diff --git a/api/main.py b/api/main.py index 60c0cba5dbdb515d5f5f4acdddfe13a55efc6208..1e51f5cd75e119575d532d816112febc6256db5e 100644 --- a/api/main.py +++ b/api/main.py @@ -1,354 +1,356 @@ -"""AIOS web API — the ONE shared, stateless process the Streamlit exit is aimed at. - -It REUSES the `royalimports_os/` data layer verbatim (nothing re-implemented): the canonical, -reconciled Odoo model stays server-side and the browser only ever sees derived JSON. Serves the -JSON API under `/api/*` and the built React bundle (`aios-web/web/dist`) at `/`. - -WHAT CHANGED IN EXIT WAVE 1 (2026-07-30) — three things, all of them load-bearing: - - * **Real sessions replace HTTP Basic.** The whole app used to sit behind one shared - `APP_PASSWORD` with the browser's native Basic prompt, which means every caller was the same - anonymous principal and no route could scope anything. Now a signed stateless cookie carries - a real `core/users` identity (X3), and every v1 route resolves BU + own-book scope from the - user RECORD. `/api/health` stays unauthenticated (liveness only). - * **The overlay fork is deleted.** `aios-web/api/data/overlay.json` was a second writable home - for user-owned fields the Streamlit app keeps in the tenant store. ONE store now (C1c). - * **The SSL shim is env-gated.** It used to run at import, unconditionally. - -⚠ TENANT RESOLUTION IS PER REQUEST (X7). Nothing tenant-shaped is held at module level; the -session's tenant claim resolves through `harness.runtime.get_runtime`, which is LRU-bounded. This -is the rule the ~30–80 MB/tenant target depends on — EXIT-0 measured the alternative at a ~0.6 GB -commit FLOOR per tenant, duplicated within 2% per tenant, nothing shared. -""" -import os -import sys -from pathlib import Path - -# --- the local Odoo SSL quirk, now BEHIND A GATE ------------------------------------------------- -# The Windows trust store reports the (valid) Odoo cert as expired, so local runs need an -# unverified default context; the HF Space and the container are unaffected. This used to run -# unconditionally at import — i.e. the shipped container disabled TLS verification for every -# outbound HTTPS call it ever made, to Odoo and to everything else, forever. That is a -# man-in-the-middle away from being someone else's data. It is now opt-in, must be set -# deliberately, and is never on by default. -# ⛔ NEVER set AIOS_INSECURE_SSL in a deployed environment. It exists for one developer laptop. -if os.environ.get("AIOS_INSECURE_SSL") == "1": - import ssl - ssl._create_default_https_context = ssl._create_unverified_context # noqa: S323 - -# --- reuse the tenant #0 data layer verbatim. RI_DIR overrides the location in the container -# (where the layout differs from the local sibling-dir default). --- -_HERE = Path(__file__).resolve() -_RI = Path(os.environ.get("RI_DIR") or (_HERE.parents[2] / "royalimports_os")) -for _p in (str(_RI), str(_HERE.parent)): - if _p not in sys.path: - sys.path.insert(0, _p) - -from dotenv import load_dotenv # noqa: E402 -load_dotenv(_RI / ".env") # Odoo creds + APP_PASSWORD, git-ignored, never committed/printed - -from fastapi import Body, Depends, FastAPI, Request # noqa: E402 -from fastapi.middleware.gzip import GZipMiddleware # noqa: E402 -from fastapi.responses import JSONResponse # noqa: E402 -from fastapi.staticfiles import StaticFiles # noqa: E402 -from starlette.exceptions import HTTPException as StarletteHTTPException # noqa: E402 - -import aios_session # noqa: E402 -import routes_admin # noqa: E402 -import routes_auth # noqa: E402 -import routes_customers # noqa: E402 -import routes_grid # noqa: E402 -import routes_nav # noqa: E402 -import routes_pages # noqa: E402 -import routes_records # noqa: E402 -from core import grid_events # noqa: E402 -from deps import Session, module_gate # noqa: E402 - -_WEB_DIST = _HERE.parents[1] / "web" / "dist" - -# --- THE CANONICAL FIELD CONTRACT: a startup assertion, and the referee gate's subject ---------- -# Every field tags its semantic TYPE and its SOURCE. `source='odoo'` is READ-ONLY (Odoo is never -# written); `source='overlay'` is the editable stratum that lives OUTSIDE Odoo. Loaded from the -# ONE canonical file shared with the embedded host (`royalimports_os/aios_grid_fields.json`), so -# embed == standalone by construction. -# -# TWO REASONS THIS IS HERE and not folded into the routes: -# 1. It FAILS LOUDLY at import when the file is missing — which means the deploy or the RI_DIR -# layout is broken, and discovering that from a 500 on the first customer request instead of -# at startup costs a debugging session. (The pre-wave main.py had this guard; the EXIT-2a -# rewrite dropped it and this restores it.) -# 2. `aios-web/verify_fields_contract.py` — the cross-side REFEREE — reads `FIELDS` and -# `_PASSTHROUGH_KEYS` from this module to prove the canonical file, `aios_grid.py` and this -# API have not drifted. The rewrite removed them and the referee went red; retargeting the -# gate would have been the wrong repair ([[gate-can-report-green-on-nothing]]: retarget, do -# not delete — but only when the subject genuinely moved. Here it should not have moved). -# -# ⚠ THE ROUTES SERVE A SUPERSET OF THIS. `routes_customers._payload` derives its field list from -# `aios_grid.fields_from_workspace(ws)`, which is `FIELDS` PLUS the session user's own custom_ and -# measure_ columns — the same list the Streamlit host renders. That is the point: the standalone -# shell now sees the user's own columns instead of the bare base contract. `FIELDS` is the -# canonical FLOOR, asserted below to be exactly what `aios_grid` starts from. -import json as _json_contract # noqa: E402 -_FIELDS_PATH = _RI / "aios_grid_fields.json" -if not _FIELDS_PATH.is_file(): - raise FileNotFoundError( - f"AIOS web API: canonical field contract missing at {_FIELDS_PATH}. Set RI_DIR to the " - "royalimports_os root (it also carries the data layer this API imports)." - ) -_contract = _json_contract.loads(_FIELDS_PATH.read_text(encoding="utf-8")) -FIELDS = _contract["fields"] if isinstance(_contract, dict) else _contract -# text/status/select/date pass through untouched; every OTHER odoo field is numeric -> rounded. -# Derived from field TYPE (not a hand-kept key list) so a new text/date field can never be -# wrongly rounded. `select` joined 2026-08-02 (dba) — a choice label rounded would be garbage. -_PASSTHROUGH_KEYS = {f["key"] for f in FIELDS - if f["source"] == "odoo" and f["type"] in ("text", "status", "select", - "date")} - -app = FastAPI(title="AIOS web API") - -# The customers payload measured 1.15 MB of JSON on the live Space, shipped UNCOMPRESSED — with -# the 754 KB bundle behind it, most of "the app is slow" was bytes on the wire. gzip takes the -# payload to ~10–15% of that. minimum_size spares the tiny acks the overhead. -app.add_middleware(GZipMiddleware, minimum_size=1024) - - -@app.exception_handler(StarletteHTTPException) -def _error_shape(request: Request, exc: StarletteHTTPException): - """ONE error shape for every non-2xx (X2): `{"error": {"code", "message"}}`. - - `deps.err` already raises detail in that shape; anything FastAPI raises on its own (a 404, a - 422 from a malformed path param) is wrapped here so a client never has to branch on two - different error bodies. - """ - detail = exc.detail - if isinstance(detail, dict) and "error" in detail: - body = detail - else: - body = {"error": {"code": f"http_{exc.status_code}", "message": str(detail)}} - return JSONResponse(body, status_code=exc.status_code, - headers=getattr(exc, "headers", None)) - - -@app.exception_handler(grid_events.StoreUnavailable) -def _store_unavailable(request: Request, exc: grid_events.StoreUnavailable): - """THE SAFETY NET for "the store is down" → 503, from anywhere. - - ⚠ WHY THIS IS APP-LEVEL AND NOT A `try` PER ROUTE. It was a try per route first, and a - `StoreUnavailable` raised while BUILDING THE PAYLOAD — before the route reached its own - try/except — surfaced as a 500. A store outage is a normal operational state and every route - here touches the store at least twice (the workspace read, then the write), so "remember to - wrap it" is a rule that gets forgotten once and then reports the wrong thing. One handler - means a store outage can only ever be a 503, whichever call raised it. - - The seam raises this only when the caller passed no `fallback_ws` — i.e. exactly on this - adapter, which has no durable session dict to degrade into. A 200 over a write that - evaporated is the failure the whole rule exists to prevent. - """ - return JSONResponse( - {"error": {"code": "store_unavailable", - "message": "the tenant store is unavailable — no change was saved"}}, - status_code=503) - - -@app.get("/api/health") -def health(): - """Unauthenticated LIVENESS only — it must answer before anyone can sign in, so it may not - reveal anything about the deployment beyond "the process is up". No version, no tenant list, - no config: a health endpoint is the one URL every scanner finds first.""" - return {"ok": True} - - -app.include_router(routes_auth.router) -app.include_router(routes_nav.router) -app.include_router(routes_customers.router) -app.include_router(routes_grid.router) -app.include_router(routes_records.router) -# EXIT wave 2: the Y1 page-data envelope (one route for every ported dashboard) and Y4's user -# administration. `routes_pages` imports `pages`, which lazily imports each `pages_*` builder — so -# a new page is a builder module plus one registry line, and nothing here changes. -app.include_router(routes_pages.router) -app.include_router(routes_admin.router) - - -# --- DEPRECATED ALIASES (removed when S2's shell flips; kept so the current bundle keeps working) -# They are the v1 handlers with the v1 session requirement — NOT the old unauthenticated Basic -# behavior. An alias that kept the old auth would be a bypass of everything above it. -_GATE = module_gate(routes_customers.MODULE) - - -@app.get("/api/customers", deprecated=True) -def _customers_alias(session: Session = Depends(_GATE)): - return routes_customers._payload(session) - - -@app.patch("/api/customers/{pid}", deprecated=True) -def _patch_alias(pid: int, body: dict = Body(default=None), - session: Session = Depends(_GATE)): - return routes_customers.patch_customer(pid, body, session) - - -def _assert_contract_floor(): - """The canonical FIELDS must be exactly what `aios_grid` starts an empty workspace from. - - This is what stops `FIELDS` becoming a constant that exists only to satisfy a gate. If the - canonical JSON and `aios_grid.fields_from_workspace({})` ever disagree, the standalone API and - the embedded host are serving two different schemas and the grid's own contract has forked — - the exact drift `verify_fields_contract.py` was written to catch, now also caught at startup - on whatever machine is actually running. - """ - import aios_grid - base = [f for f in aios_grid.fields_from_workspace({}) if not f.get("custom")] - if [f["key"] for f in base] != [f["key"] for f in FIELDS]: - raise RuntimeError( - "AIOS web API: the canonical field contract and aios_grid.fields_from_workspace({}) " - "disagree on the base field set — embed and standalone would serve different schemas. " - "Run aios-web/verify_fields_contract.py.") - - -def _startup_notes(): - """Say the two things an operator must know, once, at import — never in a response body.""" - if aios_session.EPHEMERAL_SECRET: - print("[aios-api] AIOS_SESSION_SECRET is not set — signing with a random per-process " - "key. Sessions will not survive a restart and will not work across workers. " - "Set it in production.") - if os.environ.get("AIOS_INSECURE_SSL") == "1": - print("[aios-api] AIOS_INSECURE_SSL=1 — TLS verification is DISABLED for outbound " - "requests. Local development only; never in a deployed environment.") - - -_assert_contract_floor() -_startup_notes() - - -# ⛔ THE STATIC MOUNT IS NOW UNAUTHENTICATED, and that is a change this wave made on purpose. -# Before EXIT-3a, `BasicAuth` middleware gated the WHOLE app including this mount. A branded login -# page cannot live behind a password prompt, so the shell's own assets must be public — which they -# are: `index.html`, the JS/CSS bundle and the favicon reveal nothing. -# -# ⚠ WHAT THAT SILENTLY DE-GATED, caught in review rather than in production. `web/dist/` also -# carries `sample_customers.json`, a DEV FIXTURE copied from `web/public/`. Its 8 customers are -# synthetic, but the `agent` column holds REAL EMPLOYEE NAMES, and it went from Basic-gated to -# publicly fetchable in this commit. Nothing needs it: both the API bridge and `useCustomerData` -# deleted their sample fallback on purpose ("NOTHING HERE FALLS BACK TO sample_customers.json"), -# and it survives only because it sits in `web/public/`. So it is refused here — 404, the same -# answer as any other path that is not part of the app. -# -# The right long-term fix is deleting it from `web/public/` (S2's lane — flagged in the mailbox); -# this guard is what makes the API safe regardless of what the bundle happens to contain. -_DEV_FIXTURES = {"sample_customers.json"} - - -class _AppStatic(StaticFiles): - async def get_response(self, path, scope): - if Path(path).name in _DEV_FIXTURES: - raise StarletteHTTPException(status_code=404, detail="Not Found") - resp = await super().get_response(path, scope) - # Vite content-hashes everything under assets/ (a change is a NEW url), so those are - # immutable — a repeat visit re-downloads zero bytes instead of the whole 750 KB bundle. - # index.html must stay revalidated or a deploy would strand returning browsers on the old - # bundle; ETag/304 makes that revalidation a header exchange, not a transfer. - # ⚠ Normalised first: on a Windows host StaticFiles hands this path with backslashes, - # and `startswith("assets/")` silently skipped every asset (measured on the local probe). - if path.replace("\\", "/").lstrip("/").startswith("assets/"): - resp.headers["Cache-Control"] = "public, max-age=31536000, immutable" - else: - resp.headers["Cache-Control"] = "no-cache" - return resp - - -# static bundle LAST so /api/* wins; html=True serves index.html at / plus the built assets -if _WEB_DIST.is_dir(): - app.mount("/", _AppStatic(directory=str(_WEB_DIST), html=True), name="web") - - -# --- boot prewarm (AIOS_PREWARM=1 — set by the Dockerfile, never by tests) ----------------------- -# Without this, the first visitor after every deploy/restart pays the full Odoo pool build in -# their request. The thread warms the CONSOLIDATED scope (None, None) + every registered page's -# default envelope; scoped users still pay their own scope's first build, once. -# Env-gated rather than a startup event so importing `api.main` in a gate (verify_api and friends -# run against fakes) can never fire a live Odoo pull. -def _seed_and_sync_store(): - """Bring the analytical store (harness.datastore) LIVE for this container — the app.py - bootstrap, mirrored (2026-07-31, owner item 1). - - `harness.datastore` powers every measure column/condition, and ONLY app.py used to call - `ensure_seed()` — so on a fresh Space disk this container resolved measures against a store - that never existed and every measure cell served blank. Seeding alone was NOT enough either, - and that was measured live the same day: "datastore seeded in 1.7s" followed by an endless - `api:measure-column: ModelError the data cache is still warming up` — `ready()` demands - EVERY entity at phase 'live', and a seed that predates a newer entity leaves it un-synced - forever in a process with no sync loop. The SYNC SPRINT after the seed is what closes the - write_date gap and backfills anything the seed lacks (app.py:7779's exact pattern, bounded - passes). Fail-quiet throughout: no seed/token/Odoo → the columns stay blank, the rows still - serve. - """ - import time as _t - t0 = _t.time() - try: - from harness import datastore as _ds - if _ds.ensure_seed(): - print(f"[aios-api] datastore seeded in {_t.time() - t0:.1f}s") - # DEDICATED Odoo connection for this thread (the W6 postmortem rule): the sync's - # search_reads must never interleave on the shared client's xmlrpc transport. - import core.odoo as _odoo - try: - _odoo._tlocal.client = _odoo.OdooClient() - except Exception: - pass - res = {} - for i in range(12): - res = _ds.sync_all(log=lambda *a, **k: None) - print(f"[aios-api] datastore sync pass {i + 1}: " - + ", ".join(f"{k}={v.get('phase')}" for k, v in sorted(res.items()))) - if all(v.get("phase") == "live" for v in res.values()): - break - print(f"[aios-api] datastore sync done in {_t.time() - t0:.1f}s " - f"(ready={_ds.ready()})") - except Exception as e: # noqa: BLE001 - print(f"[aios-api] datastore seed/sync skipped: {e}") - - -def _store_resync_loop(): - """Keep the analytical mirror current — the API-process stand-in for the re-sync the - Streamlit app piggybacks on page renders. Measure memos key on the pool stamp, so a - refreshed pool re-reads the freshly synced store.""" - import time as _t - while True: - _t.sleep(1800) - try: - from harness import datastore as _ds - import core.odoo as _odoo - try: - _odoo._tlocal.client = _odoo.OdooClient() - except Exception: - pass - _ds.sync_all(log=lambda *a, **k: None) - except Exception as e: # noqa: BLE001 - print(f"[aios-api] store resync failed: {e}") - - -def _prewarm(): - import time as _t - t0 = _t.time() - # ⚠ The store sync runs in its OWN thread, never ahead of the pool warm: a stale seed can - # take many minutes of XML-RPC to close, and the first live probe of this arrangement - # showed the pool warm (42s) silently queued behind it — the whole app cold for every - # visitor while a background column channel caught up. Measure cells retry via the - # transient rule until the sync lands; nothing else waits on it. - import threading as _th - _th.Thread(target=_seed_and_sync_store, daemon=True, name="store-seed-sync").start() - try: - from harness import runtime as _runtime - rt = _runtime.get_runtime("royal-imports") - routes_customers.warm_default(rt) - import pages as _pages - _pages.warm_default(rt) - print(f"[aios-api] prewarm done in {_t.time() - t0:.1f}s") - except Exception as e: # noqa: BLE001 — boot must not die on a warm-up - print(f"[aios-api] prewarm skipped: {e}") - - -if os.environ.get("AIOS_PREWARM") == "1": - import threading as _threading - _threading.Thread(target=_prewarm, daemon=True, name="prewarm").start() - _threading.Thread(target=_store_resync_loop, daemon=True, name="store-resync").start() +"""AIOS web API — the ONE shared, stateless process the Streamlit exit is aimed at. + +It REUSES the `royalimports_os/` data layer verbatim (nothing re-implemented): the canonical, +reconciled Odoo model stays server-side and the browser only ever sees derived JSON. Serves the +JSON API under `/api/*` and the built React bundle (`aios-web/web/dist`) at `/`. + +WHAT CHANGED IN EXIT WAVE 1 (2026-07-30) — three things, all of them load-bearing: + + * **Real sessions replace HTTP Basic.** The whole app used to sit behind one shared + `APP_PASSWORD` with the browser's native Basic prompt, which means every caller was the same + anonymous principal and no route could scope anything. Now a signed stateless cookie carries + a real `core/users` identity (X3), and every v1 route resolves BU + own-book scope from the + user RECORD. `/api/health` stays unauthenticated (liveness only). + * **The overlay fork is deleted.** `aios-web/api/data/overlay.json` was a second writable home + for user-owned fields the Streamlit app keeps in the tenant store. ONE store now (C1c). + * **The SSL shim is env-gated.** It used to run at import, unconditionally. + +⚠ TENANT RESOLUTION IS PER REQUEST (X7). Nothing tenant-shaped is held at module level; the +session's tenant claim resolves through `harness.runtime.get_runtime`, which is LRU-bounded. This +is the rule the ~30–80 MB/tenant target depends on — EXIT-0 measured the alternative at a ~0.6 GB +commit FLOOR per tenant, duplicated within 2% per tenant, nothing shared. +""" +import os +import sys +from pathlib import Path + +# --- the local Odoo SSL quirk, now BEHIND A GATE ------------------------------------------------- +# The Windows trust store reports the (valid) Odoo cert as expired, so local runs need an +# unverified default context; the HF Space and the container are unaffected. This used to run +# unconditionally at import — i.e. the shipped container disabled TLS verification for every +# outbound HTTPS call it ever made, to Odoo and to everything else, forever. That is a +# man-in-the-middle away from being someone else's data. It is now opt-in, must be set +# deliberately, and is never on by default. +# ⛔ NEVER set AIOS_INSECURE_SSL in a deployed environment. It exists for one developer laptop. +if os.environ.get("AIOS_INSECURE_SSL") == "1": + import ssl + ssl._create_default_https_context = ssl._create_unverified_context # noqa: S323 + +# --- reuse the tenant #0 data layer verbatim. RI_DIR overrides the location in the container +# (where the layout differs from the local sibling-dir default). --- +_HERE = Path(__file__).resolve() +_RI = Path(os.environ.get("RI_DIR") or (_HERE.parents[2] / "royalimports_os")) +for _p in (str(_RI), str(_HERE.parent)): + if _p not in sys.path: + sys.path.insert(0, _p) + +from dotenv import load_dotenv # noqa: E402 +load_dotenv(_RI / ".env") # Odoo creds + APP_PASSWORD, git-ignored, never committed/printed + +from fastapi import Body, Depends, FastAPI, Request # noqa: E402 +from fastapi.middleware.gzip import GZipMiddleware # noqa: E402 +from fastapi.responses import JSONResponse # noqa: E402 +from fastapi.staticfiles import StaticFiles # noqa: E402 +from starlette.exceptions import HTTPException as StarletteHTTPException # noqa: E402 + +import aios_session # noqa: E402 +import routes_admin # noqa: E402 +import routes_auth # noqa: E402 +import routes_customers # noqa: E402 +import routes_grid # noqa: E402 +import routes_nav # noqa: E402 +import routes_pages # noqa: E402 +import routes_products # noqa: E402 (wave 15 C-TOPIC — gated, not yet in the nav) +import routes_records # noqa: E402 +from core import grid_events # noqa: E402 +from deps import Session, module_gate # noqa: E402 + +_WEB_DIST = _HERE.parents[1] / "web" / "dist" + +# --- THE CANONICAL FIELD CONTRACT: a startup assertion, and the referee gate's subject ---------- +# Every field tags its semantic TYPE and its SOURCE. `source='odoo'` is READ-ONLY (Odoo is never +# written); `source='overlay'` is the editable stratum that lives OUTSIDE Odoo. Loaded from the +# ONE canonical file shared with the embedded host (`royalimports_os/aios_grid_fields.json`), so +# embed == standalone by construction. +# +# TWO REASONS THIS IS HERE and not folded into the routes: +# 1. It FAILS LOUDLY at import when the file is missing — which means the deploy or the RI_DIR +# layout is broken, and discovering that from a 500 on the first customer request instead of +# at startup costs a debugging session. (The pre-wave main.py had this guard; the EXIT-2a +# rewrite dropped it and this restores it.) +# 2. `aios-web/verify_fields_contract.py` — the cross-side REFEREE — reads `FIELDS` and +# `_PASSTHROUGH_KEYS` from this module to prove the canonical file, `aios_grid.py` and this +# API have not drifted. The rewrite removed them and the referee went red; retargeting the +# gate would have been the wrong repair ([[gate-can-report-green-on-nothing]]: retarget, do +# not delete — but only when the subject genuinely moved. Here it should not have moved). +# +# ⚠ THE ROUTES SERVE A SUPERSET OF THIS. `routes_customers._payload` derives its field list from +# `aios_grid.fields_from_workspace(ws)`, which is `FIELDS` PLUS the session user's own custom_ and +# measure_ columns — the same list the Streamlit host renders. That is the point: the standalone +# shell now sees the user's own columns instead of the bare base contract. `FIELDS` is the +# canonical FLOOR, asserted below to be exactly what `aios_grid` starts from. +import json as _json_contract # noqa: E402 +_FIELDS_PATH = _RI / "aios_grid_fields.json" +if not _FIELDS_PATH.is_file(): + raise FileNotFoundError( + f"AIOS web API: canonical field contract missing at {_FIELDS_PATH}. Set RI_DIR to the " + "royalimports_os root (it also carries the data layer this API imports)." + ) +_contract = _json_contract.loads(_FIELDS_PATH.read_text(encoding="utf-8")) +FIELDS = _contract["fields"] if isinstance(_contract, dict) else _contract +# text/status/select/date pass through untouched; every OTHER odoo field is numeric -> rounded. +# Derived from field TYPE (not a hand-kept key list) so a new text/date field can never be +# wrongly rounded. `select` joined 2026-08-02 (dba) — a choice label rounded would be garbage. +_PASSTHROUGH_KEYS = {f["key"] for f in FIELDS + if f["source"] == "odoo" and f["type"] in ("text", "status", "select", + "date")} + +app = FastAPI(title="AIOS web API") + +# The customers payload measured 1.15 MB of JSON on the live Space, shipped UNCOMPRESSED — with +# the 754 KB bundle behind it, most of "the app is slow" was bytes on the wire. gzip takes the +# payload to ~10–15% of that. minimum_size spares the tiny acks the overhead. +app.add_middleware(GZipMiddleware, minimum_size=1024) + + +@app.exception_handler(StarletteHTTPException) +def _error_shape(request: Request, exc: StarletteHTTPException): + """ONE error shape for every non-2xx (X2): `{"error": {"code", "message"}}`. + + `deps.err` already raises detail in that shape; anything FastAPI raises on its own (a 404, a + 422 from a malformed path param) is wrapped here so a client never has to branch on two + different error bodies. + """ + detail = exc.detail + if isinstance(detail, dict) and "error" in detail: + body = detail + else: + body = {"error": {"code": f"http_{exc.status_code}", "message": str(detail)}} + return JSONResponse(body, status_code=exc.status_code, + headers=getattr(exc, "headers", None)) + + +@app.exception_handler(grid_events.StoreUnavailable) +def _store_unavailable(request: Request, exc: grid_events.StoreUnavailable): + """THE SAFETY NET for "the store is down" → 503, from anywhere. + + ⚠ WHY THIS IS APP-LEVEL AND NOT A `try` PER ROUTE. It was a try per route first, and a + `StoreUnavailable` raised while BUILDING THE PAYLOAD — before the route reached its own + try/except — surfaced as a 500. A store outage is a normal operational state and every route + here touches the store at least twice (the workspace read, then the write), so "remember to + wrap it" is a rule that gets forgotten once and then reports the wrong thing. One handler + means a store outage can only ever be a 503, whichever call raised it. + + The seam raises this only when the caller passed no `fallback_ws` — i.e. exactly on this + adapter, which has no durable session dict to degrade into. A 200 over a write that + evaporated is the failure the whole rule exists to prevent. + """ + return JSONResponse( + {"error": {"code": "store_unavailable", + "message": "the tenant store is unavailable — no change was saved"}}, + status_code=503) + + +@app.get("/api/health") +def health(): + """Unauthenticated LIVENESS only — it must answer before anyone can sign in, so it may not + reveal anything about the deployment beyond "the process is up". No version, no tenant list, + no config: a health endpoint is the one URL every scanner finds first.""" + return {"ok": True} + + +app.include_router(routes_auth.router) +app.include_router(routes_nav.router) +app.include_router(routes_customers.router) +app.include_router(routes_products.router) +app.include_router(routes_grid.router) +app.include_router(routes_records.router) +# EXIT wave 2: the Y1 page-data envelope (one route for every ported dashboard) and Y4's user +# administration. `routes_pages` imports `pages`, which lazily imports each `pages_*` builder — so +# a new page is a builder module plus one registry line, and nothing here changes. +app.include_router(routes_pages.router) +app.include_router(routes_admin.router) + + +# --- DEPRECATED ALIASES (removed when S2's shell flips; kept so the current bundle keeps working) +# They are the v1 handlers with the v1 session requirement — NOT the old unauthenticated Basic +# behavior. An alias that kept the old auth would be a bypass of everything above it. +_GATE = module_gate(routes_customers.MODULE) + + +@app.get("/api/customers", deprecated=True) +def _customers_alias(session: Session = Depends(_GATE)): + return routes_customers._payload(session) + + +@app.patch("/api/customers/{pid}", deprecated=True) +def _patch_alias(pid: int, body: dict = Body(default=None), + session: Session = Depends(_GATE)): + return routes_customers.patch_customer(pid, body, session) + + +def _assert_contract_floor(): + """The canonical FIELDS must be exactly what `aios_grid` starts an empty workspace from. + + This is what stops `FIELDS` becoming a constant that exists only to satisfy a gate. If the + canonical JSON and `aios_grid.fields_from_workspace({})` ever disagree, the standalone API and + the embedded host are serving two different schemas and the grid's own contract has forked — + the exact drift `verify_fields_contract.py` was written to catch, now also caught at startup + on whatever machine is actually running. + """ + import aios_grid + base = [f for f in aios_grid.fields_from_workspace({}) if not f.get("custom")] + if [f["key"] for f in base] != [f["key"] for f in FIELDS]: + raise RuntimeError( + "AIOS web API: the canonical field contract and aios_grid.fields_from_workspace({}) " + "disagree on the base field set — embed and standalone would serve different schemas. " + "Run aios-web/verify_fields_contract.py.") + + +def _startup_notes(): + """Say the two things an operator must know, once, at import — never in a response body.""" + if aios_session.EPHEMERAL_SECRET: + print("[aios-api] AIOS_SESSION_SECRET is not set — signing with a random per-process " + "key. Sessions will not survive a restart and will not work across workers. " + "Set it in production.") + if os.environ.get("AIOS_INSECURE_SSL") == "1": + print("[aios-api] AIOS_INSECURE_SSL=1 — TLS verification is DISABLED for outbound " + "requests. Local development only; never in a deployed environment.") + + +_assert_contract_floor() +_startup_notes() + + +# ⛔ THE STATIC MOUNT IS NOW UNAUTHENTICATED, and that is a change this wave made on purpose. +# Before EXIT-3a, `BasicAuth` middleware gated the WHOLE app including this mount. A branded login +# page cannot live behind a password prompt, so the shell's own assets must be public — which they +# are: `index.html`, the JS/CSS bundle and the favicon reveal nothing. +# +# ⚠ WHAT THAT SILENTLY DE-GATED, caught in review rather than in production. `web/dist/` also +# carries `sample_customers.json`, a DEV FIXTURE copied from `web/public/`. Its 8 customers are +# synthetic, but the `agent` column holds REAL EMPLOYEE NAMES, and it went from Basic-gated to +# publicly fetchable in this commit. Nothing needs it: both the API bridge and `useCustomerData` +# deleted their sample fallback on purpose ("NOTHING HERE FALLS BACK TO sample_customers.json"), +# and it survives only because it sits in `web/public/`. So it is refused here — 404, the same +# answer as any other path that is not part of the app. +# +# The right long-term fix is deleting it from `web/public/` (S2's lane — flagged in the mailbox); +# this guard is what makes the API safe regardless of what the bundle happens to contain. +_DEV_FIXTURES = {"sample_customers.json"} + + +class _AppStatic(StaticFiles): + async def get_response(self, path, scope): + if Path(path).name in _DEV_FIXTURES: + raise StarletteHTTPException(status_code=404, detail="Not Found") + resp = await super().get_response(path, scope) + # Vite content-hashes everything under assets/ (a change is a NEW url), so those are + # immutable — a repeat visit re-downloads zero bytes instead of the whole 750 KB bundle. + # index.html must stay revalidated or a deploy would strand returning browsers on the old + # bundle; ETag/304 makes that revalidation a header exchange, not a transfer. + # ⚠ Normalised first: on a Windows host StaticFiles hands this path with backslashes, + # and `startswith("assets/")` silently skipped every asset (measured on the local probe). + if path.replace("\\", "/").lstrip("/").startswith("assets/"): + resp.headers["Cache-Control"] = "public, max-age=31536000, immutable" + else: + resp.headers["Cache-Control"] = "no-cache" + return resp + + +# static bundle LAST so /api/* wins; html=True serves index.html at / plus the built assets +if _WEB_DIST.is_dir(): + app.mount("/", _AppStatic(directory=str(_WEB_DIST), html=True), name="web") + + +# --- boot prewarm (AIOS_PREWARM=1 — set by the Dockerfile, never by tests) ----------------------- +# Without this, the first visitor after every deploy/restart pays the full Odoo pool build in +# their request. The thread warms the CONSOLIDATED scope (None, None) + every registered page's +# default envelope; scoped users still pay their own scope's first build, once. +# Env-gated rather than a startup event so importing `api.main` in a gate (verify_api and friends +# run against fakes) can never fire a live Odoo pull. +def _seed_and_sync_store(): + """Bring the analytical store (harness.datastore) LIVE for this container — the app.py + bootstrap, mirrored (2026-07-31, owner item 1). + + `harness.datastore` powers every measure column/condition, and ONLY app.py used to call + `ensure_seed()` — so on a fresh Space disk this container resolved measures against a store + that never existed and every measure cell served blank. Seeding alone was NOT enough either, + and that was measured live the same day: "datastore seeded in 1.7s" followed by an endless + `api:measure-column: ModelError the data cache is still warming up` — `ready()` demands + EVERY entity at phase 'live', and a seed that predates a newer entity leaves it un-synced + forever in a process with no sync loop. The SYNC SPRINT after the seed is what closes the + write_date gap and backfills anything the seed lacks (app.py:7779's exact pattern, bounded + passes). Fail-quiet throughout: no seed/token/Odoo → the columns stay blank, the rows still + serve. + """ + import time as _t + t0 = _t.time() + try: + from harness import datastore as _ds + if _ds.ensure_seed(): + print(f"[aios-api] datastore seeded in {_t.time() - t0:.1f}s") + # DEDICATED Odoo connection for this thread (the W6 postmortem rule): the sync's + # search_reads must never interleave on the shared client's xmlrpc transport. + import core.odoo as _odoo + try: + _odoo._tlocal.client = _odoo.OdooClient() + except Exception: + pass + res = {} + for i in range(12): + res = _ds.sync_all(log=lambda *a, **k: None) + print(f"[aios-api] datastore sync pass {i + 1}: " + + ", ".join(f"{k}={v.get('phase')}" for k, v in sorted(res.items()))) + if all(v.get("phase") == "live" for v in res.values()): + break + print(f"[aios-api] datastore sync done in {_t.time() - t0:.1f}s " + f"(ready={_ds.ready()})") + except Exception as e: # noqa: BLE001 + print(f"[aios-api] datastore seed/sync skipped: {e}") + + +def _store_resync_loop(): + """Keep the analytical mirror current — the API-process stand-in for the re-sync the + Streamlit app piggybacks on page renders. Measure memos key on the pool stamp, so a + refreshed pool re-reads the freshly synced store.""" + import time as _t + while True: + _t.sleep(1800) + try: + from harness import datastore as _ds + import core.odoo as _odoo + try: + _odoo._tlocal.client = _odoo.OdooClient() + except Exception: + pass + _ds.sync_all(log=lambda *a, **k: None) + except Exception as e: # noqa: BLE001 + print(f"[aios-api] store resync failed: {e}") + + +def _prewarm(): + import time as _t + t0 = _t.time() + # ⚠ The store sync runs in its OWN thread, never ahead of the pool warm: a stale seed can + # take many minutes of XML-RPC to close, and the first live probe of this arrangement + # showed the pool warm (42s) silently queued behind it — the whole app cold for every + # visitor while a background column channel caught up. Measure cells retry via the + # transient rule until the sync lands; nothing else waits on it. + import threading as _th + _th.Thread(target=_seed_and_sync_store, daemon=True, name="store-seed-sync").start() + try: + from harness import runtime as _runtime + rt = _runtime.get_runtime("royal-imports") + routes_customers.warm_default(rt) + import pages as _pages + _pages.warm_default(rt) + print(f"[aios-api] prewarm done in {_t.time() - t0:.1f}s") + except Exception as e: # noqa: BLE001 — boot must not die on a warm-up + print(f"[aios-api] prewarm skipped: {e}") + + +if os.environ.get("AIOS_PREWARM") == "1": + import threading as _threading + _threading.Thread(target=_prewarm, daemon=True, name="prewarm").start() + _threading.Thread(target=_store_resync_loop, daemon=True, name="store-resync").start() diff --git a/api/pages.py b/api/pages.py index 23e776bcbbf6a99fbd5bf887b53b8fede43c7be0..726dd39f8b03fff2b7c7180b5af148e986187c1c 100644 --- a/api/pages.py +++ b/api/pages.py @@ -301,14 +301,20 @@ def register(key, builder): def builder_for(key): """The builder for `key`, or None. A missing key is a 404 at the route — NOT a 403: an - unported page is a fact about our roadmap, not about this user's grants.""" - if not _BUILDERS: - import pages_sales # noqa: F401 (self-registers on import) + unported page is a fact about our roadmap, not about this user's grants. + + ⚠ Wave 16 (owner item 7, R3/R11): `pages_sales` is UNREGISTERED — the lazy self-import + that used to live here is gone, so a production process holds ZERO builders and every + /pages/{key} is a 404 until the next surface (Collections / Procurement) registers. + The registry mechanism itself is untouched: a future builder self-registers on import, + and routes_pages.py should import it at module level so deploy_web.py's import walk can + see it (the wave-9 missing-module scar). pages_sales.py stays on disk as the template + and as verify_api section G's fixture — the gate imports it explicitly. + """ return _BUILDERS.get(str(key or "").strip().lower()) def known_pages(): - builder_for("") # force the lazy import return sorted(_BUILDERS) diff --git a/api/routes_admin.py b/api/routes_admin.py index 05b37f7580f45faddf8f27a085c65e8dc8b138e3..e6983e601447a1fc85ac2add33c4d61cc1eb1a12 100644 --- a/api/routes_admin.py +++ b/api/routes_admin.py @@ -93,7 +93,36 @@ def _view(uname, rec): "active": bool(rec.get("active", True)), # The session-revocation handle. An admin needs it: it is the only visible evidence # that "sign them out everywhere" actually happened. - "epoch": int(rec.get("epoch") or 0)} + "epoch": int(rec.get("epoch") or 0), + # S3 ask 4 — one sentence for the roster's Access column, so the list does not need + # a /perms round trip per row to fill one cell. Computed from the same record the + # editor will open, so the two cannot disagree. + "accessSummary": _access_summary(rec), + "perms_v": int(rec.get("perms_v") or 0)} + + +def _access_summary(rec): + """One sentence describing what this account may reach. Deliberately says LESS than the + editor: it is a signpost, not a rule listing, and a summary that tried to spell out filters + would be wrong the moment a filter got interesting.""" + import core.perm_scope as perm_scope + + if perms.is_admin(rec): + # amendment 4: an admin bypasses `perms` entirely, so rendering their stored rules as if + # they applied is the one misreading of that clause that could actually hurt. + return "Everything (admin)" + if not perm_scope.is_migrated(rec): + mods = perms.allowed_modules(rec) + return "All modules (legacy rules)" if mods is None else \ + f"{len(mods)} module{'' if len(mods) == 1 else 's'} (legacy rules)" + entries = (rec.get("perms") or {}) + opened = [k for k, e in entries.items() if isinstance(e, dict) and e.get("access", True)] + restricted = sum(1 for k in opened + if (entries[k].get("filter") or entries[k].get("hiddenFields"))) + if not opened: + return "No modules" + base = f"{len(opened)} module{'' if len(opened) == 1 else 's'}" + return f"{base}, {restricted} restricted" if restricted else base # ── request validation: every rule below is fail-closed ────────────────────────────────────────── @@ -299,6 +328,386 @@ def set_password(username: str, body: dict = Body(default=None), return Response(status_code=204) +# ── C-PERM (wave 15): per-module access + permanent filters + hidden fields ────────────────── +#: The modules the permission editor governs — the GRID surfaces, the ones with a field schema +#: to filter and hide. Amendment 6 ships the wall on `customer_data` alone and adds +#: `product_data` when C-TOPIC lands; the list is the one place that changes. +_PERM_MODULES = ("customer_data",) + + +def _module_fields(key): + """The field schema the editor builds its pickers from — the SAME vocabulary the grid uses, + so an admin filters on exactly what the user sees. + + ⛔ Returned WITHOUT any per-user hiding applied, deliberately: this is the admin choosing + what to hide, so hiding the choices would make a field unhideable the moment it was hidden + once for somebody. The route is admin-gated; the projection a MEMBER receives is the one + `perm_scope.visible_fields` narrows. + """ + import aios_grid + out = [] + for f in aios_grid.FIELDS: + if not isinstance(f, dict) or not f.get("key"): + continue + out.append({"key": f["key"], "label": f.get("label") or f["key"], + "type": f.get("type") or "text", + **({"options": f["options"]} if isinstance(f.get("options"), list) else {})}) + return out + + +def _clean_perms(v): + """Validate a whole `perms` block. FAIL-CLOSED, and LOUD rather than lenient. + + ⛔ WHY THIS REFUSES WHERE `clean_filter_tree` DROPS. The view sanitiser is deliberately + drop-per-node: one bad rule must never cost a user their whole saved view. A PERMISSION + filter is the opposite situation — an admin types "agent is Tara", a leaf is silently + dropped, and the stored wall is EMPTY. The admin sees "Saved", the account sees the whole + book, and nothing anywhere says so. So anything that would be dropped is a 400 instead: + the filter is re-validated with `clean_filter_tree` and the result must come back with the + SAME leaf count it went in with. + + Shape (C-PERM amendment 2 — a `FilterTree` is a PAIR, `{conj?, nodes}`; `clean_filter_tree` + validates the NODE LIST alone and never sees the root conjunction, so the two are checked + separately and a bare node list is refused rather than silently read as `and`). + """ + import aios_grid + + if v is None: + return None + if not isinstance(v, dict): + raise err(400, "bad_perms", "perms must be an object keyed by module") + unknown = sorted(set(v) - set(_PERM_MODULES)) + if unknown: + raise err(400, "bad_perms", + f"unknown module keys: {unknown} — the permission editor governs " + f"{list(_PERM_MODULES)}") + out = {} + for key, raw in v.items(): + if not isinstance(raw, dict): + raise err(400, "bad_perms", f"{key}: each entry must be an object") + valid_keys = {f["key"] for f in _module_fields(key)} + hidden = raw.get("hiddenFields") or [] + if not isinstance(hidden, list): + raise err(400, "bad_perms", f"{key}: hiddenFields must be a list") + bad = sorted({str(h) for h in hidden} - valid_keys) + if bad: + # A hiddenFields entry naming nothing hides nothing — and reads as a restriction + # that is not there. + raise err(400, "bad_perms", + f"{key}: hiddenFields names unknown fields {bad}") + tree = raw.get("filter") + clean_tree = None + if tree not in (None, {}, []): + if not isinstance(tree, dict) or not isinstance(tree.get("nodes"), list): + raise err(400, "bad_filter", + f"{key}: filter must be {{conj?, nodes:[…]}} — a bare list would lose " + f"the root conjunction, and an 'or' wall read as 'and' restricts " + f"nothing it was meant to") + conj = tree.get("conj", "and") + if conj not in ("and", "or"): + raise err(400, "bad_filter", f"{key}: conj must be 'and' or 'or'") + nodes = tree["nodes"] + cleaned = aios_grid.clean_filter_tree(nodes, valid_keys, cohort_ids=None) + if _leaf_count(cleaned) != _leaf_count(nodes): + raise err(400, "bad_filter", + f"{key}: the filter contains conditions this module cannot evaluate " + f"(an unknown field, an unknown operator, or a cohort leaf — cohorts " + f"are per-user and cannot be a permanent rule). Refused rather than " + f"saved with the bad conditions silently removed, which would store a " + f"weaker wall than the one on screen.") + clean_tree = {"conj": conj, "nodes": cleaned} + out[key] = {"access": bool(raw.get("access", True)), + "filter": clean_tree, + "hiddenFields": sorted({str(h) for h in hidden})} + _refuse_unshapeable_bu(out) + return out + + +def _refuse_unshapeable_bu(perms_out): + """⛔ A BU CONDITION THE PUSHDOWN CANNOT READ IS A VALUE LEAK WEARING A CORRECT ROW LIST. + + Amendment 3 in one more place. `perm_scope.derive_pool_scope` recognises exactly the shapes + that PIN a business unit: a top-level `dba eq` leaf, or a top-level OR-group of them — which + is what `perm_migrate` emits and what the condition builder produces for "is any of". An + admin composing the same intent a slightly different way (a NESTED group, `dba neq Royal`, a + `dba` leaf one level down) produces a filter that still narrows the ROWS correctly through + `permits()` — and leaves the pool built CONSOLIDATED, so every surviving row carries + Fisch+Royal numbers. The row list looks right. The revenue is another BU's. + + That is precisely the defect amendment 3 exists for, re-entering through the editor R9 just + shipped, and it cannot be caught downstream: by then the numbers are simply wrong, with + nothing anomalous about them. + + So it is refused at the WRITE, where a person is present to fix it. The discriminator is + narrow on purpose — the filter must MENTION `dba` and must fail to pin a team. A wall like + `dba is Fisch OR revenue > 1000` genuinely does not confine anyone to one BU, and + consolidated values are the correct answer for it, so it is not caught here (`derive` also + refuses it) and must not be. + """ + import core.perm_scope as perm_scope + + for key, e in perms_out.items(): + tree = e.get("filter") + if not tree or not _mentions_dba(tree.get("nodes")): + continue + probe = {"role": "user", "perms_v": perm_scope.PERMS_VERSION, + "perms": {key: {"access": True, "filter": tree, "hiddenFields": []}}} + team_id, _ = perm_scope.derive_pool_scope(probe, key) + if team_id is None and _confines_to_one_bu(tree): + raise err(400, "bu_condition_shape", + f"{key}: this filter restricts the business unit in a way the data layer " + f"cannot push into the query, so the rows would be correct while the " + f"revenue figures on them stayed consolidated across both units. Express " + f"the business-unit condition as a TOP-LEVEL condition — 'DBA is Fisch', " + f"or an 'any of' over the brands — and keep any other rules alongside it.") + + +def _guard_bu_widening(rec, cleaned, confirmed): + """⛔ THE TWO-CLICK LEAK: a SECOND save that silently drops the business-unit condition. + + `_fold_legacy_scope` runs only while a record is un-migrated, which is correct — after the + first save the filter IS the whole wall and the admin owns it. But the first save also + CHANGES the tree (it folds the BU condition in), so a client holding the tree it submitted + rather than the one the server returned will, on its next save, PUT a payload with no BU + condition — and a whole-record replace deletes it. Measured, not theorised: the same client + payload saved twice takes the pool scope from `(6, 'Ann')` to `(None, 'Ann')`, which is both + business units. + + So a save that REMOVES the brand confinement is refused unless it says it means to. Widening + BU access is a legitimate thing for an administrator to do — it is just never a thing to do + by accident, and the difference between the two is one explicit flag. + + ⚠ Deliberately NOT solved by always folding the legacy scope: that would make a BU + restriction permanent and unremovable, which contradicts R1 (the filter is the wall, and the + admin edits it). The right shape is "you may widen, say so". + """ + import core.perm_scope as perm_scope + + if confirmed: + return + stored = (rec.get("perms") or {}) if isinstance(rec.get("perms"), dict) else {} + for key, new_entry in cleaned.items(): + if not new_entry.get("access", True): + # Revoking the module entirely is the OPPOSITE of widening, and the filter on a + # denied entry governs nothing. Guarding it would make "lock this account out" + # require a confirm_widen flag, which reads as nonsense to whoever hits it. + continue + old = stored.get(key) + if not isinstance(old, dict): + continue # nothing stored yet: the fold already handled it + old_tree, new_tree = old.get("filter"), new_entry.get("filter") + if not old_tree or not _confines_to_one_bu(old_tree): + continue # was not confined -> this save cannot widen it + if new_tree and _confines_to_one_bu(new_tree): + continue # still confined -> not a widening + raise err(400, "bu_widening", + f"{key}: this would REMOVE the business-unit restriction and give the account " + f"both units. If that is intended, resend with confirm_widen: true. If it is " + f"not, reload the account's permissions first — saving a filter loaded before " + f"the last change drops the conditions it did not know about.") + # A guard is only as good as its trigger: `perm_scope` is imported so a future reader sees + # the connection to derive_pool_scope, which is what the removed condition was feeding. + _ = perm_scope + + +def _mentions_dba(nodes): + for n in nodes or (): + if not isinstance(n, dict): + continue + if isinstance(n.get("children"), list): + if _mentions_dba(n["children"]): + return True + elif n.get("colId") == "dba": + return True + return False + + +def _confines_to_one_bu(tree): + """Does the BRAND STRUCTURE ALONE confine the reader to one business unit? + + ⚠ "Alone" is the whole precision of this function, and getting it wrong makes the guard + refuse legitimate walls. `dba is Fisch OR ar_open > 1000` does NOT confine anybody — a + high-balance Royal customer satisfies it — so consolidated values are the correct answer and + refusing it would be a false positive. My first attempt evaluated synthetic rows carrying + only `dba`, which made `ar_open > 1000` read false on every probe row and turned that exact + wall into a "confinement" it is not. + + So every NON-`dba` leaf is treated as TRUE — the most generous reading, i.e. "suppose the + reader satisfies everything else; can they still see both brands?" If yes, the wall does not + confine and the pool is correctly consolidated. If no, the brand structure is doing the + confining and `derive_pool_scope` must be able to see it, or the numbers are wrong. + """ + def admits(node, brand): + if isinstance(node.get("children"), list): + kids = [admits(k, brand) for k in node["children"] if isinstance(k, dict)] + if not kids: + return True + return any(kids) if node.get("conj") == "or" else all(kids) + if node.get("colId") != "dba": + return True # every other condition: assume satisfied + want = str(node.get("value") or "").strip().lower() + op = node.get("op") + if op == "eq": + return brand.lower() == want + if op == "neq": + return brand.lower() != want + if op == "contains": + return want in brand.lower() + if op == "doesNotContain": + return want not in brand.lower() + if op == "isEmpty": + return False # a probe brand is never blank + if op == "isNotEmpty": + return True + return True # an op that cannot judge a brand does not confine + + nodes, conj = (tree.get("nodes") or []), tree.get("conj", "and") + root = {"conj": conj, "children": nodes} + admitted = {b for b in ("Fisch", "Royal", "Both") if admits(root, b)} + if not admitted: + return False # admits nothing at all — a different problem + # 'Both' belongs to either unit, so it cannot by itself widen the answer. + return not ({"Fisch", "Royal"} <= admitted) + + +def _leaf_count(nodes): + n = 0 + for node in nodes or (): + if isinstance(node, dict) and isinstance(node.get("children"), list): + n += _leaf_count(node["children"]) + else: + n += 1 + return n + + +def _fold_legacy_scope(rec, cleaned): + """⛔ MIGRATING A RECORD MUST NEVER WIDEN IT. The invariant this function exists to hold. + + Writing perms stamps `perms_v: 1`, and that marker SWITCHES OFF the legacy `bus`/`agent` + fallback in `perm_scope` (amendment 4 — absence must start meaning DENY). So a first write + whose filter carries no BU condition silently promotes a Royal-only account to BOTH business + units: the wall that used to come from `bus` is gone and nothing replaced it. + + Caught by the end-to-end leg in `verify_api` and by nothing else — every model-level check + passed, because the model was doing exactly what it was told. The account simply received + the other BU's customers on the wire. + + So on the FIRST perms write we fold the legacy scope in, as ordinary conditions, exactly as + `perm_migrate` would: this IS R1's migration, performed at the moment the record acquires a + perms block. From then on the admin sees those leaves in the editor (GET returns the folded + filter) and can change them like any other condition — which is R1's whole point, and why + this is a one-time fold rather than a permanent floor AND-ed on every write. + + Idempotent by construction: it runs only while the record is un-migrated, and the write that + calls it is the write that migrates it. + """ + import core.perm_migrate as perm_migrate + import core.perm_scope as perm_scope + + if perm_scope.is_migrated(rec): + return cleaned + legacy = perm_migrate.filter_for(rec) + if not legacy: + return cleaned # nothing to preserve: the account was unrestricted + out = {} + for key, e in cleaned.items(): + tree = e.get("filter") + if not tree or not tree.get("nodes"): + folded = legacy + else: + # AND the two roots together. The submitted tree keeps its own conjunction by being + # nested as a GROUP — flattening an `or` tree into an `and` root would turn the + # admin's "A or B" into "A and B", which is a different and much narrower wall. + folded = {"conj": "and", + "nodes": list(legacy["nodes"]) + [{"conj": tree.get("conj", "and"), + "children": list(tree["nodes"])}]} + out[key] = dict(e, filter=folded) + return out + + +@router.get("/admin/users/{username}/perms") +def get_perms(username: str, session: Session = Depends(admin_gate)): + """This account's permission block plus the field schema the editor needs to render it.""" + reg = _registry() + uname = str(username or "").strip().lower() + if uname not in reg: + raise err(404, "no_such_user", f"no account named {uname!r}") + import core.perm_scope as perm_scope + + rec = reg[uname] + stored = rec.get("perms") or {} + # S3 ask 3 — AN ENTRY FOR EVERY DECLARED MODULE, never a gap the client has to default. + # The PUT is a whole-record replace over this same module list, so a key declared here and + # omitted from `perms` would become an explicit DENY the moment anyone pressed Save. The + # default sent is the EFFECTIVE one (`may_access`), so an un-migrated record shows the + # access its legacy grant currently gives rather than a guess in either direction. + perms_out = {} + for k in _PERM_MODULES: + e = stored.get(k) + perms_out[k] = e if isinstance(e, dict) else { + "access": bool(perm_scope.may_access(rec, k)), "filter": None, "hiddenFields": []} + return {"username": uname, + "perms": perms_out, + # S3 ask 2 — the marker rides the GET. An absent module entry means DENY on a + # migrated record and LEGACY on an un-migrated one: opposite meanings for identical + # JSON, so the client cannot render honestly without knowing which world it is in. + "perms_v": int(rec.get("perms_v") or 0), + # `role == 'admin'` bypasses perms entirely (amendment 4) — sent so the editor can + # say "Everything (admin)" instead of rendering stored rules that do not apply. + "is_admin": perms.is_admin(rec), + "modules": [{"key": k, "label": _MODULE_LABELS.get(k, k)} for k in _PERM_MODULES], + # S3 ask 1 — CANONICAL SHAPE: a BARE ARRAY of fields per module key. Not the nav + # schema envelope; the editor needs the field list and nothing else, and one shape + # beats two readings of a sentence. + "fields_by_module": {k: _module_fields(k) for k in _PERM_MODULES}} + + +@router.put("/admin/users/{username}/perms") +def put_perms(username: str, body: dict = Body(default=None), + session: Session = Depends(admin_gate)): + """Replace this account's permission block wholesale. + + WHOLESALE, not a merge: "remove this restriction" has to be expressible, and a merge cannot + express a deletion without a second vocabulary for it. + + ⚠ NO EPOCH BUMP, for the same reason `PATCH /admin/users/{u}` does not bump one: + `deps._user_for` re-reads the record on every request, so a narrowed wall applies to the + target's LIVE session on its very next call. Bumping would only add a forced re-login on top + of a change that has already taken effect. + """ + body = body if isinstance(body, dict) else {} + reg = _registry() + uname = str(username or "").strip().lower() + if uname not in reg: + raise err(404, "no_such_user", f"no account named {uname!r}") + if "perms" not in body: + raise err(400, "empty_patch", "no perms to save") + + # THE SELF-LOCKOUT GUARD, the twin of `self_demote` on the PATCH route. An admin bypasses + # perm_scope entirely, so this cannot brick them today — but it stops an administrator + # writing a wall for themselves that would bite the moment their role changed. + if uname == session.uname: + raise err(400, "self_perms", + "you cannot set permissions on your own account — ask another admin") + + cleaned = _clean_perms(body.get("perms")) or {} + cleaned = _fold_legacy_scope(reg[uname], cleaned) + _guard_bu_widening(reg[uname], cleaned, bool(body.get("confirm_widen"))) + users.set_access(uname, perms=cleaned) + fresh = _registry() + rec = fresh.get(uname) or {} + if int(rec.get("perms_v") or 0) < users.PERMS_VERSION: + # The store took the write and did not record it. A 200 here would tell an administrator + # the wall is up when it is not — the one direction this must never fail in. + raise err(503, "store_unavailable", + "the permissions were not saved — the account is UNCHANGED") + return {"username": uname, "perms": rec.get("perms") or {}, + "perms_v": int(rec.get("perms_v") or 0)} + + +_MODULE_LABELS = {"customer_data": "Customer", "product_data": "Product"} + + @router.get("/settings") def settings(session: Session = Depends(require_session)): """The session's OWN settings — any authenticated user, not admin-only. @@ -316,6 +725,10 @@ def settings(session: Session = Depends(require_session)): "team_id": perms.scope_team_id(session.user), "agent": perms.scope_agent(session.user), "modules": sorted(modules) if modules is not None else "all", + # C-PERM: the caller's OWN effective wall, read-only. The grid uses it to grey + # pickers rather than to enforce — hidden fields are stripped from every data wire + # regardless, so a client that ignores this is narrowed anyway, never widened. + "perms": session.user.get("perms") or {}, }, "tenant": {"key": session.tenant, "name": getattr(session.runtime, "name", session.tenant)}, diff --git a/api/routes_customers.py b/api/routes_customers.py index d288dbd289743c315308640335e8d32f419b6871..248b9f8a5730c4a96c8413062671b3251b4f47e6 100644 --- a/api/routes_customers.py +++ b/api/routes_customers.py @@ -1,264 +1,328 @@ -"""routes_customers.py — X2's read + write of the customer table, BU-SCOPED (EXIT-3b / EXIT-2a). - -Two things happen here that did not happen in the pre-wave `main.py`: - - 1. **ROWS ARE SCOPED TO THE SESSION.** The old `/api/customers` served `cl.pool()` — the whole - book, to anyone holding the shared APP_PASSWORD. Now the pool is built with - `(team_id, agent_name)` derived from the USER RECORD, so a Royal-only user never receives a - Fisch row and an agent-linked login never receives another rep's book. The scope is applied - at the QUERY, not as a post-filter, so there is no moment at which the other BU's rows exist - in this response. - - 2. **THE OVERLAY FORK IS GONE.** `aios-web/api/data/overlay.json` was a SECOND writable home - for the same user-owned fields the Streamlit app keeps in the tenant store — two truths, and - whichever process you asked last was right. Reads and writes now both go through - `modules.customer_data`'s table-workspace functions: ONE store (C1c, ARCHITECTURE §1a rule 3). - -⚠ ONE STORE IS NOT YET ONE CACHE (strangler-period, booked honestly). `core.store.get()` is -cache-first per PROCESS, so a write from the Streamlit container is invisible to a running API -container until its cache is refreshed, and vice versa. Deleting the fork removes the second -SOURCE OF TRUTH; it does not make the two runtimes coherent. The fix is X4/Postgres (task C-4, -owner-blocked on B-3), and no test here may claim read-your-writes ACROSS runtimes — a TestClient -proof is single-process and would report green on exactly the thing that is still broken. -""" -import time - -from fastapi import APIRouter, Body, Depends - -import scope_cache -from deps import Session, err, module_gate, perms - -router = APIRouter(prefix="/api/v1") - -#: The surface these routes serve. Both legs are gated on it, so a user without the grant gets a -#: 403 rather than an empty table that looks like "you have no customers". -MODULE = "customer_data" - -_CACHE_TTL = 900 # the pool build is slow (Odoo + reconciliation); 15 min, as before - - -def _pool_rows(session: Session): - """The reconciled Odoo pool for this session's SCOPE — the slow part, and the only part that - may be shared between users. - - ⛔ WHAT MAY BE CACHED HERE, AND WHY THE LINE IS EXACTLY HERE. The cache key is - `(team_id, agent)` and the cached value is the raw pool: Odoo-source columns only. That is - genuinely scope-shaped — two users with the same BU and the same book are asking the same - question, and `cl.pool()` is expensive (an Odoo pull plus reconciliation). - - The FULL PAYLOAD is NOT cacheable on this key, and caching it here was a real defect I shipped - and then removed. `fields` comes from `fields_from_workspace(ws)` — that user's own `custom_` - and `measure_` columns — and every overlay cell comes from `ws['overlays']`; the table - workspace is read as `data[username]` and written as `patch_table_overlay(uname, …)`, i.e. - PER USER. So two Royal-only users with no agent link share `(6, None)` and the second one - would have been served the FIRST one's private notes and private columns. The scope key was - right for the pool and wrong for everything wrapped around it. - - It survived a green 129-check battery because every fixture user had a DISTINCT - `(team_id, agent)` pair, so no two of them ever collided on the key — the test set could not - express the bug. `verify_api.py` now carries a same-scope second user for exactly this. - """ - rt = session.runtime - team_id = perms.scope_team_id(session.user) - agent = perms.scope_agent(session.user) - return _pool_for(rt, team_id, agent) - - -def _pool_for(rt, team_id, agent): - """The cached pool for an explicit scope — session-free so the prewarm thread and the - stale-refresh path can call it. STALE-WHILE-REFRESH (scope_cache): once a copy exists no - request blocks on the 10–30s Odoo rebuild again; only a scope's FIRST-ever build does.""" - import modules.customer_data as cl - - key = ("pool", team_id, agent) - - def _build(): - # ⚠ THE SCOPE GOES INTO THE BUILDER. `pool(agent_name, team_id)` is the same reconciled - # builder the Streamlit page uses — passing the scope here is what makes the isolation a - # property of the QUERY instead of a filter someone can forget to apply downstream. - return cl.pool(agent, team_id) - - def _evict(): - # Bounded: a scope cache that only ever grows is a memory leak in a shared process. - if len(rt.pool_cache) > 16: - for stale in sorted(rt.pool_cache, key=lambda k: rt.pool_cache[k][0])[:8]: - rt.pool_cache.pop(stale, None) - - return scope_cache.get(rt.pool_cache, key, _CACHE_TTL, _build, _evict) - - -def warm_default(rt): - """Boot prewarm: the consolidated pool `(None, None)` — the scope every admin and every - all-BU account lands on. Called from main.py's prewarm thread only.""" - _pool_for(rt, None, None) - - -def _team_agent(session: Session): - return perms.scope_team_id(session.user), perms.scope_agent(session.user) - - -def _pool_stamp(rt, team_id, agent): - """The cached pool's build timestamp — the DATA STAMP in every measure-memo key, so a pool - refresh invalidates the memoised answers exactly when the underlying rows changed.""" - entry = rt.pool_cache.get(("pool", team_id, agent)) - return entry[0] if isinstance(entry, tuple) and entry else 0 - - -def _measure_err(tag, e): - try: - import harness.telemetry as _tel - _tel.error(f"api:{tag}", e) - except Exception: - pass - - -def grid_assembly(session: Session, scope: str = "customer", storage_key: str = "", - consume_corrections: bool = True): - """ONE assembly of this session's grid state, shared by `/customers`, `/workspace` and the - events route (2026-07-31 — the standalone measure gap, owner item 1). - - What it adds over the pre-wave hand-rolled `_payload` loop, and why it replaced it: - - * rows go through `aios_grid.rows_from_pool` — the SAME builder the embedded host uses, - so `lat`/`lon` (the Map view's data), `_created` and every derived column ride each row - by construction instead of by a second loop that drifts. The hand loop was written to - mirror the pre-Map contract and silently dropped the coordinates: the shell's Map view - had nothing to plot ("the Map no longer works"). - * `derived` carries the cohort column's cells AND the measure columns' values, resolved - through `core.measure_resolve` (EXIT-5's extraction of the `_cl_measure_*` family). - Without them every measure column the owner built rendered BLANK in the shell. - * `measures` (the offer) and `measure_sets` (condition answers) are computed here so the - events route can finally validate measure fields/conditions instead of refusing them - (an empty `measure_offer` made `clean_measure_field` reject every create over HTTP). - - Memos live on the TENANT RUNTIME (`rt.measure_memo` / `rt.mset_memo`) — bounded by the - module's own clear-past-cap rule, keyed on (stamp, scope, pool identity, question), nothing - user-shaped in them. - """ - import aios_grid - from core import grid_events, measure_resolve - - rt = session.runtime - team_id, agent = _team_agent(session) - rows_src = _pool_for(rt, team_id, agent) - pids = frozenset(r["pid"] for r in rows_src if r.get("pid") is not None) - ws = grid_events.table_workspace( - _ctx_for(session, pids), allowed_pids=pids, - consume_corrections=consume_corrections) - workspace, fields, views, lists = aios_grid.workspace_wire( - ws, session.uname, set(pids), defs={}, scope_key=scope, storage_key=storage_key) - - today = time.strftime("%Y-%m-%d") - stamp = _pool_stamp(rt, team_id, agent) - measures = measure_resolve.offer(team_id, on_error=_measure_err) - measure_sets = measure_resolve.condition_sets( - [v.get("config") or {} for v in (views or [])], None, team_id, pids, today, stamp, - rt.mset_memo, on_error=_measure_err) - # The derived channel: cohort membership cells + measure column values, ONE dict — the - # same read-only channel the embed host hands to rows_from_pool. - derived = aios_grid.cohort_cells(lists) - for pid, cells in measure_resolve.column_values( - fields, team_id, pids, today, stamp, rt.measure_memo, - on_error=_measure_err).items(): - derived.setdefault(pid, {}).update(cells) - - return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace, - "fields": fields, "views": views, "lists": lists, "derived": derived, - "measures": measures, "measure_sets": measure_sets, "today": today, - "team_id": team_id} - - -def _payload(session: Session): - """`{fields, rows, today, pulled_at}` — X2's shape, which `verify_fields_contract.py` - referees. Rows are now built by `aios_grid.rows_from_pool` (embed == standalone by - construction); see `grid_assembly` for what that fixed. - - ⚠ `rows_src` is the SHARED cached list — `rows_from_pool` reads it and builds NEW dicts, - never mutating a cached row (the same-scope-second-user leak rule). - """ - import aios_grid - - g = grid_assembly(session) - rows = aios_grid.rows_from_pool( - g["rows_src"], g["fields"], g["ws"].get("overlays"), derived=g["derived"]) - return {"fields": g["fields"], "rows": rows, - # `today` rides the payload because every relative date condition must resolve against - # the TENANT's day, never the browser's — a client that falls back to its own clock - # disagrees with the server for everyone west of it. - "today": g["today"], - "pulled_at": time.strftime("%Y-%m-%d %H:%M")} - - -def _ctx_for(session: Session, pids): - """An EventCtx for the READ path — no fallback workspace, so a store outage is a 503 rather - than a phantom in-memory workspace an API request cannot persist.""" - from core import grid_events - return grid_events.EventCtx( - uname=session.uname, allowed_pids=frozenset(pids or ()), fields=[], - admin=session.admin, fallback_ws=None, seen_ids={}) - - -def allowed_pids(session: Session): - """The pids this session may touch — the POOL's own ids, so the write wall and the read scope - can never disagree. - - Reads `_pool_rows` rather than `_payload`: the wall only needs identities, and going through - the full payload would pay for a workspace read and a row assembly on every write. - """ - return frozenset(r["pid"] for r in _pool_rows(session) if r.get("pid") is not None) - - -@router.get("/customers") -def customers(session: Session = Depends(module_gate(MODULE))): - return _payload(session) - - -@router.patch("/customers/{pid}") -def patch_customer(pid: int, body: dict = Body(default=None), - session: Session = Depends(module_gate(MODULE))): - """Write the EDITABLE overlay stratum only — Odoo stays read-only, forever. - - Routed through `core.grid_events.handle_one` as an `overlay_patch` event rather than writing - the store directly: that handler is where the per-key `permissions.edit` wall, the pid wall - and the truncation rules live, and a second implementation of those would be a second set of - them to keep in step. The response reports what was ACCEPTED, which is not always what was - asked for. - """ - from core import grid_events - - updates = dict(body or {}) - if not updates: - raise err(400, "empty_patch", "no fields to update") - pool = allowed_pids(session) - if pid not in pool: - # 403, not 404: the pid may well exist — it is simply not in this session's book, and - # saying "no such customer" would confirm the opposite to anyone who guessed right. - raise err(403, "out_of_scope", "that customer is not in your book") - payload = _payload(session) - ctx = grid_events.EventCtx( - uname=session.uname, allowed_pids=pool, fields=payload["fields"], - admin=session.admin, fallback_ws=None, seen_ids={}) - try: - grid_events.handle_one( - {"id": f"patch:{pid}:{time.time_ns()}", "type": "overlay_patch", - "pid": pid, "updates": updates}, ctx) - except grid_events.StoreUnavailable: - raise err(503, "store_unavailable", - "the tenant store is unavailable — your change was not saved") - - # What actually landed, read back from the store rather than echoed from the request: a - # refused key or a truncated value must not be reported as accepted. - stored = (grid_events.table_workspace(_ctx_for(session, pool), allowed_pids=None) - .get("overlays") or {}).get(str(pid)) or {} - accepted = {k: stored.get(k) for k in updates if k in stored} - refused = sorted(k for k in updates if k not in accepted or stored.get(k) != str(updates[k])) - # No cache to patch: the overlay stratum is re-read from the store on every `_payload`, so - # read-your-writes within this runtime is a property of the design rather than of a - # write-through step somebody has to remember. (It was a write-through step while the whole - # payload was cached on a scope key — the arrangement that leaked one user's notes to - # another. See `_pool_rows`.) Cross-RUNTIME coherence is still not claimed: the module - # docstring says why, and Postgres is the fix. - out = {"ok": True, "pid": pid, "updates": accepted} - if refused: - out["refused"] = refused - return out +"""routes_customers.py — X2's read + write of the customer table, BU-SCOPED (EXIT-3b / EXIT-2a). + +Two things happen here that did not happen in the pre-wave `main.py`: + + 1. **ROWS ARE SCOPED TO THE SESSION.** The old `/api/customers` served `cl.pool()` — the whole + book, to anyone holding the shared APP_PASSWORD. Now the pool is built with + `(team_id, agent_name)` derived from the USER RECORD, so a Royal-only user never receives a + Fisch row and an agent-linked login never receives another rep's book. The scope is applied + at the QUERY, not as a post-filter, so there is no moment at which the other BU's rows exist + in this response. + + 2. **THE OVERLAY FORK IS GONE.** `aios-web/api/data/overlay.json` was a SECOND writable home + for the same user-owned fields the Streamlit app keeps in the tenant store — two truths, and + whichever process you asked last was right. Reads and writes now both go through + `modules.customer_data`'s table-workspace functions: ONE store (C1c, ARCHITECTURE §1a rule 3). + +⚠ ONE STORE IS NOT YET ONE CACHE (strangler-period, booked honestly). `core.store.get()` is +cache-first per PROCESS, so a write from the Streamlit container is invisible to a running API +container until its cache is refreshed, and vice versa. Deleting the fork removes the second +SOURCE OF TRUTH; it does not make the two runtimes coherent. The fix is X4/Postgres (task C-4, +owner-blocked on B-3), and no test here may claim read-your-writes ACROSS runtimes — a TestClient +proof is single-process and would report green on exactly the thing that is still broken. +""" +import time + +from fastapi import APIRouter, Body, Depends + +import scope_cache +from deps import Session, err, module_gate, perms + +router = APIRouter(prefix="/api/v1") + +#: The surface these routes serve. Both legs are gated on it, so a user without the grant gets a +#: 403 rather than an empty table that looks like "you have no customers". +MODULE = "customer_data" + +_CACHE_TTL = 900 # the pool build is slow (Odoo + reconciliation); 15 min, as before + + +def _pool_rows(session: Session): + """The reconciled Odoo pool for this session's SCOPE — the slow part, and the only part that + may be shared between users. + + ⛔ WHAT MAY BE CACHED HERE, AND WHY THE LINE IS EXACTLY HERE. The cache key is + `(team_id, agent)` and the cached value is the raw pool: Odoo-source columns only. That is + genuinely scope-shaped — two users with the same BU and the same book are asking the same + question, and `cl.pool()` is expensive (an Odoo pull plus reconciliation). + + The FULL PAYLOAD is NOT cacheable on this key, and caching it here was a real defect I shipped + and then removed. `fields` comes from `fields_from_workspace(ws)` — that user's own `custom_` + and `measure_` columns — and every overlay cell comes from `ws['overlays']`; the table + workspace is read as `data[username]` and written as `patch_table_overlay(uname, …)`, i.e. + PER USER. So two Royal-only users with no agent link share `(6, None)` and the second one + would have been served the FIRST one's private notes and private columns. The scope key was + right for the pool and wrong for everything wrapped around it. + + It survived a green 129-check battery because every fixture user had a DISTINCT + `(team_id, agent)` pair, so no two of them ever collided on the key — the test set could not + express the bug. `verify_api.py` now carries a same-scope second user for exactly this. + """ + rt = session.runtime + team_id, agent = _team_agent(session) + return _pool_for(rt, team_id, agent) + + +def _pool_for(rt, team_id, agent): + """The cached pool for an explicit scope — session-free so the prewarm thread and the + stale-refresh path can call it. STALE-WHILE-REFRESH (scope_cache): once a copy exists no + request blocks on the 10–30s Odoo rebuild again; only a scope's FIRST-ever build does.""" + import modules.customer_data as cl + + key = ("pool", team_id, agent) + + def _build(): + # ⚠ THE SCOPE GOES INTO THE BUILDER. `pool(agent_name, team_id)` is the same reconciled + # builder the Streamlit page uses — passing the scope here is what makes the isolation a + # property of the QUERY instead of a filter someone can forget to apply downstream. + return cl.pool(agent, team_id) + + def _evict(): + # Bounded: a scope cache that only ever grows is a memory leak in a shared process. + if len(rt.pool_cache) > 16: + for stale in sorted(rt.pool_cache, key=lambda k: rt.pool_cache[k][0])[:8]: + rt.pool_cache.pop(stale, None) + + return scope_cache.get(rt.pool_cache, key, _CACHE_TTL, _build, _evict) + + +def warm_default(rt): + """Boot prewarm: the consolidated pool `(None, None)` — the scope every admin and every + all-BU account lands on. Called from main.py's prewarm thread only.""" + _pool_for(rt, None, None) + + +def _team_agent(session: Session): + """The `(team_id, agent)` this session's POOL is built with — ONE derivation point, used by + `_pool_rows` and `grid_assembly` alike, so the cache key and the query can never disagree. + + ⛔ WAVE 15 R1: THIS NOW COMES FROM THE PERMANENT FILTER (C-PERM amendment 3). `team_id` is + not a row filter — `customer_data._pool_build` passes it into `cust._cust_rev` three times + and into `_cadence_bulk`, so it decides what `rev`/`ly`/`ltm`/`aov`/`status` MEAN. Enforcing + a BU purely as a post-filter would keep the row list right and silently consolidate every + number. So the pushdown survives as a DERIVATION OF the declared filter rather than a second + wall beside it, and `perm_scope.derive_pool_scope` falls back to the legacy `bus`/`agent` + derivation for any record the migration has not reached yet. + """ + import core.perm_scope as perm_scope + return perm_scope.derive_pool_scope(session.user, MODULE) + + +def _pool_stamp(rt, team_id, agent): + """The cached pool's build timestamp — the DATA STAMP in every measure-memo key, so a pool + refresh invalidates the memoised answers exactly when the underlying rows changed.""" + entry = rt.pool_cache.get(("pool", team_id, agent)) + return entry[0] if isinstance(entry, tuple) and entry else 0 + + +def _measure_err(tag, e): + try: + import harness.telemetry as _tel + _tel.error(f"api:{tag}", e) + except Exception: + pass + + +def grid_assembly(session: Session, scope: str = "customer", storage_key: str = "", + consume_corrections: bool = True): + """ONE assembly of this session's grid state, shared by `/customers`, `/workspace` and the + events route (2026-07-31 — the standalone measure gap, owner item 1). + + What it adds over the pre-wave hand-rolled `_payload` loop, and why it replaced it: + + * rows go through `aios_grid.rows_from_pool` — the SAME builder the embedded host uses, + so `lat`/`lon` (the Map view's data), `_created` and every derived column ride each row + by construction instead of by a second loop that drifts. The hand loop was written to + mirror the pre-Map contract and silently dropped the coordinates: the shell's Map view + had nothing to plot ("the Map no longer works"). + * `derived` carries the cohort column's cells AND the measure columns' values, resolved + through `core.measure_resolve` (EXIT-5's extraction of the `_cl_measure_*` family). + Without them every measure column the owner built rendered BLANK in the shell. + * `measures` (the offer) and `measure_sets` (condition answers) are computed here so the + events route can finally validate measure fields/conditions instead of refusing them + (an empty `measure_offer` made `clean_measure_field` reject every create over HTTP). + + Memos live on the TENANT RUNTIME (`rt.measure_memo` / `rt.mset_memo`) — bounded by the + module's own clear-past-cap rule, keyed on (stamp, scope, pool identity, question), nothing + user-shaped in them. + """ + import aios_grid + from core import grid_events, measure_resolve + + import core.perm_scope as perm_scope + + rt = session.runtime + team_id, agent = _team_agent(session) + rows_src = _pool_for(rt, team_id, agent) + # ⛔ THE ROW WALL, APPLIED BEFORE `pids` IS TAKEN. Everything downstream is bounded by that + # frozenset — `allowed_pids` for the workspace, cohort membership, measure resolution — so + # scoping here means a row this account may not see never enters ANY of them, rather than + # being filtered out of one payload and surviving in another. + # + # Evaluated against the CANONICAL field list, not the per-user assembled one, for two + # reasons: the assembled list is not built yet (it needs `pids`), and a permanent filter may + # only ever name a canonical field anyway — `routes_admin._clean_perms` validates it against + # exactly this schema and 400s otherwise. `permits()` denies on anything it cannot answer. + rows_src = perm_scope.apply_row_scope(rows_src, session.user, MODULE, aios_grid.FIELDS) + pids = frozenset(r["pid"] for r in rows_src if r.get("pid") is not None) + ws = grid_events.table_workspace( + _ctx_for(session, pids), allowed_pids=pids, + consume_corrections=consume_corrections) + workspace, fields, views, lists = aios_grid.workspace_wire( + ws, session.uname, set(pids), defs={}, scope_key=scope, storage_key=storage_key) + # THE FIELD WALL — a TRANSITIVE closure (C-PERM amendment 5), so hiding a field also hides + # every formula computed FROM it. Formulas evaluate in the browser from `{ref}`s, so + # shipping a dependent formula while withholding its input either leaks the input through + # the formula's value or silently computes a wrong one; only removing both is coherent. + # Applied AFTER workspace_wire because custom + measure columns are what it must cover. + hidden = perm_scope.hidden_keys(session.user, MODULE, fields) + if hidden: + fields = [f for f in fields if f.get("key") not in hidden] + # The field LIST and the ROW payload are two different wires. Narrowing only the first + # would leave the value sitting in the second, where anything can read it. + rows_src = [perm_scope.strip_row(r, hidden) for r in rows_src] + + today = time.strftime("%Y-%m-%d") + stamp = _pool_stamp(rt, team_id, agent) + measures = measure_resolve.offer(team_id, on_error=_measure_err) + measure_sets = measure_resolve.condition_sets( + [v.get("config") or {} for v in (views or [])], None, team_id, pids, today, stamp, + rt.mset_memo, on_error=_measure_err) + # The derived channel: cohort membership cells + measure column values, ONE dict — the + # same read-only channel the embed host hands to rows_from_pool. + derived = aios_grid.cohort_cells(lists) + for pid, cells in measure_resolve.column_values( + fields, team_id, pids, today, stamp, rt.measure_memo, + on_error=_measure_err).items(): + derived.setdefault(pid, {}).update(cells) + + return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace, + "fields": fields, "views": views, "lists": lists, "derived": derived, + "measures": measures, "measure_sets": measure_sets, "today": today, + "team_id": team_id} + + +def _payload(session: Session): + """`{fields, rows, today, pulled_at}` — X2's shape, which `verify_fields_contract.py` + referees. Rows are now built by `aios_grid.rows_from_pool` (embed == standalone by + construction); see `grid_assembly` for what that fixed. + + ⚠ `rows_src` is the SHARED cached list — `rows_from_pool` reads it and builds NEW dicts, + never mutating a cached row (the same-scope-second-user leak rule). + """ + import aios_grid + + g = grid_assembly(session) + rows = aios_grid.rows_from_pool( + g["rows_src"], g["fields"], g["ws"].get("overlays"), derived=g["derived"]) + return {"fields": g["fields"], "rows": rows, + # `today` rides the payload because every relative date condition must resolve against + # the TENANT's day, never the browser's — a client that falls back to its own clock + # disagrees with the server for everyone west of it. + "today": g["today"], + "pulled_at": time.strftime("%Y-%m-%d %H:%M")} + + +def _ctx_for(session: Session, pids): + """An EventCtx for the READ path — no fallback workspace, so a store outage is a 503 rather + than a phantom in-memory workspace an API request cannot persist.""" + from core import grid_events + return grid_events.EventCtx( + uname=session.uname, allowed_pids=frozenset(pids or ()), fields=[], + # C-PERM: the write wall's field half. Computed from the CANONICAL contract because + # `fields=[]` here — the closure only needs the schema, not this user's column list. + hidden_keys=_hidden_for(session), + admin=session.admin, fallback_ws=None, seen_ids={}) + + + +def _hidden_for(session: Session): + """The fields this session's permissions hide — the write wall's half of C-PERM. + + Read paths strip these from both wires so they cannot be SEEN; this is what stops them + being WRITTEN by a caller who knows the key. Evaluated against the canonical contract, the + same schema `routes_admin._clean_perms` validates a hiddenFields entry against. + """ + import aios_grid + import core.perm_scope as perm_scope + + return perm_scope.hidden_keys(session.user, MODULE, aios_grid.FIELDS) + +def allowed_pids(session: Session): + """The pids this session may touch — the POOL's own ids, so the write wall and the read scope + can never disagree. + + Reads `_pool_rows` rather than `_payload`: the wall only needs identities, and going through + the full payload would pay for a workspace read and a row assembly on every write. + + ⛔ THE PERMANENT FILTER APPLIES HERE TOO, AND FORGETTING IT IS A WRITE-WITHOUT-READ HOLE. + `_pool_rows` is built with the DERIVED pushdown, which expresses only what a `(team_id, + agent)` pair can express. Any part of the wall the pushdown cannot carry — `revenue > 1000`, + a nested group, a condition on any other column — leaves the pool WIDER than the filter. Read + paths close that gap with `apply_row_scope`; without the same call here the write wall would + be the wider set, and a restricted user could PATCH a row this API will not show them. + Same function, same order as `grid_assembly`, so the two walls cannot drift. + """ + import core.perm_scope as perm_scope + import aios_grid + + rows = perm_scope.apply_row_scope(_pool_rows(session), session.user, MODULE, + aios_grid.FIELDS) + return frozenset(r["pid"] for r in rows if r.get("pid") is not None) + + +@router.get("/customers") +def customers(session: Session = Depends(module_gate(MODULE))): + return _payload(session) + + +@router.patch("/customers/{pid}") +def patch_customer(pid: int, body: dict = Body(default=None), + session: Session = Depends(module_gate(MODULE))): + """Write the EDITABLE overlay stratum only — Odoo stays read-only, forever. + + Routed through `core.grid_events.handle_one` as an `overlay_patch` event rather than writing + the store directly: that handler is where the per-key `permissions.edit` wall, the pid wall + and the truncation rules live, and a second implementation of those would be a second set of + them to keep in step. The response reports what was ACCEPTED, which is not always what was + asked for. + """ + from core import grid_events + + updates = dict(body or {}) + if not updates: + raise err(400, "empty_patch", "no fields to update") + pool = allowed_pids(session) + if pid not in pool: + # 403, not 404: the pid may well exist — it is simply not in this session's book, and + # saying "no such customer" would confirm the opposite to anyone who guessed right. + raise err(403, "out_of_scope", "that customer is not in your book") + payload = _payload(session) + ctx = grid_events.EventCtx( + uname=session.uname, allowed_pids=pool, fields=payload["fields"], + admin=session.admin, fallback_ws=None, seen_ids={}, + hidden_keys=_hidden_for(session)) + try: + grid_events.handle_one( + {"id": f"patch:{pid}:{time.time_ns()}", "type": "overlay_patch", + "pid": pid, "updates": updates}, ctx) + except grid_events.StoreUnavailable: + raise err(503, "store_unavailable", + "the tenant store is unavailable — your change was not saved") + + # What actually landed, read back from the store rather than echoed from the request: a + # refused key or a truncated value must not be reported as accepted. + stored = (grid_events.table_workspace(_ctx_for(session, pool), allowed_pids=None) + .get("overlays") or {}).get(str(pid)) or {} + accepted = {k: stored.get(k) for k in updates if k in stored} + refused = sorted(k for k in updates if k not in accepted or stored.get(k) != str(updates[k])) + # No cache to patch: the overlay stratum is re-read from the store on every `_payload`, so + # read-your-writes within this runtime is a property of the design rather than of a + # write-through step somebody has to remember. (It was a write-through step while the whole + # payload was cached on a scope key — the arrangement that leaked one user's notes to + # another. See `_pool_rows`.) Cross-RUNTIME coherence is still not claimed: the module + # docstring says why, and Postgres is the fix. + out = {"ok": True, "pid": pid, "updates": accepted} + if refused: + out["refused"] = refused + return out diff --git a/api/routes_grid.py b/api/routes_grid.py index 019a47c62d6a7f9ec029504c453a3c13faf187c6..f071a8ff8d26a53db7b8b9eda90d1d292b35c3b2 100644 --- a/api/routes_grid.py +++ b/api/routes_grid.py @@ -39,15 +39,36 @@ _MAX_EVENTS = 24 def _ctx(session: Session, fields, pids, **kw): from core import grid_events + import aios_grid + import core.perm_scope as perm_scope + + # Wave 16 C-TOPIC: the ctx is TOPIC-SHAPED. The product scope swaps all three of the + # things a write is validated against — the module the permission wall reads, the canonical + # contract the hidden-field closure runs over, and the TABLE OPS the write lands in. + # Getting any one of them from the other topic is the "validated against the wrong field + # contract" near-miss the wave-15 routes_products header warned about. + if kw.get("scope_key") == "product": + import modules.product_data as pd + from routes_products import MODULE as _PMOD, pd_fields + + module, canonical = _PMOD, pd_fields(consolidated=True) + kw.setdefault("table", pd.TABLE_OPS) + else: + module, canonical = MODULE, aios_grid.FIELDS return grid_events.EventCtx( uname=session.uname, allowed_pids=pids, fields=fields, admin=session.admin, + # C-PERM: the write wall's field half, on the EVENTS transport too. This route takes the + # component's event objects verbatim, so a hidden key would otherwise arrive here with + # nothing between it and the store. + hidden_keys=perm_scope.hidden_keys(session.user, module, canonical), fallback_ws=None, seen_ids={}, **kw) -#: The two surfaces the ONE grid serves. `cohort` is the same table over hand-curated SETS rather +#: The surfaces the ONE grid serves. `cohort` is the same table over hand-curated SETS rather #: than over the whole scoped pool — `app.py:page_cohort` calls the same `_table_grid` with -#: `cohort_mode=True, scope_key='cohort'`. -_SCOPES = ("customer", "cohort") +#: `cohort_mode=True, scope_key='cohort'`. `product` (wave 16 C-TOPIC) is the SKU table: +#: same engine, its own pool, field contract and workspace BUCKET (routes_products). +_SCOPES = ("customer", "cohort", "product") def _scope_or_400(raw): @@ -81,11 +102,51 @@ def workspace(scope: str = "customer", from routes_customers import grid_assembly scope = _scope_or_400(scope) + # ── Wave 16 C-TOPIC: the PRODUCT surface has its own assembly (own pool, own field + # contract, own workspace BUCKET) and the contract's own storage key. It branches before + # the customer derivation because the customer storage key embeds (bu, agent) while the + # product one is deliberately `all:all` — one product workspace per user (the wave doc's + # C-TOPIC line), since BU narrows the product VALUES, not which workspace you own. + if scope == "product": + from routes_products import MODULE as PRODUCT_MODULE, product_assembly + + # ⛔ THE GATE CHANGES WITH THE SCOPE. This route's dependency asserts the CUSTOMER + # grant; a caller asking for the product surface must hold the PRODUCT grant too, or a + # customer-only account could read product workspaces through this one door. + session.require(PRODUCT_MODULE) + storage_key = f"{session.tenant}:product-list:{session.uname}:all:all" + try: + g = product_assembly(session, scope=scope, storage_key=storage_key) + except grid_events.StoreUnavailable: + raise err(503, "store_unavailable", "the tenant store is unavailable") + workspace = g["workspace"] + workspace["overlays"] = g["ws"].get("overlays") or {} + # The measure channel is EMPTY on this topic (customer-grain descope) — stated + # explicitly so the client's pickers grey rather than guess. + workspace["measures"] = g["measures"] + workspace["measureSets"] = g["measure_sets"] + workspace["derived"] = {} + workspace["viewer"] = {"name": session.uname, "isAdmin": bool(session.admin)} + try: + from core import users as _users + workspace["userOptions"] = _users.assignable_people() + workspace["userAvatars"] = {k: v for k, v in _users.avatar_map().items() + if str(v).startswith("data:image/")} + except Exception: + workspace["userOptions"] = [] + workspace["userAvatars"] = {} + workspace["scopeKey"] = scope + return {"workspace": workspace} + # The storage key mirrors the host's own convention byte-for-byte (app.py's `_table_grid` # call sites) with the session's TENANT in the host's hardcoded slot, so localStorage state # carries across embed ⇄ standalone on the same browser. - team_id = perms.scope_team_id(session.user) - agent = perms.scope_agent(session.user) + # Wave 15 R1 — the SAME derivation the pool uses (`routes_customers._team_agent`), so the + # storage key cannot drift from the scope it names. Value-identical for every migrated + # record (verify_perm_scope section D proves the derivation reproduces the legacy scope + # exactly), so nobody's saved localStorage state moves when the migration runs. + import core.perm_scope as perm_scope + team_id, agent = perm_scope.derive_pool_scope(session.user, MODULE) bu = team_id if team_id is not None else "all" if scope == "cohort": storage_key = f"{session.tenant}:cohort:{session.uname}:{bu}" @@ -202,7 +263,7 @@ def _ts_label(bucket, start): @router.post("/grid/timeseries") -def grid_timeseries(body: dict = Body(default=None), +def grid_timeseries(body: dict = Body(default=None), scope: str = "customer", session: Session = Depends(module_gate(MODULE))): """Pooled measure values per calendar bucket — the time-series view's data channel. @@ -225,6 +286,16 @@ def grid_timeseries(body: dict = Body(default=None), from harness import windows as _wn from routes_customers import _pool_stamp, _team_agent, allowed_pids + # Wave 16 C-TOPIC: the channel is CUSTOMER-GRAIN (measure_resolve's own grain), so the + # product surface is refused in words rather than answered with an id-space accident — + # product pids are CRC32 hashes and would mostly fall outside the customer book anyway, + # but "mostly" is not a wall. The client hides the mode for this topic; this is the + # server's half of the same refusal. + if _scope_or_400(scope) == "product": + raise err(400, "bad_timeseries", + "the product surface has no time-series channel yet — measures are " + "customer-grain") + body = body or {} bucket = body.get("bucket") if bucket not in _TS_BUCKETS: @@ -397,7 +468,18 @@ def grid_events_route(body: dict = Body(default=None), scope = _scope_or_400((body or {}).get("scopeKey")) # This assembly validates the write; it is not a payload the browser will render. Leave # one-shot field-name correction acks queued for the subsequent /workspace refresh. - g = grid_assembly(session, scope=scope, consume_corrections=False) + # Wave 16 C-TOPIC: the PRODUCT topic gets the product assembly — product field contract, + # product pids, and (below) the product TABLE OPS, so a product event is validated against + # and lands in the product bucket. The measure/cohort context is honestly EMPTY there: + # `clean_measure_field` refuses measure creates on this surface by construction (the + # customer-grain descope), which is the fail-closed shape, not an accident. + if scope == "product": + from routes_products import MODULE as PRODUCT_MODULE, product_assembly + + session.require(PRODUCT_MODULE) # the route's own dependency asserts only customer_data + g = product_assembly(session, consume_corrections=False) + else: + g = grid_assembly(session, scope=scope, consume_corrections=False) # ⚠ THE MEASURE CONTEXT IS NOT OPTIONAL (2026-07-31). Without `measure_offer`, # `clean_measure_field` had an empty admission list and every measure-column create over # HTTP was silently refused; without `measure_keys`, `clean_filter_tree` stripped every diff --git a/api/routes_pages.py b/api/routes_pages.py index d178f17c5c2bb8582b12430b025bdcc70caf306b..4dcf66e5ae81195bcb1bd4300246cc663c5088fe 100644 --- a/api/routes_pages.py +++ b/api/routes_pages.py @@ -19,14 +19,13 @@ FAIL-CLOSED, and the order matters: from fastapi import APIRouter, Depends, Query import pages -# ⛔ IMPORTED HERE AT MODULE LEVEL ON PURPOSE, even though `pages.builder_for` also imports it -# lazily. `deploy_web.py` ships a hand-maintained file set, and W2-11 adds a `check_include()`-style -# IMPORT WALK to catch what that set misses — a walk that only follows module-level imports would -# never reach a builder registered from inside a function body, and a missing module CRASHED the -# live Space on 2026-07-04. One visible import makes the builder reachable by static analysis; the -# lazy import in `pages.py` stays as the fallback that keeps the registry self-assembling. -# (No circularity: `pages` is fully loaded by the line above before `pages_sales` imports it back.) -import pages_sales # noqa: F401 +# ⚠ Wave 16 (owner item 7): the module-level pages_sales import was REMOVED — the Sales page +# is retired, so no builder registers in production and every /pages/{key} 404s (a roadmap +# fact, not a grant fact). When the next builder lands (Collections / Procurement), import it +# HERE at module level, not only lazily: deploy_web.py's import walk follows module-level +# imports, and a builder registered from inside a function body is invisible to it — a +# missing module CRASHED the live Space on 2026-07-04. (verify_api section G scans this file +# for the retired import — phrase any mention of it so the scan cannot read prose as code.) from deps import Session, require_session router = APIRouter(prefix="/api/v1") diff --git a/api/routes_products.py b/api/routes_products.py new file mode 100644 index 0000000000000000000000000000000000000000..74eddb0dc9f950ba13e206e32f42b5a19c5b5951 --- /dev/null +++ b/api/routes_products.py @@ -0,0 +1,197 @@ +"""routes_products.py — the PRODUCT table's read seam (wave 15 item 9/10, contract C-TOPIC). + +The proof that C-TOPIC's bet is real: **a second table object is a pool module plus a route, not +a second component tree**. Everything structural here is borrowed rather than re-implemented — +the permission wall (`core.perm_scope`), the row builder (`aios_grid.rows_from_pool`), the +scope-keyed stale-while-refresh cache (`scope_cache`), the error shape, the module gate. + +⛔ NOT REACHABLE FROM THE NAV YET, AND THAT IS THE POINT OF LANDING IT THIS WAY. There is no +`product_data` registry row, so `core.perms.nav_pages` never emits one and no user can navigate +here; the route answers only to a caller who already knows the URL AND holds the grant. That +keeps a half-built surface off the owner's screen while the server half is real, gated and +reviewable — rather than shipping a nav entry that opens onto columns nobody has reconciled. +Wave 16 adds the registry row, the client `topic` prop and the write path; both are named in the +wave doc rather than left implicit. + +Wave 16 (C-TOPIC's second half): the WRITE PATH exists now, and it is exactly what the wave-15 +header demanded before one could — its OWN table workspace bucket +(`modules.product_data.TABLE_OPS`, store key 'product_table_workspace') and its own event +validation (the events route builds the ctx over the PRODUCT field contract + product pids + +the product ops). ⛔ The separate bucket is load-bearing, not tidy: product pids are CRC32 +hashes and customer pids are Odoo partner ids — one shared overlay bucket and a hash collision +silently writes a product note onto somebody's customer. +""" +import time + +from fastapi import Body, Depends + +from fastapi import APIRouter + +import scope_cache +from deps import Session, err, module_gate + +router = APIRouter(prefix="/api/v1") + +#: The registry key this surface WILL carry. The gate is live now even though the nav is not, so +#: the day the registry row appears the wall is already the one that was tested. +MODULE = "product_data" + +_CACHE_TTL = 900 + + +def _pool_for(rt, team_id): + """The cached SKU pool for one scope. Same stale-while-refresh discipline as the customer + pool: only a scope's FIRST-ever build blocks, and the cache key is the SCOPE, never the user + — the customer route learned that the hard way (a per-user payload cached on a scope key + served one user's private columns to another).""" + import modules.product_data as pd + + # ⚠ Signature is (cache, key, ttl, build) — the wave-15 version passed `ttl=` as a keyword + # after the build lambda and DIED on every call ("multiple values for 'ttl'"). Latent until + # wave 16 because nothing drove this route end-to-end: verify_perm_scope's section H stubs + # the pool a layer below. verify_api's W16 section now exercises the real call. + return scope_cache.get(rt.pool_cache, ("product_pool", team_id), _CACHE_TTL, + lambda: pd.pool(team_id=team_id)) + + +def product_assembly(session: Session, scope: str = "product", storage_key: str = "", + consume_corrections: bool = True): + """The product topic's mirror of `routes_customers.grid_assembly` — SAME g-dict keys, so + the /workspace and events routes consume either interchangeably. + + Three deliberate absences, each a topic fact rather than a gap: + * `measures`/`measure_sets` are EMPTY — `core.measure_resolve` is CUSTOMER-grain (the + C-TOPIC v1 descope, booked in the wave doc); the events ctx therefore refuses measure + creates on this surface, which is the correct fail-closed shape. + * `lists` is EMPTY and `workspace_wire(with_cohorts=False)` — cohorts store PARTNER pids; + resolving them against CRC32 product pids would intersect two unrelated id spaces. + * `derived` is EMPTY — it exists to carry cohort + measure cells, and there are neither. + """ + import aios_grid + import core.perm_scope as perm_scope + import modules.product_data as pd + from core import grid_events + + team_id, _agent = perm_scope.derive_pool_scope(session.user, MODULE) + try: + rows_src = _pool_for(session.runtime, team_id) + except Exception as e: + raise err(503, "pool_unavailable", + f"the product catalogue could not be built — {str(e)[:160]}") + + fields_base = pd_fields(consolidated=team_id is None) + # The SAME wall the customer assembly applies, in the same order: rows first (before pids + # are taken, so an out-of-filter row never enters allowed_pids), then the field closure, + # then the values stripped from the rows as well as the field list. + rows_src = perm_scope.apply_row_scope(rows_src, session.user, MODULE, fields_base) + pids = frozenset(r["pid"] for r in rows_src if r.get("pid") is not None) + + ctx = grid_events.EventCtx( + uname=session.uname, allowed_pids=pids, fields=[], + hidden_keys=perm_scope.hidden_keys(session.user, MODULE, fields_base), + admin=session.admin, fallback_ws=None, seen_ids={}, + scope_key="product", table=pd.TABLE_OPS) + ws = grid_events.table_workspace(ctx, allowed_pids=pids, + consume_corrections=consume_corrections) + workspace, fields, views, lists = aios_grid.workspace_wire( + ws, session.uname, set(pids), defs={}, scope_key=scope, storage_key=storage_key, + fields_base=fields_base, with_cohorts=False) + + hidden = perm_scope.hidden_keys(session.user, MODULE, fields) + if hidden: + fields = [f for f in fields if f.get("key") not in hidden] + rows_src = [perm_scope.strip_row(r, hidden) for r in rows_src] + + return {"rows_src": rows_src, "pids": pids, "ws": ws, "workspace": workspace, + "fields": fields, "views": views, "lists": lists, "derived": {}, + "measures": [], "measure_sets": {}, "today": time.strftime("%Y-%m-%d"), + "team_id": team_id} + + +@router.get("/products") +def products(session: Session = Depends(module_gate(MODULE))): + """The product table for this session's scope — the /customers envelope byte-for-byte + (`{fields, rows, today, pulled_at}`) plus two additive keys (`identity`, `scope`). + + The BU scope is DERIVED FROM THE PERMANENT FILTER (`perm_scope.derive_pool_scope`), exactly + as the customer route derives it — and for the same reason, which is worth restating because + it is the wave's central lesson: `team_id` shapes the revenue VALUES on each row, so a BU + enforced as a post-filter yields a correct row list carrying both units' numbers. + """ + import aios_grid + + g = product_assembly(session) + rows = aios_grid.rows_from_pool( + g["rows_src"], g["fields"], g["ws"].get("overlays"), derived=g["derived"]) + return {"fields": g["fields"], "rows": rows, + "today": g["today"], "pulled_at": time.strftime("%Y-%m-%d %H:%M"), + "identity": {"pid": "pid", "businessKey": "code"}, + "scope": {"team_id": g["team_id"], "consolidated": g["team_id"] is None}} + + +@router.patch("/products/{pid}") +def patch_product(pid: int, body: dict = Body(default=None), + session: Session = Depends(module_gate(MODULE))): + """Write the product table's EDITABLE overlay stratum — the customers PATCH, on the product + topic's ctx. Routed through `core.grid_events.handle_one` so the per-key `permissions.edit` + wall, the pid wall and the truncation rules stay ONE implementation; the ctx's `table` ops + aim the write at the PRODUCT bucket.""" + import modules.product_data as pd + from core import grid_events + + updates = dict(body or {}) + if not updates: + raise err(400, "empty_patch", "no fields to update") + g = product_assembly(session, consume_corrections=False) + if pid not in g["pids"]: + # 403, not 404 — the code may exist; it is simply not in this session's catalogue. + raise err(403, "out_of_scope", "that product is not in your catalogue") + import core.perm_scope as perm_scope + + ctx = grid_events.EventCtx( + uname=session.uname, allowed_pids=g["pids"], fields=g["fields"], + admin=session.admin, fallback_ws=None, seen_ids={}, + hidden_keys=perm_scope.hidden_keys( + session.user, MODULE, pd_fields(consolidated=g["team_id"] is None)), + scope_key="product", table=pd.TABLE_OPS) + try: + grid_events.handle_one( + {"id": f"patch:product:{pid}:{time.time_ns()}", "type": "overlay_patch", + "pid": pid, "updates": updates}, ctx) + except grid_events.StoreUnavailable: + raise err(503, "store_unavailable", + "the tenant store is unavailable — your change was not saved") + + # What actually landed, read back from the PRODUCT bucket rather than echoed from the + # request: a refused key or a truncated value must not be reported as accepted. + stored = (grid_events.table_workspace(ctx, allowed_pids=None) + .get("overlays") or {}).get(str(pid)) or {} + accepted = {k: stored.get(k) for k in updates if k in stored} + refused = sorted(k for k in updates + if k not in accepted or stored.get(k) != str(updates[k])) + out = {"pid": pid, "updates": accepted} + if refused: + out["refused"] = refused + return out + + +def pd_fields(consolidated=True): + """The product field contract, minus the CONSOLIDATED-only columns when the caller is scoped. + + ⛔ The omission is the SCOPE RULE, not a display preference (see `modules/product_data` + decision 2): `inventory.sku_inventory` is brand-independent, so serving those columns to a + BU-scoped caller would put company-wide stock beside BU-shaped revenue in one row. A column + that is absent asks a question; one that is silently company-wide answers a different one. + """ + import json + from pathlib import Path + + import aios_grid + + doc = json.loads((Path(aios_grid.__file__).resolve().parent / + "aios_grid_fields.json").read_text(encoding="utf-8")) + fields = list((doc.get("product_data") or {}).get("fields") or []) + if consolidated: + return fields + import modules.product_data as pd + return [f for f in fields if f.get("key") not in pd.CONSOLIDATED_ONLY] diff --git a/royalimports_os/aios_grid.py b/royalimports_os/aios_grid.py index f7d945ac1cd34093d87a80f6d2ee8115405e578d..a89ff39be64a8d2a5b7509f474499eaebceea7ba 100644 --- a/royalimports_os/aios_grid.py +++ b/royalimports_os/aios_grid.py @@ -70,6 +70,17 @@ def _load_fields(): FIELDS = _load_fields() + +def product_fields(): + """The PRODUCT table's canonical contract (wave 15 C-TOPIC, `product_data` key in the same + JSON). A separate accessor rather than a second module constant so the one file-read and the + one failure mode stay shared with `FIELDS`.""" + doc = json.loads(_FIELDS_PATH.read_text(encoding="utf-8")) + fields = (doc.get("product_data") or {}).get("fields") + if not isinstance(fields, list) or not fields: + raise ValueError(f"aios_grid: {_FIELDS_PATH} has no product_data.fields list.") + return fields + # text/date fields pass through untouched; every OTHER odoo (numeric) field is rounded — # mirrors aios-web/api/main.py _payload() exactly so embed == standalone byte-for-byte. @@ -386,7 +397,7 @@ def measure_fields_of(fields): return [f for f in fields or [] if isinstance(f.get("measure"), dict)] -def fields_from_workspace(workspace=None, cohorts=False, scope_key=None): +def fields_from_workspace(workspace=None, cohorts=False, scope_key=None, fields_base=None): """Overlay persisted notes/custom fields onto the immutable source-field contract. `cohorts=True` appends the derived cohort column — see `cohort_field`. Appended LAST and @@ -405,11 +416,18 @@ def fields_from_workspace(workspace=None, cohorts=False, scope_key=None): saved def carrying `scope` is emitted only when it matches — so a cohort-specific field never appears on the Customer table. FAIL-CLOSED: a caller that passes no scope_key sees only unscoped (global) fields; base contract fields are never scoped. + + `fields_base` (wave 16 C-TOPIC) — the canonical contract to overlay onto. Absent = the + CUSTOMER contract (`FIELDS`), byte-identical to before the parameter existed; the product + surface passes `product_fields()`. The workspace dict a caller hands in must already be the + matching table object's bucket — this function cannot tell a customer overlay from a + product one, which is exactly why the buckets are separate stores. """ saved = dict((workspace or {}).get("fields") or {}) out = [] - base_keys = {field["key"] for field in FIELDS} - for base in FIELDS: + base_fields = fields_base if fields_base is not None else FIELDS + base_keys = {field["key"] for field in base_fields} + for base in base_fields: meta = saved.get(base["key"]) or {} field = dict(base) if isinstance(meta.get("note"), str): @@ -725,7 +743,10 @@ _LEGACY_MODES = {'dashboard': 'chart'} #: Chart kinds a chart-mode view may hold (wave-8 I19, contract C2). Mirrors the client's #: union. Deliberately small: the owner asked to "start with simple charts" and expand, and a #: kind the client cannot draw is worse than one that does not exist yet. -CHART_KINDS = {'bar', 'line', 'area', 'donut', 'kpi'} +#: Wave-16 C-CHARTCAP: + 'table' — the group-by aggregate table (by-rep / by-BU / +#: top-customers, the third Sales block shape). Client renderer: DashboardView's +#: GroupTableView over salesParity.tableFromSpec. +CHART_KINDS = {'bar', 'line', 'area', 'donut', 'kpi', 'table'} CHART_AGGS = {'sum', 'avg', 'count', 'min', 'max'} MAX_CHARTS = 12 #: per view — a dashboard, not an unbounded render loop MAX_CHART_TITLE = 60 @@ -835,6 +856,13 @@ def _clean_chart(raw, valid_keys): if (isinstance(n, int) and not isinstance(n, bool) and 1 <= n <= TS_MAX_LAST_N): out['span'] = {'lastN': n} + # ── Wave-16 C-CHARTCAP: the YoY companion. Kept ONLY where it can mean something — + # beside a kept bucket (the compare series) or on a sum-of-metric KPI (the delta + # line). Anything else is a stored claim the renderer would have to re-refuse. + # Mirrors the client's cleanCharts rule key for key. + if raw.get('compare') == 'prior_year' and ( + out.get('bucket') or (kind == 'kpi' and out.get('agg') == 'sum')): + out['compare'] = 'prior_year' return out @@ -1256,11 +1284,16 @@ def _default_view_config(fields): } -def views_from_defs(defs, saved_views, fields): - """Convert legacy list formulas into the shared serializable SavedView contract.""" +def views_from_defs(defs, saved_views, fields, system_name="All customers"): + """Convert legacy list formulas into the shared serializable SavedView contract. + + `system_name` (wave 16 C-TOPIC) labels the system view per TOPIC ("All products" on the + product surface). The ID stays "all-customers" on every topic — the client pins it + (UNDELETABLE_VIEW_IDS, the landing default), and an id that varies by surface would fork + that contract for a label's sake.""" base = _default_view_config(fields) views = [{ - "id": "all-customers", "name": "All customers", "kind": "system", + "id": "all-customers", "name": system_name, "kind": "system", "locked": True, "config": dict(base), }] op_map = {">=": "gte", ">": "gt", "<=": "lte", "<": "lt", "=": "eq", @@ -1303,7 +1336,8 @@ def views_from_defs(defs, saved_views, fields): return views -def workspace_wire(ws, uname, pool_pids, defs=None, scope_key='customer', storage_key=None): +def workspace_wire(ws, uname, pool_pids, defs=None, scope_key='customer', storage_key=None, + fields_base=None, with_cohorts=True): """The client's `GridWorkspace` WIRE SHAPE from the stored table workspace — the ONE projection, shared by both servers (app.py's `_table_grid` and the API's `/workspace`). @@ -1319,23 +1353,33 @@ def workspace_wire(ws, uname, pool_pids, defs=None, scope_key='customer', storag HOST-ONLY extras stay with the host: `docs`/`docPayload`, `pool`, `hideViews`, `cohortMode`/`scopeChoice` (the API stamps its own from `?scope=`). + + Wave 16 C-TOPIC: `fields_base` selects the canonical contract (absent = customer, + byte-identical); `with_cohorts=False` is the PRODUCT surface — cohorts are customer + machinery (`modules/cohort` stores partner pids), and resolving them against product pids + would intersect two unrelated id spaces and render a plausible, meaningless member count. """ import modules.cohort as cohort_mod cohort_lists = [] - for cid, c in sorted(cohort_mod.visible(uname, pool_pids).items(), - key=lambda kv: (kv[1].get('name') or '').lower()): - members = [p for p in (c.get('members') or []) if p in pool_pids] - entry = {'id': cid, 'name': c.get('name') or cid, 'pids': members} - # Rule 8b: a member can drop out of the 24-month pool without the cohort being wrong, - # and a silently smaller cohort is exactly what the unverifiable-count rule forbids. - missing = len(c.get('members') or []) - len(members) - if missing: - entry['missing'] = missing - cohort_lists.append(entry) - - fields = fields_from_workspace(ws, cohorts=bool(cohort_lists), scope_key=scope_key) - views = views_from_defs(defs or {}, ws.get('views'), fields) + if with_cohorts: + for cid, c in sorted(cohort_mod.visible(uname, pool_pids).items(), + key=lambda kv: (kv[1].get('name') or '').lower()): + members = [p for p in (c.get('members') or []) if p in pool_pids] + entry = {'id': cid, 'name': c.get('name') or cid, 'pids': members} + # Rule 8b: a member can drop out of the 24-month pool without the cohort being + # wrong, and a silently smaller cohort is exactly what the unverifiable-count rule + # forbids. + missing = len(c.get('members') or []) - len(members) + if missing: + entry['missing'] = missing + cohort_lists.append(entry) + + fields = fields_from_workspace(ws, cohorts=bool(cohort_lists), scope_key=scope_key, + fields_base=fields_base) + views = views_from_defs(defs or {}, ws.get('views'), fields, + system_name=("All products" if scope_key == 'product' + else "All customers")) workspace = {'storageKey': storage_key, 'views': views, 'lists': cohort_lists} # Owner item 3 (2026-07-31): where this user left off. The client's own localStorage copy # wins when present; this is the server's answer for a FRESH browser, which used to fall diff --git a/royalimports_os/aios_grid_fields.json b/royalimports_os/aios_grid_fields.json index 85a5393ae4b78915611d19f40f6aeb37f9084574..94439534efbc960347317d2461ae52a65cac65cf 100644 --- a/royalimports_os/aios_grid_fields.json +++ b/royalimports_os/aios_grid_fields.json @@ -1,230 +1,340 @@ -{ - "_comment": "CANONICAL field contract for the AIOS Airtable-style grid — the SINGLE source of truth. Consumed by royalimports_os/aios_grid.py (embed/Space host) and aios-web/api/main.py (standalone API), and regenerated into aios-web/web/public/sample_customers.json. Edit HERE only, then run aios-web/verify_fields_contract.py. source=odoo is READ-ONLY; source=overlay is the editable stratum (notes/tags) outside Odoo. type in {text,status,select,currency,int,date,pct} (select = a fixed-choice READ-ONLY brand attribute; dba is the first, wave 2026-08-02). `description` (wave 5) is the CANONICAL per-field description — every field must carry one, and since wave 7 (owner W8, 2026-07-28) every description is ONE SHORT PLAIN sentence (two only when a fact would otherwise mislead): what the field IS, nothing else — no filter tips, no '(none)' coaching, no rationale; the user's workspace NOTE overrides it in the (i) hover, never in this file. BUILDER FACT (documented here, deliberately NOT in user-facing text): blank text attributes display as '(none)', so `is '(none)'` — not `is empty` — finds the blanks on agent/city/state/country/zip/payment_terms/pricelist/tags. filterable:false = the CONDITION BUILDER does not offer it (still displayed, still sortable); every such field must have a replacement declared in aios-web/verify_fields_contract.py. 2026-07-27 partner attributes: country/zip/payment_terms/pricelist/tags/customer_since all ship default:false. zip is TEXT because a postal code has leading zeros. Odoo's credit_limit (1% populated) and user_id salesperson (2%) are deliberately ABSENT; agent_ids is the salesperson field and AR is where credit exposure comes from. Wave-5 item 8 (2026-07-27): ltm_rev and at_risk are DELETED — LTM's replacement is a creatable Sales measure column (the demo column IS Sales · the last 12 months), at_risk's replacement is a formula field, e.g. MAX(0, {revenue_ly} - {revenue_ytd}). Wave-6 item 8 (2026-07-27, the no-buildable-presets rule): revenue_ytd, revenue_ly, orders_24m, aov and yoy_pct are DELETED — every one is self-buildable, so a frozen pre-set beside the builder was two ways to ask one question. Replacements (recorded in verify_fields_contract.py): creatable measure columns for Sales / Orders / Avg order $ over any period (harness/measure_filter.py ADMITTED carries revenue, orders and the composite aov), and a formula over two measure columns for YoY, e.g. ({sales_ytd} - {sales_ly}) / {sales_ly}. Stale view colIds naming the five self-heal on the next autosave (the established rule).", - "fields": [ - { - "key": "customer", - "label": "Customer", - "type": "text", - "source": "odoo", - "pinned": true, - "default": true, - "description": "The customer's name in Odoo. One row per customer who ordered in the last 24 months." - }, - { - "key": "odoo_status", - "label": "Odoo record", - "type": "status", - "source": "odoo", - "default": false, - "description": "Whether this customer still exists in Odoo. Archived means deleted there." - }, - { - "key": "agent", - "label": "Agent", - "type": "text", - "source": "odoo", - "default": true, - "description": "The sales agent who owns this account." - }, - { - "key": "dba", - "label": "DBA", - "type": "select", - "source": "odoo", - "default": false, - "options": [ - "Fisch", - "Royal", - "Both" - ], - "description": "The brand this customer buys from - Fisch, Royal, or both. Amazon-channel orders are not a DBA." - }, - { - "key": "salesperson", - "label": "Salesperson", - "type": "text", - "source": "odoo", - "default": false, - "description": "Who keyed in most of this customer's orders — not the Agent, who owns the account." - }, - { - "key": "city", - "label": "City", - "type": "text", - "source": "odoo", - "default": true, - "description": "City on the customer's Odoo address." - }, - { - "key": "state", - "label": "State", - "type": "text", - "source": "odoo", - "default": true, - "description": "State or province on the customer's Odoo address." - }, - { - "key": "country", - "label": "Country", - "type": "text", - "source": "odoo", - "default": false, - "description": "Country on the customer's Odoo address." - }, - { - "key": "zip", - "label": "ZIP", - "type": "text", - "source": "odoo", - "default": false, - "description": "Postal code on the customer's Odoo address." - }, - { - "key": "customer_since", - "label": "Customer since", - "type": "date", - "source": "odoo", - "default": false, - "description": "When this customer was first set up in Odoo." - }, - { - "key": "tags", - "label": "Tags", - "type": "text", - "source": "odoo", - "default": false, - "description": "Odoo labels on this customer, comma-separated." - }, - { - "key": "pricelist", - "label": "Price list", - "type": "text", - "source": "odoo", - "default": false, - "description": "The price list this customer buys on." - }, - { - "key": "payment_terms", - "label": "Payment terms", - "type": "text", - "source": "odoo", - "default": false, - "description": "Payment terms on this customer's account — Net 30, for example." - }, - { - "key": "last_order", - "label": "Last order", - "type": "date", - "source": "odoo", - "default": true, - "description": "Date of the most recent confirmed order." - }, - { - "key": "overdue_days", - "label": "Overdue days", - "type": "int", - "source": "odoo", - "default": true, - "description": "How many days late this customer is running against their own usual ordering rhythm." - }, - { - "_note": "filterable:false — DERIVED ANALYTIC: est_missed is min(cycles missed, 3) x AOV, a score we compute rather than an object the business has, so a condition on it would read as a fact about the customer when it is a fact about our arithmetic. It still displays and still sorts. Until wave 6 this flag also covered the frozen-window presets (revenue_ytd / revenue_ly / orders_24m / aov / yoy_pct); those are now DELETED outright under the owner's no-buildable-presets rule — see _comment. est_missed itself STAYS: no creatable measure or formula reproduces the cadence model behind it.", - "key": "est_missed", - "label": "Est. missed $", - "type": "currency", - "source": "odoo", - "default": true, - "agg": "sum", - "filterable": false, - "description": "Estimated sales missed while quiet: missed orders (capped at 3) times average order value. An estimate, not money owed." - }, - { - "key": "ar_open", - "label": "AR open $", - "type": "currency", - "source": "odoo", - "default": false, - "description": "Invoiced money owed, not yet overdue." - }, - { - "key": "ar_overdue", - "label": "AR overdue $", - "type": "currency", - "source": "odoo", - "default": false, - "description": "Invoiced money past due — same basis as the Collections page." - }, - { - "key": "ar_exposure", - "label": "Credit exposure $", - "type": "currency", - "source": "odoo", - "default": false, - "description": "The most you could be out if they stopped paying today: open, overdue, draft and not-yet-invoiced." - }, - { - "key": "days_to_pay", - "label": "Days to pay", - "type": "int", - "source": "odoo", - "default": false, - "description": "Average days to pay an invoice in full. Blank means no fully paid invoice yet." - }, - { - "key": "top_category", - "label": "Top category", - "type": "text", - "source": "odoo", - "default": false, - "description": "The category this customer spent the most on in the last 12 months." - }, - { - "key": "top_category_pct", - "label": "Top category %", - "type": "pct", - "source": "odoo", - "default": false, - "description": "Share of last-12-months spend that went to the top category." - }, - { - "key": "sku_count", - "label": "SKUs bought", - "type": "int", - "source": "odoo", - "default": false, - "description": "Distinct products bought in the last 12 months." - }, - { - "key": "top_sku", - "label": "Top SKU", - "type": "text", - "source": "odoo", - "default": false, - "description": "The product this customer spent the most on in the last 12 months." - }, - { - "key": "days_since", - "label": "Days since order", - "type": "int", - "source": "odoo", - "default": false, - "description": "Days since the last confirmed order." - }, - { - "key": "typical_gap_days", - "label": "Typical gap days", - "type": "int", - "source": "odoo", - "default": false, - "description": "Days this customer usually goes between orders, from their own history." - }, - { - "key": "notes", - "label": "Notes", - "type": "text", - "source": "overlay", - "default": false, - "description": "Your notes on this customer. Saved in this app only, visible only to you." - } - ] -} +{ + "_comment": "CANONICAL field contract for the AIOS Airtable-style grid \u2014 the SINGLE source of truth. Consumed by royalimports_os/aios_grid.py (embed/Space host) and aios-web/api/main.py (standalone API), and regenerated into aios-web/web/public/sample_customers.json. Edit HERE only, then run aios-web/verify_fields_contract.py. source=odoo is READ-ONLY; source=overlay is the editable stratum (notes/tags) outside Odoo. type in {text,status,select,currency,int,date,pct} (select = a fixed-choice READ-ONLY brand attribute; dba is the first, wave 2026-08-02). `description` (wave 5) is the CANONICAL per-field description \u2014 every field must carry one, and since wave 7 (owner W8, 2026-07-28) every description is ONE SHORT PLAIN sentence (two only when a fact would otherwise mislead): what the field IS, nothing else \u2014 no filter tips, no '(none)' coaching, no rationale; the user's workspace NOTE overrides it in the (i) hover, never in this file. BUILDER FACT (documented here, deliberately NOT in user-facing text): blank text attributes display as '(none)', so `is '(none)'` \u2014 not `is empty` \u2014 finds the blanks on agent/city/state/country/zip/payment_terms/pricelist/tags. filterable:false = the CONDITION BUILDER does not offer it (still displayed, still sortable); every such field must have a replacement declared in aios-web/verify_fields_contract.py. 2026-07-27 partner attributes: country/zip/payment_terms/pricelist/tags/customer_since all ship default:false. zip is TEXT because a postal code has leading zeros. Odoo's credit_limit (1% populated) and user_id salesperson (2%) are deliberately ABSENT; agent_ids is the salesperson field and AR is where credit exposure comes from. Wave-5 item 8 (2026-07-27): ltm_rev and at_risk are DELETED \u2014 LTM's replacement is a creatable Sales measure column (the demo column IS Sales \u00b7 the last 12 months), at_risk's replacement is a formula field, e.g. MAX(0, {revenue_ly} - {revenue_ytd}). Wave-6 item 8 (2026-07-27, the no-buildable-presets rule): revenue_ytd, revenue_ly, orders_24m, aov and yoy_pct are DELETED \u2014 every one is self-buildable, so a frozen pre-set beside the builder was two ways to ask one question. Replacements (recorded in verify_fields_contract.py): creatable measure columns for Sales / Orders / Avg order $ over any period (harness/measure_filter.py ADMITTED carries revenue, orders and the composite aov), and a formula over two measure columns for YoY, e.g. ({sales_ytd} - {sales_ly}) / {sales_ly}. Stale view colIds naming the five self-heal on the next autosave (the established rule).", + "fields": [ + { + "key": "customer", + "label": "Customer", + "type": "text", + "source": "odoo", + "pinned": true, + "default": true, + "description": "The customer's name in Odoo. One row per customer who ordered in the last 24 months." + }, + { + "key": "odoo_status", + "label": "Odoo record", + "type": "status", + "source": "odoo", + "default": false, + "description": "Whether this customer still exists in Odoo. Archived means deleted there." + }, + { + "key": "agent", + "label": "Agent", + "type": "text", + "source": "odoo", + "default": true, + "description": "The sales agent who owns this account." + }, + { + "key": "dba", + "label": "DBA", + "type": "select", + "source": "odoo", + "default": false, + "options": [ + "Fisch", + "Royal", + "Both" + ], + "description": "The brand this customer buys from - Fisch, Royal, or both. Amazon-channel orders are not a DBA." + }, + { + "key": "salesperson", + "label": "Salesperson", + "type": "text", + "source": "odoo", + "default": false, + "description": "Who keyed in most of this customer's orders \u2014 not the Agent, who owns the account." + }, + { + "key": "city", + "label": "City", + "type": "text", + "source": "odoo", + "default": true, + "description": "City on the customer's Odoo address." + }, + { + "key": "state", + "label": "State", + "type": "text", + "source": "odoo", + "default": true, + "description": "State or province on the customer's Odoo address." + }, + { + "key": "country", + "label": "Country", + "type": "text", + "source": "odoo", + "default": false, + "description": "Country on the customer's Odoo address." + }, + { + "key": "zip", + "label": "ZIP", + "type": "text", + "source": "odoo", + "default": false, + "description": "Postal code on the customer's Odoo address." + }, + { + "key": "customer_since", + "label": "Customer since", + "type": "date", + "source": "odoo", + "default": false, + "description": "When this customer was first set up in Odoo." + }, + { + "key": "tags", + "label": "Tags", + "type": "text", + "source": "odoo", + "default": false, + "description": "Odoo labels on this customer, comma-separated." + }, + { + "key": "pricelist", + "label": "Price list", + "type": "text", + "source": "odoo", + "default": false, + "description": "The price list this customer buys on." + }, + { + "key": "payment_terms", + "label": "Payment terms", + "type": "text", + "source": "odoo", + "default": false, + "description": "Payment terms on this customer's account \u2014 Net 30, for example." + }, + { + "key": "last_order", + "label": "Last order", + "type": "date", + "source": "odoo", + "default": true, + "description": "Date of the most recent confirmed order." + }, + { + "key": "overdue_days", + "label": "Overdue days", + "type": "int", + "source": "odoo", + "default": true, + "description": "How many days late this customer is running against their own usual ordering rhythm." + }, + { + "_note": "filterable:false \u2014 DERIVED ANALYTIC: est_missed is min(cycles missed, 3) x AOV, a score we compute rather than an object the business has, so a condition on it would read as a fact about the customer when it is a fact about our arithmetic. It still displays and still sorts. Until wave 6 this flag also covered the frozen-window presets (revenue_ytd / revenue_ly / orders_24m / aov / yoy_pct); those are now DELETED outright under the owner's no-buildable-presets rule \u2014 see _comment. est_missed itself STAYS: no creatable measure or formula reproduces the cadence model behind it.", + "key": "est_missed", + "label": "Est. missed $", + "type": "currency", + "source": "odoo", + "default": true, + "agg": "sum", + "filterable": false, + "description": "Estimated sales missed while quiet: missed orders (capped at 3) times average order value. An estimate, not money owed." + }, + { + "key": "ar_open", + "label": "AR open $", + "type": "currency", + "source": "odoo", + "default": false, + "description": "Invoiced money owed, not yet overdue." + }, + { + "key": "ar_overdue", + "label": "AR overdue $", + "type": "currency", + "source": "odoo", + "default": false, + "description": "Invoiced money past due \u2014 same basis as the Collections page." + }, + { + "key": "ar_exposure", + "label": "Credit exposure $", + "type": "currency", + "source": "odoo", + "default": false, + "description": "The most you could be out if they stopped paying today: open, overdue, draft and not-yet-invoiced." + }, + { + "key": "days_to_pay", + "label": "Days to pay", + "type": "int", + "source": "odoo", + "default": false, + "description": "Average days to pay an invoice in full. Blank means no fully paid invoice yet." + }, + { + "key": "top_category", + "label": "Top category", + "type": "text", + "source": "odoo", + "default": false, + "description": "The category this customer spent the most on in the last 12 months." + }, + { + "key": "top_category_pct", + "label": "Top category %", + "type": "pct", + "source": "odoo", + "default": false, + "description": "Share of last-12-months spend that went to the top category." + }, + { + "key": "sku_count", + "label": "SKUs bought", + "type": "int", + "source": "odoo", + "default": false, + "description": "Distinct products bought in the last 12 months." + }, + { + "key": "top_sku", + "label": "Top SKU", + "type": "text", + "source": "odoo", + "default": false, + "description": "The product this customer spent the most on in the last 12 months." + }, + { + "key": "days_since", + "label": "Days since order", + "type": "int", + "source": "odoo", + "default": false, + "description": "Days since the last confirmed order." + }, + { + "key": "typical_gap_days", + "label": "Typical gap days", + "type": "int", + "source": "odoo", + "default": false, + "description": "Days this customer usually goes between orders, from their own history." + }, + { + "key": "notes", + "label": "Notes", + "type": "text", + "source": "overlay", + "default": false, + "description": "Your notes on this customer. Saved in this app only, visible only to you." + } + ], + "_product_comment": "ADDITIVE, wave 15 C-TOPIC. The PRODUCT table's field contract. Kept as a SEPARATE top-level key rather than restructuring `fields` into {customer_data, product_data}: both existing readers (aios_grid._load_fields, aios-web/api/main.py) index doc['fields'] directly, and reshaping that mid-wave would break the embed for a cosmetic gain. The keyed shape can arrive when both readers move in ONE commit; until then this is the product half and `fields` is the customer half.", + "product_data": { + "identity": "pid", + "business_key": "code", + "fields": [ + { + "key": "code", + "label": "SKU", + "type": "text", + "source": "odoo", + "pinned": true, + "default": true, + "description": "The SKU code \u2014 the product's real business key. `pid` is a stable CRC32 of it because the grid keys on an integer." + }, + { + "key": "product", + "label": "Product", + "type": "text", + "source": "odoo", + "default": true, + "description": "Product name as it appears in Odoo." + }, + { + "key": "category", + "label": "Category", + "type": "select", + "source": "odoo", + "default": true, + "description": "Product category; '(uncategorized)' when Odoo carries none." + }, + { + "key": "rev_ytd", + "label": "Revenue YTD", + "type": "currency", + "source": "odoo", + "default": true, + "description": "Year-to-date revenue for this SKU, BU-scoped when the caller is." + }, + { + "key": "rev_ly", + "label": "Revenue LY", + "type": "currency", + "source": "odoo", + "description": "Same period last year \u2014 seasonal wholesale compares like for like." + }, + { + "key": "yoy_pct", + "label": "YoY %", + "type": "pct", + "source": "odoo", + "description": "Year-over-year change; null when last year was zero (a ratio to zero is not a number)." + }, + { + "key": "qty_ytd", + "label": "Units YTD", + "type": "int", + "source": "odoo", + "description": "Units sold year to date." + }, + { + "key": "orders_ytd", + "label": "Orders YTD", + "type": "int", + "source": "odoo", + "description": "Distinct orders containing this SKU, year to date." + }, + { + "key": "on_hand", + "label": "On hand", + "type": "int", + "source": "odoo", + "description": "Units in stock. CONSOLIDATED \u2014 one physical warehouse, not brand-tagged, so this column is ABSENT for a BU-scoped caller rather than silently company-wide." + }, + { + "key": "unit_cost", + "label": "Unit cost", + "type": "currency", + "source": "odoo", + "description": "Inventory unit cost. Consolidated; absent for a BU-scoped caller." + }, + { + "key": "inv_value", + "label": "Stock value", + "type": "currency", + "source": "odoo", + "description": "On-hand value at cost. Consolidated; absent for a BU-scoped caller." + }, + { + "key": "qty_ltm", + "label": "Units LTM", + "type": "int", + "source": "odoo", + "description": "Units sold in the last twelve months. Consolidated; absent for a BU-scoped caller." + }, + { + "key": "dos", + "label": "Days of supply", + "type": "int", + "source": "odoo", + "description": "Days of supply at the LTM rate; null means it never sells through. Consolidated; absent for a BU-scoped caller." + }, + { + "key": "stock_bucket", + "label": "Stock status", + "type": "select", + "source": "odoo", + "description": "Dead / excess / healthy bucket from the inventory module. Consolidated; absent for a BU-scoped caller." + } + ] + } +} diff --git a/royalimports_os/core/grid_events.py b/royalimports_os/core/grid_events.py index 0bc817ea55f131d90cc09dbfc0df84b22f0ac4c6..8fbf00e2c28545e4717dfcc5e3e674e0d706c3cf 100644 --- a/royalimports_os/core/grid_events.py +++ b/royalimports_os/core/grid_events.py @@ -112,7 +112,20 @@ class EventCtx: measure_offer: tuple = () visible_views: tuple = () admin: bool = False + #: ⛔ WAVE 15 C-PERM — the fields this caller's PERMANENT PERMISSIONS hide, transitive + #: closure included (`core.perm_scope.hidden_keys`). A SECURITY parameter in the same class + #: as `allowed_pids`, and here for the same reason: the read paths strip a hidden field from + #: both wires, so a caller cannot SEE it — but without this they could still WRITE it by + #: naming the key, because `overlay_keys` only asks whether the column exists. Empty means + #: "nothing hidden", which is every legacy record and therefore every caller today. + hidden_keys: frozenset = frozenset() scope_key: str = 'customer' + #: Wave 16 C-TOPIC — the TABLE OPS this ctx reads and writes (a `core.table_store.make` + #: object). None = the CUSTOMER table (`modules.customer_data.TABLE_OPS`), which keeps + #: every existing caller byte-identical. The PRODUCT surface passes + #: `modules.product_data.TABLE_OPS` so its views/fields/overlays land in the product + #: bucket — never the customer one, whose pids are a different id space entirely. + table: Optional[object] = None seen_ids: Optional[MutableMapping] = None fallback_ws: Optional[MutableMapping] = None out: EventResult = field(default_factory=EventResult) @@ -125,6 +138,13 @@ class EventCtx: self.seen_ids = {} +def _tops(ctx): + """The table-ops object this ctx operates on — the customer table unless the caller chose + another topic. ONE resolution point so 'which bucket does this write land in' has exactly + one answer per event.""" + return ctx.table if ctx.table is not None else cl_mod.TABLE_OPS + + # ------------------------------------------------------------------ the workspace family (X1 amd.) def table_workspace(ctx, allowed_pids=None, consume_corrections=True): """Durable Airtable-style view/schema/overlay state, with an honest session fallback. @@ -148,10 +168,10 @@ def table_workspace(ctx, allowed_pids=None, consume_corrections=True): """ uname = ctx.uname if store.available(): - ws = cl_mod.table_workspace( + ws = _tops(ctx).workspace( uname, consume_corrections=bool(consume_corrections)) try: - shared = cl_mod.shared_table_views(uname, bool(ctx.admin)) + shared = _tops(ctx).shared_views(uname, bool(ctx.admin)) except Exception as _se: _tel.error('sharedviews:read', _se) shared = {} @@ -410,7 +430,7 @@ def handle_one(event, ctx): vid = str(event.get('viewId') or '').strip()[:120] if vid and store.available(): try: - cl_mod.save_table_active_view(uname, vid) + _tops(ctx).save_active_view(uname, vid) except Exception as _ae: _tel.error('grid:view-select', _ae) return False @@ -430,7 +450,7 @@ def handle_one(event, ctx): seen.add(k) order.append(k) if store.available(): - cl_mod.save_table_record_layout(uname, order) + _tops(ctx).save_record_layout(uname, order) else: _session_ready() if order: @@ -530,7 +550,7 @@ def handle_one(event, ctx): # caller may not SEE reads as absent — which would look like a CREATE and let anybody # overwrite somebody else's shared view by guessing its id. Ask the store for the raw # record and refuse before deciding anything else. Fail-closed on both branches. - _raw_shared = cl_mod.shared_table_view(view_id) if store.available() else None + _raw_shared = _tops(ctx).shared_view(view_id) if store.available() else None if _raw_shared is not None and not prior: return False # exists, not visible to this caller: refuse if _raw_shared is not None and not _tstore._may_edit(_raw_shared, uname, admin): @@ -621,7 +641,7 @@ def handle_one(event, ctx): if view_id != 'all-customers': _reserved_view_names.append('All customers') if store.available(): - view = (cl_mod.save_table_view( + view = (_tops(ctx).save_view( uname, view, reserved_names=_reserved_view_names, is_admin=admin) or view) else: _session_ready() @@ -666,11 +686,11 @@ def handle_one(event, ctx): # only. A collaborator can change what a shared view shows; they cannot destroy # everybody else's copy of it, because there is only one copy. if store.available(): - _raw_shared = cl_mod.shared_table_view(view_id) + _raw_shared = _tops(ctx).shared_view(view_id) if _raw_shared is not None and not _tstore._may_administer( _raw_shared, uname, admin): return False - cl_mod.delete_table_view(uname, view_id) + _tops(ctx).delete_view(uname, view_id) else: _session_ready() ws['views'].pop(view_id, None) @@ -807,7 +827,7 @@ def handle_one(event, ctx): and isinstance(value, dict)) ] if store.available(): - field = (cl_mod.save_table_field( + field = (_tops(ctx).save_field( uname, field, reserved_names=_reserved_field_names, correction_id=event_id) or field) else: @@ -1052,7 +1072,7 @@ def handle_one(event, ctx): _res = _mutate(table_workspace(ctx, consume_corrections=False)) if _res is None: return False # refused: nothing is written - cl_mod.save_table_folders(uname, _res[0], _res[1]) + _tops(ctx).save_folders(uname, _res[0], _res[1]) # True: the sidebars render from server state (which folder holds what), not from local # optimism — the same contract the cohort panel's membership edits ride. return True @@ -1069,7 +1089,7 @@ def handle_one(event, ctx): if not (key.startswith('custom_') or key.startswith(_ag3.MEASURE_FIELD_PREFIX)): return False if store.available(): - cl_mod.delete_table_field(uname, key) + _tops(ctx).delete_field(uname, key) else: _session_ready() ws['fields'].pop(key, None) @@ -1121,7 +1141,7 @@ def handle_one(event, ctx): else: clone.pop('scope', None) if store.available(): - clone = (cl_mod.duplicate_table_field( + clone = (_tops(ctx).duplicate_field( uname, src_key, new_key, clone, reserved_names=_reserved_field_names, correction_id=event_id) or clone) @@ -1198,6 +1218,14 @@ def handle_one(event, ctx): if key not in overlay_keys or not isinstance(value, (str, int, float)): refused = True continue + # C-PERM: a field this caller's permissions HIDE cannot be written, only refused. + # `overlay_keys` asks whether the column exists, not whether this person may touch + # it — so without this line a restricted user who knows a hidden key could PATCH a + # value they are not allowed to read back. Refused LOUDLY (repaint) so the client + # reverts rather than showing a value the store never took. + if key in (ctx.hidden_keys or frozenset()): + refused = True + continue # Wave-5 item 1: `permissions.edit` is enforced HERE, per key — the client hiding # its editor is courtesy, this is the wall. Fail-closed: a restricted field with # no readable createdBy admits only admins. @@ -1246,7 +1274,7 @@ def handle_one(event, ctx): updates[key] = clean if updates: if store.available(): - cl_mod.patch_table_overlay(uname, pid, updates) + _tops(ctx).patch_overlay(uname, pid, updates) else: _session_ready() ws['overlays'].setdefault(str(pid), {}).update(updates) diff --git a/royalimports_os/core/perm_migrate.py b/royalimports_os/core/perm_migrate.py new file mode 100644 index 0000000000000000000000000000000000000000..ee7aaca3bcfd5fc979d385cd630d3542bf42d984 --- /dev/null +++ b/royalimports_os/core/perm_migrate.py @@ -0,0 +1,156 @@ +"""core/perm_migrate.py — R1's one-time migration: `bus`/`agent` become a PERMANENT FILTER. + +Owner ruling R1: BU access stops being its own field and becomes an ordinary permanent filter +under the permissioning engine, declared and edited exactly like "Agent is Tara". This module +builds that filter from the legacy record and — the part that matters — PROVES the swap is a +no-op before anything relies on it. + +⛔ WHY THE PROOF IS ABOUT VALUES AND NOT ABOUT ROWS (C-PERM amendment 3). +`modules/customer_data._pool_build` passes `team_id` into `cust._cust_rev` three times (YTD, LY, +LTM) and into `cust._cadence_bulk`. It therefore decides what `rev`, `ly`, `ltm`, `aov`, +`est_missed` and the derived `status` MEAN — it is not a row filter. Swap it for a post-filter +and a Fisch-only user keeps a plausible row LIST while every number on it quietly becomes +Fisch+Royal, worst for `dba = Both` customers, who are precisely the ones a BU filter admits. +A pid-set reconciliation reports GREEN on that. So `reconcile()` compares VALUES. + +The pushdown survives as `perm_scope.derive_pool_scope` — a DERIVATION OF the filter rather than +a wall beside it — so a correctly migrated record produces the IDENTICAL pool call, and the +reconciliation below should be exact rather than merely close. If it is not exact, that is a +finding for the owner, not a tolerance to widen. +""" +import core.perm_scope as perm_scope +import core.perms as perms + +MODULE = 'customer_data' + +#: `_dba_attrs` emits exactly {'Fisch','Royal','Both'} (blank = no brand attributable in 24 +#: months). A BU grant admits its own brand AND the dual-brand customers: a Both customer IS a +#: Fisch customer. Mirrors `perm_scope._DBA_TEAM`, inverted. +#: +#: ⚠ TWO VALUES, AND THE COLUMN VOCABULARY HAS NO "IS ANY OF". `FILTER_OPS` is single-valued by +#: design (`eq`, `neq`, `contains`, …) — `anyOf` belongs to the COHORT vocabulary and is +#: deliberately DISJOINT from it, so a column leaf carrying `anyOf` is refused by every engine +#: (`filter_eval` returns False, `clean_filter_tree` drops it). This migration's first draft +#: emitted exactly that and `reconcile()` caught it as two lost customers. So the BU condition +#: is an OR GROUP of `eq` leaves, which is what the condition builder itself produces. +_TEAM_DBA = {5: ('Fisch', 'Both'), 6: ('Royal', 'Both')} + + +def filter_for(rec): + """The permanent filter equivalent to this record's legacy `bus` + `agent`, or None when the + record was unrestricted (an admin, or `bus:'all'` with no agent link). + + AND-conjoined at the root, and top-level by construction — which is also what makes it + pushdown-derivable (`derive_pool_scope` reads top-level AND leaves only). + """ + nodes = [] + team_id = perms.scope_team_id(rec) + if team_id in _TEAM_DBA: + nodes.append({'conj': 'or', + 'children': [{'colId': 'dba', 'op': 'eq', 'value': v, 'value2': ''} + for v in _TEAM_DBA[team_id]]}) + agent = perms.scope_agent(rec) + if agent: + nodes.append({'colId': 'agent', 'op': 'eq', 'value': str(agent), 'value2': ''}) + if not nodes: + return None + return {'conj': 'and', 'nodes': nodes} + + +def perms_for(rec, modules=(MODULE,)): + """The `perms` block this legacy record becomes. + + ⚠ ACCESS IS COPIED FROM THE OLD GRANT, NOT ASSUMED. `may_open` is what decided reachability + before this wave, so migrating a record must not widen it — and on a migrated record an + undeclared module DENIES (amendment 4), so every module the user could reach has to be + declared here or the migration is a lockout. + """ + out = {} + for key in modules: + out[key] = {'access': bool(perms.may_open(rec, key)), + 'filter': filter_for(rec), + 'hiddenFields': []} + return out + + +def plan(registry_dict, modules=(MODULE,)): + """`{username: perms_block}` for every record that is not already migrated. + + Admins are included and get an all-access block with no filter: they bypass `perm_scope` + anyway, but leaving them un-migrated would keep the legacy reader alive for the one account + most likely to be inspected when something looks wrong. + """ + out = {} + for uname, rec in (registry_dict or {}).items(): + if not isinstance(rec, dict) or perm_scope.is_migrated(rec): + continue + out[uname] = perms_for(rec, modules) + return out + + +#: The row members whose meaning depends on `team_id` — the ones amendment 3 is about. A +#: reconciliation that skipped these would be the pid-only gate that cannot see the leak. +VALUE_KEYS = ('rev', 'ly', 'ltm', 'aov', 'est_missed', 'status', 'orders', 'last_order') + + +def reconcile(rec, pool_fn, modules=(MODULE,)): + """Prove the migrated record sees EXACTLY what the legacy record saw. + + `pool_fn(agent, team_id) -> rows` is injected so this is testable without Odoo and so the + caller decides whether to hit the live builder or a fixture. + + Returns `{ok, legacy_scope, derived_scope, lost, gained, value_diffs}`: + * `lost` — pids the legacy wall admitted and the migrated one drops. Expected to be + EMPTY. One narrow class is known and must be REPORTED rather than tolerated: + `_dba_attrs` uses a 731-day window while `_cust_rev`'s LY window can reach a + little further back, so a customer whose only in-scope revenue predates that + window carries a BLANK `dba` and fails a `dba` leaf. Blank is the honest "no + brand attributable" state, so such a customer is NAMED here, never rounded + away. + * `gained` — pids the migrated wall admits and the legacy one did not. Must be empty: it + is the widening direction, and there is no acceptable non-empty value. + * `value_diffs` — per-pid disagreements on VALUE_KEYS. The assertion amendment 3 exists + for; a non-empty list means the pushdown was not applied and the numbers are + consolidated. + """ + legacy_scope = (perms.scope_agent(rec), perms.scope_team_id(rec)) + migrated = dict(rec) + migrated['perms'] = perms_for(rec, modules) + migrated['perms_v'] = perm_scope.PERMS_VERSION + team_id, agent = perm_scope.derive_pool_scope(migrated, MODULE) + derived_scope = (agent, team_id) + + legacy_rows = pool_fn(legacy_scope[0], legacy_scope[1]) + derived_rows = pool_fn(agent, team_id) + fields = _fields_of(legacy_rows) + kept = perm_scope.apply_row_scope(derived_rows, migrated, MODULE, fields) + + legacy_by = {r.get('pid'): r for r in legacy_rows} + kept_by = {r.get('pid'): r for r in kept} + lost = sorted(set(legacy_by) - set(kept_by)) + gained = sorted(set(kept_by) - set(legacy_by)) + + value_diffs = [] + for pid in sorted(set(legacy_by) & set(kept_by)): + a, b = legacy_by[pid], kept_by[pid] + for k in VALUE_KEYS: + if k in a and a.get(k) != b.get(k): + value_diffs.append({'pid': pid, 'key': k, + 'legacy': a.get(k), 'migrated': b.get(k)}) + return {'ok': not lost and not gained and not value_diffs, + 'legacy_scope': legacy_scope, 'derived_scope': derived_scope, + 'lost': lost, 'gained': gained, 'value_diffs': value_diffs, + 'names': {r.get('pid'): r.get('customer') for r in legacy_rows + if r.get('pid') in set(lost)}} + + +def _fields_of(rows): + """A field list good enough to EVALUATE with, inferred from the assembled rows. + + The permanent filters this module builds name `dba` (text) and `agent` (text) only, so the + inference is exact for them. It is deliberately not a schema: `permits()` needs types to + dispatch comparisons, and inferring `text` for an unknown key would be a guess with + consequences — so anything not recognised is left out, which makes its leaf unanswerable and + therefore DENYING rather than silently mistyped. + """ + return [{'key': 'dba', 'type': 'text'}, {'key': 'agent', 'type': 'text'}] diff --git a/royalimports_os/core/perm_scope.py b/royalimports_os/core/perm_scope.py new file mode 100644 index 0000000000000000000000000000000000000000..8267a4902756280d0475592351f3d0730b5f0a6c --- /dev/null +++ b/royalimports_os/core/perm_scope.py @@ -0,0 +1,286 @@ +"""core/perm_scope.py — the permission WALL for table modules (wave 15, C-PERM). + +ONE place answers the three questions a restricted account raises on a grid surface: + + may_access(user, module) may they open it at all? + visible_fields(fields, u, mod) which COLUMNS may they receive? + apply_row_scope(rows, u, mod, …) which ROWS may they receive? + +plus one that exists only because of how the pool is built: + + derive_pool_scope(user, module) which (team_id, agent) must the pool be BUILT with? + +Both hosts call these — `aios-web/api` (`grid_assembly`) and `app.py` (`_table_grid`) — because +a wall that exists on one runtime and not the other is not a wall. `core/perms.py` stays what it +is (module GRANTS + the legacy BU derivation); this module is the row/field/pushdown layer that +sits on top, and it is deliberately a separate file so the legacy readers can keep their +semantics untouched while this one fails closed. + +──────────────────────────────────────────────────────────────────────────────────────────── +THE RECORD + + user['perms'] = {'': {'access': bool, + 'filter': {'conj'?: 'and'|'or', 'nodes': [...]} | None, + 'hiddenFields': ['', ...]}} + user['perms_v'] = 1 stamped by the migration and by every write + +`perms_v` is the EXPLICIT-RESOLUTION marker, and it is here because of `permissioning.md` +Part II gap #5: "`allowed_modules() is None` is fail-open by default … make 'resolved: +unrestricted' an explicit value so absence/uncertainty DENIES." The same class already shipped +twice in this codebase (`modules: []` and `bus: []` both read as UNRESTRICTED — +`routes_admin.py`'s own docstring documents both). So: + + * `perms_v` ABSENT → the record is UN-MIGRATED, and the LEGACY wall applies unchanged + (`core.perms` module grants + the `bus`/`agent` query scope). That is not fail-open: it is + today's real wall, and it bounds the rollout window to "until the migration runs". + * `perms_v == 1` and the module has NO entry → **DENY**. Absence now means what it says. + * `role == 'admin'` bypasses all of it — which is also what keeps BREAK-GLASS alive. + `deps._user_for` hands back a hardcoded master dict on a store outage + (`{'username':'admin','role':'admin','bus':'all','modules':'all'}`) that will never carry a + perms block; without this clause an explicit-marker scheme locks the owner out of their own + product at exactly the moment the store is broken. +""" +import re + +import core.perms as perms + +#: `aios_grid._FORMULA_REF`'s pattern, restated rather than imported: this module is imported by +#: the API's request path and `aios_grid` pulls in the whole grid stack. Same regex, one line, +#: and `verify_api` asserts the two agree so it cannot drift into a different grammar. +_FORMULA_REF = re.compile(r"\{([^{}]*)\}") + +PERMS_VERSION = 1 + + +def _rec(user): + return user if isinstance(user, dict) else {} + + +def is_migrated(user): + """True once this record carries an explicit resolution. See the module docstring.""" + return int(_rec(user).get('perms_v') or 0) >= PERMS_VERSION + + +def entry(user, module): + """This user's declared permissions for `module`, or None if nothing is declared. + + None is AMBIGUOUS on purpose and every caller must resolve it against `is_migrated`: + on a migrated record it means DENY, on a legacy one it means "ask the old wall". + """ + p = _rec(user).get('perms') + if not isinstance(p, dict): + return None + e = p.get(module) + return e if isinstance(e, dict) else None + + +def may_access(user, module): + """May this account open `module` at all? Fail-closed on a migrated record.""" + if perms.is_admin(user): + return True + e = entry(user, module) + if e is not None: + return bool(e.get('access', True)) + if is_migrated(user): + # Migrated and undeclared = denied. This is the whole point of the marker. + return False + return perms.may_open(user, module) # legacy record: the old grant wall + + +# ── FIELDS ─────────────────────────────────────────────────────────────────────────────────── +def hidden_keys(user, module, fields): + """The TRANSITIVE closure of hidden field keys (C-PERM amendment 5). + + ⛔ WHY A CLOSURE AND NOT A SET DIFFERENCE. A formula field is computed in the BROWSER + (`formulaEngine.ts`, injected by `computedRows`) from `{ref}`s into other columns, and a + measure column's value arrives precomputed in `derived`. So hiding field X has exactly three + possible outcomes and only one of them is coherent: + + strip X, keep formulas → every formula over X computes blank or wrong, silently + keep X's value for them → X has leaked, wearing a formula's name + strip X AND its dependents→ the only honest answer + + So a hidden field drags every formula that references it — and every formula that references + THAT formula, hence the fixpoint loop — out of the payload with it. + + ⚠ This runs on every assembly, so it is a fixpoint over a handful of custom fields, not a + graph library. `MAX_PASSES` bounds a reference cycle the client would refuse to evaluate + anyway; without it a self-referential pair would spin here. + """ + e = entry(user, module) + if perms.is_admin(user) or not e: + return frozenset() + hidden = {str(k) for k in (e.get('hiddenFields') or ()) if k} + if not hidden: + return frozenset() + + refs = {} + for f in fields or (): + if not isinstance(f, dict) or not f.get('key'): + continue + expr = f.get('formula') + if isinstance(expr, str) and expr: + refs[f['key']] = {m.strip() for m in _FORMULA_REF.findall(expr) if m.strip()} + + MAX_PASSES = 12 + for _ in range(MAX_PASSES): + grew = False + for key, deps in refs.items(): + if key not in hidden and deps & hidden: + hidden.add(key) + grew = True + if not grew: + break + return frozenset(hidden) + + +def visible_fields(fields, user, module): + """`fields` minus the hidden closure. Order preserved — the column order is the user's.""" + hide = hidden_keys(user, module, fields) + if not hide: + return list(fields or ()) + return [f for f in (fields or ()) + if not (isinstance(f, dict) and f.get('key') in hide)] + + +def strip_row(row, hide): + """Drop hidden keys from ONE assembled row. Cheap enough to run per row, and it must run + per row: the field list and the row payload are two different wires, and stripping only the + first would leave the value sitting in the second where anyone can read it.""" + if not hide or not isinstance(row, dict): + return row + return {k: v for k, v in row.items() if k not in hide} + + +# ── ROWS ───────────────────────────────────────────────────────────────────────────────────── +def apply_row_scope(rows, user, module, fields, ctx=None): + """The rows this account may receive: `filter_eval.permits` over the permanent filter. + + `permits`, never `matches` — an unanswerable permanent filter DENIES rather than being + ignored. See `harness/filter_eval`'s docstring for the field-rename walkthrough that makes + the difference a leak rather than a preference. + """ + if perms.is_admin(user): + return list(rows or ()) + e = entry(user, module) + tree = (e or {}).get('filter') + if not tree: + return list(rows or ()) + from harness import filter_eval as fe + return [r for r in (rows or ()) if fe.permits(tree, r, fields, ctx)] + + +# ── THE PUSHDOWN ───────────────────────────────────────────────────────────────────────────── +#: `dba` value sets that pin a BU, and the Odoo team they pin. `_dba_attrs` emits exactly +#: {'Fisch','Royal','Both'} (blank for "no brand attributable in 24 months"), so a permission +#: filter admitting Fisch admits {Fisch, Both} — a Both customer IS a Fisch customer. +_DBA_TEAM = ((frozenset({'fisch', 'both'}), 5), (frozenset({'royal', 'both'}), 6)) + +#: Only equality pushes down. `FILTER_OPS` is single-valued (there is no column-level "is any +#: of" — that vocabulary belongs to cohort leaves and is disjoint), so a multi-value BU +#: condition arrives as an OR GROUP of `eq` leaves, handled by `_group_dba_team` below. +_PUSHDOWN_OPS = frozenset({'eq'}) + + +def derive_pool_scope(user, module): + """`(team_id, agent)` the POOL must be BUILT with, derived from the permanent filter. + + ⛔ THIS EXISTS BECAUSE `team_id` SHAPES VALUES, NOT ROW MEMBERSHIP (C-PERM amendment 3). + `modules/customer_data._pool_build` passes `team_id` into `cust._cust_rev` three times (YTD, + LY, LTM) and into `cust._cadence_bulk`, so it decides what `rev`, `ly`, `ltm`, `aov`, + `est_missed` and the derived `status` MEAN. Enforce a BU purely as a post-filter and a + Fisch-only user keeps a correct-looking row LIST while every number on it silently becomes + Fisch+Royal — worst for `dba = Both` customers, who are exactly the ones a BU filter admits. + A pid-level reconciliation cannot see that; the values one can, and does. + + So the query-level pushdown SURVIVES — but as a DERIVATION OF the permanent filter rather + than a second wall beside it, which is what keeps R1's "BU access is just a filter" true at + the level the owner asked for it (one declaration, one UI, one engine). + + Pure, and recomputed per request rather than stored: a stored derivation drifts from the + filter it came from, and then two things disagree about what an account may see. + + Reads TOP-LEVEL AND-conjunction leaves ONLY. A leaf under `or` guarantees no narrowing — + `dba is Fisch OR revenue > 10` must not pin the pool to Fisch — so it never pushes down. + Anything not recognised here simply is not pushed down; `apply_row_scope` still applies the + whole tree, so the wall is unchanged either way. Belt AND braces, deliberately: the pushdown + is what makes the VALUES right, `permits()` is what makes the ROWS right. + """ + if perms.is_admin(user): + return None, None + e = entry(user, module) + tree = (e or {}).get('filter') + if not tree: + # Un-migrated records still answer through the legacy derivation, so the old wall keeps + # working until the migration has run. + if not is_migrated(user): + return perms.scope_team_id(user), perms.scope_agent(user) + return None, None + + from harness import filter_eval as fe + nodes, conj = fe.tree_parts(tree) + if conj == 'or': + return None, None + + team_id, agent = None, None + for n in nodes: + if not isinstance(n, dict): + continue + if isinstance(n.get('children'), list): + # A top-level OR GROUP under an AND root IS a guaranteed narrowing — every row must + # satisfy it — so it may push down, unlike a leaf under an OR ROOT (refused above). + # This is the shape a multi-value BU condition actually takes; see `_group_dba_team`. + tid = _group_dba_team(n) + if tid is not None: + team_id = tid if team_id in (None, tid) else None + continue + if n.get('op') not in _PUSHDOWN_OPS: + continue + col = n.get('colId') + raw = n.get('value') + if col == 'dba': + vals = {v.strip().lower() for v in str(raw or '').split(',') if v.strip()} + if not vals: + continue + for allowed, tid in _DBA_TEAM: + if vals <= allowed: + # Both BUs named = no narrowing to push; leave it to the post-filter. + team_id = tid if team_id in (None, tid) else None + break + elif col == 'agent': + v = str(raw or '').strip() + # A SET of agents cannot become the pool's single `agent_name`; the post-filter + # handles it. Only an unambiguous single value pushes down. + if v and ',' not in v: + agent = v + return team_id, agent + + +def _group_dba_team(group): + """The team a top-level `or` group pins, or None. + + Recognises ONLY the exact shape "every child is a `dba eq ` leaf" — the group the + condition builder emits for a multi-value BU condition, and the one `perm_migrate` writes. + Every OTHER group returns None and is left entirely to the post-filter: a group mixing `dba` + with another column, or containing a nested group, does not pin a BU on its own, and + guessing that it does would build the pool from the wrong book. Narrow by construction — + the pushdown may only ever be an OPTIMISATION of a constraint the filter already expresses. + """ + if group.get('conj') != 'or': + return None + children = group.get('children') or [] + if not children: + return None + vals = set() + for c in children: + if (not isinstance(c, dict) or isinstance(c.get('children'), list) + or c.get('colId') != 'dba' or c.get('op') != 'eq'): + return None + v = str(c.get('value') or '').strip().lower() + if not v: + return None + vals.add(v) + for allowed, tid in _DBA_TEAM: + if vals <= allowed: + return tid + return None diff --git a/royalimports_os/core/perms.py b/royalimports_os/core/perms.py index 47a19fffa6b94195804d84c28f6e3bf53234a339..dc8cde8caf34bffd5a5b3ad2ec4fdf818598944f 100644 --- a/royalimports_os/core/perms.py +++ b/royalimports_os/core/perms.py @@ -29,7 +29,19 @@ import core.users as users # customer_data + cohort — and may_open() gives a parent grant to its children. Mapping it away # would silently narrow every "customers" grant to one child. _LEGACY_KEYS = {'myday': 'customer_data', 'customer_list': 'customer_data', - 'map': 'customer_data', 'library': 'settings'} + 'map': 'customer_data', 'library': 'settings', + # wave 16 (item 5, R10): Cohort folded into the Customer rail as locked + # views — a cohort grant or ?page=cohort deep link lands on the grid that + # now hosts them. + 'cohort': 'customer_data', + # wave 16 (item 7, R11): the Agents PAGE is deleted; an 'agent'-granted + # login's surviving surface is the Customer grid over their OWN m2m book — + # the legacy query-scope (scope_agent reads the record's agent LINK, not + # this list) keeps that book exact, shared customers included. The R1 + # migration deliberately SKIPS agent-linked records: `agent is X` cannot + # express m2m membership (a shared customer displays its primary agent), + # so their wall stays legacy until a membership predicate exists. + 'agent': 'customer_data'} def is_admin(user): diff --git a/royalimports_os/core/registry.py b/royalimports_os/core/registry.py index 7ef3fb46d6f242dae6ea2293573879f4c22c350b..3895672cc517841726d5b42df2917ee5b7c8104e 100644 --- a/royalimports_os/core/registry.py +++ b/royalimports_os/core/registry.py @@ -34,8 +34,15 @@ Fields: # See [[connector-onboarding]]: the plug-in seam is datastore.py, and Odoo has no delegated # OAuth, so the "+ New" connect flow is the credential-form shape, not an OAuth redirect. REGISTRY = [ - {'key': 'sales', 'label': 'Sales', 'brand': True, 'hq': False, 'validate': True, 'source': 'Odoo', - 'note': 'Revenue, YoY, seasonality, reps, customers, SKUs — by BU.'}, + # ARCHIVED wave 16 (owner item 7, R3/R11, 2026-08-02): the PAGE went on the strength of + # C-CHARTCAP — every Sales block shape (YoY compare series, KPI delta tiles, group-by + # tables) is now assemblable BY HAND from the grid's chart/dashboard views, which is what + # R3 required before deletion. `modules/sales.py` (the data layer) STAYS — drawers and the + # briefing still read it, and pages_sales.py survives UNREGISTERED as the Y1 envelope's + # template + verify_api's fixture. + {'key': 'sales', 'label': 'Sales', 'brand': True, 'hq': False, 'validate': True, 'source': 'Odoo', 'archived': True, + 'note': 'Revenue, YoY, seasonality, reps, customers, SKUs — by BU. Retired wave 16: ' + 'rebuild as grid chart/dashboard views (compare series, KPI deltas, tables).'}, # ARCHIVED AS A PAGE (owner item 14, wave 8): "archive the current form of the Customer # dashboard completely, i want to redesign it, exactly with the backend we have". So the # PAGE goes and the DATA LAYER stays — modules/customers.py still powers the Customer table's @@ -67,12 +74,36 @@ REGISTRY = [ # data moves, a cohort only changes when a person edits it. validate:False because # there is no Odoo aggregate to reconcile a hand-picked list against; its metrics are # the customers module's, already validated there. - {'key': 'cohort', 'label': 'Cohort', 'brand': True, 'hq': False, 'validate': False, 'source': 'Odoo', 'parent': 'customers', - 'note': 'Hand-curated, unchanging customer lists. Same grid as Data (filter, sort, ' - 'group, custom columns) but the SET is fixed: it changes only when someone ' - 'adds or removes a member. Populated from a view via ... > Add to list.'}, - {'key': 'agent', 'label': 'Agents', 'brand': True, 'hq': False, 'validate': True, 'source': 'Odoo', - 'note': 'Per-agent book: sales (custom dates), returns, top SKUs, full customer list incl. inactive. Returns consolidated.'}, + # ARCHIVED wave 16 (owner item 5, R10 — the fold-in): every cohort now projects as a + # LOCKED VIEW in the Customer rail's "Cohorts" section (wave-15 C-LOCK), so the separate + # nav destination is gone. ALL cohort machinery stays: `scope=cohort` still works + # (routes_grid._SCOPES, storage keys, events), page_cohort remains in app.py, and + # _LEGACY_KEYS maps cohort→customer_data so grants + ?page= deep links land on the grid + # that now hosts the cohorts. + {'key': 'cohort', 'label': 'Cohort', 'brand': True, 'hq': False, 'validate': False, 'source': 'Odoo', 'parent': 'customers', 'archived': True, + 'note': 'Hand-curated, unchanging customer lists — folded into the Customer rail as ' + 'locked views (wave 16). The set is fixed: it changes only when someone adds ' + 'or removes a member. Open them from Customer > Views > Cohorts.'}, + # ARCHIVED wave 16 (owner item 7, R11, 2026-08-02) beside Sales. The agent DRAWER and the + # data layer (modules/agent.py, agent_* caches) STAY — agent entities still open from + # customer surfaces; an own-book agent login's home is the Customer grid narrowed by the + # R1 permanent filter ("Agent is X"), not this page. + {'key': 'agent', 'label': 'Agents', 'brand': True, 'hq': False, 'validate': True, 'source': 'Odoo', 'archived': True, + 'note': 'Per-agent book: sales (custom dates), returns, top SKUs, full customer list incl. inactive. ' + 'Retired wave 16: agent drawers + the R1 own-book filter carry the use case.'}, + # Wave 16 C-TOPIC (owner items 9+10, R4): the PRODUCT table family — the second object on + # the table-page factory. `products_family` is the folder head (the `customers` pattern: + # group_only, never a destination); `product_data` is the grid over the SKU dataset, with + # its OWN workspace bucket ('product_table_workspace') and the /products + scope=product + # seams. The archived Streamlit `products` (SKU) row below stays archived and untouched, + # exactly as R4 rules. + {'key': 'products_family', 'label': 'Products', 'brand': True, 'hq': False, 'validate': False, + 'group_only': True, + 'note': 'Folder for the product surfaces (Product table). The archived SKU dashboard is ' + 'not part of this family.'}, + {'key': 'product_data', 'label': 'Product', 'brand': True, 'hq': False, 'validate': True, 'source': 'Odoo', 'parent': 'products_family', + 'note': 'The SKU catalogue as a grid: per-product revenue, units and (consolidated) ' + 'stock columns, with saved views and custom fields. Identity = the SKU code.'}, {'key': 'products', 'label': 'SKU', 'brand': True, 'hq': False, 'validate': True, 'archived': True, 'note': 'SKU movers, zombies, velocity, coverage, drawers — by BU (sales-derived).'}, {'key': 'assortment', 'label': 'Assortment', 'brand': True, 'hq': False, 'validate': True, 'archived': True, diff --git a/royalimports_os/core/users.py b/royalimports_os/core/users.py index 6019f3033b85176cd3826a360cc2f1c3fd19a723..f92eb4c724ef4179abd89c8e676ce3a533c5a421 100644 --- a/royalimports_os/core/users.py +++ b/royalimports_os/core/users.py @@ -17,16 +17,29 @@ import core.store as store BU_LABELS = {5: 'Fisch', 6: 'Royal'} _ITER = 200_000 +#: Wave 15 C-PERM — the explicit-resolution marker. Mirrors `core.perm_scope.PERMS_VERSION`; +#: kept as a literal here so `users` does not import the permission layer it is read by. +PERMS_VERSION = 1 + def _hash(pw, salt): return hashlib.pbkdf2_hmac('sha256', str(pw).encode('utf-8'), bytes.fromhex(salt), _ITER).hex() -def _record(pw, name, role, bus, active=True, modules='all', agent=None, email=None): +def _record(pw, name, role, bus, active=True, modules='all', agent=None, email=None, + perms=None): salt = secrets.token_hex(16) - return {'salt': salt, 'hash': _hash(pw, salt), 'name': name, 'role': role, - 'bus': bus, 'active': active, 'modules': modules, - 'agent': agent or None, 'email': email or None} + rec = {'salt': salt, 'hash': _hash(pw, salt), 'name': name, 'role': role, + 'bus': bus, 'active': active, 'modules': modules, + 'agent': agent or None, 'email': email or None} + if perms is not None: + # Wave 15 C-PERM. A record written WITH perms is migrated by construction — the marker + # and the block are set together, here, so no writer can create one without the other. + # (`core.perm_scope` reads an unmarked record as legacy, so a block without its marker + # would be silently ignored; a marker without a block would deny everything.) + rec['perms'] = perms + rec['perms_v'] = PERMS_VERSION + return rec def registry(): @@ -69,6 +82,17 @@ def _public(username, u): # to every grid session via the workspace map); without it here the API session's # user record silently drops it and /me can never show your own photo. 'avatar': u.get('avatar') or None, + # ⛔ WAVE 15 C-PERM — THE WALL TRAVELS ON THIS PROJECTION OR IT DOES NOT TRAVEL. + # `deps._user_for` builds every API session from `_public()`, so a `perms` block + # dropped here is a restricted account served as an unrestricted one — silently, on + # every route, with nothing to notice. `perms_v` must ride ALONG WITH it and for the + # same reason inverted: the marker without the block denies everything, the block + # without the marker is ignored. Two keys, one fact, never separated. + # `verify_api` asserts a restricted user's SESSION OBJECT carries both, at the mount + # rather than by grep — a projection is exactly the kind of wiring that looks + # present in three files and is absent in the one that runs. + **({'perms': u['perms']} if isinstance(u.get('perms'), dict) else {}), + **({'perms_v': int(u['perms_v'] or 0)} if u.get('perms_v') else {}), 'epoch': int(u.get('epoch') or 0)} @@ -201,7 +225,7 @@ def set_active(username, active): def set_access(username, role=None, bus=None, modules=None, agent=None, email=None, - name=None): + name=None, perms=None): """Update access fields. agent/email: pass '' to clear, None to leave unchanged — the user↔agent link scopes the Customer List page / digests to that agent's book. @@ -226,6 +250,13 @@ def set_access(username, role=None, bus=None, modules=None, agent=None, email=No u['agent'] = agent or None if email is not None: u['email'] = email or None + if perms is not None: + # Wave 15 C-PERM. Writing perms MIGRATES the record: the marker goes on in the + # same read-modify-write, so a record can never end up with one and not the + # other (see `_record`). Whole-block replace, matching the PUT route's shape — + # a merge would make "remove this restriction" unexpressible. + u['perms'] = perms + u['perms_v'] = PERMS_VERSION return reg store.update('users', _set) diff --git a/royalimports_os/harness/analyst.py b/royalimports_os/harness/analyst.py index 8cb6c2a0453e34a298f504a72826ba1f10596a06..87b0e8e8bb4bf5f3f411af1705a891b686e35cf7 100644 --- a/royalimports_os/harness/analyst.py +++ b/royalimports_os/harness/analyst.py @@ -198,10 +198,63 @@ def _live_chat(messages, tools, model, tool_choice="auto"): raise RuntimeError(f"all LLM providers failed (last: {last_err})") +#: Wave 15 R2 — what a restricted account is told instead of an answer. +ANALYST_DENIED = ("The Analyst is not available on your account. It answers from the full " + "governed model, which is wider than what your account is permitted to see.") + + +def may_ask(user): + """⛔ R2 — THE AI WALL, AND IT IS DELIBERATELY BLUNT. + + Owner, verbatim: *"If the AI is triggered by a user, the AI ITSELF should not be able to see + the data."* Today the Analyst's tools run UNSCOPED — `harness/tools.run_semantic_query` takes + no subject and no filter, so every question it answers is answered over the whole tenant. + A restricted account asking "what were our top customers?" would therefore receive, in prose, + precisely the rows the grid's permanent filter exists to withhold. Prose is not a lesser leak + than a table; it is a harder one to notice. + + So the wall is REFUSAL, not narrowing: an account with ANY declared restriction — or any + non-admin on a migrated record — does not reach the model at all. An AI that never runs + cannot leak what it never read. Fail-closed on an unreadable record for the same reason. + + ⭢ NAMED DEBT, owner-mandated (R2, doc §Debt, log 2026-08-02). The RIGHT answer is to thread + the subject's permanent filter into every semantic query the Analyst runs — `filter_sql` + already compiles that tree to SQL, so the shape exists; what does not exist is a per-subject + query path through `harness/semantic.py`, which takes `team_id` and nothing else. Until that + lands this refusal is the whole enforcement, and it must NOT be relaxed into "narrow the + prompt" or "tell the model what it may not say" — a prompt is not a permission boundary. + """ + import core.perms as perms + import core.perm_scope as perm_scope + + if not isinstance(user, dict): + return False # no identity resolved -> no Analyst + if perms.is_admin(user): + return True + if perm_scope.is_migrated(user): + # Migrated and not an admin: the account is governed by a wall the Analyst cannot honour. + return False + # Legacy record: restricted the old way is still restricted. + return (perms.allowed_modules(user) is None + and perms.scope_team_id(user) is None + and not perms.scope_agent(user)) + + def ask(question, history=None, chat_fn=None, model=DEFAULT_MODEL, max_iters=MAX_ITERS, - telemetry_kind="analyst"): + telemetry_kind="analyst", user=None): """Run one Analyst turn. Returns {answer, artifacts, tool_trace, iterations, exhausted, - usage}. chat_fn(messages, tools, model) -> (assistant_message_dict, usage_dict).""" + usage}. chat_fn(messages, tools, model) -> (assistant_message_dict, usage_dict). + + `user` is the SUBJECT asking. Passing it engages the R2 wall (`may_ask`); omitting it keeps + the unscoped behaviour that `harness/evals.py` and `harness/routines.py` rely on — those run + as the SYSTEM, not on behalf of a person, and gating them on a user record they do not have + would break the eval ladder to no security benefit. Every call that IS on behalf of somebody + passes it, and `app.py`'s chat entry point does. + """ + if user is not None and not may_ask(user): + return {"answer": ANALYST_DENIED, "artifacts": [], "tool_trace": [], + "iterations": 0, "exhausted": False, "denied": True, + "usage": {"prompt_tokens": 0, "completion_tokens": 0}} chat = chat_fn or _live_chat tools = T.openai_tools() messages = [{"role": "system", "content": system_prompt()}] diff --git a/royalimports_os/harness/filter_eval.py b/royalimports_os/harness/filter_eval.py new file mode 100644 index 0000000000000000000000000000000000000000..b5782b90d6f476a89582674e3afccf2eb091e896 --- /dev/null +++ b/royalimports_os/harness/filter_eval.py @@ -0,0 +1,485 @@ +"""harness/filter_eval.py — the filter tree evaluated against ROWS, in Python (wave 15, C-EVAL). + +THE THIRD ENGINE, and the one with a different job. There are now three readers of the same +filter tree and it is worth being precise about why: + + * `customer-grid/useVisibleRows.ts` — the CLIENT, over in-memory rows. The reference. + * `harness/filter_sql.py` — compiles the tree to SQL for the DuckDB semantic tables. + * **this module** — evaluates the tree against wire-shaped row dicts in the + API/host process, where there is no SQL and the rows are + already in hand. + +It exists because a PERMANENT (permission) filter has to be applied server-side, to rows the +server is about to send, on a surface whose columns are not a DuckDB table. Neither existing +engine can do that: the client one is TypeScript, and the SQL one needs a table. + +⛔ TWO ENTRY POINTS, OPPOSITE DEFAULTS, AND THE DIFFERENCE IS THE WHOLE POINT. + + matches(...) DISPLAY semantics. A faithful mirror of the client, including the places + where the client IGNORES a leaf. Refereed against the client by + `aios-web/verify_filter_parity.py` — if this disagrees with the browser about + one row, a saved view means two different things in two places. + + permits(...) PERMISSION semantics. Same evaluator, `strict=True`: anything the display + engine would IGNORE, this DENIES. + +Why they cannot be the same function (C-EVAL amendment 1, and the reason this module has a +docstring this long). The client engine is TRI-STATE — `True` / `False` / `None`, where `None` +means "this leaf is INACTIVE, parent ignores it entirely". A leaf naming a column that does not +exist returns `None` (`useVisibleRows.ts:318`), and a group whose children are all inactive is +itself inactive (:273). For a DISPLAY filter that is exactly right: a half-built condition must +not zero the grid, and a stale column reference must not either. + +For a PERMISSION filter it is a catastrophe. `agent is Tara` is the only thing standing between +a sales rep and the whole book; rename or delete the `agent` field and that leaf becomes +`None` — ignored — and the rep silently receives every customer. The wall would be one field +rename away from open, and nothing would go red. So `permits()` inverts every ignore into a +denial: an unanswerable permission filter is an OUTAGE, not a licence. + +The asymmetry is a PARAMETER (`strict`) rather than a second implementation, deliberately: a +mirror must copy the original's asymmetries, and the only way to be sure it still does next +month is for both behaviours to come out of the same walk. + +⚠ WHAT THIS MODULE DOES NOT RE-IMPLEMENT. Activeness (`is_rule_active`), the JS-`Number` +coercion (`to_num`), the op vocabularies, cohort-id parsing and the date-window/anchor resolvers +all already exist in `filter_sql.py` and `windows.py`, and are already held against the client by +`verify_filter_engine.py` (525 checks) and `verify_windows.py` (123). Importing them is not +laziness — a second copy of "what counts as an active rule" is precisely the drift those gates +exist to catch, and it would be a copy the gates do not cover. +""" +from harness.filter_sql import ( # noqa: F401 (COHORT_OPS re-exported for callers) + COHORT_FIELD, COHORT_OPS, COHORT_OP_ALIASES, FILTER_OPS, RANK_OPS, + is_rule_active, parse_cohort_ids, to_num, _resolve_anchor, _window_bounds, +) + +#: The CLIENT's numeric family, which is WIDER than `filter_sql.NUMERIC_TYPES`. `rating` (an +#: integer 1..max) and `formula` (computed in the browser and injected at the field's key) compare +#: as numbers here because this engine sees the same assembled row the client does. They are +#: absent from the SQL port for a good reason — they are client-only strata that can never reach a +#: DuckDB table — so the two lists differing is correct, not drift. Mirrors `isNumericType`. +NUMERIC_TYPES = frozenset({'currency', 'int', 'pct', 'rating', 'formula'}) + +#: `created_time` is a DATETIME rendered read-only, and it filters as a DATE (truncated to the +#: day below). Mirrors `isDateType`. +DATE_TYPES = frozenset({'date', 'created_time'}) + +#: The date ops that actually compare against an ANCHOR. Everything else falls to the +#: active-and-always-true default WITHOUT resolving one — ordering matters, see `_match_date`. +DATE_CMP_OPS = frozenset({'eq', 'neq', 'lt', 'lte', 'gt', 'gte'}) + + +class EvalCtx: + """Everything the engine needs besides the row and the columns. + + All four members share one property — each is an answer a single ROW cannot compute — and + therefore share one failure mode: absent, the condition matches NOTHING rather than + everything. That is the widening sin the cohort/measure/rank leaves are each written to + avoid, and it is why none of these defaults to a permissive value. + """ + + __slots__ = ('cohort_sets', 'measure_sets', 'rank_sets', 'today') + + def __init__(self, cohort_sets=None, measure_sets=None, rank_sets=None, today=None): + #: {cohort_id: set(pid)} — the cohorts THIS reader may see. + self.cohort_sets = cohort_sets or {} + #: {rule_id: set(pid)} — resolved measure conditions (CG-8). + self.measure_sets = measure_sets or {} + #: {id(leaf) or leaf-key: set(pid)} — resolved rank slices (C-OPS). + self.rank_sets = rank_sets or {} + #: The TENANT's today, ISO. Never the server clock at call time — a date filter that + #: means something different per process is not a filter. + self.today = today + + +_EMPTY_CTX = EvalCtx() + + +def _is_group(node): + return isinstance(node, dict) and isinstance(node.get('children'), list) + + +def _is_cohort(node): + return isinstance(node, dict) and node.get('colId') == COHORT_FIELD + + +def _is_measure(node): + """Mirrors `isMeasureRule`: a leaf carrying a `window` IS a measure condition.""" + return isinstance(node, dict) and node.get('window') is not None + + +def _rhs_col(rhs): + """Mirrors `rhsColId`: a STATISTIC names no column.""" + if not isinstance(rhs, dict) or rhs.get('kind') == 'stat': + return None + return rhs.get('colId') + + +def _as_text(v): + """The client's `String(raw ?? "").toLowerCase()`. `None` becomes '' (never 'None').""" + return ('' if v is None else str(v)).lower() + + +def _as_day(v): + """Day-granularity truncation. A `created_time` cell is a DATETIME and every comparand in + this vocabulary is a DATE — lexically the longer string sorts AFTER its own day, so without + this `on or before ` would silently exclude today's rows. Identity for a pure date.""" + return ('' if v is None else str(v))[:10] + + +def _cmp_num(op, a, b): + """`default: True` is the documented ACTIVE-and-always-true case — an operator that exists + but does not apply to this type (`contains` on a number) narrows nothing and asks nothing. + An operator in NO vocabulary never reaches here; `_eval` refuses it first.""" + if op == 'gt': + return a > b + if op == 'gte': + return a >= b + if op == 'lt': + return a < b + if op == 'lte': + return a <= b + if op == 'eq': + return a == b + if op == 'neq': + return a != b + return True + + +def _cmp_str(op, a, v): + if op == 'eq': + return a == v + if op == 'neq': + return a != v + if op == 'lt': + return a < v + if op == 'lte': + return a <= v + if op == 'gt': + return a > v + if op == 'gte': + return a >= v + return True + + +def _cmp_text(op, a, v): + if op == 'contains': + return v in a + if op == 'doesNotContain': + return v not in a + if op == 'eq': + return a == v + if op == 'neq': + return a != v + return True + + +def _is_blank(raw): + """Blank = None or ''. A numeric 0 is NOT blank — `isEmpty` must not swallow a real zero, + and the wire preserves null for a missing value.""" + return raw is None or raw == '' + + +def _match_numeric(rule, raw, other, has_rhs): + a = to_num(raw) + op = rule.get('op') + if has_rhs: + return _cmp_num(op, a, to_num(other)) + if op == 'between': + v, v2 = rule.get('value'), rule.get('value2') + if v == '' or v2 is None or v2 == '': + return True # both bounds required + lo, hi = to_num(v), to_num(v2) + if lo > hi: + lo, hi = hi, lo + return lo <= a <= hi + if rule.get('value') == '': + return True # inactive until a value is typed + return _cmp_num(op, a, to_num(rule.get('value'))) + + +def _match_date(rule, raw, other, has_rhs, today): + a = _as_day(raw) + op = rule.get('op') + + # "is within [the past month]" — a RANGE test, and the only date op reading `dateWindow`. + if op == 'within': + if not today: + return False + bounds = _window_bounds(rule.get('dateWindow'), today) + if not bounds: + return False # unresolvable range -> matches nothing + if a == '': + # A blank date is not "within" any range. Without this, '' >= a null lower bound is + # vacuously true and every never-ordered customer lands inside every window. + return False + lo, hi = bounds + return (lo is None or a >= lo) and (hi is None or a <= hi) + + if has_rhs: + return _cmp_str(op, a, _as_day(other)) + if op == 'between': + v, v2 = rule.get('value'), rule.get('value2') + if v == '' or v2 is None or v2 == '': + return True + lo, hi = (v, v2) if v < v2 else (v2, v) + return lo <= a <= hi + + # An op that does not apply to a date (`contains`) is ACTIVE-and-always-true, decided BEFORE + # any anchor is resolved — there is no date in that question to resolve. Ordering this after + # the anchor would turn `contains` on a date from always-true into matches-nothing, which is + # a different answer under `or`. + if op not in DATE_CMP_OPS: + return True + if not rule.get('dateMode') and rule.get('value') == '': + return True # inactive until a value is typed + mode = rule.get('dateMode') or 'exact' + # `today` is required by a RELATIVE anchor and by nothing else, which is what keeps every + # pre-anchor saved view working in a payload that carries no today. + if mode != 'exact' and not today: + return False + v = _resolve_anchor(mode, rule.get('value'), today or '1970-01-01') + if v is None: + # Unresolvable (junk date, missing N) -> matches nothing. The honest answer to a + # question with no date in it. + return False + return _cmp_str(op, a, v) + + +def _match_filter(rule, row, columns, today): + """One LEAF against one row, dispatched on the field's declared type. + + `isEmpty`/`isNotEmpty` are handled FIRST and type-independently: they must never fall + through to the "blank value -> inactive" guards below, which would turn them into + always-true no-ops. + """ + field = columns.get(rule.get('colId')) or {} + ftype = field.get('type') + raw = row.get(rule.get('colId')) + op = rule.get('op') + + if op == 'isEmpty': + return _is_blank(raw) + if op == 'isNotEmpty': + return not _is_blank(raw) + + # A RANK op can never be answered from one row. `_eval` routes rank leaves to their resolved + # set and one should never arrive here; this is the SECOND layer, and it exists because of + # what the first layer's absence would do — `_cmp_num`'s `default: True` would make `topN` + # match EVERY row, a filter that widens under a count that agrees with it. + if op in RANK_OPS: + return False + + rhs = rule.get('rhs') + has_rhs = rhs is not None + other = row.get(_rhs_col(rhs) or '') if has_rhs else None + + if ftype in NUMERIC_TYPES: + return _match_numeric(rule, raw, other, has_rhs) + if ftype in DATE_TYPES: + return _match_date(rule, raw, other, has_rhs, today) + + a = _as_text(raw) + if has_rhs: + return _cmp_text(op, a, _as_text(other)) + if rule.get('value') == '': + return True + return _cmp_text(op, a, _as_text(rule.get('value'))) + + +def _eval(node, row, columns, ctx, strict): + """One node against one row. `True` / `False` / `None`, where `None` = INACTIVE. + + `strict` is the permission mode: every `None` this function would return becomes `False` + instead. Read the two behaviours side by side rather than trusting either alone — the + difference between them IS the security property (see the module docstring). + """ + ignore = False if strict else None + + if _is_group(node): + saw_active = False + all_true = True + any_true = False + for child in node['children']: + v = _eval(child, row, columns, ctx, strict) + if v is None: + continue # inactive -> ignored entirely + saw_active = True + all_true = all_true and v + any_true = any_true or v + if not saw_active: + # A group with no active children is itself inactive. In strict mode an empty or + # wholly-unanswerable permission group DENIES: a wall that evaluates to "nothing to + # say" must not mean "let them through". + return ignore + return any_true if node.get('conj') == 'or' else all_true + + if not isinstance(node, dict): + return ignore + + # A COHORT leaf, BEFORE the column lookup: `__cohort__` is not a column, so the lookup below + # would call it INACTIVE — and inactive means every row on screen under a count nobody doubts. + if _is_cohort(node): + if not is_rule_active(node, columns): + return ignore + ids = parse_cohort_ids(node.get('value')) + sets = [ctx.cohort_sets.get(cid) for cid in ids] + # ANY named cohort we were given no membership for makes the WHOLE condition + # unanswerable, and unanswerable matches nothing — for `is none of` as well. Answering + # "everything" to `is none of [a cohort we cannot see]` is the widening sin wearing a + # plausible face, and PARTIAL evaluation is worse: `is none of [A, B]` quietly becoming + # `is none of [A]` would show every row in B under a count nobody would doubt. + if any(s is None for s in sets): + return False + pid = row.get('pid') + op = node.get('op') + op = op if op in COHORT_OPS else COHORT_OP_ALIASES.get(op, 'anyOf') + if op == 'allOf': + return all(pid in s for s in sets) + in_any = any(pid in s for s in sets) + return (not in_any) if op == 'noneOf' else in_any + + # A MEASURE leaf, also before the column lookup and for the same reason: a measure's colId + # ("revenue") is not a column of this table. An ACTIVE rule whose set has not been resolved + # is PENDING and matches NOTHING — never everything. + if _is_measure(node): + if not is_rule_active(node, columns): + return ignore + s = ctx.measure_sets.get(node.get('id')) if node.get('id') else None + if s is None: + return False + return row.get('pid') in s + + # ── a column leaf ──────────────────────────────────────────────────────────────────────── + if node.get('colId') not in columns: + # THE LEAF THIS WHOLE MODULE'S `strict` FLAG EXISTS FOR. Display: ignore it. Permission: + # deny — see the module docstring's field-rename walkthrough. + return ignore + if node.get('rhs') is not None and _rhs_col(node['rhs']) not in columns: + # An rhs naming a column this table does not have is ignored by the SAME rule as an + # unknown LEFT column. Treating one side as "ignore" and the other as "match nothing" + # would make `a > deleted` behave differently from `deleted > a`. + return ignore + if not is_rule_active(node, columns): + return ignore + + # A RANK leaf is a MEMBERSHIP test, like a cohort or a measure: the set was computed in a + # prior pass over the other rows. No set = REFUSE, never "ignore" and never "true" — both of + # those SHOW rows. + if node.get('op') in RANK_OPS: + s = ctx.rank_sets.get(_rank_key(node)) + return (row.get('pid') in s) if s is not None else False + + # An operator in NO vocabulary at all. The comparators end in `default: True`, right for an + # operator that exists but does not apply to this type; NOT right for one that exists + # nowhere (`inTertile` out of a stale saved view), which would match every row. + if node.get('op') not in FILTER_OPS: + return False + + return _match_filter(node, row, columns, ctx.today) + + +def _rank_key(node): + """The client keys `rankSets` by leaf IDENTITY (a Map keyed on the node object). Python + dicts cannot key on a dict, so the caller that resolves rank sets and this evaluator agree + on a derived key. Kept in ONE place so the two cannot drift apart.""" + return (node.get('id') or '', node.get('colId') or '', node.get('op') or '', + str(node.get('value') if node.get('value') is not None else '')) + + +def _columns_map(fields): + """`[{key,type,…}]` -> `{key: field}`. Accepts a mapping unchanged, so callers holding + either shape need no adapter.""" + if isinstance(fields, dict): + return fields + out = {} + for f in fields or (): + if isinstance(f, dict) and f.get('key'): + out[f['key']] = f + return out + + +def evaluate(tree, row, fields, ctx=None): + """The TRI-STATE the client actually has: `True` / `False` / `None`, where `None` means the + tree is INACTIVE — it asks nothing, so it narrows nothing. + + Exposed because collapsing `None` into `True` (which `matches` does, correctly, for its own + purpose) destroys a distinction some callers must keep. The `memberPids` union is the one + that bit: the client's rule is `members.has(pid) || matchFilterTree(…)` and that union sits + INSIDE `if (filters.length)`, so an INACTIVE tree must show every row and ignore the member + list — whereas an ACTIVE tree that merely fails must still admit hand-picked members. A + caller holding only `matches` cannot tell those two apart and will narrow an inactive view + down to its hand-picked rows. (`filter_sql.compile_filter_tree` keeps the same distinction + by returning None rather than a predicate; this is the row-engine's equivalent.) + + Activeness is ROW-INDEPENDENT — every `None` here comes from `is_rule_active` or an empty + group, none of which reads the row — so a caller may compute it once per tree if it wishes. + """ + columns = _columns_map(fields) + nodes, conj = tree_parts(tree) + return _eval({'conj': conj, 'children': nodes}, row, columns, ctx or _EMPTY_CTX, False) + + +def matches(tree, row, fields, ctx=None): + """DISPLAY semantics — does `row` survive this filter tree? Mirrors the client exactly. + + A wholly INACTIVE tree returns True: no narrowing, every row shows. That is what the browser + does with a half-built condition, and this function's whole job is to agree with the browser. + Use `evaluate()` instead when you need to tell "inactive" from "matched" (see its docstring). + """ + v = evaluate(tree, row, fields, ctx) + return True if v is None else bool(v) + + +def visible_pids(tree, rows, fields, ctx=None, member_pids=None): + """The client's whole row pipeline for one tree, member union included — the shape a caller + should reach for instead of assembling `matches` in a loop. + + Mirrors `useVisibleRows`: an INACTIVE tree yields every row (and IGNORES `member_pids`, + because the union lives inside `if (filters.length)`); an ACTIVE tree yields the rows it + matches UNION the hand-picked members. + """ + ctx = ctx or _EMPTY_CTX + members = set(member_pids or ()) + out, active = [], False + verdicts = [] + for r in rows: + v = evaluate(tree, r, fields, ctx) + if v is not None: + active = True + verdicts.append((r, v)) + for r, v in verdicts: + if not active: + out.append(r.get('pid')) + elif v or (members and r.get('pid') in members): + out.append(r.get('pid')) + return out + + +def permits(tree, row, fields, ctx=None): + """PERMISSION semantics — may this reader SEE `row` under this permanent filter? + + Same evaluator, every ignore inverted into a denial. An empty/absent tree means "no + restriction declared" and admits (the caller decides whether a module with no entry is + reachable at all — that is `perm_scope`'s question, not this one); anything PRESENT but + unanswerable DENIES. + """ + nodes, conj = tree_parts(tree) + if not nodes: + return True # nothing declared -> nothing to enforce here + columns = _columns_map(fields) + v = _eval({'conj': conj, 'children': nodes}, row, columns, ctx or _EMPTY_CTX, True) + return bool(v) + + +def tree_parts(tree): + """Read C-PERM amendment 2's `FilterTree` — `{conj?, nodes}` — into `(nodes, conj)`. + + Accepts a BARE LIST too, because that is what `ViewConfig.filters` is and what + `clean_filter_tree` returns; an absent conj is `'and'`, mirroring `ViewConfig.filterConj`. + One reader, so the absent-conj default lives here instead of at every call site. + """ + if isinstance(tree, dict): + nodes = tree.get('nodes') + conj = 'or' if tree.get('conj') == 'or' else 'and' + return (nodes if isinstance(nodes, list) else []), conj + return (tree if isinstance(tree, list) else []), 'and' diff --git a/royalimports_os/modules/customer_data.py b/royalimports_os/modules/customer_data.py index ff22f2fd32b03347c9278d94f97bc1a38dd90e0b..8797e8e302b9646be1312b73e7b2d8d2379619b2 100644 --- a/royalimports_os/modules/customer_data.py +++ b/royalimports_os/modules/customer_data.py @@ -544,6 +544,10 @@ def delete_list(username, name): # A NEW table object gets its own `core.table_store.make('_table_workspace')`. _TSTORE = table_store.make(TABLE_KEY) +#: Wave 16 C-TOPIC — the ops OBJECT, for callers that select a table by TOPIC (grid_events' +#: `EventCtx.table`). The module-level re-exports below stay for every existing caller. +TABLE_OPS = _TSTORE + table_workspace = _TSTORE.workspace shared_table_views = _TSTORE.shared_views # wave-9 I17: views shared WITH this viewer shared_table_view = _TSTORE.shared_view # ...and one raw, for authorisation only diff --git a/royalimports_os/modules/digest.py b/royalimports_os/modules/digest.py index ec3141d0432ccb4c1ed2737f691819b05a18aaf1..80550bf0ae305963a63b412724dbdd18f92b88da 100644 --- a/royalimports_os/modules/digest.py +++ b/royalimports_os/modules/digest.py @@ -117,8 +117,11 @@ def build(user, t=None): rows.append(_line(r.get('customer', '?'), href, meta)) if y_orders: rows.append(_sec('Yesterday')) + # Wave 16: the Sales page is retired (registry row archived) — yesterday's orders now + # link to the Customer grid, the surface that carries the book. A link to an archived + # page would fall through to the landing and read as a broken link. rows.append(_line(f"{y_orders} orders · {_m(y_rev)}", - links.deeplink('sales', src='digest'))) + links.deeplink('customer_data', src='digest'))) scope = f"{agent}'s book" if agent else 'the whole book' list_url = links.deeplink('customer_data', src='digest') diff --git a/royalimports_os/modules/product_data.py b/royalimports_os/modules/product_data.py new file mode 100644 index 0000000000000000000000000000000000000000..e087c968a60ed3f5819d29f099064c2da78a47b1 --- /dev/null +++ b/royalimports_os/modules/product_data.py @@ -0,0 +1,146 @@ +"""modules/product_data.py — the PRODUCT table's pool (wave 15 item 9/10, contract C-TOPIC). + +The second object on the table-page factory: same grid, same engine, same permission wall — the +only difference is the field schema and the identity. `modules/customer_data.pool()` is the +template and this deliberately mirrors its signature and its row shape. + +⛔ THREE DECISIONS THIS FILE HAD TO MAKE, EACH RECORDED BECAUSE A LATER READER WILL WONDER. + +1. **THE IDENTITY IS A SKU CODE, WHICH IS A STRING, AND THE GRID WANTS AN INTEGER `pid`.** + Cohort membership, `allowed_pids`, the measure channel and `rows_from_pool` all key on an + integer. So each row carries BOTH: `pid` (a stable CRC32 of the code, so the same SKU gets the + same id on every pull and across processes — never an enumeration index, which would reshuffle + whenever the catalogue changes) and `code`, the real business key, as a visible column. + `_assert_no_pid_collision` fails the BUILD rather than the read: two SKUs sharing a pid would + silently merge in every downstream set operation, and a loud build failure is the only version + of that anyone would notice. + +2. **THE SCOPE RULE — inventory columns are CONSOLIDATED and are therefore OMITTED for a + BU-scoped caller.** `products.directory(t, team_id)` is brand-shaped; `inventory.sku_inventory` + is explicitly NOT (its own docstring: "on-hand stock is one physical warehouse, not + brand-tagged"). Joining them for a Fisch-only user would put BU-shaped revenue beside + company-wide stock IN THE SAME ROW — the mixed-scope value defect wave 15's amendment 3 exists + for, arriving through a different door. The honest options were "omit" or "label the columns + company-wide"; omit is the fail-closed one, and a column that is absent asks a question, + whereas a column that is silently company-wide answers one wrongly. + +3. **WHAT IS NOT HERE, NAMED RATHER THAN QUIETLY MISSING.** R4 lists ~20 fields. Vendor and + COUNTRY are not in Odoo at all — they live in the inventory WORKBOOK + ([[odoo-vendor-country-origin]]) and need a loader this module deliberately does not invent. + Margin % comes from `modules/pricing.table`, which is a heavier build (channel-rate cost + allocation) and is left for the wave that needs it. `validate()` reconciles what SHIPS; it + does not pretend to cover columns that are absent. +""" +import zlib + +import core.periods as P +import core.table_store as table_store +import modules.products as products + +#: Columns that exist ONLY on a consolidated pull. See decision 2. +CONSOLIDATED_ONLY = ("on_hand", "unit_cost", "inv_value", "qty_ltm", "dos", "stock_bucket") + +#: Wave 16 C-TOPIC — the PRODUCT table's OWN workspace bucket. ⛔ Never the customer one: +#: product pids are CRC32 hashes of SKU codes and customer pids are Odoo partner ids, so in a +#: SHARED overlay bucket a hash collision would silently write a product note onto somebody's +#: customer (or the reverse). Separate store keys make that structurally impossible, which is +#: the whole reason the table-page factory exists ("a new table object gets its own +#: table_store.make('_table_workspace')"). +TABLE_KEY = 'product_table_workspace' +TABLE_OPS = table_store.make(TABLE_KEY) + + +def sku_pid(code): + """A stable integer id for a SKU code. CRC32, masked to 31 bits so it is always positive and + always JSON-safe. Stable across processes and pulls, which an enumeration index is not.""" + return zlib.crc32(str(code).encode("utf-8")) & 0x7FFFFFFF + + +def _assert_no_pid_collision(rows): + """Two SKUs sharing a pid would MERGE in every set operation downstream — cohort membership, + allowed_pids, the measure channel — and nothing would report it. Fail the build instead.""" + seen = {} + for r in rows: + prior = seen.get(r["pid"]) + if prior is not None and prior != r["code"]: + raise ValueError( + f"product_data: pid collision — {prior!r} and {r['code']!r} both hash to " + f"{r['pid']}. Downstream set operations would merge them silently; widen the id " + f"before shipping this catalogue.") + seen[r["pid"]] = r["code"] + + +def _inventory_by_code(t): + """`{code: {...}}` from the inventory module, or `{}` if it cannot be read. + + Degrades to empty rather than raising, matching `customer_data._pool_build`'s treatment of + its own slow families: a product table that will not render because inventory is momentarily + unreachable is a worse failure than one with blank stock columns. + """ + try: + import modules.inventory as inventory + return inventory.sku_inventory(t=t) or {} + except Exception: + return {} + + +def pool(team_id=None, t=None): + """One row per SKU across the scoped book — the PRODUCT analogue of `customer_data.pool`. + + `team_id` shapes the revenue columns exactly as it does for customers (`products.directory` + passes it into `_sku_rev`), which is why `core.perm_scope.derive_pool_scope` must keep + driving it rather than a post-filter deciding the BU. + """ + t = t or P.today() + consolidated = team_id is None + inv = _inventory_by_code(t) if consolidated else {} + + rows = [] + for r in products.directory(t=t, team_id=team_id): + code = r["code"] + row = { + "pid": sku_pid(code), + "code": code, + "product": r.get("product") or code, + "category": r.get("category") or "(uncategorized)", + "rev_ytd": r.get("rev_ytd", 0.0), + "rev_ly": r.get("rev_ly", 0.0), + "yoy_pct": r.get("yoy_pct"), + "qty_ytd": r.get("qty_ytd", 0.0), + "orders_ytd": r.get("orders_ytd", 0), + } + if consolidated: + e = inv.get(code) or {} + row.update({ + "on_hand": e.get("on_hand"), + "unit_cost": e.get("unit_cost"), + "inv_value": e.get("inv_value"), + "qty_ltm": e.get("qty_ltm"), + "dos": e.get("dos"), + "stock_bucket": e.get("bucket"), + }) + rows.append(row) + + rows.sort(key=lambda r: -(r["rev_ytd"] or 0.0)) + _assert_no_pid_collision(rows) + return rows + + +def validate(team_id=None, t=None): + """Reconcile what SHIPS to an independent aggregate — the platform's own rule that a number + which does not tie to Odoo does not ship. + + The check is deliberately narrow and says so: Σ per-SKU YTD revenue must equal the SKU + module's own YTD total over the same scope. It does NOT cover the inventory columns (they are + a different module's reconciliation, and they are absent on a scoped pull anyway). + """ + t = t or P.today() + rows = pool(team_id=team_id, t=t) + ours = round(sum(r["rev_ytd"] or 0.0 for r in rows), 2) + yf, yt = P.ytd(t) + theirs = round(sum(v.get("rev", 0.0) + for v in (products._sku_rev(yf, yt, team_id) or {}).values()), 2) + return [{ + "check": "Σ per-SKU YTD revenue == modules.products._sku_rev over the same window", + "ours": ours, "theirs": theirs, "ok": abs(ours - theirs) < 0.01, + }] diff --git a/web/dist-embed/index.html b/web/dist-embed/index.html index 390ec9c4ddb05c3aa31be4dcb6cb9031d0b88aa8..1dd63ec35f92283b4871560fd6cad3b7e3ffea23 100644 --- a/web/dist-embed/index.html +++ b/web/dist-embed/index.html @@ -9,9 +9,9 @@ `),a=r.stack.split(` `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=` `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ae(e):``}function ce(e){switch(e.tag){case 5:return ae(e.type);case 16:return ae(`Lazy`);case 13:return ae(`Suspense`);case 19:return ae(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function le(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case ee:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function ue(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return le(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function de(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function pe(e){var t=fe(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function me(e){e._valueTracker||=pe(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=fe(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function ge(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function _e(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ve(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=de(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ye(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function be(e,t){ye(e,t);var n=de(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Se(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Se(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Se(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ce=Array.isArray;function we(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ne(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Pe).forEach(function(e){Fe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pe[t]=Pe[e]})});function Ie(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Pe.hasOwnProperty(e)&&Pe[e]?(``+t).trim():t+`px`}function Le(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ie(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Re=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ze(e,t){if(t){if(Re[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Be(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ve=null;function He(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ue=null,We=null,Ge=null;function Ke(e){if(e=Ui(e)){if(typeof Ue!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Gi(t),Ue(e.stateNode,e.type,t))}}function qe(e){We?Ge?Ge.push(e):Ge=[e]:We=e}function Je(){if(We){var e=We,t=Ge;if(Ge=We=null,Ke(e),t)for(e=0;e>>=0,e===0?32:31-(At(e)/jt|0)|0}var Nt=64,Pt=4194304;function Ft(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function It(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ft(a))):r=Ft(s)}else o=n&~i,o===0?a!==0&&(r=Ft(a)):r=Ft(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Ht(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-kt(t),e[t]=n}function Ut(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=nr),ar=` `,or=!1;function sr(e,t){switch(e){case`keyup`:return er.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var lr=!1;function ur(e,t){switch(e){case`compositionend`:return cr(t);case`keypress`:return t.which===32?(or=!0,ar):null;case`textInput`:return e=t.data,e===ar&&or?null:e;default:return null}}function dr(e,t){if(lr)return e===`compositionend`||!tr&&sr(e,t)?(e=Tn(),wn=Cn=Sn=null,lr=!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=Nr(n)}}function Fr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ir(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Lr(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`)}function Rr(e){var t=Ir(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Fr(n.ownerDocument.documentElement,n)){if(r!==null&&Lr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Pr(n,a);var o=Pr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,Br=null,Vr=null,Hr=null,Ur=!1;function Wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||Br==null||Br!==ge(r)||(r=Br,`selectionStart`in r&&Lr(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}),Hr&&Mr(Hr,r)||(Hr=r,r=gi(Vr,`onSelect`),0qi||(e.current=Ki[qi],Ki[qi]=null,qi--)}function Xi(e,t){qi++,Ki[qi]=e.current,e.current=t}var Zi={},Qi=Ji(Zi),$i=Ji(!1),ea=Zi;function ta(e,t){var n=e.type.contextTypes;if(!n)return Zi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function na(e){return e=e.childContextTypes,e!=null}function ra(){Yi($i),Yi(Qi)}function ia(e,t,n){if(Qi.current!==Zi)throw Error(r(168));Xi(Qi,t),Xi($i,n)}function aa(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ue(e)||`Unknown`,a));return F({},n,i)}function oa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zi,ea=Qi.current,Xi(Qi,e),Xi($i,$i.current),!0}function sa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=aa(e,t,ea),i.__reactInternalMemoizedMergedChildContext=e,Yi($i),Yi(Qi),Xi(Qi,e)):Yi($i),Xi($i,n)}var ca=null,la=!1,ua=!1;function da(e){ca===null?ca=[e]:ca.push(e)}function fa(e){la=!0,da(e)}function pa(){if(!ua&&ca!==null){ua=!0;var e=0,t=Gt;try{var n=ca;for(Gt=1;e>=o,i-=o,xa=1<<32-kt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ka&&Ca(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ka&&Ca(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ka&&Ca(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ka&&Ca(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===te&&Ua(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Va(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=su(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ou(i.type,i.key,i.props,null,e.mode,o),o.ref=Va(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=uu(i,e.mode,o),r.return=e,e=r}return s(e);case te:return l=i._init,_(e,r,l(i._payload),o)}if(Ce(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Ha(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=lu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ga=Wa(!0),Ka=Wa(!1),qa=Ji(null),Ja=null,Ya=null,Xa=null;function Za(){Xa=Ya=Ja=null}function Qa(e){var t=qa.current;Yi(qa),e._currentValue=t}function $a(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function eo(e,t){Ja=e,Xa=Ya=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Us=!0),e.firstContext=null)}function to(e){var t=e._currentValue;if(Xa!==e)if(e={context:e,memoizedValue:t,next:null},Ya===null){if(Ja===null)throw Error(r(308));Ya=e,Ja.dependencies={lanes:0,firstContext:e}}else Ya=Ya.next=e;return t}var no=null;function ro(e){no===null?no=[e]:no.push(e)}function io(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ro(t)):(n.next=i.next,i.next=n),t.interleaved=n,ao(e,r)}function ao(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var oo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function uo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ao(e,n)}return i=r.interleaved,i===null?(t.next=t,ro(r)):(t.next=i.next,i.next=t),r.interleaved=t,ao(e,n)}function fo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wt(e,n)}}function po(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function mo(e,t,n,r){var i=e.updateQueue;oo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:oo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);il|=o,e.lanes=o,e.memoizedState=d}}function ho(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ao.transition;Ao.transition={};try{e(!1),t()}finally{Gt=n,Ao.transition=r}}function gs(){return Uo().memoizedState}function _s(e,t,n){var r=Cl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e))bs(t,n);else if(n=io(e,t,n,r),n!==null){var i=Sl();wl(n,e,r,i),xs(n,t,r)}}function vs(e,t,n){var r=Cl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))bs(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,jr(s,o)){var c=t.interleaved;c===null?(i.next=i,ro(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=io(e,t,i,r),n!==null&&(i=Sl(),wl(n,e,r,i),xs(n,t,r))}}function ys(e){var t=e.alternate;return e===Mo||t!==null&&t===Mo}function bs(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wt(e,n)}}var Ss={readContext:to,useCallback:Ro,useContext:Ro,useEffect:Ro,useImperativeHandle:Ro,useInsertionEffect:Ro,useLayoutEffect:Ro,useMemo:Ro,useReducer:Ro,useRef:Ro,useState:Ro,useDebugValue:Ro,useDeferredValue:Ro,useTransition:Ro,useMutableSource:Ro,useSyncExternalStore:Ro,useId:Ro,unstable_isNewReconciler:!1},Cs={readContext:to,useCallback:function(e,t){return Ho().memoizedState=[e,t===void 0?null:t],e},useContext:to,useEffect:as,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),rs(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){return rs(4,2,e,t)},useMemo:function(e,t){var n=Ho();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ho();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_s.bind(null,Mo,e),[r.memoizedState,e]},useRef:function(e){var t=Ho();return e={current:e},t.memoizedState=e},useState:es,useDebugValue:ds,useDeferredValue:function(e){return Ho().memoizedState=e},useTransition:function(){var e=es(!1),t=e[0];return e=hs.bind(null,e[1]),Ho().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Mo,a=Ho();if(ka){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Zc===null)throw Error(r(349));jo&30||Yo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Zo.bind(null,i,o,e),[e]),i.flags|=2048,ts(9,Xo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Ho(),t=Zc.identifierPrefix;if(ka){var n=Sa,r=xa;n=(r&~(1<<32-kt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Lo++,0qi||(e.current=Ki[qi],Ki[qi]=null,qi--)}function Xi(e,t){qi++,Ki[qi]=e.current,e.current=t}var Zi={},Qi=Ji(Zi),$i=Ji(!1),ea=Zi;function ta(e,t){var n=e.type.contextTypes;if(!n)return Zi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function na(e){return e=e.childContextTypes,e!=null}function ra(){Yi($i),Yi(Qi)}function ia(e,t,n){if(Qi.current!==Zi)throw Error(r(168));Xi(Qi,t),Xi($i,n)}function aa(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ue(e)||`Unknown`,a));return F({},n,i)}function oa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zi,ea=Qi.current,Xi(Qi,e),Xi($i,$i.current),!0}function sa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=aa(e,t,ea),i.__reactInternalMemoizedMergedChildContext=e,Yi($i),Yi(Qi),Xi(Qi,e)):Yi($i),Xi($i,n)}var ca=null,la=!1,ua=!1;function da(e){ca===null?ca=[e]:ca.push(e)}function eee(e){la=!0,da(e)}function fa(){if(!ua&&ca!==null){ua=!0;var e=0,t=Gt;try{var n=ca;for(Gt=1;e>=o,i-=o,ba=1<<32-kt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Oa&&Sa(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Oa&&Sa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Oa&&Sa(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Oa&&Sa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===te&&Ha(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ba(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=cu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=su(i.type,i.key,i.props,null,e.mode,o),o.ref=Ba(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=du(i,e.mode,o),r.return=e,e=r}return s(e);case te:return l=i._init,_(e,r,l(i._payload),o)}if(Ce(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Va(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=uu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Wa=Ua(!0),Ga=Ua(!1),Ka=Ji(null),qa=null,Ja=null,Ya=null;function Xa(){Ya=Ja=qa=null}function Za(e){var t=Ka.current;Yi(Ka),e._currentValue=t}function Qa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function $a(e,t){qa=e,Ya=Ja=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function eo(e){var t=e._currentValue;if(Ya!==e)if(e={context:e,memoizedValue:t,next:null},Ja===null){if(qa===null)throw Error(r(308));Ja=e,qa.dependencies={lanes:0,firstContext:e}}else Ja=Ja.next=e;return t}var to=null;function no(e){to===null?to=[e]:to.push(e)}function ro(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,no(t)):(n.next=i.next,i.next=n),t.interleaved=n,io(e,r)}function io(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ao=!1;function oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function so(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function co(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function lo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Zc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,io(e,n)}return i=r.interleaved,i===null?(t.next=t,no(r)):(t.next=i.next,i.next=t),r.interleaved=t,io(e,n)}function uo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wt(e,n)}}function fo(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function po(e,t,n,r){var i=e.updateQueue;ao=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:ao=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);al|=o,e.lanes=o,e.memoizedState=d}}function mo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ko.transition;ko.transition={};try{e(!1),t()}finally{Gt=n,ko.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=wl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=ro(e,t,n,r),n!==null){var i=Cl();Tl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=wl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(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,jr(s,o)){var c=t.interleaved;c===null?(i.next=i,no(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=ro(e,t,i,r),n!==null&&(i=Cl(),Tl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===jo||t!==null&&t===jo}function ys(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wt(e,n)}}var xs={readContext:eo,useCallback:Lo,useContext:Lo,useEffect:Lo,useImperativeHandle:Lo,useInsertionEffect:Lo,useLayoutEffect:Lo,useMemo:Lo,useReducer:Lo,useRef:Lo,useState:Lo,useDebugValue:Lo,useDeferredValue:Lo,useTransition:Lo,useMutableSource:Lo,useSyncExternalStore:Lo,useId:Lo,unstable_isNewReconciler:!1},Ss={readContext:eo,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:eo,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=gs.bind(null,jo,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=jo,a=Vo();if(Oa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Qc===null)throw Error(r(349));Ao&30||Jo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,i,o,e),[e]),i.flags|=2048,es(9,Yo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=Qc.identifierPrefix;if(Oa){var n=xa,r=ba;n=(r&~(1<<32-kt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Io++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ii]=t,e[Li]=i,pc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Be(n,i),n){case`dialog`:li(`cancel`,e),li(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:li(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;oul&&(t.flags|=128,i=!0,hc(s,!1),t.lanes=4194304)}else{if(!i)if(e=Eo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ka)return gc(t),null}else 2*yt()-s.renderingStartTime>ul&&n!==1073741824&&(t.flags|=128,i=!0,hc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(gc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=yt(),t.sibling=null,n=To.current,Xi(To,i?n&1|2:n&1),t);case 22:case 23:return Pl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?el&1073741824&&(gc(t),t.subtreeFlags&6&&(t.flags|=8192)):gc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function ree(e,t){switch(Ea(t),t.tag){case 1:return na(t.type)&&ra(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return So(),Yi($i),Yi(Qi),Oo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wo(t),null;case 13:if(Yi(To),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ra()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yi(To),null;case 4:return So(),null;case 10:return Qa(t.type._context),null;case 22:case 23:return Pl(),null;case 24:return null;default:return null}}var _c=!1,vc=!1,yc=typeof WeakSet==`function`?WeakSet:Set,bc=null;function xc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Jl(e,t,n)}else n.current=null}function Sc(e,t,n){try{n()}catch(n){Jl(e,t,n)}}var Cc=!1;function wc(e,t){if(wi=hn,e=Ir(),Lr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.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||i!==0&&f.nodeType!==3||(l=s+i),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===i&&(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(Ti={focusedElem:e,selectionRange:n},hn=!1,bc=t;bc!==null;)if(t=bc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,bc=e;else for(;bc!==null;){t=bc;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Es(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Jl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,bc=e;break}bc=t.return}return h=Cc,Cc=!1,h}function Tc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Sc(t,n,a)}i=i.next}while(i!==r)}}function Ec(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Dc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Oc(e){var t=e.alternate;t!==null&&(e.alternate=null,Oc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ii],delete t[Li],delete t[zi],delete t[Bi],delete t[Vi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kc(e){return e.tag===5||e.tag===3||e.tag===4}function Ac(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||kc(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.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 jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ci));else if(r!==4&&(e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function Mc(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&&(e=e.child,e!==null))for(Mc(e,t,n),e=e.sibling;e!==null;)Mc(e,t,n),e=e.sibling}var Nc=null,Pc=!1;function Fc(e,t,n){for(n=n.child;n!==null;)Ic(e,t,n),n=n.sibling}function Ic(e,t,n){if(Dt&&typeof Dt.onCommitFiberUnmount==`function`)try{Dt.onCommitFiberUnmount(Et,n)}catch{}switch(n.tag){case 5:vc||xc(n,t);case 6:var r=Nc,i=Pc;Nc=null,Fc(e,t,n),Nc=r,Pc=i,Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Nc.removeChild(n.stateNode));break;case 18:Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?Mi(e.parentNode,n):e.nodeType===1&&Mi(e,n),z(e)):Mi(Nc,n.stateNode));break;case 4:r=Nc,i=Pc,Nc=n.stateNode.containerInfo,Pc=!0,Fc(e,t,n),Nc=r,Pc=i;break;case 0:case 11:case 14:case 15:if(!vc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Sc(n,t,o),i=i.next}while(i!==r)}Fc(e,t,n);break;case 1:if(!vc&&(xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Jl(n,t,e)}Fc(e,t,n);break;case 21:Fc(e,t,n);break;case 22:n.mode&1?(vc=(r=vc)||n.memoizedState!==null,Fc(e,t,n),vc=r):Fc(e,t,n);break;default:Fc(e,t,n)}}function Lc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Ql.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Rc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=yt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Kc(i/1960))-i,10e?16:e,gl===null)var i=!1;else{if(e=gl,gl=null,_l=0,Xc&6)throw Error(r(331));var a=Xc;for(Xc|=4,bc=e.current;bc!==null;){var o=bc,s=o.child;if(bc.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lyt()-ll?Fl(e,0):ol|=n),Tl(e,t)}function Xl(e,t){t===0&&(e.mode&1?(t=Pt,Pt<<=1,!(Pt&130023424)&&(Pt=4194304)):t=1);var n=Sl();e=ao(e,t),e!==null&&(Ht(e,t,n),Tl(e,n))}function Zl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xl(e,n)}function Ql(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Xl(e,n)}var $l=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$i.current)Us=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Us=!1,fc(e,t,n);Us=!!(e.flags&131072)}else Us=!1,ka&&t.flags&1048576&&wa(t,_a,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;uc(e,t),e=t.pendingProps;var a=ta(t,Qi.current);eo(t,n),a=Bo(null,t,i,e,a,n);var o=Vo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,na(i)?(o=!0,oa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,so(t),a.updater=Os,t.stateNode=a,a._reactInternals=t,Ms(t,i,e,n),t=Qs(null,t,i,!0,o,n)):(t.tag=0,ka&&o&&Ta(t),Ws(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(uc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=iu(i),e=Es(i,e),a){case 0:t=Xs(null,t,i,e,n);break a;case 1:t=Zs(null,t,i,e,n);break a;case 11:t=Gs(null,t,i,e,n);break a;case 14:t=Ks(null,t,i,Es(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Es(i,a),Xs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Es(i,a),Zs(e,t,i,a,n);case 3:a:{if($s(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,co(e,t),mo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ns(Error(r(423)),t),t=ec(e,t,i,n,a);break a}else if(i!==a){a=Ns(Error(r(424)),t),t=ec(e,t,i,n,a);break a}else for(Oa=Ni(t.stateNode.containerInfo.firstChild),Da=t,ka=!0,Aa=null,n=Ka(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ra(),i===a){t=dc(e,t,n);break a}Ws(e,t,i,n)}t=t.child}return t;case 5:return Co(t),e===null&&Pa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ei(i,a)?s=null:o!==null&&Ei(i,o)&&(t.flags|=32),Ys(e,t),Ws(e,t,s,n),t.child;case 6:return e===null&&Pa(t),null;case 13:return rc(e,t,n);case 4:return xo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ga(t,null,i,n):Ws(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Es(i,a),Gs(e,t,i,a,n);case 7:return Ws(e,t,t.pendingProps,n),t.child;case 8:return Ws(e,t,t.pendingProps.children,n),t.child;case 12:return Ws(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Xi(qa,i._currentValue),i._currentValue=s,o!==null)if(jr(o.value,s)){if(o.children===a.children&&!$i.current){t=dc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=lo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),$a(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),$a(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Ws(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,eo(t,n),a=to(a),i=i(a),t.flags|=1,Ws(e,t,i,n),t.child;case 14:return i=t.type,a=Es(i,t.pendingProps),a=Es(i.type,a),Ks(e,t,i,a,n);case 15:return qs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Es(i,a),uc(e,t),t.tag=1,na(i)?(e=!0,oa(t)):e=!1,eo(t,n),As(t,i,a),Ms(t,i,a,n),Qs(null,t,i,!0,e,n);case 19:return lc(e,t,n);case 22:return Js(e,t,n)}throw Error(r(156,t.tag))};function eu(e,t){return ht(e,t)}function tu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nu(e,t,n,r){return new tu(e,t,n,r)}function ru(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iu(e){if(typeof e==`function`)return+!!ru(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===N)return 14}return 2}function au(e,t){var n=e.alternate;return n===null?(n=nu(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ou(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ru(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return su(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=nu(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=nu(13,n,t,a),e.elementType=M,e.lanes=o,e;case ee:return e=nu(19,n,t,a),e.elementType=ee,e.lanes=o,e;case ne:return cu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case N:s=14;break a;case te:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=nu(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function su(e,t,n,r){return e=nu(7,e,r,t),e.lanes=n,e}function cu(e,t,n,r){return e=nu(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function lu(e,t,n){return e=nu(6,e,null,t),e.lanes=n,e}function uu(e,t,n){return t=nu(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iee(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vt(0),this.expirationTimes=Vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function du(e,t,n,r,i,a,o,s,c){return e=new iee(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=nu(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},so(a),e}function aee(e,t,n){var r=3{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=h()})),_=s((e=>{var t=g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),v=u(f(),1),y=_();function b(e=`This should not happen`){throw Error(e)}function x(e,t=`Assertion failed`){if(!e)return b(t)}function S(e,t){return b(t??`Hell froze over`)}function C(e,t){try{return e()}catch{return t}}function w(e,t){let n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&w(e[r],t[r]););return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(T.call(e,n)&&++r&&!T.call(t,n)||!(n in t)||!w(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var T,E=o((()=>{T=Object.prototype.hasOwnProperty})),D=s(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e,t){return e!=null&&n.call(e,t)}t.exports=r})),O=s(((e,t)=>{t.exports=Array.isArray})),k=s(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),A=s(((e,t)=>{var n=k(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),j=s(((e,t)=>{t.exports=A().Symbol})),M=s(((e,t)=>{var n=j(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),ee=s(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),N=s(((e,t)=>{var n=j(),r=M(),i=ee(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),te=s(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),ne=s(((e,t)=>{var n=N(),r=te(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),P=s(((e,t)=>{var n=O(),r=ne(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),re=s(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),F=s(((e,t)=>{var n=N(),r=re(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),ie=s(((e,t)=>{t.exports=A()[`__core-js_shared__`]})),ae=s(((e,t)=>{var n=ie(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),oe=s(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),se=s(((e,t)=>{var n=F(),r=ae(),i=re(),a=oe(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),ce=s(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),le=s(((e,t)=>{var n=se(),r=ce();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),ue=s(((e,t)=>{t.exports=le()(Object,`create`)})),de=s(((e,t)=>{var n=ue();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),fe=s(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),pe=s(((e,t)=>{var n=ue(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),me=s(((e,t)=>{var n=ue(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),he=s(((e,t)=>{var n=ue(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),ge=s(((e,t)=>{var n=de(),r=fe(),i=pe(),a=me(),o=he();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),ve=s(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),ye=s(((e,t)=>{var n=ve();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),be=s(((e,t)=>{var n=ye(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),xe=s(((e,t)=>{var n=ye();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Se=s(((e,t)=>{var n=ye();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Ce=s(((e,t)=>{var n=ye();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),we=s(((e,t)=>{var n=_e(),r=be(),i=xe(),a=Se(),o=Ce();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=le()(A(),`Map`)})),Ee=s(((e,t)=>{var n=ge(),r=we(),i=Te();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),De=s(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),Oe=s(((e,t)=>{var n=De();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ke=s(((e,t)=>{var n=Oe();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),Ae=s(((e,t)=>{var n=Oe();function r(e){return n(this,e).get(e)}t.exports=r})),je=s(((e,t)=>{var n=Oe();function r(e){return n(this,e).has(e)}t.exports=r})),Me=s(((e,t)=>{var n=Oe();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),Ne=s(((e,t)=>{var n=Ee(),r=ke(),i=Ae(),a=je(),o=Me();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=Ne(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),Fe=s(((e,t)=>{var n=Pe(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Ie=s(((e,t)=>{var n=Fe(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Le=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=j(),r=Le(),i=O(),a=ne(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),ze=s(((e,t)=>{var n=Re();function r(e){return e==null?``:n(e)}t.exports=r})),Be=s(((e,t)=>{var n=O(),r=P(),i=Ie(),a=ze();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),Ve=s(((e,t)=>{var n=N(),r=te(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),He=s(((e,t)=>{var n=Ve(),r=te(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),Ue=s(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;function r(e,t){var r=typeof e;return t??=9007199254740991,!!t&&(r==`number`||r!=`symbol`&&n.test(e))&&e>-1&&e%1==0&&e{function n(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}t.exports=n})),Ge=s(((e,t)=>{var n=ne(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Ke=s(((e,t)=>{var n=Be(),r=He(),i=O(),a=Ue(),o=We(),s=Ge();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=D(),r=Ke();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i}));function Je(e){return`width`in e&&typeof e.width==`number`}async function Ye(e){return typeof e==`object`?e:await e()}function Xe(e){return!(e.kind===I.Loading||e.kind===I.Bubble||e.kind===I.RowID||e.kind===I.Protected||e.kind===I.Drilldown)}function Ze(e){return e.kind===at.Marker||e.kind===at.NewRow}function Qe(e){if(!Xe(e)||e.kind===I.Image)return!1;if(e.kind===I.Text||e.kind===I.Number||e.kind===I.Markdown||e.kind===I.Uri||e.kind===I.Custom||e.kind===I.Boolean)return e.readonly!==!0;S(e,`A cell was passed with an invalid kind`)}function $e(e){return(0,nt.default)(e,`editor`)}function et(e){return!(e.readonly??!1)}function tt(e){if(e.length===0)return[];let t=[...e],n=[];t.sort(function(e,t){return e[0]-t[0]}),n.push([...t[0]]);for(let e of t.slice(1)){let t=n[n.length-1];t[1]{E(),nt=u(qe(),1),(function(e){e.Uri=`uri`,e.Text=`text`,e.Image=`image`,e.RowID=`row-id`,e.Number=`number`,e.Bubble=`bubble`,e.Boolean=`boolean`,e.Loading=`loading`,e.Markdown=`markdown`,e.Drilldown=`drilldown`,e.Protected=`protected`,e.Custom=`custom`})(I||={}),(function(e){e.HeaderRowID=`headerRowID`,e.HeaderCode=`headerCode`,e.HeaderNumber=`headerNumber`,e.HeaderString=`headerString`,e.HeaderBoolean=`headerBoolean`,e.HeaderAudioUri=`headerAudioUri`,e.HeaderVideoUri=`headerVideoUri`,e.HeaderEmoji=`headerEmoji`,e.HeaderImage=`headerImage`,e.HeaderUri=`headerUri`,e.HeaderPhone=`headerPhone`,e.HeaderMarkdown=`headerMarkdown`,e.HeaderDate=`headerDate`,e.HeaderTime=`headerTime`,e.HeaderEmail=`headerEmail`,e.HeaderReference=`headerReference`,e.HeaderIfThenElse=`headerIfThenElse`,e.HeaderSingleValue=`headerSingleValue`,e.HeaderLookup=`headerLookup`,e.HeaderTextTemplate=`headerTextTemplate`,e.HeaderMath=`headerMath`,e.HeaderRollup=`headerRollup`,e.HeaderJoinStrings=`headerJoinStrings`,e.HeaderSplitString=`headerSplitString`,e.HeaderGeoDistance=`headerGeoDistance`,e.HeaderArray=`headerArray`,e.RowOwnerOverlay=`rowOwnerOverlay`,e.ProtectedColumnOverlay=`protectedColumnOverlay`})(rt||={}),(function(e){e.Triangle=`triangle`,e.Dots=`dots`})(it||={}),(function(e){e.NewRow=`new-row`,e.Marker=`marker`})(at||={}),st=class e{items;constructor(e){this.items=e}static empty=()=>ot??=new e([]);static fromSingleSelection=t=>e.empty().add(t);offset(t){if(t===0)return this;let n=this.items.map(e=>[e[0]+t,e[1]+t]);return new e(n)}add(t){let n=typeof t==`number`?[t,t+1]:t,r=tt([...this.items,n]);return new e(r)}remove(t){let n=[...this.items],r=typeof t==`number`?t:t[0],i=typeof t==`number`?t+1:t[1];for(let[e,t]of n.entries()){let[a,o]=t;if(a<=i&&r<=o){let t=[];a=n&&e{})),dt,ft,pt=o((()=>{ut(),dt=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|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|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|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|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ft=lt(function(e){return dt.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),mt,ht=o((()=>{mt=function(){let e=Array.prototype.slice.call(arguments).filter(Boolean),t={},n=[];e.forEach(e=>{(e?e.split(` `):[]).forEach(e=>{if(e.startsWith(`atm_`)){let[,n]=e.split(`_`);t[n]=e}else n.push(e)})});let r=[];for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.push(t[e]);return r.push(...n),r.join(` `)}}));function gt(e,t,n){let r=bt(t,n);if(!e){let e=typeof ft==`function`?{default:ft}:ft;Object.keys(r).forEach(t=>{e.default(t)||delete r[t]})}return r}function _t(e){return t=>{let n=(n,r)=>{let{as:i=e,class:a=``}=n,o=gt(t.propsAsIs===void 0?!(typeof i==`string`&&i.indexOf(`-`)===-1&&!vt(i[0])):t.propsAsIs,n,[`as`,`class`]);o.ref=r,o.className=t.atomic?mt(t.class,o.className||a):mt(o.className||a,t.class);let{vars:s}=t;if(s){let e={};for(let r in s){let i=s[r],a=i[0],o=i[1]||``,c=typeof a==`function`?a(n):a;t.name,e[`--${r}`]=`${c}${o}`}let r=o.style||{},i=Object.keys(r);i.length>0&&i.forEach(t=>{e[t]=r[t]}),o.style=e}return e.__linaria&&e!==i?(o.as=i,v.createElement(e,o)):v.createElement(i,o)},r=v.forwardRef?v.forwardRef(n):e=>{let t=bt(e,[`innerRef`]);return n(t,e.innerRef)};return r.displayName=t.name,r.__linaria={className:t.class||``,extends:e},r}}var vt,yt,bt,xt,St=o((()=>{pt(),ht(),vt=e=>e.toUpperCase()===e,yt=e=>t=>e.indexOf(t)===-1,bt=(e,t)=>{let n={};return Object.keys(e).filter(yt(t)).forEach(t=>{n[t]=e[t]}),n},xt=_t}));St();var Ct=xt(`div`)({name:`ImageOverlayEditorStyle`,class:`gdg-i2iowwq`,propsAsIs:!1}),wt=s(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Tt=s(((e,t)=>{var n=wt();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Et=s(((e,t)=>{t.exports=Tt()()})),Dt=s((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`react`,`prop-types`],n);else if(e!==void 0)n(e,f(),Et());else{var r={exports:{}};n(r.exports,t.react,t.propTypes),t.reactSwipe=r.exports}})(e,function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var r=a(t),i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}var o=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var l=function(){function e(e,t){for(var n=0;n0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return f?e:e.capture}function h(e){if(`touches`in e){var t=e.touches[0];return{x:t.pageX,y:t.pageY}}return{x:e.screenX,y:e.screenY}}var g=function(e){d(t,e);function t(){var e;c(this,t);var n=[...arguments],r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(n)));return r._handleSwipeStart=r._handleSwipeStart.bind(r),r._handleSwipeMove=r._handleSwipeMove.bind(r),r._handleSwipeEnd=r._handleSwipeEnd.bind(r),r._onMouseDown=r._onMouseDown.bind(r),r._onMouseMove=r._onMouseMove.bind(r),r._onMouseUp=r._onMouseUp.bind(r),r._setSwiperRef=r._setSwiperRef.bind(r),r}return l(t,[{key:`componentDidMount`,value:function(){this.swiper&&this.swiper.addEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`componentWillUnmount`,value:function(){this.swiper&&this.swiper.removeEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`_onMouseDown`,value:function(e){this.props.allowMouseEvents&&(this.mouseDown=!0,document.addEventListener(`mouseup`,this._onMouseUp),document.addEventListener(`mousemove`,this._onMouseMove),this._handleSwipeStart(e))}},{key:`_onMouseMove`,value:function(e){this.mouseDown&&this._handleSwipeMove(e)}},{key:`_onMouseUp`,value:function(e){this.mouseDown=!1,document.removeEventListener(`mouseup`,this._onMouseUp),document.removeEventListener(`mousemove`,this._onMouseMove),this._handleSwipeEnd(e)}},{key:`_handleSwipeStart`,value:function(e){var t=h(e),n=t.x,r=t.y;this.moveStart={x:n,y:r},this.props.onSwipeStart(e)}},{key:`_handleSwipeMove`,value:function(e){if(this.moveStart){var t=h(e),n=t.x,r=t.y,i=n-this.moveStart.x,a=r-this.moveStart.y;this.moving=!0,this.props.onSwipeMove({x:i,y:a},e)&&e.cancelable&&e.preventDefault(),this.movePosition={deltaX:i,deltaY:a}}}},{key:`_handleSwipeEnd`,value:function(e){this.props.onSwipeEnd(e);var t=this.props.tolerance;this.moving&&this.movePosition&&(this.movePosition.deltaX<-t?this.props.onSwipeLeft(1,e):this.movePosition.deltaX>t&&this.props.onSwipeRight(1,e),this.movePosition.deltaY<-t?this.props.onSwipeUp(1,e):this.movePosition.deltaY>t&&this.props.onSwipeDown(1,e)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:`_setSwiperRef`,value:function(e){this.swiper=e,this.props.innerRef(e)}},{key:`render`,value:function(){var e=this.props;e.tagName;var t=e.className,n=e.style,i=e.children;e.allowMouseEvents,e.onSwipeUp,e.onSwipeDown,e.onSwipeLeft,e.onSwipeRight,e.onSwipeStart,e.onSwipeMove,e.onSwipeEnd,e.innerRef,e.tolerance;var a=s(e,[`tagName`,`className`,`style`,`children`,`allowMouseEvents`,`onSwipeUp`,`onSwipeDown`,`onSwipeLeft`,`onSwipeRight`,`onSwipeStart`,`onSwipeMove`,`onSwipeEnd`,`innerRef`,`tolerance`]);return r.default.createElement(this.props.tagName,o({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:t,style:n},a),i)}}]),t}(t.Component);g.displayName=`ReactSwipe`,g.propTypes={tagName:i.default.string,className:i.default.string,style:i.default.object,children:i.default.node,allowMouseEvents:i.default.bool,onSwipeUp:i.default.func,onSwipeDown:i.default.func,onSwipeLeft:i.default.func,onSwipeRight:i.default.func,onSwipeStart:i.default.func,onSwipeMove:i.default.func,onSwipeEnd:i.default.func,innerRef:i.default.func,tolerance:i.default.number.isRequired},g.defaultProps={tagName:`div`,allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=g})})),Ot=s((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`./react-swipe`],n);else if(e!==void 0)n(e,Dt());else{var r={exports:{}};n(r.exports,t.reactSwipe),t.index=r.exports}})(e,function(e,t){Object.defineProperty(e,"__esModule",{value:!0});var n=r(t);function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default})})),kt=s(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(kt());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.default={ROOT:function(e){return(0,t.default)(r({"carousel-root":!0},e||``,!!e))},CAROUSEL:function(e){return(0,t.default)({carousel:!0,"carousel-slider":e})},WRAPPER:function(e,n){return(0,t.default)({"thumbs-wrapper":!e,"slider-wrapper":e,"axis-horizontal":n===`horizontal`,"axis-vertical":n!==`horizontal`})},SLIDER:function(e,n){return(0,t.default)({thumbs:!e,slider:e,animated:!n})},ITEM:function(e,n,r){return(0,t.default)({thumb:!e,slide:e,selected:n,previous:r})},ARROW_PREV:function(e){return(0,t.default)({"control-arrow control-prev":!0,"control-disabled":e})},ARROW_NEXT:function(e){return(0,t.default)({"control-arrow control-next":!0,"control-disabled":e})},DOT:function(e){return(0,t.default)({dot:!0,selected:e})}}})),jt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.outerWidth=void 0,e.outerWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft)+parseInt(n.marginRight),t}})),Mt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(e,t,n){var r=e===0?e:e+t;return`translate3d`+(`(`+(n===`horizontal`?[r,0,0]:[0,r,0]).join(`,`)+`)`)}})),Nt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return window}})),Pt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=l(f()),n=s(At()),r=jt(),i=s(Mt()),a=s(Ot()),o=s(Nt());function s(e){return e&&e.__esModule?e:{default:e}}function c(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return c=function(){return e},e}function l(e){if(e&&e.__esModule)return e;if(e===null||u(e)!==`object`&&typeof e!=`function`)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function u(e){"@babel/helpers - typeof";return u=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},u(e)}function d(){return d=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){return e.hasOwnProperty(`key`)},T=function(e){g(c,e);var s=v(c);function c(e){var n;return p(this,c),n=s.call(this,e),C(b(n),`itemsWrapperRef`,void 0),C(b(n),`itemsListRef`,void 0),C(b(n),`thumbsRef`,void 0),C(b(n),`setItemsWrapperRef`,function(e){n.itemsWrapperRef=e}),C(b(n),`setItemsListRef`,function(e){n.itemsListRef=e}),C(b(n),`setThumbsRef`,function(e,t){n.thumbsRef||=[],n.thumbsRef[t]=e}),C(b(n),`updateSizes`,function(){if(!(!n.props.children||!n.itemsWrapperRef||!n.thumbsRef)){var e=t.Children.count(n.props.children),i=n.itemsWrapperRef.clientWidth,a=n.props.thumbWidth?n.props.thumbWidth:(0,r.outerWidth)(n.thumbsRef[0]),o=Math.floor(i/a),s=o0&&(r=0),s===c&&r<0&&(r=0);var l=s+100/(n.itemsWrapperRef.clientWidth/r);return n.itemsListRef&&[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(e){n.itemsListRef.style[e]=(0,i.default)(l,`%`,n.props.axis)}),!0}),C(b(n),`slideRight`,function(e){n.moveTo(n.state.firstItem-(typeof e==`number`?e:1))}),C(b(n),`slideLeft`,function(e){n.moveTo(n.state.firstItem+(typeof e==`number`?e:1))}),C(b(n),`moveTo`,function(e){e=e<0?0:e,e=e>=n.state.lastPosition?n.state.lastPosition:e,n.setState({firstItem:e})}),n.state={selectedItem:e.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},n}return h(c,[{key:`componentDidMount`,value:function(){this.setupThumbs()}},{key:`componentDidUpdate`,value:function(e){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==e.children&&this.updateSizes()}},{key:`componentWillUnmount`,value:function(){this.destroyThumbs()}},{key:`setupThumbs`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.updateSizes()}},{key:`destroyThumbs`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes)}},{key:`getFirstItem`,value:function(e){var t=e;return e>=this.state.lastPosition&&(t=this.state.lastPosition),e1,o=this.state.showArrows&&this.state.firstItem>0,s=this.state.showArrows&&this.state.firstItem{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return document}})),It=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setPosition=e.getPosition=e.isKeyboardEvent=e.defaultStatusFormatter=e.noop=void 0;var t=f(),n=r(Mt());function r(e){return e&&e.__esModule?e:{default:e}}e.noop=function(){},e.defaultStatusFormatter=function(e,t){return`${e} of ${t}`},e.isKeyboardEvent=function(e){return e?e.hasOwnProperty(`key`):!1},e.getPosition=function(e,n){if(n.infiniteLoop&&++e,e===0)return 0;var r=t.Children.count(n.children);if(n.centerMode&&n.axis===`horizontal`){var i=-e*n.centerSlidePercentage,a=r-1;return e&&(e!==a||n.infiniteLoop)?i+=(100-n.centerSlidePercentage)/2:e===a&&(i+=100-n.centerSlidePercentage),i}return-e*100},e.setPosition=function(e,t){var r={};return[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(i){r[i]=(0,n.default)(e,`%`,t)}),r}})),Lt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fadeAnimationHandler=e.slideStopSwipingHandler=e.slideSwipeAnimationHandler=e.slideAnimationHandler=void 0;var t=f(),n=i(Mt()),r=It();function i(e){return e&&e.__esModule?e:{default:e}}function a(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 o(e){for(var t=1;tl))return c<0?e.centerMode&&e.centerSlidePercentage&&e.axis===`horizontal`?a.itemListStyle=(0,r.setPosition)(-(l+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):a.itemListStyle=(0,r.setPosition)(-(l+2)*100,e.axis):c>l&&(a.itemListStyle=(0,r.setPosition)(0,e.axis)),a;var u=(0,r.getPosition)(s,e),d=(0,n.default)(u,`%`,e.axis),f=e.transitionTime+`ms`;return a.itemListStyle={WebkitTransform:d,msTransform:d,OTransform:d,transform:d},i.swiping||(a.itemListStyle=o(o({},a.itemListStyle),{},{WebkitTransitionDuration:f,MozTransitionDuration:f,OTransitionDuration:f,transitionDuration:f,msTransitionDuration:f})),a},e.slideSwipeAnimationHandler=function(e,n,i,a){var o={},s=n.axis===`horizontal`,c=t.Children.count(n.children),l=0,u=(0,r.getPosition)(i.selectedItem,n),d=n.infiniteLoop?(0,r.getPosition)(c-1,n)-100:(0,r.getPosition)(c-1,n),f=s?e.x:e.y,p=f;u===l&&f>0&&(p=0),u===d&&f<0&&(p=0);var m=u+100/(i.itemSize/p),h=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&h&&(i.selectedItem===0&&m>-100?m-=c*100:i.selectedItem===c-1&&m<-c*100&&(m+=c*100)),(!n.preventMovementUntilSwipeScrollTolerance||h||i.swipeMovementStarted)&&(i.swipeMovementStarted||a({swipeMovementStarted:!0}),o.itemListStyle=(0,r.setPosition)(m,n.axis)),h&&!i.cancelClick&&a({cancelClick:!0}),o},e.slideStopSwipingHandler=function(e,t){var n=(0,r.getPosition)(t.selectedItem,e);return{itemListStyle:(0,r.setPosition)(n,e.axis)}},e.fadeAnimationHandler=function(e,t){var n=e.transitionTime+`ms`,r=`ease-in-out`,i={position:`absolute`,display:`block`,zIndex:-2,minHeight:`100%`,opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:r,msTransitionTimingFunction:r,MozTransitionTimingFunction:r,WebkitTransitionTimingFunction:r,OTransitionTimingFunction:r};return t.swiping||(i=o(o({},i),{},{WebkitTransitionDuration:n,MozTransitionDuration:n,OTransitionDuration:n,transitionDuration:n,msTransitionDuration:n})),{slideStyle:i,selectedStyle:o(o({},i),{},{opacity:1,position:`relative`}),prevStyle:o({},i)}}})),Rt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=d(f()),n=l(Ot()),r=l(At()),i=l(Pt()),a=l(Ft()),o=l(Nt()),s=It(),c=Lt();function l(e){return e&&e.__esModule?e:{default:e}}function u(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return u=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(e===null||p(e)!==`object`&&typeof e!=`function`)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function p(e){"@babel/helpers - typeof";return p=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p(e)}function m(){return m=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=function(e){b(u,e);var l=S(u);function u(e){var n;_(this,u),n=l.call(this,e),D(w(n),`thumbsRef`,void 0),D(w(n),`carouselWrapperRef`,void 0),D(w(n),`listRef`,void 0),D(w(n),`itemsRef`,void 0),D(w(n),`timer`,void 0),D(w(n),`animationHandler`,void 0),D(w(n),`setThumbsRef`,function(e){n.thumbsRef=e}),D(w(n),`setCarouselWrapperRef`,function(e){n.carouselWrapperRef=e}),D(w(n),`setListRef`,function(e){n.listRef=e}),D(w(n),`setItemsRef`,function(e,t){n.itemsRef||=[],n.itemsRef[t]=e}),D(w(n),`autoPlay`,function(){t.Children.count(n.props.children)<=1||(n.clearAutoPlay(),n.props.autoPlay&&(n.timer=setTimeout(function(){n.increment()},n.props.interval)))}),D(w(n),`clearAutoPlay`,function(){n.timer&&clearTimeout(n.timer)}),D(w(n),`resetAutoPlay`,function(){n.clearAutoPlay(),n.autoPlay()}),D(w(n),`stopOnHover`,function(){n.setState({isMouseEntered:!0},n.clearAutoPlay)}),D(w(n),`startOnLeave`,function(){n.setState({isMouseEntered:!1},n.autoPlay)}),D(w(n),`isFocusWithinTheCarousel`,function(){return n.carouselWrapperRef?!!((0,a.default)().activeElement===n.carouselWrapperRef||n.carouselWrapperRef.contains((0,a.default)().activeElement)):!1}),D(w(n),`navigateWithKeyboard`,function(e){if(n.isFocusWithinTheCarousel()){var t=n.props.axis===`horizontal`,r={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},i=t?r.ArrowRight:r.ArrowDown,a=t?r.ArrowLeft:r.ArrowUp;i===e.keyCode?n.increment():a===e.keyCode&&n.decrement()}}),D(w(n),`updateSizes`,function(){if(!(!n.state.initialized||!n.itemsRef||n.itemsRef.length===0)){var e=n.props.axis===`horizontal`,t=n.itemsRef[0];if(t){var r=e?t.clientWidth:t.clientHeight;n.setState({itemSize:r}),n.thumbsRef&&n.thumbsRef.updateSizes()}}}),D(w(n),`setMountState`,function(){n.setState({hasMount:!0}),n.updateSizes()}),D(w(n),`handleClickItem`,function(e,r){if(t.Children.count(n.props.children)!==0){if(n.state.cancelClick){n.setState({cancelClick:!1});return}n.props.onClickItem(e,r),e!==n.state.selectedItem&&n.setState({selectedItem:e})}}),D(w(n),`handleOnChange`,function(e,r){t.Children.count(n.props.children)<=1||n.props.onChange(e,r)}),D(w(n),`handleClickThumb`,function(e,t){n.props.onClickThumb(e,t),n.moveTo(e)}),D(w(n),`onSwipeStart`,function(e){n.setState({swiping:!0}),n.props.onSwipeStart(e)}),D(w(n),`onSwipeEnd`,function(e){n.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),n.props.onSwipeEnd(e),n.clearAutoPlay(),n.state.autoPlay&&n.autoPlay()}),D(w(n),`onSwipeMove`,function(e,t){n.props.onSwipeMove(t);var r=n.props.swipeAnimationHandler(e,n.props,n.state,n.setState.bind(w(n)));return n.setState(g({},r)),!!Object.keys(r).length}),D(w(n),`decrement`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem-(typeof e==`number`?e:1))}),D(w(n),`increment`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem+(typeof e==`number`?e:1))}),D(w(n),`moveTo`,function(e){if(typeof e==`number`){var r=t.Children.count(n.props.children)-1;e<0&&(e=n.props.infiniteLoop?r:0),e>r&&(e=n.props.infiniteLoop?0:r),n.selectItem({selectedItem:e}),n.state.autoPlay&&n.state.isMouseEntered===!1&&n.resetAutoPlay()}}),D(w(n),`onClickNext`,function(){n.increment(1)}),D(w(n),`onClickPrev`,function(){n.decrement(1)}),D(w(n),`onSwipeForward`,function(){n.increment(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`onSwipeBackwards`,function(){n.decrement(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`changeItem`,function(e){return function(t){(!(0,s.isKeyboardEvent)(t)||t.key===`Enter`)&&n.moveTo(e)}}),D(w(n),`selectItem`,function(e){n.setState(g({previousItem:n.state.selectedItem},e),function(){n.setState(n.animationHandler(n.props,n.state))}),n.handleOnChange(e.selectedItem,t.Children.toArray(n.props.children)[e.selectedItem])}),D(w(n),`getInitialImage`,function(){var e=n.props.selectedItem,t=n.itemsRef&&n.itemsRef[e];return(t&&t.getElementsByTagName(`img`)||[])[0]}),D(w(n),`getVariableItemHeight`,function(e){var t=n.itemsRef&&n.itemsRef[e];if(n.state.hasMount&&t&&t.children.length){var r=t.children[0].getElementsByTagName(`img`)||[];if(r.length>0){var i=r[0];i.complete||i.addEventListener(`load`,function e(){n.forceUpdate(),i.removeEventListener(`load`,e)})}var a=(r[0]||t.children[0]).clientHeight;return a>0?a:null}return null});var r={initialized:!1,previousItem:e.selectedItem,selectedItem:e.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:e.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return n.animationHandler=typeof e.animationHandler==`function`&&e.animationHandler||e.animationHandler===`fade`&&c.fadeAnimationHandler||c.slideAnimationHandler,n.state=g(g({},r),n.animationHandler(e,r)),n}return y(u,[{key:`componentDidMount`,value:function(){this.props.children&&this.setupCarousel()}},{key:`componentDidUpdate`,value:function(e,t){!e.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!e.autoFocus&&this.props.autoFocus&&this.forceFocus(),t.swiping&&!this.state.swiping&&this.setState(g({},this.props.stopSwipingHandler(this.props,this.state))),(e.selectedItem!==this.props.selectedItem||e.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),e.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:`componentWillUnmount`,value:function(){this.destroyCarousel()}},{key:`setupCarousel`,value:function(){var e=this;this.bindEvents(),this.state.autoPlay&&t.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var t=e.getInitialImage();t&&!t.complete?t.addEventListener(`load`,e.setMountState):e.setMountState()})}},{key:`destroyCarousel`,value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:`setupAutoPlay`,value:function(){this.autoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.addEventListener(`mouseenter`,this.stopOnHover),e.addEventListener(`mouseleave`,this.startOnLeave))}},{key:`destroyAutoPlay`,value:function(){this.clearAutoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.removeEventListener(`mouseenter`,this.stopOnHover),e.removeEventListener(`mouseleave`,this.startOnLeave))}},{key:`bindEvents`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.props.useKeyboardArrows&&(0,a.default)().addEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`unbindEvents`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes);var e=this.getInitialImage();e&&e.removeEventListener(`load`,this.setMountState),this.props.useKeyboardArrows&&(0,a.default)().removeEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`forceFocus`,value:function(){var e;(e=this.carouselWrapperRef)==null||e.focus()}},{key:`renderItems`,value:function(e){var n=this;return this.props.children?t.Children.map(this.props.children,function(i,a){var o=a===n.state.selectedItem,s=a===n.state.previousItem,c=o&&n.state.selectedStyle||s&&n.state.prevStyle||n.state.slideStyle||{};n.props.centerMode&&n.props.axis===`horizontal`&&(c=g(g({},c),{},{minWidth:n.props.centerSlidePercentage+`%`})),n.state.swiping&&n.state.swipeMovementStarted&&(c=g(g({},c),{},{pointerEvents:`none`}));var l={ref:function(e){return n.setItemsRef(e,a)},key:`itemKey`+a+(e?`clone`:``),className:r.default.ITEM(!0,a===n.state.selectedItem,a===n.state.previousItem),onClick:n.handleClickItem.bind(n,a,i),style:c};return t.default.createElement(`li`,l,n.props.renderItem(i,{isSelected:a===n.state.selectedItem,isPrevious:a===n.state.previousItem}))}):[]}},{key:`renderControls`,value:function(){var e=this,n=this.props,r=n.showIndicators,i=n.labels,a=n.renderIndicator,o=n.children;return r?t.default.createElement(`ul`,{className:`control-dots`},t.Children.map(o,function(t,n){return a&&a(e.changeItem(n),n===e.state.selectedItem,n,i.item)})):null}},{key:`renderStatus`,value:function(){return this.props.showStatus?t.default.createElement(`p`,{className:`carousel-status`},this.props.statusFormatter(this.state.selectedItem+1,t.Children.count(this.props.children))):null}},{key:`renderThumbs`,value:function(){return!this.props.showThumbs||!this.props.children||t.Children.count(this.props.children)===0?null:t.default.createElement(i.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:`render`,value:function(){var e=this;if(!this.props.children||t.Children.count(this.props.children)===0)return null;var i=this.props.swipeable&&t.Children.count(this.props.children)>1,a=this.props.axis===`horizontal`,o=this.props.showArrows&&t.Children.count(this.props.children)>1,s=o&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,c=o&&(this.state.selectedItem{})),Bt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Carousel",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"CarouselProps",{enumerable:!0,get:function(){return n.CarouselProps}}),Object.defineProperty(e,"Thumbs",{enumerable:!0,get:function(){return r.default}});var t=i(Rt()),n=zt(),r=i(Pt());function i(e){return e&&e.__esModule?e:{default:e}}})),Vt=s(((e,t)=>{var n=A();t.exports=function(){return n.Date.now()}})),Ht=s(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),Ut=s(((e,t)=>{var n=Ht(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),Wt=s(((e,t)=>{var n=Ut(),r=re(),i=ne(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),Gt=s(((e,t)=>{var n=re(),r=Vt(),i=Wt(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),L=u(f(),1),Kt=u(Gt(),1);E();function qt(e,t,n,r,i=!1){let a=L.useRef();a.current=t,L.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;let t=n,o=e=>{a.current?.call(t,e)};return t.addEventListener(e,o,{passive:r,capture:i}),()=>{t.removeEventListener(e,o,{capture:i})}},[e,n,r,i])}function Jt(e,t){return e===void 0?void 0:t}var Yt=Math.PI;function Xt(e){return e*Yt/180}var Zt=(e,t,n)=>({x1:e-n/2,y1:t-n/2,x2:e+n/2,y2:t+n/2}),Qt=(e,t,n,r,i)=>{switch(e){case`left`:return Math.floor(t)+r+i/2;case`center`:return Math.floor(t+n/2);case`right`:return Math.floor(t+n)-r-i/2}},$t=(e,t,n)=>Math.min(e,t-n*2),en=(e,t,n)=>n.x1<=e&&e<=n.x2&&n.y1<=t&&t<=n.y2,tn=e=>{let t=e.fgColor??`currentColor`;return L.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}),L.createElement(`path`,{d:`M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}))},nn=e=>{let t=e.fgColor??`currentColor`;return L.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M19 6L10.3802 17L5.34071 11.8758`,vectorEffect:`non-scaling-stroke`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}))};function rn(e,t,n){let[r,i]=L.useState(e),a=L.useRef(!0);L.useEffect(()=>()=>{a.current=!1},[]);let o=L.useRef((0,Kt.default)(e=>{a.current&&i(e)},n));return L.useLayoutEffect(()=>{a.current&&o.current(()=>e())},t),r}var an=RegExp(`^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]`);function R(e){return an.test(e)?`rtl`:`not-rtl`}var on=void 0;function sn(){if(typeof document>`u`)return 0;if(on!==void 0)return on;let e=document.createElement(`p`);e.style.width=`100%`,e.style.height=`200px`;let t=document.createElement(`div`);t.id=`testScrollbar`,t.style.position=`absolute`,t.style.top=`0px`,t.style.left=`0px`,t.style.visibility=`hidden`,t.style.width=`200px`,t.style.height=`150px`,t.style.overflow=`hidden`,t.append(e),document.body.append(t);let n=e.offsetWidth;t.style.overflow=`scroll`;let r=e.offsetWidth;return n===r&&(r=t.clientWidth),t.remove(),on=n-r,on}var cn=Symbol();function ln(e){let t=L.useRef([cn,e]);t.current[1]!==e&&(t.current[0]=e),t.current[1]=e;let[n,r]=L.useState(e),[,i]=L.useState(),a=L.useCallback(e=>{let n=t.current[0];n!==cn&&(e=typeof e==`function`?e(n):e,e===n)||(n!==cn&&i({}),r(t=>typeof e==`function`?e(n===cn?t:n):e),t.current[0]=cn)},[]),o=L.useCallback(()=>{t.current[0]=cn,i({})},[]);return[t.current[0]===cn?n:t.current[0],a,o]}function un(e){if(e.length===0)return``;let t=0,n=0;for(let r of e){if(n+=r.length,n>1e4)break;t++}return e.slice(0,t).join(`, `)}function dn(e){let t=L.useRef(e);return w(e,t.current)||(t.current=e),t.current}var fn=Bt(),pn=e=>{let{urls:t,canWrite:n,onEditClick:r,renderImage:i}=e,a=t.filter(e=>e!==``);if(a.length===0)return null;let o=a.length>1;return L.createElement(Ct,{"data-testid":`GDG-default-image-overlay-editor`},L.createElement(fn.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},a.map(e=>{let t=i?.(e)??L.createElement(`img`,{draggable:!1,src:e});return L.createElement(`div`,{className:`gdg-centering-container`,key:e},t)})),n&&r&&L.createElement(`button`,{className:`gdg-edit-icon`,onClick:r},L.createElement(tn,null)))};function z(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:``,highlight:null,hooks:null,langPrefix:`language-`,mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}var mn=z();function hn(e){mn=e}var gn=/[&<>"']/,_n=new RegExp(gn.source,`g`),vn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,yn=new RegExp(vn.source,`g`),bn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},xn=e=>bn[e];function Sn(e,t){if(t){if(gn.test(e))return e.replace(_n,xn)}else if(vn.test(e))return e.replace(yn,xn);return e}var Cn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function wn(e){return e.replace(Cn,(e,t)=>(t=t.toLowerCase(),t===`colon`?`:`:t.charAt(0)===`#`?t.charAt(1)===`x`?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):``))}var Tn=/(^|[^\[])\^/g;function En(e,t){e=typeof e==`string`?e:e.source,t||=``;let n={replace:(t,r)=>(r=r.source||r,r=r.replace(Tn,`$1`),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}var Dn=/[^\w:]/g,On=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function kn(e,t,n){if(e){let e;try{e=decodeURIComponent(wn(n)).replace(Dn,``).toLowerCase()}catch{return null}if(e.indexOf(`javascript:`)===0||e.indexOf(`vbscript:`)===0||e.indexOf(`data:`)===0)return null}t&&!On.test(n)&&(n=Pn(t,n));try{n=encodeURI(n).replace(/%25/g,`%`)}catch{return null}return n}var An={},jn=/^[^:]+:\/*[^/]*$/,Mn=/^([^:]+:)[\s\S]*$/,Nn=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Pn(e,t){An[` `+e]||(jn.test(e)?An[` `+e]=e+`/`:An[` `+e]=Ln(e,`/`,!0)),e=An[` `+e];let n=e.indexOf(`:`)===-1;return t.substring(0,2)===`//`?n?t:e.replace(Mn,`$1`)+t:t.charAt(0)===`/`?n?t:e.replace(Nn,`$1`)+t:e+t}var Fn={exec:function(){}};function In(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length1;)t&1&&(n+=e),t>>=1,e+=e;return n+e}function Vn(e,t,n,r){let i=t.href,a=t.title?Sn(t.title):null,o=e[1].replace(/\\([\[\]])/g,`$1`);if(e[0].charAt(0)!==`!`){r.state.inLink=!0;let e={type:`link`,raw:n,href:i,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:`image`,raw:n,href:i,title:a,text:Sn(o)}}function Hn(e,t){let n=e.match(/^(\s+)(?:```)/);if(n===null)return t;let r=n[1];return t.split(` +`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ns(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ps(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Fs=typeof WeakMap==`function`?WeakMap:Map;function Is(e,t,n){n=co(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pl||(pl=!0,ml=r),Ps(e,t)},n}function Ls(e,t,n){n=co(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ps(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ps(e,t),typeof r!=`function`&&(hl===null?hl=new Set([this]):hl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Rs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fs;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)||(i.add(n),e=Xl.bind(null,e,t,n),t.then(e,e))}function zs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Bs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=co(-1,1),t.tag=2,lo(n,t,1))),n.lanes|=1),e)}var Vs=C.ReactCurrentOwner,Hs=!1;function Us(e,t,n,r){t.child=e===null?Ga(t,null,n,r):Wa(t,e.child,n,r)}function Ws(e,t,n,r,i){n=n.render;var a=t.ref;return $a(t,i),r=zo(e,t,n,r,a,i),n=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,uc(e,t,i)):(Oa&&n&&wa(t),t.flags|=1,Us(e,t,r,i),t.child)}function Gs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!iu(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ks(e,t,a,r,i)):(e=su(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Mr:n,n(o,r)&&e.ref===t.ref)return uc(e,t,i)}return t.flags|=1,e=ou(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ks(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Mr(a,r)&&e.ref===t.ref)if(Hs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Hs=!0);else return t.lanes=e.lanes,uc(e,t,i)}return Ys(e,t,n,r,i)}function qs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xi(nl,tl),tl|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Xi(nl,tl),tl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Xi(nl,tl),tl|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Xi(nl,tl),tl|=r;return Us(e,t,i,n),t.child}function Js(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ys(e,t,n,r,i){var a=na(n)?ea:Qi.current;return a=ta(t,a),$a(t,i),n=zo(e,t,n,r,a,i),r=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,uc(e,t,i)):(Oa&&r&&wa(t),t.flags|=1,Us(e,t,n,i),t.child)}function Xs(e,t,n,r,i){if(na(n)){var a=!0;oa(t)}else a=!1;if($a(t,i),t.stateNode===null)lc(e,t),ks(t,n,r),js(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=eo(l):(l=na(n)?ea:Qi.current,l=ta(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&As(t,o,r,l),ao=!1;var f=t.memoizedState;o.state=f,po(t,r,o,i),c=t.memoizedState,s!==r||f!==c||$i.current||ao?(typeof u==`function`&&(Es(t,n,u,r),c=t.memoizedState),(s=ao||Os(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,so(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Ts(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=eo(c):(c=na(n)?ea:Qi.current,c=ta(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&As(t,o,r,c),ao=!1,f=t.memoizedState,o.state=f,po(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||$i.current||ao?(typeof p==`function`&&(Es(t,n,p,r),m=t.memoizedState),(l=ao||Os(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Zs(e,t,n,r,a,i)}function Zs(e,t,n,r,i,a){Js(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&sa(t,n,!1),uc(e,t,a);r=t.stateNode,Vs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Wa(t,e.child,null,a),t.child=Wa(t,null,s,a)):Us(e,t,s,a),t.memoizedState=r.state,i&&sa(t,n,!0),t.child}function Qs(e){var t=e.stateNode;t.pendingContext?ia(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ia(e,t.context,!1),bo(e,t.containerInfo)}function $s(e,t,n,r,i){return La(),Ra(i),t.flags|=256,Us(e,t,n,r),t.child}var ec={dehydrated:null,treeContext:null,retryLane:0};function tc(e){return{baseLanes:e,cachePool:null,transitions:null}}function nc(e,t,n){var r=t.pendingProps,i=wo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Xi(wo,i&1),e===null)return Na(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=lu(o,r,0,null),e=cu(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=tc(n),t.memoizedState=ec,e):rc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ac(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ou(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=cu(a,o,n,null),a.flags|=2):a=ou(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?tc(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=ec,r}return a=e.child,e=a.sibling,r=ou(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function rc(e,t){return t=lu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ic(e,t,n,r){return r!==null&&Ra(r),Wa(t,e.child,null,n),e=rc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ac(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ns(Error(r(422))),ic(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=lu({mode:`visible`,children:i.children},a,0,null),o=cu(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Wa(t,e.child,null,s),t.child.memoizedState=tc(s),t.memoizedState=ec,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ic(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ns(o,i,void 0),ic(e,t,s,i)}if(c=(s&e.childLanes)!==0,Hs||c){if(i=Qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,io(e,a),Tl(i,e,a,-1))}return zl(),i=Ns(Error(r(421))),ic(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Da=Ni(a.nextSibling),Ea=t,Oa=!0,ka=null,e!==null&&(_a[va++]=ba,_a[va++]=xa,_a[va++]=ya,ba=e.id,xa=e.overflow,ya=t),t=rc(t,i.children),t.flags|=4096,t)}function oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Qa(e.return,t,n)}function sc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Us(e,t,r.children,n),r=wo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&oc(e,n,t);else if(e.tag===19)oc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Xi(wo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&To(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),sc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&To(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}sc(t,!0,n,null,a);break;case`together`:sc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function lc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function uc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),al|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=ou(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ou(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function nee(e,t,n){switch(t.tag){case 3:Qs(t),La();break;case 5:So(t);break;case 1:na(t.type)&&oa(t);break;case 4:bo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Xi(Ka,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xi(wo,wo.current&1),e=uc(e,t,n),e===null?null:e.sibling):nc(e,t,n):(Xi(wo,wo.current&1),t.flags|=128,null);Xi(wo,wo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Xi(wo,wo.current),r)break;return null;case 22:case 23:return t.lanes=0,qs(e,t,n)}return uc(e,t,n)}var dc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},fc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,yo(go.current);var o=null;switch(n){case`input`:i=_e(e,i),r=_e(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=Te(e,i),r=Te(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=Ci)}ze(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&li(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},pc=function(e,t,n,r){n!==r&&(t.flags|=4)};function mc(e,t){if(!Oa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function hc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gc(e,t,n){var i=t.pendingProps;switch(Ta(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hc(t),null;case 1:return na(t.type)&&ra(),hc(t),null;case 3:return i=t.stateNode,xo(),Yi($i),Yi(Qi),Do(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Fa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ka!==null&&(kl(ka),ka=null))),hc(t),null;case 5:Co(t);var o=yo(vo.current);if(n=t.type,e!==null&&t.stateNode!=null)fc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return hc(t),null}if(e=yo(go.current),Fa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ii]=t,i[Li]=s,e=(t.mode&1)!=0,n){case`dialog`:li(`cancel`,i),li(`close`,i);break;case`iframe`:case`object`:case`embed`:li(`load`,i);break;case`video`:case`audio`:for(o=0;o<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ii]=t,e[Li]=i,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Be(n,i),n){case`dialog`:li(`cancel`,e),li(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:li(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;odl&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304)}else{if(!i)if(e=To(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Oa)return hc(t),null}else 2*yt()-s.renderingStartTime>dl&&n!==1073741824&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(hc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=yt(),t.sibling=null,n=wo.current,Xi(wo,i?n&1|2:n&1),t);case 22:case 23:return Fl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?tl&1073741824&&(hc(t),t.subtreeFlags&6&&(t.flags|=8192)):hc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function _c(e,t){switch(Ta(t),t.tag){case 1:return na(t.type)&&ra(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xo(),Yi($i),Yi(Qi),Do(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Co(t),null;case 13:if(Yi(wo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));La()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yi(wo),null;case 4:return xo(),null;case 10:return Za(t.type._context),null;case 22:case 23:return Fl(),null;case 24:return null;default:return null}}var vc=!1,yc=!1,bc=typeof WeakSet==`function`?WeakSet:Set,xc=null;function Sc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Yl(e,t,n)}else n.current=null}function Cc(e,t,n){try{n()}catch(n){Yl(e,t,n)}}var wc=!1;function Tc(e,t){if(wi=hn,e=Ir(),Lr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.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||i!==0&&f.nodeType!==3||(l=s+i),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===i&&(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(Ti={focusedElem:e,selectionRange:n},hn=!1,xc=t;xc!==null;)if(t=xc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,xc=e;else for(;xc!==null;){t=xc;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Yl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,xc=e;break}xc=t.return}return h=wc,wc=!1,h}function Ec(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Cc(t,n,a)}i=i.next}while(i!==r)}}function Dc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Oc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function kc(e){var t=e.alternate;t!==null&&(e.alternate=null,kc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ii],delete t[Li],delete t[zi],delete t[Bi],delete t[Vi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ac(e){return e.tag===5||e.tag===3||e.tag===4}function jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ac(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.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 Mc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ci));else if(r!==4&&(e=e.child,e!==null))for(Mc(e,t,n),e=e.sibling;e!==null;)Mc(e,t,n),e=e.sibling}function Nc(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&&(e=e.child,e!==null))for(Nc(e,t,n),e=e.sibling;e!==null;)Nc(e,t,n),e=e.sibling}var Pc=null,Fc=!1;function Ic(e,t,n){for(n=n.child;n!==null;)Lc(e,t,n),n=n.sibling}function Lc(e,t,n){if(Dt&&typeof Dt.onCommitFiberUnmount==`function`)try{Dt.onCommitFiberUnmount(Et,n)}catch{}switch(n.tag){case 5:yc||Sc(n,t);case 6:var r=Pc,i=Fc;Pc=null,Ic(e,t,n),Pc=r,Fc=i,Pc!==null&&(Fc?(e=Pc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Pc.removeChild(n.stateNode));break;case 18:Pc!==null&&(Fc?(e=Pc,n=n.stateNode,e.nodeType===8?Mi(e.parentNode,n):e.nodeType===1&&Mi(e,n),z(e)):Mi(Pc,n.stateNode));break;case 4:r=Pc,i=Fc,Pc=n.stateNode.containerInfo,Fc=!0,Ic(e,t,n),Pc=r,Fc=i;break;case 0:case 11:case 14:case 15:if(!yc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Cc(n,t,o),i=i.next}while(i!==r)}Ic(e,t,n);break;case 1:if(!yc&&(Sc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Yl(n,t,e)}Ic(e,t,n);break;case 21:Ic(e,t,n);break;case 22:n.mode&1?(yc=(r=yc)||n.memoizedState!==null,Ic(e,t,n),yc=r):Ic(e,t,n);break;default:Ic(e,t,n)}}function Rc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bc),t.forEach(function(t){var r=$l.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function zc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=yt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*qc(i/1960))-i,10e?16:e,_l===null)var i=!1;else{if(e=_l,_l=null,vl=0,Zc&6)throw Error(r(331));var a=Zc;for(Zc|=4,xc=e.current;xc!==null;){var o=xc,s=o.child;if(xc.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lyt()-ul?Il(e,0):sl|=n),El(e,t)}function Zl(e,t){t===0&&(e.mode&1?(t=Pt,Pt<<=1,!(Pt&130023424)&&(Pt=4194304)):t=1);var n=Cl();e=io(e,t),e!==null&&(Ht(e,t,n),El(e,n))}function Ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zl(e,n)}function $l(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Zl(e,n)}var eu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$i.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,nee(e,t,n);Hs=!!(e.flags&131072)}else Hs=!1,Oa&&t.flags&1048576&&Ca(t,ga,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;lc(e,t),e=t.pendingProps;var a=ta(t,Qi.current);$a(t,n),a=zo(null,t,i,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,na(i)?(o=!0,oa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,oo(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,i,e,n),t=Zs(null,t,i,!0,o,n)):(t.tag=0,Oa&&o&&wa(t),Us(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(lc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=au(i),e=Ts(i,e),a){case 0:t=Ys(null,t,i,e,n);break a;case 1:t=Xs(null,t,i,e,n);break a;case 11:t=Ws(null,t,i,e,n);break a;case 14:t=Gs(null,t,i,Ts(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Ys(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Xs(e,t,i,a,n);case 3:a:{if(Qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,so(e,t),po(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(r(423)),t),t=$s(e,t,i,n,a);break a}else if(i!==a){a=Ms(Error(r(424)),t),t=$s(e,t,i,n,a);break a}else for(Da=Ni(t.stateNode.containerInfo.firstChild),Ea=t,Oa=!0,ka=null,n=Ga(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(La(),i===a){t=uc(e,t,n);break a}Us(e,t,i,n)}t=t.child}return t;case 5:return So(t),e===null&&Na(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ei(i,a)?s=null:o!==null&&Ei(i,o)&&(t.flags|=32),Js(e,t),Us(e,t,s,n),t.child;case 6:return e===null&&Na(t),null;case 13:return nc(e,t,n);case 4:return bo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Wa(t,null,i,n):Us(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Ws(e,t,i,a,n);case 7:return Us(e,t,t.pendingProps,n),t.child;case 8:return Us(e,t,t.pendingProps.children,n),t.child;case 12:return Us(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Xi(Ka,i._currentValue),i._currentValue=s,o!==null)if(jr(o.value,s)){if(o.children===a.children&&!$i.current){t=uc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=co(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Qa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Qa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Us(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,$a(t,n),a=eo(a),i=i(a),t.flags|=1,Us(e,t,i,n),t.child;case 14:return i=t.type,a=Ts(i,t.pendingProps),a=Ts(i.type,a),Gs(e,t,i,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),lc(e,t),t.tag=1,na(i)?(e=!0,oa(t)):e=!1,$a(t,n),ks(t,i,a),js(t,i,a,n),Zs(null,t,i,!0,e,n);case 19:return cc(e,t,n);case 22:return qs(e,t,n)}throw Error(r(156,t.tag))};function tu(e,t){return ht(e,t)}function nu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ru(e,t,n,r){return new nu(e,t,n,r)}function iu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function au(e){if(typeof e==`function`)return+!!iu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===N)return 14}return 2}function ou(e,t){var n=e.alternate;return n===null?(n=ru(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function su(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)iu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return cu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=ru(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=ru(13,n,t,a),e.elementType=M,e.lanes=o,e;case ee:return e=ru(19,n,t,a),e.elementType=ee,e.lanes=o,e;case ne:return lu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case N:s=14;break a;case te:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=ru(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function cu(e,t,n,r){return e=ru(7,e,r,t),e.lanes=n,e}function lu(e,t,n,r){return e=ru(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function uu(e,t,n){return e=ru(6,e,null,t),e.lanes=n,e}function du(e,t,n){return t=ru(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vt(0),this.expirationTimes=Vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function pu(e,t,n,r,i,a,o,s,c){return e=new fu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=ru(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},oo(a),e}function mu(e,t,n){var r=3{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=h()})),_=s((e=>{var t=g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),v=u(f(),1),y=_();function b(e=`This should not happen`){throw Error(e)}function x(e,t=`Assertion failed`){if(!e)return b(t)}function S(e,t){return b(t??`Hell froze over`)}function C(e,t){try{return e()}catch{return t}}function w(e,t){let n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&w(e[r],t[r]););return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(T.call(e,n)&&++r&&!T.call(t,n)||!(n in t)||!w(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var T,E=o((()=>{T=Object.prototype.hasOwnProperty})),D=s(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e,t){return e!=null&&n.call(e,t)}t.exports=r})),O=s(((e,t)=>{t.exports=Array.isArray})),k=s(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),A=s(((e,t)=>{var n=k(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),j=s(((e,t)=>{t.exports=A().Symbol})),M=s(((e,t)=>{var n=j(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),ee=s(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),N=s(((e,t)=>{var n=j(),r=M(),i=ee(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),te=s(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),ne=s(((e,t)=>{var n=N(),r=te(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),P=s(((e,t)=>{var n=O(),r=ne(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),re=s(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),F=s(((e,t)=>{var n=N(),r=re(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),ie=s(((e,t)=>{t.exports=A()[`__core-js_shared__`]})),ae=s(((e,t)=>{var n=ie(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),oe=s(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),se=s(((e,t)=>{var n=F(),r=ae(),i=re(),a=oe(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),ce=s(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),le=s(((e,t)=>{var n=se(),r=ce();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),ue=s(((e,t)=>{t.exports=le()(Object,`create`)})),de=s(((e,t)=>{var n=ue();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),fe=s(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),pe=s(((e,t)=>{var n=ue(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),me=s(((e,t)=>{var n=ue(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),he=s(((e,t)=>{var n=ue(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),ge=s(((e,t)=>{var n=de(),r=fe(),i=pe(),a=me(),o=he();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),ve=s(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),ye=s(((e,t)=>{var n=ve();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),be=s(((e,t)=>{var n=ye(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),xe=s(((e,t)=>{var n=ye();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Se=s(((e,t)=>{var n=ye();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Ce=s(((e,t)=>{var n=ye();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),we=s(((e,t)=>{var n=_e(),r=be(),i=xe(),a=Se(),o=Ce();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=le()(A(),`Map`)})),Ee=s(((e,t)=>{var n=ge(),r=we(),i=Te();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),De=s(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),Oe=s(((e,t)=>{var n=De();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ke=s(((e,t)=>{var n=Oe();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),Ae=s(((e,t)=>{var n=Oe();function r(e){return n(this,e).get(e)}t.exports=r})),je=s(((e,t)=>{var n=Oe();function r(e){return n(this,e).has(e)}t.exports=r})),Me=s(((e,t)=>{var n=Oe();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),Ne=s(((e,t)=>{var n=Ee(),r=ke(),i=Ae(),a=je(),o=Me();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=Ne(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),Fe=s(((e,t)=>{var n=Pe(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Ie=s(((e,t)=>{var n=Fe(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Le=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=j(),r=Le(),i=O(),a=ne(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),ze=s(((e,t)=>{var n=Re();function r(e){return e==null?``:n(e)}t.exports=r})),Be=s(((e,t)=>{var n=O(),r=P(),i=Ie(),a=ze();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),Ve=s(((e,t)=>{var n=N(),r=te(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),He=s(((e,t)=>{var n=Ve(),r=te(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),Ue=s(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;function r(e,t){var r=typeof e;return t??=9007199254740991,!!t&&(r==`number`||r!=`symbol`&&n.test(e))&&e>-1&&e%1==0&&e{function n(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}t.exports=n})),Ge=s(((e,t)=>{var n=ne(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Ke=s(((e,t)=>{var n=Be(),r=He(),i=O(),a=Ue(),o=We(),s=Ge();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=D(),r=Ke();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i}));function Je(e){return`width`in e&&typeof e.width==`number`}async function Ye(e){return typeof e==`object`?e:await e()}function Xe(e){return!(e.kind===I.Loading||e.kind===I.Bubble||e.kind===I.RowID||e.kind===I.Protected||e.kind===I.Drilldown)}function Ze(e){return e.kind===at.Marker||e.kind===at.NewRow}function Qe(e){if(!Xe(e)||e.kind===I.Image)return!1;if(e.kind===I.Text||e.kind===I.Number||e.kind===I.Markdown||e.kind===I.Uri||e.kind===I.Custom||e.kind===I.Boolean)return e.readonly!==!0;S(e,`A cell was passed with an invalid kind`)}function $e(e){return(0,nt.default)(e,`editor`)}function et(e){return!(e.readonly??!1)}function tt(e){if(e.length===0)return[];let t=[...e],n=[];t.sort(function(e,t){return e[0]-t[0]}),n.push([...t[0]]);for(let e of t.slice(1)){let t=n[n.length-1];t[1]{E(),nt=u(qe(),1),(function(e){e.Uri=`uri`,e.Text=`text`,e.Image=`image`,e.RowID=`row-id`,e.Number=`number`,e.Bubble=`bubble`,e.Boolean=`boolean`,e.Loading=`loading`,e.Markdown=`markdown`,e.Drilldown=`drilldown`,e.Protected=`protected`,e.Custom=`custom`})(I||={}),(function(e){e.HeaderRowID=`headerRowID`,e.HeaderCode=`headerCode`,e.HeaderNumber=`headerNumber`,e.HeaderString=`headerString`,e.HeaderBoolean=`headerBoolean`,e.HeaderAudioUri=`headerAudioUri`,e.HeaderVideoUri=`headerVideoUri`,e.HeaderEmoji=`headerEmoji`,e.HeaderImage=`headerImage`,e.HeaderUri=`headerUri`,e.HeaderPhone=`headerPhone`,e.HeaderMarkdown=`headerMarkdown`,e.HeaderDate=`headerDate`,e.HeaderTime=`headerTime`,e.HeaderEmail=`headerEmail`,e.HeaderReference=`headerReference`,e.HeaderIfThenElse=`headerIfThenElse`,e.HeaderSingleValue=`headerSingleValue`,e.HeaderLookup=`headerLookup`,e.HeaderTextTemplate=`headerTextTemplate`,e.HeaderMath=`headerMath`,e.HeaderRollup=`headerRollup`,e.HeaderJoinStrings=`headerJoinStrings`,e.HeaderSplitString=`headerSplitString`,e.HeaderGeoDistance=`headerGeoDistance`,e.HeaderArray=`headerArray`,e.RowOwnerOverlay=`rowOwnerOverlay`,e.ProtectedColumnOverlay=`protectedColumnOverlay`})(rt||={}),(function(e){e.Triangle=`triangle`,e.Dots=`dots`})(it||={}),(function(e){e.NewRow=`new-row`,e.Marker=`marker`})(at||={}),st=class e{items;constructor(e){this.items=e}static empty=()=>ot??=new e([]);static fromSingleSelection=t=>e.empty().add(t);offset(t){if(t===0)return this;let n=this.items.map(e=>[e[0]+t,e[1]+t]);return new e(n)}add(t){let n=typeof t==`number`?[t,t+1]:t,r=tt([...this.items,n]);return new e(r)}remove(t){let n=[...this.items],r=typeof t==`number`?t:t[0],i=typeof t==`number`?t+1:t[1];for(let[e,t]of n.entries()){let[a,o]=t;if(a<=i&&r<=o){let t=[];a=n&&e{})),dt,ft,pt=o((()=>{ut(),dt=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|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|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|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|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ft=lt(function(e){return dt.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91})})),mt,ht=o((()=>{mt=function(){let e=Array.prototype.slice.call(arguments).filter(Boolean),t={},n=[];e.forEach(e=>{(e?e.split(` `):[]).forEach(e=>{if(e.startsWith(`atm_`)){let[,n]=e.split(`_`);t[n]=e}else n.push(e)})});let r=[];for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.push(t[e]);return r.push(...n),r.join(` `)}}));function gt(e,t,n){let r=bt(t,n);if(!e){let e=typeof ft==`function`?{default:ft}:ft;Object.keys(r).forEach(t=>{e.default(t)||delete r[t]})}return r}function _t(e){return t=>{let n=(n,r)=>{let{as:i=e,class:a=``}=n,o=gt(t.propsAsIs===void 0?!(typeof i==`string`&&i.indexOf(`-`)===-1&&!vt(i[0])):t.propsAsIs,n,[`as`,`class`]);o.ref=r,o.className=t.atomic?mt(t.class,o.className||a):mt(o.className||a,t.class);let{vars:s}=t;if(s){let e={};for(let r in s){let i=s[r],a=i[0],o=i[1]||``,c=typeof a==`function`?a(n):a;t.name,e[`--${r}`]=`${c}${o}`}let r=o.style||{},i=Object.keys(r);i.length>0&&i.forEach(t=>{e[t]=r[t]}),o.style=e}return e.__linaria&&e!==i?(o.as=i,v.createElement(e,o)):v.createElement(i,o)},r=v.forwardRef?v.forwardRef(n):e=>{let t=bt(e,[`innerRef`]);return n(t,e.innerRef)};return r.displayName=t.name,r.__linaria={className:t.class||``,extends:e},r}}var vt,yt,bt,xt,St=o((()=>{pt(),ht(),vt=e=>e.toUpperCase()===e,yt=e=>t=>e.indexOf(t)===-1,bt=(e,t)=>{let n={};return Object.keys(e).filter(yt(t)).forEach(t=>{n[t]=e[t]}),n},xt=_t}));St();var Ct=xt(`div`)({name:`ImageOverlayEditorStyle`,class:`gdg-i2iowwq`,propsAsIs:!1}),wt=s(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Tt=s(((e,t)=>{var n=wt();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Et=s(((e,t)=>{t.exports=Tt()()})),Dt=s((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`react`,`prop-types`],n);else if(e!==void 0)n(e,f(),Et());else{var r={exports:{}};n(r.exports,t.react,t.propTypes),t.reactSwipe=r.exports}})(e,function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var r=a(t),i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}var o=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var l=function(){function e(e,t){for(var n=0;n0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return f?e:e.capture}function h(e){if(`touches`in e){var t=e.touches[0];return{x:t.pageX,y:t.pageY}}return{x:e.screenX,y:e.screenY}}var g=function(e){d(t,e);function t(){var e;c(this,t);var n=[...arguments],r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(n)));return r._handleSwipeStart=r._handleSwipeStart.bind(r),r._handleSwipeMove=r._handleSwipeMove.bind(r),r._handleSwipeEnd=r._handleSwipeEnd.bind(r),r._onMouseDown=r._onMouseDown.bind(r),r._onMouseMove=r._onMouseMove.bind(r),r._onMouseUp=r._onMouseUp.bind(r),r._setSwiperRef=r._setSwiperRef.bind(r),r}return l(t,[{key:`componentDidMount`,value:function(){this.swiper&&this.swiper.addEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`componentWillUnmount`,value:function(){this.swiper&&this.swiper.removeEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`_onMouseDown`,value:function(e){this.props.allowMouseEvents&&(this.mouseDown=!0,document.addEventListener(`mouseup`,this._onMouseUp),document.addEventListener(`mousemove`,this._onMouseMove),this._handleSwipeStart(e))}},{key:`_onMouseMove`,value:function(e){this.mouseDown&&this._handleSwipeMove(e)}},{key:`_onMouseUp`,value:function(e){this.mouseDown=!1,document.removeEventListener(`mouseup`,this._onMouseUp),document.removeEventListener(`mousemove`,this._onMouseMove),this._handleSwipeEnd(e)}},{key:`_handleSwipeStart`,value:function(e){var t=h(e),n=t.x,r=t.y;this.moveStart={x:n,y:r},this.props.onSwipeStart(e)}},{key:`_handleSwipeMove`,value:function(e){if(this.moveStart){var t=h(e),n=t.x,r=t.y,i=n-this.moveStart.x,a=r-this.moveStart.y;this.moving=!0,this.props.onSwipeMove({x:i,y:a},e)&&e.cancelable&&e.preventDefault(),this.movePosition={deltaX:i,deltaY:a}}}},{key:`_handleSwipeEnd`,value:function(e){this.props.onSwipeEnd(e);var t=this.props.tolerance;this.moving&&this.movePosition&&(this.movePosition.deltaX<-t?this.props.onSwipeLeft(1,e):this.movePosition.deltaX>t&&this.props.onSwipeRight(1,e),this.movePosition.deltaY<-t?this.props.onSwipeUp(1,e):this.movePosition.deltaY>t&&this.props.onSwipeDown(1,e)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:`_setSwiperRef`,value:function(e){this.swiper=e,this.props.innerRef(e)}},{key:`render`,value:function(){var e=this.props;e.tagName;var t=e.className,n=e.style,i=e.children;e.allowMouseEvents,e.onSwipeUp,e.onSwipeDown,e.onSwipeLeft,e.onSwipeRight,e.onSwipeStart,e.onSwipeMove,e.onSwipeEnd,e.innerRef,e.tolerance;var a=s(e,[`tagName`,`className`,`style`,`children`,`allowMouseEvents`,`onSwipeUp`,`onSwipeDown`,`onSwipeLeft`,`onSwipeRight`,`onSwipeStart`,`onSwipeMove`,`onSwipeEnd`,`innerRef`,`tolerance`]);return r.default.createElement(this.props.tagName,o({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:t,style:n},a),i)}}]),t}(t.Component);g.displayName=`ReactSwipe`,g.propTypes={tagName:i.default.string,className:i.default.string,style:i.default.object,children:i.default.node,allowMouseEvents:i.default.bool,onSwipeUp:i.default.func,onSwipeDown:i.default.func,onSwipeLeft:i.default.func,onSwipeRight:i.default.func,onSwipeStart:i.default.func,onSwipeMove:i.default.func,onSwipeEnd:i.default.func,innerRef:i.default.func,tolerance:i.default.number.isRequired},g.defaultProps={tagName:`div`,allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=g})})),Ot=s((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`./react-swipe`],n);else if(e!==void 0)n(e,Dt());else{var r={exports:{}};n(r.exports,t.reactSwipe),t.index=r.exports}})(e,function(e,t){Object.defineProperty(e,"__esModule",{value:!0});var n=r(t);function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default})})),kt=s(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(kt());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.default={ROOT:function(e){return(0,t.default)(r({"carousel-root":!0},e||``,!!e))},CAROUSEL:function(e){return(0,t.default)({carousel:!0,"carousel-slider":e})},WRAPPER:function(e,n){return(0,t.default)({"thumbs-wrapper":!e,"slider-wrapper":e,"axis-horizontal":n===`horizontal`,"axis-vertical":n!==`horizontal`})},SLIDER:function(e,n){return(0,t.default)({thumbs:!e,slider:e,animated:!n})},ITEM:function(e,n,r){return(0,t.default)({thumb:!e,slide:e,selected:n,previous:r})},ARROW_PREV:function(e){return(0,t.default)({"control-arrow control-prev":!0,"control-disabled":e})},ARROW_NEXT:function(e){return(0,t.default)({"control-arrow control-next":!0,"control-disabled":e})},DOT:function(e){return(0,t.default)({dot:!0,selected:e})}}})),jt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.outerWidth=void 0,e.outerWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft)+parseInt(n.marginRight),t}})),Mt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(e,t,n){var r=e===0?e:e+t;return`translate3d`+(`(`+(n===`horizontal`?[r,0,0]:[0,r,0]).join(`,`)+`)`)}})),Nt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return window}})),Pt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=l(f()),n=s(At()),r=jt(),i=s(Mt()),a=s(Ot()),o=s(Nt());function s(e){return e&&e.__esModule?e:{default:e}}function c(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return c=function(){return e},e}function l(e){if(e&&e.__esModule)return e;if(e===null||u(e)!==`object`&&typeof e!=`function`)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function u(e){"@babel/helpers - typeof";return u=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},u(e)}function d(){return d=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){return e.hasOwnProperty(`key`)},T=function(e){g(c,e);var s=v(c);function c(e){var n;return p(this,c),n=s.call(this,e),C(b(n),`itemsWrapperRef`,void 0),C(b(n),`itemsListRef`,void 0),C(b(n),`thumbsRef`,void 0),C(b(n),`setItemsWrapperRef`,function(e){n.itemsWrapperRef=e}),C(b(n),`setItemsListRef`,function(e){n.itemsListRef=e}),C(b(n),`setThumbsRef`,function(e,t){n.thumbsRef||=[],n.thumbsRef[t]=e}),C(b(n),`updateSizes`,function(){if(!(!n.props.children||!n.itemsWrapperRef||!n.thumbsRef)){var e=t.Children.count(n.props.children),i=n.itemsWrapperRef.clientWidth,a=n.props.thumbWidth?n.props.thumbWidth:(0,r.outerWidth)(n.thumbsRef[0]),o=Math.floor(i/a),s=o0&&(r=0),s===c&&r<0&&(r=0);var l=s+100/(n.itemsWrapperRef.clientWidth/r);return n.itemsListRef&&[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(e){n.itemsListRef.style[e]=(0,i.default)(l,`%`,n.props.axis)}),!0}),C(b(n),`slideRight`,function(e){n.moveTo(n.state.firstItem-(typeof e==`number`?e:1))}),C(b(n),`slideLeft`,function(e){n.moveTo(n.state.firstItem+(typeof e==`number`?e:1))}),C(b(n),`moveTo`,function(e){e=e<0?0:e,e=e>=n.state.lastPosition?n.state.lastPosition:e,n.setState({firstItem:e})}),n.state={selectedItem:e.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},n}return h(c,[{key:`componentDidMount`,value:function(){this.setupThumbs()}},{key:`componentDidUpdate`,value:function(e){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==e.children&&this.updateSizes()}},{key:`componentWillUnmount`,value:function(){this.destroyThumbs()}},{key:`setupThumbs`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.updateSizes()}},{key:`destroyThumbs`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes)}},{key:`getFirstItem`,value:function(e){var t=e;return e>=this.state.lastPosition&&(t=this.state.lastPosition),e1,o=this.state.showArrows&&this.state.firstItem>0,s=this.state.showArrows&&this.state.firstItem{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return document}})),It=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setPosition=e.getPosition=e.isKeyboardEvent=e.defaultStatusFormatter=e.noop=void 0;var t=f(),n=r(Mt());function r(e){return e&&e.__esModule?e:{default:e}}e.noop=function(){},e.defaultStatusFormatter=function(e,t){return`${e} of ${t}`},e.isKeyboardEvent=function(e){return e?e.hasOwnProperty(`key`):!1},e.getPosition=function(e,n){if(n.infiniteLoop&&++e,e===0)return 0;var r=t.Children.count(n.children);if(n.centerMode&&n.axis===`horizontal`){var i=-e*n.centerSlidePercentage,a=r-1;return e&&(e!==a||n.infiniteLoop)?i+=(100-n.centerSlidePercentage)/2:e===a&&(i+=100-n.centerSlidePercentage),i}return-e*100},e.setPosition=function(e,t){var r={};return[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(i){r[i]=(0,n.default)(e,`%`,t)}),r}})),Lt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fadeAnimationHandler=e.slideStopSwipingHandler=e.slideSwipeAnimationHandler=e.slideAnimationHandler=void 0;var t=f(),n=i(Mt()),r=It();function i(e){return e&&e.__esModule?e:{default:e}}function a(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 o(e){for(var t=1;tl))return c<0?e.centerMode&&e.centerSlidePercentage&&e.axis===`horizontal`?a.itemListStyle=(0,r.setPosition)(-(l+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):a.itemListStyle=(0,r.setPosition)(-(l+2)*100,e.axis):c>l&&(a.itemListStyle=(0,r.setPosition)(0,e.axis)),a;var u=(0,r.getPosition)(s,e),d=(0,n.default)(u,`%`,e.axis),f=e.transitionTime+`ms`;return a.itemListStyle={WebkitTransform:d,msTransform:d,OTransform:d,transform:d},i.swiping||(a.itemListStyle=o(o({},a.itemListStyle),{},{WebkitTransitionDuration:f,MozTransitionDuration:f,OTransitionDuration:f,transitionDuration:f,msTransitionDuration:f})),a},e.slideSwipeAnimationHandler=function(e,n,i,a){var o={},s=n.axis===`horizontal`,c=t.Children.count(n.children),l=0,u=(0,r.getPosition)(i.selectedItem,n),d=n.infiniteLoop?(0,r.getPosition)(c-1,n)-100:(0,r.getPosition)(c-1,n),f=s?e.x:e.y,p=f;u===l&&f>0&&(p=0),u===d&&f<0&&(p=0);var m=u+100/(i.itemSize/p),h=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&h&&(i.selectedItem===0&&m>-100?m-=c*100:i.selectedItem===c-1&&m<-c*100&&(m+=c*100)),(!n.preventMovementUntilSwipeScrollTolerance||h||i.swipeMovementStarted)&&(i.swipeMovementStarted||a({swipeMovementStarted:!0}),o.itemListStyle=(0,r.setPosition)(m,n.axis)),h&&!i.cancelClick&&a({cancelClick:!0}),o},e.slideStopSwipingHandler=function(e,t){var n=(0,r.getPosition)(t.selectedItem,e);return{itemListStyle:(0,r.setPosition)(n,e.axis)}},e.fadeAnimationHandler=function(e,t){var n=e.transitionTime+`ms`,r=`ease-in-out`,i={position:`absolute`,display:`block`,zIndex:-2,minHeight:`100%`,opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:r,msTransitionTimingFunction:r,MozTransitionTimingFunction:r,WebkitTransitionTimingFunction:r,OTransitionTimingFunction:r};return t.swiping||(i=o(o({},i),{},{WebkitTransitionDuration:n,MozTransitionDuration:n,OTransitionDuration:n,transitionDuration:n,msTransitionDuration:n})),{slideStyle:i,selectedStyle:o(o({},i),{},{opacity:1,position:`relative`}),prevStyle:o({},i)}}})),Rt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=d(f()),n=l(Ot()),r=l(At()),i=l(Pt()),a=l(Ft()),o=l(Nt()),s=It(),c=Lt();function l(e){return e&&e.__esModule?e:{default:e}}function u(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return u=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(e===null||p(e)!==`object`&&typeof e!=`function`)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function p(e){"@babel/helpers - typeof";return p=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p(e)}function m(){return m=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=function(e){b(u,e);var l=S(u);function u(e){var n;_(this,u),n=l.call(this,e),D(w(n),`thumbsRef`,void 0),D(w(n),`carouselWrapperRef`,void 0),D(w(n),`listRef`,void 0),D(w(n),`itemsRef`,void 0),D(w(n),`timer`,void 0),D(w(n),`animationHandler`,void 0),D(w(n),`setThumbsRef`,function(e){n.thumbsRef=e}),D(w(n),`setCarouselWrapperRef`,function(e){n.carouselWrapperRef=e}),D(w(n),`setListRef`,function(e){n.listRef=e}),D(w(n),`setItemsRef`,function(e,t){n.itemsRef||=[],n.itemsRef[t]=e}),D(w(n),`autoPlay`,function(){t.Children.count(n.props.children)<=1||(n.clearAutoPlay(),n.props.autoPlay&&(n.timer=setTimeout(function(){n.increment()},n.props.interval)))}),D(w(n),`clearAutoPlay`,function(){n.timer&&clearTimeout(n.timer)}),D(w(n),`resetAutoPlay`,function(){n.clearAutoPlay(),n.autoPlay()}),D(w(n),`stopOnHover`,function(){n.setState({isMouseEntered:!0},n.clearAutoPlay)}),D(w(n),`startOnLeave`,function(){n.setState({isMouseEntered:!1},n.autoPlay)}),D(w(n),`isFocusWithinTheCarousel`,function(){return n.carouselWrapperRef?!!((0,a.default)().activeElement===n.carouselWrapperRef||n.carouselWrapperRef.contains((0,a.default)().activeElement)):!1}),D(w(n),`navigateWithKeyboard`,function(e){if(n.isFocusWithinTheCarousel()){var t=n.props.axis===`horizontal`,r={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},i=t?r.ArrowRight:r.ArrowDown,a=t?r.ArrowLeft:r.ArrowUp;i===e.keyCode?n.increment():a===e.keyCode&&n.decrement()}}),D(w(n),`updateSizes`,function(){if(!(!n.state.initialized||!n.itemsRef||n.itemsRef.length===0)){var e=n.props.axis===`horizontal`,t=n.itemsRef[0];if(t){var r=e?t.clientWidth:t.clientHeight;n.setState({itemSize:r}),n.thumbsRef&&n.thumbsRef.updateSizes()}}}),D(w(n),`setMountState`,function(){n.setState({hasMount:!0}),n.updateSizes()}),D(w(n),`handleClickItem`,function(e,r){if(t.Children.count(n.props.children)!==0){if(n.state.cancelClick){n.setState({cancelClick:!1});return}n.props.onClickItem(e,r),e!==n.state.selectedItem&&n.setState({selectedItem:e})}}),D(w(n),`handleOnChange`,function(e,r){t.Children.count(n.props.children)<=1||n.props.onChange(e,r)}),D(w(n),`handleClickThumb`,function(e,t){n.props.onClickThumb(e,t),n.moveTo(e)}),D(w(n),`onSwipeStart`,function(e){n.setState({swiping:!0}),n.props.onSwipeStart(e)}),D(w(n),`onSwipeEnd`,function(e){n.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),n.props.onSwipeEnd(e),n.clearAutoPlay(),n.state.autoPlay&&n.autoPlay()}),D(w(n),`onSwipeMove`,function(e,t){n.props.onSwipeMove(t);var r=n.props.swipeAnimationHandler(e,n.props,n.state,n.setState.bind(w(n)));return n.setState(g({},r)),!!Object.keys(r).length}),D(w(n),`decrement`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem-(typeof e==`number`?e:1))}),D(w(n),`increment`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem+(typeof e==`number`?e:1))}),D(w(n),`moveTo`,function(e){if(typeof e==`number`){var r=t.Children.count(n.props.children)-1;e<0&&(e=n.props.infiniteLoop?r:0),e>r&&(e=n.props.infiniteLoop?0:r),n.selectItem({selectedItem:e}),n.state.autoPlay&&n.state.isMouseEntered===!1&&n.resetAutoPlay()}}),D(w(n),`onClickNext`,function(){n.increment(1)}),D(w(n),`onClickPrev`,function(){n.decrement(1)}),D(w(n),`onSwipeForward`,function(){n.increment(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`onSwipeBackwards`,function(){n.decrement(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`changeItem`,function(e){return function(t){(!(0,s.isKeyboardEvent)(t)||t.key===`Enter`)&&n.moveTo(e)}}),D(w(n),`selectItem`,function(e){n.setState(g({previousItem:n.state.selectedItem},e),function(){n.setState(n.animationHandler(n.props,n.state))}),n.handleOnChange(e.selectedItem,t.Children.toArray(n.props.children)[e.selectedItem])}),D(w(n),`getInitialImage`,function(){var e=n.props.selectedItem,t=n.itemsRef&&n.itemsRef[e];return(t&&t.getElementsByTagName(`img`)||[])[0]}),D(w(n),`getVariableItemHeight`,function(e){var t=n.itemsRef&&n.itemsRef[e];if(n.state.hasMount&&t&&t.children.length){var r=t.children[0].getElementsByTagName(`img`)||[];if(r.length>0){var i=r[0];i.complete||i.addEventListener(`load`,function e(){n.forceUpdate(),i.removeEventListener(`load`,e)})}var a=(r[0]||t.children[0]).clientHeight;return a>0?a:null}return null});var r={initialized:!1,previousItem:e.selectedItem,selectedItem:e.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:e.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return n.animationHandler=typeof e.animationHandler==`function`&&e.animationHandler||e.animationHandler===`fade`&&c.fadeAnimationHandler||c.slideAnimationHandler,n.state=g(g({},r),n.animationHandler(e,r)),n}return y(u,[{key:`componentDidMount`,value:function(){this.props.children&&this.setupCarousel()}},{key:`componentDidUpdate`,value:function(e,t){!e.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!e.autoFocus&&this.props.autoFocus&&this.forceFocus(),t.swiping&&!this.state.swiping&&this.setState(g({},this.props.stopSwipingHandler(this.props,this.state))),(e.selectedItem!==this.props.selectedItem||e.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),e.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:`componentWillUnmount`,value:function(){this.destroyCarousel()}},{key:`setupCarousel`,value:function(){var e=this;this.bindEvents(),this.state.autoPlay&&t.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var t=e.getInitialImage();t&&!t.complete?t.addEventListener(`load`,e.setMountState):e.setMountState()})}},{key:`destroyCarousel`,value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:`setupAutoPlay`,value:function(){this.autoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.addEventListener(`mouseenter`,this.stopOnHover),e.addEventListener(`mouseleave`,this.startOnLeave))}},{key:`destroyAutoPlay`,value:function(){this.clearAutoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.removeEventListener(`mouseenter`,this.stopOnHover),e.removeEventListener(`mouseleave`,this.startOnLeave))}},{key:`bindEvents`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.props.useKeyboardArrows&&(0,a.default)().addEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`unbindEvents`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes);var e=this.getInitialImage();e&&e.removeEventListener(`load`,this.setMountState),this.props.useKeyboardArrows&&(0,a.default)().removeEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`forceFocus`,value:function(){var e;(e=this.carouselWrapperRef)==null||e.focus()}},{key:`renderItems`,value:function(e){var n=this;return this.props.children?t.Children.map(this.props.children,function(i,a){var o=a===n.state.selectedItem,s=a===n.state.previousItem,c=o&&n.state.selectedStyle||s&&n.state.prevStyle||n.state.slideStyle||{};n.props.centerMode&&n.props.axis===`horizontal`&&(c=g(g({},c),{},{minWidth:n.props.centerSlidePercentage+`%`})),n.state.swiping&&n.state.swipeMovementStarted&&(c=g(g({},c),{},{pointerEvents:`none`}));var l={ref:function(e){return n.setItemsRef(e,a)},key:`itemKey`+a+(e?`clone`:``),className:r.default.ITEM(!0,a===n.state.selectedItem,a===n.state.previousItem),onClick:n.handleClickItem.bind(n,a,i),style:c};return t.default.createElement(`li`,l,n.props.renderItem(i,{isSelected:a===n.state.selectedItem,isPrevious:a===n.state.previousItem}))}):[]}},{key:`renderControls`,value:function(){var e=this,n=this.props,r=n.showIndicators,i=n.labels,a=n.renderIndicator,o=n.children;return r?t.default.createElement(`ul`,{className:`control-dots`},t.Children.map(o,function(t,n){return a&&a(e.changeItem(n),n===e.state.selectedItem,n,i.item)})):null}},{key:`renderStatus`,value:function(){return this.props.showStatus?t.default.createElement(`p`,{className:`carousel-status`},this.props.statusFormatter(this.state.selectedItem+1,t.Children.count(this.props.children))):null}},{key:`renderThumbs`,value:function(){return!this.props.showThumbs||!this.props.children||t.Children.count(this.props.children)===0?null:t.default.createElement(i.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:`render`,value:function(){var e=this;if(!this.props.children||t.Children.count(this.props.children)===0)return null;var i=this.props.swipeable&&t.Children.count(this.props.children)>1,a=this.props.axis===`horizontal`,o=this.props.showArrows&&t.Children.count(this.props.children)>1,s=o&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,c=o&&(this.state.selectedItem{})),Bt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Carousel",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"CarouselProps",{enumerable:!0,get:function(){return n.CarouselProps}}),Object.defineProperty(e,"Thumbs",{enumerable:!0,get:function(){return r.default}});var t=i(Rt()),n=zt(),r=i(Pt());function i(e){return e&&e.__esModule?e:{default:e}}})),Vt=s(((e,t)=>{var n=A();t.exports=function(){return n.Date.now()}})),Ht=s(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),Ut=s(((e,t)=>{var n=Ht(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),Wt=s(((e,t)=>{var n=Ut(),r=re(),i=ne(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),Gt=s(((e,t)=>{var n=re(),r=Vt(),i=Wt(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),L=u(f(),1),Kt=u(Gt(),1);E();function qt(e,t,n,r,i=!1){let a=L.useRef();a.current=t,L.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;let t=n,o=e=>{a.current?.call(t,e)};return t.addEventListener(e,o,{passive:r,capture:i}),()=>{t.removeEventListener(e,o,{capture:i})}},[e,n,r,i])}function Jt(e,t){return e===void 0?void 0:t}var Yt=Math.PI;function Xt(e){return e*Yt/180}var Zt=(e,t,n)=>({x1:e-n/2,y1:t-n/2,x2:e+n/2,y2:t+n/2}),Qt=(e,t,n,r,i)=>{switch(e){case`left`:return Math.floor(t)+r+i/2;case`center`:return Math.floor(t+n/2);case`right`:return Math.floor(t+n)-r-i/2}},$t=(e,t,n)=>Math.min(e,t-n*2),en=(e,t,n)=>n.x1<=e&&e<=n.x2&&n.y1<=t&&t<=n.y2,tn=e=>{let t=e.fgColor??`currentColor`;return L.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}),L.createElement(`path`,{d:`M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}))},nn=e=>{let t=e.fgColor??`currentColor`;return L.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M19 6L10.3802 17L5.34071 11.8758`,vectorEffect:`non-scaling-stroke`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}))};function rn(e,t,n){let[r,i]=L.useState(e),a=L.useRef(!0);L.useEffect(()=>()=>{a.current=!1},[]);let o=L.useRef((0,Kt.default)(e=>{a.current&&i(e)},n));return L.useLayoutEffect(()=>{a.current&&o.current(()=>e())},t),r}var an=RegExp(`^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]`);function R(e){return an.test(e)?`rtl`:`not-rtl`}var on=void 0;function sn(){if(typeof document>`u`)return 0;if(on!==void 0)return on;let e=document.createElement(`p`);e.style.width=`100%`,e.style.height=`200px`;let t=document.createElement(`div`);t.id=`testScrollbar`,t.style.position=`absolute`,t.style.top=`0px`,t.style.left=`0px`,t.style.visibility=`hidden`,t.style.width=`200px`,t.style.height=`150px`,t.style.overflow=`hidden`,t.append(e),document.body.append(t);let n=e.offsetWidth;t.style.overflow=`scroll`;let r=e.offsetWidth;return n===r&&(r=t.clientWidth),t.remove(),on=n-r,on}var cn=Symbol();function ln(e){let t=L.useRef([cn,e]);t.current[1]!==e&&(t.current[0]=e),t.current[1]=e;let[n,r]=L.useState(e),[,i]=L.useState(),a=L.useCallback(e=>{let n=t.current[0];n!==cn&&(e=typeof e==`function`?e(n):e,e===n)||(n!==cn&&i({}),r(t=>typeof e==`function`?e(n===cn?t:n):e),t.current[0]=cn)},[]),o=L.useCallback(()=>{t.current[0]=cn,i({})},[]);return[t.current[0]===cn?n:t.current[0],a,o]}function un(e){if(e.length===0)return``;let t=0,n=0;for(let r of e){if(n+=r.length,n>1e4)break;t++}return e.slice(0,t).join(`, `)}function dn(e){let t=L.useRef(e);return w(e,t.current)||(t.current=e),t.current}var fn=Bt(),pn=e=>{let{urls:t,canWrite:n,onEditClick:r,renderImage:i}=e,a=t.filter(e=>e!==``);if(a.length===0)return null;let o=a.length>1;return L.createElement(Ct,{"data-testid":`GDG-default-image-overlay-editor`},L.createElement(fn.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},a.map(e=>{let t=i?.(e)??L.createElement(`img`,{draggable:!1,src:e});return L.createElement(`div`,{className:`gdg-centering-container`,key:e},t)})),n&&r&&L.createElement(`button`,{className:`gdg-edit-icon`,onClick:r},L.createElement(tn,null)))};function z(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:``,highlight:null,hooks:null,langPrefix:`language-`,mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}var mn=z();function hn(e){mn=e}var gn=/[&<>"']/,_n=new RegExp(gn.source,`g`),vn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,yn=new RegExp(vn.source,`g`),bn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},xn=e=>bn[e];function Sn(e,t){if(t){if(gn.test(e))return e.replace(_n,xn)}else if(vn.test(e))return e.replace(yn,xn);return e}var Cn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function wn(e){return e.replace(Cn,(e,t)=>(t=t.toLowerCase(),t===`colon`?`:`:t.charAt(0)===`#`?t.charAt(1)===`x`?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):``))}var Tn=/(^|[^\[])\^/g;function En(e,t){e=typeof e==`string`?e:e.source,t||=``;let n={replace:(t,r)=>(r=r.source||r,r=r.replace(Tn,`$1`),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}var Dn=/[^\w:]/g,On=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function kn(e,t,n){if(e){let e;try{e=decodeURIComponent(wn(n)).replace(Dn,``).toLowerCase()}catch{return null}if(e.indexOf(`javascript:`)===0||e.indexOf(`vbscript:`)===0||e.indexOf(`data:`)===0)return null}t&&!On.test(n)&&(n=Pn(t,n));try{n=encodeURI(n).replace(/%25/g,`%`)}catch{return null}return n}var An={},jn=/^[^:]+:\/*[^/]*$/,Mn=/^([^:]+:)[\s\S]*$/,Nn=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Pn(e,t){An[` `+e]||(jn.test(e)?An[` `+e]=e+`/`:An[` `+e]=Ln(e,`/`,!0)),e=An[` `+e];let n=e.indexOf(`:`)===-1;return t.substring(0,2)===`//`?n?t:e.replace(Mn,`$1`)+t:t.charAt(0)===`/`?n?t:e.replace(Nn,`$1`)+t:e+t}var Fn={exec:function(){}};function In(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length1;)t&1&&(n+=e),t>>=1,e+=e;return n+e}function Vn(e,t,n,r){let i=t.href,a=t.title?Sn(t.title):null,o=e[1].replace(/\\([\[\]])/g,`$1`);if(e[0].charAt(0)!==`!`){r.state.inLink=!0;let e={type:`link`,raw:n,href:i,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:`image`,raw:n,href:i,title:a,text:Sn(o)}}function Hn(e,t){let n=e.match(/^(\s+)(?:```)/);if(n===null)return t;let r=n[1];return t.split(` `).map(e=>{let t=e.match(/^\s+/);if(t===null)return e;let[n]=t;return n.length>=r.length?e.slice(r.length):e}).join(` `)}var Un=class{constructor(e){this.options=e||mn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(/^ {1,4}/gm,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Ln(e,` `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Hn(e,t[3]||``);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){let t=Ln(e,`#`);(this.options.pedantic||!t||/ $/.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/^ *>[ \t]?/gm,``),n=this.lexer.state.top;this.lexer.state.top=!0;let r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:`blockquote`,raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,r,i,a,o,s,c,l,u,d,f,p,m=t[1].trim(),h=m.length>1,g={type:`list`,raw:``,ordered:h,start:h?+m.slice(0,-1):``,loose:!1,items:[]};m=h?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=h?m:`[*+-]`);let _=RegExp(`^( {0,3}${m})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(t=_.exec(e))||this.rules.block.hr.test(e)));){if(n=t[0],e=e.substring(n.length),l=t[2].split(` @@ -165,17 +165,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`

An error -`}};function fa(e,t){return e===`normal`?[t.bgIconHeader,t.fgIconHeader]:e===`selected`?[`white`,t.accentColor]:[t.accentColor,t.bgHeader]}var pa=class{onSettled;spriteMap=new Map;headerIcons;inFlight=0;constructor(e,t){this.onSettled=t,this.headerIcons=e??{}}drawSprite(e,t,n,r,i,a,o,s=1){let[c,l]=fa(t,o),u=a*Math.ceil(window.devicePixelRatio),d=`${c}_${l}_${u}_${e}`,f=this.spriteMap.get(d);if(f===void 0){let t=this.headerIcons[e];if(t===void 0)return;f=document.createElement(`canvas`);let n=f.getContext(`2d`);if(n===null)return;let r=new Image;r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t({fgColor:l,bgColor:c}))}`,this.spriteMap.set(d,f);let i=r.decode();if(i===void 0)return;this.inFlight++,i.then(()=>{n.drawImage(r,0,0,u,u)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else s<1&&(n.globalAlpha=s),n.drawImage(f,0,0,u,u,r,i,a,a),s<1&&(n.globalAlpha=1)}};function ma(e){if(e.length===0)return;let t;for(let n of e)t=Math.min(t??n.y,n.y)}function ha(e,t,n,r,i,a,o,s,c){s??=t;let l=t,u=e,d=r-a,f=!1;for(;ls&&c(l,u,e,!1,o&&u===r-1)===!0){f=!0;break}l+=e,u++}if(!f){l=n;for(let e=0;e!e.sticky)?.sourceIndex??0;if(c>d){let e=Math.max(s,d),l=t,f=r;for(let t=a.sourceIndex-1;t>=e;t--)l-=o[t].width,f+=o[t].width;for(let e=a.sourceIndex+1;e<=c;e++)f+=o[e].width;u={x:l,y:n,width:f,height:i}}if(d>s){let e=Math.min(c,d-1),u=t,f=r;for(let e=a.sourceIndex-1;e>=s;e--)u-=o[e].width,f+=o[e].width;for(let t=a.sourceIndex+1;t<=e;t++)f+=o[t].width;l={x:u,y:n,width:f,height:i}}return[l,u]}function ya(e,t,n,r){if(r===`any`)return Sa(e,{x:t,y:n,width:1,height:1});if(r===`vertical`&&(t=e.x),r===`horizontal`&&(n=e.y),Mr([t,n],e))return;let i=t-e.x,a=e.x+e.width-t,o=n-e.y+1,s=e.y+e.height-n,c=Math.min(r===`vertical`?2**53-1:i,r===`vertical`?2**53-1:a,r===`horizontal`?2**53-1:o,r===`horizontal`?2**53-1:s);return c===s?{x:e.x,y:e.y+e.height,width:e.width,height:n-e.y-e.height+1}:c===o?{x:e.x,y:n,width:e.width,height:e.y-n}:c===a?{x:e.x+e.width,y:e.y,width:t-e.x-e.width+1,height:e.height}:{x:t,y:e.y,width:e.x-t,height:e.height}}function ba(e,t,n,r,i,a,o,s){return e<=i+o&&i<=e+n&&t<=a+s&&a<=t+r}function xa(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Sa(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function Ca(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function wa(e,t,n,r){if(e.x>t||e.y>n||e.x<0&&e.y<0&&e.x+e.width>t&&e.y+e.height>n)return;if(e.x>=0&&e.y>=0&&e.x+e.width<=t&&e.y+e.height<=n)return e;let i=t+4,a=n+4,o=-4-e.x,s=e.x+e.width-i,c=-4-e.y,l=e.y+e.height-a,u=o>0?e.x+Math.floor(o/r)*r:e.x,d=s>0?e.x+e.width-Math.floor(s/r)*r:e.x+e.width,f=c>0?e.y+Math.floor(c/r)*r:e.y,p=l>0?e.y+e.height-Math.floor(l/r)*r:e.y+e.height;return{x:u,y:f,width:d-u,height:p-f}}function Ta(e,t,n,r,i){let[a,o,s,c]=t,[l,u,d,f]=i,{x:p,y:m,width:h,height:g}=e,_=[];if(h<=0||g<=0)return _;let v=p+h,y=m+g,b=ps,C=m+g>c,w=p>=a&&pa&&v<=s||ps,T=m>=o&&mo&&y<=c||mc;if(w&&T){let e=Math.max(p,a),t=Math.max(m,o),n=Math.min(v,s),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:u,width:d-l+1,height:f-u+1}})}if(b&&x){let e=p,t=m,n=Math.min(v,a),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:0,width:l+1,height:u+1}})}if(x&&w){let e=Math.max(p,a),t=m,n=Math.min(v,s),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:0,width:d-l+1,height:u+1}})}if(x&&S){let e=Math.max(p,s),t=m,r=v,i=Math.min(y,o);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:0,width:n-d+1,height:u+1}})}if(b&&T){let e=p,t=Math.max(m,o),n=Math.min(v,a),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:u,width:l+1,height:f-u+1}})}if(S&&T){let e=Math.max(p,s),t=Math.max(m,o),r=v,i=Math.min(y,c);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:u,width:n-d+1,height:f-u+1}})}if(b&&C){let e=p,t=Math.max(m,c),n=Math.min(v,a),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:0,y:f,width:l+1,height:r-f+1}})}if(C&&w){let e=Math.max(p,a),t=Math.max(m,c),n=Math.min(v,s),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:l,y:f,width:d-l+1,height:r-f+1}})}if(S&&C){let e=Math.max(p,s),t=Math.max(m,c),i=v,a=y;_.push({rect:{x:e,y:t,width:i-e,height:a-t},clip:{x:d,y:f,width:n-d+1,height:r-f+1}})}return _}ct(),Ti(),vr();var Ea={kind:I.Loading,allowOverlay:!1};function Da(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,ee,N){let te=y?.size??2**53-1,ne=performance.now(),P=k.baseFontFull;e.font=P;let re={ctx:e},F=[0,0],ie=g>0?zr(c,g,l):0,ae,oe,se=ma(v);return ga(t,s,a,o,i,(t,a,o,s,ce)=>{let le=Math.max(0,s-a),ue=a+le,de=i+1,fe=t.width-le,pe=r-i-1;if(v.length>0){let e=!1;for(let t=0;t{e.save(),e.beginPath(),e.rect(ue,de,fe,pe),e.clip()},he=b.columns.hasIndex(t.sourceIndex),ge=d(t.group??``).overrideTheme,_e=t.themeOverride===void 0&&ge===void 0?k:xi(k,ge,t.themeOverride),ve=_e.baseFontFull;ve!==P&&(P=ve,e.font=ve),me();let ye;return ha(ce,o,r,c,l,g,_,se,(i,o,l,d,g)=>{if(o<0||(F[0]=t.sourceIndex,F[1]=o,y!==void 0&&!y.has(F)))return;if(v.length>0){let e=!1;for(let n=0;nce.span!==void 0&&e>=ce.span[0]&&e<=ce.span[1]);xe&&!m&&h?Se=0:xe&&h&&(Se=Math.max(Se,1)),Ce&&Se++,xe||(_&&Se++,he&&!g&&Se++);let we=ce.kind===I.Protected?be.bgCellMedium:be.bgCell,Te;if((d||we!==k.bgCell)&&(Te=mr(we,Te)),Se>0||se){se&&(Te=mr(be.bgHeader,Te));for(let e=0;eN&&!fe){let n=be.baseFontFull;n!==P&&(e.font=n,P=n),ye=Na(e,ce,t.sourceIndex,o,De,Oe,le,i,ue,l,Se>0,be,Te??be.bgCell,C,w,ke?.hoverAmount??0,E,O,ne,D,ye,A,j,M,ee)}return Ee&&e.restore(),ce.style===`faded`&&(e.globalAlpha=1),te--,de&&(e.restore(),ye?.deprep?.(re),ye=void 0,me(),P=ve,e.font=ve),te<=0}),e.restore(),te<=0}),ae}var Oa=[0,0],ka={x:0,y:0,width:0,height:0},Aa=[void 0,()=>void 0],ja=!1;function Ma(){ja=!0}function Na(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w){let T,E;g!==void 0&&g[0][0]===n&&g[0][1]===r&&(T=g[1][0],E=g[1][1]);let D;Oa[0]=n,Oa[1]=r,ka.x=o,ka.y=s,ka.width=c,ka.height=l,Aa[0]=S.getValue(Oa),Aa[1]=e=>S.setValue(Oa,e),ja=!1;let O={ctx:e,theme:d,col:n,row:r,cell:t,rect:ka,highlighted:u,cellFillColor:f,hoverAmount:h,frameTime:v,hoverX:T,drawState:Aa,hoverY:E,imageLoader:p,spriteManager:m,hyperWrapping:_,overrideCursor:T===void 0?void 0:w,requestAnimationFrame:Ma},k=ei(O,t.lastUpdated,v,b,i,a),A=C(t);if(A!==void 0){b?.renderer!==A&&(b?.deprep?.(O),b=void 0);let e=A.drawPrep?.(O,b);y!==void 0&&!Ze(O.cell)?y(O,()=>A.draw(O,t)):A.draw(O,t),D=e===void 0?void 0:{deprep:e?.deprep,fillStyle:e?.fillStyle,font:e?.font,renderer:A}}return(k||ja)&&x?.(Oa),D}E(),ct();function Pa(e,t,n,r,i,a,o,s,c=-20,l=-20,u=32,d=`center`,f=`square`){let p=Math.floor(i+o/2),m=f===`circle`?1e4:t.roundingRadius??4,h=$t(u,o,t.cellVerticalPadding),g=h/2,_=Qt(d,r,a,t.cellHorizontalPadding,h),v=Zt(_,p,h),y=en(r+c,i+l,v);switch(n){case!0:e.beginPath(),si(e,_-h/2,p-h/2,h,h,m),f===`circle`&&(g*=.8,h*=.8),e.fillStyle=s?t.accentColor:t.textMedium,e.fill(),e.beginPath(),e.moveTo(_-g+h/4.23,p-g+h/1.97),e.lineTo(_-g+h/2.42,p-g+h/1.44),e.lineTo(_-g+h/1.29,p-g+h/3.25),e.strokeStyle=t.bgCell,e.lineJoin=`round`,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;case null:case!1:e.beginPath(),si(e,_-h/2+.5,p-h/2+.5,h-1,h-1,m),e.lineWidth=1,e.strokeStyle=y?t.textDark:t.textMedium,e.stroke();break;case void 0:e.beginPath(),si(e,_-h/2,p-h/2,h,h,m),e.fillStyle=y?t.textMedium:t.textLight,e.fill(),f===`circle`&&(g*=.8,h*=.8),e.beginPath(),e.moveTo(_-h/3,p),e.lineTo(_+h/3,p),e.strokeStyle=t.bgCell,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;default:S(n)}}Ti(),vr(),ct();function Fa(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=o+s;if(y<=0)return;e.fillStyle=d.bgHeader,e.fillRect(0,0,i,y);let[b,x]=r?.[0]??[];e.font=d.headerFontFull,ga(t,0,a,0,y,(t,r,i,a)=>{if(g!==void 0&&!g.has([t.sourceIndex,-1]))return;let m=Math.max(0,a-r);e.save(),e.beginPath(),e.rect(r+m,s,t.width-m,o),e.clip();let y=h(t.group??``).overrideTheme,S=t.themeOverride===void 0&&y===void 0?d:xi(d,y,t.themeOverride);S.bgHeader!==d.bgHeader&&(e.fillStyle=S.bgHeader,e.fill()),S!==d&&(e.font=S.baseFontFull);let C=u.columns.hasIndex(t.sourceIndex),w=c!==void 0||l,T=!w&&x===-1&&b===t.sourceIndex,E=w?0:p.find(e=>e.item[0]===t.sourceIndex&&e.item[1]===-1)?.hoverAmount??0,D=u?.current!==void 0&&u.current.cell[0]===t.sourceIndex,O=C?S.accentColor:D?S.bgHeaderHasFocus:S.bgHeader,k=n?s:0,A=t.sourceIndex===0?0:1;C?(e.fillStyle=O,e.fillRect(r+A,k,t.width-A,o)):(D||E>0)&&(e.beginPath(),e.rect(r+A,k,t.width-A,o),D&&(e.fillStyle=S.bgHeaderHasFocus,e.fill()),E>0&&(e.globalAlpha=E,e.fillStyle=S.bgHeaderHovered,e.fill(),e.globalAlpha=1)),Va(e,r,k,t.width,o,t,C,S,T,D,E,f,_,v),e.restore()}),n&&Ia(e,t,i,a,s,r,d,f,p,m,h,g)}function Ia(e,t,n,r,i,a,o,s,c,l,u,d){let[f,p]=a?.[0]??[],m=0;_a(t,n,r,i,(t,n,r,c,h,g)=>{if(d!==void 0&&!d.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1}))return;e.save(),e.beginPath(),e.rect(r,c,h,g),e.clip();let _=u(n),v=_?.overrideTheme===void 0?o:xi(o,_.overrideTheme),y=p===-2&&f!==void 0&&f>=t[0]&&f<=t[1],b=y?v.bgHeaderHovered:v.bgHeader;if(b!==o.bgHeader&&(e.fillStyle=b,e.fill()),e.fillStyle=v.textGroupHeader??v.textHeader,_!==void 0){let t=r;if(_.icon!==void 0&&(s.drawSprite(_.icon,`normal`,e,t+8,(i-20)/2,20,v),t+=26),e.fillText(_.name,t+8,i/2+Xr(e,o.headerFontFull)),_.actions!==void 0&&y){let t=za({x:r,y:c,width:h,height:g},_.actions);e.beginPath();let n=t[0].x-10,o=r+h-n;e.rect(n,0,o,i);let l=e.createLinearGradient(n,0,n+o,0),u=fr(b,0);l.addColorStop(0,u),l.addColorStop(10/o,b),l.addColorStop(1,b),e.fillStyle=l,e.fill(),e.globalAlpha=.6;let[d,f]=a?.[1]??[-1,-1];for(let n=0;n<_.actions.length;n++){let i=_.actions[n],a=t[n],o=xa(a,d+r,f);o&&(e.globalAlpha=1),s.drawSprite(i.icon,`normal`,e,a.x+a.width/2-10,a.y+a.height/2-10,20,v),o&&(e.globalAlpha=.6)}e.globalAlpha=1}}r!==0&&l(t[0])&&(e.beginPath(),e.moveTo(r+.5,0),e.lineTo(r+.5,i),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()),e.restore(),m=r+h}),e.beginPath(),e.moveTo(m+.5,0),e.lineTo(m+.5,i),e.moveTo(0,i+.5),e.lineTo(n,i+.5),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()}var La=30;function Ra(e,t,n,r,i){return i?{x:e,y:t,width:La,height:Math.min(La,r)}:{x:e+n-La,y:Math.max(t,t+r/2-La/2),width:La,height:Math.min(La,r)}}function za(e,t){let n=[],r=e.x+e.width-26*t.length,i=e.y+e.height/2-13;for(let e=0;e35){let n=f?35:r-35,i=f?35*.7:r-35*.7,a=n/r,o=i/r,s=e.createLinearGradient(t,0,t+r,0),c=fr(h,0);s.addColorStop(+!!f,h),s.addColorStop(a,h),s.addColorStop(o,c),s.addColorStop(+!f,c),e.fillStyle=s}else e.fillStyle=h;if(f&&(e.textAlign=`right`),e.fillText(a.title,v,n+i/2+Xr(e,s.headerFontFull)),f&&(e.textAlign=`left`),g&&a.hasMenu===!0)if(a.menuIcon===void 0||a.menuIcon===it.Triangle){e.beginPath();let t=p.x+p.width/2-5.5,n=p.y+p.height/2-3;li(e,[{x:t,y:n},{x:t+11,y:n},{x:t+5.5,y:n+6}],1),e.fillStyle=h,e.fill()}else if(a.menuIcon===it.Dots)e.beginPath(),ci(e,p.x+p.width/2,p.y+p.height/2),e.fillStyle=h,e.fill();else{let t=p.x+(p.width-s.headerIconSize)/2,n=p.y+(p.height-s.headerIconSize)/2;u.drawSprite(a.menuIcon,`normal`,e,t,n,s.headerIconSize,s)}}function Va(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=R(a.title)===`rtl`,h=Ra(t,n,r,i,m);f===void 0?Ba(e,t,n,r,i,a,o,s,c,u,d,p,m,h):f({ctx:e,theme:s,rect:{x:t,y:n,width:r,height:i},column:a,columnIndex:a.sourceIndex,isSelected:o,hoverAmount:u,isHovered:c,hasSelectedCell:l,spriteManager:d,menuBounds:h},()=>Ba(e,t,n,r,i,a,o,s,c,u,d,p,m,h))}var Ha=s(((e,t)=>{var n=le();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),Ua=s(((e,t)=>{var n=Ha();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),Wa=s(((e,t)=>{function n(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),Ka=s(((e,t)=>{t.exports=Ga()()})),qa=s(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{function n(){return!1}t.exports=n})),Ya=s(((e,t)=>{var n=A(),r=Ja(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Xa=s(((e,t)=>{var n=N(),r=We(),i=te(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Za=s(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),Qa=s(((e,t)=>{var n=k(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),$a=s(((e,t)=>{var n=Xa(),r=Za(),i=Qa(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),eo=s(((e,t)=>{var n=qa(),r=He(),i=O(),a=Ya(),o=Ue(),s=$a(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),to=s(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),no=s(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),ro=s(((e,t)=>{t.exports=no()(Object.keys,Object)})),io=s(((e,t)=>{var n=to(),r=ro(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),ao=s(((e,t)=>{var n=eo(),r=io(),i=$i();function a(e){return i(e)?n(e):r(e)}t.exports=a})),oo=s(((e,t)=>{var n=Ka(),r=ao();function i(e,t){return e&&n(e,t,r)}t.exports=i})),so=s(((e,t)=>{var n=$i();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=oo();t.exports=so()(n)})),lo=s(((e,t)=>{var n=co();function r(e,t,r,i){return n(e,function(e,n,a){t(i,e,r(e),a)}),i}t.exports=r})),uo=s(((e,t)=>{var n=we();function r(){this.__data__=new n,this.size=0}t.exports=r})),fo=s(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),po=s(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),mo=s(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),ho=s(((e,t)=>{var n=we(),r=Te(),i=Ne(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=we(),r=uo(),i=fo(),a=po(),o=mo(),s=ho();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),_o=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=Pi(),r=_o(),i=Vi(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=A().Uint8Array})),bo=s(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),xo=s(((e,t)=>{var n=j(),r=yo(),i=ve(),a=vo(),o=bo(),s=Wi(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),So=s(((e,t)=>{var n=Ji(),r=O();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),Co=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),To=s(((e,t)=>{var n=Co(),r=wo(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),Eo=s(((e,t)=>{var n=So(),r=To(),i=ao();function a(e){return n(e,i,r)}t.exports=a})),Do=s(((e,t)=>{var n=Eo(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=le()(A(),`DataView`)})),ko=s(((e,t)=>{t.exports=le()(A(),`Promise`)})),Ao=s(((e,t)=>{t.exports=le()(A(),`WeakMap`)})),jo=s(((e,t)=>{var n=Oo(),r=Te(),i=ko(),a=Hi(),o=Ao(),s=N(),c=oe(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),Mo=s(((e,t)=>{var n=go(),r=vo(),i=xo(),a=Do(),o=jo(),s=O(),c=Ya(),l=$a(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),No=s(((e,t)=>{var n=Mo(),r=te();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),Po=s(((e,t)=>{var n=go(),r=No(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=re();function r(e){return e===e&&!n(e)}t.exports=r})),Io=s(((e,t)=>{var n=Fo(),r=ao();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),Lo=s(((e,t)=>{function n(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),eee=s(((e,t)=>{var n=Po(),r=Io(),i=Lo();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),Ro=s(((e,t)=>{var n=Be(),r=Ge();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=Ro();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Bo=s(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),Vo=s(((e,t)=>{var n=Bo(),r=Ke();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),Ho=s(((e,t)=>{var n=No(),r=zo(),i=Vo(),a=P(),o=Fo(),s=Lo(),c=Ge(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),Uo=s(((e,t)=>{function n(e){return e}t.exports=n})),Wo=s(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),Go=s(((e,t)=>{var n=Ro();function r(e){return function(t){return n(t,e)}}t.exports=r})),Ko=s(((e,t)=>{var n=Wo(),r=Go(),i=P(),a=Ge();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),qo=s(((e,t)=>{var n=eee(),r=Ho(),i=Uo(),a=O(),o=Ko();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),Jo=s(((e,t)=>{var n=Wa(),r=lo(),i=qo(),a=O();function o(e,t){return function(o,s){var c=a(o)?n:r,l=t?t():{};return c(o,e,i(s,2),l)}}t.exports=o})),Yo=u(s(((e,t)=>{var n=Ua(),r=Jo(),i=Object.prototype.hasOwnProperty;t.exports=r(function(e,t,r){i.call(e,r)?e[r].push(t):n(e,r,[t])})}))(),1);Ti(),vr();function Xo(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){if(_!==void 0||t[t.length-1]!==n[t.length-1])return;let y=ma(g);ga(t,c,o,s,a,(n,o,s,c,_)=>{if(n!==t[t.length-1])return;o+=n.width;let b=Math.max(o,c);b>r||(e.save(),e.beginPath(),e.rect(b,a+1,1e4,i-a-1),e.clip(),ha(_,s,i,l,u,m,h,y,(t,n,r,i)=>{if(!i&&g.length>0&&!g.some(e=>ba(o,t,1e4,r,e.x,e.y,e.width,e.height)))return;let a=f.hasIndex(n),s=p.hasIndex(n);e.beginPath();let c=d?.(n),l=c===void 0?v:xi(v,c);l.bgCell!==v.bgCell&&(e.fillStyle=l.bgCell,e.fillRect(o,t,1e4,r)),s&&(e.fillStyle=l.bgHeader,e.fillRect(o,t,1e4,r)),a&&(e.fillStyle=l.accentLight,e.fillRect(o,t,1e4,r))}),e.restore())})}function Zo(e,t,n,r,i,a,o,s,c){let l=!1;for(let e of t)if(!e.sticky){l=o(e.sourceIndex);break}let u=c.horizontalBorderColor??c.borderColor,d=c.borderColor,f=l?Rr(t):0,p;if(f!==0&&(p=pr(d,c.bgCell),e.beginPath(),e.moveTo(f+.5,0),e.lineTo(f+.5,r),e.strokeStyle=p,e.stroke()),i>0){let t=d===u&&p!==void 0?p:pr(u,c.bgCell),o=zr(a,i,s);e.beginPath(),e.moveTo(0,r-o+.5),e.lineTo(n,r-o+.5),e.strokeStyle=t,e.stroke()}}var Qo=(e,t,n)=>{let r=0,i=t,a=0,o=n;if(e!==void 0&&e.length>0){r=2**53-1,a=2**53-1,i=-(2**53-1),o=-(2**53-1);for(let t of e)r=Math.min(r,t.x-1),i=Math.max(i,t.x+t.width+1),a=Math.min(a,t.y-1),o=Math.max(o,t.y+t.height+1)}return{minX:r,maxX:i,minY:a,maxY:o}};function $o(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=m.bgCell,{minX:g,maxX:_,minY:v,maxY:y}=Qo(s,a,o),b=[],x=o-zr(p,f,l),S=c,C=n,w=0;for(;S+i=v&&e<=y-1){let n=u?.(C)?.bgCell;n!==void 0&&n!==h&&C>=p-f&&b.push({x:g,y:e,w:_-g,h:t,color:n})}S+=t,C0)for(let e=0;e=g&&i<=_&&d(e+1)&&b.push({x:i,y:w,w:n.width,h:E,color:a}),T+=n.width}if(b.length===0)return;let D;e.beginPath();for(let t=b.length-1;t>=0;t--){let n=b[t];D===void 0?D=n.color:n.color!==D&&(e.fillStyle=D,e.fill(),e.beginPath(),D=n.color),e.rect(n.x,n.y,n.w,n.h)}D!==void 0&&(e.fillStyle=D,e.fill()),e.beginPath()}function es(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=!1){if(c!==void 0){e.beginPath(),e.save(),e.rect(0,0,a,o);for(let t of c)e.rect(t.x+1,t.y+1,t.width-1,t.height-1);e.clip(`evenodd`)}let v=g.horizontalBorderColor??g.borderColor,y=g.borderColor,{minX:b,maxX:x,minY:S,maxY:C}=Qo(s,a,o),w=[];e.beginPath();let T=.5;for(let e=0;e=b&&i<=x&&p(e+1)&&w.push({x1:i,y1:Math.max(l,S),x2:i,y2:Math.min(o,C),color:y})}let E=o+.5;for(let e=h-m;e=S&&n<=C-1){let e=f?.(t);w.push({x1:b,y1:n,x2:x,y2:n,color:e?.horizontalBorderColor??e?.borderColor??v})}e+=d(t),t++}}let D=(0,Yo.default)(w,e=>e.color);for(let t of Object.keys(D)){e.strokeStyle=t;for(let n of D[t])e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke(),e.beginPath()}c!==void 0&&e.restore()}E();function ts(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=[];e.imageSmoothingEnabled=!1;let b=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o),S=0;if(typeof _==`number`)S+=(x-b)*_;else for(let e=b;ei.cellYOffset&&(S=-S),S+=c-i.translateY;let C=Math.min(i.cellXOffset,a),w=Math.max(i.cellXOffset,a),T=0;for(let e=C;ei.cellXOffset&&(T=-T),T+=s-i.translateX;let E=Rr(g);if(T!==0&&S!==0)return{regions:[]};let D=l>0?zr(f,l,_):0,O=u-E-Math.abs(T),k=d-p-D-Math.abs(S)-1;if(O>150&&k>150){let i={sx:0,sy:0,sw:u*m,sh:d*m,dx:0,dy:0,dw:u*m,dh:d*m};if(S>0?(i.sy=(p+1)*m,i.sh=k*m,i.dy=(S+p+1)*m,i.dh=k*m,y.push({x:0,y:p,width:u,height:S+1})):S<0&&(i.sy=(-S+p+1)*m,i.sh=k*m,i.dy=(p+1)*m,i.dh=k*m,y.push({x:0,y:d+S-D,width:u,height:-S+D})),T>0?(i.sx=E*m,i.sw=O*m,i.dx=(T+E)*m,i.dw=O*m,y.push({x:E-1,y:0,width:T+2,height:d})):T<0&&(i.sx=(E-T)*m,i.sw=O*m,i.dx=E*m,i.dw=O*m,y.push({x:u+T,y:0,width:-T,height:d})),e.setTransform(1,0,0,1,0,0),v){if(E>0&&T!==0&&S===0&&(r===void 0||n?.[1]!==!1)){let n=E*m,r=d*m;e.drawImage(t,0,0,n,r,0,0,n,r)}if(D>0&&T===0&&S!==0&&(r===void 0||n?.[0]!==!1)){let n=(d-D)*m,r=u*m,i=D*m;e.drawImage(t,0,n,r,i,0,n,r,i)}}e.drawImage(t,i.sx,i.sy,i.sw,i.sh,i.dx,i.dy,i.dw,i.dh),e.scale(m,m)}return e.imageSmoothingEnabled=!0,{regions:y}}function ns(e,t,n,r,i,a,o,s,c,l){let u=[];return t!==e.cellXOffset||n!==e.cellYOffset||r!==e.translateX||i!==e.translateY||ga(c,n,r,i,s,(e,t,n,r)=>{if(e.sourceIndex===l){let e=Math.max(t,r)+1;return u.push({x:e,y:0,width:a-e,height:o}),!0}}),u}function rs(e,t){if(t===void 0||e.width!==t.width||e.height!==t.height||e.theme!==t.theme||e.headerHeight!==t.headerHeight||e.rowHeight!==t.rowHeight||e.rows!==t.rows||e.freezeColumns!==t.freezeColumns||e.getRowThemeOverride!==t.getRowThemeOverride||e.isFocused!==t.isFocused||e.isResizing!==t.isResizing||e.verticalBorder!==t.verticalBorder||e.getCellContent!==t.getCellContent||e.highlightRegions!==t.highlightRegions||e.selection!==t.selection||e.dragAndDropState!==t.dragAndDropState||e.prelightCells!==t.prelightCells||e.touchMode!==t.touchMode||e.maxScaleFactor!==t.maxScaleFactor)return!1;if(e.mappedColumns!==t.mappedColumns){if(e.mappedColumns.length>100||e.mappedColumns.length!==t.mappedColumns.length)return!1;let n;for(let r=0;re.style!==`no-outline`);if(g===void 0||g.length===0)return;let _=Rr(s),v=zr(p,f,d),y=[c,0,s.length,p-f],b=[_,0,t,n-v],x=g.map(e=>{let m=e.range,h=e.style??`dashed`;return Ta(m,y,t,n,b).map(m=>{let g=m.rect,_=ui(g.x,g.y,t,n,u,l+u,r,i,a,o,p,c,f,s,d),v=g.width===1&&g.height===1?_:ui(g.x+g.width-1,g.y+g.height-1,t,n,u,l+u,r,i,a,o,p,c,f,s,d);return g.x+g.width>=s.length&&--v.width,g.y+g.height>=p&&--v.height,{color:e.color,style:h,clip:m.clip,rect:wa({x:_.x,y:_.y,width:v.x+v.width-_.x,height:v.y+v.height-_.y},t,n,8)}})}),S=()=>{e.lineWidth=1;let r=!1;for(let i of x)for(let a of i)if(a?.rect!==void 0&&ba(0,0,t,n,a.rect.x,a.rect.y,a.rect.width,a.rect.height)){let t=r,n=!Ca(a.clip,a.rect);n&&(e.save(),e.rect(a.clip.x,a.clip.y,a.clip.width,a.clip.height),e.clip()),a.style===`dashed`&&!r?(e.setLineDash([5,3]),r=!0):(a.style===`solid`||a.style===`solid-outline`)&&r&&(e.setLineDash([]),r=!1),e.strokeStyle=a.style===`solid-outline`?mr(mr(a.color,h.borderColor),h.bgCell):fr(a.color,1),e.strokeRect(a.rect.x+.5,a.rect.y+.5,a.rect.width-1,a.rect.height-1),n&&(e.restore(),r=t)}r&&e.setLineDash([])};return S(),S}function as(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.lineWidth=2,e.strokeStyle=i,e.stroke(),e.globalAlpha=1}function os(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){if(u.current===void 0)return;let _=u.current.range,v=u.current.cell,y=[_.x+_.width-1,_.y+_.height-1];if(v[1]>=g&&y[1]>=g||!o.some(e=>e.sourceIndex===v[0]||e.sourceIndex===y[0]))return;let[b,x]=u.current.cell,S=f(u.current.cell),C=S.span??[b,b],w=x>=g-p,T=p>0&&!w?zr(g,p,d)-1:0,E=y[1],D;if(ga(o,r,i,a,l,(r,i,a,o,l)=>{if(r.sticky&&b>r.sourceIndex)return;let u=r.sourceIndexC[1],_=r.sourceIndex===y[0];if(!(!_&&(u||f)))return ha(l,a,n,g,d,p,m,void 0,(a,l,u)=>{if(l!==x&&l!==E)return;let d=i,f=r.width;if(S.span!==void 0){let e=va(S.span,i,a,r.width,u,r,s),t=r.sticky?e[0]:e[1];t!==void 0&&(d=t.x,f=t.width)}return l===E&&_&&h&&(D=()=>{o>d&&!r.sticky&&(e.beginPath(),e.rect(o,0,t-o,n),e.clip()),e.beginPath(),e.rect(d+f-4,a+u-4,4,4),e.fillStyle=r.themeOverride?.accentColor??c.accentColor,e.fill()}),D!==void 0}),D!==void 0}),D===void 0)return;let O=()=>{e.save(),e.beginPath(),e.rect(0,l,t,n-l-T),e.clip(),D?.(),e.restore()};return O(),O}vr(),E();function ss(e,t,n,r,i,a,o,s,c){c===void 0||c.size===0||(e.beginPath(),_a(t,n,a,r,(t,n,r,i,a,o)=>{c.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1})&&e.rect(r,i,a,o)}),ga(t,s,a,o,i,(t,n,a,o)=>{let s=Math.max(0,o-n),l=n+s+1,u=t.width-s-1;c.has([t.sourceIndex,-1])&&e.rect(l,r,u,i-r)}),e.clip())}function cs(e,t,n,r,i,a,o,s,c,l){let u=0;return ga(e,a,r,i,n,(e,n,r,i,a)=>(ha(a,r,t,o,s,c,l,void 0,(e,t,n,r)=>{r||(u=Math.max(t,u))}),!0)),u}function ls(e,t){let{canvasCtx:n,headerCanvasCtx:r,width:i,height:a,cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mappedColumns:u,enableGroups:d,freezeColumns:f,dragAndDropState:p,theme:m,drawFocus:h,headerHeight:g,groupHeaderHeight:_,disabledRows:v,rowHeight:y,verticalBorder:b,overrideCursor:S,isResizing:C,selection:w,fillHandle:T,freezeTrailingRows:E,rows:D,getCellContent:O,getGroupDetails:k,getRowThemeOverride:A,isFocused:j,drawHeaderCallback:M,prelightCells:ee,drawCellCallback:N,highlightRegions:te,resizeCol:ne,imageLoader:P,lastBlitData:re,hoverValues:F,hyperWrapping:ie,hoverInfo:ae,spriteManager:oe,maxScaleFactor:se,hasAppendRow:ce,touchMode:le,enqueue:ue,renderStateProvider:de,getCellRenderer:fe,renderStrategy:pe,bufferACtx:me,bufferBCtx:he,damage:ge,minimumCellWidth:_e}=e;if(i===0||a===0)return;let ve=pe===`double-buffer`,ye=Math.min(se,Math.ceil(window.devicePixelRatio??1)),be=pe!==`direct`&&rs(e,t),xe=n.canvas;(xe.width!==i*ye||xe.height!==a*ye)&&(xe.width=i*ye,xe.height=a*ye,xe.style.width=i+`px`,xe.style.height=a+`px`);let Se=r.canvas,Ce=d?_+g:g,we=Ce+1;(Se.width!==i*ye||Se.height!==we*ye)&&(Se.width=i*ye,Se.height=we*ye,Se.style.width=i+`px`,Se.style.height=we+`px`);let Te=me.canvas,Ee=he.canvas;ve&&(Te.width!==i*ye||Te.height!==a*ye)&&(Te.width=i*ye,Te.height=a*ye,re.current!==void 0&&(re.current.aBufferScroll=void 0)),ve&&(Ee.width!==i*ye||Ee.height!==a*ye)&&(Ee.width=i*ye,Ee.height=a*ye,re.current!==void 0&&(re.current.bBufferScroll=void 0));let De=re.current;if(be===!0&&o===De?.cellXOffset&&s===De?.cellYOffset&&c===De?.translateX&&l===De?.translateY)return;let Oe=null;ve&&(Oe=n);let ke=r,Ae;Ae=ve?ge===void 0?De?.lastBuffer===`b`?me:he:De?.lastBuffer===`b`?he:me:n;let je=Ae.canvas,Me=ve?je===Te?Ee:Te:xe,Ne=typeof y==`number`?()=>y:y;ke.save(),Ae.save(),ke.beginPath(),Ae.beginPath(),ke.textBaseline=`middle`,Ae.textBaseline=`middle`,ye!==1&&(ke.scale(ye,ye),Ae.scale(ye,ye));let Pe=Br(u,o,i,p,c),Fe=[],Ie=h&&w.current?.cell[1]===s&&l===0,Le=!1;if(te!==void 0){for(let e of te)if(e.style!==`no-outline`&&e.range.y===s&&l===0){Le=!0;break}}let Re=()=>{Fa(ke,Pe,d,ae,i,c,g,_,p,C,w,m,oe,F,b,k,ge,M,le),es(ke,Pe,s,c,l,i,a,void 0,void 0,_,Ce,Ne,A,b,E,D,m,!0),ke.beginPath(),ke.moveTo(0,we-.5),ke.lineTo(i,we-.5),ke.strokeStyle=mr(m.headerBottomBorderColor??m.horizontalBorderColor??m.borderColor,m.bgHeader),ke.stroke(),Le&&is(ke,i,a,o,s,c,l,u,f,g,_,y,E,D,te,m),Ie&&os(ke,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D)};if(ge!==void 0){let e=Pe[Pe.length-1].sourceIndex+1,t=ge.hasItemInRegion([{x:o,y:-2,width:e,height:2},{x:o,y:s,width:e,height:300},{x:0,y:s,width:f,height:300},{x:0,y:-2,width:f,height:2},{x:o,y:D-E,width:e,height:E,when:E>0}]),n=e=>{Da(e,Pe,u,a,Ce,c,l,s,D,Ne,O,k,A,v,j,h,E,ce,Fe,ge,w,ee,te,P,oe,F,ae,N,ie,m,ue,de,fe,S,_e);let t=w.current;T&&h&&t!==void 0&&ge.has(Pr(t.range))&&os(e,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D)};t&&(n(Ae),Oe!==null&&(Oe.save(),Oe.scale(ye,ye),Oe.textBaseline=`middle`,n(Oe),Oe.restore()),ge.hasHeader()&&(ss(ke,Pe,i,_,Ce,c,l,s,ge),Re())),Ae.restore(),ke.restore();return}if((be!==!0||o!==De?.cellXOffset||c!==De?.translateX||Ie!==De?.mustDrawFocusOnHeader||Le!==De?.mustDrawHighlightRingsOnHeader)&&Re(),be===!0){x(Me!==void 0&&De!==void 0);let{regions:e}=ts(Ae,Me,Me===Te?De.aBufferScroll:De.bBufferScroll,Me===Te?De.bBufferScroll:De.aBufferScroll,De,o,s,c,l,E,i,a,D,Ce,ye,u,Pe,y,ve);Fe=e}else be!==!1&&(x(De!==void 0),Fe=ns(De,o,s,c,l,i,a,Ce,Pe,be));Zo(Ae,Pe,i,a,E,D,b,Ne,m);let ze=is(Ae,i,a,o,s,c,l,u,f,g,_,y,E,D,te,m),Be=h?os(Ae,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D):void 0;if(Ae.fillStyle=m.bgCell,Fe.length>0){Ae.beginPath();for(let e of Fe)Ae.rect(e.x,e.y,e.width,e.height);Ae.clip(),Ae.fill(),Ae.beginPath()}else Ae.fillRect(0,0,i,a);let Ve=Da(Ae,Pe,u,a,Ce,c,l,s,D,Ne,O,k,A,v,j,h,E,ce,Fe,ge,w,ee,te,P,oe,F,ae,N,ie,m,ue,de,fe,S,_e);Xo(Ae,Pe,u,i,a,Ce,c,l,s,D,Ne,A,w.rows,v,E,ce,Fe,ge,m),$o(Ae,Pe,s,c,l,i,a,Fe,Ce,Ne,A,b,E,D,m),es(Ae,Pe,s,c,l,i,a,Fe,Ve,_,Ce,Ne,A,b,E,D,m),ze?.(),Be?.(),C&&ga(Pe,0,c,0,Ce,(e,t)=>e.sourceIndex===ne?(as(ke,t+e.width,0,Ce+1,mr(m.resizeIndicatorColor??m.accentLight,m.bgHeader)),as(Ae,t+e.width,Ce,a,mr(m.resizeIndicatorColor??m.accentLight,m.bgCell)),!0):!1),Oe!==null&&(Oe.fillStyle=m.bgCell,Oe.fillRect(0,0,i,a),Oe.drawImage(Ae.canvas,0,0));let He=cs(Pe,a,Ce,c,l,s,D,Ne,E,ce);P?.setWindow({x:o,y:s,width:Pe.length,height:He-s},f,Array.from({length:E},(e,t)=>D-1-t));let Ue=De!==void 0&&(o!==De.cellXOffset||c!==De.translateX),We=De!==void 0&&(s!==De.cellYOffset||l!==De.translateY);re.current={cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mustDrawFocusOnHeader:Ie,mustDrawHighlightRingsOnHeader:Le,lastBuffer:ve?je===Te?`a`:`b`:void 0,aBufferScroll:je===Te?[Ue,We]:De?.aBufferScroll,bBufferScroll:je===Ee?[Ue,We]:De?.bBufferScroll},Ae.restore(),ke.restore()}var us=u(ji(),1),ds=80;function fs(e){let t=e-1;return t*t*t+1}var ps=class{callback;constructor(e){this.callback=e}currentHoveredItem=void 0;leavingItems=[];lastAnimationTime;addToLeavingItems=e=>{this.leavingItems.some(t=>Nr(t.item,e.item))||this.leavingItems.push(e)};removeFromLeavingItems=e=>{let t=this.leavingItems.find(t=>Nr(t.item,e));return this.leavingItems=this.leavingItems.filter(e=>e!==t),t?.hoverAmount??0};cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)};shouldStep=()=>{let e=this.leavingItems.length>0,t=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||t};getAnimatingItems=()=>this.currentHoveredItem===void 0?this.leavingItems.map(e=>({...e,hoverAmount:fs(e.hoverAmount)})):[...this.leavingItems,this.currentHoveredItem];step=e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{let t=(e-this.lastAnimationTime)/ds;for(let e of this.leavingItems)e.hoverAmount=(0,us.default)(e.hoverAmount-t,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,us.default)(this.currentHoveredItem.hoverAmount+t,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0};setHovered=e=>{if(!Nr(this.currentHoveredItem?.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){let t=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:t}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}}},ms=class{fn;val;constructor(e){this.fn=e}get value(){return this.val??=this.fn()}};function hs(e){return new ms(e)}var gs=hs(()=>window.navigator.userAgent.includes(`Firefox`)),_s=hs(()=>window.navigator.userAgent.includes(`Mac OS`)&&window.navigator.userAgent.includes(`Safari`)&&!window.navigator.userAgent.includes(`Chrome`)),vs=hs(()=>window.navigator.platform.toLowerCase().startsWith(`mac`));function ys(e){let t=L.useRef([]),n=L.useRef(0),r=L.useRef(e);r.current=e;let i=L.useCallback(()=>{let e=()=>window.requestAnimationFrame(i),i=()=>{let e=t.current.map(hi);t.current=[],r.current(new vi(e)),t.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?e:i)},[]);return L.useCallback(e=>{t.current.length===0&&i();let n=fi(e[0],e[1]);t.current.includes(n)||t.current.push(n)},[i])}var bs=`header`,xs=`group-header`,Ss=`out-of-bounds`,Cs;(function(e){e[e.Start=-2]=`Start`,e[e.StartPadding=-1]=`StartPadding`,e[e.Center=0]=`Center`,e[e.EndPadding=1]=`EndPadding`,e[e.End=2]=`End`})(Cs||={});function ws(e,t){return e===t?!0:e?.kind===`out-of-bounds`?e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]&&e?.region[0]===t?.region[0]&&e?.region[1]===t?.region[1]:e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]}ct();var Ts=u(ra(),1);E();var Es=6,Ds=(e,t)=>e.kind===I.Custom?e.copyData:(t?.(e))?.getAccessibilityString(e)??``,Os=L.memo(L.forwardRef((e,t)=>{let{width:n,height:r,accessibilityHeight:i,columns:a,cellXOffset:o,cellYOffset:s,headerHeight:c,fillHandle:l=!1,groupHeaderHeight:u,rowHeight:d,rows:f,getCellContent:p,getRowThemeOverride:m,onHeaderMenuClick:h,enableGroups:g,isFilling:_,onCanvasFocused:v,onCanvasBlur:y,isFocused:b,selection:S,freezeColumns:C,onContextMenu:w,freezeTrailingRows:T,fixedShadowX:E=!0,fixedShadowY:D=!0,drawFocusRing:O,onMouseDown:k,onMouseUp:A,onMouseMoveRaw:j,onMouseMove:M,onItemHovered:ee,dragAndDropState:N,firstColAccessible:te,onKeyDown:ne,onKeyUp:P,highlightRegions:re,canvasRef:F,onDragStart:ie,onDragEnd:ae,eventTargetRef:oe,isResizing:se,resizeColumn:ce,isDragging:le,isDraggable:ue=!1,allowResize:de,disabledRows:fe,hasAppendRow:pe,getGroupDetails:me,theme:he,prelightCells:ge,headerIcons:_e,verticalBorder:ve,drawCell:ye,drawHeader:be,onCellFocused:xe,onDragOverCell:Se,onDrop:Ce,onDragLeave:we,imageWindowLoader:Te,smoothScrollX:Ee=!1,smoothScrollY:De=!1,experimental:Oe,getCellRenderer:ke}=e,Ae=e.translateX??0,je=e.translateY??0,Me=Math.max(C,Math.min(a.length-1,o)),Ne=L.useRef(null),Pe=Te,Fe=L.useRef(),[Ie,Le]=L.useState(!1),Re=L.useRef([]),ze=L.useRef(),[Be,Ve]=L.useState(),[He,Ue]=L.useState(),We=L.useRef(null),[Ge,Ke]=L.useState(),[qe,Je]=L.useState(!1),Ye=L.useRef(qe);Ye.current=qe;let Xe=L.useMemo(()=>new pa(_e,()=>{vt.current=void 0,St.current()}),[_e]),$e=g?u+c:c,tt=L.useRef(-1),nt=(Oe?.enableFirefoxRescaling??!1)&&gs.value,rt=(Oe?.enableSafariRescaling??!1)&&_s.value;L.useLayoutEffect(()=>{window.devicePixelRatio===1||!nt&&!rt||(tt.current!==-1&&Le(!0),window.clearTimeout(tt.current),tt.current=window.setTimeout(()=>{Le(!1),tt.current=-1},200))},[s,Me,Ae,je,nt,rt]);let it=Or(a,C),ot=E?Rr(it,N):0,ct=L.useCallback((e,t,i)=>{let a=e.getBoundingClientRect();if(t>=it.length||i>=f)return;let o=a.width/n,c=ui(t,i,n,r,u,$e,Me,s,Ae,je,f,C,T,it,d);return o!==1&&(c.x*=o,c.y*=o,c.width*=o,c.height*=o),c.x+=a.x,c.y+=a.y,c},[n,r,u,$e,Me,s,Ae,je,f,C,T,it,d]),lt=L.useCallback((e,t,i,a)=>{let o=e.getBoundingClientRect(),p=o.width/n,m=(t-o.left)/p,h=(i-o.top)/p,_=Br(it,Me,n,void 0,Ae),v=0,y=0;a instanceof MouseEvent&&(v=a.button,y=a.buttons);let b=Vr(m,_,Ae),C=Hr(h,r,g,c,u,f,d,s,je,T),w=a?.shiftKey===!0,E=a?.ctrlKey===!0,D=a?.metaKey===!0,O=a!==void 0&&!(a instanceof MouseEvent)||a?.pointerType===`touch`,k=[m<0?-1:+(nn||h>r){let i=m>n?1:m<0?-1:0,a=h>r?1:h<0?-1:0,o=i*2,s=a*2;i===0&&(o=b===-1?Cs.EndPadding:Cs.Center),a===0&&(s=C===void 0?Cs.EndPadding:Cs.Center);let c=!1;if(b===-1&&C===-1){let n=ct(e,it.length-1,-1);x(n!==void 0),c=tn&&mr&&h=0?(r=!0,n=ct(e,a,C),x(n!==void 0),A={kind:g&&C===-2?xs:bs,location:[a,C],bounds:n,group:it[a].group??``,isEdge:r,shiftKey:w,ctrlKey:E,metaKey:D,isTouch:O,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:k}):A={kind:g&&C===-2?xs:bs,group:it[b].group??``,location:[b,C],bounds:n,isEdge:r,shiftKey:w,ctrlKey:E,metaKey:D,isTouch:O,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:k}}else{let n=ct(e,b,C);x(n!==void 0);let r=n!==void 0&&n.x+n.width-t<5,a=!1;if(l&&S.current!==void 0){let n=Pr(S.current.range),r=ct(e,n[0],n[1]);if(r!==void 0){let e=r.x+r.width-2,n=r.y+r.height-2;a=Math.abs(e-t){}),ft=L.useRef(Be);ft.current=Be;let[pt,mt]=L.useMemo(()=>{let e=document.createElement(`canvas`),t=document.createElement(`canvas`);return e.style.display=`none`,e.style.opacity=`0`,e.style.position=`fixed`,t.style.display=`none`,t.style.opacity=`0`,t.style.position=`fixed`,[e.getContext(`2d`,{alpha:!1}),t.getContext(`2d`,{alpha:!1})]},[]);L.useLayoutEffect(()=>{if(!(pt===null||mt===null))return document.documentElement.append(pt.canvas),document.documentElement.append(mt.canvas),()=>{pt.canvas.remove(),mt.canvas.remove()}},[pt,mt]);let ht=L.useMemo(()=>new _i,[]),gt=nt&&Ie?1:rt&&Ie?2:5,_t=Oe?.disableMinimumCellWidth===!0?1:10,vt=L.useRef(),yt=L.useRef(null),bt=L.useRef(null),xt=L.useCallback(()=>{let e=Ne.current,t=We.current;if(e===null||t===null||(yt.current===null&&(yt.current=e.getContext(`2d`,{alpha:!1}),e.width=0,e.height=0),bt.current===null&&(bt.current=t.getContext(`2d`,{alpha:!1}),t.width=0,t.height=0),yt.current===null||bt.current===null||pt===null||mt===null))return;let i=!1,a=e=>{i=!0,Ke(e)},o=vt.current,h={headerCanvasCtx:bt.current,canvasCtx:yt.current,bufferACtx:pt,bufferBCtx:mt,width:n,height:r,cellXOffset:Me,cellYOffset:s,translateX:Math.round(Ae),translateY:Math.round(je),mappedColumns:it,enableGroups:g,freezeColumns:C,dragAndDropState:N,theme:he,headerHeight:c,groupHeaderHeight:u,disabledRows:fe??st.empty(),rowHeight:d,verticalBorder:ve,isResizing:se,resizeCol:ce,isFocused:b,selection:S,fillHandle:l,drawCellCallback:ye,hasAppendRow:pe,overrideCursor:a,maxScaleFactor:gt,freezeTrailingRows:T,rows:f,drawFocus:O,getCellContent:p,getGroupDetails:me??(e=>({name:e})),getRowThemeOverride:m,drawHeaderCallback:be,prelightCells:ge,highlightRegions:re,imageLoader:Pe,lastBlitData:ze,damage:Fe.current,hoverValues:Re.current,hoverInfo:ft.current,spriteManager:Xe,scrolling:Ie,hyperWrapping:Oe?.hyperWrapping??!1,touchMode:qe,enqueue:dt.current,renderStateProvider:ht,renderStrategy:Oe?.renderStrategy??(_s.value?`double-buffer`:`single-buffer`),getCellRenderer:ke,minimumCellWidth:_t};h.damage===void 0?(vt.current=h,ls(h,o)):ls(h,void 0),!i&&(h.damage===void 0||h.damage.has(ft?.current?.[0]))&&Ke(void 0)},[pt,mt,n,r,Me,s,Ae,je,it,g,C,N,he,c,u,fe,d,ve,se,pe,ce,b,S,l,T,f,O,gt,p,me,m,ye,be,ge,re,Pe,Xe,Ie,Oe?.hyperWrapping,Oe?.renderStrategy,qe,ht,ke,_t]),St=L.useRef(xt);L.useLayoutEffect(()=>{xt(),St.current=xt},[xt]),L.useLayoutEffect(()=>{(async()=>{document?.fonts?.ready!==void 0&&(await document.fonts.ready,vt.current=void 0,St.current())})()},[]);let Ct=L.useCallback(e=>{Fe.current=e,St.current(),Fe.current=void 0},[]);dt.current=ys(Ct);let wt=L.useCallback(e=>{Ct(new vi(e.map(e=>e.cell)))},[Ct]);Pe.setCallback(Ct);let[Tt,Et]=L.useState(!1),[Dt,Ot]=ut??[],kt=Dt!==void 0&&Ot===-1,At=Dt!==void 0&&Ot===-2,jt=!1,Mt=!1,Nt=Ge;if(Nt===void 0&&Dt!==void 0&&Ot!==void 0&&Ot>-1&&Ot({contain:`strict`,display:`block`,cursor:Pt}),[Pt]),It=L.useRef(`default`),Lt=oe?.current;Lt!=null&&It.current!==Ft.cursor&&(Lt.style.cursor=It.current=Ft.cursor);let Rt=L.useCallback((e,t,n,r)=>{if(me===void 0)return;let i=me(e);if(i.actions!==void 0){let e=za(t,i.actions);for(let[a,o]of e.entries())if(xa(o,n+t.x,r+o.y))return i.actions[a]}},[me]),zt=L.useCallback((e,t,n,r)=>{let i=a[t];if(!le&&!se&&i.hasMenu===!0&&!(He??!1)){let a=ct(e,t,-1);x(a!==void 0);let o=Ra(a.x,a.y,a.width,a.height,R(i.title)===`rtl`);if(n>o.x&&no.y&&r{let t=Ne.current,n=oe?.current;if(t===null||e.target!==t&&e.target!==n)return;Ht.current=!0;let r,i;if(e instanceof MouseEvent?(r=e.clientX,i=e.clientY):(r=e.touches[0].clientX,i=e.touches[0].clientY),e.target===n&&n!==null){let e=n.getBoundingClientRect();if(r>e.right||i>e.bottom)return}let a=lt(t,r,i,e);Vt.current=a.location,a.isTouch&&(Bt.current=Date.now()),Ye.current!==a.isTouch&&Je(a.isTouch),!(a.kind===`header`&&zt(t,a.location[0],r,i)!==void 0)&&(a.kind===`group-header`&&Rt(a.group,a.bounds,a.localEventX,a.localEventY)!==void 0||(k?.(a),!a.isTouch&&ue!==!0&&ue!==a.kind&&a.button<3&&a.button!==1&&e.preventDefault()))},[oe,ue,lt,Rt,zt,k]);qt(`touchstart`,Ut,window,!1),qt(`mousedown`,Ut,window,!1);let Wt=L.useRef(0),Gt=L.useCallback(e=>{let t=Wt.current;Wt.current=Date.now();let n=Ne.current;if(Ht.current=!1,A===void 0||n===null)return;let r=oe?.current,i=e.target!==n&&e.target!==r,a,o,s=!0;if(e instanceof MouseEvent){if(a=e.clientX,o=e.clientY,s=e.button<3,e.pointerType===`touch`)return}else a=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY;let c=lt(n,a,o,e);c.isTouch&&Bt.current!==0&&Date.now()-Bt.current>500&&(c={...c,isLongTouch:!0}),t!==0&&Date.now()-t<(c.isTouch?1e3:500)&&(c={...c,isDoubleClick:!0}),Ye.current!==c.isTouch&&Je(c.isTouch),!i&&e.cancelable&&s&&e.preventDefault();let[l]=c.location,u=zt(n,l,a,o);if(c.kind===`header`&&u!==void 0){(c.button!==0||Vt.current?.[0]!==l||Vt.current?.[1]!==-1)&&A(c,!0);return}else if(c.kind===`group-header`){let e=Rt(c.group,c.bounds,c.localEventX,c.localEventY);if(e!==void 0){c.button===0&&e.onClick(c);return}}A(c,i)},[A,oe,lt,zt,Rt]);qt(`mouseup`,Gt,window,!1),qt(`touchend`,Gt,window,!1),qt(`click`,L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n=oe?.current,r=e.target!==t&&e.target!==n,i,a,o=!0;e instanceof MouseEvent?(i=e.clientX,a=e.clientY,o=e.button<3):(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY);let s=lt(t,i,a,e);Ye.current!==s.isTouch&&Je(s.isTouch),!r&&e.cancelable&&o&&e.preventDefault();let[c]=s.location,l=zt(t,c,i,a);if(s.kind===`header`&&l!==void 0)s.button===0&&Vt.current?.[0]===c&&Vt.current?.[1]===-1&&h?.(c,l);else if(s.kind===`group-header`){let e=Rt(s.group,s.bounds,s.localEventX,s.localEventY);e!==void 0&&s.button===0&&e.onClick(s)}},[oe,lt,zt,h,Rt]),window,!1),qt(`contextmenu`,L.useCallback(e=>{let t=Ne.current,n=oe?.current;if(t===null||e.target!==t&&e.target!==n||w===void 0)return;let r=lt(t,e.clientX,e.clientY,e);w(r,()=>{e.cancelable&&e.preventDefault()})},[oe,lt,w]),oe?.current??null,!1);let Kt=L.useCallback(e=>{Fe.current=new vi(e.map(e=>e.item)),Re.current=e,St.current(),Fe.current=void 0},[]),Jt=L.useMemo(()=>new ps(Kt),[Kt]),Yt=L.useRef(Jt);Yt.current=Jt,L.useLayoutEffect(()=>{let e=Yt.current;if(ut===void 0||ut[1]<0){e.setHovered(ut);return}let t=p(ut,!0),n=ke(t),r=n===void 0&&t.kind===I.Custom||n?.needsHover!==void 0&&(typeof n.needsHover==`boolean`?n.needsHover:n.needsHover(t));e.setHovered(r?ut:void 0)},[p,ke,ut]);let Xt=L.useRef();qt(`mousemove`,L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n=oe?.current,r=e.target!==t&&e.target!==n,i=lt(t,e.clientX,e.clientY,e);if(i.kind!==`out-of-bounds`&&r&&!Ht.current&&!i.isTouch)return;let a=(e,t)=>{Ve(n=>n===e||n?.[0][0]===e?.[0][0]&&n?.[0][1]===e?.[0][1]&&(n?.[1][0]===e?.[1][0]&&n?.[1][1]===e?.[1][1]||!t)?n:e)};if(!ws(i,Xt.current))Ke(void 0),ee?.(i),a(i.kind===`out-of-bounds`?void 0:[i.location,[i.localEventX,i.localEventY]],!0),Xt.current=i;else if(i.kind===`cell`||i.kind===`header`||i.kind===`group-header`){let e=!1,t=!0;if(i.kind===`cell`){let n=p(i.location);t=ke(n)?.needsHoverPosition??n.kind===I.Custom,e=t}else i.kind===`group-header`&&(e=!0);let n=[i.location,[i.localEventX,i.localEventY]];a(n,t),ft.current=n,e&&Ct(new vi([i.location]))}let o=i.location[0]>=+!te;Ue(i.kind===`header`&&i.isEdge&&o&&de===!0),Et(i.kind===`cell`&&i.isFillHandle),j?.(e),M(i)},[oe,lt,te,de,j,M,ee,p,ke,Ct]),window,!0);let Zt=L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n,r;S.current!==void 0&&(n=ct(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),ne?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[ne,S,ct]),Qt=L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n,r;S.current!==void 0&&(n=ct(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),P?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[P,S,ct]),$t=L.useCallback(e=>{Ne.current=e,F!==void 0&&(F.current=e)},[F]);qt(`dragstart`,L.useCallback(e=>{let t=Ne.current;if(t===null||ue===!1||se){e.preventDefault();return}let n,r,i=lt(t,e.clientX,e.clientY);if(ue!==!0&&i.kind!==ue){e.preventDefault();return}let a=(e,t)=>{n=e,r=t},o,s,c,l=(e,t,n)=>{o=e,s=t,c=n},u=!1;if(ie?.({...i,setData:a,setDragImage:l,preventDefault:()=>u=!0,defaultPrevented:()=>u}),!u&&n!==void 0&&r!==void 0&&e.dataTransfer!==null)if(e.dataTransfer.setData(n,r),e.dataTransfer.effectAllowed=`copyLink`,o!==void 0&&s!==void 0&&c!==void 0)e.dataTransfer.setDragImage(o,s,c);else{let[n,r]=i.location;if(r!==void 0){let i=document.createElement(`canvas`),a=ct(t,n,r);x(a!==void 0);let o=Math.ceil(window.devicePixelRatio??1);i.width=a.width*o,i.height=a.height*o;let s=i.getContext(`2d`);s!==null&&(s.scale(o,o),s.textBaseline=`middle`,r===-1?(s.font=he.headerFontFull,s.fillStyle=he.bgHeader,s.fillRect(0,0,i.width,i.height),Va(s,0,0,a.width,a.height,it[n],!1,he,!1,!1,0,Xe,be,!1)):(s.font=he.baseFontFull,s.fillStyle=he.bgCell,s.fillRect(0,0,i.width,i.height),Na(s,p([n,r]),0,r,!1,!1,0,0,a.width,a.height,!1,he,he.bgCell,Pe,Xe,1,void 0,!1,0,void 0,void 0,void 0,ht,ke,()=>void 0))),i.style.left=`-100%`,i.style.position=`absolute`,i.style.width=`${a.width}px`,i.style.height=`${a.height}px`,document.body.append(i),e.dataTransfer.setDragImage(i,a.width/2,a.height/2),window.setTimeout(()=>{i.remove()},0)}}else e.preventDefault()},[ue,se,lt,ie,ct,he,it,Xe,be,p,Pe,ht,ke]),oe?.current??null,!1,!1);let en=L.useRef();qt(`dragover`,L.useCallback(e=>{let t=Ne.current;if(Ce!==void 0&&e.preventDefault(),t===null||Se===void 0)return;let[n,r]=lt(t,e.clientX,e.clientY).location,i=n-+!te,[a,o]=en.current??[];(a!==i||o!==r)&&(en.current=[i,r],Se([i,r],e.dataTransfer))},[te,lt,Se,Ce]),oe?.current??null,!1,!1),qt(`dragend`,L.useCallback(()=>{en.current=void 0,ae?.()},[ae]),oe?.current??null,!1,!1),qt(`drop`,L.useCallback(e=>{let t=Ne.current;if(t===null||Ce===void 0)return;e.preventDefault();let[n,r]=lt(t,e.clientX,e.clientY).location,i=n-+!te;Ce([i,r],e.dataTransfer)},[te,lt,Ce]),oe?.current??null,!1,!1),qt(`dragleave`,L.useCallback(()=>{we?.()},[we]),oe?.current??null,!1,!1);let tn=L.useRef(S);tn.current=S;let nn=L.useRef(null),an=L.useCallback(e=>{Ne.current===null||!Ne.current.contains(document.activeElement)||(e===null&&tn.current.current!==void 0?F?.current?.focus({preventScroll:!0}):e!==null&&e.focus({preventScroll:!0}),nn.current=e)},[F]);L.useImperativeHandle(t,()=>({focus:()=>{let e=nn.current;e===null||!document.contains(e)?F?.current?.focus({preventScroll:!0}):e.focus({preventScroll:!0})},getBounds:(e,t)=>{if(!(F===void 0||F.current===null))return ct(F.current,e??0,t??-1)},damage:wt}),[F,wt,ct]);let on=L.useRef(),cn=rn(()=>{if(n<50||Oe?.disableAccessibilityTree===!0)return null;let e=Br(it,Me,n,N,Ae),t=te?0:-1;!te&&e[0]?.sourceIndex===0&&(e=e.slice(1));let[r,a]=S.current?.cell??[],o=S.current?.range,c=e.map(e=>e.sourceIndex),l=(0,Ts.default)(s,Math.min(f,s+i));return r!==void 0&&a!==void 0&&!(c.includes(r)&&l.includes(a))&&an(null),L.createElement(`table`,{key:`access-tree`,role:`grid`,"aria-rowcount":f+1,"aria-multiselectable":`true`,"aria-colcount":it.length+t},L.createElement(`thead`,{role:`rowgroup`},L.createElement(`tr`,{role:`row`,"aria-rowindex":1},e.map(e=>L.createElement(`th`,{role:`columnheader`,"aria-selected":S.columns.hasIndex(e.sourceIndex),"aria-colindex":e.sourceIndex+1+t,tabIndex:-1,onFocus:t=>{if(t.target!==nn.current)return xe?.([e.sourceIndex,-1])},key:e.sourceIndex},e.title)))),L.createElement(`tbody`,{role:`rowgroup`},l.map(n=>L.createElement(`tr`,{role:`row`,"aria-selected":S.rows.hasIndex(n),key:n,"aria-rowindex":n+2},e.map(e=>{let i=e.sourceIndex,s=fi(i,n),c=r===i&&a===n,l=o!==void 0&&i>=o.x&&i=o.y&&n{let e=F?.current;if(e!=null)return ne?.({bounds:ct(e,i,n),cancel:()=>void 0,preventDefault:()=>void 0,stopPropagation:()=>void 0,ctrlKey:!1,key:`Enter`,keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:d})},onFocusCapture:e=>{if(!(e.target===nn.current||on.current?.[0]===i&&on.current?.[1]===n))return on.current=d,xe?.(d)},ref:c?an:void 0,tabIndex:-1},Ds(f,ke))})))))},[n,it,Me,N,Ae,f,s,i,S,an,p,F,ne,ct,xe],200),ln=C===0||!E?0:Me>C?1:(0,us.default)(-Ae/100,0,1),un=-s*32+je,dn=D?(0,us.default)(-un/100,0,1):0,fn=L.useMemo(()=>{if(!ln&&!dn)return null;let e={position:`absolute`,top:0,left:ot,width:n-ot,height:r,opacity:ln,pointerEvents:`none`,transition:Ee?void 0:`opacity 0.2s`,boxShadow:`inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)`},t={position:`absolute`,top:$e,left:0,width:n,height:r,opacity:dn,pointerEvents:`none`,transition:De?void 0:`opacity 0.2s`,boxShadow:`inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)`};return L.createElement(L.Fragment,null,ln>0&&L.createElement(`div`,{id:`shadow-x`,style:e}),dn>0&&L.createElement(`div`,{id:`shadow-y`,style:t}))},[ln,dn,ot,n,Ee,$e,r,De]),pn=L.useMemo(()=>({position:`absolute`,top:0,left:0}),[]);return L.createElement(L.Fragment,null,L.createElement(`canvas`,{"data-testid":`data-grid-canvas`,tabIndex:0,onKeyDown:Zt,onKeyUp:Qt,onFocus:v,onBlur:y,ref:$t,style:Ft},cn),L.createElement(`canvas`,{ref:We,style:pn}),fn)}));function ks(e,t,n,r){return(0,us.default)(Math.round(t-(e.growOffset??0)),Math.ceil(n),Math.floor(r))}var As=e=>{let[t,n]=L.useState(),[r,i]=L.useState(),[a,o]=L.useState(),[s,c]=L.useState(),[l,u]=L.useState(!1),[d,f]=L.useState(),[p,m]=L.useState(),[h,g]=L.useState(),[_,v]=L.useState(!1),[y,b]=L.useState(),{onHeaderMenuClick:x,getCellContent:S,onColumnMoved:C,onColumnResize:w,onColumnResizeStart:T,onColumnResizeEnd:E,gridRef:D,maxColumnWidth:O,minColumnWidth:k,onRowMoved:A,lockColumns:j,onColumnProposeMove:M,onMouseDown:ee,onMouseUp:N,onItemHovered:te,onDragStart:ne,canvasRef:P}=e,re=(w??E??T)!==void 0,{columns:F,selection:ie}=e,ae=ie.columns,oe=L.useCallback(e=>{let[t,n]=e.location;a!==void 0&&s!==t&&t>=j?(u(!0),c(t)):p!==void 0&&n!==void 0?(v(!0),g(Math.max(0,n))):r===void 0&&!l&&!_&&te?.(e)},[a,p,s,te,j,r,l,_]),se=C!==void 0,ce=L.useCallback(e=>{if(e.button===0){let[t,r]=e.location;if(e.kind===`out-of-bounds`&&e.isEdge&&re){let e=D?.current?.getBounds(F.length-1,-1);e!==void 0&&(n(e.x),i(F.length-1))}else if(e.kind===`header`&&t>=j){let r=P?.current;if(e.isEdge&&re&&r){n(e.bounds.x),i(t);let a=r.getBoundingClientRect().width/r.offsetWidth,o=e.bounds.width/a;T?.(F[t],o,t,o+(F[t].growOffset??0))}else e.kind===`header`&&se&&(f(e.bounds.x),o(t))}else e.kind===`cell`&&j>0&&t===0&&r!==void 0&&A!==void 0&&(b(e.bounds.y),m(r))}ee?.(e)},[ee,re,j,A,D,F,se,T,P]),le=L.useCallback((e,t)=>{l||_||x?.(e,t)},[l,_,x]),ue=L.useRef(-1),de=L.useCallback(()=>{ue.current=-1,m(void 0),g(void 0),b(void 0),v(!1),o(void 0),c(void 0),f(void 0),u(!1),i(void 0),n(void 0)},[]),fe=L.useCallback((e,t)=>{if(e.button===0){if(r!==void 0){if(ae?.hasIndex(r)===!0)for(let e of ae){if(e===r)continue;let t=F[e],n=ks(t,ue.current,k,O);w?.(t,n,e,n+(t.growOffset??0))}let e=ks(F[r],ue.current,k,O);if(E?.(F[r],e,r,e+(F[r].growOffset??0)),ae.hasIndex(r))for(let e of ae){if(e===r)continue;let t=F[e],n=ks(t,ue.current,k,O);E?.(t,n,e,n+(t.growOffset??0))}}de(),a!==void 0&&s!==void 0&&C?.(a,s),p!==void 0&&h!==void 0&&A?.(p,h)}N?.(e,t)},[N,r,a,s,p,h,ae,E,F,k,O,w,C,A,de]),pe=L.useMemo(()=>{if(!(a===void 0||s===void 0)&&a!==s&&M?.(a,s)!==!1)return{src:a,dest:s}},[a,s,M]),me=L.useCallback(e=>{let n=P?.current;if(a!==void 0&&d!==void 0)Math.abs(e.clientX-d)>20&&u(!0);else if(p!==void 0&&y!==void 0)Math.abs(e.clientY-y)>20&&v(!0);else if(r!==void 0&&t!==void 0&&n){let i=n.getBoundingClientRect().width/n.offsetWidth,a=(e.clientX-t)/i,o=F[r],s=ks(o,a,k,O);if(w?.(o,s,r,s+(o.growOffset??0)),ue.current=a,ae?.first()===r)for(let e of ae){if(e===r)continue;let t=F[e],n=ks(t,ue.current,k,O);w?.(t,n,e,n+(t.growOffset??0))}}},[a,d,p,y,r,t,F,k,O,w,ae,P]),he=L.useCallback((e,t)=>{if(p===void 0||h===void 0)return S(e,t);let[n,r]=e;return r===h?r=p:(r>h&&--r,r>=p&&(r+=1)),S([n,r],t)},[p,h,S]),ge=L.useCallback(e=>{ne?.(e),e.defaultPrevented()||de()},[de,ne]);return L.createElement(Os,{accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,enableGroups:e.enableGroups,eventTargetRef:e.eventTargetRef,experimental:e.experimental,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,headerIcons:e.headerIcons,height:e.height,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,resizeColumn:r,isDraggable:e.isDraggable,isFilling:e.isFilling,isFocused:e.isFocused,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDrop:e.onDrop,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,width:e.width,getCellContent:he,isResizing:r!==void 0,onHeaderMenuClick:le,isDragging:l,onItemHovered:oe,onDragStart:ge,onMouseDown:ce,allowResize:re,onMouseUp:fe,dragAndDropState:pe,onMouseMoveRaw:me,ref:D})};function js(e){let t=(0,L.useRef)(null),[n,r]=(0,L.useState)({width:e?.[0],height:e?.[1]});return(0,L.useLayoutEffect)(()=>{let e=new window.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t&&t.contentRect||{};r(t=>t.width===e&&t.height===n?t:{width:e,height:n})}});return t.current&&e.observe(t.current,void 0),()=>{e.disconnect()}},[t.current]),{ref:t,...n}}var Ms=(e,t,n)=>{let r=(0,L.useRef)(null),i=(0,L.useRef)(null),a=(0,L.useRef)(null),o=(0,L.useRef)(0),s=(0,L.useRef)(t);s.current=t;let c=n.current;(0,L.useEffect)(()=>{let t=()=>{if(i.current===!1&&c!==null){let e=[c.scrollLeft,c.scrollTop];if(a.current?.[0]===e[0]&&a.current?.[1]===e[1])if(o.current>10){a.current=null,i.current=null;return}else o.current++;else o.current=0,s.current(e[0],e[1]),a.current=e;r.current=window.setTimeout(t,1e3/120)}},n=()=>{i.current=!0,a.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},l=e=>{e.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(t,1e3/120))};if(e&&c!==null){let e=c;return e.addEventListener(`touchstart`,n),e.addEventListener(`touchend`,l),()=>{e.removeEventListener(`touchstart`,n),e.removeEventListener(`touchend`,l),r.current!==null&&window.clearTimeout(r.current)}}},[e,c])};St();var Ns=xt(`div`)({name:`ScrollRegionStyle`,class:`gdg-s1dgczr6`,propsAsIs:!1,vars:{"s1dgczr6-0":[e=>e.isSafari?`scroll`:`auto`]}});function Ps(e){let[t,n]=L.useState(!1),r=typeof window>`u`?null:window,i=L.useRef(0);return qt(`touchstart`,L.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),qt(`touchend`,L.useCallback(t=>{t.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),e))},[e]),r,!0,!1),t}var Fs=e=>{let{children:t,clientHeight:n,scrollHeight:r,scrollWidth:i,update:a,draggable:o,className:s,preventDiagonalScrolling:c=!1,paddingBottom:l=0,paddingRight:u=0,rightElement:d,rightElementProps:f,kineticScrollPerfHack:p=!1,scrollRef:m,initialSize:h}=e,g=[],_=f?.sticky??!1,v=f?.fill??!1,y=L.useRef(0),b=L.useRef(0),x=L.useRef(null),S=typeof window>`u`?1:window.devicePixelRatio,C=L.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),w=L.useRef(null),T=Ps(200),[E,D]=L.useState(!0),O=L.useRef(0);L.useLayoutEffect(()=>{if(!E||T||C.current.lockDirection===void 0)return;let e=x.current;if(e===null)return;let[t,n]=C.current.lockDirection;t===void 0?n!==void 0&&(e.scrollTop=n):e.scrollLeft=t,C.current.lockDirection=void 0},[T,E]);let k=L.useCallback((e,t)=>{let n=x.current;if(n===null)return;t??=n.scrollTop,e??=n.scrollLeft;let i=C.current.scrollTop,o=C.current.scrollLeft,s=e-o,d=t-i;T&&s!==0&&d!==0&&(Math.abs(s)>3||Math.abs(d)>3)&&c&&C.current.lockDirection===void 0&&(C.current.lockDirection=Math.abs(s)0&&(Math.abs(g)>2e3||h===0||h===_)&&r>n.scrollHeight+5){let e=h/_,t=(r-m)*e;y.current=t-h}f!==void 0&&(window.clearTimeout(O.current),D(!1),O.current=window.setTimeout(()=>D(!0),200)),a({x:e,y:h+y.current,width:p-u,height:m-l,paddingRight:w.current?.clientWidth??0})},[l,u,r,a,c,T]);Ms(p&&_s.value,k,x);let A=L.useRef(k);A.current=k;let j=L.useRef(),M=L.useRef(!1);L.useLayoutEffect(()=>{M.current?k():M.current=!0},[k,l,u]);let ee=L.useCallback(e=>{x.current=e,m!==void 0&&(m.current=e)},[m]),N=0,te=0;for(g.push(L.createElement(`div`,{key:N++,style:{width:i,height:0}}));teA.current(),0),j.current={width:P,height:re}),(P??0)===0||(re??0)===0?L.createElement(`div`,{ref:ne}):L.createElement(`div`,{ref:ne},L.createElement(Ns,{isSafari:_s.value},L.createElement(`div`,{className:`dvn-underlay`},t),L.createElement(`div`,{ref:ee,style:j.current,draggable:o,onDragStart:e=>{o||(e.stopPropagation(),e.preventDefault())},className:`dvn-scroller `+(s??``),onScroll:()=>k()},L.createElement(`div`,{className:`dvn-scroll-inner`+(d===void 0?` dvn-hidden`:``)},L.createElement(`div`,{className:`dvn-stack`},g),d!==void 0&&L.createElement(L.Fragment,null,!v&&L.createElement(`div`,{className:`dvn-spacer`}),L.createElement(`div`,{ref:w,style:{height:re,maxHeight:n-Math.ceil(S%1),position:`sticky`,top:0,paddingLeft:1,marginBottom:-40,marginRight:u,flexGrow:v?1:void 0,right:_?u??0:void 0,pointerEvents:`auto`}},d))))))},Is=e=>{let{columns:t,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:a,enableGroups:o,freezeColumns:s,experimental:c,nonGrowWidth:l,clientSize:u,className:d,onVisibleRegionChanged:f,scrollRef:p,preventDiagonalScrolling:m,rightElement:h,rightElementProps:g,overscrollX:_,overscrollY:v,initialSize:y,smoothScrollX:b=!1,smoothScrollY:x=!1,isDraggable:S}=e,{paddingRight:C,paddingBottom:w}=c??{},[T,E]=u,D=L.useRef(),O=L.useRef(),k=L.useRef(),A=L.useRef(),j=l+Math.max(0,_??0),M=o?i+a:i;if(typeof r==`number`)M+=n*r;else for(let e=0;e{if(ee.current===void 0)return;let e={...ee.current},i=0,a=e.x<0?-e.x:0,o=0,c=0;e.x=e.x<0?0:e.x;let l=0;for(let e=0;e=t+n.width)i+=n.width,c++,o++;else if(e.x>t)i+=n.width,b?a+=t-e.x:c++,o++;else if(e.x+e.width>t)i+=n.width,o++;else break}let u=0,d=0,p=0;if(typeof r==`number`)x?(d=Math.floor(e.y/r),u=d*r-e.y):d=Math.ceil(e.y/r),p=Math.ceil(e.height/r)+d,u<0&&p++;else{let t=0;for(let i=0;i=t+n)t+=n,d++,p++;else if(e.y>a)t+=n,x?u+=a-e.y:d++,p++;else if(e.y+e.height>n/2+t)t+=n,p++;else break}}let m={x:c,y:d,width:o-c,height:p-d},h=D.current;(h===void 0||h.y!==m.y||h.x!==m.x||h.height!==m.height||h.width!==m.width||O.current!==a||k.current!==u||e.width!==A.current?.[0]||e.height!==A.current?.[1])&&(f?.({x:c,y:d,width:o-c,height:p-d},e.width,e.height,e.paddingRight??0,a,u),D.current=m,O.current=a,k.current=u,A.current=[e.width,e.height])},[t,r,n,f,s,b,x]),te=L.useCallback(e=>{ee.current=e,N()},[N]);return L.useEffect(()=>{N()},[N]),L.createElement(Fs,{scrollRef:p,className:d,kineticScrollPerfHack:c?.kineticScrollPerfHack,preventDiagonalScrolling:m,draggable:S===!0||typeof S==`string`,scrollWidth:j+(C??0),scrollHeight:M+(w??0),clientHeight:E,rightElement:h,paddingBottom:w,paddingRight:C,rightElementProps:g,update:te,initialSize:y},L.createElement(As,{eventTargetRef:p,width:T,height:E,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,onColumnProposeMove:e.onColumnProposeMove,verticalBorder:e.verticalBorder,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}))};St();var Ls=xt(`div`)({name:`SearchWrapper`,class:`gdg-seveqep`,propsAsIs:!1});ct(),E();var Rs=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 244l144-144 144 144M256 120v292`})),zs=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 268l144 144 144-144M256 392V100`})),Bs=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`32`,d:`M368 368L144 144M368 144L144 368`})),Vs=10,Hs=e=>{let{canvasRef:t,cellYOffset:n,rows:r,columns:i,searchInputRef:a,searchValue:o,searchResults:s,onSearchValueChange:c,getCellsForSelection:l,onSearchResultsChanged:u,showSearch:d=!1,onSearchClose:f}=e,[p]=L.useState(()=>`search-box-`+Math.round(Math.random()*1e3)),[m,h]=L.useState(``),g=o??m,_=L.useCallback(e=>{h(e),c?.(e)},[c]),[v,y]=L.useState(),b=L.useRef(v);b.current=v,L.useEffect(()=>{s!==void 0&&(s.length>0?y(e=>({rowsSearched:r,results:s.length,selectedIndex:e?.selectedIndex??-1})):y(void 0))},[r,s]);let S=L.useRef();S.current===void 0&&(S.current=new AbortController);let C=L.useRef(),[w,T]=L.useState([]),E=s??w,D=L.useCallback(()=>{C.current!==void 0&&(window.cancelAnimationFrame(C.current),C.current=void 0,S.current.abort())},[]),O=L.useRef(n);O.current=n;let k=L.useCallback(e=>{let t=new RegExp(e.replace(/([$()*+.?[\\\]^{|}-])/g,`\\$1`),`i`),n=O.current,a=Math.min(10,r),o=0;y(void 0),T([]);let s=[],c=async()=>{if(l===void 0)return;let e=performance.now(),d=r-o,f=l({x:0,y:n,width:i.length,height:Math.min(a,d,r-n)},S.current.signal);typeof f==`function`&&(f=await f());let p=!1;for(let[e,r]of f.entries())for(let[i,a]of r.entries()){let r;switch(a.kind){case I.Text:case I.Number:r=a.displayData;break;case I.Uri:case I.Markdown:r=a.data;break;case I.Boolean:r=typeof a.data==`boolean`?a.data.toString():void 0;break;case I.Image:case I.Bubble:r=a.data.join(`🐳`);break;case I.Custom:r=a.copyData;break}r!==void 0&&t.test(r)&&(s.push([i,e+n]),p=!0)}let m=performance.now();p&&T([...s]),o+=f.length,x(o<=r);let h=b.current?.selectedIndex??-1;y({results:s.length,rowsSearched:o,selectedIndex:h}),u?.(s,h),n+a>=r?n=0:n+=a;let g=m-e,_=Vs/Math.max(g,1);a=Math.ceil(a*_),o{f?.(),y(void 0),T([]),u?.([],-1),D(),t?.current?.focus()},[D,t,f,u]),j=L.useCallback(e=>{_(e.target.value),s===void 0&&(e.target.value===``?(y(void 0),T([]),D()):k(e.target.value))},[k,D,_,s]);L.useEffect(()=>{d&&a.current!==null&&(_(``),a.current.focus({preventScroll:!0}))},[d,a,_]);let M=L.useCallback(e=>{if(e?.stopPropagation?.(),v===void 0)return;let t=(v.selectedIndex+1)%v.results;y({...v,selectedIndex:t}),u?.(E,t)},[v,u,E]),ee=L.useCallback(e=>{if(e?.stopPropagation?.(),v===void 0)return;let t=(v.selectedIndex-1)%v.results;t<0&&(t+=v.results),y({...v,selectedIndex:t}),u?.(E,t)},[u,E,v]),N=L.useCallback(e=>{(e.ctrlKey||e.metaKey)&&e.nativeEvent.code===`KeyF`||e.key===`Escape`?(A(),e.stopPropagation(),e.preventDefault()):e.key===`Enter`&&(e.shiftKey?ee():M())},[A,M,ee]);L.useEffect(()=>()=>{D()},[D]);let[te,ne]=L.useState(!1);L.useEffect(()=>{if(d)ne(!0);else{let e=setTimeout(()=>ne(!1),150);return()=>clearTimeout(e)}},[d]);let P=L.useMemo(()=>{if(!d&&!te)return null;let e;v!==void 0&&(e=v.results>=1e3?`over 1000`:`${v.results} result${v.results===1?``:`s`}`,v.selectedIndex>=0&&(e=`${v.selectedIndex+1} of ${e}`));let t=e=>{e.stopPropagation()},n={width:`${Math.floor((v?.rowsSearched??0)/r*100)}%`};return L.createElement(Ls,{className:d?``:`out`,onMouseDown:t,onMouseMove:t,onMouseUp:t,onClick:t},L.createElement(`div`,{className:`gdg-search-bar-inner`},L.createElement(`input`,{id:p,"aria-hidden":!d,"data-testid":`search-input`,ref:a,onChange:j,value:g,tabIndex:d?void 0:-1,onKeyDownCapture:N}),L.createElement(`button`,{"aria-label":`Previous Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:ee,disabled:(v?.results??0)===0},Rs),L.createElement(`button`,{"aria-label":`Next Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:M,disabled:(v?.results??0)===0},zs),f!==void 0&&L.createElement(`button`,{"aria-label":`Close Search`,"aria-hidden":!d,"data-testid":`search-close-button`,tabIndex:d?void 0:-1,onClick:A},Bs)),v===void 0?L.createElement(`div`,{className:`gdg-search-status`},L.createElement(`label`,{htmlFor:p},`Type to search`)):L.createElement(L.Fragment,null,L.createElement(`div`,{className:`gdg-search-status`},L.createElement(`div`,{"data-testid":`search-result-area`},e)),L.createElement(`div`,{className:`gdg-search-progress`,style:n})))},[d,te,v,r,p,a,j,g,N,ee,M,f,A]);return L.createElement(L.Fragment,null,L.createElement(Is,{prelightCells:E,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,className:e.className,clientSize:e.clientSize,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,nonGrowWidth:e.nonGrowWidth,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,initialSize:e.initialSize,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,onVisibleRegionChanged:e.onVisibleRegionChanged,overscrollX:e.overscrollX,overscrollY:e.overscrollY,preventDiagonalScrolling:e.preventDiagonalScrolling,rightElement:e.rightElement,rightElementProps:e.rightElementProps,rowHeight:e.rowHeight,rows:e.rows,scrollRef:e.scrollRef,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,onColumnProposeMove:e.onColumnProposeMove,drawFocusRing:e.drawFocusRing,drawCell:e.drawCell,drawHeader:e.drawHeader,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}),P)},Us,Ws,Gs=o((()=>{Us=u(f(),1),Ws=class extends Us.PureComponent{wrapperRef=Us.createRef();componentDidMount(){document.addEventListener(`touchend`,this.clickOutside,!0),document.addEventListener(`mousedown`,this.clickOutside,!0),document.addEventListener(`contextmenu`,this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener(`touchend`,this.clickOutside,!0),document.removeEventListener(`mousedown`,this.clickOutside,!0),document.removeEventListener(`contextmenu`,this.clickOutside,!0)}clickOutside=e=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(e))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(e.target)){let t=e.target;for(;t!==null;){if(t.classList.contains(`click-outside-ignore`))return;t=t.parentElement}this.props.onClickOutside()}};render(){let{onClickOutside:e,isOutsideClick:t,...n}=this.props;return Us.createElement(`div`,{...n,ref:this.wrapperRef},this.props.children)}}}));St(),Gs();var Ks=xt(`input`)({name:`RenameInput`,class:`gdg-r17m35ur`,propsAsIs:!1,vars:{"r17m35ur-0":[e=>Math.max(16,e.targetHeight-10),`px`]}}),qs=e=>{let{bounds:t,group:n,onClose:r,canvasBounds:i,onFinish:a}=e,[o,s]=L.useState(n);return L.createElement(Ws,{style:{position:`absolute`,left:t.x-i.left+1,top:t.y-i.top,width:t.width-2,height:t.height},className:`gdg-c1tqibwd`,onClickOutside:r},L.createElement(Ks,{targetHeight:t.height,"data-testid":`group-rename-input`,value:o,onBlur:r,onFocus:e=>e.target.setSelectionRange(0,o.length),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?a(o):e.key===`Escape`&&r()},autoFocus:!0}))};function Js(e,t){return e===void 0?!1:e.length>1&&e.startsWith(`_`)?Number.parseInt(e.slice(1))===t.keyCode:e.length===1&&e>=`a`&&e<=`z`?e.toUpperCase().codePointAt(0)===t.keyCode:e===t.key}function Ys(e,t,n){let r=Xs(e,t);return r&&(n.didMatch=!0),r}function Xs(e,t){if(e.length===0)return!1;if(e.includes(`|`)){let n=e.split(`|`);for(let e of n)if(Xs(e,t))return!0;return!1}let n=!1,r=!1,i=!1,a=!1,o=e.split(`+`);if(!Js(o.pop(),t))return!1;if(o[0]===`any`)return!0;for(let e of o)switch(e){case`ctrl`:n=!0;break;case`shift`:r=!0;break;case`alt`:i=!0;break;case`meta`:a=!0;break;case`primary`:vs.value?a=!0:n=!0;break}return t.altKey===i&&t.ctrlKey===n&&t.shiftKey===r&&t.metaKey===a}ct();function Zs(e,t,n,r,i,a){return[L.useCallback((o,s,c,l)=>{(a===`cell`||a===`multi-cell`)&&o!==void 0&&(o={...o,range:{x:o.cell[0],y:o.cell[1],width:1,height:1}});let u=n===`mixed`&&(c||l===`drag`),d=r===`mixed`&&u,f=i===`mixed`&&u,p={current:o===void 0?void 0:{...o,rangeStack:l===`drag`?e.current?.rangeStack??[]:[]},columns:d?e.columns:st.empty(),rows:f?e.rows:st.empty()};c&&(a===`multi-rect`||a===`multi-cell`)&&p.current!==void 0&&e.current!==void 0&&(p={...p,current:{...p.current,rangeStack:[...e.current.rangeStack,e.current.range]}}),t(p,s)},[r,e,n,a,i,t]),L.useCallback((a,o,s)=>{a??=e.rows,o!==void 0&&(a=a.add(o));let c;if(i===`exclusive`&&a.length>0)c={current:void 0,columns:st.empty(),rows:a};else{let t=s&&n===`mixed`,i=s&&r===`mixed`;c={current:t?e.current:void 0,columns:i?e.columns:st.empty(),rows:a}}t(c,!1)},[r,e,n,i,t]),L.useCallback((a,o,s)=>{a??=e.columns,o!==void 0&&(a=a.add(o));let c;if(r===`exclusive`&&a.length>0)c={current:void 0,rows:st.empty(),columns:a};else{let t=s&&n===`mixed`,r=s&&i===`mixed`;c={current:t?e.current:void 0,rows:r?e.rows:st.empty(),columns:a}}t(c,!1)},[r,e,n,i,t])]}ct();function Qs(e,t,n,r,i){let a=L.useCallback(n=>{if(e===!0){let e=[];for(let r=n.y;r=i?a.push({kind:I.Loading,allowOverlay:!1}):a.push(t([e,r]));e.push(a)}return e}return e?.(n,r.signal)??[]},[r.signal,t,e,i]),o=e===void 0?void 0:a,s=L.useCallback(e=>{if(o===void 0)return[];let t={...e,x:e.x-n};if(t.x<0){t.x=0,t.width--;let e=o(t,r.signal);return typeof e==`function`?async()=>(await e()).map(e=>[{kind:I.Loading,allowOverlay:!1},...e]):e.map(e=>[{kind:I.Loading,allowOverlay:!1},...e])}return o(t,r.signal)},[r.signal,o,n]);return[e===void 0?void 0:s,o]}E(),ct();function $s(e){if(e.copyData!==void 0)return{formatted:e.copyData,rawValue:e.copyData,format:`string`};switch(e.kind){case I.Boolean:return{formatted:e.data===!0?`TRUE`:e.data===!1?`FALSE`:e.data===void 0?`INDETERMINATE`:``,rawValue:e.data,format:`boolean`};case I.Custom:return{formatted:e.copyData,rawValue:e.copyData,format:`string`};case I.Image:case I.Bubble:return{formatted:e.data,rawValue:e.data,format:`string-array`};case I.Drilldown:return{formatted:e.data.map(e=>e.text),rawValue:e.data.map(e=>e.text),format:`string-array`};case I.Text:return{formatted:e.displayData??e.data,rawValue:e.data,format:`string`};case I.Uri:return{formatted:e.displayData??e.data,rawValue:e.data,format:`url`};case I.Markdown:case I.RowID:return{formatted:e.data,rawValue:e.data,format:`string`};case I.Number:return{formatted:e.displayData,rawValue:e.data,format:`number`};case I.Loading:return{formatted:`#LOADING`,rawValue:``,format:`string`};case I.Protected:return{formatted:`************`,rawValue:``,format:`string`};default:S(e)}}function ec(e,t){return e.map((e,n)=>{let r=t[n];return e.map(e=>e.span!==void 0&&e.span[0]!==r?{formatted:``,rawValue:``,format:`string`}:$s(e))})}function tc(e,t){return(t?/[\t\n",]/:/[\t\n"]/).test(e)&&(e=`"${e.replace(/"/g,`""`)}"`),e}function nc(e){let t=[];for(let n of e){let e=[];for(let t of n)t.format===`url`?e.push(t.rawValue?.toString()??``):t.format===`string-array`?e.push(t.formatted.map(e=>tc(e,!0)).join(`,`)):e.push(tc(t.formatted,!1));t.push(e.join(` `))}return t.join(` -`)}function rc(e){return e.replace(/\t/g,` `).replace(/ {2,}/g,e=>` `.repeat(e.length))}function ic(e){return`"`+e.replace(/&/g,`&`).replace(/"/g,`"`).replace(//g,`>`)+`"`}function ac(e){return e.replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`)}function oc(e){let t=[];t.push(``,``);for(let n of e){t.push(``);for(let e of n){let n=`gdg-format="${e.format}"`;e.format===`url`?t.push(``):e.format===`string-array`?t.push(``):t.push(``)}t.push(``)}return t.push(`
${rc(e.formatted)}
    ${e.formatted.map((t,n)=>`
  1. `+rc(t)+`
  2. `).join(``)}
${rc(e.formatted)}
`),t.join(``)}function sc(e,t){let n=ec(e,t);return{textPlain:nc(n),textHtml:oc(n)}}function cc(e){let t=document.createElement(`html`);t.innerHTML=e.replace(/ /g,` `);let n=t.querySelector(`table`);if(n===null)return;let r=[n],i=[],a;for(;r.length>0;){let e=r.pop();if(e===void 0)break;if(e instanceof HTMLTableElement||e.nodeName===`TBODY`)r.push(...[...e.children].reverse());else if(e instanceof HTMLTableRowElement)a!==void 0&&i.push(a),a=[],r.push(...[...e.children].reverse());else if(e instanceof HTMLTableCellElement){let t=e.cloneNode(!0),n=t.children.length===1&&t.children[0].nodeName===`P`?t.children[0]:null,r=n?.children.length===1&&n.children[0].nodeName===`FONT`,i=t.querySelectorAll(`br`);for(let e of i)e.replaceWith(` -`);let o=t.getAttribute(`gdg-raw-value`),s=t.getAttribute(`gdg-format`)??`string`;if(t.querySelector(`a`)!==null)a?.push({rawValue:t.querySelector(`a`)?.getAttribute(`href`)??``,formatted:t.textContent??``,format:s});else if(t.querySelector(`ol`)!==null){let e=t.querySelectorAll(`li`);a?.push({rawValue:[...e].map(e=>e.getAttribute(`gdg-raw-value`)??``),formatted:[...e].map(e=>e.textContent??``),format:`string-array`})}else if(o!==null)a?.push({rawValue:ac(o),formatted:t.textContent??``,format:s});else{let e=t.textContent??``;r&&(e=e.replace(/\n(?!\n)/g,``)),a?.push({rawValue:e??``,formatted:e??``,format:s})}}}return a!==void 0&&i.push(a),i}function lc(e,t,n,r,i){let a=e;if(r===`allowPartial`||e.current===void 0||t===void 0)return e;let o=!1;do{if(e?.current===void 0)break;let r=e.current?.range,s=[];if(r.width>2){let e=t({x:r.x,y:r.y,width:1,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e);let n=t({x:r.x+r.width-1,y:r.y,width:1,height:r.height},i.signal);if(typeof n==`function`)return a;s.push(...n)}else{let e=t({x:r.x,y:r.y,width:r.width,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e)}let c=r.x-n,l=r.x+r.width-1-n;for(let e of s)for(let t of e)t.span!==void 0&&(c=Math.min(t.span[0],c),l=Math.max(t.span[1],l));c===r.x-n&&l===r.x+r.width-1-n?o=!0:e={current:{cell:e.current.cell??[0,0],range:{x:c+n,y:r.y,width:l-c+1,height:r.height},rangeStack:e.current.rangeStack},columns:e.columns,rows:e.rows}}while(!o);return e}function uc(e){return e.startsWith(`"`)&&e.endsWith(`"`)&&(e=e.slice(1,-1).replace(/""/g,`"`)),e}function dc(e){let t;(function(e){e[e.None=0]=`None`,e[e.inString=1]=`inString`,e[e.inStringPostQuote=2]=`inStringPostQuote`})(t||={});let n=[],r=[],i=0,a=t.None;e=e.replace(/\r\n/g,` +`}};function eee(e,t){return e===`normal`?[t.bgIconHeader,t.fgIconHeader]:e===`selected`?[`white`,t.accentColor]:[t.accentColor,t.bgHeader]}var fa=class{onSettled;spriteMap=new Map;headerIcons;inFlight=0;constructor(e,t){this.onSettled=t,this.headerIcons=e??{}}drawSprite(e,t,n,r,i,a,o,s=1){let[c,l]=eee(t,o),u=a*Math.ceil(window.devicePixelRatio),d=`${c}_${l}_${u}_${e}`,f=this.spriteMap.get(d);if(f===void 0){let t=this.headerIcons[e];if(t===void 0)return;f=document.createElement(`canvas`);let n=f.getContext(`2d`);if(n===null)return;let r=new Image;r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t({fgColor:l,bgColor:c}))}`,this.spriteMap.set(d,f);let i=r.decode();if(i===void 0)return;this.inFlight++,i.then(()=>{n.drawImage(r,0,0,u,u)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else s<1&&(n.globalAlpha=s),n.drawImage(f,0,0,u,u,r,i,a,a),s<1&&(n.globalAlpha=1)}};function pa(e){if(e.length===0)return;let t;for(let n of e)t=Math.min(t??n.y,n.y)}function ma(e,t,n,r,i,a,o,s,c){s??=t;let l=t,u=e,d=r-a,f=!1;for(;ls&&c(l,u,e,!1,o&&u===r-1)===!0){f=!0;break}l+=e,u++}if(!f){l=n;for(let e=0;e!e.sticky)?.sourceIndex??0;if(c>d){let e=Math.max(s,d),l=t,f=r;for(let t=a.sourceIndex-1;t>=e;t--)l-=o[t].width,f+=o[t].width;for(let e=a.sourceIndex+1;e<=c;e++)f+=o[e].width;u={x:l,y:n,width:f,height:i}}if(d>s){let e=Math.min(c,d-1),u=t,f=r;for(let e=a.sourceIndex-1;e>=s;e--)u-=o[e].width,f+=o[e].width;for(let t=a.sourceIndex+1;t<=e;t++)f+=o[t].width;l={x:u,y:n,width:f,height:i}}return[l,u]}function va(e,t,n,r){if(r===`any`)return xa(e,{x:t,y:n,width:1,height:1});if(r===`vertical`&&(t=e.x),r===`horizontal`&&(n=e.y),Mr([t,n],e))return;let i=t-e.x,a=e.x+e.width-t,o=n-e.y+1,s=e.y+e.height-n,c=Math.min(r===`vertical`?2**53-1:i,r===`vertical`?2**53-1:a,r===`horizontal`?2**53-1:o,r===`horizontal`?2**53-1:s);return c===s?{x:e.x,y:e.y+e.height,width:e.width,height:n-e.y-e.height+1}:c===o?{x:e.x,y:n,width:e.width,height:e.y-n}:c===a?{x:e.x+e.width,y:e.y,width:t-e.x-e.width+1,height:e.height}:{x:t,y:e.y,width:e.x-t,height:e.height}}function ya(e,t,n,r,i,a,o,s){return e<=i+o&&i<=e+n&&t<=a+s&&a<=t+r}function ba(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function xa(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function Sa(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function Ca(e,t,n,r){if(e.x>t||e.y>n||e.x<0&&e.y<0&&e.x+e.width>t&&e.y+e.height>n)return;if(e.x>=0&&e.y>=0&&e.x+e.width<=t&&e.y+e.height<=n)return e;let i=t+4,a=n+4,o=-4-e.x,s=e.x+e.width-i,c=-4-e.y,l=e.y+e.height-a,u=o>0?e.x+Math.floor(o/r)*r:e.x,d=s>0?e.x+e.width-Math.floor(s/r)*r:e.x+e.width,f=c>0?e.y+Math.floor(c/r)*r:e.y,p=l>0?e.y+e.height-Math.floor(l/r)*r:e.y+e.height;return{x:u,y:f,width:d-u,height:p-f}}function wa(e,t,n,r,i){let[a,o,s,c]=t,[l,u,d,f]=i,{x:p,y:m,width:h,height:g}=e,_=[];if(h<=0||g<=0)return _;let v=p+h,y=m+g,b=ps,C=m+g>c,w=p>=a&&pa&&v<=s||ps,T=m>=o&&mo&&y<=c||mc;if(w&&T){let e=Math.max(p,a),t=Math.max(m,o),n=Math.min(v,s),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:u,width:d-l+1,height:f-u+1}})}if(b&&x){let e=p,t=m,n=Math.min(v,a),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:0,width:l+1,height:u+1}})}if(x&&w){let e=Math.max(p,a),t=m,n=Math.min(v,s),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:0,width:d-l+1,height:u+1}})}if(x&&S){let e=Math.max(p,s),t=m,r=v,i=Math.min(y,o);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:0,width:n-d+1,height:u+1}})}if(b&&T){let e=p,t=Math.max(m,o),n=Math.min(v,a),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:u,width:l+1,height:f-u+1}})}if(S&&T){let e=Math.max(p,s),t=Math.max(m,o),r=v,i=Math.min(y,c);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:u,width:n-d+1,height:f-u+1}})}if(b&&C){let e=p,t=Math.max(m,c),n=Math.min(v,a),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:0,y:f,width:l+1,height:r-f+1}})}if(C&&w){let e=Math.max(p,a),t=Math.max(m,c),n=Math.min(v,s),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:l,y:f,width:d-l+1,height:r-f+1}})}if(S&&C){let e=Math.max(p,s),t=Math.max(m,c),i=v,a=y;_.push({rect:{x:e,y:t,width:i-e,height:a-t},clip:{x:d,y:f,width:n-d+1,height:r-f+1}})}return _}ct(),Ti(),vr();var Ta={kind:I.Loading,allowOverlay:!1};function Ea(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,ee,N){let te=y?.size??2**53-1,ne=performance.now(),P=k.baseFontFull;e.font=P;let re={ctx:e},F=[0,0],ie=g>0?zr(c,g,l):0,ae,oe,se=pa(v);return ha(t,s,a,o,i,(t,a,o,s,ce)=>{let le=Math.max(0,s-a),ue=a+le,de=i+1,fe=t.width-le,pe=r-i-1;if(v.length>0){let e=!1;for(let t=0;t{e.save(),e.beginPath(),e.rect(ue,de,fe,pe),e.clip()},he=b.columns.hasIndex(t.sourceIndex),ge=d(t.group??``).overrideTheme,_e=t.themeOverride===void 0&&ge===void 0?k:xi(k,ge,t.themeOverride),ve=_e.baseFontFull;ve!==P&&(P=ve,e.font=ve),me();let ye;return ma(ce,o,r,c,l,g,_,se,(i,o,l,d,g)=>{if(o<0||(F[0]=t.sourceIndex,F[1]=o,y!==void 0&&!y.has(F)))return;if(v.length>0){let e=!1;for(let n=0;nce.span!==void 0&&e>=ce.span[0]&&e<=ce.span[1]);xe&&!m&&h?Se=0:xe&&h&&(Se=Math.max(Se,1)),Ce&&Se++,xe||(_&&Se++,he&&!g&&Se++);let we=ce.kind===I.Protected?be.bgCellMedium:be.bgCell,Te;if((d||we!==k.bgCell)&&(Te=mr(we,Te)),Se>0||se){se&&(Te=mr(be.bgHeader,Te));for(let e=0;eN&&!fe){let n=be.baseFontFull;n!==P&&(e.font=n,P=n),ye=Ma(e,ce,t.sourceIndex,o,De,Oe,le,i,ue,l,Se>0,be,Te??be.bgCell,C,w,ke?.hoverAmount??0,E,O,ne,D,ye,A,j,M,ee)}return Ee&&e.restore(),ce.style===`faded`&&(e.globalAlpha=1),te--,de&&(e.restore(),ye?.deprep?.(re),ye=void 0,me(),P=ve,e.font=ve),te<=0}),e.restore(),te<=0}),ae}var Da=[0,0],Oa={x:0,y:0,width:0,height:0},ka=[void 0,()=>void 0],Aa=!1;function ja(){Aa=!0}function Ma(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w){let T,E;g!==void 0&&g[0][0]===n&&g[0][1]===r&&(T=g[1][0],E=g[1][1]);let D;Da[0]=n,Da[1]=r,Oa.x=o,Oa.y=s,Oa.width=c,Oa.height=l,ka[0]=S.getValue(Da),ka[1]=e=>S.setValue(Da,e),Aa=!1;let O={ctx:e,theme:d,col:n,row:r,cell:t,rect:Oa,highlighted:u,cellFillColor:f,hoverAmount:h,frameTime:v,hoverX:T,drawState:ka,hoverY:E,imageLoader:p,spriteManager:m,hyperWrapping:_,overrideCursor:T===void 0?void 0:w,requestAnimationFrame:ja},k=ei(O,t.lastUpdated,v,b,i,a),A=C(t);if(A!==void 0){b?.renderer!==A&&(b?.deprep?.(O),b=void 0);let e=A.drawPrep?.(O,b);y!==void 0&&!Ze(O.cell)?y(O,()=>A.draw(O,t)):A.draw(O,t),D=e===void 0?void 0:{deprep:e?.deprep,fillStyle:e?.fillStyle,font:e?.font,renderer:A}}return(k||Aa)&&x?.(Da),D}E(),ct();function Na(e,t,n,r,i,a,o,s,c=-20,l=-20,u=32,d=`center`,f=`square`){let p=Math.floor(i+o/2),m=f===`circle`?1e4:t.roundingRadius??4,h=$t(u,o,t.cellVerticalPadding),g=h/2,_=Qt(d,r,a,t.cellHorizontalPadding,h),v=Zt(_,p,h),y=en(r+c,i+l,v);switch(n){case!0:e.beginPath(),si(e,_-h/2,p-h/2,h,h,m),f===`circle`&&(g*=.8,h*=.8),e.fillStyle=s?t.accentColor:t.textMedium,e.fill(),e.beginPath(),e.moveTo(_-g+h/4.23,p-g+h/1.97),e.lineTo(_-g+h/2.42,p-g+h/1.44),e.lineTo(_-g+h/1.29,p-g+h/3.25),e.strokeStyle=t.bgCell,e.lineJoin=`round`,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;case null:case!1:e.beginPath(),si(e,_-h/2+.5,p-h/2+.5,h-1,h-1,m),e.lineWidth=1,e.strokeStyle=y?t.textDark:t.textMedium,e.stroke();break;case void 0:e.beginPath(),si(e,_-h/2,p-h/2,h,h,m),e.fillStyle=y?t.textMedium:t.textLight,e.fill(),f===`circle`&&(g*=.8,h*=.8),e.beginPath(),e.moveTo(_-h/3,p),e.lineTo(_+h/3,p),e.strokeStyle=t.bgCell,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;default:S(n)}}Ti(),vr(),ct();function Pa(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=o+s;if(y<=0)return;e.fillStyle=d.bgHeader,e.fillRect(0,0,i,y);let[b,x]=r?.[0]??[];e.font=d.headerFontFull,ha(t,0,a,0,y,(t,r,i,a)=>{if(g!==void 0&&!g.has([t.sourceIndex,-1]))return;let m=Math.max(0,a-r);e.save(),e.beginPath(),e.rect(r+m,s,t.width-m,o),e.clip();let y=h(t.group??``).overrideTheme,S=t.themeOverride===void 0&&y===void 0?d:xi(d,y,t.themeOverride);S.bgHeader!==d.bgHeader&&(e.fillStyle=S.bgHeader,e.fill()),S!==d&&(e.font=S.baseFontFull);let C=u.columns.hasIndex(t.sourceIndex),w=c!==void 0||l,T=!w&&x===-1&&b===t.sourceIndex,E=w?0:p.find(e=>e.item[0]===t.sourceIndex&&e.item[1]===-1)?.hoverAmount??0,D=u?.current!==void 0&&u.current.cell[0]===t.sourceIndex,O=C?S.accentColor:D?S.bgHeaderHasFocus:S.bgHeader,k=n?s:0,A=t.sourceIndex===0?0:1;C?(e.fillStyle=O,e.fillRect(r+A,k,t.width-A,o)):(D||E>0)&&(e.beginPath(),e.rect(r+A,k,t.width-A,o),D&&(e.fillStyle=S.bgHeaderHasFocus,e.fill()),E>0&&(e.globalAlpha=E,e.fillStyle=S.bgHeaderHovered,e.fill(),e.globalAlpha=1)),Ba(e,r,k,t.width,o,t,C,S,T,D,E,f,_,v),e.restore()}),n&&Fa(e,t,i,a,s,r,d,f,p,m,h,g)}function Fa(e,t,n,r,i,a,o,s,c,l,u,d){let[f,p]=a?.[0]??[],m=0;ga(t,n,r,i,(t,n,r,c,h,g)=>{if(d!==void 0&&!d.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1}))return;e.save(),e.beginPath(),e.rect(r,c,h,g),e.clip();let _=u(n),v=_?.overrideTheme===void 0?o:xi(o,_.overrideTheme),y=p===-2&&f!==void 0&&f>=t[0]&&f<=t[1],b=y?v.bgHeaderHovered:v.bgHeader;if(b!==o.bgHeader&&(e.fillStyle=b,e.fill()),e.fillStyle=v.textGroupHeader??v.textHeader,_!==void 0){let t=r;if(_.icon!==void 0&&(s.drawSprite(_.icon,`normal`,e,t+8,(i-20)/2,20,v),t+=26),e.fillText(_.name,t+8,i/2+Xr(e,o.headerFontFull)),_.actions!==void 0&&y){let t=Ra({x:r,y:c,width:h,height:g},_.actions);e.beginPath();let n=t[0].x-10,o=r+h-n;e.rect(n,0,o,i);let l=e.createLinearGradient(n,0,n+o,0),u=fr(b,0);l.addColorStop(0,u),l.addColorStop(10/o,b),l.addColorStop(1,b),e.fillStyle=l,e.fill(),e.globalAlpha=.6;let[d,f]=a?.[1]??[-1,-1];for(let n=0;n<_.actions.length;n++){let i=_.actions[n],a=t[n],o=ba(a,d+r,f);o&&(e.globalAlpha=1),s.drawSprite(i.icon,`normal`,e,a.x+a.width/2-10,a.y+a.height/2-10,20,v),o&&(e.globalAlpha=.6)}e.globalAlpha=1}}r!==0&&l(t[0])&&(e.beginPath(),e.moveTo(r+.5,0),e.lineTo(r+.5,i),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()),e.restore(),m=r+h}),e.beginPath(),e.moveTo(m+.5,0),e.lineTo(m+.5,i),e.moveTo(0,i+.5),e.lineTo(n,i+.5),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()}var Ia=30;function La(e,t,n,r,i){return i?{x:e,y:t,width:Ia,height:Math.min(Ia,r)}:{x:e+n-Ia,y:Math.max(t,t+r/2-Ia/2),width:Ia,height:Math.min(Ia,r)}}function Ra(e,t){let n=[],r=e.x+e.width-26*t.length,i=e.y+e.height/2-13;for(let e=0;e35){let n=f?35:r-35,i=f?35*.7:r-35*.7,a=n/r,o=i/r,s=e.createLinearGradient(t,0,t+r,0),c=fr(h,0);s.addColorStop(+!!f,h),s.addColorStop(a,h),s.addColorStop(o,c),s.addColorStop(+!f,c),e.fillStyle=s}else e.fillStyle=h;if(f&&(e.textAlign=`right`),e.fillText(a.title,v,n+i/2+Xr(e,s.headerFontFull)),f&&(e.textAlign=`left`),g&&a.hasMenu===!0)if(a.menuIcon===void 0||a.menuIcon===it.Triangle){e.beginPath();let t=p.x+p.width/2-5.5,n=p.y+p.height/2-3;li(e,[{x:t,y:n},{x:t+11,y:n},{x:t+5.5,y:n+6}],1),e.fillStyle=h,e.fill()}else if(a.menuIcon===it.Dots)e.beginPath(),ci(e,p.x+p.width/2,p.y+p.height/2),e.fillStyle=h,e.fill();else{let t=p.x+(p.width-s.headerIconSize)/2,n=p.y+(p.height-s.headerIconSize)/2;u.drawSprite(a.menuIcon,`normal`,e,t,n,s.headerIconSize,s)}}function Ba(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=R(a.title)===`rtl`,h=La(t,n,r,i,m);f===void 0?za(e,t,n,r,i,a,o,s,c,u,d,p,m,h):f({ctx:e,theme:s,rect:{x:t,y:n,width:r,height:i},column:a,columnIndex:a.sourceIndex,isSelected:o,hoverAmount:u,isHovered:c,hasSelectedCell:l,spriteManager:d,menuBounds:h},()=>za(e,t,n,r,i,a,o,s,c,u,d,p,m,h))}var Va=s(((e,t)=>{var n=le();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),Ha=s(((e,t)=>{var n=Va();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),Ua=s(((e,t)=>{function n(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),Ga=s(((e,t)=>{t.exports=Wa()()})),Ka=s(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{function n(){return!1}t.exports=n})),Ja=s(((e,t)=>{var n=A(),r=qa(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Ya=s(((e,t)=>{var n=N(),r=We(),i=te(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Xa=s(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),Za=s(((e,t)=>{var n=k(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),Qa=s(((e,t)=>{var n=Ya(),r=Xa(),i=Za(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),$a=s(((e,t)=>{var n=Ka(),r=He(),i=O(),a=Ja(),o=Ue(),s=Qa(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),eo=s(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),to=s(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),no=s(((e,t)=>{t.exports=to()(Object.keys,Object)})),ro=s(((e,t)=>{var n=eo(),r=no(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),io=s(((e,t)=>{var n=$a(),r=ro(),i=$i();function a(e){return i(e)?n(e):r(e)}t.exports=a})),ao=s(((e,t)=>{var n=Ga(),r=io();function i(e,t){return e&&n(e,t,r)}t.exports=i})),oo=s(((e,t)=>{var n=$i();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=ao();t.exports=oo()(n)})),co=s(((e,t)=>{var n=so();function r(e,t,r,i){return n(e,function(e,n,a){t(i,e,r(e),a)}),i}t.exports=r})),lo=s(((e,t)=>{var n=we();function r(){this.__data__=new n,this.size=0}t.exports=r})),uo=s(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),fo=s(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),po=s(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),mo=s(((e,t)=>{var n=we(),r=Te(),i=Ne(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=we(),r=lo(),i=uo(),a=fo(),o=po(),s=mo();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),go=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=Pi(),r=go(),i=Vi(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=A().Uint8Array})),yo=s(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),bo=s(((e,t)=>{var n=j(),r=vo(),i=ve(),a=_o(),o=yo(),s=Wi(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),xo=s(((e,t)=>{var n=Ji(),r=O();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),So=s(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),wo=s(((e,t)=>{var n=So(),r=Co(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),To=s(((e,t)=>{var n=xo(),r=wo(),i=io();function a(e){return n(e,i,r)}t.exports=a})),Eo=s(((e,t)=>{var n=To(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=le()(A(),`DataView`)})),Oo=s(((e,t)=>{t.exports=le()(A(),`Promise`)})),ko=s(((e,t)=>{t.exports=le()(A(),`WeakMap`)})),Ao=s(((e,t)=>{var n=Do(),r=Te(),i=Oo(),a=Hi(),o=ko(),s=N(),c=oe(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),jo=s(((e,t)=>{var n=ho(),r=_o(),i=bo(),a=Eo(),o=Ao(),s=O(),c=Ja(),l=Qa(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),Mo=s(((e,t)=>{var n=jo(),r=te();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),No=s(((e,t)=>{var n=ho(),r=Mo(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=re();function r(e){return e===e&&!n(e)}t.exports=r})),Fo=s(((e,t)=>{var n=Po(),r=io();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),Io=s(((e,t)=>{function n(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),tee=s(((e,t)=>{var n=No(),r=Fo(),i=Io();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),Lo=s(((e,t)=>{var n=Be(),r=Ge();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=Lo();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),zo=s(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),Bo=s(((e,t)=>{var n=zo(),r=Ke();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),Vo=s(((e,t)=>{var n=Mo(),r=Ro(),i=Bo(),a=P(),o=Po(),s=Io(),c=Ge(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),Ho=s(((e,t)=>{function n(e){return e}t.exports=n})),Uo=s(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),Wo=s(((e,t)=>{var n=Lo();function r(e){return function(t){return n(t,e)}}t.exports=r})),Go=s(((e,t)=>{var n=Uo(),r=Wo(),i=P(),a=Ge();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),Ko=s(((e,t)=>{var n=tee(),r=Vo(),i=Ho(),a=O(),o=Go();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),qo=s(((e,t)=>{var n=Ua(),r=co(),i=Ko(),a=O();function o(e,t){return function(o,s){var c=a(o)?n:r,l=t?t():{};return c(o,e,i(s,2),l)}}t.exports=o})),Jo=u(s(((e,t)=>{var n=Ha(),r=qo(),i=Object.prototype.hasOwnProperty;t.exports=r(function(e,t,r){i.call(e,r)?e[r].push(t):n(e,r,[t])})}))(),1);Ti(),vr();function Yo(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){if(_!==void 0||t[t.length-1]!==n[t.length-1])return;let y=pa(g);ha(t,c,o,s,a,(n,o,s,c,_)=>{if(n!==t[t.length-1])return;o+=n.width;let b=Math.max(o,c);b>r||(e.save(),e.beginPath(),e.rect(b,a+1,1e4,i-a-1),e.clip(),ma(_,s,i,l,u,m,h,y,(t,n,r,i)=>{if(!i&&g.length>0&&!g.some(e=>ya(o,t,1e4,r,e.x,e.y,e.width,e.height)))return;let a=f.hasIndex(n),s=p.hasIndex(n);e.beginPath();let c=d?.(n),l=c===void 0?v:xi(v,c);l.bgCell!==v.bgCell&&(e.fillStyle=l.bgCell,e.fillRect(o,t,1e4,r)),s&&(e.fillStyle=l.bgHeader,e.fillRect(o,t,1e4,r)),a&&(e.fillStyle=l.accentLight,e.fillRect(o,t,1e4,r))}),e.restore())})}function Xo(e,t,n,r,i,a,o,s,c){let l=!1;for(let e of t)if(!e.sticky){l=o(e.sourceIndex);break}let u=c.horizontalBorderColor??c.borderColor,d=c.borderColor,f=l?Rr(t):0,p;if(f!==0&&(p=pr(d,c.bgCell),e.beginPath(),e.moveTo(f+.5,0),e.lineTo(f+.5,r),e.strokeStyle=p,e.stroke()),i>0){let t=d===u&&p!==void 0?p:pr(u,c.bgCell),o=zr(a,i,s);e.beginPath(),e.moveTo(0,r-o+.5),e.lineTo(n,r-o+.5),e.strokeStyle=t,e.stroke()}}var Zo=(e,t,n)=>{let r=0,i=t,a=0,o=n;if(e!==void 0&&e.length>0){r=2**53-1,a=2**53-1,i=-(2**53-1),o=-(2**53-1);for(let t of e)r=Math.min(r,t.x-1),i=Math.max(i,t.x+t.width+1),a=Math.min(a,t.y-1),o=Math.max(o,t.y+t.height+1)}return{minX:r,maxX:i,minY:a,maxY:o}};function Qo(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=m.bgCell,{minX:g,maxX:_,minY:v,maxY:y}=Zo(s,a,o),b=[],x=o-zr(p,f,l),S=c,C=n,w=0;for(;S+i=v&&e<=y-1){let n=u?.(C)?.bgCell;n!==void 0&&n!==h&&C>=p-f&&b.push({x:g,y:e,w:_-g,h:t,color:n})}S+=t,C0)for(let e=0;e=g&&i<=_&&d(e+1)&&b.push({x:i,y:w,w:n.width,h:E,color:a}),T+=n.width}if(b.length===0)return;let D;e.beginPath();for(let t=b.length-1;t>=0;t--){let n=b[t];D===void 0?D=n.color:n.color!==D&&(e.fillStyle=D,e.fill(),e.beginPath(),D=n.color),e.rect(n.x,n.y,n.w,n.h)}D!==void 0&&(e.fillStyle=D,e.fill()),e.beginPath()}function $o(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=!1){if(c!==void 0){e.beginPath(),e.save(),e.rect(0,0,a,o);for(let t of c)e.rect(t.x+1,t.y+1,t.width-1,t.height-1);e.clip(`evenodd`)}let v=g.horizontalBorderColor??g.borderColor,y=g.borderColor,{minX:b,maxX:x,minY:S,maxY:C}=Zo(s,a,o),w=[];e.beginPath();let T=.5;for(let e=0;e=b&&i<=x&&p(e+1)&&w.push({x1:i,y1:Math.max(l,S),x2:i,y2:Math.min(o,C),color:y})}let E=o+.5;for(let e=h-m;e=S&&n<=C-1){let e=f?.(t);w.push({x1:b,y1:n,x2:x,y2:n,color:e?.horizontalBorderColor??e?.borderColor??v})}e+=d(t),t++}}let D=(0,Jo.default)(w,e=>e.color);for(let t of Object.keys(D)){e.strokeStyle=t;for(let n of D[t])e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke(),e.beginPath()}c!==void 0&&e.restore()}E();function es(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=[];e.imageSmoothingEnabled=!1;let b=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o),S=0;if(typeof _==`number`)S+=(x-b)*_;else for(let e=b;ei.cellYOffset&&(S=-S),S+=c-i.translateY;let C=Math.min(i.cellXOffset,a),w=Math.max(i.cellXOffset,a),T=0;for(let e=C;ei.cellXOffset&&(T=-T),T+=s-i.translateX;let E=Rr(g);if(T!==0&&S!==0)return{regions:[]};let D=l>0?zr(f,l,_):0,O=u-E-Math.abs(T),k=d-p-D-Math.abs(S)-1;if(O>150&&k>150){let i={sx:0,sy:0,sw:u*m,sh:d*m,dx:0,dy:0,dw:u*m,dh:d*m};if(S>0?(i.sy=(p+1)*m,i.sh=k*m,i.dy=(S+p+1)*m,i.dh=k*m,y.push({x:0,y:p,width:u,height:S+1})):S<0&&(i.sy=(-S+p+1)*m,i.sh=k*m,i.dy=(p+1)*m,i.dh=k*m,y.push({x:0,y:d+S-D,width:u,height:-S+D})),T>0?(i.sx=E*m,i.sw=O*m,i.dx=(T+E)*m,i.dw=O*m,y.push({x:E-1,y:0,width:T+2,height:d})):T<0&&(i.sx=(E-T)*m,i.sw=O*m,i.dx=E*m,i.dw=O*m,y.push({x:u+T,y:0,width:-T,height:d})),e.setTransform(1,0,0,1,0,0),v){if(E>0&&T!==0&&S===0&&(r===void 0||n?.[1]!==!1)){let n=E*m,r=d*m;e.drawImage(t,0,0,n,r,0,0,n,r)}if(D>0&&T===0&&S!==0&&(r===void 0||n?.[0]!==!1)){let n=(d-D)*m,r=u*m,i=D*m;e.drawImage(t,0,n,r,i,0,n,r,i)}}e.drawImage(t,i.sx,i.sy,i.sw,i.sh,i.dx,i.dy,i.dw,i.dh),e.scale(m,m)}return e.imageSmoothingEnabled=!0,{regions:y}}function ts(e,t,n,r,i,a,o,s,c,l){let u=[];return t!==e.cellXOffset||n!==e.cellYOffset||r!==e.translateX||i!==e.translateY||ha(c,n,r,i,s,(e,t,n,r)=>{if(e.sourceIndex===l){let e=Math.max(t,r)+1;return u.push({x:e,y:0,width:a-e,height:o}),!0}}),u}function ns(e,t){if(t===void 0||e.width!==t.width||e.height!==t.height||e.theme!==t.theme||e.headerHeight!==t.headerHeight||e.rowHeight!==t.rowHeight||e.rows!==t.rows||e.freezeColumns!==t.freezeColumns||e.getRowThemeOverride!==t.getRowThemeOverride||e.isFocused!==t.isFocused||e.isResizing!==t.isResizing||e.verticalBorder!==t.verticalBorder||e.getCellContent!==t.getCellContent||e.highlightRegions!==t.highlightRegions||e.selection!==t.selection||e.dragAndDropState!==t.dragAndDropState||e.prelightCells!==t.prelightCells||e.touchMode!==t.touchMode||e.maxScaleFactor!==t.maxScaleFactor)return!1;if(e.mappedColumns!==t.mappedColumns){if(e.mappedColumns.length>100||e.mappedColumns.length!==t.mappedColumns.length)return!1;let n;for(let r=0;re.style!==`no-outline`);if(g===void 0||g.length===0)return;let _=Rr(s),v=zr(p,f,d),y=[c,0,s.length,p-f],b=[_,0,t,n-v],x=g.map(e=>{let m=e.range,h=e.style??`dashed`;return wa(m,y,t,n,b).map(m=>{let g=m.rect,_=ui(g.x,g.y,t,n,u,l+u,r,i,a,o,p,c,f,s,d),v=g.width===1&&g.height===1?_:ui(g.x+g.width-1,g.y+g.height-1,t,n,u,l+u,r,i,a,o,p,c,f,s,d);return g.x+g.width>=s.length&&--v.width,g.y+g.height>=p&&--v.height,{color:e.color,style:h,clip:m.clip,rect:Ca({x:_.x,y:_.y,width:v.x+v.width-_.x,height:v.y+v.height-_.y},t,n,8)}})}),S=()=>{e.lineWidth=1;let r=!1;for(let i of x)for(let a of i)if(a?.rect!==void 0&&ya(0,0,t,n,a.rect.x,a.rect.y,a.rect.width,a.rect.height)){let t=r,n=!Sa(a.clip,a.rect);n&&(e.save(),e.rect(a.clip.x,a.clip.y,a.clip.width,a.clip.height),e.clip()),a.style===`dashed`&&!r?(e.setLineDash([5,3]),r=!0):(a.style===`solid`||a.style===`solid-outline`)&&r&&(e.setLineDash([]),r=!1),e.strokeStyle=a.style===`solid-outline`?mr(mr(a.color,h.borderColor),h.bgCell):fr(a.color,1),e.strokeRect(a.rect.x+.5,a.rect.y+.5,a.rect.width-1,a.rect.height-1),n&&(e.restore(),r=t)}r&&e.setLineDash([])};return S(),S}function is(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.lineWidth=2,e.strokeStyle=i,e.stroke(),e.globalAlpha=1}function as(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){if(u.current===void 0)return;let _=u.current.range,v=u.current.cell,y=[_.x+_.width-1,_.y+_.height-1];if(v[1]>=g&&y[1]>=g||!o.some(e=>e.sourceIndex===v[0]||e.sourceIndex===y[0]))return;let[b,x]=u.current.cell,S=f(u.current.cell),C=S.span??[b,b],w=x>=g-p,T=p>0&&!w?zr(g,p,d)-1:0,E=y[1],D;if(ha(o,r,i,a,l,(r,i,a,o,l)=>{if(r.sticky&&b>r.sourceIndex)return;let u=r.sourceIndexC[1],_=r.sourceIndex===y[0];if(!(!_&&(u||f)))return ma(l,a,n,g,d,p,m,void 0,(a,l,u)=>{if(l!==x&&l!==E)return;let d=i,f=r.width;if(S.span!==void 0){let e=_a(S.span,i,a,r.width,u,r,s),t=r.sticky?e[0]:e[1];t!==void 0&&(d=t.x,f=t.width)}return l===E&&_&&h&&(D=()=>{o>d&&!r.sticky&&(e.beginPath(),e.rect(o,0,t-o,n),e.clip()),e.beginPath(),e.rect(d+f-4,a+u-4,4,4),e.fillStyle=r.themeOverride?.accentColor??c.accentColor,e.fill()}),D!==void 0}),D!==void 0}),D===void 0)return;let O=()=>{e.save(),e.beginPath(),e.rect(0,l,t,n-l-T),e.clip(),D?.(),e.restore()};return O(),O}vr(),E();function os(e,t,n,r,i,a,o,s,c){c===void 0||c.size===0||(e.beginPath(),ga(t,n,a,r,(t,n,r,i,a,o)=>{c.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1})&&e.rect(r,i,a,o)}),ha(t,s,a,o,i,(t,n,a,o)=>{let s=Math.max(0,o-n),l=n+s+1,u=t.width-s-1;c.has([t.sourceIndex,-1])&&e.rect(l,r,u,i-r)}),e.clip())}function ss(e,t,n,r,i,a,o,s,c,l){let u=0;return ha(e,a,r,i,n,(e,n,r,i,a)=>(ma(a,r,t,o,s,c,l,void 0,(e,t,n,r)=>{r||(u=Math.max(t,u))}),!0)),u}function cs(e,t){let{canvasCtx:n,headerCanvasCtx:r,width:i,height:a,cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mappedColumns:u,enableGroups:d,freezeColumns:f,dragAndDropState:p,theme:m,drawFocus:h,headerHeight:g,groupHeaderHeight:_,disabledRows:v,rowHeight:y,verticalBorder:b,overrideCursor:S,isResizing:C,selection:w,fillHandle:T,freezeTrailingRows:E,rows:D,getCellContent:O,getGroupDetails:k,getRowThemeOverride:A,isFocused:j,drawHeaderCallback:M,prelightCells:ee,drawCellCallback:N,highlightRegions:te,resizeCol:ne,imageLoader:P,lastBlitData:re,hoverValues:F,hyperWrapping:ie,hoverInfo:ae,spriteManager:oe,maxScaleFactor:se,hasAppendRow:ce,touchMode:le,enqueue:ue,renderStateProvider:de,getCellRenderer:fe,renderStrategy:pe,bufferACtx:me,bufferBCtx:he,damage:ge,minimumCellWidth:_e}=e;if(i===0||a===0)return;let ve=pe===`double-buffer`,ye=Math.min(se,Math.ceil(window.devicePixelRatio??1)),be=pe!==`direct`&&ns(e,t),xe=n.canvas;(xe.width!==i*ye||xe.height!==a*ye)&&(xe.width=i*ye,xe.height=a*ye,xe.style.width=i+`px`,xe.style.height=a+`px`);let Se=r.canvas,Ce=d?_+g:g,we=Ce+1;(Se.width!==i*ye||Se.height!==we*ye)&&(Se.width=i*ye,Se.height=we*ye,Se.style.width=i+`px`,Se.style.height=we+`px`);let Te=me.canvas,Ee=he.canvas;ve&&(Te.width!==i*ye||Te.height!==a*ye)&&(Te.width=i*ye,Te.height=a*ye,re.current!==void 0&&(re.current.aBufferScroll=void 0)),ve&&(Ee.width!==i*ye||Ee.height!==a*ye)&&(Ee.width=i*ye,Ee.height=a*ye,re.current!==void 0&&(re.current.bBufferScroll=void 0));let De=re.current;if(be===!0&&o===De?.cellXOffset&&s===De?.cellYOffset&&c===De?.translateX&&l===De?.translateY)return;let Oe=null;ve&&(Oe=n);let ke=r,Ae;Ae=ve?ge===void 0?De?.lastBuffer===`b`?me:he:De?.lastBuffer===`b`?he:me:n;let je=Ae.canvas,Me=ve?je===Te?Ee:Te:xe,Ne=typeof y==`number`?()=>y:y;ke.save(),Ae.save(),ke.beginPath(),Ae.beginPath(),ke.textBaseline=`middle`,Ae.textBaseline=`middle`,ye!==1&&(ke.scale(ye,ye),Ae.scale(ye,ye));let Pe=Br(u,o,i,p,c),Fe=[],Ie=h&&w.current?.cell[1]===s&&l===0,Le=!1;if(te!==void 0){for(let e of te)if(e.style!==`no-outline`&&e.range.y===s&&l===0){Le=!0;break}}let Re=()=>{Pa(ke,Pe,d,ae,i,c,g,_,p,C,w,m,oe,F,b,k,ge,M,le),$o(ke,Pe,s,c,l,i,a,void 0,void 0,_,Ce,Ne,A,b,E,D,m,!0),ke.beginPath(),ke.moveTo(0,we-.5),ke.lineTo(i,we-.5),ke.strokeStyle=mr(m.headerBottomBorderColor??m.horizontalBorderColor??m.borderColor,m.bgHeader),ke.stroke(),Le&&rs(ke,i,a,o,s,c,l,u,f,g,_,y,E,D,te,m),Ie&&as(ke,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D)};if(ge!==void 0){let e=Pe[Pe.length-1].sourceIndex+1,t=ge.hasItemInRegion([{x:o,y:-2,width:e,height:2},{x:o,y:s,width:e,height:300},{x:0,y:s,width:f,height:300},{x:0,y:-2,width:f,height:2},{x:o,y:D-E,width:e,height:E,when:E>0}]),n=e=>{Ea(e,Pe,u,a,Ce,c,l,s,D,Ne,O,k,A,v,j,h,E,ce,Fe,ge,w,ee,te,P,oe,F,ae,N,ie,m,ue,de,fe,S,_e);let t=w.current;T&&h&&t!==void 0&&ge.has(Pr(t.range))&&as(e,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D)};t&&(n(Ae),Oe!==null&&(Oe.save(),Oe.scale(ye,ye),Oe.textBaseline=`middle`,n(Oe),Oe.restore()),ge.hasHeader()&&(os(ke,Pe,i,_,Ce,c,l,s,ge),Re())),Ae.restore(),ke.restore();return}if((be!==!0||o!==De?.cellXOffset||c!==De?.translateX||Ie!==De?.mustDrawFocusOnHeader||Le!==De?.mustDrawHighlightRingsOnHeader)&&Re(),be===!0){x(Me!==void 0&&De!==void 0);let{regions:e}=es(Ae,Me,Me===Te?De.aBufferScroll:De.bBufferScroll,Me===Te?De.bBufferScroll:De.aBufferScroll,De,o,s,c,l,E,i,a,D,Ce,ye,u,Pe,y,ve);Fe=e}else be!==!1&&(x(De!==void 0),Fe=ts(De,o,s,c,l,i,a,Ce,Pe,be));Xo(Ae,Pe,i,a,E,D,b,Ne,m);let ze=rs(Ae,i,a,o,s,c,l,u,f,g,_,y,E,D,te,m),Be=h?as(Ae,i,a,s,c,l,Pe,u,m,Ce,w,Ne,O,E,ce,T,D):void 0;if(Ae.fillStyle=m.bgCell,Fe.length>0){Ae.beginPath();for(let e of Fe)Ae.rect(e.x,e.y,e.width,e.height);Ae.clip(),Ae.fill(),Ae.beginPath()}else Ae.fillRect(0,0,i,a);let Ve=Ea(Ae,Pe,u,a,Ce,c,l,s,D,Ne,O,k,A,v,j,h,E,ce,Fe,ge,w,ee,te,P,oe,F,ae,N,ie,m,ue,de,fe,S,_e);Yo(Ae,Pe,u,i,a,Ce,c,l,s,D,Ne,A,w.rows,v,E,ce,Fe,ge,m),Qo(Ae,Pe,s,c,l,i,a,Fe,Ce,Ne,A,b,E,D,m),$o(Ae,Pe,s,c,l,i,a,Fe,Ve,_,Ce,Ne,A,b,E,D,m),ze?.(),Be?.(),C&&ha(Pe,0,c,0,Ce,(e,t)=>e.sourceIndex===ne?(is(ke,t+e.width,0,Ce+1,mr(m.resizeIndicatorColor??m.accentLight,m.bgHeader)),is(Ae,t+e.width,Ce,a,mr(m.resizeIndicatorColor??m.accentLight,m.bgCell)),!0):!1),Oe!==null&&(Oe.fillStyle=m.bgCell,Oe.fillRect(0,0,i,a),Oe.drawImage(Ae.canvas,0,0));let He=ss(Pe,a,Ce,c,l,s,D,Ne,E,ce);P?.setWindow({x:o,y:s,width:Pe.length,height:He-s},f,Array.from({length:E},(e,t)=>D-1-t));let Ue=De!==void 0&&(o!==De.cellXOffset||c!==De.translateX),We=De!==void 0&&(s!==De.cellYOffset||l!==De.translateY);re.current={cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mustDrawFocusOnHeader:Ie,mustDrawHighlightRingsOnHeader:Le,lastBuffer:ve?je===Te?`a`:`b`:void 0,aBufferScroll:je===Te?[Ue,We]:De?.aBufferScroll,bBufferScroll:je===Ee?[Ue,We]:De?.bBufferScroll},Ae.restore(),ke.restore()}var ls=u(ji(),1),us=80;function ds(e){let t=e-1;return t*t*t+1}var fs=class{callback;constructor(e){this.callback=e}currentHoveredItem=void 0;leavingItems=[];lastAnimationTime;addToLeavingItems=e=>{this.leavingItems.some(t=>Nr(t.item,e.item))||this.leavingItems.push(e)};removeFromLeavingItems=e=>{let t=this.leavingItems.find(t=>Nr(t.item,e));return this.leavingItems=this.leavingItems.filter(e=>e!==t),t?.hoverAmount??0};cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)};shouldStep=()=>{let e=this.leavingItems.length>0,t=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||t};getAnimatingItems=()=>this.currentHoveredItem===void 0?this.leavingItems.map(e=>({...e,hoverAmount:ds(e.hoverAmount)})):[...this.leavingItems,this.currentHoveredItem];step=e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{let t=(e-this.lastAnimationTime)/us;for(let e of this.leavingItems)e.hoverAmount=(0,ls.default)(e.hoverAmount-t,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,ls.default)(this.currentHoveredItem.hoverAmount+t,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0};setHovered=e=>{if(!Nr(this.currentHoveredItem?.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){let t=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:t}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}}},ps=class{fn;val;constructor(e){this.fn=e}get value(){return this.val??=this.fn()}};function ms(e){return new ps(e)}var hs=ms(()=>window.navigator.userAgent.includes(`Firefox`)),gs=ms(()=>window.navigator.userAgent.includes(`Mac OS`)&&window.navigator.userAgent.includes(`Safari`)&&!window.navigator.userAgent.includes(`Chrome`)),_s=ms(()=>window.navigator.platform.toLowerCase().startsWith(`mac`));function vs(e){let t=L.useRef([]),n=L.useRef(0),r=L.useRef(e);r.current=e;let i=L.useCallback(()=>{let e=()=>window.requestAnimationFrame(i),i=()=>{let e=t.current.map(hi);t.current=[],r.current(new vi(e)),t.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?e:i)},[]);return L.useCallback(e=>{t.current.length===0&&i();let n=fi(e[0],e[1]);t.current.includes(n)||t.current.push(n)},[i])}var ys=`header`,bs=`group-header`,xs=`out-of-bounds`,Ss;(function(e){e[e.Start=-2]=`Start`,e[e.StartPadding=-1]=`StartPadding`,e[e.Center=0]=`Center`,e[e.EndPadding=1]=`EndPadding`,e[e.End=2]=`End`})(Ss||={});function Cs(e,t){return e===t?!0:e?.kind===`out-of-bounds`?e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]&&e?.region[0]===t?.region[0]&&e?.region[1]===t?.region[1]:e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]}ct();var ws=u(ra(),1);E();var Ts=6,Es=(e,t)=>e.kind===I.Custom?e.copyData:(t?.(e))?.getAccessibilityString(e)??``,Ds=L.memo(L.forwardRef((e,t)=>{let{width:n,height:r,accessibilityHeight:i,columns:a,cellXOffset:o,cellYOffset:s,headerHeight:c,fillHandle:l=!1,groupHeaderHeight:u,rowHeight:d,rows:f,getCellContent:p,getRowThemeOverride:m,onHeaderMenuClick:h,enableGroups:g,isFilling:_,onCanvasFocused:v,onCanvasBlur:y,isFocused:b,selection:S,freezeColumns:C,onContextMenu:w,freezeTrailingRows:T,fixedShadowX:E=!0,fixedShadowY:D=!0,drawFocusRing:O,onMouseDown:k,onMouseUp:A,onMouseMoveRaw:j,onMouseMove:M,onItemHovered:ee,dragAndDropState:N,firstColAccessible:te,onKeyDown:ne,onKeyUp:P,highlightRegions:re,canvasRef:F,onDragStart:ie,onDragEnd:ae,eventTargetRef:oe,isResizing:se,resizeColumn:ce,isDragging:le,isDraggable:ue=!1,allowResize:de,disabledRows:fe,hasAppendRow:pe,getGroupDetails:me,theme:he,prelightCells:ge,headerIcons:_e,verticalBorder:ve,drawCell:ye,drawHeader:be,onCellFocused:xe,onDragOverCell:Se,onDrop:Ce,onDragLeave:we,imageWindowLoader:Te,smoothScrollX:Ee=!1,smoothScrollY:De=!1,experimental:Oe,getCellRenderer:ke}=e,Ae=e.translateX??0,je=e.translateY??0,Me=Math.max(C,Math.min(a.length-1,o)),Ne=L.useRef(null),Pe=Te,Fe=L.useRef(),[Ie,Le]=L.useState(!1),Re=L.useRef([]),ze=L.useRef(),[Be,Ve]=L.useState(),[He,Ue]=L.useState(),We=L.useRef(null),[Ge,Ke]=L.useState(),[qe,Je]=L.useState(!1),Ye=L.useRef(qe);Ye.current=qe;let Xe=L.useMemo(()=>new fa(_e,()=>{vt.current=void 0,St.current()}),[_e]),$e=g?u+c:c,tt=L.useRef(-1),nt=(Oe?.enableFirefoxRescaling??!1)&&hs.value,rt=(Oe?.enableSafariRescaling??!1)&&gs.value;L.useLayoutEffect(()=>{window.devicePixelRatio===1||!nt&&!rt||(tt.current!==-1&&Le(!0),window.clearTimeout(tt.current),tt.current=window.setTimeout(()=>{Le(!1),tt.current=-1},200))},[s,Me,Ae,je,nt,rt]);let it=Or(a,C),ot=E?Rr(it,N):0,ct=L.useCallback((e,t,i)=>{let a=e.getBoundingClientRect();if(t>=it.length||i>=f)return;let o=a.width/n,c=ui(t,i,n,r,u,$e,Me,s,Ae,je,f,C,T,it,d);return o!==1&&(c.x*=o,c.y*=o,c.width*=o,c.height*=o),c.x+=a.x,c.y+=a.y,c},[n,r,u,$e,Me,s,Ae,je,f,C,T,it,d]),lt=L.useCallback((e,t,i,a)=>{let o=e.getBoundingClientRect(),p=o.width/n,m=(t-o.left)/p,h=(i-o.top)/p,_=Br(it,Me,n,void 0,Ae),v=0,y=0;a instanceof MouseEvent&&(v=a.button,y=a.buttons);let b=Vr(m,_,Ae),C=Hr(h,r,g,c,u,f,d,s,je,T),w=a?.shiftKey===!0,E=a?.ctrlKey===!0,D=a?.metaKey===!0,O=a!==void 0&&!(a instanceof MouseEvent)||a?.pointerType===`touch`,k=[m<0?-1:+(nn||h>r){let i=m>n?1:m<0?-1:0,a=h>r?1:h<0?-1:0,o=i*2,s=a*2;i===0&&(o=b===-1?Ss.EndPadding:Ss.Center),a===0&&(s=C===void 0?Ss.EndPadding:Ss.Center);let c=!1;if(b===-1&&C===-1){let n=ct(e,it.length-1,-1);x(n!==void 0),c=tn&&mr&&h=0?(r=!0,n=ct(e,a,C),x(n!==void 0),A={kind:g&&C===-2?bs:ys,location:[a,C],bounds:n,group:it[a].group??``,isEdge:r,shiftKey:w,ctrlKey:E,metaKey:D,isTouch:O,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:k}):A={kind:g&&C===-2?bs:ys,group:it[b].group??``,location:[b,C],bounds:n,isEdge:r,shiftKey:w,ctrlKey:E,metaKey:D,isTouch:O,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:k}}else{let n=ct(e,b,C);x(n!==void 0);let r=n!==void 0&&n.x+n.width-t<5,a=!1;if(l&&S.current!==void 0){let n=Pr(S.current.range),r=ct(e,n[0],n[1]);if(r!==void 0){let e=r.x+r.width-2,n=r.y+r.height-2;a=Math.abs(e-t){}),ft=L.useRef(Be);ft.current=Be;let[pt,mt]=L.useMemo(()=>{let e=document.createElement(`canvas`),t=document.createElement(`canvas`);return e.style.display=`none`,e.style.opacity=`0`,e.style.position=`fixed`,t.style.display=`none`,t.style.opacity=`0`,t.style.position=`fixed`,[e.getContext(`2d`,{alpha:!1}),t.getContext(`2d`,{alpha:!1})]},[]);L.useLayoutEffect(()=>{if(!(pt===null||mt===null))return document.documentElement.append(pt.canvas),document.documentElement.append(mt.canvas),()=>{pt.canvas.remove(),mt.canvas.remove()}},[pt,mt]);let ht=L.useMemo(()=>new _i,[]),gt=nt&&Ie?1:rt&&Ie?2:5,_t=Oe?.disableMinimumCellWidth===!0?1:10,vt=L.useRef(),yt=L.useRef(null),bt=L.useRef(null),xt=L.useCallback(()=>{let e=Ne.current,t=We.current;if(e===null||t===null||(yt.current===null&&(yt.current=e.getContext(`2d`,{alpha:!1}),e.width=0,e.height=0),bt.current===null&&(bt.current=t.getContext(`2d`,{alpha:!1}),t.width=0,t.height=0),yt.current===null||bt.current===null||pt===null||mt===null))return;let i=!1,a=e=>{i=!0,Ke(e)},o=vt.current,h={headerCanvasCtx:bt.current,canvasCtx:yt.current,bufferACtx:pt,bufferBCtx:mt,width:n,height:r,cellXOffset:Me,cellYOffset:s,translateX:Math.round(Ae),translateY:Math.round(je),mappedColumns:it,enableGroups:g,freezeColumns:C,dragAndDropState:N,theme:he,headerHeight:c,groupHeaderHeight:u,disabledRows:fe??st.empty(),rowHeight:d,verticalBorder:ve,isResizing:se,resizeCol:ce,isFocused:b,selection:S,fillHandle:l,drawCellCallback:ye,hasAppendRow:pe,overrideCursor:a,maxScaleFactor:gt,freezeTrailingRows:T,rows:f,drawFocus:O,getCellContent:p,getGroupDetails:me??(e=>({name:e})),getRowThemeOverride:m,drawHeaderCallback:be,prelightCells:ge,highlightRegions:re,imageLoader:Pe,lastBlitData:ze,damage:Fe.current,hoverValues:Re.current,hoverInfo:ft.current,spriteManager:Xe,scrolling:Ie,hyperWrapping:Oe?.hyperWrapping??!1,touchMode:qe,enqueue:dt.current,renderStateProvider:ht,renderStrategy:Oe?.renderStrategy??(gs.value?`double-buffer`:`single-buffer`),getCellRenderer:ke,minimumCellWidth:_t};h.damage===void 0?(vt.current=h,cs(h,o)):cs(h,void 0),!i&&(h.damage===void 0||h.damage.has(ft?.current?.[0]))&&Ke(void 0)},[pt,mt,n,r,Me,s,Ae,je,it,g,C,N,he,c,u,fe,d,ve,se,pe,ce,b,S,l,T,f,O,gt,p,me,m,ye,be,ge,re,Pe,Xe,Ie,Oe?.hyperWrapping,Oe?.renderStrategy,qe,ht,ke,_t]),St=L.useRef(xt);L.useLayoutEffect(()=>{xt(),St.current=xt},[xt]),L.useLayoutEffect(()=>{(async()=>{document?.fonts?.ready!==void 0&&(await document.fonts.ready,vt.current=void 0,St.current())})()},[]);let Ct=L.useCallback(e=>{Fe.current=e,St.current(),Fe.current=void 0},[]);dt.current=vs(Ct);let wt=L.useCallback(e=>{Ct(new vi(e.map(e=>e.cell)))},[Ct]);Pe.setCallback(Ct);let[Tt,Et]=L.useState(!1),[Dt,Ot]=ut??[],kt=Dt!==void 0&&Ot===-1,At=Dt!==void 0&&Ot===-2,jt=!1,Mt=!1,Nt=Ge;if(Nt===void 0&&Dt!==void 0&&Ot!==void 0&&Ot>-1&&Ot({contain:`strict`,display:`block`,cursor:Pt}),[Pt]),It=L.useRef(`default`),Lt=oe?.current;Lt!=null&&It.current!==Ft.cursor&&(Lt.style.cursor=It.current=Ft.cursor);let Rt=L.useCallback((e,t,n,r)=>{if(me===void 0)return;let i=me(e);if(i.actions!==void 0){let e=Ra(t,i.actions);for(let[a,o]of e.entries())if(ba(o,n+t.x,r+o.y))return i.actions[a]}},[me]),zt=L.useCallback((e,t,n,r)=>{let i=a[t];if(!le&&!se&&i.hasMenu===!0&&!(He??!1)){let a=ct(e,t,-1);x(a!==void 0);let o=La(a.x,a.y,a.width,a.height,R(i.title)===`rtl`);if(n>o.x&&no.y&&r{let t=Ne.current,n=oe?.current;if(t===null||e.target!==t&&e.target!==n)return;Ht.current=!0;let r,i;if(e instanceof MouseEvent?(r=e.clientX,i=e.clientY):(r=e.touches[0].clientX,i=e.touches[0].clientY),e.target===n&&n!==null){let e=n.getBoundingClientRect();if(r>e.right||i>e.bottom)return}let a=lt(t,r,i,e);Vt.current=a.location,a.isTouch&&(Bt.current=Date.now()),Ye.current!==a.isTouch&&Je(a.isTouch),!(a.kind===`header`&&zt(t,a.location[0],r,i)!==void 0)&&(a.kind===`group-header`&&Rt(a.group,a.bounds,a.localEventX,a.localEventY)!==void 0||(k?.(a),!a.isTouch&&ue!==!0&&ue!==a.kind&&a.button<3&&a.button!==1&&e.preventDefault()))},[oe,ue,lt,Rt,zt,k]);qt(`touchstart`,Ut,window,!1),qt(`mousedown`,Ut,window,!1);let Wt=L.useRef(0),Gt=L.useCallback(e=>{let t=Wt.current;Wt.current=Date.now();let n=Ne.current;if(Ht.current=!1,A===void 0||n===null)return;let r=oe?.current,i=e.target!==n&&e.target!==r,a,o,s=!0;if(e instanceof MouseEvent){if(a=e.clientX,o=e.clientY,s=e.button<3,e.pointerType===`touch`)return}else a=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY;let c=lt(n,a,o,e);c.isTouch&&Bt.current!==0&&Date.now()-Bt.current>500&&(c={...c,isLongTouch:!0}),t!==0&&Date.now()-t<(c.isTouch?1e3:500)&&(c={...c,isDoubleClick:!0}),Ye.current!==c.isTouch&&Je(c.isTouch),!i&&e.cancelable&&s&&e.preventDefault();let[l]=c.location,u=zt(n,l,a,o);if(c.kind===`header`&&u!==void 0){(c.button!==0||Vt.current?.[0]!==l||Vt.current?.[1]!==-1)&&A(c,!0);return}else if(c.kind===`group-header`){let e=Rt(c.group,c.bounds,c.localEventX,c.localEventY);if(e!==void 0){c.button===0&&e.onClick(c);return}}A(c,i)},[A,oe,lt,zt,Rt]);qt(`mouseup`,Gt,window,!1),qt(`touchend`,Gt,window,!1),qt(`click`,L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n=oe?.current,r=e.target!==t&&e.target!==n,i,a,o=!0;e instanceof MouseEvent?(i=e.clientX,a=e.clientY,o=e.button<3):(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY);let s=lt(t,i,a,e);Ye.current!==s.isTouch&&Je(s.isTouch),!r&&e.cancelable&&o&&e.preventDefault();let[c]=s.location,l=zt(t,c,i,a);if(s.kind===`header`&&l!==void 0)s.button===0&&Vt.current?.[0]===c&&Vt.current?.[1]===-1&&h?.(c,l);else if(s.kind===`group-header`){let e=Rt(s.group,s.bounds,s.localEventX,s.localEventY);e!==void 0&&s.button===0&&e.onClick(s)}},[oe,lt,zt,h,Rt]),window,!1),qt(`contextmenu`,L.useCallback(e=>{let t=Ne.current,n=oe?.current;if(t===null||e.target!==t&&e.target!==n||w===void 0)return;let r=lt(t,e.clientX,e.clientY,e);w(r,()=>{e.cancelable&&e.preventDefault()})},[oe,lt,w]),oe?.current??null,!1);let Kt=L.useCallback(e=>{Fe.current=new vi(e.map(e=>e.item)),Re.current=e,St.current(),Fe.current=void 0},[]),Jt=L.useMemo(()=>new fs(Kt),[Kt]),Yt=L.useRef(Jt);Yt.current=Jt,L.useLayoutEffect(()=>{let e=Yt.current;if(ut===void 0||ut[1]<0){e.setHovered(ut);return}let t=p(ut,!0),n=ke(t),r=n===void 0&&t.kind===I.Custom||n?.needsHover!==void 0&&(typeof n.needsHover==`boolean`?n.needsHover:n.needsHover(t));e.setHovered(r?ut:void 0)},[p,ke,ut]);let Xt=L.useRef();qt(`mousemove`,L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n=oe?.current,r=e.target!==t&&e.target!==n,i=lt(t,e.clientX,e.clientY,e);if(i.kind!==`out-of-bounds`&&r&&!Ht.current&&!i.isTouch)return;let a=(e,t)=>{Ve(n=>n===e||n?.[0][0]===e?.[0][0]&&n?.[0][1]===e?.[0][1]&&(n?.[1][0]===e?.[1][0]&&n?.[1][1]===e?.[1][1]||!t)?n:e)};if(!Cs(i,Xt.current))Ke(void 0),ee?.(i),a(i.kind===`out-of-bounds`?void 0:[i.location,[i.localEventX,i.localEventY]],!0),Xt.current=i;else if(i.kind===`cell`||i.kind===`header`||i.kind===`group-header`){let e=!1,t=!0;if(i.kind===`cell`){let n=p(i.location);t=ke(n)?.needsHoverPosition??n.kind===I.Custom,e=t}else i.kind===`group-header`&&(e=!0);let n=[i.location,[i.localEventX,i.localEventY]];a(n,t),ft.current=n,e&&Ct(new vi([i.location]))}let o=i.location[0]>=+!te;Ue(i.kind===`header`&&i.isEdge&&o&&de===!0),Et(i.kind===`cell`&&i.isFillHandle),j?.(e),M(i)},[oe,lt,te,de,j,M,ee,p,ke,Ct]),window,!0);let Zt=L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n,r;S.current!==void 0&&(n=ct(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),ne?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[ne,S,ct]),Qt=L.useCallback(e=>{let t=Ne.current;if(t===null)return;let n,r;S.current!==void 0&&(n=ct(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),P?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[P,S,ct]),$t=L.useCallback(e=>{Ne.current=e,F!==void 0&&(F.current=e)},[F]);qt(`dragstart`,L.useCallback(e=>{let t=Ne.current;if(t===null||ue===!1||se){e.preventDefault();return}let n,r,i=lt(t,e.clientX,e.clientY);if(ue!==!0&&i.kind!==ue){e.preventDefault();return}let a=(e,t)=>{n=e,r=t},o,s,c,l=(e,t,n)=>{o=e,s=t,c=n},u=!1;if(ie?.({...i,setData:a,setDragImage:l,preventDefault:()=>u=!0,defaultPrevented:()=>u}),!u&&n!==void 0&&r!==void 0&&e.dataTransfer!==null)if(e.dataTransfer.setData(n,r),e.dataTransfer.effectAllowed=`copyLink`,o!==void 0&&s!==void 0&&c!==void 0)e.dataTransfer.setDragImage(o,s,c);else{let[n,r]=i.location;if(r!==void 0){let i=document.createElement(`canvas`),a=ct(t,n,r);x(a!==void 0);let o=Math.ceil(window.devicePixelRatio??1);i.width=a.width*o,i.height=a.height*o;let s=i.getContext(`2d`);s!==null&&(s.scale(o,o),s.textBaseline=`middle`,r===-1?(s.font=he.headerFontFull,s.fillStyle=he.bgHeader,s.fillRect(0,0,i.width,i.height),Ba(s,0,0,a.width,a.height,it[n],!1,he,!1,!1,0,Xe,be,!1)):(s.font=he.baseFontFull,s.fillStyle=he.bgCell,s.fillRect(0,0,i.width,i.height),Ma(s,p([n,r]),0,r,!1,!1,0,0,a.width,a.height,!1,he,he.bgCell,Pe,Xe,1,void 0,!1,0,void 0,void 0,void 0,ht,ke,()=>void 0))),i.style.left=`-100%`,i.style.position=`absolute`,i.style.width=`${a.width}px`,i.style.height=`${a.height}px`,document.body.append(i),e.dataTransfer.setDragImage(i,a.width/2,a.height/2),window.setTimeout(()=>{i.remove()},0)}}else e.preventDefault()},[ue,se,lt,ie,ct,he,it,Xe,be,p,Pe,ht,ke]),oe?.current??null,!1,!1);let en=L.useRef();qt(`dragover`,L.useCallback(e=>{let t=Ne.current;if(Ce!==void 0&&e.preventDefault(),t===null||Se===void 0)return;let[n,r]=lt(t,e.clientX,e.clientY).location,i=n-+!te,[a,o]=en.current??[];(a!==i||o!==r)&&(en.current=[i,r],Se([i,r],e.dataTransfer))},[te,lt,Se,Ce]),oe?.current??null,!1,!1),qt(`dragend`,L.useCallback(()=>{en.current=void 0,ae?.()},[ae]),oe?.current??null,!1,!1),qt(`drop`,L.useCallback(e=>{let t=Ne.current;if(t===null||Ce===void 0)return;e.preventDefault();let[n,r]=lt(t,e.clientX,e.clientY).location,i=n-+!te;Ce([i,r],e.dataTransfer)},[te,lt,Ce]),oe?.current??null,!1,!1),qt(`dragleave`,L.useCallback(()=>{we?.()},[we]),oe?.current??null,!1,!1);let tn=L.useRef(S);tn.current=S;let nn=L.useRef(null),an=L.useCallback(e=>{Ne.current===null||!Ne.current.contains(document.activeElement)||(e===null&&tn.current.current!==void 0?F?.current?.focus({preventScroll:!0}):e!==null&&e.focus({preventScroll:!0}),nn.current=e)},[F]);L.useImperativeHandle(t,()=>({focus:()=>{let e=nn.current;e===null||!document.contains(e)?F?.current?.focus({preventScroll:!0}):e.focus({preventScroll:!0})},getBounds:(e,t)=>{if(!(F===void 0||F.current===null))return ct(F.current,e??0,t??-1)},damage:wt}),[F,wt,ct]);let on=L.useRef(),cn=rn(()=>{if(n<50||Oe?.disableAccessibilityTree===!0)return null;let e=Br(it,Me,n,N,Ae),t=te?0:-1;!te&&e[0]?.sourceIndex===0&&(e=e.slice(1));let[r,a]=S.current?.cell??[],o=S.current?.range,c=e.map(e=>e.sourceIndex),l=(0,ws.default)(s,Math.min(f,s+i));return r!==void 0&&a!==void 0&&!(c.includes(r)&&l.includes(a))&&an(null),L.createElement(`table`,{key:`access-tree`,role:`grid`,"aria-rowcount":f+1,"aria-multiselectable":`true`,"aria-colcount":it.length+t},L.createElement(`thead`,{role:`rowgroup`},L.createElement(`tr`,{role:`row`,"aria-rowindex":1},e.map(e=>L.createElement(`th`,{role:`columnheader`,"aria-selected":S.columns.hasIndex(e.sourceIndex),"aria-colindex":e.sourceIndex+1+t,tabIndex:-1,onFocus:t=>{if(t.target!==nn.current)return xe?.([e.sourceIndex,-1])},key:e.sourceIndex},e.title)))),L.createElement(`tbody`,{role:`rowgroup`},l.map(n=>L.createElement(`tr`,{role:`row`,"aria-selected":S.rows.hasIndex(n),key:n,"aria-rowindex":n+2},e.map(e=>{let i=e.sourceIndex,s=fi(i,n),c=r===i&&a===n,l=o!==void 0&&i>=o.x&&i=o.y&&n{let e=F?.current;if(e!=null)return ne?.({bounds:ct(e,i,n),cancel:()=>void 0,preventDefault:()=>void 0,stopPropagation:()=>void 0,ctrlKey:!1,key:`Enter`,keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:d})},onFocusCapture:e=>{if(!(e.target===nn.current||on.current?.[0]===i&&on.current?.[1]===n))return on.current=d,xe?.(d)},ref:c?an:void 0,tabIndex:-1},Es(f,ke))})))))},[n,it,Me,N,Ae,f,s,i,S,an,p,F,ne,ct,xe],200),ln=C===0||!E?0:Me>C?1:(0,ls.default)(-Ae/100,0,1),un=-s*32+je,dn=D?(0,ls.default)(-un/100,0,1):0,fn=L.useMemo(()=>{if(!ln&&!dn)return null;let e={position:`absolute`,top:0,left:ot,width:n-ot,height:r,opacity:ln,pointerEvents:`none`,transition:Ee?void 0:`opacity 0.2s`,boxShadow:`inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)`},t={position:`absolute`,top:$e,left:0,width:n,height:r,opacity:dn,pointerEvents:`none`,transition:De?void 0:`opacity 0.2s`,boxShadow:`inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)`};return L.createElement(L.Fragment,null,ln>0&&L.createElement(`div`,{id:`shadow-x`,style:e}),dn>0&&L.createElement(`div`,{id:`shadow-y`,style:t}))},[ln,dn,ot,n,Ee,$e,r,De]),pn=L.useMemo(()=>({position:`absolute`,top:0,left:0}),[]);return L.createElement(L.Fragment,null,L.createElement(`canvas`,{"data-testid":`data-grid-canvas`,tabIndex:0,onKeyDown:Zt,onKeyUp:Qt,onFocus:v,onBlur:y,ref:$t,style:Ft},cn),L.createElement(`canvas`,{ref:We,style:pn}),fn)}));function Os(e,t,n,r){return(0,ls.default)(Math.round(t-(e.growOffset??0)),Math.ceil(n),Math.floor(r))}var ks=e=>{let[t,n]=L.useState(),[r,i]=L.useState(),[a,o]=L.useState(),[s,c]=L.useState(),[l,u]=L.useState(!1),[d,f]=L.useState(),[p,m]=L.useState(),[h,g]=L.useState(),[_,v]=L.useState(!1),[y,b]=L.useState(),{onHeaderMenuClick:x,getCellContent:S,onColumnMoved:C,onColumnResize:w,onColumnResizeStart:T,onColumnResizeEnd:E,gridRef:D,maxColumnWidth:O,minColumnWidth:k,onRowMoved:A,lockColumns:j,onColumnProposeMove:M,onMouseDown:ee,onMouseUp:N,onItemHovered:te,onDragStart:ne,canvasRef:P}=e,re=(w??E??T)!==void 0,{columns:F,selection:ie}=e,ae=ie.columns,oe=L.useCallback(e=>{let[t,n]=e.location;a!==void 0&&s!==t&&t>=j?(u(!0),c(t)):p!==void 0&&n!==void 0?(v(!0),g(Math.max(0,n))):r===void 0&&!l&&!_&&te?.(e)},[a,p,s,te,j,r,l,_]),se=C!==void 0,ce=L.useCallback(e=>{if(e.button===0){let[t,r]=e.location;if(e.kind===`out-of-bounds`&&e.isEdge&&re){let e=D?.current?.getBounds(F.length-1,-1);e!==void 0&&(n(e.x),i(F.length-1))}else if(e.kind===`header`&&t>=j){let r=P?.current;if(e.isEdge&&re&&r){n(e.bounds.x),i(t);let a=r.getBoundingClientRect().width/r.offsetWidth,o=e.bounds.width/a;T?.(F[t],o,t,o+(F[t].growOffset??0))}else e.kind===`header`&&se&&(f(e.bounds.x),o(t))}else e.kind===`cell`&&j>0&&t===0&&r!==void 0&&A!==void 0&&(b(e.bounds.y),m(r))}ee?.(e)},[ee,re,j,A,D,F,se,T,P]),le=L.useCallback((e,t)=>{l||_||x?.(e,t)},[l,_,x]),ue=L.useRef(-1),de=L.useCallback(()=>{ue.current=-1,m(void 0),g(void 0),b(void 0),v(!1),o(void 0),c(void 0),f(void 0),u(!1),i(void 0),n(void 0)},[]),fe=L.useCallback((e,t)=>{if(e.button===0){if(r!==void 0){if(ae?.hasIndex(r)===!0)for(let e of ae){if(e===r)continue;let t=F[e],n=Os(t,ue.current,k,O);w?.(t,n,e,n+(t.growOffset??0))}let e=Os(F[r],ue.current,k,O);if(E?.(F[r],e,r,e+(F[r].growOffset??0)),ae.hasIndex(r))for(let e of ae){if(e===r)continue;let t=F[e],n=Os(t,ue.current,k,O);E?.(t,n,e,n+(t.growOffset??0))}}de(),a!==void 0&&s!==void 0&&C?.(a,s),p!==void 0&&h!==void 0&&A?.(p,h)}N?.(e,t)},[N,r,a,s,p,h,ae,E,F,k,O,w,C,A,de]),pe=L.useMemo(()=>{if(!(a===void 0||s===void 0)&&a!==s&&M?.(a,s)!==!1)return{src:a,dest:s}},[a,s,M]),me=L.useCallback(e=>{let n=P?.current;if(a!==void 0&&d!==void 0)Math.abs(e.clientX-d)>20&&u(!0);else if(p!==void 0&&y!==void 0)Math.abs(e.clientY-y)>20&&v(!0);else if(r!==void 0&&t!==void 0&&n){let i=n.getBoundingClientRect().width/n.offsetWidth,a=(e.clientX-t)/i,o=F[r],s=Os(o,a,k,O);if(w?.(o,s,r,s+(o.growOffset??0)),ue.current=a,ae?.first()===r)for(let e of ae){if(e===r)continue;let t=F[e],n=Os(t,ue.current,k,O);w?.(t,n,e,n+(t.growOffset??0))}}},[a,d,p,y,r,t,F,k,O,w,ae,P]),he=L.useCallback((e,t)=>{if(p===void 0||h===void 0)return S(e,t);let[n,r]=e;return r===h?r=p:(r>h&&--r,r>=p&&(r+=1)),S([n,r],t)},[p,h,S]),ge=L.useCallback(e=>{ne?.(e),e.defaultPrevented()||de()},[de,ne]);return L.createElement(Ds,{accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,enableGroups:e.enableGroups,eventTargetRef:e.eventTargetRef,experimental:e.experimental,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,headerIcons:e.headerIcons,height:e.height,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,resizeColumn:r,isDraggable:e.isDraggable,isFilling:e.isFilling,isFocused:e.isFocused,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDrop:e.onDrop,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,width:e.width,getCellContent:he,isResizing:r!==void 0,onHeaderMenuClick:le,isDragging:l,onItemHovered:oe,onDragStart:ge,onMouseDown:ce,allowResize:re,onMouseUp:fe,dragAndDropState:pe,onMouseMoveRaw:me,ref:D})};function As(e){let t=(0,L.useRef)(null),[n,r]=(0,L.useState)({width:e?.[0],height:e?.[1]});return(0,L.useLayoutEffect)(()=>{let e=new window.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t&&t.contentRect||{};r(t=>t.width===e&&t.height===n?t:{width:e,height:n})}});return t.current&&e.observe(t.current,void 0),()=>{e.disconnect()}},[t.current]),{ref:t,...n}}var js=(e,t,n)=>{let r=(0,L.useRef)(null),i=(0,L.useRef)(null),a=(0,L.useRef)(null),o=(0,L.useRef)(0),s=(0,L.useRef)(t);s.current=t;let c=n.current;(0,L.useEffect)(()=>{let t=()=>{if(i.current===!1&&c!==null){let e=[c.scrollLeft,c.scrollTop];if(a.current?.[0]===e[0]&&a.current?.[1]===e[1])if(o.current>10){a.current=null,i.current=null;return}else o.current++;else o.current=0,s.current(e[0],e[1]),a.current=e;r.current=window.setTimeout(t,1e3/120)}},n=()=>{i.current=!0,a.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},l=e=>{e.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(t,1e3/120))};if(e&&c!==null){let e=c;return e.addEventListener(`touchstart`,n),e.addEventListener(`touchend`,l),()=>{e.removeEventListener(`touchstart`,n),e.removeEventListener(`touchend`,l),r.current!==null&&window.clearTimeout(r.current)}}},[e,c])};St();var Ms=xt(`div`)({name:`ScrollRegionStyle`,class:`gdg-s1dgczr6`,propsAsIs:!1,vars:{"s1dgczr6-0":[e=>e.isSafari?`scroll`:`auto`]}});function Ns(e){let[t,n]=L.useState(!1),r=typeof window>`u`?null:window,i=L.useRef(0);return qt(`touchstart`,L.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),qt(`touchend`,L.useCallback(t=>{t.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),e))},[e]),r,!0,!1),t}var Ps=e=>{let{children:t,clientHeight:n,scrollHeight:r,scrollWidth:i,update:a,draggable:o,className:s,preventDiagonalScrolling:c=!1,paddingBottom:l=0,paddingRight:u=0,rightElement:d,rightElementProps:f,kineticScrollPerfHack:p=!1,scrollRef:m,initialSize:h}=e,g=[],_=f?.sticky??!1,v=f?.fill??!1,y=L.useRef(0),b=L.useRef(0),x=L.useRef(null),S=typeof window>`u`?1:window.devicePixelRatio,C=L.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),w=L.useRef(null),T=Ns(200),[E,D]=L.useState(!0),O=L.useRef(0);L.useLayoutEffect(()=>{if(!E||T||C.current.lockDirection===void 0)return;let e=x.current;if(e===null)return;let[t,n]=C.current.lockDirection;t===void 0?n!==void 0&&(e.scrollTop=n):e.scrollLeft=t,C.current.lockDirection=void 0},[T,E]);let k=L.useCallback((e,t)=>{let n=x.current;if(n===null)return;t??=n.scrollTop,e??=n.scrollLeft;let i=C.current.scrollTop,o=C.current.scrollLeft,s=e-o,d=t-i;T&&s!==0&&d!==0&&(Math.abs(s)>3||Math.abs(d)>3)&&c&&C.current.lockDirection===void 0&&(C.current.lockDirection=Math.abs(s)0&&(Math.abs(g)>2e3||h===0||h===_)&&r>n.scrollHeight+5){let e=h/_,t=(r-m)*e;y.current=t-h}f!==void 0&&(window.clearTimeout(O.current),D(!1),O.current=window.setTimeout(()=>D(!0),200)),a({x:e,y:h+y.current,width:p-u,height:m-l,paddingRight:w.current?.clientWidth??0})},[l,u,r,a,c,T]);js(p&&gs.value,k,x);let A=L.useRef(k);A.current=k;let j=L.useRef(),M=L.useRef(!1);L.useLayoutEffect(()=>{M.current?k():M.current=!0},[k,l,u]);let ee=L.useCallback(e=>{x.current=e,m!==void 0&&(m.current=e)},[m]),N=0,te=0;for(g.push(L.createElement(`div`,{key:N++,style:{width:i,height:0}}));teA.current(),0),j.current={width:P,height:re}),(P??0)===0||(re??0)===0?L.createElement(`div`,{ref:ne}):L.createElement(`div`,{ref:ne},L.createElement(Ms,{isSafari:gs.value},L.createElement(`div`,{className:`dvn-underlay`},t),L.createElement(`div`,{ref:ee,style:j.current,draggable:o,onDragStart:e=>{o||(e.stopPropagation(),e.preventDefault())},className:`dvn-scroller `+(s??``),onScroll:()=>k()},L.createElement(`div`,{className:`dvn-scroll-inner`+(d===void 0?` dvn-hidden`:``)},L.createElement(`div`,{className:`dvn-stack`},g),d!==void 0&&L.createElement(L.Fragment,null,!v&&L.createElement(`div`,{className:`dvn-spacer`}),L.createElement(`div`,{ref:w,style:{height:re,maxHeight:n-Math.ceil(S%1),position:`sticky`,top:0,paddingLeft:1,marginBottom:-40,marginRight:u,flexGrow:v?1:void 0,right:_?u??0:void 0,pointerEvents:`auto`}},d))))))},Fs=e=>{let{columns:t,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:a,enableGroups:o,freezeColumns:s,experimental:c,nonGrowWidth:l,clientSize:u,className:d,onVisibleRegionChanged:f,scrollRef:p,preventDiagonalScrolling:m,rightElement:h,rightElementProps:g,overscrollX:_,overscrollY:v,initialSize:y,smoothScrollX:b=!1,smoothScrollY:x=!1,isDraggable:S}=e,{paddingRight:C,paddingBottom:w}=c??{},[T,E]=u,D=L.useRef(),O=L.useRef(),k=L.useRef(),A=L.useRef(),j=l+Math.max(0,_??0),M=o?i+a:i;if(typeof r==`number`)M+=n*r;else for(let e=0;e{if(ee.current===void 0)return;let e={...ee.current},i=0,a=e.x<0?-e.x:0,o=0,c=0;e.x=e.x<0?0:e.x;let l=0;for(let e=0;e=t+n.width)i+=n.width,c++,o++;else if(e.x>t)i+=n.width,b?a+=t-e.x:c++,o++;else if(e.x+e.width>t)i+=n.width,o++;else break}let u=0,d=0,p=0;if(typeof r==`number`)x?(d=Math.floor(e.y/r),u=d*r-e.y):d=Math.ceil(e.y/r),p=Math.ceil(e.height/r)+d,u<0&&p++;else{let t=0;for(let i=0;i=t+n)t+=n,d++,p++;else if(e.y>a)t+=n,x?u+=a-e.y:d++,p++;else if(e.y+e.height>n/2+t)t+=n,p++;else break}}let m={x:c,y:d,width:o-c,height:p-d},h=D.current;(h===void 0||h.y!==m.y||h.x!==m.x||h.height!==m.height||h.width!==m.width||O.current!==a||k.current!==u||e.width!==A.current?.[0]||e.height!==A.current?.[1])&&(f?.({x:c,y:d,width:o-c,height:p-d},e.width,e.height,e.paddingRight??0,a,u),D.current=m,O.current=a,k.current=u,A.current=[e.width,e.height])},[t,r,n,f,s,b,x]),te=L.useCallback(e=>{ee.current=e,N()},[N]);return L.useEffect(()=>{N()},[N]),L.createElement(Ps,{scrollRef:p,className:d,kineticScrollPerfHack:c?.kineticScrollPerfHack,preventDiagonalScrolling:m,draggable:S===!0||typeof S==`string`,scrollWidth:j+(C??0),scrollHeight:M+(w??0),clientHeight:E,rightElement:h,paddingBottom:w,paddingRight:C,rightElementProps:g,update:te,initialSize:y},L.createElement(ks,{eventTargetRef:p,width:T,height:E,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,onColumnProposeMove:e.onColumnProposeMove,verticalBorder:e.verticalBorder,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}))};St();var Is=xt(`div`)({name:`SearchWrapper`,class:`gdg-seveqep`,propsAsIs:!1});ct(),E();var Ls=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 244l144-144 144 144M256 120v292`})),Rs=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 268l144 144 144-144M256 392V100`})),zs=L.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},L.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`32`,d:`M368 368L144 144M368 144L144 368`})),Bs=10,Vs=e=>{let{canvasRef:t,cellYOffset:n,rows:r,columns:i,searchInputRef:a,searchValue:o,searchResults:s,onSearchValueChange:c,getCellsForSelection:l,onSearchResultsChanged:u,showSearch:d=!1,onSearchClose:f}=e,[p]=L.useState(()=>`search-box-`+Math.round(Math.random()*1e3)),[m,h]=L.useState(``),g=o??m,_=L.useCallback(e=>{h(e),c?.(e)},[c]),[v,y]=L.useState(),b=L.useRef(v);b.current=v,L.useEffect(()=>{s!==void 0&&(s.length>0?y(e=>({rowsSearched:r,results:s.length,selectedIndex:e?.selectedIndex??-1})):y(void 0))},[r,s]);let S=L.useRef();S.current===void 0&&(S.current=new AbortController);let C=L.useRef(),[w,T]=L.useState([]),E=s??w,D=L.useCallback(()=>{C.current!==void 0&&(window.cancelAnimationFrame(C.current),C.current=void 0,S.current.abort())},[]),O=L.useRef(n);O.current=n;let k=L.useCallback(e=>{let t=new RegExp(e.replace(/([$()*+.?[\\\]^{|}-])/g,`\\$1`),`i`),n=O.current,a=Math.min(10,r),o=0;y(void 0),T([]);let s=[],c=async()=>{if(l===void 0)return;let e=performance.now(),d=r-o,f=l({x:0,y:n,width:i.length,height:Math.min(a,d,r-n)},S.current.signal);typeof f==`function`&&(f=await f());let p=!1;for(let[e,r]of f.entries())for(let[i,a]of r.entries()){let r;switch(a.kind){case I.Text:case I.Number:r=a.displayData;break;case I.Uri:case I.Markdown:r=a.data;break;case I.Boolean:r=typeof a.data==`boolean`?a.data.toString():void 0;break;case I.Image:case I.Bubble:r=a.data.join(`🐳`);break;case I.Custom:r=a.copyData;break}r!==void 0&&t.test(r)&&(s.push([i,e+n]),p=!0)}let m=performance.now();p&&T([...s]),o+=f.length,x(o<=r);let h=b.current?.selectedIndex??-1;y({results:s.length,rowsSearched:o,selectedIndex:h}),u?.(s,h),n+a>=r?n=0:n+=a;let g=m-e,_=Bs/Math.max(g,1);a=Math.ceil(a*_),o{f?.(),y(void 0),T([]),u?.([],-1),D(),t?.current?.focus()},[D,t,f,u]),j=L.useCallback(e=>{_(e.target.value),s===void 0&&(e.target.value===``?(y(void 0),T([]),D()):k(e.target.value))},[k,D,_,s]);L.useEffect(()=>{d&&a.current!==null&&(_(``),a.current.focus({preventScroll:!0}))},[d,a,_]);let M=L.useCallback(e=>{if(e?.stopPropagation?.(),v===void 0)return;let t=(v.selectedIndex+1)%v.results;y({...v,selectedIndex:t}),u?.(E,t)},[v,u,E]),ee=L.useCallback(e=>{if(e?.stopPropagation?.(),v===void 0)return;let t=(v.selectedIndex-1)%v.results;t<0&&(t+=v.results),y({...v,selectedIndex:t}),u?.(E,t)},[u,E,v]),N=L.useCallback(e=>{(e.ctrlKey||e.metaKey)&&e.nativeEvent.code===`KeyF`||e.key===`Escape`?(A(),e.stopPropagation(),e.preventDefault()):e.key===`Enter`&&(e.shiftKey?ee():M())},[A,M,ee]);L.useEffect(()=>()=>{D()},[D]);let[te,ne]=L.useState(!1);L.useEffect(()=>{if(d)ne(!0);else{let e=setTimeout(()=>ne(!1),150);return()=>clearTimeout(e)}},[d]);let P=L.useMemo(()=>{if(!d&&!te)return null;let e;v!==void 0&&(e=v.results>=1e3?`over 1000`:`${v.results} result${v.results===1?``:`s`}`,v.selectedIndex>=0&&(e=`${v.selectedIndex+1} of ${e}`));let t=e=>{e.stopPropagation()},n={width:`${Math.floor((v?.rowsSearched??0)/r*100)}%`};return L.createElement(Is,{className:d?``:`out`,onMouseDown:t,onMouseMove:t,onMouseUp:t,onClick:t},L.createElement(`div`,{className:`gdg-search-bar-inner`},L.createElement(`input`,{id:p,"aria-hidden":!d,"data-testid":`search-input`,ref:a,onChange:j,value:g,tabIndex:d?void 0:-1,onKeyDownCapture:N}),L.createElement(`button`,{"aria-label":`Previous Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:ee,disabled:(v?.results??0)===0},Ls),L.createElement(`button`,{"aria-label":`Next Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:M,disabled:(v?.results??0)===0},Rs),f!==void 0&&L.createElement(`button`,{"aria-label":`Close Search`,"aria-hidden":!d,"data-testid":`search-close-button`,tabIndex:d?void 0:-1,onClick:A},zs)),v===void 0?L.createElement(`div`,{className:`gdg-search-status`},L.createElement(`label`,{htmlFor:p},`Type to search`)):L.createElement(L.Fragment,null,L.createElement(`div`,{className:`gdg-search-status`},L.createElement(`div`,{"data-testid":`search-result-area`},e)),L.createElement(`div`,{className:`gdg-search-progress`,style:n})))},[d,te,v,r,p,a,j,g,N,ee,M,f,A]);return L.createElement(L.Fragment,null,L.createElement(Fs,{prelightCells:E,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,className:e.className,clientSize:e.clientSize,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,nonGrowWidth:e.nonGrowWidth,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,initialSize:e.initialSize,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,onVisibleRegionChanged:e.onVisibleRegionChanged,overscrollX:e.overscrollX,overscrollY:e.overscrollY,preventDiagonalScrolling:e.preventDiagonalScrolling,rightElement:e.rightElement,rightElementProps:e.rightElementProps,rowHeight:e.rowHeight,rows:e.rows,scrollRef:e.scrollRef,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,onColumnProposeMove:e.onColumnProposeMove,drawFocusRing:e.drawFocusRing,drawCell:e.drawCell,drawHeader:e.drawHeader,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}),P)},Hs,Us,Ws=o((()=>{Hs=u(f(),1),Us=class extends Hs.PureComponent{wrapperRef=Hs.createRef();componentDidMount(){document.addEventListener(`touchend`,this.clickOutside,!0),document.addEventListener(`mousedown`,this.clickOutside,!0),document.addEventListener(`contextmenu`,this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener(`touchend`,this.clickOutside,!0),document.removeEventListener(`mousedown`,this.clickOutside,!0),document.removeEventListener(`contextmenu`,this.clickOutside,!0)}clickOutside=e=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(e))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(e.target)){let t=e.target;for(;t!==null;){if(t.classList.contains(`click-outside-ignore`))return;t=t.parentElement}this.props.onClickOutside()}};render(){let{onClickOutside:e,isOutsideClick:t,...n}=this.props;return Hs.createElement(`div`,{...n,ref:this.wrapperRef},this.props.children)}}}));St(),Ws();var Gs=xt(`input`)({name:`RenameInput`,class:`gdg-r17m35ur`,propsAsIs:!1,vars:{"r17m35ur-0":[e=>Math.max(16,e.targetHeight-10),`px`]}}),Ks=e=>{let{bounds:t,group:n,onClose:r,canvasBounds:i,onFinish:a}=e,[o,s]=L.useState(n);return L.createElement(Us,{style:{position:`absolute`,left:t.x-i.left+1,top:t.y-i.top,width:t.width-2,height:t.height},className:`gdg-c1tqibwd`,onClickOutside:r},L.createElement(Gs,{targetHeight:t.height,"data-testid":`group-rename-input`,value:o,onBlur:r,onFocus:e=>e.target.setSelectionRange(0,o.length),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?a(o):e.key===`Escape`&&r()},autoFocus:!0}))};function qs(e,t){return e===void 0?!1:e.length>1&&e.startsWith(`_`)?Number.parseInt(e.slice(1))===t.keyCode:e.length===1&&e>=`a`&&e<=`z`?e.toUpperCase().codePointAt(0)===t.keyCode:e===t.key}function Js(e,t,n){let r=Ys(e,t);return r&&(n.didMatch=!0),r}function Ys(e,t){if(e.length===0)return!1;if(e.includes(`|`)){let n=e.split(`|`);for(let e of n)if(Ys(e,t))return!0;return!1}let n=!1,r=!1,i=!1,a=!1,o=e.split(`+`);if(!qs(o.pop(),t))return!1;if(o[0]===`any`)return!0;for(let e of o)switch(e){case`ctrl`:n=!0;break;case`shift`:r=!0;break;case`alt`:i=!0;break;case`meta`:a=!0;break;case`primary`:_s.value?a=!0:n=!0;break}return t.altKey===i&&t.ctrlKey===n&&t.shiftKey===r&&t.metaKey===a}ct();function Xs(e,t,n,r,i,a){return[L.useCallback((o,s,c,l)=>{(a===`cell`||a===`multi-cell`)&&o!==void 0&&(o={...o,range:{x:o.cell[0],y:o.cell[1],width:1,height:1}});let u=n===`mixed`&&(c||l===`drag`),d=r===`mixed`&&u,f=i===`mixed`&&u,p={current:o===void 0?void 0:{...o,rangeStack:l===`drag`?e.current?.rangeStack??[]:[]},columns:d?e.columns:st.empty(),rows:f?e.rows:st.empty()};c&&(a===`multi-rect`||a===`multi-cell`)&&p.current!==void 0&&e.current!==void 0&&(p={...p,current:{...p.current,rangeStack:[...e.current.rangeStack,e.current.range]}}),t(p,s)},[r,e,n,a,i,t]),L.useCallback((a,o,s)=>{a??=e.rows,o!==void 0&&(a=a.add(o));let c;if(i===`exclusive`&&a.length>0)c={current:void 0,columns:st.empty(),rows:a};else{let t=s&&n===`mixed`,i=s&&r===`mixed`;c={current:t?e.current:void 0,columns:i?e.columns:st.empty(),rows:a}}t(c,!1)},[r,e,n,i,t]),L.useCallback((a,o,s)=>{a??=e.columns,o!==void 0&&(a=a.add(o));let c;if(r===`exclusive`&&a.length>0)c={current:void 0,rows:st.empty(),columns:a};else{let t=s&&n===`mixed`,r=s&&i===`mixed`;c={current:t?e.current:void 0,rows:r?e.rows:st.empty(),columns:a}}t(c,!1)},[r,e,n,i,t])]}ct();function Zs(e,t,n,r,i){let a=L.useCallback(n=>{if(e===!0){let e=[];for(let r=n.y;r=i?a.push({kind:I.Loading,allowOverlay:!1}):a.push(t([e,r]));e.push(a)}return e}return e?.(n,r.signal)??[]},[r.signal,t,e,i]),o=e===void 0?void 0:a,s=L.useCallback(e=>{if(o===void 0)return[];let t={...e,x:e.x-n};if(t.x<0){t.x=0,t.width--;let e=o(t,r.signal);return typeof e==`function`?async()=>(await e()).map(e=>[{kind:I.Loading,allowOverlay:!1},...e]):e.map(e=>[{kind:I.Loading,allowOverlay:!1},...e])}return o(t,r.signal)},[r.signal,o,n]);return[e===void 0?void 0:s,o]}E(),ct();function Qs(e){if(e.copyData!==void 0)return{formatted:e.copyData,rawValue:e.copyData,format:`string`};switch(e.kind){case I.Boolean:return{formatted:e.data===!0?`TRUE`:e.data===!1?`FALSE`:e.data===void 0?`INDETERMINATE`:``,rawValue:e.data,format:`boolean`};case I.Custom:return{formatted:e.copyData,rawValue:e.copyData,format:`string`};case I.Image:case I.Bubble:return{formatted:e.data,rawValue:e.data,format:`string-array`};case I.Drilldown:return{formatted:e.data.map(e=>e.text),rawValue:e.data.map(e=>e.text),format:`string-array`};case I.Text:return{formatted:e.displayData??e.data,rawValue:e.data,format:`string`};case I.Uri:return{formatted:e.displayData??e.data,rawValue:e.data,format:`url`};case I.Markdown:case I.RowID:return{formatted:e.data,rawValue:e.data,format:`string`};case I.Number:return{formatted:e.displayData,rawValue:e.data,format:`number`};case I.Loading:return{formatted:`#LOADING`,rawValue:``,format:`string`};case I.Protected:return{formatted:`************`,rawValue:``,format:`string`};default:S(e)}}function $s(e,t){return e.map((e,n)=>{let r=t[n];return e.map(e=>e.span!==void 0&&e.span[0]!==r?{formatted:``,rawValue:``,format:`string`}:Qs(e))})}function ec(e,t){return(t?/[\t\n",]/:/[\t\n"]/).test(e)&&(e=`"${e.replace(/"/g,`""`)}"`),e}function tc(e){let t=[];for(let n of e){let e=[];for(let t of n)t.format===`url`?e.push(t.rawValue?.toString()??``):t.format===`string-array`?e.push(t.formatted.map(e=>ec(e,!0)).join(`,`)):e.push(ec(t.formatted,!1));t.push(e.join(` `))}return t.join(` +`)}function nc(e){return e.replace(/\t/g,` `).replace(/ {2,}/g,e=>` `.repeat(e.length))}function rc(e){return`"`+e.replace(/&/g,`&`).replace(/"/g,`"`).replace(//g,`>`)+`"`}function ic(e){return e.replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`)}function ac(e){let t=[];t.push(``,``);for(let n of e){t.push(``);for(let e of n){let n=`gdg-format="${e.format}"`;e.format===`url`?t.push(``):e.format===`string-array`?t.push(``):t.push(``)}t.push(``)}return t.push(`
${nc(e.formatted)}
    ${e.formatted.map((t,n)=>`
  1. `+nc(t)+`
  2. `).join(``)}
${nc(e.formatted)}
`),t.join(``)}function oc(e,t){let n=$s(e,t);return{textPlain:tc(n),textHtml:ac(n)}}function sc(e){let t=document.createElement(`html`);t.innerHTML=e.replace(/ /g,` `);let n=t.querySelector(`table`);if(n===null)return;let r=[n],i=[],a;for(;r.length>0;){let e=r.pop();if(e===void 0)break;if(e instanceof HTMLTableElement||e.nodeName===`TBODY`)r.push(...[...e.children].reverse());else if(e instanceof HTMLTableRowElement)a!==void 0&&i.push(a),a=[],r.push(...[...e.children].reverse());else if(e instanceof HTMLTableCellElement){let t=e.cloneNode(!0),n=t.children.length===1&&t.children[0].nodeName===`P`?t.children[0]:null,r=n?.children.length===1&&n.children[0].nodeName===`FONT`,i=t.querySelectorAll(`br`);for(let e of i)e.replaceWith(` +`);let o=t.getAttribute(`gdg-raw-value`),s=t.getAttribute(`gdg-format`)??`string`;if(t.querySelector(`a`)!==null)a?.push({rawValue:t.querySelector(`a`)?.getAttribute(`href`)??``,formatted:t.textContent??``,format:s});else if(t.querySelector(`ol`)!==null){let e=t.querySelectorAll(`li`);a?.push({rawValue:[...e].map(e=>e.getAttribute(`gdg-raw-value`)??``),formatted:[...e].map(e=>e.textContent??``),format:`string-array`})}else if(o!==null)a?.push({rawValue:ic(o),formatted:t.textContent??``,format:s});else{let e=t.textContent??``;r&&(e=e.replace(/\n(?!\n)/g,``)),a?.push({rawValue:e??``,formatted:e??``,format:s})}}}return a!==void 0&&i.push(a),i}function cc(e,t,n,r,i){let a=e;if(r===`allowPartial`||e.current===void 0||t===void 0)return e;let o=!1;do{if(e?.current===void 0)break;let r=e.current?.range,s=[];if(r.width>2){let e=t({x:r.x,y:r.y,width:1,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e);let n=t({x:r.x+r.width-1,y:r.y,width:1,height:r.height},i.signal);if(typeof n==`function`)return a;s.push(...n)}else{let e=t({x:r.x,y:r.y,width:r.width,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e)}let c=r.x-n,l=r.x+r.width-1-n;for(let e of s)for(let t of e)t.span!==void 0&&(c=Math.min(t.span[0],c),l=Math.max(t.span[1],l));c===r.x-n&&l===r.x+r.width-1-n?o=!0:e={current:{cell:e.current.cell??[0,0],range:{x:c+n,y:r.y,width:l-c+1,height:r.height},rangeStack:e.current.rangeStack},columns:e.columns,rows:e.rows}}while(!o);return e}function lc(e){return e.startsWith(`"`)&&e.endsWith(`"`)&&(e=e.slice(1,-1).replace(/""/g,`"`)),e}function uc(e){let t;(function(e){e[e.None=0]=`None`,e[e.inString=1]=`inString`,e[e.inStringPostQuote=2]=`inStringPostQuote`})(t||={});let n=[],r=[],i=0,a=t.None;e=e.replace(/\r\n/g,` `);let o=0;for(let s of e){switch(a){case t.None:s===` `||s===` `?(r.push(e.slice(i,o)),i=o+1,s===` `&&(n.push(r),r=[])):s===`"`&&(a=t.inString);break;case t.inString:s===`"`&&(a=t.inStringPostQuote);break;case t.inStringPostQuote:s===`"`?a=t.inString:s===` `||s===` -`?(r.push(uc(e.slice(i,o))),i=o+1,s===` -`&&(n.push(r),r=[]),a=t.None):a=t.None;break}o++}return ie.map(e=>({rawValue:e,formatted:e,format:`string`})))}function fc(e,t,n){let r=sc(e,t),i=e=>{window.navigator.clipboard?.writeText(e)},a=(e,t)=>window.navigator.clipboard?.write===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]),!0);window.navigator.clipboard?.write!==void 0||n?.clipboardData!==void 0?((e,t)=>{try{if(n===void 0||n.clipboardData===null)throw Error(`No clipboard data`);n?.clipboardData?.setData(`text/plain`,e),n?.clipboardData?.setData(`text/html`,t)}catch{a(e,t)||i(e)}})(r.textPlain,r.textHtml):i(r.textPlain),n?.preventDefault()}function pc(e){return e!==!0}St();function mc(e){return typeof e==`string`?e:`${e}px`}var tee=xt(`div`)({name:`Wrapper`,class:`gdg-wmyidgi`,propsAsIs:!1,vars:{"wmyidgi-0":[e=>e.innerWidth],"wmyidgi-1":[e=>e.innerHeight]}}),hc=e=>{let{inWidth:t,inHeight:n,children:r,...i}=e;return L.createElement(tee,{innerHeight:mc(n),innerWidth:mc(t),...i},r)},gc=2,nee=1300;function ree(e,t,n){let r=L.useRef(0),[i,a]=e??[0,0];L.useEffect(()=>{if(i===0&&a===0){r.current=0;return}let e=!1,o=0,s=c=>{if(!e){if(o===0)o=c;else{let e=c-o;r.current=Math.min(1,r.current+e/nee);let s=r.current**1.618*e*gc;t.current?.scrollBy(i*s,a*s),o=c,n?.()}window.requestAnimationFrame(s)}};return window.requestAnimationFrame(s),()=>{e=!0}},[t,i,a,n])}Ti();function _c({rowHeight:e,headerHeight:t,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:a,scaleToRem:o,remSize:s}){let[c,l,u,d,f,p]=L.useMemo(()=>{if(!o||s===16)return[e,t,n,r,i,a];let c=s/16,l=e,u=bi();return[typeof l==`number`?l*c:e=>Math.ceil(l(e)*c),Math.ceil(t*c),Math.ceil(n*c),{...r,headerIconSize:(r?.headerIconSize??u.headerIconSize)*c,cellHorizontalPadding:(r?.cellHorizontalPadding??u.cellHorizontalPadding)*c,cellVerticalPadding:(r?.cellVerticalPadding??u.cellVerticalPadding)*c},Math.ceil((i??0)*c),Math.ceil((a??0)*c)]},[n,t,i,a,s,e,o,r]);return{rowHeight:c,headerHeight:l,groupHeaderHeight:u,theme:d,overscrollX:f,overscrollY:p}}var vc={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function yc(e,t){return e===!0?t:e===!1?``:e}function bc(e){let t=vs.value;return{activateCell:yc(e.activateCell,` |Enter|shift+Enter`),clear:yc(e.clear,`any+Escape`),closeOverlay:yc(e.closeOverlay,`any+Escape`),acceptOverlayDown:yc(e.acceptOverlayDown,`Enter`),acceptOverlayUp:yc(e.acceptOverlayUp,`shift+Enter`),acceptOverlayLeft:yc(e.acceptOverlayLeft,`shift+Tab`),acceptOverlayRight:yc(e.acceptOverlayRight,`Tab`),copy:e.copy,cut:e.cut,delete:yc(e.delete,t?`Backspace|Delete`:`Delete`),downFill:yc(e.downFill,`primary+_68`),scrollToSelectedCell:yc(e.scrollToSelectedCell,`primary+Enter`),goDownCell:yc(e.goDownCell,`ArrowDown`),goDownCellRetainSelection:yc(e.goDownCellRetainSelection,`alt+ArrowDown`),goLeftCell:yc(e.goLeftCell,`ArrowLeft|shift+Tab`),goLeftCellRetainSelection:yc(e.goLeftCellRetainSelection,`alt+ArrowLeft`),goRightCell:yc(e.goRightCell,`ArrowRight|Tab`),goRightCellRetainSelection:yc(e.goRightCellRetainSelection,`alt+ArrowRight`),goUpCell:yc(e.goUpCell,`ArrowUp`),goUpCellRetainSelection:yc(e.goUpCellRetainSelection,`alt+ArrowUp`),goToFirstCell:yc(e.goToFirstCell,`primary+Home`),goToFirstColumn:yc(e.goToFirstColumn,`Home|primary+ArrowLeft`),goToFirstRow:yc(e.goToFirstRow,`primary+ArrowUp`),goToLastCell:yc(e.goToLastCell,`primary+End`),goToLastColumn:yc(e.goToLastColumn,`End|primary+ArrowRight`),goToLastRow:yc(e.goToLastRow,`primary+ArrowDown`),goToNextPage:yc(e.goToNextPage,`PageDown`),goToPreviousPage:yc(e.goToPreviousPage,`PageUp`),paste:e.paste,rightFill:yc(e.rightFill,`primary+_82`),search:yc(e.search,`primary+f`),selectAll:yc(e.selectAll,`primary+a`),selectColumn:yc(e.selectColumn,`ctrl+ `),selectGrowDown:yc(e.selectGrowDown,`shift+ArrowDown`),selectGrowLeft:yc(e.selectGrowLeft,`shift+ArrowLeft`),selectGrowRight:yc(e.selectGrowRight,`shift+ArrowRight`),selectGrowUp:yc(e.selectGrowUp,`shift+ArrowUp`),selectRow:yc(e.selectRow,`shift+ `),selectToFirstCell:yc(e.selectToFirstCell,`primary+shift+Home`),selectToFirstColumn:yc(e.selectToFirstColumn,`primary+shift+ArrowLeft`),selectToFirstRow:yc(e.selectToFirstRow,`primary+shift+ArrowUp`),selectToLastCell:yc(e.selectToLastCell,`primary+shift+End`),selectToLastColumn:yc(e.selectToLastColumn,`primary+shift+ArrowRight`),selectToLastRow:yc(e.selectToLastRow,`primary+shift+ArrowDown`)}}function xc(e){let t=dn(e);return L.useMemo(()=>{if(t===void 0)return bc(vc);let e={...t,goToNextPage:t?.goToNextPage??t?.pageDown??vc.goToNextPage,goToPreviousPage:t?.goToPreviousPage??t?.pageUp??vc.goToPreviousPage,goToFirstCell:t?.goToFirstCell??t?.first??vc.goToFirstCell,goToLastCell:t?.goToLastCell??t?.last??vc.goToLastCell,selectToFirstCell:t?.selectToFirstCell??t?.first??vc.selectToFirstCell,selectToLastCell:t?.selectToLastCell??t?.last??vc.selectToLastCell};return bc({...vc,...e})},[t])}var Sc=g(),Cc=`modulepreload`,wc=function(e,t){return new URL(e,t).href},Tc={},Ec=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=wc(t,n),t=s(t),t in Tc)return;Tc[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Cc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Dc,Oc,kc,Ac,jc,Mc,Nc,Pc=o((()=>{St(),Dc=()=>e=>e.targetX,Oc=()=>e=>e.targetY,kc=()=>e=>e.targetWidth,Ac=()=>e=>e.targetHeight,jc=()=>e=>e.targetY+10,Mc=()=>e=>Math.max(0,(e.targetHeight-28)/2),Nc=xt(`div`)({name:`DataGridOverlayEditorStyle`,class:`gdg-d19meir1`,propsAsIs:!1,vars:{"d19meir1-0":[Oc(),`px`],"d19meir1-1":[Dc(),`px`],"d19meir1-2":[kc(),`px`],"d19meir1-3":[Ac(),`px`],"d19meir1-4":[jc(),`px`],"d19meir1-5":[Mc(),`px`]}})}));function Fc(){let[e,t]=Lc.useState();return[e??void 0,t]}function Ic(){let[e,t]=Fc(),[n,r]=Lc.useState(0),[i,a]=Lc.useState(!0);return Lc.useLayoutEffect(()=>{if(e===void 0||!(`IntersectionObserver`in window))return;let t=new IntersectionObserver(e=>{e.length!==0&&a(e[0].isIntersecting)},{threshold:1});return t.observe(e),()=>t.disconnect()},[e]),Lc.useEffect(()=>{if(i||e===void 0)return;let t,n=()=>{let{right:i}=e.getBoundingClientRect();r(e=>Math.min(e+window.innerWidth-i-10,0)),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{t!==void 0&&cancelAnimationFrame(t)}},[e,i]),{ref:t,style:Lc.useMemo(()=>({transform:`translateX(${n}px)`}),[n])}}var Lc,Rc=o((()=>{Lc=u(f(),1)})),zc=c({default:()=>Vc}),Bc,Vc,Hc=o((()=>{Bc=u(f(),1),Gs(),Ti(),ct(),Pc(),Rc(),Vc=e=>{let{target:t,content:n,onFinishEditing:r,forceEditMode:i,initialValue:a,imageEditorOverride:o,markdownDivCreateNode:s,highlight:c,className:l,theme:u,id:d,cell:f,bloom:p,validateCell:m,getCellRenderer:h,provideEditor:g,isOutsideClick:_}=e,[v,y]=Bc.useState(i?n:void 0),b=Bc.useRef(v??n);b.current=v??n;let[x,S]=Bc.useState(()=>m===void 0||!(Xe(n)&&m?.(f,n,b.current)===!1)),C=Bc.useCallback((e,t)=>{r(x?e:void 0,t)},[x,r]),w=Bc.useCallback(e=>{if(m!==void 0&&e!==void 0&&Xe(e)){let t=m(f,e,b.current);t===!1?S(!1):(typeof t==`object`&&(e=t),S(!0))}y(e)},[f,m]),T=Bc.useRef(!1),E=Bc.useRef(void 0),D=Bc.useCallback(()=>{C(v,[0,0]),T.current=!0},[v,C]),O=Bc.useCallback((e,t)=>{C(e,t??E.current??[0,0]),T.current=!0},[C]),k=Bc.useCallback(async e=>{let t=!1;e.key===`Escape`?(e.stopPropagation(),e.preventDefault(),E.current=[0,0]):e.key===`Enter`&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),E.current=[0,1],t=!0):e.key===`Tab`&&(e.stopPropagation(),e.preventDefault(),E.current=[e.shiftKey?-1:1,0],t=!0),window.setTimeout(()=>{!T.current&&E.current!==void 0&&(C(t?v:void 0,E.current),T.current=!0)},0)},[C,v]),A=v??n,[j,M]=Bc.useMemo(()=>{if(Ze(n))return[];let e=g?.(n);return e===void 0?[h(n)?.provideEditor?.(n),!1]:[e,!1]},[n,h,g]),{ref:ee,style:N}=Ic(),te=!0,ne,P=!0,re;if(j!==void 0){te=j.disablePadding!==!0,P=j.disableStyling!==!0;let e=$e(j);e&&(re=j.styleOverride);let n=e?j.editor:j;ne=Bc.createElement(n,{isHighlighted:c,onChange:w,value:A,initialValue:a,onFinishedEditing:O,validatedSelection:Xe(A)?A.selectionRange:void 0,forceEditMode:i,target:t,imageEditorOverride:o,markdownDivCreateNode:s,isValid:x,theme:u})}re={...re,...N};let F=document.getElementById(`portal`);if(F===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `

` as the last child of your ``.'),null;let ie=P?`gdg-style`:`gdg-unstyle`;x||(ie+=` gdg-invalid`),te&&(ie+=` gdg-pad`);let ae=p?.[0]??1,oe=p?.[1]??1;return(0,Sc.createPortal)(Bc.createElement(wi.Provider,{value:u},Bc.createElement(Ws,{style:yi(u),className:l,onClickOutside:D,isOutsideClick:_},Bc.createElement(Nc,{ref:ee,id:d,className:ie,style:re,as:M===!0?`label`:void 0,targetX:t.x-ae,targetY:t.y-oe,targetWidth:t.width+ae*2,targetHeight:t.height+oe*2},Bc.createElement(`div`,{className:`gdg-clip-region`,onKeyDown:k},ne)))),F)}}));E();var Uc=u(qi(),1),Wc=u(Zi(),1);ct(),Ti(),vr();var Gc=L.lazy(async()=>await Ec(()=>Promise.resolve().then(()=>(Hc(),zc)),void 0,import.meta.url)),Kc=0;function qc(e){return(0,Uc.default)((0,Wc.default)((0,Wc.default)(e).filter(e=>e.span!==void 0).map(e=>(0,Ts.default)((e.span?.[0]??0)+1,(e.span?.[1]??0)+1))))}function Jc(e,t){return e===void 0||t===0||e.columns.length===0&&e.current===void 0?e:{current:e.current===void 0?void 0:{cell:[e.current.cell[0]+t,e.current.cell[1]],range:{...e.current.range,x:e.current.range.x+t},rangeStack:e.current.rangeStack.map(e=>({...e,x:e.x+t}))},rows:e.rows,columns:e.columns.offset(t)}}var Yc={kind:I.Loading,allowOverlay:!1},Xc={columns:st.empty(),rows:st.empty(),current:void 0},Zc=L.forwardRef((e,t)=>{let[n,r]=L.useState(Xc),[i,a]=L.useState(),o=L.useRef(null),s=L.useRef(null),[c,l]=L.useState(),u=L.useRef(null),d=L.useRef(),f=typeof window>`u`?null:window,{imageEditorOverride:p,getRowThemeOverride:m,markdownDivCreateNode:h,width:g,height:_,columns:v,rows:y,getCellContent:b,onCellClicked:w,onCellActivated:T,onFillPattern:E,onFinishedEditing:D,coercePasteValue:O,drawHeader:k,drawCell:A,editorBloom:j,onHeaderClicked:M,onColumnProposeMove:ee,spanRangeBehavior:N=`default`,onGroupHeaderClicked:te,onCellContextMenu:ne,className:P,onHeaderContextMenu:re,getCellsForSelection:F,onGroupHeaderContextMenu:ie,onGroupHeaderRenamed:ae,onCellEdited:oe,onCellsEdited:se,onSearchResultsChanged:ce,searchResults:le,onSearchValueChange:ue,searchValue:de,onKeyDown:fe,onKeyUp:pe,keybindings:me,editOnType:he=!0,onRowAppended:ge,onColumnMoved:_e,validateCell:ve,highlightRegions:ye,rangeSelect:be=`rect`,columnSelect:xe=`multi`,rowSelect:Se=`multi`,rangeSelectionBlending:Ce=`exclusive`,columnSelectionBlending:we=`exclusive`,rowSelectionBlending:Te=`exclusive`,onDelete:Ee,onDragStart:De,onMouseMove:Oe,onPaste:ke,copyHeaders:Ae=!1,freezeColumns:je=0,cellActivationBehavior:Me=`second-click`,rowSelectionMode:Ne=`auto`,onHeaderMenuClick:Pe,getGroupDetails:Fe,onSearchClose:Ie,onItemHovered:Le,onSelectionCleared:Re,showSearch:ze,onVisibleRegionChanged:Be,gridSelection:Ve,onGridSelectionChange:He,minColumnWidth:Ue=50,maxColumnWidth:We=500,maxColumnAutoWidth:Ge,provideEditor:Ke,trailingRowOptions:qe,freezeTrailingRows:Je=0,allowedFillDirections:Ye=`orthogonal`,scrollOffsetX:et,scrollOffsetY:tt,verticalBorder:nt,onDragOverCell:rt,onDrop:it,onColumnResize:ot,onColumnResizeEnd:ct,onColumnResizeStart:lt,customRenderers:ut,fillHandle:dt,drawFocusRing:ft=!0,experimental:pt,fixedShadowX:mt,fixedShadowY:ht,headerIcons:gt,imageWindowLoader:_t,initialSize:vt,isDraggable:yt,onDragLeave:bt,onRowMoved:xt,overscrollX:St,overscrollY:Ct,preventDiagonalScrolling:wt,rightElement:Tt,rightElementProps:Et,trapFocus:Dt=!1,smoothScrollX:Ot,smoothScrollY:kt,scaleToRem:At=!1,rowHeight:jt=34,headerHeight:Mt=36,groupHeaderHeight:Nt=Mt,theme:Pt,isOutsideClick:Ft,renderers:It}=e,Lt=typeof e.rowMarkers==`string`?void 0:e.rowMarkers,Rt=Lt?.kind??e.rowMarkers??`none`,zt=Lt?.width??e.rowMarkerWidth,Bt=Lt?.startIndex??e.rowMarkerStartIndex??1,Vt=Lt?.theme??e.rowMarkerTheme,Ht=Lt?.checkboxStyle??`square`,Ut=Math.max(Ue,20),Wt=Math.max(We,Ut),Gt=Math.max(Ge??Wt,Ut),Yt=L.useMemo(()=>typeof window>`u`?{fontSize:`16px`}:window.getComputedStyle(document.documentElement),[]),{rowHeight:Xt,headerHeight:Zt,groupHeaderHeight:Qt,theme:$t,overscrollX:en,overscrollY:tn}=_c({groupHeaderHeight:Nt,headerHeight:Mt,overscrollX:St,overscrollY:Ct,remSize:L.useMemo(()=>Number.parseFloat(Yt.fontSize),[Yt]),rowHeight:jt,scaleToRem:At,theme:Pt}),nn=xc(me),rn=zt??(y>1e4?48:y>1e3?44:y>100?36:32),an=Rt!==`none`,R=+!!an,on=ge!==void 0,cn=qe?.sticky===!0,[un,dn]=L.useState(!1),fn=ze??un,pn=L.useCallback(()=>{Ie===void 0?dn(!1):Ie()},[Ie]),z=L.useMemo(()=>Ve===void 0?void 0:Jc(Ve,R),[Ve,R])??n,mn=L.useRef();mn.current===void 0&&(mn.current=new AbortController),L.useEffect(()=>()=>mn?.current.abort(),[]);let[hn,gn]=Qs(F,b,R,mn.current,y),_n=L.useCallback((e,t,n)=>{if(ve===void 0)return!0;let r=[e[0]-R,e[1]];return ve?.(r,t,n)},[R,ve]),vn=L.useRef(Ve),yn=L.useCallback((e,t)=>{t&&(e=lc(e,hn,R,N,mn.current)),He===void 0?r(e):(vn.current=Jc(e,-R),He(vn.current))},[He,hn,R,N]),bn=Jt(ot,L.useCallback((e,t,n,r)=>{ot?.(v[n-R],t,n-R,r)},[ot,R,v])),xn=Jt(ct,L.useCallback((e,t,n,r)=>{ct?.(v[n-R],t,n-R,r)},[ct,R,v])),Sn=Jt(lt,L.useCallback((e,t,n,r)=>{lt?.(v[n-R],t,n-R,r)},[lt,R,v])),Cn=Jt(k,L.useCallback((e,t)=>k?.({...e,columnIndex:e.columnIndex-R},t)??!1,[k,R])),wn=Jt(A,L.useCallback((e,t)=>A?.({...e,col:e.col-R},t)??!1,[A,R])),Tn=L.useCallback(e=>{if(Ee!==void 0){let t=Ee(Jc(e,-R));return typeof t==`boolean`?t:Jc(t,R)}return!0},[Ee,R]),[En,Dn,On]=Zs(z,yn,Ce,we,Te,be),kn=L.useMemo(()=>xi(bi(),$t),[$t]),[An,jn]=L.useState([0,0,0]),Mn=L.useMemo(()=>{if(It===void 0)return{};let e={};for(let t of It)e[t.kind]=t;return e},[It]),Nn=L.useCallback(e=>e.kind===I.Custom?ut?.find(t=>t.isMatch(e)):Mn[e.kind],[ut,Mn]),{sizedColumns:Pn,nonGrowWidth:Fn}=ki(v,y,gn,An[0]-(R===0?0:rn)-An[2],Ut,Gt,kn,Nn,mn.current);Rt!==`none`&&(Fn+=rn);let In=L.useMemo(()=>Pn.some(e=>e.group!==void 0),[Pn]),Ln=In?Zt+Qt:Zt,Rn=z.rows.length,zn=Rt===`none`?void 0:Rn===0?!1:Rn===y||void 0,Bn=L.useMemo(()=>Rt===`none`?Pn:[{title:``,width:rn,icon:void 0,hasMenu:!1,style:`normal`,themeOverride:Vt,rowMarker:Ht,rowMarkerChecked:zn},...Pn],[Rt,Pn,rn,Vt,Ht,zn]),[Vn,Hn]=L.useMemo(()=>[tt!==void 0&&typeof Xt==`number`?Math.floor(tt/Xt):0,tt!==void 0&&typeof Xt==`number`?-(tt%Xt):0],[tt,Xt]),Un=L.useRef({height:1,width:1,x:0,y:0}),Wn=L.useMemo(()=>({x:Un.current.x,y:Vn,width:Un.current.width??1,height:Un.current.height??1,ty:Hn}),[Hn,Vn]),Gn=L.useRef(!1),[Kn,qn,Jn]=ln(Wn);Un.current=Kn;let Yn=(Kn.height??1)>1;L.useLayoutEffect(()=>{if(tt!==void 0&&u.current!==null&&Yn){if(u.current.scrollTop===tt)return;u.current.scrollTop=tt,u.current.scrollTop!==tt&&Jn(),Gn.current=!0}},[tt,Yn,Jn]);let Xn=(Kn.width??1)>1;L.useLayoutEffect(()=>{if(et!==void 0&&u.current!==null&&Xn){if(u.current.scrollLeft===et)return;u.current.scrollLeft=et,u.current.scrollLeft!==et&&Jn(),Gn.current=!0}},[et,Xn,Jn]);let Zn=Kn.x+R,Qn=Kn.y,$n=L.useRef(null),er=L.useCallback(e=>{e===!0?$n.current?.focus():window.requestAnimationFrame(()=>{$n.current?.focus()})},[]),tr=on?y+1:y,nr=L.useCallback(e=>{let t=R===0?e:e.map(e=>({...e,location:[e.location[0]-R,e.location[1]]})),n=se?.(t);if(n!==!0)for(let e of t)oe?.(e.location,e.value);return n},[oe,se,R]),[rr,ir]=L.useState(),ar=z.current!==void 0&&z.current.range.width*z.current.range.height>1?z.current.range:void 0,or=ft?z.current?.cell:void 0,sr=or?.[0],cr=or?.[1],lr=L.useMemo(()=>{if((ye===void 0||ye.length===0)&&(ar??sr??cr??rr)===void 0)return;let e=[];if(ye!==void 0)for(let t of ye){let n=Bn.length-t.range.x-R;n>0&&e.push({color:t.color,range:{...t.range,x:t.range.x+R,width:Math.min(n,t.range.width)},style:t.style})}return rr!==void 0&&e.push({color:fr(kn.accentColor,0),range:rr,style:`dashed`}),ar!==void 0&&e.push({color:fr(kn.accentColor,.5),range:ar,style:`solid-outline`}),sr!==void 0&&cr!==void 0&&e.push({color:kn.accentColor,range:{x:sr,y:cr,width:1,height:1},style:`solid-outline`}),e.length>0?e:void 0},[rr,ar,sr,cr,ye,Bn.length,kn.accentColor,R]),ur=L.useRef(Bn);ur.current=Bn;let dr=L.useCallback(([e,t],n=!1)=>{let r=on&&t===tr-1;if(e===0&&an)return r?Yc:{kind:at.Marker,allowOverlay:!1,checkboxStyle:Ht,checked:z?.rows.hasIndex(t)===!0,markerKind:Rt===`clickable-number`?`number`:Rt,row:Bt+t,drawHandle:xt!==void 0,cursor:Rt===`clickable-number`?`pointer`:void 0};if(r){let t=e===R?qe?.hint??``:``,n=ur.current[e];if(n?.trailingRowOptions?.disabled===!0)return Yc;{let e=n?.trailingRowOptions?.hint??t,r=n?.trailingRowOptions?.addIcon??qe?.addIcon;return{kind:at.NewRow,hint:e,allowOverlay:!1,icon:r}}}else{let r=e-R;if(n||pt?.strict===!0){let e=Un.current,n=e.x>r||r>e.x+e.width||e.y>t||t>e.y+e.height||t>=br.current,i=r===e.extras?.selected?.[0]&&t===e.extras?.selected[1],a=!1;if(e.extras?.freezeRegions!==void 0){for(let n of e.extras.freezeRegions)if(xa(n,r,t)){a=!0;break}}if(n&&!i&&!a)return Yc}let i=b([r,t]);return R!==0&&i.span!==void 0&&(i={...i,span:[i.span[0]+R,i.span[1]+R]}),i}},[on,tr,an,Ht,z?.rows,Rt,Bt,xt,R,qe?.hint,qe?.addIcon,pt?.strict,b]),pr=L.useCallback(e=>{let t=Fe?.(e)??{name:e};return ae!==void 0&&e!==``&&(t={icon:t.icon,name:t.name,overrideTheme:t.overrideTheme,actions:[...t.actions??[],{title:`Rename`,icon:`renameIcon`,onClick:e=>Lr({group:t.name,bounds:e.bounds})}]}),t},[Fe,ae]),mr=L.useCallback(e=>{let[t,n]=e.cell,r=Bn[t],i=r?.group===void 0?void 0:pr(r.group)?.overrideTheme,o=r?.themeOverride,s=m?.(n);a({...e,theme:xi(kn,i,o,s,e.content.themeOverride)})},[m,Bn,pr,kn]),hr=L.useCallback((e,t,n)=>{if(z.current===void 0)return;let[r,i]=z.current.cell,a=dr([r,i]);if(a.kind!==I.Boolean&&a.allowOverlay){let t=a;if(n!==void 0)switch(t.kind){case I.Number:{let e=C(()=>n===`-`?-0:Number.parseFloat(n),0);t={...t,data:Number.isNaN(e)?0:e};break}case I.Text:case I.Markdown:case I.Uri:t={...t,data:n};break}mr({target:e,content:t,initialValue:n,cell:[r,i],highlight:n===void 0,forceEditMode:n!==void 0})}else a.kind===I.Boolean&&t&&a.readonly!==!0&&(nr([{location:z.current.cell,value:{...a,data:pc(a.data)}}]),$n.current?.damage([{cell:z.current.cell}]))},[dr,z,nr,mr]),gr=L.useCallback((e,t)=>{let n=$n.current?.getBounds(e,t);if(n===void 0||u.current===null)return;let r=dr([e,t]);r.allowOverlay&&mr({target:n,content:r,initialValue:void 0,highlight:!0,cell:[e,t],forceEditMode:!0})},[dr,mr]),_r=L.useCallback((e,t,n=`both`,r=0,i=0,a=void 0)=>{if(u.current!==null){let o=$n.current,c=s.current,l=typeof e==`number`?e:e.unit===`cell`?e.amount:void 0,d=typeof t==`number`?t:t.unit===`cell`?t.amount:void 0,f=typeof e!=`number`&&e.unit===`px`?e.amount:void 0,p=typeof t!=`number`&&t.unit===`px`?t.amount:void 0;if(o!==null&&c!==null){let s={x:0,y:0,width:0,height:0},m=0,h=0;if((l!==void 0||d!==void 0)&&(s=o.getBounds((l??0)+R,d??0)??s,s.width===0||s.height===0))return;let g=c.getBoundingClientRect(),_=g.width/c.offsetWidth;if(f!==void 0&&(s={...s,x:f-g.left-u.current.scrollLeft,width:1}),p!==void 0&&(s={...s,y:p+g.top-u.current.scrollTop,height:1}),s!==void 0){let o={x:s.x-r,y:s.y-i,width:s.width+2*r,height:s.height+2*i},c=0;for(let e=0;e0&&(l=zr(tr,d,Xt));let f=c*_+g.left+R*rn*_,p=g.right,v=g.top+Ln*_,y=g.bottom-l*_,b=s.width+r*2;switch(a?.hAlign){case`start`:p=f+b;break;case`end`:f=p-b;break;case`center`:f=Math.floor((f+p)/2)-b/2,p=f+b;break}let x=s.height+i*2;switch(a?.vAlign){case`start`:y=v+x;break;case`end`:v=y-x;break;case`center`:v=Math.floor((v+y)/2)-x/2,y=v+x;break}f>o.x?m=o.x-f:po.y?h=o.y-v:y=tr-d)&&(h=0),(m!==0||h!==0)&&(_!==1&&(m/=_,h/=_),u.current.scrollTo(m+u.current.scrollLeft,h+u.current.scrollTop))}}}},[R,Je,rn,Ln,je,Pn,tr,cn,Xt]),vr=L.useRef(gr),yr=L.useRef(b),br=L.useRef(y);vr.current=gr,yr.current=b,br.current=y;let xr=L.useCallback(async(e,t=!0)=>{if(Bn[e]?.trailingRowOptions?.disabled===!0)return;let n=ge?.(),r,i=!0;n!==void 0&&(r=await n,r===`top`&&(i=!1),typeof r==`number`&&(i=!1));let a=0,o=()=>{if(br.current<=y){a<500&&window.setTimeout(o,a),a=50+a*2;return}let n=typeof r==`number`?r:i?y:0;vi.current(e-R,n),En({cell:[e,n],range:{x:e,y:n,width:1,height:1}},!1,!1,`edit`);let s=yr.current([e-R,n]);s.allowOverlay&&Qe(s)&&s.readonly!==!0&&t&&window.setTimeout(()=>{vr.current(e,n)},0)};o()},[Bn,ge,R,y,En]),Sr=L.useCallback(e=>{let t=Pn[e]?.trailingRowOptions?.targetColumn??qe?.targetColumn;if(typeof t==`number`)return t+ +!!an;if(typeof t==`object`){let e=v.indexOf(t);if(e>=0)return e+ +!!an}},[Pn,v,an,qe?.targetColumn]),Cr=L.useRef(),wr=L.useRef(),Tr=L.useCallback((e,t)=>{let[n,r]=t;return xi(kn,Bn[n]?.themeOverride,m?.(r),e.themeOverride)},[m,Bn,kn]),Er=L.useCallback(e=>{let t=vs.value?e.metaKey:e.ctrlKey,n=t&&Se===`multi`,r=t&&xe===`multi`,[i,o]=e.location,s=z.columns,c=z.rows,[l,u]=z.current?.cell??[];if(e.kind===`cell`){if(wr.current=void 0,Or.current=[i,o],i===0&&an){if(on===!0&&o===y||Rt===`number`||Se===`none`)return;let r=dr(e.location);if(r.kind!==at.Marker)return;if(xt!==void 0){let t=Nn(r);x(t?.kind===at.Marker);let n=t?.onClick?.({...e,cell:r,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,theme:Tr(r,e.location),preventDefault:()=>void 0});if(n===void 0||n.checked===r.checked)return}a(void 0),er();let i=c.hasIndex(o),s=Cr.current;if(Se===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&s!==void 0&&c.hasIndex(s)){let e=[Math.min(s,o),Math.max(s,o)+1];n||Ne===`multi`?Dn(void 0,e,!0):Dn(st.fromSingleSelection(e),void 0,n)}else n||e.isTouch||Ne===`multi`?i?Dn(c.remove(o),void 0,!0):(Dn(void 0,o,!0),Cr.current=o):i&&c.length===1?Dn(st.empty(),void 0,t):(Dn(st.fromSingleSelection(o),void 0,t),Cr.current=o)}else if(i>=R&&on&&o===y){let e=Sr(i);xr(e??i)}else if(l!==i||u!==o){let n=dr(e.location),r=Nn(n);if(r?.onSelect!==void 0){let t=!1;if(r.onSelect({...e,cell:n,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,preventDefault:()=>t=!0,theme:Tr(n,e.location)}),t)return}let s=cn&&o===y,c=cn&&z!==void 0&&z.current?.cell[1]===y;if((e.shiftKey||e.isLongTouch===!0)&&l!==void 0&&u!==void 0&&z.current!==void 0&&!c){if(s)return;let e=Math.min(i,l),n=Math.max(i,l),r=Math.min(o,u),a=Math.max(o,u);En({...z.current,range:{x:e,y:r,width:n-e+1,height:a-r+1}},!0,t,`click`),Cr.current=void 0,er()}else En({cell:[i,o],range:{x:i,y:o,width:1,height:1}},!0,t,`click`),Cr.current=void 0,a(void 0),er()}}else if(e.kind===`header`)if(Or.current=[i,o],a(void 0),an&&i===0)Cr.current=void 0,wr.current=void 0,Se===`multi`&&(c.length===y?Dn(st.empty(),void 0,t):Dn(st.fromSingleSelection([0,y]),void 0,t),er());else{let n=wr.current;if(xe===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&n!==void 0&&s.hasIndex(n)){let e=[Math.min(n,i),Math.max(n,i)+1];r?On(void 0,e,t):On(st.fromSingleSelection(e),void 0,t)}else r?(s.hasIndex(i)?On(s.remove(i),void 0,t):On(void 0,i,t),wr.current=i):xe!==`none`&&(On(st.fromSingleSelection(i),void 0,t),wr.current=i);Cr.current=void 0,er()}else e.kind===`group-header`?Or.current=[i,o]:e.kind===`out-of-bounds`&&!e.isMaybeScrollbar&&(yn(Xc,!1),a(void 0),er(),Re?.(),Cr.current=void 0,wr.current=void 0)},[xr,xe,er,Nn,Sr,dr,z,an,cn,Re,xt,R,Rt,Se,Ne,y,En,yn,On,Dn,on,Tr]),Dr=L.useRef(!1),Or=L.useRef(),jr=L.useRef(Kn),Pr=L.useRef(),Fr=L.useCallback(e=>{if(Br.current=!1,jr.current=Un.current,e.button!==0&&e.button!==1){Pr.current=void 0;return}let t=performance.now();Pr.current={button:e.button,time:t,location:e.location},e?.kind===`header`&&(Dr.current=!0);let n=e.kind===`cell`&&e.isFillHandle;!n&&e.kind!==`cell`&&e.isEdge||(l({previousSelection:z,fillHandle:n}),Or.current=void 0,!e.isTouch&&e.button===0&&!n?Er(e):!e.isTouch&&e.button===1&&(Or.current=e.location))},[z,Er]),[Ir,Lr]=L.useState(),Rr=L.useCallback(e=>{if(e.kind!==`group-header`||xe!==`multi`)return;let t=vs.value?e.metaKey:e.ctrlKey,[n]=e.location,r=z.columns;if(n=R&&Ar(i.group,Bn[e].group);e--)a--;for(let e=n+1;e{if(hn!==void 0&&bn!==void 0){let t=Un.current.y,n=Un.current.height,r=hn({x:e,y:t,width:1,height:Math.min(n,y-t)},mn.current.signal);typeof r!=`object`&&(r=await r());let i=Pn[e-R],a=document.createElement(`canvas`).getContext(`2d`,{alpha:!1});if(a!==null){a.font=kn.baseFontFull;let t=Oi(a,kn,i,0,r,Ut,Wt,!1,Nn);bn?.(i,t.width,e,t.width)}}},[Pn,hn,Wt,kn,Ut,bn,R,y,Nn]),[Hr,Ur]=L.useState(),Wr=L.useCallback(async(e,t)=>{let n=e.current?.range;if(n===void 0||hn===void 0||t.current===void 0)return;let r=t.current.range;if(E!==void 0){let e=!1;if(E({fillDestination:{...r,x:r.x-R},patternSource:{...n,x:n.x-R},preventDefault:()=>e=!0}),e)return}let i=hn(n,mn.current.signal);typeof i!=`object`&&(i=await i());let a=i,o=[];for(let e=0;e({cell:e.location})))},[hn,nr,E,R]),Gr=L.useCallback(()=>{if(z.current===void 0||z.current.range.width<=1)return;let e={...z,current:{...z.current,range:{...z.current.range,width:1}}};Wr(e,z)},[Wr,z]),Kr=L.useCallback(()=>{if(z.current===void 0||z.current.range.height<=1)return;let e={...z,current:{...z.current,range:{...z.current.range,height:1}}};Wr(e,z)},[Wr,z]),qr=L.useCallback((e,t)=>{let n=c;if(l(void 0),ir(void 0),Ur(void 0),Dr.current=!1,t)return;if(n?.fillHandle===!0&&z.current!==void 0&&n.previousSelection?.current!==void 0){if(rr===void 0)return;let e={...z,current:{...z.current,range:Sa(n.previousSelection.current.range,rr)}};Wr(n.previousSelection,e),yn(e,!0);return}let[r,i]=e.location,[a,o]=Or.current??[],s=()=>{Br.current=!0},u=t=>{let c=t.isTouch||a===r&&o===i;if(c&&w?.([r-R,i],{...t,preventDefault:s}),t.button===1)return!Br.current;if(!Br.current){let a=dr(e.location),o=Nn(a);if(o!==void 0&&o.onClick!==void 0&&c){let n=o.onClick({...t,cell:a,posX:t.localEventX,posY:t.localEventY,bounds:t.bounds,theme:Tr(a,e.location),preventDefault:s});n!==void 0&&!Ze(n)&&Xe(n)&&(nr([{location:t.location,value:n}]),$n.current?.damage([{cell:t.location}]))}if(Br.current||z.current===void 0)return!1;let l=!1;switch(a.activationBehaviorOverride??Me){case`double-click`:case`second-click`:{if(n?.previousSelection?.current?.cell===void 0)break;let[e,a]=z.current.cell,[o,s]=n.previousSelection.current.cell;l=r===e&&r===o&&i===a&&i===s&&(t.isDoubleClick===!0||Me===`second-click`);break}case`single-click`:l=!0;break}if(l)return T?.([r-R,i]),hr(t.bounds,!1),!0}return!1},d=e.location[0]-R;if(e.isTouch){let t=Un.current,n=jr.current;if(t.x!==n.x||t.y!==n.y)return;if(e.isLongTouch===!0){if(e.kind===`cell`&&Nr(z.current?.cell,e.location)){ne?.([d,e.location[1]],{...e,preventDefault:s});return}else if(e.kind===`header`&&z.columns.hasIndex(r)){re?.(d,{...e,preventDefault:s});return}else if(e.kind===`group-header`){if(d<0)return;ie?.(d,{...e,preventDefault:s});return}}e.kind===`cell`?u(e)||Er(e):e.kind===`group-header`?te?.(d,{...e,preventDefault:s}):(e.kind===`header`&&M?.(d,{...e,preventDefault:s}),Er(e));return}if(e.kind===`header`){if(d<0)return;e.isEdge?e.isDoubleClick===!0&&Vr(r):e.button===0&&r===a&&i===o&&M?.(d,{...e,preventDefault:s})}if(e.kind===`group-header`){if(d<0)return;e.button===0&&r===a&&i===o&&(te?.(d,{...e,preventDefault:s}),Br.current||Rr(e))}e.kind===`cell`&&(e.button===0||e.button===1)&&u(e),Or.current=void 0},[c,z,R,rr,Wr,yn,w,dr,Nn,Me,Tr,nr,T,hr,ne,re,ie,Er,te,M,Vr,Rr]),Jr=L.useCallback(e=>{let t={...e,location:[e.location[0]-R,e.location[1]]};Oe?.(t),c!==void 0&&e.buttons===0&&(l(void 0),ir(void 0),Ur(void 0),Dr.current=!1),Ur(t=>Dr.current?[e.scrollEdge[0],0]:e.scrollEdge[0]===t?.[0]&&e.scrollEdge[1]===t[1]?t:c===void 0||(Pr.current?.location[0]??0){Pe?.(e-R,t)},[Pe,R]),Xr=z?.current?.cell,Zr=L.useCallback((e,t,n,r,i,a)=>{Gn.current=!1;let o=Xr;o!==void 0&&(o=[o[0]-R,o[1]]);let s=je===0?void 0:{x:0,y:e.y,width:je,height:e.height},c=[];s!==void 0&&c.push(s),Je>0&&(c.push({x:e.x-R,y:y-Je,width:e.width,height:Je}),je>0&&c.push({x:0,y:y-Je,width:je,height:Je}));let l={x:e.x-R,y:e.y,width:e.width,height:on&&e.y+e.height>=y?e.height-1:e.height,tx:i,ty:a,extras:{selected:o,freezeRegion:s,freezeRegions:c}};Un.current=l,qn(l),jn([t,n,r]),Be?.(l,l.tx,l.ty,l.extras)},[Xr,R,on,y,je,Je,qn,Be]),Qr=Jt(_e,L.useCallback((e,t)=>{_e?.(e-R,t-R),xe!==`none`&&On(st.fromSingleSelection(t),void 0,!0)},[xe,_e,R,On])),$r=L.useRef(!1),ei=L.useCallback(e=>{if(e.location[0]===0&&R>0){e.preventDefault();return}De?.({...e,location:[e.location[0]-R,e.location[1]]}),e.defaultPrevented()||($r.current=!0),l(void 0)},[De,R]),ti=L.useCallback(()=>{$r.current=!1},[]),ni=L.useRef(),ri=L.useCallback(e=>{if(!ws(e,ni.current)&&(ni.current=e,!(Pr?.current?.button!==void 0&&Pr.current.button>=1))){if(e.buttons!==0&&c!==void 0&&Pr.current?.location[0]===0&&e.location[0]===0&&R===1&&Se===`multi`&&c.previousSelection&&!c.previousSelection.rows.hasIndex(Pr.current.location[1])&&z.rows.hasIndex(Pr.current.location[1])){let t=Math.min(Pr.current.location[1],e.location[1]),n=Math.max(Pr.current.location[1],e.location[1])+1;Dn(st.fromSingleSelection([t,n]),void 0,!1)}if(e.buttons!==0&&c!==void 0&&z.current!==void 0&&!$r.current&&!Dr.current&&(be===`rect`||be===`multi-rect`)){let[t,n]=z.current.cell,[r,i]=e.location;if(i<0&&(i=Un.current.y),c.fillHandle===!0&&c.previousSelection?.current!==void 0){let e=c.previousSelection.current.range;i=Math.min(i,on?y-1:y);let t=ya(e,r,i,Ye);ir(t)}else{if(on&&n===y)return;if(on&&i===y)if(e.kind===`out-of-bounds`)i--;else return;r=Math.max(r,R);let a=r-t,o=i-n,s={x:a>=0?t:r,y:o>=0?n:i,width:Math.abs(a)+1,height:Math.abs(o)+1};En({...z.current,range:s},!0,!1,`drag`)}}Le?.({...e,location:[e.location[0]-R,e.location[1]]})}},[Ye,c,R,Se,z,be,Le,Dn,on,y,En]);ree(Hr,u,L.useCallback(()=>{let e=ni.current;if(e===void 0)return;let[t,n]=e.scrollEdge,[r,i]=e.location,a=Un.current;t===-1?r=a.extras?.freezeRegion?.x??a.x:t===1&&(r=a.x+a.width),n===-1?i=Math.max(0,a.y):n===1&&(i=Math.min(y-1,a.y+a.height)),r=(0,us.default)(r,0,Bn.length-1),i=(0,us.default)(i,0,y-1),ri({...e,location:[r,i]})},[Bn.length,ri,y]));let ii=L.useCallback(e=>{if(z.current===void 0)return;let[t,n]=e,[r,i]=z.current.cell,a=z.current.range,o=a.x,s=a.x+a.width,c=a.y,l=a.y+a.height;if(n!==0)switch(n){case 2:l=y,c=i,_r(0,l,`vertical`);break;case-2:c=0,l=i+1,_r(0,c,`vertical`);break;case 1:ci+1?(l--,_r(0,l,`vertical`)):(c=Math.max(0,c-1),_r(0,c,`vertical`));break;default:S(n)}if(t!==0)if(t===2)s=Bn.length,o=r,_r(s-1-R,0,`horizontal`);else if(t===-2)o=R,s=r+1,_r(o-R,0,`horizontal`);else{let e=[];if(hn!==void 0){let t=hn({x:o,y:c,width:s-o-R,height:l-c},mn.current.signal);typeof t==`object`&&(e=qc(t))}if(t===1){let t=!1;if(o0){let n=(0,Ts.default)(o+1,r+1).find(t=>!e.includes(t-R));n!==void 0&&(o=n,t=!0)}else o++,t=!0;t&&_r(o,0,`horizontal`)}t||(s=Math.min(Bn.length,s+1),_r(s-1-R,0,`horizontal`))}else if(t===-1){let t=!1;if(s>r+1){if(e.length>0){let n=(0,Ts.default)(s-1,r,-1).find(t=>!e.includes(t-R));n!==void 0&&(s=n,t=!0)}else s--,t=!0;t&&_r(s-R,0,`horizontal`)}t||(o=Math.max(R,o-1),_r(o-R,0,`horizontal`))}else S(t)}En({cell:z.current.cell,range:{x:o,y:c,width:s-o,height:l-c}},!0,!1,`keyboard-select`)},[hn,z,Bn.length,R,y,_r,En]),ai=L.useCallback((e,t,n,r)=>{let i=tr-+!n;if(e=(0,us.default)(e,R,Pn.length-1+R),t=(0,us.default)(t,0,i),e===Xr?.[0]&&t===Xr?.[1])return!1;if(r&&z.current!==void 0){let n=[...z.current.rangeStack];(z.current.range.width>1||z.current.range.height>1)&&n.push(z.current.range),yn({...z,current:{cell:[e,t],range:{x:e,y:t,width:1,height:1},rangeStack:n}},!0)}else En({cell:[e,t],range:{x:e,y:t,width:1,height:1}},!0,!1,`keyboard-nav`);return d.current!==void 0&&d.current[0]===e&&d.current[1]===t&&(d.current=void 0),_r(e-R,t),!0},[tr,R,Pn.length,Xr,z,_r,yn,En]),oi=L.useCallback((e,t)=>{i?.cell!==void 0&&e!==void 0&&Xe(e)&&(nr([{location:i.cell,value:e}]),window.requestAnimationFrame(()=>{$n.current?.damage([{cell:i.cell}])})),er(!0),a(void 0);let[n,r]=t;if(z.current!==void 0&&(n!==0||r!==0)){let t=z.current.cell[1]===tr-1&&e!==void 0;ai((0,us.default)(z.current.cell[0]+n,0,Bn.length-1),(0,us.default)(z.current.cell[1]+r,0,tr-1),t,!1)}D?.(e,t)},[i?.cell,er,z,D,nr,tr,ai,Bn.length]),si=L.useMemo(()=>`gdg-overlay-${Kc++}`,[]),ci=L.useCallback(e=>{er();let t=[];for(let n=e.x;n({cell:e.location})))},[er,b,Nn,nr,R]),li=i!==void 0,ui=L.useCallback(e=>{let t=()=>{e.stopPropagation(),e.preventDefault()},n={didMatch:!1},{bounds:r}=e,i=z.columns,s=z.rows,c=nn;if(!li&&Ys(c.clear,e,n))yn(Xc,!1),Re?.();else if(!li&&Ys(c.selectAll,e,n))yn({columns:st.empty(),rows:st.empty(),current:{cell:z.current?.cell??[R,0],range:{x:R,y:0,width:v.length,height:y},rangeStack:[]}},!1);else if(Ys(c.search,e,n))o?.current?.focus({preventScroll:!0}),dn(!0);else if(Ys(c.delete,e,n)){let e=Tn?.(z)??!0;if(e!==!1){let t=e===!0?z:e;if(t.current!==void 0){ci(t.current.range);for(let e of t.current.rangeStack)ci(e)}for(let e of t.rows)ci({x:R,y:e,width:v.length,height:1});for(let e of t.columns)ci({x:e,y:0,width:1,height:y})}}if(n.didMatch)return t(),!0;if(z.current===void 0)return!1;let[l,u]=z.current.cell,d=!1,f=!1;Ys(c.scrollToSelectedCell,e,n)?vi.current(l-R,u):xe!==`none`&&Ys(c.selectColumn,e,n)?i.hasIndex(l)?On(i.remove(l),void 0,!0):xe===`single`?On(st.fromSingleSelection(l),void 0,!0):On(void 0,l,!0):Se!==`none`&&Ys(c.selectRow,e,n)?s.hasIndex(u)?Dn(s.remove(u),void 0,!0):Se===`single`?Dn(st.fromSingleSelection(u),void 0,!0):Dn(void 0,u,!0):!li&&r!==void 0&&Ys(c.activateCell,e,n)?u===y&&on?window.setTimeout(()=>{let e=Sr(l);xr(e??l)},0):(T?.([l-R,u]),hr(r,!0)):z.current.range.height>1&&Ys(c.downFill,e,n)?Kr():z.current.range.width>1&&Ys(c.rightFill,e,n)?Gr():Ys(c.goToNextPage,e,n)?u+=Math.max(1,Un.current.height-4):Ys(c.goToPreviousPage,e,n)?u-=Math.max(1,Un.current.height-4):Ys(c.goToFirstCell,e,n)?(a(void 0),u=0,l=0):Ys(c.goToLastCell,e,n)?(a(void 0),u=2**53-1,l=2**53-1):Ys(c.selectToFirstCell,e,n)?(a(void 0),ii([-2,-2])):Ys(c.selectToLastCell,e,n)?(a(void 0),ii([2,2])):li?(Ys(c.closeOverlay,e,n)&&a(void 0),Ys(c.acceptOverlayDown,e,n)&&(a(void 0),u++),Ys(c.acceptOverlayUp,e,n)&&(a(void 0),u--),Ys(c.acceptOverlayLeft,e,n)&&(a(void 0),l--),Ys(c.acceptOverlayRight,e,n)&&(a(void 0),l++)):(Ys(c.goDownCell,e,n)?u+=1:Ys(c.goUpCell,e,n)?--u:Ys(c.goRightCell,e,n)?l+=1:Ys(c.goLeftCell,e,n)?--l:Ys(c.goDownCellRetainSelection,e,n)?(u+=1,d=!0):Ys(c.goUpCellRetainSelection,e,n)?(--u,d=!0):Ys(c.goRightCellRetainSelection,e,n)?(l+=1,d=!0):Ys(c.goLeftCellRetainSelection,e,n)?(--l,d=!0):Ys(c.goToLastRow,e,n)?u=y-1:Ys(c.goToFirstRow,e,n)?u=-(2**53-1):Ys(c.goToLastColumn,e,n)?l=2**53-1:Ys(c.goToFirstColumn,e,n)?l=-(2**53-1):(be===`rect`||be===`multi-rect`)&&(Ys(c.selectGrowDown,e,n)?ii([0,1]):Ys(c.selectGrowUp,e,n)?ii([0,-1]):Ys(c.selectGrowRight,e,n)?ii([1,0]):Ys(c.selectGrowLeft,e,n)?ii([-1,0]):Ys(c.selectToLastRow,e,n)?ii([0,2]):Ys(c.selectToFirstRow,e,n)?ii([0,-2]):Ys(c.selectToLastColumn,e,n)?ii([2,0]):Ys(c.selectToFirstColumn,e,n)&&ii([-2,0])),f=n.didMatch);let p=ai(l,u,!1,d),m=n.didMatch;return m&&(p||!f||Dt)&&t(),m},[li,z,nn,xe,Se,be,R,y,ai,yn,Re,v.length,Tn,Dt,ci,On,Dn,on,Sr,xr,T,hr,Kr,Gr,ii]),di=L.useCallback(e=>{let t=!1;if(fe!==void 0&&fe({...e,cancel:()=>{t=!0}}),t||ui(e)||z.current===void 0)return;let[n,r]=z.current.cell,i=Un.current;if(he&&!e.metaKey&&!e.ctrlKey&&z.current!==void 0&&e.key.length===1&&/[ -~]/g.test(e.key)&&e.bounds!==void 0&&Qe(b([n-R,Math.max(0,Math.min(r,y-1))]))){if((!on||r!==y)&&(i.y>r||r>i.y+i.height||i.x>n||n>i.x+i.width))return;hr(e.bounds,!0,e.key),e.stopPropagation(),e.preventDefault()}},[he,fe,ui,z,b,R,y,on,hr]),fi=L.useCallback((e,t)=>{let n=e.location[0]-R;if(e.kind===`header`&&re?.(n,{...e,preventDefault:t}),e.kind===`group-header`){if(n<0)return;ie?.(n,{...e,preventDefault:t})}if(e.kind===`cell`){let[r,i]=e.location;ne?.([n,i],{...e,preventDefault:t}),kr(z,e.location)||ai(r,i,!1,!1)}},[z,ne,ie,re,R,ai]),pi=L.useCallback(async e=>{if(!nn.paste)return;function t(e,t,n,r){let i=typeof n==`object`?n?.join(` +`?(r.push(lc(e.slice(i,o))),i=o+1,s===` +`&&(n.push(r),r=[]),a=t.None):a=t.None;break}o++}return ie.map(e=>({rawValue:e,formatted:e,format:`string`})))}function nee(e,t,n){let r=oc(e,t),i=e=>{window.navigator.clipboard?.writeText(e)},a=(e,t)=>window.navigator.clipboard?.write===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]),!0);window.navigator.clipboard?.write!==void 0||n?.clipboardData!==void 0?((e,t)=>{try{if(n===void 0||n.clipboardData===null)throw Error(`No clipboard data`);n?.clipboardData?.setData(`text/plain`,e),n?.clipboardData?.setData(`text/html`,t)}catch{a(e,t)||i(e)}})(r.textPlain,r.textHtml):i(r.textPlain),n?.preventDefault()}function dc(e){return e!==!0}St();function fc(e){return typeof e==`string`?e:`${e}px`}var pc=xt(`div`)({name:`Wrapper`,class:`gdg-wmyidgi`,propsAsIs:!1,vars:{"wmyidgi-0":[e=>e.innerWidth],"wmyidgi-1":[e=>e.innerHeight]}}),mc=e=>{let{inWidth:t,inHeight:n,children:r,...i}=e;return L.createElement(pc,{innerHeight:fc(n),innerWidth:fc(t),...i},r)},hc=2,gc=1300;function _c(e,t,n){let r=L.useRef(0),[i,a]=e??[0,0];L.useEffect(()=>{if(i===0&&a===0){r.current=0;return}let e=!1,o=0,s=c=>{if(!e){if(o===0)o=c;else{let e=c-o;r.current=Math.min(1,r.current+e/gc);let s=r.current**1.618*e*hc;t.current?.scrollBy(i*s,a*s),o=c,n?.()}window.requestAnimationFrame(s)}};return window.requestAnimationFrame(s),()=>{e=!0}},[t,i,a,n])}Ti();function vc({rowHeight:e,headerHeight:t,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:a,scaleToRem:o,remSize:s}){let[c,l,u,d,f,p]=L.useMemo(()=>{if(!o||s===16)return[e,t,n,r,i,a];let c=s/16,l=e,u=bi();return[typeof l==`number`?l*c:e=>Math.ceil(l(e)*c),Math.ceil(t*c),Math.ceil(n*c),{...r,headerIconSize:(r?.headerIconSize??u.headerIconSize)*c,cellHorizontalPadding:(r?.cellHorizontalPadding??u.cellHorizontalPadding)*c,cellVerticalPadding:(r?.cellVerticalPadding??u.cellVerticalPadding)*c},Math.ceil((i??0)*c),Math.ceil((a??0)*c)]},[n,t,i,a,s,e,o,r]);return{rowHeight:c,headerHeight:l,groupHeaderHeight:u,theme:d,overscrollX:f,overscrollY:p}}var yc={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function bc(e,t){return e===!0?t:e===!1?``:e}function xc(e){let t=_s.value;return{activateCell:bc(e.activateCell,` |Enter|shift+Enter`),clear:bc(e.clear,`any+Escape`),closeOverlay:bc(e.closeOverlay,`any+Escape`),acceptOverlayDown:bc(e.acceptOverlayDown,`Enter`),acceptOverlayUp:bc(e.acceptOverlayUp,`shift+Enter`),acceptOverlayLeft:bc(e.acceptOverlayLeft,`shift+Tab`),acceptOverlayRight:bc(e.acceptOverlayRight,`Tab`),copy:e.copy,cut:e.cut,delete:bc(e.delete,t?`Backspace|Delete`:`Delete`),downFill:bc(e.downFill,`primary+_68`),scrollToSelectedCell:bc(e.scrollToSelectedCell,`primary+Enter`),goDownCell:bc(e.goDownCell,`ArrowDown`),goDownCellRetainSelection:bc(e.goDownCellRetainSelection,`alt+ArrowDown`),goLeftCell:bc(e.goLeftCell,`ArrowLeft|shift+Tab`),goLeftCellRetainSelection:bc(e.goLeftCellRetainSelection,`alt+ArrowLeft`),goRightCell:bc(e.goRightCell,`ArrowRight|Tab`),goRightCellRetainSelection:bc(e.goRightCellRetainSelection,`alt+ArrowRight`),goUpCell:bc(e.goUpCell,`ArrowUp`),goUpCellRetainSelection:bc(e.goUpCellRetainSelection,`alt+ArrowUp`),goToFirstCell:bc(e.goToFirstCell,`primary+Home`),goToFirstColumn:bc(e.goToFirstColumn,`Home|primary+ArrowLeft`),goToFirstRow:bc(e.goToFirstRow,`primary+ArrowUp`),goToLastCell:bc(e.goToLastCell,`primary+End`),goToLastColumn:bc(e.goToLastColumn,`End|primary+ArrowRight`),goToLastRow:bc(e.goToLastRow,`primary+ArrowDown`),goToNextPage:bc(e.goToNextPage,`PageDown`),goToPreviousPage:bc(e.goToPreviousPage,`PageUp`),paste:e.paste,rightFill:bc(e.rightFill,`primary+_82`),search:bc(e.search,`primary+f`),selectAll:bc(e.selectAll,`primary+a`),selectColumn:bc(e.selectColumn,`ctrl+ `),selectGrowDown:bc(e.selectGrowDown,`shift+ArrowDown`),selectGrowLeft:bc(e.selectGrowLeft,`shift+ArrowLeft`),selectGrowRight:bc(e.selectGrowRight,`shift+ArrowRight`),selectGrowUp:bc(e.selectGrowUp,`shift+ArrowUp`),selectRow:bc(e.selectRow,`shift+ `),selectToFirstCell:bc(e.selectToFirstCell,`primary+shift+Home`),selectToFirstColumn:bc(e.selectToFirstColumn,`primary+shift+ArrowLeft`),selectToFirstRow:bc(e.selectToFirstRow,`primary+shift+ArrowUp`),selectToLastCell:bc(e.selectToLastCell,`primary+shift+End`),selectToLastColumn:bc(e.selectToLastColumn,`primary+shift+ArrowRight`),selectToLastRow:bc(e.selectToLastRow,`primary+shift+ArrowDown`)}}function Sc(e){let t=dn(e);return L.useMemo(()=>{if(t===void 0)return xc(yc);let e={...t,goToNextPage:t?.goToNextPage??t?.pageDown??yc.goToNextPage,goToPreviousPage:t?.goToPreviousPage??t?.pageUp??yc.goToPreviousPage,goToFirstCell:t?.goToFirstCell??t?.first??yc.goToFirstCell,goToLastCell:t?.goToLastCell??t?.last??yc.goToLastCell,selectToFirstCell:t?.selectToFirstCell??t?.first??yc.selectToFirstCell,selectToLastCell:t?.selectToLastCell??t?.last??yc.selectToLastCell};return xc({...yc,...e})},[t])}var Cc=g(),wc=`modulepreload`,Tc=function(e,t){return new URL(e,t).href},Ec={},Dc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tc(t,n),t=s(t),t in Ec)return;Ec[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Oc,kc,Ac,jc,Mc,Nc,Pc,Fc=o((()=>{St(),Oc=()=>e=>e.targetX,kc=()=>e=>e.targetY,Ac=()=>e=>e.targetWidth,jc=()=>e=>e.targetHeight,Mc=()=>e=>e.targetY+10,Nc=()=>e=>Math.max(0,(e.targetHeight-28)/2),Pc=xt(`div`)({name:`DataGridOverlayEditorStyle`,class:`gdg-d19meir1`,propsAsIs:!1,vars:{"d19meir1-0":[kc(),`px`],"d19meir1-1":[Oc(),`px`],"d19meir1-2":[Ac(),`px`],"d19meir1-3":[jc(),`px`],"d19meir1-4":[Mc(),`px`],"d19meir1-5":[Nc(),`px`]}})}));function Ic(){let[e,t]=Rc.useState();return[e??void 0,t]}function Lc(){let[e,t]=Ic(),[n,r]=Rc.useState(0),[i,a]=Rc.useState(!0);return Rc.useLayoutEffect(()=>{if(e===void 0||!(`IntersectionObserver`in window))return;let t=new IntersectionObserver(e=>{e.length!==0&&a(e[0].isIntersecting)},{threshold:1});return t.observe(e),()=>t.disconnect()},[e]),Rc.useEffect(()=>{if(i||e===void 0)return;let t,n=()=>{let{right:i}=e.getBoundingClientRect();r(e=>Math.min(e+window.innerWidth-i-10,0)),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{t!==void 0&&cancelAnimationFrame(t)}},[e,i]),{ref:t,style:Rc.useMemo(()=>({transform:`translateX(${n}px)`}),[n])}}var Rc,zc=o((()=>{Rc=u(f(),1)})),Bc=c({default:()=>Hc}),Vc,Hc,Uc=o((()=>{Vc=u(f(),1),Ws(),Ti(),ct(),Fc(),zc(),Hc=e=>{let{target:t,content:n,onFinishEditing:r,forceEditMode:i,initialValue:a,imageEditorOverride:o,markdownDivCreateNode:s,highlight:c,className:l,theme:u,id:d,cell:f,bloom:p,validateCell:m,getCellRenderer:h,provideEditor:g,isOutsideClick:_}=e,[v,y]=Vc.useState(i?n:void 0),b=Vc.useRef(v??n);b.current=v??n;let[x,S]=Vc.useState(()=>m===void 0||!(Xe(n)&&m?.(f,n,b.current)===!1)),C=Vc.useCallback((e,t)=>{r(x?e:void 0,t)},[x,r]),w=Vc.useCallback(e=>{if(m!==void 0&&e!==void 0&&Xe(e)){let t=m(f,e,b.current);t===!1?S(!1):(typeof t==`object`&&(e=t),S(!0))}y(e)},[f,m]),T=Vc.useRef(!1),E=Vc.useRef(void 0),D=Vc.useCallback(()=>{C(v,[0,0]),T.current=!0},[v,C]),O=Vc.useCallback((e,t)=>{C(e,t??E.current??[0,0]),T.current=!0},[C]),k=Vc.useCallback(async e=>{let t=!1;e.key===`Escape`?(e.stopPropagation(),e.preventDefault(),E.current=[0,0]):e.key===`Enter`&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),E.current=[0,1],t=!0):e.key===`Tab`&&(e.stopPropagation(),e.preventDefault(),E.current=[e.shiftKey?-1:1,0],t=!0),window.setTimeout(()=>{!T.current&&E.current!==void 0&&(C(t?v:void 0,E.current),T.current=!0)},0)},[C,v]),A=v??n,[j,M]=Vc.useMemo(()=>{if(Ze(n))return[];let e=g?.(n);return e===void 0?[h(n)?.provideEditor?.(n),!1]:[e,!1]},[n,h,g]),{ref:ee,style:N}=Lc(),te=!0,ne,P=!0,re;if(j!==void 0){te=j.disablePadding!==!0,P=j.disableStyling!==!0;let e=$e(j);e&&(re=j.styleOverride);let n=e?j.editor:j;ne=Vc.createElement(n,{isHighlighted:c,onChange:w,value:A,initialValue:a,onFinishedEditing:O,validatedSelection:Xe(A)?A.selectionRange:void 0,forceEditMode:i,target:t,imageEditorOverride:o,markdownDivCreateNode:s,isValid:x,theme:u})}re={...re,...N};let F=document.getElementById(`portal`);if(F===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let ie=P?`gdg-style`:`gdg-unstyle`;x||(ie+=` gdg-invalid`),te&&(ie+=` gdg-pad`);let ae=p?.[0]??1,oe=p?.[1]??1;return(0,Cc.createPortal)(Vc.createElement(wi.Provider,{value:u},Vc.createElement(Us,{style:yi(u),className:l,onClickOutside:D,isOutsideClick:_},Vc.createElement(Pc,{ref:ee,id:d,className:ie,style:re,as:M===!0?`label`:void 0,targetX:t.x-ae,targetY:t.y-oe,targetWidth:t.width+ae*2,targetHeight:t.height+oe*2},Vc.createElement(`div`,{className:`gdg-clip-region`,onKeyDown:k},ne)))),F)}}));E();var Wc=u(qi(),1),Gc=u(Zi(),1);ct(),Ti(),vr();var Kc=L.lazy(async()=>await Dc(()=>Promise.resolve().then(()=>(Uc(),Bc)),void 0,import.meta.url)),qc=0;function Jc(e){return(0,Wc.default)((0,Gc.default)((0,Gc.default)(e).filter(e=>e.span!==void 0).map(e=>(0,ws.default)((e.span?.[0]??0)+1,(e.span?.[1]??0)+1))))}function Yc(e,t){return e===void 0||t===0||e.columns.length===0&&e.current===void 0?e:{current:e.current===void 0?void 0:{cell:[e.current.cell[0]+t,e.current.cell[1]],range:{...e.current.range,x:e.current.range.x+t},rangeStack:e.current.rangeStack.map(e=>({...e,x:e.x+t}))},rows:e.rows,columns:e.columns.offset(t)}}var Xc={kind:I.Loading,allowOverlay:!1},Zc={columns:st.empty(),rows:st.empty(),current:void 0},Qc=L.forwardRef((e,t)=>{let[n,r]=L.useState(Zc),[i,a]=L.useState(),o=L.useRef(null),s=L.useRef(null),[c,l]=L.useState(),u=L.useRef(null),d=L.useRef(),f=typeof window>`u`?null:window,{imageEditorOverride:p,getRowThemeOverride:m,markdownDivCreateNode:h,width:g,height:_,columns:v,rows:y,getCellContent:b,onCellClicked:w,onCellActivated:T,onFillPattern:E,onFinishedEditing:D,coercePasteValue:O,drawHeader:k,drawCell:A,editorBloom:j,onHeaderClicked:M,onColumnProposeMove:ee,spanRangeBehavior:N=`default`,onGroupHeaderClicked:te,onCellContextMenu:ne,className:P,onHeaderContextMenu:re,getCellsForSelection:F,onGroupHeaderContextMenu:ie,onGroupHeaderRenamed:ae,onCellEdited:oe,onCellsEdited:se,onSearchResultsChanged:ce,searchResults:le,onSearchValueChange:ue,searchValue:de,onKeyDown:fe,onKeyUp:pe,keybindings:me,editOnType:he=!0,onRowAppended:ge,onColumnMoved:_e,validateCell:ve,highlightRegions:ye,rangeSelect:be=`rect`,columnSelect:xe=`multi`,rowSelect:Se=`multi`,rangeSelectionBlending:Ce=`exclusive`,columnSelectionBlending:we=`exclusive`,rowSelectionBlending:Te=`exclusive`,onDelete:Ee,onDragStart:De,onMouseMove:Oe,onPaste:ke,copyHeaders:Ae=!1,freezeColumns:je=0,cellActivationBehavior:Me=`second-click`,rowSelectionMode:Ne=`auto`,onHeaderMenuClick:Pe,getGroupDetails:Fe,onSearchClose:Ie,onItemHovered:Le,onSelectionCleared:Re,showSearch:ze,onVisibleRegionChanged:Be,gridSelection:Ve,onGridSelectionChange:He,minColumnWidth:Ue=50,maxColumnWidth:We=500,maxColumnAutoWidth:Ge,provideEditor:Ke,trailingRowOptions:qe,freezeTrailingRows:Je=0,allowedFillDirections:Ye=`orthogonal`,scrollOffsetX:et,scrollOffsetY:tt,verticalBorder:nt,onDragOverCell:rt,onDrop:it,onColumnResize:ot,onColumnResizeEnd:ct,onColumnResizeStart:lt,customRenderers:ut,fillHandle:dt,drawFocusRing:ft=!0,experimental:pt,fixedShadowX:mt,fixedShadowY:ht,headerIcons:gt,imageWindowLoader:_t,initialSize:vt,isDraggable:yt,onDragLeave:bt,onRowMoved:xt,overscrollX:St,overscrollY:Ct,preventDiagonalScrolling:wt,rightElement:Tt,rightElementProps:Et,trapFocus:Dt=!1,smoothScrollX:Ot,smoothScrollY:kt,scaleToRem:At=!1,rowHeight:jt=34,headerHeight:Mt=36,groupHeaderHeight:Nt=Mt,theme:Pt,isOutsideClick:Ft,renderers:It}=e,Lt=typeof e.rowMarkers==`string`?void 0:e.rowMarkers,Rt=Lt?.kind??e.rowMarkers??`none`,zt=Lt?.width??e.rowMarkerWidth,Bt=Lt?.startIndex??e.rowMarkerStartIndex??1,Vt=Lt?.theme??e.rowMarkerTheme,Ht=Lt?.checkboxStyle??`square`,Ut=Math.max(Ue,20),Wt=Math.max(We,Ut),Gt=Math.max(Ge??Wt,Ut),Yt=L.useMemo(()=>typeof window>`u`?{fontSize:`16px`}:window.getComputedStyle(document.documentElement),[]),{rowHeight:Xt,headerHeight:Zt,groupHeaderHeight:Qt,theme:$t,overscrollX:en,overscrollY:tn}=vc({groupHeaderHeight:Nt,headerHeight:Mt,overscrollX:St,overscrollY:Ct,remSize:L.useMemo(()=>Number.parseFloat(Yt.fontSize),[Yt]),rowHeight:jt,scaleToRem:At,theme:Pt}),nn=Sc(me),rn=zt??(y>1e4?48:y>1e3?44:y>100?36:32),an=Rt!==`none`,R=+!!an,on=ge!==void 0,cn=qe?.sticky===!0,[un,dn]=L.useState(!1),fn=ze??un,pn=L.useCallback(()=>{Ie===void 0?dn(!1):Ie()},[Ie]),z=L.useMemo(()=>Ve===void 0?void 0:Yc(Ve,R),[Ve,R])??n,mn=L.useRef();mn.current===void 0&&(mn.current=new AbortController),L.useEffect(()=>()=>mn?.current.abort(),[]);let[hn,gn]=Zs(F,b,R,mn.current,y),_n=L.useCallback((e,t,n)=>{if(ve===void 0)return!0;let r=[e[0]-R,e[1]];return ve?.(r,t,n)},[R,ve]),vn=L.useRef(Ve),yn=L.useCallback((e,t)=>{t&&(e=cc(e,hn,R,N,mn.current)),He===void 0?r(e):(vn.current=Yc(e,-R),He(vn.current))},[He,hn,R,N]),bn=Jt(ot,L.useCallback((e,t,n,r)=>{ot?.(v[n-R],t,n-R,r)},[ot,R,v])),xn=Jt(ct,L.useCallback((e,t,n,r)=>{ct?.(v[n-R],t,n-R,r)},[ct,R,v])),Sn=Jt(lt,L.useCallback((e,t,n,r)=>{lt?.(v[n-R],t,n-R,r)},[lt,R,v])),Cn=Jt(k,L.useCallback((e,t)=>k?.({...e,columnIndex:e.columnIndex-R},t)??!1,[k,R])),wn=Jt(A,L.useCallback((e,t)=>A?.({...e,col:e.col-R},t)??!1,[A,R])),Tn=L.useCallback(e=>{if(Ee!==void 0){let t=Ee(Yc(e,-R));return typeof t==`boolean`?t:Yc(t,R)}return!0},[Ee,R]),[En,Dn,On]=Xs(z,yn,Ce,we,Te,be),kn=L.useMemo(()=>xi(bi(),$t),[$t]),[An,jn]=L.useState([0,0,0]),Mn=L.useMemo(()=>{if(It===void 0)return{};let e={};for(let t of It)e[t.kind]=t;return e},[It]),Nn=L.useCallback(e=>e.kind===I.Custom?ut?.find(t=>t.isMatch(e)):Mn[e.kind],[ut,Mn]),{sizedColumns:Pn,nonGrowWidth:Fn}=ki(v,y,gn,An[0]-(R===0?0:rn)-An[2],Ut,Gt,kn,Nn,mn.current);Rt!==`none`&&(Fn+=rn);let In=L.useMemo(()=>Pn.some(e=>e.group!==void 0),[Pn]),Ln=In?Zt+Qt:Zt,Rn=z.rows.length,zn=Rt===`none`?void 0:Rn===0?!1:Rn===y||void 0,Bn=L.useMemo(()=>Rt===`none`?Pn:[{title:``,width:rn,icon:void 0,hasMenu:!1,style:`normal`,themeOverride:Vt,rowMarker:Ht,rowMarkerChecked:zn},...Pn],[Rt,Pn,rn,Vt,Ht,zn]),[Vn,Hn]=L.useMemo(()=>[tt!==void 0&&typeof Xt==`number`?Math.floor(tt/Xt):0,tt!==void 0&&typeof Xt==`number`?-(tt%Xt):0],[tt,Xt]),Un=L.useRef({height:1,width:1,x:0,y:0}),Wn=L.useMemo(()=>({x:Un.current.x,y:Vn,width:Un.current.width??1,height:Un.current.height??1,ty:Hn}),[Hn,Vn]),Gn=L.useRef(!1),[Kn,qn,Jn]=ln(Wn);Un.current=Kn;let Yn=(Kn.height??1)>1;L.useLayoutEffect(()=>{if(tt!==void 0&&u.current!==null&&Yn){if(u.current.scrollTop===tt)return;u.current.scrollTop=tt,u.current.scrollTop!==tt&&Jn(),Gn.current=!0}},[tt,Yn,Jn]);let Xn=(Kn.width??1)>1;L.useLayoutEffect(()=>{if(et!==void 0&&u.current!==null&&Xn){if(u.current.scrollLeft===et)return;u.current.scrollLeft=et,u.current.scrollLeft!==et&&Jn(),Gn.current=!0}},[et,Xn,Jn]);let Zn=Kn.x+R,Qn=Kn.y,$n=L.useRef(null),er=L.useCallback(e=>{e===!0?$n.current?.focus():window.requestAnimationFrame(()=>{$n.current?.focus()})},[]),tr=on?y+1:y,nr=L.useCallback(e=>{let t=R===0?e:e.map(e=>({...e,location:[e.location[0]-R,e.location[1]]})),n=se?.(t);if(n!==!0)for(let e of t)oe?.(e.location,e.value);return n},[oe,se,R]),[rr,ir]=L.useState(),ar=z.current!==void 0&&z.current.range.width*z.current.range.height>1?z.current.range:void 0,or=ft?z.current?.cell:void 0,sr=or?.[0],cr=or?.[1],lr=L.useMemo(()=>{if((ye===void 0||ye.length===0)&&(ar??sr??cr??rr)===void 0)return;let e=[];if(ye!==void 0)for(let t of ye){let n=Bn.length-t.range.x-R;n>0&&e.push({color:t.color,range:{...t.range,x:t.range.x+R,width:Math.min(n,t.range.width)},style:t.style})}return rr!==void 0&&e.push({color:fr(kn.accentColor,0),range:rr,style:`dashed`}),ar!==void 0&&e.push({color:fr(kn.accentColor,.5),range:ar,style:`solid-outline`}),sr!==void 0&&cr!==void 0&&e.push({color:kn.accentColor,range:{x:sr,y:cr,width:1,height:1},style:`solid-outline`}),e.length>0?e:void 0},[rr,ar,sr,cr,ye,Bn.length,kn.accentColor,R]),ur=L.useRef(Bn);ur.current=Bn;let dr=L.useCallback(([e,t],n=!1)=>{let r=on&&t===tr-1;if(e===0&&an)return r?Xc:{kind:at.Marker,allowOverlay:!1,checkboxStyle:Ht,checked:z?.rows.hasIndex(t)===!0,markerKind:Rt===`clickable-number`?`number`:Rt,row:Bt+t,drawHandle:xt!==void 0,cursor:Rt===`clickable-number`?`pointer`:void 0};if(r){let t=e===R?qe?.hint??``:``,n=ur.current[e];if(n?.trailingRowOptions?.disabled===!0)return Xc;{let e=n?.trailingRowOptions?.hint??t,r=n?.trailingRowOptions?.addIcon??qe?.addIcon;return{kind:at.NewRow,hint:e,allowOverlay:!1,icon:r}}}else{let r=e-R;if(n||pt?.strict===!0){let e=Un.current,n=e.x>r||r>e.x+e.width||e.y>t||t>e.y+e.height||t>=br.current,i=r===e.extras?.selected?.[0]&&t===e.extras?.selected[1],a=!1;if(e.extras?.freezeRegions!==void 0){for(let n of e.extras.freezeRegions)if(ba(n,r,t)){a=!0;break}}if(n&&!i&&!a)return Xc}let i=b([r,t]);return R!==0&&i.span!==void 0&&(i={...i,span:[i.span[0]+R,i.span[1]+R]}),i}},[on,tr,an,Ht,z?.rows,Rt,Bt,xt,R,qe?.hint,qe?.addIcon,pt?.strict,b]),pr=L.useCallback(e=>{let t=Fe?.(e)??{name:e};return ae!==void 0&&e!==``&&(t={icon:t.icon,name:t.name,overrideTheme:t.overrideTheme,actions:[...t.actions??[],{title:`Rename`,icon:`renameIcon`,onClick:e=>Lr({group:t.name,bounds:e.bounds})}]}),t},[Fe,ae]),mr=L.useCallback(e=>{let[t,n]=e.cell,r=Bn[t],i=r?.group===void 0?void 0:pr(r.group)?.overrideTheme,o=r?.themeOverride,s=m?.(n);a({...e,theme:xi(kn,i,o,s,e.content.themeOverride)})},[m,Bn,pr,kn]),hr=L.useCallback((e,t,n)=>{if(z.current===void 0)return;let[r,i]=z.current.cell,a=dr([r,i]);if(a.kind!==I.Boolean&&a.allowOverlay){let t=a;if(n!==void 0)switch(t.kind){case I.Number:{let e=C(()=>n===`-`?-0:Number.parseFloat(n),0);t={...t,data:Number.isNaN(e)?0:e};break}case I.Text:case I.Markdown:case I.Uri:t={...t,data:n};break}mr({target:e,content:t,initialValue:n,cell:[r,i],highlight:n===void 0,forceEditMode:n!==void 0})}else a.kind===I.Boolean&&t&&a.readonly!==!0&&(nr([{location:z.current.cell,value:{...a,data:dc(a.data)}}]),$n.current?.damage([{cell:z.current.cell}]))},[dr,z,nr,mr]),gr=L.useCallback((e,t)=>{let n=$n.current?.getBounds(e,t);if(n===void 0||u.current===null)return;let r=dr([e,t]);r.allowOverlay&&mr({target:n,content:r,initialValue:void 0,highlight:!0,cell:[e,t],forceEditMode:!0})},[dr,mr]),_r=L.useCallback((e,t,n=`both`,r=0,i=0,a=void 0)=>{if(u.current!==null){let o=$n.current,c=s.current,l=typeof e==`number`?e:e.unit===`cell`?e.amount:void 0,d=typeof t==`number`?t:t.unit===`cell`?t.amount:void 0,f=typeof e!=`number`&&e.unit===`px`?e.amount:void 0,p=typeof t!=`number`&&t.unit===`px`?t.amount:void 0;if(o!==null&&c!==null){let s={x:0,y:0,width:0,height:0},m=0,h=0;if((l!==void 0||d!==void 0)&&(s=o.getBounds((l??0)+R,d??0)??s,s.width===0||s.height===0))return;let g=c.getBoundingClientRect(),_=g.width/c.offsetWidth;if(f!==void 0&&(s={...s,x:f-g.left-u.current.scrollLeft,width:1}),p!==void 0&&(s={...s,y:p+g.top-u.current.scrollTop,height:1}),s!==void 0){let o={x:s.x-r,y:s.y-i,width:s.width+2*r,height:s.height+2*i},c=0;for(let e=0;e0&&(l=zr(tr,d,Xt));let f=c*_+g.left+R*rn*_,p=g.right,v=g.top+Ln*_,y=g.bottom-l*_,b=s.width+r*2;switch(a?.hAlign){case`start`:p=f+b;break;case`end`:f=p-b;break;case`center`:f=Math.floor((f+p)/2)-b/2,p=f+b;break}let x=s.height+i*2;switch(a?.vAlign){case`start`:y=v+x;break;case`end`:v=y-x;break;case`center`:v=Math.floor((v+y)/2)-x/2,y=v+x;break}f>o.x?m=o.x-f:po.y?h=o.y-v:y=tr-d)&&(h=0),(m!==0||h!==0)&&(_!==1&&(m/=_,h/=_),u.current.scrollTo(m+u.current.scrollLeft,h+u.current.scrollTop))}}}},[R,Je,rn,Ln,je,Pn,tr,cn,Xt]),vr=L.useRef(gr),yr=L.useRef(b),br=L.useRef(y);vr.current=gr,yr.current=b,br.current=y;let xr=L.useCallback(async(e,t=!0)=>{if(Bn[e]?.trailingRowOptions?.disabled===!0)return;let n=ge?.(),r,i=!0;n!==void 0&&(r=await n,r===`top`&&(i=!1),typeof r==`number`&&(i=!1));let a=0,o=()=>{if(br.current<=y){a<500&&window.setTimeout(o,a),a=50+a*2;return}let n=typeof r==`number`?r:i?y:0;vi.current(e-R,n),En({cell:[e,n],range:{x:e,y:n,width:1,height:1}},!1,!1,`edit`);let s=yr.current([e-R,n]);s.allowOverlay&&Qe(s)&&s.readonly!==!0&&t&&window.setTimeout(()=>{vr.current(e,n)},0)};o()},[Bn,ge,R,y,En]),Sr=L.useCallback(e=>{let t=Pn[e]?.trailingRowOptions?.targetColumn??qe?.targetColumn;if(typeof t==`number`)return t+ +!!an;if(typeof t==`object`){let e=v.indexOf(t);if(e>=0)return e+ +!!an}},[Pn,v,an,qe?.targetColumn]),Cr=L.useRef(),wr=L.useRef(),Tr=L.useCallback((e,t)=>{let[n,r]=t;return xi(kn,Bn[n]?.themeOverride,m?.(r),e.themeOverride)},[m,Bn,kn]),Er=L.useCallback(e=>{let t=_s.value?e.metaKey:e.ctrlKey,n=t&&Se===`multi`,r=t&&xe===`multi`,[i,o]=e.location,s=z.columns,c=z.rows,[l,u]=z.current?.cell??[];if(e.kind===`cell`){if(wr.current=void 0,Or.current=[i,o],i===0&&an){if(on===!0&&o===y||Rt===`number`||Se===`none`)return;let r=dr(e.location);if(r.kind!==at.Marker)return;if(xt!==void 0){let t=Nn(r);x(t?.kind===at.Marker);let n=t?.onClick?.({...e,cell:r,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,theme:Tr(r,e.location),preventDefault:()=>void 0});if(n===void 0||n.checked===r.checked)return}a(void 0),er();let i=c.hasIndex(o),s=Cr.current;if(Se===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&s!==void 0&&c.hasIndex(s)){let e=[Math.min(s,o),Math.max(s,o)+1];n||Ne===`multi`?Dn(void 0,e,!0):Dn(st.fromSingleSelection(e),void 0,n)}else n||e.isTouch||Ne===`multi`?i?Dn(c.remove(o),void 0,!0):(Dn(void 0,o,!0),Cr.current=o):i&&c.length===1?Dn(st.empty(),void 0,t):(Dn(st.fromSingleSelection(o),void 0,t),Cr.current=o)}else if(i>=R&&on&&o===y){let e=Sr(i);xr(e??i)}else if(l!==i||u!==o){let n=dr(e.location),r=Nn(n);if(r?.onSelect!==void 0){let t=!1;if(r.onSelect({...e,cell:n,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,preventDefault:()=>t=!0,theme:Tr(n,e.location)}),t)return}let s=cn&&o===y,c=cn&&z!==void 0&&z.current?.cell[1]===y;if((e.shiftKey||e.isLongTouch===!0)&&l!==void 0&&u!==void 0&&z.current!==void 0&&!c){if(s)return;let e=Math.min(i,l),n=Math.max(i,l),r=Math.min(o,u),a=Math.max(o,u);En({...z.current,range:{x:e,y:r,width:n-e+1,height:a-r+1}},!0,t,`click`),Cr.current=void 0,er()}else En({cell:[i,o],range:{x:i,y:o,width:1,height:1}},!0,t,`click`),Cr.current=void 0,a(void 0),er()}}else if(e.kind===`header`)if(Or.current=[i,o],a(void 0),an&&i===0)Cr.current=void 0,wr.current=void 0,Se===`multi`&&(c.length===y?Dn(st.empty(),void 0,t):Dn(st.fromSingleSelection([0,y]),void 0,t),er());else{let n=wr.current;if(xe===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&n!==void 0&&s.hasIndex(n)){let e=[Math.min(n,i),Math.max(n,i)+1];r?On(void 0,e,t):On(st.fromSingleSelection(e),void 0,t)}else r?(s.hasIndex(i)?On(s.remove(i),void 0,t):On(void 0,i,t),wr.current=i):xe!==`none`&&(On(st.fromSingleSelection(i),void 0,t),wr.current=i);Cr.current=void 0,er()}else e.kind===`group-header`?Or.current=[i,o]:e.kind===`out-of-bounds`&&!e.isMaybeScrollbar&&(yn(Zc,!1),a(void 0),er(),Re?.(),Cr.current=void 0,wr.current=void 0)},[xr,xe,er,Nn,Sr,dr,z,an,cn,Re,xt,R,Rt,Se,Ne,y,En,yn,On,Dn,on,Tr]),Dr=L.useRef(!1),Or=L.useRef(),jr=L.useRef(Kn),Pr=L.useRef(),Fr=L.useCallback(e=>{if(Br.current=!1,jr.current=Un.current,e.button!==0&&e.button!==1){Pr.current=void 0;return}let t=performance.now();Pr.current={button:e.button,time:t,location:e.location},e?.kind===`header`&&(Dr.current=!0);let n=e.kind===`cell`&&e.isFillHandle;!n&&e.kind!==`cell`&&e.isEdge||(l({previousSelection:z,fillHandle:n}),Or.current=void 0,!e.isTouch&&e.button===0&&!n?Er(e):!e.isTouch&&e.button===1&&(Or.current=e.location))},[z,Er]),[Ir,Lr]=L.useState(),Rr=L.useCallback(e=>{if(e.kind!==`group-header`||xe!==`multi`)return;let t=_s.value?e.metaKey:e.ctrlKey,[n]=e.location,r=z.columns;if(n=R&&Ar(i.group,Bn[e].group);e--)a--;for(let e=n+1;e{if(hn!==void 0&&bn!==void 0){let t=Un.current.y,n=Un.current.height,r=hn({x:e,y:t,width:1,height:Math.min(n,y-t)},mn.current.signal);typeof r!=`object`&&(r=await r());let i=Pn[e-R],a=document.createElement(`canvas`).getContext(`2d`,{alpha:!1});if(a!==null){a.font=kn.baseFontFull;let t=Oi(a,kn,i,0,r,Ut,Wt,!1,Nn);bn?.(i,t.width,e,t.width)}}},[Pn,hn,Wt,kn,Ut,bn,R,y,Nn]),[Hr,Ur]=L.useState(),Wr=L.useCallback(async(e,t)=>{let n=e.current?.range;if(n===void 0||hn===void 0||t.current===void 0)return;let r=t.current.range;if(E!==void 0){let e=!1;if(E({fillDestination:{...r,x:r.x-R},patternSource:{...n,x:n.x-R},preventDefault:()=>e=!0}),e)return}let i=hn(n,mn.current.signal);typeof i!=`object`&&(i=await i());let a=i,o=[];for(let e=0;e({cell:e.location})))},[hn,nr,E,R]),Gr=L.useCallback(()=>{if(z.current===void 0||z.current.range.width<=1)return;let e={...z,current:{...z.current,range:{...z.current.range,width:1}}};Wr(e,z)},[Wr,z]),Kr=L.useCallback(()=>{if(z.current===void 0||z.current.range.height<=1)return;let e={...z,current:{...z.current,range:{...z.current.range,height:1}}};Wr(e,z)},[Wr,z]),qr=L.useCallback((e,t)=>{let n=c;if(l(void 0),ir(void 0),Ur(void 0),Dr.current=!1,t)return;if(n?.fillHandle===!0&&z.current!==void 0&&n.previousSelection?.current!==void 0){if(rr===void 0)return;let e={...z,current:{...z.current,range:xa(n.previousSelection.current.range,rr)}};Wr(n.previousSelection,e),yn(e,!0);return}let[r,i]=e.location,[a,o]=Or.current??[],s=()=>{Br.current=!0},u=t=>{let c=t.isTouch||a===r&&o===i;if(c&&w?.([r-R,i],{...t,preventDefault:s}),t.button===1)return!Br.current;if(!Br.current){let a=dr(e.location),o=Nn(a);if(o!==void 0&&o.onClick!==void 0&&c){let n=o.onClick({...t,cell:a,posX:t.localEventX,posY:t.localEventY,bounds:t.bounds,theme:Tr(a,e.location),preventDefault:s});n!==void 0&&!Ze(n)&&Xe(n)&&(nr([{location:t.location,value:n}]),$n.current?.damage([{cell:t.location}]))}if(Br.current||z.current===void 0)return!1;let l=!1;switch(a.activationBehaviorOverride??Me){case`double-click`:case`second-click`:{if(n?.previousSelection?.current?.cell===void 0)break;let[e,a]=z.current.cell,[o,s]=n.previousSelection.current.cell;l=r===e&&r===o&&i===a&&i===s&&(t.isDoubleClick===!0||Me===`second-click`);break}case`single-click`:l=!0;break}if(l)return T?.([r-R,i]),hr(t.bounds,!1),!0}return!1},d=e.location[0]-R;if(e.isTouch){let t=Un.current,n=jr.current;if(t.x!==n.x||t.y!==n.y)return;if(e.isLongTouch===!0){if(e.kind===`cell`&&Nr(z.current?.cell,e.location)){ne?.([d,e.location[1]],{...e,preventDefault:s});return}else if(e.kind===`header`&&z.columns.hasIndex(r)){re?.(d,{...e,preventDefault:s});return}else if(e.kind===`group-header`){if(d<0)return;ie?.(d,{...e,preventDefault:s});return}}e.kind===`cell`?u(e)||Er(e):e.kind===`group-header`?te?.(d,{...e,preventDefault:s}):(e.kind===`header`&&M?.(d,{...e,preventDefault:s}),Er(e));return}if(e.kind===`header`){if(d<0)return;e.isEdge?e.isDoubleClick===!0&&Vr(r):e.button===0&&r===a&&i===o&&M?.(d,{...e,preventDefault:s})}if(e.kind===`group-header`){if(d<0)return;e.button===0&&r===a&&i===o&&(te?.(d,{...e,preventDefault:s}),Br.current||Rr(e))}e.kind===`cell`&&(e.button===0||e.button===1)&&u(e),Or.current=void 0},[c,z,R,rr,Wr,yn,w,dr,Nn,Me,Tr,nr,T,hr,ne,re,ie,Er,te,M,Vr,Rr]),Jr=L.useCallback(e=>{let t={...e,location:[e.location[0]-R,e.location[1]]};Oe?.(t),c!==void 0&&e.buttons===0&&(l(void 0),ir(void 0),Ur(void 0),Dr.current=!1),Ur(t=>Dr.current?[e.scrollEdge[0],0]:e.scrollEdge[0]===t?.[0]&&e.scrollEdge[1]===t[1]?t:c===void 0||(Pr.current?.location[0]??0){Pe?.(e-R,t)},[Pe,R]),Xr=z?.current?.cell,Zr=L.useCallback((e,t,n,r,i,a)=>{Gn.current=!1;let o=Xr;o!==void 0&&(o=[o[0]-R,o[1]]);let s=je===0?void 0:{x:0,y:e.y,width:je,height:e.height},c=[];s!==void 0&&c.push(s),Je>0&&(c.push({x:e.x-R,y:y-Je,width:e.width,height:Je}),je>0&&c.push({x:0,y:y-Je,width:je,height:Je}));let l={x:e.x-R,y:e.y,width:e.width,height:on&&e.y+e.height>=y?e.height-1:e.height,tx:i,ty:a,extras:{selected:o,freezeRegion:s,freezeRegions:c}};Un.current=l,qn(l),jn([t,n,r]),Be?.(l,l.tx,l.ty,l.extras)},[Xr,R,on,y,je,Je,qn,Be]),Qr=Jt(_e,L.useCallback((e,t)=>{_e?.(e-R,t-R),xe!==`none`&&On(st.fromSingleSelection(t),void 0,!0)},[xe,_e,R,On])),$r=L.useRef(!1),ei=L.useCallback(e=>{if(e.location[0]===0&&R>0){e.preventDefault();return}De?.({...e,location:[e.location[0]-R,e.location[1]]}),e.defaultPrevented()||($r.current=!0),l(void 0)},[De,R]),ti=L.useCallback(()=>{$r.current=!1},[]),ni=L.useRef(),ri=L.useCallback(e=>{if(!Cs(e,ni.current)&&(ni.current=e,!(Pr?.current?.button!==void 0&&Pr.current.button>=1))){if(e.buttons!==0&&c!==void 0&&Pr.current?.location[0]===0&&e.location[0]===0&&R===1&&Se===`multi`&&c.previousSelection&&!c.previousSelection.rows.hasIndex(Pr.current.location[1])&&z.rows.hasIndex(Pr.current.location[1])){let t=Math.min(Pr.current.location[1],e.location[1]),n=Math.max(Pr.current.location[1],e.location[1])+1;Dn(st.fromSingleSelection([t,n]),void 0,!1)}if(e.buttons!==0&&c!==void 0&&z.current!==void 0&&!$r.current&&!Dr.current&&(be===`rect`||be===`multi-rect`)){let[t,n]=z.current.cell,[r,i]=e.location;if(i<0&&(i=Un.current.y),c.fillHandle===!0&&c.previousSelection?.current!==void 0){let e=c.previousSelection.current.range;i=Math.min(i,on?y-1:y);let t=va(e,r,i,Ye);ir(t)}else{if(on&&n===y)return;if(on&&i===y)if(e.kind===`out-of-bounds`)i--;else return;r=Math.max(r,R);let a=r-t,o=i-n,s={x:a>=0?t:r,y:o>=0?n:i,width:Math.abs(a)+1,height:Math.abs(o)+1};En({...z.current,range:s},!0,!1,`drag`)}}Le?.({...e,location:[e.location[0]-R,e.location[1]]})}},[Ye,c,R,Se,z,be,Le,Dn,on,y,En]);_c(Hr,u,L.useCallback(()=>{let e=ni.current;if(e===void 0)return;let[t,n]=e.scrollEdge,[r,i]=e.location,a=Un.current;t===-1?r=a.extras?.freezeRegion?.x??a.x:t===1&&(r=a.x+a.width),n===-1?i=Math.max(0,a.y):n===1&&(i=Math.min(y-1,a.y+a.height)),r=(0,ls.default)(r,0,Bn.length-1),i=(0,ls.default)(i,0,y-1),ri({...e,location:[r,i]})},[Bn.length,ri,y]));let ii=L.useCallback(e=>{if(z.current===void 0)return;let[t,n]=e,[r,i]=z.current.cell,a=z.current.range,o=a.x,s=a.x+a.width,c=a.y,l=a.y+a.height;if(n!==0)switch(n){case 2:l=y,c=i,_r(0,l,`vertical`);break;case-2:c=0,l=i+1,_r(0,c,`vertical`);break;case 1:ci+1?(l--,_r(0,l,`vertical`)):(c=Math.max(0,c-1),_r(0,c,`vertical`));break;default:S(n)}if(t!==0)if(t===2)s=Bn.length,o=r,_r(s-1-R,0,`horizontal`);else if(t===-2)o=R,s=r+1,_r(o-R,0,`horizontal`);else{let e=[];if(hn!==void 0){let t=hn({x:o,y:c,width:s-o-R,height:l-c},mn.current.signal);typeof t==`object`&&(e=Jc(t))}if(t===1){let t=!1;if(o0){let n=(0,ws.default)(o+1,r+1).find(t=>!e.includes(t-R));n!==void 0&&(o=n,t=!0)}else o++,t=!0;t&&_r(o,0,`horizontal`)}t||(s=Math.min(Bn.length,s+1),_r(s-1-R,0,`horizontal`))}else if(t===-1){let t=!1;if(s>r+1){if(e.length>0){let n=(0,ws.default)(s-1,r,-1).find(t=>!e.includes(t-R));n!==void 0&&(s=n,t=!0)}else s--,t=!0;t&&_r(s-R,0,`horizontal`)}t||(o=Math.max(R,o-1),_r(o-R,0,`horizontal`))}else S(t)}En({cell:z.current.cell,range:{x:o,y:c,width:s-o,height:l-c}},!0,!1,`keyboard-select`)},[hn,z,Bn.length,R,y,_r,En]),ai=L.useCallback((e,t,n,r)=>{let i=tr-+!n;if(e=(0,ls.default)(e,R,Pn.length-1+R),t=(0,ls.default)(t,0,i),e===Xr?.[0]&&t===Xr?.[1])return!1;if(r&&z.current!==void 0){let n=[...z.current.rangeStack];(z.current.range.width>1||z.current.range.height>1)&&n.push(z.current.range),yn({...z,current:{cell:[e,t],range:{x:e,y:t,width:1,height:1},rangeStack:n}},!0)}else En({cell:[e,t],range:{x:e,y:t,width:1,height:1}},!0,!1,`keyboard-nav`);return d.current!==void 0&&d.current[0]===e&&d.current[1]===t&&(d.current=void 0),_r(e-R,t),!0},[tr,R,Pn.length,Xr,z,_r,yn,En]),oi=L.useCallback((e,t)=>{i?.cell!==void 0&&e!==void 0&&Xe(e)&&(nr([{location:i.cell,value:e}]),window.requestAnimationFrame(()=>{$n.current?.damage([{cell:i.cell}])})),er(!0),a(void 0);let[n,r]=t;if(z.current!==void 0&&(n!==0||r!==0)){let t=z.current.cell[1]===tr-1&&e!==void 0;ai((0,ls.default)(z.current.cell[0]+n,0,Bn.length-1),(0,ls.default)(z.current.cell[1]+r,0,tr-1),t,!1)}D?.(e,t)},[i?.cell,er,z,D,nr,tr,ai,Bn.length]),si=L.useMemo(()=>`gdg-overlay-${qc++}`,[]),ci=L.useCallback(e=>{er();let t=[];for(let n=e.x;n({cell:e.location})))},[er,b,Nn,nr,R]),li=i!==void 0,ui=L.useCallback(e=>{let t=()=>{e.stopPropagation(),e.preventDefault()},n={didMatch:!1},{bounds:r}=e,i=z.columns,s=z.rows,c=nn;if(!li&&Js(c.clear,e,n))yn(Zc,!1),Re?.();else if(!li&&Js(c.selectAll,e,n))yn({columns:st.empty(),rows:st.empty(),current:{cell:z.current?.cell??[R,0],range:{x:R,y:0,width:v.length,height:y},rangeStack:[]}},!1);else if(Js(c.search,e,n))o?.current?.focus({preventScroll:!0}),dn(!0);else if(Js(c.delete,e,n)){let e=Tn?.(z)??!0;if(e!==!1){let t=e===!0?z:e;if(t.current!==void 0){ci(t.current.range);for(let e of t.current.rangeStack)ci(e)}for(let e of t.rows)ci({x:R,y:e,width:v.length,height:1});for(let e of t.columns)ci({x:e,y:0,width:1,height:y})}}if(n.didMatch)return t(),!0;if(z.current===void 0)return!1;let[l,u]=z.current.cell,d=!1,f=!1;Js(c.scrollToSelectedCell,e,n)?vi.current(l-R,u):xe!==`none`&&Js(c.selectColumn,e,n)?i.hasIndex(l)?On(i.remove(l),void 0,!0):xe===`single`?On(st.fromSingleSelection(l),void 0,!0):On(void 0,l,!0):Se!==`none`&&Js(c.selectRow,e,n)?s.hasIndex(u)?Dn(s.remove(u),void 0,!0):Se===`single`?Dn(st.fromSingleSelection(u),void 0,!0):Dn(void 0,u,!0):!li&&r!==void 0&&Js(c.activateCell,e,n)?u===y&&on?window.setTimeout(()=>{let e=Sr(l);xr(e??l)},0):(T?.([l-R,u]),hr(r,!0)):z.current.range.height>1&&Js(c.downFill,e,n)?Kr():z.current.range.width>1&&Js(c.rightFill,e,n)?Gr():Js(c.goToNextPage,e,n)?u+=Math.max(1,Un.current.height-4):Js(c.goToPreviousPage,e,n)?u-=Math.max(1,Un.current.height-4):Js(c.goToFirstCell,e,n)?(a(void 0),u=0,l=0):Js(c.goToLastCell,e,n)?(a(void 0),u=2**53-1,l=2**53-1):Js(c.selectToFirstCell,e,n)?(a(void 0),ii([-2,-2])):Js(c.selectToLastCell,e,n)?(a(void 0),ii([2,2])):li?(Js(c.closeOverlay,e,n)&&a(void 0),Js(c.acceptOverlayDown,e,n)&&(a(void 0),u++),Js(c.acceptOverlayUp,e,n)&&(a(void 0),u--),Js(c.acceptOverlayLeft,e,n)&&(a(void 0),l--),Js(c.acceptOverlayRight,e,n)&&(a(void 0),l++)):(Js(c.goDownCell,e,n)?u+=1:Js(c.goUpCell,e,n)?--u:Js(c.goRightCell,e,n)?l+=1:Js(c.goLeftCell,e,n)?--l:Js(c.goDownCellRetainSelection,e,n)?(u+=1,d=!0):Js(c.goUpCellRetainSelection,e,n)?(--u,d=!0):Js(c.goRightCellRetainSelection,e,n)?(l+=1,d=!0):Js(c.goLeftCellRetainSelection,e,n)?(--l,d=!0):Js(c.goToLastRow,e,n)?u=y-1:Js(c.goToFirstRow,e,n)?u=-(2**53-1):Js(c.goToLastColumn,e,n)?l=2**53-1:Js(c.goToFirstColumn,e,n)?l=-(2**53-1):(be===`rect`||be===`multi-rect`)&&(Js(c.selectGrowDown,e,n)?ii([0,1]):Js(c.selectGrowUp,e,n)?ii([0,-1]):Js(c.selectGrowRight,e,n)?ii([1,0]):Js(c.selectGrowLeft,e,n)?ii([-1,0]):Js(c.selectToLastRow,e,n)?ii([0,2]):Js(c.selectToFirstRow,e,n)?ii([0,-2]):Js(c.selectToLastColumn,e,n)?ii([2,0]):Js(c.selectToFirstColumn,e,n)&&ii([-2,0])),f=n.didMatch);let p=ai(l,u,!1,d),m=n.didMatch;return m&&(p||!f||Dt)&&t(),m},[li,z,nn,xe,Se,be,R,y,ai,yn,Re,v.length,Tn,Dt,ci,On,Dn,on,Sr,xr,T,hr,Kr,Gr,ii]),di=L.useCallback(e=>{let t=!1;if(fe!==void 0&&fe({...e,cancel:()=>{t=!0}}),t||ui(e)||z.current===void 0)return;let[n,r]=z.current.cell,i=Un.current;if(he&&!e.metaKey&&!e.ctrlKey&&z.current!==void 0&&e.key.length===1&&/[ -~]/g.test(e.key)&&e.bounds!==void 0&&Qe(b([n-R,Math.max(0,Math.min(r,y-1))]))){if((!on||r!==y)&&(i.y>r||r>i.y+i.height||i.x>n||n>i.x+i.width))return;hr(e.bounds,!0,e.key),e.stopPropagation(),e.preventDefault()}},[he,fe,ui,z,b,R,y,on,hr]),fi=L.useCallback((e,t)=>{let n=e.location[0]-R;if(e.kind===`header`&&re?.(n,{...e,preventDefault:t}),e.kind===`group-header`){if(n<0)return;ie?.(n,{...e,preventDefault:t})}if(e.kind===`cell`){let[r,i]=e.location;ne?.([n,i],{...e,preventDefault:t}),kr(z,e.location)||ai(r,i,!1,!1)}},[z,ne,ie,re,R,ai]),pi=L.useCallback(async e=>{if(!nn.paste)return;function t(e,t,n,r){let i=typeof n==`object`?n?.join(` `)??``:n?.toString()??``;if(!Ze(e)&&Qe(e)&&e.readonly!==!0){let a=O?.(i,e);if(a!==void 0&&Xe(a))return{location:t,value:a};let o=Nn(e);if(o===void 0)return;if(o.kind===I.Custom){x(e.kind===I.Custom);let n=o.onPaste?.(i,e.data);return n===void 0?void 0:{location:t,value:{...e,data:n}}}else{let a=o.onPaste?.(i,e,{formatted:r,formattedString:typeof r==`string`?r:r?.join(` -`),rawValue:n});return a===void 0?void 0:(x(a.kind===e.kind),{location:t,value:a})}}}let n=z.columns,r=z.rows,i=u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0,a;if(z.current===void 0?n.length===1?a=[n.first()??0,0]:r.length===1&&(a=[R,r.first()??0]):a=[z.current.range.x,z.current.range.y],i&&a!==void 0){let n,r,i=`text/plain`,o=`text/html`;if(navigator.clipboard.read!==void 0){let e=await navigator.clipboard.read();for(let t of e){if(t.types.includes(o)){let e=cc(await(await t.getType(o)).text());if(e!==void 0){n=e;break}}t.types.includes(i)&&(r=await(await t.getType(i)).text())}}else if(navigator.clipboard.readText!==void 0)r=await navigator.clipboard.readText();else if(e!==void 0&&e?.clipboardData!==null)e.clipboardData.types.includes(o)&&(n=cc(e.clipboardData.getData(o))),n===void 0&&e.clipboardData.types.includes(i)&&(r=e.clipboardData.getData(i));else return;let[s,c]=a,l=[];do{if(ke===void 0){let e=dr(a),i=r??n?.map(e=>e.map(e=>e.rawValue).join(` `)).join(` `)??``,o=t(e,a,i,void 0);o!==void 0&&l.push(o);break}if(n===void 0){if(r===void 0)return;n=dc(r)}if(ke===!1||typeof ke==`function`&&ke?.([a[0]-R,a[1]],n.map(e=>e.map(e=>e.rawValue?.toString()??``)))!==!0)return;for(let[e,r]of n.entries()){if(e+c>=y)break;for(let[n,i]of r.entries()){let r=[n+s,e+c],[a,o]=r;if(a>=Bn.length||o>=tr)continue;let u=t(dr(r),r,i.rawValue,i.formatted);u!==void 0&&l.push(u)}}}while(!1);nr(l),$n.current?.damage(l.map(e=>({cell:e.location})))}},[O,Nn,dr,z,nn.paste,Bn.length,nr,tr,ke,R,y]);qt(`paste`,pi,f,!1,!0);let mi=L.useCallback(async(e,t)=>{if(!nn.copy)return;let n=t===!0||u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0,r=z.columns,i=z.rows,a=(t,n)=>{fc(Ae?[n.map(e=>({kind:I.Text,data:v[e].title,displayData:v[e].title,allowOverlay:!1})),...t]:t,n,e)};if(n&&hn!==void 0){if(z.current!==void 0){let e=hn(z.current.range,mn.current.signal);typeof e!=`object`&&(e=await e()),a(e,(0,Ts.default)(z.current.range.x-R,z.current.range.x+z.current.range.width-R))}else if(i!==void 0&&i.length>0){let e=[...i].map(e=>{let t=hn({x:R,y:e,width:v.length,height:1},mn.current.signal);return typeof t==`object`?t[0]:t().then(e=>e[0])});e.some(e=>e instanceof Promise)?a(await Promise.all(e),(0,Ts.default)(v.length)):a(e,(0,Ts.default)(v.length))}else if(r.length>0){let e=[],t=[];for(let n of r){let r=hn({x:n,y:0,width:1,height:y},mn.current.signal);typeof r!=`object`&&(r=await r()),e.push(r),t.push(n-R)}e.length===1?a(e[0],t):a(e.reduce((e,t)=>e.map((e,n)=>[...e,...t[n]])),t)}}},[v,hn,z,nn.copy,R,y,Ae]);qt(`copy`,mi,f,!1,!1),qt(`cut`,L.useCallback(async e=>{if(nn.cut&&(u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0)&&(await mi(e),z.current!==void 0)){let e={current:{cell:z.current.cell,range:z.current.range,rangeStack:[]},rows:st.empty(),columns:st.empty()},t=Tn?.(e);if(t===!1||(e=t===!0?e:t,e.current===void 0))return;ci(e.current.range)}},[ci,z,nn.cut,mi,Tn]),f,!1,!1);let hi=L.useCallback((e,t)=>{if(ce!==void 0){R!==0&&(e=e.map(e=>[e[0]-R,e[1]])),ce(e,t);return}if(e.length===0||t===-1)return;let[n,r]=e[t];d.current!==void 0&&d.current[0]===n&&d.current[1]===r||(d.current=[n,r],ai(n,r,!1,!1))},[ce,R,ai]),[gi,_i]=Ve?.current?.cell??[],vi=L.useRef(_r);vi.current=_r,L.useLayoutEffect(()=>{!Gn.current&&gi!==void 0&&_i!==void 0&&(gi!==vn.current?.current?.cell[0]||_i!==vn.current?.current?.cell[1])&&vi.current(gi,_i),Gn.current=!1},[gi,_i]);let Si=z.current!==void 0&&(z.current.cell[0]>=Bn.length||z.current.cell[1]>=tr);L.useLayoutEffect(()=>{Si&&yn(Xc,!1)},[Si,yn]);let Ci=L.useMemo(()=>on===!0&&qe?.tint===!0?st.fromSingleSelection(tr-1):st.empty(),[tr,on,qe?.tint]),Ti=L.useCallback(e=>typeof nt==`boolean`?nt:nt?.(e-R)??!0,[R,nt]),Ei=L.useMemo(()=>{if(Ir===void 0||s.current===null)return null;let{bounds:e,group:t}=Ir,n=s.current.getBoundingClientRect();return L.createElement(qs,{bounds:e,group:t,canvasBounds:n,onClose:()=>Lr(void 0),onFinish:e=>{Lr(void 0),ae?.(t,e)}})},[ae,Ir]),Di=Math.min(Bn.length,je+ +!!an);L.useImperativeHandle(t,()=>({appendRow:(e,t)=>xr(e+R,t),updateCells:e=>(R!==0&&(e=e.map(e=>({cell:[e.cell[0]+R,e.cell[1]]}))),$n.current?.damage(e)),getBounds:(e,t)=>{if(!(s?.current===null||u?.current===null)){if(e===void 0&&t===void 0){let e=s.current.getBoundingClientRect(),t=e.width/u.current.clientWidth;return{x:e.x-u.current.scrollLeft*t,y:e.y-u.current.scrollTop*t,width:u.current.scrollWidth*t,height:u.current.scrollHeight*t}}return $n.current?.getBounds((e??0)+R,t)}},focus:()=>$n.current?.focus(),emit:async e=>{switch(e){case`delete`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!1,key:`Delete`,keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-right`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`r`,keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-down`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`d`,keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`copy`:await mi(void 0,!0);break;case`paste`:await pi();break}},scrollTo:_r,remeasureColumns:e=>{for(let t of e)Vr(t+R)}}),[xr,Vr,mi,di,pi,R,_r]);let[Ai,ji]=Xr??[],Mi=L.useCallback(e=>{let[t,n]=e;if(n===-1){xe!==`none`&&(On(st.fromSingleSelection(t),void 0,!1),er());return}Ai===t&&ji===n||(En({cell:e,range:{x:t,y:n,width:1,height:1}},!0,!1,`keyboard-nav`),_r(t,n))},[xe,er,_r,Ai,ji,En,On]),[Ni,Pi]=L.useState(!1),Fi=L.useRef((0,Kt.default)(e=>{Pi(e)},5)),Ii=L.useCallback(()=>{Fi.current(!0),z.current===void 0&&z.columns.length===0&&z.rows.length===0&&c===void 0&&En({cell:[R,Qn],range:{x:R,y:Qn,width:1,height:1}},!0,!1,`keyboard-select`)},[Qn,z,c,R,En]),Li=L.useCallback(()=>{Fi.current(!1)},[]),[Ri,zi]=L.useMemo(()=>{let e,t=pt?.scrollbarWidthOverride??sn(),n=y+ +!!on;if(typeof Xt==`number`)e=Ln+n*Xt;else{let t=0,r=Math.min(n,10);for(let e=0;et.width+e,0)+t;return[`${Math.min(1e5,r)}px`,`${Math.min(1e5,e)}px`]},[Bn,pt?.scrollbarWidthOverride,Xt,y,on,Ln]),Bi=L.useMemo(()=>yi(kn),[kn]);return L.createElement(wi.Provider,{value:kn},L.createElement(hc,{style:Bi,className:P,inWidth:g??Ri,inHeight:_??zi},L.createElement(Hs,{fillHandle:dt,drawFocusRing:ft,experimental:pt,fixedShadowX:mt,fixedShadowY:ht,getRowThemeOverride:m,headerIcons:gt,imageWindowLoader:_t,initialSize:vt,isDraggable:yt,onDragLeave:bt,onRowMoved:xt,overscrollX:en,overscrollY:tn,preventDiagonalScrolling:wt,rightElement:Tt,rightElementProps:Et,smoothScrollX:Ot,smoothScrollY:kt,className:P,enableGroups:In,onCanvasFocused:Ii,onCanvasBlur:Li,canvasRef:s,onContextMenu:fi,theme:kn,cellXOffset:Zn,cellYOffset:Qn,accessibilityHeight:Kn.height,onDragEnd:ti,columns:Bn,nonGrowWidth:Fn,drawHeader:Cn,onColumnProposeMove:ee,drawCell:wn,disabledRows:Ci,freezeColumns:Di,lockColumns:R,firstColAccessible:R===0,getCellContent:dr,minColumnWidth:Ut,maxColumnWidth:Wt,searchInputRef:o,showSearch:fn,onSearchClose:pn,highlightRegions:lr,getCellsForSelection:hn,getGroupDetails:pr,headerHeight:Zt,isFocused:Ni,groupHeaderHeight:In?Qt:0,freezeTrailingRows:Je+(on&&qe?.sticky===!0?1:0),hasAppendRow:on,onColumnResize:bn,onColumnResizeEnd:xn,onColumnResizeStart:Sn,onCellFocused:Mi,onColumnMoved:Qr,onDragStart:ei,onHeaderMenuClick:Yr,onItemHovered:ri,isFilling:c?.fillHandle===!0,onMouseMove:Jr,onKeyDown:di,onKeyUp:pe,onMouseDown:Fr,onMouseUp:qr,onDragOverCell:rt,onDrop:it,onSearchResultsChanged:hi,onVisibleRegionChanged:Zr,clientSize:An,rowHeight:Xt,searchResults:le,searchValue:de,onSearchValueChange:ue,rows:tr,scrollRef:u,selection:z,translateX:Kn.tx,translateY:Kn.ty,verticalBorder:Ti,gridRef:$n,getCellRenderer:Nn}),Ei,i!==void 0&&L.createElement(L.Suspense,{fallback:null},L.createElement(Gc,{...i,validateCell:_n,bloom:j,id:si,getCellRenderer:Nn,className:pt?.isSubGrid===!0?`click-outside-ignore`:void 0,provideEditor:Ke,imageEditorOverride:p,onFinishEditing:oi,markdownDivCreateNode:h,isOutsideClick:Ft}))))});ct();var Qc=20,$c={getAccessibilityString:e=>e.data?.toString()??`false`,kind:I.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:e=>el(e,e.cell.data,et(e.cell),e.cell.maxSize??Qc),onDelete:e=>({...e,data:!1}),onClick:e=>{let{cell:t,posX:n,posY:r,bounds:i,theme:a}=e,{width:o,height:s,x:c,y:l}=i,u=t.maxSize??Qc,d=Math.floor(i.y+s/2),f=$t(u,s,a.cellVerticalPadding),p=Zt(Qt(t.contentAlign??`center`,c,o,a.cellHorizontalPadding,f),d,f),m=en(c+n,l+r,p);if(et(t)&&m)return{...t,data:pc(t.data)}},onPaste:(e,t)=>{let n=null;return e.toLowerCase()===`true`?n=!0:e.toLowerCase()===`false`?n=!1:e.toLowerCase()===`indeterminate`&&(n=void 0),n===t.data?void 0:{...t,data:n}}};function el(e,t,n,r){if(!n&&t===null)return;let{ctx:i,hoverAmount:a,theme:o,rect:s,highlighted:c,hoverX:l,hoverY:u,cell:{contentAlign:d}}=e,{x:f,y:p,width:m,height:h}=s,g=.35,_=n?1-g+g*a:.4;t===null&&(_*=a),_!==0&&(i.globalAlpha=_,Pa(i,o,t,f,p,m,h,c,l,u,r,d),i.globalAlpha=1)}St();var tl=xt(`div`)({name:`BubblesOverlayEditorStyle`,class:`gdg-b1ygi5by`,propsAsIs:!1}),nl=e=>{let{bubbles:t}=e;return L.createElement(tl,null,t.map((e,t)=>L.createElement(`div`,{key:t,className:`boe-bubble`},e)),L.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};ct();var rl={getAccessibilityString:e=>un(e.data),kind:I.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n).width+t+20,0)+2*n.cellHorizontalPadding-4,draw:e=>al(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return L.createElement(nl,{bubbles:t.data})},onPaste:()=>void 0},il=4;function al(e,t){let{rect:n,theme:r,ctx:i,highlighted:a}=e,{x:o,y:s,width:c,height:l}=n,u=il,d=o+r.cellHorizontalPadding,f=[];for(let e of t){if(d>o+c)break;let t=Jr(e,i,r.baseFontFull).width;f.push({x:d,width:t}),d+=t+16+u}i.beginPath();for(let e of f)si(i,e.x,s+(l-20)/2,e.width+16,20,r.roundingRadius??20/2);i.fillStyle=a?r.bgBubbleSelected:r.bgBubble,i.fill();for(let[e,n]of f.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(t[e],n.x+8,s+l/2+Xr(i,r))}St();var ol=xt(`div`)({name:`DrilldownOverlayEditorStyle`,class:`gdg-d4zsq0x`,propsAsIs:!1}),sl=e=>{let{drilldowns:t}=e;return L.createElement(ol,null,t.map((e,t)=>L.createElement(`div`,{key:t,className:`doe-bubble`},e.img!==void 0&&L.createElement(`img`,{src:e.img}),L.createElement(`div`,null,e.text))))};ct();var cl={getAccessibilityString:e=>un(e.data.map(e=>e.text)),kind:I.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n.text).width+t+20+(n.img===void 0?0:18),0)+2*n.cellHorizontalPadding-4,draw:e=>fl(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return L.createElement(sl,{drilldowns:t.data})},onPaste:()=>void 0},ll=4,ul={};function dl(e,t,n,r){let i=Math.ceil(window.devicePixelRatio),a=n-10,o=n*i,s=r+5,c=r*3,l=(c+10)*i,u=`${e},${t},${i},${n}`;if(ul[u]!==void 0)return{el:ul[u],height:o,width:l,middleWidth:4*i,sideWidth:s*i,padding:5*i,dpr:i};let d=document.createElement(`canvas`),f=d.getContext(`2d`);return f===null?null:(d.width=l,d.height=o,f.scale(i,i),ul[u]=d,f.beginPath(),si(f,5,5,c,a,r),f.shadowColor=`rgba(24, 25, 34, 0.4)`,f.shadowBlur=1,f.fillStyle=e,f.fill(),f.shadowColor=`rgba(24, 25, 34, 0.3)`,f.shadowOffsetY=1,f.shadowBlur=5,f.fillStyle=e,f.fill(),f.shadowOffsetY=0,f.shadowBlur=0,f.shadowBlur=0,f.beginPath(),si(f,5.5,5.5,c,a,r),f.strokeStyle=t,f.lineWidth=1,f.stroke(),{el:d,height:o,width:l,sideWidth:s*i,middleWidth:r*i,padding:5*i,dpr:i})}function fl(e,t){let{rect:n,theme:r,ctx:i,imageLoader:a,col:o,row:s}=e,{x:c,width:l}=n,u=r.baseFontFull,d=ri(i,u),f=Math.min(n.height,Math.max(16,Math.ceil(d*r.lineHeight)*2)),p=Math.floor(n.y+(n.height-f)/2),m=f-10,h=ll,g=c+r.cellHorizontalPadding,_=r.roundingRadius??6,v=dl(r.bgCell,r.drilldownBorder,f,_),y=[];for(let e of t){if(g>c+l)break;let t=Jr(e.text,i,u).width,n=0;e.img!==void 0&&a.loadOrGetImage(e.img,o,s)!==void 0&&(n=m-8+4);let r=t+n+16;y.push({x:g,width:r}),g+=r+h}if(v!==null){let{el:e,height:t,middleWidth:n,sideWidth:r,width:a,dpr:o,padding:s}=v,c=r/o,l=s/o;for(let o of y){let s=Math.floor(o.x),u=Math.floor(o.width),d=u-(c-l)*2;i.imageSmoothingEnabled=!1,i.drawImage(e,0,0,r,t,s-l,p,c,f),d>0&&i.drawImage(e,r,0,n,t,s+(c-l),p,d,f),i.drawImage(e,a-r,0,r,t,s+u-(c-l),p,c,f),i.imageSmoothingEnabled=!0}}i.beginPath();for(let[e,n]of y.entries()){let c=t[e],l=n.x+8;if(c.img!==void 0){let e=a.loadOrGetImage(c.img,o,s);if(e!==void 0){let t=m-8,n=0,a=0,o=e.width,s=e.height;o>s?(n+=(o-s)/2,o=s):s>o&&(a+=(s-o)/2,s=o),i.beginPath(),si(i,l,p+f/2-t/2,t,t,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(e,n,a,o,s,l,p+f/2-t/2,t,t),i.restore(),l+=t+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(c.text,l,p+f/2+Xr(i,r))}}ct();var pl={getAccessibilityString:e=>e.data.join(`, `),kind:I.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:e=>hl(e,e.cell.displayData??e.cell.data,e.cell.rounding??e.theme.roundingRadius??4,e.cell.contentAlign),measure:(e,t)=>t.data.length*50,onDelete:e=>({...e,data:[]}),provideEditor:()=>e=>{let{value:t,onFinishedEditing:n,imageEditorOverride:r}=e,i=r??pn;return L.createElement(i,{urls:t.data,canWrite:t.readonly!==!1,onCancel:n,onChange:e=>{n({...t,data:[e]})}})},onPaste:(e,t)=>{e=e.trim();let n=e.split(`,`).map(e=>{try{return new URL(e),e}catch{return}}).filter(e=>e!==void 0);if(!(n.length===t.data.length&&n.every((e,n)=>e===t.data[n])))return{...t,data:n}}},ml=4;function hl(e,t,n,r){let{rect:i,col:a,row:o,theme:s,ctx:c,imageLoader:l}=e,{x:u,y:d,height:f,width:p}=i,m=f-s.cellVerticalPadding*2,h=[],g=0;for(let e=0;e0&&(c.beginPath(),si(c,_,d+s.cellVerticalPadding,t,m,n),c.save(),c.clip()),c.drawImage(e,_,d+s.cellVerticalPadding,t,m),n>0&&c.restore(),_+=t+ml}}vr(),ct();function gl(e,t){let n=e*49632+t*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}var _l={getAccessibilityString:()=>``,kind:I.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:e=>{let{cell:t,col:n,row:r,ctx:i,rect:a,theme:o}=e;if(t.skeletonWidth===void 0||t.skeletonWidth===0)return;let s=t.skeletonWidth;t.skeletonWidthVariability!==void 0&&t.skeletonWidthVariability>0&&(s+=Math.round(gl(n,r)*t.skeletonWidthVariability));let c=o.cellHorizontalPadding,l=t.skeletonHeight??Math.min(18,a.height-2*o.cellVerticalPadding);si(i,a.x+c,a.y+(a.height-l)/2,s,l,o.roundingRadius??3),i.fillStyle=fr(o.textDark,.1),i.fill()},onPaste:()=>void 0};St();var vl=xt(`div`)({name:`MarkdownOverlayEditorStyle`,class:`gdg-m1pnx84e`,propsAsIs:!1,vars:{"m1pnx84e-0":[e=>e.targetWidth,`px`]}}),yl=e=>{let{value:t,onChange:n,forceEditMode:r,createNode:i,targetRect:a,onFinish:o,validatedSelection:s}=e,c=t.data,l=t.readonly===!0,[u,d]=L.useState(c===``||r),f=L.useCallback(()=>{d(e=>!e)},[]),p=c?`gdg-ml-6`:``;return u?L.createElement(vl,{targetWidth:a.width-20},L.createElement(lr,{autoFocus:!0,highlight:!1,validatedSelection:s,value:c,onKeyDown:e=>{e.key===`Enter`&&e.stopPropagation()},onChange:n}),L.createElement(`div`,{className:`gdg-edit-icon gdg-checkmark-hover ${p}`,onClick:()=>o(t)},L.createElement(nn,null))):L.createElement(vl,{targetWidth:a.width},L.createElement(ir,{contents:c,createNode:i}),!l&&L.createElement(L.Fragment,null,L.createElement(`div`,{className:`spacer`}),L.createElement(`div`,{className:`gdg-edit-icon gdg-edit-hover ${p}`,onClick:f},L.createElement(tn,null))),L.createElement(`textarea`,{className:`gdg-md-edit-textarea gdg-input`,autoFocus:!0}))};ct();var bl={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:ti,measure:(e,t,n)=>{let r=t.data.split(` -`)[0];return e.measureText(r).width+2*n.cellHorizontalPadding},draw:e=>oi(e,e.cell.data,e.cell.contentAlign),onDelete:e=>({...e,data:``}),provideEditor:()=>e=>{let{onChange:t,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:a,forceEditMode:o,validatedSelection:s}=e;return L.createElement(yl,{onFinish:i,targetRect:r,value:n,validatedSelection:s,onChange:e=>t({...n,data:e.target.value}),forceEditMode:o,createNode:a})},onPaste:(e,t)=>e===t.data?void 0:{...t,data:e}};ct();var xl={getAccessibilityString:e=>e.row.toString(),kind:at.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:Sl,measure:()=>44,draw:e=>wl(e,e.cell.row,e.cell.checked,e.cell.markerKind,e.cell.drawHandle,e.cell.checkboxStyle),onClick:e=>{let{bounds:t,cell:n,posX:r,posY:i}=e,{width:a,height:o}=t,s=n.drawHandle?7+(a-7)/2:a/2,c=o/2;if(Math.abs(r-s)<=10&&Math.abs(i-c)<=10)return{...n,checked:!n.checked}},onPaste:()=>void 0};function Sl(e,t){let{ctx:n,theme:r}=e,i=r.markerFontFull,a=t??{};return a?.font!==i&&(n.font=i,a.font=i),a.deprep=Cl,n.textAlign=`center`,a}function Cl(e){let{ctx:t}=e;t.textAlign=`start`}function wl(e,t,n,r,i,a){let{ctx:o,rect:s,hoverAmount:c,theme:l}=e,{x:u,y:d,width:f,height:p}=s,m=n?1:r===`checkbox-visible`?.6+.4*c:c;if(r!==`number`&&m>0){o.globalAlpha=m;let e=7*(n?c:1);if(Pa(o,l,n,i?u+e:u,d,i?f-e:f,p,!0,void 0,void 0,18,`center`,a),i){o.globalAlpha=c,o.beginPath();for(let e of[3,6])for(let t of[-5,-1,3])o.rect(u+e,d+p/2+t,2,2);o.fillStyle=l.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r===`number`||r===`both`&&!n){let e=t.toString(),n=l.markerFontFull,i=u+f/2;r===`both`&&c!==0&&(o.globalAlpha=1-c),o.fillStyle=l.textLight,o.font=n,o.fillText(e,i,d+p/2+Xr(o,n)),c!==0&&(o.globalAlpha=1)}}ct();var Tl={getAccessibilityString:()=>``,kind:at.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:e=>El(e,e.cell.hint,e.cell.icon),onPaste:()=>void 0};function El(e,t,n){let{ctx:r,rect:i,hoverAmount:a,theme:o,spriteManager:s}=e,{x:c,y:l,width:u,height:d}=i;r.beginPath(),r.globalAlpha=a,r.rect(c+1,l+1,u,d-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();let f=t!==``,p=0;if(n!==void 0){let e=d-8,t=c+8/2,i=l+8/2;s.drawSprite(n,`normal`,r,t,i,e,o,f?1:a),p=e}else{p=24;let e=f?12:a*12,t=f?0:(1-a)*12*.5,n=o.cellHorizontalPadding+4;e>0&&(r.moveTo(c+n+t,l+d/2),r.lineTo(c+n+t+e,l+d/2),r.moveTo(c+n+t+e*.5,l+d/2-e*.5),r.lineTo(c+n+t+e*.5,l+d/2+e*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap=`round`,r.stroke())}r.fillStyle=o.textMedium,r.fillText(t,p+c+o.cellHorizontalPadding+.5,l+d/2+Xr(r,o)),r.beginPath()}var Dl,Ol=o((()=>{St(),Dl=xt(`div`)({name:`NumberOverlayEditorStyle`,class:`gdg-n15fjm3e`,propsAsIs:!1})}));function kl(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i=s?i+=Ul(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function Gl(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=Bl(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=Hl(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function Kl(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function ql(e,t,n){return Math.min(Math.max(e,t),n)}function Jl(e){return Math.max(e.selectionStart,e.selectionEnd)}function Yl(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Xl(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function Zl(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function Ql(e,t,n,r,i,a,o){o===void 0&&(o=Zl);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function $l(e,t,n,r){var i=e.length;if(t=ql(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function eu(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;nC.length-o.length||SD||d>e.length-o.length)&&(E=d),e=e.substring(0,E),e=su(y?`-`+e:e,i),e=(e.match(cu(m,!0))||[]).join(``);var O=e.indexOf(m);e=e.replace(new RegExp(Il(m),`g`),function(e,t){return t===O?`.`:``});var k=Bl(e,i),A=k.beforeDecimal,j=k.afterDecimal,M=k.addNegation;return l.end-l.starte.map(e=>e.rawValue).join(` `)).join(` `)??``,o=t(e,a,i,void 0);o!==void 0&&l.push(o);break}if(n===void 0){if(r===void 0)return;n=uc(r)}if(ke===!1||typeof ke==`function`&&ke?.([a[0]-R,a[1]],n.map(e=>e.map(e=>e.rawValue?.toString()??``)))!==!0)return;for(let[e,r]of n.entries()){if(e+c>=y)break;for(let[n,i]of r.entries()){let r=[n+s,e+c],[a,o]=r;if(a>=Bn.length||o>=tr)continue;let u=t(dr(r),r,i.rawValue,i.formatted);u!==void 0&&l.push(u)}}}while(!1);nr(l),$n.current?.damage(l.map(e=>({cell:e.location})))}},[O,Nn,dr,z,nn.paste,Bn.length,nr,tr,ke,R,y]);qt(`paste`,pi,f,!1,!0);let mi=L.useCallback(async(e,t)=>{if(!nn.copy)return;let n=t===!0||u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0,r=z.columns,i=z.rows,a=(t,n)=>{nee(Ae?[n.map(e=>({kind:I.Text,data:v[e].title,displayData:v[e].title,allowOverlay:!1})),...t]:t,n,e)};if(n&&hn!==void 0){if(z.current!==void 0){let e=hn(z.current.range,mn.current.signal);typeof e!=`object`&&(e=await e()),a(e,(0,ws.default)(z.current.range.x-R,z.current.range.x+z.current.range.width-R))}else if(i!==void 0&&i.length>0){let e=[...i].map(e=>{let t=hn({x:R,y:e,width:v.length,height:1},mn.current.signal);return typeof t==`object`?t[0]:t().then(e=>e[0])});e.some(e=>e instanceof Promise)?a(await Promise.all(e),(0,ws.default)(v.length)):a(e,(0,ws.default)(v.length))}else if(r.length>0){let e=[],t=[];for(let n of r){let r=hn({x:n,y:0,width:1,height:y},mn.current.signal);typeof r!=`object`&&(r=await r()),e.push(r),t.push(n-R)}e.length===1?a(e[0],t):a(e.reduce((e,t)=>e.map((e,n)=>[...e,...t[n]])),t)}}},[v,hn,z,nn.copy,R,y,Ae]);qt(`copy`,mi,f,!1,!1),qt(`cut`,L.useCallback(async e=>{if(nn.cut&&(u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0)&&(await mi(e),z.current!==void 0)){let e={current:{cell:z.current.cell,range:z.current.range,rangeStack:[]},rows:st.empty(),columns:st.empty()},t=Tn?.(e);if(t===!1||(e=t===!0?e:t,e.current===void 0))return;ci(e.current.range)}},[ci,z,nn.cut,mi,Tn]),f,!1,!1);let hi=L.useCallback((e,t)=>{if(ce!==void 0){R!==0&&(e=e.map(e=>[e[0]-R,e[1]])),ce(e,t);return}if(e.length===0||t===-1)return;let[n,r]=e[t];d.current!==void 0&&d.current[0]===n&&d.current[1]===r||(d.current=[n,r],ai(n,r,!1,!1))},[ce,R,ai]),[gi,_i]=Ve?.current?.cell??[],vi=L.useRef(_r);vi.current=_r,L.useLayoutEffect(()=>{!Gn.current&&gi!==void 0&&_i!==void 0&&(gi!==vn.current?.current?.cell[0]||_i!==vn.current?.current?.cell[1])&&vi.current(gi,_i),Gn.current=!1},[gi,_i]);let Si=z.current!==void 0&&(z.current.cell[0]>=Bn.length||z.current.cell[1]>=tr);L.useLayoutEffect(()=>{Si&&yn(Zc,!1)},[Si,yn]);let Ci=L.useMemo(()=>on===!0&&qe?.tint===!0?st.fromSingleSelection(tr-1):st.empty(),[tr,on,qe?.tint]),Ti=L.useCallback(e=>typeof nt==`boolean`?nt:nt?.(e-R)??!0,[R,nt]),Ei=L.useMemo(()=>{if(Ir===void 0||s.current===null)return null;let{bounds:e,group:t}=Ir,n=s.current.getBoundingClientRect();return L.createElement(Ks,{bounds:e,group:t,canvasBounds:n,onClose:()=>Lr(void 0),onFinish:e=>{Lr(void 0),ae?.(t,e)}})},[ae,Ir]),Di=Math.min(Bn.length,je+ +!!an);L.useImperativeHandle(t,()=>({appendRow:(e,t)=>xr(e+R,t),updateCells:e=>(R!==0&&(e=e.map(e=>({cell:[e.cell[0]+R,e.cell[1]]}))),$n.current?.damage(e)),getBounds:(e,t)=>{if(!(s?.current===null||u?.current===null)){if(e===void 0&&t===void 0){let e=s.current.getBoundingClientRect(),t=e.width/u.current.clientWidth;return{x:e.x-u.current.scrollLeft*t,y:e.y-u.current.scrollTop*t,width:u.current.scrollWidth*t,height:u.current.scrollHeight*t}}return $n.current?.getBounds((e??0)+R,t)}},focus:()=>$n.current?.focus(),emit:async e=>{switch(e){case`delete`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!1,key:`Delete`,keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-right`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`r`,keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-down`:di({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`d`,keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`copy`:await mi(void 0,!0);break;case`paste`:await pi();break}},scrollTo:_r,remeasureColumns:e=>{for(let t of e)Vr(t+R)}}),[xr,Vr,mi,di,pi,R,_r]);let[Ai,ji]=Xr??[],Mi=L.useCallback(e=>{let[t,n]=e;if(n===-1){xe!==`none`&&(On(st.fromSingleSelection(t),void 0,!1),er());return}Ai===t&&ji===n||(En({cell:e,range:{x:t,y:n,width:1,height:1}},!0,!1,`keyboard-nav`),_r(t,n))},[xe,er,_r,Ai,ji,En,On]),[Ni,Pi]=L.useState(!1),Fi=L.useRef((0,Kt.default)(e=>{Pi(e)},5)),Ii=L.useCallback(()=>{Fi.current(!0),z.current===void 0&&z.columns.length===0&&z.rows.length===0&&c===void 0&&En({cell:[R,Qn],range:{x:R,y:Qn,width:1,height:1}},!0,!1,`keyboard-select`)},[Qn,z,c,R,En]),Li=L.useCallback(()=>{Fi.current(!1)},[]),[Ri,zi]=L.useMemo(()=>{let e,t=pt?.scrollbarWidthOverride??sn(),n=y+ +!!on;if(typeof Xt==`number`)e=Ln+n*Xt;else{let t=0,r=Math.min(n,10);for(let e=0;et.width+e,0)+t;return[`${Math.min(1e5,r)}px`,`${Math.min(1e5,e)}px`]},[Bn,pt?.scrollbarWidthOverride,Xt,y,on,Ln]),Bi=L.useMemo(()=>yi(kn),[kn]);return L.createElement(wi.Provider,{value:kn},L.createElement(mc,{style:Bi,className:P,inWidth:g??Ri,inHeight:_??zi},L.createElement(Vs,{fillHandle:dt,drawFocusRing:ft,experimental:pt,fixedShadowX:mt,fixedShadowY:ht,getRowThemeOverride:m,headerIcons:gt,imageWindowLoader:_t,initialSize:vt,isDraggable:yt,onDragLeave:bt,onRowMoved:xt,overscrollX:en,overscrollY:tn,preventDiagonalScrolling:wt,rightElement:Tt,rightElementProps:Et,smoothScrollX:Ot,smoothScrollY:kt,className:P,enableGroups:In,onCanvasFocused:Ii,onCanvasBlur:Li,canvasRef:s,onContextMenu:fi,theme:kn,cellXOffset:Zn,cellYOffset:Qn,accessibilityHeight:Kn.height,onDragEnd:ti,columns:Bn,nonGrowWidth:Fn,drawHeader:Cn,onColumnProposeMove:ee,drawCell:wn,disabledRows:Ci,freezeColumns:Di,lockColumns:R,firstColAccessible:R===0,getCellContent:dr,minColumnWidth:Ut,maxColumnWidth:Wt,searchInputRef:o,showSearch:fn,onSearchClose:pn,highlightRegions:lr,getCellsForSelection:hn,getGroupDetails:pr,headerHeight:Zt,isFocused:Ni,groupHeaderHeight:In?Qt:0,freezeTrailingRows:Je+(on&&qe?.sticky===!0?1:0),hasAppendRow:on,onColumnResize:bn,onColumnResizeEnd:xn,onColumnResizeStart:Sn,onCellFocused:Mi,onColumnMoved:Qr,onDragStart:ei,onHeaderMenuClick:Yr,onItemHovered:ri,isFilling:c?.fillHandle===!0,onMouseMove:Jr,onKeyDown:di,onKeyUp:pe,onMouseDown:Fr,onMouseUp:qr,onDragOverCell:rt,onDrop:it,onSearchResultsChanged:hi,onVisibleRegionChanged:Zr,clientSize:An,rowHeight:Xt,searchResults:le,searchValue:de,onSearchValueChange:ue,rows:tr,scrollRef:u,selection:z,translateX:Kn.tx,translateY:Kn.ty,verticalBorder:Ti,gridRef:$n,getCellRenderer:Nn}),Ei,i!==void 0&&L.createElement(L.Suspense,{fallback:null},L.createElement(Kc,{...i,validateCell:_n,bloom:j,id:si,getCellRenderer:Nn,className:pt?.isSubGrid===!0?`click-outside-ignore`:void 0,provideEditor:Ke,imageEditorOverride:p,onFinishEditing:oi,markdownDivCreateNode:h,isOutsideClick:Ft}))))});ct();var $c=20,el={getAccessibilityString:e=>e.data?.toString()??`false`,kind:I.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:e=>tl(e,e.cell.data,et(e.cell),e.cell.maxSize??$c),onDelete:e=>({...e,data:!1}),onClick:e=>{let{cell:t,posX:n,posY:r,bounds:i,theme:a}=e,{width:o,height:s,x:c,y:l}=i,u=t.maxSize??$c,d=Math.floor(i.y+s/2),f=$t(u,s,a.cellVerticalPadding),p=Zt(Qt(t.contentAlign??`center`,c,o,a.cellHorizontalPadding,f),d,f),m=en(c+n,l+r,p);if(et(t)&&m)return{...t,data:dc(t.data)}},onPaste:(e,t)=>{let n=null;return e.toLowerCase()===`true`?n=!0:e.toLowerCase()===`false`?n=!1:e.toLowerCase()===`indeterminate`&&(n=void 0),n===t.data?void 0:{...t,data:n}}};function tl(e,t,n,r){if(!n&&t===null)return;let{ctx:i,hoverAmount:a,theme:o,rect:s,highlighted:c,hoverX:l,hoverY:u,cell:{contentAlign:d}}=e,{x:f,y:p,width:m,height:h}=s,g=.35,_=n?1-g+g*a:.4;t===null&&(_*=a),_!==0&&(i.globalAlpha=_,Na(i,o,t,f,p,m,h,c,l,u,r,d),i.globalAlpha=1)}St();var nl=xt(`div`)({name:`BubblesOverlayEditorStyle`,class:`gdg-b1ygi5by`,propsAsIs:!1}),rl=e=>{let{bubbles:t}=e;return L.createElement(nl,null,t.map((e,t)=>L.createElement(`div`,{key:t,className:`boe-bubble`},e)),L.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};ct();var il={getAccessibilityString:e=>un(e.data),kind:I.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n).width+t+20,0)+2*n.cellHorizontalPadding-4,draw:e=>ol(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return L.createElement(rl,{bubbles:t.data})},onPaste:()=>void 0},al=4;function ol(e,t){let{rect:n,theme:r,ctx:i,highlighted:a}=e,{x:o,y:s,width:c,height:l}=n,u=al,d=o+r.cellHorizontalPadding,f=[];for(let e of t){if(d>o+c)break;let t=Jr(e,i,r.baseFontFull).width;f.push({x:d,width:t}),d+=t+16+u}i.beginPath();for(let e of f)si(i,e.x,s+(l-20)/2,e.width+16,20,r.roundingRadius??20/2);i.fillStyle=a?r.bgBubbleSelected:r.bgBubble,i.fill();for(let[e,n]of f.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(t[e],n.x+8,s+l/2+Xr(i,r))}St();var sl=xt(`div`)({name:`DrilldownOverlayEditorStyle`,class:`gdg-d4zsq0x`,propsAsIs:!1}),cl=e=>{let{drilldowns:t}=e;return L.createElement(sl,null,t.map((e,t)=>L.createElement(`div`,{key:t,className:`doe-bubble`},e.img!==void 0&&L.createElement(`img`,{src:e.img}),L.createElement(`div`,null,e.text))))};ct();var ll={getAccessibilityString:e=>un(e.data.map(e=>e.text)),kind:I.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n.text).width+t+20+(n.img===void 0?0:18),0)+2*n.cellHorizontalPadding-4,draw:e=>pl(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return L.createElement(cl,{drilldowns:t.data})},onPaste:()=>void 0},ul=4,dl={};function fl(e,t,n,r){let i=Math.ceil(window.devicePixelRatio),a=n-10,o=n*i,s=r+5,c=r*3,l=(c+10)*i,u=`${e},${t},${i},${n}`;if(dl[u]!==void 0)return{el:dl[u],height:o,width:l,middleWidth:4*i,sideWidth:s*i,padding:5*i,dpr:i};let d=document.createElement(`canvas`),f=d.getContext(`2d`);return f===null?null:(d.width=l,d.height=o,f.scale(i,i),dl[u]=d,f.beginPath(),si(f,5,5,c,a,r),f.shadowColor=`rgba(24, 25, 34, 0.4)`,f.shadowBlur=1,f.fillStyle=e,f.fill(),f.shadowColor=`rgba(24, 25, 34, 0.3)`,f.shadowOffsetY=1,f.shadowBlur=5,f.fillStyle=e,f.fill(),f.shadowOffsetY=0,f.shadowBlur=0,f.shadowBlur=0,f.beginPath(),si(f,5.5,5.5,c,a,r),f.strokeStyle=t,f.lineWidth=1,f.stroke(),{el:d,height:o,width:l,sideWidth:s*i,middleWidth:r*i,padding:5*i,dpr:i})}function pl(e,t){let{rect:n,theme:r,ctx:i,imageLoader:a,col:o,row:s}=e,{x:c,width:l}=n,u=r.baseFontFull,d=ri(i,u),f=Math.min(n.height,Math.max(16,Math.ceil(d*r.lineHeight)*2)),p=Math.floor(n.y+(n.height-f)/2),m=f-10,h=ul,g=c+r.cellHorizontalPadding,_=r.roundingRadius??6,v=fl(r.bgCell,r.drilldownBorder,f,_),y=[];for(let e of t){if(g>c+l)break;let t=Jr(e.text,i,u).width,n=0;e.img!==void 0&&a.loadOrGetImage(e.img,o,s)!==void 0&&(n=m-8+4);let r=t+n+16;y.push({x:g,width:r}),g+=r+h}if(v!==null){let{el:e,height:t,middleWidth:n,sideWidth:r,width:a,dpr:o,padding:s}=v,c=r/o,l=s/o;for(let o of y){let s=Math.floor(o.x),u=Math.floor(o.width),d=u-(c-l)*2;i.imageSmoothingEnabled=!1,i.drawImage(e,0,0,r,t,s-l,p,c,f),d>0&&i.drawImage(e,r,0,n,t,s+(c-l),p,d,f),i.drawImage(e,a-r,0,r,t,s+u-(c-l),p,c,f),i.imageSmoothingEnabled=!0}}i.beginPath();for(let[e,n]of y.entries()){let c=t[e],l=n.x+8;if(c.img!==void 0){let e=a.loadOrGetImage(c.img,o,s);if(e!==void 0){let t=m-8,n=0,a=0,o=e.width,s=e.height;o>s?(n+=(o-s)/2,o=s):s>o&&(a+=(s-o)/2,s=o),i.beginPath(),si(i,l,p+f/2-t/2,t,t,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(e,n,a,o,s,l,p+f/2-t/2,t,t),i.restore(),l+=t+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(c.text,l,p+f/2+Xr(i,r))}}ct();var ml={getAccessibilityString:e=>e.data.join(`, `),kind:I.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:e=>gl(e,e.cell.displayData??e.cell.data,e.cell.rounding??e.theme.roundingRadius??4,e.cell.contentAlign),measure:(e,t)=>t.data.length*50,onDelete:e=>({...e,data:[]}),provideEditor:()=>e=>{let{value:t,onFinishedEditing:n,imageEditorOverride:r}=e,i=r??pn;return L.createElement(i,{urls:t.data,canWrite:t.readonly!==!1,onCancel:n,onChange:e=>{n({...t,data:[e]})}})},onPaste:(e,t)=>{e=e.trim();let n=e.split(`,`).map(e=>{try{return new URL(e),e}catch{return}}).filter(e=>e!==void 0);if(!(n.length===t.data.length&&n.every((e,n)=>e===t.data[n])))return{...t,data:n}}},hl=4;function gl(e,t,n,r){let{rect:i,col:a,row:o,theme:s,ctx:c,imageLoader:l}=e,{x:u,y:d,height:f,width:p}=i,m=f-s.cellVerticalPadding*2,h=[],g=0;for(let e=0;e0&&(c.beginPath(),si(c,_,d+s.cellVerticalPadding,t,m,n),c.save(),c.clip()),c.drawImage(e,_,d+s.cellVerticalPadding,t,m),n>0&&c.restore(),_+=t+hl}}vr(),ct();function _l(e,t){let n=e*49632+t*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}var vl={getAccessibilityString:()=>``,kind:I.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:e=>{let{cell:t,col:n,row:r,ctx:i,rect:a,theme:o}=e;if(t.skeletonWidth===void 0||t.skeletonWidth===0)return;let s=t.skeletonWidth;t.skeletonWidthVariability!==void 0&&t.skeletonWidthVariability>0&&(s+=Math.round(_l(n,r)*t.skeletonWidthVariability));let c=o.cellHorizontalPadding,l=t.skeletonHeight??Math.min(18,a.height-2*o.cellVerticalPadding);si(i,a.x+c,a.y+(a.height-l)/2,s,l,o.roundingRadius??3),i.fillStyle=fr(o.textDark,.1),i.fill()},onPaste:()=>void 0};St();var yl=xt(`div`)({name:`MarkdownOverlayEditorStyle`,class:`gdg-m1pnx84e`,propsAsIs:!1,vars:{"m1pnx84e-0":[e=>e.targetWidth,`px`]}}),bl=e=>{let{value:t,onChange:n,forceEditMode:r,createNode:i,targetRect:a,onFinish:o,validatedSelection:s}=e,c=t.data,l=t.readonly===!0,[u,d]=L.useState(c===``||r),f=L.useCallback(()=>{d(e=>!e)},[]),p=c?`gdg-ml-6`:``;return u?L.createElement(yl,{targetWidth:a.width-20},L.createElement(lr,{autoFocus:!0,highlight:!1,validatedSelection:s,value:c,onKeyDown:e=>{e.key===`Enter`&&e.stopPropagation()},onChange:n}),L.createElement(`div`,{className:`gdg-edit-icon gdg-checkmark-hover ${p}`,onClick:()=>o(t)},L.createElement(nn,null))):L.createElement(yl,{targetWidth:a.width},L.createElement(ir,{contents:c,createNode:i}),!l&&L.createElement(L.Fragment,null,L.createElement(`div`,{className:`spacer`}),L.createElement(`div`,{className:`gdg-edit-icon gdg-edit-hover ${p}`,onClick:f},L.createElement(tn,null))),L.createElement(`textarea`,{className:`gdg-md-edit-textarea gdg-input`,autoFocus:!0}))};ct();var xl={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:ti,measure:(e,t,n)=>{let r=t.data.split(` +`)[0];return e.measureText(r).width+2*n.cellHorizontalPadding},draw:e=>oi(e,e.cell.data,e.cell.contentAlign),onDelete:e=>({...e,data:``}),provideEditor:()=>e=>{let{onChange:t,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:a,forceEditMode:o,validatedSelection:s}=e;return L.createElement(bl,{onFinish:i,targetRect:r,value:n,validatedSelection:s,onChange:e=>t({...n,data:e.target.value}),forceEditMode:o,createNode:a})},onPaste:(e,t)=>e===t.data?void 0:{...t,data:e}};ct();var Sl={getAccessibilityString:e=>e.row.toString(),kind:at.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:Cl,measure:()=>44,draw:e=>Tl(e,e.cell.row,e.cell.checked,e.cell.markerKind,e.cell.drawHandle,e.cell.checkboxStyle),onClick:e=>{let{bounds:t,cell:n,posX:r,posY:i}=e,{width:a,height:o}=t,s=n.drawHandle?7+(a-7)/2:a/2,c=o/2;if(Math.abs(r-s)<=10&&Math.abs(i-c)<=10)return{...n,checked:!n.checked}},onPaste:()=>void 0};function Cl(e,t){let{ctx:n,theme:r}=e,i=r.markerFontFull,a=t??{};return a?.font!==i&&(n.font=i,a.font=i),a.deprep=wl,n.textAlign=`center`,a}function wl(e){let{ctx:t}=e;t.textAlign=`start`}function Tl(e,t,n,r,i,a){let{ctx:o,rect:s,hoverAmount:c,theme:l}=e,{x:u,y:d,width:f,height:p}=s,m=n?1:r===`checkbox-visible`?.6+.4*c:c;if(r!==`number`&&m>0){o.globalAlpha=m;let e=7*(n?c:1);if(Na(o,l,n,i?u+e:u,d,i?f-e:f,p,!0,void 0,void 0,18,`center`,a),i){o.globalAlpha=c,o.beginPath();for(let e of[3,6])for(let t of[-5,-1,3])o.rect(u+e,d+p/2+t,2,2);o.fillStyle=l.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r===`number`||r===`both`&&!n){let e=t.toString(),n=l.markerFontFull,i=u+f/2;r===`both`&&c!==0&&(o.globalAlpha=1-c),o.fillStyle=l.textLight,o.font=n,o.fillText(e,i,d+p/2+Xr(o,n)),c!==0&&(o.globalAlpha=1)}}ct();var El={getAccessibilityString:()=>``,kind:at.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:e=>Dl(e,e.cell.hint,e.cell.icon),onPaste:()=>void 0};function Dl(e,t,n){let{ctx:r,rect:i,hoverAmount:a,theme:o,spriteManager:s}=e,{x:c,y:l,width:u,height:d}=i;r.beginPath(),r.globalAlpha=a,r.rect(c+1,l+1,u,d-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();let f=t!==``,p=0;if(n!==void 0){let e=d-8,t=c+8/2,i=l+8/2;s.drawSprite(n,`normal`,r,t,i,e,o,f?1:a),p=e}else{p=24;let e=f?12:a*12,t=f?0:(1-a)*12*.5,n=o.cellHorizontalPadding+4;e>0&&(r.moveTo(c+n+t,l+d/2),r.lineTo(c+n+t+e,l+d/2),r.moveTo(c+n+t+e*.5,l+d/2-e*.5),r.lineTo(c+n+t+e*.5,l+d/2+e*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap=`round`,r.stroke())}r.fillStyle=o.textMedium,r.fillText(t,p+c+o.cellHorizontalPadding+.5,l+d/2+Xr(r,o)),r.beginPath()}var Ol,kl=o((()=>{St(),Ol=xt(`div`)({name:`NumberOverlayEditorStyle`,class:`gdg-n15fjm3e`,propsAsIs:!1})}));function Al(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i=s?i+=Wl(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function Kl(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=Vl(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=Ul(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function ql(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function Jl(e,t,n){return Math.min(Math.max(e,t),n)}function Yl(e){return Math.max(e.selectionStart,e.selectionEnd)}function Xl(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Zl(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function Ql(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function $l(e,t,n,r,i,a,o){o===void 0&&(o=Ql);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function eu(e,t,n,r){var i=e.length;if(t=Jl(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function tu(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;nC.length-o.length||SD||d>e.length-o.length)&&(E=d),e=e.substring(0,E),e=cu(y?`-`+e:e,i),e=(e.match(lu(m,!0))||[]).join(``);var O=e.indexOf(m);e=e.replace(new RegExp(Ll(m),`g`),function(e,t){return t===O?`.`:``});var k=Vl(e,i),A=k.beforeDecimal,j=k.afterDecimal,M=k.addNegation;return l.end-l.startAn error Prefix can't start with '-' when allowNegative is true. prefix: `+i+` allowNegative: `+a+` - `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function aee(e){e=du(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Al);var a=e.onBlur;a===void 0&&(a=Al);var o=e.thousandSeparator,s=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l=``);var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,p=e.onValueChange,m=kl(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),h=ou(e),g=h.decimalSeparator,_=h.allowedDecimalSeparators,v=function(t){return au(t,e)},y=function(t,n){return uu(t,n,e)},b=Nl(d)?u:d,x=f??lu(b,l,t);Nl(d)?Nl(u)||(x||=typeof u==`number`):x||=typeof d==`number`;var S=function(e){return Fl(e)?e:(typeof e==`number`&&(e=Wl(e)),x&&typeof s==`number`?Gl(e,s,!!c):e)},C=tu(S(d),S(u),!!x,v,y,p),w=C[0],T=w.numAsString,E=w.formattedValue,D=C[1];return Object.assign(Object.assign({},m),{value:E,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===g||Ml(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],u=r[a],f=hu(n,t).to,p=function(e){return y(e).indexOf(`.`)+l.length};return d===0&&c&&s&&t[f.start]===g&&p(t)a?!1:i>=f.start&&i{pu=u(f()),(function(e){e.event=`event`,e.props=`prop`})(mu||={}),hu=jl(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),gu=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}}})),oee=c({default:()=>xu});function vu(){return Intl.NumberFormat()?.formatToParts(1.1)?.find(e=>e.type===`decimal`)?.value??`.`}function yu(){return vu()===`.`?`,`:`.`}var bu,xu,Su=o((()=>{bu=u(f(),1),Ol(),_u(),xu=e=>{let{value:t,onChange:n,disabled:r,highlight:i,validatedSelection:a,fixedDecimals:o,allowNegative:s,thousandSeparator:c,decimalSeparator:l}=e,u=bu.useRef();return bu.useLayoutEffect(()=>{if(a!==void 0){let e=typeof a==`number`?[a,null]:a;u.current?.setSelectionRange(e[0],e[1])}},[a]),bu.createElement(Dl,null,bu.createElement(fu,{autoFocus:!0,getInputRef:u,className:`gdg-input`,onFocus:e=>e.target.setSelectionRange(i?0:e.target.value.length,e.target.value.length),disabled:r===!0,decimalScale:o,allowNegative:s,thousandSeparator:c??yu(),decimalSeparator:l??vu(),value:Object.is(t,-0)?`-`:t??``,onValueChange:n}))}}));ct();var Cu=L.lazy(async()=>await Ec(()=>Promise.resolve().then(()=>(Su(),oee)),void 0,import.meta.url)),wu={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:ti,draw:e=>oi(e,e.cell.displayData,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.displayData).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:void 0}),provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return L.createElement(L.Suspense,{fallback:null},L.createElement(Cu,{highlight:t,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:e=>n({...r,data:Number.isNaN(e.floatValue??0)?0:e.floatValue})}))},onPaste:(e,t,n)=>{let r=typeof n.rawValue==`number`?n.rawValue:Number.parseFloat(typeof n.rawValue==`string`?n.rawValue:e);if(!(Number.isNaN(r)||t.data===r))return{...t,data:r,displayData:n.formattedString??t.displayData}}};ct();var Tu={getAccessibilityString:()=>``,measure:()=>108,kind:I.Protected,needsHover:!1,needsHoverPosition:!1,draw:Eu,onPaste:()=>void 0};function Eu(e){let{ctx:t,theme:n,rect:r}=e,{x:i,y:a,height:o}=r;t.beginPath();let s=2.5,c=i+n.cellHorizontalPadding+s,l=a+o/2,u=Math.cos(Xt(30))*s,d=Math.sin(Xt(30))*s;for(let e=0;e<12;e++)t.moveTo(c,l-s),t.lineTo(c,l+s),t.moveTo(c+u,l-d),t.lineTo(c-u,l+d),t.moveTo(c-u,l-d),t.lineTo(c+u,l+d),c+=8;t.lineWidth=1.1,t.lineCap=`square`,t.strokeStyle=n.textLight,t.stroke()}ct();var Du={getAccessibilityString:e=>e.data?.toString()??``,kind:I.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(e,t)=>ti(e,t,e.theme.textLight),draw:e=>oi(e,e.cell.data,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.data).width+n.cellHorizontalPadding*2,provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return L.createElement(lr,{highlight:t,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:e=>n({...r,data:e.target.value})})},onPaste:()=>void 0};ct(),vr();var Ou={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Text,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,drawPrep:ti,useLabel:!0,draw:e=>{let{cell:t,hoverAmount:n,hyperWrapping:r,ctx:i,rect:a,theme:o,overrideCursor:s}=e,{displayData:c,contentAlign:l,hoverEffect:u,allowWrapping:d}=t;if(u===!0&&n>0){i.textBaseline=`alphabetic`;let e=o.cellHorizontalPadding,t=o.cellVerticalPadding,r=Jr(c,i,o.baseFontFull,`alphabetic`),l=a.height-t,u=Math.min(l,r.actualBoundingBoxAscent*2.5);i.beginPath(),si(i,a.x+e/2,a.y+(a.height-u)/2+1,r.width+e*3,u-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=fr(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline=`middle`,s?.(`text`)}oi(e,c,l,d,r)},measure:(e,t,n)=>{let r=t.displayData.split(` -`,t.allowWrapping===!0?void 0:1),i=0;for(let t of r)i=Math.max(i,e.measureText(t).width);return i+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:``}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{let{isHighlighted:n,onChange:r,value:i,validatedSelection:a}=t;return L.createElement(lr,{style:e.allowWrapping===!0?{padding:`3px 8.5px`}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:a,onChange:e=>r({...i,data:e.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}};St();var ku=xt(`div`)({name:`UriOverlayEditorStyle`,class:`gdg-u1rrojo`,propsAsIs:!1}),see=e=>{let{uri:t,onChange:n,forceEditMode:r,readonly:i,validatedSelection:a,preview:o}=e,[s,c]=L.useState(!i&&(t===``||r)),l=L.useCallback(()=>{c(!0)},[]);return s?L.createElement(lr,{validatedSelection:a,highlight:!0,autoFocus:!0,value:t,onChange:n}):L.createElement(ku,null,L.createElement(`a`,{className:`gdg-link-area`,href:t,target:`_blank`,rel:`noopener noreferrer`},o),!i&&L.createElement(`div`,{className:`gdg-edit-icon`,onClick:l},L.createElement(tn,null)),L.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};ct();function Au(e,t,n,r){let i=n.cellHorizontalPadding,a=t.height/2-e.actualBoundingBoxAscent/2,o=e.width,s=e.actualBoundingBoxAscent;return r===`right`?i=t.width-o-n.cellHorizontalPadding:r===`center`&&(i=t.width/2-o/2),{x:i,y:a,width:o,height:s}}var cee=[xl,Tl,$c,rl,cl,pl,_l,bl,wu,Tu,Du,Ou,{getAccessibilityString:e=>e.data?.toString()??``,kind:I.Uri,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:ti,draw:e=>{let{cell:t,theme:n,overrideCursor:r,hoverX:i,hoverY:a,rect:o,ctx:s}=e,c=t.displayData??t.data,l=t.hoverEffect===!0;if(r!==void 0&&l&&i!==void 0&&a!==void 0){let{x:l,y:u,width:d,height:f}=Au(Jr(c,s,n.baseFontFull),o,n,t.contentAlign);if(i>=l-4&&i<=l-4+d+8&&a>=u-4&&a<=u-4+f+8){let i=Xr(s,n.baseFontFull);r(`pointer`);let a=u-i;s.beginPath(),s.moveTo(o.x+l,Math.floor(o.y+a+f+5)+.5),s.lineTo(o.x+l+d,Math.floor(o.y+a+f+5)+.5),s.strokeStyle=n.linkColor,s.stroke(),s.save(),s.fillStyle=e.cellFillColor,oi({...e,rect:{...o,x:o.x-1}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x-2}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x+1}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x+2}},c,t.contentAlign),s.restore()}}s.fillStyle=l?n.linkColor:n.textDark,oi(e,c,t.contentAlign)},onClick:e=>{let{cell:t,bounds:n,posX:r,posY:i,theme:a}=e,o=t.displayData??t.data;if(t.hoverEffect!==!0||t.onClickUri===void 0)return;let s=Yr(o,a.baseFontFull);if(s===void 0)return;let c=Au(s,n,a,t.contentAlign);xa({x:c.x-4,y:c.y-4,width:c.width+8,height:c.height+8},r,i)&&t.onClickUri(e)},measure:(e,t,n)=>e.measureText(t.displayData??t.data).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:``}),provideEditor:e=>t=>{let{onChange:n,value:r,forceEditMode:i,validatedSelection:a}=t;return L.createElement(see,{forceEditMode:r.readonly!==!0&&(i||e.hoverEffect===!0&&e.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:a,readonly:r.readonly===!0,onChange:e=>n({...r,data:e.target.value})})},onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}}],lee=u(s(((e,t)=>{var n=Gt(),r=re(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))(),1),ju=[],uee=class extends gi{imageLoaded=()=>void 0;loadedLocations=[];cache={};setCallback(e){this.imageLoaded=e}sendLoaded=(0,lee.default)(()=>{this.imageLoaded(new vi(this.loadedLocations)),this.loadedLocations=[]},20);clearOutOfWindow=()=>{let e=Object.keys(this.cache);for(let t of e){let e=this.cache[t],n=!1;for(let t=0;t{o||(o=!0,ju.length<12?ju.unshift(a):i||(a.src=``))}},c=new Promise(e=>a.addEventListener(`load`,()=>e(null)));requestAnimationFrame(async()=>{try{a.src=e,await c,await a.decode();let t=this.cache[r];if(t!==void 0&&!o){t.img=a;for(let e of t.cells)this.loadedLocations.push(hi(e));i=!0,this.sendLoaded()}}catch{s.cancel()}}),this.cache[r]=s}loadOrGetImage(e,t,n){let r=e,i=this.cache[r];if(i!==void 0){let e=fi(t,n);return i.cells.includes(e)||i.cells.push(e),i.img}else this.loadImage(e,t,n,r)}},dee=L.forwardRef((e,t)=>{let n=L.useMemo(()=>({...da,...e.headerIcons}),[e.headerIcons]),r=L.useMemo(()=>e.imageWindowLoader??new uee,[e.imageWindowLoader]);return L.createElement(Zc,{...e,renderers:cee,headerIcons:n,ref:t,imageWindowLoader:r})}),Mu=`/api/v1`,Nu=`same-origin`,Pu=`aios:unauthorized`,Fu=`aios:data-error`,Iu=`aios:toast`,Lu=`aios:workspace-stale`,Ru=`aios:nav-minimize`;function zu(e,t){typeof window>`u`||window.dispatchEvent(new CustomEvent(e,{detail:t}))}var fee=`streamlit:componentReady`,pee=`streamlit:render`,mee=`streamlit:setComponentValue`,hee=`streamlit:setFrameHeight`,Bu=`aios:grid-host-render`;function Vu(e,t){window.parent.postMessage({isStreamlitMessage:!0,type:e,...t},`*`)}function Hu(){return typeof window>`u`||window.parent===window?!1:new URLSearchParams(window.location.search).has(`streamlitUrl`)}function gee(){Hu()&&(window.addEventListener(`message`,e=>{let t=e.data;if(!t||t.type!==pee)return;window.__AIOS_STREAMLIT_ARGS__=t.args??{},window.dispatchEvent(new CustomEvent(Bu));let n=Number(t.args?.height??760);Vu(hee,{height:Number.isFinite(n)?n:760})}),Vu(fee,{apiVersion:1}))}function _ee(){return window.__AIOS_STREAMLIT_ARGS__??null}function vee(e){return window.addEventListener(Bu,e),()=>window.removeEventListener(Bu,e)}var Uu=[],Wu=null;function yee(e){Wu=e}function Gu(e){return Hu()?(Uu.push(e),Uu.length>24&&Uu.shift(),Vu(mee,{value:{events:[...Uu]},dataType:`json`}),!0):Wu?Wu(e):!1}function Ku(e){return`${e}:${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}var qu={"Content-Type":`application/json`};async function Ju(e){try{return await e.json()}catch{return null}}function Yu(e){return e===401?(Xu=null,zu(Pu),!0):!1}var bee=5*6e4,Xu=null;function Zu(){Xu=null}async function xee(){if(Xu&&Date.now()-Xu.att.pid===e);n&&Object.assign(n,t)}}return n.ok}catch{return!1}}async function $u(e,t=nd){try{let n=await fetch(`${Mu}/grid/timeseries?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Nu,headers:qu,body:JSON.stringify(e)});if(Yu(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Ju(n);return!r||!Array.isArray(r.columns)||!Array.isArray(r.rows)?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}var ed=[],td=!1,nd=`customer`;function Cee(e){nd=e}async function rd(){if(td||ed.length===0)return;td=!0;let e=ed;ed=[];let t=!1;try{let n=await fetch(`${Mu}/grid/events`,{method:`POST`,credentials:Nu,headers:qu,body:JSON.stringify({events:e,scopeKey:nd})});Yu(n.status)||(n.ok?wee(await Ju(n)):t=!0)}catch{t=!0}finally{td=!1,t?ed=[...e,...ed].slice(-24):ed.length&&rd()}}function wee(e){let t=e,n=t?.toast;typeof n==`string`&&n.trim()!==``&&zu(Iu,n.trim());let r=Array.isArray(t?.results)?t.results:[];(t?.rerender===!0||r.some(e=>e?.rerender===!0))&&zu(Lu)}function Tee(e){return ed.push(e),ed.length>24&&ed.shift(),rd(),!0}function Eee(){yee(Tee)}var id=[`all_time`,`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`ytd`,`ytd_last_year`,`ltm`,`past_week`,`past_month`,`past_year`,`last_n_days`,`next_n_days`,`custom`],ad=new Set([`last_n_days`,`next_n_days`]),od={all_time:`all time`,today:`today`,yesterday:`yesterday`,this_week:`this week`,last_week:`last week`,this_month:`this month`,last_month:`last month`,this_quarter:`this quarter`,last_quarter:`last quarter`,this_year:`this year`,last_year:`last year`,ytd:`year to date`,ytd_last_year:`last year to date`,ltm:`the last 12 months`,past_week:`the past week`,past_month:`the past month`,past_year:`the past year`,last_n_days:`the last {n} days`,next_n_days:`the next {n} days`,custom:`a custom range`},sd=[`today`,`yesterday`,`one_week_ago`,`one_month_ago`,`n_days_ago`,`exact`],Dee=new Set([`today`,`yesterday`,`one_week_ago`,`one_month_ago`]),cd={today:`today`,yesterday:`yesterday`,one_week_ago:`one week ago`,one_month_ago:`one month ago`,n_days_ago:`{n} days ago`,exact:`an exact date`};function ld(e){let t=String(e??``).trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return null;let n=new Date(`${t}T00:00:00Z`);return Number.isNaN(n.getTime())?null:n}function ud(e){return e.toISOString().slice(0,10)}function dd(e,t){return new Date(e.getTime()+t*864e5)}function fd(e){return[e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate()]}function pd(e,t,n){return new Date(Date.UTC(e,t-1,n))}function md(e){let[t,n]=fd(e);return pd(t,n,1)}function hd(e){let[t,n]=fd(e);return n===12?pd(t,12,31):dd(pd(t,n+1,1),-1)}function gd(e){return(e.getUTCDay()+6)%7}function _d(e){let[t,n]=fd(e);return pd(t,3*Math.floor((n-1)/3)+1,1)}function Oee(e,t){return new Date(Date.UTC(t===12?e+1:e,t===12?0:t,1)-864e5).getUTCDate()}function vd(e,t){let[n,r,i]=fd(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a-o*12+1;return pd(o,s,Math.min(i,Oee(o,s)))}function yd(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.kind;if(!id.includes(n))return null;let r={kind:n};if(ad.has(n)){let e=Number(t.n);if(!Number.isInteger(e)||e<1||e>3650)return null;r.n=e}if(n===`custom`){let e=ld(t.from),n=ld(t.to);if(!e&&!n)return null;e&&n&&e>n&&([e,n]=[n,e]),e&&(r.from=ud(e)),n&&(r.to=ud(n))}return r}function bd(e,t){let n=yd(e);if(!n)return null;let r=ld(t);if(!r)throw Error("resolveWindow() needs an explicit `today`");switch(n.kind){case`all_time`:return[null,null];case`today`:return[ud(r),ud(r)];case`yesterday`:{let e=dd(r,-1);return[ud(e),ud(e)]}case`this_week`:{let e=dd(r,-gd(r));return[ud(e),ud(dd(e,6))]}case`last_week`:{let e=dd(r,-gd(r)-7);return[ud(e),ud(dd(e,6))]}case`this_month`:return[ud(md(r)),ud(hd(r))];case`last_month`:{let e=dd(md(r),-1);return[ud(md(e)),ud(e)]}case`this_quarter`:{let e=_d(r),[t,n]=fd(e);return[ud(e),ud(hd(pd(t,n+2,1)))]}case`last_quarter`:{let e=dd(_d(r),-1);return[ud(_d(e)),ud(e)]}case`this_year`:{let[e]=fd(r);return[ud(pd(e,1,1)),ud(pd(e,12,31))]}case`last_year`:{let[e]=fd(r);return[ud(pd(e-1,1,1)),ud(pd(e-1,12,31))]}case`ytd`:{let[e]=fd(r);return[ud(pd(e,1,1)),ud(r)]}case`ytd_last_year`:{let[e]=fd(r);return[ud(pd(e-1,1,1)),ud(vd(r,-12))]}case`ltm`:return[ud(dd(r,-364)),ud(r)];case`past_week`:return[ud(dd(r,-6)),ud(r)];case`past_month`:return[ud(dd(vd(r,-1),1)),ud(r)];case`past_year`:return[ud(dd(vd(r,-12),1)),ud(r)];case`last_n_days`:return[ud(dd(r,-(n.n-1))),ud(r)];case`next_n_days`:return[ud(r),ud(dd(r,n.n-1))];case`custom`:return[n.from??null,n.to??null]}}function xd(e){let t=yd(e);return t?od[t.kind].replace(`{n}`,String(t.n??``)):`an invalid range`}function Sd(e,t,n){let r=e||`exact`;if(!sd.includes(r))return null;let i=ld(n);if(!i)throw Error("resolveAnchor() needs an explicit `today`");switch(r){case`today`:return ud(i);case`yesterday`:return ud(dd(i,-1));case`one_week_ago`:return ud(dd(i,-7));case`one_month_ago`:return ud(vd(i,-1));case`n_days_ago`:{let e=String(t??``).trim();if(!/^[0-9]+$/.test(e))return null;let n=Number(e);return n>3650?null:ud(dd(i,-n))}default:{let e=ld(t);return e?ud(e):null}}}var Cd=[`text`,`select`,`multiselect`,`user`,`int`,`currency`,`pct`,`date`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`],kee=new Set([`formula`,`created_time`]);function wd(e){return e===`select`||e===`user`||e===`multiselect`}function Aee(e){let t=new Set,n=[];for(let r of e.split(` -`)){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n.slice(0,50)}function Td(e,t,n=120){let r=Math.max(1,Math.floor(n)),i=e=>e.trim().replace(/\s+/g,` `),a=(i(e)||`Untitled`).slice(0,r).trimEnd(),o=new Set(t.map(e=>i(e).toLocaleLowerCase()));if(!o.has(a.toLocaleLowerCase()))return a;for(let e=2;;e+=1){let t=` ${e}`,n=a.slice(0,Math.max(0,r-t.length)).trimEnd(),i=n?`${n}${t}`:String(e).slice(-r);if(!o.has(i.toLocaleLowerCase()))return i}}function jee(e){return e.filter(e=>e.filterable!==!1)}function Ed(e){return Array.isArray(e.options)?e.options:[]}function Mee(e){return typeof e.formula==`string`&&e.formula.trim()!==``?e.formula:void 0}function Dd(e){let t=typeof e.max==`number`&&Number.isFinite(e.max)?Math.round(e.max):5;return Math.max(2,Math.min(10,t))}var Nee=[`grid`,`chart`,`dashboard`,`list`,`calendar`,`kanban`,`map`,`timeseries`],Pee={dashboard:`chart`};function Fee(e){return Pee[e]??e}var Od=[`week`,`month`,`quarter`,`year`],kd=[`abs`,`pct`,`yoy`,`ytd`],Iee=[`note`,`formula`],Lee=/^[A-Za-z0-9_ .+\-*/()[\]]*$/;function Ree(e){let t=e.bucket===void 0||Od.includes(e.bucket),n=e.span,r;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.lastN;if(typeof e==`number`&&Number.isFinite(e)){let t=Math.round(e);t>=1&&t<=120&&(r={lastN:t})}}let i=e.span===void 0?r===void 0:!!r&&r.lastN===n?.lastN;if(t&&i)return e;let a={...e};return t||delete a.bucket,i||(r?a.span=r:delete a.span),a}function Ad(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(typeof t.mode!=`string`||!Nee.includes(t.mode))return;let n={mode:Fee(t.mode)};for(let e of[`dateField`,`stackField`,`titleField`,`colorField`,`sizeField`]){let r=t[e];typeof r==`string`&&r!==``&&(n[e]=r)}if(Array.isArray(t.charts)){let e=t.charts.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`).map(Ree);e.length&&(n.charts=e.slice(0,12))}if(t.kanbanClamp===!1&&(n.kanbanClamp=!1),(t.calendarMode===`records`||t.calendarMode===`summary`)&&(n.calendarMode=t.calendarMode),Array.isArray(t.calendarMetrics)){let e=[];for(let n of t.calendarMetrics){if(!n||typeof n!=`object`)continue;let t=n;typeof t.id!=`string`||!t.id||typeof t.field!=`string`||!t.field||typeof t.agg!=`string`||!t.agg||e.push({id:t.id,field:t.field,agg:t.agg})}e.length&&(n.calendarMetrics=e.slice(0,4))}if(Od.includes(t.tsBucket)&&(n.tsBucket=t.tsBucket),t.tsSpan&&typeof t.tsSpan==`object`&&!Array.isArray(t.tsSpan)){let e=t.tsSpan,r={};if(typeof e.from==`string`&&e.from&&(r.from=e.from),typeof e.to==`string`&&e.to&&(r.to=e.to),typeof e.lastN==`number`&&Number.isFinite(e.lastN)){let t=Math.round(e.lastN);t>=1&&t<=120&&(r.lastN=t)}(r.from||r.to||r.lastN!=null)&&(n.tsSpan=r)}if(Array.isArray(t.tsFields)){let e=t.tsFields.filter(e=>typeof e==`string`&&e!==``);e.length&&(n.tsFields=e.slice(0,12))}if(Array.isArray(t.tsDeltas)){let e=new Set,r=[];for(let n of t.tsDeltas)typeof n!=`string`||!kd.includes(n)||e.has(n)||(e.add(n),r.push(n));r.length&&(n.tsDeltas=r.slice(0,kd.length))}if(t.tsGridlines===!1&&(n.tsGridlines=!1),t.tsSparkline===!0&&(n.tsSparkline=!0),Array.isArray(t.tsRows)){let e=[],r=new Set;for(let n of t.tsRows){if(!n||typeof n!=`object`)continue;let t=n;if(typeof t.id!=`string`||!t.id||t.id.length>40||r.has(t.id)||typeof t.kind!=`string`||!Iee.includes(t.kind)||typeof t.label!=`string`||t.label.length>120)continue;r.add(t.id);let i={id:t.id,kind:t.kind,label:t.label};i.kind===`formula`&&typeof t.expr==`string`&&t.expr.length<=200&&Lee.test(t.expr)&&(i.expr=t.expr),e.push(i)}e.length&&(n.tsRows=e.slice(0,12))}if(t.tsStyles&&typeof t.tsStyles==`object`&&!Array.isArray(t.tsStyles)){let e={},r=0;for(let[n,i]of Object.entries(t.tsStyles)){if(r>=200)break;if(!n||!i||typeof i!=`object`||Array.isArray(i))continue;let t=i,a={};t.bold===!0&&(a.bold=!0),t.line===!0&&(a.line=!0),!(!a.bold&&!a.line)&&(e[n]=a,r+=1)}r&&(n.tsStyles=e)}if(!(n.mode===`grid`&&!n.dateField&&!n.stackField&&!n.titleField&&!n.colorField&&!n.sizeField&&!n.charts&&n.kanbanClamp===void 0&&!n.calendarMode&&!n.calendarMetrics&&!n.tsBucket&&!n.tsSpan&&!n.tsFields&&!n.tsDeltas&&n.tsGridlines===void 0&&n.tsSparkline===void 0&&!n.tsRows&&!n.tsStyles))return n}function jd(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.round(e);if(!(t<=1))return Math.min(8,t)}function Md(e,t){if(e.source!==`overlay`||kee.has(e.type))return!1;let n=e.permissions?.edit??`everyone`;return n===`everyone`?!0:t?t.isAdmin?!0:n===`creator`&&e.createdBy===t.name:!1}function Nd(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Pd(e){return e===`date`||e===`created_time`}function Fd(e,t){return Nd(e)?t===`asc`?`1 → 9`:`9 → 1`:Pd(e)?t===`asc`?`Oldest → Newest`:`Newest → Oldest`:t===`asc`?`A → Z`:`Z → A`}function Id(e,t){return e.type===`status`||e.type===`select`||e.type===`multiselect`||e.type===`checkbox`||e.type===`text`&&e.source!==`overlay`&&e.key!==t}var Ld=[`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`];function Rd(e){return Ld.includes(e)}var zee=[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`,`gt`,`gte`,`lt`,`lte`,`between`,`within`,`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`],zd=new Set([`isEmpty`,`isNotEmpty`,`aboveAvg`,`belowAvg`]),Bd=`__cohort__`;function Vd(e){return!Yd(e)&&e.colId===`__cohort__`}var Hd=[`anyOf`,`allOf`,`noneOf`],Bee={eq:`anyOf`,neq:`noneOf`};function Ud(e){return Hd.includes(e)?e:Bee[e]??`anyOf`}function Wd(e){let t=[];for(let n of String(e??``).split(`,`)){let e=n.trim();if(!(e===``||t.includes(e))&&(t.push(e),t.length>=20))break}return t}var Gd=[`avg`,`median`,`p10`,`p25`,`p75`,`p90`],Vee={avg:`the average`,median:`the median`,p10:`the bottom 10%`,p25:`the bottom quartile`,p75:`the top quartile`,p90:`the top 10%`};function Kd(e){return e&&e.kind!==`stat`?e.colId:void 0}function Hee(e){return e?e.kind===`stat`?Gd.includes(e.stat):e.colId?e.kind===`measure`?yd(e.window)!=null:e.kind===`field`:!1:!1}function qd(e){return e.colId===`__cohort__`?Wd(e.value).length>0:zd.has(e.op)?!0:e.op===`within`?yd(e.dateWindow)!=null:e.rhs?Hee(e.rhs):e.dateMode&&Dee.has(e.dateMode)?!0:e.op===`between`?e.value!==``&&e.value2!=null&&e.value2!==``:e.value!==``}var Uee=[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`],Wee=[`gte`,`gt`,`lte`,`lt`];function Jd(e){return!Yd(e)&&e.window!=null}function Yd(e){return e!=null&&Array.isArray(e.children)}var Gee=new Set([`all-customers`]);function Xd(e){return Gee.has(e.id)}function Zd(e){return e.config?.display?.mode??`grid`}function Qd(e){return e.kind===`system`||Xd(e)?!1:!!e.locked}function $d(e,t){return t?t.isAdmin?!0:!!e.createdBy&&e.createdBy===t.name:!1}var ef=[`personal`,`collaborative`,`users`],Kee={personal:`Personal`,collaborative:`Collaborative`,users:`Specific users`},qee={personal:`Only you can change this view.`,collaborative:`Anyone who can see this table can change it.`,users:`Only the people you pick can change it.`};function Jee(e,t,n){let r=e&&typeof e==`object`&&!Array.isArray(e)?e:{},i=ef.includes(r.edit)?r.edit:t;if(i!==`users`)return{edit:i};let a=new Set,o=[];for(let e of(Array.isArray(r.users)?r.users:[]).slice(0,50)){let t=String(e??``).trim();!t||a.has(t.toLowerCase())||n&&!n.includes(t)||(a.add(t.toLowerCase()),o.push(t))}return o.length?{edit:`users`,users:o}:{edit:`personal`}}function Yee(e){return e.permissions?.edit??`collaborative`}function tf(e,t){let n=Yee(e);return n===`collaborative`||!e.createdBy?!0:t?t.isAdmin||e.createdBy&&e.createdBy===t.name?!0:n===`users`&&(e.permissions?.users??[]).includes(t.name):!1}var Xee=[`folder`,`star`,`flag`,`tag`,`bookmark`,`grid`,`chart`,`map`,`users`,`clock`,`heart`,`bolt`],Zee=[`neutral`,`blue`,`green`,`yellow`,`red`],Qee=`folder`,nf=`neutral`;function $ee(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(!Xee.includes(t.shape))return;let n=t.shape,r=Zee.includes(t.tone)?t.tone:nf;if(!(n===`folder`&&r===`neutral`))return{shape:n,tone:r}}var ete=5*1024*1024;function tte(e){return e?.windowed?`server-windowed`:`whole-book`}function nte(e){return JSON.stringify([e.config?.filters??[],e.config?.filterConj===`or`?`or`:`and`])}function rte(e,t,n){let r=nte(e);return r===nte(t)||r===n?null:r}function rf(e,t){for(let n of e??[]){if(Yd(n)){rf(n.children,t);continue}let e=n;Jd(n)&&e.id&&t.set(e.id,e)}}function ite(e,t,n,r){if(!t||n==null||r-n>12e4)return e;let i=e,a=t.config?t.config.display:void 0;if(t.config&&JSON.stringify(a??null)!==JSON.stringify(e.config?.display??null)){let t={...e.config};a===void 0?delete t.display:t.display=a,i={...e,config:t}}let o=t.config?t.config.cohortLock:void 0;if(t.config&&o!==i.config?.cohortLock){let e={...i.config};o===void 0?delete e.cohortLock:e.cohortLock=o,i={...i,config:e}}let s=t.config?t.config.filters:void 0;if(!Array.isArray(s)||s.length===0)return i;let c=new Map;if(rf(s,c),c.size===0)return i;let l=new Map;rf(e.config?e.config.filters:void 0,l);let u=!1;for(let[e,t]of c){if(!qd(t))continue;let n=l.get(e);if(!n||!qd(n)){u=!0;break}}return u?{...i,config:{...i.config,filters:s,filterConj:t.config.filterConj??e.config.filterConj}}:i}function af(e,t){let n=e=>{let n={};for(let[r,i]of Object.entries(e??{}))typeof i==`number`&&t-i<=12e4&&(n[r]=i);return n};return{edited:n(e?.edited),deleted:n(e?.deleted)}}function of(e){if(Array.isArray(e))return e.map(of);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!==void 0&&(t[n]=of(r))}return t}return e}function ate(e){let{createdBy:t,permissions:n,editRequestId:r,labelCorrectedFrom:i,labelCorrectionId:a,...o}=e;return JSON.stringify(of(o))}function ote(e,t,n,r,i){let a=e=>typeof e==`number`&&r-e<=12e4,o=new Map(t.map(e=>[e.key,e])),s=[];for(let t of e){let e=o.get(t.key);if(o.delete(t.key),!a(n?.deleted?.[t.key])){if(!e){s.push(t);continue}if(!i){s.push({...e,...t,note:t.note??e.note});continue}if(t.labelCorrectedFrom===e.label&&t.label!==e.label&&typeof t.labelCorrectionId==`string`&&t.labelCorrectionId===e.editRequestId){s.push(t);continue}if(a(n?.edited?.[t.key])&&ate(e)!==ate(t)){s.push({...e,...t.createdBy==null?{}:{createdBy:t.createdBy}});continue}s.push(t.note==null&&e.note!=null?{...t,note:e.note}:t)}}for(let e of o.values())if(e.custom&&!a(n?.deleted?.[e.key])){if(e.source===`overlay`){s.push(e);continue}(!i||a(n?.edited?.[e.key]))&&s.push(e)}return s}function ste(e,t){let n=e.filter(e=>!(e.pid===t.pid&&e.key===t.key));return n.push(t),n.slice(-64)}function cte(e,t,n){let r=[],i={};for(let a of e){if(a==null||typeof a.pid!=`number`||typeof a.key!=`string`||typeof a.at!=`number`)continue;let e=t(a.pid),o=e?e[a.key]:void 0;String(o??``)!==String(a.value??``)&&(n-a.at>12e4||(r.push(a),i[a.pid]={...i[a.pid],[a.key]:a.value}))}return{keep:r,seeds:i}}function sf(){if(typeof window>`u`)return null;let e=window.__AIOS_GRID__;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function lte(){let e=_ee()?.payload;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function ute(e,t){let n={...e,workspace:t};Array.isArray(t.measures)&&(n.measures=t.measures),t.measureSets&&typeof t.measureSets==`object`&&(n.measureSets=t.measureSets),t.viewer&&typeof t.viewer.name==`string`&&(n.viewer=t.viewer),Array.isArray(t.userOptions)&&(n.userOptions=t.userOptions);let r=t.derived;return r&&typeof r==`object`&&Object.keys(r).length>0&&(n.rows=e.rows.map(e=>{let t=r[String(e.pid)];return t?{...e,...t}:e})),n}function dte(){return lte()??sf()}var cf=Hu(),fte=sf()!==null;function pte(e){return`aios-grid-cells:${e}`}function mte(e){try{let t=localStorage.getItem(pte(e)),n=t?JSON.parse(t):null;return Array.isArray(n)?n:[]}catch{return[]}}function hte(e,t){try{localStorage.setItem(pte(e),JSON.stringify(t))}catch{}}function gte(e){let t=e?.workspace?.storageKey;if(!e||!t)return{};let n=new Map(e.rows.map(e=>[e.pid,e])),{keep:r,seeds:i}=cte(mte(t),e=>n.get(e),Date.now());return hte(t,r),i}function _te(e=`customer`){Cee(e);let[t,n]=(0,L.useState)(()=>dte()),[r,i]=(0,L.useState)(()=>cf?gte(dte()):{}),a=(0,L.useRef)(t);a.current=t,(0,L.useEffect)(()=>{if(cf){let e=()=>{let e=lte();if(!e)return;let t=gte(e);Object.keys(t).length&&i(e=>{let n={...e};for(let[e,r]of Object.entries(t))n[Number(e)]={...r,...n[Number(e)]};return n}),n(e)};return e(),vee(e)}if(sf())return;let t=!1;async function r(){let[r,i]=await Promise.all([xee(),Qu(e)]);t||!r||n(i?ute(r,i):r)}r();async function a(){let r=await Qu(e);t||!r||n(e=>e&&ute(e,r))}let o=()=>{a()};return typeof window<`u`&&window.addEventListener(Lu,o),()=>{t=!0,typeof window<`u`&&window.removeEventListener(Lu,o)}},[e]);let o=(0,L.useCallback)((e,t)=>{let n;if(i(r=>(n=r[e],{...r,[e]:{...r[e],...t}})),cf){let n=a.current?.workspace?.storageKey;if(n){let r=mte(n),i=Date.now();for(let[n,a]of Object.entries(t))r=ste(r,{pid:e,key:n,value:a??null,at:i});hte(n,r)}Gu({id:Ku(`overlay`),type:`overlay_patch`,pid:e,updates:t});return}fte||See(e,t).then(t=>{t||(console.warn(`customer-grid: overlay PATCH failed for pid ${e}; rolling back`),i(t=>{let r={...t};return n===void 0?delete r[e]:r[e]=n,r}))})},[]);return{fields:t?.fields??[],rawRows:t?.rows??[],payload:t,loading:t===null,overlayEdits:r,setOverlayEdits:i,patchOverlay:o}}var lf=`#202433`,uf=`#6B7280`,df=`#E6E9EF`,vte=`#FFFFFF`,yte=`#FAFBFC`,bte=`#9DBFF2`,ff=`#EDF3FD`,xte=`#F5D989`,Ste=`#FBF4E0`,Cte=`#F0A8A0`,wte=`#FCEEEC`,Tte=`#A5D8B4`,Ete=`#EBF6EF`,Dte=`#768FB6`,Ote=`#4F6079`,kte=`#7E6428`,Ate=`#A3453C`,jte=`#35754E`,pf={accentColor:Dte,accentLight:ff,textDark:lf,textMedium:uf,textLight:`#8B92A0`,textHeader:lf,bgCell:vte,bgHeader:yte,bgHeaderHovered:`#F1F3F6`,bgHeaderHasFocus:ff,borderColor:df,horizontalBorderColor:df,fgIconHeader:uf,bgIconHeader:df,fontFamily:`Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`,baseFontStyle:`13px`,headerFontStyle:`600 13px`},Mte={growing:{bgBubble:Ete,textBubble:jte},new:{bgBubble:ff,textBubble:Ote},declining:{bgBubble:Ste,textBubble:kte},dormant:{bgBubble:df,textBubble:lf},lost:{bgBubble:wte,textBubble:Ate},reactivated:{bgBubble:Tte,textBubble:lf}},Nte={growing:{bgCell:`rgba(165, 216, 180, 0.40)`},new:{bgCell:`rgba(157, 191, 242, 0.38)`},declining:{bgCell:`rgba(245, 217, 137, 0.42)`},dormant:{bgCell:`rgba(107, 114, 128, 0.13)`},lost:{bgCell:`rgba(240, 168, 160, 0.38)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.72)`}},Pte={growing:{bgCell:`rgba(165, 216, 180, 0.62)`},new:{bgCell:`rgba(157, 191, 242, 0.60)`},declining:{bgCell:`rgba(245, 217, 137, 0.64)`},dormant:{bgCell:`rgba(107, 114, 128, 0.22)`},lost:{bgCell:`rgba(240, 168, 160, 0.60)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.92)`}},Fte={bgCell:`rgba(32, 36, 51, 0.06)`},Ite=Fte,Lte=Fte,mf={bgHeader:`#F1F0ED`,bgHeaderHovered:`#F1F0ED`,bgHeaderHasFocus:`#F1F0ED`,bgCell:`rgba(115, 105, 75, 0.05)`,headerFontStyle:`700 13px`},Rte={filter:mf,sort:mf,group:mf},zte=uf,hf=(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`,Bte=[{d:`M3.2 4.6h9.6v8.2H3.2z`},{d:`M3.2 7.2h9.6`},{d:`M5.8 3v3.2`},{d:`M10.2 3v3.2`}],gf={text:[{d:`M3 5h10M3 8h10M3 11h6`}],status:[{d:`M4 13V3.5h7.6L10.1 6l1.5 2.5H4`}],currency:[{d:`M8 2.8v10.4`},{d:`M10.6 5.4A2.6 2.6 0 0 0 8.2 4.2H7.4a2 2 0 0 0 0 4h1.2a2 2 0 0 1 0 4H7.8a2.6 2.6 0 0 1-2.4-1.4`}],int:[{d:`M6.2 3L4.8 13M11.2 3l-1.4 10M3.4 6.2h9.2M2.9 9.8h9.2`}],date:Bte,pct:[{d:hf(4.6,4.6,1.6)},{d:hf(11.4,11.4,1.6)},{d:`M12.2 3.9L3.8 12.3`}],select:[{d:`M3.2 3.8h9.6v8.4H3.2z`},{d:`M6.2 7.2l1.8 1.8 1.8-1.8`}],user:[{d:hf(8,6,2.4)},{d:`M3.6 13c0-2.4 2-3.8 4.4-3.8s4.4 1.4 4.4 3.8`}],multiselect:[{d:`M3 4.6h2.2v2.2H3zM3 9.2h2.2v2.2H3z`},{d:`M7.2 5.7h6M7.2 10.3h6`}],checkbox:[{d:`M3.4 3.4h9.2v9.2H3.4z`},{d:`M5.8 8.1l1.8 1.9 3.4-3.9`}],phone:[{d:`M5.1 3.2L7 5.1 5.6 7a7.2 7.2 0 0 0 3.4 3.4l1.9-1.4 1.9 1.9-1.5 1.6c-3 .5-8.3-4.8-7.8-7.8z`}],email:[{d:`M3 4.4h10v7.2H3z`},{d:`M3 4.9l5 3.9 5-3.9`}],url:[{d:`M7 5.4L8.4 4a2.6 2.6 0 0 1 3.7 3.7L10.7 9`},{d:`M9 10.6L7.6 12a2.6 2.6 0 0 1-3.7-3.7L5.3 7`},{d:`M6.2 9.8l3.6-3.6`}],rating:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`,fill:!0}],created_time:[{d:hf(8,8,5.2)},{d:`M8 4.9v3.4l2.3 1.4`}],formula:[{d:`M5.6 12.8V5.4a2 2 0 0 1 3.2-1.6`},{d:`M4.2 7.6h4.6`},{d:`M10.2 8.4l3 3.4M13.2 8.4l-3 3.4`}]},_f={grid:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.5h10.8M2.6 9.5h10.8M6.4 3.4v9.2M10 3.4v9.2`}],list:[{d:`M3 4.6h1.4M6.4 4.6h6.6M3 8h1.4M6.4 8h6.6M3 11.4h1.4M6.4 11.4h6.6`}],chart:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],dashboard:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],calendar:Bte,kanban:[{d:`M2.8 3.4h3.1v9.2H2.8zM6.5 3.4h3.1v6.2H6.5zM10.2 3.4h3.1v7.6h-3.1z`}],map:[{d:`M8 2.6a3.6 3.6 0 0 1 3.6 3.6c0 2.7-3.6 7.2-3.6 7.2S4.4 8.9 4.4 6.2A3.6 3.6 0 0 1 8 2.6z`},{d:hf(8,6.1,1.3)}],timeseries:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.6h10.8M6.2 3.4v9.2`},{d:`M7.2 10.8l2-2.4 1.6 1.2 1.8-2.6`}]},Vte={bar:[{d:`M3.2 12.8V7.4M6.4 12.8V4.2M9.6 12.8V8.8M12.8 12.8V5.8`}],line:[{d:`M2.6 11.2l3.2-3.4 2.6 2 4.9-5.2`},{d:hf(5.8,7.8,.9)},{d:hf(8.4,9.8,.9)}],area:[{d:`M2.6 12.4V9.2l3.2-3.2 2.6 2 4.9-4.6v9z`},{d:`M2.6 9.2l3.2-3.2 2.6 2 4.9-4.6`}],donut:[{d:hf(8,8,5)},{d:hf(8,8,2.1)}],kpi:[{d:`M2.6 3.8h10.8v8.4H2.6z`},{d:`M5.4 9.6V6.4l1.9 3.2V6.4M9.4 6.4v3.2h1.8`}]},Hte={bar:`blue`,line:`green`,area:`green`,donut:`yellow`,kpi:`neutral`},Ute={folder:[{d:`M2.4 12.6V4.2a.6.6 0 0 1 .6-.6h3.2l1.5 1.7h5.3a.6.6 0 0 1 .6.6v6.7a.6.6 0 0 1-.6.6H3a.6.6 0 0 1-.6-.6z`}],star:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`}],flag:[{d:`M4.2 13.4V2.9`},{d:`M4.2 3.4h7.6l-1.5 2.6 1.5 2.6H4.2z`}],tag:[{d:`M2.9 8.2V3.5a.6.6 0 0 1 .6-.6h4.7l5 5-5.3 5.3z`},{d:hf(5.6,5.6,1)}],bookmark:[{d:`M4.4 2.9h7.2v10.4L8 10.7l-3.6 2.6z`}],grid:_f.grid,chart:_f.dashboard,map:_f.map,users:gf.user,clock:gf.created_time,heart:[{d:`M8 13.1S2.7 9.8 2.7 6.4a2.9 2.9 0 0 1 5.3-1.6 2.9 2.9 0 0 1 5.3 1.6c0 3.4-5.3 6.7-5.3 6.7z`}],bolt:[{d:`M9.1 2.4L4.2 9.1h3.3l-.6 4.5 4.9-6.7H8.5z`}]},vf={neutral:{fill:df,stroke:uf},blue:{fill:bte,stroke:Dte},green:{fill:Tte,stroke:jte},yellow:{fill:xte,stroke:kte},red:{fill:Cte,stroke:Ate}},yf={neutral:`Neutral`,blue:`Blue`,green:`Green`,yellow:`Yellow`,red:`Red`},bf={folder:`Folder`,star:`Star`,flag:`Flag`,tag:`Tag`,bookmark:`Bookmark`,grid:`Table`,chart:`Chart`,map:`Map`,users:`People`,clock:`Clock`,heart:`Heart`,bolt:`Priority`},xf={grid:`Grid`,chart:`Chart`,dashboard:`Chart`,list:`List`,calendar:`Calendar`,kanban:`Kanban`,map:`Map`,timeseries:`Time series`},Sf=[`grid`,`chart`,`list`,`calendar`,`kanban`,`map`,`timeseries`],Cf={grid:`blue`,list:`blue`,chart:`green`,dashboard:`green`,calendar:`yellow`,kanban:`yellow`,map:`red`,timeseries:`green`},wf={text:`Single line text`,select:`Single select`,multiselect:`Multi select`,user:`Assignee`,int:`Number`,currency:`Currency`,pct:`Percent`,date:`Date`,checkbox:`Checkbox`,phone:`Phone number`,email:`Email`,url:`URL`,rating:`Rating`,created_time:`Created time`,formula:`Formula`,status:`Lifecycle status (Odoo)`};function Wte(e,t){return e.fill?``:``}function Gte(e){return({fgColor:t})=>``+e.map(e=>Wte(e,t)).join(``)+``}function Tf(e){return`t_${e}`}var Kte={...Object.fromEntries(Object.keys(gf).map(e=>[Tf(e),Gte(gf[e])])),aiosInfo:()=>``};function qte(e,t,n){return e&&t>Math.max(0,n-16)?e:null}function Jte(e,t,n,r=8){let i=Math.min(n,280);return Math.round(Math.max(r,Math.min(e,t-r-i)))}var Ef=`600 13px`;function Yte(e,t,n,r,i){let a=t=>`${e} ${t} (${n})`,o=a(t);if(r==null||r<=0||i(o)<=r)return o;let s=r-i(a(``));return s<=0?o:a(kf(t,s,i))}function Df(e,t,n,r=4){if(n.length===0)return null;let i=[],a=e.x+e.width-t-r;for(let t of n){let n=a-t;if(n-e.x<68)return null;i.push({x:Math.round(n),y:Math.round(e.y+(e.height-t)/2),size:t}),a=n-6}return i}function Of(e,t){let n=[];return e&&n.push(16),t&&n.push(6),n}function Xte(e,t,n=30){let r=Df({x:0,y:0,width:e,height:32},n,t===!0?[16]:t===!1?[]:t);return r?Math.max(0,r[r.length-1].x-32-6):null}function kf(e,t,n){if(t==null||!e||n(e)<=t)return e;let r=n(`…`);if(r>t)return e;let i=0,a=e.length;for(;it.x+t.width||at.y+t.height)?null:{x:i,y:a,size:n}}function Qte(e){let{placement:t,target:n,panel:r,viewport:i}=e,a=i.left+8,o=i.left+i.width-8,s=i.top+8,c=i.top+i.height-8,l=Math.max(1,o-a),u=Math.min(r.width,l),d=r.height,f,p,m,h;if(t===`right-start`){let e=Math.max(0,o-(n.right+6)),t=Math.max(0,n.left-6-a),r=u<=e||e>=t;h=r?`right`:`left`;let i=r?n.right+6:n.left-6-u;f=Math.min(Math.max(i,a),Math.max(a,o-u)),m=Math.max(1,c-s),p=Math.min(Math.max(n.top,s),Math.max(s,c-Math.min(d,m)))}else{let e=Math.max(0,c-(n.bottom+6)),r=Math.max(0,n.top-6-s),i=d<=e||e>=r;h=i?`below`:`above`,m=Math.max(1,i?e:r);let l=t===`bottom-end`?n.right-u:n.left;f=Math.min(Math.max(l,a),o-u),p=i?Math.min(n.bottom+6,c-m):Math.max(s,n.top-6-Math.min(d,m))}return{left:Math.round(f),top:Math.round(p),maxWidth:Math.floor(l),maxHeight:Math.floor(m),side:h}}var $te=150,Af={base:void 0,bold:void 0};function ene(e,t=!1){let n=t?`bold`:`base`;if(Af[n]===void 0){let e=document.createElement(`canvas`).getContext(`2d`);e&&(e.font=`${(t?mf.headerFontStyle:pf.headerFontStyle)??`600 13px`} ${pf.fontFamily??`Inter, sans-serif`}`),Af[n]=e}let r=Af[n];return r?r.measureText(e).width:0}function tne(e){return!!(e.note||e.description)}function nne(e,t){for(let n of e??[]){if(Yd(n)){nne(n.children,t);continue}qd(n)&&t.add(n.colId)}}function rne(e){return e?Rte[e]:void 0}function ine(e){let t=new Map;for(let n of e.sorts??[])t.set(n.colId,`sort`);e.groupBy&&t.set(e.groupBy,`group`);let n=new Set;nne(e.filters??[],n);for(let e of n)t.set(e,`filter`);return t}function jf(e){return e.default!==!1||e.source===`overlay`}function Mf(e){let t=e.filter(jf).map(e=>e.key),n=e.filter(e=>!jf(e)).map(e=>e.key);return{filters:[],filterConj:`and`,sorts:[],groupBy:null,colorBy:null,rowHeightMode:`short`,order:[...t,...n],visible:t,widths:{},memberPids:[]}}function ane(e,t){let n=new Set(t.map(e=>e.key)),r=e.filter((t,r)=>n.has(t)&&e.indexOf(t)===r);for(let e of t)r.includes(e.key)||r.push(e.key);let i=t.find(e=>e.pinned)?.key??t[0]?.key;return i&&r[0]!==i?[i,...r.filter(e=>e!==i)]:r}function one(e,t,n){let r=new Set(t.map(e=>e.key)),i=new Set(e.filter(e=>r.has(e)));if(i.size===0)for(let e of t)jf(e)&&i.add(e.key);return n&&i.add(n),i}function sne(e,t,n){let r=(0,L.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),i=(0,L.useMemo)(()=>e.find(e=>e.pinned)?.key??e[0]?.key??``,[e]),a=(0,L.useMemo)(()=>ane(t.order,e),[t.order,e]),o=(0,L.useMemo)(()=>one(t.visible,e,i),[t.visible,e,i]),s=(0,L.useMemo)(()=>ine(t),[t.filters,t.sorts,t.groupBy]),c=(0,L.useMemo)(()=>a.filter(e=>o.has(e)).map(e=>{let n=r.get(e),i=t.widths[e]??$te,a=s.has(e),o=Of(tne(n),n.source===`overlay`);return{id:e,title:kf(n.label,Xte(i,o),e=>ene(e,a)),width:i,hasMenu:!0,menuIcon:`dots`,icon:Tf(n.type),themeOverride:rne(s.get(e))}}),[a,o,t.widths,r,s]),l=(0,L.useCallback)((e,r)=>{e.id&&n({...t,widths:{...t.widths,[e.id]:Math.round(r)}})},[t,n]),u=(0,L.useCallback)((e,r)=>{if(e===0||r===0)return;let i=a.filter(e=>o.has(e));if(e<0||e>=i.length||r<0||r>=i.length)return;let s=i.slice(),[c]=s.splice(e,1);s.splice(r,0,c);let l=0,u=a.map(e=>o.has(e)?s[l++]:e);n({...t,order:u})},[t,n,a,o]),d=(0,L.useCallback)((e,t)=>e!==0&&t!==0,[]),f=(0,L.useCallback)((e,r)=>{if(!r&&e===i)return;let a=new Set(o);r?a.add(e):a.delete(e),n({...t,visible:[...a]})},[t,i,n,o]),p=(0,L.useCallback)((e,r,i)=>{let s=a.filter(t=>t!==e);if(i===`end`||!r)s.push(e);else{let t=Math.max(0,s.indexOf(r));s.splice(t+ +(i===`right`),0,e)}let c=new Set(o);c.add(e),n({...t,order:s,visible:[...c]})},[t,n,a,o]);return{visibleCols:c,fieldByKey:r,order:a,visible:o,widths:t.widths,lockedKey:i,onColumnResize:l,onColumnMoved:u,onColumnProposeMove:d,setColumnVisible:f,insertColumn:p}}function cne(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function lne(e,t){let n={};for(let r of t){if(r.agg!==`sum`)continue;let t=0;for(let n of e)t+=cne(n[r.key]);let i=Math.round(t*100)/100;n[r.key]=r.type===`currency`?`$`+i.toLocaleString():i.toLocaleString()}return n}var Nf={sets:new Map,unanswerable:0};function une(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function Pf(e){return!Yd(e)&&!Jd(e)&&Rd(e.op)}function Ff(e){for(let t of e??[]){if(Yd(t)){if(Ff(t.children))return!0;continue}if(Pf(t))return!0}return!1}function If(e){let t=[];for(let n of e??[]){if(Yd(n)){let e=If(n.children);e.length&&t.push({conj:n.conj,children:e});continue}Pf(n)||t.push(n)}return t}function Lf(e){let t=[];for(let n of e??[]){if(Yd(n)){t.push(...Lf(n.children));continue}if(!Pf(n))continue;let e=n;qd(e)&&t.push(e)}return t}function dne(e,t,n){let r=[];for(let n of e){let e=n[t];if(e==null||e===``)continue;let i=typeof e==`number`?e:Number(e);Number.isFinite(i)&&r.push({pid:n.pid,v:i})}return r.sort((e,t)=>e.v===t.v?e.pid-t.pid:n===`asc`?e.v-t.v:t.v-e.v),r}function Rf(e,t,n){let r=Number(e);if(!Number.isFinite(r))return null;let i=Math.trunc(r);return i!==r||in?null:i}function fne(e,t,n){return Math.min(n,Math.floor(e*n/t)+1)}function zf(e,t){return Math.min(e,Math.max(1,Math.ceil(e*t/100)))}function pne(e,t,n){let r=Lf(e);if(!r.length)return Nf;let i=new Map,a=0,o=new Map,s=(e,n)=>{let r=`${n}:${e}`,i=o.get(r);return i||(i=dne(t,e,n),o.set(r,i)),i},c=e=>{i.set(e,new Set),a+=1};for(let e of r){let r=n.get(e.colId);if(!r||!une(r.type)){c(e);continue}let o=s(e.colId,`asc`);if(!o.length){i.set(e,new Set),t.length&&(a+=1);continue}let l=o.length,u=null;switch(e.op){case`topN`:{let t=Rf(e.value,1,1e4);u=t==null?null:s(e.colId,`desc`).slice(0,t);break}case`bottomN`:{let t=Rf(e.value,1,1e4);u=t==null?null:o.slice(0,t);break}case`inTopPct`:{let t=Rf(e.value,1,100);u=t==null?null:s(e.colId,`desc`).slice(0,zf(l,t));break}case`inBottomPct`:{let t=Rf(e.value,1,100);u=t==null?null:o.slice(0,zf(l,t));break}case`aboveAvg`:case`belowAvg`:{let t=o.reduce((e,t)=>e+t.v,0)/l;u=o.filter(n=>e.op===`aboveAvg`?n.v>t:n.vfne(r,l,t)===n);break}default:u=null}if(u==null){c(e);continue}i.set(e,new Set(u.map(e=>e.pid)))}return{sets:i,unanswerable:a}}function Bf(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Vf(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function mne(e){return e===`date`||e===`created_time`}function hne(e,t,n){for(let r of n){if(r.type!==`text`&&r.type!==`status`)continue;let n=t[r.key];if(n!=null&&String(n).toLowerCase().includes(e))return!0}return!1}function Hf(e){return e==null||e===``}function gne(e,t,n,r){let i=n.get(e.colId);if(!i)return!0;let a=t[e.colId];if(e.op===`isEmpty`)return Hf(a);if(e.op===`isNotEmpty`)return!Hf(a);if(Rd(e.op))return!1;let o=e.rhs!=null,s=o?t[Kd(e.rhs)??``]:void 0;if(Vf(i.type)){let t=Bf(a);if(o)return Uf(e.op,t,Bf(s));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=Math.min(Bf(e.value),Bf(e.value2)),r=Math.max(Bf(e.value),Bf(e.value2));return t>=n&&t<=r}return e.value===``||Uf(e.op,t,Bf(e.value))}if(mne(i.type)){let t=String(a??``).slice(0,10);if(e.op===`within`){if(!r)return!1;let n=bd(e.dateWindow,r);if(!n||t===``)return!1;let[i,a]=n;return(i==null||t>=i)&&(a==null||t<=a)}if(o)return Wf(e.op,t,String(s??``).slice(0,10));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=e.value=n&&t<=r}if(!_ne.has(e.op)||!e.dateMode&&e.value===``)return!0;let n=e.dateMode||`exact`;if(n!==`exact`&&!r)return!1;let i=Sd(n,e.value,r||`1970-01-01`);return i!=null&&Wf(e.op,t,i)}let c=String(a??``).toLowerCase();return o?Gf(e.op,c,String(s??``).toLowerCase()):e.value===``||Gf(e.op,c,e.value.toLowerCase())}var _ne=new Set([`eq`,`neq`,`lt`,`lte`,`gt`,`gte`]);function Uf(e,t,n){switch(e){case`gt`:return t>n;case`gte`:return t>=n;case`lt`:return tn;case`gte`:return t>=n;default:return!0}}function Gf(e,t,n){switch(e){case`contains`:return t.includes(n);case`doesNotContain`:return!t.includes(n);case`eq`:return t===n;case`neq`:return t!==n;default:return!0}}function Kf(e,t,n,r){if(Yd(e)){let i=!1,a=!0,o=!1;for(let s of e.children){let e=Kf(s,t,n,r);e!==null&&(i=!0,a&&=e,o||=e)}return i?e.conj===`or`?o:a:null}if(Vd(e)){if(!qd(e))return null;let n=Wd(e.value).map(e=>r?.cohortSets?.[e]);if(n.some(e=>!e))return!1;let i=Ud(e.op);if(i===`allOf`)return n.every(e=>e.has(t.pid));let a=n.some(e=>e.has(t.pid));return i===`noneOf`?!a:a}if(Jd(e)){if(!qd(e))return null;let n=e.id?r?.measureSets?.[e.id]:void 0;return n?n.has(t.pid):!1}if(!n.has(e.colId)||e.rhs&&!n.has(Kd(e.rhs)??``)||!qd(e))return null;if(Rd(e.op)){let n=r?.rankSets?.get(e);return n?n.has(t.pid):!1}return zee.includes(e.op)?gne(e,t,n,r?.today):!1}function qf(e,t){let n=0;for(let r of e??[]){if(Yd(r)){n+=qf(r.children,t);continue}!Jd(r)||!qd(r)||(!r.id||!t?.[r.id])&&(n+=1)}return n}function Jf(e){let t=[];for(let n of e??[]){if(Yd(n)){t.push(...Jf(n.children));continue}!Jd(n)||!qd(n)||t.push(n.id||`(no-id)`)}return t}function Yf(e,t){let n=0;for(let r of e??[]){if(Yd(r)){n+=Yf(r.children,t);continue}if(qd(r)){if(Vd(r)){Wd(r.value).some(e=>!t?.cohortSets?.[e])&&(n+=1);continue}Jd(r)||(r.op===`within`?(!t?.today||!bd(r.dateWindow,t.today))&&(n+=1):r.dateMode&&(!t?.today||Sd(r.dateMode,r.value,t.today)==null)&&(n+=1))}}return n}function Xf(e,t,n,r,i){let a=Kf({conj:t,children:e},n,r,i);return a===null||a}function vne(e,t){return(n,r)=>{for(let i of e){let e=t.get(i.colId),a=e?Vf(e.type):!1,o=n[i.colId],s=r[i.colId],c=Hf(o),l=Hf(s);if(c!==l)return c?1:-1;if(c&&l)continue;let u=a?Bf(o)-Bf(s):String(o??``).localeCompare(String(s??``));if(u!==0)return i.dir===`asc`?u:-u}return 0}}function yne(e,t,n,r){let i=[],a=new Map,o=r.some(e=>e.key===t&&(e.multi||e.type===`multiselect`)),s=r.some(e=>e.key===t&&e.type===`checkbox`),c=e=>s?e===`1`?`Checked`:`Unchecked`:e===``?`(empty)`:e;for(let n of e){let e=n[t],r=e==null?``:String(e),s=o?r.split(`,`).map(e=>e.trim()).filter(e=>e!==``):[r];for(let e of s.length?s:[``]){let t=a.get(e);t||(t=[],a.set(e,t),i.push(e)),t.push(n)}}let l=[];for(let e of i){let t=a.get(e),i=n.has(e),o=lne(t,r);if(l.push({kind:`group-header`,groupKey:e,label:c(e),count:t.length,collapsed:i,aggs:o}),!i){for(let e of t)l.push({kind:`data`,record:e});l.push({kind:`group-footer`,groupKey:e,aggs:o})}}return l}function Zf(e){let{rawRows:t,fields:n,filters:r,search:i,sorts:a,groupBy:o,collapsed:s,memberPids:c=[],filterConj:l=`and`,serverWindowed:u=!1,measureSets:d,cohortSets:f,today:p,cohortLock:m}=e,h={measureSets:d,cohortSets:f,today:p},g=0,_=e=>{let t=e.map(e=>({kind:`data`,record:e})),n=new Map;return t.forEach((e,t)=>{e.kind===`data`&&n.set(e.record.pid,t)}),{visibleRows:t,pidToIndex:n,unresolvedRank:g}};if(u)return _(t);let v=new Map;for(let e of n)v.set(e.key,e);let y=t;if(m){let e=f?.[m];if(!e)return _([]);y=y.filter(t=>e.has(t.pid))}if(r.length){if(Ff(r)){let e=If(r),t=y,n=pne(r,e.length?t.filter(t=>Xf(e,l,t,v,h)):t,v);h.rankSets=n.sets,g=n.unanswerable}else h.rankSets=Nf.sets;let e=new Set(c);y=y.filter(t=>e.has(t.pid)||Xf(r,l,t,v,h))}let b=i.trim().toLowerCase();if(b&&(y=y.filter(e=>hne(b,e,n))),a.length&&(y=[...y].sort(vne(a,v))),!o)return _(y);let x=yne(y,o,s,n),S=new Map;return x.forEach((e,t)=>{e.kind===`data`&&!S.has(e.record.pid)&&S.set(e.record.pid,t)}),{visibleRows:x,pidToIndex:S,unresolvedRank:g}}function bne(e,t,n,r,i,a,o,s=[],c=`and`,l=!1,u,d,f,p){return(0,L.useMemo)(()=>Zf({rawRows:e,fields:t,filters:n,search:r,sorts:i,groupBy:a,collapsed:o,memberPids:s,filterConj:c,serverWindowed:l,measureSets:u,cohortSets:d,today:f,cohortLock:p}),[e,t,n,c,r,i,a,o,s,l,u,d,f,p])}var Qf=[{bg:`#EDF3FD`,fg:`#4F6079`},{bg:`#EBF6EF`,fg:`#35754E`},{bg:`#FBF4E0`,fg:`#7E6428`},{bg:`#FCEEEC`,fg:`#A3453C`},{bg:`#F1EEFB`,fg:`#6B57A8`},{bg:`#EEF1F4`,fg:`#4B5563`}];function $f(e){if(!(typeof e!=`string`||!/^#[0-9a-f]{6}$/i.test(e.trim())))return e.trim().toUpperCase()}var ep=`#182230`,tp=[{id:`blue-tint`,hue:`blue`,strength:`tint`,bg:`#EDF3FD`,fg:`#4F6079`,label:`Light blue`},{id:`green-tint`,hue:`green`,strength:`tint`,bg:`#EBF6EF`,fg:`#35754E`,label:`Light green`},{id:`yellow-tint`,hue:`yellow`,strength:`tint`,bg:`#FBF4E0`,fg:`#7E6428`,label:`Light yellow`},{id:`red-tint`,hue:`red`,strength:`tint`,bg:`#FCEEEC`,fg:`#A3453C`,label:`Light red`},{id:`purple-tint`,hue:`purple`,strength:`tint`,bg:`#F1EEFB`,fg:`#6B57A8`,label:`Light purple`},{id:`blue-pastel`,hue:`blue`,strength:`pastel`,bg:`#9DBFF2`,fg:ep,label:`Blue`},{id:`green-pastel`,hue:`green`,strength:`pastel`,bg:`#A5D8B4`,fg:ep,label:`Green`},{id:`yellow-pastel`,hue:`yellow`,strength:`pastel`,bg:`#F5D989`,fg:ep,label:`Yellow`},{id:`red-pastel`,hue:`red`,strength:`pastel`,bg:`#F0A8A0`,fg:ep,label:`Red`},{id:`purple-pastel`,hue:`purple`,strength:`pastel`,bg:`#C3B3EE`,fg:ep,label:`Purple`}];function np(e){let t=$f(e);if(!t)return;let n=ip(t,1),r=ip(t,3),i=ip(t,5),a=tp[0],o=1/0;for(let e of tp){let t=n-ip(e.bg,1),s=r-ip(e.bg,3),c=i-ip(e.bg,5),l=(n+ip(e.bg,1))/2,u=(2+l/256)*t*t+4*s*s+(2+(255-l)/256)*c*c;u>>0;return Qf[t%Qf.length]}function Sne(e,t){let n=e.optionColors;if(!n)return;let r=$f(n[t]);if(r)return r;let i=t.trim().toLowerCase();for(let[e,t]of Object.entries(n))if(e.trim().toLowerCase()===i)return $f(t)}function ip(e,t){return Number.parseInt(e.slice(t,t+2),16)}function ap(e){let t=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(ip(e,1))+.7152*t(ip(e,3))+.0722*t(ip(e,5))}function Cne(e){let t=ap($f(e)??`#FFFFFF`),n=ap(`#182230`),r=ap(`#FFFFFF`);return(t+.05)/(n+.05)>=(r+.05)/(t+.05)?`#182230`:`#FFFFFF`}function op(e,t){if(!t||e.colorCodeOptions===!1)return;let n=Sne(e,t);return n?xne(n):rp(t)}function sp(e){return rp(e).bg}function cp(e){let t=e.split(`@`)[0].trim().split(/[\s._]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function wne(e){return Math.max(14,Math.min(22,e-6))}function Tne(e,t){return{data:{kind:`aios-user`,name:e,photo:t?.[e]},copyData:e}}function lp(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function up(e){return e===`1`||e===1||e===!0}function dp(e,t){if(t?.abbrev&&Math.abs(e)>=1e3){let t=Math.abs(e),[n,r]=t>=1e9?[1e9,`B`]:t>=1e6?[1e6,`M`]:[1e3,`k`];return(e/n).toFixed(1)+r}let n=t&&Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=4?t.decimals:null,r=t?.thousands!==!1;return n==null?r?e.toLocaleString():String(e):r?e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n}):e.toFixed(n)}function Ene(e){let t=e.includes(` `)?e.replace(` `,`T`):e,n=/T\d{2}:\d{2}/.test(t)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(t)?t+`Z`:t,r=new Date(n);return Number.isNaN(r.getTime())?null:r}function fp(e,t){if(t==null||t===``)return``;let n=String(t),r=Ene(n);if(!r)return n;let i=e.format,a=i?.time??e.type===`created_time`,o=i?.tz===`utc`?{timeZone:`UTC`}:void 0;return a?r.toLocaleString(void 0,o):r.toLocaleDateString(void 0,o)}function pp(e,t){switch(e.type){case`currency`:return t==null||t===``?``:`$`+dp(lp(t),e.format);case`int`:case`formula`:return t==null||t===``?``:dp(lp(t),e.format);case`pct`:return t==null||t===``?``:lp(t).toFixed(1)+`%`;case`date`:case`created_time`:return fp(e,t);case`checkbox`:return up(t)?`Checked`:``;case`rating`:{let n=lp(t);return n>=1?`${Math.round(n)} of ${Dd(e)}`:``}case`multiselect`:return String(t??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``).join(`, `);default:return String(t??``)}}ct();function Dne(e,t,n,r,i){e.beginPath();for(let i=0;i<10;i+=1){let a=Math.PI/5*i-Math.PI/2,o=i%2==0?r:r*.45,s=t+Math.cos(a)*o,c=n+Math.sin(a)*o;i===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),i?(e.fillStyle=`#A98A3E`,e.fill()):(e.strokeStyle=`rgba(118, 143, 182, 0.55)`,e.lineWidth=1,e.stroke())}var mp=new Map,hp;function gp(e){hp=e}function One(e){let t=mp.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return mp.set(e,null),null;let n=new Image;return mp.set(e,n),n.onload=()=>hp?.(),n.onerror=()=>{mp.set(e,null),hp?.()},n.src=e,n}function kne(e,t,n,r,i,a,o){let s=a?One(a):null;if(s&&s.complete&&s.naturalWidth>0){e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.clip();let i=Math.max(r*2/s.naturalWidth,r*2/s.naturalHeight),a=s.naturalWidth*i,o=s.naturalHeight*i;e.drawImage(s,t-a/2,n-o/2,a,o),e.restore();return}let c=rp(i);e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fillStyle=c.bg,e.fill(),e.fillStyle=c.fg,e.font=`600 ${Math.round(r*.9)}px ${o}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(cp(i),t,n+.5),e.restore()}var Ane={kind:I.Custom,isMatch:e=>e.data?.kind===`aios-user`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{name:a,photo:o}=t.data;if(!a)return!0;let s=wne(r.height),c=r.x+i.cellHorizontalPadding+s/2,l=r.y+r.height/2;return c+s/2>r.x+r.width-i.cellHorizontalPadding||kne(n,c,l,s/2,a,o,i.fontFamily),!0}},jne={kind:I.Custom,isMatch:e=>e.data?.kind===`aios-rating`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{value:a,max:o}=t.data,s=r.y+r.height/2,c=r.x+i.cellHorizontalPadding+13/2,l=r.x+r.width-i.cellHorizontalPadding;for(let e=0;el);e+=1)Dne(n,c,s,13/2,ee.trim()).filter(e=>e!==``),r=n.length?op(e,n[0]):void 0;return{kind:I.Bubble,data:n,allowOverlay:!1,themeOverride:r?{bgBubble:r.bg,textBubble:r.fg}:void 0}}default:return{kind:I.Text,data:String(t??``),displayData:String(t??``),...i}}}ct();var _p={kind:I.Text,data:``,displayData:``,allowOverlay:!1};function Nne(e,t,n,r,i){let a=e.collapsed?`▶`:`▼`,o=e.count.toLocaleString(),s=`${a} ${e.label} (${o})`,c=i?Yte(a,e.label,o,r,i):s;return{kind:I.Text,data:s,displayData:t===0?c:``,allowOverlay:!1,span:[0,Math.max(0,n-1)],themeOverride:{bgCell:`#eef0f3`,bgCellMedium:`#eef0f3`,textDark:`#33333d`,baseFontStyle:Ef}}}function Pne(e,t){let n=t?e.aggs[t.key]:void 0;return{kind:I.Text,data:n??``,displayData:n??``,contentAlign:`right`,allowOverlay:!1,themeOverride:{bgCell:`#f6f7f9`,bgCellMedium:`#f6f7f9`,textDark:`#4a4a55`,baseFontStyle:`600 12px`}}}function Fne(e,t,n,r,i,a,o=0,s=null,c){return(0,L.useCallback)(([o,l])=>{let u=e[l];if(!u)return _p;let d=t[o],f=d?n.get(d.id):void 0;return u.kind===`group-header`?Nne(u,o,t.length,s,c):u.kind===`group-footer`?Pne(u,f):f?Mne(f,r[u.record.pid]?.[f.key]??u.record[f.key],i(f),a):_p},[e,t,n,r,i,a,o,s,c])}ct();function Ine(e,t,n){let[r,i]=(0,L.useState)(new Set),[a,o]=(0,L.useState)(void 0),s=(0,L.useRef)(null);return(0,L.useEffect)(()=>{o(e=>{if(!e)return e;let n=s.current,r=n==null?void 0:t.get(n);if(r!==void 0)return r===e.cell[1]?e:{cell:[e.cell[0],r],range:{x:e.cell[0],y:r,width:1,height:1},rangeStack:[]}})},[e,t]),{gridSelection:(0,L.useMemo)(()=>{let i=st.empty();for(let e of r){let n=t.get(e);n!==void 0&&(i=i.add(n))}return{current:a&&a.cell[1]{o(t.current);let n=t.current?e[t.current.cell[1]]:void 0;s.current=n&&n.kind===`data`?n.record.pid:null;let r=new Set;for(let n of t.rows){let t=e[n];t&&t.kind===`data`&&r.add(t.record.pid)}i(r)},[e]),selectPids:(0,L.useCallback)((e,t)=>{i(n=>{let r=t===`add`?new Set(n):new Set;for(let t of e)r.add(t);return r})},[]),togglePid:(0,L.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setActiveCell:(0,L.useCallback)((t,n)=>{let r=e[n];s.current=r&&r.kind===`data`?r.record.pid:null,o({cell:[t,n],range:{x:t,y:n,width:1,height:1},rangeStack:[]})},[e]),clearSelection:(0,L.useCallback)(()=>{i(new Set),o(void 0),s.current=null},[])}}var vp=[{key:`filters`,label:`Filter conditions`,blurb:`Which records the view shows, and how the conditions combine.`},{key:`sorts`,label:`Sorts`,blurb:`The order records are listed in.`},{key:`groupBy`,label:`Groups`,blurb:`The field records are bucketed by.`},{key:`visible`,label:`Hidden fields`,blurb:`Which columns are shown.`},{key:`order`,label:`Field order`,blurb:`Left-to-right column order.`},{key:`rowHeightMode`,label:`Row height`,blurb:`Short, medium or tall rows.`}],yp=vp.map(e=>e.key);function Lne(e){return typeof e==`string`&&yp.includes(e)}function bp(e){return JSON.parse(JSON.stringify(e))}function Rne(e,t,n){let r={};if(!e)return r;let i=new Set;for(let e of t)Lne(e)&&i.add(e);if(i.size===0)return r;if(i.has(`filters`)&&(r.filters=bp(Array.isArray(e.filters)?e.filters:[]),r.filterConj=e.filterConj),i.has(`sorts`)&&(r.sorts=bp(Array.isArray(e.sorts)?e.sorts:[])),i.has(`groupBy`)&&(r.groupBy=e.groupBy??null),i.has(`visible`)){let t=bp(Array.isArray(e.visible)?e.visible:[]);r.visible=n&&!t.includes(n)?[n,...t]:t}return i.has(`order`)&&(r.order=bp(Array.isArray(e.order)?e.order:[])),i.has(`rowHeightMode`)&&e.rowHeightMode&&(r.rowHeightMode=e.rowHeightMode),r}var zne=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),xp=s(((e,t)=>{t.exports=zne()})),Bne=g(),B=xp(),Sp=(0,L.createContext)(null),Vne=[`[data-overlay-autofocus]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[href]`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Hne({children:e}){let t=(0,L.useRef)([]),n=(0,L.useMemo)(()=>({register:e=>(t.current=[...t.current.filter(t=>t!==e),e],()=>{t.current=t.current.filter(t=>t!==e)}),isTop:e=>t.current.at(-1)===e}),[]);return(0,B.jsx)(Sp.Provider,{value:n,children:e})}function Une(e){if(`getBoundingClientRect`in e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}return e}function Wne(e,t){return e.left===t.left&&e.top===t.top&&e.maxWidth===t.maxWidth&&e.maxHeight===t.maxHeight&&e.visibility===t.visibility}function Gne({panelRef:e,onDismiss:t,dismissOnOutside:n=!0,initialFocus:r=`first`,restoreFocus:i=!0,trapFocus:a=!1,outsideElements:o=[]}){let s=(0,L.useId)(),c=(0,L.useContext)(Sp),l=(0,L.useRef)(t),u=(0,L.useRef)(o);l.current=t,u.current=o,(0,L.useEffect)(()=>c?.register(s),[s,c]),(0,L.useEffect)(()=>{let t=t=>{if(!n||c&&!c.isTop(s))return;let r=t.target;!r||e.current?.contains(r)||u.current.some(e=>e?.contains(r))||(document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current())},r=t=>{if(c&&!c.isTop(s))return;if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current();return}if(t.key!==`Tab`||!a)return;let n=Array.from(e.current?.querySelectorAll(Vne)??[]).filter(e=>e.getClientRects().length>0);if(!n.length){t.preventDefault(),e.current?.focus();return}let r=n[0],i=n.at(-1),o=document.activeElement;t.shiftKey&&(o===r||!e.current?.contains(o))?(t.preventDefault(),i.focus()):!t.shiftKey&&o===i&&(t.preventDefault(),r.focus())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,r,!0)}},[n,s,e,c,a]),(0,L.useLayoutEffect)(()=>{let t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=window.requestAnimationFrame(()=>{if(r===`none`)return;let t=r===`first`?Vne:r;(e.current?.querySelector(t))?.focus({preventScroll:!0})});return()=>{window.cancelAnimationFrame(n),i&&t?.isConnected&&t.focus({preventScroll:!0})}},[r,e,i])}function Kne({children:e}){return(0,Bne.createPortal)(e,document.body)}function Cp({anchor:e,className:t,children:n,onDismiss:r,placement:i=`bottom-start`,role:a,ariaLabel:o,id:s,initialFocus:c=`first`,restoreFocus:l=!0,dismissOnOutside:u=!0,onKeyDown:d,dataKind:f}){let p=(0,L.useRef)(null),[m,h]=(0,L.useState)({position:`fixed`,left:0,top:0,visibility:`hidden`}),g=`getBoundingClientRect`in e?e:null;Gne({panelRef:p,onDismiss:r,dismissOnOutside:u,initialFocus:c,restoreFocus:l,outsideElements:[g]});let _=(0,L.useCallback)(()=>{let t=p.current;if(!t)return;let n=Une(e),r=window.visualViewport,a=r?.offsetLeft??0,o=r?.offsetTop??0,s=r?.width??window.innerWidth,c=r?.height??window.innerHeight,l=t.getBoundingClientRect(),u=Qte({placement:i,target:n,panel:{width:Math.max(l.width,t.scrollWidth),height:Math.max(l.height,t.scrollHeight)},viewport:{left:a,top:o,width:s,height:c}}),d={position:`fixed`,left:u.left,top:u.top,maxWidth:u.maxWidth,maxHeight:u.maxHeight,visibility:`visible`};h(e=>Wne(e,d)?e:d)},[e,i]);return(0,L.useLayoutEffect)(()=>{_();let e=window.requestAnimationFrame(_),t=new ResizeObserver(_);return p.current&&t.observe(p.current),g&&t.observe(g),window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),window.visualViewport?.addEventListener(`resize`,_),window.visualViewport?.addEventListener(`scroll`,_),()=>{window.cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0),window.visualViewport?.removeEventListener(`resize`,_),window.visualViewport?.removeEventListener(`scroll`,_)}},[g,_]),(0,B.jsx)(Kne,{children:(0,B.jsx)(`div`,{ref:p,id:s,className:t,style:m,role:a,"aria-label":o,"data-overlay-kind":f,onKeyDown:d,children:n})})}function qne({shapes:e}){return(0,B.jsx)(B.Fragment,{children:e.map((e,t)=>e.fill?(0,B.jsx)(`path`,{d:e.d,fill:`currentColor`},t):(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function wp({type:e,size:t=14,title:n}){return(0,B.jsxs)(`svg`,{className:`cg-type-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!n||void 0,role:n?`img`:void 0,"aria-label":n,children:[n&&(0,B.jsx)(`title`,{children:n}),(0,B.jsx)(qne,{shapes:gf[e===`measure`?`currency`:e]})]})}function Tp({mode:e,size:t=14}){return(0,B.jsx)(`svg`,{className:`cg-mode-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,B.jsx)(qne,{shapes:_f[e]})})}function Jne({mode:e,tone:t,size:n=15}){let r=vf[t];return(0,B.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:n,height:n,viewBox:`0 0 16 16`,"aria-hidden":!0,children:_f[e].map((e,t)=>e.fill?(0,B.jsx)(`path`,{d:e.d,fill:r.stroke},t):(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Yne({kind:e,size:t=15}){let n=vf[Hte[e]];return(0,B.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Vte[e].map((t,r)=>(0,B.jsx)(`path`,{d:t.d,fill:r===0&&(e===`area`||e===`donut`||e===`kpi`)?n.fill:`none`,stroke:n.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},r))})}var Xne={width:16,height:16,viewBox:`0 0 16 16`,fill:`none`},Ep={stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`},Zne={duplicate:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`5.5`,y:`5.5`,width:`8`,height:`8`,rx:`1.5`,...Ep}),(0,B.jsx)(`path`,{d:`M10.5 2.5h-7a1 1 0 0 0-1 1v7`,...Ep})]}),insertLeft:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`3`,y1:`2.5`,x2:`3`,y2:`13.5`,...Ep}),(0,B.jsx)(`path`,{d:`M13.5 8H6.5M9.2 5.3 6.5 8l2.7 2.7`,...Ep})]}),insertRight:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`13`,y1:`2.5`,x2:`13`,y2:`13.5`,...Ep}),(0,B.jsx)(`path`,{d:`M2.5 8h7M6.8 5.3 9.5 8l-2.7 2.7`,...Ep})]}),addEnd:(0,B.jsx)(`path`,{d:`M8 3v10M3 8h10`,...Ep}),rename:(0,B.jsx)(`path`,{d:`m9.8 3.2 3 3L6.2 12.8l-3.6.6.6-3.6 6.6-6.6Z`,...Ep}),description:(0,B.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h6`,...Ep}),permissions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...Ep}),(0,B.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0V7`,...Ep})]}),unlock:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...Ep}),(0,B.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0`,...Ep})]}),format:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M3 5h5.5M12.5 5H13M3 11h1M7 11h6`,...Ep}),(0,B.jsx)(`circle`,{cx:`10.5`,cy:`5`,r:`1.6`,...Ep}),(0,B.jsx)(`circle`,{cx:`4.9`,cy:`11`,r:`1.6`,...Ep})]}),swap:(0,B.jsx)(`path`,{d:`M3.5 6h9M10.2 3.7 12.5 6l-2.3 2.3M12.5 10.5h-9M5.8 8.2 3.5 10.5l2.3 2.3`,...Ep}),sortAsc:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...Ep}),(0,B.jsx)(`path`,{d:`M8.5 4.5h2M8.5 8h3.5M8.5 11.5h5`,...Ep})]}),sortDesc:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...Ep}),(0,B.jsx)(`path`,{d:`M8.5 4.5h5M8.5 8h3.5M8.5 11.5h2`,...Ep})]}),off:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,...Ep}),(0,B.jsx)(`line`,{x1:`4.4`,y1:`11.6`,x2:`11.6`,y2:`4.4`,...Ep})]}),filter:(0,B.jsx)(`path`,{d:`M2.5 3.5h11L9.5 8.5v3.8L6.5 14V8.5L2.5 3.5Z`,...Ep}),group:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...Ep}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...Ep}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...Ep})]}),pin:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...Ep}),(0,B.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...Ep})]}),unpin:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...Ep}),(0,B.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...Ep}),(0,B.jsx)(`line`,{x1:`3`,y1:`13`,x2:`13`,y2:`3`,...Ep})]}),hide:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,...Ep}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.5`,...Ep}),(0,B.jsx)(`line`,{x1:`3.5`,y1:`12.5`,x2:`12.5`,y2:`3.5`,...Ep})]}),trash:(0,B.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,...Ep}),download:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M8 2.5v7M5.3 6.8 8 9.5l2.7-2.7`,...Ep}),(0,B.jsx)(`path`,{d:`M3 11v1.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V11`,...Ep})]}),cohortAdd:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M2.5 4h7M2.5 7.5h5M2.5 11h4`,...Ep}),(0,B.jsx)(`path`,{d:`M11.5 8.5v5M9 11h5`,...Ep})]})};function Qne({name:e}){return(0,B.jsx)(`svg`,{...Xne,"aria-hidden":!0,children:Zne[e]})}function Dp({icon:e,text:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:typeof e==`string`?(0,B.jsx)(Qne,{name:e}):e}),(0,B.jsx)(`span`,{className:`cg-mi-text`,children:t})]})}function $ne({size:e=14}){return(0,B.jsxs)(`svg`,{className:`cg-eyeoff-icon`,width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M9.6 8a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M3.3 12.7 12.7 3.3`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`})]})}function ere({size:e=11}){return(0,B.jsxs)(`svg`,{className:`cg-lock-mark`,width:e,height:e,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M4.2 7.2h7.6v5.6H4.2z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M5.9 7.2V5.5a2.1 2.1 0 0 1 4.2 0v1.7`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`})]})}function Op({icon:e,size:t=14}){let n=e?.shape??`folder`,r=vf[e?.tone??`neutral`];return(0,B.jsx)(`svg`,{className:`cg-folder-mark`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Ute[n].map((e,t)=>(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function tre({item:e}){return e.icon?(0,B.jsx)(B.Fragment,{children:e.icon}):e.type?(0,B.jsx)(wp,{type:e.type,title:e.type===`measure`?`Metric`:wf[e.type]}):(0,B.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0})}function nre(){return(0,B.jsx)(`svg`,{className:`cg-fsel-caret`,width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`})})}function rre(){return(0,B.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`})})}var ire=8;function kp({fields:e,value:t,onChange:n,placeholder:r=`Choose a field…`,allow:i,ariaLabel:a,className:o,disabled:s,title:c,keepOpen:l,overlayAutofocus:u}){let[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``),h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=(0,L.useMemo)(()=>i?e.filter(e=>e.type!=null&&i.includes(e.type)):e,[e,i]),v=t!=null,y=v?e.find(e=>e.key===t):void 0,b=p.trim().toLowerCase(),x=b?_.filter(e=>e.label.toLowerCase().includes(b)):_,S=()=>{f(!1),m(``)},C=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(g.current?.querySelectorAll(`button.cg-type-row`)??[]).filter(e=>!e.disabled);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);if(e.key===`Home`)return t[0].focus();if(e.key===`End`)return t[t.length-1].focus();let r=e.key===`ArrowDown`?1:-1;t[n<0?r===1?0:t.length-1:(n+r+t.length)%t.length].focus()},w;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{ref:h,type:`button`,disabled:s,className:`cg-select cg-fsel`+(y?``:v&&t!==``?` is-missing`:` is-empty`)+(o?` ${o}`:``),"aria-label":a,"aria-haspopup":`listbox`,"aria-expanded":d,"data-overlay-autofocus":u?!0:void 0,onClick:()=>f(e=>!e),children:[y?(0,B.jsx)(tre,{item:y}):(0,B.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`cg-fsel-label`,children:y?.label??(v&&t!==``?t:r)}),(0,B.jsx)(nre,{})]}),d&&h.current&&(0,B.jsx)(Cp,{anchor:h.current,className:`cg-pop cg-fsel-pop`,onDismiss:S,role:`dialog`,ariaLabel:a??c??`Choose a field`,initialFocus:_.length>=ire?`.cg-fsel-search input`:`button.cg-type-row`,dataKind:`field-select`,children:(0,B.jsxs)(`div`,{className:`cg-fsel-body`,onKeyDown:C,children:[c&&(0,B.jsx)(`div`,{className:`cg-pop-title`,children:c}),_.length>=ire&&(0,B.jsxs)(`div`,{className:`cg-type-search cg-fsel-search`,children:[(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,B.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,B.jsx)(`input`,{type:`text`,value:p,placeholder:`Find a field…`,"aria-label":`Find a field`,onChange:e=>m(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,ref:g,"aria-label":a??c??`Fields`,children:[x.map(e=>{let r=e.group&&e.group!==w?e.group:null;return w=e.group,(0,B.jsxs)(L.Fragment,{children:[r&&(0,B.jsx)(`div`,{className:`cg-fsel-group`,role:`presentation`,children:r}),(0,B.jsxs)(`button`,{type:`button`,role:`option`,disabled:e.disabled,"aria-selected":e.key===t,className:`cg-type-row`+(e.key===t?` is-on`:``),onClick:()=>{n(e.key),l?m(``):S()},children:[(0,B.jsx)(tre,{item:e}),(0,B.jsxs)(`span`,{className:`cg-type-label`,children:[e.label,e.hint&&(0,B.jsx)(`span`,{className:`cg-fsel-hint`,children:e.hint})]}),e.key===t&&(0,B.jsx)(rre,{})]})]},e.key)}),x.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:_.length===0?`No field to choose here.`:`No field matches.`})]})]})})]})}function Ap(e,t){let n=e=>e.toLocaleString();if(!t?.windowed)return`${n(e)} ${e===1?`record`:`records`}`;let r=t.matched===1?`record`:`records`,i=t.matched=t.matched?`${n(t.matched)} ${r}${i}`:`showing ${n(t.shown)} of ${n(t.matched)} ${r}${i}`}function are(e){if(!e?.partial)return null;let t=typeof e.loaded==`number`&&Number.isFinite(e.loaded)&&e.loaded>=0?Math.floor(e.loaded):0,n=typeof e.total==`number`&&Number.isFinite(e.total)&&e.total>0?Math.floor(e.total).toLocaleString():`…`;return`${t.toLocaleString()} of ${n}`}function ore(e,t){if(!t?.windowed)return Ap(e,t);let n=e=>e.toLocaleString();return t.shown>=t.matched?`${n(t.matched)} ${t.matched===1?`record`:`records`}`:`showing ${n(t.shown)} of ${n(t.matched)}`}var jp=Nd,Mp=Pd;function Np(e){return e===`checkbox`?[`isNotEmpty`,`isEmpty`]:jp(e)?[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`,`between`,`isEmpty`,`isNotEmpty`]:Mp(e)?[`eq`,`within`,`lt`,`gt`,`lte`,`gte`,`neq`,`isEmpty`,`isNotEmpty`]:e===`status`||e===`select`||e===`user`?[`eq`,`neq`,`isEmpty`,`isNotEmpty`]:[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`]}var sre={topN:`top N`,bottomN:`bottom N`,inTopPct:`top N%`,inBottomPct:`bottom N%`,aboveAvg:`above average`,belowAvg:`below average`,inQuartile:`in quartile`,inDecile:`in decile`};function cre(e){switch(e){case`topN`:case`bottomN`:case`inTopPct`:case`inBottomPct`:case`inDecile`:return`10`;case`inQuartile`:return`4`;default:return``}}function lre(e){for(let t of e??[]){if(Yd(t)){if(lre(t.children))return!0;continue}if(Rd(t.op)&&!Jd(t))return!0}return!1}function ure(e,t){if(Rd(e))return sre[e]??e;if(t===`checkbox`){if(e===`isNotEmpty`)return`is checked`;if(e===`isEmpty`)return`is unchecked`}if(e===`isEmpty`)return`is empty`;if(e===`isNotEmpty`)return`is not empty`;if(Mp(t))switch(e){case`eq`:return`is`;case`neq`:return`is not`;case`within`:return`is within`;case`lt`:return`is before`;case`lte`:return`is on or before`;case`gt`:return`is after`;case`gte`:return`is on or after`;case`between`:return`is between`}if(jp(t))switch(e){case`gte`:return`≥`;case`gt`:return`>`;case`lte`:return`≤`;case`lt`:return`<`;case`eq`:return`=`;case`neq`:return`≠`;case`between`:return`is between`;default:return e}if(t===`multiselect`)switch(e){case`contains`:return`has`;case`doesNotContain`:return`does not have`;case`eq`:return`is exactly`;case`neq`:return`is not exactly`;default:return e}switch(e){case`contains`:return`contains`;case`doesNotContain`:return`does not contain`;case`eq`:return`is`;case`neq`:return`is not`;default:return e}}function dre(e,t){return t&&!e.includes(t)?[...e,t]:[...e]}function fre(e){return e===`or`?`Any of the following are true…`:`All of the following are true…`}var Pp=[...Uee],Fp=[...Wee],pre=[...Hd];function mre(e){switch(Ud(e)){case`allOf`:return`is all of`;case`noneOf`:return`is none of`;default:return`is any of`}}var hre=`measure`,Ip={kind:`ltm`},gre={kind:`past_month`},_re=[`last_n_days`,`past_week`,`past_month`,`past_year`,`this_week`,`this_month`,`this_year`,`custom`];function vre(e,t,n,r,i){let a=e.map(e=>({key:e.key,label:e.label,type:e.type})),o=new Set(a.map(e=>e.key));if(!t||o.has(t)||r.has(t)||t===`__cohort__`&&i)return a;let s=n.get(t);return a.push({key:t,label:s?s.label:t,type:s?.type}),a}var yre=0;function bre(){return yre+=1,`r${Date.now().toString(36)}${yre.toString(36)}`}function xre(e){let t=e[0];return t?{colId:t.key,op:Np(t.type)[0],value:``}:null}function Sre(e){let t=0;for(let n of e)t+=Yd(n)?Sre(n.children):1;return t}var Lp={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`},Rp={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function Cre(){return(0,B.jsxs)(`svg`,{...Lp,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`,...Rp}),(0,B.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`,...Rp}),(0,B.jsx)(`line`,{x1:`10.5`,y1:`3`,x2:`10.5`,y2:`13`,...Rp})]})}function wre(){return(0,B.jsx)(`svg`,{...Lp,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M2.5 4h11L9.5 9v3.5L6.5 14V9L2.5 4Z`,...Rp})})}function Tre(){return(0,B.jsxs)(`svg`,{...Lp,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M5 3v10M5 13l-2-2M5 13l2-2`,...Rp}),(0,B.jsx)(`path`,{d:`M11 13V3M11 3l-2 2M11 3l2 2`,...Rp})]})}function Ere(){return(0,B.jsx)(`svg`,{...Lp,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M8 2s4.5 4.2 4.5 7a4.5 4.5 0 0 1-9 0C3.5 6.2 8 2 8 2Z`,...Rp})})}function Dre(){return(0,B.jsxs)(`svg`,{...Lp,"aria-hidden":!0,children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`5`,x2:`13.5`,y2:`5`,...Rp}),(0,B.jsx)(`line`,{x1:`2.5`,y1:`8`,x2:`13.5`,y2:`8`,...Rp}),(0,B.jsx)(`line`,{x1:`2.5`,y1:`11`,x2:`13.5`,y2:`11`,...Rp})]})}function Ore(){return(0,B.jsxs)(`svg`,{...Lp,"aria-hidden":!0,children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...Rp}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...Rp}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...Rp})]})}function kre(){return(0,B.jsxs)(`svg`,{...Lp,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,...Rp}),(0,B.jsx)(`line`,{x1:`10.2`,y1:`10.2`,x2:`13.5`,y2:`13.5`,...Rp})]})}var Are={filters:(0,B.jsx)(wre,{}),sorts:(0,B.jsx)(Tre,{}),groupBy:(0,B.jsx)(Ore,{}),visible:(0,B.jsx)($ne,{}),order:(0,B.jsx)(Cre,{}),rowHeightMode:(0,B.jsx)(Dre,{})};function jre(){return(0,B.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M4 6l4 4 4-4`,...Rp})})}function zp({label:e,icon:t,active:n,tone:r,wide:i,measureWide:a,pairWide:o,forceOpenSignal:s,children:c}){let[l,u]=(0,L.useState)(!1),d=(0,L.useRef)(null),f=(0,L.useId)();return(0,L.useEffect)(()=>{s&&s>0&&u(!0)},[s]),(0,B.jsxs)(`div`,{className:`cg-pop-wrap`,children:[(0,B.jsxs)(`button`,{ref:d,type:`button`,className:`cg-tb-btn`+(r?` cg-tb-btn--${r}`:``)+(n||l?` is-active`:``),onClick:()=>u(e=>!e),"aria-expanded":l,"aria-haspopup":`dialog`,"aria-controls":l?f:void 0,children:[t,(0,B.jsx)(`span`,{children:e}),(0,B.jsx)(jre,{})]}),l&&d.current&&(0,B.jsx)(Cp,{anchor:d.current,className:`cg-pop`+(i?` cg-pop--wide`:``)+(a?` cg-pop--measures`:``)+(o?` cg-pop--pair`:``),onDismiss:()=>u(!1),role:`dialog`,ariaLabel:`${e} options`,id:f,dataKind:`toolbar-${e.split(` `)[0].toLowerCase()}`,children:c(()=>u(!1))})]})}function Mre({rule:e,onPatch:t}){let n=e.dateMode??`exact`;return(0,B.jsxs)(`span`,{className:`cg-cond-anchor`,children:[(0,B.jsx)(`select`,{className:`cg-select cg-cond-anchor-mode`,value:n,"aria-label":`Date`,onChange:e=>{let n=e.target.value;t({dateMode:n,value:``})},children:sd.map(e=>(0,B.jsx)(`option`,{value:e,children:e===`n_days_ago`?cd[e].replace(`{n}`,`N`):cd[e]},e))}),n===`n_days_ago`&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:0,max:3650,"aria-label":`Number of days ago`,value:e.value,onChange:e=>t({value:e.target.value})}),n===`exact`&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`date`,"aria-label":`Date`,value:e.value,onChange:e=>t({value:e.target.value})})]})}function Nre({rule:e,options:t,isMeasure:n,onPatch:r}){let i=e.rhs,a=Kd(i)??``;return(0,B.jsxs)(`span`,{className:`cg-cond-rhs`,children:[(0,B.jsx)(kp,{className:`cg-cond-field`,ariaLabel:`Compare with field`,placeholder:`Select a field…`,value:a||void 0,fields:t,onChange:e=>{r({rhs:n?{kind:`measure`,colId:e,window:i?.kind===`measure`&&i.window||Ip}:{kind:`field`,colId:e}})}}),n&&a!==``&&(0,B.jsx)(Bp,{window:i?.kind===`measure`&&i.window||Ip,onWindow:e=>r({rhs:{kind:`measure`,colId:a,window:e}})})]})}function Pre({rule:e,type:t,statusOptions:n,onValue:r,onValue2:i}){if(e.op===`between`){let n=t===`date`||t===`created_time`?`date`:`number`;return(0,B.jsxs)(`span`,{className:`cg-cond-between`,children:[(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value,onChange:e=>r(e.target.value)}),(0,B.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value2??``,onChange:e=>i(e.target.value)})]})}return t===`status`||t===`select`||t===`user`||t===`multiselect`?(0,B.jsxs)(`select`,{className:`cg-select cg-cond-val`,value:e.value,onChange:e=>r(e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}):(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:t===`date`||t===`created_time`?`date`:jp(t)?`number`:`text`,placeholder:`Value`,value:e.value,onChange:e=>r(e.target.value)})}function Fre({rule:e,onValue:t}){let n=e.op===`inQuartile`?4:e.op===`inDecile`?10:0;if(n)return(0,B.jsx)(`select`,{className:`cg-select cg-cond-val`,value:e.value,"aria-label":e.op===`inQuartile`?`Quartile`:`Decile`,onChange:e=>t(e.target.value),children:Array.from({length:n},(e,t)=>String(t+1)).map(e=>(0,B.jsx)(`option`,{value:e,children:e===`1`?`${e} (lowest)`:e===String(n)?`${e} (highest)`:e},e))});let r=e.op===`inTopPct`||e.op===`inBottomPct`;return(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`number`,min:1,max:r?100:1e4,step:1,placeholder:`10`,"aria-label":r?`Percent`:`How many`,value:e.value,onChange:e=>t(e.target.value)})}function Ire({rule:e,lists:t,onPatch:n}){let r=Wd(e.value),i=new Map(t.map(e=>[e.id,e.name])),a=t.filter(e=>!r.includes(e.id)),o=a.length>0&&r.length<20,s=e=>n({value:e.join(`,`)});return(0,B.jsxs)(`span`,{className:`cg-cond-cohorts`,children:[r.map(e=>(0,B.jsxs)(`span`,{className:`cg-chip`+(i.has(e)?``:` cg-chip--gone`),children:[(0,B.jsx)(`span`,{className:`cg-chip-text`,children:i.get(e)??`(deleted list)`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-chip-x`,"aria-label":`Remove ${i.get(e)??e}`,onClick:()=>s(r.filter(t=>t!==e)),children:`×`})]},e)),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-val cg-cond-cohort-add`,value:``,"aria-label":`Cohort`,disabled:!o,onChange:e=>e.target.value&&s([...r,e.target.value]),children:[(0,B.jsx)(`option`,{value:``,children:o?r.length?`Add a cohort…`:`Select a cohort…`:`all added`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}function Bp({window:e,onWindow:t,kinds:n=id}){let r=e.kind;return(0,B.jsxs)(`span`,{className:`cg-cond-window`,children:[(0,B.jsx)(`select`,{className:`cg-select cg-cond-win-kind`,value:r,"aria-label":`Date window`,onChange:n=>{let r=n.target.value;ad.has(r)?t({kind:r,n:e.n??30}):t(r===`custom`?{kind:r,from:e.from??``,to:e.to??``}:{kind:r})},children:(n.includes(r)?n:[...n,r]).map(e=>(0,B.jsx)(`option`,{value:e,children:ad.has(e)?od[e].replace(`{n}`,`N`):od[e]},e))}),ad.has(r)&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:1,max:3650,"aria-label":`Number of days`,value:e.n??``,onChange:n=>t({...e,n:n.target.value===``?void 0:Number(n.target.value)})}),r===`custom`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window start`,value:e.from??``,onChange:n=>t({...e,from:n.target.value})}),(0,B.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window end`,value:e.to??``,onChange:n=>t({...e,to:n.target.value})})]})]})}function Lre({index:e,conj:t,onConj:n}){return e===0?(0,B.jsx)(`span`,{className:`cg-cond-prefix`,children:`Where`}):e===1?(0,B.jsxs)(`select`,{className:`cg-select cg-cond-conj`,value:t,"aria-label":`Combine conditions with`,onChange:e=>n(e.target.value),children:[(0,B.jsx)(`option`,{value:`and`,children:`and`}),(0,B.jsx)(`option`,{value:`or`,children:`or`})]}):(0,B.jsx)(`span`,{className:`cg-cond-prefix cg-cond-conj-echo`,children:t})}function Rre({nodes:e,conj:t,depth:n,fields:r,fieldByKey:i,measures:a,measureByKey:o,lists:s,statusValues:c,onNodes:l,onConj:u}){let[d,f]=(0,L.useState)(null),p=(t,n)=>l(e.map((e,r)=>r===t?n:e)),m=t=>l(e.filter((e,n)=>n!==t)),h=()=>{let t=xre(r);t&&l([...e,t])},g=()=>{let t=xre(r);t&&l([...e,{conj:`or`,children:[t]}])},_=n<3;return(0,B.jsxs)(B.Fragment,{children:[e.map((e,l)=>(0,B.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,B.jsx)(Lre,{index:l,conj:t,onConj:u}),Yd(e)?(0,B.jsx)(Bre,{group:e,depth:n+1,fields:r,fieldByKey:i,measures:a,measureByKey:o,lists:s,statusValues:c,onGroup:e=>p(l,e),onRemove:()=>m(l)}):(0,B.jsx)(zre,{rule:e,fields:r,fieldByKey:i,measures:a,measureByKey:o,lists:s,statusValues:c,onRule:e=>p(l,e),onRemove:()=>m(l)})]},l)),(0,B.jsxs)(`div`,{className:`cg-builder-add`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(d===`condition`?` is-on`:``),onClick:()=>{f(`condition`),h()},children:`+ Add condition`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(d===`group`?` is-on`:``),onClick:()=>{f(`group`),g()},disabled:!_,title:_?`Group conditions so they evaluate together`:`Condition groups can nest 3 levels deep`,children:`+ Add condition group`})]})]})}function zre({rule:e,fields:t,fieldByKey:n,measures:r,measureByKey:i,lists:a,statusValues:o,onRule:s,onRemove:c}){let l=Jd(e),u=e.colId===Bd,d=a.length>0,f=l?i.get(e.colId)?.type??`currency`:n.get(e.colId)?.type??`text`,p=t=>s({...e,...t}),m=t=>{if(t===`__cohort__`){s({colId:Bd,op:pre[0],value:``});return}if(i.get(t)){s({id:e.id??bre(),colId:t,op:Pp[0],value:``,value2:void 0,window:e.window??Ip});return}s({colId:t,op:Np(n.get(t)?.type??`text`)[0],value:``,value2:void 0})},h=t=>{if(u)return p({op:t});if(Rd(t))return s({...e,op:t,value:cre(t),value2:void 0,rhs:void 0,dateWindow:void 0});if(zd.has(t))return s({...e,op:t,value:``,value2:void 0,rhs:void 0});if(t===`within`)return s({...e,op:t,value:``,value2:void 0,rhs:void 0,dateWindow:e.dateWindow??gre});if(e.op===`within`)return s({...e,op:t,dateWindow:void 0,value:``});p({op:t})},g=l?r.map(e=>({key:e.key,label:e.label,type:hre})):t.filter(t=>t.key!==e.colId&&(jp(f)?jp(t.type):t.type===f)).map(e=>({key:e.key,label:e.label,type:e.type})),_=!u&&e.op!==`within`&&!zd.has(e.op)&&!Rd(e.op)&&g.length>0&&(l||jp(f)||Mp(f)),v=e.rhs?.kind===`stat`,y=e.rhs!=null&&!v,b=l?y||v?Fp:Pp:u?pre:Np(f),x=u?Ud(e.op):e.op,S=dre(!l&&!u&&jp(f)?[...b,...Ld]:b,x),C=S.filter(e=>!Rd(e)),w=S.filter(e=>Rd(e));return(0,B.jsxs)(`span`,{className:`cg-cond-row`+(l?` is-measure`:``)+(u?` is-cohort`:``)+(e.rhs==null?``:` has-rhs`),children:[(0,B.jsx)(kp,{className:`cg-cond-field`,ariaLabel:`Field`,value:e.colId,onChange:m,fields:[...vre(t,e.colId,n,i,d),...r.map(e=>({key:e.key,label:e.label,type:hre})),...d?[{key:Bd,label:`Cohort`,type:`multiselect`}]:[]]}),l&&(0,B.jsx)(Bp,{window:e.window??Ip,onWindow:e=>p({window:e})}),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:x,"aria-label":`Condition`,onChange:e=>h(e.target.value),children:[C.map(e=>(0,B.jsx)(`option`,{value:e,children:u?mre(e):ure(e,f)},e)),w.length>0&&(0,B.jsx)(`optgroup`,{label:`Ranked`,children:w.map(e=>(0,B.jsx)(`option`,{value:e,children:ure(e,f)},e))})]}),_&&(0,B.jsxs)(`select`,{className:`cg-select cg-cond-mode`,value:v?`stat`:y?`field`:`value`,"aria-label":`Compare against`,onChange:t=>{let n=t.target.value;if(n===`stat`)return p({rhs:{kind:`stat`,stat:`median`},value:``,value2:void 0,op:Fp.includes(e.op)?e.op:Fp[1]});if(n===`field`)return p({rhs:l?{kind:`measure`,colId:``,window:Ip}:{kind:`field`,colId:``},value:``,value2:void 0});p({rhs:void 0,value:``})},children:[(0,B.jsx)(`option`,{value:`value`,children:`a value`}),(0,B.jsx)(`option`,{value:`field`,children:`another field`}),l&&(0,B.jsx)(`option`,{value:`stat`,children:`a statistic`})]}),zd.has(e.op)?(0,B.jsx)(`span`,{className:`cg-cond-val cg-cond-noval`,"aria-hidden":!0}):v?(0,B.jsx)(`select`,{className:`cg-select cg-cond-val cg-cond-stat`,value:e.rhs?.kind===`stat`?e.rhs.stat:`median`,"aria-label":`Statistic`,onChange:e=>p({rhs:{kind:`stat`,stat:e.target.value}}),children:Gd.map(e=>(0,B.jsx)(`option`,{value:e,children:Vee[e]},e))}):y?(0,B.jsx)(Nre,{rule:e,options:g,isMeasure:l,onPatch:p}):u?(0,B.jsx)(Ire,{rule:e,lists:a,onPatch:p}):Rd(e.op)?(0,B.jsx)(Fre,{rule:e,onValue:e=>p({value:e})}):e.op===`within`?(0,B.jsx)(Bp,{window:e.dateWindow??gre,onWindow:e=>p({dateWindow:e}),kinds:_re}):Mp(f)?(0,B.jsx)(Mre,{rule:e,onPatch:p}):(0,B.jsx)(Pre,{rule:e,type:f,statusOptions:o[e.colId]??[],onValue:e=>p({value:e}),onValue2:e=>p({value2:e})}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition`,onClick:c,children:`×`})]})}function Bre({group:e,depth:t,fields:n,fieldByKey:r,measures:i,measureByKey:a,lists:o,statusValues:s,onGroup:c,onRemove:l}){return(0,B.jsxs)(`span`,{className:`cg-cond-group`,"data-depth":t,children:[(0,B.jsxs)(`span`,{className:`cg-cond-group-head`,children:[(0,B.jsx)(`span`,{className:`cg-cond-group-sum`,children:e.children.length?fre(e.conj):`Add a condition to this group…`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition group`,onClick:l,children:`×`})]}),(0,B.jsx)(`span`,{className:`cg-cond-group-body`,children:(0,B.jsx)(Rre,{nodes:e.children,conj:e.conj,depth:t,fields:n,fieldByKey:r,measures:i,measureByKey:a,lists:o,statusValues:s,onNodes:t=>c({...e,children:t}),onConj:t=>c({...e,conj:t})})})]})}function Vre({views:e,lockedKey:t,onApply:n,onClose:r}){let[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(()=>new Set([`filters`])),c=e.find(e=>e.id===i),l=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-copycfg`,children:[(0,B.jsxs)(`div`,{className:`cg-copycfg-head`,children:[(0,B.jsx)(`span`,{children:`Copy configuration from`}),(0,B.jsx)(kp,{className:`cg-copycfg-source`,ariaLabel:`View to copy from`,placeholder:`Choose a view…`,value:i||void 0,onChange:a,fields:e.map(e=>({key:e.id,label:e.name,icon:(0,B.jsx)(Tp,{mode:Zd(e)})}))}),(0,B.jsx)(`span`,{children:`to this view`})]}),(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Select what to copy. This view keeps everything else.`}),(0,B.jsx)(`div`,{className:`cg-pop-list`,children:vp.map(e=>(0,B.jsxs)(`label`,{className:`cg-check-row`,title:e.blurb,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.key),onChange:()=>l(e.key)}),(0,B.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:Are[e.key]}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.label})]},e.key))}),(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-copycfg-bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set(yp)),children:`Select all`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set),children:`Clear all`})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions cg-copycfg-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!c||o.size===0,title:c?o.size===0?`Choose at least one thing to copy`:void 0:`Choose the view to copy from`,onClick:()=>{c&&(n(Rne(c.config,o,t)),r())},children:`Copy configuration`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:r,children:`Cancel`})]})]})}function Hre({fields:e,fieldByKey:t,measures:n,measureByKey:r,lists:i,filters:a,filterConj:o,onFilters:s,onFilterConj:c,statusValues:l,cohortLock:u,lockedKey:d,copyViews:f,onCopyConfig:p}){let[m,h]=(0,L.useState)(!1),g=(0,L.useRef)(null),_=!!p&&(f?.length??0)>0;return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Filter`}),u&&(0,B.jsx)(`div`,{className:`cg-flt-lockchip`,children:u.name?`Customer list locked to ${u.name}`+(typeof u.count==`number`?` · ${u.count.toLocaleString()} ${u.count===1?`customer`:`customers`}`:``):`Customer list locked to a set you cannot see`}),a.length===0?(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No conditions. Add one to narrow the list.`}):(0,B.jsx)(`div`,{className:`cg-builder-caption`,children:`In this view, show records`}),(0,B.jsx)(Rre,{nodes:a,conj:o,depth:1,fields:e,fieldByKey:t,measures:n,measureByKey:r,lists:i,statusValues:l,onNodes:s,onConj:c}),lre(a)&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Ranked among the records your other conditions keep — so “top 10” inside a filtered view means the top 10 of that view. Records with no value are not ranked at all. Quartiles and deciles are equal-size slices BY RANK, not by value.`}),(a.length>0||_)&&(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[a.length>0&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s([]),children:`Clear all`}),_&&(0,B.jsx)(`button`,{ref:g,type:`button`,className:`cg-link-btn cg-copy-link`+(m?` is-on`:``),"aria-expanded":m,onClick:()=>h(e=>!e),children:`Copy from another view`})]}),m&&g.current&&(0,B.jsx)(Cp,{anchor:g.current,className:`cg-pop cg-copycfg-pop`,placement:`bottom-end`,onDismiss:()=>h(!1),role:`dialog`,ariaLabel:`Copy configuration from another view`,dataKind:`copy-config`,children:(0,B.jsx)(Vre,{views:f??[],lockedKey:d,onApply:e=>p?.(e),onClose:()=>h(!1)})})]})}function Ure({fields:e,fieldByKey:t,sorts:n,onSorts:r}){let i=(e,t)=>r(n.map((n,r)=>r===e?{...n,...t}:n)),a=e=>r(n.filter((t,n)=>n!==e));return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Sort`}),n.length===0&&(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No sorts. Add one to order the list.`}),n.map((n,r)=>{let o=t.get(n.colId)?.type??`text`;return(0,B.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,B.jsx)(`span`,{className:`cg-cond-prefix`,children:r===0?`Sort by`:`then by`}),(0,B.jsxs)(`span`,{className:`cg-cond-row`,children:[(0,B.jsx)(kp,{className:`cg-cond-field`,ariaLabel:`Sort field`,value:n.colId,onChange:e=>i(r,{colId:e}),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))}),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:n.dir,"aria-label":`Sort direction`,onChange:e=>i(r,{dir:e.target.value}),children:[(0,B.jsx)(`option`,{value:`asc`,children:Fd(o,`asc`)}),(0,B.jsx)(`option`,{value:`desc`,children:Fd(o,`desc`)})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove sort`,onClick:()=>a(r),children:`×`})]})]},r)}),(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>{let t=new Set(n.map(e=>e.colId)),i=e.find(e=>!t.has(e.key))??e[0];i&&r([...n,{colId:i.key,dir:`asc`}])},children:`+ Add another sort`}),n.length>0&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>r([]),children:`Clear`})]})]})}var Wre=[{mode:`short`,label:`Short`},{mode:`medium`,label:`Medium`},{mode:`tall`,label:`Tall`}];function Gre({fields:e,visible:t,lockedKey:n,onColumnVisible:r,onColumnsVisible:i,onFieldOrder:a,deletableKeys:o,onDeleteField:s}){let[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),g=c.trim().toLowerCase(),_=g?e.filter(e=>e.label.toLowerCase().includes(g)):e,v=!!a&&g===``,y=(t,r)=>{if(t===r||t===n||r===n)return null;let i=e.map(e=>e.key),a=i.indexOf(t),o=i.indexOf(r);if(a<0||o<0)return null;let s=i.slice();return s.splice(a,1),s.splice(o,0,t),s},b=(t,n)=>{if(!v)return;let r=e.map(e=>e.key),i=r[r.indexOf(t)+n];if(i===void 0)return;let o=y(t,i);o&&a(o)};return(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Hide fields`}),(0,B.jsx)(`input`,{type:`text`,className:`cg-input cg-fields-search`,placeholder:`Find a field…`,"aria-label":`Find a field`,value:c,onChange:e=>l(e.target.value)}),(0,B.jsxs)(`div`,{className:`cg-pop-list`,children:[_.map(e=>{let i=e.key===n,c=t.has(e.key),l=!!s&&!!o?.has(e.key),g=u===e.key;return(0,B.jsxs)(`label`,{className:`cg-check-row`+(c?``:` is-off`)+(i?` is-locked`:``)+(f===e.key?` is-dragging`:``)+(m===e.key&&f!==null&&f!==e.key?` is-drop-target`:``),title:i?`Always visible`:void 0,onDragOver:v&&f&&f!==e.key?t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,m!==e.key&&h(e.key)}:void 0,onDrop:v&&f?t=>{t.preventDefault(),t.stopPropagation();let n=y(f,e.key);p(null),h(null),n&&a(n)}:void 0,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-field-grip`,draggable:v&&!i,"aria-label":i?`${e.label} is always first`:v?`Reorder ${e.label} — drag, or use the arrow keys`:`Reorder ${e.label} (clear the search first)`,title:v&&!i?`Drag to reorder, or use the arrow keys`:i?`This column is always first`:`Clear the search to reorder`,onDragStart:t=>{t.dataTransfer.setData(`text/plain`,e.key),t.dataTransfer.effectAllowed=`move`,p(e.key)},onDragEnd:()=>{p(null),h(null)},onClick:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:t=>{t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),t.stopPropagation(),b(e.key,t.key===`ArrowUp`?-1:1))},children:(0,B.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,"aria-hidden":!0,focusable:`false`,children:[4,8,12].map(e=>[2.5,7.5].map(t=>(0,B.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}),(0,B.jsx)(`input`,{type:`checkbox`,checked:c,disabled:i,onChange:t=>r(e.key,t.target.checked)}),(0,B.jsx)(wp,{type:e.type,title:wf[e.type]}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.label}),e.source===`odoo`&&!e.custom&&(0,B.jsx)(`span`,{className:`cg-preset-tag`,children:`Pre-set`}),e.scope===`cohort`&&(0,B.jsx)(`span`,{className:`cg-preset-tag cg-scope-tag`,children:`Cohort-only`}),i&&(0,B.jsx)(`span`,{className:`cg-lock-tag`,children:`Locked`}),l&&(0,B.jsx)(`button`,{type:`button`,className:`cg-check-del`+(g?` is-armed`:``),"aria-label":g?`Permanently delete ${e.label}?`:`Delete ${e.label}`,title:g?void 0:`Removes this field and its values on every row.`,onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!g){d(e.key);return}d(null),s(e.key)},children:g?`Delete permanently?`:(0,B.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`})})})]},e.key)}),_.length===0&&(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No field matches your search.`})]}),(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-fields-footer`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>i(e.map(e=>e.key)),children:`Show all`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>i([n]),children:`Hide all`})]})]})}function Kre({fields:e,visible:t,lockedKey:n,onColumnVisible:r,onColumnsVisible:i,orderedFields:a,onFieldOrder:o,deletableKeys:s,onDeleteField:c,colorOn:l,onToggleColor:u,rowHeightMode:d,onRowHeightMode:f,filters:p,onFilters:m,filterConj:h,onFilterConj:g,sorts:_,onSorts:v,groupBy:y,onGroupBy:b,statusValues:x,measures:S=[],pendingMeasureCount:C=0,unresolvedCount:w=0,lists:T=[],cohortLock:E,copyViews:D,onCopyConfig:O,search:k,onSearch:A,recordCount:j,scopeCounts:M,pool:ee,serverWindowed:N=!1,cohortAction:te,filterSeed:ne=null,modeControl:P}){let re=e.filter(e=>t.has(e.key)).length,F=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),ie=(0,L.useMemo)(()=>jee(e),[e]),ae=(0,L.useMemo)(()=>{let e=new Map;for(let t of S)e.set(t.key,t);return e},[S]),oe=(0,L.useMemo)(()=>e.filter(e=>Id(e,n)),[e,n]),se=(0,L.useRef)(0);(0,L.useEffect)(()=>{if(!ne||ne.n===se.current)return;if(se.current=ne.n,ne.measure){let e=ae.get(ne.measure.key);if(!e)return;m([...p,{id:bre(),colId:e.key,op:Pp[0],value:``,window:ne.measure.window}]);return}let e=ne.key?F.get(ne.key):void 0;!e||e.filterable===!1||m([...p,{colId:e.key,op:Np(e.type)[0],value:``}])},[ne,F,ae,p,m]);let ce=(0,L.useMemo)(()=>Sre(p),[p]),le=(0,L.useMemo)(()=>{let e=t=>t.some(t=>Yd(t)?e(t.children):t.rhs!=null&&t.rhs.kind!==`stat`);return e(p)},[p]),ue=ce?`Filter · ${ce}`:`Filter`,de=_.length?`Sort · ${_.length}`:`Sort`,fe=y?`Group: ${F.get(y)?.label??`?`}`:`Group`;return(0,B.jsxs)(`div`,{className:`cg-toolbar`,children:[P,(0,B.jsx)(zp,{label:`Hide fields`,icon:(0,B.jsx)($ne,{}),active:re(0,B.jsx)(Gre,{fields:a??e,visible:t,lockedKey:n,onColumnVisible:r,onColumnsVisible:i,onFieldOrder:o,deletableKeys:s,onDeleteField:c})}),(0,B.jsx)(zp,{label:ue,icon:(0,B.jsx)(wre,{}),active:ce>0,tone:`filter`,wide:!0,measureWide:S.length>0,pairWide:le,forceOpenSignal:ne?.n,children:()=>(0,B.jsx)(Hre,{fields:ie,fieldByKey:F,measures:S,measureByKey:ae,lists:T,filters:p,filterConj:h,onFilters:m,onFilterConj:g,statusValues:x,cohortLock:E,lockedKey:n,copyViews:D,onCopyConfig:O})}),(0,B.jsx)(zp,{label:de,icon:(0,B.jsx)(Tre,{}),active:_.length>0,tone:`sort`,wide:!0,children:()=>(0,B.jsx)(Ure,{fields:e,fieldByKey:F,sorts:_,onSorts:v})}),(0,B.jsx)(zp,{label:fe,icon:(0,B.jsx)(Ore,{}),active:y!==null,tone:`group`,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Group by`}),N?(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Not available on this table. It loads one page at a time, so a group would count only the rows currently fetched.`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:y===null,onChange:()=>b(null)}),(0,B.jsx)(`span`,{children:`No grouping`})]}),oe.map(e=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:y===e.key,onChange:()=>b(e.key)}),(0,B.jsx)(wp,{type:e.type,title:wf[e.type]}),(0,B.jsx)(`span`,{children:e.label})]},e.key))]})]})}),(0,B.jsx)(`span`,{className:`cg-tb-divider`,"aria-hidden":!0}),(0,B.jsx)(zp,{label:`Color`,icon:(0,B.jsx)(Ere,{}),active:l,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Color`}),(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:!l,onChange:()=>u(!1)}),(0,B.jsx)(`span`,{children:`No color`})]}),(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:l,onChange:()=>u(!0)}),(0,B.jsx)(`span`,{children:`Color by status`})]})]})}),(0,B.jsx)(zp,{label:`Rows`,icon:(0,B.jsx)(Dre,{}),active:d!==`short`,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Row height`}),Wre.map(e=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-rowh`,checked:d===e.mode,onChange:()=>f(e.mode)}),(0,B.jsx)(`span`,{children:e.label})]},e.mode))]})}),(0,B.jsxs)(`div`,{className:`cg-search`,children:[(0,B.jsx)(`span`,{className:`cg-search-icon`,"aria-hidden":!0,children:(0,B.jsx)(kre,{})}),(0,B.jsx)(`input`,{type:`text`,className:`cg-search-input`,placeholder:`Search customers…`,value:k,onChange:e=>A(e.target.value)}),k&&(0,B.jsx)(`button`,{type:`button`,className:`cg-search-clear`,"aria-label":`Clear search`,onClick:()=>A(``),children:`×`})]}),te,(0,B.jsx)(`span`,{className:`cg-tb-spacer`}),C>0&&(0,B.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${C} measure condition${C===1?``:`s`} still being calculated over the period you chose. Rows are hidden until the answer arrives rather than shown under a count that would be wrong.`,children:`Calculating…`}),w>0&&(0,B.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${w} condition${w===1?``:`s`} cannot be evaluated — a date that does not resolve, or a list this view refers to that no longer exists. Rows are hidden rather than shown under a count that would be wrong.`,children:`Filter unresolved`}),are(ee)==null?(0,B.jsxs)(`span`,{className:`cg-count`,title:Ap(j,M),children:[(0,B.jsx)(`span`,{className:`cg-count-full`,children:Ap(j,M)}),(0,B.jsx)(`span`,{className:`cg-count-compact`,children:ore(j,M)})]}):(0,B.jsxs)(`span`,{className:`cg-count cg-count-partial`,title:`Loading the rest of your customers in the background — you can browse, filter and sort what is already here.`,children:[(0,B.jsx)(`span`,{className:`cg-count-loaddot`,"aria-hidden":!0}),are(ee)]})]})}function Vp({on:e}){return(0,B.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:(0,B.jsx)(`polygon`,{points:`10,1.8 12.5,7.2 18.4,7.7 13.9,11.6 15.3,17.4 10,14.3 4.7,17.4 6.1,11.6 1.6,7.7 7.5,7.2`,fill:e?`#A98A3E`:`none`,stroke:e?`#A98A3E`:`rgba(118,143,182,0.55)`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function qre({value:e,max:t}){return(0,B.jsx)(`span`,{className:`cg-stars cg-stars--static`,"aria-label":`${e} of ${t}`,children:Array.from({length:t},(t,n)=>(0,B.jsx)(Vp,{on:n=0?n.splice(r,1):n.push(t),Zre(n)}function Gp(e,t,n){let r=e.type===`user`?t??[]:Ed(e),i=r.map(e=>({value:e,label:e})),a=e.type===`multiselect`?Wp(n):[Hp(n).trim()];for(let e of a)e===``||r.includes(e)||i.push({value:e,label:`${e} (no longer a choice)`,stale:!0});return i}function Kp(e){let t=Hp(e).trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):``}function $re(e){let t=e.trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?t:null}function qp(e,t){let n=Math.round(Number(Hp(t)));return Number.isFinite(n)?Math.max(0,Math.min(Dd(e),n)):0}function eie(e,t,n){let r=qp(e,t),i=Math.max(1,Math.min(Dd(e),Math.round(n)));return i===r?``:String(i)}function tie(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase():`?`}var Jp=[`csv`,`xlsx`,`pdf`,`json`],Yp={csv:`CSV`,xlsx:`Excel`,pdf:`PDF`,json:`JSON`};function nie(e,t,n){let r=(e.trim()||`export`).replace(/[\\/:*?"<>|]/g,`_`);return t?`${r} - ${t}.${n}`:`${r}.${n}`}function Xp(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function rie(e,t){let n=[e.map(e=>Xp(e.label)).join(`,`)];for(let r of t)n.push(e.map(e=>Xp(pp(e,r[e.key]))).join(`,`));return n.join(`\r + `),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function mu(e){e=pu(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=jl);var a=e.onBlur;a===void 0&&(a=jl);var o=e.thousandSeparator,s=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l=``);var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,p=e.onValueChange,m=Al(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),h=su(e),g=h.decimalSeparator,_=h.allowedDecimalSeparators,v=function(t){return ou(t,e)},y=function(t,n){return du(t,n,e)},b=Pl(d)?u:d,x=f??uu(b,l,t);Pl(d)?Pl(u)||(x||=typeof u==`number`):x||=typeof d==`number`;var S=function(e){return Il(e)?e:(typeof e==`number`&&(e=Gl(e)),x&&typeof s==`number`?Kl(e,s,!!c):e)},C=nu(S(d),S(u),!!x,v,y,p),w=C[0],T=w.numAsString,E=w.formattedValue,D=C[1];return Object.assign(Object.assign({},m),{value:E,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===g||Nl(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],u=r[a],f=vu(n,t).to,p=function(e){return y(e).indexOf(`.`)+l.length};return d===0&&c&&s&&t[f.start]===g&&p(t)a?!1:i>=f.start&&i{gu=u(f()),(function(e){e.event=`event`,e.props=`prop`})(_u||={}),vu=Ml(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),yu=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}}})),xu=c({default:()=>Tu});function Su(){return Intl.NumberFormat()?.formatToParts(1.1)?.find(e=>e.type===`decimal`)?.value??`.`}function Cu(){return Su()===`.`?`,`:`.`}var wu,Tu,Eu=o((()=>{wu=u(f(),1),kl(),bu(),Tu=e=>{let{value:t,onChange:n,disabled:r,highlight:i,validatedSelection:a,fixedDecimals:o,allowNegative:s,thousandSeparator:c,decimalSeparator:l}=e,u=wu.useRef();return wu.useLayoutEffect(()=>{if(a!==void 0){let e=typeof a==`number`?[a,null]:a;u.current?.setSelectionRange(e[0],e[1])}},[a]),wu.createElement(Ol,null,wu.createElement(hu,{autoFocus:!0,getInputRef:u,className:`gdg-input`,onFocus:e=>e.target.setSelectionRange(i?0:e.target.value.length,e.target.value.length),disabled:r===!0,decimalScale:o,allowNegative:s,thousandSeparator:c??Cu(),decimalSeparator:l??Su(),value:Object.is(t,-0)?`-`:t??``,onValueChange:n}))}}));ct();var Du=L.lazy(async()=>await Dc(()=>Promise.resolve().then(()=>(Eu(),xu)),void 0,import.meta.url)),Ou={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:ti,draw:e=>oi(e,e.cell.displayData,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.displayData).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:void 0}),provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return L.createElement(L.Suspense,{fallback:null},L.createElement(Du,{highlight:t,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:e=>n({...r,data:Number.isNaN(e.floatValue??0)?0:e.floatValue})}))},onPaste:(e,t,n)=>{let r=typeof n.rawValue==`number`?n.rawValue:Number.parseFloat(typeof n.rawValue==`string`?n.rawValue:e);if(!(Number.isNaN(r)||t.data===r))return{...t,data:r,displayData:n.formattedString??t.displayData}}};ct();var ku={getAccessibilityString:()=>``,measure:()=>108,kind:I.Protected,needsHover:!1,needsHoverPosition:!1,draw:Au,onPaste:()=>void 0};function Au(e){let{ctx:t,theme:n,rect:r}=e,{x:i,y:a,height:o}=r;t.beginPath();let s=2.5,c=i+n.cellHorizontalPadding+s,l=a+o/2,u=Math.cos(Xt(30))*s,d=Math.sin(Xt(30))*s;for(let e=0;e<12;e++)t.moveTo(c,l-s),t.lineTo(c,l+s),t.moveTo(c+u,l-d),t.lineTo(c-u,l+d),t.moveTo(c-u,l-d),t.lineTo(c+u,l+d),c+=8;t.lineWidth=1.1,t.lineCap=`square`,t.strokeStyle=n.textLight,t.stroke()}ct();var ju={getAccessibilityString:e=>e.data?.toString()??``,kind:I.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(e,t)=>ti(e,t,e.theme.textLight),draw:e=>oi(e,e.cell.data,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.data).width+n.cellHorizontalPadding*2,provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return L.createElement(lr,{highlight:t,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:e=>n({...r,data:e.target.value})})},onPaste:()=>void 0};ct(),vr();var ree={getAccessibilityString:e=>e.data?.toString()??``,kind:I.Text,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,drawPrep:ti,useLabel:!0,draw:e=>{let{cell:t,hoverAmount:n,hyperWrapping:r,ctx:i,rect:a,theme:o,overrideCursor:s}=e,{displayData:c,contentAlign:l,hoverEffect:u,allowWrapping:d}=t;if(u===!0&&n>0){i.textBaseline=`alphabetic`;let e=o.cellHorizontalPadding,t=o.cellVerticalPadding,r=Jr(c,i,o.baseFontFull,`alphabetic`),l=a.height-t,u=Math.min(l,r.actualBoundingBoxAscent*2.5);i.beginPath(),si(i,a.x+e/2,a.y+(a.height-u)/2+1,r.width+e*3,u-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=fr(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline=`middle`,s?.(`text`)}oi(e,c,l,d,r)},measure:(e,t,n)=>{let r=t.displayData.split(` +`,t.allowWrapping===!0?void 0:1),i=0;for(let t of r)i=Math.max(i,e.measureText(t).width);return i+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:``}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{let{isHighlighted:n,onChange:r,value:i,validatedSelection:a}=t;return L.createElement(lr,{style:e.allowWrapping===!0?{padding:`3px 8.5px`}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:a,onChange:e=>r({...i,data:e.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}};St();var Mu=xt(`div`)({name:`UriOverlayEditorStyle`,class:`gdg-u1rrojo`,propsAsIs:!1}),iee=e=>{let{uri:t,onChange:n,forceEditMode:r,readonly:i,validatedSelection:a,preview:o}=e,[s,c]=L.useState(!i&&(t===``||r)),l=L.useCallback(()=>{c(!0)},[]);return s?L.createElement(lr,{validatedSelection:a,highlight:!0,autoFocus:!0,value:t,onChange:n}):L.createElement(Mu,null,L.createElement(`a`,{className:`gdg-link-area`,href:t,target:`_blank`,rel:`noopener noreferrer`},o),!i&&L.createElement(`div`,{className:`gdg-edit-icon`,onClick:l},L.createElement(tn,null)),L.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};ct();function aee(e,t,n,r){let i=n.cellHorizontalPadding,a=t.height/2-e.actualBoundingBoxAscent/2,o=e.width,s=e.actualBoundingBoxAscent;return r===`right`?i=t.width-o-n.cellHorizontalPadding:r===`center`&&(i=t.width/2-o/2),{x:i,y:a,width:o,height:s}}var oee=[Sl,El,el,il,ll,ml,vl,xl,Ou,ku,ju,ree,{getAccessibilityString:e=>e.data?.toString()??``,kind:I.Uri,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:ti,draw:e=>{let{cell:t,theme:n,overrideCursor:r,hoverX:i,hoverY:a,rect:o,ctx:s}=e,c=t.displayData??t.data,l=t.hoverEffect===!0;if(r!==void 0&&l&&i!==void 0&&a!==void 0){let{x:l,y:u,width:d,height:f}=aee(Jr(c,s,n.baseFontFull),o,n,t.contentAlign);if(i>=l-4&&i<=l-4+d+8&&a>=u-4&&a<=u-4+f+8){let i=Xr(s,n.baseFontFull);r(`pointer`);let a=u-i;s.beginPath(),s.moveTo(o.x+l,Math.floor(o.y+a+f+5)+.5),s.lineTo(o.x+l+d,Math.floor(o.y+a+f+5)+.5),s.strokeStyle=n.linkColor,s.stroke(),s.save(),s.fillStyle=e.cellFillColor,oi({...e,rect:{...o,x:o.x-1}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x-2}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x+1}},c,t.contentAlign),oi({...e,rect:{...o,x:o.x+2}},c,t.contentAlign),s.restore()}}s.fillStyle=l?n.linkColor:n.textDark,oi(e,c,t.contentAlign)},onClick:e=>{let{cell:t,bounds:n,posX:r,posY:i,theme:a}=e,o=t.displayData??t.data;if(t.hoverEffect!==!0||t.onClickUri===void 0)return;let s=Yr(o,a.baseFontFull);if(s===void 0)return;let c=aee(s,n,a,t.contentAlign);ba({x:c.x-4,y:c.y-4,width:c.width+8,height:c.height+8},r,i)&&t.onClickUri(e)},measure:(e,t,n)=>e.measureText(t.displayData??t.data).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:``}),provideEditor:e=>t=>{let{onChange:n,value:r,forceEditMode:i,validatedSelection:a}=t;return L.createElement(iee,{forceEditMode:r.readonly!==!0&&(i||e.hoverEffect===!0&&e.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:a,readonly:r.readonly===!0,onChange:e=>n({...r,data:e.target.value})})},onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}}],see=u(s(((e,t)=>{var n=Gt(),r=re(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))(),1),Nu=[],cee=class extends gi{imageLoaded=()=>void 0;loadedLocations=[];cache={};setCallback(e){this.imageLoaded=e}sendLoaded=(0,see.default)(()=>{this.imageLoaded(new vi(this.loadedLocations)),this.loadedLocations=[]},20);clearOutOfWindow=()=>{let e=Object.keys(this.cache);for(let t of e){let e=this.cache[t],n=!1;for(let t=0;t{o||(o=!0,Nu.length<12?Nu.unshift(a):i||(a.src=``))}},c=new Promise(e=>a.addEventListener(`load`,()=>e(null)));requestAnimationFrame(async()=>{try{a.src=e,await c,await a.decode();let t=this.cache[r];if(t!==void 0&&!o){t.img=a;for(let e of t.cells)this.loadedLocations.push(hi(e));i=!0,this.sendLoaded()}}catch{s.cancel()}}),this.cache[r]=s}loadOrGetImage(e,t,n){let r=e,i=this.cache[r];if(i!==void 0){let e=fi(t,n);return i.cells.includes(e)||i.cells.push(e),i.img}else this.loadImage(e,t,n,r)}},lee=L.forwardRef((e,t)=>{let n=L.useMemo(()=>({...da,...e.headerIcons}),[e.headerIcons]),r=L.useMemo(()=>e.imageWindowLoader??new cee,[e.imageWindowLoader]);return L.createElement(Qc,{...e,renderers:oee,headerIcons:n,ref:t,imageWindowLoader:r})}),Pu=[`all_time`,`today`,`yesterday`,`this_week`,`last_week`,`this_month`,`last_month`,`this_quarter`,`last_quarter`,`this_year`,`last_year`,`ytd`,`ytd_last_year`,`ltm`,`past_week`,`past_month`,`past_year`,`last_n_days`,`next_n_days`,`custom`],Fu=new Set([`last_n_days`,`next_n_days`]),Iu={all_time:`all time`,today:`today`,yesterday:`yesterday`,this_week:`this week`,last_week:`last week`,this_month:`this month`,last_month:`last month`,this_quarter:`this quarter`,last_quarter:`last quarter`,this_year:`this year`,last_year:`last year`,ytd:`year to date`,ytd_last_year:`last year to date`,ltm:`the last 12 months`,past_week:`the past week`,past_month:`the past month`,past_year:`the past year`,last_n_days:`the last {n} days`,next_n_days:`the next {n} days`,custom:`a custom range`},Lu=[`today`,`yesterday`,`one_week_ago`,`one_month_ago`,`n_days_ago`,`exact`],uee=new Set([`today`,`yesterday`,`one_week_ago`,`one_month_ago`]),Ru={today:`today`,yesterday:`yesterday`,one_week_ago:`one week ago`,one_month_ago:`one month ago`,n_days_ago:`{n} days ago`,exact:`an exact date`};function zu(e){let t=String(e??``).trim().slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return null;let n=new Date(`${t}T00:00:00Z`);return Number.isNaN(n.getTime())?null:n}function Bu(e){return e.toISOString().slice(0,10)}function Vu(e,t){return new Date(e.getTime()+t*864e5)}function Hu(e){return[e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate()]}function Uu(e,t,n){return new Date(Date.UTC(e,t-1,n))}function Wu(e){let[t,n]=Hu(e);return Uu(t,n,1)}function Gu(e){let[t,n]=Hu(e);return n===12?Uu(t,12,31):Vu(Uu(t,n+1,1),-1)}function Ku(e){return(e.getUTCDay()+6)%7}function qu(e){let[t,n]=Hu(e);return Uu(t,3*Math.floor((n-1)/3)+1,1)}function dee(e,t){return new Date(Date.UTC(t===12?e+1:e,t===12?0:t,1)-864e5).getUTCDate()}function Ju(e,t){let[n,r,i]=Hu(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a-o*12+1;return Uu(o,s,Math.min(i,dee(o,s)))}function Yu(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.kind;if(!Pu.includes(n))return null;let r={kind:n};if(Fu.has(n)){let e=Number(t.n);if(!Number.isInteger(e)||e<1||e>3650)return null;r.n=e}if(n===`custom`){let e=zu(t.from),n=zu(t.to);if(!e&&!n)return null;e&&n&&e>n&&([e,n]=[n,e]),e&&(r.from=Bu(e)),n&&(r.to=Bu(n))}return r}function Xu(e,t){let n=Yu(e);if(!n)return null;let r=zu(t);if(!r)throw Error("resolveWindow() needs an explicit `today`");switch(n.kind){case`all_time`:return[null,null];case`today`:return[Bu(r),Bu(r)];case`yesterday`:{let e=Vu(r,-1);return[Bu(e),Bu(e)]}case`this_week`:{let e=Vu(r,-Ku(r));return[Bu(e),Bu(Vu(e,6))]}case`last_week`:{let e=Vu(r,-Ku(r)-7);return[Bu(e),Bu(Vu(e,6))]}case`this_month`:return[Bu(Wu(r)),Bu(Gu(r))];case`last_month`:{let e=Vu(Wu(r),-1);return[Bu(Wu(e)),Bu(e)]}case`this_quarter`:{let e=qu(r),[t,n]=Hu(e);return[Bu(e),Bu(Gu(Uu(t,n+2,1)))]}case`last_quarter`:{let e=Vu(qu(r),-1);return[Bu(qu(e)),Bu(e)]}case`this_year`:{let[e]=Hu(r);return[Bu(Uu(e,1,1)),Bu(Uu(e,12,31))]}case`last_year`:{let[e]=Hu(r);return[Bu(Uu(e-1,1,1)),Bu(Uu(e-1,12,31))]}case`ytd`:{let[e]=Hu(r);return[Bu(Uu(e,1,1)),Bu(r)]}case`ytd_last_year`:{let[e]=Hu(r);return[Bu(Uu(e-1,1,1)),Bu(Ju(r,-12))]}case`ltm`:return[Bu(Vu(r,-364)),Bu(r)];case`past_week`:return[Bu(Vu(r,-6)),Bu(r)];case`past_month`:return[Bu(Vu(Ju(r,-1),1)),Bu(r)];case`past_year`:return[Bu(Vu(Ju(r,-12),1)),Bu(r)];case`last_n_days`:return[Bu(Vu(r,-(n.n-1))),Bu(r)];case`next_n_days`:return[Bu(r),Bu(Vu(r,n.n-1))];case`custom`:return[n.from??null,n.to??null]}}function Zu(e){let t=Yu(e);return t?Iu[t.kind].replace(`{n}`,String(t.n??``)):`an invalid range`}function Qu(e,t,n){let r=e||`exact`;if(!Lu.includes(r))return null;let i=zu(n);if(!i)throw Error("resolveAnchor() needs an explicit `today`");switch(r){case`today`:return Bu(i);case`yesterday`:return Bu(Vu(i,-1));case`one_week_ago`:return Bu(Vu(i,-7));case`one_month_ago`:return Bu(Ju(i,-1));case`n_days_ago`:{let e=String(t??``).trim();if(!/^[0-9]+$/.test(e))return null;let n=Number(e);return n>3650?null:Bu(Vu(i,-n))}default:{let e=zu(t);return e?Bu(e):null}}}var $u=[`text`,`select`,`multiselect`,`user`,`int`,`currency`,`pct`,`date`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`],fee=new Set([`formula`,`created_time`]);function ed(e){return e===`select`||e===`user`||e===`multiselect`}function pee(e){let t=new Set,n=[];for(let r of e.split(` +`)){let e=r.trim();if(!e)continue;let i=e.toLowerCase();t.has(i)||(t.add(i),n.push(e))}return n.slice(0,50)}function td(e,t,n=120){let r=Math.max(1,Math.floor(n)),i=e=>e.trim().replace(/\s+/g,` `),a=(i(e)||`Untitled`).slice(0,r).trimEnd(),o=new Set(t.map(e=>i(e).toLocaleLowerCase()));if(!o.has(a.toLocaleLowerCase()))return a;for(let e=2;;e+=1){let t=` ${e}`,n=a.slice(0,Math.max(0,r-t.length)).trimEnd(),i=n?`${n}${t}`:String(e).slice(-r);if(!o.has(i.toLocaleLowerCase()))return i}}function mee(e){return e.filter(e=>e.filterable!==!1)}function nd(e){return Array.isArray(e.options)?e.options:[]}function hee(e){return typeof e.formula==`string`&&e.formula.trim()!==``?e.formula:void 0}function rd(e){let t=typeof e.max==`number`&&Number.isFinite(e.max)?Math.round(e.max):5;return Math.max(2,Math.min(10,t))}var gee=[`grid`,`chart`,`dashboard`,`list`,`calendar`,`kanban`,`map`,`timeseries`],_ee={dashboard:`chart`};function vee(e){return _ee[e]??e}var id=[`week`,`month`,`quarter`,`year`],ad=[`abs`,`pct`,`yoy`,`ytd`],yee=[`note`,`formula`],bee=/^[A-Za-z0-9_ .+\-*/()[\]]*$/;function xee(e){let t=e.bucket===void 0||id.includes(e.bucket),n=e.span,r;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.lastN;if(typeof e==`number`&&Number.isFinite(e)){let t=Math.round(e);t>=1&&t<=120&&(r={lastN:t})}}let i=e.span===void 0?r===void 0:!!r&&r.lastN===n?.lastN;if(t&&i)return e;let a={...e};return t||delete a.bucket,i||(r?a.span=r:delete a.span),a}function od(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(typeof t.mode!=`string`||!gee.includes(t.mode))return;let n={mode:vee(t.mode)};for(let e of[`dateField`,`stackField`,`titleField`,`colorField`,`sizeField`]){let r=t[e];typeof r==`string`&&r!==``&&(n[e]=r)}if(Array.isArray(t.charts)){let e=t.charts.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`).map(xee);e.length&&(n.charts=e.slice(0,12))}if(t.kanbanClamp===!1&&(n.kanbanClamp=!1),(t.calendarMode===`records`||t.calendarMode===`summary`)&&(n.calendarMode=t.calendarMode),Array.isArray(t.calendarMetrics)){let e=[];for(let n of t.calendarMetrics){if(!n||typeof n!=`object`)continue;let t=n;typeof t.id!=`string`||!t.id||typeof t.field!=`string`||!t.field||typeof t.agg!=`string`||!t.agg||e.push({id:t.id,field:t.field,agg:t.agg})}e.length&&(n.calendarMetrics=e.slice(0,4))}if(id.includes(t.tsBucket)&&(n.tsBucket=t.tsBucket),t.tsSpan&&typeof t.tsSpan==`object`&&!Array.isArray(t.tsSpan)){let e=t.tsSpan,r={};if(typeof e.from==`string`&&e.from&&(r.from=e.from),typeof e.to==`string`&&e.to&&(r.to=e.to),typeof e.lastN==`number`&&Number.isFinite(e.lastN)){let t=Math.round(e.lastN);t>=1&&t<=120&&(r.lastN=t)}(r.from||r.to||r.lastN!=null)&&(n.tsSpan=r)}if(Array.isArray(t.tsFields)){let e=t.tsFields.filter(e=>typeof e==`string`&&e!==``);e.length&&(n.tsFields=e.slice(0,12))}if(Array.isArray(t.tsDeltas)){let e=new Set,r=[];for(let n of t.tsDeltas)typeof n!=`string`||!ad.includes(n)||e.has(n)||(e.add(n),r.push(n));r.length&&(n.tsDeltas=r.slice(0,ad.length))}if(t.tsGridlines===!1&&(n.tsGridlines=!1),t.tsSparkline===!0&&(n.tsSparkline=!0),Array.isArray(t.tsRows)){let e=[],r=new Set;for(let n of t.tsRows){if(!n||typeof n!=`object`)continue;let t=n;if(typeof t.id!=`string`||!t.id||t.id.length>40||r.has(t.id)||typeof t.kind!=`string`||!yee.includes(t.kind)||typeof t.label!=`string`||t.label.length>120)continue;r.add(t.id);let i={id:t.id,kind:t.kind,label:t.label};i.kind===`formula`&&typeof t.expr==`string`&&t.expr.length<=200&&bee.test(t.expr)&&(i.expr=t.expr),e.push(i)}e.length&&(n.tsRows=e.slice(0,12))}if(t.tsStyles&&typeof t.tsStyles==`object`&&!Array.isArray(t.tsStyles)){let e={},r=0;for(let[n,i]of Object.entries(t.tsStyles)){if(r>=200)break;if(!n||!i||typeof i!=`object`||Array.isArray(i))continue;let t=i,a={};t.bold===!0&&(a.bold=!0),t.line===!0&&(a.line=!0),!(!a.bold&&!a.line)&&(e[n]=a,r+=1)}r&&(n.tsStyles=e)}if(!(n.mode===`grid`&&!n.dateField&&!n.stackField&&!n.titleField&&!n.colorField&&!n.sizeField&&!n.charts&&n.kanbanClamp===void 0&&!n.calendarMode&&!n.calendarMetrics&&!n.tsBucket&&!n.tsSpan&&!n.tsFields&&!n.tsDeltas&&n.tsGridlines===void 0&&n.tsSparkline===void 0&&!n.tsRows&&!n.tsStyles))return n}function sd(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.round(e);if(!(t<=1))return Math.min(8,t)}function cd(e,t){if(e.source!==`overlay`||fee.has(e.type))return!1;let n=e.permissions?.edit??`everyone`;return n===`everyone`?!0:t?t.isAdmin?!0:n===`creator`&&e.createdBy===t.name:!1}function ld(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function ud(e){return e===`date`||e===`created_time`}function dd(e,t){return ld(e)?t===`asc`?`1 → 9`:`9 → 1`:ud(e)?t===`asc`?`Oldest → Newest`:`Newest → Oldest`:t===`asc`?`A → Z`:`Z → A`}function See(e,t){return e.type===`status`||e.type===`select`||e.type===`multiselect`||e.type===`checkbox`||e.type===`text`&&e.source!==`overlay`&&e.key!==t}var Cee=[`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`];function fd(e){return Cee.includes(e)}var wee=[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`,`gt`,`gte`,`lt`,`lte`,`between`,`within`,`topN`,`bottomN`,`inTopPct`,`inBottomPct`,`aboveAvg`,`belowAvg`,`inQuartile`,`inDecile`],pd=new Set([`isEmpty`,`isNotEmpty`,`aboveAvg`,`belowAvg`]),md=`__cohort__`;function Tee(e){return!bd(e)&&e.colId===`__cohort__`}var Eee=[`anyOf`,`allOf`,`noneOf`],Dee={eq:`anyOf`,neq:`noneOf`};function hd(e){return Eee.includes(e)?e:Dee[e]??`anyOf`}function gd(e){let t=[];for(let n of String(e??``).split(`,`)){let e=n.trim();if(!(e===``||t.includes(e))&&(t.push(e),t.length>=20))break}return t}var Oee=[`avg`,`median`,`p10`,`p25`,`p75`,`p90`],kee={avg:`the average`,median:`the median`,p10:`the bottom 10%`,p25:`the bottom quartile`,p75:`the top quartile`,p90:`the top 10%`};function _d(e){return e&&e.kind!==`stat`?e.colId:void 0}function Aee(e){return e?e.kind===`stat`?Oee.includes(e.stat):e.colId?e.kind===`measure`?Yu(e.window)!=null:e.kind===`field`:!1:!1}function vd(e){return e.colId===`__cohort__`?gd(e.value).length>0:pd.has(e.op)?!0:e.op===`within`?Yu(e.dateWindow)!=null:e.rhs?Aee(e.rhs):e.dateMode&&uee.has(e.dateMode)?!0:e.op===`between`?e.value!==``&&e.value2!=null&&e.value2!==``:e.value!==``}var jee=[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`],Mee=[`gte`,`gt`,`lte`,`lt`];function yd(e){return!bd(e)&&e.window!=null}function bd(e){return e!=null&&Array.isArray(e.children)}function xd(e){return Array.isArray(e?.nodes)?e.nodes:[]}function Sd(e){return e?.conj===`or`?`or`:`and`}var Nee=new Set([`all-customers`]),Pee={key:`customer_data`,scope:`customer`,rowsPath:`customers`,noun:`customer`,nouns:`customers`,measures:!0},Fee={key:`product_data`,scope:`product`,rowsPath:`products`,noun:`product`,nouns:`products`,measures:!1};function Cd(e){return e===`product`?Fee:Pee}function wd(e){return Nee.has(e.id)}function Td(e){return e.config?.display?.mode??`grid`}function Ed(e){return e.kind===`system`||wd(e)?!1:!!e.locked}function Dd(e,t){return t?t.isAdmin?!0:!!e.createdBy&&e.createdBy===t.name:!1}var Od=[`personal`,`collaborative`,`users`],Iee={personal:`Personal`,collaborative:`Collaborative`,users:`Specific users`},Lee={personal:`Only you can change this view.`,collaborative:`Anyone who can see this table can change it.`,users:`Only the people you pick can change it.`};function Ree(e,t,n){let r=e&&typeof e==`object`&&!Array.isArray(e)?e:{},i=Od.includes(r.edit)?r.edit:t;if(i!==`users`)return{edit:i};let a=new Set,o=[];for(let e of(Array.isArray(r.users)?r.users:[]).slice(0,50)){let t=String(e??``).trim();!t||a.has(t.toLowerCase())||n&&!n.includes(t)||(a.add(t.toLowerCase()),o.push(t))}return o.length?{edit:`users`,users:o}:{edit:`personal`}}function zee(e){return e.permissions?.edit??`collaborative`}function kd(e,t){let n=zee(e);return n===`collaborative`||!e.createdBy?!0:t?t.isAdmin||e.createdBy&&e.createdBy===t.name?!0:n===`users`&&(e.permissions?.users??[]).includes(t.name):!1}var Ad=[`folder`,`star`,`flag`,`tag`,`bookmark`,`grid`,`chart`,`map`,`users`,`clock`,`heart`,`bolt`],jd=[`neutral`,`blue`,`green`,`yellow`,`red`],Md=`folder`,Nd=`neutral`;function Bee(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(!Ad.includes(t.shape))return;let n=t.shape,r=jd.includes(t.tone)?t.tone:Nd;if(!(n===`folder`&&r===`neutral`))return{shape:n,tone:r}}var Pd=5*1024*1024;function Vee(e){return e?.windowed?`server-windowed`:`whole-book`}var Fd=`/api/v1`,Id=`same-origin`,Ld=`aios:unauthorized`,Rd=`aios:data-error`,zd=`aios:toast`,Bd=`aios:workspace-stale`,Vd=`aios:nav-minimize`;function Hd(e,t){typeof window>`u`||window.dispatchEvent(new CustomEvent(e,{detail:t}))}var Hee=`streamlit:componentReady`,Uee=`streamlit:render`,Wee=`streamlit:setComponentValue`,Gee=`streamlit:setFrameHeight`,Ud=`aios:grid-host-render`;function Wd(e,t){window.parent.postMessage({isStreamlitMessage:!0,type:e,...t},`*`)}function Gd(){return typeof window>`u`||window.parent===window?!1:new URLSearchParams(window.location.search).has(`streamlitUrl`)}function Kee(){Gd()&&(window.addEventListener(`message`,e=>{let t=e.data;if(!t||t.type!==Uee)return;window.__AIOS_STREAMLIT_ARGS__=t.args??{},window.dispatchEvent(new CustomEvent(Ud));let n=Number(t.args?.height??760);Wd(Gee,{height:Number.isFinite(n)?n:760})}),Wd(Hee,{apiVersion:1}))}function qee(){return window.__AIOS_STREAMLIT_ARGS__??null}function Jee(e){return window.addEventListener(Ud,e),()=>window.removeEventListener(Ud,e)}var Kd=[],qd=null;function Yee(e){qd=e}function Jd(e){return Gd()?(Kd.push(e),Kd.length>24&&Kd.shift(),Wd(Wee,{value:{events:[...Kd]},dataType:`json`}),!0):qd?qd(e):!1}function Yd(e){return`${e}:${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}var Xd={"Content-Type":`application/json`};async function Zd(e){try{return await e.json()}catch{return null}}function Qd(e){return e===401?($d.clear(),Hd(Ld),!0):!1}var Xee=5*6e4,$d=new Map;function ef(){$d.clear()}async function Zee(e){let t=$d.get(e.rowsPath);if(t&&Date.now()-t.ate.pid===t);n&&Object.assign(n,e)}}return r.ok}catch{return!1}}async function nf(e,t=of){try{let n=await fetch(`${Fd}/grid/timeseries?scope=${encodeURIComponent(t)}`,{method:`POST`,credentials:Id,headers:Xd,body:JSON.stringify(e)});if(Qd(n.status)||!n.ok)return{payload:null,status:n.status};let r=await Zd(n);return!r||!Array.isArray(r.columns)||!Array.isArray(r.rows)?{payload:null,status:n.status}:{payload:r,status:n.status}}catch{return{payload:null,status:0}}}var rf=[],af=!1,of=`customer`;function $ee(e){of=e}async function sf(){if(af||rf.length===0)return;af=!0;let e=rf;rf=[];let t=!1;try{let n=await fetch(`${Fd}/grid/events`,{method:`POST`,credentials:Id,headers:Xd,body:JSON.stringify({events:e,scopeKey:of})});Qd(n.status)||(n.ok?ete(await Zd(n)):t=!0)}catch{t=!0}finally{af=!1,t?rf=[...e,...rf].slice(-24):rf.length&&sf()}}function ete(e){let t=e,n=t?.toast;typeof n==`string`&&n.trim()!==``&&Hd(zd,n.trim());let r=Array.isArray(t?.results)?t.results:[];(t?.rerender===!0||r.some(e=>e?.rerender===!0))&&Hd(Bd)}function tte(e){return rf.push(e),rf.length>24&&rf.shift(),sf(),!0}function nte(){Yee(tte)}function cf(e){return JSON.stringify([e.config?.filters??[],e.config?.filterConj===`or`?`or`:`and`])}function rte(e,t,n){let r=cf(e);return r===cf(t)||r===n?null:r}function lf(e,t){for(let n of e??[]){if(bd(n)){lf(n.children,t);continue}let e=n;yd(n)&&e.id&&t.set(e.id,e)}}function ite(e,t,n,r){if(!t||n==null||r-n>12e4)return e;let i=e,a=t.config?t.config.display:void 0;if(t.config&&JSON.stringify(a??null)!==JSON.stringify(e.config?.display??null)){let t={...e.config};a===void 0?delete t.display:t.display=a,i={...e,config:t}}let o=t.config?t.config.cohortLock:void 0;if(t.config&&o!==i.config?.cohortLock){let e={...i.config};o===void 0?delete e.cohortLock:e.cohortLock=o,i={...i,config:e}}let s=t.config?t.config.filters:void 0;if(!Array.isArray(s)||s.length===0)return i;let c=new Map;if(lf(s,c),c.size===0)return i;let l=new Map;lf(e.config?e.config.filters:void 0,l);let u=!1;for(let[e,t]of c){if(!vd(t))continue;let n=l.get(e);if(!n||!vd(n)){u=!0;break}}return u?{...i,config:{...i.config,filters:s,filterConj:t.config.filterConj??e.config.filterConj}}:i}function uf(e,t){let n=e=>{let n={};for(let[r,i]of Object.entries(e??{}))typeof i==`number`&&t-i<=12e4&&(n[r]=i);return n};return{edited:n(e?.edited),deleted:n(e?.deleted)}}function df(e){if(Array.isArray(e))return e.map(df);if(e&&typeof e==`object`){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!==void 0&&(t[n]=df(r))}return t}return e}function ff(e){let{createdBy:t,permissions:n,editRequestId:r,labelCorrectedFrom:i,labelCorrectionId:a,...o}=e;return JSON.stringify(df(o))}function ate(e,t,n,r,i){let a=e=>typeof e==`number`&&r-e<=12e4,o=new Map(t.map(e=>[e.key,e])),s=[];for(let t of e){let e=o.get(t.key);if(o.delete(t.key),!a(n?.deleted?.[t.key])){if(!e){s.push(t);continue}if(!i){s.push({...e,...t,note:t.note??e.note});continue}if(t.labelCorrectedFrom===e.label&&t.label!==e.label&&typeof t.labelCorrectionId==`string`&&t.labelCorrectionId===e.editRequestId){s.push(t);continue}if(a(n?.edited?.[t.key])&&ff(e)!==ff(t)){s.push({...e,...t.createdBy==null?{}:{createdBy:t.createdBy}});continue}s.push(t.note==null&&e.note!=null?{...t,note:e.note}:t)}}for(let e of o.values())if(e.custom&&!a(n?.deleted?.[e.key])){if(e.source===`overlay`){s.push(e);continue}(!i||a(n?.edited?.[e.key]))&&s.push(e)}return s}function ote(e,t){let n=e.filter(e=>!(e.pid===t.pid&&e.key===t.key));return n.push(t),n.slice(-64)}function ste(e,t,n){let r=[],i={};for(let a of e){if(a==null||typeof a.pid!=`number`||typeof a.key!=`string`||typeof a.at!=`number`)continue;let e=t(a.pid),o=e?e[a.key]:void 0;String(o??``)!==String(a.value??``)&&(n-a.at>12e4||(r.push(a),i[a.pid]={...i[a.pid],[a.key]:a.value}))}return{keep:r,seeds:i}}function pf(){if(typeof window>`u`)return null;let e=window.__AIOS_GRID__;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function mf(){let e=qee()?.payload;return e&&Array.isArray(e.rows)&&Array.isArray(e.fields)?e:null}function hf(e,t){let n={...e,workspace:t};Array.isArray(t.measures)&&(n.measures=t.measures),t.measureSets&&typeof t.measureSets==`object`&&(n.measureSets=t.measureSets),t.viewer&&typeof t.viewer.name==`string`&&(n.viewer=t.viewer),Array.isArray(t.userOptions)&&(n.userOptions=t.userOptions);let r=t.derived;return r&&typeof r==`object`&&Object.keys(r).length>0&&(n.rows=e.rows.map(e=>{let t=r[String(e.pid)];return t?{...e,...t}:e})),n}function gf(){return mf()??pf()}var _f=Gd(),cte=pf()!==null;function vf(e){return`aios-grid-cells:${e}`}function yf(e){try{let t=localStorage.getItem(vf(e)),n=t?JSON.parse(t):null;return Array.isArray(n)?n:[]}catch{return[]}}function bf(e,t){try{localStorage.setItem(vf(e),JSON.stringify(t))}catch{}}function xf(e){let t=e?.workspace?.storageKey;if(!e||!t)return{};let n=new Map(e.rows.map(e=>[e.pid,e])),{keep:r,seeds:i}=ste(yf(t),e=>n.get(e),Date.now());return bf(t,r),i}function lte(e=`customer`){$ee(e);let t=Cd(e),[n,r]=(0,L.useState)(()=>gf()),[i,a]=(0,L.useState)(()=>_f?xf(gf()):{}),o=(0,L.useRef)(n);o.current=n,(0,L.useEffect)(()=>{if(_f){let e=()=>{let e=mf();if(!e)return;let t=xf(e);Object.keys(t).length&&a(e=>{let n={...e};for(let[e,r]of Object.entries(t))n[Number(e)]={...r,...n[Number(e)]};return n}),r(e)};return e(),Jee(e)}if(pf())return;let n=!1;async function i(){let[i,a]=await Promise.all([Zee(t),tf(e)]);n||!i||r(a?hf(i,a):i)}i();async function o(){let t=await tf(e);n||!t||r(e=>e&&hf(e,t))}let s=()=>{o()};return typeof window<`u`&&window.addEventListener(Bd,s),()=>{n=!0,typeof window<`u`&&window.removeEventListener(Bd,s)}},[e,t]);let s=(0,L.useCallback)((e,n)=>{let r;if(a(t=>(r=t[e],{...t,[e]:{...t[e],...n}})),_f){let t=o.current?.workspace?.storageKey;if(t){let r=yf(t),i=Date.now();for(let[t,a]of Object.entries(n))r=ote(r,{pid:e,key:t,value:a??null,at:i});bf(t,r)}Jd({id:Yd(`overlay`),type:`overlay_patch`,pid:e,updates:n});return}cte||Qee(t,e,n).then(t=>{t||(console.warn(`customer-grid: overlay PATCH failed for pid ${e}; rolling back`),a(t=>{let n={...t};return r===void 0?delete n[e]:n[e]=r,n}))})},[t]);return{fields:n?.fields??[],rawRows:n?.rows??[],payload:n,loading:n===null,overlayEdits:i,setOverlayEdits:a,patchOverlay:s}}function ute(e,t){return[...e??[]].filter(e=>!!e&&typeof e.id==`string`&&e.id!==``).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({id:e.id,name:e.name,count:Array.isArray(e.pids)?e.pids.length:null,missing:typeof e.missing==`number`&&e.missing>0?e.missing:0,active:!!t&&e.id===t,locked:!0}))}function dte(e){return e?e.count==null?`Locked to a list you cannot see`:`${e.name} · ${e.count.toLocaleString()} ${e.count===1?`customer`:`customers`}`:null}var Sf=`#202433`,Cf=`#6B7280`,wf=`#E6E9EF`,fte=`#FFFFFF`,pte=`#FAFBFC`,mte=`#9DBFF2`,Tf=`#EDF3FD`,hte=`#F5D989`,Ef=`#FBF4E0`,gte=`#F0A8A0`,_te=`#FCEEEC`,Df=`#A5D8B4`,Of=`#EBF6EF`,kf=`#F1EEFB`,Af=`#6B57A8`,jf=`#768FB6`,vte=`#4F6079`,Mf=`#7E6428`,yte=`#A3453C`,Nf=`#35754E`,Pf={accentColor:jf,accentLight:Tf,textDark:Sf,textMedium:Cf,textLight:`#8B92A0`,textHeader:Sf,bgCell:fte,bgHeader:pte,bgHeaderHovered:`#F1F3F6`,bgHeaderHasFocus:Tf,borderColor:wf,horizontalBorderColor:wf,fgIconHeader:Cf,bgIconHeader:wf,fontFamily:`Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`,baseFontStyle:`13px`,headerFontStyle:`600 13px`},bte={growing:{bgBubble:Of,textBubble:Nf},new:{bgBubble:Tf,textBubble:vte},declining:{bgBubble:Ef,textBubble:Mf},dormant:{bgBubble:wf,textBubble:Sf},lost:{bgBubble:_te,textBubble:yte},reactivated:{bgBubble:Df,textBubble:Sf}},xte={growing:{bgCell:`rgba(165, 216, 180, 0.40)`},new:{bgCell:`rgba(157, 191, 242, 0.38)`},declining:{bgCell:`rgba(245, 217, 137, 0.42)`},dormant:{bgCell:`rgba(107, 114, 128, 0.13)`},lost:{bgCell:`rgba(240, 168, 160, 0.38)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.72)`}},Ste={growing:{bgCell:`rgba(165, 216, 180, 0.62)`},new:{bgCell:`rgba(157, 191, 242, 0.60)`},declining:{bgCell:`rgba(245, 217, 137, 0.64)`},dormant:{bgCell:`rgba(107, 114, 128, 0.22)`},lost:{bgCell:`rgba(240, 168, 160, 0.60)`},reactivated:{bgCell:`rgba(165, 216, 180, 0.92)`}},Cte={bgCell:`rgba(32, 36, 51, 0.06)`},wte=Cte,Tte=Cte,Ff=`700 13px`;function If(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}var Ete={filter:{bgHeader:Of,bgHeaderHovered:Of,bgHeaderHasFocus:Of,bgCell:If(Nf,.06),headerFontStyle:Ff},sort:{bgHeader:Ef,bgHeaderHovered:Ef,bgHeaderHasFocus:Ef,bgCell:If(Mf,.06),headerFontStyle:Ff},group:{bgHeader:kf,bgHeaderHovered:kf,bgHeaderHasFocus:kf,bgCell:If(Af,.06),headerFontStyle:Ff}},Dte={filter:{bgCell:If(Nf,.035)},sort:{bgCell:If(Mf,.035)},group:{bgCell:If(Af,.035)}},Ote=Cf,Lf=(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`,kte=[{d:`M3.2 4.6h9.6v8.2H3.2z`},{d:`M3.2 7.2h9.6`},{d:`M5.8 3v3.2`},{d:`M10.2 3v3.2`}],Rf={text:[{d:`M3 5h10M3 8h10M3 11h6`}],status:[{d:`M4 13V3.5h7.6L10.1 6l1.5 2.5H4`}],currency:[{d:`M8 2.8v10.4`},{d:`M10.6 5.4A2.6 2.6 0 0 0 8.2 4.2H7.4a2 2 0 0 0 0 4h1.2a2 2 0 0 1 0 4H7.8a2.6 2.6 0 0 1-2.4-1.4`}],int:[{d:`M6.2 3L4.8 13M11.2 3l-1.4 10M3.4 6.2h9.2M2.9 9.8h9.2`}],date:kte,pct:[{d:Lf(4.6,4.6,1.6)},{d:Lf(11.4,11.4,1.6)},{d:`M12.2 3.9L3.8 12.3`}],select:[{d:`M3.2 3.8h9.6v8.4H3.2z`},{d:`M6.2 7.2l1.8 1.8 1.8-1.8`}],user:[{d:Lf(8,6,2.4)},{d:`M3.6 13c0-2.4 2-3.8 4.4-3.8s4.4 1.4 4.4 3.8`}],multiselect:[{d:`M3 4.6h2.2v2.2H3zM3 9.2h2.2v2.2H3z`},{d:`M7.2 5.7h6M7.2 10.3h6`}],checkbox:[{d:`M3.4 3.4h9.2v9.2H3.4z`},{d:`M5.8 8.1l1.8 1.9 3.4-3.9`}],phone:[{d:`M5.1 3.2L7 5.1 5.6 7a7.2 7.2 0 0 0 3.4 3.4l1.9-1.4 1.9 1.9-1.5 1.6c-3 .5-8.3-4.8-7.8-7.8z`}],email:[{d:`M3 4.4h10v7.2H3z`},{d:`M3 4.9l5 3.9 5-3.9`}],url:[{d:`M7 5.4L8.4 4a2.6 2.6 0 0 1 3.7 3.7L10.7 9`},{d:`M9 10.6L7.6 12a2.6 2.6 0 0 1-3.7-3.7L5.3 7`},{d:`M6.2 9.8l3.6-3.6`}],rating:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`,fill:!0}],created_time:[{d:Lf(8,8,5.2)},{d:`M8 4.9v3.4l2.3 1.4`}],formula:[{d:`M5.6 12.8V5.4a2 2 0 0 1 3.2-1.6`},{d:`M4.2 7.6h4.6`},{d:`M10.2 8.4l3 3.4M13.2 8.4l-3 3.4`}]},zf={grid:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.5h10.8M2.6 9.5h10.8M6.4 3.4v9.2M10 3.4v9.2`}],list:[{d:`M3 4.6h1.4M6.4 4.6h6.6M3 8h1.4M6.4 8h6.6M3 11.4h1.4M6.4 11.4h6.6`}],chart:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],dashboard:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M5.4 10.6V7.2M8 10.6V5.4M10.6 10.6V8.6`}],calendar:kte,kanban:[{d:`M2.8 3.4h3.1v9.2H2.8zM6.5 3.4h3.1v6.2H6.5zM10.2 3.4h3.1v7.6h-3.1z`}],map:[{d:`M8 2.6a3.6 3.6 0 0 1 3.6 3.6c0 2.7-3.6 7.2-3.6 7.2S4.4 8.9 4.4 6.2A3.6 3.6 0 0 1 8 2.6z`},{d:Lf(8,6.1,1.3)}],timeseries:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.6h10.8M6.2 3.4v9.2`},{d:`M7.2 10.8l2-2.4 1.6 1.2 1.8-2.6`}]},Ate={bar:[{d:`M3.2 12.8V7.4M6.4 12.8V4.2M9.6 12.8V8.8M12.8 12.8V5.8`}],line:[{d:`M2.6 11.2l3.2-3.4 2.6 2 4.9-5.2`},{d:Lf(5.8,7.8,.9)},{d:Lf(8.4,9.8,.9)}],area:[{d:`M2.6 12.4V9.2l3.2-3.2 2.6 2 4.9-4.6v9z`},{d:`M2.6 9.2l3.2-3.2 2.6 2 4.9-4.6`}],donut:[{d:Lf(8,8,5)},{d:Lf(8,8,2.1)}],kpi:[{d:`M2.6 3.8h10.8v8.4H2.6z`},{d:`M5.4 9.6V6.4l1.9 3.2V6.4M9.4 6.4v3.2h1.8`}],table:[{d:`M2.6 3.4h10.8v9.2H2.6z`},{d:`M2.6 6.2h10.8M7.2 6.2v6.4M2.6 9.4h10.8`}]},jte={bar:`blue`,line:`green`,area:`green`,donut:`yellow`,kpi:`neutral`,table:`neutral`},Mte={folder:[{d:`M2.4 12.6V4.2a.6.6 0 0 1 .6-.6h3.2l1.5 1.7h5.3a.6.6 0 0 1 .6.6v6.7a.6.6 0 0 1-.6.6H3a.6.6 0 0 1-.6-.6z`}],star:[{d:`M8 2.9l1.63 3.3 3.64.53-2.63 2.57.62 3.63L8 11.24 4.74 12.93l.62-3.63L2.73 6.73l3.64-.53z`}],flag:[{d:`M4.2 13.4V2.9`},{d:`M4.2 3.4h7.6l-1.5 2.6 1.5 2.6H4.2z`}],tag:[{d:`M2.9 8.2V3.5a.6.6 0 0 1 .6-.6h4.7l5 5-5.3 5.3z`},{d:Lf(5.6,5.6,1)}],bookmark:[{d:`M4.4 2.9h7.2v10.4L8 10.7l-3.6 2.6z`}],grid:zf.grid,chart:zf.dashboard,map:zf.map,users:Rf.user,clock:Rf.created_time,heart:[{d:`M8 13.1S2.7 9.8 2.7 6.4a2.9 2.9 0 0 1 5.3-1.6 2.9 2.9 0 0 1 5.3 1.6c0 3.4-5.3 6.7-5.3 6.7z`}],bolt:[{d:`M9.1 2.4L4.2 9.1h3.3l-.6 4.5 4.9-6.7H8.5z`}]},Bf={neutral:{fill:wf,stroke:Cf},blue:{fill:mte,stroke:jf},green:{fill:Df,stroke:Nf},yellow:{fill:hte,stroke:Mf},red:{fill:gte,stroke:yte}},Nte={neutral:`Neutral`,blue:`Blue`,green:`Green`,yellow:`Yellow`,red:`Red`},Pte={folder:`Folder`,star:`Star`,flag:`Flag`,tag:`Tag`,bookmark:`Bookmark`,grid:`Table`,chart:`Chart`,map:`Map`,users:`People`,clock:`Clock`,heart:`Heart`,bolt:`Priority`},Vf={grid:`Grid`,chart:`Chart`,dashboard:`Chart`,list:`List`,calendar:`Calendar`,kanban:`Kanban`,map:`Map`,timeseries:`Time series`},Fte=[`grid`,`chart`,`list`,`calendar`,`kanban`,`map`,`timeseries`],Ite={grid:`blue`,list:`blue`,chart:`green`,dashboard:`green`,calendar:`yellow`,kanban:`yellow`,map:`red`,timeseries:`green`},Hf={text:`Single line text`,select:`Single select`,multiselect:`Multi select`,user:`Assignee`,int:`Number`,currency:`Currency`,pct:`Percent`,date:`Date`,checkbox:`Checkbox`,phone:`Phone number`,email:`Email`,url:`URL`,rating:`Rating`,created_time:`Created time`,formula:`Formula`,status:`Lifecycle status (Odoo)`};function Lte(e,t){return e.fill?``:``}function Rte(e){return({fgColor:t})=>``+e.map(e=>Lte(e,t)).join(``)+``}function zte(e){return`t_${e}`}var Bte={...Object.fromEntries(Object.keys(Rf).map(e=>[zte(e),Rte(Rf[e])])),aiosInfo:()=>``};function Vte(e,t,n){return e&&t>Math.max(0,n-16)?e:null}function Hte(e,t,n,r=8){let i=Math.min(n,280);return Math.round(Math.max(r,Math.min(e,t-r-i)))}var Ute=`600 13px`;function Wte(e,t,n,r,i){let a=t=>`${e} ${t} (${n})`,o=a(t);if(r==null||r<=0||i(o)<=r)return o;let s=r-i(a(``));return s<=0?o:a(Jte(t,s,i))}function Gte(e,t,n,r=4){if(n.length===0)return null;let i=[],a=e.x+e.width-t-r;for(let t of n){let n=a-t;if(n-e.x<68)return null;i.push({x:Math.round(n),y:Math.round(e.y+(e.height-t)/2),size:t}),a=n-6}return i}function Kte(e,t){let n=[];return e&&n.push(16),t&&n.push(6),n}function qte(e,t,n=30){let r=Gte({x:0,y:0,width:e,height:32},n,t===!0?[16]:t===!1?[]:t);return r?Math.max(0,r[r.length-1].x-32-6):null}function Jte(e,t,n){if(t==null||!e||n(e)<=t)return e;let r=n(`…`);if(r>t)return e;let i=0,a=e.length;for(;it.x+t.width||at.y+t.height)?null:{x:i,y:a,size:n}}function Xte(e){let{placement:t,target:n,panel:r,viewport:i}=e,a=i.left+8,o=i.left+i.width-8,s=i.top+8,c=i.top+i.height-8,l=Math.max(1,o-a),u=Math.min(r.width,l),d=r.height,f,p,m,h;if(t===`right-start`){let e=Math.max(0,o-(n.right+6)),t=Math.max(0,n.left-6-a),r=u<=e||e>=t;h=r?`right`:`left`;let i=r?n.right+6:n.left-6-u;f=Math.min(Math.max(i,a),Math.max(a,o-u)),m=Math.max(1,c-s),p=Math.min(Math.max(n.top,s),Math.max(s,c-Math.min(d,m)))}else{let e=Math.max(0,c-(n.bottom+6)),r=Math.max(0,n.top-6-s),i=d<=e||e>=r;h=i?`below`:`above`,m=Math.max(1,i?e:r);let l=t===`bottom-end`?n.right-u:n.left;f=Math.min(Math.max(l,a),o-u),p=i?Math.min(n.bottom+6,c-m):Math.max(s,n.top-6-Math.min(d,m))}return{left:Math.round(f),top:Math.round(p),maxWidth:Math.floor(l),maxHeight:Math.floor(m),side:h}}var Zte=150,Uf={base:void 0,bold:void 0};function Qte(e,t=!1){let n=t?`bold`:`base`;if(Uf[n]===void 0){let e=document.createElement(`canvas`).getContext(`2d`);e&&(e.font=`${(t?`700 13px`:Pf.headerFontStyle)??`600 13px`} ${Pf.fontFamily??`Inter, sans-serif`}`),Uf[n]=e}let r=Uf[n];return r?r.measureText(e).width:0}function $te(e){return!!(e.note||e.description)}function Wf(e,t){for(let n of e??[]){if(bd(n)){Wf(n.children,t);continue}vd(n)&&t.add(n.colId)}}function ene(e){return e?Ete[e]:void 0}function tne(e){let t=new Map;e.groupBy&&t.set(e.groupBy,`group`);for(let n of e.sorts??[])t.set(n.colId,`sort`);let n=new Set;Wf(e.filters??[],n);for(let e of n)t.set(e,`filter`);return t}function nne(e){let t=new Set;return Wf(e.filters??[],t),t.size>0?`filter`:(e.sorts??[]).length>0?`sort`:e.groupBy?`group`:void 0}function Gf(e){return e.default!==!1||e.source===`overlay`}function Kf(e){let t=e.filter(Gf).map(e=>e.key),n=e.filter(e=>!Gf(e)).map(e=>e.key);return{filters:[],filterConj:`and`,sorts:[],groupBy:null,colorBy:null,rowHeightMode:`short`,order:[...t,...n],visible:t,widths:{},memberPids:[]}}function rne(e,t){let n=new Set(t.map(e=>e.key)),r=e.filter((t,r)=>n.has(t)&&e.indexOf(t)===r);for(let e of t)r.includes(e.key)||r.push(e.key);let i=t.find(e=>e.pinned)?.key??t[0]?.key;return i&&r[0]!==i?[i,...r.filter(e=>e!==i)]:r}function ine(e,t,n){let r=new Set(t.map(e=>e.key)),i=new Set(e.filter(e=>r.has(e)));if(i.size===0)for(let e of t)Gf(e)&&i.add(e.key);return n&&i.add(n),i}function ane(e,t,n){let r=(0,L.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]),i=(0,L.useMemo)(()=>e.find(e=>e.pinned)?.key??e[0]?.key??``,[e]),a=(0,L.useMemo)(()=>rne(t.order,e),[t.order,e]),o=(0,L.useMemo)(()=>ine(t.visible,e,i),[t.visible,e,i]),s=(0,L.useMemo)(()=>tne(t),[t.filters,t.sorts,t.groupBy]),c=(0,L.useMemo)(()=>a.filter(e=>o.has(e)).map(e=>{let n=r.get(e),i=t.widths[e]??Zte,a=s.has(e),o=Kte($te(n),n.source===`overlay`);return{id:e,title:Jte(n.label,qte(i,o),e=>Qte(e,a)),width:i,hasMenu:!0,menuIcon:`dots`,icon:zte(n.type),themeOverride:ene(s.get(e))}}),[a,o,t.widths,r,s]),l=(0,L.useCallback)((e,r)=>{e.id&&n({...t,widths:{...t.widths,[e.id]:Math.round(r)}})},[t,n]),u=(0,L.useCallback)((e,r)=>{if(e===0||r===0)return;let i=a.filter(e=>o.has(e));if(e<0||e>=i.length||r<0||r>=i.length)return;let s=i.slice(),[c]=s.splice(e,1);s.splice(r,0,c);let l=0,u=a.map(e=>o.has(e)?s[l++]:e);n({...t,order:u})},[t,n,a,o]),d=(0,L.useCallback)((e,t)=>e!==0&&t!==0,[]),f=(0,L.useCallback)((e,r)=>{if(!r&&e===i)return;let a=new Set(o);r?a.add(e):a.delete(e),n({...t,visible:[...a]})},[t,i,n,o]),p=(0,L.useCallback)((e,r,i)=>{let s=a.filter(t=>t!==e);if(i===`end`||!r)s.push(e);else{let t=Math.max(0,s.indexOf(r));s.splice(t+ +(i===`right`),0,e)}let c=new Set(o);c.add(e),n({...t,order:s,visible:[...c]})},[t,n,a,o]);return{visibleCols:c,fieldByKey:r,order:a,visible:o,widths:t.widths,lockedKey:i,onColumnResize:l,onColumnMoved:u,onColumnProposeMove:d,setColumnVisible:f,insertColumn:p}}function one(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function sne(e,t){let n={};for(let r of t){if(r.agg!==`sum`)continue;let t=0;for(let n of e)t+=one(n[r.key]);let i=Math.round(t*100)/100;n[r.key]=r.type===`currency`?`$`+i.toLocaleString():i.toLocaleString()}return n}var cne={sets:new Map,unanswerable:0};function lne(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function qf(e){return!bd(e)&&!yd(e)&&fd(e.op)}function une(e){for(let t of e??[]){if(bd(t)){if(une(t.children))return!0;continue}if(qf(t))return!0}return!1}function dne(e){let t=[];for(let n of e??[]){if(bd(n)){let e=dne(n.children);e.length&&t.push({conj:n.conj,children:e});continue}qf(n)||t.push(n)}return t}function fne(e){let t=[];for(let n of e??[]){if(bd(n)){t.push(...fne(n.children));continue}if(!qf(n))continue;let e=n;vd(e)&&t.push(e)}return t}function pne(e,t,n){let r=[];for(let n of e){let e=n[t];if(e==null||e===``)continue;let i=typeof e==`number`?e:Number(e);Number.isFinite(i)&&r.push({pid:n.pid,v:i})}return r.sort((e,t)=>e.v===t.v?e.pid-t.pid:n===`asc`?e.v-t.v:t.v-e.v),r}function Jf(e,t,n){let r=Number(e);if(!Number.isFinite(r))return null;let i=Math.trunc(r);return i!==r||in?null:i}function mne(e,t,n){return Math.min(n,Math.floor(e*n/t)+1)}function Yf(e,t){return Math.min(e,Math.max(1,Math.ceil(e*t/100)))}function hne(e,t,n){let r=fne(e);if(!r.length)return cne;let i=new Map,a=0,o=new Map,s=(e,n)=>{let r=`${n}:${e}`,i=o.get(r);return i||(i=pne(t,e,n),o.set(r,i)),i},c=e=>{i.set(e,new Set),a+=1};for(let e of r){let r=n.get(e.colId);if(!r||!lne(r.type)){c(e);continue}let o=s(e.colId,`asc`);if(!o.length){i.set(e,new Set),t.length&&(a+=1);continue}let l=o.length,u=null;switch(e.op){case`topN`:{let t=Jf(e.value,1,1e4);u=t==null?null:s(e.colId,`desc`).slice(0,t);break}case`bottomN`:{let t=Jf(e.value,1,1e4);u=t==null?null:o.slice(0,t);break}case`inTopPct`:{let t=Jf(e.value,1,100);u=t==null?null:s(e.colId,`desc`).slice(0,Yf(l,t));break}case`inBottomPct`:{let t=Jf(e.value,1,100);u=t==null?null:o.slice(0,Yf(l,t));break}case`aboveAvg`:case`belowAvg`:{let t=o.reduce((e,t)=>e+t.v,0)/l;u=o.filter(n=>e.op===`aboveAvg`?n.v>t:n.vmne(r,l,t)===n);break}default:u=null}if(u==null){c(e);continue}i.set(e,new Set(u.map(e=>e.pid)))}return{sets:i,unanswerable:a}}function Xf(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function Zf(e){return e===`currency`||e===`int`||e===`pct`||e===`rating`||e===`formula`}function gne(e){return e===`date`||e===`created_time`}function _ne(e,t,n){for(let r of n){if(r.type!==`text`&&r.type!==`status`)continue;let n=t[r.key];if(n!=null&&String(n).toLowerCase().includes(e))return!0}return!1}function Qf(e){return e==null||e===``}function vne(e,t,n,r){let i=n.get(e.colId);if(!i)return!0;let a=t[e.colId];if(e.op===`isEmpty`)return Qf(a);if(e.op===`isNotEmpty`)return!Qf(a);if(fd(e.op))return!1;let o=e.rhs!=null,s=o?t[_d(e.rhs)??``]:void 0;if(Zf(i.type)){let t=Xf(a);if(o)return $f(e.op,t,Xf(s));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=Math.min(Xf(e.value),Xf(e.value2)),r=Math.max(Xf(e.value),Xf(e.value2));return t>=n&&t<=r}return e.value===``||$f(e.op,t,Xf(e.value))}if(gne(i.type)){let t=String(a??``).slice(0,10);if(e.op===`within`){if(!r)return!1;let n=Xu(e.dateWindow,r);if(!n||t===``)return!1;let[i,a]=n;return(i==null||t>=i)&&(a==null||t<=a)}if(o)return ep(e.op,t,String(s??``).slice(0,10));if(e.op===`between`){if(e.value===``||e.value2==null||e.value2===``)return!0;let n=e.value=n&&t<=r}if(!yne.has(e.op)||!e.dateMode&&e.value===``)return!0;let n=e.dateMode||`exact`;if(n!==`exact`&&!r)return!1;let i=Qu(n,e.value,r||`1970-01-01`);return i!=null&&ep(e.op,t,i)}let c=String(a??``).toLowerCase();return o?tp(e.op,c,String(s??``).toLowerCase()):e.value===``||tp(e.op,c,e.value.toLowerCase())}var yne=new Set([`eq`,`neq`,`lt`,`lte`,`gt`,`gte`]);function $f(e,t,n){switch(e){case`gt`:return t>n;case`gte`:return t>=n;case`lt`:return tn;case`gte`:return t>=n;default:return!0}}function tp(e,t,n){switch(e){case`contains`:return t.includes(n);case`doesNotContain`:return!t.includes(n);case`eq`:return t===n;case`neq`:return t!==n;default:return!0}}function np(e,t,n,r){if(bd(e)){let i=!1,a=!0,o=!1;for(let s of e.children){let e=np(s,t,n,r);e!==null&&(i=!0,a&&=e,o||=e)}return i?e.conj===`or`?o:a:null}if(Tee(e)){if(!vd(e))return null;let n=gd(e.value).map(e=>r?.cohortSets?.[e]);if(n.some(e=>!e))return!1;let i=hd(e.op);if(i===`allOf`)return n.every(e=>e.has(t.pid));let a=n.some(e=>e.has(t.pid));return i===`noneOf`?!a:a}if(yd(e)){if(!vd(e))return null;let n=e.id?r?.measureSets?.[e.id]:void 0;return n?n.has(t.pid):!1}if(!n.has(e.colId)||e.rhs&&!n.has(_d(e.rhs)??``)||!vd(e))return null;if(fd(e.op)){let n=r?.rankSets?.get(e);return n?n.has(t.pid):!1}return wee.includes(e.op)?vne(e,t,n,r?.today):!1}function rp(e,t){let n=0;for(let r of e??[]){if(bd(r)){n+=rp(r.children,t);continue}!yd(r)||!vd(r)||(!r.id||!t?.[r.id])&&(n+=1)}return n}function ip(e){let t=[];for(let n of e??[]){if(bd(n)){t.push(...ip(n.children));continue}!yd(n)||!vd(n)||t.push(n.id||`(no-id)`)}return t}function bne(e,t){let n=0;for(let r of e??[]){if(bd(r)){n+=bne(r.children,t);continue}if(vd(r)){if(Tee(r)){gd(r.value).some(e=>!t?.cohortSets?.[e])&&(n+=1);continue}yd(r)||(r.op===`within`?(!t?.today||!Xu(r.dateWindow,t.today))&&(n+=1):r.dateMode&&(!t?.today||Qu(r.dateMode,r.value,t.today)==null)&&(n+=1))}}return n}function ap(e,t,n,r,i){let a=np({conj:t,children:e},n,r,i);return a===null||a}function xne(e,t){return(n,r)=>{for(let i of e){let e=t.get(i.colId),a=e?Zf(e.type):!1,o=n[i.colId],s=r[i.colId],c=Qf(o),l=Qf(s);if(c!==l)return c?1:-1;if(c&&l)continue;let u=a?Xf(o)-Xf(s):String(o??``).localeCompare(String(s??``));if(u!==0)return i.dir===`asc`?u:-u}return 0}}function Sne(e,t,n,r){let i=[],a=new Map,o=r.some(e=>e.key===t&&(e.multi||e.type===`multiselect`)),s=r.some(e=>e.key===t&&e.type===`checkbox`),c=e=>s?e===`1`?`Checked`:`Unchecked`:e===``?`(empty)`:e;for(let n of e){let e=n[t],r=e==null?``:String(e),s=o?r.split(`,`).map(e=>e.trim()).filter(e=>e!==``):[r];for(let e of s.length?s:[``]){let t=a.get(e);t||(t=[],a.set(e,t),i.push(e)),t.push(n)}}let l=[];for(let e of i){let t=a.get(e),i=n.has(e),o=sne(t,r);if(l.push({kind:`group-header`,groupKey:e,label:c(e),count:t.length,collapsed:i,aggs:o}),!i){for(let e of t)l.push({kind:`data`,record:e});l.push({kind:`group-footer`,groupKey:e,aggs:o})}}return l}function op(e){let{rawRows:t,fields:n,filters:r,search:i,sorts:a,groupBy:o,collapsed:s,memberPids:c=[],filterConj:l=`and`,serverWindowed:u=!1,measureSets:d,cohortSets:f,today:p,cohortLock:m}=e,h={measureSets:d,cohortSets:f,today:p},g=0,_=e=>{let t=e.map(e=>({kind:`data`,record:e})),n=new Map;return t.forEach((e,t)=>{e.kind===`data`&&n.set(e.record.pid,t)}),{visibleRows:t,pidToIndex:n,unresolvedRank:g}};if(u)return _(t);let v=new Map;for(let e of n)v.set(e.key,e);let y=t;if(m){let e=f?.[m];if(!e)return _([]);y=y.filter(t=>e.has(t.pid))}if(r.length){if(une(r)){let e=dne(r),t=y,n=hne(r,e.length?t.filter(t=>ap(e,l,t,v,h)):t,v);h.rankSets=n.sets,g=n.unanswerable}else h.rankSets=cne.sets;let e=new Set(c);y=y.filter(t=>e.has(t.pid)||ap(r,l,t,v,h))}let b=i.trim().toLowerCase();if(b&&(y=y.filter(e=>_ne(b,e,n))),a.length&&(y=[...y].sort(xne(a,v))),!o)return _(y);let x=Sne(y,o,s,n),S=new Map;return x.forEach((e,t)=>{e.kind===`data`&&!S.has(e.record.pid)&&S.set(e.record.pid,t)}),{visibleRows:x,pidToIndex:S,unresolvedRank:g}}function Cne(e,t,n,r,i,a,o,s=[],c=`and`,l=!1,u,d,f,p){return(0,L.useMemo)(()=>op({rawRows:e,fields:t,filters:n,search:r,sorts:i,groupBy:a,collapsed:o,memberPids:s,filterConj:c,serverWindowed:l,measureSets:u,cohortSets:d,today:f,cohortLock:p}),[e,t,n,c,r,i,a,o,s,l,u,d,f,p])}var sp=[{bg:`#EDF3FD`,fg:`#4F6079`},{bg:`#EBF6EF`,fg:`#35754E`},{bg:`#FBF4E0`,fg:`#7E6428`},{bg:`#FCEEEC`,fg:`#A3453C`},{bg:`#F1EEFB`,fg:`#6B57A8`},{bg:`#EEF1F4`,fg:`#4B5563`}];function cp(e){if(!(typeof e!=`string`||!/^#[0-9a-f]{6}$/i.test(e.trim())))return e.trim().toUpperCase()}var lp=`#182230`,up=[{id:`blue-tint`,hue:`blue`,strength:`tint`,bg:`#EDF3FD`,fg:`#4F6079`,label:`Light blue`},{id:`green-tint`,hue:`green`,strength:`tint`,bg:`#EBF6EF`,fg:`#35754E`,label:`Light green`},{id:`yellow-tint`,hue:`yellow`,strength:`tint`,bg:`#FBF4E0`,fg:`#7E6428`,label:`Light yellow`},{id:`red-tint`,hue:`red`,strength:`tint`,bg:`#FCEEEC`,fg:`#A3453C`,label:`Light red`},{id:`purple-tint`,hue:`purple`,strength:`tint`,bg:`#F1EEFB`,fg:`#6B57A8`,label:`Light purple`},{id:`blue-pastel`,hue:`blue`,strength:`pastel`,bg:`#9DBFF2`,fg:lp,label:`Blue`},{id:`green-pastel`,hue:`green`,strength:`pastel`,bg:`#A5D8B4`,fg:lp,label:`Green`},{id:`yellow-pastel`,hue:`yellow`,strength:`pastel`,bg:`#F5D989`,fg:lp,label:`Yellow`},{id:`red-pastel`,hue:`red`,strength:`pastel`,bg:`#F0A8A0`,fg:lp,label:`Red`},{id:`purple-pastel`,hue:`purple`,strength:`pastel`,bg:`#C3B3EE`,fg:lp,label:`Purple`}];function dp(e){let t=cp(e);if(!t)return;let n=pp(t,1),r=pp(t,3),i=pp(t,5),a=up[0],o=1/0;for(let e of up){let t=n-pp(e.bg,1),s=r-pp(e.bg,3),c=i-pp(e.bg,5),l=(n+pp(e.bg,1))/2,u=(2+l/256)*t*t+4*s*s+(2+(255-l)/256)*c*c;u>>0;return sp[t%sp.length]}function Tne(e,t){let n=e.optionColors;if(!n)return;let r=cp(n[t]);if(r)return r;let i=t.trim().toLowerCase();for(let[e,t]of Object.entries(n))if(e.trim().toLowerCase()===i)return cp(t)}function pp(e,t){return Number.parseInt(e.slice(t,t+2),16)}function mp(e){let t=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(pp(e,1))+.7152*t(pp(e,3))+.0722*t(pp(e,5))}function Ene(e){let t=mp(cp(e)??`#FFFFFF`),n=mp(`#182230`),r=mp(`#FFFFFF`);return(t+.05)/(n+.05)>=(r+.05)/(t+.05)?`#182230`:`#FFFFFF`}function hp(e,t){if(!t||e.colorCodeOptions===!1)return;let n=Tne(e,t);return n?wne(n):fp(t)}function gp(e){return fp(e).bg}function _p(e){let t=e.split(`@`)[0].trim().split(/[\s._]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function Dne(e){return Math.max(14,Math.min(22,e-6))}function One(e,t){return{data:{kind:`aios-user`,name:e,photo:t?.[e]},copyData:e}}function vp(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:0}function yp(e){return e===`1`||e===1||e===!0}function bp(e,t){if(t?.abbrev&&Math.abs(e)>=1e3){let t=Math.abs(e),[n,r]=t>=1e9?[1e9,`B`]:t>=1e6?[1e6,`M`]:[1e3,`k`];return(e/n).toFixed(1)+r}let n=t&&Number.isInteger(t.decimals)&&t.decimals>=0&&t.decimals<=4?t.decimals:null,r=t?.thousands!==!1;return n==null?r?e.toLocaleString():String(e):r?e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n}):e.toFixed(n)}function kne(e){let t=e.includes(` `)?e.replace(` `,`T`):e,n=/T\d{2}:\d{2}/.test(t)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(t)?t+`Z`:t,r=new Date(n);return Number.isNaN(r.getTime())?null:r}function xp(e,t){if(t==null||t===``)return``;let n=String(t),r=kne(n);if(!r)return n;let i=e.format,a=i?.time??e.type===`created_time`,o=i?.tz===`utc`?{timeZone:`UTC`}:void 0;return a?r.toLocaleString(void 0,o):r.toLocaleDateString(void 0,o)}function Sp(e,t){switch(e.type){case`currency`:return t==null||t===``?``:`$`+bp(vp(t),e.format);case`int`:case`formula`:return t==null||t===``?``:bp(vp(t),e.format);case`pct`:return t==null||t===``?``:vp(t).toFixed(1)+`%`;case`date`:case`created_time`:return xp(e,t);case`checkbox`:return yp(t)?`Checked`:``;case`rating`:{let n=vp(t);return n>=1?`${Math.round(n)} of ${rd(e)}`:``}case`multiselect`:return String(t??``).split(`,`).map(e=>e.trim()).filter(e=>e!==``).join(`, `);default:return String(t??``)}}ct();function Ane(e,t,n,r,i){e.beginPath();for(let i=0;i<10;i+=1){let a=Math.PI/5*i-Math.PI/2,o=i%2==0?r:r*.45,s=t+Math.cos(a)*o,c=n+Math.sin(a)*o;i===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),i?(e.fillStyle=`#A98A3E`,e.fill()):(e.strokeStyle=`rgba(118, 143, 182, 0.55)`,e.lineWidth=1,e.stroke())}var Cp=new Map,wp;function Tp(e){wp=e}function jne(e){let t=Cp.get(e);if(t!==void 0)return t;if(typeof Image>`u`)return Cp.set(e,null),null;let n=new Image;return Cp.set(e,n),n.onload=()=>wp?.(),n.onerror=()=>{Cp.set(e,null),wp?.()},n.src=e,n}function Mne(e,t,n,r,i,a,o){let s=a?jne(a):null;if(s&&s.complete&&s.naturalWidth>0){e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.clip();let i=Math.max(r*2/s.naturalWidth,r*2/s.naturalHeight),a=s.naturalWidth*i,o=s.naturalHeight*i;e.drawImage(s,t-a/2,n-o/2,a,o),e.restore();return}let c=fp(i);e.save(),e.beginPath(),e.arc(t,n,r,0,Math.PI*2),e.fillStyle=c.bg,e.fill(),e.fillStyle=c.fg,e.font=`600 ${Math.round(r*.9)}px ${o}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(_p(i),t,n+.5),e.restore()}var Nne={kind:I.Custom,isMatch:e=>e.data?.kind===`aios-user`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{name:a,photo:o}=t.data;if(!a)return!0;let s=Dne(r.height),c=r.x+i.cellHorizontalPadding+s/2,l=r.y+r.height/2;return c+s/2>r.x+r.width-i.cellHorizontalPadding||Mne(n,c,l,s/2,a,o,i.fontFamily),!0}},Pne={kind:I.Custom,isMatch:e=>e.data?.kind===`aios-rating`,draw:(e,t)=>{let{ctx:n,rect:r,theme:i}=e,{value:a,max:o}=t.data,s=r.y+r.height/2,c=r.x+i.cellHorizontalPadding+13/2,l=r.x+r.width-i.cellHorizontalPadding;for(let e=0;el);e+=1)Ane(n,c,s,13/2,ee.trim()).filter(e=>e!==``),r=n.length?hp(e,n[0]):void 0;return{kind:I.Bubble,data:n,allowOverlay:!1,themeOverride:r?{bgBubble:r.bg,textBubble:r.fg}:void 0}}default:return{kind:I.Text,data:String(t??``),displayData:String(t??``),...i}}}ct();var Ep={kind:I.Text,data:``,displayData:``,allowOverlay:!1};function Ine(e,t,n,r,i){let a=e.collapsed?`▶`:`▼`,o=e.count.toLocaleString(),s=`${a} ${e.label} (${o})`,c=i?Wte(a,e.label,o,r,i):s;return{kind:I.Text,data:s,displayData:t===0?c:``,allowOverlay:!1,span:[0,Math.max(0,n-1)],themeOverride:{bgCell:`#eef0f3`,bgCellMedium:`#eef0f3`,textDark:`#33333d`,baseFontStyle:Ute}}}function Lne(e,t){let n=t?e.aggs[t.key]:void 0;return{kind:I.Text,data:n??``,displayData:n??``,contentAlign:`right`,allowOverlay:!1,themeOverride:{bgCell:`#f6f7f9`,bgCellMedium:`#f6f7f9`,textDark:`#4a4a55`,baseFontStyle:`600 12px`}}}function Rne(e,t,n,r,i,a,o=0,s=null,c){return(0,L.useCallback)(([o,l])=>{let u=e[l];if(!u)return Ep;let d=t[o],f=d?n.get(d.id):void 0;return u.kind===`group-header`?Ine(u,o,t.length,s,c):u.kind===`group-footer`?Lne(u,f):f?Fne(f,r[u.record.pid]?.[f.key]??u.record[f.key],i(f),a):Ep},[e,t,n,r,i,a,o,s,c])}ct();function zne(e,t,n){let[r,i]=(0,L.useState)(new Set),[a,o]=(0,L.useState)(void 0),s=(0,L.useRef)(null);return(0,L.useEffect)(()=>{o(e=>{if(!e)return e;let n=s.current,r=n==null?void 0:t.get(n);if(r!==void 0)return r===e.cell[1]?e:{cell:[e.cell[0],r],range:{x:e.cell[0],y:r,width:1,height:1},rangeStack:[]}})},[e,t]),{gridSelection:(0,L.useMemo)(()=>{let i=st.empty();for(let e of r){let n=t.get(e);n!==void 0&&(i=i.add(n))}return{current:a&&a.cell[1]{o(t.current);let n=t.current?e[t.current.cell[1]]:void 0;s.current=n&&n.kind===`data`?n.record.pid:null;let r=new Set;for(let n of t.rows){let t=e[n];t&&t.kind===`data`&&r.add(t.record.pid)}i(r)},[e]),selectPids:(0,L.useCallback)((e,t)=>{i(n=>{let r=t===`add`?new Set(n):new Set;for(let t of e)r.add(t);return r})},[]),togglePid:(0,L.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setActiveCell:(0,L.useCallback)((t,n)=>{let r=e[n];s.current=r&&r.kind===`data`?r.record.pid:null,o({cell:[t,n],range:{x:t,y:n,width:1,height:1},rangeStack:[]})},[e]),clearSelection:(0,L.useCallback)(()=>{i(new Set),o(void 0),s.current=null},[])}}var Dp=[{key:`filters`,label:`Filter conditions`,blurb:`Which records the view shows, and how the conditions combine.`},{key:`sorts`,label:`Sorts`,blurb:`The order records are listed in.`},{key:`groupBy`,label:`Groups`,blurb:`The field records are bucketed by.`},{key:`visible`,label:`Hidden fields`,blurb:`Which columns are shown.`},{key:`order`,label:`Field order`,blurb:`Left-to-right column order.`},{key:`rowHeightMode`,label:`Row height`,blurb:`Short, medium or tall rows.`}],Op=Dp.map(e=>e.key);function Bne(e){return typeof e==`string`&&Op.includes(e)}function kp(e){return JSON.parse(JSON.stringify(e))}function Vne(e,t,n){let r={};if(!e)return r;let i=new Set;for(let e of t)Bne(e)&&i.add(e);if(i.size===0)return r;if(i.has(`filters`)&&(r.filters=kp(Array.isArray(e.filters)?e.filters:[]),r.filterConj=e.filterConj),i.has(`sorts`)&&(r.sorts=kp(Array.isArray(e.sorts)?e.sorts:[])),i.has(`groupBy`)&&(r.groupBy=e.groupBy??null),i.has(`visible`)){let t=kp(Array.isArray(e.visible)?e.visible:[]);r.visible=n&&!t.includes(n)?[n,...t]:t}return i.has(`order`)&&(r.order=kp(Array.isArray(e.order)?e.order:[])),i.has(`rowHeightMode`)&&e.rowHeightMode&&(r.rowHeightMode=e.rowHeightMode),r}var Hne=s((e=>{var t=f(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),Ap=s(((e,t)=>{t.exports=Hne()})),Une=g(),B=Ap(),jp=(0,L.createContext)(null),Mp=[`[data-overlay-autofocus]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[href]`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Np({children:e}){let t=(0,L.useRef)([]),n=(0,L.useMemo)(()=>({register:e=>(t.current=[...t.current.filter(t=>t!==e),e],()=>{t.current=t.current.filter(t=>t!==e)}),isTop:e=>t.current.at(-1)===e}),[]);return(0,B.jsx)(jp.Provider,{value:n,children:e})}function Wne(e){if(`getBoundingClientRect`in e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height}}return e}function Gne(e,t){return e.left===t.left&&e.top===t.top&&e.maxWidth===t.maxWidth&&e.maxHeight===t.maxHeight&&e.visibility===t.visibility}function Pp({panelRef:e,onDismiss:t,dismissOnOutside:n=!0,initialFocus:r=`first`,restoreFocus:i=!0,trapFocus:a=!1,outsideElements:o=[]}){let s=(0,L.useId)(),c=(0,L.useContext)(jp),l=(0,L.useRef)(t),u=(0,L.useRef)(o);l.current=t,u.current=o,(0,L.useEffect)(()=>c?.register(s),[s,c]),(0,L.useEffect)(()=>{let t=t=>{if(!n||c&&!c.isTop(s))return;let r=t.target;!r||e.current?.contains(r)||u.current.some(e=>e?.contains(r))||(document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current())},r=t=>{if(c&&!c.isTop(s))return;if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),document.activeElement instanceof HTMLElement&&e.current?.contains(document.activeElement)&&document.activeElement.blur(),l.current();return}if(t.key!==`Tab`||!a)return;let n=Array.from(e.current?.querySelectorAll(Mp)??[]).filter(e=>e.getClientRects().length>0);if(!n.length){t.preventDefault(),e.current?.focus();return}let r=n[0],i=n.at(-1),o=document.activeElement;t.shiftKey&&(o===r||!e.current?.contains(o))?(t.preventDefault(),i.focus()):!t.shiftKey&&o===i&&(t.preventDefault(),r.focus())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,r,!0)}},[n,s,e,c,a]),(0,L.useLayoutEffect)(()=>{let t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=window.requestAnimationFrame(()=>{if(r===`none`)return;let t=r===`first`?Mp:r;(e.current?.querySelector(t))?.focus({preventScroll:!0})});return()=>{window.cancelAnimationFrame(n),i&&t?.isConnected&&t.focus({preventScroll:!0})}},[r,e,i])}function Fp({children:e}){return(0,Une.createPortal)(e,document.body)}function Ip({anchor:e,className:t,children:n,onDismiss:r,placement:i=`bottom-start`,role:a,ariaLabel:o,id:s,initialFocus:c=`first`,restoreFocus:l=!0,dismissOnOutside:u=!0,onKeyDown:d,dataKind:f}){let p=(0,L.useRef)(null),[m,h]=(0,L.useState)({position:`fixed`,left:0,top:0,visibility:`hidden`}),g=`getBoundingClientRect`in e?e:null;Pp({panelRef:p,onDismiss:r,dismissOnOutside:u,initialFocus:c,restoreFocus:l,outsideElements:[g]});let _=(0,L.useCallback)(()=>{let t=p.current;if(!t)return;let n=Wne(e),r=window.visualViewport,a=r?.offsetLeft??0,o=r?.offsetTop??0,s=r?.width??window.innerWidth,c=r?.height??window.innerHeight,l=t.getBoundingClientRect(),u=Xte({placement:i,target:n,panel:{width:Math.max(l.width,t.scrollWidth),height:Math.max(l.height,t.scrollHeight)},viewport:{left:a,top:o,width:s,height:c}}),d={position:`fixed`,left:u.left,top:u.top,maxWidth:u.maxWidth,maxHeight:u.maxHeight,visibility:`visible`};h(e=>Gne(e,d)?e:d)},[e,i]);return(0,L.useLayoutEffect)(()=>{_();let e=window.requestAnimationFrame(_),t=new ResizeObserver(_);return p.current&&t.observe(p.current),g&&t.observe(g),window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),window.visualViewport?.addEventListener(`resize`,_),window.visualViewport?.addEventListener(`scroll`,_),()=>{window.cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0),window.visualViewport?.removeEventListener(`resize`,_),window.visualViewport?.removeEventListener(`scroll`,_)}},[g,_]),(0,B.jsx)(Fp,{children:(0,B.jsx)(`div`,{ref:p,id:s,className:t,style:m,role:a,"aria-label":o,"data-overlay-kind":f,onKeyDown:d,children:n})})}function Lp({shapes:e}){return(0,B.jsx)(B.Fragment,{children:e.map((e,t)=>e.fill?(0,B.jsx)(`path`,{d:e.d,fill:`currentColor`},t):(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Rp({type:e,size:t=14,title:n}){return(0,B.jsxs)(`svg`,{className:`cg-type-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!n||void 0,role:n?`img`:void 0,"aria-label":n,children:[n&&(0,B.jsx)(`title`,{children:n}),(0,B.jsx)(Lp,{shapes:Rf[e===`measure`?`currency`:e]})]})}function zp({mode:e,size:t=14}){return(0,B.jsx)(`svg`,{className:`cg-mode-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:(0,B.jsx)(Lp,{shapes:zf[e]})})}function Bp({mode:e,tone:t,size:n=15}){let r=Bf[t];return(0,B.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:n,height:n,viewBox:`0 0 16 16`,"aria-hidden":!0,children:zf[e].map((e,t)=>e.fill?(0,B.jsx)(`path`,{d:e.d,fill:r.stroke},t):(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Kne({kind:e,size:t=15}){let n=Bf[jte[e]];return(0,B.jsx)(`svg`,{className:`cg-mode-icon cg-tone-icon`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Ate[e].map((t,r)=>(0,B.jsx)(`path`,{d:t.d,fill:r===0&&(e===`area`||e===`donut`||e===`kpi`||e===`table`)?n.fill:`none`,stroke:n.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},r))})}var qne={width:16,height:16,viewBox:`0 0 16 16`,fill:`none`},Vp={stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`},Jne={duplicate:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`5.5`,y:`5.5`,width:`8`,height:`8`,rx:`1.5`,...Vp}),(0,B.jsx)(`path`,{d:`M10.5 2.5h-7a1 1 0 0 0-1 1v7`,...Vp})]}),insertLeft:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`3`,y1:`2.5`,x2:`3`,y2:`13.5`,...Vp}),(0,B.jsx)(`path`,{d:`M13.5 8H6.5M9.2 5.3 6.5 8l2.7 2.7`,...Vp})]}),insertRight:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`13`,y1:`2.5`,x2:`13`,y2:`13.5`,...Vp}),(0,B.jsx)(`path`,{d:`M2.5 8h7M6.8 5.3 9.5 8l-2.7 2.7`,...Vp})]}),addEnd:(0,B.jsx)(`path`,{d:`M8 3v10M3 8h10`,...Vp}),rename:(0,B.jsx)(`path`,{d:`m9.8 3.2 3 3L6.2 12.8l-3.6.6.6-3.6 6.6-6.6Z`,...Vp}),description:(0,B.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h6`,...Vp}),permissions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...Vp}),(0,B.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0V7`,...Vp})]}),unlock:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1`,...Vp}),(0,B.jsx)(`path`,{d:`M5.5 7V5.2a2.5 2.5 0 0 1 5 0`,...Vp})]}),format:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M3 5h5.5M12.5 5H13M3 11h1M7 11h6`,...Vp}),(0,B.jsx)(`circle`,{cx:`10.5`,cy:`5`,r:`1.6`,...Vp}),(0,B.jsx)(`circle`,{cx:`4.9`,cy:`11`,r:`1.6`,...Vp})]}),swap:(0,B.jsx)(`path`,{d:`M3.5 6h9M10.2 3.7 12.5 6l-2.3 2.3M12.5 10.5h-9M5.8 8.2 3.5 10.5l2.3 2.3`,...Vp}),sortAsc:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...Vp}),(0,B.jsx)(`path`,{d:`M8.5 4.5h2M8.5 8h3.5M8.5 11.5h5`,...Vp})]}),sortDesc:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M4.5 3v10M4.5 13l-2-2M4.5 13l2-2`,...Vp}),(0,B.jsx)(`path`,{d:`M8.5 4.5h5M8.5 8h3.5M8.5 11.5h2`,...Vp})]}),off:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`,...Vp}),(0,B.jsx)(`line`,{x1:`4.4`,y1:`11.6`,x2:`11.6`,y2:`4.4`,...Vp})]}),filter:(0,B.jsx)(`path`,{d:`M2.5 3.5h11L9.5 8.5v3.8L6.5 14V8.5L2.5 3.5Z`,...Vp}),group:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...Vp}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...Vp}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...Vp})]}),pin:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...Vp}),(0,B.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...Vp})]}),unpin:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M6 2.5h4l-.5 4L12 9v1H4V9l2.5-2.5L6 2.5Z`,...Vp}),(0,B.jsx)(`line`,{x1:`8`,y1:`10`,x2:`8`,y2:`13.5`,...Vp}),(0,B.jsx)(`line`,{x1:`3`,y1:`13`,x2:`13`,y2:`3`,...Vp})]}),hide:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,...Vp}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.5`,...Vp}),(0,B.jsx)(`line`,{x1:`3.5`,y1:`12.5`,x2:`12.5`,y2:`3.5`,...Vp})]}),trash:(0,B.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,...Vp}),download:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M8 2.5v7M5.3 6.8 8 9.5l2.7-2.7`,...Vp}),(0,B.jsx)(`path`,{d:`M3 11v1.5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V11`,...Vp})]}),cohortAdd:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d:`M2.5 4h7M2.5 7.5h5M2.5 11h4`,...Vp}),(0,B.jsx)(`path`,{d:`M11.5 8.5v5M9 11h5`,...Vp})]})};function Yne({name:e}){return(0,B.jsx)(`svg`,{...qne,"aria-hidden":!0,children:Jne[e]})}function Hp({icon:e,text:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:typeof e==`string`?(0,B.jsx)(Yne,{name:e}):e}),(0,B.jsx)(`span`,{className:`cg-mi-text`,children:t})]})}function Up({size:e=14}){return(0,B.jsxs)(`svg`,{className:`cg-eyeoff-icon`,width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M2.5 8s2-3.5 5.5-3.5S13.5 8 13.5 8s-2 3.5-5.5 3.5S2.5 8 2.5 8Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M9.6 8a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0Z`,stroke:`currentColor`,strokeWidth:1.4,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M3.3 12.7 12.7 3.3`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`})]})}function Wp({size:e=11}){return(0,B.jsxs)(`svg`,{className:`cg-lock-mark`,width:e,height:e,viewBox:`0 0 16 16`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M4.2 7.2h7.6v5.6H4.2z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M5.9 7.2V5.5a2.1 2.1 0 0 1 4.2 0v1.7`,fill:`none`,stroke:`currentColor`,strokeWidth:1.35,strokeLinecap:`round`})]})}function Gp({icon:e,size:t=14}){let n=e?.shape??`folder`,r=Bf[e?.tone??`neutral`];return(0,B.jsx)(`svg`,{className:`cg-folder-mark`,width:t,height:t,viewBox:`0 0 16 16`,"aria-hidden":!0,children:Mte[n].map((e,t)=>(0,B.jsx)(`path`,{d:e.d,fill:`none`,stroke:r.stroke,strokeWidth:1.35,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function Kp({item:e}){return e.icon?(0,B.jsx)(B.Fragment,{children:e.icon}):e.type?(0,B.jsx)(Rp,{type:e.type,title:e.type===`measure`?`Metric`:Hf[e.type]}):(0,B.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0})}function Xne(){return(0,B.jsx)(`svg`,{className:`cg-fsel-caret`,width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M4 6l4 4 4-4`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Zne(){return(0,B.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:1.6,strokeLinecap:`round`,strokeLinejoin:`round`})})}var qp=8;function Jp({fields:e,value:t,onChange:n,placeholder:r=`Choose a field…`,allow:i,ariaLabel:a,className:o,disabled:s,title:c,keepOpen:l,overlayAutofocus:u}){let[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``),h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=(0,L.useMemo)(()=>i?e.filter(e=>e.type!=null&&i.includes(e.type)):e,[e,i]),v=t!=null,y=v?e.find(e=>e.key===t):void 0,b=p.trim().toLowerCase(),x=b?_.filter(e=>e.label.toLowerCase().includes(b)):_,S=()=>{f(!1),m(``)},C=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(g.current?.querySelectorAll(`button.cg-type-row`)??[]).filter(e=>!e.disabled);if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);if(e.key===`Home`)return t[0].focus();if(e.key===`End`)return t[t.length-1].focus();let r=e.key===`ArrowDown`?1:-1;t[n<0?r===1?0:t.length-1:(n+r+t.length)%t.length].focus()},w;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{ref:h,type:`button`,disabled:s,className:`cg-select cg-fsel`+(y?``:v&&t!==``?` is-missing`:` is-empty`)+(o?` ${o}`:``),"aria-label":a,"aria-haspopup":`listbox`,"aria-expanded":d,"data-overlay-autofocus":u?!0:void 0,onClick:()=>f(e=>!e),children:[y?(0,B.jsx)(Kp,{item:y}):(0,B.jsx)(`span`,{className:`cg-fsel-nomark`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`cg-fsel-label`,children:y?.label??(v&&t!==``?t:r)}),(0,B.jsx)(Xne,{})]}),d&&h.current&&(0,B.jsx)(Ip,{anchor:h.current,className:`cg-pop cg-fsel-pop`,onDismiss:S,role:`dialog`,ariaLabel:a??c??`Choose a field`,initialFocus:_.length>=qp?`.cg-fsel-search input`:`button.cg-type-row`,dataKind:`field-select`,children:(0,B.jsxs)(`div`,{className:`cg-fsel-body`,onKeyDown:C,children:[c&&(0,B.jsx)(`div`,{className:`cg-pop-title`,children:c}),_.length>=qp&&(0,B.jsxs)(`div`,{className:`cg-type-search cg-fsel-search`,children:[(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,B.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,B.jsx)(`input`,{type:`text`,value:p,placeholder:`Find a field…`,"aria-label":`Find a field`,onChange:e=>m(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,ref:g,"aria-label":a??c??`Fields`,children:[x.map(e=>{let r=e.group&&e.group!==w?e.group:null;return w=e.group,(0,B.jsxs)(L.Fragment,{children:[r&&(0,B.jsx)(`div`,{className:`cg-fsel-group`,role:`presentation`,children:r}),(0,B.jsxs)(`button`,{type:`button`,role:`option`,disabled:e.disabled,"aria-selected":e.key===t,className:`cg-type-row`+(e.key===t?` is-on`:``),onClick:()=>{n(e.key),l?m(``):S()},children:[(0,B.jsx)(Kp,{item:e}),(0,B.jsxs)(`span`,{className:`cg-type-label`,children:[e.label,e.hint&&(0,B.jsx)(`span`,{className:`cg-fsel-hint`,children:e.hint})]}),e.key===t&&(0,B.jsx)(Zne,{})]})]},e.key)}),x.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:_.length===0?`No field to choose here.`:`No field matches.`})]})]})})]})}function Yp(e,t){let n=e=>e.toLocaleString();if(!t?.windowed)return`${n(e)} ${e===1?`record`:`records`}`;let r=t.matched===1?`record`:`records`,i=t.matched=t.matched?`${n(t.matched)} ${r}${i}`:`showing ${n(t.shown)} of ${n(t.matched)} ${r}${i}`}function Xp(e){if(!e?.partial)return null;let t=typeof e.loaded==`number`&&Number.isFinite(e.loaded)&&e.loaded>=0?Math.floor(e.loaded):0,n=typeof e.total==`number`&&Number.isFinite(e.total)&&e.total>0?Math.floor(e.total).toLocaleString():`…`;return`${t.toLocaleString()} of ${n}`}function Qne(e,t){if(!t?.windowed)return Yp(e,t);let n=e=>e.toLocaleString();return t.shown>=t.matched?`${n(t.matched)} ${t.matched===1?`record`:`records`}`:`showing ${n(t.shown)} of ${n(t.matched)}`}function Zp({window:e,onWindow:t,kinds:n=Pu}){let r=e.kind;return(0,B.jsxs)(`span`,{className:`cg-cond-window`,children:[(0,B.jsx)(`select`,{className:`cg-select cg-cond-win-kind`,value:r,"aria-label":`Date window`,onChange:n=>{let r=n.target.value;Fu.has(r)?t({kind:r,n:e.n??30}):t(r===`custom`?{kind:r,from:e.from??``,to:e.to??``}:{kind:r})},children:(n.includes(r)?n:[...n,r]).map(e=>(0,B.jsx)(`option`,{value:e,children:Fu.has(e)?Iu[e].replace(`{n}`,`N`):Iu[e]},e))}),Fu.has(r)&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:1,max:3650,"aria-label":`Number of days`,value:e.n??``,onChange:n=>t({...e,n:n.target.value===``?void 0:Number(n.target.value)})}),r===`custom`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window start`,value:e.from??``,onChange:n=>t({...e,from:n.target.value})}),(0,B.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-date`,type:`date`,"aria-label":`Window end`,value:e.to??``,onChange:n=>t({...e,to:n.target.value})})]})]})}var Qp=ld,$p=ud;function em(e){return e===`checkbox`?[`isNotEmpty`,`isEmpty`]:Qp(e)?[`gte`,`gt`,`lte`,`lt`,`eq`,`neq`,`between`,`isEmpty`,`isNotEmpty`]:$p(e)?[`eq`,`within`,`lt`,`gt`,`lte`,`gte`,`neq`,`isEmpty`,`isNotEmpty`]:e===`status`||e===`select`||e===`user`?[`eq`,`neq`,`isEmpty`,`isNotEmpty`]:[`contains`,`doesNotContain`,`eq`,`neq`,`isEmpty`,`isNotEmpty`]}var $ne={topN:`top N`,bottomN:`bottom N`,inTopPct:`top N%`,inBottomPct:`bottom N%`,aboveAvg:`above average`,belowAvg:`below average`,inQuartile:`in quartile`,inDecile:`in decile`};function ere(e){switch(e){case`topN`:case`bottomN`:case`inTopPct`:case`inBottomPct`:case`inDecile`:return`10`;case`inQuartile`:return`4`;default:return``}}function tm(e){for(let t of e??[]){if(bd(t)){if(tm(t.children))return!0;continue}if(fd(t.op)&&!yd(t))return!0}return!1}function nm(e,t){if(fd(e))return $ne[e]??e;if(t===`checkbox`){if(e===`isNotEmpty`)return`is checked`;if(e===`isEmpty`)return`is unchecked`}if(e===`isEmpty`)return`is empty`;if(e===`isNotEmpty`)return`is not empty`;if($p(t))switch(e){case`eq`:return`is`;case`neq`:return`is not`;case`within`:return`is within`;case`lt`:return`is before`;case`lte`:return`is on or before`;case`gt`:return`is after`;case`gte`:return`is on or after`;case`between`:return`is between`}if(Qp(t))switch(e){case`gte`:return`≥`;case`gt`:return`>`;case`lte`:return`≤`;case`lt`:return`<`;case`eq`:return`=`;case`neq`:return`≠`;case`between`:return`is between`;default:return e}if(t===`multiselect`)switch(e){case`contains`:return`has`;case`doesNotContain`:return`does not have`;case`eq`:return`is exactly`;case`neq`:return`is not exactly`;default:return e}switch(e){case`contains`:return`contains`;case`doesNotContain`:return`does not contain`;case`eq`:return`is`;case`neq`:return`is not`;default:return e}}function tre(e,t){return t&&!e.includes(t)?[...e,t]:[...e]}function nre(e){return e===`or`?`Any of the following are true…`:`All of the following are true…`}var rm=[...jee],im=[...Mee],am=[...Eee];function rre(e){switch(hd(e)){case`allOf`:return`is all of`;case`noneOf`:return`is none of`;default:return`is any of`}}var om=`measure`,sm={kind:`ltm`},cm={kind:`past_month`},ire=[`last_n_days`,`past_week`,`past_month`,`past_year`,`this_week`,`this_month`,`this_year`,`custom`];function are(e,t,n,r,i){let a=e.map(e=>({key:e.key,label:e.label,type:e.type})),o=new Set(a.map(e=>e.key));if(!t||o.has(t)||r.has(t)||t===`__cohort__`&&i)return a;let s=n.get(t);return a.push({key:t,label:s?s.label:t,type:s?.type}),a}var lm=0;function um(){return lm+=1,`r${Date.now().toString(36)}${lm.toString(36)}`}function dm(e){let t=e[0];return t?{colId:t.key,op:em(t.type)[0],value:``}:null}function fm(e){let t=0;for(let n of e)t+=bd(n)?fm(n.children):1;return t}function ore({rule:e,onPatch:t}){let n=e.dateMode??`exact`;return(0,B.jsxs)(`span`,{className:`cg-cond-anchor`,children:[(0,B.jsx)(`select`,{className:`cg-select cg-cond-anchor-mode`,value:n,"aria-label":`Date`,onChange:e=>{let n=e.target.value;t({dateMode:n,value:``})},children:Lu.map(e=>(0,B.jsx)(`option`,{value:e,children:e===`n_days_ago`?Ru[e].replace(`{n}`,`N`):Ru[e]},e))}),n===`n_days_ago`&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-win-n`,type:`number`,min:0,max:3650,"aria-label":`Number of days ago`,value:e.value,onChange:e=>t({value:e.target.value})}),n===`exact`&&(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`date`,"aria-label":`Date`,value:e.value,onChange:e=>t({value:e.target.value})})]})}function sre({rule:e,options:t,isMeasure:n,onPatch:r}){let i=e.rhs,a=_d(i)??``;return(0,B.jsxs)(`span`,{className:`cg-cond-rhs`,children:[(0,B.jsx)(Jp,{className:`cg-cond-field`,ariaLabel:`Compare with field`,placeholder:`Select a field…`,value:a||void 0,fields:t,onChange:e=>{r({rhs:n?{kind:`measure`,colId:e,window:i?.kind===`measure`&&i.window||sm}:{kind:`field`,colId:e}})}}),n&&a!==``&&(0,B.jsx)(Zp,{window:i?.kind===`measure`&&i.window||sm,onWindow:e=>r({rhs:{kind:`measure`,colId:a,window:e}})})]})}function cre({rule:e,type:t,statusOptions:n,onValue:r,onValue2:i}){if(e.op===`between`){let n=t===`date`||t===`created_time`?`date`:`number`;return(0,B.jsxs)(`span`,{className:`cg-cond-between`,children:[(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value,onChange:e=>r(e.target.value)}),(0,B.jsx)(`span`,{className:`cg-cond-and`,children:`and`}),(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:n,value:e.value2??``,onChange:e=>i(e.target.value)})]})}return t===`status`||t===`select`||t===`user`||t===`multiselect`?(0,B.jsxs)(`select`,{className:`cg-select cg-cond-val`,value:e.value,onChange:e=>r(e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:`Select…`}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}):(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:t===`date`||t===`created_time`?`date`:Qp(t)?`number`:`text`,placeholder:`Value`,value:e.value,onChange:e=>r(e.target.value)})}function lre({rule:e,onValue:t}){let n=e.op===`inQuartile`?4:e.op===`inDecile`?10:0;if(n)return(0,B.jsx)(`select`,{className:`cg-select cg-cond-val`,value:e.value,"aria-label":e.op===`inQuartile`?`Quartile`:`Decile`,onChange:e=>t(e.target.value),children:Array.from({length:n},(e,t)=>String(t+1)).map(e=>(0,B.jsx)(`option`,{value:e,children:e===`1`?`${e} (lowest)`:e===String(n)?`${e} (highest)`:e},e))});let r=e.op===`inTopPct`||e.op===`inBottomPct`;return(0,B.jsx)(`input`,{className:`cg-input cg-cond-val`,type:`number`,min:1,max:r?100:1e4,step:1,placeholder:`10`,"aria-label":r?`Percent`:`How many`,value:e.value,onChange:e=>t(e.target.value)})}function ure({rule:e,lists:t,onPatch:n}){let r=gd(e.value),i=new Map(t.map(e=>[e.id,e.name])),a=t.filter(e=>!r.includes(e.id)),o=a.length>0&&r.length<20,s=e=>n({value:e.join(`,`)});return(0,B.jsxs)(`span`,{className:`cg-cond-cohorts`,children:[r.map(e=>(0,B.jsxs)(`span`,{className:`cg-chip`+(i.has(e)?``:` cg-chip--gone`),children:[(0,B.jsx)(`span`,{className:`cg-chip-text`,children:i.get(e)??`(deleted list)`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-chip-x`,"aria-label":`Remove ${i.get(e)??e}`,onClick:()=>s(r.filter(t=>t!==e)),children:`×`})]},e)),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-val cg-cond-cohort-add`,value:``,"aria-label":`Cohort`,disabled:!o,onChange:e=>e.target.value&&s([...r,e.target.value]),children:[(0,B.jsx)(`option`,{value:``,children:o?r.length?`Add a cohort…`:`Select a cohort…`:`all added`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}function dre({index:e,conj:t,onConj:n}){return e===0?(0,B.jsx)(`span`,{className:`cg-cond-prefix`,children:`Where`}):e===1?(0,B.jsxs)(`select`,{className:`cg-select cg-cond-conj`,value:t,"aria-label":`Combine conditions with`,onChange:e=>n(e.target.value),children:[(0,B.jsx)(`option`,{value:`and`,children:`and`}),(0,B.jsx)(`option`,{value:`or`,children:`or`})]}):(0,B.jsx)(`span`,{className:`cg-cond-prefix cg-cond-conj-echo`,children:t})}function pm({nodes:e,conj:t,depth:n,ctx:r,onNodes:i,onConj:a}){let[o,s]=(0,L.useState)(null),c=(t,n)=>i(e.map((e,r)=>r===t?n:e)),l=t=>i(e.filter((e,n)=>n!==t)),u=()=>{let t=dm(r.fields);t&&i([...e,t])},d=()=>{let t=dm(r.fields);t&&i([...e,{conj:`or`,children:[t]}])},f=n<3;return(0,B.jsxs)(B.Fragment,{children:[e.map((e,i)=>(0,B.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,B.jsx)(dre,{index:i,conj:t,onConj:a}),bd(e)?(0,B.jsx)(pre,{group:e,depth:n+1,ctx:r,onGroup:e=>c(i,e),onRemove:()=>l(i)}):(0,B.jsx)(fre,{rule:e,ctx:r,onRule:e=>c(i,e),onRemove:()=>l(i)})]},i)),(0,B.jsxs)(`div`,{className:`cg-builder-add`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`condition`?` is-on`:``),onClick:()=>{s(`condition`),u()},children:`+ Add condition`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`+(o===`group`?` is-on`:``),onClick:()=>{s(`group`),d()},disabled:!f,title:f?`Group conditions so they evaluate together`:`Condition groups can nest 3 levels deep`,children:`+ Add condition group`})]})]})}function fre({rule:e,ctx:t,onRule:n,onRemove:r}){let{fields:i,fieldByKey:a,measures:o,measureByKey:s,lists:c,choicesFor:l}=t,u=yd(e),d=e.colId===md,f=c.length>0,p=u?s.get(e.colId)?.type??`currency`:a.get(e.colId)?.type??`text`,m=t=>n({...e,...t}),h=t=>{if(t===`__cohort__`){n({colId:md,op:am[0],value:``});return}if(s.get(t)){n({id:e.id??um(),colId:t,op:rm[0],value:``,value2:void 0,window:e.window??sm});return}n({colId:t,op:em(a.get(t)?.type??`text`)[0],value:``,value2:void 0})},g=t=>{if(d)return m({op:t});if(fd(t))return n({...e,op:t,value:ere(t),value2:void 0,rhs:void 0,dateWindow:void 0});if(pd.has(t))return n({...e,op:t,value:``,value2:void 0,rhs:void 0});if(t===`within`)return n({...e,op:t,value:``,value2:void 0,rhs:void 0,dateWindow:e.dateWindow??cm});if(e.op===`within`)return n({...e,op:t,dateWindow:void 0,value:``});m({op:t})},_=u?o.map(e=>({key:e.key,label:e.label,type:om})):i.filter(t=>t.key!==e.colId&&(Qp(p)?Qp(t.type):t.type===p)).map(e=>({key:e.key,label:e.label,type:e.type})),v=!d&&e.op!==`within`&&!pd.has(e.op)&&!fd(e.op)&&_.length>0&&(u||Qp(p)||$p(p)),y=e.rhs?.kind===`stat`,b=e.rhs!=null&&!y,x=u?b||y?im:rm:d?am:em(p),S=d?hd(e.op):e.op,C=tre(!u&&!d&&Qp(p)?[...x,...Cee]:x,S),w=C.filter(e=>!fd(e)),T=C.filter(e=>fd(e));return(0,B.jsxs)(`span`,{className:`cg-cond-row`+(u?` is-measure`:``)+(d?` is-cohort`:``)+(e.rhs==null?``:` has-rhs`),children:[(0,B.jsx)(Jp,{className:`cg-cond-field`,ariaLabel:`Field`,value:e.colId,onChange:h,fields:[...are(i,e.colId,a,s,f),...o.map(e=>({key:e.key,label:e.label,type:om})),...f?[{key:md,label:`Cohort`,type:`multiselect`}]:[]]}),u&&(0,B.jsx)(Zp,{window:e.window??sm,onWindow:e=>m({window:e})}),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:S,"aria-label":`Condition`,onChange:e=>g(e.target.value),children:[w.map(e=>(0,B.jsx)(`option`,{value:e,children:d?rre(e):nm(e,p)},e)),T.length>0&&(0,B.jsx)(`optgroup`,{label:`Ranked`,children:T.map(e=>(0,B.jsx)(`option`,{value:e,children:nm(e,p)},e))})]}),v&&(0,B.jsxs)(`select`,{className:`cg-select cg-cond-mode`,value:y?`stat`:b?`field`:`value`,"aria-label":`Compare against`,onChange:t=>{let n=t.target.value;if(n===`stat`)return m({rhs:{kind:`stat`,stat:`median`},value:``,value2:void 0,op:im.includes(e.op)?e.op:im[1]});if(n===`field`)return m({rhs:u?{kind:`measure`,colId:``,window:sm}:{kind:`field`,colId:``},value:``,value2:void 0});m({rhs:void 0,value:``})},children:[(0,B.jsx)(`option`,{value:`value`,children:`a value`}),(0,B.jsx)(`option`,{value:`field`,children:`another field`}),u&&(0,B.jsx)(`option`,{value:`stat`,children:`a statistic`})]}),pd.has(e.op)?(0,B.jsx)(`span`,{className:`cg-cond-val cg-cond-noval`,"aria-hidden":!0}):y?(0,B.jsx)(`select`,{className:`cg-select cg-cond-val cg-cond-stat`,value:e.rhs?.kind===`stat`?e.rhs.stat:`median`,"aria-label":`Statistic`,onChange:e=>m({rhs:{kind:`stat`,stat:e.target.value}}),children:Oee.map(e=>(0,B.jsx)(`option`,{value:e,children:kee[e]},e))}):b?(0,B.jsx)(sre,{rule:e,options:_,isMeasure:u,onPatch:m}):d?(0,B.jsx)(ure,{rule:e,lists:c,onPatch:m}):fd(e.op)?(0,B.jsx)(lre,{rule:e,onValue:e=>m({value:e})}):e.op===`within`?(0,B.jsx)(Zp,{window:e.dateWindow??cm,onWindow:e=>m({dateWindow:e}),kinds:ire}):$p(p)?(0,B.jsx)(ore,{rule:e,onPatch:m}):(0,B.jsx)(cre,{rule:e,type:p,statusOptions:l(e.colId),onValue:e=>m({value:e}),onValue2:e=>m({value2:e})}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition`,onClick:r,children:`×`})]})}function pre({group:e,depth:t,ctx:n,onGroup:r,onRemove:i}){return(0,B.jsxs)(`span`,{className:`cg-cond-group`,"data-depth":t,children:[(0,B.jsxs)(`span`,{className:`cg-cond-group-head`,children:[(0,B.jsx)(`span`,{className:`cg-cond-group-sum`,children:e.children.length?nre(e.conj):`Add a condition to this group…`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove condition group`,onClick:i,children:`×`})]}),(0,B.jsx)(`span`,{className:`cg-cond-group-body`,children:(0,B.jsx)(pm,{nodes:e.children,conj:e.conj,depth:t,ctx:n,onNodes:t=>r({...e,children:t}),onConj:t=>r({...e,conj:t})})})]})}function mm({fields:e,filters:t,onChange:n,cohorts:r=[],measures:i=[],userOptions:a,statusValues:o,cohortLock:s,footerExtra:c}){let l=xd(t),u=Sd(t),d=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),f=(0,L.useMemo)(()=>mee(e),[e]),p=(0,L.useMemo)(()=>{let e=new Map;for(let t of i)e.set(t.key,t);return e},[i]),m=(0,L.useCallback)(e=>{let t=o?.[e];if(t)return t;let n=d.get(e);return n?n.type===`user`?a??[]:nd(n):[]},[o,d,a]),h=(0,L.useMemo)(()=>({fields:f,fieldByKey:d,measures:i,measureByKey:p,lists:r,choicesFor:m}),[f,d,i,p,r,m]);return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Filter`}),s&&(0,B.jsx)(`div`,{className:`cg-flt-lockchip`,children:s.name?`Customer list locked to ${s.name}`+(typeof s.count==`number`?` · ${s.count.toLocaleString()} ${s.count===1?`customer`:`customers`}`:``):`Customer list locked to a set you cannot see`}),l.length===0?(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No conditions. Add one to narrow the list.`}):(0,B.jsx)(`div`,{className:`cg-builder-caption`,children:`In this view, show records`}),(0,B.jsx)(pm,{nodes:l,conj:u,depth:1,ctx:h,onNodes:e=>n({conj:u,nodes:e}),onConj:e=>n({conj:e,nodes:l})}),tm(l)&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Ranked among the records your other conditions keep — so “top 10” inside a filtered view means the top 10 of that view. Records with no value are not ranked at all. Quartiles and deciles are equal-size slices BY RANK, not by value.`}),(l.length>0||c)&&(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[l.length>0&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>n({conj:u,nodes:[]}),children:`Clear all`}),c]})]})}function hm({fields:e,hidden:t,onToggle:n,onHideAll:r,onShowAll:i,lockedKey:a,onFieldOrder:o,deletableKeys:s,onDeleteField:c}){let[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),_=l.trim().toLowerCase(),v=_?e.filter(e=>e.label.toLowerCase().includes(_)):e,y=!!o&&_===``,b=(t,n)=>{if(t===n||t===a||n===a)return null;let r=e.map(e=>e.key),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return null;let s=r.slice();return s.splice(i,1),s.splice(o,0,t),s},x=(t,n)=>{if(!y)return;let r=e.map(e=>e.key),i=r[r.indexOf(t)+n];if(i===void 0)return;let a=b(t,i);a&&o(a)};return(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Hide fields`}),(0,B.jsx)(`input`,{type:`text`,className:`cg-input cg-fields-search`,placeholder:`Find a field…`,"aria-label":`Find a field`,value:l,onChange:e=>u(e.target.value)}),(0,B.jsxs)(`div`,{className:`cg-pop-list`,children:[v.map(e=>{let r=a!==void 0&&e.key===a,i=!t.has(e.key),l=!!c&&!!s?.has(e.key),u=d===e.key;return(0,B.jsxs)(`label`,{className:`cg-check-row`+(i?``:` is-off`)+(r?` is-locked`:``)+(p===e.key?` is-dragging`:``)+(h===e.key&&p!==null&&p!==e.key?` is-drop-target`:``),title:r?`Always visible`:void 0,onDragOver:y&&p&&p!==e.key?t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,h!==e.key&&g(e.key)}:void 0,onDrop:y&&p?t=>{t.preventDefault(),t.stopPropagation();let n=b(p,e.key);m(null),g(null),n&&o(n)}:void 0,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-field-grip`,draggable:y&&!r,"aria-label":r?`${e.label} is always first`:y?`Reorder ${e.label} — drag, or use the arrow keys`:`Reorder ${e.label} (clear the search first)`,title:y&&!r?`Drag to reorder, or use the arrow keys`:r?`This column is always first`:`Clear the search to reorder`,onDragStart:t=>{t.dataTransfer.setData(`text/plain`,e.key),t.dataTransfer.effectAllowed=`move`,m(e.key)},onDragEnd:()=>{m(null),g(null)},onClick:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:t=>{t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),t.stopPropagation(),x(e.key,t.key===`ArrowUp`?-1:1))},children:(0,B.jsx)(`svg`,{width:`10`,height:`16`,viewBox:`0 0 10 16`,"aria-hidden":!0,focusable:`false`,children:[4,8,12].map(e=>[2.5,7.5].map(t=>(0,B.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}),(0,B.jsx)(`input`,{type:`checkbox`,checked:i,disabled:r,onChange:()=>n(e.key)}),(0,B.jsx)(Rp,{type:e.type,title:Hf[e.type]}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.label}),e.source===`odoo`&&!e.custom&&(0,B.jsx)(`span`,{className:`cg-preset-tag`,children:`Pre-set`}),e.scope===`cohort`&&(0,B.jsx)(`span`,{className:`cg-preset-tag cg-scope-tag`,children:`Cohort-only`}),r&&(0,B.jsx)(`span`,{className:`cg-lock-tag`,children:`Locked`}),l&&(0,B.jsx)(`button`,{type:`button`,className:`cg-check-del`+(u?` is-armed`:``),"aria-label":u?`Permanently delete ${e.label}?`:`Delete ${e.label}`,title:u?void 0:`Removes this field and its values on every row.`,onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!u){f(e.key);return}f(null),c(e.key)},children:u?`Delete permanently?`:(0,B.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M3.5 4.5h9M6.5 4.5V3h3v1.5M5 4.5l.6 8.5h4.8l.6-8.5`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`})})})]},e.key)}),v.length===0&&(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No field matches your search.`})]}),(i||r)&&(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-fields-footer`,children:[i&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:i,children:`Show all`}),r&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:r,children:`Hide all`})]})]})}var mre={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function hre(){return(0,B.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M4 6l4 4 4-4`,...mre})})}function gm({label:e,icon:t,active:n,tone:r,wide:i,measureWide:a,pairWide:o,forceOpenSignal:s,children:c}){let[l,u]=(0,L.useState)(!1),d=(0,L.useRef)(null),f=(0,L.useId)();return(0,L.useEffect)(()=>{s&&s>0&&u(!0)},[s]),(0,B.jsxs)(`div`,{className:`cg-pop-wrap`,children:[(0,B.jsxs)(`button`,{ref:d,type:`button`,className:`cg-tb-btn`+(r?` cg-tb-btn--${r}`:``)+(n||l?` is-active`:``),onClick:()=>u(e=>!e),"aria-expanded":l,"aria-haspopup":`dialog`,"aria-controls":l?f:void 0,title:e,"aria-label":e,children:[t,(0,B.jsx)(`span`,{className:`cg-tb-label`,children:e}),(0,B.jsx)(hre,{})]}),l&&d.current&&(0,B.jsx)(Ip,{anchor:d.current,className:`cg-pop`+(i?` cg-pop--wide`:``)+(a?` cg-pop--measures`:``)+(o?` cg-pop--pair`:``),onDismiss:()=>u(!1),role:`dialog`,ariaLabel:`${e} options`,id:f,dataKind:`toolbar-${e.split(` `)[0].toLowerCase()}`,children:c(()=>u(!1))})]})}var _m={width:14,height:14,viewBox:`0 0 16 16`,fill:`none`},vm={stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`};function gre(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`,...vm}),(0,B.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`,...vm}),(0,B.jsx)(`line`,{x1:`10.5`,y1:`3`,x2:`10.5`,y2:`13`,...vm})]})}function ym(){return(0,B.jsx)(`svg`,{..._m,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M2.5 4h11L9.5 9v3.5L6.5 14V9L2.5 4Z`,...vm})})}function bm(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M5 3v10M5 13l-2-2M5 13l2-2`,...vm}),(0,B.jsx)(`path`,{d:`M11 13V3M11 3l-2 2M11 3l2 2`,...vm})]})}function _re(){return(0,B.jsx)(`svg`,{..._m,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M8 2s4.5 4.2 4.5 7a4.5 4.5 0 0 1-9 0C3.5 6.2 8 2 8 2Z`,...vm})})}function xm(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`5`,x2:`13.5`,y2:`5`,...vm}),(0,B.jsx)(`line`,{x1:`2.5`,y1:`8`,x2:`13.5`,y2:`8`,...vm}),(0,B.jsx)(`line`,{x1:`2.5`,y1:`11`,x2:`13.5`,y2:`11`,...vm})]})}function Sm(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`line`,{x1:`2.5`,y1:`4`,x2:`13.5`,y2:`4`,...vm}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`8`,x2:`13.5`,y2:`8`,...vm}),(0,B.jsx)(`line`,{x1:`5.5`,y1:`12`,x2:`13.5`,y2:`12`,...vm})]})}function vre(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{x:`3.5`,y:`7`,width:`9`,height:`6`,rx:`1.2`,...vm}),(0,B.jsx)(`path`,{d:`M5.75 7V5.25a2.25 2.25 0 0 1 4.5 0V7`,...vm})]})}function yre(){return(0,B.jsxs)(`svg`,{..._m,"aria-hidden":!0,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4`,...vm}),(0,B.jsx)(`line`,{x1:`10.2`,y1:`10.2`,x2:`13.5`,y2:`13.5`,...vm})]})}var bre={filters:(0,B.jsx)(ym,{}),sorts:(0,B.jsx)(bm,{}),groupBy:(0,B.jsx)(Sm,{}),visible:(0,B.jsx)(Up,{}),order:(0,B.jsx)(gre,{}),rowHeightMode:(0,B.jsx)(xm,{})};function xre({views:e,lockedKey:t,onApply:n,onClose:r}){let[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(()=>new Set([`filters`])),c=e.find(e=>e.id===i),l=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-copycfg`,children:[(0,B.jsxs)(`div`,{className:`cg-copycfg-head`,children:[(0,B.jsx)(`span`,{children:`Copy configuration from`}),(0,B.jsx)(Jp,{className:`cg-copycfg-source`,ariaLabel:`View to copy from`,placeholder:`Choose a view…`,value:i||void 0,onChange:a,fields:e.map(e=>({key:e.id,label:e.name,icon:(0,B.jsx)(zp,{mode:Td(e)})}))}),(0,B.jsx)(`span`,{children:`to this view`})]}),(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Select what to copy. This view keeps everything else.`}),(0,B.jsx)(`div`,{className:`cg-pop-list`,children:Dp.map(e=>(0,B.jsxs)(`label`,{className:`cg-check-row`,title:e.blurb,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o.has(e.key),onChange:()=>l(e.key)}),(0,B.jsx)(`span`,{className:`cg-mi-ic`,"aria-hidden":!0,children:bre[e.key]}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.label})]},e.key))}),(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-copycfg-bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set(Op)),children:`Select all`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>s(new Set),children:`Clear all`})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions cg-copycfg-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!c||o.size===0,title:c?o.size===0?`Choose at least one thing to copy`:void 0:`Choose the view to copy from`,onClick:()=>{c&&(n(Vne(c.config,o,t)),r())},children:`Copy configuration`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:r,children:`Cancel`})]})]})}function Sre({views:e,lockedKey:t,onApply:n}){let[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(null);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{ref:a,type:`button`,className:`cg-link-btn cg-copy-link`+(r?` is-on`:``),"aria-expanded":r,onClick:()=>i(e=>!e),children:`Copy from another view`}),r&&a.current&&(0,B.jsx)(Ip,{anchor:a.current,className:`cg-pop cg-copycfg-pop`,placement:`bottom-end`,onDismiss:()=>i(!1),role:`dialog`,ariaLabel:`Copy configuration from another view`,dataKind:`copy-config`,children:(0,B.jsx)(xre,{views:e,lockedKey:t,onApply:n,onClose:()=>i(!1)})})]})}function Cre({fields:e,fieldByKey:t,sorts:n,onSorts:r}){let i=(e,t)=>r(n.map((n,r)=>r===e?{...n,...t}:n)),a=e=>r(n.filter((t,n)=>n!==e));return(0,B.jsxs)(`div`,{className:`cg-pop-body cg-builder`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Sort`}),n.length===0&&(0,B.jsx)(`div`,{className:`cg-builder-empty`,children:`No sorts. Add one to order the list.`}),n.map((n,r)=>{let o=t.get(n.colId)?.type??`text`;return(0,B.jsxs)(`div`,{className:`cg-cond-line`,children:[(0,B.jsx)(`span`,{className:`cg-cond-prefix`,children:r===0?`Sort by`:`then by`}),(0,B.jsxs)(`span`,{className:`cg-cond-row`,children:[(0,B.jsx)(Jp,{className:`cg-cond-field`,ariaLabel:`Sort field`,value:n.colId,onChange:e=>i(r,{colId:e}),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))}),(0,B.jsxs)(`select`,{className:`cg-select cg-cond-op`,value:n.dir,"aria-label":`Sort direction`,onChange:e=>i(r,{dir:e.target.value}),children:[(0,B.jsx)(`option`,{value:`asc`,children:dd(o,`asc`)}),(0,B.jsx)(`option`,{value:`desc`,children:dd(o,`desc`)})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-cond-x`,"aria-label":`Remove sort`,onClick:()=>a(r),children:`×`})]})]},r)}),(0,B.jsxs)(`div`,{className:`cg-pop-footer cg-builder-footer`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>{let t=new Set(n.map(e=>e.colId)),i=e.find(e=>!t.has(e.key))??e[0];i&&r([...n,{colId:i.key,dir:`asc`}])},children:`+ Add another sort`}),n.length>0&&(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>r([]),children:`Clear`})]})]})}var wre=[{mode:`short`,label:`Short`},{mode:`medium`,label:`Medium`},{mode:`tall`,label:`Tall`}];function Tre({fields:e,visible:t,nouns:n=`customers`,lockedKey:r,onColumnVisible:i,onColumnsVisible:a,orderedFields:o,onFieldOrder:s,deletableKeys:c,onDeleteField:l,colorOn:u,onToggleColor:d,rowHeightMode:f,onRowHeightMode:p,filters:m,onFilters:h,filterConj:g,onFilterConj:_,sorts:v,onSorts:y,groupBy:b,onGroupBy:x,statusValues:S,measures:C=[],pendingMeasureCount:w=0,unresolvedCount:T=0,lists:E=[],cohortLock:D,copyViews:O,onCopyConfig:k,search:A,onSearch:j,recordCount:M,scopeCounts:ee,pool:N,serverWindowed:te=!1,cohortAction:ne,filterSeed:P=null,modeControl:re}){let F=e.filter(e=>t.has(e.key)).length,ie=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.key,n);return t},[e]),ae=(0,L.useMemo)(()=>{let e=new Map;for(let t of C)e.set(t.key,t);return e},[C]),oe=o??e,se=(0,L.useMemo)(()=>new Set(oe.filter(e=>!t.has(e.key)).map(e=>e.key)),[oe,t]),ce=(0,L.useMemo)(()=>({conj:g,nodes:m}),[g,m]),le=e=>{let t=xd(e),n=Sd(e);t!==m&&h(t),n!==g&&_(n)},ue=dte(D?{name:D.name??``,count:D.count??null}:null),de=!!k&&(O?.length??0)>0,fe=(0,L.useMemo)(()=>e.filter(e=>See(e,r)),[e,r]),pe=(0,L.useRef)(0);(0,L.useEffect)(()=>{if(!P||P.n===pe.current)return;if(pe.current=P.n,P.measure){let e=ae.get(P.measure.key);if(!e)return;h([...m,{id:um(),colId:e.key,op:rm[0],value:``,window:P.measure.window}]);return}let e=P.key?ie.get(P.key):void 0;!e||e.filterable===!1||h([...m,{colId:e.key,op:em(e.type)[0],value:``}])},[P,ie,ae,m,h]);let me=(0,L.useMemo)(()=>fm(m),[m]),he=(0,L.useMemo)(()=>{let e=t=>t.some(t=>bd(t)?e(t.children):t.rhs!=null&&t.rhs.kind!==`stat`);return e(m)},[m]),ge=me?`Filter · ${me}`:`Filter`,_e=v.length?`Sort · ${v.length}`:`Sort`,ve=b?`Group: ${ie.get(b)?.label??`?`}`:`Group`;return(0,B.jsxs)(`div`,{className:`cg-toolbar`,children:[re,(0,B.jsx)(gm,{label:`Hide fields`,icon:(0,B.jsx)(Up,{}),active:F(0,B.jsx)(hm,{fields:oe,hidden:se,onToggle:e=>i(e,!t.has(e)),onShowAll:()=>a(e.map(e=>e.key)),onHideAll:()=>a([r]),lockedKey:r,onFieldOrder:s,deletableKeys:c,onDeleteField:l})}),(0,B.jsx)(gm,{label:ge,icon:(0,B.jsx)(ym,{}),active:me>0,tone:`filter`,wide:!0,measureWide:C.length>0,pairWide:he,forceOpenSignal:P?.n,children:()=>(0,B.jsx)(mm,{fields:e,measures:C,cohorts:E,filters:ce,onChange:le,statusValues:S,cohortLock:D,footerExtra:de?(0,B.jsx)(Sre,{views:O,lockedKey:r,onApply:e=>k(e)}):void 0})}),(0,B.jsx)(gm,{label:_e,icon:(0,B.jsx)(bm,{}),active:v.length>0,tone:`sort`,wide:!0,children:()=>(0,B.jsx)(Cre,{fields:e,fieldByKey:ie,sorts:v,onSorts:y})}),(0,B.jsx)(gm,{label:ve,icon:(0,B.jsx)(Sm,{}),active:b!==null,tone:`group`,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Group by`}),te?(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`Not available on this table. It loads one page at a time, so a group would count only the rows currently fetched.`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===null,onChange:()=>x(null)}),(0,B.jsx)(`span`,{children:`No grouping`})]}),fe.map(e=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-group`,checked:b===e.key,onChange:()=>x(e.key)}),(0,B.jsx)(Rp,{type:e.type,title:Hf[e.type]}),(0,B.jsx)(`span`,{children:e.label})]},e.key))]})]})}),ue&&(0,B.jsxs)(`span`,{className:`cg-tb-lock`,title:`This table is locked to a customer list. Filters and sort narrow WITHIN the lock; the lock itself is changed from the view menu in the rail.`,children:[(0,B.jsx)(vre,{}),(0,B.jsx)(`span`,{className:`cg-tb-label`,children:ue})]}),(0,B.jsx)(`span`,{className:`cg-tb-divider`,"aria-hidden":!0}),(0,B.jsx)(gm,{label:`Color`,icon:(0,B.jsx)(_re,{}),active:u,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Color`}),(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:!u,onChange:()=>d(!1)}),(0,B.jsx)(`span`,{children:`No color`})]}),(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-color`,checked:u,onChange:()=>d(!0)}),(0,B.jsx)(`span`,{children:`Color by status`})]})]})}),(0,B.jsx)(gm,{label:`Rows`,icon:(0,B.jsx)(xm,{}),active:f!==`short`,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Row height`}),wre.map(e=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-rowh`,checked:f===e.mode,onChange:()=>p(e.mode)}),(0,B.jsx)(`span`,{children:e.label})]},e.mode))]})}),(0,B.jsxs)(`div`,{className:`cg-search`,children:[(0,B.jsx)(`span`,{className:`cg-search-icon`,"aria-hidden":!0,children:(0,B.jsx)(yre,{})}),(0,B.jsx)(`input`,{type:`text`,className:`cg-search-input`,placeholder:`Search ${n}…`,value:A,onChange:e=>j(e.target.value)}),A&&(0,B.jsx)(`button`,{type:`button`,className:`cg-search-clear`,"aria-label":`Clear search`,onClick:()=>j(``),children:`×`})]}),ne,(0,B.jsx)(`span`,{className:`cg-tb-spacer`}),w>0&&(0,B.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${w} measure condition${w===1?``:`s`} still being calculated over the period you chose. Rows are hidden until the answer arrives rather than shown under a count that would be wrong.`,children:`Calculating…`}),T>0&&(0,B.jsx)(`span`,{className:`cg-count cg-count-pending`,title:`${T} condition${T===1?``:`s`} cannot be evaluated — a date that does not resolve, or a list this view refers to that no longer exists. Rows are hidden rather than shown under a count that would be wrong.`,children:`Filter unresolved`}),Xp(N)==null?(0,B.jsxs)(`span`,{className:`cg-count`,title:Yp(M,ee),children:[(0,B.jsx)(`span`,{className:`cg-count-full`,children:Yp(M,ee)}),(0,B.jsx)(`span`,{className:`cg-count-compact`,children:Qne(M,ee)})]}):(0,B.jsxs)(`span`,{className:`cg-count cg-count-partial`,title:`Loading the rest of your ${n} in the background — you can browse, filter and sort what is already here.`,children:[(0,B.jsx)(`span`,{className:`cg-count-loaddot`,"aria-hidden":!0}),Xp(N)]})]})}function Cm({on:e}){return(0,B.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:(0,B.jsx)(`polygon`,{points:`10,1.8 12.5,7.2 18.4,7.7 13.9,11.6 15.3,17.4 10,14.3 4.7,17.4 6.1,11.6 1.6,7.7 7.5,7.2`,fill:e?`#A98A3E`:`none`,stroke:e?`#A98A3E`:`rgba(118,143,182,0.55)`,strokeWidth:`1.2`,strokeLinejoin:`round`})})}function Ere({value:e,max:t}){return(0,B.jsx)(`span`,{className:`cg-stars cg-stars--static`,"aria-label":`${e} of ${t}`,children:Array.from({length:t},(t,n)=>(0,B.jsx)(Cm,{on:n=0?n.splice(r,1):n.push(t),Are(n)}function Dm(e,t,n){let r=e.type===`user`?t??[]:nd(e),i=r.map(e=>({value:e,label:e})),a=e.type===`multiselect`?Em(n):[wm(n).trim()];for(let e of a)e===``||r.includes(e)||i.push({value:e,label:`${e} (no longer a choice)`,stale:!0});return i}function Om(e){let t=wm(e).trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):``}function Mre(e){let t=e.trim();if(t===``)return``;let n=Number(t);return Number.isFinite(n)?t:null}function km(e,t){let n=Math.round(Number(wm(t)));return Number.isFinite(n)?Math.max(0,Math.min(rd(e),n)):0}function Nre(e,t,n){let r=km(e,t),i=Math.max(1,Math.min(rd(e),Math.round(n)));return i===r?``:String(i)}function Pre(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase():`?`}var Am=[`csv`,`xlsx`,`pdf`,`json`],jm={csv:`CSV`,xlsx:`Excel`,pdf:`PDF`,json:`JSON`};function Fre(e,t,n){let r=(e.trim()||`export`).replace(/[\\/:*?"<>|]/g,`_`);return t?`${r} - ${t}.${n}`:`${r}.${n}`}function Mm(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Ire(e,t){let n=[e.map(e=>Mm(e.label)).join(`,`)];for(let r of t)n.push(e.map(e=>Mm(Sp(e,r[e.key]))).join(`,`));return n.join(`\r `)+`\r -`}function iie(e,t){return JSON.stringify({fields:e.map(e=>({key:e.key,label:e.label,type:e.type})),rows:t.map(t=>{let n={pid:t.pid};for(let r of e)n[r.key]=t[r.key]??null;return n})},null,1)}var aie=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function oie(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function sie(e){let t=e?/^(\d{4})-(\d{2})-(\d{2})/.exec(e):null,n=t?Number(t[1]):2020,r=t?Number(t[2]):1,i=t?Number(t[3]):1;return{date:Math.max(1980,n)-1980<<9|r<<5|i,time:0}}function cie(e,t){let n=new TextEncoder,r=sie(t),i=[],a=[],o=0,s=e=>[e&255,e>>8&255],c=e=>[e&255,e>>8&255,e>>16&255,e>>24&255];for(let t of e){let e=n.encode(t.name),l=oie(t.data),u=new Uint8Array([...c(67324752),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0)]);i.push(u,e,t.data),a.push(new Uint8Array([...c(33639248),...s(20),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0),...s(0),...s(0),...s(0),...c(0),...c(o)]),e),o+=u.length+e.length+t.data.length}let l=o,u=0;for(let e of a)u+=e.length;let d=new Uint8Array([...c(101010256),...s(0),...s(0),...s(e.length),...s(e.length),...c(u),...c(l),...s(0)]),f=o+u+d.length,p=new Uint8Array(f),m=0;for(let e of[...i,...a,d])p.set(e,m),m+=e.length;return p}function Zp(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,``)}function lie(e){return(e.replace(/[[\]:*?/\\]/g,`_`).trim()||`Export`).slice(0,31)}function uie(e,t,n,r){let i=new TextEncoder,a=e=>`${Zp(e)}`,o=e=>`${e.join(``)}`,s=`${[o(e.map(e=>a(e.label))),...t.map(t=>o(e.map(e=>a(pp(e,t[e.key])))))].join(``)}`,c=``;return cie([{name:`[Content_Types].xml`,data:i.encode(``)},{name:`_rels/.rels`,data:i.encode(``)},{name:`xl/workbook.xml`,data:i.encode(c)},{name:`xl/_rels/workbook.xml.rels`,data:i.encode(``)},{name:`xl/worksheets/sheet1.xml`,data:i.encode(s)}],r)}var Qp=792,$p=612,em=36,tm=8,nm=13,rm=17,im=tm*.52,die={"…":133,"–":150,"—":151,"‘":145,"’":146,"“":147,"”":148,"·":183,"€":128,"•":149};function am(e){let t=``;for(let n of e){let e=n.codePointAt(0)??63,r=e<=255?e:die[n]??63,i=String.fromCharCode(r);t+=i===`\\`?`\\\\`:i===`(`?`\\(`:i===`)`?`\\)`:i}return t}function om(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function fie(e,t,n,r){let i=Qp-em*2,a=t.slice(0,200),o=e.map(e=>{let t=e.label.length;for(let n of a)t=Math.max(t,pp(e,n[e.key]).length);return Math.min(170,Math.max(42,t*im+8))}),s=Math.min(1,i/o.reduce((e,t)=>e+t,0)),c=o.map(e=>e*s),l=Math.max(1,Math.floor(($p-em*2-26-rm-14)/nm)),u=Math.max(1,Math.ceil(t.length/l)),d=r?`${n} — ${r}`:n,f=[];for(let n=0;n`${5+t*2} 0 R`).join(` `);p.push(`1 0 obj +`}function Lre(e,t){return JSON.stringify({fields:e.map(e=>({key:e.key,label:e.label,type:e.type})),rows:t.map(t=>{let n={pid:t.pid};for(let r of e)n[r.key]=t[r.key]??null;return n})},null,1)}var Rre=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function zre(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function Bre(e){let t=e?/^(\d{4})-(\d{2})-(\d{2})/.exec(e):null,n=t?Number(t[1]):2020,r=t?Number(t[2]):1,i=t?Number(t[3]):1;return{date:Math.max(1980,n)-1980<<9|r<<5|i,time:0}}function Vre(e,t){let n=new TextEncoder,r=Bre(t),i=[],a=[],o=0,s=e=>[e&255,e>>8&255],c=e=>[e&255,e>>8&255,e>>16&255,e>>24&255];for(let t of e){let e=n.encode(t.name),l=zre(t.data),u=new Uint8Array([...c(67324752),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0)]);i.push(u,e,t.data),a.push(new Uint8Array([...c(33639248),...s(20),...s(20),...s(2048),...s(0),...s(r.time),...s(r.date),...c(l),...c(t.data.length),...c(t.data.length),...s(e.length),...s(0),...s(0),...s(0),...s(0),...c(0),...c(o)]),e),o+=u.length+e.length+t.data.length}let l=o,u=0;for(let e of a)u+=e.length;let d=new Uint8Array([...c(101010256),...s(0),...s(0),...s(e.length),...s(e.length),...c(u),...c(l),...s(0)]),f=o+u+d.length,p=new Uint8Array(f),m=0;for(let e of[...i,...a,d])p.set(e,m),m+=e.length;return p}function Nm(e){return e.replace(/&/g,`&`).replace(//g,`>`).replace(/"/g,`"`).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,``)}function Hre(e){return(e.replace(/[[\]:*?/\\]/g,`_`).trim()||`Export`).slice(0,31)}function Ure(e,t,n,r){let i=new TextEncoder,a=e=>`${Nm(e)}`,o=e=>`${e.join(``)}`,s=`${[o(e.map(e=>a(e.label))),...t.map(t=>o(e.map(e=>a(Sp(e,t[e.key])))))].join(``)}`,c=``;return Vre([{name:`[Content_Types].xml`,data:i.encode(``)},{name:`_rels/.rels`,data:i.encode(``)},{name:`xl/workbook.xml`,data:i.encode(c)},{name:`xl/_rels/workbook.xml.rels`,data:i.encode(``)},{name:`xl/worksheets/sheet1.xml`,data:i.encode(s)}],r)}var Pm=792,Fm=612,Im=36,Lm=8,Rm=13,zm=17,Bm=Lm*.52,Wre={"…":133,"–":150,"—":151,"‘":145,"’":146,"“":147,"”":148,"·":183,"€":128,"•":149};function Vm(e){let t=``;for(let n of e){let e=n.codePointAt(0)??63,r=e<=255?e:Wre[n]??63,i=String.fromCharCode(r);t+=i===`\\`?`\\\\`:i===`(`?`\\(`:i===`)`?`\\)`:i}return t}function Hm(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function Gre(e,t,n,r){let i=Pm-Im*2,a=t.slice(0,200),o=e.map(e=>{let t=e.label.length;for(let n of a)t=Math.max(t,Sp(e,n[e.key]).length);return Math.min(170,Math.max(42,t*Bm+8))}),s=Math.min(1,i/o.reduce((e,t)=>e+t,0)),c=o.map(e=>e*s),l=Math.max(1,Math.floor((Fm-Im*2-26-zm-14)/Rm)),u=Math.max(1,Math.ceil(t.length/l)),d=r?`${n} — ${r}`:n,f=[];for(let n=0;n`${5+t*2} 0 R`).join(` `);p.push(`1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj `),p.push(`2 0 obj\n<< /Type /Pages /Kids [${m}] /Count ${f.length} >>\nendobj\n`),p.push(`3 0 obj @@ -196,24 +196,24 @@ endobj `),p.push(`4 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj -`),f.forEach((e,t)=>{let n=5+t*2;p.push(`${n} 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${Qp} ${$p}] /Resources << /Font << /F1 3 0 R /F2 4 0 R >> >> /Contents ${n+1} 0 R >>\nendobj\n`),p.push(`${n+1} 0 obj\n<< /Length ${e.length} >>\nstream\n${e}endstream\nendobj\n`)});let h=`%PDF-1.4 -`,g=[];for(let e of p)g.push(h.length),h+=e;let _=h.length;h+=`xref\n0 ${p.length+1}\n0000000000 65535 f \n`;for(let e of g)h+=`${String(e).padStart(10,`0`)} 00000 n \n`;h+=`trailer\n<< /Size ${p.length+1} /Root 1 0 R >>\nstartxref\n${_}\n%%EOF\n`;let v=new Uint8Array(h.length);for(let e=0;eURL.revokeObjectURL(n),4e3)}function pie(e,t,n,r,i){let a=nie(t,n,e);if(e===`csv`){sm(a,new Blob([``,rie(r,i)],{type:`text/csv;charset=utf-8`}));return}if(e===`json`){sm(a,new Blob([iie(r,i)],{type:`application/json`}));return}if(e===`xlsx`){sm(a,new Blob([uie(r,i,t,n).buffer],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}));return}sm(a,new Blob([fie(r,i,t,n).buffer],{type:`application/pdf`}))}var mie=new Set([`sum`,`count`]);function hie(e){return mie.has(e)}var cm=`month`;function lm(e){let t=Od.includes(e.bucket??``)?e.bucket:cm,n=e.span??{},r;return r=typeof n.lastN==`number`&&Number.isFinite(n.lastN)?{lastN:Math.max(1,Math.min(120,Math.round(n.lastN)))}:n.from||n.to?{from:n.from,to:n.to}:{lastN:12},{pids:e.pids,bucket:t,span:r,fields:e.fields.slice(0,12)}}function um(e,t){return e==null||t==null||t===0||!Number.isFinite(e)||!Number.isFinite(t)?null:(e-t)/Math.abs(t)*100}function gie(e,t){return e==null?`—`:t?t(e):String(e)}function _ie(e){return e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)}%`}function vie(e){switch(e){case`not_a_measure_field`:return`not a measure — only measure fields have a time dimension`;case`unresolvable`:return`a composite measure has no single aggregate to bucket`;case`window_fixed`:return`its period is a fixed date range, so it cannot slide across buckets`;default:return e}}function dm(e){if(!e)return{columns:[],rows:[],notes:[],pool:0,empty:!0};let t=e.columns??[],n=(e.rows??[]).map(e=>{let n=e.values??[],r=t.map((e,t)=>({value:n[t]??null,delta:um(n[t]??null,t>0?n[t-1]??null:null),partial:e.partial===!0})),i=hie(e.agg)&&typeof e.total==`number`&&Number.isFinite(e.total)?e.total:void 0;return{field:e.field,label:e.label,agg:e.agg,cells:r,total:i,allUnanswered:r.length>0&&r.every(e=>e.value==null),window:e.window}}),r=[],i=e.meta??{pool:0};for(let e of i.dropped??[])r.push(`${e.field} is not shown — ${vie(e.reason)}.`);for(let e of i.problems??[])r.push(e);let a=t.filter(e=>e.partial).length;a>0&&r.push(a===1?`The last column is a partial period — it is still filling.`:`${a} columns are partial periods — they are still filling.`);let o=n.filter(e=>e.allUnanswered).length;return o>0&&r.push(`${o} of ${n.length} metrics returned no values for this span (shown as "—").`),{columns:t,rows:n,notes:r,pool:i.pool??0,empty:n.length===0}}function yie(e){let t=[],n=0;for(;nt[n],i=e=>{let t=r();return t&&t.k===`op`&&t.v===e?(n+=1,!0):!1};function a(){let e=r();if(!e)return null;if(e.k===`num`)return n+=1,{t:`num`,v:e.v};if(e.k===`ref`)return n+=1,{t:`ref`,name:e.name};if(i(`(`)){let e=c();return!e||!i(`)`)?null:e}return null}function o(){if(i(`-`)){let e=o();return e?{t:`neg`,a:e}:null}return i(`+`)?o():a()}function s(){let e=o();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`*`&&t.v!==`/`)return e;n+=1;let i=o();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}function c(){let e=s();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`+`&&t.v!==`-`)return e;n+=1;let i=s();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}let l=c();return l&&n===t.length?l:null}function xie(e,t){let n,r=e=>{switch(e.t){case`num`:return e.v;case`ref`:{let r=t(e.name);return r===void 0?(n??=`unknown_ref`,null):r}case`neg`:{let t=r(e.a);return t==null?null:-t}case`bin`:{let t=r(e.a),i=r(e.b);if(t==null||i==null)return null;if(e.op===`+`)return t+i;if(e.op===`-`)return t-i;if(e.op===`*`)return t*i;if(i===0)return n??=`div_zero`,null;let a=t/i;return Number.isFinite(a)?a:null}}},i=r(e);return n?{value:null,error:n}:{value:i}}function Sie(e,t){switch(t){case`syntax`:return`${e}: that formula could not be read — use + - * / ( ) with numbers and [row] references.`;case`unknown_ref`:return`${e}: a row it refers to is not on this sheet, so it is left blank rather than treated as zero.`;case`cycle`:return`${e}: it refers back to itself, so it has no value.`;case`div_zero`:return`${e}: divided by zero in at least one period — those cells are blank, not zero.`}}var Cie={week:52,month:12,quarter:4,year:1},fm={abs:`Change`,pct:`Change %`,yoy:`vs last year`,ytd:`YTD growth`};function wie(e){return e!==`abs`}function pm(e,t,n){let r=e.cells.map(e=>e.value),i=Cie[n]??12,a=[];for(let n of t){let t=wie(n),o,s;n===`abs`?s=r.map((e,t)=>t===0||e==null||r[t-1]==null?null:e-r[t-1]):n===`pct`?s=r.map((e,t)=>um(e,t>0?r[t-1]:null)):n===`yoy`||e.window?.kind===`ytd`?(s=r.map((e,t)=>um(e,t>=i?r[t-i]:null)),r.length<=i&&(o=`This span is shorter than a year, so there is no earlier period to compare against.`)):(s=r.map(()=>null),o=e.window==null?`Year-to-date growth needs the metric's own period, which this server did not report.`:`Year-to-date growth is only meaningful on a year-to-date metric — this one is "${e.window.label}".`),a.push({kind:n,label:fm[n],percent:t,values:s,refusal:o})}return a}function mm(e,t,n){if(!e)return{};let r=e[t],i=n?e[`${t}:${n}`]:void 0;return!r&&!i?{}:{...r,...i}}function Tie(e,t,n){let r=e.filter(e=>e!=null&&Number.isFinite(e));if(r.length<2)return[];let i=Math.min(...r),a=Math.max(...r)-i,o=e.length>1?t/(e.length-1):0,s=[],c=[];return e.forEach((e,t)=>{if(e==null||!Number.isFinite(e)){c.length>1&&s.push({points:c}),c=[];return}let r=a===0?n/2:n-(e-i)/a*n;c.push({x:t*o,y:r})}),c.length>1&&s.push({points:c}),s}function Eie(e){return e.points.map(e=>`${Math.round(e.x*10)/10},${Math.round(e.y*10)/10}`).join(` `)}function hm(e){return e.trim().toLowerCase()}function Die(e,t){let n=[...e.notes],r=t.deltas??[],i=(t.customRows??[]).filter(e=>e&&typeof e.id==`string`),a=new Map,o=new Map;e.rows.forEach((e,t)=>{a.has(e.field)||a.set(e.field,{kind:`metric`,index:t});let n=hm(e.label);n&&!o.has(n)&&o.set(n,{kind:`metric`,index:t})}),i.forEach((e,t)=>{if(e.kind!==`formula`)return;a.has(e.id)||a.set(e.id,{kind:`formula`,index:t});let n=hm(e.label);n&&!o.has(n)&&o.set(n,{kind:`formula`,index:t})});let s=i.map(e=>e.kind===`formula`?bie(e.expr??``):null),c=new Map,l=new Map,u=(t,n)=>{let r=c.get(t);if(r)return r;let i=e.columns.length;if(n.has(t))return l.set(t,`cycle`),Array(i).fill(null);let d=s[t];if(!d){l.set(t,`syntax`);let e=Array(i).fill(null);return c.set(t,e),e}n.add(t);let f=[];for(let r=0;r{let i=a.get(t.trim())??o.get(hm(t));if(i)return i.kind===`metric`?e.rows[i.index]?.cells[r]?.value??null:u(i.index,n)[r]??null});i.error&&!l.has(t)&&l.set(t,i.error),f.push(i.value)}return n.delete(t),c.set(t,f),f},d=e.rows.map(e=>({id:e.field,kind:`metric`,label:e.label,sublabel:e.window?.label,agg:e.agg,cells:e.cells,total:e.total,deltas:pm(e,r,t.bucket),allUnanswered:e.allUnanswered}));i.forEach((i,a)=>{if(i.kind===`note`){d.push({id:i.id,kind:`note`,label:i.label,cells:e.columns.map(e=>({value:null,delta:null,partial:e.partial===!0})),deltas:[],allUnanswered:!1});return}let o=u(a,new Set),s=e.columns.map((e,t)=>({value:o[t]??null,delta:um(o[t]??null,t>0?o[t-1]??null:null),partial:e.partial===!0})),c=l.get(a);c&&n.push(Sie(i.label||i.id,c)),d.push({id:i.id,kind:`formula`,label:i.label,expr:i.expr,cells:s,deltas:pm({cells:s,window:void 0},r,t.bucket),allUnanswered:s.length>0&&s.every(e=>e.value==null)})});let f=new Set;for(let e of d)for(let t of e.deltas)t.refusal&&f.add(t.refusal);for(let e of f)n.push(e);return{columns:e.columns,rows:d,notes:n,pool:e.pool,empty:d.length===0}}function gm(e,t){let n=e.cells.map((e,n)=>({cell:e,col:t[n]})).filter(e=>e.col&&e.cell.value!=null).map(t=>({key:t.col.key,label:t.col.label,value:t.cell.value,n:1,seriesKey:e.field,seriesLabel:e.label}));return{points:n,xOrder:t.map(e=>e.key),seriesOrder:[e.field],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.filter(e=>e.value==null).length,missingY:0,rows:n.length,nonPositive:0,nonPositiveValue:0}}function _m(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Oie(e){let t=[[`Metric`,...e.columns.map(e=>e.label),`Total`].map(_m).join(`,`)];for(let n of e.rows){t.push([_m(n.sublabel?`${n.label} (${n.sublabel})`:n.label),...n.cells.map(e=>e.value==null?``:String(e.value)),n.total==null?``:String(n.total)].join(`,`));for(let e of n.deltas)t.push([_m(`${n.label} — ${e.label}${e.percent?` (%)`:``}`),...e.values.map(e=>e==null?``:String(e)),``].join(`,`))}return t.join(`\r +`),f.forEach((e,t)=>{let n=5+t*2;p.push(`${n} 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${Pm} ${Fm}] /Resources << /Font << /F1 3 0 R /F2 4 0 R >> >> /Contents ${n+1} 0 R >>\nendobj\n`),p.push(`${n+1} 0 obj\n<< /Length ${e.length} >>\nstream\n${e}endstream\nendobj\n`)});let h=`%PDF-1.4 +`,g=[];for(let e of p)g.push(h.length),h+=e;let _=h.length;h+=`xref\n0 ${p.length+1}\n0000000000 65535 f \n`;for(let e of g)h+=`${String(e).padStart(10,`0`)} 00000 n \n`;h+=`trailer\n<< /Size ${p.length+1} /Root 1 0 R >>\nstartxref\n${_}\n%%EOF\n`;let v=new Uint8Array(h.length);for(let e=0;eURL.revokeObjectURL(n),4e3)}function Kre(e,t,n,r,i){let a=Fre(t,n,e);if(e===`csv`){Um(a,new Blob([``,Ire(r,i)],{type:`text/csv;charset=utf-8`}));return}if(e===`json`){Um(a,new Blob([Lre(r,i)],{type:`application/json`}));return}if(e===`xlsx`){Um(a,new Blob([Ure(r,i,t,n).buffer],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}));return}Um(a,new Blob([Gre(r,i,t,n).buffer],{type:`application/pdf`}))}var qre=new Set([`sum`,`count`]);function Jre(e){return qre.has(e)}var Wm=`month`;function Gm(e){let t=id.includes(e.bucket??``)?e.bucket:Wm,n=e.span??{},r;return r=typeof n.lastN==`number`&&Number.isFinite(n.lastN)?{lastN:Math.max(1,Math.min(120,Math.round(n.lastN)))}:n.from||n.to?{from:n.from,to:n.to}:{lastN:12},{pids:e.pids,bucket:t,span:r,fields:e.fields.slice(0,12)}}function Km(e,t){return e==null||t==null||t===0||!Number.isFinite(e)||!Number.isFinite(t)?null:(e-t)/Math.abs(t)*100}function Yre(e,t){return e==null?`—`:t?t(e):String(e)}function Xre(e){return e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)}%`}function Zre(e){switch(e){case`not_a_measure_field`:return`not a measure — only measure fields have a time dimension`;case`unresolvable`:return`a composite measure has no single aggregate to bucket`;case`window_fixed`:return`its period is a fixed date range, so it cannot slide across buckets`;default:return e}}function qm(e){if(!e)return{columns:[],rows:[],notes:[],pool:0,empty:!0};let t=e.columns??[],n=(e.rows??[]).map(e=>{let n=e.values??[],r=t.map((e,t)=>({value:n[t]??null,delta:Km(n[t]??null,t>0?n[t-1]??null:null),partial:e.partial===!0})),i=Jre(e.agg)&&typeof e.total==`number`&&Number.isFinite(e.total)?e.total:void 0;return{field:e.field,label:e.label,agg:e.agg,cells:r,total:i,allUnanswered:r.length>0&&r.every(e=>e.value==null),window:e.window}}),r=[],i=e.meta??{pool:0};for(let e of i.dropped??[])r.push(`${e.field} is not shown — ${Zre(e.reason)}.`);for(let e of i.problems??[])r.push(e);let a=t.filter(e=>e.partial).length;a>0&&r.push(a===1?`The last column is a partial period — it is still filling.`:`${a} columns are partial periods — they are still filling.`);let o=n.filter(e=>e.allUnanswered).length;return o>0&&r.push(`${o} of ${n.length} metrics returned no values for this span (shown as "—").`),{columns:t,rows:n,notes:r,pool:i.pool??0,empty:n.length===0}}function Qre(e){let t=[],n=0;for(;nt[n],i=e=>{let t=r();return t&&t.k===`op`&&t.v===e?(n+=1,!0):!1};function a(){let e=r();if(!e)return null;if(e.k===`num`)return n+=1,{t:`num`,v:e.v};if(e.k===`ref`)return n+=1,{t:`ref`,name:e.name};if(i(`(`)){let e=c();return!e||!i(`)`)?null:e}return null}function o(){if(i(`-`)){let e=o();return e?{t:`neg`,a:e}:null}return i(`+`)?o():a()}function s(){let e=o();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`*`&&t.v!==`/`)return e;n+=1;let i=o();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}function c(){let e=s();if(!e)return null;for(;;){let t=r();if(!t||t.k!==`op`||t.v!==`+`&&t.v!==`-`)return e;n+=1;let i=s();if(!i)return null;e={t:`bin`,op:t.v,a:e,b:i}}}let l=c();return l&&n===t.length?l:null}function eie(e,t){let n,r=e=>{switch(e.t){case`num`:return e.v;case`ref`:{let r=t(e.name);return r===void 0?(n??=`unknown_ref`,null):r}case`neg`:{let t=r(e.a);return t==null?null:-t}case`bin`:{let t=r(e.a),i=r(e.b);if(t==null||i==null)return null;if(e.op===`+`)return t+i;if(e.op===`-`)return t-i;if(e.op===`*`)return t*i;if(i===0)return n??=`div_zero`,null;let a=t/i;return Number.isFinite(a)?a:null}}},i=r(e);return n?{value:null,error:n}:{value:i}}function tie(e,t){switch(t){case`syntax`:return`${e}: that formula could not be read — use + - * / ( ) with numbers and [row] references.`;case`unknown_ref`:return`${e}: a row it refers to is not on this sheet, so it is left blank rather than treated as zero.`;case`cycle`:return`${e}: it refers back to itself, so it has no value.`;case`div_zero`:return`${e}: divided by zero in at least one period — those cells are blank, not zero.`}}var Jm={week:52,month:12,quarter:4,year:1},Ym={abs:`Change`,pct:`Change %`,yoy:`vs last year`,ytd:`YTD growth`};function nie(e){return e!==`abs`}function Xm(e,t,n){let r=e.cells.map(e=>e.value),i=Jm[n]??12,a=[];for(let n of t){let t=nie(n),o,s;n===`abs`?s=r.map((e,t)=>t===0||e==null||r[t-1]==null?null:e-r[t-1]):n===`pct`?s=r.map((e,t)=>Km(e,t>0?r[t-1]:null)):n===`yoy`||e.window?.kind===`ytd`?(s=r.map((e,t)=>Km(e,t>=i?r[t-i]:null)),r.length<=i&&(o=`This span is shorter than a year, so there is no earlier period to compare against.`)):(s=r.map(()=>null),o=e.window==null?`Year-to-date growth needs the metric's own period, which this server did not report.`:`Year-to-date growth is only meaningful on a year-to-date metric — this one is "${e.window.label}".`),a.push({kind:n,label:Ym[n],percent:t,values:s,refusal:o})}return a}function rie(e,t){let n=Jm[t]??12,r={value:null,delta:null,partial:!1},i=e.cells.map((t,i)=>i>=n?e.cells[i-n]:r),a=e.cells.length<=n?`This span is shorter than a year, so there is no earlier period to compare against.`:void 0;return{label:`${e.label} (last year)`,cells:a?[]:i,back:n,refusal:a}}function Zm(e,t,n){if(!e)return{};let r=e[t],i=n?e[`${t}:${n}`]:void 0;return!r&&!i?{}:{...r,...i}}function iie(e,t,n){let r=e.filter(e=>e!=null&&Number.isFinite(e));if(r.length<2)return[];let i=Math.min(...r),a=Math.max(...r)-i,o=e.length>1?t/(e.length-1):0,s=[],c=[];return e.forEach((e,t)=>{if(e==null||!Number.isFinite(e)){c.length>1&&s.push({points:c}),c=[];return}let r=a===0?n/2:n-(e-i)/a*n;c.push({x:t*o,y:r})}),c.length>1&&s.push({points:c}),s}function aie(e){return e.points.map(e=>`${Math.round(e.x*10)/10},${Math.round(e.y*10)/10}`).join(` `)}function Qm(e){return e.trim().toLowerCase()}function oie(e,t){let n=[...e.notes],r=t.deltas??[],i=(t.customRows??[]).filter(e=>e&&typeof e.id==`string`),a=new Map,o=new Map;e.rows.forEach((e,t)=>{a.has(e.field)||a.set(e.field,{kind:`metric`,index:t});let n=Qm(e.label);n&&!o.has(n)&&o.set(n,{kind:`metric`,index:t})}),i.forEach((e,t)=>{if(e.kind!==`formula`)return;a.has(e.id)||a.set(e.id,{kind:`formula`,index:t});let n=Qm(e.label);n&&!o.has(n)&&o.set(n,{kind:`formula`,index:t})});let s=i.map(e=>e.kind===`formula`?$re(e.expr??``):null),c=new Map,l=new Map,u=(t,n)=>{let r=c.get(t);if(r)return r;let i=e.columns.length;if(n.has(t))return l.set(t,`cycle`),Array(i).fill(null);let d=s[t];if(!d){l.set(t,`syntax`);let e=Array(i).fill(null);return c.set(t,e),e}n.add(t);let f=[];for(let r=0;r{let i=a.get(t.trim())??o.get(Qm(t));if(i)return i.kind===`metric`?e.rows[i.index]?.cells[r]?.value??null:u(i.index,n)[r]??null});i.error&&!l.has(t)&&l.set(t,i.error),f.push(i.value)}return n.delete(t),c.set(t,f),f},d=e.rows.map(e=>({id:e.field,kind:`metric`,label:e.label,sublabel:e.window?.label,agg:e.agg,cells:e.cells,total:e.total,deltas:Xm(e,r,t.bucket),allUnanswered:e.allUnanswered}));i.forEach((i,a)=>{if(i.kind===`note`){d.push({id:i.id,kind:`note`,label:i.label,cells:e.columns.map(e=>({value:null,delta:null,partial:e.partial===!0})),deltas:[],allUnanswered:!1});return}let o=u(a,new Set),s=e.columns.map((e,t)=>({value:o[t]??null,delta:Km(o[t]??null,t>0?o[t-1]??null:null),partial:e.partial===!0})),c=l.get(a);c&&n.push(tie(i.label||i.id,c)),d.push({id:i.id,kind:`formula`,label:i.label,expr:i.expr,cells:s,deltas:Xm({cells:s,window:void 0},r,t.bucket),allUnanswered:s.length>0&&s.every(e=>e.value==null)})});let f=new Set;for(let e of d)for(let t of e.deltas)t.refusal&&f.add(t.refusal);for(let e of f)n.push(e);return{columns:e.columns,rows:d,notes:n,pool:e.pool,empty:d.length===0}}function $m(e,t){let n=e.cells.map((e,n)=>({cell:e,col:t[n]})).filter(e=>e.col&&e.cell.value!=null).map(t=>({key:t.col.key,label:t.col.label,value:t.cell.value,n:1,seriesKey:e.field,seriesLabel:e.label}));return{points:n,xOrder:t.map(e=>e.key),seriesOrder:[e.field],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.filter(e=>e.value==null).length,missingY:0,rows:n.length,nonPositive:0,nonPositiveValue:0}}function sie(e,t,n,r){let i=rie(e,n),a=Math.max(1,Math.min(Math.round(r),t.length)),o=t.length-a,s=t.slice(o),c=`${e.field}::prior_year`,l=(e,t,n)=>s.map((t,n)=>({col:t,cell:e[o+n]})).filter(e=>e.cell&&e.cell.value!=null).map(e=>({key:e.col.key,label:e.col.label,value:e.cell.value,n:1,seriesKey:t,seriesLabel:n})),u=l(e.cells,e.field,e.label),d=i.refusal?[]:l(i.cells,c,i.label);return{points:[...u,...d],xOrder:s.map(e=>e.key),seriesOrder:i.refusal?[e.field]:[e.field,c],omitted:0,omittedValue:0,omittedSeries:0,omittedSeriesValue:0,blanks:e.cells.slice(o).filter(e=>e.value==null).length,missingY:0,rows:u.length,nonPositive:0,nonPositiveValue:0}}function eh(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function cie(e){let t=[[`Metric`,...e.columns.map(e=>e.label),`Total`].map(eh).join(`,`)];for(let n of e.rows){t.push([eh(n.sublabel?`${n.label} (${n.sublabel})`:n.label),...n.cells.map(e=>e.value==null?``:String(e.value)),n.total==null?``:String(n.total)].join(`,`));for(let e of n.deltas)t.push([eh(`${n.label} — ${e.label}${e.percent?` (%)`:``}`),...e.values.map(e=>e==null?``:String(e)),``].join(`,`))}return t.join(`\r `)+`\r -`}var kie={brand:[`#1F4E78`,`#C8A24B`,`#6F96B8`,`#E0C979`,`#3E6F98`,`#A17C2D`],categorical:[`#2F6B9A`,`#C28A2C`,`#4C8A68`,`#8A5C9D`,`#C25B56`,`#4B8793`,`#8B704A`,`#6A78A8`,`#A45D7D`,`#708B3D`,`#B66B32`,`#52749C`],sequential:[`#E7F0F7`,`#C5D9E9`,`#9CBCD5`,`#719DBE`,`#477CA3`,`#1F4E78`],diverging:[`#2F6B9A`,`#7EA5C3`,`#D8E4ED`,`#F0E6C6`,`#D5B66A`,`#9B7222`]};function Aie(e){switch(e.axis?.y?.format){case`number`:return{format:`,.2~f`};case`currency`:return{format:`$,.0f`};case`percent`:return{labelExpr:`format(datum.value, ',.2~f') + '%'`};case`compact`:return{format:`~s`};default:return{}}}function jie(e,t){let n=new Map(e.xOrder.map((e,t)=>[e,t])),r=new Map(e.seriesOrder.map((e,t)=>[e,t]));return e.points.map(e=>({xKey:e.key,xLabel:e.label,xIndex:n.get(e.key)??0,value:e.value,valueText:t(e.value),n:e.n,seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,seriesIndex:r.get(e.seriesKey)??0}))}function Mie(){return{font:`Inter, ui-sans-serif, system-ui, sans-serif`,view:{stroke:null},axis:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,labelLimit:110,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:11,titleFontWeight:500,gridColor:`#E7EBEF`,domainColor:`#C9D1D9`,tickColor:`#C9D1D9`},legend:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:10,symbolType:`circle`,orient:`bottom`,direction:`horizontal`}}}function Nie(e,t){return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,data:{values:t},width:`container`,height:`container`,autosize:{type:`fit`,contains:`padding`,resize:!0},padding:4,config:Mie(),usermeta:{rendererBoundary:`aios-chart-spec-v1`,chartId:e.id}}}function vm(e){return[{field:`xLabel`,type:`nominal`,title:`Group`},...e?[{field:`seriesLabel`,type:`nominal`,title:`Series`}]:[],{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}function ym({spec:e,model:t,xTitle:n,yTitle:r,formatValue:i}){let a=jie(t,i).filter(t=>e.kind!==`donut`||t.value>0),o=[...kie[e.palette??`brand`]],s=!!(e.splitBy&&t.seriesOrder.length),c=s?{field:`seriesLabel`,type:`nominal`,title:null,sort:{field:`seriesIndex`,op:`min`},scale:{range:o},legend:{columns:4}}:{value:o[0]},l={field:`xLabel`,type:`nominal`,title:n??null,sort:{field:`xIndex`,op:`min`,order:`ascending`},axis:{labelAngle:t.xOrder.length>7?-35:0,labelOverlap:`greedy`}},u={field:`value`,type:`quantitative`,title:r??null,axis:Aie(e)},d=Nie(e,a);if(e.kind===`kpi`)return{...d,mark:{type:`text`,align:`center`,baseline:`middle`,font:`Inter, ui-sans-serif, system-ui, sans-serif`,fontSize:32,fontWeight:600,color:`#172433`},encoding:{text:{field:`valueText`,type:`nominal`},tooltip:[{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}};if(e.kind===`donut`)return{...d,mark:{type:`arc`,innerRadius:44,outerRadius:76,cornerRadius:2,padAngle:.01},encoding:{theta:{field:`value`,type:`quantitative`,stack:!0},color:{field:`xLabel`,type:`nominal`,title:null,sort:{field:`xIndex`,op:`min`},scale:{range:o},legend:{orient:`right`,direction:`vertical`,labelLimit:110}},order:{field:`xIndex`,type:`quantitative`},tooltip:vm(!1)}};let f={x:l,y:{...u,stack:(e.kind===`bar`||e.kind===`area`)&&s?e.stacked?`zero`:null:void 0},color:c,tooltip:vm(s)};return s&&e.kind===`bar`&&!e.stacked&&(f.xOffset={field:`seriesLabel`,type:`nominal`,sort:{field:`seriesIndex`,op:`min`}}),(e.kind===`line`||e.kind===`area`)&&(f.order={field:`xIndex`,type:`quantitative`},s&&(f.detail={field:`seriesKey`,type:`nominal`})),{...d,mark:e.kind===`bar`?{type:`bar`,cornerRadiusTopLeft:2,cornerRadiusTopRight:2}:e.kind===`area`?{type:`area`,opacity:s?.68:.48,line:!0,point:!0}:{type:`line`,strokeWidth:2,point:{filled:!0,size:46}},encoding:f}}function bm(e,t={}){let n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=n===``?1/0:t.maxLength===void 0?80:t.maxLength,{replacer:i}=t;return(function e(t,a,o){t&&typeof t.toJSON==`function`&&(t=t.toJSON());let s=JSON.stringify(t,i);if(s===void 0)return s;let c=r-a.length-o;if(s.length<=c){let e=s.replace(xm,(e,t)=>t||`${e} `);if(e.length<=c)return e}if(i!=null&&(t=JSON.parse(s),i=void 0),typeof t==`object`&&t){let r=a+n,i=[],o=0,s,c;if(Array.isArray(t)){s=`[`,c=`]`;let{length:n}=t;for(;o0)return[s,n+i.join(`,\n${r}`),c].join(`\n${a}`)}return s})(e,``,0)}var xm,Pie=o((()=>{xm=/("(?:[^\\"]|\\.)*")|[:,]/g}));function Sm(e,t,n){return Object.assign(e,{fields:t||[],fname:n})}function Cm(e){return e==null?null:e.fname}function wm(e){return e==null?null:e.fields}var Tm=o((()=>{}));function Em(e){return e.length===1?Dm(e[0]):Om(e)}var Dm,Om,km=o((()=>{Dm=e=>function(t){return t[e]},Om=e=>{let t=e.length;return function(n){for(let r=0;r{}));function jm(e){let t=[],n=e.length,r=null,i=0,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;so?l():o=s+1:c===`[`?(s>o&&l(),i=o=s+1):c===`]`&&(i||V(`Access path missing open bracket: `+e),i>0&&l(),i=0,o=s+1);return i&&V(`Access path missing closing bracket: `+e),r&&V(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var Mm=o((()=>{Am()}));function Nm(e,t,n){let r=jm(e),i=r.length===1?r[0]:e;return Sm((n&&n.get||Em)(r),[i],t||i)}var Pm=o((()=>{Tm(),km(),Mm()})),Fm,Im,Lm,Rm,zm,Bm,Fie=o((()=>{Tm(),Pm(),Fm=Nm(`id`),Im=Sm(e=>e,[],`identity`),Lm=Sm(()=>0,[],`zero`),Rm=Sm(()=>1,[],`one`),zm=Sm(()=>!0,[],`true`),Bm=Sm(()=>!1,[],`false`)})),Vm,Iie=o((()=>{Vm=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]==`function`),`__proto__`])}));function Lie(e,t,n){let r=[t,...n];console[e](...r)}function Hm(e,t,n=Lie){let r=e||0;return{level(e){return arguments.length?(r=+e,this):r},error(...e){return r>=1&&n(t||`error`,`ERROR`,e),this},warn(...e){return r>=2&&n(t||`warn`,`WARN`,e),this},info(...e){return r>=3&&n(t||`log`,`INFO`,e),this},debug(...e){return r>=4&&n(t||`log`,`DEBUG`,e),this}}}var Rie=o((()=>{})),H,Um=o((()=>{H=Array.isArray}));function Wm(e){return e===Object(e)}var Gm=o((()=>{}));function Km(...e){return e.reduce((e,t)=>{for(let n in t)if(n===`signals`)e.signals=zie(e.signals,t.signals);else{let r=n===`legend`?{layout:1}:n===`style`||null;qm(e,n,t[n],r)}return e},{})}function qm(e,t,n,r){if(!Jm(t))return;let i=e,a,o;if(Wm(n)&&!H(n)){let e=n;for(a in o=Wm(i[t])?i[t]:i[t]={},e)r&&(r===!0||r[a])?qm(o,a,e[a]):Jm(a)&&(o[a]=e[a])}else i[t]=n}function zie(e,t){if(e==null)return t;if(t==null)return e;let n={},r=[];function i(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(i),e.forEach(i),r}var Jm,Bie=o((()=>{Um(),Gm(),Jm=e=>e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}));function Ym(e){return e[e.length-1]}var Xm=o((()=>{}));function Zm(e){return e==null||e===``?null:+e}var Qm=o((()=>{}));function $m(e){return e.length>0}function eh(e,t,n,r){$m(e)||V(`Domain array must not be empty`);let i=n(e[0]),a=n(Ym(e)),o=(a-i)*t;return[r(i-o),r(a-o)]}function th(e,t){return eh(e,t,hh,gh)}function nh(e,t){let n=Math.sign(e[0]);return eh(e,t,dh(n),uh(n))}function rh(e,t,n){return eh(e,t,mh(n),mh(1/n))}function ih(e,t,n){return eh(e,t,fh(n),ph(n))}function ah(e,t,n,r,i){$m(e)||V(`Domain array must not be empty`);let a=r(e[0]),o=r(Ym(e)),s=t==null?(a+o)/2:r(t);return[i(s+(a-s)*n),i(s+(o-s)*n)]}function oh(e,t,n){return ah(e,t,n,hh,gh)}function sh(e,t,n){let r=Math.sign(e[0]);return ah(e,t,n,dh(r),uh(r))}function ch(e,t,n,r){return ah(e,t,n,mh(r),mh(1/r))}function lh(e,t,n,r){return ah(e,t,n,fh(r),ph(r))}var uh,dh,fh,ph,mh,hh,gh,Vie=o((()=>{Am(),Xm(),Qm(),uh=e=>t=>e*Math.exp(t),dh=e=>t=>Math.log(e*t),fh=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),ph=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,mh=e=>t=>t<0?-((-t)**+e):t**+e,hh=e=>Zm(e)??0,gh=e=>e}));function _h(e){return 1+~~(new Date(e).getMonth()/3)}function vh(e){return 1+~~(new Date(e).getUTCMonth()/3)}var Hie=o((()=>{}));function yh(e){return e==null?[]:H(e)?e:[e]}var bh=o((()=>{Um()}));function xh(e,t,n){let r=e[0],i=e[1],a;return i=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}var Uie=o((()=>{}));function Sh(e){return typeof e==`function`}var Ch=o((()=>{}));function wh(e,t,n){let r=n||{},i=yh(t)||[],a=[],o=[],s={},c=r.comparator||Dh;return yh(e).forEach((e,t)=>{if(e==null)return;a.push(i[t]===Th?-1:1);let n=Sh(e)?e:Nm(e,void 0,r);o.push(n),(wm(n)||[]).forEach(e=>s[e]=1)}),o.length===0?null:Sm(c(o,a),Object.keys(s))}var Th,Eh,Dh,Oh,kh,Wie=o((()=>{Tm(),bh(),Pm(),Ch(),Th=`descending`,Eh=(e,t)=>{let n=e,r=t;return(nr||r==null)&&n!=null?1:(r=r instanceof Date?+r:r,n=n instanceof Date?+n:n)!==n&&r===r?-1:+(r!==r&&n===n)},Dh=(e,t)=>e.length===1?Oh(e[0],t[0]):kh(e,t,e.length),Oh=(e,t)=>function(n,r){return Eh(e(n),e(r))*t},kh=(e,t,n)=>(t.push(0),function(r,i){let a,o=0,s=-1;for(;o===0&&++se}var Gie=o((()=>{Ch()}));function jh(e,t){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}var Kie=o((()=>{}));function Mh(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}var Nh=o((()=>{}));function Ph(e,t){let n=0,r,i,a,o;if(e&&(r=e.length))if(t==null){for(i=e[n];no&&(o=i))}else{for(i=t(e[n]);no&&(o=i))}return[a,o]}var qie=o((()=>{}));function Fh(e,t){let n=e.length,r=-1,i,a,o,s,c;if(t==null){for(;++r=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c{}));function Ih(e,t){return Object.hasOwn(e,t)}var Lh=o((()=>{}));function Rh(e){let t={},n;function r(e){return Ih(t,e)&&t[e]!==zh}let i={size:0,empty:0,object:t,has:r,get(e){return r(e)?t[e]:void 0},set(e,n){return r(e)||(++i.size,t[e]===zh&&--i.empty),t[e]=n,this},delete(e){return r(e)&&(--i.size,++i.empty,t[e]=zh),this},clear(){i.size=i.empty=0,i.object=t={}},test(e){return arguments.length?(n=e,i):n},clean(){let e={},r=0;for(let i in t){let a=t[i];a!==zh&&(!n||!n(a))&&(e[i]=a,++r)}i.size=r,i.empty=0,i.object=t=e}};return e&&Object.keys(e).forEach(t=>{i.set(t,e[t])}),i}var zh,Yie=o((()=>{Lh(),zh={}}));function Bh(e,t,n,r,i,a){if(!n&&n!==0)return a;let o=+n,s=e[0],c=Ym(e),l;if(c===void 0)return a;c{Xm()}));function U(e,t,n){let r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),Mh(r,n)}var Zie=o((()=>{Nh()}));function Vh(e,t,n,r){let i=t[0],a=t[t.length-1],o;return i>a&&(o=i,i=a,a=o),n=n===void 0||n,r=r===void 0||r,(n?i<=e:i{}));function Hh(e){return typeof e==`boolean`}var $ie=o((()=>{}));function Uh(e){return Object.prototype.toString.call(e)===`[object Date]`}var Wh=o((()=>{}));function Gh(e){return e!=null&&Sh(e[Symbol.iterator])}var eae=o((()=>{Ch()}));function Kh(e){return typeof e==`number`}var qh=o((()=>{}));function Jh(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var tae=o((()=>{}));function Yh(e){return typeof e==`string`}var Xh=o((()=>{}));function Zh(e,t,n){let r=e?t?yh(e).map(e=>e.replace(/\\(.)/g,`$1`)):yh(e):void 0,i=r?.length,a=n&&n.get||Em,o=e=>a(t?[e]:jm(e)),s;if(!i||!r)s=function(){return``};else if(i===1){let e=o(r[0]);s=function(t){return``+e(t)}}else{let e=r.map(o);s=function(t){let n=``+e[0](t),r=0;for(;++r{Tm(),bh(),km(),Mm()}));function Qh(e,t){let n=e[0],r=Ym(e),i=+t;return r===void 0?n:i?i===1?r:n+i*(r-n):n}var rae=o((()=>{Xm()}));function $h(e){e=+e||eg;let t,n,r,i=()=>{t={},n={},r=0},a=(i,a)=>(++r>e&&(n=t,t={},r=1),t[i]=a);return i(),{clear:i,has:e=>Ih(t,e)||Ih(n,e),get:e=>Ih(t,e)?t[e]:Ih(n,e)?a(e,n[e]):void 0,set:(e,n)=>Ih(t,e)?t[e]=n:a(e,n)}}var eg,iae=o((()=>{Lh(),eg=1e4}));function aae(e){return e===Array||typeof e==`function`&&e.prototype&&ArrayBuffer.isView(e.prototype)}function tg(e,t,n,r){let i=t.length,a=n.length;if(!a)return t;if(!i)return n;let o=t.constructor,s=r||(aae(o)?new o(i+a):Array(i+a)),c=0,l=0,u=0;for(;c0?n[l++]:t[c++];for(;c{}));function ng(e,t){let n=``;for(;--t>=0;)n+=e;return n}var rg=o((()=>{}));function ig(e,t,n,r){let i=n||` `,a=e+``,o=t-a.length;return o<=0?a:r===`left`?ng(i,o)+a:r===`center`?ng(i,~~(o/2))+a+ng(i,Math.ceil(o/2)):a+ng(i,o)}var sae=o((()=>{rg()}));function ag(e){return e&&Ym(e)-e[0]||0}var cae=o((()=>{Xm()}));function W(e){return H(e)?`[${e.map(e=>e===null?`null`:W(e))}]`:Wm(e)||Yh(e)?JSON.stringify(e).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`):e}var lae=o((()=>{Um(),Gm(),Xh()}));function og(e){return e==null||e===``?null:!e||e===`false`||e===`0`?!1:!!e}var uae=o((()=>{}));function sg(e,t){return t||=cg,e==null||e===``?null:t(e)}var cg,dae=o((()=>{Wh(),qh(),cg=e=>Kh(e)||Uh(e)?e:Date.parse(e)}));function lg(e){return e==null||e===``?null:e+``}var fae=o((()=>{}));function ug(e){let t={},n=e.length;for(let r=0;r{}));function dg(e,t,n,r){let i=r??`…`,a=e+``,o=a.length,s=Math.max(0,t-i.length);return o<=t?a:n===`left`?i+a.slice(o-s):n===`center`?a.slice(0,Math.ceil(s/2))+i+a.slice(o-~~(s/2)):a.slice(0,s)+i}var mae=o((()=>{}));function fg(e,t,n){if(e)if(t){let r=e.length;for(let i=0;i{})),pg=o((()=>{Tm(),Fie(),Iie(),Rie(),Bie(),Vie(),Hie(),bh(),Uie(),Wie(),Gie(),Kie(),Am(),Nh(),qie(),Jie(),Yie(),Pm(),Xie(),Lh(),Zie(),Qie(),Um(),$ie(),Wh(),Ch(),eae(),qh(),Gm(),tae(),Xh(),nae(),rae(),iae(),oae(),sae(),Xm(),rg(),cae(),Mm(),lae(),uae(),dae(),Qm(),fae(),pae(),mae(),hae()}));function mg(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function gae(e,t){var n=mg(e);return function(r,i){return t(n(r),i,e)}}function hg(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function gg(e,t){var n=e+``,r=n.length;return r9999?`+`+gg(e,6):gg(e,4)}function vae(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:_ae(e.getUTCFullYear(),4)+`-`+gg(e.getUTCMonth()+1,2)+`-`+gg(e.getUTCDate(),2)+(i?`T`+gg(t,2)+`:`+gg(n,2)+`:`+gg(r,2)+`.`+gg(i,3)+`Z`:r?`T`+gg(t,2)+`:`+gg(n,2)+`:`+gg(r,2)+`Z`:n||t?`T`+gg(t,2)+`:`+gg(n,2)+`Z`:``)}function yae(e){var t=RegExp(`["`+e+` -\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?gae(e,t):mg(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===bg&&--i,e.charCodeAt(i-1)===xg&&--i;function u(){if(c)return vg;if(l)return l=!1,_g;var t,r=a,o;if(e.charCodeAt(r)===yg){for(;a++=i?c=!0:(o=e.charCodeAt(a++))===bg?l=!0:o===xg&&(l=!0,e.charCodeAt(a)===bg&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a[e,t])),r=new Map(e.seriesOrder.map((e,t)=>[e,t]));return e.points.map(e=>({xKey:e.key,xLabel:e.label,xIndex:n.get(e.key)??0,value:e.value,valueText:t(e.value),n:e.n,seriesKey:e.seriesKey,seriesLabel:e.seriesLabel,seriesIndex:r.get(e.seriesKey)??0}))}function fie(){return{font:`Inter, ui-sans-serif, system-ui, sans-serif`,view:{stroke:null},axis:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,labelLimit:110,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:11,titleFontWeight:500,gridColor:`#E7EBEF`,domainColor:`#C9D1D9`,tickColor:`#C9D1D9`},legend:{labelColor:`#536273`,labelFont:`Inter, ui-sans-serif, system-ui, sans-serif`,labelFontSize:10,titleColor:`#344355`,titleFont:`Inter, ui-sans-serif, system-ui, sans-serif`,titleFontSize:10,symbolType:`circle`,orient:`bottom`,direction:`horizontal`}}}function pie(e,t){return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,data:{values:t},width:`container`,height:`container`,autosize:{type:`fit`,contains:`padding`,resize:!0},padding:4,config:fie(),usermeta:{rendererBoundary:`aios-chart-spec-v1`,chartId:e.id}}}function th(e){return[{field:`xLabel`,type:`nominal`,title:`Group`},...e?[{field:`seriesLabel`,type:`nominal`,title:`Series`}]:[],{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}function nh({spec:e,model:t,xTitle:n,yTitle:r,formatValue:i}){let a=die(t,i).filter(t=>e.kind!==`donut`||t.value>0),o=[...lie[e.palette??`brand`]],s=t.seriesOrder.length>0,c=s?{field:`seriesLabel`,type:`nominal`,title:null,sort:{field:`seriesIndex`,op:`min`},scale:{range:o},legend:{columns:4}}:{value:o[0]},l={field:`xLabel`,type:`nominal`,title:n??null,sort:{field:`xIndex`,op:`min`,order:`ascending`},axis:{labelAngle:t.xOrder.length>7?-35:0,labelOverlap:`greedy`}},u={field:`value`,type:`quantitative`,title:r??null,axis:uie(e)},d=pie(e,a);if(e.kind===`kpi`)return{...d,mark:{type:`text`,align:`center`,baseline:`middle`,font:`Inter, ui-sans-serif, system-ui, sans-serif`,fontSize:32,fontWeight:600,color:`#172433`},encoding:{text:{field:`valueText`,type:`nominal`},tooltip:[{field:`valueText`,type:`nominal`,title:`Value`},{field:`n`,type:`quantitative`,title:`Records`,format:`,`}]}};if(e.kind===`donut`)return{...d,mark:{type:`arc`,innerRadius:44,outerRadius:76,cornerRadius:2,padAngle:.01},encoding:{theta:{field:`value`,type:`quantitative`,stack:!0},color:{field:`xLabel`,type:`nominal`,title:null,sort:{field:`xIndex`,op:`min`},scale:{range:o},legend:{orient:`right`,direction:`vertical`,labelLimit:110}},order:{field:`xIndex`,type:`quantitative`},tooltip:th(!1)}};let f={x:l,y:{...u,stack:(e.kind===`bar`||e.kind===`area`)&&s?e.stacked?`zero`:null:void 0},color:c,tooltip:th(s)};return s&&e.kind===`bar`&&!e.stacked&&(f.xOffset={field:`seriesLabel`,type:`nominal`,sort:{field:`seriesIndex`,op:`min`}}),(e.kind===`line`||e.kind===`area`)&&(f.order={field:`xIndex`,type:`quantitative`},s&&(f.detail={field:`seriesKey`,type:`nominal`})),{...d,mark:e.kind===`bar`?{type:`bar`,cornerRadiusTopLeft:2,cornerRadiusTopRight:2}:e.kind===`area`?{type:`area`,opacity:s?.68:.48,line:!0,point:!0}:{type:`line`,strokeWidth:2,point:{filled:!0,size:46}},encoding:f}}function rh(e,t={}){let n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=n===``?1/0:t.maxLength===void 0?80:t.maxLength,{replacer:i}=t;return(function e(t,a,o){t&&typeof t.toJSON==`function`&&(t=t.toJSON());let s=JSON.stringify(t,i);if(s===void 0)return s;let c=r-a.length-o;if(s.length<=c){let e=s.replace(ih,(e,t)=>t||`${e} `);if(e.length<=c)return e}if(i!=null&&(t=JSON.parse(s),i=void 0),typeof t==`object`&&t){let r=a+n,i=[],o=0,s,c;if(Array.isArray(t)){s=`[`,c=`]`;let{length:n}=t;for(;o0)return[s,n+i.join(`,\n${r}`),c].join(`\n${a}`)}return s})(e,``,0)}var ih,mie=o((()=>{ih=/("(?:[^\\"]|\\.)*")|[:,]/g}));function ah(e,t,n){return Object.assign(e,{fields:t||[],fname:n})}function oh(e){return e==null?null:e.fname}function sh(e){return e==null?null:e.fields}var ch=o((()=>{}));function lh(e){return e.length===1?uh(e[0]):dh(e)}var uh,dh,fh=o((()=>{uh=e=>function(t){return t[e]},dh=e=>{let t=e.length;return function(n){for(let r=0;r{}));function mh(e){let t=[],n=e.length,r=null,i=0,a=``,o,s,c;e+=``;function l(){t.push(a+e.substring(o,s)),a=``,o=s+1}for(o=s=0;so?l():o=s+1:c===`[`?(s>o&&l(),i=o=s+1):c===`]`&&(i||V(`Access path missing open bracket: `+e),i>0&&l(),i=0,o=s+1);return i&&V(`Access path missing closing bracket: `+e),r&&V(`Access path missing closing quote: `+e),s>o&&(s++,l()),t}var hh=o((()=>{ph()}));function gh(e,t,n){let r=mh(e),i=r.length===1?r[0]:e;return ah((n&&n.get||lh)(r),[i],t||i)}var _h=o((()=>{ch(),fh(),hh()})),vh,yh,bh,xh,Sh,Ch,hie=o((()=>{ch(),_h(),vh=gh(`id`),yh=ah(e=>e,[],`identity`),bh=ah(()=>0,[],`zero`),xh=ah(()=>1,[],`one`),Sh=ah(()=>!0,[],`true`),Ch=ah(()=>!1,[],`false`)})),wh,gie=o((()=>{wh=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]==`function`),`__proto__`])}));function _ie(e,t,n){let r=[t,...n];console[e](...r)}function Th(e,t,n=_ie){let r=e||0;return{level(e){return arguments.length?(r=+e,this):r},error(...e){return r>=1&&n(t||`error`,`ERROR`,e),this},warn(...e){return r>=2&&n(t||`warn`,`WARN`,e),this},info(...e){return r>=3&&n(t||`log`,`INFO`,e),this},debug(...e){return r>=4&&n(t||`log`,`DEBUG`,e),this}}}var vie=o((()=>{})),H,Eh=o((()=>{H=Array.isArray}));function Dh(e){return e===Object(e)}var Oh=o((()=>{}));function kh(...e){return e.reduce((e,t)=>{for(let n in t)if(n===`signals`)e.signals=yie(e.signals,t.signals);else{let r=n===`legend`?{layout:1}:n===`style`||null;Ah(e,n,t[n],r)}return e},{})}function Ah(e,t,n,r){if(!jh(t))return;let i=e,a,o;if(Dh(n)&&!H(n)){let e=n;for(a in o=Dh(i[t])?i[t]:i[t]={},e)r&&(r===!0||r[a])?Ah(o,a,e[a]):jh(a)&&(o[a]=e[a])}else i[t]=n}function yie(e,t){if(e==null)return t;if(t==null)return e;let n={},r=[];function i(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(i),e.forEach(i),r}var jh,bie=o((()=>{Eh(),Oh(),jh=e=>e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}));function Mh(e){return e[e.length-1]}var Nh=o((()=>{}));function Ph(e){return e==null||e===``?null:+e}var Fh=o((()=>{}));function Ih(e){return e.length>0}function Lh(e,t,n,r){Ih(e)||V(`Domain array must not be empty`);let i=n(e[0]),a=n(Mh(e)),o=(a-i)*t;return[r(i-o),r(a-o)]}function Rh(e,t){return Lh(e,t,Qh,$h)}function zh(e,t){let n=Math.sign(e[0]);return Lh(e,t,Jh(n),qh(n))}function Bh(e,t,n){return Lh(e,t,Zh(n),Zh(1/n))}function Vh(e,t,n){return Lh(e,t,Yh(n),Xh(n))}function Hh(e,t,n,r,i){Ih(e)||V(`Domain array must not be empty`);let a=r(e[0]),o=r(Mh(e)),s=t==null?(a+o)/2:r(t);return[i(s+(a-s)*n),i(s+(o-s)*n)]}function Uh(e,t,n){return Hh(e,t,n,Qh,$h)}function Wh(e,t,n){let r=Math.sign(e[0]);return Hh(e,t,n,Jh(r),qh(r))}function Gh(e,t,n,r){return Hh(e,t,n,Zh(r),Zh(1/r))}function Kh(e,t,n,r){return Hh(e,t,n,Yh(r),Xh(r))}var qh,Jh,Yh,Xh,Zh,Qh,$h,xie=o((()=>{ph(),Nh(),Fh(),qh=e=>t=>e*Math.exp(t),Jh=e=>t=>Math.log(e*t),Yh=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Xh=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Zh=e=>t=>t<0?-((-t)**+e):t**+e,Qh=e=>Ph(e)??0,$h=e=>e}));function eg(e){return 1+~~(new Date(e).getMonth()/3)}function tg(e){return 1+~~(new Date(e).getUTCMonth()/3)}var Sie=o((()=>{}));function ng(e){return e==null?[]:H(e)?e:[e]}var rg=o((()=>{Eh()}));function ig(e,t,n){let r=e[0],i=e[1],a;return i=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}var Cie=o((()=>{}));function ag(e){return typeof e==`function`}var og=o((()=>{}));function sg(e,t,n){let r=n||{},i=ng(t)||[],a=[],o=[],s={},c=r.comparator||ug;return ng(e).forEach((e,t)=>{if(e==null)return;a.push(i[t]===cg?-1:1);let n=ag(e)?e:gh(e,void 0,r);o.push(n),(sh(n)||[]).forEach(e=>s[e]=1)}),o.length===0?null:ah(c(o,a),Object.keys(s))}var cg,lg,ug,dg,fg,wie=o((()=>{ch(),rg(),_h(),og(),cg=`descending`,lg=(e,t)=>{let n=e,r=t;return(nr||r==null)&&n!=null?1:(r=r instanceof Date?+r:r,n=n instanceof Date?+n:n)!==n&&r===r?-1:+(r!==r&&n===n)},ug=(e,t)=>e.length===1?dg(e[0],t[0]):fg(e,t,e.length),dg=(e,t)=>function(n,r){return lg(e(n),e(r))*t},fg=(e,t,n)=>(t.push(0),function(r,i){let a,o=0,s=-1;for(;o===0&&++se}var Tie=o((()=>{og()}));function mg(e,t){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}var Eie=o((()=>{}));function hg(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}var Die=o((()=>{}));function gg(e,t){let n=0,r,i,a,o;if(e&&(r=e.length))if(t==null){for(i=e[n];no&&(o=i))}else{for(i=t(e[n]);no&&(o=i))}return[a,o]}var Oie=o((()=>{}));function kie(e,t){let n=e.length,r=-1,i,a,o,s,c;if(t==null){for(;++r=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c=s){o=c=s;break}if(r===n)return[-1,-1];for(i=a=r;++rs&&(o=s,i=r),c{}));function _g(e,t){return Object.hasOwn(e,t)}var vg=o((()=>{}));function yg(e){let t={},n;function r(e){return _g(t,e)&&t[e]!==bg}let i={size:0,empty:0,object:t,has:r,get(e){return r(e)?t[e]:void 0},set(e,n){return r(e)||(++i.size,t[e]===bg&&--i.empty),t[e]=n,this},delete(e){return r(e)&&(--i.size,++i.empty,t[e]=bg),this},clear(){i.size=i.empty=0,i.object=t={}},test(e){return arguments.length?(n=e,i):n},clean(){let e={},r=0;for(let i in t){let a=t[i];a!==bg&&(!n||!n(a))&&(e[i]=a,++r)}i.size=r,i.empty=0,i.object=t=e}};return e&&Object.keys(e).forEach(t=>{i.set(t,e[t])}),i}var bg,jie=o((()=>{vg(),bg={}}));function Mie(e,t,n,r,i,a){if(!n&&n!==0)return a;let o=+n,s=e[0],c=Mh(e),l;if(c===void 0)return a;c{Nh()}));function U(e,t,n){let r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),hg(r,n)}var Pie=o((()=>{Die()}));function xg(e,t,n,r){let i=t[0],a=t[t.length-1],o;return i>a&&(o=i,i=a,a=o),n=n===void 0||n,r=r===void 0||r,(n?i<=e:i{}));function Sg(e){return typeof e==`boolean`}var Iie=o((()=>{}));function Cg(e){return Object.prototype.toString.call(e)===`[object Date]`}var Lie=o((()=>{}));function Rie(e){return e!=null&&ag(e[Symbol.iterator])}var zie=o((()=>{og()}));function wg(e){return typeof e==`number`}var Bie=o((()=>{}));function Tg(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var Vie=o((()=>{}));function Eg(e){return typeof e==`string`}var Hie=o((()=>{}));function Dg(e,t,n){let r=e?t?ng(e).map(e=>e.replace(/\\(.)/g,`$1`)):ng(e):void 0,i=r?.length,a=n&&n.get||lh,o=e=>a(t?[e]:mh(e)),s;if(!i||!r)s=function(){return``};else if(i===1){let e=o(r[0]);s=function(t){return``+e(t)}}else{let e=r.map(o);s=function(t){let n=``+e[0](t),r=0;for(;++r{ch(),rg(),fh(),hh()}));function Wie(e,t){let n=e[0],r=Mh(e),i=+t;return r===void 0?n:i?i===1?r:n+i*(r-n):n}var Gie=o((()=>{Nh()}));function Kie(e){e=+e||qie;let t,n,r,i=()=>{t={},n={},r=0},a=(i,a)=>(++r>e&&(n=t,t={},r=1),t[i]=a);return i(),{clear:i,has:e=>_g(t,e)||_g(n,e),get:e=>_g(t,e)?t[e]:_g(n,e)?a(e,n[e]):void 0,set:(e,n)=>_g(t,e)?t[e]=n:a(e,n)}}var qie,Jie=o((()=>{vg(),qie=1e4}));function Yie(e){return e===Array||typeof e==`function`&&e.prototype&&ArrayBuffer.isView(e.prototype)}function Xie(e,t,n,r){let i=t.length,a=n.length;if(!a)return t;if(!i)return n;let o=t.constructor,s=r||(Yie(o)?new o(i+a):Array(i+a)),c=0,l=0,u=0;for(;c0?n[l++]:t[c++];for(;c{}));function Og(e,t){let n=``;for(;--t>=0;)n+=e;return n}var Qie=o((()=>{}));function $ie(e,t,n,r){let i=n||` `,a=e+``,o=t-a.length;return o<=0?a:r===`left`?Og(i,o)+a:r===`center`?Og(i,~~(o/2))+a+Og(i,Math.ceil(o/2)):a+Og(i,o)}var eae=o((()=>{Qie()}));function kg(e){return e&&Mh(e)-e[0]||0}var tae=o((()=>{Nh()}));function W(e){return H(e)?`[${e.map(e=>e===null?`null`:W(e))}]`:Dh(e)||Eg(e)?JSON.stringify(e).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`):e}var nae=o((()=>{Eh(),Oh(),Hie()}));function Ag(e){return e==null||e===``?null:!e||e===`false`||e===`0`?!1:!!e}var rae=o((()=>{}));function jg(e,t){return t||=iae,e==null||e===``?null:t(e)}var iae,aae=o((()=>{Lie(),Bie(),iae=e=>wg(e)||Cg(e)?e:Date.parse(e)}));function Mg(e){return e==null||e===``?null:e+``}var oae=o((()=>{}));function Ng(e){let t={},n=e.length;for(let r=0;r{}));function cae(e,t,n,r){let i=r??`…`,a=e+``,o=a.length,s=Math.max(0,t-i.length);return o<=t?a:n===`left`?i+a.slice(o-s):n===`center`?a.slice(0,Math.ceil(s/2))+i+a.slice(o-~~(s/2)):a.slice(0,s)+i}var lae=o((()=>{}));function Pg(e,t,n){if(e)if(t){let r=e.length;for(let i=0;i{})),Fg=o((()=>{ch(),hie(),gie(),vie(),bie(),xie(),Sie(),rg(),Cie(),wie(),Tie(),Eie(),ph(),Die(),Oie(),Aie(),jie(),_h(),Nie(),vg(),Pie(),Fie(),Eh(),Iie(),Lie(),og(),zie(),Bie(),Oh(),Vie(),Hie(),Uie(),Gie(),Jie(),Zie(),eae(),Nh(),Qie(),tae(),hh(),nae(),rae(),aae(),Fh(),oae(),sae(),lae(),uae()}));function dae(e){return Function(`d`,`return {`+e.map(function(e,t){return JSON.stringify(e)+`: d[`+t+`] || ""`}).join(`,`)+`}`)}function fae(e,t){var n=dae(e);return function(r,i){return t(n(r),i,e)}}function pae(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}function Ig(e,t){var n=e+``,r=n.length;return r9999?`+`+Ig(e,6):Ig(e,4)}function hae(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?`Invalid Date`:mae(e.getUTCFullYear(),4)+`-`+Ig(e.getUTCMonth()+1,2)+`-`+Ig(e.getUTCDate(),2)+(i?`T`+Ig(t,2)+`:`+Ig(n,2)+`:`+Ig(r,2)+`.`+Ig(i,3)+`Z`:r?`T`+Ig(t,2)+`:`+Ig(n,2)+`:`+Ig(r,2)+`Z`:n||t?`T`+Ig(t,2)+`:`+Ig(n,2)+`Z`:``)}function gae(e){var t=RegExp(`["`+e+` +\r]`),n=e.charCodeAt(0);function r(e,t){var n,r,a=i(e,function(e,i){if(n)return n(e,i-1);r=e,n=t?fae(e,t):dae(e)});return a.columns=r||[],a}function i(e,t){var r=[],i=e.length,a=0,o=0,s,c=i<=0,l=!1;e.charCodeAt(i-1)===Bg&&--i,e.charCodeAt(i-1)===Vg&&--i;function u(){if(c)return Rg;if(l)return l=!1,Lg;var t,r=a,o;if(e.charCodeAt(r)===zg){for(;a++=i?c=!0:(o=e.charCodeAt(a++))===Bg?l=!0:o===Vg&&(l=!0,e.charCodeAt(a)===Bg&&++a),e.slice(r+1,t-1).replace(/""/g,`"`)}for(;a{_g={},vg={},yg=34,bg=10,xg=13})),xae=o((()=>{bae()}));function Sae(e){return e}var Sg=o((()=>{}));function Cae(e){if(e==null)return Sae;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c{Sg()}));function wae(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}var Tae=o((()=>{}));function Eae(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return wg(e,t)})}:wg(e,t)}function wg(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Tg(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Tg(e,t){var n=Cae(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a{Tae(),Cg()}));function Dae(e,t){var n={},r={},i={},a=[],o=-1;t.forEach(function(n,r){var i=e.arcs[n<0?~n:n],a;i.length<3&&!i[1][0]&&!i[1][1]&&(a=t[++o],t[o]=n,t[r]=a)}),t.forEach(function(e){var t=s(e),n=t[0],a=t[1],o,c;if(o=i[n])if(delete i[o.end],o.push(e),o.end=a,c=r[a]){delete r[c.start];var l=c===o?o:o.concat(c);r[l.start=o.start]=i[l.end=c.end]=l}else r[o.start]=i[o.end]=o;else if(o=r[a])if(delete r[o.start],o.unshift(e),o.start=n,c=i[n]){delete i[c.end];var u=c===o?o:c.concat(o);r[u.start=c.start]=i[u.end=o.end]=u}else r[o.start]=i[o.end]=o;else o=[e],r[o.start=n]=i[o.end=a]=o});function s(t){var n=e.arcs[t<0?~t:t],r=n[0],i;return e.transform?(i=[0,0],n.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=n[n.length-1],t<0?[i,r]:[r,i]}function c(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach(function(e){n[e<0?~e:e]=1}),a.push(i)}}return c(i,r),c(r,i),t.forEach(function(e){n[e<0?~e:e]||a.push([e])}),a}var Dg=o((()=>{}));function Oae(e){return Tg(e,kae.apply(this,arguments))}function kae(e,t,n){var r,i,a;if(arguments.length>1)r=Aae(e,t,n);else for(i=0,r=Array(a=e.arcs.length);i{Eg(),Dg()})),Mae=o((()=>{Cg(),Eg(),jae(),Dg(),Sg()}));function Og(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var kg=o((()=>{}));function Nae(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var Ag=o((()=>{}));function jg(e){let t,n,r;e.length===2?(t=e===Og||e===Nae?e:Pae,n=e,r=e):(t=Og,n=(t,n)=>Og(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 Pae(){return 0}var Mg=o((()=>{kg(),Ag()}));function Ng(e){return e===null?NaN:+e}function*Fae(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 Pg=o((()=>{})),Fg,Ig,Lg,Iae=o((()=>{kg(),Mg(),Pg(),Fg=jg(Og),Ig=Fg.right,Lg=Fg.left,jg(Ng).center}));function Lae(e,t){let n=0,r,i=0,a=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(r=t-i,i+=r/++n,a+=r*(t-i));else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}var Rg=o((()=>{}));function Rae(e,t){let n=Lae(e,t);return n&&Math.sqrt(n)}var zae=o((()=>{Rg()})),zg,Bae=o((()=>{zg=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}}}));function Bg({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Vg({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Hg({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Ug(e){return typeof e==`object`&&e?e.valueOf():e}var Wg,Gg,Kg=o((()=>{Wg=class extends Map{constructor(e,t=Ug){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(Bg(this,e))}has(e){return super.has(Bg(this,e))}set(e,t){return super.set(Vg(this,e),t)}delete(e){return super.delete(Hg(this,e))}},Gg=class extends Set{constructor(e,t=Ug){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let t of e)this.add(t)}has(e){return super.has(Bg(this,e))}add(e){return super.add(Vg(this,e))}delete(e){return super.delete(Hg(this,e))}}}));function Vae(e,t){return Array.from(t,t=>e[t])}var Hae=o((()=>{}));function Uae(e=Og){if(e===Og)return qg;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 qg(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Jg=o((()=>{kg()}));function Yg(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=$g?10:a>=e_?5:a>=t_?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{$g=Math.sqrt(50),e_=Math.sqrt(10),t_=Math.sqrt(2)}));function n_(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}var r_=o((()=>{}));function i_(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}var a_=o((()=>{}));function o_(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?qg:Uae(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));o_(e,t,u,d,i)}let a=e[t],o=n,s=r;for(s_(e,n,t),i(e[r],a)>0&&s_(e,n,r);o0;)--s}i(e[n],a)===0?s_(e,n,s):(++s,s_(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function s_(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}var c_=o((()=>{Jg()}));function l_(e,t,n){if(e=Float64Array.from(Fae(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return i_(e);if(t>=1)return n_(e);var r,i=(r-1)*t,a=Math.floor(i),o=n_(o_(e,a).subarray(0,a+1));return o+(i_(e.subarray(a+1))-o)*(i-a)}}function u_(e,t,n=Ng){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)}}var d_=o((()=>{r_(),a_(),c_(),Pg()}));function Gae(e,t){let n=0,r=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}var Kae=o((()=>{}));function f_(e,t){return l_(e,.5,t)}var qae=o((()=>{d_()}));function*Jae(e){for(let t of e)yield*t}function p_(e){return Array.from(Jae(e))}var Yae=o((()=>{}));function m_(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{}));function h_(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}var Zae=o((()=>{}));function Qae(e,...t){e=new Gg(e),t=t.map($ae);out:for(let n of e)for(let r of t)if(!r.has(n)){e.delete(n);continue out}return e}function $ae(e){return e instanceof Gg?e:new Gg(e)}var eoe=o((()=>{Kg()}));function toe(...e){let t=new Gg;for(let n of e)for(let e of n)t.add(e);return t}var noe=o((()=>{Kg()})),g_=o((()=>{Iae(),kg(),Mg(),Ag(),zae(),Bae(),Kg(),Jg(),Wae(),d_(),r_(),Kae(),qae(),Yae(),a_(),Hae(),c_(),Xae(),Zae(),Rg(),eoe(),noe()}));function roe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function __(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)]}var v_=o((()=>{}));function y_(e){return e=__(Math.abs(e)),e?e[1]:NaN}var b_=o((()=>{v_()}));function ioe(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)}}var aoe=o((()=>{}));function ooe(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var soe=o((()=>{}));function x_(e){if(!(t=C_.exec(e)))throw Error(`invalid format: `+e);var t;return new S_({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]})}function S_(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+``}var C_,w_=o((()=>{C_=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,x_.prototype=S_.prototype,S_.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 coe(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var loe=o((()=>{}));function uoe(e,t){var n=__(e,t);if(!n)return T_=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(T_=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`)+__(e,Math.max(0,t+a-1))[0]}var T_,E_=o((()=>{v_()}));function D_(e,t){var n=__(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 doe=o((()=>{v_()})),O_,foe=o((()=>{v_(),E_(),doe(),O_={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:roe,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)=>D_(e*100,t),r:D_,s:uoe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}}));function k_(e){return e}var poe=o((()=>{}));function A_(e){var t=e.grouping===void 0||e.thousands===void 0?k_:ioe(j_.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?k_:ooe(j_.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=x_(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`):O_[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=O_[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=coe(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&T_!==void 0?M_[8+T_/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(y_(t)/3)))*3,r=10**-n,i=l((e=x_(e),e.type=`f`,e),{suffix:M_[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var j_,M_,N_=o((()=>{b_(),aoe(),soe(),w_(),loe(),foe(),E_(),poe(),j_=Array.prototype.map,M_=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`]}));function moe(e){return P_=A_(e),F_=P_.format,I_=P_.formatPrefix,P_}var P_,F_,I_,hoe=o((()=>{N_(),moe({thousands:`,`,grouping:[3],currency:[`$`,``]})}));function L_(e){return Math.max(0,-y_(Math.abs(e)))}var goe=o((()=>{b_()}));function R_(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(y_(t)/3)))*3-y_(Math.abs(e)))}var _oe=o((()=>{b_()}));function z_(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,y_(t)-y_(e))+1}var voe=o((()=>{b_()})),B_=o((()=>{hoe(),N_(),w_(),goe(),_oe(),voe()}));function V_(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(sV_(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)=>(H_.setTime(+t),U_.setTime(+r),e(H_),e(U_),Math.floor(n(H_,U_))),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 H_,U_,W_=o((()=>{H_=new Date,U_=new Date})),G_,K_=o((()=>{W_(),G_=V_(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e),G_.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?V_(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):G_),G_.range})),q_,J_,Y_,X_,Z_,Q_,$_,ev=o((()=>{q_=1e3,J_=q_*60,Y_=J_*60,X_=Y_*24,Z_=X_*7,Q_=X_*30,$_=X_*365})),tv,nv=o((()=>{W_(),ev(),tv=V_(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*q_)},(e,t)=>(t-e)/q_,e=>e.getUTCSeconds()),tv.range})),rv,iv,av=o((()=>{W_(),ev(),rv=V_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*q_)},(e,t)=>{e.setTime(+e+t*J_)},(e,t)=>(t-e)/J_,e=>e.getMinutes()),rv.range,iv=V_(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*J_)},(e,t)=>(t-e)/J_,e=>e.getUTCMinutes()),iv.range})),ov,sv,cv=o((()=>{W_(),ev(),ov=V_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*q_-e.getMinutes()*J_)},(e,t)=>{e.setTime(+e+t*Y_)},(e,t)=>(t-e)/Y_,e=>e.getHours()),ov.range,sv=V_(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Y_)},(e,t)=>(t-e)/Y_,e=>e.getUTCHours()),sv.range})),lv,uv,dv,fv=o((()=>{W_(),ev(),lv=V_(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*J_)/X_,e=>e.getDate()-1),lv.range,uv=V_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/X_,e=>e.getUTCDate()-1),uv.range,dv=V_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/X_,e=>Math.floor(e/X_)),dv.range}));function pv(e){return V_(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())*J_)/Z_)}function mv(e){return V_(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)/Z_)}var hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv=o((()=>{W_(),ev(),hv=pv(0),gv=pv(1),_v=pv(2),vv=pv(3),yv=pv(4),bv=pv(5),xv=pv(6),hv.range,gv.range,_v.range,vv.range,yv.range,bv.range,xv.range,Sv=mv(0),Cv=mv(1),wv=mv(2),Tv=mv(3),Ev=mv(4),Dv=mv(5),Ov=mv(6),Sv.range,Cv.range,wv.range,Tv.range,Ev.range,Dv.range,Ov.range})),Av,jv,Mv=o((()=>{W_(),Av=V_(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()),Av.range,jv=V_(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()),jv.range})),Nv,Pv,Fv=o((()=>{W_(),Nv=V_(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()),Nv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:V_(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)}),Nv.range,Pv=V_(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()),Pv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:V_(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)}),Pv.range}));function Iv(e,t,n,r,i,a){let o=[[tv,1,q_],[tv,5,5*q_],[tv,15,15*q_],[tv,30,30*q_],[a,1,J_],[a,5,5*J_],[a,15,15*J_],[a,30,30*J_],[i,1,Y_],[i,3,3*Y_],[i,6,6*Y_],[i,12,12*Y_],[r,1,X_],[r,2,2*X_],[n,1,Z_],[t,1,Q_],[t,3,3*Q_],[e,1,$_]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Qg(t/$_,n/$_,r));if(a===0)return G_.every(Math.max(Qg(t,n,r),1));let[s,c]=o[i/o[a-1][2]{g_(),ev(),K_(),nv(),av(),cv(),fv(),kv(),Mv(),Fv(),[Lv,Rv]=Iv(Pv,jv,Sv,dv,sv,iv),[zv,Bv]=Iv(Nv,Av,hv,lv,ov,rv)})),Vv=o((()=>{W_(),K_(),nv(),av(),cv(),fv(),kv(),Mv(),Fv(),yoe()}));function Hv(e){let t=yh(e).slice(),n={};return t.length||V(`Missing time unit.`),t.forEach(e=>{Ih(Ey,e)?n[e]=1:V(`Invalid time unit: ${e}.`)}),(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+ +!!n.dayofyear>1&&V(`Incompatible time units: ${e}`),t.sort((e,t)=>Ey[e]-Ey[t]),t}function Uv(e,t){let n=Mh({},Dy,t),r=Hv(e),i=r.length,a=``,o=0,s,c;for(o=0;oo;--s)if(c=r.slice(o,s).join(`-`),n[c]!=null){a+=n[c],o=s;break}return a.trim()}function Wv(e){return Oy.setFullYear(e),Oy.setMonth(0),Oy.setDate(1),Oy.setHours(0,0,0,0),Oy}function Gv(e){return qv(new Date(e))}function Kv(e){return Jv(new Date(e))}function qv(e){return lv.count(Wv(e.getFullYear())-1,e)}function Jv(e){return hv.count(Wv(e.getFullYear())-1,e)}function Yv(e){return Wv(e).getDay()}function boe(e,t,n,r,i,a,o){if(0<=e&&e<100){let s=new Date(-1,t,n,r,i,a,o);return s.setFullYear(e),s}return new Date(e,t,n,r,i,a,o)}function Xv(e){return Qv(new Date(e))}function Zv(e){return $v(new Date(e))}function Qv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return uv.count(t-1,e)}function $v(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return Sv.count(t-1,e)}function ey(e){return Oy.setTime(Date.UTC(e,0,1)),Oy.getUTCDay()}function xoe(e,t,n,r,i,a,o){if(0<=e&&e<100){let e=new Date(Date.UTC(-1,t,n,r,i,a,o));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,i,a,o))}function ty(e,t,n,r,i){let a=t||1,o=Ym(e),s=(e,t,i)=>(i||=e,Soe(n[i],r[i],e===o&&a,t)),c=new Date,l=ug(e),u=l.year?s(hy):Ah(2012),d=l.month?s(_y):l.quarter?s(gy):Lm,f=l.week&&l.day?s(`day`,1,`weekday`):l.week?s(vy,1):l.day?s(`day`,1):l.date?s(yy,1):l.dayofyear?s(by,1):Rm,p=l.hours?s(xy):Lm,m=l.minutes?s(Sy):Lm,h=l.seconds?s(Cy):Lm,g=l.milliseconds?s(wy):Lm;return function(e){c.setTime(+e);let t=u(c);return i(t,d(c),f(c,t),p(c),m(c),h(c),g(c))}}function Soe(e,t,n,r){let i=n<=1?e:r?(t,i)=>r+n*Math.floor((e(t,i)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(i(e,n),n):i}function ny(e,t,n){return t+e*7-(n+6)%7}function ry(e,t){return ty(e,t||1,ky,Ay,boe)}function iy(e,t){return ty(e,t||1,jy,My,xoe)}function ay(e){return Ny[e]}function oy(e){return Py[e]}function sy(e,t,n){return e?e.offset(t,n):void 0}function cy(e,t,n){return sy(ay(e),t,n)}function ly(e,t,n){return sy(oy(e),t,n)}function uy(e,t,n,r){return e?e.range(t,n,r):void 0}function dy(e,t,n,r){return uy(ay(e),t,n,r)}function fy(e,t,n,r){return uy(oy(e),t,n,r)}function py(e){let t=e.extent,n=e.maxbins||40,r=Math.abs(ag(t))/n,i=jg(e=>e[2]).right(Jy,r),a,o;return i===Jy.length?(a=qy,o=Qg(t[0]/Vy,t[1]/Vy,n)):i?(i=Jy[r/Jy[i-1][2]{let n=t(e),r=new Date(n);return Number.isNaN(+r)&&V(`Invalid date: ${n}`),r}),a=Yy.findIndex(e=>!e.aligned(i,r)),o=Yy.findIndex(e=>!e.skippable&&!e.aligned(i,r)),s=o>a+1?o:a,{units:c,step:l}=Yy[s-1];return{units:c,step:l}}var hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy,Gy,Coe,woe,Ky,qy,Jy,Toe,Eoe,Yy,Xy=o((()=>{pg(),Vv(),g_(),hy=`year`,gy=`quarter`,_y=`month`,vy=`week`,yy=`date`,by=`dayofyear`,xy=`hours`,Sy=`minutes`,Cy=`seconds`,wy=`milliseconds`,Ty=[hy,gy,_y,vy,yy,`day`,by,xy,Sy,Cy,wy],Ey=Ty.reduce((e,t,n)=>(e[t]=1+n,e),{}),Dy={[hy]:`%Y `,[gy]:`Q%q `,[_y]:`%b `,[yy]:`%d `,[vy]:`W%U `,day:`%a `,[by]:`%j `,[xy]:`%H:00`,[Sy]:`00:%M`,[Cy]:`:%S`,[wy]:`.%L`,[`${hy}-${_y}`]:`%Y-%m `,[`${hy}-${_y}-${yy}`]:`%Y-%m-%d `,[`${xy}-${Sy}`]:`%H:%M`},Oy=new Date,ky={[hy]:e=>e.getFullYear(),[gy]:e=>Math.floor(e.getMonth()/3),[_y]:e=>e.getMonth(),[yy]:e=>e.getDate(),[xy]:e=>e.getHours(),[Sy]:e=>e.getMinutes(),[Cy]:e=>e.getSeconds(),[wy]:e=>e.getMilliseconds(),[by]:e=>qv(e),[vy]:e=>Jv(e),weekday:(e,t)=>ny(Jv(e),e.getDay(),Yv(t)),day:(e,t)=>ny(1,e.getDay(),Yv(t))},Ay={[gy]:e=>3*e,[vy]:(e,t)=>ny(e,0,Yv(t))},jy={[hy]:e=>e.getUTCFullYear(),[gy]:e=>Math.floor(e.getUTCMonth()/3),[_y]:e=>e.getUTCMonth(),[yy]:e=>e.getUTCDate(),[xy]:e=>e.getUTCHours(),[Sy]:e=>e.getUTCMinutes(),[Cy]:e=>e.getUTCSeconds(),[wy]:e=>e.getUTCMilliseconds(),[by]:e=>Qv(e),[vy]:e=>$v(e),day:(e,t)=>ny(1,e.getUTCDay(),ey(t)),weekday:(e,t)=>ny($v(e),e.getUTCDay(),ey(t))},My={[gy]:e=>3*e,[vy]:(e,t)=>ny(e,0,ey(t))},Ny={[hy]:Nv,[gy]:Av.every(3),[_y]:Av,[vy]:hv,[yy]:lv,day:lv,[by]:lv,[xy]:ov,[Sy]:rv,[Cy]:tv,[wy]:G_},Py={[hy]:Pv,[gy]:jv.every(3),[_y]:jv,[vy]:Sv,[yy]:uv,day:uv,[by]:uv,[xy]:sv,[Sy]:iv,[Cy]:tv,[wy]:G_},Fy=1e3,Iy=Fy*60,Ly=Iy*60,Ry=Ly*24,zy=Ry*7,By=Ry*30,Vy=Ry*365,Hy=[hy,_y,yy,xy,Sy,Cy,wy],Uy=Hy.slice(0,-1),Wy=Uy.slice(0,-1),Gy=Wy.slice(0,-1),Coe=Gy.slice(0,-1),woe=[hy,vy],Ky=[hy,_y],qy=[hy],Jy=[[Uy,1,Fy],[Uy,5,5*Fy],[Uy,15,15*Fy],[Uy,30,30*Fy],[Wy,1,Iy],[Wy,5,5*Iy],[Wy,15,15*Iy],[Wy,30,30*Iy],[Gy,1,Ly],[Gy,3,3*Ly],[Gy,6,6*Ly],[Gy,12,12*Ly],[Coe,1,Ry],[woe,1,zy],[Ky,1,By],[Ky,3,3*By],[qy,1,Vy]],Toe={[hy]:e=>e.getFullYear(),[_y]:e=>e.getMonth(),[yy]:e=>e.getDate(),day:e=>e.getDay(),[xy]:e=>e.getHours(),[Sy]:e=>e.getMinutes(),[Cy]:e=>e.getSeconds(),[wy]:e=>e.getMilliseconds()},Eoe={[hy]:e=>e.getUTCFullYear(),[_y]:e=>e.getUTCMonth(),[yy]:e=>e.getUTCDate(),day:e=>e.getUTCDay(),[xy]:e=>e.getUTCHours(),[Sy]:e=>e.getUTCMinutes(),[Cy]:e=>e.getUTCSeconds(),[wy]:e=>e.getUTCMilliseconds()},Yy=[{units:[hy,_y,yy,xy,Sy,Cy,wy],step:1,aligned:()=>!0},{units:[hy,_y,yy,xy,Sy,Cy],step:1,aligned:(e,t)=>e.every(e=>t[wy](e)===0)},{units:[hy,_y,yy,xy,Sy],step:1,aligned:(e,t)=>e.every(e=>t[Cy](e)===0)},{units:[hy,_y,yy,xy,Sy],step:5,aligned:(e,t)=>e.every(e=>t[Sy](e)%5==0)},{units:[hy,_y,yy,xy,Sy],step:10,aligned:(e,t)=>e.every(e=>t[Sy](e)%10==0)},{units:[hy,_y,yy,xy],step:1,aligned:(e,t)=>e.every(e=>t[Sy](e)===0)},{units:[hy,_y,yy],step:1,aligned:(e,t)=>e.every(e=>t[xy](e)===0)},{units:[hy,vy],step:1,skippable:!0,aligned:(e,t)=>new Set(e.map(e=>t.day(e))).size===1},{units:[hy,_y],step:1,aligned:(e,t)=>e.every(e=>t[yy](e)===1)},{units:[hy,_y],step:3,aligned:(e,t)=>e.every(e=>t[_y](e)%3==0)},{units:[hy],step:1,aligned:(e,t)=>e.every(e=>t[_y](e)===0)},{units:[hy],step:10,aligned:(e,t)=>e.every(e=>t[hy](e)%10==0)},{aligned:()=>!1}]}));function Zy(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Qy(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function $y(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Doe(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=tb(i),u=nb(i),d=tb(a),f=nb(a),p=tb(o),m=nb(o),h=tb(s),g=nb(s),_=tb(c),v=nb(c),y={a:ee,A:N,b:te,B:ne,c:null,d:Yoe,e:Yoe,f:ese,g:dse,G:pse,H:Xoe,I:Zoe,j:Qoe,L:$oe,m:tse,M:nse,p:P,q:re,Q:Ise,s:Lse,S:rse,u:ise,U:ase,V:sse,w:cse,W:lse,x:null,X:null,y:use,Y:fse,Z:mse,"%":Fse},b={a:F,A:ie,b:ae,B:oe,c:null,d:hse,e:hse,f:bse,g:jse,G:Nse,H:gse,I:_se,j:vse,L:yse,m:xse,M:Sse,p:se,q:ce,Q:Ise,s:Lse,S:Cse,u:wse,U:Tse,V:Dse,w:Ose,W:kse,x:null,X:null,y:Ase,Y:Mse,Z:Pse,"%":Fse},x={a:E,A:D,b:O,B:k,c:A,d:zoe,e:zoe,f:Goe,g:Foe,G:Poe,H:Voe,I:Voe,j:Boe,L:Woe,m:Roe,M:Hoe,p:T,q:Loe,Q:qoe,s:Joe,S:Uoe,u:Aoe,U:joe,V:Moe,w:koe,W:Noe,x:j,X:M,y:Foe,Y:Poe,Z:Ioe,"%":Koe};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i53)return null;`w`in r||(r.w=1),`Z`in r?(a=Qy($y(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?Cv.ceil(a):Cv(a),a=uv.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=Zy($y(r.y,0,1)),o=a.getDay(),a=o>4||o===0?gv.ceil(a):gv(a),a=lv.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?Qy($y(r.y,0,1)).getUTCDay():Zy($y(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,Qy(r)):Zy(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 rb?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 ee(e){return o[e.getDay()]}function N(e){return a[e.getDay()]}function te(e){return c[e.getMonth()]}function ne(e){return s[e.getMonth()]}function P(e){return i[+(e.getHours()>=12)]}function re(e){return 1+~~(e.getMonth()/3)}function F(e){return o[e.getUTCDay()]}function ie(e){return a[e.getUTCDay()]}function ae(e){return c[e.getUTCMonth()]}function oe(e){return s[e.getUTCMonth()]}function se(e){return i[+(e.getUTCHours()>=12)]}function ce(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}function eb(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function koe(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Aoe(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function joe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Moe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Noe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Poe(e,t,n){var r=ib.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Foe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ioe(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 Loe(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Roe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function zoe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Boe(e,t,n){var r=ib.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Voe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Hoe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Uoe(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Woe(e,t,n){var r=ib.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Goe(e,t,n){var r=ib.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Koe(e,t,n){var r=Rse.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function qoe(e,t,n){var r=ib.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Joe(e,t,n){var r=ib.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Yoe(e,t){return eb(e.getDate(),t,2)}function Xoe(e,t){return eb(e.getHours(),t,2)}function Zoe(e,t){return eb(e.getHours()%12||12,t,2)}function Qoe(e,t){return eb(1+lv.count(Nv(e),e),t,3)}function $oe(e,t){return eb(e.getMilliseconds(),t,3)}function ese(e,t){return $oe(e,t)+`000`}function tse(e,t){return eb(e.getMonth()+1,t,2)}function nse(e,t){return eb(e.getMinutes(),t,2)}function rse(e,t){return eb(e.getSeconds(),t,2)}function ise(e){var t=e.getDay();return t===0?7:t}function ase(e,t){return eb(hv.count(Nv(e)-1,e),t,2)}function ose(e){var t=e.getDay();return t>=4||t===0?yv(e):yv.ceil(e)}function sse(e,t){return e=ose(e),eb(yv.count(Nv(e),e)+(Nv(e).getDay()===4),t,2)}function cse(e){return e.getDay()}function lse(e,t){return eb(gv.count(Nv(e)-1,e),t,2)}function use(e,t){return eb(e.getFullYear()%100,t,2)}function dse(e,t){return e=ose(e),eb(e.getFullYear()%100,t,2)}function fse(e,t){return eb(e.getFullYear()%1e4,t,4)}function pse(e,t){var n=e.getDay();return e=n>=4||n===0?yv(e):yv.ceil(e),eb(e.getFullYear()%1e4,t,4)}function mse(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+eb(t/60|0,`0`,2)+eb(t%60,`0`,2)}function hse(e,t){return eb(e.getUTCDate(),t,2)}function gse(e,t){return eb(e.getUTCHours(),t,2)}function _se(e,t){return eb(e.getUTCHours()%12||12,t,2)}function vse(e,t){return eb(1+uv.count(Pv(e),e),t,3)}function yse(e,t){return eb(e.getUTCMilliseconds(),t,3)}function bse(e,t){return yse(e,t)+`000`}function xse(e,t){return eb(e.getUTCMonth()+1,t,2)}function Sse(e,t){return eb(e.getUTCMinutes(),t,2)}function Cse(e,t){return eb(e.getUTCSeconds(),t,2)}function wse(e){var t=e.getUTCDay();return t===0?7:t}function Tse(e,t){return eb(Sv.count(Pv(e)-1,e),t,2)}function Ese(e){var t=e.getUTCDay();return t>=4||t===0?Ev(e):Ev.ceil(e)}function Dse(e,t){return e=Ese(e),eb(Ev.count(Pv(e),e)+(Pv(e).getUTCDay()===4),t,2)}function Ose(e){return e.getUTCDay()}function kse(e,t){return eb(Cv.count(Pv(e)-1,e),t,2)}function Ase(e,t){return eb(e.getUTCFullYear()%100,t,2)}function jse(e,t){return e=Ese(e),eb(e.getUTCFullYear()%100,t,2)}function Mse(e,t){return eb(e.getUTCFullYear()%1e4,t,4)}function Nse(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ev(e):Ev.ceil(e),eb(e.getUTCFullYear()%1e4,t,4)}function Pse(){return`+0000`}function Fse(){return`%`}function Ise(e){return+e}function Lse(e){return Math.floor(e/1e3)}var rb,ib,Rse,zse,Bse=o((()=>{Vv(),rb={"-":``,_:` `,0:`0`},ib=/^\s*\d+/,Rse=/^%/,zse=/[\\^$*+?|[\]().{}]/g}));function Vse(e){return ab=Doe(e),ob=ab.format,Hse=ab.parse,sb=ab.utcFormat,Use=ab.utcParse,ab}var ab,ob,Hse,sb,Use,Wse=o((()=>{Bse(),Vse({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`]})})),cb=o((()=>{Wse(),Bse()}));function lb(e){let t={};return n=>t[n]||(t[n]=e(n))}function Gse(e,t){return n=>{let r=e(n),i=r.indexOf(t);if(i<0)return r;let a=Kse(r,i),o=ai;)if(r[a]!==`0`){++a;break}return r.slice(0,a)+o}}function Kse(e,t){let n=e.lastIndexOf(`e`),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function qse(e){let t=lb(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){let n=x_(e||`,`);if(n.precision==null){switch(n.precision=12,n.type){case`%`:n.precision-=2;break;case`e`:--n.precision;break}return Gse(t(n),t(`.1f`)(1)[1])}else return t(n)},formatSpan(e,r,i,a){a=x_(a??`,f`);let o=Qg(e,r,i),s=Math.max(Math.abs(e),Math.abs(r)),c;if(a.precision==null)switch(a.type){case`s`:return isNaN(c=R_(o,s))||(a.precision=c),n(a,s);case``:case`e`:case`g`:case`p`:case`r`:isNaN(c=z_(o,s))||(a.precision=c-(a.type===`e`));break;case`f`:case`%`:isNaN(c=L_(o))||(a.precision=c-(a.type===`%`)*2);break}return t(a)}}}function Jse(){return pb=qse({format:F_,formatPrefix:I_})}function Yse(e){return qse(A_(e))}function ub(e){return arguments.length?pb=Yse(e):pb}function Xse(e,t,n){n||={},Wm(n)||V(`Invalid time multi-format specifier: ${n}`);let r=t(Cy),i=t(Sy),a=t(xy),o=t(yy),s=t(vy),c=t(_y),l=t(gy),u=t(hy),d=e(n.milliseconds||`.%L`),f=e(n.seconds||`:%S`),p=e(n.minutes||`%I:%M`),m=e(n.hours||`%I %p`),h=e(n.date||n.day||`%a %d`),g=e(n.week||`%b %d`),_=e(n.month||`%B`),v=e(n.quarter||`%B`),y=e(n.year||`%Y`);return e=>(r(e)Yh(e)?t(e):Xse(t,ay,e),utcFormat:e=>Yh(e)?n(e):Xse(n,oy,e),timeParse:lb(e.parse),utcParse:lb(e.utcParse)}}function Qse(){return mb=Zse({format:ob,parse:Hse,utcFormat:sb,utcParse:Use})}function $se(e){return Zse(Doe(e))}function db(e){return arguments.length?mb=$se(e):mb}function ece(e,t){let n=e?Yse(e):ub(),r=t?$se(t):db();return hb(n,r)}function fb(e,t){let n=arguments.length;return n&&n!==2&&V(`defaultLocale expects either zero or two arguments.`),n?hb(ub(e),db(t)):hb(ub(),db())}function tce(){return Jse(),Qse(),fb()}var pb,mb,hb,gb=o((()=>{g_(),B_(),Xy(),pg(),cb(),Jse(),Qse(),hb=(e,t)=>Mh({},e,t)}));function nce(e){return t=>({options:t||{},sanitize:ice,load:rce,fileAccess:!1,file:ace(e),http:sce})}async function rce(e,t){let n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t?.http)}async function ice(e,t){t=Mh({},this.options,t);let n=this.fileAccess,r={href:null},i,a,o,s=vce.test(e.replace(yce,``));(e==null||typeof e!=`string`||!s)&&V(`Sanitize failure, invalid URI: `+W(e));let c=_ce.test(e);return(o=t.baseURL)&&!c&&(!e.startsWith(`/`)&&!o.endsWith(`/`)&&(e=`/`+e),e=o+e),a=(i=e.startsWith(bce))||t.mode===`file`||t.mode!==`http`&&!c&&n,i?e=e.slice(7):e.startsWith(`//`)&&(t.defaultProtocol===`file`?(e=e.slice(2),a=!0):e=(t.defaultProtocol||`http`)+`:`+e),Object.defineProperty(r,"localFile",{value:!!a}),r.href=e,t.target&&(r.target=t.target+``),t.rel&&(r.rel=t.rel+``),t.context===`image`&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+``),r}function ace(e){return e?t=>new Promise((n,r)=>{e.readFile(t,(e,t)=>{e?r(e):n(t)})}):oce}async function oce(){V(`No file system access.`)}async function sce(e,t){let n=Mh({},this.options.http,t),r=t&&t.response,i=await fetch(e,n);return i.ok?Sh(i[r])?i[r]():i.text():V(i.status+``+i.statusText)}function cce(e,t){if(!e||!e.length)return`unknown`;let n=e.length,r=Sb.length,i=Sb.map((e,t)=>t+1);for(let a=0,o=0,s,c;ae===0?t:e,0)-1]}function lce(e,t){return t.reduce((t,n)=>(t[n]=cce(e,n),t),{})}function uce(e){let t=function(t,n){let r={delimiter:e};return _b(t,n?Mh(n,r):r)};return t.responseType=`text`,t}function _b(e,t){return t.header&&(e=t.header.map(W).join(t.delimiter)+` -`+e),yae(t.delimiter).parse(e+``)}function dce(e){return typeof Buffer==`function`&&Sh(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function vb(e,t){let n=t&&t.property?Nm(t.property):Im;return Wm(e)&&!dce(e)?fce(n(e),t):n(JSON.parse(e))}function fce(e,t){return!H(e)&&Gh(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}function pce(e,t){let n,r,i,a;return e=vb(e,t),t&&t.feature?(n=Eae,i=t.feature):t&&t.mesh?(n=Oae,i=t.mesh,a=Ece[t.filter]):V(`Missing TopoJSON feature or mesh parameter.`),r=(r=e.objects[i])?n(e,r,a):V(`Invalid TopoJSON object: `+i),r&&r.features||[r]}function yb(e,t){return arguments.length>1?(Cb[e]=t,this):Ih(Cb,e)?Cb[e]:null}function mce(e){let t=yb(e);return t&&t.responseType||`text`}function hce(e,t,n,r){t||={};let i=yb(t.type||`json`);return i||V(`Unknown data format type: `+t.type),e=i(e,t),t.parse&&gce(e,t.parse,n,r),Ih(e,`columns`)&&delete e.columns,e}function gce(e,t,n,r){if(!e.length)return;let i=db();n||=i.timeParse,r||=i.utcParse;let a=e.columns||Object.keys(e[0]),o,s,c,l,u,d;t===`auto`&&(t=lce(e,a)),a=Object.keys(t);let f=a.map(e=>{let i=t[e],a,o;if(i&&(i.startsWith(`date:`)||i.startsWith(`utc:`)))return a=i.split(/:(.+)?/,2),o=a[1],(o[0]===`'`&&o[o.length-1]===`'`||o[0]===`"`&&o[o.length-1]===`"`)&&(o=o.slice(1,-1)),(a[0]===`utc`?r:n)(o);if(!xb[i])throw Error(`Illegal format pattern: `+e+`:`+i);return xb[i]});for(c=0,u=e.length,d=a.length;c{pg(),xae(),Mae(),gb(),_ce=/^(data:|([A-Za-z]+:)?\/\/)/,vce=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,yce=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,bce=`file://`,xce=e=>e!=null&&e===e,Sce=e=>e===`true`||e===`false`||e===!0||e===!1,Cce=e=>!Number.isNaN(Date.parse(e)),bb=e=>!Number.isNaN(+e)&&!(e instanceof Date),wce=e=>bb(e)&&Number.isInteger(+e),xb={boolean:og,integer:Zm,number:Zm,date:sg,string:lg,unknown:Im},Sb=[Sce,wce,bb,Cce],Tce=[`boolean`,`integer`,`number`,`date`],_b.responseType=`text`,vb.responseType=`json`,Ece={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t},pce.responseType=`json`,Cb={dsv:_b,csv:uce(`,`),tsv:uce(` `),json:vb,topojson:pce},wb=nce(null)}));function Eb(e){let t=e||Im,n=[],r={};return n.add=e=>{let i=t(e);return r[i]||(r[i]=1,n.push(e)),n},n.remove=e=>{let i=t(e);if(r[i]){r[i]=0;let t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function Db(e,t){try{await t(e)}catch(t){e.error(t)}}function Ob(e){return!!(e&&kb(e))}function kb(e){return e[Gb]}function Dce(e,t){return e[Gb]=t,e}function Ab(e){let t=e===Object(e)?e:{data:e};return kb(t)?t:Dce(t,cle++)}function jb(e){return Mb(e,Ab({}))}function Mb(e,t){for(let n in e)t[n]=e[n];return t}function Oce(e,t){return Dce(t,kb(e))}function Nb(e,t){return e?t?(n,r)=>e(n,r)||kb(t(n))-kb(t(r)):(t,n)=>e(t,n)||kb(t)-kb(n):null}function kce(e){return e&&e.constructor===Pb}function Pb(){let e=[],t=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:Pb,insert(t){let n=yh(t),r=n.length;for(let t=0;t{m(e)&&(l[kb(e)]=-1)});for(d=0,f=e.length;d0&&(_(h,m,p.value),s.modifies(m));for(d=0,f=i.length;d{m(e)&&l[kb(e)]>0&&_(e,p.field,p.value)}),s.modifies(p.field);if(o)s.mod=t.length||r.length?c.filter(e=>l[kb(e)]>0):c.slice();else for(g in u)s.mod.push(u[g]);return(a||a==null&&(t.length||r.length))&&s.clean(!0),s}}}function Fb(){Object.defineProperty(this,Kb,{writable:!0,value:{}})}function Ib(e,t,n,r){this.id=++lle,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function Ace(e){return function(t){let n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}function jce(e,t,n,r){let i=1,a;return e instanceof Ib?a=e:e&&e.prototype instanceof Ib?a=new e:Sh(e)?a=new Ib(null,e):(i=0,a=new Ib(e,t)),this.rank(a),i&&(r=n,n=t),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a}function Mce(e,t){let n=e.rank,r=t.length;for(let i=0;it=e);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}function zce(e,t,n,r,i){return(e instanceof Ib?Vce:Bce)(this,e,t,n,r,i),this}function Bce(e,t,n,r,i,a){let o=Mh({},a,hle),s,c;Sh(n)||(n=Ah(n)),r===void 0?s=t=>e.touch(n(t)):Sh(r)?(c=new Ib(null,r,i,!1),s=t=>{c.evaluate(t);let r=n(t),i=c.value;kce(i)?e.pulse(r,i,a):e.update(r,i,o)}):s=t=>e.update(n(t),r,o),t.apply(s)}function Vce(e,t,n,r,i,a){if(r===void 0)t.targets().add(n);else{let o=a||{},s=new Ib(null,Hce(n,r),i,!1);s.modified(o.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}function Hce(e,t){return t=Sh(t)?t:Ah(t),e?function(n,r){let i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function Uce(e){e.rank=++this._rank}function Wce(e){let t=[e],n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&V(`Cycle detected in dataflow graph.`)}function zb(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Bb(e,t){let n=[];return fg(e,t,e=>n.push(e)),n}function Gce(e,t){let n={};return e.visit(t,e=>{n[kb(e)]=1}),e=>n[kb(e)]?null:e}function Vb(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}function Hb(e,t,n,r){let i=this,a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(let e of n)if(e.stamp===t){if(e.fields){let t=i.fields||={};for(let n in e.fields)t[n]=1}e.changed(i.ADD)&&(a|=i.ADD),e.changed(i.REM)&&(a|=i.REM),e.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}async function Kce(e,t,n){let r=this,i=[];if(r._pulse)return Xce(r);if(r._pending&&await r._pending,t&&await Db(r,t),!r._touched.length)return r.debug(`Dataflow invoked, but nothing to do.`),r;let a=++r._clock;r._pulse=new zb(r,a,e),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=Eb(Fm);let o=0,s,c,l;try{for(;r._heap.size()>0;){if(s=r._heap.pop(),s.rank!==s.qrank){r._enqueue(s,!0);continue}c=s.run(r._getPulse(s,e)),c.then?c=await c:c.async&&(i.push(c.async),c=qb),c!==qb&&s._targets&&s._targets.forEach(e=>r._enqueue(e)),++o}}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${o} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){let e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r}async function qce(e,t,n){for(;this._running;)await this._running;let r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function Jce(e,t,n){return this._pulse?Xce(this):(this.evaluate(e,t,n),this)}function Yce(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}}function Xce(e){return e.error(`Dataflow already running. Use runAsync() to chain invocations.`),e}function Zce(e,t){let n=e.stampe.pulse),t):this._input[e.id]||$ce(this._pulse,n&&n.pulse)}function $ce(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==qb&&(e.source=t.source),e)}function ele(e,t){let n=t||rx;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function tle(e,t,n){let r=n||rx;return(e.set(t)||r.force)&&this.touch(e,r),this}function nle(e,t,n){this.touch(e,n||rx);let r=new zb(this,this._clock+ +!this._pulse),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function rle(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),ile(t,0,t.length-1,e)),pop:()=>{let n=t.pop(),r;return t.length?(r=t[0],t[0]=n,ale(t,0,e)):r=n,r}}}function ile(e,t,n,r){let i,a,o=e[n];for(;n>t;){if(a=n-1>>1,i=e[a],r(o,i)<0){e[n]=i,n=a;continue}break}return e[n]=o}function ale(e,t,n){let r=t,i=e.length,a=e[t],o=(t<<1)+1,s;for(;o=0&&(o=s),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=a,ile(e,r,t,n)}function Ub(){this.logger(Hm()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=fb();try{this._loader=wb()}catch{}this._touched=Eb(Fm),this._input={},this._pulse=null,this._heap=rle((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Wb(e){return function(){return this._log[e].apply(this,arguments)}}function G(e,t){Ib.call(this,e,null,t)}function ole(e){let t=sle(e);return t&&t.Definition||null}function sle(e){return e&&=e.toLowerCase(),Ih(ix,e)?ix[e]:null}var Gb,cle,Kb,lle,ule,dle,fle,ple,mle,hle,qb,Jb,Yb,Xb,gle,Zb,Qb,$b,ex,tx,nx,rx,ix,ax=o((()=>{pg(),Tb(),gb(),Gb=Symbol(`vega_id`),cle=1,Kb=`_:mod:_`,Fb.prototype={set(e,t,n,r){let i=this,a=i[e],o=i[Kb];return t!=null&&t>=0?(a[t]!==n||r)&&(a[t]=n,o[t+`:`+e]=-1,o[e]=-1):(a!==n||r)&&(i[e]=n,o[e]=H(n)?1+n.length:-1),i},modified(e,t){let n=this[Kb];if(!arguments.length){for(let e in n)if(n[e])return!0;return!1}else if(H(e)){for(let t=0;t=0?t+1{o instanceof Ib?(o!==this&&(t&&o.targets().add(this),a.push(o)),i.push({op:o,name:e,index:n})):r.set(e,n,o)};for(o in e)if(s=e[o],o===ule)yh(s).forEach(e=>{e instanceof Ib?e!==this&&(e.targets().add(this),a.push(e)):V(`Pulse parameters must be operator instances.`)}),this.source=s;else if(H(s))for(r.set(o,-1,Array(c=s.length)),l=0;l{let n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){let t=Rb();return this.targets().add(Rb(null,null,jh(e,e=>{let n=e.dataflow;t.receive(e),n&&n.run&&n.run()}))),t},between(e,t){let n=!1;return e.targets().add(Rb(null,null,()=>n=!0)),t.targets().add(Rb(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=zm,this._targets=null}},hle={skip:!0},qb={},Jb=1,Yb=2,Xb=4,gle=3,Zb=5,Qb=7,$b=8,ex=16,tx=32,nx=64,zb.prototype={StopPropagation:qb,ADD:Jb,REM:Yb,MOD:Xb,ADD_REM:gle,ADD_MOD:Zb,ALL:Qb,REFLOW:$b,SOURCE:ex,NO_SOURCE:tx,NO_FIELDS:nx,fork(e){return new zb(this.dataflow).init(this,e)},clone(){let e=this.fork(Qb);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&=e.source.slice(),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length?e:(e=new zb(this.dataflow).init(this),e.add=e.source,e.rem=[],e)},init(e,t){let n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&nx)&&(n.fields=e.fields),t&Jb?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Yb?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Xb?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&tx?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){let t=e||Qb;return t&Jb&&this.add.length||t&Yb&&this.rem.length||t&Xb&&this.mod.length},reflow(e){if(e)return this.fork(Qb).reflow();let t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Xb,Gce(this,Jb))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){let t=this.fields||={};return H(e)?e.forEach(e=>t[e]=!0):t[e]=!0,this},modified(e,t){let n=this.fields;return(t||this.mod.length)&&n?arguments.length?H(e)?e.some(e=>n[e]):n[e]:!!n:!1},filter(e,t){let n=this;return e&Jb&&(n.addF=Vb(n.addF,t)),e&Yb&&(n.remF=Vb(n.remF,t)),e&Xb&&(n.modF=Vb(n.modF,t)),e&ex&&(n.srcF=Vb(n.srcF,t)),n},materialize(e){e||=Qb;let t=this;return e&Jb&&t.addF&&(t.add=Bb(t.add,t.addF),t.addF=null),e&Yb&&t.remF&&(t.rem=Bb(t.rem,t.remF),t.remF=null),e&Xb&&t.modF&&(t.mod=Bb(t.mod,t.modF),t.modF=null),e&ex&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){let n=this,r=t;if(e&ex)return fg(n.source,n.srcF,r),n;e&Jb&&fg(n.add,n.addF,r),e&Yb&&fg(n.rem,n.remF,r),e&Xb&&fg(n.mod,n.modF,r);let i=n.source;if(e&$b&&i){let e=n.add.length+n.mod.length;e===i.length||(e?fg(i,Gce(n,Zb),r):fg(i,n.srcF,r))}return n}},U(Hb,zb,{fork(e){let t=new zb(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,e=>t.add.push(e)),e&t.REM&&this.visit(t.REM,e=>t.rem.push(e)),e&t.MOD&&this.visit(t.MOD,e=>t.mod.push(e))),t},changed(e){return this.changes&e},modified(e){let t=this,n=t.fields;return n&&t.changes&t.MOD?H(e)?e.some(e=>n[e]):n[e]:0},filter(){V(`MultiPulse does not support filtering.`)},materialize(){V(`MultiPulse does not support materialization.`)},visit(e,t){let n=this,r=n.pulses,i=r.length,a=0;if(e&n.SOURCE)for(;athis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){let t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}}),ix={}}));function*_le(e,t){if(t==null)for(let t of e)t!=null&&t!==``&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==``&&(r=+r)>=r&&(yield r)}}function ox(e,t,n){let r=Float64Array.from(_le(e,n));return r.sort(Og),t.map(e=>u_(r,e))}function sx(e,t){return ox(e,[.25,.5,.75],t)}function cx(e,t){let n=e.length,r=Rae(e,t),i=sx(e,t),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*n**-.2}function vle(e){let t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2],a=e.extent[0],o=e.extent[1],s,c,l,u,d,f,p=e.span||o-a||Math.abs(a)||1;if(e.step)s=e.step;else if(e.steps){for(u=p/t,d=0,f=e.steps.length;dt;)s*=n;for(d=0,f=i.length;d=l&&p/u<=t&&(s=u)}u=Math.log(s);let m=n**(-(u>=0?0:~~(-u/r)+1)-1);return(e.nice||e.nice===void 0)&&(u=Math.floor(a/s+m)*s,a=ae);let i=e.length,a=new Float64Array(i),o=0,s=1,c=r(e[0]),l=c,u=c+t,d;for(;s=u){for(l=(c+l)/2;o>1);oi;)e[o--]=e[r]}r=i,i=a}return e}function Cle(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function wle(e,t){t??(t=e,e=0);let n,r,i,a={min(e){return arguments.length?(n=e||0,i=r-n,a):n},max(e){return arguments.length?(r=e||0,i=r-n,a):r},sample(){return n+Math.floor(i*jx())},pdf(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},icdf(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN}};return a.min(e).max(t)}function lx(e,t){e||=0,t??=1;let n=0,r=0,i,a;if(Nx===Nx)n=Nx,Nx=NaN;else{do n=jx()*2-1,r=jx()*2-1,i=n*n+r*r;while(i===0||i>1);a=Math.sqrt(-2*Math.log(i)/i),n*=a,Nx=r*a}return e+n*t}function ux(e,t,n){n??=1;let r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*Mx)}function dx(e,t,n){t||=0,n??=1;let r=(e-t)/n,i=Math.abs(r),a;if(i>37)a=0;else{let e=Math.exp(-i*i/2),t;i<7.07106781186547?(t=.0352624965998911*i+.700383064443688,t=t*i+6.37396220353165,t=t*i+33.912866078383,t=t*i+112.079291497871,t=t*i+221.213596169931,t=t*i+220.206867912376,a=e*t,t=.0883883476483184*i+1.75566716318264,t=t*i+16.064177579207,t=t*i+86.7807322029461,t=t*i+296.564248779674,t=t*i+637.333633378831,t=t*i+793.826512519948,t=t*i+440.413735824752,a/=t):(t=i+.65,t=i+4/t,t=i+3/t,t=i+2/t,t=i+1/t,a=e/t/2.506628274631)}return r>0?1-a:a}function fx(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*Vle*Tle(2*e-1)}function Tle(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=1.0512122733215323e-9+n*t,n=-4.112633980346984e-9+n*t,n=-2.9070369957882005e-8+n*t,n=4.2347877827932404e-7+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*t,n=-2.7517406297064545e-7+n*t,n=1.8239629214389228e-8+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=1.5076572693500548e-9+n*t,n=-3.789465440126737e-9+n*t,n=7.61570120807834e-9+n*t,n=-1.496002662714924e-8+n*t,n=2.914795345090108e-8+n*t,n=-6.771199775845234e-8+n*t,n=2.2900482228026655e-7+n*t,n=-9.9298272942317e-7+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function px(e,t){let n,r,i={mean(e){return arguments.length?(n=e||0,i):n},stdev(e){return arguments.length?(r=e??1,i):r},sample:()=>lx(n,r),pdf:e=>ux(e,n,r),cdf:e=>dx(e,n,r),icdf:e=>fx(e,n,r)};return i.mean(e).stdev(t)}function mx(e,t){let n=px(),r=0,i={data(n){return arguments.length?(e=n,r=n?n.length:0,i.bandwidth(t)):e},bandwidth(n){return arguments.length?(t=n,!t&&e&&(t=cx(e)),i):t},sample(){return e[~~(jx()*r)]+t*n.sample()},pdf(i){let a=0,o=0;for(;ohx(n,r),pdf:e=>gx(e,n,r),cdf:e=>_x(e,n,r),icdf:e=>vx(e,n,r)};return i.mean(e).stdev(t)}function Dle(e,t){let n=0,r;function i(e){let t=[],r=0,i;for(i=0;i=t&&e<=n?1/(n-t):0}function xx(e,t,n){return n??(n=t??1,t=0),en?1:(e-t)/(n-t)}function Sx(e,t,n){return n??(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Ole(e,t){let n,r,i={min(e){return arguments.length?(n=e||0,i):n},max(e){return arguments.length?(r=e??1,i):r},sample:()=>yx(n,r),pdf:e=>bx(e,n,r),cdf:e=>xx(e,n,r),icdf:e=>Sx(e,n,r)};return t??(t=e??1,e=0),i.min(e).max(t)}function Cx(e,t,n){let r=0,i=0;for(let a of e){let e=n(a);t(a)==null||e==null||isNaN(e)||(r+=(e-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function wx(e,t,n,r){let i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function Tx(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return r!=null&&(r=+r)>=r&&i!=null&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));let i=e.length,a=new Float64Array(i),o=new Float64Array(i),s=0,c=0,l=0,u,d,f;for(f of e)a[s]=u=+t(f),o[s]=d=+n(f),++s,c+=(u-c)/s,l+=(d-l)/s;for(s=0;s=a&&o!=null&&(o=+o)>=o&&r(a,o,++i)}function Dx(e,t,n,r,i){let a=0,o=0;return Ex(e,t,n,(e,t)=>{let n=t-i(e),s=t-r;a+=n*n,o+=s*s}),1-a/o}function Ox(e,t,n){let r=0,i=0,a=0,o=0,s=0;Ex(e,t,n,(e,t)=>{++s,r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=wx(r,i,a,o),l=e=>c[0]+c[1]*e;return{coef:c,predict:l,rSquared:Dx(e,t,n,i,l)}}function kle(e,t,n){let r=0,i=0,a=0,o=0,s=0;Ex(e,t,n,(e,t)=>{++s,e=Math.log(e),r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=wx(r,i,a,o),l=e=>c[0]+c[1]*Math.log(e);return{coef:c,predict:l,rSquared:Dx(e,t,n,i,l)}}function Ale(e,t,n){let[r,i,a,o]=Tx(e,t,n),s=0,c=0,l=0,u=0,d=0,f,p,m;Ex(e,t,n,(e,t)=>{f=r[d++],p=Math.log(t),m=f*t,s+=(t*p-s)/d,c+=(m-c)/d,l+=(m*p-l)/d,u+=(f*m-u)/d});let[h,g]=wx(c/o,s/o,l/o,u/o),_=e=>Math.exp(h+g*(e-a));return{coef:[Math.exp(h-g*a),g],predict:_,rSquared:Dx(e,t,n,o,_)}}function jle(e,t,n){let r=0,i=0,a=0,o=0,s=0,c=0;Ex(e,t,n,(e,t)=>{let n=Math.log(e),l=Math.log(t);++c,r+=(n-r)/c,i+=(l-i)/c,a+=(n*l-a)/c,o+=(n*n-o)/c,s+=(t-s)/c});let l=wx(r,i,a,o),u=e=>l[0]*e**+l[1];return l[0]=Math.exp(l[0]),{coef:l,predict:u,rSquared:Dx(e,t,n,s,u)}}function kx(e,t,n){let[r,i,a,o]=Tx(e,t,n),s=r.length,c=0,l=0,u=0,d=0,f=0,p,m,h,g;for(p=0;p(e-=a,y*e*e+b*e+x+o);return{coef:[x-b*a+y*a*a+o,b-2*y*a,y],predict:S,rSquared:Dx(e,t,n,o,S)}}function Mle(e,t,n,r){if(r===0)return Cx(e,t,n);if(r===1)return Ox(e,t,n);if(r===2)return kx(e,t,n);let[i,a,o,s]=Tx(e,t,n),c=i.length,l=[],u=[],d=r+1,f,p,m,h,g;for(f=0;f{e-=o;let t=s+_[0]+_[1]*e+_[2]*e*e;for(f=3;f=0;--a)for(s=t[a],c=1,i[a]+=s,o=1;o<=a;++o)c*=(a+1-o)/o,i[a-o]+=s*n**+o*c;return i[0]+=r,i}function Ple(e){let t=e.length-1,n=[],r,i,a,o,s;for(r=0;rMath.abs(e[r][o])&&(o=i);for(a=r;a=r;a--)e[a][i]-=e[a][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(s=0,a=i+1;ai[o]-n?r:o,c=0,l=0,p=0,m=0,h=0,g=1/Math.abs(i[s]-n||1);for(let e=r;e<=o;++e){let t=i[e],r=a[e],o=Ile(Math.abs(n-t)*g)*f[e],s=t*o;c+=o,l+=s,p+=r*o,m+=r*s,h+=t*s}let[_,v]=wx(l/c,p/c,m/c,h/c);u[e]=_+v*n,d[e]=Math.abs(a[e]-u[e]),Lle(i,e+1,t)}if(e===Px)break;let n=f_(d);if(Math.abs(n)=1?Fx:(r=1-t*t)*r}return Rle(i,u,o,s)}function Ile(e){return(e=1-e*e*e)*e*e}function Lle(e,t,n){let r=e[t],i=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}function Rle(e,t,n,r){let i=e.length,a=[],o=0,s=0,c=[],l;for(;o[t,e(t)],a=t[0],o=t[1],s=o-a,c=s/r,l=[i(a)],u=[];if(n===r){for(let e=1;e0;)u.push(i(a+e/n*s))}let d=l[0],f=u[u.length-1],p=1/s,m=zle(d[1],u);for(;f;){let e=i((d[0]+f[0])/2);e[0]-d[0]>=c&&Ble(d,e,f,p,m)>Hle?u.push(e):(d=f,l.push(f),u.pop()),f=u[u.length-1]}return l}function zle(e,t){let n=e,r=e,i=t.length;for(let e=0;er&&(r=i)}return 1/(r-n)}function Ble(e,t,n,r,i){let a=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),o=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(a-o)}var jx,Mx,Vle,Nx,Px,Fx,Hle,Ix=o((()=>{g_(),jx=Math.random,Mx=Math.sqrt(2*Math.PI),Vle=Math.SQRT2,Nx=NaN,Px=2,Fx=1e-12,Hle=.5*Math.PI/180})),Ule=c({aggregate:()=>zx,bin:()=>Bx,collect:()=>Vx,compare:()=>Hx,countpattern:()=>Ux,cross:()=>Wx,density:()=>Kx,dotbin:()=>Jx,expression:()=>Yx,extent:()=>Xx,facet:()=>Qx,field:()=>$x,filter:()=>eS,flatten:()=>tS,fold:()=>nS,formula:()=>rS,generate:()=>iS,impute:()=>aS,joinaggregate:()=>oS,kde:()=>sS,key:()=>cS,load:()=>lS,lookup:()=>dS,multiextent:()=>mue,multivalues:()=>gue,params:()=>vue,pivot:()=>fS,prefacet:()=>Sue,project:()=>pS,proxy:()=>mS,quantile:()=>hS,relay:()=>gS,sample:()=>_S,sequence:()=>vS,sieve:()=>yS,subflow:()=>Zx,timeunit:()=>bS,tupleindex:()=>xS,values:()=>SS,window:()=>wS});function Wle(e){return t=>{let n=e.length,r=1,i=String(e[0](t));for(;rMh({name:e,aggregate_param:r,out:n||e},DS,t)}function qle(e,t,n){return OS[e](n,t)}function Jle(e,t){return e.idx-t.idx}function Yle(e){let t={};e.forEach(e=>t[e.name]=e);let n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=OS[e]())})};return e.forEach(n),Object.values(t).sort(Jle)}function Xle(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function Zle(e,t){if(e==null||e===``){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function Qle(e,t){if(e==null||e===``){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function $le(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function eue(e,t){let n=t||Im,r=Yle(e),i=e.slice().sort(Jle);function a(e){this._ops=r,this._out=i,this.cell=e,this.init()}return a.prototype.init=Xle,a.prototype.add=Zle,a.prototype.rem=Qle,a.prototype.set=$le,a.prototype.get=n,a.fields=e.map(e=>e.out),a}function Rx(e){this._key=e?Nm(e):kb,this.reset()}function zx(e){G.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function Bx(e){G.call(this,null,e)}function tue(e,t,n){let r=e,i=t||[],a=n||[],o={},s=0;return{add:e=>a.push(e),remove:e=>o[r(e)]=++s,size:()=>i.length,data:(e,t)=>(s&&=(i=i.filter(e=>!o[r(e)]),o={},0),t&&e&&i.sort(e),a.length&&(i=e?tg(e,i,a.sort(e)):i.concat(a),a=[]),i)}}function Vx(e){G.call(this,[],e)}function Hx(e){Ib.call(this,null,nue,e)}function nue(e){return this.value&&!e.modified()?this.value:wh(e.fields,e.orders)}function Ux(e){G.call(this,null,e)}function rue(e,t,n){switch(t){case`upper`:e=e.toUpperCase();break;case`lower`:e=e.toLowerCase();break}return e.match(n)}function Wx(e){G.call(this,null,e)}function iue(e,t,n,r){for(var i=[],a={},o=e.length,s=0,c,l;sGx(e,t))):typeof r[n]===PS&&r[n](e[n]);return r}function Kx(e){G.call(this,null,e)}function aue(e){return()=>e.materialize(e.SOURCE).source}function oue(e,t){return e?e.map((e,n)=>t[n]||Cm(e)):null}function qx(e,t,n){let r=[],i=e=>e(c),a,o,s,c,l,u;if(t==null)r.push(e.map(n));else for(a={},o=0,s=e.length;ot(n,e),wm(t),Cm(t))}function Xx(e){G.call(this,[void 0,void 0],e)}function Zx(e,t){Ib.call(this,e),this.parent=t,this.count=0}function Qx(e){G.call(this,{},e),this._keys=Rh();let t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,r=t.active;nNm(e)):Nm(e.name,e.as)}function eS(e){G.call(this,Rh(),e)}function tS(e){G.call(this,[],e)}function nS(e){G.call(this,[],e)}function rS(e){G.call(this,null,e)}function iS(e){G.call(this,[],e)}function aS(e){G.call(this,[],e)}function lue(e){var t=e.method||BS.value,n;if(BS[t]==null)V(`Unrecognized imputation method: `+t);else if(t===BS.value)return n=e.value===void 0?0:e.value,()=>n;else return BS[t]}function uue(e){let t=e.field;return e=>e?t(e):NaN}function due(e,t,n,r){var i=e=>e(g),a=[],o=r?r.slice():[],s={},c={},l,u,d,f,p,m,h,g;for(o.forEach((e,t)=>s[e]=t+1),f=0,h=e.length;fi&&(i=o[1]);return[r,i]}function gue(e){Ib.call(this,null,_ue,e)}function _ue(e){return this.value&&!e.modified()?this.value:e.values.reduce((e,t)=>e.concat(t),[])}function vue(e){G.call(this,null,e)}function fS(e){zx.call(this,e)}function yue(e,t){let n=e.field,r=e.value,i=(e.op===`count`?`__count__`:e.op)||`sum`,a=wm(n).concat(wm(r)),o=xue(n,e.limit||0,t);return t.changed()&&e.set(`__pivot__`,null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>i),fields:o.map(e=>bue(e,n,r,a)),as:o.map(e=>e+``),modified:e.modified.bind(e)}}function bue(e,t,n,r){return Sm(r=>t(r)===e?n(r):NaN,r,e+``)}function xue(e,t,n){let r={},i=[];return n.visit(n.SOURCE,t=>{let n=e(t);r[n]||(r[n]=1,i.push(n))}),i.sort(Eh),t?i.slice(0,t):i}function Sue(e){Qx.call(this,e)}function pS(e){G.call(this,null,e)}function Cue(e,t,n,r){for(let i=0,a=n.length;ic[e]=1)}p(e.sort),t.forEach((e,t)=>{let c=n[t],m=r[t],h=i[t]||null,g=Cm(c),_=Gle(e,g,a[t]);if(p(c),o.push(_),Ih(WS,e))s.push(wue(e,c,m,_));else{if(c==null&&e!==`count`&&V(`Null aggregate field specified.`),e===`count`){u.push(_);return}f=!1;let t=l[g];t||(t=l[g]=[],t.field=c,d.push(t)),t.push(qle(e,h,_))}}),(u.length||d.length)&&(this.cell=Eue(d,u,f)),this.inputs=Object.keys(c)}function Eue(e,t,n){e=e.map(e=>eue(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,a=r.agg=Array(i),o=0;on?n:e}function Oue(e,t,n,r){e.p0=e.i0,e.p1=e.i1;let i=t[0]==null?0:n+t[0],a=t[1]==null?r:n+t[1]+1;e.i0=TS(i,0,r),e.i1=TS(a,0,r),e.index=n}function kue(e,t){let n=e.i0,r=e.i1-1,i=e.compare,a=e.data,o=a.length-1;n>0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),r{pg(),ax(),Ix(),g_(),Xy(),ES=()=>{},DS={init:ES,add:ES,rem:ES,idx:0},OS={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:[`mean`],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?Math.max(0,e.dev)/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:[`mean`],idx:1},variancep:{value:e=>e.valid?Math.max(0,e.dev)/e.valid:void 0,req:[`variance`],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid-1)):void 0,req:[`variance`],idx:2},stdevp:{value:e=>e.valid?Math.sqrt(Math.max(0,e.dev)/e.valid):void 0,req:[`variance`],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid*(e.valid-1))):void 0,req:[`variance`],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:[`values`],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:[`values`],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:[`values`],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:[`values`],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:[`values`],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:[`values`],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:[`values`],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:[`values`],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:[`min`,`values`],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:[`max`,`values`],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:[`exponential`],idx:1}},kS=Object.keys(OS).filter(e=>e!==`__count__`),[...kS,`__count__`].forEach(e=>{OS[e]=Kle(e,OS[e])}),AS=Rx.prototype,AS.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},AS.add=function(e){this._add.push(e)},AS.rem=function(e){this._rem.push(e)},AS.values=function(){if(this._get=null,this._rem.length===0)return this._add;let e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,a=Array(r-i),o={},s,c,l;for(s=0;s=0;)a=e(t[r])+``,Ih(n,a)||(n[a]=1,++i);return i},AS.extent=function(e){if(this._get!==e||!this._ext){let t=this.values(),n=Fh(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},AS.argmin=function(e){return this.extent(e)[0]||{}},AS.argmax=function(e){return this.extent(e)[1]||{}},AS.min=function(e){let t=this.extent(e)[0];return t==null?void 0:e(t)},AS.max=function(e){let t=this.extent(e)[1];return t==null?void 0:e(t)},AS.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=sx(this.values(),e),this._get=e),this._q},AS.q1=function(e){return this.quartile(e)[0]},AS.q2=function(e){return this.quartile(e)[1]},AS.q3=function(e){return this.quartile(e)[2]},AS.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=ble(this.values(),1e3,.05,e),this._get=e),this._ci},AS.ci0=function(e){return this.ci(e)[0]},AS.ci1=function(e){return this.ci(e)[1]},zx.Definition={type:`Aggregate`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`ops`,type:`enum`,array:!0,values:kS},{name:`aggregate_params`,type:`number`,null:!0,array:!0},{name:`fields`,type:`field`,null:!0,array:!0},{name:`as`,type:`string`,null:!0,array:!0},{name:`drop`,type:`boolean`,default:!0},{name:`cross`,type:`boolean`,default:!1},{name:`key`,type:`field`}]},U(zx,G,{transform(e,t){let n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){let e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function a(e){let t,a,o,s;for(t in e)for(o=e[t].tuple,a=0;a{let t=Cm(e);return i(e),n.push(t),t}),this.cellkey=e.key?e.key:Lx(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];let a=e.fields||[null],o=e.ops||[`count`],s=e.aggregate_params||[null],c=e.as||[],l=a.length,u={},d,f,p,m,h,g,_;for(l!==o.length&&V(`Unmatched number of fields and aggregate ops.`),_=0;_eue(e,e.field)),Object.create(null)},cellkey:Lx(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{let t=r(e);e[s]=t,e[c]=t==null?null:i+a*(1+(t-i)/a)}:e=>e[s]=r(e)),t.modifies(n?o:s)},_bins(e){if(this.value&&!e.modified())return this.value;let t=e.field,n=vle(e),r=n.step,i=n.start,a=i+Math.ceil((n.stop-i)/r)*r,o,s;(o=e.anchor)!=null&&(s=o-(i+r*Math.floor((o-i)/r)),i+=s,a+=s);let c=function(e){let n=Zm(t(e));return n==null?null:na?1/0:(n=Math.max(i,Math.min(n,a-r)),i+r*Math.floor(jS+(n-i)/r))};return c.start=i,c.stop=a,c.step=r,this.value=Sm(c,wm(t),e.name||`bin_`+Cm(t))}}),Vx.Definition={type:`Collect`,metadata:{source:!0},params:[{name:`sort`,type:`compare`}]},U(Vx,G,{transform(e,t){let n=t.fork(t.ALL),r=tue(kb,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified(`sort`)||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(Nb(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),U(Hx,Ib),Ux.Definition={type:`CountPattern`,metadata:{generates:!0,changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`case`,type:`enum`,values:[`upper`,`lower`,`mixed`],default:`mixed`},{name:`pattern`,type:`string`,default:`[\\w"]+`},{name:`stopwords`,type:`string`,default:``},{name:`as`,type:`string`,array:!0,length:2,default:[`text`,`count`]}]},U(Ux,G,{transform(e,t){let n=t=>n=>{for(var r=rue(s(n),e.case,a)||[],i,c=0,l=r.length;ci[e]=1+(i[e]||0)),u=n(e=>--i[e]);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,u)),this._finish(t,c)},_parameterCheck(e,t){let n=!1;return(e.modified(`stopwords`)||!this._stop)&&(this._stop=RegExp(`^`+(e.stopwords||``)+`$`,`i`),n=!0),(e.modified(`pattern`)||!this._match)&&(this._match=new RegExp(e.pattern||`[\\w']+`,`g`),n=!0),(e.modified(`field`)||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){let n=this._counts,r=this._tuples||={},i=t[0],a=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS),s,c,l;for(s in n)c=r[s],l=n[s]||0,!c&&l?(r[s]=c=Ab({}),c[i]=s,c[a]=l,o.add.push(c)):l===0?(c&&o.rem.push(c),n[s]=null,r[s]=null):c[a]!==l&&(c[a]=l,o.mod.push(c));return o.modifies(t)}}),Wx.Definition={type:`Cross`,metadata:{generates:!0},params:[{name:`filter`,type:`expr`},{name:`as`,type:`string`,array:!0,length:2,default:[`a`,`b`]}]},U(Wx,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.as||[`a`,`b`],i=r[0],a=r[1],o=!this.value||t.changed(t.ADD_REM)||e.modified(`as`)||e.modified(`filter`),s=this.value;return o?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=iue(s,i,a,e.filter||zm)):n.mod=s,n.source=this.value,n.modifies(r)}}),MS={kde:mx,mixture:Dle,normal:px,lognormal:Ele,uniform:Ole},NS=`distributions`,PS=`function`,FS=`field`,IS=[{key:{function:`normal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`lognormal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`uniform`},params:[{name:`min`,type:`number`,default:0},{name:`max`,type:`number`,default:1}]},{key:{function:`kde`},params:[{name:`field`,type:`field`,required:!0},{name:`from`,type:`data`},{name:`bandwidth`,type:`number`,default:0}]}],LS={key:{function:`mixture`},params:[{name:`distributions`,type:`param`,array:!0,params:IS},{name:`weights`,type:`number`,array:!0}]},Kx.Definition={type:`Density`,metadata:{generates:!0},params:[{name:`extent`,type:`number`,array:!0,length:2},{name:`steps`,type:`number`},{name:`minsteps`,type:`number`,default:25},{name:`maxsteps`,type:`number`,default:200},{name:`method`,type:`string`,default:`pdf`,values:[`pdf`,`cdf`]},{name:`distribution`,type:`param`,params:IS.concat(LS)},{name:`as`,type:`string`,array:!0,default:[`value`,`density`]}]},U(Kx,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=Gx(e.distribution,aue(t)),i=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200,o=e.method||`pdf`;o!==`pdf`&&o!==`cdf`&&V(`Invalid density method: `+o),!e.extent&&!r.data&&V(`Missing density extent parameter.`),o=r[o];let s=e.as||[`value`,`density`],c=e.extent||Ph(r.data()),l=Ax(o,c,i,a).map(e=>{let t={};return t[s[0]]=e[0],t[s[1]]=e[1],Ab(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),RS=`bin`,Jx.Definition={type:`DotBin`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`step`,type:`number`},{name:`smooth`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:RS}]},zS=(e,t)=>ag(Ph(e,t))/30,U(Jx,G,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;let n=t.materialize(t.SOURCE).source,r=qx(t.source,e.groupby,Im),i=e.smooth||!1,a=e.field,o=e.step||zS(n,a),s=Nb((e,t)=>a(e)-a(t)),c=e.as||RS,l=r.length,u=1/0,d=-1/0,f=0,p;for(;fd&&(d=t),e[++p][c]=t}return this.value={start:u,stop:d,step:o},t.reflow(!0).modifies(c)}}),U(Yx,Ib),Xx.Definition={type:`Extent`,metadata:{},params:[{name:`field`,type:`field`,required:!0}]},U(Xx,G,{transform(e,t){let n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified(`field`),a=n[0],o=n[1];if((i||a==null)&&(a=1/0,o=-1/0),t.visit(i?t.SOURCE:t.ADD,e=>{let t=Zm(r(e));t!=null&&(to&&(o=t))}),!Number.isFinite(a)||!Number.isFinite(o)){let e=Cm(r);e&&=` for field "${e}"`,t.dataflow.warn(`Infinite extent${e}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),U(Zx,Ib,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){--this.count,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),U(Qx,G,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,r){let i=this.value,a=Ih(i,e)&&i[e],o,s;return a?a.value.stampe&&e.count>0);this.initTargets(e)}},initTargets(e){let t=this._targets,n=t.length,r=e?e.length:0,i=0;for(;ithis.subflow(e,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{let t=kb(e),n=a.get(t);n!==void 0&&(a.delete(t),s(n).rem(e))}),t.visit(t.ADD,e=>{let t=r(e);a.set(kb(e),t),s(t).add(e)}),o||t.modified(r.fields)?t.visit(t.MOD,e=>{let t=kb(e),n=a.get(t),i=r(e);n===i?s(i).mod(e):(a.set(t,i),s(n).rem(e),s(i).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{s(a.get(kb(e))).mod(e)}),o&&t.visit(t.REFLOW,e=>{let t=kb(e),n=a.get(t),i=r(e);n!==i&&(a.set(t,i),s(n).rem(e),s(i).add(e))}),t.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}}),U($x,Ib),eS.Definition={type:`Filter`,metadata:{changes:!0},params:[{name:`expr`,type:`expr`,required:!0}]},U(eS,G,{transform(e,t){let n=t.dataflow,r=this.value,i=t.fork(),a=i.add,o=i.rem,s=i.mod,c=e.expr,l=!0;t.visit(t.REM,e=>{let t=kb(e);r.has(t)?r.delete(t):o.push(e)}),t.visit(t.ADD,t=>{c(t,e)?a.push(t):r.set(kb(t),1)});function u(t){let n=kb(t),i=c(t,e),u=r.get(n);i&&u?(r.delete(n),a.push(t)):!i&&!u?(r.set(n,1),o.push(t)):l&&i&&!u&&s.push(t)}return t.visit(t.MOD,u),e.modified()&&(l=!1,t.visit(t.REFLOW,u)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),tS.Definition={type:`Flatten`,metadata:{generates:!0},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`index`,type:`string`},{name:`as`,type:`string`,array:!0}]},U(tS,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=oue(r,e.as||[]),a=e.index||null,o=i.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{let t=r.map(t=>t(e)),s=t.reduce((e,t)=>Math.max(e,t.length),0),c=0,l,u;for(;c{for(let t=0,a;tt[r]=n(t,e))}}),U(iS,G,{transform(e,t){let n=t.fork(t.ALL),r=e.generator,i=this.value,a=e.size-i.length,o,s,c;if(a>0){for(o=[];--a>=0;)o.push(c=Ab(r(e))),i.push(c);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else s=i.slice(0,-a),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(s):s,i=i.slice(-a);return n.source=this.value=i,n}}),BS={value:`value`,median:f_,mean:Gae,min:i_,max:n_},VS=[],aS.Definition={type:`Impute`,metadata:{changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`key`,type:`field`,required:!0},{name:`keyvals`,array:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`enum`,default:`value`,values:[`value`,`mean`,`median`,`max`,`min`]},{name:`value`,default:0}]},U(aS,G,{transform(e,t){var n=t.fork(t.ALL),r=lue(e),i=uue(e),a=Cm(e.field),o=Cm(e.key),s=(e.groupby||[]).map(Cm),c=due(t.source,e.groupby,e.key,e.keyvals),l=[],u=this.value,d=c.domain.length,f,p,m,h,g,_,v,y,b,x;for(g=0,y=c.length;gn.add(e))):(i=n.value=n.value||this.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),n.changes(),t.visit(t.SOURCE,e=>{Mh(e,i[n.cellkey(e)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){let e=this._adds,t=this._mods,n,r;for(n=0,r=this._alen;n{let n=mx(t,o)[s],r=e.counts?t.length:1;Ax(n,u||Ph(t),d,f).forEach(e=>{let n={};for(let e=0;e(this._pending=yh(e.data),e=>e.touch(this)))}:n.request(e.url,e.format).then(e=>uS(this,t,yh(e.data)))}}),dS.Definition={type:`Lookup`,metadata:{modifies:!0},params:[{name:`index`,type:`index`,params:[{name:`from`,type:`data`,required:!0},{name:`key`,type:`field`,required:!0}]},{name:`values`,type:`field`,array:!0},{name:`fields`,type:`field`,array:!0,required:!0},{name:`as`,type:`string`,array:!0},{name:`default`,default:null}]},U(dS,G,{transform(e,t){let n=e.fields,r=e.index,i=e.values,a=e.default==null?null:e.default,o=e.modified(),s=n.length,c=o?t.SOURCE:t.ADD,l=t,u=e.as,d,f,p;return i?(f=i.length,s>1&&!u&&V(`Multi-field lookup requires explicit "as" parameter.`),u&&u.length!==s*f&&V(`The "as" parameter has too few output field names.`),u||=i.map(Cm),d=function(e){for(var t=0,o=0,c,l;tt.modified(e.fields)),c|=p?t.MOD:0),t.visit(c,d),l.modifies(u)}}),U(mue,Ib),U(gue,Ib),U(vue,G,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),fS.Definition={type:`Pivot`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`value`,type:`field`,required:!0},{name:`op`,type:`enum`,values:kS,default:`sum`},{name:`limit`,type:`number`,default:0},{name:`key`,type:`field`}]},U(fS,zx,{_transform:zx.prototype.transform,transform(e,t){return this._transform(yue(e,t),t)}}),U(Sue,Qx,{transform(e,t){let n=e.subflow,r=e.field,i=e=>this.subflow(kb(e),n,t,e);return(e.modified(`field`)||r&&t.modified(wm(r)))&&V(`PreFacet does not support field modification.`),this.initTargets(),r?(t.visit(t.MOD,e=>{let t=i(e);r(e).forEach(e=>t.mod(e))}),t.visit(t.ADD,e=>{let t=i(e);r(e).forEach(e=>t.add(Ab(e)))}),t.visit(t.REM,e=>{let t=i(e);r(e).forEach(e=>t.rem(e))})):(t.visit(t.MOD,e=>i(e).mod(e)),t.visit(t.ADD,e=>i(e).add(e)),t.visit(t.REM,e=>i(e).rem(e))),t.clean()&&t.runAfter(()=>this.clean()),t}}),pS.Definition={type:`Project`,metadata:{generates:!0,changes:!0},params:[{name:`fields`,type:`field`,array:!0},{name:`as`,type:`string`,null:!0,array:!0}]},U(pS,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=oue(e.fields,e.as||[]),a=r?(e,t)=>Cue(e,t,r,i):Mb,o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,e=>{let t=kb(e);n.rem.push(o[t]),o[t]=null}),t.visit(t.ADD,e=>{let t=a(e,Ab({}));o[kb(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{n.mod.push(a(e,o[kb(e)]))}),n}}),U(mS,G,{transform(e,t){return this.value=e.value,e.modified(`value`)?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),hS.Definition={type:`Quantile`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`probs`,type:`number`,array:!0},{name:`step`,type:`number`,default:.01},{name:`as`,type:`string`,array:!0,default:[`prob`,`value`]}]},HS=1e-14,U(hS,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.as||[`prob`,`value`];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;let i=t.materialize(t.SOURCE).source,a=qx(i,e.groupby,e.field),o=(e.groupby||[]).map(Cm),s=[],c=e.step||.01,l=e.probs||m_(c/2,1-HS,c),u=l.length;return a.forEach(e=>{let t=ox(e,l);for(let n=0;n{let t=kb(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{let t=jb(e);r[kb(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{let t=r[kb(e)];for(let r in e)t[r]=e[r],n.modifies(r);n.mod.push(t)})),n}}),_S.Definition={type:`Sample`,metadata:{},params:[{name:`size`,type:`number`,default:1e3}]},U(_S,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.modified(`size`),i=e.size,a=this.value.reduce((e,t)=>(e[kb(t)]=1,e),{}),o=this.value,s=this.count,c=0;function l(e){let t,r;o.length=c&&(t=o[r],a[kb(t)]&&n.rem.push(t),o[r]=e)),++s}if(t.rem.length&&(t.visit(t.REM,e=>{let t=kb(e);a[t]&&(a[t]=-1,n.rem.push(e)),--s}),o=o.filter(e=>a[kb(e)]!==-1)),(t.rem.length||r)&&o.length{a[kb(e)]||l(e)}),c=-1),r&&o.length>i){let e=o.length-i;for(let t=0;t{a[kb(e)]&&n.mod.push(e)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||c<0)&&(n.add=o.filter(e=>!a[kb(e)])),this.count=s,this.value=n.source=o,n}}),vS.Definition={type:`Sequence`,metadata:{generates:!0,changes:!0},params:[{name:`start`,type:`number`,required:!0},{name:`stop`,type:`number`,required:!0},{name:`step`,type:`number`,default:1},{name:`as`,type:`string`,default:`data`}]},U(vS,G,{transform(e,t){if(this.value&&!e.modified())return;let n=t.materialize().fork(t.MOD),r=e.as||`data`;return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=m_(e.start,e.stop,e.step||1).map(e=>{let t={};return t[r]=e,Ab(t)}),n.add=t.add.concat(this.value),n}}),U(yS,G,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),US=[`unit0`,`unit1`],bS.Definition={type:`TimeUnit`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`interval`,type:`boolean`,default:!0},{name:`units`,type:`enum`,values:Ty,array:!0},{name:`step`,type:`number`,default:1},{name:`maxbins`,type:`number`,default:40},{name:`extent`,type:`date`,array:!0},{name:`inferUnits`,type:`boolean`,default:!1},{name:`timezone`,type:`enum`,default:`local`,values:[`local`,`utc`]},{name:`as`,type:`string`,array:!0,length:2,default:US}]},U(bS,G,{transform(e,t){let n=e.field,r=e.interval!==!1,i=e.timezone===`utc`,a=this._floor(e,t),o=(i?oy:ay)(a.unit).offset,s=e.as||US,c=s[0],l=s[1],u=a.step,d=a.start||1/0,f=a.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(wm(n)))&&(t=t.reflow(!0),p=t.SOURCE,d=1/0,f=-1/0),t.visit(p,e=>{let t=n(e),i,s;t==null?(e[c]=null,r&&(e[l]=null)):(e[c]=i=s=a(t),r&&(e[l]=s=o(i,u)),if&&(f=s))}),a.start=d,a.stop=f,t.modifies(r?s:c)},_floor(e,t){let n=e.timezone===`utc`;e.inferUnits&&(e.units||e.step!=null||e.maxbins!=null||e.extent)&&t.dataflow.warn(`TimeUnit inferUnits overrides units, step, maxbins and extent.`);let{units:r,step:i}=e.inferUnits?my(t.materialize(t.SOURCE).source,e.field,n):e.units?{units:e.units,step:e.step||1}:py({extent:e.extent||Ph(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=Hv(r),o=this.value||{},s=(n?iy:ry)(a,i);return s.unit=Ym(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),U(xS,G,{transform(e,t){let n=t.dataflow,r=e.field,i=this.value,a=e=>i.set(r(e),e),o=!0;return e.modified(`field`)||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,e=>i.delete(r(e))),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}}),U(SS,G,{transform(e,t){(!this.value||e.modified(`field`)||e.modified(`sort`)||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Nb(e.sort)):t.source).map(e.field))}}),WS={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=WS.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.data,r=t.compare,i=t.index;if(e0||V(`ntile num must be greater than zero.`);let n=WS.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||V(`nth_value nth must be greater than zero.`),{next:n=>{let r=n.i0+(t-1);return rt=null,next:n=>{let r=e(n.data[n.index]);return r==null?t:t=r}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{let i=r.data;return r.index<=n?t:(n=Tue(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}},GS=Object.keys(WS),KS=CS.prototype,KS.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},KS.update=function(e,t){let n=this.cell,r=this.windows,i=e.data,a=r&&r.length,o;if(n){for(o=e.p0;othis.group(i(e)),o=this.state;(!o||n)&&(o=this.state=new CS(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,e=>a(e).add(e))):(t.visit(t.REM,e=>a(e).remove(e)),t.visit(t.ADD,e=>a(e).add(e)));for(let t=0,n=this._mlen;t{}));function jue(e){return e>1?0:e<-1?rC:Math.acos(e)}function YS(e){return e>=1?iC:e<=-1?-iC:Math.asin(e)}var XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC=o((()=>{XS=Math.abs,ZS=Math.atan2,QS=Math.cos,$S=Math.max,eC=Math.min,tC=Math.sin,nC=Math.sqrt,rC=Math.PI,iC=rC/2,aC=2*rC}));function sC(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return sC;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t{lC=Math.PI,uC=2*lC,dC=1e-6,fC=uC-dC,pC=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?sC:Mue(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>dC)if(!(Math.abs(u*s-c*l)>dC)||!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((lC-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>dC&&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)>dC||Math.abs(this._y1-l)>dC)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%uC+uC),d>fC?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>dC&&this._append`A${n},${n},0,${+(d>=lC)},${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._}},cC.prototype=pC.prototype})),mC=o((()=>{Nue()}));function hC(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 pC(t)}var gC=o((()=>{mC()}));function Pue(e){return e.innerRadius}function Fue(e){return e.outerRadius}function Iue(e){return e.startAngle}function Lue(e){return e.endAngle}function Rue(e){return e&&e.padAngle}function zue(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function _C(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/nC(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*nC($S(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function Bue(){var e=Pue,t=Fue,n=qS(0),r=null,i=Iue,a=Lue,o=Rue,s=null,c=hC(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-iC,m=a.apply(this,arguments)-iC,h=XS(m-p),g=m>p;if(s||=l=c(),f1e-12))s.moveTo(0,0);else if(h>aC-1e-12)s.moveTo(f*QS(p),f*tC(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*QS(m),d*tC(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):nC(d*d+f*f)),T=eC(XS(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=YS(w/d*tC(C)),j=YS(w/f*tC(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*QS(_),ee=f*tC(_),N=d*QS(b),te=d*tC(b);if(T>1e-12){var ne=f*QS(v),P=f*tC(v),re=d*QS(y),F=d*tC(y),ie;if(h1e-12?D>1e-12?(O=_C(re,F,M,ee,f,D,g),k=_C(ne,P,N,te,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D1e-12)||!(x>1e-12)?s.lineTo(N,te):E>1e-12?(O=_C(N,te,ne,P,d,-E,g),k=_C(M,ee,re,F,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E{JS(),oC(),gC()}));function vC(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var yC=o((()=>{Array.prototype.slice}));function bC(e){this._context=e}function xC(e){return new bC(e)}var SC=o((()=>{bC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}}));function Hue(e){return e[0]}function Uue(e){return e[1]}var Wue=o((()=>{}));function Gue(e,t){var n=qS(!0),r=null,i=xC,a=null,o=hC(s);e=typeof e==`function`?e:e===void 0?Hue:qS(e),t=typeof t==`function`?t:t===void 0?Uue:qS(t);function s(s){var c,l=(s=vC(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c{yC(),JS(),SC(),gC(),Wue()}));function que(e,t,n){var r=null,i=qS(!0),a=null,o=xC,s=null,c=hC(l);e=typeof e==`function`?e:e===void 0?Hue:qS(+e),t=typeof t==`function`?t:qS(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Uue:qS(+n);function l(l){var u,d,f,p=(l=vC(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u=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 Gue().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:qS(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:qS(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:qS(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:qS(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:qS(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:qS(+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:qS(!!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 Jue=o((()=>{yC(),JS(),SC(),Kue(),gC(),Wue()})),Yue,Xue=o((()=>{oC(),Yue={draw(e,t){let n=nC(t/rC);e.moveTo(n,0),e.arc(0,0,n,0,aC)}}}));function Zue(e,t){let n=null,r=hC(i);e=typeof e==`function`?e:qS(e||Yue),t=typeof t==`function`?t:qS(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:qS(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:qS(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}var Que=o((()=>{JS(),gC(),Xue()}));function CC(){}var wC=o((()=>{}));function TC(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 EC(e){this._context=e}function $ue(e){return new EC(e)}var DC=o((()=>{EC.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:TC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:TC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function ede(e){this._context=e}function tde(e){return new ede(e)}var nde=o((()=>{wC(),DC(),ede.prototype={areaStart:CC,areaEnd:CC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:TC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function rde(e){this._context=e}function ide(e){return new rde(e)}var ade=o((()=>{DC(),rde.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:TC(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function ode(e,t){this._basis=new EC(e),this._beta=t}var sde,cde=o((()=>{DC(),ode.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},sde=(function e(t){function n(e){return t===1?new EC(e):new ode(e,t)}return n.beta=function(t){return e(+t)},n})(.85)}));function OC(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function kC(e,t){this._context=e,this._k=(1-t)/6}var lde,AC=o((()=>{kC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:OC(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:OC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},lde=(function e(t){function n(e){return new kC(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function jC(e,t){this._context=e,this._k=(1-t)/6}var ude,dde=o((()=>{wC(),AC(),jC.prototype={areaStart:CC,areaEnd:CC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:OC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},ude=(function e(t){function n(e){return new jC(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function MC(e,t){this._context=e,this._k=(1-t)/6}var fde,pde=o((()=>{AC(),MC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=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,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:OC(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},fde=(function e(t){function n(e){return new MC(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function NC(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function mde(e,t){this._context=e,this._alpha=t}var hde,PC=o((()=>{oC(),AC(),mde.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}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;default:NC(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},hde=(function e(t){function n(e){return t?new mde(e,t):new kC(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function gde(e,t){this._context=e,this._alpha=t}var _de,vde=o((()=>{dde(),wC(),PC(),gde.prototype={areaStart:CC,areaEnd:CC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:NC(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},_de=(function e(t){function n(e){return t?new gde(e,t):new jC(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function yde(e,t){this._context=e,this._alpha=t}var bde,xde=o((()=>{pde(),PC(),yde.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=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){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:NC(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},bde=(function e(t){function n(e){return t?new yde(e,t):new MC(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function Sde(e){this._context=e}function Cde(e){return new Sde(e)}var wde=o((()=>{wC(),Sde.prototype={areaStart:CC,areaEnd:CC,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 Tde(e){return e<0?-1:1}function Ede(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(Tde(a)+Tde(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Dde(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function FC(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 IC(e){this._context=e}function LC(e){this._context=new RC(e)}function RC(e){this._context=e}function Ode(e){return new IC(e)}function kde(e){return new LC(e)}var Ade=o((()=>{IC.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:FC(this,this._t0,Dde(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,FC(this,Dde(this,n=Ede(this,e,t)),n);break;default:FC(this,this._t0,n=Ede(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(LC.prototype=Object.create(IC.prototype)).point=function(e,t){IC.prototype.point.call(this,t,e)},RC.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 zC(e){this._context=e}function jde(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t{zC.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=jde(e),i=jde(t),a=0,o=1;o{BC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}}})),Rde=o((()=>{Vue(),Jue(),Kue(),yC(),JS(),oC(),SC(),gC(),Que(),Xue(),nde(),ade(),DC(),cde(),dde(),pde(),AC(),vde(),xde(),PC(),wde(),Ade(),Nde(),Lde()}));function VC(e,t){if(typeof document<`u`&&document.createElement){let n=document.createElement(`canvas`);if(n&&n.getContext)return n.width=e,n.height=t,n}return null}var HC,UC=o((()=>{HC=()=>typeof Image<`u`?Image:null}));function WC(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function GC(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t);break}return this}var KC=o((()=>{}));function qC(){var e=new Wg,t=[],n=[],r=JC;function i(i){let a=e.get(i);if(a===void 0){if(r!==JC)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Wg;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return qC(t,n).unknown(r)},WC.apply(i,arguments),i}var JC,zde=o((()=>{g_(),KC(),JC=Symbol(`implicit`)}));function YC(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function XC(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}var ZC=o((()=>{}));function QC(){}function $C(){return this.rgb().formatHex()}function Bde(){return this.rgb().formatHex8()}function Vde(){return pw(this).formatHsl()}function ew(){return this.rgb().formatRgb()}function tw(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ww.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?nw(t):n===3?new ow(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rw(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rw(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=Tw.exec(e))?new ow(t[1],t[2],t[3],1):(t=Ew.exec(e))?new ow(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Dw.exec(e))?rw(t[1],t[2],t[3],t[4]):(t=Ow.exec(e))?rw(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kw.exec(e))?fw(t[1],t[2]/100,t[3]/100,1):(t=Aw.exec(e))?fw(t[1],t[2]/100,t[3]/100,t[4]):jw.hasOwnProperty(e)?nw(jw[e]):e===`transparent`?new ow(NaN,NaN,NaN,0):null}function nw(e){return new ow(e>>16&255,e>>8&255,e&255,1)}function rw(e,t,n,r){return r<=0&&(e=t=n=NaN),new ow(e,t,n,r)}function iw(e){return e instanceof QC||(e=tw(e)),e?(e=e.rgb(),new ow(e.r,e.g,e.b,e.opacity)):new ow}function aw(e,t,n,r){return arguments.length===1?iw(e):new ow(e,t,n,r??1)}function ow(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function sw(){return`#${dw(this.r)}${dw(this.g)}${dw(this.b)}`}function Hde(){return`#${dw(this.r)}${dw(this.g)}${dw(this.b)}${dw((isNaN(this.opacity)?1:this.opacity)*255)}`}function cw(){let e=lw(this.opacity);return`${e===1?`rgb(`:`rgba(`}${uw(this.r)}, ${uw(this.g)}, ${uw(this.b)}${e===1?`)`:`, ${e})`}`}function lw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function uw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function dw(e){return e=uw(e),(e<16?`0`:``)+e.toString(16)}function fw(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hw(e,t,n,r)}function pw(e){if(e instanceof hw)return new hw(e.h,e.s,e.l,e.opacity);if(e instanceof QC||(e=tw(e)),!e)return new hw;if(e instanceof hw)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 hw(o,s,c,e.opacity)}function mw(e,t,n,r){return arguments.length===1?pw(e):new hw(e,t,n,r??1)}function hw(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function gw(e){return e=(e||0)%360,e<0?e+360:e}function _w(e){return Math.max(0,Math.min(1,e||0))}function vw(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 yw,bw,xw,Sw,Cw,ww,Tw,Ew,Dw,Ow,kw,Aw,jw,Mw=o((()=>{ZC(),yw=.7,bw=1/yw,xw=`\\s*([+-]?\\d+)\\s*`,Sw=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Cw=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ww=/^#([0-9a-f]{3,8})$/,Tw=RegExp(`^rgb\\(${xw},${xw},${xw}\\)$`),Ew=RegExp(`^rgb\\(${Cw},${Cw},${Cw}\\)$`),Dw=RegExp(`^rgba\\(${xw},${xw},${xw},${Sw}\\)$`),Ow=RegExp(`^rgba\\(${Cw},${Cw},${Cw},${Sw}\\)$`),kw=RegExp(`^hsl\\(${Sw},${Cw},${Cw}\\)$`),Aw=RegExp(`^hsla\\(${Sw},${Cw},${Cw},${Sw}\\)$`),jw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},YC(QC,tw,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$C,formatHex:$C,formatHex8:Bde,formatHsl:Vde,formatRgb:ew,toString:ew}),YC(ow,aw,XC(QC,{brighter(e){return e=e==null?bw:bw**+e,new ow(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yw:yw**+e,new ow(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ow(uw(this.r),uw(this.g),uw(this.b),lw(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:sw,formatHex:sw,formatHex8:Hde,formatRgb:cw,toString:cw})),YC(hw,mw,XC(QC,{brighter(e){return e=e==null?bw:bw**+e,new hw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yw:yw**+e,new hw(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 ow(vw(e>=240?e-240:e+120,i,r),vw(e,i,r),vw(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new hw(gw(this.h),_w(this.s),_w(this.l),lw(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=lw(this.opacity);return`${e===1?`hsl(`:`hsla(`}${gw(this.h)}, ${_w(this.s)*100}%, ${_w(this.l)*100}%${e===1?`)`:`, ${e})`}`}}))})),Nw,Pw,Fw=o((()=>{Nw=Math.PI/180,Pw=180/Math.PI}));function Iw(e){if(e instanceof Rw)return new Rw(e.l,e.a,e.b,e.opacity);if(e instanceof Ww)return Gw(e);e instanceof ow||(e=iw(e));var t=Hw(e.r),n=Hw(e.g),r=Hw(e.b),i=zw((.2225045*t+.7168786*n+.0606169*r)/Jw),a,o;return t===n&&n===r?a=o=i:(a=zw((.4360747*t+.3850649*n+.1430804*r)/qw),o=zw((.0139322*t+.0971045*n+.7141733*r)/Yw)),new Rw(116*i-16,500*(a-i),200*(i-o),e.opacity)}function Lw(e,t,n,r){return arguments.length===1?Iw(e):new Rw(e,t,n,r??1)}function Rw(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function zw(e){return e>$w?e**(1/3):e/Qw+Xw}function Bw(e){return e>Zw?e*e*e:Qw*(e-Xw)}function Vw(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function Hw(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ude(e){if(e instanceof Ww)return new Ww(e.h,e.c,e.l,e.opacity);if(e instanceof Rw||(e=Iw(e)),e.a===0&&e.b===0)return new Ww(NaN,0{ZC(),Mw(),Fw(),Kw=18,qw=.96422,Jw=1,Yw=.82521,Xw=4/29,Zw=6/29,Qw=3*Zw*Zw,$w=Zw*Zw*Zw,YC(Rw,Lw,XC(QC,{brighter(e){return new Rw(this.l+Kw*(e??1),this.a,this.b,this.opacity)},darker(e){return new Rw(this.l-Kw*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=qw*Bw(t),e=Jw*Bw(e),n=Yw*Bw(n),new ow(Vw(3.1338561*t-1.6168667*e-.4906146*n),Vw(-.9787684*t+1.9161415*e+.033454*n),Vw(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),YC(Ww,Uw,XC(QC,{brighter(e){return new Ww(this.h,this.c,this.l+Kw*(e??1),this.opacity)},darker(e){return new Ww(this.h,this.c,this.l-Kw*(e??1),this.opacity)},rgb(){return Gw(this).rgb()}}))}));function Gde(e){if(e instanceof tT)return new tT(e.h,e.s,e.l,e.opacity);e instanceof ow||(e=iw(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(lT*r+sT*t-cT*n)/(lT+sT-cT),a=r-i,o=(oT*(n-i)-iT*a)/aT,s=Math.sqrt(o*o+a*a)/(oT*i*(1-i)),c=s?Math.atan2(o,a)*Pw-120:NaN;return new tT(c<0?c+360:c,s,i,e.opacity)}function eT(e,t,n,r){return arguments.length===1?Gde(e):new tT(e,t,n,r??1)}function tT(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}var nT,rT,iT,aT,oT,sT,cT,lT,Kde=o((()=>{ZC(),Mw(),Fw(),nT=-.14861,rT=1.78277,iT=-.29227,aT=-.90649,oT=1.97294,sT=oT*aT,cT=oT*rT,lT=rT*iT-aT*nT,YC(tT,eT,XC(QC,{brighter(e){return e=e==null?bw:bw**+e,new tT(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yw:yw**+e,new tT(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Nw,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new ow(255*(t+n*(nT*r+rT*i)),255*(t+n*(iT*r+aT*i)),255*(t+oT*r*n),this.opacity)}}))})),uT=o((()=>{Mw(),Wde(),Kde()}));function dT(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}function fT(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r{}));function mT(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return dT((n-r/t)*t,i,a,o,s)}}var hT=o((()=>{pT()})),gT,_T=o((()=>{gT=e=>()=>e}));function vT(e,t){return function(n){return e+n*t}}function qde(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function yT(e,t){var n=t-e;return n?vT(e,n>180||n<-180?n-360*Math.round(n/360):n):gT(isNaN(e)?t:e)}function Jde(e){return(e=+e)==1?bT:function(t,n){return n-t?qde(t,n,e):gT(isNaN(t)?n:t)}}function bT(e,t){var n=t-e;return n?vT(e,n):gT(isNaN(e)?t:e)}var xT=o((()=>{_T()}));function ST(e){return function(t){var n=t.length,r=Array(n),i=Array(n),a=Array(n),o,s;for(o=0;o{uT(),pT(),hT(),xT(),CT=(function e(t){var n=Jde(t);function r(e,t){var r=n((e=aw(e)).r,(t=aw(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=bT(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),wT=ST(fT),TT=ST(mT)}));function DT(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i{}));function Yde(e,t){return(OT(t)?DT:AT)(e,t)}function AT(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o{UT(),kT()}));function MT(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}var NT=o((()=>{}));function PT(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var FT=o((()=>{}));function IT(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=HT(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var LT=o((()=>{UT()}));function Xde(e){return function(){return e}}function Zde(e){return function(t){return e(t)+``}}function RT(e,t){var n=zT.lastIndex=BT.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=zT.exec(e))&&(i=BT.exec(t));)(a=i.index)>n&&(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:PT(r,i)})),n=BT.lastIndex;return n{FT(),zT=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,BT=new RegExp(zT.source,`g`)}));function HT(e,t){var n=typeof t,r;return t==null||n===`boolean`?gT(t):(n===`number`?PT:n===`string`?(r=tw(t))?(t=r,CT):RT:t instanceof tw?CT:t instanceof Date?MT:OT(t)?DT:Array.isArray(t)?AT:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?IT:PT)(e,t)}var UT=o((()=>{uT(),ET(),jT(),NT(),FT(),LT(),VT(),_T(),kT()}));function Qde(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var $de=o((()=>{}));function efe(e,t){var n=yT(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var tfe=o((()=>{xT()}));function WT(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var nfe=o((()=>{}));function GT(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r{KT=180/Math.PI,qT={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}}));function ife(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?qT:GT(t.a,t.b,t.c,t.d,t.e,t.f)}function afe(e){return e==null||(JT||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),JT.setAttribute(`transform`,e),!(e=JT.transform.baseVal.consolidate()))?qT:(e=e.matrix,GT(e.a,e.b,e.c,e.d,e.e,e.f))}var JT,ofe=o((()=>{rfe()}));function YT(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:PT(e,i)},{i:c-2,x:PT(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:PT(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:PT(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:PT(e,n)},{i:s-2,x:PT(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t{FT(),ofe(),XT=YT(ife,`px, `,`px)`,`deg)`),ZT=YT(afe,`, `,`)`,`)`)}));function QT(e){return((e=Math.exp(e))+1/e)/2}function cfe(e){return((e=Math.exp(e))-1/e)/2}function lfe(e){return((e=Math.exp(2*e))-1)/(e+1)}var $T,eE,ufe=o((()=>{$T=1e-12,eE=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<$T)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=QT(y),c=s/(n*g)*(i*lfe(t*r+y)-cfe(y));return[a+c*d,o+c*f,s*i/QT(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4)}));function tE(e){return function(t,n){var r=e((t=mw(t)).h,(n=mw(n)).h),i=bT(t.s,n.s),a=bT(t.l,n.l),o=bT(t.opacity,n.opacity);return function(e){return t.h=r(e),t.s=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var nE,rE,dfe=o((()=>{uT(),xT(),nE=tE(yT),rE=tE(bT)}));function ffe(e,t){var n=bT((e=Lw(e)).l,(t=Lw(t)).l),r=bT(e.a,t.a),i=bT(e.b,t.b),a=bT(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}var pfe=o((()=>{uT(),xT()}));function iE(e){return function(t,n){var r=e((t=Uw(t)).h,(n=Uw(n)).h),i=bT(t.c,n.c),a=bT(t.l,n.l),o=bT(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var aE,oE,mfe=o((()=>{uT(),xT(),aE=iE(yT),oE=iE(bT)}));function sE(e){return(function t(n){n=+n;function r(t,r){var i=e((t=eT(t)).h,(r=eT(r)).h),a=bT(t.s,r.s),o=bT(t.l,r.l),s=bT(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var cE,lE,hfe=o((()=>{uT(),xT(),cE=sE(yT),lE=sE(bT)}));function uE(e,t){t===void 0&&(t=e,e=HT);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n{UT()}));function _fe(e,t){for(var n=Array(t),r=0;r{})),yfe=c({interpolate:()=>HT,interpolateArray:()=>Yde,interpolateBasis:()=>fT,interpolateBasisClosed:()=>mT,interpolateCubehelix:()=>cE,interpolateCubehelixLong:()=>lE,interpolateDate:()=>MT,interpolateDiscrete:()=>Qde,interpolateHcl:()=>aE,interpolateHclLong:()=>oE,interpolateHsl:()=>nE,interpolateHslLong:()=>rE,interpolateHue:()=>efe,interpolateLab:()=>ffe,interpolateNumber:()=>PT,interpolateNumberArray:()=>DT,interpolateObject:()=>IT,interpolateRgb:()=>CT,interpolateRgbBasis:()=>wT,interpolateRgbBasisClosed:()=>TT,interpolateRound:()=>WT,interpolateString:()=>RT,interpolateTransformCss:()=>XT,interpolateTransformSvg:()=>ZT,interpolateZoom:()=>eE,piecewise:()=>uE,quantize:()=>_fe}),dE=o((()=>{UT(),jT(),pT(),hT(),NT(),$de(),tfe(),FT(),kT(),LT(),nfe(),VT(),sfe(),ufe(),ET(),dfe(),pfe(),mfe(),hfe(),gfe(),vfe()}));function bfe(e){return function(){return e}}var xfe=o((()=>{}));function fE(e){return+e}var pE=o((()=>{}));function mE(e){return e}function hE(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:bfe(isNaN(t)?NaN:.5)}function Sfe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Cfe(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?wfe:Cfe,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),PT))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,fE),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=WT,u()},d.clamp=function(e){return arguments.length?(o=e?!0:mE,u()):o!==mE},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 vE(){return _E()(mE,mE)}var yE,bE=o((()=>{g_(),dE(),xfe(),pE(),yE=[0,1]}));function xE(e,t,n,r){var i=Qg(e,t,n),a;switch(r=x_(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=R_(i,o))&&(r.precision=a),I_(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=z_(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=L_(i))&&(r.precision=a-(r.type===`%`)*2);break}return F_(r)}var SE=o((()=>{g_(),B_()}));function CE(e){var t=e.domain;return e.ticks=function(e){var n=t();return Xg(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return xE(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=Zg(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 wE(){var e=vE();return e.copy=function(){return gE(e,wE())},WC.apply(e,arguments),CE(e)}var TE=o((()=>{g_(),bE(),KC(),SE()}));function EE(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,fE),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return EE(e).unknown(t)},e=arguments.length?Array.from(e,fE):[0,1],CE(n)}var Tfe=o((()=>{TE(),pE()}));function DE(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a{}));function kE(e){return Math.log(e)}function AE(e){return Math.exp(e)}function Efe(e){return-Math.log(-e)}function Dfe(e){return-Math.exp(-e)}function Ofe(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function kfe(e){return e===10?Ofe:e===Math.E?Math.exp:t=>e**+t}function Afe(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 jE(e){return(t,n)=>-e(-t,n)}function ME(e){let t=e(kE,AE),n=t.domain,r=10,i,a;function o(){return i=Afe(r),a=kfe(r),n()[0]<0?(i=jE(i),a=jE(a),e(Efe,Dfe)):e(kE,AE),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=x_(n)).precision==null&&(n.trim=!0),n=F_(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(DE(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function NE(){let e=ME(_E()).domain([1,10]);return e.copy=()=>gE(e,NE()).base(e.base()),WC.apply(e,arguments),e}var PE=o((()=>{g_(),B_(),OE(),bE(),KC()}));function FE(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function IE(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function LE(e){var t=1,n=e(FE(t),IE(t));return n.constant=function(n){return arguments.length?e(FE(t=+n),IE(t)):t},CE(n)}function RE(){var e=LE(_E());return e.copy=function(){return gE(e,RE()).constant(e.constant())},WC.apply(e,arguments)}var zE=o((()=>{TE(),bE(),KC()}));function BE(e){return function(t){return t<0?-((-t)**+e):t**+e}}function jfe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Mfe(e){return e<0?-e*e:e*e}function VE(e){var t=e(mE,mE),n=1;function r(){return n===1?e(mE,mE):n===.5?e(jfe,Mfe):e(BE(n),BE(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},CE(t)}function HE(){var e=VE(_E());return e.copy=function(){return gE(e,HE()).exponent(e.exponent())},WC.apply(e,arguments),e}function Nfe(){return HE.apply(null,arguments).exponent(.5)}var UE=o((()=>{TE(),bE(),KC()}));function WE(){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{g_(),KC()}));function GE(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[Ig(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++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 GE().domain([e,t]).range(i).unknown(a)},WC.apply(CE(o),arguments)}var Ffe=o((()=>{g_(),TE(),KC()}));function KE(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Ig(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 KE().domain(e).range(t).unknown(n)},WC.apply(i,arguments)}var Ife=o((()=>{g_(),KC()}));function Lfe(e){return new Date(e)}function Rfe(e){return e instanceof Date?+e:+new Date(+e)}function qE(e,t,n,r,i,a,o,s,c,l){var u=vE(),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){Vv(),cb(),bE(),KC(),OE()}));function Bfe(){return WC.apply(qE(Lv,Rv,Pv,jv,Sv,uv,sv,iv,tv,sb).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}var Vfe=o((()=>{Vv(),cb(),JE(),KC()}));function YE(){var e=0,t=1,n,r,i,a,o=mE,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(HT),l.rangeRound=u(WT),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function XE(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ZE(){var e=CE(YE()(mE));return e.copy=function(){return XE(e,ZE())},GC.apply(e,arguments)}function QE(){var e=ME(YE()).domain([1,10]);return e.copy=function(){return XE(e,QE()).base(e.base())},GC.apply(e,arguments)}function $E(){var e=LE(YE());return e.copy=function(){return XE(e,$E()).constant(e.constant())},GC.apply(e,arguments)}function eD(){var e=VE(YE());return e.copy=function(){return XE(e,eD()).exponent(e.exponent())},GC.apply(e,arguments)}function Hfe(){return eD.apply(null,arguments).exponent(.5)}var tD=o((()=>{dE(),bE(),KC(),TE(),PE(),zE(),UE()}));function nD(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=mE,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e{dE(),bE(),KC(),TE(),PE(),tD(),zE(),UE()})),Gfe=o((()=>{g_(),zde(),Tfe(),TE(),PE(),zE(),UE(),bE(),pE(),Pfe(),Ffe(),Ife(),JE(),Vfe(),tD(),Wfe(),SE()}));function sD(e){for(var t=e.length/6|0,n=Array(t),r=0;r{})),lD,Kfe=o((()=>{cD(),lD=sD(`1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf`)})),uD,qfe=o((()=>{cD(),uD=sD(`7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666`)})),dD,Jfe=o((()=>{cD(),dD=sD(`1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666`)})),fD,Yfe=o((()=>{cD(),fD=sD(`4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0`)})),pD,Xfe=o((()=>{cD(),pD=sD(`a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928`)})),mD,Zfe=o((()=>{cD(),mD=sD(`fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2`)})),hD,Qfe=o((()=>{cD(),hD=sD(`b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc`)})),gD,$fe=o((()=>{cD(),gD=sD(`e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999`)})),_D,epe=o((()=>{cD(),_D=sD(`66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3`)})),vD,tpe=o((()=>{cD(),vD=sD(`8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f`)})),npe=o((()=>{Kfe(),qfe(),Jfe(),Yfe(),Xfe(),Zfe(),Qfe(),$fe(),epe(),tpe(),cD(),dE(),uT()}));function yD(e,t,n){let r=e-t+n*2;return e?r>0?r:1:0}function rpe(e){return function(t){let n=t[0],r=t[1],i;return r=r&&n[c]<=i&&(a<0&&(a=c),o=c);if(!(a<0))return r=e.invertExtent(n[a]),i=e.invertExtent(n[o]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function bD(){let e=qC().unknown(void 0),t=e.domain,n=e.range,r=[0,1],i,a,o=!1,s=0,c=0,l=.5;delete e.unknown;function u(){let e=t().length,u=r[1]p+i*e);return n(u?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),u()):t()},e.range=function(e){return arguments.length?(r=[+e[0],+e[1]],u()):r.slice()},e.rangeRound=function(e){return r=[+e[0],+e[1]],o=!0,u()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,u()):o},e.padding=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),s=c,u()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),u()):s},e.paddingOuter=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),u()):c},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),u()):l},e.invertRange=function(e){if(e[0]==null||e[1]==null)return;let i=r[1]r[1-i])))return u=Math.max(0,Ig(o,c)-1),d=c===l?u:Ig(o,l)-1,c-o[u]>a+1e-10&&++u,i&&(f=u,u=s-d,d=s-f),u>d?void 0:t().slice(u,d+1)},e.invert=function(t){let n=e.invertRange([t,t]);return n&&n[0]},e.copy=function(){return bD().domain(t()).range(r).round(o).paddingInner(s).paddingOuter(c).align(l)},u()}function xD(e){let t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return xD(t())},e}function ape(){return xD(bD().paddingInner(1))}function ope(e){return gO.call(e,Zm)}function SD(){let e=[],t=[];function n(n){return n==null||n!==n?void 0:t[(Ig(e,n)-1)%t.length]}return n.domain=function(t){return arguments.length?(e=ope(t),n):e.slice()},n.range=function(e){return arguments.length?(t=_O.call(e),n):t.slice()},n.tickFormat=function(t,n){return xE(e[0],Ym(e),t??10,n)},n.copy=function(){return SD().domain(n.domain()).range(n.range())},n}function CD(e){return e[yO]=!0,e}function wD(e){return e&&e[yO]===!0}function spe(e,t,n){let r=function(){let n=t();return n.invertRange||=n.invert?rpe(n):n.invertExtent?ipe(n):void 0,n.type=e,CD(n)};return r.metadata=ug(yh(n)),r}function TD(e,t,n){return arguments.length>1?(vO.set(e,spe(e,t,n)),this):ED(e)?vO.get(e):void 0}function ED(e){return vO.has(e)}function DD(e,t){let n=vO.get(e);return n&&n.metadata[t]}function OD(e){return DD(e,dO)}function kD(e){return DD(e,fO)}function AD(e){return DD(e,pO)}function jD(e){return DD(e,`log`)}function MD(e){return DD(e,hO)}function ND(e){return DD(e,mO)}function PD(e){return DD(e,iO)}function FD(e,t){let n=t[0],r=Ym(t)-n;return function(t){return e(n+t*r)}}function ID(e,t,n){return uE(zD(t||`rgb`,n),e)}function LD(e,t){let n=Array(t),r=t+1;for(let i=0;ie[t]?o[t](e[t]()):0),o)}function zD(e,t){let n=yfe[cpe(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function cpe(e){return`interpolate`+e.toLowerCase().split(`-`).map(e=>e[0].toUpperCase()+e.slice(1)).join(``)}function BD(e){if(H(e))return e;let t=e.length/6|0,n=Array(t);for(let r=0;r1?(CO[e]=t,this):CO[e]}function UD(e,t,n){let r;if(Kh(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null)){let r=e.domain(),i=Math.min(r[0],Ym(r)),a=Math.max(r[0],Ym(r));if(t=Math.min(t,Math.floor((a-i)/n||1)+1),!e.bins&&!jD(e.type)&&!MD(e.type)&&i1&&Qg(i,a,t)a&&(r=a,a=i,i=r,o=EO),i=Math.floor(i),a=Math.ceil(a),t=t.map(t=>[t,e(t)]).filter(e=>i<=e[1]&&e[1]<=a).sort(o).map(e=>e[0]),n>0&&t.length>1){let e=[t[0],Ym(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}function GD(e,t){return e.bins?WD(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function KD(e,t,n,r,i,a){let o=t.type,s=wO;if(o===`time`||i===`time`)s=e.timeFormat(r);else if(o===`utc`||i===`utc`)s=e.utcFormat(r);else if(jD(o)){let i=e.formatFloat(r);if(a||t.bins)s=i;else{let e=qD(t,n,!1);s=t=>e(t)?i(t):``}}else if(t.tickFormat){let i=t.domain();s=e.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=e.format(r));return s}function qD(e,t,n){let r=GD(e,t),i=e.base(),a=Math.log(i),o=Math.max(1,i*t/r.length),s=e=>{let t=e/i**+Math.round(Math.log(e)/a);return t*i1?r[1]-r[0]:r[0],o;for(o=1;o(e-r)/a}function ppe(e,t,n,r){let i=r||t.type;return Yh(n)&&MD(i)&&(n=n.replace(/%a/g,`%A`).replace(/%b/g,`%B`)),!n&&i===`time`?e.timeFormat(`%A, %d %B %Y, %X`):!n&&i===`utc`?e.utcFormat(`%A, %d %B %Y, %X UTC`):YD(e,t,5,null,n,r,!0)}function XD(e,t,n){n||={};let r=Math.max(3,n.maxlen||7),i=ppe(e,t,n.format,n.formatType);if(AD(t.type)){let e=JD(t).slice(1).map(i),n=e.length;return`${n} boundar${n===1?`y`:`ies`}: ${e.join(`, `)}`}else if(kD(t.type)){let e=t.domain(),n=e.length,a=n>r?e.slice(0,r-2).map(i).join(`, `)+`, ending with `+e.slice(-1).map(i):e.map(i).join(`, `);return`${n} value${n===1?``:`s`}: ${a}`}else{let e=t.domain();return`values from ${i(e[0])} to ${i(Ym(e))}`}}var ZD,QD,$D,eO,tO,nO,rO,iO,aO,oO,sO,cO,lO,uO,dO,fO,pO,mO,hO,gO,_O,vO,yO,bO,xO,SO,CO,wO,TO,EO,DO,OO,kO,AO,jO,MO,NO,PO,FO=o((()=>{pg(),g_(),Gfe(),dE(),npe(),Xy(),ZD=`identity`,QD=`linear`,$D=`sqrt`,eO=`symlog`,tO=`time`,nO=`sequential`,rO=`diverging`,iO=`quantile`,aO=`quantize`,oO=`threshold`,sO=`ordinal`,cO=`point`,lO=`band`,uO=`bin-ordinal`,dO=`continuous`,fO=`discrete`,pO=`discretizing`,mO=`interpolating`,hO=`temporal`,gO=Array.prototype.map,_O=Array.prototype.slice,vO=new Map,yO=Symbol(`vega_scale`),TD(ZD,EE),TD(QD,wE,dO),TD(`log`,NE,[dO,`log`]),TD(`pow`,HE,dO),TD($D,Nfe,dO),TD(eO,RE,dO),TD(tO,zfe,[dO,hO]),TD(`utc`,Bfe,[dO,hO]),TD(nO,ZE,[dO,mO]),TD(`${nO}-${QD}`,ZE,[dO,mO]),TD(`${nO}-log`,QE,[dO,mO,`log`]),TD(`${nO}-pow`,eD,[dO,mO]),TD(`${nO}-${$D}`,Hfe,[dO,mO]),TD(`${nO}-${eO}`,$E,[dO,mO]),TD(`${rO}-${QD}`,rD,[dO,mO]),TD(`${rO}-log`,iD,[dO,mO,`log`]),TD(`${rO}-pow`,oD,[dO,mO]),TD(`${rO}-${$D}`,Ufe,[dO,mO]),TD(`${rO}-${eO}`,aD,[dO,mO]),TD(iO,WE,[pO,iO]),TD(aO,GE,pO),TD(oO,KE,pO),TD(uO,SD,[fO,pO]),TD(sO,qC,fO),TD(lO,bD,fO),TD(cO,ape,fO),bO=[`clamp`,`base`,`constant`,`exponent`],xO={blues:`cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90`,greens:`d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429`,greys:`e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e`,oranges:`fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303`,purples:`e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c`,reds:`fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13`,blueGreen:`d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429`,bluePurple:`ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71`,greenBlue:`d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1`,orangeRed:`fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403`,purpleBlue:`dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281`,purpleBlueGreen:`dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353`,purpleRed:`dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a`,redPurple:`fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174`,yellowGreen:`e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034`,yellowOrangeBrown:`feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204`,yellowOrangeRed:`fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225`,blueOrange:`134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07`,brownBlueGreen:`704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147`,purpleGreen:`5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29`,purpleOrange:`4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07`,redBlue:`8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85`,redGrey:`8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434`,yellowGreenBlue:`eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185`,redYellowBlue:`a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695`,redYellowGreen:`a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837`,pinkYellowGreen:`8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419`,spectral:`9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2`,viridis:`440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725`,magma:`0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf`,inferno:`0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4`,plasma:`0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921`,cividis:`00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647`,rainbow:`6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa`,sinebow:`ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040`,turbo:`23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00`,browns:`eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632`,tealBlues:`bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985`,teals:`bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667`,warmGreys:`dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e`,goldGreen:`f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36`,goldOrange:`f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26`,goldRed:`f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e`,lightGreyRed:`efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b`,lightGreyTeal:`e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc`,lightMulti:`e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c`,lightOrange:`f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b`,lightTealBlue:`e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988`,darkBlue:`3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff`,darkGold:`3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff`,darkGreen:`3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa`,darkMulti:`3737371f5287197d8c29a86995ce3fffe800ffffff`,darkRed:`3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c`},SO={accent:uD,category10:lD,category20:`1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5`,category20b:`393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6`,category20c:`3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9`,dark2:dD,observable10:fD,paired:pD,pastel1:mD,pastel2:hD,set1:gD,set2:_D,set3:vD,tableau10:`4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac`,tableau20:`4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5`},CO={},VD(SO,BD),VD(xO,e=>ID(BD(e))),wO=e=>H(e)?e.map(e=>String(e)):String(e),TO=(e,t)=>e[1]-t[1],EO=(e,t)=>t[1]-e[1],DO={[iO]:`quantiles`,[aO]:`thresholds`,[oO]:`domain`},OO={[iO]:`quantiles`,[aO]:`domain`},kO=e=>DO[e.type]||e.bins,AO=e=>(t,n,r)=>{let i=jO(r[n+1],jO(r.max,1/0)),a=PO(t,e),o=PO(i,e);return a&&o?a+` – `+o:o?`< `+o:`≥ `+a},jO=(e,t)=>e??t,MO=e=>(t,n)=>n?e(t):null,NO=e=>t=>e(t),PO=(e,t)=>Number.isFinite(e)?t(e):null}));function mpe(){Qk=0}function IO(e){return e&&e.gradient}function LO(e,t,n){let r=e.gradient,i=e.id,a=r===`radial`?$k:``;return i||(i=e.id=`gradient_`+Qk++,r===`radial`?(e.x1=RO(e.x1,.5),e.y1=RO(e.y1,.5),e.r1=RO(e.r1,0),e.x2=RO(e.x2,.5),e.y2=RO(e.y2,.5),e.r2=RO(e.r2,.5),a=$k):(e.x1=RO(e.x1,0),e.y1=RO(e.y1,0),e.x2=RO(e.x2,1),e.y2=RO(e.y2,0))),t[i]=e,`url(`+(n||``)+`#`+a+i+`)`}function RO(e,t){return e??t}function zO(e,t){var n=[],r;return r={gradient:`linear`,x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(e,t){return n.push({offset:e,color:t}),r}}}function BO(e,t,n){var r=Ih(eA,e)&&eA[e],i=null;return r&&(i=r.curve||r[t||`vertical`],r.tension&&n!=null&&(i=i[r.tension](n))),i}function VO(e){let t=[];return(e.match(khe)||[]).forEach(e=>{let n=e[0],r=n.toLowerCase(),i=Ohe[r],a=hpe(r,i,e.slice(1).trim()),o=a.length;if(o1&&(h=Math.sqrt(h),n*=h,r*=h);let g=f/n,_=d/n,v=-d/r,y=f/r,b=g*s+_*c,x=v*s+y*c,S=g*e+_*t,C=v*e+y*t,w=1/((S-b)*(S-b)+(C-x)*(C-x))-.25;w<0&&(w=0);let T=Math.sqrt(w);a==i&&(T=-T);let E=.5*(b+S)-T*(C-x),D=.5*(x+C)+T*(S-b),O=Math.atan2(x-D,b-E),k=Math.atan2(C-D,S-E)-O;k<0&&a===1?k+=rA:k>0&&a===0&&(k-=rA);let A=Math.ceil(Math.abs(k/(nA+.001))),j=[];for(let e=0;e+e}function WO(e,t,n){return Math.max(t,Math.min(e,n))}function Epe(){var e=Spe,t=Cpe,n=wpe,r=Tpe,i=UO(0),a=i,o=i,s=i,c=null;function l(l,u,d){var f,p=u??+e.call(this,l),m=d??+t.call(this,l),h=+n.call(this,l),g=+r.call(this,l),_=Math.min(h,g)/2,v=WO(+i.call(this,l),0,_),y=WO(+a.call(this,l),0,_),b=WO(+o.call(this,l),0,_),x=WO(+s.call(this,l),0,_);if(c||=f=cC(),v<=0&&y<=0&&b<=0&&x<=0)c.rect(p,m,h,g);else{var S=p+h,C=m+g;c.moveTo(p+v,m),c.lineTo(S-y,m),c.bezierCurveTo(S-fA*y,m,S,m+fA*y,S,m+y),c.lineTo(S,C-x),c.bezierCurveTo(S,C-fA*x,S-fA*x,C,S-x,C),c.lineTo(p+b,C),c.bezierCurveTo(p+fA*b,C,p,C-fA*b,p,C-b),c.lineTo(p,m+v),c.bezierCurveTo(p,m+fA*v,p+fA*v,m,p+v,m),c.closePath()}if(f)return c=null,f+``||null}return l.x=function(t){return arguments.length?(e=UO(t),l):e},l.y=function(e){return arguments.length?(t=UO(e),l):t},l.width=function(e){return arguments.length?(n=UO(e),l):n},l.height=function(e){return arguments.length?(r=UO(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=UO(e),a=t==null?i:UO(t),s=n==null?i:UO(n),o=r==null?a:UO(r),l):i},l.context=function(e){return arguments.length?(c=e??null,l):c},l}function Dpe(){var e,t,n,r,i=null,a,o,s,c;function l(e,t,n){let r=n/2;if(a){var l=s-t,u=e-o;if(l||u){var d=Math.hypot(l,u),f=(l/=d)*c,p=(u/=d)*c,m=Math.atan2(u,l);i.moveTo(o-f,s-p),i.lineTo(e-l*r,t-u*r),i.arc(e,t,r,m-Math.PI,m),i.lineTo(o+f,s+p),i.arc(o,s,c,m,m+Math.PI)}else i.arc(e,t,r,0,rA);i.closePath()}else a=1;o=e,s=t,c=r}function u(o){var s,c=o.length,u,d=!1,f;for(i??=f=cC(),s=0;s<=c;++s)!(sNhe?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),c=(-o+u)/a,l=(-o-u)/a)):c=.5*s/o,0f)return!1;h>d&&(d=h)}else if(p>0){if(h0?(e.globalAlpha=n,e.fillStyle=Upe(e,t,t.fill),!0):!1}function sk(e,t,n){var r=(r=t.strokeWidth)??1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=Upe(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||`butt`,e.lineJoin=t.strokeJoin||`miter`,e.miterLimit=t.strokeMiterLimit==null?4:t.strokeMiterLimit,e.setLineDash&&(e.setLineDash(t.strokeDash||oge),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function Wpe(e,t){return e.zindex-t.zindex||e.index-t.index}function ck(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,a;for(i=0,a=t.length;i=0;)if(r=t(n[i]))return r;if(n===a){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function dk(e){return function(t,n,r){lk(n,n=>{(!r||r.intersects(n.bounds))&&Kpe(e,t,n,n)})}}function Gpe(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&Kpe(e,t,n.items[0],n.items)}}function Kpe(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(ik(t,n),n.fill&&ok(t,n,i)&&t.fill(),n.stroke&&sk(t,n,i)&&t.stroke()))}function fk(e){return e||=zm,function(t,n,r,i,a,o){return r*=t.pixelRatio,i*=t.pixelRatio,uk(n,n=>{let s=n.bounds;if(!(s&&!s.contains(a,o)||!s)&&e(t,n,r,i,a,o))return n})}}function pk(e,t){return function(n,r,i,a){var o=Array.isArray(r)?r[0]:r,s=t??o.fill,c=o.stroke&&n.isPointInStroke,l,u;return c&&(l=o.strokeWidth,u=o.strokeCap,n.lineWidth=l??1,n.lineCap=u??`butt`),e(n,r)?!1:s&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function mk(e){return fk(pk(e))}function hk(e,t){return`translate(`+e+`,`+t+`)`}function gk(e){return`rotate(`+e+`)`}function qpe(e,t){return`scale(`+e+`,`+t+`)`}function Jpe(e){return hk(e.x||0,e.y||0)}function Ype(e){return hk(e.x||0,e.y||0)+(e.angle?` `+gk(e.angle):``)}function Xpe(e){return hk(e.x||0,e.y||0)+(e.angle?` `+gk(e.angle):``)+(e.scaleX||e.scaleY?` `+qpe(e.scaleX||1,e.scaleY||1):``)}function _k(e,t,n){function r(e,n){e(`transform`,Ype(n)),e(`d`,t(null,n))}function i(e,n){return t(ek(e,n.angle),n),$O(e,n,!0).translate(n.x||0,n.y||0)}function a(e,n){var r=n.x||0,i=n.y||0,a=n.angle||0;e.translate(r,i),a&&e.rotate(a*=tA),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-r,-i)}return{type:e,tag:`path`,nested:!1,attr:r,bound:i,draw:dk(a),pick:mk(a),isect:n||tk(a)}}function Zpe(e,t){for(var n=e[0].orient===`horizontal`?t[1]:t[0],r=e[0].orient===`horizontal`?`y`:`x`,i=e.length,a=1/0,o,s;--i>=0;)e[i].defined!==!1&&(s=Math.abs(e[i][r]-n),s=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],a=e[r].y-t[1],o=i*i+a*a,o=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],a=r*r+i*i,r=e[n].size||1,a.5&&t<1.5?.5-Math.abs(t-1):0:e.strokeOffset}function rme(e,t){e(`transform`,Jpe(t))}function ime(e,t){let n=nme(t);e(`d`,qO(null,t,n,n))}function ame(e,t){e(`class`,`background`),e(`aria-hidden`,!0),ime(e,t)}function ome(e,t){e(`class`,`foreground`),e(`aria-hidden`,!0),t.strokeForeground?ime(e,t):e(`d`,``)}function sme(e,t,n){e(`clip-path`,t.clip?JO(n,t,t):null)}function cme(e,t){if(!t.clip&&t.items){let n=t.items,r=n.length;for(let t=0;t{let i=t.x||0,a=t.y||0,o=t.strokeForeground,s=t.opacity==null?1:t.opacity;(t.stroke||t.fill)&&s&&(yk(e,t,i,a),ik(e,t),t.fill&&ok(e,t,s)&&e.fill(),t.stroke&&!o&&sk(e,t,s)&&e.stroke()),e.save(),e.translate(i,a),t.clip&&tme(e,t),n&&n.translate(-i,-a),lk(t,t=>{(t.marktype===`group`||r==null||r.includes(t.marktype))&&this.draw(e,t,n,r)}),n&&n.translate(i,a),e.restore(),o&&t.stroke&&s&&(yk(e,t,i,a),ik(e,t),sk(e,t,s)&&e.stroke())})}function ume(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a)||!t.items)return null;let o=n*e.pixelRatio,s=r*e.pixelRatio;return uk(t,c=>{let l,u,d,f=c.bounds;if(f&&!f.contains(i,a))return;u=c.x||0,d=c.y||0;let p=u+(c.width||0),m=d+(c.height||0),h=c.clip;if(h&&(ip||am))return;if(e.save(),e.translate(u,d),u=i-u,d=a-d,h&&KO(c)&&!dge(e,c,o,s))return e.restore(),null;let g=c.strokeForeground,_=t.interactive!==!1;return _&&g&&c.stroke&&uge(e,c,o,s)?(e.restore(),c):(l=uk(c,e=>dme(e,u,d)?this.pick(e,n,r,u,d):null),!l&&_&&(c.fill||!g&&c.stroke)&&lge(e,c,o,s)&&(l=c),e.restore(),l||null)})}function dme(e,t,n){return(e.interactive!==!1||e.marktype===`group`)&&e.bounds&&e.bounds.contains(t,n)}function bk(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function xk(e,t){return e.width==null?!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:e.width}function Sk(e,t){return e.height==null?!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:e.height}function Ck(e,t){return e===`center`?t/2:e===`right`?t:0}function wk(e,t){return e===`middle`?t/2:e===`bottom`?t:0}function fme(e,t,n){let r=bk(t,n),i=xk(t,r),a=Sk(t,r),o=(t.x||0)-Ck(t.align,i),s=(t.y||0)-wk(t.baseline,a);e(`href`,!r.src&&r.toDataURL?r.toDataURL():r.src||``,IA[`xmlns:xlink`],`xlink:href`),e(`transform`,hk(o,s)),e(`width`,i),e(`height`,a),e(`preserveAspectRatio`,t.aspect===!1?`none`:`xMidYMid`)}function pme(e,t){let n=t.image,r=xk(t,n),i=Sk(t,n),a=(t.x||0)-Ck(t.align,r),o=(t.y||0)-wk(t.baseline,i);return e.set(a,o,a+r,o+i)}function mme(e,t,n){lk(t,t=>{if(n&&!n.intersects(t.bounds))return;let r=bk(t,this),i=xk(t,r),a=Sk(t,r);if(i===0||a===0)return;let o=(t.x||0)-Ck(t.align,i),s=(t.y||0)-wk(t.baseline,a),c,l,u;t.aspect!==!1&&(c=r.width/r.height,l=t.width/t.height,c===c&&l===l&&c!==l&&(l{if(!(n&&!n.intersects(t.bounds))){var r=t.opacity==null?1:t.opacity;r&&Sme(e,t,r)&&(ik(e,t),e.stroke())}})}function wme(e,t,n,r){return e.isPointInStroke?Sme(e,t,1)&&e.isPointInStroke(n,r):!1}function Tme(e){RA.width=e&&PA?Dk:Ek}function Ek(e,t){return Eme(Mk(e,t),Ok(e))}function Eme(e,t){return~~(.8*e.length*t)}function Dk(e,t){return Ok(e)<=0||!(t=Mk(e,t))?0:Dme(t,Pk(e))}function Dme(e,t){let n=`(${t}) ${e}`,r=LA.get(n);return r===void 0&&(PA.font=t,r=PA.measureText(e).width,LA.set(n,r)),r}function Ok(e){return e.fontSize==null?11:+e.fontSize||0}function kk(e){return e.lineHeight==null?Ok(e)+2:e.lineHeight}function Ome(e){return H(e)?e.length>1?e:e[0]:e}function Ak(e){return Ome(e.lineBreak&&e.text&&!H(e.text)?e.text.split(e.lineBreak):e.text)}function jk(e){let t=Ak(e);return(H(t)?t.length-1:0)*kk(e)}function Mk(e,t){let n=t==null?``:(t+``).trim();return e.limit>0&&n.length?Ame(e,n):n}function kme(e){if(RA.width===Dk){let t=Pk(e);return e=>Dme(e,t)}else if(RA.width===Ek){let t=Ok(e);return e=>Eme(e,t)}else return t=>RA.width(e,t)}function Ame(e,t){var n=+e.limit,r=kme(e);if(r(t)>>1,r(t.slice(c))>n?o=c+1:s=c;return i+t.slice(o)}else{for(;o>>1),r(t.slice(0,c))Math.max(e,RA.width(t,n)),0)):d=RA.width(t,u),i===`center`?c-=d/2:i===`right`&&(c-=d),e.set(c+=o,l+=s,c+d,l+r),t.angle&&!n)e.rotate(t.angle*tA,o,s);else if(n===2)return e.rotatedPoints(t.angle*tA,o,s);return e}function Mme(e,t,n){lk(t,t=>{var r=t.opacity==null?1:t.opacity,i,a,o,s,c,l,u;if(!(n&&!n.intersects(t.bounds)||r===0||t.fontSize<=0||t.text==null||t.text.length===0)){if(e.font=Pk(t),e.textAlign=t.align||`left`,i=Ik(t),a=i.x1,o=i.y1,t.angle&&(e.save(),e.translate(a,o),e.rotate(t.angle*tA),a=o=0),a+=t.dx||0,o+=(t.dy||0)+Fk(t),l=Ak(t),ik(e,t),H(l))for(c=kk(t),s=0;st;)e.removeChild(n[--r]);return e}function Bme(e){return`mark-`+e.marktype+(e.role?` role-`+e.role:``)+(e.name?` `+e.name:``)}function Uk(e,t){if(t.getScreenCTM){let n=Vme(e,t.getScreenCTM());if(n)return n}return Hme(e,t,t.getBoundingClientRect())}function Vme(e,t){if(!t)return null;let n=t.a*t.d-t.b*t.c;if(!n)return null;let r=e.clientX-t.e,i=e.clientY-t.f;return[(t.d*r-t.c*i)/n,(t.a*i-t.b*r)/n]}function Hme(e,t,n){let r=t.offsetWidth?n.width/t.offsetWidth:1,i=t.offsetHeight?n.height/t.offsetHeight:1;return[(e.clientX-n.left)/r-(t.clientLeft||0),(e.clientY-n.top)/i-(t.clientTop||0)]}function Ume(e,t,n,r){var i=e&&e.mark,a,o;if(i&&(a=BA[i.marktype]).tip){for(o=Uk(t,n),o[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=a.tip(i.items,o)}return e}function Wme(e,t,n,r){e.element().setAttribute(`title`,r||``)}function Gme(e,t){mj(t).forEach(t=>Kme(e,t))}function Kme(e,t){let n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}function Wk(e,t,n){t.forEach(t=>e.fire(t,n))}function qme(e,t,n){return function(r){let i=this._active,a=this.pickEvent(r);a===i?Wk(this,e,r):((!i||!i.exit)&&Wk(this,n,r),this._active=a,Wk(this,t,r),Wk(this,e,r))}}function Jme(e){return function(t){Wk(this,e,t),this._active=null}}function Yme(){return typeof window<`u`&&window.devicePixelRatio||1}function Xme(e,t,n,r,i,a){let o=typeof HTMLElement<`u`&&e instanceof HTMLElement&&e.parentNode!=null,s=e.getContext(`2d`),c=o?Yme():i;e.width=t*c,e.height=n*c;for(let e in a)s[e]=a[e];return o&&c!==1&&(e.style.width=t+`px`,e.style.height=n+`px`),s.pixelRatio=c,s.setTransform(c,0,0,c,c*r[0],c*r[1]),e}function Zme(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}function Qme(e,t){let n=t.aria===!1;if(e(yj,n||void 0),n||t.description==null)for(let t in Oj)e(Oj[t],void 0);else{let n=t.mark.marktype;e(bj,t.description),e(xj,t.ariaRole||(n===`group`?Cj:wj)),e(Sj,t.ariaRoleDescription||`${n} mark`)}}function $me(e){return e.aria===!1?{[yj]:!0}:Ej[e.role]?null:Dj[e.role]?the(e,Dj[e.role]):ehe(e)}function ehe(e){let t=e.marktype,n=t===`group`||t===`text`||e.items.some(e=>e.description!=null&&e.aria!==!1);return Tj(n?Cj:wj,`${t} mark container`,e.description)}function the(e,t){try{let n=e.items[0],r=t.caption||(()=>``);return Tj(t.role||wj,t.desc,e.description||n.description||r(n))}catch{return null}}function nhe(e){return yh(e.text).join(` `)}function rhe(e){let t=e.datum,n=e.orient,r=t.title?ahe(e):null,i=e.context,a=i.scales[t.scale].value,o=i.dataflow.locale(),s=a.type;return`${n===`left`||n===`right`?`Y`:`X`}-axis`+(r?` titled '${r}'`:``)+` for a ${kD(s)?`discrete`:s} scale with ${XD(o,a,e)}`}function ihe(e){let t=e.datum,n=t.title?ahe(e):null,r=`${t.type||``} legend`.trim(),i=t.scales,a=Object.keys(i),o=e.context,s=o.scales[i[a[0]]].value,c=o.dataflow.locale();return she(r)+(n?` titled '${n}'`:``)+` for ${ohe(a)} with ${XD(c,s,e)}`}function ahe(e){try{return yh(Ym(e.items).items[0].text).join(` `)}catch{return null}}function ohe(e){return e=e.map(e=>e+(e===`fill`||e===`stroke`?` color`:``)),e.length<2?e[0]:e.slice(0,-1).join(`, `)+` and `+Ym(e)}function she(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Gk(){let e=``,t=``,n=``,r=[],i=()=>t=n=``,a=a=>{t&&(e+=`${t}>${n}`,i()),r.push(a)},o=(e,n)=>(n!=null&&(t+=` ${e}="${Aj(n)}"`),s),s={open(e,...n){a(e),t=`<`+e;for(let e of n)for(let t in e)o(t,e[t]);return s},close(){let a=r.pop();return t?e+=t+(n?`>${n}`:`/>`):e+=``,i(),s},attr:o,text:e=>(n+=kj(e),s),toString:()=>e};return s}function che(e,t){if(e.open(t.tagName),t.hasAttributes()){let n=t.attributes,r=n.length;for(let t=0;t{i=e.mark(t,n,i,r),++a}),Hk(t,1+a)}function phe(e,t,n,r,i){let a=e._svg,o;if(!a&&(o=t.ownerDocument,a=zk(o,r,Lj),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:`default`},r===`g`))){let t=zk(o,`path`,Lj);a.appendChild(t),t.__data__=e;let n=zk(o,`g`,Lj);a.appendChild(n),n.__data__=e;let r=zk(o,`path`,Lj);a.appendChild(r),r.__data__=e,r.__values__={fill:`default`}}return(a.ownerSVGElement!==i||mhe(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}function mhe(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}function Kk(e,t,n){t!==Bj[e]&&(n?hhe(zj,e,t,n):Yk(zj,e,t),Bj[e]=t)}function qk(e,t,n){n!==Bj[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+``),Bj[t]=n)}function Jk(e,t){for(let n in t)Yk(e,n,t[n])}function Yk(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function hhe(e,t,n,r){n==null?e.removeAttributeNS(r,t):e.setAttributeNS(r,t,n)}function ghe(){let e;return typeof window>`u`?``:(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function _he(e,t,n,r,i){let a;if(t==null||(r===`bgrect`&&n.interactive===!1&&(e[`pointer-events`]=`none`),r===`bgfore`&&(n.interactive===!1&&(e[`pointer-events`]=`none`),e.display=`none`,t.fill!==null)))return e;r===`image`&&t.smooth===!1&&(a=[`image-rendering: optimizeSpeed;`,`image-rendering: pixelated;`]),r===`text`&&(e[`font-family`]=Nk(t),e[`font-size`]=Ok(t)+`px`,e[`font-style`]=t.fontStyle,e[`font-variant`]=t.fontVariant,e[`font-weight`]=t.fontWeight);for(let n in Mj){let r=t[n],a=Mj[n];r===`transparent`&&(a===`fill`||a===`stroke`)||r!=null&&(IO(r)&&(r=LO(r,i.gradient,``)),e[a]=r)}for(let e in Nj){let n=t[e];n!=null&&(a||=[],a.push(`${Nj[e]}: ${n};`))}return a&&(e.style=a.join(` `)),e}function vhe(e){Uj.svgMarkTypes=e.svgMarkTypes??[`text`],Uj.svgOnTop=e.svgOnTop??!0,Uj.debug=e.debug??!1}function Xk(e,t){return e=String(e||``).toLowerCase(),arguments.length>1?(Qj[e]=t,this):Qj[e]}function yhe(e,t,n){let r=[],i=new YO().union(t),a=e.marktype;return a?bhe(e,i,n,r):a===`group`?She(e,i,n,r):V(`Intersect scene must be mark node or group item.`)}function bhe(e,t,n,r){if(xhe(e,t,n)){let i=e.items,a=e.marktype,o=i.length,s=0;if(a===`group`)for(;s=0;a--)if(n[a]!=r[a])return!1;for(a=n.length-1;a>=0;a--)if(i=n[a],!Zk(e[i],t[i],i))return!1;return typeof e==typeof t}function Dhe(){Ppe(),mpe()}var Qk,$k,eA,Ohe,khe,Ahe,jhe,Mhe,tA,Nhe,nA,rA,iA,aA,oA,sA,cA,lA,uA,dA,fA,pA,mA,Phe,Fhe,Ihe,Lhe,Rhe,zhe,Bhe,Vhe,Hhe,Uhe,Whe,Ghe,Khe,qhe,Jhe,Yhe,hA,Xhe,Zhe,Qhe,$he,ege,tge,nge,rge,gA,_A,ige,vA,yA,bA,xA,SA,CA,wA,TA,EA,DA,OA,kA,AA,jA,MA,NA,age,PA,FA,oge,sge,cge,lge,uge,dge,fge,IA,pge,mge,hge,gge,_ge,vge,yge,LA,RA,bge,zA,BA,VA,xge,HA,UA,WA,Sge,Cge,wge,GA,KA,qA,JA,Tge,YA,XA,ZA,QA,Ege,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j,eM,tM=o((()=>{pg(),Rde(),mC(),UC(),Tb(),FO(),Qk=0,$k=`p_`,eA={basis:{curve:$ue},"basis-closed":{curve:tde},"basis-open":{curve:ide},bundle:{curve:sde,tension:`beta`,value:.85},cardinal:{curve:lde,tension:`tension`,value:0},"cardinal-open":{curve:fde,tension:`tension`,value:0},"cardinal-closed":{curve:ude,tension:`tension`,value:0},"catmull-rom":{curve:hde,tension:`alpha`,value:.5},"catmull-rom-closed":{curve:_de,tension:`alpha`,value:.5},"catmull-rom-open":{curve:bde,tension:`alpha`,value:.5},linear:{curve:xC},"linear-closed":{curve:Cde},monotone:{horizontal:kde,vertical:Ode},natural:{curve:Mde},step:{curve:Pde},"step-after":{curve:Ide},"step-before":{curve:Fde}},Ohe={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},khe=/[mlhvzcsqta]([^mlhvzcsqta]*)/gi,Ahe=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,jhe=/^((\s+,?\s*)|(,\s*))/,Mhe=/^[01]/,tA=Math.PI/180,Nhe=1e-14,nA=Math.PI/2,rA=Math.PI*2,iA=Math.sqrt(3)/2,aA={},oA={},sA=[].join,cA=[`l`,0,0,0,0,0,0,0],lA=.5773502691896257,uA={circle:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,rA)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/2.5;e.moveTo(-n,-r),e.lineTo(-n,r),e.lineTo(-r,r),e.lineTo(-r,n),e.lineTo(r,n),e.lineTo(r,r),e.lineTo(n,r),e.lineTo(n,-r),e.lineTo(r,-r),e.lineTo(r,-n),e.lineTo(-r,-n),e.lineTo(-r,-r),e.closePath()}},diamond:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/7,i=n/2.5,a=n/8;e.moveTo(-r,n),e.lineTo(r,n),e.lineTo(r,-a),e.lineTo(i,-a),e.lineTo(0,-n),e.lineTo(-i,-a),e.lineTo(-r,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n,i=r-n*lA,a=n/4;e.moveTo(0,-r-i),e.lineTo(-a,r-i),e.lineTo(a,r-i),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n,i=r-n*lA;e.moveTo(0,-r-i),e.lineTo(-n,r-i),e.lineTo(n,r-i),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n;e.moveTo(0,-r),e.lineTo(-n,r),e.lineTo(n,r),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n;e.moveTo(0,r),e.lineTo(-n,-r),e.lineTo(n,-r),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n;e.moveTo(r,0),e.lineTo(-r,-n),e.lineTo(-r,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,r=iA*n;e.moveTo(-r,0),e.lineTo(r,-n),e.lineTo(r,n),e.closePath()}},stroke:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}},dA={},fA=.448084975506,pA=e=>e.x||0,mA=e=>e.y||0,Phe=e=>e.width||0,Fhe=e=>e.height||0,Ihe=e=>(e.x||0)+(e.width||0),Lhe=e=>(e.y||0)+(e.height||0),Rhe=e=>e.startAngle||0,zhe=e=>e.endAngle||0,Bhe=e=>e.padAngle||0,Vhe=e=>e.innerRadius||0,Hhe=e=>e.outerRadius||0,Uhe=e=>e.cornerRadius||0,Whe=e=>GO(e.cornerRadiusTopLeft,e.cornerRadius)||0,Ghe=e=>GO(e.cornerRadiusTopRight,e.cornerRadius)||0,Khe=e=>GO(e.cornerRadiusBottomRight,e.cornerRadius)||0,qhe=e=>GO(e.cornerRadiusBottomLeft,e.cornerRadius)||0,Jhe=e=>GO(e.size,64),Yhe=e=>e.size||1,hA=e=>e.defined!==!1,Xhe=e=>bpe(e.shape||`circle`),Zhe=Bue().startAngle(Rhe).endAngle(zhe).padAngle(Bhe).innerRadius(Vhe).outerRadius(Hhe).cornerRadius(Uhe),Qhe=que().x(pA).y1(mA).y0(Lhe).defined(hA),$he=que().y(mA).x1(pA).x0(Ihe).defined(hA),ege=Gue().x(pA).y(mA).defined(hA),tge=Epe().x(pA).y(mA).width(Phe).height(Fhe).cornerRadius(Whe,Ghe,Khe,qhe),nge=Zue().type(Xhe).size(Jhe),rge=Dpe().x(pA).y(mA).defined(hA).size(Yhe),gA=1,YO.prototype={clone(){return new YO(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},U(ZO,XO),_A=class{constructor(e){this._pending=0,this._loader=e||wb()}pending(){return this._pending}sanitizeURL(e){let t=this;return Fpe(t),t._loader.sanitize(e,{context:`href`}).then(e=>(QO(t),e)).catch(()=>(QO(t),null))}loadImage(e){let t=this,n=HC();return Fpe(t),t._loader.sanitize(e,{context:`image`}).then(e=>{let r=e.href;if(!r||!n)throw{url:r};let i=new n,a=Ih(e,`crossOrigin`)?e.crossOrigin:`anonymous`;return a!=null&&(i.crossOrigin=a),i.onload=()=>QO(t),i.onerror=()=>QO(t),i.src=r,i}).catch(e=>(QO(t),{complete:!1,width:0,height:0,src:e&&e.url||``}))}ready(){let e=this;return new Promise(t=>{function n(r){e.pending()?setTimeout(()=>{n(!0)},10):t(r)}n(!1)})}},ige=rA-1e-8,EA=(e,t)=>vA.add(e,t),DA=(e,t)=>EA(yA=e,bA=t),OA=e=>EA(e,vA.y1),kA=e=>EA(vA.x1,e),AA=(e,t)=>SA*e+wA*t,jA=(e,t)=>CA*e+TA*t,MA=(e,t)=>EA(AA(e,t),jA(e,t)),NA=(e,t)=>DA(AA(e,t),jA(e,t)),age={beginPath(){},closePath(){},moveTo:NA,lineTo:NA,rect(e,t,n,r){xA?(MA(e+n,t),MA(e+n,t+r),MA(e,t+r),NA(e,t)):(EA(e+n,t+r),DA(e,t))},quadraticCurveTo(e,t,n,r){let i=AA(e,t),a=jA(e,t),o=AA(n,r),s=jA(n,r);Ipe(yA,i,o,OA),Ipe(bA,a,s,kA),DA(o,s)},bezierCurveTo(e,t,n,r,i,a){let o=AA(e,t),s=jA(e,t),c=AA(n,r),l=jA(n,r),u=AA(i,a),d=jA(i,a);Lpe(yA,o,c,u,OA),Lpe(bA,s,l,d,kA),DA(u,d)},arc(e,t,n,r,i,a){if(r+=xA,i+=xA,yA=n*Math.cos(i)+e,bA=n*Math.sin(i)+t,Math.abs(i-r)>ige)EA(e-n,t-n),EA(e+n,t+n);else{let o=r=>EA(n*Math.cos(r)+e,n*Math.sin(r)+t),s,c;if(o(r),o(i),i!==r)if(r%=rA,r<0&&(r+=rA),i%=rA,i<0&&(i+=rA),ii;++c,s-=nA)o(s);else for(s=r-r%nA+nA,c=0;c<4&&s=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1}handlers(e){let t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(let e in t)n.push(...t[e]);return n}eventName(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:`href`}).then(t=>{let n=new MouseEvent(e.type,e),r=zk(null,`a`);for(let e in t)r.setAttribute(e,t[e]);r.dispatchEvent(n)}).catch(()=>{})}handleTooltip(e,t,n){if(t&&t.tooltip!=null){t=Ume(t,e,this.canvas(),this._origin);let r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}}getItemBoundingClientRect(e){let t=this.canvas();if(!t)return;let n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,a=i.width(),o=i.height(),s=i.x1+r[0]+n.left,c=i.y1+r[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,c+=e.y||0;return{x:s,y:c,width:a,height:o,left:s,top:c,right:s+a,bottom:c+o}}},WA=class{constructor(e){this._el=null,this._bgcolor=null,this._loader=new _A(e)}initialize(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(e,t){let n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){let n=this.render(e,t);return this._ready?this._ready.then(()=>n):Promise.resolve(n)}_load(e,t){var n=this,r=n._loader[e](t);if(!n._ready){let e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return r}sanitizeURL(e){return this._load(`sanitizeURL`,e)}loadImage(e){return this._load(`loadImage`,e)}},Sge=`keydown`,Cge=`keypress`,wge=`keyup`,GA=`dragenter`,KA=`dragleave`,qA=`dragover`,JA=`pointerdown`,Tge=`pointerup`,YA=`pointermove`,XA=`pointerout`,ZA=`pointerover`,QA=`mousedown`,Ege=`mouseup`,$A=`mousemove`,ej=`mouseout`,tj=`mouseover`,nj=`click`,rj=`dblclick`,ij=`wheel`,aj=`mousewheel`,oj=`touchstart`,sj=`touchmove`,cj=`touchend`,lj=[Sge,Cge,wge,GA,KA,qA,JA,Tge,YA,XA,ZA,QA,Ege,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj],uj=YA,dj=ej,fj=nj,pj=class extends UA{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=lj,this.pointermove=qme([YA,$A],[ZA,tj],[XA,ej]),this.dragover=qme([qA],[GA],[KA]),this.pointerout=Jme([XA,ej]),this.dragleave=Jme([KA])}initialize(e,t,n){return this._canvas=e&&Bk(e,`canvas`),[nj,QA,JA,YA,XA,KA].forEach(e=>Gme(this,e)),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext(`2d`)}DOMMouseScroll(e){this.fire(aj,e)}pointerdown(e){this._down=this._active,this.fire(JA,e)}mousedown(e){this._down=this._active,this.fire(QA,e)}click(e){this._down===this._active&&(this.fire(nj,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&=(this._active=this._touch,!1),this.fire(oj,e,!0)}touchmove(e){this.fire(sj,e,!0)}touchend(e){this.fire(cj,e,!0),this._touch=null}fire(e,t,n){let r=n?this._touch:this._active,i=this._handlers[e];if(t.vegaType=e,e===fj&&r&&r.href?this.handleHref(t,r,r.href):(e===uj||e===dj)&&this.handleTooltip(t,r,e!==dj),i)for(let e=0,n=i.length;e=0&&r.splice(i,1),this}pickEvent(e){let t=Uk(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,r,i){let a=this.context();return BA[e.marktype].pick.call(this,a,e,t,n,r,i)}},mj=e=>e===oj||e===sj||e===cj?[oj,sj,cj]:[e],hj=class extends WA{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new YO,this._tempb=new YO}initialize(e,t,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:VC(1,1,this._options.type),e&&this._canvas&&(Hk(e,0).appendChild(this._canvas),this._canvas.setAttribute(`class`,`marks`)),super.initialize(e,t,n,r,i)}resize(e,t,n,r){if(super.resize(e,t,n,r),this._canvas)Xme(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{let e=this._options.externalContext;e||V(`CanvasRenderer is missing a valid canvas or context`),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext(`2d`):null)}dirty(e){let t=this._tempb.clear().union(e.bounds),n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){let n=this.context(),r=this._origin,i=this._width,a=this._height,o=this._dirty,s=gj(r,i,a);n.save();let c=this._redraw||o.empty()?(this._redraw=!1,s.expand(1)):Zme(n,s.intersect(o),r);return this.clear(-r[0],-r[1],i,a),this.draw(n,e,c,t),n.restore(),o.clear(),this}draw(e,t,n,r){if(t.marktype!==`group`&&r!=null&&!r.includes(t.marktype))return;let i=BA[t.marktype];t.clip&&eme(e,t),i.draw.call(this,e,t,n,r),t.clip&&e.restore()}clear(e,t,n,r){let i=this._options,a=this.context();i.type!==`pdf`&&!i.externalContext&&a.clearRect(e,t,n,r),this._bgcolor!=null&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,r))}},gj=(e,t,n)=>new YO().set(0,0,t,n).translate(-e[0],-e[1]),_j=class extends UA{constructor(e,t){super(e,t);let n=this;n._hrefHandler=vj(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=vj(n,(e,t)=>{n.handleTooltip(e,t,e.type!==dj)})}initialize(e,t,n){let r=this._svg;return r&&(r.removeEventListener(fj,this._hrefHandler),r.removeEventListener(uj,this._tooltipHandler),r.removeEventListener(dj,this._tooltipHandler)),this._svg=r=e&&Bk(e,`svg`),r&&(r.addEventListener(fj,this._hrefHandler),r.addEventListener(uj,this._tooltipHandler),r.addEventListener(dj,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){let n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){let i={type:e,handler:t,listener:vj(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(e,t){let n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}},vj=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},yj=`aria-hidden`,bj=`aria-label`,xj=`role`,Sj=`aria-roledescription`,Cj=`graphics-object`,wj=`graphics-symbol`,Tj=(e,t,n)=>({[xj]:e,[Sj]:t,[bj]:n||void 0}),Ej=ug([`axis-domain`,`axis-grid`,`axis-label`,`axis-tick`,`axis-title`,`legend-band`,`legend-entry`,`legend-gradient`,`legend-label`,`legend-title`,`legend-symbol`,`title`]),Dj={axis:{desc:`axis`,caption:rhe},legend:{desc:`legend`,caption:ihe},"title-text":{desc:`title`,caption:e=>`Title text '${nhe(e)}'`},"title-subtitle":{desc:`subtitle`,caption:e=>`Subtitle text '${nhe(e)}'`}},Oj={ariaRole:xj,ariaRoleDescription:Sj,description:bj},kj=e=>(e+``).replace(/&/g,`&`).replace(//g,`>`),Aj=e=>kj(e).replace(/"/g,`"`).replace(/\t/g,` `).replace(/\n/g,` `).replace(/\r/g,` `),jj=e=>che(Gk(),e)+``,Mj={fill:`fill`,fillOpacity:`fill-opacity`,stroke:`stroke`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,strokeCap:`stroke-linecap`,strokeJoin:`stroke-linejoin`,strokeDash:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeMiterLimit:`stroke-miterlimit`,opacity:`opacity`},Nj={blend:`mix-blend-mode`},Pj={fill:`none`,"stroke-miterlimit":4},Fj=0,Ij=`http://www.w3.org/2000/xmlns/`,Lj=IA.xmlns,Rj=class extends WA{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,r,i){return this._defs={},this._clearDefs(),e&&(this._svg=Vk(e,0,`svg`,Lj),this._svg.setAttributeNS(Ij,`xmlns`,Lj),this._svg.setAttributeNS(Ij,`xmlns:xlink`,IA[`xmlns:xlink`]),this._svg.setAttribute(`version`,IA.version),this._svg.setAttribute(`class`,`marks`),Hk(e,1),this._root=Vk(this._svg,Fj,`g`,Lj),Jk(this._root,Pj),Hk(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,r,i)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty(`background-color`,e),super.background(...arguments)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svg&&(Jk(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute(`transform`,`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){let e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute(`style`),n=Vk(e,Fj,`rect`,Lj),Jk(n,{width:this._width,height:this._height,fill:t}));let r=jj(e);return t&&(e.removeChild(n),this._svg.style.setProperty(`background-color`,t)),r}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Hk(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;let e=this._dirty;if(!e.length||!this._dirtyID)return!0;let t=++this._dirtyID,n,r,i,a,o,s,c;for(o=0,s=e.length;o{e.dirty=t})),!r.zdirty){if(n.exit){a.nested&&r.items.length?(c=r.items[0],c._svg&&this._update(a,c._svg,c)):n._svg&&(c=n._svg.parentNode,c&&c.removeChild(n._svg)),n._svg=null;continue}n=a.nested?r.items[0]:n,n._update!==t&&(!n._svg||!n._svg.ownerSVGElement?(this._dirtyAll=!1,lhe(n,t)):this._update(a,n._svg,n),n._update=t)}return!this._dirtyAll}mark(e,t,n,r){if(!this.isDirty(t))return t._svg;let i=this._svg,a=t.marktype,o=BA[a],s=t.interactive===!1?`none`:null,c=o.tag===`g`,l=phe(t,e,n,`g`,i);if(a!==`group`&&r!=null&&!r.includes(a))return Hk(l,0),t._svg;l.setAttribute(`class`,Bme(t));let u=$me(t);for(let e in u)Yk(l,e,u[e]);c||Yk(l,`pointer-events`,s),Yk(l,`clip-path`,t.clip?JO(this,t,t.group):null);let d=null,f=0,p=e=>{let t=this.isDirty(e),n=phe(e,l,d,o.tag,i);t&&(this._update(o,n,e),c&&fhe(this,n,e,r)),d=n,++f};return o.nested?t.items.length&&p(t.items[0]):lk(t,p),Hk(l,f),l}_update(e,t,n){zj=t,Bj=t.__values__,Qme(Kk,n),e.attr(Kk,n,this);let r=Vj[e.type];r&&r.call(this,e,t,n),zj&&this.style(zj,n)}style(e,t){if(t!=null){for(let n in Mj){let r=n===`font`?Nk(t):t[n];if(r===Bj[n])continue;let i=Mj[n];r==null?e.removeAttribute(i):(IO(r)&&(r=LO(r,this._defs.gradient,ghe())),e.setAttribute(i,r+``)),Bj[n]=r}for(let n in Nj)qk(e,Nj[n],t[n])}}defs(){let e=this._svg,t=this._defs,n=t.el,r=0;for(let i in t.gradient)n||(t.el=n=Vk(e,1,`defs`,Lj)),r=uhe(n,t.gradient[i],r);for(let i in t.clipping)n||(t.el=n=Vk(e,1,`defs`,Lj)),r=dhe(n,t.clipping[i],r);n&&(r===0?(e.removeChild(n),t.el=null):Hk(n,r))}_clearDefs(){let e=this._defs;e.gradient={},e.clipping={}}},zj=null,Bj=null,Vj={group(e,t,n){let r=zj=t.childNodes[2];Bj=r.__values__,e.foreground(Kk,n,this),Bj=t.__values__,zj=t.childNodes[1],e.content(Kk,n,this);let i=zj=t.childNodes[0];e.background(Kk,n,this);let a=n.mark.interactive===!1?`none`:null;if(a!==Bj.events&&(Yk(r,`pointer-events`,a),Yk(i,`pointer-events`,a),Bj.events=a),n.strokeForeground&&n.stroke){let e=n.fill;Yk(r,`display`,null),this.style(i,n),Yk(i,`stroke`,null),e&&(n.fill=null),Bj=r.__values__,this.style(r,n),e&&(n.fill=e),zj=null}else Yk(r,`display`,`none`)},image(e,t,n){n.smooth===!1?(qk(t,`image-rendering`,`optimizeSpeed`),qk(t,`image-rendering`,`pixelated`)):qk(t,`image-rendering`,null)},text(e,t,n){let r=Ak(n),i,a,o,s;H(r)?(a=r.map(e=>Mk(n,e)),i=a.join(` -`),i!==Bj.text&&(Hk(t,0),o=t.ownerDocument,s=kk(n),a.forEach((e,r)=>{let i=zk(o,`tspan`,Lj);i.__data__=n,i.textContent=e,r&&(i.setAttribute(`x`,0),i.setAttribute(`dy`,s)),t.appendChild(i)}),Bj.text=i)):(a=Mk(n,r),a!==Bj.text&&(t.textContent=a,Bj.text=a)),Yk(t,`font-family`,Nk(n)),Yk(t,`font-size`,Ok(n)+`px`),Yk(t,`font-style`,n.fontStyle),Yk(t,`font-variant`,n.fontVariant),Yk(t,`font-weight`,n.fontWeight)}},Hj=class extends WA{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){let t=Gk();t.open(`svg`,Mh({},IA,{class:`marks`,width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!==`transparent`&&n!==`none`&&t.open(`rect`,{width:this._width,height:this._height,fill:n}).close(),t.open(`g`,Pj,{transform:`translate(`+this._origin+`)`}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+``,this}mark(e,t){let n=BA[t.marktype],r=n.tag,i=[Qme,n.attr];e.open(`g`,{class:Bme(t),"clip-path":t.clip?JO(this,t,t.group):null},$me(t),{"pointer-events":r!==`g`&&t.interactive===!1?`none`:null});let a=a=>{let o=this.href(a);if(o&&e.open(`a`,o),e.open(r,this.attr(t,a,i,r===`g`?null:r)),r===`text`){let t=Ak(a);if(H(t)){let n={x:0,dy:kk(a)};for(let r=0;rthis.mark(e,t)),e.close(),r&&o?(i&&(a.fill=null),a.stroke=o,e.open(`path`,this.attr(t,a,n.foreground,`bgrect`)).close(),i&&(a.fill=i)):e.open(`path`,this.attr(t,a,n.foreground,`bgfore`)).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&a(t.items[0]):lk(t,a),e.close()}href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e[`xlink:href`]=e.href,e.href=null,(this._hrefs||={})[t]=e})}return null}attr(e,t,n,r){let i={},a=(e,t,n,r)=>{i[r||e]=t};return Array.isArray(n)?n.forEach(e=>e(a,t,this)):n(a,t,this),r&&_he(i,t,e,r,this._defs),i}defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open(`defs`);for(let n in t){let r=t[n],i=r.stops;r.gradient===`radial`?(e.open(`pattern`,{id:$k+n,viewBox:`0,0,1,1`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid slice`}),e.open(`rect`,{width:`1`,height:`1`,fill:`url(#`+n+`)`}).close(),e.close(),e.open(`radialGradient`,{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open(`linearGradient`,{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t!Uj.svgMarkTypes.includes(e));this._svgRenderer.render(e,Uj.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svgRenderer.resize(e,t,n,r),this._canvasRenderer.resize(e,t,n,r),this}background(e){return Uj.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}},Gj=class extends pj{constructor(e,t){super(e,t)}initialize(e,t,n){let r=Vk(Vk(e,0,`div`),+!Uj.svgOnTop,`div`);return super.initialize(r,t,n)}},Kj=`canvas`,qj=`hybrid`,Jj=`png`,Yj=`svg`,Xj=`none`,Zj={Canvas:Kj,PNG:Jj,SVG:Yj,Hybrid:qj,None:Xj},Qj={},Qj[Kj]=Qj[Jj]={renderer:hj,headless:hj,handler:pj},Qj[Yj]={renderer:Rj,headless:Hj,handler:_j},Qj[qj]={renderer:Wj,headless:Wj,handler:Gj},Qj[Xj]={},$j=new YO,eM=1e-9})),Dge=c({bound:()=>nM,identifier:()=>iM,mark:()=>aM,overlap:()=>oM,render:()=>sM,viewlayout:()=>_M});function nM(e){G.call(this,null,e)}function rM(e,t,n){return t(e.bounds.clear(),e,n)}function iM(e){G.call(this,0,e)}function Oge(e){return e._signals[nN]||(e._signals[nN]=e.add(0))}function aM(e){G.call(this,null,e)}function kge(e){let t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function oM(e){G.call(this,null,e)}function sM(e){G.call(this,null,e)}function cM(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Age(e){var t=e.items[0].orient;return t===yM||t===bM}function jge(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function Mge(e,t,n,r){var i=t.items[0],a=i.datum,o=i.translate==null?.5:i.translate,s=i.orient,c=jge(a),l=i.range,u=i.offset,d=i.position,f=i.minExtent,p=i.maxExtent,m=a.title&&i.items[c[2]].items[0],h=i.titlePadding,g=i.bounds,_=m&&jk(m),v=0,y=0,b,x;switch(uN.clear().union(g),g.clear(),(b=c[0])>-1&&g.union(i.items[b].bounds),(b=c[1])>-1&&g.union(i.items[b].bounds),s){case vM:v=d||0,y=-u,x=Math.max(f,Math.min(p,-g.y1)),g.add(0,-x).add(l,0),m&&lM(e,m,x,h,_,0,-1,g);break;case yM:v=-u,y=d||0,x=Math.max(f,Math.min(p,-g.x1)),g.add(-x,0).add(0,l),m&&lM(e,m,x,h,_,1,-1,g);break;case bM:v=n+u,y=d||0,x=Math.max(f,Math.min(p,g.x2)),g.add(0,0).add(x,l),m&&lM(e,m,x,h,_,1,1,g);break;case xM:v=d||0,y=r+u,x=Math.max(f,Math.min(p,g.y2)),g.add(0,0).add(l,x),m&&lM(e,m,x,h,0,0,1,g);break;default:v=i.x,y=i.y}return $O(g.translate(v,y),i),cM(i,`x`,v+o)|cM(i,`y`,y+o)&&(i.bounds=uN,e.dirty(i),i.bounds=g,e.dirty(i)),i.mark.bounds.clear().union(g)}function lM(e,t,n,r,i,a,o,s){let c=t.bounds;if(t.auto){let s=o*(n+i+r),l=0,u=0;e.dirty(t),a?l=(t.x||0)-(t.x=s):u=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(c.translate(-l,-u)),e.dirty(t)}s.union(c)}function Nge(e){var t=e.items,n=t.length,r=0,i,a;let o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r1)for(C=0;C0&&(y[C]+=A/2);if(s&&uM(n.center,tN)&&u!==1)for(C=0;C0&&(b[C]+=j/2);for(C=0;Ci&&(e.warn(`Grid headers exceed limit: `+i),t=t.slice(0,i)),h+=a,v=0,b=t.length;v=0&&(C=n[y])==null;y-=f);s?(w=p==null?C.x:Math.round(C.bounds.x1+p*C.bounds.width()),T=h):(w=h,T=p==null?C.y:Math.round(C.bounds.y1+p*C.bounds.height())),x.union(S.bounds.translate(w-(S.x||0),T-(S.y||0))),S.x=w,S.y=T,e.dirty(S),g=o(g,x[l])}return g}function mM(e,t,n,r,i,a){if(t){e.dirty(t);var o=n,s=n;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),t.bounds.translate(o-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=s,e.dirty(t)}}function zge(e,t){let n=e[t]||{};return(t,r)=>n[t]==null?e[t]==null?r:e[t]:n[t]}function Bge(e,t){let n=-1/0;return e.forEach(e=>{e.offset!=null&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}function Vge(e,t,n,r,i,a,o){let s=zge(n,t),c=Bge(e,s(`offset`,0)),l=s(`anchor`,EM),u=s(`frame`,jM),d=l===OM?1:l===DM?.5:0,f=u===MM?r.x1+d*r.width():d*(a||i.width()+2*i.x1),p=u===MM?i.y1+d*i.height():d*(o||r.height()+2*r.y1),m={align:QM,bounds:s(`bounds`,$M),columns:s(`direction`)===`vertical`?1:e.length,padding:s(`margin`,8),center:s(`center`),nodirty:!0};switch(t){case yM:m.anchor={x:Math.floor(r.x1)-c,column:OM,y:p,row:l};break;case bM:m.anchor={x:Math.ceil(r.x2)+c,y:p,row:l};break;case vM:m.anchor={y:Math.floor(i.y1)-c,row:OM,x:f,column:l};break;case xM:m.anchor={y:Math.ceil(i.y2)+c,x:f,column:l};break;case SM:m.anchor={x:c,y:c};break;case CM:m.anchor={x:a-c,y:c,column:OM};break;case wM:m.anchor={x:c,y:o-c,row:OM};break;case TM:m.anchor={x:a-c,y:o-c,column:OM,row:OM};break}return m}function Hge(e,t){var n=t.items[0],r=n.datum,i=n.orient,a=n.bounds,o=n.x,s=n.y,c,l;return n._bounds?n._bounds.clear().union(a):n._bounds=a.clone(),a.clear(),Wge(e,n,n.items[0].items[0]),a=Uge(n,a),c=2*n.padding,l=2*n.padding,a.empty()||(c=Math.ceil(a.width()+c),l=Math.ceil(a.height()+l)),r.type===GM&&Gge(n.items[0].items[0].items[0].items),i!==XM&&(n.x=o=0,n.y=s=0),n.width=c,n.height=l,$O(a.set(o,s,o+c,s+l),n),n.mark.bounds.clear().union(a),n}function Uge(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.empty()&&(t.x2=e.padding,t.y2=e.padding),t.x1=e.padding,t.y1=e.padding,t}function Wge(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(!t.datum.title)(i||a)&&gM(e,n,i,a);else{var o=t.items[1].items[0],s=o.anchor,c=t.titlePadding||0,l=r-o.x,u=r-o.y;switch(o.orient){case yM:i+=Math.ceil(o.bounds.width())+c;break;case bM:case xM:break;default:a+=o.bounds.height()+c}switch((i||a)&&gM(e,n,i,a),o.orient){case yM:u+=hM(t,n,o,s,1,1);break;case bM:l+=hM(t,n,o,OM,0,0)+c,u+=hM(t,n,o,s,1,1);break;case xM:l+=hM(t,n,o,s,0,0),u+=hM(t,n,o,OM,-1,0,1)+c;break;default:l+=hM(t,n,o,s,0,0)}(l||u)&&gM(e,o,l,u),(l=Math.round(o.bounds.x1-r))<0&&(gM(e,n,-l,0),gM(e,o,-l,0))}}function hM(e,t,n,r,i,a,o){let s=e.datum.type!==`symbol`,c=n.datum.vgrad,l=(s&&(a||!c)&&!o?t.items[0]:t).bounds[i?`y2`:`x2`]-e.padding,u=c&&a?l:0,d=c&&a?0:l,f=i<=0?0:jk(n);return Math.round(r===EM?u:r===OM?d-f:.5*(l-f))}function gM(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function Gge(e){let t=e.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{});e.forEach(e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y})}function Kge(e,t,n,r,i){var a=t.items[0],o=a.frame,s=a.orient,c=a.anchor,l=a.offset,u=a.padding,d=a.items[0].items[0],f=a.items[1]&&a.items[1].items[0],p=s===yM||s===bM?r:n,m=0,h=0,g=0,_=0,v=0,y;if(o===jM?s===yM&&(m=r,p=0):s===yM?(m=i.y2,p=i.y1):s===bM?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2),y=c===EM?m:c===OM?p:(m+p)/2,f&&f.text){switch(s){case vM:case xM:v=d.bounds.height()+u;break;case yM:_=d.bounds.width()+u;break;case bM:_=-d.bounds.width()-u;break}uN.clear().union(f.bounds),uN.translate(_-(f.x||0),v-(f.y||0)),cM(f,`x`,_)|cM(f,`y`,v)&&(e.dirty(f),f.bounds.clear().union(uN),f.mark.bounds.clear().union(uN),e.dirty(f)),uN.clear().union(f.bounds)}else uN.clear();switch(uN.union(d.bounds),s){case vM:h=y,g=i.y1-uN.height()-l;break;case yM:h=i.x1-uN.width()-l,g=y;break;case bM:h=i.x2+uN.width()+l,g=y;break;case xM:h=y,g=i.y2+l;break;default:h=a.x,g=a.y}return cM(a,`x`,h)|cM(a,`y`,g)&&(uN.translate(h,g),e.dirty(a),a.bounds.clear().union(uN),t.bounds.clear().union(uN),e.dirty(a)),a.bounds}function _M(e){G.call(this,null,e)}function qge(e){return e&&e.mark.role!==`legend-entry`}function Jge(e,t,n){var r=t.items,i=Math.max(0,t.width||0),a=Math.max(0,t.height||0),o=new YO().set(0,0,i,a),s=o.clone(),c=o.clone(),l=[],u,d,f,p,m,h;for(m=0,h=r.length;m{f=e.orient||bM,f!==XM&&(t[f]||(t[f]=[])).push(e)});for(let r in t){let o=t[r];fM(e,o,Vge(o,r,n.legends,s,c,i,a))}l.forEach(t=>{let r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&(n.autosize.type===KM||n.autosize.type===qM||n.autosize.type===JM))switch(t.orient){case yM:case bM:o.add(r.x1,0).add(r.x2,0);break;case vM:case xM:o.add(0,r.y1).add(0,r.y2)}else o.union(r)})}o.union(s).union(c),u&&o.union(Kge(e,u,i,a,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),Yge(e,t,o,n)}function Yge(e,t,n,r){let i=r.autosize||{},a=i.type;if(e._autosize<1||!a)return;let o=e._width,s=e._height,c=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),u=Math.max(0,t.height||0),d=Math.max(0,Math.ceil(-n.y1)),f=Math.max(0,Math.ceil(n.x2-c)),p=Math.max(0,Math.ceil(n.y2-u));if(i.contains===WM){let t=e.padding();o-=t.left+t.right,s-=t.top+t.bottom}a===XM?(l=0,d=0,c=o,u=s):a===KM?(c=Math.max(0,o-l-f),u=Math.max(0,s-d-p)):a===qM?(c=Math.max(0,o-l-f),s=u+d+p):a===JM?(o=c+l+f,u=Math.max(0,s-d-p)):a===YM&&(o=c+l+f,s=u+d+p),e._resizeView(o,s,c,u,[l,d],i.resize)}var vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,Xge=o((()=>{ax(),tM(),pg(),vM=`top`,yM=`left`,bM=`right`,xM=`bottom`,SM=`top-left`,CM=`top-right`,wM=`bottom-left`,TM=`bottom-right`,EM=`start`,DM=`middle`,OM=`end`,kM=`x`,AM=`y`,jM=`group`,MM=`bounds`,NM=`axis`,PM=`title`,FM=`frame`,IM=`scope`,LM=`legend`,RM=`row-header`,zM=`row-footer`,BM=`row-title`,VM=`column-header`,HM=`column-footer`,UM=`column-title`,WM=`padding`,GM=`symbol`,KM=`fit`,qM=`fit-x`,JM=`fit-y`,YM=`pad`,XM=`none`,ZM=`all`,QM=`each`,$M=`flush`,eN=`column`,tN=`row`,U(nM,G,{transform(e,t){let n=t.dataflow,r=e.mark,i=r.marktype,a=BA[i],o=a.bound,s=r.bounds,c;if(a.nested)r.items.length&&n.dirty(r.items[0]),s=rM(r,o),r.items.forEach(e=>{e.bounds.clear().union(s)});else if(i===jM||e.modified())switch(t.visit(t.MOD,e=>n.dirty(e)),s.clear(),r.items.forEach(e=>s.union(rM(e,o))),r.role){case NM:case LM:case PM:t.reflow()}else c=t.changed(t.REM),t.visit(t.ADD,e=>{s.union(rM(e,o))}),t.visit(t.MOD,e=>{c||=s.alignsWith(e.bounds),n.dirty(e),s.union(rM(e,o))}),c&&(s.clear(),r.items.forEach(e=>s.union(e.bounds)));return whe(r),t.modifies(`bounds`)}}),nN=`:vega_identifier:`,iM.Definition={type:`Identifier`,metadata:{modifies:!0},params:[{name:`as`,type:`string`,required:!0}]},U(iM,G,{transform(e,t){let n=Oge(t.dataflow),r=e.as,i=n.value;return t.visit(t.ADD,e=>e[r]=e[r]||++i),n.set(this.value=i),t}}),U(aM,G,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,kge(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let r=n.marktype===jM?ZO:XO;return t.visit(t.ADD,e=>r.call(e,n)),(e.modified(`clip`)||e.modified(`interactive`))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}}),rN={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((e,r)=>!r||!iN(n.bounds,e.bounds,t)?(n=e,1):e.opacity=0)}},iN=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),aN=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,a;n{let t=e.bounds;return t.width()>1&&t.height()>1},sN=(e,t,n)=>{var r=e.range(),i=new YO;return t===vM||t===xM?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),e=>i.encloses(e.bounds)},cN=e=>(e.forEach(e=>e.opacity=1),e),lN=(e,t)=>e.reflow(t.modified()).modifies(`opacity`),U(oM,G,{transform(e,t){let n=rN[e.method]||rN.parity,r=e.separation||0,i=t.materialize(t.SOURCE).source,a,o;if(!i||!i.length)return;if(!e.method)return e.modified(`method`)&&(cN(i),t=lN(t,e)),t;if(i=i.filter(oN),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),a=cN(i),t=lN(t,e),a.length>=3&&aN(a,r)){do a=n(a,r);while(a.length>=3&&aN(a,r));a.length<3&&!Ym(i).opacity&&(a.length>1&&(Ym(a).opacity=0),Ym(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=sN(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(e=>{o(e)||(e.opacity=0)}));let s=a[0].mark.bounds.clear();return i.forEach(e=>{e.opacity&&s.union(e.bounds)}),t}}),U(sM,G,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){let e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}}),uN=new YO,dN=(e,t)=>Math.floor(Math.min(e,t)),fN=(e,t)=>Math.ceil(Math.max(e,t)),U(_M,G,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&Ige(n,t,e.layout),Jge(n,t,e)}),qge(e.mark.group)?t.reflow():t}})})),Zge=c({axisticks:()=>pN,datajoin:()=>mN,encode:()=>hN,legendentries:()=>gN,linkpath:()=>_N,pie:()=>vN,scale:()=>bN,sortitems:()=>wN,stack:()=>TN});function pN(e){G.call(this,null,e)}function mN(e){G.call(this,null,e)}function Qge(){return Ab({})}function $ge(e){let t=Rh().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}function hN(e){G.call(this,null,e)}function gN(e){G.call(this,[],e)}function _N(e){G.call(this,{},e)}function vN(e){G.call(this,null,e)}function e_e(e){let t=e.type;return!e.bins&&(t===`linear`||t===`pow`||t===`sqrt`)}function yN(e){return OD(e)&&e!==`sequential`}function bN(e){G.call(this,null,e),this.modified(!0)}function t_e(e){var t=e.type,n=``,r;return t===`sequential`?nO+`-`+QD:(n_e(e)&&(r=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=r===2?nO+`-`:r===3?rO+`-`:``),(n+t||`linear`).toLowerCase())}function n_e(e){let t=e.type;return OD(t)&&t!==`time`&&t!==`utc`&&(e.scheme||e.range&&e.range.length&&e.range.every(Yh))}function r_e(e,t,n){let r=i_e(e,t.domainRaw,n);if(r>-1)return r;var i=t.domain,a=e.type,o=t.zero||t.zero===void 0&&e_e(e),s,c;if(!i)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(s=(i=i.slice()).length-1||1,o&&(i[0]>0&&(i[0]=0),i[s]<0&&(i[s]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[s]=t.domainMax),t.domainMid!=null)){c=t.domainMid;let e=c>i[s]?s+1:ce+(t<0?-1:+(t>0)),0))!==t.length&&n.warn(`Log scale domain includes zero: `+W(t)),t}function o_e(e,t,n){let r=t.bins;if(r&&!H(r)){let t=e.domain(),n=t[0],i=Ym(t),a=r.step,o=r.start==null?n:r.start,s=r.stop==null?i:r.stop;a||V(`Scale bins parameter missing step property.`),oi&&(s=a*Math.floor(i/a)),r=m_(o,s+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===`bin-ordinal`&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function s_e(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(t.rangeStep!=null)a=c_e(r,t,n);else if(t.scheme&&(a=l_e(r,t,n),Sh(a))){if(e.interpolator)return e.interpolator(a);V(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&ND(r))return e.interpolator(ID(CN(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(zD(t.interpolate,t.interpolateGamma)):Sh(e.round)?e.round(i):Sh(e.rangeRound)&&e.interpolate(i?WT:HT),a&&e.range(CN(a,t.reverse))}function c_e(e,t,n){e!==`band`&&e!==`point`&&V(`Only band and point scales support rangeStep.`);var r=(t.paddingOuter==null?t.padding:t.paddingOuter)||0,i=e===`point`?1:(t.paddingInner==null?t.padding:t.paddingInner)||0;return[0,t.rangeStep*yD(n,i,r)]}function l_e(e,t,n){var r=t.schemeExtent,i,a;return H(t.scheme)?a=ID(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),a=HD(i),a||V(`Unrecognized scheme name: ${t.scheme}`)),n=e===`threshold`?n+1:e===`bin-ordinal`?n-1:e===`quantile`||e===`quantize`?+t.schemeCount||UN:n,ND(e)?SN(a,r,t.reverse):Sh(a)?LD(SN(a,r),n):e===`ordinal`?a:a.slice(0,n)}function SN(e,t,n){return Sh(e)&&(t||n)?FD(e,CN(t||[0,1],n)):e}function CN(e,t){return t?e.slice().reverse():e}function wN(e){G.call(this,null,e)}function TN(e){G.call(this,null,e)}function u_e(e,t,n,r,i){for(var a=(t-e.sum)/2,o=e.length,s=0,c;se(u),o,s,c,l,u,d,f,p,m;if(t==null)i.push(e.slice());else for(o={},s=0,c=e.length;sm&&(m=p),n&&f.sort(n)}return i.max=m,i}var EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,m_e=o((()=>{ax(),FO(),pg(),g_(),dE(),U(pN,G,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.scale,o=UD(a,e.count==null?e.values?e.values.length:10:e.count,e.minstep),s=e.format||KD(n,a,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?WD(a,e.values,o):GD(a,o);return i&&(r.rem=i),i=c.map((e,t)=>Ab({index:t/(c.length-1||1),tickIndex:t,value:e,label:s(e)})),e.extra&&i.length&&i.push(Ab({index:-1,tickIndex:-1,extra:{value:i[0].value},label:``})),r.source=i,r.add=i,this.value=i,r}}),U(mN,G,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||Qge,a=e.key||kb,o=this.value;return H(r.encode)&&(r.encode=null),o&&(e.modified(`key`)||t.modified(a))&&V(`DataJoin does not support modified key function or fields.`),o||(t=t.addAll(),this.value=o=$ge(a)),t.visit(t.ADD,e=>{let t=a(e),n=o.get(t);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(e),o.set(t,n),r.add.push(n)),n.datum=e,n.exit=!1}),t.visit(t.MOD,e=>{let t=a(e),n=o.get(t);n&&(n.datum=e,r.mod.push(n))}),t.visit(t.REM,e=>{let t=a(e),n=o.get(t);e===n.datum&&!n.exit&&(r.rem.push(n),n.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&r.modifies(`datum`),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r}}),U(hN,G,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(H(a))if(n.changed()||a.every(e=>i[e]))a=a[0],n.encode=null;else return t.StopPropagation;var o=a===`enter`,s=i.update||Bm,c=i.enter||Bm,l=i.exit||Bm,u=(a&&!o?i[a]:s)||Bm;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{c(t,e),s(t,e)}),n.modifies(c.output),n.modifies(s.output),u!==Bm&&u!==s&&(t.visit(t.ADD,t=>{u(t,e)}),n.modifies(u.output))),t.changed(t.REM)&&l!==Bm&&(t.visit(t.REM,t=>{l(t,e)}),n.modifies(l.output)),o||u!==Bm){let i=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(i,t=>{let i=c(t,e)||r;(u(t,e)||i)&&n.mod.push(t)}),n.mod.length&&n.modifies(c.output)):t.visit(i,t=>{(u(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(u.output)}return n.changed()?n:t.StopPropagation}}),U(gN,G,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.type||`symbol`,o=e.scale,s=+e.limit,c=UD(o,e.count==null?5:e.count,e.minstep),l=!!e.values||a===`symbol`,u=e.format||YD(n,o,c,a,e.formatSpecifier,e.formatType,l),d=e.values||JD(o,c),f,p,m,h,g;return i&&(r.rem=i),a===`symbol`?(s&&d.length>s?(t.dataflow.warn(`Symbol legend count exceeds limit, filtering items.`),i=d.slice(0,s-1),g=!0):i=d,Sh(m=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),h=i.reduce((t,n)=>Math.max(t,m(n,e)),0)):m=Ah(h=m||8),i=i.map((t,n)=>Ab({index:n,label:u(t,n,i),value:t,offset:h,size:m(t,e)})),g&&(g=d[i.length],i.push(Ab({index:i.length,label:`\u2026${d.length-i.length} entries`,value:g,offset:h,size:m(g,e)})))):a===`gradient`?(f=o.domain(),p=RD(o,f[0],Ym(f)),d.length<3&&!e.values&&f[0]!==Ym(f)&&(d=[f[0],Ym(f)]),i=d.map((e,t)=>Ab({index:t,label:u(e,t,d),value:e,perc:p(e)}))):(m=d.length-1,p=fpe(o),i=d.map((e,t)=>Ab({index:t,label:u(e,t,d),value:e,perc:t?p(e):0,perc2:t===m?1:p(d[t+1])}))),r.source=i,r.add=i,this.value=i,r}}),EN=e=>e.source.x,DN=e=>e.source.y,ON=e=>e.target.x,kN=e=>e.target.y,_N.Definition={type:`LinkPath`,metadata:{modifies:!0},params:[{name:`sourceX`,type:`field`,default:`source.x`},{name:`sourceY`,type:`field`,default:`source.y`},{name:`targetX`,type:`field`,default:`target.x`},{name:`targetY`,type:`field`,default:`target.y`},{name:`orient`,type:`enum`,default:`vertical`,values:[`horizontal`,`vertical`,`radial`]},{name:`shape`,type:`enum`,default:`line`,values:[`line`,`arc`,`curve`,`diagonal`,`orthogonal`]},{name:`require`,type:`signal`},{name:`as`,type:`string`,default:`path`}]},U(_N,G,{transform(e,t){var n=e.sourceX||EN,r=e.sourceY||DN,i=e.targetX||ON,a=e.targetY||kN,o=e.as||`path`,s=e.orient||`vertical`,c=e.shape||`line`,l=HN.get(c+`-`+s)||HN.get(c);return l||V(`LinkPath unsupported type: `+e.shape+(e.orient?`-`+e.orient:``)),t.visit(t.SOURCE,e=>{e[o]=l(n(e),r(e),i(e),a(e))}),t.reflow(e.modified()).modifies(o)}}),AN=(e,t,n,r)=>`M`+e+`,`+t+`L`+n+`,`+r,jN=(e,t,n,r)=>AN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),MN=(e,t,n,r)=>{var i=n-e,a=r-t,o=Math.hypot(i,a)/2,s=180*Math.atan2(a,i)/Math.PI;return`M`+e+`,`+t+`A`+o+`,`+o+` `+s+` 0 1 `+n+`,`+r},NN=(e,t,n,r)=>MN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),PN=(e,t,n,r)=>{let i=n-e,a=r-t,o=.2*(i+a),s=.2*(a-i);return`M`+e+`,`+t+`C`+(e+o)+`,`+(t+s)+` `+(n+s)+`,`+(r-o)+` `+n+`,`+r},FN=(e,t,n,r)=>PN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),IN=(e,t,n,r)=>`M`+e+`,`+t+`V`+r+`H`+n,LN=(e,t,n,r)=>`M`+e+`,`+t+`H`+n+`V`+r,RN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=Math.abs(n-e)>Math.PI?n<=e:n>e;return`M`+t*i+`,`+t*a+`A`+t+`,`+t+` 0 0,`+ +!!c+` `+t*o+`,`+t*s+`L`+r*o+`,`+r*s},zN=(e,t,n,r)=>{let i=(e+n)/2;return`M`+e+`,`+t+`C`+i+`,`+t+` `+i+`,`+r+` `+n+`,`+r},BN=(e,t,n,r)=>{let i=(t+r)/2;return`M`+e+`,`+t+`C`+e+`,`+i+` `+n+`,`+i+` `+n+`,`+r},VN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=(t+r)/2;return`M`+t*i+`,`+t*a+`C`+c*i+`,`+c*a+` `+c*o+`,`+c*s+` `+r*o+`,`+r*s},HN=Rh({line:AN,"line-radial":jN,arc:MN,"arc-radial":NN,curve:PN,"curve-radial":FN,"orthogonal-horizontal":IN,"orthogonal-vertical":LN,"orthogonal-radial":RN,"diagonal-horizontal":zN,"diagonal-vertical":BN,"diagonal-radial":VN}),vN.Definition={type:`Pie`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`startAngle`,type:`number`,default:0},{name:`endAngle`,type:`number`,default:6.283185307179586},{name:`sort`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0,length:2,default:[`startAngle`,`endAngle`]}]},U(vN,G,{transform(e,t){var n=e.as||[`startAngle`,`endAngle`],r=n[0],i=n[1],a=e.field||Rm,o=e.startAngle||0,s=e.endAngle==null?2*Math.PI:e.endAngle,c=t.source,l=c.map(a),u=l.length,d=o,f=(s-o)/h_(l),p=m_(u),m,h,g;for(e.sort&&p.sort((e,t)=>l[e]-l[t]),m=0;m1?0:e<-1?QN:Math.acos(e)}function XN(e){return e>1?$N:e<-1?-$N:Math.asin(e)}var ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P=o((()=>{ZN=1e-6,QN=Math.PI,$N=QN/2,eP=QN/4,tP=QN*2,nP=180/QN,rP=QN/180,iP=Math.abs,aP=Math.atan,oP=Math.atan2,sP=Math.cos,cP=Math.ceil,lP=Math.exp,uP=Math.hypot,dP=Math.log,fP=Math.pow,pP=Math.sin,mP=Math.sign||function(e){return e>0?1:e<0?-1:0},hP=Math.sqrt,gP=Math.tan}));function vP(){}var yP=o((()=>{}));function bP(e,t){e&&TP.hasOwnProperty(e.type)&&TP[e.type](e,t)}function xP(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r{wP={Feature:function(e,t){bP(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=sP(t),o=pP(t),s=PP*o,c=NP*a+s*sP(i),l=s*r*pP(i);OP.add(oP(l,c)),MP=e,NP=a,PP=o}function v_e(e){return kP=new zg,CP(e,FP),kP*2}var OP,kP,AP,jP,MP,NP,PP,FP,IP=o((()=>{g_(),_P(),yP(),EP(),OP=new zg,kP=new zg,FP={point:vP,lineStart:vP,lineEnd:vP,polygonStart:function(){OP=new zg,FP.lineStart=h_e,FP.lineEnd=g_e},polygonEnd:function(){var e=+OP;kP.add(e<0?tP+e:e),this.lineStart=this.lineEnd=this.point=vP},sphere:function(){kP.add(tP)}}}));function LP(e){return[oP(e[1],e[0]),XN(e[2])]}function RP(e){var t=e[0],n=e[1],r=sP(n);return[r*sP(t),r*pP(t),pP(n)]}function zP(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function BP(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function VP(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function HP(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function UP(e){var t=hP(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var WP=o((()=>{_P()}));function GP(e,t){sF.push(cF=[QP=e,eF=e]),t<$P&&($P=t),t>tF&&(tF=t)}function KP(e,t){var n=RP([e*rP,t*rP]);if(aF){var r=BP(aF,n),i=BP([r[1],-r[0],0],r);UP(i),i=LP(i);var a=e-nF,o=a>0?1:-1,s=i[0]*nP*o,c,l=iP(a)>180;l^(o*nFtF&&(tF=c)):(s=(s+360)%360-180,l^(o*nFtF&&(tF=t))),l?eXP(QP,eF)&&(eF=e):XP(e,eF)>XP(QP,eF)&&(QP=e):eF>=QP?(eeF&&(eF=e)):e>nF?XP(QP,e)>XP(QP,eF)&&(eF=e):XP(e,eF)>XP(QP,eF)&&(QP=e)}else sF.push(cF=[QP=e,eF=e]);t<$P&&($P=t),t>tF&&(tF=t),aF=n,nF=e}function qP(){lF.point=KP}function JP(){cF[0]=QP,cF[1]=eF,lF.point=GP,aF=null}function YP(e,t){if(aF){var n=e-nF;oF.add(iP(n)>180?n+(n>0?360:-360):n)}else rF=e,iF=t;FP.point(e,t),KP(e,t)}function y_e(){FP.lineStart()}function b_e(){YP(rF,iF),FP.lineEnd(),iP(oF)>1e-6&&(QP=-(eF=180)),cF[0]=QP,cF[1]=eF,aF=null}function XP(e,t){return(t-=e)<0?t+360:t}function x_e(e,t){return e[0]-t[0]}function ZP(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tXP(r[0],r[1])&&(r[1]=i[1]),XP(i[0],r[1])>XP(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=a.length-1,t=0,r=a[n];t<=n;r=i,++t)i=a[t],(s=XP(r[1],i[0]))>o&&(o=s,QP=i[0],eF=r[1])}return sF=cF=null,QP===1/0||$P===1/0?[[NaN,NaN],[NaN,NaN]]:[[QP,$P],[eF,tF]]}var QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,C_e=o((()=>{g_(),IP(),WP(),_P(),EP(),lF={point:GP,lineStart:qP,lineEnd:JP,polygonStart:function(){lF.point=YP,lF.lineStart=y_e,lF.lineEnd=b_e,oF=new zg,FP.polygonStart()},polygonEnd:function(){FP.polygonEnd(),lF.point=GP,lF.lineStart=qP,lF.lineEnd=JP,OP<0?(QP=-(eF=180),$P=-(tF=90)):oF>1e-6?tF=90:oF<-1e-6&&($P=-90),cF[0]=QP,cF[1]=eF},sphere:function(){QP=-(eF=180),$P=-(tF=90)}}}));function uF(e,t){e*=rP,t*=rP;var n=sP(t);dF(n*sP(e),n*pP(e),pP(t))}function dF(e,t,n){++hF,_F+=(e-_F)/hF,vF+=(t-vF)/hF,yF+=(n-yF)/hF}function fF(){jF.point=w_e}function w_e(e,t){e*=rP,t*=rP;var n=sP(t);OF=n*sP(e),kF=n*pP(e),AF=pP(t),jF.point=T_e,dF(OF,kF,AF)}function T_e(e,t){e*=rP,t*=rP;var n=sP(t),r=n*sP(e),i=n*pP(e),a=pP(t),o=oP(hP((o=kF*a-AF*i)*o+(o=AF*r-OF*a)*o+(o=OF*i-kF*r)*o),OF*r+kF*i+AF*a);gF+=o,bF+=o*(OF+(OF=r)),xF+=o*(kF+(kF=i)),SF+=o*(AF+(AF=a)),dF(OF,kF,AF)}function pF(){jF.point=uF}function E_e(){jF.point=O_e}function D_e(){mF(EF,DF),jF.point=uF}function O_e(e,t){EF=e,DF=t,e*=rP,t*=rP,jF.point=mF;var n=sP(t);OF=n*sP(e),kF=n*pP(e),AF=pP(t),dF(OF,kF,AF)}function mF(e,t){e*=rP,t*=rP;var n=sP(t),r=n*sP(e),i=n*pP(e),a=pP(t),o=kF*a-AF*i,s=AF*r-OF*a,c=OF*i-kF*r,l=uP(o,s,c),u=XN(l),d=l&&-u/l;CF.add(d*o),wF.add(d*s),TF.add(d*c),gF+=u,bF+=u*(OF+(OF=r)),xF+=u*(kF+(kF=i)),SF+=u*(AF+(AF=a)),dF(OF,kF,AF)}function k_e(e){hF=gF=_F=vF=yF=bF=xF=SF=0,CF=new zg,wF=new zg,TF=new zg,CP(e,jF);var t=+CF,n=+wF,r=+TF,i=uP(t,n,r);return i<1e-12&&(t=bF,n=xF,r=SF,gF<1e-6&&(t=_F,n=vF,r=yF),i=uP(t,n,r),i<1e-12)?[NaN,NaN]:[oP(n,t)*nP,XN(r/i)*nP]}var hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,A_e=o((()=>{g_(),_P(),yP(),EP(),jF={sphere:vP,point:uF,lineStart:fF,lineEnd:pF,polygonStart:function(){jF.lineStart=E_e,jF.lineEnd=D_e},polygonEnd:function(){jF.lineStart=fF,jF.lineEnd=pF}}}));function MF(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}var NF=o((()=>{}));function PF(e,t){return iP(e)>QN&&(e-=Math.round(e/tP)*tP),[e,t]}function FF(e,t,n){return(e%=tP)?t||n?MF(LF(e),RF(t,n)):LF(e):t||n?RF(t,n):PF}function IF(e){return function(t,n){return t+=e,iP(t)>QN&&(t-=Math.round(t/tP)*tP),[t,n]}}function LF(e){var t=IF(e);return t.invert=IF(-e),t}function RF(e,t){var n=sP(e),r=pP(e),i=sP(t),a=pP(t);function o(e,t){var o=sP(t),s=sP(e)*o,c=pP(e)*o,l=pP(t),u=l*n+s*r;return[oP(c*i-u*a,s*n-l*r),XN(u*i+c*a)]}return o.invert=function(e,t){var o=sP(t),s=sP(e)*o,c=pP(e)*o,l=pP(t),u=l*i-c*a;return[oP(c*i+l*a,s*n+u*r),XN(u*n-s*r)]},o}function j_e(e){e=FF(e[0]*rP,e[1]*rP,e.length>2?e[2]*rP:0);function t(t){return t=e(t[0]*rP,t[1]*rP),t[0]*=nP,t[1]*=nP,t}return t.invert=function(t){return t=e.invert(t[0]*rP,t[1]*rP),t[0]*=nP,t[1]*=nP,t},t}var zF=o((()=>{NF(),_P(),PF.invert=PF}));function M_e(e,t,n,r,i,a){if(n){var o=sP(t),s=pP(t),c=r*n;i==null?(i=t+r*tP,a=t-c/2):(i=BF(o,i),a=BF(o,a),(r>0?ia)&&(i+=r*tP));for(var l,u=i;r>0?u>a:u{WP(),_P()}));function HF(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:vP,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}var UF=o((()=>{yP()}));function WF(e,t){return iP(e[0]-t[0])<1e-6&&iP(e[1]-t[1])<1e-6}var GF=o((()=>{_P()}));function KF(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function qF(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(WF(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function JF(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n{GF(),_P()}));function XF(e){return iP(e[0])<=QN?e[0]:mP(e[0])*((iP(e[0])+QN)%tP-QN)}function N_e(e,t){var n=XF(t),r=t[1],i=pP(r),a=[pP(n),-sP(n),0],o=0,s=0,c=new zg;i===1?r=$N+ZN:i===-1&&(r=-$N-ZN);for(var l=0,u=e.length;l=0?1:-1,E=T*w,D=E>QN,O=g*S;if(c.add(oP(O*T*pP(E),_*C+O*sP(E))),o+=D?w+T*tP:w,D^m>=n^b>=n){var k=BP(RP(p),RP(y));UP(k);var A=BP(a,k);UP(A);var j=(D^w>=0?-1:1)*XN(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}var ZF=o((()=>{g_(),WP(),_P()}));function QF(e,t,n,r){return function(i){var a=t(i),o=HF(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=p_(u);var e=N_e(l,r);u.length?(c||=(i.polygonStart(),!0),qF(u,F_e,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(P_e))}}return f}}function P_e(e){return e.length>1}function F_e(e,t){return((e=e.x)[0]<0?e[1]-$N-ZN:$N-e[1])-((t=t.x)[0]<0?t[1]-$N-ZN:$N-t[1])}var $F=o((()=>{UF(),YF(),_P(),ZF(),g_()}));function I_e(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?QN:-QN,c=iP(a-t);iP(c-QN)<1e-6?(e.point(t,n=(n+o)/2>0?$N:-$N),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=QN&&(iP(t-r)<1e-6&&(t-=r*ZN),iP(a-s)<1e-6&&(a-=s*ZN),n=L_e(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function L_e(e,t,n,r){var i,a,o=pP(e-n);return iP(o)>1e-6?aP((pP(t)*(a=sP(r))*pP(n)-pP(r)*(i=sP(t))*pP(e))/(i*a*o)):(t+r)/2}function R_e(e,t,n,r){var i;if(e==null)i=n*$N,r.point(-QN,i),r.point(0,i),r.point(QN,i),r.point(QN,0),r.point(QN,-i),r.point(0,-i),r.point(-QN,-i),r.point(-QN,0),r.point(-QN,i);else if(iP(e[0]-t[0])>1e-6){var a=e[0]{$F(),_P(),eI=QF(function(){return!0},I_e,R_e,[-QN,-$N])}));function z_e(e){var t=sP(e),n=2*rP,r=t>0,i=iP(t)>ZN;function a(t,r,i,a){M_e(a,e,n,i,t,r)}function o(e,n){return sP(e)*sP(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?QN:-QN),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||WF(t,m)||WF(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!WF(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=RP(e),a=RP(n),o=[1,0,0],s=BP(i,a),c=zP(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=BP(o,s),m=HP(o,d);VP(m,HP(s,f));var h=p,g=zP(m,h),_=zP(h,h),v=g*g-_*(zP(m,m)-1);if(!(v<0)){var y=hP(v),b=HP(h,(-g-y)/_);if(VP(b,m),b=LP(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S0^b[1]<(iP(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>QN^(x<=b[0]&&b[0]<=S)){var k=HP(h,(-g+y)/_);return VP(k,m),[b,LP(k)]}}}function l(t,n){var i=r?e:QN-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return QF(o,s,a,r?[0,-e]:[-QN,e-QN])}var nI=o((()=>{WP(),VF(),_P(),GF(),$F()}));function B_e(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m0)){if(m/=p,p<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var V_e=o((()=>{}));function rI(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return iP(r[0]-e)<1e-6?i>0?0:3:iP(r[0]-n)<1e-6?i>0?2:1:iP(r[1]-t)<1e-6?+(i>0):i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=HF(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;nr&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=p_(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&qF(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(aI,Math.min(iI,g)),_=Math.max(aI,Math.min(iI,_))],u=[a=Math.max(aI,Math.min(iI,a)),o=Math.max(aI,Math.min(iI,o))];B_e(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}var iI,aI,oI=o((()=>{_P(),UF(),V_e(),YF(),g_(),iI=1e9,aI=-iI}));function sI(e,t,n){var r=m_(e,t-ZN,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function cI(e,t,n){var r=m_(e,t-ZN,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function H_e(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return m_(cP(r/u)*u,n,u).map(m).concat(m_(cP(s/d)*d,o,d).map(h)).concat(m_(cP(t/c)*c,e,c).filter(function(e){return iP(e%u)>ZN}).map(f)).concat(m_(cP(a/l)*l,i,l).filter(function(e){return iP(e%d)>ZN}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=sI(a,i,90),p=cI(t,e,g),m=sI(s,o,90),h=cI(r,n,g),_):g},_.extentMajor([[-180,-90+ZN],[180,90-ZN]]).extentMinor([[-180,-80-ZN],[180,80+ZN]])}var U_e=o((()=>{g_(),_P()})),lI,uI=o((()=>{lI=e=>e}));function W_e(){vI.point=G_e}function G_e(e,t){vI.point=dI,mI=gI=e,hI=_I=t}function dI(e,t){pI.add(_I*e-gI*t),gI=e,_I=t}function K_e(){dI(mI,hI)}var fI,pI,mI,hI,gI,_I,vI,q_e=o((()=>{g_(),_P(),yP(),fI=new zg,pI=new zg,vI={point:vP,lineStart:vP,lineEnd:vP,polygonStart:function(){vI.lineStart=W_e,vI.lineEnd=K_e},polygonEnd:function(){vI.lineStart=vI.lineEnd=vI.point=vP,fI.add(iP(pI)),pI=new zg},result:function(){var e=fI/2;return fI=new zg,e}}}));function J_e(e,t){exI&&(xI=e),tSI&&(SI=t)}var yI,bI,xI,SI,CI,wI=o((()=>{yP(),yI=1/0,bI=yI,xI=-yI,SI=xI,CI={point:J_e,lineStart:vP,lineEnd:vP,polygonStart:vP,polygonEnd:vP,result:function(){var e=[[yI,bI],[xI,SI]];return xI=SI=-(bI=yI=1/0),e}}}));function TI(e,t){kI+=e,AI+=t,++jI}function EI(){HI.point=Y_e}function Y_e(e,t){HI.point=X_e,TI(BI=e,VI=t)}function X_e(e,t){var n=e-BI,r=t-VI,i=hP(n*n+r*r);MI+=i*(BI+e)/2,NI+=i*(VI+t)/2,PI+=i,TI(BI=e,VI=t)}function DI(){HI.point=TI}function Z_e(){HI.point=$_e}function Q_e(){OI(RI,zI)}function $_e(e,t){HI.point=OI,TI(RI=BI=e,zI=VI=t)}function OI(e,t){var n=e-BI,r=t-VI,i=hP(n*n+r*r);MI+=i*(BI+e)/2,NI+=i*(VI+t)/2,PI+=i,i=VI*e-BI*t,FI+=i*(BI+e),II+=i*(VI+t),LI+=i*3,TI(BI=e,VI=t)}var kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,eve=o((()=>{_P(),kI=0,AI=0,jI=0,MI=0,NI=0,PI=0,FI=0,II=0,LI=0,HI={point:TI,lineStart:EI,lineEnd:DI,polygonStart:function(){HI.lineStart=Z_e,HI.lineEnd=Q_e},polygonEnd:function(){HI.point=TI,HI.lineStart=EI,HI.lineEnd=DI},result:function(){var e=LI?[FI/LI,II/LI]:PI?[MI/PI,NI/PI]:jI?[kI/jI,AI/jI]:[NaN,NaN];return kI=AI=jI=MI=NI=PI=FI=II=LI=0,e}}}));function UI(e){this._context=e}var tve=o((()=>{_P(),yP(),UI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,tP);break}},result:vP}}));function nve(e,t){ZI.point=WI,qI=YI=e,JI=XI=t}function WI(e,t){YI-=e,XI-=t,GI.add(hP(YI*YI+XI*XI)),YI=e,XI=t}var GI,KI,qI,JI,YI,XI,ZI,rve=o((()=>{g_(),_P(),yP(),GI=new zg,ZI={point:vP,lineStart:function(){ZI.point=nve},lineEnd:function(){KI&&WI(qI,JI),ZI.point=vP},polygonStart:function(){KI=!0},polygonEnd:function(){KI=null},result:function(){var e=+GI;return GI=new zg,e}}}));function QI(e){let t=1;this._+=e[0];for(let n=e.length;t=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return QI;if(t!==$I){let e=10**t;$I=t,eL=function(t){let n=1;this._+=t[0];for(let r=t.length;n{rL=class{constructor(e){this._append=e==null?QI:ive(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==tL||this._append!==eL){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,tL=e,eL=this._append,nL=this._,this._=t}this._+=nL;break}}result(){let e=this._;return this._=``,e.length?e:null}}}));function iL(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),CP(e,i(a))),a.result()}return o.area=function(e){return CP(e,i(vI)),vI.result()},o.measure=function(e){return CP(e,i(ZI)),ZI.result()},o.bounds=function(e){return CP(e,i(CI)),CI.result()},o.centroid=function(e){return CP(e,i(HI)),HI.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,lI):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new rL(n)):new UI(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new rL(n)),o},o.projection(e).digits(n).context(t)}var ove=o((()=>{uI(),EP(),q_e(),wI(),eve(),tve(),rve(),ave()}));function aL(e){return function(t){var n=new oL;for(var r in e)n[r]=e[r];return n.stream=t,n}}function oL(){}var sL=o((()=>{oL.prototype={constructor:oL,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}}));function cL(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),CP(n,e.stream(CI)),t(CI.result()),r!=null&&e.clipExtent(r),e}function lL(e,t,n){return cL(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function uL(e,t,n){return lL(e,[[0,0],t],n)}function dL(e,t,n){return cL(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function fL(e,t,n){return cL(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var pL=o((()=>{EP(),wI()}));function mL(e,t){return+t?cve(e,t):sve(e)}function sve(e){return aL({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function cve(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=hP(b*b+x*x+S*S),w=XN(S/=C),T=iP(iP(S)-1)<1e-6||iP(a-d)<1e-6?(a+d)/2:oP(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||iP((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m{WP(),_P(),sL(),hL=16,gL=sP(30*rP)}));function uve(e){return aL({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function dve(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function _L(e,t,n,r,i,a){if(!a)return dve(e,t,n,r,i);var o=sP(a),s=pP(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function vL(e){return yL(function(){return e})()}function yL(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=eI,g=null,_,v,y,b=lI,x=.5,S,C,w,T,E;function D(e){return w(e[0]*rP,e[1]*rP)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*nP,e[1]*nP]}D.stream=function(e){return T&&E===e?T:T=bL(uve(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?z_e(m=e*rP):(m=null,eI),A()):m*nP},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,lI):rI(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*rP,o=e[1]%360*rP,k()):[a*nP,o*nP]},D.rotate=function(e){return arguments.length?(s=e[0]%360*rP,c=e[1]%360*rP,l=e.length>2?e[2]%360*rP:0,k()):[s*nP,c*nP,l*nP]},D.angle=function(e){return arguments.length?(d=e%360*rP,k()):d*nP},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=mL(C,x=e*e),A()):hP(x)},D.fitExtent=function(e,t){return lL(D,e,t)},D.fitSize=function(e,t){return uL(D,e,t)},D.fitWidth=function(e,t){return dL(D,e,t)},D.fitHeight=function(e,t){return fL(D,e,t)};function k(){var e=_L(n,0,0,f,p,d).apply(null,t(a,o)),m=_L(n,r-e[0],i-e[1],f,p,d);return u=FF(s,c,l),C=MF(t,m),w=MF(u,C),S=mL(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}var bL,xL=o((()=>{tI(),nI(),oI(),NF(),uI(),_P(),zF(),sL(),pL(),lve(),bL=aL({point:function(e,t){this.stream.point(e*rP,t*rP)}})}));function SL(e){var t=0,n=QN/3,r=yL(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*rP,n=e[1]*rP):[t*nP,n*nP]},i}var CL=o((()=>{_P(),xL()}));function fve(e){var t=sP(e);function n(e,n){return[e*t,pP(n)/t]}return n.invert=function(e,n){return[e/t,XN(n*t)]},n}var pve=o((()=>{_P()}));function mve(e,t){var n=pP(e),r=(n+pP(t))/2;if(iP(r)<1e-6)return fve(e);var i=1+n*(2*r-n),a=hP(i)/r;function o(e,t){var n=hP(i-2*r*pP(t))/r;return[n*pP(e*=r),a-n*sP(e)]}return o.invert=function(e,t){var n=a-t,o=oP(e,iP(n))*mP(n);return n*r<0&&(o-=QN*mP(e)*mP(n)),[o/r,XN((i-(e*e+n*n)*r*r)/(2*r))]},o}function wL(){return SL(mve).scale(155.424).center([0,33.6442])}var TL=o((()=>{_P(),CL(),pve()}));function EL(){return wL().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}var DL=o((()=>{TL()}));function hve(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i=.12&&s<.234&&a>=-.425&&a<-.214?i:s>=.166&&s<.234&&a>=-.214&&a<-.115?o:n).invert(e)},u.stream=function(r){return e&&t===r?e:e=hve([n.stream(t=r),i.stream(r),o.stream(r)])},u.precision=function(e){return arguments.length?(n.precision(e),i.precision(e),o.precision(e),d()):n.precision()},u.scale=function(e){return arguments.length?(n.scale(e),i.scale(e*.35),o.scale(e),u.translate(n.translate())):n.scale()},u.translate=function(e){if(!arguments.length)return n.translate();var t=n.scale(),c=+e[0],u=+e[1];return r=n.translate(e).clipExtent([[c-.455*t,u-.238*t],[c+.455*t,u+.238*t]]).stream(l),a=i.translate([c-.307*t,u+.201*t]).clipExtent([[c-.425*t+ZN,u+.12*t+ZN],[c-.214*t-ZN,u+.234*t-ZN]]).stream(l),s=o.translate([c-.205*t,u+.212*t]).clipExtent([[c-.214*t+ZN,u+.166*t+ZN],[c-.115*t-ZN,u+.234*t-ZN]]).stream(l),d()},u.fitExtent=function(e,t){return lL(u,e,t)},u.fitSize=function(e,t){return uL(u,e,t)},u.fitWidth=function(e,t){return dL(u,e,t)},u.fitHeight=function(e,t){return fL(u,e,t)};function d(){return e=t=null,u}return u.scale(1070)}var _ve=o((()=>{_P(),DL(),TL(),pL()}));function OL(e){return function(t,n){var r=sP(t),i=sP(n),a=e(r*i);return a===1/0?[2,0]:[a*i*pP(t),a*pP(n)]}}function kL(e){return function(t,n){var r=hP(t*t+n*n),i=e(r),a=pP(i),o=sP(i);return[oP(t*a,r*o),XN(r&&n*a/r)]}}var AL=o((()=>{_P()}));function vve(){return vL(jL).scale(124.75).clipAngle(179.999)}var jL,yve=o((()=>{_P(),AL(),xL(),jL=OL(function(e){return hP(2/(1+e))}),jL.invert=kL(function(e){return 2*XN(e/2)})}));function bve(){return vL(ML).scale(79.4188).clipAngle(179.999)}var ML,xve=o((()=>{_P(),AL(),xL(),ML=OL(function(e){return(e=YN(e))&&e/pP(e)}),ML.invert=kL(function(e){return e})}));function NL(e,t){return[e,dP(gP(($N+t)/2))]}function Sve(){return PL(NL).scale(961/tP)}function PL(e){var t=vL(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=QN*r(),i=t(j_e(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===NL?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}var FL=o((()=>{_P(),zF(),xL(),NL.invert=function(e,t){return[e,2*aP(lP(t))-$N]}}));function IL(e){return gP(($N+e)/2)}function Cve(e,t){var n=sP(e),r=e===t?pP(e):dP(n/sP(t))/dP(IL(t)/IL(e)),i=n*fP(IL(e),r)/r;if(!r)return NL;function a(e,t){i>0?t<-$N+1e-6&&(t=-$N+ZN):t>$N-1e-6&&(t=$N-ZN);var n=i/fP(IL(t),r);return[n*pP(r*e),i-n*sP(r*e)]}return a.invert=function(e,t){var n=i-t,a=mP(r)*hP(e*e+n*n),o=oP(e,iP(n))*mP(n);return n*r<0&&(o-=QN*mP(e)*mP(n)),[o/r,2*aP(fP(i/a,1/r))-$N]},a}function wve(){return SL(Cve).scale(109.5).parallels([30,30])}var Tve=o((()=>{_P(),CL(),FL()}));function LL(e,t){return[e,t]}function Eve(){return vL(LL).scale(152.63)}var RL=o((()=>{xL(),LL.invert=LL}));function Dve(e,t){var n=sP(e),r=e===t?pP(e):(n-sP(t))/(t-e),i=n/r+e;if(iP(r)<1e-6)return LL;function a(e,t){var n=i-t,a=r*e;return[n*pP(a),i-n*sP(a)]}return a.invert=function(e,t){var n=i-t,a=oP(e,iP(n))*mP(n);return n*r<0&&(a-=QN*mP(e)*mP(n)),[a/r,i-mP(r)*hP(e*e+n*n)]},a}function Ove(){return SL(Dve).scale(131.154).center([0,13.9389])}var kve=o((()=>{_P(),CL(),RL()}));function zL(e,t){var n=XN(WL*pP(t)),r=n*n,i=r*r*r;return[e*sP(n)/(WL*(BL+3*VL*r+i*(7*HL+9*UL*r))),n*(BL+VL*r+i*(HL+UL*r))]}function Ave(){return vL(zL).scale(177.158)}var BL,VL,HL,UL,WL,GL,jve=o((()=>{xL(),_P(),BL=1.340264,VL=-.081106,HL=893e-6,UL=.003796,WL=hP(3)/2,GL=12,zL.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,a=0,o,s,c;a{_P(),AL(),xL(),KL.invert=kL(aP)}));function Pve(){var e=1,t=0,n=0,r=1,i=1,a=0,o,s,c=null,l,u,d,f=1,p=1,m=aL({point:function(e,t){var n=y([e,t]);this.stream.point(n[0],n[1])}}),h=lI,g,_;function v(){return f=e*r,p=e*i,g=_=null,y}function y(e){var r=e[0]*f,i=e[1]*p;if(a){var c=i*o-r*s;r=r*o+i*s,i=c}return[r+t,i+n]}return y.invert=function(e){var r=e[0]-t,i=e[1]-n;if(a){var c=i*o+r*s;r=r*o-i*s,i=c}return[r/f,i/p]},y.stream=function(e){return g&&_===e?g:g=m(h(_=e))},y.postclip=function(e){return arguments.length?(h=e,c=l=u=d=null,v()):h},y.clipExtent=function(e){return arguments.length?(h=e==null?(c=l=u=d=null,lI):rI(c=+e[0][0],l=+e[0][1],u=+e[1][0],d=+e[1][1]),v()):c==null?null:[[c,l],[u,d]]},y.scale=function(t){return arguments.length?(e=+t,v()):e},y.translate=function(e){return arguments.length?(t=+e[0],n=+e[1],v()):[t,n]},y.angle=function(e){return arguments.length?(a=e%360*rP,s=pP(a),o=sP(a),v()):a*nP},y.reflectX=function(e){return arguments.length?(r=e?-1:1,v()):r<0},y.reflectY=function(e){return arguments.length?(i=e?-1:1,v()):i<0},y.fitExtent=function(e,t){return lL(y,e,t)},y.fitSize=function(e,t){return uL(y,e,t)},y.fitWidth=function(e,t){return dL(y,e,t)},y.fitHeight=function(e,t){return fL(y,e,t)},y}var Fve=o((()=>{oI(),uI(),sL(),pL(),_P()}));function qL(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function Ive(){return vL(qL).scale(175.295)}var Lve=o((()=>{xL(),_P(),qL.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,o=a*a;n-=i=(n*(1.007226+a*(.015085+o*(-.044475+.028874*a-.005916*o)))-t)/(1.007226+a*(.015085*3+o*(-.044475*7+.028874*9*a-.005916*11*o)))}while(iP(i)>1e-6&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}}));function JL(e,t){return[sP(t)*pP(e),pP(t)]}function Rve(){return vL(JL).scale(249.5).clipAngle(90+ZN)}var zve=o((()=>{_P(),AL(),xL(),JL.invert=kL(XN)}));function YL(e,t){var n=sP(t),r=1+sP(e)*n;return[n*pP(e)/r,pP(t)/r]}function Bve(){return vL(YL).scale(250).clipAngle(142)}var Vve=o((()=>{_P(),AL(),xL(),YL.invert=kL(function(e){return 2*aP(e)})}));function XL(e,t){return[dP(gP(($N+t)/2)),-e]}function Hve(){var e=PL(XL),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90]).scale(159.155)}var Uve=o((()=>{_P(),FL(),XL.invert=function(e,t){return[-t,2*aP(lP(e))-$N]}})),ZL=o((()=>{IP(),C_e(),A_e(),VF(),tI(),nI(),oI(),ZF(),g_(),_P(),yP(),EP(),U_e(),ove(),DL(),_ve(),yve(),xve(),Tve(),TL(),kve(),jve(),RL(),Nve(),Fve(),xL(),FL(),Lve(),zve(),Vve(),Uve(),zF(),sL()}));function QL(e){return e>1?rR:e<-1?-rR:Math.asin(e)}function Wve(e){return e>0?Math.sqrt(e):0}var $L,eR,tR,nR,rR,iR,aR=o((()=>{$L=Math.abs,eR=Math.cos,tR=Math.sin,nR=Math.PI,rR=nR/2,nR/4,iR=Wve(2),nR*2,180/nR,nR/180}));function Gve(e,t){var n=e*tR(t),r=30,i;do t-=i=(t+tR(t)-n)/(1+eR(t));while($L(i)>1e-6&&--r>0);return t/2}function Kve(e,t,n){function r(r,i){return[e*r*eR(i=Gve(n,i)),t*tR(i)]}return r.invert=function(r,i){return i=QL(i/t),[r/(e*eR(i)),QL((2*i+tR(2*i))/n)]},r}function qve(){return vL(oR).scale(169.529)}var oR,Jve=o((()=>{ZL(),aR(),oR=Kve(iR/rR,iR,nR)})),Yve=o((()=>{ZL(),aR(),Jve(),g_()}));function Xve(e,t){return function n(){let r=t();return r.type=e,r.path=iL().projection(r),r.copy=r.copy||function(){let e=n();return uR.forEach(t=>{r[t]&&e[t](r[t]())}),e.path.pointRadius(r.path.pointRadius()),e},CD(r)}}function sR(e,t){if(!e||typeof e!=`string`)throw Error(`Projection type must be a name string.`);return e=e.toLowerCase(),arguments.length>1?(dR[e]=Xve(e,t),this):dR[e]||null}function cR(e){return e&&e.path||lR}var lR,uR,dR,fR=o((()=>{ZL(),Yve(),FO(),lR=iL(),uR=[`clipAngle`,`clipExtent`,`scale`,`translate`,`center`,`rotate`,`parallels`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],dR={albers:EL,albersusa:gve,azimuthalequalarea:vve,azimuthalequidistant:bve,conicconformal:wve,conicequalarea:wL,conicequidistant:Ove,equalEarth:Ave,equirectangular:Eve,gnomonic:Mve,identity:Pve,mercator:Sve,mollweide:qve,naturalEarth1:Ive,orthographic:Rve,stereographic:Bve,transversemercator:Hve};for(let e in dR)sR(e,dR[e])})),Zve=c({contour:()=>wR,geojson:()=>TR,geopath:()=>ER,geopoint:()=>DR,geoshape:()=>OR,graticule:()=>kR,heatmap:()=>AR,isocontour:()=>hR,kde2d:()=>SR,projection:()=>MR});function Qve(){}function pR(){var e=1,t=1,n=s;function r(e,t){return t.map(t=>i(e,t))}function i(e,t){var r=[],i=[];return a(e,t,a=>{n(a,e,t),$ve(a)>0?r.push([a]):i.push(a)}),i.forEach(e=>{for(var t=0,n=r.length,i;t=r,f,p;for(PR[d<<1].forEach(m);++c=r,PR[u|d<<1].forEach(m);for(PR[d<<0].forEach(m);++l=r,f=n[l*e]>=r,PR[d<<1|f<<2].forEach(m);++c=r,p=f,f=n[l*e+c+1]>=r,PR[u|d<<1|f<<2|p<<3].forEach(m);PR[d|f<<3].forEach(m)}for(c=-1,f=n[l*e]>=r,PR[f<<2].forEach(m);++c=r,PR[f<<2|p<<3].forEach(m);PR[f<<3].forEach(m);function m(e){var t=[e[0][0]+c,e[0][1]+l],n=[e[1][0]+c,e[1][1]+l],r=o(t),u=o(n),d,f;(d=s[r])?(f=a[u])?(delete s[d.end],delete a[f.start],d===f?(d.ring.push(n),i(d.ring)):a[d.start]=s[f.end]={start:d.start,end:f.end,ring:d.ring.concat(f.ring)}):(delete s[d.end],d.ring.push(n),s[d.end=u]=d):(d=a[u])?(f=s[r])?(delete a[d.start],delete s[f.end],d===f?(d.ring.push(n),i(d.ring)):a[f.start]=s[d.end]={start:f.start,end:d.end,ring:f.ring.concat(d.ring)}):(delete a[d.start],d.ring.unshift(t),a[d.start=r]=d):a[r]=s[u]={start:r,end:u,ring:[t,n]}}}function o(t){return t[0]*2+t[1]*(e+1)*4}function s(n,r,i){n.forEach(n=>{var a=n[0],o=n[1],s=a|0,c=o|0,l,u=r[c*e+s];a>0&&a0&&o=0&&a>=0||V(`invalid size`),e=i,t=a,r},r.smooth=function(e){return arguments.length?(n=e?s:Qve,r):n===s},r}function $ve(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++tr!=p>r&&n<(f-l)*(r-u)/(p-u)+l&&(i=-i)}return i}function nye(e,t,n){var r;return rye(e,t,n)&&iye(e[r=+(e[0]===t[0])],n[r],t[r])}function rye(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function iye(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function mR(e,t,n){return function(r){var i=Ph(r),a=n?Math.min(i[0],0):i[0],o=i[1],s=o-a,c=t?Qg(a,o,e):s/(e+1);return m_(a+c,o,c)}}function hR(e){G.call(this,null,e)}function aye(e,t,n){let r=mR(n.levels||10,n.nice,n.zero!==!1);return n.resolve===`shared`?r(e.map(e=>n_(t(e).values))):r}function oye(e,t,n,r){let i=r.scale||t.scale,a=r.translate||t.translate;if(Sh(i)&&(i=i(n,r)),Sh(a)&&(a=a(n,r)),(i===1||i==null)&&!a)return;let o=(Kh(i)?i:i[0])||1,s=(Kh(i)?i:i[1])||1,c=a&&a[0]||0,l=a&&a[1]||0;e.forEach(gR(t,o,s,c,l))}function gR(e,t,n,r,i){let a=e.x1||0,o=e.y1||0,s=t*n<0;function c(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(u)}function u(e){e[0]=(e[0]-a)*t+r,e[1]=(e[1]-o)*n+i}return function(e){return e.coordinates.forEach(c),e}}function _R(e,t,n){let r=e>=0?e:cx(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function vR(e){return Sh(e)?e:Ah(+e)}function yR(){var e=e=>e[0],t=e=>e[1],n=Rm,r=[-1,-1],i=960,a=500,o=2;function s(s,c){let l=_R(r[0],s,e)>>o,u=_R(r[1],s,t)>>o,d=l?l+2:0,f=u?u+2:0,p=2*d+(i>>o),m=2*f+(a>>o),h=new Float32Array(p*m),g=new Float32Array(p*m),_=h;s.forEach(r=>{let i=d+(+e(r)>>o),a=f+(+t(r)>>o);i>=0&&i=0&&a0&&u>0?(bR(p,m,h,g,l),xR(p,m,g,h,u),bR(p,m,h,g,l),xR(p,m,g,h,u),bR(p,m,h,g,l),xR(p,m,g,h,u)):l>0?(bR(p,m,h,g,l),bR(p,m,g,h,l),bR(p,m,h,g,l),_=g):u>0&&(xR(p,m,h,g,u),xR(p,m,g,h,u),xR(p,m,h,g,u),_=g);let v=c?2**(-2*o):1/h_(_);for(let e=0,t=p*m;e>o),y2:f+(a>>o)}}return s.x=function(t){return arguments.length?(e=vR(t),s):e},s.y=function(e){return arguments.length?(t=vR(e),s):t},s.weight=function(e){return arguments.length?(n=vR(e),s):n},s.size=function(e){if(!arguments.length)return[i,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||V(`invalid size`),i=t,a=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||V(`invalid cell size`),o=Math.floor(Math.log(e)/Math.LN2),s):1<=i&&(t>=a&&(s-=n[t-a+o*e]),r[t-i+o*e]=s/Math.min(t+1,e-1+a-t,a))}function xR(e,t,n,r,i){let a=(i<<1)+1;for(let o=0;o=i&&(s>=a&&(c-=n[o+(s-a)*e]),r[o+(s-i)*e]=c/Math.min(s+1,t-1+a-s,a))}function SR(e){G.call(this,null,e)}function CR(e,t){return FR.forEach(n=>t[n]==null?0:e[n](t[n])),e}function sye(e,t){var n=[],r=e=>e(s),i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;ae(t(n)):r=>{var i=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(i),a};return r.context=t=>(e.context(t),r),r}function kR(e){G.call(this,[],e),this.generator=H_e()}function AR(e){G.call(this,null,e)}function uye(e,t){let n;return Sh(e)?(n=n=>aw(e(n,t)),n.dep=jR(e)):n=Ah(aw(e||`#888`)),n}function dye(e,t){let n;return Sh(e)?(n=n=>e(n,t),n.dep=jR(e)):e?n=Ah(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}function jR(e){if(!Sh(e))return!1;let t=ug(wm(e));return t.$x||t.$y||t.$value||t.$max}function fye(e,t,n,r){let i=e.width,a=e.height,o=e.x1||0,s=e.y1||0,c=e.x2||i,l=e.y2||a,u=e.values,d=u?e=>u[e]:Lm,f=VC(c-o,l-s),p=f.getContext(`2d`),m=p.getImageData(0,0,c-o,l-s),h=m.data;for(let e=s,a=0;ee.concat(gye(t)),[])}}function gye(e){return e.type===LR?e.features:yh(e).filter(e=>e!=null).map(e=>e.type===IR?e:{type:IR,geometry:e})}var PR,FR,IR,LR,RR,_ye=o((()=>{ax(),pg(),g_(),Ix(),fR(),ZL(),uT(),UC(),PR=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]],hR.Definition={type:`Isocontour`,metadata:{generates:!0},params:[{name:`field`,type:`field`},{name:`thresholds`,type:`number`,array:!0},{name:`levels`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`zero`,type:`boolean`,default:!0},{name:`smooth`,type:`boolean`,default:!0},{name:`scale`,type:`number`,expr:!0},{name:`translate`,type:`number`,array:!0,expr:!0},{name:`as`,type:`string`,null:!0,default:`contour`}]},U(hR,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||Im,a=pR().smooth(e.smooth!==!1),o=e.thresholds||aye(r,i,e),s=e.as===null?null:e.as||`contour`,c=[];return r.forEach(t=>{let n=i(t),r=a.size([n.width,n.height])(n.values,H(o)?o:o(n.values));oye(r,n,t,e),r.forEach(e=>{c.push(Mb(t,Ab(s==null?e:{[s]:e})))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),SR.Definition={type:`KDE2D`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`weight`,type:`field`},{name:`groupby`,type:`field`,array:!0},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`,array:!0,length:2},{name:`counts`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:`grid`}]},FR=[`x`,`y`,`weight`,`size`,`cellSize`,`bandwidth`],U(SR,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=sye(r,e.groupby),a=(e.groupby||[]).map(Cm),o=CR(yR(),e),s=e.as||`grid`,c=[];function l(e,t){for(let n=0;nAb(l({[s]:o(t,e.counts)},t.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),wR.Definition={type:`Contour`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`values`,type:`number`,array:!0},{name:`x`,type:`field`},{name:`y`,type:`field`},{name:`weight`,type:`field`},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`},{name:`count`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`thresholds`,type:`number`,array:!0},{name:`smooth`,type:`boolean`,default:!0}]},U(wR,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=pR().smooth(e.smooth!==!1),i=e.values,a=e.thresholds||mR(e.count||10,e.nice,!!i),o=e.size,s,c;return i||=(i=t.materialize(t.SOURCE).source,s=CR(yR(),e)(i,!0),c=gR(s,s.scale||1,s.scale||1,0,0),o=[s.width,s.height],s.values),a=H(a)?a:a(i),i=r.size(o)(i,a),c&&i.forEach(c),this.value&&(n.rem=this.value),this.value=n.source=n.add=(i||[]).map(Ab),n}}),IR=`Feature`,LR=`FeatureCollection`,RR=`MultiPoint`,TR.Definition={type:`GeoJSON`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,length:2},{name:`geojson`,type:`field`}]},U(TR,G,{transform(e,t){var n=this._features,r=this._points,i=e.fields,a=i&&i[0],o=i&&i[1],s=e.geojson||!i&&Im,c=t.ADD,l=e.modified()||t.changed(t.REM)||t.modified(wm(s))||a&&t.modified(wm(a))||o&&t.modified(wm(o));(!this.value||l)&&(c=t.SOURCE,this._features=n=[],this._points=r=[]),s&&t.visit(c,e=>n.push(s(e))),a&&o&&(t.visit(c,e=>{var t=a(e),n=o(e);t!=null&&n!=null&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),n=n.concat({type:IR,geometry:{type:RR,coordinates:r}})),this.value={type:LR,features:n}}}),ER.Definition={type:`GeoPath`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`path`}]},U(ER,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||Im,a=e.as||`path`,o=n.SOURCE;!r||e.modified()?(this.value=r=cR(e.projection),n.materialize().reflow()):o=i===Im||t.modified(i.fields)?n.ADD_MOD:n.ADD;let s=cye(r,e.pointRadius);return n.visit(o,e=>e[a]=r(i(e))),r.pointRadius(s),n.modifies(a)}}),DR.Definition={type:`GeoPoint`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`,required:!0},{name:`fields`,type:`field`,array:!0,required:!0,length:2},{name:`as`,type:`string`,array:!0,length:2,default:[`x`,`y`]}]},U(DR,G,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],a=e.as||[`x`,`y`],o=a[0],s=a[1],c;function l(e){let t=n([r(e),i(e)]);t?(e[o]=t[0],e[s]=t[1]):(e[o]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(c=t.modified(r.fields)||t.modified(i.fields),t.visit(c?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),OR.Definition={type:`GeoShape`,metadata:{modifies:!0,nomod:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`,default:`datum`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`shape`}]},U(OR,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||`shape`,a=n.ADD;return(!r||e.modified())&&(this.value=r=lye(cR(e.projection),e.field||Nm(`datum`),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,e=>e[i]=r),n.modifies(i)}}),kR.Definition={type:`Graticule`,metadata:{changes:!0,generates:!0},params:[{name:`extent`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMajor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMinor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`step`,type:`number`,array:!0,length:2},{name:`stepMajor`,type:`number`,array:!0,length:2,default:[90,360]},{name:`stepMinor`,type:`number`,array:!0,length:2,default:[10,10]},{name:`precision`,type:`number`,default:2.5}]},U(kR,G,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(let t in e)Sh(r[t])&&r[t](e[t]);return i=r(),n.length?t.mod.push(Oce(n[0],i)):t.add.push(Ab(i)),n[0]=i,t}}),AR.Definition={type:`heatmap`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`color`,type:`string`,expr:!0},{name:`opacity`,type:`number`,expr:!0},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`as`,type:`string`,default:`image`}]},U(AR,G,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve===`shared`,i=e.field||Im,a=dye(e.opacity,e),o=uye(e.color,e),s=e.as||`image`,c={$x:0,$y:0,$value:0,$max:r?n_(n.map(e=>n_(i(e).values))):0};return n.forEach(e=>{let t=i(e),n=Mh({},e,c);r||(n.$max=n_(t.values||[])),e[s]=fye(t,n,o.dep?o:Ah(o(n)),a.dep?a:Ah(a(n)))}),t.reflow(!0).modifies(s)}}),U(MR,G,{transform(e,t){let n=this.value;return!n||e.modified(`type`)?(this.value=n=mye(e.type),uR.forEach(t=>{e[t]!=null&&NR(n,t,e[t])})):uR.forEach(t=>{e.modified(t)&&NR(n,t,e[t])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&pye(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}})}));function vye(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i{}));function bye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return zR(this.cover(t,n),t,n,e)}function zR(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function xye(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=i),ad&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n{}));function Cye(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t{}));function Tye(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}var Eye=o((()=>{}));function Dye(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}var Oye=o((()=>{}));function BR(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}var VR=o((()=>{}));function kye(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new BR(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b{VR()}));function jye(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function Mye(e){for(var t=0,n=e.length;t{}));function Pye(){return this._root}var Fye=o((()=>{}));function Iye(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}var Lye=o((()=>{}));function Rye(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new BR(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new BR(i,l,u,s,c)),(i=r[2])&&t.push(new BR(i,a,u,l,c)),(i=r[1])&&t.push(new BR(i,l,o,s,u)),(i=r[0])&&t.push(new BR(i,a,o,l,u))}return this}var zye=o((()=>{VR()}));function Bye(e){var t=[],n=[],r;for(this._root&&t.push(new BR(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new BR(a,o,s,u,d)),(a=i[1])&&t.push(new BR(a,u,s,c,d)),(a=i[2])&&t.push(new BR(a,o,d,u,l)),(a=i[3])&&t.push(new BR(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}var Vye=o((()=>{VR()}));function Hye(e){return e[0]}function Uye(e){return arguments.length?(this._x=e,this):this._x}var Wye=o((()=>{}));function Gye(e){return e[1]}function Kye(e){return arguments.length?(this._y=e,this):this._y}var qye=o((()=>{}));function HR(e,t,n){var r=new UR(t??Hye,n??Gye,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function UR(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function WR(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var GR,Jye=o((()=>{Sye(),wye(),Eye(),Oye(),Aye(),Nye(),Fye(),Lye(),zye(),Vye(),Wye(),qye(),GR=HR.prototype=UR.prototype,GR.copy=function(){var e=new UR(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=WR(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=WR(r));return e},GR.add=bye,GR.addAll=xye,GR.cover=Cye,GR.data=Tye,GR.extent=Dye,GR.find=kye,GR.remove=jye,GR.removeAll=Mye,GR.root=Pye,GR.size=Iye,GR.visit=Rye,GR.visitAfter=Bye,GR.x=Uye,GR.y=Kye})),KR=o((()=>{Jye()}));function qR(e){return function(){return e}}var JR=o((()=>{}));function YR(e){return(e()-.5)*1e-6}var XR=o((()=>{}));function Yye(e){return e.x+e.vx}function Xye(e){return e.y+e.vy}function Zye(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=qR(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;ml.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_u+m||ad+m||oe.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r{KR(),JR(),XR()}));function $ye(e){return e.index}function ZR(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function ebe(e){var t=$ye,n=d,r,i=qR(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n[t(e,n,o),e])),d;for(n=0,s=Array(i);n{JR(),XR()}));function QR(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}function rbe(e,t){for(var n=0,r=e.length,i;n{tz={value:()=>{}},$R.prototype=QR.prototype={constructor:$R,on:function(e,t){var n=this._,r=nbe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r{ibe()}));function nz(){return mz||=(_z(obe),gz.now()+hz)}function obe(){mz=0}function rz(){this._call=this._time=this._next=null}function iz(e,t,n){var r=new rz;return r.restart(e,t,n),r}function sbe(){nz(),++sz;for(var e=dz,t;e;)(t=mz-e._time)>=0&&e._call.call(void 0,t),e=e._next;--sz}function az(){mz=(pz=gz.now())+hz,sz=cz=0;try{sbe()}finally{sz=0,lbe(),mz=0}}function cbe(){var e=gz.now(),t=e-pz;t>uz&&(hz-=t,pz=e)}function lbe(){for(var e,t=dz,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:dz=n);fz=e,oz(r)}function oz(e){sz||(cz&&=clearTimeout(cz),e-mz>24?(e<1/0&&(cz=setTimeout(az,e-gz.now()-hz)),lz&&=clearInterval(lz)):(lz||=(pz=gz.now(),setInterval(cbe,uz)),sz=1,_z(az)))}var sz,cz,lz,uz,dz,fz,pz,mz,hz,gz,_z,vz=o((()=>{sz=0,cz=0,lz=0,uz=1e3,pz=0,mz=0,hz=0,gz=typeof performance==`object`&&performance.now?performance:Date,_z=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},rz.prototype=iz.prototype={constructor:rz,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?nz():+n)+(t==null?0:+t),!this._next&&fz!==this&&(fz?fz._next=this:dz=this,fz=this),this._call=e,this._time=n,oz()},stop:function(){this._call&&(this._call=null,this._time=1/0,oz())}}}));function ube(e,t,n){var r=new rz,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(e,t,n){t=+t,n=n==null?nz():+n,r._restart(function a(o){o+=i,r._restart(a,i+=t,n),e(o)},t,n)},r.restart(e,t,n),r)}var dbe=o((()=>{vz()})),yz=o((()=>{vz(),dbe()}));function fbe(){let e=1;return()=>(e=(bz*e+xz)%Sz)/Sz}var bz,xz,Sz,pbe=o((()=>{bz=1664525,xz=1013904223,Sz=4294967296}));function mbe(e){return e.x}function hbe(e){return e.y}function gbe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=iz(d),l=QR(`tick`,`end`),u=fbe();e??=[];function d(){f(),l.call(`tick`,t),n1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i1?(l.on(e,n),t):l.on(e)}}}var Cz,wz,Tz=o((()=>{abe(),yz(),pbe(),Cz=10,wz=Math.PI*(3-Math.sqrt(5))}));function _be(){var e,t,n,r,i=qR(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=HR(e,mbe,hbe).visitAfter(d);for(r=n,i=0;i=s)){(e.data!==t||e.next)&&(d===0&&(d=YR(n),m+=d*d),f===0&&(f=YR(n),m+=f*f),m{KR(),JR(),XR(),Tz()}));function ybe(e){var t=qR(.1),n,r,i;typeof e!=`function`&&(e=qR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{JR()}));function xbe(e){var t=qR(.1),n,r,i;typeof e!=`function`&&(e=qR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{JR()})),Cbe=o((()=>{yye(),Qye(),tbe(),vbe(),JR(),Tz(),bbe(),Sbe()})),wbe=c({force:()=>Ez});function Ez(e){G.call(this,null,e)}function Tbe(e,t){return()=>e.touch(t).run()}function Ebe(e,t){let n=gbe(e),r=n.stop,i=n.restart,a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,i()),n.stop=()=>(a=!0,r()),Dz(n,t,!0).on(`end`,()=>a=!0)}function Dz(e,t,n,r){var i=yh(t.forces),a,o,s,c;for(a=0,o=Az.length;at(e,n):t)}var Oz,kz,Az,jz,Mz,Abe=o((()=>{ax(),pg(),Cbe(),Oz={center:vye,collide:Zye,nbody:_be,link:ebe,x:ybe,y:xbe},kz=`forces`,Az=[`alpha`,`alphaMin`,`alphaTarget`,`velocityDecay`,`forces`],jz=[`static`,`iterations`],Mz=[`x`,`y`,`vx`,`vy`],Ez.Definition={type:`Force`,metadata:{modifies:!0},params:[{name:`static`,type:`boolean`,default:!1},{name:`restart`,type:`boolean`,default:!1},{name:`iterations`,type:`number`,default:300},{name:`alpha`,type:`number`,default:1},{name:`alphaMin`,type:`number`,default:.001},{name:`alphaTarget`,type:`number`,default:0},{name:`velocityDecay`,type:`number`,default:.4},{name:`forces`,type:`param`,array:!0,params:[{key:{force:`center`},params:[{name:`x`,type:`number`,default:0},{name:`y`,type:`number`,default:0}]},{key:{force:`collide`},params:[{name:`radius`,type:`number`,expr:!0},{name:`strength`,type:`number`,default:.7},{name:`iterations`,type:`number`,default:1}]},{key:{force:`nbody`},params:[{name:`strength`,type:`number`,default:-30,expr:!0},{name:`theta`,type:`number`,default:.9},{name:`distanceMin`,type:`number`,default:1},{name:`distanceMax`,type:`number`}]},{key:{force:`link`},params:[{name:`links`,type:`data`},{name:`id`,type:`field`},{name:`distance`,type:`number`,default:30,expr:!0},{name:`strength`,type:`number`,expr:!0},{name:`iterations`,type:`number`,default:1}]},{key:{force:`x`},params:[{name:`strength`,type:`number`,default:.1},{name:`x`,type:`field`}]},{key:{force:`y`},params:[{name:`strength`,type:`number`,default:.1},{name:`y`,type:`field`}]}]},{name:`as`,type:`string`,array:!0,modify:!1,default:Mz}]},U(Ez,G,{transform(e,t){var n=this.value,r=t.changed(t.ADD_REM),i=e.modified(Az),a=e.iterations||300;if(n?(r&&(t.modifies(`index`),n.nodes(t.source)),(i||t.changed(t.MOD))&&Dz(n,e,0,t)):(this.value=n=Ebe(t.source,e),n.on(`tick`,Tbe(t.dataflow,this)),e.static||(r=!0,n.tick()),t.modifies(`index`)),i||r||e.modified(jz)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-n.alphaMin()**(1/a)),e.static)for(n.stop();--a>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let e=this._argops,t=0,s=e.length,c;t{}));function Bbe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function Vbe(){return this.eachAfter(Bbe)}var Hbe=o((()=>{}));function Ube(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}var Wbe=o((()=>{}));function Gbe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}var Kbe=o((()=>{}));function qbe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o{}));function Ybe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}var Xbe=o((()=>{}));function Zbe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}var Qbe=o((()=>{}));function $be(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var exe=o((()=>{}));function txe(e){for(var t=this,n=nxe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function nxe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}var rxe=o((()=>{}));function ixe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var axe=o((()=>{}));function oxe(){return Array.from(this)}var sxe=o((()=>{}));function cxe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var lxe=o((()=>{}));function uxe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}var dxe=o((()=>{}));function*fxe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i{}));function Nz(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=gxe)):t===void 0&&(t=hxe);for(var n=new Fz(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new Fz(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Pz)}function mxe(){return Nz(this).eachBefore(_xe)}function hxe(e){return e.children}function gxe(e){return Array.isArray(e)?e[1]:null}function _xe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Pz(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Fz(e){this.data=e,this.depth=this.height=0,this.parent=null}var Iz=o((()=>{Hbe(),Wbe(),Kbe(),Jbe(),Xbe(),Qbe(),exe(),rxe(),axe(),sxe(),lxe(),dxe(),pxe(),Fz.prototype=Nz.prototype={constructor:Fz,count:Vbe,each:Ube,eachAfter:qbe,eachBefore:Gbe,find:Ybe,sum:Zbe,sort:$be,path:txe,ancestors:ixe,descendants:oxe,leaves:cxe,links:uxe,copy:mxe,[Symbol.iterator]:fxe}}));function Lz(e){return e==null?null:Rz(e)}function Rz(e){if(typeof e!=`function`)throw Error();return e}var zz=o((()=>{}));function Bz(){return 0}function Vz(e){return function(){return e}}var Hz=o((()=>{}));function vxe(){let e=1;return()=>(e=(Uz*e+Wz)%Gz)/Gz}var Uz,Wz,Gz,yxe=o((()=>{Uz=1664525,Wz=1013904223,Gz=4294967296}));function bxe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function xxe(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}var Kz=o((()=>{}));function Sxe(e,t){for(var n=0,r=(e=xxe(Array.from(e),t)).length,i=[],a,o;n0&&n*n>r*r+i*i}function Yz(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*O))/(2*E):O/D);return{x:r+S+C*k,y:i+w+T*k,r:k}}var Qz=o((()=>{Kz()}));function $z(e,t,n){var r=e.x-t.x,i,a,o=e.y-t.y,s,c,l=r*r+o*o;l?(a=t.r+n.r,a*=a,c=e.r+n.r,c*=c,a>c?(i=(l+c-a)/(2*l),s=Math.sqrt(Math.max(0,c/l-i*i)),n.x=e.x-i*r-s*o,n.y=e.y-i*o+s*r):(i=(l+a-c)/(2*l),s=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-s*o,n.y=t.y+i*o+s*r)):(n.x=t.x+n.r,n.y=t.y)}function eB(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function tB(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function nB(e){this._=e,this.next=null,this.previous=null}function Exe(e,t){if(!(a=(e=bxe(e)).length))return 0;var n=e[0],r,i,a,o,s,c,l,u,d,f;if(n.x=0,n.y=0,!(a>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(a>2))return n.r+r.r;$z(r,n,i=e[2]),n=new nB(n),r=new nB(r),i=new nB(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;pack:for(c=3;c{Kz(),Qz()}));function Dxe(e){return Math.sqrt(e.value)}function Oxe(){var e=null,t=1,n=1,r=Bz;function i(i){let a=vxe();return i.x=t/2,i.y=n/2,e?i.eachBefore(iB(e)).eachAfter(aB(r,.5,a)).eachBefore(oB(1)):i.eachBefore(iB(Dxe)).eachAfter(aB(Bz,1,a)).eachAfter(aB(r,i.r/Math.min(t,n),a)).eachBefore(oB(Math.min(t,n)/(2*i.r))),i}return i.radius=function(t){return arguments.length?(e=Lz(t),i):e},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(e){return arguments.length?(r=typeof e==`function`?e:Vz(+e),i):r},i}function iB(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function aB(e,t,n){return function(r){if(i=r.children){var i,a,o=i.length,s=e(r)*t||0,c;if(s)for(a=0;a{zz(),Hz(),yxe(),rB()}));function sB(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var cB=o((()=>{}));function lB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s{}));function Axe(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(sB),i}function a(e,t){return function(r){r.children&&lB(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o{cB(),uB()}));function Mxe(e){return e.id}function Nxe(e){return e.parentId}function dB(){var e=Mxe,t=Nxe,n;function r(r){var i=Array.from(r),a=e,o=t,s,c,l,u,d,f,p,m,h=new Map;if(n!=null){let e=i.map((e,t)=>Pxe(n(e,t,r))),t=e.map(fB),s=new Set(e).add(``);for(let n of t)s.has(n)||(s.add(n),e.push(n),t.push(fB(n)),i.push(gB));a=(t,n)=>e[n],o=(e,n)=>t[n]}for(l=0,s=i.length;l=0&&(f=i[e],f.data===gB);--e)f.data=null}if(u.parent=mB,u.eachBefore(function(e){e.depth=e.parent.depth+1,--s}).eachBefore(Pz),u.parent=null,s>0)throw Error(`cycle`);return u}return r.id=function(t){return arguments.length?(e=Lz(t),r):e},r.parentId=function(e){return arguments.length?(t=Lz(e),r):t},r.path=function(e){return arguments.length?(n=Lz(e),r):n},r}function Pxe(e){e=`${e}`;let t=e.length;return pB(e,t-1)&&!pB(e,t-2)&&(e=e.slice(0,-1)),e[0]===`/`?e:`/${e}`}function fB(e){let t=e.length;if(t<2)return``;for(;--t>1&&!pB(e,t););return e.slice(0,t)}function pB(e,t){if(e[t]===`/`){let n=0;for(;t>0&&e[--t]===`\\`;)++n;if(!(n&1))return!0}return!1}var mB,hB,gB,Fxe=o((()=>{zz(),Iz(),mB={depth:-1},hB={},gB={}}));function Ixe(e,t){return e.parent===t.parent?1:2}function _B(e){var t=e.children;return t?t[0]:e.t}function vB(e){var t=e.children;return t?t[t.length-1]:e.t}function Lxe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Rxe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function zxe(e,t,n){return e.a.parent===t.parent?e.a:n}function yB(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function Bxe(e){for(var t=new yB(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new yB(a[o],o)),i.parent=n;return(t.parent=new yB(null,0)).children=[t],t}function Vxe(){var e=Ixe,t=1,n=1,r=null;function i(i){var s=Bxe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.xu.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){Rxe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=vB(o),i=_B(i),o&&i;)s=_B(s),a=vB(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(Lxe(zxe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!vB(a)&&(a.t=o,a.m+=u-l),i&&!_B(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var Hxe=o((()=>{Iz(),yB.prototype=Object.create(Fz.prototype)}));function bB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s{}));function SB(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;uv&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p{uB(),xB(),CB=(1+Math.sqrt(5))/2,wB=(function e(t){function n(e,n,r,i,a){SB(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(CB)}));function Uxe(){var e=wB,t=!1,n=1,r=1,i=[0],a=Bz,o=Bz,s=Bz,c=Bz,l=Bz;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(sB),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d{cB(),TB(),zz(),Hz()}));function Gxe(e,t,n,r,i){var a=e.children,o,s=a.length,c,l=Array(s+1);for(l[0]=c=o=0;o=t-1){var c=a[e];c.x0=r,c.y0=i,c.x1=o,c.y1=s;return}for(var d=l[e],f=n/2+d,p=e+1,m=t-1;p>>1;l[h]s-i){var v=n?(r*_+o*g)/n:o;u(e,p,g,r,i,v,s),u(p,t,_,v,i,o,s)}else{var y=n?(i*_+s*g)/n:s;u(e,p,g,r,i,o,y),u(p,t,_,r,y,o,s)}}}var Kxe=o((()=>{}));function qxe(e,t,n,r,i){(e.depth&1?bB:lB)(e,t,n,r,i)}var Jxe=o((()=>{uB(),xB()})),EB,Yxe=o((()=>{uB(),xB(),TB(),EB=(function e(t){function n(e,n,r,i,a){if((o=e._squarify)&&o.ratio===t)for(var o,s,c,l,u=-1,d,f=o.length,p=e.value;++u1?t:1)},n})(CB)})),Xxe=o((()=>{zbe(),Iz(),kxe(),rB(),Qz(),jxe(),Fxe(),Hxe(),Wxe(),Kxe(),uB(),xB(),Jxe(),TB(),Yxe()})),Zxe=c({nest:()=>OB,pack:()=>AB,partition:()=>jB,stratify:()=>MB,tree:()=>NB,treelinks:()=>PB,treemap:()=>FB});function DB(e,t,n){let r={};return e.each(e=>{let i=e.data;n(i)&&(r[t(i)]=e)}),e.lookup=r,e}function OB(e){G.call(this,null,e)}function Qxe(){let e=[],t={entries:e=>r(n(e,0),0),key:n=>(e.push(n),t)};function n(t,r){if(r>=e.length)return t;let i=t.length,a=e[r++],o={},s={},c=-1,l,u,d;for(;++ce.length)return t;let i=[];for(let e in t)i.push({key:e,values:r(t[e],n)});return i}return t}function kB(e){G.call(this,null,e)}function $xe(e,t,n){for(let r,i=0,a=t.length;i{ax(),pg(),Xxe(),OB.Definition={type:`Nest`,metadata:{treesource:!0,changes:!0},params:[{name:`keys`,type:`field`,array:!0},{name:`generate`,type:`boolean`}]},IB=e=>e.values,U(OB,G,{transform(e,t){t.source||V(`Nest transform requires an upstream data source.`);var n=e.generate,r=e.modified(),i=t.clone(),a=this.value;return(!a||r||t.changed())&&(a&&a.each(e=>{e.children&&Ob(e.data)&&i.rem.push(e.data)}),this.value=a=Nz({values:yh(e.keys).reduce((e,t)=>(e.key(t),e),Qxe()).entries(i.source)},IB),n&&a.each(e=>{e.children&&(e=Ab(e.data),i.add.push(e),i.source.push(e))}),DB(a,kb,kb)),i.source.root=a,i}}),LB=(e,t)=>e.parent===t.parent?1:2,U(kB,G,{transform(e,t){(!t.source||!t.source.root)&&V(this.constructor.name+` transform requires a backing tree data source.`);let n=this.layout(e.method),r=this.fields,i=t.source.root,a=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(Nb(e.sort,e=>e.data)),$xe(n,this.params,e),n.separation&&n.separation(e.separation===!1?Rm:LB);try{this.value=n(i)}catch(e){V(e)}return i.each(e=>eSe(e,r,a)),t.reflow(e.modified()).modifies(a).modifies(`leaf`)}}),RB=[`x`,`y`,`r`,`depth`,`children`],AB.Definition={type:`Pack`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`radius`,type:`field`,default:null},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:RB.length,default:RB}]},U(AB,kB,{layout:Oxe,params:[`radius`,`size`,`padding`],fields:RB}),zB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],jB.Definition={type:`Partition`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:zB.length,default:zB}]},U(jB,kB,{layout:Axe,params:[`size`,`round`,`padding`],fields:zB}),MB.Definition={type:`Stratify`,metadata:{treesource:!0},params:[{name:`key`,type:`field`,required:!0},{name:`parentKey`,type:`field`,required:!0}]},U(MB,G,{transform(e,t){t.source||V(`Stratify transform requires an upstream data source.`);let n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),a=!n||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),a&&(n=i.source.length?DB(dB().id(e.key).parentId(e.parentKey)(i.source),e.key,zm):DB(dB()([{}]),e.key,e.key)),i.source.root=this.value=n,i}}),BB={tidy:Vxe,cluster:Rbe},VB=[`x`,`y`,`depth`,`children`],NB.Definition={type:`Tree`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`tidy`,values:[`tidy`,`cluster`]},{name:`size`,type:`number`,array:!0,length:2},{name:`nodeSize`,type:`number`,array:!0,length:2},{name:`separation`,type:`boolean`,default:!0},{name:`as`,type:`string`,array:!0,length:VB.length,default:VB}]},U(NB,kB,{layout(e){let t=e||`tidy`;if(Ih(BB,t))return BB[t]();V(`Unrecognized Tree layout method: `+t)},params:[`size`,`nodeSize`],fields:VB}),PB.Definition={type:`TreeLinks`,metadata:{tree:!0,generates:!0,changes:!0},params:[]},U(PB,G,{transform(e,t){let n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),a={};return r||V(`TreeLinks transform requires a tree data source.`),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,e=>a[kb(e)]=1),r.each(e=>{let t=e.data,n=e.parent&&e.parent.data;n&&a[kb(t)]&&a[kb(n)]&&i.add.push(Ab({source:n,target:t}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,e=>a[kb(e)]=1),n.forEach(e=>{(a[kb(e.source)]||a[kb(e.target)])&&i.mod.push(e)})),i}}),HB={binary:Gxe,dice:lB,slice:bB,slicedice:qxe,squarify:wB,resquarify:EB},UB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],FB.Definition={type:`Treemap`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`squarify`,values:[`squarify`,`resquarify`,`binary`,`dice`,`slice`,`slicedice`]},{name:`padding`,type:`number`,default:0},{name:`paddingInner`,type:`number`,default:0},{name:`paddingOuter`,type:`number`,default:0},{name:`paddingTop`,type:`number`,default:0},{name:`paddingRight`,type:`number`,default:0},{name:`paddingBottom`,type:`number`,default:0},{name:`paddingLeft`,type:`number`,default:0},{name:`ratio`,type:`number`,default:1.618033988749895},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:UB.length,default:UB}]},U(FB,kB,{layout(){let e=Uxe();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{Ih(HB,t)?e.tile(HB[t]):V(`Unrecognized Treemap layout method: `+t)},e},params:[`method`,`ratio`,`size`,`round`,`padding`,`paddingInner`,`paddingOuter`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],fields:UB})})),nSe=c({label:()=>YB});function rSe(e,t){let n=e.bitmap();return(t||[]).forEach(t=>n.set(e(t.boundary[0]),e(t.boundary[3]))),[n,void 0]}function iSe(e,t,n,r,i){let a=e.width,o=e.height,s=r||i,c=VC(a,o).getContext(`2d`),l=VC(a,o).getContext(`2d`),u=s&&VC(a,o).getContext(`2d`);n.forEach(e=>GB(c,e,!1)),GB(l,t,!1),s&&GB(u,t,!0);let d=WB(c,a,o),f=WB(l,a,o),p=s&&WB(u,a,o),m=e.bitmap(),h=s&&e.bitmap(),g,_,v,y,b,x,S,C;for(_=0;_{t.items.forEach(t=>GB(e,t.items,n))}):BA[r].draw(e,{items:n?t.map(aSe):t})}function aSe(e){let t=Mb(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:`#000`,fillOpacity:0}:t}function oSe(e,t){let n=new Uint32Array(~~((e*t+$B)/$B));function r(e,t){n[e]|=t}function i(e,t){n[e]&=t}return{array:n,get:(t,r)=>{let i=r*e+t;return n[i>>>ZB]&1<<(i&QB)},set:(t,n)=>{let i=n*e+t;r(i>>>ZB,1<<(i&QB))},clear:(t,n)=>{let r=n*e+t;i(r>>>ZB,~(1<<(r&QB)))},getRange:(t,r,i,a)=>{let o=a,s,c,l,u;for(;o>=r;--o)if(s=o*e+t,c=o*e+i,l=s>>>ZB,u=c>>>ZB,l===u){if(n[l]&eV[s&QB]&tV[(c&QB)+1])return!0}else{if(n[l]&eV[s&QB]||n[u]&tV[(c&QB)+1])return!0;for(let e=l+1;e{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+i,c=o>>>ZB,l=s>>>ZB,c===l)r(c,eV[o&QB]&tV[(s&QB)+1]);else for(r(c,eV[o&QB]),r(l,tV[(s&QB)+1]),u=c+1;u{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+r,c=o>>>ZB,l=s>>>ZB,c===l)i(c,tV[o&QB]|eV[(s&QB)+1]);else for(i(c,tV[o&QB]),i(l,eV[(s&QB)+1]),u=c+1;un<0||r<0||a>=t||i>=e}}function sSe(e,t,n){let r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),a=~~((t+2*n+r)/r),o=e=>~~((e+n)/r);return o.invert=e=>e*r-n,o.bitmap=()=>oSe(i,a),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function cSe(e,t,n,r){let i=e.width,a=e.height;return function(e){let t=e.datum.datum.items[r].items,n=t.length,o=e.datum.fontSize,s=RA.width(e.datum,e.datum.text),c=0,l,u,d,f,p,m,h;for(let r=0;r=c&&(c=h,e.x=p,e.y=m);return p=s/2,m=o/2,l=e.x-p,u=e.x+p,d=e.y-m,f=e.y+m,e.align=`center`,l<0&&u<=i?e.align=`left`:0<=l&&ii||t-(o=r/2)<0||t+o>a}function qB(e,t,n,r,i,a,o,s){let c=i*a/(r*2),l=e(t-c),u=e(t+c),d=e(n-(a/=2)),f=e(n+a);return o.outOfBounds(l,d,u,f)||o.getRange(l,d,u,f)||s&&s.getRange(l,d,u,f)}function lSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1];function c(t,n,r,c,l){let u=e.invert(t),d=e.invert(n),f=r,p=a,m;if(!KB(u,d,c,l,i,a)&&!qB(e,u,d,l,c,f,o,s)&&!qB(e,u,d,l,c,l,o,null)){for(;p-f>=1;)m=(f+p)/2,qB(e,u,d,l,c,m,o,s)?p=m:f=m;if(f>r)return[u,d,f,!0]}}return function(t){let s=t.datum.datum.items[r].items,l=s.length,u=t.datum.fontSize,d=RA.width(t.datum,t.datum.text),f=n?u:0,p=!1,m=!1,h=0,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(let r=0;r_&&(M=g,g=_,_=M),v>y&&(M=v,v=y,y=M),w=e(g),E=e(_),T=~~((w+E)/2),D=e(v),k=e(y),O=~~((D+k)/2),S=T;S>=w;--S)for(C=O;C>=D;--C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);for(S=T;S<=E;++S)for(C=O;C<=k;++C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);!p&&!n&&(A=Math.abs(_-g+y-v),b=(g+_)/2,x=(v+y)/2,A>=h&&!KB(b,x,d,u,i,a)&&!qB(e,b,x,u,d,u,o,null)&&(h=A,t.x=b,t.y=x,m=!0))}return p||m?(b=d/2,x=u/2,o.setRange(e(t.x-b),e(t.y-x),e(t.x+b),e(t.y+x)),t.align=`center`,t.baseline=`middle`,!0):!1}}function uSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=e.bitmap();return function(t){let l=t.datum.datum.items[r].items,u=l.length,d=t.datum.fontSize,f=RA.width(t.datum,t.datum.text),p=[],m=n?d:0,h=!1,g=!1,_=0,v,y,b,x,S,C,w,T,E,D,O,k;for(let r=0;r=1;)O=(E+D)/2,qB(e,S,C,d,f,O,o,s)?D=O:E=O;E>m&&(t.x=S,t.y=C,m=E,h=!0)}}!h&&!n&&(k=Math.abs(y-v+x-b),S=(v+y)/2,C=(b+x)/2,k>=_&&!KB(S,C,f,d,i,a)&&!qB(e,S,C,d,f,d,o,null)&&(_=k,t.x=S,t.y=C,g=!0))}return h||g?(S=f/2,C=d/2,o.setRange(e(t.x-S),e(t.y-C),e(t.x+S),e(t.y+C)),t.align=`center`,t.baseline=`middle`,!0):!1}}function dSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=r.length;return function(t){let l=t.boundary,u=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>a)return!1;let d=t.textWidth??0,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;for(let i=0;i>>2&3)-1,m=f===0&&p===0||r[i]<0,h=f&&p?Math.SQRT1_2:1,g=r[i]<0?-1:1,_=l[1+f]+r[i]*f*h,S=l[4+p]+g*u*p/2+r[i]*p*h,y=S-u/2,b=S+u/2,C=e(_),T=e(y),E=e(b),!d)if(JB(C,C,T,E,o,s,_,_,y,b,l,m))d=RA.width(t.datum,t.datum.text);else continue;if(x=_+g*d*f/2,_=x-d/2,v=x+d/2,C=e(_),w=e(v),JB(C,w,T,E,o,s,_,v,y,b,l,m))return t.x=f?f*g<0?v:_:x,t.y=p?p*g<0?b:y:S,t.align=iV[f*g+1],t.baseline=aV[p*g+1],o.setRange(C,T,w,E),!0}return!1}}function JB(e,t,n,r,i,a,o,s,c,l,u,d){return!(i.outOfBounds(e,n,t,r)||(d&&a||i).getRange(e,n,t,r))}function fSe(e,t,n,r,i,a,o,s,c,l,u){if(!e.length)return e;let d=Math.max(r.length,i.length),f=pSe(r,d),p=mSe(i,d),m=hSe(e[0].datum),h=m===`group`&&e[0].datum.items[c].marktype,g=h===`area`,_=gSe(m,h,s,c),v=l===null||l===1/0,y=g&&u===`naive`,b=-1,x=-1,S=e.map(e=>{let t=v?RA.width(e,e.text):void 0;return b=Math.max(b,t),x=Math.max(x,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:_(e),textWidth:t}});l=l===null||l===1/0?Math.max(b,x)+Math.max(...r):l;let C=sSe(t[0],t[1],l),w;if(!y){n&&S.sort((e,t)=>n(e.datum,t.datum));let t=!1;for(let e=0;ee.datum);w=a.length||r?iSe(C,r||[],a,t,g):rSe(C,o&&S)}let T=g?sV[u](C,w,o,c):dSe(C,w,p,f);return S.forEach(e=>e.opacity=+T(e)),S}function pSe(e,t){let n=new Float64Array(t),r=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?e===`line`||e===`area`?e=>i(e.datum):t===`line`?e=>{let t=e.datum.items[r].items;return i(t.length?t[n===`start`?0:t.length-1]:{x:NaN,y:NaN})}:e=>{let t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:i}function YB(e){G.call(this,null,e)}var XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV,oV,sV,cV,lV,_Se=o((()=>{tM(),UC(),ax(),pg(),XB=4278190080,ZB=5,QB=31,$B=32,eV=new Uint32Array(33),tV=new Uint32Array(33),tV[0]=0,eV[0]=~tV[0];for(let e=1;e<=$B;++e)tV[e]=tV[e-1]<<1|1,eV[e]=~tV[e];nV=[-1,-1,1,1],rV=[-1,1,-1,1],iV=[`right`,`center`,`left`],aV=[`bottom`,`middle`,`top`],oV={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},sV={naive:cSe,"reduced-search":lSe,floodfill:uSe},cV=[`x`,`y`,`opacity`,`align`,`baseline`],lV=[`top-left`,`left`,`bottom-left`,`top`,`bottom`,`top-right`,`right`,`bottom-right`],YB.Definition={type:`Label`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`sort`,type:`compare`},{name:`anchor`,type:`string`,array:!0,default:lV},{name:`offset`,type:`number`,array:!0,default:[1]},{name:`padding`,type:`number`,default:0,null:!0},{name:`lineAnchor`,type:`string`,values:[`start`,`end`],default:`end`},{name:`markIndex`,type:`number`,default:0},{name:`avoidBaseMark`,type:`boolean`,default:!0},{name:`avoidMarks`,type:`data`,array:!0},{name:`method`,type:`string`,default:`naive`},{name:`as`,type:`string`,array:!0,length:cV.length,default:cV}]},U(YB,G,{transform(e,t){function n(n){let r=e[n];return Sh(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||n(`sort`)))return;(!e.size||e.size.length!==2)&&V(`Size parameter should be specified as a [width, height] array.`);let i=e.as||cV;return fSe(t.materialize(t.SOURCE).source||[],e.size,e.sort,yh(e.offset==null?1:e.offset),yh(e.anchor||lV),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||`end`,e.markIndex||0,e.padding===void 0?0:e.padding,e.method||`naive`).forEach(e=>{let t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline}),t.reflow(r).modifies(i)}})})),vSe=c({loess:()=>dV,regression:()=>fV});function uV(e,t){var n=[],r=function(e){return e(s)},i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;a{Ix(),ax(),pg(),dV.Definition={type:`Loess`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`bandwidth`,type:`number`,default:.3},{name:`as`,type:`string`,array:!0}]},U(dV,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=uV(r,e.groupby),a=(e.groupby||[]).map(Cm),o=a.length,s=e.as||[Cm(e.x),Cm(e.y)],c=[];i.forEach(t=>{Fle(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{let n={};for(let e=0;ee===`poly`?t:e===`quad`?2:1,fV.Definition={type:`Regression`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`string`,default:`linear`,values:Object.keys(pV)},{name:`order`,type:`number`,default:3},{name:`extent`,type:`number`,array:!0,length:2},{name:`params`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0}]},U(fV,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=uV(r,e.groupby),a=(e.groupby||[]).map(Cm),o=e.method||`linear`,s=e.order==null?3:e.order,c=mV(o,s),l=e.as||[Cm(e.x),Cm(e.y)],u=pV[o],d=[],f=e.extent;Ih(pV,o)||V(`Invalid regression method: `+o),f!=null&&o===`log`&&f[0]<=0&&(t.dataflow.warn(`Ignoring extent with values <= 0 for log regression.`),f=null),i.forEach(n=>{if(n.length<=c){t.dataflow.warn(`Skipping regression with more parameters than data points.`);return}let r=u(n,e.x,e.y,s);if(e.params){d.push(Ab({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));return}let i=f||Ph(n,e.x),p=e=>{let t={};for(let e=0;ep([e,r.predict(e)])):Ax(r.predict,i,25,200).forEach(p)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=d}return n}})}));function hV(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(dl==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);dl==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d{gV=11102230246251565e-32,_V=134217729,vV=3.000000000000001*gV}));function xSe(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=_V*T,p=f-(f-T),m=T-p,f=_V*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=_V*D,p=f-(f-D),m=D-p,f=_V*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,wV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,wV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,wV[2]=v-(w-d)+(_-d),wV[3]=w;let k=bSe(4,wV),A=SV*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=CV*o+vV*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=_V*s,p=f-(f-s),m=s-p,f=_V*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=_V*c,p=f-(f-c),m=c-p,f=_V*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,OV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,OV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,OV[2]=v-(w-d)+(_-d),OV[3]=w;let j=hV(4,wV,4,OV,TV);b=T*u,f=_V*T,p=f-(f-T),m=T-p,f=_V*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=_V*D,p=f-(f-D),m=D-p,f=_V*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,OV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,OV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,OV[2]=v-(w-d)+(_-d),OV[3]=w;let M=hV(j,TV,4,OV,EV);b=s*u,f=_V*s,p=f-(f-s),m=s-p,f=_V*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=_V*c,p=f-(f-c),m=c-p,f=_V*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,OV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,OV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,OV[2]=v-(w-d)+(_-d),OV[3]=w;let ee=hV(M,EV,4,OV,DV);return DV[ee-1]}function bV(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=xV*l?c:-xSe(e,t,n,r,i,a,l)}var xV,SV,CV,wV,TV,EV,DV,OV,SSe=o((()=>{yV(),xV=(3+16*gV)*gV,SV=(2+12*gV)*gV,CV=(9+64*gV)*gV*gV,wV=K(4),TV=K(8),EV=K(12),DV=K(16),OV=K(4)})),CSe=o((()=>{yV(),(7+56*gV)*gV,(3+28*gV)*gV,(26+288*gV)*gV*gV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(8),K(8),K(8),K(4),K(8),K(8),K(16),K(12),K(192),K(192)})),wSe=o((()=>{yV(),(10+96*gV)*gV,(4+48*gV)*gV,(44+576*gV)*gV*gV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(4),K(4),K(4),K(8),K(16),K(16),K(16),K(32),K(32),K(48),K(64),K(1152),K(1152)})),TSe=o((()=>{yV(),(16+224*gV)*gV,(5+72*gV)*gV,(71+1408*gV)*gV*gV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(1152),K(1152),K(1152),K(1152),K(1152),K(2304),K(2304),K(3456),K(5760),K(8),K(8),K(8),K(16),K(24),K(48),K(48),K(96),K(192),K(384),K(384),K(384),K(768),K(96),K(96),K(96),K(1152)})),ESe=o((()=>{SSe(),CSe(),wSe(),TSe()}));function DSe(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function kV(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function OSe(e,t,n,r,i,a,o,s){let c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,p=a-s,m=c*c+l*l,h=u*u+d*d,g=f*f+p*p;return c*(d*g-h*p)-l*(u*g-h*f)+m*(u*p-d*f)<0}function kSe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),p=(l*u-s*d)*f,m=(o*d-c*u)*f;return p*p+m*m}function ASe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c);return{x:e+(l*u-s*d)*f,y:t+(o*d-c*u)*f}}function AV(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let r=e[i],a=t[r],o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+r>>1,a=n+1,o=r;jV(e,i,a),t[e[n]]>t[e[r]]&&jV(e,n,r),t[e[a]]>t[e[r]]&&jV(e,a,r),t[e[n]]>t[e[a]]&&jV(e,n,a);let s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]c);if(o=o-n?(AV(e,t,a,r),AV(e,t,n,o-1)):(AV(e,t,n,o-1),AV(e,t,a,r))}}function jV(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function jSe(e){return e[0]}function MSe(e){return e[1]}var MV,NV,PV,NSe=o((()=>{ESe(),MV=2**-52,NV=new Uint32Array(512),PV=class e{static from(t,n=jSe,r=MSe){let i=t.length,a=new Float64Array(i*2);for(let e=0;e>1;if(t>0&&typeof e[0]!=`number`)throw Error(`Expected coords to contain numbers.`);this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1,o=1/0,s=1/0,c=-1/0,l=-1/0;for(let t=0;tc&&(c=n),r>l&&(l=r),this._ids[t]=t}let u=(o+c)/2,d=(s+l)/2,f=0,p=0,m=0;for(let t=0,n=1/0;t0&&(p=t,n=r)}let _=e[2*p],v=e[2*p+1],y=1/0;for(let t=0;tr&&(t[n++]=i,r=a)}this.hull=t.subarray(0,n),this.triangles=new Uint32Array,this.halfedges=new Int32Array;return}if(bV(h,g,_,v,b,x)<0){let e=p,t=_,n=v;p=m,_=b,v=x,m=e,b=t,x=n}let S=ASe(h,g,_,v,b,x);this._cx=S.x,this._cy=S.y;for(let t=0;t0&&Math.abs(l-o)<=MV&&Math.abs(u-s)<=MV||(o=l,s=u,c===f||c===p||c===m))continue;let d=0;for(let e=0,t=this._hashKey(l,u);e=0;)if(h=g,h===d){h=-1;break}if(h===-1)continue;let _=this._addTriangle(h,c,n[h],-1,-1,r[h]);r[c]=this._legalize(_+2),r[h]=_,C++;let v=n[h];for(;g=n[v],bV(l,u,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)_=this._addTriangle(v,c,g,r[c],-1,r[v]),r[c]=this._legalize(_+2),n[v]=v,C--,v=g;if(h===d)for(;g=t[h],bV(l,u,e[2*g],e[2*g+1],e[2*h],e[2*h+1])<0;)_=this._addTriangle(g,c,h,-1,r[h],r[g]),this._legalize(_+2),r[g]=_,n[h]=h,C--,h=g;this._hullStart=t[c]=h,n[h]=t[v]=c,n[c]=v,i[this._hashKey(l,u)]=c,i[this._hashKey(e[2*h],e[2*h+1])]=h}this.hull=new Uint32Array(C);for(let e=0,t=this._hullStart;e{FV=1e-6,IV=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=``}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,i=t;if(n<0)throw Error(`negative radius`);this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>FV||Math.abs(this._y1-i)>FV)&&(this._+=`L`+r+`,`+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}})),RV,zV=o((()=>{RV=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}})),BV,VV=o((()=>{LV(),zV(),BV=class{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((i=+i)>=(n=+n)))throw Error(`invalid bounds`);this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i,a,o=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r=0,s=0,c=n.length,l,u;r1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t1e-10)return!1}return!0}function LSe(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}function RSe(e,t,n,r){let i=e.length,a=new Float64Array(i*2);for(let o=0;o{NSe(),LV(),zV(),VV(),HV=2*Math.PI,UV=Math.pow,WV=class e{static from(t,n=PSe,r=FSe,i){return new e(`length`in t?RSe(t,n,r,i):Float64Array.from(zSe(t,n,r,i)))}constructor(e){this._delaunator=new PV(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&ISe(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);let e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new BV(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){let t=o.indexOf(e);t>0&&(yield o[t-1]),t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){let{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let l=e,u=UV(t-c[e*2],2)+UV(n-c[e*2+1],2),d=r[e],f=d;do{let r=s[f],d=UV(t-c[r*2],2)+UV(n-c[r*2+1],2);if(d{BSe(),VV()})),HSe=c({voronoi:()=>GV});function GV(e){G.call(this,null,e)}function USe(e){let t=e[0][0],n=e[0][1],r=e.length-1;for(;e[r][0]===t&&e[r][1]===n;--r);return`M`+e.slice(0,r+1).join(`L`)+`Z`}function WSe(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}var KV,GSe=o((()=>{ax(),pg(),VSe(),GV.Definition={type:`Voronoi`,metadata:{modifies:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`size`,type:`number`,array:!0,length:2},{name:`extent`,type:`array`,array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:`number`,array:!0,length:2}},{name:`as`,type:`string`,default:`path`}]},KV=[-1e5,-1e5,1e5,1e5],U(GV,G,{transform(e,t){let n=e.as||`path`,r=t.source;if(!r||!r.length)return t;let i=e.size;i=i?[0,0,i[0],i[1]]:(i=e.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:KV;let a=this.value=WV.from(r,e.x,e.y).voronoi(i);for(let e=0,t=r.length;eYV});function qSe(){var e=[256,256],t,n,r,i,a,o,s,c=qV,l=[],u=Math.random,d={};d.layout=function(){for(var c=f(VC()),d=$Se((e[0]>>5)*e[1]),m=null,h=l.length,g=-1,_=[],v=l.map(e=>({text:t(e),font:n(e),style:i(e),weight:a(e),rotate:o(e),size:~~(r(e)+1e-14),padding:s(e),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:e})).sort((e,t)=>t.size-e.size);++g>1,y.y=e[1]*(u()+.5)>>1,JSe(c,y,v,g),y.hasText&&p(d,y,m)&&(_.push(y),m?XSe(m,y):m=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=e[0]>>1,y.y-=e[1]>>1)}return _};function f(e){e.width=e.height=1;var t=Math.sqrt(e.getContext(`2d`).getImageData(0,0,1,1).data.length>>2);e.width=(ZV<<5)/t,e.height=QV/t;var n=e.getContext(`2d`);return n.fillStyle=n.strokeStyle=`red`,n.textAlign=`center`,{context:n,ratio:t}}function p(t,n,r){for(var i=n.x,a=n.y,o=Math.hypot(e[0],e[1]),s=c(e),l=u()<.5?1:-1,d=-l,f,p,m;(f=s(d+=l))&&(p=~~f[0],m=~~f[1],!(Math.min(Math.abs(p),Math.abs(m))>=o));)if(n.x=i+p,n.y=a+m,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>e[0]||n.y+n.y1>e[1])&&(!r||!YSe(n,t,e[0]))&&(!r||ZSe(n,r))){for(var h=n.sprite,g=n.width>>5,_=e[0]>>5,v=n.x-(g<<4),y=v&127,b=32-y,x=n.y1-n.y0,S=(n.y+n.y0)*_+(v>>5),C,w=0;w>>y:0);S+=_}return n.sprite=null,!0}return!1}return d.words=function(e){return arguments.length?(l=e,d):l},d.size=function(t){return arguments.length?(e=[+t[0],+t[1]],d):e},d.font=function(e){return arguments.length?(n=JV(e),d):n},d.fontStyle=function(e){return arguments.length?(i=JV(e),d):i},d.fontWeight=function(e){return arguments.length?(a=JV(e),d):a},d.rotate=function(e){return arguments.length?(o=JV(e),d):o},d.text=function(e){return arguments.length?(t=JV(e),d):t},d.spiral=function(e){return arguments.length?(c=$V[e]||e,d):c},d.fontSize=function(e){return arguments.length?(r=JV(e),d):r},d.padding=function(e){return arguments.length?(s=JV(e),d):s},d.random=function(e){return arguments.length?(u=e,d):u},d}function JSe(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,(ZV<<5)/a,QV/a);var o=0,s=0,c=0,l=n.length,u,d,f,p,m;for(--r;++r>5<<5,f=~~Math.max(Math.abs(v+y),Math.abs(v-y))}else u=u+31>>5<<5;if(f>c&&(c=f),o+u>=ZV<<5&&(o=0,s+=c,c=0),s+f>=QV)break;i.translate((o+(u>>1))/a,(s+(f>>1))/a),t.rotate&&i.rotate(t.rotate*XV),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=u,t.height=f,t.xoff=o,t.yoff=s,t.x1=u>>1,t.y1=f>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=u}for(var x=i.getImageData(0,0,(ZV<<5)/a,QV/a).data,S=[];--r>=0;)if(t=n[r],t.hasText){for(u=t.width,d=u>>5,f=t.y1-t.y0,p=0;p>5),E=x[(s+m)*(ZV<<5)+(o+p)<<2]?1<<31-p%32:0;S[T]|=E,C|=E}C?w=m:(t.y0++,f--,m--,s++)}t.y1=t.y0+w,t.sprite=S.slice(0,(t.y1-t.y0)*d)}}}function YSe(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,a=e.x-(i<<4),o=a&127,s=32-o,c=e.y1-e.y0,l=(e.y+e.y0)*n+(a>>5),u,d=0;d>>o:0))&t[l+f])return!0;l+=n}return!1}function XSe(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function ZSe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0{UC(),ax(),pg(),FO(),Ix(),XV=Math.PI/180,ZV=64,QV=2048,$V={archimedean:qV,rectangular:QSe},eH=[`x`,`y`,`font`,`fontSize`,`fontStyle`,`fontWeight`,`angle`],tH=[`text`,`font`,`rotate`,`fontSize`,`fontStyle`,`fontWeight`],YV.Definition={type:`Wordcloud`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2},{name:`font`,type:`string`,expr:!0,default:`sans-serif`},{name:`fontStyle`,type:`string`,expr:!0,default:`normal`},{name:`fontWeight`,type:`string`,expr:!0,default:`normal`},{name:`fontSize`,type:`number`,expr:!0,default:14},{name:`fontSizeRange`,type:`number`,array:`nullable`,default:[10,50]},{name:`rotate`,type:`number`,expr:!0,default:0},{name:`text`,type:`field`},{name:`spiral`,type:`string`,values:[`archimedean`,`rectangular`]},{name:`padding`,type:`number`,expr:!0},{name:`as`,type:`string`,array:!0,length:7,default:eH}]},U(YV,G,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&V(`Wordcloud size dimensions must be non-zero.`);function n(n){let r=e[n];return Sh(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||tH.some(n)))return;let i=t.materialize(t.SOURCE).source,a=this.value,o=e.as||eH,s=e.fontSize||14,c;if(Sh(s)?c=e.fontSizeRange:s=Ah(s),c){let e=s,t=TD(`sqrt`)().domain(Ph(i,e)).range(c);s=n=>t(e(n))}i.forEach(e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0});let l=a.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||`archimedean`).rotate(e.rotate||0).font(e.font||`sans-serif`).fontStyle(e.fontStyle||`normal`).fontWeight(e.fontWeight||`normal`).fontSize(s).random(jx).layout(),u=a.size(),d=u[0]>>1,f=u[1]>>1,p=l.length;for(let e=0,t,n;eaH,resolvefilter:()=>oH});function nCe(){let e=8,t=[],n=lH(0),r=nH(0,e),i=nH(0,e);return{data:()=>t,seen:()=>n=rCe(n,t.length),add(e){for(let n=0,r=t.length,i=e.length,a;nt.length,curr:()=>r,prev:()=>i,reset:e=>i[e]=r[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){r[e]|=t},clear(e,t){r[e]&=~t},resize(t,n){(t>r.length||n>e)&&(e=Math.max(n,e),r=nH(t,e,r),i=nH(t,e))}}}function rCe(e,t,n){return e.length>=t?e:(n||=new e.constructor(t),n.set(e),n)}function nH(e,t,n){let r=(t<257?sH:t<65537?cH:lH)(e);return n&&r.set(n),r}function rH(e,t,n){let r=1<0)for(f=0;fe,size:()=>n}}function iCe(e,t){return e.sort.call(t,(t,n)=>{let r=e[t],i=e[n];return ri)}),Vae(e,t)}function aCe(e,t,n,r,i,a,o,s,c){let l=0,u=0,d;for(d=0;l{g_(),ax(),pg(),sH=e=>new Uint8Array(e),cH=e=>new Uint16Array(e),lH=e=>new Uint32Array(e),aH.Definition={type:`CrossFilter`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`query`,type:`array`,array:!0,required:!0,content:{type:`number`,array:!0,length:2}}]},U(aH,G,{transform(e,t){return this._dims?e.modified(`fields`)||e.fields.some(e=>t.modified(e.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,r=e.query,i=this._indices={},a=this._dims=[],o=r.length,s=0,c,l;for(;s{let e=i.remove(t,n);for(let t in r)r[t].reindex(e)})},update(e,t,n){let r=this._dims,i=e.query,a=t.stamp,o=r.length,s=0,c,l;for(n.filters=0,l=0;lp)for(g=p,_=Math.min(d,m);g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;if(f>m)for(g=Math.max(d,m),_=f;g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;else if(fu)for(p=u,m=Math.min(c,d);pd)for(p=Math.max(c,d),m=l;ps[e]&n?null:o[e];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,e=>{let t=s[e]&n;return!t&&t^c[e]&n?o[e]:null}),a.filter(a.REM,e=>{let t=s[e]&n;return t&&!(t^(t^c[e]&n))?o[e]:null})):(a.filter(a.ADD,l),a.filter(a.REM,e=>(s[e]&n)===i?o[e]:null)),a.filter(a.SOURCE,e=>l(e._index))}})}));function uH(e){this.type=e}function sCe(e){switch(e.type){case YH:return e.elements;case XH:case $H:return[e.left,e.right];case ZH:return[e.callee].concat(e.arguments);case QH:return[e.test,e.consequent,e.alternate];case eU:return[e.object,e.property];case tU:return e.properties;case qH:return[e.key,e.value];case nU:return[e.argument];case JH:case KH:case GH:default:return[]}}function dH(e,t){if(!e)throw Error(`ASSERT: `+t)}function fH(e){return e>=48&&e<=57}function pH(e){return`0123456789abcdefABCDEF`.includes(e)}function mH(e){return`01234567`.includes(e)}function cCe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function hH(e){return e===10||e===13||e===8232||e===8233}function gH(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&zU.test(String.fromCharCode(e))}function _H(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&BU.test(String.fromCharCode(e))}function vH(){for(;q1114111||e!==`}`)&&jH({},DU,LU),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function bH(){var e=iU.charCodeAt(q++),t=String.fromCharCode(e);for(e===92&&(iU.charCodeAt(q)!==117&&jH({},DU,LU),++q,e=yH(`u`),(!e||e===`\\`||!gH(e.charCodeAt(0)))&&jH({},DU,LU),t=e);q>>=`)return q+=4,{type:pU,value:o,start:e,end:q};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return q+=3,{type:pU,value:a,start:e,end:q};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return q+=2,{type:pU,value:i,start:e,end:q};if(i===`//`&&jH({},DU,LU),`<>=!+-*%&|^/`.includes(r))return++q,{type:pU,value:r,start:e,end:q};jH({},DU,LU)}function fCe(e){let t=``;for(;q{if(parseInt(t,16)<=1114111)return`x`;jH({},NU)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{jH({},NU)}try{return new RegExp(e,t)}catch{return null}}function gCe(){var e=iU[q],t,n,r,i;for(dH(e===`/`,`Regular expression literal must start with a slash`),t=iU[q++],n=!1,r=!1;q=0&&jH({},NU,n),{value:n,literal:t}}function vCe(){var e,t,n,r;return oU=null,vH(),e=q,t=gCe(),n=_Ce(),r=hCe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:q}}function yCe(e){return e.type===lU||e.type===uU||e.type===sU||e.type===dU}function CH(){if(vH(),q>=aU)return{type:cU,start:q,end:q};let e=iU.charCodeAt(q);return gH(e)?dCe():e===40||e===41||e===59?xH():e===39||e===34?mCe():e===46?fH(iU.charCodeAt(q+1))?SH():xH():fH(e)?SH():xH()}function wH(){let e=oU;return q=e.end,oU=CH(),q=e.end,e}function TH(){let e=q;oU=CH(),q=e}function bCe(e){let t=new uH(gU);return t.elements=e,t}function EH(e,t,n){let r=new uH(e===`||`||e===`&&`?SU:_U);return r.operator=e,r.left=t,r.right=n,r}function xCe(e,t){let n=new uH(vU);return n.callee=e,n.arguments=t,n}function SCe(e,t,n){let r=new uH(yU);return r.test=e,r.consequent=t,r.alternate=n,r}function DH(e){let t=new uH(bU);return t.name=e,t}function OH(e){let t=new uH(xU);return t.value=e.value,t.raw=iU.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function kH(e,t,n){let r=new uH(CU);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function CCe(e){let t=new uH(wU);return t.properties=e,t}function AH(e,t,n){let r=new uH(TU);return r.key=t,r.value=n,r.kind=e,r}function wCe(e,t){let n=new uH(EU);return n.operator=e,n.argument=t,n.prefix=!0,n}function jH(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(dH(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function FCe(){var e=oU,t,n,r,i,a,o,s,c=RH(),l;if(r=oU,i=zH(r),i===0)return c;for(r.prec=i,wH(),t=[e,oU],o=RH(),a=[c,r,o];(i=zH(oU))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=EH(s,c,o),a.push(n);r=wH(),r.prec=i,a.push(r),t.push(oU),n=RH(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=EH(a[l-1].value,a[l-2],n),l-=2;return n}function BH(){var e=FCe(),t,n;return PH(`?`)&&(wH(),t=BH(),NH(`:`),n=BH(),e=SCe(e,t,n)),e}function VH(){let e=BH();if(PH(`,`))throw Error(RU);return e}function HH(e){iU=e,q=0,aU=iU.length,oU=null,TH();let t=VH();if(oU.type!==cU)throw Error(`Unexpect token after expression.`);return t}function UH(e){function t(t,n,r,i){let a=e(n[0]);return r&&(a=r+`(`+a+`)`,r.lastIndexOf(`new `,0)===0&&(a=`(`+a+`)`)),a+`.`+t+(i<0?``:i===0?`()`:`(`+n.slice(1).map(e).join(`,`)+`)`)}function n(e,n,r){return i=>t(e,i,n,r)}let r=`new Date`,i=`String`,a=`RegExp`;return{isNaN:`Number.isNaN`,isFinite:`Number.isFinite`,abs:`Math.abs`,acos:`Math.acos`,asin:`Math.asin`,atan:`Math.atan`,atan2:`Math.atan2`,ceil:`Math.ceil`,cos:`Math.cos`,exp:`Math.exp`,floor:`Math.floor`,hypot:`Math.hypot`,log:`Math.log`,max:`Math.max`,min:`Math.min`,pow:`Math.pow`,random:`Math.random`,round:`Math.round`,sin:`Math.sin`,sqrt:`Math.sqrt`,tan:`Math.tan`,clamp:function(t){t.length<3&&V(`Missing arguments to clamp function.`),t.length>3&&V(`Too many arguments to clamp function.`);let n=t.map(e);return`Math.max(`+n[1]+`, Math.min(`+n[2]+`,`+n[0]+`))`},now:`Date.now`,utc:`Date.UTC`,datetime:r,date:n(`getDate`,r,0),day:n(`getDay`,r,0),year:n(`getFullYear`,r,0),month:n(`getMonth`,r,0),hours:n(`getHours`,r,0),minutes:n(`getMinutes`,r,0),seconds:n(`getSeconds`,r,0),milliseconds:n(`getMilliseconds`,r,0),time:n(`getTime`,r,0),timezoneoffset:n(`getTimezoneOffset`,r,0),utcdate:n(`getUTCDate`,r,0),utcday:n(`getUTCDay`,r,0),utcyear:n(`getUTCFullYear`,r,0),utcmonth:n(`getUTCMonth`,r,0),utchours:n(`getUTCHours`,r,0),utcminutes:n(`getUTCMinutes`,r,0),utcseconds:n(`getUTCSeconds`,r,0),utcmilliseconds:n(`getUTCMilliseconds`,r,0),length:n(`length`,null,-1),parseFloat:`parseFloat`,parseInt:`parseInt`,upper:n(`toUpperCase`,i,0),lower:n(`toLowerCase`,i,0),substring:n(`substring`,i),split:n(`split`,i),trim:n(`trim`,i,0),btoa:`btoa`,atob:`atob`,encodeURIComponent:`encodeURIComponent`,regexp:a,test:n(`test`,a),if:function(t){t.length<3&&V(`Missing arguments to if function.`),t.length>3&&V(`Too many arguments to if function.`);let n=t.map(e);return`(`+n[0]+`?`+n[1]+`:`+n[2]+`)`}}}function ICe(e){let t=e&&e.length-1;return t&&(e[0]===`"`&&e[t]===`"`||e[0]===`'`&&e[t]===`'`)?e.slice(1,-1):e}function WH(e){e||={};let t=e.allowed?ug(e.allowed):{},n=e.forbidden?ug(e.forbidden):{},r=e.constants||UU,i=(e.functions||UH)(d),a=e.globalvar,o=e.fieldvar,s=Sh(a)?a:e=>`${a}["${e}"]`,c={},l={},u=0;function d(e){if(Yh(e))return e;let t=f[e.type];return t??V(`Unsupported type: `+e.type),t(e)}let f={Literal:e=>e.raw,Identifier:e=>{let i=e.name;return u>0?i:Ih(n,i)?V(`Illegal identifier: `+i):Ih(r,i)?r[i]:Ih(t,i)?i:(c[i]=1,s(i))},MemberExpression:e=>{let t=!e.computed,n=d(e.object);t&&(u+=1);let r=d(e.property);return n===o&&(l[ICe(r)]=1),t&&--u,n+(t?`.`+r:`[`+r+`]`)},CallExpression:e=>{e.callee.type!==`Identifier`&&V(`Illegal callee type: `+e.callee.type);let t=e.callee.name,n=e.arguments,r=Ih(i,t)&&i[t];return r||V(`Unrecognized function: `+t),Sh(r)?r(n):r+`(`+n.map(d).join(`,`)+`)`},ArrayExpression:e=>`[`+e.elements.map(d).join(`,`)+`]`,BinaryExpression:e=>`(`+d(e.left)+` `+e.operator+` `+d(e.right)+`)`,UnaryExpression:e=>`(`+e.operator+d(e.argument)+`)`,ConditionalExpression:e=>`(`+d(e.test)+`?`+d(e.consequent)+`:`+d(e.alternate)+`)`,LogicalExpression:e=>`(`+d(e.left)+e.operator+d(e.right)+`)`,ObjectExpression:e=>{for(let t of e.properties){let e=t.key.name;Vm.has(e)&&V(`Illegal property: `+e)}return`{`+e.properties.map(d).join(`,`)+`}`},Property:e=>{u+=1;let t=d(e.key);return--u,t+`:`+d(e.value)}};function p(e){let t={code:d(e),globals:Object.keys(c),fields:Object.keys(l)};return c={},l={},t}return p.functions=i,p.constants=r,p}var GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,q,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU=o((()=>{pg(),GH=`RawCode`,KH=`Literal`,qH=`Property`,JH=`Identifier`,YH=`ArrayExpression`,XH=`BinaryExpression`,ZH=`CallExpression`,QH=`ConditionalExpression`,$H=`LogicalExpression`,eU=`MemberExpression`,tU=`ObjectExpression`,nU=`UnaryExpression`,uH.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=sCe(this),n=0,r=t.length;n`,rU[lU]=`Identifier`,rU[uU]=`Keyword`,rU[dU]=`Null`,rU[fU]=`Numeric`,rU[pU]=`Punctuator`,rU[mU]=`String`,rU[hU]=`RegularExpression`,gU=`ArrayExpression`,_U=`BinaryExpression`,vU=`CallExpression`,yU=`ConditionalExpression`,bU=`Identifier`,xU=`Literal`,SU=`LogicalExpression`,CU=`MemberExpression`,wU=`ObjectExpression`,TU=`Property`,EU=`UnaryExpression`,DU=`Unexpected token %0`,OU=`Unexpected number`,kU=`Unexpected string`,AU=`Unexpected identifier`,jU=`Unexpected reserved word`,MU=`Unexpected end of input`,NU=`Invalid regular expression`,PU=`Invalid regular expression: missing /`,FU=`Octal literals are not allowed in strict mode.`,IU=`Duplicate data property in object literal not allowed in strict mode`,LU=`ILLEGAL`,RU=`Disabled.`,zU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),BU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),VU={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},HU={if:1},UU={NaN:`NaN`,E:`Math.E`,LN2:`Math.LN2`,LN10:`Math.LN10`,LOG2E:`Math.LOG2E`,LOG10E:`Math.LOG10E`,PI:`Math.PI`,SQRT1_2:`Math.SQRT1_2`,SQRT2:`Math.SQRT2`,MIN_VALUE:`Number.MIN_VALUE`,MAX_VALUE:`Number.MAX_VALUE`}}));function GU(e){return(!e.getter||!e.getter[JU])&&(e.getter=Nm(e.field),e.getter[JU]=!0),e.getter}function KU(e,t){for(var n=t.fields,r=t.values,i=n.length,a=0,o,s;a=r[a])return!1}else if(s.type===lW){if(o>r[a])return!1}else if(s.type===uW){if(o<=r[a])return!1}else if(s.type===dW){if(oMh(t.fields?{values:t.fields.map(t=>GU(t)(e.datum))}:{[tW]:nW(e.datum)},t))}function BCe(e,t,n,r){for(var i=this.context.data[e],a=i?i.values.value:[],o={},s={},c={},l,u,d,f,p,m,h,g,_,v,y=a.length,b=0,x,S;b(e[u[n].field]=t,e),{})))}else p=tW,m=nW(l),h=o[p]||(o[p]={}),g=h[f]||(h[f]=[]),g.push(m),n&&(g=s[f]||(s[f]=[]),g.push({[tW]:m}));if(t||=XU,o[tW]?o[tW]=vW[`${tW}_${t}`](...Object.values(o[tW])):Object.keys(o).forEach(e=>{o[e]=Object.keys(o[e]).map(t=>o[e][t]).reduce((n,r)=>n===void 0?r:vW[`${c[e]}_${t}`](n,r))}),a=Object.keys(s),n&&a.length){let e=r?QU:ZU;o[e]=t===XU?{[$U]:a.reduce((e,t)=>(e.push(...s[t]),e),[])}:{[eW]:a.map(e=>({[$U]:s[e]}))}}return o}function qU(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to selection functions must be a string literal.`);let i=t[0].value,a=t.length>=2&&Ym(t).value,o=`@unit`,s=yW+i;a===YU&&!Ih(r,o)&&(r[o]=n.getData(i).indataRef(n,`unit`)),Ih(r,s)||(r[s]=n.getData(i).tuplesRef())}var JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW,aW,oW,sW,cW,lW,uW,dW,fW,pW,mW,hW,gW,_W,vW,yW,VCe=o((()=>{g_(),pg(),WU(),JU=Symbol(`vega_selection_getter`),YU=`intersect`,XU=`union`,ZU=`vlMulti`,QU=`vlPoint`,$U=`or`,eW=`and`,tW=`_vgsid_`,nW=Nm(tW),rW=`E`,iW=`R`,aW=`R-E`,oW=`R-LE`,sW=`R-RE`,cW=`E-LT`,lW=`E-LTE`,uW=`E-GT`,dW=`E-GTE`,fW=`E-VALID`,pW=`E-ONE`,mW=`index:unit`,hW=jg(nW),gW=hW.left,_W=hW.right,vW={[`${tW}_union`]:toe,[`${tW}_intersect`]:Qae,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;nt.includes(e)):t},R_union:function(e,t){var n=Zm(t[0]),r=Zm(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}},yW=`:`}));function bW(e){let t=this.context.data[e];return t?t.values.value:[]}function HCe(e,t,n){let r=this.context.data[e][`index:`+t],i=r?r.value.get(n):void 0;return i&&i.count}function UCe(e,t){let n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(zm).insert(t)),1}function WCe(e,t,n){if(e){let n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return n===void 0?e:n}function xW(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?``:(GW.setYear(2e3),GW.setMonth(e),GW.setDate(t),VW.call(this,GW,n))}function GCe(e){return xW.call(this,e,1,`%B`)}function KCe(e){return xW.call(this,e,1,`%b`)}function qCe(e){return xW.call(this,0,2+e,`%A`)}function JCe(e){return xW.call(this,0,2+e,`%a`)}function SW(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to data functions must be a string literal.`);let i=t[0].value,a=`:`+i;if(!Ih(a,r))try{r[a]=n.getData(i).tuplesRef()}catch{}}function YCe(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to indata must be a string literal.`),t[1].type!==`Literal`&&V(`Second argument to indata must be a string literal.`);let i=t[0].value,a=t[1].value,o=`@`+a;Ih(o,r)||(r[o]=n.getData(i).indataRef(n,a))}function CW(e,t,n,r){if(t[0].type===`Literal`)wW(n,r,t[0].value);else for(e in n.scales)wW(n,r,e)}function wW(e,t,n){let r=`%`+n;if(!Ih(t,r))try{t[r]=e.scaleRef(n)}catch{}}function TW(e,t){if(Yh(e)){let n=t.scales[e];return n&&wD(n.value)?n.value:void 0}else if(Sh(e))return wD(e)?e:void 0}function XCe(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=CW,n._range=CW,n._scale=CW;let r=t=>`_[`+(t.type===`Literal`?W(`%`+t.value):W(`%`)+`+`+e(t))+`]`;return{_bandwidth:e=>`this.__bandwidth(${r(e[0])})`,_range:e=>`${r(e[0])}.range()`,_scale:t=>`${r(t[0])}(${e(t[1])})`}}function EW(e,t){return function(n,r,i){if(n){let t=TW(n,(i||this).context);return t&&t.path[e](r)}else return t(r)}}function ZCe(e,t){let n=TW(e,(t||this).context);return n&&n.scale()}function QCe(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function DW(e,t,n){try{e[t].apply(e,[`EXPRESSION`].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function $Ce(){return DW(this.context.dataflow,`warn`,arguments)}function ewe(){return DW(this.context.dataflow,`info`,arguments)}function twe(){return DW(this.context.dataflow,`debug`,arguments)}function OW(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function kW(e){let t=aw(e),n=OW(t.r),r=OW(t.g),i=OW(t.b);return .2126*n+.7152*r+.0722*i}function nwe(e,t){let n=kW(e),r=kW(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function rwe(){let e=[].slice.call(arguments);return e.unshift({}),Mh(...e)}function AW(e,t){return e===t||e!==e&&t!==t?!0:H(e)?H(t)&&e.length===t.length?iwe(e,t):!1:Wm(e)&&Wm(t)?jW(e,t):!1}function iwe(e,t){for(let n=0,r=e.length;njW(e,t)}function awe(e,t,n,r,i,a){let o=this.context.dataflow,s=this.context.data[e],c=s.input,l=o.stamp(),u=s.changes,d,f;if(o._trigger===!1||!(c.value.length||t||r))return 0;if((!u||u.stamp{s.modified=!0,o.pulse(c,u).run()},!0,1)),n&&(d=n===!0?zm:H(n)||Ob(n)?n:MW(n),u.remove(d)),t&&u.insert(t),r&&(d=MW(r),c.value.some(d)?u.remove(d):u.insert(r)),i){if(Sh(i))throw Error(`modify parameter must be a data tuple, not a function`);for(f in a)u.modify(i,f,a[f])}return 1}function owe(e){let t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function swe(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}function cwe(e,t){let n=YW[t]||(YW[t]=Nm(t));return H(e)?e.map(n):n(e)}function NW(e){return H(e)||ArrayBuffer.isView(e)?e:null}function PW(e){return NW(e)||(Yh(e)?e:null)}function lwe(e,...t){return NW(e).join(...t)}function uwe(e,...t){return PW(e).indexOf(...t)}function dwe(e,...t){return PW(e).lastIndexOf(...t)}function fwe(e,...t){return PW(e).slice(...t)}function pwe(e,t,n){return Sh(n)&&V(`Function argument passed to replace.`),!Yh(t)&&!Jh(t)&&V(`Please pass a string or RegExp argument to replace.`),String(e).replace(t,n)}function mwe(e){return NW(e).slice().reverse()}function hwe(e){return NW(e).slice().sort(Eh)}function gwe(e,t,n){return yD(e||0,t||0,n||0)}function _we(e,t){let n=TW(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function vwe(e,t){let n=TW(e,(t||this).context);return n?n.copy():void 0}function ywe(e,t){let n=TW(e,(t||this).context);return n?n.domain():[]}function bwe(e,t,n){let r=TW(e,(n||this).context);return r?H(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0}function xwe(e,t){let n=TW(e,(t||this).context);return n&&n.range?n.range():[]}function Swe(e,t,n){let r=TW(e,(n||this).context);return r?r(t):void 0}function Cwe(e,t,n,r,i){e=TW(e,(i||this).context);let a=zO(t,n),o=e.domain(),s=o[0],c=Ym(o),l=Im;return c-s?l=RD(e,s,c):e=(e.interpolator?TD(`sequential`)().interpolator(e.interpolator()):TD(`linear`)().interpolate(e.interpolate()).range(e.range())).domain([s=0,c=1]),e.ticks&&(o=e.ticks(+r||15),s!==o[0]&&o.unshift(s),c!==Ym(o)&&o.push(c)),o.forEach(t=>a.stop(l(t),e(t))),a}function wwe(e,t,n){let r=TW(e,(n||this).context);return function(e){return r?r.path.context(e)(t):``}}function Twe(e){let t=null;return function(n){return n?HO(n,t||=VO(e)):e}}function FW(e,t){let n=bW.call(t,e);return n.root&&n.root.lookup||{}}function Ewe(e,t,n){let r=FW(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(XW):void 0}function Dwe(e,t){let n=FW(e,this)[t];return n?n.ancestors().map(XW):void 0}function Owe(){let e=ZW();return e?e.screen:{}}function kwe(){let e=ZW();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function Awe(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function IW(e,t,n){if(!e)return[];let[r,i]=e,a=new YO().set(r[0],r[1],i[0],i[1]);return yhe(n||this.context.dataflow.scenegraph().root,a,jwe(t))}function jwe(e){let t=null;if(e){let n=yh(e.marktype),r=yh(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}function Mwe(e,t,n,r=5){e=yh(e);let i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function Nwe(e){return yh(e).reduce((t,[n,r],i)=>t+=i==0?`M ${n},${r} `:i===e.length-1?` Z`:`L ${n},${r} `,``)}function Pwe(e,t,n){let{x:r,y:i,mark:a}=n,o=new YO().set(2**53-1,2**53-1,-(2**53-1),-(2**53-1));for(let[e,n]of t)eo.x2&&(o.x2=e),no.y2&&(o.y2=n);return o.translate(r,i),IW([[o.x1,o.y1],[o.x2,o.y2]],e,a).filter(e=>Fwe(e.x,e.y,t))}function Fwe(e,t,n){let r=0;for(let i=0,a=n.length-1;it!=s>t&&e<(o-c)*(t-l)/(s-l)+c&&r++}return r&1}function Iwe(e){let t=UH(e);$W.forEach(e=>t[e]=eG+e);for(let e in QW)t[e]=tG+e;return Mh(t,XCe(e,QW,nG)),t}function LW(e,t,n){return arguments.length===1?QW[e]:(QW[e]=t,n&&(nG[e]=n),iG&&(iG.functions[e]=tG+e),this)}function RW(e,t){let n={},r;try{e=Yh(e)?e:W(e)+``,r=HH(e)}catch{V(`Expression parse error: `+e)}r.visit(e=>{if(e.type!==`CallExpression`)return;let r=e.callee.name,i=rG.visitors[r];i&&i(r,e.arguments,t,n)});let i=iG(r);return i.globals.forEach(e=>{let r=`$`+e;!Ih(n,r)&&t.getSignal(e)&&(n[r]=t.signalRef(e))}),{$expr:Mh({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}var zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG,tG,nG,rG,iG,aG=o((()=>{pg(),WU(),FO(),ZL(),uT(),ax(),tM(),VCe(),Ix(),Xy(),g_(),zW=e=>function(t,n){let r=this.context.dataflow.locale();return t===null?`null`:r[e](n)(t)},BW=zW(`format`),VW=zW(`timeFormat`),HW=zW(`utcFormat`),UW=zW(`timeParse`),WW=zW(`utcParse`),GW=new Date(2e3,0,1),KW=EW(`area`,v_e),qW=EW(`bounds`,S_e),JW=EW(`centroid`,k_e),YW={},XW=e=>e.data,ZW=()=>typeof window<`u`&&window||null,QW={random(){return jx()},cumulativeNormal:dx,cumulativeLogNormal:_x,cumulativeUniform:xx,densityNormal:ux,densityLogNormal:gx,densityUniform:bx,quantileNormal:fx,quantileLogNormal:vx,quantileUniform:Sx,sampleNormal:lx,sampleLogNormal:hx,sampleUniform:yx,isArray:H,isBoolean:Hh,isDate:Uh,isDefined(e){return e!==void 0},isNumber:Kh,isObject:Wm,isRegExp:Jh,isString:Yh,isTuple:Ob,isValid(e){return e!=null&&e===e},toBoolean:og,toDate(e){return sg(e)},toNumber:Zm,toString:lg,indexof:uwe,join:lwe,lastindexof:dwe,replace:pwe,reverse:mwe,sort:hwe,slice:fwe,flush:Bh,lerp:Qh,merge:rwe,pad:ig,peek:Ym,pluck:cwe,span:ag,inrange:Vh,truncate:dg,rgb:aw,lab:Lw,hcl:Uw,hsl:mw,luminance:kW,contrast:nwe,sequence:m_,format:BW,utcFormat:HW,utcParse:WW,utcOffset:ly,utcSequence:fy,timeFormat:VW,timeParse:UW,timeOffset:cy,timeSequence:dy,timeUnitSpecifier:Uv,monthFormat:GCe,monthAbbrevFormat:KCe,dayFormat:qCe,dayAbbrevFormat:JCe,quarter:_h,utcquarter:vh,week:Kv,utcweek:Zv,dayofyear:Gv,utcdayofyear:Xv,warn:$Ce,info:ewe,debug:twe,extent(e){return Ph(e)},inScope:QCe,intersect:IW,clampRange:xh,pinchDistance:owe,pinchAngle:swe,screen:Owe,containerSize:Awe,windowSize:kwe,bandspace:gwe,setdata:UCe,pathShape:Twe,panLinear:th,panLog:nh,panPow:rh,panSymlog:ih,zoomLinear:oh,zoomLog:sh,zoomPow:ch,zoomSymlog:lh,encode:WCe,modify:awe,lassoAppend:Mwe,lassoPath:Nwe,intersectLasso:Pwe},$W=[`view`,`item`,`group`,`xy`,`x`,`y`],eG=`event.vega.`,tG=`this.`,nG={},rG={forbidden:[`_`],allowed:[`datum`,`event`,`item`],fieldvar:`datum`,globalvar:e=>`_[${W(`$`+e)}]`,functions:Iwe,constants:UU,visitors:nG},iG=WH(rG),LW(`bandwidth`,_we,CW),LW(`copy`,vwe,CW),LW(`domain`,ywe,CW),LW(`range`,xwe,CW),LW(`invert`,bwe,CW),LW(`scale`,Swe,CW),LW(`gradient`,Cwe,CW),LW(`geoArea`,KW,CW),LW(`geoBounds`,qW,CW),LW(`geoCentroid`,JW,CW),LW(`geoShape`,wwe,CW),LW(`geoScale`,ZCe,CW),LW(`indata`,HCe,YCe),LW(`data`,bW,SW),LW(`treePath`,Ewe,SW),LW(`treeAncestors`,Dwe,SW),LW(`vlSelectionTest`,LCe,qU),LW(`vlSelectionIdTest`,RCe,qU),LW(`vlSelectionResolve`,BCe,qU),LW(`vlSelectionTuples`,zCe)}));function Lwe(e){let t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()}function Rwe(e,t){let n=``;return fG[t]?n:(e.x2&&(e.x?(pG[t]&&(n+=`if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;`),n+=`o.width=o.x2-o.x;`):n+=`o.x=o.x2-(o.width||0);`),e.xc&&(n+=`o.x=o.xc-(o.width||0)/2;`),e.y2&&(e.y?(pG[t]&&(n+=`if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;`),n+=`o.height=o.y2-o.y;`):n+=`o.y=o.y2-(o.height||0);`),e.yc&&(n+=`o.y=o.yc-(o.height||0)/2;`),n)}function oG(e){return(e+``).toLowerCase()}function zwe(e){return oG(e)===`operator`}function Bwe(e){return oG(e)===`collect`}function sG(e,t,n){n.endsWith(`;`)||(n=`return(`+n+`);`);let r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function Vwe(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} +`)}function l(t){return t.map(u).join(e)}function u(e){return e==null?``:e instanceof Date?hae(e):t.test(e+=``)?`"`+e.replace(/"/g,`""`)+`"`:e}return{parse:r,parseRows:i,format:o,formatBody:s,formatRows:c,formatRow:l,formatValue:u}}var Lg,Rg,zg,Bg,Vg,_ae=o((()=>{Lg={},Rg={},zg=34,Bg=10,Vg=13})),vae=o((()=>{_ae()}));function yae(e){return e}var bae=o((()=>{}));function xae(e){if(e==null)return yae;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c{bae()}));function Cae(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}var wae=o((()=>{}));function Tae(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return Eae(e,t)})}:Eae(e,t)}function Eae(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Dae(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Dae(e,t){var n=xae(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a{wae(),Sae()}));function kae(e,t){var n={},r={},i={},a=[],o=-1;t.forEach(function(n,r){var i=e.arcs[n<0?~n:n],a;i.length<3&&!i[1][0]&&!i[1][1]&&(a=t[++o],t[o]=n,t[r]=a)}),t.forEach(function(e){var t=s(e),n=t[0],a=t[1],o,c;if(o=i[n])if(delete i[o.end],o.push(e),o.end=a,c=r[a]){delete r[c.start];var l=c===o?o:o.concat(c);r[l.start=o.start]=i[l.end=c.end]=l}else r[o.start]=i[o.end]=o;else if(o=r[a])if(delete r[o.start],o.unshift(e),o.start=n,c=i[n]){delete i[c.end];var u=c===o?o:c.concat(o);r[u.start=c.start]=i[u.end=o.end]=u}else r[o.start]=i[o.end]=o;else o=[e],r[o.start=n]=i[o.end=a]=o});function s(t){var n=e.arcs[t<0?~t:t],r=n[0],i;return e.transform?(i=[0,0],n.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=n[n.length-1],t<0?[i,r]:[r,i]}function c(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach(function(e){n[e<0?~e:e]=1}),a.push(i)}}return c(i,r),c(r,i),t.forEach(function(e){n[e<0?~e:e]||a.push([e])}),a}var Aae=o((()=>{}));function jae(e){return Dae(e,Mae.apply(this,arguments))}function Mae(e,t,n){var r,i,a;if(arguments.length>1)r=Nae(e,t,n);else for(i=0,r=Array(a=e.arcs.length);i{Oae(),Aae()})),Fae=o((()=>{Sae(),Oae(),Pae(),Aae(),bae()}));function Hg(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var Ug=o((()=>{}));function Iae(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var Lae=o((()=>{}));function Wg(e){let t,n,r;e.length===2?(t=e===Hg||e===Iae?e:Rae,n=e,r=e):(t=Hg,n=(t,n)=>Hg(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 Rae(){return 0}var zae=o((()=>{Ug(),Lae()}));function Bae(e){return e===null?NaN:+e}function*Vae(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 Hae=o((()=>{})),Gg,Kg,qg,Uae=o((()=>{Ug(),zae(),Hae(),Gg=Wg(Hg),Kg=Gg.right,qg=Gg.left,Wg(Bae).center}));function Wae(e,t){let n=0,r,i=0,a=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(r=t-i,i+=r/++n,a+=r*(t-i));else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i))}if(n>1)return a/(n-1)}var Gae=o((()=>{}));function Kae(e,t){let n=Wae(e,t);return n&&Math.sqrt(n)}var qae=o((()=>{Gae()})),Jg,Jae=o((()=>{Jg=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}}}));function Yg({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Yae({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Xae({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Zae(e){return typeof e==`object`&&e?e.valueOf():e}var Xg,Zg,Qg=o((()=>{Xg=class extends Map{constructor(e,t=Zae){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(Yg(this,e))}has(e){return super.has(Yg(this,e))}set(e,t){return super.set(Yae(this,e),t)}delete(e){return super.delete(Xae(this,e))}},Zg=class extends Set{constructor(e,t=Zae){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let t of e)this.add(t)}has(e){return super.has(Yg(this,e))}add(e){return super.add(Yae(this,e))}delete(e){return super.delete(Xae(this,e))}}}));function Qae(e,t){return Array.from(t,t=>e[t])}var $ae=o((()=>{}));function eoe(e=Hg){if(e===Hg)return toe;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 toe(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var noe=o((()=>{Ug()}));function $g(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=roe?10:a>=ioe?5:a>=aoe?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{roe=Math.sqrt(50),ioe=Math.sqrt(10),aoe=Math.sqrt(2)}));function r_(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}var soe=o((()=>{}));function i_(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}var coe=o((()=>{}));function loe(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?toe:eoe(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));loe(e,t,u,d,i)}let a=e[t],o=n,s=r;for(a_(e,n,t),i(e[r],a)>0&&a_(e,n,r);o0;)--s}i(e[n],a)===0?a_(e,n,s):(++s,a_(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function a_(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}var uoe=o((()=>{noe()}));function o_(e,t,n){if(e=Float64Array.from(Vae(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return i_(e);if(t>=1)return r_(e);var r,i=(r-1)*t,a=Math.floor(i),o=r_(loe(e,a).subarray(0,a+1));return o+(i_(e.subarray(a+1))-o)*(i-a)}}function doe(e,t,n=Bae){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)}}var foe=o((()=>{soe(),coe(),uoe(),Hae()}));function poe(e,t){let n=0,r=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}var moe=o((()=>{}));function hoe(e,t){return o_(e,.5,t)}var goe=o((()=>{foe()}));function*_oe(e){for(let t of e)yield*t}function voe(e){return Array.from(_oe(e))}var yoe=o((()=>{}));function s_(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{}));function xoe(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}var Soe=o((()=>{}));function Coe(e,...t){e=new Zg(e),t=t.map(woe);out:for(let n of e)for(let r of t)if(!r.has(n)){e.delete(n);continue out}return e}function woe(e){return e instanceof Zg?e:new Zg(e)}var Toe=o((()=>{Qg()}));function Eoe(...e){let t=new Zg;for(let n of e)for(let e of n)t.add(e);return t}var Doe=o((()=>{Qg()})),c_=o((()=>{Uae(),Ug(),zae(),Lae(),qae(),Jae(),Qg(),noe(),ooe(),foe(),soe(),moe(),goe(),yoe(),coe(),$ae(),uoe(),boe(),Soe(),Gae(),Toe(),Doe()}));function Ooe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function l_(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)]}var u_=o((()=>{}));function d_(e){return e=l_(Math.abs(e)),e?e[1]:NaN}var f_=o((()=>{u_()}));function koe(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)}}var Aoe=o((()=>{}));function joe(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Moe=o((()=>{}));function p_(e){if(!(t=Noe.exec(e)))throw Error(`invalid format: `+e);var t;return new m_({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]})}function m_(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+``}var Noe,Poe=o((()=>{Noe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i,p_.prototype=m_.prototype,m_.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 Foe(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Ioe=o((()=>{}));function Loe(e,t){var n=l_(e,t);if(!n)return h_=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(h_=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`)+l_(e,Math.max(0,t+a-1))[0]}var h_,Roe=o((()=>{u_()}));function zoe(e,t){var n=l_(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 Boe=o((()=>{u_()})),g_,Voe=o((()=>{u_(),Roe(),Boe(),g_={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Ooe,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)=>zoe(e*100,t),r:zoe,s:Loe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)}}));function Hoe(e){return e}var Uoe=o((()=>{}));function Woe(e){var t=e.grouping===void 0||e.thousands===void 0?Hoe:koe(__.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?Hoe:joe(__.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=p_(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`):g_[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=g_[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=Foe(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&h_!==void 0?v_[8+h_/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(d_(t)/3)))*3,r=10**-n,i=l((e=p_(e),e.type=`f`,e),{suffix:v_[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var __,v_,Goe=o((()=>{f_(),Aoe(),Moe(),Poe(),Ioe(),Voe(),Roe(),Uoe(),__=Array.prototype.map,v_=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`]}));function Koe(e){return y_=Woe(e),b_=y_.format,x_=y_.formatPrefix,y_}var y_,b_,x_,qoe=o((()=>{Goe(),Koe({thousands:`,`,grouping:[3],currency:[`$`,``]})}));function Joe(e){return Math.max(0,-d_(Math.abs(e)))}var Yoe=o((()=>{f_()}));function Xoe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(d_(t)/3)))*3-d_(Math.abs(e)))}var Zoe=o((()=>{f_()}));function Qoe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,d_(t)-d_(e))+1}var $oe=o((()=>{f_()})),S_=o((()=>{qoe(),Goe(),Poe(),Yoe(),Zoe(),$oe()}));function C_(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(sC_(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)=>(w_.setTime(+t),T_.setTime(+r),e(w_),e(T_),Math.floor(n(w_,T_))),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 w_,T_,E_=o((()=>{w_=new Date,T_=new Date})),D_,O_=o((()=>{E_(),D_=C_(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e),D_.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?C_(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):D_),D_.range})),k_,A_,j_,M_,N_,P_,F_,I_=o((()=>{k_=1e3,A_=k_*60,j_=A_*60,M_=j_*24,N_=M_*7,P_=M_*30,F_=M_*365})),L_,R_=o((()=>{E_(),I_(),L_=C_(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*k_)},(e,t)=>(t-e)/k_,e=>e.getUTCSeconds()),L_.range})),z_,B_,V_=o((()=>{E_(),I_(),z_=C_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*k_)},(e,t)=>{e.setTime(+e+t*A_)},(e,t)=>(t-e)/A_,e=>e.getMinutes()),z_.range,B_=C_(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*A_)},(e,t)=>(t-e)/A_,e=>e.getUTCMinutes()),B_.range})),H_,U_,W_=o((()=>{E_(),I_(),H_=C_(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*k_-e.getMinutes()*A_)},(e,t)=>{e.setTime(+e+t*j_)},(e,t)=>(t-e)/j_,e=>e.getHours()),H_.range,U_=C_(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*j_)},(e,t)=>(t-e)/j_,e=>e.getUTCHours()),U_.range})),G_,K_,q_,J_=o((()=>{E_(),I_(),G_=C_(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*A_)/M_,e=>e.getDate()-1),G_.range,K_=C_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/M_,e=>e.getUTCDate()-1),K_.range,q_=C_(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/M_,e=>Math.floor(e/M_)),q_.range}));function Y_(e){return C_(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())*A_)/N_)}function X_(e){return C_(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)/N_)}var Z_,Q_,$_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv=o((()=>{E_(),I_(),Z_=Y_(0),Q_=Y_(1),$_=Y_(2),ev=Y_(3),tv=Y_(4),nv=Y_(5),rv=Y_(6),Z_.range,Q_.range,$_.range,ev.range,tv.range,nv.range,rv.range,iv=X_(0),av=X_(1),ov=X_(2),sv=X_(3),cv=X_(4),lv=X_(5),uv=X_(6),iv.range,av.range,ov.range,sv.range,cv.range,lv.range,uv.range})),fv,pv,mv=o((()=>{E_(),fv=C_(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()),fv.range,pv=C_(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()),pv.range})),hv,gv,_v=o((()=>{E_(),hv=C_(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()),hv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:C_(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)}),hv.range,gv=C_(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()),gv.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:C_(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)}),gv.range}));function vv(e,t,n,r,i,a){let o=[[L_,1,k_],[L_,5,5*k_],[L_,15,15*k_],[L_,30,30*k_],[a,1,A_],[a,5,5*A_],[a,15,15*A_],[a,30,30*A_],[i,1,j_],[i,3,3*j_],[i,6,6*j_],[i,12,12*j_],[r,1,M_],[r,2,2*M_],[n,1,N_],[t,1,P_],[t,3,3*P_],[e,1,F_]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(n_(t/F_,n/F_,r));if(a===0)return D_.every(Math.max(n_(t,n,r),1));let[s,c]=o[i/o[a-1][2]{c_(),I_(),O_(),R_(),V_(),W_(),J_(),dv(),mv(),_v(),[yv,bv]=vv(gv,pv,iv,q_,U_,B_),[xv,Sv]=vv(hv,fv,Z_,G_,H_,z_)})),Cv=o((()=>{E_(),O_(),R_(),V_(),W_(),J_(),dv(),mv(),_v(),ese()}));function wv(e){let t=ng(e).slice(),n={};return t.length||V(`Missing time unit.`),t.forEach(e=>{_g(cy,e)?n[e]=1:V(`Invalid time unit: ${e}.`)}),(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+ +!!n.dayofyear>1&&V(`Incompatible time units: ${e}`),t.sort((e,t)=>cy[e]-cy[t]),t}function Tv(e,t){let n=hg({},ly,t),r=wv(e),i=r.length,a=``,o=0,s,c;for(o=0;oo;--s)if(c=r.slice(o,s).join(`-`),n[c]!=null){a+=n[c],o=s;break}return a.trim()}function Ev(e){return uy.setFullYear(e),uy.setMonth(0),uy.setDate(1),uy.setHours(0,0,0,0),uy}function Dv(e){return kv(new Date(e))}function Ov(e){return Av(new Date(e))}function kv(e){return G_.count(Ev(e.getFullYear())-1,e)}function Av(e){return Z_.count(Ev(e.getFullYear())-1,e)}function jv(e){return Ev(e).getDay()}function tse(e,t,n,r,i,a,o){if(0<=e&&e<100){let s=new Date(-1,t,n,r,i,a,o);return s.setFullYear(e),s}return new Date(e,t,n,r,i,a,o)}function Mv(e){return Pv(new Date(e))}function Nv(e){return Fv(new Date(e))}function Pv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return K_.count(t-1,e)}function Fv(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return iv.count(t-1,e)}function Iv(e){return uy.setTime(Date.UTC(e,0,1)),uy.getUTCDay()}function nse(e,t,n,r,i,a,o){if(0<=e&&e<100){let e=new Date(Date.UTC(-1,t,n,r,i,a,o));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,i,a,o))}function Lv(e,t,n,r,i){let a=t||1,o=Mh(e),s=(e,t,i)=>(i||=e,rse(n[i],r[i],e===o&&a,t)),c=new Date,l=Ng(e),u=l.year?s(Zv):pg(2012),d=l.month?s($v):l.quarter?s(Qv):bh,f=l.week&&l.day?s(`day`,1,`weekday`):l.week?s(ey,1):l.day?s(`day`,1):l.date?s(ty,1):l.dayofyear?s(ny,1):xh,p=l.hours?s(ry):bh,m=l.minutes?s(iy):bh,h=l.seconds?s(ay):bh,g=l.milliseconds?s(oy):bh;return function(e){c.setTime(+e);let t=u(c);return i(t,d(c),f(c,t),p(c),m(c),h(c),g(c))}}function rse(e,t,n,r){let i=n<=1?e:r?(t,i)=>r+n*Math.floor((e(t,i)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(i(e,n),n):i}function Rv(e,t,n){return t+e*7-(n+6)%7}function zv(e,t){return Lv(e,t||1,dy,fy,tse)}function Bv(e,t){return Lv(e,t||1,py,my,nse)}function Vv(e){return hy[e]}function Hv(e){return gy[e]}function Uv(e,t,n){return e?e.offset(t,n):void 0}function Wv(e,t,n){return Uv(Vv(e),t,n)}function Gv(e,t,n){return Uv(Hv(e),t,n)}function Kv(e,t,n,r){return e?e.range(t,n,r):void 0}function qv(e,t,n,r){return Kv(Vv(e),t,n,r)}function Jv(e,t,n,r){return Kv(Hv(e),t,n,r)}function Yv(e){let t=e.extent,n=e.maxbins||40,r=Math.abs(kg(t))/n,i=Wg(e=>e[2]).right(My,r),a,o;return i===My.length?(a=jy,o=n_(t[0]/Cy,t[1]/Cy,n)):i?(i=My[r/My[i-1][2]{let n=t(e),r=new Date(n);return Number.isNaN(+r)&&V(`Invalid date: ${n}`),r}),a=Fy.findIndex(e=>!e.aligned(i,r)),o=Fy.findIndex(e=>!e.skippable&&!e.aligned(i,r)),s=o>a+1?o:a,{units:c,step:l}=Fy[s-1];return{units:c,step:l}}var Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy=o((()=>{Fg(),Cv(),c_(),Zv=`year`,Qv=`quarter`,$v=`month`,ey=`week`,ty=`date`,ny=`dayofyear`,ry=`hours`,iy=`minutes`,ay=`seconds`,oy=`milliseconds`,sy=[Zv,Qv,$v,ey,ty,`day`,ny,ry,iy,ay,oy],cy=sy.reduce((e,t,n)=>(e[t]=1+n,e),{}),ly={[Zv]:`%Y `,[Qv]:`Q%q `,[$v]:`%b `,[ty]:`%d `,[ey]:`W%U `,day:`%a `,[ny]:`%j `,[ry]:`%H:00`,[iy]:`00:%M`,[ay]:`:%S`,[oy]:`.%L`,[`${Zv}-${$v}`]:`%Y-%m `,[`${Zv}-${$v}-${ty}`]:`%Y-%m-%d `,[`${ry}-${iy}`]:`%H:%M`},uy=new Date,dy={[Zv]:e=>e.getFullYear(),[Qv]:e=>Math.floor(e.getMonth()/3),[$v]:e=>e.getMonth(),[ty]:e=>e.getDate(),[ry]:e=>e.getHours(),[iy]:e=>e.getMinutes(),[ay]:e=>e.getSeconds(),[oy]:e=>e.getMilliseconds(),[ny]:e=>kv(e),[ey]:e=>Av(e),weekday:(e,t)=>Rv(Av(e),e.getDay(),jv(t)),day:(e,t)=>Rv(1,e.getDay(),jv(t))},fy={[Qv]:e=>3*e,[ey]:(e,t)=>Rv(e,0,jv(t))},py={[Zv]:e=>e.getUTCFullYear(),[Qv]:e=>Math.floor(e.getUTCMonth()/3),[$v]:e=>e.getUTCMonth(),[ty]:e=>e.getUTCDate(),[ry]:e=>e.getUTCHours(),[iy]:e=>e.getUTCMinutes(),[ay]:e=>e.getUTCSeconds(),[oy]:e=>e.getUTCMilliseconds(),[ny]:e=>Pv(e),[ey]:e=>Fv(e),day:(e,t)=>Rv(1,e.getUTCDay(),Iv(t)),weekday:(e,t)=>Rv(Fv(e),e.getUTCDay(),Iv(t))},my={[Qv]:e=>3*e,[ey]:(e,t)=>Rv(e,0,Iv(t))},hy={[Zv]:hv,[Qv]:fv.every(3),[$v]:fv,[ey]:Z_,[ty]:G_,day:G_,[ny]:G_,[ry]:H_,[iy]:z_,[ay]:L_,[oy]:D_},gy={[Zv]:gv,[Qv]:pv.every(3),[$v]:pv,[ey]:iv,[ty]:K_,day:K_,[ny]:K_,[ry]:U_,[iy]:B_,[ay]:L_,[oy]:D_},_y=1e3,vy=_y*60,yy=vy*60,by=yy*24,xy=by*7,Sy=by*30,Cy=by*365,wy=[Zv,$v,ty,ry,iy,ay,oy],Ty=wy.slice(0,-1),Ey=Ty.slice(0,-1),Dy=Ey.slice(0,-1),Oy=Dy.slice(0,-1),ky=[Zv,ey],Ay=[Zv,$v],jy=[Zv],My=[[Ty,1,_y],[Ty,5,5*_y],[Ty,15,15*_y],[Ty,30,30*_y],[Ey,1,vy],[Ey,5,5*vy],[Ey,15,15*vy],[Ey,30,30*vy],[Dy,1,yy],[Dy,3,3*yy],[Dy,6,6*yy],[Dy,12,12*yy],[Oy,1,by],[ky,1,xy],[Ay,1,Sy],[Ay,3,3*Sy],[jy,1,Cy]],Ny={[Zv]:e=>e.getFullYear(),[$v]:e=>e.getMonth(),[ty]:e=>e.getDate(),day:e=>e.getDay(),[ry]:e=>e.getHours(),[iy]:e=>e.getMinutes(),[ay]:e=>e.getSeconds(),[oy]:e=>e.getMilliseconds()},Py={[Zv]:e=>e.getUTCFullYear(),[$v]:e=>e.getUTCMonth(),[ty]:e=>e.getUTCDate(),day:e=>e.getUTCDay(),[ry]:e=>e.getUTCHours(),[iy]:e=>e.getUTCMinutes(),[ay]:e=>e.getUTCSeconds(),[oy]:e=>e.getUTCMilliseconds()},Fy=[{units:[Zv,$v,ty,ry,iy,ay,oy],step:1,aligned:()=>!0},{units:[Zv,$v,ty,ry,iy,ay],step:1,aligned:(e,t)=>e.every(e=>t[oy](e)===0)},{units:[Zv,$v,ty,ry,iy],step:1,aligned:(e,t)=>e.every(e=>t[ay](e)===0)},{units:[Zv,$v,ty,ry,iy],step:5,aligned:(e,t)=>e.every(e=>t[iy](e)%5==0)},{units:[Zv,$v,ty,ry,iy],step:10,aligned:(e,t)=>e.every(e=>t[iy](e)%10==0)},{units:[Zv,$v,ty,ry],step:1,aligned:(e,t)=>e.every(e=>t[iy](e)===0)},{units:[Zv,$v,ty],step:1,aligned:(e,t)=>e.every(e=>t[ry](e)===0)},{units:[Zv,ey],step:1,skippable:!0,aligned:(e,t)=>new Set(e.map(e=>t.day(e))).size===1},{units:[Zv,$v],step:1,aligned:(e,t)=>e.every(e=>t[ty](e)===1)},{units:[Zv,$v],step:3,aligned:(e,t)=>e.every(e=>t[$v](e)%3==0)},{units:[Zv],step:1,aligned:(e,t)=>e.every(e=>t[$v](e)===0)},{units:[Zv],step:10,aligned:(e,t)=>e.every(e=>t[Zv](e)%10==0)},{aligned:()=>!1}]}));function Ly(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Ry(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function zy(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function By(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=Hy(i),u=Uy(i),d=Hy(a),f=Uy(a),p=Hy(o),m=Uy(o),h=Hy(s),g=Uy(s),_=Hy(c),v=Uy(c),y={a:ee,A:N,b:te,B:ne,c:null,d:Jy,e:Jy,f:wse,g:Pse,G:Ise,H:xse,I:Sse,j:Cse,L:Yy,m:Tse,M:Ese,p:P,q:re,Q:tb,s:nb,S:Dse,u:Ose,U:kse,V:Ase,w:jse,W:Mse,x:null,X:null,y:Nse,Y:Fse,Z:Lse,"%":eb},b={a:F,A:ie,b:ae,B:oe,c:null,d:Zy,e:Zy,f:Vse,g:Zse,G:$se,H:Rse,I:zse,j:Bse,L:Qy,m:Hse,M:Use,p:se,q:ce,Q:tb,s:nb,S:Wse,u:Gse,U:Kse,V:qse,w:Jse,W:Yse,x:null,X:null,y:Xse,Y:Qse,Z:ece,"%":eb},x={a:E,A:D,b:O,B:k,c:A,d:Ky,e:Ky,f:_se,g:Gy,G:Wy,H:qy,I:qy,j:pse,L:gse,m:fse,M:mse,p:T,q:dse,Q:yse,s:bse,S:hse,u:ose,U:sse,V:cse,w:ase,W:lse,x:j,X:M,y:Gy,Y:Wy,Z:use,"%":vse};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i53)return null;`w`in r||(r.w=1),`Z`in r?(a=Ry(zy(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?av.ceil(a):av(a),a=K_.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=Ly(zy(r.y,0,1)),o=a.getDay(),a=o>4||o===0?Q_.ceil(a):Q_(a),a=G_.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?Ry(zy(r.y,0,1)).getUTCDay():Ly(zy(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,Ry(r)):Ly(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 rb?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 ee(e){return o[e.getDay()]}function N(e){return a[e.getDay()]}function te(e){return c[e.getMonth()]}function ne(e){return s[e.getMonth()]}function P(e){return i[+(e.getHours()>=12)]}function re(e){return 1+~~(e.getMonth()/3)}function F(e){return o[e.getUTCDay()]}function ie(e){return a[e.getUTCDay()]}function ae(e){return c[e.getUTCMonth()]}function oe(e){return s[e.getUTCMonth()]}function se(e){return i[+(e.getUTCHours()>=12)]}function ce(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}function Vy(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function ase(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function ose(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function sse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function cse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function lse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Wy(e,t,n){var r=ib.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Gy(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function use(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 dse(e,t,n){var r=ib.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function fse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Ky(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function pse(e,t,n){var r=ib.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function qy(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function mse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function hse(e,t,n){var r=ib.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function gse(e,t,n){var r=ib.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function _se(e,t,n){var r=ib.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function vse(e,t,n){var r=ab.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function yse(e,t,n){var r=ib.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function bse(e,t,n){var r=ib.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Jy(e,t){return Vy(e.getDate(),t,2)}function xse(e,t){return Vy(e.getHours(),t,2)}function Sse(e,t){return Vy(e.getHours()%12||12,t,2)}function Cse(e,t){return Vy(1+G_.count(hv(e),e),t,3)}function Yy(e,t){return Vy(e.getMilliseconds(),t,3)}function wse(e,t){return Yy(e,t)+`000`}function Tse(e,t){return Vy(e.getMonth()+1,t,2)}function Ese(e,t){return Vy(e.getMinutes(),t,2)}function Dse(e,t){return Vy(e.getSeconds(),t,2)}function Ose(e){var t=e.getDay();return t===0?7:t}function kse(e,t){return Vy(Z_.count(hv(e)-1,e),t,2)}function Xy(e){var t=e.getDay();return t>=4||t===0?tv(e):tv.ceil(e)}function Ase(e,t){return e=Xy(e),Vy(tv.count(hv(e),e)+(hv(e).getDay()===4),t,2)}function jse(e){return e.getDay()}function Mse(e,t){return Vy(Q_.count(hv(e)-1,e),t,2)}function Nse(e,t){return Vy(e.getFullYear()%100,t,2)}function Pse(e,t){return e=Xy(e),Vy(e.getFullYear()%100,t,2)}function Fse(e,t){return Vy(e.getFullYear()%1e4,t,4)}function Ise(e,t){var n=e.getDay();return e=n>=4||n===0?tv(e):tv.ceil(e),Vy(e.getFullYear()%1e4,t,4)}function Lse(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Vy(t/60|0,`0`,2)+Vy(t%60,`0`,2)}function Zy(e,t){return Vy(e.getUTCDate(),t,2)}function Rse(e,t){return Vy(e.getUTCHours(),t,2)}function zse(e,t){return Vy(e.getUTCHours()%12||12,t,2)}function Bse(e,t){return Vy(1+K_.count(gv(e),e),t,3)}function Qy(e,t){return Vy(e.getUTCMilliseconds(),t,3)}function Vse(e,t){return Qy(e,t)+`000`}function Hse(e,t){return Vy(e.getUTCMonth()+1,t,2)}function Use(e,t){return Vy(e.getUTCMinutes(),t,2)}function Wse(e,t){return Vy(e.getUTCSeconds(),t,2)}function Gse(e){var t=e.getUTCDay();return t===0?7:t}function Kse(e,t){return Vy(iv.count(gv(e)-1,e),t,2)}function $y(e){var t=e.getUTCDay();return t>=4||t===0?cv(e):cv.ceil(e)}function qse(e,t){return e=$y(e),Vy(cv.count(gv(e),e)+(gv(e).getUTCDay()===4),t,2)}function Jse(e){return e.getUTCDay()}function Yse(e,t){return Vy(av.count(gv(e)-1,e),t,2)}function Xse(e,t){return Vy(e.getUTCFullYear()%100,t,2)}function Zse(e,t){return e=$y(e),Vy(e.getUTCFullYear()%100,t,2)}function Qse(e,t){return Vy(e.getUTCFullYear()%1e4,t,4)}function $se(e,t){var n=e.getUTCDay();return e=n>=4||n===0?cv(e):cv.ceil(e),Vy(e.getUTCFullYear()%1e4,t,4)}function ece(){return`+0000`}function eb(){return`%`}function tb(e){return+e}function nb(e){return Math.floor(e/1e3)}var rb,ib,ab,ob,sb=o((()=>{Cv(),rb={"-":``,_:` `,0:`0`},ib=/^\s*\d+/,ab=/^%/,ob=/[\\^$*+?|[\]().{}]/g}));function tce(e){return cb=By(e),lb=cb.format,ub=cb.parse,db=cb.utcFormat,fb=cb.utcParse,cb}var cb,lb,ub,db,fb,nce=o((()=>{sb(),tce({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`]})})),pb=o((()=>{nce(),sb()}));function mb(e){let t={};return n=>t[n]||(t[n]=e(n))}function rce(e,t){return n=>{let r=e(n),i=r.indexOf(t);if(i<0)return r;let a=ice(r,i),o=ai;)if(r[a]!==`0`){++a;break}return r.slice(0,a)+o}}function ice(e,t){let n=e.lastIndexOf(`e`),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function hb(e){let t=mb(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){let n=p_(e||`,`);if(n.precision==null){switch(n.precision=12,n.type){case`%`:n.precision-=2;break;case`e`:--n.precision;break}return rce(t(n),t(`.1f`)(1)[1])}else return t(n)},formatSpan(e,r,i,a){a=p_(a??`,f`);let o=n_(e,r,i),s=Math.max(Math.abs(e),Math.abs(r)),c;if(a.precision==null)switch(a.type){case`s`:return isNaN(c=Xoe(o,s))||(a.precision=c),n(a,s);case``:case`e`:case`g`:case`p`:case`r`:isNaN(c=Qoe(o,s))||(a.precision=c-(a.type===`e`));break;case`f`:case`%`:isNaN(c=Joe(o))||(a.precision=c-(a.type===`%`)*2);break}return t(a)}}}function gb(){return Eb=hb({format:b_,formatPrefix:x_})}function _b(e){return hb(Woe(e))}function vb(e){return arguments.length?Eb=_b(e):Eb}function yb(e,t,n){n||={},Dh(n)||V(`Invalid time multi-format specifier: ${n}`);let r=t(ay),i=t(iy),a=t(ry),o=t(ty),s=t(ey),c=t($v),l=t(Qv),u=t(Zv),d=e(n.milliseconds||`.%L`),f=e(n.seconds||`:%S`),p=e(n.minutes||`%I:%M`),m=e(n.hours||`%I %p`),h=e(n.date||n.day||`%a %d`),g=e(n.week||`%b %d`),_=e(n.month||`%B`),v=e(n.quarter||`%B`),y=e(n.year||`%Y`);return e=>(r(e)Eg(e)?t(e):yb(t,Vv,e),utcFormat:e=>Eg(e)?n(e):yb(n,Hv,e),timeParse:mb(e.parse),utcParse:mb(e.utcParse)}}function xb(){return Db=bb({format:lb,parse:ub,utcFormat:db,utcParse:fb})}function Sb(e){return bb(By(e))}function Cb(e){return arguments.length?Db=Sb(e):Db}function wb(e,t){let n=e?_b(e):vb(),r=t?Sb(t):Cb();return Ob(n,r)}function Tb(e,t){let n=arguments.length;return n&&n!==2&&V(`defaultLocale expects either zero or two arguments.`),n?Ob(vb(e),Cb(t)):Ob(vb(),Cb())}function ace(){return gb(),xb(),Tb()}var Eb,Db,Ob,kb=o((()=>{c_(),S_(),Iy(),Fg(),pb(),gb(),xb(),Ob=(e,t)=>hg({},e,t)}));function oce(e){return t=>({options:t||{},sanitize:cce,load:sce,fileAccess:!1,file:lce(e),http:dce})}async function sce(e,t){let n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t?.http)}async function cce(e,t){t=hg({},this.options,t);let n=this.fileAccess,r={href:null},i,a,o,s=Bb.test(e.replace(Vb,``));(e==null||typeof e!=`string`||!s)&&V(`Sanitize failure, invalid URI: `+W(e));let c=zb.test(e);return(o=t.baseURL)&&!c&&(!e.startsWith(`/`)&&!o.endsWith(`/`)&&(e=`/`+e),e=o+e),a=(i=e.startsWith(Hb))||t.mode===`file`||t.mode!==`http`&&!c&&n,i?e=e.slice(7):e.startsWith(`//`)&&(t.defaultProtocol===`file`?(e=e.slice(2),a=!0):e=(t.defaultProtocol||`http`)+`:`+e),Object.defineProperty(r,"localFile",{value:!!a}),r.href=e,t.target&&(r.target=t.target+``),t.rel&&(r.rel=t.rel+``),t.context===`image`&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+``),r}function lce(e){return e?t=>new Promise((n,r)=>{e.readFile(t,(e,t)=>{e?r(e):n(t)})}):uce}async function uce(){V(`No file system access.`)}async function dce(e,t){let n=hg({},this.options.http,t),r=t&&t.response,i=await fetch(e,n);return i.ok?ag(i[r])?i[r]():i.text():V(i.status+``+i.statusText)}function Ab(e,t){if(!e||!e.length)return`unknown`;let n=e.length,r=Yb.length,i=Yb.map((e,t)=>t+1);for(let a=0,o=0,s,c;ae===0?t:e,0)-1]}function jb(e,t){return t.reduce((t,n)=>(t[n]=Ab(e,n),t),{})}function Mb(e){let t=function(t,n){let r={delimiter:e};return Nb(t,n?hg(n,r):r)};return t.responseType=`text`,t}function Nb(e,t){return t.header&&(e=t.header.map(W).join(t.delimiter)+` +`+e),gae(t.delimiter).parse(e+``)}function fce(e){return typeof Buffer==`function`&&ag(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Pb(e,t){let n=t&&t.property?gh(t.property):yh;return Dh(e)&&!fce(e)?pce(n(e),t):n(JSON.parse(e))}function pce(e,t){return!H(e)&&Rie(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}function Fb(e,t){let n,r,i,a;return e=Pb(e,t),t&&t.feature?(n=Tae,i=t.feature):t&&t.mesh?(n=jae,i=t.mesh,a=Zb[t.filter]):V(`Missing TopoJSON feature or mesh parameter.`),r=(r=e.objects[i])?n(e,r,a):V(`Invalid TopoJSON object: `+i),r&&r.features||[r]}function Ib(e,t){return arguments.length>1?(Qb[e]=t,this):_g(Qb,e)?Qb[e]:null}function Lb(e){let t=Ib(e);return t&&t.responseType||`text`}function Rb(e,t,n,r){t||={};let i=Ib(t.type||`json`);return i||V(`Unknown data format type: `+t.type),e=i(e,t),t.parse&&mce(e,t.parse,n,r),_g(e,`columns`)&&delete e.columns,e}function mce(e,t,n,r){if(!e.length)return;let i=Cb();n||=i.timeParse,r||=i.utcParse;let a=e.columns||Object.keys(e[0]),o,s,c,l,u,d;t===`auto`&&(t=jb(e,a)),a=Object.keys(t);let f=a.map(e=>{let i=t[e],a,o;if(i&&(i.startsWith(`date:`)||i.startsWith(`utc:`)))return a=i.split(/:(.+)?/,2),o=a[1],(o[0]===`'`&&o[o.length-1]===`'`||o[0]===`"`&&o[o.length-1]===`"`)&&(o=o.slice(1,-1)),(a[0]===`utc`?r:n)(o);if(!Jb[i])throw Error(`Illegal format pattern: `+e+`:`+i);return Jb[i]});for(c=0,u=e.length,d=a.length;c{Fg(),vae(),Fae(),kb(),zb=/^(data:|([A-Za-z]+:)?\/\/)/,Bb=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Vb=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Hb=`file://`,Ub=e=>e!=null&&e===e,Wb=e=>e===`true`||e===`false`||e===!0||e===!1,Gb=e=>!Number.isNaN(Date.parse(e)),Kb=e=>!Number.isNaN(+e)&&!(e instanceof Date),qb=e=>Kb(e)&&Number.isInteger(+e),Jb={boolean:Ag,integer:Ph,number:Ph,date:jg,string:Mg,unknown:yh},Yb=[Wb,qb,Kb,Gb],Xb=[`boolean`,`integer`,`number`,`date`],Nb.responseType=`text`,Pb.responseType=`json`,Zb={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t},Fb.responseType=`json`,Qb={dsv:Nb,csv:Mb(`,`),tsv:Mb(` `),json:Pb,topojson:Fb},$b=oce(null)}));function tx(e){let t=e||yh,n=[],r={};return n.add=e=>{let i=t(e);return r[i]||(r[i]=1,n.push(e)),n},n.remove=e=>{let i=t(e);if(r[i]){r[i]=0;let t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function nx(e,t){try{await t(e)}catch(t){e.error(t)}}function rx(e){return!!(e&&ix(e))}function ix(e){return e[kx]}function ax(e,t){return e[kx]=t,e}function ox(e){let t=e===Object(e)?e:{data:e};return ix(t)?t:ax(t,Ax++)}function sx(e){return cx(e,ox({}))}function cx(e,t){for(let n in e)t[n]=e[n];return t}function lx(e,t){return ax(t,ix(e))}function ux(e,t){return e?t?(n,r)=>e(n,r)||ix(t(n))-ix(t(r)):(t,n)=>e(t,n)||ix(t)-ix(n):null}function dx(e){return e&&e.constructor===fx}function fx(){let e=[],t=[],n=[],r=[],i=[],a=null,o=!1;return{constructor:fx,insert(t){let n=ng(t),r=n.length;for(let t=0;t{m(e)&&(l[ix(e)]=-1)});for(d=0,f=e.length;d0&&(_(h,m,p.value),s.modifies(m));for(d=0,f=i.length;d{m(e)&&l[ix(e)]>0&&_(e,p.field,p.value)}),s.modifies(p.field);if(o)s.mod=t.length||r.length?c.filter(e=>l[ix(e)]>0):c.slice();else for(g in u)s.mod.push(u[g]);return(a||a==null&&(t.length||r.length))&&s.clean(!0),s}}}function px(){Object.defineProperty(this,jx,{writable:!0,value:{}})}function mx(e,t,n,r){this.id=++Mx,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function hx(e){return function(t){let n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}function hce(e,t,n,r){let i=1,a;return e instanceof mx?a=e:e&&e.prototype instanceof mx?a=new e:ag(e)?a=new mx(null,e):(i=0,a=new mx(e,t)),this.rank(a),i&&(r=n,n=t),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a}function gce(e,t){let n=e.rank,r=t.length;for(let i=0;it=e);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}function Cce(e,t,n,r,i){return(e instanceof mx?Tce:wce)(this,e,t,n,r,i),this}function wce(e,t,n,r,i,a){let o=hg({},a,Rx),s,c;ag(n)||(n=pg(n)),r===void 0?s=t=>e.touch(n(t)):ag(r)?(c=new mx(null,r,i,!1),s=t=>{c.evaluate(t);let r=n(t),i=c.value;dx(i)?e.pulse(r,i,a):e.update(r,i,o)}):s=t=>e.update(n(t),r,o),t.apply(s)}function Tce(e,t,n,r,i,a){if(r===void 0)t.targets().add(n);else{let o=a||{},s=new mx(null,Ece(n,r),i,!1);s.modified(o.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}function Ece(e,t){return t=ag(t)?t:pg(t),e?function(n,r){let i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function Dce(e){e.rank=++this._rank}function Oce(e){let t=[e],n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&V(`Cycle detected in dataflow graph.`)}function vx(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function yx(e,t){let n=[];return Pg(e,t,e=>n.push(e)),n}function bx(e,t){let n={};return e.visit(t,e=>{n[ix(e)]=1}),e=>n[ix(e)]?null:e}function xx(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}function Sx(e,t,n,r){let i=this,a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(let e of n)if(e.stamp===t){if(e.fields){let t=i.fields||={};for(let n in e.fields)t[n]=1}e.changed(i.ADD)&&(a|=i.ADD),e.changed(i.REM)&&(a|=i.REM),e.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}async function kce(e,t,n){let r=this,i=[];if(r._pulse)return Cx(r);if(r._pending&&await r._pending,t&&await nx(r,t),!r._touched.length)return r.debug(`Dataflow invoked, but nothing to do.`),r;let a=++r._clock;r._pulse=new vx(r,a,e),r._touched.forEach(e=>r._enqueue(e,!0)),r._touched=tx(vh);let o=0,s,c,l;try{for(;r._heap.size()>0;){if(s=r._heap.pop(),s.rank!==s.qrank){r._enqueue(s,!0);continue}c=s.run(r._getPulse(s,e)),c.then?c=await c:c.async&&(i.push(c.async),c=zx),c!==zx&&s._targets&&s._targets.forEach(e=>r._enqueue(e)),++o}}catch(e){r._heap.clear(),l=e}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${o} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){let e=r._postrun.sort((e,t)=>t.priority-e.priority);r._postrun=[];for(let t=0;tr.runAsync(null,()=>{e.forEach(e=>{try{e(r)}catch(e){r.error(e)}})})),r}async function Ace(e,t,n){for(;this._running;)await this._running;let r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function jce(e,t,n){return this._pulse?Cx(this):(this.evaluate(e,t,n),this)}function Mce(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(e){this.error(e)}}function Cx(e){return e.error(`Dataflow already running. Use runAsync() to chain invocations.`),e}function Nce(e,t){let n=e.stampe.pulse),t):this._input[e.id]||Fce(this._pulse,n&&n.pulse)}function Fce(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==zx&&(e.source=t.source),e)}function Ice(e,t){let n=t||Xx;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function Lce(e,t,n){let r=n||Xx;return(e.set(t)||r.force)&&this.touch(e,r),this}function Rce(e,t,n){this.touch(e,n||Xx);let r=new vx(this,this._clock+ +!this._pulse),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function zce(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),wx(t,0,t.length-1,e)),pop:()=>{let n=t.pop(),r;return t.length?(r=t[0],t[0]=n,Bce(t,0,e)):r=n,r}}}function wx(e,t,n,r){let i,a,o=e[n];for(;n>t;){if(a=n-1>>1,i=e[a],r(o,i)<0){e[n]=i,n=a;continue}break}return e[n]=o}function Bce(e,t,n){let r=t,i=e.length,a=e[t],o=(t<<1)+1,s;for(;o=0&&(o=s),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=a,wx(e,r,t,n)}function Tx(){this.logger(Th()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Tb();try{this._loader=$b()}catch{}this._touched=tx(vh),this._input={},this._pulse=null,this._heap=zce((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Ex(e){return function(){return this._log[e].apply(this,arguments)}}function G(e,t){mx.call(this,e,null,t)}function Dx(e){let t=Ox(e);return t&&t.Definition||null}function Ox(e){return e&&=e.toLowerCase(),_g(Zx,e)?Zx[e]:null}var kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx=o((()=>{Fg(),ex(),kb(),kx=Symbol(`vega_id`),Ax=1,jx=`_:mod:_`,px.prototype={set(e,t,n,r){let i=this,a=i[e],o=i[jx];return t!=null&&t>=0?(a[t]!==n||r)&&(a[t]=n,o[t+`:`+e]=-1,o[e]=-1):(a!==n||r)&&(i[e]=n,o[e]=H(n)?1+n.length:-1),i},modified(e,t){let n=this[jx];if(!arguments.length){for(let e in n)if(n[e])return!0;return!1}else if(H(e)){for(let t=0;t=0?t+1{o instanceof mx?(o!==this&&(t&&o.targets().add(this),a.push(o)),i.push({op:o,name:e,index:n})):r.set(e,n,o)};for(o in e)if(s=e[o],o===Nx)ng(s).forEach(e=>{e instanceof mx?e!==this&&(e.targets().add(this),a.push(e)):V(`Pulse parameters must be operator instances.`)}),this.source=s;else if(H(s))for(r.set(o,-1,Array(c=s.length)),l=0;l{let n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){let t=_x();return this.targets().add(_x(null,null,mg(e,e=>{let n=e.dataflow;t.receive(e),n&&n.run&&n.run()}))),t},between(e,t){let n=!1;return e.targets().add(_x(null,null,()=>n=!0)),t.targets().add(_x(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Sh,this._targets=null}},Rx={skip:!0},zx={},Bx=1,Vx=2,Hx=4,Ux=3,Wx=5,Gx=7,Kx=8,qx=16,Jx=32,Yx=64,vx.prototype={StopPropagation:zx,ADD:Bx,REM:Vx,MOD:Hx,ADD_REM:Ux,ADD_MOD:Wx,ALL:Gx,REFLOW:Kx,SOURCE:qx,NO_SOURCE:Jx,NO_FIELDS:Yx,fork(e){return new vx(this.dataflow).init(this,e)},clone(){let e=this.fork(Gx);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&=e.source.slice(),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length?e:(e=new vx(this.dataflow).init(this),e.add=e.source,e.rem=[],e)},init(e,t){let n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&Yx)&&(n.fields=e.fields),t&Bx?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Vx?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Hx?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&Jx?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){let t=e||Gx;return t&Bx&&this.add.length||t&Vx&&this.rem.length||t&Hx&&this.mod.length},reflow(e){if(e)return this.fork(Gx).reflow();let t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Hx,bx(this,Bx))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){let t=this.fields||={};return H(e)?e.forEach(e=>t[e]=!0):t[e]=!0,this},modified(e,t){let n=this.fields;return(t||this.mod.length)&&n?arguments.length?H(e)?e.some(e=>n[e]):n[e]:!!n:!1},filter(e,t){let n=this;return e&Bx&&(n.addF=xx(n.addF,t)),e&Vx&&(n.remF=xx(n.remF,t)),e&Hx&&(n.modF=xx(n.modF,t)),e&qx&&(n.srcF=xx(n.srcF,t)),n},materialize(e){e||=Gx;let t=this;return e&Bx&&t.addF&&(t.add=yx(t.add,t.addF),t.addF=null),e&Vx&&t.remF&&(t.rem=yx(t.rem,t.remF),t.remF=null),e&Hx&&t.modF&&(t.mod=yx(t.mod,t.modF),t.modF=null),e&qx&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){let n=this,r=t;if(e&qx)return Pg(n.source,n.srcF,r),n;e&Bx&&Pg(n.add,n.addF,r),e&Vx&&Pg(n.rem,n.remF,r),e&Hx&&Pg(n.mod,n.modF,r);let i=n.source;if(e&Kx&&i){let e=n.add.length+n.mod.length;e===i.length||(e?Pg(i,bx(n,Wx),r):Pg(i,n.srcF,r))}return n}},U(Sx,vx,{fork(e){let t=new vx(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,e=>t.add.push(e)),e&t.REM&&this.visit(t.REM,e=>t.rem.push(e)),e&t.MOD&&this.visit(t.MOD,e=>t.mod.push(e))),t},changed(e){return this.changes&e},modified(e){let t=this,n=t.fields;return n&&t.changes&t.MOD?H(e)?e.some(e=>n[e]):n[e]:0},filter(){V(`MultiPulse does not support filtering.`)},materialize(){V(`MultiPulse does not support materialization.`)},visit(e,t){let n=this,r=n.pulses,i=r.length,a=0;if(e&n.SOURCE)for(;athis.pulse=e):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){let t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}}),Zx={}}));function*$x(e,t){if(t==null)for(let t of e)t!=null&&t!==``&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==``&&(r=+r)>=r&&(yield r)}}function eS(e,t,n){let r=Float64Array.from($x(e,n));return r.sort(Hg),t.map(e=>doe(r,e))}function tS(e,t){return eS(e,[.25,.5,.75],t)}function nS(e,t){let n=e.length,r=Kae(e,t),i=tS(e,t),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*n**-.2}function rS(e){let t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2],a=e.extent[0],o=e.extent[1],s,c,l,u,d,f,p=e.span||o-a||Math.abs(a)||1;if(e.step)s=e.step;else if(e.steps){for(u=p/t,d=0,f=e.steps.length;dt;)s*=n;for(d=0,f=i.length;d=l&&p/u<=t&&(s=u)}u=Math.log(s);let m=n**(-(u>=0?0:~~(-u/r)+1)-1);return(e.nice||e.nice===void 0)&&(u=Math.floor(a/s+m)*s,a=ae);let i=e.length,a=new Float64Array(i),o=0,s=1,c=r(e[0]),l=c,u=c+t,d;for(;s=u){for(l=(c+l)/2;o>1);oi;)e[o--]=e[r]}r=i,i=a}return e}function Uce(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function Wce(e,t){t??(t=e,e=0);let n,r,i,a={min(e){return arguments.length?(n=e||0,i=r-n,a):n},max(e){return arguments.length?(r=e||0,i=r-n,a):r},sample(){return n+Math.floor(i*IS())},pdf(e){return e===Math.floor(e)&&e>=n&&e=r?1:(t-n+1)/i},icdf(e){return e>=0&&e<=1?n-1+Math.floor(e*i):NaN}};return a.min(e).max(t)}function oS(e,t){e||=0,t??=1;let n=0,r=0,i,a;if(zS===zS)n=zS,zS=NaN;else{do n=IS()*2-1,r=IS()*2-1,i=n*n+r*r;while(i===0||i>1);a=Math.sqrt(-2*Math.log(i)/i),n*=a,zS=r*a}return e+n*t}function sS(e,t,n){n??=1;let r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*LS)}function cS(e,t,n){t||=0,n??=1;let r=(e-t)/n,i=Math.abs(r),a;if(i>37)a=0;else{let e=Math.exp(-i*i/2),t;i<7.07106781186547?(t=.0352624965998911*i+.700383064443688,t=t*i+6.37396220353165,t=t*i+33.912866078383,t=t*i+112.079291497871,t=t*i+221.213596169931,t=t*i+220.206867912376,a=e*t,t=.0883883476483184*i+1.75566716318264,t=t*i+16.064177579207,t=t*i+86.7807322029461,t=t*i+296.564248779674,t=t*i+637.333633378831,t=t*i+793.826512519948,t=t*i+440.413735824752,a/=t):(t=i+.65,t=i+4/t,t=i+3/t,t=i+2/t,t=i+1/t,a=e/t/2.506628274631)}return r>0?1-a:a}function lS(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*RS*Gce(2*e-1)}function Gce(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=1.0512122733215323e-9+n*t,n=-4.112633980346984e-9+n*t,n=-2.9070369957882005e-8+n*t,n=4.2347877827932404e-7+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*t,n=-2.7517406297064545e-7+n*t,n=1.8239629214389228e-8+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=1.5076572693500548e-9+n*t,n=-3.789465440126737e-9+n*t,n=7.61570120807834e-9+n*t,n=-1.496002662714924e-8+n*t,n=2.914795345090108e-8+n*t,n=-6.771199775845234e-8+n*t,n=2.2900482228026655e-7+n*t,n=-9.9298272942317e-7+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function uS(e,t){let n,r,i={mean(e){return arguments.length?(n=e||0,i):n},stdev(e){return arguments.length?(r=e??1,i):r},sample:()=>oS(n,r),pdf:e=>sS(e,n,r),cdf:e=>cS(e,n,r),icdf:e=>lS(e,n,r)};return i.mean(e).stdev(t)}function dS(e,t){let n=uS(),r=0,i={data(n){return arguments.length?(e=n,r=n?n.length:0,i.bandwidth(t)):e},bandwidth(n){return arguments.length?(t=n,!t&&e&&(t=nS(e)),i):t},sample(){return e[~~(IS()*r)]+t*n.sample()},pdf(i){let a=0,o=0;for(;ofS(n,r),pdf:e=>pS(e,n,r),cdf:e=>mS(e,n,r),icdf:e=>hS(e,n,r)};return i.mean(e).stdev(t)}function _S(e,t){let n=0,r;function i(e){let t=[],r=0,i;for(i=0;i=t&&e<=n?1/(n-t):0}function bS(e,t,n){return n??(n=t??1,t=0),en?1:(e-t)/(n-t)}function xS(e,t,n){return n??(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function SS(e,t){let n,r,i={min(e){return arguments.length?(n=e||0,i):n},max(e){return arguments.length?(r=e??1,i):r},sample:()=>vS(n,r),pdf:e=>yS(e,n,r),cdf:e=>bS(e,n,r),icdf:e=>xS(e,n,r)};return t??(t=e??1,e=0),i.min(e).max(t)}function CS(e,t,n){let r=0,i=0;for(let a of e){let e=n(a);t(a)==null||e==null||isNaN(e)||(r+=(e-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function wS(e,t,n,r){let i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function TS(e,t,n,r){e=e.filter(e=>{let r=t(e),i=n(e);return r!=null&&(r=+r)>=r&&i!=null&&(i=+i)>=i}),r&&e.sort((e,n)=>t(e)-t(n));let i=e.length,a=new Float64Array(i),o=new Float64Array(i),s=0,c=0,l=0,u,d,f;for(f of e)a[s]=u=+t(f),o[s]=d=+n(f),++s,c+=(u-c)/s,l+=(d-l)/s;for(s=0;s=a&&o!=null&&(o=+o)>=o&&r(a,o,++i)}function DS(e,t,n,r,i){let a=0,o=0;return ES(e,t,n,(e,t)=>{let n=t-i(e),s=t-r;a+=n*n,o+=s*s}),1-a/o}function OS(e,t,n){let r=0,i=0,a=0,o=0,s=0;ES(e,t,n,(e,t)=>{++s,r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=wS(r,i,a,o),l=e=>c[0]+c[1]*e;return{coef:c,predict:l,rSquared:DS(e,t,n,i,l)}}function kS(e,t,n){let r=0,i=0,a=0,o=0,s=0;ES(e,t,n,(e,t)=>{++s,e=Math.log(e),r+=(e-r)/s,i+=(t-i)/s,a+=(e*t-a)/s,o+=(e*e-o)/s});let c=wS(r,i,a,o),l=e=>c[0]+c[1]*Math.log(e);return{coef:c,predict:l,rSquared:DS(e,t,n,i,l)}}function AS(e,t,n){let[r,i,a,o]=TS(e,t,n),s=0,c=0,l=0,u=0,d=0,f,p,m;ES(e,t,n,(e,t)=>{f=r[d++],p=Math.log(t),m=f*t,s+=(t*p-s)/d,c+=(m-c)/d,l+=(m*p-l)/d,u+=(f*m-u)/d});let[h,g]=wS(c/o,s/o,l/o,u/o),_=e=>Math.exp(h+g*(e-a));return{coef:[Math.exp(h-g*a),g],predict:_,rSquared:DS(e,t,n,o,_)}}function jS(e,t,n){let r=0,i=0,a=0,o=0,s=0,c=0;ES(e,t,n,(e,t)=>{let n=Math.log(e),l=Math.log(t);++c,r+=(n-r)/c,i+=(l-i)/c,a+=(n*l-a)/c,o+=(n*n-o)/c,s+=(t-s)/c});let l=wS(r,i,a,o),u=e=>l[0]*e**+l[1];return l[0]=Math.exp(l[0]),{coef:l,predict:u,rSquared:DS(e,t,n,s,u)}}function MS(e,t,n){let[r,i,a,o]=TS(e,t,n),s=r.length,c=0,l=0,u=0,d=0,f=0,p,m,h,g;for(p=0;p(e-=a,y*e*e+b*e+x+o);return{coef:[x-b*a+y*a*a+o,b-2*y*a,y],predict:S,rSquared:DS(e,t,n,o,S)}}function NS(e,t,n,r){if(r===0)return CS(e,t,n);if(r===1)return OS(e,t,n);if(r===2)return MS(e,t,n);let[i,a,o,s]=TS(e,t,n),c=i.length,l=[],u=[],d=r+1,f,p,m,h,g;for(f=0;f{e-=o;let t=s+_[0]+_[1]*e+_[2]*e*e;for(f=3;f=0;--a)for(s=t[a],c=1,i[a]+=s,o=1;o<=a;++o)c*=(a+1-o)/o,i[a-o]+=s*n**+o*c;return i[0]+=r,i}function qce(e){let t=e.length-1,n=[],r,i,a,o,s;for(r=0;rMath.abs(e[r][o])&&(o=i);for(a=r;a=r;a--)e[a][i]-=e[a][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(s=0,a=i+1;ai[o]-n?r:o,c=0,l=0,p=0,m=0,h=0,g=1/Math.abs(i[s]-n||1);for(let e=r;e<=o;++e){let t=i[e],r=a[e],o=Jce(Math.abs(n-t)*g)*f[e],s=t*o;c+=o,l+=s,p+=r*o,m+=r*s,h+=t*s}let[_,v]=wS(l/c,p/c,m/c,h/c);u[e]=_+v*n,d[e]=Math.abs(a[e]-u[e]),Yce(i,e+1,t)}if(e===BS)break;let n=hoe(d);if(Math.abs(n)=1?VS:(r=1-t*t)*r}return Xce(i,u,o,s)}function Jce(e){return(e=1-e*e*e)*e*e}function Yce(e,t,n){let r=e[t],i=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}function Xce(e,t,n,r){let i=e.length,a=[],o=0,s=0,c=[],l;for(;o[t,e(t)],a=t[0],o=t[1],s=o-a,c=s/r,l=[i(a)],u=[];if(n===r){for(let e=1;e0;)u.push(i(a+e/n*s))}let d=l[0],f=u[u.length-1],p=1/s,m=Zce(d[1],u);for(;f;){let e=i((d[0]+f[0])/2);e[0]-d[0]>=c&&Qce(d,e,f,p,m)>HS?u.push(e):(d=f,l.push(f),u.pop()),f=u[u.length-1]}return l}function Zce(e,t){let n=e,r=e,i=t.length;for(let e=0;er&&(r=i)}return 1/(r-n)}function Qce(e,t,n,r,i){let a=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),o=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(a-o)}var IS,LS,RS,zS,BS,VS,HS,US=o((()=>{c_(),IS=Math.random,LS=Math.sqrt(2*Math.PI),RS=Math.SQRT2,zS=NaN,BS=2,VS=1e-12,HS=.5*Math.PI/180})),$ce=c({aggregate:()=>XS,bin:()=>ZS,collect:()=>$S,compare:()=>eC,countpattern:()=>tC,cross:()=>nC,density:()=>iC,dotbin:()=>sC,expression:()=>cC,extent:()=>lC,facet:()=>dC,field:()=>fC,filter:()=>pC,flatten:()=>mC,fold:()=>hC,formula:()=>gC,generate:()=>_C,impute:()=>vC,joinaggregate:()=>yC,kde:()=>bC,key:()=>xC,load:()=>SC,lookup:()=>wC,multiextent:()=>TC,multivalues:()=>EC,params:()=>DC,pivot:()=>OC,prefacet:()=>kC,project:()=>AC,proxy:()=>jC,quantile:()=>MC,relay:()=>NC,sample:()=>PC,sequence:()=>FC,sieve:()=>IC,subflow:()=>uC,timeunit:()=>LC,tupleindex:()=>RC,values:()=>zC,window:()=>VC});function ele(e){return t=>{let n=e.length,r=1,i=String(e[0](t));for(;rhg({name:e,aggregate_param:r,out:n||e},WC,t)}function KS(e,t,n){return GC[e](n,t)}function qS(e,t){return e.idx-t.idx}function nle(e){let t={};e.forEach(e=>t[e.name]=e);let n=e=>{e.req&&e.req.forEach(e=>{t[e]||n(t[e]=GC[e]())})};return e.forEach(n),Object.values(t).sort(qS)}function rle(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function ile(e,t){if(e==null||e===``){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function ale(e,t){if(e==null||e===``){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function ole(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function JS(e,t){let n=t||yh,r=nle(e),i=e.slice().sort(qS);function a(e){this._ops=r,this._out=i,this.cell=e,this.init()}return a.prototype.init=rle,a.prototype.add=ile,a.prototype.rem=ale,a.prototype.set=ole,a.prototype.get=n,a.fields=e.map(e=>e.out),a}function YS(e){this._key=e?gh(e):ix,this.reset()}function XS(e){G.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function ZS(e){G.call(this,null,e)}function QS(e,t,n){let r=e,i=t||[],a=n||[],o={},s=0;return{add:e=>a.push(e),remove:e=>o[r(e)]=++s,size:()=>i.length,data:(e,t)=>(s&&=(i=i.filter(e=>!o[r(e)]),o={},0),t&&e&&i.sort(e),a.length&&(i=e?Xie(e,i,a.sort(e)):i.concat(a),a=[]),i)}}function $S(e){G.call(this,[],e)}function eC(e){mx.call(this,null,sle,e)}function sle(e){return this.value&&!e.modified()?this.value:sg(e.fields,e.orders)}function tC(e){G.call(this,null,e)}function cle(e,t,n){switch(t){case`upper`:e=e.toUpperCase();break;case`lower`:e=e.toLowerCase();break}return e.match(n)}function nC(e){G.call(this,null,e)}function lle(e,t,n,r){for(var i=[],a={},o=e.length,s=0,c,l;srC(e,t))):typeof r[n]===ZC&&r[n](e[n]);return r}function iC(e){G.call(this,null,e)}function ule(e){return()=>e.materialize(e.SOURCE).source}function aC(e,t){return e?e.map((e,n)=>t[n]||oh(e)):null}function oC(e,t,n){let r=[],i=e=>e(c),a,o,s,c,l,u;if(t==null)r.push(e.map(n));else for(a={},o=0,s=e.length;ot(n,e),sh(t),oh(t))}function lC(e){G.call(this,[void 0,void 0],e)}function uC(e,t){mx.call(this,e),this.parent=t,this.count=0}function dC(e){G.call(this,{},e),this._keys=yg();let t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,r=t.active;ngh(e)):gh(e.name,e.as)}function pC(e){G.call(this,yg(),e)}function mC(e){G.call(this,[],e)}function hC(e){G.call(this,[],e)}function gC(e){G.call(this,null,e)}function _C(e){G.call(this,[],e)}function vC(e){G.call(this,[],e)}function ple(e){var t=e.method||rw.value,n;if(rw[t]==null)V(`Unrecognized imputation method: `+t);else if(t===rw.value)return n=e.value===void 0?0:e.value,()=>n;else return rw[t]}function mle(e){let t=e.field;return e=>e?t(e):NaN}function hle(e,t,n,r){var i=e=>e(g),a=[],o=r?r.slice():[],s={},c={},l,u,d,f,p,m,h,g;for(o.forEach((e,t)=>s[e]=t+1),f=0,h=e.length;fi&&(i=o[1]);return[r,i]}function EC(e){mx.call(this,null,yle,e)}function yle(e){return this.value&&!e.modified()?this.value:e.values.reduce((e,t)=>e.concat(t),[])}function DC(e){G.call(this,null,e)}function OC(e){XS.call(this,e)}function ble(e,t){let n=e.field,r=e.value,i=(e.op===`count`?`__count__`:e.op)||`sum`,a=sh(n).concat(sh(r)),o=Sle(n,e.limit||0,t);return t.changed()&&e.set(`__pivot__`,null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>i),fields:o.map(e=>xle(e,n,r,a)),as:o.map(e=>e+``),modified:e.modified.bind(e)}}function xle(e,t,n,r){return ah(r=>t(r)===e?n(r):NaN,r,e+``)}function Sle(e,t,n){let r={},i=[];return n.visit(n.SOURCE,t=>{let n=e(t);r[n]||(r[n]=1,i.push(n))}),i.sort(lg),t?i.slice(0,t):i}function kC(e){dC.call(this,e)}function AC(e){G.call(this,null,e)}function Cle(e,t,n,r){for(let i=0,a=n.length;ic[e]=1)}p(e.sort),t.forEach((e,t)=>{let c=n[t],m=r[t],h=i[t]||null,g=oh(c),_=GS(e,g,a[t]);if(p(c),o.push(_),_g(sw,e))s.push(wle(e,c,m,_));else{if(c==null&&e!==`count`&&V(`Null aggregate field specified.`),e===`count`){u.push(_);return}f=!1;let t=l[g];t||(t=l[g]=[],t.field=c,d.push(t)),t.push(KS(e,h,_))}}),(u.length||d.length)&&(this.cell=Ele(d,u,f)),this.inputs=Object.keys(c)}function Ele(e,t,n){e=e.map(e=>JS(e,e.field));let r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,a=r.agg=Array(i),o=0;on?n:e}function Ole(e,t,n,r){e.p0=e.i0,e.p1=e.i1;let i=t[0]==null?0:n+t[0],a=t[1]==null?r:n+t[1]+1;e.i0=HC(i,0,r),e.i1=HC(a,0,r),e.index=n}function kle(e,t){let n=e.i0,r=e.i1-1,i=e.compare,a=e.data,o=a.length-1;n>0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),r{Fg(),Qx(),US(),c_(),Iy(),UC=()=>{},WC={init:UC,add:UC,rem:UC,idx:0},GC={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:[`mean`],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?Math.max(0,e.dev)/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:[`mean`],idx:1},variancep:{value:e=>e.valid?Math.max(0,e.dev)/e.valid:void 0,req:[`variance`],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid-1)):void 0,req:[`variance`],idx:2},stdevp:{value:e=>e.valid?Math.sqrt(Math.max(0,e.dev)/e.valid):void 0,req:[`variance`],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(Math.max(0,e.dev)/(e.valid*(e.valid-1))):void 0,req:[`variance`],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:[`values`],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:[`values`],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:[`values`],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:[`values`],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:[`values`],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:[`values`],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:[`values`],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:[`values`],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:[`min`,`values`],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:[`max`,`values`],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:[`exponential`],idx:1}},KC=Object.keys(GC).filter(e=>e!==`__count__`),[...KC,`__count__`].forEach(e=>{GC[e]=tle(e,GC[e])}),qC=YS.prototype,qC.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},qC.add=function(e){this._add.push(e)},qC.rem=function(e){this._rem.push(e)},qC.values=function(){if(this._get=null,this._rem.length===0)return this._add;let e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,a=Array(r-i),o={},s,c,l;for(s=0;s=0;)a=e(t[r])+``,_g(n,a)||(n[a]=1,++i);return i},qC.extent=function(e){if(this._get!==e||!this._ext){let t=this.values(),n=kie(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},qC.argmin=function(e){return this.extent(e)[0]||{}},qC.argmax=function(e){return this.extent(e)[1]||{}},qC.min=function(e){let t=this.extent(e)[0];return t==null?void 0:e(t)},qC.max=function(e){let t=this.extent(e)[1];return t==null?void 0:e(t)},qC.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=tS(this.values(),e),this._get=e),this._q},qC.q1=function(e){return this.quartile(e)[0]},qC.q2=function(e){return this.quartile(e)[1]},qC.q3=function(e){return this.quartile(e)[2]},qC.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=iS(this.values(),1e3,.05,e),this._get=e),this._ci},qC.ci0=function(e){return this.ci(e)[0]},qC.ci1=function(e){return this.ci(e)[1]},XS.Definition={type:`Aggregate`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`ops`,type:`enum`,array:!0,values:KC},{name:`aggregate_params`,type:`number`,null:!0,array:!0},{name:`fields`,type:`field`,null:!0,array:!0},{name:`as`,type:`string`,null:!0,array:!0},{name:`drop`,type:`boolean`,default:!0},{name:`cross`,type:`boolean`,default:!1},{name:`key`,type:`field`}]},U(XS,G,{transform(e,t){let n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,e=>n.add(e))):(n.value=n.value||n.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){let e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function a(e){let t,a,o,s;for(t in e)for(o=e[t].tuple,a=0;a{let t=oh(e);return i(e),n.push(t),t}),this.cellkey=e.key?e.key:WS(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];let a=e.fields||[null],o=e.ops||[`count`],s=e.aggregate_params||[null],c=e.as||[],l=a.length,u={},d,f,p,m,h,g,_;for(l!==o.length&&V(`Unmatched number of fields and aggregate ops.`),_=0;_JS(e,e.field)),Object.create(null)},cellkey:WS(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{let t=r(e);e[s]=t,e[c]=t==null?null:i+a*(1+(t-i)/a)}:e=>e[s]=r(e)),t.modifies(n?o:s)},_bins(e){if(this.value&&!e.modified())return this.value;let t=e.field,n=rS(e),r=n.step,i=n.start,a=i+Math.ceil((n.stop-i)/r)*r,o,s;(o=e.anchor)!=null&&(s=o-(i+r*Math.floor((o-i)/r)),i+=s,a+=s);let c=function(e){let n=Ph(t(e));return n==null?null:na?1/0:(n=Math.max(i,Math.min(n,a-r)),i+r*Math.floor(JC+(n-i)/r))};return c.start=i,c.stop=a,c.step=r,this.value=ah(c,sh(t),e.name||`bin_`+oh(t))}}),$S.Definition={type:`Collect`,metadata:{source:!0},params:[{name:`sort`,type:`compare`}]},U($S,G,{transform(e,t){let n=t.fork(t.ALL),r=QS(ix,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified(`sort`)||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(ux(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),U(eC,mx),tC.Definition={type:`CountPattern`,metadata:{generates:!0,changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`case`,type:`enum`,values:[`upper`,`lower`,`mixed`],default:`mixed`},{name:`pattern`,type:`string`,default:`[\\w"]+`},{name:`stopwords`,type:`string`,default:``},{name:`as`,type:`string`,array:!0,length:2,default:[`text`,`count`]}]},U(tC,G,{transform(e,t){let n=t=>n=>{for(var r=cle(s(n),e.case,a)||[],i,c=0,l=r.length;ci[e]=1+(i[e]||0)),u=n(e=>--i[e]);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,u)),this._finish(t,c)},_parameterCheck(e,t){let n=!1;return(e.modified(`stopwords`)||!this._stop)&&(this._stop=RegExp(`^`+(e.stopwords||``)+`$`,`i`),n=!0),(e.modified(`pattern`)||!this._match)&&(this._match=new RegExp(e.pattern||`[\\w']+`,`g`),n=!0),(e.modified(`field`)||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){let n=this._counts,r=this._tuples||={},i=t[0],a=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS),s,c,l;for(s in n)c=r[s],l=n[s]||0,!c&&l?(r[s]=c=ox({}),c[i]=s,c[a]=l,o.add.push(c)):l===0?(c&&o.rem.push(c),n[s]=null,r[s]=null):c[a]!==l&&(c[a]=l,o.mod.push(c));return o.modifies(t)}}),nC.Definition={type:`Cross`,metadata:{generates:!0},params:[{name:`filter`,type:`expr`},{name:`as`,type:`string`,array:!0,length:2,default:[`a`,`b`]}]},U(nC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.as||[`a`,`b`],i=r[0],a=r[1],o=!this.value||t.changed(t.ADD_REM)||e.modified(`as`)||e.modified(`filter`),s=this.value;return o?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=lle(s,i,a,e.filter||Sh)):n.mod=s,n.source=this.value,n.modifies(r)}}),YC={kde:dS,mixture:_S,normal:uS,lognormal:gS,uniform:SS},XC=`distributions`,ZC=`function`,QC=`field`,$C=[{key:{function:`normal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`lognormal`},params:[{name:`mean`,type:`number`,default:0},{name:`stdev`,type:`number`,default:1}]},{key:{function:`uniform`},params:[{name:`min`,type:`number`,default:0},{name:`max`,type:`number`,default:1}]},{key:{function:`kde`},params:[{name:`field`,type:`field`,required:!0},{name:`from`,type:`data`},{name:`bandwidth`,type:`number`,default:0}]}],ew={key:{function:`mixture`},params:[{name:`distributions`,type:`param`,array:!0,params:$C},{name:`weights`,type:`number`,array:!0}]},iC.Definition={type:`Density`,metadata:{generates:!0},params:[{name:`extent`,type:`number`,array:!0,length:2},{name:`steps`,type:`number`},{name:`minsteps`,type:`number`,default:25},{name:`maxsteps`,type:`number`,default:200},{name:`method`,type:`string`,default:`pdf`,values:[`pdf`,`cdf`]},{name:`distribution`,type:`param`,params:$C.concat(ew)},{name:`as`,type:`string`,array:!0,default:[`value`,`density`]}]},U(iC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=rC(e.distribution,ule(t)),i=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200,o=e.method||`pdf`;o!==`pdf`&&o!==`cdf`&&V(`Invalid density method: `+o),!e.extent&&!r.data&&V(`Missing density extent parameter.`),o=r[o];let s=e.as||[`value`,`density`],c=e.extent||gg(r.data()),l=FS(o,c,i,a).map(e=>{let t={};return t[s[0]]=e[0],t[s[1]]=e[1],ox(t)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),tw=`bin`,sC.Definition={type:`DotBin`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`step`,type:`number`},{name:`smooth`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:tw}]},nw=(e,t)=>kg(gg(e,t))/30,U(sC,G,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;let n=t.materialize(t.SOURCE).source,r=oC(t.source,e.groupby,yh),i=e.smooth||!1,a=e.field,o=e.step||nw(n,a),s=ux((e,t)=>a(e)-a(t)),c=e.as||tw,l=r.length,u=1/0,d=-1/0,f=0,p;for(;fd&&(d=t),e[++p][c]=t}return this.value={start:u,stop:d,step:o},t.reflow(!0).modifies(c)}}),U(cC,mx),lC.Definition={type:`Extent`,metadata:{},params:[{name:`field`,type:`field`,required:!0}]},U(lC,G,{transform(e,t){let n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified(`field`),a=n[0],o=n[1];if((i||a==null)&&(a=1/0,o=-1/0),t.visit(i?t.SOURCE:t.ADD,e=>{let t=Ph(r(e));t!=null&&(to&&(o=t))}),!Number.isFinite(a)||!Number.isFinite(o)){let e=oh(r);e&&=` for field "${e}"`,t.dataflow.warn(`Infinite extent${e}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),U(uC,mx,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){--this.count,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),U(dC,G,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,r){let i=this.value,a=_g(i,e)&&i[e],o,s;return a?a.value.stampe&&e.count>0);this.initTargets(e)}},initTargets(e){let t=this._targets,n=t.length,r=e?e.length:0,i=0;for(;ithis.subflow(e,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,e=>{let t=ix(e),n=a.get(t);n!==void 0&&(a.delete(t),s(n).rem(e))}),t.visit(t.ADD,e=>{let t=r(e);a.set(ix(e),t),s(t).add(e)}),o||t.modified(r.fields)?t.visit(t.MOD,e=>{let t=ix(e),n=a.get(t),i=r(e);n===i?s(i).mod(e):(a.set(t,i),s(n).rem(e),s(i).add(e))}):t.changed(t.MOD)&&t.visit(t.MOD,e=>{s(a.get(ix(e))).mod(e)}),o&&t.visit(t.REFLOW,e=>{let t=ix(e),n=a.get(t),i=r(e);n!==i&&(a.set(t,i),s(n).rem(e),s(i).add(e))}),t.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}}),U(fC,mx),pC.Definition={type:`Filter`,metadata:{changes:!0},params:[{name:`expr`,type:`expr`,required:!0}]},U(pC,G,{transform(e,t){let n=t.dataflow,r=this.value,i=t.fork(),a=i.add,o=i.rem,s=i.mod,c=e.expr,l=!0;t.visit(t.REM,e=>{let t=ix(e);r.has(t)?r.delete(t):o.push(e)}),t.visit(t.ADD,t=>{c(t,e)?a.push(t):r.set(ix(t),1)});function u(t){let n=ix(t),i=c(t,e),u=r.get(n);i&&u?(r.delete(n),a.push(t)):!i&&!u?(r.set(n,1),o.push(t)):l&&i&&!u&&s.push(t)}return t.visit(t.MOD,u),e.modified()&&(l=!1,t.visit(t.REFLOW,u)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),mC.Definition={type:`Flatten`,metadata:{generates:!0},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`index`,type:`string`},{name:`as`,type:`string`,array:!0}]},U(mC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=aC(r,e.as||[]),a=e.index||null,o=i.length;return n.rem=this.value,t.visit(t.SOURCE,e=>{let t=r.map(t=>t(e)),s=t.reduce((e,t)=>Math.max(e,t.length),0),c=0,l,u;for(;c{for(let t=0,a;tt[r]=n(t,e))}}),U(_C,G,{transform(e,t){let n=t.fork(t.ALL),r=e.generator,i=this.value,a=e.size-i.length,o,s,c;if(a>0){for(o=[];--a>=0;)o.push(c=ox(r(e))),i.push(c);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else s=i.slice(0,-a),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(s):s,i=i.slice(-a);return n.source=this.value=i,n}}),rw={value:`value`,median:hoe,mean:poe,min:i_,max:r_},iw=[],vC.Definition={type:`Impute`,metadata:{changes:!0},params:[{name:`field`,type:`field`,required:!0},{name:`key`,type:`field`,required:!0},{name:`keyvals`,array:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`enum`,default:`value`,values:[`value`,`mean`,`median`,`max`,`min`]},{name:`value`,default:0}]},U(vC,G,{transform(e,t){var n=t.fork(t.ALL),r=ple(e),i=mle(e),a=oh(e.field),o=oh(e.key),s=(e.groupby||[]).map(oh),c=hle(t.source,e.groupby,e.key,e.keyvals),l=[],u=this.value,d=c.domain.length,f,p,m,h,g,_,v,y,b,x;for(g=0,y=c.length;gn.add(e))):(i=n.value=n.value||this.init(e),t.visit(t.REM,e=>n.rem(e)),t.visit(t.ADD,e=>n.add(e))),n.changes(),t.visit(t.SOURCE,e=>{hg(e,i[n.cellkey(e)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){let e=this._adds,t=this._mods,n,r;for(n=0,r=this._alen;n{let n=dS(t,o)[s],r=e.counts?t.length:1;FS(n,u||gg(t),d,f).forEach(e=>{let n={};for(let e=0;e(this._pending=ng(e.data),e=>e.touch(this)))}:n.request(e.url,e.format).then(e=>CC(this,t,ng(e.data)))}}),wC.Definition={type:`Lookup`,metadata:{modifies:!0},params:[{name:`index`,type:`index`,params:[{name:`from`,type:`data`,required:!0},{name:`key`,type:`field`,required:!0}]},{name:`values`,type:`field`,array:!0},{name:`fields`,type:`field`,array:!0,required:!0},{name:`as`,type:`string`,array:!0},{name:`default`,default:null}]},U(wC,G,{transform(e,t){let n=e.fields,r=e.index,i=e.values,a=e.default==null?null:e.default,o=e.modified(),s=n.length,c=o?t.SOURCE:t.ADD,l=t,u=e.as,d,f,p;return i?(f=i.length,s>1&&!u&&V(`Multi-field lookup requires explicit "as" parameter.`),u&&u.length!==s*f&&V(`The "as" parameter has too few output field names.`),u||=i.map(oh),d=function(e){for(var t=0,o=0,c,l;tt.modified(e.fields)),c|=p?t.MOD:0),t.visit(c,d),l.modifies(u)}}),U(TC,mx),U(EC,mx),U(DC,G,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),OC.Definition={type:`Pivot`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`value`,type:`field`,required:!0},{name:`op`,type:`enum`,values:KC,default:`sum`},{name:`limit`,type:`number`,default:0},{name:`key`,type:`field`}]},U(OC,XS,{_transform:XS.prototype.transform,transform(e,t){return this._transform(ble(e,t),t)}}),U(kC,dC,{transform(e,t){let n=e.subflow,r=e.field,i=e=>this.subflow(ix(e),n,t,e);return(e.modified(`field`)||r&&t.modified(sh(r)))&&V(`PreFacet does not support field modification.`),this.initTargets(),r?(t.visit(t.MOD,e=>{let t=i(e);r(e).forEach(e=>t.mod(e))}),t.visit(t.ADD,e=>{let t=i(e);r(e).forEach(e=>t.add(ox(e)))}),t.visit(t.REM,e=>{let t=i(e);r(e).forEach(e=>t.rem(e))})):(t.visit(t.MOD,e=>i(e).mod(e)),t.visit(t.ADD,e=>i(e).add(e)),t.visit(t.REM,e=>i(e).rem(e))),t.clean()&&t.runAfter(()=>this.clean()),t}}),AC.Definition={type:`Project`,metadata:{generates:!0,changes:!0},params:[{name:`fields`,type:`field`,array:!0},{name:`as`,type:`string`,null:!0,array:!0}]},U(AC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.fields,i=aC(e.fields,e.as||[]),a=r?(e,t)=>Cle(e,t,r,i):cx,o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,e=>{let t=ix(e);n.rem.push(o[t]),o[t]=null}),t.visit(t.ADD,e=>{let t=a(e,ox({}));o[ix(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{n.mod.push(a(e,o[ix(e)]))}),n}}),U(jC,G,{transform(e,t){return this.value=e.value,e.modified(`value`)?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),MC.Definition={type:`Quantile`,metadata:{generates:!0,changes:!0},params:[{name:`groupby`,type:`field`,array:!0},{name:`field`,type:`field`,required:!0},{name:`probs`,type:`number`,array:!0},{name:`step`,type:`number`,default:.01},{name:`as`,type:`string`,array:!0,default:[`prob`,`value`]}]},aw=1e-14,U(MC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.as||[`prob`,`value`];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;let i=t.materialize(t.SOURCE).source,a=oC(i,e.groupby,e.field),o=(e.groupby||[]).map(oh),s=[],c=e.step||.01,l=e.probs||s_(c/2,1-aw,c),u=l.length;return a.forEach(e=>{let t=eS(e,l);for(let n=0;n{let t=ix(e);n.rem.push(r[t]),r[t]=null}),t.visit(t.ADD,e=>{let t=sx(e);r[ix(e)]=t,n.add.push(t)}),t.visit(t.MOD,e=>{let t=r[ix(e)];for(let r in e)t[r]=e[r],n.modifies(r);n.mod.push(t)})),n}}),PC.Definition={type:`Sample`,metadata:{},params:[{name:`size`,type:`number`,default:1e3}]},U(PC,G,{transform(e,t){let n=t.fork(t.NO_SOURCE),r=e.modified(`size`),i=e.size,a=this.value.reduce((e,t)=>(e[ix(t)]=1,e),{}),o=this.value,s=this.count,c=0;function l(e){let t,r;o.length=c&&(t=o[r],a[ix(t)]&&n.rem.push(t),o[r]=e)),++s}if(t.rem.length&&(t.visit(t.REM,e=>{let t=ix(e);a[t]&&(a[t]=-1,n.rem.push(e)),--s}),o=o.filter(e=>a[ix(e)]!==-1)),(t.rem.length||r)&&o.length{a[ix(e)]||l(e)}),c=-1),r&&o.length>i){let e=o.length-i;for(let t=0;t{a[ix(e)]&&n.mod.push(e)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||c<0)&&(n.add=o.filter(e=>!a[ix(e)])),this.count=s,this.value=n.source=o,n}}),FC.Definition={type:`Sequence`,metadata:{generates:!0,changes:!0},params:[{name:`start`,type:`number`,required:!0},{name:`stop`,type:`number`,required:!0},{name:`step`,type:`number`,default:1},{name:`as`,type:`string`,default:`data`}]},U(FC,G,{transform(e,t){if(this.value&&!e.modified())return;let n=t.materialize().fork(t.MOD),r=e.as||`data`;return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=s_(e.start,e.stop,e.step||1).map(e=>{let t={};return t[r]=e,ox(t)}),n.add=t.add.concat(this.value),n}}),U(IC,G,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),ow=[`unit0`,`unit1`],LC.Definition={type:`TimeUnit`,metadata:{modifies:!0},params:[{name:`field`,type:`field`,required:!0},{name:`interval`,type:`boolean`,default:!0},{name:`units`,type:`enum`,values:sy,array:!0},{name:`step`,type:`number`,default:1},{name:`maxbins`,type:`number`,default:40},{name:`extent`,type:`date`,array:!0},{name:`inferUnits`,type:`boolean`,default:!1},{name:`timezone`,type:`enum`,default:`local`,values:[`local`,`utc`]},{name:`as`,type:`string`,array:!0,length:2,default:ow}]},U(LC,G,{transform(e,t){let n=e.field,r=e.interval!==!1,i=e.timezone===`utc`,a=this._floor(e,t),o=(i?Hv:Vv)(a.unit).offset,s=e.as||ow,c=s[0],l=s[1],u=a.step,d=a.start||1/0,f=a.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(sh(n)))&&(t=t.reflow(!0),p=t.SOURCE,d=1/0,f=-1/0),t.visit(p,e=>{let t=n(e),i,s;t==null?(e[c]=null,r&&(e[l]=null)):(e[c]=i=s=a(t),r&&(e[l]=s=o(i,u)),if&&(f=s))}),a.start=d,a.stop=f,t.modifies(r?s:c)},_floor(e,t){let n=e.timezone===`utc`;e.inferUnits&&(e.units||e.step!=null||e.maxbins!=null||e.extent)&&t.dataflow.warn(`TimeUnit inferUnits overrides units, step, maxbins and extent.`);let{units:r,step:i}=e.inferUnits?Xv(t.materialize(t.SOURCE).source,e.field,n):e.units?{units:e.units,step:e.step||1}:Yv({extent:e.extent||gg(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=wv(r),o=this.value||{},s=(n?Bv:zv)(a,i);return s.unit=Mh(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),U(RC,G,{transform(e,t){let n=t.dataflow,r=e.field,i=this.value,a=e=>i.set(r(e),e),o=!0;return e.modified(`field`)||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,e=>i.delete(r(e))),t.visit(t.ADD,a)):o=!1,this.modified(o),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}}),U(zC,G,{transform(e,t){(!this.value||e.modified(`field`)||e.modified(`sort`)||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(ux(e.sort)):t.source).map(e.field))}}),sw={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){let e=sw.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.data,r=t.compare,i=t.index;if(e0||V(`ntile num must be greater than zero.`);let n=sw.cume_dist(),r=n.next;return{init:n.init,next:e=>Math.ceil(t*r(e))}},lag:function(e,t){return t=+t||1,{next:n=>{let r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let r=n.index+t,i=n.data;return re(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||V(`nth_value nth must be greater than zero.`),{next:n=>{let r=n.i0+(t-1);return rt=null,next:n=>{let r=e(n.data[n.index]);return r==null?t:t=r}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{let i=r.data;return r.index<=n?t:(n=Tle(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}},cw=Object.keys(sw),lw=BC.prototype,lw.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},lw.update=function(e,t){let n=this.cell,r=this.windows,i=e.data,a=r&&r.length,o;if(n){for(o=e.p0;othis.group(i(e)),o=this.state;(!o||n)&&(o=this.state=new BC(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,e=>a(e).add(e))):(t.visit(t.REM,e=>a(e).remove(e)),t.visit(t.ADD,e=>a(e).add(e)));for(let t=0,n=this._mlen;t{}));function jle(e){return e>1?0:e<-1?bw:Math.acos(e)}function fw(e){return e>=1?xw:e<=-1?-xw:Math.asin(e)}var pw,mw,hw,gw,_w,vw,yw,bw,xw,Sw,Cw=o((()=>{pw=Math.abs,mw=Math.atan2,hw=Math.cos,gw=Math.max,_w=Math.min,vw=Math.sin,yw=Math.sqrt,bw=Math.PI,xw=bw/2,Sw=2*bw}));function ww(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return ww;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t{Ew=Math.PI,Dw=2*Ew,Ow=1e-6,kw=Dw-Ow,Aw=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?ww:Mle(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Ow)if(!(Math.abs(u*s-c*l)>Ow)||!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((Ew-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ow&&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)>Ow||Math.abs(this._y1-l)>Ow)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Dw+Dw),d>kw?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>Ow&&this._append`A${n},${n},0,${+(d>=Ew)},${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._}},Tw.prototype=Aw.prototype})),jw=o((()=>{Nle()}));function Mw(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 Aw(t)}var Nw=o((()=>{jw()}));function Ple(e){return e.innerRadius}function Fle(e){return e.outerRadius}function Ile(e){return e.startAngle}function Lle(e){return e.endAngle}function Rle(e){return e&&e.padAngle}function zle(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function Pw(e,t,n,r,i,a,o){var s=e-n,c=t-r,l=(o?a:-a)/yw(s*s+c*c),u=l*c,d=-l*s,f=e+u,p=t+d,m=n+u,h=r+d,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=v*v+y*y,x=i-a,S=f*h-m*p,C=(y<0?-1:1)*yw(gw(0,x*x*b-S*S)),w=(S*y-v*C)/b,T=(-S*v-y*C)/b,E=(S*y+v*C)/b,D=(-S*v+y*C)/b,O=w-g,k=T-_,A=E-g,j=D-_;return O*O+k*k>A*A+j*j&&(w=E,T=D),{cx:w,cy:T,x01:-u,y01:-d,x11:w*(i/x-1),y11:T*(i/x-1)}}function Ble(){var e=Ple,t=Fle,n=uw(0),r=null,i=Ile,a=Lle,o=Rle,s=null,c=Mw(l);function l(){var l,u,d=+e.apply(this,arguments),f=+t.apply(this,arguments),p=i.apply(this,arguments)-xw,m=a.apply(this,arguments)-xw,h=pw(m-p),g=m>p;if(s||=l=c(),f1e-12))s.moveTo(0,0);else if(h>Sw-1e-12)s.moveTo(f*hw(p),f*vw(p)),s.arc(0,0,f,p,m,!g),d>1e-12&&(s.moveTo(d*hw(m),d*vw(m)),s.arc(0,0,d,m,p,g));else{var _=p,v=m,y=p,b=m,x=h,S=h,C=o.apply(this,arguments)/2,w=C>1e-12&&(r?+r.apply(this,arguments):yw(d*d+f*f)),T=_w(pw(f-d)/2,+n.apply(this,arguments)),E=T,D=T,O,k;if(w>1e-12){var A=fw(w/d*vw(C)),j=fw(w/f*vw(C));(x-=A*2)>1e-12?(A*=g?1:-1,y+=A,b-=A):(x=0,y=b=(p+m)/2),(S-=j*2)>1e-12?(j*=g?1:-1,_+=j,v-=j):(S=0,_=v=(p+m)/2)}var M=f*hw(_),ee=f*vw(_),N=d*hw(b),te=d*vw(b);if(T>1e-12){var ne=f*hw(v),P=f*vw(v),re=d*hw(y),F=d*vw(y),ie;if(h1e-12?D>1e-12?(O=Pw(re,F,M,ee,f,D,g),k=Pw(ne,P,N,te,f,D,g),s.moveTo(O.cx+O.x01,O.cy+O.y01),D1e-12)||!(x>1e-12)?s.lineTo(N,te):E>1e-12?(O=Pw(N,te,ne,P,d,-E,g),k=Pw(M,ee,re,F,d,-E,g),s.lineTo(O.cx+O.x01,O.cy+O.y01),E{dw(),Cw(),Nw()}));function Fw(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}var Iw=o((()=>{Array.prototype.slice}));function Lw(e){this._context=e}function Rw(e){return new Lw(e)}var zw=o((()=>{Lw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}}}));function Bw(e){return e[0]}function Vw(e){return e[1]}var Hw=o((()=>{}));function Uw(e,t){var n=uw(!0),r=null,i=Rw,a=null,o=Mw(s);e=typeof e==`function`?e:e===void 0?Bw:uw(e),t=typeof t==`function`?t:t===void 0?Vw:uw(t);function s(s){var c,l=(s=Fw(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c{Iw(),dw(),zw(),Nw(),Hw()}));function Gw(e,t,n){var r=null,i=uw(!0),a=null,o=Rw,s=null,c=Mw(l);e=typeof e==`function`?e:e===void 0?Bw:uw(+e),t=typeof t==`function`?t:uw(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Vw:uw(+n);function l(l){var u,d,f,p=(l=Fw(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u=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 Uw().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:uw(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:uw(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:uw(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:uw(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:uw(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:uw(+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:uw(!!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 Hle=o((()=>{Iw(),dw(),zw(),Ww(),Nw(),Hw()})),Kw,qw=o((()=>{Cw(),Kw={draw(e,t){let n=yw(t/bw);e.moveTo(n,0),e.arc(0,0,n,0,Sw)}}}));function Ule(e,t){let n=null,r=Mw(i);e=typeof e==`function`?e:uw(e||Kw),t=typeof t==`function`?t:uw(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:uw(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:uw(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}var Wle=o((()=>{dw(),Nw(),qw()}));function Jw(){}var Yw=o((()=>{}));function Xw(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 Zw(e){this._context=e}function Gle(e){return new Zw(e)}var Qw=o((()=>{Zw.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:Xw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Xw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function $w(e){this._context=e}function Kle(e){return new $w(e)}var qle=o((()=>{Yw(),Qw(),$w.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Xw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function eT(e){this._context=e}function Jle(e){return new eT(e)}var Yle=o((()=>{Qw(),eT.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:Xw(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}}}));function tT(e,t){this._basis=new Zw(e),this._beta=t}var nT,Xle=o((()=>{Qw(),tT.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},nT=(function e(t){function n(e){return t===1?new Zw(e):new tT(e,t)}return n.beta=function(t){return e(+t)},n})(.85)}));function rT(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function iT(e,t){this._context=e,this._k=(1-t)/6}var aT,oT=o((()=>{iT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:rT(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:rT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},aT=(function e(t){function n(e){return new iT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function sT(e,t){this._context=e,this._k=(1-t)/6}var cT,lT=o((()=>{Yw(),oT(),sT.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:rT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},cT=(function e(t){function n(e){return new sT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function uT(e,t){this._context=e,this._k=(1-t)/6}var dT,fT=o((()=>{oT(),uT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=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,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:rT(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},dT=(function e(t){function n(e){return new uT(e,t)}return n.tension=function(t){return e(+t)},n})(0)}));function pT(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function mT(e,t){this._context=e,this._alpha=t}var hT,gT=o((()=>{Cw(),oT(),mT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}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;default:pT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},hT=(function e(t){function n(e){return t?new mT(e,t):new iT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function _T(e,t){this._context=e,this._alpha=t}var vT,Zle=o((()=>{lT(),Yw(),gT(),_T.prototype={areaStart:Jw,areaEnd:Jw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:pT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},vT=(function e(t){function n(e){return t?new _T(e,t):new sT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function yT(e,t){this._context=e,this._alpha=t}var bT,Qle=o((()=>{fT(),gT(),yT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=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){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:pT(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},bT=(function e(t){function n(e){return t?new yT(e,t):new uT(e,0)}return n.alpha=function(t){return e(+t)},n})(.5)}));function xT(e){this._context=e}function $le(e){return new xT(e)}var eue=o((()=>{Yw(),xT.prototype={areaStart:Jw,areaEnd:Jw,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 ST(e){return e<0?-1:1}function CT(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(ST(a)+ST(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function wT(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function TT(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 ET(e){this._context=e}function DT(e){this._context=new OT(e)}function OT(e){this._context=e}function tue(e){return new ET(e)}function nue(e){return new DT(e)}var rue=o((()=>{ET.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:TT(this,this._t0,wT(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,TT(this,wT(this,n=CT(this,e,t)),n);break;default:TT(this,this._t0,n=CT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(DT.prototype=Object.create(ET.prototype)).point=function(e,t){ET.prototype.point.call(this,t,e)},OT.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 kT(e){this._context=e}function AT(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t{kT.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=AT(e),i=AT(t),a=0,o=1;o{jT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}}})),uue=o((()=>{Vle(),Hle(),Ww(),Iw(),dw(),Cw(),zw(),Nw(),Wle(),qw(),qle(),Yle(),Qw(),Xle(),lT(),fT(),oT(),Zle(),Qle(),gT(),eue(),rue(),aue(),lue()}));function MT(e,t){if(typeof document<`u`&&document.createElement){let n=document.createElement(`canvas`);if(n&&n.getContext)return n.width=e,n.height=t,n}return null}var NT,PT=o((()=>{NT=()=>typeof Image<`u`?Image:null}));function FT(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function IT(e,t){switch(arguments.length){case 0:break;case 1:typeof e==`function`?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t==`function`?this.interpolator(t):this.range(t);break}return this}var LT=o((()=>{}));function RT(){var e=new Xg,t=[],n=[],r=zT;function i(i){let a=e.get(i);if(a===void 0){if(r!==zT)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Xg;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return RT(t,n).unknown(r)},FT.apply(i,arguments),i}var zT,due=o((()=>{c_(),LT(),zT=Symbol(`implicit`)}));function BT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function VT(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}var HT=o((()=>{}));function UT(){}function WT(){return this.rgb().formatHex()}function fue(){return this.rgb().formatHex8()}function pue(){return iE(this).formatHsl()}function GT(){return this.rgb().formatRgb()}function KT(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=hE.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?qT(t):n===3?new ZT(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?JT(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?JT(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=gE.exec(e))?new ZT(t[1],t[2],t[3],1):(t=_E.exec(e))?new ZT(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vE.exec(e))?JT(t[1],t[2],t[3],t[4]):(t=yE.exec(e))?JT(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bE.exec(e))?rE(t[1],t[2]/100,t[3]/100,1):(t=xE.exec(e))?rE(t[1],t[2]/100,t[3]/100,t[4]):SE.hasOwnProperty(e)?qT(SE[e]):e===`transparent`?new ZT(NaN,NaN,NaN,0):null}function qT(e){return new ZT(e>>16&255,e>>8&255,e&255,1)}function JT(e,t,n,r){return r<=0&&(e=t=n=NaN),new ZT(e,t,n,r)}function YT(e){return e instanceof UT||(e=KT(e)),e?(e=e.rgb(),new ZT(e.r,e.g,e.b,e.opacity)):new ZT}function XT(e,t,n,r){return arguments.length===1?YT(e):new ZT(e,t,n,r??1)}function ZT(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function QT(){return`#${nE(this.r)}${nE(this.g)}${nE(this.b)}`}function mue(){return`#${nE(this.r)}${nE(this.g)}${nE(this.b)}${nE((isNaN(this.opacity)?1:this.opacity)*255)}`}function $T(){let e=eE(this.opacity);return`${e===1?`rgb(`:`rgba(`}${tE(this.r)}, ${tE(this.g)}, ${tE(this.b)}${e===1?`)`:`, ${e})`}`}function eE(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tE(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function nE(e){return e=tE(e),(e<16?`0`:``)+e.toString(16)}function rE(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new oE(e,t,n,r)}function iE(e){if(e instanceof oE)return new oE(e.h,e.s,e.l,e.opacity);if(e instanceof UT||(e=KT(e)),!e)return new oE;if(e instanceof oE)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 oE(o,s,c,e.opacity)}function aE(e,t,n,r){return arguments.length===1?iE(e):new oE(e,t,n,r??1)}function oE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function sE(e){return e=(e||0)%360,e<0?e+360:e}function cE(e){return Math.max(0,Math.min(1,e||0))}function lE(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 uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE=o((()=>{HT(),uE=.7,dE=1/uE,fE=`\\s*([+-]?\\d+)\\s*`,pE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,mE=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,hE=/^#([0-9a-f]{3,8})$/,gE=RegExp(`^rgb\\(${fE},${fE},${fE}\\)$`),_E=RegExp(`^rgb\\(${mE},${mE},${mE}\\)$`),vE=RegExp(`^rgba\\(${fE},${fE},${fE},${pE}\\)$`),yE=RegExp(`^rgba\\(${mE},${mE},${mE},${pE}\\)$`),bE=RegExp(`^hsl\\(${pE},${mE},${mE}\\)$`),xE=RegExp(`^hsla\\(${pE},${mE},${mE},${pE}\\)$`),SE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},BT(UT,KT,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:WT,formatHex:WT,formatHex8:fue,formatHsl:pue,formatRgb:GT,toString:GT}),BT(ZT,XT,VT(UT,{brighter(e){return e=e==null?dE:dE**+e,new ZT(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?uE:uE**+e,new ZT(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ZT(tE(this.r),tE(this.g),tE(this.b),eE(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:QT,formatHex:QT,formatHex8:mue,formatRgb:$T,toString:$T})),BT(oE,aE,VT(UT,{brighter(e){return e=e==null?dE:dE**+e,new oE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uE:uE**+e,new oE(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 ZT(lE(e>=240?e-240:e+120,i,r),lE(e,i,r),lE(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new oE(sE(this.h),cE(this.s),cE(this.l),eE(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=eE(this.opacity);return`${e===1?`hsl(`:`hsla(`}${sE(this.h)}, ${cE(this.s)*100}%, ${cE(this.l)*100}%${e===1?`)`:`, ${e})`}`}}))})),wE,TE,EE=o((()=>{wE=Math.PI/180,TE=180/Math.PI}));function DE(e){if(e instanceof kE)return new kE(e.l,e.a,e.b,e.opacity);if(e instanceof FE)return IE(e);e instanceof ZT||(e=YT(e));var t=NE(e.r),n=NE(e.g),r=NE(e.b),i=AE((.2225045*t+.7168786*n+.0606169*r)/zE),a,o;return t===n&&n===r?a=o=i:(a=AE((.4360747*t+.3850649*n+.1430804*r)/RE),o=AE((.0139322*t+.0971045*n+.7141733*r)/BE)),new kE(116*i-16,500*(a-i),200*(i-o),e.opacity)}function OE(e,t,n,r){return arguments.length===1?DE(e):new kE(e,t,n,r??1)}function kE(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function AE(e){return e>WE?e**(1/3):e/UE+VE}function jE(e){return e>HE?e*e*e:UE*(e-VE)}function ME(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function NE(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function hue(e){if(e instanceof FE)return new FE(e.h,e.c,e.l,e.opacity);if(e instanceof kE||(e=DE(e)),e.a===0&&e.b===0)return new FE(NaN,0{HT(),CE(),EE(),LE=18,RE=.96422,zE=1,BE=.82521,VE=4/29,HE=6/29,UE=3*HE*HE,WE=HE*HE*HE,BT(kE,OE,VT(UT,{brighter(e){return new kE(this.l+LE*(e??1),this.a,this.b,this.opacity)},darker(e){return new kE(this.l-LE*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=RE*jE(t),e=zE*jE(e),n=BE*jE(n),new ZT(ME(3.1338561*t-1.6168667*e-.4906146*n),ME(-.9787684*t+1.9161415*e+.033454*n),ME(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),BT(FE,PE,VT(UT,{brighter(e){return new FE(this.h,this.c,this.l+LE*(e??1),this.opacity)},darker(e){return new FE(this.h,this.c,this.l-LE*(e??1),this.opacity)},rgb(){return IE(this).rgb()}}))}));function _ue(e){if(e instanceof KE)return new KE(e.h,e.s,e.l,e.opacity);e instanceof ZT||(e=YT(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(eD*r+QE*t-$E*n)/(eD+QE-$E),a=r-i,o=(ZE*(n-i)-YE*a)/XE,s=Math.sqrt(o*o+a*a)/(ZE*i*(1-i)),c=s?Math.atan2(o,a)*TE-120:NaN;return new KE(c<0?c+360:c,s,i,e.opacity)}function GE(e,t,n,r){return arguments.length===1?_ue(e):new KE(e,t,n,r??1)}function KE(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}var qE,JE,YE,XE,ZE,QE,$E,eD,vue=o((()=>{HT(),CE(),EE(),qE=-.14861,JE=1.78277,YE=-.29227,XE=-.90649,ZE=1.97294,QE=ZE*XE,$E=ZE*JE,eD=JE*YE-XE*qE,BT(KE,GE,VT(UT,{brighter(e){return e=e==null?dE:dE**+e,new KE(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uE:uE**+e,new KE(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*wE,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new ZT(255*(t+n*(qE*r+JE*i)),255*(t+n*(YE*r+XE*i)),255*(t+ZE*r*n),this.opacity)}}))})),tD=o((()=>{CE(),gue(),vue()}));function nD(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}function rD(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r{}));function aD(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return nD((n-r/t)*t,i,a,o,s)}}var oD=o((()=>{iD()})),sD,cD=o((()=>{sD=e=>()=>e}));function yue(e,t){return function(n){return e+n*t}}function bue(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function lD(e,t){var n=t-e;return n?yue(e,n>180||n<-180?n-360*Math.round(n/360):n):sD(isNaN(e)?t:e)}function xue(e){return(e=+e)==1?uD:function(t,n){return n-t?bue(t,n,e):sD(isNaN(t)?n:t)}}function uD(e,t){var n=t-e;return n?yue(e,n):sD(isNaN(e)?t:e)}var dD=o((()=>{cD()}));function Sue(e){return function(t){var n=t.length,r=Array(n),i=Array(n),a=Array(n),o,s;for(o=0;o{tD(),iD(),oD(),dD(),fD=(function e(t){var n=xue(t);function r(e,t){var r=n((e=XT(e)).r,(t=XT(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=uD(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),Cue=Sue(rD),wue=Sue(aD)}));function pD(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i{}));function Due(e,t){return(Eue(t)?pD:Oue)(e,t)}function Oue(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o{bD(),mD()}));function Aue(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}var jue=o((()=>{}));function hD(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var gD=o((()=>{}));function Mue(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=yD(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Nue=o((()=>{bD()}));function Pue(e){return function(){return e}}function Fue(e){return function(t){return e(t)+``}}function Iue(e,t){var n=_D.lastIndex=vD.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=_D.exec(e))&&(i=vD.exec(t));)(a=i.index)>n&&(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:hD(r,i)})),n=vD.lastIndex;return n{gD(),_D=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vD=new RegExp(_D.source,`g`)}));function yD(e,t){var n=typeof t,r;return t==null||n===`boolean`?sD(t):(n===`number`?hD:n===`string`?(r=KT(t))?(t=r,fD):Iue:t instanceof KT?fD:t instanceof Date?Aue:Eue(t)?pD:Array.isArray(t)?Oue:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Mue:hD)(e,t)}var bD=o((()=>{tD(),Tue(),kue(),jue(),gD(),Nue(),Lue(),cD(),mD()}));function Rue(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var zue=o((()=>{}));function Bue(e,t){var n=lD(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var Vue=o((()=>{dD()}));function xD(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var Hue=o((()=>{}));function Uue(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r{SD=180/Math.PI,CD={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}}));function Gue(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?CD:Uue(t.a,t.b,t.c,t.d,t.e,t.f)}function Kue(e){return e==null||(wD||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),wD.setAttribute(`transform`,e),!(e=wD.transform.baseVal.consolidate()))?CD:(e=e.matrix,Uue(e.a,e.b,e.c,e.d,e.e,e.f))}var wD,que=o((()=>{Wue()}));function Jue(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:hD(e,i)},{i:c-2,x:hD(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:hD(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:hD(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:hD(e,n)},{i:s-2,x:hD(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t{gD(),que(),Yue=Jue(Gue,`px, `,`px)`,`deg)`),Xue=Jue(Kue,`, `,`)`,`)`)}));function Que(e){return((e=Math.exp(e))+1/e)/2}function $ue(e){return((e=Math.exp(e))-1/e)/2}function ede(e){return((e=Math.exp(2*e))-1)/(e+1)}var tde,nde,rde=o((()=>{tde=1e-12,nde=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p{tD(),dD(),ade=ide(lD),ode=ide(uD)}));function cde(e,t){var n=uD((e=OE(e)).l,(t=OE(t)).l),r=uD(e.a,t.a),i=uD(e.b,t.b),a=uD(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=r(t),e.b=i(t),e.opacity=a(t),e+``}}var lde=o((()=>{tD(),dD()}));function ude(e){return function(t,n){var r=e((t=PE(t)).h,(n=PE(n)).h),i=uD(t.c,n.c),a=uD(t.l,n.l),o=uD(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var dde,fde,pde=o((()=>{tD(),dD(),dde=ude(lD),fde=ude(uD)}));function mde(e){return(function t(n){n=+n;function r(t,r){var i=e((t=GE(t)).h,(r=GE(r)).h),a=uD(t.s,r.s),o=uD(t.l,r.l),s=uD(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}var hde,gde,_de=o((()=>{tD(),dD(),hde=mde(lD),gde=mde(uD)}));function TD(e,t){t===void 0&&(t=e,e=yD);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n{bD()}));function yde(e,t){for(var n=Array(t),r=0;r{})),xde=c({interpolate:()=>yD,interpolateArray:()=>Due,interpolateBasis:()=>rD,interpolateBasisClosed:()=>aD,interpolateCubehelix:()=>hde,interpolateCubehelixLong:()=>gde,interpolateDate:()=>Aue,interpolateDiscrete:()=>Rue,interpolateHcl:()=>dde,interpolateHclLong:()=>fde,interpolateHsl:()=>ade,interpolateHslLong:()=>ode,interpolateHue:()=>Bue,interpolateLab:()=>cde,interpolateNumber:()=>hD,interpolateNumberArray:()=>pD,interpolateObject:()=>Mue,interpolateRgb:()=>fD,interpolateRgbBasis:()=>Cue,interpolateRgbBasisClosed:()=>wue,interpolateRound:()=>xD,interpolateString:()=>Iue,interpolateTransformCss:()=>Yue,interpolateTransformSvg:()=>Xue,interpolateZoom:()=>nde,piecewise:()=>TD,quantize:()=>yde}),ED=o((()=>{bD(),kue(),iD(),oD(),jue(),zue(),Vue(),gD(),mD(),Nue(),Hue(),Lue(),Zue(),rde(),Tue(),sde(),lde(),pde(),_de(),vde(),bde()}));function Sde(e){return function(){return e}}var Cde=o((()=>{}));function DD(e){return+e}var OD=o((()=>{}));function kD(e){return e}function AD(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Sde(isNaN(t)?NaN:.5)}function wde(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Tde(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Ede:Tde,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),hD))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,DD),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=xD,u()},d.clamp=function(e){return arguments.length?(o=e?!0:kD,u()):o!==kD},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 Dde(){return MD()(kD,kD)}var ND,PD=o((()=>{c_(),ED(),Cde(),OD(),ND=[0,1]}));function Ode(e,t,n,r){var i=n_(e,t,n),a;switch(r=p_(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Xoe(i,o))&&(r.precision=a),x_(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Qoe(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Joe(i))&&(r.precision=a-(r.type===`%`)*2);break}return b_(r)}var kde=o((()=>{c_(),S_()}));function FD(e){var t=e.domain;return e.ticks=function(e){var n=t();return e_(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Ode(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=t_(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 Ade(){var e=Dde();return e.copy=function(){return jD(e,Ade())},FT.apply(e,arguments),FD(e)}var ID=o((()=>{c_(),PD(),LT(),kde()}));function jde(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,DD),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return jde(e).unknown(t)},e=arguments.length?Array.from(e,DD):[0,1],FD(n)}var Mde=o((()=>{ID(),OD()}));function Nde(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a{}));function Fde(e){return Math.log(e)}function Ide(e){return Math.exp(e)}function Lde(e){return-Math.log(-e)}function Rde(e){return-Math.exp(-e)}function zde(e){return isFinite(e)?+(`1e`+e):e<0?0:e}function Bde(e){return e===10?zde:e===Math.E?Math.exp:t=>e**+t}function Vde(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 Hde(e){return(t,n)=>-e(-t,n)}function LD(e){let t=e(Fde,Ide),n=t.domain,r=10,i,a;function o(){return i=Vde(r),a=Bde(r),n()[0]<0?(i=Hde(i),a=Hde(a),e(Lde,Rde)):e(Fde,Ide),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=p_(n)).precision==null&&(n.trim=!0),n=b_(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(Nde(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Ude(){let e=LD(MD()).domain([1,10]);return e.copy=()=>jD(e,Ude()).base(e.base()),FT.apply(e,arguments),e}var RD=o((()=>{c_(),S_(),Pde(),PD(),LT()}));function Wde(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Gde(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function zD(e){var t=1,n=e(Wde(t),Gde(t));return n.constant=function(n){return arguments.length?e(Wde(t=+n),Gde(t)):t},FD(n)}function Kde(){var e=zD(MD());return e.copy=function(){return jD(e,Kde()).constant(e.constant())},FT.apply(e,arguments)}var BD=o((()=>{ID(),PD(),LT()}));function qde(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Jde(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Yde(e){return e<0?-e*e:e*e}function VD(e){var t=e(kD,kD),n=1;function r(){return n===1?e(kD,kD):n===.5?e(Jde,Yde):e(qde(n),qde(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},FD(t)}function HD(){var e=VD(MD());return e.copy=function(){return jD(e,HD()).exponent(e.exponent())},FT.apply(e,arguments),e}function Xde(){return HD.apply(null,arguments).exponent(.5)}var UD=o((()=>{ID(),PD(),LT()}));function Zde(){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{c_(),LT()}));function $de(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[Kg(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++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 $de().domain([e,t]).range(i).unknown(a)},FT.apply(FD(o),arguments)}var efe=o((()=>{c_(),ID(),LT()}));function tfe(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Kg(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 tfe().domain(e).range(t).unknown(n)},FT.apply(i,arguments)}var nfe=o((()=>{c_(),LT()}));function rfe(e){return new Date(e)}function ife(e){return e instanceof Date?+e:+new Date(+e)}function WD(e,t,n,r,i,a,o,s,c,l){var u=Dde(),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){Cv(),pb(),PD(),LT(),Pde()}));function sfe(){return FT.apply(WD(yv,bv,gv,pv,iv,K_,U_,B_,L_,db).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}var cfe=o((()=>{Cv(),pb(),ofe(),LT()}));function GD(){var e=0,t=1,n,r,i,a,o=kD,s=!1,c;function l(e){return e==null||isNaN(e=+e)?c:o(i===0?.5:(e=(a(e)-n)*i,s?Math.max(0,Math.min(1,e)):e))}l.domain=function(o){return arguments.length?([e,t]=o,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(e){return arguments.length?(s=!!e,l):s},l.interpolator=function(e){return arguments.length?(o=e,l):o};function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,o=e(n,r),l):[o(0),o(1)]}}return l.range=u(yD),l.rangeRound=u(xD),l.unknown=function(e){return arguments.length?(c=e,l):c},function(o){return a=o,n=o(e),r=o(t),i=n===r?0:1/(r-n),l}}function KD(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function qD(){var e=FD(GD()(kD));return e.copy=function(){return KD(e,qD())},IT.apply(e,arguments)}function lfe(){var e=LD(GD()).domain([1,10]);return e.copy=function(){return KD(e,lfe()).base(e.base())},IT.apply(e,arguments)}function ufe(){var e=zD(GD());return e.copy=function(){return KD(e,ufe()).constant(e.constant())},IT.apply(e,arguments)}function JD(){var e=VD(GD());return e.copy=function(){return KD(e,JD()).exponent(e.exponent())},IT.apply(e,arguments)}function dfe(){return JD.apply(null,arguments).exponent(.5)}var ffe=o((()=>{ED(),PD(),LT(),ID(),RD(),BD(),UD()}));function YD(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=kD,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e{ED(),PD(),LT(),ID(),RD(),ffe(),BD(),UD()})),vfe=o((()=>{c_(),due(),Mde(),ID(),RD(),BD(),UD(),PD(),OD(),Qde(),efe(),nfe(),ofe(),cfe(),ffe(),_fe(),kde()}));function ZD(e){for(var t=e.length/6|0,n=Array(t),r=0;r{})),yfe,bfe=o((()=>{QD(),yfe=ZD(`1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf`)})),xfe,Sfe=o((()=>{QD(),xfe=ZD(`7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666`)})),Cfe,wfe=o((()=>{QD(),Cfe=ZD(`1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666`)})),Tfe,Efe=o((()=>{QD(),Tfe=ZD(`4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0`)})),Dfe,Ofe=o((()=>{QD(),Dfe=ZD(`a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928`)})),kfe,Afe=o((()=>{QD(),kfe=ZD(`fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2`)})),jfe,Mfe=o((()=>{QD(),jfe=ZD(`b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc`)})),Nfe,Pfe=o((()=>{QD(),Nfe=ZD(`e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999`)})),Ffe,Ife=o((()=>{QD(),Ffe=ZD(`66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3`)})),Lfe,Rfe=o((()=>{QD(),Lfe=ZD(`8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f`)})),zfe=o((()=>{bfe(),Sfe(),wfe(),Efe(),Ofe(),Afe(),Mfe(),Pfe(),Ife(),Rfe(),QD(),ED(),tD()}));function $D(e,t,n){let r=e-t+n*2;return e?r>0?r:1:0}function Bfe(e){return function(t){let n=t[0],r=t[1],i;return r=r&&n[c]<=i&&(a<0&&(a=c),o=c);if(!(a<0))return r=e.invertExtent(n[a]),i=e.invertExtent(n[o]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function eO(){let e=RT().unknown(void 0),t=e.domain,n=e.range,r=[0,1],i,a,o=!1,s=0,c=0,l=.5;delete e.unknown;function u(){let e=t().length,u=r[1]p+i*e);return n(u?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),u()):t()},e.range=function(e){return arguments.length?(r=[+e[0],+e[1]],u()):r.slice()},e.rangeRound=function(e){return r=[+e[0],+e[1]],o=!0,u()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,u()):o},e.padding=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),s=c,u()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),u()):s},e.paddingOuter=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),u()):c},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),u()):l},e.invertRange=function(e){if(e[0]==null||e[1]==null)return;let i=r[1]r[1-i])))return u=Math.max(0,Kg(o,c)-1),d=c===l?u:Kg(o,l)-1,c-o[u]>a+1e-10&&++u,i&&(f=u,u=s-d,d=s-f),u>d?void 0:t().slice(u,d+1)},e.invert=function(t){let n=e.invertRange([t,t]);return n&&n[0]},e.copy=function(){return eO().domain(t()).range(r).round(o).paddingInner(s).paddingOuter(c).align(l)},u()}function Hfe(e){let t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Hfe(t())},e}function Ufe(){return Hfe(eO().paddingInner(1))}function Wfe(e){return Spe.call(e,Ph)}function Gfe(){let e=[],t=[];function n(n){return n==null||n!==n?void 0:t[(Kg(e,n)-1)%t.length]}return n.domain=function(t){return arguments.length?(e=Wfe(t),n):e.slice()},n.range=function(e){return arguments.length?(t=Cpe.call(e),n):t.slice()},n.tickFormat=function(t,n){return Ode(e[0],Mh(e),t??10,n)},n.copy=function(){return Gfe().domain(n.domain()).range(n.range())},n}function Kfe(e){return e[EO]=!0,e}function qfe(e){return e&&e[EO]===!0}function Jfe(e,t,n){let r=function(){let n=t();return n.invertRange||=n.invert?Bfe(n):n.invertExtent?Vfe(n):void 0,n.type=e,Kfe(n)};return r.metadata=Ng(ng(n)),r}function tO(e,t,n){return arguments.length>1?(TO.set(e,Jfe(e,t,n)),this):Yfe(e)?TO.get(e):void 0}function Yfe(e){return TO.has(e)}function nO(e,t){let n=TO.get(e);return n&&n.metadata[t]}function rO(e){return nO(e,bO)}function iO(e){return nO(e,xO)}function aO(e){return nO(e,SO)}function oO(e){return nO(e,`log`)}function Xfe(e){return nO(e,wO)}function Zfe(e){return nO(e,CO)}function Qfe(e){return nO(e,_O)}function $fe(e,t){let n=t[0],r=Mh(t)-n;return function(t){return e(n+t*r)}}function sO(e,t,n){return TD(cO(t||`rgb`,n),e)}function epe(e,t){let n=Array(t),r=t+1;for(let i=0;ie[t]?o[t](e[t]()):0),o)}function cO(e,t){let n=xde[npe(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function npe(e){return`interpolate`+e.toLowerCase().split(`-`).map(e=>e[0].toUpperCase()+e.slice(1)).join(``)}function rpe(e){if(H(e))return e;let t=e.length/6|0,n=Array(t);for(let r=0;r1?(DO[e]=t,this):DO[e]}function uO(e,t,n){let r;if(wg(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null)){let r=e.domain(),i=Math.min(r[0],Mh(r)),a=Math.max(r[0],Mh(r));if(t=Math.min(t,Math.floor((a-i)/n||1)+1),!e.bins&&!oO(e.type)&&!Xfe(e.type)&&i1&&n_(i,a,t)a&&(r=a,a=i,i=r,o=kpe),i=Math.floor(i),a=Math.ceil(a),t=t.map(t=>[t,e(t)]).filter(e=>i<=e[1]&&e[1]<=a).sort(o).map(e=>e[0]),n>0&&t.length>1){let e=[t[0],Mh(t)];for(;t.length>n&&t.length>=3;)t=t.filter((e,t)=>!(t%2));t.length<3&&(t=e)}return t}function dO(e,t){return e.bins?ape(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function ope(e,t,n,r,i,a){let o=t.type,s=Dpe;if(o===`time`||i===`time`)s=e.timeFormat(r);else if(o===`utc`||i===`utc`)s=e.utcFormat(r);else if(oO(o)){let i=e.formatFloat(r);if(a||t.bins)s=i;else{let e=spe(t,n,!1);s=t=>e(t)?i(t):``}}else if(t.tickFormat){let i=t.domain();s=e.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=e.format(r));return s}function spe(e,t,n){let r=dO(e,t),i=e.base(),a=Math.log(i),o=Math.max(1,i*t/r.length),s=e=>{let t=e/i**+Math.round(Math.log(e)/a);return t*i1?r[1]-r[0]:r[0],o;for(o=1;o(e-r)/a}function mpe(e,t,n,r){let i=r||t.type;return Eg(n)&&Xfe(i)&&(n=n.replace(/%a/g,`%A`).replace(/%b/g,`%B`)),!n&&i===`time`?e.timeFormat(`%A, %d %B %Y, %X`):!n&&i===`utc`?e.utcFormat(`%A, %d %B %Y, %X UTC`):fpe(e,t,5,null,n,r,!0)}function hpe(e,t,n){n||={};let r=Math.max(3,n.maxlen||7),i=mpe(e,t,n.format,n.formatType);if(aO(t.type)){let e=cpe(t).slice(1).map(i),n=e.length;return`${n} boundar${n===1?`y`:`ies`}: ${e.join(`, `)}`}else if(iO(t.type)){let e=t.domain(),n=e.length,a=n>r?e.slice(0,r-2).map(i).join(`, `)+`, ending with `+e.slice(-1).map(i):e.map(i).join(`, `);return`${n} value${n===1?``:`s`}: ${a}`}else{let e=t.domain();return`values from ${i(e[0])} to ${i(Mh(e))}`}}var gpe,fO,pO,mO,_pe,hO,gO,_O,vO,yO,vpe,ype,bpe,xpe,bO,xO,SO,CO,wO,Spe,Cpe,TO,EO,wpe,Tpe,Epe,DO,Dpe,Ope,kpe,OO,kO,Ape,jpe,AO,Mpe,Npe,jO,MO=o((()=>{Fg(),c_(),vfe(),ED(),zfe(),Iy(),gpe=`identity`,fO=`linear`,pO=`sqrt`,mO=`symlog`,_pe=`time`,hO=`sequential`,gO=`diverging`,_O=`quantile`,vO=`quantize`,yO=`threshold`,vpe=`ordinal`,ype=`point`,bpe=`band`,xpe=`bin-ordinal`,bO=`continuous`,xO=`discrete`,SO=`discretizing`,CO=`interpolating`,wO=`temporal`,Spe=Array.prototype.map,Cpe=Array.prototype.slice,TO=new Map,EO=Symbol(`vega_scale`),tO(gpe,jde),tO(fO,Ade,bO),tO(`log`,Ude,[bO,`log`]),tO(`pow`,HD,bO),tO(pO,Xde,bO),tO(mO,Kde,bO),tO(_pe,afe,[bO,wO]),tO(`utc`,sfe,[bO,wO]),tO(hO,qD,[bO,CO]),tO(`${hO}-${fO}`,qD,[bO,CO]),tO(`${hO}-log`,lfe,[bO,CO,`log`]),tO(`${hO}-pow`,JD,[bO,CO]),tO(`${hO}-${pO}`,dfe,[bO,CO]),tO(`${hO}-${mO}`,ufe,[bO,CO]),tO(`${gO}-${fO}`,pfe,[bO,CO]),tO(`${gO}-log`,mfe,[bO,CO,`log`]),tO(`${gO}-pow`,XD,[bO,CO]),tO(`${gO}-${pO}`,gfe,[bO,CO]),tO(`${gO}-${mO}`,hfe,[bO,CO]),tO(_O,Zde,[SO,_O]),tO(vO,$de,SO),tO(yO,tfe,SO),tO(xpe,Gfe,[xO,SO]),tO(vpe,RT,xO),tO(bpe,eO,xO),tO(ype,Ufe,xO),wpe=[`clamp`,`base`,`constant`,`exponent`],Tpe={blues:`cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90`,greens:`d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429`,greys:`e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e`,oranges:`fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303`,purples:`e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c`,reds:`fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13`,blueGreen:`d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429`,bluePurple:`ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71`,greenBlue:`d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1`,orangeRed:`fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403`,purpleBlue:`dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281`,purpleBlueGreen:`dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353`,purpleRed:`dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a`,redPurple:`fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174`,yellowGreen:`e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034`,yellowOrangeBrown:`feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204`,yellowOrangeRed:`fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225`,blueOrange:`134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07`,brownBlueGreen:`704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147`,purpleGreen:`5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29`,purpleOrange:`4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07`,redBlue:`8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85`,redGrey:`8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434`,yellowGreenBlue:`eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185`,redYellowBlue:`a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695`,redYellowGreen:`a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837`,pinkYellowGreen:`8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419`,spectral:`9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2`,viridis:`440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725`,magma:`0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf`,inferno:`0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4`,plasma:`0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921`,cividis:`00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647`,rainbow:`6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa`,sinebow:`ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040`,turbo:`23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00`,browns:`eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632`,tealBlues:`bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985`,teals:`bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667`,warmGreys:`dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e`,goldGreen:`f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36`,goldOrange:`f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26`,goldRed:`f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e`,lightGreyRed:`efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b`,lightGreyTeal:`e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc`,lightMulti:`e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c`,lightOrange:`f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b`,lightTealBlue:`e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988`,darkBlue:`3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff`,darkGold:`3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff`,darkGreen:`3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa`,darkMulti:`3737371f5287197d8c29a86995ce3fffe800ffffff`,darkRed:`3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c`},Epe={accent:xfe,category10:yfe,category20:`1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5`,category20b:`393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6`,category20c:`3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9`,dark2:Cfe,observable10:Tfe,paired:Dfe,pastel1:kfe,pastel2:jfe,set1:Nfe,set2:Ffe,set3:Lfe,tableau10:`4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac`,tableau20:`4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5`},DO={},ipe(Epe,rpe),ipe(Tpe,e=>sO(rpe(e))),Dpe=e=>H(e)?e.map(e=>String(e)):String(e),Ope=(e,t)=>e[1]-t[1],kpe=(e,t)=>t[1]-e[1],OO={[_O]:`quantiles`,[vO]:`thresholds`,[yO]:`domain`},kO={[_O]:`quantiles`,[vO]:`domain`},Ape=e=>OO[e.type]||e.bins,jpe=e=>(t,n,r)=>{let i=AO(r[n+1],AO(r.max,1/0)),a=jO(t,e),o=jO(i,e);return a&&o?a+` – `+o:o?`< `+o:`≥ `+a},AO=(e,t)=>e??t,Mpe=e=>(t,n)=>n?e(t):null,Npe=e=>t=>e(t),jO=(e,t)=>Number.isFinite(e)?t(e):null}));function Ppe(){qk=0}function NO(e){return e&&e.gradient}function Fpe(e,t,n){let r=e.gradient,i=e.id,a=r===`radial`?Jk:``;return i||(i=e.id=`gradient_`+qk++,r===`radial`?(e.x1=PO(e.x1,.5),e.y1=PO(e.y1,.5),e.r1=PO(e.r1,0),e.x2=PO(e.x2,.5),e.y2=PO(e.y2,.5),e.r2=PO(e.r2,.5),a=Jk):(e.x1=PO(e.x1,0),e.y1=PO(e.y1,0),e.x2=PO(e.x2,1),e.y2=PO(e.y2,0))),t[i]=e,`url(`+(n||``)+`#`+a+i+`)`}function PO(e,t){return e??t}function Ipe(e,t){var n=[],r;return r={gradient:`linear`,x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(e,t){return n.push({offset:e,color:t}),r}}}function FO(e,t,n){var r=_g(Yk,e)&&Yk[e],i=null;return r&&(i=r.curve||r[t||`vertical`],r.tension&&n!=null&&(i=i[r.tension](n))),i}function IO(e){let t=[];return(e.match(Zhe)||[]).forEach(e=>{let n=e[0],r=n.toLowerCase(),i=Xhe[r],a=Lpe(r,i,e.slice(1).trim()),o=a.length;if(o1&&(h=Math.sqrt(h),n*=h,r*=h);let g=f/n,_=d/n,v=-d/r,y=f/r,b=g*s+_*c,x=v*s+y*c,S=g*e+_*t,C=v*e+y*t,w=1/((S-b)*(S-b)+(C-x)*(C-x))-.25;w<0&&(w=0);let T=Math.sqrt(w);a==i&&(T=-T);let E=.5*(b+S)-T*(C-x),D=.5*(x+C)+T*(S-b),O=Math.atan2(x-D,b-E),k=Math.atan2(C-D,S-E)-O;k<0&&a===1?k+=Qk:k>0&&a===0&&(k-=Qk);let A=Math.ceil(Math.abs(k/(Zk+.001))),j=[];for(let e=0;e+e}function zO(e,t,n){return Math.max(t,Math.min(e,n))}function Jpe(){var e=Wpe,t=Gpe,n=Kpe,r=qpe,i=RO(0),a=i,o=i,s=i,c=null;function l(l,u,d){var f,p=u??+e.call(this,l),m=d??+t.call(this,l),h=+n.call(this,l),g=+r.call(this,l),_=Math.min(h,g)/2,v=zO(+i.call(this,l),0,_),y=zO(+a.call(this,l),0,_),b=zO(+o.call(this,l),0,_),x=zO(+s.call(this,l),0,_);if(c||=f=Tw(),v<=0&&y<=0&&b<=0&&x<=0)c.rect(p,m,h,g);else{var S=p+h,C=m+g;c.moveTo(p+v,m),c.lineTo(S-y,m),c.bezierCurveTo(S-sA*y,m,S,m+sA*y,S,m+y),c.lineTo(S,C-x),c.bezierCurveTo(S,C-sA*x,S-sA*x,C,S-x,C),c.lineTo(p+b,C),c.bezierCurveTo(p+sA*b,C,p,C-sA*b,p,C-b),c.lineTo(p,m+v),c.bezierCurveTo(p,m+sA*v,p+sA*v,m,p+v,m),c.closePath()}if(f)return c=null,f+``||null}return l.x=function(t){return arguments.length?(e=RO(t),l):e},l.y=function(e){return arguments.length?(t=RO(e),l):t},l.width=function(e){return arguments.length?(n=RO(e),l):n},l.height=function(e){return arguments.length?(r=RO(e),l):r},l.cornerRadius=function(e,t,n,r){return arguments.length?(i=RO(e),a=t==null?i:RO(t),s=n==null?i:RO(n),o=r==null?a:RO(r),l):i},l.context=function(e){return arguments.length?(c=e??null,l):c},l}function Ype(){var e,t,n,r,i=null,a,o,s,c;function l(e,t,n){let r=n/2;if(a){var l=s-t,u=e-o;if(l||u){var d=Math.hypot(l,u),f=(l/=d)*c,p=(u/=d)*c,m=Math.atan2(u,l);i.moveTo(o-f,s-p),i.lineTo(e-l*r,t-u*r),i.arc(e,t,r,m-Math.PI,m),i.lineTo(o+f,s+p),i.arc(o,s,c,m,m+Math.PI)}else i.arc(e,t,r,0,Qk);i.closePath()}else a=1;o=e,s=t,c=r}function u(o){var s,c=o.length,u,d=!1,f;for(i??=f=Tw(),s=0;s<=c;++s)!(stge?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),c=(-o+u)/a,l=(-o-u)/a)):c=.5*s/o,0f)return!1;h>d&&(d=h)}else if(p>0){if(h0?(e.globalAlpha=n,e.fillStyle=dme(e,t,t.fill),!0):!1}function nk(e,t,n){var r=(r=t.strokeWidth)??1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=dme(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||`butt`,e.lineJoin=t.strokeJoin||`miter`,e.miterLimit=t.strokeMiterLimit==null?4:t.strokeMiterLimit,e.setLineDash&&(e.setLineDash(t.strokeDash||Oge),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function fme(e,t){return e.zindex-t.zindex||e.index-t.index}function rk(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,a;for(i=0,a=t.length;i=0;)if(r=t(n[i]))return r;if(n===a){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function ok(e){return function(t,n,r){ik(n,n=>{(!r||r.intersects(n.bounds))&&mme(e,t,n,n)})}}function pme(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&mme(e,t,n.items[0],n.items)}}function mme(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||($O(t,n),n.fill&&tk(t,n,i)&&t.fill(),n.stroke&&nk(t,n,i)&&t.stroke()))}function sk(e){return e||=Sh,function(t,n,r,i,a,o){return r*=t.pixelRatio,i*=t.pixelRatio,ak(n,n=>{let s=n.bounds;if(!(s&&!s.contains(a,o)||!s)&&e(t,n,r,i,a,o))return n})}}function ck(e,t){return function(n,r,i,a){var o=Array.isArray(r)?r[0]:r,s=t??o.fill,c=o.stroke&&n.isPointInStroke,l,u;return c&&(l=o.strokeWidth,u=o.strokeCap,n.lineWidth=l??1,n.lineCap=u??`butt`),e(n,r)?!1:s&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function lk(e){return sk(ck(e))}function uk(e,t){return`translate(`+e+`,`+t+`)`}function dk(e){return`rotate(`+e+`)`}function hme(e,t){return`scale(`+e+`,`+t+`)`}function gme(e){return uk(e.x||0,e.y||0)}function _me(e){return uk(e.x||0,e.y||0)+(e.angle?` `+dk(e.angle):``)}function vme(e){return uk(e.x||0,e.y||0)+(e.angle?` `+dk(e.angle):``)+(e.scaleX||e.scaleY?` `+hme(e.scaleX||1,e.scaleY||1):``)}function fk(e,t,n){function r(e,n){e(`transform`,_me(n)),e(`d`,t(null,n))}function i(e,n){return t(YO(e,n.angle),n),JO(e,n,!0).translate(n.x||0,n.y||0)}function a(e,n){var r=n.x||0,i=n.y||0,a=n.angle||0;e.translate(r,i),a&&e.rotate(a*=Xk),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-r,-i)}return{type:e,tag:`path`,nested:!1,attr:r,bound:i,draw:ok(a),pick:lk(a),isect:n||XO(a)}}function yme(e,t){for(var n=e[0].orient===`horizontal`?t[1]:t[0],r=e[0].orient===`horizontal`?`y`:`x`,i=e.length,a=1/0,o,s;--i>=0;)e[i].defined!==!1&&(s=Math.abs(e[i][r]-n),s=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],a=e[r].y-t[1],o=i*i+a*a,o=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],a=r*r+i*i,r=e[n].size||1,a.5&&t<1.5?.5-Math.abs(t-1):0:e.strokeOffset}function Tme(e,t){e(`transform`,gme(t))}function Eme(e,t){let n=wme(t);e(`d`,HO(null,t,n,n))}function Dme(e,t){e(`class`,`background`),e(`aria-hidden`,!0),Eme(e,t)}function Ome(e,t){e(`class`,`foreground`),e(`aria-hidden`,!0),t.strokeForeground?Eme(e,t):e(`d`,``)}function kme(e,t,n){e(`clip-path`,t.clip?UO(n,t,t):null)}function Ame(e,t){if(!t.clip&&t.items){let n=t.items,r=n.length;for(let t=0;t{let i=t.x||0,a=t.y||0,o=t.strokeForeground,s=t.opacity==null?1:t.opacity;(t.stroke||t.fill)&&s&&(mk(e,t,i,a),$O(e,t),t.fill&&tk(e,t,s)&&e.fill(),t.stroke&&!o&&nk(e,t,s)&&e.stroke()),e.save(),e.translate(i,a),t.clip&&Cme(e,t),n&&n.translate(-i,-a),ik(t,t=>{(t.marktype===`group`||r==null||r.includes(t.marktype))&&this.draw(e,t,n,r)}),n&&n.translate(i,a),e.restore(),o&&t.stroke&&s&&(mk(e,t,i,a),$O(e,t),nk(e,t,s)&&e.stroke())})}function Mme(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a)||!t.items)return null;let o=n*e.pixelRatio,s=r*e.pixelRatio;return ak(t,c=>{let l,u,d,f=c.bounds;if(f&&!f.contains(i,a))return;u=c.x||0,d=c.y||0;let p=u+(c.width||0),m=d+(c.height||0),h=c.clip;if(h&&(ip||am))return;if(e.save(),e.translate(u,d),u=i-u,d=a-d,h&&VO(c)&&!Nge(e,c,o,s))return e.restore(),null;let g=c.strokeForeground,_=t.interactive!==!1;return _&&g&&c.stroke&&Mge(e,c,o,s)?(e.restore(),c):(l=ak(c,e=>Nme(e,u,d)?this.pick(e,n,r,u,d):null),!l&&_&&(c.fill||!g&&c.stroke)&&jge(e,c,o,s)&&(l=c),e.restore(),l||null)})}function Nme(e,t,n){return(e.interactive!==!1||e.marktype===`group`)&&e.bounds&&e.bounds.contains(t,n)}function hk(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(t=>{e.image=t,e.image.url=e.url})),n}function gk(e,t){return e.width==null?!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:e.width}function _k(e,t){return e.height==null?!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:e.height}function vk(e,t){return e===`center`?t/2:e===`right`?t:0}function yk(e,t){return e===`middle`?t/2:e===`bottom`?t:0}function Pme(e,t,n){let r=hk(t,n),i=gk(t,r),a=_k(t,r),o=(t.x||0)-vk(t.align,i),s=(t.y||0)-yk(t.baseline,a);e(`href`,!r.src&&r.toDataURL?r.toDataURL():r.src||``,jA[`xmlns:xlink`],`xlink:href`),e(`transform`,uk(o,s)),e(`width`,i),e(`height`,a),e(`preserveAspectRatio`,t.aspect===!1?`none`:`xMidYMid`)}function Fme(e,t){let n=t.image,r=gk(t,n),i=_k(t,n),a=(t.x||0)-vk(t.align,r),o=(t.y||0)-yk(t.baseline,i);return e.set(a,o,a+r,o+i)}function Ime(e,t,n){ik(t,t=>{if(n&&!n.intersects(t.bounds))return;let r=hk(t,this),i=gk(t,r),a=_k(t,r);if(i===0||a===0)return;let o=(t.x||0)-vk(t.align,i),s=(t.y||0)-yk(t.baseline,a),c,l,u;t.aspect!==!1&&(c=r.width/r.height,l=t.width/t.height,c===c&&l===l&&c!==l&&(l{if(!(n&&!n.intersects(t.bounds))){var r=t.opacity==null?1:t.opacity;r&&Wme(e,t,r)&&($O(e,t),e.stroke())}})}function Kme(e,t,n,r){return e.isPointInStroke?Wme(e,t,1)&&e.isPointInStroke(n,r):!1}function qme(e){NA.width=e&&kA?Sk:xk}function xk(e,t){return Jme(Dk(e,t),Ck(e))}function Jme(e,t){return~~(.8*e.length*t)}function Sk(e,t){return Ck(e)<=0||!(t=Dk(e,t))?0:Yme(t,kk(e))}function Yme(e,t){let n=`(${t}) ${e}`,r=MA.get(n);return r===void 0&&(kA.font=t,r=kA.measureText(e).width,MA.set(n,r)),r}function Ck(e){return e.fontSize==null?11:+e.fontSize||0}function wk(e){return e.lineHeight==null?Ck(e)+2:e.lineHeight}function Xme(e){return H(e)?e.length>1?e:e[0]:e}function Tk(e){return Xme(e.lineBreak&&e.text&&!H(e.text)?e.text.split(e.lineBreak):e.text)}function Ek(e){let t=Tk(e);return(H(t)?t.length-1:0)*wk(e)}function Dk(e,t){let n=t==null?``:(t+``).trim();return e.limit>0&&n.length?Qme(e,n):n}function Zme(e){if(NA.width===Sk){let t=kk(e);return e=>Yme(e,t)}else if(NA.width===xk){let t=Ck(e);return e=>Jme(e,t)}else return t=>NA.width(e,t)}function Qme(e,t){var n=+e.limit,r=Zme(e);if(r(t)>>1,r(t.slice(c))>n?o=c+1:s=c;return i+t.slice(o)}else{for(;o>>1),r(t.slice(0,c))Math.max(e,NA.width(t,n)),0)):d=NA.width(t,u),i===`center`?c-=d/2:i===`right`&&(c-=d),e.set(c+=o,l+=s,c+d,l+r),t.angle&&!n)e.rotate(t.angle*Xk,o,s);else if(n===2)return e.rotatedPoints(t.angle*Xk,o,s);return e}function ehe(e,t,n){ik(t,t=>{var r=t.opacity==null?1:t.opacity,i,a,o,s,c,l,u;if(!(n&&!n.intersects(t.bounds)||r===0||t.fontSize<=0||t.text==null||t.text.length===0)){if(e.font=kk(t),e.textAlign=t.align||`left`,i=jk(t),a=i.x1,o=i.y1,t.angle&&(e.save(),e.translate(a,o),e.rotate(t.angle*Xk),a=o=0),a+=t.dx||0,o+=(t.dy||0)+Ak(t),l=Tk(t),$O(e,t),H(l))for(c=wk(t),s=0;st;)e.removeChild(n[--r]);return e}function che(e){return`mark-`+e.marktype+(e.role?` role-`+e.role:``)+(e.name?` `+e.name:``)}function Rk(e,t){if(t.getScreenCTM){let n=lhe(e,t.getScreenCTM());if(n)return n}return uhe(e,t,t.getBoundingClientRect())}function lhe(e,t){if(!t)return null;let n=t.a*t.d-t.b*t.c;if(!n)return null;let r=e.clientX-t.e,i=e.clientY-t.f;return[(t.d*r-t.c*i)/n,(t.a*i-t.b*r)/n]}function uhe(e,t,n){let r=t.offsetWidth?n.width/t.offsetWidth:1,i=t.offsetHeight?n.height/t.offsetHeight:1;return[(e.clientX-n.left)/r-(t.clientLeft||0),(e.clientY-n.top)/i-(t.clientTop||0)]}function dhe(e,t,n,r){var i=e&&e.mark,a,o;if(i&&(a=FA[i.marktype]).tip){for(o=Rk(t,n),o[0]-=r[0],o[1]-=r[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=a.tip(i.items,o)}return e}function fhe(e,t,n,r){e.element().setAttribute(`title`,r||``)}function phe(e,t){lj(t).forEach(t=>mhe(e,t))}function mhe(e,t){let n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}function zk(e,t,n){t.forEach(t=>e.fire(t,n))}function hhe(e,t,n){return function(r){let i=this._active,a=this.pickEvent(r);a===i?zk(this,e,r):((!i||!i.exit)&&zk(this,n,r),this._active=a,zk(this,t,r),zk(this,e,r))}}function ghe(e){return function(t){zk(this,e,t),this._active=null}}function _he(){return typeof window<`u`&&window.devicePixelRatio||1}function vhe(e,t,n,r,i,a){let o=typeof HTMLElement<`u`&&e instanceof HTMLElement&&e.parentNode!=null,s=e.getContext(`2d`),c=o?_he():i;e.width=t*c,e.height=n*c;for(let e in a)s[e]=a[e];return o&&c!==1&&(e.style.width=t+`px`,e.style.height=n+`px`),s.pixelRatio=c,s.setTransform(c,0,0,c,c*r[0],c*r[1]),e}function yhe(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}function bhe(e,t){let n=t.aria===!1;if(e(mj,n||void 0),n||t.description==null)for(let t in Cj)e(Cj[t],void 0);else{let n=t.mark.marktype;e(hj,t.description),e(gj,t.ariaRole||(n===`group`?vj:yj)),e(_j,t.ariaRoleDescription||`${n} mark`)}}function xhe(e){return e.aria===!1?{[mj]:!0}:xj[e.role]?null:Sj[e.role]?Che(e,Sj[e.role]):She(e)}function She(e){let t=e.marktype,n=t===`group`||t===`text`||e.items.some(e=>e.description!=null&&e.aria!==!1);return bj(n?vj:yj,`${t} mark container`,e.description)}function Che(e,t){try{let n=e.items[0],r=t.caption||(()=>``);return bj(t.role||yj,t.desc,e.description||n.description||r(n))}catch{return null}}function whe(e){return ng(e.text).join(` `)}function The(e){let t=e.datum,n=e.orient,r=t.title?Dhe(e):null,i=e.context,a=i.scales[t.scale].value,o=i.dataflow.locale(),s=a.type;return`${n===`left`||n===`right`?`Y`:`X`}-axis`+(r?` titled '${r}'`:``)+` for a ${iO(s)?`discrete`:s} scale with ${hpe(o,a,e)}`}function Ehe(e){let t=e.datum,n=t.title?Dhe(e):null,r=`${t.type||``} legend`.trim(),i=t.scales,a=Object.keys(i),o=e.context,s=o.scales[i[a[0]]].value,c=o.dataflow.locale();return khe(r)+(n?` titled '${n}'`:``)+` for ${Ohe(a)} with ${hpe(c,s,e)}`}function Dhe(e){try{return ng(Mh(e.items).items[0].text).join(` `)}catch{return null}}function Ohe(e){return e=e.map(e=>e+(e===`fill`||e===`stroke`?` color`:``)),e.length<2?e[0]:e.slice(0,-1).join(`, `)+` and `+Mh(e)}function khe(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Bk(){let e=``,t=``,n=``,r=[],i=()=>t=n=``,a=a=>{t&&(e+=`${t}>${n}`,i()),r.push(a)},o=(e,n)=>(n!=null&&(t+=` ${e}="${Tj(n)}"`),s),s={open(e,...n){a(e),t=`<`+e;for(let e of n)for(let t in e)o(t,e[t]);return s},close(){let a=r.pop();return t?e+=t+(n?`>${n}`:`/>`):e+=``,i(),s},attr:o,text:e=>(n+=wj(e),s),toString:()=>e};return s}function Ahe(e,t){if(e.open(t.tagName),t.hasAttributes()){let n=t.attributes,r=n.length;for(let t=0;t{i=e.mark(t,n,i,r),++a}),Lk(t,1+a)}function Fhe(e,t,n,r,i){let a=e._svg,o;if(!a&&(o=t.ownerDocument,a=Pk(o,r,Mj),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:`default`},r===`g`))){let t=Pk(o,`path`,Mj);a.appendChild(t),t.__data__=e;let n=Pk(o,`g`,Mj);a.appendChild(n),n.__data__=e;let r=Pk(o,`path`,Mj);a.appendChild(r),r.__data__=e,r.__values__={fill:`default`}}return(a.ownerSVGElement!==i||Ihe(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}function Ihe(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}function Vk(e,t,n){t!==Fj[e]&&(n?Lhe(Pj,e,t,n):Wk(Pj,e,t),Fj[e]=t)}function Hk(e,t,n){n!==Fj[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+``),Fj[t]=n)}function Uk(e,t){for(let n in t)Wk(e,n,t[n])}function Wk(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Lhe(e,t,n,r){n==null?e.removeAttributeNS(r,t):e.setAttributeNS(r,t,n)}function Rhe(){let e;return typeof window>`u`?``:(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function zhe(e,t,n,r,i){let a;if(t==null||(r===`bgrect`&&n.interactive===!1&&(e[`pointer-events`]=`none`),r===`bgfore`&&(n.interactive===!1&&(e[`pointer-events`]=`none`),e.display=`none`,t.fill!==null)))return e;r===`image`&&t.smooth===!1&&(a=[`image-rendering: optimizeSpeed;`,`image-rendering: pixelated;`]),r===`text`&&(e[`font-family`]=Ok(t),e[`font-size`]=Ck(t)+`px`,e[`font-style`]=t.fontStyle,e[`font-variant`]=t.fontVariant,e[`font-weight`]=t.fontWeight);for(let n in Dj){let r=t[n],a=Dj[n];r===`transparent`&&(a===`fill`||a===`stroke`)||r!=null&&(NO(r)&&(r=Fpe(r,i.gradient,``)),e[a]=r)}for(let e in Oj){let n=t[e];n!=null&&(a||=[],a.push(`${Oj[e]}: ${n};`))}return a&&(e.style=a.join(` `)),e}function Bhe(e){Rj.svgMarkTypes=e.svgMarkTypes??[`text`],Rj.svgOnTop=e.svgOnTop??!0,Rj.debug=e.debug??!1}function Gk(e,t){return e=String(e||``).toLowerCase(),arguments.length>1?(qj[e]=t,this):qj[e]}function Vhe(e,t,n){let r=[],i=new WO().union(t),a=e.marktype;return a?Hhe(e,i,n,r):a===`group`?Whe(e,i,n,r):V(`Intersect scene must be mark node or group item.`)}function Hhe(e,t,n,r){if(Uhe(e,t,n)){let i=e.items,a=e.marktype,o=i.length,s=0;if(a===`group`)for(;s=0;a--)if(n[a]!=r[a])return!1;for(a=n.length-1;a>=0;a--)if(i=n[a],!Kk(e[i],t[i],i))return!1;return typeof e==typeof t}function Yhe(){nme(),Ppe()}var qk,Jk,Yk,Xhe,Zhe,Qhe,$he,ege,Xk,tge,Zk,Qk,$k,eA,tA,nA,rA,iA,aA,oA,sA,cA,lA,nge,rge,ige,age,oge,sge,cge,lge,uge,dge,fge,pge,mge,hge,gge,_ge,uA,vge,yge,bge,xge,Sge,Cge,wge,Tge,dA,fA,Ege,pA,mA,hA,gA,_A,vA,yA,bA,xA,SA,CA,wA,TA,EA,DA,OA,Dge,kA,AA,Oge,kge,Age,jge,Mge,Nge,Pge,jA,Fge,Ige,Lge,Rge,zge,Bge,Vge,MA,NA,Hge,PA,FA,IA,Uge,LA,RA,zA,Wge,Gge,Kge,BA,VA,HA,UA,qge,WA,GA,KA,qA,Jge,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj=o((()=>{Fg(),uue(),jw(),PT(),ex(),MO(),qk=0,Jk=`p_`,Yk={basis:{curve:Gle},"basis-closed":{curve:Kle},"basis-open":{curve:Jle},bundle:{curve:nT,tension:`beta`,value:.85},cardinal:{curve:aT,tension:`tension`,value:0},"cardinal-open":{curve:dT,tension:`tension`,value:0},"cardinal-closed":{curve:cT,tension:`tension`,value:0},"catmull-rom":{curve:hT,tension:`alpha`,value:.5},"catmull-rom-closed":{curve:vT,tension:`alpha`,value:.5},"catmull-rom-open":{curve:bT,tension:`alpha`,value:.5},linear:{curve:Rw},"linear-closed":{curve:$le},monotone:{horizontal:nue,vertical:tue},natural:{curve:iue},step:{curve:oue},"step-after":{curve:cue},"step-before":{curve:sue}},Xhe={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Zhe=/[mlhvzcsqta]([^mlhvzcsqta]*)/gi,Qhe=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,$he=/^((\s+,?\s*)|(,\s*))/,ege=/^[01]/,Xk=Math.PI/180,tge=1e-14,Zk=Math.PI/2,Qk=Math.PI*2,$k=Math.sqrt(3)/2,eA={},tA={},nA=[].join,rA=[`l`,0,0,0,0,0,0,0],iA=.5773502691896257,aA={circle:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Qk)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/2.5;e.moveTo(-n,-r),e.lineTo(-n,r),e.lineTo(-r,r),e.lineTo(-r,n),e.lineTo(r,n),e.lineTo(r,r),e.lineTo(n,r),e.lineTo(n,-r),e.lineTo(r,-r),e.lineTo(r,-n),e.lineTo(-r,-n),e.lineTo(-r,-r),e.closePath()}},diamond:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/7,i=n/2.5,a=n/8;e.moveTo(-r,n),e.lineTo(r,n),e.lineTo(r,-a),e.lineTo(i,-a),e.lineTo(0,-n),e.lineTo(-i,-a),e.lineTo(-r,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n,i=r-n*iA,a=n/4;e.moveTo(0,-r-i),e.lineTo(-a,r-i),e.lineTo(a,r-i),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n,i=r-n*iA;e.moveTo(0,-r-i),e.lineTo(-n,r-i),e.lineTo(n,r-i),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n;e.moveTo(0,-r),e.lineTo(-n,r),e.lineTo(n,r),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n;e.moveTo(0,r),e.lineTo(-n,-r),e.lineTo(n,-r),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n;e.moveTo(r,0),e.lineTo(-r,-n),e.lineTo(-r,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,r=$k*n;e.moveTo(-r,0),e.lineTo(r,-n),e.lineTo(r,n),e.closePath()}},stroke:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}},oA={},sA=.448084975506,cA=e=>e.x||0,lA=e=>e.y||0,nge=e=>e.width||0,rge=e=>e.height||0,ige=e=>(e.x||0)+(e.width||0),age=e=>(e.y||0)+(e.height||0),oge=e=>e.startAngle||0,sge=e=>e.endAngle||0,cge=e=>e.padAngle||0,lge=e=>e.innerRadius||0,uge=e=>e.outerRadius||0,dge=e=>e.cornerRadius||0,fge=e=>BO(e.cornerRadiusTopLeft,e.cornerRadius)||0,pge=e=>BO(e.cornerRadiusTopRight,e.cornerRadius)||0,mge=e=>BO(e.cornerRadiusBottomRight,e.cornerRadius)||0,hge=e=>BO(e.cornerRadiusBottomLeft,e.cornerRadius)||0,gge=e=>BO(e.size,64),_ge=e=>e.size||1,uA=e=>e.defined!==!1,vge=e=>Hpe(e.shape||`circle`),yge=Ble().startAngle(oge).endAngle(sge).padAngle(cge).innerRadius(lge).outerRadius(uge).cornerRadius(dge),bge=Gw().x(cA).y1(lA).y0(age).defined(uA),xge=Gw().y(lA).x1(cA).x0(ige).defined(uA),Sge=Uw().x(cA).y(lA).defined(uA),Cge=Jpe().x(cA).y(lA).width(nge).height(rge).cornerRadius(fge,pge,mge,hge),wge=Ule().type(vge).size(gge),Tge=Ype().x(cA).y(lA).defined(uA).size(_ge),dA=1,WO.prototype={clone(){return new WO(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){let r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(e),c=Math.sin(e),l=t-t*s+n*c,u=n-t*c-n*s;return[s*r-c*i+l,c*r+s*i+u,s*r-c*o+l,c*r+s*o+u,s*a-c*i+l,c*a+s*i+u,s*a-c*o+l,c*a+s*o+u]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},U(KO,GO),fA=class{constructor(e){this._pending=0,this._loader=e||$b()}pending(){return this._pending}sanitizeURL(e){let t=this;return rme(t),t._loader.sanitize(e,{context:`href`}).then(e=>(qO(t),e)).catch(()=>(qO(t),null))}loadImage(e){let t=this,n=NT();return rme(t),t._loader.sanitize(e,{context:`image`}).then(e=>{let r=e.href;if(!r||!n)throw{url:r};let i=new n,a=_g(e,`crossOrigin`)?e.crossOrigin:`anonymous`;return a!=null&&(i.crossOrigin=a),i.onload=()=>qO(t),i.onerror=()=>qO(t),i.src=r,i}).catch(e=>(qO(t),{complete:!1,width:0,height:0,src:e&&e.url||``}))}ready(){let e=this;return new Promise(t=>{function n(r){e.pending()?setTimeout(()=>{n(!0)},10):t(r)}n(!1)})}},Ege=Qk-1e-8,xA=(e,t)=>pA.add(e,t),SA=(e,t)=>xA(mA=e,hA=t),CA=e=>xA(e,pA.y1),wA=e=>xA(pA.x1,e),TA=(e,t)=>_A*e+yA*t,EA=(e,t)=>vA*e+bA*t,DA=(e,t)=>xA(TA(e,t),EA(e,t)),OA=(e,t)=>SA(TA(e,t),EA(e,t)),Dge={beginPath(){},closePath(){},moveTo:OA,lineTo:OA,rect(e,t,n,r){gA?(DA(e+n,t),DA(e+n,t+r),DA(e,t+r),OA(e,t)):(xA(e+n,t+r),SA(e,t))},quadraticCurveTo(e,t,n,r){let i=TA(e,t),a=EA(e,t),o=TA(n,r),s=EA(n,r);ime(mA,i,o,CA),ime(hA,a,s,wA),SA(o,s)},bezierCurveTo(e,t,n,r,i,a){let o=TA(e,t),s=EA(e,t),c=TA(n,r),l=EA(n,r),u=TA(i,a),d=EA(i,a);ame(mA,o,c,u,CA),ame(hA,s,l,d,wA),SA(u,d)},arc(e,t,n,r,i,a){if(r+=gA,i+=gA,mA=n*Math.cos(i)+e,hA=n*Math.sin(i)+t,Math.abs(i-r)>Ege)xA(e-n,t-n),xA(e+n,t+n);else{let o=r=>xA(n*Math.cos(r)+e,n*Math.sin(r)+t),s,c;if(o(r),o(i),i!==r)if(r%=Qk,r<0&&(r+=Qk),i%=Qk,i<0&&(i+=Qk),ii;++c,s-=Zk)o(s);else for(s=r-r%Zk+Zk,c=0;c<4&&s=0;)if(e[r].type===t&&(!n||e[r].handler===n))return r;return-1}handlers(e){let t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(let e in t)n.push(...t[e]);return n}eventName(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:`href`}).then(t=>{let n=new MouseEvent(e.type,e),r=Pk(null,`a`);for(let e in t)r.setAttribute(e,t[e]);r.dispatchEvent(n)}).catch(()=>{})}handleTooltip(e,t,n){if(t&&t.tooltip!=null){t=dhe(t,e,this.canvas(),this._origin);let r=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,r)}}getItemBoundingClientRect(e){let t=this.canvas();if(!t)return;let n=t.getBoundingClientRect(),r=this._origin,i=e.bounds,a=i.width(),o=i.height(),s=i.x1+r[0]+n.left,c=i.y1+r[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,c+=e.y||0;return{x:s,y:c,width:a,height:o,left:s,top:c,right:s+a,bottom:c+o}}},zA=class{constructor(e){this._el=null,this._bgcolor=null,this._loader=new fA(e)}initialize(e,t,n,r,i){return this._el=e,this.resize(t,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,r){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(e,t){let n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){let n=this.render(e,t);return this._ready?this._ready.then(()=>n):Promise.resolve(n)}_load(e,t){var n=this,r=n._loader[e](t);if(!n._ready){let e=n._call;n._ready=n._loader.ready().then(t=>{t&&e(),n._ready=null})}return r}sanitizeURL(e){return this._load(`sanitizeURL`,e)}loadImage(e){return this._load(`loadImage`,e)}},Wge=`keydown`,Gge=`keypress`,Kge=`keyup`,BA=`dragenter`,VA=`dragleave`,HA=`dragover`,UA=`pointerdown`,qge=`pointerup`,WA=`pointermove`,GA=`pointerout`,KA=`pointerover`,qA=`mousedown`,Jge=`mouseup`,JA=`mousemove`,YA=`mouseout`,XA=`mouseover`,ZA=`click`,QA=`dblclick`,$A=`wheel`,ej=`mousewheel`,tj=`touchstart`,nj=`touchmove`,rj=`touchend`,ij=[Wge,Gge,Kge,BA,VA,HA,UA,qge,WA,GA,KA,qA,Jge,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj],aj=WA,oj=YA,sj=ZA,cj=class extends RA{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=ij,this.pointermove=hhe([WA,JA],[KA,XA],[GA,YA]),this.dragover=hhe([HA],[BA],[VA]),this.pointerout=ghe([GA,YA]),this.dragleave=ghe([VA])}initialize(e,t,n){return this._canvas=e&&Fk(e,`canvas`),[ZA,qA,UA,WA,GA,VA].forEach(e=>phe(this,e)),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext(`2d`)}DOMMouseScroll(e){this.fire(ej,e)}pointerdown(e){this._down=this._active,this.fire(UA,e)}mousedown(e){this._down=this._active,this.fire(qA,e)}click(e){this._down===this._active&&(this.fire(ZA,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&=(this._active=this._touch,!1),this.fire(tj,e,!0)}touchmove(e){this.fire(nj,e,!0)}touchend(e){this.fire(rj,e,!0),this._touch=null}fire(e,t,n){let r=n?this._touch:this._active,i=this._handlers[e];if(t.vegaType=e,e===sj&&r&&r.href?this.handleHref(t,r,r.href):(e===aj||e===oj)&&this.handleTooltip(t,r,e!==oj),i)for(let e=0,n=i.length;e=0&&r.splice(i,1),this}pickEvent(e){let t=Rk(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,r,i){let a=this.context();return FA[e.marktype].pick.call(this,a,e,t,n,r,i)}},lj=e=>e===tj||e===nj||e===rj?[tj,nj,rj]:[e],uj=class extends zA{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new WO,this._tempb=new WO}initialize(e,t,n,r,i,a){return this._options=a||{},this._canvas=this._options.externalContext?null:MT(1,1,this._options.type),e&&this._canvas&&(Lk(e,0).appendChild(this._canvas),this._canvas.setAttribute(`class`,`marks`)),super.initialize(e,t,n,r,i)}resize(e,t,n,r){if(super.resize(e,t,n,r),this._canvas)vhe(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{let e=this._options.externalContext;e||V(`CanvasRenderer is missing a valid canvas or context`),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext(`2d`):null)}dirty(e){let t=this._tempb.clear().union(e.bounds),n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){let n=this.context(),r=this._origin,i=this._width,a=this._height,o=this._dirty,s=dj(r,i,a);n.save();let c=this._redraw||o.empty()?(this._redraw=!1,s.expand(1)):yhe(n,s.intersect(o),r);return this.clear(-r[0],-r[1],i,a),this.draw(n,e,c,t),n.restore(),o.clear(),this}draw(e,t,n,r){if(t.marktype!==`group`&&r!=null&&!r.includes(t.marktype))return;let i=FA[t.marktype];t.clip&&Sme(e,t),i.draw.call(this,e,t,n,r),t.clip&&e.restore()}clear(e,t,n,r){let i=this._options,a=this.context();i.type!==`pdf`&&!i.externalContext&&a.clearRect(e,t,n,r),this._bgcolor!=null&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,r))}},dj=(e,t,n)=>new WO().set(0,0,t,n).translate(-e[0],-e[1]),fj=class extends RA{constructor(e,t){super(e,t);let n=this;n._hrefHandler=pj(n,(e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)}),n._tooltipHandler=pj(n,(e,t)=>{n.handleTooltip(e,t,e.type!==oj)})}initialize(e,t,n){let r=this._svg;return r&&(r.removeEventListener(sj,this._hrefHandler),r.removeEventListener(aj,this._tooltipHandler),r.removeEventListener(oj,this._tooltipHandler)),this._svg=r=e&&Fk(e,`svg`),r&&(r.addEventListener(sj,this._hrefHandler),r.addEventListener(aj,this._tooltipHandler),r.addEventListener(oj,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){let n=this.eventName(e),r=this._handlers;if(this._handlerIndex(r[n],e,t)<0){let i={type:e,handler:t,listener:pj(this,t)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(e,t){let n=this.eventName(e),r=this._handlers[n],i=this._handlerIndex(r,e,t);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}},pj=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},mj=`aria-hidden`,hj=`aria-label`,gj=`role`,_j=`aria-roledescription`,vj=`graphics-object`,yj=`graphics-symbol`,bj=(e,t,n)=>({[gj]:e,[_j]:t,[hj]:n||void 0}),xj=Ng([`axis-domain`,`axis-grid`,`axis-label`,`axis-tick`,`axis-title`,`legend-band`,`legend-entry`,`legend-gradient`,`legend-label`,`legend-title`,`legend-symbol`,`title`]),Sj={axis:{desc:`axis`,caption:The},legend:{desc:`legend`,caption:Ehe},"title-text":{desc:`title`,caption:e=>`Title text '${whe(e)}'`},"title-subtitle":{desc:`subtitle`,caption:e=>`Subtitle text '${whe(e)}'`}},Cj={ariaRole:gj,ariaRoleDescription:_j,description:hj},wj=e=>(e+``).replace(/&/g,`&`).replace(//g,`>`),Tj=e=>wj(e).replace(/"/g,`"`).replace(/\t/g,` `).replace(/\n/g,` `).replace(/\r/g,` `),Ej=e=>Ahe(Bk(),e)+``,Dj={fill:`fill`,fillOpacity:`fill-opacity`,stroke:`stroke`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,strokeCap:`stroke-linecap`,strokeJoin:`stroke-linejoin`,strokeDash:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeMiterLimit:`stroke-miterlimit`,opacity:`opacity`},Oj={blend:`mix-blend-mode`},kj={fill:`none`,"stroke-miterlimit":4},Aj=0,jj=`http://www.w3.org/2000/xmlns/`,Mj=jA.xmlns,Nj=class extends zA{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,r,i){return this._defs={},this._clearDefs(),e&&(this._svg=Ik(e,0,`svg`,Mj),this._svg.setAttributeNS(jj,`xmlns`,Mj),this._svg.setAttributeNS(jj,`xmlns:xlink`,jA[`xmlns:xlink`]),this._svg.setAttribute(`version`,jA.version),this._svg.setAttribute(`class`,`marks`),Lk(e,1),this._root=Ik(this._svg,Aj,`g`,Mj),Uk(this._root,kj),Lk(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,r,i)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty(`background-color`,e),super.background(...arguments)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svg&&(Uk(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute(`transform`,`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){let e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute(`style`),n=Ik(e,Aj,`rect`,Mj),Uk(n,{width:this._width,height:this._height,fill:t}));let r=Ej(e);return t&&(e.removeChild(n),this._svg.style.setProperty(`background-color`,t)),r}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Lk(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;let e=this._dirty;if(!e.length||!this._dirtyID)return!0;let t=++this._dirtyID,n,r,i,a,o,s,c;for(o=0,s=e.length;o{e.dirty=t})),!r.zdirty){if(n.exit){a.nested&&r.items.length?(c=r.items[0],c._svg&&this._update(a,c._svg,c)):n._svg&&(c=n._svg.parentNode,c&&c.removeChild(n._svg)),n._svg=null;continue}n=a.nested?r.items[0]:n,n._update!==t&&(!n._svg||!n._svg.ownerSVGElement?(this._dirtyAll=!1,jhe(n,t)):this._update(a,n._svg,n),n._update=t)}return!this._dirtyAll}mark(e,t,n,r){if(!this.isDirty(t))return t._svg;let i=this._svg,a=t.marktype,o=FA[a],s=t.interactive===!1?`none`:null,c=o.tag===`g`,l=Fhe(t,e,n,`g`,i);if(a!==`group`&&r!=null&&!r.includes(a))return Lk(l,0),t._svg;l.setAttribute(`class`,che(t));let u=xhe(t);for(let e in u)Wk(l,e,u[e]);c||Wk(l,`pointer-events`,s),Wk(l,`clip-path`,t.clip?UO(this,t,t.group):null);let d=null,f=0,p=e=>{let t=this.isDirty(e),n=Fhe(e,l,d,o.tag,i);t&&(this._update(o,n,e),c&&Phe(this,n,e,r)),d=n,++f};return o.nested?t.items.length&&p(t.items[0]):ik(t,p),Lk(l,f),l}_update(e,t,n){Pj=t,Fj=t.__values__,bhe(Vk,n),e.attr(Vk,n,this);let r=Ij[e.type];r&&r.call(this,e,t,n),Pj&&this.style(Pj,n)}style(e,t){if(t!=null){for(let n in Dj){let r=n===`font`?Ok(t):t[n];if(r===Fj[n])continue;let i=Dj[n];r==null?e.removeAttribute(i):(NO(r)&&(r=Fpe(r,this._defs.gradient,Rhe())),e.setAttribute(i,r+``)),Fj[n]=r}for(let n in Oj)Hk(e,Oj[n],t[n])}}defs(){let e=this._svg,t=this._defs,n=t.el,r=0;for(let i in t.gradient)n||(t.el=n=Ik(e,1,`defs`,Mj)),r=Mhe(n,t.gradient[i],r);for(let i in t.clipping)n||(t.el=n=Ik(e,1,`defs`,Mj)),r=Nhe(n,t.clipping[i],r);n&&(r===0?(e.removeChild(n),t.el=null):Lk(n,r))}_clearDefs(){let e=this._defs;e.gradient={},e.clipping={}}},Pj=null,Fj=null,Ij={group(e,t,n){let r=Pj=t.childNodes[2];Fj=r.__values__,e.foreground(Vk,n,this),Fj=t.__values__,Pj=t.childNodes[1],e.content(Vk,n,this);let i=Pj=t.childNodes[0];e.background(Vk,n,this);let a=n.mark.interactive===!1?`none`:null;if(a!==Fj.events&&(Wk(r,`pointer-events`,a),Wk(i,`pointer-events`,a),Fj.events=a),n.strokeForeground&&n.stroke){let e=n.fill;Wk(r,`display`,null),this.style(i,n),Wk(i,`stroke`,null),e&&(n.fill=null),Fj=r.__values__,this.style(r,n),e&&(n.fill=e),Pj=null}else Wk(r,`display`,`none`)},image(e,t,n){n.smooth===!1?(Hk(t,`image-rendering`,`optimizeSpeed`),Hk(t,`image-rendering`,`pixelated`)):Hk(t,`image-rendering`,null)},text(e,t,n){let r=Tk(n),i,a,o,s;H(r)?(a=r.map(e=>Dk(n,e)),i=a.join(` +`),i!==Fj.text&&(Lk(t,0),o=t.ownerDocument,s=wk(n),a.forEach((e,r)=>{let i=Pk(o,`tspan`,Mj);i.__data__=n,i.textContent=e,r&&(i.setAttribute(`x`,0),i.setAttribute(`dy`,s)),t.appendChild(i)}),Fj.text=i)):(a=Dk(n,r),a!==Fj.text&&(t.textContent=a,Fj.text=a)),Wk(t,`font-family`,Ok(n)),Wk(t,`font-size`,Ck(n)+`px`),Wk(t,`font-style`,n.fontStyle),Wk(t,`font-variant`,n.fontVariant),Wk(t,`font-weight`,n.fontWeight)}},Lj=class extends zA{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){let t=Bk();t.open(`svg`,hg({},jA,{class:`marks`,width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!==`transparent`&&n!==`none`&&t.open(`rect`,{width:this._width,height:this._height,fill:n}).close(),t.open(`g`,kj,{transform:`translate(`+this._origin+`)`}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+``,this}mark(e,t){let n=FA[t.marktype],r=n.tag,i=[bhe,n.attr];e.open(`g`,{class:che(t),"clip-path":t.clip?UO(this,t,t.group):null},xhe(t),{"pointer-events":r!==`g`&&t.interactive===!1?`none`:null});let a=a=>{let o=this.href(a);if(o&&e.open(`a`,o),e.open(r,this.attr(t,a,i,r===`g`?null:r)),r===`text`){let t=Tk(a);if(H(t)){let n={x:0,dy:wk(a)};for(let r=0;rthis.mark(e,t)),e.close(),r&&o?(i&&(a.fill=null),a.stroke=o,e.open(`path`,this.attr(t,a,n.foreground,`bgrect`)).close(),i&&(a.fill=i)):e.open(`path`,this.attr(t,a,n.foreground,`bgfore`)).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&a(t.items[0]):ik(t,a),e.close()}href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then(e=>{e[`xlink:href`]=e.href,e.href=null,(this._hrefs||={})[t]=e})}return null}attr(e,t,n,r){let i={},a=(e,t,n,r)=>{i[r||e]=t};return Array.isArray(n)?n.forEach(e=>e(a,t,this)):n(a,t,this),r&&zhe(i,t,e,r,this._defs),i}defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open(`defs`);for(let n in t){let r=t[n],i=r.stops;r.gradient===`radial`?(e.open(`pattern`,{id:Jk+n,viewBox:`0,0,1,1`,width:`100%`,height:`100%`,preserveAspectRatio:`xMidYMid slice`}),e.open(`rect`,{width:`1`,height:`1`,fill:`url(#`+n+`)`}).close(),e.close(),e.open(`radialGradient`,{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open(`linearGradient`,{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let t=0;t!Rj.svgMarkTypes.includes(e));this._svgRenderer.render(e,Rj.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,r){return super.resize(e,t,n,r),this._svgRenderer.resize(e,t,n,r),this._canvasRenderer.resize(e,t,n,r),this}background(e){return Rj.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}},Bj=class extends cj{constructor(e,t){super(e,t)}initialize(e,t,n){let r=Ik(Ik(e,0,`div`),+!Rj.svgOnTop,`div`);return super.initialize(r,t,n)}},Vj=`canvas`,Hj=`hybrid`,Uj=`png`,Wj=`svg`,Gj=`none`,Kj={Canvas:Vj,PNG:Uj,SVG:Wj,Hybrid:Hj,None:Gj},qj={},qj[Vj]=qj[Uj]={renderer:uj,headless:uj,handler:cj},qj[Wj]={renderer:Nj,headless:Lj,handler:fj},qj[Hj]={renderer:zj,headless:zj,handler:Bj},qj[Gj]={},Jj=new WO,Yj=1e-9})),Yge=c({bound:()=>Zj,identifier:()=>$j,mark:()=>eM,overlap:()=>tM,render:()=>nM,viewlayout:()=>fM});function Zj(e){G.call(this,null,e)}function Qj(e,t,n){return t(e.bounds.clear(),e,n)}function $j(e){G.call(this,0,e)}function Xge(e){return e._signals[ZM]||(e._signals[ZM]=e.add(0))}function eM(e){G.call(this,null,e)}function Zge(e){let t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function tM(e){G.call(this,null,e)}function nM(e){G.call(this,null,e)}function rM(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Qge(e){var t=e.items[0].orient;return t===mM||t===hM}function $ge(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function e_e(e,t,n,r){var i=t.items[0],a=i.datum,o=i.translate==null?.5:i.translate,s=i.orient,c=$ge(a),l=i.range,u=i.offset,d=i.position,f=i.minExtent,p=i.maxExtent,m=a.title&&i.items[c[2]].items[0],h=i.titlePadding,g=i.bounds,_=m&&Ek(m),v=0,y=0,b,x;switch(aN.clear().union(g),g.clear(),(b=c[0])>-1&&g.union(i.items[b].bounds),(b=c[1])>-1&&g.union(i.items[b].bounds),s){case pM:v=d||0,y=-u,x=Math.max(f,Math.min(p,-g.y1)),g.add(0,-x).add(l,0),m&&iM(e,m,x,h,_,0,-1,g);break;case mM:v=-u,y=d||0,x=Math.max(f,Math.min(p,-g.x1)),g.add(-x,0).add(0,l),m&&iM(e,m,x,h,_,1,-1,g);break;case hM:v=n+u,y=d||0,x=Math.max(f,Math.min(p,g.x2)),g.add(0,0).add(x,l),m&&iM(e,m,x,h,_,1,1,g);break;case gM:v=d||0,y=r+u,x=Math.max(f,Math.min(p,g.y2)),g.add(0,0).add(l,x),m&&iM(e,m,x,h,0,0,1,g);break;default:v=i.x,y=i.y}return JO(g.translate(v,y),i),rM(i,`x`,v+o)|rM(i,`y`,y+o)&&(i.bounds=aN,e.dirty(i),i.bounds=g,e.dirty(i)),i.mark.bounds.clear().union(g)}function iM(e,t,n,r,i,a,o,s){let c=t.bounds;if(t.auto){let s=o*(n+i+r),l=0,u=0;e.dirty(t),a?l=(t.x||0)-(t.x=s):u=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(c.translate(-l,-u)),e.dirty(t)}s.union(c)}function t_e(e){var t=e.items,n=t.length,r=0,i,a;let o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r1)for(C=0;C0&&(y[C]+=A/2);if(s&&aM(n.center,XM)&&u!==1)for(C=0;C0&&(b[C]+=j/2);for(C=0;Ci&&(e.warn(`Grid headers exceed limit: `+i),t=t.slice(0,i)),h+=a,v=0,b=t.length;v=0&&(C=n[y])==null;y-=f);s?(w=p==null?C.x:Math.round(C.bounds.x1+p*C.bounds.width()),T=h):(w=h,T=p==null?C.y:Math.round(C.bounds.y1+p*C.bounds.height())),x.union(S.bounds.translate(w-(S.x||0),T-(S.y||0))),S.x=w,S.y=T,e.dirty(S),g=o(g,x[l])}return g}function lM(e,t,n,r,i,a){if(t){e.dirty(t);var o=n,s=n;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),t.bounds.translate(o-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=s,e.dirty(t)}}function s_e(e,t){let n=e[t]||{};return(t,r)=>n[t]==null?e[t]==null?r:e[t]:n[t]}function c_e(e,t){let n=-1/0;return e.forEach(e=>{e.offset!=null&&(n=Math.max(n,e.offset))}),n>-1/0?n:t}function l_e(e,t,n,r,i,a,o){let s=s_e(n,t),c=c_e(e,s(`offset`,0)),l=s(`anchor`,xM),u=s(`frame`,EM),d=l===CM?1:l===SM?.5:0,f=u===DM?r.x1+d*r.width():d*(a||i.width()+2*i.x1),p=u===DM?i.y1+d*i.height():d*(o||r.height()+2*r.y1),m={align:qM,bounds:s(`bounds`,JM),columns:s(`direction`)===`vertical`?1:e.length,padding:s(`margin`,8),center:s(`center`),nodirty:!0};switch(t){case mM:m.anchor={x:Math.floor(r.x1)-c,column:CM,y:p,row:l};break;case hM:m.anchor={x:Math.ceil(r.x2)+c,y:p,row:l};break;case pM:m.anchor={y:Math.floor(i.y1)-c,row:CM,x:f,column:l};break;case gM:m.anchor={y:Math.ceil(i.y2)+c,x:f,column:l};break;case _M:m.anchor={x:c,y:c};break;case vM:m.anchor={x:a-c,y:c,column:CM};break;case yM:m.anchor={x:c,y:o-c,row:CM};break;case bM:m.anchor={x:a-c,y:o-c,column:CM,row:CM};break}return m}function u_e(e,t){var n=t.items[0],r=n.datum,i=n.orient,a=n.bounds,o=n.x,s=n.y,c,l;return n._bounds?n._bounds.clear().union(a):n._bounds=a.clone(),a.clear(),f_e(e,n,n.items[0].items[0]),a=d_e(n,a),c=2*n.padding,l=2*n.padding,a.empty()||(c=Math.ceil(a.width()+c),l=Math.ceil(a.height()+l)),r.type===BM&&p_e(n.items[0].items[0].items[0].items),i!==GM&&(n.x=o=0,n.y=s=0),n.width=c,n.height=l,JO(a.set(o,s,o+c,s+l),n),n.mark.bounds.clear().union(a),n}function d_e(e,t){return e.items.forEach(e=>t.union(e.bounds)),t.empty()&&(t.x2=e.padding,t.y2=e.padding),t.x1=e.padding,t.y1=e.padding,t}function f_e(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(!t.datum.title)(i||a)&&dM(e,n,i,a);else{var o=t.items[1].items[0],s=o.anchor,c=t.titlePadding||0,l=r-o.x,u=r-o.y;switch(o.orient){case mM:i+=Math.ceil(o.bounds.width())+c;break;case hM:case gM:break;default:a+=o.bounds.height()+c}switch((i||a)&&dM(e,n,i,a),o.orient){case mM:u+=uM(t,n,o,s,1,1);break;case hM:l+=uM(t,n,o,CM,0,0)+c,u+=uM(t,n,o,s,1,1);break;case gM:l+=uM(t,n,o,s,0,0),u+=uM(t,n,o,CM,-1,0,1)+c;break;default:l+=uM(t,n,o,s,0,0)}(l||u)&&dM(e,o,l,u),(l=Math.round(o.bounds.x1-r))<0&&(dM(e,n,-l,0),dM(e,o,-l,0))}}function uM(e,t,n,r,i,a,o){let s=e.datum.type!==`symbol`,c=n.datum.vgrad,l=(s&&(a||!c)&&!o?t.items[0]:t).bounds[i?`y2`:`x2`]-e.padding,u=c&&a?l:0,d=c&&a?0:l,f=i<=0?0:Ek(n);return Math.round(r===xM?u:r===CM?d-f:.5*(l-f))}function dM(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function p_e(e){let t=e.reduce((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e),{});e.forEach(e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y})}function m_e(e,t,n,r,i){var a=t.items[0],o=a.frame,s=a.orient,c=a.anchor,l=a.offset,u=a.padding,d=a.items[0].items[0],f=a.items[1]&&a.items[1].items[0],p=s===mM||s===hM?r:n,m=0,h=0,g=0,_=0,v=0,y;if(o===EM?s===mM&&(m=r,p=0):s===mM?(m=i.y2,p=i.y1):s===hM?(m=i.y1,p=i.y2):(m=i.x1,p=i.x2),y=c===xM?m:c===CM?p:(m+p)/2,f&&f.text){switch(s){case pM:case gM:v=d.bounds.height()+u;break;case mM:_=d.bounds.width()+u;break;case hM:_=-d.bounds.width()-u;break}aN.clear().union(f.bounds),aN.translate(_-(f.x||0),v-(f.y||0)),rM(f,`x`,_)|rM(f,`y`,v)&&(e.dirty(f),f.bounds.clear().union(aN),f.mark.bounds.clear().union(aN),e.dirty(f)),aN.clear().union(f.bounds)}else aN.clear();switch(aN.union(d.bounds),s){case pM:h=y,g=i.y1-aN.height()-l;break;case mM:h=i.x1-aN.width()-l,g=y;break;case hM:h=i.x2+aN.width()+l,g=y;break;case gM:h=y,g=i.y2+l;break;default:h=a.x,g=a.y}return rM(a,`x`,h)|rM(a,`y`,g)&&(aN.translate(h,g),e.dirty(a),a.bounds.clear().union(aN),t.bounds.clear().union(aN),e.dirty(a)),a.bounds}function fM(e){G.call(this,null,e)}function h_e(e){return e&&e.mark.role!==`legend-entry`}function g_e(e,t,n){var r=t.items,i=Math.max(0,t.width||0),a=Math.max(0,t.height||0),o=new WO().set(0,0,i,a),s=o.clone(),c=o.clone(),l=[],u,d,f,p,m,h;for(m=0,h=r.length;m{f=e.orient||hM,f!==GM&&(t[f]||(t[f]=[])).push(e)});for(let r in t){let o=t[r];sM(e,o,l_e(o,r,n.legends,s,c,i,a))}l.forEach(t=>{let r=t.bounds;if(r.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=r,e.dirty(t)),n.autosize&&(n.autosize.type===VM||n.autosize.type===HM||n.autosize.type===UM))switch(t.orient){case mM:case hM:o.add(r.x1,0).add(r.x2,0);break;case pM:case gM:o.add(0,r.y1).add(0,r.y2)}else o.union(r)})}o.union(s).union(c),u&&o.union(m_e(e,u,i,a,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),__e(e,t,o,n)}function __e(e,t,n,r){let i=r.autosize||{},a=i.type;if(e._autosize<1||!a)return;let o=e._width,s=e._height,c=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),u=Math.max(0,t.height||0),d=Math.max(0,Math.ceil(-n.y1)),f=Math.max(0,Math.ceil(n.x2-c)),p=Math.max(0,Math.ceil(n.y2-u));if(i.contains===zM){let t=e.padding();o-=t.left+t.right,s-=t.top+t.bottom}a===GM?(l=0,d=0,c=o,u=s):a===VM?(c=Math.max(0,o-l-f),u=Math.max(0,s-d-p)):a===HM?(c=Math.max(0,o-l-f),s=u+d+p):a===UM?(o=c+l+f,u=Math.max(0,s-d-p)):a===WM&&(o=c+l+f,s=u+d+p),e._resizeView(o,s,c,u,[l,d],i.resize)}var pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,v_e=o((()=>{Qx(),Xj(),Fg(),pM=`top`,mM=`left`,hM=`right`,gM=`bottom`,_M=`top-left`,vM=`top-right`,yM=`bottom-left`,bM=`bottom-right`,xM=`start`,SM=`middle`,CM=`end`,wM=`x`,TM=`y`,EM=`group`,DM=`bounds`,OM=`axis`,kM=`title`,AM=`frame`,jM=`scope`,MM=`legend`,NM=`row-header`,PM=`row-footer`,FM=`row-title`,IM=`column-header`,LM=`column-footer`,RM=`column-title`,zM=`padding`,BM=`symbol`,VM=`fit`,HM=`fit-x`,UM=`fit-y`,WM=`pad`,GM=`none`,KM=`all`,qM=`each`,JM=`flush`,YM=`column`,XM=`row`,U(Zj,G,{transform(e,t){let n=t.dataflow,r=e.mark,i=r.marktype,a=FA[i],o=a.bound,s=r.bounds,c;if(a.nested)r.items.length&&n.dirty(r.items[0]),s=Qj(r,o),r.items.forEach(e=>{e.bounds.clear().union(s)});else if(i===EM||e.modified())switch(t.visit(t.MOD,e=>n.dirty(e)),s.clear(),r.items.forEach(e=>s.union(Qj(e,o))),r.role){case OM:case MM:case kM:t.reflow()}else c=t.changed(t.REM),t.visit(t.ADD,e=>{s.union(Qj(e,o))}),t.visit(t.MOD,e=>{c||=s.alignsWith(e.bounds),n.dirty(e),s.union(Qj(e,o))}),c&&(s.clear(),r.items.forEach(e=>s.union(e.bounds)));return Khe(r),t.modifies(`bounds`)}}),ZM=`:vega_identifier:`,$j.Definition={type:`Identifier`,metadata:{modifies:!0},params:[{name:`as`,type:`string`,required:!0}]},U($j,G,{transform(e,t){let n=Xge(t.dataflow),r=e.as,i=n.value;return t.visit(t.ADD,e=>e[r]=e[r]||++i),n.set(this.value=i),t}}),U(eM,G,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,Zge(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let r=n.marktype===EM?KO:GO;return t.visit(t.ADD,e=>r.call(e,n)),(e.modified(`clip`)||e.modified(`interactive`))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}}),QM={parity:e=>e.filter((e,t)=>t%2?e.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((e,r)=>!r||!$M(n.bounds,e.bounds,t)?(n=e,1):e.opacity=0)}},$M=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),eN=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,a;n{let t=e.bounds;return t.width()>1&&t.height()>1},nN=(e,t,n)=>{var r=e.range(),i=new WO;return t===pM||t===gM?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),e=>i.encloses(e.bounds)},rN=e=>(e.forEach(e=>e.opacity=1),e),iN=(e,t)=>e.reflow(t.modified()).modifies(`opacity`),U(tM,G,{transform(e,t){let n=QM[e.method]||QM.parity,r=e.separation||0,i=t.materialize(t.SOURCE).source,a,o;if(!i||!i.length)return;if(!e.method)return e.modified(`method`)&&(rN(i),t=iN(t,e)),t;if(i=i.filter(tN),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),a=rN(i),t=iN(t,e),a.length>=3&&eN(a,r)){do a=n(a,r);while(a.length>=3&&eN(a,r));a.length<3&&!Mh(i).opacity&&(a.length>1&&(Mh(a).opacity=0),Mh(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=nN(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(e=>{o(e)||(e.opacity=0)}));let s=a[0].mark.bounds.clear();return i.forEach(e=>{e.opacity&&s.union(e.bounds)}),t}}),U(nM,G,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,e=>n.dirty(e)),t.fields&&t.fields.zindex){let e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}}),aN=new WO,oN=(e,t)=>Math.floor(Math.min(e,t)),sN=(e,t)=>Math.ceil(Math.max(e,t)),U(fM,G,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach(t=>{e.layout&&i_e(n,t,e.layout),g_e(n,t,e)}),h_e(e.mark.group)?t.reflow():t}})})),y_e=c({axisticks:()=>cN,datajoin:()=>lN,encode:()=>uN,legendentries:()=>dN,linkpath:()=>fN,pie:()=>pN,scale:()=>hN,sortitems:()=>yN,stack:()=>bN});function cN(e){G.call(this,null,e)}function lN(e){G.call(this,null,e)}function b_e(){return ox({})}function x_e(e){let t=yg().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}function uN(e){G.call(this,null,e)}function dN(e){G.call(this,[],e)}function fN(e){G.call(this,{},e)}function pN(e){G.call(this,null,e)}function S_e(e){let t=e.type;return!e.bins&&(t===`linear`||t===`pow`||t===`sqrt`)}function mN(e){return rO(e)&&e!==`sequential`}function hN(e){G.call(this,null,e),this.modified(!0)}function C_e(e){var t=e.type,n=``,r;return t===`sequential`?hO+`-`+fO:(w_e(e)&&(r=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=r===2?hO+`-`:r===3?gO+`-`:``),(n+t||`linear`).toLowerCase())}function w_e(e){let t=e.type;return rO(t)&&t!==`time`&&t!==`utc`&&(e.scheme||e.range&&e.range.length&&e.range.every(Eg))}function T_e(e,t,n){let r=E_e(e,t.domainRaw,n);if(r>-1)return r;var i=t.domain,a=e.type,o=t.zero||t.zero===void 0&&S_e(e),s,c;if(!i)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(s=(i=i.slice()).length-1||1,o&&(i[0]>0&&(i[0]=0),i[s]<0&&(i[s]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[s]=t.domainMax),t.domainMid!=null)){c=t.domainMid;let e=c>i[s]?s+1:ce+(t<0?-1:+(t>0)),0))!==t.length&&n.warn(`Log scale domain includes zero: `+W(t)),t}function O_e(e,t,n){let r=t.bins;if(r&&!H(r)){let t=e.domain(),n=t[0],i=Mh(t),a=r.step,o=r.start==null?n:r.start,s=r.stop==null?i:r.stop;a||V(`Scale bins parameter missing step property.`),oi&&(s=a*Math.floor(i/a)),r=s_(o,s+a/2,a)}return r?e.bins=r:e.bins&&delete e.bins,e.type===`bin-ordinal`&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function k_e(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(t.rangeStep!=null)a=A_e(r,t,n);else if(t.scheme&&(a=j_e(r,t,n),ag(a))){if(e.interpolator)return e.interpolator(a);V(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&Zfe(r))return e.interpolator(sO(vN(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(cO(t.interpolate,t.interpolateGamma)):ag(e.round)?e.round(i):ag(e.rangeRound)&&e.interpolate(i?xD:yD),a&&e.range(vN(a,t.reverse))}function A_e(e,t,n){e!==`band`&&e!==`point`&&V(`Only band and point scales support rangeStep.`);var r=(t.paddingOuter==null?t.padding:t.paddingOuter)||0,i=e===`point`?1:(t.paddingInner==null?t.padding:t.paddingInner)||0;return[0,t.rangeStep*$D(n,i,r)]}function j_e(e,t,n){var r=t.schemeExtent,i,a;return H(t.scheme)?a=sO(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),a=lO(i),a||V(`Unrecognized scheme name: ${t.scheme}`)),n=e===`threshold`?n+1:e===`bin-ordinal`?n-1:e===`quantile`||e===`quantize`?+t.schemeCount||RN:n,Zfe(e)?_N(a,r,t.reverse):ag(a)?epe(_N(a,r),n):e===`ordinal`?a:a.slice(0,n)}function _N(e,t,n){return ag(e)&&(t||n)?$fe(e,vN(t||[0,1],n)):e}function vN(e,t){return t?e.slice().reverse():e}function yN(e){G.call(this,null,e)}function bN(e){G.call(this,null,e)}function M_e(e,t,n,r,i){for(var a=(t-e.sum)/2,o=e.length,s=0,c;se(u),o,s,c,l,u,d,f,p,m;if(t==null)i.push(e.slice());else for(o={},s=0,c=e.length;sm&&(m=p),n&&f.sort(n)}return i.max=m,i}var xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,I_e=o((()=>{Qx(),MO(),Fg(),c_(),ED(),U(cN,G,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.scale,o=uO(a,e.count==null?e.values?e.values.length:10:e.count,e.minstep),s=e.format||ope(n,a,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?ape(a,e.values,o):dO(a,o);return i&&(r.rem=i),i=c.map((e,t)=>ox({index:t/(c.length-1||1),tickIndex:t,value:e,label:s(e)})),e.extra&&i.length&&i.push(ox({index:-1,tickIndex:-1,extra:{value:i[0].value},label:``})),r.source=i,r.add=i,this.value=i,r}}),U(lN,G,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||b_e,a=e.key||ix,o=this.value;return H(r.encode)&&(r.encode=null),o&&(e.modified(`key`)||t.modified(a))&&V(`DataJoin does not support modified key function or fields.`),o||(t=t.addAll(),this.value=o=x_e(a)),t.visit(t.ADD,e=>{let t=a(e),n=o.get(t);n?n.exit?(o.empty--,r.add.push(n)):r.mod.push(n):(n=i(e),o.set(t,n),r.add.push(n)),n.datum=e,n.exit=!1}),t.visit(t.MOD,e=>{let t=a(e),n=o.get(t);n&&(n.datum=e,r.mod.push(n))}),t.visit(t.REM,e=>{let t=a(e),n=o.get(t);e===n.datum&&!n.exit&&(r.rem.push(n),n.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&r.modifies(`datum`),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),r}}),U(uN,G,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(H(a))if(n.changed()||a.every(e=>i[e]))a=a[0],n.encode=null;else return t.StopPropagation;var o=a===`enter`,s=i.update||Ch,c=i.enter||Ch,l=i.exit||Ch,u=(a&&!o?i[a]:s)||Ch;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{c(t,e),s(t,e)}),n.modifies(c.output),n.modifies(s.output),u!==Ch&&u!==s&&(t.visit(t.ADD,t=>{u(t,e)}),n.modifies(u.output))),t.changed(t.REM)&&l!==Ch&&(t.visit(t.REM,t=>{l(t,e)}),n.modifies(l.output)),o||u!==Ch){let i=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(i,t=>{let i=c(t,e)||r;(u(t,e)||i)&&n.mod.push(t)}),n.mod.length&&n.modifies(c.output)):t.visit(i,t=>{(u(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(u.output)}return n.changed()?n:t.StopPropagation}}),U(dN,G,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.type||`symbol`,o=e.scale,s=+e.limit,c=uO(o,e.count==null?5:e.count,e.minstep),l=!!e.values||a===`symbol`,u=e.format||fpe(n,o,c,a,e.formatSpecifier,e.formatType,l),d=e.values||cpe(o,c),f,p,m,h,g;return i&&(r.rem=i),a===`symbol`?(s&&d.length>s?(t.dataflow.warn(`Symbol legend count exceeds limit, filtering items.`),i=d.slice(0,s-1),g=!0):i=d,ag(m=e.size)?(!e.values&&o(i[0])===0&&(i=i.slice(1)),h=i.reduce((t,n)=>Math.max(t,m(n,e)),0)):m=pg(h=m||8),i=i.map((t,n)=>ox({index:n,label:u(t,n,i),value:t,offset:h,size:m(t,e)})),g&&(g=d[i.length],i.push(ox({index:i.length,label:`\u2026${d.length-i.length} entries`,value:g,offset:h,size:m(g,e)})))):a===`gradient`?(f=o.domain(),p=tpe(o,f[0],Mh(f)),d.length<3&&!e.values&&f[0]!==Mh(f)&&(d=[f[0],Mh(f)]),i=d.map((e,t)=>ox({index:t,label:u(e,t,d),value:e,perc:p(e)}))):(m=d.length-1,p=ppe(o),i=d.map((e,t)=>ox({index:t,label:u(e,t,d),value:e,perc:t?p(e):0,perc2:t===m?1:p(d[t+1])}))),r.source=i,r.add=i,this.value=i,r}}),xN=e=>e.source.x,SN=e=>e.source.y,CN=e=>e.target.x,wN=e=>e.target.y,fN.Definition={type:`LinkPath`,metadata:{modifies:!0},params:[{name:`sourceX`,type:`field`,default:`source.x`},{name:`sourceY`,type:`field`,default:`source.y`},{name:`targetX`,type:`field`,default:`target.x`},{name:`targetY`,type:`field`,default:`target.y`},{name:`orient`,type:`enum`,default:`vertical`,values:[`horizontal`,`vertical`,`radial`]},{name:`shape`,type:`enum`,default:`line`,values:[`line`,`arc`,`curve`,`diagonal`,`orthogonal`]},{name:`require`,type:`signal`},{name:`as`,type:`string`,default:`path`}]},U(fN,G,{transform(e,t){var n=e.sourceX||xN,r=e.sourceY||SN,i=e.targetX||CN,a=e.targetY||wN,o=e.as||`path`,s=e.orient||`vertical`,c=e.shape||`line`,l=LN.get(c+`-`+s)||LN.get(c);return l||V(`LinkPath unsupported type: `+e.shape+(e.orient?`-`+e.orient:``)),t.visit(t.SOURCE,e=>{e[o]=l(n(e),r(e),i(e),a(e))}),t.reflow(e.modified()).modifies(o)}}),TN=(e,t,n,r)=>`M`+e+`,`+t+`L`+n+`,`+r,EN=(e,t,n,r)=>TN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),DN=(e,t,n,r)=>{var i=n-e,a=r-t,o=Math.hypot(i,a)/2,s=180*Math.atan2(a,i)/Math.PI;return`M`+e+`,`+t+`A`+o+`,`+o+` `+s+` 0 1 `+n+`,`+r},ON=(e,t,n,r)=>DN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),kN=(e,t,n,r)=>{let i=n-e,a=r-t,o=.2*(i+a),s=.2*(a-i);return`M`+e+`,`+t+`C`+(e+o)+`,`+(t+s)+` `+(n+s)+`,`+(r-o)+` `+n+`,`+r},AN=(e,t,n,r)=>kN(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),jN=(e,t,n,r)=>`M`+e+`,`+t+`V`+r+`H`+n,MN=(e,t,n,r)=>`M`+e+`,`+t+`H`+n+`V`+r,NN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=Math.abs(n-e)>Math.PI?n<=e:n>e;return`M`+t*i+`,`+t*a+`A`+t+`,`+t+` 0 0,`+ +!!c+` `+t*o+`,`+t*s+`L`+r*o+`,`+r*s},PN=(e,t,n,r)=>{let i=(e+n)/2;return`M`+e+`,`+t+`C`+i+`,`+t+` `+i+`,`+r+` `+n+`,`+r},FN=(e,t,n,r)=>{let i=(t+r)/2;return`M`+e+`,`+t+`C`+e+`,`+i+` `+n+`,`+i+` `+n+`,`+r},IN=(e,t,n,r)=>{let i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),c=(t+r)/2;return`M`+t*i+`,`+t*a+`C`+c*i+`,`+c*a+` `+c*o+`,`+c*s+` `+r*o+`,`+r*s},LN=yg({line:TN,"line-radial":EN,arc:DN,"arc-radial":ON,curve:kN,"curve-radial":AN,"orthogonal-horizontal":jN,"orthogonal-vertical":MN,"orthogonal-radial":NN,"diagonal-horizontal":PN,"diagonal-vertical":FN,"diagonal-radial":IN}),pN.Definition={type:`Pie`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`startAngle`,type:`number`,default:0},{name:`endAngle`,type:`number`,default:6.283185307179586},{name:`sort`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0,length:2,default:[`startAngle`,`endAngle`]}]},U(pN,G,{transform(e,t){var n=e.as||[`startAngle`,`endAngle`],r=n[0],i=n[1],a=e.field||xh,o=e.startAngle||0,s=e.endAngle==null?2*Math.PI:e.endAngle,c=t.source,l=c.map(a),u=l.length,d=o,f=(s-o)/xoe(l),p=s_(u),m,h,g;for(e.sort&&p.sort((e,t)=>l[e]-l[t]),m=0;m1?0:e<-1?qN:Math.acos(e)}function GN(e){return e>1?JN:e<-1?-JN:Math.asin(e)}var KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP=o((()=>{KN=1e-6,qN=Math.PI,JN=qN/2,YN=qN/4,XN=qN*2,ZN=180/qN,QN=qN/180,$N=Math.abs,eP=Math.atan,tP=Math.atan2,nP=Math.cos,rP=Math.ceil,iP=Math.exp,aP=Math.hypot,oP=Math.log,sP=Math.pow,cP=Math.sin,lP=Math.sign||function(e){return e>0?1:e<0?-1:0},uP=Math.sqrt,dP=Math.tan}));function pP(){}var mP=o((()=>{}));function hP(e,t){e&&bP.hasOwnProperty(e.type)&&bP[e.type](e,t)}function gP(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r{yP={Feature:function(e,t){hP(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=nP(t),o=cP(t),s=kP*o,c=OP*a+s*nP(i),l=s*r*cP(i);CP.add(tP(l,c)),DP=e,OP=a,kP=o}function B_e(e){return wP=new Jg,vP(e,AP),wP*2}var CP,wP,TP,EP,DP,OP,kP,AP,jP=o((()=>{c_(),fP(),mP(),xP(),CP=new Jg,wP=new Jg,AP={point:pP,lineStart:pP,lineEnd:pP,polygonStart:function(){CP=new Jg,AP.lineStart=L_e,AP.lineEnd=R_e},polygonEnd:function(){var e=+CP;wP.add(e<0?XN+e:e),this.lineStart=this.lineEnd=this.point=pP},sphere:function(){wP.add(XN)}}}));function MP(e){return[tP(e[1],e[0]),GN(e[2])]}function NP(e){var t=e[0],n=e[1],r=nP(n);return[r*nP(t),r*cP(t),cP(n)]}function PP(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function FP(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function IP(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function LP(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function RP(e){var t=uP(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var zP=o((()=>{fP()}));function BP(e,t){nF.push(rF=[qP=e,YP=e]),tXP&&(XP=t)}function VP(e,t){var n=NP([e*QN,t*QN]);if(eF){var r=FP(eF,n),i=FP([r[1],-r[0],0],r);RP(i),i=MP(i);var a=e-ZP,o=a>0?1:-1,s=i[0]*ZN*o,c,l=$N(a)>180;l^(o*ZPXP&&(XP=c)):(s=(s+360)%360-180,l^(o*ZPXP&&(XP=t))),l?eGP(qP,YP)&&(YP=e):GP(e,YP)>GP(qP,YP)&&(qP=e):YP>=qP?(eYP&&(YP=e)):e>ZP?GP(qP,e)>GP(qP,YP)&&(YP=e):GP(e,YP)>GP(qP,YP)&&(qP=e)}else nF.push(rF=[qP=e,YP=e]);tXP&&(XP=t),eF=n,ZP=e}function HP(){iF.point=VP}function UP(){rF[0]=qP,rF[1]=YP,iF.point=BP,eF=null}function WP(e,t){if(eF){var n=e-ZP;tF.add($N(n)>180?n+(n>0?360:-360):n)}else QP=e,$P=t;AP.point(e,t),VP(e,t)}function V_e(){AP.lineStart()}function H_e(){WP(QP,$P),AP.lineEnd(),$N(tF)>1e-6&&(qP=-(YP=180)),rF[0]=qP,rF[1]=YP,eF=null}function GP(e,t){return(t-=e)<0?t+360:t}function U_e(e,t){return e[0]-t[0]}function KP(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tGP(r[0],r[1])&&(r[1]=i[1]),GP(i[0],r[1])>GP(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=a.length-1,t=0,r=a[n];t<=n;r=i,++t)i=a[t],(s=GP(r[1],i[0]))>o&&(o=s,qP=i[0],YP=r[1])}return nF=rF=null,qP===1/0||JP===1/0?[[NaN,NaN],[NaN,NaN]]:[[qP,JP],[YP,XP]]}var qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,G_e=o((()=>{c_(),jP(),zP(),fP(),xP(),iF={point:BP,lineStart:HP,lineEnd:UP,polygonStart:function(){iF.point=WP,iF.lineStart=V_e,iF.lineEnd=H_e,tF=new Jg,AP.polygonStart()},polygonEnd:function(){AP.polygonEnd(),iF.point=BP,iF.lineStart=HP,iF.lineEnd=UP,CP<0?(qP=-(YP=180),JP=-(XP=90)):tF>1e-6?XP=90:tF<-1e-6&&(JP=-90),rF[0]=qP,rF[1]=YP},sphere:function(){qP=-(YP=180),JP=-(XP=90)}}}));function aF(e,t){e*=QN,t*=QN;var n=nP(t);oF(n*nP(e),n*cP(e),cP(t))}function oF(e,t,n){++uF,fF+=(e-fF)/uF,pF+=(t-pF)/uF,mF+=(n-mF)/uF}function sF(){EF.point=K_e}function K_e(e,t){e*=QN,t*=QN;var n=nP(t);CF=n*nP(e),wF=n*cP(e),TF=cP(t),EF.point=q_e,oF(CF,wF,TF)}function q_e(e,t){e*=QN,t*=QN;var n=nP(t),r=n*nP(e),i=n*cP(e),a=cP(t),o=tP(uP((o=wF*a-TF*i)*o+(o=TF*r-CF*a)*o+(o=CF*i-wF*r)*o),CF*r+wF*i+TF*a);dF+=o,hF+=o*(CF+(CF=r)),gF+=o*(wF+(wF=i)),_F+=o*(TF+(TF=a)),oF(CF,wF,TF)}function cF(){EF.point=aF}function J_e(){EF.point=X_e}function Y_e(){lF(xF,SF),EF.point=aF}function X_e(e,t){xF=e,SF=t,e*=QN,t*=QN,EF.point=lF;var n=nP(t);CF=n*nP(e),wF=n*cP(e),TF=cP(t),oF(CF,wF,TF)}function lF(e,t){e*=QN,t*=QN;var n=nP(t),r=n*nP(e),i=n*cP(e),a=cP(t),o=wF*a-TF*i,s=TF*r-CF*a,c=CF*i-wF*r,l=aP(o,s,c),u=GN(l),d=l&&-u/l;vF.add(d*o),yF.add(d*s),bF.add(d*c),dF+=u,hF+=u*(CF+(CF=r)),gF+=u*(wF+(wF=i)),_F+=u*(TF+(TF=a)),oF(CF,wF,TF)}function Z_e(e){uF=dF=fF=pF=mF=hF=gF=_F=0,vF=new Jg,yF=new Jg,bF=new Jg,vP(e,EF);var t=+vF,n=+yF,r=+bF,i=aP(t,n,r);return i<1e-12&&(t=hF,n=gF,r=_F,dF<1e-6&&(t=fF,n=pF,r=mF),i=aP(t,n,r),i<1e-12)?[NaN,NaN]:[tP(n,t)*ZN,GN(r/i)*ZN]}var uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,Q_e=o((()=>{c_(),fP(),mP(),xP(),EF={sphere:pP,point:aF,lineStart:sF,lineEnd:cF,polygonStart:function(){EF.lineStart=J_e,EF.lineEnd=Y_e},polygonEnd:function(){EF.lineStart=sF,EF.lineEnd=cF}}}));function DF(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}var OF=o((()=>{}));function kF(e,t){return $N(e)>qN&&(e-=Math.round(e/XN)*XN),[e,t]}function AF(e,t,n){return(e%=XN)?t||n?DF(MF(e),NF(t,n)):MF(e):t||n?NF(t,n):kF}function jF(e){return function(t,n){return t+=e,$N(t)>qN&&(t-=Math.round(t/XN)*XN),[t,n]}}function MF(e){var t=jF(e);return t.invert=jF(-e),t}function NF(e,t){var n=nP(e),r=cP(e),i=nP(t),a=cP(t);function o(e,t){var o=nP(t),s=nP(e)*o,c=cP(e)*o,l=cP(t),u=l*n+s*r;return[tP(c*i-u*a,s*n-l*r),GN(u*i+c*a)]}return o.invert=function(e,t){var o=nP(t),s=nP(e)*o,c=cP(e)*o,l=cP(t),u=l*i-c*a;return[tP(c*i+l*a,s*n+u*r),GN(u*n-s*r)]},o}function $_e(e){e=AF(e[0]*QN,e[1]*QN,e.length>2?e[2]*QN:0);function t(t){return t=e(t[0]*QN,t[1]*QN),t[0]*=ZN,t[1]*=ZN,t}return t.invert=function(t){return t=e.invert(t[0]*QN,t[1]*QN),t[0]*=ZN,t[1]*=ZN,t},t}var PF=o((()=>{OF(),fP(),kF.invert=kF}));function eve(e,t,n,r,i,a){if(n){var o=nP(t),s=cP(t),c=r*n;i==null?(i=t+r*XN,a=t-c/2):(i=FF(o,i),a=FF(o,a),(r>0?ia)&&(i+=r*XN));for(var l,u=i;r>0?u>a:u{zP(),fP()}));function LF(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:pP,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}var RF=o((()=>{mP()}));function zF(e,t){return $N(e[0]-t[0])<1e-6&&$N(e[1]-t[1])<1e-6}var BF=o((()=>{fP()}));function VF(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function HF(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(zF(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function UF(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n{BF(),fP()}));function GF(e){return $N(e[0])<=qN?e[0]:lP(e[0])*(($N(e[0])+qN)%XN-qN)}function tve(e,t){var n=GF(t),r=t[1],i=cP(r),a=[cP(n),-nP(n),0],o=0,s=0,c=new Jg;i===1?r=JN+KN:i===-1&&(r=-JN-KN);for(var l=0,u=e.length;l=0?1:-1,E=T*w,D=E>qN,O=g*S;if(c.add(tP(O*T*cP(E),_*C+O*nP(E))),o+=D?w+T*XN:w,D^m>=n^b>=n){var k=FP(NP(p),NP(y));RP(k);var A=FP(a,k);RP(A);var j=(D^w>=0?-1:1)*GN(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}var KF=o((()=>{c_(),zP(),fP()}));function qF(e,t,n,r){return function(i){var a=t(i),o=LF(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=voe(u);var e=tve(l,r);u.length?(c||=(i.polygonStart(),!0),HF(u,rve,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(nve))}}return f}}function nve(e){return e.length>1}function rve(e,t){return((e=e.x)[0]<0?e[1]-JN-KN:JN-e[1])-((t=t.x)[0]<0?t[1]-JN-KN:JN-t[1])}var JF=o((()=>{RF(),WF(),fP(),KF(),c_()}));function ive(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?qN:-qN,c=$N(a-t);$N(c-qN)<1e-6?(e.point(t,n=(n+o)/2>0?JN:-JN),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=qN&&($N(t-r)<1e-6&&(t-=r*KN),$N(a-s)<1e-6&&(a-=s*KN),n=ave(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function ave(e,t,n,r){var i,a,o=cP(e-n);return $N(o)>1e-6?eP((cP(t)*(a=nP(r))*cP(n)-cP(r)*(i=nP(t))*cP(e))/(i*a*o)):(t+r)/2}function ove(e,t,n,r){var i;if(e==null)i=n*JN,r.point(-qN,i),r.point(0,i),r.point(qN,i),r.point(qN,0),r.point(qN,-i),r.point(0,-i),r.point(-qN,-i),r.point(-qN,0),r.point(-qN,i);else if($N(e[0]-t[0])>1e-6){var a=e[0]{JF(),fP(),YF=qF(function(){return!0},ive,ove,[-qN,-JN])}));function sve(e){var t=nP(e),n=2*QN,r=t>0,i=$N(t)>KN;function a(t,r,i,a){eve(a,e,n,i,t,r)}function o(e,n){return nP(e)*nP(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?qN:-qN),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||zF(t,m)||zF(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!zF(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=NP(e),a=NP(n),o=[1,0,0],s=FP(i,a),c=PP(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=FP(o,s),m=LP(o,d);IP(m,LP(s,f));var h=p,g=PP(m,h),_=PP(h,h),v=g*g-_*(PP(m,m)-1);if(!(v<0)){var y=uP(v),b=LP(h,(-g-y)/_);if(IP(b,m),b=MP(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S0^b[1]<($N(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>qN^(x<=b[0]&&b[0]<=S)){var k=LP(h,(-g+y)/_);return IP(k,m),[b,MP(k)]}}}function l(t,n){var i=r?e:qN-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return qF(o,s,a,r?[0,-e]:[-qN,e-qN])}var ZF=o((()=>{zP(),IF(),fP(),BF(),JF()}));function cve(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m0)){if(m/=p,p<0){if(m0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var lve=o((()=>{}));function QF(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return $N(r[0]-e)<1e-6?i>0?0:3:$N(r[0]-n)<1e-6?i>0?2:1:$N(r[1]-t)<1e-6?+(i>0):i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=LF(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;nr&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=voe(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&HF(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(eI,Math.min($F,g)),_=Math.max(eI,Math.min($F,_))],u=[a=Math.max(eI,Math.min($F,a)),o=Math.max(eI,Math.min($F,o))];cve(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}var $F,eI,tI=o((()=>{fP(),RF(),lve(),WF(),c_(),$F=1e9,eI=-$F}));function nI(e,t,n){var r=s_(e,t-KN,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function rI(e,t,n){var r=s_(e,t-KN,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function uve(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return s_(rP(r/u)*u,n,u).map(m).concat(s_(rP(s/d)*d,o,d).map(h)).concat(s_(rP(t/c)*c,e,c).filter(function(e){return $N(e%u)>KN}).map(f)).concat(s_(rP(a/l)*l,i,l).filter(function(e){return $N(e%d)>KN}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=nI(a,i,90),p=rI(t,e,g),m=nI(s,o,90),h=rI(r,n,g),_):g},_.extentMajor([[-180,-90+KN],[180,90-KN]]).extentMinor([[-180,-80-KN],[180,80+KN]])}var dve=o((()=>{c_(),fP()})),iI,aI=o((()=>{iI=e=>e}));function fve(){pI.point=pve}function pve(e,t){pI.point=oI,lI=dI=e,uI=fI=t}function oI(e,t){cI.add(fI*e-dI*t),dI=e,fI=t}function mve(){oI(lI,uI)}var sI,cI,lI,uI,dI,fI,pI,hve=o((()=>{c_(),fP(),mP(),sI=new Jg,cI=new Jg,pI={point:pP,lineStart:pP,lineEnd:pP,polygonStart:function(){pI.lineStart=fve,pI.lineEnd=mve},polygonEnd:function(){pI.lineStart=pI.lineEnd=pI.point=pP,sI.add($N(cI)),cI=new Jg},result:function(){var e=sI/2;return sI=new Jg,e}}}));function gve(e,t){egI&&(gI=e),t_I&&(_I=t)}var mI,hI,gI,_I,vI,yI=o((()=>{mP(),mI=1/0,hI=mI,gI=-mI,_I=gI,vI={point:gve,lineStart:pP,lineEnd:pP,polygonStart:pP,polygonEnd:pP,result:function(){var e=[[mI,hI],[gI,_I]];return gI=_I=-(hI=mI=1/0),e}}}));function bI(e,t){wI+=e,TI+=t,++EI}function xI(){LI.point=_ve}function _ve(e,t){LI.point=vve,bI(FI=e,II=t)}function vve(e,t){var n=e-FI,r=t-II,i=uP(n*n+r*r);DI+=i*(FI+e)/2,OI+=i*(II+t)/2,kI+=i,bI(FI=e,II=t)}function SI(){LI.point=bI}function yve(){LI.point=xve}function bve(){CI(NI,PI)}function xve(e,t){LI.point=CI,bI(NI=FI=e,PI=II=t)}function CI(e,t){var n=e-FI,r=t-II,i=uP(n*n+r*r);DI+=i*(FI+e)/2,OI+=i*(II+t)/2,kI+=i,i=II*e-FI*t,AI+=i*(FI+e),jI+=i*(II+t),MI+=i*3,bI(FI=e,II=t)}var wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,Sve=o((()=>{fP(),wI=0,TI=0,EI=0,DI=0,OI=0,kI=0,AI=0,jI=0,MI=0,LI={point:bI,lineStart:xI,lineEnd:SI,polygonStart:function(){LI.lineStart=yve,LI.lineEnd=bve},polygonEnd:function(){LI.point=bI,LI.lineStart=xI,LI.lineEnd=SI},result:function(){var e=MI?[AI/MI,jI/MI]:kI?[DI/kI,OI/kI]:EI?[wI/EI,TI/EI]:[NaN,NaN];return wI=TI=EI=DI=OI=kI=AI=jI=MI=0,e}}}));function RI(e){this._context=e}var Cve=o((()=>{fP(),mP(),RI.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,XN);break}},result:pP}}));function wve(e,t){KI.point=zI,HI=WI=e,UI=GI=t}function zI(e,t){WI-=e,GI-=t,BI.add(uP(WI*WI+GI*GI)),WI=e,GI=t}var BI,VI,HI,UI,WI,GI,KI,Tve=o((()=>{c_(),fP(),mP(),BI=new Jg,KI={point:pP,lineStart:function(){KI.point=wve},lineEnd:function(){VI&&zI(HI,UI),KI.point=pP},polygonStart:function(){VI=!0},polygonEnd:function(){VI=null},result:function(){var e=+BI;return BI=new Jg,e}}}));function qI(e){let t=1;this._+=e[0];for(let n=e.length;t=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return qI;if(t!==JI){let e=10**t;JI=t,YI=function(t){let n=1;this._+=t[0];for(let r=t.length;n{QI=class{constructor(e){this._append=e==null?qI:Eve(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==XI||this._append!==YI){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,XI=e,YI=this._append,ZI=this._,this._=t}this._+=ZI;break}}result(){let e=this._;return this._=``,e.length?e:null}}}));function $I(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),vP(e,i(a))),a.result()}return o.area=function(e){return vP(e,i(pI)),pI.result()},o.measure=function(e){return vP(e,i(KI)),KI.result()},o.bounds=function(e){return vP(e,i(vI)),vI.result()},o.centroid=function(e){return vP(e,i(LI)),LI.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,iI):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new QI(n)):new RI(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new QI(n)),o},o.projection(e).digits(n).context(t)}var Ove=o((()=>{aI(),xP(),hve(),yI(),Sve(),Cve(),Tve(),Dve()}));function eL(e){return function(t){var n=new tL;for(var r in e)n[r]=e[r];return n.stream=t,n}}function tL(){}var nL=o((()=>{tL.prototype={constructor:tL,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}}));function rL(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),vP(n,e.stream(vI)),t(vI.result()),r!=null&&e.clipExtent(r),e}function iL(e,t,n){return rL(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function aL(e,t,n){return iL(e,[[0,0],t],n)}function oL(e,t,n){return rL(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function sL(e,t,n){return rL(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var cL=o((()=>{xP(),yI()}));function lL(e,t){return+t?Ave(e,t):kve(e)}function kve(e){return eL({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Ave(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=uP(b*b+x*x+S*S),w=GN(S/=C),T=$N($N(S)-1)<1e-6||$N(a-d)<1e-6?(a+d)/2:tP(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||$N((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m{zP(),fP(),nL(),uL=16,dL=nP(30*QN)}));function Mve(e){return eL({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Nve(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function fL(e,t,n,r,i,a){if(!a)return Nve(e,t,n,r,i);var o=nP(a),s=cP(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function pL(e){return mL(function(){return e})()}function mL(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=YF,g=null,_,v,y,b=iI,x=.5,S,C,w,T,E;function D(e){return w(e[0]*QN,e[1]*QN)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*ZN,e[1]*ZN]}D.stream=function(e){return T&&E===e?T:T=hL(Mve(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?sve(m=e*QN):(m=null,YF),A()):m*ZN},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,iI):QF(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*QN,o=e[1]%360*QN,k()):[a*ZN,o*ZN]},D.rotate=function(e){return arguments.length?(s=e[0]%360*QN,c=e[1]%360*QN,l=e.length>2?e[2]%360*QN:0,k()):[s*ZN,c*ZN,l*ZN]},D.angle=function(e){return arguments.length?(d=e%360*QN,k()):d*ZN},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=lL(C,x=e*e),A()):uP(x)},D.fitExtent=function(e,t){return iL(D,e,t)},D.fitSize=function(e,t){return aL(D,e,t)},D.fitWidth=function(e,t){return oL(D,e,t)},D.fitHeight=function(e,t){return sL(D,e,t)};function k(){var e=fL(n,0,0,f,p,d).apply(null,t(a,o)),m=fL(n,r-e[0],i-e[1],f,p,d);return u=AF(s,c,l),C=DF(t,m),w=DF(u,C),S=lL(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}var hL,gL=o((()=>{XF(),ZF(),tI(),OF(),aI(),fP(),PF(),nL(),cL(),jve(),hL=eL({point:function(e,t){this.stream.point(e*QN,t*QN)}})}));function _L(e){var t=0,n=qN/3,r=mL(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*QN,n=e[1]*QN):[t*ZN,n*ZN]},i}var vL=o((()=>{fP(),gL()}));function Pve(e){var t=nP(e);function n(e,n){return[e*t,cP(n)/t]}return n.invert=function(e,n){return[e/t,GN(n*t)]},n}var Fve=o((()=>{fP()}));function Ive(e,t){var n=cP(e),r=(n+cP(t))/2;if($N(r)<1e-6)return Pve(e);var i=1+n*(2*r-n),a=uP(i)/r;function o(e,t){var n=uP(i-2*r*cP(t))/r;return[n*cP(e*=r),a-n*nP(e)]}return o.invert=function(e,t){var n=a-t,o=tP(e,$N(n))*lP(n);return n*r<0&&(o-=qN*lP(e)*lP(n)),[o/r,GN((i-(e*e+n*n)*r*r)/(2*r))]},o}function yL(){return _L(Ive).scale(155.424).center([0,33.6442])}var bL=o((()=>{fP(),vL(),Fve()}));function xL(){return yL().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}var SL=o((()=>{bL()}));function Lve(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i=.12&&s<.234&&a>=-.425&&a<-.214?i:s>=.166&&s<.234&&a>=-.214&&a<-.115?o:n).invert(e)},u.stream=function(r){return e&&t===r?e:e=Lve([n.stream(t=r),i.stream(r),o.stream(r)])},u.precision=function(e){return arguments.length?(n.precision(e),i.precision(e),o.precision(e),d()):n.precision()},u.scale=function(e){return arguments.length?(n.scale(e),i.scale(e*.35),o.scale(e),u.translate(n.translate())):n.scale()},u.translate=function(e){if(!arguments.length)return n.translate();var t=n.scale(),c=+e[0],u=+e[1];return r=n.translate(e).clipExtent([[c-.455*t,u-.238*t],[c+.455*t,u+.238*t]]).stream(l),a=i.translate([c-.307*t,u+.201*t]).clipExtent([[c-.425*t+KN,u+.12*t+KN],[c-.214*t-KN,u+.234*t-KN]]).stream(l),s=o.translate([c-.205*t,u+.212*t]).clipExtent([[c-.214*t+KN,u+.166*t+KN],[c-.115*t-KN,u+.234*t-KN]]).stream(l),d()},u.fitExtent=function(e,t){return iL(u,e,t)},u.fitSize=function(e,t){return aL(u,e,t)},u.fitWidth=function(e,t){return oL(u,e,t)},u.fitHeight=function(e,t){return sL(u,e,t)};function d(){return e=t=null,u}return u.scale(1070)}var zve=o((()=>{fP(),SL(),bL(),cL()}));function CL(e){return function(t,n){var r=nP(t),i=nP(n),a=e(r*i);return a===1/0?[2,0]:[a*i*cP(t),a*cP(n)]}}function wL(e){return function(t,n){var r=uP(t*t+n*n),i=e(r),a=cP(i),o=nP(i);return[tP(t*a,r*o),GN(r&&n*a/r)]}}var TL=o((()=>{fP()}));function Bve(){return pL(EL).scale(124.75).clipAngle(179.999)}var EL,Vve=o((()=>{fP(),TL(),gL(),EL=CL(function(e){return uP(2/(1+e))}),EL.invert=wL(function(e){return 2*GN(e/2)})}));function Hve(){return pL(DL).scale(79.4188).clipAngle(179.999)}var DL,Uve=o((()=>{fP(),TL(),gL(),DL=CL(function(e){return(e=WN(e))&&e/cP(e)}),DL.invert=wL(function(e){return e})}));function OL(e,t){return[e,oP(dP((JN+t)/2))]}function Wve(){return kL(OL).scale(961/XN)}function kL(e){var t=pL(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=qN*r(),i=t($_e(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===OL?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}var AL=o((()=>{fP(),PF(),gL(),OL.invert=function(e,t){return[e,2*eP(iP(t))-JN]}}));function jL(e){return dP((JN+e)/2)}function Gve(e,t){var n=nP(e),r=e===t?cP(e):oP(n/nP(t))/oP(jL(t)/jL(e)),i=n*sP(jL(e),r)/r;if(!r)return OL;function a(e,t){i>0?t<-JN+1e-6&&(t=-JN+KN):t>JN-1e-6&&(t=JN-KN);var n=i/sP(jL(t),r);return[n*cP(r*e),i-n*nP(r*e)]}return a.invert=function(e,t){var n=i-t,a=lP(r)*uP(e*e+n*n),o=tP(e,$N(n))*lP(n);return n*r<0&&(o-=qN*lP(e)*lP(n)),[o/r,2*eP(sP(i/a,1/r))-JN]},a}function Kve(){return _L(Gve).scale(109.5).parallels([30,30])}var qve=o((()=>{fP(),vL(),AL()}));function ML(e,t){return[e,t]}function Jve(){return pL(ML).scale(152.63)}var NL=o((()=>{gL(),ML.invert=ML}));function Yve(e,t){var n=nP(e),r=e===t?cP(e):(n-nP(t))/(t-e),i=n/r+e;if($N(r)<1e-6)return ML;function a(e,t){var n=i-t,a=r*e;return[n*cP(a),i-n*nP(a)]}return a.invert=function(e,t){var n=i-t,a=tP(e,$N(n))*lP(n);return n*r<0&&(a-=qN*lP(e)*lP(n)),[a/r,i-lP(r)*uP(e*e+n*n)]},a}function Xve(){return _L(Yve).scale(131.154).center([0,13.9389])}var Zve=o((()=>{fP(),vL(),NL()}));function PL(e,t){var n=GN(zL*cP(t)),r=n*n,i=r*r*r;return[e*nP(n)/(zL*(FL+3*IL*r+i*(7*LL+9*RL*r))),n*(FL+IL*r+i*(LL+RL*r))]}function Qve(){return pL(PL).scale(177.158)}var FL,IL,LL,RL,zL,BL,$ve=o((()=>{gL(),fP(),FL=1.340264,IL=-.081106,LL=893e-6,RL=.003796,zL=uP(3)/2,BL=12,PL.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,a=0,o,s,c;a{fP(),TL(),gL(),VL.invert=wL(eP)}));function nye(){var e=1,t=0,n=0,r=1,i=1,a=0,o,s,c=null,l,u,d,f=1,p=1,m=eL({point:function(e,t){var n=y([e,t]);this.stream.point(n[0],n[1])}}),h=iI,g,_;function v(){return f=e*r,p=e*i,g=_=null,y}function y(e){var r=e[0]*f,i=e[1]*p;if(a){var c=i*o-r*s;r=r*o+i*s,i=c}return[r+t,i+n]}return y.invert=function(e){var r=e[0]-t,i=e[1]-n;if(a){var c=i*o+r*s;r=r*o-i*s,i=c}return[r/f,i/p]},y.stream=function(e){return g&&_===e?g:g=m(h(_=e))},y.postclip=function(e){return arguments.length?(h=e,c=l=u=d=null,v()):h},y.clipExtent=function(e){return arguments.length?(h=e==null?(c=l=u=d=null,iI):QF(c=+e[0][0],l=+e[0][1],u=+e[1][0],d=+e[1][1]),v()):c==null?null:[[c,l],[u,d]]},y.scale=function(t){return arguments.length?(e=+t,v()):e},y.translate=function(e){return arguments.length?(t=+e[0],n=+e[1],v()):[t,n]},y.angle=function(e){return arguments.length?(a=e%360*QN,s=cP(a),o=nP(a),v()):a*ZN},y.reflectX=function(e){return arguments.length?(r=e?-1:1,v()):r<0},y.reflectY=function(e){return arguments.length?(i=e?-1:1,v()):i<0},y.fitExtent=function(e,t){return iL(y,e,t)},y.fitSize=function(e,t){return aL(y,e,t)},y.fitWidth=function(e,t){return oL(y,e,t)},y.fitHeight=function(e,t){return sL(y,e,t)},y}var rye=o((()=>{tI(),aI(),nL(),cL(),fP()}));function HL(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function iye(){return pL(HL).scale(175.295)}var aye=o((()=>{gL(),fP(),HL.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,o=a*a;n-=i=(n*(1.007226+a*(.015085+o*(-.044475+.028874*a-.005916*o)))-t)/(1.007226+a*(.015085*3+o*(-.044475*7+.028874*9*a-.005916*11*o)))}while($N(i)>1e-6&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}}));function UL(e,t){return[nP(t)*cP(e),cP(t)]}function oye(){return pL(UL).scale(249.5).clipAngle(90+KN)}var sye=o((()=>{fP(),TL(),gL(),UL.invert=wL(GN)}));function WL(e,t){var n=nP(t),r=1+nP(e)*n;return[n*cP(e)/r,cP(t)/r]}function cye(){return pL(WL).scale(250).clipAngle(142)}var lye=o((()=>{fP(),TL(),gL(),WL.invert=wL(function(e){return 2*eP(e)})}));function GL(e,t){return[oP(dP((JN+t)/2)),-e]}function uye(){var e=kL(GL),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):(e=t(),[e[1],-e[0]])},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):(e=n(),[e[0],e[1],e[2]-90])},n([0,0,90]).scale(159.155)}var dye=o((()=>{fP(),AL(),GL.invert=function(e,t){return[-t,2*eP(iP(e))-JN]}})),KL=o((()=>{jP(),G_e(),Q_e(),IF(),XF(),ZF(),tI(),KF(),c_(),fP(),mP(),xP(),dve(),Ove(),SL(),zve(),Vve(),Uve(),qve(),bL(),Zve(),$ve(),NL(),tye(),rye(),gL(),AL(),aye(),sye(),lye(),dye(),PF(),nL()}));function qL(e){return e>1?QL:e<-1?-QL:Math.asin(e)}function fye(e){return e>0?Math.sqrt(e):0}var JL,YL,XL,ZL,QL,$L,eR=o((()=>{JL=Math.abs,YL=Math.cos,XL=Math.sin,ZL=Math.PI,QL=ZL/2,ZL/4,$L=fye(2),ZL*2,180/ZL,ZL/180}));function pye(e,t){var n=e*XL(t),r=30,i;do t-=i=(t+XL(t)-n)/(1+YL(t));while(JL(i)>1e-6&&--r>0);return t/2}function mye(e,t,n){function r(r,i){return[e*r*YL(i=pye(n,i)),t*XL(i)]}return r.invert=function(r,i){return i=qL(i/t),[r/(e*YL(i)),qL((2*i+XL(2*i))/n)]},r}function hye(){return pL(tR).scale(169.529)}var tR,gye=o((()=>{KL(),eR(),tR=mye($L/QL,$L,ZL)})),_ye=o((()=>{KL(),eR(),gye(),c_()}));function vye(e,t){return function n(){let r=t();return r.type=e,r.path=$I().projection(r),r.copy=r.copy||function(){let e=n();return aR.forEach(t=>{r[t]&&e[t](r[t]())}),e.path.pointRadius(r.path.pointRadius()),e},Kfe(r)}}function nR(e,t){if(!e||typeof e!=`string`)throw Error(`Projection type must be a name string.`);return e=e.toLowerCase(),arguments.length>1?(oR[e]=vye(e,t),this):oR[e]||null}function rR(e){return e&&e.path||iR}var iR,aR,oR,sR=o((()=>{KL(),_ye(),MO(),iR=$I(),aR=[`clipAngle`,`clipExtent`,`scale`,`translate`,`center`,`rotate`,`parallels`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],oR={albers:xL,albersusa:Rve,azimuthalequalarea:Bve,azimuthalequidistant:Hve,conicconformal:Kve,conicequalarea:yL,conicequidistant:Xve,equalEarth:Qve,equirectangular:Jve,gnomonic:eye,identity:nye,mercator:Wve,mollweide:hye,naturalEarth1:iye,orthographic:oye,stereographic:cye,transversemercator:uye};for(let e in oR)nR(e,oR[e])})),yye=c({contour:()=>yR,geojson:()=>bR,geopath:()=>xR,geopoint:()=>SR,geoshape:()=>CR,graticule:()=>wR,heatmap:()=>TR,isocontour:()=>uR,kde2d:()=>_R,projection:()=>DR});function bye(){}function cR(){var e=1,t=1,n=s;function r(e,t){return t.map(t=>i(e,t))}function i(e,t){var r=[],i=[];return a(e,t,a=>{n(a,e,t),xye(a)>0?r.push([a]):i.push(a)}),i.forEach(e=>{for(var t=0,n=r.length,i;t=r,f,p;for(kR[d<<1].forEach(m);++c=r,kR[u|d<<1].forEach(m);for(kR[d<<0].forEach(m);++l=r,f=n[l*e]>=r,kR[d<<1|f<<2].forEach(m);++c=r,p=f,f=n[l*e+c+1]>=r,kR[u|d<<1|f<<2|p<<3].forEach(m);kR[d|f<<3].forEach(m)}for(c=-1,f=n[l*e]>=r,kR[f<<2].forEach(m);++c=r,kR[f<<2|p<<3].forEach(m);kR[f<<3].forEach(m);function m(e){var t=[e[0][0]+c,e[0][1]+l],n=[e[1][0]+c,e[1][1]+l],r=o(t),u=o(n),d,f;(d=s[r])?(f=a[u])?(delete s[d.end],delete a[f.start],d===f?(d.ring.push(n),i(d.ring)):a[d.start]=s[f.end]={start:d.start,end:f.end,ring:d.ring.concat(f.ring)}):(delete s[d.end],d.ring.push(n),s[d.end=u]=d):(d=a[u])?(f=s[r])?(delete a[d.start],delete s[f.end],d===f?(d.ring.push(n),i(d.ring)):a[f.start]=s[d.end]={start:f.start,end:d.end,ring:f.ring.concat(d.ring)}):(delete a[d.start],d.ring.unshift(t),a[d.start=r]=d):a[r]=s[u]={start:r,end:u,ring:[t,n]}}}function o(t){return t[0]*2+t[1]*(e+1)*4}function s(n,r,i){n.forEach(n=>{var a=n[0],o=n[1],s=a|0,c=o|0,l,u=r[c*e+s];a>0&&a0&&o=0&&a>=0||V(`invalid size`),e=i,t=a,r},r.smooth=function(e){return arguments.length?(n=e?s:bye,r):n===s},r}function xye(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++tr!=p>r&&n<(f-l)*(r-u)/(p-u)+l&&(i=-i)}return i}function wye(e,t,n){var r;return Tye(e,t,n)&&Eye(e[r=+(e[0]===t[0])],n[r],t[r])}function Tye(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Eye(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function lR(e,t,n){return function(r){var i=gg(r),a=n?Math.min(i[0],0):i[0],o=i[1],s=o-a,c=t?n_(a,o,e):s/(e+1);return s_(a+c,o,c)}}function uR(e){G.call(this,null,e)}function Dye(e,t,n){let r=lR(n.levels||10,n.nice,n.zero!==!1);return n.resolve===`shared`?r(e.map(e=>r_(t(e).values))):r}function Oye(e,t,n,r){let i=r.scale||t.scale,a=r.translate||t.translate;if(ag(i)&&(i=i(n,r)),ag(a)&&(a=a(n,r)),(i===1||i==null)&&!a)return;let o=(wg(i)?i:i[0])||1,s=(wg(i)?i:i[1])||1,c=a&&a[0]||0,l=a&&a[1]||0;e.forEach(dR(t,o,s,c,l))}function dR(e,t,n,r,i){let a=e.x1||0,o=e.y1||0,s=t*n<0;function c(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(u)}function u(e){e[0]=(e[0]-a)*t+r,e[1]=(e[1]-o)*n+i}return function(e){return e.coordinates.forEach(c),e}}function fR(e,t,n){let r=e>=0?e:nS(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function pR(e){return ag(e)?e:pg(+e)}function mR(){var e=e=>e[0],t=e=>e[1],n=xh,r=[-1,-1],i=960,a=500,o=2;function s(s,c){let l=fR(r[0],s,e)>>o,u=fR(r[1],s,t)>>o,d=l?l+2:0,f=u?u+2:0,p=2*d+(i>>o),m=2*f+(a>>o),h=new Float32Array(p*m),g=new Float32Array(p*m),_=h;s.forEach(r=>{let i=d+(+e(r)>>o),a=f+(+t(r)>>o);i>=0&&i=0&&a0&&u>0?(hR(p,m,h,g,l),gR(p,m,g,h,u),hR(p,m,h,g,l),gR(p,m,g,h,u),hR(p,m,h,g,l),gR(p,m,g,h,u)):l>0?(hR(p,m,h,g,l),hR(p,m,g,h,l),hR(p,m,h,g,l),_=g):u>0&&(gR(p,m,h,g,u),gR(p,m,g,h,u),gR(p,m,h,g,u),_=g);let v=c?2**(-2*o):1/xoe(_);for(let e=0,t=p*m;e>o),y2:f+(a>>o)}}return s.x=function(t){return arguments.length?(e=pR(t),s):e},s.y=function(e){return arguments.length?(t=pR(e),s):t},s.weight=function(e){return arguments.length?(n=pR(e),s):n},s.size=function(e){if(!arguments.length)return[i,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||V(`invalid size`),i=t,a=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||V(`invalid cell size`),o=Math.floor(Math.log(e)/Math.LN2),s):1<=i&&(t>=a&&(s-=n[t-a+o*e]),r[t-i+o*e]=s/Math.min(t+1,e-1+a-t,a))}function gR(e,t,n,r,i){let a=(i<<1)+1;for(let o=0;o=i&&(s>=a&&(c-=n[o+(s-a)*e]),r[o+(s-i)*e]=c/Math.min(s+1,t-1+a-s,a))}function _R(e){G.call(this,null,e)}function vR(e,t){return AR.forEach(n=>t[n]==null?0:e[n](t[n])),e}function kye(e,t){var n=[],r=e=>e(s),i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;ae(t(n)):r=>{var i=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(i),a};return r.context=t=>(e.context(t),r),r}function wR(e){G.call(this,[],e),this.generator=uve()}function TR(e){G.call(this,null,e)}function Mye(e,t){let n;return ag(e)?(n=n=>XT(e(n,t)),n.dep=ER(e)):n=pg(XT(e||`#888`)),n}function Nye(e,t){let n;return ag(e)?(n=n=>e(n,t),n.dep=ER(e)):e?n=pg(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}function ER(e){if(!ag(e))return!1;let t=Ng(sh(e));return t.$x||t.$y||t.$value||t.$max}function Pye(e,t,n,r){let i=e.width,a=e.height,o=e.x1||0,s=e.y1||0,c=e.x2||i,l=e.y2||a,u=e.values,d=u?e=>u[e]:bh,f=MT(c-o,l-s),p=f.getContext(`2d`),m=p.getImageData(0,0,c-o,l-s),h=m.data;for(let e=s,a=0;ee.concat(Rye(t)),[])}}function Rye(e){return e.type===MR?e.features:ng(e).filter(e=>e!=null).map(e=>e.type===jR?e:{type:jR,geometry:e})}var kR,AR,jR,MR,NR,zye=o((()=>{Qx(),Fg(),c_(),US(),sR(),KL(),tD(),PT(),kR=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]],uR.Definition={type:`Isocontour`,metadata:{generates:!0},params:[{name:`field`,type:`field`},{name:`thresholds`,type:`number`,array:!0},{name:`levels`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`zero`,type:`boolean`,default:!0},{name:`smooth`,type:`boolean`,default:!0},{name:`scale`,type:`number`,expr:!0},{name:`translate`,type:`number`,array:!0,expr:!0},{name:`as`,type:`string`,null:!0,default:`contour`}]},U(uR,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||yh,a=cR().smooth(e.smooth!==!1),o=e.thresholds||Dye(r,i,e),s=e.as===null?null:e.as||`contour`,c=[];return r.forEach(t=>{let n=i(t),r=a.size([n.width,n.height])(n.values,H(o)?o:o(n.values));Oye(r,n,t,e),r.forEach(e=>{c.push(cx(t,ox(s==null?e:{[s]:e})))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),_R.Definition={type:`KDE2D`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`weight`,type:`field`},{name:`groupby`,type:`field`,array:!0},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`,array:!0,length:2},{name:`counts`,type:`boolean`,default:!1},{name:`as`,type:`string`,default:`grid`}]},AR=[`x`,`y`,`weight`,`size`,`cellSize`,`bandwidth`],U(_R,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=kye(r,e.groupby),a=(e.groupby||[]).map(oh),o=vR(mR(),e),s=e.as||`grid`,c=[];function l(e,t){for(let n=0;nox(l({[s]:o(t,e.counts)},t.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),yR.Definition={type:`Contour`,metadata:{generates:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`values`,type:`number`,array:!0},{name:`x`,type:`field`},{name:`y`,type:`field`},{name:`weight`,type:`field`},{name:`cellSize`,type:`number`},{name:`bandwidth`,type:`number`},{name:`count`,type:`number`},{name:`nice`,type:`boolean`,default:!1},{name:`thresholds`,type:`number`,array:!0},{name:`smooth`,type:`boolean`,default:!0}]},U(yR,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=cR().smooth(e.smooth!==!1),i=e.values,a=e.thresholds||lR(e.count||10,e.nice,!!i),o=e.size,s,c;return i||=(i=t.materialize(t.SOURCE).source,s=vR(mR(),e)(i,!0),c=dR(s,s.scale||1,s.scale||1,0,0),o=[s.width,s.height],s.values),a=H(a)?a:a(i),i=r.size(o)(i,a),c&&i.forEach(c),this.value&&(n.rem=this.value),this.value=n.source=n.add=(i||[]).map(ox),n}}),jR=`Feature`,MR=`FeatureCollection`,NR=`MultiPoint`,bR.Definition={type:`GeoJSON`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,length:2},{name:`geojson`,type:`field`}]},U(bR,G,{transform(e,t){var n=this._features,r=this._points,i=e.fields,a=i&&i[0],o=i&&i[1],s=e.geojson||!i&&yh,c=t.ADD,l=e.modified()||t.changed(t.REM)||t.modified(sh(s))||a&&t.modified(sh(a))||o&&t.modified(sh(o));(!this.value||l)&&(c=t.SOURCE,this._features=n=[],this._points=r=[]),s&&t.visit(c,e=>n.push(s(e))),a&&o&&(t.visit(c,e=>{var t=a(e),n=o(e);t!=null&&n!=null&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),n=n.concat({type:jR,geometry:{type:NR,coordinates:r}})),this.value={type:MR,features:n}}}),xR.Definition={type:`GeoPath`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`path`}]},U(xR,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||yh,a=e.as||`path`,o=n.SOURCE;!r||e.modified()?(this.value=r=rR(e.projection),n.materialize().reflow()):o=i===yh||t.modified(i.fields)?n.ADD_MOD:n.ADD;let s=Aye(r,e.pointRadius);return n.visit(o,e=>e[a]=r(i(e))),r.pointRadius(s),n.modifies(a)}}),SR.Definition={type:`GeoPoint`,metadata:{modifies:!0},params:[{name:`projection`,type:`projection`,required:!0},{name:`fields`,type:`field`,array:!0,required:!0,length:2},{name:`as`,type:`string`,array:!0,length:2,default:[`x`,`y`]}]},U(SR,G,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],a=e.as||[`x`,`y`],o=a[0],s=a[1],c;function l(e){let t=n([r(e),i(e)]);t?(e[o]=t[0],e[s]=t[1]):(e[o]=void 0,e[s]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(c=t.modified(r.fields)||t.modified(i.fields),t.visit(c?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),CR.Definition={type:`GeoShape`,metadata:{modifies:!0,nomod:!0},params:[{name:`projection`,type:`projection`},{name:`field`,type:`field`,default:`datum`},{name:`pointRadius`,type:`number`,expr:!0},{name:`as`,type:`string`,default:`shape`}]},U(CR,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||`shape`,a=n.ADD;return(!r||e.modified())&&(this.value=r=jye(rR(e.projection),e.field||gh(`datum`),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,e=>e[i]=r),n.modifies(i)}}),wR.Definition={type:`Graticule`,metadata:{changes:!0,generates:!0},params:[{name:`extent`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMajor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`extentMinor`,type:`array`,array:!0,length:2,content:{type:`number`,array:!0,length:2}},{name:`step`,type:`number`,array:!0,length:2},{name:`stepMajor`,type:`number`,array:!0,length:2,default:[90,360]},{name:`stepMinor`,type:`number`,array:!0,length:2,default:[10,10]},{name:`precision`,type:`number`,default:2.5}]},U(wR,G,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(let t in e)ag(r[t])&&r[t](e[t]);return i=r(),n.length?t.mod.push(lx(n[0],i)):t.add.push(ox(i)),n[0]=i,t}}),TR.Definition={type:`heatmap`,metadata:{modifies:!0},params:[{name:`field`,type:`field`},{name:`color`,type:`string`,expr:!0},{name:`opacity`,type:`number`,expr:!0},{name:`resolve`,type:`enum`,values:[`shared`,`independent`],default:`independent`},{name:`as`,type:`string`,default:`image`}]},U(TR,G,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve===`shared`,i=e.field||yh,a=Nye(e.opacity,e),o=Mye(e.color,e),s=e.as||`image`,c={$x:0,$y:0,$value:0,$max:r?r_(n.map(e=>r_(i(e).values))):0};return n.forEach(e=>{let t=i(e),n=hg({},e,c);r||(n.$max=r_(t.values||[])),e[s]=Pye(t,n,o.dep?o:pg(o(n)),a.dep?a:pg(a(n)))}),t.reflow(!0).modifies(s)}}),U(DR,G,{transform(e,t){let n=this.value;return!n||e.modified(`type`)?(this.value=n=Iye(e.type),aR.forEach(t=>{e[t]!=null&&OR(n,t,e[t])})):aR.forEach(t=>{e.modified(t)&&OR(n,t,e[t])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&Fye(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}})}));function Bye(e,t){var n,r=1;e??=0,t??=0;function i(){var i,a=n.length,o,s=0,c=0;for(i=0;i{}));function Hye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return PR(this.cover(t,n),t,n,e)}function PR(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Uye(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;nu&&(u=i),ad&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n{}));function Gye(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t{}));function qye(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}var Jye=o((()=>{}));function Yye(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}var Xye=o((()=>{}));function FR(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}var IR=o((()=>{}));function Zye(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new FR(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b{IR()}));function $ye(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function ebe(e){for(var t=0,n=e.length;t{}));function nbe(){return this._root}var rbe=o((()=>{}));function ibe(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}var abe=o((()=>{}));function obe(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new FR(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new FR(i,l,u,s,c)),(i=r[2])&&t.push(new FR(i,a,u,l,c)),(i=r[1])&&t.push(new FR(i,l,o,s,u)),(i=r[0])&&t.push(new FR(i,a,o,l,u))}return this}var sbe=o((()=>{IR()}));function cbe(e){var t=[],n=[],r;for(this._root&&t.push(new FR(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new FR(a,o,s,u,d)),(a=i[1])&&t.push(new FR(a,u,s,c,d)),(a=i[2])&&t.push(new FR(a,o,d,u,l)),(a=i[3])&&t.push(new FR(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}var lbe=o((()=>{IR()}));function ube(e){return e[0]}function dbe(e){return arguments.length?(this._x=e,this):this._x}var fbe=o((()=>{}));function pbe(e){return e[1]}function mbe(e){return arguments.length?(this._y=e,this):this._y}var hbe=o((()=>{}));function LR(e,t,n){var r=new RR(t??ube,n??pbe,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function RR(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function zR(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var BR,gbe=o((()=>{Wye(),Kye(),Jye(),Xye(),Qye(),tbe(),rbe(),abe(),sbe(),lbe(),fbe(),hbe(),BR=LR.prototype=RR.prototype,BR.copy=function(){var e=new RR(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=zR(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=zR(r));return e},BR.add=Hye,BR.addAll=Uye,BR.cover=Gye,BR.data=qye,BR.extent=Yye,BR.find=Zye,BR.remove=$ye,BR.removeAll=ebe,BR.root=nbe,BR.size=ibe,BR.visit=obe,BR.visitAfter=cbe,BR.x=dbe,BR.y=mbe})),VR=o((()=>{gbe()}));function HR(e){return function(){return e}}var UR=o((()=>{}));function WR(e){return(e()-.5)*1e-6}var GR=o((()=>{}));function _be(e){return e.x+e.vx}function vbe(e){return e.y+e.vy}function ybe(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=HR(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;ml.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_u+m||ad+m||oe.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r{VR(),UR(),GR()}));function xbe(e){return e.index}function KR(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function Sbe(e){var t=xbe,n=d,r,i=HR(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n[t(e,n,o),e])),d;for(n=0,s=Array(i);n{UR(),GR()}));function qR(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}function Tbe(e,t){for(var n=0,r=e.length,i;n{XR={value:()=>{}},JR.prototype=qR.prototype={constructor:JR,on:function(e,t){var n=this._,r=wbe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r{Ebe()}));function ZR(){return lz||=(fz(Obe),dz.now()+uz)}function Obe(){lz=0}function QR(){this._call=this._time=this._next=null}function $R(e,t,n){var r=new QR;return r.restart(e,t,n),r}function kbe(){ZR(),++nz;for(var e=oz,t;e;)(t=lz-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nz}function ez(){lz=(cz=dz.now())+uz,nz=rz=0;try{kbe()}finally{nz=0,jbe(),lz=0}}function Abe(){var e=dz.now(),t=e-cz;t>az&&(uz-=t,cz=e)}function jbe(){for(var e,t=oz,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:oz=n);sz=e,tz(r)}function tz(e){nz||(rz&&=clearTimeout(rz),e-lz>24?(e<1/0&&(rz=setTimeout(ez,e-dz.now()-uz)),iz&&=clearInterval(iz)):(iz||=(cz=dz.now(),setInterval(Abe,az)),nz=1,fz(ez)))}var nz,rz,iz,az,oz,sz,cz,lz,uz,dz,fz,pz=o((()=>{nz=0,rz=0,iz=0,az=1e3,cz=0,lz=0,uz=0,dz=typeof performance==`object`&&performance.now?performance:Date,fz=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)},QR.prototype=$R.prototype={constructor:QR,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ZR():+n)+(t==null?0:+t),!this._next&&sz!==this&&(sz?sz._next=this:oz=this,sz=this),this._call=e,this._time=n,tz()},stop:function(){this._call&&(this._call=null,this._time=1/0,tz())}}}));function Mbe(e,t,n){var r=new QR,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(e,t,n){t=+t,n=n==null?ZR():+n,r._restart(function a(o){o+=i,r._restart(a,i+=t,n),e(o)},t,n)},r.restart(e,t,n),r)}var Nbe=o((()=>{pz()})),mz=o((()=>{pz(),Nbe()}));function Pbe(){let e=1;return()=>(e=(hz*e+gz)%_z)/_z}var hz,gz,_z,Fbe=o((()=>{hz=1664525,gz=1013904223,_z=4294967296}));function Ibe(e){return e.x}function Lbe(e){return e.y}function Rbe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=$R(d),l=qR(`tick`,`end`),u=Pbe();e??=[];function d(){f(),l.call(`tick`,t),n1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i1?(l.on(e,n),t):l.on(e)}}}var vz,yz,bz=o((()=>{Dbe(),mz(),Fbe(),vz=10,yz=Math.PI*(3-Math.sqrt(5))}));function zbe(){var e,t,n,r,i=HR(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=LR(e,Ibe,Lbe).visitAfter(d);for(r=n,i=0;i=s)){(e.data!==t||e.next)&&(d===0&&(d=WR(n),m+=d*d),f===0&&(f=WR(n),m+=f*f),m{VR(),UR(),GR(),bz()}));function Vbe(e){var t=HR(.1),n,r,i;typeof e!=`function`&&(e=HR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{UR()}));function Ube(e){var t=HR(.1),n,r,i;typeof e!=`function`&&(e=HR(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t{UR()})),Gbe=o((()=>{Vye(),bbe(),Cbe(),Bbe(),UR(),bz(),Hbe(),Wbe()})),Kbe=c({force:()=>xz});function xz(e){G.call(this,null,e)}function qbe(e,t){return()=>e.touch(t).run()}function Jbe(e,t){let n=Rbe(e),r=n.stop,i=n.restart,a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,i()),n.stop=()=>(a=!0,r()),Sz(n,t,!0).on(`end`,()=>a=!0)}function Sz(e,t,n,r){var i=ng(t.forces),a,o,s,c;for(a=0,o=Tz.length;at(e,n):t)}var Cz,wz,Tz,Ez,Dz,Qbe=o((()=>{Qx(),Fg(),Gbe(),Cz={center:Bye,collide:ybe,nbody:zbe,link:Sbe,x:Vbe,y:Ube},wz=`forces`,Tz=[`alpha`,`alphaMin`,`alphaTarget`,`velocityDecay`,`forces`],Ez=[`static`,`iterations`],Dz=[`x`,`y`,`vx`,`vy`],xz.Definition={type:`Force`,metadata:{modifies:!0},params:[{name:`static`,type:`boolean`,default:!1},{name:`restart`,type:`boolean`,default:!1},{name:`iterations`,type:`number`,default:300},{name:`alpha`,type:`number`,default:1},{name:`alphaMin`,type:`number`,default:.001},{name:`alphaTarget`,type:`number`,default:0},{name:`velocityDecay`,type:`number`,default:.4},{name:`forces`,type:`param`,array:!0,params:[{key:{force:`center`},params:[{name:`x`,type:`number`,default:0},{name:`y`,type:`number`,default:0}]},{key:{force:`collide`},params:[{name:`radius`,type:`number`,expr:!0},{name:`strength`,type:`number`,default:.7},{name:`iterations`,type:`number`,default:1}]},{key:{force:`nbody`},params:[{name:`strength`,type:`number`,default:-30,expr:!0},{name:`theta`,type:`number`,default:.9},{name:`distanceMin`,type:`number`,default:1},{name:`distanceMax`,type:`number`}]},{key:{force:`link`},params:[{name:`links`,type:`data`},{name:`id`,type:`field`},{name:`distance`,type:`number`,default:30,expr:!0},{name:`strength`,type:`number`,expr:!0},{name:`iterations`,type:`number`,default:1}]},{key:{force:`x`},params:[{name:`strength`,type:`number`,default:.1},{name:`x`,type:`field`}]},{key:{force:`y`},params:[{name:`strength`,type:`number`,default:.1},{name:`y`,type:`field`}]}]},{name:`as`,type:`string`,array:!0,modify:!1,default:Dz}]},U(xz,G,{transform(e,t){var n=this.value,r=t.changed(t.ADD_REM),i=e.modified(Tz),a=e.iterations||300;if(n?(r&&(t.modifies(`index`),n.nodes(t.source)),(i||t.changed(t.MOD))&&Sz(n,e,0,t)):(this.value=n=Jbe(t.source,e),n.on(`tick`,qbe(t.dataflow,this)),e.static||(r=!0,n.tick()),t.modifies(`index`)),i||r||e.modified(Ez)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-n.alphaMin()**(1/a)),e.static)for(n.stop();--a>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let e=this._argops,t=0,s=e.length,c;t{}));function cxe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function lxe(){return this.eachAfter(cxe)}var uxe=o((()=>{}));function dxe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}var fxe=o((()=>{}));function pxe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}var mxe=o((()=>{}));function hxe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o{}));function _xe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}var vxe=o((()=>{}));function yxe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}var bxe=o((()=>{}));function xxe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var Sxe=o((()=>{}));function Cxe(e){for(var t=this,n=wxe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function wxe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}var Txe=o((()=>{}));function Exe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var Dxe=o((()=>{}));function Oxe(){return Array.from(this)}var kxe=o((()=>{}));function Axe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var jxe=o((()=>{}));function Mxe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}var Nxe=o((()=>{}));function*Pxe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i{}));function Oz(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Rxe)):t===void 0&&(t=Lxe);for(var n=new Az(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new Az(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(kz)}function Ixe(){return Oz(this).eachBefore(zxe)}function Lxe(e){return e.children}function Rxe(e){return Array.isArray(e)?e[1]:null}function zxe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function kz(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Az(e){this.data=e,this.depth=this.height=0,this.parent=null}var jz=o((()=>{uxe(),fxe(),mxe(),gxe(),vxe(),bxe(),Sxe(),Txe(),Dxe(),kxe(),jxe(),Nxe(),Fxe(),Az.prototype=Oz.prototype={constructor:Az,count:lxe,each:dxe,eachAfter:hxe,eachBefore:pxe,find:_xe,sum:yxe,sort:xxe,path:Cxe,ancestors:Exe,descendants:Oxe,leaves:Axe,links:Mxe,copy:Ixe,[Symbol.iterator]:Pxe}}));function Mz(e){return e==null?null:Nz(e)}function Nz(e){if(typeof e!=`function`)throw Error();return e}var Pz=o((()=>{}));function Fz(){return 0}function Iz(e){return function(){return e}}var Lz=o((()=>{}));function Bxe(){let e=1;return()=>(e=(Rz*e+zz)%Bz)/Bz}var Rz,zz,Bz,Vxe=o((()=>{Rz=1664525,zz=1013904223,Bz=4294967296}));function Hxe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Uxe(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}var Vz=o((()=>{}));function Wxe(e,t){for(var n=0,r=(e=Uxe(Array.from(e),t)).length,i=[],a,o;n0&&n*n>r*r+i*i}function Wz(e,t){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*O))/(2*E):O/D);return{x:r+S+C*k,y:i+w+T*k,r:k}}var qz=o((()=>{Vz()}));function Jz(e,t,n){var r=e.x-t.x,i,a,o=e.y-t.y,s,c,l=r*r+o*o;l?(a=t.r+n.r,a*=a,c=e.r+n.r,c*=c,a>c?(i=(l+c-a)/(2*l),s=Math.sqrt(Math.max(0,c/l-i*i)),n.x=e.x-i*r-s*o,n.y=e.y-i*o+s*r):(i=(l+a-c)/(2*l),s=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-s*o,n.y=t.y+i*o+s*r)):(n.x=t.x+n.r,n.y=t.y)}function Yz(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function Xz(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function Zz(e){this._=e,this.next=null,this.previous=null}function Jxe(e,t){if(!(a=(e=Hxe(e)).length))return 0;var n=e[0],r,i,a,o,s,c,l,u,d,f;if(n.x=0,n.y=0,!(a>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(a>2))return n.r+r.r;Jz(r,n,i=e[2]),n=new Zz(n),r=new Zz(r),i=new Zz(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;pack:for(c=3;c{Vz(),qz()}));function Yxe(e){return Math.sqrt(e.value)}function Xxe(){var e=null,t=1,n=1,r=Fz;function i(i){let a=Bxe();return i.x=t/2,i.y=n/2,e?i.eachBefore($z(e)).eachAfter(eB(r,.5,a)).eachBefore(tB(1)):i.eachBefore($z(Yxe)).eachAfter(eB(Fz,1,a)).eachAfter(eB(r,i.r/Math.min(t,n),a)).eachBefore(tB(Math.min(t,n)/(2*i.r))),i}return i.radius=function(t){return arguments.length?(e=Mz(t),i):e},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(e){return arguments.length?(r=typeof e==`function`?e:Iz(+e),i):r},i}function $z(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function eB(e,t,n){return function(r){if(i=r.children){var i,a,o=i.length,s=e(r)*t||0,c;if(s)for(a=0;a{Pz(),Lz(),Vxe(),Qz()}));function nB(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var rB=o((()=>{}));function iB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s{}));function Qxe(){var e=1,t=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore(a(t,o)),r&&i.eachBefore(nB),i}function a(e,t){return function(r){r.children&&iB(r,r.x0,e*(r.depth+1)/t,r.x1,e*(r.depth+2)/t);var i=r.x0,a=r.y0,o=r.x1-n,s=r.y1-n;o{rB(),aB()}));function eSe(e){return e.id}function tSe(e){return e.parentId}function oB(){var e=eSe,t=tSe,n;function r(r){var i=Array.from(r),a=e,o=t,s,c,l,u,d,f,p,m,h=new Map;if(n!=null){let e=i.map((e,t)=>nSe(n(e,t,r))),t=e.map(sB),s=new Set(e).add(``);for(let n of t)s.has(n)||(s.add(n),e.push(n),t.push(sB(n)),i.push(dB));a=(t,n)=>e[n],o=(e,n)=>t[n]}for(l=0,s=i.length;l=0&&(f=i[e],f.data===dB);--e)f.data=null}if(u.parent=lB,u.eachBefore(function(e){e.depth=e.parent.depth+1,--s}).eachBefore(kz),u.parent=null,s>0)throw Error(`cycle`);return u}return r.id=function(t){return arguments.length?(e=Mz(t),r):e},r.parentId=function(e){return arguments.length?(t=Mz(e),r):t},r.path=function(e){return arguments.length?(n=Mz(e),r):n},r}function nSe(e){e=`${e}`;let t=e.length;return cB(e,t-1)&&!cB(e,t-2)&&(e=e.slice(0,-1)),e[0]===`/`?e:`/${e}`}function sB(e){let t=e.length;if(t<2)return``;for(;--t>1&&!cB(e,t););return e.slice(0,t)}function cB(e,t){if(e[t]===`/`){let n=0;for(;t>0&&e[--t]===`\\`;)++n;if(!(n&1))return!0}return!1}var lB,uB,dB,rSe=o((()=>{Pz(),jz(),lB={depth:-1},uB={},dB={}}));function iSe(e,t){return e.parent===t.parent?1:2}function fB(e){var t=e.children;return t?t[0]:e.t}function pB(e){var t=e.children;return t?t[t.length-1]:e.t}function aSe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function oSe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function sSe(e,t,n){return e.a.parent===t.parent?e.a:n}function mB(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function cSe(e){for(var t=new mB(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new mB(a[o],o)),i.parent=n;return(t.parent=new mB(null,0)).children=[t],t}function lSe(){var e=iSe,t=1,n=1,r=null;function i(i){var s=cSe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.xu.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){oSe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=pB(o),i=fB(i),o&&i;)s=fB(s),a=pB(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(aSe(sSe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!pB(a)&&(a.t=o,a.m+=u-l),i&&!fB(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var uSe=o((()=>{jz(),mB.prototype=Object.create(Az.prototype)}));function hB(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s{}));function _B(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;uv&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p{aB(),gB(),vB=(1+Math.sqrt(5))/2,yB=(function e(t){function n(e,n,r,i,a){_B(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(vB)}));function dSe(){var e=yB,t=!1,n=1,r=1,i=[0],a=Fz,o=Fz,s=Fz,c=Fz,l=Fz;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(nB),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d{rB(),bB(),Pz(),Lz()}));function pSe(e,t,n,r,i){var a=e.children,o,s=a.length,c,l=Array(s+1);for(l[0]=c=o=0;o=t-1){var c=a[e];c.x0=r,c.y0=i,c.x1=o,c.y1=s;return}for(var d=l[e],f=n/2+d,p=e+1,m=t-1;p>>1;l[h]s-i){var v=n?(r*_+o*g)/n:o;u(e,p,g,r,i,v,s),u(p,t,_,v,i,o,s)}else{var y=n?(i*_+s*g)/n:s;u(e,p,g,r,i,o,y),u(p,t,_,r,y,o,s)}}}var mSe=o((()=>{}));function hSe(e,t,n,r,i){(e.depth&1?hB:iB)(e,t,n,r,i)}var gSe=o((()=>{aB(),gB()})),xB,_Se=o((()=>{aB(),gB(),bB(),xB=(function e(t){function n(e,n,r,i,a){if((o=e._squarify)&&o.ratio===t)for(var o,s,c,l,u=-1,d,f=o.length,p=e.value;++u1?t:1)},n})(vB)})),vSe=o((()=>{sxe(),jz(),Zxe(),Qz(),qz(),$xe(),rSe(),uSe(),fSe(),mSe(),aB(),gB(),gSe(),bB(),_Se()})),ySe=c({nest:()=>CB,pack:()=>TB,partition:()=>EB,stratify:()=>DB,tree:()=>OB,treelinks:()=>kB,treemap:()=>AB});function SB(e,t,n){let r={};return e.each(e=>{let i=e.data;n(i)&&(r[t(i)]=e)}),e.lookup=r,e}function CB(e){G.call(this,null,e)}function bSe(){let e=[],t={entries:e=>r(n(e,0),0),key:n=>(e.push(n),t)};function n(t,r){if(r>=e.length)return t;let i=t.length,a=e[r++],o={},s={},c=-1,l,u,d;for(;++ce.length)return t;let i=[];for(let e in t)i.push({key:e,values:r(t[e],n)});return i}return t}function wB(e){G.call(this,null,e)}function xSe(e,t,n){for(let r,i=0,a=t.length;i{Qx(),Fg(),vSe(),CB.Definition={type:`Nest`,metadata:{treesource:!0,changes:!0},params:[{name:`keys`,type:`field`,array:!0},{name:`generate`,type:`boolean`}]},jB=e=>e.values,U(CB,G,{transform(e,t){t.source||V(`Nest transform requires an upstream data source.`);var n=e.generate,r=e.modified(),i=t.clone(),a=this.value;return(!a||r||t.changed())&&(a&&a.each(e=>{e.children&&rx(e.data)&&i.rem.push(e.data)}),this.value=a=Oz({values:ng(e.keys).reduce((e,t)=>(e.key(t),e),bSe()).entries(i.source)},jB),n&&a.each(e=>{e.children&&(e=ox(e.data),i.add.push(e),i.source.push(e))}),SB(a,ix,ix)),i.source.root=a,i}}),MB=(e,t)=>e.parent===t.parent?1:2,U(wB,G,{transform(e,t){(!t.source||!t.source.root)&&V(this.constructor.name+` transform requires a backing tree data source.`);let n=this.layout(e.method),r=this.fields,i=t.source.root,a=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(ux(e.sort,e=>e.data)),xSe(n,this.params,e),n.separation&&n.separation(e.separation===!1?xh:MB);try{this.value=n(i)}catch(e){V(e)}return i.each(e=>SSe(e,r,a)),t.reflow(e.modified()).modifies(a).modifies(`leaf`)}}),NB=[`x`,`y`,`r`,`depth`,`children`],TB.Definition={type:`Pack`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`radius`,type:`field`,default:null},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:NB.length,default:NB}]},U(TB,wB,{layout:Xxe,params:[`radius`,`size`,`padding`],fields:NB}),PB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],EB.Definition={type:`Partition`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`padding`,type:`number`,default:0},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:PB.length,default:PB}]},U(EB,wB,{layout:Qxe,params:[`size`,`round`,`padding`],fields:PB}),DB.Definition={type:`Stratify`,metadata:{treesource:!0},params:[{name:`key`,type:`field`,required:!0},{name:`parentKey`,type:`field`,required:!0}]},U(DB,G,{transform(e,t){t.source||V(`Stratify transform requires an upstream data source.`);let n=this.value,r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),a=!n||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),a&&(n=i.source.length?SB(oB().id(e.key).parentId(e.parentKey)(i.source),e.key,Sh):SB(oB()([{}]),e.key,e.key)),i.source.root=this.value=n,i}}),FB={tidy:lSe,cluster:oxe},IB=[`x`,`y`,`depth`,`children`],OB.Definition={type:`Tree`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`tidy`,values:[`tidy`,`cluster`]},{name:`size`,type:`number`,array:!0,length:2},{name:`nodeSize`,type:`number`,array:!0,length:2},{name:`separation`,type:`boolean`,default:!0},{name:`as`,type:`string`,array:!0,length:IB.length,default:IB}]},U(OB,wB,{layout(e){let t=e||`tidy`;if(_g(FB,t))return FB[t]();V(`Unrecognized Tree layout method: `+t)},params:[`size`,`nodeSize`],fields:IB}),kB.Definition={type:`TreeLinks`,metadata:{tree:!0,generates:!0,changes:!0},params:[]},U(kB,G,{transform(e,t){let n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),a={};return r||V(`TreeLinks transform requires a tree data source.`),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,e=>a[ix(e)]=1),r.each(e=>{let t=e.data,n=e.parent&&e.parent.data;n&&a[ix(t)]&&a[ix(n)]&&i.add.push(ox({source:n,target:t}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,e=>a[ix(e)]=1),n.forEach(e=>{(a[ix(e.source)]||a[ix(e.target)])&&i.mod.push(e)})),i}}),LB={binary:pSe,dice:iB,slice:hB,slicedice:hSe,squarify:yB,resquarify:xB},RB=[`x0`,`y0`,`x1`,`y1`,`depth`,`children`],AB.Definition={type:`Treemap`,metadata:{tree:!0,modifies:!0},params:[{name:`field`,type:`field`},{name:`sort`,type:`compare`},{name:`method`,type:`enum`,default:`squarify`,values:[`squarify`,`resquarify`,`binary`,`dice`,`slice`,`slicedice`]},{name:`padding`,type:`number`,default:0},{name:`paddingInner`,type:`number`,default:0},{name:`paddingOuter`,type:`number`,default:0},{name:`paddingTop`,type:`number`,default:0},{name:`paddingRight`,type:`number`,default:0},{name:`paddingBottom`,type:`number`,default:0},{name:`paddingLeft`,type:`number`,default:0},{name:`ratio`,type:`number`,default:1.618033988749895},{name:`round`,type:`boolean`,default:!1},{name:`size`,type:`number`,array:!0,length:2},{name:`as`,type:`string`,array:!0,length:RB.length,default:RB}]},U(AB,wB,{layout(){let e=dSe();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{_g(LB,t)?e.tile(LB[t]):V(`Unrecognized Treemap layout method: `+t)},e},params:[`method`,`ratio`,`size`,`round`,`padding`,`paddingInner`,`paddingOuter`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`],fields:RB})})),wSe=c({label:()=>WB});function TSe(e,t){let n=e.bitmap();return(t||[]).forEach(t=>n.set(e(t.boundary[0]),e(t.boundary[3]))),[n,void 0]}function ESe(e,t,n,r,i){let a=e.width,o=e.height,s=r||i,c=MT(a,o).getContext(`2d`),l=MT(a,o).getContext(`2d`),u=s&&MT(a,o).getContext(`2d`);n.forEach(e=>BB(c,e,!1)),BB(l,t,!1),s&&BB(u,t,!0);let d=zB(c,a,o),f=zB(l,a,o),p=s&&zB(u,a,o),m=e.bitmap(),h=s&&e.bitmap(),g,_,v,y,b,x,S,C;for(_=0;_{t.items.forEach(t=>BB(e,t.items,n))}):FA[r].draw(e,{items:n?t.map(DSe):t})}function DSe(e){let t=cx(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:`#000`,fillOpacity:0}:t}function OSe(e,t){let n=new Uint32Array(~~((e*t+JB)/JB));function r(e,t){n[e]|=t}function i(e,t){n[e]&=t}return{array:n,get:(t,r)=>{let i=r*e+t;return n[i>>>KB]&1<<(i&qB)},set:(t,n)=>{let i=n*e+t;r(i>>>KB,1<<(i&qB))},clear:(t,n)=>{let r=n*e+t;i(r>>>KB,~(1<<(r&qB)))},getRange:(t,r,i,a)=>{let o=a,s,c,l,u;for(;o>=r;--o)if(s=o*e+t,c=o*e+i,l=s>>>KB,u=c>>>KB,l===u){if(n[l]&YB[s&qB]&XB[(c&qB)+1])return!0}else{if(n[l]&YB[s&qB]||n[u]&XB[(c&qB)+1])return!0;for(let e=l+1;e{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+i,c=o>>>KB,l=s>>>KB,c===l)r(c,YB[o&qB]&XB[(s&qB)+1]);else for(r(c,YB[o&qB]),r(l,XB[(s&qB)+1]),u=c+1;u{let o,s,c,l,u;for(;n<=a;++n)if(o=n*e+t,s=n*e+r,c=o>>>KB,l=s>>>KB,c===l)i(c,XB[o&qB]|YB[(s&qB)+1]);else for(i(c,XB[o&qB]),i(l,YB[(s&qB)+1]),u=c+1;un<0||r<0||a>=t||i>=e}}function kSe(e,t,n){let r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),a=~~((t+2*n+r)/r),o=e=>~~((e+n)/r);return o.invert=e=>e*r-n,o.bitmap=()=>OSe(i,a),o.ratio=r,o.padding=n,o.width=e,o.height=t,o}function ASe(e,t,n,r){let i=e.width,a=e.height;return function(e){let t=e.datum.datum.items[r].items,n=t.length,o=e.datum.fontSize,s=NA.width(e.datum,e.datum.text),c=0,l,u,d,f,p,m,h;for(let r=0;r=c&&(c=h,e.x=p,e.y=m);return p=s/2,m=o/2,l=e.x-p,u=e.x+p,d=e.y-m,f=e.y+m,e.align=`center`,l<0&&u<=i?e.align=`left`:0<=l&&ii||t-(o=r/2)<0||t+o>a}function HB(e,t,n,r,i,a,o,s){let c=i*a/(r*2),l=e(t-c),u=e(t+c),d=e(n-(a/=2)),f=e(n+a);return o.outOfBounds(l,d,u,f)||o.getRange(l,d,u,f)||s&&s.getRange(l,d,u,f)}function jSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1];function c(t,n,r,c,l){let u=e.invert(t),d=e.invert(n),f=r,p=a,m;if(!VB(u,d,c,l,i,a)&&!HB(e,u,d,l,c,f,o,s)&&!HB(e,u,d,l,c,l,o,null)){for(;p-f>=1;)m=(f+p)/2,HB(e,u,d,l,c,m,o,s)?p=m:f=m;if(f>r)return[u,d,f,!0]}}return function(t){let s=t.datum.datum.items[r].items,l=s.length,u=t.datum.fontSize,d=NA.width(t.datum,t.datum.text),f=n?u:0,p=!1,m=!1,h=0,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M;for(let r=0;r_&&(M=g,g=_,_=M),v>y&&(M=v,v=y,y=M),w=e(g),E=e(_),T=~~((w+E)/2),D=e(v),k=e(y),O=~~((D+k)/2),S=T;S>=w;--S)for(C=O;C>=D;--C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);for(S=T;S<=E;++S)for(C=O;C<=k;++C)j=c(S,C,f,d,u),j&&([t.x,t.y,f,p]=j);!p&&!n&&(A=Math.abs(_-g+y-v),b=(g+_)/2,x=(v+y)/2,A>=h&&!VB(b,x,d,u,i,a)&&!HB(e,b,x,u,d,u,o,null)&&(h=A,t.x=b,t.y=x,m=!0))}return p||m?(b=d/2,x=u/2,o.setRange(e(t.x-b),e(t.y-x),e(t.x+b),e(t.y+x)),t.align=`center`,t.baseline=`middle`,!0):!1}}function MSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=e.bitmap();return function(t){let l=t.datum.datum.items[r].items,u=l.length,d=t.datum.fontSize,f=NA.width(t.datum,t.datum.text),p=[],m=n?d:0,h=!1,g=!1,_=0,v,y,b,x,S,C,w,T,E,D,O,k;for(let r=0;r=1;)O=(E+D)/2,HB(e,S,C,d,f,O,o,s)?D=O:E=O;E>m&&(t.x=S,t.y=C,m=E,h=!0)}}!h&&!n&&(k=Math.abs(y-v+x-b),S=(v+y)/2,C=(b+x)/2,k>=_&&!VB(S,C,f,d,i,a)&&!HB(e,S,C,d,f,d,o,null)&&(_=k,t.x=S,t.y=C,g=!0))}return h||g?(S=f/2,C=d/2,o.setRange(e(t.x-S),e(t.y-C),e(t.x+S),e(t.y+C)),t.align=`center`,t.baseline=`middle`,!0):!1}}function NSe(e,t,n,r){let i=e.width,a=e.height,o=t[0],s=t[1],c=r.length;return function(t){let l=t.boundary,u=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>a)return!1;let d=t.textWidth??0,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;for(let i=0;i>>2&3)-1,m=f===0&&p===0||r[i]<0,h=f&&p?Math.SQRT1_2:1,g=r[i]<0?-1:1,_=l[1+f]+r[i]*f*h,S=l[4+p]+g*u*p/2+r[i]*p*h,y=S-u/2,b=S+u/2,C=e(_),T=e(y),E=e(b),!d)if(UB(C,C,T,E,o,s,_,_,y,b,l,m))d=NA.width(t.datum,t.datum.text);else continue;if(x=_+g*d*f/2,_=x-d/2,v=x+d/2,C=e(_),w=e(v),UB(C,w,T,E,o,s,_,v,y,b,l,m))return t.x=f?f*g<0?v:_:x,t.y=p?p*g<0?b:y:S,t.align=$B[f*g+1],t.baseline=eV[p*g+1],o.setRange(C,T,w,E),!0}return!1}}function UB(e,t,n,r,i,a,o,s,c,l,u,d){return!(i.outOfBounds(e,n,t,r)||(d&&a||i).getRange(e,n,t,r))}function PSe(e,t,n,r,i,a,o,s,c,l,u){if(!e.length)return e;let d=Math.max(r.length,i.length),f=FSe(r,d),p=ISe(i,d),m=LSe(e[0].datum),h=m===`group`&&e[0].datum.items[c].marktype,g=h===`area`,_=RSe(m,h,s,c),v=l===null||l===1/0,y=g&&u===`naive`,b=-1,x=-1,S=e.map(e=>{let t=v?NA.width(e,e.text):void 0;return b=Math.max(b,t),x=Math.max(x,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:_(e),textWidth:t}});l=l===null||l===1/0?Math.max(b,x)+Math.max(...r):l;let C=kSe(t[0],t[1],l),w;if(!y){n&&S.sort((e,t)=>n(e.datum,t.datum));let t=!1;for(let e=0;ee.datum);w=a.length||r?ESe(C,r||[],a,t,g):TSe(C,o&&S)}let T=g?nV[u](C,w,o,c):NSe(C,w,p,f);return S.forEach(e=>e.opacity=+T(e)),S}function FSe(e,t){let n=new Float64Array(t),r=e.length;for(let t=0;t[e.x,e.x,e.x,e.y,e.y,e.y];return e?e===`line`||e===`area`?e=>i(e.datum):t===`line`?e=>{let t=e.datum.items[r].items;return i(t.length?t[n===`start`?0:t.length-1]:{x:NaN,y:NaN})}:e=>{let t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:i}function WB(e){G.call(this,null,e)}var GB,KB,qB,JB,YB,XB,ZB,QB,$B,eV,tV,nV,rV,iV,zSe=o((()=>{Xj(),PT(),Qx(),Fg(),GB=4278190080,KB=5,qB=31,JB=32,YB=new Uint32Array(33),XB=new Uint32Array(33),XB[0]=0,YB[0]=~XB[0];for(let e=1;e<=JB;++e)XB[e]=XB[e-1]<<1|1,YB[e]=~XB[e];ZB=[-1,-1,1,1],QB=[-1,1,-1,1],$B=[`right`,`center`,`left`],eV=[`bottom`,`middle`,`top`],tV={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},nV={naive:ASe,"reduced-search":jSe,floodfill:MSe},rV=[`x`,`y`,`opacity`,`align`,`baseline`],iV=[`top-left`,`left`,`bottom-left`,`top`,`bottom`,`top-right`,`right`,`bottom-right`],WB.Definition={type:`Label`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2,required:!0},{name:`sort`,type:`compare`},{name:`anchor`,type:`string`,array:!0,default:iV},{name:`offset`,type:`number`,array:!0,default:[1]},{name:`padding`,type:`number`,default:0,null:!0},{name:`lineAnchor`,type:`string`,values:[`start`,`end`],default:`end`},{name:`markIndex`,type:`number`,default:0},{name:`avoidBaseMark`,type:`boolean`,default:!0},{name:`avoidMarks`,type:`data`,array:!0},{name:`method`,type:`string`,default:`naive`},{name:`as`,type:`string`,array:!0,length:rV.length,default:rV}]},U(WB,G,{transform(e,t){function n(n){let r=e[n];return ag(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||n(`sort`)))return;(!e.size||e.size.length!==2)&&V(`Size parameter should be specified as a [width, height] array.`);let i=e.as||rV;return PSe(t.materialize(t.SOURCE).source||[],e.size,e.sort,ng(e.offset==null?1:e.offset),ng(e.anchor||iV),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||`end`,e.markIndex||0,e.padding===void 0?0:e.padding,e.method||`naive`).forEach(e=>{let t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline}),t.reflow(r).modifies(i)}})})),BSe=c({loess:()=>oV,regression:()=>sV});function aV(e,t){var n=[],r=function(e){return e(s)},i,a,o,s,c,l;if(t==null)n.push(e);else for(i={},a=0,o=e.length;a{US(),Qx(),Fg(),oV.Definition={type:`Loess`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`bandwidth`,type:`number`,default:.3},{name:`as`,type:`string`,array:!0}]},U(oV,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=aV(r,e.groupby),a=(e.groupby||[]).map(oh),o=a.length,s=e.as||[oh(e.x),oh(e.y)],c=[];i.forEach(t=>{PS(t,e.x,e.y,e.bandwidth||.3).forEach(e=>{let n={};for(let e=0;ee===`poly`?t:e===`quad`?2:1,sV.Definition={type:`Regression`,metadata:{generates:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`groupby`,type:`field`,array:!0},{name:`method`,type:`string`,default:`linear`,values:Object.keys(cV)},{name:`order`,type:`number`,default:3},{name:`extent`,type:`number`,array:!0,length:2},{name:`params`,type:`boolean`,default:!1},{name:`as`,type:`string`,array:!0}]},U(sV,G,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let r=t.materialize(t.SOURCE).source,i=aV(r,e.groupby),a=(e.groupby||[]).map(oh),o=e.method||`linear`,s=e.order==null?3:e.order,c=lV(o,s),l=e.as||[oh(e.x),oh(e.y)],u=cV[o],d=[],f=e.extent;_g(cV,o)||V(`Invalid regression method: `+o),f!=null&&o===`log`&&f[0]<=0&&(t.dataflow.warn(`Ignoring extent with values <= 0 for log regression.`),f=null),i.forEach(n=>{if(n.length<=c){t.dataflow.warn(`Skipping regression with more parameters than data points.`);return}let r=u(n,e.x,e.y,s);if(e.params){d.push(ox({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));return}let i=f||gg(n,e.x),p=e=>{let t={};for(let e=0;ep([e,r.predict(e)])):FS(r.predict,i,25,200).forEach(p)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=d}return n}})}));function uV(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(dl==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);dl==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d{dV=11102230246251565e-32,fV=134217729,pV=3.000000000000001*dV}));function USe(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e-i,E=n-i,D=t-a,O=r-a;b=T*O,f=fV*T,p=f-(f-T),m=T-p,f=fV*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=D*E,f=fV*D,p=f-(f-D),m=D-p,f=fV*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,yV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,yV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,yV[2]=v-(w-d)+(_-d),yV[3]=w;let k=HSe(4,yV),A=_V*o;if(k>=A||-k>=A||(d=e-T,s=e-(T+d)+(d-i),d=n-E,l=n-(E+d)+(d-i),d=t-D,c=t-(D+d)+(d-a),d=r-O,u=r-(O+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(A=vV*o+pV*Math.abs(k),k+=T*u+O*s-(D*l+E*c),k>=A||-k>=A))return k;b=s*O,f=fV*s,p=f-(f-s),m=s-p,f=fV*O,h=f-(f-O),g=O-h,x=m*g-(b-p*h-m*h-p*g),S=c*E,f=fV*c,p=f-(f-c),m=c-p,f=fV*E,h=f-(f-E),g=E-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,CV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,CV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,CV[2]=v-(w-d)+(_-d),CV[3]=w;let j=uV(4,yV,4,CV,bV);b=T*u,f=fV*T,p=f-(f-T),m=T-p,f=fV*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=D*l,f=fV*D,p=f-(f-D),m=D-p,f=fV*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,CV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,CV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,CV[2]=v-(w-d)+(_-d),CV[3]=w;let M=uV(j,bV,4,CV,xV);b=s*u,f=fV*s,p=f-(f-s),m=s-p,f=fV*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=fV*c,p=f-(f-c),m=c-p,f=fV*l,h=f-(f-l),g=l-h,C=m*g-(S-p*h-m*h-p*g),_=x-C,d=x-_,CV[0]=x-(_+d)+(d-C),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,CV[1]=y-(_+d)+(d-S),w=v+_,d=w-v,CV[2]=v-(w-d)+(_-d),CV[3]=w;let ee=uV(M,xV,4,CV,SV);return SV[ee-1]}function hV(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=gV*l?c:-USe(e,t,n,r,i,a,l)}var gV,_V,vV,yV,bV,xV,SV,CV,WSe=o((()=>{mV(),gV=(3+16*dV)*dV,_V=(2+12*dV)*dV,vV=(9+64*dV)*dV*dV,yV=K(4),bV=K(8),xV=K(12),SV=K(16),CV=K(4)})),GSe=o((()=>{mV(),(7+56*dV)*dV,(3+28*dV)*dV,(26+288*dV)*dV*dV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(8),K(8),K(8),K(4),K(8),K(8),K(16),K(12),K(192),K(192)})),KSe=o((()=>{mV(),(10+96*dV)*dV,(4+48*dV)*dV,(44+576*dV)*dV*dV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(8),K(4),K(4),K(4),K(8),K(16),K(16),K(16),K(32),K(32),K(48),K(64),K(1152),K(1152)})),qSe=o((()=>{mV(),(16+224*dV)*dV,(5+72*dV)*dV,(71+1408*dV)*dV*dV,K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(4),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(24),K(1152),K(1152),K(1152),K(1152),K(1152),K(2304),K(2304),K(3456),K(5760),K(8),K(8),K(8),K(16),K(24),K(48),K(48),K(96),K(192),K(384),K(384),K(384),K(768),K(96),K(96),K(96),K(1152)})),JSe=o((()=>{WSe(),GSe(),KSe(),qSe()}));function YSe(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function wV(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function XSe(e,t,n,r,i,a,o,s){let c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,p=a-s,m=c*c+l*l,h=u*u+d*d,g=f*f+p*p;return c*(d*g-h*p)-l*(u*g-h*f)+m*(u*p-d*f)<0}function ZSe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),p=(l*u-s*d)*f,m=(o*d-c*u)*f;return p*p+m*m}function QSe(e,t,n,r,i,a){let o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c);return{x:e+(l*u-s*d)*f,y:t+(o*d-c*u)*f}}function TV(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let r=e[i],a=t[r],o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+r>>1,a=n+1,o=r;EV(e,i,a),t[e[n]]>t[e[r]]&&EV(e,n,r),t[e[a]]>t[e[r]]&&EV(e,a,r),t[e[n]]>t[e[a]]&&EV(e,n,a);let s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]c);if(o=o-n?(TV(e,t,a,r),TV(e,t,n,o-1)):(TV(e,t,n,o-1),TV(e,t,a,r))}}function EV(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function $Se(e){return e[0]}function eCe(e){return e[1]}var DV,OV,kV,tCe=o((()=>{JSe(),DV=2**-52,OV=new Uint32Array(512),kV=class e{static from(t,n=$Se,r=eCe){let i=t.length,a=new Float64Array(i*2);for(let e=0;e>1;if(t>0&&typeof e[0]!=`number`)throw Error(`Expected coords to contain numbers.`);this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1,o=1/0,s=1/0,c=-1/0,l=-1/0;for(let t=0;tc&&(c=n),r>l&&(l=r),this._ids[t]=t}let u=(o+c)/2,d=(s+l)/2,f=0,p=0,m=0;for(let t=0,n=1/0;t0&&(p=t,n=r)}let _=e[2*p],v=e[2*p+1],y=1/0;for(let t=0;tr&&(t[n++]=i,r=a)}this.hull=t.subarray(0,n),this.triangles=new Uint32Array,this.halfedges=new Int32Array;return}if(hV(h,g,_,v,b,x)<0){let e=p,t=_,n=v;p=m,_=b,v=x,m=e,b=t,x=n}let S=QSe(h,g,_,v,b,x);this._cx=S.x,this._cy=S.y;for(let t=0;t0&&Math.abs(l-o)<=DV&&Math.abs(u-s)<=DV||(o=l,s=u,c===f||c===p||c===m))continue;let d=0;for(let e=0,t=this._hashKey(l,u);e=0;)if(h=g,h===d){h=-1;break}if(h===-1)continue;let _=this._addTriangle(h,c,n[h],-1,-1,r[h]);r[c]=this._legalize(_+2),r[h]=_,C++;let v=n[h];for(;g=n[v],hV(l,u,e[2*v],e[2*v+1],e[2*g],e[2*g+1])<0;)_=this._addTriangle(v,c,g,r[c],-1,r[v]),r[c]=this._legalize(_+2),n[v]=v,C--,v=g;if(h===d)for(;g=t[h],hV(l,u,e[2*g],e[2*g+1],e[2*h],e[2*h+1])<0;)_=this._addTriangle(g,c,h,-1,r[h],r[g]),this._legalize(_+2),r[g]=_,n[h]=h,C--,h=g;this._hullStart=t[c]=h,n[h]=t[v]=c,n[c]=v,i[this._hashKey(l,u)]=c,i[this._hashKey(e[2*h],e[2*h+1])]=h}this.hull=new Uint32Array(C);for(let e=0,t=this._hullStart;e{AV=1e-6,jV=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=``}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,i=t;if(n<0)throw Error(`negative radius`);this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>AV||Math.abs(this._y1-i)>AV)&&(this._+=`L`+r+`,`+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}})),NV,PV=o((()=>{NV=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}})),FV,IV=o((()=>{MV(),PV(),FV=class{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((i=+i)>=(n=+n)))throw Error(`invalid bounds`);this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i,a,o=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r=0,s=0,c=n.length,l,u;r1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t1e-10)return!1}return!0}function aCe(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}function oCe(e,t,n,r){let i=e.length,a=new Float64Array(i*2);for(let o=0;o{tCe(),MV(),PV(),IV(),LV=2*Math.PI,RV=Math.pow,zV=class e{static from(t,n=nCe,r=rCe,i){return new e(`length`in t?oCe(t,n,r,i):Float64Array.from(sCe(t,n,r,i)))}constructor(e){this._delaunator=new kV(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&iCe(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);let e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new FV(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){let t=o.indexOf(e);t>0&&(yield o[t-1]),t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){let{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let l=e,u=RV(t-c[e*2],2)+RV(n-c[e*2+1],2),d=r[e],f=d;do{let r=s[f],d=RV(t-c[r*2],2)+RV(n-c[r*2+1],2);if(d{cCe(),IV()})),uCe=c({voronoi:()=>BV});function BV(e){G.call(this,null,e)}function dCe(e){let t=e[0][0],n=e[0][1],r=e.length-1;for(;e[r][0]===t&&e[r][1]===n;--r);return`M`+e.slice(0,r+1).join(`L`)+`Z`}function fCe(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}var VV,pCe=o((()=>{Qx(),Fg(),lCe(),BV.Definition={type:`Voronoi`,metadata:{modifies:!0},params:[{name:`x`,type:`field`,required:!0},{name:`y`,type:`field`,required:!0},{name:`size`,type:`number`,array:!0,length:2},{name:`extent`,type:`array`,array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:`number`,array:!0,length:2}},{name:`as`,type:`string`,default:`path`}]},VV=[-1e5,-1e5,1e5,1e5],U(BV,G,{transform(e,t){let n=e.as||`path`,r=t.source;if(!r||!r.length)return t;let i=e.size;i=i?[0,0,i[0],i[1]]:(i=e.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:VV;let a=this.value=zV.from(r,e.x,e.y).voronoi(i);for(let e=0,t=r.length;eWV});function hCe(){var e=[256,256],t,n,r,i,a,o,s,c=HV,l=[],u=Math.random,d={};d.layout=function(){for(var c=f(MT()),d=xCe((e[0]>>5)*e[1]),m=null,h=l.length,g=-1,_=[],v=l.map(e=>({text:t(e),font:n(e),style:i(e),weight:a(e),rotate:o(e),size:~~(r(e)+1e-14),padding:s(e),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:e})).sort((e,t)=>t.size-e.size);++g>1,y.y=e[1]*(u()+.5)>>1,gCe(c,y,v,g),y.hasText&&p(d,y,m)&&(_.push(y),m?vCe(m,y):m=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=e[0]>>1,y.y-=e[1]>>1)}return _};function f(e){e.width=e.height=1;var t=Math.sqrt(e.getContext(`2d`).getImageData(0,0,1,1).data.length>>2);e.width=(KV<<5)/t,e.height=qV/t;var n=e.getContext(`2d`);return n.fillStyle=n.strokeStyle=`red`,n.textAlign=`center`,{context:n,ratio:t}}function p(t,n,r){for(var i=n.x,a=n.y,o=Math.hypot(e[0],e[1]),s=c(e),l=u()<.5?1:-1,d=-l,f,p,m;(f=s(d+=l))&&(p=~~f[0],m=~~f[1],!(Math.min(Math.abs(p),Math.abs(m))>=o));)if(n.x=i+p,n.y=a+m,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>e[0]||n.y+n.y1>e[1])&&(!r||!_Ce(n,t,e[0]))&&(!r||yCe(n,r))){for(var h=n.sprite,g=n.width>>5,_=e[0]>>5,v=n.x-(g<<4),y=v&127,b=32-y,x=n.y1-n.y0,S=(n.y+n.y0)*_+(v>>5),C,w=0;w>>y:0);S+=_}return n.sprite=null,!0}return!1}return d.words=function(e){return arguments.length?(l=e,d):l},d.size=function(t){return arguments.length?(e=[+t[0],+t[1]],d):e},d.font=function(e){return arguments.length?(n=UV(e),d):n},d.fontStyle=function(e){return arguments.length?(i=UV(e),d):i},d.fontWeight=function(e){return arguments.length?(a=UV(e),d):a},d.rotate=function(e){return arguments.length?(o=UV(e),d):o},d.text=function(e){return arguments.length?(t=UV(e),d):t},d.spiral=function(e){return arguments.length?(c=JV[e]||e,d):c},d.fontSize=function(e){return arguments.length?(r=UV(e),d):r},d.padding=function(e){return arguments.length?(s=UV(e),d):s},d.random=function(e){return arguments.length?(u=e,d):u},d}function gCe(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,(KV<<5)/a,qV/a);var o=0,s=0,c=0,l=n.length,u,d,f,p,m;for(--r;++r>5<<5,f=~~Math.max(Math.abs(v+y),Math.abs(v-y))}else u=u+31>>5<<5;if(f>c&&(c=f),o+u>=KV<<5&&(o=0,s+=c,c=0),s+f>=qV)break;i.translate((o+(u>>1))/a,(s+(f>>1))/a),t.rotate&&i.rotate(t.rotate*GV),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=u,t.height=f,t.xoff=o,t.yoff=s,t.x1=u>>1,t.y1=f>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=u}for(var x=i.getImageData(0,0,(KV<<5)/a,qV/a).data,S=[];--r>=0;)if(t=n[r],t.hasText){for(u=t.width,d=u>>5,f=t.y1-t.y0,p=0;p>5),E=x[(s+m)*(KV<<5)+(o+p)<<2]?1<<31-p%32:0;S[T]|=E,C|=E}C?w=m:(t.y0++,f--,m--,s++)}t.y1=t.y0+w,t.sprite=S.slice(0,(t.y1-t.y0)*d)}}}function _Ce(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,a=e.x-(i<<4),o=a&127,s=32-o,c=e.y1-e.y0,l=(e.y+e.y0)*n+(a>>5),u,d=0;d>>o:0))&t[l+f])return!0;l+=n}return!1}function vCe(e,t){var n=e[0],r=e[1];t.x+t.x0r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function yCe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0{PT(),Qx(),Fg(),MO(),US(),GV=Math.PI/180,KV=64,qV=2048,JV={archimedean:HV,rectangular:bCe},YV=[`x`,`y`,`font`,`fontSize`,`fontStyle`,`fontWeight`,`angle`],XV=[`text`,`font`,`rotate`,`fontSize`,`fontStyle`,`fontWeight`],WV.Definition={type:`Wordcloud`,metadata:{modifies:!0},params:[{name:`size`,type:`number`,array:!0,length:2},{name:`font`,type:`string`,expr:!0,default:`sans-serif`},{name:`fontStyle`,type:`string`,expr:!0,default:`normal`},{name:`fontWeight`,type:`string`,expr:!0,default:`normal`},{name:`fontSize`,type:`number`,expr:!0,default:14},{name:`fontSizeRange`,type:`number`,array:`nullable`,default:[10,50]},{name:`rotate`,type:`number`,expr:!0,default:0},{name:`text`,type:`field`},{name:`spiral`,type:`string`,values:[`archimedean`,`rectangular`]},{name:`padding`,type:`number`,expr:!0},{name:`as`,type:`string`,array:!0,length:7,default:YV}]},U(WV,G,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&V(`Wordcloud size dimensions must be non-zero.`);function n(n){let r=e[n];return ag(r)&&t.modified(r.fields)}let r=e.modified();if(!(r||t.changed(t.ADD_REM)||XV.some(n)))return;let i=t.materialize(t.SOURCE).source,a=this.value,o=e.as||YV,s=e.fontSize||14,c;if(ag(s)?c=e.fontSizeRange:s=pg(s),c){let e=s,t=tO(`sqrt`)().domain(gg(i,e)).range(c);s=n=>t(e(n))}i.forEach(e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0});let l=a.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||`archimedean`).rotate(e.rotate||0).font(e.font||`sans-serif`).fontStyle(e.fontStyle||`normal`).fontWeight(e.fontWeight||`normal`).fontSize(s).random(IS).layout(),u=a.size(),d=u[0]>>1,f=u[1]>>1,p=l.length;for(let e=0,t,n;eeH,resolvefilter:()=>tH});function wCe(){let e=8,t=[],n=iH(0),r=ZV(0,e),i=ZV(0,e);return{data:()=>t,seen:()=>n=TCe(n,t.length),add(e){for(let n=0,r=t.length,i=e.length,a;nt.length,curr:()=>r,prev:()=>i,reset:e=>i[e]=r[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){r[e]|=t},clear(e,t){r[e]&=~t},resize(t,n){(t>r.length||n>e)&&(e=Math.max(n,e),r=ZV(t,e,r),i=ZV(t,e))}}}function TCe(e,t,n){return e.length>=t?e:(n||=new e.constructor(t),n.set(e),n)}function ZV(e,t,n){let r=(t<257?nH:t<65537?rH:iH)(e);return n&&r.set(n),r}function QV(e,t,n){let r=1<0)for(f=0;fe,size:()=>n}}function ECe(e,t){return e.sort.call(t,(t,n)=>{let r=e[t],i=e[n];return ri)}),Qae(e,t)}function DCe(e,t,n,r,i,a,o,s,c){let l=0,u=0,d;for(d=0;l{c_(),Qx(),Fg(),nH=e=>new Uint8Array(e),rH=e=>new Uint16Array(e),iH=e=>new Uint32Array(e),eH.Definition={type:`CrossFilter`,metadata:{},params:[{name:`fields`,type:`field`,array:!0,required:!0},{name:`query`,type:`array`,array:!0,required:!0,content:{type:`number`,array:!0,length:2}}]},U(eH,G,{transform(e,t){return this._dims?e.modified(`fields`)||e.fields.some(e=>t.modified(e.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,r=e.query,i=this._indices={},a=this._dims=[],o=r.length,s=0,c,l;for(;s{let e=i.remove(t,n);for(let t in r)r[t].reindex(e)})},update(e,t,n){let r=this._dims,i=e.query,a=t.stamp,o=r.length,s=0,c,l;for(n.filters=0,l=0;lp)for(g=p,_=Math.min(d,m);g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;if(f>m)for(g=Math.max(d,m),_=f;g<_;++g)v=c[g],a[v]!==n&&(s[v]=o[v],a[v]=n,r.push(v)),o[v]^=h;else if(fu)for(p=u,m=Math.min(c,d);pd)for(p=Math.max(c,d),m=l;ps[e]&n?null:o[e];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,e=>{let t=s[e]&n;return!t&&t^c[e]&n?o[e]:null}),a.filter(a.REM,e=>{let t=s[e]&n;return t&&!(t^(t^c[e]&n))?o[e]:null})):(a.filter(a.ADD,l),a.filter(a.REM,e=>(s[e]&n)===i?o[e]:null)),a.filter(a.SOURCE,e=>l(e._index))}})}));function aH(e){this.type=e}function kCe(e){switch(e.type){case WH:return e.elements;case GH:case JH:return[e.left,e.right];case KH:return[e.callee].concat(e.arguments);case qH:return[e.test,e.consequent,e.alternate];case YH:return[e.object,e.property];case XH:return e.properties;case HH:return[e.key,e.value];case ZH:return[e.argument];case UH:case VH:case BH:default:return[]}}function oH(e,t){if(!e)throw Error(`ASSERT: `+t)}function sH(e){return e>=48&&e<=57}function cH(e){return`0123456789abcdefABCDEF`.includes(e)}function lH(e){return`01234567`.includes(e)}function ACe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function uH(e){return e===10||e===13||e===8232||e===8233}function dH(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&PU.test(String.fromCharCode(e))}function fH(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&FU.test(String.fromCharCode(e))}function pH(){for(;q1114111||e!==`}`)&&EH({},SU,MU),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function hH(){var e=$H.charCodeAt(q++),t=String.fromCharCode(e);for(e===92&&($H.charCodeAt(q)!==117&&EH({},SU,MU),++q,e=mH(`u`),(!e||e===`\\`||!dH(e.charCodeAt(0)))&&EH({},SU,MU),t=e);q>>=`)return q+=4,{type:cU,value:o,start:e,end:q};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return q+=3,{type:cU,value:a,start:e,end:q};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return q+=2,{type:cU,value:i,start:e,end:q};if(i===`//`&&EH({},SU,MU),`<>=!+-*%&|^/`.includes(r))return++q,{type:cU,value:r,start:e,end:q};EH({},SU,MU)}function PCe(e){let t=``;for(;q{if(parseInt(t,16)<=1114111)return`x`;EH({},OU)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{EH({},OU)}try{return new RegExp(e,t)}catch{return null}}function RCe(){var e=$H[q],t,n,r,i;for(oH(e===`/`,`Regular expression literal must start with a slash`),t=$H[q++],n=!1,r=!1;q=0&&EH({},OU,n),{value:n,literal:t}}function BCe(){var e,t,n,r;return tU=null,pH(),e=q,t=RCe(),n=zCe(),r=LCe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:q}}function VCe(e){return e.type===iU||e.type===aU||e.type===nU||e.type===oU}function vH(){if(pH(),q>=eU)return{type:rU,start:q,end:q};let e=$H.charCodeAt(q);return dH(e)?NCe():e===40||e===41||e===59?gH():e===39||e===34?ICe():e===46?sH($H.charCodeAt(q+1))?_H():gH():sH(e)?_H():gH()}function yH(){let e=tU;return q=e.end,tU=vH(),q=e.end,e}function bH(){let e=q;tU=vH(),q=e}function HCe(e){let t=new aH(dU);return t.elements=e,t}function xH(e,t,n){let r=new aH(e===`||`||e===`&&`?_U:fU);return r.operator=e,r.left=t,r.right=n,r}function UCe(e,t){let n=new aH(pU);return n.callee=e,n.arguments=t,n}function WCe(e,t,n){let r=new aH(mU);return r.test=e,r.consequent=t,r.alternate=n,r}function SH(e){let t=new aH(hU);return t.name=e,t}function CH(e){let t=new aH(gU);return t.value=e.value,t.raw=$H.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function wH(e,t,n){let r=new aH(vU);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function GCe(e){let t=new aH(yU);return t.properties=e,t}function TH(e,t,n){let r=new aH(bU);return r.key=t,r.value=n,r.kind=e,r}function KCe(e,t){let n=new aH(xU);return n.operator=e,n.argument=t,n.prefix=!0,n}function EH(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(oH(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function rwe(){var e=tU,t,n,r,i,a,o,s,c=NH(),l;if(r=tU,i=PH(r),i===0)return c;for(r.prec=i,yH(),t=[e,tU],o=NH(),a=[c,r,o];(i=PH(tU))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=xH(s,c,o),a.push(n);r=yH(),r.prec=i,a.push(r),t.push(tU),n=NH(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=xH(a[l-1].value,a[l-2],n),l-=2;return n}function FH(){var e=rwe(),t,n;return kH(`?`)&&(yH(),t=FH(),OH(`:`),n=FH(),e=WCe(e,t,n)),e}function IH(){let e=FH();if(kH(`,`))throw Error(NU);return e}function LH(e){$H=e,q=0,eU=$H.length,tU=null,bH();let t=IH();if(tU.type!==rU)throw Error(`Unexpect token after expression.`);return t}function RH(e){function t(t,n,r,i){let a=e(n[0]);return r&&(a=r+`(`+a+`)`,r.lastIndexOf(`new `,0)===0&&(a=`(`+a+`)`)),a+`.`+t+(i<0?``:i===0?`()`:`(`+n.slice(1).map(e).join(`,`)+`)`)}function n(e,n,r){return i=>t(e,i,n,r)}let r=`new Date`,i=`String`,a=`RegExp`;return{isNaN:`Number.isNaN`,isFinite:`Number.isFinite`,abs:`Math.abs`,acos:`Math.acos`,asin:`Math.asin`,atan:`Math.atan`,atan2:`Math.atan2`,ceil:`Math.ceil`,cos:`Math.cos`,exp:`Math.exp`,floor:`Math.floor`,hypot:`Math.hypot`,log:`Math.log`,max:`Math.max`,min:`Math.min`,pow:`Math.pow`,random:`Math.random`,round:`Math.round`,sin:`Math.sin`,sqrt:`Math.sqrt`,tan:`Math.tan`,clamp:function(t){t.length<3&&V(`Missing arguments to clamp function.`),t.length>3&&V(`Too many arguments to clamp function.`);let n=t.map(e);return`Math.max(`+n[1]+`, Math.min(`+n[2]+`,`+n[0]+`))`},now:`Date.now`,utc:`Date.UTC`,datetime:r,date:n(`getDate`,r,0),day:n(`getDay`,r,0),year:n(`getFullYear`,r,0),month:n(`getMonth`,r,0),hours:n(`getHours`,r,0),minutes:n(`getMinutes`,r,0),seconds:n(`getSeconds`,r,0),milliseconds:n(`getMilliseconds`,r,0),time:n(`getTime`,r,0),timezoneoffset:n(`getTimezoneOffset`,r,0),utcdate:n(`getUTCDate`,r,0),utcday:n(`getUTCDay`,r,0),utcyear:n(`getUTCFullYear`,r,0),utcmonth:n(`getUTCMonth`,r,0),utchours:n(`getUTCHours`,r,0),utcminutes:n(`getUTCMinutes`,r,0),utcseconds:n(`getUTCSeconds`,r,0),utcmilliseconds:n(`getUTCMilliseconds`,r,0),length:n(`length`,null,-1),parseFloat:`parseFloat`,parseInt:`parseInt`,upper:n(`toUpperCase`,i,0),lower:n(`toLowerCase`,i,0),substring:n(`substring`,i),split:n(`split`,i),trim:n(`trim`,i,0),btoa:`btoa`,atob:`atob`,encodeURIComponent:`encodeURIComponent`,regexp:a,test:n(`test`,a),if:function(t){t.length<3&&V(`Missing arguments to if function.`),t.length>3&&V(`Too many arguments to if function.`);let n=t.map(e);return`(`+n[0]+`?`+n[1]+`:`+n[2]+`)`}}}function iwe(e){let t=e&&e.length-1;return t&&(e[0]===`"`&&e[t]===`"`||e[0]===`'`&&e[t]===`'`)?e.slice(1,-1):e}function zH(e){e||={};let t=e.allowed?Ng(e.allowed):{},n=e.forbidden?Ng(e.forbidden):{},r=e.constants||RU,i=(e.functions||RH)(d),a=e.globalvar,o=e.fieldvar,s=ag(a)?a:e=>`${a}["${e}"]`,c={},l={},u=0;function d(e){if(Eg(e))return e;let t=f[e.type];return t??V(`Unsupported type: `+e.type),t(e)}let f={Literal:e=>e.raw,Identifier:e=>{let i=e.name;return u>0?i:_g(n,i)?V(`Illegal identifier: `+i):_g(r,i)?r[i]:_g(t,i)?i:(c[i]=1,s(i))},MemberExpression:e=>{let t=!e.computed,n=d(e.object);t&&(u+=1);let r=d(e.property);return n===o&&(l[iwe(r)]=1),t&&--u,n+(t?`.`+r:`[`+r+`]`)},CallExpression:e=>{e.callee.type!==`Identifier`&&V(`Illegal callee type: `+e.callee.type);let t=e.callee.name,n=e.arguments,r=_g(i,t)&&i[t];return r||V(`Unrecognized function: `+t),ag(r)?r(n):r+`(`+n.map(d).join(`,`)+`)`},ArrayExpression:e=>`[`+e.elements.map(d).join(`,`)+`]`,BinaryExpression:e=>`(`+d(e.left)+` `+e.operator+` `+d(e.right)+`)`,UnaryExpression:e=>`(`+e.operator+d(e.argument)+`)`,ConditionalExpression:e=>`(`+d(e.test)+`?`+d(e.consequent)+`:`+d(e.alternate)+`)`,LogicalExpression:e=>`(`+d(e.left)+e.operator+d(e.right)+`)`,ObjectExpression:e=>{for(let t of e.properties){let e=t.key.name;wh.has(e)&&V(`Illegal property: `+e)}return`{`+e.properties.map(d).join(`,`)+`}`},Property:e=>{u+=1;let t=d(e.key);return--u,t+`:`+d(e.value)}};function p(e){let t={code:d(e),globals:Object.keys(c),fields:Object.keys(l)};return c={},l={},t}return p.functions=i,p.constants=r,p}var BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,q,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU=o((()=>{Fg(),BH=`RawCode`,VH=`Literal`,HH=`Property`,UH=`Identifier`,WH=`ArrayExpression`,GH=`BinaryExpression`,KH=`CallExpression`,qH=`ConditionalExpression`,JH=`LogicalExpression`,YH=`MemberExpression`,XH=`ObjectExpression`,ZH=`UnaryExpression`,aH.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=kCe(this),n=0,r=t.length;n`,QH[iU]=`Identifier`,QH[aU]=`Keyword`,QH[oU]=`Null`,QH[sU]=`Numeric`,QH[cU]=`Punctuator`,QH[lU]=`String`,QH[uU]=`RegularExpression`,dU=`ArrayExpression`,fU=`BinaryExpression`,pU=`CallExpression`,mU=`ConditionalExpression`,hU=`Identifier`,gU=`Literal`,_U=`LogicalExpression`,vU=`MemberExpression`,yU=`ObjectExpression`,bU=`Property`,xU=`UnaryExpression`,SU=`Unexpected token %0`,CU=`Unexpected number`,wU=`Unexpected string`,TU=`Unexpected identifier`,EU=`Unexpected reserved word`,DU=`Unexpected end of input`,OU=`Invalid regular expression`,kU=`Invalid regular expression: missing /`,AU=`Octal literals are not allowed in strict mode.`,jU=`Duplicate data property in object literal not allowed in strict mode`,MU=`ILLEGAL`,NU=`Disabled.`,PU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),FU=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),IU={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},LU={if:1},RU={NaN:`NaN`,E:`Math.E`,LN2:`Math.LN2`,LN10:`Math.LN10`,LOG2E:`Math.LOG2E`,LOG10E:`Math.LOG10E`,PI:`Math.PI`,SQRT1_2:`Math.SQRT1_2`,SQRT2:`Math.SQRT2`,MIN_VALUE:`Number.MIN_VALUE`,MAX_VALUE:`Number.MAX_VALUE`}}));function BU(e){return(!e.getter||!e.getter[UU])&&(e.getter=gh(e.field),e.getter[UU]=!0),e.getter}function VU(e,t){for(var n=t.fields,r=t.values,i=n.length,a=0,o,s;a=r[a])return!1}else if(s.type===iW){if(o>r[a])return!1}else if(s.type===aW){if(o<=r[a])return!1}else if(s.type===oW){if(ohg(t.fields?{values:t.fields.map(t=>BU(t)(e.datum))}:{[XU]:ZU(e.datum)},t))}function cwe(e,t,n,r){for(var i=this.context.data[e],a=i?i.values.value:[],o={},s={},c={},l,u,d,f,p,m,h,g,_,v,y=a.length,b=0,x,S;b(e[u[n].field]=t,e),{})))}else p=XU,m=ZU(l),h=o[p]||(o[p]={}),g=h[f]||(h[f]=[]),g.push(m),n&&(g=s[f]||(s[f]=[]),g.push({[XU]:m}));if(t||=GU,o[XU]?o[XU]=pW[`${XU}_${t}`](...Object.values(o[XU])):Object.keys(o).forEach(e=>{o[e]=Object.keys(o[e]).map(t=>o[e][t]).reduce((n,r)=>n===void 0?r:pW[`${c[e]}_${t}`](n,r))}),a=Object.keys(s),n&&a.length){let e=r?qU:KU;o[e]=t===GU?{[JU]:a.reduce((e,t)=>(e.push(...s[t]),e),[])}:{[YU]:a.map(e=>({[JU]:s[e]}))}}return o}function HU(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to selection functions must be a string literal.`);let i=t[0].value,a=t.length>=2&&Mh(t).value,o=`@unit`,s=mW+i;a===WU&&!_g(r,o)&&(r[o]=n.getData(i).indataRef(n,`unit`)),_g(r,s)||(r[s]=n.getData(i).tuplesRef())}var UU,WU,GU,KU,qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW,aW,oW,sW,cW,lW,uW,dW,fW,pW,mW,lwe=o((()=>{c_(),Fg(),zU(),UU=Symbol(`vega_selection_getter`),WU=`intersect`,GU=`union`,KU=`vlMulti`,qU=`vlPoint`,JU=`or`,YU=`and`,XU=`_vgsid_`,ZU=gh(XU),QU=`E`,$U=`R`,eW=`R-E`,tW=`R-LE`,nW=`R-RE`,rW=`E-LT`,iW=`E-LTE`,aW=`E-GT`,oW=`E-GTE`,sW=`E-VALID`,cW=`E-ONE`,lW=`index:unit`,uW=Wg(ZU),dW=uW.left,fW=uW.right,pW={[`${XU}_union`]:Eoe,[`${XU}_intersect`]:Coe,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;nt.includes(e)):t},R_union:function(e,t){var n=Ph(t[0]),r=Ph(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]r&&(n=t[1],r=t[0]),e.length?rr&&(e[1]=r),e):[n,r]}},mW=`:`}));function hW(e){let t=this.context.data[e];return t?t.values.value:[]}function uwe(e,t,n){let r=this.context.data[e][`index:`+t],i=r?r.value.get(n):void 0;return i&&i.count}function dwe(e,t){let n=this.context.dataflow,r=this.context.data[e].input;return n.pulse(r,n.changeset().remove(Sh).insert(t)),1}function fwe(e,t,n){if(e){let n=this.context.dataflow,r=e.mark.source;n.pulse(r,n.changeset().encode(e,t))}return n===void 0?e:n}function gW(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?``:(BW.setYear(2e3),BW.setMonth(e),BW.setDate(t),IW.call(this,BW,n))}function pwe(e){return gW.call(this,e,1,`%B`)}function mwe(e){return gW.call(this,e,1,`%b`)}function hwe(e){return gW.call(this,0,2+e,`%A`)}function gwe(e){return gW.call(this,0,2+e,`%a`)}function _W(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to data functions must be a string literal.`);let i=t[0].value,a=`:`+i;if(!_g(a,r))try{r[a]=n.getData(i).tuplesRef()}catch{}}function _we(e,t,n,r){t[0].type!==`Literal`&&V(`First argument to indata must be a string literal.`),t[1].type!==`Literal`&&V(`Second argument to indata must be a string literal.`);let i=t[0].value,a=t[1].value,o=`@`+a;_g(o,r)||(r[o]=n.getData(i).indataRef(n,a))}function vW(e,t,n,r){if(t[0].type===`Literal`)yW(n,r,t[0].value);else for(e in n.scales)yW(n,r,e)}function yW(e,t,n){let r=`%`+n;if(!_g(t,r))try{t[r]=e.scaleRef(n)}catch{}}function bW(e,t){if(Eg(e)){let n=t.scales[e];return n&&qfe(n.value)?n.value:void 0}else if(ag(e))return qfe(e)?e:void 0}function vwe(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=vW,n._range=vW,n._scale=vW;let r=t=>`_[`+(t.type===`Literal`?W(`%`+t.value):W(`%`)+`+`+e(t))+`]`;return{_bandwidth:e=>`this.__bandwidth(${r(e[0])})`,_range:e=>`${r(e[0])}.range()`,_scale:t=>`${r(t[0])}(${e(t[1])})`}}function xW(e,t){return function(n,r,i){if(n){let t=bW(n,(i||this).context);return t&&t.path[e](r)}else return t(r)}}function ywe(e,t){let n=bW(e,(t||this).context);return n&&n.scale()}function bwe(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function SW(e,t,n){try{e[t].apply(e,[`EXPRESSION`].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function xwe(){return SW(this.context.dataflow,`warn`,arguments)}function Swe(){return SW(this.context.dataflow,`info`,arguments)}function Cwe(){return SW(this.context.dataflow,`debug`,arguments)}function CW(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function wW(e){let t=XT(e),n=CW(t.r),r=CW(t.g),i=CW(t.b);return .2126*n+.7152*r+.0722*i}function wwe(e,t){let n=wW(e),r=wW(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function Twe(){let e=[].slice.call(arguments);return e.unshift({}),hg(...e)}function TW(e,t){return e===t||e!==e&&t!==t?!0:H(e)?H(t)&&e.length===t.length?Ewe(e,t):!1:Dh(e)&&Dh(t)?EW(e,t):!1}function Ewe(e,t){for(let n=0,r=e.length;nEW(e,t)}function Dwe(e,t,n,r,i,a){let o=this.context.dataflow,s=this.context.data[e],c=s.input,l=o.stamp(),u=s.changes,d,f;if(o._trigger===!1||!(c.value.length||t||r))return 0;if((!u||u.stamp{s.modified=!0,o.pulse(c,u).run()},!0,1)),n&&(d=n===!0?Sh:H(n)||rx(n)?n:DW(n),u.remove(d)),t&&u.insert(t),r&&(d=DW(r),c.value.some(d)?u.remove(d):u.insert(r)),i){if(ag(i))throw Error(`modify parameter must be a data tuple, not a function`);for(f in a)u.modify(i,f,a[f])}return 1}function Owe(e){let t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function kwe(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}function Awe(e,t){let n=WW[t]||(WW[t]=gh(t));return H(e)?e.map(n):n(e)}function OW(e){return H(e)||ArrayBuffer.isView(e)?e:null}function kW(e){return OW(e)||(Eg(e)?e:null)}function jwe(e,...t){return OW(e).join(...t)}function Mwe(e,...t){return kW(e).indexOf(...t)}function Nwe(e,...t){return kW(e).lastIndexOf(...t)}function Pwe(e,...t){return kW(e).slice(...t)}function Fwe(e,t,n){return ag(n)&&V(`Function argument passed to replace.`),!Eg(t)&&!Tg(t)&&V(`Please pass a string or RegExp argument to replace.`),String(e).replace(t,n)}function Iwe(e){return OW(e).slice().reverse()}function Lwe(e){return OW(e).slice().sort(lg)}function Rwe(e,t,n){return $D(e||0,t||0,n||0)}function zwe(e,t){let n=bW(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function Bwe(e,t){let n=bW(e,(t||this).context);return n?n.copy():void 0}function Vwe(e,t){let n=bW(e,(t||this).context);return n?n.domain():[]}function Hwe(e,t,n){let r=bW(e,(n||this).context);return r?H(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0}function Uwe(e,t){let n=bW(e,(t||this).context);return n&&n.range?n.range():[]}function Wwe(e,t,n){let r=bW(e,(n||this).context);return r?r(t):void 0}function Gwe(e,t,n,r,i){e=bW(e,(i||this).context);let a=Ipe(t,n),o=e.domain(),s=o[0],c=Mh(o),l=yh;return c-s?l=tpe(e,s,c):e=(e.interpolator?tO(`sequential`)().interpolator(e.interpolator()):tO(`linear`)().interpolate(e.interpolate()).range(e.range())).domain([s=0,c=1]),e.ticks&&(o=e.ticks(+r||15),s!==o[0]&&o.unshift(s),c!==Mh(o)&&o.push(c)),o.forEach(t=>a.stop(l(t),e(t))),a}function Kwe(e,t,n){let r=bW(e,(n||this).context);return function(e){return r?r.path.context(e)(t):``}}function qwe(e){let t=null;return function(n){return n?LO(n,t||=IO(e)):e}}function AW(e,t){let n=hW.call(t,e);return n.root&&n.root.lookup||{}}function Jwe(e,t,n){let r=AW(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(GW):void 0}function Ywe(e,t){let n=AW(e,this)[t];return n?n.ancestors().map(GW):void 0}function Xwe(){let e=KW();return e?e.screen:{}}function Zwe(){let e=KW();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function Qwe(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function jW(e,t,n){if(!e)return[];let[r,i]=e,a=new WO().set(r[0],r[1],i[0],i[1]);return Vhe(n||this.context.dataflow.scenegraph().root,a,$we(t))}function $we(e){let t=null;if(e){let n=ng(e.marktype),r=ng(e.markname);t=e=>(!n.length||n.some(t=>e.marktype===t))&&(!r.length||r.some(t=>e.name===t))}return t}function eTe(e,t,n,r=5){e=ng(e);let i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function tTe(e){return ng(e).reduce((t,[n,r],i)=>t+=i==0?`M ${n},${r} `:i===e.length-1?` Z`:`L ${n},${r} `,``)}function nTe(e,t,n){let{x:r,y:i,mark:a}=n,o=new WO().set(2**53-1,2**53-1,-(2**53-1),-(2**53-1));for(let[e,n]of t)eo.x2&&(o.x2=e),no.y2&&(o.y2=n);return o.translate(r,i),jW([[o.x1,o.y1],[o.x2,o.y2]],e,a).filter(e=>rTe(e.x,e.y,t))}function rTe(e,t,n){let r=0;for(let i=0,a=n.length-1;it!=s>t&&e<(o-c)*(t-l)/(s-l)+c&&r++}return r&1}function iTe(e){let t=RH(e);JW.forEach(e=>t[e]=YW+e);for(let e in qW)t[e]=XW+e;return hg(t,vwe(e,qW,ZW)),t}function MW(e,t,n){return arguments.length===1?qW[e]:(qW[e]=t,n&&(ZW[e]=n),$W&&($W.functions[e]=XW+e),this)}function NW(e,t){let n={},r;try{e=Eg(e)?e:W(e)+``,r=LH(e)}catch{V(`Expression parse error: `+e)}r.visit(e=>{if(e.type!==`CallExpression`)return;let r=e.callee.name,i=QW.visitors[r];i&&i(r,e.arguments,t,n)});let i=$W(r);return i.globals.forEach(e=>{let r=`$`+e;!_g(n,r)&&t.getSignal(e)&&(n[r]=t.signalRef(e))}),{$expr:hg({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}var PW,FW,IW,LW,RW,zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG=o((()=>{Fg(),zU(),MO(),KL(),tD(),Qx(),Xj(),lwe(),US(),Iy(),c_(),PW=e=>function(t,n){let r=this.context.dataflow.locale();return t===null?`null`:r[e](n)(t)},FW=PW(`format`),IW=PW(`timeFormat`),LW=PW(`utcFormat`),RW=PW(`timeParse`),zW=PW(`utcParse`),BW=new Date(2e3,0,1),VW=xW(`area`,B_e),HW=xW(`bounds`,W_e),UW=xW(`centroid`,Z_e),WW={},GW=e=>e.data,KW=()=>typeof window<`u`&&window||null,qW={random(){return IS()},cumulativeNormal:cS,cumulativeLogNormal:mS,cumulativeUniform:bS,densityNormal:sS,densityLogNormal:pS,densityUniform:yS,quantileNormal:lS,quantileLogNormal:hS,quantileUniform:xS,sampleNormal:oS,sampleLogNormal:fS,sampleUniform:vS,isArray:H,isBoolean:Sg,isDate:Cg,isDefined(e){return e!==void 0},isNumber:wg,isObject:Dh,isRegExp:Tg,isString:Eg,isTuple:rx,isValid(e){return e!=null&&e===e},toBoolean:Ag,toDate(e){return jg(e)},toNumber:Ph,toString:Mg,indexof:Mwe,join:jwe,lastindexof:Nwe,replace:Fwe,reverse:Iwe,sort:Lwe,slice:Pwe,flush:Mie,lerp:Wie,merge:Twe,pad:$ie,peek:Mh,pluck:Awe,span:kg,inrange:xg,truncate:cae,rgb:XT,lab:OE,hcl:PE,hsl:aE,luminance:wW,contrast:wwe,sequence:s_,format:FW,utcFormat:LW,utcParse:zW,utcOffset:Gv,utcSequence:Jv,timeFormat:IW,timeParse:RW,timeOffset:Wv,timeSequence:qv,timeUnitSpecifier:Tv,monthFormat:pwe,monthAbbrevFormat:mwe,dayFormat:hwe,dayAbbrevFormat:gwe,quarter:eg,utcquarter:tg,week:Ov,utcweek:Nv,dayofyear:Dv,utcdayofyear:Mv,warn:xwe,info:Swe,debug:Cwe,extent(e){return gg(e)},inScope:bwe,intersect:jW,clampRange:ig,pinchDistance:Owe,pinchAngle:kwe,screen:Xwe,containerSize:Qwe,windowSize:Zwe,bandspace:Rwe,setdata:dwe,pathShape:qwe,panLinear:Rh,panLog:zh,panPow:Bh,panSymlog:Vh,zoomLinear:Uh,zoomLog:Wh,zoomPow:Gh,zoomSymlog:Kh,encode:fwe,modify:Dwe,lassoAppend:eTe,lassoPath:tTe,intersectLasso:nTe},JW=[`view`,`item`,`group`,`xy`,`x`,`y`],YW=`event.vega.`,XW=`this.`,ZW={},QW={forbidden:[`_`],allowed:[`datum`,`event`,`item`],fieldvar:`datum`,globalvar:e=>`_[${W(`$`+e)}]`,functions:iTe,constants:RU,visitors:ZW},$W=zH(QW),MW(`bandwidth`,zwe,vW),MW(`copy`,Bwe,vW),MW(`domain`,Vwe,vW),MW(`range`,Uwe,vW),MW(`invert`,Hwe,vW),MW(`scale`,Wwe,vW),MW(`gradient`,Gwe,vW),MW(`geoArea`,VW,vW),MW(`geoBounds`,HW,vW),MW(`geoCentroid`,UW,vW),MW(`geoShape`,Kwe,vW),MW(`geoScale`,ywe,vW),MW(`indata`,uwe,_we),MW(`data`,hW,_W),MW(`treePath`,Jwe,_W),MW(`treeAncestors`,Ywe,_W),MW(`vlSelectionTest`,awe,HU),MW(`vlSelectionIdTest`,owe,HU),MW(`vlSelectionResolve`,cwe,HU),MW(`vlSelectionTuples`,swe)}));function aTe(e){let t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(e=>t.parseOperator(e)),n.forEach(e=>t.parseOperatorParameters(e)),(e.streams||[]).forEach(e=>t.parseStream(e)),(e.updates||[]).forEach(e=>t.parseUpdate(e)),t.resolve()}function oTe(e,t){let n=``;return sG[t]?n:(e.x2&&(e.x?(cG[t]&&(n+=`if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;`),n+=`o.width=o.x2-o.x;`):n+=`o.x=o.x2-(o.width||0);`),e.xc&&(n+=`o.x=o.xc-(o.width||0)/2;`),e.y2&&(e.y?(cG[t]&&(n+=`if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;`),n+=`o.height=o.y2-o.y;`):n+=`o.y=o.y2-(o.height||0);`),e.yc&&(n+=`o.y=o.yc-(o.height||0)/2;`),n)}function tG(e){return(e+``).toLowerCase()}function sTe(e){return tG(e)===`operator`}function cTe(e){return tG(e)===`collect`}function nG(e,t,n){n.endsWith(`;`)||(n=`return(`+n+`);`);let r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function lTe(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} : (u > v || v == null) && u != null ? ${r} : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} - : v !== v && u === u ? ${r} : `}function Hwe(e){let t=this;zwe(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function Uwe(e){let t=this;if(e.params){let n=t.get(e.id);n||V(`Invalid operator id: `+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function Wwe(e,t){t||={};let n=this;for(let r in e){let i=e[r];t[r]=H(i)?i.map(e=>cG(e,n,t)):cG(i,n,t)}return t}function cG(e,t,n){if(!e||!Wm(e))return e;for(let r=0,i=hG.length,a;re&&e.$tupleid?kb:e);return t.fn[n]||(t.fn[n]=wh(r,e.$order,t.expr.codegen))}function Xwe(e,t){let n=e.$encode,r={};for(let e in n){let i=n[e];r[e]=Sm(t.encodeExpression(i.$expr),i.$fields),r[e].output=i.$output}return r}function Zwe(e,t){return t}function Qwe(e,t){let n=e.$subflow;return function(e,r,i){let a=t.fork().parse(n),o=a.get(n.operators[0].id),s=a.signals.parent;return s&&s.set(i),o.detachSubflow=()=>t.detach(a),o}}function $we(){return kb}function eTe(e){var t=this,n=e.filter==null?void 0:t.eventExpression(e.filter),r=e.stream==null?void 0:t.get(e.stream),i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(e=>t.get(e)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(e=>t.get(e)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r??V(`Invalid stream definition: `+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function tTe(e){var t=this,n=Wm(n=e.source)?n.$ref:n,r=t.get(n),i=null,a=e.update,o=void 0;r||V(`Source not defined: `+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),a&&a.$expr&&(a.$params&&(o=t.parseParameters(a.$params)),a=t.handlerExpression(a.$expr)),t.update(e,r,i,a,o)}function nTe(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(n=>{let i=t.signals[n];e.signals(n,i)&&(r[n]=i.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(n=>{let r=t.data[n];e.data(n,r)&&(i[n]=r.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n}function rTe(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(e=>{n.update(t.signals[e],i[e],gG)}),Object.keys(r||{}).forEach(e=>{n.pulse(t.data[e].input,n.changeset().remove(zm).insert(r[e]))}),(e.subcontext||[]).forEach((e,n)=>{let r=t.subcontext[n];r&&r.setState(e)})}function lG(e,t,n,r){return new uG(e,t,n,r)}function uG(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||mG,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function dG(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}var fG,pG,mG,hG,gG,_G=o((()=>{pg(),ax(),fG=ug([`rule`]),pG=ug([`group`,`image`,`rect`]),mG={operator:(e,t)=>sG(e,[`_`],t.code),parameter:(e,t)=>sG(e,[`datum`,`_`],t.code),event:(e,t)=>sG(e,[`event`],t.code),handler:(e,t)=>sG(e,[`_`,`event`],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:r}=t,i=`var o=item,datum=o.datum,m=0,$;`;for(let e in r){let t=`o[`+W(e)+`]`;i+=`$=${r[e].code};if(${t}!==$)${t}=$,m=1;`}return i+=Rwe(r,n),i+=`return m;`,sG(e,[`item`,`_`],i)},codegen:{get(e){let t=`[${e.map(W).join(`][`)}]`,n=Function(`_`,`return _${t};`);return n.path=t,n},comparator(e,t){let n,r=Function(`a`,`b`,`var u, v; return `+e.map((e,r)=>{let i=t[r],a,o;return e.path?(a=`a${e.path}`,o=`b${e.path}`):((n||={})[`f`+r]=e,a=`this.f${r}(a)`,o=`this.f${r}(b)`),Vwe(a,o,-i,i)}).join(``)+`0;`);return n?r.bind(n):r}}},hG=[{key:`$ref`,parse:Gwe},{key:`$key`,parse:qwe},{key:`$expr`,parse:Kwe},{key:`$field`,parse:Jwe},{key:`$encode`,parse:Xwe},{key:`$compare`,parse:Ywe},{key:`$context`,parse:Zwe},{key:`$subflow`,parse:Qwe},{key:`$tupleid`,parse:$we}],gG={skip:!0},uG.prototype=dG.prototype={fork(){let e=new dG(this);return(this.subcontext||=[]).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);let t=Object.keys(e.nodes);for(let n of t)e.nodes[n]._targets=null;for(let n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){let n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),Bwe(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let i=n.get(e.parent.$ref);i?(r.connect(i,[t]),t.targets().add(i)):(n.unresolved=n.unresolved||[]).push(()=>{i=n.get(e.parent.$ref),r.connect(i,[t]),t.targets().add(i)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(let r in e.data){let i=n.data[r]||(n.data[r]={});e.data[r].forEach(e=>i[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[oG(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:Lwe,parseOperator:Hwe,parseOperatorParameters:Uwe,parseParameters:Wwe,parseStream:eTe,parseUpdate:tTe,getState:nTe,setState:rTe}}));function iTe(e){let t=e.container();t&&(t.setAttribute(`role`,`graphics-document`),t.setAttribute(`aria-roleDescription`,`visualization`),vG(t,e.description()))}function vG(e,t){e&&(t==null?e.removeAttribute(`aria-label`):e.setAttribute(`aria-label`,t))}function aTe(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}function oTe(e){let t=e._signals.cursor||(e._signals.cursor=e.add({user:KG,item:null}));e.on(e.events(`view`,`pointermove`),t,(e,n)=>{let r=t.value,i=r?Yh(r)?r:r.user:KG,a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}}),e.add(null,function(t){let n=t.cursor,r=this.value;return Yh(n)||(r=n.item,n=n.user),yG(e,n&&n!==KG?n:r||n),r},{cursor:t})}function yG(e,t){let n=e.globalCursor()?typeof document<`u`&&document.body:e.container();if(n)return t==null?n.style.removeProperty(`cursor`):n.style.cursor=t}function bG(e,t){var n=e._runtime.data;return Ih(n,t)||V(`Unrecognized data set: `+t),n[t]}function sTe(e,t){return arguments.length<2?bG(this,e).values.value:xG.call(this,e,Pb().remove(zm).insert(t))}function xG(e,t){kce(t)||V(`Second argument to changes must be a changeset.`);let n=bG(this,e);return n.modified=!0,this.pulse(n.input,t)}function cTe(e,t){return xG.call(this,e,Pb().insert(t))}function lTe(e,t){return xG.call(this,e,Pb().remove(t))}function SG(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function CG(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function wG(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function uTe(e){var t=wG(e),n=SG(e),r=CG(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(t=>{try{t(n,r)}catch(t){e.error(t)}})}function dTe(e,t,n){var r=e._renderer,i=r&&r.canvas(),a,o,s;return i&&(s=wG(e),o=t.changedTouches?t.changedTouches[0]:t,a=Uk(o,i),a[0]-=s[0],a[1]-=s[1]),t.dataflow=e,t.item=n,t.vega=fTe(e,n,a),t}function fTe(e,t,n){let r=t?t.mark.marktype===`group`?t:t.mark.group:null;function i(e){var n=r,i;if(e){for(i=t;i;i=i.mark.group)if(i.mark.name===e){n=i;break}}return n&&n.mark&&n.mark.interactive?n:{}}function a(e){if(!e)return n;Yh(e)&&(e=i(e));let t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:Ah(e),item:Ah(t||{}),group:i,xy:a,x:e=>a(e)[0],y:e=>a(e)[1]}}function pTe(e){let t=Mh({defaults:{}},e),n=(e,t)=>{t.forEach(t=>{H(e[t])&&(e[t]=ug(e[t]))})};return n(t.defaults,[`prevent`,`allow`]),n(t,[`view`,`window`,`selector`]),t}function TG(e,t,n,r){e._eventListeners.push({type:n,sources:yh(t),handler:r})}function mTe(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function EG(e,t,n){let r=e._eventConfig&&e._eventConfig[t];return r===!1||Wm(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function hTe(e,t,n){var r=this,i=new Lb(n),a=function(n,a){r.runAsync(null,()=>{e===qG&&mTe(r,t)&&n.preventDefault(),i.receive(dTe(r,n,a))})},o;if(e===JG)EG(r,`timer`,t)&&r.timer(a,t);else if(e===qG)EG(r,`view`,t)&&r.addEventListener(t,a,XG);else if(e===YG?EG(r,`window`,t)&&typeof window<`u`&&(o=[window]):typeof document<`u`&&EG(r,`selector`,t)&&(o=Array.from(document.querySelectorAll(e))),!o)r.warn(`Can not resolve event source: `+e);else{for(var s=0,c=o.length;s=0;)t[i].stop();for(i=r.length;--i>=0;)for(o=r[i],a=o.sources.length;--a>=0;)o.sources[a].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)c=n[i].type,s=n[i].handler,this._handler.off(c,s);return this}function AG(e,t,n){let r=document.createElement(e);for(let e in t)r.setAttribute(e,t[e]);return n!=null&&(r.textContent=n),r}function vTe(e,t,n){if(!t)return;let r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,t)})}},r.debounce&&(i.update=jh(r.debounce,i.update))),(r.input==null&&r.element?yTe:xTe)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function yTe(e,t,n,r){let i=n.event||`input`,a=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,a),TG(r,t,i,a),e.set=e=>{t.value=e,t.dispatchEvent(bTe(i))}}function bTe(e){return typeof Event<`u`?new Event(e):{type:e}}function xTe(e,t,n,r){let i=r.signal(n.signal),a=AG(`div`,{class:ZG}),o=n.input===`radio`?a:a.appendChild(AG(`label`));o.appendChild(AG(`span`,{class:QG},n.name||n.signal)),t.appendChild(a);let s=STe;switch(n.input){case`checkbox`:s=CTe;break;case`select`:s=wTe;break;case`radio`:s=TTe;break;case`range`:s=ETe;break}s(e,o,n,i)}function STe(e,t,n,r){let i=AG(`input`);for(let e in n)e!==`signal`&&e!==`element`&&i.setAttribute(e===`input`?`type`:e,n[e]);i.setAttribute(`name`,n.signal),i.value=r,t.appendChild(i),i.addEventListener(`input`,()=>e.update(i.value)),e.elements=[i],e.set=e=>i.value=e}function CTe(e,t,n,r){let i={type:`checkbox`,name:n.signal};r&&(i.checked=!0);let a=AG(`input`,i);t.appendChild(a),a.addEventListener(`change`,()=>e.update(a.checked)),e.elements=[a],e.set=e=>a.checked=!!e||null}function wTe(e,t,n,r){let i=AG(`select`,{name:n.signal}),a=n.labels||[];n.options.forEach((e,t)=>{let n={value:e};jG(e,r)&&(n.selected=!0),i.appendChild(AG(`option`,n,(a[t]||e)+``))}),t.appendChild(i),i.addEventListener(`change`,()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=e=>{for(let t=0,r=n.options.length;t{let s={type:`radio`,name:n.signal,value:t};jG(t,r)&&(s.checked=!0);let c=AG(`input`,s);c.addEventListener(`change`,()=>e.update(t));let l=AG(`label`,{},(a[o]||t)+``);return l.prepend(c),i.appendChild(l),c}),e.set=t=>{let n=e.elements,r=n.length;for(let e=0;e{c.textContent=s.value,e.update(+s.value)};s.addEventListener(`input`,l),s.addEventListener(`change`,l),e.elements=[s],e.set=e=>{s.value=e,c.textContent=e}}function jG(e,t){return e===t||e+``==t+``}function MG(e,t,n,r,i,a){return t||=new r(e.loader()),t.initialize(n,SG(e),CG(e),wG(e),i,a).background(e.background())}function NG(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function DTe(e,t,n,r){let i=new r(e.loader(),NG(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,wG(e),e);return t&&t.handlers().forEach(e=>{i.on(e.type,e.handler)}),i}function OTe(e,t){let n=this,r=n._renderType,i=n._eventConfig.bind,a=Xk(r);e=n._el=e?PG(n,e,!0):null,iTe(n),a||n.error(`Unrecognized renderer type: `+r);let o=a.handler||pj,s=e?a.renderer:a.headless;return n._renderer=s?MG(n,n._renderer,e,s):null,n._handler=DTe(n,n._handler,e,o),n._redraw=!0,e&&i!==`none`&&(t=t?n._elBind=PG(n,t,!0):e.appendChild(AG(`form`,{class:`vega-bindings`})),n._bind.forEach(e=>{e.param.element&&i!==`container`&&(e.element=PG(n,e.param.element,!!e.param.input))}),n._bind.forEach(e=>{vTe(n,e.element||t,e)})),n}function PG(e,t,n){if(typeof t==`string`)if(typeof document<`u`){if(t=document.querySelector(t),!t)return e.error(`Signal bind element not found: `+t),null}else return e.error(`DOM document instance not found.`),null;if(t&&n)try{t.textContent=``}catch(n){t=null,e.error(n)}return t}function FG(e){return Wm(e)?{top:eK(e.top),bottom:eK(e.bottom),left:eK(e.left),right:eK(e.right)}:tK(eK(e))}async function IG(e,t,n,r){let i=Xk(t),a=i&&i.headless;return a||V(`Unrecognized renderer type: `+t),await e.runAsync(),MG(e,null,null,a,n,r).renderAsync(e._scenegraph.root)}async function kTe(e,t){e!==Zj.Canvas&&e!==Zj.SVG&&e!==Zj.PNG&&V(`Unrecognized image type: `+e);let n=await IG(this,e,t);return e===Zj.SVG?ATe(n.svg(),`image/svg+xml`):n.canvas().toDataURL(`image/png`)}function ATe(e,t){let n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function jTe(e,t){return(await IG(this,Zj.Canvas,e,t)).canvas()}async function MTe(e){return(await IG(this,Zj.SVG,e)).svg()}function NTe(e,t,n){return lG(e,ix,QW,n).parse(t)}function PTe(e){var t=this._runtime.scales;return Ih(t,e)||V(`Unrecognized scale or projection: `+e),t[e].value}function LG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===iK?r.left+r.right:0)}function RG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===iK?r.top+r.bottom:0)}function FTe(e){var t=e._signals,n=t[nK],r=t[rK],i=t[iK];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,t=>{e._width=t.size,e._viewWidth=LG(e,t.size),a()},{size:n}),e._resizeHeight=e.add(null,t=>{e._height=t.size,e._viewHeight=RG(e,t.size),a()},{size:r});let o=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}function ITe(e,t,n,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==n&&(s=1,o.signal(nK,n,aK),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(rK,r,aK),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==i[0]||o._origin[1]!==i[1])&&(o._resize=1,o._origin=i),s&&o.run(`enter`),a&&o.runAfter(e=>e.resize())},!1,1)}function LTe(e){return this._runtime.getState(e||{data:RTe,signals:zTe,recurse:!0})}function RTe(e,t){return t.modified&&H(t.input.value)&&!e.startsWith(`_:vega:_`)}function zTe(e,t){return!(e===`parent`||t instanceof ix.proxy)}function BTe(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this}function VTe(e,t){function n(t){e({timestamp:Date.now(),elapsed:t})}this._timers.push(ube(n,t))}function HTe(e,t,n,r){let i=e.element();i&&i.setAttribute(`title`,UTe(r))}function UTe(e){return e==null?``:H(e)?zG(e):Wm(e)&&!Uh(e)?WTe(e):e+``}function WTe(e){return Object.keys(e).map(t=>{let n=e[t];return t+`: `+(H(n)?zG(n):BG(n))}).join(` -`)}function zG(e){return`[`+e.map(BG).join(`, `)+`]`}function BG(e){return H(e)?`[…]`:Wm(e)&&!Uh(e)?`{…}`:e}function GTe(){if(this.renderer()===`canvas`&&this._renderer._canvas){let e=null,t=()=>{e?.();let n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener(`change`,t),e=()=>{n.removeEventListener(`change`,t)},this._renderer._canvas.getContext(`2d`).pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function VG(e,t){let n=this;if(t||={},Ub.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let r=Mh({},e.locale,t.locale);n.locale(ece(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Zj.Canvas,n._scenegraph=new HA;let r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||HTe,n._redraw=!0,n._handler=new pj().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=pTe(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let i=NTe(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(e=>({state:null,param:Mh({},e)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=LG(n,n._width),n._viewHeight=RG(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,FTe(n),aTe(n),oTe(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function HG(e,t){return Ih(e._signals,t)?e._signals[t]:V(`Unrecognized signal name: `+W(t))}function UG(e,t){let n=(e._targets||[]).filter(e=>e._update&&e._update.handler===t);return n.length?n[0]:null}function WG(e,t,n,r){let i=UG(n,r);return i||(i=NG(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function GG(e,t,n){let r=UG(t,n);return r&&t._targets.remove(r),e}var KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,KTe=o((()=>{pg(),ax(),tM(),g_(),aG(),_G(),yz(),gb(),KG=`default`,qG=`view`,JG=`timer`,YG=`window`,XG={trap:!1},ZG=`vega-bind`,QG=`vega-bind-name`,$G=`vega-bind-radio`,eK=e=>+e||0,tK=e=>({top:e,bottom:e,left:e,right:e}),nK=`width`,rK=`height`,iK=`padding`,aK={skip:!0},U(VG,Ub,{async evaluate(e,t,n){if(await Ub.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,uTe(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}return n&&Db(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e==null?null:e+``;return t!==this._desc&&vG(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let r=HG(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal(`width`,e):this.signal(`width`)},height(e){return arguments.length?this.signal(`height`,e):this.signal(`height`)},padding(e){return arguments.length?this.signal(`padding`,FG(e)):FG(this.signal(`padding`))},autosize(e){return arguments.length?this.signal(`autosize`,e):this.signal(`autosize`)},background(e){return arguments.length?this.signal(`background`,e):this.signal(`background`)},renderer(e){return arguments.length?(Xk(e)||V(`Unrecognized renderer type: `+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Ub.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(HG(this,`autosize`))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:ITe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=NG(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,a;--r>=0;)if(a=n[r].type,i=n[r].handler,e===a&&(t===i||t===i.raw)){this._handler.off(a,i);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return WG(this,e,HG(this,e),t)},removeSignalListener(e,t){return GG(this,HG(this,e),t)},addDataListener(e,t){return WG(this,e,bG(this,e).values,t)},removeDataListener(e,t){return GG(this,bG(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=yG(this,null);this._globalCursor=!!e,t&&yG(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:VTe,events:hTe,finalize:_Te,hover:gTe,data:sTe,change:xG,insert:cTe,remove:lTe,scale:PTe,initialize:OTe,toImageURL:kTe,toCanvas:jTe,toSVG:MTe,getState:LTe,setState:BTe,_watchPixelRatio:GTe})}));function oK(e,t,n){return xK=t||uK,SK=n||bK,cK(e.trim()).map(lK)}function qTe(e){return SK[e]}function sK(e,t,n,r,i){let a=e.length,o=0,s;for(;t' after between selector: `+e;r=r.map(lK);let i=lK(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function YTe(e){let t={source:xK},n=[],r=[0,0],i=0,a=0,o=e.length,s=0,c,l;if(e[o-1]===mK){if(s=e.lastIndexOf(pK),s>=0){try{r=XTe(e.substring(s+1,o-1))}catch{throw`Invalid throttle specification: `+e}e=e.slice(0,s).trim(),o=e.length}else throw`Unmatched right brace: `+e;s=0}if(!o)throw e;if(e[0]===_K&&(i=++s),c=sK(e,s,hK),c1?(t.type=n[1],i?t.markname=n[0].slice(1):qTe(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)===`!`&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function XTe(e){let t=e.split(gK);if(!e.length||t.length>2)throw e;return t.map(t=>{let n=+t;if(n!==n)throw e;return n})}var uK,dK,fK,pK,mK,hK,gK,_K,vK,yK,bK,xK,SK,CK=o((()=>{uK=`view`,dK=`[`,fK=`]`,pK=`{`,mK=`}`,hK=`:`,gK=`,`,_K=`@`,vK=`>`,yK=/[[\]{}]/,bK={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1}}));function ZTe(e){return Wm(e)?e:{type:e||`pad`}}function QTe(e){return Wm(e)?e.signal?e:{top:Pq(e.top),bottom:Pq(e.bottom),left:Pq(e.left),right:Pq(e.right)}:Fq(Pq(e))}function wK(e,t,n,r){return n==null?0:(Wm(n)&&!H(n)||H(n)&&n.length&&Wm(n[0])?e.update[t]=n:e[r||`enter`][t]={value:n},1)}function TK(e,t,n){for(let n in t)wK(e,n,t[n]);for(let t in n)wK(e,t,n[t],`update`)}function EK(e,t,n){for(let r in t)n&&Ih(n,r)||(e[r]=Mh(e[r]||{},t[r]));return e}function DK(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function $Te(e,t,n,r,i){let a={},o={},s,c,l,u;for(c in c=`lineBreak`,t===`text`&&i[c]!=null&&!DK(c,e)&&OK(a,c,i[c]),(n==`legend`||String(n).startsWith(`axis`))&&(n=null),u=n===`frame`?i.group:n===`mark`?Mh({},i.mark,i[t]):null,u)l=DK(c,e)||(c===`fill`||c===`stroke`)&&(DK(`fill`,e)||DK(`stroke`,e)),l||OK(a,c,u[c]);for(c in yh(r).forEach(t=>{let n=i.style&&i.style[t];for(let t in n)DK(t,e)||OK(a,t,n[t])}),e=Mh({},e),a)u=a[c],u.signal?(s||={})[c]=u:o[c]=u;return e.enter=Mh(o,e.enter),s&&(e.update=Mh(s,e.update)),e}function OK(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function kK(e){if(e.gradient!=null)return tEe(e);let t=e.signal?`(${e.signal})`:e.color?eEe(e.color):e.field==null?e.value===void 0?void 0:W(e.value):jK(e.field);return e.scale!=null&&(t=nEe(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${AK(e.exponent)})`),e.mult!=null&&(t+=`*${AK(e.mult)}`),e.offset!=null&&(t+=`+${AK(e.offset)}`),e.round&&(t=`round(${t})`),t}function eEe(e){return e.c?nJ(`hcl`,e.h,e.c,e.l):e.h||e.s?nJ(`hsl`,e.h,e.s,e.l):e.l||e.a?nJ(`lab`,e.l,e.a,e.b):e.r||e.g||e.b?nJ(`rgb`,e.r,e.g,e.b):null}function tEe(e){let t=[e.start,e.stop,e.count].map(e=>e==null?null:W(e));for(;t.length&&Ym(t)==null;)t.pop();return t.unshift(tJ(e.gradient)),`gradient(${t.join(`,`)})`}function AK(e){return Wm(e)?`(`+kK(e)+`)`:e}function jK(e){return MK(Wm(e)?e:{datum:e})}function MK(e){let t,n,r;if(e.signal)t=`datum`,r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t=`item`;n-->0;)t+=`.mark.group`;e.parent?(r=e.parent,t+=`.datum`):r=e.group}else e.datum?(t=`datum`,r=e.datum):V(`Invalid field reference: `+W(e));return e.signal||(r=Yh(r)?jm(r).map(W).join(`][`):MK(r)),t+`[`+r+`]`}function nEe(e,t){let n=tJ(e.scale);return e.range==null?(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+`+`:``)+`_bandwidth(${n})`+(+e.band==1?``:`*`+AK(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t??=`0`):t=`lerp(_range(${n}), ${+e.range})`,t}function rEe(e){let t=``;return e.forEach(e=>{let n=kK(e);t+=e.test?`(${e.test})?${n}:`:n}),Ym(t)===`:`&&(t+=`null`),t}function NK(e,t,n,r,i,a){let o={};a||={},a.encoders={$encode:o},e=$Te(e,t,n,r,i.config);for(let n in e)o[n]=iEe(e[n],t,a,i);return a}function iEe(e,t,n,r){let i={},a={};for(let t in e)e[t]!=null&&(i[t]=oEe(aEe(e[t]),r,n,a));return{$expr:{marktype:t,channels:i},$fields:Object.keys(a),$output:Object.keys(e)}}function aEe(e){return H(e)?rEe(e):kK(e)}function oEe(e,t,n,r){let i=RW(e,t);return i.$fields.forEach(e=>r[e]=1),Mh(n,i.$params),i.$expr}function PK(e,t){V(e+` for "outer" push: `+W(t))}function FK(e,t){let n=e.name;if(e.push===rJ)t.signals[n]||PK(`No prior signal definition`,n),iJ.forEach(t=>{e[t]!==void 0&&PK(`Invalid property `,t)});else{let r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function IK(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function LK(e,t,n,r){return new IK(e,t,n,r)}function RK(e,t){return LK(`operator`,e,t)}function zK(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function BK(e,t){return t?{$field:e,$name:t}:{$field:e}}function VK(e,t){return{$compare:e,$order:t}}function sEe(e,t){let n={$key:e};return t&&(n.$flat=!0),n}function cEe(e){return Wm(e)?(e.order===sJ?`-`:`+`)+HK(e.op,e.field):``}function HK(e,t){return(e&&e.signal?`$`+e.signal:e||``)+(e&&t?`_`:``)+(t&&t.signal?`$`+t.signal:t?.replace(/\W+/g,`_`).replace(/^_+|_+$/g,``)||``)}function UK(e){return e&&e.signal}function lEe(e){return e&&e.expr}function WK(e){if(UK(e))return!0;if(Wm(e)){for(let t in e)if(WK(e[t]))return!0}return!1}function GK(e,t){return e??t}function KK(e){return e&&e.signal||e}function qK(e,t){return(e.merge?dEe:e.stream?fEe:e.type?pEe:V(`Invalid stream specification: `+W(e)))(e,t)}function uEe(e){return e===cJ?lJ:e||lJ}function dEe(e,t){let n=JK({merge:e.merge.map(e=>qK(e,t))},e,t);return t.addStream(n).id}function fEe(e,t){let n=JK({stream:qK(e.stream,t)},e,t);return t.addStream(n).id}function pEe(e,t){let n;e.type===uJ?(n=t.event(uJ,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(uEe(e.source),e.type);let r=JK({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function JK(e,t,n){let r=t.between;return r&&(r.length!==2&&V(`Stream "between" parameter must have 2 entries: `+W(t)),e.between=[qK(r[0],n),qK(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(mEe(t.marktype,t.markname,t.markrole)),t.source===cJ&&r.push(`inScope(event.item)`),r.length&&(e.filter=RW(`(`+r.join(`)&&(`)+`)`,n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function mEe(e,t,n){return`event.item`+(e&&e!==`*`?`&&event.item.mark.marktype==='`+e+`'`:``)+(n?`&&event.item.mark.role==='`+n+`'`:``)+(t?`&&event.item.mark.name==='`+t+`'`:``)}function hEe(e,t,n){let r=e.encode,i={target:n},a=e.events,o=e.update,s=[];a||V(`Signal update missing events specification.`),Yh(a)&&(a=oK(a,t.isSubscope()?cJ:lJ)),a=yh(a).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[_Ee(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&V(`Signal encode and update are mutually exclusive.`),o=`encode(item(),`+W(r)+`)`),i.update=Yh(o)?RW(o,t):o.expr==null?o.value==null?o.signal==null?V(`Invalid signal update specification.`):{$expr:dJ,$params:{$value:t.signalRef(o.signal)}}:o.value:RW(o.expr,t),e.force&&(i.options={force:!0}),s.forEach(e=>t.addUpdate(Mh(gEe(e,t),i)))}function gEe(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):qK(e,t)}}function _Ee(e){return{signal:`[`+e.map(e=>e.scale?`scale("`+e.scale+`")`:e.signal)+`]`}}function vEe(e,t){let n=t.getSignal(e.name),r=e.update;e.init&&(r?V(`Signals can not include both init and update expressions.`):(r=e.init,n.initonly=!0)),r&&(r=RW(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(e=>hEe(e,t,n.id))}function yEe(e,t){let n=e.type||`linear`;ED(n)||V(`Unrecognized scale type: `+W(n)),t.addScale(e.name,{type:n,domain:void 0})}function bEe(e,t){let n=t.getScale(e.name).params,r;for(r in n.domain=QK(e.domain,e,t),e.range!=null&&(n.range=eq(e,t,n)),e.interpolate!=null&&AEe(e.interpolate,n),e.nice!=null&&(n.nice=kEe(e.nice,t)),e.bins!=null&&(n.bins=OEe(e.bins,t)),e)Ih(n,r)||r===`name`||(n[r]=YK(e[r],t))}function YK(e,t){return Wm(e)?e.signal?t.signalRef(e.signal):V(`Unsupported object: `+W(e)):e}function XK(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>YK(e,t))}function ZK(e){V(`Can not find data set: `+W(e))}function QK(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&V(`No scale domain defined for domainMin/domainMax to override.`);return}return e.signal?n.signalRef(e.signal):(H(e)?xEe:e.fields?CEe:SEe)(e,t,n)}function xEe(e,t,n){return e.map(e=>YK(e,n))}function SEe(e,t,n){let r=n.getData(e.data);return r||ZK(e.data),kD(t.type)?r.valuesRef(n,e.field,$K(e.sort,!1)):PD(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function CEe(e,t,n){let r=e.data,i=e.fields.reduce((e,t)=>(t=Yh(t)?{data:r,field:t}:H(t)||t.signal?wEe(t,n):t,e.push(t),e),[]);return(kD(t.type)?TEe:PD(t.type)?EEe:DEe)(e,n,i)}function wEe(e,t){let n=`_:vega:_`+VJ++,r=gJ({});if(H(e))r.value={$ingest:e};else if(e.signal){let i=`setdata(`+W(n)+`,`+e.signal+`)`;r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,LJ({})]),{data:n,field:`data`}}function TEe(e,t,n){let r=$K(e.sort,!0),i,a,o=n.map(e=>{let n=t.getData(e.data);return n||ZK(e.data),n.countsRef(t,e.field,r)}),s={groupby:aJ,pulse:o};r&&(i=r.op||`count`,a=r.field?HK(i,r.field):`count`,s.ops=[HJ[i]],s.fields=[t.fieldRef(a)],s.as=[a]),i=t.add(pJ(s));let c=t.add(gJ({pulse:zK(i)}));return a=t.add(BJ({field:aJ,sort:t.sortRef(r),pulse:zK(c)})),zK(a)}function $K(e,t){return e&&(!e.field&&!e.op?Wm(e)?e.field=`key`:e={field:`key`}:!e.field&&e.op!==`count`?V(`No field provided for sort aggregate op: `+e.op):t&&e.field&&e.op&&!HJ[e.op]&&V(`Multiple domain scales can not be sorted using `+e.op)),e}function EEe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||ZK(e.data),n.domainRef(t,e.field)});return zK(t.add(OJ({values:r})))}function DEe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||ZK(e.data),n.extentRef(t,e.field)});return zK(t.add(DJ({extents:r})))}function OEe(e,t){return e.signal||H(e)?XK(e,t):t.objectProperty(e)}function kEe(e,t){return e.signal?t.signalRef(e.signal):Wm(e)?{interval:YK(e.interval),step:YK(e.step)}:YK(e)}function AEe(e,t){t.interpolate=YK(e.type||e),e.gamma!=null&&(t.interpolateGamma=YK(e.gamma))}function eq(e,t,n){let r=t.config.range,i=e.range;if(i.signal)return t.signalRef(i.signal);if(Yh(i)){if(r&&Ih(r,i))return e=Mh({},e,{range:r[i]}),eq(e,t,n);i===`width`?i=[0,{signal:`width`}]:i===`height`?i=kD(e.type)?[0,{signal:`height`}]:[{signal:`height`},0]:V(`Unrecognized scale range value: `+W(i))}else if(i.scheme){n.scheme=H(i.scheme)?XK(i.scheme,t):YK(i.scheme,t),i.extent&&(n.schemeExtent=XK(i.extent,t)),i.count&&(n.schemeCount=YK(i.count,t));return}else if(i.step){n.rangeStep=YK(i.step,t);return}else if(kD(e.type)&&!H(i))return QK(i,e,t);else H(i)||V(`Unsupported range type: `+W(i));return i.map(e=>(H(e)?XK:YK)(e,t))}function jEe(e,t){let n=t.config.projection||{},r={};for(let n in e)n!==`name`&&(r[n]=tq(e[n],n,t));for(let e in n)r[e]??(r[e]=tq(n[e],e,t));t.addProjection(e.name,r)}function tq(e,t,n){return H(e)?e.map(e=>tq(e,t,n)):Wm(e)?e.signal?n.signalRef(e.signal):t===`fit`?e:V(`Unsupported parameter object: `+W(e)):e}function nq(e){return e.type=hY,e.interactive=e.interactive||!1,e}function rq(e,t){let n=(n,r)=>GK(e[n],GK(t[n],r));return n.isVertical=n=>JJ===GK(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>GK(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>GK(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>GK(e.columns,GK(t.columns,+n.isVertical(!0))),n}function iq(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function MEe(e,t,n){let r=t.config.style[n];return r&&r[e]}function aq(e,t,n){return`item.anchor === '${YJ}' ? ${e} : item.anchor === '${ZJ}' ? ${t} : ${n}`}function NEe(e){let t=e(`tickBand`),n=e(`tickOffset`),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},Wm(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t===`extent`?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e(`bandPosition`),i=e(`tickExtra`)),{extra:i,band:r,offset:n}}function oq(e,t){return t?e?Wm(e)?Object.assign({},e,{offset:oq(e.offset,t)}):{value:e,offset:t}:t:e}function sq(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=EK(e.encode,t,fY)):e.interactive=!1,e}function PEe(e,t,n,r){let i=rq(e,n),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength(),c,l,u,d,f;a?(l=[0,1],u=[0,0],d=o,f=s):(l=[0,0],u=[1,0],d=s,f=o);let p={enter:c={opacity:pY,x:pY,y:pY,width:Iq(d),height:Iq(f)},update:Mh({},c,{opacity:mY,fill:{gradient:t,start:l,stop:u}}),exit:{opacity:pY}};return TK(p,{stroke:i(`gradientStrokeColor`),strokeWidth:i(`gradientStrokeWidth`)},{opacity:i(`gradientOpacity`)}),sq({type:gY,role:Jq,encode:p},r)}function FEe(e,t,n,r,i){let a=rq(e,n),o=a.isVertical(),s=a.gradientThickness(),c=a.gradientLength(),l,u,d,f,p=``;o?(l=`y`,d=`y2`,u=`x`,f=`width`,p=`1-`):(l=`x`,d=`x2`,u=`y`,f=`height`);let m={opacity:pY,fill:{scale:t,field:nY}};m[l]={signal:p+`datum.perc`,mult:c},m[u]=pY,m[d]={signal:p+`datum.perc2`,mult:c},m[f]=Iq(s);let h={enter:m,update:Mh({},m,{opacity:mY}),exit:{opacity:pY}};return TK(h,{stroke:a(`gradientStrokeColor`),strokeWidth:a(`gradientStrokeWidth`)},{opacity:a(`gradientOpacity`)}),sq({type:gY,role:Kq,key:nY,from:i,encode:h},r)}function cq(e,t,n,r){let i=rq(e,t),a=i.isVertical(),o=Iq(i.gradientThickness()),s=i.gradientLength(),c=i(`labelOverlap`),l,u,d,f,p=``,m={enter:l={opacity:pY},update:u={opacity:mY,text:{field:$J}},exit:{opacity:pY}};return TK(m,{fill:i(`labelColor`),fillOpacity:i(`labelOpacity`),font:i(`labelFont`),fontSize:i(`labelFontSize`),fontStyle:i(`labelFontStyle`),fontWeight:i(`labelFontWeight`),limit:GK(e.labelLimit,t.gradientLabelLimit)}),a?(l.align={value:`left`},l.baseline=u.baseline={signal:SY},d=`y`,f=`x`,p=`1-`):(l.align=u.align={signal:xY},l.baseline={value:`top`},d=`x`,f=`y`),l[d]=u[d]={signal:p+`datum.perc`,mult:s},l[f]=u[f]=o,o.offset=GK(e.labelOffset,t.gradientLabelOffset)||0,c=c?{separation:i(`labelSeparation`),method:c,order:`datum.index`}:void 0,sq({type:yY,role:Yq,style:rY,key:nY,from:r,encode:m,overlap:c},n)}function IEe(e,t,n,r,i){let a=rq(e,t),o=n.entries,s=!!(o&&o.interactive),c=o?o.name:void 0,l=a(`clipHeight`),u=a(`symbolOffset`),d={data:`value`},f=`(${i}) ? datum.${eY} : datum.${uY}`,p=l?Iq(l):{field:uY},m=`datum.${QJ}`,h=`max(1, ${i})`,g,_,v,y,b;p.mult=.5,g={enter:_={opacity:pY,x:{signal:f,mult:.5,offset:u},y:p},update:v={opacity:mY,x:_.x,y:_.y},exit:{opacity:pY}};let x=null,S=null;e.fill||(x=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),TK(g,{fill:a(`symbolFillColor`,x),shape:a(`symbolType`),size:a(`symbolSize`),stroke:a(`symbolStrokeColor`,S),strokeDash:a(`symbolDash`),strokeDashOffset:a(`symbolDashOffset`),strokeWidth:a(`symbolStrokeWidth`)},{opacity:a(`symbolOpacity`)}),dY.forEach(t=>{e[t]&&(v[t]=_[t]={scale:e[t],field:nY})});let C=sq({type:vY,role:Xq,key:nY,from:d,clip:l?!0:void 0,encode:g},n.symbols),w=Iq(u);w.offset=a(`labelOffset`),g={enter:_={opacity:pY,x:{signal:f,offset:w},y:p},update:v={opacity:mY,text:{field:$J},x:_.x,y:_.y},exit:{opacity:pY}},TK(g,{align:a(`labelAlign`),baseline:a(`labelBaseline`),fill:a(`labelColor`),fillOpacity:a(`labelOpacity`),font:a(`labelFont`),fontSize:a(`labelFontSize`),fontStyle:a(`labelFontStyle`),fontWeight:a(`labelFontWeight`),limit:a(`labelLimit`)});let T=sq({type:yY,role:Yq,style:rY,key:nY,from:d,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:pY,height:l?Iq(l):pY,opacity:pY},exit:{opacity:pY},update:v={opacity:mY,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(y=`ceil(item.mark.items.length / ${h})`,v.row.signal=`${m}%${y}`,v.column.signal=`floor(${m} / ${y})`,b={field:[`row`,m]}):(v.row.signal=`floor(${m} / ${h})`,v.column.signal=`${m} % ${h}`,b={field:m}),v.column.signal=`(${i})?${v.column.signal}:${m}`,r={facet:{data:r,name:`value`,groupby:QJ}},nq({role:Rq,from:r,encode:EK(g,o,fY),marks:[C,T],name:c,interactive:s,sort:b})}function LEe(e,t){let n=rq(e,t);return{align:n(`gridAlign`),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n(`rowPadding`),column:n(`columnPadding`)}}}function REe(e,t,n,r){let i=rq(e,t),a={enter:{opacity:pY},update:{opacity:mY,x:{field:{group:`padding`}},y:{field:{group:`padding`}}},exit:{opacity:pY}};return TK(a,{orient:i(`titleOrient`),_anchor:i(`titleAnchor`),anchor:{signal:kY},angle:{signal:AY},align:{signal:OY},baseline:{signal:jY},text:e.title,fill:i(`titleColor`),fillOpacity:i(`titleOpacity`),font:i(`titleFont`),fontSize:i(`titleFontSize`),fontStyle:i(`titleFontStyle`),fontWeight:i(`titleFontWeight`),limit:i(`titleLimit`),lineHeight:i(`titleLineHeight`)},{align:i(`titleAlign`),baseline:i(`titleBaseline`)}),sq({type:yY,role:Zq,style:iY,from:r,encode:a},n)}function zEe(e,t){let n;return Wm(e)&&(e.signal?n=e.signal:e.path?n=`pathShape(`+lq(e.path)+`)`:e.sphere&&(n=`geoShape(`+lq(e.sphere)+`, {type: "Sphere"})`)),n?t.signalRef(n):!!e}function lq(e){return Wm(e)&&e.signal?e.signal:W(e)}function uq(e){let t=e.role||``;return t.startsWith(`axis`)||t.startsWith(`legend`)||t.startsWith(`title`)?t:e.type===hY?Rq:t||`mark`}function BEe(e){return{marktype:e.type,name:e.name||void 0,role:e.role||uq(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function VEe(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function dq(e,t){let n=ole(e.type);n||V(`Unrecognized transform type: `+W(e.type));let r=LK(n.type.toLowerCase(),null,fq(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function fq(e,t,n){let r={},i=e.params.length;for(let a=0;apq(e,t,n)):pq(e,i,n)}function pq(e,t,n){let r=e.type;if(UK(t))return FY(r)?V(`Expression references can not be signals.`):IY(r)?n.fieldRef(t):LY(r)?n.compareRef(t):n.signalRef(t.signal);{let i=e.expr||IY(r);return i&&MY(t)?n.exprRef(t.expr,t.as):i&&NY(t)?BK(t.field,t.as):FY(r)?RW(t,n):PY(r)?zK(n.getData(t).values):IY(r)?BK(t):LY(r)?n.compareRef(t):t}}function UEe(e,t,n){return Yh(t.from)||V(`Lookup "from" parameter must be a string literal.`),n.getData(t.from).lookupRef(n,t.key)}function WEe(e,t,n){let r=t[e.name];return e.array?(H(r)||V(`Expected an array of sub-parameters. Instead: `+W(r)),r.map(t=>mq(e,t,n))):mq(e,r,n)}function mq(e,t,n){let r=e.params.length,i;for(let n=0;ne??`null`).join(`,`)+`),0)`,t);c.update=l.$expr,c.params=l.$params}function xq(e,t){let n=uq(e),r=e.type===hY,i=e.from&&e.from.facet,a=e.overlap,o=e.layout||n===`scope`||n===`frame`,s,c,l,u,d,f,p,m=n===`mark`||o||i,h=GEe(e.from,r,t);c=t.add(vJ({key:h.key||(e.key?BK(e.key):void 0),pulse:h.pulse,clean:!r}));let g=zK(c);c=l=t.add(gJ({pulse:g})),c=t.add(EJ({markdef:BEe(e),interactive:VEe(e.interactive,t),clip:zEe(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef(`parent`):null,index:t.markpath(),pulse:zK(c)}));let _=zK(c);c=u=t.add(yJ(NK(e.encode,e.type,n,e.style,t,{mod:!1,pulse:_}))),c.params.parent=t.encode(),e.transform&&e.transform.forEach(e=>{let n=dq(e,t),r=n.metadata;(r.generates||r.changes)&&V(`Mark transforms should not generate new data.`),r.nomod||(u.params.mod=!0),n.params.pulse=zK(c),t.add(c=n)}),e.sort&&(c=t.add(RJ({sort:t.compareRef(e.sort),pulse:zK(c)})));let v=zK(c);(i||o)&&(o=t.add(zJ({layout:t.objectProperty(e.layout),legends:t.legends,mark:_,pulse:v})),f=zK(o));let y=t.add(hJ({mark:_,pulse:f||v}));p=zK(y),r&&(m&&(s=t.operators,s.pop(),o&&s.pop()),t.pushState(v,f||p,g),i?KEe(e,t,h):m?qEe(e,t,h):t.parse(e),t.popState(),m&&(o&&s.push(o),s.push(y))),a&&(p=JEe(a,p,t));let b=t.add(FJ({pulse:p})),x=t.add(LJ({pulse:zK(b)},void 0,t.parent()));e.name!=null&&(d=e.name,t.addData(d,new gq(t,l,b,x)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&V(`Marks only support modify triggers.`),bq(e,t,d)}))}function JEe(e,t,n){let r=e.method,i=e.bound,a=e.separation,o={separation:UK(a)?n.signalRef(a.signal):a,method:UK(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),i){let e=i.tolerance;o.boundTolerance=UK(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return zK(n.add(kJ(o)))}function YEe(e,t){let n=t.config.legend,r=e.encode||{},i=rq(e,n),a=r.legend||{},o=a.name||void 0,s=a.interactive,c=a.style,l={},u=0,d,f,p;dY.forEach(t=>e[t]?(l[t]=e[t],u||=e[t]):0),u||V(`Missing valid scale for legend.`);let m=XEe(e,t.scaleType(u)),h={title:e.title!=null,scales:l,type:m,vgrad:m!==`symbol`&&i.isVertical()},g=zK(t.add(gJ(null,[h]))),_={enter:{x:{value:0},y:{value:0}}},v=zK(t.add(wJ(f={type:m,scale:t.scaleRef(u),count:t.objectProperty(i(`tickCount`)),limit:t.property(i(`symbolLimit`)),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===cY?(p=[PEe(e,u,n,r.gradient),cq(e,n,r.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${KK(i.gradientLength())})/100))`)):m===lY?p=[FEe(e,u,n,r.gradient,v),cq(e,n,r.labels,v)]:(d=LEe(e,n),p=[IEe(e,n,r,v,KK(d.columns))],f.size=$Ee(e,t,p[0].marks)),p=[nq({role:qq,from:g,encode:_,marks:p,layout:d,interactive:s})],h.title&&p.push(REe(e,n,r.title,g)),xq(nq({role:Gq,from:g,encode:EK(QEe(i,e,n),a,fY),marks:p,aria:i(`aria`),description:i(`description`),zindex:i(`zindex`),name:o,interactive:s,style:c}),t)}function XEe(e,t){let n=e.type||sY;return!e.type&&ZEe(e)===1&&(e.fill||e.stroke)&&(n=OD(t)?cY:AD(t)?lY:sY),n===cY?AD(t)?lY:cY:n}function ZEe(e){return dY.reduce((t,n)=>t+ +!!e[n],0)}function QEe(e,t,n){let r={enter:{},update:{}};return TK(r,{orient:e(`orient`),offset:e(`offset`),padding:e(`padding`),titlePadding:e(`titlePadding`),cornerRadius:e(`cornerRadius`),fill:e(`fillColor`),stroke:e(`strokeColor`),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e(`legendX`),y:e(`legendY`),format:t.format,formatType:t.formatType}),r}function $Ee(e,t,n){return RW(`max(ceil(sqrt(${KK(Sq(`size`,e,n))})+${KK(Sq(`strokeWidth`,e,n))}),${KK(eDe(n[1].encode,t,rY))})`,t)}function Sq(e,t,n){return t[e]?`scale("${t[e]}",datum)`:iq(e,n[0].encode)}function eDe(e,t,n){return iq(`fontSize`,e)||MEe(`fontSize`,t,n)}function tDe(e,t){e=Yh(e)?{text:e}:e;let n=rq(e,t.config.title),r=e.encode||{},i=r.group||{},a=i.name||void 0,o=i.interactive,s=i.style,c=[],l=zK(t.add(gJ(null,[{}])));return c.push(iDe(e,n,nDe(e),l)),e.subtitle&&c.push(aDe(e,n,r.subtitle,l)),xq(nq({role:Qq,from:l,encode:rDe(n,i),marks:c,aria:n(`aria`),description:n(`description`),zindex:n(`zindex`),name:a,interactive:o,style:s}),t)}function nDe(e){let t=e.encode;return t&&t.title||Mh({name:e.name,interactive:e.interactive,style:e.style},t)}function rDe(e,t){let n={enter:{},update:{}};return TK(n,{orient:e(`orient`),anchor:e(`anchor`),align:{signal:bY},angle:{signal:RY},limit:e(`limit`),frame:e(`frame`),offset:e(`offset`)||0,padding:e(`subtitlePadding`)}),EK(n,t,fY)}function iDe(e,t,n,r){let i={value:0},a=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return TK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`color`),font:t(`font`),fontSize:t(`fontSize`),fontStyle:t(`fontStyle`),fontWeight:t(`fontWeight`),lineHeight:t(`lineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),sq({type:yY,role:$q,style:aY,from:r,encode:o},n)}function aDe(e,t,n,r){let i={value:0},a=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return TK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`subtitleColor`),font:t(`subtitleFont`),fontSize:t(`subtitleFontSize`),fontStyle:t(`subtitleFontStyle`),fontWeight:t(`subtitleFontWeight`),lineHeight:t(`subtitleLineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),sq({type:yY,role:eJ,style:oY,from:r,encode:o},n)}function oDe(e,t){let n=[];e.transform&&e.transform.forEach(e=>{n.push(dq(e,t))}),e.on&&e.on.forEach(n=>{bq(n,t,e.name)}),t.addDataPipeline(e.name,sDe(e,t,n))}function sDe(e,t,n){let r=[],i=null,a=!1,o=!1,s,c,l,u,d;for(e.values?UK(e.values)||WK(e.format)?(r.push(wq(t,e)),r.push(i=Cq())):r.push(i=Cq({$ingest:e.values,$format:e.format})):e.url?WK(e.url)||WK(e.format)?(r.push(wq(t,e)),r.push(i=Cq())):r.push(i=Cq({$request:e.url,$format:e.format})):e.source&&(i=s=yh(e.source).map(e=>zK(t.getData(e).output)),r.push(null)),c=0,l=n.length;ce==null?!DK(t,r):(n.update[t]=nX(Iq(e),n.update[t]),!1),a=i(e(`titleX`),`x`),o=i(e(`titleY`),`y`);n.enter.auto=o===a?Iq(o):VY(t,Iq(o),Iq(a))}function gDe(e,t){let n=cDe(e,t),r=e.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,c=rq(e,n),l=NEe(c),u={scale:e.scale,ticks:!!c(`ticks`),labels:!!c(`labels`),grid:!!c(`grid`),domain:!!c(`domain`),title:e.title!=null},d=zK(t.add(gJ({},[u]))),f=zK(t.add(mJ({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[],m;return u.grid&&p.push(uDe(e,n,r.grid,f,l)),u.ticks&&(m=c(`tickSize`),p.push(fDe(e,n,r.ticks,f,m,l))),u.labels&&(m=u.ticks?m:0,p.push(pDe(e,n,r.labels,f,m,l))),u.domain&&p.push(lDe(e,n,r.domain,d)),u.title&&p.push(mDe(e,n,r.title,d)),xq(nq({role:zq,from:d,encode:EK(_De(c,e),i,fY),marks:p,aria:c(`aria`),description:c(`description`),zindex:c(`zindex`),name:a,interactive:o,style:s}),t)}function _De(e,t){let n={enter:{},update:{}};return TK(n,{orient:e(`orient`),offset:e(`offset`)||0,position:GK(t.position,0),titlePadding:e(`titlePadding`),minExtent:e(`minExtent`),maxExtent:e(`maxExtent`),range:{signal:`abs(span(range("${t.scale}")))`},translate:e(`translate`),format:t.format,formatType:t.formatType}),n}function kq(e,t,n){let r=yh(e.signals),i=yh(e.scales);return n||r.forEach(e=>FK(e,t)),yh(e.projections).forEach(e=>jEe(e,t)),i.forEach(e=>yEe(e,t)),yh(e.data).forEach(e=>oDe(e,t)),i.forEach(e=>bEe(e,t)),(n||r).forEach(e=>vEe(e,t)),yh(e.axes).forEach(e=>gDe(e,t)),yh(e.marks).forEach(e=>xq(e,t)),yh(e.legends).forEach(e=>YEe(e,t)),e.title&&tDe(e.title,t),t.parseLambdas(),t}function vDe(e,t){let n=t.config,r=zK(t.root=t.add(RK())),i=yDe(e,n);i.forEach(e=>FK(e,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let a=t.add(gJ()),o=t.add(yJ(NK(rX(e.encode),hY,Lq,e.style,t,{pulse:zK(a)}))),s=t.add(zJ({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef(`autosize`),mark:r,pulse:zK(o)}));t.operators.pop(),t.pushState(zK(o),zK(s),null),kq(e,t,i),t.operators.push(s);let c=t.add(hJ({mark:r,pulse:zK(s)}));return c=t.add(FJ({pulse:zK(c)})),c=t.add(LJ({pulse:zK(c)})),t.addData(`root`,new gq(t,a,a,c)),t}function Aq(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function yDe(e,t){let n=n=>GK(e[n],t[n]),r=[Aq(`background`,n(`background`)),Aq(`autosize`,ZTe(n(`autosize`))),Aq(`padding`,QTe(n(`padding`))),Aq(`width`,n(`width`)||0),Aq(`height`,n(`height`)||0)],i=r.reduce((e,t)=>(e[t.name]=t,e),{}),a={};return yh(e.signals).forEach(e=>{Ih(i,e.name)?e=Mh(i[e.name],e):r.push(e),a[e.name]=e}),yh(t.signals).forEach(e=>{!Ih(a,e.name)&&!Ih(i,e.name)&&r.push(e)}),r}function jq(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Mq(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function Nq(e){return(H(e)?bDe:xDe)(e)}function bDe(e){let t=e.length,n=`[`;for(let r=0;r0?`,`:``)+(Wm(t)?t.signal||Nq(t):W(t))}return n+`]`}function xDe(e){let t=`{`,n=0,r,i;for(r in e)i=e[r],t+=(++n>1?`,`:``)+W(r)+`:`+(Wm(i)?i.signal||Nq(i):W(i));return t+`}`}function SDe(){let e=`sans-serif`,t=`#4c78a8`,n=`#000`,r=`#888`,i=`#ddd`;return{description:`Vega visualization`,padding:0,autosize:`pad`,background:null,events:{defaults:{allow:[`wheel`]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:`bold`},"group-title":{fill:n,font:e,fontSize:13,fontWeight:`bold`},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:`circle`},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:`square`},cell:{fill:`transparent`,stroke:i},view:{fill:`transparent`}},title:{orient:`top`,anchor:`middle`,offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:`mercator`},legend:{orient:`right`,padding:0,gridAlign:`each`,columnPadding:10,rowPadding:2,symbolDirection:`vertical`,gradientDirection:`vertical`,gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:`left`,labelBaseline:`middle`,labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:`circle`,symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:`transparent`,symbolBaseStrokeColor:r,titleLimit:180,titleOrient:`top`,titlePadding:5,layout:{offset:18,direction:`horizontal`,left:{direction:`vertical`},right:{direction:`vertical`}}},range:{category:{scheme:`tableau10`},ordinal:{scheme:`blues`},heatmap:{scheme:`yellowgreenblue`},ramp:{scheme:`blues`},diverging:{scheme:`blueorange`,extent:[1,0]},symbol:[`circle`,`square`,`triangle-up`,`cross`,`diamond`,`triangle-right`,`triangle-down`,`triangle-left`]}}}function CDe(e,t,n){return Wm(e)||V(`Input Vega specification must be an object.`),t=Km(SDe(),t,e.config),vDe(e,new jq(t,n)).toRuntime()}var Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ,OJ,kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,wDe=o((()=>{pg(),aG(),CK(),FO(),ax(),Pq=e=>+e||0,Fq=e=>({top:e,bottom:e,left:e,right:e}),Iq=e=>Wm(e)&&!H(e)?Mh({},e):{value:e},Lq=`frame`,Rq=`scope`,zq=`axis`,Bq=`axis-domain`,Vq=`axis-grid`,Hq=`axis-label`,Uq=`axis-tick`,Wq=`axis-title`,Gq=`legend`,Kq=`legend-band`,qq=`legend-entry`,Jq=`legend-gradient`,Yq=`legend-label`,Xq=`legend-symbol`,Zq=`legend-title`,Qq=`title`,$q=`title-text`,eJ=`title-subtitle`,tJ=e=>Yh(e)?W(e):e.signal?`(${e.signal})`:jK(e),nJ=(e,t,n,r)=>`(${e}(${[t,n,r].map(kK).join(`,`)})+'')`,rJ=`outer`,iJ=[`value`,`update`,`init`,`react`,`bind`],aJ=BK(`key`),oJ=`ascending`,sJ=`descending`,cJ=`scope`,lJ=`view`,uJ=`timer`,dJ={code:`_.$value`,ast:{type:`Identifier`,value:`value`}},fJ=e=>(t,n,r)=>LK(e,n,t||void 0,r),pJ=fJ(`aggregate`),mJ=fJ(`axisticks`),hJ=fJ(`bound`),gJ=fJ(`collect`),_J=fJ(`compare`),vJ=fJ(`datajoin`),yJ=fJ(`encode`),bJ=fJ(`expression`),xJ=fJ(`facet`),SJ=fJ(`field`),CJ=fJ(`key`),wJ=fJ(`legendentries`),TJ=fJ(`load`),EJ=fJ(`mark`),DJ=fJ(`multiextent`),OJ=fJ(`multivalues`),kJ=fJ(`overlap`),AJ=fJ(`params`),jJ=fJ(`prefacet`),MJ=fJ(`projection`),NJ=fJ(`proxy`),PJ=fJ(`relay`),FJ=fJ(`render`),IJ=fJ(`scale`),LJ=fJ(`sieve`),RJ=fJ(`sortitems`),zJ=fJ(`viewlayout`),BJ=fJ(`values`),VJ=0,HJ={min:`min`,max:`max`,count:`sum`},UJ=`top`,WJ=`left`,GJ=`right`,KJ=`bottom`,qJ=`center`,JJ=`vertical`,YJ=`start`,XJ=`middle`,ZJ=`end`,QJ=`index`,$J=`label`,eY=`offset`,tY=`perc`,nY=`value`,rY=`guide-label`,iY=`guide-title`,aY=`group-title`,oY=`group-subtitle`,sY=`symbol`,cY=`gradient`,lY=`discrete`,uY=`size`,dY=[uY,`shape`,`fill`,`stroke`,`strokeWidth`,`strokeDash`,`opacity`],fY={name:1,style:1,interactive:1},pY={value:0},mY={value:1},hY=`group`,gY=`rect`,_Y=`rule`,vY=`symbol`,yY=`text`,bY=aq(W(WJ),W(GJ),W(qJ)),xY=`datum.${tY}<=0?"${WJ}":datum.${tY}>=1?"${GJ}":"${qJ}"`,SY=`datum.${tY}<=0?"${KJ}":datum.${tY}>=1?"${UJ}":"${XJ}"`,CY=`item.orient === "left"`,wY=`item.orient === "right"`,TY=`(${CY} || ${wY})`,EY=`datum.vgrad && ${TY}`,DY=aq(`"top"`,`"bottom"`,`"middle"`),OY=`datum.vgrad && ${wY} ? (${aq(`"right"`,`"left"`,`"center"`)}) : (${TY} && !(datum.vgrad && ${CY})) ? "left" : ${bY}`,kY=`item._anchor || (${TY} ? "middle" : "start")`,AY=`${EY} ? (${CY} ? -90 : 90) : 0`,jY=`${TY} ? (datum.vgrad ? (${wY} ? "bottom" : "top") : ${DY}) : "top"`,MY=e=>e&&e.expr,NY=e=>e&&e.field,PY=e=>e===`data`,FY=e=>e===`expr`,IY=e=>e===`field`,LY=e=>e===`compare`,gq.fromEntries=function(e,t){let n=t.length,r=t[n-1],i=t[n-2],a=t[0],o=null,s=1;for(a&&a.type===`load`&&(a=t[1]),e.add(t[0]);se===KJ||e===UJ,BY=(e,t,n)=>UK(e)?qY(e.signal,t,n):e===WJ||e===UJ?t:n,VY=(e,t,n)=>UK(e)?GY(e.signal,t,n):zY(e)?t:n,HY=(e,t,n)=>UK(e)?KY(e.signal,t,n):zY(e)?n:t,UY=(e,t,n)=>UK(e)?JY(e.signal,t,n):e===UJ?{value:t}:{value:n},WY=(e,t,n)=>UK(e)?YY(e.signal,t,n):e===GJ?{value:t}:{value:n},GY=(e,t,n)=>XY(`${e} === '${UJ}' || ${e} === '${KJ}'`,t,n),KY=(e,t,n)=>XY(`${e} !== '${UJ}' && ${e} !== '${KJ}'`,t,n),qY=(e,t,n)=>QY(`${e} === '${WJ}' || ${e} === '${UJ}'`,t,n),JY=(e,t,n)=>QY(`${e} === '${UJ}'`,t,n),YY=(e,t,n)=>QY(`${e} === '${GJ}'`,t,n),XY=(e,t,n)=>(t=t==null?t:Iq(t),n=n==null?n:Iq(n),ZY(t)&&ZY(n)?(t=t?t.signal||W(t.value):null,n=n?n.signal||W(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[Mh({test:e},t)].concat(n||[])),ZY=e=>e==null||Object.keys(e).length===1,QY=(e,t,n)=>({signal:`${e} ? (${eX(t)}) : (${eX(n)})`}),$Y=(e,t,n,r,i)=>({signal:(r==null?``:`${e} === '${WJ}' ? (${eX(r)}) : `)+(n==null?``:`${e} === '${KJ}' ? (${eX(n)}) : `)+(i==null?``:`${e} === '${GJ}' ? (${eX(i)}) : `)+(t==null?``:`${e} === '${UJ}' ? (${eX(t)}) : `)+`(null)`}),eX=e=>UK(e)?e.signal:e==null?null:W(e),tX=(e,t)=>t===0?0:UK(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},nX=(e,t)=>{let n=e.signal;return n&&n.endsWith(`(null)`)?{signal:n.slice(0,-6)+t.signal}:e},rX=e=>EK({enter:{x:{value:0},y:{value:0}},update:{width:{signal:`width`},height:{signal:`height`}}},e),jq.prototype=Mq.prototype={parse(e){return kq(e,this)},fork(){return new Mq(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+`:`:0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&=(e.refs.forEach(t=>{t.$ref=e.id}),null),e},proxy(e){let t=e instanceof IK?zK(e):e;return this.add(NJ({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let r,i;e&&(r=e.data||={},i=r[t]||(r[t]=[]),i.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,`input`),n(t.output,e,`output`),n(t.values,e,`values`);for(let r in t.index)n(t.index[r],e,`index:`+r)}return this},pushState(e,t,n){this._encode.push(zK(this.add(LJ({pulse:e})))),this._parent.push(t),this._lookup.push(n?zK(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Ym(this._parent)},encode(){return Ym(this._encode)},lookup(){return Ym(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Yh(e))return BK(e,t);e.signal||V(`Unsupported field reference: `+W(e));let n=e.signal,r=this.field[n];if(!r){let e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=r=zK(this.add(SJ(e)))}return r},compareRef(e){let t=!1,n=e=>UK(e)?(t=!0,this.signalRef(e.signal)):lEe(e)?(t=!0,this.exprRef(e.expr)):e,r=yh(e.field).map(n),i=yh(e.order).map(n);return t?zK(this.add(_J({fields:r,orders:i}))):VK(r,i)},keyRef(e,t){let n=!1,r=e=>UK(e)?(n=!0,zK(i[e.signal])):e,i=this.signals;return e=yh(e).map(r),n?zK(this.add(CJ({fields:e,flat:t}))):sEe(e,t)},sortRef(e){if(!e)return e;let t=HK(e.op,e.field),n=e.order||oJ;return n.signal?zK(this.add(_J({fields:t,orders:this.signalRef(n.signal)}))):VK(t,n)},event(e,t){let n=e+`:`+t;if(!this.events[n]){let r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return Ih(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&V(`Duplicate signal name: `+W(e));let n=t instanceof IK?t:this.add(RK(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||V(`Unrecognized signal name: `+W(e)),this.signals[e]},signalRef(e){return this.signals[e]?zK(this.signals[e]):(Ih(this.lambdas,e)||(this.lambdas[e]=this.add(RK(null))),zK(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;tYO,CanvasHandler:()=>pj,CanvasRenderer:()=>hj,DATE:()=>yy,DAY:()=>`day`,DAYOFYEAR:()=>by,Dataflow:()=>Ub,Debug:()=>4,DisallowedObjectProperties:()=>Vm,Error:()=>1,EventStream:()=>Lb,Gradient:()=>zO,GroupItem:()=>ZO,HOURS:()=>xy,Handler:()=>UA,HybridHandler:()=>Gj,HybridRenderer:()=>Wj,Info:()=>3,Item:()=>XO,MILLISECONDS:()=>wy,MINUTES:()=>Sy,MONTH:()=>_y,Marks:()=>BA,MultiPulse:()=>Hb,None:()=>0,Operator:()=>Ib,Parameters:()=>Fb,Pulse:()=>zb,QUARTER:()=>gy,RenderType:()=>Zj,Renderer:()=>WA,ResourceLoader:()=>_A,SECONDS:()=>Cy,SVGHandler:()=>_j,SVGRenderer:()=>Rj,SVGStringRenderer:()=>Hj,Scenegraph:()=>HA,TIME_UNITS:()=>Ty,Transform:()=>G,View:()=>VG,WEEK:()=>vy,Warn:()=>2,YEAR:()=>hy,accessor:()=>Sm,accessorFields:()=>wm,accessorName:()=>Cm,array:()=>yh,ascending:()=>Eh,bandwidthNRD:()=>cx,bin:()=>vle,bootstrapCI:()=>ble,boundClip:()=>whe,boundContext:()=>ek,boundItem:()=>Rk,boundMark:()=>Fme,boundStroke:()=>$O,changeset:()=>Pb,clampRange:()=>xh,codegenExpression:()=>WH,compare:()=>wh,constant:()=>Ah,cumulativeLogNormal:()=>_x,cumulativeNormal:()=>dx,cumulativeUniform:()=>xx,dayofyear:()=>Gv,debounce:()=>jh,defaultLocale:()=>fb,definition:()=>ole,densityLogNormal:()=>gx,densityNormal:()=>ux,densityUniform:()=>bx,detectTimeUnits:()=>my,domChild:()=>Vk,domClear:()=>Hk,domCreate:()=>zk,domFind:()=>Bk,dotbin:()=>xle,error:()=>V,expressionFunction:()=>LW,extend:()=>Mh,extent:()=>Ph,extentIndex:()=>Fh,falsy:()=>Bm,fastmap:()=>Rh,field:()=>Nm,flush:()=>Bh,font:()=>Pk,fontFamily:()=>Nk,fontSize:()=>Ok,format:()=>Cb,formatLocale:()=>ub,formats:()=>yb,hasOwnProperty:()=>Ih,id:()=>Fm,identity:()=>Im,inferType:()=>cce,inferTypes:()=>lce,ingest:()=>Ab,inherits:()=>U,inrange:()=>Vh,interpolate:()=>zD,interpolateColors:()=>ID,interpolateRange:()=>FD,intersect:()=>yhe,intersectBoxLine:()=>rk,intersectPath:()=>tk,intersectPoint:()=>nk,intersectRule:()=>Bpe,isArray:()=>H,isBoolean:()=>Hh,isDate:()=>Uh,isFunction:()=>Sh,isIterable:()=>Gh,isNumber:()=>Kh,isObject:()=>Wm,isRegExp:()=>Jh,isString:()=>Yh,isTuple:()=>Ob,key:()=>Zh,lerp:()=>Qh,lineHeight:()=>kk,loader:()=>wb,locale:()=>ece,logger:()=>Hm,lruCache:()=>$h,markup:()=>Gk,merge:()=>tg,mergeConfig:()=>Km,multiLineOffset:()=>jk,one:()=>Rm,pad:()=>ig,panLinear:()=>th,panLog:()=>nh,panPow:()=>rh,panSymlog:()=>ih,parse:()=>CDe,parseExpression:()=>HH,parseSelector:()=>oK,path:()=>cC,pathCurves:()=>BO,pathEqual:()=>The,pathParse:()=>VO,pathRectangle:()=>Epe,pathRender:()=>HO,pathSymbols:()=>bpe,pathTrail:()=>Dpe,peek:()=>Ym,point:()=>Uk,projection:()=>sR,quantileLogNormal:()=>vx,quantileNormal:()=>fx,quantileUniform:()=>Sx,quantiles:()=>ox,quantizeInterpolator:()=>LD,quarter:()=>_h,quartiles:()=>sx,random:()=>jx,randomInteger:()=>wle,randomKDE:()=>mx,randomLCG:()=>Cle,randomLogNormal:()=>Ele,randomMixture:()=>Dle,randomNormal:()=>px,randomUniform:()=>Ole,read:()=>hce,regressionConstant:()=>Cx,regressionExp:()=>Ale,regressionLinear:()=>Ox,regressionLoess:()=>Fle,regressionLog:()=>kle,regressionPoly:()=>Mle,regressionPow:()=>jle,regressionQuad:()=>kx,renderModule:()=>Xk,repeat:()=>ng,resetDefaultLocale:()=>tce,resetSVGDefIds:()=>Dhe,responseType:()=>mce,runtimeContext:()=>lG,sampleCurve:()=>Ax,sampleLogNormal:()=>hx,sampleNormal:()=>lx,sampleUniform:()=>yx,scale:()=>TD,sceneEqual:()=>Zk,sceneFromJSON:()=>Lme,scenePickVisit:()=>uk,sceneToJSON:()=>Ime,sceneVisit:()=>lk,sceneZOrder:()=>ck,scheme:()=>HD,serializeXML:()=>jj,setHybridRendererOptions:()=>vhe,setRandom:()=>yle,span:()=>ag,splitAccessPath:()=>jm,stringValue:()=>W,textMetrics:()=>RA,timeBin:()=>py,timeFloor:()=>ry,timeFormatLocale:()=>db,timeInterval:()=>ay,timeOffset:()=>cy,timeSequence:()=>dy,timeUnitSpecifier:()=>Uv,timeUnits:()=>Hv,toBoolean:()=>og,toDate:()=>sg,toNumber:()=>Zm,toSet:()=>ug,toString:()=>lg,transform:()=>sle,transforms:()=>ix,truncate:()=>dg,truthy:()=>zm,tupleid:()=>kb,typeParsers:()=>xb,utcFloor:()=>iy,utcInterval:()=>oy,utcOffset:()=>ly,utcSequence:()=>fy,utcdayofyear:()=>Xv,utcquarter:()=>vh,utcweek:()=>Zv,version:()=>aX,visitArray:()=>fg,week:()=>Kv,writeConfig:()=>qm,zero:()=>Lm,zoomLinear:()=>oh,zoomLog:()=>sh,zoomPow:()=>ch,zoomSymlog:()=>lh}),iX,aX,oX=o((()=>{pg(),pg(),ax(),Aue(),Xge(),m_e(),_ye(),Abe(),tSe(),_Se(),ySe(),GSe(),eCe(),oCe(),Ix(),Xy(),Tb(),tM(),FO(),fR(),KTe(),gb(),aG(),wDe(),_G(),WU(),CK(),iX=`6.3.1`,Mh(ix,Ule,Dge,Zge,Zve,wbe,nSe,Zxe,vSe,HSe,KSe,tCe),aX=iX}));function EDe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}function sX(e,t,n,r,i,a){let o=e=>_X[e.type](o,e);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=r,o.event=i,o.item=a,hX.forEach(e=>o.fn[e]=(...t)=>i.vega[e](...t)),o(e)}var cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,DDe=o((()=>{pg(),cX={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},lX={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},uX={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e},dX=Array.prototype.slice,fX=(e,t,n)=>{let r=n?n(t[0]):t[0];return r[e].apply(r,dX.call(t,1))},pX=(e,t=0,n=1,r=0,i=0,a=0,o=0)=>Yh(e)?new Date(e):new Date(e,t,n,r,i,a,o),mX={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:pX,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return fX(`join`,arguments)},indexof:function(){return fX(`indexOf`,arguments)},lastindexof:function(){return fX(`lastIndexOf`,arguments)},slice:function(){return fX(`slice`,arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(Eh),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return fX(`substring`,arguments,String)},split:function(){return fX(`split`,arguments,String)},replace:function(){return fX(`replace`,arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),encodeURIComponent:e=>encodeURIComponent(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)},hX=[`view`,`item`,`group`,`xy`,`x`,`y`],gX=new Set([Function,eval,setTimeout,setInterval]),typeof setImmediate==`function`&&gX.add(setImmediate),_X={Literal:(e,t)=>t.value,Identifier:(e,t)=>{let n=t.name;return e.memberDepth>0?n:n===`datum`?e.datum:n===`event`?e.event:n===`item`?e.item:cX[n]||e.params[`$`+n]},MemberExpression:(e,t)=>{let n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);let i=e(t.property);if(n&&--e.memberDepth,gX.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{let n=t.arguments,r=t.callee.name;return r.startsWith(`_`)&&(r=r.slice(1)),r===`if`?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||mX[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>lX[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>uX[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator===`&&`?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((t,n)=>{e.memberDepth+=1;let r=e(n.key);--e.memberDepth;let i=e(n.value);return Vm.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):gX.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):t[r]=i,t},{})},vX={operator(e,t){let n=t.ast,r=e.functions;return e=>sX(n,r,e)},parameter(e,t){let n=t.ast,r=e.functions;return(e,t)=>sX(n,r,t,e)},event(e,t){let n=t.ast,r=e.functions;return e=>sX(n,r,void 0,void 0,e)},handler(e,t){let n=t.ast,r=e.functions;return(e,t)=>{let i=t.item&&t.item.datum;return sX(n,r,e,i,t)}},encode(e,t){let{marktype:n,channels:r}=t,i=e.functions,a=n===`group`||n===`image`||n===`rect`;return(e,t)=>{let o=e.datum,s=0,c;for(let n in r)c=sX(r[n].ast,i,t,o,void 0,e),e[n]!==c&&(e[n]=c,s=1);return n!==`rule`&&EDe(e,r,a),s}}}}));function yX(e){this.type=e}function ODe(e){switch(e.type){case tZ:return e.elements;case nZ:case aZ:return[e.left,e.right];case rZ:return[e.callee].concat(e.arguments);case iZ:return[e.test,e.consequent,e.alternate];case oZ:return[e.object,e.property];case sZ:return e.properties;case $X:return[e.key,e.value];case cZ:return[e.argument];case eZ:case QX:case ZX:default:return[]}}function bX(e,t){if(!e)throw Error(`ASSERT: `+t)}function xX(e){return e>=48&&e<=57}function SX(e){return`0123456789abcdefABCDEF`.includes(e)}function CX(e){return`01234567`.includes(e)}function kDe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function wX(e){return e===10||e===13||e===8232||e===8233}function TX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&GZ.test(String.fromCharCode(e))}function EX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&KZ.test(String.fromCharCode(e))}function DX(){for(;J1114111||e!==`}`)&&BX({},NZ,UZ),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function kX(){var e=uZ.charCodeAt(J++),t=String.fromCharCode(e);for(e===92&&(uZ.charCodeAt(J)!==117&&BX({},NZ,UZ),++J,e=OX(`u`),(!e||e===`\\`||!TX(e.charCodeAt(0)))&&BX({},NZ,UZ),t=e);J>>=`)return J+=4,{type:yZ,value:o,start:e,end:J};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return J+=3,{type:yZ,value:a,start:e,end:J};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return J+=2,{type:yZ,value:i,start:e,end:J};if(i===`//`&&BX({},NZ,UZ),`<>=!+-*%&|^/`.includes(r))return++J,{type:yZ,value:r,start:e,end:J};BX({},NZ,UZ)}function NDe(e){let t=``;for(;J{if(parseInt(t,16)<=1114111)return`x`;BX({},zZ)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{BX({},zZ)}try{return new RegExp(e,t)}catch{return null}}function LDe(){var e=uZ[J],t,n,r,i;for(bX(e===`/`,`Regular expression literal must start with a slash`),t=uZ[J++],n=!1,r=!1;J=0&&BX({},zZ,n),{value:n,literal:t}}function zDe(){var e,t,n,r;return fZ=null,DX(),e=J,t=LDe(),n=RDe(),r=IDe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:J}}function BDe(e){return e.type===hZ||e.type===gZ||e.type===pZ||e.type===_Z}function MX(){if(DX(),J>=dZ)return{type:mZ,start:J,end:J};let e=uZ.charCodeAt(J);return TX(e)?MDe():e===40||e===41||e===59?AX():e===39||e===34?FDe():e===46?xX(uZ.charCodeAt(J+1))?jX():AX():xX(e)?jX():AX()}function NX(){let e=fZ;return J=e.end,fZ=MX(),J=e.end,e}function PX(){let e=J;fZ=MX(),J=e}function VDe(e){let t=new yX(SZ);return t.elements=e,t}function FX(e,t,n){let r=new yX(e===`||`||e===`&&`?OZ:CZ);return r.operator=e,r.left=t,r.right=n,r}function HDe(e,t){let n=new yX(wZ);return n.callee=e,n.arguments=t,n}function UDe(e,t,n){let r=new yX(TZ);return r.test=e,r.consequent=t,r.alternate=n,r}function IX(e){let t=new yX(EZ);return t.name=e,t}function LX(e){let t=new yX(DZ);return t.value=e.value,t.raw=uZ.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function RX(e,t,n){let r=new yX(kZ);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function WDe(e){let t=new yX(AZ);return t.properties=e,t}function zX(e,t,n){let r=new yX(jZ);return r.key=t,r.value=n,r.kind=e,r}function GDe(e,t){let n=new yX(MZ);return n.operator=e,n.argument=t,n.prefix=!0,n}function BX(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(bX(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function nOe(){var e=fZ,t,n,r,i,a,o,s,c=qX(),l;if(r=fZ,i=JX(r),i===0)return c;for(r.prec=i,NX(),t=[e,fZ],o=qX(),a=[c,r,o];(i=JX(fZ))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=FX(s,c,o),a.push(n);r=NX(),r.prec=i,a.push(r),t.push(fZ),n=qX(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=FX(a[l-1].value,a[l-2],n),l-=2;return n}function YX(){var e=nOe(),t,n;return UX(`?`)&&(NX(),t=YX(),HX(`:`),n=YX(),e=UDe(e,t,n)),e}function XX(){let e=YX();if(UX(`,`))throw Error(WZ);return e}function rOe(e){uZ=e,J=0,dZ=uZ.length,fZ=null,PX();let t=XX();if(fZ.type!==mZ)throw Error(`Unexpect token after expression.`);return t}var ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,J,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ,AZ,jZ,MZ,NZ,PZ,FZ,IZ,LZ,RZ,zZ,BZ,VZ,HZ,UZ,WZ,GZ,KZ,qZ,JZ,iOe=o((()=>{pg(),ZX=`RawCode`,QX=`Literal`,$X=`Property`,eZ=`Identifier`,tZ=`ArrayExpression`,nZ=`BinaryExpression`,rZ=`CallExpression`,iZ=`ConditionalExpression`,aZ=`LogicalExpression`,oZ=`MemberExpression`,sZ=`ObjectExpression`,cZ=`UnaryExpression`,yX.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=ODe(this),n=0,r=t.length;n`,lZ[hZ]=`Identifier`,lZ[gZ]=`Keyword`,lZ[_Z]=`Null`,lZ[vZ]=`Numeric`,lZ[yZ]=`Punctuator`,lZ[bZ]=`String`,lZ[xZ]=`RegularExpression`,SZ=`ArrayExpression`,CZ=`BinaryExpression`,wZ=`CallExpression`,TZ=`ConditionalExpression`,EZ=`Identifier`,DZ=`Literal`,OZ=`LogicalExpression`,kZ=`MemberExpression`,AZ=`ObjectExpression`,jZ=`Property`,MZ=`UnaryExpression`,NZ=`Unexpected token %0`,PZ=`Unexpected number`,FZ=`Unexpected string`,IZ=`Unexpected identifier`,LZ=`Unexpected reserved word`,RZ=`Unexpected end of input`,zZ=`Invalid regular expression`,BZ=`Invalid regular expression: missing /`,VZ=`Octal literals are not allowed in strict mode.`,HZ=`Duplicate data property in object literal not allowed in strict mode`,UZ=`ILLEGAL`,WZ=`Disabled.`,GZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),KZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),qZ={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},JZ={if:1}})),aOe=c({accessPathDepth:()=>OQ,accessPathWithDatum:()=>xQ,accessWithDatumToUnescapedPath:()=>CQ,compile:()=>RIe,contains:()=>aQ,deepEqual:()=>FQ,deleteNestedProperty:()=>yQ,duplicate:()=>n4,entries:()=>i4,every:()=>sQ,fieldIntersection:()=>pQ,flatAccessWithDatum:()=>SQ,getFirstDefined:()=>kQ,hasIntersection:()=>dQ,hasProperty:()=>Y,hash:()=>rQ,internalField:()=>jQ,isBoolean:()=>hQ,isEmpty:()=>mQ,isEqual:()=>sOe,isInternalField:()=>MQ,isNullOrFalse:()=>iQ,isNumeric:()=>PQ,isPrimitive:()=>gQ,keys:()=>$,logicalExpr:()=>vQ,mergeDeep:()=>cQ,never:()=>eQ,normalize:()=>bMe,normalizeAngle:()=>NQ,omit:()=>nQ,pick:()=>tQ,prefixGenerator:()=>fQ,removePathFromField:()=>DQ,replaceAll:()=>EQ,replacePathInField:()=>TQ,resetIdCounter:()=>lOe,setEqual:()=>uQ,some:()=>oQ,stringify:()=>IQ,titleCase:()=>bQ,unescapeSingleQuoteAndPathDot:()=>wQ,unique:()=>lQ,uniqueId:()=>AQ,vals:()=>r4,varName:()=>_Q,version:()=>eBe});function YZ(e){return Y(e,`or`)}function XZ(e){return Y(e,`and`)}function ZZ(e){return Y(e,`not`)}function QZ(e,t){if(ZZ(e))QZ(e.not,t);else if(XZ(e))for(let n of e.and)QZ(n,t);else if(YZ(e))for(let n of e.or)QZ(n,t);else t(e)}function $Z(e,t){return ZZ(e)?{not:$Z(e.not,t)}:XZ(e)?{and:e.and.map(e=>$Z(e,t))}:YZ(e)?{or:e.or.map(e=>$Z(e,t))}:t(e)}function eQ(e){throw Error(e)}function tQ(e,t){let n={};for(let r of t)Ih(e,r)&&(n[r]=e[r]);return n}function nQ(e,t){let n={...e};for(let e of t)delete n[e];return n}function rQ(e){if(Kh(e))return e;let t=Yh(e)?e:IQ(e);if(t.length<250)return t;let n=0;for(let e=0;et===0?e:`[${e}]`),r=e.map((t,n)=>e.slice(0,n+1).join(``));for(let e of r)t.add(e)}return t}function pQ(e,t){return e===void 0||t===void 0||dQ(fQ(e),fQ(t))}function mQ(e){return $(e).length===0}function hQ(e){return e===!0||e===!1}function gQ(e){return Yh(e)||Kh(e)||hQ(e)}function _Q(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function vQ(e,t){return ZZ(e)?`!(${vQ(e.not,t)})`:XZ(e)?`(${e.and.map(e=>vQ(e,t)).join(`) && (`)})`:YZ(e)?`(${e.or.map(e=>vQ(e,t)).join(`) || (`)})`:t(e)}function yQ(e,t){if(t.length===0)return!0;let n=t.shift();return n in e&&yQ(e[n],t)&&delete e[n],mQ(e)}function bQ(e){return e.charAt(0).toUpperCase()+e.substr(1)}function xQ(e,t=`datum`){let n=jm(e),r=[];for(let e=1;e<=n.length;e++){let i=`[${n.slice(0,e).map(W).join(`][`)}]`;r.push(`${t}${i}`)}return r.join(` && `)}function SQ(e,t=`datum`){return`${t}[${W(jm(e).join(`.`))}]`}function CQ(e){return`datum['${e.replaceAll(`'`,`\\'`)}']`}function wQ(e){return e.replaceAll(`\\'`,`'`).replaceAll(`\\.`,`.`)}function cOe(e){return e.replace(/(\[|\]|\.|'|")/g,`\\$1`)}function TQ(e){return`${jm(e).map(cOe).join(`\\.`)}`}function EQ(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`),`g`),n)}function DQ(e){return`${jm(e).join(`.`)}`}function OQ(e){return e?jm(e).length:0}function kQ(...e){return e.find(e=>e!==void 0)}function AQ(e){let t=++a4;return e?String(e)+t:t}function lOe(){a4=42}function jQ(e){return MQ(e)?e:`__${e}`}function MQ(e){return e.startsWith(`__`)}function NQ(e){if(e!==void 0)return(e%360+360)%360}function PQ(e){return Kh(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}function FQ(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!FQ(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;for(let n of e.entries())if(!FQ(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==o4.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==o4.toString)return e.toString()===t.toString();let i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!FQ(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function IQ(e){let t=[];return(function e(n){if(n?.toJSON&&typeof n.toJSON==`function`&&(n=n.toJSON()),n===void 0)return;if(typeof n==`number`)return isFinite(n)?`${n}`:`null`;if(typeof n!=`object`)return JSON.stringify(n);let r,i;if(Array.isArray(n)){for(i=`[`,r=0;rl$(e[t])?_Q(`_${t}_${i4(e[t])}`):_Q(`_${t}_${e[t]}`)).join(``)}`}function o$(e){return e===!0||c$(e)&&!e.binned}function s$(e){return e===`binned`||c$(e)&&e.binned===!0}function c$(e){return Wm(e)}function l$(e){return Y(e,`param`)}function u$(e){switch(e){case s4:case c4:case k4:case T4:case E4:case D4:case P4:case j4:case M4:case N4:case O4:return 6;case F4:return 4;default:return 10}}function d$(e){return Y(e,`expr`)}function f$(e,{level:t}={level:0}){let n=$(e||{}),r={};for(let i of n)r[i]=t===0?b$(e[i]):f$(e[i],{level:t-1});return r}function p$(e){let{anchor:t,frame:n,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:u,subtitleFontStyle:d,subtitleFontWeight:f,subtitleLineHeight:p,subtitlePadding:m,...h}=e,g={...h,...s?{fill:s}:{}},_={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a===void 0?{}:{angle:a},...o===void 0?{}:{limit:o}},v={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...u?{subtitleFontSize:u}:{},...d?{subtitleFontStyle:d}:{},...f?{subtitleFontWeight:f}:{},...p?{subtitleLineHeight:p}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:g,subtitleMarkConfig:tQ(e,[`align`,`baseline`,`dx`,`dy`,`limit`]),nonMarkTitleProperties:_,subtitle:v}}function m$(e){return Yh(e)||H(e)&&Yh(e[0])}function h$(e){return Y(e,`signal`)}function g$(e){return Y(e,`step`)}function _$(e){return!H(e)&&Y(e,`fields`)&&!Y(e,`data`)}function _Oe(e){return!H(e)&&Y(e,`fields`)&&Y(e,`data`)}function v$(e){return!H(e)&&Y(e,`field`)&&Y(e,`data`)}function y$(e){let t=H(e.condition)?e.condition.map(x$):x$(e.condition);return{...b$(e),condition:t}}function b$(e){if(d$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function x$(e){if(d$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function S$(e){if(d$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return h$(e)?e:e===void 0?void 0:{value:e}}function vOe(e){return h$(e)?e.signal:W(e)}function C$(e){return h$(e)?e.signal:W(e.value)}function w$(e){return h$(e)?e.signal:e==null?null:W(e)}function yOe(e,t,n){for(let r of n){let n=D$(r,t.markDef,t.config);n!==void 0&&(e[r]=S$(n))}return e}function T$(e){return[].concat(e.type,e.style??[])}function E$(e,t,n,r={}){let{vgChannel:i,ignoreVgConfig:a}=r;return i&&Y(t,i)?t[i]:t[e]===void 0?a&&(!i||i===e)?void 0:D$(e,t,n,r):t[e]}function D$(e,t,n,{vgChannel:r}={}){let i=O$(e,t,n.style);return kQ(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function O$(e,t,n){return k$(e,T$(t),n)}function k$(e,t,n){t=yh(t);let r;for(let i of t){let t=n[i];Y(t,e)&&(r=t[e])}return r}function A$(e,t){return yh(e).reduce((e,n)=>(e.field.push(Q(n,t)),e.order.push(n.sort??`ascending`),e),{field:[],order:[]})}function j$(e,t){let n=[...e];return t.forEach(e=>{for(let t of n)if(FQ(t,e))return;n.push(e)}),n}function M$(e,t){return FQ(e,t)||!t?e:e?[...yh(e),...yh(t)].join(`, `):t}function N$(e,t){let n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((m$(n)||h$(n))&&(m$(r)||h$(r)))return{explicit:e.explicit,value:M$(n,r)};if(m$(n)||h$(n))return{explicit:e.explicit,value:n};if(m$(r)||h$(r))return{explicit:e.explicit,value:r};if(!m$(n)&&!h$(n)&&!m$(r)&&!h$(r))return{explicit:e.explicit,value:j$(n,r)};throw Error(`It should never reach here`)}function P$(e){return`Invalid specification ${IQ(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function F$(e){return`${e==`width`?`Width`:`Height`} "container" only works for single views and layered views.`}function I$(e){return`${e==`width`?`Width`:`Height`} "container" only works well with autosize "fit" or "fit-${e==`width`?`x`:`y`}".`}function L$(e){return e?`Dropping "fit-${e}" because spec has discrete ${KQ(e)}.`:`Dropping "fit" because spec has discrete size.`}function R$(e){return`Unknown field for ${e}. Cannot calculate view size.`}function z$(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function bOe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function xOe(e){return`The "nearest" transform is not supported for ${e} marks.`}function B$(e){return`Selection not supported for ${e} yet.`}function SOe(e){return`Cannot find a selection named "${e}".`}function COe(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function wOe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}function TOe(e){return`Unknown repeated value "${e}".`}function V$(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function EOe(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${W(e)}.`}function DOe(e,t,n,r){return`${e.length?`Multiple `:`No `}matching ${W(t)} encoding found for selection ${W(n.param)}. Using "field": ${W(r)}.`}function OOe(e){return`Unrecognized parse "${e}".`}function H$(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function kOe(e){return`Ignoring an invalid transform: ${IQ(e)}.`}function U$(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function AOe(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${IQ(t)} is overridden by a child projection ${IQ(n)}.`}function jOe(e){return`${e}Offset dropped because ${e} is continuous`}function MOe(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${IQ(n)}}.`}function W$(e){return`Invalid field type "${e}".`}function NOe(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function POe(e){return`Invalid aggregation operator "${e}".`}function G$(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?`fill and stroke`:n?`fill`:`stroke`}.`}function FOe(e){return`Position range does not support relative band size for ${e}.`}function K$(e,t){return`Dropping ${IQ(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function q$(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function IOe(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function LOe(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function ROe(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function zOe(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function J$(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}function BOe(e){return`The ${e} for range marks cannot be an expression`}function VOe(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function HOe(e,t){return`Specified orient "${e}" overridden with "${t}".`}function UOe(e){return`Cannot use the scale property "${e}" with non-color channel.`}function WOe(e){return`Cannot use the relative band size with ${e} scale.`}function GOe(e){return`Using unaggregated domain with raw field has no effect (${IQ(e)}).`}function KOe(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function qOe(e){return`Unaggregated domain is currently unsupported for log scale (${IQ(e)}).`}function JOe(e){return`Cannot apply size to non-oriented mark "${e}".`}function YOe(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function XOe(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function Y$(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function X$(e){return`The step for "${e}" is dropped because the ${e===`width`?`x`:`y`} is continuous.`}function ZOe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${IQ(n)} and ${IQ(r)}). Using ${IQ(n)}.`}function QOe(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${IQ(n)} and ${IQ(r)}). Using the union of the two domains.`}function $Oe(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function eke(e){return`Dropping sort property ${IQ(e)} as unioned domains only support boolean or op "count", "min", and "max".`}function tke(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function nke(e){return`Cannot stack "${e}" if there is already "${e}2".`}function rke(e){return`Stack is applied to a non-linear scale (${e}).`}function ike(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Z$(e,t){return`Invalid ${e}: ${IQ(t)}.`}function ake(e){return`Dropping day from datetime ${IQ(e)} as day cannot be combined with other units.`}function oke(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function ske(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function cke(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function Q$(e){return`1D error band does not support ${e}.`}function $$(e){return`Channel ${e} is required for "binned" bin.`}function lke(e){return`Channel ${e} should not be used with "binned" bin.`}function uke(e){return`Domain for ${e} is required for threshold scale.`}function dke(e){return l3=e,l3}function fke(){return l3=c3,l3}function e1(...e){l3.error(...e)}function X(...e){l3.warn(...e)}function pke(...e){l3.debug(...e)}function t1(e){if(e&&Wm(e)){for(let t of p3)if(Y(e,t))return!0}return!1}function mke(e){if(PQ(e)&&(e=+e),Kh(e))return e>4&&X(Z$(`quarter`,e)),e-1;throw Error(Z$(`quarter`,e))}function hke(e){if(PQ(e)&&(e=+e),Kh(e))return e-1;{let t=e.toLowerCase(),n=u3.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=QLe.indexOf(r);if(i!==-1)return i;throw Error(Z$(`month`,e))}}function gke(e){if(PQ(e)&&(e=+e),Kh(e))return e%7;{let t=e.toLowerCase(),n=d3.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=$Le.indexOf(r);if(i!==-1)return i;throw Error(Z$(`day`,e))}}function n1(e,t){let n=[];if(t&&e.day!==void 0&&$(e).length>1&&(X(ake(e)),e=n4(e),delete e.day),e.year===void 0?n.push(2012):n.push(e.year),e.month!==void 0){let r=t?hke(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){let r=t?mke(e.quarter):e.quarter;n.push(Kh(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){let r=t?gke(e.day):e.day;n.push(Kh(r)?r+1:`${r}+1`)}else n.push(1);for(let t of[`hours`,`minutes`,`seconds`,`milliseconds`]){let r=e[t];n.push(r===void 0?0:r)}return n}function r1(e){let t=n1(e,!0).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function _ke(e){let t=n1(e,!1).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function vke(e){let t=n1(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}function yke(e){return Ih(f3,e)}function i1(e){return Wm(e)?e.binned:bke(e)}function bke(e){return e?.startsWith(`binned`)}function a1(e){return e.startsWith(`utc`)}function xke(e){return e.substring(3)}function o1(e){return p3.filter(t=>Cke(e,t))}function Ske(e){let t=o1(e);return t[t.length-1]}function Cke(e,t){let n=e.indexOf(t);return!(n<0||n>0&&t===`seconds`&&e.charAt(n-1)===`i`||e.length>n+3&&t===`day`&&e.charAt(n+3)===`o`||n>0&&t===`year`&&e.charAt(n-1)===`f`)}function wke(e,t,{end:n}={end:!1}){let r=xQ(t),i=a1(e)?`utc`:``;function a(e){return e===`quarter`?`(${i}quarter(${r})-1)`:`${i}${e}(${r})`}let o,s={};for(let t of p3)Cke(e,t)&&(s[t]=a(t),o=t);return n&&(s[o]+=`+1`),_ke(s)}function Tke(e){if(e)return`timeUnitSpecifier(${IQ(o1(e))}, ${IQ(eRe)})`}function Eke(e,t,n){if(!e)return;let r=Tke(e);return`${n||a1(e)?`utc`:`time`}Format(${t}, ${r})`}function s1(e){if(!e)return;let t;return Yh(e)?t=bke(e)?{unit:e.substring(6),binned:!0}:{unit:e}:Wm(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),a1(t.unit)&&(t.utc=!0,t.unit=xke(t.unit)),t}function Dke(e){let{utc:t,...n}=s1(e);return n.unit?(t?`utc`:``)+$(n).map(e=>_Q(`${e===`unit`?``:`_${e}_`}${n[e]}`)).join(``):`${t?`utc`:``}timeunit${$(n).map(e=>_Q(`_${e}_${n[e]}`)).join(``)}`}function Oke(e,t=e=>e){let n=s1(e),r=Ske(n.unit);if(r&&r!==`day`){let e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:a}=Ake(r,n.step);return`${t(r1({...e,[a]:+e[a]+i}))} - ${t(r1(e))}`}}function kke(e){return Ih(tRe,e)}function Ake(e,t=1){if(kke(e))return{part:e,step:t};switch(e){case`day`:case`dayofyear`:return{part:`date`,step:t};case`quarter`:return{part:`month`,step:t*3};case`week`:return{part:`date`,step:t*7}}}function jke(e){return Y(e,`param`)}function c1(e){return!!e?.field&&e.equal!==void 0}function l1(e){return!!e?.field&&e.lt!==void 0}function u1(e){return!!e?.field&&e.lte!==void 0}function d1(e){return!!e?.field&&e.gt!==void 0}function f1(e){return!!e?.field&&e.gte!==void 0}function p1(e){return!!(e?.field&&(H(e.range)&&e.range.length===2||h$(e.range)))}function m1(e){return!!e?.field&&(H(e.oneOf)||H(e.in))}function Mke(e){return!!e?.field&&e.valid!==void 0}function Nke(e){return m1(e)||c1(e)||p1(e)||l1(e)||d1(e)||u1(e)||f1(e)}function h1(e,t){return p0(e,{timeUnit:t,wrapTime:!0})}function Pke(e,t){return e.map(e=>h1(e,t))}function Fke(e,t=!0){let{field:n}=e,{unit:r,binned:i}=s1(e.timeUnit)||{},a=Q(e,{expr:`datum`}),o=r?`time(${i?a:wke(r,n)})`:a;if(c1(e))return`${o}===${h1(e.equal,r)}`;if(l1(e)){let t=e.lt;return`${o}<${h1(t,r)}`}else if(d1(e)){let t=e.gt;return`${o}>${h1(t,r)}`}else if(u1(e)){let t=e.lte;return`${o}<=${h1(t,r)}`}else if(f1(e)){let t=e.gte;return`${o}>=${h1(t,r)}`}else if(m1(e))return`indexof([${Pke(e.oneOf,r).join(`,`)}], ${o}) !== -1`;else if(Mke(e))return g1(o,e.valid);else if(p1(e)){let{range:n}=f$(e),i=h$(n)?{signal:`${n.signal}[0]`}:n[0],a=h$(n)?{signal:`${n.signal}[1]`}:n[1];if(i!==null&&a!==null&&t)return`inrange(${o}, [${h1(i,r)}, ${h1(a,r)}])`;let s=[];return i!==null&&s.push(`${o} >= ${h1(i,r)}`),a!==null&&s.push(`${o} <= ${h1(a,r)}`),s.length>0?s.join(` && `):`true`}throw Error(`Invalid field predicate: ${IQ(e)}`)}function g1(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Ike(e){return Nke(e)&&e.timeUnit?{...e,timeUnit:s1(e.timeUnit)}:e}function Lke(e){return e===`quantitative`||e===`temporal`}function _1(e){return e===`ordinal`||e===`nominal`}function Rke(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case h3:return`quantitative`;case`t`:case _3:return`temporal`;case`o`:case g3:return`ordinal`;case`n`:case v3:return`nominal`;case y3:return`geojson`}}function zke(e,t){let n=x3[e],r=x3[t];return n===r||n===`ordinal-position`&&r===`time`||r===`ordinal-position`&&n===`time`}function Bke(e){return nRe[e]}function Vke(e){return S3.has(e)}function v1(e){return iRe.has(e)}function y1(e){return rRe.has(e)}function b1(e){return C3.has(e)}function x1(e){return w3.has(e)}function Hke(e){return!Yh(e)&&Y(e,`name`)}function Uke(e){return Y(e,`param`)}function Wke(e){return Y(e,`unionWith`)}function Gke(e){return Wm(e)&&`field`in e}function S1(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return![`point`,`band`,`identity`].includes(e);case`bins`:return![`point`,`band`,`identity`,`ordinal`].includes(e);case`round`:return b1(e)||e===`band`||e===`point`;case`padding`:case`rangeMin`:case`rangeMax`:return b1(e)||[`point`,`band`].includes(e);case`paddingOuter`:case`align`:return[`point`,`band`].includes(e);case`paddingInner`:return e===`band`;case`domainMax`:case`domainMid`:case`domainMin`:case`domainRaw`:case`clamp`:return b1(e);case`nice`:return b1(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return y1(e)&&!aQ([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function Kke(e,t){switch(t){case`interpolate`:case`scheme`:case`domainMid`:return BQ(e)?void 0:UOe(t);case`align`:case`type`:case`bins`:case`domain`:case`domainMax`:case`domainMin`:case`domainRaw`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeMax`:case`rangeMin`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function qke(e,t){return aQ([g3,v3],t)?e===void 0||v1(e):t===_3?aQ([b3.TIME,b3.UTC,void 0],e):t!==h3||Vke(e)||x1(e)||e===void 0}function Jke(e,t,n=!1){if(!$Q(e))return!1;switch(e){case u4:case d4:case m4:case h4:case v4:case g4:return b1(t)?!0:t===`band`||t===`point`&&!n;case w4:return aQ([`linear`,`band`],t);case k4:case P4:case j4:case M4:case N4:case A4:return b1(t)||x1(t)||aQ([`band`,`point`,`ordinal`],t);case T4:case E4:case D4:return t!==`band`;case F4:case O4:return t===`ordinal`||x1(t)}}function Yke(e){return Wm(e)&&`value`in e}function C1(e){return[`line`,`area`,`trail`].includes(e)}function w1(e){return[`rect`,`bar`,`image`,`arc`,`tick`].includes(e)}function T1(e){return Y(e,`type`)}function E1(e){return Y(e,`band`)}function Xke(e){return T1(e)?e.type:e}function Zke(e,{isPath:t}){return e===void 0||e===`break-paths-show-path-domains`?t?`break-paths-show-domains`:`filter`:e===null?`show`:e}function D1({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){if(!r||!y1(r)||i)return`always-valid`;let a=Zke(E$(`invalid`,e,t),{isPath:C1(e.type)});return t.scale?.invalid?.[n]===void 0?a:`show`}function Qke(e){return e===`break-paths-filter-domains`||e===`break-paths-show-domains`}function $ke({scaleName:e,scale:t,mode:n}){let r=`domain('${e}')`;if(!t||!e)return;let i=`${r}[0]`,a=`peek(${r})`,o=t.domainHasZero();return o===`definitely`?{scale:e,value:0}:o===`maybe`?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n===`zeroOrMin`?i:a})`}:{signal:`scale('${e}', ${n===`zeroOrMin`?i:a})`}}function eAe({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:a}){let o=n?.get(`type`),s=s0(t),c=D1({scaleChannel:e,markDef:i,config:a,scaleType:o,isCountAggregate:i$(s?.aggregate)});if(s&&c===`show`){let t=a.scale.invalid?.[e]??`zero-or-min`;return{test:g1(Q(s,{expr:`datum`}),!1),...tAe(t,n,r)}}}function tAe(e,t,n){if(Yke(e)){let{value:t}=e;return h$(t)?{signal:t.signal}:{value:t}}return $ke({scale:t,scaleName:n,mode:`zeroOrMin`})}function O1(e){let{channel:t,channelDef:n,markDef:r,scale:i,scaleName:a,config:o}=e,s=UQ(t),c=j1(e),l=eAe({scaleChannel:s,channelDef:n,scale:i,scaleName:a,markDef:r,config:o});return l===void 0?c:[l,c]}function nAe(e){let{datum:t}=e;return t1(t)?r1(t):`${IQ(t)}`}function k1(e,t,n,r){let i={};if(t&&(i.scale=t),J1(e)){let{datum:t}=e;t1(t)?i.signal=r1(t):h$(t)?i.signal=t.signal:d$(t)?i.signal=t.expr:i.value=t}else i.field=Q(e,n);if(r){let{offset:e,band:t}=r;e&&(i.offset=e),t&&(i.band=t)}return i}function A1({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:a=`end`,bandPosition:o=.5}){let s=!h$(o)&&0{let r=p0(t,{timeUnit:Z(e)&&!i1(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return r===void 0?t:{signal:r}})}function m0(e,t){return o$(e.bin)?$Q(t)&&[`ordinal`,`nominal`].includes(e.type):(console.warn(`Only call this method for binned field defs.`),!1)}function h0(e){return e?.condition}function zAe(e){return Ih(ORe,e)}function g0(e){return Y(e,`mark`)}function _0(e,t){let n=e?.[t];return n?H(n)?oQ(n,e=>!!e.field):Z(n)||G1(n):!1}function BAe(e,t){let n=e?.[t];return n?H(n)?oQ(n,e=>!!e.field):Z(n)||J1(n)||K1(n):!1}function VAe(e,t){if(YQ(t)){let n=e[t];if((Z(n)||J1(n))&&(_1(n.type)||Z(n)&&n.timeUnit))return BAe(e,JQ(t))}return!1}function HAe(e){return oQ(WIe,t=>{if(_0(e,t)){let n=e[t];if(H(n))return oQ(n,e=>!!e.aggregate);{let e=s0(n);return e&&!!e.aggregate}}return!1})}function UAe(e,t){let n=[],r=[],i=[],a=[],o={};return y0(e,(s,c)=>{if(Z(s)){let{field:l,aggregate:u,bin:d,timeUnit:f,...p}=s;if(u||f||d){let e=i0(s)?.title,m=Q(s,{forAs:!0}),h={...e?[]:{title:r0(s,t,{allowDisabling:!0})},...p,field:m};if(u){let e;if(n$(u)?(e=`argmax`,m=Q({op:`argmax`,field:u.argmax},{forAs:!0}),h.field=`${m}.${l}`):t$(u)?(e=`argmin`,m=Q({op:`argmin`,field:u.argmin},{forAs:!0}),h.field=`${m}.${l}`):u!==`boxplot`&&u!==`errorbar`&&u!==`errorband`&&(e=u),e){let t={op:e,as:m};l&&(t.field=l),a.push(t)}}else if(n.push(m),Q1(s)&&o$(d)){if(r.push({bin:d,field:l,as:m}),n.push(Q(s,{binSuffix:`end`})),m0(s,c)&&n.push(Q(s,{binSuffix:`range`})),YQ(c)){let e={field:`${m}_end`};o[`${c}2`]=e}h.bin=`binned`,HQ(c)||(h.type=h3)}else if(f&&!i1(f)){i.push({timeUnit:f,field:l,as:m});let e=Q1(s)&&s.type!==_3&&`time`;e&&(c===I4||c===B4?h.formatType=e:fOe(c)?h.legend={formatType:e,...h.legend}:YQ(c)&&(h.axis={formatType:e,...h.axis}))}o[c]=h}else n.push(l),o[c]=e[c]}else o[c]=e[c]}),{bins:r,timeUnits:i,aggregate:a,groupby:n,encoding:o}}function WAe(e,t,n){let r=mOe(t,n);if(!r)return!1;if(r===`binned`){let n=e[t===f4?u4:d4];return!!(Z(n)&&Z(e[t])&&s$(n.bin))}return!0}function GAe(e,t,n,r){let i={};for(let t of $(e))VQ(t)||X(IOe(t));for(let a of eLe){if(!e[a])continue;let o=e[a];if(ZQ(a)){let e=dOe(a),t=i[e];if(Z(t)&&Lke(t.type)&&Z(o)&&!t.timeUnit){X(jOe(e));continue}}if(a===`angle`&&t===`arc`&&!e.theta&&(X(qLe),a=v4),!WAe(e,a,t)){X(q$(a,t));continue}if(a===k4&&t===`line`&&s0(e[a])?.aggregate){X(JLe);continue}if(a===T4&&(n?`fill`in e:`stroke`in e)){X(G$(`encoding`,{fill:`fill`in e,stroke:`stroke`in e}));continue}if(a===R4||a===L4&&!H(o)&&!$1(o)||a===B4&&H(o)){if(o){if(a===L4){let t=e[a];if(bAe(t)){i[a]=t;continue}}i[a]=yh(o).reduce((e,t)=>(Z(t)?e.push(u0(t,a)):X(K$(t,a)),e),[])}}else{if(a===B4&&o===null)i[a]=null;else if(!Z(o)&&!J1(o)&&!$1(o)&&!W1(o)&&!h$(o)){X(K$(o,a));continue}i[a]=PAe(o,a,r)}}return i}function v0(e,t){let n={};for(let r of $(e))n[r]=PAe(e[r],r,t,{compositeMark:!0});return n}function KAe(e){let t=[];for(let n of $(e))if(_0(e,n)){let r=e[n],i=yh(r);for(let e of i)Z(e)?t.push(e):G1(e)&&t.push(e.condition)}return t}function y0(e,t,n){if(e)for(let r of $(e)){let i=e[r];if(H(i))for(let e of i)t.call(n,e,r);else t.call(n,i,r)}}function qAe(e,t,n,r){return e?$(e).reduce((n,i)=>{let a=e[i];return H(a)?a.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,a,i)},n):n}function JAe(e,t){return $(t).reduce((n,r)=>{switch(r){case u4:case d4:case V4:case U4:case H4:case f4:case p4:return n;case m4:case h4:if(e===`line`||e===`area`||e===`trail`){let e=t[r];if(Z(e)){let i=t[r===m4?u4:d4];if(Z(i)&&!i.aggregate&&!e.aggregate){let t=Q(i,{}),r=Q(e,{});t&&r&&t!==r&&n.push(t)}}}return n;case v4:case y4:case g4:case _4:case w4:case b4:case x4:case S4:case C4:case I4:case O4:case A4:case B4:return n;case L4:if(e===`line`||e===`trail`)return n;case R4:case z4:{let e=t[r];if(H(e)||Z(e))for(let t of yh(e))t.aggregate||n.push(Q(t,{}));return n}case k4:if(e===`trail`)return n;case T4:case E4:case D4:case j4:case M4:case N4:case F4:case P4:{let e=s0(t[r]);return e&&!e.aggregate&&n.push(Q(e,{})),n}}},[])}function YAe(e){let{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(H(t)){for(let e of t)e.aggregate?(r||=[],r.push(e)):(i||=[],i.push(e));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return H(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function b0(e,t,n,r=!0){if(`tooltip`in n)return{tooltip:n.tooltip};let i=e.map(({fieldPrefix:e,titlePrefix:n})=>{let i=r?` of ${x0(t)}`:``;return{field:e+t.field,type:t.type,title:h$(n)?{signal:`${n}"${escape(i)}"`}:n+i}}),a=KAe(n).map(TAe);return{tooltip:[...i,...lQ(a,rQ)]}}function x0(e){let{title:t,field:n}=e;return kQ(t,n)}function S0(e,t,n,r,i){let{scale:a,axis:o}=n;return({partName:s,mark:c,positionPrefix:l,endPositionPrefix:u=void 0,extraEncoding:d={}})=>{let f=x0(n);return XAe(e,s,i,{mark:c,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...f===void 0?{}:{title:f},...a===void 0?{}:{scale:a},...o===void 0?{}:{axis:o}},...Yh(u)?{[`${t}2`]:{field:`${u}_${n.field}`}}:{},...r,...d}})}}function XAe(e,t,n,r){let{clip:i,color:a,opacity:o}=e,s=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...T1(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(t)}`,...Hh(e[t])?{}:e[t]}}]:[]}function ZAe(e,t,n){let{encoding:r}=e,i=t===`vertical`?`y`:`x`,a=r[i],o=r[`${i}2`],s=r[`${i}Error`],c=r[`${i}Error2`];return{continuousAxisChannelDef:C0(a,n),continuousAxisChannelDef2:C0(o,n),continuousAxisChannelDefError:C0(s,n),continuousAxisChannelDefError2:C0(c,n),continuousAxis:i}}function C0(e,t){if(e?.aggregate){let{aggregate:n,...r}=e;return n!==t&&X(cke(n,t)),r}else return e}function QAe(e,t){let{mark:n,encoding:r}=e,{x:i,y:a}=r;if(T1(n)&&n.orient)return n.orient;if(Y1(i)){if(Y1(a)){let e=Z(i)&&i.aggregate,n=Z(a)&&a.aggregate;if(!e&&n===t)return`vertical`;if(!n&&e===t)return`horizontal`;if(e===t&&n===t)throw Error(`Both x and y cannot have aggregate`);return f0(a)&&!f0(i)?`horizontal`:`vertical`}return`horizontal`}else if(Y1(a))return`vertical`;else throw Error(`Need a valid continuous axis for ${t}s`)}function $Ae(e){return Kh(e)?`tukey`:e}function eje(e,{config:t}){e={...e,encoding:v0(e.encoding,t)};let{mark:n,encoding:r,params:i,projection:a,...o}=e,s=T1(n)?n:{type:n};i&&X(B$(`boxplot`));let c=s.extent??t.boxplot.extent,l=E$(`size`,s,t),u=s.invalid,d=$Ae(c),{bins:f,timeUnits:p,transform:m,continuousAxisChannelDef:h,continuousAxis:g,groupby:_,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:S}=nje(e,c,t),C=DQ(h.field),{color:w,size:T,...E}=y,D=e=>S0(s,g,h,e,t.boxplot),O=D(E),k=D(y),A=(Wm(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||`#4c78a8`,j=D({...E,...T?{size:T}:{},color:{condition:{test:`${CQ(`lower_box_${h.field}`)} >= ${CQ(`upper_box_${h.field}`)}`,...w||{value:A}}}}),M=b0([{fieldPrefix:d===`min-max`?`upper_whisker_`:`max_`,titlePrefix:`Max`},{fieldPrefix:`upper_box_`,titlePrefix:`Q3`},{fieldPrefix:`mid_box_`,titlePrefix:`Median`},{fieldPrefix:`lower_box_`,titlePrefix:`Q1`},{fieldPrefix:d===`min-max`?`lower_whisker_`:`min_`,titlePrefix:`Min`}],h,y),ee={type:`tick`,color:`black`,opacity:1,orient:b,invalid:u,aria:!1},N=d===`min-max`?M:b0([{fieldPrefix:`upper_whisker_`,titlePrefix:`Upper Whisker`},{fieldPrefix:`lower_whisker_`,titlePrefix:`Lower Whisker`}],h,y),te=[...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`lower_whisker`,endPositionPrefix:`lower_box`,extraEncoding:N}),...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`upper_box`,endPositionPrefix:`upper_whisker`,extraEncoding:N}),...O({partName:`ticks`,mark:ee,positionPrefix:`lower_whisker`,extraEncoding:N}),...O({partName:`ticks`,mark:ee,positionPrefix:`upper_whisker`,extraEncoding:N})],ne=[...d===`tukey`?[]:te,...k({partName:`box`,mark:{type:`bar`,...l?{size:l}:{},orient:x,invalid:u,ariaRoleDescription:`box`},positionPrefix:`lower_box`,endPositionPrefix:`upper_box`,extraEncoding:M}),...j({partName:`median`,mark:{type:`tick`,invalid:u,...Wm(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:`mid_box`,extraEncoding:M})];if(d===`min-max`)return{...o,transform:(o.transform??[]).concat(m),layer:ne};let P=CQ(`lower_box_${h.field}`),re=CQ(`upper_box_${h.field}`),F=`(${re} - ${P})`,ie=`${P} - ${c} * ${F}`,ae=`${re} + ${c} * ${F}`,oe=CQ(h.field),se={joinaggregate:tje(h.field),groupby:_},ce={transform:[{filter:`(${ie} <= ${oe}) && (${oe} <= ${ae})`},{aggregate:[{op:`min`,field:h.field,as:`lower_whisker_${C}`},{op:`max`,field:h.field,as:`upper_whisker_${C}`},{op:`min`,field:`lower_box_${h.field}`,as:`lower_box_${C}`},{op:`max`,field:`upper_box_${h.field}`,as:`upper_box_${C}`},...v],groupby:_}],layer:te},{tooltip:le,...ue}=E,{scale:de,axis:fe}=h,pe=x0(h),me=XAe(s,`outliers`,t.boxplot,{transform:[{filter:`(${oe} < ${ie}) || (${oe} > ${ae})`}],mark:`point`,encoding:{[g]:{field:h.field,type:h.type,...pe===void 0?{}:{title:pe},...de===void 0?{}:{scale:de},...fe===void 0?{}:{axis:fe}},...ue,...w?{color:w}:{},...S?{tooltip:S}:{}}})[0],he,ge=[...f,...p,se];return me?he={transform:ge,layer:[me,ce]}:(he=ce,he.transform.unshift(...ge)),{...o,layer:[he,{transform:m,layer:ne}]}}function tje(e){let t=DQ(e);return[{op:`q1`,field:e,as:`lower_box_${t}`},{op:`q3`,field:e,as:`upper_box_${t}`}]}function nje(e,t,n){let r=QAe(e,X3),{continuousAxisChannelDef:i,continuousAxis:a}=ZAe(e,r,X3),o=i.field,s=DQ(o),c=$Ae(t),l=[...tje(o),{op:`median`,field:o,as:`mid_box_${s}`},{op:`min`,field:o,as:(c===`min-max`?`lower_whisker_`:`min_`)+s},{op:`max`,field:o,as:(c===`min-max`?`upper_whisker_`:`max_`)+s}],u=c===`min-max`||c===`tukey`?[]:[{calculate:`${CQ(`upper_box_${s}`)} - ${CQ(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${CQ(`upper_box_${s}`)} + ${CQ(`iqr_${s}`)} * ${t}, ${CQ(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${CQ(`lower_box_${s}`)} - ${CQ(`iqr_${s}`)} * ${t}, ${CQ(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[a]:d,...f}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=YAe(f),{bins:h,timeUnits:g,aggregate:_,groupby:v,encoding:y}=UAe(m,n),b=r===`vertical`?`horizontal`:`vertical`,x=r;return{bins:h,timeUnits:g,transform:[...h,...g,{aggregate:[..._,...l],groupby:v},...u],groupby:v,aggregate:_,continuousAxisChannelDef:i,continuousAxis:a,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:p}}function rje(e,{config:t}){e={...e,encoding:v0(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:c,tooltipEncoding:l}=cje(e,Z3,t);delete a.size;let u=S0(s,i,r,a,t.errorbar),d=s.thickness,f=s.size,p={type:`tick`,orient:o,aria:!1,...d===void 0?{}:{thickness:d},...f===void 0?{}:{size:f}},m=[...u({partName:`ticks`,mark:p,positionPrefix:`lower`,extraEncoding:l}),...u({partName:`ticks`,mark:p,positionPrefix:`upper`,extraEncoding:l}),...u({partName:`rule`,mark:{type:`rule`,ariaRoleDescription:`errorbar`,...d===void 0?{}:{size:d}},positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:l})];return{...c,transform:n,...m.length>1?{layer:m}:{...m[0]}}}function ije(e,t){let{encoding:n}=e;if(aje(n))return{orient:QAe(e,t),inputType:`raw`};let r=oje(n),i=sje(n),a=n.x,o=n.y;if(r){if(i)throw Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);let e=n.x2,r=n.y2;if(Z1(e)&&Z1(r))throw Error(`${t} cannot have both x2 and y2`);if(Z1(e)){if(Y1(a))return{orient:`horizontal`,inputType:`aggregated-upper-lower`};throw Error(`Both x and x2 have to be quantitative in ${t}`)}else if(Z1(r)){if(Y1(o))return{orient:`vertical`,inputType:`aggregated-upper-lower`};throw Error(`Both y and y2 have to be quantitative in ${t}`)}throw Error(`No ranged axis`)}else{let e=n.xError,r=n.xError2,i=n.yError,s=n.yError2;if(Z1(r)&&!Z1(e))throw Error(`${t} cannot have xError2 without xError`);if(Z1(s)&&!Z1(i))throw Error(`${t} cannot have yError2 without yError`);if(Z1(e)&&Z1(i))throw Error(`${t} cannot have both xError and yError with both are quantiative`);if(Z1(e)){if(Y1(a))return{orient:`horizontal`,inputType:`aggregated-error`};throw Error(`All x, xError, and xError2 (if exist) have to be quantitative`)}else if(Z1(i)){if(Y1(o))return{orient:`vertical`,inputType:`aggregated-error`};throw Error(`All y, yError, and yError2 (if exist) have to be quantitative`)}throw Error(`No ranged axis`)}}function aje(e){return(Z1(e.x)||Z1(e.y))&&!Z1(e.x2)&&!Z1(e.y2)&&!Z1(e.xError)&&!Z1(e.xError2)&&!Z1(e.yError)&&!Z1(e.yError2)}function oje(e){return Z1(e.x2)||Z1(e.y2)}function sje(e){return Z1(e.xError)||Z1(e.xError2)||Z1(e.yError)||Z1(e.yError2)}function cje(e,t,n){let{mark:r,encoding:i,params:a,projection:o,...s}=e,c=T1(r)?r:{type:r};a&&X(B$(t));let{orient:l,inputType:u}=ije(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:f,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=ZAe(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:_,tooltipSummary:v,tooltipTitleWithFieldName:y}=lje(c,d,f,p,m,u,t,n),{[h]:b,[h===`x`?`x2`:`y2`]:x,[h===`x`?`xError`:`yError`]:S,[h===`x`?`xError2`:`yError2`]:C,...w}=i,{bins:T,timeUnits:E,aggregate:D,groupby:O,encoding:k}=UAe(w,n),A=[...D,...g],j=u===`raw`?O:[],M=b0(v,d,k,y);return{transform:[...s.transform??[],...T,...E,...A.length===0?[]:[{aggregate:A,groupby:j}],..._],groupby:j,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:k,ticksOrient:l===`vertical`?`horizontal`:`vertical`,markDef:c,outerSpec:s,tooltipEncoding:M}}function lje(e,t,n,r,i,a,o,s){let c=[],l=[],u=t.field,d,f=!1;if(a===`raw`){let t=e.center?e.center:e.extent?e.extent===`iqr`?`median`:`mean`:s.errorbar.center,n=e.extent?e.extent:t===`mean`?`stderr`:`iqr`;if(t===`median`!=(n===`iqr`)&&X(ske(t,n,o)),n===`stderr`||n===`stdev`)c=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],l=[{calculate:`${CQ(`center_${u}`)} + ${CQ(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${CQ(`center_${u}`)} - ${CQ(`extent_${u}`)}`,as:`lower_${u}`}],d=[{fieldPrefix:`center_`,titlePrefix:bQ(t)},{fieldPrefix:`upper_`,titlePrefix:uje(t,n,`+`)},{fieldPrefix:`lower_`,titlePrefix:uje(t,n,`-`)}],f=!0;else{let e,t,r;n===`ci`?(e=`mean`,t=`ci0`,r=`ci1`):(e=`median`,t=`q1`,r=`q3`),c=[{op:t,field:u,as:`lower_${u}`},{op:r,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],d=[{fieldPrefix:`upper_`,titlePrefix:r0({field:u,aggregate:r,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`lower_`,titlePrefix:r0({field:u,aggregate:t,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`center_`,titlePrefix:r0({field:u,aggregate:e,type:`quantitative`},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&X(oke(e.center,e.extent)),a===`aggregated-upper-lower`?(d=[],l=[{calculate:CQ(n.field),as:`upper_${u}`},{calculate:CQ(u),as:`lower_${u}`}]):a===`aggregated-error`&&(d=[{fieldPrefix:``,titlePrefix:u}],l=[{calculate:`${CQ(u)} + ${CQ(r.field)}`,as:`upper_${u}`}],i?l.push({calculate:`${CQ(u)} + ${CQ(i.field)}`,as:`lower_${u}`}):l.push({calculate:`${CQ(u)} - ${CQ(r.field)}`,as:`lower_${u}`}));for(let e of l)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:EQ(EQ(e.calculate,`datum['`,``),`']`,``)})}return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:d,tooltipTitleWithFieldName:f}}function uje(e,t,n){return`${bQ(e)} ${n} ${t}`}function dje(e,{config:t}){e={...e,encoding:v0(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:c}=cje(e,Q3,t),l=o,u=S0(l,i,r,a,t.errorband),d=e.encoding.x!==void 0&&e.encoding.y!==void 0,f={type:d?`area`:`rect`},p={type:d?`line`:`rule`},m={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return d?(f={...f,...m,ariaRoleDescription:`errorband`},p={...p,...m,aria:!1}):l.interpolate?X(Q$(`interpolate`)):l.tension&&X(Q$(`tension`)),{...s,transform:n,layer:[...u({partName:`band`,mark:f,positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`lower`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`upper`,extraEncoding:c})]}}function w0(e,t,n){let r=new Y3(e,t);$3[e]={normalizer:r,parts:n}}function fje(){return $($3)}function T0(e){return e===`legend`||!!e?.legend}function E0(e){return T0(e)&&Wm(e)}function D0(e){return!!e?.select}function pje(e){let t=[];for(let n of e||[]){if(D0(n))continue;let{expr:e,bind:r,...i}=n;if(r&&e){let n={...i,bind:r,init:e};t.push(n)}else{let n={...i,...e?{update:e}:{},...r?{bind:r}:{}};t.push(n)}}return t}function mje(e){return k0(e)||A0(e)||O0(e)}function O0(e){return Y(e,`concat`)}function k0(e){return Y(e,`vconcat`)}function A0(e){return Y(e,`hconcat`)}function hje({step:e,offsetIsDiscrete:t}){return t?e.for??`offset`:`position`}function j0(e){return Y(e,`step`)}function gje(e){return Y(e,`view`)||Y(e,`width`)||Y(e,`height`)}function _je(e,t,n){let r=n[t],i={},{spacing:a,columns:o}=r;a!==void 0&&(i.spacing=a),o!==void 0&&(V1(e)&&!z1(e.facet)||O0(e))&&(i.columns=o),k0(e)&&(i.columns=1);for(let t of VRe)if(e[t]!==void 0)if(t===`spacing`){let n=e[t];i[t]=Kh(n)?n:{row:n.row??a,column:n.column??a}}else i[t]=e[t];return i}function M0(e,t){return e[t]??e[t===`width`?`continuousWidth`:`continuousHeight`]}function N0(e,t){let n=P0(e,t);return j0(n)?n.step:o6}function P0(e,t){return kQ(e[t]??e[t===`width`?`discreteWidth`:`discreteHeight`],{step:e.step})}function vje(e={}){return{signals:[{name:`color`,value:Wm(e)?{...l6,...e}:l6}],mark:{color:{signal:`color.blue`}},rule:{color:{signal:`color.gray0`}},text:{color:{signal:`color.gray0`}},style:{"guide-label":{fill:{signal:`color.gray0`}},"guide-title":{fill:{signal:`color.gray0`}},"group-title":{fill:{signal:`color.gray0`}},"group-subtitle":{fill:{signal:`color.gray0`}},cell:{stroke:{signal:`color.gray8`}}},axis:{domainColor:{signal:`color.gray13`},gridColor:{signal:`color.gray8`},tickColor:{signal:`color.gray13`}},range:{category:[{signal:`color.blue`},{signal:`color.orange`},{signal:`color.red`},{signal:`color.teal`},{signal:`color.green`},{signal:`color.yellow`},{signal:`color.purple`},{signal:`color.pink`},{signal:`color.brown`},{signal:`color.grey8`}]}}}function yje(e){return{signals:[{name:`fontSize`,value:Wm(e)?{...c6,...e}:c6}],text:{fontSize:{signal:`fontSize.text`}},style:{"guide-label":{fontSize:{signal:`fontSize.guideLabel`}},"guide-title":{fontSize:{signal:`fontSize.guideTitle`}},"group-title":{fontSize:{signal:`fontSize.groupTitle`}},"group-subtitle":{fontSize:{signal:`fontSize.groupSubtitle`}}}}}function bje(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function xje(e){let t=$(e||{}),n={};for(let r of t){let t=e[r];n[r]=h0(t)?y$(t):b$(t)}return n}function Sje(e){let t=$(e),n={};for(let r of t)n[r]=xje(e[r]);return n}function Cje(e={}){let{color:t,font:n,fontSize:r,selection:i,...a}=e,o=Km({},n4(HRe),n?bje(n):{},t?vje(t):{},r?yje(r):{},a||{});i&&qm(o,`selection`,i,!0);let s=nQ(o,URe);for(let e of[`background`,`lineBreak`,`padding`])o[e]&&(s[e]=b$(o[e]));for(let e of z3)o[e]&&(s[e]=f$(o[e]));for(let e of J3)o[e]&&(s[e]=xje(o[e]));for(let e of n6)o[e]&&(s[e]=f$(o[e]));if(o.legend&&(s.legend=f$(o.legend)),o.scale){let{invalid:e,...t}=o.scale,n=f$(e,{level:1});s.scale={...f$(t),...$(n).length>0?{invalid:n}:{}}}return o.style&&(s.style=Sje(o.style)),o.title&&(s.title=f$(o.title)),o.view&&(s.view=f$(o.view)),s}function wje(e){e=n4(e);for(let t of GRe)delete e[t];if(e.axis)for(let t in e.axis)h0(e.axis[t])&&delete e.axis[t];if(e.legend)for(let t of FRe)delete e.legend[t];if(e.mark){for(let t of L3)delete e.mark[t];e.mark.tooltip&&Wm(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(pje(e.params)),delete e.params);for(let t of WRe){for(let n of L3)delete e[t][n];let n=KRe[t];if(n)for(let r of n)delete e[t][r];Eje(e,t)}for(let t of fje())delete e[t];Tje(e);for(let t in e)Wm(e[t])&&mQ(e[t])&&delete e[t];return mQ(e)?void 0:e}function Tje(e){let{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=p$(e.title);mQ(t)||(e.style[`group-title`]={...e.style[`group-title`],...t}),mQ(n)||(e.style[`group-subtitle`]={...e.style[`group-subtitle`],...n}),mQ(r)?delete e.title:e.title=r}function Eje(e,t,n,r){let i=e[t];t===`view`&&(n=`cell`);let a={...i,...e.style[n??t]};mQ(a)||(e.style[n??t]=a),delete e[t]}function F0(e){return Y(e,`layer`)}function Dje(e){return Y(e,`repeat`)}function Oje(e){return!H(e.repeat)&&Y(e.repeat,`layer`)}function kje(e){return Ih(qRe,e)}function I0(e){return Z(e)&&q1(e)===`quantitative`&&!e.bin}function Aje(e,t,{orient:n,type:r}){let i=t===`x`?`y`:`radius`,a=t===`x`&&[`bar`,`area`].includes(r),o=e[t],s=e[i];if(Z(o)&&Z(s)){if(I0(o)&&I0(s)){if(o.stack)return t;if(s.stack)return i;let e=Z(o)&&!!o.aggregate;if(e!==(Z(s)&&!!s.aggregate))return e?t:i;if(a){if(n===`vertical`)return i;if(n===`horizontal`)return t}}else if(I0(o))return t;else if(I0(s))return i}else if(I0(o))return a&&n===`vertical`?void 0:t;else if(I0(s))return a&&n===`horizontal`?void 0:i}function jje(e){switch(e){case`x`:return`y`;case`y`:return`x`;case`theta`:return`radius`;case`radius`:return`theta`}}function Mje(e,t){let n=T1(e)?e:{type:e},r=n.type;if(!JRe.has(r))return null;let i=Aje(t,`x`,n)||Aje(t,`theta`,n);if(!i)return null;let a=t[i],o=Z(a)?Q(a,{}):void 0,s=jje(i),c=[],l=new Set;if(t[s]){let e=t[s],n=Z(e)?Q(e,{}):void 0;n&&n!==o&&(c.push(s),l.add(n))}let u=s===`x`?`xOffset`:`yOffset`,d=t[u],f=Z(d)?Q(d,{}):void 0;f&&f!==o&&(c.push(u),l.add(f));let p=hLe.reduce((e,n)=>{if(n!==`tooltip`&&_0(t,n)){let r=t[n];for(let t of yh(r)){let r=s0(t);if(r.aggregate)continue;let i=Q(r,{});(!i||!l.has(i))&&e.push({channel:n,fieldDef:r})}}return e},[]),m;return a.stack===void 0?YRe.has(r)&&(m=`zero`):m=Hh(a.stack)?a.stack?`zero`:null:a.stack,!m||!kje(m)||HAe(t)&&p.length===0?null:(a?.scale?.type&&a?.scale?.type!==b3.LINEAR&&a?.stack&&X(rke(a.scale.type)),Z1(t[GQ(i)])?(a.stack!==void 0&&X(nke(i)),null):(Z(a)&&a.aggregate&&!MLe.has(a.aggregate)&&X(ike(a.aggregate)),{groupbyChannels:c,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&C1(r),stackBy:p,offset:m}))}function Nje(e,t,n){let r=f$(e),i=E$(`orient`,r,n);if(r.orient=Lje(r.type,t,i),i!==void 0&&i!==r.orient&&X(HOe(r.orient,i)),r.type===`bar`&&r.orient){let e=E$(`cornerRadiusEnd`,r,n);if(e!==void 0){let n=r.orient===`horizontal`&&t.x2||r.orient===`vertical`&&t.y2?[`cornerRadius`]:CRe[r.orient];for(let t of n)r[t]=e;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}let a=E$(`opacity`,r,n),o=E$(`fillOpacity`,r,n);return a===void 0&&o===void 0&&(r.opacity=Fje(r.type,t)),E$(`cursor`,r,n)===void 0&&(r.cursor=Pje(r,t,n)),r}function Pje(e,t,n){return t.href||e.href||E$(`href`,e,n)?`pointer`:e.cursor}function Fje(e,t){if(aQ([A3,N3,P3,F3],e)&&!HAe(t))return d6}function Ije(e,t,{graticule:n}){if(n)return!1;let r=D$(`filled`,e,t),i=e.type;return kQ(r,i!==A3&&i!==k3&&i!==j3)}function Lje(e,t,n){switch(e){case A3:case P3:case F3:case hRe:case mRe:return}let{x:r,y:i,x2:a,y2:o}=t;switch(e){case M3:case O3:if(Z(r)&&(s$(r.bin)||Z(i)&&i.aggregate&&!r.aggregate))return`vertical`;if(Z(i)&&(s$(i.bin)||Z(r)&&r.aggregate&&!i.aggregate))return`horizontal`;if(o||a){if(n)return n;if(!a)return(Z(r)&&r.type===h3&&!o$(r.bin)||X1(r))&&Z(i)&&s$(i.bin)?`horizontal`:`vertical`;if(!o)return(Z(i)&&i.type===h3&&!o$(i.bin)||X1(i))&&Z(r)&&s$(r.bin)?`vertical`:`horizontal`}case j3:if(a&&!(Z(r)&&s$(r.bin))&&o&&!(Z(i)&&s$(i.bin)))return;case D3:if(o)return Z(i)&&s$(i.bin)?`horizontal`:`vertical`;if(a)return Z(r)&&s$(r.bin)?`vertical`:`horizontal`;if(e===j3){if(r&&!i)return`vertical`;if(i&&!r)return`horizontal`}case k3:case N3:{let t=SAe(r),a=SAe(i);if(n)return n;if(t&&!a)return e===`tick`?`vertical`:`horizontal`;if(!t&&a)return e===`tick`?`horizontal`:`vertical`;if(t&&a)return`vertical`;{let e=Q1(r)&&r.type===_3,t=Q1(i)&&i.type===_3;if(e&&!t)return`vertical`;if(!e&&t)return`horizontal`}return}}return`vertical`}function Rje(e){let{point:t,line:n,...r}=e;return $(r).length>1?r:r.type}function zje(e){for(let t of[`line`,`area`,`rule`,`trail`])e[t]&&(e={...e,[t]:nQ(e[t],[`point`,`line`])});return e}function L0(e,t={},n){return e.point===`transparent`?{opacity:0}:e.point?Wm(e.point)?e.point:{}:e.point===void 0?t.point||n.shape?Wm(t.point)?t.point:{}:void 0:null}function Bje(e,t={}){return e.line?e.line===!0?{}:e.line:e.line===void 0?t.line?t.line===!0?{}:t.line:void 0:null}function Vje(e,t){return t?z1(e)?Gje(e,t):Hje(e,t):e}function R0(e,t){return t?Gje(e,t):e}function z0(e,t,n){let r=t[e];if(gAe(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};X(TOe(r.repeat));return}return t}function Hje(e,t){if(e=z0(`field`,e,t),e!==void 0){if(e===null)return null;if(H1(e)&&R1(e.sort)){let n=z0(`field`,e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Uje(e,t){if(Z(e))return Hje(e,t);{let n=z0(`datum`,e,t);return n!==e&&!n.type&&(n.type=`nominal`),n}}function Wje(e,t){if(Z1(e)){let n=Uje(e,t);if(n)return n;if(W1(e))return{condition:e.condition}}else{if(K1(e)){let n=Uje(e.condition,t);if(n)return{...e,condition:n};{let{condition:t,...n}=e;return n}}return e}}function Gje(e,t){let n={};for(let r in e)if(Y(e,r)){let i=e[r];if(H(i))n[r]=i.map(e=>Wje(e,t)).filter(e=>e);else{let e=Wje(i,t);e!==void 0&&(n[r]=e)}}return n}function Kje({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){let i=new Set([...$(e),...$(t)]);for(let a of i){let i=t[a],o=e[a];if(Z1(i)){let e={...o,...i};r[a]=e}else K1(i)?r[a]={...i,condition:{...o,...i.condition}}:i||i===null?r[a]=i:(n||$1(o)||h$(o)||Z1(o)||H(o))&&(r[a]=o)}}else r=t;return!r||mQ(r)?void 0:r}function qje(e){let{parentProjection:t,projection:n}=e;return t&&n&&X(AOe({parentProjection:t,projection:n})),n??t}function B0(e){return Y(e,`filter`)}function Jje(e){return Y(e,`stop`)}function Yje(e){return Y(e,`lookup`)}function Xje(e){return Y(e,`data`)}function Zje(e){return Y(e,`param`)}function Qje(e){return Y(e,`pivot`)}function $je(e){return Y(e,`density`)}function eMe(e){return Y(e,`quantile`)}function tMe(e){return Y(e,`regression`)}function nMe(e){return Y(e,`loess`)}function rMe(e){return Y(e,`sample`)}function iMe(e){return Y(e,`window`)}function aMe(e){return Y(e,`joinaggregate`)}function oMe(e){return Y(e,`flatten`)}function sMe(e){return Y(e,`calculate`)}function cMe(e){return Y(e,`bin`)}function lMe(e){return Y(e,`impute`)}function uMe(e){return Y(e,`timeUnit`)}function dMe(e){return Y(e,`aggregate`)}function fMe(e){return Y(e,`stack`)}function pMe(e){return Y(e,`fold`)}function mMe(e){return Y(e,`extent`)&&!Y(e,`density`)&&!Y(e,`regression`)}function hMe(e){return e.map(e=>B0(e)?{filter:$Z(e.filter,Ike)}:e)}function gMe(e,t){let{transform:n,...r}=e;if(n){let e=n.map(e=>{if(B0(e))return{filter:V0(e,t)};if(cMe(e)&&c$(e.bin))return{...e,bin:vMe(e.bin)};if(Yje(e)){let{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e});return{...r,transform:e}}return e}function _Me(e,t){let n=n4(e);if(Z(n)&&c$(n.bin)&&(n.bin=vMe(n.bin)),e0(n)&&n.scale?.domain?.selection){let{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(W1(n))if(H(n.condition))n.condition=n.condition.map(e=>{let{selection:n,param:r,test:i,...a}=e;return r?e:{...a,test:V0(e,t)}});else{let{selection:e,param:r,test:i,...a}=_Me(n.condition,t);n.condition=r?n.condition:{...a,test:V0(n.condition,t)}}return n}function vMe(e){let t=e.extent;if(t?.selection){let{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function V0(e,t){let n=e=>$Z(e,e=>{let n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n});return e.selection?n(e.selection):$Z(e.test||e.filter,e=>e.selection?n(e.selection):e)}function yMe(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function bMe(e,t){t===void 0&&(t=Cje(e.config));let n=xMe(e,t),{width:r,height:i}=e,a=CMe(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}function xMe(e,t={}){let n={config:t};return nze.map(eze.map(tze.map(e,n),n),n)}function SMe(e){return Yh(e)?{type:e}:e??{}}function CMe(e,t,n){let{width:r,height:i}=t,a=g0(e)||F0(e),o={};a?r==`container`&&i==`container`?(o.type=`fit`,o.contains=`padding`):r==`container`?(o.type=`fit-x`,o.contains=`padding`):i==`container`&&(o.type=`fit-y`,o.contains=`padding`):(r==`container`&&(X(F$(`width`)),r=void 0),i==`container`&&(X(F$(`height`)),i=void 0));let s={type:`pad`,...o,...n?SMe(n.autosize):{},...SMe(e.autosize)};if(s.type===`fit`&&!a&&(X(LLe),s.type=`pad`),r==`container`&&!(s.type==`fit`||s.type==`fit-x`)&&X(I$(`width`)),i==`container`&&!(s.type==`fit`||s.type==`fit-y`)&&X(I$(`height`)),!FQ(s,{type:`pad`}))return s}function wMe(e){return[`fit`,`fit-x`,`fit-y`].includes(e)}function TMe(e){return e?`fit-${XQ(e)}`:`fit`}function EMe(e,t){let n={};for(let t of rze)e&&e[t]!==void 0&&(n[t]=b$(e[t]));return t&&(n.params=e.params),n}function H0(e){return{explicit:!0,value:e}}function U0(e){return{explicit:!1,value:e}}function DMe(e){return(t,n,r,i)=>{let a=e(t.value,n.value);return a>0?t:a<0?n:W0(t,n,r,i)}}function W0(e,t,n,r){return e.explicit&&t.explicit&&X(ZOe(n,r,e.value,t.value)),e}function G0(e,t,n,r,i=W0){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:FQ(e.value,t.value)?e:i(e,t,n,r)}function K0(e){return Y(e,`url`)}function q0(e){return Y(e,`values`)}function OMe(e){return Y(e,`name`)&&!K0(e)&&!q0(e)&&!J0(e)}function J0(e){return e&&(kMe(e)||AMe(e)||Y0(e))}function kMe(e){return Y(e,`sequence`)}function AMe(e){return Y(e,`sphere`)}function Y0(e){return Y(e,`graticule`)}function jMe({invalid:e,isPath:t}){switch(Zke(e,{isPath:t})){case`filter`:return{marks:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`break-paths-show-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`include-invalid-values`};case`break-paths-filter-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`show`:return{marks:`include-invalid-values`,scales:`include-invalid-values`}}}function MMe(e){let{marks:t,scales:n}=jMe(e);return t===n?m6.Main:n===`include-invalid-values`?m6.PreFilterInvalid:m6.PostFilterInvalid}function X0(e){return e.as!==void 0}function NMe(e){return`${e}_end`}function PMe({timeUnit:e,field:t,reverse:n}){let{unit:r,utc:i}=e,{part:a,step:o}=Ake(Ske(r),e.step);return`${i?`utcOffset`:`timeOffset`}('${a}', ${CQ(t)}, ${n?-o:o})`}function FMe([e,t],n,r){if(n!==void 0&&n!==.5){let i=CQ(e),a=CQ(t);return[{type:`formula`,expr:IMe([PMe({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${v6}`},{type:`formula`,expr:IMe([i,a],n+.5),as:`${e}_${y6}`}]}return[]}function IMe([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}function LMe(e){let{signals:t,hasLegend:n,index:r,...i}=e;return i.field=TQ(i.field),i}function Z0(e,t=!0,n=Im){if(H(e)){let r=e.map(e=>Z0(e,t,n));return t?`[${r.join(`, `)}]`:r}else if(t1(e))return n(t?r1(e):vke(e));return t?n(IQ(e)):e}function RMe(e,t){for(let n of r4(e.component.selection??{})){let r=n.name,i=`${r}${G6}, ${n.resolve===`global`?`true`:`{unit: ${p2(e)}}`}`;for(let r of q6)r.defined(n)&&(r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(i=r.modifyExpr(e,n,i)));t.push({name:r+vze,on:[{events:{signal:n.name+G6},update:`modify(${W(n.name+W6)}, ${i})`}]})}return Q0(t)}function zMe(e,t){if(e.component.selection&&$(e.component.selection).length){let n=W(e.getName(`cell`));t.unshift({name:`facet`,value:{},on:[{events:oK(`pointermove`,`scope`),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Q0(t)}function BMe(e,t){let n=!1;for(let r of r4(e.component.selection??{})){let i=r.name,a=W(i+W6);if(t.filter(e=>e.name===i).length===0){let e=r.resolve===`global`?`union`:r.resolve,n=r.type===`point`?`, true, true)`:`)`;t.push({name:r.name,update:`${K6}(${a}, ${W(e)}${n}`})}n=!0;for(let n of q6)n.defined(r)&&n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))}return n&&t.filter(e=>e.name===`unit`).length===0&&t.unshift({name:`unit`,value:{},on:[{events:`pointermove`,update:`isTuple(group()) ? group() : unit`}]}),Q0(t)}function VMe(e,t){let n=[],r=[],i=p2(e,{escape:!1});for(let a of r4(e.component.selection??{})){let o={name:a.name+W6};if(a.project.hasSelectionId&&(o.transform=[{type:`collect`,sort:{field:i6}}]),a.init){let e=a.project.items.map(LMe);o.values=a.project.hasSelectionId?a.init.map(e=>({unit:i,[i6]:Z0(e,!1)[0]})):a.init.map(t=>({unit:i,fields:e,values:Z0(t,!1)}))}if([...n,...t].filter(e=>e.name===a.name+W6).length||n.push(o),h2(a)&&t.length){let n=e.lookupDataSource(e.getDataName(m6.Main)),i=t.find(e=>e.name===n),a=i.transform.find(e=>e.type===`filter`&&e.expr.includes(`vlSelectionTest`));if(a){i.transform=i.transform.filter(e=>e!==a);let e={name:i.name+x6,source:i.name,transform:[a]};r.push(e)}}}return n.concat(t,r)}function HMe(e,t){for(let n of r4(e.component.selection??{}))for(let r of q6)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function UMe(e,t){for(let n of e.children)W2(n)&&(t=HMe(n,t));return t}function WMe(e,t,n,r){let i=wNe(e,t.param,t);return{signal:y1(n.get(`type`))&&H(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function Q0(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}function $0(e,t){return`domain(${W(e.scaleName(t))})`}function e2(e){return e.parent&&q2(e.parent)&&(!e.parent.parent||e2(e.parent.parent))}function GMe(e,t,n,r){let i=!e.hasProjection,a=n.channel,o=n.signals.visual,s=W(i?e.scaleName(a):e.projectionName()),c=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(a===u4?`width`:`height`).signal,u=`${a}(unit)`,d=t.events.reduce((e,t)=>[...e,{events:t.between[0],update:`[${u}, ${u}]`},{events:t,update:`[${o}[0], clamp(${u}, 0, ${l})]`}],[]);if(i){let i=n.signals.data,l=k6.defined(t),u=e.getScaleComponent(a),f=u?u.get(`type`):void 0,p=r?{init:Z0(r,!0,c)}:{value:[]};return d.push({events:{signal:t.name+j6},update:y1(f)?`[${c(`${i}[0]`)}, ${c(`${i}[1]`)}]`:`[0, 0]`}),l?[{name:i,on:[]}]:[{name:o,...p,on:d},{name:i,...r?{init:Z0(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]}]}else{let e=a===u4?0:1,n=t.name+N6;return[{name:o,...r?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:d}]}}function t2({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){let a=W1(t)&&t.condition,o=[];a&&(o=yh(a).map(t=>{let n=i(t);if(hAe(t)){let{param:r,empty:i}=t;return{test:CNe(e,{param:r,empty:i}),...n}}else return{test:_2(e,t.test),...n}})),r!==void 0&&o.push(r);let s=i(t);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function n2(e,t=`text`){let n=e.encoding[t];return t2({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>r2(t,e.config),invalidValueRef:void 0})}function r2(e,t,n=`datum`){if(e){if($1(e))return S$(e.value);if(Z1(e)){let{format:r,formatType:i}=o0(e);return P1({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function KMe(e,t={}){let{encoding:n,markDef:r,config:i,stack:a}=e,o=n.tooltip;if(H(o))return{tooltip:JMe({tooltip:o},a,i,t)};{let s=t.reactiveGeom?`datum.datum`:`datum`;return t2({model:e,channelDef:o,vgChannel:`tooltip`,mainRefFn:e=>{let o=YMe(e,i,s);if(o)return o;if(e===null)return;let c=E$(`tooltip`,r,i);if(c===!0&&(c={content:`encoding`}),Yh(c))return{value:c};if(Wm(c))return h$(c)?c:c.content===`encoding`?JMe(n,a,i,t):{signal:s}},invalidValueRef:void 0})}}function qMe(e,t,n,{reactiveGeom:r}={}){let i={...n,...n.tooltipFormat},a=new Set,o=r?`datum.datum`:`datum`,s=[];function c(n,r){let c=UQ(r),l=Q1(n)?n:{...n,type:e[c].type},u=yh(l.title||a0(l,i)).join(`, `).replaceAll(/"/g,`\\"`),d;if(YQ(r)){let t=r===`x`?`x2`:`y2`,n=s0(e[t]);if(s$(l.bin)&&n){let e=Q(l,{expr:o}),r=Q(n,{expr:o}),{format:s,formatType:c}=o0(l);d=L1(e,r,s,c,i),a.add(t)}}if((YQ(r)||r===v4||r===g4)&&t&&t.fieldChannel===r&&t.offset===`normalize`){let{format:e,formatType:t}=o0(l);d=P1({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:i,normalizeStack:!0}).signal}d??=YMe(l,i,o).signal,s.push({channel:r,key:u,value:d})}y0(e,(e,t)=>{Z(e)?c(e,t):G1(e)&&c(e.condition,t)});let l={};for(let{channel:e,key:t,value:n}of s)!a.has(e)&&!l[t]&&(l[t]=n);return l}function JMe(e,t,n,{reactiveGeom:r}={}){let i=qMe(e,t,n,{reactiveGeom:r}),a=i4(i).map(([e,t])=>`"${e}": ${t}`);return a.length>0?{signal:`{${a.join(`, `)}}`}:void 0}function YMe(e,t,n=`datum`){if(Z(e)&&_1(e.type)&&!e.timeUnit&&!o0(e).format&&!o0(e).formatType){let t=`${n}["${e.field}"]`;return{signal:`isValid(${t}) ? isArray(${t}) ? join(${t}, '\\n') : ${t} : ""+${t}`}}return r2(e,t,n)}function XMe(e){let{markDef:t,config:n}=e,r=E$(`aria`,t,n);return r===!1?{}:{...r?{aria:r}:{},...ZMe(e),...QMe(e)}}function ZMe(e){let{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};let i=E$(`ariaRoleDescription`,n,r);return i==null?Ih(FLe,t)?{}:{ariaRoleDescription:{value:t}}:{ariaRoleDescription:{value:i}}}function QMe(e){let{encoding:t,markDef:n,config:r,stack:i}=e,a=t.description;if(a)return t2({model:e,channelDef:a,vgChannel:`description`,mainRefFn:t=>r2(t,e.config),invalidValueRef:void 0});let o=E$(`description`,n,r);if(o!=null)return{description:S$(o)};if(r.aria===!1)return{};let s=qMe(t,i,r);if(!mQ(s))return{description:{signal:i4(s).filter(([e])=>!e.startsWith(`_`)).map(([e,t])=>[e,t.replaceAll(`\\n`,` `)]).map(([e,t],n)=>`"${n>0?`; `:``}${e}: " + (${t})`).join(` + `)}}}function i2(e,t,n={}){let{markDef:r,encoding:i,config:a}=t,{vgChannel:o}=n,{defaultRef:s,defaultValue:c}=n,l=i[e];s===void 0&&(c??=E$(e,r,a,{vgChannel:o,ignoreVgConfig:!W1(l)}),c!==void 0&&(s=S$(c)));let u={markDef:r,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},d=eAe({...u,scaleChannel:e,channelDef:l});return t2({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:d,mainRefFn:t=>j1({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function $Me(e,t={filled:void 0}){let{markDef:n,encoding:r,config:i}=e,{type:a}=n,o=t.filled??E$(`filled`,n,i),s=aQ([`bar`,`point`,`circle`,`square`,`geoshape`],a)?`transparent`:void 0,c=E$(o===!0?`color`:void 0,n,i,{vgChannel:`fill`})??i.mark[o===!0&&`color`]??s,l=E$(o===!1?`color`:void 0,n,i,{vgChannel:`stroke`})??i.mark[o===!1&&`color`],u=o?`fill`:`stroke`,d={...c?{fill:S$(c)}:{},...l?{stroke:S$(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&X(G$(`property`,{fill:`fill`in n,stroke:`stroke`in n})),{...d,...i2(`color`,e,{vgChannel:u,defaultValue:o?c:l}),...i2(`fill`,e,{defaultValue:r.fill?c:void 0}),...i2(`stroke`,e,{defaultValue:r.stroke?l:void 0})}}function eNe(e){let{encoding:t,mark:n}=e,r=t.order;return!C1(n)&&$1(r)?t2({model:e,channelDef:r,vgChannel:`zindex`,mainRefFn:e=>S$(e.value),invalidValueRef:void 0}):{}}function a2({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){let a=`${e}Offset`,o=t[a],s=n[a];if((a===`xOffset`||a===`yOffset`)&&s)return{offsetType:`encoding`,offset:j1({channel:a,channelDef:s,markDef:t,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:S$(o),bandPosition:i})};let c=t[a];return c?{offsetType:`visual`,offset:c}:{}}function o2(e,t,{defaultPos:n,vgChannel:r}){let{encoding:i,markDef:a,config:o,stack:s}=t,c=i[e],l=i[GQ(e)],u=t.scaleName(e),d=t.getScaleComponent(e),{offset:f,offsetType:p}=a2({channel:e,markDef:a,encoding:i,model:t,bandPosition:.5}),m=s2({model:t,defaultPos:n,channel:e,scaleName:u,scale:d}),h=!c&&YQ(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:tNe({channel:e,channelDef:c,channel2Def:l,markDef:a,config:o,scaleName:u,scale:d,stack:s,offset:f,defaultRef:m,bandPosition:p===`encoding`?0:void 0});return h?{[r||e]:h}:void 0}function tNe(e){let{channel:t,channelDef:n,scaleName:r,stack:i,offset:a,markDef:o}=e;if(Z1(n)&&i&&t===i.fieldChannel){if(Z(n)){let e=n.bandPosition;if(e===void 0&&o.type===`text`&&(t===`radius`||t===`theta`)&&(e=.5),e!==void 0)return A1({scaleName:r,fieldOrDatumDef:n,startSuffix:`start`,bandPosition:e,offset:a})}return k1(n,r,{suffix:`end`},{offset:a})}return O1(e)}function s2({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){let{markDef:a,config:o}=e;return()=>{let s=UQ(n),c=WQ(n),l=E$(n,a,o,{vgChannel:c});if(l!==void 0)return M1(n,l);switch(t){case`zeroOrMin`:return nNe({scaleName:r,scale:i,mode:`zeroOrMin`,mainChannel:s,config:o});case`zeroOrMax`:return nNe({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:o});case`mid`:return{...e[KQ(n)],mult:.5}}}}function nNe({mainChannel:e,config:t,...n}){let r=$ke(n),{mode:i}=n;if(r)return r;switch(e){case`radius`:{if(i===`zeroOrMin`)return{value:0};let{widthSignal:e,heightSignal:t}=i.zeroOrMax;return{signal:`min(${e},${t})/2`}}case`theta`:return i===`zeroOrMin`?{value:0}:{signal:`2*PI`};case`x`:return i===`zeroOrMin`?{value:0}:{field:{group:`width`}};case`y`:return i===`zeroOrMin`?{field:{group:`height`}}:{value:0}}}function rNe(e,t,n,r=`middle`){if(e===`radius`||e===`theta`)return WQ(e);let i=e===`x`?`align`:`baseline`,a=E$(i,t,n),o;return h$(a)?(X(BOe(i)),o=void 0):o=a,e===`x`?fze[o||(r===`top`?`left`:`center`)]:pze[o||r]}function c2(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?iNe(e,t,{defaultPos:n,defaultPos2:r}):o2(e,t,{defaultPos:n})}function iNe(e,t,{defaultPos:n,defaultPos2:r}){let{markDef:i,config:a}=t,o=GQ(e),s=KQ(e),c=aNe(t,r,o);return{...o2(e,t,{defaultPos:n,vgChannel:c[s]?rNe(e,i,a):WQ(e)}),...c}}function aNe(e,t,n){let{encoding:r,mark:i,markDef:a,stack:o,config:s}=e,c=UQ(n),l=KQ(n),u=WQ(n),d=r[c],f=e.scaleName(c),p=e.getScaleComponent(c),{offset:m}=n in r||n in a?a2({channel:n,markDef:a,encoding:r,model:e}):a2({channel:c,markDef:a,encoding:r,model:e});if(!d&&(n===`x2`||n===`y2`)&&(r.latitude||r.longitude)){let t=KQ(n),r=e.markDef[t];return r==null?{[u]:{field:e.getName(n)}}:{[t]:{value:r}}}let h=oNe({channel:n,channelDef:d,channel2Def:r[n],markDef:a,config:s,scaleName:f,scale:p,stack:o,offset:m,defaultRef:void 0});return h===void 0?l2(n,a)||l2(n,{[n]:O$(n,a,s.style),[l]:O$(l,a,s.style)})||l2(n,s[i])||l2(n,s.mark)||{[u]:s2({model:e,defaultPos:t,channel:n,scaleName:f,scale:p})()}:{[u]:h}}function oNe({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:o,stack:s,offset:c,defaultRef:l}){return Z1(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?k1(t,a,{suffix:`start`},{offset:c}):O1({channel:e,channelDef:n,scaleName:a,scale:o,stack:s,markDef:r,config:i,offset:c,defaultRef:l})}function l2(e,t){let n=KQ(e),r=WQ(e);if(t[r]!==void 0)return{[r]:M1(e,t[r])};if(t[e]!==void 0)return{[r]:M1(e,t[e])};if(t[n]){let r=t[n];if(E1(r))X(FOe(n));else return{[n]:M1(e,r)}}}function u2(e,t){let{config:n,encoding:r,markDef:i}=e,a=i.type,o=GQ(t),s=KQ(t),c=r[t],l=r[o],u=e.getScaleComponent(t),d=u?u.get(`type`):void 0,f=i.orient,p=r[s]??r.size??E$(`size`,i,n,{vgChannel:s}),m=qQ(t),h=a===`bar`&&(t===`x`?f===`vertical`:f===`horizontal`)||a===`tick`&&(t===`y`?f===`vertical`:f===`horizontal`);return Z(c)&&(o$(c.bin)||s$(c.bin)||c.timeUnit&&!l)&&!(p&&!E1(p))&&!r[m]&&!v1(d)?uNe({fieldDef:c,fieldDef2:l,channel:t,model:e}):(Z1(c)&&v1(d)||h)&&!l?cNe(c,t,e):iNe(t,e,{defaultPos:`zeroOrMax`,defaultPos2:`zeroOrMin`})}function sNe(e,t,n,r,i,a,o){if(E1(i))if(n){let e=n.get(`type`);if(e===`band`){let e=`bandwidth('${t}')`;i.band!==1&&(e=`${i.band} * ${e}`);let n=D$(`minBandSize`,{type:o},r);return{signal:n?`max(${w$(n)}, ${e})`:e}}else i.band!==1&&X(WOe(e))}else return{mult:i.band,field:{group:e}};else if(h$(i))return i;else if(i)return{value:i};if(n){let e=n.get(`range`);if(g$(e)&&Kh(e.step))return{value:e.step-2}}if(!a){let{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:i,tickBandPaddingInner:a}=r.scale,s=kQ(t,o===`tick`?a:o===`bar`?n:i);if(h$(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(Kh(s))return{signal:`${1-s} * ${e}`}}return{value:N0(r.view,e)-2}}function cNe(e,t,n){let{markDef:r,encoding:i,config:a,stack:o}=n,s=r.orient,c=n.scaleName(t),l=n.getScaleComponent(t),u=KQ(t),d=GQ(t),f=qQ(t),p=n.scaleName(f),m=n.getScaleComponent(JQ(t)),h=r.type===`tick`||s===`horizontal`&&t===`y`||s===`vertical`&&t===`x`,g;(i.size||r.size)&&(h?g=i2(`size`,n,{vgChannel:u,defaultRef:S$(r.size)}):X(JOe(r.type)));let _=!!g,v=vAe({channel:t,fieldDef:e,markDef:r,config:a,scaleType:(l||m)?.get(`type`),useVlSizeChannel:h});g||={[u]:sNe(u,p||c,m||l,a,v,!!e,r.type)};let y=rNe(t,r,a,(l||m)?.get(`type`)===`band`&&E1(v)&&!_?`top`:`middle`),b=y===`xc`||y===`yc`,{offset:x,offsetType:S}=a2({channel:t,markDef:r,encoding:i,model:n,bandPosition:b?.5:0}),C=(b&&S!==`encoding`&&Z(e)&&e.timeUnit&&!i[d]?U1({fieldDef:e,markDef:r,config:a}):void 0)??(b?S===`encoding`?0:.5:h$(v)?{signal:`(1-${v})/2`}:E1(v)?(1-v.band)/2:0),w=O1({channel:t,channelDef:e,markDef:r,config:a,scaleName:c,scale:l,stack:o,offset:x,defaultRef:s2({model:n,defaultPos:`mid`,channel:t,scaleName:c,scale:l}),bandPosition:C});if(u)return{[y]:w,...g};{let e=WQ(d),t=g[u],n=x?{...t,offset:x}:t;return{[y]:w,[e]:H(w)?[w[0],{...w[1],offset:n}]:{...w,offset:n}}}}function lNe(e,t,n,r,i,a,o){if(LQ(e))return 0;let s=e===`x`||e===`y2`,c=s?-t/2:t/2;if(h$(n)||h$(i)||h$(r)||a){let e=w$(n),t=w$(i),l=w$(r),u=w$(a),d=a?`(${o} < ${u} ? ${s?``:`-`}0.5 * (${u} - (${o})) : ${c})`:c,f=l?`${l} + `:``,p=e?`(${e} ? -1 : 1) * `:``,m=t?`(${t} + ${d})`:d;return{signal:f+p+m}}else return i||=0,r+(n?-i-c:+i+c)}function uNe({fieldDef:e,fieldDef2:t,channel:n,model:r}){let{config:i,markDef:a,encoding:o}=r,s=r.getScaleComponent(n),c=r.scaleName(n),l=s?s.get(`type`):void 0,u=s.get(`reverse`),d=vAe({channel:n,fieldDef:e,markDef:a,config:i,scaleType:l}),f=(r.component.axes[n]?.[0])?.get(`translate`)??.5,p=YQ(n)?E$(`binSpacing`,a,i)??0:0,m=GQ(n),h=WQ(n),g=WQ(m),_=D$(`minBandSize`,a,i),{offset:v}=a2({channel:n,markDef:a,encoding:o,model:r,bandPosition:0}),{offset:y}=a2({channel:m,markDef:a,encoding:o,model:r,bandPosition:0}),b=rAe({fieldDef:e,scaleName:c}),x=lNe(n,p,u,f,v,_,b),S=lNe(m,p,u,f,y??v,_,b),C=h$(d)?{signal:`(1-${d.signal})/2`}:E1(d)?(1-d.band)/2:.5,w=U1({fieldDef:e,fieldDef2:t,markDef:a,config:i});if(o$(e.bin)||e.timeUnit){let t=e.timeUnit&&w!==.5;return{[g]:dNe({fieldDef:e,scaleName:c,bandPosition:C,offset:S,useRectOffsetField:t}),[h]:dNe({fieldDef:e,scaleName:c,bandPosition:h$(C)?{signal:`1-${C.signal}`}:1-C,offset:x,useRectOffsetField:t})}}else if(s$(e.bin)){let n=k1(e,c,{},{offset:S});if(Z(t))return{[g]:n,[h]:k1(t,c,{},{offset:x})};if(c$(e.bin)&&e.bin.step)return{[g]:n,[h]:{signal:`scale("${c}", ${Q(e,{expr:`datum`})} + ${e.bin.step})`,offset:x}}}X($$(m))}function dNe({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return A1({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:v6,endSuffix:y6}:{}})}function d2(e,t){let{fill:n=void 0,stroke:r=void 0}=t.color===`include`?$Me(e):{};return{...pNe(e.markDef,t),...fNe(`fill`,n),...fNe(`stroke`,r),...i2(`opacity`,e),...i2(`fillOpacity`,e),...i2(`strokeOpacity`,e),...i2(`strokeWidth`,e),...i2(`strokeDash`,e),...eNe(e),...KMe(e),...n2(e,`href`),...XMe(e)}}function fNe(e,t){return t?{[e]:t}:{}}function pNe(e,t){return PLe.reduce((n,r)=>(!mze.has(r)&&Y(e,r)&&t[r]!==`ignore`&&(n[r]=S$(e[r])),n),{})}function f2(e){let{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,a)=>{let o;if(!$Q(a)||!(o=e.getScaleType(a)))return;let s=i$(i.aggregate);if(Qke(D1({scaleChannel:a,markDef:n,config:t,scaleType:o,isCountAggregate:s}))){let t=e.vgField(a,{expr:`datum`,binSuffix:e.stack?.impute?`mid`:void 0});t&&r.add(t)}}),r.size>0)return{defined:{signal:[...r].map(e=>g1(e,!0)).join(` && `)}}}function mNe(e,t){if(t!==void 0)return{[e]:S$(t)}}function hNe(e,t,n){let r=e.fieldDef(t)?.field;for(let i of r4(e.component.selection??{})){let e=i.project.hasField[r]??i.project.hasChannel[t];if(e&&z6.defined(i)){let t=n.get(`selections`)??[];t.push(i.name),n.set(`selections`,t,!1),e.hasLegend=!0}}}function gNe(e,t,n,r,i){let a=t.name,o=a+B6,s=a+V6,c=n.channel,l=k6.defined(t),u=i.find(e=>e.name===n.signals[l?`data`:`visual`]),d=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(c),p=f?.get(`type`),m=f?.get(`reverse`),h=l?c===u4?m?``:`-`:m?`-`:``:``,g=`${o}.extent_${c}`,_=`${h}${s}.${c} / ${l?`${d}`:`span(${g})`}`,v=`${!l||!f?`panLinear`:p===`log`?`panLog`:p===`symlog`?`panSymlog`:p===`pow`?`panPow`:`panLinear`}(${g}, ${_}${l?p===`pow`?`, ${f.get(`exponent`)??1}`:p===`symlog`?`, ${f.get(`constant`)??1}`:``:``})`;u.on.push({events:{signal:s},update:l?v:`clampRange(${v}, 0, ${d})`})}function _Ne(e,t,n,r,i){let a=t.name,o=n.channel,s=k6.defined(t),c=i.find(e=>e.name===n.signals[s?`data`:`visual`]),l=e.getSizeSignalRef(r).signal,u=e.getScaleComponent(o),d=u?.get(`type`),f=s?$0(e,o):c.name,p=a+U6,m=`${a}${H6}.${o}`,h=`${!s||!u?`zoomLinear`:d===`log`?`zoomLog`:d===`symlog`?`zoomSymlog`:d===`pow`?`zoomPow`:`zoomLinear`}(${f}, ${m}, ${p}${s?d===`pow`?`, ${u.get(`exponent`)??1}`:d===`symlog`?`, ${u.get(`constant`)??1}`:``:``})`;c.on.push({events:{signal:p},update:s?h:`clampRange(${h}, 0, ${l})`})}function vNe(e){let t=e.parent;for(;t&&!G2(t);)t=t.parent;return t}function p2(e,{escape:t}={escape:!0}){let n=t?W(e.name):e.name,r=vNe(e);if(r){let{facet:e}=r;for(let t of J4)e[t]&&(n+=` + '__facet_${t}_' + (facet[${W(r.vgField(t))}])`)}return n}function m2(e){return r4(e.component.selection??{}).reduce((e,t)=>e||t.project.hasSelectionId,!1)}function yNe(e,t){(Yh(t.select)||!t.select.on)&&delete e.events,(Yh(t.select)||!t.select.clear)&&delete e.clear,(Yh(t.select)||!t.select.toggle)&&delete e.toggle}function h2(e){return e.events?.find(e=>`type`in e&&e.type===`timer`)}function g2(e){let t=[];return e.type===`Identifier`?[e.name]:e.type===`Literal`?[e.value]:(e.type===`MemberExpression`&&(t.push(...g2(e.object)),t.push(...g2(e.property))),t)}function bNe(e){return e.object.type===`MemberExpression`?bNe(e.object):e.object.name===`datum`}function xNe(e){let t=rOe(e),n=new Set;return t.visit(e=>{e.type===`MemberExpression`&&bNe(e)&&n.add(g2(e).slice(1).join(`.`))}),n}function SNe(e,t){let n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(let a of t){let t=_Q(a.name),o=a.select,s=Yh(o)?o:o.type,c=Wm(o)?n4(o):{type:s},l=r[s];for(let e in l)e===`fields`||e===`encodings`||(e===`mark`&&(c.mark={...l.mark,...c.mark}),(c[e]===void 0||c[e]===!0)&&(c[e]=n4(l[e]??c[e])));let u=n[t]={...c,name:t,type:s,init:a.value,bind:a.bind,events:Yh(c.on)?oK(c.on,`scope`):yh(n4(c.on))};if(h2(u)&&(i++,i>1)){delete n[t];continue}let d=n4(a);for(let t of q6)t.defined(u)&&t.parse&&t.parse(e,u,d)}return i>1&&X(ULe),n}function CNe(e,t,n,r=`datum`){let i=Yh(t)?t:t.param,a=_Q(i),o=W(a+W6),s;try{s=e.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){let t=n??e.component.data.raw,r=s.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}let c=`${s.project.hasSelectionId?`vlSelectionIdTest(`:`vlSelectionTest(`}${o}, ${r}${s.resolve===`global`?`)`:`, ${W(s.resolve)})`}`,l=`length(data(${o}))`;return t.empty===!1?`${l} && ${c}`:`!${l} || ${c}`}function wNe(e,t,n){let r=_Q(t),i=n.encoding,a=n.field,o;try{o=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!a)a=o.project.items[0].field,o.project.items.length>1&&X(EOe(a));else if(i&&!a){let e=o.project.items.filter(e=>e.channel===i);!e.length||e.length>1?(a=o.project.items[0].field,X(DOe(e,i,n,a))):a=e[0].field}return`${o.name}[${W(TQ(a))}]`}function TNe(e,t){for(let[n,r]of i4(e.component.selection??{})){let i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new g6(new J6(t,e,{param:n}),i,m6.Lookup,e.component.data.outputNodeRefCounts)}}function _2(e,t,n){return vQ(t,t=>Yh(t)?t:jke(t)?CNe(e,t,n):Fke(t))}function ENe(e,t){if(e)return H(e)&&!m$(e)?e.map(e=>a0(e,t)).join(`, `):e}function v2(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function y2(e,t,n,r={header:!1}){let{disable:i,orient:a,scale:o,labelExpr:s,title:c,zindex:l,...u}=e.combine();if(!i){for(let e in u){let n=e,r=DRe[n],i=u[n];if(r&&r!==t&&r!==`both`)delete u[n];else if(h0(i)){let{condition:e,...t}=i,r=yh(e),a=G3[n];if(a){let{vgProp:e,part:i}=a;v2(u,i,e,[...r.map(e=>{let{test:t,...n}=e;return{test:_2(null,t),...n}}),t]),delete u[n]}else a===null&&(u[n]={signal:r.map(e=>{let{test:t,...n}=e;return`${_2(null,t)} ? ${C$(n)} : `}).join(``)+C$(t)})}else if(h$(i)){let e=G3[n];if(e){let{vgProp:t,part:r}=e;v2(u,r,t,i),delete u[n]}}aQ([`labelAlign`,`labelBaseline`],n)&&u[n]===null&&delete u[n]}if(t===`grid`){if(!u.grid)return;if(u.encode){let{grid:e}=u.encode;u.encode={...e?{grid:e}:{}},mQ(u.encode)&&delete u.encode}return{scale:o,orient:a,...u,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:kQ(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(s!==void 0){let e=s;u.encode?.labels?.update&&h$(u.encode.labels.update.text)&&(e=EQ(s,`datum.label`,u.encode.labels.update.text.signal)),v2(u,`labels`,`text`,{signal:e})}if(u.labelAlign===null&&delete u.labelAlign,u.encode){for(let t of K3)e.hasAxisPart(t)||delete u.encode[t];mQ(u.encode)&&delete u.encode}let t=ENe(c,n);return{scale:o,orient:a,grid:!1,...t?{title:t}:{},...u,...n.aria===!1?{aria:!1}:{},zindex:kQ(l,0)}}}}function DNe(e){let{axes:t}=e.component,n=[];for(let r of Q4)if(t[r]){for(let i of t[r])if(!i.get(`disable`)&&!i.get(`gridScale`)){let t=r===`x`?`height`:`width`,i=e.getSizeSignalRef(t).signal;t!==i&&n.push({name:t,update:i})}}return n}function ONe(e,t){let{x:n=[],y:r=[]}=e;return[...n.map(e=>y2(e,`grid`,t)),...r.map(e=>y2(e,`grid`,t)),...n.map(e=>y2(e,`main`,t)),...r.map(e=>y2(e,`main`,t))].filter(e=>e)}function kNe(e,t,n,r){return Object.assign.apply(null,[{},...e.map(e=>{if(e===`axisOrient`){let e=n===`x`?`bottom`:`left`,i=t[n===`x`?`axisBottom`:`axisLeft`]||{},a=t[n===`x`?`axisTop`:`axisRight`]||{},o=new Set([...$(i),...$(a)]),s={};for(let t of o.values())s[t]={signal:`${r.signal} === "${e}" ? ${w$(i[t])} : ${w$(a[t])}`};return s}return t[e]})])}function ANe(e,t,n,r){let i=t===`band`?[`axisDiscrete`,`axisBand`]:t===`point`?[`axisDiscrete`,`axisPoint`]:Vke(t)?[`axisQuantitative`]:t===`time`||t===`utc`?[`axisTemporal`]:[],a=e===`x`?`axisX`:`axisY`,o=h$(n)?`axisOrient`:`axis${bQ(n)}`,s=[...i,...i.map(e=>a+e.substr(4))],c=[`axis`,o,a];return{vlOnlyAxisConfig:kNe(s,r,e,n),vgAxisConfig:kNe(c,r,e,n),axisConfigStyle:jNe([...c,...s],r)}}function jNe(e,t){let n=[{}];for(let r of e){let e=t[r]?.style;if(e){e=yh(e);for(let r of e)n.push(t.style[r])}}return Object.assign.apply(null,n)}function b2(e,t,n,r={}){let i=k$(e,n,t);if(i!==void 0)return{configFrom:`style`,configValue:i};for(let t of[`vlOnlyAxisConfig`,`vgAxisConfig`,`axisConfigStyle`])if(r[t]?.[e]!==void 0)return{configFrom:t,configValue:r[t][e]};return{}}function MNe(e,t){return!v1(e)&&Z(t)&&!o$(t?.bin)&&!s$(t?.bin)}function NNe(e,t){let n=t===`x`?`y`:`x`;if(e.getScaleComponent(n))return e.scaleName(n)}function PNe(e,t,n,r,i){let a=t?.labelAngle;if(a!==void 0)return h$(a)?a:NQ(a);{let{configValue:a}=b2(`labelAngle`,r,t?.style,i);return a===void 0?n===u4&&aQ([v3,g3],e.type)&&!(Z(e)&&e.timeUnit)?270:void 0:NQ(a)}}function x2(e){return`(((${e.signal} % 360) + 360) % 360)`}function FNe(e,t,n,r){if(e!==void 0)if(n===`x`){if(h$(e)){let n=x2(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${h$(t)?`(${t.signal} === "top")`:t===`top`} ? "bottom" : "top"`}}if(450;if(a||u){let s=t===`row`?`height`:`width`;return{name:e.getName(`${t}_${n}`),type:`group`,role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:YNe(o,t)}:{},...u&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[s]:i.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}function ZNe(e,t){return yze[t][e]}function QNe(e,t){let n={};for(let r of J4){let i=e[r];if(i?.facetFieldDef){let{titleAnchor:e,titleOrient:a}=T2([`titleAnchor`,`titleOrient`],i.facetFieldDef.header,t,r),o=C2(r,a),s=ZNe(e,o);s!==void 0&&(n[o]=s)}}return mQ(n)?void 0:n}function $Ne(e,t,n,r,i){let a={};for(let o of r){if(!i[o])continue;let r=w2(o,t?.header,e,n);r!==void 0&&(a[i[o]]=r)}return a}function D2(e){return[...O2(e,`width`),...O2(e,`height`),...O2(e,`childWidth`),...O2(e,`childHeight`)]}function O2(e,t){let n=t===`width`?`x`:`y`,r=e.component.layoutSize.get(t);if(r==null||r===`merged`)return[];let i=e.getSizeSignalRef(t).signal;if(r===`step`){let t=e.getScaleComponent(n);if(t){let r=t.get(`type`),a=t.get(`range`);if(v1(r)&&g$(a)){let r=e.scaleName(n);return G2(e.parent)&&e.parent.component.resolve.scale[n]===`independent`?[ePe(r,a)]:[ePe(r,a),{name:i,update:tPe(r,t,`domain('${r}').length`)}]}}throw Error(`layout size is step although width/height is not step.`)}else if(r==`container`){let t=i.endsWith(`width`),n=t?`containerSize()[0]`:`containerSize()[1]`,r=`isFinite(${n}) ? ${n} : ${M0(e.config.view,t?`width`:`height`)}`;return[{name:i,init:r,on:[{update:r,events:`window:resize`}]}]}else return[{name:i,value:r}]}function ePe(e,t){let n=`${e}_step`;return h$(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function tPe(e,t,n){let r=t.get(`type`),i=t.get(`padding`),a=kQ(t.get(`paddingOuter`),i),o=t.get(`paddingInner`);return o=r===`band`?o===void 0?i:o:1,`bandspace(${n}, ${w$(o)}, ${w$(a)}) * ${e}_step`}function nPe(e){return e===`childWidth`?`width`:e===`childHeight`?`height`:e}function rPe(e,t){return $(e).reduce((n,r)=>({...n,...t2({model:t,channelDef:e[r],vgChannel:r,mainRefFn:e=>S$(e.value),invalidValueRef:void 0})}),{})}function iPe(e,t){if(G2(t))return e===`theta`?`independent`:`shared`;if(q2(t))return`shared`;if(K2(t))return YQ(e)||e===`theta`||e===`radius`?`independent`:`shared`;throw Error(`invalid model type for resolve`)}function k2(e,t){let n=e.scale[t],r=YQ(t)?`axis`:`legend`;return n===`independent`?(e[r][t]===`shared`&&X($Oe(t)),`independent`):e[r][t]||`shared`}function aPe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:a}){if(a!==`symbol`)return;let{markDef:o,encoding:s,config:c,mark:l}=n,u=o.filled&&l!==`trail`,d={...yOe({},n,bRe),...$Me(n,{filled:u})},f=i.get(`symbolOpacity`)??c.legend.symbolOpacity,p=i.get(`symbolFillColor`)??c.legend.symbolFillColor,m=i.get(`symbolStrokeColor`)??c.legend.symbolStrokeColor,h=f===void 0?lPe(s.opacity)??o.opacity:void 0;if(d.fill){if(r===`fill`||u&&r===T4)delete d.fill;else if(Y(d.fill,`field`))p?delete d.fill:(d.fill=S$(c.legend.symbolBaseFillColor??`black`),d.fillOpacity=S$(h??1));else if(H(d.fill)){let e=A2(s.fill??s.color)??o.fill??(u&&o.color);e&&(d.fill=S$(e))}}if(d.stroke){if(r===`stroke`||!u&&r===T4)delete d.stroke;else if(Y(d.stroke,`field`)||m)delete d.stroke;else if(H(d.stroke)){let e=kQ(A2(s.stroke||s.color),o.stroke,u?o.color:void 0);e&&(d.stroke={value:e})}}if(r!==j4){let e=Z(t)&&dPe(n,i,t);e?d.opacity=[{test:e,...S$(h??1)},S$(c.legend.unselectedOpacity)]:h&&(d.opacity=S$(h))}return d={...d,...e},mQ(d)?void 0:d}function oPe(e,{model:t,legendType:n,legendCmpt:r}){if(n!==`gradient`)return;let{config:i,markDef:a,encoding:o}=t,s={},c=(r.get(`gradientOpacity`)??i.legend.gradientOpacity)===void 0?lPe(o.opacity)||a.opacity:void 0;return c&&(s.opacity=S$(c)),s={...s,...e},mQ(s)?void 0:s}function sPe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){let a=n.legend(r)||{},o=n.config,s=Z(t)?dPe(n,i,t):void 0,c=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:u}=a,d;N1(u)?d=F1({fieldOrDatumDef:t,field:`datum.value`,format:l,formatType:u,config:o}):l===void 0&&u===void 0&&o.customFormatTypes&&(t.type===`quantitative`&&o.numberFormatType?d=F1({fieldOrDatumDef:t,field:`datum.value`,format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type===`temporal`&&o.timeFormatType&&Z(t)&&t.timeUnit===void 0&&(d=F1({fieldOrDatumDef:t,field:`datum.value`,format:o.timeFormat,formatType:o.timeFormatType,config:o})));let f={...c?{opacity:c}:{},...d?{text:d}:{},...e};return mQ(f)?void 0:f}function cPe(e,{legendCmpt:t}){return t.get(`selections`)?.length?{...e,fill:{value:`transparent`}}:e}function lPe(e){return uPe(e,(e,t)=>Math.max(e,t.value))}function A2(e){return uPe(e,(e,t)=>kQ(e,t.value))}function uPe(e,t){if(xAe(e))return yh(e.condition).reduce(t,e.value);if($1(e))return e.value}function dPe(e,t,n){let r=t.get(`selections`);if(!r?.length)return;let i=W(n.field);return r.map(e=>`(!length(data(${W(_Q(e)+W6)})) || (${e}[${i}] && indexof(${e}[${i}], datum.value) >= 0))`).join(` || `)}function fPe(e,t){let n=e.values;if(H(n))return RAe(t,n);if(h$(n))return n}function pPe(e,t,n,r){if(t!==`shape`){let e=A2(n)??r;if(e)return e}switch(e){case`bar`:case`rect`:case`image`:case`square`:return`square`;case`line`:case`trail`:case`rule`:return`stroke`;case`arc`:case`point`:case`circle`:case`tick`:case`geoshape`:case`area`:case`text`:return`circle`}}function mPe(e){let{legend:t}=e;return kQ(t.type,hPe(e))}function hPe({channel:e,timeUnit:t,scaleType:n}){if(BQ(e)){if(aQ([`quarter`,`month`,`day`],t))return`symbol`;if(b1(n))return`gradient`}return`symbol`}function gPe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?`gradientDirection`:`symbolDirection`]??_Pe(n,t)}function _Pe(e,t){switch(e){case`top`:case`bottom`:return`horizontal`;case`left`:case`right`:case`none`:case void 0:return;default:return t===`gradient`?`horizontal`:void 0}}function vPe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){let{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:o,gradientVerticalMaxLength:s,gradientVerticalMinLength:c}=e;if(b1(i))return n===`horizontal`?r===`top`||r===`bottom`?yPe(t,`width`,o,a):o:yPe(t,`height`,c,s)}function yPe(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function bPe(e){if(aQ([`quantile`,`threshold`,`log`,`symlog`],e))return`greedy`}function xPe(e){let t=W2(e)?SPe(e):EPe(e);return e.component.legends=t,t}function SPe(e){let{encoding:t}=e,n={};for(let r of[T4,...r6]){let i=c0(t[r]);!i||!e.getScaleComponent(r)||r===O4&&Z(i)&&i.type===y3||(n[r]=TPe(e,r))}return n}function CPe(e,t){let n=e.scaleName(t);if(e.mark===`trail`){if(t===`color`)return{stroke:n};if(t===`size`)return{strokeWidth:n}}return t===`color`?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function wPe(e,t,n,r){switch(t){case`disable`:return n!==void 0;case`values`:return!!n?.values;case`title`:if(t===`title`&&e===r?.title)return!0}return e===(n||{})[t]}function TPe(e,t){let n=e.legend(t),{markDef:r,encoding:i,config:a}=e,o=a.legend,s=new bze({},CPe(e,t));hNe(e,t,s);let c=n===void 0?o.disable:!n;if(s.set(`disable`,c,n!==void 0),c)return s;n||={};let l=e.getScaleComponent(t).get(`type`),u=c0(i[t]),d=Z(u)?s1(u.timeUnit)?.unit:void 0,f=n.orient||a.legend.orient||`right`,p=mPe({legend:n,channel:t,timeUnit:d,scaleType:l}),m=gPe({legend:n,legendType:p,orient:f,legendConfig:o}),h={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:u,legendConfig:o,config:a,scaleType:l,orient:f,legendType:p,direction:m};for(let r of $6){if(p===`gradient`&&r.startsWith(`symbol`)||p===`symbol`&&r.startsWith(`gradient`))continue;let i=r in t8?t8[r](h):n[r];if(i!==void 0){let o=wPe(i,r,n,e.fieldDef(t));(o||a.legend[r]===void 0)&&s.set(r,i,o)}}let g=n?.encoding??{},_=s.get(`selections`),v={},y={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:p};for(let t of[`labels`,`legend`,`title`,`symbols`,`gradient`,`entries`]){let n=rPe(g[t]??{},e),r=t in e8?e8[t](n,y):n;r!==void 0&&!mQ(r)&&(v[t]={..._?.length&&Z(u)?{name:`${_Q(u.field)}_legend_${t}`}:{},..._?.length?{interactive:!0}:{},update:_?.length?{...r,cursor:{value:`pointer`}}:r})}return mQ(v)||s.set(`encode`,v,!!n?.encoding),s}function EPe(e){let{legends:t,resolve:n}=e.component;for(let r of e.children){xPe(r);for(let i of $(r.component.legends))n.legend[i]=k2(e.component.resolve,i),n.legend[i]===`shared`&&(t[i]=DPe(t[i],r.component.legends[i]),t[i]||(n.legend[i]=`independent`,delete t[i]))}for(let r of $(t))for(let t of e.children)t.component.legends[r]&&n.legend[r]===`shared`&&delete t.component.legends[r];return t}function DPe(e,t){if(!e)return t.clone();let n=e.getWithExplicit(`orient`),r=t.getWithExplicit(`orient`);if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(let n of $6){let r=G0(e.getWithExplicit(n),t.getWithExplicit(n),n,`legend`,(e,t)=>{switch(n){case`symbolType`:return OPe(e,t);case`title`:return N$(e,t);case`type`:return i=!0,U0(`symbol`)}return W0(e,t,n,`legend`)});e.setWithExplicit(n,r)}return i&&(e.implicit?.encode?.gradient&&yQ(e.implicit,[`encode`,`gradient`]),e.explicit?.encode?.gradient&&yQ(e.explicit,[`encode`,`gradient`])),e}function OPe(e,t){return t.value===`circle`?t:e}function kPe(e,t,n,r){if(m0(t,n)){let i=W2(e)?e.axis(n)??e.legend(n)??{}:{},a=Q(t,{expr:`datum`}),o=Q(t,{expr:`datum`,binSuffix:`end`});return{formulaAs:Q(t,{binSuffix:`range`,forAs:!0}),formula:L1(a,o,i.format,i.formatType,r)}}return{}}function APe(e,t){return`${a$(e)}_${t}`}function jPe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function j2(e,t,n){let r=APe(d0(n,void 0)??{},t);return e.getName(`${r}_bins`)}function MPe(e){return`as`in e}function NPe(e,t,n){let r,i;r=MPe(e)?Yh(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Q(e,{forAs:!0}),Q(e,{binSuffix:`end`,forAs:!0})];let a={...d0(t,void 0)},o=APe(a,e.field),{signal:s,extentSignal:c}=jPe(n,o);if(l$(a.extent)){let e=a.extent;i=wNe(n,e.param,e),delete a.extent}return{key:o,binComponent:{bin:a,field:e.field,as:[r],...s?{signal:s}:{},...c?{extentSignal:c}:{},...i?{span:i}:{}}}}function PPe(e,t,n,r){let i=W2(r)?r.encoding[GQ(t)]:void 0;if(Q1(n)&&W2(r)&&yAe(n,i,r.markDef,r.config)){e.add(Q(n,{})),e.add(Q(n,{suffix:`end`}));let{mark:i,markDef:a,config:o}=r,s=U1({fieldDef:n,markDef:a,config:o});w1(i)&&s!==.5&&YQ(t)&&(e.add(Q(n,{suffix:v6})),e.add(Q(n,{suffix:y6}))),n.bin&&m0(n,t)&&e.add(Q(n,{binSuffix:`range`}))}else if(zQ(t)){let n=RQ(t);e.add(r.getName(n))}else e.add(Q(n));return e0(n)&&Gke(n.scale?.range)&&e.add(n.scale.range.field),e}function FPe(e,t){for(let n of $(t)){let r=t[n];for(let t of $(r))n in e?e[n][t]=new Set([...e[n][t]??[],...r[t]]):e[n]={[t]:r[t]}}}function IPe(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function LPe(e,t){let n=xQ(e);return t===`number`?`toNumber(${n})`:t===`boolean`?`toBoolean(${n})`:t===`string`?`toString(${n})`:t===`date`?`toDate(${n})`:t===`flatten`?n:t.startsWith(`date:`)?`timeParse(${n},'${IPe(t.slice(5,t.length))}')`:t.startsWith(`utc:`)?`utcParse(${n},'${IPe(t.slice(4,t.length))}')`:(X(OOe(t)),null)}function RPe(e){let t={};return QZ(e.filter,e=>{if(Nke(e)){let n=null;c1(e)?n=b$(e.equal):u1(e)?n=b$(e.lte):l1(e)?n=b$(e.lt):d1(e)?n=b$(e.gt):f1(e)?n=b$(e.gte):p1(e)?n=e.range[0]:m1(e)&&(n=(e.oneOf??e.in)[0]),n&&(t1(n)?t[e.field]=`date`:Kh(n)?t[e.field]=`number`:Yh(n)&&(t[e.field]=`string`)),e.timeUnit&&(t[e.field]=`date`)}}),t}function zPe(e){let t={};function n(e){f0(e)?t[e.field]=`date`:e.type===`quantitative`&&gOe(e.aggregate)?t[e.field]=`number`:OQ(e.field)>1?e.field in t||(t[e.field]=`flatten`):e0(e)&&R1(e.sort)&&OQ(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]=`flatten`))}if((W2(e)||G2(e))&&e.forEachFieldDef((t,r)=>{if(Q1(t))n(t);else{let i=UQ(r),a=e.fieldDef(i);n({...t,type:a.type})}}),W2(e)){let{mark:n,markDef:r,encoding:i}=e;if(C1(n)&&!e.encoding.order){let e=i[r.orient===`horizontal`?`y`:`x`];Z(e)&&e.type===`quantitative`&&!(e.field in t)&&(t[e.field]=`number`)}}return t}function BPe(e){let t={};if(W2(e)&&e.component.selection)for(let n of $(e.component.selection)){let r=e.component.selection[n];for(let e of r.project.items)!e.channel&&OQ(e.field)>1&&(t[e.field]=`flatten`)}return t}function M2(e){return e instanceof l8||e instanceof s8||e instanceof c8}function N2(e){return`isValid(${e}) && isFinite(+${e})`}function VPe(e){return e.stack.stackBy.reduce((e,t)=>{let n=t.fieldDef,r=Q(n);return r&&e.push(r),e},[])}function HPe(e){return H(e)&&e.every(e=>Yh(e))&&e.length>1}function UPe(e){function t(n){if(!(n instanceof i8)){let r=n.clone();if(r instanceof g6){let t=_8+r.getSource();r.setSource(t),e.model.component.data.outputNodes[t]=r}else(r instanceof r8||r instanceof h8||r instanceof g8||r instanceof p8)&&r.addDimensions(e.fields);for(let e of n.children.flatMap(t))e.parent=r;return[r]}return n.children.flatMap(t)}return t}function P2(e){if(e instanceof i8)if(e.numChildren()===1&&!(e.children[0]instanceof g6)){let t=e.children[0];(t instanceof r8||t instanceof h8||t instanceof g8||t instanceof p8)&&t.addDimensions(e.fields),t.swapWithParent(),P2(e)}else{let t=e.model.component.data.main;WPe(t);let n=UPe(e),r=e.children.map(n).flat();for(let e of r)e.parent=t}else e.children.map(P2)}function WPe(e){if(e instanceof g6&&e.type===m6.Main&&e.numChildren()===1){let t=e.children[0];t instanceof i8||(t.swapWithParent(),WPe(e))}}function F2(e){for(let t of e){for(let e of t.children)if(e.parent!==t)return!1;if(!F2(t.children))return!1}return!0}function I2(e,t){let n=!1;for(let r of t)n=e.optimize(r)||n;return n}function GPe(e,t,n){let r=e.sources,i=!1;return i=I2(new wze,r)||i,i=I2(new Sze(t),r)||i,r=r.filter(e=>e.numChildren()>0),i=I2(new Dze,r)||i,r=r.filter(e=>e.numChildren()>0),n||(i=I2(new Tze,r)||i,i=I2(new Aze(t),r)||i,i=I2(new Cze,r)||i,i=I2(new Eze,r)||i,i=I2(new kze,r)||i,i=I2(new Oze,r)||i,i=I2(new xze,r)||i,i=I2(new jze,r)||i),e.sources=r,i}function KPe(e,t){F2(e.sources);let n=0,r=0;for(let r=0;r({signal:`{data: ${p0(e,{timeUnit:n,type:t})}}`}))}function L2(e,t,n){let r=s1(n)?.unit;return t===`temporal`||r?QPe(e,t,r):[e]}function R2(e,t,n,r){let{encoding:i,markDef:a,mark:o,config:s,stack:c}=n,l=c0(i[r]),{type:u}=l,d=l.timeUnit,f=MMe({invalid:D$(`invalid`,a,s),isPath:C1(o)});if(Wke(t)){let i=R2(e,void 0,n,r);return H0([...L2(t.unionWith,u,d),...i.value])}else if(h$(t))return H0([t]);else if(t&&t!==`unaggregated`&&!Uke(t))return H0(L2(t,u,d));if(c&&r===c.fieldChannel){if(c.offset===`normalize`)return U0([[0,1]]);let e=n.requestDataName(f);return U0([{data:e,field:n.vgField(r,{suffix:`start`})},{data:e,field:n.vgField(r,{suffix:`end`})}])}let p=$Q(r)&&Z(l)?eFe(n,r,e):void 0;if(J1(l))return U0(L2([l.datum],u,d));let m=l;if(t===`unaggregated`){let{field:e}=l;return U0([{data:n.requestDataName(f),field:Q({field:e,aggregate:`min`})},{data:n.requestDataName(f),field:Q({field:e,aggregate:`max`})}])}else if(o$(m.bin)){if(v1(e))return U0(e===`bin-ordinal`?[]:[{data:hQ(p)?n.requestDataName(f):n.requestDataName(m6.Raw),field:n.vgField(r,m0(m,r)?{binSuffix:`range`}:{}),sort:p===!0||!Wm(p)?{field:n.vgField(r,{}),op:`min`}:p}]);{let{bin:e}=m;if(o$(e)){let t=j2(n,m.field,e);return U0([new y8(()=>{let e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}else return U0([{data:n.requestDataName(f),field:n.vgField(r,{})}])}}else if(m.timeUnit&&aQ([`time`,`utc`],e)){let e=i[GQ(r)];if(yAe(m,e,a,s)){let t=n.requestDataName(f),i=U1({fieldDef:m,fieldDef2:e,markDef:a,config:s}),c=w1(o)&&i!==.5&&YQ(r);return U0([{data:t,field:n.vgField(r,c?{suffix:v6}:{})},{data:t,field:n.vgField(r,{suffix:c?y6:`end`})}])}}return U0(p?[{data:hQ(p)?n.requestDataName(f):n.requestDataName(m6.Raw),field:n.vgField(r),sort:p}]:[{data:n.requestDataName(f),field:n.vgField(r)}])}function z2(e,t){let{op:n,field:r,order:i}=e;return{op:n??(t?`sum`:V3),...r?{field:TQ(r)}:{},...i?{order:i}:{}}}function $Pe(e,t){let n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t)?.bin,a=Uke(r)?r:void 0,o=c$(i)&&l$(i.extent)?i.extent:void 0;(a||o)&&n.set(`selectionExtent`,a??o,!0)}function eFe(e,t,n){if(!v1(n))return;let r=e.fieldDef(t),i=r.sort;if(mAe(i))return{op:`min`,field:S2(r,t),order:`ascending`};let{stack:a}=e,o=a?new Set([...a.groupbyFields,...a.stackBy.map(e=>e.fieldDef.field)]):void 0;if(R1(i))return z2(i,a&&!o.has(i.field));if(pAe(i)){let{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:s,field:c}=r,l=a&&!o.has(c);if(t$(s)||n$(s))return z2({field:Q(r),order:n},l);if(r$(s)||!s)return z2({op:s,field:c,order:n},l)}else if(i===`descending`)return{op:`min`,field:e.vgField(t),order:`descending`};else if(aQ([`ascending`,void 0],i))return!0}function tFe(e,t){let{aggregate:n,type:r}=e;return n?Yh(n)&&!NLe.has(n)?{valid:!1,reason:KOe(n)}:r===`quantitative`&&t===`log`?{valid:!1,reason:qOe(e)}:{valid:!0}:{valid:!1,reason:GOe(e)}}function B2(e,t,n,r){return e.explicit&&t.explicit&&X(QOe(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function nFe(e){let t=lQ(e.map(e=>{if(v$(e)){let{sort:t,...n}=e;return n}return e}),rQ),n=lQ(e.map(e=>{if(v$(e)){let t=e.sort;return t!==void 0&&!hQ(t)&&(`op`in t&&t.op===`count`&&delete t.field,t.order===`ascending`&&delete t.order),t}}).filter(e=>e!==void 0),rQ);if(t.length===0)return;if(t.length===1){let t=e[0];if(v$(t)&&n.length>0){let e=n[0];if(n.length>1){X(s3);let t=n.filter(e=>Wm(e)&&`op`in e&&e.op!==`min`);e=n.every(e=>Wm(e)&&`op`in e)&&t.length===1?t[0]:!0}else if(Wm(e)&&`field`in e){let n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}let r=lQ(n.map(e=>hQ(e)||!(`op`in e)||Yh(e.op)&&Ih(ALe,e.op)?e:(X(eke(e)),!0)),rQ),i;r.length===1?i=r[0]:r.length>1&&(X(s3),i=!0);let a=lQ(e.map(e=>v$(e)?e.data:null),e=>e);return a.length===1&&a[0]!==null?{data:a[0],fields:t.map(e=>e.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function V2(e){if(v$(e)&&Yh(e.field))return e.field;if(_$(e)){let t;for(let n of e.fields)if(v$(n)&&Yh(n.field)){if(!t)t=n.field;else if(t!==n.field)return X(YLe),t}return X(XLe),t}else if(_Oe(e)){X(ZLe);let t=e.fields[0];return Yh(t)?t:void 0}}function H2(e,t){return nFe(e.component.scales[t].get(`domains`).map(t=>(v$(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function rFe(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function iFe(e,t){if(W2(e)){let n=e.fieldDef(t);if(n?.field)return n.field}let n=(e.children??[]).map(e=>iFe(e,t)).filter(e=>!!e);if(n.length>0){let e=lQ(n,rQ);return e.length===1?e[0]:void 0}}function aFe(e,t,n){if(t===n)return!0;let r=e.getScaleType(t),i=e.getScaleType(n);return!r||!i?!1:v1(r)===v1(i)}function oFe(e,t){return e?`field:${e}`:`channel:${String(t)}`}function sFe(e){if(H(e)){let t=e.filter(gQ);return t.length>0?t:null}if(_$(e)){let t=[];if(t.push(...e.fields.flatMap(e=>H(e)?e.filter(gQ):[])),t.length>0)return lQ(t,rQ)}return null}function U2(e,t){try{return sFe(H2(e,t))}catch{return null}}function cFe(e,t,n){let r=U2(e,t),i=U2(e,n);return r&&i?lQ([...r,...i],rQ):null}function lFe(e,t,n){t&&t.length>0&&(e.getWithExplicit(`values`)?.explicit||(n&&X(n),e.set(`values`,t,!1)))}function uFe(e,t,n){let r=e.getScaleComponent(t),i=e.getScaleComponent(n);if(!r||!i)return!1;let a=r.getWithExplicit(`domains`),o=i.getWithExplicit(`domains`);if(!(a?.explicit&&o?.explicit))return!1;let s=H2(e,t),c=H2(e,n);return rQ(s)===rQ(c)}function dFe(e){let t=e.component.legends,n={};for(let r of $(t)){let i=oFe(iFe(e,r),r);if(!n[i]){n[i]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(let o of n[i])if(aFe(e,o.channel,r)&&DPe(o.cmpt,t[r])){let t=e.getScaleType(o.channel),n=e.getScaleType(r);t&&n&&v1(t)&&v1(n)&&(uFe(e,o.channel,r)?lFe(o.cmpt,U2(e,o.channel)):lFe(o.cmpt,cFe(e,o.channel,r),tke(o.channel,r))),a=!0;break}a||n[i].push({channel:r,cmpt:t[r].clone()})}return r4(n).flat().map(t=>fFe(t.cmpt,e.config)).filter(e=>e!==void 0)}function fFe(e,t){let{disable:n,labelExpr:r,selections:i,...a}=e.combine();if(!n){if(t.aria===!1&&a.aria==null&&(a.aria=!1),a.encode?.symbols){let e=a.encode.symbols.update;e.fill&&e.fill.value!==`transparent`&&!e.stroke&&!a.stroke&&(e.stroke={value:`transparent`});for(let t of r6)a[t]&&delete e[t]}if(a.title||delete a.title,r!==void 0){let e=r;a.encode?.labels?.update&&h$(a.encode.labels.update.text)&&(e=EQ(r,`datum.label`,a.encode.labels.update.text.signal)),rFe(a,`labels`,`text`,{signal:e})}return a}}function pFe(e){return q2(e)||K2(e)?mFe(e):hFe(e)}function mFe(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),hFe(e))}function hFe(e){let t=e.component.projection;if(!t||t.merged)return[];let n=t.combine(),{name:r}=n;if(t.data){let i={signal:`[${t.size.map(e=>e.signal).join(`, `)}]`},a=t.data.reduce((t,n)=>{let r=h$(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return aQ(t,r)||t.push(r),t},[]);if(a.length<=0)throw Error(`Projection's fit didn't find any data sources`);return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(`, `)}]`:a[0]},...n}]}else return[{name:r,translate:{signal:`[width / 2, height / 2]`},...n}]}function gFe(e){e.component.projection=W2(e)?_Fe(e):bFe(e)}function _Fe(e){if(e.hasProjection){let t=f$(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]:void 0,i=n?vFe(e):void 0,a=new b8(e.projectionName(!0),{...f$(e.config.projection),...t},r,i);return a.get(`type`)||a.set(`type`,`equalEarth`,!1),a}}function vFe(e){let t=[],{encoding:n}=e;for(let r of[[x4,b4],[C4,S4]])(c0(n[r[0]])||c0(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(O4)&&e.typedFieldDef(O4).type===y3&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(m6.Main)),t}function yFe(e,t){let n=sQ(Mze,n=>!!(!Ih(e.explicit,n)&&!Ih(t.explicit,n)||Ih(e.explicit,n)&&Ih(t.explicit,n)&&FQ(e.get(n),t.get(n))));if(FQ(e.size,t.size)){if(n)return e;if(FQ(e.explicit,{}))return t;if(FQ(t.explicit,{}))return e}return null}function bFe(e){if(e.children.length===0)return;let t;for(let t of e.children)gFe(t);let n=sQ(e.children,e=>{let n=e.component.projection;if(!n)return!0;if(t){let e=yFe(t,n);return e&&(t=e),!!e}else return t=n,!0});if(t&&n){let n=e.projectionName(!0),r=new b8(n,t.specifiedProjection,t.size,n4(t.data));for(let t of e.children){let e=t.component.projection;e&&(e.isFit&&r.data.push(...t.component.projection.data),t.renameProjection(e.get(`name`),n),e.merged=!0)}return r}}function xFe(e){return q2(e)||K2(e)?e.children.reduce((e,t)=>e.concat(xFe(t)),SFe(e)):SFe(e)}function SFe(e){return $(e.component.scales).reduce((t,n)=>{let r=e.component.scales[n];if(r.merged)return t;let i=r.combine(),{name:a,type:o,selectionExtent:s,domains:c,range:l,reverse:u,...d}=i,f=CFe(i.range,a,n,e),p=H2(e,n),m=s?WMe(e,s,r,p):null;return t.push({name:a,type:o,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:f,...u===void 0?{}:{reverse:u},...d}),t},[])}function CFe(e,t,n,r){if(YQ(n)){if(g$(e))return{step:{signal:`${t}_step`}}}else if(Wm(e)&&v$(e))return{...e,data:r.lookupDataSource(e.data)};return e}function wFe(e){let t=e.component.scales;for(let n of r3){let r=t[n];if(!r)continue;let i=EFe(n,e);r.setWithExplicit(`range`,i)}}function TFe(e,t){let n=e.fieldDef(t);if(n?.bin){let{bin:r,field:i}=n,a=KQ(t),o=e.getName(a);if(Wm(r)&&r.binned&&r.step!==void 0)return new y8(()=>{let n=e.scaleName(t),i=`(domain("${n}")[1] - domain("${n}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${i})`});if(o$(r)){let t=j2(e,i,r);return new y8(()=>{let n=e.getSignalName(t),r=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(o)} / (${r})`})}}}function EFe(e,t){let n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get(`type`);for(let r of Nze)if(n[r]!==void 0){let a=S1(i,r),o=Kke(e,r);if(!a)X(Y$(i,r,e));else if(o)X(o);else switch(r){case`range`:{let r=n.range;if(H(r)){if(YQ(e))return H0(r.map(e=>{if(e===`width`||e===`height`){let n=t.getName(e),r=t.getSignalName.bind(t);return y8.fromName(r,n)}return e}))}else if(Wm(r))return H0({data:t.requestDataName(m6.Main),field:r.field,sort:{op:`min`,field:t.vgField(e)}});return H0(r)}case`scheme`:return H0(DFe(n[r]))}}let a=e===u4||e===`xOffset`?`width`:`height`,o=r[a];if(j0(o)){if(YQ(e))if(v1(i)){let n=AFe(o,t,e);if(n)return H0({step:n})}else X(X$(a));else if(ZQ(e)){let n=e===m4?`x`:`y`;if(t.getScaleComponent(n).get(`type`)===`band`){let e=jFe(o,i);if(e)return H0(e)}}}let{rangeMin:s,rangeMax:c}=n,l=kFe(e,t);return(s!==void 0||c!==void 0)&&S1(i,`rangeMin`)&&H(l)&&l.length===2?H0([s??l[0],c??l[1]]):U0(l)}function DFe(e){return Hke(e)?{scheme:e.name,...nQ(e,[`name`])}:{scheme:e}}function OFe(e,t,n,{center:r}={}){let i=KQ(e),a=t.getName(i),o=t.getSignalName.bind(t);return e===d4&&y1(n)?r?[y8.fromName(e=>`${o(e)}/2`,a),y8.fromName(e=>`-${o(e)}/2`,a)]:[y8.fromName(o,a),0]:r?[y8.fromName(e=>`-${o(e)}/2`,a),y8.fromName(e=>`${o(e)}/2`,a)]:[0,y8.fromName(o,a)]}function kFe(e,t){let{size:n,config:r,mark:i,encoding:a}=t,{type:o}=c0(a[e]),s=t.getScaleComponent(e).get(`type`),{domain:c,domainMid:l}=t.specifiedScales[e];switch(e){case u4:case d4:if(aQ([`point`,`band`],s)){let i=NFe(e,n,r.view);if(j0(i))return{step:AFe(i,t,e)}}return OFe(e,t,s);case m4:case h4:return MFe(e,t,s);case k4:{let a=IFe(i,r),o=LFe(i,n,t,r);return x1(s)?FFe(a,o,PFe(s,r,c,e)):[a,o]}case v4:return[0,Math.PI*2];case A4:return[0,360];case g4:return[0,new y8(()=>`min(${t.getSignalName(G2(t.parent)?`child_width`:`width`)},${t.getSignalName(G2(t.parent)?`child_height`:`height`)})/2`)];case w4:return{step:1e3/r.scale.framesPerSecond};case P4:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case F4:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case O4:return`symbol`;case T4:case E4:case D4:return s===`ordinal`?o===`nominal`?`category`:`ordinal`:l===void 0?i===`rect`||i===`geoshape`?`heatmap`:`ramp`:`diverging`;case j4:case M4:case N4:return[r.scale.minOpacity,r.scale.maxOpacity]}}function AFe(e,t,n){let{encoding:r}=t,i=t.getScaleComponent(n),a=JQ(n),o=r[a];if(hje({step:e,offsetIsDiscrete:Z1(o)&&_1(o.type)})===`offset`&&BAe(r,a)){let n=t.getScaleComponent(a),r=`domain('${t.scaleName(a)}').length`;if(n.get(`type`)===`band`){let e=n.get(`paddingInner`)??n.get(`padding`)??0,t=n.get(`paddingOuter`)??n.get(`padding`)??0;r=`bandspace(${r}, ${e}, ${t})`}let o=i.get(`paddingInner`)??i.get(`padding`);return{signal:`${e.step} * ${r} / (1-${vOe(o)})`}}else return e.step}function jFe(e,t){if(hje({step:e,offsetIsDiscrete:v1(t)})===`offset`)return{step:e.step}}function MFe(e,t,n){let r=e===m4?`x`:`y`,i=t.getScaleComponent(r);if(!i)return OFe(r,t,n,{center:!0});let a=i.get(`type`),o=t.scaleName(r),{markDef:s,config:c}=t;if(a===`band`){let e=NFe(r,t.size,t.config.view);if(j0(e)){let t=jFe(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}else{let n=t.encoding[r];if(Z(n)&&n.timeUnit){let e=Oke(n.timeUnit,e=>`scale('${o}', ${e})`),r=t.config.scale.bandWithNestedOffsetPaddingInner,i=U1({fieldDef:n,markDef:s,config:c})-.5,a=i===0?``:` + ${i}`;if(r){let t=h$(r)?`${r.signal}/2${a}`:`${r/2+i}`,n=h$(r)?`(1 - ${r.signal}/2)${a}`:`${1-r/2+i}`;return[{signal:`${t} * (${e})`},{signal:`${n} * (${e})`}]}return[0,{signal:e}]}return eQ(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function NFe(e,t,n){let r=e===u4?`width`:`height`,i=t[r];return i===void 0?P0(n,r):i}function PFe(e,t,n,r){switch(e){case`quantile`:return t.scale.quantileCount;case`quantize`:return t.scale.quantizeCount;case`threshold`:return n!==void 0&&H(n)?n.length+1:(X(uke(r)),3)}}function FFe(e,t,n){let r=()=>{let r=w$(t),i=w$(e),a=`(${r} - ${i}) / (${n} - 1)`;return`sequence(${i}, ${r} + ${a}, ${a})`};return h$(t)?new y8(r):{signal:r()}}function IFe(e,t){switch(e){case`bar`:case`tick`:return t.scale.minBandSize;case`line`:case`trail`:case`rule`:return t.scale.minStrokeWidth;case`text`:return t.scale.minFontSize;case`point`:case`square`:case`circle`:return t.scale.minSize}throw Error(q$(`size`,e))}function LFe(e,t,n,r){let i={x:TFe(n,`x`),y:TFe(n,`y`)};switch(e){case`bar`:case`tick`:{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;let e=RFe(t,i,r.view);return Kh(e)?e-1:new y8(()=>`${e.signal} - 1`)}case`line`:case`trail`:case`rule`:return r.scale.maxStrokeWidth;case`text`:return r.scale.maxFontSize;case`point`:case`square`:case`circle`:{if(r.scale.maxSize)return r.scale.maxSize;let e=RFe(t,i,r.view);return Kh(e)?(S8*e)**2:new y8(()=>`pow(${S8} * ${e.signal}, 2)`)}}throw Error(q$(`size`,e))}function RFe(e,t,n){let r=j0(e.width)?e.width.step:N0(n,`width`),i=j0(e.height)?e.height.step:N0(n,`height`);return t.x||t.y?new y8(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(`, `)})`):Math.min(r,i)}function zFe(e,t){W2(e)?BFe(e,t):HFe(e,t)}function BFe(e,t){let n=e.component.scales,{config:r,encoding:i,markDef:a,specifiedScales:o}=e;for(let s of $(n)){let c=o[s],l=n[s],u=e.getScaleComponent(s),d=c0(i[s]),f=c[t],p=u.get(`type`),m=u.get(`padding`),h=u.get(`paddingInner`),g=S1(p,t),_=Kke(s,t);if(f!==void 0&&(g?_&&X(_):X(Y$(p,t,s))),g&&_===void 0)if(f!==void 0){let e=d.timeUnit,n=d.type;switch(t){case`domainMax`:case`domainMin`:t1(c[t])||n===`temporal`||e?l.set(t,{signal:p0(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{let n=Y(C8,t)?C8[t]({model:e,channel:s,fieldOrDatumDef:d,scaleType:p,scalePadding:m,scalePaddingInner:h,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:a,config:r,hasNestedOffsetScale:VAe(i,s),hasSecondaryRangeChannel:!!i[GQ(s)]}):r.scale[t];n!==void 0&&l.set(t,n,!1)}}}function VFe(e){W2(e)?wFe(e):HFe(e,`range`)}function HFe(e,t){let n=e.component.scales;for(let n of e.children)t===`range`?VFe(n):zFe(n,t);for(let r of $(n)){let i;for(let n of e.children){let e=n.component.scales[r];if(e){let n=e.getWithExplicit(t);i=G0(i,n,t,`scale`,DMe((e,n)=>{switch(t){case`range`:return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function UFe(e,t){let n=t.bin;if(o$(n)){let r=j2(e,t.field,n);return new y8(()=>e.getSignalName(r))}else if(s$(n)&&c$(n)&&n.step!==void 0)return{step:n.step}}function WFe(e,t){if(aQ([T4,E4,D4],e)&&t!==`nominal`)return`hcl`}function GFe(e,t,n,r,i,a){if(!(s0(a)?.bin||H(n)||i!=null||r!=null||aQ([b3.TIME,b3.UTC],e)))return YQ(t)?!0:void 0}function KFe(e,t,n,r,i,a){if(YQ(e)){if(b1(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;let{type:t,orient:o}=i;if(t===`bar`&&!(Z(r)&&(r.bin||r.timeUnit))&&(o===`vertical`&&e===`x`||o===`horizontal`&&e===`y`))return a.continuousBandSize}if(t===b3.POINT)return n.pointPadding}}function qFe(e,t,n,r,i,a=!1){if(e===void 0){if(YQ(t)){let{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r,tickBandPaddingInner:o,bandWithNestedOffsetPaddingInner:s}=i;return a?s:kQ(e,n===`bar`?t:n===`tick`?o:r)}else if(ZQ(t)&&r===b3.BAND)return i.offsetBandPaddingInner}}function JFe(e,t,n,r,i,a=!1){if(e===void 0){if(YQ(t)){let{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=i;if(a)return t;if(n===b3.BAND)return kQ(e,h$(r)?{signal:`${r.signal}/2`}:r/2)}else if(ZQ(t)){if(n===b3.POINT)return .5;if(n===b3.BAND)return i.offsetBandPaddingOuter}}}function YFe(e,t,n,r){if(n===`x`&&r.xReverse!==void 0)return y1(e)&&t===`descending`?h$(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(y1(e)&&t===`descending`)return!0}function XFe(e,t,n,r,i,a,o){if(n&&n!==`unaggregated`&&y1(i)){if(H(n)){let e=n[0],t=n[n.length-1];if(Kh(e)&&e<=0&&Kh(t)&&t>=0)return!0}return!1}if(e===`size`&&t.type===`quantitative`&&!x1(i))return!0;if(!(Z(t)&&t.bin)&&aQ([...Q4,...gLe],e)){let{orient:t,type:n}=r;return aQ([`bar`,`area`,`line`,`trail`],n)&&(t===`horizontal`&&e===`y`||t===`vertical`&&e===`x`)?!1:aQ([`bar`,`area`],n)&&!o?!0:a?.zero}return!1}function ZFe(e,t,n,r,i=!1){let a=QFe(t,n,r,i),{type:o}=e;return $Q(t)?o===void 0?a:Jke(t,o)?Z(n)&&!qke(o,n.type)?(X(XOe(o,a)),a):o:(X(YOe(t,o,a)),a):null}function QFe(e,t,n,r){switch(t.type){case`nominal`:case`ordinal`:{if(BQ(e)||e$(e)===`discrete`)return e===`shape`&&t.type===`ordinal`&&X(J$(e,`ordinal`)),`ordinal`;if(QQ(e))return`band`;if(YQ(e)||ZQ(e)){if(aQ([`rect`,`bar`,`image`,`rule`,`tick`],n.type)||r)return`band`}else if(n.type===`arc`&&e in $4)return`band`;let i=n[KQ(e)];return E1(i)||t0(t)&&t.axis?.tickBand?`band`:`point`}case`temporal`:return BQ(e)?`time`:e$(e)===`discrete`?(X(J$(e,`temporal`)),`ordinal`):Z(t)&&t.timeUnit&&s1(t.timeUnit).utc?`utc`:QQ(e)?`band`:`time`;case`quantitative`:return BQ(e)?Z(t)&&o$(t.bin)?`bin-ordinal`:`linear`:e$(e)===`discrete`?(X(J$(e,`quantitative`)),`ordinal`):QQ(e)?`band`:`linear`;case`geojson`:return}throw Error(W$(t.type))}function $Fe(e,{ignoreRange:t}={}){eIe(e),qPe(e);for(let t of pRe)zFe(e,t);t||VFe(e)}function eIe(e){W2(e)?e.component.scales=tIe(e):e.component.scales=nIe(e)}function tIe(e){let{encoding:t,mark:n,markDef:r}=e,i={};for(let a of r3){let o=c0(t[a]);if(o&&n===I3&&a===O4&&o.type===y3)continue;let s=o&&o.scale;if(o&&s!==null&&s!==!1){s??={};let n=VAe(t,a),c=ZFe(s,a,o,r,n);i[a]=new x8(e.scaleName(`${a}`,!0),{value:c,explicit:s.type===c})}}return i}function nIe(e){let t=e.component.scales={},n={},r=e.component.resolve;for(let t of e.children){eIe(t);for(let i of $(t.component.scales))if(r.scale[i]??=iPe(i,e),r.scale[i]===`shared`){let e=n[i],a=t.component.scales[i].getWithExplicit(`type`);e?zke(e.value,a.value)?n[i]=G0(e,a,`type`,`scale`,Pze):(r.scale[i]=`independent`,delete n[i]):n[i]=a}}for(let r of $(n)){let i=e.scaleName(r,!0),a=n[r];t[r]=new x8(i,a);for(let t of e.children){let e=t.component.scales[r];e&&(t.renameScale(e.get(`name`),i),e.merged=!0)}}return t}function W2(e){return e?.type===`unit`}function G2(e){return e?.type===`facet`}function K2(e){return e?.type===`concat`}function q2(e){return e?.type===`layer`}function rIe(e){let t=0;function n(r,i){if(r instanceof l8&&!r.isGenerator&&!K0(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof a8&&(r.parent instanceof l8&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof i8){i.name||=`data_${t++}`,!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof s8||r instanceof c8||r instanceof m8||r instanceof J6||r instanceof X6||r instanceof M8||r instanceof r8||r instanceof F8||r instanceof g8||r instanceof p8||r instanceof A8||r instanceof k8||r instanceof D8||r instanceof P8||r instanceof I8||r instanceof L8||r instanceof o8||r instanceof z8||r instanceof R8||r instanceof O8)&&i.transform.push(r.assemble()),(r instanceof n8||r instanceof _6||r instanceof N8||r instanceof h8||r instanceof j8)&&i.transform.push(...r.assemble()),r instanceof g6&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof g6?r.setSource(i.name):(i.name||=`data_${t++}`,r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof g6&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||=`data_${t++}`;let a=i.name;!i.source||i.transform.length>0?e.push(i):a=i.source;for(let e of r.children)n(e,{name:null,source:a,transform:[]});break}}}return n}function iIe(e){let t=[],n=rIe(t);for(let t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}function aIe(e,t){let n=[],r=rIe(n),i=0;for(let t of e.sources)t.hasName()||(t.dataName=`source_${i++}`),r(t,t.assemble());for(let e of n)e.transform.length===0&&delete e.transform;let a=0;for(let[e,t]of n.entries())(t.transform??[]).length===0&&!t.source&&n.splice(a++,0,n.splice(e,1)[0]);for(let t of n)for(let n of t.transform??[])n.type===`lookup`&&(n.from=e.outputNodes[n.from].getSource());for(let e of n)e.name in t&&(e.values=t[e.name]);return n}function oIe(e){return e===`top`||e===`left`||h$(e)?`header`:`footer`}function sIe(e){for(let t of J4)cIe(e,t);uIe(e,`x`),uIe(e,`y`)}function cIe(e,t){let{facet:n,config:r,child:i,component:a}=e;if(e.channelHasField(t)){let o=n[t],s=w2(`title`,null,r,t),c=r0(o,r,{allowDisabling:!0,includeDefault:s===void 0||!!s});i.component.layoutHeaders[t].title&&(c=H(c)?c.join(`, `):c,c+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);let l=w2(`labelOrient`,o.header,r,t),u=o.header!==null&&kQ(o.header?.labels,r.header.labels,!0),d=aQ([`bottom`,`right`],l)?`footer`:`header`;a.layoutHeaders[t]={title:o.header===null?null:c,facetFieldDef:o,[d]:t===`facet`?[]:[lIe(e,t,u)]}}}function lIe(e,t,n){let r=t===`row`?`height`:`width`;return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function uIe(e,t){let{child:n}=e;if(n.component.axes[t]){let{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=k2(i,t),i.axis[t]===`shared`){let i=t===`x`?`column`:`row`,a=r[i];for(let r of n.component.axes[t]){let t=oIe(r.get(`orient`));a[t]??=[lIe(e,i,!1)];let n=y2(r,`main`,e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}}function dIe(e){J2(e),Y2(e,`width`),Y2(e,`height`)}function fIe(e){J2(e);let t=e.layout.columns===1?`width`:`childWidth`,n=e.layout.columns===void 0?`height`:`childHeight`;Y2(e,t),Y2(e,n)}function J2(e){for(let t of e.children)t.parseLayoutSize()}function Y2(e,t){let n=nPe(t),r=XQ(n),i=e.component.resolve,a=e.component.layoutSize,o;for(let t of e.children){let a=t.component.layoutSize.getWithExplicit(n),s=i.scale[r]??iPe(r,e);if(s===`independent`&&a.value===`step`){o=void 0;break}if(o){if(s===`independent`&&o.value!==a.value){o=void 0;break}o=G0(o,a,n,``)}else o=a}if(o){for(let r of e.children)e.renameSignal(r.getName(n),e.getName(t)),r.component.layoutSize.set(n,`merged`,!1);a.setWithExplicit(t,o)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function pIe(e){let{size:t,component:n}=e;for(let r of Q4){let i=KQ(r);if(t[i]!=null&&t[i]!=null){let e=t[i];n.layoutSize.set(i,j0(e)?`step`:e,!0)}else{let t=mIe(e,i);n.layoutSize.set(i,t,!1)}}}function mIe(e,t){let n=t===`width`?`x`:`y`,r=e.config,i=e.getScaleComponent(n);if(i){let e=i.get(`type`),n=i.get(`range`);if(v1(e)){let e=P0(r.view,t);return g$(n)||j0(e)?`step`:e}else return M0(r.view,t)}else if(e.hasProjection||e.mark===`arc`)return M0(r.view,t);else{let e=P0(r.view,t);return j0(e)?e.step:e}}function X2(e,t,n){return Q(t,{suffix:`by_${Q(e)}`,...n})}function hIe(e,t){let{row:n,column:r}=t;if(n&&r){let t=null;for(let i of[n,r])if(R1(i.sort)){let{field:n,op:r=V3}=i.sort;e=t=new p8(e,{joinaggregate:[{op:r,field:n,as:X2(i,i.sort,{forAs:!0})}],groupby:[Q(i)]})}return t}return null}function gIe(e,t){for(let n of t){let t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;let r=e.format?.mesh,i=t.format?.feature;if(r&&i)continue;let a=e.format?.feature;if((a||i)&&a!==i)continue;let o=t.format?.mesh;if(!((r||o)&&r!==o)){if(q0(e)&&q0(t)){if(FQ(e.values,t.values))return n}else if(K0(e)&&K0(t)){if(e.url===t.url)return n}else if(OMe(e)&&e.name===n.dataName)return n}}return null}function _Ie(e,t){if(e.data||!e.parent){if(e.data===null){let e=new l8({values:[]});return t.push(e),e}let n=gIe(e.data,t);if(n)return J0(e.data)||(n.data.format=cQ({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{let n=new l8(e.data);return t.push(n),n}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function vIe(e,t,n){let r=0;for(let i of t.transforms){let a,o;if(sMe(i))o=e=new X6(e,i),a=`derived`;else if(B0(i)){let r=RPe(i);o=e=a8.makeWithAncestors(e,{},r,n)??e,e=new J6(e,t,i.filter)}else if(cMe(i))o=e=n8.makeFromTransform(e,i,t),a=`number`;else if(uMe(i))a=`date`,n.getWithExplicit(i.field).value===void 0&&(e=new a8(e,{[i.field]:a}),n.set(i.field,a,!1)),o=e=_6.makeFromTransform(e,i);else if(dMe(i))o=e=r8.makeFromTransform(e,i),a=`number`,m2(t)&&(e=new o8(e));else if(Yje(i))o=e=F8.make(e,t,i,r++),a=`derived`;else if(iMe(i))o=e=new g8(e,i),a=`number`;else if(aMe(i))o=e=new p8(e,i),a=`number`;else if(fMe(i))o=e=h8.makeFromTransform(e,i),a=`derived`;else if(pMe(i))o=e=new A8(e,i),a=`derived`;else if(mMe(i))o=e=new O8(e,i),a=`derived`;else if(oMe(i))o=e=new k8(e,i),a=`derived`;else if(Qje(i))o=e=new R8(e,i),a=`derived`;else if(rMe(i))e=new z8(e,i);else if(lMe(i))o=e=N8.makeFromTransform(e,i),a=`derived`;else if($je(i))o=e=new D8(e,i),a=`derived`;else if(eMe(i))o=e=new I8(e,i),a=`derived`;else if(tMe(i))o=e=new L8(e,i),a=`derived`;else if(nMe(i))o=e=new P8(e,i),a=`derived`;else{X(kOe(i));continue}if(o&&a!==void 0)for(let e of o.producedFields()??[])n.set(e,a,!1)}return e}function Z2(e){let t=_Ie(e,e.component.data.sources),{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,a=!(i&&(J0(i)||K0(i)||q0(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new ize;J0(i)?(kMe(i)?t=new c8(t,i.sequence):Y0(i)&&(t=new s8(t,i.graticule)),a.parseNothing=!0):i?.format?.parse===null&&(a.parseNothing=!0),t=a8.makeExplicit(t,e,a)??t,t=new o8(t);let o=e.parent&&q2(e.parent);(W2(e)||G2(e))&&o&&(t=n8.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=vIe(t,e,a));let s=BPe(e),c=zPe(e);t=a8.makeWithAncestors(t,{},{...s,...c},a)??t,W2(e)&&(t=j8.parseAll(t,e),t=M8.parseAll(t,e)),(W2(e)||G2(e))&&(o||(t=n8.makeFromEncoding(t,e)??t),t=_6.makeFromEncoding(t,e)??t,t=X6.parseAllForSortIndex(t,e));let l=t=Q2(m6.Raw,e,t);if(W2(e)){let n=r8.makeFromEncoding(t,e);n&&(t=n,m2(e)&&(t=new o8(t))),t=N8.makeFromEncoding(t,e)??t,t=h8.makeFromEncoding(t,e)??t}let u,d;if(W2(e)){let{markDef:n,mark:r,config:i}=e,{marks:a,scales:o}=d=jMe({invalid:E$(`invalid`,n,i),isPath:C1(r)});a!==o&&o===`include-invalid-values`&&(u=t=Q2(m6.PreFilterInvalid,e,t)),a===`exclude-invalid-values`&&(t=m8.make(t,e,d)??t)}let f=t=Q2(m6.Main,e,t),p;if(W2(e)&&d){let{marks:n,scales:r}=d;n===`include-invalid-values`&&r===`exclude-invalid-values`&&(t=m8.make(t,e,d)??t,p=t=Q2(m6.PostFilterInvalid,e,t))}W2(e)&&TNe(e,f);let m=null;if(G2(e)){let r=e.getName(`facet`);t=hIe(t,e.facet)??t,m=new i8(t,e,r,f.getSource()),n[r]=m}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:l,main:f,facetRoot:m,ancestorParse:a,preFilterInvalid:u,postFilterInvalid:p}}function Q2(e,t,n){let{outputNodes:r,outputNodeRefCounts:i}=t.component.data,a=t.getDataName(e),o=new g6(n,a,e,i);return r[a]=o,o}function yIe(e){return e===!1||e===null}function bIe(e,t,n){let{encoding:r,config:i}=e,a=c0(r[t])??c0(r[GQ(t)]),{format:o,formatType:s}=e.axis(t)||{};if(N1(s))return{text:F1({fieldOrDatumDef:a,field:`datum.value`,format:o,formatType:s,config:i}),...n};if(o===void 0&&s===void 0&&i.customFormatTypes){if(q1(a)===`quantitative`){if(t0(a)&&a.stack===`normalize`&&i.normalizedNumberFormatType)return{text:F1({fieldOrDatumDef:a,field:`datum.value`,format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:F1({fieldOrDatumDef:a,field:`datum.value`,format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(q1(a)===`temporal`&&i.timeFormatType&&Z(a)&&!a.timeUnit)return{text:F1({fieldOrDatumDef:a,field:`datum.value`,format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function xIe(e){return Q4.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[EIe(n,e)]),t),{})}function SIe(e){let{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(let r of e.children){r.parseAxesAndHeaders();for(let i of $(r.component.axes))n.axis[i]=k2(e.component.resolve,i),n.axis[i]===`shared`&&(t[i]=CIe(t[i],r.component.axes[i]),t[i]||(n.axis[i]=`independent`,delete t[i]))}for(let i of Q4){for(let a of e.children)if(a.component.axes[i]){if(n.axis[i]===`independent`){t[i]=(t[i]??[]).concat(a.component.axes[i]);for(let e of a.component.axes[i]){let{value:t,explicit:n}=e.getWithExplicit(`orient`);if(!h$(t)){if(r[t]>0&&!n){let n=Rze[t];r[t]>r[n]&&e.set(`orient`,n,!1)}r[t]++}}}delete a.component.axes[i]}if(n.axis[i]===`independent`&&t[i]&&t[i].length>1)for(let[e,n]of(t[i]||[]).entries())e>0&&n.get(`grid`)&&!n.explicit.grid&&(n.implicit.grid=!1)}}function CIe(e,t){if(e){if(e.length!==t.length)return;let n=e.length;for(let r=0;re.clone());return e}function wIe(e,t){for(let n of B8){let r=G0(e.getWithExplicit(n),t.getWithExplicit(n),n,`axis`,(e,t)=>{switch(n){case`title`:return N$(e,t);case`gridScale`:return{explicit:e.explicit,value:kQ(e.value,t.value)}}return W0(e,t,n,`axis`)});e.setWithExplicit(n,r)}return e}function TIe(e,t,n,r,i){if(t===`disable`)return n!==void 0;switch(n||={},t){case`titleAngle`:case`labelAngle`:return e===(h$(n.labelAngle)?n.labelAngle:NQ(n.labelAngle));case`values`:return!!n.values;case`encode`:return!!n.encoding||!!n.labelAngle;case`title`:if(e===HNe(r,i))return!0}return e===n[t]}function EIe(e,t){let n=t.axis(e),r=new Lze,i=c0(t.encoding[e]),{mark:a,config:o}=t,s=n?.orient||o[e===`x`?`axisX`:`axisY`]?.orient||o.axis?.orient||zNe(e),c=t.getScaleComponent(e).get(`type`),l=ANe(e,c,s,t.config),u=n===void 0?b2(`disable`,o.style,n?.style,l).configValue:!n;if(r.set(`disable`,u,n!==void 0),u)return r;n||={};let d=PNe(i,n,e,o.style,l),f=sAe(n.formatType,i,c),p=oAe(i,i.type,n.format,n.formatType,o,!0),m={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:c,orient:s,labelAngle:d,format:p,formatType:f,mark:a,config:o};for(let i of B8){let a=i in Y6?Y6[i](m):zAe(i)?n[i]:void 0,s=a!==void 0,c=TIe(a,i,n,t,e);if(s&&c)r.set(i,a,c);else{let{configValue:e=void 0,configFrom:t=void 0}=zAe(i)&&i!==`values`?b2(i,o.style,n.style,l):{},u=e!==void 0;s&&!u?r.set(i,a,c):(t!==`vgAxisConfig`||zze.has(i)&&u||h0(e)||h$(e))&&r.set(i,e,!1)}}let h=n.encoding??{},g=K3.reduce((n,i)=>{if(!r.hasAxisPart(i))return n;let a=rPe(h[i]??{},t),o=i===`labels`?bIe(t,e,a):a;return o!==void 0&&!mQ(o)&&(n[i]={update:o}),n},{});return mQ(g)||r.set(`encode`,g,!!n.encoding||n.labelAngle!==void 0),r}function DIe({encoding:e,size:t}){for(let n of Q4){let r=KQ(n);j0(t[r])&&Y1(e[n])&&(delete t[r],X(X$(r)))}return t}function $2(e,t){let{config:n}=e;return{...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...o2(`x`,e,{defaultPos:`mid`}),...o2(`y`,e,{defaultPos:`mid`}),...i2(`size`,e),...i2(`angle`,e),...OIe(e,n,t)}}function OIe(e,t,n){return n?{shape:{value:n}}:i2(`shape`,e)}function kIe(e,t,n){if(E$(`align`,e,n)===void 0)return`center`}function AIe(e,t,n){if(E$(`baseline`,e,n)===void 0)return`middle`}function jIe(e){if(aQ([k3,D3,gRe],e.mark)){let t=JAe(e.mark,e.encoding);if(t.length>0)return MIe(e,t)}else if(e.mark===O3){let t=a3.some(t=>E$(t,e.markDef,e.config));if(e.stack&&!e.fieldDef(`size`)&&t)return NIe(e)}return e4(e)}function MIe(e,t){return[{name:e.getName(`pathgroup`),type:`group`,from:{facet:{name:H8+e.requestDataName(m6.Main),data:e.requestDataName(m6.Main),groupby:t}},encode:{update:{width:{field:{group:`width`}},height:{field:{group:`height`}}}},marks:e4(e,{fromPrefix:H8})}]}function NIe(e){let[t]=e4(e,{fromPrefix:U8}),n=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),i=(e,t)=>`${e}(${[r({prefix:`min`,suffix:`start`,expr:t}),r({prefix:`max`,suffix:`start`,expr:t}),r({prefix:`min`,suffix:`end`,expr:t}),r({prefix:`max`,suffix:`end`,expr:t})].map(e=>`scale('${n}',${e})`).join(`,`)})`,a,o;e.stack.fieldChannel===`x`?(a={...tQ(t.encode.update,[`y`,`yc`,`y2`,`height`,...a3]),x:{signal:i(`min`,`datum`)},x2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={x:{field:{group:`x`},mult:-1},height:{field:{group:`height`}}},t.encode.update={...nQ(t.encode.update,[`y`,`yc`,`y2`]),height:{field:{group:`height`}}}):(a={...tQ(t.encode.update,[`x`,`xc`,`x2`,`width`]),y:{signal:i(`min`,`datum`)},y2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={y:{field:{group:`y`},mult:-1},width:{field:{group:`width`}}},t.encode.update={...nQ(t.encode.update,[`x`,`xc`,`x2`]),width:{field:{group:`width`}}});for(let n of a3){let r=D$(n,e.markDef,e.config);t.encode.update[n]?(a[n]=t.encode.update[n],delete t.encode.update[n]):r&&(a[n]=S$(r)),r&&(t.encode.update[n]={value:0})}let s=[];if(e.stack.groupbyChannels?.length>0)for(let t of e.stack.groupbyChannels){let n=e.fieldDef(t),r=Q(n);r&&s.push(r),(n?.bin||n?.timeUnit)&&s.push(Q(n,{binSuffix:`end`}))}return a=[`stroke`,`strokeWidth`,`strokeJoin`,`strokeCap`,`strokeDash`,`strokeDashOffset`,`strokeMiterLimit`,`strokeOpacity`].reduce((n,r)=>{if(t.encode.update[r])return{...n,[r]:t.encode.update[r]};{let t=D$(r,e.markDef,e.config);return t===void 0?n:{...n,[r]:S$(t)}}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:`group`,from:{facet:{data:e.requestDataName(m6.Main),name:U8+e.requestDataName(m6.Main),groupby:s,aggregate:{fields:[r({suffix:`start`}),r({suffix:`start`}),r({suffix:`end`}),r({suffix:`end`})],ops:[`min`,`max`,`min`,`max`]}}},encode:{update:a},marks:[{type:`group`,encode:{update:o},marks:[t]}]}]}function PIe(e){let{encoding:t,stack:n,mark:r,markDef:i,config:a}=e,o=t.order;if(!(!H(o)&&$1(o)&&iQ(o.value)||!o&&iQ(E$(`order`,i,a)))){if((H(o)||Z(o))&&!n)return A$(o,{expr:`datum`});if(C1(r)){let e=i.orient===`horizontal`?`y`:`x`,n=t[e];if(Z(n))return{field:e}}}}function e4(e,t={fromPrefix:``}){let{mark:n,markDef:r,encoding:i,config:a}=e,o=kQ(r.clip,FIe(e),IIe(e)),s=T$(r),c=i.key,l=PIe(e),u=LIe(e);u&&Object.values(e.component.selection).some(e=>e.type===`point`&&!e.bind&&e.on!==`pointerover`)&&(e.markDef.cursor??=`pointer`);let d=E$(`aria`,r,a),f=V8[n].postEncodingTransform?V8[n].postEncodingTransform(e):null;return[{name:e.getName(`marks`),type:V8[n].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...c?{key:c.field}:{},...l?{sort:l}:{},...u||{},...d===!1?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(m6.Main)},encode:{update:V8[n].encodeEntry(e)},...f?{transform:f}:{}}]}function FIe(e){let t=e.getScaleComponent(`x`),n=e.getScaleComponent(`y`);return t?.get(`selectionExtent`)||n?.get(`selectionExtent`)?!0:void 0}function IIe(e){let t=e.component.projection;return t&&!t.isFit?!0:void 0}function LIe(e){if(!e.component.selection)return null;let t=$(e.component.selection).length,n=t,r=e.parent;for(;r&&n===0;)n=$(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark===`geoshape`||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}function t4(e,t,n,r,i){if(V1(e))return new Fze(e,t,n,i);if(F0(e))return new $ze(e,t,n,r,i);if(g0(e))return new W8(e,t,n,r,i);if(mje(e))return new Ize(e,t,n,i);throw Error(P$(e))}function RIe(e,t={}){t.logger&&dke(t.logger),t.fieldTitle&&jAe(t.fieldTitle);try{let n=Cje(Km(t.config,e.config)),r=bMe(e,n),i=t4(r,null,``,void 0,n);return i.parse(),KPe(i.component.data,i),{spec:BIe(i,zIe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&fke(),t.fieldTitle&&MAe()}}function zIe(e,t,n,r){let i=r.component.layoutSize.get(`width`),a=r.component.layoutSize.get(`height`);if(t===void 0?(t={type:`pad`},r.hasAxisOrientSignalRef()&&(t.resize=!0)):Yh(t)&&(t={type:t}),i&&a&&wMe(t.type)){if(i===`step`&&a===`step`)X(L$()),t.type=`pad`;else if(i===`step`||a===`step`){let e=i===`step`?`width`:`height`;X(L$(XQ(e))),t.type=TMe(e===`width`?`height`:`width`)}}return{...$(t).length===1&&t.type?t.type===`pad`?{}:{autosize:t.type}:{autosize:t},...EMe(n,!1),...EMe(e,!0)}}function BIe(e,t,n={},r){let i=e.config?wje(e.config):void 0,a=aIe(e.component.data,n),o=e.assembleSelectionData(a),s=e.assembleProjections(),c=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0),d=e.assembleLayoutSignals();d=d.filter(e=>(e.name===`width`||e.name===`height`)&&e.value!==void 0?(t[e.name]=+e.value,!1):!0);let{params:f,...p}=t;return{$schema:`https://vega.github.io/schema/vega/v6.json`,...e.description?{description:e.description}:{},...p,...c?{title:c}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...s.length>0?{projections:s}:{},...e.assembleGroup([...d,...e.assembleSelectionTopLevelSignals([]),...pje(f)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}var VIe,n4,$,r4,i4,a4,o4,s4,c4,l4,u4,d4,f4,p4,m4,h4,g4,_4,v4,y4,b4,x4,S4,C4,w4,T4,E4,D4,O4,k4,A4,j4,M4,N4,P4,F4,I4,L4,R4,z4,B4,V4,H4,U4,HIe,W4,G4,UIe,K4,q4,J4,Y4,WIe,GIe,KIe,qIe,JIe,YIe,XIe,ZIe,QIe,$Ie,eLe,tLe,nLe,rLe,iLe,aLe,oLe,sLe,cLe,lLe,uLe,dLe,fLe,pLe,mLe,X4,hLe,Z4,Q4,$4,gLe,e3,_Le,vLe,yLe,bLe,xLe,SLe,CLe,wLe,TLe,t3,ELe,n3,r3,i3,DLe,OLe,kLe,ALe,jLe,MLe,NLe,PLe,FLe,a3,ILe,LLe,RLe,zLe,BLe,VLe,HLe,ULe,o3,WLe,GLe,KLe,qLe,JLe,s3,YLe,XLe,ZLe,c3,l3,u3,QLe,d3,$Le,f3,p3,eRe,tRe,m3,h3,g3,_3,v3,y3,b3,x3,nRe,S3,C3,w3,rRe,iRe,aRe,oRe,sRe,cRe,lRe,uRe,dRe,fRe,pRe,T3,E3,D3,O3,mRe,k3,A3,hRe,j3,M3,N3,gRe,P3,F3,I3,_Re,vRe,yRe,bRe,L3,R3,xRe,SRe,z3,CRe,B3,wRe,TRe,V3,ERe,H3,U3,W3,G3,K3,DRe,q3,ORe,J3,Y3,X3,kRe,ARe,Z3,jRe,MRe,Q3,NRe,PRe,$3,FRe,e6,t6,IRe,LRe,n6,r6,RRe,zRe,i6,BRe,a6,VRe,o6,HRe,s6,c6,l6,URe,WRe,GRe,KRe,u6,qRe,JRe,YRe,d6,XRe,ZRe,QRe,$Re,f6,eze,tze,nze,rze,p6,ize,m6,h6,g6,_6,v6,y6,b6,aze,oze,x6,S6,C6,w6,T6,E6,D6,O6,sze,cze,lze,k6,A6,j6,M6,N6,uze,dze,fze,pze,mze,P6,F6,I6,L6,R6,hze,z6,B6,V6,gze,H6,U6,_ze,W6,G6,vze,K6,q6,J6,Y6,X6,Z6,Q6,yze,$6,bze,e8,t8,n8,r8,i8,a8,o8,s8,c8,l8,u8,d8,f8,xze,Sze,Cze,wze,Tze,Eze,Dze,Oze,kze,Aze,jze,p8,m8,h8,g8,_8,v8,y8,Mze,b8,x8,Nze,S8,C8,Pze,w8,T8,E8,D8,O8,k8,A8,j8,M8,N8,P8,F8,I8,L8,R8,z8,Fze,Ize,B8,Lze,Rze,zze,Bze,Vze,Hze,Uze,Wze,Gze,Kze,qze,Jze,Yze,Xze,Zze,Qze,V8,H8,U8,W8,$ze,eBe,tBe=o((()=>{pg(),oX(),CK(),iOe(),VIe={version:`6.4.3`},n4=structuredClone,Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>IQ(e)).join(`,`)})`},$=Object.keys,r4=Object.values,i4=Object.entries,a4=42,o4=Object.getPrototypeOf(structuredClone({})),s4=`row`,c4=`column`,l4=`facet`,u4=`x`,d4=`y`,f4=`x2`,p4=`y2`,m4=`xOffset`,h4=`yOffset`,g4=`radius`,_4=`radius2`,v4=`theta`,y4=`theta2`,b4=`latitude`,x4=`longitude`,S4=`latitude2`,C4=`longitude2`,w4=`time`,T4=`color`,E4=`fill`,D4=`stroke`,O4=`shape`,k4=`size`,A4=`angle`,j4=`opacity`,M4=`fillOpacity`,N4=`strokeOpacity`,P4=`strokeWidth`,F4=`strokeDash`,I4=`text`,L4=`order`,R4=`detail`,z4=`key`,B4=`tooltip`,V4=`href`,H4=`url`,U4=`description`,HIe={x:1,y:1,x2:1,y2:1},W4={theta:1,theta2:1,radius:1,radius2:1},G4={longitude:1,longitude2:1,latitude:1,latitude2:1},UIe=$(G4),K4={...HIe,...W4,...G4,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1},q4={row:1,column:1,facet:1},J4=$(q4),Y4={...K4,...q4},WIe=$(Y4),{order:GIe,detail:KIe,tooltip:qIe,...JIe}=Y4,{row:YIe,column:XIe,facet:ZIe,...QIe}=JIe,$Ie=[f4,p4,S4,C4,y4,_4],eLe=$(K4),{x:tLe,y:nLe,x2:rLe,y2:iLe,xOffset:aLe,yOffset:oLe,latitude:sLe,longitude:cLe,latitude2:lLe,longitude2:uLe,theta:dLe,theta2:fLe,radius:pLe,radius2:mLe,...X4}=K4,hLe=$(X4),Z4={x:1,y:1},Q4=$(Z4),$4={theta:1,radius:1},gLe=$($4),e3={xOffset:1,yOffset:1},_Le={time:1},{text:vLe,tooltip:yLe,href:bLe,url:xLe,description:SLe,detail:CLe,key:wLe,order:TLe,...t3}=X4,ELe=$(t3),n3={...Z4,...$4,...e3,...t3},r3=$(n3),i3={arc:`always`,area:`always`,bar:`always`,circle:`always`,geoshape:`always`,image:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:DLe,...OLe}=i3,kLe={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},ALe={count:1,min:1,max:1},jLe=new Set([`count`,`valid`,`missing`,`distinct`]),MLe=new Set([`count`,`sum`,`distinct`,`valid`,`missing`]),NLe=new Set([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]),PLe=$({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),FLe={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},a3=[`cornerRadius`,`cornerRadiusTopLeft`,`cornerRadiusTopRight`,`cornerRadiusBottomLeft`,`cornerRadiusBottomRight`],ILe=` – `,LLe=`Autosize "fit" only works for single views and layered views.`,RLe=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,zLe=`Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc`,BLe=`Legend bindings are only supported for selections over an individual field or encoding channel.`,VLe=`The same selection must be used to override scale domains in a layered view.`,HLe=`Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.`,ULe=`Multiple timer selections in one unit spec are not supported. Ignoring all but the first.`,o3=`Animation involving facet, layer, or concat is currently unsupported.`,WLe=`Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).`,GLe=`Attempt to add the same child twice.`,KLe=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`,qLe=`Arc marks uses theta channel rather than angle, replacing angle with theta.`,JLe=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`,s3=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,YLe=`Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.`,XLe=`Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.`,ZLe=`Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.`,c3=Hm(2),l3=c3,u3=[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`],QLe=u3.map(e=>e.substr(0,3)),d3=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`],$Le=d3.map(e=>e.substr(0,3)),f3={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},p3=$(f3),eRe={"year-month":`%b %Y `,"year-month-date":`%b %d, %Y `},tRe={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},m3={quantitative:`quantitative`,ordinal:`ordinal`,temporal:`temporal`,nominal:`nominal`,geojson:`geojson`},h3=m3.quantitative,g3=m3.ordinal,_3=m3.temporal,v3=m3.nominal,y3=m3.geojson,b3={LINEAR:`linear`,LOG:`log`,POW:`pow`,SQRT:`sqrt`,TIME:`time`,UTC:`utc`,POINT:`point`,BAND:`band`},x3={linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,identity:`numeric`,sequential:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`},nRe={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0},S3=new Set([`linear`,`log`,`pow`,`sqrt`,`symlog`]),C3=new Set([...S3,`time`,`utc`]),w3=new Set([`quantile`,`quantize`,`threshold`]),rRe=new Set([...C3,...w3,`sequential`,`identity`]),iRe=new Set([`ordinal`,`bin-ordinal`,`point`,`band`]),aRe={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},{type:oRe,domain:sRe,range:cRe,rangeMax:lRe,rangeMin:uRe,scheme:dRe,...fRe}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},pRe=$(fRe),T3={arc:`arc`,area:`area`,bar:`bar`,image:`image`,line:`line`,point:`point`,rect:`rect`,rule:`rule`,text:`text`,tick:`tick`,trail:`trail`,circle:`circle`,square:`square`,geoshape:`geoshape`},E3=T3.arc,D3=T3.area,O3=T3.bar,mRe=T3.image,k3=T3.line,A3=T3.point,hRe=T3.rect,j3=T3.rule,M3=T3.text,N3=T3.tick,gRe=T3.trail,P3=T3.circle,F3=T3.square,I3=T3.geoshape,_Re=new Set($(T3)),vRe=[`stroke`,`strokeWidth`,`strokeDash`,`strokeDashOffset`,`strokeOpacity`,`strokeJoin`,`strokeMiterLimit`],yRe=[`fill`,`fillOpacity`],bRe=[...vRe,...yRe],L3=$({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),R3=[`binSpacing`,`continuousBandSize`,`discreteBandSize`,`minBandSize`],xRe={area:[`line`,`point`],bar:R3,rect:R3,line:[`point`],tick:[`bandSize`,`thickness`,...R3]},SRe={color:`#4c78a8`,invalid:`break-paths-show-path-domains`,timeUnitBandSize:1},z3=$({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1}),CRe={horizontal:[`cornerRadiusTopRight`,`cornerRadiusBottomRight`],vertical:[`cornerRadiusTopLeft`,`cornerRadiusTopRight`]},B3={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},wRe={...B3,binSpacing:1},TRe={...B3,thickness:1},V3=`min`,ERe={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1},H3=(e,t)=>{switch(t.fieldTitle){case`plain`:return e.field;case`functional`:return AAe(e);default:return kAe(e,t)}},U3=H3,W3={compatible:!0},G3={labelAlign:{part:`labels`,vgProp:`align`},labelBaseline:{part:`labels`,vgProp:`baseline`},labelColor:{part:`labels`,vgProp:`fill`},labelFont:{part:`labels`,vgProp:`font`},labelFontSize:{part:`labels`,vgProp:`fontSize`},labelFontStyle:{part:`labels`,vgProp:`fontStyle`},labelFontWeight:{part:`labels`,vgProp:`fontWeight`},labelOpacity:{part:`labels`,vgProp:`opacity`},labelOffset:null,labelPadding:null,gridColor:{part:`grid`,vgProp:`stroke`},gridDash:{part:`grid`,vgProp:`strokeDash`},gridDashOffset:{part:`grid`,vgProp:`strokeDashOffset`},gridOpacity:{part:`grid`,vgProp:`opacity`},gridWidth:{part:`grid`,vgProp:`strokeWidth`},tickColor:{part:`ticks`,vgProp:`stroke`},tickDash:{part:`ticks`,vgProp:`strokeDash`},tickDashOffset:{part:`ticks`,vgProp:`strokeDashOffset`},tickOpacity:{part:`ticks`,vgProp:`opacity`},tickSize:null,tickWidth:{part:`ticks`,vgProp:`strokeWidth`}},K3=[`domain`,`grid`,`labels`,`ticks`,`title`],DRe={grid:`grid`,gridCap:`grid`,gridColor:`grid`,gridDash:`grid`,gridDashOffset:`grid`,gridOpacity:`grid`,gridScale:`grid`,gridWidth:`grid`,orient:`main`,bandPosition:`both`,aria:`main`,description:`main`,domain:`main`,domainCap:`main`,domainColor:`main`,domainDash:`main`,domainDashOffset:`main`,domainOpacity:`main`,domainWidth:`main`,format:`main`,formatType:`main`,labelAlign:`main`,labelAngle:`main`,labelBaseline:`main`,labelBound:`main`,labelColor:`main`,labelFlush:`main`,labelFlushOffset:`main`,labelFont:`main`,labelFontSize:`main`,labelFontStyle:`main`,labelFontWeight:`main`,labelLimit:`main`,labelLineHeight:`main`,labelOffset:`main`,labelOpacity:`main`,labelOverlap:`main`,labelPadding:`main`,labels:`main`,labelSeparation:`main`,maxExtent:`main`,minExtent:`main`,offset:`both`,position:`main`,tickCap:`main`,tickColor:`main`,tickDash:`main`,tickDashOffset:`main`,tickMinStep:`both`,tickOffset:`both`,tickOpacity:`main`,tickRound:`both`,ticks:`main`,tickSize:`main`,tickWidth:`both`,title:`main`,titleAlign:`main`,titleAnchor:`main`,titleAngle:`main`,titleBaseline:`main`,titleColor:`main`,titleFont:`main`,titleFontSize:`main`,titleFontStyle:`main`,titleFontWeight:`main`,titleLimit:`main`,titleLineHeight:`main`,titleOpacity:`main`,titlePadding:`main`,titleX:`main`,titleY:`main`,encode:`both`,scale:`both`,tickBand:`both`,tickCount:`both`,tickExtra:`both`,translate:`both`,values:`both`,zindex:`both`},q3={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},ORe={...q3,style:1,labelExpr:1,encoding:1},J3=$({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1}),Y3=class{name;run;constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return g0(e)?Xke(e.mark)===this.name:!1}},X3=`boxplot`,kRe=[`box`,`median`,`outliers`,`rule`,`ticks`],ARe=new Y3(X3,eje),Z3=`errorbar`,jRe=[`ticks`,`rule`],MRe=new Y3(Z3,rje),Q3=`errorband`,NRe=[`band`,`borders`],PRe=new Y3(Q3,dje),$3={},w0(X3,eje,kRe),w0(Z3,rje,jRe),w0(Q3,dje,NRe),FRe=[`gradientHorizontalMaxLength`,`gradientHorizontalMinLength`,`gradientVerticalMaxLength`,`gradientVerticalMinLength`,`unselectedOpacity`],e6={titleAlign:`align`,titleAnchor:`anchor`,titleAngle:`angle`,titleBaseline:`baseline`,titleColor:`color`,titleFont:`font`,titleFontSize:`fontSize`,titleFontStyle:`fontStyle`,titleFontWeight:`fontWeight`,titleLimit:`limit`,titleLineHeight:`lineHeight`,titleOrient:`orient`,titlePadding:`offset`},t6={labelAlign:`align`,labelAnchor:`anchor`,labelAngle:`angle`,labelBaseline:`baseline`,labelColor:`color`,labelFont:`font`,labelFontSize:`fontSize`,labelFontStyle:`fontStyle`,labelFontWeight:`fontWeight`,labelLimit:`limit`,labelLineHeight:`lineHeight`,labelOrient:`orient`,labelPadding:`offset`},IRe=$(e6),LRe=$(t6),n6=$({header:1,headerRow:1,headerColumn:1,headerFacet:1}),r6=[`size`,`shape`,`fill`,`stroke`,`strokeDash`,`strokeWidth`,`opacity`],RRe={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},zRe={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},i6=`_vgsid_`,BRe={point:{on:`click`,fields:[i6],toggle:`event.shiftKey`,resolve:`global`,clear:`dblclick`},interval:{on:`[pointerdown, window:pointerup] > window:pointermove!`,encodings:[`x`,`y`],translate:`[pointerdown, window:pointerup] > window:pointermove!`,zoom:`wheel!`,mark:{fill:`#333`,fillOpacity:.125,stroke:`white`},resolve:`global`,clear:`dblclick`}},a6=20,VRe=$({align:1,bounds:1,center:1,columns:1,spacing:1}),o6=20,HRe={background:`white`,padding:5,timeFormat:`%b %d, %Y`,countTitle:`Count of Records`,view:{continuousWidth:300,continuousHeight:300,step:o6},mark:SRe,arc:{},area:{},bar:wRe,circle:{},geoshape:{},image:{},line:{},point:{},rect:B3,rule:{color:`black`},square:{},text:{color:`black`},tick:TRe,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:`white`},outliers:{},rule:{},ticks:null},errorbar:{center:`mean`,rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:aRe,projection:{},legend:RRe,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:BRe,style:{},title:{},facet:{spacing:a6},concat:{spacing:a6},normalizedNumberFormat:`.0%`},s6=[`#4c78a8`,`#f58518`,`#e45756`,`#72b7b2`,`#54a24b`,`#eeca3b`,`#b279a2`,`#ff9da6`,`#9d755d`,`#bab0ac`],c6={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},l6={blue:s6[0],orange:s6[1],red:s6[2],teal:s6[3],green:s6[4],yellow:s6[5],purple:s6[6],pink:s6[7],brown:s6[8],gray0:`#000`,gray1:`#111`,gray2:`#222`,gray3:`#333`,gray4:`#444`,gray5:`#555`,gray6:`#666`,gray7:`#777`,gray8:`#888`,gray9:`#999`,gray10:`#aaa`,gray11:`#bbb`,gray12:`#ccc`,gray13:`#ddd`,gray14:`#eee`,gray15:`#fff`},URe=[...z3,...J3,...n6,`background`,`padding`,`legend`,`lineBreak`,`scale`,`style`,`title`,`view`],WRe=new Set([`view`,..._Re]),GRe=`color.fontSize.background.padding.facet.concat.numberFormat.numberFormatType.normalizedNumberFormat.normalizedNumberFormatType.timeFormat.countTitle.header.axisQuantitative.axisTemporal.axisDiscrete.axisPoint.axisXBand.axisXPoint.axisXDiscrete.axisXQuantitative.axisXTemporal.axisYBand.axisYPoint.axisYDiscrete.axisYQuantitative.axisYTemporal.scale.selection.overlay`.split(`.`),KRe={view:[`continuousWidth`,`continuousHeight`,`discreteWidth`,`discreteHeight`,`step`],...xRe},u6=class{map(e,t){return V1(e)?this.mapFacet(e,t):Dje(e)?this.mapRepeat(e,t):A0(e)?this.mapHConcat(e,t):k0(e)?this.mapVConcat(e,t):O0(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(F0(e))return this.mapLayer(e,t);if(g0(e))return this.mapUnit(e,t);throw Error(P$(e))}mapLayer(e,t){return{...e,layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map(e=>this.map(e,t))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map(e=>this.map(e,t))}}mapConcat(e,t){let{concat:n,...r}=e;return{...r,concat:n.map(e=>this.map(e,t))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}},qRe={zero:1,center:1,normalize:1},JRe=new Set([E3,O3,D3,j3,A3,P3,F3,k3,M3,N3]),YRe=new Set([O3,D3,E3]),d6=.7,XRe=class{name=`path-overlay`;hasMatchingType(e,t){if(g0(e)){let{mark:n,encoding:r}=e,i=T1(n)?n:{type:n};switch(i.type){case`line`:case`rule`:case`trail`:return!!L0(i,t[i.type],r);case`area`:return!!L0(i,t[i.type],r)||!!Bje(i,t[i.type])}}return!1}run(e,t,n){let{config:r}=t,{params:i,projection:a,mark:o,name:s,encoding:c,...l}=e,u=v0(c,r),d=T1(o)?o:{type:o},f=L0(d,r[d.type],u),p=d.type===`area`&&Bje(d,r[d.type]),m=[{name:s,...i?{params:i}:{},mark:Rje({...d.type===`area`&&E$(`opacity`,d,r)==null&&E$(`fillOpacity`,d,r)==null?{opacity:d6}:{},...d}),encoding:nQ(u,[`shape`])}],h=Mje(Nje(d,u,r),u),g=u;if(h){let{fieldChannel:e,offset:t}=h;g={...u,[e]:{...u[e],...t?{stack:t}:{}}}}return g=nQ(g,[`y2`,`x2`]),p&&m.push({...a?{projection:a}:{},mark:{type:`line`,...tQ(d,[`clip`,`interpolate`,`tension`,`tooltip`]),...p},encoding:g}),f&&m.push({...a?{projection:a}:{},mark:{type:`point`,opacity:1,filled:!0,...tQ(d,[`clip`,`tooltip`]),...f},encoding:g}),n({...l,layer:m},{...t,config:zje(r)})}},ZRe=class{name=`RuleForRangedLine`;hasMatchingType(e){if(g0(e)){let{encoding:t,mark:n}=e;if(n===`line`||T1(n)&&n.type===`line`)for(let e of $Ie){let n=t[UQ(e)];if(t[e]&&(Z(n)&&!s$(n.bin)||J1(n)))return!0}}return!1}run(e,t,n){let{encoding:r,mark:i}=e;return X(VOe(!!r.x2,!!r.y2)),n({...e,mark:Wm(i)?{...i,type:`rule`}:`rule`},t)}},QRe=class extends u6{nonFacetUnitNormalizers=[ARe,MRe,PRe,new XRe,new ZRe];map(e,t){if(g0(e)){let n=_0(e.encoding,s4),r=_0(e.encoding,c4),i=_0(e.encoding,l4);if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){let{parentEncoding:n,parentProjection:r}=t,i=R0(e.encoding,t.repeater),a={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{},...i?{encoding:i}:{}};if(n||r)return this.mapUnitWithParentEncodingOrProjection(a,t);let o=this.mapLayerOrUnit.bind(this);for(let e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(a,t.config))return e.run(a,t,o);return a}mapRepeat(e,t){return Oje(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){let{repeat:n,spec:r,...i}=e,{row:a,column:o,layer:s}=n,{repeater:c={},repeaterPrefix:l=``}=t;return a||o?this.mapRepeat({...e,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},t):{...i,layer:s.map(e=>{let n={...c,layer:e},i=`${(r.name?`${r.name}_`:``)+l}child__layer_${_Q(e)}`,a=this.mapLayerOrUnit(r,{...t,repeater:n,repeaterPrefix:i});return a.name=i,a})}}mapNonLayerRepeat(e,t){let{repeat:n,spec:r,data:i,...a}=e;!H(n)&&e.columns&&(e=nQ(e,[`columns`]),X(V$(`repeat`)));let o=[],{repeater:s={},repeaterPrefix:c=``}=t,l=!H(n)&&n.row||[s?s.row:null],u=!H(n)&&n.column||[s?s.column:null],d=H(n)&&n||[s?s.repeat:null];for(let e of d)for(let i of l)for(let a of u){let l={repeat:e,row:i,column:a,layer:s.layer},u=`${(r.name?`${r.name}_`:``)+c}child__${H(n)?`${_Q(e)}`:(n.row?`row_${_Q(i)}`:``)+(n.column?`column_${_Q(a)}`:``)}`,d=this.map(r,{...t,repeater:l,repeaterPrefix:u});d.name=u,o.push(nQ(d,[`data`]))}let f=H(n)?e.columns:n.column?n.column.length:1;return{data:r.data??i,align:`all`,...a,columns:f,concat:o}}mapFacet(e,t){let{facet:n}=e;return z1(n)&&e.columns&&(e=nQ(e,[`columns`]),X(V$(`facet`))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){let{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:a,config:o}=t,s=qje({parentProjection:a,projection:r}),c=Kje({parentEncoding:i,encoding:R0(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:o})}mapFacetedUnit(e,t){let{row:n,column:r,facet:i,...a}=e.encoding,{mark:o,width:s,projection:c,height:l,view:u,params:d,encoding:f,...p}=e,{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:n,column:r,facet:i},t),g=R0(a,t.repeater);return this.mapFacet({...p,...h,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:o,encoding:g,...d?{params:d}:{}}},t)}getFacetMappingAndLayout(e,t){let{row:n,column:r,facet:i}=e;if(n||r){i&&X(zOe([...n?[s4]:[],...r?[c4]:[]]));let t={},a={};for(let n of[s4,c4]){let r=e[n];if(r){let{align:e,center:i,spacing:o,columns:s,...c}=r;t[n]=c;for(let e of[`align`,`center`,`spacing`])r[e]!==void 0&&(a[e]??={},a[e][n]=r[e])}}return{facetMapping:t,layout:a}}else{let{align:e,center:n,spacing:r,columns:a,...o}=i;return{facetMapping:Vje(o,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...r?{spacing:r}:{},...a?{columns:a}:{}}}}}mapLayer(e,{parentEncoding:t,parentProjection:n,...r}){let{encoding:i,projection:a,...o}=e,s={...r,parentEncoding:Kje({parentEncoding:t,encoding:i,layer:!0}),parentProjection:qje({parentProjection:n,projection:a})};return super.mapLayer({...o,...e.name?{name:[s.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{}},s)}},$Re=class extends u6{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=gMe(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if(e=gMe(e,t),e.encoding){let n={};for(let[r,i]of i4(e.encoding))n[r]=_Me(i,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){let{selection:n,...r}=e;return n?{...r,params:i4(n).map(([e,n])=>{let{init:r,bind:i,empty:a,...o}=n;o.type===`single`?(o.type=`point`,o.toggle=!1):o.type===`multi`&&(o.type=`point`),t.emptySelections[e]=a!==`none`;for(let n of r4(t.selectionPredicates[e]??{}))n.empty=a!==`none`;return{name:e,value:r,select:o,bind:i}})}:e}},f6=class extends u6{map(e,t){let n=t.selections??[];if(e.params&&!g0(e)){let t=[];for(let r of e.params)D0(r)?n.push(r):t.push(r);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){let n=t.selections;if(!n||!n.length)return e;let r=(t.path??[]).concat(e.name),i=[];for(let t of n)if(!t.views||!t.views.length)i.push(t);else for(let n of t.views)(Yh(n)&&(n===e.name||r.includes(n))||H(n)&&n.map(e=>r.indexOf(e)).every((e,t,n)=>e!==-1&&(t===0||e>n[t-1])))&&i.push(t);return i.length&&(e.params=i),e}};for(let e of[`mapFacet`,`mapRepeat`,`mapHConcat`,`mapVConcat`,`mapLayer`]){let t=f6.prototype[e];f6.prototype[e]=function(e,n){return t.call(this,e,yMe(e,n))}}eze=new QRe,tze=new $Re,nze=new f6,rze=[`background`,`padding`],p6=class e{explicit;implicit;constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new e(n4(this.explicit),n4(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return kQ(this.explicit[e],this.implicit[e])}getWithExplicit(e){return this.explicit[e]===void 0?this.implicit[e]===void 0?{explicit:!1,value:void 0}:{explicit:!1,value:this.implicit[e]}:{explicit:!0,value:this.explicit[e]}}setWithExplicit(e,{value:t,explicit:n}){t!==void 0&&this.set(e,t,n)}set(e,t,n){return delete this[n?`implicit`:`explicit`][e],this[n?`explicit`:`implicit`][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){t[e]===void 0?n[e]!==void 0&&this.set(e,n[e],!1):this.set(e,t[e],!0)}copyKeyFromObject(e,t){t[e]!==void 0&&this.set(e,t[e],!0)}copyAll(e){for(let t of $(e.combine())){let n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}},ize=class extends p6{explicit;implicit;parseNothing;constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){let e=super.clone();return e.parseNothing=this.parseNothing,e}},(function(e){e[e.Raw=0]=`Raw`,e[e.Main=1]=`Main`,e[e.Row=2]=`Row`,e[e.Column=3]=`Column`,e[e.Lookup=4]=`Lookup`,e[e.PreFilterInvalid=5]=`PreFilterInvalid`,e[e.PostFilterInvalid=6]=`PostFilterInvalid`})(m6||={}),h6=class{debugName;_children=[];_parent=null;_hash;constructor(e,t){this.debugName=t,e&&(this.parent=e)}clone(){throw Error(`Cannot clone node`)}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){if(this._children.includes(e)){X(GLe);return}t===void 0?this._children.push(e):this._children.splice(t,0,e)}removeChild(e){let t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(let t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){let t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){let e=this._parent,t=e.parent;for(let t of this._children)t.parent=e;this._children=[],e.removeChild(this);let n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}},g6=class extends h6{type;refCounts;_source;_name;clone(){let e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${AQ()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}},_6=class e extends h6{timeUnits;clone(){return new e(null,n4(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{let{field:i,timeUnit:a}=t;if(a){let o;if(i1(a)){if(W2(n)){let{mark:e,markDef:r,config:s}=n,c=U1({fieldDef:t,markDef:r,config:s});(w1(e)||c)&&(o={timeUnit:s1(a),field:i})}}else o={as:Q(t,{forAs:!0}),field:i,timeUnit:a};if(W2(n)){let{mark:e,markDef:i,config:a}=n,s=U1({fieldDef:t,markDef:i,config:a});w1(e)&&YQ(r)&&s!==.5&&(o.rectBandPosition=s)}o&&(e[rQ(o)]=o)}return e},{});return mQ(r)?null:new e(t,r)}static makeFromTransform(t,n){let{timeUnit:r,...i}={...n},a=s1(r),o={...i,timeUnit:a};return new e(t,{[rQ(o)]:o})}merge(e){this.timeUnits={...this.timeUnits};for(let t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){let t={};for(let[n,r]of i4(this.timeUnits)){let i=X0(r)?r.as:`${r.field}_end`;e.has(i)||(t[n]=r)}this.timeUnits=t}producedFields(){return new Set(r4(this.timeUnits).map(e=>X0(e)?e.as:NMe(e.field)))}dependentFields(){return new Set(r4(this.timeUnits).map(e=>e.field))}hash(){return`TimeUnit ${rQ(this.timeUnits)}`}assemble(){let e=[];for(let t of r4(this.timeUnits)){let{rectBandPosition:n}=t,r=s1(t.timeUnit);if(X0(t)){let{field:i,as:a}=t,{unit:o,utc:s,...c}=r,l=[a,`${a}_end`];e.push({field:TQ(i),type:`timeunit`,...o?{units:o1(o)}:{},...s?{timezone:`utc`}:{},...c,as:l}),e.push(...FMe(l,n,r))}else if(t){let{field:i}=t,a=wQ(i),o=PMe({timeUnit:r,field:a}),s=NMe(a);e.push({type:`formula`,expr:o,as:s}),e.push(...FMe([a,s],n,r))}}return e}},v6=`offsetted_rect_start`,y6=`offsetted_rect_end`,b6=`_tuple_fields`,aze=class{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}},oze={defined:()=>!0,parse:(e,t,n)=>{let r=t.name,i=t.project??=new aze,a={},o={},s=new Set,c=(e,t)=>{let n=t===`visual`?e.channel:e.field,i=_Q(`${r}_${n}`);for(let e=1;s.has(i);e++)i=_Q(`${r}_${n}_${e}`);return s.add(i),{[t]:i}},l=t.type,u=e.config.selection[l],d=n.value===void 0?null:yh(n.value),{fields:f,encodings:p}=Wm(n.select)?n.select:{};if(!f&&!p&&d){for(let e of d)if(Wm(e))for(let t of $(e))uOe(t)?(p||=[]).push(t):l===`interval`?(X(HLe),p=u.encodings):(f??=[]).push(t)}!f&&!p&&(p=u.encodings,`fields`in u&&(f=u.fields));for(let t of p??[]){let n=e.fieldDef(t);if(n){let r=n.field;if(n.aggregate){X(bOe(t,n.aggregate));continue}else if(!r){X(z$(t));continue}if(n.timeUnit&&!i1(n.timeUnit)){r=e.vgField(t);let i={timeUnit:n.timeUnit,as:r,field:n.field};o[rQ(i)]=i}if(!a[r]){let o=l===`interval`&&$Q(t)&&y1(e.getScaleComponent(t).get(`type`))?`R`:n.bin?`R-RE`:`E`,s={field:r,channel:t,type:o,index:i.items.length};s.signals={...c(s,`data`),...c(s,`visual`)},i.items.push(a[r]=s),i.hasField[r]=a[r],i.hasSelectionId=i.hasSelectionId||r===i6,zQ(t)?(s.geoChannel=t,s.channel=RQ(t),i.hasChannel[s.channel]=a[r]):i.hasChannel[t]=a[r]}}else X(z$(t))}for(let e of f??[]){if(i.hasField[e])continue;let t={type:`E`,field:e,index:i.items.length};t.signals={...c(t,`data`)},i.items.push(t),i.hasField[e]=t,i.hasSelectionId=i.hasSelectionId||e===i6}d&&(t.init=d.map(e=>i.items.map(t=>Wm(e)?e[t.geoChannel||t.channel]===void 0?e[t.field]:e[t.geoChannel||t.channel]:e))),mQ(o)||(i.timeUnit=new _6(null,o))},signals:(e,t,n)=>{let r=t.name+b6;return n.filter(e=>e.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(LMe)})}},x6=`_curr`,S6=`anim_value`,C6=`anim_clock`,w6=`eased_anim_clock`,T6=`min_extent`,E6=`max_range_extent`,D6=`last_tick_at`,O6=`is_playing`,sze=1/60*1e3,cze=(e,t)=>[{name:w6,update:C6},{name:`${e}_domain`,init:`domain('${t}')`},{name:T6,init:`extent(${e}_domain)[0]`},{name:E6,init:`extent(range('${t}'))[1]`},{name:S6,update:`invert('${t}', ${w6})`}],lze={defined:e=>e.type===`point`,topLevelSignals:(e,t,n)=>(h2(t)&&(n=n.concat([{name:C6,init:`0`,on:[{events:{type:`timer`,throttle:sze},update:`${O6} ? (${C6} + (now() - ${D6}) > ${E6} ? 0 : ${C6} + (now() - ${D6})) : ${C6}`}]},{name:D6,init:`now()`,on:[{events:[{signal:C6},{signal:O6}],update:`now()`}]},{name:O6,init:`true`}])),n),signals:(e,t,n)=>{let r=t.name,i=r+b6,a=t.project,o=`(item().isVoronoi ? datum.datum : datum)`,s=r4(e.component.selection??{}).reduce((e,t)=>t.type===`interval`?e.concat(t.name+A6):e,[]).map(e=>`indexof(item().mark.name, '${e}') < 0`).join(` && `),c=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${s?` && ${s}`:``}`,l=`unit: ${p2(e)}, `;if(t.project.hasSelectionId)l+=`${i6}: ${o}[${W(i6)}]`;else if(h2(t))l+=`fields: ${i}, values: [${S6} ? ${S6} : ${T6}]`;else{let t=a.items.map(t=>e.fieldDef(t.channel)?.bin?`[${o}[${W(e.vgField(t.channel,{}))}], ${o}[${W(e.vgField(t.channel,{binSuffix:`end`}))}]]`:`${o}[${W(t.field)}]`).join(`, `);l+=`fields: ${i}, values: [${t}]`}if(h2(t))return n.concat(cze(t.name,e.scaleName(w4)),[{name:r+G6,on:[{events:[{signal:w6},{signal:S6}],update:`{${l}}`,force:!0}]}]);{let e=t.events;return n.concat([{name:r+G6,on:e?[{events:e,update:`${c} ? {${l}} : null`,force:!0}]:[]}])}}},k6={defined:e=>e.type===`interval`&&e.resolve===`global`&&e.bind&&e.bind===`scales`,parse:(e,t)=>{let n=t.scales=[];for(let r of t.project.items){let i=r.channel;if(!$Q(i))continue;let a=e.getScaleComponent(i),o=a?a.get(`type`):void 0;if(o==`sequential`&&X(zLe),!a||!y1(o)){X(RLe);continue}a.set(`selectionExtent`,{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{let r=t.scales.filter(e=>n.filter(t=>t.name===e.signals.data).length===0);if(!e.parent||e2(e)||r.length===0)return n;let i=n.find(e=>e.name===t.name),a=i.update;if(a.includes(K6))i.update=`{${r.map(e=>`${W(TQ(e.field))}: ${e.signals.data}`).join(`, `)}}`;else{for(let e of r){let t=`${W(TQ(e.field))}: ${e.signals.data}`;a.includes(t)||(a=`${a.substring(0,a.length-1)}, ${t}}`)}i.update=a}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!e2(e))for(let e of t.scales){let t=n.find(t=>t.name===e.signals.data);t.push=`outer`,delete t.value,delete t.update}return n}},A6=`_brush`,j6=`_scale_trigger`,M6=`geo_interval_init_tick`,N6=`_init`,uze=`_center`,dze={defined:e=>e.type===`interval`,parse:(e,t,n)=>{if(e.hasProjection){let e={...Wm(n.select)?n.select:{}};e.fields=[i6],e.encodings||=n.value?$(n.value):[x4,b4],n.select={type:`interval`,...e}}if(t.translate&&!k6.defined(t)){let e=`!event.item || event.item.mark.name !== ${W(t.name+A6)}`;for(let n of t.events){if(!n.between){X(`${n} is not an ordered event stream for interval selections.`);continue}let t=yh(n.between[0].filter??=[]);t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{let r=t.name,i=r+G6,a=r4(t.project.hasChannel).filter(e=>e.channel===u4||e.channel===d4),o=t.init?t.init[0]:null;if(n.push(...a.reduce((n,r)=>n.concat(GMe(e,t,r,o?.[r.index])),[])),e.hasProjection){let s=W(e.projectionName()),c=e.projectionName()+uze,{x:l,y:u}=t.project.hasChannel,d=l?.signals.visual,f=u?.signals.visual,p=l?o?.[l.index]:`${c}[0]`,m=u?o?.[u.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,g=`[[${d?`${d}[0]`:`0`}, ${f?`${f}[0]`:`0`}],[${d?`${d}[1]`:h(`width`)}, ${f?`${f}[1]`:h(`height`)}]]`;o&&(n.unshift({name:r+N6,init:`[scale(${s}, [${l?p[0]:p}, ${u?m[0]:m}]), scale(${s}, [${l?p[1]:p}, ${u?m[1]:m}])]`}),(!l||!u)&&(n.find(e=>e.name===c)||n.unshift({name:c,update:`invert(${s}, [${h(`width`)}/2, ${h(`height`)}/2])`})));let _=`vlSelectionTuples(${`intersect(${g}, {markname: ${W(e.getName(`marks`))}}, unit.mark)`}, ${`{unit: ${p2(e)}}`})`,v=a.map(e=>e.signals.visual);return n.concat({name:i,on:[{events:[...v.length?[{signal:v.join(` || `)}]:[],...o?[{signal:M6}]:[]],update:_}]})}else{if(!k6.defined(t)){let t=r+j6,i=a.map(t=>{let n=t.channel,{data:r,visual:i}=t.signals,a=W(e.scaleName(n)),o=y1(e.getScaleComponent(n).get(`type`))?`+`:``;return`(!isArray(${r}) || (${o}invert(${a}, ${i})[0] === ${o}${r}[0] && ${o}invert(${a}, ${i})[1] === ${o}${r}[1]))`});i.length&&n.push({name:t,value:{},on:[{events:a.map(t=>({scale:e.scaleName(t.channel)})),update:`${i.join(` && `)} ? ${t} : {}`}]})}let s=a.map(e=>e.signals.data),c=`unit: ${p2(e)}, fields: ${r+b6}, values`;return n.concat({name:i,...o?{init:`{${c}: ${Z0(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(` || `)}],update:`${s.join(` && `)} ? {${c}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(W2(e)&&e.hasProjection&&t.init&&(n.filter(e=>e.name===M6).length||n.unshift({name:M6,value:null,on:[{events:`timer{1}`,update:`${M6} === null ? {} : ${M6}`}]})),n),marks:(e,t,n)=>{let r=t.name,{x:i,y:a}=t.project.hasChannel,o=i?.signals.visual,s=a?.signals.visual,c=`data(${W(t.name+W6)})`;if(k6.defined(t)||!i&&!a)return n;let l={x:i===void 0?{value:0}:{signal:`${o}[0]`},y:a===void 0?{value:0}:{signal:`${s}[0]`},x2:i===void 0?{field:{group:`width`}}:{signal:`${o}[1]`},y2:a===void 0?{field:{group:`height`}}:{signal:`${s}[1]`}};if(t.resolve===`global`)for(let t of $(l))l[t]=[{test:`${c}.length && ${c}[0].unit === ${p2(e)}`,...l[t]},{value:0}];let{fill:u,fillOpacity:d,cursor:f,...p}=t.mark,m=$(p).reduce((e,t)=>(e[t]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(e=>e).join(` && `),value:p[t]},{value:null}],e),{}),h=f??(t.translate?`move`:null);return[{name:`${r+A6}_bg`,type:`rect`,clip:!0,encode:{enter:{fill:{value:u},fillOpacity:{value:d}},update:l}},...n,{name:r+A6,type:`rect`,clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:`transparent`}},update:{...l,...m}}}]}},fze={left:`x`,center:`xc`,right:`x2`},pze={top:`y`,middle:`yc`,bottom:`y2`},mze=new Set([`aria`,`width`,`height`]),P6=`voronoi`,F6={defined:e=>e.type===`point`&&e.nearest,parse:(e,t)=>{if(t.events)for(let n of t.events)n.markname=e.getName(P6)},marks:(e,t,n)=>{let{x:r,y:i}=t.project.hasChannel,a=e.mark;if(C1(a))return X(xOe(a)),n;let o={name:e.getName(P6),type:`path`,interactive:!0,aria:!1,from:{data:e.getName(`marks`)},encode:{update:{fill:{value:`transparent`},strokeWidth:{value:.35},stroke:{value:`transparent`},isVoronoi:{value:!0},...KMe(e,{reactiveGeom:!0})}},transform:[{type:`voronoi`,x:{expr:r||!i?`datum.datum.x || 0`:`0`},y:{expr:i||!r?`datum.datum.y || 0`:`0`},size:[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]}]},s=0,c=!1;return n.forEach((t,n)=>{let r=t.name??``;r===e.component.mark[0].name?s=n:r.includes(P6)&&(c=!0)}),c||n.splice(s+1,0,o),n}},I6={defined:e=>e.type===`point`&&e.resolve===`global`&&e.bind&&e.bind!==`scales`&&!T0(e.bind),parse:(e,t,n)=>yNe(t,n),topLevelSignals:(e,t,n)=>{let r=t.name,i=t.project,a=t.bind,o=t.init?.[0],s=F6.defined(t)?`(item().isVoronoi ? datum.datum : datum)`:`datum`;return i.items.forEach((e,i)=>{let c=_Q(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift({name:c,...o?{init:Z0(o[i])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${W(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})}),n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+G6),o=r+b6,s=i.items.map(e=>_Q(`${r}_${e.field}`)),c=s.map(e=>`${e} !== null`).join(` && `);return s.length&&(a.update=`${c} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`),delete a.value,delete a.on,n}},L6=`_toggle`,R6={defined:e=>e.type===`point`&&!h2(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+L6,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{let n=t.name+G6,r=t.name+L6;return`${r} ? null : ${n}, ${t.resolve===`global`?`${r} ? null : true, `:`${r} ? null : {unit: ${p2(e)}}, `}${r} ? ${n} : null`}},hze={defined:e=>e.clear!==void 0&&e.clear!==!1&&!h2(e),parse:(e,t)=>{t.clear&&=Yh(t.clear)?oK(t.clear,`view`):t.clear},topLevelSignals:(e,t,n)=>{if(I6.defined(t))for(let e of t.project.items){let r=n.findIndex(n=>n.name===_Q(`${t.name}_${e.field}`));r!==-1&&n[r].on.push({events:t.clear,update:`null`})}return n},signals:(e,t,n)=>{function r(e,r){e!==-1&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if(t.type===`interval`)for(let e of t.project.items){let t=n.findIndex(t=>t.name===e.signals.visual);r(t,`[0, 0]`),t===-1&&r(n.findIndex(t=>t.name===e.signals.data),`null`)}else{let e=n.findIndex(e=>e.name===t.name+G6);r(e,`null`),R6.defined(t)&&(e=n.findIndex(e=>e.name===t.name+L6),r(e,`false`))}return n}},z6={defined:e=>{let t=e.resolve===`global`&&e.bind&&T0(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==i6;return t&&!n&&X(BLe),t&&n},parse:(e,t,n)=>{let r=n4(n);if(r.select=Yh(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},yNe(t,r),Wm(n.select)&&(n.select.on||n.select.clear)){let e=`event.item && indexof(event.item.mark.role, "legend") < 0`;for(let n of t.events)n.filter=yh(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}let i=E0(t.bind)?t.bind.legend:`click`;t.bind={legend:{merge:Yh(i)?oK(i,`view`):yh(i)}}},topLevelSignals:(e,t,n)=>{let r=t.name,i=E0(t.bind)&&t.bind.legend,a=e=>t=>{let n=n4(t);return n.markname=e,n};for(let e of t.project.items){if(!e.hasLegend)continue;let o=`${_Q(e.field)}_legend`,s=`${r}_${o}`;if(n.filter(e=>e.name===s).length===0){let e=i.merge.map(a(`${o}_symbols`)).concat(i.merge.map(a(`${o}_labels`))).concat(i.merge.map(a(`${o}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:`isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value`,force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+G6),o=r+b6,s=i.items.filter(e=>e.hasLegend).map(e=>_Q(`${r}_${_Q(e.field)}_legend`)),c=`${s.map(e=>`${e} !== null`).join(` && `)} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`;t.events&&s.length>0?a.on.push({events:s.map(e=>({signal:e})),update:c}):s.length>0&&(a.update=c,delete a.value,delete a.on);let l=n.find(e=>e.name===r+L6),u=E0(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:u}):l.on[0].events=u),n}},B6=`_translate_anchor`,V6=`_translate_delta`,gze={defined:e=>e.type===`interval`&&e.translate,signals:(e,t,n)=>{let r=t.name,i=k6.defined(t),a=r+B6,{x:o,y:s}=t.project.hasChannel,c=oK(t.translate,`scope`);return i||(c=c.map(e=>(e.between[0].markname=r+A6,e))),n.push({name:a,value:{},on:[{events:c.map(e=>e.between[0]),update:`{x: x(unit), y: y(unit)${o===void 0?``:`, extent_x: ${i?$0(e,u4):`slice(${o.signals.visual})`}`}${s===void 0?``:`, extent_y: ${i?$0(e,d4):`slice(${s.signals.visual})`}`}}`}]},{name:r+V6,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&gNe(e,t,o,`width`,n),s!==void 0&&gNe(e,t,s,`height`,n),n}},H6=`_zoom_anchor`,U6=`_zoom_delta`,_ze={defined:e=>e.type===`interval`&&e.zoom,signals:(e,t,n)=>{let r=t.name,i=k6.defined(t),a=r+U6,{x:o,y:s}=t.project.hasChannel,c=W(e.scaleName(u4)),l=W(e.scaleName(d4)),u=oK(t.zoom,`scope`);return i||(u=u.map(e=>(e.markname=r+A6,e))),n.push({name:r+H6,on:[{events:u,update:i?`{${[c?`x: invert(${c}, x(unit))`:``,l?`y: invert(${l}, y(unit))`:``].filter(e=>e).join(`, `)}}`:`{x: x(unit), y: y(unit)}`}]},{name:a,on:[{events:u,force:!0,update:`pow(1.001, event.deltaY * pow(16, event.deltaMode))`}]}),o!==void 0&&_Ne(e,t,o,`width`,n),s!==void 0&&_Ne(e,t,s,`height`,n),n}},W6=`_store`,G6=`_tuple`,vze=`_modify`,K6=`vlSelectionResolve`,q6=[lze,dze,oze,R6,I6,k6,z6,hze,gze,_ze,F6],J6=class e extends h6{model;filter;expr;_dependentFields;clone(){return new e(null,this.model,n4(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=_2(this.model,this.filter,this),this._dependentFields=xNe(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:`filter`,expr:this.expr}}hash(){return`Filter ${this.expr}`}},Y6={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??MNe(n,e),gridScale:({model:e,channel:t})=>NNe(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||INe(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||FNe(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??LNe(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??RNe(t.type,n,Z(t)&&!!t.timeUnit,Z(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{let a=e===`x`?`width`:e===`y`?`height`:void 0,o=a?t.getSizeSignalRef(a):void 0;return n.tickCount??BNe({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??VNe({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;let r=HNe(t,n);if(r!==void 0)return r;let i=t.typedFieldDef(n),a=n===`x`?`x2`:`y2`,o=t.fieldDef(a);return j$(i?[_Ae(i)]:[],Z(o)?[_Ae(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>UNe(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??WNe(n,t)},X6=class e extends h6{transform;_dependentFields;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=xNe(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef((n,r)=>{if(e0(n)&&mAe(n.sort)){let{field:i,timeUnit:a}=n,o=n.sort,s=o.map((e,t)=>`${Fke({field:i,timeUnit:a,equal:e})} ? ${t} : `).join(``)+o.length;t=new e(t,{calculate:s,as:S2(n,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:`formula`,expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${rQ(this.transform)}`}},Z6=[`row`,`column`],Q6=[`header`,`footer`],yze={column:{start:0,end:1},row:{start:1,end:0}},$6=$({...zRe,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),bze=class extends p6{},e8={symbols:aPe,gradient:oPe,labels:sPe,entries:cPe},t8={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{let{format:r,formatType:i}=t;return oAe(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{let{formatType:r}=e;return sAe(r,t,n)},gradientLength:e=>{let{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??vPe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??bPe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??pPe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>r0(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(BQ(n)&&b1(t)){if(e===`gradient`)return}else if(e===`symbol`)return;return e},values:({fieldOrDatumDef:e,legend:t})=>fPe(t,e)},n8=class e extends h6{bins;clone(){return new e(null,n4(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{if(Q1(t)&&o$(t.bin)){let{key:i,binComponent:a}=NPe(t,t.bin,n);e[i]={...a,...e[i],...kPe(n,t,r,n.config)}}return e},{});return mQ(r)?null:new e(t,r)}static makeFromTransform(t,n,r){let{key:i,binComponent:a}=NPe(n,n.bin,r);return new e(t,{[i]:a})}merge(e,t){for(let n of $(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=lQ([...this.bins[n].as,...e.bins[n].as],rQ)):this.bins[n]=e.bins[n];for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(r4(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(r4(this.bins).map(e=>e.field))}hash(){return`Bin ${rQ(this.bins)}`}assemble(){return r4(this.bins).flatMap(e=>{let t=[],[n,...r]=e.as,{extent:i,...a}=e.bin,o={type:`bin`,field:TQ(e.field),as:n,signal:e.signal,...l$(i)?{extent:null}:{extent:i},...e.span?{span:{signal:`span(${e.span})`}}:{},...a};!i&&e.extentSignal&&(t.push({type:`extent`,field:TQ(e.field),signal:e.extentSignal}),o.extent={signal:e.extentSignal}),t.push(o);for(let e of r)for(let r=0;r<2;r++)t.push({type:`formula`,expr:Q({field:n[r]},{expr:`datum`}),as:e[r]});return e.formula&&t.push({type:`formula`,expr:e.formula,as:e.formulaAs}),t})}},r8=class e extends h6{dimensions;measures;clone(){return new e(null,new Set(this.dimensions),n4(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let r=!1;n.forEachFieldDef(e=>{e.aggregate&&(r=!0)});let i={},a=new Set;return!r||(n.forEachFieldDef((e,t)=>{let{aggregate:r,field:o}=e;if(r)if(r===`count`)i[`*`]??={},i[`*`].count=new Set([Q(e,{forAs:!0})]);else{if(t$(r)||n$(r)){let e=t$(r)?`argmin`:`argmax`,t=r[e];i[t]??={},i[t][e]=new Set([Q({op:e,field:t},{forAs:!0})])}else i[o]??={},i[o][r]=new Set([Q(e,{forAs:!0})]);$Q(t)&&n.scaleDomain(t)===`unaggregated`&&(i[o]??={},i[o].min=new Set([Q({field:o,aggregate:`min`},{forAs:!0})]),i[o].max=new Set([Q({field:o,aggregate:`max`},{forAs:!0})]))}else PPe(a,t,e,n)}),a.size+$(i).length===0)?null:new e(t,a,i)}static makeFromTransform(t,n){let r=new Set,i={};for(let e of n.aggregate){let{op:t,field:n,as:r}=e;t&&(t===`count`?(i[`*`]??={},i[`*`].count=new Set([r||Q(e,{forAs:!0})])):(i[n]??={},i[n][t]??=new Set,i[n][t].add(r||Q(e,{forAs:!0}))))}for(let e of n.groupby??[])r.add(e);return r.size+$(i).length===0?null:new e(t,r,i)}merge(e){return uQ(this.dimensions,e.dimensions)?(FPe(this.measures,e.measures),!0):(pke(`different dimensions, cannot merge`),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...$(this.measures)])}producedFields(){let e=new Set;for(let t of $(this.measures))for(let n of $(this.measures[t])){let r=this.measures[t][n];r.size===0?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${rQ({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let e=[],t=[],n=[];for(let r of $(this.measures))for(let i of $(this.measures[r]))for(let a of this.measures[r][i])n.push(a),e.push(i),t.push(r===`*`?null:TQ(r));return{type:`aggregate`,groupby:[...this.dimensions].map(TQ),ops:e,fields:t,as:n}}},i8=class extends h6{model;name;data;column;row;facet;childModel;constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(let e of J4){let n=t.facet[e];if(n){let{bin:r,sort:i}=n;this[e]={name:t.getName(`${e}_domain`),fields:[Q(n),...o$(r)?[Q(n,{binSuffix:`end`})]:[]],...R1(i)?{sortField:i}:H(i)?{sortIndexField:S2(n,e)}:{}}}}this.childModel=t.child}hash(){let e=`Facet`;for(let t of J4)this[t]&&(e+=` ${t.charAt(0)}:${rQ(this[t])}`);return e}get fields(){let e=[];for(let t of J4)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){let e=new Set(this.fields);for(let t of J4)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let e={};for(let t of Q4){let n=this.childModel.component.scales[t];if(n&&!n.merged){let r=n.get(`type`),i=n.get(`range`);if(v1(r)&&g$(i)){let n=V2(H2(this.childModel,t));n?e[t]=n:X(R$(t))}}}return e}assembleRowColumnHeaderData(e,t,n){let r={row:`y`,column:`x`,facet:void 0}[e],i=[],a=[],o=[];r&&n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),a.push(`max`)):(i.push(n[r]),a.push(`distinct`)),o.push(`distinct_${n[r]}`));let{sortField:s,sortIndexField:c}=this[e];if(s){let{op:e=V3,field:t}=s;i.push(t),a.push(e),o.push(Q(s,{forAs:!0}))}else c&&(i.push(c),a.push(`max`),o.push(c));return{name:this[e].name,source:t??this.data,transform:[{type:`aggregate`,groupby:this[e].fields,...i.length?{fields:i,ops:a,as:o}:{}}]}}assembleFacetHeaderData(e){let{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,r=[],i={};for(let e of Z6){for(let t of Q6){let r=n[e]?.[t]??[];for(let t of r)if(t.axes?.length>0){i[e]=!0;break}}if(i[e]){let n=`length(data("${this.facet.name}"))`,i=e===`row`?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};r.push({name:`${this.facet.name}_${e}`,transform:[{type:`sequence`,start:0,stop:i}]})}}let{row:a,column:o}=i;return(a||o)&&r.unshift(this.assembleRowColumnHeaderData(`facet`,null,e)),r}assemble(){let e=[],t=null,n=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:a}=this;if(r&&i&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;let r=[].concat(n.x??[],n.y??[]),i=r.map(()=>`distinct`);e.push({name:t,source:this.data,transform:[{type:`aggregate`,groupby:this.fields,fields:r,ops:i}]})}for(let r of[c4,s4])this[r]&&e.push(this.assembleRowColumnHeaderData(r,t,n));if(a){let t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}},a8=class e extends h6{_parse;clone(){return new e(null,n4(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${rQ(this._parse)}`}static makeExplicit(e,t,n){let r={},i=t.data;return!J0(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(t,n,r,i){for(let e of $(r)){let t=i.getWithExplicit(e);t.value!==void 0&&(t.explicit||t.value===r[e]||t.value===`derived`||r[e]===`flatten`?delete r[e]:X(H$(e,r[e],t.value)))}for(let e of $(n)){let t=i.get(e);t!==void 0&&(t===n[e]?delete n[e]:X(H$(e,n[e],t)))}let a=new p6(n,r);i.copyAll(a);let o={};for(let e of $(a.combine())){let t=a.get(e);t!==null&&(o[e]=t)}return $(o).length===0||i.parseNothing?null:new e(t,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){let e={};for(let t of $(this._parse)){let n=this._parse[t];OQ(t)===1&&(e[t]=n)}return e}producedFields(){return new Set($(this._parse))}dependentFields(){return new Set($(this._parse))}assembleTransforms(e=!1){return $(this._parse).filter(t=>!e||OQ(t)>1).map(e=>{let t=LPe(e,this._parse[e]);return t?{type:`formula`,expr:t,as:DQ(e)}:null}).filter(e=>e!==null)}},o8=class e extends h6{clone(){return new e(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([i6])}hash(){return`Identifier`}assemble(){return{type:`identifier`,as:i6}}},s8=class e extends h6{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${rQ(this.params)}`}assemble(){return{type:`graticule`,...this.params===!0?{}:this.params}}},c8=class e extends h6{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??`data`])}hash(){return`Hash ${rQ(this.params)}`}assemble(){return{type:`sequence`,...this.params}}},l8=class extends h6{_data;_name;_generator;constructor(e){super(null),e??={name:`source`};let t;if(J0(e)||(t=e.format?{...nQ(e.format,[`parse`])}:{}),q0(e))this._data={values:e.values};else if(K0(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];aQ([`json`,`csv`,`tsv`,`dsv`,`topojson`],n)||(n=`json`),t.type=n}}else AMe(e)?this._data={values:[{type:`Sphere`}]}:(OMe(e)||J0(e))&&(this._data={});this._generator=J0(e),e.name&&(this._name=e.name),t&&!mQ(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw Error(`Source nodes have to be roots.`)}remove(){throw Error(`Source nodes are roots and cannot be removed.`)}hash(){throw Error(`Cannot hash sources`)}assemble(){return{name:this._name,...this._data,transform:[]}}},u8=class{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}},d8=class extends u8{getNodeDepths(e,t,n){n.set(e,t);for(let r of e.children)this.getNodeDepths(r,t+1,n);return n}optimize(e){let t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(let e of t)this.run(e[0]);return this.modifiedFlag}},f8=class extends u8{optimize(e){this.run(e);for(let t of e.children)this.optimize(t);return this.modifiedFlag}},xze=class extends f8{mergeNodes(e,t){let n=t.shift();for(let r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){let t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(e,n[t]))}},Sze=class extends f8{requiresSelectionId;constructor(e){super(),this.requiresSelectionId=e&&m2(e)}run(e){e instanceof o8&&(this.requiresSelectionId&&(M2(e.parent)||e.parent instanceof r8||e.parent instanceof a8)||(this.setModified(),e.remove()))}},Cze=class extends u8{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof _6&&(n=e.producedFields(),dQ(n,t)&&(this.setModified(),e.removeFormulas(t),e.producedFields.length===0&&e.remove()));for(let r of e.children)this.run(r,new Set([...t,...n]))}},wze=class extends f8{constructor(){super()}run(e){e instanceof g6&&!e.isRequired()&&(this.setModified(),e.remove())}},Tze=class extends d8{run(e){if(!M2(e)&&!(e.numChildren()>1)){for(let t of e.children)if(t instanceof a8)if(e instanceof a8)this.setModified(),e.merge(t);else{if(pQ(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}},Eze=class extends d8{run(e){let t=[...e.children],n=e.children.filter(e=>e instanceof a8);if(e.numChildren()>1&&n.length>=1){let r={},i=new Set;for(let e of n){let t=e.parse;for(let e of $(t))e in r?r[e]!==t[e]&&i.add(e):r[e]=t[e]}for(let e of i)delete r[e];if(!mQ(r)){this.setModified();let n=new a8(e,r);for(let i of t){if(i instanceof a8)for(let e of $(r))delete i.parse[e];e.removeChild(i),i.parent=n,i instanceof a8&&$(i.parse).length===0&&i.remove()}}}}},Dze=class extends d8{run(e){e instanceof g6||e.numChildren()>0||e instanceof i8||e instanceof l8||(this.setModified(),e.remove())}},Oze=class extends d8{run(e){let t=e.children.filter(e=>e instanceof _6),n=t.pop();for(let e of t)this.setModified(),n.merge(e)}},kze=class extends d8{run(e){let t=e.children.filter(e=>e instanceof r8),n={};for(let e of t){let t=rQ(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(let t of $(n)){let r=n[t];if(r.length>1){let t=r.pop();for(let n of r)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}},Aze=class extends d8{model;constructor(e){super(),this.model=e}run(e){let t=!(M2(e)||e instanceof J6||e instanceof a8||e instanceof o8),n=[],r=[];for(let i of e.children)i instanceof n8&&(t&&!pQ(e.producedFields(),i.dependentFields())?n.push(i):r.push(i));if(n.length>0){let t=n.pop();for(let e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof n8?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(r.length>1){let e=r.pop();for(let t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}},jze=class extends d8{run(e){let t=[...e.children];if(!oQ(t,e=>e instanceof g6)||e.numChildren()<=1)return;let n=[],r;for(let i of t)if(i instanceof g6){let t=i;for(;t.numChildren()===1;){let[e]=t.children;if(e instanceof g6)t=e;else break}n.push(...t.children),r?(e.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=t,this.setModified()):r=t}else n.push(i);if(n.length){this.setModified();for(let e of n)e.parent.removeChild(e),e.parent=r}}},p8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=lQ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??Q(e)}hash(){return`JoinAggregateTransform ${rQ(this.transform)}`}assemble(){let e=[],t=[],n=[];for(let r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(r.field===void 0?null:r.field);let r=this.transform.groupby;return{type:`joinaggregate`,as:n,ops:t,fields:e,...r===void 0?{}:{groupby:r}}}},m8=class e extends h6{filter;clone(){return new e(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(t,n,r){let{config:i,markDef:a}=n,{marks:o,scales:s}=r;if(o===`include-invalid-values`&&s===`include-invalid-values`)return null;let c=n.reduceFieldDef((e,t,r)=>{let o=$Q(r)&&n.getScaleComponent(r);if(o){let n=o.get(`type`),{aggregate:s}=t,c=D1({scaleChannel:r,markDef:a,config:i,scaleType:n,isCountAggregate:i$(s)});c!==`show`&&c!==`always-valid`&&(e[t.field]=t)}return e},{});return $(c).length?new e(t,c):null}dependentFields(){return new Set($(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${rQ(this.filter)}`}assemble(){let e=$(this.filter).reduce((e,t)=>{let n=this.filter[t],r=Q(n,{expr:`datum`});return n!==null&&(n.type===`temporal`?e.push(`(isDate(${r}) || (${N2(r)}))`):n.type===`quantitative`&&e.push(N2(r))),e},[]);return e.length>0?{type:`filter`,expr:e.join(` && `)}:null}},h8=class e extends h6{_stack;clone(){return new e(null,n4(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(t,n){let{stack:r,groupby:i,as:a,offset:o=`zero`}=n,s=[],c=[];if(n.sort!==void 0)for(let e of n.sort)s.push(e.field),c.push(kQ(e.order,`ascending`));let l={field:s,order:c},u;return u=HPe(a)?a:Yh(a)?[a,`${a}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new e(t,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(t,n){let r=n.stack,{encoding:i}=n;if(!r)return null;let{groupbyChannels:a,fieldChannel:o,offset:s,impute:c}=r,l=a.map(e=>{let t=i[e];return s0(t)}).filter(e=>!!e),u=VPe(n),d=n.encoding.order,f;if(H(d)||Z(d))f=A$(d);else{let e=bAe(d)?d.sort:o===`y`?`descending`:`ascending`;f=u.reduce((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t),{field:[],order:[]})}return new e(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:u,sort:f,offset:s,impute:c,as:[n.vgField(o,{suffix:`start`,forAs:!0}),n.vgField(o,{suffix:`end`,forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){let e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${rQ(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map(e=>e.bin?t?[Q(e,{binSuffix:`mid`})]:[Q(e,{}),Q(e,{binSuffix:`end`})]:[Q(e)]).flat():n??[]}assemble(){let e=[],{facetby:t,dimensionFieldDefs:n,stackField:r,stackby:i,sort:a,offset:o,impute:s,as:c}=this._stack;if(s)for(let a of n){let{bandPosition:n=.5,bin:o}=a;if(o){let t=Q(a,{expr:`datum`}),r=Q(a,{expr:`datum`,binSuffix:`end`});e.push({type:`formula`,expr:`${N2(t)} ? ${n}*${t}+${1-n}*${r} : ${t}`,as:Q(a,{binSuffix:`mid`,forAs:!0})})}e.push({type:`impute`,field:r,groupby:[...i,...t],key:Q(a,{binSuffix:`mid`}),method:`value`,value:0})}return e.push({type:`stack`,groupby:[...this.getGroupbyFields(),...t],field:r,sort:a,as:c,offset:o}),e}},g8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=lQ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach(t=>e.add(t.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??Q(e)}hash(){return`WindowTransform ${rQ(this.transform)}`}assemble(){let e=[],t=[],n=[],r=[];for(let i of this.transform.window)t.push(i.op),n.push(this.getDefaultName(i)),r.push(i.param===void 0?null:i.param),e.push(i.field===void 0?null:i.field);let i=this.transform.frame,a=this.transform.groupby;if(i&&i[0]===null&&i[1]===null&&t.every(e=>r$(e)))return{type:`joinaggregate`,as:n,ops:t,fields:e,...a===void 0?{}:{groupby:a}};let o=[],s=[];if(this.transform.sort!==void 0)for(let e of this.transform.sort)o.push(e.field),s.push(e.order??`ascending`);let c={field:o,order:s},l=this.transform.ignorePeers;return{type:`window`,params:r,as:n,ops:t,fields:e,sort:c,...l===void 0?{}:{ignorePeers:l},...a===void 0?{}:{groupby:a},...i===void 0?{}:{frame:i}}}},_8=`scale_`,v8=5,y8=class e{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}signal;static fromName(t,n){return new e(()=>t(n))}},Mze=[`type`,`clipAngle`,`clipExtent`,`center`,`rotate`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],b8=class extends p6{specifiedProjection;size;data;merged=!1;constructor(e,t,n,r){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=r}get isFit(){return!!this.data}},x8=class extends p6{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit(`type`,t)}domainHasZero(){let e=this.get(`type`);if(aQ([b3.LOG,b3.TIME,b3.UTC],e))return`definitely-not`;let t=this.get(`zero`);if(t===!0||t===void 0&&aQ([b3.LINEAR,b3.SQRT,b3.POW],e))return`definitely`;let n=this.get(`domains`);if(n.length>0){let e=!1,t=!1,r=!1;for(let i of n){if(H(i)){let n=i[0],r=i[i.length-1];if(Kh(n)&&Kh(r))if(n<=0&&r>=0){e=!0;continue}else{t=!0;continue}}r=!0}if(e)return`definitely`;if(t&&!r)return`definitely-not`}return`maybe`}},Nze=[`range`,`scheme`],S8=.95,C8={bins:({model:e,fieldOrDatumDef:t})=>Z(t)?UFe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>WFe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>GFe(e,t,n,r,i,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>KFe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:a})=>qFe(e,t,n.type,r,i.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>JFe(e,t,n,r,i.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>YFe(t,Z(e)?e.sort:void 0,n,r.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>XFe(e,t,n,r,i,a.scale,o)},Pze=DMe((e,t)=>Bke(e)-Bke(t)),w8=class{nameMap;constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return this.nameMap[e]!==void 0}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}},T8=class{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(e,t,n,r,i,a,o){this.type=t,this.parent=n,this.config=i,this.parent=n,this.config=i,this.view=f$(o),this.name=e.name??r,this.title=m$(e.title)?{text:e.title}:e.title?f$(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new w8,this.projectionNameMap=n?n.projectionNameMap:new w8,this.signalNameMap=n?n.signalNameMap:new w8,this.data=e.data,this.description=e.description,this.transforms=hMe(e.transform??[]),this.layout=t===`layer`||t===`unit`?{}:_je(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:V1(e)||n?.component.data.isFaceted&&e.data===void 0},layoutSize:new p6,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?n4(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef(`width`)}get height(){return this.getSizeSignalRef(`height`)}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){$Fe(this)}parseProjection(){gFe(this)}renameTopLevelLayoutSizeSignal(){this.getName(`width`)!==`width`&&this.renameSignal(this.getName(`width`),`width`),this.getName(`height`)!==`height`&&this.renameSignal(this.getName(`height`),`height`)}parseLegends(){xPe(this)}assembleEncodeFromView(e){let{style:t,...n}=e,r={};for(let e of $(n)){let t=n[e];t!==void 0&&(r[e]=S$(t))}return r}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),!e&&(this.description&&(t.description=S$(this.description)),this.type===`unit`||this.type===`layer`)?{width:this.getSizeSignalRef(`width`),height:this.getSizeSignalRef(`height`),...t}:mQ(t)?void 0:t}assembleLayout(){if(!this.layout)return;let{spacing:e,...t}=this.layout,{component:n,config:r}=this,i=QNe(n.layoutHeaders,r);return{padding:e,...this.assembleDefaultLayout(),...t,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:e}=this.component,t=[];for(let n of J4)e[n].title&&t.push(GNe(this,n));for(let e of Z6)t=t.concat(JNe(this,e));return t}assembleAxes(){return ONe(this.component.axes,this.config)}assembleLegends(){return dFe(this)}assembleProjections(){return pFe(this)}assembleTitle(){let{encoding:e,...t}=this.title??{},n={...p$(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return aQ([`unit`,`layer`],this.type)?aQ([`middle`,void 0],n.anchor)&&(n.frame??=`group`):n.anchor??=`start`,mQ(n)?void 0:n}assembleGroup(e=[]){let t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);let n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let r=!this.parent||G2(this.parent)?xFe(this):[];r.length>0&&(t.scales=r);let i=this.assembleAxes();i.length>0&&(t.axes=i);let a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(e){return _Q((this.name?`${this.name}_`:``)+e)}getDataName(e){return this.getName(m6[e].toLowerCase())}requestDataName(e){let t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(G2(this.parent)){let t=XQ(nPe(e)),n=this.component.scales[t];if(n&&!n.merged){let e=n.get(`type`),r=n.get(`range`);if(v1(e)&&g$(r)){let e=n.get(`name`),r=V2(H2(this,t));return r?{signal:tPe(e,n,Q({aggregate:`distinct`,field:r},{expr:`datum`}))}:(X(R$(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){let t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){if(t)return this.getName(e);if(VQ(e)&&$Q(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e)))return this.scaleNameMap.get(this.getName(e))}projectionName(e){if(e)return this.getName(`projection`);if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName(`projection`)))return this.projectionNameMap.get(this.getName(`projection`))}getScaleComponent(e){if(!this.component.scales)throw Error(`getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().`);let t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){let t=this.getScaleComponent(e);return t?t.get(`type`):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw Error(SOe(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some(e=>e.hasOrientSignalRef())||this.component.axes.y?.some(e=>e.hasOrientSignalRef())}},E8=class extends T8{vgField(e,t={}){let n=this.fieldDef(e);if(n)return Q(n,t)}reduceFieldDef(e,t){return qAe(this.getMapping(),(t,n,r)=>{let i=s0(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){y0(this.getMapping(),(t,n)=>{let r=s0(t);r&&e(r,n)},t)}},D8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`value`,n[1]??`density`];let r=this.transform.resolve??`shared`;this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${rQ(this.transform)}`}assemble(){let{density:e,...t}=this.transform,n={type:`kde`,field:e,...t};return n.resolve=this.transform.resolve,n}},O8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${rQ(this.transform)}`}assemble(){let{extent:e,param:t}=this.transform;return{type:`extent`,field:e,signal:t}}},k8=class e extends h6{transform;clone(){return new e(this.parent,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>r[t]??e)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${rQ(this.transform)}`}assemble(){let{flatten:e,as:t}=this.transform;return{type:`flatten`,fields:e,as:t}}},A8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`key`,n[1]??`value`]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${rQ(this.transform)}`}assemble(){let{fold:e,as:t}=this.transform;return{type:`fold`,fields:e,as:t}}},j8=class e extends h6{fields;geojson;signal;clone(){return new e(null,n4(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let r=0;for(let i of[[x4,b4],[C4,S4]]){let a=i.map(e=>{let t=c0(n.encoding[e]);return Z(t)?t.field:J1(t)?{expr:`${t.datum}`}:$1(t)?{expr:`${t.value}`}:void 0});(a[0]||a[1])&&(t=new e(t,a,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(O4)){let i=n.typedFieldDef(O4);i.type===y3&&(t=new e(t,null,i.field,n.getName(`geojson_${r}`)))}return t}constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}dependentFields(){let e=(this.fields??[]).filter(Yh);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${rQ(this.fields)}`}assemble(){return[...this.geojson?[{type:`filter`,expr:`isValid(datum["${this.geojson}"])`}]:[],{type:`geojson`,...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}},M8=class e extends h6{projection;fields;as;clone(){return new e(null,this.projection,n4(this.fields),n4(this.as))}constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(let r of[[x4,b4],[C4,S4]]){let i=r.map(e=>{let t=c0(n.encoding[e]);return Z(t)?t.field:J1(t)?{expr:`${t.datum}`}:$1(t)?{expr:`${t.value}`}:void 0}),a=r[0]===C4?`2`:``;(i[0]||i[1])&&(t=new e(t,n.projectionName(),i,[n.getName(`x${a}`),n.getName(`y${a}`)]))}return t}dependentFields(){return new Set(this.fields.filter(Yh))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${rQ(this.fields)} ${rQ(this.as)}`}assemble(){return{type:`geopoint`,projection:this.projection,fields:this.fields,as:this.as}}},N8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){let{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(`,`)})`}}static makeFromTransform(t,n){return new e(t,n)}static makeFromEncoding(t,n){let r=n.encoding,i=r.x,a=r.y;if(Z(i)&&Z(a)){let o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;let s=i.impute?a:a.impute?i:void 0,{method:c,value:l,frame:u,keyvals:d}=o.impute,f=JAe(n.mark,r);return new e(t,{impute:o.field,key:s.field,...c?{method:c}:{},...l===void 0?{}:{value:l},...u?{frame:u}:{},...d===void 0?{}:{keyvals:d},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${rQ(this.transform)}`}assemble(){let{impute:e,key:t,keyvals:n,method:r,groupby:i,value:a,frame:o=[null,null]}=this.transform,s={type:`impute`,field:e,key:t,...n?{keyvals:Jje(n)?this.processSequence(n):n}:{},method:`value`,...i?{groupby:i}:{},value:!r||r===`value`?a:null};return r&&r!==`value`?[s,{type:`window`,as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:o,ignorePeers:!1,...i?{groupby:i}:{}},{type:`formula`,expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}},P8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${rQ(this.transform)}`}assemble(){let{loess:e,on:t,...n}=this.transform;return{type:`loess`,x:t,y:e,...n}}},F8=class e extends h6{transform;secondary;clone(){return new e(null,n4(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(t,n,r,i){let a=n.component.data.sources,{from:o}=r,s=null;if(Xje(o)){let e=gIe(o.data,a);e||(e=new l8(o.data),a.push(e));let t=n.getName(`lookup_${i}`);s=new g6(e,t,m6.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[t]=s}else if(Zje(o)){let e=o.param;r={as:e,...r};let t;try{t=n.getSelectionComponent(_Q(e),e)}catch{throw Error(COe(e))}if(s=t.materialized,!s)throw Error(wOe(e))}return new e(t,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?yh(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${rQ({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:yh(this.transform.as)}:{}};else{let t=this.transform.as;Yh(t)||(X(KLe),t=`_lookup`),e={as:[t]}}return{type:`lookup`,from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}},I8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`prob`,n[1]??`value`]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${rQ(this.transform)}`}assemble(){let{quantile:e,...t}=this.transform;return{type:`quantile`,field:e,...t}}},L8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=n4(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${rQ(this.transform)}`}assemble(){let{regression:e,on:t,...n}=this.transform;return{type:`regression`,x:t,y:e,...n}}},R8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=lQ((this.transform.groupby??[]).concat(e),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${rQ(this.transform)}`}assemble(){let{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return{type:`pivot`,field:e,value:t,...r===void 0?{}:{limit:r},...i===void 0?{}:{op:i},...n===void 0?{}:{groupby:n}}}},z8=class e extends h6{transform;clone(){return new e(null,n4(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${rQ(this.transform)}`}assemble(){return{type:`sample`,size:this.transform.sample}}},Fze=class e extends E8{facet;child;children;constructor(e,t,n,r){super(e,`facet`,t,n,r,e.resolve),this.child=t4(e.spec,this,this.getName(`child`),void 0,r),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!z1(e))return{facet:this.initFacetFieldDef(e,`facet`)};let t=$(e),n={};for(let r of t){if(![s4,c4].includes(r)){X(q$(r,`facet`));break}let t=e[r];if(t.field===void 0){X(K$(t,r));break}n[r]=this.initFacetFieldDef(t,r)}return n}initFacetFieldDef(e,t){let n=u0(e,t);return n.header?n.header=f$(n.header):n.header===null&&(n.header=null),n}channelHasField(e){return Y(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=Z2(this),this.child.parseData()}parseLayoutSize(){J2(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,r4(this.component.selection).some(e=>h2(e))&&e1(o3)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),sIe(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){let e={};for(let t of J4)for(let n of Q6){let r=this.component.layoutHeaders[t],i=r[n],{facetFieldDef:a}=r;if(a){let n=w2(`titleOrient`,a.header,this.config,t);if([`right`,`bottom`].includes(n)){let r=C2(t,n);e.titleAnchor??={},e.titleAnchor[r]=`end`}}if(i?.[0]){let i=t===`row`?`height`:`width`,a=n===`header`?`headerBand`:`footerBand`;t!==`facet`&&!this.child.component.layoutSize.get(i)&&(e[a]??={},e[a][t]=.5),r.title&&(e.offset??={},e.offset[t===`row`?`rowTitle`:`columnTitle`]=10)}}return e}assembleDefaultLayout(){let{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0,r=`all`;return(!t&&this.component.resolve.scale.x===`independent`||!e&&this.component.resolve.scale.y===`independent`)&&(r=`none`),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:`full`,align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof e))return{signal:`length(data('${this.getName(`column_domain`)}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof e?{...this.channelHasField(`column`)?{encode:{update:{columns:{field:Q(this.facet.column,{prefix:`distinct`})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){let t=[],n=[],r=[];if(this.child instanceof e){if(this.child.channelHasField(`column`)){let e=Q(this.child.facet.column);t.push(e),n.push(`distinct`),r.push(`distinct_${e}`)}}else for(let e of Q4){let i=this.child.component.scales[e];if(i&&!i.merged){let a=i.get(`type`),o=i.get(`range`);if(v1(a)&&g$(o)){let i=V2(H2(this.child,e));i?(t.push(i),n.push(`distinct`),r.push(`distinct_${i}`)):X(R$(e))}}}return{fields:t,ops:n,as:r}}assembleFacet(){let{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:a,as:o}=this.getCardinalityAggregateForChild(),s=[];for(let e of J4){let t=this.facet[e];if(t){s.push(Q(t));let{bin:c,sort:l}=t;if(o$(c)&&s.push(Q(t,{binSuffix:`end`})),R1(l)){let{field:e,op:s=V3}=l,c=X2(t,l);n&&r?(i.push(c),a.push(`max`),o.push(c)):(i.push(e),a.push(s),o.push(c))}else if(H(l)){let n=S2(t,e);i.push(n),a.push(`max`),o.push(n)}}}let c=!!n&&!!r;return{name:e,data:t,groupby:s,...c||i.length>0?{aggregate:{...c?{cross:c}:{},...i.length?{fields:i,ops:a,as:o}:{}}}:{}}}facetSortFields(e){let{facet:t}=this,n=t[e];return n?R1(n.sort)?[X2(n,n.sort,{expr:`datum`})]:H(n.sort)?[S2(n,e,{expr:`datum`})]:[Q(n,{expr:`datum`})]:[]}facetSortOrder(e){let{facet:t}=this,n=t[e];if(n){let{sort:e}=n;return[(R1(e)?e.order:!H(e)&&e)||`ascending`]}return[]}assembleLabelTitle(){let{facet:e,config:t}=this;if(e.facet)return E2(e.facet,`facet`,t);let n={row:[`top`,`bottom`],column:[`left`,`right`]};for(let r of Z6)if(e[r]){let i=w2(`labelOrient`,e[r]?.header,t,r);if(n[r].includes(i))return E2(e[r],r,t)}}assembleMarks(){let{child:e}=this,t=this.component.data.facetRoot,n=iIe(t),r=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),a=e.assembleGroupStyle();return[{name:this.getName(`cell`),type:`group`,...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:J4.map(e=>this.facetSortFields(e)).flat(),order:J4.map(e=>this.facetSortOrder(e)).flat()},...n.length>0?{data:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup(zMe(this,[]))}]}getMapping(){return this.facet}},Ize=class extends T8{children;constructor(e,t,n,r){super(e,`concat`,t,n,r,e.resolve),(e.resolve?.axis?.x===`shared`||e.resolve?.axis?.y===`shared`)&&X(WLe),this.children=this.getChildren(e).map((e,t)=>t4(e,this,this.getName(`concat_${t}`),void 0,r))}parseData(){this.component.data=Z2(this);for(let e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}r4(this.component.selection).some(e=>h2(e))&&e1(o3)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(let e of this.children)e.parseAxesAndHeaders()}getChildren(e){return k0(e)?e.vconcat:A0(e)?e.hconcat:e.concat}parseLayoutSize(){fIe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){let e=D2(this);for(let t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{let t=e.assembleTitle(),n=e.assembleGroupStyle(),r=e.assembleGroupEncodeEntry(!1);return{type:`group`,name:e.getName(`group`),...t?{title:t}:{},...n?{style:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){let e=this.layout.columns;return{...e==null?{}:{columns:e},bounds:`full`,align:`each`}}},B8=$({disable:1,gridScale:1,scale:1,...q3,labelExpr:1,encode:1}),Lze=class e extends p6{explicit;implicit;mainExtracted;constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new e(n4(this.explicit),n4(this.implicit),this.mainExtracted)}hasAxisPart(e){return e===`axis`?!0:e===`grid`||e===`title`?!!this.get(e):!yIe(this.get(e))}hasOrientSignalRef(){return h$(this.explicit.orient)}},Rze={bottom:`top`,top:`bottom`,left:`right`,right:`left`},zze=new Set([`grid`,`translate`,`format`,`formatType`,`orient`,`labelExpr`,`tickCount`,`position`,`tickMinStep`]),Bze={vgMark:`arc`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...o2(`x`,e,{defaultPos:`mid`}),...o2(`y`,e,{defaultPos:`mid`}),...u2(e,`radius`),...u2(e,`theta`)})},Vze={vgMark:`area`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`include`,size:`ignore`,theta:`ignore`}),...c2(`x`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`horizontal`}),...c2(`y`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`vertical`}),...f2(e)})},Hze={vgMark:`rect`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...u2(e,`x`),...u2(e,`y`)})},Uze={vgMark:`shape`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`})}),postEncodingTransform:e=>{let{encoding:t}=e,n=t.shape;return[{type:`geoshape`,projection:e.projectionName(),...n&&Z(n)&&n.type===y3?{field:Q(n,{expr:`datum`})}:{}}]}},Wze={vgMark:`image`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`ignore`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...u2(e,`x`),...u2(e,`y`),...n2(e,`url`)})},Gze={vgMark:`line`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...o2(`x`,e,{defaultPos:`mid`}),...o2(`y`,e,{defaultPos:`mid`}),...i2(`size`,e,{vgChannel:`strokeWidth`}),...f2(e)})},Kze={vgMark:`trail`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...o2(`x`,e,{defaultPos:`mid`}),...o2(`y`,e,{defaultPos:`mid`}),...i2(`size`,e),...f2(e)})},qze={vgMark:`symbol`,encodeEntry:e=>$2(e)},Jze={vgMark:`symbol`,encodeEntry:e=>$2(e,`circle`)},Yze={vgMark:`symbol`,encodeEntry:e=>$2(e,`square`)},Xze={vgMark:`rect`,encodeEntry:e=>({...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...u2(e,`x`),...u2(e,`y`)})},Zze={vgMark:`rule`,encodeEntry:e=>{let{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...c2(`x`,e,{defaultPos:n===`horizontal`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`vertical`}),...c2(`y`,e,{defaultPos:n===`vertical`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`horizontal`}),...i2(`size`,e,{vgChannel:`strokeWidth`})}}},Qze={vgMark:`text`,encodeEntry:e=>{let{config:t,encoding:n}=e;return{...d2(e,{align:`include`,baseline:`include`,color:`include`,size:`ignore`,orient:`ignore`,theta:`include`}),...o2(`x`,e,{defaultPos:`mid`}),...o2(`y`,e,{defaultPos:`mid`}),...n2(e),...i2(`size`,e,{vgChannel:`fontSize`}),...i2(`angle`,e),...mNe(`align`,kIe(e.markDef,n,t)),...mNe(`baseline`,AIe(e.markDef,n,t)),...o2(`radius`,e,{defaultPos:null}),...o2(`theta`,e,{defaultPos:null})}}},V8={arc:Bze,area:Vze,bar:Hze,circle:Jze,geoshape:Uze,image:Wze,line:Gze,point:qze,rect:Xze,rule:Zze,square:Yze,text:Qze,tick:{vgMark:`rect`,encodeEntry:e=>{let{config:t,markDef:n}=e,r=n.orient,i=r===`horizontal`?`x`:`y`,a=r===`horizontal`?`y`:`x`,o=r===`horizontal`?`height`:`width`;return{...d2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...u2(e,i),...o2(a,e,{defaultPos:`mid`,vgChannel:a===`y`?`yc`:`xc`}),[o]:S$(E$(`thickness`,n,t))}}},trail:Kze},H8=`faceted_path_`,U8=`stack_group_`,W8=class extends E8{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,t,n,r={},i){super(e,`unit`,t,n,i,void 0,gje(e)?e.view:void 0);let a=T1(e.mark)?{...e.mark}:{type:e.mark},o=a.type;a.filled===void 0&&(a.filled=Ije(a,i,{graticule:e.data&&Y0(e.data)}));let s=this.encoding=GAe(e.encoding||{},o,a.filled,i);this.markDef=Nje(a,s,i),this.size=DIe({encoding:s,size:gje(e)?{...r,...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}:r}),this.stack=Mje(this.markDef,s),this.specifiedScales=this.initScales(o,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter(e=>D0(e)),this.alignStackOrderWithColorDomain()}get hasProjection(){let{encoding:e}=this,t=this.mark===I3,n=e&&UIe.some(t=>Z1(e[t]));return t||n}scaleDomain(e){let t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return r3.reduce((e,n)=>{let r=c0(t[n]);return r&&(e[n]=this.initScale(r.scale??{})),e},{})}initScale(e){let{domain:t,range:n}=e,r=f$(e);return H(t)&&(r.domain=t.map(b$)),H(n)&&(r.range=n.map(b$)),r}initAxes(e){return Q4.reduce((t,n)=>{let r=e[n];if(Z1(r)||n===u4&&Z1(e.x2)||n===d4&&Z1(e.y2)){let e=Z1(r)?r.axis:void 0;t[n]=e&&this.initAxis({...e})}return t},{})}initAxis(e){let t=$(e),n={};for(let r of t){let t=e[r];n[r]=h0(t)?y$(t):b$(t)}return n}initLegends(e){return ELe.reduce((t,n)=>{let r=c0(e[n]);if(r&&pOe(n)){let e=r.legend;t[n]=e&&f$(e)}return t},{})}alignStackOrderWithColorDomain(){let{color:e,fill:t,order:n,xOffset:r,yOffset:i}=this.encoding,a=t||e,o=Z(a)?a:void 0,s=o?.field,c=o?.scale,l=o?.type,u=c?.domain,d=r||i,f=Z(d)?d:void 0,p=`_${s}_sort_index`;if(!n&&Array.isArray(u)&&typeof s==`string`&&l===`nominal`)if(f&&!f.sort)f.sort=u;else{if(!this.stack)return;let e=`indexof(${W(u)}, datum['${s}'])`,t=this.markDef?.orient===`horizontal`?`ascending`:`descending`;this.transforms.push({calculate:e,as:p}),this.encoding.order={field:p,type:`quantitative`,sort:t}}}parseData(){this.component.data=Z2(this)}parseLayoutSize(){pIe(this)}parseSelections(){this.component.selection=SNe(this,this.selection)}parseMarkGroup(){this.component.mark=jIe(this)}parseAxesAndHeaders(){this.component.axes=xIe(this)}assembleSelectionTopLevelSignals(e){return BMe(this,e)}assembleSignals(){return[...DNe(this),...RMe(this,[])]}assembleSelectionData(e){return VMe(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return D2(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),`time`in this.encoding&&(e.from.data=e.from.data+x6)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return(!this.parent||!q2(this.parent))&&(e=HMe(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){let{style:e}=this.view||{};return e===void 0?this.encoding.x||this.encoding.y?`cell`:`view`:e}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return _0(this.encoding,e)}fieldDef(e){let t=this.encoding[e];return s0(t)}typedFieldDef(e){let t=this.fieldDef(e);return Q1(t)?t:null}},$ze=class e extends T8{children;constructor(t,n,r,i,a){super(t,`layer`,n,r,a,t.resolve,t.view);let o={...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((t,n)=>{if(F0(t))return new e(t,this,this.getName(`layer_${n}`),o,a);if(g0(t))return new W8(t,this,this.getName(`layer_${n}`),o,a);throw Error(P$(t))})}parseData(){this.component.data=Z2(this);for(let e of this.children)e.parseData()}parseLayoutSize(){dIe(this)}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}r4(this.component.selection).some(e=>h2(e))&&e1(o3)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){SIe(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),DNe(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),D2(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleGroupStyle(){let e=new Set;for(let t of this.children)for(let n of yh(t.assembleGroupStyle()))e.add(n);let t=Array.from(e);return t.length>1?t:t.length===1?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(let t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return UMe(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),dFe(this))}},eBe=VIe.version}));function nBe(e){let[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var rBe=o((()=>{})),iBe=c({carbong10:()=>LBe,carbong100:()=>zBe,carbong90:()=>RBe,carbonwhite:()=>IBe,dark:()=>oBe,excel:()=>sBe,fivethirtyeight:()=>uBe,ggplot2:()=>dBe,googlecharts:()=>CBe,latimes:()=>hBe,powerbi:()=>MBe,quartz:()=>gBe,urbaninstitute:()=>SBe,version:()=>BBe,vox:()=>_Be});function G8({theme:e,background:t}){let n=[`white`,`g10`].includes(e)?`light`:`dark`,r=N5.gridBg[e],i=N5.textPrimary[e],a=N5.textSecondary[e],o=n===`dark`?PBe:FBe,s=n===`dark`?`#d4bbff`:`#6929c4`;return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:`start`,dy:-15,fontSize:16,font:j5,fontWeight:600},axis:{labelColor:a,labelFontSize:12,labelFont:NBe,labelFontWeight:M5,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:N5.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:j5,fill:a,fontWeight:M5},"guide-title":{font:j5,fill:a,fontWeight:M5}},range:{category:o,diverging:[`#750e13`,`#a2191f`,`#da1e28`,`#fa4d56`,`#ff8389`,`#ffb3b8`,`#ffd7d9`,`#fff1f1`,`#e5f6ff`,`#bae6ff`,`#82cfff`,`#33b1ff`,`#1192e8`,`#0072c3`,`#00539a`,`#003a6d`],heatmap:[`#f6f2ff`,`#e8daff`,`#d4bbff`,`#be95ff`,`#a56eff`,`#8a3ffc`,`#6929c4`,`#491d8b`,`#31135e`,`#1c0f30`]}}}var aBe,K8,q8,oBe,J8,sBe,Y8,X8,cBe,lBe,Z8,Q8,uBe,$8,dBe,fBe,pBe,e5,t5,mBe,n5,r5,i5,a5,o5,hBe,s5,c5,gBe,l5,_Be,u5,d5,vBe,f5,p5,yBe,bBe,xBe,m5,SBe,h5,g5,_5,CBe,v5,y5,b5,x5,S5,C5,w5,T5,E5,wBe,D5,TBe,EBe,DBe,OBe,kBe,ABe,jBe,O5,k5,A5,MBe,j5,NBe,M5,N5,PBe,FBe,IBe,LBe,RBe,zBe,BBe,VBe=o((()=>{aBe={version:`3.0.0`},K8=`#fff`,q8=`#888`,oBe={background:`#333`,view:{stroke:q8},title:{color:K8,subtitleColor:K8},style:{"guide-label":{fill:K8},"guide-title":{fill:K8}},axis:{domainColor:K8,gridColor:q8,tickColor:K8}},J8=`#4572a7`,sBe={background:`#fff`,arc:{fill:J8},area:{fill:J8},line:{stroke:J8,strokeWidth:2},path:{stroke:J8},rect:{fill:J8},shape:{stroke:J8},symbol:{fill:J8,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:`#000000`,gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:50,symbolType:`square`},range:{category:[`#4572a7`,`#aa4643`,`#8aa453`,`#71598e`,`#4598ae`,`#d98445`,`#94aace`,`#d09393`,`#b9cc98`,`#a99cbc`]}},Y8=`#30a2da`,X8=`#cbcbcb`,cBe=`#999`,lBe=`#333`,Z8=`#f0f0f0`,Q8=`#333`,uBe={arc:{fill:Y8},area:{fill:Y8},axis:{domainColor:X8,grid:!0,gridColor:X8,gridWidth:1,labelColor:cBe,labelFontSize:10,titleColor:lBe,tickColor:X8,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:Z8,group:{fill:Z8},legend:{labelColor:Q8,labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`,titleColor:Q8,titleFontSize:14,titlePadding:10},line:{stroke:Y8,strokeWidth:2},path:{stroke:Y8,strokeWidth:.5},rect:{fill:Y8},range:{category:[`#30a2da`,`#fc4f30`,`#e5ae38`,`#6d904f`,`#8b8b8b`,`#b96db8`,`#ff9e27`,`#56cc60`,`#52d2ca`,`#52689e`,`#545454`,`#9fe4f8`],diverging:[`#cc0020`,`#e77866`,`#f6e7e1`,`#d6e8ed`,`#91bfd9`,`#1d78b5`],heatmap:[`#d6e8ed`,`#cee0e5`,`#91bfd9`,`#549cc6`,`#1d78b5`]},point:{filled:!0,shape:`circle`},shape:{stroke:Y8},bar:{binSpacing:2,fill:Y8,stroke:null},title:{anchor:`start`,fontSize:24,fontWeight:600,offset:20}},$8=`#000`,dBe={group:{fill:`#e5e5e5`},arc:{fill:$8},area:{fill:$8},line:{stroke:$8},path:{stroke:$8},rect:{fill:$8},shape:{stroke:$8},symbol:{fill:$8,size:40},axis:{domain:!1,grid:!0,gridColor:`#FFFFFF`,gridOpacity:1,labelColor:`#7F7F7F`,labelPadding:4,tickColor:`#7F7F7F`,tickSize:5.67,titleFontSize:16,titleFontWeight:`normal`},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:40},range:{category:[`#000000`,`#7F7F7F`,`#1A1A1A`,`#999999`,`#333333`,`#B0B0B0`,`#4D4D4D`,`#C9C9C9`,`#666666`,`#DCDCDC`]}},fBe=22,pBe=`normal`,e5=`Benton Gothic, sans-serif`,t5=11.5,mBe=`normal`,n5=`#82c6df`,r5=`Benton Gothic Bold, sans-serif`,i5=`normal`,a5=13,o5={"category-6":[`#ec8431`,`#829eb1`,`#c89d29`,`#3580b1`,`#adc839`,`#ab7fb4`],"fire-7":[`#fbf2c7`,`#f9e39c`,`#f8d36e`,`#f4bb6a`,`#e68a4f`,`#d15a40`,`#ab4232`],"fireandice-6":[`#e68a4f`,`#f4bb6a`,`#f9e39c`,`#dadfe2`,`#a6b7c6`,`#849eae`]},hBe={background:`#ffffff`,title:{anchor:`start`,color:`#000000`,font:r5,fontSize:fBe,fontWeight:pBe},arc:{fill:n5},area:{fill:n5},line:{stroke:n5,strokeWidth:2},path:{stroke:n5},rect:{fill:n5},shape:{stroke:n5},symbol:{fill:n5,size:30},axis:{labelFont:e5,labelFontSize:t5,labelFontWeight:mBe,titleFont:r5,titleFontSize:a5,titleFontWeight:i5},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:`middle`,maxExtent:45,minExtent:45,tickSize:2,titleAlign:`left`,titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:e5,labelFontSize:t5,symbolType:`square`,titleFont:r5,titleFontSize:a5,titleFontWeight:i5},range:{category:o5[`category-6`],diverging:o5[`fireandice-6`],heatmap:o5[`fire-7`],ordinal:o5[`fire-7`],ramp:o5[`fire-7`]}},s5=`#ab5787`,c5=`#979797`,gBe={background:`#f9f9f9`,arc:{fill:s5},area:{fill:s5},line:{stroke:s5},path:{stroke:s5},rect:{fill:s5},shape:{stroke:s5},symbol:{fill:s5,size:30},axis:{domainColor:c5,domainWidth:.5,gridWidth:.2,labelColor:c5,tickColor:c5,tickWidth:.2,titleColor:c5},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`},range:{category:[`#ab5787`,`#51b2e5`,`#703c5c`,`#168dd9`,`#d190b6`,`#00609f`,`#d365ba`,`#154866`,`#666666`,`#c4c4c4`]}},l5=`#3e5c69`,_Be={background:`#fff`,arc:{fill:l5},area:{fill:l5},line:{stroke:l5},path:{stroke:l5},rect:{fill:l5},shape:{stroke:l5},symbol:{fill:l5},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:`normal`},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:`square`},range:{category:[`#3e5c69`,`#6793a6`,`#182429`,`#0570b0`,`#3690c0`,`#74a9cf`,`#a6bddb`,`#e2ddf2`]}},u5=`#1696d2`,d5=`#000000`,vBe=`#FFFFFF`,f5=`Lato`,p5=`Lato`,yBe=`Lato`,bBe=`#DEDDDD`,xBe=18,m5={"shades-blue":[`#CFE8F3`,`#A2D4EC`,`#73BFE2`,`#46ABDB`,`#1696D2`,`#12719E`,`#0A4C6A`,`#062635`],"six-groups-cat-1":[`#1696d2`,`#ec008b`,`#fdbf11`,`#000000`,`#d2d2d2`,`#55b748`],"six-groups-seq":[`#cfe8f3`,`#a2d4ec`,`#73bfe2`,`#46abdb`,`#1696d2`,`#12719e`],"diverging-colors":[`#ca5800`,`#fdbf11`,`#fdd870`,`#fff2cf`,`#cfe8f3`,`#73bfe2`,`#1696d2`,`#0a4c6a`]},SBe={background:vBe,title:{anchor:`start`,fontSize:xBe,font:f5},axisX:{domain:!0,domainColor:d5,domainWidth:1,grid:!1,labelFontSize:12,labelFont:p5,labelAngle:0,tickColor:d5,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:f5},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:bBe,gridWidth:1,labelFontSize:12,labelFont:p5,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:f5,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:p5,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:f5,orient:`right`,offset:10},view:{stroke:`transparent`},range:{category:m5[`six-groups-cat-1`],diverging:m5[`diverging-colors`],heatmap:m5[`diverging-colors`],ordinal:m5[`six-groups-seq`],ramp:m5[`shades-blue`]},area:{fill:u5},rect:{fill:u5},line:{color:u5,stroke:u5,strokeWidth:5},trail:{color:u5,stroke:u5,strokeWidth:0,size:1},path:{stroke:u5,strokeWidth:.5},point:{filled:!0},text:{font:yBe,color:u5,fontSize:11,align:`center`,fontWeight:400,size:11},style:{bar:{fill:u5,stroke:null}},arc:{fill:u5},shape:{stroke:u5},symbol:{fill:u5,size:30}},h5=`#3366CC`,g5=`#ccc`,_5=`Arial, sans-serif`,CBe={arc:{fill:h5},area:{fill:h5},path:{stroke:h5},rect:{fill:h5},shape:{stroke:h5},symbol:{stroke:h5},circle:{fill:h5},background:`#fff`,padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:_5,fontSize:12},"guide-title":{font:_5,fontSize:12},"group-title":{font:_5,fontSize:12}},title:{font:_5,fontSize:14,fontWeight:`bold`,dy:-3,anchor:`start`},axis:{gridColor:g5,tickColor:g5,domain:!1,grid:!0},range:{category:[`#4285F4`,`#DB4437`,`#F4B400`,`#0F9D58`,`#AB47BC`,`#00ACC1`,`#FF7043`,`#9E9D24`,`#5C6BC0`,`#F06292`,`#00796B`,`#C2185B`],heatmap:[`#c6dafc`,`#5e97f6`,`#2a56c6`]}},v5=e=>e*1.3333333333333333,y5=v5(9),b5=v5(10),x5=v5(12),S5=`Segoe UI`,C5=`wf_standard-font, helvetica, arial, sans-serif`,w5=`#252423`,T5=`#605E5C`,E5=`transparent`,wBe=`#C8C6C4`,D5=`#118DFF`,TBe=`#12239E`,EBe=`#E66C37`,DBe=`#6B007B`,OBe=`#E044A7`,kBe=`#744EC2`,ABe=`#D9B300`,jBe=`#D64550`,O5=D5,k5=`#DEEFFF`,A5=[k5,O5],MBe={view:{stroke:E5},background:E5,font:S5,header:{titleFont:C5,titleFontSize:x5,titleColor:w5,labelFont:S5,labelFontSize:b5,labelColor:T5},axis:{ticks:!1,grid:!1,domain:!1,labelColor:T5,labelFontSize:y5,titleFont:C5,titleColor:w5,titleFontSize:x5,titleFontWeight:`normal`},axisQuantitative:{tickCount:3,grid:!0,gridColor:wBe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:D5},line:{stroke:D5,strokeWidth:3,strokeCap:`round`,strokeJoin:`round`},text:{font:S5,fontSize:y5,fill:T5},arc:{fill:D5},area:{fill:D5,line:!0,opacity:.6},path:{stroke:D5},rect:{fill:D5},point:{fill:D5,filled:!0,size:75},shape:{stroke:D5},symbol:{fill:D5,strokeWidth:1.5,size:50},legend:{titleFont:S5,titleFontWeight:`bold`,titleColor:T5,labelFont:S5,labelFontSize:b5,labelColor:T5,symbolType:`circle`,symbolSize:75},range:{category:[D5,TBe,EBe,DBe,OBe,kBe,ABe,jBe],diverging:A5,heatmap:A5,ordinal:[k5,`#c7e4ff`,`#b0d9ff`,`#9aceff`,`#83c3ff`,`#6cb9ff`,`#55aeff`,`#3fa3ff`,`#2898ff`,O5]}},j5=`IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif`,NBe=`IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif`,M5=400,N5={textPrimary:{g90:`#f4f4f4`,g100:`#f4f4f4`,white:`#161616`,g10:`#161616`},textSecondary:{g90:`#c6c6c6`,g100:`#c6c6c6`,white:`#525252`,g10:`#525252`},layerAccent01:{white:`#e0e0e0`,g10:`#e0e0e0`,g90:`#525252`,g100:`#393939`},gridBg:{white:`#ffffff`,g10:`#ffffff`,g90:`#161616`,g100:`#161616`}},PBe=[`#8a3ffc`,`#33b1ff`,`#007d79`,`#ff7eb6`,`#fa4d56`,`#fff1f1`,`#6fdc8c`,`#4589ff`,`#d12771`,`#d2a106`,`#08bdba`,`#bae6ff`,`#ba4e00`,`#d4bbff`],FBe=[`#6929c4`,`#1192e8`,`#005d5d`,`#9f1853`,`#fa4d56`,`#570408`,`#198038`,`#002d9c`,`#ee538b`,`#b28600`,`#009d9a`,`#012749`,`#8a3800`,`#a56eff`],IBe=G8({theme:`white`,background:`#ffffff`}),LBe=G8({theme:`g10`,background:`#f4f4f4`}),RBe=G8({theme:`g90`,background:`#262626`}),zBe=G8({theme:`g100`,background:`#161616`}),BBe=aBe.version}));function HBe(e,t,n,r){if(H(e))return`[${e.map(e=>t(Yh(e)?e:WBe(e,n))).join(`, `)}]`;if(Wm(e)){let i=``,{title:a,image:o,...s}=e;a&&(i+=`

${t(a)}

`),o&&(i+=``);let c=Object.keys(s);if(c.length>0){i+=``;for(let e of c){let r=s[e];r!==void 0&&(Wm(r)&&(r=WBe(r,n)),i+=``)}i+=`
${t(e)}${t(r)}
`}return i||`{}`}return t(e)}function UBe(e){let t=[];return function(n,r){if(typeof r!=`object`||!r)return r;let i=t.indexOf(this)+1;return t.length=i,t.length>e?`[Object]`:t.indexOf(r)>=0?`[Circular]`:(t.push(r),r)}}function WBe(e,t){return JSON.stringify(e,UBe(t))}function GBe(e){return String(e).replace(/&/g,`&`).replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function QBe(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}var $Be,eVe,P5,tVe,nVe,rVe=o((()=>{pg(),$Be={version:`1.0.0`},eVe=`#vg-tooltip-element { + : v !== v && u === u ? ${r} : `}function uTe(e){let t=this;sTe(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function dTe(e){let t=this;if(e.params){let n=t.get(e.id);n||V(`Invalid operator id: `+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function fTe(e,t){t||={};let n=this;for(let r in e){let i=e[r];t[r]=H(i)?i.map(e=>rG(e,n,t)):rG(i,n,t)}return t}function rG(e,t,n){if(!e||!Dh(e))return e;for(let r=0,i=uG.length,a;re&&e.$tupleid?ix:e);return t.fn[n]||(t.fn[n]=sg(r,e.$order,t.expr.codegen))}function vTe(e,t){let n=e.$encode,r={};for(let e in n){let i=n[e];r[e]=ah(t.encodeExpression(i.$expr),i.$fields),r[e].output=i.$output}return r}function yTe(e,t){return t}function bTe(e,t){let n=e.$subflow;return function(e,r,i){let a=t.fork().parse(n),o=a.get(n.operators[0].id),s=a.signals.parent;return s&&s.set(i),o.detachSubflow=()=>t.detach(a),o}}function xTe(){return ix}function STe(e){var t=this,n=e.filter==null?void 0:t.eventExpression(e.filter),r=e.stream==null?void 0:t.get(e.stream),i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(e=>t.get(e)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(e=>t.get(e)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r??V(`Invalid stream definition: `+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function CTe(e){var t=this,n=Dh(n=e.source)?n.$ref:n,r=t.get(n),i=null,a=e.update,o=void 0;r||V(`Source not defined: `+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),a&&a.$expr&&(a.$params&&(o=t.parseParameters(a.$params)),a=t.handlerExpression(a.$expr)),t.update(e,r,i,a,o)}function wTe(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(n=>{let i=t.signals[n];e.signals(n,i)&&(r[n]=i.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(n=>{let r=t.data[n];e.data(n,r)&&(i[n]=r.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(t=>t.getState(e))),n}function TTe(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(e=>{n.update(t.signals[e],i[e],dG)}),Object.keys(r||{}).forEach(e=>{n.pulse(t.data[e].input,n.changeset().remove(Sh).insert(r[e]))}),(e.subcontext||[]).forEach((e,n)=>{let r=t.subcontext[n];r&&r.setState(e)})}function iG(e,t,n,r){return new aG(e,t,n,r)}function aG(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||lG,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function oG(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}var sG,cG,lG,uG,dG,fG=o((()=>{Fg(),Qx(),sG=Ng([`rule`]),cG=Ng([`group`,`image`,`rect`]),lG={operator:(e,t)=>nG(e,[`_`],t.code),parameter:(e,t)=>nG(e,[`datum`,`_`],t.code),event:(e,t)=>nG(e,[`event`],t.code),handler:(e,t)=>nG(e,[`_`,`event`],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:r}=t,i=`var o=item,datum=o.datum,m=0,$;`;for(let e in r){let t=`o[`+W(e)+`]`;i+=`$=${r[e].code};if(${t}!==$)${t}=$,m=1;`}return i+=oTe(r,n),i+=`return m;`,nG(e,[`item`,`_`],i)},codegen:{get(e){let t=`[${e.map(W).join(`][`)}]`,n=Function(`_`,`return _${t};`);return n.path=t,n},comparator(e,t){let n,r=Function(`a`,`b`,`var u, v; return `+e.map((e,r)=>{let i=t[r],a,o;return e.path?(a=`a${e.path}`,o=`b${e.path}`):((n||={})[`f`+r]=e,a=`this.f${r}(a)`,o=`this.f${r}(b)`),lTe(a,o,-i,i)}).join(``)+`0;`);return n?r.bind(n):r}}},uG=[{key:`$ref`,parse:pTe},{key:`$key`,parse:hTe},{key:`$expr`,parse:mTe},{key:`$field`,parse:gTe},{key:`$encode`,parse:vTe},{key:`$compare`,parse:_Te},{key:`$context`,parse:yTe},{key:`$subflow`,parse:bTe},{key:`$tupleid`,parse:xTe}],dG={skip:!0},aG.prototype=oG.prototype={fork(){let e=new oG(this);return(this.subcontext||=[]).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);let t=Object.keys(e.nodes);for(let n of t)e.nodes[n]._targets=null;for(let n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){let n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),cTe(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let i=n.get(e.parent.$ref);i?(r.connect(i,[t]),t.targets().add(i)):(n.unresolved=n.unresolved||[]).push(()=>{i=n.get(e.parent.$ref),r.connect(i,[t]),t.targets().add(i)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(let r in e.data){let i=n.data[r]||(n.data[r]={});e.data[r].forEach(e=>i[e]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[tG(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:aTe,parseOperator:uTe,parseOperatorParameters:dTe,parseParameters:fTe,parseStream:STe,parseUpdate:CTe,getState:wTe,setState:TTe}}));function ETe(e){let t=e.container();t&&(t.setAttribute(`role`,`graphics-document`),t.setAttribute(`aria-roleDescription`,`visualization`),pG(t,e.description()))}function pG(e,t){e&&(t==null?e.removeAttribute(`aria-label`):e.setAttribute(`aria-label`,t))}function DTe(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}function OTe(e){let t=e._signals.cursor||(e._signals.cursor=e.add({user:VG,item:null}));e.on(e.events(`view`,`pointermove`),t,(e,n)=>{let r=t.value,i=r?Eg(r)?r:r.user:VG,a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}}),e.add(null,function(t){let n=t.cursor,r=this.value;return Eg(n)||(r=n.item,n=n.user),mG(e,n&&n!==VG?n:r||n),r},{cursor:t})}function mG(e,t){let n=e.globalCursor()?typeof document<`u`&&document.body:e.container();if(n)return t==null?n.style.removeProperty(`cursor`):n.style.cursor=t}function hG(e,t){var n=e._runtime.data;return _g(n,t)||V(`Unrecognized data set: `+t),n[t]}function kTe(e,t){return arguments.length<2?hG(this,e).values.value:gG.call(this,e,fx().remove(Sh).insert(t))}function gG(e,t){dx(t)||V(`Second argument to changes must be a changeset.`);let n=hG(this,e);return n.modified=!0,this.pulse(n.input,t)}function ATe(e,t){return gG.call(this,e,fx().insert(t))}function jTe(e,t){return gG.call(this,e,fx().remove(t))}function _G(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function vG(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function yG(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function MTe(e){var t=yG(e),n=_G(e),r=vG(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(t=>{try{t(n,r)}catch(t){e.error(t)}})}function NTe(e,t,n){var r=e._renderer,i=r&&r.canvas(),a,o,s;return i&&(s=yG(e),o=t.changedTouches?t.changedTouches[0]:t,a=Rk(o,i),a[0]-=s[0],a[1]-=s[1]),t.dataflow=e,t.item=n,t.vega=PTe(e,n,a),t}function PTe(e,t,n){let r=t?t.mark.marktype===`group`?t:t.mark.group:null;function i(e){var n=r,i;if(e){for(i=t;i;i=i.mark.group)if(i.mark.name===e){n=i;break}}return n&&n.mark&&n.mark.interactive?n:{}}function a(e){if(!e)return n;Eg(e)&&(e=i(e));let t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:pg(e),item:pg(t||{}),group:i,xy:a,x:e=>a(e)[0],y:e=>a(e)[1]}}function FTe(e){let t=hg({defaults:{}},e),n=(e,t)=>{t.forEach(t=>{H(e[t])&&(e[t]=Ng(e[t]))})};return n(t.defaults,[`prevent`,`allow`]),n(t,[`view`,`window`,`selector`]),t}function bG(e,t,n,r){e._eventListeners.push({type:n,sources:ng(t),handler:r})}function ITe(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function xG(e,t,n){let r=e._eventConfig&&e._eventConfig[t];return r===!1||Dh(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function LTe(e,t,n){var r=this,i=new gx(n),a=function(n,a){r.runAsync(null,()=>{e===HG&&ITe(r,t)&&n.preventDefault(),i.receive(NTe(r,n,a))})},o;if(e===UG)xG(r,`timer`,t)&&r.timer(a,t);else if(e===HG)xG(r,`view`,t)&&r.addEventListener(t,a,GG);else if(e===WG?xG(r,`window`,t)&&typeof window<`u`&&(o=[window]):typeof document<`u`&&xG(r,`selector`,t)&&(o=Array.from(document.querySelectorAll(e))),!o)r.warn(`Can not resolve event source: `+e);else{for(var s=0,c=o.length;s=0;)t[i].stop();for(i=r.length;--i>=0;)for(o=r[i],a=o.sources.length;--a>=0;)o.sources[a].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)c=n[i].type,s=n[i].handler,this._handler.off(c,s);return this}function TG(e,t,n){let r=document.createElement(e);for(let e in t)r.setAttribute(e,t[e]);return n!=null&&(r.textContent=n),r}function BTe(e,t,n){if(!t)return;let r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,t)})}},r.debounce&&(i.update=mg(r.debounce,i.update))),(r.input==null&&r.element?VTe:UTe)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function VTe(e,t,n,r){let i=n.event||`input`,a=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,a),bG(r,t,i,a),e.set=e=>{t.value=e,t.dispatchEvent(HTe(i))}}function HTe(e){return typeof Event<`u`?new Event(e):{type:e}}function UTe(e,t,n,r){let i=r.signal(n.signal),a=TG(`div`,{class:KG}),o=n.input===`radio`?a:a.appendChild(TG(`label`));o.appendChild(TG(`span`,{class:qG},n.name||n.signal)),t.appendChild(a);let s=WTe;switch(n.input){case`checkbox`:s=GTe;break;case`select`:s=KTe;break;case`radio`:s=qTe;break;case`range`:s=JTe;break}s(e,o,n,i)}function WTe(e,t,n,r){let i=TG(`input`);for(let e in n)e!==`signal`&&e!==`element`&&i.setAttribute(e===`input`?`type`:e,n[e]);i.setAttribute(`name`,n.signal),i.value=r,t.appendChild(i),i.addEventListener(`input`,()=>e.update(i.value)),e.elements=[i],e.set=e=>i.value=e}function GTe(e,t,n,r){let i={type:`checkbox`,name:n.signal};r&&(i.checked=!0);let a=TG(`input`,i);t.appendChild(a),a.addEventListener(`change`,()=>e.update(a.checked)),e.elements=[a],e.set=e=>a.checked=!!e||null}function KTe(e,t,n,r){let i=TG(`select`,{name:n.signal}),a=n.labels||[];n.options.forEach((e,t)=>{let n={value:e};EG(e,r)&&(n.selected=!0),i.appendChild(TG(`option`,n,(a[t]||e)+``))}),t.appendChild(i),i.addEventListener(`change`,()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=e=>{for(let t=0,r=n.options.length;t{let s={type:`radio`,name:n.signal,value:t};EG(t,r)&&(s.checked=!0);let c=TG(`input`,s);c.addEventListener(`change`,()=>e.update(t));let l=TG(`label`,{},(a[o]||t)+``);return l.prepend(c),i.appendChild(l),c}),e.set=t=>{let n=e.elements,r=n.length;for(let e=0;e{c.textContent=s.value,e.update(+s.value)};s.addEventListener(`input`,l),s.addEventListener(`change`,l),e.elements=[s],e.set=e=>{s.value=e,c.textContent=e}}function EG(e,t){return e===t||e+``==t+``}function DG(e,t,n,r,i,a){return t||=new r(e.loader()),t.initialize(n,_G(e),vG(e),yG(e),i,a).background(e.background())}function OG(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function YTe(e,t,n,r){let i=new r(e.loader(),OG(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,yG(e),e);return t&&t.handlers().forEach(e=>{i.on(e.type,e.handler)}),i}function XTe(e,t){let n=this,r=n._renderType,i=n._eventConfig.bind,a=Gk(r);e=n._el=e?kG(n,e,!0):null,ETe(n),a||n.error(`Unrecognized renderer type: `+r);let o=a.handler||cj,s=e?a.renderer:a.headless;return n._renderer=s?DG(n,n._renderer,e,s):null,n._handler=YTe(n,n._handler,e,o),n._redraw=!0,e&&i!==`none`&&(t=t?n._elBind=kG(n,t,!0):e.appendChild(TG(`form`,{class:`vega-bindings`})),n._bind.forEach(e=>{e.param.element&&i!==`container`&&(e.element=kG(n,e.param.element,!!e.param.input))}),n._bind.forEach(e=>{BTe(n,e.element||t,e)})),n}function kG(e,t,n){if(typeof t==`string`)if(typeof document<`u`){if(t=document.querySelector(t),!t)return e.error(`Signal bind element not found: `+t),null}else return e.error(`DOM document instance not found.`),null;if(t&&n)try{t.textContent=``}catch(n){t=null,e.error(n)}return t}function AG(e){return Dh(e)?{top:YG(e.top),bottom:YG(e.bottom),left:YG(e.left),right:YG(e.right)}:XG(YG(e))}async function jG(e,t,n,r){let i=Gk(t),a=i&&i.headless;return a||V(`Unrecognized renderer type: `+t),await e.runAsync(),DG(e,null,null,a,n,r).renderAsync(e._scenegraph.root)}async function ZTe(e,t){e!==Kj.Canvas&&e!==Kj.SVG&&e!==Kj.PNG&&V(`Unrecognized image type: `+e);let n=await jG(this,e,t);return e===Kj.SVG?QTe(n.svg(),`image/svg+xml`):n.canvas().toDataURL(`image/png`)}function QTe(e,t){let n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function $Te(e,t){return(await jG(this,Kj.Canvas,e,t)).canvas()}async function eEe(e){return(await jG(this,Kj.SVG,e)).svg()}function tEe(e,t,n){return iG(e,Zx,qW,n).parse(t)}function nEe(e){var t=this._runtime.scales;return _g(t,e)||V(`Unrecognized scale or projection: `+e),t[e].value}function MG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===$G?r.left+r.right:0)}function NG(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===$G?r.top+r.bottom:0)}function rEe(e){var t=e._signals,n=t[ZG],r=t[QG],i=t[$G];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,t=>{e._width=t.size,e._viewWidth=MG(e,t.size),a()},{size:n}),e._resizeHeight=e.add(null,t=>{e._height=t.size,e._viewHeight=NG(e,t.size),a()},{size:r});let o=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,o.rank=i.rank+1}function iEe(e,t,n,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==n&&(s=1,o.signal(ZG,n,eK),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(QG,r,eK),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==i[0]||o._origin[1]!==i[1])&&(o._resize=1,o._origin=i),s&&o.run(`enter`),a&&o.runAfter(e=>e.resize())},!1,1)}function aEe(e){return this._runtime.getState(e||{data:oEe,signals:sEe,recurse:!0})}function oEe(e,t){return t.modified&&H(t.input.value)&&!e.startsWith(`_:vega:_`)}function sEe(e,t){return!(e===`parent`||t instanceof Zx.proxy)}function cEe(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},e=>{e._trigger=!0}),this}function lEe(e,t){function n(t){e({timestamp:Date.now(),elapsed:t})}this._timers.push(Mbe(n,t))}function uEe(e,t,n,r){let i=e.element();i&&i.setAttribute(`title`,dEe(r))}function dEe(e){return e==null?``:H(e)?PG(e):Dh(e)&&!Cg(e)?fEe(e):e+``}function fEe(e){return Object.keys(e).map(t=>{let n=e[t];return t+`: `+(H(n)?PG(n):FG(n))}).join(` +`)}function PG(e){return`[`+e.map(FG).join(`, `)+`]`}function FG(e){return H(e)?`[…]`:Dh(e)&&!Cg(e)?`{…}`:e}function pEe(){if(this.renderer()===`canvas`&&this._renderer._canvas){let e=null,t=()=>{e?.();let n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener(`change`,t),e=()=>{n.removeEventListener(`change`,t)},this._renderer._canvas.getContext(`2d`).pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function IG(e,t){let n=this;if(t||={},Tx.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let r=hg({},e.locale,t.locale);n.locale(wb(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Kj.Canvas,n._scenegraph=new LA;let r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||uEe,n._redraw=!0,n._handler=new cj().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=FTe(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let i=tEe(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(e=>({state:null,param:hg({},e)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=MG(n,n._width),n._viewHeight=NG(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,rEe(n),DTe(n),OTe(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function LG(e,t){return _g(e._signals,t)?e._signals[t]:V(`Unrecognized signal name: `+W(t))}function RG(e,t){let n=(e._targets||[]).filter(e=>e._update&&e._update.handler===t);return n.length?n[0]:null}function zG(e,t,n,r){let i=RG(n,r);return i||(i=OG(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function BG(e,t,n){let r=RG(t,n);return r&&t._targets.remove(r),e}var VG,HG,UG,WG,GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,mEe=o((()=>{Fg(),Qx(),Xj(),c_(),eG(),fG(),mz(),kb(),VG=`default`,HG=`view`,UG=`timer`,WG=`window`,GG={trap:!1},KG=`vega-bind`,qG=`vega-bind-name`,JG=`vega-bind-radio`,YG=e=>+e||0,XG=e=>({top:e,bottom:e,left:e,right:e}),ZG=`width`,QG=`height`,$G=`padding`,eK={skip:!0},U(IG,Tx,{async evaluate(e,t,n){if(await Tx.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,MTe(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}return n&&nx(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e==null?null:e+``;return t!==this._desc&&pG(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let r=LG(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal(`width`,e):this.signal(`width`)},height(e){return arguments.length?this.signal(`height`,e):this.signal(`height`)},padding(e){return arguments.length?this.signal(`padding`,AG(e)):AG(this.signal(`padding`))},autosize(e){return arguments.length?this.signal(`autosize`,e):this.signal(`autosize`)},background(e){return arguments.length?this.signal(`background`,e):this.signal(`background`)},renderer(e){return arguments.length?(Gk(e)||V(`Unrecognized renderer type: `+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Tx.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(LG(this,`autosize`))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:iEe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=OG(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,a;--r>=0;)if(a=n[r].type,i=n[r].handler,e===a&&(t===i||t===i.raw)){this._handler.off(a,i);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return zG(this,e,LG(this,e),t)},removeSignalListener(e,t){return BG(this,LG(this,e),t)},addDataListener(e,t){return zG(this,e,hG(this,e).values,t)},removeDataListener(e,t){return BG(this,hG(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=mG(this,null);this._globalCursor=!!e,t&&mG(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:lEe,events:LTe,finalize:zTe,hover:RTe,data:kTe,change:gG,insert:ATe,remove:jTe,scale:nEe,initialize:XTe,toImageURL:ZTe,toCanvas:$Te,toSVG:eEe,getState:aEe,setState:cEe,_watchPixelRatio:pEe})}));function tK(e,t,n){return gK=t||aK,_K=n||hK,rK(e.trim()).map(iK)}function hEe(e){return _K[e]}function nK(e,t,n,r,i){let a=e.length,o=0,s;for(;t' after between selector: `+e;r=r.map(iK);let i=iK(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function _Ee(e){let t={source:gK},n=[],r=[0,0],i=0,a=0,o=e.length,s=0,c,l;if(e[o-1]===lK){if(s=e.lastIndexOf(cK),s>=0){try{r=vEe(e.substring(s+1,o-1))}catch{throw`Invalid throttle specification: `+e}e=e.slice(0,s).trim(),o=e.length}else throw`Unmatched right brace: `+e;s=0}if(!o)throw e;if(e[0]===fK&&(i=++s),c=nK(e,s,uK),c1?(t.type=n[1],i?t.markname=n[0].slice(1):hEe(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)===`!`&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function vEe(e){let t=e.split(dK);if(!e.length||t.length>2)throw e;return t.map(t=>{let n=+t;if(n!==n)throw e;return n})}var aK,oK,sK,cK,lK,uK,dK,fK,pK,mK,hK,gK,_K,vK=o((()=>{aK=`view`,oK=`[`,sK=`]`,cK=`{`,lK=`}`,uK=`:`,dK=`,`,fK=`@`,pK=`>`,mK=/[[\]{}]/,hK={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1}}));function yEe(e){return Dh(e)?e:{type:e||`pad`}}function bEe(e){return Dh(e)?e.signal?e:{top:kq(e.top),bottom:kq(e.bottom),left:kq(e.left),right:kq(e.right)}:Aq(kq(e))}function yK(e,t,n,r){return n==null?0:(Dh(n)&&!H(n)||H(n)&&n.length&&Dh(n[0])?e.update[t]=n:e[r||`enter`][t]={value:n},1)}function bK(e,t,n){for(let n in t)yK(e,n,t[n]);for(let t in n)yK(e,t,n[t],`update`)}function xK(e,t,n){for(let r in t)n&&_g(n,r)||(e[r]=hg(e[r]||{},t[r]));return e}function SK(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}function xEe(e,t,n,r,i){let a={},o={},s,c,l,u;for(c in c=`lineBreak`,t===`text`&&i[c]!=null&&!SK(c,e)&&CK(a,c,i[c]),(n==`legend`||String(n).startsWith(`axis`))&&(n=null),u=n===`frame`?i.group:n===`mark`?hg({},i.mark,i[t]):null,u)l=SK(c,e)||(c===`fill`||c===`stroke`)&&(SK(`fill`,e)||SK(`stroke`,e)),l||CK(a,c,u[c]);for(c in ng(r).forEach(t=>{let n=i.style&&i.style[t];for(let t in n)SK(t,e)||CK(a,t,n[t])}),e=hg({},e),a)u=a[c],u.signal?(s||={})[c]=u:o[c]=u;return e.enter=hg(o,e.enter),s&&(e.update=hg(s,e.update)),e}function CK(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}function wK(e){if(e.gradient!=null)return CEe(e);let t=e.signal?`(${e.signal})`:e.color?SEe(e.color):e.field==null?e.value===void 0?void 0:W(e.value):EK(e.field);return e.scale!=null&&(t=wEe(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${TK(e.exponent)})`),e.mult!=null&&(t+=`*${TK(e.mult)}`),e.offset!=null&&(t+=`+${TK(e.offset)}`),e.round&&(t=`round(${t})`),t}function SEe(e){return e.c?Zq(`hcl`,e.h,e.c,e.l):e.h||e.s?Zq(`hsl`,e.h,e.s,e.l):e.l||e.a?Zq(`lab`,e.l,e.a,e.b):e.r||e.g||e.b?Zq(`rgb`,e.r,e.g,e.b):null}function CEe(e){let t=[e.start,e.stop,e.count].map(e=>e==null?null:W(e));for(;t.length&&Mh(t)==null;)t.pop();return t.unshift(Xq(e.gradient)),`gradient(${t.join(`,`)})`}function TK(e){return Dh(e)?`(`+wK(e)+`)`:e}function EK(e){return DK(Dh(e)?e:{datum:e})}function DK(e){let t,n,r;if(e.signal)t=`datum`,r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t=`item`;n-->0;)t+=`.mark.group`;e.parent?(r=e.parent,t+=`.datum`):r=e.group}else e.datum?(t=`datum`,r=e.datum):V(`Invalid field reference: `+W(e));return e.signal||(r=Eg(r)?mh(r).map(W).join(`][`):DK(r)),t+`[`+r+`]`}function wEe(e,t){let n=Xq(e.scale);return e.range==null?(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+`+`:``)+`_bandwidth(${n})`+(+e.band==1?``:`*`+TK(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t??=`0`):t=`lerp(_range(${n}), ${+e.range})`,t}function TEe(e){let t=``;return e.forEach(e=>{let n=wK(e);t+=e.test?`(${e.test})?${n}:`:n}),Mh(t)===`:`&&(t+=`null`),t}function OK(e,t,n,r,i,a){let o={};a||={},a.encoders={$encode:o},e=xEe(e,t,n,r,i.config);for(let n in e)o[n]=EEe(e[n],t,a,i);return a}function EEe(e,t,n,r){let i={},a={};for(let t in e)e[t]!=null&&(i[t]=OEe(DEe(e[t]),r,n,a));return{$expr:{marktype:t,channels:i},$fields:Object.keys(a),$output:Object.keys(e)}}function DEe(e){return H(e)?TEe(e):wK(e)}function OEe(e,t,n,r){let i=NW(e,t);return i.$fields.forEach(e=>r[e]=1),hg(n,i.$params),i.$expr}function kK(e,t){V(e+` for "outer" push: `+W(t))}function AK(e,t){let n=e.name;if(e.push===Qq)t.signals[n]||kK(`No prior signal definition`,n),$q.forEach(t=>{e[t]!==void 0&&kK(`Invalid property `,t)});else{let r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function jK(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function MK(e,t,n,r){return new jK(e,t,n,r)}function NK(e,t){return MK(`operator`,e,t)}function PK(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function FK(e,t){return t?{$field:e,$name:t}:{$field:e}}function IK(e,t){return{$compare:e,$order:t}}function kEe(e,t){let n={$key:e};return t&&(n.$flat=!0),n}function AEe(e){return Dh(e)?(e.order===nJ?`-`:`+`)+LK(e.op,e.field):``}function LK(e,t){return(e&&e.signal?`$`+e.signal:e||``)+(e&&t?`_`:``)+(t&&t.signal?`$`+t.signal:t?.replace(/\W+/g,`_`).replace(/^_+|_+$/g,``)||``)}function RK(e){return e&&e.signal}function jEe(e){return e&&e.expr}function zK(e){if(RK(e))return!0;if(Dh(e)){for(let t in e)if(zK(e[t]))return!0}return!1}function BK(e,t){return e??t}function VK(e){return e&&e.signal||e}function HK(e,t){return(e.merge?NEe:e.stream?PEe:e.type?FEe:V(`Invalid stream specification: `+W(e)))(e,t)}function MEe(e){return e===rJ?iJ:e||iJ}function NEe(e,t){let n=UK({merge:e.merge.map(e=>HK(e,t))},e,t);return t.addStream(n).id}function PEe(e,t){let n=UK({stream:HK(e.stream,t)},e,t);return t.addStream(n).id}function FEe(e,t){let n;e.type===aJ?(n=t.event(aJ,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(MEe(e.source),e.type);let r=UK({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function UK(e,t,n){let r=t.between;return r&&(r.length!==2&&V(`Stream "between" parameter must have 2 entries: `+W(t)),e.between=[HK(r[0],n),HK(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(IEe(t.marktype,t.markname,t.markrole)),t.source===rJ&&r.push(`inScope(event.item)`),r.length&&(e.filter=NW(`(`+r.join(`)&&(`)+`)`,n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function IEe(e,t,n){return`event.item`+(e&&e!==`*`?`&&event.item.mark.marktype==='`+e+`'`:``)+(n?`&&event.item.mark.role==='`+n+`'`:``)+(t?`&&event.item.mark.name==='`+t+`'`:``)}function LEe(e,t,n){let r=e.encode,i={target:n},a=e.events,o=e.update,s=[];a||V(`Signal update missing events specification.`),Eg(a)&&(a=tK(a,t.isSubscope()?rJ:iJ)),a=ng(a).filter(e=>e.signal||e.scale?(s.push(e),0):1),s.length>1&&(s=[zEe(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&V(`Signal encode and update are mutually exclusive.`),o=`encode(item(),`+W(r)+`)`),i.update=Eg(o)?NW(o,t):o.expr==null?o.value==null?o.signal==null?V(`Invalid signal update specification.`):{$expr:oJ,$params:{$value:t.signalRef(o.signal)}}:o.value:NW(o.expr,t),e.force&&(i.options={force:!0}),s.forEach(e=>t.addUpdate(hg(REe(e,t),i)))}function REe(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):HK(e,t)}}function zEe(e){return{signal:`[`+e.map(e=>e.scale?`scale("`+e.scale+`")`:e.signal)+`]`}}function BEe(e,t){let n=t.getSignal(e.name),r=e.update;e.init&&(r?V(`Signals can not include both init and update expressions.`):(r=e.init,n.initonly=!0)),r&&(r=NW(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(e=>LEe(e,t,n.id))}function VEe(e,t){let n=e.type||`linear`;Yfe(n)||V(`Unrecognized scale type: `+W(n)),t.addScale(e.name,{type:n,domain:void 0})}function HEe(e,t){let n=t.getScale(e.name).params,r;for(r in n.domain=qK(e.domain,e,t),e.range!=null&&(n.range=YK(e,t,n)),e.interpolate!=null&&QEe(e.interpolate,n),e.nice!=null&&(n.nice=ZEe(e.nice,t)),e.bins!=null&&(n.bins=XEe(e.bins,t)),e)_g(n,r)||r===`name`||(n[r]=WK(e[r],t))}function WK(e,t){return Dh(e)?e.signal?t.signalRef(e.signal):V(`Unsupported object: `+W(e)):e}function GK(e,t){return e.signal?t.signalRef(e.signal):e.map(e=>WK(e,t))}function KK(e){V(`Can not find data set: `+W(e))}function qK(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&V(`No scale domain defined for domainMin/domainMax to override.`);return}return e.signal?n.signalRef(e.signal):(H(e)?UEe:e.fields?GEe:WEe)(e,t,n)}function UEe(e,t,n){return e.map(e=>WK(e,n))}function WEe(e,t,n){let r=n.getData(e.data);return r||KK(e.data),iO(t.type)?r.valuesRef(n,e.field,JK(e.sort,!1)):Qfe(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function GEe(e,t,n){let r=e.data,i=e.fields.reduce((e,t)=>(t=Eg(t)?{data:r,field:t}:H(t)||t.signal?KEe(t,n):t,e.push(t),e),[]);return(iO(t.type)?qEe:Qfe(t.type)?JEe:YEe)(e,n,i)}function KEe(e,t){let n=`_:vega:_`+IJ++,r=dJ({});if(H(e))r.value={$ingest:e};else if(e.signal){let i=`setdata(`+W(n)+`,`+e.signal+`)`;r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,MJ({})]),{data:n,field:`data`}}function qEe(e,t,n){let r=JK(e.sort,!0),i,a,o=n.map(e=>{let n=t.getData(e.data);return n||KK(e.data),n.countsRef(t,e.field,r)}),s={groupby:eJ,pulse:o};r&&(i=r.op||`count`,a=r.field?LK(i,r.field):`count`,s.ops=[LJ[i]],s.fields=[t.fieldRef(a)],s.as=[a]),i=t.add(cJ(s));let c=t.add(dJ({pulse:PK(i)}));return a=t.add(FJ({field:eJ,sort:t.sortRef(r),pulse:PK(c)})),PK(a)}function JK(e,t){return e&&(!e.field&&!e.op?Dh(e)?e.field=`key`:e={field:`key`}:!e.field&&e.op!==`count`?V(`No field provided for sort aggregate op: `+e.op):t&&e.field&&e.op&&!LJ[e.op]&&V(`Multiple domain scales can not be sorted using `+e.op)),e}function JEe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||KK(e.data),n.domainRef(t,e.field)});return PK(t.add(CJ({values:r})))}function YEe(e,t,n){let r=n.map(e=>{let n=t.getData(e.data);return n||KK(e.data),n.extentRef(t,e.field)});return PK(t.add(SJ({extents:r})))}function XEe(e,t){return e.signal||H(e)?GK(e,t):t.objectProperty(e)}function ZEe(e,t){return e.signal?t.signalRef(e.signal):Dh(e)?{interval:WK(e.interval),step:WK(e.step)}:WK(e)}function QEe(e,t){t.interpolate=WK(e.type||e),e.gamma!=null&&(t.interpolateGamma=WK(e.gamma))}function YK(e,t,n){let r=t.config.range,i=e.range;if(i.signal)return t.signalRef(i.signal);if(Eg(i)){if(r&&_g(r,i))return e=hg({},e,{range:r[i]}),YK(e,t,n);i===`width`?i=[0,{signal:`width`}]:i===`height`?i=iO(e.type)?[0,{signal:`height`}]:[{signal:`height`},0]:V(`Unrecognized scale range value: `+W(i))}else if(i.scheme){n.scheme=H(i.scheme)?GK(i.scheme,t):WK(i.scheme,t),i.extent&&(n.schemeExtent=GK(i.extent,t)),i.count&&(n.schemeCount=WK(i.count,t));return}else if(i.step){n.rangeStep=WK(i.step,t);return}else if(iO(e.type)&&!H(i))return qK(i,e,t);else H(i)||V(`Unsupported range type: `+W(i));return i.map(e=>(H(e)?GK:WK)(e,t))}function $Ee(e,t){let n=t.config.projection||{},r={};for(let n in e)n!==`name`&&(r[n]=XK(e[n],n,t));for(let e in n)r[e]??(r[e]=XK(n[e],e,t));t.addProjection(e.name,r)}function XK(e,t,n){return H(e)?e.map(e=>XK(e,t,n)):Dh(e)?e.signal?n.signalRef(e.signal):t===`fit`?e:V(`Unsupported parameter object: `+W(e)):e}function ZK(e){return e.type=uY,e.interactive=e.interactive||!1,e}function QK(e,t){let n=(n,r)=>BK(e[n],BK(t[n],r));return n.isVertical=n=>UJ===BK(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>BK(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>BK(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>BK(e.columns,BK(t.columns,+n.isVertical(!0))),n}function $K(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function eDe(e,t,n){let r=t.config.style[n];return r&&r[e]}function eq(e,t,n){return`item.anchor === '${WJ}' ? ${e} : item.anchor === '${KJ}' ? ${t} : ${n}`}function tDe(e){let t=e(`tickBand`),n=e(`tickOffset`),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},Dh(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t===`extent`?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e(`bandPosition`),i=e(`tickExtra`)),{extra:i,band:r,offset:n}}function tq(e,t){return t?e?Dh(e)?Object.assign({},e,{offset:tq(e.offset,t)}):{value:e,offset:t}:t:e}function nq(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=xK(e.encode,t,sY)):e.interactive=!1,e}function nDe(e,t,n,r){let i=QK(e,n),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength(),c,l,u,d,f;a?(l=[0,1],u=[0,0],d=o,f=s):(l=[0,0],u=[1,0],d=s,f=o);let p={enter:c={opacity:cY,x:cY,y:cY,width:jq(d),height:jq(f)},update:hg({},c,{opacity:lY,fill:{gradient:t,start:l,stop:u}}),exit:{opacity:cY}};return bK(p,{stroke:i(`gradientStrokeColor`),strokeWidth:i(`gradientStrokeWidth`)},{opacity:i(`gradientOpacity`)}),nq({type:dY,role:Uq,encode:p},r)}function rDe(e,t,n,r,i){let a=QK(e,n),o=a.isVertical(),s=a.gradientThickness(),c=a.gradientLength(),l,u,d,f,p=``;o?(l=`y`,d=`y2`,u=`x`,f=`width`,p=`1-`):(l=`x`,d=`x2`,u=`y`,f=`height`);let m={opacity:cY,fill:{scale:t,field:ZJ}};m[l]={signal:p+`datum.perc`,mult:c},m[u]=cY,m[d]={signal:p+`datum.perc2`,mult:c},m[f]=jq(s);let h={enter:m,update:hg({},m,{opacity:lY}),exit:{opacity:cY}};return bK(h,{stroke:a(`gradientStrokeColor`),strokeWidth:a(`gradientStrokeWidth`)},{opacity:a(`gradientOpacity`)}),nq({type:dY,role:Vq,key:ZJ,from:i,encode:h},r)}function rq(e,t,n,r){let i=QK(e,t),a=i.isVertical(),o=jq(i.gradientThickness()),s=i.gradientLength(),c=i(`labelOverlap`),l,u,d,f,p=``,m={enter:l={opacity:cY},update:u={opacity:lY,text:{field:JJ}},exit:{opacity:cY}};return bK(m,{fill:i(`labelColor`),fillOpacity:i(`labelOpacity`),font:i(`labelFont`),fontSize:i(`labelFontSize`),fontStyle:i(`labelFontStyle`),fontWeight:i(`labelFontWeight`),limit:BK(e.labelLimit,t.gradientLabelLimit)}),a?(l.align={value:`left`},l.baseline=u.baseline={signal:_Y},d=`y`,f=`x`,p=`1-`):(l.align=u.align={signal:gY},l.baseline={value:`top`},d=`x`,f=`y`),l[d]=u[d]={signal:p+`datum.perc`,mult:s},l[f]=u[f]=o,o.offset=BK(e.labelOffset,t.gradientLabelOffset)||0,c=c?{separation:i(`labelSeparation`),method:c,order:`datum.index`}:void 0,nq({type:mY,role:Wq,style:QJ,key:ZJ,from:r,encode:m,overlap:c},n)}function iDe(e,t,n,r,i){let a=QK(e,t),o=n.entries,s=!!(o&&o.interactive),c=o?o.name:void 0,l=a(`clipHeight`),u=a(`symbolOffset`),d={data:`value`},f=`(${i}) ? datum.${YJ} : datum.${aY}`,p=l?jq(l):{field:aY},m=`datum.${qJ}`,h=`max(1, ${i})`,g,_,v,y,b;p.mult=.5,g={enter:_={opacity:cY,x:{signal:f,mult:.5,offset:u},y:p},update:v={opacity:lY,x:_.x,y:_.y},exit:{opacity:cY}};let x=null,S=null;e.fill||(x=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),bK(g,{fill:a(`symbolFillColor`,x),shape:a(`symbolType`),size:a(`symbolSize`),stroke:a(`symbolStrokeColor`,S),strokeDash:a(`symbolDash`),strokeDashOffset:a(`symbolDashOffset`),strokeWidth:a(`symbolStrokeWidth`)},{opacity:a(`symbolOpacity`)}),oY.forEach(t=>{e[t]&&(v[t]=_[t]={scale:e[t],field:ZJ})});let C=nq({type:pY,role:Gq,key:ZJ,from:d,clip:l?!0:void 0,encode:g},n.symbols),w=jq(u);w.offset=a(`labelOffset`),g={enter:_={opacity:cY,x:{signal:f,offset:w},y:p},update:v={opacity:lY,text:{field:JJ},x:_.x,y:_.y},exit:{opacity:cY}},bK(g,{align:a(`labelAlign`),baseline:a(`labelBaseline`),fill:a(`labelColor`),fillOpacity:a(`labelOpacity`),font:a(`labelFont`),fontSize:a(`labelFontSize`),fontStyle:a(`labelFontStyle`),fontWeight:a(`labelFontWeight`),limit:a(`labelLimit`)});let T=nq({type:mY,role:Wq,style:QJ,key:ZJ,from:d,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:cY,height:l?jq(l):cY,opacity:cY},exit:{opacity:cY},update:v={opacity:lY,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(y=`ceil(item.mark.items.length / ${h})`,v.row.signal=`${m}%${y}`,v.column.signal=`floor(${m} / ${y})`,b={field:[`row`,m]}):(v.row.signal=`floor(${m} / ${h})`,v.column.signal=`${m} % ${h}`,b={field:m}),v.column.signal=`(${i})?${v.column.signal}:${m}`,r={facet:{data:r,name:`value`,groupby:qJ}},ZK({role:Nq,from:r,encode:xK(g,o,sY),marks:[C,T],name:c,interactive:s,sort:b})}function aDe(e,t){let n=QK(e,t);return{align:n(`gridAlign`),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n(`rowPadding`),column:n(`columnPadding`)}}}function oDe(e,t,n,r){let i=QK(e,t),a={enter:{opacity:cY},update:{opacity:lY,x:{field:{group:`padding`}},y:{field:{group:`padding`}}},exit:{opacity:cY}};return bK(a,{orient:i(`titleOrient`),_anchor:i(`titleAnchor`),anchor:{signal:wY},angle:{signal:TY},align:{signal:CY},baseline:{signal:EY},text:e.title,fill:i(`titleColor`),fillOpacity:i(`titleOpacity`),font:i(`titleFont`),fontSize:i(`titleFontSize`),fontStyle:i(`titleFontStyle`),fontWeight:i(`titleFontWeight`),limit:i(`titleLimit`),lineHeight:i(`titleLineHeight`)},{align:i(`titleAlign`),baseline:i(`titleBaseline`)}),nq({type:mY,role:Kq,style:$J,from:r,encode:a},n)}function sDe(e,t){let n;return Dh(e)&&(e.signal?n=e.signal:e.path?n=`pathShape(`+iq(e.path)+`)`:e.sphere&&(n=`geoShape(`+iq(e.sphere)+`, {type: "Sphere"})`)),n?t.signalRef(n):!!e}function iq(e){return Dh(e)&&e.signal?e.signal:W(e)}function aq(e){let t=e.role||``;return t.startsWith(`axis`)||t.startsWith(`legend`)||t.startsWith(`title`)?t:e.type===uY?Nq:t||`mark`}function cDe(e){return{marktype:e.type,name:e.name||void 0,role:e.role||aq(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function lDe(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function oq(e,t){let n=Dx(e.type);n||V(`Unrecognized transform type: `+W(e.type));let r=MK(n.type.toLowerCase(),null,sq(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function sq(e,t,n){let r={},i=e.params.length;for(let a=0;acq(e,t,n)):cq(e,i,n)}function cq(e,t,n){let r=e.type;if(RK(t))return AY(r)?V(`Expression references can not be signals.`):jY(r)?n.fieldRef(t):MY(r)?n.compareRef(t):n.signalRef(t.signal);{let i=e.expr||jY(r);return i&&DY(t)?n.exprRef(t.expr,t.as):i&&OY(t)?FK(t.field,t.as):AY(r)?NW(t,n):kY(r)?PK(n.getData(t).values):jY(r)?FK(t):MY(r)?n.compareRef(t):t}}function dDe(e,t,n){return Eg(t.from)||V(`Lookup "from" parameter must be a string literal.`),n.getData(t.from).lookupRef(n,t.key)}function fDe(e,t,n){let r=t[e.name];return e.array?(H(r)||V(`Expected an array of sub-parameters. Instead: `+W(r)),r.map(t=>lq(e,t,n))):lq(e,r,n)}function lq(e,t,n){let r=e.params.length,i;for(let n=0;ne??`null`).join(`,`)+`),0)`,t);c.update=l.$expr,c.params=l.$params}function gq(e,t){let n=aq(e),r=e.type===uY,i=e.from&&e.from.facet,a=e.overlap,o=e.layout||n===`scope`||n===`frame`,s,c,l,u,d,f,p,m=n===`mark`||o||i,h=pDe(e.from,r,t);c=t.add(pJ({key:h.key||(e.key?FK(e.key):void 0),pulse:h.pulse,clean:!r}));let g=PK(c);c=l=t.add(dJ({pulse:g})),c=t.add(xJ({markdef:cDe(e),interactive:lDe(e.interactive,t),clip:sDe(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef(`parent`):null,index:t.markpath(),pulse:PK(c)}));let _=PK(c);c=u=t.add(mJ(OK(e.encode,e.type,n,e.style,t,{mod:!1,pulse:_}))),c.params.parent=t.encode(),e.transform&&e.transform.forEach(e=>{let n=oq(e,t),r=n.metadata;(r.generates||r.changes)&&V(`Mark transforms should not generate new data.`),r.nomod||(u.params.mod=!0),n.params.pulse=PK(c),t.add(c=n)}),e.sort&&(c=t.add(NJ({sort:t.compareRef(e.sort),pulse:PK(c)})));let v=PK(c);(i||o)&&(o=t.add(PJ({layout:t.objectProperty(e.layout),legends:t.legends,mark:_,pulse:v})),f=PK(o));let y=t.add(uJ({mark:_,pulse:f||v}));p=PK(y),r&&(m&&(s=t.operators,s.pop(),o&&s.pop()),t.pushState(v,f||p,g),i?mDe(e,t,h):m?hDe(e,t,h):t.parse(e),t.popState(),m&&(o&&s.push(o),s.push(y))),a&&(p=gDe(a,p,t));let b=t.add(AJ({pulse:p})),x=t.add(MJ({pulse:PK(b)},void 0,t.parent()));e.name!=null&&(d=e.name,t.addData(d,new dq(t,l,b,x)),e.on&&e.on.forEach(e=>{(e.insert||e.remove||e.toggle)&&V(`Marks only support modify triggers.`),hq(e,t,d)}))}function gDe(e,t,n){let r=e.method,i=e.bound,a=e.separation,o={separation:RK(a)?n.signalRef(a.signal):a,method:RK(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),i){let e=i.tolerance;o.boundTolerance=RK(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(i.scale),o.boundOrient=i.orient}return PK(n.add(wJ(o)))}function _De(e,t){let n=t.config.legend,r=e.encode||{},i=QK(e,n),a=r.legend||{},o=a.name||void 0,s=a.interactive,c=a.style,l={},u=0,d,f,p;oY.forEach(t=>e[t]?(l[t]=e[t],u||=e[t]):0),u||V(`Missing valid scale for legend.`);let m=vDe(e,t.scaleType(u)),h={title:e.title!=null,scales:l,type:m,vgrad:m!==`symbol`&&i.isVertical()},g=PK(t.add(dJ(null,[h]))),_={enter:{x:{value:0},y:{value:0}}},v=PK(t.add(yJ(f={type:m,scale:t.scaleRef(u),count:t.objectProperty(i(`tickCount`)),limit:t.property(i(`symbolLimit`)),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===rY?(p=[nDe(e,u,n,r.gradient),rq(e,n,r.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${VK(i.gradientLength())})/100))`)):m===iY?p=[rDe(e,u,n,r.gradient,v),rq(e,n,r.labels,v)]:(d=aDe(e,n),p=[iDe(e,n,r,v,VK(d.columns))],f.size=xDe(e,t,p[0].marks)),p=[ZK({role:Hq,from:g,encode:_,marks:p,layout:d,interactive:s})],h.title&&p.push(oDe(e,n,r.title,g)),gq(ZK({role:Bq,from:g,encode:xK(bDe(i,e,n),a,sY),marks:p,aria:i(`aria`),description:i(`description`),zindex:i(`zindex`),name:o,interactive:s,style:c}),t)}function vDe(e,t){let n=e.type||nY;return!e.type&&yDe(e)===1&&(e.fill||e.stroke)&&(n=rO(t)?rY:aO(t)?iY:nY),n===rY?aO(t)?iY:rY:n}function yDe(e){return oY.reduce((t,n)=>t+ +!!e[n],0)}function bDe(e,t,n){let r={enter:{},update:{}};return bK(r,{orient:e(`orient`),offset:e(`offset`),padding:e(`padding`),titlePadding:e(`titlePadding`),cornerRadius:e(`cornerRadius`),fill:e(`fillColor`),stroke:e(`strokeColor`),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e(`legendX`),y:e(`legendY`),format:t.format,formatType:t.formatType}),r}function xDe(e,t,n){return NW(`max(ceil(sqrt(${VK(_q(`size`,e,n))})+${VK(_q(`strokeWidth`,e,n))}),${VK(SDe(n[1].encode,t,QJ))})`,t)}function _q(e,t,n){return t[e]?`scale("${t[e]}",datum)`:$K(e,n[0].encode)}function SDe(e,t,n){return $K(`fontSize`,e)||eDe(`fontSize`,t,n)}function CDe(e,t){e=Eg(e)?{text:e}:e;let n=QK(e,t.config.title),r=e.encode||{},i=r.group||{},a=i.name||void 0,o=i.interactive,s=i.style,c=[],l=PK(t.add(dJ(null,[{}])));return c.push(EDe(e,n,wDe(e),l)),e.subtitle&&c.push(DDe(e,n,r.subtitle,l)),gq(ZK({role:qq,from:l,encode:TDe(n,i),marks:c,aria:n(`aria`),description:n(`description`),zindex:n(`zindex`),name:a,interactive:o,style:s}),t)}function wDe(e){let t=e.encode;return t&&t.title||hg({name:e.name,interactive:e.interactive,style:e.style},t)}function TDe(e,t){let n={enter:{},update:{}};return bK(n,{orient:e(`orient`),anchor:e(`anchor`),align:{signal:hY},angle:{signal:NY},limit:e(`limit`),frame:e(`frame`),offset:e(`offset`)||0,padding:e(`subtitlePadding`)}),xK(n,t,sY)}function EDe(e,t,n,r){let i={value:0},a=e.text,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return bK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`color`),font:t(`font`),fontSize:t(`fontSize`),fontStyle:t(`fontStyle`),fontWeight:t(`fontWeight`),lineHeight:t(`lineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),nq({type:mY,role:Jq,style:eY,from:r,encode:o},n)}function DDe(e,t,n,r){let i={value:0},a=e.subtitle,o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return bK(o,{text:a,align:{signal:`item.mark.group.align`},angle:{signal:`item.mark.group.angle`},limit:{signal:`item.mark.group.limit`},baseline:`top`,dx:t(`dx`),dy:t(`dy`),fill:t(`subtitleColor`),font:t(`subtitleFont`),fontSize:t(`subtitleFontSize`),fontStyle:t(`subtitleFontStyle`),fontWeight:t(`subtitleFontWeight`),lineHeight:t(`subtitleLineHeight`)},{align:t(`align`),angle:t(`angle`),baseline:t(`baseline`)}),nq({type:mY,role:Yq,style:tY,from:r,encode:o},n)}function ODe(e,t){let n=[];e.transform&&e.transform.forEach(e=>{n.push(oq(e,t))}),e.on&&e.on.forEach(n=>{hq(n,t,e.name)}),t.addDataPipeline(e.name,kDe(e,t,n))}function kDe(e,t,n){let r=[],i=null,a=!1,o=!1,s,c,l,u,d;for(e.values?RK(e.values)||zK(e.format)?(r.push(yq(t,e)),r.push(i=vq())):r.push(i=vq({$ingest:e.values,$format:e.format})):e.url?zK(e.url)||zK(e.format)?(r.push(yq(t,e)),r.push(i=vq())):r.push(i=vq({$request:e.url,$format:e.format})):e.source&&(i=s=ng(e.source).map(e=>PK(t.getData(e).output)),r.push(null)),c=0,l=n.length;ce==null?!SK(t,r):(n.update[t]=ZY(jq(e),n.update[t]),!1),a=i(e(`titleX`),`x`),o=i(e(`titleY`),`y`);n.enter.auto=o===a?jq(o):IY(t,jq(o),jq(a))}function RDe(e,t){let n=ADe(e,t),r=e.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,c=QK(e,n),l=tDe(c),u={scale:e.scale,ticks:!!c(`ticks`),labels:!!c(`labels`),grid:!!c(`grid`),domain:!!c(`domain`),title:e.title!=null},d=PK(t.add(dJ({},[u]))),f=PK(t.add(lJ({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[],m;return u.grid&&p.push(MDe(e,n,r.grid,f,l)),u.ticks&&(m=c(`tickSize`),p.push(PDe(e,n,r.ticks,f,m,l))),u.labels&&(m=u.ticks?m:0,p.push(FDe(e,n,r.labels,f,m,l))),u.domain&&p.push(jDe(e,n,r.domain,d)),u.title&&p.push(IDe(e,n,r.title,d)),gq(ZK({role:Pq,from:d,encode:xK(zDe(c,e),i,sY),marks:p,aria:c(`aria`),description:c(`description`),zindex:c(`zindex`),name:a,interactive:o,style:s}),t)}function zDe(e,t){let n={enter:{},update:{}};return bK(n,{orient:e(`orient`),offset:e(`offset`)||0,position:BK(t.position,0),titlePadding:e(`titlePadding`),minExtent:e(`minExtent`),maxExtent:e(`maxExtent`),range:{signal:`abs(span(range("${t.scale}")))`},translate:e(`translate`),format:t.format,formatType:t.formatType}),n}function wq(e,t,n){let r=ng(e.signals),i=ng(e.scales);return n||r.forEach(e=>AK(e,t)),ng(e.projections).forEach(e=>$Ee(e,t)),i.forEach(e=>VEe(e,t)),ng(e.data).forEach(e=>ODe(e,t)),i.forEach(e=>HEe(e,t)),(n||r).forEach(e=>BEe(e,t)),ng(e.axes).forEach(e=>RDe(e,t)),ng(e.marks).forEach(e=>gq(e,t)),ng(e.legends).forEach(e=>_De(e,t)),e.title&&CDe(e.title,t),t.parseLambdas(),t}function BDe(e,t){let n=t.config,r=PK(t.root=t.add(NK())),i=VDe(e,n);i.forEach(e=>AK(e,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let a=t.add(dJ()),o=t.add(mJ(OK(QY(e.encode),uY,Mq,e.style,t,{pulse:PK(a)}))),s=t.add(PJ({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef(`autosize`),mark:r,pulse:PK(o)}));t.operators.pop(),t.pushState(PK(o),PK(s),null),wq(e,t,i),t.operators.push(s);let c=t.add(uJ({mark:r,pulse:PK(s)}));return c=t.add(AJ({pulse:PK(c)})),c=t.add(MJ({pulse:PK(c)})),t.addData(`root`,new dq(t,a,a,c)),t}function Tq(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function VDe(e,t){let n=n=>BK(e[n],t[n]),r=[Tq(`background`,n(`background`)),Tq(`autosize`,yEe(n(`autosize`))),Tq(`padding`,bEe(n(`padding`))),Tq(`width`,n(`width`)||0),Tq(`height`,n(`height`)||0)],i=r.reduce((e,t)=>(e[t.name]=t,e),{}),a={};return ng(e.signals).forEach(e=>{_g(i,e.name)?e=hg(i[e.name],e):r.push(e),a[e.name]=e}),ng(t.signals).forEach(e=>{!_g(a,e.name)&&!_g(i,e.name)&&r.push(e)}),r}function Eq(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Dq(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function Oq(e){return(H(e)?HDe:UDe)(e)}function HDe(e){let t=e.length,n=`[`;for(let r=0;r0?`,`:``)+(Dh(t)?t.signal||Oq(t):W(t))}return n+`]`}function UDe(e){let t=`{`,n=0,r,i;for(r in e)i=e[r],t+=(++n>1?`,`:``)+W(r)+`:`+(Dh(i)?i.signal||Oq(i):W(i));return t+`}`}function WDe(){let e=`sans-serif`,t=`#4c78a8`,n=`#000`,r=`#888`,i=`#ddd`;return{description:`Vega visualization`,padding:0,autosize:`pad`,background:null,events:{defaults:{allow:[`wheel`]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:`bold`},"group-title":{fill:n,font:e,fontSize:13,fontWeight:`bold`},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:`circle`},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:`square`},cell:{fill:`transparent`,stroke:i},view:{fill:`transparent`}},title:{orient:`top`,anchor:`middle`,offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:`mercator`},legend:{orient:`right`,padding:0,gridAlign:`each`,columnPadding:10,rowPadding:2,symbolDirection:`vertical`,gradientDirection:`vertical`,gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:`left`,labelBaseline:`middle`,labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:`circle`,symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:`transparent`,symbolBaseStrokeColor:r,titleLimit:180,titleOrient:`top`,titlePadding:5,layout:{offset:18,direction:`horizontal`,left:{direction:`vertical`},right:{direction:`vertical`}}},range:{category:{scheme:`tableau10`},ordinal:{scheme:`blues`},heatmap:{scheme:`yellowgreenblue`},ramp:{scheme:`blues`},diverging:{scheme:`blueorange`,extent:[1,0]},symbol:[`circle`,`square`,`triangle-up`,`cross`,`diamond`,`triangle-right`,`triangle-down`,`triangle-left`]}}}function GDe(e,t,n){return Dh(e)||V(`Input Vega specification must be an object.`),t=kh(WDe(),t,e.config),BDe(e,new Eq(t,n)).toRuntime()}var kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ,OJ,kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,KDe=o((()=>{Fg(),eG(),vK(),MO(),Qx(),kq=e=>+e||0,Aq=e=>({top:e,bottom:e,left:e,right:e}),jq=e=>Dh(e)&&!H(e)?hg({},e):{value:e},Mq=`frame`,Nq=`scope`,Pq=`axis`,Fq=`axis-domain`,Iq=`axis-grid`,Lq=`axis-label`,Rq=`axis-tick`,zq=`axis-title`,Bq=`legend`,Vq=`legend-band`,Hq=`legend-entry`,Uq=`legend-gradient`,Wq=`legend-label`,Gq=`legend-symbol`,Kq=`legend-title`,qq=`title`,Jq=`title-text`,Yq=`title-subtitle`,Xq=e=>Eg(e)?W(e):e.signal?`(${e.signal})`:EK(e),Zq=(e,t,n,r)=>`(${e}(${[t,n,r].map(wK).join(`,`)})+'')`,Qq=`outer`,$q=[`value`,`update`,`init`,`react`,`bind`],eJ=FK(`key`),tJ=`ascending`,nJ=`descending`,rJ=`scope`,iJ=`view`,aJ=`timer`,oJ={code:`_.$value`,ast:{type:`Identifier`,value:`value`}},sJ=e=>(t,n,r)=>MK(e,n,t||void 0,r),cJ=sJ(`aggregate`),lJ=sJ(`axisticks`),uJ=sJ(`bound`),dJ=sJ(`collect`),fJ=sJ(`compare`),pJ=sJ(`datajoin`),mJ=sJ(`encode`),hJ=sJ(`expression`),gJ=sJ(`facet`),_J=sJ(`field`),vJ=sJ(`key`),yJ=sJ(`legendentries`),bJ=sJ(`load`),xJ=sJ(`mark`),SJ=sJ(`multiextent`),CJ=sJ(`multivalues`),wJ=sJ(`overlap`),TJ=sJ(`params`),EJ=sJ(`prefacet`),DJ=sJ(`projection`),OJ=sJ(`proxy`),kJ=sJ(`relay`),AJ=sJ(`render`),jJ=sJ(`scale`),MJ=sJ(`sieve`),NJ=sJ(`sortitems`),PJ=sJ(`viewlayout`),FJ=sJ(`values`),IJ=0,LJ={min:`min`,max:`max`,count:`sum`},RJ=`top`,zJ=`left`,BJ=`right`,VJ=`bottom`,HJ=`center`,UJ=`vertical`,WJ=`start`,GJ=`middle`,KJ=`end`,qJ=`index`,JJ=`label`,YJ=`offset`,XJ=`perc`,ZJ=`value`,QJ=`guide-label`,$J=`guide-title`,eY=`group-title`,tY=`group-subtitle`,nY=`symbol`,rY=`gradient`,iY=`discrete`,aY=`size`,oY=[aY,`shape`,`fill`,`stroke`,`strokeWidth`,`strokeDash`,`opacity`],sY={name:1,style:1,interactive:1},cY={value:0},lY={value:1},uY=`group`,dY=`rect`,fY=`rule`,pY=`symbol`,mY=`text`,hY=eq(W(zJ),W(BJ),W(HJ)),gY=`datum.${XJ}<=0?"${zJ}":datum.${XJ}>=1?"${BJ}":"${HJ}"`,_Y=`datum.${XJ}<=0?"${VJ}":datum.${XJ}>=1?"${RJ}":"${GJ}"`,vY=`item.orient === "left"`,yY=`item.orient === "right"`,bY=`(${vY} || ${yY})`,xY=`datum.vgrad && ${bY}`,SY=eq(`"top"`,`"bottom"`,`"middle"`),CY=`datum.vgrad && ${yY} ? (${eq(`"right"`,`"left"`,`"center"`)}) : (${bY} && !(datum.vgrad && ${vY})) ? "left" : ${hY}`,wY=`item._anchor || (${bY} ? "middle" : "start")`,TY=`${xY} ? (${vY} ? -90 : 90) : 0`,EY=`${bY} ? (datum.vgrad ? (${yY} ? "bottom" : "top") : ${SY}) : "top"`,DY=e=>e&&e.expr,OY=e=>e&&e.field,kY=e=>e===`data`,AY=e=>e===`expr`,jY=e=>e===`field`,MY=e=>e===`compare`,dq.fromEntries=function(e,t){let n=t.length,r=t[n-1],i=t[n-2],a=t[0],o=null,s=1;for(a&&a.type===`load`&&(a=t[1]),e.add(t[0]);se===VJ||e===RJ,FY=(e,t,n)=>RK(e)?HY(e.signal,t,n):e===zJ||e===RJ?t:n,IY=(e,t,n)=>RK(e)?BY(e.signal,t,n):PY(e)?t:n,LY=(e,t,n)=>RK(e)?VY(e.signal,t,n):PY(e)?n:t,RY=(e,t,n)=>RK(e)?UY(e.signal,t,n):e===RJ?{value:t}:{value:n},zY=(e,t,n)=>RK(e)?WY(e.signal,t,n):e===BJ?{value:t}:{value:n},BY=(e,t,n)=>GY(`${e} === '${RJ}' || ${e} === '${VJ}'`,t,n),VY=(e,t,n)=>GY(`${e} !== '${RJ}' && ${e} !== '${VJ}'`,t,n),HY=(e,t,n)=>qY(`${e} === '${zJ}' || ${e} === '${RJ}'`,t,n),UY=(e,t,n)=>qY(`${e} === '${RJ}'`,t,n),WY=(e,t,n)=>qY(`${e} === '${BJ}'`,t,n),GY=(e,t,n)=>(t=t==null?t:jq(t),n=n==null?n:jq(n),KY(t)&&KY(n)?(t=t?t.signal||W(t.value):null,n=n?n.signal||W(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[hg({test:e},t)].concat(n||[])),KY=e=>e==null||Object.keys(e).length===1,qY=(e,t,n)=>({signal:`${e} ? (${YY(t)}) : (${YY(n)})`}),JY=(e,t,n,r,i)=>({signal:(r==null?``:`${e} === '${zJ}' ? (${YY(r)}) : `)+(n==null?``:`${e} === '${VJ}' ? (${YY(n)}) : `)+(i==null?``:`${e} === '${BJ}' ? (${YY(i)}) : `)+(t==null?``:`${e} === '${RJ}' ? (${YY(t)}) : `)+`(null)`}),YY=e=>RK(e)?e.signal:e==null?null:W(e),XY=(e,t)=>t===0?0:RK(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},ZY=(e,t)=>{let n=e.signal;return n&&n.endsWith(`(null)`)?{signal:n.slice(0,-6)+t.signal}:e},QY=e=>xK({enter:{x:{value:0},y:{value:0}},update:{width:{signal:`width`},height:{signal:`height`}}},e),Eq.prototype=Dq.prototype={parse(e){return wq(e,this)},fork(){return new Dq(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+`:`:0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&=(e.refs.forEach(t=>{t.$ref=e.id}),null),e},proxy(e){let t=e instanceof jK?PK(e):e;return this.add(OJ({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let r,i;e&&(r=e.data||={},i=r[t]||(r[t]=[]),i.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,`input`),n(t.output,e,`output`),n(t.values,e,`values`);for(let r in t.index)n(t.index[r],e,`index:`+r)}return this},pushState(e,t,n){this._encode.push(PK(this.add(MJ({pulse:e})))),this._parent.push(t),this._lookup.push(n?PK(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Mh(this._parent)},encode(){return Mh(this._encode)},lookup(){return Mh(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Eg(e))return FK(e,t);e.signal||V(`Unsupported field reference: `+W(e));let n=e.signal,r=this.field[n];if(!r){let e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=r=PK(this.add(_J(e)))}return r},compareRef(e){let t=!1,n=e=>RK(e)?(t=!0,this.signalRef(e.signal)):jEe(e)?(t=!0,this.exprRef(e.expr)):e,r=ng(e.field).map(n),i=ng(e.order).map(n);return t?PK(this.add(fJ({fields:r,orders:i}))):IK(r,i)},keyRef(e,t){let n=!1,r=e=>RK(e)?(n=!0,PK(i[e.signal])):e,i=this.signals;return e=ng(e).map(r),n?PK(this.add(vJ({fields:e,flat:t}))):kEe(e,t)},sortRef(e){if(!e)return e;let t=LK(e.op,e.field),n=e.order||tJ;return n.signal?PK(this.add(fJ({fields:t,orders:this.signalRef(n.signal)}))):IK(t,n)},event(e,t){let n=e+`:`+t;if(!this.events[n]){let r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return _g(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&V(`Duplicate signal name: `+W(e));let n=t instanceof jK?t:this.add(NK(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||V(`Unrecognized signal name: `+W(e)),this.signals[e]},signalRef(e){return this.signals[e]?PK(this.signals[e]):(_g(this.lambdas,e)||(this.lambdas[e]=this.add(NK(null))),PK(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;tWO,CanvasHandler:()=>cj,CanvasRenderer:()=>uj,DATE:()=>ty,DAY:()=>`day`,DAYOFYEAR:()=>ny,Dataflow:()=>Tx,Debug:()=>4,DisallowedObjectProperties:()=>wh,Error:()=>1,EventStream:()=>gx,Gradient:()=>Ipe,GroupItem:()=>KO,HOURS:()=>ry,Handler:()=>RA,HybridHandler:()=>Bj,HybridRenderer:()=>zj,Info:()=>3,Item:()=>GO,MILLISECONDS:()=>oy,MINUTES:()=>iy,MONTH:()=>$v,Marks:()=>FA,MultiPulse:()=>Sx,None:()=>0,Operator:()=>mx,Parameters:()=>px,Pulse:()=>vx,QUARTER:()=>Qv,RenderType:()=>Kj,Renderer:()=>zA,ResourceLoader:()=>fA,SECONDS:()=>ay,SVGHandler:()=>fj,SVGRenderer:()=>Nj,SVGStringRenderer:()=>Lj,Scenegraph:()=>LA,TIME_UNITS:()=>sy,Transform:()=>G,View:()=>IG,WEEK:()=>ey,Warn:()=>2,YEAR:()=>Zv,accessor:()=>ah,accessorFields:()=>sh,accessorName:()=>oh,array:()=>ng,ascending:()=>lg,bandwidthNRD:()=>nS,bin:()=>rS,bootstrapCI:()=>iS,boundClip:()=>Khe,boundContext:()=>YO,boundItem:()=>Nk,boundMark:()=>rhe,boundStroke:()=>JO,changeset:()=>fx,clampRange:()=>ig,codegenExpression:()=>zH,compare:()=>sg,constant:()=>pg,cumulativeLogNormal:()=>mS,cumulativeNormal:()=>cS,cumulativeUniform:()=>bS,dayofyear:()=>Dv,debounce:()=>mg,defaultLocale:()=>Tb,definition:()=>Dx,densityLogNormal:()=>pS,densityNormal:()=>sS,densityUniform:()=>yS,detectTimeUnits:()=>Xv,domChild:()=>Ik,domClear:()=>Lk,domCreate:()=>Pk,domFind:()=>Fk,dotbin:()=>aS,error:()=>V,expressionFunction:()=>MW,extend:()=>hg,extent:()=>gg,extentIndex:()=>kie,falsy:()=>Ch,fastmap:()=>yg,field:()=>gh,flush:()=>Mie,font:()=>kk,fontFamily:()=>Ok,fontSize:()=>Ck,format:()=>Qb,formatLocale:()=>vb,formats:()=>Ib,hasOwnProperty:()=>_g,id:()=>vh,identity:()=>yh,inferType:()=>Ab,inferTypes:()=>jb,ingest:()=>ox,inherits:()=>U,inrange:()=>xg,interpolate:()=>cO,interpolateColors:()=>sO,interpolateRange:()=>$fe,intersect:()=>Vhe,intersectBoxLine:()=>QO,intersectPath:()=>XO,intersectPoint:()=>ZO,intersectRule:()=>cme,isArray:()=>H,isBoolean:()=>Sg,isDate:()=>Cg,isFunction:()=>ag,isIterable:()=>Rie,isNumber:()=>wg,isObject:()=>Dh,isRegExp:()=>Tg,isString:()=>Eg,isTuple:()=>rx,key:()=>Dg,lerp:()=>Wie,lineHeight:()=>wk,loader:()=>$b,locale:()=>wb,logger:()=>Th,lruCache:()=>Kie,markup:()=>Bk,merge:()=>Xie,mergeConfig:()=>kh,multiLineOffset:()=>Ek,one:()=>xh,pad:()=>$ie,panLinear:()=>Rh,panLog:()=>zh,panPow:()=>Bh,panSymlog:()=>Vh,parse:()=>GDe,parseExpression:()=>LH,parseSelector:()=>tK,path:()=>Tw,pathCurves:()=>FO,pathEqual:()=>qhe,pathParse:()=>IO,pathRectangle:()=>Jpe,pathRender:()=>LO,pathSymbols:()=>Hpe,pathTrail:()=>Ype,peek:()=>Mh,point:()=>Rk,projection:()=>nR,quantileLogNormal:()=>hS,quantileNormal:()=>lS,quantileUniform:()=>xS,quantiles:()=>eS,quantizeInterpolator:()=>epe,quarter:()=>eg,quartiles:()=>tS,random:()=>IS,randomInteger:()=>Wce,randomKDE:()=>dS,randomLCG:()=>Uce,randomLogNormal:()=>gS,randomMixture:()=>_S,randomNormal:()=>uS,randomUniform:()=>SS,read:()=>Rb,regressionConstant:()=>CS,regressionExp:()=>AS,regressionLinear:()=>OS,regressionLoess:()=>PS,regressionLog:()=>kS,regressionPoly:()=>NS,regressionPow:()=>jS,regressionQuad:()=>MS,renderModule:()=>Gk,repeat:()=>Og,resetDefaultLocale:()=>ace,resetSVGDefIds:()=>Yhe,responseType:()=>Lb,runtimeContext:()=>iG,sampleCurve:()=>FS,sampleLogNormal:()=>fS,sampleNormal:()=>oS,sampleUniform:()=>vS,scale:()=>tO,sceneEqual:()=>Kk,sceneFromJSON:()=>ahe,scenePickVisit:()=>ak,sceneToJSON:()=>ihe,sceneVisit:()=>ik,sceneZOrder:()=>rk,scheme:()=>lO,serializeXML:()=>Ej,setHybridRendererOptions:()=>Bhe,setRandom:()=>Vce,span:()=>kg,splitAccessPath:()=>mh,stringValue:()=>W,textMetrics:()=>NA,timeBin:()=>Yv,timeFloor:()=>zv,timeFormatLocale:()=>Cb,timeInterval:()=>Vv,timeOffset:()=>Wv,timeSequence:()=>qv,timeUnitSpecifier:()=>Tv,timeUnits:()=>wv,toBoolean:()=>Ag,toDate:()=>jg,toNumber:()=>Ph,toSet:()=>Ng,toString:()=>Mg,transform:()=>Ox,transforms:()=>Zx,truncate:()=>cae,truthy:()=>Sh,tupleid:()=>ix,typeParsers:()=>Jb,utcFloor:()=>Bv,utcInterval:()=>Hv,utcOffset:()=>Gv,utcSequence:()=>Jv,utcdayofyear:()=>Mv,utcquarter:()=>tg,utcweek:()=>Nv,version:()=>eX,visitArray:()=>Pg,week:()=>Ov,writeConfig:()=>Ah,zero:()=>bh,zoomLinear:()=>Uh,zoomLog:()=>Wh,zoomPow:()=>Gh,zoomSymlog:()=>Kh}),$Y,eX,tX=o((()=>{Fg(),Fg(),Qx(),Ale(),v_e(),I_e(),zye(),Qbe(),CSe(),zSe(),VSe(),pCe(),SCe(),OCe(),US(),Iy(),ex(),Xj(),MO(),sR(),mEe(),kb(),eG(),KDe(),fG(),zU(),vK(),$Y=`6.3.1`,hg(Zx,$ce,Yge,y_e,yye,Kbe,wSe,ySe,BSe,uCe,mCe,CCe),eX=$Y}));function JDe(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}function nX(e,t,n,r,i,a){let o=e=>fX[e.type](o,e);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=r,o.event=i,o.item=a,uX.forEach(e=>o.fn[e]=(...t)=>i.vega[e](...t)),o(e)}var rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,YDe=o((()=>{Fg(),rX={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},iX={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},aX={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e},oX=Array.prototype.slice,sX=(e,t,n)=>{let r=n?n(t[0]):t[0];return r[e].apply(r,oX.call(t,1))},cX=(e,t=0,n=1,r=0,i=0,a=0,o=0)=>Eg(e)?new Date(e):new Date(e,t,n,r,i,a,o),lX={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:cX,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return sX(`join`,arguments)},indexof:function(){return sX(`indexOf`,arguments)},lastindexof:function(){return sX(`lastIndexOf`,arguments)},slice:function(){return sX(`slice`,arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(lg),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return sX(`substring`,arguments,String)},split:function(){return sX(`split`,arguments,String)},replace:function(){return sX(`replace`,arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),encodeURIComponent:e=>encodeURIComponent(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)},uX=[`view`,`item`,`group`,`xy`,`x`,`y`],dX=new Set([Function,eval,setTimeout,setInterval]),typeof setImmediate==`function`&&dX.add(setImmediate),fX={Literal:(e,t)=>t.value,Identifier:(e,t)=>{let n=t.name;return e.memberDepth>0?n:n===`datum`?e.datum:n===`event`?e.event:n===`item`?e.item:rX[n]||e.params[`$`+n]},MemberExpression:(e,t)=>{let n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);let i=e(t.property);if(n&&--e.memberDepth,dX.has(r[i])){console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`);return}return r[i]},CallExpression:(e,t)=>{let n=t.arguments,r=t.callee.name;return r.startsWith(`_`)&&(r=r.slice(1)),r===`if`?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||lX[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>iX[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>aX[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator===`&&`?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((t,n)=>{e.memberDepth+=1;let r=e(n.key);--e.memberDepth;let i=e(n.value);return wh.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):dX.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):t[r]=i,t},{})},pX={operator(e,t){let n=t.ast,r=e.functions;return e=>nX(n,r,e)},parameter(e,t){let n=t.ast,r=e.functions;return(e,t)=>nX(n,r,t,e)},event(e,t){let n=t.ast,r=e.functions;return e=>nX(n,r,void 0,void 0,e)},handler(e,t){let n=t.ast,r=e.functions;return(e,t)=>{let i=t.item&&t.item.datum;return nX(n,r,e,i,t)}},encode(e,t){let{marktype:n,channels:r}=t,i=e.functions,a=n===`group`||n===`image`||n===`rect`;return(e,t)=>{let o=e.datum,s=0,c;for(let n in r)c=nX(r[n].ast,i,t,o,void 0,e),e[n]!==c&&(e[n]=c,s=1);return n!==`rule`&&JDe(e,r,a),s}}}}));function mX(e){this.type=e}function XDe(e){switch(e.type){case XX:return e.elements;case ZX:case eZ:return[e.left,e.right];case QX:return[e.callee].concat(e.arguments);case $X:return[e.test,e.consequent,e.alternate];case tZ:return[e.object,e.property];case nZ:return e.properties;case JX:return[e.key,e.value];case rZ:return[e.argument];case YX:case qX:case KX:default:return[]}}function hX(e,t){if(!e)throw Error(`ASSERT: `+t)}function gX(e){return e>=48&&e<=57}function _X(e){return`0123456789abcdefABCDEF`.includes(e)}function vX(e){return`01234567`.includes(e)}function ZDe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function yX(e){return e===10||e===13||e===8232||e===8233}function bX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&BZ.test(String.fromCharCode(e))}function xX(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&VZ.test(String.fromCharCode(e))}function SX(){for(;J1114111||e!==`}`)&&FX({},OZ,RZ),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function wX(){var e=aZ.charCodeAt(J++),t=String.fromCharCode(e);for(e===92&&(aZ.charCodeAt(J)!==117&&FX({},OZ,RZ),++J,e=CX(`u`),(!e||e===`\\`||!bX(e.charCodeAt(0)))&&FX({},OZ,RZ),t=e);J>>=`)return J+=4,{type:mZ,value:o,start:e,end:J};if(a=o.substr(0,3),a===`>>>`||a===`<<=`||a===`>>=`)return J+=3,{type:mZ,value:a,start:e,end:J};if(i=a.substr(0,2),r===i[1]&&`+-<>&|`.includes(r)||i===`=>`)return J+=2,{type:mZ,value:i,start:e,end:J};if(i===`//`&&FX({},OZ,RZ),`<>=!+-*%&|^/`.includes(r))return++J,{type:mZ,value:r,start:e,end:J};FX({},OZ,RZ)}function tOe(e){let t=``;for(;J{if(parseInt(t,16)<=1114111)return`x`;FX({},PZ)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,`x`));try{new RegExp(n)}catch{FX({},PZ)}try{return new RegExp(e,t)}catch{return null}}function aOe(){var e=aZ[J],t,n,r,i;for(hX(e===`/`,`Regular expression literal must start with a slash`),t=aZ[J++],n=!1,r=!1;J=0&&FX({},PZ,n),{value:n,literal:t}}function sOe(){var e,t,n,r;return sZ=null,SX(),e=J,t=aOe(),n=oOe(),r=iOe(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:J}}function cOe(e){return e.type===uZ||e.type===dZ||e.type===cZ||e.type===fZ}function DX(){if(SX(),J>=oZ)return{type:lZ,start:J,end:J};let e=aZ.charCodeAt(J);return bX(e)?eOe():e===40||e===41||e===59?TX():e===39||e===34?rOe():e===46?gX(aZ.charCodeAt(J+1))?EX():TX():gX(e)?EX():TX()}function OX(){let e=sZ;return J=e.end,sZ=DX(),J=e.end,e}function kX(){let e=J;sZ=DX(),J=e}function lOe(e){let t=new mX(_Z);return t.elements=e,t}function AX(e,t,n){let r=new mX(e===`||`||e===`&&`?CZ:vZ);return r.operator=e,r.left=t,r.right=n,r}function uOe(e,t){let n=new mX(yZ);return n.callee=e,n.arguments=t,n}function dOe(e,t,n){let r=new mX(bZ);return r.test=e,r.consequent=t,r.alternate=n,r}function jX(e){let t=new mX(xZ);return t.name=e,t}function MX(e){let t=new mX(SZ);return t.value=e.value,t.raw=aZ.slice(e.start,e.end),e.regex&&(t.raw===`//`&&(t.raw=`/(?:)/`),t.regex=e.regex),t}function NX(e,t,n){let r=new mX(wZ);return r.computed=e===`[`,r.object=t,r.property=n,r.computed||(n.member=!0),r}function fOe(e){let t=new mX(TZ);return t.properties=e,t}function PX(e,t,n){let r=new mX(EZ);return r.key=t,r.value=n,r.kind=e,r}function pOe(e,t){let n=new mX(DZ);return n.operator=e,n.argument=t,n.prefix=!0,n}function FX(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(e,t)=>(hX(t`:case`<=`:case`>=`:case`instanceof`:case`in`:t=7;break;case`<<`:case`>>`:case`>>>`:t=8;break;case`+`:case`-`:t=9;break;case`*`:case`/`:case`%`:t=11;break}return t}function wOe(){var e=sZ,t,n,r,i,a,o,s,c=HX(),l;if(r=sZ,i=UX(r),i===0)return c;for(r.prec=i,OX(),t=[e,sZ],o=HX(),a=[c,r,o];(i=UX(sZ))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,c=a.pop(),t.pop(),n=AX(s,c,o),a.push(n);r=OX(),r.prec=i,a.push(r),t.push(sZ),n=HX(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=AX(a[l-1].value,a[l-2],n),l-=2;return n}function WX(){var e=wOe(),t,n;return RX(`?`)&&(OX(),t=WX(),LX(`:`),n=WX(),e=dOe(e,t,n)),e}function GX(){let e=WX();if(RX(`,`))throw Error(zZ);return e}function TOe(e){aZ=e,J=0,oZ=aZ.length,sZ=null,kX();let t=GX();if(sZ.type!==lZ)throw Error(`Unexpect token after expression.`);return t}var KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,J,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ,AZ,jZ,MZ,NZ,PZ,FZ,IZ,LZ,RZ,zZ,BZ,VZ,HZ,UZ,EOe=o((()=>{Fg(),KX=`RawCode`,qX=`Literal`,JX=`Property`,YX=`Identifier`,XX=`ArrayExpression`,ZX=`BinaryExpression`,QX=`CallExpression`,$X=`ConditionalExpression`,eZ=`LogicalExpression`,tZ=`MemberExpression`,nZ=`ObjectExpression`,rZ=`UnaryExpression`,mX.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=XDe(this),n=0,r=t.length;n`,iZ[uZ]=`Identifier`,iZ[dZ]=`Keyword`,iZ[fZ]=`Null`,iZ[pZ]=`Numeric`,iZ[mZ]=`Punctuator`,iZ[hZ]=`String`,iZ[gZ]=`RegularExpression`,_Z=`ArrayExpression`,vZ=`BinaryExpression`,yZ=`CallExpression`,bZ=`ConditionalExpression`,xZ=`Identifier`,SZ=`Literal`,CZ=`LogicalExpression`,wZ=`MemberExpression`,TZ=`ObjectExpression`,EZ=`Property`,DZ=`UnaryExpression`,OZ=`Unexpected token %0`,kZ=`Unexpected number`,AZ=`Unexpected string`,jZ=`Unexpected identifier`,MZ=`Unexpected reserved word`,NZ=`Unexpected end of input`,PZ=`Invalid regular expression`,FZ=`Invalid regular expression: missing /`,IZ=`Octal literals are not allowed in strict mode.`,LZ=`Duplicate data property in object literal not allowed in strict mode`,RZ=`ILLEGAL`,zZ=`Disabled.`,BZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),VZ=RegExp(`[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]`),HZ={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1},UZ={if:1}})),DOe=c({accessPathDepth:()=>CQ,accessPathWithDatum:()=>gQ,accessWithDatumToUnescapedPath:()=>vQ,compile:()=>uLe,contains:()=>eQ,deepEqual:()=>AQ,deleteNestedProperty:()=>mQ,duplicate:()=>q2,entries:()=>Y2,every:()=>nQ,fieldIntersection:()=>cQ,flatAccessWithDatum:()=>_Q,getFirstDefined:()=>wQ,hasIntersection:()=>oQ,hasProperty:()=>Y,hash:()=>QZ,internalField:()=>EQ,isBoolean:()=>uQ,isEmpty:()=>lQ,isEqual:()=>kOe,isInternalField:()=>DQ,isNullOrFalse:()=>$Z,isNumeric:()=>kQ,isPrimitive:()=>dQ,keys:()=>$,logicalExpr:()=>pQ,mergeDeep:()=>rQ,never:()=>YZ,normalize:()=>KMe,normalizeAngle:()=>OQ,omit:()=>ZZ,pick:()=>XZ,prefixGenerator:()=>sQ,removePathFromField:()=>SQ,replaceAll:()=>xQ,replacePathInField:()=>bQ,resetIdCounter:()=>jOe,setEqual:()=>aQ,some:()=>tQ,stringify:()=>jQ,titleCase:()=>hQ,unescapeSingleQuoteAndPathDot:()=>yQ,unique:()=>iQ,uniqueId:()=>TQ,vals:()=>J2,varName:()=>fQ,version:()=>TBe});function WZ(e){return Y(e,`or`)}function GZ(e){return Y(e,`and`)}function KZ(e){return Y(e,`not`)}function qZ(e,t){if(KZ(e))qZ(e.not,t);else if(GZ(e))for(let n of e.and)qZ(n,t);else if(WZ(e))for(let n of e.or)qZ(n,t);else t(e)}function JZ(e,t){return KZ(e)?{not:JZ(e.not,t)}:GZ(e)?{and:e.and.map(e=>JZ(e,t))}:WZ(e)?{or:e.or.map(e=>JZ(e,t))}:t(e)}function YZ(e){throw Error(e)}function XZ(e,t){let n={};for(let r of t)_g(e,r)&&(n[r]=e[r]);return n}function ZZ(e,t){let n={...e};for(let e of t)delete n[e];return n}function QZ(e){if(wg(e))return e;let t=Eg(e)?e:jQ(e);if(t.length<250)return t;let n=0;for(let e=0;et===0?e:`[${e}]`),r=e.map((t,n)=>e.slice(0,n+1).join(``));for(let e of r)t.add(e)}return t}function cQ(e,t){return e===void 0||t===void 0||oQ(sQ(e),sQ(t))}function lQ(e){return $(e).length===0}function uQ(e){return e===!0||e===!1}function dQ(e){return Eg(e)||wg(e)||uQ(e)}function fQ(e){let t=e.replace(/\W/g,`_`);return(e.match(/^\d+/)?`_`:``)+t}function pQ(e,t){return KZ(e)?`!(${pQ(e.not,t)})`:GZ(e)?`(${e.and.map(e=>pQ(e,t)).join(`) && (`)})`:WZ(e)?`(${e.or.map(e=>pQ(e,t)).join(`) || (`)})`:t(e)}function mQ(e,t){if(t.length===0)return!0;let n=t.shift();return n in e&&mQ(e[n],t)&&delete e[n],lQ(e)}function hQ(e){return e.charAt(0).toUpperCase()+e.substr(1)}function gQ(e,t=`datum`){let n=mh(e),r=[];for(let e=1;e<=n.length;e++){let i=`[${n.slice(0,e).map(W).join(`][`)}]`;r.push(`${t}${i}`)}return r.join(` && `)}function _Q(e,t=`datum`){return`${t}[${W(mh(e).join(`.`))}]`}function vQ(e){return`datum['${e.replaceAll(`'`,`\\'`)}']`}function yQ(e){return e.replaceAll(`\\'`,`'`).replaceAll(`\\.`,`.`)}function AOe(e){return e.replace(/(\[|\]|\.|'|")/g,`\\$1`)}function bQ(e){return`${mh(e).map(AOe).join(`\\.`)}`}function xQ(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`),`g`),n)}function SQ(e){return`${mh(e).join(`.`)}`}function CQ(e){return e?mh(e).length:0}function wQ(...e){return e.find(e=>e!==void 0)}function TQ(e){let t=++X2;return e?String(e)+t:t}function jOe(){X2=42}function EQ(e){return DQ(e)?e:`__${e}`}function DQ(e){return e.startsWith(`__`)}function OQ(e){if(e!==void 0)return(e%360+360)%360}function kQ(e){return wg(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}function AQ(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!AQ(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;for(let n of e.entries())if(!AQ(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==Z2.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==Z2.toString)return e.toString()===t.toString();let i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!AQ(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function jQ(e){let t=[];return(function e(n){if(n?.toJSON&&typeof n.toJSON==`function`&&(n=n.toJSON()),n===void 0)return;if(typeof n==`number`)return isFinite(n)?`${n}`:`null`;if(typeof n!=`object`)return JSON.stringify(n);let r,i;if(Array.isArray(n)){for(i=`[`,r=0;ri$(e[t])?fQ(`_${t}_${Y2(e[t])}`):fQ(`_${t}_${e[t]}`)).join(``)}`}function t$(e){return e===!0||r$(e)&&!e.binned}function n$(e){return e===`binned`||r$(e)&&e.binned===!0}function r$(e){return Dh(e)}function i$(e){return Y(e,`param`)}function a$(e){switch(e){case Q2:case $2:case b4:case g4:case _4:case v4:case T4:case S4:case C4:case w4:case y4:return 6;case E4:return 4;default:return 10}}function o$(e){return Y(e,`expr`)}function s$(e,{level:t}={level:0}){let n=$(e||{}),r={};for(let i of n)r[i]=t===0?h$(e[i]):s$(e[i],{level:t-1});return r}function c$(e){let{anchor:t,frame:n,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:u,subtitleFontStyle:d,subtitleFontWeight:f,subtitleLineHeight:p,subtitlePadding:m,...h}=e,g={...h,...s?{fill:s}:{}},_={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a===void 0?{}:{angle:a},...o===void 0?{}:{limit:o}},v={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...u?{subtitleFontSize:u}:{},...d?{subtitleFontStyle:d}:{},...f?{subtitleFontWeight:f}:{},...p?{subtitleLineHeight:p}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:g,subtitleMarkConfig:XZ(e,[`align`,`baseline`,`dx`,`dy`,`limit`]),nonMarkTitleProperties:_,subtitle:v}}function l$(e){return Eg(e)||H(e)&&Eg(e[0])}function u$(e){return Y(e,`signal`)}function d$(e){return Y(e,`step`)}function f$(e){return!H(e)&&Y(e,`fields`)&&!Y(e,`data`)}function zOe(e){return!H(e)&&Y(e,`fields`)&&Y(e,`data`)}function p$(e){return!H(e)&&Y(e,`field`)&&Y(e,`data`)}function m$(e){let t=H(e.condition)?e.condition.map(g$):g$(e.condition);return{...h$(e),condition:t}}function h$(e){if(o$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function g$(e){if(o$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return e}function _$(e){if(o$(e)){let{expr:t,...n}=e;return{signal:t,...n}}return u$(e)?e:e===void 0?void 0:{value:e}}function BOe(e){return u$(e)?e.signal:W(e)}function v$(e){return u$(e)?e.signal:W(e.value)}function y$(e){return u$(e)?e.signal:e==null?null:W(e)}function VOe(e,t,n){for(let r of n){let n=S$(r,t.markDef,t.config);n!==void 0&&(e[r]=_$(n))}return e}function b$(e){return[].concat(e.type,e.style??[])}function x$(e,t,n,r={}){let{vgChannel:i,ignoreVgConfig:a}=r;return i&&Y(t,i)?t[i]:t[e]===void 0?a&&(!i||i===e)?void 0:S$(e,t,n,r):t[e]}function S$(e,t,n,{vgChannel:r}={}){let i=C$(e,t,n.style);return wQ(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function C$(e,t,n){return w$(e,b$(t),n)}function w$(e,t,n){t=ng(t);let r;for(let i of t){let t=n[i];Y(t,e)&&(r=t[e])}return r}function T$(e,t){return ng(e).reduce((e,n)=>(e.field.push(Q(n,t)),e.order.push(n.sort??`ascending`),e),{field:[],order:[]})}function E$(e,t){let n=[...e];return t.forEach(e=>{for(let t of n)if(AQ(t,e))return;n.push(e)}),n}function D$(e,t){return AQ(e,t)||!t?e:e?[...ng(e),...ng(t)].join(`, `):t}function O$(e,t){let n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((l$(n)||u$(n))&&(l$(r)||u$(r)))return{explicit:e.explicit,value:D$(n,r)};if(l$(n)||u$(n))return{explicit:e.explicit,value:n};if(l$(r)||u$(r))return{explicit:e.explicit,value:r};if(!l$(n)&&!u$(n)&&!l$(r)&&!u$(r))return{explicit:e.explicit,value:E$(n,r)};throw Error(`It should never reach here`)}function k$(e){return`Invalid specification ${jQ(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function A$(e){return`${e==`width`?`Width`:`Height`} "container" only works for single views and layered views.`}function j$(e){return`${e==`width`?`Width`:`Height`} "container" only works well with autosize "fit" or "fit-${e==`width`?`x`:`y`}".`}function M$(e){return e?`Dropping "fit-${e}" because spec has discrete ${VQ(e)}.`:`Dropping "fit" because spec has discrete size.`}function N$(e){return`Unknown field for ${e}. Cannot calculate view size.`}function P$(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function HOe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function UOe(e){return`The "nearest" transform is not supported for ${e} marks.`}function F$(e){return`Selection not supported for ${e} yet.`}function WOe(e){return`Cannot find a selection named "${e}".`}function GOe(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function KOe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}function qOe(e){return`Unknown repeated value "${e}".`}function I$(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function JOe(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${W(e)}.`}function YOe(e,t,n,r){return`${e.length?`Multiple `:`No `}matching ${W(t)} encoding found for selection ${W(n.param)}. Using "field": ${W(r)}.`}function XOe(e){return`Unrecognized parse "${e}".`}function L$(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function ZOe(e){return`Ignoring an invalid transform: ${jQ(e)}.`}function R$(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function QOe(e){let{parentProjection:t,projection:n}=e;return`Layer's shared projection ${jQ(t)} is overridden by a child projection ${jQ(n)}.`}function $Oe(e){return`${e}Offset dropped because ${e} is continuous`}function eke(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${jQ(n)}}.`}function z$(e){return`Invalid field type "${e}".`}function tke(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function nke(e){return`Invalid aggregation operator "${e}".`}function B$(e,t){let{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?`fill and stroke`:n?`fill`:`stroke`}.`}function rke(e){return`Position range does not support relative band size for ${e}.`}function V$(e,t){return`Dropping ${jQ(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function H$(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function ike(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function ake(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function oke(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function ske(e){return`Facet encoding dropped as ${e.join(` and `)} ${e.length>1?`are`:`is`} also specified.`}function U$(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t===`ordinal`?`order`:`magnitude`}.`}function cke(e){return`The ${e} for range marks cannot be an expression`}function lke(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?`x2 and y2`:e?`x2`:`y2`}. We will use the rule mark (line segments) instead.`}function uke(e,t){return`Specified orient "${e}" overridden with "${t}".`}function dke(e){return`Cannot use the scale property "${e}" with non-color channel.`}function fke(e){return`Cannot use the relative band size with ${e} scale.`}function pke(e){return`Using unaggregated domain with raw field has no effect (${jQ(e)}).`}function mke(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function hke(e){return`Unaggregated domain is currently unsupported for log scale (${jQ(e)}).`}function gke(e){return`Cannot apply size to non-oriented mark "${e}".`}function _ke(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function vke(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function yke(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function bke(e){return`The step for "${e}" is dropped because the ${e===`width`?`x`:`y`} is continuous.`}function xke(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${jQ(n)} and ${jQ(r)}). Using ${jQ(n)}.`}function Ske(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${jQ(n)} and ${jQ(r)}). Using the union of the two domains.`}function Cke(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function wke(e){return`Dropping sort property ${jQ(e)} as unioned domains only support boolean or op "count", "min", and "max".`}function Tke(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function Eke(e){return`Cannot stack "${e}" if there is already "${e}2".`}function Dke(e){return`Stack is applied to a non-linear scale (${e}).`}function Oke(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function W$(e,t){return`Invalid ${e}: ${jQ(t)}.`}function kke(e){return`Dropping day from datetime ${jQ(e)} as day cannot be combined with other units.`}function Ake(e,t){return`${t?`extent `:``}${t&&e?`and `:``}${e?`center `:``}${t&&e?`are `:`is `}not needed when data are aggregated.`}function jke(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function Mke(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function Nke(e){return`1D error band does not support ${e}.`}function Pke(e){return`Channel ${e} is required for "binned" bin.`}function Fke(e){return`Channel ${e} should not be used with "binned" bin.`}function Ike(e){return`Domain for ${e} is required for threshold scale.`}function Lke(e){return e3=e,e3}function Rke(){return e3=$4,e3}function G$(...e){e3.error(...e)}function X(...e){e3.warn(...e)}function zke(...e){e3.debug(...e)}function K$(e){if(e&&Dh(e)){for(let t of i3)if(Y(e,t))return!0}return!1}function Bke(e){if(kQ(e)&&(e=+e),wg(e))return e>4&&X(W$(`quarter`,e)),e-1;throw Error(W$(`quarter`,e))}function Vke(e){if(kQ(e)&&(e=+e),wg(e))return e-1;{let t=e.toLowerCase(),n=t3.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=wRe.indexOf(r);if(i!==-1)return i;throw Error(W$(`month`,e))}}function Hke(e){if(kQ(e)&&(e=+e),wg(e))return e%7;{let t=e.toLowerCase(),n=n3.indexOf(t);if(n!==-1)return n;let r=t.substr(0,3),i=TRe.indexOf(r);if(i!==-1)return i;throw Error(W$(`day`,e))}}function q$(e,t){let n=[];if(t&&e.day!==void 0&&$(e).length>1&&(X(kke(e)),e=q2(e),delete e.day),e.year===void 0?n.push(2012):n.push(e.year),e.month!==void 0){let r=t?Vke(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){let r=t?Bke(e.quarter):e.quarter;n.push(wg(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){let r=t?Hke(e.day):e.day;n.push(wg(r)?r+1:`${r}+1`)}else n.push(1);for(let t of[`hours`,`minutes`,`seconds`,`milliseconds`]){let r=e[t];n.push(r===void 0?0:r)}return n}function J$(e){let t=q$(e,!0).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function Uke(e){let t=q$(e,!1).join(`, `);return e.utc?`utc(${t})`:`datetime(${t})`}function Wke(e){let t=q$(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}function Gke(e){return _g(r3,e)}function Y$(e){return Dh(e)?e.binned:Kke(e)}function Kke(e){return e?.startsWith(`binned`)}function X$(e){return e.startsWith(`utc`)}function qke(e){return e.substring(3)}function Z$(e){return i3.filter(t=>Yke(e,t))}function Jke(e){let t=Z$(e);return t[t.length-1]}function Yke(e,t){let n=e.indexOf(t);return!(n<0||n>0&&t===`seconds`&&e.charAt(n-1)===`i`||e.length>n+3&&t===`day`&&e.charAt(n+3)===`o`||n>0&&t===`year`&&e.charAt(n-1)===`f`)}function Xke(e,t,{end:n}={end:!1}){let r=gQ(t),i=X$(e)?`utc`:``;function a(e){return e===`quarter`?`(${i}quarter(${r})-1)`:`${i}${e}(${r})`}let o,s={};for(let t of i3)Yke(e,t)&&(s[t]=a(t),o=t);return n&&(s[o]+=`+1`),Uke(s)}function Zke(e){if(e)return`timeUnitSpecifier(${jQ(Z$(e))}, ${jQ(ERe)})`}function Qke(e,t,n){if(!e)return;let r=Zke(e);return`${n||X$(e)?`utc`:`time`}Format(${t}, ${r})`}function Q$(e){if(!e)return;let t;return Eg(e)?t=Kke(e)?{unit:e.substring(6),binned:!0}:{unit:e}:Dh(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),X$(t.unit)&&(t.utc=!0,t.unit=qke(t.unit)),t}function $ke(e){let{utc:t,...n}=Q$(e);return n.unit?(t?`utc`:``)+$(n).map(e=>fQ(`${e===`unit`?``:`_${e}_`}${n[e]}`)).join(``):`${t?`utc`:``}timeunit${$(n).map(e=>fQ(`_${e}_${n[e]}`)).join(``)}`}function eAe(e,t=e=>e){let n=Q$(e),r=Jke(n.unit);if(r&&r!==`day`){let e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:a}=nAe(r,n.step);return`${t(J$({...e,[a]:+e[a]+i}))} - ${t(J$(e))}`}}function tAe(e){return _g(DRe,e)}function nAe(e,t=1){if(tAe(e))return{part:e,step:t};switch(e){case`day`:case`dayofyear`:return{part:`date`,step:t};case`quarter`:return{part:`month`,step:t*3};case`week`:return{part:`date`,step:t*7}}}function rAe(e){return Y(e,`param`)}function $$(e){return!!e?.field&&e.equal!==void 0}function e1(e){return!!e?.field&&e.lt!==void 0}function t1(e){return!!e?.field&&e.lte!==void 0}function n1(e){return!!e?.field&&e.gt!==void 0}function r1(e){return!!e?.field&&e.gte!==void 0}function i1(e){return!!(e?.field&&(H(e.range)&&e.range.length===2||u$(e.range)))}function a1(e){return!!e?.field&&(H(e.oneOf)||H(e.in))}function iAe(e){return!!e?.field&&e.valid!==void 0}function aAe(e){return a1(e)||$$(e)||i1(e)||e1(e)||n1(e)||t1(e)||r1(e)}function o1(e,t){return i0(e,{timeUnit:t,wrapTime:!0})}function oAe(e,t){return e.map(e=>o1(e,t))}function sAe(e,t=!0){let{field:n}=e,{unit:r,binned:i}=Q$(e.timeUnit)||{},a=Q(e,{expr:`datum`}),o=r?`time(${i?a:Xke(r,n)})`:a;if($$(e))return`${o}===${o1(e.equal,r)}`;if(e1(e)){let t=e.lt;return`${o}<${o1(t,r)}`}else if(n1(e)){let t=e.gt;return`${o}>${o1(t,r)}`}else if(t1(e)){let t=e.lte;return`${o}<=${o1(t,r)}`}else if(r1(e)){let t=e.gte;return`${o}>=${o1(t,r)}`}else if(a1(e))return`indexof([${oAe(e.oneOf,r).join(`,`)}], ${o}) !== -1`;else if(iAe(e))return s1(o,e.valid);else if(i1(e)){let{range:n}=s$(e),i=u$(n)?{signal:`${n.signal}[0]`}:n[0],a=u$(n)?{signal:`${n.signal}[1]`}:n[1];if(i!==null&&a!==null&&t)return`inrange(${o}, [${o1(i,r)}, ${o1(a,r)}])`;let s=[];return i!==null&&s.push(`${o} >= ${o1(i,r)}`),a!==null&&s.push(`${o} <= ${o1(a,r)}`),s.length>0?s.join(` && `):`true`}throw Error(`Invalid field predicate: ${jQ(e)}`)}function s1(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function cAe(e){return aAe(e)&&e.timeUnit?{...e,timeUnit:Q$(e.timeUnit)}:e}function lAe(e){return e===`quantitative`||e===`temporal`}function c1(e){return e===`ordinal`||e===`nominal`}function uAe(e){if(e)switch(e=e.toLowerCase(),e){case`q`:case o3:return`quantitative`;case`t`:case c3:return`temporal`;case`o`:case s3:return`ordinal`;case`n`:case l3:return`nominal`;case u3:return`geojson`}}function dAe(e,t){let n=f3[e],r=f3[t];return n===r||n===`ordinal-position`&&r===`time`||r===`ordinal-position`&&n===`time`}function fAe(e){return ORe[e]}function pAe(e){return p3.has(e)}function l1(e){return ARe.has(e)}function u1(e){return kRe.has(e)}function d1(e){return m3.has(e)}function f1(e){return h3.has(e)}function mAe(e){return!Eg(e)&&Y(e,`name`)}function hAe(e){return Y(e,`param`)}function gAe(e){return Y(e,`unionWith`)}function _Ae(e){return Dh(e)&&`field`in e}function p1(e,t){switch(t){case`type`:case`domain`:case`reverse`:case`range`:return!0;case`scheme`:case`interpolate`:return![`point`,`band`,`identity`].includes(e);case`bins`:return![`point`,`band`,`identity`,`ordinal`].includes(e);case`round`:return d1(e)||e===`band`||e===`point`;case`padding`:case`rangeMin`:case`rangeMax`:return d1(e)||[`point`,`band`].includes(e);case`paddingOuter`:case`align`:return[`point`,`band`].includes(e);case`paddingInner`:return e===`band`;case`domainMax`:case`domainMid`:case`domainMin`:case`domainRaw`:case`clamp`:return d1(e);case`nice`:return d1(e)||e===`quantize`||e===`threshold`;case`exponent`:return e===`pow`;case`base`:return e===`log`;case`constant`:return e===`symlog`;case`zero`:return u1(e)&&!eQ([`log`,`time`,`utc`,`threshold`,`quantile`],e)}}function vAe(e,t){switch(t){case`interpolate`:case`scheme`:case`domainMid`:return FQ(e)?void 0:dke(t);case`align`:case`type`:case`bins`:case`domain`:case`domainMax`:case`domainMin`:case`domainRaw`:case`range`:case`base`:case`exponent`:case`constant`:case`nice`:case`padding`:case`paddingInner`:case`paddingOuter`:case`rangeMax`:case`rangeMin`:case`reverse`:case`round`:case`clamp`:case`zero`:return}}function yAe(e,t){return eQ([s3,l3],t)?e===void 0||l1(e):t===c3?eQ([d3.TIME,d3.UTC,void 0],e):t!==o3||pAe(e)||f1(e)||e===void 0}function bAe(e,t,n=!1){if(!JQ(e))return!1;switch(e){case t4:case n4:case a4:case o4:case l4:case s4:return d1(t)?!0:t===`band`||t===`point`&&!n;case h4:return eQ([`linear`,`band`],t);case b4:case T4:case S4:case C4:case w4:case x4:return d1(t)||f1(t)||eQ([`band`,`point`,`ordinal`],t);case g4:case _4:case v4:return t!==`band`;case E4:case y4:return t===`ordinal`||f1(t)}}function xAe(e){return Dh(e)&&`value`in e}function m1(e){return[`line`,`area`,`trail`].includes(e)}function h1(e){return[`rect`,`bar`,`image`,`arc`,`tick`].includes(e)}function g1(e){return Y(e,`type`)}function _1(e){return Y(e,`band`)}function SAe(e){return g1(e)?e.type:e}function CAe(e,{isPath:t}){return e===void 0||e===`break-paths-show-path-domains`?t?`break-paths-show-domains`:`filter`:e===null?`show`:e}function v1({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){if(!r||!u1(r)||i)return`always-valid`;let a=CAe(x$(`invalid`,e,t),{isPath:m1(e.type)});return t.scale?.invalid?.[n]===void 0?a:`show`}function wAe(e){return e===`break-paths-filter-domains`||e===`break-paths-show-domains`}function TAe({scaleName:e,scale:t,mode:n}){let r=`domain('${e}')`;if(!t||!e)return;let i=`${r}[0]`,a=`peek(${r})`,o=t.domainHasZero();return o===`definitely`?{scale:e,value:0}:o===`maybe`?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n===`zeroOrMin`?i:a})`}:{signal:`scale('${e}', ${n===`zeroOrMin`?i:a})`}}function EAe({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:a}){let o=n?.get(`type`),s=Q1(t),c=v1({scaleChannel:e,markDef:i,config:a,scaleType:o,isCountAggregate:$Q(s?.aggregate)});if(s&&c===`show`){let t=a.scale.invalid?.[e]??`zero-or-min`;return{test:s1(Q(s,{expr:`datum`}),!1),...DAe(t,n,r)}}}function DAe(e,t,n){if(xAe(e)){let{value:t}=e;return u$(t)?{signal:t.signal}:{value:t}}return TAe({scale:t,scaleName:n,mode:`zeroOrMin`})}function y1(e){let{channel:t,channelDef:n,markDef:r,scale:i,scaleName:a,config:o}=e,s=RQ(t),c=S1(e),l=EAe({scaleChannel:s,channelDef:n,scale:i,scaleName:a,markDef:r,config:o});return l===void 0?c:[l,c]}function OAe(e){let{datum:t}=e;return K$(t)?J$(t):`${jQ(t)}`}function b1(e,t,n,r){let i={};if(t&&(i.scale=t),z1(e)){let{datum:t}=e;K$(t)?i.signal=J$(t):u$(t)?i.signal=t.signal:o$(t)?i.signal=t.expr:i.value=t}else i.field=Q(e,n);if(r){let{offset:e,band:t}=r;e&&(i.offset=e),t&&(i.band=t)}return i}function x1({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:a=`end`,bandPosition:o=.5}){let s=!u$(o)&&0{let r=i0(t,{timeUnit:Z(e)&&!Y$(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return r===void 0?t:{signal:r}})}function a0(e,t){return t$(e.bin)?JQ(t)&&[`ordinal`,`nominal`].includes(e.type):(console.warn(`Only call this method for binned field defs.`),!1)}function o0(e){return e?.condition}function dje(e){return _g(eze,e)}function s0(e){return Y(e,`mark`)}function c0(e,t){let n=e?.[t];return n?H(n)?tQ(n,e=>!!e.field):Z(n)||I1(n):!1}function fje(e,t){let n=e?.[t];return n?H(n)?tQ(n,e=>!!e.field):Z(n)||z1(n)||L1(n):!1}function pje(e,t){if(WQ(t)){let n=e[t];if((Z(n)||z1(n))&&(c1(n.type)||Z(n)&&n.timeUnit))return fje(e,UQ(t))}return!1}function mje(e){return tQ(gLe,t=>{if(c0(e,t)){let n=e[t];if(H(n))return tQ(n,e=>!!e.aggregate);{let e=Q1(n);return e&&!!e.aggregate}}return!1})}function hje(e,t){let n=[],r=[],i=[],a=[],o={};return u0(e,(s,c)=>{if(Z(s)){let{field:l,aggregate:u,bin:d,timeUnit:f,...p}=s;if(u||f||d){let e=Y1(s)?.title,m=Q(s,{forAs:!0}),h={...e?[]:{title:J1(s,t,{allowDisabling:!0})},...p,field:m};if(u){let e;if(ZQ(u)?(e=`argmax`,m=Q({op:`argmax`,field:u.argmax},{forAs:!0}),h.field=`${m}.${l}`):XQ(u)?(e=`argmin`,m=Q({op:`argmin`,field:u.argmin},{forAs:!0}),h.field=`${m}.${l}`):u!==`boxplot`&&u!==`errorbar`&&u!==`errorband`&&(e=u),e){let t={op:e,as:m};l&&(t.field=l),a.push(t)}}else if(n.push(m),U1(s)&&t$(d)){if(r.push({bin:d,field:l,as:m}),n.push(Q(s,{binSuffix:`end`})),a0(s,c)&&n.push(Q(s,{binSuffix:`range`})),WQ(c)){let e={field:`${m}_end`};o[`${c}2`]=e}h.bin=`binned`,LQ(c)||(h.type=o3)}else if(f&&!Y$(f)){i.push({timeUnit:f,field:l,as:m});let e=U1(s)&&s.type!==c3&&`time`;e&&(c===D4||c===j4?h.formatType=e:POe(c)?h.legend={formatType:e,...h.legend}:WQ(c)&&(h.axis={formatType:e,...h.axis}))}o[c]=h}else n.push(l),o[c]=e[c]}else o[c]=e[c]}),{bins:r,timeUnits:i,aggregate:a,groupby:n,encoding:o}}function gje(e,t,n){let r=IOe(t,n);if(!r)return!1;if(r===`binned`){let n=e[t===r4?t4:n4];return!!(Z(n)&&Z(e[t])&&n$(n.bin))}return!0}function _je(e,t,n,r){let i={};for(let t of $(e))IQ(t)||X(ike(t));for(let a of ELe){if(!e[a])continue;let o=e[a];if(KQ(a)){let e=NOe(a),t=i[e];if(Z(t)&&lAe(t.type)&&Z(o)&&!t.timeUnit){X($Oe(e));continue}}if(a===`angle`&&t===`arc`&&!e.theta&&(X(yRe),a=l4),!gje(e,a,t)){X(H$(a,t));continue}if(a===b4&&t===`line`&&Q1(e[a])?.aggregate){X(bRe);continue}if(a===g4&&(n?`fill`in e:`stroke`in e)){X(B$(`encoding`,{fill:`fill`in e,stroke:`stroke`in e}));continue}if(a===k4||a===O4&&!H(o)&&!W1(o)||a===j4&&H(o)){if(o){if(a===O4){let t=e[a];if(KAe(t)){i[a]=t;continue}}i[a]=ng(o).reduce((e,t)=>(Z(t)?e.push(t0(t,a)):X(V$(t,a)),e),[])}}else{if(a===j4&&o===null)i[a]=null;else if(!Z(o)&&!z1(o)&&!W1(o)&&!F1(o)&&!u$(o)){X(V$(o,a));continue}i[a]=oje(o,a,r)}}return i}function l0(e,t){let n={};for(let r of $(e))n[r]=oje(e[r],r,t,{compositeMark:!0});return n}function vje(e){let t=[];for(let n of $(e))if(c0(e,n)){let r=e[n],i=ng(r);for(let e of i)Z(e)?t.push(e):I1(e)&&t.push(e.condition)}return t}function u0(e,t,n){if(e)for(let r of $(e)){let i=e[r];if(H(i))for(let e of i)t.call(n,e,r);else t.call(n,i,r)}}function yje(e,t,n,r){return e?$(e).reduce((n,i)=>{let a=e[i];return H(a)?a.reduce((e,n)=>t.call(r,e,n,i),n):t.call(r,n,a,i)},n):n}function bje(e,t){return $(t).reduce((n,r)=>{switch(r){case t4:case n4:case M4:case P4:case N4:case r4:case i4:return n;case a4:case o4:if(e===`line`||e===`area`||e===`trail`){let e=t[r];if(Z(e)){let i=t[r===a4?t4:n4];if(Z(i)&&!i.aggregate&&!e.aggregate){let t=Q(i,{}),r=Q(e,{});t&&r&&t!==r&&n.push(t)}}}return n;case l4:case u4:case s4:case c4:case h4:case d4:case f4:case p4:case m4:case D4:case y4:case x4:case j4:return n;case O4:if(e===`line`||e===`trail`)return n;case k4:case A4:{let e=t[r];if(H(e)||Z(e))for(let t of ng(e))t.aggregate||n.push(Q(t,{}));return n}case b4:if(e===`trail`)return n;case g4:case _4:case v4:case S4:case C4:case w4:case E4:case T4:{let e=Q1(t[r]);return e&&!e.aggregate&&n.push(Q(e,{})),n}}},[])}function xje(e){let{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(H(t)){for(let e of t)e.aggregate?(r||=[],r.push(e)):(i||=[],i.push(e));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return H(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function d0(e,t,n,r=!0){if(`tooltip`in n)return{tooltip:n.tooltip};let i=e.map(({fieldPrefix:e,titlePrefix:n})=>{let i=r?` of ${f0(t)}`:``;return{field:e+t.field,type:t.type,title:u$(n)?{signal:`${n}"${escape(i)}"`}:n+i}}),a=vje(n).map(ZAe);return{tooltip:[...i,...iQ(a,QZ)]}}function f0(e){let{title:t,field:n}=e;return wQ(t,n)}function p0(e,t,n,r,i){let{scale:a,axis:o}=n;return({partName:s,mark:c,positionPrefix:l,endPositionPrefix:u=void 0,extraEncoding:d={}})=>{let f=f0(n);return Sje(e,s,i,{mark:c,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...f===void 0?{}:{title:f},...a===void 0?{}:{scale:a},...o===void 0?{}:{axis:o}},...Eg(u)?{[`${t}2`]:{field:`${u}_${n.field}`}}:{},...r,...d}})}}function Sje(e,t,n,r){let{clip:i,color:a,opacity:o}=e,s=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...g1(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(t)}`,...Sg(e[t])?{}:e[t]}}]:[]}function Cje(e,t,n){let{encoding:r}=e,i=t===`vertical`?`y`:`x`,a=r[i],o=r[`${i}2`],s=r[`${i}Error`],c=r[`${i}Error2`];return{continuousAxisChannelDef:m0(a,n),continuousAxisChannelDef2:m0(o,n),continuousAxisChannelDefError:m0(s,n),continuousAxisChannelDefError2:m0(c,n),continuousAxis:i}}function m0(e,t){if(e?.aggregate){let{aggregate:n,...r}=e;return n!==t&&X(Mke(n,t)),r}else return e}function wje(e,t){let{mark:n,encoding:r}=e,{x:i,y:a}=r;if(g1(n)&&n.orient)return n.orient;if(B1(i)){if(B1(a)){let e=Z(i)&&i.aggregate,n=Z(a)&&a.aggregate;if(!e&&n===t)return`vertical`;if(!n&&e===t)return`horizontal`;if(e===t&&n===t)throw Error(`Both x and y cannot have aggregate`);return r0(a)&&!r0(i)?`horizontal`:`vertical`}return`horizontal`}else if(B1(a))return`vertical`;else throw Error(`Need a valid continuous axis for ${t}s`)}function Tje(e){return wg(e)?`tukey`:e}function Eje(e,{config:t}){e={...e,encoding:l0(e.encoding,t)};let{mark:n,encoding:r,params:i,projection:a,...o}=e,s=g1(n)?n:{type:n};i&&X(F$(`boxplot`));let c=s.extent??t.boxplot.extent,l=x$(`size`,s,t),u=s.invalid,d=Tje(c),{bins:f,timeUnits:p,transform:m,continuousAxisChannelDef:h,continuousAxis:g,groupby:_,aggregate:v,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:S}=Oje(e,c,t),C=SQ(h.field),{color:w,size:T,...E}=y,D=e=>p0(s,g,h,e,t.boxplot),O=D(E),k=D(y),A=(Dh(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||`#4c78a8`,j=D({...E,...T?{size:T}:{},color:{condition:{test:`${vQ(`lower_box_${h.field}`)} >= ${vQ(`upper_box_${h.field}`)}`,...w||{value:A}}}}),M=d0([{fieldPrefix:d===`min-max`?`upper_whisker_`:`max_`,titlePrefix:`Max`},{fieldPrefix:`upper_box_`,titlePrefix:`Q3`},{fieldPrefix:`mid_box_`,titlePrefix:`Median`},{fieldPrefix:`lower_box_`,titlePrefix:`Q1`},{fieldPrefix:d===`min-max`?`lower_whisker_`:`min_`,titlePrefix:`Min`}],h,y),ee={type:`tick`,color:`black`,opacity:1,orient:b,invalid:u,aria:!1},N=d===`min-max`?M:d0([{fieldPrefix:`upper_whisker_`,titlePrefix:`Upper Whisker`},{fieldPrefix:`lower_whisker_`,titlePrefix:`Lower Whisker`}],h,y),te=[...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`lower_whisker`,endPositionPrefix:`lower_box`,extraEncoding:N}),...O({partName:`rule`,mark:{type:`rule`,invalid:u,aria:!1},positionPrefix:`upper_box`,endPositionPrefix:`upper_whisker`,extraEncoding:N}),...O({partName:`ticks`,mark:ee,positionPrefix:`lower_whisker`,extraEncoding:N}),...O({partName:`ticks`,mark:ee,positionPrefix:`upper_whisker`,extraEncoding:N})],ne=[...d===`tukey`?[]:te,...k({partName:`box`,mark:{type:`bar`,...l?{size:l}:{},orient:x,invalid:u,ariaRoleDescription:`box`},positionPrefix:`lower_box`,endPositionPrefix:`upper_box`,extraEncoding:M}),...j({partName:`median`,mark:{type:`tick`,invalid:u,...Dh(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:`mid_box`,extraEncoding:M})];if(d===`min-max`)return{...o,transform:(o.transform??[]).concat(m),layer:ne};let P=vQ(`lower_box_${h.field}`),re=vQ(`upper_box_${h.field}`),F=`(${re} - ${P})`,ie=`${P} - ${c} * ${F}`,ae=`${re} + ${c} * ${F}`,oe=vQ(h.field),se={joinaggregate:Dje(h.field),groupby:_},ce={transform:[{filter:`(${ie} <= ${oe}) && (${oe} <= ${ae})`},{aggregate:[{op:`min`,field:h.field,as:`lower_whisker_${C}`},{op:`max`,field:h.field,as:`upper_whisker_${C}`},{op:`min`,field:`lower_box_${h.field}`,as:`lower_box_${C}`},{op:`max`,field:`upper_box_${h.field}`,as:`upper_box_${C}`},...v],groupby:_}],layer:te},{tooltip:le,...ue}=E,{scale:de,axis:fe}=h,pe=f0(h),me=Sje(s,`outliers`,t.boxplot,{transform:[{filter:`(${oe} < ${ie}) || (${oe} > ${ae})`}],mark:`point`,encoding:{[g]:{field:h.field,type:h.type,...pe===void 0?{}:{title:pe},...de===void 0?{}:{scale:de},...fe===void 0?{}:{axis:fe}},...ue,...w?{color:w}:{},...S?{tooltip:S}:{}}})[0],he,ge=[...f,...p,se];return me?he={transform:ge,layer:[me,ce]}:(he=ce,he.transform.unshift(...ge)),{...o,layer:[he,{transform:m,layer:ne}]}}function Dje(e){let t=SQ(e);return[{op:`q1`,field:e,as:`lower_box_${t}`},{op:`q3`,field:e,as:`upper_box_${t}`}]}function Oje(e,t,n){let r=wje(e,V3),{continuousAxisChannelDef:i,continuousAxis:a}=Cje(e,r,V3),o=i.field,s=SQ(o),c=Tje(t),l=[...Dje(o),{op:`median`,field:o,as:`mid_box_${s}`},{op:`min`,field:o,as:(c===`min-max`?`lower_whisker_`:`min_`)+s},{op:`max`,field:o,as:(c===`min-max`?`upper_whisker_`:`max_`)+s}],u=c===`min-max`||c===`tukey`?[]:[{calculate:`${vQ(`upper_box_${s}`)} - ${vQ(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${vQ(`upper_box_${s}`)} + ${vQ(`iqr_${s}`)} * ${t}, ${vQ(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${vQ(`lower_box_${s}`)} - ${vQ(`iqr_${s}`)} * ${t}, ${vQ(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[a]:d,...f}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=xje(f),{bins:h,timeUnits:g,aggregate:_,groupby:v,encoding:y}=hje(m,n),b=r===`vertical`?`horizontal`:`vertical`,x=r;return{bins:h,timeUnits:g,transform:[...h,...g,{aggregate:[..._,...l],groupby:v},...u],groupby:v,aggregate:_,continuousAxisChannelDef:i,continuousAxis:a,encodingWithoutContinuousAxis:y,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:p}}function kje(e,{config:t}){e={...e,encoding:l0(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:c,tooltipEncoding:l}=Pje(e,H3,t);delete a.size;let u=p0(s,i,r,a,t.errorbar),d=s.thickness,f=s.size,p={type:`tick`,orient:o,aria:!1,...d===void 0?{}:{thickness:d},...f===void 0?{}:{size:f}},m=[...u({partName:`ticks`,mark:p,positionPrefix:`lower`,extraEncoding:l}),...u({partName:`ticks`,mark:p,positionPrefix:`upper`,extraEncoding:l}),...u({partName:`rule`,mark:{type:`rule`,ariaRoleDescription:`errorbar`,...d===void 0?{}:{size:d}},positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:l})];return{...c,transform:n,...m.length>1?{layer:m}:{...m[0]}}}function Aje(e,t){let{encoding:n}=e;if(jje(n))return{orient:wje(e,t),inputType:`raw`};let r=Mje(n),i=Nje(n),a=n.x,o=n.y;if(r){if(i)throw Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);let e=n.x2,r=n.y2;if(H1(e)&&H1(r))throw Error(`${t} cannot have both x2 and y2`);if(H1(e)){if(B1(a))return{orient:`horizontal`,inputType:`aggregated-upper-lower`};throw Error(`Both x and x2 have to be quantitative in ${t}`)}else if(H1(r)){if(B1(o))return{orient:`vertical`,inputType:`aggregated-upper-lower`};throw Error(`Both y and y2 have to be quantitative in ${t}`)}throw Error(`No ranged axis`)}else{let e=n.xError,r=n.xError2,i=n.yError,s=n.yError2;if(H1(r)&&!H1(e))throw Error(`${t} cannot have xError2 without xError`);if(H1(s)&&!H1(i))throw Error(`${t} cannot have yError2 without yError`);if(H1(e)&&H1(i))throw Error(`${t} cannot have both xError and yError with both are quantiative`);if(H1(e)){if(B1(a))return{orient:`horizontal`,inputType:`aggregated-error`};throw Error(`All x, xError, and xError2 (if exist) have to be quantitative`)}else if(H1(i)){if(B1(o))return{orient:`vertical`,inputType:`aggregated-error`};throw Error(`All y, yError, and yError2 (if exist) have to be quantitative`)}throw Error(`No ranged axis`)}}function jje(e){return(H1(e.x)||H1(e.y))&&!H1(e.x2)&&!H1(e.y2)&&!H1(e.xError)&&!H1(e.xError2)&&!H1(e.yError)&&!H1(e.yError2)}function Mje(e){return H1(e.x2)||H1(e.y2)}function Nje(e){return H1(e.xError)||H1(e.xError2)||H1(e.yError)||H1(e.yError2)}function Pje(e,t,n){let{mark:r,encoding:i,params:a,projection:o,...s}=e,c=g1(r)?r:{type:r};a&&X(F$(t));let{orient:l,inputType:u}=Aje(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:f,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=Cje(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:_,tooltipSummary:v,tooltipTitleWithFieldName:y}=Fje(c,d,f,p,m,u,t,n),{[h]:b,[h===`x`?`x2`:`y2`]:x,[h===`x`?`xError`:`yError`]:S,[h===`x`?`xError2`:`yError2`]:C,...w}=i,{bins:T,timeUnits:E,aggregate:D,groupby:O,encoding:k}=hje(w,n),A=[...D,...g],j=u===`raw`?O:[],M=d0(v,d,k,y);return{transform:[...s.transform??[],...T,...E,...A.length===0?[]:[{aggregate:A,groupby:j}],..._],groupby:j,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:k,ticksOrient:l===`vertical`?`horizontal`:`vertical`,markDef:c,outerSpec:s,tooltipEncoding:M}}function Fje(e,t,n,r,i,a,o,s){let c=[],l=[],u=t.field,d,f=!1;if(a===`raw`){let t=e.center?e.center:e.extent?e.extent===`iqr`?`median`:`mean`:s.errorbar.center,n=e.extent?e.extent:t===`mean`?`stderr`:`iqr`;if(t===`median`!=(n===`iqr`)&&X(jke(t,n,o)),n===`stderr`||n===`stdev`)c=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],l=[{calculate:`${vQ(`center_${u}`)} + ${vQ(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${vQ(`center_${u}`)} - ${vQ(`extent_${u}`)}`,as:`lower_${u}`}],d=[{fieldPrefix:`center_`,titlePrefix:hQ(t)},{fieldPrefix:`upper_`,titlePrefix:Ije(t,n,`+`)},{fieldPrefix:`lower_`,titlePrefix:Ije(t,n,`-`)}],f=!0;else{let e,t,r;n===`ci`?(e=`mean`,t=`ci0`,r=`ci1`):(e=`median`,t=`q1`,r=`q3`),c=[{op:t,field:u,as:`lower_${u}`},{op:r,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],d=[{fieldPrefix:`upper_`,titlePrefix:J1({field:u,aggregate:r,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`lower_`,titlePrefix:J1({field:u,aggregate:t,type:`quantitative`},s,{allowDisabling:!1})},{fieldPrefix:`center_`,titlePrefix:J1({field:u,aggregate:e,type:`quantitative`},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&X(Ake(e.center,e.extent)),a===`aggregated-upper-lower`?(d=[],l=[{calculate:vQ(n.field),as:`upper_${u}`},{calculate:vQ(u),as:`lower_${u}`}]):a===`aggregated-error`&&(d=[{fieldPrefix:``,titlePrefix:u}],l=[{calculate:`${vQ(u)} + ${vQ(r.field)}`,as:`upper_${u}`}],i?l.push({calculate:`${vQ(u)} + ${vQ(i.field)}`,as:`lower_${u}`}):l.push({calculate:`${vQ(u)} - ${vQ(r.field)}`,as:`lower_${u}`}));for(let e of l)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:xQ(xQ(e.calculate,`datum['`,``),`']`,``)})}return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:d,tooltipTitleWithFieldName:f}}function Ije(e,t,n){return`${hQ(e)} ${n} ${t}`}function Lje(e,{config:t}){e={...e,encoding:l0(e.encoding,t)};let{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:c}=Pje(e,U3,t),l=o,u=p0(l,i,r,a,t.errorband),d=e.encoding.x!==void 0&&e.encoding.y!==void 0,f={type:d?`area`:`rect`},p={type:d?`line`:`rule`},m={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return d?(f={...f,...m,ariaRoleDescription:`errorband`},p={...p,...m,aria:!1}):l.interpolate?X(Nke(`interpolate`)):l.tension&&X(Nke(`tension`)),{...s,transform:n,layer:[...u({partName:`band`,mark:f,positionPrefix:`lower`,endPositionPrefix:`upper`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`lower`,extraEncoding:c}),...u({partName:`borders`,mark:p,positionPrefix:`upper`,extraEncoding:c})]}}function h0(e,t,n){let r=new B3(e,t);W3[e]={normalizer:r,parts:n}}function Rje(){return $(W3)}function g0(e){return e===`legend`||!!e?.legend}function _0(e){return g0(e)&&Dh(e)}function v0(e){return!!e?.select}function zje(e){let t=[];for(let n of e||[]){if(v0(n))continue;let{expr:e,bind:r,...i}=n;if(r&&e){let n={...i,bind:r,init:e};t.push(n)}else{let n={...i,...e?{update:e}:{},...r?{bind:r}:{}};t.push(n)}}return t}function Bje(e){return b0(e)||x0(e)||y0(e)}function y0(e){return Y(e,`concat`)}function b0(e){return Y(e,`vconcat`)}function x0(e){return Y(e,`hconcat`)}function Vje({step:e,offsetIsDiscrete:t}){return t?e.for??`offset`:`position`}function S0(e){return Y(e,`step`)}function Hje(e){return Y(e,`view`)||Y(e,`width`)||Y(e,`height`)}function Uje(e,t,n){let r=n[t],i={},{spacing:a,columns:o}=r;a!==void 0&&(i.spacing=a),o!==void 0&&(M1(e)&&!A1(e.facet)||y0(e))&&(i.columns=o),b0(e)&&(i.columns=1);for(let t of pze)if(e[t]!==void 0)if(t===`spacing`){let n=e[t];i[t]=wg(n)?n:{row:n.row??a,column:n.column??a}}else i[t]=e[t];return i}function C0(e,t){return e[t]??e[t===`width`?`continuousWidth`:`continuousHeight`]}function w0(e,t){let n=T0(e,t);return S0(n)?n.step:Z3}function T0(e,t){return wQ(e[t]??e[t===`width`?`discreteWidth`:`discreteHeight`],{step:e.step})}function Wje(e={}){return{signals:[{name:`color`,value:Dh(e)?{...e6,...e}:e6}],mark:{color:{signal:`color.blue`}},rule:{color:{signal:`color.gray0`}},text:{color:{signal:`color.gray0`}},style:{"guide-label":{fill:{signal:`color.gray0`}},"guide-title":{fill:{signal:`color.gray0`}},"group-title":{fill:{signal:`color.gray0`}},"group-subtitle":{fill:{signal:`color.gray0`}},cell:{stroke:{signal:`color.gray8`}}},axis:{domainColor:{signal:`color.gray13`},gridColor:{signal:`color.gray8`},tickColor:{signal:`color.gray13`}},range:{category:[{signal:`color.blue`},{signal:`color.orange`},{signal:`color.red`},{signal:`color.teal`},{signal:`color.green`},{signal:`color.yellow`},{signal:`color.purple`},{signal:`color.pink`},{signal:`color.brown`},{signal:`color.grey8`}]}}}function Gje(e){return{signals:[{name:`fontSize`,value:Dh(e)?{...$3,...e}:$3}],text:{fontSize:{signal:`fontSize.text`}},style:{"guide-label":{fontSize:{signal:`fontSize.guideLabel`}},"guide-title":{fontSize:{signal:`fontSize.guideTitle`}},"group-title":{fontSize:{signal:`fontSize.groupTitle`}},"group-subtitle":{fontSize:{signal:`fontSize.groupSubtitle`}}}}}function Kje(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function qje(e){let t=$(e||{}),n={};for(let r of t){let t=e[r];n[r]=o0(t)?m$(t):h$(t)}return n}function Jje(e){let t=$(e),n={};for(let r of t)n[r]=qje(e[r]);return n}function Yje(e={}){let{color:t,font:n,fontSize:r,selection:i,...a}=e,o=kh({},q2(mze),n?Kje(n):{},t?Wje(t):{},r?Gje(r):{},a||{});i&&Ah(o,`selection`,i,!0);let s=ZZ(o,hze);for(let e of[`background`,`lineBreak`,`padding`])o[e]&&(s[e]=h$(o[e]));for(let e of A3)o[e]&&(s[e]=s$(o[e]));for(let e of z3)o[e]&&(s[e]=qje(o[e]));for(let e of q3)o[e]&&(s[e]=s$(o[e]));if(o.legend&&(s.legend=s$(o.legend)),o.scale){let{invalid:e,...t}=o.scale,n=s$(e,{level:1});s.scale={...s$(t),...$(n).length>0?{invalid:n}:{}}}return o.style&&(s.style=Jje(o.style)),o.title&&(s.title=s$(o.title)),o.view&&(s.view=s$(o.view)),s}function Xje(e){e=q2(e);for(let t of _ze)delete e[t];if(e.axis)for(let t in e.axis)o0(e.axis[t])&&delete e.axis[t];if(e.legend)for(let t of sze)delete e.legend[t];if(e.mark){for(let t of O3)delete e.mark[t];e.mark.tooltip&&Dh(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(zje(e.params)),delete e.params);for(let t of gze){for(let n of O3)delete e[t][n];let n=vze[t];if(n)for(let r of n)delete e[t][r];Qje(e,t)}for(let t of Rje())delete e[t];Zje(e);for(let t in e)Dh(e[t])&&lQ(e[t])&&delete e[t];return lQ(e)?void 0:e}function Zje(e){let{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=c$(e.title);lQ(t)||(e.style[`group-title`]={...e.style[`group-title`],...t}),lQ(n)||(e.style[`group-subtitle`]={...e.style[`group-subtitle`],...n}),lQ(r)?delete e.title:e.title=r}function Qje(e,t,n,r){let i=e[t];t===`view`&&(n=`cell`);let a={...i,...e.style[n??t]};lQ(a)||(e.style[n??t]=a),delete e[t]}function E0(e){return Y(e,`layer`)}function $je(e){return Y(e,`repeat`)}function eMe(e){return!H(e.repeat)&&Y(e.repeat,`layer`)}function tMe(e){return _g(yze,e)}function D0(e){return Z(e)&&R1(e)===`quantitative`&&!e.bin}function nMe(e,t,{orient:n,type:r}){let i=t===`x`?`y`:`radius`,a=t===`x`&&[`bar`,`area`].includes(r),o=e[t],s=e[i];if(Z(o)&&Z(s)){if(D0(o)&&D0(s)){if(o.stack)return t;if(s.stack)return i;let e=Z(o)&&!!o.aggregate;if(e!==(Z(s)&&!!s.aggregate))return e?t:i;if(a){if(n===`vertical`)return i;if(n===`horizontal`)return t}}else if(D0(o))return t;else if(D0(s))return i}else if(D0(o))return a&&n===`vertical`?void 0:t;else if(D0(s))return a&&n===`horizontal`?void 0:i}function rMe(e){switch(e){case`x`:return`y`;case`y`:return`x`;case`theta`:return`radius`;case`radius`:return`theta`}}function iMe(e,t){let n=g1(e)?e:{type:e},r=n.type;if(!bze.has(r))return null;let i=nMe(t,`x`,n)||nMe(t,`theta`,n);if(!i)return null;let a=t[i],o=Z(a)?Q(a,{}):void 0,s=rMe(i),c=[],l=new Set;if(t[s]){let e=t[s],n=Z(e)?Q(e,{}):void 0;n&&n!==o&&(c.push(s),l.add(n))}let u=s===`x`?`xOffset`:`yOffset`,d=t[u],f=Z(d)?Q(d,{}):void 0;f&&f!==o&&(c.push(u),l.add(f));let p=VLe.reduce((e,n)=>{if(n!==`tooltip`&&c0(t,n)){let r=t[n];for(let t of ng(r)){let r=Q1(t);if(r.aggregate)continue;let i=Q(r,{});(!i||!l.has(i))&&e.push({channel:n,fieldDef:r})}}return e},[]),m;return a.stack===void 0?xze.has(r)&&(m=`zero`):m=Sg(a.stack)?a.stack?`zero`:null:a.stack,!m||!tMe(m)||mje(t)&&p.length===0?null:(a?.scale?.type&&a?.scale?.type!==d3.LINEAR&&a?.stack&&X(Dke(a.scale.type)),H1(t[BQ(i)])?(a.stack!==void 0&&X(Eke(i)),null):(Z(a)&&a.aggregate&&!iRe.has(a.aggregate)&&X(Oke(a.aggregate)),{groupbyChannels:c,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&m1(r),stackBy:p,offset:m}))}function aMe(e,t,n){let r=s$(e),i=x$(`orient`,r,n);if(r.orient=lMe(r.type,t,i),i!==void 0&&i!==r.orient&&X(uke(r.orient,i)),r.type===`bar`&&r.orient){let e=x$(`cornerRadiusEnd`,r,n);if(e!==void 0){let n=r.orient===`horizontal`&&t.x2||r.orient===`vertical`&&t.y2?[`cornerRadius`]:YRe[r.orient];for(let t of n)r[t]=e;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}let a=x$(`opacity`,r,n),o=x$(`fillOpacity`,r,n);return a===void 0&&o===void 0&&(r.opacity=sMe(r.type,t)),x$(`cursor`,r,n)===void 0&&(r.cursor=oMe(r,t,n)),r}function oMe(e,t,n){return t.href||e.href||x$(`href`,e,n)?`pointer`:e.cursor}function sMe(e,t){if(eQ([x3,w3,T3,E3],e)&&!mje(t))return n6}function cMe(e,t,{graticule:n}){if(n)return!1;let r=S$(`filled`,e,t),i=e.type;return wQ(r,i!==x3&&i!==b3&&i!==S3)}function lMe(e,t,n){switch(e){case x3:case T3:case E3:case VRe:case BRe:return}let{x:r,y:i,x2:a,y2:o}=t;switch(e){case C3:case y3:if(Z(r)&&(n$(r.bin)||Z(i)&&i.aggregate&&!r.aggregate))return`vertical`;if(Z(i)&&(n$(i.bin)||Z(r)&&r.aggregate&&!i.aggregate))return`horizontal`;if(o||a){if(n)return n;if(!a)return(Z(r)&&r.type===o3&&!t$(r.bin)||V1(r))&&Z(i)&&n$(i.bin)?`horizontal`:`vertical`;if(!o)return(Z(i)&&i.type===o3&&!t$(i.bin)||V1(i))&&Z(r)&&n$(r.bin)?`vertical`:`horizontal`}case S3:if(a&&!(Z(r)&&n$(r.bin))&&o&&!(Z(i)&&n$(i.bin)))return;case v3:if(o)return Z(i)&&n$(i.bin)?`horizontal`:`vertical`;if(a)return Z(r)&&n$(r.bin)?`vertical`:`horizontal`;if(e===S3){if(r&&!i)return`vertical`;if(i&&!r)return`horizontal`}case b3:case w3:{let t=JAe(r),a=JAe(i);if(n)return n;if(t&&!a)return e===`tick`?`vertical`:`horizontal`;if(!t&&a)return e===`tick`?`horizontal`:`vertical`;if(t&&a)return`vertical`;{let e=U1(r)&&r.type===c3,t=U1(i)&&i.type===c3;if(e&&!t)return`vertical`;if(!e&&t)return`horizontal`}return}}return`vertical`}function uMe(e){let{point:t,line:n,...r}=e;return $(r).length>1?r:r.type}function dMe(e){for(let t of[`line`,`area`,`rule`,`trail`])e[t]&&(e={...e,[t]:ZZ(e[t],[`point`,`line`])});return e}function O0(e,t={},n){return e.point===`transparent`?{opacity:0}:e.point?Dh(e.point)?e.point:{}:e.point===void 0?t.point||n.shape?Dh(t.point)?t.point:{}:void 0:null}function fMe(e,t={}){return e.line?e.line===!0?{}:e.line:e.line===void 0?t.line?t.line===!0?{}:t.line:void 0:null}function pMe(e,t){return t?A1(e)?_Me(e,t):mMe(e,t):e}function k0(e,t){return t?_Me(e,t):e}function A0(e,t,n){let r=t[e];if(HAe(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};X(qOe(r.repeat));return}return t}function mMe(e,t){if(e=A0(`field`,e,t),e!==void 0){if(e===null)return null;if(N1(e)&&k1(e.sort)){let n=A0(`field`,e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function hMe(e,t){if(Z(e))return mMe(e,t);{let n=A0(`datum`,e,t);return n!==e&&!n.type&&(n.type=`nominal`),n}}function gMe(e,t){if(H1(e)){let n=hMe(e,t);if(n)return n;if(F1(e))return{condition:e.condition}}else{if(L1(e)){let n=hMe(e.condition,t);if(n)return{...e,condition:n};{let{condition:t,...n}=e;return n}}return e}}function _Me(e,t){let n={};for(let r in e)if(Y(e,r)){let i=e[r];if(H(i))n[r]=i.map(e=>gMe(e,t)).filter(e=>e);else{let e=gMe(i,t);e!==void 0&&(n[r]=e)}}return n}function vMe({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){let i=new Set([...$(e),...$(t)]);for(let a of i){let i=t[a],o=e[a];if(H1(i)){let e={...o,...i};r[a]=e}else L1(i)?r[a]={...i,condition:{...o,...i.condition}}:i||i===null?r[a]=i:(n||W1(o)||u$(o)||H1(o)||H(o))&&(r[a]=o)}}else r=t;return!r||lQ(r)?void 0:r}function yMe(e){let{parentProjection:t,projection:n}=e;return t&&n&&X(QOe({parentProjection:t,projection:n})),n??t}function j0(e){return Y(e,`filter`)}function bMe(e){return Y(e,`stop`)}function xMe(e){return Y(e,`lookup`)}function SMe(e){return Y(e,`data`)}function CMe(e){return Y(e,`param`)}function wMe(e){return Y(e,`pivot`)}function TMe(e){return Y(e,`density`)}function EMe(e){return Y(e,`quantile`)}function DMe(e){return Y(e,`regression`)}function OMe(e){return Y(e,`loess`)}function kMe(e){return Y(e,`sample`)}function AMe(e){return Y(e,`window`)}function jMe(e){return Y(e,`joinaggregate`)}function MMe(e){return Y(e,`flatten`)}function NMe(e){return Y(e,`calculate`)}function PMe(e){return Y(e,`bin`)}function FMe(e){return Y(e,`impute`)}function IMe(e){return Y(e,`timeUnit`)}function LMe(e){return Y(e,`aggregate`)}function RMe(e){return Y(e,`stack`)}function zMe(e){return Y(e,`fold`)}function BMe(e){return Y(e,`extent`)&&!Y(e,`density`)&&!Y(e,`regression`)}function VMe(e){return e.map(e=>j0(e)?{filter:JZ(e.filter,cAe)}:e)}function HMe(e,t){let{transform:n,...r}=e;if(n){let e=n.map(e=>{if(j0(e))return{filter:M0(e,t)};if(PMe(e)&&r$(e.bin))return{...e,bin:WMe(e.bin)};if(xMe(e)){let{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e});return{...r,transform:e}}return e}function UMe(e,t){let n=q2(e);if(Z(n)&&r$(n.bin)&&(n.bin=WMe(n.bin)),G1(n)&&n.scale?.domain?.selection){let{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(F1(n))if(H(n.condition))n.condition=n.condition.map(e=>{let{selection:n,param:r,test:i,...a}=e;return r?e:{...a,test:M0(e,t)}});else{let{selection:e,param:r,test:i,...a}=UMe(n.condition,t);n.condition=r?n.condition:{...a,test:M0(n.condition,t)}}return n}function WMe(e){let t=e.extent;if(t?.selection){let{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function M0(e,t){let n=e=>JZ(e,e=>{let n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n});return e.selection?n(e.selection):JZ(e.test||e.filter,e=>e.selection?n(e.selection):e)}function GMe(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function KMe(e,t){t===void 0&&(t=Yje(e.config));let n=qMe(e,t),{width:r,height:i}=e,a=YMe(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}function qMe(e,t={}){let n={config:t};return Oze.map(Eze.map(Dze.map(e,n),n),n)}function JMe(e){return Eg(e)?{type:e}:e??{}}function YMe(e,t,n){let{width:r,height:i}=t,a=s0(e)||E0(e),o={};a?r==`container`&&i==`container`?(o.type=`fit`,o.contains=`padding`):r==`container`?(o.type=`fit-x`,o.contains=`padding`):i==`container`&&(o.type=`fit-y`,o.contains=`padding`):(r==`container`&&(X(A$(`width`)),r=void 0),i==`container`&&(X(A$(`height`)),i=void 0));let s={type:`pad`,...o,...n?JMe(n.autosize):{},...JMe(e.autosize)};if(s.type===`fit`&&!a&&(X(lRe),s.type=`pad`),r==`container`&&!(s.type==`fit`||s.type==`fit-x`)&&X(j$(`width`)),i==`container`&&!(s.type==`fit`||s.type==`fit-y`)&&X(j$(`height`)),!AQ(s,{type:`pad`}))return s}function XMe(e){return[`fit`,`fit-x`,`fit-y`].includes(e)}function ZMe(e){return e?`fit-${GQ(e)}`:`fit`}function QMe(e,t){let n={};for(let t of kze)e&&e[t]!==void 0&&(n[t]=h$(e[t]));return t&&(n.params=e.params),n}function N0(e){return{explicit:!0,value:e}}function P0(e){return{explicit:!1,value:e}}function $Me(e){return(t,n,r,i)=>{let a=e(t.value,n.value);return a>0?t:a<0?n:F0(t,n,r,i)}}function F0(e,t,n,r){return e.explicit&&t.explicit&&X(xke(n,r,e.value,t.value)),e}function I0(e,t,n,r,i=F0){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:AQ(e.value,t.value)?e:i(e,t,n,r)}function L0(e){return Y(e,`url`)}function R0(e){return Y(e,`values`)}function eNe(e){return Y(e,`name`)&&!L0(e)&&!R0(e)&&!z0(e)}function z0(e){return e&&(tNe(e)||nNe(e)||B0(e))}function tNe(e){return Y(e,`sequence`)}function nNe(e){return Y(e,`sphere`)}function B0(e){return Y(e,`graticule`)}function rNe({invalid:e,isPath:t}){switch(CAe(e,{isPath:t})){case`filter`:return{marks:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`break-paths-show-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`include-invalid-values`};case`break-paths-filter-domains`:return{marks:t?`include-invalid-values`:`exclude-invalid-values`,scales:`exclude-invalid-values`};case`show`:return{marks:`include-invalid-values`,scales:`include-invalid-values`}}}function iNe(e){let{marks:t,scales:n}=rNe(e);return t===n?a6.Main:n===`include-invalid-values`?a6.PreFilterInvalid:a6.PostFilterInvalid}function V0(e){return e.as!==void 0}function aNe(e){return`${e}_end`}function oNe({timeUnit:e,field:t,reverse:n}){let{unit:r,utc:i}=e,{part:a,step:o}=nAe(Jke(r),e.step);return`${i?`utcOffset`:`timeOffset`}('${a}', ${vQ(t)}, ${n?-o:o})`}function sNe([e,t],n,r){if(n!==void 0&&n!==.5){let i=vQ(e),a=vQ(t);return[{type:`formula`,expr:cNe([oNe({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${l6}`},{type:`formula`,expr:cNe([i,a],n+.5),as:`${e}_${u6}`}]}return[]}function cNe([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}function lNe(e){let{signals:t,hasLegend:n,index:r,...i}=e;return i.field=bQ(i.field),i}function H0(e,t=!0,n=yh){if(H(e)){let r=e.map(e=>H0(e,t,n));return t?`[${r.join(`, `)}]`:r}else if(K$(e))return n(t?J$(e):Wke(e));return t?n(jQ(e)):e}function uNe(e,t){for(let n of J2(e.component.selection??{})){let r=n.name,i=`${r}${L6}, ${n.resolve===`global`?`true`:`{unit: ${i2(e)}}`}`;for(let r of z6)r.defined(n)&&(r.signals&&(t=r.signals(e,n,t)),r.modifyExpr&&(i=r.modifyExpr(e,n,i)));t.push({name:r+Uze,on:[{events:{signal:n.name+L6},update:`modify(${W(n.name+I6)}, ${i})`}]})}return U0(t)}function dNe(e,t){if(e.component.selection&&$(e.component.selection).length){let n=W(e.getName(`cell`));t.unshift({name:`facet`,value:{},on:[{events:tK(`pointermove`,`scope`),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return U0(t)}function fNe(e,t){let n=!1;for(let r of J2(e.component.selection??{})){let i=r.name,a=W(i+I6);if(t.filter(e=>e.name===i).length===0){let e=r.resolve===`global`?`union`:r.resolve,n=r.type===`point`?`, true, true)`:`)`;t.push({name:r.name,update:`${R6}(${a}, ${W(e)}${n}`})}n=!0;for(let n of z6)n.defined(r)&&n.topLevelSignals&&(t=n.topLevelSignals(e,r,t))}return n&&t.filter(e=>e.name===`unit`).length===0&&t.unshift({name:`unit`,value:{},on:[{events:`pointermove`,update:`isTuple(group()) ? group() : unit`}]}),U0(t)}function pNe(e,t){let n=[],r=[],i=i2(e,{escape:!1});for(let a of J2(e.component.selection??{})){let o={name:a.name+I6};if(a.project.hasSelectionId&&(o.transform=[{type:`collect`,sort:{field:Y3}}]),a.init){let e=a.project.items.map(lNe);o.values=a.project.hasSelectionId?a.init.map(e=>({unit:i,[Y3]:H0(e,!1)[0]})):a.init.map(t=>({unit:i,fields:e,values:H0(t,!1)}))}if([...n,...t].filter(e=>e.name===a.name+I6).length||n.push(o),o2(a)&&t.length){let n=e.lookupDataSource(e.getDataName(a6.Main)),i=t.find(e=>e.name===n),a=i.transform.find(e=>e.type===`filter`&&e.expr.includes(`vlSelectionTest`));if(a){i.transform=i.transform.filter(e=>e!==a);let e={name:i.name+f6,source:i.name,transform:[a]};r.push(e)}}}return n.concat(t,r)}function mNe(e,t){for(let n of J2(e.component.selection??{}))for(let r of z6)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function hNe(e,t){for(let n of e.children)F2(n)&&(t=mNe(n,t));return t}function gNe(e,t,n,r){let i=XNe(e,t.param,t);return{signal:u1(n.get(`type`))&&H(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function U0(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}function W0(e,t){return`domain(${W(e.scaleName(t))})`}function G0(e){return e.parent&&R2(e.parent)&&(!e.parent.parent||G0(e.parent.parent))}function _Ne(e,t,n,r){let i=!e.hasProjection,a=n.channel,o=n.signals.visual,s=W(i?e.scaleName(a):e.projectionName()),c=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(a===t4?`width`:`height`).signal,u=`${a}(unit)`,d=t.events.reduce((e,t)=>[...e,{events:t.between[0],update:`[${u}, ${u}]`},{events:t,update:`[${o}[0], clamp(${u}, 0, ${l})]`}],[]);if(i){let i=n.signals.data,l=b6.defined(t),u=e.getScaleComponent(a),f=u?u.get(`type`):void 0,p=r?{init:H0(r,!0,c)}:{value:[]};return d.push({events:{signal:t.name+S6},update:u1(f)?`[${c(`${i}[0]`)}, ${c(`${i}[1]`)}]`:`[0, 0]`}),l?[{name:i,on:[]}]:[{name:o,...p,on:d},{name:i,...r?{init:H0(r)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${s}, ${o})`}]}]}else{let e=a===t4?0:1,n=t.name+w6;return[{name:o,...r?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:d}]}}function K0({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){let a=F1(t)&&t.condition,o=[];a&&(o=ng(a).map(t=>{let n=i(t);if(VAe(t)){let{param:r,empty:i}=t;return{test:YNe(e,{param:r,empty:i}),...n}}else return{test:c2(e,t.test),...n}})),r!==void 0&&o.push(r);let s=i(t);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function q0(e,t=`text`){let n=e.encoding[t];return K0({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>J0(t,e.config),invalidValueRef:void 0})}function J0(e,t,n=`datum`){if(e){if(W1(e))return _$(e.value);if(H1(e)){let{format:r,formatType:i}=Z1(e);return T1({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function vNe(e,t={}){let{encoding:n,markDef:r,config:i,stack:a}=e,o=n.tooltip;if(H(o))return{tooltip:bNe({tooltip:o},a,i,t)};{let s=t.reactiveGeom?`datum.datum`:`datum`;return K0({model:e,channelDef:o,vgChannel:`tooltip`,mainRefFn:e=>{let o=xNe(e,i,s);if(o)return o;if(e===null)return;let c=x$(`tooltip`,r,i);if(c===!0&&(c={content:`encoding`}),Eg(c))return{value:c};if(Dh(c))return u$(c)?c:c.content===`encoding`?bNe(n,a,i,t):{signal:s}},invalidValueRef:void 0})}}function yNe(e,t,n,{reactiveGeom:r}={}){let i={...n,...n.tooltipFormat},a=new Set,o=r?`datum.datum`:`datum`,s=[];function c(n,r){let c=RQ(r),l=U1(n)?n:{...n,type:e[c].type},u=ng(l.title||X1(l,i)).join(`, `).replaceAll(/"/g,`\\"`),d;if(WQ(r)){let t=r===`x`?`x2`:`y2`,n=Q1(e[t]);if(n$(l.bin)&&n){let e=Q(l,{expr:o}),r=Q(n,{expr:o}),{format:s,formatType:c}=Z1(l);d=O1(e,r,s,c,i),a.add(t)}}if((WQ(r)||r===l4||r===s4)&&t&&t.fieldChannel===r&&t.offset===`normalize`){let{format:e,formatType:t}=Z1(l);d=T1({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:i,normalizeStack:!0}).signal}d??=xNe(l,i,o).signal,s.push({channel:r,key:u,value:d})}u0(e,(e,t)=>{Z(e)?c(e,t):I1(e)&&c(e.condition,t)});let l={};for(let{channel:e,key:t,value:n}of s)!a.has(e)&&!l[t]&&(l[t]=n);return l}function bNe(e,t,n,{reactiveGeom:r}={}){let i=yNe(e,t,n,{reactiveGeom:r}),a=Y2(i).map(([e,t])=>`"${e}": ${t}`);return a.length>0?{signal:`{${a.join(`, `)}}`}:void 0}function xNe(e,t,n=`datum`){if(Z(e)&&c1(e.type)&&!e.timeUnit&&!Z1(e).format&&!Z1(e).formatType){let t=`${n}["${e.field}"]`;return{signal:`isValid(${t}) ? isArray(${t}) ? join(${t}, '\\n') : ${t} : ""+${t}`}}return J0(e,t,n)}function SNe(e){let{markDef:t,config:n}=e,r=x$(`aria`,t,n);return r===!1?{}:{...r?{aria:r}:{},...CNe(e),...wNe(e)}}function CNe(e){let{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};let i=x$(`ariaRoleDescription`,n,r);return i==null?_g(sRe,t)?{}:{ariaRoleDescription:{value:t}}:{ariaRoleDescription:{value:i}}}function wNe(e){let{encoding:t,markDef:n,config:r,stack:i}=e,a=t.description;if(a)return K0({model:e,channelDef:a,vgChannel:`description`,mainRefFn:t=>J0(t,e.config),invalidValueRef:void 0});let o=x$(`description`,n,r);if(o!=null)return{description:_$(o)};if(r.aria===!1)return{};let s=yNe(t,i,r);if(!lQ(s))return{description:{signal:Y2(s).filter(([e])=>!e.startsWith(`_`)).map(([e,t])=>[e,t.replaceAll(`\\n`,` `)]).map(([e,t],n)=>`"${n>0?`; `:``}${e}: " + (${t})`).join(` + `)}}}function Y0(e,t,n={}){let{markDef:r,encoding:i,config:a}=t,{vgChannel:o}=n,{defaultRef:s,defaultValue:c}=n,l=i[e];s===void 0&&(c??=x$(e,r,a,{vgChannel:o,ignoreVgConfig:!F1(l)}),c!==void 0&&(s=_$(c)));let u={markDef:r,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},d=EAe({...u,scaleChannel:e,channelDef:l});return K0({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:d,mainRefFn:t=>S1({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function TNe(e,t={filled:void 0}){let{markDef:n,encoding:r,config:i}=e,{type:a}=n,o=t.filled??x$(`filled`,n,i),s=eQ([`bar`,`point`,`circle`,`square`,`geoshape`],a)?`transparent`:void 0,c=x$(o===!0?`color`:void 0,n,i,{vgChannel:`fill`})??i.mark[o===!0&&`color`]??s,l=x$(o===!1?`color`:void 0,n,i,{vgChannel:`stroke`})??i.mark[o===!1&&`color`],u=o?`fill`:`stroke`,d={...c?{fill:_$(c)}:{},...l?{stroke:_$(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&X(B$(`property`,{fill:`fill`in n,stroke:`stroke`in n})),{...d,...Y0(`color`,e,{vgChannel:u,defaultValue:o?c:l}),...Y0(`fill`,e,{defaultValue:r.fill?c:void 0}),...Y0(`stroke`,e,{defaultValue:r.stroke?l:void 0})}}function ENe(e){let{encoding:t,mark:n}=e,r=t.order;return!m1(n)&&W1(r)?K0({model:e,channelDef:r,vgChannel:`zindex`,mainRefFn:e=>_$(e.value),invalidValueRef:void 0}):{}}function X0({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){let a=`${e}Offset`,o=t[a],s=n[a];if((a===`xOffset`||a===`yOffset`)&&s)return{offsetType:`encoding`,offset:S1({channel:a,channelDef:s,markDef:t,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:_$(o),bandPosition:i})};let c=t[a];return c?{offsetType:`visual`,offset:c}:{}}function Z0(e,t,{defaultPos:n,vgChannel:r}){let{encoding:i,markDef:a,config:o,stack:s}=t,c=i[e],l=i[BQ(e)],u=t.scaleName(e),d=t.getScaleComponent(e),{offset:f,offsetType:p}=X0({channel:e,markDef:a,encoding:i,model:t,bandPosition:.5}),m=Q0({model:t,defaultPos:n,channel:e,scaleName:u,scale:d}),h=!c&&WQ(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:DNe({channel:e,channelDef:c,channel2Def:l,markDef:a,config:o,scaleName:u,scale:d,stack:s,offset:f,defaultRef:m,bandPosition:p===`encoding`?0:void 0});return h?{[r||e]:h}:void 0}function DNe(e){let{channel:t,channelDef:n,scaleName:r,stack:i,offset:a,markDef:o}=e;if(H1(n)&&i&&t===i.fieldChannel){if(Z(n)){let e=n.bandPosition;if(e===void 0&&o.type===`text`&&(t===`radius`||t===`theta`)&&(e=.5),e!==void 0)return x1({scaleName:r,fieldOrDatumDef:n,startSuffix:`start`,bandPosition:e,offset:a})}return b1(n,r,{suffix:`end`},{offset:a})}return y1(e)}function Q0({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){let{markDef:a,config:o}=e;return()=>{let s=RQ(n),c=zQ(n),l=x$(n,a,o,{vgChannel:c});if(l!==void 0)return C1(n,l);switch(t){case`zeroOrMin`:return ONe({scaleName:r,scale:i,mode:`zeroOrMin`,mainChannel:s,config:o});case`zeroOrMax`:return ONe({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:o});case`mid`:return{...e[VQ(n)],mult:.5}}}}function ONe({mainChannel:e,config:t,...n}){let r=TAe(n),{mode:i}=n;if(r)return r;switch(e){case`radius`:{if(i===`zeroOrMin`)return{value:0};let{widthSignal:e,heightSignal:t}=i.zeroOrMax;return{signal:`min(${e},${t})/2`}}case`theta`:return i===`zeroOrMin`?{value:0}:{signal:`2*PI`};case`x`:return i===`zeroOrMin`?{value:0}:{field:{group:`width`}};case`y`:return i===`zeroOrMin`?{field:{group:`height`}}:{value:0}}}function kNe(e,t,n,r=`middle`){if(e===`radius`||e===`theta`)return zQ(e);let i=e===`x`?`align`:`baseline`,a=x$(i,t,n),o;return u$(a)?(X(cke(i)),o=void 0):o=a,e===`x`?Rze[o||(r===`top`?`left`:`center`)]:zze[o||r]}function $0(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?ANe(e,t,{defaultPos:n,defaultPos2:r}):Z0(e,t,{defaultPos:n})}function ANe(e,t,{defaultPos:n,defaultPos2:r}){let{markDef:i,config:a}=t,o=BQ(e),s=VQ(e),c=jNe(t,r,o);return{...Z0(e,t,{defaultPos:n,vgChannel:c[s]?kNe(e,i,a):zQ(e)}),...c}}function jNe(e,t,n){let{encoding:r,mark:i,markDef:a,stack:o,config:s}=e,c=RQ(n),l=VQ(n),u=zQ(n),d=r[c],f=e.scaleName(c),p=e.getScaleComponent(c),{offset:m}=n in r||n in a?X0({channel:n,markDef:a,encoding:r,model:e}):X0({channel:c,markDef:a,encoding:r,model:e});if(!d&&(n===`x2`||n===`y2`)&&(r.latitude||r.longitude)){let t=VQ(n),r=e.markDef[t];return r==null?{[u]:{field:e.getName(n)}}:{[t]:{value:r}}}let h=MNe({channel:n,channelDef:d,channel2Def:r[n],markDef:a,config:s,scaleName:f,scale:p,stack:o,offset:m,defaultRef:void 0});return h===void 0?e2(n,a)||e2(n,{[n]:C$(n,a,s.style),[l]:C$(l,a,s.style)})||e2(n,s[i])||e2(n,s.mark)||{[u]:Q0({model:e,defaultPos:t,channel:n,scaleName:f,scale:p})()}:{[u]:h}}function MNe({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:o,stack:s,offset:c,defaultRef:l}){return H1(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?b1(t,a,{suffix:`start`},{offset:c}):y1({channel:e,channelDef:n,scaleName:a,scale:o,stack:s,markDef:r,config:i,offset:c,defaultRef:l})}function e2(e,t){let n=VQ(e),r=zQ(e);if(t[r]!==void 0)return{[r]:C1(e,t[r])};if(t[e]!==void 0)return{[r]:C1(e,t[e])};if(t[n]){let r=t[n];if(_1(r))X(rke(n));else return{[n]:C1(e,r)}}}function t2(e,t){let{config:n,encoding:r,markDef:i}=e,a=i.type,o=BQ(t),s=VQ(t),c=r[t],l=r[o],u=e.getScaleComponent(t),d=u?u.get(`type`):void 0,f=i.orient,p=r[s]??r.size??x$(`size`,i,n,{vgChannel:s}),m=HQ(t),h=a===`bar`&&(t===`x`?f===`vertical`:f===`horizontal`)||a===`tick`&&(t===`y`?f===`vertical`:f===`horizontal`);return Z(c)&&(t$(c.bin)||n$(c.bin)||c.timeUnit&&!l)&&!(p&&!_1(p))&&!r[m]&&!l1(d)?INe({fieldDef:c,fieldDef2:l,channel:t,model:e}):(H1(c)&&l1(d)||h)&&!l?PNe(c,t,e):ANe(t,e,{defaultPos:`zeroOrMax`,defaultPos2:`zeroOrMin`})}function NNe(e,t,n,r,i,a,o){if(_1(i))if(n){let e=n.get(`type`);if(e===`band`){let e=`bandwidth('${t}')`;i.band!==1&&(e=`${i.band} * ${e}`);let n=S$(`minBandSize`,{type:o},r);return{signal:n?`max(${y$(n)}, ${e})`:e}}else i.band!==1&&X(fke(e))}else return{mult:i.band,field:{group:e}};else if(u$(i))return i;else if(i)return{value:i};if(n){let e=n.get(`range`);if(d$(e)&&wg(e.step))return{value:e.step-2}}if(!a){let{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:i,tickBandPaddingInner:a}=r.scale,s=wQ(t,o===`tick`?a:o===`bar`?n:i);if(u$(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(wg(s))return{signal:`${1-s} * ${e}`}}return{value:w0(r.view,e)-2}}function PNe(e,t,n){let{markDef:r,encoding:i,config:a,stack:o}=n,s=r.orient,c=n.scaleName(t),l=n.getScaleComponent(t),u=VQ(t),d=BQ(t),f=HQ(t),p=n.scaleName(f),m=n.getScaleComponent(UQ(t)),h=r.type===`tick`||s===`horizontal`&&t===`y`||s===`vertical`&&t===`x`,g;(i.size||r.size)&&(h?g=Y0(`size`,n,{vgChannel:u,defaultRef:_$(r.size)}):X(gke(r.type)));let _=!!g,v=WAe({channel:t,fieldDef:e,markDef:r,config:a,scaleType:(l||m)?.get(`type`),useVlSizeChannel:h});g||={[u]:NNe(u,p||c,m||l,a,v,!!e,r.type)};let y=kNe(t,r,a,(l||m)?.get(`type`)===`band`&&_1(v)&&!_?`top`:`middle`),b=y===`xc`||y===`yc`,{offset:x,offsetType:S}=X0({channel:t,markDef:r,encoding:i,model:n,bandPosition:b?.5:0}),C=(b&&S!==`encoding`&&Z(e)&&e.timeUnit&&!i[d]?P1({fieldDef:e,markDef:r,config:a}):void 0)??(b?S===`encoding`?0:.5:u$(v)?{signal:`(1-${v})/2`}:_1(v)?(1-v.band)/2:0),w=y1({channel:t,channelDef:e,markDef:r,config:a,scaleName:c,scale:l,stack:o,offset:x,defaultRef:Q0({model:n,defaultPos:`mid`,channel:t,scaleName:c,scale:l}),bandPosition:C});if(u)return{[y]:w,...g};{let e=zQ(d),t=g[u],n=x?{...t,offset:x}:t;return{[y]:w,[e]:H(w)?[w[0],{...w[1],offset:n}]:{...w,offset:n}}}}function FNe(e,t,n,r,i,a,o){if(MQ(e))return 0;let s=e===`x`||e===`y2`,c=s?-t/2:t/2;if(u$(n)||u$(i)||u$(r)||a){let e=y$(n),t=y$(i),l=y$(r),u=y$(a),d=a?`(${o} < ${u} ? ${s?``:`-`}0.5 * (${u} - (${o})) : ${c})`:c,f=l?`${l} + `:``,p=e?`(${e} ? -1 : 1) * `:``,m=t?`(${t} + ${d})`:d;return{signal:f+p+m}}else return i||=0,r+(n?-i-c:+i+c)}function INe({fieldDef:e,fieldDef2:t,channel:n,model:r}){let{config:i,markDef:a,encoding:o}=r,s=r.getScaleComponent(n),c=r.scaleName(n),l=s?s.get(`type`):void 0,u=s.get(`reverse`),d=WAe({channel:n,fieldDef:e,markDef:a,config:i,scaleType:l}),f=(r.component.axes[n]?.[0])?.get(`translate`)??.5,p=WQ(n)?x$(`binSpacing`,a,i)??0:0,m=BQ(n),h=zQ(n),g=zQ(m),_=S$(`minBandSize`,a,i),{offset:v}=X0({channel:n,markDef:a,encoding:o,model:r,bandPosition:0}),{offset:y}=X0({channel:m,markDef:a,encoding:o,model:r,bandPosition:0}),b=kAe({fieldDef:e,scaleName:c}),x=FNe(n,p,u,f,v,_,b),S=FNe(m,p,u,f,y??v,_,b),C=u$(d)?{signal:`(1-${d.signal})/2`}:_1(d)?(1-d.band)/2:.5,w=P1({fieldDef:e,fieldDef2:t,markDef:a,config:i});if(t$(e.bin)||e.timeUnit){let t=e.timeUnit&&w!==.5;return{[g]:LNe({fieldDef:e,scaleName:c,bandPosition:C,offset:S,useRectOffsetField:t}),[h]:LNe({fieldDef:e,scaleName:c,bandPosition:u$(C)?{signal:`1-${C.signal}`}:1-C,offset:x,useRectOffsetField:t})}}else if(n$(e.bin)){let n=b1(e,c,{},{offset:S});if(Z(t))return{[g]:n,[h]:b1(t,c,{},{offset:x})};if(r$(e.bin)&&e.bin.step)return{[g]:n,[h]:{signal:`scale("${c}", ${Q(e,{expr:`datum`})} + ${e.bin.step})`,offset:x}}}X(Pke(m))}function LNe({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return x1({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:l6,endSuffix:u6}:{}})}function n2(e,t){let{fill:n=void 0,stroke:r=void 0}=t.color===`include`?TNe(e):{};return{...zNe(e.markDef,t),...RNe(`fill`,n),...RNe(`stroke`,r),...Y0(`opacity`,e),...Y0(`fillOpacity`,e),...Y0(`strokeOpacity`,e),...Y0(`strokeWidth`,e),...Y0(`strokeDash`,e),...ENe(e),...vNe(e),...q0(e,`href`),...SNe(e)}}function RNe(e,t){return t?{[e]:t}:{}}function zNe(e,t){return oRe.reduce((n,r)=>(!T6.has(r)&&Y(e,r)&&t[r]!==`ignore`&&(n[r]=_$(e[r])),n),{})}function r2(e){let{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,a)=>{let o;if(!JQ(a)||!(o=e.getScaleType(a)))return;let s=$Q(i.aggregate);if(wAe(v1({scaleChannel:a,markDef:n,config:t,scaleType:o,isCountAggregate:s}))){let t=e.vgField(a,{expr:`datum`,binSuffix:e.stack?.impute?`mid`:void 0});t&&r.add(t)}}),r.size>0)return{defined:{signal:[...r].map(e=>s1(e,!0)).join(` && `)}}}function BNe(e,t){if(t!==void 0)return{[e]:_$(t)}}function VNe(e,t,n){let r=e.fieldDef(t)?.field;for(let i of J2(e.component.selection??{})){let e=i.project.hasField[r]??i.project.hasChannel[t];if(e&&j6.defined(i)){let t=n.get(`selections`)??[];t.push(i.name),n.set(`selections`,t,!1),e.hasLegend=!0}}}function HNe(e,t,n,r,i){let a=t.name,o=a+M6,s=a+N6,c=n.channel,l=b6.defined(t),u=i.find(e=>e.name===n.signals[l?`data`:`visual`]),d=e.getSizeSignalRef(r).signal,f=e.getScaleComponent(c),p=f?.get(`type`),m=f?.get(`reverse`),h=l?c===t4?m?``:`-`:m?`-`:``:``,g=`${o}.extent_${c}`,_=`${h}${s}.${c} / ${l?`${d}`:`span(${g})`}`,v=`${!l||!f?`panLinear`:p===`log`?`panLog`:p===`symlog`?`panSymlog`:p===`pow`?`panPow`:`panLinear`}(${g}, ${_}${l?p===`pow`?`, ${f.get(`exponent`)??1}`:p===`symlog`?`, ${f.get(`constant`)??1}`:``:``})`;u.on.push({events:{signal:s},update:l?v:`clampRange(${v}, 0, ${d})`})}function UNe(e,t,n,r,i){let a=t.name,o=n.channel,s=b6.defined(t),c=i.find(e=>e.name===n.signals[s?`data`:`visual`]),l=e.getSizeSignalRef(r).signal,u=e.getScaleComponent(o),d=u?.get(`type`),f=s?W0(e,o):c.name,p=a+F6,m=`${a}${P6}.${o}`,h=`${!s||!u?`zoomLinear`:d===`log`?`zoomLog`:d===`symlog`?`zoomSymlog`:d===`pow`?`zoomPow`:`zoomLinear`}(${f}, ${m}, ${p}${s?d===`pow`?`, ${u.get(`exponent`)??1}`:d===`symlog`?`, ${u.get(`constant`)??1}`:``:``})`;c.on.push({events:{signal:p},update:s?h:`clampRange(${h}, 0, ${l})`})}function WNe(e){let t=e.parent;for(;t&&!I2(t);)t=t.parent;return t}function i2(e,{escape:t}={escape:!0}){let n=t?W(e.name):e.name,r=WNe(e);if(r){let{facet:e}=r;for(let t of z4)e[t]&&(n+=` + '__facet_${t}_' + (facet[${W(r.vgField(t))}])`)}return n}function a2(e){return J2(e.component.selection??{}).reduce((e,t)=>e||t.project.hasSelectionId,!1)}function GNe(e,t){(Eg(t.select)||!t.select.on)&&delete e.events,(Eg(t.select)||!t.select.clear)&&delete e.clear,(Eg(t.select)||!t.select.toggle)&&delete e.toggle}function o2(e){return e.events?.find(e=>`type`in e&&e.type===`timer`)}function s2(e){let t=[];return e.type===`Identifier`?[e.name]:e.type===`Literal`?[e.value]:(e.type===`MemberExpression`&&(t.push(...s2(e.object)),t.push(...s2(e.property))),t)}function KNe(e){return e.object.type===`MemberExpression`?KNe(e.object):e.object.name===`datum`}function qNe(e){let t=TOe(e),n=new Set;return t.visit(e=>{e.type===`MemberExpression`&&KNe(e)&&n.add(s2(e).slice(1).join(`.`))}),n}function JNe(e,t){let n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(let a of t){let t=fQ(a.name),o=a.select,s=Eg(o)?o:o.type,c=Dh(o)?q2(o):{type:s},l=r[s];for(let e in l)e===`fields`||e===`encodings`||(e===`mark`&&(c.mark={...l.mark,...c.mark}),(c[e]===void 0||c[e]===!0)&&(c[e]=q2(l[e]??c[e])));let u=n[t]={...c,name:t,type:s,init:a.value,bind:a.bind,events:Eg(c.on)?tK(c.on,`scope`):ng(q2(c.on))};if(o2(u)&&(i++,i>1)){delete n[t];continue}let d=q2(a);for(let t of z6)t.defined(u)&&t.parse&&t.parse(e,u,d)}return i>1&&X(hRe),n}function YNe(e,t,n,r=`datum`){let i=Eg(t)?t:t.param,a=fQ(i),o=W(a+I6),s;try{s=e.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){let t=n??e.component.data.raw,r=s.project.timeUnit.clone();t.parent?r.insertAsParentOf(t):t.parent=r}let c=`${s.project.hasSelectionId?`vlSelectionIdTest(`:`vlSelectionTest(`}${o}, ${r}${s.resolve===`global`?`)`:`, ${W(s.resolve)})`}`,l=`length(data(${o}))`;return t.empty===!1?`${l} && ${c}`:`!${l} || ${c}`}function XNe(e,t,n){let r=fQ(t),i=n.encoding,a=n.field,o;try{o=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!a)a=o.project.items[0].field,o.project.items.length>1&&X(JOe(a));else if(i&&!a){let e=o.project.items.filter(e=>e.channel===i);!e.length||e.length>1?(a=o.project.items[0].field,X(YOe(e,i,n,a))):a=e[0].field}return`${o.name}[${W(bQ(a))}]`}function ZNe(e,t){for(let[n,r]of Y2(e.component.selection??{})){let i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new s6(new B6(t,e,{param:n}),i,a6.Lookup,e.component.data.outputNodeRefCounts)}}function c2(e,t,n){return pQ(t,t=>Eg(t)?t:rAe(t)?YNe(e,t,n):sAe(t))}function QNe(e,t){if(e)return H(e)&&!l$(e)?e.map(e=>X1(e,t)).join(`, `):e}function l2(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function u2(e,t,n,r={header:!1}){let{disable:i,orient:a,scale:o,labelExpr:s,title:c,zindex:l,...u}=e.combine();if(!i){for(let e in u){let n=e,r=$Re[n],i=u[n];if(r&&r!==t&&r!==`both`)delete u[n];else if(o0(i)){let{condition:e,...t}=i,r=ng(e),a=I3[n];if(a){let{vgProp:e,part:i}=a;l2(u,i,e,[...r.map(e=>{let{test:t,...n}=e;return{test:c2(null,t),...n}}),t]),delete u[n]}else a===null&&(u[n]={signal:r.map(e=>{let{test:t,...n}=e;return`${c2(null,t)} ? ${v$(n)} : `}).join(``)+v$(t)})}else if(u$(i)){let e=I3[n];if(e){let{vgProp:t,part:r}=e;l2(u,r,t,i),delete u[n]}}eQ([`labelAlign`,`labelBaseline`],n)&&u[n]===null&&delete u[n]}if(t===`grid`){if(!u.grid)return;if(u.encode){let{grid:e}=u.encode;u.encode={...e?{grid:e}:{}},lQ(u.encode)&&delete u.encode}return{scale:o,orient:a,...u,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:wQ(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(s!==void 0){let e=s;u.encode?.labels?.update&&u$(u.encode.labels.update.text)&&(e=xQ(s,`datum.label`,u.encode.labels.update.text.signal)),l2(u,`labels`,`text`,{signal:e})}if(u.labelAlign===null&&delete u.labelAlign,u.encode){for(let t of L3)e.hasAxisPart(t)||delete u.encode[t];lQ(u.encode)&&delete u.encode}let t=QNe(c,n);return{scale:o,orient:a,grid:!1,...t?{title:t}:{},...u,...n.aria===!1?{aria:!1}:{},zindex:wQ(l,0)}}}}function $Ne(e){let{axes:t}=e.component,n=[];for(let r of U4)if(t[r]){for(let i of t[r])if(!i.get(`disable`)&&!i.get(`gridScale`)){let t=r===`x`?`height`:`width`,i=e.getSizeSignalRef(t).signal;t!==i&&n.push({name:t,update:i})}}return n}function ePe(e,t){let{x:n=[],y:r=[]}=e;return[...n.map(e=>u2(e,`grid`,t)),...r.map(e=>u2(e,`grid`,t)),...n.map(e=>u2(e,`main`,t)),...r.map(e=>u2(e,`main`,t))].filter(e=>e)}function tPe(e,t,n,r){return Object.assign.apply(null,[{},...e.map(e=>{if(e===`axisOrient`){let e=n===`x`?`bottom`:`left`,i=t[n===`x`?`axisBottom`:`axisLeft`]||{},a=t[n===`x`?`axisTop`:`axisRight`]||{},o=new Set([...$(i),...$(a)]),s={};for(let t of o.values())s[t]={signal:`${r.signal} === "${e}" ? ${y$(i[t])} : ${y$(a[t])}`};return s}return t[e]})])}function nPe(e,t,n,r){let i=t===`band`?[`axisDiscrete`,`axisBand`]:t===`point`?[`axisDiscrete`,`axisPoint`]:pAe(t)?[`axisQuantitative`]:t===`time`||t===`utc`?[`axisTemporal`]:[],a=e===`x`?`axisX`:`axisY`,o=u$(n)?`axisOrient`:`axis${hQ(n)}`,s=[...i,...i.map(e=>a+e.substr(4))],c=[`axis`,o,a];return{vlOnlyAxisConfig:tPe(s,r,e,n),vgAxisConfig:tPe(c,r,e,n),axisConfigStyle:rPe([...c,...s],r)}}function rPe(e,t){let n=[{}];for(let r of e){let e=t[r]?.style;if(e){e=ng(e);for(let r of e)n.push(t.style[r])}}return Object.assign.apply(null,n)}function d2(e,t,n,r={}){let i=w$(e,n,t);if(i!==void 0)return{configFrom:`style`,configValue:i};for(let t of[`vlOnlyAxisConfig`,`vgAxisConfig`,`axisConfigStyle`])if(r[t]?.[e]!==void 0)return{configFrom:t,configValue:r[t][e]};return{}}function iPe(e,t){return!l1(e)&&Z(t)&&!t$(t?.bin)&&!n$(t?.bin)}function aPe(e,t){let n=t===`x`?`y`:`x`;if(e.getScaleComponent(n))return e.scaleName(n)}function oPe(e,t,n,r,i){let a=t?.labelAngle;if(a!==void 0)return u$(a)?a:OQ(a);{let{configValue:a}=d2(`labelAngle`,r,t?.style,i);return a===void 0?n===t4&&eQ([l3,s3],e.type)&&!(Z(e)&&e.timeUnit)?270:void 0:OQ(a)}}function f2(e){return`(((${e.signal} % 360) + 360) % 360)`}function sPe(e,t,n,r){if(e!==void 0)if(n===`x`){if(u$(e)){let n=f2(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${u$(t)?`(${t.signal} === "top")`:t===`top`} ? "bottom" : "top"`}}if(450;if(a||u){let s=t===`row`?`height`:`width`;return{name:e.getName(`${t}_${n}`),type:`group`,role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:xPe(o,t)}:{},...u&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[s]:i.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}function CPe(e,t){return Wze[t][e]}function wPe(e,t){let n={};for(let r of z4){let i=e[r];if(i?.facetFieldDef){let{titleAnchor:e,titleOrient:a}=g2([`titleAnchor`,`titleOrient`],i.facetFieldDef.header,t,r),o=m2(r,a),s=CPe(e,o);s!==void 0&&(n[o]=s)}}return lQ(n)?void 0:n}function TPe(e,t,n,r,i){let a={};for(let o of r){if(!i[o])continue;let r=h2(o,t?.header,e,n);r!==void 0&&(a[i[o]]=r)}return a}function v2(e){return[...y2(e,`width`),...y2(e,`height`),...y2(e,`childWidth`),...y2(e,`childHeight`)]}function y2(e,t){let n=t===`width`?`x`:`y`,r=e.component.layoutSize.get(t);if(r==null||r===`merged`)return[];let i=e.getSizeSignalRef(t).signal;if(r===`step`){let t=e.getScaleComponent(n);if(t){let r=t.get(`type`),a=t.get(`range`);if(l1(r)&&d$(a)){let r=e.scaleName(n);return I2(e.parent)&&e.parent.component.resolve.scale[n]===`independent`?[EPe(r,a)]:[EPe(r,a),{name:i,update:DPe(r,t,`domain('${r}').length`)}]}}throw Error(`layout size is step although width/height is not step.`)}else if(r==`container`){let t=i.endsWith(`width`),n=t?`containerSize()[0]`:`containerSize()[1]`,r=`isFinite(${n}) ? ${n} : ${C0(e.config.view,t?`width`:`height`)}`;return[{name:i,init:r,on:[{update:r,events:`window:resize`}]}]}else return[{name:i,value:r}]}function EPe(e,t){let n=`${e}_step`;return u$(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function DPe(e,t,n){let r=t.get(`type`),i=t.get(`padding`),a=wQ(t.get(`paddingOuter`),i),o=t.get(`paddingInner`);return o=r===`band`?o===void 0?i:o:1,`bandspace(${n}, ${y$(o)}, ${y$(a)}) * ${e}_step`}function OPe(e){return e===`childWidth`?`width`:e===`childHeight`?`height`:e}function kPe(e,t){return $(e).reduce((n,r)=>({...n,...K0({model:t,channelDef:e[r],vgChannel:r,mainRefFn:e=>_$(e.value),invalidValueRef:void 0})}),{})}function APe(e,t){if(I2(t))return e===`theta`?`independent`:`shared`;if(R2(t))return`shared`;if(L2(t))return WQ(e)||e===`theta`||e===`radius`?`independent`:`shared`;throw Error(`invalid model type for resolve`)}function b2(e,t){let n=e.scale[t],r=WQ(t)?`axis`:`legend`;return n===`independent`?(e[r][t]===`shared`&&X(Cke(t)),`independent`):e[r][t]||`shared`}function jPe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:a}){if(a!==`symbol`)return;let{markDef:o,encoding:s,config:c,mark:l}=n,u=o.filled&&l!==`trail`,d={...VOe({},n,KRe),...TNe(n,{filled:u})},f=i.get(`symbolOpacity`)??c.legend.symbolOpacity,p=i.get(`symbolFillColor`)??c.legend.symbolFillColor,m=i.get(`symbolStrokeColor`)??c.legend.symbolStrokeColor,h=f===void 0?FPe(s.opacity)??o.opacity:void 0;if(d.fill){if(r===`fill`||u&&r===g4)delete d.fill;else if(Y(d.fill,`field`))p?delete d.fill:(d.fill=_$(c.legend.symbolBaseFillColor??`black`),d.fillOpacity=_$(h??1));else if(H(d.fill)){let e=x2(s.fill??s.color)??o.fill??(u&&o.color);e&&(d.fill=_$(e))}}if(d.stroke){if(r===`stroke`||!u&&r===g4)delete d.stroke;else if(Y(d.stroke,`field`)||m)delete d.stroke;else if(H(d.stroke)){let e=wQ(x2(s.stroke||s.color),o.stroke,u?o.color:void 0);e&&(d.stroke={value:e})}}if(r!==S4){let e=Z(t)&&LPe(n,i,t);e?d.opacity=[{test:e,..._$(h??1)},_$(c.legend.unselectedOpacity)]:h&&(d.opacity=_$(h))}return d={...d,...e},lQ(d)?void 0:d}function MPe(e,{model:t,legendType:n,legendCmpt:r}){if(n!==`gradient`)return;let{config:i,markDef:a,encoding:o}=t,s={},c=(r.get(`gradientOpacity`)??i.legend.gradientOpacity)===void 0?FPe(o.opacity)||a.opacity:void 0;return c&&(s.opacity=_$(c)),s={...s,...e},lQ(s)?void 0:s}function NPe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){let a=n.legend(r)||{},o=n.config,s=Z(t)?LPe(n,i,t):void 0,c=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:u}=a,d;w1(u)?d=E1({fieldOrDatumDef:t,field:`datum.value`,format:l,formatType:u,config:o}):l===void 0&&u===void 0&&o.customFormatTypes&&(t.type===`quantitative`&&o.numberFormatType?d=E1({fieldOrDatumDef:t,field:`datum.value`,format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type===`temporal`&&o.timeFormatType&&Z(t)&&t.timeUnit===void 0&&(d=E1({fieldOrDatumDef:t,field:`datum.value`,format:o.timeFormat,formatType:o.timeFormatType,config:o})));let f={...c?{opacity:c}:{},...d?{text:d}:{},...e};return lQ(f)?void 0:f}function PPe(e,{legendCmpt:t}){return t.get(`selections`)?.length?{...e,fill:{value:`transparent`}}:e}function FPe(e){return IPe(e,(e,t)=>Math.max(e,t.value))}function x2(e){return IPe(e,(e,t)=>wQ(e,t.value))}function IPe(e,t){if(qAe(e))return ng(e.condition).reduce(t,e.value);if(W1(e))return e.value}function LPe(e,t,n){let r=t.get(`selections`);if(!r?.length)return;let i=W(n.field);return r.map(e=>`(!length(data(${W(fQ(e)+I6)})) || (${e}[${i}] && indexof(${e}[${i}], datum.value) >= 0))`).join(` || `)}function RPe(e,t){let n=e.values;if(H(n))return uje(t,n);if(u$(n))return n}function zPe(e,t,n,r){if(t!==`shape`){let e=x2(n)??r;if(e)return e}switch(e){case`bar`:case`rect`:case`image`:case`square`:return`square`;case`line`:case`trail`:case`rule`:return`stroke`;case`arc`:case`point`:case`circle`:case`tick`:case`geoshape`:case`area`:case`text`:return`circle`}}function BPe(e){let{legend:t}=e;return wQ(t.type,VPe(e))}function VPe({channel:e,timeUnit:t,scaleType:n}){if(FQ(e)){if(eQ([`quarter`,`month`,`day`],t))return`symbol`;if(d1(n))return`gradient`}return`symbol`}function HPe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?`gradientDirection`:`symbolDirection`]??UPe(n,t)}function UPe(e,t){switch(e){case`top`:case`bottom`:return`horizontal`;case`left`:case`right`:case`none`:case void 0:return;default:return t===`gradient`?`horizontal`:void 0}}function WPe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){let{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:o,gradientVerticalMaxLength:s,gradientVerticalMinLength:c}=e;if(d1(i))return n===`horizontal`?r===`top`||r===`bottom`?GPe(t,`width`,o,a):o:GPe(t,`height`,c,s)}function GPe(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function KPe(e){if(eQ([`quantile`,`threshold`,`log`,`symlog`],e))return`greedy`}function qPe(e){let t=F2(e)?JPe(e):QPe(e);return e.component.legends=t,t}function JPe(e){let{encoding:t}=e,n={};for(let r of[g4,...J3]){let i=$1(t[r]);!i||!e.getScaleComponent(r)||r===y4&&Z(i)&&i.type===u3||(n[r]=ZPe(e,r))}return n}function YPe(e,t){let n=e.scaleName(t);if(e.mark===`trail`){if(t===`color`)return{stroke:n};if(t===`size`)return{strokeWidth:n}}return t===`color`?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function XPe(e,t,n,r){switch(t){case`disable`:return n!==void 0;case`values`:return!!n?.values;case`title`:if(t===`title`&&e===r?.title)return!0}return e===(n||{})[t]}function ZPe(e,t){let n=e.legend(t),{markDef:r,encoding:i,config:a}=e,o=a.legend,s=new Gze({},YPe(e,t));VNe(e,t,s);let c=n===void 0?o.disable:!n;if(s.set(`disable`,c,n!==void 0),c)return s;n||={};let l=e.getScaleComponent(t).get(`type`),u=$1(i[t]),d=Z(u)?Q$(u.timeUnit)?.unit:void 0,f=n.orient||a.legend.orient||`right`,p=BPe({legend:n,channel:t,timeUnit:d,scaleType:l}),m=HPe({legend:n,legendType:p,orient:f,legendConfig:o}),h={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:u,legendConfig:o,config:a,scaleType:l,orient:f,legendType:p,direction:m};for(let r of G6){if(p===`gradient`&&r.startsWith(`symbol`)||p===`symbol`&&r.startsWith(`gradient`))continue;let i=r in q6?q6[r](h):n[r];if(i!==void 0){let o=XPe(i,r,n,e.fieldDef(t));(o||a.legend[r]===void 0)&&s.set(r,i,o)}}let g=n?.encoding??{},_=s.get(`selections`),v={},y={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:p};for(let t of[`labels`,`legend`,`title`,`symbols`,`gradient`,`entries`]){let n=kPe(g[t]??{},e),r=t in K6?K6[t](n,y):n;r!==void 0&&!lQ(r)&&(v[t]={..._?.length&&Z(u)?{name:`${fQ(u.field)}_legend_${t}`}:{},..._?.length?{interactive:!0}:{},update:_?.length?{...r,cursor:{value:`pointer`}}:r})}return lQ(v)||s.set(`encode`,v,!!n?.encoding),s}function QPe(e){let{legends:t,resolve:n}=e.component;for(let r of e.children){qPe(r);for(let i of $(r.component.legends))n.legend[i]=b2(e.component.resolve,i),n.legend[i]===`shared`&&(t[i]=$Pe(t[i],r.component.legends[i]),t[i]||(n.legend[i]=`independent`,delete t[i]))}for(let r of $(t))for(let t of e.children)t.component.legends[r]&&n.legend[r]===`shared`&&delete t.component.legends[r];return t}function $Pe(e,t){if(!e)return t.clone();let n=e.getWithExplicit(`orient`),r=t.getWithExplicit(`orient`);if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(let n of G6){let r=I0(e.getWithExplicit(n),t.getWithExplicit(n),n,`legend`,(e,t)=>{switch(n){case`symbolType`:return eFe(e,t);case`title`:return O$(e,t);case`type`:return i=!0,P0(`symbol`)}return F0(e,t,n,`legend`)});e.setWithExplicit(n,r)}return i&&(e.implicit?.encode?.gradient&&mQ(e.implicit,[`encode`,`gradient`]),e.explicit?.encode?.gradient&&mQ(e.explicit,[`encode`,`gradient`])),e}function eFe(e,t){return t.value===`circle`?t:e}function tFe(e,t,n,r){if(a0(t,n)){let i=F2(e)?e.axis(n)??e.legend(n)??{}:{},a=Q(t,{expr:`datum`}),o=Q(t,{expr:`datum`,binSuffix:`end`});return{formulaAs:Q(t,{binSuffix:`range`,forAs:!0}),formula:O1(a,o,i.format,i.formatType,r)}}return{}}function nFe(e,t){return`${e$(e)}_${t}`}function rFe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function S2(e,t,n){let r=nFe(n0(n,void 0)??{},t);return e.getName(`${r}_bins`)}function iFe(e){return`as`in e}function aFe(e,t,n){let r,i;r=iFe(e)?Eg(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Q(e,{forAs:!0}),Q(e,{binSuffix:`end`,forAs:!0})];let a={...n0(t,void 0)},o=nFe(a,e.field),{signal:s,extentSignal:c}=rFe(n,o);if(i$(a.extent)){let e=a.extent;i=XNe(n,e.param,e),delete a.extent}return{key:o,binComponent:{bin:a,field:e.field,as:[r],...s?{signal:s}:{},...c?{extentSignal:c}:{},...i?{span:i}:{}}}}function oFe(e,t,n,r){let i=F2(r)?r.encoding[BQ(t)]:void 0;if(U1(n)&&F2(r)&&GAe(n,i,r.markDef,r.config)){e.add(Q(n,{})),e.add(Q(n,{suffix:`end`}));let{mark:i,markDef:a,config:o}=r,s=P1({fieldDef:n,markDef:a,config:o});h1(i)&&s!==.5&&WQ(t)&&(e.add(Q(n,{suffix:l6})),e.add(Q(n,{suffix:u6}))),n.bin&&a0(n,t)&&e.add(Q(n,{binSuffix:`range`}))}else if(PQ(t)){let n=NQ(t);e.add(r.getName(n))}else e.add(Q(n));return G1(n)&&_Ae(n.scale?.range)&&e.add(n.scale.range.field),e}function sFe(e,t){for(let n of $(t)){let r=t[n];for(let t of $(r))n in e?e[n][t]=new Set([...e[n][t]??[],...r[t]]):e[n]={[t]:r[t]}}}function cFe(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function lFe(e,t){let n=gQ(e);return t===`number`?`toNumber(${n})`:t===`boolean`?`toBoolean(${n})`:t===`string`?`toString(${n})`:t===`date`?`toDate(${n})`:t===`flatten`?n:t.startsWith(`date:`)?`timeParse(${n},'${cFe(t.slice(5,t.length))}')`:t.startsWith(`utc:`)?`utcParse(${n},'${cFe(t.slice(4,t.length))}')`:(X(XOe(t)),null)}function uFe(e){let t={};return qZ(e.filter,e=>{if(aAe(e)){let n=null;$$(e)?n=h$(e.equal):t1(e)?n=h$(e.lte):e1(e)?n=h$(e.lt):n1(e)?n=h$(e.gt):r1(e)?n=h$(e.gte):i1(e)?n=e.range[0]:a1(e)&&(n=(e.oneOf??e.in)[0]),n&&(K$(n)?t[e.field]=`date`:wg(n)?t[e.field]=`number`:Eg(n)&&(t[e.field]=`string`)),e.timeUnit&&(t[e.field]=`date`)}}),t}function dFe(e){let t={};function n(e){r0(e)?t[e.field]=`date`:e.type===`quantitative`&&ROe(e.aggregate)?t[e.field]=`number`:CQ(e.field)>1?e.field in t||(t[e.field]=`flatten`):G1(e)&&k1(e.sort)&&CQ(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]=`flatten`))}if((F2(e)||I2(e))&&e.forEachFieldDef((t,r)=>{if(U1(t))n(t);else{let i=RQ(r),a=e.fieldDef(i);n({...t,type:a.type})}}),F2(e)){let{mark:n,markDef:r,encoding:i}=e;if(m1(n)&&!e.encoding.order){let e=i[r.orient===`horizontal`?`y`:`x`];Z(e)&&e.type===`quantitative`&&!(e.field in t)&&(t[e.field]=`number`)}}return t}function fFe(e){let t={};if(F2(e)&&e.component.selection)for(let n of $(e.component.selection)){let r=e.component.selection[n];for(let e of r.project.items)!e.channel&&CQ(e.field)>1&&(t[e.field]=`flatten`)}return t}function C2(e){return e instanceof t8||e instanceof $6||e instanceof e8}function w2(e){return`isValid(${e}) && isFinite(+${e})`}function pFe(e){return e.stack.stackBy.reduce((e,t)=>{let n=t.fieldDef,r=Q(n);return r&&e.push(r),e},[])}function mFe(e){return H(e)&&e.every(e=>Eg(e))&&e.length>1}function hFe(e){function t(n){if(!(n instanceof X6)){let r=n.clone();if(r instanceof s6){let t=l8+r.getSource();r.setSource(t),e.model.component.data.outputNodes[t]=r}else(r instanceof Y6||r instanceof s8||r instanceof c8||r instanceof a8)&&r.addDimensions(e.fields);for(let e of n.children.flatMap(t))e.parent=r;return[r]}return n.children.flatMap(t)}return t}function T2(e){if(e instanceof X6)if(e.numChildren()===1&&!(e.children[0]instanceof s6)){let t=e.children[0];(t instanceof Y6||t instanceof s8||t instanceof c8||t instanceof a8)&&t.addDimensions(e.fields),t.swapWithParent(),T2(e)}else{let t=e.model.component.data.main;gFe(t);let n=hFe(e),r=e.children.map(n).flat();for(let e of r)e.parent=t}else e.children.map(T2)}function gFe(e){if(e instanceof s6&&e.type===a6.Main&&e.numChildren()===1){let t=e.children[0];t instanceof X6||(t.swapWithParent(),gFe(e))}}function E2(e){for(let t of e){for(let e of t.children)if(e.parent!==t)return!1;if(!E2(t.children))return!1}return!0}function D2(e,t){let n=!1;for(let r of t)n=e.optimize(r)||n;return n}function _Fe(e,t,n){let r=e.sources,i=!1;return i=D2(new Yze,r)||i,i=D2(new qze(t),r)||i,r=r.filter(e=>e.numChildren()>0),i=D2(new Qze,r)||i,r=r.filter(e=>e.numChildren()>0),n||(i=D2(new Xze,r)||i,i=D2(new tBe(t),r)||i,i=D2(new Jze,r)||i,i=D2(new Zze,r)||i,i=D2(new eBe,r)||i,i=D2(new $ze,r)||i,i=D2(new Kze,r)||i,i=D2(new nBe,r)||i),e.sources=r,i}function vFe(e,t){E2(e.sources);let n=0,r=0;for(let r=0;r({signal:`{data: ${i0(e,{timeUnit:n,type:t})}}`}))}function O2(e,t,n){let r=Q$(n)?.unit;return t===`temporal`||r?wFe(e,t,r):[e]}function k2(e,t,n,r){let{encoding:i,markDef:a,mark:o,config:s,stack:c}=n,l=$1(i[r]),{type:u}=l,d=l.timeUnit,f=iNe({invalid:S$(`invalid`,a,s),isPath:m1(o)});if(gAe(t)){let i=k2(e,void 0,n,r);return N0([...O2(t.unionWith,u,d),...i.value])}else if(u$(t))return N0([t]);else if(t&&t!==`unaggregated`&&!hAe(t))return N0(O2(t,u,d));if(c&&r===c.fieldChannel){if(c.offset===`normalize`)return P0([[0,1]]);let e=n.requestDataName(f);return P0([{data:e,field:n.vgField(r,{suffix:`start`})},{data:e,field:n.vgField(r,{suffix:`end`})}])}let p=JQ(r)&&Z(l)?EFe(n,r,e):void 0;if(z1(l))return P0(O2([l.datum],u,d));let m=l;if(t===`unaggregated`){let{field:e}=l;return P0([{data:n.requestDataName(f),field:Q({field:e,aggregate:`min`})},{data:n.requestDataName(f),field:Q({field:e,aggregate:`max`})}])}else if(t$(m.bin)){if(l1(e))return P0(e===`bin-ordinal`?[]:[{data:uQ(p)?n.requestDataName(f):n.requestDataName(a6.Raw),field:n.vgField(r,a0(m,r)?{binSuffix:`range`}:{}),sort:p===!0||!Dh(p)?{field:n.vgField(r,{}),op:`min`}:p}]);{let{bin:e}=m;if(t$(e)){let t=S2(n,m.field,e);return P0([new d8(()=>{let e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}else return P0([{data:n.requestDataName(f),field:n.vgField(r,{})}])}}else if(m.timeUnit&&eQ([`time`,`utc`],e)){let e=i[BQ(r)];if(GAe(m,e,a,s)){let t=n.requestDataName(f),i=P1({fieldDef:m,fieldDef2:e,markDef:a,config:s}),c=h1(o)&&i!==.5&&WQ(r);return P0([{data:t,field:n.vgField(r,c?{suffix:l6}:{})},{data:t,field:n.vgField(r,{suffix:c?u6:`end`})}])}}return P0(p?[{data:uQ(p)?n.requestDataName(f):n.requestDataName(a6.Raw),field:n.vgField(r),sort:p}]:[{data:n.requestDataName(f),field:n.vgField(r)}])}function A2(e,t){let{op:n,field:r,order:i}=e;return{op:n??(t?`sum`:M3),...r?{field:bQ(r)}:{},...i?{order:i}:{}}}function TFe(e,t){let n=e.component.scales[t],r=e.specifiedScales[t].domain,i=e.fieldDef(t)?.bin,a=hAe(r)?r:void 0,o=r$(i)&&i$(i.extent)?i.extent:void 0;(a||o)&&n.set(`selectionExtent`,a??o,!0)}function EFe(e,t,n){if(!l1(n))return;let r=e.fieldDef(t),i=r.sort;if(BAe(i))return{op:`min`,field:p2(r,t),order:`ascending`};let{stack:a}=e,o=a?new Set([...a.groupbyFields,...a.stackBy.map(e=>e.fieldDef.field)]):void 0;if(k1(i))return A2(i,a&&!o.has(i.field));if(zAe(i)){let{encoding:t,order:n}=i,r=e.fieldDef(t),{aggregate:s,field:c}=r,l=a&&!o.has(c);if(XQ(s)||ZQ(s))return A2({field:Q(r),order:n},l);if(QQ(s)||!s)return A2({op:s,field:c,order:n},l)}else if(i===`descending`)return{op:`min`,field:e.vgField(t),order:`descending`};else if(eQ([`ascending`,void 0],i))return!0}function DFe(e,t){let{aggregate:n,type:r}=e;return n?Eg(n)&&!aRe.has(n)?{valid:!1,reason:mke(n)}:r===`quantitative`&&t===`log`?{valid:!1,reason:hke(e)}:{valid:!0}:{valid:!1,reason:pke(e)}}function j2(e,t,n,r){return e.explicit&&t.explicit&&X(Ske(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function OFe(e){let t=iQ(e.map(e=>{if(p$(e)){let{sort:t,...n}=e;return n}return e}),QZ),n=iQ(e.map(e=>{if(p$(e)){let t=e.sort;return t!==void 0&&!uQ(t)&&(`op`in t&&t.op===`count`&&delete t.field,t.order===`ascending`&&delete t.order),t}}).filter(e=>e!==void 0),QZ);if(t.length===0)return;if(t.length===1){let t=e[0];if(p$(t)&&n.length>0){let e=n[0];if(n.length>1){X(Q4);let t=n.filter(e=>Dh(e)&&`op`in e&&e.op!==`min`);e=n.every(e=>Dh(e)&&`op`in e)&&t.length===1?t[0]:!0}else if(Dh(e)&&`field`in e){let n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}let r=iQ(n.map(e=>uQ(e)||!(`op`in e)||Eg(e.op)&&_g(nRe,e.op)?e:(X(wke(e)),!0)),QZ),i;r.length===1?i=r[0]:r.length>1&&(X(Q4),i=!0);let a=iQ(e.map(e=>p$(e)?e.data:null),e=>e);return a.length===1&&a[0]!==null?{data:a[0],fields:t.map(e=>e.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function M2(e){if(p$(e)&&Eg(e.field))return e.field;if(f$(e)){let t;for(let n of e.fields)if(p$(n)&&Eg(n.field)){if(!t)t=n.field;else if(t!==n.field)return X(xRe),t}return X(SRe),t}else if(zOe(e)){X(CRe);let t=e.fields[0];return Eg(t)?t:void 0}}function N2(e,t){return OFe(e.component.scales[t].get(`domains`).map(t=>(p$(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function kFe(e,t,n,r){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=r}function AFe(e,t){if(F2(e)){let n=e.fieldDef(t);if(n?.field)return n.field}let n=(e.children??[]).map(e=>AFe(e,t)).filter(e=>!!e);if(n.length>0){let e=iQ(n,QZ);return e.length===1?e[0]:void 0}}function jFe(e,t,n){if(t===n)return!0;let r=e.getScaleType(t),i=e.getScaleType(n);return!r||!i?!1:l1(r)===l1(i)}function MFe(e,t){return e?`field:${e}`:`channel:${String(t)}`}function NFe(e){if(H(e)){let t=e.filter(dQ);return t.length>0?t:null}if(f$(e)){let t=[];if(t.push(...e.fields.flatMap(e=>H(e)?e.filter(dQ):[])),t.length>0)return iQ(t,QZ)}return null}function P2(e,t){try{return NFe(N2(e,t))}catch{return null}}function PFe(e,t,n){let r=P2(e,t),i=P2(e,n);return r&&i?iQ([...r,...i],QZ):null}function FFe(e,t,n){t&&t.length>0&&(e.getWithExplicit(`values`)?.explicit||(n&&X(n),e.set(`values`,t,!1)))}function IFe(e,t,n){let r=e.getScaleComponent(t),i=e.getScaleComponent(n);if(!r||!i)return!1;let a=r.getWithExplicit(`domains`),o=i.getWithExplicit(`domains`);if(!(a?.explicit&&o?.explicit))return!1;let s=N2(e,t),c=N2(e,n);return QZ(s)===QZ(c)}function LFe(e){let t=e.component.legends,n={};for(let r of $(t)){let i=MFe(AFe(e,r),r);if(!n[i]){n[i]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(let o of n[i])if(jFe(e,o.channel,r)&&$Pe(o.cmpt,t[r])){let t=e.getScaleType(o.channel),n=e.getScaleType(r);t&&n&&l1(t)&&l1(n)&&(IFe(e,o.channel,r)?FFe(o.cmpt,P2(e,o.channel)):FFe(o.cmpt,PFe(e,o.channel,r),Tke(o.channel,r))),a=!0;break}a||n[i].push({channel:r,cmpt:t[r].clone()})}return J2(n).flat().map(t=>RFe(t.cmpt,e.config)).filter(e=>e!==void 0)}function RFe(e,t){let{disable:n,labelExpr:r,selections:i,...a}=e.combine();if(!n){if(t.aria===!1&&a.aria==null&&(a.aria=!1),a.encode?.symbols){let e=a.encode.symbols.update;e.fill&&e.fill.value!==`transparent`&&!e.stroke&&!a.stroke&&(e.stroke={value:`transparent`});for(let t of J3)a[t]&&delete e[t]}if(a.title||delete a.title,r!==void 0){let e=r;a.encode?.labels?.update&&u$(a.encode.labels.update.text)&&(e=xQ(r,`datum.label`,a.encode.labels.update.text.signal)),kFe(a,`labels`,`text`,{signal:e})}return a}}function zFe(e){return R2(e)||L2(e)?BFe(e):VFe(e)}function BFe(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),VFe(e))}function VFe(e){let t=e.component.projection;if(!t||t.merged)return[];let n=t.combine(),{name:r}=n;if(t.data){let i={signal:`[${t.size.map(e=>e.signal).join(`, `)}]`},a=t.data.reduce((t,n)=>{let r=u$(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return eQ(t,r)||t.push(r),t},[]);if(a.length<=0)throw Error(`Projection's fit didn't find any data sources`);return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(`, `)}]`:a[0]},...n}]}else return[{name:r,translate:{signal:`[width / 2, height / 2]`},...n}]}function HFe(e){e.component.projection=F2(e)?UFe(e):KFe(e)}function UFe(e){if(e.hasProjection){let t=s$(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]:void 0,i=n?WFe(e):void 0,a=new f8(e.projectionName(!0),{...s$(e.config.projection),...t},r,i);return a.get(`type`)||a.set(`type`,`equalEarth`,!1),a}}function WFe(e){let t=[],{encoding:n}=e;for(let r of[[f4,d4],[m4,p4]])($1(n[r[0]])||$1(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(y4)&&e.typedFieldDef(y4).type===u3&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(a6.Main)),t}function GFe(e,t){let n=nQ(rBe,n=>!!(!_g(e.explicit,n)&&!_g(t.explicit,n)||_g(e.explicit,n)&&_g(t.explicit,n)&&AQ(e.get(n),t.get(n))));if(AQ(e.size,t.size)){if(n)return e;if(AQ(e.explicit,{}))return t;if(AQ(t.explicit,{}))return e}return null}function KFe(e){if(e.children.length===0)return;let t;for(let t of e.children)HFe(t);let n=nQ(e.children,e=>{let n=e.component.projection;if(!n)return!0;if(t){let e=GFe(t,n);return e&&(t=e),!!e}else return t=n,!0});if(t&&n){let n=e.projectionName(!0),r=new f8(n,t.specifiedProjection,t.size,q2(t.data));for(let t of e.children){let e=t.component.projection;e&&(e.isFit&&r.data.push(...t.component.projection.data),t.renameProjection(e.get(`name`),n),e.merged=!0)}return r}}function qFe(e){return R2(e)||L2(e)?e.children.reduce((e,t)=>e.concat(qFe(t)),JFe(e)):JFe(e)}function JFe(e){return $(e.component.scales).reduce((t,n)=>{let r=e.component.scales[n];if(r.merged)return t;let i=r.combine(),{name:a,type:o,selectionExtent:s,domains:c,range:l,reverse:u,...d}=i,f=YFe(i.range,a,n,e),p=N2(e,n),m=s?gNe(e,s,r,p):null;return t.push({name:a,type:o,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:f,...u===void 0?{}:{reverse:u},...d}),t},[])}function YFe(e,t,n,r){if(WQ(n)){if(d$(e))return{step:{signal:`${t}_step`}}}else if(Dh(e)&&p$(e))return{...e,data:r.lookupDataSource(e.data)};return e}function XFe(e){let t=e.component.scales;for(let n of J4){let r=t[n];if(!r)continue;let i=QFe(n,e);r.setWithExplicit(`range`,i)}}function ZFe(e,t){let n=e.fieldDef(t);if(n?.bin){let{bin:r,field:i}=n,a=VQ(t),o=e.getName(a);if(Dh(r)&&r.binned&&r.step!==void 0)return new d8(()=>{let n=e.scaleName(t),i=`(domain("${n}")[1] - domain("${n}")[0]) / ${r.step}`;return`${e.getSignalName(o)} / (${i})`});if(t$(r)){let t=S2(e,i,r);return new d8(()=>{let n=e.getSignalName(t),r=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(o)} / (${r})`})}}}function QFe(e,t){let n=t.specifiedScales[e],{size:r}=t,i=t.getScaleComponent(e).get(`type`);for(let r of iBe)if(n[r]!==void 0){let a=p1(i,r),o=vAe(e,r);if(!a)X(yke(i,r,e));else if(o)X(o);else switch(r){case`range`:{let r=n.range;if(H(r)){if(WQ(e))return N0(r.map(e=>{if(e===`width`||e===`height`){let n=t.getName(e),r=t.getSignalName.bind(t);return d8.fromName(r,n)}return e}))}else if(Dh(r))return N0({data:t.requestDataName(a6.Main),field:r.field,sort:{op:`min`,field:t.vgField(e)}});return N0(r)}case`scheme`:return N0($Fe(n[r]))}}let a=e===t4||e===`xOffset`?`width`:`height`,o=r[a];if(S0(o)){if(WQ(e))if(l1(i)){let n=nIe(o,t,e);if(n)return N0({step:n})}else X(bke(a));else if(KQ(e)){let n=e===a4?`x`:`y`;if(t.getScaleComponent(n).get(`type`)===`band`){let e=rIe(o,i);if(e)return N0(e)}}}let{rangeMin:s,rangeMax:c}=n,l=tIe(e,t);return(s!==void 0||c!==void 0)&&p1(i,`rangeMin`)&&H(l)&&l.length===2?N0([s??l[0],c??l[1]]):P0(l)}function $Fe(e){return mAe(e)?{scheme:e.name,...ZZ(e,[`name`])}:{scheme:e}}function eIe(e,t,n,{center:r}={}){let i=VQ(e),a=t.getName(i),o=t.getSignalName.bind(t);return e===n4&&u1(n)?r?[d8.fromName(e=>`${o(e)}/2`,a),d8.fromName(e=>`-${o(e)}/2`,a)]:[d8.fromName(o,a),0]:r?[d8.fromName(e=>`-${o(e)}/2`,a),d8.fromName(e=>`${o(e)}/2`,a)]:[0,d8.fromName(o,a)]}function tIe(e,t){let{size:n,config:r,mark:i,encoding:a}=t,{type:o}=$1(a[e]),s=t.getScaleComponent(e).get(`type`),{domain:c,domainMid:l}=t.specifiedScales[e];switch(e){case t4:case n4:if(eQ([`point`,`band`],s)){let i=aIe(e,n,r.view);if(S0(i))return{step:nIe(i,t,e)}}return eIe(e,t,s);case a4:case o4:return iIe(e,t,s);case b4:{let a=cIe(i,r),o=lIe(i,n,t,r);return f1(s)?sIe(a,o,oIe(s,r,c,e)):[a,o]}case l4:return[0,Math.PI*2];case x4:return[0,360];case s4:return[0,new d8(()=>`min(${t.getSignalName(I2(t.parent)?`child_width`:`width`)},${t.getSignalName(I2(t.parent)?`child_height`:`height`)})/2`)];case h4:return{step:1e3/r.scale.framesPerSecond};case T4:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case E4:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case y4:return`symbol`;case g4:case _4:case v4:return s===`ordinal`?o===`nominal`?`category`:`ordinal`:l===void 0?i===`rect`||i===`geoshape`?`heatmap`:`ramp`:`diverging`;case S4:case C4:case w4:return[r.scale.minOpacity,r.scale.maxOpacity]}}function nIe(e,t,n){let{encoding:r}=t,i=t.getScaleComponent(n),a=UQ(n),o=r[a];if(Vje({step:e,offsetIsDiscrete:H1(o)&&c1(o.type)})===`offset`&&fje(r,a)){let n=t.getScaleComponent(a),r=`domain('${t.scaleName(a)}').length`;if(n.get(`type`)===`band`){let e=n.get(`paddingInner`)??n.get(`padding`)??0,t=n.get(`paddingOuter`)??n.get(`padding`)??0;r=`bandspace(${r}, ${e}, ${t})`}let o=i.get(`paddingInner`)??i.get(`padding`);return{signal:`${e.step} * ${r} / (1-${BOe(o)})`}}else return e.step}function rIe(e,t){if(Vje({step:e,offsetIsDiscrete:l1(t)})===`offset`)return{step:e.step}}function iIe(e,t,n){let r=e===a4?`x`:`y`,i=t.getScaleComponent(r);if(!i)return eIe(r,t,n,{center:!0});let a=i.get(`type`),o=t.scaleName(r),{markDef:s,config:c}=t;if(a===`band`){let e=aIe(r,t.size,t.config.view);if(S0(e)){let t=rIe(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}else{let n=t.encoding[r];if(Z(n)&&n.timeUnit){let e=eAe(n.timeUnit,e=>`scale('${o}', ${e})`),r=t.config.scale.bandWithNestedOffsetPaddingInner,i=P1({fieldDef:n,markDef:s,config:c})-.5,a=i===0?``:` + ${i}`;if(r){let t=u$(r)?`${r.signal}/2${a}`:`${r/2+i}`,n=u$(r)?`(1 - ${r.signal}/2)${a}`:`${1-r/2+i}`;return[{signal:`${t} * (${e})`},{signal:`${n} * (${e})`}]}return[0,{signal:e}]}return YZ(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function aIe(e,t,n){let r=e===t4?`width`:`height`,i=t[r];return i===void 0?T0(n,r):i}function oIe(e,t,n,r){switch(e){case`quantile`:return t.scale.quantileCount;case`quantize`:return t.scale.quantizeCount;case`threshold`:return n!==void 0&&H(n)?n.length+1:(X(Ike(r)),3)}}function sIe(e,t,n){let r=()=>{let r=y$(t),i=y$(e),a=`(${r} - ${i}) / (${n} - 1)`;return`sequence(${i}, ${r} + ${a}, ${a})`};return u$(t)?new d8(r):{signal:r()}}function cIe(e,t){switch(e){case`bar`:case`tick`:return t.scale.minBandSize;case`line`:case`trail`:case`rule`:return t.scale.minStrokeWidth;case`text`:return t.scale.minFontSize;case`point`:case`square`:case`circle`:return t.scale.minSize}throw Error(H$(`size`,e))}function lIe(e,t,n,r){let i={x:ZFe(n,`x`),y:ZFe(n,`y`)};switch(e){case`bar`:case`tick`:{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;let e=uIe(t,i,r.view);return wg(e)?e-1:new d8(()=>`${e.signal} - 1`)}case`line`:case`trail`:case`rule`:return r.scale.maxStrokeWidth;case`text`:return r.scale.maxFontSize;case`point`:case`square`:case`circle`:{if(r.scale.maxSize)return r.scale.maxSize;let e=uIe(t,i,r.view);return wg(e)?(m8*e)**2:new d8(()=>`pow(${m8} * ${e.signal}, 2)`)}}throw Error(H$(`size`,e))}function uIe(e,t,n){let r=S0(e.width)?e.width.step:w0(n,`width`),i=S0(e.height)?e.height.step:w0(n,`height`);return t.x||t.y?new d8(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(`, `)})`):Math.min(r,i)}function dIe(e,t){F2(e)?fIe(e,t):mIe(e,t)}function fIe(e,t){let n=e.component.scales,{config:r,encoding:i,markDef:a,specifiedScales:o}=e;for(let s of $(n)){let c=o[s],l=n[s],u=e.getScaleComponent(s),d=$1(i[s]),f=c[t],p=u.get(`type`),m=u.get(`padding`),h=u.get(`paddingInner`),g=p1(p,t),_=vAe(s,t);if(f!==void 0&&(g?_&&X(_):X(yke(p,t,s))),g&&_===void 0)if(f!==void 0){let e=d.timeUnit,n=d.type;switch(t){case`domainMax`:case`domainMin`:K$(c[t])||n===`temporal`||e?l.set(t,{signal:i0(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{let n=Y(h8,t)?h8[t]({model:e,channel:s,fieldOrDatumDef:d,scaleType:p,scalePadding:m,scalePaddingInner:h,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:a,config:r,hasNestedOffsetScale:pje(i,s),hasSecondaryRangeChannel:!!i[BQ(s)]}):r.scale[t];n!==void 0&&l.set(t,n,!1)}}}function pIe(e){F2(e)?XFe(e):mIe(e,`range`)}function mIe(e,t){let n=e.component.scales;for(let n of e.children)t===`range`?pIe(n):dIe(n,t);for(let r of $(n)){let i;for(let n of e.children){let e=n.component.scales[r];if(e){let n=e.getWithExplicit(t);i=I0(i,n,t,`scale`,$Me((e,n)=>{switch(t){case`range`:return e.step&&n.step?e.step-n.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function hIe(e,t){let n=t.bin;if(t$(n)){let r=S2(e,t.field,n);return new d8(()=>e.getSignalName(r))}else if(n$(n)&&r$(n)&&n.step!==void 0)return{step:n.step}}function gIe(e,t){if(eQ([g4,_4,v4],e)&&t!==`nominal`)return`hcl`}function _Ie(e,t,n,r,i,a){if(!(Q1(a)?.bin||H(n)||i!=null||r!=null||eQ([d3.TIME,d3.UTC],e)))return WQ(t)?!0:void 0}function vIe(e,t,n,r,i,a){if(WQ(e)){if(d1(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;let{type:t,orient:o}=i;if(t===`bar`&&!(Z(r)&&(r.bin||r.timeUnit))&&(o===`vertical`&&e===`x`||o===`horizontal`&&e===`y`))return a.continuousBandSize}if(t===d3.POINT)return n.pointPadding}}function yIe(e,t,n,r,i,a=!1){if(e===void 0){if(WQ(t)){let{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r,tickBandPaddingInner:o,bandWithNestedOffsetPaddingInner:s}=i;return a?s:wQ(e,n===`bar`?t:n===`tick`?o:r)}else if(KQ(t)&&r===d3.BAND)return i.offsetBandPaddingInner}}function bIe(e,t,n,r,i,a=!1){if(e===void 0){if(WQ(t)){let{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=i;if(a)return t;if(n===d3.BAND)return wQ(e,u$(r)?{signal:`${r.signal}/2`}:r/2)}else if(KQ(t)){if(n===d3.POINT)return .5;if(n===d3.BAND)return i.offsetBandPaddingOuter}}}function xIe(e,t,n,r){if(n===`x`&&r.xReverse!==void 0)return u1(e)&&t===`descending`?u$(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(u1(e)&&t===`descending`)return!0}function SIe(e,t,n,r,i,a,o){if(n&&n!==`unaggregated`&&u1(i)){if(H(n)){let e=n[0],t=n[n.length-1];if(wg(e)&&e<=0&&wg(t)&&t>=0)return!0}return!1}if(e===`size`&&t.type===`quantitative`&&!f1(i))return!0;if(!(Z(t)&&t.bin)&&eQ([...U4,...HLe],e)){let{orient:t,type:n}=r;return eQ([`bar`,`area`,`line`,`trail`],n)&&(t===`horizontal`&&e===`y`||t===`vertical`&&e===`x`)?!1:eQ([`bar`,`area`],n)&&!o?!0:a?.zero}return!1}function CIe(e,t,n,r,i=!1){let a=wIe(t,n,r,i),{type:o}=e;return JQ(t)?o===void 0?a:bAe(t,o)?Z(n)&&!yAe(o,n.type)?(X(vke(o,a)),a):o:(X(_ke(t,o,a)),a):null}function wIe(e,t,n,r){switch(t.type){case`nominal`:case`ordinal`:{if(FQ(e)||YQ(e)===`discrete`)return e===`shape`&&t.type===`ordinal`&&X(U$(e,`ordinal`)),`ordinal`;if(qQ(e))return`band`;if(WQ(e)||KQ(e)){if(eQ([`rect`,`bar`,`image`,`rule`,`tick`],n.type)||r)return`band`}else if(n.type===`arc`&&e in W4)return`band`;let i=n[VQ(e)];return _1(i)||K1(t)&&t.axis?.tickBand?`band`:`point`}case`temporal`:return FQ(e)?`time`:YQ(e)===`discrete`?(X(U$(e,`temporal`)),`ordinal`):Z(t)&&t.timeUnit&&Q$(t.timeUnit).utc?`utc`:qQ(e)?`band`:`time`;case`quantitative`:return FQ(e)?Z(t)&&t$(t.bin)?`bin-ordinal`:`linear`:YQ(e)===`discrete`?(X(U$(e,`quantitative`)),`ordinal`):qQ(e)?`band`:`linear`;case`geojson`:return}throw Error(z$(t.type))}function TIe(e,{ignoreRange:t}={}){EIe(e),yFe(e);for(let t of zRe)dIe(e,t);t||pIe(e)}function EIe(e){F2(e)?e.component.scales=DIe(e):e.component.scales=OIe(e)}function DIe(e){let{encoding:t,mark:n,markDef:r}=e,i={};for(let a of J4){let o=$1(t[a]);if(o&&n===D3&&a===y4&&o.type===u3)continue;let s=o&&o.scale;if(o&&s!==null&&s!==!1){s??={};let n=pje(t,a),c=CIe(s,a,o,r,n);i[a]=new p8(e.scaleName(`${a}`,!0),{value:c,explicit:s.type===c})}}return i}function OIe(e){let t=e.component.scales={},n={},r=e.component.resolve;for(let t of e.children){EIe(t);for(let i of $(t.component.scales))if(r.scale[i]??=APe(i,e),r.scale[i]===`shared`){let e=n[i],a=t.component.scales[i].getWithExplicit(`type`);e?dAe(e.value,a.value)?n[i]=I0(e,a,`type`,`scale`,aBe):(r.scale[i]=`independent`,delete n[i]):n[i]=a}}for(let r of $(n)){let i=e.scaleName(r,!0),a=n[r];t[r]=new p8(i,a);for(let t of e.children){let e=t.component.scales[r];e&&(t.renameScale(e.get(`name`),i),e.merged=!0)}}return t}function F2(e){return e?.type===`unit`}function I2(e){return e?.type===`facet`}function L2(e){return e?.type===`concat`}function R2(e){return e?.type===`layer`}function kIe(e){let t=0;function n(r,i){if(r instanceof t8&&!r.isGenerator&&!L0(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof Z6&&(r.parent instanceof t8&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof X6){i.name||=`data_${t++}`,!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof $6||r instanceof e8||r instanceof o8||r instanceof B6||r instanceof H6||r instanceof w8||r instanceof Y6||r instanceof D8||r instanceof c8||r instanceof a8||r instanceof S8||r instanceof x8||r instanceof y8||r instanceof E8||r instanceof O8||r instanceof k8||r instanceof Q6||r instanceof j8||r instanceof A8||r instanceof b8)&&i.transform.push(r.assemble()),(r instanceof J6||r instanceof c6||r instanceof T8||r instanceof s8||r instanceof C8)&&i.transform.push(...r.assemble()),r instanceof s6&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof s6?r.setSource(i.name):(i.name||=`data_${t++}`,r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof s6&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||=`data_${t++}`;let a=i.name;!i.source||i.transform.length>0?e.push(i):a=i.source;for(let e of r.children)n(e,{name:null,source:a,transform:[]});break}}}return n}function AIe(e){let t=[],n=kIe(t);for(let t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}function jIe(e,t){let n=[],r=kIe(n),i=0;for(let t of e.sources)t.hasName()||(t.dataName=`source_${i++}`),r(t,t.assemble());for(let e of n)e.transform.length===0&&delete e.transform;let a=0;for(let[e,t]of n.entries())(t.transform??[]).length===0&&!t.source&&n.splice(a++,0,n.splice(e,1)[0]);for(let t of n)for(let n of t.transform??[])n.type===`lookup`&&(n.from=e.outputNodes[n.from].getSource());for(let e of n)e.name in t&&(e.values=t[e.name]);return n}function MIe(e){return e===`top`||e===`left`||u$(e)?`header`:`footer`}function NIe(e){for(let t of z4)PIe(e,t);IIe(e,`x`),IIe(e,`y`)}function PIe(e,t){let{facet:n,config:r,child:i,component:a}=e;if(e.channelHasField(t)){let o=n[t],s=h2(`title`,null,r,t),c=J1(o,r,{allowDisabling:!0,includeDefault:s===void 0||!!s});i.component.layoutHeaders[t].title&&(c=H(c)?c.join(`, `):c,c+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);let l=h2(`labelOrient`,o.header,r,t),u=o.header!==null&&wQ(o.header?.labels,r.header.labels,!0),d=eQ([`bottom`,`right`],l)?`footer`:`header`;a.layoutHeaders[t]={title:o.header===null?null:c,facetFieldDef:o,[d]:t===`facet`?[]:[FIe(e,t,u)]}}}function FIe(e,t,n){let r=t===`row`?`height`:`width`;return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function IIe(e,t){let{child:n}=e;if(n.component.axes[t]){let{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=b2(i,t),i.axis[t]===`shared`){let i=t===`x`?`column`:`row`,a=r[i];for(let r of n.component.axes[t]){let t=MIe(r.get(`orient`));a[t]??=[FIe(e,i,!1)];let n=u2(r,`main`,e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}}function LIe(e){z2(e),B2(e,`width`),B2(e,`height`)}function RIe(e){z2(e);let t=e.layout.columns===1?`width`:`childWidth`,n=e.layout.columns===void 0?`height`:`childHeight`;B2(e,t),B2(e,n)}function z2(e){for(let t of e.children)t.parseLayoutSize()}function B2(e,t){let n=OPe(t),r=GQ(n),i=e.component.resolve,a=e.component.layoutSize,o;for(let t of e.children){let a=t.component.layoutSize.getWithExplicit(n),s=i.scale[r]??APe(r,e);if(s===`independent`&&a.value===`step`){o=void 0;break}if(o){if(s===`independent`&&o.value!==a.value){o=void 0;break}o=I0(o,a,n,``)}else o=a}if(o){for(let r of e.children)e.renameSignal(r.getName(n),e.getName(t)),r.component.layoutSize.set(n,`merged`,!1);a.setWithExplicit(t,o)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function zIe(e){let{size:t,component:n}=e;for(let r of U4){let i=VQ(r);if(t[i]!=null&&t[i]!=null){let e=t[i];n.layoutSize.set(i,S0(e)?`step`:e,!0)}else{let t=BIe(e,i);n.layoutSize.set(i,t,!1)}}}function BIe(e,t){let n=t===`width`?`x`:`y`,r=e.config,i=e.getScaleComponent(n);if(i){let e=i.get(`type`),n=i.get(`range`);if(l1(e)){let e=T0(r.view,t);return d$(n)||S0(e)?`step`:e}else return C0(r.view,t)}else if(e.hasProjection||e.mark===`arc`)return C0(r.view,t);else{let e=T0(r.view,t);return S0(e)?e.step:e}}function V2(e,t,n){return Q(t,{suffix:`by_${Q(e)}`,...n})}function VIe(e,t){let{row:n,column:r}=t;if(n&&r){let t=null;for(let i of[n,r])if(k1(i.sort)){let{field:n,op:r=M3}=i.sort;e=t=new a8(e,{joinaggregate:[{op:r,field:n,as:V2(i,i.sort,{forAs:!0})}],groupby:[Q(i)]})}return t}return null}function HIe(e,t){for(let n of t){let t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;let r=e.format?.mesh,i=t.format?.feature;if(r&&i)continue;let a=e.format?.feature;if((a||i)&&a!==i)continue;let o=t.format?.mesh;if(!((r||o)&&r!==o)){if(R0(e)&&R0(t)){if(AQ(e.values,t.values))return n}else if(L0(e)&&L0(t)){if(e.url===t.url)return n}else if(eNe(e)&&e.name===n.dataName)return n}}return null}function UIe(e,t){if(e.data||!e.parent){if(e.data===null){let e=new t8({values:[]});return t.push(e),e}let n=HIe(e.data,t);if(n)return z0(e.data)||(n.data.format=rQ({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{let n=new t8(e.data);return t.push(n),n}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function WIe(e,t,n){let r=0;for(let i of t.transforms){let a,o;if(NMe(i))o=e=new H6(e,i),a=`derived`;else if(j0(i)){let r=uFe(i);o=e=Z6.makeWithAncestors(e,{},r,n)??e,e=new B6(e,t,i.filter)}else if(PMe(i))o=e=J6.makeFromTransform(e,i,t),a=`number`;else if(IMe(i))a=`date`,n.getWithExplicit(i.field).value===void 0&&(e=new Z6(e,{[i.field]:a}),n.set(i.field,a,!1)),o=e=c6.makeFromTransform(e,i);else if(LMe(i))o=e=Y6.makeFromTransform(e,i),a=`number`,a2(t)&&(e=new Q6(e));else if(xMe(i))o=e=D8.make(e,t,i,r++),a=`derived`;else if(AMe(i))o=e=new c8(e,i),a=`number`;else if(jMe(i))o=e=new a8(e,i),a=`number`;else if(RMe(i))o=e=s8.makeFromTransform(e,i),a=`derived`;else if(zMe(i))o=e=new S8(e,i),a=`derived`;else if(BMe(i))o=e=new b8(e,i),a=`derived`;else if(MMe(i))o=e=new x8(e,i),a=`derived`;else if(wMe(i))o=e=new A8(e,i),a=`derived`;else if(kMe(i))e=new j8(e,i);else if(FMe(i))o=e=T8.makeFromTransform(e,i),a=`derived`;else if(TMe(i))o=e=new y8(e,i),a=`derived`;else if(EMe(i))o=e=new O8(e,i),a=`derived`;else if(DMe(i))o=e=new k8(e,i),a=`derived`;else if(OMe(i))o=e=new E8(e,i),a=`derived`;else{X(ZOe(i));continue}if(o&&a!==void 0)for(let e of o.producedFields()??[])n.set(e,a,!1)}return e}function H2(e){let t=UIe(e,e.component.data.sources),{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,a=!(i&&(z0(i)||L0(i)||R0(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new Aze;z0(i)?(tNe(i)?t=new e8(t,i.sequence):B0(i)&&(t=new $6(t,i.graticule)),a.parseNothing=!0):i?.format?.parse===null&&(a.parseNothing=!0),t=Z6.makeExplicit(t,e,a)??t,t=new Q6(t);let o=e.parent&&R2(e.parent);(F2(e)||I2(e))&&o&&(t=J6.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=WIe(t,e,a));let s=fFe(e),c=dFe(e);t=Z6.makeWithAncestors(t,{},{...s,...c},a)??t,F2(e)&&(t=C8.parseAll(t,e),t=w8.parseAll(t,e)),(F2(e)||I2(e))&&(o||(t=J6.makeFromEncoding(t,e)??t),t=c6.makeFromEncoding(t,e)??t,t=H6.parseAllForSortIndex(t,e));let l=t=U2(a6.Raw,e,t);if(F2(e)){let n=Y6.makeFromEncoding(t,e);n&&(t=n,a2(e)&&(t=new Q6(t))),t=T8.makeFromEncoding(t,e)??t,t=s8.makeFromEncoding(t,e)??t}let u,d;if(F2(e)){let{markDef:n,mark:r,config:i}=e,{marks:a,scales:o}=d=rNe({invalid:x$(`invalid`,n,i),isPath:m1(r)});a!==o&&o===`include-invalid-values`&&(u=t=U2(a6.PreFilterInvalid,e,t)),a===`exclude-invalid-values`&&(t=o8.make(t,e,d)??t)}let f=t=U2(a6.Main,e,t),p;if(F2(e)&&d){let{marks:n,scales:r}=d;n===`include-invalid-values`&&r===`exclude-invalid-values`&&(t=o8.make(t,e,d)??t,p=t=U2(a6.PostFilterInvalid,e,t))}F2(e)&&ZNe(e,f);let m=null;if(I2(e)){let r=e.getName(`facet`);t=VIe(t,e.facet)??t,m=new X6(t,e,r,f.getSource()),n[r]=m}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:l,main:f,facetRoot:m,ancestorParse:a,preFilterInvalid:u,postFilterInvalid:p}}function U2(e,t,n){let{outputNodes:r,outputNodeRefCounts:i}=t.component.data,a=t.getDataName(e),o=new s6(n,a,e,i);return r[a]=o,o}function GIe(e){return e===!1||e===null}function KIe(e,t,n){let{encoding:r,config:i}=e,a=$1(r[t])??$1(r[BQ(t)]),{format:o,formatType:s}=e.axis(t)||{};if(w1(s))return{text:E1({fieldOrDatumDef:a,field:`datum.value`,format:o,formatType:s,config:i}),...n};if(o===void 0&&s===void 0&&i.customFormatTypes){if(R1(a)===`quantitative`){if(K1(a)&&a.stack===`normalize`&&i.normalizedNumberFormatType)return{text:E1({fieldOrDatumDef:a,field:`datum.value`,format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:E1({fieldOrDatumDef:a,field:`datum.value`,format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(R1(a)===`temporal`&&i.timeFormatType&&Z(a)&&!a.timeUnit)return{text:E1({fieldOrDatumDef:a,field:`datum.value`,format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function qIe(e){return U4.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[QIe(n,e)]),t),{})}function JIe(e){let{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(let r of e.children){r.parseAxesAndHeaders();for(let i of $(r.component.axes))n.axis[i]=b2(e.component.resolve,i),n.axis[i]===`shared`&&(t[i]=YIe(t[i],r.component.axes[i]),t[i]||(n.axis[i]=`independent`,delete t[i]))}for(let i of U4){for(let a of e.children)if(a.component.axes[i]){if(n.axis[i]===`independent`){t[i]=(t[i]??[]).concat(a.component.axes[i]);for(let e of a.component.axes[i]){let{value:t,explicit:n}=e.getWithExplicit(`orient`);if(!u$(t)){if(r[t]>0&&!n){let n=lBe[t];r[t]>r[n]&&e.set(`orient`,n,!1)}r[t]++}}}delete a.component.axes[i]}if(n.axis[i]===`independent`&&t[i]&&t[i].length>1)for(let[e,n]of(t[i]||[]).entries())e>0&&n.get(`grid`)&&!n.explicit.grid&&(n.implicit.grid=!1)}}function YIe(e,t){if(e){if(e.length!==t.length)return;let n=e.length;for(let r=0;re.clone());return e}function XIe(e,t){for(let n of M8){let r=I0(e.getWithExplicit(n),t.getWithExplicit(n),n,`axis`,(e,t)=>{switch(n){case`title`:return O$(e,t);case`gridScale`:return{explicit:e.explicit,value:wQ(e.value,t.value)}}return F0(e,t,n,`axis`)});e.setWithExplicit(n,r)}return e}function ZIe(e,t,n,r,i){if(t===`disable`)return n!==void 0;switch(n||={},t){case`titleAngle`:case`labelAngle`:return e===(u$(n.labelAngle)?n.labelAngle:OQ(n.labelAngle));case`values`:return!!n.values;case`encode`:return!!n.encoding||!!n.labelAngle;case`title`:if(e===mPe(r,i))return!0}return e===n[t]}function QIe(e,t){let n=t.axis(e),r=new cBe,i=$1(t.encoding[e]),{mark:a,config:o}=t,s=n?.orient||o[e===`x`?`axisX`:`axisY`]?.orient||o.axis?.orient||dPe(e),c=t.getScaleComponent(e).get(`type`),l=nPe(e,c,s,t.config),u=n===void 0?d2(`disable`,o.style,n?.style,l).configValue:!n;if(r.set(`disable`,u,n!==void 0),u)return r;n||={};let d=oPe(i,n,e,o.style,l),f=NAe(n.formatType,i,c),p=MAe(i,i.type,n.format,n.formatType,o,!0),m={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:c,orient:s,labelAngle:d,format:p,formatType:f,mark:a,config:o};for(let i of M8){let a=i in V6?V6[i](m):dje(i)?n[i]:void 0,s=a!==void 0,c=ZIe(a,i,n,t,e);if(s&&c)r.set(i,a,c);else{let{configValue:e=void 0,configFrom:t=void 0}=dje(i)&&i!==`values`?d2(i,o.style,n.style,l):{},u=e!==void 0;s&&!u?r.set(i,a,c):(t!==`vgAxisConfig`||uBe.has(i)&&u||o0(e)||u$(e))&&r.set(i,e,!1)}}let h=n.encoding??{},g=L3.reduce((n,i)=>{if(!r.hasAxisPart(i))return n;let a=kPe(h[i]??{},t),o=i===`labels`?KIe(t,e,a):a;return o!==void 0&&!lQ(o)&&(n[i]={update:o}),n},{});return lQ(g)||r.set(`encode`,g,!!n.encoding||n.labelAngle!==void 0),r}function $Ie({encoding:e,size:t}){for(let n of U4){let r=VQ(n);S0(t[r])&&B1(e[n])&&(delete t[r],X(bke(r)))}return t}function W2(e,t){let{config:n}=e;return{...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...Z0(`x`,e,{defaultPos:`mid`}),...Z0(`y`,e,{defaultPos:`mid`}),...Y0(`size`,e),...Y0(`angle`,e),...eLe(e,n,t)}}function eLe(e,t,n){return n?{shape:{value:n}}:Y0(`shape`,e)}function tLe(e,t,n){if(x$(`align`,e,n)===void 0)return`center`}function nLe(e,t,n){if(x$(`baseline`,e,n)===void 0)return`middle`}function rLe(e){if(eQ([b3,v3,HRe],e.mark)){let t=bje(e.mark,e.encoding);if(t.length>0)return iLe(e,t)}else if(e.mark===y3){let t=X4.some(t=>x$(t,e.markDef,e.config));if(e.stack&&!e.fieldDef(`size`)&&t)return aLe(e)}return G2(e)}function iLe(e,t){return[{name:e.getName(`pathgroup`),type:`group`,from:{facet:{name:P8+e.requestDataName(a6.Main),data:e.requestDataName(a6.Main),groupby:t}},encode:{update:{width:{field:{group:`width`}},height:{field:{group:`height`}}}},marks:G2(e,{fromPrefix:P8})}]}function aLe(e){let[t]=G2(e,{fromPrefix:F8}),n=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),i=(e,t)=>`${e}(${[r({prefix:`min`,suffix:`start`,expr:t}),r({prefix:`max`,suffix:`start`,expr:t}),r({prefix:`min`,suffix:`end`,expr:t}),r({prefix:`max`,suffix:`end`,expr:t})].map(e=>`scale('${n}',${e})`).join(`,`)})`,a,o;e.stack.fieldChannel===`x`?(a={...XZ(t.encode.update,[`y`,`yc`,`y2`,`height`,...X4]),x:{signal:i(`min`,`datum`)},x2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={x:{field:{group:`x`},mult:-1},height:{field:{group:`height`}}},t.encode.update={...ZZ(t.encode.update,[`y`,`yc`,`y2`]),height:{field:{group:`height`}}}):(a={...XZ(t.encode.update,[`x`,`xc`,`x2`,`width`]),y:{signal:i(`min`,`datum`)},y2:{signal:i(`max`,`datum`)},clip:{value:!0}},o={y:{field:{group:`y`},mult:-1},width:{field:{group:`width`}}},t.encode.update={...ZZ(t.encode.update,[`x`,`xc`,`x2`]),width:{field:{group:`width`}}});for(let n of X4){let r=S$(n,e.markDef,e.config);t.encode.update[n]?(a[n]=t.encode.update[n],delete t.encode.update[n]):r&&(a[n]=_$(r)),r&&(t.encode.update[n]={value:0})}let s=[];if(e.stack.groupbyChannels?.length>0)for(let t of e.stack.groupbyChannels){let n=e.fieldDef(t),r=Q(n);r&&s.push(r),(n?.bin||n?.timeUnit)&&s.push(Q(n,{binSuffix:`end`}))}return a=[`stroke`,`strokeWidth`,`strokeJoin`,`strokeCap`,`strokeDash`,`strokeDashOffset`,`strokeMiterLimit`,`strokeOpacity`].reduce((n,r)=>{if(t.encode.update[r])return{...n,[r]:t.encode.update[r]};{let t=S$(r,e.markDef,e.config);return t===void 0?n:{...n,[r]:_$(t)}}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:`group`,from:{facet:{data:e.requestDataName(a6.Main),name:F8+e.requestDataName(a6.Main),groupby:s,aggregate:{fields:[r({suffix:`start`}),r({suffix:`start`}),r({suffix:`end`}),r({suffix:`end`})],ops:[`min`,`max`,`min`,`max`]}}},encode:{update:a},marks:[{type:`group`,encode:{update:o},marks:[t]}]}]}function oLe(e){let{encoding:t,stack:n,mark:r,markDef:i,config:a}=e,o=t.order;if(!(!H(o)&&W1(o)&&$Z(o.value)||!o&&$Z(x$(`order`,i,a)))){if((H(o)||Z(o))&&!n)return T$(o,{expr:`datum`});if(m1(r)){let e=i.orient===`horizontal`?`y`:`x`,n=t[e];if(Z(n))return{field:e}}}}function G2(e,t={fromPrefix:``}){let{mark:n,markDef:r,encoding:i,config:a}=e,o=wQ(r.clip,sLe(e),cLe(e)),s=b$(r),c=i.key,l=oLe(e),u=lLe(e);u&&Object.values(e.component.selection).some(e=>e.type===`point`&&!e.bind&&e.on!==`pointerover`)&&(e.markDef.cursor??=`pointer`);let d=x$(`aria`,r,a),f=N8[n].postEncodingTransform?N8[n].postEncodingTransform(e):null;return[{name:e.getName(`marks`),type:N8[n].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...c?{key:c.field}:{},...l?{sort:l}:{},...u||{},...d===!1?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(a6.Main)},encode:{update:N8[n].encodeEntry(e)},...f?{transform:f}:{}}]}function sLe(e){let t=e.getScaleComponent(`x`),n=e.getScaleComponent(`y`);return t?.get(`selectionExtent`)||n?.get(`selectionExtent`)?!0:void 0}function cLe(e){let t=e.component.projection;return t&&!t.isFit?!0:void 0}function lLe(e){if(!e.component.selection)return null;let t=$(e.component.selection).length,n=t,r=e.parent;for(;r&&n===0;)n=$(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark===`geoshape`||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}function K2(e,t,n,r,i){if(M1(e))return new oBe(e,t,n,i);if(E0(e))return new wBe(e,t,n,r,i);if(s0(e))return new I8(e,t,n,r,i);if(Bje(e))return new sBe(e,t,n,i);throw Error(k$(e))}function uLe(e,t={}){t.logger&&Lke(t.logger),t.fieldTitle&&rje(t.fieldTitle);try{let n=Yje(kh(t.config,e.config)),r=KMe(e,n),i=K2(r,null,``,void 0,n);return i.parse(),vFe(i.component.data,i),{spec:fLe(i,dLe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&Rke(),t.fieldTitle&&ije()}}function dLe(e,t,n,r){let i=r.component.layoutSize.get(`width`),a=r.component.layoutSize.get(`height`);if(t===void 0?(t={type:`pad`},r.hasAxisOrientSignalRef()&&(t.resize=!0)):Eg(t)&&(t={type:t}),i&&a&&XMe(t.type)){if(i===`step`&&a===`step`)X(M$()),t.type=`pad`;else if(i===`step`||a===`step`){let e=i===`step`?`width`:`height`;X(M$(GQ(e))),t.type=ZMe(e===`width`?`height`:`width`)}}return{...$(t).length===1&&t.type?t.type===`pad`?{}:{autosize:t.type}:{autosize:t},...QMe(n,!1),...QMe(e,!0)}}function fLe(e,t,n={},r){let i=e.config?Xje(e.config):void 0,a=jIe(e.component.data,n),o=e.assembleSelectionData(a),s=e.assembleProjections(),c=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0),d=e.assembleLayoutSignals();d=d.filter(e=>(e.name===`width`||e.name===`height`)&&e.value!==void 0?(t[e.name]=+e.value,!1):!0);let{params:f,...p}=t;return{$schema:`https://vega.github.io/schema/vega/v6.json`,...e.description?{description:e.description}:{},...p,...c?{title:c}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...s.length>0?{projections:s}:{},...e.assembleGroup([...d,...e.assembleSelectionTopLevelSignals([]),...zje(f)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}var pLe,q2,$,J2,Y2,X2,Z2,Q2,$2,e4,t4,n4,r4,i4,a4,o4,s4,c4,l4,u4,d4,f4,p4,m4,h4,g4,_4,v4,y4,b4,x4,S4,C4,w4,T4,E4,D4,O4,k4,A4,j4,M4,N4,P4,mLe,F4,I4,hLe,L4,R4,z4,B4,gLe,_Le,vLe,yLe,bLe,xLe,SLe,CLe,wLe,TLe,ELe,DLe,OLe,kLe,ALe,jLe,MLe,NLe,PLe,FLe,ILe,LLe,RLe,zLe,BLe,V4,VLe,H4,U4,W4,HLe,G4,ULe,WLe,GLe,KLe,qLe,JLe,YLe,XLe,ZLe,K4,QLe,q4,J4,Y4,$Le,eRe,tRe,nRe,rRe,iRe,aRe,oRe,sRe,X4,cRe,lRe,uRe,dRe,fRe,pRe,mRe,hRe,Z4,gRe,_Re,vRe,yRe,bRe,Q4,xRe,SRe,CRe,$4,e3,t3,wRe,n3,TRe,r3,i3,ERe,DRe,a3,o3,s3,c3,l3,u3,d3,f3,ORe,p3,m3,h3,kRe,ARe,jRe,MRe,NRe,PRe,FRe,IRe,LRe,RRe,zRe,g3,_3,v3,y3,BRe,b3,x3,VRe,S3,C3,w3,HRe,T3,E3,D3,URe,WRe,GRe,KRe,O3,k3,qRe,JRe,A3,YRe,j3,XRe,ZRe,M3,QRe,N3,P3,F3,I3,L3,$Re,R3,eze,z3,B3,V3,tze,nze,H3,rze,ize,U3,aze,oze,W3,sze,G3,K3,cze,lze,q3,J3,uze,dze,Y3,fze,X3,pze,Z3,mze,Q3,$3,e6,hze,gze,_ze,vze,t6,yze,bze,xze,n6,Sze,Cze,wze,Tze,r6,Eze,Dze,Oze,kze,i6,Aze,a6,o6,s6,c6,l6,u6,d6,jze,Mze,f6,p6,m6,h6,g6,_6,v6,y6,Nze,Pze,Fze,b6,x6,S6,C6,w6,Ize,Lze,Rze,zze,T6,E6,D6,O6,k6,A6,Bze,j6,M6,N6,Vze,P6,F6,Hze,I6,L6,Uze,R6,z6,B6,V6,H6,U6,W6,Wze,G6,Gze,K6,q6,J6,Y6,X6,Z6,Q6,$6,e8,t8,n8,r8,i8,Kze,qze,Jze,Yze,Xze,Zze,Qze,$ze,eBe,tBe,nBe,a8,o8,s8,c8,l8,u8,d8,rBe,f8,p8,iBe,m8,h8,aBe,g8,_8,v8,y8,b8,x8,S8,C8,w8,T8,E8,D8,O8,k8,A8,j8,oBe,sBe,M8,cBe,lBe,uBe,dBe,fBe,pBe,mBe,hBe,gBe,_Be,vBe,yBe,bBe,xBe,SBe,CBe,N8,P8,F8,I8,wBe,TBe,EBe=o((()=>{Fg(),tX(),vK(),EOe(),pLe={version:`6.4.3`},q2=structuredClone,Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>jQ(e)).join(`,`)})`},$=Object.keys,J2=Object.values,Y2=Object.entries,X2=42,Z2=Object.getPrototypeOf(structuredClone({})),Q2=`row`,$2=`column`,e4=`facet`,t4=`x`,n4=`y`,r4=`x2`,i4=`y2`,a4=`xOffset`,o4=`yOffset`,s4=`radius`,c4=`radius2`,l4=`theta`,u4=`theta2`,d4=`latitude`,f4=`longitude`,p4=`latitude2`,m4=`longitude2`,h4=`time`,g4=`color`,_4=`fill`,v4=`stroke`,y4=`shape`,b4=`size`,x4=`angle`,S4=`opacity`,C4=`fillOpacity`,w4=`strokeOpacity`,T4=`strokeWidth`,E4=`strokeDash`,D4=`text`,O4=`order`,k4=`detail`,A4=`key`,j4=`tooltip`,M4=`href`,N4=`url`,P4=`description`,mLe={x:1,y:1,x2:1,y2:1},F4={theta:1,theta2:1,radius:1,radius2:1},I4={longitude:1,longitude2:1,latitude:1,latitude2:1},hLe=$(I4),L4={...mLe,...F4,...I4,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1},R4={row:1,column:1,facet:1},z4=$(R4),B4={...L4,...R4},gLe=$(B4),{order:_Le,detail:vLe,tooltip:yLe,...bLe}=B4,{row:xLe,column:SLe,facet:CLe,...wLe}=bLe,TLe=[r4,i4,p4,m4,u4,c4],ELe=$(L4),{x:DLe,y:OLe,x2:kLe,y2:ALe,xOffset:jLe,yOffset:MLe,latitude:NLe,longitude:PLe,latitude2:FLe,longitude2:ILe,theta:LLe,theta2:RLe,radius:zLe,radius2:BLe,...V4}=L4,VLe=$(V4),H4={x:1,y:1},U4=$(H4),W4={theta:1,radius:1},HLe=$(W4),G4={xOffset:1,yOffset:1},ULe={time:1},{text:WLe,tooltip:GLe,href:KLe,url:qLe,description:JLe,detail:YLe,key:XLe,order:ZLe,...K4}=V4,QLe=$(K4),q4={...H4,...W4,...G4,...K4},J4=$(q4),Y4={arc:`always`,area:`always`,bar:`always`,circle:`always`,geoshape:`always`,image:`always`,line:`always`,rule:`always`,point:`always`,rect:`always`,square:`always`,trail:`always`,text:`always`,tick:`always`},{geoshape:$Le,...eRe}=Y4,tRe={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},nRe={count:1,min:1,max:1},rRe=new Set([`count`,`valid`,`missing`,`distinct`]),iRe=new Set([`count`,`sum`,`distinct`,`valid`,`missing`]),aRe=new Set([`mean`,`average`,`median`,`q1`,`q3`,`min`,`max`]),oRe=$({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),sRe={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},X4=[`cornerRadius`,`cornerRadiusTopLeft`,`cornerRadiusTopRight`,`cornerRadiusBottomLeft`,`cornerRadiusBottomRight`],cRe=` – `,lRe=`Autosize "fit" only works for single views and layered views.`,uRe=`Scale bindings are currently only supported for scales with unbinned, continuous domains.`,dRe=`Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc`,fRe=`Legend bindings are only supported for selections over an individual field or encoding channel.`,pRe=`The same selection must be used to override scale domains in a layered view.`,mRe=`Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.`,hRe=`Multiple timer selections in one unit spec are not supported. Ignoring all but the first.`,Z4=`Animation involving facet, layer, or concat is currently unsupported.`,gRe=`Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).`,_Re=`Attempt to add the same child twice.`,vRe=`If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.`,yRe=`Arc marks uses theta channel rather than angle, replacing angle with theta.`,bRe=`Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.`,Q4=`Domains that should be unioned has conflicting sort properties. Sort will be set to true.`,xRe=`Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.`,SRe=`Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.`,CRe=`Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.`,$4=Th(2),e3=$4,t3=[`january`,`february`,`march`,`april`,`may`,`june`,`july`,`august`,`september`,`october`,`november`,`december`],wRe=t3.map(e=>e.substr(0,3)),n3=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`],TRe=n3.map(e=>e.substr(0,3)),r3={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},i3=$(r3),ERe={"year-month":`%b %Y `,"year-month-date":`%b %d, %Y `},DRe={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},a3={quantitative:`quantitative`,ordinal:`ordinal`,temporal:`temporal`,nominal:`nominal`,geojson:`geojson`},o3=a3.quantitative,s3=a3.ordinal,c3=a3.temporal,l3=a3.nominal,u3=a3.geojson,d3={LINEAR:`linear`,LOG:`log`,POW:`pow`,SQRT:`sqrt`,TIME:`time`,UTC:`utc`,POINT:`point`,BAND:`band`},f3={linear:`numeric`,log:`numeric`,pow:`numeric`,sqrt:`numeric`,symlog:`numeric`,identity:`numeric`,sequential:`numeric`,time:`time`,utc:`time`,ordinal:`ordinal`,"bin-ordinal":`bin-ordinal`,point:`ordinal-position`,band:`ordinal-position`,quantile:`discretizing`,quantize:`discretizing`,threshold:`discretizing`},ORe={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0},p3=new Set([`linear`,`log`,`pow`,`sqrt`,`symlog`]),m3=new Set([...p3,`time`,`utc`]),h3=new Set([`quantile`,`quantize`,`threshold`]),kRe=new Set([...m3,...h3,`sequential`,`identity`]),ARe=new Set([`ordinal`,`bin-ordinal`,`point`,`band`]),jRe={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},{type:MRe,domain:NRe,range:PRe,rangeMax:FRe,rangeMin:IRe,scheme:LRe,...RRe}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},zRe=$(RRe),g3={arc:`arc`,area:`area`,bar:`bar`,image:`image`,line:`line`,point:`point`,rect:`rect`,rule:`rule`,text:`text`,tick:`tick`,trail:`trail`,circle:`circle`,square:`square`,geoshape:`geoshape`},_3=g3.arc,v3=g3.area,y3=g3.bar,BRe=g3.image,b3=g3.line,x3=g3.point,VRe=g3.rect,S3=g3.rule,C3=g3.text,w3=g3.tick,HRe=g3.trail,T3=g3.circle,E3=g3.square,D3=g3.geoshape,URe=new Set($(g3)),WRe=[`stroke`,`strokeWidth`,`strokeDash`,`strokeDashOffset`,`strokeOpacity`,`strokeJoin`,`strokeMiterLimit`],GRe=[`fill`,`fillOpacity`],KRe=[...WRe,...GRe],O3=$({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),k3=[`binSpacing`,`continuousBandSize`,`discreteBandSize`,`minBandSize`],qRe={area:[`line`,`point`],bar:k3,rect:k3,line:[`point`],tick:[`bandSize`,`thickness`,...k3]},JRe={color:`#4c78a8`,invalid:`break-paths-show-path-domains`,timeUnitBandSize:1},A3=$({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1}),YRe={horizontal:[`cornerRadiusTopRight`,`cornerRadiusBottomRight`],vertical:[`cornerRadiusTopLeft`,`cornerRadiusTopRight`]},j3={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},XRe={...j3,binSpacing:1},ZRe={...j3,thickness:1},M3=`min`,QRe={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1},N3=(e,t)=>{switch(t.fieldTitle){case`plain`:return e.field;case`functional`:return nje(e);default:return tje(e,t)}},P3=N3,F3={compatible:!0},I3={labelAlign:{part:`labels`,vgProp:`align`},labelBaseline:{part:`labels`,vgProp:`baseline`},labelColor:{part:`labels`,vgProp:`fill`},labelFont:{part:`labels`,vgProp:`font`},labelFontSize:{part:`labels`,vgProp:`fontSize`},labelFontStyle:{part:`labels`,vgProp:`fontStyle`},labelFontWeight:{part:`labels`,vgProp:`fontWeight`},labelOpacity:{part:`labels`,vgProp:`opacity`},labelOffset:null,labelPadding:null,gridColor:{part:`grid`,vgProp:`stroke`},gridDash:{part:`grid`,vgProp:`strokeDash`},gridDashOffset:{part:`grid`,vgProp:`strokeDashOffset`},gridOpacity:{part:`grid`,vgProp:`opacity`},gridWidth:{part:`grid`,vgProp:`strokeWidth`},tickColor:{part:`ticks`,vgProp:`stroke`},tickDash:{part:`ticks`,vgProp:`strokeDash`},tickDashOffset:{part:`ticks`,vgProp:`strokeDashOffset`},tickOpacity:{part:`ticks`,vgProp:`opacity`},tickSize:null,tickWidth:{part:`ticks`,vgProp:`strokeWidth`}},L3=[`domain`,`grid`,`labels`,`ticks`,`title`],$Re={grid:`grid`,gridCap:`grid`,gridColor:`grid`,gridDash:`grid`,gridDashOffset:`grid`,gridOpacity:`grid`,gridScale:`grid`,gridWidth:`grid`,orient:`main`,bandPosition:`both`,aria:`main`,description:`main`,domain:`main`,domainCap:`main`,domainColor:`main`,domainDash:`main`,domainDashOffset:`main`,domainOpacity:`main`,domainWidth:`main`,format:`main`,formatType:`main`,labelAlign:`main`,labelAngle:`main`,labelBaseline:`main`,labelBound:`main`,labelColor:`main`,labelFlush:`main`,labelFlushOffset:`main`,labelFont:`main`,labelFontSize:`main`,labelFontStyle:`main`,labelFontWeight:`main`,labelLimit:`main`,labelLineHeight:`main`,labelOffset:`main`,labelOpacity:`main`,labelOverlap:`main`,labelPadding:`main`,labels:`main`,labelSeparation:`main`,maxExtent:`main`,minExtent:`main`,offset:`both`,position:`main`,tickCap:`main`,tickColor:`main`,tickDash:`main`,tickDashOffset:`main`,tickMinStep:`both`,tickOffset:`both`,tickOpacity:`main`,tickRound:`both`,ticks:`main`,tickSize:`main`,tickWidth:`both`,title:`main`,titleAlign:`main`,titleAnchor:`main`,titleAngle:`main`,titleBaseline:`main`,titleColor:`main`,titleFont:`main`,titleFontSize:`main`,titleFontStyle:`main`,titleFontWeight:`main`,titleLimit:`main`,titleLineHeight:`main`,titleOpacity:`main`,titlePadding:`main`,titleX:`main`,titleY:`main`,encode:`both`,scale:`both`,tickBand:`both`,tickCount:`both`,tickExtra:`both`,translate:`both`,values:`both`,zindex:`both`},R3={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},eze={...R3,style:1,labelExpr:1,encoding:1},z3=$({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1}),B3=class{name;run;constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return s0(e)?SAe(e.mark)===this.name:!1}},V3=`boxplot`,tze=[`box`,`median`,`outliers`,`rule`,`ticks`],nze=new B3(V3,Eje),H3=`errorbar`,rze=[`ticks`,`rule`],ize=new B3(H3,kje),U3=`errorband`,aze=[`band`,`borders`],oze=new B3(U3,Lje),W3={},h0(V3,Eje,tze),h0(H3,kje,rze),h0(U3,Lje,aze),sze=[`gradientHorizontalMaxLength`,`gradientHorizontalMinLength`,`gradientVerticalMaxLength`,`gradientVerticalMinLength`,`unselectedOpacity`],G3={titleAlign:`align`,titleAnchor:`anchor`,titleAngle:`angle`,titleBaseline:`baseline`,titleColor:`color`,titleFont:`font`,titleFontSize:`fontSize`,titleFontStyle:`fontStyle`,titleFontWeight:`fontWeight`,titleLimit:`limit`,titleLineHeight:`lineHeight`,titleOrient:`orient`,titlePadding:`offset`},K3={labelAlign:`align`,labelAnchor:`anchor`,labelAngle:`angle`,labelBaseline:`baseline`,labelColor:`color`,labelFont:`font`,labelFontSize:`fontSize`,labelFontStyle:`fontStyle`,labelFontWeight:`fontWeight`,labelLimit:`limit`,labelLineHeight:`lineHeight`,labelOrient:`orient`,labelPadding:`offset`},cze=$(G3),lze=$(K3),q3=$({header:1,headerRow:1,headerColumn:1,headerFacet:1}),J3=[`size`,`shape`,`fill`,`stroke`,`strokeDash`,`strokeWidth`,`opacity`],uze={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},dze={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},Y3=`_vgsid_`,fze={point:{on:`click`,fields:[Y3],toggle:`event.shiftKey`,resolve:`global`,clear:`dblclick`},interval:{on:`[pointerdown, window:pointerup] > window:pointermove!`,encodings:[`x`,`y`],translate:`[pointerdown, window:pointerup] > window:pointermove!`,zoom:`wheel!`,mark:{fill:`#333`,fillOpacity:.125,stroke:`white`},resolve:`global`,clear:`dblclick`}},X3=20,pze=$({align:1,bounds:1,center:1,columns:1,spacing:1}),Z3=20,mze={background:`white`,padding:5,timeFormat:`%b %d, %Y`,countTitle:`Count of Records`,view:{continuousWidth:300,continuousHeight:300,step:Z3},mark:JRe,arc:{},area:{},bar:XRe,circle:{},geoshape:{},image:{},line:{},point:{},rect:j3,rule:{color:`black`},square:{},text:{color:`black`},tick:ZRe,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:`white`},outliers:{},rule:{},ticks:null},errorbar:{center:`mean`,rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:jRe,projection:{},legend:uze,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:fze,style:{},title:{},facet:{spacing:X3},concat:{spacing:X3},normalizedNumberFormat:`.0%`},Q3=[`#4c78a8`,`#f58518`,`#e45756`,`#72b7b2`,`#54a24b`,`#eeca3b`,`#b279a2`,`#ff9da6`,`#9d755d`,`#bab0ac`],$3={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},e6={blue:Q3[0],orange:Q3[1],red:Q3[2],teal:Q3[3],green:Q3[4],yellow:Q3[5],purple:Q3[6],pink:Q3[7],brown:Q3[8],gray0:`#000`,gray1:`#111`,gray2:`#222`,gray3:`#333`,gray4:`#444`,gray5:`#555`,gray6:`#666`,gray7:`#777`,gray8:`#888`,gray9:`#999`,gray10:`#aaa`,gray11:`#bbb`,gray12:`#ccc`,gray13:`#ddd`,gray14:`#eee`,gray15:`#fff`},hze=[...A3,...z3,...q3,`background`,`padding`,`legend`,`lineBreak`,`scale`,`style`,`title`,`view`],gze=new Set([`view`,...URe]),_ze=`color.fontSize.background.padding.facet.concat.numberFormat.numberFormatType.normalizedNumberFormat.normalizedNumberFormatType.timeFormat.countTitle.header.axisQuantitative.axisTemporal.axisDiscrete.axisPoint.axisXBand.axisXPoint.axisXDiscrete.axisXQuantitative.axisXTemporal.axisYBand.axisYPoint.axisYDiscrete.axisYQuantitative.axisYTemporal.scale.selection.overlay`.split(`.`),vze={view:[`continuousWidth`,`continuousHeight`,`discreteWidth`,`discreteHeight`,`step`],...qRe},t6=class{map(e,t){return M1(e)?this.mapFacet(e,t):$je(e)?this.mapRepeat(e,t):x0(e)?this.mapHConcat(e,t):b0(e)?this.mapVConcat(e,t):y0(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(E0(e))return this.mapLayer(e,t);if(s0(e))return this.mapUnit(e,t);throw Error(k$(e))}mapLayer(e,t){return{...e,layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map(e=>this.map(e,t))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map(e=>this.map(e,t))}}mapConcat(e,t){let{concat:n,...r}=e;return{...r,concat:n.map(e=>this.map(e,t))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}},yze={zero:1,center:1,normalize:1},bze=new Set([_3,y3,v3,S3,x3,T3,E3,b3,C3,w3]),xze=new Set([y3,v3,_3]),n6=.7,Sze=class{name=`path-overlay`;hasMatchingType(e,t){if(s0(e)){let{mark:n,encoding:r}=e,i=g1(n)?n:{type:n};switch(i.type){case`line`:case`rule`:case`trail`:return!!O0(i,t[i.type],r);case`area`:return!!O0(i,t[i.type],r)||!!fMe(i,t[i.type])}}return!1}run(e,t,n){let{config:r}=t,{params:i,projection:a,mark:o,name:s,encoding:c,...l}=e,u=l0(c,r),d=g1(o)?o:{type:o},f=O0(d,r[d.type],u),p=d.type===`area`&&fMe(d,r[d.type]),m=[{name:s,...i?{params:i}:{},mark:uMe({...d.type===`area`&&x$(`opacity`,d,r)==null&&x$(`fillOpacity`,d,r)==null?{opacity:n6}:{},...d}),encoding:ZZ(u,[`shape`])}],h=iMe(aMe(d,u,r),u),g=u;if(h){let{fieldChannel:e,offset:t}=h;g={...u,[e]:{...u[e],...t?{stack:t}:{}}}}return g=ZZ(g,[`y2`,`x2`]),p&&m.push({...a?{projection:a}:{},mark:{type:`line`,...XZ(d,[`clip`,`interpolate`,`tension`,`tooltip`]),...p},encoding:g}),f&&m.push({...a?{projection:a}:{},mark:{type:`point`,opacity:1,filled:!0,...XZ(d,[`clip`,`tooltip`]),...f},encoding:g}),n({...l,layer:m},{...t,config:dMe(r)})}},Cze=class{name=`RuleForRangedLine`;hasMatchingType(e){if(s0(e)){let{encoding:t,mark:n}=e;if(n===`line`||g1(n)&&n.type===`line`)for(let e of TLe){let n=t[RQ(e)];if(t[e]&&(Z(n)&&!n$(n.bin)||z1(n)))return!0}}return!1}run(e,t,n){let{encoding:r,mark:i}=e;return X(lke(!!r.x2,!!r.y2)),n({...e,mark:Dh(i)?{...i,type:`rule`}:`rule`},t)}},wze=class extends t6{nonFacetUnitNormalizers=[nze,ize,oze,new Sze,new Cze];map(e,t){if(s0(e)){let n=c0(e.encoding,Q2),r=c0(e.encoding,$2),i=c0(e.encoding,e4);if(n||r||i)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){let{parentEncoding:n,parentProjection:r}=t,i=k0(e.encoding,t.repeater),a={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{},...i?{encoding:i}:{}};if(n||r)return this.mapUnitWithParentEncodingOrProjection(a,t);let o=this.mapLayerOrUnit.bind(this);for(let e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(a,t.config))return e.run(a,t,o);return a}mapRepeat(e,t){return eMe(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){let{repeat:n,spec:r,...i}=e,{row:a,column:o,layer:s}=n,{repeater:c={},repeaterPrefix:l=``}=t;return a||o?this.mapRepeat({...e,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},t):{...i,layer:s.map(e=>{let n={...c,layer:e},i=`${(r.name?`${r.name}_`:``)+l}child__layer_${fQ(e)}`,a=this.mapLayerOrUnit(r,{...t,repeater:n,repeaterPrefix:i});return a.name=i,a})}}mapNonLayerRepeat(e,t){let{repeat:n,spec:r,data:i,...a}=e;!H(n)&&e.columns&&(e=ZZ(e,[`columns`]),X(I$(`repeat`)));let o=[],{repeater:s={},repeaterPrefix:c=``}=t,l=!H(n)&&n.row||[s?s.row:null],u=!H(n)&&n.column||[s?s.column:null],d=H(n)&&n||[s?s.repeat:null];for(let e of d)for(let i of l)for(let a of u){let l={repeat:e,row:i,column:a,layer:s.layer},u=`${(r.name?`${r.name}_`:``)+c}child__${H(n)?`${fQ(e)}`:(n.row?`row_${fQ(i)}`:``)+(n.column?`column_${fQ(a)}`:``)}`,d=this.map(r,{...t,repeater:l,repeaterPrefix:u});d.name=u,o.push(ZZ(d,[`data`]))}let f=H(n)?e.columns:n.column?n.column.length:1;return{data:r.data??i,align:`all`,...a,columns:f,concat:o}}mapFacet(e,t){let{facet:n}=e;return A1(n)&&e.columns&&(e=ZZ(e,[`columns`]),X(I$(`facet`))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){let{encoding:n,projection:r}=e,{parentEncoding:i,parentProjection:a,config:o}=t,s=yMe({parentProjection:a,projection:r}),c=vMe({parentEncoding:i,encoding:k0(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:o})}mapFacetedUnit(e,t){let{row:n,column:r,facet:i,...a}=e.encoding,{mark:o,width:s,projection:c,height:l,view:u,params:d,encoding:f,...p}=e,{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:n,column:r,facet:i},t),g=k0(a,t.repeater);return this.mapFacet({...p,...h,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:o,encoding:g,...d?{params:d}:{}}},t)}getFacetMappingAndLayout(e,t){let{row:n,column:r,facet:i}=e;if(n||r){i&&X(ske([...n?[Q2]:[],...r?[$2]:[]]));let t={},a={};for(let n of[Q2,$2]){let r=e[n];if(r){let{align:e,center:i,spacing:o,columns:s,...c}=r;t[n]=c;for(let e of[`align`,`center`,`spacing`])r[e]!==void 0&&(a[e]??={},a[e][n]=r[e])}}return{facetMapping:t,layout:a}}else{let{align:e,center:n,spacing:r,columns:a,...o}=i;return{facetMapping:pMe(o,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...r?{spacing:r}:{},...a?{columns:a}:{}}}}}mapLayer(e,{parentEncoding:t,parentProjection:n,...r}){let{encoding:i,projection:a,...o}=e,s={...r,parentEncoding:vMe({parentEncoding:t,encoding:i,layer:!0}),parentProjection:yMe({parentProjection:n,projection:a})};return super.mapLayer({...o,...e.name?{name:[s.repeaterPrefix,e.name].filter(e=>e).join(`_`)}:{}},s)}},Tze=class extends t6{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=HMe(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if(e=HMe(e,t),e.encoding){let n={};for(let[r,i]of Y2(e.encoding))n[r]=UMe(i,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){let{selection:n,...r}=e;return n?{...r,params:Y2(n).map(([e,n])=>{let{init:r,bind:i,empty:a,...o}=n;o.type===`single`?(o.type=`point`,o.toggle=!1):o.type===`multi`&&(o.type=`point`),t.emptySelections[e]=a!==`none`;for(let n of J2(t.selectionPredicates[e]??{}))n.empty=a!==`none`;return{name:e,value:r,select:o,bind:i}})}:e}},r6=class extends t6{map(e,t){let n=t.selections??[];if(e.params&&!s0(e)){let t=[];for(let r of e.params)v0(r)?n.push(r):t.push(r);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){let n=t.selections;if(!n||!n.length)return e;let r=(t.path??[]).concat(e.name),i=[];for(let t of n)if(!t.views||!t.views.length)i.push(t);else for(let n of t.views)(Eg(n)&&(n===e.name||r.includes(n))||H(n)&&n.map(e=>r.indexOf(e)).every((e,t,n)=>e!==-1&&(t===0||e>n[t-1])))&&i.push(t);return i.length&&(e.params=i),e}};for(let e of[`mapFacet`,`mapRepeat`,`mapHConcat`,`mapVConcat`,`mapLayer`]){let t=r6.prototype[e];r6.prototype[e]=function(e,n){return t.call(this,e,GMe(e,n))}}Eze=new wze,Dze=new Tze,Oze=new r6,kze=[`background`,`padding`],i6=class e{explicit;implicit;constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new e(q2(this.explicit),q2(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return wQ(this.explicit[e],this.implicit[e])}getWithExplicit(e){return this.explicit[e]===void 0?this.implicit[e]===void 0?{explicit:!1,value:void 0}:{explicit:!1,value:this.implicit[e]}:{explicit:!0,value:this.explicit[e]}}setWithExplicit(e,{value:t,explicit:n}){t!==void 0&&this.set(e,t,n)}set(e,t,n){return delete this[n?`implicit`:`explicit`][e],this[n?`explicit`:`implicit`][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){t[e]===void 0?n[e]!==void 0&&this.set(e,n[e],!1):this.set(e,t[e],!0)}copyKeyFromObject(e,t){t[e]!==void 0&&this.set(e,t[e],!0)}copyAll(e){for(let t of $(e.combine())){let n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}},Aze=class extends i6{explicit;implicit;parseNothing;constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){let e=super.clone();return e.parseNothing=this.parseNothing,e}},(function(e){e[e.Raw=0]=`Raw`,e[e.Main=1]=`Main`,e[e.Row=2]=`Row`,e[e.Column=3]=`Column`,e[e.Lookup=4]=`Lookup`,e[e.PreFilterInvalid=5]=`PreFilterInvalid`,e[e.PostFilterInvalid=6]=`PostFilterInvalid`})(a6||={}),o6=class{debugName;_children=[];_parent=null;_hash;constructor(e,t){this.debugName=t,e&&(this.parent=e)}clone(){throw Error(`Cannot clone node`)}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){if(this._children.includes(e)){X(_Re);return}t===void 0?this._children.push(e):this._children.splice(t,0,e)}removeChild(e){let t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(let t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){let t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){let e=this._parent,t=e.parent;for(let t of this._children)t.parent=e;this._children=[],e.removeChild(this);let n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}},s6=class extends o6{type;refCounts;_source;_name;clone(){let e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,r){super(e,t),this.type=n,this.refCounts=r,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${TQ()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}},c6=class e extends o6{timeUnits;clone(){return new e(null,q2(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{let{field:i,timeUnit:a}=t;if(a){let o;if(Y$(a)){if(F2(n)){let{mark:e,markDef:r,config:s}=n,c=P1({fieldDef:t,markDef:r,config:s});(h1(e)||c)&&(o={timeUnit:Q$(a),field:i})}}else o={as:Q(t,{forAs:!0}),field:i,timeUnit:a};if(F2(n)){let{mark:e,markDef:i,config:a}=n,s=P1({fieldDef:t,markDef:i,config:a});h1(e)&&WQ(r)&&s!==.5&&(o.rectBandPosition=s)}o&&(e[QZ(o)]=o)}return e},{});return lQ(r)?null:new e(t,r)}static makeFromTransform(t,n){let{timeUnit:r,...i}={...n},a=Q$(r),o={...i,timeUnit:a};return new e(t,{[QZ(o)]:o})}merge(e){this.timeUnits={...this.timeUnits};for(let t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){let t={};for(let[n,r]of Y2(this.timeUnits)){let i=V0(r)?r.as:`${r.field}_end`;e.has(i)||(t[n]=r)}this.timeUnits=t}producedFields(){return new Set(J2(this.timeUnits).map(e=>V0(e)?e.as:aNe(e.field)))}dependentFields(){return new Set(J2(this.timeUnits).map(e=>e.field))}hash(){return`TimeUnit ${QZ(this.timeUnits)}`}assemble(){let e=[];for(let t of J2(this.timeUnits)){let{rectBandPosition:n}=t,r=Q$(t.timeUnit);if(V0(t)){let{field:i,as:a}=t,{unit:o,utc:s,...c}=r,l=[a,`${a}_end`];e.push({field:bQ(i),type:`timeunit`,...o?{units:Z$(o)}:{},...s?{timezone:`utc`}:{},...c,as:l}),e.push(...sNe(l,n,r))}else if(t){let{field:i}=t,a=yQ(i),o=oNe({timeUnit:r,field:a}),s=aNe(a);e.push({type:`formula`,expr:o,as:s}),e.push(...sNe([a,s],n,r))}}return e}},l6=`offsetted_rect_start`,u6=`offsetted_rect_end`,d6=`_tuple_fields`,jze=class{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}},Mze={defined:()=>!0,parse:(e,t,n)=>{let r=t.name,i=t.project??=new jze,a={},o={},s=new Set,c=(e,t)=>{let n=t===`visual`?e.channel:e.field,i=fQ(`${r}_${n}`);for(let e=1;s.has(i);e++)i=fQ(`${r}_${n}_${e}`);return s.add(i),{[t]:i}},l=t.type,u=e.config.selection[l],d=n.value===void 0?null:ng(n.value),{fields:f,encodings:p}=Dh(n.select)?n.select:{};if(!f&&!p&&d){for(let e of d)if(Dh(e))for(let t of $(e))MOe(t)?(p||=[]).push(t):l===`interval`?(X(mRe),p=u.encodings):(f??=[]).push(t)}!f&&!p&&(p=u.encodings,`fields`in u&&(f=u.fields));for(let t of p??[]){let n=e.fieldDef(t);if(n){let r=n.field;if(n.aggregate){X(HOe(t,n.aggregate));continue}else if(!r){X(P$(t));continue}if(n.timeUnit&&!Y$(n.timeUnit)){r=e.vgField(t);let i={timeUnit:n.timeUnit,as:r,field:n.field};o[QZ(i)]=i}if(!a[r]){let o=l===`interval`&&JQ(t)&&u1(e.getScaleComponent(t).get(`type`))?`R`:n.bin?`R-RE`:`E`,s={field:r,channel:t,type:o,index:i.items.length};s.signals={...c(s,`data`),...c(s,`visual`)},i.items.push(a[r]=s),i.hasField[r]=a[r],i.hasSelectionId=i.hasSelectionId||r===Y3,PQ(t)?(s.geoChannel=t,s.channel=NQ(t),i.hasChannel[s.channel]=a[r]):i.hasChannel[t]=a[r]}}else X(P$(t))}for(let e of f??[]){if(i.hasField[e])continue;let t={type:`E`,field:e,index:i.items.length};t.signals={...c(t,`data`)},i.items.push(t),i.hasField[e]=t,i.hasSelectionId=i.hasSelectionId||e===Y3}d&&(t.init=d.map(e=>i.items.map(t=>Dh(e)?e[t.geoChannel||t.channel]===void 0?e[t.field]:e[t.geoChannel||t.channel]:e))),lQ(o)||(i.timeUnit=new c6(null,o))},signals:(e,t,n)=>{let r=t.name+d6;return n.filter(e=>e.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(lNe)})}},f6=`_curr`,p6=`anim_value`,m6=`anim_clock`,h6=`eased_anim_clock`,g6=`min_extent`,_6=`max_range_extent`,v6=`last_tick_at`,y6=`is_playing`,Nze=1/60*1e3,Pze=(e,t)=>[{name:h6,update:m6},{name:`${e}_domain`,init:`domain('${t}')`},{name:g6,init:`extent(${e}_domain)[0]`},{name:_6,init:`extent(range('${t}'))[1]`},{name:p6,update:`invert('${t}', ${h6})`}],Fze={defined:e=>e.type===`point`,topLevelSignals:(e,t,n)=>(o2(t)&&(n=n.concat([{name:m6,init:`0`,on:[{events:{type:`timer`,throttle:Nze},update:`${y6} ? (${m6} + (now() - ${v6}) > ${_6} ? 0 : ${m6} + (now() - ${v6})) : ${m6}`}]},{name:v6,init:`now()`,on:[{events:[{signal:m6},{signal:y6}],update:`now()`}]},{name:y6,init:`true`}])),n),signals:(e,t,n)=>{let r=t.name,i=r+d6,a=t.project,o=`(item().isVoronoi ? datum.datum : datum)`,s=J2(e.component.selection??{}).reduce((e,t)=>t.type===`interval`?e.concat(t.name+x6):e,[]).map(e=>`indexof(item().mark.name, '${e}') < 0`).join(` && `),c=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${s?` && ${s}`:``}`,l=`unit: ${i2(e)}, `;if(t.project.hasSelectionId)l+=`${Y3}: ${o}[${W(Y3)}]`;else if(o2(t))l+=`fields: ${i}, values: [${p6} ? ${p6} : ${g6}]`;else{let t=a.items.map(t=>e.fieldDef(t.channel)?.bin?`[${o}[${W(e.vgField(t.channel,{}))}], ${o}[${W(e.vgField(t.channel,{binSuffix:`end`}))}]]`:`${o}[${W(t.field)}]`).join(`, `);l+=`fields: ${i}, values: [${t}]`}if(o2(t))return n.concat(Pze(t.name,e.scaleName(h4)),[{name:r+L6,on:[{events:[{signal:h6},{signal:p6}],update:`{${l}}`,force:!0}]}]);{let e=t.events;return n.concat([{name:r+L6,on:e?[{events:e,update:`${c} ? {${l}} : null`,force:!0}]:[]}])}}},b6={defined:e=>e.type===`interval`&&e.resolve===`global`&&e.bind&&e.bind===`scales`,parse:(e,t)=>{let n=t.scales=[];for(let r of t.project.items){let i=r.channel;if(!JQ(i))continue;let a=e.getScaleComponent(i),o=a?a.get(`type`):void 0;if(o==`sequential`&&X(dRe),!a||!u1(o)){X(uRe);continue}a.set(`selectionExtent`,{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{let r=t.scales.filter(e=>n.filter(t=>t.name===e.signals.data).length===0);if(!e.parent||G0(e)||r.length===0)return n;let i=n.find(e=>e.name===t.name),a=i.update;if(a.includes(R6))i.update=`{${r.map(e=>`${W(bQ(e.field))}: ${e.signals.data}`).join(`, `)}}`;else{for(let e of r){let t=`${W(bQ(e.field))}: ${e.signals.data}`;a.includes(t)||(a=`${a.substring(0,a.length-1)}, ${t}}`)}i.update=a}return n.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!G0(e))for(let e of t.scales){let t=n.find(t=>t.name===e.signals.data);t.push=`outer`,delete t.value,delete t.update}return n}},x6=`_brush`,S6=`_scale_trigger`,C6=`geo_interval_init_tick`,w6=`_init`,Ize=`_center`,Lze={defined:e=>e.type===`interval`,parse:(e,t,n)=>{if(e.hasProjection){let e={...Dh(n.select)?n.select:{}};e.fields=[Y3],e.encodings||=n.value?$(n.value):[f4,d4],n.select={type:`interval`,...e}}if(t.translate&&!b6.defined(t)){let e=`!event.item || event.item.mark.name !== ${W(t.name+x6)}`;for(let n of t.events){if(!n.between){X(`${n} is not an ordered event stream for interval selections.`);continue}let t=ng(n.between[0].filter??=[]);t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{let r=t.name,i=r+L6,a=J2(t.project.hasChannel).filter(e=>e.channel===t4||e.channel===n4),o=t.init?t.init[0]:null;if(n.push(...a.reduce((n,r)=>n.concat(_Ne(e,t,r,o?.[r.index])),[])),e.hasProjection){let s=W(e.projectionName()),c=e.projectionName()+Ize,{x:l,y:u}=t.project.hasChannel,d=l?.signals.visual,f=u?.signals.visual,p=l?o?.[l.index]:`${c}[0]`,m=u?o?.[u.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,g=`[[${d?`${d}[0]`:`0`}, ${f?`${f}[0]`:`0`}],[${d?`${d}[1]`:h(`width`)}, ${f?`${f}[1]`:h(`height`)}]]`;o&&(n.unshift({name:r+w6,init:`[scale(${s}, [${l?p[0]:p}, ${u?m[0]:m}]), scale(${s}, [${l?p[1]:p}, ${u?m[1]:m}])]`}),(!l||!u)&&(n.find(e=>e.name===c)||n.unshift({name:c,update:`invert(${s}, [${h(`width`)}/2, ${h(`height`)}/2])`})));let _=`vlSelectionTuples(${`intersect(${g}, {markname: ${W(e.getName(`marks`))}}, unit.mark)`}, ${`{unit: ${i2(e)}}`})`,v=a.map(e=>e.signals.visual);return n.concat({name:i,on:[{events:[...v.length?[{signal:v.join(` || `)}]:[],...o?[{signal:C6}]:[]],update:_}]})}else{if(!b6.defined(t)){let t=r+S6,i=a.map(t=>{let n=t.channel,{data:r,visual:i}=t.signals,a=W(e.scaleName(n)),o=u1(e.getScaleComponent(n).get(`type`))?`+`:``;return`(!isArray(${r}) || (${o}invert(${a}, ${i})[0] === ${o}${r}[0] && ${o}invert(${a}, ${i})[1] === ${o}${r}[1]))`});i.length&&n.push({name:t,value:{},on:[{events:a.map(t=>({scale:e.scaleName(t.channel)})),update:`${i.join(` && `)} ? ${t} : {}`}]})}let s=a.map(e=>e.signals.data),c=`unit: ${i2(e)}, fields: ${r+d6}, values`;return n.concat({name:i,...o?{init:`{${c}: ${H0(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(` || `)}],update:`${s.join(` && `)} ? {${c}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(F2(e)&&e.hasProjection&&t.init&&(n.filter(e=>e.name===C6).length||n.unshift({name:C6,value:null,on:[{events:`timer{1}`,update:`${C6} === null ? {} : ${C6}`}]})),n),marks:(e,t,n)=>{let r=t.name,{x:i,y:a}=t.project.hasChannel,o=i?.signals.visual,s=a?.signals.visual,c=`data(${W(t.name+I6)})`;if(b6.defined(t)||!i&&!a)return n;let l={x:i===void 0?{value:0}:{signal:`${o}[0]`},y:a===void 0?{value:0}:{signal:`${s}[0]`},x2:i===void 0?{field:{group:`width`}}:{signal:`${o}[1]`},y2:a===void 0?{field:{group:`height`}}:{signal:`${s}[1]`}};if(t.resolve===`global`)for(let t of $(l))l[t]=[{test:`${c}.length && ${c}[0].unit === ${i2(e)}`,...l[t]},{value:0}];let{fill:u,fillOpacity:d,cursor:f,...p}=t.mark,m=$(p).reduce((e,t)=>(e[t]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(e=>e).join(` && `),value:p[t]},{value:null}],e),{}),h=f??(t.translate?`move`:null);return[{name:`${r+x6}_bg`,type:`rect`,clip:!0,encode:{enter:{fill:{value:u},fillOpacity:{value:d}},update:l}},...n,{name:r+x6,type:`rect`,clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:`transparent`}},update:{...l,...m}}}]}},Rze={left:`x`,center:`xc`,right:`x2`},zze={top:`y`,middle:`yc`,bottom:`y2`},T6=new Set([`aria`,`width`,`height`]),E6=`voronoi`,D6={defined:e=>e.type===`point`&&e.nearest,parse:(e,t)=>{if(t.events)for(let n of t.events)n.markname=e.getName(E6)},marks:(e,t,n)=>{let{x:r,y:i}=t.project.hasChannel,a=e.mark;if(m1(a))return X(UOe(a)),n;let o={name:e.getName(E6),type:`path`,interactive:!0,aria:!1,from:{data:e.getName(`marks`)},encode:{update:{fill:{value:`transparent`},strokeWidth:{value:.35},stroke:{value:`transparent`},isVoronoi:{value:!0},...vNe(e,{reactiveGeom:!0})}},transform:[{type:`voronoi`,x:{expr:r||!i?`datum.datum.x || 0`:`0`},y:{expr:i||!r?`datum.datum.y || 0`:`0`},size:[e.getSizeSignalRef(`width`),e.getSizeSignalRef(`height`)]}]},s=0,c=!1;return n.forEach((t,n)=>{let r=t.name??``;r===e.component.mark[0].name?s=n:r.includes(E6)&&(c=!0)}),c||n.splice(s+1,0,o),n}},O6={defined:e=>e.type===`point`&&e.resolve===`global`&&e.bind&&e.bind!==`scales`&&!g0(e.bind),parse:(e,t,n)=>GNe(t,n),topLevelSignals:(e,t,n)=>{let r=t.name,i=t.project,a=t.bind,o=t.init?.[0],s=D6.defined(t)?`(item().isVoronoi ? datum.datum : datum)`:`datum`;return i.items.forEach((e,i)=>{let c=fQ(`${r}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift({name:c,...o?{init:H0(o[i])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${W(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})}),n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+L6),o=r+d6,s=i.items.map(e=>fQ(`${r}_${e.field}`)),c=s.map(e=>`${e} !== null`).join(` && `);return s.length&&(a.update=`${c} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`),delete a.value,delete a.on,n}},k6=`_toggle`,A6={defined:e=>e.type===`point`&&!o2(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+k6,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{let n=t.name+L6,r=t.name+k6;return`${r} ? null : ${n}, ${t.resolve===`global`?`${r} ? null : true, `:`${r} ? null : {unit: ${i2(e)}}, `}${r} ? ${n} : null`}},Bze={defined:e=>e.clear!==void 0&&e.clear!==!1&&!o2(e),parse:(e,t)=>{t.clear&&=Eg(t.clear)?tK(t.clear,`view`):t.clear},topLevelSignals:(e,t,n)=>{if(O6.defined(t))for(let e of t.project.items){let r=n.findIndex(n=>n.name===fQ(`${t.name}_${e.field}`));r!==-1&&n[r].on.push({events:t.clear,update:`null`})}return n},signals:(e,t,n)=>{function r(e,r){e!==-1&&n[e].on&&n[e].on.push({events:t.clear,update:r})}if(t.type===`interval`)for(let e of t.project.items){let t=n.findIndex(t=>t.name===e.signals.visual);r(t,`[0, 0]`),t===-1&&r(n.findIndex(t=>t.name===e.signals.data),`null`)}else{let e=n.findIndex(e=>e.name===t.name+L6);r(e,`null`),A6.defined(t)&&(e=n.findIndex(e=>e.name===t.name+k6),r(e,`false`))}return n}},j6={defined:e=>{let t=e.resolve===`global`&&e.bind&&g0(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==Y3;return t&&!n&&X(fRe),t&&n},parse:(e,t,n)=>{let r=q2(n);if(r.select=Eg(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},GNe(t,r),Dh(n.select)&&(n.select.on||n.select.clear)){let e=`event.item && indexof(event.item.mark.role, "legend") < 0`;for(let n of t.events)n.filter=ng(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}let i=_0(t.bind)?t.bind.legend:`click`;t.bind={legend:{merge:Eg(i)?tK(i,`view`):ng(i)}}},topLevelSignals:(e,t,n)=>{let r=t.name,i=_0(t.bind)&&t.bind.legend,a=e=>t=>{let n=q2(t);return n.markname=e,n};for(let e of t.project.items){if(!e.hasLegend)continue;let o=`${fQ(e.field)}_legend`,s=`${r}_${o}`;if(n.filter(e=>e.name===s).length===0){let e=i.merge.map(a(`${o}_symbols`)).concat(i.merge.map(a(`${o}_labels`))).concat(i.merge.map(a(`${o}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:`isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value`,force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{let r=t.name,i=t.project,a=n.find(e=>e.name===r+L6),o=r+d6,s=i.items.filter(e=>e.hasLegend).map(e=>fQ(`${r}_${fQ(e.field)}_legend`)),c=`${s.map(e=>`${e} !== null`).join(` && `)} ? {fields: ${o}, values: [${s.join(`, `)}]} : null`;t.events&&s.length>0?a.on.push({events:s.map(e=>({signal:e})),update:c}):s.length>0&&(a.update=c,delete a.value,delete a.on);let l=n.find(e=>e.name===r+k6),u=_0(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:u}):l.on[0].events=u),n}},M6=`_translate_anchor`,N6=`_translate_delta`,Vze={defined:e=>e.type===`interval`&&e.translate,signals:(e,t,n)=>{let r=t.name,i=b6.defined(t),a=r+M6,{x:o,y:s}=t.project.hasChannel,c=tK(t.translate,`scope`);return i||(c=c.map(e=>(e.between[0].markname=r+x6,e))),n.push({name:a,value:{},on:[{events:c.map(e=>e.between[0]),update:`{x: x(unit), y: y(unit)${o===void 0?``:`, extent_x: ${i?W0(e,t4):`slice(${o.signals.visual})`}`}${s===void 0?``:`, extent_y: ${i?W0(e,n4):`slice(${s.signals.visual})`}`}}`}]},{name:r+N6,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&HNe(e,t,o,`width`,n),s!==void 0&&HNe(e,t,s,`height`,n),n}},P6=`_zoom_anchor`,F6=`_zoom_delta`,Hze={defined:e=>e.type===`interval`&&e.zoom,signals:(e,t,n)=>{let r=t.name,i=b6.defined(t),a=r+F6,{x:o,y:s}=t.project.hasChannel,c=W(e.scaleName(t4)),l=W(e.scaleName(n4)),u=tK(t.zoom,`scope`);return i||(u=u.map(e=>(e.markname=r+x6,e))),n.push({name:r+P6,on:[{events:u,update:i?`{${[c?`x: invert(${c}, x(unit))`:``,l?`y: invert(${l}, y(unit))`:``].filter(e=>e).join(`, `)}}`:`{x: x(unit), y: y(unit)}`}]},{name:a,on:[{events:u,force:!0,update:`pow(1.001, event.deltaY * pow(16, event.deltaMode))`}]}),o!==void 0&&UNe(e,t,o,`width`,n),s!==void 0&&UNe(e,t,s,`height`,n),n}},I6=`_store`,L6=`_tuple`,Uze=`_modify`,R6=`vlSelectionResolve`,z6=[Fze,Lze,Mze,A6,O6,b6,j6,Bze,Vze,Hze,D6],B6=class e extends o6{model;filter;expr;_dependentFields;clone(){return new e(null,this.model,q2(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=c2(this.model,this.filter,this),this._dependentFields=qNe(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:`filter`,expr:this.expr}}hash(){return`Filter ${this.expr}`}},V6={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??iPe(n,e),gridScale:({model:e,channel:t})=>aPe(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||cPe(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||sPe(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??lPe(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??uPe(t.type,n,Z(t)&&!!t.timeUnit,Z(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{let a=e===`x`?`width`:e===`y`?`height`:void 0,o=a?t.getSizeSignalRef(a):void 0;return n.tickCount??fPe({fieldOrDatumDef:r,scaleType:i,size:o,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??pPe({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;let r=mPe(t,n);if(r!==void 0)return r;let i=t.typedFieldDef(n),a=n===`x`?`x2`:`y2`,o=t.fieldDef(a);return E$(i?[UAe(i)]:[],Z(o)?[UAe(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>hPe(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??gPe(n,t)},H6=class e extends o6{transform;_dependentFields;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=qNe(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef((n,r)=>{if(G1(n)&&BAe(n.sort)){let{field:i,timeUnit:a}=n,o=n.sort,s=o.map((e,t)=>`${sAe({field:i,timeUnit:a,equal:e})} ? ${t} : `).join(``)+o.length;t=new e(t,{calculate:s,as:p2(n,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:`formula`,expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${QZ(this.transform)}`}},U6=[`row`,`column`],W6=[`header`,`footer`],Wze={column:{start:0,end:1},row:{start:1,end:0}},G6=$({...dze,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Gze=class extends i6{},K6={symbols:jPe,gradient:MPe,labels:NPe,entries:PPe},q6={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{let{format:r,formatType:i}=t;return MAe(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{let{formatType:r}=e;return NAe(r,t,n)},gradientLength:e=>{let{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??WPe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??KPe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??zPe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>J1(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(FQ(n)&&d1(t)){if(e===`gradient`)return}else if(e===`symbol`)return;return e},values:({fieldOrDatumDef:e,legend:t})=>RPe(t,e)},J6=class e extends o6{bins;clone(){return new e(null,q2(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(t,n){let r=n.reduceFieldDef((e,t,r)=>{if(U1(t)&&t$(t.bin)){let{key:i,binComponent:a}=aFe(t,t.bin,n);e[i]={...a,...e[i],...tFe(n,t,r,n.config)}}return e},{});return lQ(r)?null:new e(t,r)}static makeFromTransform(t,n,r){let{key:i,binComponent:a}=aFe(n,n.bin,r);return new e(t,{[i]:a})}merge(e,t){for(let n of $(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=iQ([...this.bins[n].as,...e.bins[n].as],QZ)):this.bins[n]=e.bins[n];for(let t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(J2(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(J2(this.bins).map(e=>e.field))}hash(){return`Bin ${QZ(this.bins)}`}assemble(){return J2(this.bins).flatMap(e=>{let t=[],[n,...r]=e.as,{extent:i,...a}=e.bin,o={type:`bin`,field:bQ(e.field),as:n,signal:e.signal,...i$(i)?{extent:null}:{extent:i},...e.span?{span:{signal:`span(${e.span})`}}:{},...a};!i&&e.extentSignal&&(t.push({type:`extent`,field:bQ(e.field),signal:e.extentSignal}),o.extent={signal:e.extentSignal}),t.push(o);for(let e of r)for(let r=0;r<2;r++)t.push({type:`formula`,expr:Q({field:n[r]},{expr:`datum`}),as:e[r]});return e.formula&&t.push({type:`formula`,expr:e.formula,as:e.formulaAs}),t})}},Y6=class e extends o6{dimensions;measures;clone(){return new e(null,new Set(this.dimensions),q2(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let r=!1;n.forEachFieldDef(e=>{e.aggregate&&(r=!0)});let i={},a=new Set;return!r||(n.forEachFieldDef((e,t)=>{let{aggregate:r,field:o}=e;if(r)if(r===`count`)i[`*`]??={},i[`*`].count=new Set([Q(e,{forAs:!0})]);else{if(XQ(r)||ZQ(r)){let e=XQ(r)?`argmin`:`argmax`,t=r[e];i[t]??={},i[t][e]=new Set([Q({op:e,field:t},{forAs:!0})])}else i[o]??={},i[o][r]=new Set([Q(e,{forAs:!0})]);JQ(t)&&n.scaleDomain(t)===`unaggregated`&&(i[o]??={},i[o].min=new Set([Q({field:o,aggregate:`min`},{forAs:!0})]),i[o].max=new Set([Q({field:o,aggregate:`max`},{forAs:!0})]))}else oFe(a,t,e,n)}),a.size+$(i).length===0)?null:new e(t,a,i)}static makeFromTransform(t,n){let r=new Set,i={};for(let e of n.aggregate){let{op:t,field:n,as:r}=e;t&&(t===`count`?(i[`*`]??={},i[`*`].count=new Set([r||Q(e,{forAs:!0})])):(i[n]??={},i[n][t]??=new Set,i[n][t].add(r||Q(e,{forAs:!0}))))}for(let e of n.groupby??[])r.add(e);return r.size+$(i).length===0?null:new e(t,r,i)}merge(e){return aQ(this.dimensions,e.dimensions)?(sFe(this.measures,e.measures),!0):(zke(`different dimensions, cannot merge`),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...$(this.measures)])}producedFields(){let e=new Set;for(let t of $(this.measures))for(let n of $(this.measures[t])){let r=this.measures[t][n];r.size===0?e.add(`${n}_${t}`):r.forEach(e.add,e)}return e}hash(){return`Aggregate ${QZ({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let e=[],t=[],n=[];for(let r of $(this.measures))for(let i of $(this.measures[r]))for(let a of this.measures[r][i])n.push(a),e.push(i),t.push(r===`*`?null:bQ(r));return{type:`aggregate`,groupby:[...this.dimensions].map(bQ),ops:e,fields:t,as:n}}},X6=class extends o6{model;name;data;column;row;facet;childModel;constructor(e,t,n,r){super(e),this.model=t,this.name=n,this.data=r;for(let e of z4){let n=t.facet[e];if(n){let{bin:r,sort:i}=n;this[e]={name:t.getName(`${e}_domain`),fields:[Q(n),...t$(r)?[Q(n,{binSuffix:`end`})]:[]],...k1(i)?{sortField:i}:H(i)?{sortIndexField:p2(n,e)}:{}}}}this.childModel=t.child}hash(){let e=`Facet`;for(let t of z4)this[t]&&(e+=` ${t.charAt(0)}:${QZ(this[t])}`);return e}get fields(){let e=[];for(let t of z4)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){let e=new Set(this.fields);for(let t of z4)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let e={};for(let t of U4){let n=this.childModel.component.scales[t];if(n&&!n.merged){let r=n.get(`type`),i=n.get(`range`);if(l1(r)&&d$(i)){let n=M2(N2(this.childModel,t));n?e[t]=n:X(N$(t))}}}return e}assembleRowColumnHeaderData(e,t,n){let r={row:`y`,column:`x`,facet:void 0}[e],i=[],a=[],o=[];r&&n&&n[r]&&(t?(i.push(`distinct_${n[r]}`),a.push(`max`)):(i.push(n[r]),a.push(`distinct`)),o.push(`distinct_${n[r]}`));let{sortField:s,sortIndexField:c}=this[e];if(s){let{op:e=M3,field:t}=s;i.push(t),a.push(e),o.push(Q(s,{forAs:!0}))}else c&&(i.push(c),a.push(`max`),o.push(c));return{name:this[e].name,source:t??this.data,transform:[{type:`aggregate`,groupby:this[e].fields,...i.length?{fields:i,ops:a,as:o}:{}}]}}assembleFacetHeaderData(e){let{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,r=[],i={};for(let e of U6){for(let t of W6){let r=n[e]?.[t]??[];for(let t of r)if(t.axes?.length>0){i[e]=!0;break}}if(i[e]){let n=`length(data("${this.facet.name}"))`,i=e===`row`?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};r.push({name:`${this.facet.name}_${e}`,transform:[{type:`sequence`,start:0,stop:i}]})}}let{row:a,column:o}=i;return(a||o)&&r.unshift(this.assembleRowColumnHeaderData(`facet`,null,e)),r}assemble(){let e=[],t=null,n=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:a}=this;if(r&&i&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;let r=[].concat(n.x??[],n.y??[]),i=r.map(()=>`distinct`);e.push({name:t,source:this.data,transform:[{type:`aggregate`,groupby:this.fields,fields:r,ops:i}]})}for(let r of[$2,Q2])this[r]&&e.push(this.assembleRowColumnHeaderData(r,t,n));if(a){let t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}},Z6=class e extends o6{_parse;clone(){return new e(null,q2(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${QZ(this._parse)}`}static makeExplicit(e,t,n){let r={},i=t.data;return!z0(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(t,n,r,i){for(let e of $(r)){let t=i.getWithExplicit(e);t.value!==void 0&&(t.explicit||t.value===r[e]||t.value===`derived`||r[e]===`flatten`?delete r[e]:X(L$(e,r[e],t.value)))}for(let e of $(n)){let t=i.get(e);t!==void 0&&(t===n[e]?delete n[e]:X(L$(e,n[e],t)))}let a=new i6(n,r);i.copyAll(a);let o={};for(let e of $(a.combine())){let t=a.get(e);t!==null&&(o[e]=t)}return $(o).length===0||i.parseNothing?null:new e(t,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){let e={};for(let t of $(this._parse)){let n=this._parse[t];CQ(t)===1&&(e[t]=n)}return e}producedFields(){return new Set($(this._parse))}dependentFields(){return new Set($(this._parse))}assembleTransforms(e=!1){return $(this._parse).filter(t=>!e||CQ(t)>1).map(e=>{let t=lFe(e,this._parse[e]);return t?{type:`formula`,expr:t,as:SQ(e)}:null}).filter(e=>e!==null)}},Q6=class e extends o6{clone(){return new e(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([Y3])}hash(){return`Identifier`}assemble(){return{type:`identifier`,as:Y3}}},$6=class e extends o6{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${QZ(this.params)}`}assemble(){return{type:`graticule`,...this.params===!0?{}:this.params}}},e8=class e extends o6{params;clone(){return new e(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??`data`])}hash(){return`Hash ${QZ(this.params)}`}assemble(){return{type:`sequence`,...this.params}}},t8=class extends o6{_data;_name;_generator;constructor(e){super(null),e??={name:`source`};let t;if(z0(e)||(t=e.format?{...ZZ(e.format,[`parse`])}:{}),R0(e))this._data={values:e.values};else if(L0(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];eQ([`json`,`csv`,`tsv`,`dsv`,`topojson`],n)||(n=`json`),t.type=n}}else nNe(e)?this._data={values:[{type:`Sphere`}]}:(eNe(e)||z0(e))&&(this._data={});this._generator=z0(e),e.name&&(this._name=e.name),t&&!lQ(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw Error(`Source nodes have to be roots.`)}remove(){throw Error(`Source nodes are roots and cannot be removed.`)}hash(){throw Error(`Cannot hash sources`)}assemble(){return{name:this._name,...this._data,transform:[]}}},n8=class{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}},r8=class extends n8{getNodeDepths(e,t,n){n.set(e,t);for(let r of e.children)this.getNodeDepths(r,t+1,n);return n}optimize(e){let t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(let e of t)this.run(e[0]);return this.modifiedFlag}},i8=class extends n8{optimize(e){this.run(e);for(let t of e.children)this.optimize(t);return this.modifiedFlag}},Kze=class extends i8{mergeNodes(e,t){let n=t.shift();for(let r of t)e.removeChild(r),r.parent=n,r.remove()}run(e){let t=e.children.map(e=>e.hash()),n={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(e,n[t]))}},qze=class extends i8{requiresSelectionId;constructor(e){super(),this.requiresSelectionId=e&&a2(e)}run(e){e instanceof Q6&&(this.requiresSelectionId&&(C2(e.parent)||e.parent instanceof Y6||e.parent instanceof Z6)||(this.setModified(),e.remove()))}},Jze=class extends n8{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof c6&&(n=e.producedFields(),oQ(n,t)&&(this.setModified(),e.removeFormulas(t),e.producedFields.length===0&&e.remove()));for(let r of e.children)this.run(r,new Set([...t,...n]))}},Yze=class extends i8{constructor(){super()}run(e){e instanceof s6&&!e.isRequired()&&(this.setModified(),e.remove())}},Xze=class extends r8{run(e){if(!C2(e)&&!(e.numChildren()>1)){for(let t of e.children)if(t instanceof Z6)if(e instanceof Z6)this.setModified(),e.merge(t);else{if(cQ(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}},Zze=class extends r8{run(e){let t=[...e.children],n=e.children.filter(e=>e instanceof Z6);if(e.numChildren()>1&&n.length>=1){let r={},i=new Set;for(let e of n){let t=e.parse;for(let e of $(t))e in r?r[e]!==t[e]&&i.add(e):r[e]=t[e]}for(let e of i)delete r[e];if(!lQ(r)){this.setModified();let n=new Z6(e,r);for(let i of t){if(i instanceof Z6)for(let e of $(r))delete i.parse[e];e.removeChild(i),i.parent=n,i instanceof Z6&&$(i.parse).length===0&&i.remove()}}}}},Qze=class extends r8{run(e){e instanceof s6||e.numChildren()>0||e instanceof X6||e instanceof t8||(this.setModified(),e.remove())}},$ze=class extends r8{run(e){let t=e.children.filter(e=>e instanceof c6),n=t.pop();for(let e of t)this.setModified(),n.merge(e)}},eBe=class extends r8{run(e){let t=e.children.filter(e=>e instanceof Y6),n={};for(let e of t){let t=QZ(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(let t of $(n)){let r=n[t];if(r.length>1){let t=r.pop();for(let n of r)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}},tBe=class extends r8{model;constructor(e){super(),this.model=e}run(e){let t=!(C2(e)||e instanceof B6||e instanceof Z6||e instanceof Q6),n=[],r=[];for(let i of e.children)i instanceof J6&&(t&&!cQ(e.producedFields(),i.dependentFields())?n.push(i):r.push(i));if(n.length>0){let t=n.pop();for(let e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof J6?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(r.length>1){let e=r.pop();for(let t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}},nBe=class extends r8{run(e){let t=[...e.children];if(!tQ(t,e=>e instanceof s6)||e.numChildren()<=1)return;let n=[],r;for(let i of t)if(i instanceof s6){let t=i;for(;t.numChildren()===1;){let[e]=t.children;if(e instanceof s6)t=e;else break}n.push(...t.children),r?(e.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=t,this.setModified()):r=t}else n.push(i);if(n.length){this.setModified();for(let e of n)e.parent.removeChild(e),e.parent=r}}},a8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=iQ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??Q(e)}hash(){return`JoinAggregateTransform ${QZ(this.transform)}`}assemble(){let e=[],t=[],n=[];for(let r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(r.field===void 0?null:r.field);let r=this.transform.groupby;return{type:`joinaggregate`,as:n,ops:t,fields:e,...r===void 0?{}:{groupby:r}}}},o8=class e extends o6{filter;clone(){return new e(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(t,n,r){let{config:i,markDef:a}=n,{marks:o,scales:s}=r;if(o===`include-invalid-values`&&s===`include-invalid-values`)return null;let c=n.reduceFieldDef((e,t,r)=>{let o=JQ(r)&&n.getScaleComponent(r);if(o){let n=o.get(`type`),{aggregate:s}=t,c=v1({scaleChannel:r,markDef:a,config:i,scaleType:n,isCountAggregate:$Q(s)});c!==`show`&&c!==`always-valid`&&(e[t.field]=t)}return e},{});return $(c).length?new e(t,c):null}dependentFields(){return new Set($(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${QZ(this.filter)}`}assemble(){let e=$(this.filter).reduce((e,t)=>{let n=this.filter[t],r=Q(n,{expr:`datum`});return n!==null&&(n.type===`temporal`?e.push(`(isDate(${r}) || (${w2(r)}))`):n.type===`quantitative`&&e.push(w2(r))),e},[]);return e.length>0?{type:`filter`,expr:e.join(` && `)}:null}},s8=class e extends o6{_stack;clone(){return new e(null,q2(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(t,n){let{stack:r,groupby:i,as:a,offset:o=`zero`}=n,s=[],c=[];if(n.sort!==void 0)for(let e of n.sort)s.push(e.field),c.push(wQ(e.order,`ascending`));let l={field:s,order:c},u;return u=mFe(a)?a:Eg(a)?[a,`${a}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new e(t,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:u})}static makeFromEncoding(t,n){let r=n.stack,{encoding:i}=n;if(!r)return null;let{groupbyChannels:a,fieldChannel:o,offset:s,impute:c}=r,l=a.map(e=>{let t=i[e];return Q1(t)}).filter(e=>!!e),u=pFe(n),d=n.encoding.order,f;if(H(d)||Z(d))f=T$(d);else{let e=KAe(d)?d.sort:o===`y`?`descending`:`ascending`;f=u.reduce((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t),{field:[],order:[]})}return new e(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:u,sort:f,offset:s,impute:c,as:[n.vgField(o,{suffix:`start`,forAs:!0}),n.vgField(o,{suffix:`end`,forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){let e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${QZ(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map(e=>e.bin?t?[Q(e,{binSuffix:`mid`})]:[Q(e,{}),Q(e,{binSuffix:`end`})]:[Q(e)]).flat():n??[]}assemble(){let e=[],{facetby:t,dimensionFieldDefs:n,stackField:r,stackby:i,sort:a,offset:o,impute:s,as:c}=this._stack;if(s)for(let a of n){let{bandPosition:n=.5,bin:o}=a;if(o){let t=Q(a,{expr:`datum`}),r=Q(a,{expr:`datum`,binSuffix:`end`});e.push({type:`formula`,expr:`${w2(t)} ? ${n}*${t}+${1-n}*${r} : ${t}`,as:Q(a,{binSuffix:`mid`,forAs:!0})})}e.push({type:`impute`,field:r,groupby:[...i,...t],key:Q(a,{binSuffix:`mid`}),method:`value`,value:0})}return e.push({type:`stack`,groupby:[...this.getGroupbyFields(),...t],field:r,sort:a,as:c,offset:o}),e}},c8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=iQ(this.transform.groupby.concat(e),e=>e)}dependentFields(){let e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach(t=>e.add(t.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??Q(e)}hash(){return`WindowTransform ${QZ(this.transform)}`}assemble(){let e=[],t=[],n=[],r=[];for(let i of this.transform.window)t.push(i.op),n.push(this.getDefaultName(i)),r.push(i.param===void 0?null:i.param),e.push(i.field===void 0?null:i.field);let i=this.transform.frame,a=this.transform.groupby;if(i&&i[0]===null&&i[1]===null&&t.every(e=>QQ(e)))return{type:`joinaggregate`,as:n,ops:t,fields:e,...a===void 0?{}:{groupby:a}};let o=[],s=[];if(this.transform.sort!==void 0)for(let e of this.transform.sort)o.push(e.field),s.push(e.order??`ascending`);let c={field:o,order:s},l=this.transform.ignorePeers;return{type:`window`,params:r,as:n,ops:t,fields:e,sort:c,...l===void 0?{}:{ignorePeers:l},...a===void 0?{}:{groupby:a},...i===void 0?{}:{frame:i}}}},l8=`scale_`,u8=5,d8=class e{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}signal;static fromName(t,n){return new e(()=>t(n))}},rBe=[`type`,`clipAngle`,`clipExtent`,`center`,`rotate`,`precision`,`reflectX`,`reflectY`,`coefficient`,`distance`,`fraction`,`lobes`,`parallel`,`radius`,`ratio`,`spacing`,`tilt`],f8=class extends i6{specifiedProjection;size;data;merged=!1;constructor(e,t,n,r){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=r}get isFit(){return!!this.data}},p8=class extends i6{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit(`type`,t)}domainHasZero(){let e=this.get(`type`);if(eQ([d3.LOG,d3.TIME,d3.UTC],e))return`definitely-not`;let t=this.get(`zero`);if(t===!0||t===void 0&&eQ([d3.LINEAR,d3.SQRT,d3.POW],e))return`definitely`;let n=this.get(`domains`);if(n.length>0){let e=!1,t=!1,r=!1;for(let i of n){if(H(i)){let n=i[0],r=i[i.length-1];if(wg(n)&&wg(r))if(n<=0&&r>=0){e=!0;continue}else{t=!0;continue}}r=!0}if(e)return`definitely`;if(t&&!r)return`definitely-not`}return`maybe`}},iBe=[`range`,`scheme`],m8=.95,h8={bins:({model:e,fieldOrDatumDef:t})=>Z(t)?hIe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>gIe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>_Ie(e,t,n,r,i,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>vIe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:a})=>yIe(e,t,n.type,r,i.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>bIe(e,t,n,r,i.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>xIe(t,Z(e)?e.sort:void 0,n,r.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>SIe(e,t,n,r,i,a.scale,o)},aBe=$Me((e,t)=>fAe(e)-fAe(t)),g8=class{nameMap;constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return this.nameMap[e]!==void 0}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}},_8=class{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(e,t,n,r,i,a,o){this.type=t,this.parent=n,this.config=i,this.parent=n,this.config=i,this.view=s$(o),this.name=e.name??r,this.title=l$(e.title)?{text:e.title}:e.title?s$(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new g8,this.projectionNameMap=n?n.projectionNameMap:new g8,this.signalNameMap=n?n.signalNameMap:new g8,this.data=e.data,this.description=e.description,this.transforms=VMe(e.transform??[]),this.layout=t===`layer`||t===`unit`?{}:Uje(e,t,i),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:M1(e)||n?.component.data.isFaceted&&e.data===void 0},layoutSize:new i6,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?q2(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef(`width`)}get height(){return this.getSizeSignalRef(`height`)}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){TIe(this)}parseProjection(){HFe(this)}renameTopLevelLayoutSizeSignal(){this.getName(`width`)!==`width`&&this.renameSignal(this.getName(`width`),`width`),this.getName(`height`)!==`height`&&this.renameSignal(this.getName(`height`),`height`)}parseLegends(){qPe(this)}assembleEncodeFromView(e){let{style:t,...n}=e,r={};for(let e of $(n)){let t=n[e];t!==void 0&&(r[e]=_$(t))}return r}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),!e&&(this.description&&(t.description=_$(this.description)),this.type===`unit`||this.type===`layer`)?{width:this.getSizeSignalRef(`width`),height:this.getSizeSignalRef(`height`),...t}:lQ(t)?void 0:t}assembleLayout(){if(!this.layout)return;let{spacing:e,...t}=this.layout,{component:n,config:r}=this,i=wPe(n.layoutHeaders,r);return{padding:e,...this.assembleDefaultLayout(),...t,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:e}=this.component,t=[];for(let n of z4)e[n].title&&t.push(_Pe(this,n));for(let e of U6)t=t.concat(bPe(this,e));return t}assembleAxes(){return ePe(this.component.axes,this.config)}assembleLegends(){return LFe(this)}assembleProjections(){return zFe(this)}assembleTitle(){let{encoding:e,...t}=this.title??{},n={...c$(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return eQ([`unit`,`layer`],this.type)?eQ([`middle`,void 0],n.anchor)&&(n.frame??=`group`):n.anchor??=`start`,lQ(n)?void 0:n}assembleGroup(e=[]){let t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);let n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let r=!this.parent||I2(this.parent)?qFe(this):[];r.length>0&&(t.scales=r);let i=this.assembleAxes();i.length>0&&(t.axes=i);let a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(e){return fQ((this.name?`${this.name}_`:``)+e)}getDataName(e){return this.getName(a6[e].toLowerCase())}requestDataName(e){let t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(I2(this.parent)){let t=GQ(OPe(e)),n=this.component.scales[t];if(n&&!n.merged){let e=n.get(`type`),r=n.get(`range`);if(l1(e)&&d$(r)){let e=n.get(`name`),r=M2(N2(this,t));return r?{signal:DPe(e,n,Q({aggregate:`distinct`,field:r},{expr:`datum`}))}:(X(N$(t)),null)}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){let t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){if(t)return this.getName(e);if(IQ(e)&&JQ(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e)))return this.scaleNameMap.get(this.getName(e))}projectionName(e){if(e)return this.getName(`projection`);if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName(`projection`)))return this.projectionNameMap.get(this.getName(`projection`))}getScaleComponent(e){if(!this.component.scales)throw Error(`getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().`);let t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){let t=this.getScaleComponent(e);return t?t.get(`type`):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw Error(WOe(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some(e=>e.hasOrientSignalRef())||this.component.axes.y?.some(e=>e.hasOrientSignalRef())}},v8=class extends _8{vgField(e,t={}){let n=this.fieldDef(e);if(n)return Q(n,t)}reduceFieldDef(e,t){return yje(this.getMapping(),(t,n,r)=>{let i=Q1(n);return i?e(t,i,r):t},t)}forEachFieldDef(e,t){u0(this.getMapping(),(t,n)=>{let r=Q1(t);r&&e(r,n)},t)}},y8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`value`,n[1]??`density`];let r=this.transform.resolve??`shared`;this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${QZ(this.transform)}`}assemble(){let{density:e,...t}=this.transform,n={type:`kde`,field:e,...t};return n.resolve=this.transform.resolve,n}},b8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${QZ(this.transform)}`}assemble(){let{extent:e,param:t}=this.transform;return{type:`extent`,field:e,signal:t}}},x8=class e extends o6{transform;clone(){return new e(this.parent,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let{flatten:n,as:r=[]}=this.transform;this.transform.as=n.map((e,t)=>r[t]??e)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${QZ(this.transform)}`}assemble(){let{flatten:e,as:t}=this.transform;return{type:`flatten`,fields:e,as:t}}},S8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`key`,n[1]??`value`]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${QZ(this.transform)}`}assemble(){let{fold:e,as:t}=this.transform;return{type:`fold`,fields:e,as:t}}},C8=class e extends o6{fields;geojson;signal;clone(){return new e(null,q2(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let r=0;for(let i of[[f4,d4],[m4,p4]]){let a=i.map(e=>{let t=$1(n.encoding[e]);return Z(t)?t.field:z1(t)?{expr:`${t.datum}`}:W1(t)?{expr:`${t.value}`}:void 0});(a[0]||a[1])&&(t=new e(t,a,null,n.getName(`geojson_${r++}`)))}if(n.channelHasField(y4)){let i=n.typedFieldDef(y4);i.type===u3&&(t=new e(t,null,i.field,n.getName(`geojson_${r}`)))}return t}constructor(e,t,n,r){super(e),this.fields=t,this.geojson=n,this.signal=r}dependentFields(){let e=(this.fields??[]).filter(Eg);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${QZ(this.fields)}`}assemble(){return[...this.geojson?[{type:`filter`,expr:`isValid(datum["${this.geojson}"])`}]:[],{type:`geojson`,...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}},w8=class e extends o6{projection;fields;as;clone(){return new e(null,this.projection,q2(this.fields),q2(this.as))}constructor(e,t,n,r){super(e),this.projection=t,this.fields=n,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(let r of[[f4,d4],[m4,p4]]){let i=r.map(e=>{let t=$1(n.encoding[e]);return Z(t)?t.field:z1(t)?{expr:`${t.datum}`}:W1(t)?{expr:`${t.value}`}:void 0}),a=r[0]===m4?`2`:``;(i[0]||i[1])&&(t=new e(t,n.projectionName(),i,[n.getName(`x${a}`),n.getName(`y${a}`)]))}return t}dependentFields(){return new Set(this.fields.filter(Eg))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${QZ(this.fields)} ${QZ(this.as)}`}assemble(){return{type:`geopoint`,projection:this.projection,fields:this.fields,as:this.as}}},T8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){let{start:t=0,stop:n,step:r}=e;return{signal:`sequence(${[t,n,...r?[r]:[]].join(`,`)})`}}static makeFromTransform(t,n){return new e(t,n)}static makeFromEncoding(t,n){let r=n.encoding,i=r.x,a=r.y;if(Z(i)&&Z(a)){let o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;let s=i.impute?a:a.impute?i:void 0,{method:c,value:l,frame:u,keyvals:d}=o.impute,f=bje(n.mark,r);return new e(t,{impute:o.field,key:s.field,...c?{method:c}:{},...l===void 0?{}:{value:l},...u?{frame:u}:{},...d===void 0?{}:{keyvals:d},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${QZ(this.transform)}`}assemble(){let{impute:e,key:t,keyvals:n,method:r,groupby:i,value:a,frame:o=[null,null]}=this.transform,s={type:`impute`,field:e,key:t,...n?{keyvals:bMe(n)?this.processSequence(n):n}:{},method:`value`,...i?{groupby:i}:{},value:!r||r===`value`?a:null};return r&&r!==`value`?[s,{type:`window`,as:[`imputed_${e}_value`],ops:[r],fields:[e],frame:o,ignorePeers:!1,...i?{groupby:i}:{}},{type:`formula`,expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]:[s]}},E8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${QZ(this.transform)}`}assemble(){let{loess:e,on:t,...n}=this.transform;return{type:`loess`,x:t,y:e,...n}}},D8=class e extends o6{transform;secondary;clone(){return new e(null,q2(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(t,n,r,i){let a=n.component.data.sources,{from:o}=r,s=null;if(SMe(o)){let e=HIe(o.data,a);e||(e=new t8(o.data),a.push(e));let t=n.getName(`lookup_${i}`);s=new s6(e,t,a6.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[t]=s}else if(CMe(o)){let e=o.param;r={as:e,...r};let t;try{t=n.getSelectionComponent(fQ(e),e)}catch{throw Error(GOe(e))}if(s=t.materialized,!s)throw Error(KOe(e))}return new e(t,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?ng(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${QZ({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:ng(this.transform.as)}:{}};else{let t=this.transform.as;Eg(t)||(X(vRe),t=`_lookup`),e={as:[t]}}return{type:`lookup`,from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}},O8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??`prob`,n[1]??`value`]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${QZ(this.transform)}`}assemble(){let{quantile:e,...t}=this.transform;return{type:`quantile`,field:e,...t}}},k8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=q2(t);let n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${QZ(this.transform)}`}assemble(){let{regression:e,on:t,...n}=this.transform;return{type:`regression`,x:t,y:e,...n}}},A8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=iQ((this.transform.groupby??[]).concat(e),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${QZ(this.transform)}`}assemble(){let{pivot:e,value:t,groupby:n,limit:r,op:i}=this.transform;return{type:`pivot`,field:e,value:t,...r===void 0?{}:{limit:r},...i===void 0?{}:{op:i},...n===void 0?{}:{groupby:n}}}},j8=class e extends o6{transform;clone(){return new e(null,q2(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${QZ(this.transform)}`}assemble(){return{type:`sample`,size:this.transform.sample}}},oBe=class e extends v8{facet;child;children;constructor(e,t,n,r){super(e,`facet`,t,n,r,e.resolve),this.child=K2(e.spec,this,this.getName(`child`),void 0,r),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!A1(e))return{facet:this.initFacetFieldDef(e,`facet`)};let t=$(e),n={};for(let r of t){if(![Q2,$2].includes(r)){X(H$(r,`facet`));break}let t=e[r];if(t.field===void 0){X(V$(t,r));break}n[r]=this.initFacetFieldDef(t,r)}return n}initFacetFieldDef(e,t){let n=t0(e,t);return n.header?n.header=s$(n.header):n.header===null&&(n.header=null),n}channelHasField(e){return Y(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=H2(this),this.child.parseData()}parseLayoutSize(){z2(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,J2(this.component.selection).some(e=>o2(e))&&G$(Z4)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),NIe(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){let e={};for(let t of z4)for(let n of W6){let r=this.component.layoutHeaders[t],i=r[n],{facetFieldDef:a}=r;if(a){let n=h2(`titleOrient`,a.header,this.config,t);if([`right`,`bottom`].includes(n)){let r=m2(t,n);e.titleAnchor??={},e.titleAnchor[r]=`end`}}if(i?.[0]){let i=t===`row`?`height`:`width`,a=n===`header`?`headerBand`:`footerBand`;t!==`facet`&&!this.child.component.layoutSize.get(i)&&(e[a]??={},e[a][t]=.5),r.title&&(e.offset??={},e.offset[t===`row`?`rowTitle`:`columnTitle`]=10)}}return e}assembleDefaultLayout(){let{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0,r=`all`;return(!t&&this.component.resolve.scale.x===`independent`||!e&&this.component.resolve.scale.y===`independent`)&&(r=`none`),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:`full`,align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof e))return{signal:`length(data('${this.getName(`column_domain`)}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof e?{...this.channelHasField(`column`)?{encode:{update:{columns:{field:Q(this.facet.column,{prefix:`distinct`})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){let t=[],n=[],r=[];if(this.child instanceof e){if(this.child.channelHasField(`column`)){let e=Q(this.child.facet.column);t.push(e),n.push(`distinct`),r.push(`distinct_${e}`)}}else for(let e of U4){let i=this.child.component.scales[e];if(i&&!i.merged){let a=i.get(`type`),o=i.get(`range`);if(l1(a)&&d$(o)){let i=M2(N2(this.child,e));i?(t.push(i),n.push(`distinct`),r.push(`distinct_${i}`)):X(N$(e))}}}return{fields:t,ops:n,as:r}}assembleFacet(){let{name:e,data:t}=this.component.data.facetRoot,{row:n,column:r}=this.facet,{fields:i,ops:a,as:o}=this.getCardinalityAggregateForChild(),s=[];for(let e of z4){let t=this.facet[e];if(t){s.push(Q(t));let{bin:c,sort:l}=t;if(t$(c)&&s.push(Q(t,{binSuffix:`end`})),k1(l)){let{field:e,op:s=M3}=l,c=V2(t,l);n&&r?(i.push(c),a.push(`max`),o.push(c)):(i.push(e),a.push(s),o.push(c))}else if(H(l)){let n=p2(t,e);i.push(n),a.push(`max`),o.push(n)}}}let c=!!n&&!!r;return{name:e,data:t,groupby:s,...c||i.length>0?{aggregate:{...c?{cross:c}:{},...i.length?{fields:i,ops:a,as:o}:{}}}:{}}}facetSortFields(e){let{facet:t}=this,n=t[e];return n?k1(n.sort)?[V2(n,n.sort,{expr:`datum`})]:H(n.sort)?[p2(n,e,{expr:`datum`})]:[Q(n,{expr:`datum`})]:[]}facetSortOrder(e){let{facet:t}=this,n=t[e];if(n){let{sort:e}=n;return[(k1(e)?e.order:!H(e)&&e)||`ascending`]}return[]}assembleLabelTitle(){let{facet:e,config:t}=this;if(e.facet)return _2(e.facet,`facet`,t);let n={row:[`top`,`bottom`],column:[`left`,`right`]};for(let r of U6)if(e[r]){let i=h2(`labelOrient`,e[r]?.header,t,r);if(n[r].includes(i))return _2(e[r],r,t)}}assembleMarks(){let{child:e}=this,t=this.component.data.facetRoot,n=AIe(t),r=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),a=e.assembleGroupStyle();return[{name:this.getName(`cell`),type:`group`,...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:z4.map(e=>this.facetSortFields(e)).flat(),order:z4.map(e=>this.facetSortOrder(e)).flat()},...n.length>0?{data:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup(dNe(this,[]))}]}getMapping(){return this.facet}},sBe=class extends _8{children;constructor(e,t,n,r){super(e,`concat`,t,n,r,e.resolve),(e.resolve?.axis?.x===`shared`||e.resolve?.axis?.y===`shared`)&&X(gRe),this.children=this.getChildren(e).map((e,t)=>K2(e,this,this.getName(`concat_${t}`),void 0,r))}parseData(){this.component.data=H2(this);for(let e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}J2(this.component.selection).some(e=>o2(e))&&G$(Z4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(let e of this.children)e.parseAxesAndHeaders()}getChildren(e){return b0(e)?e.vconcat:x0(e)?e.hconcat:e.concat}parseLayoutSize(){RIe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){let e=v2(this);for(let t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{let t=e.assembleTitle(),n=e.assembleGroupStyle(),r=e.assembleGroupEncodeEntry(!1);return{type:`group`,name:e.getName(`group`),...t?{title:t}:{},...n?{style:n}:{},...r?{encode:{update:r}}:{},...e.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){let e=this.layout.columns;return{...e==null?{}:{columns:e},bounds:`full`,align:`each`}}},M8=$({disable:1,gridScale:1,scale:1,...R3,labelExpr:1,encode:1}),cBe=class e extends i6{explicit;implicit;mainExtracted;constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new e(q2(this.explicit),q2(this.implicit),this.mainExtracted)}hasAxisPart(e){return e===`axis`?!0:e===`grid`||e===`title`?!!this.get(e):!GIe(this.get(e))}hasOrientSignalRef(){return u$(this.explicit.orient)}},lBe={bottom:`top`,top:`bottom`,left:`right`,right:`left`},uBe=new Set([`grid`,`translate`,`format`,`formatType`,`orient`,`labelExpr`,`tickCount`,`position`,`tickMinStep`]),dBe={vgMark:`arc`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...Z0(`x`,e,{defaultPos:`mid`}),...Z0(`y`,e,{defaultPos:`mid`}),...t2(e,`radius`),...t2(e,`theta`)})},fBe={vgMark:`area`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`include`,size:`ignore`,theta:`ignore`}),...$0(`x`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`horizontal`}),...$0(`y`,e,{defaultPos:`zeroOrMin`,defaultPos2:`zeroOrMin`,range:e.markDef.orient===`vertical`}),...r2(e)})},pBe={vgMark:`rect`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...t2(e,`x`),...t2(e,`y`)})},mBe={vgMark:`shape`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`})}),postEncodingTransform:e=>{let{encoding:t}=e,n=t.shape;return[{type:`geoshape`,projection:e.projectionName(),...n&&Z(n)&&n.type===u3?{field:Q(n,{expr:`datum`})}:{}}]}},hBe={vgMark:`image`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`ignore`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...t2(e,`x`),...t2(e,`y`),...q0(e,`url`)})},gBe={vgMark:`line`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`ignore`,orient:`ignore`,theta:`ignore`}),...Z0(`x`,e,{defaultPos:`mid`}),...Z0(`y`,e,{defaultPos:`mid`}),...Y0(`size`,e,{vgChannel:`strokeWidth`}),...r2(e)})},_Be={vgMark:`trail`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,size:`include`,orient:`ignore`,theta:`ignore`}),...Z0(`x`,e,{defaultPos:`mid`}),...Z0(`y`,e,{defaultPos:`mid`}),...Y0(`size`,e),...r2(e)})},vBe={vgMark:`symbol`,encodeEntry:e=>W2(e)},yBe={vgMark:`symbol`,encodeEntry:e=>W2(e,`circle`)},bBe={vgMark:`symbol`,encodeEntry:e=>W2(e,`square`)},xBe={vgMark:`rect`,encodeEntry:e=>({...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...t2(e,`x`),...t2(e,`y`)})},SBe={vgMark:`rule`,encodeEntry:e=>{let{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...$0(`x`,e,{defaultPos:n===`horizontal`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`vertical`}),...$0(`y`,e,{defaultPos:n===`vertical`?`zeroOrMax`:`mid`,defaultPos2:`zeroOrMin`,range:n!==`horizontal`}),...Y0(`size`,e,{vgChannel:`strokeWidth`})}}},CBe={vgMark:`text`,encodeEntry:e=>{let{config:t,encoding:n}=e;return{...n2(e,{align:`include`,baseline:`include`,color:`include`,size:`ignore`,orient:`ignore`,theta:`include`}),...Z0(`x`,e,{defaultPos:`mid`}),...Z0(`y`,e,{defaultPos:`mid`}),...q0(e),...Y0(`size`,e,{vgChannel:`fontSize`}),...Y0(`angle`,e),...BNe(`align`,tLe(e.markDef,n,t)),...BNe(`baseline`,nLe(e.markDef,n,t)),...Z0(`radius`,e,{defaultPos:null}),...Z0(`theta`,e,{defaultPos:null})}}},N8={arc:dBe,area:fBe,bar:pBe,circle:yBe,geoshape:mBe,image:hBe,line:gBe,point:vBe,rect:xBe,rule:SBe,square:bBe,text:CBe,tick:{vgMark:`rect`,encodeEntry:e=>{let{config:t,markDef:n}=e,r=n.orient,i=r===`horizontal`?`x`:`y`,a=r===`horizontal`?`y`:`x`,o=r===`horizontal`?`height`:`width`;return{...n2(e,{align:`ignore`,baseline:`ignore`,color:`include`,orient:`ignore`,size:`ignore`,theta:`ignore`}),...t2(e,i),...Z0(a,e,{defaultPos:`mid`,vgChannel:a===`y`?`yc`:`xc`}),[o]:_$(x$(`thickness`,n,t))}}},trail:_Be},P8=`faceted_path_`,F8=`stack_group_`,I8=class extends v8{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,t,n,r={},i){super(e,`unit`,t,n,i,void 0,Hje(e)?e.view:void 0);let a=g1(e.mark)?{...e.mark}:{type:e.mark},o=a.type;a.filled===void 0&&(a.filled=cMe(a,i,{graticule:e.data&&B0(e.data)}));let s=this.encoding=_je(e.encoding||{},o,a.filled,i);this.markDef=aMe(a,s,i),this.size=$Ie({encoding:s,size:Hje(e)?{...r,...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}:r}),this.stack=iMe(this.markDef,s),this.specifiedScales=this.initScales(o,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter(e=>v0(e)),this.alignStackOrderWithColorDomain()}get hasProjection(){let{encoding:e}=this,t=this.mark===D3,n=e&&hLe.some(t=>H1(e[t]));return t||n}scaleDomain(e){let t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return J4.reduce((e,n)=>{let r=$1(t[n]);return r&&(e[n]=this.initScale(r.scale??{})),e},{})}initScale(e){let{domain:t,range:n}=e,r=s$(e);return H(t)&&(r.domain=t.map(h$)),H(n)&&(r.range=n.map(h$)),r}initAxes(e){return U4.reduce((t,n)=>{let r=e[n];if(H1(r)||n===t4&&H1(e.x2)||n===n4&&H1(e.y2)){let e=H1(r)?r.axis:void 0;t[n]=e&&this.initAxis({...e})}return t},{})}initAxis(e){let t=$(e),n={};for(let r of t){let t=e[r];n[r]=o0(t)?m$(t):h$(t)}return n}initLegends(e){return QLe.reduce((t,n)=>{let r=$1(e[n]);if(r&&FOe(n)){let e=r.legend;t[n]=e&&s$(e)}return t},{})}alignStackOrderWithColorDomain(){let{color:e,fill:t,order:n,xOffset:r,yOffset:i}=this.encoding,a=t||e,o=Z(a)?a:void 0,s=o?.field,c=o?.scale,l=o?.type,u=c?.domain,d=r||i,f=Z(d)?d:void 0,p=`_${s}_sort_index`;if(!n&&Array.isArray(u)&&typeof s==`string`&&l===`nominal`)if(f&&!f.sort)f.sort=u;else{if(!this.stack)return;let e=`indexof(${W(u)}, datum['${s}'])`,t=this.markDef?.orient===`horizontal`?`ascending`:`descending`;this.transforms.push({calculate:e,as:p}),this.encoding.order={field:p,type:`quantitative`,sort:t}}}parseData(){this.component.data=H2(this)}parseLayoutSize(){zIe(this)}parseSelections(){this.component.selection=JNe(this,this.selection)}parseMarkGroup(){this.component.mark=rLe(this)}parseAxesAndHeaders(){this.component.axes=qIe(this)}assembleSelectionTopLevelSignals(e){return fNe(this,e)}assembleSignals(){return[...$Ne(this),...uNe(this,[])]}assembleSelectionData(e){return pNe(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return v2(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),`time`in this.encoding&&(e.from.data=e.from.data+f6)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return(!this.parent||!R2(this.parent))&&(e=mNe(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){let{style:e}=this.view||{};return e===void 0?this.encoding.x||this.encoding.y?`cell`:`view`:e}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return c0(this.encoding,e)}fieldDef(e){let t=this.encoding[e];return Q1(t)}typedFieldDef(e){let t=this.fieldDef(e);return U1(t)?t:null}},wBe=class e extends _8{children;constructor(t,n,r,i,a){super(t,`layer`,n,r,a,t.resolve,t.view);let o={...i,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((t,n)=>{if(E0(t))return new e(t,this,this.getName(`layer_${n}`),o,a);if(s0(t))return new I8(t,this,this.getName(`layer_${n}`),o,a);throw Error(k$(t))})}parseData(){this.component.data=H2(this);for(let e of this.children)e.parseData()}parseLayoutSize(){LIe(this)}parseSelections(){this.component.selection={};for(let e of this.children){e.parseSelections();for(let t of $(e.component.selection))this.component.selection[t]=e.component.selection[t]}J2(this.component.selection).some(e=>o2(e))&&G$(Z4)}parseMarkGroup(){for(let e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){JIe(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),$Ne(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),v2(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleGroupStyle(){let e=new Set;for(let t of this.children)for(let n of ng(t.assembleGroupStyle()))e.add(n);let t=Array.from(e);return t.length>1?t:t.length===1?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(let t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return hNe(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),LFe(this))}},TBe=pLe.version}));function DBe(e){let[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var OBe=o((()=>{})),kBe=c({carbong10:()=>cVe,carbong100:()=>uVe,carbong90:()=>lVe,carbonwhite:()=>sVe,dark:()=>jBe,excel:()=>MBe,fivethirtyeight:()=>FBe,ggplot2:()=>IBe,googlecharts:()=>JBe,latimes:()=>BBe,powerbi:()=>rVe,quartz:()=>VBe,urbaninstitute:()=>qBe,version:()=>dVe,vox:()=>HBe});function L8({theme:e,background:t}){let n=[`white`,`g10`].includes(e)?`light`:`dark`,r=T5.gridBg[e],i=T5.textPrimary[e],a=T5.textSecondary[e],o=n===`dark`?aVe:oVe,s=n===`dark`?`#d4bbff`:`#6929c4`;return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:`start`,dy:-15,fontSize:16,font:C5,fontWeight:600},axis:{labelColor:a,labelFontSize:12,labelFont:iVe,labelFontWeight:w5,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:T5.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:C5,fill:a,fontWeight:w5},"guide-title":{font:C5,fill:a,fontWeight:w5}},range:{category:o,diverging:[`#750e13`,`#a2191f`,`#da1e28`,`#fa4d56`,`#ff8389`,`#ffb3b8`,`#ffd7d9`,`#fff1f1`,`#e5f6ff`,`#bae6ff`,`#82cfff`,`#33b1ff`,`#1192e8`,`#0072c3`,`#00539a`,`#003a6d`],heatmap:[`#f6f2ff`,`#e8daff`,`#d4bbff`,`#be95ff`,`#a56eff`,`#8a3ffc`,`#6929c4`,`#491d8b`,`#31135e`,`#1c0f30`]}}}var ABe,R8,z8,jBe,B8,MBe,V8,H8,NBe,PBe,U8,W8,FBe,G8,IBe,LBe,RBe,K8,q8,zBe,J8,Y8,X8,Z8,Q8,BBe,$8,e5,VBe,t5,HBe,n5,r5,UBe,i5,a5,WBe,GBe,KBe,o5,qBe,s5,c5,l5,JBe,u5,d5,f5,p5,m5,h5,g5,_5,v5,YBe,y5,XBe,ZBe,QBe,$Be,eVe,tVe,nVe,b5,x5,S5,rVe,C5,iVe,w5,T5,aVe,oVe,sVe,cVe,lVe,uVe,dVe,fVe=o((()=>{ABe={version:`3.0.0`},R8=`#fff`,z8=`#888`,jBe={background:`#333`,view:{stroke:z8},title:{color:R8,subtitleColor:R8},style:{"guide-label":{fill:R8},"guide-title":{fill:R8}},axis:{domainColor:R8,gridColor:z8,tickColor:R8}},B8=`#4572a7`,MBe={background:`#fff`,arc:{fill:B8},area:{fill:B8},line:{stroke:B8,strokeWidth:2},path:{stroke:B8},rect:{fill:B8},shape:{stroke:B8},symbol:{fill:B8,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:`#000000`,gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:50,symbolType:`square`},range:{category:[`#4572a7`,`#aa4643`,`#8aa453`,`#71598e`,`#4598ae`,`#d98445`,`#94aace`,`#d09393`,`#b9cc98`,`#a99cbc`]}},V8=`#30a2da`,H8=`#cbcbcb`,NBe=`#999`,PBe=`#333`,U8=`#f0f0f0`,W8=`#333`,FBe={arc:{fill:V8},area:{fill:V8},axis:{domainColor:H8,grid:!0,gridColor:H8,gridWidth:1,labelColor:NBe,labelFontSize:10,titleColor:PBe,tickColor:H8,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:U8,group:{fill:U8},legend:{labelColor:W8,labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`,titleColor:W8,titleFontSize:14,titlePadding:10},line:{stroke:V8,strokeWidth:2},path:{stroke:V8,strokeWidth:.5},rect:{fill:V8},range:{category:[`#30a2da`,`#fc4f30`,`#e5ae38`,`#6d904f`,`#8b8b8b`,`#b96db8`,`#ff9e27`,`#56cc60`,`#52d2ca`,`#52689e`,`#545454`,`#9fe4f8`],diverging:[`#cc0020`,`#e77866`,`#f6e7e1`,`#d6e8ed`,`#91bfd9`,`#1d78b5`],heatmap:[`#d6e8ed`,`#cee0e5`,`#91bfd9`,`#549cc6`,`#1d78b5`]},point:{filled:!0,shape:`circle`},shape:{stroke:V8},bar:{binSpacing:2,fill:V8,stroke:null},title:{anchor:`start`,fontSize:24,fontWeight:600,offset:20}},G8=`#000`,IBe={group:{fill:`#e5e5e5`},arc:{fill:G8},area:{fill:G8},line:{stroke:G8},path:{stroke:G8},rect:{fill:G8},shape:{stroke:G8},symbol:{fill:G8,size:40},axis:{domain:!1,grid:!0,gridColor:`#FFFFFF`,gridOpacity:1,labelColor:`#7F7F7F`,labelPadding:4,tickColor:`#7F7F7F`,tickSize:5.67,titleFontSize:16,titleFontWeight:`normal`},legend:{labelBaseline:`middle`,labelFontSize:11,symbolSize:40},range:{category:[`#000000`,`#7F7F7F`,`#1A1A1A`,`#999999`,`#333333`,`#B0B0B0`,`#4D4D4D`,`#C9C9C9`,`#666666`,`#DCDCDC`]}},LBe=22,RBe=`normal`,K8=`Benton Gothic, sans-serif`,q8=11.5,zBe=`normal`,J8=`#82c6df`,Y8=`Benton Gothic Bold, sans-serif`,X8=`normal`,Z8=13,Q8={"category-6":[`#ec8431`,`#829eb1`,`#c89d29`,`#3580b1`,`#adc839`,`#ab7fb4`],"fire-7":[`#fbf2c7`,`#f9e39c`,`#f8d36e`,`#f4bb6a`,`#e68a4f`,`#d15a40`,`#ab4232`],"fireandice-6":[`#e68a4f`,`#f4bb6a`,`#f9e39c`,`#dadfe2`,`#a6b7c6`,`#849eae`]},BBe={background:`#ffffff`,title:{anchor:`start`,color:`#000000`,font:Y8,fontSize:LBe,fontWeight:RBe},arc:{fill:J8},area:{fill:J8},line:{stroke:J8,strokeWidth:2},path:{stroke:J8},rect:{fill:J8},shape:{stroke:J8},symbol:{fill:J8,size:30},axis:{labelFont:K8,labelFontSize:q8,labelFontWeight:zBe,titleFont:Y8,titleFontSize:Z8,titleFontWeight:X8},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:`middle`,maxExtent:45,minExtent:45,tickSize:2,titleAlign:`left`,titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:K8,labelFontSize:q8,symbolType:`square`,titleFont:Y8,titleFontSize:Z8,titleFontWeight:X8},range:{category:Q8[`category-6`],diverging:Q8[`fireandice-6`],heatmap:Q8[`fire-7`],ordinal:Q8[`fire-7`],ramp:Q8[`fire-7`]}},$8=`#ab5787`,e5=`#979797`,VBe={background:`#f9f9f9`,arc:{fill:$8},area:{fill:$8},line:{stroke:$8},path:{stroke:$8},rect:{fill:$8},shape:{stroke:$8},symbol:{fill:$8,size:30},axis:{domainColor:e5,domainWidth:.5,gridWidth:.2,labelColor:e5,tickColor:e5,tickWidth:.2,titleColor:e5},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:`square`},range:{category:[`#ab5787`,`#51b2e5`,`#703c5c`,`#168dd9`,`#d190b6`,`#00609f`,`#d365ba`,`#154866`,`#666666`,`#c4c4c4`]}},t5=`#3e5c69`,HBe={background:`#fff`,arc:{fill:t5},area:{fill:t5},line:{stroke:t5},path:{stroke:t5},rect:{fill:t5},shape:{stroke:t5},symbol:{fill:t5},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:`normal`},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:`square`},range:{category:[`#3e5c69`,`#6793a6`,`#182429`,`#0570b0`,`#3690c0`,`#74a9cf`,`#a6bddb`,`#e2ddf2`]}},n5=`#1696d2`,r5=`#000000`,UBe=`#FFFFFF`,i5=`Lato`,a5=`Lato`,WBe=`Lato`,GBe=`#DEDDDD`,KBe=18,o5={"shades-blue":[`#CFE8F3`,`#A2D4EC`,`#73BFE2`,`#46ABDB`,`#1696D2`,`#12719E`,`#0A4C6A`,`#062635`],"six-groups-cat-1":[`#1696d2`,`#ec008b`,`#fdbf11`,`#000000`,`#d2d2d2`,`#55b748`],"six-groups-seq":[`#cfe8f3`,`#a2d4ec`,`#73bfe2`,`#46abdb`,`#1696d2`,`#12719e`],"diverging-colors":[`#ca5800`,`#fdbf11`,`#fdd870`,`#fff2cf`,`#cfe8f3`,`#73bfe2`,`#1696d2`,`#0a4c6a`]},qBe={background:UBe,title:{anchor:`start`,fontSize:KBe,font:i5},axisX:{domain:!0,domainColor:r5,domainWidth:1,grid:!1,labelFontSize:12,labelFont:a5,labelAngle:0,tickColor:r5,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:i5},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:GBe,gridWidth:1,labelFontSize:12,labelFont:a5,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:i5,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:a5,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:i5,orient:`right`,offset:10},view:{stroke:`transparent`},range:{category:o5[`six-groups-cat-1`],diverging:o5[`diverging-colors`],heatmap:o5[`diverging-colors`],ordinal:o5[`six-groups-seq`],ramp:o5[`shades-blue`]},area:{fill:n5},rect:{fill:n5},line:{color:n5,stroke:n5,strokeWidth:5},trail:{color:n5,stroke:n5,strokeWidth:0,size:1},path:{stroke:n5,strokeWidth:.5},point:{filled:!0},text:{font:WBe,color:n5,fontSize:11,align:`center`,fontWeight:400,size:11},style:{bar:{fill:n5,stroke:null}},arc:{fill:n5},shape:{stroke:n5},symbol:{fill:n5,size:30}},s5=`#3366CC`,c5=`#ccc`,l5=`Arial, sans-serif`,JBe={arc:{fill:s5},area:{fill:s5},path:{stroke:s5},rect:{fill:s5},shape:{stroke:s5},symbol:{stroke:s5},circle:{fill:s5},background:`#fff`,padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:l5,fontSize:12},"guide-title":{font:l5,fontSize:12},"group-title":{font:l5,fontSize:12}},title:{font:l5,fontSize:14,fontWeight:`bold`,dy:-3,anchor:`start`},axis:{gridColor:c5,tickColor:c5,domain:!1,grid:!0},range:{category:[`#4285F4`,`#DB4437`,`#F4B400`,`#0F9D58`,`#AB47BC`,`#00ACC1`,`#FF7043`,`#9E9D24`,`#5C6BC0`,`#F06292`,`#00796B`,`#C2185B`],heatmap:[`#c6dafc`,`#5e97f6`,`#2a56c6`]}},u5=e=>e*1.3333333333333333,d5=u5(9),f5=u5(10),p5=u5(12),m5=`Segoe UI`,h5=`wf_standard-font, helvetica, arial, sans-serif`,g5=`#252423`,_5=`#605E5C`,v5=`transparent`,YBe=`#C8C6C4`,y5=`#118DFF`,XBe=`#12239E`,ZBe=`#E66C37`,QBe=`#6B007B`,$Be=`#E044A7`,eVe=`#744EC2`,tVe=`#D9B300`,nVe=`#D64550`,b5=y5,x5=`#DEEFFF`,S5=[x5,b5],rVe={view:{stroke:v5},background:v5,font:m5,header:{titleFont:h5,titleFontSize:p5,titleColor:g5,labelFont:m5,labelFontSize:f5,labelColor:_5},axis:{ticks:!1,grid:!1,domain:!1,labelColor:_5,labelFontSize:d5,titleFont:h5,titleColor:g5,titleFontSize:p5,titleFontWeight:`normal`},axisQuantitative:{tickCount:3,grid:!0,gridColor:YBe,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:y5},line:{stroke:y5,strokeWidth:3,strokeCap:`round`,strokeJoin:`round`},text:{font:m5,fontSize:d5,fill:_5},arc:{fill:y5},area:{fill:y5,line:!0,opacity:.6},path:{stroke:y5},rect:{fill:y5},point:{fill:y5,filled:!0,size:75},shape:{stroke:y5},symbol:{fill:y5,strokeWidth:1.5,size:50},legend:{titleFont:m5,titleFontWeight:`bold`,titleColor:_5,labelFont:m5,labelFontSize:f5,labelColor:_5,symbolType:`circle`,symbolSize:75},range:{category:[y5,XBe,ZBe,QBe,$Be,eVe,tVe,nVe],diverging:S5,heatmap:S5,ordinal:[x5,`#c7e4ff`,`#b0d9ff`,`#9aceff`,`#83c3ff`,`#6cb9ff`,`#55aeff`,`#3fa3ff`,`#2898ff`,b5]}},C5=`IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif`,iVe=`IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif`,w5=400,T5={textPrimary:{g90:`#f4f4f4`,g100:`#f4f4f4`,white:`#161616`,g10:`#161616`},textSecondary:{g90:`#c6c6c6`,g100:`#c6c6c6`,white:`#525252`,g10:`#525252`},layerAccent01:{white:`#e0e0e0`,g10:`#e0e0e0`,g90:`#525252`,g100:`#393939`},gridBg:{white:`#ffffff`,g10:`#ffffff`,g90:`#161616`,g100:`#161616`}},aVe=[`#8a3ffc`,`#33b1ff`,`#007d79`,`#ff7eb6`,`#fa4d56`,`#fff1f1`,`#6fdc8c`,`#4589ff`,`#d12771`,`#d2a106`,`#08bdba`,`#bae6ff`,`#ba4e00`,`#d4bbff`],oVe=[`#6929c4`,`#1192e8`,`#005d5d`,`#9f1853`,`#fa4d56`,`#570408`,`#198038`,`#002d9c`,`#ee538b`,`#b28600`,`#009d9a`,`#012749`,`#8a3800`,`#a56eff`],sVe=L8({theme:`white`,background:`#ffffff`}),cVe=L8({theme:`g10`,background:`#f4f4f4`}),lVe=L8({theme:`g90`,background:`#262626`}),uVe=L8({theme:`g100`,background:`#161616`}),dVe=ABe.version}));function pVe(e,t,n,r){if(H(e))return`[${e.map(e=>t(Eg(e)?e:hVe(e,n))).join(`, `)}]`;if(Dh(e)){let i=``,{title:a,image:o,...s}=e;a&&(i+=`

${t(a)}

`),o&&(i+=``);let c=Object.keys(s);if(c.length>0){i+=``;for(let e of c){let r=s[e];r!==void 0&&(Dh(r)&&(r=hVe(r,n)),i+=``)}i+=`
${t(e)}${t(r)}
`}return i||`{}`}return t(e)}function mVe(e){let t=[];return function(n,r){if(typeof r!=`object`||!r)return r;let i=t.indexOf(this)+1;return t.length=i,t.length>e?`[Object]`:t.indexOf(r)>=0?`[Circular]`:(t.push(r),r)}}function hVe(e,t){return JSON.stringify(e,mVe(t))}function gVe(e){return String(e).replace(/&/g,`&`).replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function CVe(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}var wVe,TVe,E5,EVe,DVe,OVe=o((()=>{Fg(),wVe={version:`1.0.0`},TVe=`#vg-tooltip-element { visibility: hidden; padding: 8px; position: fixed; @@ -267,8 +267,8 @@ endobj #vg-tooltip-element.dark-theme td.key { color: #bfbfbf; } -`,P5=`vg-tooltip-element`,tVe={offsetX:10,offsetY:10,id:P5,styleId:`vega-tooltip-style`,theme:`light`,disableDefaultStyle:!1,sanitize:GBe,maxDepth:2,formatTooltip:HBe,baseURL:``,anchor:`cursor`,position:[`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]},nVe=class{call;options;el;constructor(e){this.options={...tVe,...e};let t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){let e=document.createElement(`style`);e.setAttribute(`id`,this.options.styleId),e.innerHTML=KBe(t);let n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement(`div`),this.el.setAttribute(`id`,this.options.id),this.el.classList.add(`vg-tooltip`),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===``){this.el.classList.remove(`visible`,`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add(`visible`,`${this.options.theme}-theme`);let{x:i,y:a}=this.options.anchor===`mark`?JBe(e,t,n,this.el.getBoundingClientRect(),this.options):qBe(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${a}px`,this.el.style.left=`${i}px`}},$Be.version}));function F5(e,t){return VVe.call(e,t)}function I5(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function z5(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function iVe(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function B5(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!R5(f))throw new t7(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else R5(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new t7(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=UVe[t.op].call(t,c,f,e);if(o.test===!1)throw new t7(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=n7[t.op].call(t,c,f,e);if(o.test===!1)throw new t7(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new t7('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new t7("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new t7("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&B5(e.value))throw new t7("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new t7("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new t7(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=sVe([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new t7(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function sVe(e,t,n){try{if(!Array.isArray(e))throw new t7(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)U5(L5(t),L5(e),n||!0);else{n||=W5;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function q5(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=I5(t),o=I5(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(F5(t,l)&&!(t[l]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?q5(u,d,n,r+`/`+z5(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+z5(l),value:L5(u)}),n.push({op:`replace`,path:r+`/`+z5(l),value:L5(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+z5(l),value:L5(u)}),n.push({op:`remove`,path:r+`/`+z5(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(!(!s&&a.length==o.length))for(var c=0;c=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}return i7=e,i7}function J5(){if(JVe)return a7;JVe=1;let e=Object.freeze({loose:!0}),t=Object.freeze({});return a7=n=>n?typeof n==`object`?n:e:t,a7}function Y5(){return YVe?s7:(YVe=1,s7={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},s7)}function X5(){return XVe?c7:(XVe=1,c7=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{},c7)}function Z5(){return ZVe?o7.exports:(ZVe=1,(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Y5(),a=X5();t=e.exports={};let o=t.re=[],s=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})(o7,o7.exports),o7.exports)}function gVe(){if(QVe)return l7;QVe=1;let e=/^[0-9]+$/,t=(t,n)=>{let r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:tt(n,e)},l7}function Q5(){if($Ve)return u7;$Ve=1;let e=X5(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=Y5(),{safeRe:r,t:i}=Z5(),a=J5(),{compareIdentifiers:o}=gVe();class s{constructor(o,c){if(c=a(c),o instanceof s){if(o.loose===!!c.loose&&o.includePrerelease===!!c.includePrerelease)return o;o=o.version}else if(typeof o!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>t)throw TypeError(`version is longer than ${t} characters`);e(`SemVer`,o,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=o.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>n||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>n||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),o(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}return u7=s,u7}function $5(){if(eHe)return d7;eHe=1;let e=Q5();return d7=(t,n,r)=>new e(t,r).compare(new e(n,r)),d7}function _Ve(){if(tHe)return f7;tHe=1;let e=$5();return f7=(t,n,r)=>e(t,n,r)===0,f7}function vVe(){if(nHe)return p7;nHe=1;let e=$5();return p7=(t,n,r)=>e(t,n,r)!==0,p7}function yVe(){if(rHe)return m7;rHe=1;let e=$5();return m7=(t,n,r)=>e(t,n,r)>0,m7}function bVe(){if(iHe)return h7;iHe=1;let e=$5();return h7=(t,n,r)=>e(t,n,r)>=0,h7}function xVe(){if(aHe)return g7;aHe=1;let e=$5();return g7=(t,n,r)=>e(t,n,r)<0,g7}function SVe(){if(oHe)return _7;oHe=1;let e=$5();return _7=(t,n,r)=>e(t,n,r)<=0,_7}function CVe(){if(sHe)return v7;sHe=1;let e=_Ve(),t=vVe(),n=yVe(),r=bVe(),i=xVe(),a=SVe();return v7=(o,s,c,l)=>{switch(s){case`===`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o===c;case`!==`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o!==c;case``:case`=`:case`==`:return e(o,c,l);case`!=`:return t(o,c,l);case`>`:return n(o,c,l);case`>=`:return r(o,c,l);case`<`:return i(o,c,l);case`<=`:return a(o,c,l);default:throw TypeError(`Invalid operator: ${s}`)}},v7}function wVe(){if(cHe)return y7;cHe=1;let e=Symbol(`SemVer ANY`);class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(` `),o(`comparator`,r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value=``:this.value=this.operator+this.semver.version,o(`comp`,this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],a=t.match(n);if(!a)throw TypeError(`Invalid comparator: ${t}`);this.operator=a[1]===void 0?``:a[1],this.operator===`=`&&(this.operator=``),a[2]?this.semver=new s(a[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o(`Comparator.test`,t,this.options.loose),this.semver===e||t===e)return!0;if(typeof t==`string`)try{t=new s(t,this.options)}catch{return!1}return a(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``||new c(e.value,r).test(this.value):e.operator===``?e.value===``||new c(this.value,r).test(e.semver):(r=n(r),r.includePrerelease&&(this.value===`<0.0.0-0`||e.value===`<0.0.0-0`)||!r.includePrerelease&&(this.value.startsWith(`<0.0.0`)||e.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&e.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&e.operator.startsWith(`<`)||this.semver.version===e.semver.version&&this.operator.includes(`=`)&&e.operator.includes(`=`)||a(this.semver,`<`,e.semver,r)&&this.operator.startsWith(`>`)&&e.operator.startsWith(`<`)||a(this.semver,`>`,e.semver,r)&&this.operator.startsWith(`<`)&&e.operator.startsWith(`>`)))}}y7=t;let n=J5(),{safeRe:r,t:i}=Z5(),a=CVe(),o=X5(),s=Q5(),c=TVe();return y7}function TVe(){if(lHe)return b7;lHe=1;let e=/\s+/g;class t{constructor(n,a){if(a=r(a),n instanceof t)return n.loose===!!a.loose&&n.includePrerelease===!!a.includePrerelease?n:new t(n.raw,a);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=n.trim().replace(e,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!m(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&h(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&f)|(this.options.loose&&p))+`:`+e,r=n.get(t);if(r)return r;let o=this.options.loose,h=o?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(h,D(this.options.includePrerelease)),a(`hyphen replace`,e),e=e.replace(s[c.COMPARATORTRIM],l),a(`comparator trim`,e),e=e.replace(s[c.TILDETRIM],u),a(`tilde trim`,e),e=e.replace(s[c.CARETTRIM],d),a(`caret trim`,e);let g=e.split(` `).map(e=>_(e,this.options)).join(` `).split(/\s+/).map(e=>E(e,this.options));o&&(g=g.filter(e=>(a(`loose invalid filter`,e,this.options),!!e.match(s[c.COMPARATORLOOSE])))),a(`range list`,g);let v=new Map,y=g.map(e=>new i(e,this.options));for(let e of y){if(m(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let b=[...v.values()];return n.set(t,b),b}intersects(e,n){if(!(e instanceof t))throw TypeError(`a Range is required`);return this.set.some(t=>g(t,n)&&e.set.some(e=>g(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new o(e,this.options)}catch{return!1}for(let t=0;te.value===`<0.0.0-0`,h=e=>e.value===``,g=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},_=(e,t)=>(a(`comp`,e,t),e=x(e,t),a(`caret`,e),e=y(e,t),a(`tildes`,e),e=C(e,t),a(`xrange`,e),e=T(e,t),a(`stars`,e),e),v=e=>!e||e.toLowerCase()===`x`||e===`*`,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{let n=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(n,(t,n,r,i,o)=>{a(`tilde`,e,t,n,r,i,o);let s;return v(n)?s=``:v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a(`replaceTilde pr`,o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a(`tilde return`,s),s})},x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(e,t)=>{a(`caret`,e,t);let n=t.loose?s[c.CARETLOOSE]:s[c.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,o,s)=>{a(`caret`,e,t,n,i,o,s);let c;return v(n)?c=``:v(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(o)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a(`caret return`,c),c})},C=(e,t)=>(a(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>w(e,t)).join(` `)),w=(e,t)=>{e=e.trim();let n=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(n,(n,r,i,o,s,c)=>{a(`xRange`,e,n,r,i,o,s,c);let l=v(i),u=l||v(o),d=u||v(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(o=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:o=+o+1),r===`<`&&(c=`-0`),n=`${r+i}.${o}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a(`xRange return`,n),n})},T=(e,t)=>(a(`replaceStars`,e,t),e.trim().replace(s[c.STAR],``)),E=(e,t)=>(a(`replaceGTE0`,e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],``)),D=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=v(r)?``:v(i)?`>=${r}.0.0${e?`-0`:``}`:v(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=v(l)?``:v(u)?`<${+l+1}.0.0-0`:v(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),O=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return b7}function EVe(){if(uHe)return x7;uHe=1;let e=TVe();return x7=(t,n,r)=>{try{n=new e(n,r)}catch{return!1}return n.test(t)},x7}function DVe(e,t,n){let r=e.open(t),{origin:i}=new URL(t),a=40;function o(t){t.source===r&&(a=0,e.removeEventListener(`message`,o,!1))}e.addEventListener(`message`,o,!1);function s(){a<=0||(r.postMessage(n,i),setTimeout(s,250),--a)}setTimeout(s,250)}function OVe(e,...t){for(let n of t)kVe(e,n);return e}function kVe(e,t){for(let n of Object.keys(t))qm(e,n,t[n],!0)}function AVe(e){return typeof e==`function`}function jVe(e,t,n,r){let i=`${t}
`,a=`
${n}`,o=window.open(``);o.document.write(i+e+a),o.document.title=`${E7[r]} JSON Source`}function MVe(e,t,n){if(e.$schema){let r=nBe(e.$schema);n&&n!==r.library&&t.warn(`The given visualization spec is written in ${E7[r.library]}, but mode argument sets ${E7[n]??n}.`);let i=r.library;return S7(D7[i],`^${r.version.slice(1)}`)||t.warn(`The input spec uses ${E7[i]} ${r.version}, but the current version of ${E7[i]} is v${D7[i]}.`),i}return`mark`in e||`encoding`in e||`layer`in e||`hconcat`in e||`vconcat`in e||`facet`in e||`repeat`in e?`vega-lite`:`marks`in e||`signals`in e||`scales`in e||`axes`in e?`vega`:n??`vega`}function NVe(e){return!!(e&&`load`in e)}function PVe(e){return NVe(e)?e:C7.loader(e)}function FVe(e){let t=e.usermeta?.embedOptions??{};return Yh(t.defaultStyle)&&(t.defaultStyle=!1),t}async function IVe(e,t,n={}){let r,i;Yh(t)?(i=PVe(n.loader),r=JSON.parse(await i.load(t))):r=t;let a=FVe(r),o=a.loader;(!i||o)&&(i=PVe(n.loader??o));let s=await LVe(a,i),c=await LVe(n,i),l={...OVe(c,s),config:Km(c.config??{},s.config??{})};return await zVe(e,r,l,i)}async function LVe(e,t){let n=Yh(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=Yh(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function RVe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function zVe(e,t,n={},r){let i=n.theme?Km(iBe[n.theme],n.config??{}):n.config,a=Hh(n.actions)?n.actions:OVe({},fHe,n.actions??{}),o={...pHe,...n.i18n},s=n.renderer??`svg`,c=n.logger??Hm(C7.Warn);n.logLevel!==void 0&&c.level(n.logLevel);let l=n.downloadFileName??`visualization`,u=typeof e==`string`?document.querySelector(e):e;if(!u)throw Error(`${e} does not exist`);if(n.defaultStyle!==!1){let e=`vega-embed-style`,{root:t,rootContainer:r}=RVe(u);if(!t.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?dHe.toString():n.defaultStyle,r.appendChild(t)}}let d=MVe(t,c,n.mode),f=mHe[d](t,c,i);if(d===`vega-lite`&&f.$schema){let e=nBe(f.$schema);S7(D7.vega,`^${e.version.slice(1)}`)||c.warn(`The compiled spec uses Vega ${e.version}, but current version is v${D7.vega}.`)}u.classList.add(`vega-embed`),a&&u.classList.add(`has-actions`),u.innerHTML=``;let p=u;if(a){let e=document.createElement(`div`);e.classList.add(gHe),u.appendChild(e),p=e}let m=n.patch;if(m&&(f=m instanceof Function?m(f):U5(f,m,!0,!1).newDocument),n.formatLocale&&C7.formatLocale(n.formatLocale),n.timeFormatLocale&&C7.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let e in n.expressionFunctions){let t=n.expressionFunctions[e];`fn`in t?C7.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&C7.expressionFunction(e,t)}let{ast:h}=n,g=C7.parse(f,d===`vega-lite`?{}:i,{ast:h}),_=new(n.viewClass||C7.View)(g,{loader:r,logger:c,renderer:s,...h?{expr:C7.expressionInterpreter??n.expr??vX}:{}});if(_.addSignalListener(`autosize`,(e,t)=>{let{type:n}=t;n==`fit-x`?(p.classList.add(`fit-x`),p.classList.remove(`fit-y`)):n==`fit-y`?(p.classList.remove(`fit-x`),p.classList.add(`fit-y`)):n==`fit`?p.classList.add(`fit-x`,`fit-y`):p.classList.remove(`fit-x`,`fit-y`)}),n.tooltip!==!1){let{loader:e,tooltip:t}=n,r=e&&!NVe(e)?e?.baseURL:void 0,i=AVe(t)?t:new nVe({baseURL:r,...t===!0?{}:t}).call;_.tooltip(i)}let{hover:v}=n;if(v===void 0&&(v=d===`vega`),v){let{hoverSet:e,updateSet:t}=typeof v==`boolean`?{}:v;_.hover(e,t)}n&&(n.width!=null&&_.width(n.width),n.height!=null&&_.height(n.height),n.padding!=null&&_.padding(n.padding)),await _.initialize(p,n.bind).runAsync();let y;if(a!==!1){let e=u;if(n.defaultStyle!==!1||n.forceActionsMenu){let t=document.createElement(`details`);t.title=o.CLICK_TO_VIEW_ACTIONS,u.append(t),e=t;let n=document.createElement(`summary`);n.innerHTML=hHe,t.append(n),y=e=>{t.contains(e.target)||t.removeAttribute(`open`)},document.addEventListener(`click`,y)}let r=document.createElement(`div`);if(e.append(r),r.classList.add(`vega-actions`),a===!0||a.export!==!1){for(let e of[`svg`,`png`])if(a===!0||a.export===!0||a.export[e]){let t=o[`${e.toUpperCase()}_ACTION`],i=document.createElement(`a`),a=Wm(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;i.text=t,i.href=`#`,i.target=`_blank`,i.download=`${l}.${e}`,i.addEventListener(`mousedown`,async function(t){t.preventDefault();let n=await _.toImageURL(e,a);this.href=n}),r.append(i)}}if(a===!0||a.source!==!1){let e=document.createElement(`a`);e.text=o.SOURCE_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){jVe(bm(t),n.sourceHeader??``,n.sourceFooter??``,d),e.preventDefault()}),r.append(e)}if(d===`vega-lite`&&(a===!0||a.compiled!==!1)){let e=document.createElement(`a`);e.text=o.COMPILED_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){jVe(bm(f),n.sourceHeader??``,n.sourceFooter??``,`vega`),e.preventDefault()}),r.append(e)}if(a===!0||a.editor!==!1){let e=n.editorUrl??`https://vega.github.io/editor/`,a=document.createElement(`a`);a.text=o.EDITOR_ACTION,a.href=`#`,a.addEventListener(`click`,function(n){DVe(window,e,{config:i,mode:m?`vega`:d,renderer:s,spec:bm(m?f:t)}),n.preventDefault()}),r.append(a)}}function b(){y&&document.removeEventListener(`click`,y),_.finalize()}return{view:_,spec:t,vgSpec:f,finalize:b,embedOptions:n}}var BVe,VVe,e7,t7,HVe,n7,UVe,WVe,r7,GVe,KVe,i7,qVe,a7,JVe,o7,s7,YVe,c7,XVe,ZVe,l7,QVe,u7,$Ve,d7,eHe,f7,tHe,p7,nHe,m7,rHe,h7,iHe,g7,aHe,_7,oHe,v7,sHe,y7,cHe,b7,lHe,x7,uHe,S7,dHe,C7,w7,T7,fHe,pHe,E7,D7,mHe,hHe,gHe,_He=o((()=>{Pie(),oX(),DDe(),tBe(),rBe(),VBe(),rVe(),BVe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),VVe=Object.prototype.hasOwnProperty,e7=function(e){BVe(t,e);function t(t,n,r,i,a){var o=this.constructor,s=e.call(this,aVe(t,{name:n,index:r,operation:i,tree:a}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=aVe(t,{name:n,index:r,operation:i,tree:a}),s}return t}(Error),t7=e7,HVe=L5,n7={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=V5(n,this.path);r&&=L5(r);var i=H5(n,{op:`remove`,path:this.from}).removed;return H5(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=V5(n,this.from);return H5(n,{op:`add`,path:this.path,value:L5(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:G5(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},UVe={add:function(e,t,n){return R5(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:n7.move,copy:n7.copy,test:n7.test,_get:n7._get},WVe=Object.freeze({__proto__:null,JsonPatchError:t7,_areEquals:G5,applyOperation:H5,applyPatch:U5,applyReducer:oVe,deepClone:HVe,getValueByPointer:V5,validate:sVe,validator:W5}),r7=new WeakMap,GVe=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),KVe=function(){function e(e,t){this.callback=e,this.observer=t}return e}(),Object.assign({},WVe,Object.freeze({__proto__:null,compare:pVe,generate:K5,observe:fVe,unobserve:dVe}),{JsonPatchError:e7,deepClone:L5,escapePathComponent:z5,unescapePathComponent:iVe}),o7={exports:{}},S7=mVe(EVe()),dHe=`.vega-embed { +`,E5=`vg-tooltip-element`,EVe={offsetX:10,offsetY:10,id:E5,styleId:`vega-tooltip-style`,theme:`light`,disableDefaultStyle:!1,sanitize:gVe,maxDepth:2,formatTooltip:pVe,baseURL:``,anchor:`cursor`,position:[`top`,`bottom`,`left`,`right`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]},DVe=class{call;options;el;constructor(e){this.options={...EVe,...e};let t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){let e=document.createElement(`style`);e.setAttribute(`id`,this.options.styleId),e.innerHTML=_Ve(t);let n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement(`div`),this.el.setAttribute(`id`,this.options.id),this.el.classList.add(`vg-tooltip`),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===``){this.el.classList.remove(`visible`,`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add(`visible`,`${this.options.theme}-theme`);let{x:i,y:a}=this.options.anchor===`mark`?yVe(e,t,n,this.el.getBoundingClientRect(),this.options):vVe(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${a}px`,this.el.style.left=`${i}px`}},wVe.version}));function D5(e,t){return fHe.call(e,t)}function O5(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n=48&&r<=57){t++;continue}return!1}return!0}function j5(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function kVe(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function M5(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&s[l-1]==`constructor`))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(c[f]===void 0?d=s.slice(0,l).join(`/`):l==u-1&&(d=t.path),d!==void 0&&p(t,0,e,d)),l++,Array.isArray(c)){if(f===`-`)f=c.length;else if(n&&!A5(f))throw new q5(`Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index`,`OPERATION_PATH_ILLEGAL_ARRAY_INDEX`,a,t,e);else A5(f)&&(f=~~f);if(l>=u){if(n&&t.op===`add`&&f>c.length)throw new q5(`The specified index MUST NOT be greater than the number of elements in the array`,`OPERATION_VALUE_OUT_OF_BOUNDS`,a,t,e);var o=mHe[t.op].call(t,c,f,e);if(o.test===!1)throw new q5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}}else if(l>=u){var o=J5[t.op].call(t,c,f,e);if(o.test===!1)throw new q5(`Test operation failed`,`TEST_OPERATION_FAILED`,a,t,e);return o}if(c=c[f],n&&l0)throw new q5('Operation `path` property must start with "/"',`OPERATION_PATH_INVALID`,t,e,n);if((e.op===`move`||e.op===`copy`)&&typeof e.from!=`string`)throw new q5("Operation `from` property is not present (applicable in `move` and `copy` operations)",`OPERATION_FROM_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&e.value===void 0)throw new q5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_REQUIRED`,t,e,n);if((e.op===`add`||e.op===`replace`||e.op===`test`)&&M5(e.value))throw new q5("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)",`OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED`,t,e,n);if(n){if(e.op==`add`){var i=e.path.split(`/`).length,a=r.split(`/`).length;if(i!==a+1&&i!==a)throw new q5("Cannot perform an `add` operation at the desired path",`OPERATION_PATH_CANNOT_ADD`,t,e,n)}else if(e.op===`replace`||e.op===`remove`||e.op===`_get`){if(e.path!==r)throw new q5(`Cannot perform the operation at a path that does not exist`,`OPERATION_PATH_UNRESOLVABLE`,t,e,n)}else if(e.op===`move`||e.op===`copy`){var o=MVe([{op:`_get`,path:e.from,value:void 0}],n);if(o&&o.name===`OPERATION_PATH_UNRESOLVABLE`)throw new q5(`Cannot perform the operation from a path that does not exist`,`OPERATION_FROM_UNRESOLVABLE`,t,e,n)}}}function MVe(e,t,n){try{if(!Array.isArray(e))throw new q5(`Patch sequence must be an array`,`SEQUENCE_NOT_AN_ARRAY`);if(t)F5(k5(t),k5(e),n||!0);else{n||=I5;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function z5(e,t,n,r,i){if(t!==e){typeof t.toJSON==`function`&&(t=t.toJSON());for(var a=O5(t),o=O5(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(D5(t,l)&&!(t[l]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var d=t[l];typeof u==`object`&&u&&typeof d==`object`&&d&&Array.isArray(u)===Array.isArray(d)?z5(u,d,n,r+`/`+j5(l),i):u!==d&&(i&&n.push({op:`test`,path:r+`/`+j5(l),value:k5(u)}),n.push({op:`replace`,path:r+`/`+j5(l),value:k5(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:`test`,path:r+`/`+j5(l),value:k5(u)}),n.push({op:`remove`,path:r+`/`+j5(l)}),s=!0):(i&&n.push({op:`test`,path:r,value:e}),n.push({op:`replace`,path:r,value:t}))}if(!(!s&&a.length==o.length))for(var c=0;c=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}return X5=e,X5}function B5(){if(yHe)return Z5;yHe=1;let e=Object.freeze({loose:!0}),t=Object.freeze({});return Z5=n=>n?typeof n==`object`?n:e:t,Z5}function V5(){return bHe?$5:(bHe=1,$5={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$5)}function H5(){return xHe?e7:(xHe=1,e7=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{},e7)}function U5(){return SHe?Q5.exports:(SHe=1,(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=V5(),a=H5();t=e.exports={};let o=t.re=[],s=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})(Q5,Q5.exports),Q5.exports)}function VVe(){if(CHe)return t7;CHe=1;let e=/^[0-9]+$/,t=(t,n)=>{let r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:tt(n,e)},t7}function W5(){if(wHe)return n7;wHe=1;let e=H5(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=V5(),{safeRe:r,t:i}=U5(),a=B5(),{compareIdentifiers:o}=VVe();class s{constructor(o,c){if(c=a(c),o instanceof s){if(o.loose===!!c.loose&&o.includePrerelease===!!c.includePrerelease)return o;o=o.version}else if(typeof o!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof o}".`);if(o.length>t)throw TypeError(`version is longer than ${t} characters`);e(`SemVer`,o,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=o.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw TypeError(`Invalid Version: ${o}`);if(this.raw=o,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>n||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>n||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),o(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}return n7=s,n7}function G5(){if(THe)return r7;THe=1;let e=W5();return r7=(t,n,r)=>new e(t,r).compare(new e(n,r)),r7}function HVe(){if(EHe)return i7;EHe=1;let e=G5();return i7=(t,n,r)=>e(t,n,r)===0,i7}function UVe(){if(DHe)return a7;DHe=1;let e=G5();return a7=(t,n,r)=>e(t,n,r)!==0,a7}function WVe(){if(OHe)return o7;OHe=1;let e=G5();return o7=(t,n,r)=>e(t,n,r)>0,o7}function GVe(){if(kHe)return s7;kHe=1;let e=G5();return s7=(t,n,r)=>e(t,n,r)>=0,s7}function KVe(){if(AHe)return c7;AHe=1;let e=G5();return c7=(t,n,r)=>e(t,n,r)<0,c7}function qVe(){if(jHe)return l7;jHe=1;let e=G5();return l7=(t,n,r)=>e(t,n,r)<=0,l7}function JVe(){if(MHe)return u7;MHe=1;let e=HVe(),t=UVe(),n=WVe(),r=GVe(),i=KVe(),a=qVe();return u7=(o,s,c,l)=>{switch(s){case`===`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o===c;case`!==`:return typeof o==`object`&&(o=o.version),typeof c==`object`&&(c=c.version),o!==c;case``:case`=`:case`==`:return e(o,c,l);case`!=`:return t(o,c,l);case`>`:return n(o,c,l);case`>=`:return r(o,c,l);case`<`:return i(o,c,l);case`<=`:return a(o,c,l);default:throw TypeError(`Invalid operator: ${s}`)}},u7}function YVe(){if(NHe)return d7;NHe=1;let e=Symbol(`SemVer ANY`);class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(` `),o(`comparator`,r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value=``:this.value=this.operator+this.semver.version,o(`comp`,this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],a=t.match(n);if(!a)throw TypeError(`Invalid comparator: ${t}`);this.operator=a[1]===void 0?``:a[1],this.operator===`=`&&(this.operator=``),a[2]?this.semver=new s(a[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o(`Comparator.test`,t,this.options.loose),this.semver===e||t===e)return!0;if(typeof t==`string`)try{t=new s(t,this.options)}catch{return!1}return a(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``||new c(e.value,r).test(this.value):e.operator===``?e.value===``||new c(this.value,r).test(e.semver):(r=n(r),r.includePrerelease&&(this.value===`<0.0.0-0`||e.value===`<0.0.0-0`)||!r.includePrerelease&&(this.value.startsWith(`<0.0.0`)||e.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&e.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&e.operator.startsWith(`<`)||this.semver.version===e.semver.version&&this.operator.includes(`=`)&&e.operator.includes(`=`)||a(this.semver,`<`,e.semver,r)&&this.operator.startsWith(`>`)&&e.operator.startsWith(`<`)||a(this.semver,`>`,e.semver,r)&&this.operator.startsWith(`<`)&&e.operator.startsWith(`>`)))}}d7=t;let n=B5(),{safeRe:r,t:i}=U5(),a=JVe(),o=H5(),s=W5(),c=XVe();return d7}function XVe(){if(PHe)return f7;PHe=1;let e=/\s+/g;class t{constructor(n,a){if(a=r(a),n instanceof t)return n.loose===!!a.loose&&n.includePrerelease===!!a.includePrerelease?n:new t(n.raw,a);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=n.trim().replace(e,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!m(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&h(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&f)|(this.options.loose&&p))+`:`+e,r=n.get(t);if(r)return r;let o=this.options.loose,h=o?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(h,D(this.options.includePrerelease)),a(`hyphen replace`,e),e=e.replace(s[c.COMPARATORTRIM],l),a(`comparator trim`,e),e=e.replace(s[c.TILDETRIM],u),a(`tilde trim`,e),e=e.replace(s[c.CARETTRIM],d),a(`caret trim`,e);let g=e.split(` `).map(e=>_(e,this.options)).join(` `).split(/\s+/).map(e=>E(e,this.options));o&&(g=g.filter(e=>(a(`loose invalid filter`,e,this.options),!!e.match(s[c.COMPARATORLOOSE])))),a(`range list`,g);let v=new Map,y=g.map(e=>new i(e,this.options));for(let e of y){if(m(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let b=[...v.values()];return n.set(t,b),b}intersects(e,n){if(!(e instanceof t))throw TypeError(`a Range is required`);return this.set.some(t=>g(t,n)&&e.set.some(e=>g(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new o(e,this.options)}catch{return!1}for(let t=0;te.value===`<0.0.0-0`,h=e=>e.value===``,g=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},_=(e,t)=>(a(`comp`,e,t),e=x(e,t),a(`caret`,e),e=y(e,t),a(`tildes`,e),e=C(e,t),a(`xrange`,e),e=T(e,t),a(`stars`,e),e),v=e=>!e||e.toLowerCase()===`x`||e===`*`,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(` `),b=(e,t)=>{let n=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(n,(t,n,r,i,o)=>{a(`tilde`,e,t,n,r,i,o);let s;return v(n)?s=``:v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:o?(a(`replaceTilde pr`,o),s=`>=${n}.${r}.${i}-${o} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,a(`tilde return`,s),s})},x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(e,t)=>{a(`caret`,e,t);let n=t.loose?s[c.CARETLOOSE]:s[c.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,o,s)=>{a(`caret`,e,t,n,i,o,s);let c;return v(n)?c=``:v(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(o)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(a(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${o}-${s} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o}-${s} <${+n+1}.0.0-0`):(a(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${o}${r} <${n}.${i}.${+o+1}-0`:`>=${n}.${i}.${o}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${o} <${+n+1}.0.0-0`),a(`caret return`,c),c})},C=(e,t)=>(a(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>w(e,t)).join(` `)),w=(e,t)=>{e=e.trim();let n=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(n,(n,r,i,o,s,c)=>{a(`xRange`,e,n,r,i,o,s,c);let l=v(i),u=l||v(o),d=u||v(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(o=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:o=+o+1),r===`<`&&(c=`-0`),n=`${r+i}.${o}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),a(`xRange return`,n),n})},T=(e,t)=>(a(`replaceStars`,e,t),e.trim().replace(s[c.STAR],``)),E=(e,t)=>(a(`replaceGTE0`,e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],``)),D=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=v(r)?``:v(i)?`>=${r}.0.0${e?`-0`:``}`:v(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=v(l)?``:v(u)?`<${+l+1}.0.0-0`:v(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),O=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return f7}function ZVe(){if(FHe)return p7;FHe=1;let e=XVe();return p7=(t,n,r)=>{try{n=new e(n,r)}catch{return!1}return n.test(t)},p7}function QVe(e,t,n){let r=e.open(t),{origin:i}=new URL(t),a=40;function o(t){t.source===r&&(a=0,e.removeEventListener(`message`,o,!1))}e.addEventListener(`message`,o,!1);function s(){a<=0||(r.postMessage(n,i),setTimeout(s,250),--a)}setTimeout(s,250)}function $Ve(e,...t){for(let n of t)eHe(e,n);return e}function eHe(e,t){for(let n of Object.keys(t))Ah(e,n,t[n],!0)}function tHe(e){return typeof e==`function`}function nHe(e,t,n,r){let i=`${t}
`,a=`
${n}`,o=window.open(``);o.document.write(i+e+a),o.document.title=`${v7[r]} JSON Source`}function rHe(e,t,n){if(e.$schema){let r=DBe(e.$schema);n&&n!==r.library&&t.warn(`The given visualization spec is written in ${v7[r.library]}, but mode argument sets ${v7[n]??n}.`);let i=r.library;return m7(y7[i],`^${r.version.slice(1)}`)||t.warn(`The input spec uses ${v7[i]} ${r.version}, but the current version of ${v7[i]} is v${y7[i]}.`),i}return`mark`in e||`encoding`in e||`layer`in e||`hconcat`in e||`vconcat`in e||`facet`in e||`repeat`in e?`vega-lite`:`marks`in e||`signals`in e||`scales`in e||`axes`in e?`vega`:n??`vega`}function iHe(e){return!!(e&&`load`in e)}function aHe(e){return iHe(e)?e:h7.loader(e)}function oHe(e){let t=e.usermeta?.embedOptions??{};return Eg(t.defaultStyle)&&(t.defaultStyle=!1),t}async function sHe(e,t,n={}){let r,i;Eg(t)?(i=aHe(n.loader),r=JSON.parse(await i.load(t))):r=t;let a=oHe(r),o=a.loader;(!i||o)&&(i=aHe(n.loader??o));let s=await cHe(a,i),c=await cHe(n,i),l={...$Ve(c,s),config:kh(c.config??{},s.config??{})};return await uHe(e,r,l,i)}async function cHe(e,t){let n=Eg(e.config)?JSON.parse(await t.load(e.config)):e.config??{},r=Eg(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...r?{patch:r}:{},...n?{config:n}:{}}}function lHe(e){let t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function uHe(e,t,n={},r){let i=n.theme?kh(kBe[n.theme],n.config??{}):n.config,a=Sg(n.actions)?n.actions:$Ve({},LHe,n.actions??{}),o={...RHe,...n.i18n},s=n.renderer??`svg`,c=n.logger??Th(h7.Warn);n.logLevel!==void 0&&c.level(n.logLevel);let l=n.downloadFileName??`visualization`,u=typeof e==`string`?document.querySelector(e):e;if(!u)throw Error(`${e} does not exist`);if(n.defaultStyle!==!1){let e=`vega-embed-style`,{root:t,rootContainer:r}=lHe(u);if(!t.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?IHe.toString():n.defaultStyle,r.appendChild(t)}}let d=rHe(t,c,n.mode),f=zHe[d](t,c,i);if(d===`vega-lite`&&f.$schema){let e=DBe(f.$schema);m7(y7.vega,`^${e.version.slice(1)}`)||c.warn(`The compiled spec uses Vega ${e.version}, but current version is v${y7.vega}.`)}u.classList.add(`vega-embed`),a&&u.classList.add(`has-actions`),u.innerHTML=``;let p=u;if(a){let e=document.createElement(`div`);e.classList.add(VHe),u.appendChild(e),p=e}let m=n.patch;if(m&&(f=m instanceof Function?m(f):F5(f,m,!0,!1).newDocument),n.formatLocale&&h7.formatLocale(n.formatLocale),n.timeFormatLocale&&h7.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(let e in n.expressionFunctions){let t=n.expressionFunctions[e];`fn`in t?h7.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&h7.expressionFunction(e,t)}let{ast:h}=n,g=h7.parse(f,d===`vega-lite`?{}:i,{ast:h}),_=new(n.viewClass||h7.View)(g,{loader:r,logger:c,renderer:s,...h?{expr:h7.expressionInterpreter??n.expr??pX}:{}});if(_.addSignalListener(`autosize`,(e,t)=>{let{type:n}=t;n==`fit-x`?(p.classList.add(`fit-x`),p.classList.remove(`fit-y`)):n==`fit-y`?(p.classList.remove(`fit-x`),p.classList.add(`fit-y`)):n==`fit`?p.classList.add(`fit-x`,`fit-y`):p.classList.remove(`fit-x`,`fit-y`)}),n.tooltip!==!1){let{loader:e,tooltip:t}=n,r=e&&!iHe(e)?e?.baseURL:void 0,i=tHe(t)?t:new DVe({baseURL:r,...t===!0?{}:t}).call;_.tooltip(i)}let{hover:v}=n;if(v===void 0&&(v=d===`vega`),v){let{hoverSet:e,updateSet:t}=typeof v==`boolean`?{}:v;_.hover(e,t)}n&&(n.width!=null&&_.width(n.width),n.height!=null&&_.height(n.height),n.padding!=null&&_.padding(n.padding)),await _.initialize(p,n.bind).runAsync();let y;if(a!==!1){let e=u;if(n.defaultStyle!==!1||n.forceActionsMenu){let t=document.createElement(`details`);t.title=o.CLICK_TO_VIEW_ACTIONS,u.append(t),e=t;let n=document.createElement(`summary`);n.innerHTML=BHe,t.append(n),y=e=>{t.contains(e.target)||t.removeAttribute(`open`)},document.addEventListener(`click`,y)}let r=document.createElement(`div`);if(e.append(r),r.classList.add(`vega-actions`),a===!0||a.export!==!1){for(let e of[`svg`,`png`])if(a===!0||a.export===!0||a.export[e]){let t=o[`${e.toUpperCase()}_ACTION`],i=document.createElement(`a`),a=Dh(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;i.text=t,i.href=`#`,i.target=`_blank`,i.download=`${l}.${e}`,i.addEventListener(`mousedown`,async function(t){t.preventDefault();let n=await _.toImageURL(e,a);this.href=n}),r.append(i)}}if(a===!0||a.source!==!1){let e=document.createElement(`a`);e.text=o.SOURCE_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){nHe(rh(t),n.sourceHeader??``,n.sourceFooter??``,d),e.preventDefault()}),r.append(e)}if(d===`vega-lite`&&(a===!0||a.compiled!==!1)){let e=document.createElement(`a`);e.text=o.COMPILED_ACTION,e.href=`#`,e.addEventListener(`click`,function(e){nHe(rh(f),n.sourceHeader??``,n.sourceFooter??``,`vega`),e.preventDefault()}),r.append(e)}if(a===!0||a.editor!==!1){let e=n.editorUrl??`https://vega.github.io/editor/`,a=document.createElement(`a`);a.text=o.EDITOR_ACTION,a.href=`#`,a.addEventListener(`click`,function(n){QVe(window,e,{config:i,mode:m?`vega`:d,renderer:s,spec:rh(m?f:t)}),n.preventDefault()}),r.append(a)}}function b(){y&&document.removeEventListener(`click`,y),_.finalize()}return{view:_,spec:t,vgSpec:f,finalize:b,embedOptions:n}}var dHe,fHe,K5,q5,pHe,J5,mHe,hHe,Y5,gHe,_He,X5,vHe,Z5,yHe,Q5,$5,bHe,e7,xHe,SHe,t7,CHe,n7,wHe,r7,THe,i7,EHe,a7,DHe,o7,OHe,s7,kHe,c7,AHe,l7,jHe,u7,MHe,d7,NHe,f7,PHe,p7,FHe,m7,IHe,h7,g7,_7,LHe,RHe,v7,y7,zHe,BHe,VHe,HHe=o((()=>{mie(),tX(),YDe(),EBe(),OBe(),fVe(),OVe(),dHe=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fHe=Object.prototype.hasOwnProperty,K5=function(e){dHe(t,e);function t(t,n,r,i,a){var o=this.constructor,s=e.call(this,AVe(t,{name:n,index:r,operation:i,tree:a}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=a,Object.setPrototypeOf(s,o.prototype),s.message=AVe(t,{name:n,index:r,operation:i,tree:a}),s}return t}(Error),q5=K5,pHe=k5,J5={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=N5(n,this.path);r&&=k5(r);var i=P5(n,{op:`remove`,path:this.from}).removed;return P5(n,{op:`add`,path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=N5(n,this.from);return P5(n,{op:`add`,path:this.path,value:k5(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:L5(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},mHe={add:function(e,t,n){return A5(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:J5.move,copy:J5.copy,test:J5.test,_get:J5._get},hHe=Object.freeze({__proto__:null,JsonPatchError:q5,_areEquals:L5,applyOperation:P5,applyPatch:F5,applyReducer:jVe,deepClone:pHe,getValueByPointer:N5,validate:MVe,validator:I5}),Y5=new WeakMap,gHe=function(){function e(e){this.observers=new Map,this.obj=e}return e}(),_He=function(){function e(e,t){this.callback=e,this.observer=t}return e}(),Object.assign({},hHe,Object.freeze({__proto__:null,compare:RVe,generate:R5,observe:LVe,unobserve:IVe}),{JsonPatchError:K5,deepClone:k5,escapePathComponent:j5,unescapePathComponent:kVe}),Q5={exports:{}},m7=zVe(ZVe()),IHe=`.vega-embed { position: relative; display: inline-block; box-sizing: border-box; @@ -386,18 +386,18 @@ endobj transform: scale(1); } } -`,{version:`7.1.0`}.version,C7=TDe,w7=aOe,T7=typeof window<`u`?window:void 0,w7===void 0&&T7?.vl?.compile&&(w7=T7.vl),fHe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},pHe={CLICK_TO_VIEW_ACTIONS:`Click to view actions`,COMPILED_ACTION:`View Compiled Vega`,EDITOR_ACTION:`Open in Vega Editor`,PNG_ACTION:`Save as PNG`,SOURCE_ACTION:`View Source`,SVG_ACTION:`Save as SVG`},E7={vega:`Vega`,"vega-lite":`Vega-Lite`},D7={vega:C7.version,"vega-lite":w7?w7.version:`not available`},mHe={vega:e=>e,"vega-lite":(e,t,n)=>w7.compile(e,{config:n,logger:t}).spec},hHe=` +`,{version:`7.1.0`}.version,h7=qDe,g7=DOe,_7=typeof window<`u`?window:void 0,g7===void 0&&_7?.vl?.compile&&(g7=_7.vl),LHe={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},RHe={CLICK_TO_VIEW_ACTIONS:`Click to view actions`,COMPILED_ACTION:`View Compiled Vega`,EDITOR_ACTION:`Open in Vega Editor`,PNG_ACTION:`Save as PNG`,SOURCE_ACTION:`View Source`,SVG_ACTION:`Save as SVG`},v7={vega:`Vega`,"vega-lite":`Vega-Lite`},y7={vega:h7.version,"vega-lite":g7?g7.version:`not available`},zHe={vega:e=>e,"vega-lite":(e,t,n)=>g7.compile(e,{config:n,logger:t}).spec},BHe=` -`,gHe=`chart-wrapper`})),vHe=c({default:()=>yHe});function yHe({spec:e,label:t}){let n=(0,O7.useRef)(null),r=(0,O7.useRef)(null),[i,a]=(0,O7.useState)(``);return(0,O7.useEffect)(()=>{let t=!1;a(``),r.current?.finalize(),r.current=null;let i=n.current;if(i)return i.replaceChildren(),IVe(i,e,{mode:`vega-lite`,actions:!1,renderer:`svg`,tooltip:!0,hover:!0}).then(e=>{t?e.finalize():r.current=e}).catch(()=>{t||a(`This chart could not be rendered.`)}),()=>{t=!0,r.current?.finalize(),r.current=null,i.replaceChildren()}},[e]),(0,k7.jsxs)(`div`,{className:`cg-vega-frame`,role:`img`,"aria-label":t,children:[(0,k7.jsx)(`div`,{ref:n,className:`cg-vega-host`}),i&&(0,k7.jsx)(`div`,{className:`cg-ch-empty`,children:i})]})}var O7,k7,bHe=o((()=>{O7=u(f(),1),_He(),k7=xp()}));bHe();var xHe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},SHe=[6,12,24,36],A7=72,j7=18;function CHe(e){return e.filter(e=>e.key.startsWith(`measure_`))}function wHe(e){let t=e.length+1,n=new Set(e.map(e=>e.id));for(;n.has(`tsr_${t}`);)t+=1;return`tsr_${t}`}function THe({scope:e,pids:t,fields:n,display:r,onDisplay:i,locked:a}){let o=(0,L.useMemo)(()=>CHe(n),[n]),s=Od.includes(r?.tsBucket??``)?r.tsBucket:cm,c=typeof r?.tsSpan?.lastN==`number`?r.tsSpan.lastN:12,l=(0,L.useMemo)(()=>{let e=(r?.tsFields??[]).filter(e=>o.some(t=>t.key===e));return e.length?e:o.slice(0,1).map(e=>e.key)},[r?.tsFields,o]),u=(0,L.useMemo)(()=>r?.tsRows??[],[r?.tsRows]),d=(0,L.useMemo)(()=>r?.tsDeltas??[],[r?.tsDeltas]),f=r?.tsStyles,p=r?.tsGridlines!==!1,m=r?.tsSparkline===!0,[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(`idle`),[y,b]=(0,L.useState)(0),[x,S]=(0,L.useState)(new Set),C=(0,L.useRef)(0),w=Hu();(0,L.useEffect)(()=>{if(w)return;if(!l.length||!t.length){g(null),v(`idle`);return}let n=++C.current;v(`loading`),$u(lm({pids:t,bucket:s,span:{lastN:c},fields:l}),e).then(({payload:e,status:t})=>{if(n===C.current){if(!e){g(null),b(t),v(`error`);return}g(e),v(`idle`)}})},[w,e,t,s,c,l]);let T=(0,L.useMemo)(()=>dm(h),[h]),E=(0,L.useMemo)(()=>Die(T,{customRows:u,deltas:d,bucket:s}),[T,u,d,s]),D=(0,L.useCallback)(()=>{let e=Oie(E);sm(`Time series.csv`,new Blob([``+e],{type:`text/csv;charset=utf-8`}))},[E]),O=(0,L.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),k=e=>{e.length&&i?.({tsFields:e.slice(0,12)})},A=e=>i?.({tsRows:e.length?e.slice(0,12):void 0}),j=e=>{let t=d.includes(e)?d.filter(t=>t!==e):[...d,e];i?.({tsDeltas:t.length?t:void 0})},M=(e,t)=>{let n={...f??{}},r={...mm(f,e),...t},a={};r.bold&&(a.bold=!0),r.line&&(a.line=!0),a.bold||a.line?n[e]=a:delete n[e],i?.({tsStyles:Object.keys(n).length?n:void 0})};if(w)return(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`The time-series view runs in the web app. Open Loopable in a browser tab to see it.`});if(!o.length)return(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no metric fields yet. A time series needs a metric with a time dimension — add one from a column menu, then pick it here.`});let ee=o.filter(e=>!l.includes(e.key)),N=E.columns.length+2+ +!!m;return(0,B.jsxs)(`div`,{className:`cg-ts`,children:[(0,B.jsxs)(`div`,{className:`cg-ts-bar`,children:[(0,B.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,B.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Period`}),(0,B.jsx)(`select`,{className:`cg-select`,value:s,onChange:e=>i?.({tsBucket:e.target.value}),disabled:!i,children:Od.map(e=>(0,B.jsx)(`option`,{value:e,children:xHe[e]},e))})]}),(0,B.jsxs)(`label`,{className:`cg-ts-ctl`,children:[(0,B.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Span`}),(0,B.jsx)(`select`,{className:`cg-select`,value:String(c),onChange:e=>i?.({tsSpan:{lastN:Number(e.target.value)}}),disabled:!i,children:SHe.map(e=>(0,B.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]}),(0,B.jsxs)(`span`,{className:`cg-ts-group`,children:[(0,B.jsx)(`span`,{className:`cg-ts-ctl-k`,children:`Compare`}),kd.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(d.includes(e)?` is-on`:``),"aria-pressed":d.includes(e),disabled:!i,onClick:()=>j(e),children:fm[e]},e))]}),(0,B.jsxs)(`span`,{className:`cg-ts-group`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(p?` is-on`:``),"aria-pressed":p,disabled:!i,onClick:()=>i?.({tsGridlines:!p&&void 0}),children:`Gridlines`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-tog`+(m?` is-on`:``),"aria-pressed":m,disabled:!i,onClick:()=>i?.({tsSparkline:!m||void 0}),children:`Trend`})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-tb-btn`,onClick:D,disabled:E.empty,children:`Export CSV`}),(0,B.jsx)(`span`,{className:`cg-ts-pool`,children:a?`This record`:`${E.pool.toLocaleString()} ${E.pool===1?`customer`:`customers`}`})]}),_===`error`&&(0,B.jsx)(`div`,{className:`cg-ts-note cg-ts-error`,children:y===400?`That span is too wide to bucket. Choose a shorter span or a larger period.`:y===403?`None of these records are in your book.`:`The time series could not be loaded. Nothing is shown rather than a guess.`}),_===`loading`&&!h&&(0,B.jsx)(`div`,{className:`cg-ts-note`,children:`Loading…`}),h&&(0,B.jsx)(`div`,{className:`cg-ts-scroll`,children:(0,B.jsxs)(`table`,{className:`cg-ts-table`+(p?``:` is-nogrid`),children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`cg-ts-stick`,children:`Metric`}),E.columns.map(e=>(0,B.jsxs)(`th`,{className:e.partial?`is-partial`:void 0,children:[e.label,e.partial&&(0,B.jsx)(`span`,{className:`cg-ts-partial`,children:` · partial`})]},e.key)),(0,B.jsx)(`th`,{className:`cg-ts-total`,children:`Total`}),m&&(0,B.jsx)(`th`,{className:`cg-ts-sparkhead`,children:`Trend`})]})}),(0,B.jsxs)(`tbody`,{children:[E.rows.map(e=>(0,B.jsx)(DHe,{row:e,sheet:E,style:mm(f,e.id),styles:f,sparkline:m,charted:x.has(e.id),editable:!!i,metricRow:T.rows.find(t=>t.field===e.id),onToggleChart:()=>O(e.id),onStyle:t=>M(e.id,t),onRemove:()=>{e.kind===`metric`?k(l.filter(t=>t!==e.id)):A(u.filter(t=>t.id!==e.id))},onEditRow:t=>A(u.map(n=>n.id===e.id?{...n,...t}:n))},e.id)),i&&(0,B.jsx)(`tr`,{className:`cg-ts-addrow`,children:(0,B.jsx)(`th`,{className:`cg-ts-stick`,colSpan:N,children:(0,B.jsxs)(`span`,{className:`cg-ts-addbar`,children:[(0,B.jsx)(kp,{fields:ee,value:void 0,onChange:e=>k([...l,e]),className:`cg-select cg-ts-addsel`,ariaLabel:`Add a metric row`,disabled:!ee.length||l.length>=12,placeholder:ee.length?l.length>=12?`At the 12-metric limit`:`+ Add metric`:`Every metric is on the sheet`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:u.length>=12,onClick:()=>A([...u,{id:wHe(u),kind:`note`,label:``}]),children:`+ Note`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-tog`,disabled:u.length>=12,onClick:()=>A([...u,{id:wHe(u),kind:`formula`,label:``,expr:``}]),children:`+ Formula`})]})})})]})]})}),h&&E.empty&&(0,B.jsx)(`div`,{className:`cg-ts-note`,children:`No metrics returned a series for this span.`}),E.notes.length>0&&(0,B.jsx)(`ul`,{className:`cg-ts-notes`,children:E.notes.map(e=>(0,B.jsx)(`li`,{children:e},e))})]})}function EHe({style:e,editable:t,onStyle:n,onRemove:r,label:i}){return t?(0,B.jsxs)(`span`,{className:`cg-ts-rowtools`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.bold?` is-on`:``),"aria-pressed":!!e.bold,"aria-label":`Bold ${i}`,title:`Bold`,onClick:()=>n({bold:!e.bold||void 0}),children:`B`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`+(e.line?` is-on`:``),"aria-pressed":!!e.line,"aria-label":`Rule above ${i}`,title:`Rule above`,onClick:()=>n({line:!e.line||void 0}),children:`―`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-rowtool`,"aria-label":`Remove ${i}`,title:`Remove row`,onClick:r,children:`×`})]}):null}function DHe({row:e,sheet:t,style:n,styles:r,sparkline:i,charted:a,editable:o,metricRow:s,onToggleChart:c,onStyle:l,onRemove:u,onEditRow:d}){let f=(0,L.useMemo)(()=>{if(!a||!s)return null;let n=gm(s,t.columns);return n.points.length?ym({spec:{id:e.id,kind:`line`,agg:e.agg??`sum`},model:n,yTitle:e.label,formatValue:e=>e.toLocaleString(void 0,{maximumFractionDigits:2})}):null},[a,s,t.columns,e.id,e.agg,e.label]),p=t.columns.length+2+ +!!i,m=(n.line?`is-ruled`:``)+(n.bold?` is-bold`:``)||void 0;return e.kind===`note`?(0,B.jsx)(`tr`,{className:`cg-ts-noterow `+(m??``),children:(0,B.jsx)(`th`,{className:`cg-ts-stick`,colSpan:p,children:(0,B.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[o?(0,B.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Note — type a heading for this section`,"aria-label":`Note row label`,onChange:e=>d({label:e.target.value})}):(0,B.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}),(0,B.jsx)(EHe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`note row`})]})})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`tr`,{className:m,children:[(0,B.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:(0,B.jsxs)(`span`,{className:`cg-ts-rowhead`,children:[(0,B.jsxs)(`span`,{className:`cg-ts-rowmain`,children:[e.kind===`formula`?o?(0,B.jsx)(`input`,{className:`cg-ts-rowinput`,value:e.label,maxLength:120,placeholder:`Formula row name`,"aria-label":`Formula row label`,onChange:e=>d({label:e.target.value})}):(0,B.jsx)(`span`,{className:`cg-ts-rowlabel`,children:e.label}):(0,B.jsx)(`button`,{type:`button`,className:`cg-ts-rowbtn`,onClick:c,"aria-pressed":a,title:a?`Show as a row of numbers`:`Show as a line`,children:e.label}),e.sublabel&&(0,B.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.sublabel}),e.kind===`formula`&&(o?(0,B.jsx)(`input`,{className:`cg-ts-rowinput cg-ts-rowexpr`,value:e.expr??``,maxLength:200,spellCheck:!1,placeholder:`= [Sales] - [Returns]`,"aria-label":`Formula`,onChange:e=>d({expr:e.target.value})}):(0,B.jsx)(`span`,{className:`cg-ts-rowsub`,children:e.expr}))]}),(0,B.jsx)(EHe,{style:n,editable:o,onStyle:l,onRemove:u,label:e.label||`row`})]})}),e.cells.map((n,i)=>{let a=t.columns[i],o=mm(r,e.id,a?.key);return(0,B.jsx)(`td`,{className:(n.partial?`is-partial`:``)+(o.bold?` is-bold`:``)||void 0,children:gie(n.value,e=>e.toLocaleString(void 0,{maximumFractionDigits:2}))},a?.key??i)}),(0,B.jsx)(`td`,{className:`cg-ts-total`,children:e.total==null?``:e.total.toLocaleString(void 0,{maximumFractionDigits:2})}),i&&(0,B.jsx)(`td`,{className:`cg-ts-spark`,children:(0,B.jsx)(kHe,{values:e.cells.map(e=>e.value),label:e.label})})]}),e.deltas.map(e=>(0,B.jsx)(OHe,{delta:e,sparkline:i},e.kind)),a&&(0,B.jsx)(`tr`,{className:`cg-ts-chartrow`,children:(0,B.jsx)(`td`,{colSpan:p,children:f?(0,B.jsx)(yHe,{spec:f,label:`${e.label} over time`}):(0,B.jsx)(`div`,{className:`cg-ts-note`,children:`Nothing to plot — every period for this metric is unanswered.`})})})]})}function OHe({delta:e,sparkline:t}){return(0,B.jsxs)(`tr`,{className:`cg-ts-delta`,children:[(0,B.jsx)(`th`,{scope:`row`,className:`cg-ts-stick`,children:e.label}),e.values.map((t,n)=>(0,B.jsx)(`td`,{className:t==null?void 0:t>=0?`is-up`:`is-down`,children:e.percent?_ie(t):t==null?`—`:`${t>0?`+`:``}${t.toLocaleString(void 0,{maximumFractionDigits:2})}`},n)),(0,B.jsx)(`td`,{className:`cg-ts-total`}),t&&(0,B.jsx)(`td`,{className:`cg-ts-spark`})]})}function kHe({values:e,label:t}){let n=(0,L.useMemo)(()=>Tie(e,A7,j7),[e]);if(!n.length)return(0,B.jsx)(`span`,{className:`cg-ts-sparkempty`,children:`—`});let r=e.filter(e=>e!=null).length;return(0,B.jsx)(`svg`,{className:`cg-ts-sparksvg`,width:A7,height:j7,viewBox:`0 0 ${A7} ${j7}`,role:`img`,"aria-label":`${t}: trend over ${r} of ${e.length} periods`,children:n.map((e,t)=>(0,B.jsx)(`polyline`,{points:Eie(e),fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinejoin:`round`,strokeLinecap:`round`},t))})}function M7(e){return!Number.isFinite(e)||e<0?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function AHe(e){let t=[];return e.by&&t.push(e.by),e.ts&&t.push(e.ts.slice(0,16).replace(`T`,` `)),t.join(` · `)}function jHe({pid:e,docs:t,docPayload:n,onAdd:r,onFetch:i,onDelete:a}){let o=(0,L.useRef)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),d=(0,L.useRef)(null),[f,p]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!(!n||d.current==null)&&!(n.pid!==e||n.docId!==d.current)){d.current=null;try{let e=atob(n.data_b64),t=new Uint8Array(e.length);for(let n=0;nURL.revokeObjectURL(r),0)}catch{c(`That file could not be decoded. Nothing was downloaded.`)}}},[n,e]);let m=e=>{if(c(null),!e)return;if(e.size>5242880){c(`${e.name} is ${M7(e.size)}. The limit is ${M7(ete)}, so it was not uploaded.`),o.current&&(o.current.value=``);return}u(!0);let t=new FileReader;t.onerror=()=>{u(!1),c(`${e.name} could not be read.`)},t.onload=()=>{u(!1);let n=String(t.result??``),i=n.indexOf(`,`);if(i<0){c(`${e.name} could not be encoded.`);return}r({name:e.name,mime:e.type||`application/octet-stream`,size:e.size,data_b64:n.slice(i+1)}),o.current&&(o.current.value=``)},t.readAsDataURL(e)};return(0,B.jsxs)(`section`,{className:`cg-detail-section cg-docs`,children:[(0,B.jsx)(`div`,{className:`cg-detail-section-title`,children:`Documents`}),t.length===0?(0,B.jsx)(`div`,{className:`cg-docs-empty`,children:`No documents on this customer yet.`}):(0,B.jsx)(`ul`,{className:`cg-docs-list`,children:t.map(e=>(0,B.jsxs)(`li`,{className:`cg-docs-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn cg-docs-name`,title:`Download ${e.name}`,onClick:()=>{c(null),d.current=e.id,i(e.id)},children:e.name}),(0,B.jsxs)(`span`,{className:`cg-docs-meta`,children:[M7(e.size),AHe(e)?` · ${AHe(e)}`:``]}),e.canDelete!==!1&&(0,B.jsx)(`button`,{type:`button`,className:`cg-docs-del`+(f===e.id?` is-armed`:``),"aria-label":f===e.id?`Delete ${e.name}?`:`Delete ${e.name}`,onClick:()=>{if(f!==e.id){p(e.id);return}p(null),a(e.id)},children:f===e.id?`Delete?`:`×`})]},e.id))}),(0,B.jsxs)(`div`,{className:`cg-docs-add`,children:[(0,B.jsx)(`input`,{ref:o,type:`file`,className:`cg-docs-file`,"aria-label":`Add a document`,disabled:l,onChange:e=>m(e.target.files?.[0])}),(0,B.jsxs)(`span`,{className:`cg-docs-cap`,children:[`Up to `,M7(ete),` per file.`]})]}),s&&(0,B.jsx)(`div`,{className:`cg-docs-error`,children:s})]})}var MHe=`application/x-cg-field`;function NHe(e,t){let n=new Set(t),r=new Set,i=[];for(let t of e??[])!n.has(t)||r.has(t)||(r.add(t),i.push(t));for(let e of t)r.has(e)||(r.add(e),i.push(e));return i}function PHe(e,t,n){let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0||r===i)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}function FHe(e,t,n){let r=e.indexOf(t),i=r+n;if(r<0||i<0||i>=e.length)return e;let a=[...e];return a.splice(r,1),a.splice(i,0,t),a}var IHe=class extends Error{status;constructor(e,t){super(e),this.name=`RecordCommentsError`,this.status=t}};async function N7(e){let t=null;try{t=await e.json()}catch{}if(e.status===401&&zu(Pu),!e.ok)throw new IHe(t?.error?.message||`The server answered ${e.status}.`,e.status);return t}async function LHe(e,t){let n=await N7(await fetch(`${Mu}/customers/${e}/comments`,{credentials:Nu,signal:t}));return Array.isArray(n.comments)?n.comments:[]}async function RHe(e,t){return(await N7(await fetch(`${Mu}/customers/${e}/comments`,{method:`POST`,credentials:Nu,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t})}))).comment}async function zHe(e,t){await N7(await fetch(`${Mu}/customers/${e}/comments/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:Nu}))}function BHe(e){return{pid:e,comments:[],draft:``,loading:!0,posting:!1,error:``}}function VHe(e,t){if(t.type===`record`)return BHe(t.pid);if(t.pid!==e.pid)return e;switch(t.type){case`loaded`:return{...e,comments:t.comments,loading:!1,error:``};case`load-failed`:return{...e,loading:!1,error:t.error};case`draft`:return{...e,draft:t.draft};case`posting`:return{...e,posting:!0,error:``};case`posted`:return{...e,comments:[...e.comments,t.comment],draft:``,posting:!1};case`post-failed`:return{...e,posting:!1,error:t.error};case`deleted`:return{...e,comments:e.comments.filter(e=>e.id!==t.commentId)};case`delete-failed`:return{...e,error:t.error}}}function HHe(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`?`}function UHe(e){let t=new Date(e);return Number.isFinite(t.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t):e}function WHe({pid:e,viewer:t}){let[n,r]=(0,L.useReducer)(VHe,e,BHe),{comments:i,draft:a,loading:o,posting:s,error:c}=n,l=(0,L.useRef)(null);(0,L.useEffect)(()=>{let t=new AbortController;return r({type:`record`,pid:e}),LHe(e,t.signal).then(t=>r({type:`loaded`,pid:e,comments:t})).catch(t=>{t instanceof DOMException&&t.name===`AbortError`||r({type:`load-failed`,pid:e,error:t instanceof Error?t.message:`Comments could not be loaded.`})}),()=>t.abort()},[e]);let u=async t=>{t.preventDefault();let n=a.trim();if(!n||s)return;let i=e;r({type:`posting`,pid:i});try{let t=await RHe(i,n);r({type:`posted`,pid:i,comment:t}),i===e&&l.current?.focus()}catch(e){r({type:`post-failed`,pid:i,error:e instanceof Error?e.message:`That comment was not saved.`})}},d=async t=>{let n=e;try{await zHe(n,t.id),r({type:`deleted`,pid:n,commentId:t.id})}catch(e){r({type:`delete-failed`,pid:n,error:e instanceof Error?e.message:`That comment was not deleted.`})}};return(0,B.jsxs)(`aside`,{className:`cg-record-comments`,"aria-label":`Record comments`,children:[(0,B.jsxs)(`div`,{className:`cg-record-comments-head`,children:[(0,B.jsx)(`h2`,{children:`Comments`}),(0,B.jsx)(`span`,{children:i.length.toLocaleString()})]}),(0,B.jsxs)(`div`,{className:`cg-record-comment-feed`,"aria-live":`polite`,children:[o&&(0,B.jsx)(`div`,{className:`cg-record-comment-state`,children:`Loading comments…`}),!o&&i.length===0&&!c&&(0,B.jsx)(`div`,{className:`cg-record-comment-state`,children:`No comments yet. Add context for the team here.`}),i.map(e=>{let n=t?.isAdmin===!0||t?.name?.trim().toLowerCase()===e.authorKey.toLowerCase();return(0,B.jsxs)(`article`,{className:`cg-record-comment`,children:[(0,B.jsx)(`div`,{className:`cg-record-comment-avatar`,"aria-hidden":!0,children:HHe(e.author)}),(0,B.jsxs)(`div`,{className:`cg-record-comment-content`,children:[(0,B.jsxs)(`div`,{className:`cg-record-comment-meta`,children:[(0,B.jsx)(`strong`,{children:e.author}),(0,B.jsx)(`time`,{dateTime:e.createdAt,children:UHe(e.createdAt)}),n&&(0,B.jsx)(`button`,{type:`button`,className:`cg-record-comment-delete`,"aria-label":`Delete comment by ${e.author}`,title:`Delete comment`,onClick:()=>void d(e),children:`×`})]}),(0,B.jsx)(`p`,{children:e.body})]})]},e.id)}),c&&(0,B.jsx)(`div`,{className:`cg-record-comment-error`,children:c})]}),(0,B.jsxs)(`form`,{className:`cg-record-comment-compose`,onSubmit:e=>void u(e),children:[(0,B.jsx)(`label`,{htmlFor:`cg-comment-${e}`,children:`Add a comment`}),(0,B.jsx)(`textarea`,{ref:l,id:`cg-comment-${e}`,value:a,maxLength:4e3,placeholder:`Share an update or leave context…`,onChange:t=>r({type:`draft`,pid:e,draft:t.target.value}),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,B.jsxs)(`div`,{className:`cg-record-comment-compose-foot`,children:[(0,B.jsx)(`span`,{children:`Ctrl/⌘ + Enter to post`}),(0,B.jsx)(`button`,{type:`submit`,disabled:s||!a.trim(),children:s?`Posting…`:`Comment`})]})]})]})}function GHe(e,t){let n=t.trim();if(!n)return null;if(e.type===`url`)return/^https?:\/\//i.test(n)?n:/^[\w-]+(\.[\w-]+)+/.test(n)?`https://${n}`:null;if(e.type===`email`)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?`mailto:${n}`:null;if(e.type===`phone`){let e=n.replace(/[\s().-]/g,``);return/^\+?\d{5,}$/.test(e)?`tel:${e}`:null}return null}function KHe({value:e,...t}){let n=(0,L.useRef)(null);return(0,L.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.style.height=`auto`;let t=window.getComputedStyle(e),n=t.boxSizing===`border-box`?(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0):0;e.style.height=`${e.scrollHeight+n}px`};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),(0,B.jsx)(`textarea`,{ref:n,value:e,...t})}function qHe({name:e,avatars:t}){let n=t?.[e];if(n&&n.startsWith(`data:image/`))return(0,B.jsx)(`img`,{className:`cg-detail-avatar`,src:n,alt:``,"aria-hidden":!0});let r=rp(e);return(0,B.jsx)(`span`,{className:`cg-detail-avatar cg-detail-avatar--initials`,style:{background:r.bg,color:r.fg},"aria-hidden":!0,children:tie(e)})}function JHe(){return(0,B.jsx)(`svg`,{width:`10`,height:`14`,viewBox:`0 0 10 14`,"aria-hidden":!0,focusable:`false`,children:[3,7,11].map(e=>[3,7].map(t=>(0,B.jsx)(`circle`,{cx:t,cy:e,r:`1.15`,fill:`currentColor`},`${t}-${e}`)))})}function YHe({fields:e,record:t,titleKey:n,positionLabel:r,canPrev:i,canNext:a,onPrev:o,onNext:s,onClose:c,onNotesChange:l,onNotesCommit:u,viewer:d,docs:f,docPayload:p,onDocAdd:m,onDocFetch:h,onDocDelete:g,recordLayout:_,onRecordLayout:v,scope:y,userOptions:b,userAvatars:x}){let S=(0,L.useRef)(null),C=(0,L.useId)(),w=(0,L.useId)(),T=String(t[n]??`Untitled`),E=!Hu(),D=e.filter(e=>e.source===`overlay`),O=D.filter(e=>!wd(e.type)&&e.type!==`checkbox`&&e.type!==`rating`),k=D.filter(e=>e.type===`checkbox`),A=D.filter(e=>e.type===`rating`),j=D.filter(e=>wd(e.type)),M=e.filter(e=>e.source!==`overlay`&&e.key!==n),ee=new Map(e.map(e=>[e.key,e])),N=[...O,...k,...A,...j,...M].map(e=>e.key),[te,ne]=(0,L.useState)(null);(0,L.useEffect)(()=>{ne(e=>e&&JSON.stringify(e)===JSON.stringify(_??[])?null:e)},[_]);let P=NHe(te??_,N),re=(0,L.useRef)(null),[F,ie]=(0,L.useState)(null),[ae,oe]=(0,L.useState)(null),se=(0,L.useRef)(new Map),ce=(0,L.useRef)(null);(0,L.useLayoutEffect)(()=>{let e=ce.current;e&&(ce.current=null,se.current.get(e)?.focus())});let[le,ue]=(0,L.useState)(null),de=le&&P.includes(le)?le:P[0],fe=e=>{e!==P&&(ne(e),v?.(e))},[pe,me]=(0,L.useState)(`fields`),he=y!=null,ge=he?pe:`fields`,[_e,ve]=(0,L.useState)({mode:`timeseries`}),ye=(0,L.useMemo)(()=>[Number(t.pid)],[t.pid]),be=(e,t)=>(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-grip`,ref:t=>{se.current.set(e.key,t)},draggable:!0,tabIndex:e.key===de?0:-1,onFocus:()=>ue(e.key),"aria-label":`Reorder ${e.label}, position ${t+1} of ${P.length}`,title:`Drag to reorder — or press the arrow keys`,onDragStart:t=>{re.current=e.key,ie(e.key),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(MHe,e.key);let n=t.currentTarget.parentElement;n&&t.dataTransfer.setDragImage(n,14,n.clientHeight/2)},onDragEnd:()=>{re.current=null,ie(null),oe(null)},onKeyDown:t=>{if(t.key!==`ArrowUp`&&t.key!==`ArrowDown`)return;t.preventDefault();let n=FHe(P,e.key,t.key===`ArrowUp`?-1:1);n!==P&&(ce.current=e.key,fe(n))},children:(0,B.jsx)(JHe,{})}),xe=(e,n)=>{let r=`cg-ov-${e.key}`,i=Md(e,d),a=e.type===`user`&&!b?.length,o=i&&!a,s=o&&!wd(e.type)&&e.type!==`checkbox`&&e.type!==`rating`&&e.type!==`date`&&e.type!==`int`&&e.type!==`currency`&&e.type!==`pct`,c=o&&!s,f=`cg-detail-field`+(s?` cg-detail-field--edit`:``)+(c?` cg-detail-field--control`:``)+(ae===e.key?` is-dropzone`:``)+(F===e.key?` is-dragging`:``),p;if(s){let n=String(t[e.key]??``),i=GHe(e,n);p=(0,B.jsxs)(`div`,{className:`cg-detail-editwrap`,children:[(0,B.jsx)(KHe,{id:r,className:`cg-detail-textarea`,value:n,placeholder:`Add ${e.label.toLowerCase()}…`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),i&&(0,B.jsx)(`a`,{className:`cg-detail-action`,href:i,target:e.type===`url`?`_blank`:void 0,rel:e.type===`url`?`noopener noreferrer`:void 0,children:e.type===`url`?`Open link`:e.type===`email`?`Send email`:`Call`})]})}else if(e.source===`overlay`&&e.type===`checkbox`)p=(0,B.jsx)(`input`,{id:r,type:`checkbox`,className:`cg-detail-checkbox`,checked:up(t[e.key]),disabled:!o,onChange:t=>u(e.key,t.target.checked?`1`:``)});else if(c&&e.type===`rating`){let n=Dd(e),i=qp(e,t[e.key]);p=(0,B.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:(0,B.jsx)(`span`,{className:`cg-detail-stars`,children:Array.from({length:n},(e,t)=>t+1).map(n=>(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-star`,"aria-pressed":n<=i,"aria-label":n===i?`Clear ${e.label}`:`${n} star${n===1?``:`s`}`,title:n===i?`Click again to clear`:void 0,onClick:()=>u(e.key,eie(e,t[e.key],n)),children:(0,B.jsx)(Vp,{on:n<=i})},n))})})}else if(c&&(e.type===`select`||e.type===`user`)){let n=Hp(t[e.key]),i=Gp(e,b,n);p=(0,B.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`user`&&n!==``&&(0,B.jsx)(qHe,{name:n,avatars:x}),(0,B.jsxs)(`select`,{id:r,className:`cg-detail-select`,value:n,onChange:t=>u(e.key,t.target.value),children:[(0,B.jsx)(`option`,{value:``,children:e.type===`user`?`Unassigned`:`None`}),i.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})}else if(c&&e.type===`multiselect`){let n=t[e.key],i=Wp(n),a=Gp(e,b,n);p=(0,B.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,role:`group`,"aria-labelledby":`${r}-lbl`,children:a.length===0?(0,B.jsx)(`span`,{className:`cg-detail-nochoice`,children:`No choices yet. Add them from the column menu.`}):(0,B.jsx)(`span`,{className:`cg-detail-chips`,children:a.map(t=>{let r=i.includes(t.value);return(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-chip`+(r?` is-on`:``),"aria-pressed":r,title:t.stale?`No longer a choice on this field`:void 0,onClick:()=>u(e.key,Qre(n,t.value)),children:t.label},t.value)})})})}else if(c&&e.type===`date`){let n=t[e.key],i=Jre(n);p=i===null?(0,B.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[(0,B.jsx)(`input`,{id:r,type:`text`,className:`cg-detail-input`,value:Hp(n),title:`This value is not a date the picker can read — it is shown as stored.`,onChange:t=>l(e.key,t.target.value),onBlur:t=>u(e.key,t.target.value)}),(0,B.jsx)(`span`,{className:`cg-detail-hint`,children:`not a recognised date`})]}):(0,B.jsx)(`span`,{className:`cg-detail-value cg-detail-value--live`,children:(0,B.jsx)(`input`,{id:r,type:`date`,className:`cg-detail-input`,value:i,onChange:t=>u(e.key,Xre(n,t.target.value))})})}else if(c&&(e.type===`int`||e.type===`currency`||e.type===`pct`)){let n=e.type===`currency`?`$`:e.type===`pct`?`%`:``;p=(0,B.jsxs)(`span`,{className:`cg-detail-value cg-detail-value--live cg-detail-pickslot`,children:[e.type===`currency`&&(0,B.jsx)(`span`,{className:`cg-detail-unit`,children:n}),(0,B.jsx)(`input`,{id:r,type:`number`,className:`cg-detail-input cg-detail-input--num`,value:Kp(t[e.key]),step:e.type===`int`?1:`any`,placeholder:`—`,onChange:t=>l(e.key,t.target.value),onBlur:n=>{let r=$re(n.target.value);r===null?l(e.key,Kp(t[e.key])):u(e.key,r)}}),e.type===`pct`&&(0,B.jsx)(`span`,{className:`cg-detail-unit`,children:n})]})}else if(e.source===`overlay`&&e.type===`rating`)p=(0,B.jsx)(`span`,{className:`cg-detail-value`,title:a?void 0:`You do not have permission to edit this field`,children:(0,B.jsx)(qre,{value:qp(e,t[e.key]),max:Dd(e)})});else{let n=e.source===`overlay`?a?`No assignable people were supplied for this workspace`:`You do not have permission to edit this field`:void 0,r=e.type===`user`&&Hp(t[e.key])!==``;p=(0,B.jsxs)(`span`,{className:`cg-detail-value`+(r?` cg-detail-pickslot`:``),title:n,children:[r&&(0,B.jsx)(qHe,{name:Hp(t[e.key]),avatars:x}),pp(e,t[e.key])||`—`]})}let m=c&&(e.type===`rating`||e.type===`multiselect`),h=!m&&(s||c||e.source===`overlay`&&e.type===`checkbox`);return(0,B.jsxs)(`div`,{className:f,onDragOver:t=>{re.current&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,ae!==e.key&&oe(e.key))},onDragLeave:t=>{t.currentTarget.contains(t.relatedTarget)||oe(t=>t===e.key?null:t)},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`application/x-cg-field`)||re.current;oe(null),n&&fe(PHe(P,n,e.key))},children:[be(e,n),h?(0,B.jsx)(`label`,{className:`cg-detail-label`,htmlFor:r,children:e.label}):(0,B.jsx)(`span`,{className:`cg-detail-label`,id:m?`${r}-lbl`:void 0,children:e.label}),p]},e.key)};return Gne({panelRef:S,onDismiss:c,dismissOnOutside:!0,initialFocus:`[data-overlay-autofocus]`,trapFocus:!0}),(0,B.jsx)(Kne,{children:(0,B.jsx)(`div`,{className:`cg-record-backdrop`,children:(0,B.jsxs)(`div`,{className:`cg-record-modal`+(E?``:` cg-record-modal--single`),ref:S,role:`dialog`,"aria-modal":`true`,"aria-labelledby":C,"data-overlay-kind":`record-detail`,tabIndex:-1,children:[(0,B.jsxs)(`div`,{className:`cg-detail-header`,children:[(0,B.jsxs)(`div`,{className:`cg-detail-nav`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:o,disabled:!i,"aria-label":`Previous record`,title:`Previous record`,children:`‹`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-navbtn`,onClick:s,disabled:!a,"aria-label":`Next record`,title:`Next record`,children:`›`}),(0,B.jsx)(`span`,{className:`cg-detail-pos`,children:r})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-detail-close`,"data-overlay-autofocus":!0,onClick:c,"aria-label":`Close panel`,title:`Close`,children:`×`})]}),(0,B.jsxs)(`div`,{className:`cg-record-layout`,children:[(0,B.jsxs)(`main`,{className:`cg-record-main`,children:[(0,B.jsx)(`div`,{className:`cg-detail-titlewrap`,children:(0,B.jsx)(`div`,{className:`cg-detail-title`,id:C,title:T,children:T})}),he&&(0,B.jsx)(`div`,{className:`cg-record-tabs`,role:`tablist`,"aria-label":`Record view`,children:[`fields`,`insights`].map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,id:`${w}-${e}`,"aria-selected":ge===e,"aria-controls":`${w}-panel`,className:`cg-record-tab`+(ge===e?` is-on`:``),onClick:()=>me(e),children:e===`fields`?`Fields`:`Insights`},e))}),(0,B.jsx)(`div`,{className:`cg-detail-body`,id:`${w}-panel`,role:he?`tabpanel`:void 0,"aria-labelledby":he?`${w}-${ge}`:void 0,children:ge===`insights`&&y?(0,B.jsx)(`div`,{className:`cg-record-insights`,children:(0,B.jsx)(THe,{scope:y,pids:ye,fields:e,display:_e,onDisplay:e=>ve(t=>({...t,...e})),locked:!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`section`,{className:`cg-detail-section cg-detail-fieldlist`,children:P.map((e,t)=>{let n=ee.get(e);return n?xe(n,t):null})}),m&&h&&g&&(0,B.jsx)(jHe,{pid:Number(t.pid),docs:f??[],docPayload:p,onAdd:m,onFetch:h,onDelete:g})]})})]}),E&&(0,B.jsx)(WHe,{pid:Number(t.pid),viewer:d},Number(t.pid))]})]})})})}var P7=(e,t)=>typeof e==`number`&&t-e<=12e4;function XHe(e,t){let n={},r=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>P7(e,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},i=e=>{if(!e)return;let n=Object.entries(e).filter(([,e])=>P7(e.at,t));return n.length?Object.fromEntries(n.slice(-64)):void 0},a=r(e?.created),o=i(e?.renamed),s=r(e?.deleted),c=i(e?.moved);return a&&(n.created=a),o&&(n.renamed=o),s&&(n.deleted=s),c&&(n.moved=c),n}function ZHe(e,t,n,r){let i=e??[],a=[],o=new Set;for(let e of i){if(P7(n?.deleted?.[e.id],r))continue;o.add(e.id);let t=n?.renamed?.[e.id];a.push(P7(t?.at,r)&&t?{...e,name:t.name}:e)}for(let e of t??[])o.has(e.id)||P7(n?.created?.[e.id],r)&&(P7(n?.deleted?.[e.id],r)||a.push(e));return a.sort((e,t)=>(e.order??0)-(t.order??0)||e.name.localeCompare(t.name))}function QHe(e,t,n,r,i){let a=r?.moved?.[e],o=P7(a?.at,i)&&a?a.folderId:t??null;return o==null?null:n.some(e=>e.id===o)?o:null}function $He(e,t,n){let r=new Map(t.map(e=>[e.id,[]])),i=[];for(let t of e){let e=n(t),a=e==null?void 0:r.get(e);a?a.push(t):i.push(t)}let a=t.map(e=>({folder:e,items:r.get(e.id)??[]}));return a.push({folder:null,items:i}),a}function F7(){return`fld_${typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`}function eUe({views:e,activeViewId:t,saveState:n,onSelect:r,onCreate:i,onRename:a,onNote:o,onDuplicate:s,onDelete:c,lists:l=[],onAddToList:u,onCohortLock:d,today:f,onExport:p,folders:m,folderIdOf:h,onFolderCreate:g,onFolderRename:_,onFolderDelete:v,onFolderDuplicate:y,onItemMove:b,folderAddPreview:x,onFolderAddToList:S,viewer:C,onToggleLock:w,userOptions:T=[]}){let[E,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(``),[M,ee]=(0,L.useState)(`personal`),[N,te]=(0,L.useState)([]),[ne,P]=(0,L.useState)(null),[re,F]=(0,L.useState)(null),[ie,ae]=(0,L.useState)(null),[oe,se]=(0,L.useState)(``),[ce,le]=(0,L.useState)(null),[ue,de]=(0,L.useState)(null),[fe,pe]=(0,L.useState)(``),[me,he]=(0,L.useState)(null),ge=me?e.find(e=>e.id===me.viewId):void 0,_e=ce?e.find(e=>e.id===ce.viewId):void 0,ve=ne?e.find(e=>e.id===ne.viewId):void 0,ye=!!ve&&tf(ve,C),[be,xe]=(0,L.useState)(new Set),[Se,Ce]=(0,L.useState)(null),[we,Te]=(0,L.useState)(null),[Ee,De]=(0,L.useState)(!1),[Oe,ke]=(0,L.useState)(``),[Ae,je]=(0,L.useState)({shape:Qee,tone:nf}),[Me,Ne]=(0,L.useState)(null),[Pe,Fe]=(0,L.useState)(null),[Ie,Le]=(0,L.useState)(null),[Re,ze]=(0,L.useState)(``),[Be,Ve]=(0,L.useState)(null),[He,Ue]=(0,L.useState)(``),[We,Ge]=(0,L.useState)(()=>{try{return localStorage.getItem(`aios-views-rail`)===`1`}catch{return!1}}),Ke=()=>Ge(e=>{let t=!e;try{localStorage.setItem(`aios-views-rail`,t?`1`:`0`)}catch{}return t}),qe=He.trim().toLowerCase(),Je=qe?e.filter(e=>(e.name||``).toLowerCase().includes(qe)):e,Ye=!!m&&!!h&&!!b,Xe=$He(Je,Ye?m:[],e=>h?h(e.id):null),Ze=Se?m?.find(e=>e.id===Se.id):void 0,Qe=Pe&&x?x(Pe):null,$e=e=>Ye?{onDragOver:t=>{t.preventDefault(),Ve(e??`__root__`)},onDragLeave:()=>Ve(null),onDrop:t=>{t.preventDefault(),Ve(null);let n=t.dataTransfer.getData(`text/plain`);n&&b?.(n,e)}}:{},et=ie?e.find(e=>e.id===ie.viewId):void 0,tt=()=>{let e=A.trim();!e||!E||(i(e,E,Jee({edit:M,users:N},`personal`,T)),j(``),ee(`personal`),te([]),D(null))},nt=()=>{let e=Oe.trim();e&&(g?.(e,$ee(Ae)),ke(``),je({shape:Qee,tone:nf}),De(!1))},I=e=>{k(null),De(!1),D(e)},rt=()=>{k(null),D(null),De(!0)},it=e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]`)];if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()};return(0,B.jsxs)(`aside`,{className:`cg-views`+(We?` is-collapsed`:``),"aria-label":`Customer views`,children:[(0,B.jsx)(`div`,{className:`cg-views-top`,children:(0,B.jsx)(`button`,{type:`button`,className:`cg-rail-toggle`,"aria-label":We?`Expand views`:`Minimize views`,"aria-expanded":!We,title:We?`Expand views`:`Minimize views`,onClick:Ke,children:(0,B.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})})}),(0,B.jsx)(`div`,{className:`cg-sr-only`,"aria-live":`polite`,children:n===`saving`?`Saving changes…`:`All changes saved`}),(0,B.jsx)(`div`,{className:`cg-create-new`,children:(0,B.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-create-btn`,"aria-haspopup":`menu`,"aria-expanded":!!O,onClick:e=>k(t=>t?null:e.currentTarget),children:[(0,B.jsx)(`span`,{className:`cg-create-icon`,"aria-hidden":`true`,children:`+`}),(0,B.jsx)(`span`,{className:`cg-create-label`,children:`Create new…`})]})}),(0,B.jsxs)(`div`,{className:`cg-find-view`,children:[(0,B.jsxs)(`svg`,{className:`cg-find-view-icon`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,B.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,B.jsx)(`input`,{type:`text`,value:He,placeholder:`Find a view`,"aria-label":`Find a view`,onChange:e=>Ue(e.target.value),onKeyDown:e=>{e.key===`Escape`&&Ue(``)}})]}),E&&(0,B.jsxs)(`div`,{className:`cg-view-create cg-create-form`,children:[(0,B.jsxs)(`label`,{htmlFor:`cg-new-view`,children:[`New `,xf[E].toLowerCase(),` view`]}),(0,B.jsx)(`input`,{id:`cg-new-view`,className:`cg-input`,autoFocus:!0,value:A,placeholder:`e.g. Florida at risk`,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&tt(),e.key===`Escape`&&D(null)}}),(0,B.jsxs)(`div`,{className:`cg-perm`,role:`radiogroup`,"aria-label":`Who can edit this view`,children:[(0,B.jsx)(`span`,{className:`cg-perm-title`,children:`Who can edit`}),ef.map(e=>(0,B.jsxs)(`label`,{className:`cg-radio-row cg-perm-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-view-perm`,checked:M===e,onChange:()=>ee(e)}),(0,B.jsxs)(`span`,{className:`cg-perm-label`,children:[Kee[e],(0,B.jsx)(`span`,{className:`cg-perm-blurb`,children:qee[e]})]})]},e)),M===`users`&&(0,B.jsxs)(`div`,{className:`cg-perm-users`,children:[T.length===0?(0,B.jsx)(`span`,{className:`cg-perm-empty`,children:`No other accounts to pick — this will save as Personal.`}):T.map(e=>(0,B.jsxs)(`label`,{className:`cg-perm-user`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:N.includes(e),onChange:t=>te(n=>t.target.checked?[...n,e].slice(0,50):n.filter(t=>t!==e))}),(0,B.jsx)(`span`,{children:e})]},e)),T.length>0&&N.length===0&&(0,B.jsx)(`span`,{className:`cg-perm-empty`,children:`Pick at least one person, or this saves as Personal.`})]})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:tt,disabled:!A.trim(),children:`Create`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>D(null),children:`Cancel`})]})]}),Ye&&g&&Ee&&(0,B.jsxs)(`div`,{className:`cg-view-create cg-create-form cg-fold-form`,children:[(0,B.jsx)(`label`,{htmlFor:`cg-new-folder`,children:`New folder`}),(0,B.jsx)(`input`,{id:`cg-new-folder`,className:`cg-input`,autoFocus:!0,value:Oe,placeholder:`Folder name`,onChange:e=>ke(e.target.value),onKeyDown:e=>{e.key===`Enter`&&nt(),e.key===`Escape`&&De(!1)}}),(0,B.jsxs)(`div`,{className:`cg-fold-pick`,role:`group`,"aria-label":`Folder icon`,children:[(0,B.jsx)(`div`,{className:`cg-fold-pick-row`,children:Xee.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Ae.shape===e?` is-on`:``),"aria-pressed":Ae.shape===e,"aria-label":bf[e],title:bf[e],onClick:()=>je(t=>({...t,shape:e})),children:(0,B.jsx)(Op,{icon:{shape:e,tone:Ae.tone},size:15})},e))}),(0,B.jsx)(`div`,{className:`cg-fold-pick-row`,children:Zee.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-fold-swatch`+(Ae.tone===e?` is-on`:``),"aria-pressed":Ae.tone===e,"aria-label":yf[e],title:yf[e],onClick:()=>je(t=>({...t,tone:e})),children:(0,B.jsx)(Op,{icon:{shape:Ae.shape,tone:e},size:15})},e))})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,onClick:nt,disabled:!Oe.trim(),children:`Create`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>De(!1),children:`Cancel`})]})]}),O&&(0,B.jsxs)(Cp,{anchor:O,className:`cg-view-menu cg-create-flyout`,placement:`right-start`,role:`menu`,ariaLabel:`Create new`,onDismiss:()=>k(null),onKeyDown:it,dataKind:`create-new`,children:[Sf.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>I(e),children:[(0,B.jsx)(Jne,{mode:e,tone:Cf[e],size:16}),(0,B.jsx)(`span`,{children:xf[e]})]},e)),Ye&&g&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,B.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`cg-create-row`,onClick:()=>rt(),children:[(0,B.jsx)(Op,{size:16}),(0,B.jsx)(`span`,{children:`Folder`})]})]})]}),(0,B.jsx)(`div`,{className:`cg-view-list cg-views-scroll`,children:Xe.map(e=>{let n=e.folder?.id??null;if(qe&&e.folder&&e.items.length===0)return null;let i=n===null,o=n!=null&&be.has(n);return(0,B.jsxs)(`div`,{className:(i?`cg-fold-root`:`cg-fold`)+(Be===(n??`__root__`)?` is-drop`:``),...$e(n),children:[e.folder&&(0,B.jsxs)(`div`,{className:`cg-fold-head`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`cg-fold-toggle`,"aria-expanded":!o,onClick:()=>xe(t=>{let n=new Set(t);return n.has(e.folder.id)?n.delete(e.folder.id):n.add(e.folder.id),n}),children:[(0,B.jsx)(`span`,{className:`cg-fold-chev`+(o?` is-shut`:``),"aria-hidden":!0,children:`▾`}),(0,B.jsx)(Op,{icon:e.folder.icon,size:16}),we===e.folder.id?(0,B.jsx)(`input`,{className:`cg-input cg-fold-rename`,autoFocus:!0,defaultValue:e.folder.name,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.folder.name&&_?.(e.folder.id,n),Te(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&Te(null)}}):(0,B.jsx)(`span`,{className:`cg-fold-name`,children:e.folder.name}),(0,B.jsx)(`span`,{className:`cg-fold-count`,children:e.items.length})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for folder ${e.folder.name}`,"aria-haspopup":`menu`,onClick:t=>Ce(n=>n?.id===e.folder.id?null:{id:e.folder.id,anchor:t.currentTarget}),children:`···`})]}),!o&&e.items.map(e=>{let n=e.id===t,i=re===e.id,o=Zd(e);return(0,B.jsxs)(`div`,{className:`cg-view-row`+(n?` is-active`:``)+(e.config?.cohortLock?` cg-view-lockset`:``),draggable:Ye&&!i&&tf(e,C),onDragStart:t=>t.dataTransfer.setData(`text/plain`,e.id),children:[i?(0,B.jsx)(`input`,{className:`cg-view-rename cg-input`,autoFocus:!0,defaultValue:e.name,onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&a(e.id,n),F(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&F(null)}}):(0,B.jsxs)(`button`,{type:`button`,className:`cg-view-main`,onClick:()=>r(e.id),title:e.note?`${e.name} — ${e.note}`:e.name,children:[(0,B.jsx)(Jne,{mode:o,tone:Cf[o],size:16}),(0,B.jsxs)(`span`,{className:`cg-view-text`,children:[(0,B.jsx)(`span`,{className:`cg-view-name`,children:e.name}),e.note&&(0,B.jsx)(`span`,{className:`cg-view-desc`,children:e.note})]}),Qd(e)&&(0,B.jsx)(`span`,{className:`cg-view-lock`,role:`img`,"aria-label":`${xf[o]} view, locked`,title:`Locked — this view stays a ${xf[o].toLowerCase()}. Filters, sorts and columns are still editable.`,children:(0,B.jsx)(ere,{})})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":ne?.viewId===e.id,onClick:t=>P(n=>n?.viewId===e.id?null:{viewId:e.id,anchor:t.currentTarget}),children:`···`})]},e.id)}),e.folder&&!o&&e.items.length===0&&(0,B.jsx)(`div`,{className:`cg-fold-empty`,children:`Empty — drag a view here.`})]},n??`__root__`)})}),Se&&Ze&&(0,B.jsxs)(Cp,{anchor:Se.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for folder ${Ze.name}`,onDismiss:()=>{Ce(null),Ne(null)},dataKind:`folder-menu`,children:[(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Te(Ze.id),Ce(null)},children:`Rename`}),x&&S&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{Fe(Ze.id),Le(Se.anchor),ze(f?`${Ze.name} · ${f}`:Ze.name),Ce(null)},children:`Add to cohort…`}),y&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{y(Ze.id),Ce(null)},children:`Duplicate folder and its views`}),v&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item cg-menu-item--danger`+(Me===Ze.id?` is-armed`:``),onClick:()=>{if(Me!==Ze.id){Ne(Ze.id);return}v(Ze.id),Ne(null),Ce(null)},children:Me===Ze.id?`Delete folder? Its views move to the top level.`:`Delete folder`})]}),ue&&d&&(()=>{let t=e.find(e=>e.id===ue.viewId)?.config?.cohortLock;return(0,B.jsxs)(Cp,{anchor:ue.anchor,className:`cg-pop cg-lock-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Lock this view to a cohort`,onDismiss:()=>de(null),dataKind:`view-cohort-lock`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Lock to cohort`}),(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`A locked view can only ever show that cohort's customers. Filters still narrow within it, and the lock cannot be removed as a condition.`}),(l??[]).map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row`+(e.id===t?` is-on`:``),onClick:()=>{d(ue.viewId,e.id),de(null)},children:e.name},e.id)),t&&(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-lock-clear`,onClick:()=>{d(ue.viewId,null),de(null)},children:`Unlock — show the whole table again`})]})})(),Pe&&Ie&&Qe&&S&&(0,B.jsxs)(Cp,{anchor:Ie??void 0,className:`cg-pop cg-fold-addpop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add this folder's customers to a cohort`,onDismiss:()=>Fe(null),dataKind:`folder-add-to-list`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[Qe.pids.length.toLocaleString(),` customer`,Qe.pids.length===1?``:`s`,` from `,Qe.counted.toLocaleString(),` `,`view`,Qe.counted===1?``:`s`,` in this folder, counted once each.`]}),Qe.skipped.length>0&&(0,B.jsxs)(`div`,{className:`cg-pop-note cg-fold-skipped`,children:[`Not included:`,Qe.skipped.map(e=>(0,B.jsxs)(`span`,{className:`cg-fold-skip`,children:[e.name,` — `,e.why]},e.name))]}),(l??[]).map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{S(Pe,e.id,e.name),Fe(null)},children:e.name},e.id)),(0,B.jsxs)(`div`,{className:`cg-view-create`,children:[(0,B.jsx)(`label`,{htmlFor:`cg-fold-new-list`,children:`New cohort`}),(0,B.jsx)(`input`,{id:`cg-fold-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:Re,onChange:e=>ze(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Re.trim()&&(S(Pe,``,Re.trim()),Fe(null))}}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Re.trim()||Qe.pids.length===0,onClick:()=>{S(Pe,``,Re.trim()),Fe(null)},children:`Create and add`})]})]}),ne&&ve&&(0,B.jsxs)(Cp,{anchor:ne.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for ${ve.name}`,onDismiss:()=>P(null),onKeyDown:it,dataKind:`saved-view-menu`,children:[p&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{he({viewId:ve.id,anchor:ne.anchor}),P(null)},children:(0,B.jsx)(Dp,{icon:`download`,text:`Export`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0})]}),ye&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{F(ve.id),P(null)},children:(0,B.jsx)(Dp,{icon:`rename`,text:`Rename`})}),ye&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{se(ve.note??``),ae({viewId:ve.id,anchor:ne.anchor}),P(null)},children:(0,B.jsx)(Dp,{icon:`description`,text:ve.note?`Edit description`:`Add description`})}),(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{s(ve.id),P(null)},children:(0,B.jsx)(Dp,{icon:`duplicate`,text:`Duplicate`})}),u&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{pe(f?`${ve.name} · ${f}`:ve.name),le({viewId:ve.id,anchor:ne.anchor}),P(null)},children:(0,B.jsx)(Dp,{icon:`cohortAdd`,text:`Add to cohort`})}),d&&l.length>0&&ye&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{de({viewId:ve.id,anchor:ne.anchor}),P(null)},children:(0,B.jsx)(Dp,{icon:`permissions`,text:ve.config?.cohortLock?`Change cohort lock…`:`Lock to cohort…`})}),w&&ve.kind!==`system`&&ye&&$d(ve,C)&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{w(ve.id,!Qd(ve)),P(null)},children:(0,B.jsx)(Dp,{icon:Qd(ve)?`unlock`:(0,B.jsx)(Tp,{mode:Zd(ve),size:16}),text:Qd(ve)?`Unlock view`:`Lock as ${xf[Zd(ve)]}`})}),!Xd(ve)&&ye&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`is-danger`,onClick:()=>{c(ve.id),P(null)},children:(0,B.jsx)(Dp,{icon:`trash`,text:`Delete`})})]}),me&&ge&&p&&(0,B.jsxs)(Cp,{anchor:me.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Export ${ge.name}`,onDismiss:()=>he(null),onKeyDown:it,dataKind:`view-export`,children:[(0,B.jsxs)(`div`,{className:`cg-pop-title cg-export-title`,children:[`Export `,ge.name]}),Jp.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{p(ge.id,e),he(null)},children:Yp[e]},e))]}),ce&&_e&&u&&(0,B.jsxs)(Cp,{anchor:ce.anchor,className:`cg-pop cg-add-list-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Add ${_e.name} to a cohort`,onDismiss:()=>le(null),dataKind:`add-to-list`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the customers `,(0,B.jsx)(`strong`,{children:_e.name}),` matches right now. The cohort stays fixed as the data changes.`]}),l.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{u(_e.id,e.id,e.name),le(null)},children:e.name},e.id)),(0,B.jsxs)(`div`,{className:`cg-view-create`,children:[(0,B.jsx)(`label`,{htmlFor:`cg-new-list`,children:`New cohort`}),(0,B.jsx)(`input`,{id:`cg-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:fe,placeholder:`e.g. Q3 call plan`,onChange:e=>pe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&fe.trim()&&(u(_e.id,``,fe.trim()),le(null))}}),(0,B.jsx)(`div`,{className:`cg-form-actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!fe.trim(),onClick:()=>{u(_e.id,``,fe.trim()),le(null)},children:`Create and add`})})]})]}),ie&&et&&(0,B.jsxs)(Cp,{anchor:ie.anchor,className:`cg-pop cg-view-note-pop`,placement:`bottom-end`,role:`dialog`,ariaLabel:`Description for ${et.name}`,onDismiss:()=>ae(null),dataKind:`saved-view-note`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Description`}),(0,B.jsxs)(`label`,{className:`cg-column-note`,children:[(0,B.jsx)(`span`,{children:`Shown under this view's name in the list.`}),(0,B.jsx)(`textarea`,{"data-overlay-autofocus":!0,value:oe,maxLength:2e3,placeholder:`What is this list for?…`,onChange:e=>se(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:oe===(et.note??``),onClick:()=>{o(et.id,oe),ae(null)},children:`Save description`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>ae(null),children:`Cancel`})]})]})]})}function tUe({lists:e,activeCohortId:t,onSelect:n,folders:r,folderIdOf:i,onFolderCreate:a,onFolderRename:o,onFolderDelete:s,onFolderDuplicate:c,onItemMove:l,onFolderAddToList:u,today:d,onRename:f,onDelete:p,onExport:m}){let[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(null),C=x?e.find(e=>e.id===x.cohortId):void 0,w=h?e.find(e=>e.id===h.cohortId):void 0,[T,E]=(0,L.useState)(new Set),[D,O]=(0,L.useState)(null),[k,A]=(0,L.useState)(null),[j,M]=(0,L.useState)(!1),[ee,N]=(0,L.useState)(null),[te,ne]=(0,L.useState)(null),[P,re]=(0,L.useState)(null),[F,ie]=(0,L.useState)(``),[ae,oe]=(0,L.useState)(null),se=!!r&&!!i&&!!l,ce=$He(e,se?r:[],e=>i?i(e.id):null),le=D?r?.find(e=>e.id===D.id):void 0,ue=te?(t=>{let n=new Set;for(let r of e)if(!(!i||i(r.id)!==t))for(let e of r.pids??[])n.add(e);return[...n]})(te):[],de=te?e.filter(e=>i&&i(e.id)===te).length:0,fe=e=>se?{onDragOver:t=>{t.preventDefault(),oe(e??`__root__`)},onDragLeave:()=>oe(null),onDrop:t=>{t.preventDefault(),oe(null);let n=t.dataTransfer.getData(`text/plain`);n&&l?.(n,e)}}:{},pe=()=>{g(null),b(!1)},me=e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]`)];if(!t.length)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()};return(0,B.jsxs)(`aside`,{className:`cg-views cg-cohorts`,"aria-label":`Cohorts`,children:[(0,B.jsx)(`div`,{className:`cg-views-head`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`cg-views-title`,children:`Cohorts`}),(0,B.jsx)(`div`,{className:`cg-views-save`,children:e.length===1?`1 cohort`:`${e.length.toLocaleString()} cohorts`})]})}),se&&a&&(0,B.jsx)(`div`,{className:`cg-fold-new`,children:j?(0,B.jsx)(`input`,{className:`cg-input`,autoFocus:!0,placeholder:`Folder name`,onBlur:e=>{let t=e.target.value.trim();t&&a(t),M(!1)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&M(!1)}}):(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>M(!0),children:`+ New folder`})}),(0,B.jsxs)(`div`,{className:`cg-view-list`,children:[ce.map(e=>{let r=e.folder?.id??null,i=r!=null&&T.has(r);return(0,B.jsxs)(`div`,{className:(r===null?`cg-fold-root`:`cg-fold`)+(ae===(r??`__root__`)?` is-drop`:``),...fe(r),children:[e.folder&&(0,B.jsxs)(`div`,{className:`cg-fold-head`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`cg-fold-toggle`,"aria-expanded":!i,onClick:()=>E(t=>{let n=new Set(t);return n.has(e.folder.id)?n.delete(e.folder.id):n.add(e.folder.id),n}),children:[(0,B.jsx)(`span`,{className:`cg-fold-chev`+(i?` is-shut`:``),"aria-hidden":!0,children:`▾`}),k===e.folder.id?(0,B.jsx)(`input`,{className:`cg-input cg-fold-rename`,autoFocus:!0,defaultValue:e.folder.name,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.folder.name&&o?.(e.folder.id,n),A(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&A(null)}}):(0,B.jsx)(`span`,{className:`cg-fold-name`,children:e.folder.name}),(0,B.jsx)(`span`,{className:`cg-fold-count`,children:e.items.length})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for folder ${e.folder.name}`,"aria-haspopup":`menu`,onClick:t=>O(n=>n?.id===e.folder.id?null:{id:e.folder.id,anchor:t.currentTarget}),children:`···`})]}),!i&&e.items.map(e=>{let r=e.id===t,i=_===e.id;return(0,B.jsxs)(`div`,{draggable:se&&!i,onDragStart:t=>t.dataTransfer.setData(`text/plain`,e.id),children:[(0,B.jsxs)(`div`,{className:`cg-view-row`+(r?` is-active`:``),children:[i?(0,B.jsx)(`input`,{className:`cg-view-rename cg-input`,autoFocus:!0,defaultValue:e.name,"aria-label":`Rename ${e.name}`,onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&f(e.id,n),v(null)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&v(null)}}):(0,B.jsxs)(`button`,{type:`button`,className:`cg-view-main`,onClick:()=>n(e.id),title:e.name,"aria-current":r?`true`:void 0,children:[(0,B.jsx)(`span`,{className:`cg-view-dot cg-view-dot--list`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`cg-cohort-name`,children:e.name}),(0,B.jsx)(`span`,{className:`cg-cohort-count`,children:(e.pids?.length??0).toLocaleString()})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-view-more`,"aria-label":`Actions for ${e.name}`,"aria-haspopup":`menu`,"aria-expanded":h?.cohortId===e.id,onClick:t=>{let n=t.currentTarget;b(!1),g(t=>t?.cohortId===e.id?null:{cohortId:e.id,anchor:n})},children:`···`})]}),r&&(e.missing??0)>0&&(0,B.jsxs)(`div`,{className:`cg-cohort-missing`,children:[e.missing.toLocaleString(),` not active in the last 24 months, not shown`]})]},e.id)}),e.folder&&!i&&e.items.length===0&&(0,B.jsx)(`div`,{className:`cg-fold-empty`,children:`Empty — drag a cohort here.`})]},r??`__root__`)}),e.length===0&&(0,B.jsx)(`div`,{className:`cg-cohort-empty`,children:`No cohorts yet. Build one from the Customer page: filter or check customers, then Add to cohort.`})]}),D&&le&&(0,B.jsxs)(Cp,{anchor:D.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for folder ${le.name}`,onDismiss:()=>{O(null),N(null)},dataKind:`folder-menu`,children:[(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{A(le.id),O(null)},children:`Rename`}),u&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{ne(le.id),re(D.anchor),ie(d?`${le.name} · ${d}`:le.name),O(null)},children:`Add to cohort…`}),c&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item`,onClick:()=>{c(le.id),O(null)},children:`Duplicate folder and its cohorts`}),s&&(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`cg-menu-item cg-menu-item--danger`+(ee===le.id?` is-armed`:``),onClick:()=>{if(ee!==le.id){N(le.id);return}s(le.id),N(null),O(null)},children:ee===le.id?`Delete folder? Its cohorts move to the top level.`:`Delete folder`})]}),te&&P&&u&&(0,B.jsxs)(Cp,{anchor:P??void 0,className:`cg-pop cg-fold-addpop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add this folder's customers to a cohort`,onDismiss:()=>ne(null),dataKind:`folder-add-to-list`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[ue.length.toLocaleString(),` customer`,ue.length===1?``:`s`,` from`,` `,de.toLocaleString(),` cohort`,de===1?``:`s`,` in this folder, counted once each.`]}),e.filter(e=>!i||i(e.id)!==te).map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>{u(te,e.id,e.name),ne(null)},children:e.name},e.id)),(0,B.jsxs)(`div`,{className:`cg-view-create`,children:[(0,B.jsx)(`label`,{htmlFor:`cg-cfold-new-list`,children:`New cohort`}),(0,B.jsx)(`input`,{id:`cg-cfold-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:F,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&F.trim()&&(u(te,``,F.trim()),ne(null))}}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!F.trim()||ue.length===0,onClick:()=>{u(te,``,F.trim()),ne(null)},children:`Create and add`})]})]}),h&&w&&(0,B.jsxs)(Cp,{anchor:h.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Actions for ${w.name}`,onDismiss:pe,onKeyDown:me,dataKind:`cohort-menu`,children:[m&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{S({cohortId:w.id,anchor:h.anchor}),pe()},children:`Export`}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0})]}),(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{v(w.id),pe()},children:`Rename`}),(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,className:`is-danger`,onClick:()=>{if(!y){b(!0);return}p(w.id),pe()},children:y?`Delete permanently?`:`Delete`})]}),x&&C&&m&&(0,B.jsxs)(Cp,{anchor:x.anchor,className:`cg-view-menu`,placement:`bottom-end`,role:`menu`,ariaLabel:`Export ${C.name}`,onDismiss:()=>S(null),onKeyDown:me,dataKind:`cohort-export`,children:[(0,B.jsxs)(`div`,{className:`cg-pop-title cg-export-title`,children:[`Export `,C.name]}),Jp.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{m(C.id,e),S(null)},children:Yp[e]},e))]})]})}var I7=30,nUe={ABS:[1,1],ROUND:[1,2],ROUNDUP:[1,2],ROUNDDOWN:[1,2],INT:[1,1],MOD:[2,2],SQRT:[1,1],POWER:[2,2],EXP:[1,1],LN:[1,1],SUM:[1,I7],AVERAGE:[1,I7],COUNT:[1,I7],COUNTA:[1,I7],MIN:[1,I7],MAX:[1,I7],IF:[2,3],AND:[1,I7],OR:[1,I7],NOT:[1,1],IFERROR:[2,2],ISBLANK:[1,1],CONCATENATE:[1,I7],LEFT:[1,2],RIGHT:[1,2],MID:[3,3],LEN:[1,1],TRIM:[1,1],UPPER:[1,1],LOWER:[1,1],PROPER:[1,1],VALUE:[1,1],TEXT:[2,2],TODAY:[0,0],YEAR:[1,1],MONTH:[1,1],DAY:[1,1],DAYS:[2,2]},rUe={CONCAT:`CONCATENATE`},iUe=new Set([`<`,`<=`,`>`,`>=`,`=`,`!=`]);function aUe(e){let t=[],n=0;for(;n=e.length)return`a text value is missing its closing quote`;if(e[r]===`"`){if(e[r+1]===`"`){i+=`"`,r+=2;continue}break}i+=e[r],r+=1}t.push({t:`str`,v:i}),n=r+1;continue}if(/[0-9]/.test(r)||r===`.`&&/[0-9]/.test(e[n+1]??``)){let r=/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)/.exec(e.slice(n));if(!r||/^[0-9.]/.test(e[n+r[0].length]??``))return`unreadable number at "${e.slice(n,n+8)}"`;t.push({t:`num`,v:Number(r[0])}),n+=r[0].length;continue}if(/[A-Za-z_]/.test(r)){let r=/^[A-Za-z_][A-Za-z0-9_]*/.exec(e.slice(n));t.push({t:`ident`,v:r[0]}),n+=r[0].length;continue}let i=e.slice(n,n+2);if(i===`<=`||i===`>=`||i===`!=`||i===`==`||i===`<>`){t.push({t:`op`,v:i===`==`?`=`:i===`<>`?`!=`:i}),n+=2;continue}if(`+-*/^&(),<>=`.includes(r)){t.push({t:`op`,v:r}),n+=1;continue}return`unexpected character "${r}"`}return t}function L7(e){if(typeof e!=`string`||e.trim()===``)return{ok:!1,error:`the formula is empty`};if(e.length>500)return{ok:!1,error:`formula longer than 500 characters`};let t=aUe(e);if(typeof t==`string`)return{ok:!1,error:t};if(t.length===0)return{ok:!1,error:`the formula is empty`};if(t.length>200)return{ok:!1,error:`formula has more than 200 tokens`};let n=0,r=()=>t[n],i=e=>{let r=t[n];return r?.t===`op`&&r.v===e},a=null,o=e=>(a===null&&(a=e),null);function s(e){if(e>24)return o(`formula is nested too deeply`);let t=c(e);if(!t)return null;let i=r();if(i?.t===`op`&&iUe.has(i.v)){n+=1;let a=c(e);if(!a)return null;let s=r();return s?.t===`op`&&iUe.has(s.v)?o(`comparisons cannot be chained (a < b < c)`):{t:`cmp`,op:i.v,l:t,r:a}}return t}function c(e){let t=l(e);if(!t)return null;for(;i(`&`);){n+=1;let r=l(e);if(!r)return null;t={t:`bin`,op:`&`,l:t,r}}return t}function l(e){let t=u(e);if(!t)return null;for(;;)if(i(`+`)||i(`-`)){let i=r().v;n+=1;let a=u(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function u(e){let t=d(e);if(!t)return null;for(;;)if(i(`*`)||i(`/`)){let i=r().v;n+=1;let a=d(e);if(!a)return null;t={t:`bin`,op:i,l:t,r:a}}else return t}function d(e){if(e>24)return o(`formula is nested too deeply`);let t=f(e);if(!t)return null;if(i(`^`)){n+=1;let r=d(e+1);return r?{t:`bin`,op:`^`,l:t,r}:null}return t}function f(e){if(e>24)return o(`formula is nested too deeply`);if(i(`-`)){n+=1;let t=f(e+1);return t?{t:`neg`,e:t}:null}return p(e)}function p(e){if(e>24)return o(`formula is nested too deeply`);let t=r();if(!t)return o(`the formula ends unexpectedly`);if(t.t===`num`)return n+=1,{t:`num`,v:t.v};if(t.t===`str`)return n+=1,{t:`str`,v:t.v};if(t.t===`ref`)return n+=1,{t:`ref`,k:t.k};if(t.t===`op`&&t.v===`(`){n+=1;let t=s(e+1);return t?i(`)`)?(n+=1,t):o(`missing closing parenthesis`):null}if(t.t===`ident`){let r=t.v.toUpperCase();if(r===`TRUE`||r===`FALSE`)return n+=1,{t:`bool`,v:r===`TRUE`};let a=rUe[r]??r;if(!(a in nUe))return o(`unknown function ${r} — see the formula help for what is available`);if(n+=1,!i(`(`))return o(`${a} must be called with parentheses: ${a}(…)`);n+=1;let c=[];if(!i(`)`))for(;;){let t=s(e+1);if(!t)return null;if(c.push(t),i(`,`)){n+=1;continue}break}if(!i(`)`))return o(`missing closing parenthesis on ${a}(…)`);n+=1;let[l,u]=nUe[a];return c.lengthu?o(l===u?`${a} takes exactly ${l} argument${l===1?``:`s`}`:`${a} takes ${l} to ${u} arguments`):{t:`call`,fn:a,args:c}}return o(`unexpected "${t.t===`op`?t.v:String(t.v)}"`)}let m=s(1);if(!m)return{ok:!1,error:a??`could not parse the formula`};if(n!==t.length){let e=t[n];return{ok:!1,error:`unexpected "${e.t===`op`||e.t===`ident`?e.v:e.t===`ref`?`{${e.k}}`:String(e.v)}" after the formula`}}return{ok:!0,ast:m,refs:oUe(m)}}function oUe(e){let t=[],n=e=>{switch(e.t){case`ref`:t.includes(e.k)||t.push(e.k);return;case`neg`:n(e.e);return;case`bin`:case`cmp`:n(e.l),n(e.r);return;case`call`:e.args.forEach(n);return;default:return}};return n(e),t}function R7(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e==null)return null;if(typeof e==`string`){let t=e.trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}return null}function z7(e){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`?R7(e):null}function B7(e){return e==null?``:typeof e==`string`?e:typeof e==`boolean`?e?`TRUE`:`FALSE`:sUe(e)}function sUe(e){return String(Number.isInteger(e)?e:Number(e.toFixed(10)))}function cUe(e,t){if(!Number.isInteger(t)||t<-10||t>10)return null;let n=10**t,r=Math.sign(e)*Math.round(Math.abs(e)*n)/n;return Number.isFinite(r)?r:null}function V7(e){if(typeof e!=`string`)return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31?null:{y:n,m:r,d:i}}function lUe(e){return Date.UTC(e.y,e.m-1,e.d)/864e5}function uUe(e,t){let n=/^(\$?)(#,##0|0)(?:\.(0+))?(%?)$/.exec(t.trim());if(!n)return null;let[,r,i,a,o]=n,s=e;o===`%`&&(s*=100);let c=a?a.length:0,l=s<0||Object.is(s,-0)?`-`:``,[u,d]=Math.abs(s).toFixed(c).split(`.`);return i===`#,##0`&&(u=u.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)),l+r+u+(c?`.`+d:``)+(o===`%`?`%`:``)}function H7(e,t){let n=[];for(let r of e){let e=t(r);if(e==null)continue;let i=z7(e);i!=null&&n.push(i)}return n}function dUe(e,t,n){let r=e=>dUe(e,t,n);switch(e.t){case`num`:return e.v;case`str`:return e.v;case`bool`:return e.v;case`ref`:{let n=t(e.k);return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?n:null}case`neg`:{let t=z7(r(e.e));return t==null?null:-t}case`bin`:{if(e.op===`&`)return B7(r(e.l))+B7(r(e.r));let t=z7(r(e.l));if(t==null)return null;let n=z7(r(e.r));if(n==null)return null;let i;switch(e.op){case`+`:i=t+n;break;case`-`:i=t-n;break;case`*`:i=t*n;break;case`/`:if(n===0)return null;i=t/n;break;case`^`:i=t**+n;break}return Number.isFinite(i)?i:null}case`cmp`:{let t=r(e.l),n=r(e.r),i=typeof t==`number`?t:null,a=typeof n==`number`?n:null,o=i??(typeof t==`string`?R7(t):null),s=a??(typeof n==`string`?R7(n):null);if(o!=null&&s!=null)return fUe(e.op,o,s);if(typeof t==`string`&&typeof n==`string`){let r=t.trim().toLowerCase(),i=n.trim().toLowerCase();return r===``||i===``?null:fUe(e.op,ri),0)}return null}case`call`:switch(e.fn){case`ABS`:{let t=z7(r(e.args[0]));return t==null?null:Math.abs(t)}case`ROUND`:case`ROUNDUP`:case`ROUNDDOWN`:{let t=z7(r(e.args[0]));if(t==null)return null;let n=e.args.length>1?z7(r(e.args[1])):0;if(n==null||!Number.isInteger(n)||n<-10||n>10)return null;if(e.fn===`ROUND`)return cUe(t,n);let i=10**n,a=t*i,o=(e.fn===`ROUNDUP`?Math.sign(a)*Math.ceil(Math.abs(a)):Math.sign(a)*Math.floor(Math.abs(a)))/i;return Number.isFinite(o)?o:null}case`INT`:{let t=z7(r(e.args[0]));return t==null?null:Math.floor(t)}case`MOD`:{let t=z7(r(e.args[0])),n=z7(r(e.args[1]));return t==null||n==null||n===0?null:t-n*Math.floor(t/n)}case`SQRT`:{let t=z7(r(e.args[0]));return t==null||t<0?null:Math.sqrt(t)}case`POWER`:{let t=z7(r(e.args[0])),n=z7(r(e.args[1]));if(t==null||n==null)return null;let i=t**+n;return Number.isFinite(i)?i:null}case`EXP`:{let t=z7(r(e.args[0]));if(t==null)return null;let n=Math.exp(t);return Number.isFinite(n)?n:null}case`LN`:{let t=z7(r(e.args[0]));return t==null||t<=0?null:Math.log(t)}case`SUM`:return H7(e.args,r).reduce((e,t)=>e+t,0);case`AVERAGE`:{let t=H7(e.args,r);return t.length===0?null:t.reduce((e,t)=>e+t,0)/t.length}case`COUNT`:return H7(e.args,r).length;case`COUNTA`:{let t=0;for(let n of e.args){let e=r(n);e!=null&&e!==``&&(t+=1)}return t}case`MIN`:case`MAX`:{let t=H7(e.args,r);return t.length===0?null:e.fn===`MIN`?Math.min(...t):Math.max(...t)}case`IF`:{let t=r(e.args[0]);return typeof t==`boolean`?t?r(e.args[1]):e.args.length>2?r(e.args[2]):null:null}case`AND`:case`OR`:for(let t of e.args){let n=r(t);if(typeof n!=`boolean`)return null;if(e.fn===`AND`&&!n)return!1;if(e.fn===`OR`&&n)return!0}return e.fn===`AND`;case`NOT`:{let t=r(e.args[0]);return typeof t==`boolean`?!t:null}case`IFERROR`:return r(e.args[0])??r(e.args[1]);case`ISBLANK`:{let t=r(e.args[0]);return t==null||t===``}case`CONCATENATE`:return e.args.map(e=>B7(r(e))).join(``);case`LEFT`:case`RIGHT`:{let t=B7(r(e.args[0])),n=e.args.length>1?z7(r(e.args[1])):1;return n==null||!Number.isInteger(n)||n<0?null:e.fn===`LEFT`?t.slice(0,n):n===0?``:t.slice(-n)}case`MID`:{let t=B7(r(e.args[0])),n=z7(r(e.args[1])),i=z7(r(e.args[2]));return n==null||i==null||!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<0?null:t.slice(n-1,n-1+i)}case`LEN`:return B7(r(e.args[0])).length;case`TRIM`:return B7(r(e.args[0])).replace(/\s+/g,` `).trim();case`UPPER`:return B7(r(e.args[0])).toUpperCase();case`LOWER`:return B7(r(e.args[0])).toLowerCase();case`PROPER`:return B7(r(e.args[0])).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase());case`VALUE`:return z7(r(e.args[0]));case`TEXT`:{let t=z7(r(e.args[0])),n=r(e.args[1]);return t==null||typeof n!=`string`?null:uUe(t,n)}case`TODAY`:return typeof n.today==`string`&&V7(n.today)?n.today:null;case`YEAR`:case`MONTH`:case`DAY`:{let t=V7(r(e.args[0]));return t?e.fn===`YEAR`?t.y:e.fn===`MONTH`?t.m:t.d:null}case`DAYS`:{let t=V7(r(e.args[0])),n=V7(r(e.args[1]));return!t||!n?null:Math.round(lUe(t)-lUe(n))}}return null;default:return null}}function fUe(e,t,n){switch(e){case`<`:return t`:return t>n;case`>=`:return t>=n;case`=`:return t===n;case`!=`:return t!==n}}function pUe(e,t,n={}){try{let r=dUe(e,t,n);return typeof r==`number`?Number.isFinite(r)?r:null:typeof r==`string`?r:typeof r==`boolean`?r?`TRUE`:`FALSE`:null}catch{return null}}function mUe(e){let t=new Map;for(let[n,r]of e){let i=L7(r);t.set(n,i.ok?i.refs.filter(t=>e.has(t)&&t!==n):[])}let n=[],r=new Map,i=new Set,a=(e,o)=>{let s=r.get(e);if(s===2)return!i.has(e);if(s===1){for(let t=o.lastIndexOf(e);t({value:e,label:wf[e]}));function G7(e){return e===`select`||e===`multiselect`}var K7=[`Not started`,`In progress`,`Blocked`,`Done`],hUe=0;function q7(){return hUe+=1,`choice-${hUe}`}function J7(e,t=void 0){return e.map(e=>({id:q7(),label:e,color:$f(t?.[e])??$f(sp(e))}))}function Y7(e,t){let n=e.map(e=>t===`multiselect`?e.label.replace(/,/g,` `):e.label),r=Aee(n.join(` -`)),i=new Map;e.forEach((e,t)=>{let r=n[t].trim();r&&!i.has(r.toLowerCase())&&i.set(r.toLowerCase(),e)});let a={};for(let e of r){let t=$f(i.get(e.toLowerCase())?.color);t&&t!==$f(sp(e))&&(a[e]=t)}return{options:r,colors:a}}function gUe(e,t){return e.map(e=>`${e}\u0000${$f(t?Object.entries(t).find(([t])=>t.trim().toLowerCase()===e.toLowerCase())?.[1]:void 0)??$f(sp(e))}`).join(``)}function _Ue({value:e,disabled:t,label:n,onPick:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=np(e);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{ref:o,type:`button`,className:`cg-option-color`,disabled:t,style:{background:s?.bg??$f(e)??`#FFFFFF`},"aria-label":`Colour for ${n}${s?` — ${s.label}`:``}`,"aria-haspopup":`dialog`,"aria-expanded":i,title:`Change option colour`,onClick:()=>a(e=>!e)}),i&&o.current&&(0,B.jsx)(Cp,{anchor:o.current,className:`cg-pop cg-swatch-pop`,onDismiss:()=>a(!1),role:`dialog`,ariaLabel:`Colour for ${n}`,dataKind:`option-colour`,children:(0,B.jsx)(`div`,{className:`cg-swatch-grid`,children:tp.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-swatch`+(s?.id===e.id?` is-on`:``),style:{background:e.bg,color:e.fg},"aria-label":e.label,"aria-pressed":s?.id===e.id,title:e.label,onClick:()=>{r(e.bg),a(!1)},children:s?.id===e.id&&(0,B.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})},e.id))})})]})}function X7({idPrefix:e,drafts:t,onDrafts:n,colorCode:r,onColorCode:i,type:a}){let o=(e,r)=>n(t.map(t=>t.id===e?{...t,...r}:t)),s=Y7(t,a);return(0,B.jsxs)(`div`,{className:`cg-options-editor`,children:[(0,B.jsxs)(`div`,{className:`cg-options-head`,children:[(0,B.jsx)(`strong`,{children:`Options`}),(0,B.jsxs)(`label`,{className:`cg-option-toggle`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),(0,B.jsx)(`span`,{children:`Color-code options`})]})]}),(0,B.jsx)(`div`,{className:`cg-option-list`,children:t.map((i,s)=>(0,B.jsxs)(`div`,{className:`cg-option-row`,children:[(0,B.jsx)(_Ue,{value:$f(i.color)??Qf[s%Qf.length].bg,disabled:!r,label:i.label||`option ${s+1}`,onPick:e=>o(i.id,{color:e})}),(0,B.jsx)(`input`,{id:`${e}-${i.id}`,className:`cg-input cg-option-name`,type:`text`,maxLength:120,value:i.label,placeholder:`Option name`,"aria-label":`Option ${s+1}`,onChange:e=>{let t=a===`multiselect`?e.target.value.replace(/,/g,` `):e.target.value;o(i.id,{label:t})},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n([...t,{id:q7(),label:``,color:Qf[t.length%Qf.length].bg}]))}}),(0,B.jsx)(`button`,{type:`button`,className:`cg-option-remove`,"aria-label":`Remove ${i.label||`option ${s+1}`}`,title:`Remove option`,onClick:()=>n(t.filter(e=>e.id!==i.id)),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]},i.id))}),(0,B.jsx)(`button`,{type:`button`,className:`cg-option-add`,onClick:()=>n([...t,{id:q7(),label:``,color:Qf[t.length%Qf.length].bg}]),children:`Add option`}),(0,B.jsxs)(`span`,{className:`cg-field-hint`,children:[s.options.length,` option`,s.options.length===1?``:`s`,`.`,a===`multiselect`&&` Commas inside an option are not supported.`]})]})}function vUe({value:e,onPick:t,offerMeasure:n,only:r}){let[i,a]=(0,L.useState)(``),o=i.trim().toLowerCase(),s=[...r?W7.filter(e=>r.includes(e.value)):W7,...n?[{value:`measure`,label:`Metric`}]:[]].filter(e=>!o||e.label.toLowerCase().includes(o));return(0,B.jsxs)(`div`,{className:`cg-type-picker`,children:[(0,B.jsxs)(`div`,{className:`cg-type-search`,children:[(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.4`,stroke:`currentColor`,strokeWidth:`1.35`}),(0,B.jsx)(`path`,{d:`m10.4 10.4 3.1 3.1`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})]}),(0,B.jsx)(`input`,{type:`text`,value:i,placeholder:`Find a field type`,"aria-label":`Find a field type`,onChange:e=>a(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`cg-type-list`,role:`listbox`,"aria-label":`Field type`,children:[s.map(n=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e===n.value,className:`cg-type-row`+(e===n.value?` is-on`:``),onClick:()=>t(n.value),children:[(0,B.jsx)(wp,{type:n.value===`measure`?`currency`:n.value,size:16}),(0,B.jsx)(`span`,{className:`cg-type-label`,children:n.label}),e===n.value&&(0,B.jsx)(`svg`,{className:`cg-type-check`,width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`m3.5 8.5 3 3 6-6.5`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},n.value)),s.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`No matching type.`})]})]})}var yUe=`new:`,bUe=Cd.filter(e=>e!==`formula`&&e!==`created_time`),xUe={kind:`ltm`};function Z7({title:e,sub:t,onClose:n}){return(0,B.jsxs)(`div`,{className:`cg-column-head`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`cg-column-title`,children:e}),t&&(0,B.jsx)(`div`,{className:`cg-column-type`,children:t})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-icon-btn`,onClick:n,"aria-label":`Close column menu`,children:`×`})]})}function SUe({value:e,onValue:t}){return(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Scope`}),(0,B.jsxs)(`select`,{className:`cg-select cg-scope-select`,value:e,"aria-label":`Field scope`,onChange:e=>t(e.target.value),children:[(0,B.jsx)(`option`,{value:`cohort`,children:`This cohort table only`}),(0,B.jsx)(`option`,{value:`global`,children:`All customer tables`})]})]})}function Q7({kind:e,fields:t,formulaText:n,onFormulaText:r,formulaError:i,maxValue:a,onMaxValue:o,idPrefix:s,showFormulaHelp:c=!0}){if(e===`formula`){let e=t.filter(e=>e.key!==`__proto__`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Formula`}),(0,B.jsx)(`textarea`,{className:`cg-input cg-formula-editor`,rows:3,value:n,placeholder:`MAX(0, {revenue_ly} - {revenue_ytd})`,"aria-label":`Formula`,onChange:e=>r(e.target.value)})]}),(0,B.jsx)(`div`,{className:`cg-cond-line cg-formula-insert`,children:(0,B.jsx)(kp,{ariaLabel:`Insert a field reference`,placeholder:`Insert a field reference…`,value:void 0,keepOpen:!0,onChange:e=>r((n+` {`+e+`}`).trimStart()),fields:e.map(e=>({key:e.key,label:e.label,type:e.type}))})}),n.trim()!==``&&i?(0,B.jsx)(`div`,{className:`cg-field-hint cg-formula-error`,children:i}):c?(0,B.jsxs)(`div`,{className:`cg-field-hint`,children:[`Excel-style: numbers, text in quotes, `,`{field}`,` references, + − × ÷ ^ & ( ), IF · AND · OR · SUM · AVERAGE · COUNT · MIN · MAX · ROUND(UP/DOWN) · ABS · MOD · SQRT · CONCATENATE · LEFT · RIGHT · MID · LEN · TRIM · UPPER · LOWER · PROPER · TEXT · VALUE · TODAY · DAYS · YEAR · MONTH · DAY · IFERROR · ISBLANK. Errors show a blank cell.`]}):null]})}return e===`rating`?(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Number of stars`}),(0,B.jsx)(`input`,{id:`${s}-rating-max`,className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:a,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));o(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]}):e===`created_time`?(0,B.jsx)(`div`,{className:`cg-field-hint`,children:`Read-only. When the record was created in the source system.`}):null}function CUe({state:e,field:t,fields:n,locked:r,viewer:i,sortedDir:a,isFiltered:o,isGrouped:s,groupable:c,onClose:l,onNote:u,onHide:d,onCreate:f,onChangeField:p,onCreateAndSwap:m,onRetype:h,onRename:g,onFormula:_,initialPosition:v,scopeChoice:y=!1,pinnedTo:b=!1,onPinTo:x,onUnpin:S,onPeriod:C,onDelete:w,onDuplicate:T,onPermissions:E,onFormat:D,onSort:O,onClearSort:k,onFilterBy:A,onClearFilter:j,onGroupByField:M,onClearGroup:ee,userOptions:N=[],measures:te=[]}){let[ne,P]=(0,L.useState)(`menu`),[re,F]=(0,L.useState)(t.note??``),[ie,ae]=(0,L.useState)(v??null),[oe,se]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(``),[ue,de]=(0,L.useState)(!1),[fe,pe]=(0,L.useState)(`text`),[me,he]=(0,L.useState)(()=>J7(K7)),[ge,_e]=(0,L.useState)(!0),[ve,ye]=(0,L.useState)(te[0]?.key??``),[be,xe]=(0,L.useState)(xUe),[Se,Ce]=(0,L.useState)(``),[we,Te]=(0,L.useState)(5),[Ee,De]=(0,L.useState)(``),[Oe,ke]=(0,L.useState)(``),[Ae,je]=(0,L.useState)(()=>J7(K7)),[Me,Ne]=(0,L.useState)(!0),[Pe,Fe]=(0,L.useState)(``),[Ie,Le]=(0,L.useState)(5),[Re,ze]=(0,L.useState)(null),[Be,Ve]=(0,L.useState)(t.permissions?.edit??`everyone`),[He,Ue]=(0,L.useState)(()=>({...t.format??{}})),[We,Ge]=(0,L.useState)(`cohort`),[Ke,qe]=(0,L.useState)(t.label),[Je,Ye]=(0,L.useState)(t.type),[Xe,Ze]=(0,L.useState)(()=>J7(Ed(t).length?Ed(t):K7,t.optionColors)),[Qe,$e]=(0,L.useState)(t.colorCodeOptions!==!1),[et,tt]=(0,L.useState)(()=>Dd(t)),[nt,I]=(0,L.useState)(()=>typeof t.formula==`string`?t.formula:``),rt=Ee.startsWith(yUe)?Ee.slice(4):null,it=Y7(me,fe),at=it.options,ot=rt?Y7(Ae,rt):{options:[],colors:{}},st=ot.options,ct=Y7(Xe,Je),lt=ct.options,ut=(0,L.useMemo)(()=>new Set(n.filter(e=>e.type!==`formula`).map(e=>e.key)),[n]),dt=(0,L.useMemo)(()=>{let e=new Map;for(let t of n){if(t.type!==`formula`)continue;let n=typeof t.formula==`string`?t.formula:``;n&&e.set(t.key,n)}return e},[n]),ft=(0,L.useMemo)(()=>Se.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:U7(Se,ut,dt),[Se,ut,dt]),pt=(0,L.useMemo)(()=>Pe.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:U7(Pe,ut,dt),[Pe,ut,dt]),mt=te.find(e=>e.key===ve),ht=mt?`${mt.label} · ${xd(be)}`:``,gt=fe===`measure`&&!ue&&!ce.trim()?ht:ce,_t=gt.trim()!==``&&(!G7(fe)||at.length>0)&&(fe!==`measure`||!!mt)&&(fe!==`formula`||ft.ok),vt=(e,t,n)=>{if(e===`formula`)return{formula:t.trim()};if(e===`rating`)return{max:n}},yt=(e,t,n)=>G7(e)?{colorCodeOptions:n,...Object.keys(t).length?{optionColors:t}:{}}:{},bt=e=>y?{...e??{},scope:We}:e,xt=()=>{let e=gt.trim();if(!(!e||!ie||!_t)){if(fe===`measure`){if(!mt)return;f(e,mt.type,ie===`end`?null:t.key,ie,void 0,{key:mt.key,window:be},bt(void 0)),l();return}f(e,fe,ie===`end`?null:t.key,ie,G7(fe)?at:void 0,void 0,bt({...vt(fe,Se,we),...yt(fe,it.colors,ge)})),l()}},St=rt!=null&&Oe.trim()!==``&&(!G7(rt)||st.length>0)&&(rt!==`formula`||pt.ok),Ct=()=>{!rt||!St||(m(Oe.trim(),rt,G7(rt)?st:void 0,bt({...vt(rt,Pe,Ie),...yt(rt,ot.colors,Me)})),l())},wt=Ke.trim(),Tt=!!g&&wt!==``&&wt!==t.label,Et=G7(Je)&<.join(` -`)!==Ed(t).join(` -`),Dt=G7(Je)&&(Qe!==(t.colorCodeOptions!==!1)||gUe(lt,ct.colors)!==gUe(Ed(t),t.optionColors)),Ot=Je===`rating`&&et!==Dd(t),kt=h!=null&&(Je!==t.type||Et||Dt||Ot),At=!G7(Je)||lt.length>0,jt=(0,L.useMemo)(()=>nt.trim()===``?{ok:!1,error:`Type a formula`,refs:[]}:U7(nt,ut,dt,t.key),[nt,ut,dt,t.key]),Mt=!!_&&t.type===`formula`&&nt.trim()!==(typeof t.formula==`string`?t.formula.trim():``),Nt=kt&&!At||Mt&&!jt.ok,Pt=t.measure?yd(t.measure.window):null,Ft=Re?yd(Re):null,It=Ft!=null&&JSON.stringify(Ft)!==JSON.stringify(Pt),Lt=!!t.measure&&!!C,Rt=!Nt&&(Tt||kt||Mt||Lt&&It),zt=()=>{Rt&&(kt&&h?h(Je,G7(Je)?lt:void 0,{...Je===`rating`?{max:et}:{},...G7(Je)?{colorCodeOptions:Qe,...Object.keys(ct.colors).length?{optionColors:ct.colors}:{}}:{},...Tt?{label:wt}:{}}):Mt&&_?_(nt.trim(),Tt?wt:void 0):Tt&&g&&g(wt),Lt&&It&&Ft&&C(Ft),l())},Bt=n.filter(e=>e.key!==t.key),Vt=Bt.filter(e=>e.source===`odoo`&&!e.custom),Ht=Bt.filter(e=>!(e.source===`odoo`&&!e.custom)),Ut=t.measure?`Metric, read-only`:t.type===`formula`?`Formula field, computed`:t.type===`created_time`?`Created time, read-only`:t.derived?`Read-only, derived`:t.source===`odoo`?`Read-only source field`:`Editable overlay field`,Wt=t.scope===`cohort`?`${Ut} · this cohort only`:Ut,Gt=t.type===`int`||t.type===`currency`||t.type===`formula`?`number`:t.type===`date`||t.type===`created_time`?`date`:null;if(ie)return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:ie===`end`?`Add field`:`Insert field ${ie} of ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:ie===`end`?`Add field`:ie===`left`?`Insert field left`:`Insert field right`,sub:ie===`end`?`Added as the last column`:`Next to ${t.label}`,onClose:l}),(0,B.jsxs)(`div`,{className:`cg-column-create`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Name`}),(0,B.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:gt,onChange:e=>{le(e.target.value),de(!0)},onKeyDown:e=>e.key===`Enter`&&xt()})]}),(0,B.jsxs)(`div`,{className:`cg-type-block`,children:[(0,B.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,B.jsx)(vUe,{value:fe,onPick:pe,offerMeasure:te.length>0})]}),fe===`measure`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Number`}),(0,B.jsx)(kp,{ariaLabel:`Number to summarise`,placeholder:`Choose a number…`,value:mt?ve:void 0,onChange:ye,fields:te.map(e=>({key:e.key,label:e.label,type:`measure`}))})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Period`}),(0,B.jsx)(`span`,{className:`cg-measure-window`,children:(0,B.jsx)(Bp,{window:be,onWindow:xe})})]}),(0,B.jsx)(`div`,{className:`cg-field-hint`,children:`A total, average or count over the period you choose — e.g. Sales, last 90 days. Computed for every customer, and read-only.`})]}),(0,B.jsx)(Q7,{kind:fe,fields:n,formulaText:Se,onFormulaText:Ce,formulaError:ft.ok?null:ft.error??null,maxValue:we,onMaxValue:Te,idPrefix:`cg-create`}),G7(fe)&&(0,B.jsx)(X7,{idPrefix:`cg-create-option`,drafts:me,onDrafts:he,colorCode:ge,onColorCode:_e,type:fe}),fe===`user`&&(0,B.jsx)(`div`,{className:`cg-field-hint`,children:N.length?`${N.length} people can be assigned, from your user list.`:`No user list yet, so there is no one to assign.`}),y&&(0,B.jsx)(SUe,{value:We,onValue:Ge}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!_t,onClick:xt,children:`Create field`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>v?l():ae(null),children:`Cancel`})]})]})]});if(ne===`edit`)return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit field ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:`Edit field`,sub:Wt,onClose:l}),(0,B.jsxs)(`div`,{className:`cg-column-create`,children:[g?(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Name`}),(0,B.jsx)(`input`,{className:`cg-input`,autoFocus:!0,"data-overlay-autofocus":!0,value:Ke,onChange:e=>qe(e.target.value),onKeyDown:e=>e.key===`Enter`&&zt()})]}):(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Name`}),(0,B.jsx)(`input`,{className:`cg-input`,value:t.label,disabled:!0,"aria-label":`Field name (read-only)`}),(0,B.jsx)(`span`,{className:`cg-field-hint`,children:`A source field keeps its name and type from the data source.`})]}),h&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`cg-type-block`,children:[(0,B.jsx)(`span`,{className:`cg-type-title`,children:`Field type`}),(0,B.jsx)(vUe,{value:Je,onPick:e=>Ye(e),offerMeasure:!1,only:bUe})]}),Je===`rating`&&(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Number of stars`}),(0,B.jsx)(`input`,{className:`cg-input cg-rating-max`,type:`number`,min:2,max:10,value:et,"aria-label":`Number of stars`,onChange:e=>{let t=Math.round(Number(e.target.value));tt(Number.isFinite(t)?Math.max(2,Math.min(10,t)):5)}})]}),G7(Je)&&(0,B.jsx)(X7,{idPrefix:`cg-edit-option`,drafts:Xe,onDrafts:Ze,colorCode:Qe,onColorCode:$e,type:Je}),Je!==t.type&&(0,B.jsxs)(`div`,{className:`cg-field-hint`,children:[`Changes `,t.label,` into a `,wf[Je].toLowerCase(),` field, keeping its name and its values as entered. Cells that cannot be read in the new type show blank.`]})]}),Lt&&(0,B.jsxs)(`label`,{className:`cg-edit-period`,children:[(0,B.jsx)(`span`,{children:`Period`}),(0,B.jsx)(`span`,{className:`cg-measure-window`,children:(0,B.jsx)(Bp,{window:Re??t.measure.window,onWindow:ze})}),(0,B.jsx)(`span`,{className:`cg-field-hint`,children:`The window this number is computed over, for every customer.`})]}),!h&&t.type===`formula`&&_&&(0,B.jsx)(Q7,{kind:`formula`,fields:n,formulaText:nt,onFormulaText:I,formulaError:jt.ok?null:jt.error??null,maxValue:et,onMaxValue:tt,idPrefix:`cg-edit`,showFormulaHelp:!1}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Rt,onClick:zt,children:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>P(`menu`),children:`Back`})]}),!r&&Bt.length>0&&(0,B.jsxs)(`div`,{className:`cg-edit-swap`,children:[(0,B.jsx)(`span`,{className:`cg-type-title`,children:`Change field`}),(0,B.jsx)(`div`,{className:`cg-field-hint`,children:`Show a different field in this column — the current one is hidden, not lost.`}),(0,B.jsxs)(`div`,{className:`cg-column-swap`,children:[(0,B.jsx)(kp,{className:`cg-swap-select`,ariaLabel:`Change this column to another field`,placeholder:`Choose a field…`,overlayAutofocus:!g,value:Ee||void 0,onChange:De,fields:[...Vt.map(e=>({key:e.key,label:e.label,type:e.type,group:`Pre-set fields`})),...Ht.map(e=>({key:e.key,label:e.label,type:e.type,group:`Your fields`})),...W7.map(e=>({key:yUe+e.value,label:e.label,type:e.value,group:`New field`}))]}),!rt&&(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!Ee,onClick:()=>{p(Ee),l()},children:`Change`})]}),rt&&(0,B.jsxs)(`div`,{className:`cg-column-create cg-swap-create`,children:[(0,B.jsxs)(`label`,{children:[(0,B.jsxs)(`span`,{children:[`New `,wf[rt].toLowerCase(),` field`]}),(0,B.jsx)(`input`,{className:`cg-input`,autoFocus:!0,value:Oe,placeholder:`Field name`,onChange:e=>ke(e.target.value),onKeyDown:e=>e.key===`Enter`&&Ct()})]}),(0,B.jsx)(Q7,{kind:rt,fields:n,formulaText:Pe,onFormulaText:Fe,formulaError:pt.ok?null:pt.error??null,maxValue:Ie,onMaxValue:Le,idPrefix:`cg-swap`}),G7(rt)&&(0,B.jsx)(X7,{idPrefix:`cg-swap-option`,drafts:Ae,onDrafts:je,colorCode:Me,onColorCode:Ne,type:rt}),rt===`user`&&(0,B.jsx)(`div`,{className:`cg-field-hint`,children:N.length?`${N.length} people can be assigned.`:`No user list was supplied by the host yet.`}),y&&(0,B.jsx)(SUe,{value:We,onValue:Ge}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:!St,onClick:Ct,children:`Create and change`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>De(``),children:`Cancel`})]})]})]})]})]});if(ne===`note`)return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit description for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:`Edit field description`,sub:t.label,onClose:l}),(0,B.jsxs)(`div`,{className:`cg-column-create`,children:[t.description&&(0,B.jsxs)(`div`,{className:`cg-field-hint cg-desc-default`,children:[`Default description: `,t.description]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Your description`}),(0,B.jsx)(`textarea`,{className:`cg-input`,"data-overlay-autofocus":!0,autoFocus:!0,rows:4,value:re,placeholder:t.description?`Write your own to replace the default…`:`Explain how this field should be used…`,onChange:e=>F(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:re===(t.note??``),onClick:()=>{u(re),l()},children:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>P(`menu`),children:`Back`})]})]})]});if(ne===`permissions`)return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Edit permissions for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:`Edit field permissions`,sub:t.label,onClose:l}),(0,B.jsxs)(`div`,{className:`cg-column-create`,children:[(0,B.jsxs)(`div`,{className:`cg-field-hint`,children:[`Who can edit this field's values`,t.createdBy?` (created by ${t.createdBy})`:``,`.`]}),[[`everyone`,`Everyone`],[`creator`,`Only the creator`],[`admins`,`Only admins`]].map(([e,t])=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-perm`,"data-overlay-autofocus":e===`everyone`||void 0,checked:Be===e,onChange:()=>Ve(e)}),(0,B.jsx)(`span`,{children:t})]},e)),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:Be===(t.permissions?.edit??`everyone`),onClick:()=>{E?.(Be),l()},children:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>P(`menu`),children:`Back`})]})]})]});if(ne===`format`&&Gt)return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Format ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:`Field format`,sub:t.label,onClose:l}),(0,B.jsxs)(`div`,{className:`cg-column-create`,children:[Gt===`number`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:He.thousands!==!1,onChange:e=>Ue(t=>({...t,thousands:e.target.checked}))}),(0,B.jsx)(`span`,{children:`Thousands separator (12,345)`})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Decimal places`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:Number.isInteger(He.decimals)?String(He.decimals):``,"aria-label":`Decimal places`,onChange:e=>Ue(t=>{let n={...t};return e.target.value===``?delete n.decimals:n.decimals=Number(e.target.value),n}),children:[(0,B.jsx)(`option`,{value:``,children:`As entered`}),[0,1,2,3,4].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:He.abbrev===!0,onChange:e=>Ue(t=>({...t,abbrev:e.target.checked}))}),(0,B.jsx)(`span`,{children:`Abbreviate large numbers (34.0M)`})]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`checkbox`,"data-overlay-autofocus":!0,checked:He.time??t.type===`created_time`,onChange:e=>Ue(t=>({...t,time:e.target.checked}))}),(0,B.jsx)(`span`,{children:`Include the time of day`})]}),(0,B.jsxs)(`label`,{children:[(0,B.jsx)(`span`,{children:`Time zone`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:He.tz===`utc`?`utc`:`local`,"aria-label":`Time zone`,onChange:e=>Ue(t=>({...t,tz:e.target.value})),children:[(0,B.jsx)(`option`,{value:`local`,children:`Your local time`}),(0,B.jsx)(`option`,{value:`utc`,children:`UTC`})]})]})]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,disabled:JSON.stringify(He)===JSON.stringify(t.format??{}),onClick:()=>{D?.(He),l()},children:`Save`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,onClick:()=>P(`menu`),children:`Back`})]})]})]});let Kt=!!E&&!!i&&(i.isAdmin||t.createdBy!=null&&t.createdBy===i.name);return(0,B.jsxs)(Cp,{anchor:e.anchor,className:`cg-column-menu`,onDismiss:l,role:`dialog`,ariaLabel:`Column settings for ${t.label}`,initialFocus:`[data-overlay-autofocus]`,dataKind:`column-menu`,children:[(0,B.jsx)(Z7,{title:t.label,sub:Wt,onClose:l}),Lt&&(0,B.jsxs)(`button`,{type:`button`,className:`cg-column-periodline`,onClick:()=>{qe(t.label),P(`edit`)},children:[(0,B.jsx)(`span`,{className:`cg-swap-label`,children:`Period`}),(0,B.jsx)(`span`,{className:`cg-column-periodval`,children:xd(t.measure.window)})]}),(0,B.jsxs)(`div`,{className:`cg-column-actions`,children:[(0,B.jsx)(`button`,{type:`button`,"data-overlay-autofocus":!0,onClick:()=>{qe(t.label),P(`edit`)},children:(0,B.jsx)(Dp,{icon:`rename`,text:`Edit field`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),T&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{T(),l()},children:(0,B.jsx)(Dp,{icon:`duplicate`,text:`Duplicate field`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>ae(`left`),children:(0,B.jsx)(Dp,{icon:`insertLeft`,text:`Insert field left`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>ae(`right`),children:(0,B.jsx)(Dp,{icon:`insertRight`,text:`Insert field right`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>ae(`end`),children:(0,B.jsx)(Dp,{icon:`addEnd`,text:`Add field at end`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>P(`note`),children:(0,B.jsx)(Dp,{icon:`description`,text:`Edit field description`})}),Kt&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>P(`permissions`),children:(0,B.jsx)(Dp,{icon:`permissions`,text:`Edit field permissions`})}),Gt&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>P(`format`),children:(0,B.jsx)(Dp,{icon:`format`,text:`Field format`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{O(`asc`),l()},children:(0,B.jsx)(Dp,{icon:`sortAsc`,text:`Sort ${Fd(t.type,`asc`)}`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{O(`desc`),l()},children:(0,B.jsx)(Dp,{icon:`sortDesc`,text:`Sort ${Fd(t.type,`desc`)}`})}),a!=null&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{k(),l()},children:(0,B.jsx)(Dp,{icon:`off`,text:`Don't sort by this field`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(t.filterable!==!1||t.measure!=null&&te.length>0)&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{A(),l()},children:(0,B.jsx)(Dp,{icon:`filter`,text:`Filter by this field`})}),o&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{j(),l()},children:(0,B.jsx)(Dp,{icon:`off`,text:`Don't filter by this field`})}),c&&!s&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{M(),l()},children:(0,B.jsx)(Dp,{icon:`group`,text:`Group by this field`})}),s&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{ee(),l()},children:(0,B.jsx)(Dp,{icon:`off`,text:`Don't group by this field`})}),x&&!b&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{x(),l()},children:(0,B.jsx)(Dp,{icon:`pin`,text:`Pin up to this field`})}),S&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{S(),l()},children:(0,B.jsx)(Dp,{icon:`unpin`,text:`Unpin all fields`})}),(0,B.jsx)(`div`,{className:`cg-menu-sep`,role:`separator`,"aria-hidden":!0}),(0,B.jsx)(`button`,{type:`button`,disabled:r,title:r?`The primary field stays visible`:void 0,onClick:d,children:(0,B.jsx)(Dp,{icon:`hide`,text:`Hide field`})}),w&&(0,B.jsx)(`button`,{type:`button`,className:`is-danger`,title:t.measure?`Removes this formula column from the workspace.`:`Removes this field AND its values on every row.`,onClick:()=>oe?w():se(!0),children:(0,B.jsx)(Dp,{icon:`trash`,text:oe?`Delete permanently?`:`Delete field`})})]})]})}var wUe=[`bar`,`line`,`area`,`donut`,`kpi`],$7=[`sum`,`avg`,`count`,`min`,`max`],TUe=[`brand`,`categorical`,`sequential`,`diverging`],EUe=[`auto`,`number`,`currency`,`percent`,`compact`],e9=[1,12],t9=[120,800],DUe=[`bar`,`line`,`area`];function n9(e){return!!e&&e.startsWith(`measure_`)}function r9(e){return!!e.bucket&&n9(e.y)&&DUe.includes(e.kind)}function OUe(e){let t=String(e??``);return/^\d{4}-\d{2}/.test(t)?t.slice(0,7):null}function kUe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return!Number.isFinite(t)||!Number.isFinite(n)?e:new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`short`,year:`numeric`,timeZone:`UTC`})}function i9(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function a9(e,t,n){if(e===`count`)return n;if(t.length===0)return 0;switch(e){case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.reduce((e,t)=>e+t,0)/t.length;case`min`:return Math.min(...t);case`max`:return Math.max(...t)}}function AUe(e,t,n){return e===`count`?n:t.length===0?null:a9(e,t,n)}function o9(e,t,n){let r={buckets:[],omitted:0,omittedValue:0,blanks:0,missingY:0,rows:t.length},i=e.y?n.get(e.y):void 0;if(e.y&&!i)return{...r,problem:`The field this chart measured no longer exists.`};if(i&&e.agg!==`count`&&!Nd(i.type))return{...r,problem:`${i.label} is not a number, so it cannot be ${e.agg===`avg`?`averaged`:e.agg+`med`}.`};if(e.agg!==`count`&&!i)return{...r,problem:`Choose a number field to measure, or switch to Count.`};if(e.kind===`kpi`){let n=[],a=0;for(let e of t){if(!i)continue;let t=i9(e[i.key]);t==null?a+=1:n.push(t)}return{...r,missingY:a,buckets:[{key:``,label:``,value:a9(e.agg,n,t.length),n:t.length}]}}let a=e.x?n.get(e.x):void 0;if(!e.x)return{...r,problem:`Choose a field to group by.`};if(!a)return{...r,problem:`The field this chart grouped by no longer exists.`};let o=Pd(a.type),s=new Map,c=0,l=0;for(let e of t){let t=e[a.key],n,r;if(o){let e=OUe(t);e==null?(c+=1,n=``,r=`(no date)`):(n=e,r=kUe(e))}else{let e=String(t??``).trim();e===``?(c+=1,n=``,r=`(blank)`):(n=e,r=e)}let u=s.get(n);if(u||(u={label:r,vals:[],n:0},s.set(n,u)),u.n+=1,i){let t=i9(e[i.key]);t==null?l+=1:u.vals.push(t)}}let u=[...s.entries()].map(([t,n])=>({key:t,label:n.label,value:a9(e.agg,n.vals,n.n),n:n.n}));o?u.sort((e,t)=>e.key===``?1:t.key===``?-1:e.key.localeCompare(t.key)):u.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label));let d=u.filter(e=>e.value<0),f=u.filter(e=>e.value===0).length,p=d.reduce((e,t)=>e+t.value,0),m=0,h=0;if(u.length>12){let e=u.slice(0,12),t=u.slice(12);m=t.length,h=t.reduce((e,t)=>e+t.value,0),u=e}return{...r,buckets:u,omitted:m,omittedValue:h,blanks:c,missingY:l,negativeBuckets:d.length,negativeValue:p,zeroBuckets:f}}function jUe(e,t,n){let r=o9({...e,splitBy:void 0},t,n),i={points:[],xOrder:[],seriesOrder:[],omitted:r.omitted,omittedValue:r.omittedValue,omittedSeries:0,omittedSeriesValue:0,nonPositive:0,nonPositiveValue:0,blanks:r.blanks,missingY:r.missingY,rows:r.rows,problem:r.problem};if(r.problem)return i;if(e.kind===`donut`){let e=r.buckets.filter(e=>e.value>0),t=r.negativeBuckets??r.buckets.filter(e=>e.value<0).length,n=t+(r.zeroBuckets??r.buckets.filter(e=>e.value===0).length),a=r.negativeValue??r.buckets.filter(e=>e.value<0).reduce((e,t)=>e+t.value,0);return t>0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut cannot represent negative values without misrepresenting the whole. Use a bar or line chart for signed values.`}:r.buckets.length>0&&e.length===0?{...i,nonPositive:n,nonPositiveValue:a,problem:`A donut needs at least one positive value. Zero-value groups cannot be drawn as slices.`}:{...i,points:e.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:e.map(e=>e.key),nonPositive:n,nonPositiveValue:a}}if(!e.splitBy||e.kind===`kpi`)return{...i,points:r.buckets.map(e=>({...e,seriesKey:``,seriesLabel:``})),xOrder:r.buckets.map(e=>e.key)};let a=n.get(e.splitBy),o=e.x?n.get(e.x):void 0;if(!a)return{...i,problem:`The field this chart split into series no longer exists.`};if(!o)return{...i,problem:`The field this chart grouped by no longer exists.`};let s=e=>Pd(o.type)?OUe(e[o.key])??``:String(e[o.key]??``).trim(),c=e=>String(e[a.key]??``).trim(),l=new Set(r.buckets.map(e=>e.key)),u=new Map;for(let e of t){if(!l.has(s(e)))continue;let t=c(e),n=u.get(t);n?n.push(e):u.set(t,[e])}let d=[...u.entries()].map(([t,r])=>{let i=o9({...e,splitBy:void 0},r,n);return{key:t,label:t||`(blank)`,data:i,weight:i.buckets.reduce((e,t)=>e+Math.abs(t.value),0)}});d.sort((e,t)=>t.weight-e.weight||e.label.localeCompare(t.label));let f=d.slice(0,12),p=Math.max(0,d.length-f.length),m=d.slice(12).reduce((e,t)=>e+t.weight,0),h=r.buckets.map(e=>e.key),g=new Map(r.buckets.map(e=>[e.key,e.label])),_=[];for(let e of f){let t=new Map(e.data.buckets.map(e=>[e.key,e]));for(let n of h){let r=t.get(n);_.push({key:n,label:g.get(n)??n,value:r?.value??0,n:r?.n??0,seriesKey:e.key,seriesLabel:e.label})}}return{...i,points:_,xOrder:h,seriesOrder:f.map(e=>e.key),omittedSeries:p,omittedSeriesValue:m}}function MUe(e,t){return{id:e,kind:`bar`,x:t.find(e=>e.type===`status`||e.type===`select`)?.key,agg:`count`,size:{w:6,h:280}}}function NUe(e){return e.filter(e=>e.type===`status`||e.type===`select`||e.type===`text`||Pd(e.type))}function PUe(e){return e.filter(e=>Nd(e.type))}function FUe(e,t,n,r){return!n||n===`auto`?t?pp(t,e):r(e):n===`compact`?r(e):n===`number`?e.toLocaleString(void 0,{maximumFractionDigits:2}):n===`percent`?`${e.toLocaleString(void 0,{maximumFractionDigits:2})}%`:e.toLocaleString(void 0,{style:`currency`,currency:`USD`,maximumFractionDigits:0})}function IUe(e,[t,n]){return Math.max(t,Math.min(n,e))}function LUe(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,r=typeof e.id==`string`&&e.id?e.id:``,i=e.kind,a=e.agg;if(!r||!wUe.includes(i)||!$7.includes(a))continue;let o={id:r,kind:i,agg:a};if(typeof e.x==`string`&&e.x&&(o.x=e.x),typeof e.y==`string`&&e.y&&(o.y=e.y),typeof e.title==`string`&&e.title&&(o.title=e.title.slice(0,60)),typeof e.splitBy==`string`&&e.splitBy&&e.splitBy!==o.x&&(o.splitBy=e.splitBy),o.splitBy&&(i===`bar`||i===`area`)&&e.stacked===!0&&(o.stacked=!0),TUe.includes(e.palette)&&(o.palette=e.palette),e.axis&&typeof e.axis==`object`&&!Array.isArray(e.axis)){let t=e.axis,n={};for(let e of[`x`,`y`]){let r=t[e];if(!r||typeof r!=`object`||Array.isArray(r))continue;let i=r,a={};typeof i.label==`string`&&i.label.trim()&&(a.label=i.label.trim().slice(0,40)),EUe.includes(i.format)&&(a.format=i.format),(a.label!==void 0||a.format!==void 0)&&(n[e]=a)}(n.x||n.y)&&(o.axis=n)}if(e.size&&typeof e.size==`object`&&!Array.isArray(e.size)){let t=e.size,n={};typeof t.w==`number`&&Number.isFinite(t.w)&&(n.w=IUe(Math.round(t.w),e9)),typeof t.h==`number`&&Number.isFinite(t.h)&&(n.h=IUe(Math.round(t.h),t9)),(n.w!==void 0||n.h!==void 0)&&(o.size=n)}if(typeof e.bucket==`string`&&Od.includes(e.bucket)&&n9(o.y)&&(o.bucket=e.bucket,e.span&&typeof e.span==`object`&&!Array.isArray(e.span))){let t=e.span.lastN;if(typeof t==`number`&&Number.isFinite(t)){let e=Math.round(t);e>=1&&e<=120&&(o.span={lastN:e})}}if(t.push(o),t.length>=12)break}return t.length?t:void 0}var RUe={sum:`Total`,avg:`Average`,count:`Count`,min:`Lowest`,max:`Highest`},s9=50;function zUe({mode:e,onMode:t,locked:n=!1,dateField:r,dateChoices:i,stackField:a,stackChoices:o,colorField:s,colorChoices:c,sizeField:l,sizeChoices:u,onPickField:d,clamped:f=!0,onClamp:p,calendarMode:m=`records`,onCalendarMode:h,calendarMetrics:g=[],metricChoices:_=[],onCalendarMetrics:v}){return(0,B.jsxs)(`span`,{className:`cg-modes`,children:[n?(0,B.jsxs)(`span`,{className:`cg-modes-locked`,title:`This view is locked as ${xf[e]}. Filters, sorts and columns are still editable — its creator or an admin can unlock it from the view menu.`,children:[(0,B.jsx)(Tp,{mode:e}),(0,B.jsxs)(`span`,{children:[`View · `,xf[e]]}),(0,B.jsx)(ere,{})]}):(0,B.jsx)(zp,{label:`View · ${xf[e]}`,icon:(0,B.jsx)(Tp,{mode:e}),active:e!==`grid`,children:n=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`View as`}),Sf.map(r=>(0,B.jsxs)(`label`,{className:`cg-radio-row`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-viewmode`,checked:e===r,onChange:()=>{t(r),n()}}),(0,B.jsx)(Tp,{mode:r}),(0,B.jsx)(`span`,{children:xf[r]})]},r))]})}),e===`calendar`&&i.length>0&&(0,B.jsx)(kp,{className:`cg-mode-field`,ariaLabel:`Calendar date field`,value:r?.key,onChange:e=>d(`dateField`,e),fields:i.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&o.length>0&&(0,B.jsx)(kp,{className:`cg-mode-field`,ariaLabel:`Kanban stack field`,value:a?.key,onChange:e=>d(`stackField`,e),fields:o.map(e=>({key:e.key,label:e.label,type:e.type}))}),e===`kanban`&&p&&(0,B.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-mode-field`+(f?` is-on`:``),"aria-pressed":f,onClick:()=>p(!f&&void 0),title:f?`Cards are trimmed to a standard height. Click to let them grow to their content.`:`Cards grow to their content. Click to trim them to a standard height.`,children:f?`Short cards`:`Full cards`}),e===`calendar`&&h&&(0,B.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-mode-field`+(m===`summary`?` is-on`:``),"aria-pressed":m===`summary`,onClick:()=>h(m===`summary`?`records`:`summary`),title:m===`summary`?`Each day shows totals. Click to list the records instead.`:`Each day lists its records. Click to show totals instead.`,children:m===`summary`?`Summaries`:`Records`}),e===`calendar`&&m===`summary`&&v&&(0,B.jsx)(zp,{label:`Totals · ${g.length+1}`,icon:(0,B.jsx)(Tp,{mode:`chart`}),active:g.length>0,children:()=>(0,B.jsxs)(`div`,{className:`cg-pop-body`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Totals per day`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[`Records is always counted — every other figure in the cell is computed over it. Up to `,4,` more.`]}),_.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:`This table has no numeric fields to total.`}),_.map(e=>{let t=g.find(t=>t.field===e.key),n=g.length>=4;return(0,B.jsxs)(`div`,{className:`cg-cal-pick`,children:[(0,B.jsxs)(`label`,{className:`cg-check-row`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!t,disabled:!t&&n,onChange:()=>{v(t?g.filter(t=>t.field!==e.key):[...g,{id:`cm_${e.key}`,field:e.key,agg:`sum`}])}}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.label})]}),t&&(0,B.jsx)(`select`,{className:`cg-select`,value:t.agg,"aria-label":`How to total ${e.label}`,onChange:t=>v(g.map(n=>n.field===e.key?{...n,agg:t.target.value}:n)),children:$7.filter(e=>e!==`count`).map(e=>(0,B.jsx)(`option`,{value:e,children:RUe[e]},e))})]},e.key)})]})}),e===`map`&&c.length>0&&(0,B.jsx)(kp,{className:`cg-mode-field`,ariaLabel:`Colour pins by`,placeholder:`Colour: none`,value:s?.key??``,onChange:e=>d(`colorField`,e),fields:[{key:``,label:`No colour`,type:void 0},...c.map(e=>({key:e.key,label:`Colour: ${e.label}`,type:e.type}))]}),e===`map`&&u.length>0&&(0,B.jsx)(kp,{className:`cg-mode-field`,ariaLabel:`Size pins by`,placeholder:`Size: none`,value:l?.key??``,onChange:e=>d(`sizeField`,e),fields:[{key:``,label:`No size`,type:void 0},...u.map(e=>({key:e.key,label:`Size: ${e.label}`,type:e.type}))]})]})}var BUe=(0,L.memo)(function({rows:e,fieldByKey:t,visibleKeys:n,titleKey:r,onOpen:i,onToggleGroup:a}){let o=n.filter(e=>e!==r);return(0,B.jsxs)(`div`,{className:`cg-listview`,children:[e.map((e,n)=>{if(e.kind===`group-footer`)return null;if(e.kind===`group-header`)return(0,B.jsxs)(`button`,{type:`button`,className:`cg-lv-group`,onClick:()=>a(e.groupKey),"aria-expanded":!e.collapsed,children:[(0,B.jsx)(`span`,{className:`cg-lv-chev`,children:e.collapsed?`▶`:`▼`}),(0,B.jsx)(`span`,{className:`cg-lv-group-label`,children:e.label}),(0,B.jsx)(`span`,{className:`cg-lv-count`,children:e.count.toLocaleString()})]},`g:${e.groupKey}:${n}`);let s=e.record;return(0,B.jsxs)(`button`,{type:`button`,className:`cg-lv-row`,onClick:()=>i(s.pid),children:[(0,B.jsx)(`span`,{className:`cg-lv-title`,children:String(s[r]??``)}),(0,B.jsx)(`span`,{className:`cg-lv-cells`,children:o.map(e=>{let n=t.get(e);if(!n)return null;let r=pp(n,s[e]);return r?(0,B.jsxs)(`span`,{className:`cg-lv-cell`,children:[(0,B.jsx)(`span`,{className:`cg-lv-k`,children:n.label}),(0,B.jsx)(`span`,{className:`cg-lv-v`,children:r})]},e):null})})]},`r:${s.pid}:${n}`)}),e.length===0&&(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`No records match this view.`})]})});function VUe(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7));return new Date(Date.UTC(n,r-1+t,1)).toISOString().slice(0,7)}function HUe(e){let t=Number(e.slice(0,4)),n=Number(e.slice(5,7));return new Date(Date.UTC(t,n-1,1)).toLocaleDateString(void 0,{month:`long`,year:`numeric`,timeZone:`UTC`})}var UUe=(0,L.memo)(function({rows:e,field:t,today:n,titleKey:r,mode:i=`records`,metrics:a,fieldByKey:o,onOpen:s}){let c=(0,L.useMemo)(()=>e.map(e=>({pid:e.pid,title:String(e[r]??``),day:String(e[t.key]??``).slice(0,10),row:e})),[e,t.key,r]),l=(0,L.useMemo)(()=>c.filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e.day)),[c]),u=c.length-l.length,d=(0,L.useMemo)(()=>{if(n&&/^\d{4}-\d{2}/.test(n))return n.slice(0,7);let e=l.map(e=>e.day.slice(0,7)).sort();return e.length?e[e.length-1]:null},[n,l]),[f,p]=(0,L.useState)(d),m=f??d,h=(0,L.useMemo)(()=>{let e=new Map;if(!m)return e;for(let t of l){if(!t.day.startsWith(m))continue;let n=e.get(t.day)??[];n.push({pid:t.pid,title:t.title,row:t.row}),e.set(t.day,n)}return e},[l,m]),g=(0,L.useMemo)(()=>{let e=[{id:`__count__`,label:`Records`,agg:`count`}];for(let t of a??[]){let n=o?.get(t.field);n&&$7.includes(t.agg)&&e.push({id:t.id,label:n.label,field:n,agg:t.agg})}return e},[a,o]);if(!m)return(0,B.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No dates to place on a calendar yet.`,u>0&&` ${u.toLocaleString()} record${u===1?``:`s`} carry no date.`]});let _=Number(m.slice(0,4)),v=Number(m.slice(5,7)),y=new Date(Date.UTC(_,v,0)).getUTCDate(),b=(new Date(Date.UTC(_,v-1,1)).getUTCDay()+6)%7,x=[...Array.from({length:b},()=>null),...Array.from({length:y},(e,t)=>t+1)];for(;x.length%7!=0;)x.push(null);let S=[...h.values()].reduce((e,t)=>e+t.length,0);return(0,B.jsxs)(`div`,{className:`cg-calview`,children:[(0,B.jsxs)(`div`,{className:`cg-cal-bar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Previous month`,onClick:()=>p(VUe(m,-1)),children:`‹`}),(0,B.jsx)(`span`,{className:`cg-cal-title`,children:HUe(m)}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-cal-nav`,"aria-label":`Next month`,onClick:()=>p(VUe(m,1)),children:`›`}),(0,B.jsx)(`span`,{className:`cg-cal-note`,children:i===`summary`?`Totals over ${S.toLocaleString()} record${S===1?``:`s`} placed this month · by ${t.label}`:`${S.toLocaleString()} in this month · by ${t.label}`}),u>0&&(0,B.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${u.toLocaleString()} matching record${u===1?``:`s`} have no ${t.label} and are not on the calendar. They remain in the Grid and List views.`,children:[u.toLocaleString(),` without a date`]})]}),(0,B.jsxs)(`div`,{className:`cg-cal-grid`,children:[[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`].map(e=>(0,B.jsx)(`div`,{className:`cg-cal-dow`,children:e},e)),x.map((e,t)=>{let r=e?`${m}-${String(e).padStart(2,`0`)}`:``,a=e?h.get(r)??[]:[];return(0,B.jsxs)(`div`,{className:`cg-cal-cell`+(e?``:` is-blank`)+(r===n?` is-today`:``),children:[e&&(0,B.jsx)(`div`,{className:`cg-cal-day`,children:e}),i===`summary`?e&&a.length>0&&g.map(e=>{let t=[];if(e.field)for(let n of a){let r=i9(n.row[e.field.key]);r!=null&&t.push(r)}let n=AUe(e.agg,t,a.length);return(0,B.jsxs)(`div`,{className:`cg-cal-metric`,children:[(0,B.jsx)(`span`,{className:`cg-cal-metric-k`,children:e.label}),(0,B.jsx)(`span`,{className:`cg-cal-metric-v`,children:n==null?`—`:n.toLocaleString(void 0,{maximumFractionDigits:2})})]},e.id)}):a.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-cal-chip`,title:e.title,onClick:()=>s(e.pid),children:e.title},e.pid))]},t)})]})]})}),WUe=(0,L.memo)(function({rows:e,field:t,fieldByKey:n,cardKeys:r,titleKey:i,canMove:a,readOnlyReason:o,clamped:s=!0,onMove:c,onOpen:l}){let[u,d]=(0,L.useState)(new Set),f=(0,L.useMemo)(()=>{let n=t.type===`select`?[...Ed(t)]:[],r=new Map(n.map(e=>[e,[]])),i=[];for(let a of e){let e=String(a[t.key]??``).trim();if(e===``){i.push(a);continue}let o=r.get(e);o||(o=[],r.set(e,o),n.push(e)),o.push(a)}let o=n.map(e=>({key:e,label:e,rows:r.get(e)}));return(i.length||a)&&o.push({key:``,label:`(empty)`,rows:i}),o},[e,t,a]),p=e=>t=>{t.preventDefault();let n=Number(t.dataTransfer.getData(`text/plain`));Number.isFinite(n)&&n>0&&c(n,e)},m=(0,L.useRef)(!1);return(0,B.jsxs)(`div`,{className:`cg-kbview`+(s?` is-clamped`:``),children:[o&&(0,B.jsx)(`div`,{className:`cg-kb-note`,children:o}),(0,B.jsx)(`div`,{className:`cg-kb-lanes`,children:f.map(e=>{let o=u.has(e.key),s=o?e.rows:e.rows.slice(0,s9),c=e.key?op(t,e.key):void 0;return(0,B.jsxs)(`div`,{className:`cg-kb-lane`,onDragOver:a?e=>e.preventDefault():void 0,onDrop:a?p(e.key):void 0,children:[(0,B.jsxs)(`div`,{className:`cg-kb-head`,children:[(0,B.jsx)(`span`,{className:`cg-kb-pill`,style:c?{background:c.bg,color:c.fg}:void 0,children:e.label}),(0,B.jsx)(`span`,{className:`cg-kb-count`,children:e.rows.length.toLocaleString()})]}),(0,B.jsxs)(`div`,{className:`cg-kb-cards`,children:[s.map(e=>(0,B.jsxs)(`div`,{className:`cg-kb-card`+(a?` is-draggable`:``),draggable:a,role:`button`,tabIndex:0,"aria-label":`Open ${String(e[i]??`record`)}`,onClick:()=>{m.current||l(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.pid))},onDragStart:a?t=>{m.current=!0,t.dataTransfer.setData(`text/plain`,String(e.pid))}:void 0,onDragEnd:a?()=>{window.setTimeout(()=>{m.current=!1},0)}:void 0,children:[(0,B.jsx)(`span`,{className:`cg-kb-title`,children:String(e[i]??``)}),r.map(t=>{let r=n.get(t);if(!r)return null;let i=pp(r,e[t]);return i?(0,B.jsxs)(`div`,{className:`cg-kb-cell`,children:[(0,B.jsx)(`span`,{className:`cg-lv-k`,children:r.label}),(0,B.jsx)(`span`,{className:`cg-lv-v`,children:i})]},t):null})]},e.pid)),e.rows.length>s9&&!o&&(0,B.jsxs)(`button`,{type:`button`,className:`cg-link-btn cg-kb-more`,onClick:()=>d(t=>new Set(t).add(e.key)),children:[`Showing first `,s9,` — show all`,` `,e.rows.length.toLocaleString()]})]})]},e.key||`(empty)`)})})]})}),GUe=(0,L.lazy)(()=>Ec(()=>Promise.resolve().then(()=>(bHe(),vHe)),void 0,import.meta.url)),c9=6;function l9(e,[t,n]){return Math.max(t,Math.min(n,e))}var KUe={brand:`Brand`,categorical:`Distinct categories`,sequential:`Low to high`,diverging:`Below / above a midpoint`},qUe={auto:`Automatic`,number:`Plain number`,currency:`Currency`,percent:`Percent`,compact:`Compact (1.2k)`};function u9(e,t,n){let r={...e.axis?.[t]??{},...n};r.label?.trim()||delete r.label,r.format===`auto`&&delete r.format;let i={...e.axis??{}};return r.label===void 0&&r.format===void 0?delete i[t]:i[t]=r,{...e,axis:i.x||i.y?i:void 0}}var JUe={bar:`Bar`,line:`Line`,area:`Area`,donut:`Donut`,kpi:`Single number`},YUe={sum:`Sum of`,avg:`Average of`,count:`Count of records`,min:`Smallest`,max:`Largest`},XUe={week:`Weekly`,month:`Monthly`,quarter:`Quarterly`,year:`Yearly`},ZUe=[6,12,24,36];function QUe(e){return`${e.bucket}|${e.span?.lastN??12}`}function d9(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function $Ue({spec:e,data:t,fields:n,yField:r,onChange:i,onRemove:a,canPeriod:o}){let[s,c]=(0,L.useState)(!1),l=(0,L.useMemo)(()=>NUe(n),[n]),u=(0,L.useMemo)(()=>PUe(n),[n]),d=r9(e)?XUe[e.bucket]:void 0,f=d?`Period`:e.x?n.find(t=>t.key===e.x)?.label:void 0,p=d?`, ${d.toLowerCase()}`:f?` by ${f}`:``,m=e.agg===`count`?`Count of records${p}`:`${YUe[e.agg]} ${r?.label??`…`}${p}`,h=(0,L.useMemo)(()=>ym({spec:e,model:t,xTitle:e.axis?.x?.label??f,yTitle:e.axis?.y?.label??(e.agg===`count`?`Records`:r?.label),formatValue:t=>FUe(t,r,e.axis?.y?.format,d9)}),[t,e,f,r]);return(0,B.jsxs)(`div`,{className:`cg-ch-card`,style:{gridColumn:`span ${e.size?.w??c9}`,height:e.size?.h?`${e.size.h}px`:void 0},children:[(0,B.jsxs)(`div`,{className:`cg-ch-head`,children:[(0,B.jsx)(`span`,{className:`cg-ch-title`,title:e.title||m,children:e.title||m}),(0,B.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-cfg`,"aria-label":`Configure this chart`,"aria-expanded":s,onClick:()=>c(e=>!e),children:(0,B.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M3 4.5h10M3 8h10M3 11.5h10`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})}),(0,B.jsx)(`button`,{type:`button`,className:`cg-icon-btn cg-ch-del`,"aria-label":`Remove this chart`,onClick:a,children:(0,B.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`})})})]}),s&&(0,B.jsxs)(`div`,{className:`cg-ch-cfgbody`,children:[(0,B.jsxs)(`div`,{className:`cg-ch-row cg-ch-kindrow`,role:`radiogroup`,"aria-label":`Chart type`,children:[(0,B.jsx)(`span`,{children:`Chart`}),(0,B.jsx)(`div`,{className:`cg-ch-kinds`,children:wUe.map(t=>(0,B.jsxs)(`label`,{className:`cg-ch-kind`+(e.kind===t?` is-on`:``),title:JUe[t],children:[(0,B.jsx)(`input`,{type:`radio`,name:`cg-ch-kind-${e.id}`,checked:e.kind===t,onChange:()=>i({...e,kind:t})}),(0,B.jsx)(Yne,{kind:t}),(0,B.jsx)(`span`,{children:JUe[t]})]},t))})]}),(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Show`}),(0,B.jsx)(`select`,{className:`cg-select`,value:e.agg,onChange:t=>i({...e,agg:t.target.value}),children:$7.map(e=>(0,B.jsx)(`option`,{value:e,children:YUe[e]},e))})]}),e.agg!==`count`&&(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Which number`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:e.y??``,onChange:t=>i({...e,y:t.target.value||void 0,...n9(t.target.value)?{}:{bucket:void 0,span:void 0}}),children:[(0,B.jsx)(`option`,{value:``,children:`Choose a number…`}),u.map(e=>(0,B.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),o&&n9(e.y)&&DUe.includes(e.kind)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Over time`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:e.bucket??``,onChange:t=>i({...e,bucket:t.target.value||void 0,span:t.target.value?e.span:void 0}),children:[(0,B.jsx)(`option`,{value:``,children:`No — group by a field`}),Od.map(e=>(0,B.jsx)(`option`,{value:e,children:XUe[e]},e))]})]}),!!e.bucket&&(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`How far back`}),(0,B.jsx)(`select`,{className:`cg-select`,value:String(e.span?.lastN??12),onChange:t=>i({...e,span:{lastN:Number(t.target.value)}}),children:ZUe.map(e=>(0,B.jsxs)(`option`,{value:e,children:[`Last `,e]},e))})]})]}),e.kind!==`kpi`&&!(o&&e.bucket)&&(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Grouped by`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:e.x??``,onChange:t=>i({...e,x:t.target.value||void 0}),children:[(0,B.jsx)(`option`,{value:``,children:`Choose a field…`}),l.map(e=>(0,B.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Title`}),(0,B.jsx)(`input`,{className:`cg-input`,value:e.title??``,placeholder:m,maxLength:60,onChange:t=>i({...e,title:t.target.value||void 0})})]}),e.kind!==`kpi`&&e.kind!==`donut`&&!(o&&e.bucket)&&(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Break down by`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:e.splitBy??``,onChange:t=>i({...e,splitBy:t.target.value||void 0,stacked:t.target.value?e.stacked:void 0}),children:[(0,B.jsx)(`option`,{value:``,children:`Don't break it down`}),l.filter(t=>t.key!==e.x).map(e=>(0,B.jsx)(`option`,{value:e.key,children:e.label},e.key))]})]}),!!e.splitBy&&(e.kind===`bar`||e.kind===`area`)&&(0,B.jsxs)(`label`,{className:`cg-ch-row cg-ch-check`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.stacked===!0,onChange:t=>i({...e,stacked:t.target.checked||void 0})}),(0,B.jsx)(`span`,{children:`Stack them on top of each other`})]}),(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Colours`}),(0,B.jsxs)(`select`,{className:`cg-select`,value:e.palette??``,onChange:t=>i({...e,palette:t.target.value||void 0}),children:[(0,B.jsx)(`option`,{value:``,children:`Default`}),TUe.map(e=>(0,B.jsx)(`option`,{value:e,children:KUe[e]},e))]})]}),e.kind!==`kpi`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Bottom axis label`}),(0,B.jsx)(`input`,{className:`cg-input`,value:e.axis?.x?.label??``,placeholder:f??`Category`,maxLength:40,onChange:t=>i(u9(e,`x`,{label:t.target.value}))})]}),(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Side axis label`}),(0,B.jsx)(`input`,{className:`cg-input`,value:e.axis?.y?.label??``,placeholder:r?.label??`Value`,maxLength:40,onChange:t=>i(u9(e,`y`,{label:t.target.value}))})]})]}),(0,B.jsxs)(`label`,{className:`cg-ch-row`,children:[(0,B.jsx)(`span`,{children:`Number format`}),(0,B.jsx)(`select`,{className:`cg-select`,value:e.axis?.y?.format??`auto`,onChange:t=>i(u9(e,`y`,{format:t.target.value})),children:EUe.map(e=>(0,B.jsx)(`option`,{value:e,children:qUe[e]},e))})]})]}),t.problem?(0,B.jsx)(`div`,{className:`cg-ch-empty`,children:t.problem}):t.points.length===0?(0,B.jsx)(`div`,{className:`cg-ch-empty`,children:`No records match this view, so there is nothing to chart.`}):(0,B.jsx)(`div`,{className:`cg-ch-viz cg-ch-viz--${e.kind}`,children:(0,B.jsx)(L.Suspense,{fallback:(0,B.jsx)(`div`,{className:`cg-ch-loading`,children:`Loading chart…`}),children:(0,B.jsx)(GUe,{spec:h,label:e.title||m})})}),(0,B.jsxs)(`div`,{className:`cg-ch-foot`,children:[(0,B.jsxs)(`span`,{children:[t.rows.toLocaleString(),` records`]}),t.omitted>0&&(0,B.jsxs)(`span`,{title:`The ${t.omitted.toLocaleString()} smallest groups are not drawn. Together they account for ${d9(t.omittedValue)}.`,children:[`· top `,12,` of `,(t.xOrder.length+t.omitted).toLocaleString(),` groups shown (+`,d9(t.omittedValue),` not drawn)`]}),t.omittedSeries>0&&(0,B.jsxs)(`span`,{title:`${t.omittedSeries.toLocaleString()} smaller series are not drawn. Together they account for ${d9(t.omittedSeriesValue)}.`,children:[`· `,t.omittedSeries.toLocaleString(),` series not drawn`]}),t.nonPositive>0&&(0,B.jsxs)(`span`,{title:`Donut slices require positive values. These groups have a combined value of ${d9(t.nonPositiveValue)} and are not included in the circle.`,children:[`· `,t.nonPositive.toLocaleString(),` zero/negative group`,t.nonPositive===1?``:`s`,` not drawn`]}),t.blanks>0&&(0,B.jsxs)(`span`,{children:[`· `,t.blanks.toLocaleString(),` with no value grouped as blank`]}),t.missingY>0&&(0,B.jsxs)(`span`,{title:`These records carry no number for the measured field, so they are counted in the group but excluded from the aggregate.`,children:[`· `,t.missingY.toLocaleString(),` not measurable`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-ch-resize`,"aria-label":`Resize ${e.title||m}`,title:`Drag to resize · arrow keys also work`,onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.parentElement,r=n?.parentElement;if(!n||!r)return;let a=t.clientX,o=t.clientY,s=e.size?.w??c9,c=e.size?.h??n.getBoundingClientRect().height,l=Math.max(1,r.getBoundingClientRect().width/12),u=t=>{let n=l9(Math.round(s+(t.clientX-a)/l),e9),r=l9(Math.round(c+(t.clientY-o)),t9);i({...e,size:{w:n,h:r}})},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d)},onKeyDown:t=>{let n=t.key===`ArrowRight`?1:t.key===`ArrowLeft`?-1:0,r=t.key===`ArrowDown`?20:t.key===`ArrowUp`?-20:0;!n&&!r||(t.preventDefault(),i({...e,size:{w:l9((e.size?.w??c9)+n,e9),h:l9((e.size?.h??260)+r,t9)}}))},children:(0,B.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,"aria-hidden":!0,children:(0,B.jsx)(`path`,{d:`M9 3.5L3.5 9M9 7L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})})})]})}function eWe({rows:e,fields:t,fieldByKey:n,charts:r,onCharts:i,scope:a}){let o=(0,L.useMemo)(()=>r.map(t=>jUe(t,e,n)),[r,e,n]),s=(0,L.useMemo)(()=>e.map(e=>Number(e.pid)).filter(Number.isFinite),[e]),c=(0,L.useMemo)(()=>r.filter(r9),[r]),l=(0,L.useMemo)(()=>{let e=new Map;for(let t of c){let n=QUe(t),r=e.get(n)??{bucket:t.bucket,lastN:t.span?.lastN??12,fields:[]};t.y&&!r.fields.includes(t.y)&&r.fields.push(t.y),e.set(n,r)}return e},[c]),u=(0,L.useMemo)(()=>JSON.stringify([...l.entries()].map(([e,t])=>[e,[...t.fields].sort()])),[l]),[d,f]=(0,L.useState)({}),[p,m]=(0,L.useState)(!1),h=(0,L.useRef)(0);(0,L.useEffect)(()=>{if(!a||!l.size||!s.length){f({}),m(!1);return}let e=++h.current;m(!0),Promise.all([...l.entries()].map(([e,t])=>$u(lm({pids:s,bucket:t.bucket,span:{lastN:t.lastN},fields:t.fields}),a).then(({payload:t})=>[e,t]))).then(t=>{e===h.current&&(f(Object.fromEntries(t)),m(!1))})},[a,u,s,l]);let g=(e,t)=>{if(!r9(e))return t;if(!a)return{...t,points:[],problem:`This chart is a trend over periods, but the host has not said which surface this view is, so it cannot be loaded.`};let n=d[QUe(e)];if(!n)return{...t,points:[],problem:p?`Loading the periods…`:`The periods could not be loaded, so nothing is drawn rather than a guess.`};let r=dm(n),i=r.rows.find(t=>t.field===e.y);return i?gm(i,r.columns):{...t,points:[],problem:`The server returned no series for this metric — a composite metric has no single aggregate to bucket.`}};return(0,B.jsxs)(`div`,{className:`cg-dashview`,children:[(0,B.jsxs)(`div`,{className:`cg-dash-bar`,children:[(0,B.jsxs)(`span`,{className:`cg-cal-note`,children:[e.length.toLocaleString(),` records · every chart describes exactly this view's rows, so filters and cohort scope already apply`]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-dash-add`,disabled:r.length>=12,title:r.length>=12?`A view holds at most 12 charts.`:void 0,onClick:()=>{let e=`ch_${Math.random().toString(36).slice(2,10)}`;i([...r,MUe(e,t)])},children:`+ Add chart`})]}),r.length===0?(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`No charts on this view yet. "+ Add chart" builds one from the records this view already matches.`}):(0,B.jsx)(`div`,{className:`cg-dash-grid`,children:r.map((e,s)=>(0,B.jsx)($Ue,{spec:e,data:g(e,o[s]),fields:t,yField:e.y?n.get(e.y):void 0,canPeriod:!!a,onChange:t=>i(r.map(n=>n.id===e.id?t:n)),onRemove:()=>i(r.filter(t=>t.id!==e.id))},e.id))})]})}var tWe=`M465.85,1189.44l3.99,2.28 0.83,2.79 11.82,12.37 1.25,5.21 -0.42,1.67 0.93,0.27 1.84,-1.87 5.28,-3.59 2.67,-0.04 1.27,-2.84 0.01,-4 1.34,0.06 0.8,-0.54 0.35,-1.18 -0.85,-1.61 4.41,-1.31 5.21,-2.94 2.45,2.22 2.39,2.61 -0.23,3.08 1.45,3.42 5.72,4.51 1.64,4.13 5.42,4.24 4.77,6.42 -0.24,1.6 3.44,5.6 10.1,18.69 -1.2,2.5 3.48,1.11 -0.82,3.54 2.71,1.33 -0.23,1.05 0.6,1.19 0.1,1.96 2.84,-0.18 5.6,4 3.88,1.31 1.05,1.58 1.96,0.68 0.73,2.21 2.26,0.81 1.33,-0.54 0.85,1.93 0.1,1.3 -1.51,6 1.25,7.15 -1.54,3.21 -0.48,2.21 -4.11,5.07 -3.12,-0.75 -2.23,-7.37 0.7,-1.29 2.69,-1.48 -1.23,-0.74 -0.71,-7.66 -2.38,-4.54 -0.15,-0.76 1.23,-1.85 -8.55,4.31 -0.48,0.83 0.26,1.4 -1.61,4.28 -0.44,0.38 -1.54,-0.7 -1.19,-3.05 0.18,-0.65 2.3,-3.58 1.84,-4.69 3.33,-0.95 -3.83,-0.71 -1.53,-2.84 -1.82,-0.84 -1.4,-2.04 -0.6,-2.19 -1.34,-0.49 -0.13,-2.42 -1.73,-0.63 -1.85,-2.05 -0.42,-1.36 0.16,-2 -1.01,0.18 -6.28,-2.61 0.33,-3.47 -1.17,-4.59 -1.25,-1.87 0.52,-1.12 0.56,-0.01 4.97,2.74 -4.53,-4.44 -0.22,-1.24 0.27,-1.01 3.6,0.06 -4.15,-1.01 -1.11,1.79 -0.74,-0.07 -3.52,-4.89 -0.36,-2.99 0.2,-1.69 1.92,-4.97 -0.76,0.43 -2.14,4.75 -0.88,1.01 -3.15,-2.91 -2.02,-0.38 -1.28,-1.5 -1.9,-4.2 -0.49,-2.61 -1.66,-1.7 -0.97,-5.16 -1.29,-3.6 -0.38,-4.03 -0.56,2.26 -0.81,0.22 0.96,2.24 -1.17,0.12 1.33,2.55 0.59,3.93 3.09,12.43 0.14,0.74 -0.46,1.32 -2.41,-0.22 -1.68,-2.6 -1.39,-0.78 -3.7,0.25 0.41,-3.85 -2.1,-4.64 0.03,-0.71 2.47,-1.68 -2.17,0.53 -1.51,-3.85 -0.11,2.24 0.41,1.18 -0.01,1.62 -1.16,1.19 -2.56,-1.78 -1.31,-2.08 -4.81,-2.07 0.47,2.2 -1.27,1.35 2.05,-0.17 3.02,1.59 0.91,1.51 1.41,0.87 -0.84,1.82 2.95,0.33 1.85,3.26 0.07,1.49 -0.29,0.43 -4.34,0.79 -1.65,1.82 -10.66,-7.33 -0.23,-0.97 -3.4,-3.5 -1.86,-3.43 -3.7,-3.22 -2.37,-0.93 0.52,-0.82 -4.21,-1.58 -10.4,-6.91 2.13,-1.44 1.12,-1.97 -0.78,-3.4 0.14,-1.45 0.65,-0.94 0.74,-0.07 1.32,1.81 0.51,6.01 0.75,-4.72 2.64,-0.34 -2.89,-1.31 -2.15,-2.71 -1,-0.11 -4.52,4.8 -3.41,1.78 -2.32,0.36 -4.81,-0.86 -6.43,-3.48 1.34,-2.31 -0.45,-1.79 -0.9,-0.8 -0.01,1.72 -0.42,0.52 -2.54,1.13 -10,-2.64 -4.51,-0.25 -9.78,1.91 -3.89,-0.08 -0.16,-0.67 0.87,-0.39 -0.05,-0.48 -1.1,-1.52 -5.21,-1.69 -2.94,-2.54 0.88,-4.58 1.52,-3.14 -6.34,6.69 -7.41,-2.26 2.55,-4.01 -5.39,-0.22 -0.38,-1.72 -0.78,-0.33 -2.87,1.12 -0.77,-0.66 2.03,-1.91 -2.8,-2.01 0.03,-2.24 0.42,-1.43 3.57,-1.39 -3.39,-0.36 -3.31,2.89 -1.21,0.64 -2.44,-0.45 -1.9,1.93 -2.34,-1.88 -1,2 -1.73,0.56 -0.95,-0.1 -1.14,-1.37 0.23,-1.66 2.49,-4.71 -3.38,3.22 -3.33,0.52 -0.78,1.15 2.29,-0.43 -1.54,4.13 -2.41,0.62 -0.01,0.56 3.42,2.97 -0.55,2.13 -2.33,0.42 -1.48,1.76 5.92,-1.99 0.78,0.19 0.99,1.9 -0.93,1.31 -1.55,0.81 -0.39,1.61 0.21,3.56 -1.54,1.05 -1.11,3.02 -3.64,0.94 -2.89,-0.73 -1.33,-1.22 -1.65,0.81 -1.47,-2.45 -0.42,2.38 -1.33,2.43 -0.55,2.8 -1.32,-3.38 -0.92,1.45 0.14,2.39 -2.54,-0.77 0.44,2.13 -2.63,2.78 -1.59,-0.34 -1.68,1.04 -1.39,-0.63 -0.17,1.88 -0.62,1.18 -2,1.9 -0.93,2.06 -2.82,-1.15 0.13,1.42 -2.22,-0.19 -4.23,1.27 -2.41,-1.7 0.2,-1.73 0.94,-1.42 5.12,-2.47 2.39,-2.72 1.63,-3.03 -0.49,-0.4 -4.11,3.14 -3.57,-1.12 -0.6,-0.47 -0.41,-1.38 1.35,-4.68 3.85,-6.53 0.95,-4.42 -0.48,-4.48 -0.02,-1.47 0.39,-0.46 10.02,-6.56 1.05,0.02 2.69,2.1 5.47,-0.44 6.34,1.76 -0.77,-1.38 -5.12,-1.37 -5.24,-4.17 1.79,-1.43 1.81,-3.12 4.64,-3.19 -1.19,-0.08 -2.98,0.72 -1.46,1.36 -1.73,3.18 -5.64,0.46 -1.09,-1.11 -4.3,2.57 -2.33,2.65 -5.05,2.5 -1.6,1.61 -0.57,1.81 0.39,1.83 -2.8,1.69 -3.12,3.57 -0.39,1.74 0.51,1 -1.24,1.68 -3.24,2.25 -4.22,-1.31 4.09,3.9 0.4,0.95 -0.34,1.97 -1.13,1.74 -5.14,1.77 2.12,1.1 -0.27,1.44 -0.52,0.48 -3.07,1.11 -0.03,-1.58 -0.54,-0.23 -2.71,2.1 -0.21,0.27 0.7,0.45 -1.63,2.36 -3.82,3.28 0.23,0.6 -1.26,4.02 0.56,0.79 5.38,1.8 2.71,1.74 1.04,1.67 -1.26,2.84 -2.04,2.2 -2.79,1.46 -1.79,2.07 -0.75,2.76 -2.32,1.33 0.93,0.34 -0.45,2.79 -3.68,0.9 -0.16,1.34 -4.8,0.85 -1.6,2.88 -5.04,3.16 -0.06,0.7 -2.08,2.82 -2.53,0.49 -0.42,0.39 -0.2,1.67 -2.13,-0.03 -2.2,1.88 -0.49,0.68 0.92,1.84 -0.03,0.75 -0.85,2.09 -1.33,0.84 -0.42,1.15 -1.72,0.09 -4.08,3.74 -3.43,0.75 -1.57,3.23 -3.31,-0.22 -2.38,1.92 1.69,0.65 -5.51,1.75 -1.57,2.53 1.89,0.23 1.25,2.15 -2.28,2.47 -0.53,0.06 -0.22,-1.92 -0.56,-0.37 -1.29,2.89 -0.97,1.14 -8.34,3.59 -0.5,2.32 -1.05,1.4 -0.22,-4.01 -1.05,-0.34 -6.85,4.17 -1.44,1.97 -1.43,-0.31 -1.65,1.39 -1.44,-0.61 -3.2,2.5 -3.25,0.13 -0.15,-1.65 0.72,-1.43 2.41,-0.15 -1.77,-1.38 -1.81,-0.13 -1.57,1.11 -0.99,3.46 -3.78,5.03 -1.06,-0.09 -1.22,1.4 -1.28,0.42 -0.81,-0.51 0.52,-0.58 -0.94,-2.02 -0.54,-0.68 -1,-0.08 0.13,4.14 -0.63,0.83 -2.17,0.84 -1.49,-1.83 -1.41,-0.36 0.22,1.81 -0.35,1.13 -2.32,1.53 0.64,-5.6 1.87,-1.44 2.37,-0.03 8.52,-10.52 5.23,-3.8 5.48,-2.32 0.43,0.14 -0.5,0.76 0.34,0.47 3.34,-0.8 0.24,0.47 -0.28,0.59 -1.21,0.6 0.04,0.5 2.3,2.69 0.65,-0.35 -0.14,-1.68 0.59,-0.32 2,0.14 1.06,0.95 1.66,0.23 0.24,-0.55 -0.43,-0.65 -1.95,-1.44 -0.68,-1.44 2.7,-6.29 5.88,-5.09 5.71,-2.63 4.16,-4.02 0.26,1.37 2.5,0.44 0.16,-5.09 3.87,-5.43 2.13,-1.44 3.28,-3.42 1.23,-0.43 2.3,1.38 0.83,-0.49 -1.24,-0.73 -1.43,-2.94 0.86,-4.61 0.12,-3.34 0.63,-1.92 4.11,-1.17 -3.35,-1.28 -0.4,-3.64 0.71,-1.77 2.65,-3.01 2.89,-2.09 -0.75,-0.8 2.63,-7.98 -1.75,3.22 -2.04,2.45 -11.93,5.78 -1.27,-0.6 -2.28,-4.57 0.88,-3.29 3.92,0.48 -3.89,-2.48 -1.04,0.38 -1.87,3.17 -1.49,-0.99 0.39,1.58 -0.98,4.03 1.02,4.34 -0.19,1.73 -1.85,0.79 -1.5,-1.42 -4.22,-7.06 -2.46,-2.6 -2.85,2.01 -2.64,-1.9 -2.4,-3.2 -5.16,3.96 -4.89,1.58 -0.93,1.23 -0.37,1.62 -4.49,1.26 -4.43,-0.7 3.28,-1.6 1.51,-1.69 -0.64,-2.27 -0.1,-2.63 1.65,-2.06 -1.71,0 -1.1,0.74 -1.02,-1.55 -0.49,-3.06 1.72,-3.22 0.5,-3.6 -3.52,-8.85 -1.19,-4.52 -2.03,-2.42 3.21,-7.62 2.19,-1.64 -2.18,-0.02 -3.76,6.73 -2.46,2.89 1.56,0.87 0.23,0.73 0.31,1.66 -0.8,3.12 -1.85,-0.09 -1.65,1.61 -3.88,1.75 -7.83,0.88 -2.68,-2.04 0.13,-2.21 -3.86,-3.54 -2.18,-3.54 -1.57,-0.08 -2.97,-2.42 0.4,-2.03 -3.73,-0.94 3.84,-4.61 1.33,-3.11 1.07,-0.44 5.54,2.82 0.6,1.08 -1.21,3.09 4.24,-4.05 1.19,0.49 1.88,3.6 2.29,-1.73 1.22,-2.16 -2.3,-1.51 -3.22,-0.74 3.63,-1.15 -1.84,-1.56 -2.79,2.46 -5.09,-0.13 -3.55,-1.43 -4.11,-0.04 -0.69,-0.77 3.49,-3.43 -2.37,0.41 -0.69,-0.84 0.11,-1.47 -0.86,0.93 -1.61,-1.06 1.15,-1.68 -0.34,-0.14 -0.68,0.21 -0.66,1.27 0.12,2.5 -2.1,0.09 -1.43,-4.66 -1.96,-0.85 -0.48,-1.62 1.24,-2.08 -0.55,-1.07 -1.32,-0.35 -1.51,1.05 -0.67,-0.94 -0.17,-2.5 4.08,-1.09 -2.4,-1.25 -0.67,-1.32 5.3,-1.6 -1.28,-2.17 -0.21,-1.27 0.42,-2.16 5.83,-9.12 2.22,-1.49 2.75,0.91 -0.98,-2.08 1.78,-0.67 1.12,-2.5 -2.31,2.13 -0.6,-4.41 0.52,-2.92 1.39,-2.56 3.33,-0.26 0.11,-0.59 -1.71,-1.85 1.32,-2.2 3.43,-1.18 1.87,0.37 2.36,1.37 1.36,1.7 -1.38,2.74 2.65,-2.25 2.47,1.49 3.87,-1.72 1.59,-2.31 2.12,-1.49 3.85,-6.7 1.94,-0.12 0.64,1.6 0.94,0.47 5.33,-0.39 2.72,-0.73 3.86,-4.19 1.14,-1.76 0.55,-2.31 -1.43,-5.49 -0.95,-5.74 -2.65,-3.82 -1.88,-1.14 -1.2,0.16 0.87,-2.45 2.52,0.27 2.97,-1.66 1.09,-2.73 -0.58,-3.03 -2.76,-3.48 -3.83,3.5 -3.33,-0.58 -1.24,1.97 -5.31,3.45 -3.42,4.29 -0.86,1.93 -1.09,0.09 -0.79,-3.75 -3.73,-3.6 -1.12,1.23 1.46,1.93 1.39,0.35 -1.05,2.53 -3.89,-3.33 -2.58,-1.01 -6.72,0.11 -4.42,2.02 -0.83,-0.58 -2.43,2.01 -13.25,-3.42 -2.07,-1.14 -1.78,-2.72 0.04,-1.86 0.79,-0.78 -0.08,-2.67 -1.54,-0.71 -4.29,-5.51 1.88,0.6 2.64,-0.53 0.9,-2.52 3.76,-0.36 -0.41,-0.68 -14.19,-3.72 -6.63,-4 -1.15,-2.48 1.79,-2.5 0.19,1.86 3.8,-2.14 1.99,-2.8 3.77,-0.49 3.71,-4.89 3.97,-2.6 2.1,-0.72 2.34,1.37 4.31,-0.28 0.79,-1 -3.18,-2.2 0.32,-1.23 4.12,-3.45 4.39,-0.79 6.86,-4.3 8.34,-0.8 1.02,1.19 -2.91,-0.03 1.35,1.28 -1.45,4.35 0.1,2.59 -1.59,2.02 3.85,3.71 9.2,-0.44 3.41,1.36 4.24,-0.57 3.19,0.79 1.34,-0.3 2.95,-5.54 1.16,-0.87 2.89,1.75 1.04,-0.57 0.86,1.43 -0.4,-2.99 -0.58,-1.12 -4.83,-2.06 -3.22,1.02 -1.01,-1.16 0.33,-2.31 -3.46,-5.73 -1.44,-1.17 -1.7,-0.06 -1.59,-4.59 2.8,-1.53 1.23,0.83 1.38,3.4 1.3,0.5 -0.38,3.36 1.61,3.09 3.62,2.85 4.96,-1.02 4.22,3.16 1.52,0.32 4.77,-1.34 0.05,-2.51 -0.4,-1.83 -1.12,-1.15 -3.22,0.22 -2.51,-1.89 -2.13,0.52 -3.94,2.89 -5.22,-4.26 -0.25,-2.99 2.92,-5.08 -1.11,-1.2 -2.8,-0.85 -4.84,0.87 -0.21,-2.46 -1.97,2.5 -4.77,-0.26 -6.03,-2.2 -2.15,-2.72 -2.52,-8.33 -2.08,-3.85 -14.35,-13.23 -6.52,-3.36 -3.15,-3.74 -6.26,-2.52 2.74,-2 -1.16,1.56 0.88,0.4 2.16,-1.98 2.26,-11.61 -0.31,-2.78 7.96,0.56 13.73,-2.18 4.95,-3.17 3.78,-4.26 3.76,-7.15 0.5,0.14 0.77,-7.23 1.61,-4.83 12.18,-19.13 1.37,2.5 -3.56,3.22 12.26,-4.8 4.12,-4.81 5.88,-4.94 1.75,0.79 -1.62,3.26 1.14,0.86 -1.02,3.87 2.14,0.06 0.47,1.78 0.58,-7.4 1.5,0.68 3.37,-1.62 -4.09,-0.2 -2.45,-3.55 -1.36,-0.02 4.56,-5.24 4.16,-3.17 1.4,0.65 0.1,0.96 -1.78,1.76 1.01,1.13 2.9,-1.84 4.27,0.09 1.55,-1.45 6.54,-0.67 6.65,-6.25 6.16,-9.85 3.57,-3.16 0.85,0.39 -1.96,1.96 1.11,1.78 9.38,3.85 0.75,2.17 -0.63,2.09 -1.93,2.31 -3.89,2.36 1.19,0.89 0.78,2.09 1.15,0.26 3.33,-2.07 4.7,-7.16 2.53,0.56 3.08,3.36 -1.27,3.24 6.71,3.23 3.15,-2.64 4.79,-0.48 3.01,-1.44 10.61,2.98 0.77,1.26 -2.33,2.66 -0.38,2.74 2.29,1.34 0.19,1.59 0.91,0.4 4.6,-0.12 -2,3.68 8.19,1.13 6.39,-3.1 4.43,2.57 4.59,-2.56 6.84,0.3 6.61,2.88 2.38,3.33 3.82,-1.27 3.11,1.76 1.87,2.9 7.31,1.57 3.62,-0.71 10.49,1.06 7.12,5.06 6.58,0.88 2.3,-1.89 13.63,-2.58 5.81,2.75 4.68,5.44 6.8,3.28 3.31,3.84 4.62,0.09 0,254.4 5.42,1.88 0.83,-1.86 5.46,2.67 3.37,-3.33 6.8,-0.36 0,1.48 -1.21,4.48 1.47,1.87ZM158.04,1032.11l-0.44,0.16 3.71,-3 -3.27,2.84ZM97.13,1101.66l0.17,0.62 6.53,0.56 2.3,-1.92 2.75,-0.77 3.51,2.09 1.19,3.21 4.47,1.56 0.8,1.45 9.54,1.59 -0.52,2.45 -1.03,1.07 -5.83,0.01 -2.22,2.84 -0.13,1.54 -1.2,1.02 -1.62,-4.17 -4.22,-1.87 -0.94,-2.22 -2.9,-2.41 -4.86,-1.87 -6.43,3.07 -3.09,-2.35 -0.31,-2.68 0.82,-4.44 1.13,-0.61 2.09,2.23ZM364.88,1170.44l-1.44,0.19 -0.76,-0.62 0.25,-1.68 0.73,-0.18 0.83,0.56 0.39,1.73ZM82.58,1179l2.46,1.51 1.57,-0.16 1.77,2.29 -4.59,-0.68 -4.99,-3.79 0.3,-1.74 1.41,-0.89 0.72,2.34 1.35,1.12ZM318.34,1181.2l-0.55,0.08 0.74,-1.13 0.51,-2.22 0.68,0.3 0.14,0.41 -1.52,2.56ZM367.98,1179.16l-0.36,1.18 0.34,1.07 -0.82,3 -0.96,0.84 0.12,-1.04 -0.75,0.02 -0.23,-1.6 1.11,-3.69 0.39,0.49 0.81,-1.22 0.35,0.95ZM382.36,1179.17l0.26,0.64 3.06,0.25 -5.61,3.28 -1.22,-2.92 1.62,-1.96 1.89,0.71ZM396.87,1181.77l-0.36,0.56 -1.52,-0.56 1.77,-1.48 0.3,0.3 -0.19,1.18ZM157.75,1180.7l1.04,1.14 2.31,-0.28 1.26,0.73 0.46,2.07 -0.26,3.54 0.93,0.93 0.44,2.62 -4.04,0.53 -1.74,0.91 -0.35,0.68 0.28,1 -0.48,0.26 -1.29,-1.15 -4.16,-1.13 -5.82,-3.27 -3.38,-4.52 2.1,-0.62 4.72,0.38 0.59,-1.82 3.52,-1.98 3.87,-0.02ZM367.09,1193.71l-1.25,0.33 -0.3,-0.67 1.19,-2.61 4.91,-5.51 1.77,-3.97 1.83,0.6 0.71,0.99 -4.11,4.89 -2.05,4.21 -2.7,1.74ZM363.84,1187.99l-0.59,0.7 -2.25,-0.43 0.46,-1.37 1.72,-0.87 1.89,1.35 -1.23,0.62ZM403.16,1193.6l-0.54,0.13 1.92,-3.13 2.38,-1.47 -0.15,0.75 -3.61,3.72ZM217.1,1221.18l-1.72,0.18 -0.7,-2.17 1.65,-1.49 3.09,-1.29 -2.32,4.77ZM313.05,1223.19l-1.72,-1.24 1.98,-1.67 1.08,0.16 0.07,0.88 -1.41,1.87ZM313.83,1225.9l0.42,0.18 0.73,-1.34 1.35,1.1 0.82,-0.24 0.53,1.34 1.19,0.05 -0.09,1.42 -1.44,1.8 -1.82,-1.96 -0.75,0.94 0.29,1.6 -2.6,0.71 -0.38,-1.45 -0.31,0.12 -0.96,2.14 -2.8,1.5 -5.15,-2.01 4.61,-4.53 2.33,0.4 0.03,-1.45 -0.82,-1.54 2.6,-0.64 2.22,1.86ZM515.64,1230.19l5.01,0.39 3.12,5.8 1.62,5.23 -1.16,-0.9 -2.9,-7.28 -0.8,-0.81 -0.64,0.32 0.45,3.21 3.75,6.46 0.19,1.9 -0.6,0.85 0.74,1.75 -0.19,0.67 -1.99,0.78 -1.82,3.22 -1.99,1.88 -1.36,-0.01 -0.67,-1.69 -0.07,-1.2 0.5,-0.77 1.01,-5.27 -1.97,-3.31 -1.38,-9.41 -1.44,-3.99 -0.18,-1.99 0.98,0.75 1.79,3.42ZM519.82,1228.74l-0.08,0.54 -1.55,-0.05 -2.34,-1.83 1.61,-0.9 2.36,2.24ZM503.69,1228.41l1.63,2.11 -0.32,1.92 -0.89,0.41 0.91,1 3.04,-2.85 2.09,0.61 2.37,1.73 0.3,1.35 -0.49,2.9 -1.5,0.5 -1.46,-0.47 -1.22,1 1.01,0.77 3.08,0.18 1.2,2.87 -0.66,2.29 -7.2,-3.93 -0.5,0.34 -0.11,3.61 -0.84,1.28 -2.49,-0.56 -1.89,-4.84 -4.36,-4.24 -1.24,-2.12 0.64,-2.66 1.63,-1.01 0.54,-1.64 2.03,2.6 0.01,-1.2 0.55,-0.95 1.67,-0.17 1.83,-1.35 0.64,0.52ZM308.36,1237.45l0.08,1.17 3.13,-1.71 2.13,0.5 0.11,0.92 -0.76,1.03 0.04,0.66 0.81,1.22 1.99,0.66 0.23,0.8 -2.23,2.59 -6.02,-0.91 -0.64,0.61 2.46,0.33 1.16,2.29 -2.27,0.51 -1.97,1.75 -2.53,0.24 -3.57,3.12 -1.65,0.53 0.98,0.47 0.04,1.44 -1.3,2.14 -2.45,1.74 -0.89,-0.29 -0.22,-0.67 3.16,-3.52 -2.35,-1.26 -1.18,0.6 0.77,-2.11 -2.37,-0.44 -1.56,0.97 1.61,0.2 0.62,1.71 -0.87,1.95 -0.88,-0.19 -1.82,-2.41 -0.81,-3.55 -1.55,-2.73 0.37,-2.33 1.57,-2.4 2.89,-1.67 1.88,-0.28 0.98,0.43 0.4,0.92 -0.15,0.66 0.69,0.56 1.62,3.63 1.34,1.12 -1.26,-2.91 -0.46,-4.09 1.69,-0.1 -0.04,-0.48 -2.42,-2.72 0.74,-1.54 1.66,-0.18 1.94,3 0.42,0 1.11,-1.44 1.97,0.06 0.55,-2.46 -0.65,-1.01 0.74,-0.3 3.53,1.61 -0.54,1.56ZM304.46,1236.89l-0.62,0.44 -2.56,-2.71 0.45,-0.32 1.52,0.82 1.21,1.77ZM512.34,1247.47l1.67,4.1 2.31,9.14 0.11,2.38 -0.53,1.66 0.31,4.54 -0.59,1.77 -1.42,-1.34 -1.98,-4.88 0.16,-1.6 0.95,-1.71 -1.53,0.39 -1.61,-1.35 -0.05,-2.05 -1.38,0.49 -0.52,-0.45 0.17,-2.29 1.32,-1.99 -1.61,-1.13 -0.39,-2.25 -0.91,-1.28 -0.53,0.12 -1.82,4.41 -1.71,0.5 0.51,-1.9 -0.63,-3.78 0.4,-0.78 1.85,-0.78 2.01,-3.8 1.16,0.02 4.28,3.84ZM111.95,1251l-1.18,0.99 -1.07,-0.37 -0.32,-1.02 3.08,-0.82 -0.51,1.22ZM307.12,1252.24l-1.7,0.65 -1.58,1.95 -0.9,-1.07 0.23,-1.68 0.78,-1.11 4.29,0.68 -1.12,0.58ZM530.59,1254.78l0.76,0.65 0.41,-0.68 2.19,0.64 1.33,1.96 -0.06,4.22 -0.51,1.1 -3.7,-4.28 1.96,4.54 0.14,1.71 -0.41,1.12 -4.8,0.21 -0.53,-1.09 -0.36,-5.81 -1.62,-2.64 -1.78,-1.78 0.2,-0.71 1.09,-0.53 5.69,1.37ZM523.5,1258.08l0.73,1.44 1.07,-0.11 1.05,2.71 -0.32,1.04 -1.01,0.37 -0.33,5.97 -0.74,3.36 -0.5,0.55 -0.84,-0.65 -0.63,1.13 -0.76,0.01 -0.63,-2.58 0.56,-4.31 1.27,-0.88 -2.34,-2.55 0.13,-0.77 -1.21,-2.21 0.13,-2.39 1.13,-1.65 1.49,-0.3 1.75,1.82ZM537.64,1264.7l-1.57,0.27 -0.53,-0.25 -0.19,-0.88 1.2,-4.71 2.12,2.28 1,2.25 -2.03,1.04ZM116.56,1262.44l2.33,0.14 0.87,0.71 -1.8,0.99 -1.52,-1.28 0.12,-0.56ZM293.45,1264.92l-1.41,-0.5 0.12,-0.65 1.2,-0.79 1.21,0.12 -0.07,1.22 -1.05,0.6ZM288.05,1266.55l-0.77,0.49 -0.3,-0.58 1.75,-2.5 1.2,-0.81 0.83,0.57 -2.71,2.83ZM544.86,1273.24l-0.24,3.38 -2.68,0.07 -0.59,-0.81 0.16,-1 -0.51,-0.56 -2.37,-0.45 -0.45,-2.45 1.14,-0.88 2.49,-5.29 0.72,0.24 2.84,4.99 -0.51,2.76ZM537.26,1270.42l-1.27,-0.25 -1.66,-2.16 1.54,-1.83 2.94,0.38 -0.03,2.51 -1.52,1.35ZM528.31,1268.53l4.14,0.4 1.38,2.58 -0.17,2.12 3.85,1.94 1.82,2.03 1.91,4.21 2.93,4.15 -3.85,-2.27 -1.37,2.42 2.43,-0.19 2.3,1.99 0.63,1.21 -0.53,1.97 2.3,-0.12 0.32,0.44 -0.27,3.47 0.22,4.54 -0.46,1.55 -1.91,-0.17 -1.73,-3.41 -2.37,-0.89 -0.5,-0.86 -0.33,-2.79 -0.9,0.11 0.21,1.13 -0.24,0.87 -0.89,-0.37 -1.48,-2.78 -2.34,-2.78 0.17,-0.65 1.64,-0.71 -1.4,-2.18 0.56,-1.72 -3.02,-0.34 -0.8,-1.66 -2.1,-0.04 -1.44,-1.9 1.09,-1.04 1.96,0.77 1.94,-2.48 -0.55,-1.99 -0.93,-0.35 -3.56,1.89 -0.66,-0.45 -0.15,-0.7 2.56,-2.98 -0.73,-1.45 -0.05,-2.04 0.37,-0.48ZM557.75,1285.79l-1.18,4.46 -1.2,1.2 -0.84,-0.27 -0.62,-0.97 -1.19,-0.15 -0.34,-0.8 0.33,-1.05 -0.29,-0.8 -0.85,1.35 -1.36,0.84 -1.37,2.66 -0.56,-1.14 -0.4,-3.86 2.26,-3.41 0.26,-4.97 4.05,-2.51 3.09,4.62 0.36,1.17 -0.15,3.63ZM278,1279.1l-0.44,0.64 -0.86,-0.05 -0.65,-0.77 1.64,-1.91 0.31,2.09ZM531.28,1284.7l0.27,0.92 -4.19,4.58 0.17,-2.89 -1.16,-1.67 1.17,-0.85 3.74,-0.09ZM219.76,1289.29l1.51,-1.32 -0.35,1.46 1.09,2.45 -1.38,0.52 -1.06,-0.38 -1.06,0.65 -0.35,-0.57 -0.16,-3.22 1.32,-1.39 0.59,0.5 -0.15,1.3ZM223.81,1288.83l-0.16,1.58 -1.98,-1.5 2.14,-0.08ZM536.32,1297.65l0.28,0.26 0.75,-0.89 1.76,0.67 -0.34,2.69 -0.67,1.42 -1.15,-0.49 -2.3,-2.88 -1.29,-2.28 -1.46,-4.08 -1.9,-0.7 -0.41,-1 0.28,-0.86 1.51,-0.44 2.27,2.23 1.15,2.06 0.16,1.54 1.36,2.75ZM229,1293l-4.03,4.09 0.84,-2.29 -0.21,-1.69 2.16,-1.49 0.7,-1.39 0.56,0.08 -0.31,0.84 0.67,0.78 -0.38,1.07ZM553.65,1293.97l1.22,3.49 -1.98,0.19 -0.45,-0.3 0.16,-1.72 -0.57,-0.77 -1.26,0.19 -0.03,-1.3 0.45,-0.92 -0.26,-2.22 0.75,-0.28 1.23,0.98 0.74,2.66ZM233.07,1292.54l-0.22,1.83 -1.3,-0.29 0.11,-0.99 0.47,-0.03 0.26,-1.83 0.34,-0.17 0.34,1.48ZM234.81,1296.1l-0.67,-0.11 -0.46,-1.6 0.81,0.35 0.32,1.36ZM188.01,1295.94l1.1,3.27 2.78,1.82 0.58,1.06 -3.12,-1.31 -2.56,2.17 -5.58,0.09 -1.84,0.97 -1.92,2.42 -2.13,0.86 -2.64,-0.29 -0.92,-2.46 0.18,-1.24 2.07,-1.66 2.59,-4.24 2.33,0.14 5.31,-2.96 2.27,-0.03 1.5,1.39ZM201.41,1298.58l-1.06,-0.51 -0.49,-1.16 1.93,-1.03 0.35,1.02 -0.73,1.68ZM198.49,1307.34l-0.98,0.43 -1.05,-0.45 -0.9,-0.82 -0.1,-0.98 2,0.64 1.03,1.18ZM164.28,1312.5l-0.61,-0.06 -0.45,-2.21 1.18,-0.61 0.72,1.22 0.91,0.49 -1.75,1.17ZM161.09,1313.78l-2.22,0.46 -0.79,-1.9 0.74,-0.9 1.69,-0.31 2.27,2.08 -1.69,0.57ZM152.29,1317.07l0.49,0.91 0.85,-0.58 1.42,-2.23 1.61,1.28 -2.93,2.84 -0.69,1.63 1.87,-0.38 0.86,0.44 -4.47,3.09 -0.78,1.16 -4.36,1.3 -5.4,2.83 -2.05,-1.22 7.65,-3.87 0.5,-2.1 0.87,-1.2 1.39,0.02 0.85,1.07 0.17,-0.84 0.71,-0.53 -3.75,-1.36 -0.53,-1.72 0.91,-1.34 4.15,-1.23 0.52,0.19 0.14,1.84ZM156.9,1320.49l-0.46,-0.86 1.55,-1.45 -1.09,2.31ZM136.94,1327.73l-3.49,2.04 -2.67,3.69 -6.64,3.99 3.34,-4.02 0.2,-1.97 1,-1.49 3.53,-1.07 -0.19,-2.39 1.24,-1.74 2.44,-1.09 2.79,0.94 0.27,0.44 -0.69,1.86 -1.13,0.81ZM117.28,1337.16l-0.35,1.04 -2.93,-0.26 -0.13,-0.45 1.95,-1.01 1.46,0.68ZM105.43,1342.15l-0.72,0.6 -0.34,-0.96 1.65,-1.81 1.11,0.56 -0.34,1.09 -1.36,0.52ZM60.56,1352.32l-6.1,0.76 -0.93,-0.52 11.25,-3.59 0.54,-0.99 -2.01,-0.89 3.03,-1.92 1.72,1.65 -0.42,1.59 -1.41,0.85 0.66,1.21 -6.33,1.85ZM85.73,1347.92l-1.76,-0.01 1.7,-2.14 1.78,1.09 -1.72,1.06ZM73.35,1350.45l6.03,1.06 -4.98,0.69 -4.27,-0.12 -1.78,-1.39 2.26,0.35 1.56,-0.73 1.18,0.14ZM45.27,1352.93l-0.27,0.54 -1.11,-0.58 -0.48,-0.96 0.33,-0.8 0.89,-0.01 1.16,1.32 -0.52,0.49ZM38.76,1355.43l0.06,0.62 1.71,0.24 -0.17,1.55 -0.66,-0.18 -2.96,2.12 -0.75,-0.84 -1.42,1.32 0.99,-3.43 1.57,-0.91 -0.1,-1 0.54,-1.69 1.15,0.08 0.53,0.69 -0.49,1.43ZM32.45,1358.19l-5.77,0.74 -0.17,-0.45 4.7,-1.91 1.03,-1.93 0.64,-0.35 0.54,0.49 -0.82,1.75 -0.15,1.66ZM24.13,1359.42l-0.53,0.59 -1.51,-1.01 -0.23,-0.34 0.9,-0.48 0.15,-0.86 -2.37,-2.18 0.89,-0.62 1.85,-0.04 1.76,1.44 1.76,0.25 -1.43,0.9 -1.24,2.35ZM45.41,1356.43l-0.96,0.4 -1.26,-0.81 0.12,-0.95 2.1,1.36ZM42.25,1356.81l-0.72,1.08 -0.53,-0.49 -0.2,-1.49 0.4,-0.38 1.05,1.28ZM1052.56,1684.94l-1.51,1.48 -4.36,0.45 2.45,-0.8 -0.76,-1.53 -0.76,-0.55 0.01,-1.48 -1,-1.75 -1.42,4.32 -3,-0.05 -0.99,-20.2 4.57,-41.48 -1.35,-1.27 29.35,0.32 4.81,28.06 2.12,5.82 0.47,1.57 -0.14,0.66 0.73,1.01 -1.29,1.86 -1.01,3.58 -0.01,1.39 0.79,2.73 -0.42,3.69 0.28,2.37 0.69,1.54 -29.43,0.01 -0.09,1.86 2.2,2.9 -0.24,2.16 -0.69,1.33ZM1045.94,1686.59l-2.78,0.16 2.35,-0.44 0.43,0.28ZM1027.36,1608.42l0.18,1.13 -0.85,0.45 -0.18,1.17 -1.31,0.77 -0.56,1 0.2,1.23 -0.47,1.23 -1.12,1.25 -0.48,1.39 0.17,1.55 -0.56,1.24 -1.29,0.94 -0.73,2.05 -1.09,0.66 -0.67,1.26 -0.74,0.45 -0.5,3.1 -0.59,1.24 -1.44,0.79 -0.63,1.44 -1.05,0.87 -0.35,0.83 0.29,1.1 -1.77,1.02 0.37,1 -0.17,1.01 -1.76,2.08 0.4,0.8 -0.48,0.46 0.84,1.97 -0.26,1.97 0.65,1.04 -0.49,2.74 -32.9,0.05 -0.07,-7.38 -1.64,-0.47 -1.89,0.38 -1.44,-1.19 0.51,-24.01 -2.04,-15.66 50.7,0 1,1.83 -0.01,1.06 -2.59,2.78 -0.89,1.5 7.7,-0.12ZM807.28,1672.34l-22.69,0.05 -43.17,-15.87 1.31,-2.92 1.58,-0.14 0.75,-0.51 0.44,-0.94 -0.15,-1.92 -1.79,-1.2 -0.64,-1.33 -0.17,-2.19 0.2,-1.18 1.13,-0.71 0.92,-1.88 0.14,-4.06 2.05,-3.27 2.31,-1.99 -0.37,-0.94 -2.42,-1.84 -0.31,-1.4 -2.42,-4.4 0.23,-6.19 -0.81,-2.69 0.19,-1.2 -0.47,-4.02 -0.62,-1.35 0.82,-1.52 1.86,-0.49 1.13,0.11 1.98,1.64 0.56,0.02 1.6,-2.13 0.03,-11.65 56.81,0.04 -0.01,78.07ZM743.99,1622.54l-0.01,1.16 0.61,1.57 1.81,2.83 0.31,1.4 2.8,2.36 -0.01,0.42 -3.33,3.24 -1.03,2.02 -0.14,4.06 -0.92,1.88 -1.13,0.71 -0.03,3.37 0.64,1.33 1.79,1.2 0.25,0.97 -0.54,1.89 -0.75,0.51 -2.92,0.41 -26.05,2.31 -0.1,-1.56 -0.53,-0.53 -0.68,0.33 -0.22,-3.72 -0.64,-2.19 -1.69,-2.66 -6.97,-5.82 -2.1,-0.5 -0.33,0.63 -1.33,-0.43 0.2,-1.56 -1.29,-2.19 -3.7,-0.09 -3.55,-1.21 -1.05,-0.71 -0.36,-1.29 -3.85,-2.21 -1.22,0.26 -3.87,-0.97 -4.87,-0.03 -1.86,-1.49 0.23,-3.21 -0.44,-1.91 0.34,-1.77 -0.29,-0.63 -2.26,-1.22 -0.31,-0.91 0.28,-1.26 -0.45,-0.83 -1.4,-0.78 -1.31,-1.77 -1.66,-0.97 -0.68,-1.62 -3.65,-5.09 -2.42,-2.5 -0.47,-3.41 1.46,-2.27 -0.2,-1.69 -0.83,-1.24 -3.23,-0.74 -2.62,-3.09 -0.16,-2.37 -1.03,-2.43 -0.17,-3.3 0.78,-0.37 0.7,0.13 0.16,1.91 0.83,0.92 1.49,1.3 1.09,0.33 -3.58,-6.94 0.81,-0.67 2.58,-0.61 6.39,-0.09 -1.14,-0.41 -2.9,0.13 -1.72,-0.7 -1.39,0.84 -2.72,-1.15 -1.03,0.52 -0.13,2.24 0.32,1.67 -0.62,0.17 -4.67,-3.31 -0.76,0.97 0.35,-1.57 -0.11,-1.88 1.14,1.5 -0.35,-1.06 -1.57,-1.57 -0.86,-2.09 -1.91,-1.26 -4.68,-5.42 -0.21,-2.98 -1.15,-3.78 0.48,-2.16 -0.62,-3.85 -3.14,-4.73 -2.45,-2.35 -0.37,-1.78 -0.17,-1.79 1,-3.29 0.34,-0.45 0.38,0.66 0.34,-1.13 -0.33,-0.28 0.98,-2.7 -0.08,-2.81 0.82,-3.45 -0.56,-3.61 -0.52,-1.48 -0.93,-1.05 0.41,-1.54 -0.22,-1.72 48.1,0.01 0.01,44.9 21.32,18.98 40,38.16ZM684,1635.13l2.32,0.7 1.25,-0.33 0.22,0.34 -2.96,0.82 -0.86,-0.37 -0.37,-1 0.4,-0.16ZM679.18,1635.88l-1.54,-0.11 0.84,-0.55 0.7,0.66ZM682.17,1637.34l-1.4,0.01 -0.97,-1.32 2.05,-0.17 1,0.73 -0.68,0.75ZM701.46,1644.62l0.58,1.01 -1.7,-0.07 -0.52,-1.31 -0.76,-0.26 -0.12,-0.44 2.52,1.07ZM689.06,1646.92l-1.2,-0.1 -0.36,-0.73 1.1,0.05 0.46,0.78ZM701.44,1652.2l-1.4,-0.15 -1.33,-2.33 0.37,-0.3 2.36,2.78ZM807.29,1594.27l0,-58.59 79.89,0.01 0.14,58.58 -80.03,0ZM1231.07,1520.32l0.05,7.51 -0.53,2.8 -4.81,0.66 -1.2,-0.31 -1.23,0.55 -5.07,-0.14 -1.13,1.04 -6.9,3.39 -1.05,-1.7 2.71,-1.73 -0.69,-1.16 0.73,-11.58 7.66,0.33 0.01,0.4 0.56,-0.4 10.89,0.34ZM1171.57,1567.03l-1.05,-0.8 0.91,-1 1.26,1.81 -1,1.19 -0.12,-1.2ZM1194.24,1573.35l-7.62,0 -0.88,-18.57 1.23,-1.56 1.89,-0.24 1.02,0.42 -1.9,2.58 0.16,2.42 1.83,2.88 0.23,2.77 0.93,1.85 1.43,2.15 1.1,0.61 -0.46,2.11 -0.66,0.6 1.3,0.19 0.4,1.79ZM1052.56,1684.94l0.69,-1.33 0.24,-2.16 -2.2,-2.9 0.09,-1.86 29.43,-0.01 1.4,3.72 30.08,2.05 0.52,2.28 0.93,0.29 0.94,-1.4 -0.09,-3.36 0.92,-1.09 3.23,0.98 1.93,0.11 0.53,1.2 2.36,11.15 1.65,4.41 2.33,5.31 4.27,7.32 -0.49,0.77 -0.2,2 1.46,4.79 -0.49,-0.44 -1.25,-3.13 0.03,-4.47 -0.29,0.07 -0.69,2.24 -0.44,-1.53 0.49,-1.5 -0.88,-0.7 -0.05,-1.29 -0.77,-0.33 1.02,4.88 5.95,15.1 1.56,2.72 0.54,5.42 -0.97,9.32 -0.37,-0.56 -1.61,3.28 -0.76,3.62 -1.34,1.28 -0.83,-0.04 -2.03,0.96 -1.43,-0.25 -2.83,0.48 -0.64,-1.14 0.35,-1.02 0.44,-0.12 1.5,1.2 0.29,-0.51 -0.46,-0.59 -1.51,-0.7 -2.64,-4.6 -0.22,-1.25 -2.32,-0.77 -1.67,-1.16 -1.09,-2.06 -0.63,-3.67 -1.05,-0.7 1.48,-2.5 -1.04,0.7 -0.57,1.01 -0.79,0 -0.43,-1.93 0.12,-2.39 0.61,-0.89 -1.91,0.31 0.01,1.24 -1.25,-0.4 -1.72,-2.41 -2.04,-4.37 -1.07,-1.26 0.9,-0.32 2.67,-3.99 -0.51,-0.87 -0.6,0.45 -1.56,-1.46 -0.45,0.22 0.89,1.17 -0.16,1.24 -0.57,0.75 -0.62,-0.19 -0.31,0.31 -1.15,-1.76 2.09,-8.26 0.1,-5.21 -1.34,-2.13 -5.93,-5.22 -4.6,-6.21 -3.98,-2.34 -3.02,0.52 -0.52,0.47 -0.31,1.59 -1.9,0.13 -2.85,1.64 -1.01,-0.06 -1.59,0.74 -3.3,0.53 -0.65,-0.19 -0.43,-0.95 0,-0.98 0.88,1.34 0.25,-0.24 0.09,-0.52 -0.53,-1.02 -3.67,-3.23 0.6,0.06 0.15,-0.41 -0.61,-0.54 0.68,-1.29 -1.56,0.56 -0.17,1.02 -4.77,-2.18 -3.18,-0.88 2.44,-0.39 1.32,0.31 -0.47,-0.78 -1.05,-0.38 -2.17,-0.03 -2.63,1.22 -5.94,0.84 0.89,-0.75 1.56,-0.45 0.24,-0.94 -0.37,-0.91 -0.85,0.93 -1.12,-0.51 -0.16,1.12 -1.09,1.51 -2.22,0.6 -0.28,-0.2 0.59,-1.12 -0.47,0.22ZM1081.94,1694.59l-1.15,0.48 -1.23,-0.35 1.32,0.08 3,-1.38 -1.94,1.17ZM1135.65,1725.2l0.19,0.94 -2.34,-5.62 -0.69,-2.67 2.84,7.35ZM1114.07,1734.46l-0.02,0.75 -0.95,-2.64 0.54,0.45 0.43,1.44ZM1114.6,1735.72l-0.41,0.33 -0.82,-0.25 -0.64,-1.29 0.97,1.11 0.9,0.1ZM1133.43,1752.29l-2.26,2.36 1.42,-2.45 1.15,-1.06 0.04,-0.8 1.07,-0.64 -1.42,2.59ZM1130.52,1755.29l-0.31,0.06 0.57,-0.5 -0.26,0.44ZM1125.9,1757.63l-0.52,0.29 -0.54,-0.21 2.35,-0.62 -1.29,0.54ZM1122.59,1758.46l-0.5,0.17 -0.47,-1.42 1.11,0.81 -0.14,0.44ZM1119.95,1759.09l-0.74,0.12 0.6,-0.49 0.19,-0.75 0.34,0.94 -0.39,0.18ZM1117.48,1759.78l-0.31,-0.16 0.83,-0.22 -0.52,0.38ZM1080.81,1676.68l-0.69,-1.54 -0.28,-2.37 0.42,-3.69 -0.79,-2.73 0.01,-1.39 1.01,-3.58 1.29,-1.86 -0.73,-1.01 0.14,-0.66 -0.47,-1.57 -2.12,-5.82 -4.81,-28.06 28.55,0 -2.3,2.71 -0.44,1.35 3.44,2.73 2.34,1.02 2.94,5.77 2.7,2.47 1.63,2.38 2.31,1.92 2.56,4.47 2.3,1.72 1.01,1.8 1.28,4.44 0.99,0.68 1.35,2.39 0.41,2.67 0.69,0.97 2.3,1.07 -0.58,1.14 -2.16,0.89 0.54,1.21 -1.5,1.12 0.32,1.26 -1.02,0.95 0.95,0.1 -1.36,2.14 -0.97,0.24 1.05,1.18 -0.87,1.23 -0.88,-0.37 -0.89,4.32 0.19,1.89 -1.93,-0.11 -3.23,-0.98 -0.92,1.09 0.09,3.36 -0.94,1.4 -0.93,-0.29 -0.52,-2.28 -30.08,-2.05 -1.4,-3.72ZM1121.63,1677.08l-0.5,3.23 -0.24,-2.25 0.74,-0.98ZM234.69,1792.13l-1,0.69 -1.68,-0.41 -2.06,-1.62 0.72,-1.21 1.67,-1.02 2.59,0.04 0.58,1.41 -0.82,2.12ZM225.51,1793.25l-0.23,0.54 -0.39,-0.08 0.15,-1.15 1.37,-1.45 0.59,0.13 -0.36,1.2 -1.13,0.81ZM252.59,1797.96l0.9,-0.02 0.17,0.98 0.8,0.86 -1.86,0.47 -1.17,-0.88 -0.65,0.17 -0.22,-0.63 -0.45,0.13 0.42,0.63 -1.47,-0.03 -1.47,-2.08 -0.39,-1.18 1.71,-0.18 1.17,-1.12 0.66,-0.12 1.85,3ZM259.26,1800.9l5.7,0.74 -0.4,0.63 -1.28,0.57 -1.83,-0.5 -3.06,-0.18 0.46,-1.43 0.41,0.17ZM267.53,1804.35l0.29,0.22 2.09,-0.45 3.27,2.37 -1.33,1.36 -3.43,0.49 -0.34,-0.16 -0.48,-2.23 -0.72,0.14 -0.82,-0.39 -0.93,-1.55 0.46,-0.92 0.82,-0.12 1.12,1.24ZM263.4,1806.3l-0.67,0.34 -0.74,-0.16 -0.88,-1.88 1.24,-0.22 0.7,0.31 0.81,0.9 -0.46,0.71ZM277.83,1827.6l-0.5,0.58 -0.63,-0.04 -2.28,-1.24 -0.28,-0.67 0.17,-3.09 -1.8,-4.44 2.6,-3.19 -0.82,-1.86 0.21,-1.12 0.48,-0.2 7.2,3.42 1.29,1.43 0.22,1.54 0.88,0.2 0.41,1.06 1.69,1.45 -0.52,0.85 -2.31,1.62 -2.92,0.71 -2.57,1.82 -0.52,1.17ZM1007.59,1545.01l-2.73,-2.58 -0.56,-1.09 -45.89,0.34 -1.07,-2.15 0.28,-2.17 -0.14,-2.87 -0.74,-2.5 0.32,-0.64 -0.75,-1.21 0.07,-1.42 -0.44,-0.19 -0.34,-0.98 -0.53,-0.12 -0.32,-4.19 -1.31,-3.29 -1.07,-1.48 -0.69,-1.96 -0.31,-2.42 -1.11,-1.44 -0.66,-2.28 -0.94,-1.1 1.82,-6.22 -0.32,-1.18 -0.84,-0.58 0.33,-1.49 -0.73,-2.5 60.91,-0.08 0.3,1.68 1.16,1.01 0.12,0.83 -0.62,2.74 1.04,4.88 4.34,2.76 1.12,2.55 1.19,0.95 1.58,2.59 2.03,1.76 0.18,1.82 -0.75,2.57 -0.66,0.66 -0.81,2.1 -1.02,1.09 -1.71,1 -4,1.05 -1.25,0.86 -0.38,1.34 0.18,1.13 1.16,1.86 0.12,1.01 -1.69,4 -1.29,1.51 -1.41,0.68 -0.62,1.01 0.04,2.08 -0.59,0.27ZM716.36,1406.78l11.27,0 -0.01,16.97 3.76,5.48 0.32,1.26 -0.23,0.91 0.47,0.93 -0.5,0.86 4.63,3.62 6.29,8.28 1.05,-0.18 0.42,1.12 0.7,0.45 2.57,-0.14 -1.25,7.59 -0.44,0.68 0.08,2.01 0.71,0.87 0.22,1.49 -1.43,1.24 0.3,2.11 -0.38,1.79 2.64,1.43 2.06,-1.48 1.42,-1.86 2.15,1.5 1.2,4.8 2.84,4.46 -0.15,2.01 1.39,1.54 1.19,-0.03 1.06,0.71 0.89,1.61 0.71,2.95 1.66,1.3 1.57,-1.58 3.88,0.44 0.63,-1 1.01,-0.44 8.32,0.25 0.59,-2.66 0.86,-0.56 0.78,0.37 1.63,2.67 1.24,0.91 0.01,39.03 -67.88,0.01 -0.04,-28.16 1.23,-6.11 -0.47,-0.73 -2.12,-0.72 -0.65,-0.85 -0.05,-1.47 3.93,-7.51 0.19,-1.28 3.3,-7.61 0.82,-3 -0.5,-1.32 -3.96,-3.86 -0.7,-1.6 -0.14,-2.89 -1.09,-2.71 0,-43.9ZM1007.59,1545.01l0.59,-0.27 -0.04,-2.08 0.62,-1.01 1.41,-0.68 1.29,-1.51 1.69,-4 -0.12,-1.01 -1.16,-1.86 -0.18,-1.13 0.38,-1.34 1.25,-0.86 4,-1.05 1.71,-1 1.02,-1.09 0.32,-1.18 1.62,-2.66 0.28,-1.49 -0.18,-1.82 -2.03,-1.76 -0.9,-1.7 -2.56,-2.89 41.09,0.31 -2.07,11.23 -3.42,0 -0.13,35.74 -0.89,1.23 -0.04,1.44 -0.37,0.36 1.33,3.81 0.01,2.43 -1.72,3.71 -0.62,0.26 -1.57,2.54 -0.55,-0.04 -0.67,0.7 0.25,1.52 -0.54,0.45 0.18,0.34 -0.62,1.1 0.02,1.11 -0.6,0.88 0.61,1.25 -0.99,1.28 -0.13,1.14 0.37,1.24 -0.94,1 -3.46,1.43 0.55,3.49 -0.29,0.46 -4.56,-1.39 -1.98,0.04 -1,1.15 -0.23,1.57 -1.34,-1.25 -0.32,0.96 -1.29,-1.28 -0.83,-1.58 -0.18,-1.25 0.46,-0.94 0,-0.98 -0.7,-3.02 -3.41,-3.44 -3.98,-2.67 -2.19,-2.68 -0.1,-0.81 0.66,-2.15 2.07,-5.66 -0.97,-0.75 -2.94,-0.73 -1.13,0.56 -0.98,-1.14 -0.84,-2.85 -2.07,-3.01 -5.23,-5.35 -1.4,-5.17 0.03,-1.91 0.65,-2.29ZM1046.28,1582.99l-0.61,-1.25 0.6,-0.88 -0.02,-1.11 0.62,-1.1 -0.18,-0.34 0.54,-0.45 -0.25,-1.52 0.67,-0.7 0.55,0.04 1.57,-2.54 0.62,-0.26 1.72,-3.71 0.13,-1.01 -0.14,-1.42 -1.33,-3.81 0.37,-0.36 0.04,-1.44 0.89,-1.23 0.13,-35.74 31.01,0.02 -0.29,39.88 -0.45,0.76 0.29,0.64 -0.32,0.92 0.84,0.95 -0.12,0.72 -4.2,1.88 -1.56,-0.68 -1.12,0.1 -0.45,0.69 0.23,1.26 -0.39,0.96 -1,0.67 -1.82,2.65 -0.93,0.24 -1.97,3.92 -0.68,0.43 -2.12,-0.75 -1.22,-1.84 -0.53,-0.22 -0.04,0.49 -1.05,0.36 0.1,0.49 -1.72,3.05 -3.07,-1.46 -1.14,0.55 -1.95,1.91 -2.63,-1.7 -1.67,0.03 -0.78,-0.5 -0.64,1.77 -0.81,-0.96 -1.82,-0.23 -0.35,0.2 -0.37,1.56 -1.18,0.07ZM887.32,1594.27l-0.13,-43.63 75.98,0 2.62,1.92 1.5,-0.28 0.62,0.44 0.35,1.78 -1.2,0.73 -0.81,1.39 0.2,1.31 1.2,1.21 1.99,3.42 1.77,1.02 0.05,30.69 -84.14,0ZM1033.62,1594.4l0.23,-1.57 1,-1.15 1.98,-0.04 4.56,1.39 0.29,-0.46 -0.55,-3.49 3.46,-1.43 0.94,-1 -0.37,-1.24 0.13,-1.14 1.22,-1.45 0.95,0.1 0.52,-1.72 2.02,0.19 0.81,0.96 0.64,-1.77 0.78,0.5 0.7,-0.24 3.6,1.91 1.95,-1.91 1.14,-0.55 3.07,1.46 1.72,-3.05 -0.1,-0.49 1.05,-0.36 0.04,-0.49 0.53,0.22 1.22,1.84 2.12,0.75 0.68,-0.43 1.97,-3.92 0.93,-0.24 1.82,-2.65 1,-0.67 0.39,-0.96 -0.23,-1.26 0.45,-0.69 1.12,-0.1 1.56,0.68 4.2,-1.88 0.12,-0.72 -0.84,-0.95 0.32,-0.92 -0.29,-0.64 1.08,-1.25 1.95,0.58 1.87,-0.08 1.59,1.71 0.72,1.6 1.3,0.97 3.24,0.98 1.58,1.19 1.72,-0.73 2.06,1.06 1.75,-0.17 2.31,-1.1 1.36,0.06 1.4,2.46 1.92,1.76 0.12,2.15 -0.45,1.77 2.55,4.64 1.29,2.03 2.02,1.68 1.57,0.44 -4.3,3.48 -3.85,2.27 -0.58,1.28 -1.85,2.02 -1.69,0.86 -1.21,1.19 -6.61,2.49 -31.59,-1.11 -15.15,0.3 -0.34,-0.44 -2.59,-0.26 0.42,2.74 -15.83,0 0.61,-1.25 0.76,-0.4 0.84,0.31 0.61,-0.44 0.83,-2.64 0.08,-1.42 -0.36,-1.15ZM1029.83,1601.34l-0.79,0.03 0.08,-0.73 0.35,-0.03 0.36,0.73ZM978.02,1649.7l32.9,-0.05 0.06,0.67 0.55,0.39 -0.45,2.47 0.49,0.4 -0.65,1.36 0.52,1.82 1.81,2.15 0.08,0.72 -1.56,1.97 -0.2,1.14 -0.73,1.01 -1.48,1.16 -0.98,1.48 -0.98,2.92 -0.53,0.49 -0.27,2.31 -0.33,0.77 -0.68,0.14 -0.14,0.79 0.39,1.43 -0.69,1.44 21.86,0.01 -1.14,3.58 0.18,1.58 1.53,1.97 1.07,3.15 0.8,0.4 -0.77,0.36 -4.16,-1.36 -1.03,-1.09 -2.05,-0.36 -1.22,1.34 -0.92,1.8 2.71,1.47 2.06,-0.4 1.14,-0.88 0.93,0.03 0.85,-0.63 0.79,0.36 0.03,0.36 -1.71,1.44 0.81,1.02 1.28,0.34 0.48,-0.15 0.3,-1.14 0.78,-0.74 1.07,0.16 -0.15,0.47 0.64,1.18 0.03,1.32 -2,0.63 -0.69,0.61 0.36,0.36 -1.4,0.3 -0.43,0.73 0.52,1.06 1.83,1.55 3.79,1.1 0.73,1.14 1.15,0.59 -0.07,0.78 -1,0.58 -0.52,1.06 -0.92,-0.83 -1.59,1.29 0.26,-1.15 -1.02,-1.62 -2.02,-1.41 -1.96,-0.4 -0.29,-1.08 -0.67,-0.55 -3.21,-1.03 0.2,0.75 1.01,0.63 0,1.23 -0.95,2.62 -0.87,0.41 -1.01,-1.97 -0.88,-0.51 -1.41,-0.06 -0.95,0.36 -1.04,1.58 -0.83,0.26 -6.14,-2.06 0.09,-0.42 0.51,-0.13 0.99,0.17 -1.06,-1.82 -0.06,-1.4 -0.93,0.66 -2.09,-0.54 -1.8,-2.5 -1.73,-0.06 -0.78,-1.12 -1.41,0.47 -1.35,1.32 0.87,1.08 -0.28,0.32 -2.01,0.47 -4.67,-0.53 -5.74,-2.38 -5.91,0.12 -1.5,0.58 -0.65,-1.11 0.85,-0.53 0.41,-0.83 -0.24,-0.83 0.95,-1.78 -0.45,-3.06 0.34,-2.82 1.61,-3.51 0.18,-2.4 0.37,-0.55 -0.31,-1.78 -1.23,-1.9 -0.82,-2.55 -0.78,-0.73 -0.44,-3 -2.25,-2.76 0.02,-13.67ZM1032.83,1688.8l0.04,0.61 -1.38,-0.33 1.79,-1.39 -0.45,1.11ZM1037.34,1692.43l-0.32,0.42 0.31,-2 -0.44,-1.69 0.62,1.62 -0.17,1.65ZM1036.64,1693.68l-0.62,0.68 0.81,-1.21 -0.19,0.53ZM1003.59,1696.45l-0.42,0.19 -1.88,-1.14 -0.12,-0.48 1.49,-0.4 1.38,0.97 -0.45,0.86ZM1231.07,1520.32l-10.89,-0.34 -0.56,0.4 -0.01,-0.4 -7.66,-0.33 -0.3,-0.37 2.89,-10.36 21.89,0.77 4.04,-2.62 1.91,-0.08 -0.26,0.8 0.55,1.61 0.52,0.8 1.27,-0.03 0.12,0.75 -2.48,1.09 -2.45,3.41 3.51,1.57 1.37,2.9 -0.44,0.81 1.22,0.74 0.39,2.07 1,0.7 1.49,0.44 3.35,-1.49 -1.24,-3.12 -0.71,-0.5 -0.27,0.43 -0.51,-0.86 1.51,0.2 1.49,1.79 0.5,3.83 -0.17,0.51 -5.19,0.76 -2.87,1.41 -0.11,-2.68 -0.39,-0.07 -3.11,2.53 -1.2,0.16 -1.01,0.74 -0.41,-2.31 0.64,-1.59 -0.97,0.6 -1.22,-1.4 0.04,-1.42 -0.48,-0.17 -0.09,-1.75 -4.7,0.07ZM1245.75,1530.01l-3.13,0.74 -0.5,-0.48 2.43,-1.49 1.03,0.64 0.17,0.59ZM1251.81,1531.68l-0.88,0.25 -2.03,-0.56 1.94,-0.64 0.25,-1.04 0.72,1.99ZM1171.57,1567.03l0.12,1.2 1,-1.19 -1.26,-1.81 -0.91,1 -2.03,-1.61 -2.05,-0.87 -0.29,-0.43 0.31,-1.15 -2.96,-1.96 -0.6,-1.29 0.14,-0.69 -1.05,-1.29 0.19,-0.35 -1.96,-0.47 -0.8,-0.69 -0.95,-0.11 -2.56,0.85 -1.01,1.4 -2.08,-0.24 -1.14,-1.14 -2.2,2.55 -1.18,-0.33 -2.48,2.42 -2.22,1.48 0.12,-7.54 42.02,0.01 0.88,18.57 7.62,0 -0.01,0.42 -0.41,0.88 0.01,-0.64 -0.49,0.05 -0.49,2.2 -0.75,0.18 -1.71,3.14 -2.78,0.38 -0.44,0.65 -2.18,-0.25 0.63,-1.67 -1.51,-1.19 0.73,-1.33 0.06,-1.47 -1.24,1.03 -0.21,-0.59 -0.74,0.76 -1.83,-1.19 -0.95,-1.93 0.35,-1.53 3,-0.03 -2.41,-2.28 -0.75,-0.21 -0.71,0.92 0.46,-1.59 1.51,-0.5 -0.26,-0.92 -0.57,-0.4 -1.02,0.5 0.01,-0.64 0.19,-0.83 1.45,0.27 0.57,-1.34 0.03,-0.6 -0.96,0.87 -0.21,-1.87 0.94,-1.82 0.89,-0.79 2.26,-0.1 -1.45,-0.52 1.48,-1.47 -1.1,0.09 0.13,-1.19 -1.19,0.36 -0.39,1.89 -0.5,0.44 -0.85,0.34 -0.36,-0.87 -0.33,1.71 -0.62,-1.19 -0.32,1.16 -0.53,0.31 -0.17,1.16 -1.7,-0.65 0.92,1.62 0.7,0.48 0.09,0.76 -0.6,0.64 -0.98,-0.51 0.74,1.76 -0.49,2.96 0.41,3.06 1.22,2.37 -0.51,0.11 -1.52,-1.08 -1.2,-2.56 0.1,1.08 0.3,1.21 2.66,2.7 0.86,1.85 -0.09,0.78 -1.29,-1.25 -3.58,-1.3 -1.13,-1.85 -0.24,1.43 -1.27,-2.22 -1.76,0.7 -0.87,-0.16 0.13,-1.94 2.3,-3.45 -0.13,-1.62ZM1192.1,1579.36l-0.31,0.04 1.76,-3.77 -1.45,3.73ZM1262.32,1435.74l0.58,0.98 1.98,0.55 5.14,-1.89 0.22,-0.48 1.39,-0.02 4.88,4.41 0.45,19.11 -0.4,3.25 2.35,1.74 1.86,0.29 0.09,1.18 -0.79,0.91 0.75,1.56 -0.51,1.65 1.79,1.98 0.75,-0.76 1.42,0.5 0.5,2.91 -0.38,0.72 0.08,0.95 1.06,0.28 0.31,0.64 -2.33,2.44 -1.96,-0.34 -2.19,0.83 -0.49,1.09 -0.61,0.23 -2.12,-0.22 -0.77,1.95 -0.63,-0.17 -1.07,1.28 -1.09,-1.88 -1.43,-0.08 -1.09,0.99 -0.88,-1 -0.8,2.03 -0.13,1.94 -0.9,-0.83 -2.28,-0.46 1.16,-1.64 -0.96,-0.19 0.36,-1.86 -0.96,1.37 -1.3,0.82 0.06,1.36 -1.22,2.8 -0.05,1.18 -1.8,1.76 -1.35,-0.23 -2,1.64 -0.41,-1.35 -0.38,1.52 -0.39,0.09 -0.32,-1.79 -0.53,0.62 -0.35,1.62 -0.75,-0.92 -0.14,2.18 -0.73,-0.74 -1.16,0.5 0.1,-1.06 -2.43,1.39 -1.03,1.49 0.76,0.72 -3.62,4.35 -1.38,3.35 -1.04,1 -0.9,-1.46 -0.19,-1.17 -1.03,-1.4 -0.54,-2.03 -1.33,-29.23 1.41,-0.63 0.71,1.14 0.37,-0.13 0.75,-2.17 1.25,-0.38 -0.14,-2 3.19,-3.04 0.15,-1.04 1.27,-1.7 -0.09,-2.48 0.64,-3.18 2.06,-3.13 0.68,-4.44 7.38,-10.71 1.32,-1.89 2.19,0.61 -0.04,2.22ZM1272.18,1484.11l-1.39,0.18 -0.06,1.14 -1.1,-0.71 0.02,-1.11 1.25,-1.47 0.7,0.29 0.58,1.68ZM1267.22,1486.28l-0.89,0.21 -0.02,-0.78 0.3,-0.39 0.61,0.96ZM1029.71,1423.86l2.56,-0.37 7.53,-4.16 2.65,-0.67 2.48,1.33 37.37,22.35 1.1,4.36 2.48,2.98 1.82,-0.96 2.87,-0.45 0.27,0.25 -0.29,1.37 0.71,3.59 1.26,2.33 4.12,-0.53 1.66,2.01 -1.4,2.9 11.85,7.64 4.7,28.32 -3.07,7.79 -0.91,5.18 -0.65,1.77 -3.67,3.7 -2.34,1.31 -0.41,0.76 -0.46,1.67 0.32,2.94 -3.9,3.22 -15.15,0.58 0,-0.89 -27.59,-0.02 2.07,-11.23 -1.32,-12.95 0.15,-5.2 1.24,-6.84 3.62,-12.03 2.03,-3.14 3.09,-2.99 -5.8,-3.65 -3.88,0 -1.47,2.63 -1.99,1.71 -0.46,1.87 -2.2,-0.87 -0.77,-1.95 0.65,-2.08 -2.02,0.17 -0.38,-0.4 0.91,-3.42 -0.16,-1.46 -1.29,-1.21 -2.21,-0.91 0.23,-1.02 -0.63,-1.1 -3.88,-1.11 -3.92,-0.38 -3.21,-1.85 -11.37,-3.16 -1.27,-2.78 -1.26,-0.8 -0.58,0.15 -0.23,-0.6 10.4,-23.7ZM941.79,1406.78l23.48,0.02 0.07,-6.58 2.46,0.36 0.97,0.78 0.58,5.25 1.12,3.36 0.95,1.14 6.44,1.44 2.32,0.89 0.54,1 1.09,0.41 2.78,-0.62 0.98,-0.95 4.34,0.08 5.64,3.03 0.98,2.72 0.75,0 0.57,-0.89 1.44,-0.16 1.9,0.62 1.67,1.78 3.87,2.38 1.49,-0.01 3.91,-2.3 1.45,-0.26 0.86,0.14 1.09,1.64 7.43,-0.23 1.11,1.75 1.06,0.34 4.58,-0.05 -5.23,12.01 -7.92,-0.37 -9.27,6.42 -5.65,3.25 -1.82,-0.55 -1.12,1.52 -0.77,0.17 -0.02,9.51 -4.56,2.87 -2.31,4.09 0.05,1.03 1.54,0.84 0.85,1.79 -0.81,2.52 -0.06,2.69 -0.39,0.63 0.34,2.21 -0.41,2.32 0.34,1.02 1.43,1.29 2.3,0.94 2.29,1.99 2.11,0.99 2.43,3.27 5.22,3.22 0.71,0.86 0.47,2.19 0.38,4.64 -59.26,0.02 0,-28.6 -0.86,-1.2 -1.9,-0.98 -1.76,-3.15 2.69,-2.84 0.66,-2.33 -0.05,-3.21 -0.64,-3.1 -1.29,-2.41 -0.64,-2.9 0.19,-4.51 -0.63,-1.65 -0.38,-9.56 -1.47,-3.92 -0.22,-1.79 -1.35,-4.21 -0.02,-8.71 -1.11,-5.39ZM1027.36,1608.42l-7.7,0.12 0.89,-1.5 2.59,-2.78 0.01,-1.06 -1,-1.83 -50.7,0 -0.04,-37.79 -1.77,-1.02 -1.99,-3.42 -1.2,-1.21 -0.2,-1.31 0.81,-1.39 1.2,-0.73 -0.35,-1.78 -0.62,-0.44 -1.5,0.28 -2.8,-2.05 -0.82,-1.28 -0.33,-1.52 -2.26,-2.45 -1.17,-3.58 45.89,-0.34 0.56,1.09 2.73,2.58 -0.65,2.29 -0.03,1.91 1.4,5.17 5.23,5.35 2.07,3.01 0.84,2.85 0.98,1.14 1.13,-0.56 2.94,0.73 0.97,0.75 -2.07,5.66 -0.66,2.15 0.1,0.81 2.19,2.68 3.98,2.67 3.41,3.44 0.7,3.02 0,0.98 -0.46,0.94 0.18,1.25 1.53,2.53 0.71,0.32 0.2,-0.95 1.34,1.25 0.36,1.15 -0.08,1.42 -0.83,2.64 -0.61,0.44 -0.84,-0.31 -0.76,0.4 -0.85,1.4 -0.54,-0.93 -0.35,0.03 0.11,1.78 -0.81,1.48 0.32,0.71 -1.04,0.72 0.46,0.75 -0.09,0.89 -0.71,1.45ZM1044.78,1622.43l1.01,0.92 -4.57,41.48 0.99,20.2 -3.33,0.2 -2.42,-0.79 -3.63,1.09 -1.1,-0.17 -1.4,1.61 -0.88,0.4 -0.8,-0.4 -1.07,-3.15 -1.53,-1.97 -0.18,-1.58 1.14,-3.58 -21.86,-0.01 0.69,-1.44 -0.39,-1.43 0.14,-0.79 0.68,-0.14 0.33,-0.77 0.27,-2.31 0.53,-0.49 0.98,-2.92 0.98,-1.48 1.48,-1.16 0.73,-1.01 0.2,-1.14 1.56,-1.97 -0.08,-0.72 -1.81,-2.15 -0.52,-1.82 0.63,-0.93 -0.48,-1.55 0.46,-1.75 -0.55,-0.39 -0.1,-1 0.53,-2.41 -0.65,-1.04 0.26,-1.97 -0.84,-1.97 0.48,-0.46 -0.4,-0.8 1.76,-2.08 -0.08,-2.22 1.65,-0.81 -0.29,-1.1 0.35,-0.83 1.05,-0.87 0.63,-1.44 1.44,-0.79 0.59,-1.24 0.5,-3.1 0.74,-0.45 0.67,-1.26 1.09,-0.66 0.43,-0.64 -0.13,-0.78 24.12,0.03ZM750.22,1406.78l114.11,0 0.32,66.64 -80.16,0 -0.01,8.04 -1.24,-0.91 -1.63,-2.67 -0.78,-0.37 -0.86,0.56 -0.59,2.66 -8.32,-0.25 -1.01,0.44 -0.63,1 -3.88,-0.44 -0.81,0.55 -0.5,1.06 -0.9,-0.36 -1.02,-0.97 -0.71,-2.95 -0.89,-1.61 -1.06,-0.71 -1.19,0.03 -1.39,-1.54 0.15,-2.01 -2.84,-4.46 -1.2,-4.8 -2.15,-1.5 -1.42,1.86 -2.06,1.48 -2.64,-1.43 0.38,-1.79 -0.3,-2.11 1.43,-1.24 -0.22,-1.49 -0.71,-0.87 -0.08,-2.01 0.44,-0.68 1.25,-7.59 -2.57,0.14 -0.7,-0.45 -0.42,-1.12 -1.05,0.18 -6.29,-8.28 -4.51,-3.47 0.38,-1.01 -0.47,-0.93 0.23,-0.91 -0.32,-1.26 -3.76,-5.48 0.01,-16.97 22.59,0ZM1102.34,1622.4l-13.77,0.18 0.73,-3.64 2.26,-0.5 0.66,-1.79 1.51,-1.41 4.1,-0.97 4.44,-2.66 1.49,-0.37 1.16,-2.12 0.85,0.06 1.29,-1.16 1.01,-0.25 0.66,1.08 2.94,-2.29 1.28,-0.28 0.93,0.66 0.56,-0.23 1.63,-2.59 1.98,-0.69 0.34,-2.52 0.51,-1.09 64.77,0.84 -0.14,1.73 1.28,2.28 0.53,2.18 -0.72,-0.88 -3.01,-1.46 -0.03,1.88 -1.37,-0.62 0.49,1.04 -1.78,-0.25 -1.08,1.48 -0.92,0.18 -1.36,-0.84 -0.62,-2.17 0.09,3.83 4.18,0.06 1.73,-0.54 1.56,0.3 -0.16,3.92 0.94,-0.44 0.25,-2.44 1.9,-0.84 0.76,2.67 -0.33,1.66 -3.75,3.73 -0.8,0.37 -3.59,-0.6 -0.49,-1.56 -0.51,-0.33 -0.38,0.04 -0.27,1.06 -1.22,0.31 -3.39,-1.34 0.74,0.96 4.31,1.8 0.94,0.82 -1.07,1.64 -0.24,1.11 -1.72,1.15 -0.93,-0.2 -2.38,-2.08 1.09,1.8 0.86,0.76 1.75,0.41 3.28,-0.68 1.08,0.74 -1.76,2.21 -2.17,0.34 -0.29,0.63 -4.56,-0.01 -1.85,1.45 -0.71,-0.24 -0.61,-1.53 -0.01,1.92 0.38,0.9 -4.22,3.34 -1.25,1.86 -0.77,2.88 -0.28,-3.15 -0.2,2.41 -0.49,1.12 -4.46,-0.08 -1.81,0.56 -12.39,-12.67 -12.86,-0.45 -0.1,-1.86 -1.61,-2.09 -1.26,0.66 -0.02,-0.91 -0.46,-0.34 -14.85,-0.77 -4,1.77 -4.22,1.15ZM1184.55,1600.67l0.36,0 1.13,4.54 2.55,5.77 -3.14,-6.36 -0.9,-3.95ZM1187.43,1610.47l-0.17,0.28 -0.75,-1.55 0.77,0.5 0.15,0.77ZM1188.48,1619.08l-1.67,0.26 1.75,-0.8 0.63,-4.1 -0.25,-2.76 0.53,2.87 -0.09,1.62 -0.9,2.91ZM1177.56,1627.37l-0.29,0.15 1.05,-1.72 2.61,-2.53 -3.37,4.1ZM894.67,1406.78l47.12,0 1.11,5.39 0.02,8.71 1.35,4.21 0.22,1.79 1.47,3.92 0.38,9.56 0.63,1.65 -0.19,4.51 0.64,2.9 1.5,3.32 0.43,2.19 0.05,3.21 -84.82,-0.01 -0.25,-51.35 30.34,0ZM887.19,1550.64l-0.01,-14.95 -22.72,-0.01 -0.08,-30.63 63.57,0.01 3.4,2.31 2.03,0.72 0.95,-0.68 2.08,-0.39 5.23,0.22 6.41,3.45 0.48,1.07 0.86,0.68 1.21,0.29 0.77,1.36 0.31,2.42 0.69,1.96 1.07,1.48 1.31,3.29 0.32,4.19 0.53,0.12 0.34,0.98 0.44,0.19 -0.07,1.42 0.65,0.78 -0.17,1.58 0.41,0.36 0.42,4.5 -0.28,2.17 1.98,4.18 0.26,1.55 0.62,1 0.98,0.46 0.66,0.99 0.33,1.52 1,1.41 -75.98,0ZM1234.29,1473.31l1.12,-3.11 1.04,-1.45 1.43,0.49 1.34,-0.55 1.33,29.23 0.54,2.03 1.03,1.4 0.19,1.17 0.9,1.46 -0.5,2.02 -0.33,0.99 -1.91,0.08 -4.04,2.62 -12.94,-0.43 -0.95,-2.43 0.87,-2.36 1.27,-8.57 2.81,-5.97 0.95,-5.31 2.35,-1.17 2.46,-2.23 0.46,-1.49 -0.59,-2.63 1.25,-2.19 -0.08,-1.6ZM1193.82,1550.91l3.86,-2.55 -2.74,-3.75 -0.66,-0.21 -0.72,-1.84 -1.04,-0.79 0.16,-2.69 1.13,-1.22 -0.54,-2.15 2.39,-2.36 1.14,-2.21 1.29,-0.84 8.98,5.51 -1.32,3.55 -1.83,1.63 -0.88,1.79 0.26,1.08 2.18,0.4 0.58,-0.34 0.3,0.78 0.17,1.07 -1.39,8.03 0.17,-3.04 -0.6,0.82 -0.67,3.13 -0.91,1.67 -0.85,1.15 -0.87,-0.19 0.2,0.91 -0.44,1.47 -0.52,0.66 -1.19,0.39 -2.45,4.61 -1.47,0.89 -0.35,-0.13 0.65,-2.87 -1.74,-0.96 -0.98,0.05 -2.47,-1.94 -1.95,-2.22 0.01,-1.64 1.16,-2.78 3.05,-1.2 0.9,-1.67ZM1204.53,1555.39l-1.34,2.24 1.64,-3.21 -0.3,0.97ZM807.28,1672.34l0.01,-78.07 68.79,0 0.01,7.1 -0.48,0.01 -0.27,61.94 -40.99,0.03 1.16,2.43 1.38,0.68 -20.1,-0.14 -0.03,6 -9.48,0.02ZM750.48,1594.23l-0.03,11.65 -1.6,2.13 -0.56,-0.02 -1.98,-1.64 -1.13,-0.11 -1.86,0.49 -0.82,1.52 0.62,1.35 0.47,4.02 -0.19,1.2 0.81,2.69 -0.22,5.03 -40,-38.16 -21.32,-18.98 -0.01,-44.9 67.79,-0.01 0.03,73.74ZM1140.49,1512.22l8.25,-4.08 1.11,-0.95 0.21,-1.11 -1.2,-1.28 -0.46,-1.38 0.08,-2.68 -1.28,-2.95 5.14,-2.49 21.62,-0.06 4.04,-6.77 3.18,-2.92 0.39,-0.98 3.13,-1.8 5.4,-5.68 2.53,-2.04 3.67,-1.68 17.12,-0.02 -0.23,6.54 0.71,2.2 -0.13,3.03 -1.2,3.08 0.59,4.28 -0.47,3.37 0.97,-0.58 0.95,1.16 -0.38,11.54 0.31,0.95 -2.89,10.36 0.3,0.37 -0.73,11.58 0.69,1.16 -2.71,1.73 1.05,1.7 -4.06,3.62 1.31,-4.57 -0.12,-1.75 -0.49,-0.72 -0.5,-0.48 0.59,1.73 0.09,2.16 -8.98,-5.51 -0.65,-1.01 -2.04,-0.77 -1.32,-2.04 -0.02,-2.38 -0.48,-1.02 -1.63,-0.93 -1.28,-1.62 -50.2,-0.04 0.02,-8.27ZM1223,1535.91l-0.81,0.97 0.73,0.1 3.79,-1.99 0.93,0.48 2.26,-0.69 -7.42,3.54 -7.27,2.58 -8.02,1.25 1.14,-1.06 -0.87,-0.15 -0.61,0.79 -0.98,0.26 -0.19,-0.86 1.74,-2.3 2.09,-1.18 0.49,0.49 0.11,-0.65 0.78,-0.58 10.8,-1.09 3.99,-2.43 -2.68,2.52ZM1203.9,1542.86l-0.54,0.07 0.54,-1.44 1.36,-0.52 -0.12,0.94 -1.24,0.95ZM1102.26,1521.27l1.04,1.79 3.87,2.41 2.86,0 13.21,-8.17 8.61,-1.77 0.02,25.48 -1.35,0.65 -0.24,0.6 0.62,1.77 0.03,1.21 -3.08,9.34 -0.02,1.05 -1.01,1.38 -3.41,2.72 -0.8,0.35 -1.21,-0.44 -1.9,1.74 -0.58,0.04 -1.65,2.73 0.25,2.03 -1.32,0.78 -0.61,-1.4 -0.58,-0.32 -0.81,0.71 -1.49,2.84 0.26,1.91 -2.35,2.96 -1.26,0.28 -1.41,-0.52 -2.54,-2.58 -0.41,-1.2 -1.36,-0.06 -2.31,1.1 -1.75,0.17 -2.06,-1.06 -1.72,0.73 -1.58,-1.19 -3.24,-0.98 -1.3,-0.97 -0.72,-1.6 -1.59,-1.71 -2.62,-0.05 -0.53,-0.5 -1.3,0.54 0.29,-38.99 15.15,-0.58 3.9,-3.22ZM971.45,1601.37l2.04,15.66 -0.51,24.01 -2.56,-0.7 -5.76,-3.56 -1.8,1.17 -1.71,-0.17 -0.8,-0.8 -2.16,1.1 -1.79,-0.25 -2.25,0.83 -2,1.52 -3.15,-1.89 -0.17,-0.77 -1.59,0.7 -1.15,-0.39 -0.98,-0.97 -1.48,1.33 -0.63,1.67 -0.83,-0.69 0.07,-1.17 -0.33,-0.37 -2.09,0.91 -1.96,-1.16 -0.8,-1.04 -2.29,1.59 -0.9,-0.04 -0.34,-1.27 -1.34,-0.95 -0.33,-1.44 -2.93,0.05 -1.11,0.87 -1.76,-1.14 -1.39,0.2 -4.86,-1.06 -1.09,-2.27 -1.22,-0.93 -0.51,0.88 -2.58,0.05 -2.67,-2.14 -1.51,-0.6 -0.04,-26.77 -34.1,0 -0.01,-7.1 95.38,0 -0.01,7.1ZM682.66,1520.5l-48.1,-0.01 -1.45,-1.87 -0.74,-3.97 0.16,-3.12 -1.51,-3.55 2.19,-8.24 1.7,-1.28 -1.03,0.22 1.58,-4.43 0.57,-10.16 0.59,-1.46 -0.14,-5.63 1.48,-12.9 -0.36,-4.33 0.16,-4.88 -0.48,-1.29 0.88,0.61 2.71,-0.01 1.73,-0.65 2.27,1.29 2.29,-0.57 0.89,0.31 1.14,0.74 1.13,2.24 1.33,4.97 0.87,0.75 5.09,0.59 1.33,-0.18 2.31,-1.42 2.5,-0.46 2.96,0.1 1.82,0.4 0.66,0.71 1.58,0.07 7.9,-1.4 4.74,-1.84 5.75,-1.57 2.87,-0.18 1.79,-0.91 24.16,-0.02 1.5,2.11 2.77,2.46 0.5,1.32 -0.82,3 -2.14,4.65 -1.35,4.24 -3.93,7.51 0.05,1.47 0.65,0.85 2.12,0.72 0.47,0.73 -1.23,6.11 0.04,28.16 -33.95,0ZM1131.85,1515.53l3.11,-0.64 5.53,-2.67 -0.02,8.27 50.2,0.04 1.28,1.62 1.63,0.93 0.48,1.02 0.02,2.38 0.8,1.53 2.56,1.28 0.65,1.01 -1.29,0.84 -1.14,2.21 -2.39,2.36 0.54,2.15 -1.13,1.22 -0.2,1.28 0.04,1.41 1.04,0.79 0.72,1.84 0.66,0.21 2.74,3.75 -3.28,2.04 -1.7,1.82 -2.82,1.18 -2.43,-0.36 -1.71,1.74 -53.87,-0.01 -0.02,-39.24ZM1230.59,1530.63l0.53,-2.8 -0.05,-7.51 4.7,-0.07 0.09,1.75 0.48,0.17 -0.04,1.42 1.22,1.4 -0.43,0.38 -1.35,-1.74 0.3,1.42 -0.72,1.05 -0.19,2.73 -0.9,1.14 -3.64,0.66ZM1237.43,1528.25l-1.19,0.35 0.75,-2.3 0.55,-0.52 -0.11,2.47ZM1236.02,1528.35l-0.31,0.29 0.1,-1.58 0.33,0.43 -0.12,0.86ZM1127.85,1662.96l-2.3,-1.07 -0.69,-0.97 -0.41,-2.67 -1.35,-2.39 -0.99,-0.68 -1.28,-4.44 -1.01,-1.8 -2.3,-1.72 -2.56,-4.47 -2.31,-1.92 -1.63,-2.38 -2.7,-2.47 -2.94,-5.77 -2.34,-1.02 -3.44,-2.73 0.44,-1.35 2.22,-2.7 4.3,-1.16 4,-1.77 14.85,0.77 0.46,0.34 0.02,0.91 1.26,-0.66 1.61,2.09 0.1,1.86 12.86,0.45 12.39,12.67 -4.05,2.99 -2.48,3.45 -0.63,2.2 -0.51,-0.92 0.14,-1.27 -0.63,1.22 0.6,1.77 -0.53,0.68 -1.64,1.26 -1.9,0.57 -0.32,1.24 -2.16,1.65 -1.46,-0.31 0.45,1.1 -0.54,0.83 -0.92,0.64 -2.37,0.59 -1.51,1.02 -2.38,-0.44 -0.71,0.29 1.82,1.2 -0.13,0.96 -1.06,0.87 -0.33,-0.08 -0.45,-1.39 -0.7,0.8 -1.06,-1.5 0.05,1.14 1.18,1.99 -0.73,0.99 -1.03,0.38 -0.27,1.13ZM950.57,1497.24l-1.65,0.06 0.73,2.5 -0.33,1.49 0.84,0.58 0.32,1.18 -1.88,5.8 1,1.52 0.66,2.28 -1.73,-0.89 -0.48,-1.07 -1.47,-0.98 -4.94,-2.47 -5.23,-0.22 -2.08,0.39 -0.95,0.68 -2.03,-0.72 -3.4,-2.31 -63.57,-0.01 -0.09,-31.63 0.37,-0.2 -0.08,-15.09 84.82,0.01 -0.66,2.33 -2.69,2.84 1.76,3.15 1.9,0.98 0.86,1.2 0,28.6ZM1073.79,1622.4l-29.2,-0.33 0.19,0.36 -24.12,-0.08 1.72,-1.52 0.56,-1.24 -0.17,-1.55 2.07,-3.87 -0.2,-1.23 0.56,-1 1.31,-0.77 0.18,-1.17 0.85,-0.45 -0.23,-0.87 0.85,-2.6 -0.46,-0.75 1.04,-0.72 -0.32,-0.71 0.64,-0.72 -0.02,-1.81 17.04,0.02 -0.42,-2.74 2.59,0.26 0.34,0.44 15.15,-0.3 31.59,1.11 23.57,-0.34 -0.51,1.09 -0.34,2.52 -1.98,0.69 -1.63,2.59 -0.56,0.23 -0.93,-0.66 -1.28,0.28 -2.94,2.29 -0.66,-1.08 -1.01,0.25 -1.29,1.16 -0.85,-0.06 -1.16,2.12 -1.49,0.37 -4.44,2.66 -4.1,0.97 -1.51,1.41 -0.66,1.79 -2.26,0.5 -0.73,3.64 -14.78,-0.18ZM972.98,1641.04l1.44,1.19 1.89,-0.38 1.64,0.47 0.05,21.05 2.25,2.76 0.44,3 0.78,0.73 0.82,2.55 1.23,1.9 0.31,1.78 -0.37,0.55 -0.18,2.4 -1.61,3.51 -0.34,2.82 0.45,3.06 -0.95,1.78 -0.54,-0.04 -1.19,2.17 0.64,1.64 -2.39,0.25 -7.5,3.74 0.1,-0.44 2.55,-1.7 -2.87,0 0.62,-1.4 -0.2,-1.24 -1.03,-0.04 -0.66,1 -1.51,-0.34 0.34,2.25 1.19,2.09 -2.85,2.65 -0.15,1.15 -1.38,1.5 -6.6,4.2 -4.34,1.96 2.55,-1.85 -4.13,-0.32 -0.85,0.81 -1.45,-1.58 -0.73,0.09 1.31,2.86 1.18,0.4 -1.6,1.17 -1.3,0.33 -1.11,-1.04 -0.38,2.61 -0.37,0.33 -0.59,0.48 -0.48,-0.87 -0.93,0.79 -1.6,0.25 0.17,1.07 1.21,-0.42 -0.44,1.39 -1.12,1.37 -0.91,0.32 -1.39,-0.2 -0.65,0.42 1.62,2.15 -1.71,4.39 -0.96,0.18 -2.79,-1.84 0.87,2.18 2.36,0.64 0.1,1.53 -0.9,1.92 1.37,6.14 2.51,5.3 0.72,0.03 0.12,0.45 -0.07,0.87 -1.54,0.25 -0.87,0.9 -2.61,-1.44 -2.43,-0.73 -5.39,-0.88 -1.17,-0.9 -3.57,-1.19 -0.84,-0.82 -3.9,-1.35 -1.39,-4.01 -2.57,-3.76 0.18,-1.45 -0.79,-2.18 0.27,-0.74 -0.22,-1.92 -2.83,-2.34 -4.07,-5.7 -2.1,-2 -0.4,-2.26 -2.48,-4.14 -1.24,-3.21 -1.09,-1.49 -2.98,-2.84 -0.26,-0.78 -3.01,-2.27 -0.87,-1.42 -1.87,-0.54 -0.02,-0.32 -5.06,0.16 -3.16,-0.99 -0.85,0.08 -0.48,0.77 -1.03,0.49 -1.58,0.22 -1.36,1.42 -1.13,2.61 -0.5,1.68 0.14,0.75 -2.56,2.82 -0.89,0.56 -1.01,-0.03 -1.88,-0.91 -4.9,-2.87 -1.55,-0.42 -4.68,-3.27 -2.52,-3.68 -0.67,-1.79 0,-1.89 -2.69,-5.92 -6.78,-5.26 -5.81,-5.55 -1.41,-0.71 -3.28,-4.19 -1.48,-0.73 -1.16,-2.43 40.99,-0.03 0.27,-61.94 34.58,-0.01 0.04,26.77 1.51,0.6 2.06,1.76 0.61,0.38 2.58,-0.05 0.51,-0.88 1.22,0.93 1.09,2.27 4.86,1.06 1.39,-0.2 1.76,1.14 1.11,-0.87 2.93,-0.05 0.33,1.44 1.34,0.95 0.34,1.27 0.9,0.04 2.29,-1.59 0.8,1.04 1.96,1.16 2.32,-0.82 -0.07,1.13 0.63,0.97 0.53,-0.18 0.4,-1.45 1.48,-1.33 0.98,0.97 1.15,0.39 1.59,-0.7 0.17,0.77 3.15,1.89 2,-1.52 2.25,-0.83 1.79,0.25 2.16,-1.1 0.8,0.8 1.71,0.17 1.8,-1.17 5.76,3.56 2.56,0.7ZM966.66,1701.08l-0.57,0.13 3,-2.68 0.67,0.03 -3.1,2.52ZM947.04,1713.96l-0.42,0.05 0.52,-0.69 4,-2.32 -0.11,0.57 -3.99,2.39ZM944.19,1717.19l-0.24,0.04 0.65,-1.48 1.38,-1.54 0.2,0.57 -1.99,2.41ZM940.33,1724.92l-0.35,0.73 1.02,-3.59 1.88,-3.29 0.79,-0.55 -2.17,3.61 -1.17,3.09ZM942.41,1739.45l-0.15,0.59 -2.48,-8.99 0.18,-4.81 0.4,5.05 2.05,8.16ZM807.29,1594.27l-56.81,-0.04 -0.03,-73.74 34.04,0 0.01,15.19 22.79,0 0,58.59ZM1170.52,1566.23l1.05,0.8 -0.18,1.65 -2.44,2.57 -0.61,2.95 0.93,0.82 2.11,-0.24 1.6,2.32 4.06,1.48 0.88,1.2 2.36,1.7 -0.47,2.48 -0.44,0.66 -1.68,-0.1 -3.83,-4.02 -1.27,-1.93 -1.94,-1.02 2.11,1.92 4.28,5.24 2.77,1.4 -0.7,0.6 1.12,0.5 0.06,1.98 -1.56,-0.42 0.09,1.23 -0.7,0.38 -0.96,-0.51 -2.49,-2.81 0.22,0.81 1.45,1.81 3.23,2.48 0.5,1.38 -1.34,0.87 -2.29,-2.16 -0.33,-1.13 -0.83,0.06 -3.45,-1.43 -2.77,-0.16 6.58,2.23 0.44,1.79 1.47,1.23 0.19,0.91 1,0.1 1.77,-0.89 2.79,0.57 1.61,5.14 -65.81,-0.63 -3,-0.33 -0.54,0.29 -19.51,-0.1 5.89,-2.23 1.21,-1.19 1.69,-0.86 1.85,-2.02 0.58,-1.28 3.85,-2.27 4.3,-3.48 -0.07,0.96 1.09,2.05 3.26,1.74 2.72,-1.8 1.95,1.01 2.99,-0.69 0.82,-1.58 1.41,0.3 2.41,-0.98 0.49,0.52 1.06,-0.57 1.43,-2.12 -0.45,-0.81 0.45,-1.07 3.12,-4.25 0.78,-1.95 2.14,-3.24 0.86,-2.44 0.96,0.19 0.57,0.99 1.24,0.53 1.77,-0.32 2.27,-4.56 0.56,-0.44 1.4,0.03 3.27,-2.65 1.66,-2.37 1.29,-4.28 5.53,4.51 1.24,-2.96 2.19,1.19 0.63,0.66 -0.31,1.15 0.29,0.43 2.05,0.87 2.03,1.61ZM1187.17,1580.61l0.44,-0.65 2.78,-0.38 -2.51,5.68 0.11,1.04 -1.27,0.6 -1.29,1.31 -1.39,3.91 -0.72,-1.6 0.25,-1.93 0.99,-3.16 1.92,-2.91 0.69,-1.91ZM1191.79,1579.4l0.31,-0.04 -1.22,2.2 -0.52,0.23 1.43,-2.39ZM1213.42,1473.35l20.87,-0.04 0.08,1.6 -1.25,2.19 0.59,2.63 -0.46,1.49 -2.46,2.23 -2.35,1.17 -0.95,5.31 -2.81,5.97 -1.27,8.57 -0.87,2.36 0.95,2.43 -8.95,-0.34 -0.31,-0.95 0.38,-11.54 -0.95,-1.16 -0.97,0.58 0.47,-3.37 -0.59,-4.28 1.2,-3.08 0.13,-3.03 -0.71,-2.2 0.23,-6.54ZM650.94,1406.78l65.42,0 0,43.9 1.09,2.71 0.24,1.13 -0.3,0.64 0.59,2.01 -24.16,0.02 -1.79,0.91 -2.87,0.18 -5.75,1.57 -4.74,1.84 -7.9,1.4 -1.58,-0.07 -0.66,-0.71 -1.82,-0.4 -2.96,-0.1 -2.5,0.46 -2.31,1.42 -1.33,0.18 -5.09,-0.59 -0.87,-0.75 -1.33,-4.97 -1.13,-2.24 -1.14,-0.74 -0.89,-0.31 -1.14,0.41 -2.78,-1.93 -2.11,0.05 -0.43,-0.52 -2.36,0.52 -0.73,-0.54 -1.28,0.35 0.32,-5.37 1.12,2.85 0.65,-3.77 -2.08,-1.4 -0.46,-1.96 3.06,-1.68 -3.06,-1.2 -0.31,1.35 -0.68,-4.25 -1.25,-3.29 -0.76,-4.28 -0.96,-2.12 -1.83,-2.03 -0.48,-1.19 -0.53,-6.93 8.35,3.62 7.75,0.83 1.51,-0.59 2.14,1.38 2.22,-1.09 1.39,4.36 -1.39,2.42 -0.26,0.05 -0.22,-0.98 -2.61,4.07 -1.01,2.8 0.4,0.63 2.07,-1 -1.65,0.14 0.08,-0.91 0.88,-1.78 1.92,-1.67 2.34,-3 0.26,-1.57 0.6,0.14 0.1,2.55 -1.21,1.3 0.19,1.3 -0.7,0.06 1.34,2.51 -0.23,2.86 -0.81,0.19 -0.67,-0.58 -0.68,1.64 -0.69,-1.98 -1.04,0.78 -1.23,2.53 2.45,-0.12 1.25,0.59 1.12,-0.94 0.7,-1.82 1.39,-0.61 0.76,-1 -0.17,-3.91 -0.48,-0.82 0.31,-1.08 -0.21,-1.15 1.82,-3.84 -1.98,-2.95 0.24,1.7 -1.39,-1.29 -0.04,-1.19 1.33,-0.68 -0.06,-0.42 -1.51,-2.01 -1.45,-0.93 0.47,-0.56 1.49,-0.13 -0.18,-2.82 -0.56,-1.87 -1.04,0.24 -0.37,-0.52 -1.17,-3.44ZM651.01,1412.31l0.15,0.38 -0.78,0.42 -0.74,-0.66 0.12,1.21 -1.26,-0.99 1.2,-1 1.31,0.64ZM648.38,1415.27l0.3,0.56 -1.74,-0.68 -0.25,-1.69 0.54,-0.12 1.15,1.93ZM650.57,1416.46l-1.14,-0.44 0.1,-1.39 0.49,-0.18 0.55,2.01ZM653.39,1421.16l0.56,2.24 0.24,-0.93 1.55,1.61 -0.19,1.05 -1.98,-1.17 -0.74,-2.71 -1.36,-1.26 1.29,-2.72 1.06,1.08 -0.08,0.47 -1.76,1.11 1.13,0.48 0.28,0.75ZM654.25,1430.7l-0.89,-0.42 0.3,-1.43 0.47,0.36 0.12,1.49ZM655.43,1434.05l-0.49,0.68 -0.36,-0.59 -0.47,0.54 0.27,-2.2 1.05,1.57ZM650.2,1437.25l-0.26,0.31 -0.36,-0.67 0.26,-0.81 0.36,1.17ZM1016.6,1512.62l-0.43,-1.5 -4.34,-2.76 -0.55,-1.45 -0.49,-3.43 0.62,-2.74 -0.12,-0.83 -0.7,-0.44 -0.68,-1.27 -0.93,-7.81 -0.71,-0.86 -5.22,-3.22 -2.43,-3.27 -2.11,-0.99 -2.29,-1.99 -2.3,-0.94 -1.43,-1.29 -0.34,-1.02 0.41,-2.32 -0.34,-2.21 0.39,-0.63 -0.08,-2.03 0.95,-3.18 -0.85,-1.79 -1.54,-0.84 -0.05,-1.03 2.31,-4.09 4.56,-2.87 0.02,-9.51 0.77,-0.17 1.12,-1.52 1.82,0.55 5.65,-3.25 9.27,-6.42 7.92,0.37 -5.17,11.69 0.23,0.6 0.58,-0.15 1.26,0.8 1.27,2.78 11.37,3.16 3.21,1.85 3.92,0.38 3.88,1.11 0.63,1.1 -0.23,1.02 2.21,0.91 1.29,1.21 0.16,1.46 -0.91,3.42 0.38,0.4 2.02,-0.17 -0.65,2.08 0.77,1.95 2.2,0.87 0.46,-1.87 1.99,-1.71 1.47,-2.63 3.88,0 5.8,3.65 -3.09,2.99 -2.03,3.14 -3.62,12.03 -1.24,6.84 -0.15,5.2 1.32,12.95 -41.09,-0.31ZM1115.42,1586.57l-1.57,-0.44 -2.02,-1.68 -3.51,-5.95 -0.33,-0.72 0.45,-1.77 -0.39,-2.56 1.31,0.49 2.04,-0.94 0.31,-1.06 1.26,-1.24 -0.26,-1.91 1.49,-2.84 0.81,-0.71 0.58,0.32 0.61,1.4 1.32,-0.78 -0.25,-2.03 1.65,-2.73 0.58,-0.04 1.9,-1.74 1.21,0.44 0.8,-0.35 3.41,-2.72 1.01,-1.38 0.02,-1.05 3.08,-9.34 -0.03,-1.21 -0.62,-1.77 0.24,-0.6 1.35,-0.65 0,13.76 11.85,0 -0.12,7.54 2.22,-1.48 2.48,-2.42 1.18,0.33 2.2,-2.55 1.14,1.14 2.08,0.24 1.01,-1.4 2.56,-0.85 0.95,0.11 0.8,0.69 1.96,0.47 -0.19,0.35 1.05,1.29 -0.14,0.69 0.74,1.4 -1.24,2.96 -5.53,-4.51 -1.29,4.28 -1.66,2.37 -3.27,2.65 -1.4,-0.03 -0.56,0.44 -2.27,4.56 -1.77,0.32 -1.24,-0.53 -0.57,-0.99 -0.96,-0.19 -0.86,2.44 -2.14,3.24 -0.78,1.95 -3.12,4.25 -0.45,1.07 0.45,0.81 -1.43,2.12 -1.06,0.57 -0.49,-0.52 -2.41,0.98 -1.41,-0.3 -0.82,1.58 -2.99,0.69 -1.95,-1.01 -2.72,1.8 -3.26,-1.74 -1.09,-2.05 0.07,-0.96ZM864.46,1535.68l-79.96,0 -0.01,-62.26 79.8,0 0.17,62.26ZM3705.84,1830.6l-0.35,0.45 -0.37,-0.98 0.7,0.2 0.02,0.33ZM3705.88,1859.53l-0.61,0.03 -0.31,-0.5 0.73,-0.02 0.19,0.49ZM3700.79,1885.25l-0.56,0.55 -0.72,-0.62 0.91,-0.3 0.37,0.37ZM3706.62,1838.8l-0.55,0.26 0.89,-1.38 0.32,0.43 -0.66,0.69ZM3706.33,1873.78l-0.03,0.31 -0.74,-0.21 0.33,-1.07 1.24,-0.59 -0.8,1.56ZM3705.31,1875.7l-0.47,0.6 -0.39,-1.31 0.44,-0.35 0.25,0.01 0.17,1.05ZM1310.21,1835.79l-0.86,0.11 -1.17,-0.56 1.53,-0.08 0.5,0.53ZM1312.32,1835.5l-1.46,0.16 0.4,-0.37 1.06,0.21ZM1311.11,1842.2l0.95,0.53 1.16,0 -1.21,0.53 -2.3,0.05 0.05,-0.84 1.35,-0.27ZM3694.84,1895.77l-0.48,0.02 -0.56,-0.65 -0.01,-1.35 1.6,-1.15 0.53,-1.11 0.44,0.09 0.74,0.52 -1.83,1.86 -0.43,1.77ZM105.51,2213.02l-0.48,0.1 -0.59,-0.56 1.5,-0.64 1.37,0.11 -0.82,0.18 -0.98,0.81ZM1295.59,1834.42l0.7,0.2 -0.28,-0.49 0.26,0 5.02,1.05 0.09,1.66 -3.98,3.21 -3.12,0.33 -6,-0.47 -1.45,0.46 -3.38,-0.55 0.28,-2.76 -1.05,-1.68 1.05,-0.85 0.15,-0.77 1.13,-0.27 9.91,0.56 0.67,0.37ZM1303.6,1838.48l-1.47,-0.02 -0.2,-0.36 1.09,-0.33 2.07,0.38 -1.49,0.33ZM1275.76,1839.03l-0.66,-0.32 0,-0.34 0.99,0.05 -0.33,0.61Z`,nWe=`M1102.45,1516.11l0.32,0.17 -0.35,3.14 3.11,1.13 2.15,-0.62 1.52,1.61 0.57,-1.92 0.57,-0.7 6.11,-3.25 -0.14,0.89 0.23,-0.02 1.55,-2.9 3.71,-2.83 4.15,-0.5 10.76,1.79 0.36,-0.12 -4.43,-0.91 2.63,-2.49 1.38,-0.44 8.11,-1.21 3.75,0.28 1.53,-0.95 -1.34,-1.52 -0.3,-1.32 1.95,0.75 -0.33,0.94 0.53,3.08 -3.78,3.78 -5.63,3.93 -7.17,3.98 -10.17,4.13 -5.63,3.95 -4.53,0.28 -4.08,1.44 -1.85,-1.05 -4.38,0.19 3.73,-1.01 -1.49,-0.89 -1.51,0.57 -5.61,-3.05 1.07,-2.1 2.12,-2.58 0.01,-1.5 0.8,-2.15Z(M1149.27,1505.2l0.33,0.06 0.51,-1.02 -1.12,0.03 0.28,0.93Z(M1107.76,1524.37l-0.18,-1.23 -0.35,1.4 0.53,-0.17Z(M1185.72,1481.69l0.12,0.41 -0.64,0.98 -5.92,4.63 0.53,0.99 1.51,-0.57 0.22,0.54 -0.44,0.66 1.39,0.08 -1.46,1.96 -0.43,0.06 0.04,-0.38 -0.59,0.4 0.76,1.76 0.17,2.88 -3.07,1.06 -2.84,2.58 -1.85,0.44 -0.89,0.79 -3.5,-0.48 -2.94,0.42 -3.52,-1.4 -3.83,-0.59 -5.85,0.52 -7.38,2.56 -4.44,-0.86 -0.51,-0.75 2.32,-4.35 3.03,-1.75 2.76,-2.29 15.18,-2.75 0.5,-0.56 1.51,0.31 -0.21,0.28 0.74,0.71 2.77,-0.02 -0.63,0.27 0.54,0.4 0.88,-0.42 -0.21,1.14 1.75,-0.12 2,-0.94 0.1,-0.35 -1.98,0.21 2.06,-2.35 -2.73,0.85 -0.16,-0.52 0.38,-1.09 -0.36,-0.39 -1.78,0.54 -0.28,0.65 -0.4,-0.1 -0.01,-0.78 -2.87,0.93 3.8,-1.49 2.18,-0.26 0.44,0.13 -0.15,0.64 0.27,0.06 1.29,-0.55 -1.89,1.52 0.81,0.27 3.45,-2.28 3.19,-0.7 5.3,-2.36 1.26,-1.27 0.51,0.09Z(M1175.47,1487.21l0.51,-0.98 -1.9,0.94 1.39,0.04Z(M1180.16,1489.25l0.15,0.29 0.36,-0.6 -0.51,0.31Z(M1180.59,1485.7l0.12,-0.34 -2.32,0.43 -0.6,0.77 -0.01,0.8 0.7,0.1 1.06,-1.37 1.05,-0.39Z(M1130.62,1730.2l-1.29,2.42 -0.47,0.08 -1.27,-0.78 -2.11,-2.6 2.4,-2.44 1.27,-0.45 1.18,1.64 0.29,2.13Z(M773.99,1535.66l0.15,0.92 -1.56,0.91 -1.05,1.68 -2.05,1.03 -1.23,-3.65 -0.78,1.57 -0.38,-0.14 -1.69,-2.57 -0.97,-3.09 -1.68,-2.33 -0.6,-3.34 1.93,-0.91 1.17,-0.03 0.39,0.86 -0.34,1 1.52,1.6 0.87,0.16 1.03,3.06 0.8,-0.45 -0.41,-2.78 0.33,-0.38 1.48,0.98 2.04,-0.11 -0.14,0.8 -1.87,0.03 -0.72,0.95 2.52,3.29 1.24,0.94Z(M771.74,1537.58l0.18,-1.21 -0.49,-1.52 -0.43,-0.2 -0.3,0.17 0.15,1.41 0.89,1.35Z(M1083.59,1460.59l-2.49,0.42 0.3,0.38 -0.25,0.6 -1.26,1.65 0,1.6 1.8,1.53 -3.34,0.92 -1.74,1.28 -0.15,3.94 -1.82,4.19 0.63,-3.58 -0.46,0.31 -0.67,2.56 -0.33,0.19 -0.29,-0.54 0.93,-5.94 -0.58,0.22 -2.74,3.73 -0.6,-0.24 -1.67,0.97 -0.78,2.7 -1.51,0.78 0.19,2.37 -0.62,3.51 -2.56,4.38 0.83,2.07 0.12,1.75 -1.19,2.77 2.43,6.47 1.22,5.04 -0.43,5.72 -1.68,4.73 -2.57,4.79 -1.88,1.88 -4.1,2.16 -2.25,0.05 -1.8,-1.18 -2.05,-5.56 -1.17,-1.95 -0.17,-5.1 0.35,-3.26 -1.21,-4.02 -0.16,-3.63 1.15,-4.59 1.15,-2.91 -0.34,-2.01 0.34,-1.98 1.1,-2.35 0.78,-0.78 0.25,-0.89 -0.17,-2.47 2.17,-6.24 -0.94,-1.44 -2.1,0.3 -2.09,3.13 -2.06,1.59 -0.57,-0.3 -0.11,-0.75 0.88,-2.33 1.38,-2.87 2.31,-1.45 0.39,-2.34 5.44,-8.35 1.5,-3.67 -0.11,2.09 0.62,1.46 2.1,-2.6 2.16,-0.38 0.05,1.25 -1.51,1.71 0.02,0.72 0.77,0.56 1.08,-2.13 2,-1.27 0.91,-1.72 1.69,-0.53 2.38,0.45 3.4,-1.29 1.55,-1.43 1.06,-0.02 4.71,1.96 2.44,2.06 -0.06,1.15Z(M1075.29,1461.12l-0.53,-0.25 -0.39,0.61 -0.45,2.1 1.18,-0.25 0.19,-2.21Z(M1068.91,1470.91l0.17,0.87 0.57,0.24 0.09,-0.71 -0.83,-0.4Z(M1058.97,1466.73l-0.46,0.76 0.23,0.36 0.97,-0.1 0,-0.91 -0.74,-0.11Z(M1057.57,1468.55l-2.38,2.66 -1.57,2.96 0.48,1.85 0.84,0.07 1.05,-1.4 0.54,-1.91 0.93,-1 -0.28,-0.83 0.31,0.06 0.03,-1.09 0.71,-0.37 0.06,-0.55 -0.72,-0.45Z(M1087.35,1448.61l1,-0.15 -2.09,1.57 -1.22,-0.76 -2.46,0.21 -2.08,-0.6 0.22,-2.99 0.53,-1.4 -0.53,-0.21 -6.84,1.54 -5.87,0.06 -3.08,1.64 -2.67,2.23 -1.09,-0.61 -2.05,0.11 -1.38,-0.99 -1.55,0.49 -2.13,-0.18 -3.18,-5.01 -1.59,-1.02 -5,-1.06 -1.89,1.28 -0.75,1.22 -0.31,-0.59 0.11,-2.93 -0.88,-1.82 -1.01,-0.76 -0.21,-1.09 -2.03,1.44 -1.35,1.72 -2.35,0.91 -2.28,1.78 -3.87,0.72 -5.22,3.06 -3.58,1.16 -3.05,-1.73 -0.38,0.72 -1.98,0.43 2,-4.8 -0.82,-0.9 -1.2,0.14 -2.07,1.44 -1.02,-0.3 -3.21,1.98 -3.83,1.07 -1.72,0.05 -1.36,-1.05 0.48,-0.94 4.77,-3.85 9.09,-8.99 2.83,-1.73 8.75,-3.61 5.5,-3.74 1.41,-3.24 0.23,-2.4 4.85,-2.27 -1.16,3.46 -0.64,0.79 2.26,-0.84 1.24,-3.68 0.86,-1.02 0.54,-3.02 1.22,-0.21 0.49,0.42 0.33,1.42 -2.77,3.62 -0.2,0.62 0.28,0.78 0.67,-0.35 0.65,-1.6 2.39,-0.63 1.08,-1.48 0.34,-1.61 -1.32,-1.57 -0.44,-1.85 2.2,-0.48 9.63,3.91 4.59,0.05 1.45,-0.61 1.27,0.95 1.69,-0.09 1.71,2.76 2.03,6.65 2.16,3.08 3.41,1.51 8.64,-0.16 -1.81,5.27 0.89,1.67 2.5,1.9 1.38,1.79 -1.42,2.99 -0.63,2.3 1.71,1.36 1.55,-0.36 1.18,0.64 0.03,0.87 -1.17,0.1 -0.78,0.7 0.15,1.8 0.59,-0.77 0.57,0.34 -1.48,2.98 0.77,0.99 0.78,-0.64Z(M1015.4,1441.26l-0.06,0.46 0.6,0.16 -0.54,-0.62Z(M1016.57,1443.54l0.65,-0.68 -2.23,1.6 1.58,-0.92Z(M1017.78,1442.02l0.05,-0.73 -1.23,0.43 1.18,0.3Z(M1019.33,1439.94l-0.42,-0.37 -0.28,0.81 0.7,-0.44Z(M1046.11,1409.48l-0.34,0.5 0.34,1.58 2.74,-0.89 0.58,-1.26 -1.71,-0.41 -1.61,0.48Z(M1036.39,1424.91l3.26,-1.8 0.49,-1.17 1.1,-0.96 -1.18,0.15 -6.35,3.5 -0.61,0.61 0.35,0 -0.29,1.1 2.56,-0.49 0.53,-0.4 -0.36,-0.36 0.5,-0.18Z(M1049.14,1433.78l0.56,-0.37 -1.56,-0.85 -2.64,0.19 -2.39,0.87 -2.75,2.5 -0.61,1.64 2.07,0.87 -0.23,-0.5 0.42,-0.66 0.09,1.01 -0.68,1.4 0.34,0.61 0.42,-0.14 1.88,-2.33 0.17,-0.87 2.81,-2.42 -0.52,-0.63 2.62,-0.32Z(M1050.28,1410.98l0.78,-0.12 -0.05,-0.4 -0.87,-1.06 -0.52,0.12 0.05,1.22 0.61,0.24Z(M1074,1428.2l-0.41,-0.67 -1.41,-0.42 -1.33,0.27 -0.78,0.73 1.05,0.48 2.88,-0.39Z(M1088.35,1448.46l2.03,-0.52 0.9,0.92 -0.06,2.41 7.2,2.03 4.93,0.93 3.49,-0.43 0.92,0.57 3.28,-0.34 1.75,0.97 4.86,0.49 0.04,0.76 1.71,-1.01 0.84,0.74 -1.12,0.56 0.48,0.47 -0.33,0.55 0.34,0.19 1.68,-0.46 2.42,0.33 0.71,-0.68 0.16,1 0.72,0.22 3.17,-0.16 3.5,5.9 0.75,0.09 0.35,-0.58 0.73,3.58 1.96,0.89 0.01,-0.85 1.36,0.36 0.08,1.19 -0.81,1.25 0.82,0.31 0.48,0.82 -0.9,0.71 2.09,2.46 0.84,0.33 0.65,1.88 0.86,-0.9 -0.15,1.35 0.35,0.35 -1.69,0.02 -1.12,-0.72 -0.05,-0.8 -2.03,0.9 1.26,2.47 -0.12,1.29 -0.88,1.31 -4.27,-1.41 -1.51,-0.97 -0.88,-1.41 -1.36,0.42 -1.36,1.33 0.16,-2.62 -0.77,-0.45 -1.9,0.63 1.41,-1.71 0.38,-1.5 -1.15,0.9 -0.68,-0.07 -0.05,-0.8 -1.38,-0.97 -0.61,-2.06 0.32,-1.38 -4.69,-0.16 -0.1,0.45 1.31,0.93 1.59,2.43 1.09,0.61 -0.04,1.06 0.91,1.95 0.01,2.34 -1.42,2.92 -1.85,1.61 -1.63,3.64 -0.27,1.11 0.22,9.24 -0.82,2.3 -4.51,3.78 -2.68,1.05 -0.51,-0.99 -2.29,-12.12 -0.61,-1.34 -1.84,-1.72 -1.32,-0.21 -4.42,2.17 0.34,0.7 -1.32,2.34 -1.19,0.53 -1.07,1.2 -2.05,-0.67 -1.03,-1.16 0.68,-3.55 3.01,-1.52 1.15,-3.37 0.57,0.1 1.5,-1.76 0.36,-6.55 -0.32,-1.34 -1.41,-1.98 0.29,-1.08 1.67,0.2 -0.59,-1.89 -0.74,-0.93 -0.02,-0.84 -0.92,-1.05 -5,-2.39 -1.76,-0.38 -1.93,-2.19 -2.27,-0.52 -3.65,-1.9 0.06,-1.15 0.5,-0.12 -0.13,-1.42 1.06,-1.56 1.26,0.95 6.17,0.54 0.88,-0.32 -0.18,-0.65 -1.41,-1.11 -0.16,-1.16 -2.19,-0.72 0.52,-1.32 -0.6,-2.05 -1.18,-1.6 0.16,-0.44Z(M1099.72,1457.32l-1.05,0.48 -0.49,0.93 1.07,0.62 0.62,-0.19 0.71,-1.09 -0.86,-0.75Z(M1097.63,1456.81l-0.91,-1.19 -0.86,-0.16 0.01,0.8 -0.36,0.33 -1.78,0.33 -0.04,0.42 0.59,0.59 2.67,0.23 1.08,-0.81 -0.4,-0.54Z(M1094.21,1454.78l0.39,-1.1 -0.31,-0.64 -1.69,-0.82 -1.44,0.26 1.35,2.93 0.82,0.2 0.35,-0.84 0.53,0.01Z(M1090.35,1451.87l-0.19,0.74 0.73,0.55 0.02,-0.64 -0.56,-0.65Z(M1090.76,1451.6l-0.35,-1.14 0.24,-2 -0.84,-0.08 -0.66,0.8 0.97,2.1 0.64,0.32Z(M1087.39,1460.36l-1.53,0.05 1.72,1.1 0.42,-0.48 -0.61,-0.67Z(M1104.07,1459.92l7.28,2.45 3.04,1.99 2.67,-2.12 0.7,-0.1 -1.2,1.42 -1.27,0.66 1.08,0.56 1.44,-0.91 1.84,-3.26 -1.04,-0.16 0.23,-1.15 -0.38,-0.36 -1.21,2.46 -0.39,-0.74 -0.02,-1.58 -0.44,-0.12 -0.68,-1.42 -1.32,0.4 -1,1.4 -2.16,-1.84 -2.22,0.7 -0.6,0.71 0.68,0.76 -0.12,0.71 -1.47,-0.88 -1.19,0.02 -0.66,-0.84 -0.25,-1.32 -2.87,0.9 -0.9,-0.55 -0.45,0.59 -0.07,0.5 0.7,0.44 2.25,0.68Z(M1118.29,1464.93l-1.42,0.68 0.56,0.3 0.86,-0.98Z(M1135.81,1476.71l0.02,-1.1 -0.74,0 0.72,1.1Z(M977.9,1400.16l0.05,1.84 -0.81,1.07 0.1,-0.99 -1.27,-2.28 -0.65,-0.24 0.28,-1.11 -4.47,0.46 -1.12,0.62 -0.51,0.98 1.7,-0.01 2.01,2.12 1.25,-0.59 1.3,1.48 1.89,0.45 -1.4,1.03 -1.28,-0.13 -0.16,0.57 -4.43,3.59 -1.2,-0.07 -2.1,-1.67 -2.01,1.17 -1.07,0.18 -0.45,-0.73 0.6,-3.62 3.16,-1.02 0.53,-0.77 -0.06,-1.42 -0.83,-0.82 4.2,-4.12 -1.14,-0.23 -4.12,2.68 -0.36,-0.15 0.26,-1.24 -0.41,-1.4 1.64,-0.22 0.53,0.25 -0.14,0.65 0.54,0.14 0.98,-0.64 -0.34,-0.88 0.54,-0.49 2.67,-0.59 0.32,-0.7 -0.18,-0.77 -1.17,-2.57 0.73,-0.7 0.86,1.08 0.1,1.39 0.9,2.03 1.19,0.23 0.39,0.69 -0.03,1.5 -0.61,0.64 0.76,0.85 1.46,0.32 0.33,1.21 1.05,0.95Z(M970.51,1403.35l-0.98,-0.04 0.64,1.75 0.84,0.04 0.73,0.93 0.74,-0.09 0.93,-2.4 -0.78,-0.62 -2.12,0.43Z(M296.15,1194.71l-6.4,3.19 -0.91,3.96 -12.85,2.61 -1.57,-0.94 -0.37,-1.79 0.77,-1.81 9.71,-3.78 7.56,-1.94 4.06,0.5Z(M683.32,1565.04l-0.26,0.99 -0.77,0.18 -0.54,-0.38 -0.67,-1.75 0.08,-0.77 0.83,-1.15 1.11,-0.48 0.5,0.7 -0.28,2.66Z(M1043.06,1488.32l-0.1,2.04 -1.11,2.06 -0.38,-0.09 -0.62,-3.4 0.39,-1.29 0.76,-1.34 0.68,-0.02 0.42,0.25 -0.04,1.79Z(M1213.18,1487.05l-0.37,1.48 0.43,4.69 -0.95,-5.15 0.08,-1.74 1.02,-1.4 -1.02,-5.68 1.11,-6.11 0.26,-0.17 0.44,1.87 0.92,-1.76 1.14,-0.9 -0.08,1.1 -0.93,0.85 0.23,0.6 -0.47,5.33 -0.56,0.72 0.4,1.54 -1.65,4.73Z(M732.6,1646.14l-0.05,0.7 -0.93,1.15 -1.04,-0.11 -3.1,-3.9 0.09,-0.94 1.19,-0.24 3.84,3.34Z(M749.16,1424.97l-0.49,-1.81 0.74,-0.89 0.99,1.3 0.26,1.38 0.22,2.53 -0.59,1.25 -1.06,-0.06 -0.15,-0.43 0.42,-0.74 -0.25,-0.49 -1.16,-0.41 1.07,-1.63Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M885.79,1431.15l-1.02,-0.36 -2.19,0.45 1.48,-1.6 -0.42,-1.69 -2.56,-0.48 -0.62,-0.57 -0.42,-1.65 0.44,-1.29 -1.67,-1.56 -3.39,-0.71 -4.56,1.87 -0.69,-0.2 -0.71,-1.18 -1.9,1.35 -0.26,-0.17 0.16,-0.79 1.05,-1.16 1.04,-0.19 1.41,1.47 1.12,-0.15 2.67,-1.62 2.29,0 2.75,1.12 0.87,0.89 0.46,1.45 -0.2,2.1 0.55,0.36 1.35,0.29 0.27,-0.24 -0.35,-2.01 1.79,-0.67 -0.41,1.12 0.62,2.47 0.8,0.62 -0.49,0.88 0.59,0.9 3.15,1.06 7.75,-1.41 0.71,0.65 -2.95,1.69 -2.16,-0.15 -3.73,0.86 -2.62,-1.75Z(M755.08,1610.82l-1.81,-2.51 -2.21,-2.19 -0.57,0.02 -0.81,1.85 -1.12,0.37 -0.97,-0.34 -0.9,-0.99 -0.89,0.29 -0.6,-0.37 -1.55,0 -1.15,1.3 -0.8,-0.86 -0.05,-0.66 4.37,-1.63 0.51,-3.47 0.58,-0.52 -0.39,4.38 0.86,1.4 0.78,0.85 0.76,-0.38 1.47,-2.37 0.38,0.02 2.5,2.75 1.61,3.06Z(M792.26,1581.42l-0.75,2.69 -4.57,6.97 0.49,0.45 1.62,-0.22 -0.3,0.48 -3.63,0.87 -5.44,2.59 -0.64,-1.38 2.17,-0.47 0.95,-1.2 0.51,0.39 0.54,-0.66 2.28,0.21 1.19,-2.63 0.67,-0.25 0.72,-1.13 -0.22,-1.36 0.84,-0.07 1.44,-1.44 1.23,-1.98 0.13,-1.48 0.36,-0.5 0.41,0.12Z(M906.94,1473.16l-0.93,0.46 -0.25,1.49 -0.95,1.63 -1.82,0.71 0.46,2.38 1.22,0.44 -0.18,0.82 1.21,0.83 -0.16,0.82 -2.26,-0.82 -0.82,-3.9 -0.48,-0.28 -1.4,-0.51 -3.88,0.59 2.2,-0.8 0.41,-0.66 1.75,-0.26 0.44,-0.26 -0.13,-0.51 2.49,1.15 0.67,-0.96 0.49,-0.02 0.12,-2.06 1.14,-1.64 0.14,-0.9 0.2,-1.65 -0.33,-0.73 -0.7,-0.71 -2.33,-0.1 3.05,-0.58 -1.03,-1.84 -2.31,-2.58 2.16,0.29 0.65,-1.06 -0.27,-1.6 -2.79,-5.1 -0.1,-0.69 0.85,-2.5 -0.14,-2.89 -0.32,-1.51 -1.52,-1.53 -0.11,-0.69 0.72,0.14 1.47,1.46 0.65,3.82 -0.53,3.28 0.17,1.49 0.76,1.78 1.62,2.19 0.06,2.75 -0.72,1.98 1.44,2.22 0.3,2.99 -0.35,2.49 0.27,0.7 -0.3,0.44Z`.split(`(`),f9=4096,rWe=85.05112878;function p9(e,t){let n=Math.max(-85.05112878,Math.min(rWe,t))*Math.PI/180,r=(e+180)/360,i=.5-Math.log(Math.tan(Math.PI/4+n/2))/(2*Math.PI);return{x:r*f9,y:i*f9}}function iWe(e){let t=.5-e.y/f9,n=2*Math.atan(Math.exp(2*Math.PI*t))-Math.PI/2;return{lon:e.x/f9*360-180,lat:n*180/Math.PI}}function aWe(e,t){return{x:(e.x-t.tx)/t.k,y:(e.y-t.ty)/t.k}}function oWe(e){if(!Number.isFinite(e)||e<=0)return 4;let t=Math.log2(f9*1.08*e/256);return Math.max(0,Math.min(21,Math.round(t)))}function sWe(e,t){return e!=null&&t!=null&&Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e)<=90&&Math.abs(t)<=180}function cWe(e,t,n){let r=`${e.toFixed(6)},${t.toFixed(6)}`;return n==null?`https://www.google.com/maps/search/?api=1&query=${r}`:`https://www.google.com/maps/@${r},${Math.round(n)}z`}function lWe(e,t){return`https://www.google.com/maps/dir/?api=1&destination=${e.toFixed(6)},${t.toFixed(6)}`}function m9(e,t){return{x:t.tx+e.x*t.k,y:t.ty+e.y*t.k}}function uWe(e,t,n,r=40,i=f9/90){if(e.length===0)return null;let a=1/0,o=-1/0,s=1/0,c=-1/0;for(let t of e)a=Math.min(a,t.x),o=Math.max(o,t.x),s=Math.min(s,t.y),c=Math.max(c,t.y);let l=Math.max(o-a,i),u=Math.max(c-s,i),d=(a+o)/2,f=(s+c)/2;l*=1.16,u*=1.16;let p=Math.min((t-r*2)/l,(n-r*2)/u);return{k:p,tx:t/2-d*p,ty:n/2-f*p}}function dWe(e,t,n,r,i,a){let o=Math.max(i,Math.min(a,e.k*t));return o===e.k?e:{k:o,tx:n-(n-e.tx)*o/e.k,ty:r-(r-e.ty)*o/e.k}}function h9(e,t){return e/t}function fWe(e,t,n){return`${h9(e,n)} ${h9(t,n)}`}function pWe(e,t,n=1/0){let r=t/f9;return{kMin:Math.min(e,Math.max(r,e*.25)),kMax:Math.max(e,Math.min(e*60,n))}}function mWe(e){return Math.max(0,Math.min(1,(1.5-e)/.9))}function hWe(e,t,n,r,i,a,o=14,s=6){let c=t-r-o;return{x:Math.max(s,Math.min(i-n-s,e-n/2)),y:Math.max(s,Math.min(a-r-s,c>=s?c:t+o))}}var gWe=6371.0088,_We=(e,t)=>{let n=Math.PI/180,r=(t.lat-e.lat)*n,i=(t.lon-e.lon)*n,a=Math.sin(r/2)**2+Math.cos(e.lat*n)*Math.cos(t.lat*n)*Math.sin(i/2)**2;return 2*gWe*Math.asin(Math.min(1,Math.sqrt(a)))};function vWe(e,t,n,r=!1){if(e.length<2)return 0;let i=0;for(let r=1;rn(t[e],t[r]);for(let e=0;e`${e.lat.toFixed(6)},${e.lon.toFixed(6)}`,i=Math.min(e.length,SWe(!!t.coarsePointer,n));for(;;){let t=e.slice(0,i),a=t[0],o=n?a:t[t.length-1],s=n?t.slice(1):t.slice(1,-1),c=`https://www.google.com/maps/dir/?api=1&origin=${r(a)}&destination=${r(o)}`+(s.length?`&waypoints=${s.map(r).join(`|`)}`:``)+`&travelmode=driving`;if(c.length<=2048||i<=2)return{url:c,used:i};--i}}function wWe(e,t,n,r){return{x0:Math.min(e,n),y0:Math.min(t,r),x1:Math.max(e,n),y1:Math.max(t,r)}}function TWe(e,t,n,r,i,a){if(e==null||!Number.isFinite(e))return a;if(!(n>t))return(r+i)/2;let o=Math.max(0,Math.min(1,(e-t)/(n-t)));return Math.sqrt(r*r+o*(i*i-r*r))}var g9=1e3,_9=620,EWe=3.2,DWe=15,OWe=4.5,kWe=2.6,v9=[{fill:`#9DBFF2`,line:`#5F7FB0`},{fill:`#A5D8B4`,line:`#5E9C74`},{fill:`#F5D989`,line:`#B39A46`},{fill:`#F0A8A0`,line:`#B76D65`},{fill:`#7E99C2`,line:`#4A6790`},{fill:`#84AD91`,line:`#4C7A5C`},{fill:`#C4AE6E`,line:`#8C7838`},{fill:`#C0867F`,line:`#8A5049`}],y9={fill:`#D7DBE3`,line:`#8A909C`},b9={fill:`#9DBFF2`,line:`#4F6079`};function AWe(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function jWe(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function MWe({rows:e,field:t,colorField:n,sizeField:r,selectedPids:i,onSelectPids:a,onOpen:o}){let[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(null),x=(0,L.useRef)(null),S=(0,L.useRef)(!1),C=(0,L.useRef)(!1),w=(0,L.useMemo)(()=>{let i=[];for(let a of e){let e=AWe(a.lat),o=AWe(a.lon);e==null||o==null||Math.abs(e)>90||Math.abs(o)>180||i.push({pid:a.pid,title:String(a[t.key]??``),p:p9(o,e),lat:e,lon:o,colorKey:n?String(a[n.key]??``).trim():null,size:r?jWe(a[r.key]):null,colorVal:n?a[n.key]:null,sizeVal:r?a[r.key]:null})}return i},[e,t.key,n,r]),T=e.length-w.length,E=(0,L.useMemo)(()=>uWe(w.map(e=>e.p),g9,_9),[w]);(0,L.useEffect)(()=>{E&&(!C.current||h==null)&&g(E)},[E]);let{kMin:D,kMax:O}=(0,L.useMemo)(()=>E?pWe(E.k,_9,32):{kMin:1,kMax:1},[E]),k=(0,L.useMemo)(()=>{if(!n)return null;let e=[],t=new Map;for(let n of w){let r=n.colorKey??``;t.has(r)||(t.set(r,0),e.push(r)),t.set(r,(t.get(r)??0)+1)}let r=e.filter(e=>e!==``),i=new Map;return r.forEach((e,t)=>i.set(e,t{if(!r)return null;let e=1/0,t=-1/0,n=0;for(let r of w){if(r.size==null){n+=1;continue}e=Math.min(e,r.size),t=Math.max(t,r.size)}return Number.isFinite(e)?{min:e,max:t,missing:n,none:!1}:{min:0,max:0,missing:n,none:!0}},[r,w]),j=(0,L.useMemo)(()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,[]),M=(0,L.useMemo)(()=>i.size<2?[]:w.filter(e=>i.has(e.pid)&&sWe(e.lat,e.lon)).sort((e,t)=>e.pid-t.pid),[w,i]),ee=i.size-M.length,N=(0,L.useMemo)(()=>{if(!l||M.length<2)return null;let e=M.map(e=>({lat:e.lat,lon:e.lon})),t=0;for(let e=1;ee.pid===p);e>=0&&(t=e)}let{order:n,km:r}=xWe(e,_We,{start:t,roundTrip:d});return{ordered:n.map(e=>M[e]),km:r,link:CWe(n.map(t=>e[t]),{roundTrip:d,coarsePointer:j})}},[l,M,d,p,j]),te=(0,L.useCallback)(e=>{if(!k)return b9;let t=e.colorKey??``;return t===``?y9:k.swatch.get(t)??y9},[k]),ne=(0,L.useCallback)(e=>!r||!A||A.none?OWe:TWe(e.size,A.min,A.max,EWe,DWe,kWe),[r,A]),P=(0,L.useCallback)((e,t)=>{if(!y)return{x:0,y:0};let n=y.getBoundingClientRect();return{x:(e-n.left)/n.width*g9,y:(t-n.top)/n.height*_9}},[y]);(0,L.useEffect)(()=>{if(!y)return;let e=e=>{e.preventDefault();let{x:t,y:n}=P(e.clientX,e.clientY);C.current=!0,g(r=>r&&dWe(r,Math.exp(-e.deltaY*.0016),t,n,D,O))};return y.addEventListener(`wheel`,e,{passive:!1}),()=>y.removeEventListener(`wheel`,e)},[y,P,D,O]);let re=(0,L.useCallback)(e=>{C.current=!0,g(t=>t&&dWe(t,e,g9/2,_9/2,D,O))},[D,O]),F=(0,L.useCallback)(()=>{C.current=!1,g(E)},[E]),ie=(0,L.useCallback)((e,t)=>{C.current=!0,g(n=>n&&{...n,tx:n.tx+e,ty:n.ty+t})},[]),ae=(0,L.useCallback)(e=>{let t=e.shiftKey?160:60;switch(e.key){case`ArrowLeft`:ie(t,0);break;case`ArrowRight`:ie(-t,0);break;case`ArrowUp`:ie(0,t);break;case`ArrowDown`:ie(0,-t);break;case`+`:case`=`:re(1.6);break;case`-`:case`_`:re(1/1.6);break;case`0`:F();break;case`Escape`:if(!_)return;v(null);break;default:return}e.preventDefault()},[ie,re,F,_]),oe=(0,L.useCallback)(e=>{if(e.button!==0||!h)return;let{x:t,y:n}=P(e.clientX,e.clientY);S.current=!1,e.currentTarget.setPointerCapture(e.pointerId),e.shiftKey||e.ctrlKey||e.metaKey?v({x0:t,y0:n,x1:t,y1:n}):x.current={x:t,y:n,tx:h.tx,ty:h.ty}},[h,P]),se=(0,L.useCallback)(e=>{let{x:t,y:n}=P(e.clientX,e.clientY);if(_){S.current=!0,v(e=>e&&{...e,x1:t,y1:n});return}let r=x.current;r&&(Math.abs(t-r.x)+Math.abs(n-r.y)>2&&(S.current=!0),C.current=!0,g(e=>e&&{...e,tx:r.tx+(t-r.x),ty:r.ty+(n-r.y)}))},[_,P]),ce=(0,L.useCallback)(e=>{if(_&&h){let t=wWe(_.x0,_.y0,_.x1,_.y1);if(t.x1-t.x0>3&&t.y1-t.y0>3){let n=[];for(let e of w){let r=m9(e.p,h);r.x>=t.x0&&r.x<=t.x1&&r.y>=t.y0&&r.y<=t.y1&&n.push(e.pid)}a(n,e.altKey?`add`:`replace`)}v(null)}x.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[_,h,w,a]);if(!h||!E)return(0,B.jsxs)(`div`,{className:`cg-mode-empty`,children:[`No records with a location to map yet.`,T>0&&` ${T.toLocaleString()} matching record${T===1?``:`s`} have no location.`]});let le=s==null?void 0:w.find(e=>e.pid===s),ue=_?wWe(_.x0,_.y0,_.x1,_.y1):null,de=`translate(${h.tx.toFixed(2)} ${h.ty.toFixed(2)}) scale(${h.k.toFixed(6)})`,fe=e=>h9(e,h.k),pe=mWe(h.k),me=iWe(aWe({x:g9/2,y:_9/2},h)),he=cWe(me.lat,me.lon,oWe(h.k)),ge=i.size===1?w.find(e=>i.has(e.pid)):void 0,_e=A&&!A.none&&A.max>A.min?[A.min,(A.min+A.max)/2,A.max]:null;return(0,B.jsxs)(`div`,{className:`cg-mapview`,children:[(0,B.jsxs)(`div`,{className:`cg-map-bar`,children:[(0,B.jsxs)(`span`,{className:`cg-cal-note cg-map-count`,children:[(0,B.jsx)(`strong`,{children:w.length.toLocaleString()}),` of`,` `,e.length.toLocaleString(),` mapped · pinned at each customer's address`]}),T>0&&(0,B.jsxs)(`span`,{className:`cg-cal-nodate`,title:`${T.toLocaleString()} matching record${T===1?``:`s`} have no geocoded location and are not on the map. They remain in the Grid and List views.`,children:[T.toLocaleString(),` matching record`,T===1?` has`:`s have`,` no location`]}),ge&&(0,B.jsxs)(`span`,{className:`cg-map-go`,children:[(0,B.jsxs)(`a`,{href:cWe(ge.lat,ge.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Open ${ge.title} in Google Maps at ${ge.lat.toFixed(5)}, ${ge.lon.toFixed(5)} (new tab)`,children:[ge.title||`Selected pin`,` in Google Maps`]}),(0,B.jsx)(`a`,{href:lWe(ge.lat,ge.lon),target:`_blank`,rel:`noopener noreferrer`,title:`Directions to ${ge.title} (new tab)`,children:`Directions`})]}),i.size>=2&&(0,B.jsxs)(`span`,{className:`cg-map-route`,children:[l?N&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`cg-map-route-sum`,children:[(0,B.jsx)(`strong`,{children:N.ordered.length.toLocaleString()}),` stops ·`,` `,Math.round(N.km).toLocaleString(),` km`,(0,B.jsx)(`span`,{className:`cg-map-route-note`,children:` straight-line, not driving distance`})]}),(0,B.jsxs)(`label`,{className:`cg-map-route-opt`,children:[`Start`,(0,B.jsx)(`select`,{className:`cg-map-route-start`,value:String(N.ordered[0].pid),onChange:e=>m(Number(e.target.value)),children:M.map(e=>(0,B.jsx)(`option`,{value:e.pid,children:e.title||`#${e.pid}`},e.pid))})]}),(0,B.jsxs)(`label`,{className:`cg-map-route-opt`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Return to start`]}),N.link&&(0,B.jsxs)(`a`,{href:N.link.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open this route in Google Maps for driving directions (new tab)`,children:[`Open route in Google Maps`,N.link.used{u(!1),m(null)},children:`Clear`})]}):(0,B.jsxs)(`button`,{type:`button`,className:`cg-map-route-go`,onClick:()=>u(!0),disabled:M.length<2,title:M.length<2?`At least two selected records need a location to plan a route`:`Order these stops into a route`,children:[`Plan route (`,M.length.toLocaleString(),` stops)`]}),ee>0&&(0,B.jsxs)(`span`,{className:`cg-cal-nodate`,children:[ee.toLocaleString(),` selected record`,ee===1?` has`:`s have`,` no location and cannot be routed`]})]}),(0,B.jsx)(`span`,{className:`cg-map-hint`,children:`Scroll to zoom · drag to pan · shift-drag to select`})]}),(0,B.jsxs)(`div`,{className:`cg-map-frame`,tabIndex:0,role:`group`,"aria-label":`Map canvas. Arrow keys pan, plus and minus zoom, zero fits to data.`,onKeyDown:ae,children:[(0,B.jsxs)(`svg`,{ref:b,viewBox:`0 0 ${g9} ${_9}`,preserveAspectRatio:`xMidYMid meet`,className:`cg-map-svg`+(_?` is-selecting`:``),role:`img`,"aria-label":`Map of ${w.length.toLocaleString()} customers`,onPointerDown:oe,onPointerMove:se,onPointerUp:ce,onPointerCancel:ce,children:[(0,B.jsx)(`rect`,{className:`cg-map-water`,x:0,y:0,width:g9,height:_9}),(0,B.jsxs)(`g`,{transform:de,children:[pe>.01&&(0,B.jsxs)(`g`,{className:`cg-map-grat`,strokeWidth:fe(.6),opacity:pe,children:[Array.from({length:17},(e,t)=>{let n=p9(0,-80+t*10).y;return(0,B.jsx)(`line`,{x1:0,y1:n,x2:4096,y2:n},`p${t}`)}),Array.from({length:19},(e,t)=>{let n=p9(-180+t*20,0).x;return(0,B.jsx)(`line`,{x1:n,y1:0,x2:n,y2:4096},`m${t}`)})]}),(0,B.jsx)(`path`,{className:`cg-map-land`,d:tWe,strokeWidth:fe(.9)}),nWe.map((e,t)=>(0,B.jsx)(`path`,{className:`cg-map-lake`,d:e,strokeWidth:fe(.8)},t)),N&&N.ordered.length>1&&(0,B.jsx)(`polyline`,{className:`cg-map-route-line`,strokeWidth:fe(1.8),strokeDasharray:fWe(5,4,h.k),points:N.ordered.map(e=>`${e.p.x},${e.p.y}`).join(` `)+(d?` ${N.ordered[0].p.x},${N.ordered[0].p.y}`:``)}),w.map(e=>{let t=te(e),n=i.has(e.pid),r=ne(e)/h.k;return(0,B.jsx)(`circle`,{className:`cg-map-pin`+(s===e.pid?` is-hover`:``)+(n?` is-selected`:``),cx:e.p.x,cy:e.p.y,r:s===e.pid?r*1.28:r,fill:t.fill,stroke:n?`#202433`:t.line,strokeWidth:fe(n?2:1),role:`button`,tabIndex:0,"aria-label":`Open ${e.title}`,onMouseEnter:()=>c(e.pid),onMouseLeave:()=>c(t=>t===e.pid?null:t),onFocus:()=>c(e.pid),onBlur:()=>c(t=>t===e.pid?null:t),onClick:()=>{S.current||o(e.pid)},onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(e.pid))},children:(0,B.jsx)(`title`,{children:e.title})},e.pid)})]}),N&&N.ordered.map((e,t)=>{let n=m9(e.p,h);return(0,B.jsxs)(`g`,{className:`cg-map-stopno`,transform:`translate(${n.x.toFixed(2)} ${(n.y-13).toFixed(2)})`,children:[(0,B.jsx)(`circle`,{r:7.5}),(0,B.jsx)(`text`,{textAnchor:`middle`,dy:`3.4`,children:t+1})]},e.pid)}),le&&(()=>{let e=m9(le.p,h),t=[];n&&t.push(`${n.label}: ${pp(n,le.colorVal)||`—`}`),r&&t.push(`${r.label}: ${pp(r,le.sizeVal)||`—`}`);let i=le.title||`(untitled)`,a=Math.max(i.length,...t.map(e=>e.length))*6.2+20,o=21+t.length*14,s=hWe(e.x,e.y,a,o,g9,_9);return(0,B.jsxs)(`g`,{className:`cg-map-card`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:s.x,y:s.y,width:a,height:o,rx:5}),(0,B.jsx)(`text`,{className:`cg-map-card-t`,x:s.x+10,y:s.y+15,children:i}),t.map((e,t)=>(0,B.jsx)(`text`,{className:`cg-map-card-l`,x:s.x+10,y:s.y+15+14*(t+1),children:e},t))]})})(),ue&&(0,B.jsx)(`rect`,{className:`cg-map-marquee`,x:ue.x0,y:ue.y0,width:ue.x1-ue.x0,height:ue.y1-ue.y0})]}),(0,B.jsxs)(`div`,{className:`cg-map-ctl`,role:`group`,"aria-label":`Map camera`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:h.k>=O*.999999999?`Zoom in — at the limit. The basemap's detail ends here; use Open in Google Maps for street level.`:`Zoom in (+)`,"aria-label":`Zoom in`,disabled:h.k>=O*.999999999,onClick:()=>re(1.6),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M8 3.6v8.8M3.6 8h8.8`})})}),(0,B.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Zoom out (−)`,"aria-label":`Zoom out`,disabled:h.k<=D*1.000000001,onClick:()=>re(1/1.6),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M3.6 8h8.8`})})}),(0,B.jsx)(`button`,{type:`button`,className:`cg-map-ctl-b`,title:`Fit to data (0)`,"aria-label":`Fit to data`,onClick:F,children:(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M2.6 5.8V2.6h3.2M10.2 2.6h3.2v3.2M13.4 10.2v3.2h-3.2M5.8 13.4H2.6v-3.2`}),(0,B.jsx)(`path`,{d:`M6.6 8h2.8M8 6.6v2.8`})]})}),(0,B.jsx)(`a`,{className:`cg-map-ctl-b`,href:he,target:`_blank`,rel:`noopener noreferrer`,title:`Open this area in Google Maps (new tab)`,"aria-label":`Open this area in Google Maps`,children:(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M7 3.8H4.3a.9.9 0 0 0-.9.9v6.9a.9.9 0 0 0 .9.9h6.9a.9.9 0 0 0 .9-.9V9.2`}),(0,B.jsx)(`path`,{d:`M8.6 3.4h4v4M12.6 3.4 7.4 8.6`})]})})]}),(k||_e)&&(0,B.jsxs)(`div`,{className:`cg-map-legends`,children:[n&&k&&(0,B.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,B.jsx)(`div`,{className:`cg-map-legend-t`,children:n.label}),k.order.slice(0,v9.length+1).map(e=>{let t=e===``?y9:k.swatch.get(e)??y9;return(0,B.jsxs)(`div`,{className:`cg-map-legend-row`,children:[(0,B.jsx)(`span`,{className:`cg-map-swatch`,style:{background:t.fill,borderColor:t.line}}),(0,B.jsx)(`span`,{className:`cg-map-legend-k`,children:e===``?`(blank)`:e}),(0,B.jsx)(`span`,{className:`cg-map-legend-n`,children:(k.counts.get(e)??0).toLocaleString()})]},e||`(blank)`)}),k.overflow>0&&(0,B.jsxs)(`div`,{className:`cg-map-legend-note`,children:[k.overflow.toLocaleString(),` further value`,k.overflow===1?` is`:`s are`,` drawn grey — the palette holds `,v9.length,` colours and reusing one would make two values look like the same value.`]})]}),r&&A&&(0,B.jsxs)(`div`,{className:`cg-map-legend`,children:[(0,B.jsx)(`div`,{className:`cg-map-legend-t`,children:r.label}),_e?(0,B.jsx)(`div`,{className:`cg-map-sizerow`,children:_e.map((e,t)=>(0,B.jsxs)(`span`,{className:`cg-map-sizeitem`,children:[(0,B.jsx)(`svg`,{width:32,height:32,"aria-hidden":!0,children:(0,B.jsx)(`circle`,{cx:16,cy:16,r:TWe(e,A.min,A.max,EWe,DWe,kWe),fill:b9.fill,stroke:b9.line})}),(0,B.jsx)(`span`,{className:`cg-map-legend-k`,children:pp(r,e)})]},t))}):(0,B.jsxs)(`div`,{className:`cg-map-legend-note`,children:[`Every mapped record has the same `,r.label.toLowerCase(),`, so the bubbles cannot differ in size.`]}),A.missing>0&&(0,B.jsxs)(`div`,{className:`cg-map-legend-note`,children:[A.missing.toLocaleString(),` mapped record`,A.missing===1?` has`:`s have`,` no value — drawn at the smallest dot, never removed from the map.`]})]})]})]})]})}function NWe(e,t){let n=e.trim().toLowerCase();return t.find(e=>e.trim().toLowerCase()===n)}function PWe(e){let t=e.trim().replace(/[$,%\s]/g,``);if(t===``)return``;let n=Number(t);return Number.isFinite(n)?String(n):void 0}function FWe(e,t,n=Ed(e)){let r=t.replace(/\r/g,``),i=r.trim();switch(e.type){case`formula`:case`created_time`:case`status`:return;case`checkbox`:{if(i===``)return``;let e=i.toLowerCase();return[`1`,`true`,`yes`,`y`,`on`,`checked`,`x`].includes(e)?`1`:[`0`,`false`,`no`,`n`,`off`,`unchecked`].includes(e)?``:void 0}case`int`:case`currency`:case`pct`:return PWe(r);case`rating`:{if(i===``)return``;let t=Number(i);return Number.isInteger(t)&&t>=1&&t<=Dd(e)?String(t):void 0}case`select`:case`user`:return i===``?``:NWe(i,n);case`multiselect`:{if(i===``)return``;let e=[],t=new Set;for(let i of r.split(/[,\n]/)){if(!i.trim())continue;let r=NWe(i,n);if(!r)return;let a=r.toLowerCase();t.has(a)||(t.add(a),e.push(r))}return e.length?e.join(`,`):``}case`date`:return i===``||!Number.isNaN(Date.parse(i))?i:void 0;default:return r}}function IWe(e){return e.length>0&&e.every(e=>e.length===1)}var x9={fieldKey:null,armedUntil:0};function LWe(e,t){return{fieldKey:e,armedUntil:t+1e3}}function RWe(e,t){return t<=e.armedUntil?{...e,armedUntil:0}:x9}function zWe({field:e,sourceFieldKey:t,editable:n,values:r,targetPids:i,allowedChoices:a}){if(!n||!IWe(r)||t&&t!==e.key||i.length!==r.length||i.some(e=>e==null))return null;let o=[];for(let t=0;te.trim()).filter(e=>e!==``)}function XWe(e,t){for(let n of e)if(Yd(n)){if(XWe(n.children,t))return!0}else if(n.colId===t)return!0;return!1}function ZWe(e,t){let n=[];for(let r of e)if(Yd(r)){let e=ZWe(r.children,t);e.length&&n.push({...r,children:e})}else r.colId!==t&&n.push(r);return n}function k9(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``).slice(0,28)||`field`}function QWe(e,t,n,r){let i=`custom_${k9(e)}_${Math.random().toString(36).slice(2,7)}`;return t===`formula`||t===`created_time`?{key:i,label:e,type:t,source:`odoo`,derived:!0,filterable:!0,default:!0,custom:!0,...t===`formula`?{agg:`sum`,...r?.formula?{formula:r.formula}:{}}:{}}:{key:i,label:e,type:t,source:`overlay`,default:!0,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}}}function $We({scope:e=`customer`}={}){let{fields:t,rawRows:n,payload:r,loading:i,overlayEdits:a,setOverlayEdits:o,patchOverlay:s}=_te(e),[c,l]=(0,L.useState)([]),[u,d]=(0,L.useState)([]),[f,p]=(0,L.useState)(C9),[m,h]=(0,L.useState)(()=>Mf([])),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(`saved`),[b,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(new Set),[w,T]=(0,L.useState)(void 0),[E,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(null),[M,ee]=(0,L.useState)(null),N=(0,L.useCallback)(()=>{ee(null),requestAnimationFrame(()=>Te.current?.focus())},[]),[te,ne]=(0,L.useState)(!1),[P,re]=(0,L.useState)(``),F=(0,L.useRef)(null),[ie,ae]=(0,L.useState)(null),[oe,se]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(``),[ue,de]=(0,L.useState)(new Set),fe=(0,L.useRef)(null),[pe,me]=(0,L.useState)(null),[he,ge]=(0,L.useState)(null),_e=(0,L.useRef)({edited:{},deleted:{}}),[ve,ye]=(0,L.useState)(null),[be,xe]=(0,L.useState)(null),Se=(0,L.useRef)({}),Ce=(0,L.useRef)(null),we=(0,L.useRef)(null),Te=(0,L.useRef)(null),Ee=(0,L.useRef)(null),De=(0,L.useRef)(x9);(0,L.useEffect)(()=>{let e=()=>{De.current=RWe(De.current,Date.now())},t=()=>{De.current=x9};return document.addEventListener(`copy`,e,!0),window.addEventListener(`blur`,t),()=>{document.removeEventListener(`copy`,e,!0),window.removeEventListener(`blur`,t)}},[]);let[Oe,ke]=(0,L.useState)({width:800,height:600}),Ae=r?.workspace?.storageKey??`customer-grid-standalone`;(0,L.useEffect)(()=>{if(!r||t.length===0||Ce.current===Ae)return;let e=KWe(Ae),n=af(e?.fieldStamps,Date.now());_e.current={edited:{...n.edited??{}},deleted:{...n.deleted??{}}};let i=ote(t,e?.fields??[],n,Date.now(),r.workspace!=null),a=r.workspace?.views??[],o=new Map;o.set(C9,GWe(i));for(let t of e?.views??[])o.set(t.id,t);let s=new Map;for(let t of a){let n=ite(t,o.get(t.id),e?.savedAt,Date.now()),r=rte(n,t,e?.reemitted?.[t.id]);r!==null&&s.set(t.id,r),o.set(t.id,n)}let c=[...o.values()].map(e=>({...e,config:O9(e.config,i)})),u=e?.activeViewId??r.workspace?.activeViewId??C9,f=c.find(e=>e.id===u)??c[0];if(l(i),d(c),p(f.id),h(f.config),_(!0),Ce.current=Ae,s.size>0){let t={...e?.reemitted??{}};for(let e of c){let n=s.get(e.id);n!==void 0&&(Gu({id:Ku(`view`),type:`view_upsert`,view:e}),t[e.id]=n)}Se.current=t}else Se.current={...e?.reemitted??{}}},[r,t,Ae]),(0,L.useEffect)(()=>{g&&qWe(Ae,{fields:c,views:u,activeViewId:f,savedAt:Date.now(),fieldStamps:af(_e.current,Date.now()),reemitted:Se.current})},[g,Ae,c,u,f]);let je=(0,L.useCallback)(e=>{let t=af(_e.current,Date.now());_e.current={edited:{...t.edited??{},[e]:Date.now()},deleted:{...t.deleted??{}}}},[]),Me=(0,L.useCallback)(e=>{let t=af(_e.current,Date.now()),n={...t.edited??{}};delete n[e],_e.current={edited:n,deleted:{...t.deleted??{},[e]:Date.now()}}},[]),Ne=(0,L.useCallback)(e=>{e.groupBy!==m.groupBy&&C(new Set),h(e)},[m.groupBy]),{visibleCols:Pe,fieldByKey:Fe,order:Ie,visible:Le,lockedKey:Re,onColumnResize:ze,onColumnMoved:Be,onColumnProposeMove:Ve,setColumnVisible:He,insertColumn:Ue}=sne(c,m,Ne);(0,L.useEffect)(()=>{if(!g)return;let e=u.find(e=>e.id===f);if(!e||D9(e.config,m)){y(`saved`);return}return y(`saving`),we.current!==null&&window.clearTimeout(we.current),we.current=window.setTimeout(()=>{let t={...e,config:m};d(e=>e.map(e=>e.id===t.id?t:e)),Gu({id:Ku(`view`),type:`view_upsert`,view:t}),y(`saved`),we.current=null},420),()=>{we.current!==null&&window.clearTimeout(we.current)}},[g,f,m,u]),(0,L.useLayoutEffect)(()=>{let e=Ee.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();t.width>0&&t.height>0&&ke({width:Math.floor(t.width),height:Math.floor(t.height)})};t();let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[g]);let We=tte(r?.counts)===`server-windowed`,Ge=r?.workspace?.hideViews===!0,Ke=Ad(m.display),qe=We?`grid`:Ke?.mode??`grid`,Je=(0,L.useMemo)(()=>r?.measures??[],[r?.measures]),Ye=(0,L.useRef)({}),Xe=(0,L.useMemo)(()=>{let e=r?.measureSets;if(e){let t={};for(let[n,r]of Object.entries(e))t[n]=new Set(r);Ye.current=t}return Ye.current},[r?.measureSets]),Ze=(0,L.useMemo)(()=>qf(m.filters,Xe),[m.filters,Xe]),Qe=(0,L.useMemo)(()=>Jf(m.filters).join(`,`),[m.filters]),$e=(0,L.useMemo)(()=>Object.keys(Xe).join(`,`),[Xe]),et=(0,L.useMemo)(()=>r?.workspace?.lists??[],[r?.workspace?.lists]),tt=(0,L.useMemo)(()=>{let e={};for(let t of et)t.pids&&(e[t.id]=new Set(t.pids));return e},[et]),nt=r?.today,rt=r?.viewer,it=(0,L.useCallback)(e=>Md(e,rt),[rt]),at=(0,L.useMemo)(()=>Yf(m.filters,{cohortSets:tt,today:nt}),[m.filters,tt,nt]),ot=(0,L.useMemo)(()=>{let e=new Map;for(let t of c){if(t.type!==`formula`)continue;let n=Mee(t);n&&e.set(t.key,n)}let{order:t,cyclic:n}=mUe(e),r=[];for(let i of t){if(n.has(i))continue;let t=L7(e.get(i));t.ok&&r.push({key:i,ast:t.ast})}return r},[c]),st=(0,L.useMemo)(()=>c.filter(e=>e.type===`created_time`).map(e=>e.key),[c]),ct=(0,L.useMemo)(()=>{if(ot.length===0&&st.length===0)return n;let e={today:r?.today};return n.map(t=>{let n=a[t.pid],r=n?{...t,...n}:{...t},i={...t};for(let e of st)i[e]=t._created??null,r[e]=i[e];for(let{key:t,ast:n}of ot){let a=pUe(n,e=>r[e],e);i[t]=a,r[t]=a}return i})},[n,a,ot,st,r?.today]),lt=r?.workspace?.cohortMode===!0;(0,L.useEffect)(()=>{lt&&(ie&&et.some(e=>e.id===ie)||ae(et[0]?.id??null))},[lt,et,ie]);let ut=lt?et.find(e=>e.id===ie)??null:null,dt=(0,L.useMemo)(()=>new Set(ut?.pids??[]),[ut]),{visibleRows:ft,pidToIndex:pt}=bne((0,L.useMemo)(()=>lt?ct.filter(e=>dt.has(e.pid)):ct,[lt,ct,dt]),c,m.filters,b,m.sorts,We?null:m.groupBy,S,m.memberPids,m.filterConj,We,Xe,tt,nt,m.cohortLock),[mt,ht]=(0,L.useState)(E9),gt=ft.length>mt,_t=(0,L.useMemo)(()=>gt?ft.slice(0,mt):ft,[gt,ft,mt]),vt=(0,L.useMemo)(()=>{if(!gt)return pt;let e=new Map;return _t.forEach((t,n)=>{t.kind===`data`&&!e.has(t.record.pid)&&e.set(t.record.pid,n)}),e},[gt,_t,pt]),[yt,bt]=(0,L.useState)(0);(0,L.useEffect)(()=>(gp(()=>bt(e=>e+1)),()=>gp(void 0)),[]);let xt=r?.workspace?.userAvatars,St=Fne(_t,Pe,Fe,a,it,xt,yt,(0,L.useMemo)(()=>{if(!m.groupBy)return null;let e=Math.min(VWe(m),Pe.length),t=0;for(let n=0;nIe.map(e=>Fe.get(e)).filter(e=>!!e),[Ie,Fe]),jt=Ct.current?.cell[1],Mt=(0,L.useMemo)(()=>{let e={};for(let t of c){if(t.type===`select`||t.type===`multiselect`){e[t.key]=Ed(t);continue}if(t.type===`user`){e[t.key]=r?.userOptions??[];continue}t.type===`status`&&(e[t.key]=[...new Set(n.map(e=>e[t.key]).filter(e=>e!=null&&e!==``).map(String))].sort())}return e},[c,n,r?.userOptions]),Nt=BWe[m.rowHeightMode],Pt=pt.size,Ft=vt.size,It=(0,L.useCallback)(e=>{let t=_t[e];if(!(!t||t.kind!==`data`))return e===w?m.colorBy?Pte[String(t.record[m.colorBy]??``).toLowerCase()]??Ite:Ite:m.colorBy?Nte[String(t.record[m.colorBy]??``).toLowerCase()]:e===jt?Lte:void 0},[_t,m.colorBy,w,jt]),Lt=(0,L.useCallback)(e=>{let t=e.kind===`cell`?e.location[1]:void 0;T(e=>e===t?e:t);let n=t===void 0?void 0:_t[t];if(e.kind===`cell`&&n?.kind===`data`&&t!==void 0){let e=n.record.pid,r=Te.current?.getBounds(0,t),i=r?Zte(r,Ee.current?.getBoundingClientRect()):null;D(t=>i?t&&t.pid===e&&t.x===i.x&&t.y===i.y?t:{pid:e,x:i.x,y:i.y,size:i.size}:null)}if(e.kind===`header`){let t=Pe[e.location[0]],n=t?Fe.get(t.id):void 0,r=n?n.note||n.description:void 0,i=n&&t&&t.title!==n.label&&n?r?`${n.label} — ${r}`:n.label:r,a=e.bounds;if(i&&a){ye(e=>e&&e.text===i&&e.x===a.x?e:{text:i,x:a.x,y:a.y+a.height+4});return}}if(ye(e=>e===null?e:null),e.kind===`cell`&&t!==void 0){let n=_t[t],r=Pe[e.location[0]];if(n?.kind===`data`&&r){let t=Fe.get(r.id),i=t?pp(t,n.record[t.key]):``,a=e.bounds,o=a?qte(i,HWe(i),a.width):null;if(o&&a){let e=Jte(a.x,window.innerWidth,HWe(o)+20),t=a.y+a.height+4;xe(n=>n&&n.text===o&&n.x===e&&n.y===t?n:{text:o,x:e,y:t});return}}}xe(e=>e===null?e:null)},[Pe,Fe,_t]),Rt=(0,L.useMemo)(()=>m.groupBy?e=>_t[e]?.kind===`group-header`?32:Nt:Nt,[m.groupBy,Nt,_t]),zt=qe===`calendar`||qe===`kanban`||qe===`map`,Bt=zt?ft:_t,Vt=O===null?void 0:(zt?pt:vt).get(O);(0,L.useEffect)(()=>{O!==null&&Vt===void 0&&k(null)},[O,Vt]);let Ht=(0,L.useMemo)(()=>{if(Vt===void 0)return null;let e=Bt[Vt];return!e||e.kind!==`data`?null:a[e.record.pid]?{...e.record,...a[e.record.pid]}:e.record},[Vt,Bt,a]),Ut=(0,L.useMemo)(()=>Vt===void 0?0:Bt.slice(0,Vt+1).filter(e=>e.kind===`data`).length,[Vt,Bt]),Wt=(0,L.useCallback)(e=>{if(Vt===void 0)return!1;for(let t=Vt+e;t>=0&&t{if(Vt!==void 0)for(let t=Vt+e;t>=0&&t{let n=e.column.id?Fe.get(e.column.id):void 0;if(e.ctx.font=`${e.theme.headerFontStyle} ${e.theme.fontFamily}`,t(),!n)return;let r=!!(n.note||n.description),i=n.source===`overlay`,a=Df(e.rect,e.menuBounds.width,Of(r,i));if(!a)return;let o=0;if(r){let t=a[o++];e.spriteManager.drawSprite(`aiosInfo`,`normal`,e.ctx,t.x,t.y,t.size,e.theme)}if(i){let t=a[o++],n=e.ctx;n.save(),n.beginPath(),n.arc(t.x+t.size/2,t.y+t.size/2,t.size/2,0,Math.PI*2),n.fillStyle=zte,n.fill(),n.restore()}},[Fe]),qt=(0,L.useCallback)((e,t)=>{let n=_t[e[1]];if(!n)return;if(zu(Ru),n.kind===`group-header`){t.preventDefault(),C(e=>{let t=new Set(e);return t.has(n.groupKey)?t.delete(n.groupKey):t.add(n.groupKey),t});return}let r=Pe[e[0]],i=r?Fe.get(r.id):void 0;if(n.kind===`data`&&i&&it(i)&&(wd(i.type)||i.type===`rating`)){t.preventDefault(),Ot(e[0],e[1]);let r=t.bounds;ee({pid:n.record.pid,fieldKey:i.key,anchor:{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height,width:r.width,height:r.height}});return}if(n.kind===`data`&&i?.type===`url`){let e=String(a[n.record.pid]?.[i.key]??n.record[i.key]??``).trim();if(e){let n=/^https?:\/\//i.test(e)?e:/^[\w-]+(\.[\w-]+)+/.test(e)?`https://${e}`:null;if(n){t.preventDefault(),window.open(n,`_blank`,`noopener`);return}}}n.kind===`data`&&i&&i.key===Re&&Dt(n.record.pid)},[_t,Pe,Fe,it,a,Re,Dt,Ot]),Jt=(0,L.useCallback)(e=>{let t=_t[e[1]],n=Pe[e[0]],r=n?Fe.get(n.id):void 0;t?.kind===`data`&&r?.source!==`overlay`&&k(t.record.pid)},[_t,Pe,Fe]),Yt=(0,L.useCallback)((e,t)=>{let n=_t[e[1]],r=Pe[e[0]],i=r?Fe.get(r.id):void 0;if(!(!n||n.kind!==`data`||!i||!it(i))){if(t.kind===I.Boolean&&i.type===`checkbox`){s(n.record.pid,{[i.key]:t.data?`1`:``});return}if(t.kind===I.Uri){s(n.record.pid,{[i.key]:t.data??``});return}(t.kind===I.Text||t.kind===I.Number)&&s(n.record.pid,{[i.key]:t.data})}},[_t,Pe,Fe,s,it]),Xt=(0,L.useCallback)(e=>{let t=_t[e[1]],n=Pe[e[0]],r=n?Fe.get(n.id):void 0;return!!t&&t.kind===`data`&&!!r&&it(r)&&!wd(r.type)&&r.type!==`rating`&&r.type!==`status`},[_t,Pe,Fe,it]),Zt=(0,L.useCallback)((e,t)=>{let n=Pe[e[0]],r=n?Fe.get(n.id):void 0;if(!r)return!1;let i=t.map((t,n)=>{let r=_t[e[1]+n];return r?.kind===`data`?r.record.pid:null}),a=zWe({field:r,sourceFieldKey:De.current.fieldKey,editable:it(r),values:t,targetPids:i,allowedChoices:Mt[r.key]??Ed(r)});if(!a)return!1;for(let e of a)s(e.pid,{[r.key]:e.value});return!1},[Pe,Fe,it,Mt,_t,s]),Qt=(0,L.useCallback)((e,t)=>{let n=Pe[e];n?.id&&j({fieldKey:n.id,anchor:{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height,width:t.width,height:t.height}})},[Pe]),$t=(0,L.useCallback)((e,t)=>{t.isEdge||(t.preventDefault(),Qt(e,t.bounds))},[Qt]),en=(0,L.useCallback)(e=>{if(e.key.toLowerCase()===`c`&&(e.ctrlKey||e.metaKey)&&!e.altKey){let e=Ct.current?.range,t=e?.width===1?Pe[e.x]:void 0;De.current=LWe(t?.id??null,Date.now());return}if(e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=Ct.current?.cell;if(t){e.preventDefault(),e.stopPropagation(),e.cancel();let n=_t[t[1]],r=Pe[t[0]],i=r?Fe.get(r.id):void 0;if(!e.shiftKey&&n?.kind===`data`&&i&&it(i)&&(wd(i.type)||i.type===`rating`)){let e=Te.current?.getBounds(t[0],t[1]);if(e){ee({pid:n.record.pid,fieldKey:i.key,anchor:{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height,width:e.width,height:e.height}});return}}let a=e.shiftKey?-1:1,o=t[1]+a;for(;o>=0&&o<_t.length&&_t[o]?.kind!==`data`;)o+=a;o>=0&&o<_t.length&&(Ot(t[0],o),Te.current?.scrollTo(t[0],o,`vertical`,0,0));return}}let t=e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey,n=e.location&&e.location[0]>0?e.location[0]-1:void 0,r=Ct.current?.cell[0]??n;if(!t||r===void 0||!e.bounds)return;let i=Ee.current?.getBoundingClientRect()?.top??e.bounds.y;e.preventDefault(),e.stopPropagation(),e.cancel(),Qt(r,{x:e.bounds.x,y:i,width:e.bounds.width,height:36})},[Ct.current,Qt,_t,Ot,Pe,Fe,it]),tn=(0,L.useCallback)(e=>{d(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),Gu({id:Ku(`view`),type:`view_upsert`,view:e})},[]),nn=(0,L.useCallback)((e,t)=>{let n=u.find(t=>t.id===e);if(!n)return;let r={...n.config};t?r.cohortLock=t:delete r.cohortLock,tn({...n,config:r}),e===f&&h(e=>{let n={...e};return t?n.cohortLock=t:delete n.cohortLock,n})},[u,f,tn]),rn=(0,L.useCallback)(e=>{let t=u.find(e=>e.id===f);t&&!D9(t.config,m)&&tn({...t,config:m});let n=u.find(t=>t.id===e);n&&(p(e),h(O9(n.config,c)),C(new Set),x(``),k(null),ht(E9),Gu({id:Ku(`view`),type:`view_select`,viewId:e}),zu(Ru))},[u,f,m,tn,c]),an=(0,L.useCallback)((e,t,n)=>{let r=Td(e,u.map(e=>e.name)),i={...m,display:Ad({...m.display??{},mode:t})},a={id:JWe(),name:r,kind:`custom`,config:i,permissions:n};tn(a),p(a.id),h(i),y(`saved`)},[m,tn,u]),R=(0,L.useCallback)((e,t)=>{let n=u.find(t=>t.id===e);if(n){let r=Td(t,u.filter(t=>t.id!==e).map(e=>e.name));tn({...n,name:r})}},[u,tn]),on=(0,L.useCallback)((e,t)=>{let n=u.find(t=>t.id===e);!n||!$d(n,rt)||tn({...n,locked:t})},[u,tn,rt]),sn=(0,L.useCallback)((e,t)=>{let n=u.find(t=>t.id===e);n&&tn({...n,note:t.slice(0,2e3)})},[u,tn]),cn=(0,L.useCallback)(e=>{let t=u.find(t=>t.id===e);if(!t)return;let n={...t,id:JWe(),name:Td(`${t.name} copy`,u.map(e=>e.name)),kind:`custom`,locked:!1,permissions:{edit:`personal`},createdBy:void 0,config:{...t.config}};tn(n),p(n.id),h(n.config)},[u,tn]),ln=(0,L.useCallback)(e=>{let t=u.find(t=>t.id===e);if(!(!t||Xd(t)||!tf(t,rt))&&(d(t=>t.filter(t=>t.id!==e)),Gu({id:Ku(`view-delete`),type:`view_delete`,viewId:e}),f===e)){let e=u.find(e=>e.id===C9)??GWe(c);p(e.id),h(e.config)}},[u,f,c,rt]);(0,L.useEffect)(()=>{if(!lt||!g||!ie)return;let e=`cohort:${ie}`;if(f===e)return;let t=u.find(e=>e.id===f);t&&!D9(t.config,m)&&tn({...t,config:m});let n=u.find(t=>t.id===e),r=n??{id:e,name:et.find(e=>e.id===ie)?.name??`Cohort`,kind:`custom`,config:Mf(c)};n||d(e=>[...e,r]),p(e),h(O9(r.config,c)),C(new Set),x(``)},[lt,g,ie,f,u,m,c,et,tn]);let un=(0,L.useCallback)((e,t,n)=>{if(We)return;let r=u.find(t=>t.id===e);if(!r||qf(r.config.filters,Xe)>0)return;let{visibleRows:i}=Zf({rawRows:ct,fields:c,filters:r.config.filters,search:``,sorts:r.config.sorts,groupBy:null,collapsed:new Set,memberPids:r.config.memberPids,filterConj:r.config.filterConj??`and`,measureSets:Xe,cohortSets:tt,today:nt}),a=i.filter(e=>e.kind===`data`).map(e=>e.record.pid);Gu({id:Ku(`addlist`),type:`add_to_list`,viewId:e,cohortId:t,name:n,pids:a})},[u,ct,c,We,Xe,tt,nt]),[dn,fn]=(0,L.useState)({}),[pn,z]=(0,L.useState)({}),[mn,hn]=(0,L.useState)([]),[gn,_n]=(0,L.useState)([]),vn=r?.workspace?.folders,yn=(0,L.useMemo)(()=>ZHe(vn,mn,dn,Date.now()),[vn,mn,dn]),bn=(0,L.useCallback)(e=>QHe(e,u.find(t=>t.id===e)?.folderId??null,yn,dn,Date.now()),[u,yn,dn]),xn=(0,L.useCallback)(e=>{fn(t=>XHe(e(t),Date.now()))},[]),Sn=r?.workspace?.cohortFolders,Cn=(0,L.useMemo)(()=>ZHe(Sn,gn,pn,Date.now()),[Sn,gn,pn]),wn=(0,L.useCallback)(e=>QHe(e,et.find(t=>t.id===e)?.folderId??null,Cn,pn,Date.now()),[et,Cn,pn]),Tn=(0,L.useCallback)(e=>{z(t=>XHe(e(t),Date.now()))},[]),En=(0,L.useCallback)((e,t,n)=>{let r=new Set;for(let t of et)if(wn(t.id)===e)for(let e of t.pids??[])r.add(e);r.size!==0&&Gu({id:Ku(`addlist`),type:`add_to_list`,viewId:``,cohortId:t,name:n,pids:[...r]})},[et,wn]),Dn=(0,L.useCallback)(e=>{let t=new Set,n=[],r=0;for(let i of u){if(bn(i.id)!==e)continue;if(We){n.push({name:i.name,why:`this table loads one page at a time`});continue}if(qf(i.config.filters,Xe)>0){n.push({name:i.name,why:`a metric condition has no answer yet`});continue}r+=1;let{visibleRows:a}=Zf({rawRows:ct,fields:c,filters:i.config.filters,search:``,sorts:i.config.sorts,groupBy:null,collapsed:new Set,memberPids:i.config.memberPids,filterConj:i.config.filterConj??`and`,measureSets:Xe,cohortSets:tt,today:nt});for(let e of a)e.kind===`data`&&t.add(e.record.pid)}return{pids:[...t],counted:r,skipped:n}},[u,bn,We,ct,c,Xe,tt,nt]),On=(0,L.useCallback)((e,t,n)=>{let{pids:r}=Dn(e);r.length&&Gu({id:Ku(`addlist`),type:`add_to_list`,viewId:``,cohortId:t,name:n,pids:r})},[Dn]),kn=(0,L.useCallback)((e,t,n,r)=>{if(We||qf(t.filters,Xe)>0)return;let{visibleRows:i}=Zf({rawRows:n,fields:c,filters:t.filters,search:``,sorts:t.sorts,groupBy:null,collapsed:new Set,memberPids:t.memberPids,filterConj:t.filterConj??`and`,measureSets:Xe,cohortSets:tt,today:nt}),o=i.filter(e=>e.kind===`data`).map(e=>a[e.record.pid]?{...e.record,...a[e.record.pid]}:e.record),s=new Set(t.order),l=[...t.order,...c.map(e=>e.key).filter(e=>!s.has(e))],u=new Set(t.visible),d=l.filter(e=>u.has(e)).map(e=>Fe.get(e)).filter(e=>!!e);pie(r,e,nt,d,o)},[We,c,Fe,Xe,tt,nt,a]),An=(0,L.useCallback)((e,t)=>{let n=u.find(t=>t.id===e);n&&kn(n.name,O9(n.config,c),ct,t)},[u,c,ct,kn]),jn=(0,L.useCallback)((e,t)=>{let n=et.find(t=>t.id===e);if(!n)return;let r=u.find(t=>t.id===`cohort:${e}`),i=new Set(n.pids??[]);kn(n.name,O9(r?.config,c),ct.filter(e=>i.has(e.pid)),t)},[et,u,c,ct,kn]),Mn=(0,L.useCallback)((e,t)=>{let n=[...wt];!n.length||We||(Gu({id:Ku(`addlist`),type:`add_to_list`,viewId:f,cohortId:e,name:t,pids:n}),ne(!1),re(``),kt())},[wt,We,f,kt]),Nn=r?.workspace?.scopeChoice===!0,Pn=(0,L.useMemo)(()=>{let e=m.cohortLock;if(!e)return;let t=et.find(t=>t.id===e);return t?{name:t.name,count:t.pids?.length??0}:{}},[m.cohortLock,et]),Fn=r?.workspace?.recordLayout?.order,In=(0,L.useCallback)(e=>{Gu({id:Ku(`rlayout`),type:`record_layout`,order:e})},[]),Ln=(0,L.useCallback)((e,t)=>{let n=Ku(`field`),r={...e,label:Td(e.label,c.filter(t=>t.key!==e.key).map(e=>e.label)),editRequestId:n};delete r.labelCorrectedFrom,delete r.labelCorrectionId,je(r.key),l(e=>e.some(e=>e.key===r.key)?e.map(e=>e.key===r.key?r:e):[...e,r]),Gu({id:n,type:`field_upsert`,field:r,...t?{scope:t}:{}})},[je,c]),Rn=(0,L.useCallback)((e,t,n,r,i,a,o)=>{let s=Nn?o?.scope:void 0,c=s===`cohort`?{scope:`cohort`}:{};if(a){let i={key:`measure_${k9(e)}_${Math.random().toString(36).slice(2,7)}`,label:e,type:t,source:`odoo`,default:!0,custom:!0,derived:!0,filterable:!1,agg:[`currency`,`int`].includes(t)?`sum`:void 0,measure:a,...c};Ln(i,s),Ue(i.key,n,r);return}let l={...QWe(e,t,i,o),...c};Ln(l,s),Ue(l.key,n,r)},[Ue,Ln,Nn]),zn=(0,L.useCallback)((e,t)=>{if(e===Re||e===t||!Fe.has(t))return;let n=Ie.filter(e=>e!==t),r=n.indexOf(e);if(r<0)return;n.splice(r,0,t);let i=new Set(Le);i.delete(e),i.add(t),Ne({...m,order:n,visible:[...i]})},[m,Ne,Ie,Le,Fe,Re]),Bn=(0,L.useCallback)(e=>{if(!Fe.get(e)?.custom||e===Re)return;l(t=>t.filter(t=>t.key!==e));let t={...m.widths??{}};delete t[e],Ne({...m,order:Ie.filter(t=>t!==e),visible:[...Le].filter(t=>t!==e),widths:t,sorts:(m.sorts??[]).filter(t=>t.colId!==e),groupBy:m.groupBy===e?null:m.groupBy,colorBy:m.colorBy===e?null:m.colorBy}),Me(e),Gu({id:Ku(`fielddel`),type:`field_delete`,key:e})},[m,Ne,Ie,Le,Fe,Re,Me]),Vn=(0,L.useCallback)((e,t,n,r,i)=>{let a=Nn?i?.scope:void 0,o={...QWe(t,n,r,i),...a===`cohort`?{scope:`cohort`}:{}};Ln(o,a),zn(e,o.key)},[Ln,zn,Nn]),Hn=(0,L.useCallback)((e,t,n,r)=>{let i=Fe.get(e);if(!i?.custom||i.source!==`overlay`||t===`formula`||t===`created_time`)return;let a=e=>e===`int`||e===`currency`,o=i.format&&(a(i.type)&&a(t)||i.type===t),s={key:e,label:r?.label?.trim()||i.label,type:t,source:`overlay`,default:i.default,custom:!0,agg:[`currency`,`int`].includes(t)?`sum`:void 0,...i.note?{note:i.note}:{},...i.description?{description:i.description}:{},...i.scope?{scope:i.scope}:{},...i.createdBy?{createdBy:i.createdBy}:{},...i.permissions?{permissions:i.permissions}:{},...o?{format:i.format}:{},...(t===`select`||t===`multiselect`)&&n?.length?{options:n}:{},...t===`select`||t===`multiselect`?{colorCodeOptions:r?.colorCodeOptions!==!1,...r?.optionColors&&Object.keys(r.optionColors).length?{optionColors:r.optionColors}:{}}:{},...t===`multiselect`?{multi:!0}:{},...t===`rating`?{max:r?.max??5}:{}};Ln(s)},[Fe,Ln]),Un=(0,L.useCallback)(e=>{let t=e.key.startsWith(`measure_`)?`measure_`:`custom_`,n=Td(`${e.label} copy`,c.map(e=>e.label)),r=`${t}${k9(n)}_${Math.random().toString(36).slice(2,7)}`,i=Ku(`fielddup`),a={...e,key:r,label:n,editRequestId:i};delete a.createdBy,delete a.permissions,delete a.labelCorrectedFrom,delete a.labelCorrectionId,je(r),l(e=>[...e,a]),Gu({id:i,type:`field_duplicate`,sourceKey:e.key,key:r,label:n,...Nn&&e.scope===`cohort`?{scope:`cohort`}:{}}),Ue(r,e.key,`right`)},[Ue,Nn,je,c]),Wn=(0,L.useCallback)((e,t)=>{let n=Fe.get(e);if(!n?.measure)return;let r=Je.find(e=>e.key===n.measure?.key),i=r?`${r.label} · ${xd(n.measure.window)}`:null,a=r&&i&&n.label===i?`${r.label} · ${xd(t)}`:n.label;Ln({...n,label:a,measure:{...n.measure,window:t}})},[Fe,Je,Ln]),Gn=(0,L.useCallback)(e=>{ae(e),kt(),k(null),ht(E9),de(new Set),le(``),se(!1)},[kt]),Kn=(0,L.useCallback)(()=>{if(!ie)return;let e=[...wt].filter(e=>dt.has(e));e.length&&(Gu({id:Ku(`cohortrm`),type:`cohort_remove`,cohortId:ie,pids:e}),kt())},[ie,wt,dt,kt]),qn=(0,L.useCallback)((e,t)=>{let n=t.trim();n&&Gu({id:Ku(`cohortren`),type:`cohort_rename`,cohortId:e,name:n})},[]),Jn=(0,L.useCallback)(e=>{Gu({id:Ku(`cohortdel`),type:`cohort_delete`,cohortId:e}),ie===e&&(kt(),k(null),ht(E9))},[ie,kt]),Yn=(0,L.useCallback)(()=>{!ie||ue.size===0||(Gu({id:Ku(`cohortadd`),type:`cohort_add`,cohortId:ie,pids:[...ue]}),de(new Set),le(``),se(!1))},[ie,ue]),Xn=(0,L.useMemo)(()=>{if(!oe)return[];let e=ce.trim().toLowerCase(),t=[];for(let r of n){if(dt.has(r.pid))continue;let n=String(r[Re]??``);e&&!n.toLowerCase().includes(e)||t.push({pid:r.pid,name:n})}return t},[oe,ce,n,dt,Re]),Zn=(0,L.useMemo)(()=>Ie.filter(e=>Le.has(e)),[Ie,Le]),Qn=VWe(m),$n=(0,L.useCallback)(e=>{let t=Zn.indexOf(e);if(t<0)return;if(t<8){Ne({...m,frozenCount:jd(t+1)});return}let n=Zn.filter(t=>t!==e);n.splice(7,0,e);let r=0,i=Ie.map(e=>Le.has(e)?n[r++]:e);Ne({...m,order:i,frozenCount:8})},[Zn,Ie,Le,m,Ne]),er=(0,L.useCallback)(()=>Ne({...m,frozenCount:void 0}),[m,Ne]),tr=(0,L.useCallback)(e=>{let t=u.find(e=>e.id===f);if(t&&Qd(t))return;let n=Ad(m.display);if(e===`grid`){Ne({...m,display:n?Ad({...n,mode:`grid`}):void 0});return}Ne({...m,display:{...n??{},mode:e}})},[m,Ne,u,f]),nr=(0,L.useCallback)((e,t)=>{let n=Ad(m.display);if(!n)return;let r={...n,[e]:t};t||delete r[e],Ne({...m,display:r})},[m,Ne]),rr=(0,L.useCallback)(e=>{let t=Ad(m.display);if(!t)return;let n={...t};e===!1?n.kanbanClamp=!1:delete n.kanbanClamp,Ne({...m,display:n})},[m,Ne]),ir=(0,L.useCallback)(e=>{let t=Ad(m.display);if(!t)return;let n={...t},r=e.slice(0,4);r.length?n.calendarMetrics=r:delete n.calendarMetrics,Ne({...m,display:n})},[m,Ne]),ar=(0,L.useCallback)(e=>{let t=Ad(m.display);if(!t)return;let n={...t};e===`summary`?n.calendarMode=`summary`:delete n.calendarMode,Ne({...m,display:n})},[m,Ne]),or=(0,L.useMemo)(()=>c.filter(e=>Pd(e.type)),[c]),sr=(0,L.useMemo)(()=>c.filter(e=>e.type===`status`||e.type===`select`),[c]),cr=(e,t,n)=>(e?t.find(t=>t.key===e):void 0)||((n?t.find(e=>e.key===n):void 0)??t[0]),lr=(0,L.useMemo)(()=>LUe(Ke?.charts)??[],[Ke?.charts]),ur=(0,L.useCallback)(e=>{let t=Ad(m.display);if(!t)return;let n={...t,charts:e};e.length||delete n.charts,Ne({...m,display:n})},[m,Ne]),dr=(0,L.useMemo)(()=>c.filter(e=>e.type===`status`||e.type===`select`),[c]),fr=(0,L.useMemo)(()=>c.filter(e=>Nd(e.type)),[c]),pr=Ke?.colorField?dr.find(e=>e.key===Ke.colorField):void 0,mr=Ke?.sizeField?fr.find(e=>e.key===Ke.sizeField):void 0,hr=cr(Ke?.dateField,or,`last_order`),gr=cr(Ke?.stackField,sr),_r=(0,L.useMemo)(()=>{if(qe!==`calendar`&&qe!==`kanban`&&qe!==`map`&&qe!==`chart`&&qe!==`timeseries`)return[];let e=new Set,t=[];for(let n of ft){if(n.kind!==`data`||e.has(n.record.pid))continue;e.add(n.record.pid);let r=a[n.record.pid];t.push(r?{...n.record,...r}:n.record)}return t},[qe,ft,a]),vr=(0,L.useMemo)(()=>gr?Zn.filter(e=>e!==Re&&e!==gr.key).slice(0,3):[],[Zn,Re,gr]),yr=(0,L.useCallback)((e,t)=>{gr&&s(e,{[gr.key]:t})},[gr,s]),br=(0,L.useCallback)(e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),xr=(0,L.useMemo)(()=>qe===`timeseries`?_r.map(e=>e.pid):[],[qe,_r]),Sr=(0,L.useCallback)(e=>{let t=Ad(m.display)??{mode:`timeseries`};Ne({...m,display:{...t,...e}})},[m,Ne]),Cr=!!gr&&gr.type===`select`&&it(gr),wr=gr?gr.type===`status`?`Stacked by ${gr.label} — read-only, computed from the source system.`:it(gr)?null:`You do not have permission to edit this field, so cards cannot be moved.`:null;if(i||!g)return(0,B.jsx)(`div`,{className:`cg-loading`,children:`Loading customers…`});let Tr=u.find(e=>e.id===f),Er=lt?(0,B.jsx)(`button`,{type:`button`,className:`cg-tb-btn cg-tb-addcust`,ref:fe,disabled:!ie,onClick:()=>se(e=>!e),"aria-expanded":oe,"aria-haspopup":`dialog`,children:`+ Add customers`}):void 0,Dr=new Set(c.filter(e=>e.custom&&e.key!==Re).map(e=>e.key)),Or=A?Fe.get(A.fieldKey):void 0,kr=Or?m.sorts.find(e=>e.colId===Or.key)?.dir??null:null,Ar=Or?XWe(m.filters,Or.key):!1,jr=Or?Zn.indexOf(Or.key):-1,Mr=jr>=0&&Qn>1&&jr+1===Qn,Nr=We?void 0:(0,B.jsx)(zUe,{mode:qe,onMode:tr,locked:!!Tr&&Qd(Tr),dateField:hr,dateChoices:or,stackField:gr,stackChoices:sr,colorField:pr,colorChoices:dr,sizeField:mr,sizeChoices:fr,onPickField:nr,clamped:Ke?.kanbanClamp!==!1,onClamp:rr,calendarMode:Ke?.calendarMode??`records`,onCalendarMode:ar,calendarMetrics:Ke?.calendarMetrics,metricChoices:fr,onCalendarMetrics:ir}),Pr=M?Fe.get(M.fieldKey):void 0,Fr=Pr?Pr.type===`user`?r?.userOptions??[]:Ed(Pr):[],Ir=M?n.find(e=>e.pid===M.pid):void 0,Lr=String((M&&a[M.pid]?.[M.fieldKey])??(Pr&&Ir?Ir[Pr.key]:``)??``),Rr=Pr?.type===`multiselect`,zr=Rr?YWe(Lr):[],Br=Fr.length?Rr?zr.find(e=>Fr.includes(e))??Fr[0]:Fr.includes(Lr)?Lr:Fr[0]:null;return(0,B.jsxs)(`div`,{className:`cg-shell`,"data-today":nt??``,"data-measure-rules":Qe,"data-measure-sets":$e,children:[lt?(0,B.jsx)(tUe,{lists:et,activeCohortId:ie,onSelect:Gn,onRename:qn,onDelete:Jn,onExport:We?void 0:jn,folders:Cn,folderIdOf:wn,today:nt,onFolderCreate:e=>{let t=F7();_n(n=>[...n.slice(-31),{id:t,name:e,order:9999}]),Tn(e=>({...e,created:{...e.created,[t]:Date.now()}})),Gu({id:Ku(`foldnew`),type:`folder_create`,surface:`cohorts`,folderId:t,name:e})},onFolderRename:(e,t)=>{Tn(n=>({...n,renamed:{...n.renamed,[e]:{at:Date.now(),name:t}}})),Gu({id:Ku(`foldren`),type:`folder_rename`,surface:`cohorts`,folderId:e,name:t})},onFolderDelete:e=>{Tn(t=>({...t,deleted:{...t.deleted,[e]:Date.now()}})),Gu({id:Ku(`folddel`),type:`folder_delete`,surface:`cohorts`,folderId:e})},onFolderDuplicate:e=>{let t=F7(),n=Cn.find(t=>t.id===e);_n(e=>[...e.slice(-31),{id:t,name:`${n?.name??`Folder`} copy`,order:9999}]),Tn(e=>({...e,created:{...e.created,[t]:Date.now()}})),Gu({id:Ku(`folddup`),type:`folder_duplicate`,surface:`cohorts`,folderId:e,newId:t})},onItemMove:(e,t)=>{Tn(n=>({...n,moved:{...n.moved,[e]:{at:Date.now(),folderId:t}}})),Gu({id:Ku(`itemmove`),type:`item_move`,surface:`cohorts`,itemId:e,folderId:t})},onFolderAddToList:En}):!Ge&&(0,B.jsx)(eUe,{onCohortLock:nn,views:u,activeViewId:f,saveState:v,onSelect:rn,onCreate:an,onRename:R,onNote:sn,onDuplicate:cn,onDelete:ln,lists:et,onAddToList:We?void 0:un,today:nt,onExport:We?void 0:An,folders:yn,folderIdOf:bn,onFolderCreate:(e,t)=>{let n=F7();hn(r=>[...r.slice(-31),{id:n,name:e,order:9999,icon:t}]),xn(e=>({...e,created:{...e.created,[n]:Date.now()}})),Gu({id:Ku(`foldnew`),type:`folder_create`,surface:`views`,folderId:n,name:e,icon:t})},onFolderRename:(e,t)=>{xn(n=>({...n,renamed:{...n.renamed,[e]:{at:Date.now(),name:t}}})),Gu({id:Ku(`foldren`),type:`folder_rename`,surface:`views`,folderId:e,name:t})},onFolderDelete:e=>{xn(t=>({...t,deleted:{...t.deleted,[e]:Date.now()}})),Gu({id:Ku(`folddel`),type:`folder_delete`,surface:`views`,folderId:e})},onFolderDuplicate:e=>{let t=F7(),n=yn.find(t=>t.id===e);hn(e=>[...e.slice(-31),{id:t,name:`${n?.name??`Folder`} copy`,order:9999}]),xn(e=>({...e,created:{...e.created,[t]:Date.now()}})),Gu({id:Ku(`folddup`),type:`folder_duplicate`,surface:`views`,folderId:e,newId:t})},onItemMove:(e,t)=>{xn(n=>({...n,moved:{...n.moved,[e]:{at:Date.now(),folderId:t}}})),Gu({id:Ku(`itemmove`),type:`item_move`,surface:`views`,itemId:e,folderId:t})},folderAddPreview:We?void 0:Dn,onFolderAddToList:We?void 0:On,viewer:rt,onToggleLock:on,userOptions:r?.userOptions}),(0,B.jsxs)(`main`,{className:`cg-main`,children:[(0,B.jsx)(Kre,{cohortLock:Pn,copyViews:u.filter(e=>e.id!==f),onCopyConfig:e=>Ne({...m,...e}),fields:c,visible:Le,lockedKey:Re,onColumnVisible:He,onColumnsVisible:e=>Ne({...m,visible:[...new Set([Re,...e])]}),orderedFields:At,onFieldOrder:e=>Ne({...m,order:e}),deletableKeys:Dr,onDeleteField:Bn,colorOn:m.colorBy!==null,onToggleColor:e=>Ne({...m,colorBy:e?c.find(e=>e.type===`status`)?.key??null:null}),rowHeightMode:m.rowHeightMode,onRowHeightMode:e=>Ne({...m,rowHeightMode:e}),filters:m.filters,onFilters:e=>Ne({...m,filters:e}),filterConj:m.filterConj??`and`,onFilterConj:e=>Ne({...m,filterConj:e}),sorts:m.sorts,onSorts:e=>Ne({...m,sorts:e}),groupBy:We?null:m.groupBy,onGroupBy:e=>Ne({...m,groupBy:e}),statusValues:Mt,measures:Je,unresolvedCount:at,lists:et,pendingMeasureCount:Ze,search:b,onSearch:x,recordCount:Pt,scopeCounts:r?.counts,pool:r?.workspace?.pool,serverWindowed:We,cohortAction:Er,filterSeed:pe,modeControl:Nr}),(0,B.jsxs)(`div`,{className:`cg-grid-box`,ref:Ee,onMouseLeave:()=>D(e=>e===null?e:null),children:[qe===`grid`&&(0,B.jsx)(dee,{ref:Te,columns:Pe,getCellContent:St,rows:_t.length,theme:pf,freezeColumns:Qn,rowHeight:Rt,headerHeight:36,rowMarkers:`both`,gridSelection:Ct,onGridSelectionChange:Tt,getRowThemeOverride:It,onItemHovered:Lt,onCellClicked:qt,onCellActivated:Jt,onCellEdited:Yt,onPaste:Zt,validateCell:Xt,onColumnResize:ze,onColumnMoved:Be,onColumnProposeMove:Ve,drawHeader:Kt,onHeaderMenuClick:(e,t)=>Qt(e,t),onHeaderClicked:$t,onHeaderContextMenu:$t,onKeyDown:en,maxColumnWidth:600,getCellsForSelection:!0,rowSelectionMode:`multi`,smoothScrollX:!0,smoothScrollY:!0,width:Oe.width,height:Oe.height,customRenderers:[jne,Ane],headerIcons:Kte,rightElement:(0,B.jsx)(`button`,{type:`button`,className:`cg-add-field-btn`,"aria-label":`Add field`,title:`Add a field`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();ge({left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height})},children:`+`}),rightElementProps:{sticky:!0,fill:!1}}),qe===`list`&&(0,B.jsx)(BUe,{rows:_t,fieldByKey:Fe,visibleKeys:Zn,titleKey:Re,onOpen:k,onToggleGroup:br}),qe===`calendar`&&(hr?(0,B.jsx)(UUe,{rows:_r,field:hr,today:nt,titleKey:Re,mode:Ke?.calendarMode??`records`,metrics:Ke?.calendarMetrics,fieldByKey:Fe,onOpen:k}):(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no date field to place records by.`})),qe===`kanban`&&(gr?(0,B.jsx)(WUe,{rows:_r,field:gr,fieldByKey:Fe,cardKeys:vr,titleKey:Re,canMove:Cr,readOnlyReason:wr,clamped:Ke?.kanbanClamp!==!1,onMove:yr,onOpen:k}):(0,B.jsx)(`div`,{className:`cg-mode-empty`,children:`This table has no status or single-select field to stack by.`})),qe===`chart`&&(0,B.jsx)(eWe,{rows:_r,fields:c,fieldByKey:Fe,charts:lr,onCharts:ur}),qe===`timeseries`&&(0,B.jsx)(THe,{scope:e,pids:xr,fields:c,display:Ke,onDisplay:Sr}),qe===`map`&&Fe.get(Re)&&(0,B.jsx)(MWe,{rows:_r,field:Fe.get(Re),colorField:pr,sizeField:mr,selectedPids:wt,onSelectPids:Et,onOpen:k}),qe===`grid`&&E&&(0,B.jsx)(`button`,{type:`button`,className:`cg-row-expand`,style:{left:E.x,top:E.y,width:E.size,height:E.size},title:`Expand record`,"aria-label":`Expand record`,onMouseDown:e=>e.preventDefault(),onClick:()=>k(E.pid),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":!0,focusable:`false`,children:(0,B.jsx)(`path`,{d:`M9.5 2.5H13.5V6.5M6.5 13.5H2.5V9.5M13.5 2.5L9 7M2.5 13.5L7 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),ve&&(0,B.jsx)(`div`,{className:`cg-header-tip`,style:{left:ve.x,top:ve.y},"aria-hidden":!0,children:ve.text}),be&&(0,B.jsx)(`div`,{className:`cg-header-tip cg-cell-tip`,style:{left:be.x,top:be.y},"aria-hidden":!0,children:be.text}),wt.size>0&&!We&&(qe===`grid`||qe===`map`)&&(0,B.jsxs)(`div`,{className:`cg-selbar`,children:[(0,B.jsxs)(`span`,{className:`cg-selbar-count`,children:[wt.size.toLocaleString(),` selected`]}),lt?(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--danger cg-selbar-remove`,style:S9,onClick:Kn,children:`Remove from cohort`}):(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary cg-selbar-add`,style:S9,ref:F,onClick:()=>{if(!te){let e=Tr?.name??`Customers`;re(nt?`${e} · ${nt}`:e)}ne(!te)},"aria-expanded":te,"aria-haspopup":`dialog`,children:`Add to cohort`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,style:S9,onClick:kt,children:`Clear`})]})]}),gt&&(qe===`grid`||qe===`list`)&&(0,B.jsxs)(`div`,{className:`cg-more`,children:[(0,B.jsxs)(`span`,{className:`cg-more-note`,children:[`Showing first `,Ft.toLocaleString(),` of`,` `,Pt.toLocaleString()]}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>ht(e=>e+WWe),children:`See more`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-link-btn`,onClick:()=>ht(ft.length),children:`Show all`})]})]}),Or&&A&&(0,B.jsx)(CUe,{state:A,field:Or,fields:c,locked:Or.key===Re,viewer:rt,sortedDir:kr,isFiltered:Ar,isGrouped:m.groupBy===Or.key,groupable:Id(Or,Re),onClose:()=>j(null),onNote:e=>Ln({...Or,note:e}),onHide:()=>{He(Or.key,!1),j(null)},onCreate:Rn,onChangeField:e=>zn(Or.key,e),onCreateAndSwap:(e,t,n,r)=>Vn(Or.key,e,t,n,r),onRetype:Or.custom&&Or.source===`overlay`?(e,t,n)=>Hn(Or.key,e,t,n):void 0,onRename:Or.custom?e=>Ln({...Or,label:e}):void 0,onFormula:Or.custom&&Or.type===`formula`?(e,t)=>Ln({...Or,formula:e,...t?{label:t}:{}}):void 0,onPeriod:Or.measure?e=>Wn(Or.key,e):void 0,onDelete:Or.custom&&Or.key!==Re?()=>{Bn(Or.key),j(null)}:void 0,onDuplicate:Or.custom?()=>Un(Or):void 0,onPermissions:Or.custom?e=>Ln({...Or,permissions:{edit:e}}):void 0,onFormat:e=>Ln({...Or,format:e}),onSort:e=>Ne({...m,sorts:[{colId:Or.key,dir:e}]}),onClearSort:()=>Ne({...m,sorts:m.sorts.filter(e=>e.colId!==Or.key)}),onFilterBy:()=>me(e=>({n:(e?.n??0)+1,...Or.measure?{measure:{key:Or.measure.key,window:Or.measure.window}}:{key:Or.key}})),pinnedTo:Mr,onPinTo:jr>0&&!Mr?()=>$n(Or.key):void 0,onUnpin:Qn>1?er:void 0,scopeChoice:Nn,onClearFilter:()=>Ne({...m,filters:ZWe(m.filters,Or.key)}),onGroupByField:()=>Ne({...m,groupBy:Or.key}),onClearGroup:()=>Ne({...m,groupBy:null}),userOptions:r?.userOptions??[],measures:Je},Or.key),he&&Fe.get(Re)&&(0,B.jsx)(CUe,{state:{fieldKey:Re,anchor:he},field:Fe.get(Re),fields:c,locked:!0,viewer:rt,sortedDir:null,isFiltered:!1,isGrouped:!1,groupable:!1,initialPosition:`end`,onClose:()=>ge(null),onNote:()=>void 0,onHide:()=>void 0,onCreate:Rn,onChangeField:()=>void 0,onCreateAndSwap:()=>void 0,onSort:()=>void 0,onClearSort:()=>void 0,onFilterBy:()=>void 0,onClearFilter:()=>void 0,onGroupByField:()=>void 0,onClearGroup:()=>void 0,scopeChoice:Nn,userOptions:r?.userOptions??[],measures:Je},`__add-at-end__`),te&&F.current&&wt.size>0&&(0,B.jsxs)(Cp,{anchor:F.current,className:`cg-pop cg-add-list-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add selected customers to a cohort`,onDismiss:()=>ne(!1),dataKind:`selection-add-to-list`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Add to cohort`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[`Adds the `,wt.size.toLocaleString(),` checked customer`,wt.size===1?``:`s`,`. The cohort stays fixed as the data changes.`]}),et.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row`,onClick:()=>Mn(e.id,e.name),children:e.name},e.id)),(0,B.jsxs)(`div`,{className:`cg-view-create`,children:[(0,B.jsx)(`label`,{htmlFor:`cg-sel-new-list`,children:`New cohort`}),(0,B.jsx)(`input`,{id:`cg-sel-new-list`,className:`cg-input`,"data-overlay-autofocus":!0,value:P,placeholder:`e.g. Q3 call plan`,onChange:e=>re(e.target.value),onKeyDown:e=>{e.key===`Enter`&&P.trim()&&Mn(``,P.trim())}}),(0,B.jsx)(`div`,{className:`cg-form-actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:S9,disabled:!P.trim(),onClick:()=>Mn(``,P.trim()),children:`Create and add`})})]})]}),lt&&oe&&fe.current&&ie&&(0,B.jsxs)(Cp,{anchor:fe.current,className:`cg-pop cg-addcust-pop`,placement:`bottom-start`,role:`dialog`,ariaLabel:`Add customers to this cohort`,onDismiss:()=>se(!1),dataKind:`cohort-add-customers`,children:[(0,B.jsx)(`div`,{className:`cg-pop-title`,children:`Add customers`}),(0,B.jsxs)(`div`,{className:`cg-pop-note`,children:[`Search your customer pool and tick who to add to`,` `,(0,B.jsx)(`strong`,{children:ut?.name??`this cohort`}),`.`]}),(0,B.jsx)(`input`,{type:`text`,className:`cg-input cg-addcust-search`,"data-overlay-autofocus":!0,placeholder:`Search customers…`,"aria-label":`Search customers`,value:ce,onChange:e=>le(e.target.value)}),(0,B.jsxs)(`div`,{className:`cg-pick-list cg-addcust-list`,children:[Xn.slice(0,50).map(e=>(0,B.jsxs)(`label`,{className:`cg-check-row`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:ue.has(e.pid),onChange:()=>de(t=>{let n=new Set(t);return n.has(e.pid)?n.delete(e.pid):n.add(e.pid),n})}),(0,B.jsx)(`span`,{className:`cg-check-label`,children:e.name})]},e.pid)),Xn.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:ce.trim()?`No customer outside this cohort matches your search.`:`Every customer in your pool is already in this cohort.`})]}),Xn.length>50&&(0,B.jsxs)(`div`,{className:`cg-field-hint`,children:[`Showing the first 50 of `,Xn.length.toLocaleString(),` matches — keep typing to narrow.`]}),(0,B.jsxs)(`div`,{className:`cg-form-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`cg-btn cg-btn--primary`,style:S9,disabled:ue.size===0,onClick:Yn,children:ue.size===0?`Add customers`:`Add ${ue.size.toLocaleString()} customer${ue.size===1?``:`s`}`}),(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,style:S9,onClick:()=>se(!1),children:`Cancel`})]})]}),Pr&&M&&(0,B.jsxs)(Cp,{anchor:M.anchor,className:`cg-pop cg-pick-pop`,placement:`bottom-start`,role:`listbox`,ariaLabel:`Choose ${Pr.label}`,onDismiss:N,dataKind:`cell-picker`,initialFocus:`[data-overlay-autofocus]`,onKeyDown:e=>{let t=e.key===`ArrowDown`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowLeft`;if(!t&&!n)return;let r=Array.from(e.currentTarget.querySelectorAll(`.cg-pick-row, .cg-star-btn`));if(!r.length)return;e.preventDefault();let i=r.indexOf(document.activeElement);r[t?(i+1)%r.length:(i-1+r.length)%r.length]?.focus()},children:[Pr.type===`rating`&&(0,B.jsx)(`div`,{className:`cg-stars`,role:`radiogroup`,"aria-label":`Set ${Pr.label}`,children:Array.from({length:Dd(Pr)},(e,t)=>t+1).map(e=>(0,B.jsx)(`button`,{type:`button`,className:`cg-star-btn`,role:`radio`,"aria-checked":Number(Lr)===e,"data-overlay-autofocus":Number(Lr)===e||!Lr&&e===1||void 0,"aria-label":`${e} star${e===1?``:`s`}`,onClick:()=>{s(M.pid,{[Pr.key]:String(e)}),N()},children:(0,B.jsx)(Vp,{on:Number(Lr)>=e})},e))}),Pr.type!==`rating`&&Fr.length===0&&(0,B.jsx)(`div`,{className:`cg-pop-note`,children:Pr.type===`user`?`No assignable people were supplied for this workspace.`:`This field has no choices yet. Add them from the column menu.`}),(0,B.jsx)(`div`,{className:`cg-pick-list`,"aria-multiselectable":Rr||void 0,children:Fr.map(e=>{let t=op(Pr,e),n=Rr?zr.includes(e):Lr===e;return(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-overlay-autofocus":e===Br||void 0,className:`cg-pick-row`+(n?` is-on`:``),onClick:()=>{if(Rr){let t=n?zr.filter(t=>t!==e):[...zr,e];s(M.pid,{[Pr.key]:t.join(`,`)});return}s(M.pid,{[Pr.key]:e}),N()},children:[Pr.type===`user`&&(0,B.jsxs)(`span`,{className:`cg-pick-avatar`,"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`0 0 auto`,width:20,height:20,borderRadius:`50%`,overflow:`hidden`,marginRight:8,fontSize:9,fontWeight:600,lineHeight:1,position:`relative`,background:rp(e).bg,color:rp(e).fg},children:[cp(e),xt?.[e]&&(0,B.jsx)(`img`,{src:xt[e],alt:``,onError:e=>{e.currentTarget.style.visibility=`hidden`},style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,objectFit:`cover`}})]}),(0,B.jsx)(`span`,{className:`cg-pick-pill`,style:t?{background:t.bg,color:t.fg}:void 0,children:e})]},e)})}),Rr&&(0,B.jsx)(`div`,{className:`cg-form-actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`cg-btn`,style:S9,onClick:N,children:`Done`})}),Lr!==``&&(0,B.jsx)(`button`,{type:`button`,className:`cg-pick-row cg-pick-clear`,"data-overlay-autofocus":Fr.length===0||void 0,onClick:()=>{s(M.pid,{[Pr.key]:``}),N()},children:`Clear`})]}),Ht&&O!==null&&(0,B.jsx)(YHe,{fields:c,record:Ht,titleKey:Re,positionLabel:`Record ${Ut.toLocaleString()} of ${Pt.toLocaleString()}`,canPrev:Wt(-1),canNext:Wt(1),onPrev:()=>Gt(-1),onNext:()=>Gt(1),onClose:()=>k(null),recordLayout:Fn,onRecordLayout:In,scope:e,docs:r?.docs?.[String(O)]??[],docPayload:r?.docPayload,onDocAdd:r?.docs?e=>Gu({id:Ku(`docadd`),type:`doc_add`,pid:O,docId:`doc_${Ku(`d`).slice(2,14).replace(/[^a-z0-9]/gi,``)}`,...e}):void 0,onDocFetch:r?.docs?e=>Gu({id:Ku(`docget`),type:`doc_fetch`,pid:O,docId:e}):void 0,onDocDelete:r?.docs?e=>Gu({id:Ku(`docdel`),type:`doc_delete`,pid:O,docId:e}):void 0,onNotesChange:(e,t)=>o(n=>({...n,[O]:{...n[O],[e]:t}})),onNotesCommit:(e,t)=>s(O,{[e]:t}),viewer:rt,userOptions:r?.userOptions??[],userAvatars:xt})]})}var eGe=(0,L.memo)($We);function A9(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:null}function j9(e,t){let n=A9(e);if(n==null)return`—`;let r=t??+(Math.abs(n)<10&&!Number.isInteger(n));return n.toLocaleString(void 0,{minimumFractionDigits:r,maximumFractionDigits:r})}function tGe(e,t){let n=A9(e);return n==null?`—`:n<0?`-$${j9(Math.abs(n),t)}`:`$${j9(n,t)}`}function M9(e){let t=A9(e);return t==null?`—`:Math.round(t).toLocaleString()}function nGe(e,t={}){let n=A9(e);return n==null?`—`:n>=999?`+${(1+n/100).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}×`:`${t.signed&&n>=0?`+`:``}${j9(n,t.dp)}%`}var rGe=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function iGe(e){if(e==null||e===``)return`—`;let t=String(e),n=/^(\d{4})-(\d{2})$/.exec(t);if(n){let e=Number(n[2]);if(e>=1&&e<=12)return`${rGe[e-1]} ${n[1].slice(2)}`}let r=t.includes(` `)?t.replace(` `,`T`):t,i=/T\d{2}:\d{2}/.test(r)&&!/(?:[zZ]|[+-]\d{2}:?\d{2})$/.test(r)?`${r}Z`:r,a=new Date(i);return Number.isNaN(a.getTime())?t:a.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`,timeZone:`UTC`})}var N9={money:tGe,num:j9,pct:nGe,int:M9,date:iGe};function P9(e,t,n){if(t==null||t===``)return e==null||e===``?`—`:String(e);switch(t){case`money`:return tGe(e);case`num`:return j9(e);case`pct`:return nGe(e,n);case`int`:return M9(e);case`date`:return iGe(e);default:return e==null||e===``?`—`:String(e)}}function aGe(e){return!!e&&e.kind===`decomp`}function oGe(e,t){return typeof e!=`number`||typeof t!=`number`||!Number.isFinite(e)||!Number.isFinite(t)?null:{text:`Showing ${M9(e)} of ${M9(t)}`,capped:t>e}}function sGe(e,t){if(!t)return;if(aGe(t)){let n=e[t.row_key];if(!n||typeof n!=`object`)return;let r=n;return r.kind!==`decomp`||!r.date_from||!r.date_to?void 0:r}let n=e[t.id_key];if(n==null||n===``)return;let r=t.label_key?e[t.label_key]:void 0;return{kind:t.kind,id:n,label:String(r??n)}}function cGe(e){return(e??``).trim()||`Nothing matched this scope.`}function F9({d:e,size:t,className:n}){return(0,B.jsx)(`svg`,{className:n,width:t,height:t,viewBox:`0 0 24 24`,"aria-hidden":`true`,focusable:`false`,children:(0,B.jsx)(`path`,{d:e,fill:`currentColor`})})}function lGe({size:e=15}){return(0,B.jsx)(F9,{className:`pg-icon`,size:e,d:`M12 15.6 6.8 10.4l1.4-1.4 2.8 2.8V3h2v8.8l2.8-2.8 1.4 1.4zM5 20a2 2 0 0 1-2-2v-3h2v3h14v-3h2v3a2 2 0 0 1-2 2z`})}function uGe({size:e=14}){return(0,B.jsx)(F9,{className:`pg-icon`,size:e,d:`M9.6 17.6 4 12l1.4-1.4 4.2 4.2 9-9L20 7.2z`})}function dGe({size:e=14}){return(0,B.jsx)(F9,{className:`pg-icon`,size:e,d:`M11 15h2v2h-2zm0-10h2v8h-2z`})}function fGe({title:e,asOf:t,subtitle:n,controls:r,onControl:i,busy:a}){return(0,B.jsxs)(`header`,{className:`pg-header`,children:[(0,B.jsxs)(`div`,{className:`pg-title-row`,children:[(0,B.jsx)(`h1`,{className:`pg-title`,children:e}),r&&r.length>0?(0,B.jsx)(`div`,{className:`pg-controls`,children:r.map(e=>(0,B.jsxs)(`label`,{className:`pg-control`,children:[(0,B.jsx)(`span`,{className:`pg-control-label`,children:e.label}),(0,B.jsx)(`select`,{className:`pg-select`,value:String(e.value),disabled:a||!i,onChange:t=>i?.(e.key,t.target.value),children:e.options.map(e=>(0,B.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))})]},e.key))}):null]}),(0,B.jsx)(`div`,{className:`pg-rule`}),n?(0,B.jsx)(`p`,{className:`pg-subtitle`,children:n}):null,t?(0,B.jsxs)(`p`,{className:`pg-asof`,children:[`Data pulled `,(0,B.jsx)(`time`,{dateTime:t,children:N9.date(t)})]}):null]})}function pGe({label:e,note:t,children:n}){return(0,B.jsxs)(`section`,{className:`pg-section`,children:[(0,B.jsx)(`h2`,{className:`pg-section-label`,children:e}),t?(0,B.jsx)(`p`,{className:`pg-section-note`,children:t}):null,n]})}function mGe({items:e,onOpen:t}){return e.length?(0,B.jsx)(`div`,{className:`pg-kpis`,children:e.map((e,n)=>{let r=P9(e.value,e.fmt),i=e.delta!=null,a=i?P9(e.delta,e.delta_fmt??`pct`,{signed:!0}):``,o=e.delta_dir??(i?`flat`:`off`),s=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`pg-kpi-label`,children:e.label}),(0,B.jsx)(`span`,{className:`pg-kpi-value`,children:r}),a||e.delta_label?(0,B.jsxs)(`span`,{className:`pg-kpi-delta is-${o}`,children:[a,a&&e.delta_label?` `:``,e.delta_label??``]}):null]}),c=e.key??`${e.label}-${n}`;return e.drill&&t?(0,B.jsx)(`button`,{type:`button`,className:`pg-kpi is-clickable`,onClick:()=>t(e.drill),children:s},c):(0,B.jsx)(`div`,{className:`pg-kpi`,children:s},c)})}):null}function hGe({rows:e,columns:t,filename:n,note:r}){return(0,B.jsxs)(`a`,{className:`pg-download`,href:(0,L.useMemo)(()=>{let n=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=``+[t.map(e=>n(e.label)).join(`,`),...e.map(e=>t.map(t=>n(P9(e[t.key],t.fmt))).join(`,`))].join(`\r -`);return URL.createObjectURL(new Blob([r],{type:`text/csv;charset=utf-8`}))},[e,t]),download:`${n}.csv`,children:[(0,B.jsx)(lGe,{}),(0,B.jsx)(`span`,{children:`Download CSV`}),r?(0,B.jsx)(`span`,{className:`pg-download-note`,children:r}):null]})}function gGe({columns:e,rows:t,drill:n,shown:r,total:i,onOpen:a,empty:o,download:s}){let c=oGe(r,i),l=c?.capped??!1;return t.length?(0,B.jsxs)(`div`,{className:`pg-table-wrap`,children:[(0,B.jsxs)(`table`,{className:`pg-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:e.map(e=>(0,B.jsx)(`th`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,scope:`col`,children:e.label},e.key))})}),(0,B.jsx)(`tbody`,{children:t.map((t,r)=>{let i=sGe(t,n);return(0,B.jsx)(`tr`,{className:i&&a?`is-clickable`:``,children:e.map((e,n)=>{let r=P9(t[e.key],e.fmt);return(0,B.jsx)(`td`,{className:e.align===`right`?`is-right`:e.align===`center`?`is-center`:``,children:n===0&&i&&a?(0,B.jsx)(`button`,{type:`button`,className:`pg-cell-link`,onClick:()=>a(i),children:r}):r},e.key)})},String(t[e[0]?.key]??r))})})]}),(0,B.jsxs)(`div`,{className:`pg-table-foot`,children:[c?(0,B.jsx)(`span`,{className:c.capped?`pg-shown is-capped`:`pg-shown`,children:c.text}):null,s?(0,B.jsx)(hGe,{rows:t,columns:e,filename:s.filename,note:l?`the rows shown`:void 0}):null]})]}):(0,B.jsx)(`p`,{className:`pg-empty`,children:cGe(o)})}function _Ge({checks:e}){if(!e.length)return null;let t=e.filter(e=>!e.ok).length;return(0,B.jsxs)(`details`,{className:`pg-validation`,open:t>0,children:[(0,B.jsxs)(`summary`,{className:t?`is-failed`:`is-ok`,children:[t?(0,B.jsx)(dGe,{}):(0,B.jsx)(uGe,{}),(0,B.jsx)(`span`,{children:t?`${N9.int(t)} of ${N9.int(e.length)} reconciliation checks did not tie`:`All ${N9.int(e.length)} reconciliation checks tie to Odoo`})]}),(0,B.jsxs)(`table`,{className:`pg-table pg-validation-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Check`}),(0,B.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Expected`}),(0,B.jsx)(`th`,{scope:`col`,className:`is-right`,children:`Actual`}),(0,B.jsx)(`th`,{scope:`col`,children:`Note`})]})}),(0,B.jsx)(`tbody`,{children:e.map(e=>(0,B.jsxs)(`tr`,{className:e.ok?``:`is-failed`,children:[(0,B.jsx)(`td`,{children:e.name}),(0,B.jsx)(`td`,{className:`is-right`,children:P9(e.expected,e.fmt)}),(0,B.jsx)(`td`,{className:`is-right`,children:P9(e.actual,e.fmt)}),(0,B.jsx)(`td`,{children:e.note??``})]},e.name))})]})]})}var vGe={customer:`Customer`,sku:`Product`,rep:`Salesperson`,bu:`Business Unit`};function I9({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:e}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:t})]})}function yGe({drill:e,onClose:t}){let n=e.kind===`decomp`,r=e,i=e;return(0,B.jsxs)(`aside`,{className:`pg-drill`,role:`dialog`,"aria-label":e.label,children:[(0,B.jsxs)(`header`,{className:`pg-drill-head`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`pg-drill-kind`,children:n?`Period`:vGe[e.kind]??e.kind}),(0,B.jsx)(`h2`,{className:`pg-drill-title`,children:e.label})]}),(0,B.jsx)(`button`,{type:`button`,className:`pg-drill-close`,onClick:t,"aria-label":`Close`,children:`×`})]}),(0,B.jsxs)(`div`,{className:`pg-drill-body`,children:[n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(I9,{label:`Window`,value:`${N9.date(r.date_from)} – ${N9.date(r.date_to)}`}),r.cmp_from&&r.cmp_to?(0,B.jsx)(I9,{label:`Compared with`,value:`${N9.date(r.cmp_from)} – ${N9.date(r.cmp_to)}`}):null,(0,B.jsx)(I9,{label:`Scope`,value:r.scope_value==null?r.scope_type:`${r.scope_type} · ${r.scope_value}`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(I9,{label:vGe[e.kind]??`Record`,value:i.label}),(0,B.jsx)(I9,{label:`Identifier`,value:String(i.id)})]}),(0,B.jsxs)(`p`,{className:`pg-drill-note`,children:[`This wave ships the drill as a complete `,(0,B.jsx)(`em`,{children:`declaration`}),`: the exact scope above is what the number was computed over, and you can check it. The row-level breakdown behind it opens in the next release — until then, use the same view in the current application.`]})]})]})}var bGe=new Set([`text`,`status`,`currency`,`int`,`date`,`pct`,`select`,`user`,`multiselect`,`checkbox`,`phone`,`email`,`url`,`rating`,`created_time`,`formula`]);function xGe(e){return e.map(e=>({key:e.key,label:e.label,type:bGe.has(e.type)?e.type:`text`,source:e.source===`overlay`?`overlay`:`odoo`}))}function SGe(e,t){if(!t||t.length===0)return e;let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.key)??2**53-1)-(n.get(t.key)??2**53-1))}var L9=720,R9=230,z9=52,B9=10,V9=12,CGe=34;function H9(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e9?(e/1e9).toFixed(1)+`B`:t>=1e6?(e/1e6).toFixed(1)+`M`:t>=1e3?(e/1e3).toFixed(1)+`k`:Number.isInteger(e)?e.toLocaleString():e.toFixed(2)}function wGe(e){let t=e>0?`+`:e<0?`−`:``,n=Math.abs(e);return n>=999?`${t}${Math.round(n/100)}×`:`${t}${n.toFixed(+(n<10))}%`}function TGe({spec:e,series:t,fields:n,rows:r,xOrder:i,deltaByKey:a,onPick:o,pickable:s}){let c=(0,L.useMemo)(()=>xGe(n),[n]),l=(0,L.useMemo)(()=>new Map(c.map(e=>[e.key,e])),[c]),u=(0,L.useMemo)(()=>t.map(t=>({def:t,data:o9({...e,y:t.y},r,l)})),[t,e,r,l]),d=(0,L.useMemo)(()=>{let e=new Map;for(let t of u)for(let n of t.data.buckets)e.has(n.key)||e.set(n.key,n.label);return SGe([...e].map(([e,t])=>({key:e,label:t,value:0,n:0})),i)},[u,i]),f=u.find(e=>e.data.problem)?.data.problem;if(f)return(0,B.jsx)(`p`,{className:`pg-empty`,children:f});if(!d.length)return(0,B.jsx)(`p`,{className:`pg-empty`,children:`No periods in this scope yet, so there is nothing to plot.`});let p=u.map(e=>({def:e.def,data:e.data,lookup:new Map(e.data.buckets.map(e=>[e.key,e]))})),m=Math.max(0,...p.flatMap(e=>e.data.buckets.map(e=>e.value))),h=m>0?(R9-V9-CGe)/m:0,g=(L9-z9-B9)/d.length,_=Math.max(2,g*.72/Math.max(1,p.length)),v=Math.max(1,Math.ceil(d.length/12)),y=R9-CGe,b=p[0]?.data.rows??0,x=p.reduce((e,t)=>e+t.data.missingY,0),S=p[0]?.data.omitted??0,C=p[0]?.data.omittedValue??0;return(0,B.jsxs)(`div`,{className:`pg-charts`,children:[(0,B.jsx)(`div`,{className:`pg-legend`,children:p.map((e,t)=>(0,B.jsxs)(`span`,{className:`pg-legend-key`,children:[(0,B.jsx)(`span`,{className:`pg-legend-swatch pg-ser-${t%4}`}),e.def.label]},e.def.y))}),(0,B.jsxs)(`svg`,{className:`pg-chart-svg`,viewBox:`0 0 ${L9} ${R9}`,role:`img`,"aria-label":e.title??`Chart`,children:[(0,B.jsx)(`line`,{className:`pg-ax`,x1:z9,y1:y,x2:L9-B9,y2:y}),(0,B.jsx)(`line`,{className:`pg-ax pg-ax-soft`,x1:z9,y1:V9,x2:L9-B9,y2:V9}),(0,B.jsx)(`text`,{className:`pg-ax-lab`,x:z9-6,y:16,textAnchor:`end`,children:H9(m)}),(0,B.jsx)(`text`,{className:`pg-ax-lab`,x:z9-6,y,textAnchor:`end`,children:`0`}),d.map((e,t)=>{let n=z9+t*g,r=_*p.length,i=n+(g-r)/2;return(0,B.jsxs)(`g`,{children:[s&&o?(0,B.jsx)(`rect`,{className:`pg-slot`,x:n,y:V9,width:g,height:y-V9,onClick:()=>o(e.key),children:(0,B.jsx)(`title`,{children:`Open ${e.label}`})}):null,p.map((t,n)=>{let r=t.lookup.get(e.key)?.value??0,a=Math.max(+(r>0),r*h);return(0,B.jsx)(`rect`,{className:`pg-bar pg-ser-${n%4}`,x:i+n*_,y:y-a,width:Math.max(1,_-1.5),height:a,children:(0,B.jsx)(`title`,{children:`${e.label} · ${t.def.label}: ${H9(r)}`})},t.def.y)}),(()=>{let t=a?.get(e.key);if(t==null)return null;let r=Math.max(0,...p.map(t=>{let n=t.lookup.get(e.key)?.value??0;return Math.max(+(n>0),n*h)}));return(0,B.jsx)(`text`,{className:`pg-bar-delta ${t>0?`is-up`:t<0?`is-down`:``}`,x:n+g/2,y:Math.max(8,y-r-4),textAnchor:`middle`,children:wGe(t)})})(),t%v===0?(0,B.jsx)(`text`,{className:`pg-ax-lab`,x:n+g/2,y:210,textAnchor:`middle`,children:e.label}):null]},e.key||`(blank)-${t}`)})]}),(0,B.jsxs)(`p`,{className:`pg-chart-note`,children:[`${b.toLocaleString()} period${b===1?``:`s`} plotted`,S>0?` · ${S} more not drawn, worth ${H9(C)}`:``,x>0?` · ${x} value${x===1?``:`s`} the measure could not use`:``,s?` · click a period to decompose it`:``]})]})}function EGe(e){let t=[],n={body:[]};for(let r of e)r.type===`section`?((n.head||n.body.length)&&t.push(n),n={head:r,body:[]}):n.body.push(r);return(n.head||n.body.length)&&t.push(n),t}function DGe({block:e,onOpen:t}){let n=e.drill,r=new Map;if(aGe(n)){let t=e.spec.x;for(let i of e.rows){let e=i[n.row_key],a=t?i[t]:void 0;a!=null&&e&&typeof e==`object`&&e.kind===`decomp`&&r.set(String(a),e)}}let i=new Map;if(e.delta_key){let t=e.spec.x;for(let n of e.rows){let r=t?n[t]:void 0,a=n[e.delta_key];r!=null&&typeof a==`number`&&Number.isFinite(a)&&i.set(String(r),a)}}let a=!!t&&r.size>0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(TGe,{spec:e.spec,series:e.series??[],fields:e.fields,rows:e.rows,xOrder:e.x_order,deltaByKey:i.size?i:void 0,pickable:a,onPick:e=>{let n=r.get(e);n&&t&&t(n)}}),e.shown!=null&&e.total!=null&&e.total>e.shown?(0,B.jsxs)(`p`,{className:`pg-shown is-capped`,children:[`Showing `,e.shown,` of `,e.total,` periods`]}):null]})}function OGe({block:e,onOpen:t}){switch(e.type){case`kpis`:return(0,B.jsx)(mGe,{items:e.items,onOpen:t});case`table`:{let n=e;return(0,B.jsx)(gGe,{columns:n.columns,rows:n.rows,drill:n.drill,shown:n.shown,total:n.total,empty:n.empty,download:n.download,onOpen:t})}case`chart`:return(0,B.jsx)(DGe,{block:e,onOpen:t});case`validation`:return(0,B.jsx)(_Ge,{checks:e.checks});default:return null}}function kGe({page:e,onControl:t,onOpen:n,busy:r}){let i=EGe(e.blocks);return(0,B.jsxs)(`div`,{className:`pg-page`,children:[(0,B.jsx)(fGe,{title:e.title,asOf:e.as_of,subtitle:e.subtitle,controls:e.controls,onControl:t,busy:r}),i.map((e,t)=>e.head?(0,B.jsx)(pGe,{label:e.head.label,note:e.head.note,children:e.body.map((e,t)=>(0,B.jsx)(OGe,{block:e,onOpen:n},e.key??`b${t}`))},e.head.key??`s${t}`):(0,B.jsx)(`div`,{children:e.body.map((e,t)=>(0,B.jsx)(OGe,{block:e,onOpen:n},e.key??`b${t}`))},`g${t}`))]})}async function AGe(e){let t=``,n=``;try{let r=await e.json();t=String(r?.error?.code??``),n=String(r?.error?.message??``)}catch{}if(e.status>=500)return{ok:!1,status:e.status,code:t||`server_error`,message:`Something went wrong on our side. Try again in a moment.`};let r=e.status===401?`Your session has ended. Sign in again.`:e.status===403?`This account does not have access to that.`:e.status===404?`That page does not exist.`:`That request could not be completed.`;return{ok:!1,status:e.status,code:t||String(e.status),message:n||r}}async function jGe(e,t={}){let n=new URLSearchParams(t).toString(),r=`${Mu}/pages/${encodeURIComponent(e)}${n?`?${n}`:``}`;try{let e=await fetch(r,{credentials:Nu});if(!e.ok)return AGe(e);let t=await e.json();return!t||typeof t!=`object`||!Array.isArray(t.blocks)?{ok:!1,status:200,code:`bad_envelope`,message:`The server sent a page this client could not read.`}:{ok:!0,page:t}}catch{return{ok:!1,status:0,code:`offline`,message:`The server could not be reached.`}}}function MGe({pageKey:e,label:t}){let[n,r]=(0,L.useState)({phase:`loading`}),[i,a]=(0,L.useState)({}),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null),u=JSON.stringify(i);(0,L.useEffect)(()=>{let t=!1;return s(!0),jGe(e,JSON.parse(u)).then(e=>{if(!t){if(s(!1),e.ok){r({phase:`ready`,page:e.page});return}if(e.status===401){zu(Pu);return}r({phase:`error`,message:e.message})}}),()=>{t=!0}},[e,u]);let d=(0,L.useCallback)((e,t)=>{l(null),a(n=>({...n,[e]:t}))},[]);return n.phase===`loading`?(0,B.jsxs)(`div`,{className:`pg-state`,children:[(0,B.jsx)(`h1`,{children:t}),(0,B.jsx)(`p`,{children:`Loading live figures from Odoo. The first read of a new scope takes a moment.`})]}):n.phase===`error`?(0,B.jsxs)(`div`,{className:`pg-state pg-error`,children:[(0,B.jsx)(`h1`,{children:t}),(0,B.jsx)(`p`,{children:n.message}),(0,B.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>a(e=>({...e})),children:`Try again`})]}):(0,B.jsxs)(`div`,{className:o?`pg-host is-busy`:`pg-host`,children:[(0,B.jsx)(kGe,{page:n.page,onControl:d,onOpen:l,busy:o}),c?(0,B.jsx)(yGe,{drill:c,onClose:()=>l(null)}):null]})}function U9(e){return e?.role===`admin`}function NGe(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.username==`string`?t.username.trim():``;return n?{username:n,name:typeof t.name==`string`&&t.name.trim()!==``?t.name.trim():n,role:typeof t.role==`string`?t.role:``,bus:Array.isArray(t.bus)?t.bus.filter(e=>typeof e==`string`):[],modules:t.modules===`all`?`all`:Array.isArray(t.modules)?t.modules.filter(e=>typeof e==`string`):[],avatar:typeof t.avatar==`string`&&t.avatar.startsWith(`data:image/`)?t.avatar:null}:null}function W9(e){return!e||typeof e!=`object`?null:NGe(e.user)}var PGe=`Incorrect username or password.`,G9=`Sign-in is unavailable right now. Try again in a moment.`,FGe=`Cannot reach the server. Check your connection and try again.`;function IGe(e,t){if(e===0)return FGe;if(e>=500)return G9;let n=t?.error;return(typeof n?.message==`string`?n.message.trim():``)||(e===401?PGe:G9)}async function LGe(e){try{return await e.json()}catch{return null}}async function RGe(e,t){let n;try{n=await fetch(`${Mu}/auth/login`,{method:`POST`,credentials:Nu,headers:{"Content-Type":`application/json`},body:JSON.stringify({username:e,password:t})})}catch{return{ok:!1,message:IGe(0,null)}}let r=await LGe(n);if(!n.ok)return{ok:!1,message:IGe(n.status,r)};let i=W9(r);return i?{ok:!0,user:i}:{ok:!1,message:G9}}async function zGe(){try{let e=await fetch(`${Mu}/auth/me`,{credentials:Nu});return e.ok?W9(await LGe(e)):null}catch{return null}}async function BGe(){try{await fetch(`${Mu}/auth/logout`,{method:`POST`,credentials:Nu})}catch{}}async function K9(e,t){try{let n=await fetch(`${Mu}${e}`,{credentials:Nu,headers:t?.body?{"Content-Type":`application/json`}:void 0,...t});if(n.status===204)return{ok:!0,data:void 0};let r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.error,t=n.status>=500?`Something went wrong on our side. Try again in a moment.`:e?.message||(n.status===403?`Administrators only.`:n.status===409?`That username already exists. Edit the existing account instead.`:`That change could not be saved.`);return{ok:!1,status:n.status,message:t}}return{ok:!0,data:r}}catch{return{ok:!1,status:0,message:`The server could not be reached.`}}}function VGe(){return K9(`/settings`)}function HGe(){return K9(`/admin/users`)}function UGe(e){return K9(`/admin/users`,{method:`POST`,body:JSON.stringify(e)})}function WGe(e,t){return K9(`/admin/users/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function GGe(e,t){return K9(`/admin/users/${encodeURIComponent(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})})}function KGe(e){return K9(`/auth/me/avatar`,{method:`POST`,body:JSON.stringify({dataUrl:e})})}function qGe(){return K9(`/auth/me/avatar`,{method:`DELETE`})}var JGe={5:`Fisch`,6:`Royal`},YGe=[5,6];function XGe(e){return e===`all`||!Array.isArray(e)||e.length===0?`All business units`:e.map(e=>typeof e==`number`?JGe[e]??String(e):String(e)).join(`, `)}function ZGe(e){return e===`all`||!Array.isArray(e)||e.length===0?`All modules`:`${e.length} module${e.length===1?``:`s`}: ${e.join(`, `)}`}function QGe(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(!1),u=(0,L.useCallback)(()=>{HGe().then(e=>{e.ok?(t(e.data.users??[]),r(``)):(t([]),r(e.message))})},[]);(0,L.useEffect)(u,[u]);let d=(0,L.useCallback)(async(e,t,n)=>{l(!0);let i=await WGe(e,t);l(!1),i.ok?(a(n),r(``),u()):r(i.message)},[u]);return e===null?(0,B.jsx)(`p`,{className:`pg-empty`,children:`Loading accounts…`}):(0,B.jsxs)(`div`,{className:`set-pane`,children:[(0,B.jsx)(`h3`,{className:`set-h`,children:`Accounts`}),n?(0,B.jsx)(`p`,{className:`set-error`,children:n}):null,i?(0,B.jsx)(`p`,{className:`set-notice`,children:i}):null,e.length===0&&!n?(0,B.jsx)(`p`,{className:`pg-empty`,children:`No accounts are configured on this deployment yet.`}):(0,B.jsxs)(`table`,{className:`pg-table set-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`User`}),(0,B.jsx)(`th`,{scope:`col`,children:`Role`}),(0,B.jsx)(`th`,{scope:`col`,children:`Business units`}),(0,B.jsx)(`th`,{scope:`col`,children:`Modules`}),(0,B.jsx)(`th`,{scope:`col`,children:`Status`}),(0,B.jsx)(`th`,{scope:`col`})]})}),(0,B.jsx)(`tbody`,{children:e.map(e=>(0,B.jsxs)(`tr`,{className:e.active?``:`is-inactive`,children:[(0,B.jsxs)(`td`,{children:[(0,B.jsx)(`span`,{className:`set-user`,children:e.name||e.username}),(0,B.jsx)(`span`,{className:`set-username`,children:e.username})]}),(0,B.jsx)(`td`,{children:e.role===`admin`?`Admin`:`Member`}),(0,B.jsx)(`td`,{children:XGe(e.bus)}),(0,B.jsx)(`td`,{children:ZGe(e.modules)}),(0,B.jsx)(`td`,{children:e.active?`Active`:`Deactivated`}),(0,B.jsx)(`td`,{className:`is-right`,children:(0,B.jsx)(`button`,{type:`button`,className:`pg-cell-link`,onClick:()=>s(o===e.username?null:e.username),children:o===e.username?`Close`:`Edit`})})]},e.username))})]}),o?(0,B.jsx)(eKe,{user:e.find(e=>e.username===o),busy:c,onApply:d,onDone:()=>s(null)}):null,(0,B.jsx)(tKe,{onCreated:e=>{a(e),r(``),u()},onError:r})]})}function $Ge({value:e,onChange:t,id:n}){let r=e===`all`,i=new Set(r?[]:e);return(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`span`,{className:`set-label`,children:`Business units`}),(0,B.jsxs)(`label`,{className:`set-check`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>t(e.target.checked?`all`:YGe.slice())}),`All business units`]}),r?null:YGe.map(e=>(0,B.jsxs)(`label`,{className:`set-check`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:i.has(e),onChange:n=>{let r=new Set(i);n.target.checked?r.add(e):r.delete(e),t([...r])}}),JGe[e]]},e)),(0,B.jsx)(`p`,{className:`set-help`,id:`${n}-help`,children:`A member scoped to one unit sees no other unit's data anywhere — the strict-isolation rule the permission model is built on.`})]})}function eKe({user:e,busy:t,onApply:n,onDone:r}){let[i,a]=(0,L.useState)(e.name??``),[o,s]=(0,L.useState)(e.role??`user`),[c,l]=(0,L.useState)(e.bus),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``);return e?(0,B.jsxs)(`section`,{className:`set-card`,children:[(0,B.jsxs)(`h4`,{className:`set-h4`,children:[`Edit `,e.username]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-name`,children:`Display name`}),(0,B.jsx)(`input`,{id:`set-name`,className:`set-input`,value:i,onChange:e=>a(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-role`,children:`Role`}),(0,B.jsxs)(`select`,{id:`set-role`,className:`pg-select`,value:o,onChange:e=>s(e.target.value),children:[(0,B.jsx)(`option`,{value:`user`,children:`Member`}),(0,B.jsx)(`option`,{value:`admin`,children:`Admin`})]})]}),(0,B.jsx)($Ge,{id:`set-bus`,value:c,onChange:l}),(0,B.jsxs)(`div`,{className:`set-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:t,onClick:()=>n(e.username,{name:i,role:o,bus:c},`Saved ${e.username}.`),children:`Save changes`}),(0,B.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:t,onClick:()=>n(e.username,{active:!e.active},`${e.active?`Deactivated`:`Reactivated`} ${e.username}.`),children:e.active?`Deactivate account`:`Reactivate account`}),(0,B.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:r,children:`Done`})]}),(0,B.jsxs)(`div`,{className:`set-field set-danger`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-pw`,children:`Set a new password`}),(0,B.jsx)(`input`,{id:`set-pw`,className:`set-input`,type:`password`,value:u,autoComplete:`new-password`,onChange:e=>d(e.target.value)}),(0,B.jsxs)(`p`,{className:`set-help`,children:[`This signs `,e.username,` out everywhere immediately.`]}),(0,B.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:t||u.length===0,onClick:()=>{GGe(e.username,u).then(t=>{p(t.ok?`Password reset; ${e.username} was signed out.`:t.message),t.ok&&d(``)})},children:`Reset password`}),f?(0,B.jsx)(`p`,{className:`set-notice`,children:f}):null]})]}):null}function tKe({onCreated:e,onError:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(`user`),[u,d]=(0,L.useState)(`all`),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1);if(!n)return(0,B.jsx)(`button`,{type:`button`,className:`set-primary set-add`,onClick:()=>r(!0),children:`Add an account`});let g=i.trim().length>0&&f.length>0;return(0,B.jsxs)(`section`,{className:`set-card`,children:[(0,B.jsx)(`h4`,{className:`set-h4`,children:`New account`}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-user`,children:`Username`}),(0,B.jsx)(`input`,{id:`set-new-user`,className:`set-input`,value:i,autoComplete:`off`,onChange:e=>a(e.target.value)}),(0,B.jsx)(`p`,{className:`set-help`,children:`Must be new. To change an existing account, edit it above — re-creating one would revive sessions that were revoked.`})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-name`,children:`Display name`}),(0,B.jsx)(`input`,{id:`set-new-name`,className:`set-input`,value:o,onChange:e=>s(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-role`,children:`Role`}),(0,B.jsxs)(`select`,{id:`set-new-role`,className:`pg-select`,value:c,onChange:e=>l(e.target.value),children:[(0,B.jsx)(`option`,{value:`user`,children:`Member`}),(0,B.jsx)(`option`,{value:`admin`,children:`Admin`})]})]}),(0,B.jsx)($Ge,{id:`set-new-bus`,value:u,onChange:d}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-label`,htmlFor:`set-new-pw`,children:`Password`}),(0,B.jsx)(`input`,{id:`set-new-pw`,className:`set-input`,type:`password`,value:f,autoComplete:`new-password`,onChange:e=>p(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`set-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:m||!g,onClick:()=>{h(!0),UGe({username:i.trim().toLowerCase(),name:o||i.trim(),role:c,bus:u,modules:`all`,password:f}).then(n=>{h(!1),n.ok?(e(`Created ${i.trim().toLowerCase()}.`),r(!1),a(``),s(``),p(``)):t(n.message)})},children:`Create account`}),(0,B.jsx)(`button`,{type:`button`,className:`set-secondary`,onClick:()=>r(!1),children:`Cancel`})]})]})}async function nKe(e){let t=URL.createObjectURL(e);try{let e=new Image;if(await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(`unreadable image`)),e.src=t}),!e.width||!e.height)return null;let n=Math.min(128,Math.max(e.width,e.height)),r=document.createElement(`canvas`);r.width=n,r.height=n;let i=r.getContext(`2d`);if(!i)return null;let a=Math.min(e.width,e.height);return i.drawImage(e,(e.width-a)/2,(e.height-a)/2,a,a,0,0,n,n),r.toDataURL(`image/jpeg`,.85)}catch{return null}finally{URL.revokeObjectURL(t)}}function rKe({user:e,size:t}){if(e.avatar)return(0,B.jsx)(`img`,{src:e.avatar,alt:``,"aria-hidden":`true`,style:{width:t,height:t,borderRadius:`50%`,objectFit:`cover`,display:`block`,flex:`none`}});let n=(e.name.match(/[\p{L}\p{N}]/u)?.[0]??`?`).toUpperCase();return(0,B.jsx)(`span`,{"aria-hidden":`true`,style:{width:t,height:t,borderRadius:`50%`,background:`var(--lp-blue-tint)`,color:`var(--lp-blue-deep)`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontWeight:600,fontSize:Math.round(t*.42),flex:`none`},children:n})}function iKe({user:e,onUser:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),o=(0,L.useRef)(null),s=(0,L.useCallback)(async e=>{r(!0),a(``);let n=await nKe(e);if(!n){r(!1),a(`That file could not be read as an image.`);return}let i=await KGe(n);if(r(!1),i.ok){let e=W9(i.data);e&&t?.(e)}else a(i.message)},[t]),c=(0,L.useCallback)(async()=>{r(!0),a(``);let e=await qGe();if(r(!1),e.ok){let n=W9(e.data);n&&t?.(n)}else a(e.message)},[t]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h4`,{className:`set-h4`,children:`Profile photo`}),(0,B.jsx)(`p`,{className:`set-help`,children:`Shown on Assignee fields and your account chip. Square images look best; large ones are scaled down automatically.`}),i?(0,B.jsx)(`p`,{className:`set-error`,children:i}):null,(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,B.jsx)(rKe,{user:e,size:56}),(0,B.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg`,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,B.jsx)(`button`,{type:`button`,className:`set-primary`,disabled:n,onClick:()=>o.current?.click(),children:e.avatar?`Change photo`:`Upload photo`}),e.avatar?(0,B.jsx)(`button`,{type:`button`,className:`set-secondary`,disabled:n,onClick:c,children:`Remove`}):null]})]})}function aKe({user:e,section:t,onSection:n,onClose:r,onUser:i}){let[a,o]=(0,L.useState)(null),s=U9(e);(0,L.useEffect)(()=>{VGe().then(e=>{e.ok&&o(e.data)})},[]),(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let c=[[`account`,`Account`],[`scope`,`Your access`],...s?[[`users`,`Manage users`]]:[]],l=t===`users`&&!s?`account`:t;return(0,B.jsx)(`div`,{className:`set-backdrop`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,B.jsxs)(`div`,{className:`set-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[(0,B.jsxs)(`nav`,{className:`set-rail`,children:[(0,B.jsx)(`span`,{className:`set-rail-cap`,children:`Settings`}),c.map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,className:`set-rail-item`+(l===e?` is-active`:``),onClick:()=>n(e),children:t},e))]}),(0,B.jsxs)(`div`,{className:`set-body`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-close`,onClick:r,"aria-label":`Close settings`,children:`×`}),l===`account`?(0,B.jsxs)(`div`,{className:`set-pane`,children:[(0,B.jsx)(`h3`,{className:`set-h`,children:`Account`}),(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:`Signed in as`}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:e.name})]}),(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:`Username`}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:e.username})]}),(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:`Role`}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:s?`Admin`:`Member`})]}),(0,B.jsx)(iKe,{user:e,onUser:i})]}):null,l===`scope`?(0,B.jsxs)(`div`,{className:`set-pane`,children:[(0,B.jsx)(`h3`,{className:`set-h`,children:`Your access`}),(0,B.jsx)(`p`,{className:`set-help`,children:`What this account may see. Only an administrator can change it — shown here so the numbers on every page can be read in context.`}),(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:`Business units`}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:XGe(a?.scope.bus??e.bus)})]}),(0,B.jsxs)(`div`,{className:`pg-drill-row`,children:[(0,B.jsx)(`span`,{className:`pg-drill-key`,children:`Modules`}),(0,B.jsx)(`span`,{className:`pg-drill-val`,children:ZGe(a?.scope.modules??e.modules)})]})]}):null,l===`users`?(0,B.jsx)(QGe,{}):null]})]})})}var oKe=`./favicon.svg`;function sKe({size:e}){return(0,B.jsx)(`img`,{className:`lp-mark`,src:oKe,width:e,height:e,alt:``,"aria-hidden":`true`,draggable:!1})}function q9({size:e,className:t}){return(0,B.jsxs)(`div`,{className:t,children:[(0,B.jsx)(sKe,{size:e}),(0,B.jsx)(`span`,{className:`lp-wordmark`,children:`Loopable`})]})}function cKe({off:e}){return(0,B.jsxs)(`svg`,{viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M2.2 10s2.8-4.6 7.8-4.6S17.8 10 17.8 10 15 14.6 10 14.6 2.2 10 2.2 10z`}),(0,B.jsx)(`circle`,{cx:`10`,cy:`10`,r:`2.3`}),e?(0,B.jsx)(`path`,{d:`M4 16 16 4`}):null]})}function lKe({onSignedIn:e}){let[t,n]=(0,L.useState)(``),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1);async function d(n){if(n.preventDefault(),s)return;c(!0),o(``);let a=await RGe(t,r);if(a.ok){e(a.user);return}c(!1),o(a.message),i(``)}function f(e){return t=>{a&&o(``),e(t.target.value)}}return(0,B.jsx)(`div`,{className:`login-root`,children:(0,B.jsxs)(`div`,{className:`login-card`,children:[(0,B.jsx)(q9,{size:44,className:`login-brand`}),(0,B.jsxs)(`form`,{className:`login-form`,onSubmit:d,noValidate:!0,children:[(0,B.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-username`,children:`Username`}),(0,B.jsx)(`input`,{id:`login-username`,className:`login-input`,name:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:t,onChange:f(n),disabled:s,"aria-invalid":a?!0:void 0}),(0,B.jsx)(`label`,{className:`lp-sr-only`,htmlFor:`login-password`,children:`Password`}),(0,B.jsxs)(`div`,{className:`login-field`,children:[(0,B.jsx)(`input`,{id:`login-password`,className:`login-input`,name:`password`,type:l?`text`:`password`,autoComplete:`current-password`,placeholder:`Password`,value:r,onChange:f(i),disabled:s,"aria-invalid":a?!0:void 0}),(0,B.jsx)(`button`,{type:`button`,className:`login-eye`,"aria-label":l?`Hide password`:`Show password`,onClick:()=>u(e=>!e),disabled:s,tabIndex:-1,children:(0,B.jsx)(cKe,{off:l})})]}),(0,B.jsx)(`button`,{className:`login-submit`,type:`submit`,disabled:s,children:s?`Signing in…`:`Log in`})]}),(0,B.jsx)(`p`,{className:`login-msg`,role:`status`,"aria-live":`polite`,children:a})]})})}function uKe(e){let t=e?.pages;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e,r=typeof t.key==`string`?t.key.trim():``,i=typeof t.label==`string`?t.label.trim():``;!r||!i||n.push({key:r,label:i,...typeof t.source==`string`&&t.source?{source:t.source}:{},...typeof t.parent==`string`&&t.parent?{parent:t.parent}:{},...t.group_only===!0?{group_only:!0}:{},...t.chrome===`main`||t.chrome===`utility`?{chrome:t.chrome}:{}})}return n}function dKe(e){let t=[],n=[];for(let r of e)(r.chrome===`utility`?n:t).push(r);return{main:t,utility:n}}async function fKe(){try{let e=await fetch(`${Mu}/nav`,{credentials:Nu});return e.ok?{ok:!0,pages:uKe(await e.json())}:{ok:!1,status:e.status}}catch{return{ok:!1,status:0}}}var J9={folders:[],placement:{}};function pKe(e){let t=e?.prefs??e;if(!t||typeof t!=`object`)return J9;let n=t,r=[],i=new Set;if(Array.isArray(n.folders))for(let e of n.folders.slice(0,16)){if(!e||typeof e!=`object`)continue;let t=String(e.id??``).trim().slice(0,40),n=String(e.name??``).trim().replace(/\s+/g,` `).slice(0,40);!t||i.has(t)||!n||(i.add(t),r.push({id:t,name:n}))}let a={};if(n.placement&&typeof n.placement==`object`)for(let[e,t]of Object.entries(n.placement)){let n=String(t??``).slice(0,40);e&&i.has(n)&&(a[e.slice(0,60)]=n)}return{folders:r,placement:a}}async function mKe(){try{let e=await fetch(`${Mu}/nav/prefs`,{credentials:Nu});return e.ok?pKe(await e.json()):J9}catch{return J9}}async function hKe(e){try{return(await fetch(`${Mu}/nav/prefs`,{method:`POST`,credentials:Nu,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok}catch{return!1}}function gKe(e,t,n){let r=[];for(let t of e)t.depth>0&&r.length>0?r[r.length-1].children.push(t):r.push({head:t,children:[]});let i=new Map,a=[],o=new Set(t.folders.map(e=>e.id));for(let e of r){let n=t.placement[e.head.key];if(n&&o.has(n)){let t=i.get(n);t?t.push(e):i.set(n,[e])}else a.push(e)}let s=[],c=(e,t)=>{s.push({kind:`entry`,entry:e.head,...t?{folderId:t}:{}});for(let n of e.children)s.push({kind:`entry`,entry:n,...t?{folderId:t}:{}})};for(let e of t.folders){let t=i.get(e.id)??[],r=!n.has(e.id);if(s.push({kind:`folder`,folder:e,count:t.length,open:r}),r)for(let n of t)c(n,e.id)}for(let e of a)c(e);return s}function _Ke(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.key!=`string`||typeof t.label!=`string`)return null;let n=[];if(Array.isArray(t.fields))for(let e of t.fields){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||typeof t.label!=`string`||n.push({key:t.key,label:t.label,type:String(t.type??``),source:String(t.source??``),description:String(t.description??``),...Array.isArray(t.options)?{options:t.options.map(String)}:{}})}let r=[];if(Array.isArray(t.measures))for(let e of t.measures){if(!e||typeof e!=`object`)continue;let t=e;typeof t.key!=`string`||!t.key||r.push({key:t.key,label:String(t.label??t.key),type:String(t.type??``)})}return{key:t.key,label:t.label,source:String(t.source??``),fields:n,measures:r,...typeof t.note==`string`&&t.note?{note:t.note}:{}}}async function vKe(e){try{let t=await fetch(`${Mu}/nav/schema/${encodeURIComponent(e)}`,{credentials:Nu});return t.ok?_Ke(await t.json()):null}catch{return null}}var yKe=new Set([`customer_data`,`cohort`,`sales`]),bKe=new Set([`sales`]);function Y9(e,t){return`${e}/?page=${encodeURIComponent(t)}`}function xKe(e,t){let n=new Set(e.map(e=>e.key)),r=new Map;for(let t of e){if(!t.parent||!n.has(t.parent))continue;let e=r.get(t.parent);e?e.push(t):r.set(t.parent,[t])}let i=(e,n)=>{let i=yKe.has(e.key),a=i?`native`:e.group_only||r.has(e.key)?`group`:`handoff`;return{key:e.key,label:e.label,...e.source?{source:e.source}:{},kind:a,depth:n,...a===`group`?{}:{href:i?`#/${e.key}`:Y9(t,e.key)}}},a=[];for(let t of e){if(t.parent&&n.has(t.parent))continue;let e=i(t,0),o=r.get(t.key)??[];if(!(e.kind===`group`&&o.length===0)){a.push(e);for(let e of o)a.push(i(e,1))}}return a}var SKe=[`customer_data`,`cohort`];function CKe(e){for(let t of SKe){let n=e.find(e=>e.key===t&&e.kind===`native`);if(n)return n.key}return e.find(e=>e.kind===`native`)?.key??e.find(e=>e.kind!==`group`)?.key??``}function wKe(e,t){let n=e.findIndex(e=>e.key===t);if(n>=0){let t=e[n];if(t.kind!==`group`)return t;for(let r of e.slice(n+1)){if(r.depth<=t.depth)break;if(r.kind!==`group`)return r}}let r=CKe(e);return e.find(e=>e.key===r)}function TKe(){return(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-dots-icon`,children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`3.2`,r:`1.35`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.35`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`12.8`,r:`1.35`})]})}function EKe(){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`shell-nav-icon`,children:(0,B.jsx)(`path`,{d:`M2.2 4.4c0-.66.54-1.2 1.2-1.2h3l1.4 1.6h4.8c.66 0 1.2.54 1.2 1.2v6c0 .66-.54 1.2-1.2 1.2H3.4c-.66 0-1.2-.54-1.2-1.2z`})})}function DKe(){let[e,t]=(0,L.useState)(null),n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(null)},i=e=>{e.key===`Escape`&&t(null)};return document.addEventListener(`mousedown`,r,!0),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,r,!0),document.removeEventListener(`keydown`,i,!0)}},[e]),{at:e,ref:n,openFrom:e=>{let n=e.getBoundingClientRect();t({x:Math.round(n.right+4),y:Math.round(n.top)})},close:()=>t(null)}}function OKe({at:e,menuRef:t,children:n}){return(0,B.jsx)(`div`,{className:`shell-navmenu`,style:{left:Math.min(e.x,Math.max(8,window.innerWidth-248)),top:Math.min(e.y,Math.max(8,window.innerHeight-260))},ref:t,role:`menu`,children:n})}function kKe({entryLabel:e,canSchema:t,onSchema:n}){let{at:r,ref:i,openFrom:a,close:o}=DKe();return t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for ${e}`,"aria-haspopup":`menu`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e.currentTarget)},children:(0,B.jsx)(TKe,{})}),r&&(0,B.jsx)(OKe,{at:r,menuRef:i,children:(0,B.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>{o(),n()},children:`View schema`})})]}):null}function AKe({onCreate:e}){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(``),a=()=>{let t=r.trim().replace(/\s+/g,` `);t&&(e(t),i(``),n(!1))};return t?(0,B.jsxs)(`form`,{className:`shell-navmenu-form shell-newfolder-form`,onSubmit:e=>{e.preventDefault(),a()},children:[(0,B.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,placeholder:`Folder name`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(i(``),n(!1))}}),(0,B.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!r.trim(),children:`Add`})]}):(0,B.jsx)(`button`,{type:`button`,className:`shell-newfolder`,onClick:()=>n(!0),children:`+ New folder`})}function jKe({folder:e,count:t,open:n,collapsed:r,onToggle:i,onRename:a,onDelete:o,isDrop:s,dropProps:c}){let{at:l,ref:u,openFrom:d,close:f}=DKe(),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e.name),_=()=>{let t=h.trim().replace(/\s+/g,` `);t&&t!==e.name&&a(t),m(!1),f()};return r?null:(0,B.jsxs)(`div`,{className:`shell-nav-folder`+(s?` is-drop`:``),...c??{},children:[(0,B.jsxs)(`button`,{type:`button`,className:`shell-nav-folderbtn`,"aria-expanded":n,onClick:i,children:[(0,B.jsx)(EKe,{}),(0,B.jsx)(`span`,{className:`shell-nav-label`,children:e.name}),(0,B.jsx)(`span`,{className:`shell-nav-foldercount`,children:t})]}),(0,B.jsx)(`button`,{type:`button`,className:`shell-dots`,"aria-label":`Options for folder ${e.name}`,"aria-haspopup":`menu`,onClick:t=>{t.stopPropagation(),g(e.name),m(!1),d(t.currentTarget)},children:(0,B.jsx)(TKe,{})}),l&&(0,B.jsxs)(OKe,{at:l,menuRef:u,children:[p?(0,B.jsxs)(`form`,{className:`shell-navmenu-form`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,B.jsx)(`input`,{className:`shell-navmenu-input`,autoFocus:!0,maxLength:40,value:h,onChange:e=>g(e.target.value)}),(0,B.jsx)(`button`,{type:`submit`,className:`shell-navmenu-go`,disabled:!h.trim(),children:`Save`})]}):(0,B.jsx)(`button`,{type:`button`,className:`shell-navmenu-item`,onClick:()=>m(!0),children:`Rename folder`}),(0,B.jsx)(`button`,{type:`button`,className:`shell-navmenu-item is-danger`,onClick:()=>{f(),o()},children:`Delete folder`})]})]})}function MKe({schemaKey:e,onClose:t}){let[n,r]=(0,L.useState)({phase:`loading`});return(0,L.useEffect)(()=>{let t=!1;return r({phase:`loading`}),vKe(e).then(e=>{t||r(e?{phase:`ready`,schema:e}:{phase:`error`})}),()=>{t=!0}},[e]),(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]),(0,B.jsx)(`div`,{className:`shell-schema-backdrop`,onMouseDown:t,children:(0,B.jsxs)(`aside`,{className:`shell-schema`,role:`dialog`,"aria-label":`Database schema`,onMouseDown:e=>e.stopPropagation(),children:[n.phase===`loading`&&(0,B.jsx)(`div`,{className:`shell-schema-empty`,children:`Loading schema…`}),n.phase===`error`&&(0,B.jsx)(`div`,{className:`shell-schema-empty`,children:`The schema could not be loaded. Close this panel and try again.`}),n.phase===`ready`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`header`,{className:`shell-schema-head`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`shell-schema-title`,children:n.schema.label}),n.schema.source&&(0,B.jsxs)(`div`,{className:`shell-schema-sub`,children:[`Source · `,n.schema.source]})]}),(0,B.jsx)(`button`,{type:`button`,className:`shell-schema-close`,"aria-label":`Close schema`,onClick:t,children:`×`})]}),(0,B.jsxs)(`div`,{className:`shell-schema-body`,children:[n.schema.note&&(0,B.jsx)(`div`,{className:`shell-schema-note`,children:n.schema.note}),n.schema.fields.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Fields · `,n.schema.fields.length]}),(0,B.jsxs)(`table`,{className:`shell-schema-table`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{children:`Field`}),(0,B.jsx)(`th`,{children:`Type`}),(0,B.jsx)(`th`,{children:`Source`})]})}),(0,B.jsx)(`tbody`,{children:n.schema.fields.map(e=>(0,B.jsxs)(`tr`,{children:[(0,B.jsxs)(`td`,{children:[(0,B.jsx)(`div`,{className:`shell-schema-fname`,children:e.label}),e.description&&(0,B.jsx)(`div`,{className:`shell-schema-fdesc`,children:e.description}),e.options&&(0,B.jsxs)(`div`,{className:`shell-schema-fdesc`,children:[`Choices: `,e.options.join(` · `)]})]}),(0,B.jsx)(`td`,{className:`shell-schema-type`,children:e.type}),(0,B.jsx)(`td`,{className:`shell-schema-type`,children:e.source})]},e.key))})]})]}),n.schema.measures.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`shell-schema-kicker`,children:[`Semantic measures · `,n.schema.measures.length]}),(0,B.jsx)(`div`,{className:`shell-schema-measures`,children:n.schema.measures.map(e=>(0,B.jsxs)(`div`,{className:`shell-schema-measure`,children:[(0,B.jsx)(`span`,{className:`shell-schema-fname`,children:e.label}),(0,B.jsx)(`span`,{className:`shell-schema-type`,children:e.type})]},e.key))})]})]})]})]})})}var X9=`https://royal-imports-cfo-os.hf.space`,Z9=`login`,Q9=`application/x-loopable-nav`,NKe=[],PKe=[];function FKe(){let e=()=>window.location.hash.replace(/^#\/?/,``),[t,n]=(0,L.useState)(e);return(0,L.useEffect)(()=>{let t=()=>n(e());return window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[]),t}function IKe({entry:e}){return(0,B.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,B.jsx)(`h1`,{children:e.label}),(0,B.jsx)(`p`,{children:`This surface runs in the current application.`}),(0,B.jsxs)(`a`,{className:`shell-link`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[`Open `,e.label]})]})}function LKe(){return(0,B.jsxs)(`svg`,{className:`shell-nav-icon`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`ellipse`,{cx:`8`,cy:`3.6`,rx:`5.3`,ry:`2.1`}),(0,B.jsx)(`path`,{d:`M2.7 3.6v8.8c0 1.16 2.37 2.1 5.3 2.1s5.3-.94 5.3-2.1V3.6`}),(0,B.jsx)(`path`,{d:`M2.7 8c0 1.16 2.37 2.1 5.3 2.1S13.3 9.16 13.3 8`})]})}function RKe(){return(0,B.jsxs)(`svg`,{className:`shell-nav-icon is-spark`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M6.2 2.2 7.5 5.5l3.3 1.3-3.3 1.3-1.3 3.3-1.3-3.3-3.3-1.3 3.3-1.3z`}),(0,B.jsx)(`path`,{d:`M12.2 9.4l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z`})]})}function $9(){return(0,B.jsx)(`svg`,{className:`shell-nav-open`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4.6 3h4.4v4.4M8.8 3.2 3.2 8.8`})})}function zKe(){return(0,B.jsxs)(`svg`,{className:`shell-account-dots`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`3.5`,cy:`8`,r:`1.25`}),(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.25`}),(0,B.jsx)(`circle`,{cx:`12.5`,cy:`8`,r:`1.25`})]})}function BKe(){return(0,B.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 4.4h11M2.5 8h11M2.5 11.6h11`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`})})}function VKe({user:e,utility:t,onSignOut:n,onSettings:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=(e.name.match(/[\p{L}\p{N}]/u)?.[0]??``).toUpperCase(),c=t.filter(e=>e.key!==`analyst`);return(0,B.jsxs)(`div`,{className:`shell-account-wrap`,ref:o,children:[i?(0,B.jsxs)(`div`,{className:`shell-menu`,role:`menu`,children:[(0,B.jsx)(`button`,{type:`button`,className:`shell-menu-item`,role:`menuitem`,onClick:()=>{a(!1),r(`account`)},children:`Settings`}),U9(e)?(0,B.jsx)(`button`,{type:`button`,className:`shell-menu-item`,role:`menuitem`,onClick:()=>{a(!1),r(`users`)},children:`Manage users`}):null,c.length?(0,B.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}):null,c.map(e=>(0,B.jsxs)(`a`,{className:`shell-menu-item`,role:`menuitem`,href:Y9(X9,e.key),target:`_blank`,rel:`noreferrer`,onClick:()=>a(!1),children:[e.key===`settings`?`App settings`:e.label,(0,B.jsx)($9,{})]},e.key)),(0,B.jsx)(`div`,{className:`shell-menu-rule`,role:`separator`}),(0,B.jsx)(`button`,{type:`button`,className:`shell-menu-item is-signout`,role:`menuitem`,onClick:()=>{a(!1),n()},children:`Sign out`})]}):null,(0,B.jsxs)(`button`,{type:`button`,className:`shell-account`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[e.avatar?(0,B.jsx)(`img`,{className:`shell-avatar`,src:e.avatar,alt:``,"aria-hidden":`true`,style:{objectFit:`cover`,padding:0}}):(0,B.jsx)(`span`,{className:`shell-avatar`,"aria-hidden":`true`,children:s}),(0,B.jsxs)(`span`,{className:`shell-account-who`,children:[(0,B.jsx)(`span`,{className:`shell-account-name`,children:e.name}),(0,B.jsx)(`span`,{className:`shell-account-role`,children:U9(e)?`Admin`:`Member`})]}),(0,B.jsx)(zKe,{})]})]})}function HKe(){let[e,t]=(0,L.useState)({phase:`checking`}),[n,r]=(0,L.useState)({phase:`idle`}),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(null),u=FKe(),[d,f]=(0,L.useState)(()=>{try{return localStorage.getItem(`aios-nav-collapsed`)===`1`}catch{return!1}});(0,L.useEffect)(()=>{try{localStorage.setItem(`aios-nav-collapsed`,d?`1`:`0`)}catch{}},[d]);let[p,m]=(0,L.useState)(null);(0,L.useEffect)(()=>{d||m(null)},[d]);let h=(0,L.useCallback)(e=>t=>{let n=t.currentTarget.getBoundingClientRect();m({label:e,y:n.top+n.height/2})},[]),g=(0,L.useCallback)(()=>m(null),[]);(0,L.useEffect)(()=>{let e=()=>t({phase:`anon`}),n=e=>a(String(e.detail??``)||`The data could not be loaded.`),r=e=>s(String(e.detail??``)),i=()=>f(!0);return window.addEventListener(Pu,e),window.addEventListener(Fu,n),window.addEventListener(Iu,r),window.addEventListener(Ru,i),()=>{window.removeEventListener(Pu,e),window.removeEventListener(Fu,n),window.removeEventListener(Iu,r),window.removeEventListener(Ru,i)}},[]),(0,L.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>s(``),6e3);return()=>clearTimeout(e)},[o]),(0,L.useEffect)(()=>{let e=!1;return zGe().then(n=>{e||t(n?{phase:`authed`,user:n}:{phase:`anon`})}),()=>{e=!0}},[]);let _=e.phase===`authed`?e.user.username:null;(0,L.useEffect)(()=>{if(_===null){r({phase:`idle`});return}let e=!1;return r({phase:`loading`}),a(``),s(``),fKe().then(n=>{if(!e)if(n.ok){let{main:e,utility:t}=dKe(n.pages);r({phase:`ready`,entries:xKe(e,X9),utility:t})}else n.status===401?t({phase:`anon`}):r({phase:`error`})}),()=>{e=!0}},[_]);let v=n.phase===`ready`?n.entries:NKe,[y,b]=(0,L.useState)(J9),x=(0,L.useRef)(y);x.current=y;let[S,C]=(0,L.useState)(new Set),[w,T]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(_===null){b(J9),T(null);return}let e=!1;return mKe().then(t=>{e||b(t)}),()=>{e=!0}},[_]);let E=(0,L.useCallback)(e=>{let t=x.current;b(e),hKe(e).then(e=>{e||(b(t),s(`The folder change was not saved — the store refused the write.`))})},[]),D=(0,L.useCallback)((e,t)=>{let n=x.current,r={...n.placement};t?r[e]=t:delete r[e],E({folders:n.folders,placement:r})},[E]),O=(0,L.useCallback)((e,t)=>{let n=x.current;E({folders:n.folders.map(n=>n.id===e?{...n,name:t}:n),placement:n.placement})},[E]),k=(0,L.useCallback)(e=>{let t=x.current;E({folders:t.folders.filter(t=>t.id!==e),placement:Object.fromEntries(Object.entries(t.placement).filter(([,t])=>t!==e))})},[E]),A=(0,L.useCallback)(e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[j,M]=(0,L.useState)(null),[ee,N]=(0,L.useState)(null),te=(0,L.useCallback)(e=>{let t=x.current;if(t.folders.length>=16){s(`At most 16 folders.`);return}let n=`nf_${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;E({folders:[...t.folders,{id:n,name:e}],placement:t.placement})},[E]);(0,L.useEffect)(()=>{e.phase===`anon`&&u!==Z9?window.location.hash=`#/${Z9}`:e.phase===`authed`&&u===Z9&&v.length&&(window.location.hash=`#/${CKe(v)}`)},[e.phase,u,v]);let ne=(0,L.useCallback)(()=>{Zu(),BGe().then(()=>t({phase:`anon`}))},[]);if(e.phase===`checking`)return(0,B.jsx)(`div`,{className:`shell-boot`,children:(0,B.jsx)(q9,{size:44,className:`login-brand`})});if(e.phase===`anon`)return(0,B.jsx)(lKe,{onSignedIn:e=>{Zu(),t({phase:`authed`,user:e})}});let P=wKe(v,u),re=n.phase===`ready`?n.utility:PKe,F=re.find(e=>e.key===`analyst`);return(0,B.jsxs)(`div`,{className:`shell-root`,children:[(0,B.jsxs)(`aside`,{className:`shell-side`+(d?` is-collapsed`:``),children:[(0,B.jsxs)(`div`,{className:`shell-side-head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`shell-brand-btn`,disabled:!d,"aria-label":d?`Expand navigation`:void 0,onMouseEnter:d?h(`Expand navigation`):void 0,onMouseLeave:d?g:void 0,onClick:()=>f(!1),children:(0,B.jsx)(q9,{size:26,className:`shell-brand`})}),(0,B.jsx)(`button`,{type:`button`,className:`shell-rail-toggle`,"aria-label":`Minimize navigation`,"aria-expanded":!d,title:`Minimize navigation`,onClick:()=>f(!0),children:(0,B.jsx)(BKe,{})})]}),(0,B.jsxs)(`nav`,{className:`shell-nav`,children:[F?(0,B.jsxs)(`a`,{className:`shell-nav-item shell-nav-assist`,href:Y9(X9,`analyst`),target:`_blank`,rel:`noreferrer`,onMouseEnter:d?h(`AI assistant`):void 0,onMouseLeave:d?g:void 0,children:[(0,B.jsx)(RKe,{}),(0,B.jsx)(`span`,{className:`shell-nav-label`,children:`AI assistant`}),(0,B.jsx)($9,{})]}):null,(0,B.jsxs)(`div`,{className:`shell-nav-list`+(ee===`__root__`?` is-drop-root`:``),onDragOver:e=>{e.dataTransfer.types.includes(Q9)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,N(`__root__`))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||N(null)},onDrop:e=>{let t=e.dataTransfer.getData(Q9);N(null),M(null),t&&(e.preventDefault(),D(t,null))},children:[gKe(v,d?J9:y,S).map(e=>{if(e.kind===`folder`)return(0,B.jsx)(jKe,{folder:e.folder,count:e.count,open:e.open,collapsed:d,onToggle:()=>A(e.folder.id),onRename:t=>O(e.folder.id,t),onDelete:()=>k(e.folder.id),isDrop:ee===e.folder.id,dropProps:{onDragOver:t=>{t.dataTransfer.types.includes(Q9)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=`move`,N(e.folder.id))},onDrop:t=>{let n=t.dataTransfer.getData(Q9);N(null),M(null),n&&(t.preventDefault(),t.stopPropagation(),D(n,e.folder.id))}}},`folder:${e.folder.id}`);let t=e.entry,n=`shell-nav-item`+(t.depth>0?` is-child`:``)+(P&&P.key===t.key?` is-active`:``),r=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(LKe,{}),(0,B.jsx)(`span`,{className:`shell-nav-label`,children:t.label}),t.kind===`handoff`?(0,B.jsx)($9,{}):null]});if(t.kind===`group`)return(0,B.jsx)(`div`,{className:`shell-nav-group`,children:r},t.key);let i=d?{onMouseEnter:h(t.label),onMouseLeave:g}:{},a=t.kind===`native`?(0,B.jsx)(`a`,{className:n,href:t.href,...i,children:r}):(0,B.jsx)(`a`,{className:n,href:t.href,target:`_blank`,rel:`noreferrer`,...i,children:r});return(0,B.jsxs)(`div`,{className:`shell-nav-row`+(e.folderId?` is-foldered`:``)+(j===t.key?` is-dragging`:``),draggable:!d&&t.depth===0,onDragStart:e=>{e.dataTransfer.setData(Q9,t.key),e.dataTransfer.effectAllowed=`move`,M(t.key)},onDragEnd:()=>{M(null),N(null)},children:[a,!d&&t.depth===0&&(0,B.jsx)(kKe,{entryLabel:t.label,canSchema:!0,onSchema:()=>T(t.key)})]},t.key)}),!d&&n.phase===`ready`&&v.length>0?(0,B.jsx)(AKe,{onCreate:te}):null]}),n.phase===`loading`?(0,B.jsx)(`div`,{className:`shell-nav-note`,children:`Loading…`}):null,n.phase===`error`?(0,B.jsx)(`div`,{className:`shell-nav-note`,children:`Navigation unavailable. Reload to retry.`}):null,n.phase===`ready`&&v.length===0?(0,B.jsx)(`div`,{className:`shell-nav-note`,children:`No surfaces are available to this account.`}):null]}),(0,B.jsx)(`div`,{className:`shell-side-bottom`,onClickCapture:d?e=>{e.preventDefault(),e.stopPropagation(),f(!1)}:void 0,onMouseEnter:d?h(e.user.name):void 0,onMouseLeave:d?g:void 0,children:(0,B.jsx)(VKe,{user:e.user,utility:re,onSignOut:ne,onSettings:l})})]}),p?(0,B.jsx)(`div`,{className:`shell-nav-tip`,style:{top:p.y},role:`tooltip`,"aria-hidden":`true`,children:p.label}):null,(0,B.jsx)(`main`,{className:`shell-main`,children:i&&P?.kind===`native`?(0,B.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,B.jsx)(`h1`,{children:P.label}),(0,B.jsx)(`p`,{children:i}),(0,B.jsx)(`button`,{className:`login-submit shell-retry`,type:`button`,onClick:()=>window.location.reload(),children:`Retry`})]}):P?.kind===`native`&&bKe.has(P.key)?(0,B.jsx)(MGe,{pageKey:P.key,label:P.label},P.key):P?.kind===`native`?(0,B.jsx)(`div`,{className:`shell-grid-host`,children:(0,B.jsx)(Hne,{children:(0,B.jsx)(eGe,{scope:P.key===`cohort`?`cohort`:`customer`},P.key)})}):P?(0,B.jsx)(IKe,{entry:P}):(0,B.jsxs)(`div`,{className:`shell-placeholder`,children:[(0,B.jsx)(`h1`,{children:`Nothing to show`}),(0,B.jsx)(`p`,{children:n.phase===`error`?`The navigation service did not answer. Reload to retry.`:`This account has access to no surfaces yet.`})]})}),c?(0,B.jsx)(aKe,{user:e.user,section:c,onSection:l,onClose:()=>l(null),onUser:e=>t({phase:`authed`,user:e})}):null,w?(0,B.jsx)(MKe,{schemaKey:w,onClose:()=>T(null)}):null,o?(0,B.jsx)(`div`,{className:`shell-toast`,role:`status`,"aria-live":`polite`,children:o}):null]})}var UKe=Hu()||window.__AIOS_GRID__!==void 0;function WKe(){return UKe?(0,B.jsx)(`div`,{style:{width:`100%`,height:`100%`,overflow:`hidden`},children:(0,B.jsx)(Hne,{children:(0,B.jsx)(eGe,{})})}):(0,B.jsx)(HKe,{})}gee(),UKe||Eee(),(0,y.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(L.StrictMode,{children:(0,B.jsx)(WKe,{})})); - diff --git a/web/src/customer-grid/ColumnMenu.tsx b/web/src/customer-grid/ColumnMenu.tsx index a86c18922201f6fddc25c41dd69bc4903df90c7a..a0497813d9d05d95d2296ede88b18cad166bc401 100644 --- a/web/src/customer-grid/ColumnMenu.tsx +++ b/web/src/customer-grid/ColumnMenu.tsx @@ -1,1901 +1,1901 @@ -import { useMemo, useRef, useState } from "react"; -import { AnchoredOverlay } from "./OverlaySurface"; -import type { AnchorRect } from "./OverlaySurface"; -import { FieldTypeIcon, MenuLabel } from "./icons"; -import { FieldSelectButton } from "./FieldSelect"; -import { CREATABLE_TYPES, choiceOptions, directionLabel, parseOptions, ratingMax } - from "./types"; -import type { Field, FieldFormat, FieldScope, FieldType, Measure, Viewer } from "./types"; -import type { WindowSpec } from "./windows"; -import { normalizeWindow, windowLabel } from "./windows"; -import { WindowPicker } from "./Toolbar"; -import { TYPE_LABELS } from "./iconShapes"; -import { validateFormula } from "./formulaEngine"; -import { BRAND_SWATCHES, defaultOptionColor, nearestSwatch, normalizeOptionColor, - OPTION_PALETTE } from "./choiceColors"; - -export interface ColumnMenuState { - fieldKey: string; - anchor: AnchorRect; -} - -interface FieldConfigExtra { - formula?: string; - max?: number; - scope?: FieldScope; - label?: string; - colorCodeOptions?: boolean; - optionColors?: Record; -} - -interface ColumnMenuProps { - state: ColumnMenuState; - field: Field; - /** Every field of the table, for "Change field" (owner item 9): the clicked column can be - * swapped for any other field — including hidden ones like Notes — in place. */ - fields: Field[]; - locked: boolean; - /** Wave-5 item 1 — who is looking. Gates the permissions entry (creator-or-admin). */ - viewer?: Viewer; - /** Wave-5 item 3 — what the CURRENT VIEW does with this field, so the conditional - * "Don't sort/filter/group by this field" entries render exactly when they apply. */ - sortedDir: "asc" | "desc" | null; - isFiltered: boolean; - isGrouped: boolean; - /** types.isGroupableField, computed by the caller (it owns lockedKey). */ - groupable: boolean; - onClose: () => void; - onNote: (note: string) => void; - onHide: () => void; - onCreate: ( - label: string, - type: FieldType, - anchorKey: string | null, - side: "left" | "right" | "end", - options?: string[], - measureSpec?: { key: string; window: WindowSpec }, - extra?: FieldConfigExtra - ) => void; - /** Swap THIS column for another field, in place (owner item 9). */ - onChangeField: (newKey: string) => void; - /** - * Wave-2 item 5: the Change-field window's "New field" half — create a fresh overlay field - * of the chosen type and swap this column for it in one motion. The old field hides exactly - * as an ordinary change does. Wave-6 item 2 REPLACES this flow on created (`custom_`) - * fields with `onRetype` below. - */ - onCreateAndSwap: ( - label: string, - type: FieldType, - options?: string[], - extra?: FieldConfigExtra - ) => void; - /** - * Wave-6 item 2, re-homed by owner item 8 (2026-07-31): supplied for CREATED (`custom_`) - * fields only — the EDIT FIELD pane's type picker RETYPES THIS FIELD IN PLACE (same key, - * new type/options; values never converted — unreadable cells show blank, disclosed in the - * pane). `extra.label` rides along when the name changed in the same save, so rename+retype - * is ONE upsert — two sequential emits would each read the stale def and revert the other. - */ - onRetype?: ( - type: FieldType, - options?: string[], - extra?: FieldConfigExtra - ) => void; - /** Wave-6 item 5 — rename this created field (ordinary field_upsert with a new label). - * Supplied for creatable strata only. */ - onRename?: (label: string) => void; - /** - * Owner item 8 (2026-07-31) — edit a FORMULA field's source in place (the Edit-field pane's - * per-type editor for the formula type, validated with the field itself as selfKey so a - * cycle is refused at authoring). `label` rides along exactly like onRetype's — one upsert. - * Supplied for created formula fields only. - */ - onFormula?: (formula: string, label?: string) => void; - /** Wave-6 item 4 — open straight into the create form at this position (the header "+" - * passes "end"). Cancel then CLOSES rather than falling back to the action list. */ - initialPosition?: CreatePosition; - /** Wave-6 item 9c — true on the cohort page: the create forms offer the Scope control - * ("This cohort table only" = DEFAULT vs "All customer tables"). */ - scopeChoice?: boolean; - /** Wave-6 item 11c — pin state + actions. `onPinTo` absent when pinning would be a no-op - * (identity column, or already the boundary); `onUnpin` absent when nothing is pinned. */ - pinnedTo?: boolean; - onPinTo?: () => void; - onUnpin?: () => void; - /** - * Wave-2 item 8c: change the PERIOD of a measure-carrying column. Supplied for any field with - * `.measure` — user-created `measure_*` columns and the pre-set measure fields alike. The - * caller emits the ordinary `field_upsert` (and auto-renames the header when the user never - * renamed it). - */ - onPeriod?: (window: WindowSpec) => void; - /** - * Delete this USER-CREATED column outright (owner gap closed 2026-07-27). Supplied ONLY for - * the deletable strata (`custom_` overlay fields, `measure_` formula columns) — absent means - * the control is not rendered at all, so a base field cannot even be offered the action. - */ - onDelete?: () => void; - /** Wave-5 item 1 — Duplicate field. Supplied for creatable strata only (base Odoo fields - * offer no Duplicate — cloning the source of truth into an editable copy is out of scope). */ - onDuplicate?: () => void; - /** Wave-5 item 1 — save a permissions change. Supplied iff the VIEWER may change them - * (isAdmin || createdBy === viewer.name, and only on creatable strata). */ - onPermissions?: (edit: "everyone" | "creator" | "admins") => void; - /** Wave-5 item 10 — save a display format. Supplied for number/currency/formula and - * date/created_time fields. */ - onFormat?: (format: FieldFormat) => void; - /** Wave-5 item 1 — Sort by this field (replaces the view's sort), and the conditional - * clears (item 3). All of these mutate the EXISTING view config — no new host surface. */ - onSort: (dir: "asc" | "desc") => void; - onClearSort: () => void; - onFilterBy: () => void; - onClearFilter: () => void; - onGroupByField: () => void; - onClearGroup: () => void; - /** Assignable people, from the host's real user list. Empty = the host did not supply one, - * and "Assignee" is offered without choices rather than with invented ones. */ - userOptions?: string[]; - /** - * CG-8's measures, reused as the vocabulary of a FORMULA-MEASURE column (owner item 7): - * `Sales · the last 90 days` as a column the user creates. Empty = the semantic store is - * unavailable here, and the option is simply not offered (same rule as measure conditions). - */ - measures?: Measure[]; -} - -type CreatePosition = "left" | "right" | "end"; - -// ⚠ wave-7 item W4's menu-action icon set + `MenuLabel` MOVED to `icons.tsx` (wave-14 -// item 19): the view menu needs the same vocabulary, and two hand-drawn padlocks in two -// files is how one of them ends up a different padlock. `icon=` takes a NAME now. - -/** - * The menu's panes (wave-5 item 2). The NOTE editor and the editors used to render inline in - * the menu body; each opens its OWN dedicated window. One overlay, one pane at a time; - * "menu" is the action list. - * - * Owner item 8 (2026-07-31): "edit" ABSORBS the former "rename" and "swap" panes — one - * Airtable-grade Edit-field window owning the field's name, its type (with the per-type - * choices/stars/formula config), and the Change-field control that swaps the column to show - * another field. - */ -type MenuPane = "menu" | "note" | "edit" | "permissions" | "format"; - -/** - * How each creatable type reads in the menu. DERIVED from CREATABLE_TYPES rather than listed - * again: a hand-maintained copy is a third place the vocabulary lives, and the failure mode is - * silent — add a type to the contract, forget this list, and the type is accepted by the host, - * asserted by the drift gate, and simply never offered to anyone. - * - * `Record` is what forces it: adding a member to the union without a label - * here fails `tsc`, so the compiler is the gate and no test has to click a canvas header menu. - * - * Wave-8 I20: the map itself MOVED to icons.tsx, beside the per-type glyphs — a type's label - * and its icon are one vocabulary, and splitting them across two files is how they drift. - * Imported here; the totality guarantee above is unchanged (icons.tsx types it identically). - */ -const FIELD_TYPES = CREATABLE_TYPES.map((value) => ({ value, label: TYPE_LABELS[value] })); - -/** Types whose choices are declared in an options editor at creation time. */ -function needsOptions(t: FieldType | "measure"): boolean { - return t === "select" || t === "multiselect"; -} - -interface OptionDraft { - id: string; - label: string; - color: string; -} - -const DEFAULT_OPTION_LABELS = ["Not started", "In progress", "Blocked", "Done"]; -let optionDraftSequence = 0; - -function nextOptionDraftId(): string { - optionDraftSequence += 1; - return `choice-${optionDraftSequence}`; -} - -function optionDrafts( - labels: string[], - saved: Record | undefined = undefined -): OptionDraft[] { - return labels.map((label) => ({ - id: nextOptionDraftId(), - label, - color: - normalizeOptionColor(saved?.[label]) ?? - normalizeOptionColor(defaultOptionColor(label))!, - })); -} - -function optionSettings( - drafts: OptionDraft[], - type: FieldType | "measure" -): { options: string[]; colors: Record } { - const clean = drafts.map((draft) => - type === "multiselect" ? draft.label.replace(/,/g, " ") : draft.label - ); - const options = parseOptions(clean.join("\n")); - const firstByLabel = new Map(); - drafts.forEach((draft, index) => { - const label = clean[index].trim(); - if (label && !firstByLabel.has(label.toLowerCase())) - firstByLabel.set(label.toLowerCase(), draft); - }); - const colors: Record = {}; - for (const option of options) { - const draft = firstByLabel.get(option.toLowerCase()); - const color = normalizeOptionColor(draft?.color); - // The deterministic fallback is not durable data. Persist only a genuine user override; - // this keeps an untouched legacy field byte-stable while a renamed row retains its colour. - if (color && color !== normalizeOptionColor(defaultOptionColor(option))) - colors[option] = color; - } - return { options, colors }; -} - -function optionAppearanceSignature( - options: string[], - colors: Record | undefined -): string { - return options - .map((option) => { - const custom = colors - ? Object.entries(colors).find( - ([label]) => label.trim().toLowerCase() === option.toLowerCase() - )?.[1] - : undefined; - return `${option}\u0000${ - normalizeOptionColor(custom) ?? normalizeOptionColor(defaultOptionColor(option)) - }`; - }) - .join("\u0001"); -} - -/** - * Item 22 (R5) — the option COLOUR control: ten brand swatches, no free RGB. - * - * It was an ``, which offered sixteen million colours in a product whose - * whole visual argument is five. The trigger keeps the old 24px circle's footprint (it is the - * same affordance in the same place) and opens a 5×2 grid: each hue's light `-tint` on the top - * row, its `-pastel` beneath. A stored colour that is not on the palette marks its NEAREST - * swatch — so the picker says what the value reads as — and re-picking is what rewrites it. - */ -function SwatchPicker({ - value, - disabled, - label, - onPick, -}: { - value: string | undefined; - disabled?: boolean; - /** The option this colours, for the accessible name. */ - label: string; - onPick: (hex: string) => void; -}) { - const [open, setOpen] = useState(false); - const ref = useRef(null); - const current = nearestSwatch(value); - return ( - <> - - ))} -
- - )} - - ); -} - -function OptionsEditor({ - idPrefix, - drafts, - onDrafts, - colorCode, - onColorCode, - type, -}: { - idPrefix: string; - drafts: OptionDraft[]; - onDrafts: (next: OptionDraft[]) => void; - colorCode: boolean; - onColorCode: (next: boolean) => void; - type: FieldType | "measure"; -}) { - const update = (id: string, patch: Partial) => - onDrafts(drafts.map((draft) => (draft.id === id ? { ...draft, ...patch } : draft))); - const settings = optionSettings(drafts, type); - return ( -
-
- Options - -
-
- {drafts.map((draft, index) => ( -
- update(draft.id, { color: hex })} - /> - { - const label = - type === "multiselect" - ? event.target.value.replace(/,/g, " ") - : event.target.value; - update(draft.id, { label }); - }} - onKeyDown={(event) => { - if (event.key !== "Enter") return; - event.preventDefault(); - onDrafts([ - ...drafts, - { - id: nextOptionDraftId(), - label: "", - color: OPTION_PALETTE[drafts.length % OPTION_PALETTE.length].bg, - }, - ]); - }} - /> - -
- ))} -
- - - {settings.options.length} option{settings.options.length === 1 ? "" : "s"}. - {type === "multiselect" && " Commas inside an option are not supported."} - -
- ); -} - -/** - * The create-picker's kind: a creatable overlay type, or the FORMULA-MEASURE pseudo-kind. - * "measure" is deliberately NOT a FieldType — a measure column's real type comes from the - * measure itself (currency/int/pct), and widening the union would let it leak into every - * switch that renders cells. - */ -type CreateKind = FieldType | "measure"; - -/** - * Owner item 8 (2026-07-31) — the create pane's field-type picker: a find box over an icon - * listbox, replacing the icon-less native select. Each row wears the SAME mark its column - * header will wear (`FieldTypeIcon` ← TYPE_SHAPES), so the vocabulary teaches itself. The - * "measure" pseudo-kind borrows the currency mark: a measure column's real type is - * currency/int/pct, and inventing a 17th glyph for a pseudo-kind would put a mark on screen - * that no column ever wears. - */ -function TypePicker({ - value, - onPick, - offerMeasure, - only, -}: { - value: CreateKind; - onPick: (k: CreateKind) => void; - offerMeasure: boolean; - /** Restrict the list (the Edit-field pane passes RETYPE_TYPES — the overlay-editable - * strata a created field may become). Absent = every creatable type. */ - only?: readonly FieldType[]; -}) { - const [q, setQ] = useState(""); - const needle = q.trim().toLowerCase(); - const base = only - ? FIELD_TYPES.filter((r) => (only as readonly string[]).includes(r.value)) - : FIELD_TYPES; - const rows: { value: CreateKind; label: string }[] = [ - ...base, - // C-NAME (item 9, 2026-08-02): "Formula measure (over a period)" -> "Metric". Two words - // of jargon and a parenthetical, replaced by the word people already use for the thing. - // The internal key stays `measure` — see the C-NAME amendment in the wave doc. - ...(offerMeasure - ? [{ value: "measure" as CreateKind, label: "Metric" }] - : []), - ].filter((r) => !needle || r.label.toLowerCase().includes(needle)); - return ( -
-
- - setQ(event.target.value)} - /> -
-
- {rows.map((r) => ( - - ))} - {rows.length === 0 &&
No matching type.
} -
-
- ); -} - -/** The Change-field dropdown's "New field" entries. A colon cannot occur in a real field key - * (keys are slugs), so the prefix cannot collide with one. */ -const NEW_PREFIX = "new:"; - -/** - * The types a created field may be retyped TO (the Edit-field pane's type picker): the - * overlay-editable strata only. `formula` and `created_time` are a DIFFERENT stratum - * (source 'odoo', host-computed shape) — turning an overlay column into one is not a retype, - * and the host accepts in-place rebuilds on `custom_` overlay defs only. - */ -const RETYPE_TYPES = CREATABLE_TYPES.filter( - (t) => t !== "formula" && t !== "created_time" -); - -const DEFAULT_MEASURE_WINDOW: WindowSpec = { kind: "ltm" }; - -/** The head every pane shares: title line, context line, close X. */ -function PaneHead({ - title, - sub, - onClose, -}: { - title: string; - sub?: string; - onClose: () => void; -}) { - return ( -
-
-
{title}
- {sub &&
{sub}
} -
- -
- ); -} - -/** - * Wave-6 item 9c — the Scope control, rendered by BOTH create surfaces on the cohort page - * (one component so the two doors cannot drift). "This cohort table only" is the DEFAULT — - * the owner's ask: a field made while working a cohort belongs to that work unless the user - * says otherwise. - */ -function ScopeControl({ - value, - onValue, -}: { - value: FieldScope; - onValue: (v: FieldScope) => void; -}) { - return ( - - ); -} - -/** - * Wave-5 items 9/11 — the extra editors a new field's type may need, shared VERBATIM by the - * two create surfaces (insert-field and Change-field's "New field" half) so the two doors - * cannot drift: a FORMULA gets its source editor with live validation and a reference picker; - * a RATING gets its star count (the contract's 2..10). - */ -function ExtraTypeEditor({ - kind, - fields, - formulaText, - onFormulaText, - formulaError, - maxValue, - onMaxValue, - idPrefix, - showFormulaHelp = true, -}: { - kind: FieldType | "measure"; - fields: Field[]; - formulaText: string; - onFormulaText: (v: string) => void; - formulaError: string | null; - maxValue: number; - onMaxValue: (n: number) => void; - idPrefix: string; - showFormulaHelp?: boolean; -}) { - if (kind === "formula") { - // 2026-07-31 (owner item 2): other FORMULA fields are referencable now — evaluation is - // topological and a cycle is refused at validation, so the old exclusion is gone. - const referencable = fields.filter((f) => f.key !== "__proto__"); - return ( - <> -