diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index eea114ee..7aa6989f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -52,7 +52,7 @@ jobs: prefix = "rtichoke/_vendor/rtichoke_viz/" required = { f"{prefix}VENDORED_FROM", - f"{prefix}rtichoke-viz-0.20.2.tar.gz", + f"{prefix}rtichoke-viz-0.22.1.tar.gz", f"{prefix}rtichoke-viz.js", f"{prefix}rtichoke-viz.css", f"{prefix}rtichoke-viz.schema.json", @@ -60,6 +60,8 @@ jobs: f"{prefix}rtichoke-viz-report.schema.json", } assert required <= names + assert f"{prefix}rtichoke-viz-0.22.0.tar.gz" not in names + assert f"{prefix}rtichoke-viz-0.20.2.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.20.1.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.20.0.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.19.0.tar.gz" not in names diff --git a/.github/workflows/quarto-acceptance.yml b/.github/workflows/quarto-acceptance.yml index 2ef7904a..33344b05 100644 --- a/.github/workflows/quarto-acceptance.yml +++ b/.github/workflows/quarto-acceptance.yml @@ -15,6 +15,8 @@ on: - "tests/test_summary_report_browser.py" - "tests/test_summary_report_times_browser.py" - "tests/test_decision_curve_browser_acceptance.py" + - "tests/test_probs_histogram_browser_acceptance.py" + - "src/rtichoke/probs_distribution.py" - ".github/workflows/quarto-acceptance.yml" pull_request: branches: ["main"] @@ -30,6 +32,8 @@ on: - "tests/test_summary_report_browser.py" - "tests/test_summary_report_times_browser.py" - "tests/test_decision_curve_browser_acceptance.py" + - "tests/test_probs_histogram_browser_acceptance.py" + - "src/rtichoke/probs_distribution.py" - ".github/workflows/quarto-acceptance.yml" workflow_dispatch: @@ -65,3 +69,4 @@ jobs: tests/test_decision_curve_browser_acceptance.py tests/test_summary_report_browser.py tests/test_summary_report_times_browser.py + tests/test_probs_histogram_browser_acceptance.py diff --git a/src/rtichoke/__init__.py b/src/rtichoke/__init__.py index 896d7eb1..ff79f37f 100644 --- a/src/rtichoke/__init__.py +++ b/src/rtichoke/__init__.py @@ -57,12 +57,17 @@ render_performance_table as render_performance_table, ) +from rtichoke.probs_distribution import ( + create_probs_histogram as create_probs_histogram, +) + from rtichoke.summary_report.summary_report import ( create_summary_report as create_summary_report, create_summary_report_times as create_summary_report_times, ) __all__ = [ + "create_probs_histogram", "create_roc_curve", "create_roc_curve_times", "plot_roc_curve", diff --git a/src/rtichoke/_renderers.py b/src/rtichoke/_renderers.py index fae719e0..2d10c95f 100644 --- a/src/rtichoke/_renderers.py +++ b/src/rtichoke/_renderers.py @@ -8,6 +8,8 @@ from pathlib import Path from typing import Any, Literal +from rtichoke._report_browser import _resolve_render_report_symbol, _sanitize_nan_values + Renderer = Literal["plotly", "matplotlib", "browser", "rtichoke_viz"] _SUPPORTED_RENDERERS = ("plotly", "matplotlib", "browser", "rtichoke_viz") @@ -46,31 +48,69 @@ def write_html(self, path: str | Path) -> Path: output = Path(path) output.parent.mkdir(parents=True, exist_ok=True) vendor = files("rtichoke").joinpath("_vendor", "rtichoke_viz") - for asset in ("rtichoke-viz.js", "rtichoke-viz.css"): - (output.parent / asset).write_bytes(vendor.joinpath(asset).read_bytes()) - render_export = { - "roc": "renderRocV2", - "calibration": "renderCalibrationV2", - "precision_recall": "renderPrecisionRecallV2", - "gains": "renderGainsV2", - "lift": "renderLiftV2", - "decision_curve": "renderDecisionCurveV2", - "interventions_avoided": "renderInterventionsAvoidedV2", - }.get(str(self.spec.get("type"))) - if render_export is None: - raise ValueError( - f"rtichoke_viz does not support chart type {self.spec.get('type')!r}." + chart_type = str(self.spec.get("type")) + if chart_type == "prediction_distribution": + viz_js = vendor.joinpath("rtichoke-viz.js").read_text(encoding="utf-8") + viz_css = vendor.joinpath("rtichoke-viz.css").read_text(encoding="utf-8") + render_fn = _resolve_render_report_symbol( + viz_js, "renderPredictionDistribution" + ) + sanitized_spec = _sanitize_nan_values(self.spec) + spec_json = json.dumps(sanitized_spec, separators=(",", ":")).replace( + " + html = f""" + + + + + + rtichoke prediction_distribution chart + + +
+ + + + +""" + else: + for asset in ("rtichoke-viz.js", "rtichoke-viz.css"): + (output.parent / asset).write_bytes(vendor.joinpath(asset).read_bytes()) + + render_export = { + "roc": "renderRocV2", + "calibration": "renderCalibrationV2", + "precision_recall": "renderPrecisionRecallV2", + "gains": "renderGainsV2", + "lift": "renderLiftV2", + "decision_curve": "renderDecisionCurveV2", + "interventions_avoided": "renderInterventionsAvoidedV2", + }.get(chart_type) + if render_export is None: + raise ValueError( + f"rtichoke_viz does not support chart type {chart_type!r}." + ) + + spec_json = json.dumps(self.spec, separators=(",", ":")).replace( + " - rtichoke {self.spec.get("type")} chart + rtichoke {chart_type} chart
diff --git a/src/rtichoke/_report_browser.py b/src/rtichoke/_report_browser.py index 2f7a05cd..4611aec8 100644 --- a/src/rtichoke/_report_browser.py +++ b/src/rtichoke/_report_browser.py @@ -9,8 +9,10 @@ from typing import Any -def _resolve_render_report_symbol(viz_js: str) -> str: - """Resolve the local callable identifier exported as 'renderReport' from an ESM bundle.""" +def _resolve_render_report_symbol( + viz_js: str, symbol_name: str = "renderReport" +) -> str: + """Resolve the local callable identifier exported as symbol_name from an ESM bundle.""" export_pattern = re.compile(r"export\s*\{([^}]+)\}", re.DOTALL) for match in export_pattern.finditer(viz_js): clause = match.group(1) @@ -18,19 +20,19 @@ def _resolve_render_report_symbol(viz_js: str) -> str: parts = item.strip().split() if not parts: continue - if len(parts) == 3 and parts[1] == "as" and parts[2] == "renderReport": + if len(parts) == 3 and parts[1] == "as" and parts[2] == symbol_name: return parts[0] - if len(parts) == 1 and parts[0] == "renderReport": - return "renderReport" + if len(parts) == 1 and parts[0] == symbol_name: + return symbol_name if re.search( - r"export\s+(?:async\s+)?function\s+renderReport\b|export\s+(?:const|let|var)\s+renderReport\b", + rf"export\s+(?:async\s+)?function\s+{symbol_name}\b|export\s+(?:const|let|var)\s+{symbol_name}\b", viz_js, ): - return "renderReport" + return symbol_name raise ValueError( - "Could not resolve 'renderReport' export in provided JavaScript bundle." + f"Could not resolve {symbol_name!r} export in provided JavaScript bundle." ) diff --git a/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM b/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM index 075f5b99..277f0692 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM +++ b/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM @@ -1,5 +1,5 @@ repository=https://github.com/uriahf/rtichoke_viz -release=v0.20.2 -source_commit=40748bdeff7d535f516744886b64056f3aaa518d -archive=rtichoke-viz-0.20.2.tar.gz -sha256=2e4851159ceea0e3b2420c7e0aa22a566b94ec7057c27b13b7db7da88de34d11 +release=v0.22.1 +source_commit=7cc8e8c23ee2f073ff3d8e4f32198eaac4785eb2 +archive=rtichoke-viz-0.22.1.tar.gz +sha256=b812f3fc283d404d3d5982cd1a84157c3cce1f13afcdc87c392d7c9ddc029189 diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.20.2.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.20.2.tar.gz deleted file mode 100644 index 9abc58c8..00000000 Binary files a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.20.2.tar.gz and /dev/null differ diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.1.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.1.tar.gz new file mode 100644 index 00000000..4b5eaa35 Binary files /dev/null and b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.1.tar.gz differ diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json index 9b237629..e570ef8e 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json @@ -4672,6 +4672,303 @@ } } ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } + } + } + } + } + } } ] }, @@ -5322,55 +5619,352 @@ } } ] - } - ] - } - } - } - } - } - }, - { - "type": "object", - "required": [ - "schemaVersion", - "type", - "sections" - ], - "properties": { - "schemaVersion": { - "const": "1.1", - "type": "string" - }, - "type": { - "const": "report", - "type": "string" - }, - "title": { - "type": "string" - }, - "sections": { - "minItems": 1, - "type": "array", - "items": { - "type": "object", - "required": [ - "id", - "title", - "items" - ], - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "items": { - "minItems": 1, - "type": "array", - "items": { - "anyOf": [ + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } + } + } + } + } + } + } + ] + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "sections" + ], + "properties": { + "schemaVersion": { + "const": "1.1", + "type": "string" + }, + "type": { + "const": "report", + "type": "string" + }, + "title": { + "type": "string" + }, + "sections": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "title", + "items" + ], + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "items": { + "minItems": 1, + "type": "array", + "items": { + "anyOf": [ { "type": "object", "required": [ @@ -10015,15 +10609,312 @@ "type": "number" } } - } - ] + } + ] + } + ] + } + } + } + } + ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } } - ] + } } } } } - ] + } } ] }, @@ -10651,29 +11542,326 @@ "type": "string" } } - }, - "horizon": { - "minimum": 0, - "type": "number" - }, - "estimate": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ] - } + }, + "horizon": { + "minimum": 0, + "type": "number" + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } + ] + } + } + } + } + ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] } } - ] + } } } } } - ] + } } ] } @@ -15348,12 +16536,309 @@ } ] } - ] + ] + } + } + } + } + ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } } } } } - ] + } } ] }, @@ -16004,6 +17489,303 @@ } } ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } + } + } + } + } + } } ] } diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json index 46395a29..aed3d411 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json @@ -4631,6 +4631,303 @@ } } ] + }, + { + "type": "object", + "required": [ + "schemaVersion", + "type", + "evaluations", + "bins", + "operatingPoints" + ], + "properties": { + "schemaVersion": { + "const": "2.0", + "type": "string" + }, + "type": { + "const": "prediction_distribution", + "type": "string" + }, + "title": { + "type": "string" + }, + "evaluations": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "id", + "population" + ], + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "population": { + "type": "string" + }, + "label": { + "type": "string" + } + } + } + }, + "operatingPoint": { + "type": "object", + "required": [ + "dimension" + ], + "properties": { + "dimension": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + } + } + }, + "bins": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "lower", + "upper", + "includeLower", + "includeUpper", + "nPositive", + "nNegative" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "lower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "upper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "includeLower": { + "type": "boolean" + }, + "includeUpper": { + "type": "boolean" + }, + "nPositive": { + "minimum": 0, + "type": "integer" + }, + "nNegative": { + "minimum": 0, + "type": "integer" + } + } + } + }, + "rankBins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "rankLower", + "rankUpper", + "positiveMass", + "negativeMass" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "rankLower": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "rankUpper": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "positiveMass": { + "minimum": 0, + "type": "number" + }, + "negativeMass": { + "minimum": 0, + "type": "number" + } + } + } + }, + "operatingPoints": { + "minItems": 1, + "type": "array", + "items": { + "type": "object", + "required": [ + "evaluationId", + "type", + "value", + "cutoff", + "realizedPpcr" + ], + "properties": { + "evaluationId": { + "type": "string" + }, + "type": { + "anyOf": [ + { + "const": "probability_threshold", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + } + ] + }, + "value": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "cutoff": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "realizedPpcr": { + "minimum": 0, + "maximum": 1, + "type": "number" + }, + "performance": { + "type": "array", + "items": { + "type": "object", + "required": [ + "metricId", + "estimate" + ], + "properties": { + "metricId": { + "anyOf": [ + { + "const": "true_positives", + "type": "string" + }, + { + "const": "true_negatives", + "type": "string" + }, + { + "const": "false_positives", + "type": "string" + }, + { + "const": "false_negatives", + "type": "string" + }, + { + "const": "sensitivity", + "type": "string" + }, + { + "const": "specificity", + "type": "string" + }, + { + "const": "false_positive_rate", + "type": "string" + }, + { + "const": "ppv", + "type": "string" + }, + { + "const": "npv", + "type": "string" + }, + { + "const": "lift", + "type": "string" + }, + { + "const": "predicted_positives", + "type": "string" + }, + { + "const": "ppcr", + "type": "string" + }, + { + "const": "net_benefit", + "type": "string" + }, + { + "const": "net_benefit_interventions_avoided", + "type": "string" + } + ] + }, + "estimate": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "lower": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "upper": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + } + } + } + } + } + } + } + } } ] } diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css index 61a45c88..0cccd19a 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css @@ -615,3 +615,338 @@ border-left-color: #2563eb; } } + +/* Prediction Distribution Scoped Styling */ +.rtichoke-prediction-distribution { + display: flex; + flex-direction: column; + gap: 0.75rem; + box-sizing: border-box; +} + +.rtichoke-prediction-distribution__controls { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 1rem; +} + +.rtichoke-prediction-distribution__control-group { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +.rtichoke-prediction-distribution__select { + font-family: inherit; + font-size: 0.875rem; + padding: 0.25rem 0.5rem; + border: 1px solid #d1d5db; + border-radius: 4px; + background-color: #ffffff; + color: #111827; +} + +.rtichoke-prediction-distribution__summary { + display: flex; + flex-direction: column; + gap: 0.5rem; + padding: 0.75rem 1rem; + background-color: #f8fafc; + border: 1px solid #e2e8f0; + border-radius: 6px; + font-family: inherit; + font-size: 0.875rem; +} + +.rtichoke-prediction-distribution__metrics-row { + display: flex; + flex-wrap: wrap; + gap: 1.5rem; + font-size: 0.85rem; + color: #334155; +} + +.rtichoke-prediction-distribution__metric-badge { + display: flex; + align-items: center; + gap: 0.35rem; +} + +.rtichoke-prediction-distribution__metric-label { + color: #64748b; + font-weight: 500; +} + +.rtichoke-prediction-distribution__metric-value { + font-weight: 600; + color: #0f172a; +} + +.rtichoke-prediction-distribution__table { + border-collapse: collapse; + width: 100%; + max-width: 480px; + font-size: 0.825rem; + background-color: #ffffff; + border: 1px solid #cbd5e1; + border-radius: 4px; + overflow: hidden; + margin-top: 0.25rem; +} + +.rtichoke-prediction-distribution__table th, +.rtichoke-prediction-distribution__table td { + padding: 0.35rem 0.5rem; + text-align: center; + border: 1px solid #e2e8f0; + font-variant-numeric: tabular-nums; +} + +.rtichoke-prediction-distribution__table th { + background-color: #f1f5f9; + font-weight: 600; + color: #334155; +} + +.rtichoke-prediction-distribution__cell--tp, +.rtichoke-prediction-distribution__cell--tn { + background-color: #f0fdf4; + color: #166534; + font-weight: 600; +} + +.rtichoke-prediction-distribution__cell--fp, +.rtichoke-prediction-distribution__cell--fn { + background-color: #fef2f2; + color: #991b1b; + font-weight: 600; +} + +.rtichoke-prediction-distribution__cell--total { + background-color: #f8fafc; + color: #334155; + font-weight: 600; +} + +/* Enhanced Prediction Distribution Styling */ +.rtichoke-pd-controls-row { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 1.25rem; +} + +.rtichoke-pd-radio-group { + display: inline-flex; + align-items: center; + gap: 0.5rem; + font-family: inherit; + font-size: 13px; + color: #374151; +} + +.rtichoke-pd-radio-group-label { + font-weight: 600; + color: #111827; +} + +.rtichoke-pd-radio-options { + display: inline-flex; + align-items: center; + gap: 0.75rem; +} + +.rtichoke-pd-radio-option { + display: inline-flex; + align-items: center; + gap: 0.25rem; + font-size: 13px; + color: #374151; + cursor: pointer; + user-select: none; +} + +.rtichoke-pd-radio-option input[type="radio"] { + margin: 0; + cursor: pointer; +} + +.rtichoke-pd-matrix { + table-layout: fixed; + width: 100%; + max-width: 520px; + border-collapse: collapse; + font-size: 12px; + background-color: #ffffff; + border: 1px solid #cbd5e1; + border-radius: 4px; + overflow: hidden; +} + +.rtichoke-pd-matrix__corner { + background-color: #f8fafc; + padding: 0.4rem 0.5rem; + text-align: left; + border-right: 1px solid #cbd5e1; + border-bottom: 1px solid #cbd5e1; +} + +.rtichoke-pd-matrix__col-header { + padding: 0.35rem 0.5rem; + font-weight: 600; + font-size: 12px; + color: #334155; + background-color: #f8fafc; + border-bottom: 1px solid #cbd5e1; + border-right: 1px solid #e2e8f0; + text-align: center; +} + +.rtichoke-pd-matrix__col-header--blank { + background-color: #f8fafc; + border-bottom: 1px solid #cbd5e1; + border-right: none; +} + +.rtichoke-pd-matrix__col-header--active { + background-color: #eff6ff; + border-bottom: 2px solid #2563eb; +} + +.rtichoke-pd-matrix__row-header { + padding: 0.35rem 0.5rem; + font-weight: 600; + font-size: 12px; + color: #334155; + background-color: #f8fafc; + border-right: 1px solid #cbd5e1; + border-bottom: 1px solid #e2e8f0; + text-align: left; + white-space: nowrap; +} + +.rtichoke-pd-matrix__row-header--blank { + background-color: #f8fafc; + border-right: 1px solid #cbd5e1; + border-bottom: none; +} + +.rtichoke-pd-matrix__row-header--active { + background-color: #eff6ff; + border-left: 3px solid #2563eb; +} + +.rtichoke-pd-matrix__row--active { + background-color: #f8fafc; +} + +.rtichoke-pd-matrix__cell { + position: relative; + padding: 0.35rem 0.5rem; + text-align: center; + border-right: 1px solid #e2e8f0; + border-bottom: 1px solid #e2e8f0; + font-variant-numeric: tabular-nums; + z-index: 0; +} + +.rtichoke-pd-cell-bar { + position: absolute; + top: 3px; + bottom: 3px; + left: 3px; + pointer-events: none; + border-radius: 2px; + opacity: 0.25; + z-index: -1; +} + +/* Stable Typographic Skeleton */ +.rtichoke-pd-cell-content { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + position: relative; + z-index: 1; +} + +.rtichoke-pd-cell-content--margin { + justify-content: flex-end; +} + +.rtichoke-pd-cell-label { + font-weight: 600; + color: #475569; + width: 22px; + flex-shrink: 0; + text-align: left; +} + +.rtichoke-pd-cell-num { + display: flex; + flex-direction: column; + align-items: flex-end; + flex: 1; + text-align: right; +} + +.rtichoke-pd-cell-count { + font-weight: 700; + color: #0f172a; + font-variant-numeric: tabular-nums; +} + +.rtichoke-pd-cell-pct { + font-size: 10.5px; + color: #64748b; + font-variant-numeric: tabular-nums; + min-height: 14px; +} + +.rtichoke-pd-cond-option { + display: inline-flex; + align-items: center; + gap: 0.3rem; + cursor: pointer; + user-select: none; + font-weight: 600; +} + +.rtichoke-pd-cond-option input[type="radio"] { + margin: 0; + cursor: pointer; +} + +.rtichoke-pd-cond-option--active { + color: #2563eb; +} + +/* Performance Metrics integration using Performance Table Primitives */ +.rtichoke-pd-metrics-container { + width: 100%; + max-width: 520px; + margin-top: 0.25rem; +} + +.rtichoke-pd-metrics-table { + width: 100%; + table-layout: fixed; +} + +.rtichoke-pd-metric--emphasized-header { + color: #009E73 !important; + font-weight: 700 !important; +} + +.rtichoke-pd-metric--emphasized-cell { + background-color: #f0fdf4 !important; + font-weight: 700 !important; +} diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js index aa17b8dc..fd17f00a 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js @@ -1,61 +1,61 @@ -var y3=Object.defineProperty;var oa=(e,t)=>{for(var r in t)y3(e,r,{get:t[r],enumerable:!0})};var tr={};oa(tr,{HasPropertyKey:()=>Xu,IsArray:()=>xt,IsAsyncIterator:()=>Rh,IsBigInt:()=>jf,IsBoolean:()=>Oo,IsDate:()=>ia,IsFunction:()=>Ch,IsIterator:()=>Ah,IsNull:()=>Ph,IsNumber:()=>Nr,IsObject:()=>$e,IsRegExp:()=>Bf,IsString:()=>ze,IsSymbol:()=>kh,IsUint8Array:()=>Ro,IsUndefined:()=>gt});function Xu(e,t){return t in e}function Rh(e){return $e(e)&&!xt(e)&&!Ro(e)&&Symbol.asyncIterator in e}function xt(e){return Array.isArray(e)}function jf(e){return typeof e=="bigint"}function Oo(e){return typeof e=="boolean"}function ia(e){return e instanceof globalThis.Date}function Ch(e){return typeof e=="function"}function Ah(e){return $e(e)&&!xt(e)&&!Ro(e)&&Symbol.iterator in e}function Ph(e){return e===null}function Nr(e){return typeof e=="number"}function $e(e){return typeof e=="object"&&e!==null}function Bf(e){return e instanceof globalThis.RegExp}function ze(e){return typeof e=="string"}function kh(e){return typeof e=="symbol"}function Ro(e){return e instanceof globalThis.Uint8Array}function gt(e){return e===void 0}function x3(e){return e.map(t=>Zu(t))}function g3(e){return new Date(e.getTime())}function b3(e){return new Uint8Array(e)}function w3(e){return new RegExp(e.source,e.flags)}function S3(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Zu(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Zu(e[r]);return t}function Zu(e){return xt(e)?x3(e):ia(e)?g3(e):Ro(e)?b3(e):Bf(e)?w3(e):$e(e)?S3(e):e}function Xe(e){return Zu(e)}function rs(e,t){return t===void 0?Xe(e):Xe({...t,...e})}function Qu(e){return me(e)&&globalThis.Symbol.asyncIterator in e}function Ju(e){return me(e)&&globalThis.Symbol.iterator in e}function Nh(e){return me(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function el(e){return e instanceof globalThis.Promise}function ur(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function p1(e){return e instanceof globalThis.Map}function m1(e){return e instanceof globalThis.Set}function Yr(e){return globalThis.ArrayBuffer.isView(e)}function ns(e){return e instanceof globalThis.Uint8Array}function se(e,t){return t in e}function me(e){return e!==null&&typeof e=="object"}function fe(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Ze(e){return e===void 0}function Co(e){return e===null}function Yn(e){return typeof e=="boolean"}function Qe(e){return typeof e=="number"}function tl(e){return globalThis.Number.isInteger(e)}function xn(e){return typeof e=="bigint"}function Ee(e){return typeof e=="string"}function hi(e){return typeof e=="function"}function Ao(e){return typeof e=="symbol"}function Fr(e){return xn(e)||Yn(e)||Co(e)||Qe(e)||Ee(e)||Ao(e)||Ze(e)}var It;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(a,s){return e.ExactOptionalPropertyTypes?s in a:a[s]!==void 0}e.IsExactOptionalProperty=t;function r(a){let s=me(a);return e.AllowArrayObject?s:s&&!fe(a)}e.IsObjectLike=r;function n(a){return r(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=n;function o(a){return e.AllowNaN?Qe(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=Ze(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(It||(It={}));function I3(e){return globalThis.Object.freeze(e).map(t=>Gf(t))}function _3(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Gf(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Gf(e[r]);return globalThis.Object.freeze(t)}function Gf(e){return xt(e)?I3(e):ia(e)?e:Ro(e)?e:Bf(e)?e:$e(e)?_3(e):e}function P(e,t){let r=t!==void 0?{...t,...e}:e;switch(It.InstanceMode){case"freeze":return Gf(r);case"clone":return Xe(r);default:return r}}var ce=class extends Error{constructor(t){super(t)}};var tt=Symbol.for("TypeBox.Transform"),gn=Symbol.for("TypeBox.Readonly"),Ht=Symbol.for("TypeBox.Optional"),Wr=Symbol.for("TypeBox.Hint"),k=Symbol.for("TypeBox.Kind");function os(e){return $e(e)&&e[gn]==="Readonly"}function br(e){return $e(e)&&e[Ht]==="Optional"}function Fh(e){return Ie(e,"Any")}function Eh(e){return Ie(e,"Argument")}function bn(e){return Ie(e,"Array")}function aa(e){return Ie(e,"AsyncIterator")}function sa(e){return Ie(e,"BigInt")}function Po(e){return Ie(e,"Boolean")}function wn(e){return Ie(e,"Computed")}function Sn(e){return Ie(e,"Constructor")}function v3(e){return Ie(e,"Date")}function In(e){return Ie(e,"Function")}function _n(e){return Ie(e,"Integer")}function st(e){return Ie(e,"Intersect")}function fa(e){return Ie(e,"Iterator")}function Ie(e,t){return $e(e)&&k in e&&e[k]===t}function rl(e){return Oo(e)||Nr(e)||ze(e)}function Er(e){return Ie(e,"Literal")}function $r(e){return Ie(e,"MappedKey")}function Je(e){return Ie(e,"MappedResult")}function yi(e){return Ie(e,"Never")}function T3(e){return Ie(e,"Not")}function zf(e){return Ie(e,"Null")}function vn(e){return Ie(e,"Number")}function bt(e){return Ie(e,"Object")}function ca(e){return Ie(e,"Promise")}function ua(e){return Ie(e,"Record")}function lt(e){return Ie(e,"Ref")}function $h(e){return Ie(e,"RegExp")}function ko(e){return Ie(e,"String")}function Kf(e){return Ie(e,"Symbol")}function Lr(e){return Ie(e,"TemplateLiteral")}function M3(e){return Ie(e,"This")}function Re(e){return $e(e)&&tt in e}function Dr(e){return Ie(e,"Tuple")}function No(e){return Ie(e,"Undefined")}function ve(e){return Ie(e,"Union")}function O3(e){return Ie(e,"Uint8Array")}function R3(e){return Ie(e,"Unknown")}function C3(e){return Ie(e,"Unsafe")}function A3(e){return Ie(e,"Void")}function xi(e){return $e(e)&&k in e&&ze(e[k])}function rt(e){return Fh(e)||Eh(e)||bn(e)||Po(e)||sa(e)||aa(e)||wn(e)||Sn(e)||v3(e)||In(e)||_n(e)||st(e)||fa(e)||Er(e)||$r(e)||Je(e)||yi(e)||T3(e)||zf(e)||vn(e)||bt(e)||ca(e)||ua(e)||lt(e)||$h(e)||ko(e)||Kf(e)||Lr(e)||M3(e)||Dr(e)||No(e)||ve(e)||O3(e)||R3(e)||C3(e)||A3(e)||xi(e)}var _={};oa(_,{IsAny:()=>x1,IsArgument:()=>g1,IsArray:()=>b1,IsAsyncIterator:()=>w1,IsBigInt:()=>S1,IsBoolean:()=>I1,IsComputed:()=>_1,IsConstructor:()=>v1,IsDate:()=>T1,IsFunction:()=>M1,IsImport:()=>$3,IsInteger:()=>O1,IsIntersect:()=>R1,IsIterator:()=>C1,IsKind:()=>t2,IsKindOf:()=>be,IsLiteral:()=>Hf,IsLiteralBoolean:()=>L3,IsLiteralNumber:()=>P1,IsLiteralString:()=>A1,IsLiteralValue:()=>k1,IsMappedKey:()=>N1,IsMappedResult:()=>F1,IsNever:()=>E1,IsNot:()=>$1,IsNull:()=>L1,IsNumber:()=>D1,IsObject:()=>V1,IsOptional:()=>E3,IsPromise:()=>U1,IsProperties:()=>nl,IsReadonly:()=>F3,IsRecord:()=>j1,IsRecursive:()=>D3,IsRef:()=>B1,IsRegExp:()=>G1,IsSchema:()=>kt,IsString:()=>z1,IsSymbol:()=>K1,IsTemplateLiteral:()=>q1,IsThis:()=>H1,IsTransform:()=>Y1,IsTuple:()=>W1,IsUint8Array:()=>Z1,IsUndefined:()=>X1,IsUnion:()=>Uh,IsUnionLiteral:()=>V3,IsUnknown:()=>Q1,IsUnsafe:()=>J1,IsVoid:()=>e2,TypeGuardUnknownTypeError:()=>Lh});var Lh=class extends ce{},P3=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function d1(e){try{return new RegExp(e),!0}catch{return!1}}function Dh(e){if(!ze(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function h1(e){return Vh(e)||kt(e)}function qf(e){return gt(e)||jf(e)}function Ke(e){return gt(e)||Nr(e)}function Vh(e){return gt(e)||Oo(e)}function Le(e){return gt(e)||ze(e)}function k3(e){return gt(e)||ze(e)&&Dh(e)&&d1(e)}function N3(e){return gt(e)||ze(e)&&Dh(e)}function y1(e){return gt(e)||kt(e)}function F3(e){return $e(e)&&e[gn]==="Readonly"}function E3(e){return $e(e)&&e[Ht]==="Optional"}function x1(e){return be(e,"Any")&&Le(e.$id)}function g1(e){return be(e,"Argument")&&Nr(e.index)}function b1(e){return be(e,"Array")&&e.type==="array"&&Le(e.$id)&&kt(e.items)&&Ke(e.minItems)&&Ke(e.maxItems)&&Vh(e.uniqueItems)&&y1(e.contains)&&Ke(e.minContains)&&Ke(e.maxContains)}function w1(e){return be(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Le(e.$id)&&kt(e.items)}function S1(e){return be(e,"BigInt")&&e.type==="bigint"&&Le(e.$id)&&qf(e.exclusiveMaximum)&&qf(e.exclusiveMinimum)&&qf(e.maximum)&&qf(e.minimum)&&qf(e.multipleOf)}function I1(e){return be(e,"Boolean")&&e.type==="boolean"&&Le(e.$id)}function _1(e){return be(e,"Computed")&&ze(e.target)&&xt(e.parameters)&&e.parameters.every(t=>kt(t))}function v1(e){return be(e,"Constructor")&&e.type==="Constructor"&&Le(e.$id)&&xt(e.parameters)&&e.parameters.every(t=>kt(t))&&kt(e.returns)}function T1(e){return be(e,"Date")&&e.type==="Date"&&Le(e.$id)&&Ke(e.exclusiveMaximumTimestamp)&&Ke(e.exclusiveMinimumTimestamp)&&Ke(e.maximumTimestamp)&&Ke(e.minimumTimestamp)&&Ke(e.multipleOfTimestamp)}function M1(e){return be(e,"Function")&&e.type==="Function"&&Le(e.$id)&&xt(e.parameters)&&e.parameters.every(t=>kt(t))&&kt(e.returns)}function $3(e){return be(e,"Import")&&Xu(e,"$defs")&&$e(e.$defs)&&nl(e.$defs)&&Xu(e,"$ref")&&ze(e.$ref)&&e.$ref in e.$defs}function O1(e){return be(e,"Integer")&&e.type==="integer"&&Le(e.$id)&&Ke(e.exclusiveMaximum)&&Ke(e.exclusiveMinimum)&&Ke(e.maximum)&&Ke(e.minimum)&&Ke(e.multipleOf)}function nl(e){return $e(e)&&Object.entries(e).every(([t,r])=>Dh(t)&&kt(r))}function R1(e){return be(e,"Intersect")&&!(ze(e.type)&&e.type!=="object")&&xt(e.allOf)&&e.allOf.every(t=>kt(t)&&!Y1(t))&&Le(e.type)&&(Vh(e.unevaluatedProperties)||y1(e.unevaluatedProperties))&&Le(e.$id)}function C1(e){return be(e,"Iterator")&&e.type==="Iterator"&&Le(e.$id)&&kt(e.items)}function be(e,t){return $e(e)&&k in e&&e[k]===t}function A1(e){return Hf(e)&&ze(e.const)}function P1(e){return Hf(e)&&Nr(e.const)}function L3(e){return Hf(e)&&Oo(e.const)}function Hf(e){return be(e,"Literal")&&Le(e.$id)&&k1(e.const)}function k1(e){return Oo(e)||Nr(e)||ze(e)}function N1(e){return be(e,"MappedKey")&&xt(e.keys)&&e.keys.every(t=>Nr(t)||ze(t))}function F1(e){return be(e,"MappedResult")&&nl(e.properties)}function E1(e){return be(e,"Never")&&$e(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function $1(e){return be(e,"Not")&&kt(e.not)}function L1(e){return be(e,"Null")&&e.type==="null"&&Le(e.$id)}function D1(e){return be(e,"Number")&&e.type==="number"&&Le(e.$id)&&Ke(e.exclusiveMaximum)&&Ke(e.exclusiveMinimum)&&Ke(e.maximum)&&Ke(e.minimum)&&Ke(e.multipleOf)}function V1(e){return be(e,"Object")&&e.type==="object"&&Le(e.$id)&&nl(e.properties)&&h1(e.additionalProperties)&&Ke(e.minProperties)&&Ke(e.maxProperties)}function U1(e){return be(e,"Promise")&&e.type==="Promise"&&Le(e.$id)&&kt(e.item)}function j1(e){return be(e,"Record")&&e.type==="object"&&Le(e.$id)&&h1(e.additionalProperties)&&$e(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&d1(r[0])&&$e(t.patternProperties)&&kt(t.patternProperties[r[0]])})(e)}function D3(e){return $e(e)&&Wr in e&&e[Wr]==="Recursive"}function B1(e){return be(e,"Ref")&&Le(e.$id)&&ze(e.$ref)}function G1(e){return be(e,"RegExp")&&Le(e.$id)&&ze(e.source)&&ze(e.flags)&&Ke(e.maxLength)&&Ke(e.minLength)}function z1(e){return be(e,"String")&&e.type==="string"&&Le(e.$id)&&Ke(e.minLength)&&Ke(e.maxLength)&&k3(e.pattern)&&N3(e.format)}function K1(e){return be(e,"Symbol")&&e.type==="symbol"&&Le(e.$id)}function q1(e){return be(e,"TemplateLiteral")&&e.type==="string"&&ze(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function H1(e){return be(e,"This")&&Le(e.$id)&&ze(e.$ref)}function Y1(e){return $e(e)&&tt in e}function W1(e){return be(e,"Tuple")&&e.type==="array"&&Le(e.$id)&&Nr(e.minItems)&&Nr(e.maxItems)&&e.minItems===e.maxItems&&(gt(e.items)&>(e.additionalItems)&&e.minItems===0||xt(e.items)&&e.items.every(t=>kt(t)))}function X1(e){return be(e,"Undefined")&&e.type==="undefined"&&Le(e.$id)}function V3(e){return Uh(e)&&e.anyOf.every(t=>A1(t)||P1(t))}function Uh(e){return be(e,"Union")&&Le(e.$id)&&$e(e)&&xt(e.anyOf)&&e.anyOf.every(t=>kt(t))}function Z1(e){return be(e,"Uint8Array")&&e.type==="Uint8Array"&&Le(e.$id)&&Ke(e.minByteLength)&&Ke(e.maxByteLength)}function Q1(e){return be(e,"Unknown")&&Le(e.$id)}function J1(e){return be(e,"Unsafe")}function e2(e){return be(e,"Void")&&e.type==="void"&&Le(e.$id)}function t2(e){return $e(e)&&k in e&&ze(e[k])&&!P3.includes(e[k])}function kt(e){return $e(e)&&(x1(e)||g1(e)||b1(e)||I1(e)||S1(e)||w1(e)||_1(e)||v1(e)||T1(e)||M1(e)||O1(e)||R1(e)||C1(e)||Hf(e)||N1(e)||F1(e)||E1(e)||$1(e)||L1(e)||D1(e)||V1(e)||U1(e)||j1(e)||B1(e)||G1(e)||z1(e)||K1(e)||q1(e)||H1(e)||W1(e)||X1(e)||Uh(e)||Z1(e)||Q1(e)||J1(e)||e2(e)||t2(e))}var jh="(true|false)",Yf="(0|[1-9][0-9]*)",Bh="(.*)",U3="(?!.*)",QU=`^${jh}$`,gi=`^${Yf}$`,bi=`^${Bh}$`,r2=`^${U3}$`;var wi={};oa(wi,{Clear:()=>B3,Delete:()=>G3,Entries:()=>j3,Get:()=>q3,Has:()=>z3,Set:()=>K3});var is=new Map;function j3(){return new Map(is)}function B3(){return is.clear()}function G3(e){return is.delete(e)}function z3(e){return is.has(e)}function K3(e,t){is.set(e,t)}function q3(e){return is.get(e)}var Tn={};oa(Tn,{Clear:()=>Y3,Delete:()=>W3,Entries:()=>H3,Get:()=>Q3,Has:()=>X3,Set:()=>Z3});var as=new Map;function H3(){return new Map(as)}function Y3(){return as.clear()}function W3(e){return as.delete(e)}function X3(e){return as.has(e)}function Z3(e,t){as.set(e,t)}function Q3(e){return as.get(e)}function n2(e,t){return e.includes(t)}function o2(e){return[...new Set(e)]}function J3(e,t){return e.filter(r=>t.includes(r))}function e5(e,t){return e.reduce((r,n)=>J3(r,n),t)}function i2(e){return e.length===1?e[0]:e.length>1?e5(e.slice(1),e[0]):[]}function a2(e){let t=[];for(let r of e)t.push(...r);return t}function Si(e){return P({[k]:"Any"},e)}function ss(e,t){return P({[k]:"Array",type:"array",items:e},t)}function s2(e){return P({[k]:"Argument",index:e})}function fs(e,t){return P({[k]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function He(e,t,r){return P({[k]:"Computed",target:e,parameters:t},r)}function t5(e,t){let{[t]:r,...n}=e;return n}function ft(e,t){return t.reduce((r,n)=>t5(r,n),e)}function ge(e){return P({[k]:"Never",not:{}},e)}function Te(e){return P({[k]:"MappedResult",properties:e})}function cs(e,t,r){return P({[k]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function Wn(e,t,r){return P({[k]:"Function",type:"Function",parameters:e,returns:t},r)}function Wf(e,t){return P({[k]:"Union",anyOf:e},t)}function r5(e){return e.some(t=>br(t))}function f2(e){return e.map(t=>br(t)?n5(t):t)}function n5(e){return ft(e,[Ht])}function o5(e,t){return r5(e)?rr(Wf(f2(e),t)):Wf(f2(e),t)}function Xn(e,t){return e.length===1?P(e[0],t):e.length===0?ge(t):o5(e,t)}function Ce(e,t){return e.length===0?ge(t):e.length===1?P(e[0],t):Wf(e,t)}var ol=class extends ce{};function i5(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Gh(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function Eo(e,t){return Gh(e,t,"(")}function Xf(e,t){return Gh(e,t,")")}function c2(e,t){return Gh(e,t,"|")}function a5(e){if(!(Eo(e,0)&&Xf(e,e.length-1)))return!1;let t=0;for(let r=0;r0&&n.push(us(a)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(us(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function l5(e){function t(o,i){if(!Eo(o,i))throw new ol("TemplateLiteralParser: Index must point to open parens");let a=0;for(let s=i;s0&&n.push(us(s)),o=a-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function us(e){return a5(e)?us(s5(e)):f5(e)?u5(e):c5(e)?l5(e):{type:"const",const:i5(e)}}function ls(e){return us(e.slice(1,e.length-1))}var zh=class extends ce{};function p5(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function m5(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function d5(e){return e.type==="const"&&e.const===".*"}function la(e){return p5(e)||d5(e)?!1:m5(e)?!0:e.type==="and"?e.expr.every(t=>la(t)):e.type==="or"?e.expr.every(t=>la(t)):e.type==="const"?!0:(()=>{throw new zh("Unknown expression type")})()}function il(e){let t=ls(e.pattern);return la(t)}var Kh=class extends ce{};function*u2(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of u2(e.slice(1)))yield`${t}${r}`}function*h5(e){return yield*u2(e.expr.map(t=>[...Zf(t)]))}function*y5(e){for(let t of e.expr)yield*Zf(t)}function*x5(e){return yield e.const}function*Zf(e){return e.type==="and"?yield*h5(e):e.type==="or"?yield*y5(e):e.type==="const"?yield*x5(e):(()=>{throw new Kh("Unknown expression")})()}function ps(e){let t=ls(e.pattern);return la(t)?[...Zf(t)]:[]}function _e(e,t){return P({[k]:"Literal",const:e,type:typeof e},t)}function al(e){return P({[k]:"Boolean",type:"boolean"},e)}function ms(e){return P({[k]:"BigInt",type:"bigint"},e)}function Xr(e){return P({[k]:"Number",type:"number"},e)}function lr(e){return P({[k]:"String",type:"string"},e)}function*g5(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield al():t==="number"?yield Xr():t==="bigint"?yield ms():t==="string"?yield lr():yield(()=>{let r=t.split("|").map(n=>_e(n.trim()));return r.length===0?ge():r.length===1?r[0]:Xn(r)})()}function*b5(e){if(e[1]!=="{"){let t=_e("$"),r=qh(e.slice(1));return yield*[t,...r]}for(let t=2;tp2(r,t)).join("|")})`:vn(e)?`${t}${Yf}`:_n(e)?`${t}${Yf}`:sa(e)?`${t}${Yf}`:ko(e)?`${t}${Bh}`:Er(e)?`${t}${w5(e.const.toString())}`:Po(e)?`${t}${jh}`:(()=>{throw new Hh(`Unexpected Kind '${e[k]}'`)})()}function Yh(e){return`^${e.map(t=>p2(t,"")).join("")}$`}function pa(e){let r=ps(e).map(n=>_e(n));return Xn(r)}function sl(e,t){let r=ze(e)?Yh(l2(e)):Yh(e);return P({[k]:"TemplateLiteral",type:"string",pattern:r},t)}function S5(e){return ps(e).map(r=>r.toString())}function I5(e){let t=[];for(let r of e)t.push(...wr(r));return t}function _5(e){return[e.toString()]}function wr(e){return[...new Set(Lr(e)?S5(e):ve(e)?I5(e.anyOf):Er(e)?_5(e.const):vn(e)?["[number]"]:_n(e)?["[number]"]:[])]}function v5(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=Ii(e,wr(t[o]),r);return n}function T5(e,t,r){return v5(e,t.properties,r)}function m2(e,t,r){let n=T5(e,t,r);return Te(n)}function h2(e,t){return e.map(r=>y2(r,t))}function M5(e){return e.filter(t=>!yi(t))}function O5(e,t){return fl(M5(h2(e,t)))}function R5(e){return e.some(t=>yi(t))?[]:e}function C5(e,t){return Xn(R5(h2(e,t)))}function A5(e,t){return t in e?e[t]:t==="[number]"?Xn(e):ge()}function P5(e,t){return t==="[number]"?e:ge()}function k5(e,t){return t in e?e[t]:ge()}function y2(e,t){return st(e)?O5(e.allOf,t):ve(e)?C5(e.anyOf,t):Dr(e)?A5(e.items??[],t):bn(e)?P5(e.items,t):bt(e)?k5(e.properties,t):ge()}function Qf(e,t){return t.map(r=>y2(e,r))}function d2(e,t){return Xn(Qf(e,t))}function Ii(e,t,r){if(lt(e)||lt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!rt(e)||!rt(t))throw new ce(n);return He("Index",[e,t])}return Je(t)?m2(e,t,r):$r(t)?x2(e,t,r):P(rt(t)?d2(e,wr(t)):d2(e,t),r)}function N5(e,t,r){return{[t]:Ii(e,[t],Xe(r))}}function F5(e,t,r){return t.reduce((n,o)=>({...n,...N5(e,o,r)}),{})}function E5(e,t,r){return F5(e,t.keys,r)}function x2(e,t,r){let n=E5(e,t,r);return Te(n)}function ds(e,t){return P({[k]:"Iterator",type:"Iterator",items:e},t)}function $5(e){return globalThis.Object.keys(e).filter(t=>!br(e[t]))}function L5(e,t){let r=$5(e),n=r.length>0?{[k]:"Object",type:"object",required:r,properties:e}:{[k]:"Object",type:"object",properties:e};return P(n,t)}var Ae=L5;function cl(e,t){return P({[k]:"Promise",type:"Promise",item:e},t)}function D5(e){return P(ft(e,[gn]))}function V5(e){return P({...e,[gn]:"Readonly"})}function U5(e,t){return t===!1?D5(e):V5(e)}function Sr(e,t){let r=t??!0;return Je(e)?g2(e,r):U5(e,r)}function j5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Sr(e[n],t);return r}function B5(e,t){return j5(e.properties,t)}function g2(e,t){let r=B5(e,t);return Te(r)}function Zr(e,t){return P(e.length>0?{[k]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[k]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function b2(e,t){return e in t?Qr(e,t[e]):Te(t)}function G5(e){return{[e]:_e(e)}}function z5(e){let t={};for(let r of e)t[r]=_e(r);return t}function K5(e,t){return n2(t,e)?G5(e):z5(t)}function q5(e,t){let r=K5(e,t);return b2(e,r)}function Jf(e,t){return t.map(r=>Qr(e,r))}function H5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=Qr(e,t[n]);return r}function Qr(e,t){let r={...t};return br(t)?rr(Qr(e,ft(t,[Ht]))):os(t)?Sr(Qr(e,ft(t,[gn]))):Je(t)?b2(e,t.properties):$r(t)?q5(e,t.keys):Sn(t)?cs(Jf(e,t.parameters),Qr(e,t.returns),r):In(t)?Wn(Jf(e,t.parameters),Qr(e,t.returns),r):aa(t)?fs(Qr(e,t.items),r):fa(t)?ds(Qr(e,t.items),r):st(t)?nr(Jf(e,t.allOf),r):ve(t)?Ce(Jf(e,t.anyOf),r):Dr(t)?Zr(Jf(e,t.items??[]),r):bt(t)?Ae(H5(e,t.properties),r):bn(t)?ss(Qr(e,t.items),r):ca(t)?cl(Qr(e,t.item),r):t}function Y5(e,t){let r={};for(let n of e)r[n]=Qr(n,t);return r}function w2(e,t,r){let n=rt(e)?wr(e):e,o=t({[k]:"MappedKey",keys:n}),i=Y5(n,o);return Ae(i,r)}function W5(e){return P(ft(e,[Ht]))}function X5(e){return P({...e,[Ht]:"Optional"})}function Z5(e,t){return t===!1?W5(e):X5(e)}function rr(e,t){let r=t??!0;return Je(e)?S2(e,r):Z5(e,r)}function Q5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=rr(e[n],t);return r}function J5(e,t){return Q5(e.properties,t)}function S2(e,t){let r=J5(e,t);return Te(r)}function ec(e,t={}){let r=e.every(o=>bt(o)),n=rt(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return P(t.unevaluatedProperties===!1||rt(t.unevaluatedProperties)||r?{...n,[k]:"Intersect",type:"object",allOf:e}:{...n,[k]:"Intersect",allOf:e},t)}function eO(e){return e.every(t=>br(t))}function tO(e){return ft(e,[Ht])}function I2(e){return e.map(t=>br(t)?tO(t):t)}function rO(e,t){return eO(e)?rr(ec(I2(e),t)):ec(I2(e),t)}function fl(e,t={}){if(e.length===1)return P(e[0],t);if(e.length===0)return ge(t);if(e.some(r=>Re(r)))throw new Error("Cannot intersect transform types");return rO(e,t)}function nr(e,t){if(e.length===1)return P(e[0],t);if(e.length===0)return ge(t);if(e.some(r=>Re(r)))throw new Error("Cannot intersect transform types");return ec(e,t)}function Zn(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new ce("Ref: $ref must be a string");return P({[k]:"Ref",$ref:t},r)}function nO(e,t){return He("Awaited",[He(e,t)])}function oO(e){return He("Awaited",[Zn(e)])}function iO(e){return nr(_2(e))}function aO(e){return Ce(_2(e))}function sO(e){return hs(e)}function _2(e){return e.map(t=>hs(t))}function hs(e,t){return P(wn(e)?nO(e.target,e.parameters):st(e)?iO(e.allOf):ve(e)?aO(e.anyOf):ca(e)?sO(e.item):lt(e)?oO(e.$ref):e,t)}function v2(e){let t=[];for(let r of e)t.push(Ir(r));return t}function fO(e){let t=v2(e);return a2(t)}function cO(e){let t=v2(e);return i2(t)}function uO(e){return e.map((t,r)=>r.toString())}function lO(e){return["[number]"]}function pO(e){return globalThis.Object.getOwnPropertyNames(e)}function mO(e){return Wh?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Ir(e){return st(e)?fO(e.allOf):ve(e)?cO(e.anyOf):Dr(e)?uO(e.items??[]):bn(e)?lO(e.items):bt(e)?pO(e.properties):ua(e)?mO(e.patternProperties):[]}var Wh=!1;function ys(e){Wh=!0;let t=Ir(e);return Wh=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function dO(e,t){return He("KeyOf",[He(e,t)])}function hO(e){return He("KeyOf",[Zn(e)])}function yO(e,t){let r=Ir(e),n=xO(r),o=Xn(n);return P(o,t)}function xO(e){return e.map(t=>t==="[number]"?Xr():_e(t))}function xs(e,t){return wn(e)?dO(e.target,e.parameters):lt(e)?hO(e.$ref):Je(e)?T2(e,t):yO(e,t)}function gO(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=xs(e[n],Xe(t));return r}function bO(e,t){return gO(e.properties,t)}function T2(e,t){let r=bO(e,t);return Te(r)}function ul(e){let t=Ir(e),r=Qf(e,t);return t.map((n,o)=>[t[o],r[o]])}function wO(e){let t=[];for(let r of e)t.push(...Ir(r));return o2(t)}function SO(e){return e.filter(t=>!yi(t))}function IO(e,t){let r=[];for(let n of e)r.push(...Qf(n,[t]));return SO(r)}function _O(e,t){let r={};for(let n of t)r[n]=fl(IO(e,n));return r}function M2(e,t){let r=wO(e),n=_O(e,r);return Ae(n,t)}function ll(e){return P({[k]:"Date",type:"Date"},e)}function pl(e){return P({[k]:"Null",type:"null"},e)}function ml(e){return P({[k]:"Symbol",type:"symbol"},e)}function dl(e){return P({[k]:"Undefined",type:"undefined"},e)}function hl(e){return P({[k]:"Uint8Array",type:"Uint8Array"},e)}function Mn(e){return P({[k]:"Unknown"},e)}function vO(e){return e.map(t=>Xh(t,!1))}function TO(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Sr(Xh(e[r],!1));return t}function yl(e,t){return t===!0?e:Sr(e)}function Xh(e,t){return Rh(e)?yl(Si(),t):Ah(e)?yl(Si(),t):xt(e)?Sr(Zr(vO(e))):Ro(e)?hl():ia(e)?ll():$e(e)?yl(Ae(TO(e)),t):Ch(e)?yl(Wn([],Mn()),t):gt(e)?dl():Ph(e)?pl():kh(e)?ml():jf(e)?ms():Nr(e)?_e(e):Oo(e)?_e(e):ze(e)?_e(e):Ae({})}function O2(e,t){return P(Xh(e,!0),t)}function R2(e,t){return Sn(e)?Zr(e.parameters,t):ge(t)}function C2(e,t){if(gt(e))throw new Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),o=[...new Set(r)].map(i=>_e(i));return Ce(o,{...t,[Wr]:"Enum"})}var Qh=class extends ce{},N;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(N||(N={}));function Jr(e){return e===N.False?e:N.True}function gs(e){throw new Qh(e)}function _t(e){return _.IsNever(e)||_.IsIntersect(e)||_.IsUnion(e)||_.IsUnknown(e)||_.IsAny(e)}function vt(e,t){return _.IsNever(t)?$2(e,t):_.IsIntersect(t)?xl(e,t):_.IsUnion(t)?r0(e,t):_.IsUnknown(t)?U2(e,t):_.IsAny(t)?t0(e,t):gs("StructuralRight")}function t0(e,t){return N.True}function MO(e,t){return _.IsIntersect(t)?xl(e,t):_.IsUnion(t)&&t.anyOf.some(r=>_.IsAny(r)||_.IsUnknown(r))?N.True:_.IsUnion(t)?N.Union:_.IsUnknown(t)||_.IsAny(t)?N.True:N.Union}function OO(e,t){return _.IsUnknown(e)?N.False:_.IsAny(e)?N.Union:_.IsNever(e)?N.True:N.False}function RO(e,t){return _.IsObject(t)&&gl(t)?N.True:_t(t)?vt(e,t):_.IsArray(t)?Jr(De(e.items,t.items)):N.False}function CO(e,t){return _t(t)?vt(e,t):_.IsAsyncIterator(t)?Jr(De(e.items,t.items)):N.False}function AO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsBigInt(t)?N.True:N.False}function F2(e,t){return _.IsLiteralBoolean(e)||_.IsBoolean(e)?N.True:N.False}function PO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsBoolean(t)?N.True:N.False}function kO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsConstructor(t)?e.parameters.length>t.parameters.length?N.False:e.parameters.every((r,n)=>Jr(De(t.parameters[n],r))===N.True)?Jr(De(e.returns,t.returns)):N.False:N.False}function NO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsDate(t)?N.True:N.False}function FO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsFunction(t)?e.parameters.length>t.parameters.length?N.False:e.parameters.every((r,n)=>Jr(De(t.parameters[n],r))===N.True)?Jr(De(e.returns,t.returns)):N.False:N.False}function E2(e,t){return _.IsLiteral(e)&&tr.IsNumber(e.const)||_.IsNumber(e)||_.IsInteger(e)?N.True:N.False}function EO(e,t){return _.IsInteger(t)||_.IsNumber(t)?N.True:_t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):N.False}function xl(e,t){return t.allOf.every(r=>De(e,r)===N.True)?N.True:N.False}function $O(e,t){return e.allOf.some(r=>De(r,t)===N.True)?N.True:N.False}function LO(e,t){return _t(t)?vt(e,t):_.IsIterator(t)?Jr(De(e.items,t.items)):N.False}function DO(e,t){return _.IsLiteral(t)&&t.const===e.const?N.True:_t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsString(t)?V2(e,t):_.IsNumber(t)?L2(e,t):_.IsInteger(t)?E2(e,t):_.IsBoolean(t)?F2(e,t):N.False}function $2(e,t){return N.False}function VO(e,t){return N.True}function A2(e){let[t,r]=[e,0];for(;_.IsNot(t);)t=t.not,r+=1;return r%2===0?t:Mn()}function UO(e,t){return _.IsNot(e)?De(A2(e),t):_.IsNot(t)?De(e,A2(t)):gs("Invalid fallthrough for Not")}function jO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsNull(t)?N.True:N.False}function L2(e,t){return _.IsLiteralNumber(e)||_.IsNumber(e)||_.IsInteger(e)?N.True:N.False}function BO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsInteger(t)||_.IsNumber(t)?N.True:N.False}function _r(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function P2(e){return gl(e)}function k2(e){return _r(e,0)||_r(e,1)&&"description"in e.properties&&_.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(_.IsString(e.properties.description.anyOf[0])&&_.IsUndefined(e.properties.description.anyOf[1])||_.IsString(e.properties.description.anyOf[1])&&_.IsUndefined(e.properties.description.anyOf[0]))}function Zh(e){return _r(e,0)}function N2(e){return _r(e,0)}function GO(e){return _r(e,0)}function zO(e){return _r(e,0)}function KO(e){return gl(e)}function qO(e){let t=Xr();return _r(e,0)||_r(e,1)&&"length"in e.properties&&Jr(De(e.properties.length,t))===N.True}function HO(e){return _r(e,0)}function gl(e){let t=Xr();return _r(e,0)||_r(e,1)&&"length"in e.properties&&Jr(De(e.properties.length,t))===N.True}function YO(e){let t=Wn([Si()],Si());return _r(e,0)||_r(e,1)&&"then"in e.properties&&Jr(De(e.properties.then,t))===N.True}function D2(e,t){return De(e,t)===N.False||_.IsOptional(e)&&!_.IsOptional(t)?N.False:N.True}function or(e,t){return _.IsUnknown(e)?N.False:_.IsAny(e)?N.Union:_.IsNever(e)||_.IsLiteralString(e)&&P2(t)||_.IsLiteralNumber(e)&&Zh(t)||_.IsLiteralBoolean(e)&&N2(t)||_.IsSymbol(e)&&k2(t)||_.IsBigInt(e)&&GO(t)||_.IsString(e)&&P2(t)||_.IsSymbol(e)&&k2(t)||_.IsNumber(e)&&Zh(t)||_.IsInteger(e)&&Zh(t)||_.IsBoolean(e)&&N2(t)||_.IsUint8Array(e)&&KO(t)||_.IsDate(e)&&zO(t)||_.IsConstructor(e)&&HO(t)||_.IsFunction(e)&&qO(t)?N.True:_.IsRecord(e)&&_.IsString(Jh(e))?t[Wr]==="Record"?N.True:N.False:_.IsRecord(e)&&_.IsNumber(Jh(e))?_r(t,0)?N.True:N.False:N.False}function WO(e,t){return _t(t)?vt(e,t):_.IsRecord(t)?en(e,t):_.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!_.IsOptional(t.properties[r]))return N.False;if(_.IsOptional(t.properties[r]))return N.True;if(D2(e.properties[r],t.properties[r])===N.False)return N.False}return N.True})():N.False}function XO(e,t){return _t(t)?vt(e,t):_.IsObject(t)&&YO(t)?N.True:_.IsPromise(t)?Jr(De(e.item,t.item)):N.False}function Jh(e){return gi in e.patternProperties?Xr():bi in e.patternProperties?lr():gs("Unknown record key pattern")}function e0(e){return gi in e.patternProperties?e.patternProperties[gi]:bi in e.patternProperties?e.patternProperties[bi]:gs("Unable to get record value schema")}function en(e,t){let[r,n]=[Jh(t),e0(t)];return _.IsLiteralString(e)&&_.IsNumber(r)&&Jr(De(e,n))===N.True?N.True:_.IsUint8Array(e)&&_.IsNumber(r)||_.IsString(e)&&_.IsNumber(r)||_.IsArray(e)&&_.IsNumber(r)?De(e,n):_.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(D2(n,e.properties[o])===N.False)return N.False;return N.True})():N.False}function ZO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?De(e0(e),e0(t)):N.False}function QO(e,t){let r=_.IsRegExp(e)?lr():e,n=_.IsRegExp(t)?lr():t;return De(r,n)}function V2(e,t){return _.IsLiteral(e)&&tr.IsString(e.const)||_.IsString(e)?N.True:N.False}function JO(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsString(t)?N.True:N.False}function e4(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsSymbol(t)?N.True:N.False}function t4(e,t){return _.IsTemplateLiteral(e)?De(pa(e),t):_.IsTemplateLiteral(t)?De(e,pa(t)):gs("Invalid fallthrough for TemplateLiteral")}function r4(e,t){return _.IsArray(t)&&e.items!==void 0&&e.items.every(r=>De(r,t.items)===N.True)}function n4(e,t){return _.IsNever(e)?N.True:_.IsUnknown(e)?N.False:_.IsAny(e)?N.Union:N.False}function o4(e,t){return _t(t)?vt(e,t):_.IsObject(t)&&gl(t)||_.IsArray(t)&&r4(e,t)?N.True:_.IsTuple(t)?tr.IsUndefined(e.items)&&!tr.IsUndefined(t.items)||!tr.IsUndefined(e.items)&&tr.IsUndefined(t.items)?N.False:tr.IsUndefined(e.items)&&!tr.IsUndefined(t.items)||e.items.every((r,n)=>De(r,t.items[n])===N.True)?N.True:N.False:N.False}function i4(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsUint8Array(t)?N.True:N.False}function a4(e,t){return _t(t)?vt(e,t):_.IsObject(t)?or(e,t):_.IsRecord(t)?en(e,t):_.IsVoid(t)?c4(e,t):_.IsUndefined(t)?N.True:N.False}function r0(e,t){return t.anyOf.some(r=>De(e,r)===N.True)?N.True:N.False}function s4(e,t){return e.anyOf.every(r=>De(r,t)===N.True)?N.True:N.False}function U2(e,t){return N.True}function f4(e,t){return _.IsNever(t)?$2(e,t):_.IsIntersect(t)?xl(e,t):_.IsUnion(t)?r0(e,t):_.IsAny(t)?t0(e,t):_.IsString(t)?V2(e,t):_.IsNumber(t)?L2(e,t):_.IsInteger(t)?E2(e,t):_.IsBoolean(t)?F2(e,t):_.IsArray(t)?OO(e,t):_.IsTuple(t)?n4(e,t):_.IsObject(t)?or(e,t):_.IsUnknown(t)?N.True:N.False}function c4(e,t){return _.IsUndefined(e)||_.IsUndefined(e)?N.True:N.False}function u4(e,t){return _.IsIntersect(t)?xl(e,t):_.IsUnion(t)?r0(e,t):_.IsUnknown(t)?U2(e,t):_.IsAny(t)?t0(e,t):_.IsObject(t)?or(e,t):_.IsVoid(t)?N.True:N.False}function De(e,t){return _.IsTemplateLiteral(e)||_.IsTemplateLiteral(t)?t4(e,t):_.IsRegExp(e)||_.IsRegExp(t)?QO(e,t):_.IsNot(e)||_.IsNot(t)?UO(e,t):_.IsAny(e)?MO(e,t):_.IsArray(e)?RO(e,t):_.IsBigInt(e)?AO(e,t):_.IsBoolean(e)?PO(e,t):_.IsAsyncIterator(e)?CO(e,t):_.IsConstructor(e)?kO(e,t):_.IsDate(e)?NO(e,t):_.IsFunction(e)?FO(e,t):_.IsInteger(e)?EO(e,t):_.IsIntersect(e)?$O(e,t):_.IsIterator(e)?LO(e,t):_.IsLiteral(e)?DO(e,t):_.IsNever(e)?VO(e,t):_.IsNull(e)?jO(e,t):_.IsNumber(e)?BO(e,t):_.IsObject(e)?WO(e,t):_.IsRecord(e)?ZO(e,t):_.IsString(e)?JO(e,t):_.IsSymbol(e)?e4(e,t):_.IsTuple(e)?o4(e,t):_.IsPromise(e)?XO(e,t):_.IsUint8Array(e)?i4(e,t):_.IsUndefined(e)?a4(e,t):_.IsUnion(e)?s4(e,t):_.IsUnknown(e)?f4(e,t):_.IsVoid(e)?u4(e,t):gs(`Unknown left type operand '${e[k]}'`)}function _i(e,t){return De(e,t)}function l4(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=bs(e[a],t,r,n,Xe(o));return i}function p4(e,t,r,n,o){return l4(e.properties,t,r,n,o)}function j2(e,t,r,n,o){let i=p4(e,t,r,n,o);return Te(i)}function m4(e,t,r,n){let o=_i(e,t);return o===N.Union?Ce([r,n]):o===N.True?r:n}function bs(e,t,r,n,o){return Je(e)?j2(e,t,r,n,o):$r(e)?P(B2(e,t,r,n,o)):P(m4(e,t,r,n),o)}function d4(e,t,r,n,o){return{[e]:bs(_e(e),t,r,n,Xe(o))}}function h4(e,t,r,n,o){return e.reduce((i,a)=>({...i,...d4(a,t,r,n,o)}),{})}function y4(e,t,r,n,o){return h4(e.keys,t,r,n,o)}function B2(e,t,r,n,o){let i=y4(e,t,r,n,o);return Te(i)}function x4(e){return e.allOf.every(t=>ma(t))}function g4(e){return e.anyOf.some(t=>ma(t))}function b4(e){return!ma(e.not)}function ma(e){return e[k]==="Intersect"?x4(e):e[k]==="Union"?g4(e):e[k]==="Not"?b4(e):e[k]==="Undefined"}function G2(e,t){return ws(pa(e),t)}function w4(e,t){let r=e.filter(n=>_i(n,t)===N.False);return r.length===1?r[0]:Ce(r)}function ws(e,t,r={}){return Lr(e)?P(G2(e,t),r):Je(e)?P(z2(e,t),r):P(ve(e)?w4(e.anyOf,t):_i(e,t)!==N.False?ge():e,r)}function S4(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=ws(e[n],t);return r}function I4(e,t){return S4(e.properties,t)}function z2(e,t){let r=I4(e,t);return Te(r)}function K2(e,t){return Ss(pa(e),t)}function _4(e,t){let r=e.filter(n=>_i(n,t)!==N.False);return r.length===1?r[0]:Ce(r)}function Ss(e,t,r){return Lr(e)?P(K2(e,t),r):Je(e)?P(q2(e,t),r):P(ve(e)?_4(e.anyOf,t):_i(e,t)!==N.False?e:ge(),r)}function v4(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ss(e[n],t);return r}function T4(e,t){return v4(e.properties,t)}function q2(e,t){let r=T4(e,t);return Te(r)}function H2(e,t){return Sn(e)?P(e.returns,t):ge(t)}function bl(e){return Sr(rr(e))}function da(e,t,r){return P({[k]:"Record",type:"object",patternProperties:{[e]:t}},r)}function n0(e,t,r){let n={};for(let o of e)n[o]=t;return Ae(n,{...r,[Wr]:"Record"})}function M4(e,t,r){return il(e)?n0(wr(e),t,r):da(e.pattern,t,r)}function O4(e,t,r){return n0(wr(Ce(e)),t,r)}function R4(e,t,r){return n0([e.toString()],t,r)}function C4(e,t,r){return da(e.source,t,r)}function A4(e,t,r){let n=gt(e.pattern)?bi:e.pattern;return da(n,t,r)}function P4(e,t,r){return da(bi,t,r)}function k4(e,t,r){return da(r2,t,r)}function N4(e,t,r){return Ae({true:t,false:t},r)}function F4(e,t,r){return da(gi,t,r)}function E4(e,t,r){return da(gi,t,r)}function wl(e,t,r={}){return ve(e)?O4(e.anyOf,t,r):Lr(e)?M4(e,t,r):Er(e)?R4(e.const,t,r):Po(e)?N4(e,t,r):_n(e)?F4(e,t,r):vn(e)?E4(e,t,r):$h(e)?C4(e,t,r):ko(e)?A4(e,t,r):Fh(e)?P4(e,t,r):yi(e)?k4(e,t,r):ge(r)}function Sl(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function Y2(e){let t=Sl(e);return t===bi?lr():t===gi?Xr():lr({pattern:t})}function Il(e){return e.patternProperties[Sl(e)]}function $4(e,t){return t.parameters=tc(e,t.parameters),t.returns=On(e,t.returns),t}function L4(e,t){return t.parameters=tc(e,t.parameters),t.returns=On(e,t.returns),t}function D4(e,t){return t.allOf=tc(e,t.allOf),t}function V4(e,t){return t.anyOf=tc(e,t.anyOf),t}function U4(e,t){return gt(t.items)||(t.items=tc(e,t.items)),t}function j4(e,t){return t.items=On(e,t.items),t}function B4(e,t){return t.items=On(e,t.items),t}function G4(e,t){return t.items=On(e,t.items),t}function z4(e,t){return t.item=On(e,t.item),t}function K4(e,t){let r=W4(e,t.properties);return{...t,...Ae(r)}}function q4(e,t){let r=On(e,Y2(t)),n=On(e,Il(t)),o=wl(r,n);return{...t,...o}}function H4(e,t){return t.index in e?e[t.index]:Mn()}function Y4(e,t){let r=os(t),n=br(t),o=On(e,t);return r&&n?bl(o):r&&!n?Sr(o):!r&&n?rr(o):o}function W4(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:Y4(e,t[n])}),{})}function tc(e,t){return t.map(r=>On(e,r))}function On(e,t){return Sn(t)?$4(e,t):In(t)?L4(e,t):st(t)?D4(e,t):ve(t)?V4(e,t):Dr(t)?U4(e,t):bn(t)?j4(e,t):aa(t)?B4(e,t):fa(t)?G4(e,t):ca(t)?z4(e,t):bt(t)?K4(e,t):ua(t)?q4(e,t):Eh(t)?H4(e,t):t}function W2(e,t){return On(t,rs(e))}function X2(e){return P({[k]:"Integer",type:"integer"},e)}function X4(e,t,r){return{[e]:Rn(_e(e),t,Xe(r))}}function Z4(e,t,r){return e.reduce((o,i)=>({...o,...X4(i,t,r)}),{})}function Q4(e,t,r){return Z4(e.keys,t,r)}function Z2(e,t,r){let n=Q4(e,t,r);return Te(n)}function J4(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function eR(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function tR(e){return e.toUpperCase()}function rR(e){return e.toLowerCase()}function nR(e,t,r){let n=ls(e.pattern);if(!la(n))return{...e,pattern:Q2(e.pattern,t)};let a=[...Zf(n)].map(u=>_e(u)),s=J2(a,t),f=Ce(s);return sl([f],r)}function Q2(e,t){return typeof e=="string"?t==="Uncapitalize"?J4(e):t==="Capitalize"?eR(e):t==="Uppercase"?tR(e):t==="Lowercase"?rR(e):e:e.toString()}function J2(e,t){return e.map(r=>Rn(r,t))}function Rn(e,t,r={}){return $r(e)?Z2(e,t,r):Lr(e)?nR(e,t,r):ve(e)?Ce(J2(e.anyOf,t),r):Er(e)?_e(Q2(e.const,t),r):P(e,r)}function ew(e,t={}){return Rn(e,"Capitalize",t)}function tw(e,t={}){return Rn(e,"Lowercase",t)}function rw(e,t={}){return Rn(e,"Uncapitalize",t)}function nw(e,t={}){return Rn(e,"Uppercase",t)}function oR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=vi(e[o],t,Xe(r));return n}function iR(e,t,r){return oR(e.properties,t,r)}function ow(e,t,r){let n=iR(e,t,r);return Te(n)}function aR(e,t){return e.map(r=>o0(r,t))}function sR(e,t){return e.map(r=>o0(r,t))}function fR(e,t){let{[t]:r,...n}=e;return n}function cR(e,t){return t.reduce((r,n)=>fR(r,n),e)}function uR(e,t,r){let n=ft(e,[tt,"$id","required","properties"]),o=cR(r,t);return Ae(o,n)}function lR(e){let t=e.reduce((r,n)=>rl(n)?[...r,_e(n)]:r,[]);return Ce(t)}function o0(e,t){return st(e)?nr(aR(e.allOf,t)):ve(e)?Ce(sR(e.anyOf,t)):bt(e)?uR(e,t,e.properties):Ae({})}function vi(e,t,r){let n=xt(t)?lR(t):t,o=rt(t)?wr(t):t,i=lt(e),a=lt(t);return Je(e)?ow(e,o,r):$r(t)?iw(e,t,r):i&&a?He("Omit",[e,n],r):!i&&a?He("Omit",[e,n],r):i&&!a?He("Omit",[e,n],r):P({...o0(e,o),...r})}function pR(e,t,r){return{[t]:vi(e,[t],Xe(r))}}function mR(e,t,r){return t.reduce((n,o)=>({...n,...pR(e,o,r)}),{})}function dR(e,t,r){return mR(e,t.keys,r)}function iw(e,t,r){let n=dR(e,t,r);return Te(n)}function hR(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Ti(e[o],t,Xe(r));return n}function yR(e,t,r){return hR(e.properties,t,r)}function aw(e,t,r){let n=yR(e,t,r);return Te(n)}function xR(e,t){return e.map(r=>i0(r,t))}function gR(e,t){return e.map(r=>i0(r,t))}function bR(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function wR(e,t,r){let n=ft(e,[tt,"$id","required","properties"]),o=bR(r,t);return Ae(o,n)}function SR(e){let t=e.reduce((r,n)=>rl(n)?[...r,_e(n)]:r,[]);return Ce(t)}function i0(e,t){return st(e)?nr(xR(e.allOf,t)):ve(e)?Ce(gR(e.anyOf,t)):bt(e)?wR(e,t,e.properties):Ae({})}function Ti(e,t,r){let n=xt(t)?SR(t):t,o=rt(t)?wr(t):t,i=lt(e),a=lt(t);return Je(e)?aw(e,o,r):$r(t)?sw(e,t,r):i&&a?He("Pick",[e,n],r):!i&&a?He("Pick",[e,n],r):i&&!a?He("Pick",[e,n],r):P({...i0(e,o),...r})}function IR(e,t,r){return{[t]:Ti(e,[t],Xe(r))}}function _R(e,t,r){return t.reduce((n,o)=>({...n,...IR(e,o,r)}),{})}function vR(e,t,r){return _R(e,t.keys,r)}function sw(e,t,r){let n=vR(e,t,r);return Te(n)}function TR(e,t){return He("Partial",[He(e,t)])}function MR(e){return He("Partial",[Zn(e)])}function OR(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=rr(e[r]);return t}function RR(e,t){let r=ft(e,[tt,"$id","required","properties"]),n=OR(t);return Ae(n,r)}function fw(e){return e.map(t=>cw(t))}function cw(e){return wn(e)?TR(e.target,e.parameters):lt(e)?MR(e.$ref):st(e)?nr(fw(e.allOf)):ve(e)?Ce(fw(e.anyOf)):bt(e)?RR(e,e.properties):sa(e)||Po(e)||_n(e)||Er(e)||zf(e)||vn(e)||ko(e)||Kf(e)||No(e)?e:Ae({})}function Is(e,t){return Je(e)?uw(e,t):P({...cw(e),...t})}function CR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Is(e[n],Xe(t));return r}function AR(e,t){return CR(e.properties,t)}function uw(e,t){let r=AR(e,t);return Te(r)}function PR(e,t){return He("Required",[He(e,t)])}function kR(e){return He("Required",[Zn(e)])}function NR(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=ft(e[r],[Ht]);return t}function FR(e,t){let r=ft(e,[tt,"$id","required","properties"]),n=NR(t);return Ae(n,r)}function lw(e){return e.map(t=>pw(t))}function pw(e){return wn(e)?PR(e.target,e.parameters):lt(e)?kR(e.$ref):st(e)?nr(lw(e.allOf)):ve(e)?Ce(lw(e.anyOf)):bt(e)?FR(e,e.properties):sa(e)||Po(e)||_n(e)||Er(e)||zf(e)||vn(e)||ko(e)||Kf(e)||No(e)?e:Ae({})}function _s(e,t){return Je(e)?mw(e,t):P({...pw(e),...t})}function ER(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=_s(e[n],t);return r}function $R(e,t){return ER(e.properties,t)}function mw(e,t){let r=$R(e,t);return Te(r)}function LR(e,t){return t.map(r=>lt(r)?a0(e,r.$ref):Vr(e,r))}function a0(e,t){return t in e?lt(e[t])?a0(e,e[t].$ref):Vr(e,e[t]):ge()}function DR(e){return hs(e[0])}function VR(e){return Ii(e[0],e[1])}function UR(e){return xs(e[0])}function jR(e){return Is(e[0])}function BR(e){return vi(e[0],e[1])}function GR(e){return Ti(e[0],e[1])}function zR(e){return _s(e[0])}function KR(e,t,r){let n=LR(e,r);return t==="Awaited"?DR(n):t==="Index"?VR(n):t==="KeyOf"?UR(n):t==="Partial"?jR(n):t==="Omit"?BR(n):t==="Pick"?GR(n):t==="Required"?zR(n):ge()}function qR(e,t){return ss(Vr(e,t))}function HR(e,t){return fs(Vr(e,t))}function YR(e,t,r){return cs(rc(e,t),Vr(e,r))}function WR(e,t,r){return Wn(rc(e,t),Vr(e,r))}function XR(e,t){return nr(rc(e,t))}function ZR(e,t){return ds(Vr(e,t))}function QR(e,t){return Ae(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:Vr(e,t[n])}),{}))}function JR(e,t){let[r,n]=[Vr(e,Il(t)),Sl(t)],o=rs(t);return o.patternProperties[n]=r,o}function eC(e,t){return lt(t)?{...a0(e,t.$ref),[tt]:t[tt]}:t}function tC(e,t){return Zr(rc(e,t))}function rC(e,t){return Ce(rc(e,t))}function rc(e,t){return t.map(r=>Vr(e,r))}function Vr(e,t){return br(t)?P(Vr(e,ft(t,[Ht])),t):os(t)?P(Vr(e,ft(t,[gn])),t):Re(t)?P(eC(e,t),t):bn(t)?P(qR(e,t.items),t):aa(t)?P(HR(e,t.items),t):wn(t)?P(KR(e,t.target,t.parameters)):Sn(t)?P(YR(e,t.parameters,t.returns),t):In(t)?P(WR(e,t.parameters,t.returns),t):st(t)?P(XR(e,t.allOf),t):fa(t)?P(ZR(e,t.items),t):bt(t)?P(QR(e,t.properties),t):ua(t)?P(JR(e,t)):Dr(t)?P(tC(e,t.items||[]),t):ve(t)?P(rC(e,t.anyOf),t):t}function nC(e,t){return t in e?Vr(e,e[t]):ge()}function dw(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:nC(e,r)}),{})}var s0=class{constructor(t){let r=dw(t),n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){let n={...this.$defs,[t]:P(this.$defs[t],r)};return P({[k]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:{...t[n],$id:n}}),{})}};function hw(e){return new s0(e)}function yw(e,t){return P({[k]:"Not",not:e},t)}function xw(e,t){return In(e)?Zr(e.parameters,t):ge()}var oC=0;function gw(e,t={}){gt(t.$id)&&(t.$id=`T${oC++}`);let r=rs(e({[k]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,P({[Wr]:"Recursive",...r},t)}function bw(e,t){let r=ze(e)?new globalThis.RegExp(e):e;return P({[k]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function iC(e){return st(e)?e.allOf:ve(e)?e.anyOf:Dr(e)?e.items??[]:[]}function ww(e){return iC(e)}function Sw(e,t){return In(e)?P(e.returns,t):ge(t)}var f0=class{constructor(t){this.schema=t}Decode(t){return new c0(this.schema,t)}},c0=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[tt].Encode(t(a)),Decode:a=>this.decode(r[tt].Decode(a))};return{...r,[tt]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[tt]:n}}Encode(t){return Re(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function Iw(e){return new f0(e)}function _w(e={}){return P({[k]:e[k]??"Unsafe"},e)}function vw(e){return P({[k]:"Void",type:"void"},e)}var u0={};oa(u0,{Any:()=>Si,Argument:()=>s2,Array:()=>ss,AsyncIterator:()=>fs,Awaited:()=>hs,BigInt:()=>ms,Boolean:()=>al,Capitalize:()=>ew,Composite:()=>M2,Const:()=>O2,Constructor:()=>cs,ConstructorParameters:()=>R2,Date:()=>ll,Enum:()=>C2,Exclude:()=>ws,Extends:()=>bs,Extract:()=>Ss,Function:()=>Wn,Index:()=>Ii,InstanceType:()=>H2,Instantiate:()=>W2,Integer:()=>X2,Intersect:()=>nr,Iterator:()=>ds,KeyOf:()=>xs,Literal:()=>_e,Lowercase:()=>tw,Mapped:()=>w2,Module:()=>hw,Never:()=>ge,Not:()=>yw,Null:()=>pl,Number:()=>Xr,Object:()=>Ae,Omit:()=>vi,Optional:()=>rr,Parameters:()=>xw,Partial:()=>Is,Pick:()=>Ti,Promise:()=>cl,Readonly:()=>Sr,ReadonlyOptional:()=>bl,Record:()=>wl,Recursive:()=>gw,Ref:()=>Zn,RegExp:()=>bw,Required:()=>_s,Rest:()=>ww,ReturnType:()=>Sw,String:()=>lr,Symbol:()=>ml,TemplateLiteral:()=>sl,Transform:()=>Iw,Tuple:()=>Zr,Uint8Array:()=>hl,Uncapitalize:()=>rw,Undefined:()=>dl,Union:()=>Ce,Unknown:()=>Mn,Unsafe:()=>_w,Uppercase:()=>nw,Void:()=>vw});var h=u0;var Cn=h.Object({label:h.String(),domain:h.Optional(h.Tuple([h.Number(),h.Number()]))}),nc=h.Object({type:h.Union([h.Literal("identity"),h.Literal("horizontal"),h.Literal("vertical")]),value:h.Optional(h.Number())}),bZ=h.Object({schemaVersion:h.Literal("1.0"),title:h.Optional(h.String()),xAxis:Cn,yAxis:Cn,references:h.Optional(h.Array(nc))});var aC=h.Object({model:h.String(),population:h.Optional(h.String()),horizon:h.Optional(h.Number()),predicted:h.Number({minimum:0,maximum:1}),observed:h.Number({minimum:0,maximum:1}),method:h.Union([h.Literal("discrete"),h.Literal("smooth")]),events:h.Optional(h.Number({minimum:0})),total:h.Optional(h.Number({minimum:0}))}),sC=h.Object({model:h.String(),population:h.Optional(h.String()),horizon:h.Optional(h.Number()),midpoint:h.Number({minimum:0,maximum:1}),count:h.Number({minimum:0}),binWidth:h.Number({exclusiveMinimum:0,maximum:1})}),l0=h.Object({schemaVersion:h.Literal("1.0"),type:h.Literal("calibration"),data:h.Array(aC),distribution:h.Optional(h.Array(sC)),x:h.Literal("predicted"),y:h.Literal("observed"),xAxis:Cn,yAxis:Cn,references:h.Optional(h.Array(nc))});var fC=h.Object({model:h.String(),population:h.Optional(h.String()),horizon:h.Optional(h.Number()),cutoff:h.Number(),sensitivity:h.Number({minimum:0,maximum:1}),specificity:h.Number({minimum:0,maximum:1})}),p0=h.Object({schemaVersion:h.Literal("1.0"),type:h.Literal("roc"),data:h.Array(fC),x:h.Literal("false_positive_rate"),y:h.Literal("sensitivity"),xAxis:Cn,yAxis:Cn,references:h.Optional(h.Array(nc))});var cC=h.Union([p0,l0],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var An=h.Object({id:h.String(),model:h.Optional(h.String()),population:h.String(),label:h.Optional(h.String())}),Tw=h.Union([h.Literal("model"),h.Literal("population"),h.Literal("evaluation"),h.Literal("context")]),Mw=h.Object({label:h.String(),group:h.String(),role:Tw}),vs=h.Object({id:h.String(),evaluationId:h.String(),horizon:h.Optional(h.Number({minimum:0})),display:Mw}),uC=h.Object({x:h.Number(),y:h.Number()}),m0=h.Union([h.Object({type:h.Literal("identity"),label:h.Optional(h.String())}),h.Object({type:h.Literal("horizontal"),value:h.Number(),label:h.Optional(h.String())}),h.Object({type:h.Literal("vertical"),value:h.Number(),label:h.Optional(h.String())}),h.Object({type:h.Literal("path"),points:h.Array(uC,{minItems:2}),label:h.Optional(h.String())})]),lC=h.Intersect([m0,h.Object({scope:h.Literal("global")})]),pC=h.Intersect([m0,h.Object({scope:h.Literal("population"),population:h.String()})]),mC=h.Intersect([m0,h.Object({scope:h.Literal("population_horizon"),population:h.String(),horizon:h.Number({minimum:0})})]),Ow=h.Union([lC,pC,mC]),vr=h.Object({schemaVersion:h.Literal("2.0"),title:h.Optional(h.String()),evaluations:h.Array(An),series:h.Array(vs),xAxis:Cn,yAxis:Cn,references:h.Optional(h.Array(Ow))}),Rw=h.Union([h.Literal("probability_threshold"),h.Literal("ppcr")]),$o=h.Object({operatingPoint:h.Optional(h.Object({dimension:Rw}))}),_l=h.Object({operatingPoint:h.Optional(h.Object({dimension:h.Literal("probability_threshold")}))});var Cw=h.Object({seriesId:h.String(),predicted:h.Number({minimum:0,maximum:1}),observed:h.Number({minimum:0,maximum:1}),method:h.Literal("discrete"),events:h.Optional(h.Number({minimum:0})),total:h.Optional(h.Number({minimum:0}))}),Aw=h.Object({seriesId:h.String(),predicted:h.Number({minimum:0,maximum:1}),observed:h.Number(),method:h.Literal("smooth"),events:h.Optional(h.Number({minimum:0})),total:h.Optional(h.Number({minimum:0}))}),Pw=h.Union([Cw,Aw]),dC=h.Object({seriesId:h.String(),midpoint:h.Number({minimum:0,maximum:1}),count:h.Number({minimum:0}),binWidth:h.Number({exclusiveMinimum:0,maximum:1})}),d0=h.Intersect([vr,h.Object({type:h.Literal("calibration"),data:h.Array(Pw),distribution:h.Optional(h.Array(dC)),x:h.Literal("predicted"),y:h.Literal("observed")})]);var Nw=h.Object({seriesId:h.String(),threshold:h.Number({minimum:0,maximum:1}),netBenefit:h.Number()}),Fw=h.Intersect([An,h.Object({id:h.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Ew=h.Intersect([vs,h.Object({id:h.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:h.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),$w=h.Object({type:h.Literal("horizontal"),value:h.Literal(0),label:h.Optional(h.String()),scope:h.Literal("global"),benchmark:h.Literal("treat_none")}),kw={type:h.Literal("path"),points:h.Array(h.Object({x:h.Number(),y:h.Number()}),{minItems:2}),label:h.Optional(h.String()),benchmark:h.Literal("treat_all")},Lw=h.Union([h.Object({...kw,scope:h.Literal("population"),population:h.String()}),h.Object({...kw,scope:h.Literal("population_horizon"),population:h.String(),horizon:h.Number({minimum:0})})]),Dw=h.Union([$w,Lw]),h0=h.Intersect([vr,_l,h.Object({type:h.Literal("decision_curve"),evaluations:h.Array(Fw,{minItems:1}),series:h.Array(Ew,{minItems:1}),data:h.Array(Nw),x:h.Literal("threshold"),y:h.Literal("netBenefit"),references:h.Array(Dw,{minItems:2})})]);var hC=h.Object({seriesId:h.String(),cutoff:h.Number(),ppcr:h.Number({minimum:0,maximum:1}),sensitivity:h.Number({minimum:0,maximum:1})}),y0=h.Intersect([vr,$o,h.Object({type:h.Literal("gains"),data:h.Array(hC),x:h.Literal("ppcr"),y:h.Literal("sensitivity")})]);var Uw=h.Object({seriesId:h.String(),threshold:h.Number({minimum:0,maximum:1}),interventionsAvoided:h.Number()}),jw=h.Intersect([An,h.Object({id:h.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Bw=h.Intersect([vs,h.Object({id:h.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:h.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Gw=h.Object({type:h.Literal("horizontal"),value:h.Literal(0),label:h.Optional(h.String()),scope:h.Literal("global"),benchmark:h.Literal("treat_all")}),Vw={type:h.Literal("path"),points:h.Array(h.Object({x:h.Number(),y:h.Number()}),{minItems:2}),label:h.Optional(h.String()),benchmark:h.Literal("treat_none")},zw=h.Union([h.Object({...Vw,scope:h.Literal("population"),population:h.String()}),h.Object({...Vw,scope:h.Literal("population_horizon"),population:h.String(),horizon:h.Number({minimum:0})})]),Kw=h.Union([Gw,zw]),x0=h.Intersect([vr,_l,h.Object({type:h.Literal("interventions_avoided"),evaluations:h.Array(jw,{minItems:1}),series:h.Array(Bw,{minItems:1}),data:h.Array(Uw),x:h.Literal("threshold"),y:h.Literal("interventionsAvoided"),references:h.Array(Kw,{minItems:2})})]);var yC=h.Object({seriesId:h.String(),cutoff:h.Number(),ppcr:h.Number({minimum:0,maximum:1}),lift:h.Number()}),g0=h.Intersect([vr,$o,h.Object({type:h.Literal("lift"),data:h.Array(yC),x:h.Literal("ppcr"),y:h.Literal("lift")})]);var xC=h.Object({seriesId:h.String(),cutoff:h.Number(),ppcr:h.Optional(h.Number({minimum:0,maximum:1})),sensitivity:h.Number({minimum:0,maximum:1}),ppv:h.Number({minimum:0,maximum:1})}),b0=h.Intersect([vr,$o,h.Object({type:h.Literal("precision_recall"),data:h.Array(xC),x:h.Literal("sensitivity"),y:h.Literal("ppv")})]);var gC=h.Object({seriesId:h.String(),cutoff:h.Number(),ppcr:h.Optional(h.Number({minimum:0,maximum:1})),sensitivity:h.Number({minimum:0,maximum:1}),specificity:h.Number({minimum:0,maximum:1})}),w0=h.Intersect([vr,$o,h.Object({type:h.Literal("roc"),data:h.Array(gC),x:h.Literal("false_positive_rate"),y:h.Literal("sensitivity")})]);var S0=h.Union([w0,d0,b0,y0,g0,h0,x0],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var I0=h.Union([h.Literal("true_positives"),h.Literal("true_negatives"),h.Literal("false_positives"),h.Literal("false_negatives"),h.Literal("sensitivity"),h.Literal("specificity"),h.Literal("false_positive_rate"),h.Literal("ppv"),h.Literal("npv"),h.Literal("lift"),h.Literal("predicted_positives"),h.Literal("ppcr"),h.Literal("net_benefit"),h.Literal("net_benefit_interventions_avoided")]),qw=h.Object({id:I0,label:h.String()}),Hw=h.Object({metricId:I0,estimate:h.Union([h.Number(),h.Null()]),lower:h.Optional(h.Union([h.Number(),h.Null()])),upper:h.Optional(h.Union([h.Number(),h.Null()]))}),Yw=h.Union([h.Object({type:h.Literal("probability_threshold"),value:h.Number()}),h.Object({type:h.Literal("ppcr"),value:h.Number({minimum:0,maximum:1})})]),Ww=h.Object({censoringHeuristic:h.Optional(h.String()),competingEventHeuristic:h.Optional(h.String())}),Xw=h.Object({evaluationId:h.String(),horizon:h.Optional(h.Number({minimum:0})),operatingPoint:Yw,context:h.Optional(Ww),values:h.Array(Hw)}),_0=h.Object({schemaVersion:h.Literal("2.0"),type:h.Literal("performance_table"),title:h.Optional(h.String()),evaluations:h.Array(An),metrics:h.Array(qw),rows:h.Array(Xw)});var v0=h.Object({id:h.String(),label:h.String()}),T0=h.Object({metric:h.Literal("auroc"),owner:h.Object({type:h.Literal("evaluation"),evaluationId:h.String()}),estimate:h.Union([h.Number(),h.Null()])}),M0=h.Object({metric:h.Literal("prevalence"),owner:h.Object({type:h.Literal("population"),populationId:h.String()}),estimate:h.Union([h.Number(),h.Null()])}),bC=h.Object({metric:h.Literal("event_risk"),owner:h.Object({type:h.Literal("population"),populationId:h.String()}),horizon:h.Number({minimum:0}),estimate:h.Union([h.Number(),h.Null()])}),wC=h.Union([T0,M0]),Zw=h.Union([T0,M0,bC]),SC=Zw,IC=h.Object({schemaVersion:h.Literal("1.0"),type:h.Literal("summary_metrics"),title:h.Optional(h.String()),evaluations:h.Array(An),populations:h.Array(v0),metrics:h.Array(wC)}),_C=h.Object({schemaVersion:h.Literal("1.1"),type:h.Literal("summary_metrics"),title:h.Optional(h.String()),evaluations:h.Array(An),populations:h.Array(v0),metrics:h.Array(Zw)}),O0=h.Union([IC,_C],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var R0=h.Union([S0,_0,O0]),Qw=h.Object({id:h.String(),title:h.Optional(h.String()),spec:R0}),vl=h.Object({schemaVersion:h.Literal("1.0"),type:h.Literal("report"),title:h.Optional(h.String()),components:h.Array(Qw,{minItems:1})}),C0=h.Object({type:h.Literal("component"),id:h.String(),title:h.Optional(h.String()),spec:R0}),Jw=h.Object({type:h.Literal("group"),id:h.String(),title:h.String(),components:h.Array(C0,{minItems:1})}),eS=h.Object({id:h.String(),title:h.String(),items:h.Array(h.Union([C0,Jw]),{minItems:1})}),Tl=h.Object({schemaVersion:h.Literal("1.1"),type:h.Literal("report"),title:h.Optional(h.String()),sections:h.Array(eS,{minItems:1})}),vC=h.Union([vl,Tl],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function Ml(e){let t=new Set,r=i=>{if(t.has(i.id))throw new Error(`duplicate component id: ${i.id}`);t.add(i.id)};if(e.schemaVersion==="1.0"){for(let i of e.components)r(i);return}let n=new Set,o=new Set;for(let i of e.sections){if(n.has(i.id))throw new Error(`duplicate section id: ${i.id}`);n.add(i.id);for(let a of i.items){if(a.type==="component"){r(a);continue}if(o.has(a.id))throw new Error(`duplicate group id: ${a.id}`);o.add(a.id);for(let s of a.components)r(s)}}}function A0(e){let t=new Set;for(let n of e.evaluations){if(t.has(n.id))throw new Error(`duplicate evaluation id: ${n.id}`);t.add(n.id)}let r=new Set;for(let n of e.metrics){if(r.has(n.id))throw new Error(`duplicate metric id: ${n.id}`);r.add(n.id)}for(let n of e.rows){if(!t.has(n.evaluationId))throw new Error(`unknown evaluation id: ${n.evaluationId}`);for(let o of n.values)if(!r.has(o.metricId))throw new Error(`unknown metric id: ${o.metricId}`)}}function P0(e){let t=new Set;for(let o of e.evaluations){if(t.has(o.id))throw new Error(`duplicate evaluation id: ${o.id}`);t.add(o.id)}let r=new Set;for(let o of e.populations){if(r.has(o.id))throw new Error(`duplicate population id: ${o.id}`);r.add(o.id)}let n=new Set;for(let o of e.metrics){if(o.estimate!==null&&!Number.isFinite(o.estimate))throw new Error(`non-finite metric estimate: ${o.estimate}`);if("horizon"in o&&o.horizon!==void 0&&(!Number.isFinite(o.horizon)||o.horizon<0))throw new Error(`invalid horizon: ${o.horizon}`);if(o.metric==="auroc"){if("horizon"in o&&o.horizon!==void 0)throw new Error("auroc metric cannot specify horizon");if(!t.has(o.owner.evaluationId))throw new Error(`unknown evaluation id: ${o.owner.evaluationId}`);let i=`auroc:${o.owner.evaluationId}`;if(n.has(i))throw new Error(`duplicate metric ownership: auroc for evaluation ${o.owner.evaluationId}`);n.add(i)}else if(o.metric==="prevalence"){if("horizon"in o&&o.horizon!==void 0)throw new Error("prevalence metric cannot specify horizon");if(!r.has(o.owner.populationId))throw new Error(`unknown population id: ${o.owner.populationId}`);let i=`prevalence:${o.owner.populationId}`;if(n.has(i))throw new Error(`duplicate metric ownership: prevalence for population ${o.owner.populationId}`);n.add(i)}else if(o.metric==="event_risk"){if(e.schemaVersion!=="1.1")throw new Error(`event_risk metric requires schemaVersion 1.1, got ${e.schemaVersion}`);if(!("horizon"in o)||o.horizon===void 0)throw new Error("event_risk metric requires horizon");if(!r.has(o.owner.populationId))throw new Error(`unknown population id: ${o.owner.populationId}`);let i=`event_risk:${o.owner.populationId}:${o.horizon}`;if(n.has(i))throw new Error(`duplicate metric ownership: event_risk for population ${o.owner.populationId} at horizon ${o.horizon}`);n.add(i)}}}function Lo(e){let t=new Set(e.evaluations.map(o=>o.id)),r=new Set;if(t.size!==e.evaluations.length)throw new Error("duplicate evaluation id");for(let o of e.series){if(r.has(o.id))throw new Error(`duplicate series id: ${o.id}`);if(r.add(o.id),!t.has(o.evaluationId))throw new Error(`unknown evaluation id: ${o.evaluationId}`)}for(let o of e.data)if(!r.has(o.seriesId))throw new Error(`unknown series id: ${o.seriesId}`);if(e.type==="calibration"){for(let o of e.distribution??[])if(!r.has(o.seriesId))throw new Error(`unknown distribution series id: ${o.seriesId}`)}let n=new Set(e.evaluations.map(o=>o.population));for(let o of e.references??[])if((o.scope==="population"||o.scope==="population_horizon")&&!n.has(o.population))throw new Error(`unknown reference population: ${o.population}`);if(e.type==="decision_curve"){let o=e,i=o.references;o.evaluations.forEach((d,y)=>{let x=`evaluation-${y+1}`;if(d.id!==x)throw new Error(`decision curve evaluation ids must be ordinal: expected ${x}`)});let a=o.series.filter(d=>d.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("decision curve cannot mix static and horizon-qualified series");let s=a>0,f=[...new Set(o.series.map(d=>d.horizon).filter(d=>d!==void 0))],u=new Set;if(o.series.forEach((d,y)=>{if(d.id!==`series-${y+1}`)throw new Error(`decision curve series ids must be ordinal: expected series-${y+1}`);let x=o.evaluations.find(b=>b.id===d.evaluationId),w=x.model??x.population,g=x.model===void 0?"population":"model";if(d.display.label!==w||d.display.group!==w||d.display.role!==g)throw new Error("decision curve display must follow evaluation semantics");let S=`${d.evaluationId}\0${d.horizon??"static"}`;if(u.has(S))throw new Error(`duplicate decision curve evaluation-horizon series: ${d.evaluationId}`);u.add(S)}),s){if(!o.evaluations.every(y=>f.every(x=>u.has(`${y.id}\0${x}`)))||o.series.length!==o.evaluations.length*f.length)throw new Error("decision curve requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(d=>!u.has(`${d.id}\0static`)))throw new Error("decision curve requires exactly one series per evaluation");if(i.filter(d=>"benchmark"in d&&d.benchmark==="treat_none").length!==1)throw new Error("decision curve requires exactly one Treat None reference");let m=i.filter(d=>"benchmark"in d&&d.benchmark==="treat_all"),l=new Set;for(let d of m){if(s&&d.scope!=="population_horizon")throw new Error("time-dependent decision curve Treat All must use population_horizon scope");if(!s&&d.scope!=="population")throw new Error("static decision curve Treat All must use population scope");let y=d.scope==="population_horizon"?`${d.population}\0${d.horizon}`:d.population;if(l.has(y))throw new Error(`duplicate Treat All owner: ${d.population}`);l.add(y)}let p=s?[...n].flatMap(d=>f.map(y=>`${d}\0${y}`)):[...n];if(l.size!==p.length||p.some(d=>!l.has(d)))throw new Error(s?"decision curve requires exactly one Treat All reference per population and horizon":"decision curve requires exactly one Treat All reference per population")}if(e.type==="interventions_avoided"){let o=e,i=o.references;o.evaluations.forEach((d,y)=>{let x=`evaluation-${y+1}`;if(d.id!==x)throw new Error(`interventions avoided evaluation ids must be ordinal: expected ${x}`)});let a=o.series.filter(d=>d.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("interventions avoided cannot mix static and horizon-qualified series");let s=a>0,f=[...new Set(o.series.map(d=>d.horizon).filter(d=>d!==void 0))],u=new Set;if(o.series.forEach((d,y)=>{if(d.id!==`series-${y+1}`)throw new Error(`interventions avoided series ids must be ordinal: expected series-${y+1}`);let x=o.evaluations.find(b=>b.id===d.evaluationId);if(!x)throw new Error(`unknown evaluation id: ${d.evaluationId}`);let w=x.model??x.population,g=x.model===void 0?"population":"model";if(d.display.label!==w||d.display.group!==w||d.display.role!==g)throw new Error("interventions avoided display must follow evaluation semantics");let S=`${d.evaluationId}\0${d.horizon??"static"}`;if(u.has(S))throw new Error(`duplicate interventions avoided evaluation-horizon series: ${d.evaluationId}`);u.add(S)}),s){if(!o.evaluations.every(y=>f.every(x=>u.has(`${y.id}\0${x}`)))||o.series.length!==o.evaluations.length*f.length)throw new Error("interventions avoided requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(d=>!u.has(`${d.id}\0static`)))throw new Error("interventions avoided requires exactly one series per evaluation");let c=i.filter(d=>"benchmark"in d&&d.benchmark==="treat_all");if(c.length!==1)throw new Error("interventions avoided requires exactly one Treat All reference");if(c[0].scope!=="global"||c[0].type!=="horizontal"||c[0].value!==0)throw new Error("interventions avoided Treat All must be the global zero reference");let m=i.filter(d=>"benchmark"in d&&d.benchmark==="treat_none"),l=new Set;for(let d of m){if(s&&d.scope!=="population_horizon")throw new Error("time-dependent interventions avoided Treat None must use population_horizon scope");if(!s&&d.scope!=="population")throw new Error("static interventions avoided Treat None must use population scope");let y=d.scope==="population_horizon"?`${d.population}\0${d.horizon}`:d.population;if(l.has(y))throw new Error(`duplicate Treat None owner: ${d.population}`);l.add(y)}let p=s?[...n].flatMap(d=>f.map(y=>`${d}\0${y}`)):[...n];if(l.size!==p.length||p.some(d=>!l.has(d)))throw new Error(s?"interventions avoided requires exactly one Treat None reference per population and horizon":"interventions avoided requires exactly one Treat None reference per population")}}function tS(e){return{schemaVersion:"1.0",type:"roc",data:e,x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity"}]}}function TC(e){return tS(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function MC(e){return tS(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function OC(e,t,r){let n=e.map(i=>{let a=i.sum_reals??i.n_reals,s=i.total_obs??i.n;return{model:i.reference_group,predicted:i.x,observed:i.y,method:t,...t==="discrete"&&a!==void 0?{events:a}:{},...t==="discrete"&&s!==void 0?{total:s}:{}}}),o=r?.map(i=>({model:i.reference_group,midpoint:i.mids,count:i.counts,binWidth:.01}));return{schemaVersion:"1.0",type:"calibration",data:n,...o?{distribution:o}:{},x:"predicted",y:"observed",xAxis:{label:"Predicted probability",domain:[0,1]},yAxis:{label:"Observed probability",domain:[0,1]},references:[{type:"identity"}]}}function RC(e,t){let r=t.role==="model"?t.population??"population":e,n=`evaluation:${e}`;return{evaluation:{id:n,...t.role==="model"?{model:e}:{},population:r,label:e},series:{id:`series:${e}`,evaluationId:n,display:{label:e,group:e,role:t.role}}}}function k0(e,t){return[...new Set(e)].map(n=>RC(n,t))}function CC(e,t="population"){let r=k0(e.map(n=>n.model),{role:"model",population:t});return{schemaVersion:"2.0",type:"roc",evaluations:r.map(n=>n.evaluation),series:r.map(n=>n.series),data:e.map(n=>({seriesId:`series:${n.model}`,cutoff:n.probability_threshold,sensitivity:n.sensitivity,specificity:n.specificity})),x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity",scope:"global",label:"Random Guess"}]}}function AC(e,t){let r=k0(e.map(n=>n.reference_group),t);return{schemaVersion:"2.0",type:"roc",evaluations:r.map(n=>n.evaluation),series:r.map(n=>n.series),data:e.map(n=>({seriesId:`series:${n.reference_group}`,cutoff:n.chosen_cutoff,sensitivity:n.sensitivity,specificity:n.specificity})),x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity",scope:"global",label:"Random Guess"}]}}function PC(e,t,r,n){let o=k0(e.map(f=>f.reference_group),r),i=e.map(f=>f.y).filter(Number.isFinite),a=Math.min(0,...i),s=Math.max(1,...i);return{schemaVersion:"2.0",type:"calibration",evaluations:o.map(f=>f.evaluation),series:o.map(f=>f.series),data:e.map(f=>{let u=f.sum_reals??f.n_reals,c=f.total_obs??f.n;return{seriesId:`series:${f.reference_group}`,predicted:f.x,observed:f.y,method:t,...t==="discrete"&&u!==void 0?{events:u}:{},...t==="discrete"&&c!==void 0?{total:c}:{}}}),...n?{distribution:n.map(f=>({seriesId:`series:${f.reference_group}`,midpoint:f.mids,count:f.counts,binWidth:.01}))}:{},x:"predicted",y:"observed",xAxis:{label:"Predicted probability",domain:[0,1]},yAxis:{label:"Observed probability",domain:[a,s]},references:[{type:"identity",scope:"global",label:"Perfectly Calibrated"}]}}function ct(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function tn(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Do(e){let t,r,n;e.length!==2?(t=ct,r=(s,f)=>ct(e(s),f),n=(s,f)=>e(s)-f):(t=e===ct||e===tn?e:kC,r=e,n=e);function o(s,f,u=0,c=s.length){if(u>>1;r(s[m],f)<0?u=m+1:c=m}while(u>>1;r(s[m],f)<=0?u=m+1:c=m}while(uu&&n(s[m-1],f)>-n(s[m],f)?m-1:m}return{left:o,center:a,right:i}}function kC(){return 0}function oc(e){return e===null?NaN:+e}function*rS(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var nS=Do(ct),oS=nS.right,NC=nS.left,FC=Do(oc).center,ha=oS;function EC(e){return e.length|0}function $C(e){return!(e>0)}function LC(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function DC(e){return t=>e(...t)}function Ol(...e){let t=typeof e[e.length-1]=="function"&&DC(e.pop());e=e.map(LC);let r=e.map(EC),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some($C))return i;for(;;){i.push(o.map((s,f)=>e[f][s]));let a=n;for(;++o[a]===r[a];){if(a===0)return t?i.map(t):i;o[a--]=0}}}function Rl(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?o=>r+=+o||0:o=>r+=+t(o,n++,e)||0)}function Ts(e,t){let r=0,n,o=0,i=0;if(t===void 0)for(let a of e)a!=null&&(a=+a)>=a&&(n=a-o,o+=n/++r,i+=n*(a-o));else{let a=-1;for(let s of e)(s=t(s,++a,e))!=null&&(s=+s)>=s&&(n=s-o,o+=n/++r,i+=n*(s-o))}if(r>1)return i/(r-1)}function Cl(e,t){let r=Ts(e,t);return r&&Math.sqrt(r)}function Tr(e,t){let r,n;if(t===void 0)for(let o of e)o!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n=i&&(r=n=i):(r>i&&(r=i),n0){for(a=t[--r];r>0&&(n=a,o=t[--r],a=n+o,i=o-(a-n),!i););r>0&&(i<0&&t[r-1]<0||i>0&&t[r-1]>0)&&(o=i*2,n=a+o,o==n-a&&(a=n))}return a}};var pr=class extends Map{constructor(t,r=sS){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,o]of t)this.set(n,o)}get(t){return super.get(N0(this,t))}has(t){return super.has(N0(this,t))}set(t,r){return super.set(iS(this,t),r)}delete(t){return super.delete(aS(this,t))}},Pn=class extends Set{constructor(t,r=sS){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(N0(this,t))}add(t){return super.add(iS(this,t))}delete(t){return super.delete(aS(this,t))}};function N0({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function iS({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function aS({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function sS(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ic(e){return e}function Vo(e,...t){return E0(e,ic,ic,t)}function Qn(e,t,...r){return E0(e,ic,t,r)}function F0(e,t,...r){return E0(e,Array.from,t,r)}function E0(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new pr,f=n[a++],u=-1;for(let c of i){let m=f(c,++u,i),l=s.get(m);l?l.push(c):s.set(m,[c])}for(let[c,m]of s)s.set(c,o(m,a));return t(s)})(e,0)}function $0(e,t){return Array.from(t,r=>e[r])}function Mi(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(o,i)=>i);return t.length>1?(t=t.map(o=>e.map(o)),n.sort((o,i)=>{for(let a of t){let s=ac(a[o],a[i]);if(s)return s}})):(r=e.map(r),n.sort((o,i)=>ac(r[o],r[i]))),$0(e,n)}return e.sort(L0(r))}function L0(e=ct){if(e===ct)return ac;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function ac(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function Ms(e,t,r){return(t.length!==2?Mi(Qn(e,t,r),(([n,o],[i,a])=>ct(o,a)||ct(n,i))):Mi(Vo(e,r),(([n,o],[i,a])=>t(o,a)||ct(n,i)))).map(([n])=>n)}var VC=Math.sqrt(50),UC=Math.sqrt(10),jC=Math.sqrt(2);function Al(e,t,r){let n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=VC?10:i>=UC?5:i>=jC?2:1,s,f,u;return o<0?(u=Math.pow(10,-o)/a,s=Math.round(e*u),f=Math.round(t*u),s/ut&&--f,u=-u):(u=Math.pow(10,o)*a,s=Math.round(e/u),f=Math.round(t/u),s*ut&&--f),f0))return[];if(e===t)return[e];let n=t=o))return[];let s=i-o+1,f=new Array(s);if(n)if(a<0)for(let u=0;u=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r=o)&&(r=o)}return r}function Pl(e,t){let r,n=-1,o=-1;if(t===void 0)for(let i of e)++o,i!=null&&(r=i)&&(r=i,n=o);else for(let i of e)(i=t(i,++o,e))!=null&&(r=i)&&(r=i,n=o);return n}function mr(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}function kl(e,t){let r,n=-1,o=-1;if(t===void 0)for(let i of e)++o,i!=null&&(r>i||r===void 0&&i>=i)&&(r=i,n=o);else for(let i of e)(i=t(i,++o,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i,n=o);return n}function Nl(e,t,r=0,n=1/0,o){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(o=o===void 0?ac:L0(o);n>r;){if(n-r>600){let f=n-r+1,u=t-r+1,c=Math.log(f),m=.5*Math.exp(2*c/3),l=.5*Math.sqrt(c*m*(f-m)/f)*(u-f/2<0?-1:1),p=Math.max(r,Math.floor(t-u*m/f+l)),d=Math.min(n,Math.floor(t+(f-u)*m/f+l));Nl(e,t,p,d,o)}let i=e[t],a=r,s=n;for(fc(e,r,t),o(e[n],i)>0&&fc(e,r,n);a0;)--s}o(e[r],i)===0?fc(e,r,s):(++s,fc(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function fc(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function cc(e,t=ct){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?ct(a,o)>0:ct(a,a)===0)&&(r=i,o=a,n=!0)}}else for(let o of e)(n?t(o,r)>0:t(o,o)===0)&&(r=o,n=!0);return r}function jo(e,t,r){if(e=Float64Array.from(rS(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return mr(e);if(t>=1)return Nt(e);var n,o=(n-1)*t,i=Math.floor(o),a=Nt(Nl(e,i).subarray(0,i+1)),s=mr(e.subarray(i+1));return a+(s-a)*(o-i)}}function D0(e,t,r=oc){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,o=(n-1)*t,i=Math.floor(o),a=+r(e[i],i,e),s=+r(e[i+1],i+1,e);return a+(s-a)*(o-i)}}function Fl(e,t){let r=0,n=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(++r,n+=o);else{let o=-1;for(let i of e)(i=t(i,++o,e))!=null&&(i=+i)>=i&&(++r,n+=i)}if(r)return n/r}function ya(e,t){return jo(e,.5,t)}function*GC(e){for(let t of e)yield*t}function Rs(e){return Array.from(GC(e))}function El(e,t){let r=new pr;if(t===void 0)for(let i of e)i!=null&&i>=i&&r.set(i,(r.get(i)||0)+1);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&a>=a&&r.set(a,(r.get(a)||0)+1)}let n,o=0;for(let[i,a]of r)a>o&&(o=a,n=i);return n}function $l(e,t=zC){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function zC(e,t){return[e,t]}function xa(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(o);++n+e(t)}function YC(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function WC(){return!this.__axis}function XC(e,t){var r=[],n=null,o=null,i=6,a=6,s=3,f=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=e===V0||e===Ll?-1:1,c=e===Ll||e===U0?"x":"y",m=e===V0||e===j0?KC:qC;function l(p){var d=n??(t.ticks?t.ticks.apply(t,r):t.domain()),y=o??(t.tickFormat?t.tickFormat.apply(t,r):fS),x=Math.max(i,0)+s,w=t.range(),g=+w[0]+f,S=+w[w.length-1]+f,b=(t.bandwidth?YC:HC)(t.copy(),f),T=p.selection?p.selection():p,I=T.selectAll(".domain").data([null]),v=T.selectAll(".tick").data(d,t).order(),O=v.exit(),C=v.enter().append("g").attr("class","tick"),E=v.select("line"),A=v.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(C),E=E.merge(C.append("line").attr("stroke","currentColor").attr(c+"2",u*i)),A=A.merge(C.append("text").attr("fill","currentColor").attr(c,u*x).attr("dy",e===V0?"0em":e===j0?"0.71em":"0.32em")),p!==T&&(I=I.transition(p),v=v.transition(p),E=E.transition(p),A=A.transition(p),O=O.transition(p).attr("opacity",cS).attr("transform",function(F){return isFinite(F=b(F))?m(F+f):this.getAttribute("transform")}),C.attr("opacity",cS).attr("transform",function(F){var H=this.parentNode.__axis;return m((H&&isFinite(H=H(F))?H:b(F))+f)})),O.remove(),I.attr("d",e===Ll||e===U0?a?"M"+u*a+","+g+"H"+f+"V"+S+"H"+u*a:"M"+f+","+g+"V"+S:a?"M"+g+","+u*a+"V"+f+"H"+S+"V"+u*a:"M"+g+","+f+"H"+S),v.attr("opacity",1).attr("transform",function(F){return m(b(F)+f)}),E.attr(c+"2",u*i),A.attr(c,u*x).text(y),T.filter(WC).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===U0?"start":e===Ll?"end":"middle"),T.each(function(){this.__axis=b})}return l.scale=function(p){return arguments.length?(t=p,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),l):r.slice()},l.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),l):n&&n.slice()},l.tickFormat=function(p){return arguments.length?(o=p,l):o},l.tickSize=function(p){return arguments.length?(i=a=+p,l):i},l.tickSizeInner=function(p){return arguments.length?(i=+p,l):i},l.tickSizeOuter=function(p){return arguments.length?(a=+p,l):a},l.tickPadding=function(p){return arguments.length?(s=+p,l):s},l.offset=function(p){return arguments.length?(f=+p,l):f},l}function B0(e){return XC(j0,e)}var ZC={value:()=>{}};function lS(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}Dl.prototype=lS.prototype={constructor:Dl,on:function(e,t){var r=this._,n=QC(e+"",r),o,i=-1,a=n.length;if(arguments.length<2){for(;++i0)for(var r=new Array(o),n=0,o,i;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Jn.hasOwnProperty(t)?{space:Jn[t],local:e}:e}function eA(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Vl&&t.documentElement.namespaceURI===Vl?t.createElement(e):t.createElementNS(r,e)}}function tA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Go(e){var t=Bo(e);return(t.local?tA:eA)(t)}function rA(){}function ga(e){return e==null?rA:function(){return this.querySelector(e)}}function pS(e){typeof e!="function"&&(e=ga(e));for(var t=this._groups,r=t.length,n=new Array(r),o=0;o=S&&(S=g+1);!(T=x[S])&&++S=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function vS(e){e||(e=hA);function t(m,l){return m&&l?e(m.__data__,l.__data__):!m-!l}for(var r=this._groups,n=r.length,o=new Array(n),i=0;it?1:e>=t?0:NaN}function TS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MS(){return Array.from(this)}function OS(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?IA:typeof t=="function"?vA:_A)(e,t,r??"")):Ri(this.node(),e)}function Ri(e,t){return e.style.getPropertyValue(t)||Bl(e).getComputedStyle(e,null).getPropertyValue(t)}function TA(e){return function(){delete this[e]}}function MA(e,t){return function(){this[e]=t}}function OA(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function NS(e,t){return arguments.length>1?this.each((t==null?TA:typeof t=="function"?OA:MA)(e,t)):this.node()[e]}function FS(e){return e.trim().split(/^|\s+/)}function K0(e){return e.classList||new ES(e)}function ES(e){this._node=e,this._names=FS(e.getAttribute("class")||"")}ES.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function $S(e,t){for(var r=K0(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function KA(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,o=t.length,i;r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Gl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Gl(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=ZA.exec(e))?new Tt(t[1],t[2],t[3],1):(t=QA.exec(e))?new Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=JA.exec(e))?Gl(t[1],t[2],t[3],t[4]):(t=e7.exec(e))?Gl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=t7.exec(e))?aI(t[1],t[2]/100,t[3]/100,1):(t=r7.exec(e))?aI(t[1],t[2]/100,t[3]/100,t[4]):eI.hasOwnProperty(e)?nI(eI[e]):e==="transparent"?new Tt(NaN,NaN,NaN,0):null}function nI(e){return new Tt(e>>16&255,e>>8&255,e&255,1)}function Gl(e,t,r,n){return n<=0&&(e=t=r=NaN),new Tt(e,t,r,n)}function dc(e){return e instanceof to||(e=Nn(e)),e?(e=e.rgb(),new Tt(e.r,e.g,e.b,e.opacity)):new Tt}function on(e,t,r,n){return arguments.length===1?dc(e):new Tt(e,t,r,n??1)}function Tt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ko(Tt,on,Ci(to,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ai:Math.pow(Ai,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tt(wa(this.r),wa(this.g),wa(this.b),Kl(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:oI,formatHex:oI,formatHex8:i7,formatRgb:iI,toString:iI}));function oI(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}`}function i7(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}${ba((isNaN(this.opacity)?1:this.opacity)*255)}`}function iI(){let e=Kl(this.opacity);return`${e===1?"rgb(":"rgba("}${wa(this.r)}, ${wa(this.g)}, ${wa(this.b)}${e===1?")":`, ${e})`}`}function Kl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ba(e){return e=wa(e),(e<16?"0":"")+e.toString(16)}function aI(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new kn(e,t,r,n)}function fI(e){if(e instanceof kn)return new kn(e.h,e.s,e.l,e.opacity);if(e instanceof to||(e=Nn(e)),!e)return new kn;if(e instanceof kn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,s=i-o,f=(i+o)/2;return s?(t===i?a=(r-n)/s+(r0&&f<1?0:a,new kn(a,s,f,e.opacity)}function hc(e,t,r,n){return arguments.length===1?fI(e):new kn(e,t,r,n??1)}function kn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ko(kn,hc,Ci(to,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new kn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ai:Math.pow(Ai,e),new kn(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,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new Tt(Y0(e>=240?e-240:e+120,o,n),Y0(e,o,n),Y0(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new kn(sI(this.h),zl(this.s),zl(this.l),Kl(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=Kl(this.opacity);return`${e===1?"hsl(":"hsla("}${sI(this.h)}, ${zl(this.s)*100}%, ${zl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function sI(e){return e=(e||0)%360,e<0?e+360:e}function zl(e){return Math.max(0,Math.min(1,e||0))}function Y0(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var ql=Math.PI/180,Hl=180/Math.PI;var Yl=18,cI=.96422,uI=1,lI=.82521,pI=4/29,As=6/29,mI=3*As*As,a7=As*As*As;function dI(e){if(e instanceof ro)return new ro(e.l,e.a,e.b,e.opacity);if(e instanceof qo)return hI(e);e instanceof Tt||(e=dc(e));var t=Q0(e.r),r=Q0(e.g),n=Q0(e.b),o=W0((.2225045*t+.7168786*r+.0606169*n)/uI),i,a;return t===r&&r===n?i=a=o:(i=W0((.4360747*t+.3850649*r+.1430804*n)/cI),a=W0((.0139322*t+.0971045*r+.7141733*n)/lI)),new ro(116*o-16,500*(i-o),200*(o-a),e.opacity)}function Ps(e,t,r,n){return arguments.length===1?dI(e):new ro(e,t,r,n??1)}function ro(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ko(ro,Ps,Ci(to,{brighter(e){return new ro(this.l+Yl*(e??1),this.a,this.b,this.opacity)},darker(e){return new ro(this.l-Yl*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=cI*X0(t),e=uI*X0(e),r=lI*X0(r),new Tt(Z0(3.1338561*t-1.6168667*e-.4906146*r),Z0(-.9787684*t+1.9161415*e+.033454*r),Z0(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function W0(e){return e>a7?Math.pow(e,1/3):e/mI+pI}function X0(e){return e>As?e*e*e:mI*(e-pI)}function Z0(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Q0(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function s7(e){if(e instanceof qo)return new qo(e.h,e.c,e.l,e.opacity);if(e instanceof ro||(e=dI(e)),e.a===0&&e.b===0)return new qo(NaN,0=1?(r=1,t-1):Math.floor(r*t),o=e[n],i=e[n+1],a=n>0?e[n-1]:2*o-i,s=n()=>e;function II(e,t){return function(r){return e+r*t}}function c7(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Ns(e,t){var r=t-e;return r?II(e,r>180||r<-180?r-360*Math.round(r/360):r):ks(isNaN(e)?t:e)}function _I(e){return(e=+e)==1?nt:function(t,r){return r-t?c7(t,r,e):ks(isNaN(t)?r:t)}}function nt(e,t){var r=t-e;return r?II(e,r):ks(isNaN(e)?t:e)}var an=(function e(t){var r=_I(t);function n(o,i){var a=r((o=on(o)).r,(i=on(i)).r),s=r(o.g,i.g),f=r(o.b,i.b),u=nt(o.opacity,i.opacity);return function(c){return o.r=a(c),o.g=s(c),o.b=f(c),o.opacity=u(c),o+""}}return n.gamma=e,n})(1);function vI(e){return function(t){var r=t.length,n=new Array(r),o=new Array(r),i=new Array(r),a,s;for(a=0;ar&&(i=t.slice(r,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,f.push({i:a,x:et(n,o)})),r=ny.lastIndex;return r180?c+=360:c-u>180&&(u+=360),l.push({i:m.push(o(m)+"rotate(",null,n)-2,x:et(u,c)})):c&&m.push(o(m)+"rotate("+c+n)}function s(u,c,m,l){u!==c?l.push({i:m.push(o(m)+"skewX(",null,n)-2,x:et(u,c)}):c&&m.push(o(m)+"skewX("+c+n)}function f(u,c,m,l,p,d){if(u!==m||c!==l){var y=p.push(o(p)+"scale(",null,",",null,")");d.push({i:y-4,x:et(u,m)},{i:y-2,x:et(c,l)})}else(m!==1||l!==1)&&p.push(o(p)+"scale("+m+","+l+")")}return function(u,c){var m=[],l=[];return u=e(u),c=e(c),i(u.translateX,u.translateY,c.translateX,c.translateY,m,l),a(u.rotate,c.rotate,m,l),s(u.skewX,c.skewX,m,l),f(u.scaleX,u.scaleY,c.scaleX,c.scaleY,m,l),u=c=null,function(p){for(var d=-1,y=l.length,x;++d=0&&e._call.call(void 0,t),e=e._next;--Es}function LI(){va=(ep=Ic.now())+tp,Es=wc=0;try{UI()}finally{Es=0,g7(),va=0}}function x7(){var e=Ic.now(),t=e-ep;t>DI&&(tp-=t,ep=e)}function g7(){for(var e,t=Jl,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Jl=r);Sc=e,uy(n)}function uy(e){if(!Es){wc&&(wc=clearTimeout(wc));var t=e-va;t>24?(e<1/0&&(wc=setTimeout(LI,e-Ic.now()-tp)),bc&&(bc=clearInterval(bc))):(bc||(ep=Ic.now(),bc=setInterval(x7,DI)),Es=1,VI(LI))}}function np(e,t,r){var n=new _c;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,r),n}var b7=G0("start","end","cancel","interrupt"),w7=[],GI=0,jI=1,ip=2,op=3,BI=4,ap=5,Tc=6;function Pi(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;S7(e,r,{name:t,index:n,group:o,on:b7,tween:w7,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:GI})}function Mc(e,t){var r=Ot(e,t);if(r.state>GI)throw new Error("too late; already scheduled");return r}function Yt(e,t){var r=Ot(e,t);if(r.state>op)throw new Error("too late; already running");return r}function Ot(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function S7(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=rp(i,0,r.time);function i(u){r.state=jI,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var c,m,l,p;if(r.state!==jI)return f();for(c in n)if(p=n[c],p.name===r.name){if(p.state===op)return np(a);p.state===BI?(p.state=Tc,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[c]):+cip&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function j7(e,t,r){var n,o,i=U7(t)?Mc:Yt;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function e_(e,t){var r=this._id;return arguments.length<2?Ot(this.node(),r).on.on(e):this.each(j7(r,e,t))}function B7(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function t_(){return this.on("end.remove",B7(this._id))}function r_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=ga(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a=0))throw new Error(`invalid digits: ${e}`);if(t>15)return h_;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;oTa)if(!(Math.abs(m*f-u*c)>Ta)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-a,d=o-s,y=f*f+u*u,x=p*p+d*d,w=Math.sqrt(y),g=Math.sqrt(l),S=i*Math.tan((py-Math.acos((y+l-x)/(2*w*g)))/2),b=S/g,T=S/w;Math.abs(b-1)>Ta&&this._append`L${t+b*c},${r+b*m}`,this._append`A${i},${i},0,0,${+(m*p>c*d)},${this._x1=t+T*f},${this._y1=r+T*u}`}}arc(t,r,n,o,i,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(o),f=n*Math.sin(o),u=t+s,c=r+f,m=1^a,l=a?o-i:i-o;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Ta||Math.abs(this._y1-c)>Ta)&&this._append`L${u},${c}`,n&&(l<0&&(l=l%my+my),l>oP?this._append`A${n},${n},0,1,${m},${t-s},${r-f}A${n},${n},0,1,${m},${this._x1=u},${this._y1=c}`:l>Ta&&this._append`A${n},${n},0,${+(l>=py)},${m},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}};function y_(){return new ki}y_.prototype=ki.prototype;function En(e=3){return new ki(+e)}function x_(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ma(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function oo(e){return e=Ma(Math.abs(e)),e?e[1]:NaN}function g_(e,t){return function(r,n){for(var o=r.length,i=[],a=0,s=e[0],f=0;o>0&&s>0&&(f+s+1>n&&(s=Math.max(1,n-f)),i.push(r.substring(o-=s,o+s)),!((f+=s+1)>n));)s=e[a=(a+1)%e.length];return i.reverse().join(t)}}function b_(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var aP=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function io(e){if(!(t=aP.exec(e)))throw new Error("invalid format: "+e);var t;return new lp({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]})}io.prototype=lp.prototype;function lp(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+""}lp.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 w_(e){e:for(var t=e.length,r=1,n=-1,o;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}var Oc;function S_(e,t){var r=Ma(e,t);if(!r)return Oc=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(Oc=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Ma(e,Math.max(0,t+i-1))[0]}function dy(e,t){var r=Ma(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}var hy={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:x_,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)=>dy(e*100,t),r:dy,s:S_,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function yy(e){return e}var I_=Array.prototype.map,__=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function v_(e){var t=e.grouping===void 0||e.thousands===void 0?yy:g_(I_.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?yy:b_(I_.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"\u2212":e.minus+"",f=e.nan===void 0?"NaN":e.nan+"";function u(m,l){m=io(m);var p=m.fill,d=m.align,y=m.sign,x=m.symbol,w=m.zero,g=m.width,S=m.comma,b=m.precision,T=m.trim,I=m.type;I==="n"?(S=!0,I="g"):hy[I]||(b===void 0&&(b=12),T=!0,I="g"),(w||p==="0"&&d==="=")&&(w=!0,p="0",d="=");var v=(l&&l.prefix!==void 0?l.prefix:"")+(x==="$"?r:x==="#"&&/[boxX]/.test(I)?"0"+I.toLowerCase():""),O=(x==="$"?n:/[%p]/.test(I)?a:"")+(l&&l.suffix!==void 0?l.suffix:""),C=hy[I],E=/[defgprs%]/.test(I);b=b===void 0?6:/[gprs]/.test(I)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function A(F){var H=v,j=O,M,U,D;if(I==="c")j=C(F)+j,F="";else{F=+F;var oe=F<0||1/F<0;if(F=isNaN(F)?f:C(Math.abs(F),b),T&&(F=w_(F)),oe&&+F==0&&y!=="+"&&(oe=!1),H=(oe?y==="("?y:s:y==="-"||y==="("?"":y)+H,j=(I==="s"&&!isNaN(F)&&Oc!==void 0?__[8+Oc/3]:"")+j+(oe&&y==="("?")":""),E){for(M=-1,U=F.length;++MD||D>57){j=(D===46?o+F.slice(M+1):F.slice(M))+j,F=F.slice(0,M);break}}}S&&!w&&(F=t(F,1/0));var V=H.length+F.length+j.length,K=V>1)+H+F+j+K.slice(V);break;default:F=K+H+F+j;break}return i(F)}return A.toString=function(){return m+""},A}function c(m,l){var p=Math.max(-8,Math.min(8,Math.floor(oo(l)/3)))*3,d=Math.pow(10,-p),y=u((m=io(m),m.type="f",m),{suffix:__[8+p/3]});return function(x){return y(d*x)}}return{format:u,formatPrefix:c}}var pp,sn,mp;xy({thousands:",",grouping:[3],currency:["$",""]});function xy(e){return pp=v_(e),sn=pp.format,mp=pp.formatPrefix,pp}function gy(e){return Math.max(0,-oo(Math.abs(e)))}function by(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(oo(t)/3)))*3-oo(Math.abs(e)))}function wy(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,oo(t)-oo(e))+1}var ne=1e-6,dp=1e-12,ue=Math.PI,Ue=ue/2,Sy=ue/4,Ft=ue*2,Rt=180/ue,je=ue/180,de=Math.abs,fn=Math.atan,Wt=Math.atan2,te=Math.cos;var hp=Math.exp;var Oa=Math.log,yp=Math.pow,ee=Math.sin,ar=Math.sign||function(e){return e>0?1:e<0?-1:0},Ye=Math.sqrt,Ls=Math.tan;function xp(e){return e>1?0:e<-1?ue:Math.acos(e)}function mt(e){return e>1?Ue:e<-1?-Ue:Math.asin(e)}function Et(){}function gp(e,t){e&&M_.hasOwnProperty(e.type)&&M_[e.type](e,t)}var T_={Feature:function(e,t){gp(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++nue&&(e-=Math.round(e/Ft)*Ft),[e,t]}_y.invert=_y;function vy(e,t,r){return(e%=Ft)?t||r?kc(C_(e),A_(t,r)):C_(e):t||r?A_(t,r):_y}function R_(e){return function(t,r){return t+=e,de(t)>ue&&(t-=Math.round(t/Ft)*Ft),[t,r]}}function C_(e){var t=R_(e);return t.invert=R_(-e),t}function A_(e,t){var r=te(e),n=ee(e),o=te(t),i=ee(t);function a(s,f){var u=te(f),c=te(s)*u,m=ee(s)*u,l=ee(f),p=l*r+c*n;return[Wt(m*o-p*i,c*r-l*n),mt(p*o+m*i)]}return a.invert=function(s,f){var u=te(f),c=te(s)*u,m=ee(s)*u,l=ee(f),p=l*o-m*i;return[Wt(m*o+l*i,c*r+p*n),mt(p*r-c*n)]},a}function P_(e){e=vy(e[0]*je,e[1]*je,e.length>2?e[2]*je:0);function t(r){return r=e(r[0]*je,r[1]*je),r[0]*=Rt,r[1]*=Rt,r}return t.invert=function(r){return r=e.invert(r[0]*je,r[1]*je),r[0]*=Rt,r[1]*=Rt,r},t}function N_(e,t,r,n,o,i){if(r){var a=te(t),s=ee(t),f=n*r;o==null?(o=t+n*Ft,i=t-f/2):(o=k_(a,o),i=k_(a,i),(n>0?oi)&&(o+=n*Ft));for(var u,c=o;n>0?c>i:c1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Vs(e,t){return de(e[0]-t[0])=0;--s)o.point((m=c[s])[0],m[1]);else n(l.x,l.p.x,-1,o);l=l.p}l=l.o,c=l.z,p=!p}while(!l.v);o.lineEnd()}}}function F_(e){if(t=e.length){for(var t,r=0,n=e[0],o;++r=0?1:-1,E=C*O,A=E>ue,F=x*I;if(f.add(Wt(F*C*ee(E),w*v+F*te(E))),a+=A?O+C*Ft:O,A^d>=r^b>=r){var H=Ds(ao(p),ao(S));Pc(H);var j=Ds(i,H);Pc(j);var M=(A^O>=0?-1:1)*mt(j[2]);(n>M||n===M&&(H[0]||H[1]))&&(s+=A^O>=0?1:-1)}}return(a<-ne||a0){for(f||(o.polygonStart(),f=!0),o.lineStart(),I=0;I1&&b&2&&T.push(T.pop().concat(T.shift())),c.push(T.filter(sP))}}return l}}function sP(e){return e.length>1}function fP(e,t){return((e=e.x)[0]<0?e[1]-Ue-ne:Ue-e[1])-((t=t.x)[0]<0?t[1]-Ue-ne:Ue-t[1])}var My=_p(function(){return!0},cP,lP,[-ue,-Ue]);function cP(e){var t=NaN,r=NaN,n=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,a){var s=i>0?ue:-ue,f=de(i-t);de(f-ue)0?Ue:-Ue),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(i,r),o=0):n!==s&&f>=ue&&(de(t-n)ne?fn((ee(t)*(i=te(n))*ee(r)-ee(n)*(o=te(t))*ee(e))/(o*i*a)):(t+n)/2}function lP(e,t,r,n){var o;if(e==null)o=r*Ue,n.point(-ue,o),n.point(0,o),n.point(ue,o),n.point(ue,0),n.point(ue,-o),n.point(0,-o),n.point(-ue,-o),n.point(-ue,0),n.point(-ue,o);else if(de(e[0]-t[0])>ne){var i=e[0]0,o=de(t)>ne;function i(c,m,l,p){N_(p,e,r,l,c,m)}function a(c,m){return te(c)*te(m)>t}function s(c){var m,l,p,d,y;return{lineStart:function(){d=p=!1,y=1},point:function(x,w){var g=[x,w],S,b=a(x,w),T=n?b?0:u(x,w):b?u(x+(x<0?ue:-ue),w):0;if(!m&&(d=p=b)&&c.lineStart(),b!==p&&(S=f(m,g),(!S||Vs(m,S)||Vs(g,S))&&(g[2]=1)),b!==p)y=0,b?(c.lineStart(),S=f(g,m),c.point(S[0],S[1])):(S=f(m,g),c.point(S[0],S[1],2),c.lineEnd()),m=S;else if(o&&m&&n^b){var I;!(T&l)&&(I=f(g,m,!0))&&(y=0,n?(c.lineStart(),c.point(I[0][0],I[0][1]),c.point(I[1][0],I[1][1]),c.lineEnd()):(c.point(I[1][0],I[1][1]),c.lineEnd(),c.lineStart(),c.point(I[0][0],I[0][1],3)))}b&&(!m||!Vs(m,g))&&c.point(g[0],g[1]),m=g,p=b,l=T},lineEnd:function(){p&&c.lineEnd(),m=null},clean:function(){return y|(d&&p)<<1}}}function f(c,m,l){var p=ao(c),d=ao(m),y=[1,0,0],x=Ds(p,d),w=Cc(x,x),g=x[0],S=w-g*g;if(!S)return!l&&c;var b=t*w/S,T=-t*g/S,I=Ds(y,x),v=Ac(y,b),O=Ac(x,T);bp(v,O);var C=I,E=Cc(v,C),A=Cc(C,C),F=E*E-A*(Cc(v,v)-1);if(!(F<0)){var H=Ye(F),j=Ac(C,(-E-H)/A);if(bp(j,v),j=Rc(j),!l)return j;var M=c[0],U=m[0],D=c[1],oe=m[1],V;U0^j[1]<(de(j[0]-M)ue^(M<=j[0]&&j[0]<=U)){var J=Ac(C,(-E+H)/A);return bp(J,v),[j,Rc(J)]}}}function u(c,m){var l=n?e:ue-e,p=0;return c<-l?p|=1:c>l&&(p|=2),m<-l?p|=4:m>l&&(p|=8),p}return _p(a,s,i,n?[0,-e]:[-ue,e-ue])}function L_(e,t,r,n,o,i){var a=e[0],s=e[1],f=t[0],u=t[1],c=0,m=1,l=f-a,p=u-s,d;if(d=r-a,!(!l&&d>0)){if(d/=l,l<0){if(d0){if(d>m)return;d>c&&(c=d)}if(d=o-a,!(!l&&d<0)){if(d/=l,l<0){if(d>m)return;d>c&&(c=d)}else if(l>0){if(d0)){if(d/=p,p<0){if(d0){if(d>m)return;d>c&&(c=d)}if(d=i-s,!(!p&&d<0)){if(d/=p,p<0){if(d>m)return;d>c&&(c=d)}else if(p>0){if(d0&&(e[0]=a+c*l,e[1]=s+c*p),m<1&&(t[0]=a+m*l,t[1]=s+m*p),!0}}}}}var Nc=1e9,vp=-Nc;function Us(e,t,r,n){function o(u,c){return e<=u&&u<=r&&t<=c&&c<=n}function i(u,c,m,l){var p=0,d=0;if(u==null||(p=a(u,m))!==(d=a(c,m))||f(u,c)<0^m>0)do l.point(p===0||p===3?e:r,p>1?n:t);while((p=(p+m+4)%4)!==d);else l.point(c[0],c[1])}function a(u,c){return de(u[0]-e)0?0:3:de(u[0]-r)0?2:1:de(u[1]-t)0?1:0:c>0?3:2}function s(u,c){return f(u.x,c.x)}function f(u,c){var m=a(u,1),l=a(c,1);return m!==l?m-l:m===0?c[1]-u[1]:m===1?u[0]-c[0]:m===2?u[1]-c[1]:c[0]-u[0]}return function(u){var c=u,m=wp(),l,p,d,y,x,w,g,S,b,T,I,v={point:O,lineStart:F,lineEnd:H,polygonStart:E,polygonEnd:A};function O(M,U){o(M,U)&&c.point(M,U)}function C(){for(var M=0,U=0,D=p.length;Un&&(ye-Z)*(n-J)>(B-J)*(e-Z)&&++M:B<=n&&(ye-Z)*(n-J)<(B-J)*(e-Z)&&--M;return M}function E(){c=m,l=[],p=[],I=!0}function A(){var M=C(),U=I&&M,D=(l=Rs(l)).length;(U||D)&&(u.polygonStart(),U&&(u.lineStart(),i(null,null,1,u),u.lineEnd()),D&&Ip(l,s,M,i,u),u.polygonEnd()),c=u,l=p=d=null}function F(){v.point=j,p&&p.push(d=[]),T=!0,b=!1,g=S=NaN}function H(){l&&(j(y,x),w&&b&&m.rejoin(),l.push(m.result())),v.point=O,b&&c.lineEnd()}function j(M,U){var D=o(M,U);if(p&&d.push([M,U]),T)y=M,x=U,w=D,T=!1,D&&(c.lineStart(),c.point(M,U));else if(D&&b)c.point(M,U);else{var oe=[g=Math.max(vp,Math.min(Nc,g)),S=Math.max(vp,Math.min(Nc,S))],V=[M=Math.max(vp,Math.min(Nc,M)),U=Math.max(vp,Math.min(Nc,U))];L_(oe,V,e,t,r,n)?(b||(c.lineStart(),c.point(oe[0],oe[1])),c.point(V[0],V[1]),D||c.lineEnd(),I=!1):D&&(c.lineStart(),c.point(M,U),I=!1)}g=M,S=U,b=D}return v}}var Fc=e=>e;var Oy=new Ur,Ry=new Ur,D_,V_,Cy,Ay,Ni={point:Et,lineStart:Et,lineEnd:Et,polygonStart:function(){Ni.lineStart=pP,Ni.lineEnd=dP},polygonEnd:function(){Ni.lineStart=Ni.lineEnd=Ni.point=Et,Oy.add(de(Ry)),Ry=new Ur},result:function(){var e=Oy/2;return Oy=new Ur,e}};function pP(){Ni.point=mP}function mP(e,t){Ni.point=U_,D_=Cy=e,V_=Ay=t}function U_(e,t){Ry.add(Ay*e-Cy*t),Cy=e,Ay=t}function dP(){U_(D_,V_)}var Py=Ni;var js=1/0,Tp=js,Ec=-js,Mp=Ec,hP={point:yP,lineStart:Et,lineEnd:Et,polygonStart:Et,polygonEnd:Et,result:function(){var e=[[js,Tp],[Ec,Mp]];return Ec=Mp=-(Tp=js=1/0),e}};function yP(e,t){eEc&&(Ec=e),tMp&&(Mp=t)}var Bs=hP;var ky=0,Ny=0,$c=0,Op=0,Rp=0,Gs=0,Fy=0,Ey=0,Lc=0,G_,z_,so,fo,Ln={point:Ra,lineStart:j_,lineEnd:B_,polygonStart:function(){Ln.lineStart=bP,Ln.lineEnd=wP},polygonEnd:function(){Ln.point=Ra,Ln.lineStart=j_,Ln.lineEnd=B_},result:function(){var e=Lc?[Fy/Lc,Ey/Lc]:Gs?[Op/Gs,Rp/Gs]:$c?[ky/$c,Ny/$c]:[NaN,NaN];return ky=Ny=$c=Op=Rp=Gs=Fy=Ey=Lc=0,e}};function Ra(e,t){ky+=e,Ny+=t,++$c}function j_(){Ln.point=xP}function xP(e,t){Ln.point=gP,Ra(so=e,fo=t)}function gP(e,t){var r=e-so,n=t-fo,o=Ye(r*r+n*n);Op+=o*(so+e)/2,Rp+=o*(fo+t)/2,Gs+=o,Ra(so=e,fo=t)}function B_(){Ln.point=Ra}function bP(){Ln.point=SP}function wP(){K_(G_,z_)}function SP(e,t){Ln.point=K_,Ra(G_=so=e,z_=fo=t)}function K_(e,t){var r=e-so,n=t-fo,o=Ye(r*r+n*n);Op+=o*(so+e)/2,Rp+=o*(fo+t)/2,Gs+=o,o=fo*e-so*t,Fy+=o*(so+e),Ey+=o*(fo+t),Lc+=o*3,Ra(so=e,fo=t)}var $y=Ln;function Cp(e){this._context=e}Cp.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,Ft);break}}},result:Et};var Dy=new Ur,Ly,q_,H_,Dc,Vc,Ap={point:Et,lineStart:function(){Ap.point=IP},lineEnd:function(){Ly&&Y_(q_,H_),Ap.point=Et},polygonStart:function(){Ly=!0},polygonEnd:function(){Ly=null},result:function(){var e=+Dy;return Dy=new Ur,e}};function IP(e,t){Ap.point=Y_,q_=Dc=e,H_=Vc=t}function Y_(e,t){Dc-=e,Vc-=t,Dy.add(Ye(Dc*Dc+Vc*Vc)),Dc=e,Vc=t}var Vy=Ap;var W_,Pp,X_,Z_,zs=class{constructor(t){this._append=t==null?Q_:_P(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==X_||this._append!==Pp){let n=this._radius,o=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,X_=n,Pp=this._append,Z_=this._,this._=o}this._+=Z_;break}}}result(){let t=this._;return this._="",t.length?t:null}};function Q_(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Q_;if(t!==W_){let r=10**t;W_=t,Pp=function(o){let i=1;this._+=o[0];for(let a=o.length;i=0))throw new RangeError(`invalid digits: ${s}`);r=f}return t===null&&(i=new zs(r)),a},a.projection(e).digits(r).context(t)}function qs(e){return{stream:Hs(e)}}function Hs(e){return function(t){var r=new Uy;for(var n in e)r[n]=e[n];return r.stream=t,r}}function Uy(){}Uy.prototype={constructor:Uy,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 jy(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),$n(r,e.stream(Bs)),t(Bs.result()),n!=null&&e.clipExtent(n),e}function Uc(e,t,r){return jy(e,function(n){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(o/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),s=+t[0][0]+(o-a*(n[1][0]+n[0][0]))/2,f=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([s,f])},r)}function kp(e,t,r){return Uc(e,[[0,0],t],r)}function Np(e,t,r){return jy(e,function(n){var o=+t,i=o/(n[1][0]-n[0][0]),a=(o-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];e.scale(150*i).translate([a,s])},r)}function Fp(e,t,r){return jy(e,function(n){var o=+t,i=o/(n[1][1]-n[0][1]),a=-i*n[0][0],s=(o-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,s])},r)}var J_=16,vP=te(30*je);function By(e,t){return+t?MP(e,t):TP(e)}function TP(e){return Hs({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function MP(e,t){function r(n,o,i,a,s,f,u,c,m,l,p,d,y,x){var w=u-n,g=c-o,S=w*w+g*g;if(S>4*t&&y--){var b=a+l,T=s+p,I=f+d,v=Ye(b*b+T*T+I*I),O=mt(I/=v),C=de(de(I)-1)t||de((w*H+g*j)/S-.5)>.3||a*l+s*p+f*d2?M[2]%360*je:0,H()):[s*Rt,f*Rt,u*Rt]},A.angle=function(M){return arguments.length?(m=M%360*je,H()):m*Rt},A.reflectX=function(M){return arguments.length?(l=M?-1:1,H()):l<0},A.reflectY=function(M){return arguments.length?(p=M?-1:1,H()):p<0},A.precision=function(M){return arguments.length?(I=By(v,T=M*M),j()):Ye(T)},A.fitExtent=function(M,U){return Uc(A,M,U)},A.fitSize=function(M,U){return kp(A,M,U)},A.fitWidth=function(M,U){return Np(A,M,U)},A.fitHeight=function(M,U){return Fp(A,M,U)};function H(){var M=ev(r,0,0,l,p,m).apply(null,t(i,a)),U=ev(r,n-M[0],o-M[1],l,p,m);return c=vy(s,f,u),v=kc(t,U),O=kc(c,v),I=By(v,T),j()}function j(){return C=E=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&F,H()}}function Ys(e){var t=0,r=ue/3,n=Gy(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*je,r=i[1]*je):[t*Rt,r*Rt]},o}function tv(e){var t=te(e);function r(n,o){return[n*t,ee(o)/t]}return r.invert=function(n,o){return[n/t,mt(o*t)]},r}function rv(e,t){var r=ee(e),n=(r+ee(t))/2;if(de(n)=.12&&x<.234&&y>=-.425&&y<-.214?o:x>=.166&&x<.234&&y>=-.214&&y<-.115?a:r).invert(l)},c.stream=function(l){return e&&t===l?e:e=AP([r.stream(t=l),o.stream(l),a.stream(l)])},c.precision=function(l){return arguments.length?(r.precision(l),o.precision(l),a.precision(l),m()):r.precision()},c.scale=function(l){return arguments.length?(r.scale(l),o.scale(l*.35),a.scale(l),c.translate(r.translate())):r.scale()},c.translate=function(l){if(!arguments.length)return r.translate();var p=r.scale(),d=+l[0],y=+l[1];return n=r.translate(l).clipExtent([[d-.455*p,y-.238*p],[d+.455*p,y+.238*p]]).stream(u),i=o.translate([d-.307*p,y+.201*p]).clipExtent([[d-.425*p+ne,y+.12*p+ne],[d-.214*p-ne,y+.234*p-ne]]).stream(u),s=a.translate([d-.205*p,y+.212*p]).clipExtent([[d-.214*p+ne,y+.166*p+ne],[d-.115*p-ne,y+.234*p-ne]]).stream(u),m()},c.fitExtent=function(l,p){return Uc(c,l,p)},c.fitSize=function(l,p){return kp(c,l,p)},c.fitWidth=function(l,p){return Np(c,l,p)},c.fitHeight=function(l,p){return Fp(c,l,p)};function m(){return e=t=null,c}return c.scale(1070)}function Ep(e){return function(t,r){var n=te(t),o=te(r),i=e(n*o);return i===1/0?[2,0]:[i*o*ee(t),i*ee(r)]}}function co(e){return function(t,r){var n=Ye(t*t+r*r),o=e(n),i=ee(o),a=te(o);return[Wt(t*i,n*a),mt(n&&r*i/n)]}}var Ky=Ep(function(e){return Ye(2/(1+e))});Ky.invert=co(function(e){return 2*mt(e/2)});function qy(){return Xt(Ky).scale(124.75).clipAngle(180-.001)}var Hy=Ep(function(e){return(e=xp(e))&&e/ee(e)});Hy.invert=co(function(e){return e});function Yy(){return Xt(Hy).scale(79.4188).clipAngle(180-.001)}function Ws(e,t){return[e,Oa(Ls((Ue+t)/2))]}Ws.invert=function(e,t){return[e,2*fn(hp(t))-Ue]};function Wy(){return Xy(Ws).scale(961/Ft)}function Xy(e){var t=Xt(e),r=t.center,n=t.scale,o=t.translate,i=t.clipExtent,a=null,s,f,u;t.scale=function(m){return arguments.length?(n(m),c()):n()},t.translate=function(m){return arguments.length?(o(m),c()):o()},t.center=function(m){return arguments.length?(r(m),c()):r()},t.clipExtent=function(m){return arguments.length?(m==null?a=s=f=u=null:(a=+m[0][0],s=+m[0][1],f=+m[1][0],u=+m[1][1]),c()):a==null?null:[[a,s],[f,u]]};function c(){var m=ue*n(),l=t(P_(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-m,l[1]-m],[l[0]+m,l[1]+m]]:e===Ws?[[Math.max(l[0]-m,a),s],[Math.min(l[0]+m,f),u]]:[[a,Math.max(l[1]-m,s)],[f,Math.min(l[1]+m,u)]])}return c()}function $p(e){return Ls((Ue+e)/2)}function nv(e,t){var r=te(e),n=e===t?ee(e):Oa(r/te(t))/Oa($p(t)/$p(e)),o=r*yp($p(e),n)/n;if(!n)return Ws;function i(a,s){o>0?s<-Ue+ne&&(s=-Ue+ne):s>Ue-ne&&(s=Ue-ne);var f=o/yp($p(s),n);return[f*ee(n*a),o-f*te(n*a)]}return i.invert=function(a,s){var f=o-s,u=ar(n)*Ye(a*a+f*f),c=Wt(a,de(f))*ar(f);return f*n<0&&(c-=ue*ar(a)*ar(f)),[c/n,2*fn(yp(o/u,1/n))-Ue]},i}function Zy(){return Ys(nv).scale(109.5).parallels([30,30])}function Xs(e,t){return[e,t]}Xs.invert=Xs;function Qy(){return Xt(Xs).scale(152.63)}function ov(e,t){var r=te(e),n=e===t?ee(e):(r-te(t))/(t-e),o=r/n+e;if(de(n)2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Mt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function qc(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 Hc=Symbol("implicit");function Ca(){var e=new pr,t=[],r=[],n=Hc;function o(i){let a=e.get(i);if(a===void 0){if(n!==Hc)return n;e.set(i,a=t.push(i)-1)}return r[a%r.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new pr;for(let a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(r=Array.from(i),o):r.slice()},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return Ca(t,r).unknown(n)},Mt.apply(o,arguments),o}function Ei(){var e=Ca().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,i,a,s=!1,f=0,u=0,c=.5;delete e.unknown;function m(){var l=t().length,p=ot&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function NP(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?FP:NP,f=u=null,m}function m(l){return l==null||isNaN(l=+l)?i:(f||(f=s(e.map(n),t,r)))(n(a(l)))}return m.invert=function(l){return a(o((u||(u=s(t,e.map(n),et)))(l)))},m.domain=function(l){return arguments.length?(e=Array.from(l,Zs),c()):e.slice()},m.range=function(l){return arguments.length?(t=Array.from(l),c()):t.slice()},m.rangeRound=function(l){return t=Array.from(l),r=_a,c()},m.clamp=function(l){return arguments.length?(a=l?!0:Mr,c()):a!==Mr},m.interpolate=function(l){return arguments.length?(r=l,c()):r},m.unknown=function(l){return arguments.length?(i=l,m):i},function(l,p){return n=l,o=p,c()}}function Yc(){return Aa()(Mr,Mr)}function mx(e,t,r,n){var o=Os(e,t,r),i;switch(n=io(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=by(o,a))&&(n.precision=i),mp(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=wy(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=gy(o))&&(n.precision=i-(n.type==="%")*2);break}}return sn(n)}function Yo(e){var t=e.domain;return e.ticks=function(r){var n=t();return Uo(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return mx(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,i=n.length-1,a=n[o],s=n[i],f,u,c=10;for(s0;){if(u=sc(a,s,r),u===f)return n[o]=a,n[i]=s,t(n);if(u>0)a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u;else if(u<0)a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u;else break;f=u}return e},e}function Pa(){var e=Yc();return e.copy=function(){return uo(e,Pa())},Mt.apply(e,arguments),Yo(e)}function Wc(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Zs),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Wc(e).unknown(t)},e=arguments.length?Array.from(e,Zs):[0,1],Yo(r)}function Xc(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],i=e[n],a;return iMath.pow(e,t)}function VP(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 cv(e){return(t,r)=>-e(-t,r)}function dx(e){let t=e(sv,fv),r=t.domain,n=10,o,i;function a(){return o=VP(n),i=DP(n),r()[0]<0?(o=cv(o),i=cv(i),e(EP,$P)):e(sv,fv),t}return t.base=function(s){return arguments.length?(n=+s,a()):n},t.domain=function(s){return arguments.length?(r(s),a()):r()},t.ticks=s=>{let f=r(),u=f[0],c=f[f.length-1],m=c0){for(;l<=p;++l)for(d=1;dc)break;w.push(y)}}else for(;l<=p;++l)for(d=n-1;d>=1;--d)if(y=l>0?d/i(-l):d*i(l),!(yc)break;w.push(y)}w.length*2{if(s==null&&(s=10),f==null&&(f=n===10?"s":","),typeof f!="function"&&(!(n%1)&&(f=io(f)).precision==null&&(f.trim=!0),f=sn(f)),s===1/0)return f;let u=Math.max(1,n*s/t.ticks().length);return c=>{let m=c/i(Math.round(o(c)));return m*nr(Xc(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function Zc(){let e=dx(Aa()).domain([1,10]);return e.copy=()=>uo(e,Zc()).base(e.base()),Mt.apply(e,arguments),e}function uv(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function lv(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function hx(e){var t=1,r=e(uv(t),lv(t));return r.constant=function(n){return arguments.length?e(uv(t=+n),lv(t)):t},Yo(r)}function Qc(){var e=hx(Aa());return e.copy=function(){return uo(e,Qc()).constant(e.constant())},Mt.apply(e,arguments)}function pv(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function UP(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function jP(e){return e<0?-e*e:e*e}function yx(e){var t=e(Mr,Mr),r=1;function n(){return r===1?e(Mr,Mr):r===.5?e(UP,jP):e(pv(r),pv(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},Yo(t)}function Jc(){var e=yx(Aa());return e.copy=function(){return uo(e,Jc()).exponent(e.exponent())},Mt.apply(e,arguments),e}function eu(){var e=[],t=[],r=[],n;function o(){var a=0,s=Math.max(1,t.length);for(r=new Array(s-1);++a0?r[s-1]:e[0],s(e(i=new Date(+i)),i),o.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),o.round=i=>{let a=o(i),s=o.ceil(i);return i-a(t(i=new Date(+i),a==null?1:Math.floor(a)),i),o.range=(i,a,s)=>{let f=[];if(i=o.ceil(i),s=s==null?1:Math.floor(s),!(i0))return f;let u;do f.push(u=new Date(+i)),t(i,s),e(i);while(uqe(a=>{if(a>=a)for(;e(a),!i(a);)a.setTime(a-1)},(a,s)=>{if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!i(a););else for(;--s>=0;)for(;t(a,1),!i(a););}),r&&(o.count=(i,a)=>(xx.setTime(+i),gx.setTime(+a),e(xx),e(gx),Math.floor(r(xx,gx))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(n?a=>n(a)%i===0:a=>o.count(0,a)%i===0):o)),o}var ru=qe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ru.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?qe(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ru);var ble=ru.range;var $t=qe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),mv=$t.range;var Wo=qe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),BP=Wo.range,Xo=qe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),GP=Xo.range;var Zo=qe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),zP=Zo.range,Qo=qe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),KP=Qo.range;var cn=qe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),qP=cn.range,Fa=qe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),HP=Fa.range,Ea=qe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),YP=Ea.range;function $a(e){return qe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var jr=$a(0),$i=$a(1),Dp=$a(2),Vp=$a(3),po=$a(4),Up=$a(5),jp=$a(6),hv=jr.range,WP=$i.range,XP=Dp.range,ZP=Vp.range,QP=po.range,JP=Up.range,ek=jp.range;function La(e){return qe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var Br=La(0),Li=La(1),Bp=La(2),Gp=La(3),mo=La(4),zp=La(5),Kp=La(6),yv=Br.range,tk=Li.range,rk=Bp.range,nk=Gp.range,ok=mo.range,ik=zp.range,ak=Kp.range;var Jo=qe(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()),sk=Jo.range,ei=qe(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()),fk=ei.range;var sr=qe(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());sr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:qe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var ck=sr.range,fr=qe(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());fr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:qe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var uk=fr.range;function gv(e,t,r,n,o,i){let a=[[$t,1,1e3],[$t,5,5*1e3],[$t,15,15*1e3],[$t,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function s(u,c,m){let l=cx).right(a,l);if(p===a.length)return e.every(Os(u/31536e6,c/31536e6,m));if(p===0)return ru.every(Math.max(Os(u,c,m),1));let[d,y]=a[l/a[p-1][2]53)return null;"w"in $||($.w=1),"Z"in $?(G=vx(ou($.y,0,1)),ae=G.getUTCDay(),G=ae>4||ae===0?Li.ceil(G):Li(G),G=Fa.offset(G,($.V-1)*7),$.y=G.getUTCFullYear(),$.m=G.getUTCMonth(),$.d=G.getUTCDate()+($.w+6)%7):(G=_x(ou($.y,0,1)),ae=G.getDay(),G=ae>4||ae===0?$i.ceil(G):$i(G),G=cn.offset(G,($.V-1)*7),$.y=G.getFullYear(),$.m=G.getMonth(),$.d=G.getDate()+($.w+6)%7)}else("W"in $||"U"in $)&&("w"in $||($.w="u"in $?$.u%7:"W"in $?1:0),ae="Z"in $?vx(ou($.y,0,1)).getUTCDay():_x(ou($.y,0,1)).getDay(),$.m=0,$.d="W"in $?($.w+6)%7+$.W*7-(ae+5)%7:$.w+$.U*7-(ae+6)%7);return"Z"in $?($.H+=$.Z/100|0,$.M+=$.Z%100,vx($)):_x($)}}function O(L,Q,re,$){for(var ke=0,G=Q.length,ae=re.length,xe,Ge;ke=ae)return-1;if(xe=Q.charCodeAt(ke++),xe===37){if(xe=Q.charAt(ke++),Ge=T[xe in bv?Q.charAt(ke++):xe],!Ge||($=Ge(L,re,$))<0)return-1}else if(xe!=re.charCodeAt($++))return-1}return $}function C(L,Q,re){var $=u.exec(Q.slice(re));return $?(L.p=c.get($[0].toLowerCase()),re+$[0].length):-1}function E(L,Q,re){var $=p.exec(Q.slice(re));return $?(L.w=d.get($[0].toLowerCase()),re+$[0].length):-1}function A(L,Q,re){var $=m.exec(Q.slice(re));return $?(L.w=l.get($[0].toLowerCase()),re+$[0].length):-1}function F(L,Q,re){var $=w.exec(Q.slice(re));return $?(L.m=g.get($[0].toLowerCase()),re+$[0].length):-1}function H(L,Q,re){var $=y.exec(Q.slice(re));return $?(L.m=x.get($[0].toLowerCase()),re+$[0].length):-1}function j(L,Q,re){return O(L,t,Q,re)}function M(L,Q,re){return O(L,r,Q,re)}function U(L,Q,re){return O(L,n,Q,re)}function D(L){return a[L.getDay()]}function oe(L){return i[L.getDay()]}function V(L){return f[L.getMonth()]}function K(L){return s[L.getMonth()]}function Y(L){return o[+(L.getHours()>=12)]}function Z(L){return 1+~~(L.getMonth()/3)}function J(L){return a[L.getUTCDay()]}function ye(L){return i[L.getUTCDay()]}function B(L){return f[L.getUTCMonth()]}function W(L){return s[L.getUTCMonth()]}function X(L){return o[+(L.getUTCHours()>=12)]}function le(L){return 1+~~(L.getUTCMonth()/3)}return{format:function(L){var Q=I(L+="",S);return Q.toString=function(){return L},Q},parse:function(L){var Q=v(L+="",!1);return Q.toString=function(){return L},Q},utcFormat:function(L){var Q=I(L+="",b);return Q.toString=function(){return L},Q},utcParse:function(L){var Q=v(L+="",!0);return Q.toString=function(){return L},Q}}}var bv={"-":"",_:" ",0:"0"},Lt=/^\s*\d+/,pk=/^%/,mk=/[\\^$*+?|[\]().{}]/g;function Ne(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i[t.toLowerCase(),r]))}function hk(e,t,r){var n=Lt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function yk(e,t,r){var n=Lt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function xk(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function gk(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function bk(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function wv(e,t,r){var n=Lt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Sv(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function wk(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Sk(e,t,r){var n=Lt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Ik(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Iv(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function _k(e,t,r){var n=Lt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function _v(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function vk(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Tk(e,t,r){var n=Lt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Mk(e,t,r){var n=Lt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Ok(e,t,r){var n=Lt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Rk(e,t,r){var n=pk.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Ck(e,t,r){var n=Lt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Ak(e,t,r){var n=Lt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function vv(e,t){return Ne(e.getDate(),t,2)}function Pk(e,t){return Ne(e.getHours(),t,2)}function kk(e,t){return Ne(e.getHours()%12||12,t,2)}function Nk(e,t){return Ne(1+cn.count(sr(e),e),t,3)}function Cv(e,t){return Ne(e.getMilliseconds(),t,3)}function Fk(e,t){return Cv(e,t)+"000"}function Ek(e,t){return Ne(e.getMonth()+1,t,2)}function $k(e,t){return Ne(e.getMinutes(),t,2)}function Lk(e,t){return Ne(e.getSeconds(),t,2)}function Dk(e){var t=e.getDay();return t===0?7:t}function Vk(e,t){return Ne(jr.count(sr(e)-1,e),t,2)}function Av(e){var t=e.getDay();return t>=4||t===0?po(e):po.ceil(e)}function Uk(e,t){return e=Av(e),Ne(po.count(sr(e),e)+(sr(e).getDay()===4),t,2)}function jk(e){return e.getDay()}function Bk(e,t){return Ne($i.count(sr(e)-1,e),t,2)}function Gk(e,t){return Ne(e.getFullYear()%100,t,2)}function zk(e,t){return e=Av(e),Ne(e.getFullYear()%100,t,2)}function Kk(e,t){return Ne(e.getFullYear()%1e4,t,4)}function qk(e,t){var r=e.getDay();return e=r>=4||r===0?po(e):po.ceil(e),Ne(e.getFullYear()%1e4,t,4)}function Hk(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ne(t/60|0,"0",2)+Ne(t%60,"0",2)}function Tv(e,t){return Ne(e.getUTCDate(),t,2)}function Yk(e,t){return Ne(e.getUTCHours(),t,2)}function Wk(e,t){return Ne(e.getUTCHours()%12||12,t,2)}function Xk(e,t){return Ne(1+Fa.count(fr(e),e),t,3)}function Pv(e,t){return Ne(e.getUTCMilliseconds(),t,3)}function Zk(e,t){return Pv(e,t)+"000"}function Qk(e,t){return Ne(e.getUTCMonth()+1,t,2)}function Jk(e,t){return Ne(e.getUTCMinutes(),t,2)}function e9(e,t){return Ne(e.getUTCSeconds(),t,2)}function t9(e){var t=e.getUTCDay();return t===0?7:t}function r9(e,t){return Ne(Br.count(fr(e)-1,e),t,2)}function kv(e){var t=e.getUTCDay();return t>=4||t===0?mo(e):mo.ceil(e)}function n9(e,t){return e=kv(e),Ne(mo.count(fr(e),e)+(fr(e).getUTCDay()===4),t,2)}function o9(e){return e.getUTCDay()}function i9(e,t){return Ne(Li.count(fr(e)-1,e),t,2)}function a9(e,t){return Ne(e.getUTCFullYear()%100,t,2)}function s9(e,t){return e=kv(e),Ne(e.getUTCFullYear()%100,t,2)}function f9(e,t){return Ne(e.getUTCFullYear()%1e4,t,4)}function c9(e,t){var r=e.getUTCDay();return e=r>=4||r===0?mo(e):mo.ceil(e),Ne(e.getUTCFullYear()%1e4,t,4)}function u9(){return"+0000"}function Mv(){return"%"}function Ov(e){return+e}function Rv(e){return Math.floor(+e/1e3)}var Qs,Js,Nv,ho,Fv;Mx({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Mx(e){return Qs=Tx(e),Js=Qs.format,Nv=Qs.parse,ho=Qs.utcFormat,Fv=Qs.utcParse,Qs}function l9(e){return new Date(e)}function p9(e){return e instanceof Date?+e:+new Date(+e)}function qp(e,t,r,n,o,i,a,s,f,u){var c=Yc(),m=c.invert,l=c.domain,p=u(".%L"),d=u(":%S"),y=u("%I:%M"),x=u("%I %p"),w=u("%a %d"),g=u("%b %d"),S=u("%B"),b=u("%Y");function T(I){return(f(I)ry(e[e.length-1]);var Jp=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(z),em=ie(Jp);var tm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(z),rm=ie(tm);var nm=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(z),om=ie(nm);var im=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(z),am=ie(im);var cu=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(z),ef=ie(cu);var sm=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(z),fm=ie(sm);var uu=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(z),tf=ie(uu);var cm=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(z),um=ie(cm);var lm=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(z),pm=ie(lm);var mm=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(z),dm=ie(mm);var hm=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(z),ym=ie(hm);var xm=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(z),gm=ie(xm);var bm=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(z),wm=ie(bm);var Sm=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(z),Im=ie(Sm);var _m=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(z),vm=ie(_m);var Tm=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(z),Mm=ie(Tm);var Om=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(z),Rm=ie(Om);var Cm=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(z),Am=ie(Cm);var Pm=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(z),km=ie(Pm);var Nm=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(z),Fm=ie(Nm);var Em=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(z),$m=ie(Em);var Lm=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(z),Dm=ie(Lm);var Vm=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(z),Um=ie(Vm);var jm=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(z),Bm=ie(jm);var Gm=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(z),zm=ie(Gm);var Km=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(z),qm=ie(Km);var Hm=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(z),Ym=ie(Hm);function Wm(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var Xm=Fs(dr(300,.5,0),dr(-240,.5,1));var Qm=Fs(dr(-100,.75,.35),dr(80,1.5,.8)),Jm=Fs(dr(260,.75,.35),dr(80,1.5,.8)),Zm=dr();function ed(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Zm.h=360*e-100,Zm.s=1.5-1.5*t,Zm.l=.8-.9*t,Zm+""}var td=on(),m9=Math.PI/3,d9=Math.PI*2/3;function rd(e){var t;return e=(.5-e)*Math.PI,td.r=255*(t=Math.sin(e))*t,td.g=255*(t=Math.sin(e+m9))*t,td.b=255*(t=Math.sin(e+d9))*t,td+""}function nd(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function od(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var id=od(z("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ad=od(z("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),sd=od(z("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),fd=od(z("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Da(e){return function(){return e}}var Dx=Math.cos;var rf=Math.min,lu=Math.sin,Fe=Math.sqrt,Vx=1e-12,Va=Math.PI,zhe=Va/2,nf=2*Va;function Ev(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new ki(t)}var Yhe=Array.prototype.slice;function $v(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Lv(e){this._context=e}Lv.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 Ua(e){return new Lv(e)}function Dv(e){return e[0]}function Vv(e){return e[1]}function Ux(e,t){var r=Da(!0),n=null,o=Ua,i=null,a=Ev(s);e=typeof e=="function"?e:e===void 0?Dv:Da(e),t=typeof t=="function"?t:t===void 0?Vv:Da(t);function s(f){var u,c=(f=$v(f)).length,m,l=!1,p;for(n==null&&(i=o(p=a())),u=0;u<=c;++u)!(u0)for(var n=e[0],o=t[0],i=e[r]-n,a=t[r]-o,s=-1,f;++s<=r;)f=s/r,this._basis.point(this._beta*e[s]+(1-this._beta)*(n+f*i),this._beta*t[s]+(1-this._beta)*(o+f*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var Wx=(function e(t){function r(n){return t===1?new _u(n):new zv(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function sf(e,t,r){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-r),e._x2,e._y2)}function ld(e,t){this._context=e,this._k=(1-t)/6}ld.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:sf(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:sf(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}};var Xx=(function e(t){function r(n){return new ld(n,t)}return r.tension=function(n){return e(+n)},r})(0);function pd(e,t){this._context=e,this._k=(1-t)/6}pd.prototype={areaStart:pn,areaEnd:pn,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:sf(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}};var Zx=(function e(t){function r(n){return new pd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function md(e,t){this._context=e,this._k=(1-t)/6}md.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:sf(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}};var Qx=(function e(t){function r(n){return new md(n,t)}return r.tension=function(n){return e(+n)},r})(0);function vu(e,t,r){var n=e._x1,o=e._y1,i=e._x2,a=e._y2;if(e._l01_a>Vx){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,f=3*e._l01_a*(e._l01_a+e._l12_a);n=(n*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/f,o=(o*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/f}if(e._l23_a>Vx){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-r*e._l12_2a)/c}e._context.bezierCurveTo(n,o,i,a,e._x2,e._y2)}function Kv(e,t){this._context=e,this._alpha=t}Kv.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:vu(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}};var Jx=(function e(t){function r(n){return t?new Kv(n,t):new ld(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function qv(e,t){this._context=e,this._alpha=t}qv.prototype={areaStart:pn,areaEnd:pn,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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:vu(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}};var eg=(function e(t){function r(n){return t?new qv(n,t):new pd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Hv(e,t){this._context=e,this._alpha=t}Hv.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:vu(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}};var tg=(function e(t){function r(n){return t?new Hv(n,t):new md(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function Yv(e){this._context=e}Yv.prototype={areaStart:pn,areaEnd:pn,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 rg(e){return new Yv(e)}function Wv(e){return e<0?-1:1}function Xv(e,t,r){var n=e._x1-e._x0,o=t-e._x1,i=(e._y1-e._y0)/(n||o<0&&-0),a=(r-e._y1)/(o||n<0&&-0),s=(i*o+a*n)/(n+o);return(Wv(i)+Wv(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function Zv(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ng(e,t,r){var n=e._x0,o=e._y0,i=e._x1,a=e._y1,s=(i-n)/3;e._context.bezierCurveTo(n+s,o+s*t,i-s,a-s*r,i,a)}function dd(e){this._context=e}dd.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:ng(this,this._t0,Zv(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 r=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,ng(this,Zv(this,r=Xv(this,e,t)),r);break;default:ng(this,this._t0,r=Xv(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Qv(e){this._context=new Jv(e)}(Qv.prototype=Object.create(dd.prototype)).point=function(e,t){dd.prototype.point.call(this,t,e)};function Jv(e){this._context=e}Jv.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,r,n,o,i){this._context.bezierCurveTo(t,e,n,r,i,o)}};function og(e){return new dd(e)}function ig(e){return new Qv(e)}function t6(e){this._context=e}t6.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=e6(e),o=e6(t),i=0,a=1;a=0;--t)o[t]=(a[t]-o[t+1])/i[t];for(i[r-1]=(e[r]+o[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function sg(e){return new hd(e,.5)}function fg(e){return new hd(e,0)}function cg(e){return new hd(e,1)}function Di(e,t,r){this.k=e,this.x=t,this.y=r}Di.prototype={constructor:Di,scale:function(e){return e===1?this:new Di(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Di(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ug=new Di(1,0,0);lg.prototype=Di.prototype;function lg(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ug;return e.__zoom}function mn(e){return e!=null&&!Number.isNaN(e)}function Or(e,t){return+mn(t)-+mn(e)||ct(e,t)}function ja(e,t){return+mn(t)-+mn(e)||tn(e,t)}function Tu(e){return e!=null&&`${e}`!=""}function pg(e){return isFinite(e)?e:NaN}function Ba(e){return e>0&&isFinite(e)?e:NaN}function ff(e){return e<0&&isFinite(e)?e:NaN}function yd(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return`${I9(e.getUTCFullYear(),4)}-${ri(e.getUTCMonth()+1,2)}-${ri(e.getUTCDate(),2)}${r||n||o||i?`T${ri(r,2)}:${ri(n,2)}${o||i?`:${ri(o,2)}${i?`.${ri(i,3)}`:""}`:""}Z`:""}`}function I9(e){return e<0?`-${ri(-e,6)}`:e>9999?`+${ri(e,6)}`:ri(e,4)}function ri(e,t){return`${e}`.padStart(t,"0")}var _9=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Mu(e,t){return _9.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function ni(e){if(e==null)return;let t=e[0],r=e[e.length-1];return tn(t,r)}var uf=1e3,Ui=uf*60,ji=Ui*60,xo=ji*24,yo=xo*7,Ga=xo*30,Vi=xo*365,mg=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",uf],["5 seconds",5*uf],["15 seconds",15*uf],["30 seconds",30*uf],["minute",Ui],["5 minutes",5*Ui],["15 minutes",15*Ui],["30 minutes",30*Ui],["hour",ji],["3 hours",3*ji],["6 hours",6*ji],["12 hours",12*ji],["day",xo],["2 days",2*xo],["week",yo],["2 weeks",2*yo],["month",Ga],["3 months",3*Ga],["6 months",6*Ga],["year",Vi],["2 years",2*Vi],["5 years",5*Vi],["10 years",10*Vi],["20 years",20*Vi],["50 years",50*Vi],["100 years",100*Vi]],dg=new Map([["second",uf],["minute",Ui],["hour",ji],["day",xo],["monday",yo],["tuesday",yo],["wednesday",yo],["thursday",yo],["friday",yo],["saturday",yo],["sunday",yo],["week",yo],["month",Ga],["year",Vi]]),n6=new Map([["second",$t],["minute",Wo],["hour",Zo],["day",cn],["monday",$i],["tuesday",Dp],["wednesday",Vp],["thursday",po],["friday",Up],["saturday",jp],["sunday",jr],["week",jr],["month",Jo],["year",sr]]),hg=new Map([["second",$t],["minute",Xo],["hour",Qo],["day",Ea],["monday",Li],["tuesday",Bp],["wednesday",Gp],["thursday",mo],["friday",zp],["saturday",Kp],["sunday",Br],["week",Br],["month",ei],["year",fr]]),lf=Symbol("intervalDuration"),gd=Symbol("intervalType");for(let[e,t]of n6)t[lf]=dg.get(e),t[gd]="time";for(let[e,t]of hg)t[lf]=dg.get(e),t[gd]="utc";var Ou=[["year",fr,"utc"],["month",ei,"utc"],["day",Ea,"utc",6*Ga],["hour",Qo,"utc",3*xo],["minute",Xo,"utc",6*ji],["second",$t,"utc",30*Ui]],xd=[["year",sr,"time"],["month",Jo,"time"],["day",cn,"time",6*Ga],["hour",Zo,"time",3*xo],["minute",Wo,"time",6*ji],["second",$t,"time",30*Ui]],v9=[Ou[0],xd[0],Ou[1],xd[1],Ou[2],xd[2],...Ou.slice(3)];function o6(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let o=hg.get(t);if(!o)throw new Error(`unknown interval: ${e}`);if(r>1&&!o.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function yg(e){return i6(o6(e),"time")}function xg(e){return i6(o6(e),"utc")}function i6([e,t],r){let n=(r==="time"?n6:hg).get(e);return t>1&&(n=n.every(t),n[lf]=dg.get(e)*t,n[gd]=r),n}function gg(e,t){if(!(t>1))return;let r=e[lf];if(!mg.some(([,o])=>o===r)||r%xo===0&&xoMath.log(o)).center(mg,Math.log(r*t))];return(e[gd]==="time"?yg:xg)(n)}function r6(e,t,r){let n=t==="time"?Js:ho;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o=T9(r);switch(e){case"millisecond":return cf(n(".%L"),n(":%M:%S"),o);case"second":return cf(n(":%S"),n("%-I:%M"),o);case"minute":return cf(n("%-I:%M"),n("%p"),o);case"hour":return cf(n("%-I %p"),n("%b %-d"),o);case"day":return cf(n("%-d"),n("%b"),o);case"month":return cf(n("%b"),n("%Y"),o);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function T9(e){return e==="left"||e==="right"?(t,r)=>` +var PC=Object.defineProperty;var Oa=(e,t)=>{for(var r in t)PC(e,r,{get:t[r],enumerable:!0})};var cr={};Oa(cr,{HasPropertyKey:()=>kl,IsArray:()=>vt,IsAsyncIterator:()=>S0,IsBigInt:()=>bf,IsBoolean:()=>Ho,IsDate:()=>Ca,IsFunction:()=>I0,IsIterator:()=>_0,IsNull:()=>v0,IsNumber:()=>zr,IsObject:()=>je,IsRegExp:()=>gf,IsString:()=>We,IsSymbol:()=>P0,IsUint8Array:()=>Yo,IsUndefined:()=>Pt});function kl(e,t){return t in e}function S0(e){return je(e)&&!vt(e)&&!Yo(e)&&Symbol.asyncIterator in e}function vt(e){return Array.isArray(e)}function bf(e){return typeof e=="bigint"}function Ho(e){return typeof e=="boolean"}function Ca(e){return e instanceof globalThis.Date}function I0(e){return typeof e=="function"}function _0(e){return je(e)&&!vt(e)&&!Yo(e)&&Symbol.iterator in e}function v0(e){return e===null}function zr(e){return typeof e=="number"}function je(e){return typeof e=="object"&&e!==null}function gf(e){return e instanceof globalThis.RegExp}function We(e){return typeof e=="string"}function P0(e){return typeof e=="symbol"}function Yo(e){return e instanceof globalThis.Uint8Array}function Pt(e){return e===void 0}function TC(e){return e.map(t=>Rl(t))}function MC(e){return new Date(e.getTime())}function OC(e){return new Uint8Array(e)}function CC(e){return new RegExp(e.source,e.flags)}function kC(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Rl(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Rl(e[r]);return t}function Rl(e){return vt(e)?TC(e):Ca(e)?MC(e):Yo(e)?OC(e):gf(e)?CC(e):je(e)?kC(e):e}function rt(e){return Rl(e)}function Os(e,t){return t===void 0?rt(e):rt({...t,...e})}function Nl(e){return ye(e)&&globalThis.Symbol.asyncIterator in e}function Al(e){return ye(e)&&globalThis.Symbol.iterator in e}function T0(e){return ye(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function El(e){return e instanceof globalThis.Promise}function xr(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function gw(e){return e instanceof globalThis.Map}function xw(e){return e instanceof globalThis.Set}function an(e){return globalThis.ArrayBuffer.isView(e)}function Cs(e){return e instanceof globalThis.Uint8Array}function ce(e,t){return t in e}function ye(e){return e!==null&&typeof e=="object"}function fe(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function nt(e){return e===void 0}function Wo(e){return e===null}function uo(e){return typeof e=="boolean"}function ot(e){return typeof e=="number"}function Fl(e){return globalThis.Number.isInteger(e)}function kn(e){return typeof e=="bigint"}function Ve(e){return typeof e=="string"}function Di(e){return typeof e=="function"}function Xo(e){return typeof e=="symbol"}function Gr(e){return kn(e)||uo(e)||Wo(e)||ot(e)||Ve(e)||Xo(e)||nt(e)}var kt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(a,s){return e.ExactOptionalPropertyTypes?s in a:a[s]!==void 0}e.IsExactOptionalProperty=t;function r(a){let s=ye(a);return e.AllowArrayObject?s:s&&!fe(a)}e.IsObjectLike=r;function n(a){return r(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=n;function o(a){return e.AllowNaN?ot(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=nt(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(kt||(kt={}));function RC(e){return globalThis.Object.freeze(e).map(t=>xf(t))}function NC(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=xf(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=xf(e[r]);return globalThis.Object.freeze(t)}function xf(e){return vt(e)?RC(e):Ca(e)?e:Yo(e)?e:gf(e)?e:je(e)?NC(e):e}function F(e,t){let r=t!==void 0?{...t,...e}:e;switch(kt.InstanceMode){case"freeze":return xf(r);case"clone":return rt(r);default:return r}}var le=class extends Error{constructor(t){super(t)}};var ct=Symbol.for("TypeBox.Transform"),Rn=Symbol.for("TypeBox.Readonly"),er=Symbol.for("TypeBox.Optional"),sn=Symbol.for("TypeBox.Hint"),$=Symbol.for("TypeBox.Kind");function ks(e){return je(e)&&e[Rn]==="Readonly"}function Or(e){return je(e)&&e[er]==="Optional"}function M0(e){return Pe(e,"Any")}function O0(e){return Pe(e,"Argument")}function Nn(e){return Pe(e,"Array")}function ka(e){return Pe(e,"AsyncIterator")}function Ra(e){return Pe(e,"BigInt")}function Zo(e){return Pe(e,"Boolean")}function An(e){return Pe(e,"Computed")}function En(e){return Pe(e,"Constructor")}function AC(e){return Pe(e,"Date")}function Fn(e){return Pe(e,"Function")}function $n(e){return Pe(e,"Integer")}function mt(e){return Pe(e,"Intersect")}function Na(e){return Pe(e,"Iterator")}function Pe(e,t){return je(e)&&$ in e&&e[$]===t}function $l(e){return Ho(e)||zr(e)||We(e)}function Kr(e){return Pe(e,"Literal")}function qr(e){return Pe(e,"MappedKey")}function at(e){return Pe(e,"MappedResult")}function Li(e){return Pe(e,"Never")}function EC(e){return Pe(e,"Not")}function wf(e){return Pe(e,"Null")}function Dn(e){return Pe(e,"Number")}function Tt(e){return Pe(e,"Object")}function Aa(e){return Pe(e,"Promise")}function Ea(e){return Pe(e,"Record")}function gt(e){return Pe(e,"Ref")}function C0(e){return Pe(e,"RegExp")}function Qo(e){return Pe(e,"String")}function Sf(e){return Pe(e,"Symbol")}function Hr(e){return Pe(e,"TemplateLiteral")}function FC(e){return Pe(e,"This")}function Ae(e){return je(e)&&ct in e}function Yr(e){return Pe(e,"Tuple")}function Jo(e){return Pe(e,"Undefined")}function Oe(e){return Pe(e,"Union")}function $C(e){return Pe(e,"Uint8Array")}function DC(e){return Pe(e,"Unknown")}function LC(e){return Pe(e,"Unsafe")}function VC(e){return Pe(e,"Void")}function Vi(e){return je(e)&&$ in e&&We(e[$])}function ft(e){return M0(e)||O0(e)||Nn(e)||Zo(e)||Ra(e)||ka(e)||An(e)||En(e)||AC(e)||Fn(e)||$n(e)||mt(e)||Na(e)||Kr(e)||qr(e)||at(e)||Li(e)||EC(e)||wf(e)||Dn(e)||Tt(e)||Aa(e)||Ea(e)||gt(e)||C0(e)||Qo(e)||Sf(e)||Hr(e)||FC(e)||Yr(e)||Jo(e)||Oe(e)||$C(e)||DC(e)||LC(e)||VC(e)||Vi(e)}var P={};Oa(P,{IsAny:()=>_w,IsArgument:()=>vw,IsArray:()=>Pw,IsAsyncIterator:()=>Tw,IsBigInt:()=>Mw,IsBoolean:()=>Ow,IsComputed:()=>Cw,IsConstructor:()=>kw,IsDate:()=>Rw,IsFunction:()=>Nw,IsImport:()=>KC,IsInteger:()=>Aw,IsIntersect:()=>Ew,IsIterator:()=>Fw,IsKind:()=>s2,IsKindOf:()=>Ie,IsLiteral:()=>_f,IsLiteralBoolean:()=>qC,IsLiteralNumber:()=>Dw,IsLiteralString:()=>$w,IsLiteralValue:()=>Lw,IsMappedKey:()=>Vw,IsMappedResult:()=>jw,IsNever:()=>Uw,IsNot:()=>Bw,IsNull:()=>zw,IsNumber:()=>Gw,IsObject:()=>Kw,IsOptional:()=>GC,IsPromise:()=>qw,IsProperties:()=>Dl,IsReadonly:()=>zC,IsRecord:()=>Hw,IsRecursive:()=>HC,IsRef:()=>Yw,IsRegExp:()=>Ww,IsSchema:()=>Vt,IsString:()=>Xw,IsSymbol:()=>Zw,IsTemplateLiteral:()=>Qw,IsThis:()=>Jw,IsTransform:()=>e2,IsTuple:()=>t2,IsUint8Array:()=>n2,IsUndefined:()=>r2,IsUnion:()=>A0,IsUnionLiteral:()=>YC,IsUnknown:()=>o2,IsUnsafe:()=>i2,IsVoid:()=>a2,TypeGuardUnknownTypeError:()=>k0});var k0=class extends le{},jC=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function ww(e){try{return new RegExp(e),!0}catch{return!1}}function R0(e){if(!We(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function Sw(e){return N0(e)||Vt(e)}function If(e){return Pt(e)||bf(e)}function Xe(e){return Pt(e)||zr(e)}function N0(e){return Pt(e)||Ho(e)}function Ue(e){return Pt(e)||We(e)}function UC(e){return Pt(e)||We(e)&&R0(e)&&ww(e)}function BC(e){return Pt(e)||We(e)&&R0(e)}function Iw(e){return Pt(e)||Vt(e)}function zC(e){return je(e)&&e[Rn]==="Readonly"}function GC(e){return je(e)&&e[er]==="Optional"}function _w(e){return Ie(e,"Any")&&Ue(e.$id)}function vw(e){return Ie(e,"Argument")&&zr(e.index)}function Pw(e){return Ie(e,"Array")&&e.type==="array"&&Ue(e.$id)&&Vt(e.items)&&Xe(e.minItems)&&Xe(e.maxItems)&&N0(e.uniqueItems)&&Iw(e.contains)&&Xe(e.minContains)&&Xe(e.maxContains)}function Tw(e){return Ie(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Ue(e.$id)&&Vt(e.items)}function Mw(e){return Ie(e,"BigInt")&&e.type==="bigint"&&Ue(e.$id)&&If(e.exclusiveMaximum)&&If(e.exclusiveMinimum)&&If(e.maximum)&&If(e.minimum)&&If(e.multipleOf)}function Ow(e){return Ie(e,"Boolean")&&e.type==="boolean"&&Ue(e.$id)}function Cw(e){return Ie(e,"Computed")&&We(e.target)&&vt(e.parameters)&&e.parameters.every(t=>Vt(t))}function kw(e){return Ie(e,"Constructor")&&e.type==="Constructor"&&Ue(e.$id)&&vt(e.parameters)&&e.parameters.every(t=>Vt(t))&&Vt(e.returns)}function Rw(e){return Ie(e,"Date")&&e.type==="Date"&&Ue(e.$id)&&Xe(e.exclusiveMaximumTimestamp)&&Xe(e.exclusiveMinimumTimestamp)&&Xe(e.maximumTimestamp)&&Xe(e.minimumTimestamp)&&Xe(e.multipleOfTimestamp)}function Nw(e){return Ie(e,"Function")&&e.type==="Function"&&Ue(e.$id)&&vt(e.parameters)&&e.parameters.every(t=>Vt(t))&&Vt(e.returns)}function KC(e){return Ie(e,"Import")&&kl(e,"$defs")&&je(e.$defs)&&Dl(e.$defs)&&kl(e,"$ref")&&We(e.$ref)&&e.$ref in e.$defs}function Aw(e){return Ie(e,"Integer")&&e.type==="integer"&&Ue(e.$id)&&Xe(e.exclusiveMaximum)&&Xe(e.exclusiveMinimum)&&Xe(e.maximum)&&Xe(e.minimum)&&Xe(e.multipleOf)}function Dl(e){return je(e)&&Object.entries(e).every(([t,r])=>R0(t)&&Vt(r))}function Ew(e){return Ie(e,"Intersect")&&!(We(e.type)&&e.type!=="object")&&vt(e.allOf)&&e.allOf.every(t=>Vt(t)&&!e2(t))&&Ue(e.type)&&(N0(e.unevaluatedProperties)||Iw(e.unevaluatedProperties))&&Ue(e.$id)}function Fw(e){return Ie(e,"Iterator")&&e.type==="Iterator"&&Ue(e.$id)&&Vt(e.items)}function Ie(e,t){return je(e)&&$ in e&&e[$]===t}function $w(e){return _f(e)&&We(e.const)}function Dw(e){return _f(e)&&zr(e.const)}function qC(e){return _f(e)&&Ho(e.const)}function _f(e){return Ie(e,"Literal")&&Ue(e.$id)&&Lw(e.const)}function Lw(e){return Ho(e)||zr(e)||We(e)}function Vw(e){return Ie(e,"MappedKey")&&vt(e.keys)&&e.keys.every(t=>zr(t)||We(t))}function jw(e){return Ie(e,"MappedResult")&&Dl(e.properties)}function Uw(e){return Ie(e,"Never")&&je(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Bw(e){return Ie(e,"Not")&&Vt(e.not)}function zw(e){return Ie(e,"Null")&&e.type==="null"&&Ue(e.$id)}function Gw(e){return Ie(e,"Number")&&e.type==="number"&&Ue(e.$id)&&Xe(e.exclusiveMaximum)&&Xe(e.exclusiveMinimum)&&Xe(e.maximum)&&Xe(e.minimum)&&Xe(e.multipleOf)}function Kw(e){return Ie(e,"Object")&&e.type==="object"&&Ue(e.$id)&&Dl(e.properties)&&Sw(e.additionalProperties)&&Xe(e.minProperties)&&Xe(e.maxProperties)}function qw(e){return Ie(e,"Promise")&&e.type==="Promise"&&Ue(e.$id)&&Vt(e.item)}function Hw(e){return Ie(e,"Record")&&e.type==="object"&&Ue(e.$id)&&Sw(e.additionalProperties)&&je(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&ww(r[0])&&je(t.patternProperties)&&Vt(t.patternProperties[r[0]])})(e)}function HC(e){return je(e)&&sn in e&&e[sn]==="Recursive"}function Yw(e){return Ie(e,"Ref")&&Ue(e.$id)&&We(e.$ref)}function Ww(e){return Ie(e,"RegExp")&&Ue(e.$id)&&We(e.source)&&We(e.flags)&&Xe(e.maxLength)&&Xe(e.minLength)}function Xw(e){return Ie(e,"String")&&e.type==="string"&&Ue(e.$id)&&Xe(e.minLength)&&Xe(e.maxLength)&&UC(e.pattern)&&BC(e.format)}function Zw(e){return Ie(e,"Symbol")&&e.type==="symbol"&&Ue(e.$id)}function Qw(e){return Ie(e,"TemplateLiteral")&&e.type==="string"&&We(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function Jw(e){return Ie(e,"This")&&Ue(e.$id)&&We(e.$ref)}function e2(e){return je(e)&&ct in e}function t2(e){return Ie(e,"Tuple")&&e.type==="array"&&Ue(e.$id)&&zr(e.minItems)&&zr(e.maxItems)&&e.minItems===e.maxItems&&(Pt(e.items)&&Pt(e.additionalItems)&&e.minItems===0||vt(e.items)&&e.items.every(t=>Vt(t)))}function r2(e){return Ie(e,"Undefined")&&e.type==="undefined"&&Ue(e.$id)}function YC(e){return A0(e)&&e.anyOf.every(t=>$w(t)||Dw(t))}function A0(e){return Ie(e,"Union")&&Ue(e.$id)&&je(e)&&vt(e.anyOf)&&e.anyOf.every(t=>Vt(t))}function n2(e){return Ie(e,"Uint8Array")&&e.type==="Uint8Array"&&Ue(e.$id)&&Xe(e.minByteLength)&&Xe(e.maxByteLength)}function o2(e){return Ie(e,"Unknown")&&Ue(e.$id)}function i2(e){return Ie(e,"Unsafe")}function a2(e){return Ie(e,"Void")&&e.type==="void"&&Ue(e.$id)}function s2(e){return je(e)&&$ in e&&We(e[$])&&!jC.includes(e[$])}function Vt(e){return je(e)&&(_w(e)||vw(e)||Pw(e)||Ow(e)||Mw(e)||Tw(e)||Cw(e)||kw(e)||Rw(e)||Nw(e)||Aw(e)||Ew(e)||Fw(e)||_f(e)||Vw(e)||jw(e)||Uw(e)||Bw(e)||zw(e)||Gw(e)||Kw(e)||qw(e)||Hw(e)||Yw(e)||Ww(e)||Xw(e)||Zw(e)||Qw(e)||Jw(e)||t2(e)||r2(e)||A0(e)||n2(e)||o2(e)||i2(e)||a2(e)||s2(e))}var E0="(true|false)",vf="(0|[1-9][0-9]*)",F0="(.*)",WC="(?!.*)",fB=`^${E0}$`,ji=`^${vf}$`,Ui=`^${F0}$`,c2=`^${WC}$`;var Bi={};Oa(Bi,{Clear:()=>ZC,Delete:()=>QC,Entries:()=>XC,Get:()=>t8,Has:()=>JC,Set:()=>e8});var Rs=new Map;function XC(){return new Map(Rs)}function ZC(){return Rs.clear()}function QC(e){return Rs.delete(e)}function JC(e){return Rs.has(e)}function e8(e,t){Rs.set(e,t)}function t8(e){return Rs.get(e)}var Ln={};Oa(Ln,{Clear:()=>n8,Delete:()=>o8,Entries:()=>r8,Get:()=>s8,Has:()=>i8,Set:()=>a8});var Ns=new Map;function r8(){return new Map(Ns)}function n8(){return Ns.clear()}function o8(e){return Ns.delete(e)}function i8(e){return Ns.has(e)}function a8(e,t){Ns.set(e,t)}function s8(e){return Ns.get(e)}function f2(e,t){return e.includes(t)}function u2(e){return[...new Set(e)]}function c8(e,t){return e.filter(r=>t.includes(r))}function f8(e,t){return e.reduce((r,n)=>c8(r,n),t)}function l2(e){return e.length===1?e[0]:e.length>1?f8(e.slice(1),e[0]):[]}function p2(e){let t=[];for(let r of e)t.push(...r);return t}function zi(e){return F({[$]:"Any"},e)}function As(e,t){return F({[$]:"Array",type:"array",items:e},t)}function m2(e){return F({[$]:"Argument",index:e})}function Es(e,t){return F({[$]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function Qe(e,t,r){return F({[$]:"Computed",target:e,parameters:t},r)}function u8(e,t){let{[t]:r,...n}=e;return n}function dt(e,t){return t.reduce((r,n)=>u8(r,n),e)}function Se(e){return F({[$]:"Never",not:{}},e)}function ke(e){return F({[$]:"MappedResult",properties:e})}function Fs(e,t,r){return F({[$]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function lo(e,t,r){return F({[$]:"Function",type:"Function",parameters:e,returns:t},r)}function Pf(e,t){return F({[$]:"Union",anyOf:e},t)}function l8(e){return e.some(t=>Or(t))}function d2(e){return e.map(t=>Or(t)?p8(t):t)}function p8(e){return dt(e,[er])}function m8(e,t){return l8(e)?fr(Pf(d2(e),t)):Pf(d2(e),t)}function po(e,t){return e.length===1?F(e[0],t):e.length===0?Se(t):m8(e,t)}function Ee(e,t){return e.length===0?Se(t):e.length===1?F(e[0],t):Pf(e,t)}var Ll=class extends le{};function d8(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function $0(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function ti(e,t){return $0(e,t,"(")}function Tf(e,t){return $0(e,t,")")}function h2(e,t){return $0(e,t,"|")}function h8(e){if(!(ti(e,0)&&Tf(e,e.length-1)))return!1;let t=0;for(let r=0;r0&&n.push($s(a)),r=i+1}let o=e.slice(r);return o.length>0&&n.push($s(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function w8(e){function t(o,i){if(!ti(o,i))throw new Ll("TemplateLiteralParser: Index must point to open parens");let a=0;for(let s=i;s0&&n.push($s(s)),o=a-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function $s(e){return h8(e)?$s(y8(e)):b8(e)?x8(e):g8(e)?w8(e):{type:"const",const:d8(e)}}function Ds(e){return $s(e.slice(1,e.length-1))}var D0=class extends le{};function S8(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function I8(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function _8(e){return e.type==="const"&&e.const===".*"}function Fa(e){return S8(e)||_8(e)?!1:I8(e)?!0:e.type==="and"?e.expr.every(t=>Fa(t)):e.type==="or"?e.expr.every(t=>Fa(t)):e.type==="const"?!0:(()=>{throw new D0("Unknown expression type")})()}function Vl(e){let t=Ds(e.pattern);return Fa(t)}var L0=class extends le{};function*y2(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of y2(e.slice(1)))yield`${t}${r}`}function*v8(e){return yield*y2(e.expr.map(t=>[...Mf(t)]))}function*P8(e){for(let t of e.expr)yield*Mf(t)}function*T8(e){return yield e.const}function*Mf(e){return e.type==="and"?yield*v8(e):e.type==="or"?yield*P8(e):e.type==="const"?yield*T8(e):(()=>{throw new L0("Unknown expression")})()}function Ls(e){let t=Ds(e.pattern);return Fa(t)?[...Mf(t)]:[]}function Te(e,t){return F({[$]:"Literal",const:e,type:typeof e},t)}function jl(e){return F({[$]:"Boolean",type:"boolean"},e)}function Vs(e){return F({[$]:"BigInt",type:"bigint"},e)}function cn(e){return F({[$]:"Number",type:"number"},e)}function wr(e){return F({[$]:"String",type:"string"},e)}function*M8(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield jl():t==="number"?yield cn():t==="bigint"?yield Vs():t==="string"?yield wr():yield(()=>{let r=t.split("|").map(n=>Te(n.trim()));return r.length===0?Se():r.length===1?r[0]:po(r)})()}function*O8(e){if(e[1]!=="{"){let t=Te("$"),r=V0(e.slice(1));return yield*[t,...r]}for(let t=2;tg2(r,t)).join("|")})`:Dn(e)?`${t}${vf}`:$n(e)?`${t}${vf}`:Ra(e)?`${t}${vf}`:Qo(e)?`${t}${F0}`:Kr(e)?`${t}${C8(e.const.toString())}`:Zo(e)?`${t}${E0}`:(()=>{throw new j0(`Unexpected Kind '${e[$]}'`)})()}function U0(e){return`^${e.map(t=>g2(t,"")).join("")}$`}function $a(e){let r=Ls(e).map(n=>Te(n));return po(r)}function Ul(e,t){let r=We(e)?U0(b2(e)):U0(e);return F({[$]:"TemplateLiteral",type:"string",pattern:r},t)}function k8(e){return Ls(e).map(r=>r.toString())}function R8(e){let t=[];for(let r of e)t.push(...Cr(r));return t}function N8(e){return[e.toString()]}function Cr(e){return[...new Set(Hr(e)?k8(e):Oe(e)?R8(e.anyOf):Kr(e)?N8(e.const):Dn(e)?["[number]"]:$n(e)?["[number]"]:[])]}function A8(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=Gi(e,Cr(t[o]),r);return n}function E8(e,t,r){return A8(e,t.properties,r)}function x2(e,t,r){let n=E8(e,t,r);return ke(n)}function S2(e,t){return e.map(r=>I2(r,t))}function F8(e){return e.filter(t=>!Li(t))}function $8(e,t){return Bl(F8(S2(e,t)))}function D8(e){return e.some(t=>Li(t))?[]:e}function L8(e,t){return po(D8(S2(e,t)))}function V8(e,t){return t in e?e[t]:t==="[number]"?po(e):Se()}function j8(e,t){return t==="[number]"?e:Se()}function U8(e,t){return t in e?e[t]:Se()}function I2(e,t){return mt(e)?$8(e.allOf,t):Oe(e)?L8(e.anyOf,t):Yr(e)?V8(e.items??[],t):Nn(e)?j8(e.items,t):Tt(e)?U8(e.properties,t):Se()}function Of(e,t){return t.map(r=>I2(e,r))}function w2(e,t){return po(Of(e,t))}function Gi(e,t,r){if(gt(e)||gt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!ft(e)||!ft(t))throw new le(n);return Qe("Index",[e,t])}return at(t)?x2(e,t,r):qr(t)?_2(e,t,r):F(ft(t)?w2(e,Cr(t)):w2(e,t),r)}function B8(e,t,r){return{[t]:Gi(e,[t],rt(r))}}function z8(e,t,r){return t.reduce((n,o)=>({...n,...B8(e,o,r)}),{})}function G8(e,t,r){return z8(e,t.keys,r)}function _2(e,t,r){let n=G8(e,t,r);return ke(n)}function js(e,t){return F({[$]:"Iterator",type:"Iterator",items:e},t)}function K8(e){return globalThis.Object.keys(e).filter(t=>!Or(e[t]))}function q8(e,t){let r=K8(e),n=r.length>0?{[$]:"Object",type:"object",required:r,properties:e}:{[$]:"Object",type:"object",properties:e};return F(n,t)}var Fe=q8;function zl(e,t){return F({[$]:"Promise",type:"Promise",item:e},t)}function H8(e){return F(dt(e,[Rn]))}function Y8(e){return F({...e,[Rn]:"Readonly"})}function W8(e,t){return t===!1?H8(e):Y8(e)}function kr(e,t){let r=t??!0;return at(e)?v2(e,r):W8(e,r)}function X8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=kr(e[n],t);return r}function Z8(e,t){return X8(e.properties,t)}function v2(e,t){let r=Z8(e,t);return ke(r)}function fn(e,t){return F(e.length>0?{[$]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[$]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function P2(e,t){return e in t?un(e,t[e]):ke(t)}function Q8(e){return{[e]:Te(e)}}function J8(e){let t={};for(let r of e)t[r]=Te(r);return t}function e5(e,t){return f2(t,e)?Q8(e):J8(t)}function t5(e,t){let r=e5(e,t);return P2(e,r)}function Cf(e,t){return t.map(r=>un(e,r))}function r5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=un(e,t[n]);return r}function un(e,t){let r={...t};return Or(t)?fr(un(e,dt(t,[er]))):ks(t)?kr(un(e,dt(t,[Rn]))):at(t)?P2(e,t.properties):qr(t)?t5(e,t.keys):En(t)?Fs(Cf(e,t.parameters),un(e,t.returns),r):Fn(t)?lo(Cf(e,t.parameters),un(e,t.returns),r):ka(t)?Es(un(e,t.items),r):Na(t)?js(un(e,t.items),r):mt(t)?ur(Cf(e,t.allOf),r):Oe(t)?Ee(Cf(e,t.anyOf),r):Yr(t)?fn(Cf(e,t.items??[]),r):Tt(t)?Fe(r5(e,t.properties),r):Nn(t)?As(un(e,t.items),r):Aa(t)?zl(un(e,t.item),r):t}function n5(e,t){let r={};for(let n of e)r[n]=un(n,t);return r}function T2(e,t,r){let n=ft(e)?Cr(e):e,o=t({[$]:"MappedKey",keys:n}),i=n5(n,o);return Fe(i,r)}function o5(e){return F(dt(e,[er]))}function i5(e){return F({...e,[er]:"Optional"})}function a5(e,t){return t===!1?o5(e):i5(e)}function fr(e,t){let r=t??!0;return at(e)?M2(e,r):a5(e,r)}function s5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=fr(e[n],t);return r}function c5(e,t){return s5(e.properties,t)}function M2(e,t){let r=c5(e,t);return ke(r)}function kf(e,t={}){let r=e.every(o=>Tt(o)),n=ft(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return F(t.unevaluatedProperties===!1||ft(t.unevaluatedProperties)||r?{...n,[$]:"Intersect",type:"object",allOf:e}:{...n,[$]:"Intersect",allOf:e},t)}function f5(e){return e.every(t=>Or(t))}function u5(e){return dt(e,[er])}function O2(e){return e.map(t=>Or(t)?u5(t):t)}function l5(e,t){return f5(e)?fr(kf(O2(e),t)):kf(O2(e),t)}function Bl(e,t={}){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ae(r)))throw new Error("Cannot intersect transform types");return l5(e,t)}function ur(e,t){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ae(r)))throw new Error("Cannot intersect transform types");return kf(e,t)}function mo(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new le("Ref: $ref must be a string");return F({[$]:"Ref",$ref:t},r)}function p5(e,t){return Qe("Awaited",[Qe(e,t)])}function m5(e){return Qe("Awaited",[mo(e)])}function d5(e){return ur(C2(e))}function h5(e){return Ee(C2(e))}function y5(e){return Us(e)}function C2(e){return e.map(t=>Us(t))}function Us(e,t){return F(An(e)?p5(e.target,e.parameters):mt(e)?d5(e.allOf):Oe(e)?h5(e.anyOf):Aa(e)?y5(e.item):gt(e)?m5(e.$ref):e,t)}function k2(e){let t=[];for(let r of e)t.push(Rr(r));return t}function b5(e){let t=k2(e);return p2(t)}function g5(e){let t=k2(e);return l2(t)}function x5(e){return e.map((t,r)=>r.toString())}function w5(e){return["[number]"]}function S5(e){return globalThis.Object.getOwnPropertyNames(e)}function I5(e){return B0?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Rr(e){return mt(e)?b5(e.allOf):Oe(e)?g5(e.anyOf):Yr(e)?x5(e.items??[]):Nn(e)?w5(e.items):Tt(e)?S5(e.properties):Ea(e)?I5(e.patternProperties):[]}var B0=!1;function Bs(e){B0=!0;let t=Rr(e);return B0=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function _5(e,t){return Qe("KeyOf",[Qe(e,t)])}function v5(e){return Qe("KeyOf",[mo(e)])}function P5(e,t){let r=Rr(e),n=T5(r),o=po(n);return F(o,t)}function T5(e){return e.map(t=>t==="[number]"?cn():Te(t))}function zs(e,t){return An(e)?_5(e.target,e.parameters):gt(e)?v5(e.$ref):at(e)?R2(e,t):P5(e,t)}function M5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=zs(e[n],rt(t));return r}function O5(e,t){return M5(e.properties,t)}function R2(e,t){let r=O5(e,t);return ke(r)}function Gl(e){let t=Rr(e),r=Of(e,t);return t.map((n,o)=>[t[o],r[o]])}function C5(e){let t=[];for(let r of e)t.push(...Rr(r));return u2(t)}function k5(e){return e.filter(t=>!Li(t))}function R5(e,t){let r=[];for(let n of e)r.push(...Of(n,[t]));return k5(r)}function N5(e,t){let r={};for(let n of t)r[n]=Bl(R5(e,n));return r}function N2(e,t){let r=C5(e),n=N5(e,r);return Fe(n,t)}function Kl(e){return F({[$]:"Date",type:"Date"},e)}function ql(e){return F({[$]:"Null",type:"null"},e)}function Hl(e){return F({[$]:"Symbol",type:"symbol"},e)}function Yl(e){return F({[$]:"Undefined",type:"undefined"},e)}function Wl(e){return F({[$]:"Uint8Array",type:"Uint8Array"},e)}function Vn(e){return F({[$]:"Unknown"},e)}function A5(e){return e.map(t=>z0(t,!1))}function E5(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=kr(z0(e[r],!1));return t}function Xl(e,t){return t===!0?e:kr(e)}function z0(e,t){return S0(e)?Xl(zi(),t):_0(e)?Xl(zi(),t):vt(e)?kr(fn(A5(e))):Yo(e)?Wl():Ca(e)?Kl():je(e)?Xl(Fe(E5(e)),t):I0(e)?Xl(lo([],Vn()),t):Pt(e)?Yl():v0(e)?ql():P0(e)?Hl():bf(e)?Vs():zr(e)?Te(e):Ho(e)?Te(e):We(e)?Te(e):Fe({})}function A2(e,t){return F(z0(e,!0),t)}function E2(e,t){return En(e)?fn(e.parameters,t):Se(t)}function F2(e,t){if(Pt(e))throw new Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter(i=>isNaN(i)).map(i=>e[i]),o=[...new Set(r)].map(i=>Te(i));return Ee(o,{...t,[sn]:"Enum"})}var K0=class extends le{},D;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(D||(D={}));function ln(e){return e===D.False?e:D.True}function Gs(e){throw new K0(e)}function Rt(e){return P.IsNever(e)||P.IsIntersect(e)||P.IsUnion(e)||P.IsUnknown(e)||P.IsAny(e)}function Nt(e,t){return P.IsNever(t)?B2(e,t):P.IsIntersect(t)?Zl(e,t):P.IsUnion(t)?W0(e,t):P.IsUnknown(t)?q2(e,t):P.IsAny(t)?Y0(e,t):Gs("StructuralRight")}function Y0(e,t){return D.True}function F5(e,t){return P.IsIntersect(t)?Zl(e,t):P.IsUnion(t)&&t.anyOf.some(r=>P.IsAny(r)||P.IsUnknown(r))?D.True:P.IsUnion(t)?D.Union:P.IsUnknown(t)||P.IsAny(t)?D.True:D.Union}function $5(e,t){return P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:P.IsNever(e)?D.True:D.False}function D5(e,t){return P.IsObject(t)&&Ql(t)?D.True:Rt(t)?Nt(e,t):P.IsArray(t)?ln(Be(e.items,t.items)):D.False}function L5(e,t){return Rt(t)?Nt(e,t):P.IsAsyncIterator(t)?ln(Be(e.items,t.items)):D.False}function V5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsBigInt(t)?D.True:D.False}function j2(e,t){return P.IsLiteralBoolean(e)||P.IsBoolean(e)?D.True:D.False}function j5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsBoolean(t)?D.True:D.False}function U5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsConstructor(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>ln(Be(t.parameters[n],r))===D.True)?ln(Be(e.returns,t.returns)):D.False:D.False}function B5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsDate(t)?D.True:D.False}function z5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsFunction(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>ln(Be(t.parameters[n],r))===D.True)?ln(Be(e.returns,t.returns)):D.False:D.False}function U2(e,t){return P.IsLiteral(e)&&cr.IsNumber(e.const)||P.IsNumber(e)||P.IsInteger(e)?D.True:D.False}function G5(e,t){return P.IsInteger(t)||P.IsNumber(t)?D.True:Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):D.False}function Zl(e,t){return t.allOf.every(r=>Be(e,r)===D.True)?D.True:D.False}function K5(e,t){return e.allOf.some(r=>Be(r,t)===D.True)?D.True:D.False}function q5(e,t){return Rt(t)?Nt(e,t):P.IsIterator(t)?ln(Be(e.items,t.items)):D.False}function H5(e,t){return P.IsLiteral(t)&&t.const===e.const?D.True:Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsString(t)?K2(e,t):P.IsNumber(t)?z2(e,t):P.IsInteger(t)?U2(e,t):P.IsBoolean(t)?j2(e,t):D.False}function B2(e,t){return D.False}function Y5(e,t){return D.True}function $2(e){let[t,r]=[e,0];for(;P.IsNot(t);)t=t.not,r+=1;return r%2===0?t:Vn()}function W5(e,t){return P.IsNot(e)?Be($2(e),t):P.IsNot(t)?Be(e,$2(t)):Gs("Invalid fallthrough for Not")}function X5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsNull(t)?D.True:D.False}function z2(e,t){return P.IsLiteralNumber(e)||P.IsNumber(e)||P.IsInteger(e)?D.True:D.False}function Z5(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsInteger(t)||P.IsNumber(t)?D.True:D.False}function Nr(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function D2(e){return Ql(e)}function L2(e){return Nr(e,0)||Nr(e,1)&&"description"in e.properties&&P.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(P.IsString(e.properties.description.anyOf[0])&&P.IsUndefined(e.properties.description.anyOf[1])||P.IsString(e.properties.description.anyOf[1])&&P.IsUndefined(e.properties.description.anyOf[0]))}function G0(e){return Nr(e,0)}function V2(e){return Nr(e,0)}function Q5(e){return Nr(e,0)}function J5(e){return Nr(e,0)}function e3(e){return Ql(e)}function t3(e){let t=cn();return Nr(e,0)||Nr(e,1)&&"length"in e.properties&&ln(Be(e.properties.length,t))===D.True}function r3(e){return Nr(e,0)}function Ql(e){let t=cn();return Nr(e,0)||Nr(e,1)&&"length"in e.properties&&ln(Be(e.properties.length,t))===D.True}function n3(e){let t=lo([zi()],zi());return Nr(e,0)||Nr(e,1)&&"then"in e.properties&&ln(Be(e.properties.then,t))===D.True}function G2(e,t){return Be(e,t)===D.False||P.IsOptional(e)&&!P.IsOptional(t)?D.False:D.True}function lr(e,t){return P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:P.IsNever(e)||P.IsLiteralString(e)&&D2(t)||P.IsLiteralNumber(e)&&G0(t)||P.IsLiteralBoolean(e)&&V2(t)||P.IsSymbol(e)&&L2(t)||P.IsBigInt(e)&&Q5(t)||P.IsString(e)&&D2(t)||P.IsSymbol(e)&&L2(t)||P.IsNumber(e)&&G0(t)||P.IsInteger(e)&&G0(t)||P.IsBoolean(e)&&V2(t)||P.IsUint8Array(e)&&e3(t)||P.IsDate(e)&&J5(t)||P.IsConstructor(e)&&r3(t)||P.IsFunction(e)&&t3(t)?D.True:P.IsRecord(e)&&P.IsString(q0(e))?t[sn]==="Record"?D.True:D.False:P.IsRecord(e)&&P.IsNumber(q0(e))?Nr(t,0)?D.True:D.False:D.False}function o3(e,t){return Rt(t)?Nt(e,t):P.IsRecord(t)?pn(e,t):P.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!P.IsOptional(t.properties[r]))return D.False;if(P.IsOptional(t.properties[r]))return D.True;if(G2(e.properties[r],t.properties[r])===D.False)return D.False}return D.True})():D.False}function i3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)&&n3(t)?D.True:P.IsPromise(t)?ln(Be(e.item,t.item)):D.False}function q0(e){return ji in e.patternProperties?cn():Ui in e.patternProperties?wr():Gs("Unknown record key pattern")}function H0(e){return ji in e.patternProperties?e.patternProperties[ji]:Ui in e.patternProperties?e.patternProperties[Ui]:Gs("Unable to get record value schema")}function pn(e,t){let[r,n]=[q0(t),H0(t)];return P.IsLiteralString(e)&&P.IsNumber(r)&&ln(Be(e,n))===D.True?D.True:P.IsUint8Array(e)&&P.IsNumber(r)||P.IsString(e)&&P.IsNumber(r)||P.IsArray(e)&&P.IsNumber(r)?Be(e,n):P.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(G2(n,e.properties[o])===D.False)return D.False;return D.True})():D.False}function a3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?Be(H0(e),H0(t)):D.False}function s3(e,t){let r=P.IsRegExp(e)?wr():e,n=P.IsRegExp(t)?wr():t;return Be(r,n)}function K2(e,t){return P.IsLiteral(e)&&cr.IsString(e.const)||P.IsString(e)?D.True:D.False}function c3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsString(t)?D.True:D.False}function f3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsSymbol(t)?D.True:D.False}function u3(e,t){return P.IsTemplateLiteral(e)?Be($a(e),t):P.IsTemplateLiteral(t)?Be(e,$a(t)):Gs("Invalid fallthrough for TemplateLiteral")}function l3(e,t){return P.IsArray(t)&&e.items!==void 0&&e.items.every(r=>Be(r,t.items)===D.True)}function p3(e,t){return P.IsNever(e)?D.True:P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:D.False}function m3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)&&Ql(t)||P.IsArray(t)&&l3(e,t)?D.True:P.IsTuple(t)?cr.IsUndefined(e.items)&&!cr.IsUndefined(t.items)||!cr.IsUndefined(e.items)&&cr.IsUndefined(t.items)?D.False:cr.IsUndefined(e.items)&&!cr.IsUndefined(t.items)||e.items.every((r,n)=>Be(r,t.items[n])===D.True)?D.True:D.False:D.False}function d3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsUint8Array(t)?D.True:D.False}function h3(e,t){return Rt(t)?Nt(e,t):P.IsObject(t)?lr(e,t):P.IsRecord(t)?pn(e,t):P.IsVoid(t)?g3(e,t):P.IsUndefined(t)?D.True:D.False}function W0(e,t){return t.anyOf.some(r=>Be(e,r)===D.True)?D.True:D.False}function y3(e,t){return e.anyOf.every(r=>Be(r,t)===D.True)?D.True:D.False}function q2(e,t){return D.True}function b3(e,t){return P.IsNever(t)?B2(e,t):P.IsIntersect(t)?Zl(e,t):P.IsUnion(t)?W0(e,t):P.IsAny(t)?Y0(e,t):P.IsString(t)?K2(e,t):P.IsNumber(t)?z2(e,t):P.IsInteger(t)?U2(e,t):P.IsBoolean(t)?j2(e,t):P.IsArray(t)?$5(e,t):P.IsTuple(t)?p3(e,t):P.IsObject(t)?lr(e,t):P.IsUnknown(t)?D.True:D.False}function g3(e,t){return P.IsUndefined(e)||P.IsUndefined(e)?D.True:D.False}function x3(e,t){return P.IsIntersect(t)?Zl(e,t):P.IsUnion(t)?W0(e,t):P.IsUnknown(t)?q2(e,t):P.IsAny(t)?Y0(e,t):P.IsObject(t)?lr(e,t):P.IsVoid(t)?D.True:D.False}function Be(e,t){return P.IsTemplateLiteral(e)||P.IsTemplateLiteral(t)?u3(e,t):P.IsRegExp(e)||P.IsRegExp(t)?s3(e,t):P.IsNot(e)||P.IsNot(t)?W5(e,t):P.IsAny(e)?F5(e,t):P.IsArray(e)?D5(e,t):P.IsBigInt(e)?V5(e,t):P.IsBoolean(e)?j5(e,t):P.IsAsyncIterator(e)?L5(e,t):P.IsConstructor(e)?U5(e,t):P.IsDate(e)?B5(e,t):P.IsFunction(e)?z5(e,t):P.IsInteger(e)?G5(e,t):P.IsIntersect(e)?K5(e,t):P.IsIterator(e)?q5(e,t):P.IsLiteral(e)?H5(e,t):P.IsNever(e)?Y5(e,t):P.IsNull(e)?X5(e,t):P.IsNumber(e)?Z5(e,t):P.IsObject(e)?o3(e,t):P.IsRecord(e)?a3(e,t):P.IsString(e)?c3(e,t):P.IsSymbol(e)?f3(e,t):P.IsTuple(e)?m3(e,t):P.IsPromise(e)?i3(e,t):P.IsUint8Array(e)?d3(e,t):P.IsUndefined(e)?h3(e,t):P.IsUnion(e)?y3(e,t):P.IsUnknown(e)?b3(e,t):P.IsVoid(e)?x3(e,t):Gs(`Unknown left type operand '${e[$]}'`)}function Ki(e,t){return Be(e,t)}function w3(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=Ks(e[a],t,r,n,rt(o));return i}function S3(e,t,r,n,o){return w3(e.properties,t,r,n,o)}function H2(e,t,r,n,o){let i=S3(e,t,r,n,o);return ke(i)}function I3(e,t,r,n){let o=Ki(e,t);return o===D.Union?Ee([r,n]):o===D.True?r:n}function Ks(e,t,r,n,o){return at(e)?H2(e,t,r,n,o):qr(e)?F(Y2(e,t,r,n,o)):F(I3(e,t,r,n),o)}function _3(e,t,r,n,o){return{[e]:Ks(Te(e),t,r,n,rt(o))}}function v3(e,t,r,n,o){return e.reduce((i,a)=>({...i,..._3(a,t,r,n,o)}),{})}function P3(e,t,r,n,o){return v3(e.keys,t,r,n,o)}function Y2(e,t,r,n,o){let i=P3(e,t,r,n,o);return ke(i)}function T3(e){return e.allOf.every(t=>Da(t))}function M3(e){return e.anyOf.some(t=>Da(t))}function O3(e){return!Da(e.not)}function Da(e){return e[$]==="Intersect"?T3(e):e[$]==="Union"?M3(e):e[$]==="Not"?O3(e):e[$]==="Undefined"}function W2(e,t){return qs($a(e),t)}function C3(e,t){let r=e.filter(n=>Ki(n,t)===D.False);return r.length===1?r[0]:Ee(r)}function qs(e,t,r={}){return Hr(e)?F(W2(e,t),r):at(e)?F(X2(e,t),r):F(Oe(e)?C3(e.anyOf,t):Ki(e,t)!==D.False?Se():e,r)}function k3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=qs(e[n],t);return r}function R3(e,t){return k3(e.properties,t)}function X2(e,t){let r=R3(e,t);return ke(r)}function Z2(e,t){return Hs($a(e),t)}function N3(e,t){let r=e.filter(n=>Ki(n,t)!==D.False);return r.length===1?r[0]:Ee(r)}function Hs(e,t,r){return Hr(e)?F(Z2(e,t),r):at(e)?F(Q2(e,t),r):F(Oe(e)?N3(e.anyOf,t):Ki(e,t)!==D.False?e:Se(),r)}function A3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Hs(e[n],t);return r}function E3(e,t){return A3(e.properties,t)}function Q2(e,t){let r=E3(e,t);return ke(r)}function J2(e,t){return En(e)?F(e.returns,t):Se(t)}function Jl(e){return kr(fr(e))}function La(e,t,r){return F({[$]:"Record",type:"object",patternProperties:{[e]:t}},r)}function X0(e,t,r){let n={};for(let o of e)n[o]=t;return Fe(n,{...r,[sn]:"Record"})}function F3(e,t,r){return Vl(e)?X0(Cr(e),t,r):La(e.pattern,t,r)}function $3(e,t,r){return X0(Cr(Ee(e)),t,r)}function D3(e,t,r){return X0([e.toString()],t,r)}function L3(e,t,r){return La(e.source,t,r)}function V3(e,t,r){let n=Pt(e.pattern)?Ui:e.pattern;return La(n,t,r)}function j3(e,t,r){return La(Ui,t,r)}function U3(e,t,r){return La(c2,t,r)}function B3(e,t,r){return Fe({true:t,false:t},r)}function z3(e,t,r){return La(ji,t,r)}function G3(e,t,r){return La(ji,t,r)}function ep(e,t,r={}){return Oe(e)?$3(e.anyOf,t,r):Hr(e)?F3(e,t,r):Kr(e)?D3(e.const,t,r):Zo(e)?B3(e,t,r):$n(e)?z3(e,t,r):Dn(e)?G3(e,t,r):C0(e)?L3(e,t,r):Qo(e)?V3(e,t,r):M0(e)?j3(e,t,r):Li(e)?U3(e,t,r):Se(r)}function tp(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function eS(e){let t=tp(e);return t===Ui?wr():t===ji?cn():wr({pattern:t})}function rp(e){return e.patternProperties[tp(e)]}function K3(e,t){return t.parameters=Rf(e,t.parameters),t.returns=jn(e,t.returns),t}function q3(e,t){return t.parameters=Rf(e,t.parameters),t.returns=jn(e,t.returns),t}function H3(e,t){return t.allOf=Rf(e,t.allOf),t}function Y3(e,t){return t.anyOf=Rf(e,t.anyOf),t}function W3(e,t){return Pt(t.items)||(t.items=Rf(e,t.items)),t}function X3(e,t){return t.items=jn(e,t.items),t}function Z3(e,t){return t.items=jn(e,t.items),t}function Q3(e,t){return t.items=jn(e,t.items),t}function J3(e,t){return t.item=jn(e,t.item),t}function ek(e,t){let r=ok(e,t.properties);return{...t,...Fe(r)}}function tk(e,t){let r=jn(e,eS(t)),n=jn(e,rp(t)),o=ep(r,n);return{...t,...o}}function rk(e,t){return t.index in e?e[t.index]:Vn()}function nk(e,t){let r=ks(t),n=Or(t),o=jn(e,t);return r&&n?Jl(o):r&&!n?kr(o):!r&&n?fr(o):o}function ok(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:nk(e,t[n])}),{})}function Rf(e,t){return t.map(r=>jn(e,r))}function jn(e,t){return En(t)?K3(e,t):Fn(t)?q3(e,t):mt(t)?H3(e,t):Oe(t)?Y3(e,t):Yr(t)?W3(e,t):Nn(t)?X3(e,t):ka(t)?Z3(e,t):Na(t)?Q3(e,t):Aa(t)?J3(e,t):Tt(t)?ek(e,t):Ea(t)?tk(e,t):O0(t)?rk(e,t):t}function tS(e,t){return jn(t,Os(e))}function rS(e){return F({[$]:"Integer",type:"integer"},e)}function ik(e,t,r){return{[e]:Un(Te(e),t,rt(r))}}function ak(e,t,r){return e.reduce((o,i)=>({...o,...ik(i,t,r)}),{})}function sk(e,t,r){return ak(e.keys,t,r)}function nS(e,t,r){let n=sk(e,t,r);return ke(n)}function ck(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function fk(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function uk(e){return e.toUpperCase()}function lk(e){return e.toLowerCase()}function pk(e,t,r){let n=Ds(e.pattern);if(!Fa(n))return{...e,pattern:oS(e.pattern,t)};let a=[...Mf(n)].map(u=>Te(u)),s=iS(a,t),c=Ee(s);return Ul([c],r)}function oS(e,t){return typeof e=="string"?t==="Uncapitalize"?ck(e):t==="Capitalize"?fk(e):t==="Uppercase"?uk(e):t==="Lowercase"?lk(e):e:e.toString()}function iS(e,t){return e.map(r=>Un(r,t))}function Un(e,t,r={}){return qr(e)?nS(e,t,r):Hr(e)?pk(e,t,r):Oe(e)?Ee(iS(e.anyOf,t),r):Kr(e)?Te(oS(e.const,t),r):F(e,r)}function aS(e,t={}){return Un(e,"Capitalize",t)}function sS(e,t={}){return Un(e,"Lowercase",t)}function cS(e,t={}){return Un(e,"Uncapitalize",t)}function fS(e,t={}){return Un(e,"Uppercase",t)}function mk(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=qi(e[o],t,rt(r));return n}function dk(e,t,r){return mk(e.properties,t,r)}function uS(e,t,r){let n=dk(e,t,r);return ke(n)}function hk(e,t){return e.map(r=>Z0(r,t))}function yk(e,t){return e.map(r=>Z0(r,t))}function bk(e,t){let{[t]:r,...n}=e;return n}function gk(e,t){return t.reduce((r,n)=>bk(r,n),e)}function xk(e,t,r){let n=dt(e,[ct,"$id","required","properties"]),o=gk(r,t);return Fe(o,n)}function wk(e){let t=e.reduce((r,n)=>$l(n)?[...r,Te(n)]:r,[]);return Ee(t)}function Z0(e,t){return mt(e)?ur(hk(e.allOf,t)):Oe(e)?Ee(yk(e.anyOf,t)):Tt(e)?xk(e,t,e.properties):Fe({})}function qi(e,t,r){let n=vt(t)?wk(t):t,o=ft(t)?Cr(t):t,i=gt(e),a=gt(t);return at(e)?uS(e,o,r):qr(t)?lS(e,t,r):i&&a?Qe("Omit",[e,n],r):!i&&a?Qe("Omit",[e,n],r):i&&!a?Qe("Omit",[e,n],r):F({...Z0(e,o),...r})}function Sk(e,t,r){return{[t]:qi(e,[t],rt(r))}}function Ik(e,t,r){return t.reduce((n,o)=>({...n,...Sk(e,o,r)}),{})}function _k(e,t,r){return Ik(e,t.keys,r)}function lS(e,t,r){let n=_k(e,t,r);return ke(n)}function vk(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Hi(e[o],t,rt(r));return n}function Pk(e,t,r){return vk(e.properties,t,r)}function pS(e,t,r){let n=Pk(e,t,r);return ke(n)}function Tk(e,t){return e.map(r=>Q0(r,t))}function Mk(e,t){return e.map(r=>Q0(r,t))}function Ok(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function Ck(e,t,r){let n=dt(e,[ct,"$id","required","properties"]),o=Ok(r,t);return Fe(o,n)}function kk(e){let t=e.reduce((r,n)=>$l(n)?[...r,Te(n)]:r,[]);return Ee(t)}function Q0(e,t){return mt(e)?ur(Tk(e.allOf,t)):Oe(e)?Ee(Mk(e.anyOf,t)):Tt(e)?Ck(e,t,e.properties):Fe({})}function Hi(e,t,r){let n=vt(t)?kk(t):t,o=ft(t)?Cr(t):t,i=gt(e),a=gt(t);return at(e)?pS(e,o,r):qr(t)?mS(e,t,r):i&&a?Qe("Pick",[e,n],r):!i&&a?Qe("Pick",[e,n],r):i&&!a?Qe("Pick",[e,n],r):F({...Q0(e,o),...r})}function Rk(e,t,r){return{[t]:Hi(e,[t],rt(r))}}function Nk(e,t,r){return t.reduce((n,o)=>({...n,...Rk(e,o,r)}),{})}function Ak(e,t,r){return Nk(e,t.keys,r)}function mS(e,t,r){let n=Ak(e,t,r);return ke(n)}function Ek(e,t){return Qe("Partial",[Qe(e,t)])}function Fk(e){return Qe("Partial",[mo(e)])}function $k(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=fr(e[r]);return t}function Dk(e,t){let r=dt(e,[ct,"$id","required","properties"]),n=$k(t);return Fe(n,r)}function dS(e){return e.map(t=>hS(t))}function hS(e){return An(e)?Ek(e.target,e.parameters):gt(e)?Fk(e.$ref):mt(e)?ur(dS(e.allOf)):Oe(e)?Ee(dS(e.anyOf)):Tt(e)?Dk(e,e.properties):Ra(e)||Zo(e)||$n(e)||Kr(e)||wf(e)||Dn(e)||Qo(e)||Sf(e)||Jo(e)?e:Fe({})}function Ys(e,t){return at(e)?yS(e,t):F({...hS(e),...t})}function Lk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ys(e[n],rt(t));return r}function Vk(e,t){return Lk(e.properties,t)}function yS(e,t){let r=Vk(e,t);return ke(r)}function jk(e,t){return Qe("Required",[Qe(e,t)])}function Uk(e){return Qe("Required",[mo(e)])}function Bk(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=dt(e[r],[er]);return t}function zk(e,t){let r=dt(e,[ct,"$id","required","properties"]),n=Bk(t);return Fe(n,r)}function bS(e){return e.map(t=>gS(t))}function gS(e){return An(e)?jk(e.target,e.parameters):gt(e)?Uk(e.$ref):mt(e)?ur(bS(e.allOf)):Oe(e)?Ee(bS(e.anyOf)):Tt(e)?zk(e,e.properties):Ra(e)||Zo(e)||$n(e)||Kr(e)||wf(e)||Dn(e)||Qo(e)||Sf(e)||Jo(e)?e:Fe({})}function Ws(e,t){return at(e)?xS(e,t):F({...gS(e),...t})}function Gk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ws(e[n],t);return r}function Kk(e,t){return Gk(e.properties,t)}function xS(e,t){let r=Kk(e,t);return ke(r)}function qk(e,t){return t.map(r=>gt(r)?J0(e,r.$ref):Wr(e,r))}function J0(e,t){return t in e?gt(e[t])?J0(e,e[t].$ref):Wr(e,e[t]):Se()}function Hk(e){return Us(e[0])}function Yk(e){return Gi(e[0],e[1])}function Wk(e){return zs(e[0])}function Xk(e){return Ys(e[0])}function Zk(e){return qi(e[0],e[1])}function Qk(e){return Hi(e[0],e[1])}function Jk(e){return Ws(e[0])}function eR(e,t,r){let n=qk(e,r);return t==="Awaited"?Hk(n):t==="Index"?Yk(n):t==="KeyOf"?Wk(n):t==="Partial"?Xk(n):t==="Omit"?Zk(n):t==="Pick"?Qk(n):t==="Required"?Jk(n):Se()}function tR(e,t){return As(Wr(e,t))}function rR(e,t){return Es(Wr(e,t))}function nR(e,t,r){return Fs(Nf(e,t),Wr(e,r))}function oR(e,t,r){return lo(Nf(e,t),Wr(e,r))}function iR(e,t){return ur(Nf(e,t))}function aR(e,t){return js(Wr(e,t))}function sR(e,t){return Fe(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:Wr(e,t[n])}),{}))}function cR(e,t){let[r,n]=[Wr(e,rp(t)),tp(t)],o=Os(t);return o.patternProperties[n]=r,o}function fR(e,t){return gt(t)?{...J0(e,t.$ref),[ct]:t[ct]}:t}function uR(e,t){return fn(Nf(e,t))}function lR(e,t){return Ee(Nf(e,t))}function Nf(e,t){return t.map(r=>Wr(e,r))}function Wr(e,t){return Or(t)?F(Wr(e,dt(t,[er])),t):ks(t)?F(Wr(e,dt(t,[Rn])),t):Ae(t)?F(fR(e,t),t):Nn(t)?F(tR(e,t.items),t):ka(t)?F(rR(e,t.items),t):An(t)?F(eR(e,t.target,t.parameters)):En(t)?F(nR(e,t.parameters,t.returns),t):Fn(t)?F(oR(e,t.parameters,t.returns),t):mt(t)?F(iR(e,t.allOf),t):Na(t)?F(aR(e,t.items),t):Tt(t)?F(sR(e,t.properties),t):Ea(t)?F(cR(e,t)):Yr(t)?F(uR(e,t.items||[]),t):Oe(t)?F(lR(e,t.anyOf),t):t}function pR(e,t){return t in e?Wr(e,e[t]):Se()}function wS(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:pR(e,r)}),{})}var ey=class{constructor(t){let r=wS(t),n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){let n={...this.$defs,[t]:F(this.$defs[t],r)};return F({[$]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:{...t[n],$id:n}}),{})}};function SS(e){return new ey(e)}function IS(e,t){return F({[$]:"Not",not:e},t)}function _S(e,t){return Fn(e)?fn(e.parameters,t):Se()}var mR=0;function vS(e,t={}){Pt(t.$id)&&(t.$id=`T${mR++}`);let r=Os(e({[$]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,F({[sn]:"Recursive",...r},t)}function PS(e,t){let r=We(e)?new globalThis.RegExp(e):e;return F({[$]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function dR(e){return mt(e)?e.allOf:Oe(e)?e.anyOf:Yr(e)?e.items??[]:[]}function TS(e){return dR(e)}function MS(e,t){return Fn(e)?F(e.returns,t):Se(t)}var ty=class{constructor(t){this.schema=t}Decode(t){return new ry(this.schema,t)}},ry=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[ct].Encode(t(a)),Decode:a=>this.decode(r[ct].Decode(a))};return{...r,[ct]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[ct]:n}}Encode(t){return Ae(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function OS(e){return new ty(e)}function CS(e={}){return F({[$]:e[$]??"Unsafe"},e)}function kS(e){return F({[$]:"Void",type:"void"},e)}var ny={};Oa(ny,{Any:()=>zi,Argument:()=>m2,Array:()=>As,AsyncIterator:()=>Es,Awaited:()=>Us,BigInt:()=>Vs,Boolean:()=>jl,Capitalize:()=>aS,Composite:()=>N2,Const:()=>A2,Constructor:()=>Fs,ConstructorParameters:()=>E2,Date:()=>Kl,Enum:()=>F2,Exclude:()=>qs,Extends:()=>Ks,Extract:()=>Hs,Function:()=>lo,Index:()=>Gi,InstanceType:()=>J2,Instantiate:()=>tS,Integer:()=>rS,Intersect:()=>ur,Iterator:()=>js,KeyOf:()=>zs,Literal:()=>Te,Lowercase:()=>sS,Mapped:()=>T2,Module:()=>SS,Never:()=>Se,Not:()=>IS,Null:()=>ql,Number:()=>cn,Object:()=>Fe,Omit:()=>qi,Optional:()=>fr,Parameters:()=>_S,Partial:()=>Ys,Pick:()=>Hi,Promise:()=>zl,Readonly:()=>kr,ReadonlyOptional:()=>Jl,Record:()=>ep,Recursive:()=>vS,Ref:()=>mo,RegExp:()=>PS,Required:()=>Ws,Rest:()=>TS,ReturnType:()=>MS,String:()=>wr,Symbol:()=>Hl,TemplateLiteral:()=>Ul,Transform:()=>OS,Tuple:()=>fn,Uint8Array:()=>Wl,Uncapitalize:()=>cS,Undefined:()=>Yl,Union:()=>Ee,Unknown:()=>Vn,Unsafe:()=>CS,Uppercase:()=>fS,Void:()=>kS});var d=ny;var Bn=d.Object({label:d.String(),domain:d.Optional(d.Tuple([d.Number(),d.Number()]))}),Af=d.Object({type:d.Union([d.Literal("identity"),d.Literal("horizontal"),d.Literal("vertical")]),value:d.Optional(d.Number())}),kQ=d.Object({schemaVersion:d.Literal("1.0"),title:d.Optional(d.String()),xAxis:Bn,yAxis:Bn,references:d.Optional(d.Array(Af))});var hR=d.Object({model:d.String(),population:d.Optional(d.String()),horizon:d.Optional(d.Number()),predicted:d.Number({minimum:0,maximum:1}),observed:d.Number({minimum:0,maximum:1}),method:d.Union([d.Literal("discrete"),d.Literal("smooth")]),events:d.Optional(d.Number({minimum:0})),total:d.Optional(d.Number({minimum:0}))}),yR=d.Object({model:d.String(),population:d.Optional(d.String()),horizon:d.Optional(d.Number()),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),oy=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("calibration"),data:d.Array(hR),distribution:d.Optional(d.Array(yR)),x:d.Literal("predicted"),y:d.Literal("observed"),xAxis:Bn,yAxis:Bn,references:d.Optional(d.Array(Af))});var bR=d.Object({model:d.String(),population:d.Optional(d.String()),horizon:d.Optional(d.Number()),cutoff:d.Number(),sensitivity:d.Number({minimum:0,maximum:1}),specificity:d.Number({minimum:0,maximum:1})}),iy=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("roc"),data:d.Array(bR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity"),xAxis:Bn,yAxis:Bn,references:d.Optional(d.Array(Af))});var gR=d.Union([iy,oy],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var Xr=d.Object({id:d.String(),model:d.Optional(d.String()),population:d.String(),label:d.Optional(d.String())}),RS=d.Union([d.Literal("model"),d.Literal("population"),d.Literal("evaluation"),d.Literal("context")]),NS=d.Object({label:d.String(),group:d.String(),role:RS}),Xs=d.Object({id:d.String(),evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),display:NS}),xR=d.Object({x:d.Number(),y:d.Number()}),ay=d.Union([d.Object({type:d.Literal("identity"),label:d.Optional(d.String())}),d.Object({type:d.Literal("horizontal"),value:d.Number(),label:d.Optional(d.String())}),d.Object({type:d.Literal("vertical"),value:d.Number(),label:d.Optional(d.String())}),d.Object({type:d.Literal("path"),points:d.Array(xR,{minItems:2}),label:d.Optional(d.String())})]),wR=d.Intersect([ay,d.Object({scope:d.Literal("global")})]),SR=d.Intersect([ay,d.Object({scope:d.Literal("population"),population:d.String()})]),IR=d.Intersect([ay,d.Object({scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),AS=d.Union([wR,SR,IR]),Ar=d.Object({schemaVersion:d.Literal("2.0"),title:d.Optional(d.String()),evaluations:d.Array(Xr),series:d.Array(Xs),xAxis:Bn,yAxis:Bn,references:d.Optional(d.Array(AS))}),Ef=d.Union([d.Literal("probability_threshold"),d.Literal("ppcr")]),ri=d.Object({operatingPoint:d.Optional(d.Object({dimension:Ef}))}),np=d.Object({operatingPoint:d.Optional(d.Object({dimension:d.Literal("probability_threshold")}))});var ES=d.Object({seriesId:d.String(),predicted:d.Number({minimum:0,maximum:1}),observed:d.Number({minimum:0,maximum:1}),method:d.Literal("discrete"),events:d.Optional(d.Number({minimum:0})),total:d.Optional(d.Number({minimum:0}))}),FS=d.Object({seriesId:d.String(),predicted:d.Number({minimum:0,maximum:1}),observed:d.Number(),method:d.Literal("smooth"),events:d.Optional(d.Number({minimum:0})),total:d.Optional(d.Number({minimum:0}))}),$S=d.Union([ES,FS]),_R=d.Object({seriesId:d.String(),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),sy=d.Intersect([Ar,d.Object({type:d.Literal("calibration"),data:d.Array($S),distribution:d.Optional(d.Array(_R)),x:d.Literal("predicted"),y:d.Literal("observed")})]);var LS=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),netBenefit:d.Number()}),VS=d.Intersect([Xr,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),jS=d.Intersect([Xs,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),US=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_none")}),DS={type:d.Literal("path"),points:d.Array(d.Object({x:d.Number(),y:d.Number()}),{minItems:2}),label:d.Optional(d.String()),benchmark:d.Literal("treat_all")},BS=d.Union([d.Object({...DS,scope:d.Literal("population"),population:d.String()}),d.Object({...DS,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),zS=d.Union([US,BS]),cy=d.Intersect([Ar,np,d.Object({type:d.Literal("decision_curve"),evaluations:d.Array(VS,{minItems:1}),series:d.Array(jS,{minItems:1}),data:d.Array(LS),x:d.Literal("threshold"),y:d.Literal("netBenefit"),references:d.Array(zS,{minItems:2})})]);var vR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),sensitivity:d.Number({minimum:0,maximum:1})}),fy=d.Intersect([Ar,ri,d.Object({type:d.Literal("gains"),data:d.Array(vR),x:d.Literal("ppcr"),y:d.Literal("sensitivity")})]);var KS=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),interventionsAvoided:d.Number()}),qS=d.Intersect([Xr,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),HS=d.Intersect([Xs,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),YS=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_all")}),GS={type:d.Literal("path"),points:d.Array(d.Object({x:d.Number(),y:d.Number()}),{minItems:2}),label:d.Optional(d.String()),benchmark:d.Literal("treat_none")},WS=d.Union([d.Object({...GS,scope:d.Literal("population"),population:d.String()}),d.Object({...GS,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),XS=d.Union([YS,WS]),uy=d.Intersect([Ar,np,d.Object({type:d.Literal("interventions_avoided"),evaluations:d.Array(qS,{minItems:1}),series:d.Array(HS,{minItems:1}),data:d.Array(KS),x:d.Literal("threshold"),y:d.Literal("interventionsAvoided"),references:d.Array(XS,{minItems:2})})]);var PR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),lift:d.Number()}),ly=d.Intersect([Ar,ri,d.Object({type:d.Literal("lift"),data:d.Array(PR),x:d.Literal("ppcr"),y:d.Literal("lift")})]);var TR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Optional(d.Number({minimum:0,maximum:1})),sensitivity:d.Number({minimum:0,maximum:1}),ppv:d.Number({minimum:0,maximum:1})}),py=d.Intersect([Ar,ri,d.Object({type:d.Literal("precision_recall"),data:d.Array(TR),x:d.Literal("sensitivity"),y:d.Literal("ppv")})]);var my=d.Union([d.Literal("true_positives"),d.Literal("true_negatives"),d.Literal("false_positives"),d.Literal("false_negatives"),d.Literal("sensitivity"),d.Literal("specificity"),d.Literal("false_positive_rate"),d.Literal("ppv"),d.Literal("npv"),d.Literal("lift"),d.Literal("predicted_positives"),d.Literal("ppcr"),d.Literal("net_benefit"),d.Literal("net_benefit_interventions_avoided")]),ZS=d.Object({id:my,label:d.String()}),op=d.Object({metricId:my,estimate:d.Union([d.Number(),d.Null()]),lower:d.Optional(d.Union([d.Number(),d.Null()])),upper:d.Optional(d.Union([d.Number(),d.Null()]))}),QS=d.Union([d.Object({type:d.Literal("probability_threshold"),value:d.Number()}),d.Object({type:d.Literal("ppcr"),value:d.Number({minimum:0,maximum:1})})]),JS=d.Object({censoringHeuristic:d.Optional(d.String()),competingEventHeuristic:d.Optional(d.String())}),eI=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),operatingPoint:QS,context:d.Optional(JS),values:d.Array(op)}),dy=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("performance_table"),title:d.Optional(d.String()),evaluations:d.Array(Xr),metrics:d.Array(ZS),rows:d.Array(eI)});var tI=d.Object({evaluationId:d.String(),lower:d.Number({minimum:0,maximum:1}),upper:d.Number({minimum:0,maximum:1}),includeLower:d.Boolean(),includeUpper:d.Boolean(),nPositive:d.Integer({minimum:0}),nNegative:d.Integer({minimum:0})}),MR=d.Object({evaluationId:d.String(),rankLower:d.Number({minimum:0,maximum:1}),rankUpper:d.Number({minimum:0,maximum:1}),positiveMass:d.Number({minimum:0}),negativeMass:d.Number({minimum:0})}),rI=d.Object({evaluationId:d.String(),type:Ef,value:d.Number({minimum:0,maximum:1}),cutoff:d.Number({minimum:0,maximum:1}),realizedPpcr:d.Number({minimum:0,maximum:1}),performance:d.Optional(d.Array(op))}),Ff=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("prediction_distribution"),title:d.Optional(d.String()),evaluations:d.Array(Xr,{minItems:1}),operatingPoint:d.Optional(d.Object({dimension:Ef})),bins:d.Array(tI,{minItems:1}),rankBins:d.Optional(d.Array(MR)),operatingPoints:d.Array(rI,{minItems:1})});var OR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Optional(d.Number({minimum:0,maximum:1})),sensitivity:d.Number({minimum:0,maximum:1}),specificity:d.Number({minimum:0,maximum:1})}),hy=d.Intersect([Ar,ri,d.Object({type:d.Literal("roc"),data:d.Array(OR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity")})]);var yy=d.Union([hy,sy,py,fy,ly,cy,uy,Ff],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var by=d.Object({id:d.String(),label:d.String()}),gy=d.Object({metric:d.Literal("auroc"),owner:d.Object({type:d.Literal("evaluation"),evaluationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),xy=d.Object({metric:d.Literal("prevalence"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),CR=d.Object({metric:d.Literal("event_risk"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),horizon:d.Number({minimum:0}),estimate:d.Union([d.Number(),d.Null()])}),kR=d.Union([gy,xy]),nI=d.Union([gy,xy,CR]),RR=nI,NR=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(Xr),populations:d.Array(by),metrics:d.Array(kR)}),AR=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(Xr),populations:d.Array(by),metrics:d.Array(nI)}),wy=d.Union([NR,AR],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var Sy=d.Union([yy,dy,wy,Ff]),oI=d.Object({id:d.String(),title:d.Optional(d.String()),spec:Sy}),ip=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("report"),title:d.Optional(d.String()),components:d.Array(oI,{minItems:1})}),Iy=d.Object({type:d.Literal("component"),id:d.String(),title:d.Optional(d.String()),spec:Sy}),iI=d.Object({type:d.Literal("group"),id:d.String(),title:d.String(),components:d.Array(Iy,{minItems:1})}),aI=d.Object({id:d.String(),title:d.String(),items:d.Array(d.Union([Iy,iI]),{minItems:1})}),ap=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("report"),title:d.Optional(d.String()),sections:d.Array(aI,{minItems:1})}),ER=d.Union([ip,ap],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function sp(e){let t=new Set,r=i=>{if(t.has(i.id))throw new Error(`duplicate component id: ${i.id}`);t.add(i.id)};if(e.schemaVersion==="1.0"){for(let i of e.components)r(i);return}let n=new Set,o=new Set;for(let i of e.sections){if(n.has(i.id))throw new Error(`duplicate section id: ${i.id}`);n.add(i.id);for(let a of i.items){if(a.type==="component"){r(a);continue}if(o.has(a.id))throw new Error(`duplicate group id: ${a.id}`);o.add(a.id);for(let s of a.components)r(s)}}}function _y(e){let t=new Set;for(let n of e.evaluations){if(t.has(n.id))throw new Error(`duplicate evaluation id: ${n.id}`);t.add(n.id)}let r=new Set;for(let n of e.metrics){if(r.has(n.id))throw new Error(`duplicate metric id: ${n.id}`);r.add(n.id)}for(let n of e.rows){if(!t.has(n.evaluationId))throw new Error(`unknown evaluation id: ${n.evaluationId}`);for(let o of n.values)if(!r.has(o.metricId))throw new Error(`unknown metric id: ${o.metricId}`)}}function $f(e){if(e.operatingPoint?.dimension){let i=e.operatingPoint.dimension;if(!e.operatingPoints.some(s=>s.type===i))throw new Error(`configured operatingPoint dimension ${i} is not present in operatingPoints`)}let t=new Set;for(let i of e.evaluations){if(t.has(i.id))throw new Error(`duplicate evaluation id: ${i.id}`);t.add(i.id)}let r=new Map;for(let i of e.bins){if(!t.has(i.evaluationId))throw new Error(`unknown evaluation id: ${i.evaluationId}`);let a=r.get(i.evaluationId);a||(a=[],r.set(i.evaluationId,a)),a.push(i)}let n=new Map,o=new Set;for(let i of e.operatingPoints){if(!t.has(i.evaluationId))throw new Error(`unknown evaluation id: ${i.evaluationId}`);let a=`${i.evaluationId}\0${i.type}\0${i.value}`;if(o.has(a))throw new Error(`duplicate operating point: evaluationId=${i.evaluationId}, type=${i.type}, value=${i.value}`);if(o.add(a),!Number.isFinite(i.value)||i.value<0||i.value>1||!Number.isFinite(i.cutoff)||i.cutoff<0||i.cutoff>1||!Number.isFinite(i.realizedPpcr)||i.realizedPpcr<0||i.realizedPpcr>1)throw new Error(`invalid operating point bounds for evaluation ${i.evaluationId}`);if(i.type==="probability_threshold"&&Math.abs(i.value-i.cutoff)>1e-9)throw new Error(`probability_threshold value ${i.value} must equal cutoff ${i.cutoff} for evaluation ${i.evaluationId}`);let s=n.get(i.evaluationId);s||(s=[],n.set(i.evaluationId,s)),s.push(i)}for(let i of t){let a=r.get(i);if(!a||a.length===0)throw new Error(`evaluation ${i} has no bins`);let s=n.get(i);if(!s||s.length===0)throw new Error(`evaluation ${i} has no operating points`);let c=a[0];if(c.lower!==0||c.upper!==0||c.includeLower!==!0||c.includeUpper!==!0)throw new Error(`first bin for evaluation ${i} must be [0, 0]`);let u=new Set([0]),f=c.nPositive+c.nNegative;if(!Number.isInteger(c.nPositive)||c.nPositive<0||!Number.isInteger(c.nNegative)||c.nNegative<0)throw new Error(`invalid bin counts for evaluation ${i}`);for(let m=1;m1||!Number.isFinite(l.upper)||l.upper<0||l.upper>1)throw new Error(`invalid bin bounds for evaluation ${i}`);if(!Number.isInteger(l.nPositive)||l.nPositive<0||!Number.isInteger(l.nNegative)||l.nNegative<0)throw new Error(`invalid bin counts for evaluation ${i}`);if(l.includeLower!==!1||l.includeUpper!==!0)throw new Error(`bin ${m} for evaluation ${i} must be (lower, upper]`);if(l.lower>=l.upper)throw new Error(`bin ${m} for evaluation ${i} must be nondegenerate`);if(l.lower!==a[m-1].upper)throw new Error(`bins for evaluation ${i} must be contiguous and ascending`);u.add(l.upper),f+=l.nPositive+l.nNegative}if(a[a.length-1].upper!==1)throw new Error(`final bin upper bound for evaluation ${i} must be 1`);if(f<=0)throw new Error(`total count for evaluation ${i} must be positive`);for(let m of s)if(m.type==="probability_threshold"){if(m.cutoff!==0&&!u.has(m.cutoff))throw new Error(`operating point cutoff ${m.cutoff} for evaluation ${i} does not match any bin upper boundary`);let l=0;if(m.cutoff===0)l=f;else for(let h of a)h.upper>m.cutoff&&(l+=h.nPositive+h.nNegative);let p=l/f;if(Math.abs(m.realizedPpcr-p)>1e-6)throw new Error(`operating point realizedPpcr ${m.realizedPpcr} for evaluation ${i} does not match reconstructed count fraction ${p}`)}}}function vy(e){let t=new Set;for(let o of e.evaluations){if(t.has(o.id))throw new Error(`duplicate evaluation id: ${o.id}`);t.add(o.id)}let r=new Set;for(let o of e.populations){if(r.has(o.id))throw new Error(`duplicate population id: ${o.id}`);r.add(o.id)}let n=new Set;for(let o of e.metrics){if(o.estimate!==null&&!Number.isFinite(o.estimate))throw new Error(`non-finite metric estimate: ${o.estimate}`);if("horizon"in o&&o.horizon!==void 0&&(!Number.isFinite(o.horizon)||o.horizon<0))throw new Error(`invalid horizon: ${o.horizon}`);if(o.metric==="auroc"){if("horizon"in o&&o.horizon!==void 0)throw new Error("auroc metric cannot specify horizon");if(!t.has(o.owner.evaluationId))throw new Error(`unknown evaluation id: ${o.owner.evaluationId}`);let i=`auroc:${o.owner.evaluationId}`;if(n.has(i))throw new Error(`duplicate metric ownership: auroc for evaluation ${o.owner.evaluationId}`);n.add(i)}else if(o.metric==="prevalence"){if("horizon"in o&&o.horizon!==void 0)throw new Error("prevalence metric cannot specify horizon");if(!r.has(o.owner.populationId))throw new Error(`unknown population id: ${o.owner.populationId}`);let i=`prevalence:${o.owner.populationId}`;if(n.has(i))throw new Error(`duplicate metric ownership: prevalence for population ${o.owner.populationId}`);n.add(i)}else if(o.metric==="event_risk"){if(e.schemaVersion!=="1.1")throw new Error(`event_risk metric requires schemaVersion 1.1, got ${e.schemaVersion}`);if(!("horizon"in o)||o.horizon===void 0)throw new Error("event_risk metric requires horizon");if(!r.has(o.owner.populationId))throw new Error(`unknown population id: ${o.owner.populationId}`);let i=`event_risk:${o.owner.populationId}:${o.horizon}`;if(n.has(i))throw new Error(`duplicate metric ownership: event_risk for population ${o.owner.populationId} at horizon ${o.horizon}`);n.add(i)}}}function ni(e){if(e.type==="prediction_distribution"){$f(e);return}let t=new Set(e.evaluations.map(o=>o.id)),r=new Set;if(t.size!==e.evaluations.length)throw new Error("duplicate evaluation id");for(let o of e.series){if(r.has(o.id))throw new Error(`duplicate series id: ${o.id}`);if(r.add(o.id),!t.has(o.evaluationId))throw new Error(`unknown evaluation id: ${o.evaluationId}`)}for(let o of e.data)if(!r.has(o.seriesId))throw new Error(`unknown series id: ${o.seriesId}`);if(e.type==="calibration"){for(let o of e.distribution??[])if(!r.has(o.seriesId))throw new Error(`unknown distribution series id: ${o.seriesId}`)}let n=new Set(e.evaluations.map(o=>o.population));for(let o of e.references??[])if((o.scope==="population"||o.scope==="population_horizon")&&!n.has(o.population))throw new Error(`unknown reference population: ${o.population}`);if(e.type==="decision_curve"){let o=e,i=o.references;o.evaluations.forEach((h,y)=>{let b=`evaluation-${y+1}`;if(h.id!==b)throw new Error(`decision curve evaluation ids must be ordinal: expected ${b}`)});let a=o.series.filter(h=>h.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("decision curve cannot mix static and horizon-qualified series");let s=a>0,c=[...new Set(o.series.map(h=>h.horizon).filter(h=>h!==void 0))],u=new Set;if(o.series.forEach((h,y)=>{if(h.id!==`series-${y+1}`)throw new Error(`decision curve series ids must be ordinal: expected series-${y+1}`);let b=o.evaluations.find(x=>x.id===h.evaluationId),w=b.model??b.population,g=b.model===void 0?"population":"model";if(h.display.label!==w||h.display.group!==w||h.display.role!==g)throw new Error("decision curve display must follow evaluation semantics");let _=`${h.evaluationId}\0${h.horizon??"static"}`;if(u.has(_))throw new Error(`duplicate decision curve evaluation-horizon series: ${h.evaluationId}`);u.add(_)}),s){if(!o.evaluations.every(y=>c.every(b=>u.has(`${y.id}\0${b}`)))||o.series.length!==o.evaluations.length*c.length)throw new Error("decision curve requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(h=>!u.has(`${h.id}\0static`)))throw new Error("decision curve requires exactly one series per evaluation");if(i.filter(h=>"benchmark"in h&&h.benchmark==="treat_none").length!==1)throw new Error("decision curve requires exactly one Treat None reference");let m=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_all"),l=new Set;for(let h of m){if(s&&h.scope!=="population_horizon")throw new Error("time-dependent decision curve Treat All must use population_horizon scope");if(!s&&h.scope!=="population")throw new Error("static decision curve Treat All must use population scope");let y=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(y))throw new Error(`duplicate Treat All owner: ${h.population}`);l.add(y)}let p=s?[...n].flatMap(h=>c.map(y=>`${h}\0${y}`)):[...n];if(l.size!==p.length||p.some(h=>!l.has(h)))throw new Error(s?"decision curve requires exactly one Treat All reference per population and horizon":"decision curve requires exactly one Treat All reference per population")}if(e.type==="interventions_avoided"){let o=e,i=o.references;o.evaluations.forEach((h,y)=>{let b=`evaluation-${y+1}`;if(h.id!==b)throw new Error(`interventions avoided evaluation ids must be ordinal: expected ${b}`)});let a=o.series.filter(h=>h.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("interventions avoided cannot mix static and horizon-qualified series");let s=a>0,c=[...new Set(o.series.map(h=>h.horizon).filter(h=>h!==void 0))],u=new Set;if(o.series.forEach((h,y)=>{if(h.id!==`series-${y+1}`)throw new Error(`interventions avoided series ids must be ordinal: expected series-${y+1}`);let b=o.evaluations.find(x=>x.id===h.evaluationId);if(!b)throw new Error(`unknown evaluation id: ${h.evaluationId}`);let w=b.model??b.population,g=b.model===void 0?"population":"model";if(h.display.label!==w||h.display.group!==w||h.display.role!==g)throw new Error("interventions avoided display must follow evaluation semantics");let _=`${h.evaluationId}\0${h.horizon??"static"}`;if(u.has(_))throw new Error(`duplicate interventions avoided evaluation-horizon series: ${h.evaluationId}`);u.add(_)}),s){if(!o.evaluations.every(y=>c.every(b=>u.has(`${y.id}\0${b}`)))||o.series.length!==o.evaluations.length*c.length)throw new Error("interventions avoided requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(h=>!u.has(`${h.id}\0static`)))throw new Error("interventions avoided requires exactly one series per evaluation");let f=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_all");if(f.length!==1)throw new Error("interventions avoided requires exactly one Treat All reference");if(f[0].scope!=="global"||f[0].type!=="horizontal"||f[0].value!==0)throw new Error("interventions avoided Treat All must be the global zero reference");let m=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_none"),l=new Set;for(let h of m){if(s&&h.scope!=="population_horizon")throw new Error("time-dependent interventions avoided Treat None must use population_horizon scope");if(!s&&h.scope!=="population")throw new Error("static interventions avoided Treat None must use population scope");let y=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(y))throw new Error(`duplicate Treat None owner: ${h.population}`);l.add(y)}let p=s?[...n].flatMap(h=>c.map(y=>`${h}\0${y}`)):[...n];if(l.size!==p.length||p.some(h=>!l.has(h)))throw new Error(s?"interventions avoided requires exactly one Treat None reference per population and horizon":"interventions avoided requires exactly one Treat None reference per population")}}function sI(e){return{schemaVersion:"1.0",type:"roc",data:e,x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity"}]}}function FR(e){return sI(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function $R(e){return sI(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function DR(e,t,r){let n=e.map(i=>{let a=i.sum_reals??i.n_reals,s=i.total_obs??i.n;return{model:i.reference_group,predicted:i.x,observed:i.y,method:t,...t==="discrete"&&a!==void 0?{events:a}:{},...t==="discrete"&&s!==void 0?{total:s}:{}}}),o=r?.map(i=>({model:i.reference_group,midpoint:i.mids,count:i.counts,binWidth:.01}));return{schemaVersion:"1.0",type:"calibration",data:n,...o?{distribution:o}:{},x:"predicted",y:"observed",xAxis:{label:"Predicted probability",domain:[0,1]},yAxis:{label:"Observed probability",domain:[0,1]},references:[{type:"identity"}]}}function LR(e,t){let r=t.role==="model"?t.population??"population":e,n=`evaluation:${e}`;return{evaluation:{id:n,...t.role==="model"?{model:e}:{},population:r,label:e},series:{id:`series:${e}`,evaluationId:n,display:{label:e,group:e,role:t.role}}}}function Py(e,t){return[...new Set(e)].map(n=>LR(n,t))}function VR(e,t="population"){let r=Py(e.map(n=>n.model),{role:"model",population:t});return{schemaVersion:"2.0",type:"roc",evaluations:r.map(n=>n.evaluation),series:r.map(n=>n.series),data:e.map(n=>({seriesId:`series:${n.model}`,cutoff:n.probability_threshold,sensitivity:n.sensitivity,specificity:n.specificity})),x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity",scope:"global",label:"Random Guess"}]}}function jR(e,t){let r=Py(e.map(n=>n.reference_group),t);return{schemaVersion:"2.0",type:"roc",evaluations:r.map(n=>n.evaluation),series:r.map(n=>n.series),data:e.map(n=>({seriesId:`series:${n.reference_group}`,cutoff:n.chosen_cutoff,sensitivity:n.sensitivity,specificity:n.specificity})),x:"false_positive_rate",y:"sensitivity",xAxis:{label:"1 - Specificity",domain:[0,1]},yAxis:{label:"Sensitivity",domain:[0,1]},references:[{type:"identity",scope:"global",label:"Random Guess"}]}}function UR(e,t,r,n){let o=Py(e.map(c=>c.reference_group),r),i=e.map(c=>c.y).filter(Number.isFinite),a=Math.min(0,...i),s=Math.max(1,...i);return{schemaVersion:"2.0",type:"calibration",evaluations:o.map(c=>c.evaluation),series:o.map(c=>c.series),data:e.map(c=>{let u=c.sum_reals??c.n_reals,f=c.total_obs??c.n;return{seriesId:`series:${c.reference_group}`,predicted:c.x,observed:c.y,method:t,...t==="discrete"&&u!==void 0?{events:u}:{},...t==="discrete"&&f!==void 0?{total:f}:{}}}),...n?{distribution:n.map(c=>({seriesId:`series:${c.reference_group}`,midpoint:c.mids,count:c.counts,binWidth:.01}))}:{},x:"predicted",y:"observed",xAxis:{label:"Predicted probability",domain:[0,1]},yAxis:{label:"Observed probability",domain:[a,s]},references:[{type:"identity",scope:"global",label:"Perfectly Calibrated"}]}}function ht(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function mn(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function oi(e){let t,r,n;e.length!==2?(t=ht,r=(s,c)=>ht(e(s),c),n=(s,c)=>e(s)-c):(t=e===ht||e===mn?e:BR,r=e,n=e);function o(s,c,u=0,f=s.length){if(u>>1;r(s[m],c)<0?u=m+1:f=m}while(u>>1;r(s[m],c)<=0?u=m+1:f=m}while(uu&&n(s[m-1],c)>-n(s[m],c)?m-1:m}return{left:o,center:a,right:i}}function BR(){return 0}function Df(e){return e===null?NaN:+e}function*cI(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var fI=oi(ht),uI=fI.right,zR=fI.left,GR=oi(Df).center,Va=uI;function KR(e){return e.length|0}function qR(e){return!(e>0)}function HR(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function YR(e){return t=>e(...t)}function cp(...e){let t=typeof e[e.length-1]=="function"&&YR(e.pop());e=e.map(HR);let r=e.map(KR),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some(qR))return i;for(;;){i.push(o.map((s,c)=>e[c][s]));let a=n;for(;++o[a]===r[a];){if(a===0)return t?i.map(t):i;o[a--]=0}}}function fp(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?o=>r+=+o||0:o=>r+=+t(o,n++,e)||0)}function Zs(e,t){let r=0,n,o=0,i=0;if(t===void 0)for(let a of e)a!=null&&(a=+a)>=a&&(n=a-o,o+=n/++r,i+=n*(a-o));else{let a=-1;for(let s of e)(s=t(s,++a,e))!=null&&(s=+s)>=s&&(n=s-o,o+=n/++r,i+=n*(s-o))}if(r>1)return i/(r-1)}function up(e,t){let r=Zs(e,t);return r&&Math.sqrt(r)}function Er(e,t){let r,n;if(t===void 0)for(let o of e)o!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n=i&&(r=n=i):(r>i&&(r=i),n0){for(a=t[--r];r>0&&(n=a,o=t[--r],a=n+o,i=o-(a-n),!i););r>0&&(i<0&&t[r-1]<0||i>0&&t[r-1]>0)&&(o=i*2,n=a+o,o==n-a&&(a=n))}return a}};var Sr=class extends Map{constructor(t,r=mI){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,o]of t)this.set(n,o)}get(t){return super.get(Ty(this,t))}has(t){return super.has(Ty(this,t))}set(t,r){return super.set(lI(this,t),r)}delete(t){return super.delete(pI(this,t))}},zn=class extends Set{constructor(t,r=mI){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(Ty(this,t))}add(t){return super.add(lI(this,t))}delete(t){return super.delete(pI(this,t))}};function Ty({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function lI({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function pI({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function mI(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Lf(e){return e}function ii(e,...t){return Oy(e,Lf,Lf,t)}function ho(e,t,...r){return Oy(e,Lf,t,r)}function My(e,t,...r){return Oy(e,Array.from,t,r)}function Oy(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new Sr,c=n[a++],u=-1;for(let f of i){let m=c(f,++u,i),l=s.get(m);l?l.push(f):s.set(m,[f])}for(let[f,m]of s)s.set(f,o(m,a));return t(s)})(e,0)}function Cy(e,t){return Array.from(t,r=>e[r])}function Yi(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(o,i)=>i);return t.length>1?(t=t.map(o=>e.map(o)),n.sort((o,i)=>{for(let a of t){let s=Vf(a[o],a[i]);if(s)return s}})):(r=e.map(r),n.sort((o,i)=>Vf(r[o],r[i]))),Cy(e,n)}return e.sort(ky(r))}function ky(e=ht){if(e===ht)return Vf;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Vf(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function Qs(e,t,r){return(t.length!==2?Yi(ho(e,t,r),(([n,o],[i,a])=>ht(o,a)||ht(n,i))):Yi(ii(e,r),(([n,o],[i,a])=>t(o,a)||ht(n,i)))).map(([n])=>n)}var WR=Math.sqrt(50),XR=Math.sqrt(10),ZR=Math.sqrt(2);function lp(e,t,r){let n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),i=n/Math.pow(10,o),a=i>=WR?10:i>=XR?5:i>=ZR?2:1,s,c,u;return o<0?(u=Math.pow(10,-o)/a,s=Math.round(e*u),c=Math.round(t*u),s/ut&&--c,u=-u):(u=Math.pow(10,o)*a,s=Math.round(e/u),c=Math.round(t/u),s*ut&&--c),c0))return[];if(e===t)return[e];let n=t=o))return[];let s=i-o+1,c=new Array(s);if(n)if(a<0)for(let u=0;u=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r=o)&&(r=o)}return r}function pp(e,t){let r,n=-1,o=-1;if(t===void 0)for(let i of e)++o,i!=null&&(r=i)&&(r=i,n=o);else for(let i of e)(i=t(i,++o,e))!=null&&(r=i)&&(r=i,n=o);return n}function Ir(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}return r}function mp(e,t){let r,n=-1,o=-1;if(t===void 0)for(let i of e)++o,i!=null&&(r>i||r===void 0&&i>=i)&&(r=i,n=o);else for(let i of e)(i=t(i,++o,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i,n=o);return n}function dp(e,t,r=0,n=1/0,o){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(o=o===void 0?Vf:ky(o);n>r;){if(n-r>600){let c=n-r+1,u=t-r+1,f=Math.log(c),m=.5*Math.exp(2*f/3),l=.5*Math.sqrt(f*m*(c-m)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*m/c+l)),h=Math.min(n,Math.floor(t+(c-u)*m/c+l));dp(e,t,p,h,o)}let i=e[t],a=r,s=n;for(Uf(e,r,t),o(e[n],i)>0&&Uf(e,r,n);a0;)--s}o(e[r],i)===0?Uf(e,r,s):(++s,Uf(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function Uf(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Bf(e,t=ht){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?ht(a,o)>0:ht(a,a)===0)&&(r=i,o=a,n=!0)}}else for(let o of e)(n?t(o,r)>0:t(o,o)===0)&&(r=o,n=!0);return r}function si(e,t,r){if(e=Float64Array.from(cI(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Ir(e);if(t>=1)return jt(e);var n,o=(n-1)*t,i=Math.floor(o),a=jt(dp(e,i).subarray(0,i+1)),s=Ir(e.subarray(i+1));return a+(s-a)*(o-i)}}function Ry(e,t,r=Df){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,o=(n-1)*t,i=Math.floor(o),a=+r(e[i],i,e),s=+r(e[i+1],i+1,e);return a+(s-a)*(o-i)}}function hp(e,t){let r=0,n=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(++r,n+=o);else{let o=-1;for(let i of e)(i=t(i,++o,e))!=null&&(i=+i)>=i&&(++r,n+=i)}if(r)return n/r}function ja(e,t){return si(e,.5,t)}function*JR(e){for(let t of e)yield*t}function ec(e){return Array.from(JR(e))}function yp(e,t){let r=new Sr;if(t===void 0)for(let i of e)i!=null&&i>=i&&r.set(i,(r.get(i)||0)+1);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&a>=a&&r.set(a,(r.get(a)||0)+1)}let n,o=0;for(let[i,a]of r)a>o&&(o=a,n=i);return n}function bp(e,t=eN){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function eN(e,t){return[e,t]}function Ua(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(o);++n+e(t)}function oN(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function iN(){return!this.__axis}function aN(e,t){var r=[],n=null,o=null,i=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=e===Ny||e===gp?-1:1,f=e===gp||e===Ay?"x":"y",m=e===Ny||e===Ey?tN:rN;function l(p){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),y=o??(t.tickFormat?t.tickFormat.apply(t,r):dI),b=Math.max(i,0)+s,w=t.range(),g=+w[0]+c,_=+w[w.length-1]+c,x=(t.bandwidth?oN:nN)(t.copy(),c),I=p.selection?p.selection():p,S=I.selectAll(".domain").data([null]),v=I.selectAll(".tick").data(h,t).order(),T=v.exit(),O=v.enter().append("g").attr("class","tick"),R=v.select("line"),C=v.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(O),R=R.merge(O.append("line").attr("stroke","currentColor").attr(f+"2",u*i)),C=C.merge(O.append("text").attr("fill","currentColor").attr(f,u*b).attr("dy",e===Ny?"0em":e===Ey?"0.71em":"0.32em")),p!==I&&(S=S.transition(p),v=v.transition(p),R=R.transition(p),C=C.transition(p),T=T.transition(p).attr("opacity",hI).attr("transform",function(k){return isFinite(k=x(k))?m(k+c):this.getAttribute("transform")}),O.attr("opacity",hI).attr("transform",function(k){var z=this.parentNode.__axis;return m((z&&isFinite(z=z(k))?z:x(k))+c)})),T.remove(),S.attr("d",e===gp||e===Ay?a?"M"+u*a+","+g+"H"+c+"V"+_+"H"+u*a:"M"+c+","+g+"V"+_:a?"M"+g+","+u*a+"V"+c+"H"+_+"V"+u*a:"M"+g+","+c+"H"+_),v.attr("opacity",1).attr("transform",function(k){return m(x(k)+c)}),R.attr(f+"2",u*i),C.attr(f,u*b).text(y),I.filter(iN).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Ay?"start":e===gp?"end":"middle"),I.each(function(){this.__axis=x})}return l.scale=function(p){return arguments.length?(t=p,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),l):r.slice()},l.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),l):n&&n.slice()},l.tickFormat=function(p){return arguments.length?(o=p,l):o},l.tickSize=function(p){return arguments.length?(i=a=+p,l):i},l.tickSizeInner=function(p){return arguments.length?(i=+p,l):i},l.tickSizeOuter=function(p){return arguments.length?(a=+p,l):a},l.tickPadding=function(p){return arguments.length?(s=+p,l):s},l.offset=function(p){return arguments.length?(c=+p,l):c},l}function Fy(e){return aN(Ey,e)}var sN={value:()=>{}};function bI(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}xp.prototype=bI.prototype={constructor:xp,on:function(e,t){var r=this._,n=cN(e+"",r),o,i=-1,a=n.length;if(arguments.length<2){for(;++i0)for(var r=new Array(o),n=0,o,i;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),yo.hasOwnProperty(t)?{space:yo[t],local:e}:e}function uN(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===wp&&t.documentElement.namespaceURI===wp?t.createElement(e):t.createElementNS(r,e)}}function lN(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fi(e){var t=ci(e);return(t.local?lN:uN)(t)}function pN(){}function Ba(e){return e==null?pN:function(){return this.querySelector(e)}}function gI(e){typeof e!="function"&&(e=Ba(e));for(var t=this._groups,r=t.length,n=new Array(r),o=0;o=_&&(_=g+1);!(I=b[_])&&++_=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function kI(e){e||(e=PN);function t(m,l){return m&&l?e(m.__data__,l.__data__):!m-!l}for(var r=this._groups,n=r.length,o=new Array(n),i=0;it?1:e>=t?0:NaN}function RI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function NI(){return Array.from(this)}function AI(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?NN:typeof t=="function"?EN:AN)(e,t,r??"")):Xi(this.node(),e)}function Xi(e,t){return e.style.getPropertyValue(t)||_p(e).getComputedStyle(e,null).getPropertyValue(t)}function FN(e){return function(){delete this[e]}}function $N(e,t){return function(){this[e]=t}}function DN(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function VI(e,t){return arguments.length>1?this.each((t==null?FN:typeof t=="function"?DN:$N)(e,t)):this.node()[e]}function jI(e){return e.trim().split(/^|\s+/)}function Ly(e){return e.classList||new UI(e)}function UI(e){this._node=e,this._names=jI(e.getAttribute("class")||"")}UI.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function BI(e,t){for(var r=Ly(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function t4(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,o=t.length,i;r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?vp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?vp(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=s4.exec(e))?new At(t[1],t[2],t[3],1):(t=c4.exec(e))?new At(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=f4.exec(e))?vp(t[1],t[2],t[3],t[4]):(t=u4.exec(e))?vp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=l4.exec(e))?p_(t[1],t[2]/100,t[3]/100,1):(t=p4.exec(e))?p_(t[1],t[2]/100,t[3]/100,t[4]):a_.hasOwnProperty(e)?f_(a_[e]):e==="transparent"?new At(NaN,NaN,NaN,0):null}function f_(e){return new At(e>>16&255,e>>8&255,e&255,1)}function vp(e,t,r,n){return n<=0&&(e=t=r=NaN),new At(e,t,r,n)}function Hf(e){return e instanceof go||(e=Kn(e)),e?(e=e.rgb(),new At(e.r,e.g,e.b,e.opacity)):new At}function yn(e,t,r,n){return arguments.length===1?Hf(e):new At(e,t,r,n??1)}function At(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}li(At,yn,Zi(go,{brighter(e){return e=e==null?Ka:Math.pow(Ka,e),new At(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qi:Math.pow(Qi,e),new At(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new At(Ga(this.r),Ga(this.g),Ga(this.b),Tp(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:u_,formatHex:u_,formatHex8:h4,formatRgb:l_,toString:l_}));function u_(){return`#${za(this.r)}${za(this.g)}${za(this.b)}`}function h4(){return`#${za(this.r)}${za(this.g)}${za(this.b)}${za((isNaN(this.opacity)?1:this.opacity)*255)}`}function l_(){let e=Tp(this.opacity);return`${e===1?"rgb(":"rgba("}${Ga(this.r)}, ${Ga(this.g)}, ${Ga(this.b)}${e===1?")":`, ${e})`}`}function Tp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ga(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function za(e){return e=Ga(e),(e<16?"0":"")+e.toString(16)}function p_(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Gn(e,t,r,n)}function d_(e){if(e instanceof Gn)return new Gn(e.h,e.s,e.l,e.opacity);if(e instanceof go||(e=Kn(e)),!e)return new Gn;if(e instanceof Gn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),i=Math.max(t,r,n),a=NaN,s=i-o,c=(i+o)/2;return s?(t===i?a=(r-n)/s+(r0&&c<1?0:a,new Gn(a,s,c,e.opacity)}function Yf(e,t,r,n){return arguments.length===1?d_(e):new Gn(e,t,r,n??1)}function Gn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}li(Gn,Yf,Zi(go,{brighter(e){return e=e==null?Ka:Math.pow(Ka,e),new Gn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qi:Math.pow(Qi,e),new Gn(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,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new At(Uy(e>=240?e-240:e+120,o,n),Uy(e,o,n),Uy(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new Gn(m_(this.h),Pp(this.s),Pp(this.l),Tp(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=Tp(this.opacity);return`${e===1?"hsl(":"hsla("}${m_(this.h)}, ${Pp(this.s)*100}%, ${Pp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function m_(e){return e=(e||0)%360,e<0?e+360:e}function Pp(e){return Math.max(0,Math.min(1,e||0))}function Uy(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var Mp=Math.PI/180,Op=180/Math.PI;var Cp=18,h_=.96422,y_=1,b_=.82521,g_=4/29,rc=6/29,x_=3*rc*rc,y4=rc*rc*rc;function w_(e){if(e instanceof xo)return new xo(e.l,e.a,e.b,e.opacity);if(e instanceof pi)return S_(e);e instanceof At||(e=Hf(e));var t=Ky(e.r),r=Ky(e.g),n=Ky(e.b),o=By((.2225045*t+.7168786*r+.0606169*n)/y_),i,a;return t===r&&r===n?i=a=o:(i=By((.4360747*t+.3850649*r+.1430804*n)/h_),a=By((.0139322*t+.0971045*r+.7141733*n)/b_)),new xo(116*o-16,500*(i-o),200*(o-a),e.opacity)}function nc(e,t,r,n){return arguments.length===1?w_(e):new xo(e,t,r,n??1)}function xo(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}li(xo,nc,Zi(go,{brighter(e){return new xo(this.l+Cp*(e??1),this.a,this.b,this.opacity)},darker(e){return new xo(this.l-Cp*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=h_*zy(t),e=y_*zy(e),r=b_*zy(r),new At(Gy(3.1338561*t-1.6168667*e-.4906146*r),Gy(-.9787684*t+1.9161415*e+.033454*r),Gy(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function By(e){return e>y4?Math.pow(e,1/3):e/x_+g_}function zy(e){return e>rc?e*e*e:x_*(e-g_)}function Gy(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ky(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function b4(e){if(e instanceof pi)return new pi(e.h,e.c,e.l,e.opacity);if(e instanceof xo||(e=w_(e)),e.a===0&&e.b===0)return new pi(NaN,0=1?(r=1,t-1):Math.floor(r*t),o=e[n],i=e[n+1],a=n>0?e[n-1]:2*o-i,s=n()=>e;function O_(e,t){return function(r){return e+r*t}}function x4(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function ic(e,t){var r=t-e;return r?O_(e,r>180||r<-180?r-360*Math.round(r/360):r):oc(isNaN(e)?t:e)}function C_(e){return(e=+e)==1?ut:function(t,r){return r-t?x4(t,r,e):oc(isNaN(t)?r:t)}}function ut(e,t){var r=t-e;return r?O_(e,r):oc(isNaN(e)?t:e)}var bn=(function e(t){var r=C_(t);function n(o,i){var a=r((o=yn(o)).r,(i=yn(i)).r),s=r(o.g,i.g),c=r(o.b,i.b),u=ut(o.opacity,i.opacity);return function(f){return o.r=a(f),o.g=s(f),o.b=c(f),o.opacity=u(f),o+""}}return n.gamma=e,n})(1);function k_(e){return function(t){var r=t.length,n=new Array(r),o=new Array(r),i=new Array(r),a,s;for(a=0;ar&&(i=t.slice(r,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,c.push({i:a,x:st(n,o)})),r=Xy.lastIndex;return r180?f+=360:f-u>180&&(u+=360),l.push({i:m.push(o(m)+"rotate(",null,n)-2,x:st(u,f)})):f&&m.push(o(m)+"rotate("+f+n)}function s(u,f,m,l){u!==f?l.push({i:m.push(o(m)+"skewX(",null,n)-2,x:st(u,f)}):f&&m.push(o(m)+"skewX("+f+n)}function c(u,f,m,l,p,h){if(u!==m||f!==l){var y=p.push(o(p)+"scale(",null,",",null,")");h.push({i:y-4,x:st(u,m)},{i:y-2,x:st(f,l)})}else(m!==1||l!==1)&&p.push(o(p)+"scale("+m+","+l+")")}return function(u,f){var m=[],l=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,m,l),a(u.rotate,f.rotate,m,l),s(u.skewX,f.skewX,m,l),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,m,l),u=f=null,function(p){for(var h=-1,y=l.length,b;++h=0&&e._call.call(void 0,t),e=e._next;--sc}function z_(){Ya=(Fp=tu.now())+$p,sc=Jf=0;try{q_()}finally{sc=0,O4(),Ya=0}}function M4(){var e=tu.now(),t=e-Fp;t>G_&&($p-=t,Fp=e)}function O4(){for(var e,t=Ep,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Ep=r);eu=e,nb(n)}function nb(e){if(!sc){Jf&&(Jf=clearTimeout(Jf));var t=e-Ya;t>24?(e<1/0&&(Jf=setTimeout(z_,e-tu.now()-$p)),Qf&&(Qf=clearInterval(Qf))):(Qf||(Fp=tu.now(),Qf=setInterval(M4,G_)),sc=1,K_(z_))}}function Lp(e,t,r){var n=new ru;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,r),n}var C4=$y("start","end","cancel","interrupt"),k4=[],W_=0,H_=1,jp=2,Vp=3,Y_=4,Up=5,ou=6;function Ji(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;R4(e,r,{name:t,index:n,group:o,on:C4,tween:k4,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:W_})}function iu(e,t){var r=Ft(e,t);if(r.state>W_)throw new Error("too late; already scheduled");return r}function tr(e,t){var r=Ft(e,t);if(r.state>Vp)throw new Error("too late; already running");return r}function Ft(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function R4(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=Dp(i,0,r.time);function i(u){r.state=H_,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var f,m,l,p;if(r.state!==H_)return c();for(f in n)if(p=n[f],p.name===r.name){if(p.state===Vp)return Lp(a);p.state===Y_?(p.state=ou,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[f]):+fjp&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function Z4(e,t,r){var n,o,i=X4(t)?iu:tr;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function av(e,t){var r=this._id;return arguments.length<2?Ft(this.node(),r).on.on(e):this.each(Z4(r,e,t))}function Q4(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function sv(){return this.on("end.remove",Q4(this._id))}function cv(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ba(e));for(var n=this._groups,o=n.length,i=new Array(o),a=0;a=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Sv;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;oWa)if(!(Math.abs(m*c-u*f)>Wa)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-a,h=o-s,y=c*c+u*u,b=p*p+h*h,w=Math.sqrt(y),g=Math.sqrt(l),_=i*Math.tan((ib-Math.acos((y+l-b)/(2*w*g)))/2),x=_/g,I=_/w;Math.abs(x-1)>Wa&&this._append`L${t+x*f},${r+x*m}`,this._append`A${i},${i},0,0,${+(m*p>f*h)},${this._x1=t+I*c},${this._y1=r+I*u}`}}arc(t,r,n,o,i,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(o),c=n*Math.sin(o),u=t+s,f=r+c,m=1^a,l=a?o-i:i-o;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>Wa||Math.abs(this._y1-f)>Wa)&&this._append`L${u},${f}`,n&&(l<0&&(l=l%ab+ab),l>dA?this._append`A${n},${n},0,1,${m},${t-s},${r-c}A${n},${n},0,1,${m},${this._x1=u},${this._y1=f}`:l>Wa&&this._append`A${n},${n},0,${+(l>=ib)},${m},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}};function Iv(){return new ea}Iv.prototype=ea.prototype;function Hn(e=3){return new ea(+e)}function _v(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Xa(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function So(e){return e=Xa(Math.abs(e)),e?e[1]:NaN}function vv(e,t){return function(r,n){for(var o=r.length,i=[],a=0,s=e[0],c=0;o>0&&s>0&&(c+s+1>n&&(s=Math.max(1,n-c)),i.push(r.substring(o-=s,o+s)),!((c+=s+1)>n));)s=e[a=(a+1)%e.length];return i.reverse().join(t)}}function Pv(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var yA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Io(e){if(!(t=yA.exec(e)))throw new Error("invalid format: "+e);var t;return new qp({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]})}Io.prototype=qp.prototype;function qp(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+""}qp.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 Tv(e){e:for(var t=e.length,r=1,n=-1,o;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}var au;function Mv(e,t){var r=Xa(e,t);if(!r)return au=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(au=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,a=n.length;return i===a?n:i>a?n+new Array(i-a+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+Xa(e,Math.max(0,t+i-1))[0]}function sb(e,t){var r=Xa(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}var cb={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:_v,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)=>sb(e*100,t),r:sb,s:Mv,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function fb(e){return e}var Ov=Array.prototype.map,Cv=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function kv(e){var t=e.grouping===void 0||e.thousands===void 0?fb:vv(Ov.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?fb:Pv(Ov.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(m,l){m=Io(m);var p=m.fill,h=m.align,y=m.sign,b=m.symbol,w=m.zero,g=m.width,_=m.comma,x=m.precision,I=m.trim,S=m.type;S==="n"?(_=!0,S="g"):cb[S]||(x===void 0&&(x=12),I=!0,S="g"),(w||p==="0"&&h==="=")&&(w=!0,p="0",h="=");var v=(l&&l.prefix!==void 0?l.prefix:"")+(b==="$"?r:b==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),T=(b==="$"?n:/[%p]/.test(S)?a:"")+(l&&l.suffix!==void 0?l.suffix:""),O=cb[S],R=/[defgprs%]/.test(S);x=x===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function C(k){var z=v,j=T,M,U,L;if(S==="c")j=O(k)+j,k="";else{k=+k;var re=k<0||1/k<0;if(k=isNaN(k)?c:O(Math.abs(k),x),I&&(k=Tv(k)),re&&+k==0&&y!=="+"&&(re=!1),z=(re?y==="("?y:s:y==="-"||y==="("?"":y)+z,j=(S==="s"&&!isNaN(k)&&au!==void 0?Cv[8+au/3]:"")+j+(re&&y==="("?")":""),R){for(M=-1,U=k.length;++ML||L>57){j=(L===46?o+k.slice(M+1):k.slice(M))+j,k=k.slice(0,M);break}}}_&&!w&&(k=t(k,1/0));var V=z.length+k.length+j.length,q=V>1)+z+k+j+q.slice(V);break;default:k=q+z+k+j;break}return i(k)}return C.toString=function(){return m+""},C}function f(m,l){var p=Math.max(-8,Math.min(8,Math.floor(So(l)/3)))*3,h=Math.pow(10,-p),y=u((m=Io(m),m.type="f",m),{suffix:Cv[8+p/3]});return function(b){return y(h*b)}}return{format:u,formatPrefix:f}}var Hp,gn,Yp;ub({thousands:",",grouping:[3],currency:["$",""]});function ub(e){return Hp=kv(e),gn=Hp.format,Yp=Hp.formatPrefix,Hp}function lb(e){return Math.max(0,-So(Math.abs(e)))}function pb(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(So(t)/3)))*3-So(Math.abs(e)))}function mb(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,So(t)-So(e))+1}var ae=1e-6,Wp=1e-12,pe=Math.PI,Ke=pe/2,db=pe/4,Ut=pe*2,$t=180/pe,qe=pe/180,ge=Math.abs,xn=Math.atan,rr=Math.atan2,ie=Math.cos;var Xp=Math.exp;var Za=Math.log,Zp=Math.pow,ne=Math.sin,mr=Math.sign||function(e){return e>0?1:e<0?-1:0},Je=Math.sqrt,fc=Math.tan;function Qp(e){return e>1?0:e<-1?pe:Math.acos(e)}function wt(e){return e>1?Ke:e<-1?-Ke:Math.asin(e)}function Bt(){}function Jp(e,t){e&&Nv.hasOwnProperty(e.type)&&Nv[e.type](e,t)}var Rv={Feature:function(e,t){Jp(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++npe&&(e-=Math.round(e/Ut)*Ut),[e,t]}yb.invert=yb;function bb(e,t,r){return(e%=Ut)?t||r?lu(Fv(e),$v(t,r)):Fv(e):t||r?$v(t,r):yb}function Ev(e){return function(t,r){return t+=e,ge(t)>pe&&(t-=Math.round(t/Ut)*Ut),[t,r]}}function Fv(e){var t=Ev(e);return t.invert=Ev(-e),t}function $v(e,t){var r=ie(e),n=ne(e),o=ie(t),i=ne(t);function a(s,c){var u=ie(c),f=ie(s)*u,m=ne(s)*u,l=ne(c),p=l*r+f*n;return[rr(m*o-p*i,f*r-l*n),wt(p*o+m*i)]}return a.invert=function(s,c){var u=ie(c),f=ie(s)*u,m=ne(s)*u,l=ne(c),p=l*o-m*i;return[rr(m*o+l*i,f*r+p*n),wt(p*r-f*n)]},a}function Dv(e){e=bb(e[0]*qe,e[1]*qe,e.length>2?e[2]*qe:0);function t(r){return r=e(r[0]*qe,r[1]*qe),r[0]*=$t,r[1]*=$t,r}return t.invert=function(r){return r=e.invert(r[0]*qe,r[1]*qe),r[0]*=$t,r[1]*=$t,r},t}function Vv(e,t,r,n,o,i){if(r){var a=ie(t),s=ne(t),c=n*r;o==null?(o=t+n*Ut,i=t-c/2):(o=Lv(a,o),i=Lv(a,i),(n>0?oi)&&(o+=n*Ut));for(var u,f=o;n>0?f>i:f1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function lc(e,t){return ge(e[0]-t[0])=0;--s)o.point((m=f[s])[0],m[1]);else n(l.x,l.p.x,-1,o);l=l.p}l=l.o,f=l.z,p=!p}while(!l.v);o.lineEnd()}}}function jv(e){if(t=e.length){for(var t,r=0,n=e[0],o;++r=0?1:-1,R=O*T,C=R>pe,k=b*S;if(c.add(rr(k*O*ne(R),w*v+k*ie(R))),a+=C?T+O*Ut:T,C^h>=r^x>=r){var z=uc(_o(p),_o(_));uu(z);var j=uc(i,z);uu(j);var M=(C^T>=0?-1:1)*wt(j[2]);(n>M||n===M&&(z[0]||z[1]))&&(s+=C^T>=0?1:-1)}}return(a<-ae||a0){for(c||(o.polygonStart(),c=!0),o.lineStart(),S=0;S1&&x&2&&I.push(I.pop().concat(I.shift())),f.push(I.filter(bA))}}return l}}function bA(e){return e.length>1}function gA(e,t){return((e=e.x)[0]<0?e[1]-Ke-ae:Ke-e[1])-((t=t.x)[0]<0?t[1]-Ke-ae:Ke-t[1])}var xb=om(function(){return!0},xA,SA,[-pe,-Ke]);function xA(e){var t=NaN,r=NaN,n=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,a){var s=i>0?pe:-pe,c=ge(i-t);ge(c-pe)0?Ke:-Ke),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(i,r),o=0):n!==s&&c>=pe&&(ge(t-n)ae?xn((ne(t)*(i=ie(n))*ne(r)-ne(n)*(o=ie(t))*ne(e))/(o*i*a)):(t+n)/2}function SA(e,t,r,n){var o;if(e==null)o=r*Ke,n.point(-pe,o),n.point(0,o),n.point(pe,o),n.point(pe,0),n.point(pe,-o),n.point(0,-o),n.point(-pe,-o),n.point(-pe,0),n.point(-pe,o);else if(ge(e[0]-t[0])>ae){var i=e[0]0,o=ge(t)>ae;function i(f,m,l,p){Vv(p,e,r,l,f,m)}function a(f,m){return ie(f)*ie(m)>t}function s(f){var m,l,p,h,y;return{lineStart:function(){h=p=!1,y=1},point:function(b,w){var g=[b,w],_,x=a(b,w),I=n?x?0:u(b,w):x?u(b+(b<0?pe:-pe),w):0;if(!m&&(h=p=x)&&f.lineStart(),x!==p&&(_=c(m,g),(!_||lc(m,_)||lc(g,_))&&(g[2]=1)),x!==p)y=0,x?(f.lineStart(),_=c(g,m),f.point(_[0],_[1])):(_=c(m,g),f.point(_[0],_[1],2),f.lineEnd()),m=_;else if(o&&m&&n^x){var S;!(I&l)&&(S=c(g,m,!0))&&(y=0,n?(f.lineStart(),f.point(S[0][0],S[0][1]),f.point(S[1][0],S[1][1]),f.lineEnd()):(f.point(S[1][0],S[1][1]),f.lineEnd(),f.lineStart(),f.point(S[0][0],S[0][1],3)))}x&&(!m||!lc(m,g))&&f.point(g[0],g[1]),m=g,p=x,l=I},lineEnd:function(){p&&f.lineEnd(),m=null},clean:function(){return y|(h&&p)<<1}}}function c(f,m,l){var p=_o(f),h=_o(m),y=[1,0,0],b=uc(p,h),w=cu(b,b),g=b[0],_=w-g*g;if(!_)return!l&&f;var x=t*w/_,I=-t*g/_,S=uc(y,b),v=fu(y,x),T=fu(b,I);em(v,T);var O=S,R=cu(v,O),C=cu(O,O),k=R*R-C*(cu(v,v)-1);if(!(k<0)){var z=Je(k),j=fu(O,(-R-z)/C);if(em(j,v),j=su(j),!l)return j;var M=f[0],U=m[0],L=f[1],re=m[1],V;U0^j[1]<(ge(j[0]-M)pe^(M<=j[0]&&j[0]<=U)){var te=fu(O,(-R+z)/C);return em(te,v),[j,su(te)]}}}function u(f,m){var l=n?e:pe-e,p=0;return f<-l?p|=1:f>l&&(p|=2),m<-l?p|=4:m>l&&(p|=8),p}return om(a,s,i,n?[0,-e]:[-pe,e-pe])}function zv(e,t,r,n,o,i){var a=e[0],s=e[1],c=t[0],u=t[1],f=0,m=1,l=c-a,p=u-s,h;if(h=r-a,!(!l&&h>0)){if(h/=l,l<0){if(h0){if(h>m)return;h>f&&(f=h)}if(h=o-a,!(!l&&h<0)){if(h/=l,l<0){if(h>m)return;h>f&&(f=h)}else if(l>0){if(h0)){if(h/=p,p<0){if(h0){if(h>m)return;h>f&&(f=h)}if(h=i-s,!(!p&&h<0)){if(h/=p,p<0){if(h>m)return;h>f&&(f=h)}else if(p>0){if(h0&&(e[0]=a+f*l,e[1]=s+f*p),m<1&&(t[0]=a+m*l,t[1]=s+m*p),!0}}}}}var pu=1e9,im=-pu;function pc(e,t,r,n){function o(u,f){return e<=u&&u<=r&&t<=f&&f<=n}function i(u,f,m,l){var p=0,h=0;if(u==null||(p=a(u,m))!==(h=a(f,m))||c(u,f)<0^m>0)do l.point(p===0||p===3?e:r,p>1?n:t);while((p=(p+m+4)%4)!==h);else l.point(f[0],f[1])}function a(u,f){return ge(u[0]-e)0?0:3:ge(u[0]-r)0?2:1:ge(u[1]-t)0?1:0:f>0?3:2}function s(u,f){return c(u.x,f.x)}function c(u,f){var m=a(u,1),l=a(f,1);return m!==l?m-l:m===0?f[1]-u[1]:m===1?u[0]-f[0]:m===2?u[1]-f[1]:f[0]-u[0]}return function(u){var f=u,m=tm(),l,p,h,y,b,w,g,_,x,I,S,v={point:T,lineStart:k,lineEnd:z,polygonStart:R,polygonEnd:C};function T(M,U){o(M,U)&&f.point(M,U)}function O(){for(var M=0,U=0,L=p.length;Un&&(be-W)*(n-te)>(K-te)*(e-W)&&++M:K<=n&&(be-W)*(n-te)<(K-te)*(e-W)&&--M;return M}function R(){f=m,l=[],p=[],S=!0}function C(){var M=O(),U=S&&M,L=(l=ec(l)).length;(U||L)&&(u.polygonStart(),U&&(u.lineStart(),i(null,null,1,u),u.lineEnd()),L&&nm(l,s,M,i,u),u.polygonEnd()),f=u,l=p=h=null}function k(){v.point=j,p&&p.push(h=[]),I=!0,x=!1,g=_=NaN}function z(){l&&(j(y,b),w&&x&&m.rejoin(),l.push(m.result())),v.point=T,x&&f.lineEnd()}function j(M,U){var L=o(M,U);if(p&&h.push([M,U]),I)y=M,b=U,w=L,I=!1,L&&(f.lineStart(),f.point(M,U));else if(L&&x)f.point(M,U);else{var re=[g=Math.max(im,Math.min(pu,g)),_=Math.max(im,Math.min(pu,_))],V=[M=Math.max(im,Math.min(pu,M)),U=Math.max(im,Math.min(pu,U))];zv(re,V,e,t,r,n)?(x||(f.lineStart(),f.point(re[0],re[1])),f.point(V[0],V[1]),L||f.lineEnd(),S=!1):L&&(f.lineStart(),f.point(M,U),S=!1)}g=M,_=U,x=L}return v}}var mu=e=>e;var wb=new Zr,Sb=new Zr,Gv,Kv,Ib,_b,ta={point:Bt,lineStart:Bt,lineEnd:Bt,polygonStart:function(){ta.lineStart=IA,ta.lineEnd=vA},polygonEnd:function(){ta.lineStart=ta.lineEnd=ta.point=Bt,wb.add(ge(Sb)),Sb=new Zr},result:function(){var e=wb/2;return wb=new Zr,e}};function IA(){ta.point=_A}function _A(e,t){ta.point=qv,Gv=Ib=e,Kv=_b=t}function qv(e,t){Sb.add(_b*e-Ib*t),Ib=e,_b=t}function vA(){qv(Gv,Kv)}var vb=ta;var mc=1/0,am=mc,du=-mc,sm=du,PA={point:TA,lineStart:Bt,lineEnd:Bt,polygonStart:Bt,polygonEnd:Bt,result:function(){var e=[[mc,am],[du,sm]];return du=sm=-(am=mc=1/0),e}};function TA(e,t){edu&&(du=e),tsm&&(sm=t)}var dc=PA;var Pb=0,Tb=0,hu=0,cm=0,fm=0,hc=0,Mb=0,Ob=0,yu=0,Wv,Xv,vo,Po,Wn={point:Qa,lineStart:Hv,lineEnd:Yv,polygonStart:function(){Wn.lineStart=CA,Wn.lineEnd=kA},polygonEnd:function(){Wn.point=Qa,Wn.lineStart=Hv,Wn.lineEnd=Yv},result:function(){var e=yu?[Mb/yu,Ob/yu]:hc?[cm/hc,fm/hc]:hu?[Pb/hu,Tb/hu]:[NaN,NaN];return Pb=Tb=hu=cm=fm=hc=Mb=Ob=yu=0,e}};function Qa(e,t){Pb+=e,Tb+=t,++hu}function Hv(){Wn.point=MA}function MA(e,t){Wn.point=OA,Qa(vo=e,Po=t)}function OA(e,t){var r=e-vo,n=t-Po,o=Je(r*r+n*n);cm+=o*(vo+e)/2,fm+=o*(Po+t)/2,hc+=o,Qa(vo=e,Po=t)}function Yv(){Wn.point=Qa}function CA(){Wn.point=RA}function kA(){Zv(Wv,Xv)}function RA(e,t){Wn.point=Zv,Qa(Wv=vo=e,Xv=Po=t)}function Zv(e,t){var r=e-vo,n=t-Po,o=Je(r*r+n*n);cm+=o*(vo+e)/2,fm+=o*(Po+t)/2,hc+=o,o=Po*e-vo*t,Mb+=o*(vo+e),Ob+=o*(Po+t),yu+=o*3,Qa(vo=e,Po=t)}var Cb=Wn;function um(e){this._context=e}um.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,Ut);break}}},result:Bt};var Rb=new Zr,kb,Qv,Jv,bu,gu,lm={point:Bt,lineStart:function(){lm.point=NA},lineEnd:function(){kb&&eP(Qv,Jv),lm.point=Bt},polygonStart:function(){kb=!0},polygonEnd:function(){kb=null},result:function(){var e=+Rb;return Rb=new Zr,e}};function NA(e,t){lm.point=eP,Qv=bu=e,Jv=gu=t}function eP(e,t){bu-=e,gu-=t,Rb.add(Je(bu*bu+gu*gu)),bu=e,gu=t}var Nb=lm;var tP,pm,rP,nP,yc=class{constructor(t){this._append=t==null?oP:AA(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==rP||this._append!==pm){let n=this._radius,o=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,rP=n,pm=this._append,nP=this._,this._=o}this._+=nP;break}}}result(){let t=this._;return this._="",t.length?t:null}};function oP(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return oP;if(t!==tP){let r=10**t;tP=t,pm=function(o){let i=1;this._+=o[0];for(let a=o.length;i=0))throw new RangeError(`invalid digits: ${s}`);r=c}return t===null&&(i=new yc(r)),a},a.projection(e).digits(r).context(t)}function gc(e){return{stream:xc(e)}}function xc(e){return function(t){var r=new Ab;for(var n in e)r[n]=e[n];return r.stream=t,r}}function Ab(){}Ab.prototype={constructor:Ab,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 Eb(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),Yn(r,e.stream(dc)),t(dc.result()),n!=null&&e.clipExtent(n),e}function xu(e,t,r){return Eb(e,function(n){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(o/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),s=+t[0][0]+(o-a*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([s,c])},r)}function mm(e,t,r){return xu(e,[[0,0],t],r)}function dm(e,t,r){return Eb(e,function(n){var o=+t,i=o/(n[1][0]-n[0][0]),a=(o-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];e.scale(150*i).translate([a,s])},r)}function hm(e,t,r){return Eb(e,function(n){var o=+t,i=o/(n[1][1]-n[0][1]),a=-i*n[0][0],s=(o-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,s])},r)}var iP=16,EA=ie(30*qe);function Fb(e,t){return+t?$A(e,t):FA(e)}function FA(e){return xc({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function $A(e,t){function r(n,o,i,a,s,c,u,f,m,l,p,h,y,b){var w=u-n,g=f-o,_=w*w+g*g;if(_>4*t&&y--){var x=a+l,I=s+p,S=c+h,v=Je(x*x+I*I+S*S),T=wt(S/=v),O=ge(ge(S)-1)t||ge((w*z+g*j)/_-.5)>.3||a*l+s*p+c*h2?M[2]%360*qe:0,z()):[s*$t,c*$t,u*$t]},C.angle=function(M){return arguments.length?(m=M%360*qe,z()):m*$t},C.reflectX=function(M){return arguments.length?(l=M?-1:1,z()):l<0},C.reflectY=function(M){return arguments.length?(p=M?-1:1,z()):p<0},C.precision=function(M){return arguments.length?(S=Fb(v,I=M*M),j()):Je(I)},C.fitExtent=function(M,U){return xu(C,M,U)},C.fitSize=function(M,U){return mm(C,M,U)},C.fitWidth=function(M,U){return dm(C,M,U)},C.fitHeight=function(M,U){return hm(C,M,U)};function z(){var M=aP(r,0,0,l,p,m).apply(null,t(i,a)),U=aP(r,n-M[0],o-M[1],l,p,m);return f=bb(s,c,u),v=lu(t,U),T=lu(f,v),S=Fb(v,I),j()}function j(){return O=R=null,C}return function(){return t=e.apply(this,arguments),C.invert=t.invert&&k,z()}}function wc(e){var t=0,r=pe/3,n=$b(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*qe,r=i[1]*qe):[t*$t,r*$t]},o}function sP(e){var t=ie(e);function r(n,o){return[n*t,ne(o)/t]}return r.invert=function(n,o){return[n/t,wt(o*t)]},r}function cP(e,t){var r=ne(e),n=(r+ne(t))/2;if(ge(n)=.12&&b<.234&&y>=-.425&&y<-.214?o:b>=.166&&b<.234&&y>=-.214&&y<-.115?a:r).invert(l)},f.stream=function(l){return e&&t===l?e:e=jA([r.stream(t=l),o.stream(l),a.stream(l)])},f.precision=function(l){return arguments.length?(r.precision(l),o.precision(l),a.precision(l),m()):r.precision()},f.scale=function(l){return arguments.length?(r.scale(l),o.scale(l*.35),a.scale(l),f.translate(r.translate())):r.scale()},f.translate=function(l){if(!arguments.length)return r.translate();var p=r.scale(),h=+l[0],y=+l[1];return n=r.translate(l).clipExtent([[h-.455*p,y-.238*p],[h+.455*p,y+.238*p]]).stream(u),i=o.translate([h-.307*p,y+.201*p]).clipExtent([[h-.425*p+ae,y+.12*p+ae],[h-.214*p-ae,y+.234*p-ae]]).stream(u),s=a.translate([h-.205*p,y+.212*p]).clipExtent([[h-.214*p+ae,y+.166*p+ae],[h-.115*p-ae,y+.234*p-ae]]).stream(u),m()},f.fitExtent=function(l,p){return xu(f,l,p)},f.fitSize=function(l,p){return mm(f,l,p)},f.fitWidth=function(l,p){return dm(f,l,p)},f.fitHeight=function(l,p){return hm(f,l,p)};function m(){return e=t=null,f}return f.scale(1070)}function ym(e){return function(t,r){var n=ie(t),o=ie(r),i=e(n*o);return i===1/0?[2,0]:[i*o*ne(t),i*ne(r)]}}function To(e){return function(t,r){var n=Je(t*t+r*r),o=e(n),i=ne(o),a=ie(o);return[rr(t*i,n*a),wt(n&&r*i/n)]}}var Lb=ym(function(e){return Je(2/(1+e))});Lb.invert=To(function(e){return 2*wt(e/2)});function Vb(){return nr(Lb).scale(124.75).clipAngle(180-.001)}var jb=ym(function(e){return(e=Qp(e))&&e/ne(e)});jb.invert=To(function(e){return e});function Ub(){return nr(jb).scale(79.4188).clipAngle(180-.001)}function Sc(e,t){return[e,Za(fc((Ke+t)/2))]}Sc.invert=function(e,t){return[e,2*xn(Xp(t))-Ke]};function Bb(){return zb(Sc).scale(961/Ut)}function zb(e){var t=nr(e),r=t.center,n=t.scale,o=t.translate,i=t.clipExtent,a=null,s,c,u;t.scale=function(m){return arguments.length?(n(m),f()):n()},t.translate=function(m){return arguments.length?(o(m),f()):o()},t.center=function(m){return arguments.length?(r(m),f()):r()},t.clipExtent=function(m){return arguments.length?(m==null?a=s=c=u=null:(a=+m[0][0],s=+m[0][1],c=+m[1][0],u=+m[1][1]),f()):a==null?null:[[a,s],[c,u]]};function f(){var m=pe*n(),l=t(Dv(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-m,l[1]-m],[l[0]+m,l[1]+m]]:e===Sc?[[Math.max(l[0]-m,a),s],[Math.min(l[0]+m,c),u]]:[[a,Math.max(l[1]-m,s)],[c,Math.min(l[1]+m,u)]])}return f()}function bm(e){return fc((Ke+e)/2)}function fP(e,t){var r=ie(e),n=e===t?ne(e):Za(r/ie(t))/Za(bm(t)/bm(e)),o=r*Zp(bm(e),n)/n;if(!n)return Sc;function i(a,s){o>0?s<-Ke+ae&&(s=-Ke+ae):s>Ke-ae&&(s=Ke-ae);var c=o/Zp(bm(s),n);return[c*ne(n*a),o-c*ie(n*a)]}return i.invert=function(a,s){var c=o-s,u=mr(n)*Je(a*a+c*c),f=rr(a,ge(c))*mr(c);return c*n<0&&(f-=pe*mr(a)*mr(c)),[f/n,2*xn(Zp(o/u,1/n))-Ke]},i}function Gb(){return wc(fP).scale(109.5).parallels([30,30])}function Ic(e,t){return[e,t]}Ic.invert=Ic;function Kb(){return nr(Ic).scale(152.63)}function uP(e,t){var r=ie(e),n=e===t?ne(e):(r-ie(t))/(t-e),o=r/n+e;if(ge(n)2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Et(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Pu(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 Tu=Symbol("implicit");function Ja(){var e=new Sr,t=[],r=[],n=Tu;function o(i){let a=e.get(i);if(a===void 0){if(n!==Tu)return n;e.set(i,a=t.push(i)-1)}return r[a%r.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new Sr;for(let a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(r=Array.from(i),o):r.slice()},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return Ja(t,r).unknown(n)},Et.apply(o,arguments),o}function na(){var e=Ja().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,i,a,s=!1,c=0,u=0,f=.5;delete e.unknown;function m(){var l=t().length,p=ot&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function zA(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?GA:zA,c=u=null,m}function m(l){return l==null||isNaN(l=+l)?i:(c||(c=s(e.map(n),t,r)))(n(a(l)))}return m.invert=function(l){return a(o((u||(u=s(t,e.map(n),st)))(l)))},m.domain=function(l){return arguments.length?(e=Array.from(l,_c),f()):e.slice()},m.range=function(l){return arguments.length?(t=Array.from(l),f()):t.slice()},m.rangeRound=function(l){return t=Array.from(l),r=Ha,f()},m.clamp=function(l){return arguments.length?(a=l?!0:Fr,f()):a!==Fr},m.interpolate=function(l){return arguments.length?(r=l,f()):r},m.unknown=function(l){return arguments.length?(i=l,m):i},function(l,p){return n=l,o=p,f()}}function Mu(){return es()(Fr,Fr)}function ag(e,t,r,n){var o=Js(e,t,r),i;switch(n=Io(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=pb(o,a))&&(n.precision=i),Yp(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=mb(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=lb(o))&&(n.precision=i-(n.type==="%")*2);break}}return gn(n)}function di(e){var t=e.domain;return e.ticks=function(r){var n=t();return ai(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return ag(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,i=n.length-1,a=n[o],s=n[i],c,u,f=10;for(s0;){if(u=jf(a,s,r),u===c)return n[o]=a,n[i]=s,t(n);if(u>0)a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u;else if(u<0)a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u;else break;c=u}return e},e}function ts(){var e=Mu();return e.copy=function(){return Mo(e,ts())},Et.apply(e,arguments),di(e)}function Ou(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,_c),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Ou(e).unknown(t)},e=arguments.length?Array.from(e,_c):[0,1],di(r)}function Cu(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],i=e[n],a;return iMath.pow(e,t)}function WA(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 hP(e){return(t,r)=>-e(-t,r)}function sg(e){let t=e(mP,dP),r=t.domain,n=10,o,i;function a(){return o=WA(n),i=YA(n),r()[0]<0?(o=hP(o),i=hP(i),e(KA,qA)):e(mP,dP),t}return t.base=function(s){return arguments.length?(n=+s,a()):n},t.domain=function(s){return arguments.length?(r(s),a()):r()},t.ticks=s=>{let c=r(),u=c[0],f=c[c.length-1],m=f0){for(;l<=p;++l)for(h=1;hf)break;w.push(y)}}else for(;l<=p;++l)for(h=n-1;h>=1;--h)if(y=l>0?h/i(-l):h*i(l),!(yf)break;w.push(y)}w.length*2{if(s==null&&(s=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Io(c)).precision==null&&(c.trim=!0),c=gn(c)),s===1/0)return c;let u=Math.max(1,n*s/t.ticks().length);return f=>{let m=f/i(Math.round(o(f)));return m*nr(Cu(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function ku(){let e=sg(es()).domain([1,10]);return e.copy=()=>Mo(e,ku()).base(e.base()),Et.apply(e,arguments),e}function yP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function bP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function cg(e){var t=1,r=e(yP(t),bP(t));return r.constant=function(n){return arguments.length?e(yP(t=+n),bP(t)):t},di(r)}function Ru(){var e=cg(es());return e.copy=function(){return Mo(e,Ru()).constant(e.constant())},Et.apply(e,arguments)}function gP(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function XA(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function ZA(e){return e<0?-e*e:e*e}function fg(e){var t=e(Fr,Fr),r=1;function n(){return r===1?e(Fr,Fr):r===.5?e(XA,ZA):e(gP(r),gP(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},di(t)}function Nu(){var e=fg(es());return e.copy=function(){return Mo(e,Nu()).exponent(e.exponent())},Et.apply(e,arguments),e}function Au(){var e=[],t=[],r=[],n;function o(){var a=0,s=Math.max(1,t.length);for(r=new Array(s-1);++a0?r[s-1]:e[0],s(e(i=new Date(+i)),i),o.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),o.round=i=>{let a=o(i),s=o.ceil(i);return i-a(t(i=new Date(+i),a==null?1:Math.floor(a)),i),o.range=(i,a,s)=>{let c=[];if(i=o.ceil(i),s=s==null?1:Math.floor(s),!(i0))return c;let u;do c.push(u=new Date(+i)),t(i,s),e(i);while(uZe(a=>{if(a>=a)for(;e(a),!i(a);)a.setTime(a-1)},(a,s)=>{if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!i(a););else for(;--s>=0;)for(;t(a,1),!i(a););}),r&&(o.count=(i,a)=>(ug.setTime(+i),lg.setTime(+a),e(ug),e(lg),Math.floor(r(ug,lg))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(n?a=>n(a)%i===0:a=>o.count(0,a)%i===0):o)),o}var Fu=Ze(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Fu.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ze(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Fu);var Lpe=Fu.range;var zt=Ze(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),xP=zt.range;var hi=Ze(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),QA=hi.range,yi=Ze(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),JA=yi.range;var bi=Ze(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),e7=bi.range,gi=Ze(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),t7=gi.range;var wn=Ze(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),r7=wn.range,os=Ze(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),n7=os.range,is=Ze(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),o7=is.range;function as(e){return Ze(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Qr=as(0),oa=as(1),xm=as(2),wm=as(3),Co=as(4),Sm=as(5),Im=as(6),SP=Qr.range,i7=oa.range,a7=xm.range,s7=wm.range,c7=Co.range,f7=Sm.range,u7=Im.range;function ss(e){return Ze(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var Jr=ss(0),ia=ss(1),_m=ss(2),vm=ss(3),ko=ss(4),Pm=ss(5),Tm=ss(6),IP=Jr.range,l7=ia.range,p7=_m.range,m7=vm.range,d7=ko.range,h7=Pm.range,y7=Tm.range;var xi=Ze(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()),b7=xi.range,wi=Ze(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()),g7=wi.range;var dr=Ze(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());dr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ze(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var x7=dr.range,hr=Ze(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());hr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ze(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var w7=hr.range;function vP(e,t,r,n,o,i){let a=[[zt,1,1e3],[zt,5,5*1e3],[zt,15,15*1e3],[zt,30,30*1e3],[i,1,6e4],[i,5,5*6e4],[i,15,15*6e4],[i,30,30*6e4],[o,1,36e5],[o,3,3*36e5],[o,6,6*36e5],[o,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function s(u,f,m){let l=fb).right(a,l);if(p===a.length)return e.every(Js(u/31536e6,f/31536e6,m));if(p===0)return Fu.every(Math.max(Js(u,f,m),1));let[h,y]=a[l/a[p-1][2]53)return null;"w"in E||(E.w=1),"Z"in E?(G=bg(Du(E.y,0,1)),oe=G.getUTCDay(),G=oe>4||oe===0?ia.ceil(G):ia(G),G=os.offset(G,(E.V-1)*7),E.y=G.getUTCFullYear(),E.m=G.getUTCMonth(),E.d=G.getUTCDate()+(E.w+6)%7):(G=yg(Du(E.y,0,1)),oe=G.getDay(),G=oe>4||oe===0?oa.ceil(G):oa(G),G=wn.offset(G,(E.V-1)*7),E.y=G.getFullYear(),E.m=G.getMonth(),E.d=G.getDate()+(E.w+6)%7)}else("W"in E||"U"in E)&&("w"in E||(E.w="u"in E?E.u%7:"W"in E?1:0),oe="Z"in E?bg(Du(E.y,0,1)).getUTCDay():yg(Du(E.y,0,1)).getDay(),E.m=0,E.d="W"in E?(E.w+6)%7+E.W*7-(oe+5)%7:E.w+E.U*7-(oe+6)%7);return"Z"in E?(E.H+=E.Z/100|0,E.M+=E.Z%100,bg(E)):yg(E)}}function T(A,B,Q,E){for(var me=0,G=B.length,oe=Q.length,ue,Ce;me=oe)return-1;if(ue=B.charCodeAt(me++),ue===37){if(ue=B.charAt(me++),Ce=I[ue in PP?B.charAt(me++):ue],!Ce||(E=Ce(A,Q,E))<0)return-1}else if(ue!=Q.charCodeAt(E++))return-1}return E}function O(A,B,Q){var E=u.exec(B.slice(Q));return E?(A.p=f.get(E[0].toLowerCase()),Q+E[0].length):-1}function R(A,B,Q){var E=p.exec(B.slice(Q));return E?(A.w=h.get(E[0].toLowerCase()),Q+E[0].length):-1}function C(A,B,Q){var E=m.exec(B.slice(Q));return E?(A.w=l.get(E[0].toLowerCase()),Q+E[0].length):-1}function k(A,B,Q){var E=w.exec(B.slice(Q));return E?(A.m=g.get(E[0].toLowerCase()),Q+E[0].length):-1}function z(A,B,Q){var E=y.exec(B.slice(Q));return E?(A.m=b.get(E[0].toLowerCase()),Q+E[0].length):-1}function j(A,B,Q){return T(A,t,B,Q)}function M(A,B,Q){return T(A,r,B,Q)}function U(A,B,Q){return T(A,n,B,Q)}function L(A){return a[A.getDay()]}function re(A){return i[A.getDay()]}function V(A){return c[A.getMonth()]}function q(A){return s[A.getMonth()]}function H(A){return o[+(A.getHours()>=12)]}function W(A){return 1+~~(A.getMonth()/3)}function te(A){return a[A.getUTCDay()]}function be(A){return i[A.getUTCDay()]}function K(A){return c[A.getUTCMonth()]}function Z(A){return s[A.getUTCMonth()]}function Y(A){return o[+(A.getUTCHours()>=12)]}function ee(A){return 1+~~(A.getUTCMonth()/3)}return{format:function(A){var B=S(A+="",_);return B.toString=function(){return A},B},parse:function(A){var B=v(A+="",!1);return B.toString=function(){return A},B},utcFormat:function(A){var B=S(A+="",x);return B.toString=function(){return A},B},utcParse:function(A){var B=v(A+="",!0);return B.toString=function(){return A},B}}}var PP={"-":"",_:" ",0:"0"},Gt=/^\s*\d+/,I7=/^%/,_7=/[\\^$*+?|[\]().{}]/g;function De(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i[t.toLowerCase(),r]))}function P7(e,t,r){var n=Gt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function T7(e,t,r){var n=Gt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function M7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function O7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function C7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function TP(e,t,r){var n=Gt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function MP(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function k7(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function R7(e,t,r){var n=Gt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function N7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function OP(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A7(e,t,r){var n=Gt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function CP(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function E7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function F7(e,t,r){var n=Gt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function $7(e,t,r){var n=Gt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function D7(e,t,r){var n=Gt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function L7(e,t,r){var n=I7.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function V7(e,t,r){var n=Gt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function j7(e,t,r){var n=Gt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function kP(e,t){return De(e.getDate(),t,2)}function U7(e,t){return De(e.getHours(),t,2)}function B7(e,t){return De(e.getHours()%12||12,t,2)}function z7(e,t){return De(1+wn.count(dr(e),e),t,3)}function FP(e,t){return De(e.getMilliseconds(),t,3)}function G7(e,t){return FP(e,t)+"000"}function K7(e,t){return De(e.getMonth()+1,t,2)}function q7(e,t){return De(e.getMinutes(),t,2)}function H7(e,t){return De(e.getSeconds(),t,2)}function Y7(e){var t=e.getDay();return t===0?7:t}function W7(e,t){return De(Qr.count(dr(e)-1,e),t,2)}function $P(e){var t=e.getDay();return t>=4||t===0?Co(e):Co.ceil(e)}function X7(e,t){return e=$P(e),De(Co.count(dr(e),e)+(dr(e).getDay()===4),t,2)}function Z7(e){return e.getDay()}function Q7(e,t){return De(oa.count(dr(e)-1,e),t,2)}function J7(e,t){return De(e.getFullYear()%100,t,2)}function eE(e,t){return e=$P(e),De(e.getFullYear()%100,t,2)}function tE(e,t){return De(e.getFullYear()%1e4,t,4)}function rE(e,t){var r=e.getDay();return e=r>=4||r===0?Co(e):Co.ceil(e),De(e.getFullYear()%1e4,t,4)}function nE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+De(t/60|0,"0",2)+De(t%60,"0",2)}function RP(e,t){return De(e.getUTCDate(),t,2)}function oE(e,t){return De(e.getUTCHours(),t,2)}function iE(e,t){return De(e.getUTCHours()%12||12,t,2)}function aE(e,t){return De(1+os.count(hr(e),e),t,3)}function DP(e,t){return De(e.getUTCMilliseconds(),t,3)}function sE(e,t){return DP(e,t)+"000"}function cE(e,t){return De(e.getUTCMonth()+1,t,2)}function fE(e,t){return De(e.getUTCMinutes(),t,2)}function uE(e,t){return De(e.getUTCSeconds(),t,2)}function lE(e){var t=e.getUTCDay();return t===0?7:t}function pE(e,t){return De(Jr.count(hr(e)-1,e),t,2)}function LP(e){var t=e.getUTCDay();return t>=4||t===0?ko(e):ko.ceil(e)}function mE(e,t){return e=LP(e),De(ko.count(hr(e),e)+(hr(e).getUTCDay()===4),t,2)}function dE(e){return e.getUTCDay()}function hE(e,t){return De(ia.count(hr(e)-1,e),t,2)}function yE(e,t){return De(e.getUTCFullYear()%100,t,2)}function bE(e,t){return e=LP(e),De(e.getUTCFullYear()%100,t,2)}function gE(e,t){return De(e.getUTCFullYear()%1e4,t,4)}function xE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?ko(e):ko.ceil(e),De(e.getUTCFullYear()%1e4,t,4)}function wE(){return"+0000"}function NP(){return"%"}function AP(e){return+e}function EP(e){return Math.floor(+e/1e3)}var vc,Pc,VP,Ro,jP;xg({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function xg(e){return vc=gg(e),Pc=vc.format,VP=vc.parse,Ro=vc.utcFormat,jP=vc.utcParse,vc}function SE(e){return new Date(e)}function IE(e){return e instanceof Date?+e:+new Date(+e)}function Mm(e,t,r,n,o,i,a,s,c,u){var f=Mu(),m=f.invert,l=f.domain,p=u(".%L"),h=u(":%S"),y=u("%I:%M"),b=u("%I %p"),w=u("%a %d"),g=u("%b %d"),_=u("%B"),x=u("%Y");function I(S){return(c(S)Wy(e[e.length-1]);var Em=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),Fm=se(Em);var $m=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),Dm=se($m);var Lm=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),Vm=se(Lm);var jm=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),Um=se(jm);var Bu=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),Tc=se(Bu);var Bm=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),zm=se(Bm);var zu=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),Mc=se(zu);var Gm=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),Km=se(Gm);var qm=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),Hm=se(qm);var Ym=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),Wm=se(Ym);var Xm=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Zm=se(Xm);var Qm=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),Jm=se(Qm);var ed=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),td=se(ed);var rd=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),nd=se(rd);var od=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),id=se(od);var ad=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),sd=se(ad);var cd=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),fd=se(cd);var ud=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),ld=se(ud);var pd=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),md=se(pd);var dd=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),hd=se(dd);var yd=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),bd=se(yd);var gd=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),xd=se(gd);var wd=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),Sd=se(wd);var Id=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),_d=se(Id);var vd=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),Pd=se(vd);var Td=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),Md=se(Td);var Od=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),Cd=se(Od);function kd(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var Rd=ac(_r(300,.5,0),_r(-240,.5,1));var Ad=ac(_r(-100,.75,.35),_r(80,1.5,.8)),Ed=ac(_r(260,.75,.35),_r(80,1.5,.8)),Nd=_r();function Fd(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Nd.h=360*e-100,Nd.s=1.5-1.5*t,Nd.l=.8-.9*t,Nd+""}var $d=yn(),_E=Math.PI/3,vE=Math.PI*2/3;function Dd(e){var t;return e=(.5-e)*Math.PI,$d.r=255*(t=Math.sin(e))*t,$d.g=255*(t=Math.sin(e+_E))*t,$d.b=255*(t=Math.sin(e+vE))*t,$d+""}function Ld(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function Vd(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var jd=Vd(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Ud=Vd(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Bd=Vd(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),zd=Vd(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function cs(e){return function(){return e}}var Rg=Math.cos;var Oc=Math.min,Gu=Math.sin,Le=Math.sqrt,Ng=1e-12,fs=Math.PI,fye=fs/2,Cc=2*fs;function UP(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new ea(t)}var mye=Array.prototype.slice;function BP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zP(e){this._context=e}zP.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 us(e){return new zP(e)}function GP(e){return e[0]}function KP(e){return e[1]}function Ag(e,t){var r=cs(!0),n=null,o=us,i=null,a=UP(s);e=typeof e=="function"?e:e===void 0?GP:cs(e),t=typeof t=="function"?t:t===void 0?KP:cs(t);function s(c){var u,f=(c=BP(c)).length,m,l=!1,p;for(n==null&&(i=o(p=a())),u=0;u<=f;++u)!(u0)for(var n=e[0],o=t[0],i=e[r]-n,a=t[r]-o,s=-1,c;++s<=r;)c=s/r,this._basis.point(this._beta*e[s]+(1-this._beta)*(n+c*i),this._beta*t[s]+(1-this._beta)*(o+c*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var Bg=(function e(t){function r(n){return t===1?new rl(n):new XP(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Nc(e,t,r){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-r),e._x2,e._y2)}function qd(e,t){this._context=e,this._k=(1-t)/6}qd.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:Nc(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:Nc(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}};var zg=(function e(t){function r(n){return new qd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Hd(e,t){this._context=e,this._k=(1-t)/6}Hd.prototype={areaStart:_n,areaEnd:_n,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:Nc(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}};var Gg=(function e(t){function r(n){return new Hd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Yd(e,t){this._context=e,this._k=(1-t)/6}Yd.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:Nc(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}};var Kg=(function e(t){function r(n){return new Yd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function nl(e,t,r){var n=e._x1,o=e._y1,i=e._x2,a=e._y2;if(e._l01_a>Ng){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);n=(n*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,o=(o*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>Ng){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,f=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*u+e._x1*e._l23_2a-t*e._l12_2a)/f,a=(a*u+e._y1*e._l23_2a-r*e._l12_2a)/f}e._context.bezierCurveTo(n,o,i,a,e._x2,e._y2)}function ZP(e,t){this._context=e,this._alpha=t}ZP.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:nl(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}};var qg=(function e(t){function r(n){return t?new ZP(n,t):new qd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function QP(e,t){this._context=e,this._alpha=t}QP.prototype={areaStart:_n,areaEnd:_n,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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:nl(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}};var Hg=(function e(t){function r(n){return t?new QP(n,t):new Hd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function JP(e,t){this._context=e,this._alpha=t}JP.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:nl(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}};var Yg=(function e(t){function r(n){return t?new JP(n,t):new Yd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function eT(e){this._context=e}eT.prototype={areaStart:_n,areaEnd:_n,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 Wg(e){return new eT(e)}function tT(e){return e<0?-1:1}function rT(e,t,r){var n=e._x1-e._x0,o=t-e._x1,i=(e._y1-e._y0)/(n||o<0&&-0),a=(r-e._y1)/(o||n<0&&-0),s=(i*o+a*n)/(n+o);return(tT(i)+tT(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function nT(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Xg(e,t,r){var n=e._x0,o=e._y0,i=e._x1,a=e._y1,s=(i-n)/3;e._context.bezierCurveTo(n+s,o+s*t,i-s,a-s*r,i,a)}function Wd(e){this._context=e}Wd.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:Xg(this,this._t0,nT(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 r=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,Xg(this,nT(this,r=rT(this,e,t)),r);break;default:Xg(this,this._t0,r=rT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function oT(e){this._context=new iT(e)}(oT.prototype=Object.create(Wd.prototype)).point=function(e,t){Wd.prototype.point.call(this,t,e)};function iT(e){this._context=e}iT.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,r,n,o,i){this._context.bezierCurveTo(t,e,n,r,i,o)}};function Zg(e){return new Wd(e)}function Qg(e){return new oT(e)}function sT(e){this._context=e}sT.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=aT(e),o=aT(t),i=0,a=1;a=0;--t)o[t]=(a[t]-o[t+1])/i[t];for(i[r-1]=(e[r]+o[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function ex(e){return new Xd(e,.5)}function tx(e){return new Xd(e,0)}function rx(e){return new Xd(e,1)}function aa(e,t,r){this.k=e,this.x=t,this.y=r}aa.prototype={constructor:aa,scale:function(e){return e===1?this:new aa(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new aa(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nx=new aa(1,0,0);ox.prototype=aa.prototype;function ox(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nx;return e.__zoom}function vn(e){return e!=null&&!Number.isNaN(e)}function $r(e,t){return+vn(t)-+vn(e)||ht(e,t)}function ls(e,t){return+vn(t)-+vn(e)||mn(e,t)}function ol(e){return e!=null&&`${e}`!=""}function ix(e){return isFinite(e)?e:NaN}function ps(e){return e>0&&isFinite(e)?e:NaN}function Ac(e){return e<0&&isFinite(e)?e:NaN}function Zd(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return`${NE(e.getUTCFullYear(),4)}-${Ii(e.getUTCMonth()+1,2)}-${Ii(e.getUTCDate(),2)}${r||n||o||i?`T${Ii(r,2)}:${Ii(n,2)}${o||i?`:${Ii(o,2)}${i?`.${Ii(i,3)}`:""}`:""}Z`:""}`}function NE(e){return e<0?`-${Ii(-e,6)}`:e>9999?`+${Ii(e,6)}`:Ii(e,4)}function Ii(e,t){return`${e}`.padStart(t,"0")}var AE=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function il(e,t){return AE.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function _i(e){if(e==null)return;let t=e[0],r=e[e.length-1];return mn(t,r)}var Fc=1e3,ca=Fc*60,fa=ca*60,Ao=fa*24,No=Ao*7,ms=Ao*30,sa=Ao*365,ax=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",Fc],["5 seconds",5*Fc],["15 seconds",15*Fc],["30 seconds",30*Fc],["minute",ca],["5 minutes",5*ca],["15 minutes",15*ca],["30 minutes",30*ca],["hour",fa],["3 hours",3*fa],["6 hours",6*fa],["12 hours",12*fa],["day",Ao],["2 days",2*Ao],["week",No],["2 weeks",2*No],["month",ms],["3 months",3*ms],["6 months",6*ms],["year",sa],["2 years",2*sa],["5 years",5*sa],["10 years",10*sa],["20 years",20*sa],["50 years",50*sa],["100 years",100*sa]],sx=new Map([["second",Fc],["minute",ca],["hour",fa],["day",Ao],["monday",No],["tuesday",No],["wednesday",No],["thursday",No],["friday",No],["saturday",No],["sunday",No],["week",No],["month",ms],["year",sa]]),fT=new Map([["second",zt],["minute",hi],["hour",bi],["day",wn],["monday",oa],["tuesday",xm],["wednesday",wm],["thursday",Co],["friday",Sm],["saturday",Im],["sunday",Qr],["week",Qr],["month",xi],["year",dr]]),cx=new Map([["second",zt],["minute",yi],["hour",gi],["day",is],["monday",ia],["tuesday",_m],["wednesday",vm],["thursday",ko],["friday",Pm],["saturday",Tm],["sunday",Jr],["week",Jr],["month",wi],["year",hr]]),$c=Symbol("intervalDuration"),Jd=Symbol("intervalType");for(let[e,t]of fT)t[$c]=sx.get(e),t[Jd]="time";for(let[e,t]of cx)t[$c]=sx.get(e),t[Jd]="utc";var al=[["year",hr,"utc"],["month",wi,"utc"],["day",is,"utc",6*ms],["hour",gi,"utc",3*Ao],["minute",yi,"utc",6*fa],["second",zt,"utc",30*ca]],Qd=[["year",dr,"time"],["month",xi,"time"],["day",wn,"time",6*ms],["hour",bi,"time",3*Ao],["minute",hi,"time",6*fa],["second",zt,"time",30*ca]],EE=[al[0],Qd[0],al[1],Qd[1],al[2],Qd[2],...al.slice(3)];function uT(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let o=cx.get(t);if(!o)throw new Error(`unknown interval: ${e}`);if(r>1&&!o.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function fx(e){return lT(uT(e),"time")}function ux(e){return lT(uT(e),"utc")}function lT([e,t],r){let n=(r==="time"?fT:cx).get(e);return t>1&&(n=n.every(t),n[$c]=sx.get(e)*t,n[Jd]=r),n}function lx(e,t){if(!(t>1))return;let r=e[$c];if(!ax.some(([,o])=>o===r)||r%Ao===0&&AoMath.log(o)).center(ax,Math.log(r*t))];return(e[Jd]==="time"?fx:ux)(n)}function cT(e,t,r){let n=t==="time"?Pc:Ro;if(r==null)return n(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o=FE(r);switch(e){case"millisecond":return Ec(n(".%L"),n(":%M:%S"),o);case"second":return Ec(n(":%S"),n("%-I:%M"),o);case"minute":return Ec(n("%-I:%M"),n("%p"),o);case"hour":return Ec(n("%-I %p"),n("%b %-d"),o);case"day":return Ec(n("%-d"),n("%b"),o);case"month":return Ec(n("%b"),n("%Y"),o);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function FE(e){return e==="left"||e==="right"?(t,r)=>` ${t} ${r}`:e==="top"?(t,r)=>`${r} ${t}`:(t,r)=>`${t} -${r}`}function M9(e){return e==="time"?xd:e==="utc"?Ou:v9}function a6(e,t,r){let n=Nt($l(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return r6("millisecond","utc",r);for(let[o,i,a,s]of M9(e)){if(n>s||o==="hour"&&!n)break;if(t.every(f=>i.floor(f)>=f))return r6(o,a,r)}}function cf(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),f=o-ni(i);return o!==f&&i[f]!==void 0&&s===t(i[f],f)?a:r(a,s)}}var wg=Object.getPrototypeOf(Uint8Array),O9=Object.prototype.toString;function Dn(e){return e instanceof Array||e instanceof wg}function c6(e){return e instanceof wg&&!R9(e)}function u6(e){return e?.prototype instanceof wg&&!C9(e)}function R9(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function C9(e){return e===BigInt64Array||e===BigUint64Array}var Sg=Symbol("reindex");function Vt(e,t,r){let n=typeof t;return n==="string"?k6(e)?Ig(e.getChild(t),r):s6(e,_g(t),r):n==="function"?s6(e,t,r):n==="number"||t instanceof Date||n==="boolean"?We(e,Gr(t),r):typeof t?.transform=="function"?bg(t.transform(e),r):A9(bg(t,r),e?.[Sg])}function A9(e,t){return e!=null&&t?wd(e,t):e}function s6(e,t,r){return We(e,u6(r)?(n,o)=>Tg(t(n,o)):t,r)}function bg(e,t){return t===void 0?bo(e):N6(e)?Ig(e,t):e instanceof t?e:t.from(e,u6(t)&&!c6(e)?Tg:void 0)}function Ig(e,t){return e==null?e:(t===void 0||t===Array)&&E9(e.type)?Mg(f6(e)):bg(f6(e),t)}function f6(e){return e.nullCount?e.toJSON():e.toArray()}var pf=[null],_g=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},Ru={transform:Rr},dt={transform:e=>e};var l6=()=>1,p6=()=>!0,wt=e=>e==null?e:`${e}`,St=e=>e==null?e:+e;var vg=e=>e?e[0]:void 0,m6=e=>e?e[1]:void 0;var Gr=e=>()=>e;function d6(e){let t=+`${e}`.slice(1)/100;return(r,n)=>jo(r,t,n)}function za(e){return c6(e)?e:We(e,Tg,Float64Array)}function Tg(e){return e==null?NaN:Number(e)}function Mg(e){return We(e,P9)}function P9(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Mu(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function go(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:hf(e)?[void 0,e]:[e,void 0]}function ht(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function Og(e,t,r){if(e!=null)return yr(e,t,r)}function yr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function oi(e){return k6(e)?e:bo(e)}function bo(e){if(e==null||Dn(e))return e;if(N6(e))return Ig(e);if(h6(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function h6(e){switch(e?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function We(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function Bi(e,t=Array){return e instanceof t?e.slice():t.from(e)}function y6({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function Rg({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function x6(e){return y6(e)||Rg(e)||e.interval!==void 0}function wo(e){return e?.toString===O9}function mf(e){return wo(e)&&(e.type!==void 0||e.domain!==void 0)}function df(e){return wo(e)&&typeof e.transform!="function"}function Gi(e){return df(e)&&e.value===void 0&&e.channel===void 0}function g6(e,t,r,n=dt){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function ii(e,t){return e===void 0&&t===void 0?[vg,m6]:[e,t]}function bd({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=go(t)),e===void 0&&([e]=go(r)),e}function zi(e){return Dn(e)?e.length:e?.numRows}function Rr(e){let t=zi(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):We(t,r=>e.at(r))}function b6(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function dn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Cu(e){let t;return[{transform:()=>t,label:Ki(e)},r=>t=r]}function w6(e){return e==null?[e]:Cu(e)}function Ki(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function S6(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return Dt(n)||Dt(o)?We(n,(i,a)=>new Date((+n[a]+ +o[a])/2)):We(n,(i,a)=>(+n[a]+ +o[a])/2,Float64Array)},label:e.label}}function I6(e,t){let r=Cg(t?.interval,t?.type);return r?We(e,r):e}function Cg(e,t){let r=Sd(e,t);return r&&(n=>mn(n)?r.floor(n):n)}function Sd(e,t){if(e!=null){if(typeof e=="number")return k9(e);if(typeof e=="string")return(t==="time"?yg:xg)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function k9(e){e=+e,0Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>xa(Math.ceil(r*t),n*t).map(o=>o/t)}:{floor:r=>Math.floor(r/t)*t,offset:(r,n=1)=>r+t*Math.floor(n),range:(r,n)=>xa(Math.ceil(r/t),n/t).map(o=>o*t)}}function qi(e,t){if(e=Sd(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function _6(e,t){if(e=qi(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function v6(e){return typeof e?.range=="function"}function Hi(e){return e===void 0||df(e)?e:{value:e}}function T6(e){return e==null?null:{transform:t=>Vt(t,e,Float64Array),label:Ki(e)}}function hn(e){return e&&typeof e[Symbol.iterator]=="function"}function Id(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ag(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Dt(e){for(let t of e)if(t!=null)return t instanceof Date}function M6(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Mu(t)}function O6(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function R6(e){for(let t of e)if(t!=null)return typeof t=="number"}function _d(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var N9=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function hf(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||N9.has(e))}function C6(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Ut(e){return e==null||Ka(e)}function Ka(e){return/^\s*none\s*$/i.test(e)}function A6(e){return/^\s*round\s*$/i.test(e)}function vd(e,t){return Og(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Yi(e="middle"){return vd(e,"frameAnchor")}function P6(e={},...t){let r=e;for(let n of t)for(let o in n)if(r[o]===void 0){let i=n[o];r===e?r={...r,[o]:i}:r[o]=i}return r}function F9(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let o=`${n}`;if(o==="__proto__")throw new Error(`illegal name: ${o}`);if(t.has(o))throw new Error(`duplicate name: ${o}`);return t.add(o),[n,r]}))}function Pg(e){return hn(e)?F9(e):e}function Td(e){return e===!0?e="frame":e===!1?e=null:!h6(e)&&e!=null&&(e=yr(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function k6(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function N6(e){return e&&typeof e.toArray=="function"&&e.type}function E9(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var yn=Symbol("position"),zr=Symbol("color"),qa=Symbol("radius"),Ha=Symbol("length"),Ya=Symbol("opacity"),yf=Symbol("symbol"),F6=Symbol("projection"),Be=new Map([["x",yn],["y",yn],["fx",yn],["fy",yn],["r",qa],["color",zr],["opacity",Ya],["symbol",yf],["length",Ha],["projection",F6]]);function E6(e){return e===yn||e===F6}function $6(e){return e===yn||e===qa||e===Ha||e===Ya}var $9=Math.sqrt(3),L9=2/$9,D9={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*L9,o=n/2;e.moveTo(0,n),e.lineTo(r,o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-r,o),e.closePath()}},kg=new Map([["asterisk",pu],["circle",ti],["cross",mu],["diamond",du],["diamond2",hu],["hexagon",D9],["plus",yu],["square",xu],["square2",gu],["star",bu],["times",of],["triangle",wu],["triangle2",Su],["wye",Iu]]);function Ng(e){return e&&typeof e.draw=="function"}function L6(e){return Ng(e)?!0:typeof e!="string"?!1:kg.has(e.toLowerCase())}function xf(e){if(e==null||Ng(e))return e;let t=kg.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function D6(e){if(e==null||Ng(e))return[void 0,e];if(typeof e=="string"){let t=kg.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function Au({filter:e,sort:t,reverse:r,transform:n,initializer:o,...i}={},a){if(n===void 0&&(e!=null&&(n=V6(e)),t!=null&&!Gi(t)&&(n=Fg(n,$g(t))),r&&(n=Fg(n,U6))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||Gi(t))&&{sort:t},transform:Fg(n,a)}}function ai({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=V6(e)),t!=null&&!Gi(t)&&(n=Eg(n,$g(t))),r&&(n=Eg(n,U6))),{...o,...(t===null||Gi(t))&&{sort:t},initializer:Eg(n,i)}}function Fg(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,o){return{data:r,facets:n}=e.call(this,r,n,o),t.call(this,oi(r),n,o)}}function Eg(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,o,...i){let a,s,f,u,c,m;return{data:s=r,facets:f=n,channels:a}=e.call(this,r,n,o,...i),{data:c=s,facets:m=f,channels:u}=t.call(this,s,f,{...o,...a},...i),{data:c,facets:m,channels:{...a,...u}}}}function V9(e,t){return(e.initializer!=null?ai:Au)(e,t)}function V6(e){return(t,r)=>{let n=Vt(t,e);return{data:t,facets:r.map(o=>o.filter(i=>n[i]))}}}function U6(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function j6(e,{sort:t,...r}={}){return{...(df(e)&&e.channel!==void 0?ai:V9)(r,$g(e)),sort:Gi(t)?t:null}}function $g(e){return(typeof e=="function"&&e.length!==1?U9:j9)(e)}function U9(e){return(t,r)=>{let n=Dn(t)?(o,i)=>e(t[o],t[i]):(o,i)=>e(t.get(o),t.get(i));return{data:t,facets:r.map(o=>o.slice().sort(n))}}}function j9(e){let t,r;({channel:t,value:e,order:r}={...Hi(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?ja:Or),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Or;break;case"descending":r=ja;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=Vt(o,e);else{if(a===void 0)throw new Error("channel sort requires an initializer");if(s=a[t],!s)return{};s=s.value}let f=(u,c)=>r(s[u],s[c]);return{data:o,facets:i.map(u=>u.slice().sort(f))}}}function K6(e,t,r=B9){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&wo(e))return G9(e);if(typeof e=="function")return z9(e);if(/^p\d{2}$/i.test(e))return si(d6(e));switch(`${e}`.toLowerCase()){case"first":return q9;case"last":return H9;case"identity":return K9;case"count":return G6;case"distinct":return Y9;case"sum":return t==null?G6:W9;case"proportion":return z6(t,"data");case"proportion-facet":return z6(t,"facet");case"deviation":return si(Cl);case"min":return si(mr);case"min-index":return si(kl);case"max":return si(Nt);case"max-index":return si(Pl);case"mean":return B6(Fl);case"median":return B6(ya);case"variance":return si(Ts);case"mode":return si(El)}return r(e)}function B9(e){throw new Error(`invalid reduce: ${e}`)}function G9(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function z9(e){return{reduceIndex(t,r,n){return e(wd(r,t),n)}}}function si(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function B6(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return Dt(r)?new Date(n):n}}}var K9={reduceIndex(e,t){return wd(t,e)}},q9={reduceIndex(e,t){return t[e[0]]}};var H9={reduceIndex(e,t){return t[e[e.length-1]]}},G6={label:"Frequency",reduceIndex(e){return e.length}},Y9={label:"Distinct",reduceIndex(e,t){let r=new Pn;for(let n of e)r.add(t[n]);return r.size}},W9=si(rn);function z6(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>rn(r,i=>n[i])/o}}function gf(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=Ki(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),Dg(s,{scale:t,type:r,value:Vt(e,n),label:a,filter:o,hint:i})}function H6(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,gf(t,n,r)]))}function Y6(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:o,value:i}])=>{let a=o==null?null:t[o];return[n,a==null?i:We(i,a)]}));return r.channels=e,r}function Dg(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&_d(n,hf)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&_d(n,C6)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&_d(n,L6)?(t.scale=null,t.value=We(n,xf)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=Be.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Be.has(r))throw new Error(`unknown scale: ${r}`);return t}function W6(e,t,r,n,o){let{order:i,reverse:a,reduce:s=!0,limit:f}=o;for(let u in o){if(!Be.has(u))continue;let{value:c,order:m=i,reverse:l=a,reduce:p=s,limit:d=f}=Hi(o[u]),y=c?.startsWith("-");if(y&&(c=c.slice(1)),m=m===void 0?y!==(c==="width"||c==="height")?Z6:X6:Q9(m),p==null||p===!1)continue;let x=u==="fx"||u==="fy"?Z9(t,n[u]):X9(r,u);if(!x)throw new Error(`missing channel for scale: ${u}`);let w=x.value,[g=0,S=1/0]=hn(d)?d:d<0?[d]:[0,d];if(c==null)x.domain=()=>{let b=Array.from(new Pn(w));return l&&(b=b.reverse()),(g!==0||S!==1/0)&&(b=b.slice(g,S)),b};else{let b=c==="data"?e:c==="height"?q6(r,"y1","y2"):c==="width"?q6(r,"x1","x2"):Lg(r,c,c==="y"?"y2":c==="x"?"x2":void 0),T=K6(p===!0?"max":p,b);x.domain=()=>{let I=F0(Rr(w),v=>T.reduceIndex(v,b),v=>w[v]);return m&&I.sort(m),l&&I.reverse(),(g!==0||S!==1/0)&&(I=I.slice(g,S)),I.map(vg)}}}}function X9(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function Z9(e,t){let r=e.original;if(r===e)return t;let n=t.value,o=t.value=[];for(let i=0;iMath.abs(i-n[a]),Float64Array)}function Lg(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function Q9(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return X6;case"descending":return Z6}throw new Error(`invalid order: ${e}`)}function X6([e,t],[r,n]){return Or(t,n)||Or(e,r)}function Z6([e,t],[r,n]){return ja(t,n)||Or(e,r)}function Vg(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var rT=new Map([["accent",Rx],["category10",Ox],["dark2",Cx],["observable10",Ax],["paired",Px],["pastel1",kx],["pastel2",Nx],["set1",Fx],["set2",Ex],["set3",$x],["tableau10",Lx]]);function nT(e){return e!=null&&rT.has(`${e}`.toLowerCase())}var Q6=new Map([...rT,["brbg",fi(Jp,em)],["prgn",fi(tm,rm)],["piyg",fi(nm,om)],["puor",fi(im,am)],["rdbu",fi(cu,ef)],["rdgy",fi(sm,fm)],["rdylbu",fi(uu,tf)],["rdylgn",fi(cm,um)],["spectral",fi(lm,pm)],["burd",J6(cu,ef)],["buylrd",J6(uu,tf)],["blues",jt(Lm,Dm)],["greens",jt(Vm,Um)],["greys",jt(jm,Bm)],["oranges",jt(Hm,Ym)],["purples",jt(Gm,zm)],["reds",jt(Km,qm)],["turbo",ci(nd)],["viridis",ci(id)],["magma",ci(ad)],["inferno",ci(sd)],["plasma",ci(fd)],["cividis",ci(Wm)],["cubehelix",ci(Xm)],["warm",ci(Qm)],["cool",ci(Jm)],["bugn",jt(mm,dm)],["bupu",jt(hm,ym)],["gnbu",jt(xm,gm)],["orrd",jt(bm,wm)],["pubu",jt(_m,vm)],["pubugn",jt(Sm,Im)],["purd",jt(Tm,Mm)],["rdpu",jt(Om,Rm)],["ylgn",jt(Pm,km)],["ylgnbu",jt(Cm,Am)],["ylorbr",jt(Nm,Fm)],["ylorrd",jt(Em,$m)],["rainbow",eT(ed)],["sinebow",eT(rd)]]);function jt(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?ir(t,r):e[r])}function fi(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?ir(t,r):e[r])}function J6(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?ir(n=>t(1-n),r):e[r].slice().reverse())}function ci(e){return({length:t})=>ir(e,Math.max(2,Math.floor(t)))}function eT(e){return({length:t})=>ir(e,Math.floor(t)+1).slice(0,-1)}function Ug(e){let t=`${e}`.toLowerCase();if(!Q6.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return Q6.get(t)}function Pu(e,t){let r=Ug(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function oT(e,t="greys"){let r=new Set,[n,o]=Pu(t,2);for(let i of e)if(i!=null)if(i===!0)r.add(o);else if(i===!1)r.add(n);else return;return[...r]}var tT=new Map([["brbg",em],["prgn",rm],["piyg",om],["puor",am],["rdbu",ef],["rdgy",fm],["rdylbu",tf],["rdylgn",um],["spectral",pm],["burd",e=>ef(1-e)],["buylrd",e=>tf(1-e)],["blues",Dm],["greens",Um],["greys",Bm],["purples",zm],["reds",qm],["oranges",Ym],["turbo",nd],["viridis",id],["magma",ad],["inferno",sd],["plasma",fd],["cividis",Wm],["cubehelix",Xm],["warm",Qm],["cool",Jm],["bugn",dm],["bupu",ym],["gnbu",gm],["orrd",wm],["pubugn",Im],["pubu",vm],["purd",Mm],["rdpu",Rm],["ylgnbu",Am],["ylgn",km],["ylorbr",Fm],["ylorrd",$m],["rainbow",ed],["sinebow",rd]]);function bf(e){let t=`${e}`.toLowerCase();if(!tT.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return tT.get(t)}var J9=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function iT(e){return e!=null&&J9.has(`${e}`.toLowerCase())}var Bg=e=>t=>e(1-t),jg=[0,1],aT=new Map([["number",et],["rgb",an],["hsl",fy],["hcl",cy],["lab",Ql]]);function Gg(e){let t=`${e}`.toLowerCase();if(!aT.has(t))throw new Error(`unknown interpolator: ${t}`);return aT.get(t)}function Sf(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=hT(e,r),unknown:f,round:u,scheme:c,interval:m,range:l=Be.get(e)===qa?nN(r,s):Be.get(e)===Ha?oN(r,s):Be.get(e)===Ya?jg:void 0,interpolate:p=Be.get(e)===zr?c==null&&l!==void 0?an:bf(c!==void 0?c:n==="cyclical"?"rainbow":"turbo"):u?_a:et,reverse:d}){if(s=sT(s),m=qi(m,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof p!="function"&&(p=Gg(p)),d=!!d,l!==void 0){let y=s.length,x=(l=sT(l)).length;if(y!==x){if(p.length===1)throw new Error("invalid piecewise interpolator");p=no(p,l),l=void 0}}if(p.length===1?(d&&(p=Bg(p),d=!1),l===void 0&&(l=Float64Array.from(s,(y,x)=>x/(s.length-1)),l.length===2&&(l=jg)),t.interpolate((l===jg?Gr:ku)(p))):t.interpolate(p),a){let[y,x]=Tr(s);(y>0||x<0)&&(s=Bi(s),(ni(s)||1)===Math.sign(y)?s[0]=0:s[s.length-1]=0)}return d&&(s=Oi(s)),t.domain(s).unknown(f),o&&(t.nice(eN(o,n)),s=t.domain()),l!==void 0&&t.range(l),i&&t.clamp(i),{type:n,domain:s,range:l,scale:t,interpolate:p,interval:m}}function sT(e){return e=bo(e),e.length>=2?e:[e[0],e[0]]}function eN(e,t){return e===!0?void 0:typeof e=="number"?e:_6(e,t)}function fT(e,t,r){return Sf(e,Pa(),t,r)}function cT(e,t,r){return zg(e,t,{...r,exponent:.5})}function zg(e,t,{exponent:r=1,...n}){return Sf(e,Jc().exponent(r),t,{...n,type:"pow"})}function uT(e,t,{base:r=10,domain:n=iN(t),...o}){return Sf(e,Zc().base(r),t,{...o,domain:n})}function lT(e,t,{constant:r=1,...n}){return Sf(e,Qc().constant(r),t,n)}function pT(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=aN(t),unknown:s,interpolate:f,reverse:u}){return r===void 0&&(r=f!==void 0?ir(f,o):Be.get(e)===zr?Pu(i,o):void 0),a.length>0&&(a=eu(a,r===void 0?{length:o}:r).quantiles()),Md(e,t,{domain:a,range:r,reverse:u,unknown:s})}function mT(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=hT(e,t),unknown:a,interpolate:s,reverse:f}){let[u,c]=Tr(i),m;return r===void 0?(m=Uo(u,c,n),m[0]<=u&&m.splice(0,1),m[m.length-1]>=c&&m.pop(),n=m.length+1,r=s!==void 0?ir(s,n):Be.get(e)===zr?Pu(o,n):void 0):(m=ir(et(u,c),n+1).slice(1,-1),u instanceof Date&&(m=m.map(l=>new Date(l)))),ni(bo(i))<0&&m.reverse(),Md(e,t,{domain:m,range:r,reverse:f,unknown:a})}function Md(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?ir(i,r.length+1):Be.get(e)===zr?Pu(o,r.length+1):void 0,reverse:s}){r=bo(r);let f=ni(r);if(!isNaN(f)&&!tN(r,f))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=Oi(a)),{type:"threshold",scale:tu(f<0?Oi(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function tN(e,t){for(let r=1,n=e.length,o=e[0];rt}}function wf(e,t=pg){return e.length?[mr(e,({value:r})=>r===void 0?r:mr(r,t)),Nt(e,({value:r})=>r===void 0?r:Nt(r,t))]:[0,1]}function hT(e,t){let r=Be.get(e);return(r===qa||r===Ya||r===Ha?rN:wf)(t)}function rN(e){return[0,e.length?Nt(e,({value:t})=>t===void 0?t:Nt(t,pg)):1]}function nN(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=jo(e,.5,({value:a})=>a===void 0?NaN:jo(a,.25,Ba)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/Nt(o);return i<1?o.map(a=>a*i):o}function oN(e,t){let r=ya(e,({value:i})=>i===void 0?NaN:ya(i,Math.abs)),n=t.map(i=>12*i/r),o=60/Nt(n);return o<1?n.map(i=>i*o):n}function iN(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return wf(e,Ba);if(r<0)return wf(e,ff)}return[1,10]}function aN(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function ku(e){return(t,r)=>n=>e(t+n*(r-t))}var Kg=0,qg;function yT(){let e=Kg;return Kg=0,qg=void 0,e}function Cr(e){e!==qg&&(qg=e,console.warn(e),++Kg)}function Od(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=wf(n),unknown:f,pivot:u=0,scheme:c,range:m,symmetric:l=!0,interpolate:p=Be.get(e)===zr?c==null&&m!==void 0?an:bf(c!==void 0?c:"rdbu"):et,reverse:d}){u=+u,s=bo(s);let[y,x]=s;if(s.length>2&&Cr(`Warning: the diverging ${e} scale domain contains extra elements.`),tn(y,x)<0&&([y,x]=[x,y],d=!d),y=Math.min(y,u),x=Math.max(x,u),typeof p!="function"&&(p=Gg(p)),m!==void 0&&(p=p.length===1?ku(p)(...m):no(p,m)),d&&(p=Bg(p)),l){let w=r.apply(u),g=w-r.apply(y),S=r.apply(x)-w;gS&&(x=r.invert(w+g))}return t.domain([y,u,x]).unknown(f).interpolator(p),a&&t.clamp(a),i&&t.nice(i),{type:o,domain:[y,x],pivot:u,interpolate:p,scale:t}}function xT(e,t,r){return Od(e,fu(),sN,t,r)}function gT(e,t,r){return Hg(e,t,{...r,exponent:.5})}function Hg(e,t,{exponent:r=1,...n}){return Od(e,Qp().exponent(r=+r),uN(r),t,{...n,type:"diverging-pow"})}function bT(e,t,{base:r=10,pivot:n=1,domain:o=wf(t,n<0?ff:Ba),...i}){return Od(e,Xp().base(r=+r),fN,t,{domain:o,pivot:n,...i})}function wT(e,t,{constant:r=1,...n}){return Od(e,Zp().constant(r=+r),lN(r),t,n)}var sN={apply(e){return e},invert(e){return e}},fN={apply:Math.log,invert:Math.exp},cN={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function uN(e){return e===.5?cN:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function lN(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function ST(e,t,r,n){return Sf(e,t,r,n)}function IT(e,t,r){return ST(e,Hp(),t,r)}function _T(e,t,r){return ST(e,Yp(),t,r)}var If=Symbol("ordinal");function TT(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:f}){return o=qi(o,n),i===void 0&&(i=AT(r,o,e)),(n==="categorical"||n===If)&&(n="ordinal"),s&&(i=Oi(i)),i=t.domain(i).domain(),a!==void 0&&(typeof a=="function"&&(a=a(i)),t.range(a)),{type:n,domain:i,range:a,scale:t,hint:f,interval:o}}function MT(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...f}){n=qi(n,r),o===void 0&&(o=AT(t,n,e));let u;if(Be.get(e)===yf)u=pN(t),i=i===void 0?mN(u):We(i,xf);else if(Be.get(e)===zr&&(i===void 0&&(r==="ordinal"||r===If)&&(i=oT(o,a),i!==void 0&&(a=void 0)),a===void 0&&i===void 0&&(a=r==="ordinal"?"turbo":"observable10"),a!==void 0))if(i!==void 0){let c=bf(a),m=i[0],l=i[1]-i[0];i=({length:p})=>ir(d=>c(m+l*d),p)}else i=Ug(a);if(s===Hc)throw new Error(`implicit unknown on ${e} scale is not supported`);return TT(e,Ca().unknown(s),t,{...f,type:r,domain:o,range:i,hint:u})}function OT(e,t,{align:r=.5,padding:n=.5,...o}){return CT(ux().align(r).padding(n),t,o,e)}function RT(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return CT(Ei().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function CT(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=TT(n,e,t,r),e.round=o,e}function AT(e,t,r){let n=new Pn;for(let{value:o,domain:i}of e){if(i!==void 0)return i();if(o!==void 0)for(let a of o)n.add(a)}if(t!==void 0){let[o,i]=Tr(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&Be.get(r)===yn)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Mi(n,Or)}function vT(e,t){let r;for(let{hint:n}of e){let o=n?.[t];if(o!==void 0){if(r===void 0)r=o;else if(r!==o)return}}return r}function pN(e){return{fill:vT(e,"fill"),stroke:vT(e,"stroke")}}function mN(e){return Ut(e.fill)?Kx:ud}function Nu(e,{label:t,inset:r=0,insetTop:n=r,insetRight:o=r,insetBottom:i=r,insetLeft:a=r,round:s,nice:f,clamp:u,zero:c,align:m,padding:l,projection:p,facet:{label:d=t}={},...y}={}){let x={};for(let[w,g]of e){let S=y[w],b=yN(w,g,{round:Be.get(w)===yn?s:void 0,nice:f,clamp:u,zero:c,align:m,padding:l,projection:p,...S});if(b){let{label:T=w==="fx"||w==="fy"?d:t,percent:I,transform:v,inset:O,insetTop:C=O!==void 0?O:w==="y"?n:0,insetRight:E=O!==void 0?O:w==="x"?o:0,insetBottom:A=O!==void 0?O:w==="y"?i:0,insetLeft:F=O!==void 0?O:w==="x"?a:0}=S||{};if(v==null)v=void 0;else if(typeof v!="function")throw new Error("invalid scale transform; not a function");b.percent=!!I,b.label=T===void 0?dN(g,b):T,b.transform=v,w==="x"||w==="fx"?(b.insetLeft=+F,b.insetRight=+E):(w==="y"||w==="fy")&&(b.insetTop=+C,b.insetBottom=+A),x[w]=b}}return x}function Wg(e){let t={},r={scales:t};for(let[n,o]of Object.entries(e)){let{scale:i,type:a,interval:s,label:f}=o;t[n]=wN(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),f!=null&&(i.label=f)}return r}function ET(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?Cd(t):t;o&&PT(o,a),i&&kT(i,a);let s=o||i?Xg(e,t):t;r&&PT(r,s),n&&kT(n,s)}function dN(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!So(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function $T(e){return Math.sign(ni(e.domain()))*Math.sign(ni(e.range()))}function Cd(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:o,width:i,height:a,facet:{marginTop:s,marginRight:f,marginBottom:u,marginLeft:c}}=e;return{marginTop:Math.max(t,s),marginRight:Math.max(r,f),marginBottom:Math.max(n,u),marginLeft:Math.max(o,c),width:i,height:a}}function Xg({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:f}=Cd(r);return{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:e?e.scale.bandwidth()+a+o:s,height:t?t.scale.bandwidth()+n+i:f,facet:{width:s,height:f}}}function PT(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:o,marginLeft:i=0,marginRight:a=0}=t,s=i+r,f=o-a-n;e.range=[s,Math.max(s,f)],So(e)||(e.range=DT(e)),e.scale.range(e.range)}LT(e)}function kT(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:o,marginTop:i=0,marginBottom:a=0}=t,s=i+r,f=o-a-n;e.range=[Math.max(s,f),s],So(e)?e.range.reverse():e.range=DT(e),e.scale.range(e.range)}LT(e)}function LT(e){e.round===void 0&&gN(e)&&hN(e)<=30&&e.scale.round(!0)}function hN({scale:e}){let t=e.domain().length,[r,n]=e.range(),o=e.paddingInner?e.paddingInner():1,i=e.paddingOuter?e.paddingOuter():e.padding(),a=t-o,s=Math.abs(n-r)/Math.max(1,a+i*2);return(s-Math.floor(s))*a}function DT(e){let t=e.scale.domain().length+Zg(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(o,i)=>r+i/(t-1)*(n-r))}function yN(e,t=[],r={}){let n=xN(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&So({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(Dt)?Cr(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${_f(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${_f(n)}".`):o.some(M6)?Cr(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${_f(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${_f(n)}".`):o.some(O6)&&Cr(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${_f(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${_f(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=Rd(t,r,za);break;case"identity":switch(Be.get(e)){case yn:r=Rd(t,r,za);break;case yf:r=Rd(t,r,bN);break}break;case"utc":case"time":r=Rd(t,r,Mg);break}switch(n){case"diverging":return xT(e,t,r);case"diverging-sqrt":return gT(e,t,r);case"diverging-pow":return Hg(e,t,r);case"diverging-log":return bT(e,t,r);case"diverging-symlog":return wT(e,t,r);case"categorical":case"ordinal":case If:return MT(e,t,r);case"cyclical":case"sequential":case"linear":return fT(e,t,r);case"sqrt":return cT(e,t,r);case"threshold":return Md(e,t,r);case"quantile":return pT(e,t,r);case"quantize":return mT(e,t,r);case"pow":return zg(e,t,r);case"log":return uT(e,t,r);case"symlog":return lT(e,t,r);case"utc":return _T(e,t,r);case"time":return IT(e,t,r);case"point":return OT(e,t,r);case"band":return RT(e,t,r);case"identity":return dT(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function _f(e){return typeof e=="symbol"?e.description:e}function NT(e){return typeof e=="string"?`${e}`.toLowerCase():e}var FT={toString:()=>"projection"};function xN(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=NT(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=FT);for(let c of t){let m=NT(c.type);if(m!==void 0){if(r===void 0)r=m;else if(r!==m)throw new Error(`scale incompatible with channel: ${r} !== ${m}`)}}if(r===FT)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:c})=>c!==void 0))return;let f=Be.get(e);if(f===qa)return"sqrt";if(f===Ya||f===Ha)return"linear";if(f===yf)return"ordinal";let u=(n??o)?.length;if(u<2||u>2)return Yg(f);if(n!==void 0){if(Ag(n))return Yg(f);if(Dt(n))return"utc"}else{let c=t.map(({value:m})=>m).filter(m=>m!==void 0);if(c.some(Ag))return Yg(f);if(c.some(Dt))return"utc"}if(f===zr){if(a!=null||iT(i))return"diverging";if(nT(i))return"categorical"}return"linear"}function Yg(e){switch(e){case yn:return"point";case zr:return If;default:return"ordinal"}}function So({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===If}function Zg({type:e}){return e==="threshold"}function gN({type:e}){return e==="point"||e==="band"}function Wi(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,o=t.length;n{if(!Be.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function wN({scale:e,type:t,domain:r,range:n,interpolate:o,interval:i,transform:a,percent:s,pivot:f}){if(t==="identity")return{type:"identity",apply:c=>c,invert:c=>c};let u=e.unknown?e.unknown():void 0;return{type:t,domain:Bi(r),...n!==void 0&&{range:Bi(n)},...a!==void 0&&{transform:a},...s&&{percent:s},...u!==void 0&&{unknown:u},...i!==void 0&&{interval:i},...o!==void 0&&{interpolate:o},...e.clamp&&{clamp:e.clamp()},...f!==void 0&&{pivot:f,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:c=>e(c),...e.invert&&{invert:c=>e.invert(c)}}}function jT(e,t){let{fx:r,fy:n}=Nu(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?Ol(o,i).map(([a,s],f)=>({x:a,y:s,i:f})):o?o.map((a,s)=>({x:a,i:s})):i?i.map((a,s)=>({y:a,i:s})):void 0}function BT(e,{x:t,y:r}){return t&&=rb(t),r&&=rb(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,o)=>t.get(n.x)-t.get(o.x)||r.get(n.y)-r.get(o.y):t?(n,o)=>t.get(n.x)-t.get(o.x):(n,o)=>r.get(n.y)-r.get(o.y))}function Pd(e,{fx:t,fy:r}){let n=Rr(e),o=t?.value,i=r?.value;return t&&r?Qn(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?Qn(n,a=>(a.fx=o[a[0]],a),a=>o[a]):Qn(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function GT(e,t,{marginTop:r,marginLeft:n}){let o=e?({x:a})=>e(a)-n:()=>0,i=t?({y:a})=>t(a)-r:()=>0;return function(a){this.tagName==="svg"?(this.setAttribute("x",o(a)),this.setAttribute("y",i(a))):this.setAttribute("transform",`translate(${o(a)},${i(a)})`)}}function zT(e){let t=[],r=new Uint32Array(rn(e,n=>n.length));for(let n of e){let o=0;for(let i of e)n!==i&&(r.set(i,o),o+=i.length);t.push(r.slice(0,o))}return t}var SN=new Map([["top",Qg],["right",tb],["bottom",Jg],["left",eb],["top-left",Ad(Qg,eb)],["top-right",Ad(Qg,tb)],["bottom-left",Ad(Jg,eb)],["bottom-right",Ad(Jg,tb)],["top-empty",_N],["right-empty",MN],["bottom-empty",vN],["left-empty",TN],["empty",ON]]);function KT(e){if(e==null)return null;let t=SN.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var UT=new WeakMap;function rb(e){let t=UT.get(e);return t||UT.set(e,t=new pr(We(e,(r,n)=>[r,n]))),t}function Xi(e,t){return rb(e).get(t)}function IN(e,t,r){return t=dn(t),r=dn(r),e.find(n=>Object.is(dn(n.x),t)&&Object.is(dn(n.y),r))}function kd(e,t,r){return IN(e,t,r)?.empty}function Qg(e,{y:t},{y:r}){return t?Xi(t,r)===0:!0}function Jg(e,{y:t},{y:r}){return t?Xi(t,r)===t.length-1:!0}function eb(e,{x:t},{x:r}){return t?Xi(t,r)===0:!0}function tb(e,{x:t},{x:r}){return t?Xi(t,r)===t.length-1:!0}function _N(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Xi(t,n);if(i>0)return kd(e,r,t[i-1])}function vN(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Xi(t,n);if(i0)return kd(e,t[i-1],n)}function MN(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Xi(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var qT=Math.PI,ui=2*qT,nb=.618;function HT({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={},a){if(e==null)return;if(typeof e.stream=="function")return e;let s,f,u="frame";if(wo(e)){let T;if({type:e,domain:f,inset:T,insetTop:r=T!==void 0?T:r,insetRight:n=T!==void 0?T:n,insetBottom:o=T!==void 0?T:o,insetLeft:i=T!==void 0?T:i,clip:u=u,...s}=e,e==null)return}typeof e!="function"&&({type:e}=ob(e));let{width:c,height:m,marginLeft:l,marginRight:p,marginTop:d,marginBottom:y}=a,x=c-l-p-i-n,w=m-d-y-r-o;if(e=e?.({width:x,height:w,clip:u,...s}),e==null)return;u=RN(u,l,d,c-p,m-y);let g=l+i,S=d+r,b;if(f!=null){let[[T,I],[v,O]]=Ks(e).bounds(f),C=Math.min(x/(v-T),w/(O-I));C>0?(g-=(C*(T+v)-x)/2,S-=(C*(I+O)-w)/2,b=qs({point(E,A){this.stream.point(E*C+g,A*C+S)}})):Cr("Warning: the projection could not be fit to the specified domain; using the default scale.")}return b??=g===0&&S===0?YT():qs({point(T,I){this.stream.point(T+g,I+S)}}),{stream:T=>e.stream(b.stream(u(T)))}}function ob(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Vn(zy,.7463,.4673);case"albers":return Fd(jc,.7463,.4673);case"azimuthal-equal-area":return Vn(qy,4,4);case"azimuthal-equidistant":return Vn(Yy,ui,ui);case"conic-conformal":return Fd(Zy,ui,ui);case"conic-equal-area":return Fd(Fi,6.1702,2.9781);case"conic-equidistant":return Fd(Jy,7.312,3.6282);case"equal-earth":return Vn(tx,5.4133,2.6347);case"equirectangular":return Vn(Qy,ui,qT);case"gnomonic":return Vn(nx,3.4641,3.4641);case"identity":return{type:YT};case"reflect-y":return{type:CN};case"mercator":return Vn(Wy,ui,ui);case"orthographic":return Vn(ix,2,2);case"stereographic":return Vn(sx,2,2);case"transverse-mercator":return Vn(cx,ui,ui);default:throw new Error(`unknown projection type: ${e}`)}}function RN(e,t,r,n,o){if(e===!1||e==null||typeof e=="number")return i=>i;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Us(t,r,n,o);default:throw new Error(`unknown projection clip type: ${e}`)}}function Vn(e,t,r){return{type:({width:n,height:o,rotate:i,precision:a=.15,clip:s})=>{let f=e();return a!=null&&f.precision?.(a),i!=null&&f.rotate?.(i),typeof s=="number"&&f.clipAngle?.(s),n!=null&&(f.scale(Math.min(n/t,o/r)),f.translate([n/2,o/2])),f},aspectRatio:r/t}}function Fd(e,t,r){let{type:n,aspectRatio:o}=Vn(e,t,r);return{type:i=>{let{parallels:a,domain:s,width:f,height:u}=i,c=n(i);return a!=null&&(c.parallels(a),s===void 0&&f!=null&&c.fitSize([f,u],{type:"Sphere"})),c},aspectRatio:o}}var YT=Gr({stream:e=>e}),CN=Gr(qs({point(e,t){this.stream.point(e,-t)}}));function WT(e,t,r,n){let o=r[e],i=r[t],a=o.length,s=r[e]=new Float64Array(a).fill(NaN),f=r[t]=new Float64Array(a).fill(NaN),u,c=n.stream({point(m,l){s[u]=m,f[u]=l}});for(u=0;u5?5:f:nb}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=ob(e);if(t)return t}return nb}}function QT(e){let t=[],r=[],n={scale:"x",value:t},o={scale:"y",value:r},i={point(a,s){t.push(a),r.push(s)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let a of e.value)$n(a,i);return[n,o]}function JT({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,qs({point(r,n){this.stream.point(e(r),t(n))}})}function vf(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:Td(r)}}function Ve(e,{document:t}){return nn(Go(e).call(t.documentElement))}var Ed=Symbol("unset");function $d(e){return(e.length===1?AN:PN)(e)}function AN(e){let t,r=Ed;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function PN(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((o,i)=>!Object.is(o,n[i])))&&(r=n,t=e(...n)),t)}var kN=$d(e=>new Intl.NumberFormat(e)),Vbe=$d((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Ube=$d((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function NN(e="en-US"){let t=kN(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function FN(e){return yd(e,"Invalid Date")}function EN(e="en-US"){let t=NN(e);return r=>(r instanceof Date?FN:typeof r=="number"?t:wt)(r)}var Io=EN();var Zt=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,$N=0;function tM(){return`plot-clip-${++$N}`}function rM(e,{title:t,href:r,ariaLabel:n,ariaDescription:o,ariaHidden:i,target:a,fill:s,fillOpacity:f,stroke:u,strokeWidth:c,strokeOpacity:m,strokeLinejoin:l,strokeLinecap:p,strokeMiterlimit:d,strokeDasharray:y,strokeDashoffset:x,opacity:w,mixBlendMode:g,imageFilter:S,paintOrder:b,pointerEvents:T,shapeRendering:I,channels:v},{ariaLabel:O,fill:C="currentColor",fillOpacity:E,stroke:A="none",strokeOpacity:F,strokeWidth:H,strokeLinecap:j,strokeLinejoin:M,strokeMiterlimit:U,paintOrder:D}){C===null&&(s=null,f=null),A===null&&(u=null,m=null),Ut(C)?!Ut(A)&&(!Ut(s)||v?.fill)&&(A="none"):Ut(A)&&(!Ut(u)||v?.stroke)&&(C="none");let[oe,V]=go(s,C),[K,Y]=ht(f,E),[Z,J]=go(u,A),[ye,B]=ht(m,F),[W,X]=ht(w);Ka(J)||(c===void 0&&(c=H),p===void 0&&(p=j),l===void 0&&(l=M),d===void 0&&!A6(l)&&(d=U),!Ka(V)&&b===void 0&&(b=D));let[le,L]=ht(c);return C!==null&&(e.fill=yt(V,"currentColor"),e.fillOpacity=Fu(Y,1)),A!==null&&(e.stroke=yt(J,"none"),e.strokeWidth=Fu(L,1),e.strokeOpacity=Fu(B,1),e.strokeLinejoin=yt(l,"miter"),e.strokeLinecap=yt(p,"butt"),e.strokeMiterlimit=Fu(d,4),e.strokeDasharray=yt(y,"none"),e.strokeDashoffset=yt(x,"0")),e.target=wt(a),e.ariaLabel=wt(O),e.ariaDescription=wt(o),e.ariaHidden=wt(i),e.opacity=Fu(X,1),e.mixBlendMode=yt(g,"normal"),e.imageFilter=yt(S,"none"),e.paintOrder=yt(b,"normal"),e.pointerEvents=yt(T,"auto"),e.shapeRendering=yt(I,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:oe,scale:"auto",optional:!0},fillOpacity:{value:K,scale:"auto",optional:!0},stroke:{value:Z,scale:"auto",optional:!0},strokeOpacity:{value:ye,scale:"auto",optional:!0},strokeWidth:{value:le,optional:!0},opacity:{value:W,scale:"auto",optional:!0}}}function LN(e,t){t&&e.filter(r=>Tu(t[r])).append("title").call(VN,t)}function DN(e,t){t&&e.filter(([r])=>Tu(t[r])).append("title").call(UN,t)}function VN(e,t){t&&e.text(r=>Io(t[r]))}function UN(e,t){t&&e.text(([r])=>Io(t[r]))}function Ar(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:f,strokeWidth:u,opacity:c,href:m}){n&&pe(e,"aria-label",l=>n[l]),i&&pe(e,"fill",l=>i[l]),a&&pe(e,"fill-opacity",l=>a[l]),s&&pe(e,"stroke",l=>s[l]),f&&pe(e,"stroke-opacity",l=>f[l]),u&&pe(e,"stroke-width",l=>u[l]),c&&pe(e,"opacity",l=>c[l]),m&&iM(e,l=>m[l],t),r||LN(e,o)}function nM(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:f,strokeWidth:u,opacity:c,href:m}){n&&pe(e,"aria-label",([l])=>n[l]),i&&pe(e,"fill",([l])=>i[l]),a&&pe(e,"fill-opacity",([l])=>a[l]),s&&pe(e,"stroke",([l])=>s[l]),f&&pe(e,"stroke-opacity",([l])=>f[l]),u&&pe(e,"stroke-width",([l])=>u[l]),c&&pe(e,"opacity",([l])=>c[l]),m&&iM(e,([l])=>m[l],t),r||DN(e,o)}function jN({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:i,strokeWidth:a,opacity:s,href:f},{tip:u}){return[e,u?void 0:t,r,n,o,i,a,s,f].filter(c=>c!==void 0)}function BN(e,t,r){let n=Vo(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&Cr("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*oM(e,t,r,n){let{z:o}=r,{z:i}=n,a=jN(n,r),s=[...t,...a];for(let f of i?BN(e,i,o):[e]){let u,c;e:for(let m of f){for(let l of s)if(!mn(l[m])){c&&c.push(-1);continue e}if(u===void 0){c&&(yield c),u=a.map(l=>dn(l[m])),c=[m];continue}c.push(m);for(let l=0;ldn(d[m])),c=[m];continue e}}c&&(yield c)}}function GN(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=Ve("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=KN(n,r)):i&&(o=HN(i,n)),pe(e,"aria-label",t.ariaLabel),pe(e,"aria-description",t.ariaDescription),pe(e,"aria-hidden",t.ariaHidden),pe(e,"clip-path",o)}function zN(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=tM();nn(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var KN=zN((e,t,r)=>{let{width:n,height:o,marginLeft:i,marginRight:a,marginTop:s,marginBottom:f}=r;e.append("rect").attr("x",i).attr("y",s).attr("width",n-a-i).attr("height",o-s-f)}),eM=new WeakMap,qN={type:"Sphere"};function HN(e,t){let r,n;if((r=eM.get(t))||eM.set(t,r=new WeakMap),e.type==="Sphere"&&(e=qN),!(n=r.get(e))){let o=tM();nn(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function Qt(e,t,r,n){GN(e,t,r,n),pe(e,"class",t.className),pe(e,"fill",t.fill),pe(e,"fill-opacity",t.fillOpacity),pe(e,"stroke",t.stroke),pe(e,"stroke-width",t.strokeWidth),pe(e,"stroke-opacity",t.strokeOpacity),pe(e,"stroke-linejoin",t.strokeLinejoin),pe(e,"stroke-linecap",t.strokeLinecap),pe(e,"stroke-miterlimit",t.strokeMiterlimit),pe(e,"stroke-dasharray",t.strokeDasharray),pe(e,"stroke-dashoffset",t.strokeDashoffset),pe(e,"shape-rendering",t.shapeRendering),pe(e,"filter",t.imageFilter),pe(e,"paint-order",t.paintOrder);let{pointerEvents:o=n.pointerSticky===!1?"none":void 0}=t;pe(e,"pointer-events",o)}function Bt(e,t){YN(e,"mix-blend-mode",t.mixBlendMode),pe(e,"opacity",t.opacity)}function iM(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS(Jn.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Jn.xlink,"href",o),r!=null&&i.setAttribute("target",r),this.parentNode.insertBefore(i,this).appendChild(this)}})}function pe(e,t,r){r!=null&&e.attr(t,r)}function YN(e,t,r){r!=null&&e.style(t,r)}function Jt(e,t,{x:r,y:n},o=Zt,i=Zt){o+=t.dx,i+=t.dy,r?.bandwidth&&(o+=r.bandwidth()/2),n?.bandwidth&&(i+=n.bandwidth()/2),(o||i)&&e.attr("transform",`translate(${o},${i})`)}function yt(e,t){if((e=wt(e))!==t)return e}function Fu(e,t){if((e=St(e))!==t)return e}var WN=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Tf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!WN.test(e))throw new Error(`invalid class name: ${e}`);return e}function Mf(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function _o({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:o,marginBottom:i,marginLeft:a}){return[/left$/.test(e)?a:/right$/.test(e)?t-o:(a+t-o)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-i:(n+r-i)/2]}var ot=class{constructor(t,r={},n={},o){let{facet:i="auto",facetAnchor:a,fx:s,fy:f,sort:u,dx:c=0,dy:m=0,margin:l=0,marginTop:p=l,marginRight:d=l,marginBottom:y=l,marginLeft:x=l,className:w,clip:g=o?.clip,channels:S,tip:b,render:T}=n;if(this.data=t,this.sort=Gi(u)?u:null,this.initializer=ai(n).initializer,this.transform=this.initializer?n.transform:Au(n).transform,i===null||i===!1?this.facet=null:(this.facet=yr(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=t===pf&&typeof s=="string"?[s]:s,this.fy=t===pf&&typeof f=="string"?[f]:f),this.facetAnchor=KT(a),r=Pg(r),S!==void 0&&(r={...XN(S),...r}),o!==void 0&&(r={...rM(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([I,v])=>{if(df(v.value)){let{value:O,label:C=v.label,scale:E=v.scale}=v.value;v={...v,label:C,scale:E,value:O}}if(t===pf&&typeof v.value=="string"){let{value:O}=v;v={...v,value:[O]}}return[I,v]}).filter(([I,{value:v,optional:O}])=>{if(v!=null)return!0;if(O)return!1;throw new Error(`missing channel value: ${I}`)})),this.dx=+c,this.dy=+m,this.marginTop=+p,this.marginRight=+d,this.marginBottom=+y,this.marginLeft=+x,this.clip=Td(g),this.tip=ZN(b),this.className=wt(w),this.facet==="super"){if(s||f)throw new Error("super-faceting cannot use fx or fy");for(let I in this.channels){let{scale:v}=r[I];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}T!=null&&(this.render=ab(T,this.render))}initialize(t,r,n){let o=oi(this.data);t===void 0&&o!=null&&(t=[Rr(o)]);let i=t;this.transform!=null&&({facets:t,data:o}=this.transform(o,t,n),o=oi(o)),t!==void 0&&(t.original=i);let a=H6(this.channels,o);return this.sort!=null&&W6(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=mn}=r[o];if(i!==null){let a=n[o];t=t.filter(s=>i(a[s]))}}return t}project(t,r,n){for(let o in t)if(t[o].scale==="x"&&/^x|x$/.test(o)){let i=o.replace(/^x|x$/,"y");i in t&&t[i].scale==="y"&&WT(o,i,r,n.projection)}}scale(t,r,n){let o=Y6(t,r);return n.projection&&this.project(t,o,n),o}};function ib(...e){return e.plot=ot.prototype.plot,e}function ab(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,o,i,a,s){return e.call(this,r,n,o,i,a,(f,u,c,m,l)=>t.call(this,f,u,c,m,l,s))}}function XN(e){return Object.fromEntries(Object.entries(Pg(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Hi(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function ZN(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?yr(e,"tip",["x","y","xy"]):e}function Eu(e,t){return e?.tip===!0?{...e,tip:t}:wo(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function sM(e,t,r={}){let n=.5-Zt,o=.5+Zt,i=.5+Zt,a=.5-Zt;for(let{marginTop:y,marginRight:x,marginBottom:w,marginLeft:g}of t)y>n&&(n=y),x>o&&(o=x),w>i&&(i=w),g>a&&(a=g);let{margin:s,marginTop:f=s!==void 0?s:n,marginRight:u=s!==void 0?s:o,marginBottom:c=s!==void 0?s:i,marginLeft:m=s!==void 0?s:a}=r;f=+f,u=+u,c=+c,m=+m;let{width:l=640,height:p=QN(e,r,{width:l,marginTopDefault:n,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,f-n+c-i)}=r;l=+l,p=+p;let d={width:l,height:p,marginTop:f,marginRight:u,marginBottom:c,marginLeft:m};if(e.fx||e.fy){let{margin:y,marginTop:x=y!==void 0?y:f,marginRight:w=y!==void 0?y:u,marginBottom:g=y!==void 0?y:c,marginLeft:S=y!==void 0?y:m}=r.facet??{};x=+x,w=+w,g=+g,S=+S,d.facet={marginTop:x,marginRight:w,marginBottom:g,marginLeft:S}}return d}function QN({x:e,y:t,fy:r,fx:n},{projection:o,aspectRatio:i},{width:a,marginTopDefault:s,marginRightDefault:f,marginBottomDefault:u,marginLeftDefault:c}){let m=r&&r.scale.domain().length||1,l=ZT(o);if(l){let d=n?n.scale.domain().length:1,y=(1.1*m-.1)/(1.1*d-.1)*l,x=Math.max(.1,Math.min(10,y));return Math.round((a-c-f)*x+s+u)}let p=t?So(t)?t.scale.domain().length||1:Math.max(7,17/m):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let d=aM("y",t)/(aM("x",e)*i),y=n?n.scale.bandwidth():1,x=r?r.scale.bandwidth():1,w=y*(a-c-f)-e.insetLeft-e.insetRight;return(d*w+t.insetTop+t.insetBottom)/x+s+u}return!!(t||r)*Math.max(1,Math.min(60,p*m))*20+!!n*30+60}function aM(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,o;switch(r){case"linear":case"utc":case"time":o=Number;break;case"pow":{let s=t.scale.exponent();o=f=>Math.pow(f,s);break}case"log":o=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[i,a]=Tr(n);return Math.abs(o(a)-o(i))}var fM=new WeakMap;function sb(e,t,{x:r,y:n,px:o,py:i,maxRadius:a=40,channels:s,render:f,...u}={}){return a=+a,o!=null&&(r??=null,s={...s,px:{value:o,scale:"x"}}),i!=null&&(n??=null,s={...s,py:{value:i,scale:"y"}}),{x:r,y:n,channels:s,...u,render:ab(function(c,m,l,p,d,y){d={...d,pointerSticky:!1};let x=d.ownerSVGElement,{data:w}=d.getMarkState(this),g=fM.get(x);g||fM.set(x,g={sticky:!1,roots:[],renders:[]});let S=g.renders.push(J)-1,{x:b,y:T,fx:I,fy:v}=m,O=I?I(c.fx)-p.marginLeft:0,C=v?v(c.fy)-p.marginTop:0;b?.bandwidth&&(O+=b.bandwidth()/2),T?.bandwidth&&(C+=T.bandwidth()/2);let E=c.fi!=null,A;if(E){let X=g.facetStates;X||(g.facetStates=X=new Map),A=X.get(this),A||X.set(this,A=new Map)}let[F,H]=_o(this,p),{px:j,py:M}=l,U=j?X=>j[X]:cb(l,F),D=M?X=>M[X]:ub(l,H),oe,V,K,Y;function Z(X,le){if(E)if(Y&&(Y=cancelAnimationFrame(Y)),X==null)A.delete(c.fi);else{A.set(c.fi,le),Y=requestAnimationFrame(()=>{Y=null;for(let[L,Q]of A)if(Q1)){let Q=oe==null?null:Dn(w)?w[oe]:w.get(oe);d.dispatchValue(Q)}return L}function ye(X){if(g.sticky||X.pointerType==="mouse"&&X.buttons===1)return;let[le,L]=H0(X);le-=O,L-=C;let Q=lep.width-p.marginRight?1:e,re=Lp.height-p.marginBottom?1:t,$=null,ke=a*a;for(let G of c){let ae=Q*(U(G)-le),xe=re*(D(G)-L),Ge=ae*ae+xe*xe;Ge<=ke&&($=G,ke=Ge)}if($!=null&&(e!==1||t!==1)){let G=U($)-le,ae=D($)-L;ke=G*G+ae*ae}Z($,ke)}function B(X){X.pointerType==="mouse"&&oe!=null&&(g.sticky&&g.roots.some(le=>le?.contains(X.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(le=>le(null))):(g.sticky=!0,J(oe)),X.stopImmediatePropagation()))}function W(X){X.pointerType==="mouse"&&(g.sticky||Z(null))}return x.addEventListener("pointerenter",ye),x.addEventListener("pointermove",ye),x.addEventListener("pointerdown",B),x.addEventListener("pointerleave",W),J(null)},f)}}function cM(e){return sb(1,1,e)}function uM(e){return sb(1,.01,e)}function fb(e){return sb(.01,1,e)}function cb({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function ub({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function Ld(e){return So(e)&&e.interval===void 0?void 0:"tabular-nums"}function lM(e,t){let{label:r=e.label,tickSize:n=6,width:o=240,height:i=44+n,marginTop:a=18,marginRight:s=0,marginBottom:f=16+n,marginLeft:u=0,style:c,ticks:m=(o-u-s)/64,tickFormat:l,fontVariant:p=Ld(e),round:d=!0,opacity:y,className:x}=t,w=vf(t);x=Tf(x),y=ht(y)[1],l===null&&(l=()=>null);let g=Ve("svg",w).attr("class",`${x}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(F=>F.append("style").text(`:where(.${x}-ramp) { +${r}`}function $E(e){return e==="time"?Qd:e==="utc"?al:EE}function pT(e,t,r){let n=jt(bp(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return cT("millisecond","utc",r);for(let[o,i,a,s]of $E(e)){if(n>s||o==="hour"&&!n)break;if(t.every(c=>i.floor(c)>=c))return cT(o,a,r)}}function Ec(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),c=o-_i(i);return o!==c&&i[c]!==void 0&&s===t(i[c],c)?a:r(a,s)}}var mx=Object.getPrototypeOf(Uint8Array),DE=Object.prototype.toString;function Xn(e){return e instanceof Array||e instanceof mx}function hT(e){return e instanceof mx&&!LE(e)}function yT(e){return e?.prototype instanceof mx&&!VE(e)}function LE(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function VE(e){return e===BigInt64Array||e===BigUint64Array}var dx=Symbol("reindex");function qt(e,t,r){let n=typeof t;return n==="string"?LT(e)?hx(e.getChild(t),r):mT(e,yx(t),r):n==="function"?mT(e,t,r):n==="number"||t instanceof Date||n==="boolean"?et(e,en(t),r):typeof t?.transform=="function"?px(t.transform(e),r):jE(px(t,r),e?.[dx])}function jE(e,t){return e!=null&&t?th(e,t):e}function mT(e,t,r){return et(e,yT(r)?(n,o)=>gx(t(n,o)):t,r)}function px(e,t){return t===void 0?Fo(e):VT(e)?hx(e,t):e instanceof t?e:t.from(e,yT(t)&&!hT(e)?gx:void 0)}function hx(e,t){return e==null?e:(t===void 0||t===Array)&&KE(e.type)?xx(dT(e)):px(dT(e),t)}function dT(e){return e.nullCount?e.toJSON():e.toArray()}var Dc=[null],yx=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},sl={transform:Dr},St={transform:e=>e};var bT=()=>1,gT=()=>!0,Mt=e=>e==null?e:`${e}`,Ot=e=>e==null?e:+e;var bx=e=>e?e[0]:void 0,xT=e=>e?e[1]:void 0;var en=e=>()=>e;function wT(e){let t=+`${e}`.slice(1)/100;return(r,n)=>si(r,t,n)}function ds(e){return hT(e)?e:et(e,gx,Float64Array)}function gx(e){return e==null?NaN:Number(e)}function xx(e){return et(e,UE)}function UE(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?il(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Eo(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:jc(e)?[void 0,e]:[e,void 0]}function It(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function wx(e,t,r){if(e!=null)return Pr(e,t,r)}function Pr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function vi(e){return LT(e)?e:Fo(e)}function Fo(e){if(e==null||Xn(e))return e;if(VT(e))return hx(e);if(ST(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function ST(e){switch(e?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function et(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function ua(e,t=Array){return e instanceof t?e.slice():t.from(e)}function IT({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function Sx({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function _T(e){return IT(e)||Sx(e)||e.interval!==void 0}function $o(e){return e?.toString===DE}function Lc(e){return $o(e)&&(e.type!==void 0||e.domain!==void 0)}function Vc(e){return $o(e)&&typeof e.transform!="function"}function la(e){return Vc(e)&&e.value===void 0&&e.channel===void 0}function vT(e,t,r,n=St){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function Pi(e,t){return e===void 0&&t===void 0?[bx,xT]:[e,t]}function eh({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=Eo(t)),e===void 0&&([e]=Eo(r)),e}function pa(e){return Xn(e)?e.length:e?.numRows}function Dr(e){let t=pa(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):et(t,r=>e.at(r))}function PT(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Pn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cl(e){let t;return[{transform:()=>t,label:ma(e)},r=>t=r]}function TT(e){return e==null?[e]:cl(e)}function ma(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function MT(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return Kt(n)||Kt(o)?et(n,(i,a)=>new Date((+n[a]+ +o[a])/2)):et(n,(i,a)=>(+n[a]+ +o[a])/2,Float64Array)},label:e.label}}function OT(e,t){let r=Ix(t?.interval,t?.type);return r?et(e,r):e}function Ix(e,t){let r=rh(e,t);return r&&(n=>vn(n)?r.floor(n):n)}function rh(e,t){if(e!=null){if(typeof e=="number")return BE(e);if(typeof e=="string")return(t==="time"?fx:ux)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function BE(e){e=+e,0Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>Ua(Math.ceil(r*t),n*t).map(o=>o/t)}:{floor:r=>Math.floor(r/t)*t,offset:(r,n=1)=>r+t*Math.floor(n),range:(r,n)=>Ua(Math.ceil(r/t),n/t).map(o=>o*t)}}function da(e,t){if(e=rh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function CT(e,t){if(e=da(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function kT(e){return typeof e?.range=="function"}function ha(e){return e===void 0||Vc(e)?e:{value:e}}function RT(e){return e==null?null:{transform:t=>qt(t,e,Float64Array),label:ma(e)}}function Tn(e){return e&&typeof e[Symbol.iterator]=="function"}function nh(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function _x(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Kt(e){for(let t of e)if(t!=null)return t instanceof Date}function NT(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&il(t)}function AT(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function ET(e){for(let t of e)if(t!=null)return typeof t=="number"}function oh(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var zE=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function jc(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||zE.has(e))}function FT(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Ht(e){return e==null||hs(e)}function hs(e){return/^\s*none\s*$/i.test(e)}function $T(e){return/^\s*round\s*$/i.test(e)}function ih(e,t){return wx(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ya(e="middle"){return ih(e,"frameAnchor")}function DT(e={},...t){let r=e;for(let n of t)for(let o in n)if(r[o]===void 0){let i=n[o];r===e?r={...r,[o]:i}:r[o]=i}return r}function GE(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let o=`${n}`;if(o==="__proto__")throw new Error(`illegal name: ${o}`);if(t.has(o))throw new Error(`duplicate name: ${o}`);return t.add(o),[n,r]}))}function vx(e){return Tn(e)?GE(e):e}function ah(e){return e===!0?e="frame":e===!1?e=null:!ST(e)&&e!=null&&(e=Pr(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function LT(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function VT(e){return e&&typeof e.toArray=="function"&&e.type}function KE(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Mn=Symbol("position"),tn=Symbol("color"),ys=Symbol("radius"),bs=Symbol("length"),gs=Symbol("opacity"),Uc=Symbol("symbol"),jT=Symbol("projection"),He=new Map([["x",Mn],["y",Mn],["fx",Mn],["fy",Mn],["r",ys],["color",tn],["opacity",gs],["symbol",Uc],["length",bs],["projection",jT]]);function UT(e){return e===Mn||e===jT}function BT(e){return e===Mn||e===ys||e===bs||e===gs}var qE=Math.sqrt(3),HE=2/qE,YE={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*HE,o=n/2;e.moveTo(0,n),e.lineTo(r,o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-r,o),e.closePath()}},Px=new Map([["asterisk",Ku],["circle",Si],["cross",qu],["diamond",Hu],["diamond2",Yu],["hexagon",YE],["plus",Wu],["square",Xu],["square2",Zu],["star",Qu],["times",kc],["triangle",Ju],["triangle2",el],["wye",tl]]);function Tx(e){return e&&typeof e.draw=="function"}function zT(e){return Tx(e)?!0:typeof e!="string"?!1:Px.has(e.toLowerCase())}function Bc(e){if(e==null||Tx(e))return e;let t=Px.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function GT(e){if(e==null||Tx(e))return[void 0,e];if(typeof e=="string"){let t=Px.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function fl({filter:e,sort:t,reverse:r,transform:n,initializer:o,...i}={},a){if(n===void 0&&(e!=null&&(n=KT(e)),t!=null&&!la(t)&&(n=Mx(n,Cx(t))),r&&(n=Mx(n,qT))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||la(t))&&{sort:t},transform:Mx(n,a)}}function Ti({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=KT(e)),t!=null&&!la(t)&&(n=Ox(n,Cx(t))),r&&(n=Ox(n,qT))),{...o,...(t===null||la(t))&&{sort:t},initializer:Ox(n,i)}}function Mx(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,o){return{data:r,facets:n}=e.call(this,r,n,o),t.call(this,vi(r),n,o)}}function Ox(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,o,...i){let a,s,c,u,f,m;return{data:s=r,facets:c=n,channels:a}=e.call(this,r,n,o,...i),{data:f=s,facets:m=c,channels:u}=t.call(this,s,c,{...o,...a},...i),{data:f,facets:m,channels:{...a,...u}}}}function WE(e,t){return(e.initializer!=null?Ti:fl)(e,t)}function KT(e){return(t,r)=>{let n=qt(t,e);return{data:t,facets:r.map(o=>o.filter(i=>n[i]))}}}function qT(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function HT(e,{sort:t,...r}={}){return{...(Vc(e)&&e.channel!==void 0?Ti:WE)(r,Cx(e)),sort:la(t)?t:null}}function Cx(e){return(typeof e=="function"&&e.length!==1?XE:ZE)(e)}function XE(e){return(t,r)=>{let n=Xn(t)?(o,i)=>e(t[o],t[i]):(o,i)=>e(t.get(o),t.get(i));return{data:t,facets:r.map(o=>o.slice().sort(n))}}}function ZE(e){let t,r;({channel:t,value:e,order:r}={...ha(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?ls:$r),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=$r;break;case"descending":r=ls;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=qt(o,e);else{if(a===void 0)throw new Error("channel sort requires an initializer");if(s=a[t],!s)return{};s=s.value}let c=(u,f)=>r(s[u],s[f]);return{data:o,facets:i.map(u=>u.slice().sort(c))}}}function ZT(e,t,r=QE){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&$o(e))return JE(e);if(typeof e=="function")return eF(e);if(/^p\d{2}$/i.test(e))return Mi(wT(e));switch(`${e}`.toLowerCase()){case"first":return rF;case"last":return nF;case"identity":return tF;case"count":return WT;case"distinct":return oF;case"sum":return t==null?WT:iF;case"proportion":return XT(t,"data");case"proportion-facet":return XT(t,"facet");case"deviation":return Mi(up);case"min":return Mi(Ir);case"min-index":return Mi(mp);case"max":return Mi(jt);case"max-index":return Mi(pp);case"mean":return YT(hp);case"median":return YT(ja);case"variance":return Mi(Zs);case"mode":return Mi(yp)}return r(e)}function QE(e){throw new Error(`invalid reduce: ${e}`)}function JE(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function eF(e){return{reduceIndex(t,r,n){return e(th(r,t),n)}}}function Mi(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function YT(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return Kt(r)?new Date(n):n}}}var tF={reduceIndex(e,t){return th(t,e)}},rF={reduceIndex(e,t){return t[e[0]]}};var nF={reduceIndex(e,t){return t[e[e.length-1]]}},WT={label:"Frequency",reduceIndex(e){return e.length}},oF={label:"Distinct",reduceIndex(e,t){let r=new zn;for(let n of e)r.add(t[n]);return r.size}},iF=Mi(dn);function XT(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>dn(r,i=>n[i])/o}}function zc(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=ma(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),Rx(s,{scale:t,type:r,value:qt(e,n),label:a,filter:o,hint:i})}function JT(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,zc(t,n,r)]))}function e6(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:o,value:i}])=>{let a=o==null?null:t[o];return[n,a==null?i:et(i,a)]}));return r.channels=e,r}function Rx(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&oh(n,jc)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&oh(n,FT)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&oh(n,zT)?(t.scale=null,t.value=et(n,Bc)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=He.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!He.has(r))throw new Error(`unknown scale: ${r}`);return t}function t6(e,t,r,n,o){let{order:i,reverse:a,reduce:s=!0,limit:c}=o;for(let u in o){if(!He.has(u))continue;let{value:f,order:m=i,reverse:l=a,reduce:p=s,limit:h=c}=ha(o[u]),y=f?.startsWith("-");if(y&&(f=f.slice(1)),m=m===void 0?y!==(f==="width"||f==="height")?n6:r6:cF(m),p==null||p===!1)continue;let b=u==="fx"||u==="fy"?sF(t,n[u]):aF(r,u);if(!b)throw new Error(`missing channel for scale: ${u}`);let w=b.value,[g=0,_=1/0]=Tn(h)?h:h<0?[h]:[0,h];if(f==null)b.domain=()=>{let x=Array.from(new zn(w));return l&&(x=x.reverse()),(g!==0||_!==1/0)&&(x=x.slice(g,_)),x};else{let x=f==="data"?e:f==="height"?QT(r,"y1","y2"):f==="width"?QT(r,"x1","x2"):kx(r,f,f==="y"?"y2":f==="x"?"x2":void 0),I=ZT(p===!0?"max":p,x);b.domain=()=>{let S=My(Dr(w),v=>I.reduceIndex(v,x),v=>w[v]);return m&&S.sort(m),l&&S.reverse(),(g!==0||_!==1/0)&&(S=S.slice(g,_)),S.map(bx)}}}}function aF(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function sF(e,t){let r=e.original;if(r===e)return t;let n=t.value,o=t.value=[];for(let i=0;iMath.abs(i-n[a]),Float64Array)}function kx(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function cF(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return r6;case"descending":return n6}throw new Error(`invalid order: ${e}`)}function r6([e,t],[r,n]){return $r(t,n)||$r(e,r)}function n6([e,t],[r,n]){return ls(t,n)||$r(e,r)}function Nx(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var c6=new Map([["accent",Sg],["category10",wg],["dark2",Ig],["observable10",_g],["paired",vg],["pastel1",Pg],["pastel2",Tg],["set1",Mg],["set2",Og],["set3",Cg],["tableau10",kg]]);function f6(e){return e!=null&&c6.has(`${e}`.toLowerCase())}var o6=new Map([...c6,["brbg",Oi(Em,Fm)],["prgn",Oi($m,Dm)],["piyg",Oi(Lm,Vm)],["puor",Oi(jm,Um)],["rdbu",Oi(Bu,Tc)],["rdgy",Oi(Bm,zm)],["rdylbu",Oi(zu,Mc)],["rdylgn",Oi(Gm,Km)],["spectral",Oi(qm,Hm)],["burd",i6(Bu,Tc)],["buylrd",i6(zu,Mc)],["blues",Yt(gd,xd)],["greens",Yt(wd,Sd)],["greys",Yt(Id,_d)],["oranges",Yt(Od,Cd)],["purples",Yt(vd,Pd)],["reds",Yt(Td,Md)],["turbo",Ci(Ld)],["viridis",Ci(jd)],["magma",Ci(Ud)],["inferno",Ci(Bd)],["plasma",Ci(zd)],["cividis",Ci(kd)],["cubehelix",Ci(Rd)],["warm",Ci(Ad)],["cool",Ci(Ed)],["bugn",Yt(Ym,Wm)],["bupu",Yt(Xm,Zm)],["gnbu",Yt(Qm,Jm)],["orrd",Yt(ed,td)],["pubu",Yt(od,id)],["pubugn",Yt(rd,nd)],["purd",Yt(ad,sd)],["rdpu",Yt(cd,fd)],["ylgn",Yt(pd,md)],["ylgnbu",Yt(ud,ld)],["ylorbr",Yt(dd,hd)],["ylorrd",Yt(yd,bd)],["rainbow",a6(Fd)],["sinebow",a6(Dd)]]);function Yt(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?pr(t,r):e[r])}function Oi(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?pr(t,r):e[r])}function i6(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?pr(n=>t(1-n),r):e[r].slice().reverse())}function Ci(e){return({length:t})=>pr(e,Math.max(2,Math.floor(t)))}function a6(e){return({length:t})=>pr(e,Math.floor(t)+1).slice(0,-1)}function Ax(e){let t=`${e}`.toLowerCase();if(!o6.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return o6.get(t)}function ul(e,t){let r=Ax(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function u6(e,t="greys"){let r=new Set,[n,o]=ul(t,2);for(let i of e)if(i!=null)if(i===!0)r.add(o);else if(i===!1)r.add(n);else return;return[...r]}var s6=new Map([["brbg",Fm],["prgn",Dm],["piyg",Vm],["puor",Um],["rdbu",Tc],["rdgy",zm],["rdylbu",Mc],["rdylgn",Km],["spectral",Hm],["burd",e=>Tc(1-e)],["buylrd",e=>Mc(1-e)],["blues",xd],["greens",Sd],["greys",_d],["purples",Pd],["reds",Md],["oranges",Cd],["turbo",Ld],["viridis",jd],["magma",Ud],["inferno",Bd],["plasma",zd],["cividis",kd],["cubehelix",Rd],["warm",Ad],["cool",Ed],["bugn",Wm],["bupu",Zm],["gnbu",Jm],["orrd",td],["pubugn",nd],["pubu",id],["purd",sd],["rdpu",fd],["ylgnbu",ld],["ylgn",md],["ylorbr",hd],["ylorrd",bd],["rainbow",Fd],["sinebow",Dd]]);function Gc(e){let t=`${e}`.toLowerCase();if(!s6.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return s6.get(t)}var fF=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function l6(e){return e!=null&&fF.has(`${e}`.toLowerCase())}var Fx=e=>t=>e(1-t),Ex=[0,1],p6=new Map([["number",st],["rgb",bn],["hsl",tb],["hcl",rb],["lab",Ap]]);function $x(e){let t=`${e}`.toLowerCase();if(!p6.has(t))throw new Error(`unknown interpolator: ${t}`);return p6.get(t)}function qc(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=S6(e,r),unknown:c,round:u,scheme:f,interval:m,range:l=He.get(e)===ys?mF(r,s):He.get(e)===bs?dF(r,s):He.get(e)===gs?Ex:void 0,interpolate:p=He.get(e)===tn?f==null&&l!==void 0?bn:Gc(f!==void 0?f:n==="cyclical"?"rainbow":"turbo"):u?Ha:st,reverse:h}){if(s=m6(s),m=da(m,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof p!="function"&&(p=$x(p)),h=!!h,l!==void 0){let y=s.length,b=(l=m6(l)).length;if(y!==b){if(p.length===1)throw new Error("invalid piecewise interpolator");p=wo(p,l),l=void 0}}if(p.length===1?(h&&(p=Fx(p),h=!1),l===void 0&&(l=Float64Array.from(s,(y,b)=>b/(s.length-1)),l.length===2&&(l=Ex)),t.interpolate((l===Ex?en:ll)(p))):t.interpolate(p),a){let[y,b]=Er(s);(y>0||b<0)&&(s=ua(s),(_i(s)||1)===Math.sign(y)?s[0]=0:s[s.length-1]=0)}return h&&(s=Wi(s)),t.domain(s).unknown(c),o&&(t.nice(uF(o,n)),s=t.domain()),l!==void 0&&t.range(l),i&&t.clamp(i),{type:n,domain:s,range:l,scale:t,interpolate:p,interval:m}}function m6(e){return e=Fo(e),e.length>=2?e:[e[0],e[0]]}function uF(e,t){return e===!0?void 0:typeof e=="number"?e:CT(e,t)}function d6(e,t,r){return qc(e,ts(),t,r)}function h6(e,t,r){return Dx(e,t,{...r,exponent:.5})}function Dx(e,t,{exponent:r=1,...n}){return qc(e,Nu().exponent(r),t,{...n,type:"pow"})}function y6(e,t,{base:r=10,domain:n=hF(t),...o}){return qc(e,ku().base(r),t,{...o,domain:n})}function b6(e,t,{constant:r=1,...n}){return qc(e,Ru().constant(r),t,n)}function g6(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=yF(t),unknown:s,interpolate:c,reverse:u}){return r===void 0&&(r=c!==void 0?pr(c,o):He.get(e)===tn?ul(i,o):void 0),a.length>0&&(a=Au(a,r===void 0?{length:o}:r).quantiles()),sh(e,t,{domain:a,range:r,reverse:u,unknown:s})}function x6(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=S6(e,t),unknown:a,interpolate:s,reverse:c}){let[u,f]=Er(i),m;return r===void 0?(m=ai(u,f,n),m[0]<=u&&m.splice(0,1),m[m.length-1]>=f&&m.pop(),n=m.length+1,r=s!==void 0?pr(s,n):He.get(e)===tn?ul(o,n):void 0):(m=pr(st(u,f),n+1).slice(1,-1),u instanceof Date&&(m=m.map(l=>new Date(l)))),_i(Fo(i))<0&&m.reverse(),sh(e,t,{domain:m,range:r,reverse:c,unknown:a})}function sh(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?pr(i,r.length+1):He.get(e)===tn?ul(o,r.length+1):void 0,reverse:s}){r=Fo(r);let c=_i(r);if(!isNaN(c)&&!lF(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=Wi(a)),{type:"threshold",scale:Eu(c<0?Wi(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function lF(e,t){for(let r=1,n=e.length,o=e[0];rt}}function Kc(e,t=ix){return e.length?[Ir(e,({value:r})=>r===void 0?r:Ir(r,t)),jt(e,({value:r})=>r===void 0?r:jt(r,t))]:[0,1]}function S6(e,t){let r=He.get(e);return(r===ys||r===gs||r===bs?pF:Kc)(t)}function pF(e){return[0,e.length?jt(e,({value:t})=>t===void 0?t:jt(t,ix)):1]}function mF(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=si(e,.5,({value:a})=>a===void 0?NaN:si(a,.25,ps)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/jt(o);return i<1?o.map(a=>a*i):o}function dF(e,t){let r=ja(e,({value:i})=>i===void 0?NaN:ja(i,Math.abs)),n=t.map(i=>12*i/r),o=60/jt(n);return o<1?n.map(i=>i*o):n}function hF(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Kc(e,ps);if(r<0)return Kc(e,Ac)}return[1,10]}function yF(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function ll(e){return(t,r)=>n=>e(t+n*(r-t))}var Lx=0,Vx;function I6(){let e=Lx;return Lx=0,Vx=void 0,e}function Lr(e){e!==Vx&&(Vx=e,console.warn(e),++Lx)}function ch(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=Kc(n),unknown:c,pivot:u=0,scheme:f,range:m,symmetric:l=!0,interpolate:p=He.get(e)===tn?f==null&&m!==void 0?bn:Gc(f!==void 0?f:"rdbu"):st,reverse:h}){u=+u,s=Fo(s);let[y,b]=s;if(s.length>2&&Lr(`Warning: the diverging ${e} scale domain contains extra elements.`),mn(y,b)<0&&([y,b]=[b,y],h=!h),y=Math.min(y,u),b=Math.max(b,u),typeof p!="function"&&(p=$x(p)),m!==void 0&&(p=p.length===1?ll(p)(...m):wo(p,m)),h&&(p=Fx(p)),l){let w=r.apply(u),g=w-r.apply(y),_=r.apply(b)-w;g<_?y=r.invert(w-_):g>_&&(b=r.invert(w+g))}return t.domain([y,u,b]).unknown(c).interpolator(p),a&&t.clamp(a),i&&t.nice(i),{type:o,domain:[y,b],pivot:u,interpolate:p,scale:t}}function _6(e,t,r){return ch(e,Uu(),bF,t,r)}function v6(e,t,r){return jx(e,t,{...r,exponent:.5})}function jx(e,t,{exponent:r=1,...n}){return ch(e,Am().exponent(r=+r),wF(r),t,{...n,type:"diverging-pow"})}function P6(e,t,{base:r=10,pivot:n=1,domain:o=Kc(t,n<0?Ac:ps),...i}){return ch(e,Rm().base(r=+r),gF,t,{domain:o,pivot:n,...i})}function T6(e,t,{constant:r=1,...n}){return ch(e,Nm().constant(r=+r),SF(r),t,n)}var bF={apply(e){return e},invert(e){return e}},gF={apply:Math.log,invert:Math.exp},xF={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function wF(e){return e===.5?xF:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function SF(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function M6(e,t,r,n){return qc(e,t,r,n)}function O6(e,t,r){return M6(e,Om(),t,r)}function C6(e,t,r){return M6(e,Cm(),t,r)}var Hc=Symbol("ordinal");function R6(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:c}){return o=da(o,n),i===void 0&&(i=$6(r,o,e)),(n==="categorical"||n===Hc)&&(n="ordinal"),s&&(i=Wi(i)),i=t.domain(i).domain(),a!==void 0&&(typeof a=="function"&&(a=a(i)),t.range(a)),{type:n,domain:i,range:a,scale:t,hint:c,interval:o}}function N6(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...c}){n=da(n,r),o===void 0&&(o=$6(t,n,e));let u;if(He.get(e)===Uc)u=IF(t),i=i===void 0?_F(u):et(i,Bc);else if(He.get(e)===tn&&(i===void 0&&(r==="ordinal"||r===Hc)&&(i=u6(o,a),i!==void 0&&(a=void 0)),a===void 0&&i===void 0&&(a=r==="ordinal"?"turbo":"observable10"),a!==void 0))if(i!==void 0){let f=Gc(a),m=i[0],l=i[1]-i[0];i=({length:p})=>pr(h=>f(m+l*h),p)}else i=Ax(a);if(s===Tu)throw new Error(`implicit unknown on ${e} scale is not supported`);return R6(e,Ja().unknown(s),t,{...c,type:r,domain:o,range:i,hint:u})}function A6(e,t,{align:r=.5,padding:n=.5,...o}){return F6(ng().align(r).padding(n),t,o,e)}function E6(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return F6(na().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function F6(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=R6(n,e,t,r),e.round=o,e}function $6(e,t,r){let n=new zn;for(let{value:o,domain:i}of e){if(i!==void 0)return i();if(o!==void 0)for(let a of o)n.add(a)}if(t!==void 0){let[o,i]=Er(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&He.get(r)===Mn)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Yi(n,$r)}function k6(e,t){let r;for(let{hint:n}of e){let o=n?.[t];if(o!==void 0){if(r===void 0)r=o;else if(r!==o)return}}return r}function IF(e){return{fill:k6(e,"fill"),stroke:k6(e,"stroke")}}function _F(e){return Ht(e.fill)?Lg:Kd}function pl(e,{label:t,inset:r=0,insetTop:n=r,insetRight:o=r,insetBottom:i=r,insetLeft:a=r,round:s,nice:c,clamp:u,zero:f,align:m,padding:l,projection:p,facet:{label:h=t}={},...y}={}){let b={};for(let[w,g]of e){let _=y[w],x=TF(w,g,{round:He.get(w)===Mn?s:void 0,nice:c,clamp:u,zero:f,align:m,padding:l,projection:p,..._});if(x){let{label:I=w==="fx"||w==="fy"?h:t,percent:S,transform:v,inset:T,insetTop:O=T!==void 0?T:w==="y"?n:0,insetRight:R=T!==void 0?T:w==="x"?o:0,insetBottom:C=T!==void 0?T:w==="y"?i:0,insetLeft:k=T!==void 0?T:w==="x"?a:0}=_||{};if(v==null)v=void 0;else if(typeof v!="function")throw new Error("invalid scale transform; not a function");x.percent=!!S,x.label=I===void 0?vF(g,x):I,x.transform=v,w==="x"||w==="fx"?(x.insetLeft=+k,x.insetRight=+R):(w==="y"||w==="fy")&&(x.insetTop=+O,x.insetBottom=+C),b[w]=x}}return b}function Bx(e){let t={},r={scales:t};for(let[n,o]of Object.entries(e)){let{scale:i,type:a,interval:s,label:c}=o;t[n]=kF(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),c!=null&&(i.label=c)}return r}function U6(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?uh(t):t;o&&D6(o,a),i&&L6(i,a);let s=o||i?zx(e,t):t;r&&D6(r,s),n&&L6(n,s)}function vF(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!Do(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function B6(e){return Math.sign(_i(e.domain()))*Math.sign(_i(e.range()))}function uh(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:o,width:i,height:a,facet:{marginTop:s,marginRight:c,marginBottom:u,marginLeft:f}}=e;return{marginTop:Math.max(t,s),marginRight:Math.max(r,c),marginBottom:Math.max(n,u),marginLeft:Math.max(o,f),width:i,height:a}}function zx({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=uh(r);return{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:e?e.scale.bandwidth()+a+o:s,height:t?t.scale.bandwidth()+n+i:c,facet:{width:s,height:c}}}function D6(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:o,marginLeft:i=0,marginRight:a=0}=t,s=i+r,c=o-a-n;e.range=[s,Math.max(s,c)],Do(e)||(e.range=G6(e)),e.scale.range(e.range)}z6(e)}function L6(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:o,marginTop:i=0,marginBottom:a=0}=t,s=i+r,c=o-a-n;e.range=[Math.max(s,c),s],Do(e)?e.range.reverse():e.range=G6(e),e.scale.range(e.range)}z6(e)}function z6(e){e.round===void 0&&OF(e)&&PF(e)<=30&&e.scale.round(!0)}function PF({scale:e}){let t=e.domain().length,[r,n]=e.range(),o=e.paddingInner?e.paddingInner():1,i=e.paddingOuter?e.paddingOuter():e.padding(),a=t-o,s=Math.abs(n-r)/Math.max(1,a+i*2);return(s-Math.floor(s))*a}function G6(e){let t=e.scale.domain().length+Gx(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(o,i)=>r+i/(t-1)*(n-r))}function TF(e,t=[],r={}){let n=MF(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Do({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(Kt)?Lr(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Yc(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Yc(n)}".`):o.some(NT)?Lr(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Yc(n)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Yc(n)}".`):o.some(AT)&&Lr(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Yc(n)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Yc(n)}".`)}switch(r.type=n,n){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":r=fh(t,r,ds);break;case"identity":switch(He.get(e)){case Mn:r=fh(t,r,ds);break;case Uc:r=fh(t,r,CF);break}break;case"utc":case"time":r=fh(t,r,xx);break}switch(n){case"diverging":return _6(e,t,r);case"diverging-sqrt":return v6(e,t,r);case"diverging-pow":return jx(e,t,r);case"diverging-log":return P6(e,t,r);case"diverging-symlog":return T6(e,t,r);case"categorical":case"ordinal":case Hc:return N6(e,t,r);case"cyclical":case"sequential":case"linear":return d6(e,t,r);case"sqrt":return h6(e,t,r);case"threshold":return sh(e,t,r);case"quantile":return g6(e,t,r);case"quantize":return x6(e,t,r);case"pow":return Dx(e,t,r);case"log":return y6(e,t,r);case"symlog":return b6(e,t,r);case"utc":return C6(e,t,r);case"time":return O6(e,t,r);case"point":return A6(e,t,r);case"band":return E6(e,t,r);case"identity":return w6(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Yc(e){return typeof e=="symbol"?e.description:e}function V6(e){return typeof e=="string"?`${e}`.toLowerCase():e}var j6={toString:()=>"projection"};function MF(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=V6(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=j6);for(let f of t){let m=V6(f.type);if(m!==void 0){if(r===void 0)r=m;else if(r!==m)throw new Error(`scale incompatible with channel: ${r} !== ${m}`)}}if(r===j6)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:f})=>f!==void 0))return;let c=He.get(e);if(c===ys)return"sqrt";if(c===gs||c===bs)return"linear";if(c===Uc)return"ordinal";let u=(n??o)?.length;if(u<2||u>2)return Ux(c);if(n!==void 0){if(_x(n))return Ux(c);if(Kt(n))return"utc"}else{let f=t.map(({value:m})=>m).filter(m=>m!==void 0);if(f.some(_x))return Ux(c);if(f.some(Kt))return"utc"}if(c===tn){if(a!=null||l6(i))return"diverging";if(f6(i))return"categorical"}return"linear"}function Ux(e){switch(e){case Mn:return"point";case tn:return Hc;default:return"ordinal"}}function Do({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Hc}function Gx({type:e}){return e==="threshold"}function OF({type:e}){return e==="point"||e==="band"}function ba(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,o=t.length;n{if(!He.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function kF({scale:e,type:t,domain:r,range:n,interpolate:o,interval:i,transform:a,percent:s,pivot:c}){if(t==="identity")return{type:"identity",apply:f=>f,invert:f=>f};let u=e.unknown?e.unknown():void 0;return{type:t,domain:ua(r),...n!==void 0&&{range:ua(n)},...a!==void 0&&{transform:a},...s&&{percent:s},...u!==void 0&&{unknown:u},...i!==void 0&&{interval:i},...o!==void 0&&{interpolate:o},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:f=>e(f),...e.invert&&{invert:f=>e.invert(f)}}}function H6(e,t){let{fx:r,fy:n}=pl(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?cp(o,i).map(([a,s],c)=>({x:a,y:s,i:c})):o?o.map((a,s)=>({x:a,i:s})):i?i.map((a,s)=>({y:a,i:s})):void 0}function Y6(e,{x:t,y:r}){return t&&=Wx(t),r&&=Wx(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,o)=>t.get(n.x)-t.get(o.x)||r.get(n.y)-r.get(o.y):t?(n,o)=>t.get(n.x)-t.get(o.x):(n,o)=>r.get(n.y)-r.get(o.y))}function ph(e,{fx:t,fy:r}){let n=Dr(e),o=t?.value,i=r?.value;return t&&r?ho(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?ho(n,a=>(a.fx=o[a[0]],a),a=>o[a]):ho(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function W6(e,t,{marginTop:r,marginLeft:n}){let o=e?({x:a})=>e(a)-n:()=>0,i=t?({y:a})=>t(a)-r:()=>0;return function(a){this.tagName==="svg"?(this.setAttribute("x",o(a)),this.setAttribute("y",i(a))):this.setAttribute("transform",`translate(${o(a)},${i(a)})`)}}function X6(e){let t=[],r=new Uint32Array(dn(e,n=>n.length));for(let n of e){let o=0;for(let i of e)n!==i&&(r.set(i,o),o+=i.length);t.push(r.slice(0,o))}return t}var RF=new Map([["top",Kx],["right",Yx],["bottom",qx],["left",Hx],["top-left",lh(Kx,Hx)],["top-right",lh(Kx,Yx)],["bottom-left",lh(qx,Hx)],["bottom-right",lh(qx,Yx)],["top-empty",AF],["right-empty",$F],["bottom-empty",EF],["left-empty",FF],["empty",DF]]);function Z6(e){if(e==null)return null;let t=RF.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var q6=new WeakMap;function Wx(e){let t=q6.get(e);return t||q6.set(e,t=new Sr(et(e,(r,n)=>[r,n]))),t}function ga(e,t){return Wx(e).get(t)}function NF(e,t,r){return t=Pn(t),r=Pn(r),e.find(n=>Object.is(Pn(n.x),t)&&Object.is(Pn(n.y),r))}function mh(e,t,r){return NF(e,t,r)?.empty}function Kx(e,{y:t},{y:r}){return t?ga(t,r)===0:!0}function qx(e,{y:t},{y:r}){return t?ga(t,r)===t.length-1:!0}function Hx(e,{x:t},{x:r}){return t?ga(t,r)===0:!0}function Yx(e,{x:t},{x:r}){return t?ga(t,r)===t.length-1:!0}function AF(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=ga(t,n);if(i>0)return mh(e,r,t[i-1])}function EF(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=ga(t,n);if(i0)return mh(e,t[i-1],n)}function $F(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=ga(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var Q6=Math.PI,ki=2*Q6,Xx=.618;function J6({projection:e,inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={},a){if(e==null)return;if(typeof e.stream=="function")return e;let s,c,u="frame";if($o(e)){let I;if({type:e,domain:c,inset:I,insetTop:r=I!==void 0?I:r,insetRight:n=I!==void 0?I:n,insetBottom:o=I!==void 0?I:o,insetLeft:i=I!==void 0?I:i,clip:u=u,...s}=e,e==null)return}typeof e!="function"&&({type:e}=Zx(e));let{width:f,height:m,marginLeft:l,marginRight:p,marginTop:h,marginBottom:y}=a,b=f-l-p-i-n,w=m-h-y-r-o;if(e=e?.({width:b,height:w,clip:u,...s}),e==null)return;u=LF(u,l,h,f-p,m-y);let g=l+i,_=h+r,x;if(c!=null){let[[I,S],[v,T]]=bc(e).bounds(c),O=Math.min(b/(v-I),w/(T-S));O>0?(g-=(O*(I+v)-b)/2,_-=(O*(S+T)-w)/2,x=gc({point(R,C){this.stream.point(R*O+g,C*O+_)}})):Lr("Warning: the projection could not be fit to the specified domain; using the default scale.")}return x??=g===0&&_===0?eM():gc({point(I,S){this.stream.point(I+g,S+_)}}),{stream:I=>e.stream(x.stream(u(I)))}}function Zx(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Zn(Db,.7463,.4673);case"albers":return hh(wu,.7463,.4673);case"azimuthal-equal-area":return Zn(Vb,4,4);case"azimuthal-equidistant":return Zn(Ub,ki,ki);case"conic-conformal":return hh(Gb,ki,ki);case"conic-equal-area":return hh(ra,6.1702,2.9781);case"conic-equidistant":return hh(qb,7.312,3.6282);case"equal-earth":return Zn(Yb,5.4133,2.6347);case"equirectangular":return Zn(Kb,ki,Q6);case"gnomonic":return Zn(Xb,3.4641,3.4641);case"identity":return{type:eM};case"reflect-y":return{type:VF};case"mercator":return Zn(Bb,ki,ki);case"orthographic":return Zn(Qb,2,2);case"stereographic":return Zn(eg,2,2);case"transverse-mercator":return Zn(rg,ki,ki);default:throw new Error(`unknown projection type: ${e}`)}}function LF(e,t,r,n,o){if(e===!1||e==null||typeof e=="number")return i=>i;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return pc(t,r,n,o);default:throw new Error(`unknown projection clip type: ${e}`)}}function Zn(e,t,r){return{type:({width:n,height:o,rotate:i,precision:a=.15,clip:s})=>{let c=e();return a!=null&&c.precision?.(a),i!=null&&c.rotate?.(i),typeof s=="number"&&c.clipAngle?.(s),n!=null&&(c.scale(Math.min(n/t,o/r)),c.translate([n/2,o/2])),c},aspectRatio:r/t}}function hh(e,t,r){let{type:n,aspectRatio:o}=Zn(e,t,r);return{type:i=>{let{parallels:a,domain:s,width:c,height:u}=i,f=n(i);return a!=null&&(f.parallels(a),s===void 0&&c!=null&&f.fitSize([c,u],{type:"Sphere"})),f},aspectRatio:o}}var eM=en({stream:e=>e}),VF=en(gc({point(e,t){this.stream.point(e,-t)}}));function tM(e,t,r,n){let o=r[e],i=r[t],a=o.length,s=r[e]=new Float64Array(a).fill(NaN),c=r[t]=new Float64Array(a).fill(NaN),u,f=n.stream({point(m,l){s[u]=m,c[u]=l}});for(u=0;u5?5:c:Xx}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=Zx(e);if(t)return t}return Xx}}function oM(e){let t=[],r=[],n={scale:"x",value:t},o={scale:"y",value:r},i={point(a,s){t.push(a),r.push(s)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let a of e.value)Yn(a,i);return[n,o]}function iM({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,gc({point(r,n){this.stream.point(e(r),t(n))}})}function Wc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:ah(r)}}function ze(e,{document:t}){return hn(fi(e).call(t.documentElement))}var yh=Symbol("unset");function bh(e){return(e.length===1?jF:UF)(e)}function jF(e){let t,r=yh;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function UF(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((o,i)=>!Object.is(o,n[i])))&&(r=n,t=e(...n)),t)}var BF=bh(e=>new Intl.NumberFormat(e)),owe=bh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),iwe=bh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function zF(e="en-US"){let t=BF(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function GF(e){return Zd(e,"Invalid Date")}function KF(e="en-US"){let t=zF(e);return r=>(r instanceof Date?GF:typeof r=="number"?t:Mt)(r)}var Lo=KF();var or=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,qF=0;function sM(){return`plot-clip-${++qF}`}function cM(e,{title:t,href:r,ariaLabel:n,ariaDescription:o,ariaHidden:i,target:a,fill:s,fillOpacity:c,stroke:u,strokeWidth:f,strokeOpacity:m,strokeLinejoin:l,strokeLinecap:p,strokeMiterlimit:h,strokeDasharray:y,strokeDashoffset:b,opacity:w,mixBlendMode:g,imageFilter:_,paintOrder:x,pointerEvents:I,shapeRendering:S,channels:v},{ariaLabel:T,fill:O="currentColor",fillOpacity:R,stroke:C="none",strokeOpacity:k,strokeWidth:z,strokeLinecap:j,strokeLinejoin:M,strokeMiterlimit:U,paintOrder:L}){O===null&&(s=null,c=null),C===null&&(u=null,m=null),Ht(O)?!Ht(C)&&(!Ht(s)||v?.fill)&&(C="none"):Ht(C)&&(!Ht(u)||v?.stroke)&&(O="none");let[re,V]=Eo(s,O),[q,H]=It(c,R),[W,te]=Eo(u,C),[be,K]=It(m,k),[Z,Y]=It(w);hs(te)||(f===void 0&&(f=z),p===void 0&&(p=j),l===void 0&&(l=M),h===void 0&&!$T(l)&&(h=U),!hs(V)&&x===void 0&&(x=L));let[ee,A]=It(f);return O!==null&&(e.fill=_t(V,"currentColor"),e.fillOpacity=ml(H,1)),C!==null&&(e.stroke=_t(te,"none"),e.strokeWidth=ml(A,1),e.strokeOpacity=ml(K,1),e.strokeLinejoin=_t(l,"miter"),e.strokeLinecap=_t(p,"butt"),e.strokeMiterlimit=ml(h,4),e.strokeDasharray=_t(y,"none"),e.strokeDashoffset=_t(b,"0")),e.target=Mt(a),e.ariaLabel=Mt(T),e.ariaDescription=Mt(o),e.ariaHidden=Mt(i),e.opacity=ml(Y,1),e.mixBlendMode=_t(g,"normal"),e.imageFilter=_t(_,"none"),e.paintOrder=_t(x,"normal"),e.pointerEvents=_t(I,"auto"),e.shapeRendering=_t(S,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:re,scale:"auto",optional:!0},fillOpacity:{value:q,scale:"auto",optional:!0},stroke:{value:W,scale:"auto",optional:!0},strokeOpacity:{value:be,scale:"auto",optional:!0},strokeWidth:{value:ee,optional:!0},opacity:{value:Z,scale:"auto",optional:!0}}}function HF(e,t){t&&e.filter(r=>ol(t[r])).append("title").call(WF,t)}function YF(e,t){t&&e.filter(([r])=>ol(t[r])).append("title").call(XF,t)}function WF(e,t){t&&e.text(r=>Lo(t[r]))}function XF(e,t){t&&e.text(([r])=>Lo(t[r]))}function Vr(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:m}){n&&de(e,"aria-label",l=>n[l]),i&&de(e,"fill",l=>i[l]),a&&de(e,"fill-opacity",l=>a[l]),s&&de(e,"stroke",l=>s[l]),c&&de(e,"stroke-opacity",l=>c[l]),u&&de(e,"stroke-width",l=>u[l]),f&&de(e,"opacity",l=>f[l]),m&&lM(e,l=>m[l],t),r||HF(e,o)}function fM(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:m}){n&&de(e,"aria-label",([l])=>n[l]),i&&de(e,"fill",([l])=>i[l]),a&&de(e,"fill-opacity",([l])=>a[l]),s&&de(e,"stroke",([l])=>s[l]),c&&de(e,"stroke-opacity",([l])=>c[l]),u&&de(e,"stroke-width",([l])=>u[l]),f&&de(e,"opacity",([l])=>f[l]),m&&lM(e,([l])=>m[l],t),r||YF(e,o)}function ZF({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:i,strokeWidth:a,opacity:s,href:c},{tip:u}){return[e,u?void 0:t,r,n,o,i,a,s,c].filter(f=>f!==void 0)}function QF(e,t,r){let n=ii(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&Lr("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),n.values()}function*uM(e,t,r,n){let{z:o}=r,{z:i}=n,a=ZF(n,r),s=[...t,...a];for(let c of i?QF(e,i,o):[e]){let u,f;e:for(let m of c){for(let l of s)if(!vn(l[m])){f&&f.push(-1);continue e}if(u===void 0){f&&(yield f),u=a.map(l=>Pn(l[m])),f=[m];continue}f.push(m);for(let l=0;lPn(h[m])),f=[m];continue e}}f&&(yield f)}}function JF(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=ze("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=t9(n,r)):i&&(o=n9(i,n)),de(e,"aria-label",t.ariaLabel),de(e,"aria-description",t.ariaDescription),de(e,"aria-hidden",t.ariaHidden),de(e,"clip-path",o)}function e9(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=sM();hn(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var t9=e9((e,t,r)=>{let{width:n,height:o,marginLeft:i,marginRight:a,marginTop:s,marginBottom:c}=r;e.append("rect").attr("x",i).attr("y",s).attr("width",n-a-i).attr("height",o-s-c)}),aM=new WeakMap,r9={type:"Sphere"};function n9(e,t){let r,n;if((r=aM.get(t))||aM.set(t,r=new WeakMap),e.type==="Sphere"&&(e=r9),!(n=r.get(e))){let o=sM();hn(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function ir(e,t,r,n){JF(e,t,r,n),de(e,"class",t.className),de(e,"fill",t.fill),de(e,"fill-opacity",t.fillOpacity),de(e,"stroke",t.stroke),de(e,"stroke-width",t.strokeWidth),de(e,"stroke-opacity",t.strokeOpacity),de(e,"stroke-linejoin",t.strokeLinejoin),de(e,"stroke-linecap",t.strokeLinecap),de(e,"stroke-miterlimit",t.strokeMiterlimit),de(e,"stroke-dasharray",t.strokeDasharray),de(e,"stroke-dashoffset",t.strokeDashoffset),de(e,"shape-rendering",t.shapeRendering),de(e,"filter",t.imageFilter),de(e,"paint-order",t.paintOrder);let{pointerEvents:o=n.pointerSticky===!1?"none":void 0}=t;de(e,"pointer-events",o)}function Wt(e,t){o9(e,"mix-blend-mode",t.mixBlendMode),de(e,"opacity",t.opacity)}function lM(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS(yo.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(yo.xlink,"href",o),r!=null&&i.setAttribute("target",r),this.parentNode.insertBefore(i,this).appendChild(this)}})}function de(e,t,r){r!=null&&e.attr(t,r)}function o9(e,t,r){r!=null&&e.style(t,r)}function ar(e,t,{x:r,y:n},o=or,i=or){o+=t.dx,i+=t.dy,r?.bandwidth&&(o+=r.bandwidth()/2),n?.bandwidth&&(i+=n.bandwidth()/2),(o||i)&&e.attr("transform",`translate(${o},${i})`)}function _t(e,t){if((e=Mt(e))!==t)return e}function ml(e,t){if((e=Ot(e))!==t)return e}var i9=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Xc(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!i9.test(e))throw new Error(`invalid class name: ${e}`);return e}function Zc(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function Vo({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:o,marginBottom:i,marginLeft:a}){return[/left$/.test(e)?a:/right$/.test(e)?t-o:(a+t-o)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-i:(n+r-i)/2]}var lt=class{constructor(t,r={},n={},o){let{facet:i="auto",facetAnchor:a,fx:s,fy:c,sort:u,dx:f=0,dy:m=0,margin:l=0,marginTop:p=l,marginRight:h=l,marginBottom:y=l,marginLeft:b=l,className:w,clip:g=o?.clip,channels:_,tip:x,render:I}=n;if(this.data=t,this.sort=la(u)?u:null,this.initializer=Ti(n).initializer,this.transform=this.initializer?n.transform:fl(n).transform,i===null||i===!1?this.facet=null:(this.facet=Pr(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=t===Dc&&typeof s=="string"?[s]:s,this.fy=t===Dc&&typeof c=="string"?[c]:c),this.facetAnchor=Z6(a),r=vx(r),_!==void 0&&(r={...a9(_),...r}),o!==void 0&&(r={...cM(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([S,v])=>{if(Vc(v.value)){let{value:T,label:O=v.label,scale:R=v.scale}=v.value;v={...v,label:O,scale:R,value:T}}if(t===Dc&&typeof v.value=="string"){let{value:T}=v;v={...v,value:[T]}}return[S,v]}).filter(([S,{value:v,optional:T}])=>{if(v!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${S}`)})),this.dx=+f,this.dy=+m,this.marginTop=+p,this.marginRight=+h,this.marginBottom=+y,this.marginLeft=+b,this.clip=ah(g),this.tip=s9(x),this.className=Mt(w),this.facet==="super"){if(s||c)throw new Error("super-faceting cannot use fx or fy");for(let S in this.channels){let{scale:v}=r[S];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}I!=null&&(this.render=Jx(I,this.render))}initialize(t,r,n){let o=vi(this.data);t===void 0&&o!=null&&(t=[Dr(o)]);let i=t;this.transform!=null&&({facets:t,data:o}=this.transform(o,t,n),o=vi(o)),t!==void 0&&(t.original=i);let a=JT(this.channels,o);return this.sort!=null&&t6(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=vn}=r[o];if(i!==null){let a=n[o];t=t.filter(s=>i(a[s]))}}return t}project(t,r,n){for(let o in t)if(t[o].scale==="x"&&/^x|x$/.test(o)){let i=o.replace(/^x|x$/,"y");i in t&&t[i].scale==="y"&&tM(o,i,r,n.projection)}}scale(t,r,n){let o=e6(t,r);return n.projection&&this.project(t,o,n),o}};function Qx(...e){return e.plot=lt.prototype.plot,e}function Jx(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(r,n,o,i,a,s){return e.call(this,r,n,o,i,a,(c,u,f,m,l)=>t.call(this,c,u,f,m,l,s))}}function a9(e){return Object.fromEntries(Object.entries(vx(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:ha(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function s9(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Pr(e,"tip",["x","y","xy"]):e}function dl(e,t){return e?.tip===!0?{...e,tip:t}:$o(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function mM(e,t,r={}){let n=.5-or,o=.5+or,i=.5+or,a=.5-or;for(let{marginTop:y,marginRight:b,marginBottom:w,marginLeft:g}of t)y>n&&(n=y),b>o&&(o=b),w>i&&(i=w),g>a&&(a=g);let{margin:s,marginTop:c=s!==void 0?s:n,marginRight:u=s!==void 0?s:o,marginBottom:f=s!==void 0?s:i,marginLeft:m=s!==void 0?s:a}=r;c=+c,u=+u,f=+f,m=+m;let{width:l=640,height:p=c9(e,r,{width:l,marginTopDefault:n,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,c-n+f-i)}=r;l=+l,p=+p;let h={width:l,height:p,marginTop:c,marginRight:u,marginBottom:f,marginLeft:m};if(e.fx||e.fy){let{margin:y,marginTop:b=y!==void 0?y:c,marginRight:w=y!==void 0?y:u,marginBottom:g=y!==void 0?y:f,marginLeft:_=y!==void 0?y:m}=r.facet??{};b=+b,w=+w,g=+g,_=+_,h.facet={marginTop:b,marginRight:w,marginBottom:g,marginLeft:_}}return h}function c9({x:e,y:t,fy:r,fx:n},{projection:o,aspectRatio:i},{width:a,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:u,marginLeftDefault:f}){let m=r&&r.scale.domain().length||1,l=nM(o);if(l){let h=n?n.scale.domain().length:1,y=(1.1*m-.1)/(1.1*h-.1)*l,b=Math.max(.1,Math.min(10,y));return Math.round((a-f-c)*b+s+u)}let p=t?Do(t)?t.scale.domain().length||1:Math.max(7,17/m):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=pM("y",t)/(pM("x",e)*i),y=n?n.scale.bandwidth():1,b=r?r.scale.bandwidth():1,w=y*(a-f-c)-e.insetLeft-e.insetRight;return(h*w+t.insetTop+t.insetBottom)/b+s+u}return!!(t||r)*Math.max(1,Math.min(60,p*m))*20+!!n*30+60}function pM(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,o;switch(r){case"linear":case"utc":case"time":o=Number;break;case"pow":{let s=t.scale.exponent();o=c=>Math.pow(c,s);break}case"log":o=Math.log;break;case"point":case"band":return n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[i,a]=Er(n);return Math.abs(o(a)-o(i))}var dM=new WeakMap;function e1(e,t,{x:r,y:n,px:o,py:i,maxRadius:a=40,channels:s,render:c,...u}={}){return a=+a,o!=null&&(r??=null,s={...s,px:{value:o,scale:"x"}}),i!=null&&(n??=null,s={...s,py:{value:i,scale:"y"}}),{x:r,y:n,channels:s,...u,render:Jx(function(f,m,l,p,h,y){h={...h,pointerSticky:!1};let b=h.ownerSVGElement,{data:w}=h.getMarkState(this),g=dM.get(b);g||dM.set(b,g={sticky:!1,roots:[],renders:[]});let _=g.renders.push(te)-1,{x,y:I,fx:S,fy:v}=m,T=S?S(f.fx)-p.marginLeft:0,O=v?v(f.fy)-p.marginTop:0;x?.bandwidth&&(T+=x.bandwidth()/2),I?.bandwidth&&(O+=I.bandwidth()/2);let R=f.fi!=null,C;if(R){let Y=g.facetStates;Y||(g.facetStates=Y=new Map),C=Y.get(this),C||Y.set(this,C=new Map)}let[k,z]=Vo(this,p),{px:j,py:M}=l,U=j?Y=>j[Y]:r1(l,k),L=M?Y=>M[Y]:n1(l,z),re,V,q,H;function W(Y,ee){if(R)if(H&&(H=cancelAnimationFrame(H)),Y==null)C.delete(f.fi);else{C.set(f.fi,ee),H=requestAnimationFrame(()=>{H=null;for(let[A,B]of C)if(B1)){let B=re==null?null:Xn(w)?w[re]:w.get(re);h.dispatchValue(B)}return A}function be(Y){if(g.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[ee,A]=jy(Y);ee-=T,A-=O;let B=eep.width-p.marginRight?1:e,Q=Ap.height-p.marginBottom?1:t,E=null,me=a*a;for(let G of f){let oe=B*(U(G)-ee),ue=Q*(L(G)-A),Ce=oe*oe+ue*ue;Ce<=me&&(E=G,me=Ce)}if(E!=null&&(e!==1||t!==1)){let G=U(E)-ee,oe=L(E)-A;me=G*G+oe*oe}W(E,me)}function K(Y){Y.pointerType==="mouse"&&re!=null&&(g.sticky&&g.roots.some(ee=>ee?.contains(Y.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(ee=>ee(null))):(g.sticky=!0,te(re)),Y.stopImmediatePropagation()))}function Z(Y){Y.pointerType==="mouse"&&(g.sticky||W(null))}return b.addEventListener("pointerenter",be),b.addEventListener("pointermove",be),b.addEventListener("pointerdown",K),b.addEventListener("pointerleave",Z),te(null)},c)}}function hM(e){return e1(1,1,e)}function yM(e){return e1(1,.01,e)}function t1(e){return e1(.01,1,e)}function r1({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function n1({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function gh(e){return Do(e)&&e.interval===void 0?void 0:"tabular-nums"}function bM(e,t){let{label:r=e.label,tickSize:n=6,width:o=240,height:i=44+n,marginTop:a=18,marginRight:s=0,marginBottom:c=16+n,marginLeft:u=0,style:f,ticks:m=(o-u-s)/64,tickFormat:l,fontVariant:p=gh(e),round:h=!0,opacity:y,className:b}=t,w=Wc(t);b=Xc(b),y=It(y)[1],l===null&&(l=()=>null);let g=ze("svg",w).attr("class",`${b}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(k=>k.append("style").text(`:where(.${b}-ramp) { display: block; height: auto; height: intrinsic; max-width: 100%; overflow: visible; } -:where(.${x}-ramp text) { +:where(.${b}-ramp text) { white-space: pre; -}`)).call(Mf,c),S=F=>F.selectAll(".tick line").attr("y1",a+f-i),b,T=d?(F,H)=>F.rangeRound(H):(F,H)=>F.range(H),{type:I,domain:v,range:O,interpolate:C,scale:E,pivot:A}=e;if(C){let F=O===void 0?C:no(C.length===1?ku(C):C,O);b=T(E.copy(),ir(et(u,o-s),Math.min(v.length+(A!==void 0),O===void 0?1/0:O.length)));let H=256,j=w.document.createElement("canvas");j.width=H,j.height=1;let M=j.getContext("2d");for(let U=0,D=H-1;Uj:typeof l=="string"?sn(l):l;b=T(Pa().domain([-1,O.length-1]),[u,o-s]),g.append("g").attr("fill-opacity",y).selectAll().data(O).enter().append("rect").attr("x",(j,M)=>b(M-1)).attr("y",a).attr("width",(j,M)=>b(M)-b(M-1)).attr("height",i-a-f).attr("fill",j=>j),m=We(F,(j,M)=>M),l=j=>H(F[j],j)}else b=T(Ei().domain(v),[u,o-s]),g.append("g").attr("fill-opacity",y).selectAll().data(v).enter().append("rect").attr("x",b).attr("y",a).attr("width",Math.max(0,b.bandwidth()-1)).attr("height",i-a-f).attr("fill",E),S=()=>{};return g.append("g").attr("transform",`translate(0,${i-f})`).call(B0(b).ticks(Array.isArray(m)?null:m,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(n).tickValues(Array.isArray(m)?m:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",yt(p,"normal")).call(S).call(F=>F.select(".domain").remove()),r!==void 0&&g.append("text").attr("x",u).attr("y",a-6).attr("fill","currentColor").attr("font-weight","bold").text(r),g.node()}var lb=Math.PI/180;function $u(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=pb(r),e.markerMid=pb(n),e.markerEnd=pb(o)}function pb(e){if(e==null||e===!1)return null;if(e===!0)return mM;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return pM("auto");case"arrow-reverse":return pM("auto-start-reverse");case"dot":return JN;case"circle":case"circle-fill":return mM;case"circle-stroke":return eF;case"tick":return mb("auto");case"tick-x":return mb(90);case"tick-y":return mb(0)}throw new Error(`invalid marker: ${e}`)}function pM(e){return(t,r)=>Ve("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function JN(e,t){return Ve("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function mM(e,t){return Ve("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function eF(e,t){return Ve("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function mb(e){return(t,r)=>Ve("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var tF=0;function hb(e,t,{stroke:r},n){return yM(e,t,r&&(o=>r[o]),null,n)}function dM(e,t,{stroke:r,z:n},o){return yM(e,t,r&&(([i])=>r[i]),n,o)}var db=1,hM=2;function rF(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=Ed;i1){let f=s[0];a!==(a=dn(t[f]))&&(r[f]|=db)}}for(let i=o-1,a=Ed;i>=0;--i){let s=n[i];if(s.length>1){let f=s[0];a!==(a=dn(t[f]))&&(r[f]|=hM)}}return([i])=>r[i]}function yM(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let f=new Map,u=a&&rF(e,a);function c(m,l,p){return function(d){if(p&&!p(d))return;let y=i(d),x=f.get(l);x||f.set(l,x=new Map);let w=x.get(y);if(!w){let g=this.parentNode.insertBefore(l(y,s),this),S=`plot-marker-${++tF}`;g.setAttribute("id",S),x.set(y,w=`url(#${S})`)}this.setAttribute(m,w)}}t&&e.each(c("marker-start",t,u&&(m=>u(m)&db))),r&&u&&e.each(c("marker-start",r,m=>!(u(m)&db))),r&&e.each(c("marker-mid",r)),n&&e.each(c("marker-end",n,u&&(m=>u(m)&hM)))}function Dd({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=xM(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function yb({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=xM(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function xM(e,t,r){return e===void 0&&t===void 0&&r===void 0?Zt?[1,0]:[.5,.5]:[t,r]}function gM(e,{interval:t}){return e={...Hi(e)},e.interval=Sd(e.interval===void 0?t:e.interval),e}function xb(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:f}=gM(o,r);if(s==null||f==null&&!n)return r;let u=Ki(o);if(f==null){let p,d={transform:y=>p||(p=Vt(y,s)),label:u};return{...r,[e]:void 0,[`${e}1`]:i===void 0?d:i,[`${e}2`]:a===void 0&&!(i===a&&n)?d:a}}let c,m;function l(p){return m!==void 0&&p===c?m:m=We(Vt(c=p,s),d=>f.floor(d))}return t({...r,[e]:void 0,[`${e}1`]:i===void 0?{transform:l,label:u}:i,[`${e}2`]:a===void 0?{transform:p=>l(p).map(d=>f.offset(d)),label:u}:a})}function bM(e,t,r){let{[e]:n}=r,{value:o,interval:i}=gM(n,r);return o==null||i==null?r:t({...r,[e]:{label:Ki(n),transform:a=>{let s=We(Vt(a,o),u=>i.floor(u)),f=s.map(u=>i.offset(u));return s.map(Dt(s)?(u,c)=>u==null||isNaN(u=+u)||(c=f[c],c==null)||isNaN(c=+c)?void 0:new Date((u+c)/2):(u,c)=>u==null||(c=f[c],c==null)?NaN:(+u+ +c)/2)}}})}function wM(e={}){return xb("x",Dd,e,!0)}function SM(e={}){return xb("x",Dd,e)}function IM(e={}){return xb("y",yb,e)}function _M(e={}){return bM("x",Dd,e)}function vM(e={}){return bM("y",yb,e)}var TM={ariaLabel:"rule",fill:null,stroke:"currentColor"},Vd=class extends ot{constructor(t,r={}){let{x:n,y1:o,y2:i,inset:a=0,insetTop:s=a,insetBottom:f=a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:o,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},Eu(r,"x"),TM),this.insetTop=St(s),this.insetBottom=St(f),$u(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:f,y1:u,y2:c}=n,{width:m,height:l,marginTop:p,marginRight:d,marginLeft:y,marginBottom:x}=o,{insetTop:w,insetBottom:g}=this;return Ve("svg:g",i).call(Qt,this,o,i).call(Jt,this,{x:f&&a},Zt,0).call(S=>S.selectAll().data(t).enter().append("line").call(Bt,this).attr("x1",f?b=>f[b]:(y+m-d)/2).attr("x2",f?b=>f[b]:(y+m-d)/2).attr("y1",u&&!Wi(s)?b=>u[b]+w:p+w).attr("y2",c&&!Wi(s)?s.bandwidth?b=>c[b]+s.bandwidth()-g:b=>c[b]-g:l-x-g).call(Ar,this,n).call(hb,this,n,i)).node()}},Ud=class extends ot{constructor(t,r={}){let{x1:n,x2:o,y:i,inset:a=0,insetRight:s=a,insetLeft:f=a}=r;super(t,{y:{value:i,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:o,scale:"x",optional:!0}},Eu(r,"y"),TM),this.insetRight=St(s),this.insetLeft=St(f),$u(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{y:f,x1:u,x2:c}=n,{width:m,height:l,marginTop:p,marginRight:d,marginLeft:y,marginBottom:x}=o,{insetLeft:w,insetRight:g}=this;return Ve("svg:g",i).call(Qt,this,o,i).call(Jt,this,{y:f&&s},0,Zt).call(S=>S.selectAll().data(t).enter().append("line").call(Bt,this).attr("x1",u&&!Wi(a)?b=>u[b]+w:y+w).attr("x2",c&&!Wi(a)?a.bandwidth?b=>c[b]+a.bandwidth()-g:b=>c[b]-g:m-d-g).attr("y1",f?b=>f[b]:(p+l-x)/2).attr("y2",f?b=>f[b]:(p+l-x)/2).call(Ar,this,n).call(hb,this,n,i)).node()}};function gb(e,t){let{x:r=dt,y:n,y1:o,y2:i,...a}=IM(t);return[o,i]=MM(n,o,i),new Vd(e,{...a,x:r,y1:o,y2:i})}function li(e,t){let{y:r=dt,x:n,x1:o,x2:i,...a}=SM(t);return[o,i]=MM(n,o,i),new Ud(e,{...a,y:r,x1:o,x2:i})}function MM(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Of(e,...t){let r=t.length;for(let n=0,o=!0;n{let o=e[0];for(let i=0;i=0))throw new Error(`invalid lineWidth: ${c}`);this.splitLines=_b(this),this.clipLine=vb(this)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:f,y:u,rotate:c,text:m,title:l,fontSize:p}=n,{rotate:d}=this,[y,x]=_o(this,o);return Ve("svg:g",i).call(Qt,this,o,i).call(Ib,this,m,o).call(Jt,this,{x:f&&a,y:u&&s}).call(w=>w.selectAll().data(t).enter().append("text").call(Bt,this).call(oF,this,m,l).attr("transform",Of`translate(${f?g=>f[g]:y},${u?g=>u[g]:x})${c?g=>` rotate(${c[g]})`:d?` rotate(${d})`:""}`).call(pe,"font-size",p&&(g=>p[g])).call(Ar,this,n)).node()}};function wb(e){return e==null?null:yr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function oF(e,t,r,n){if(!r)return;let{lineAnchor:o,lineHeight:i,textOverflow:a,splitLines:s,clipLine:f}=t;e.each(function(u){let c=s(Io(r[u])??"").map(f),m=c.length,l=o==="top"?.71:o==="bottom"?1-m:(164-m*100)/200;if(m>1){let p=0;for(let d=0;do&&r(e,o,s)>t&&(n.push(e.slice(o,i)+(e[i-1]===PM?"-":"")),o=a),f){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*cF(e){let t=0,r=0,n=e.length;for(;rk.selectAll(".tick line").attr("y1",a+c-i),x,I=h?(k,z)=>k.rangeRound(z):(k,z)=>k.range(z),{type:S,domain:v,range:T,interpolate:O,scale:R,pivot:C}=e;if(O){let k=T===void 0?O:wo(O.length===1?ll(O):O,T);x=I(R.copy(),pr(st(u,o-s),Math.min(v.length+(C!==void 0),T===void 0?1/0:T.length)));let z=256,j=w.document.createElement("canvas");j.width=z,j.height=1;let M=j.getContext("2d");for(let U=0,L=z-1;Uj:typeof l=="string"?gn(l):l;x=I(ts().domain([-1,T.length-1]),[u,o-s]),g.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",(j,M)=>x(M-1)).attr("y",a).attr("width",(j,M)=>x(M)-x(M-1)).attr("height",i-a-c).attr("fill",j=>j),m=et(k,(j,M)=>M),l=j=>z(k[j],j)}else x=I(na().domain(v),[u,o-s]),g.append("g").attr("fill-opacity",y).selectAll().data(v).enter().append("rect").attr("x",x).attr("y",a).attr("width",Math.max(0,x.bandwidth()-1)).attr("height",i-a-c).attr("fill",R),_=()=>{};return g.append("g").attr("transform",`translate(0,${i-c})`).call(Fy(x).ticks(Array.isArray(m)?null:m,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(n).tickValues(Array.isArray(m)?m:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",_t(p,"normal")).call(_).call(k=>k.select(".domain").remove()),r!==void 0&&g.append("text").attr("x",u).attr("y",a-6).attr("fill","currentColor").attr("font-weight","bold").text(r),g.node()}var o1=Math.PI/180;function hl(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=i1(r),e.markerMid=i1(n),e.markerEnd=i1(o)}function i1(e){if(e==null||e===!1)return null;if(e===!0)return xM;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return gM("auto");case"arrow-reverse":return gM("auto-start-reverse");case"dot":return f9;case"circle":case"circle-fill":return xM;case"circle-stroke":return u9;case"tick":return a1("auto");case"tick-x":return a1(90);case"tick-y":return a1(0)}throw new Error(`invalid marker: ${e}`)}function gM(e){return(t,r)=>ze("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function f9(e,t){return ze("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function xM(e,t){return ze("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function u9(e,t){return ze("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(r=>r.append("circle").attr("r",3)).node()}function a1(e){return(t,r)=>ze("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var l9=0;function c1(e,t,{stroke:r},n){return IM(e,t,r&&(o=>r[o]),null,n)}function wM(e,t,{stroke:r,z:n},o){return IM(e,t,r&&(([i])=>r[i]),n,o)}var s1=1,SM=2;function p9(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=yh;i1){let c=s[0];a!==(a=Pn(t[c]))&&(r[c]|=s1)}}for(let i=o-1,a=yh;i>=0;--i){let s=n[i];if(s.length>1){let c=s[0];a!==(a=Pn(t[c]))&&(r[c]|=SM)}}return([i])=>r[i]}function IM(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let c=new Map,u=a&&p9(e,a);function f(m,l,p){return function(h){if(p&&!p(h))return;let y=i(h),b=c.get(l);b||c.set(l,b=new Map);let w=b.get(y);if(!w){let g=this.parentNode.insertBefore(l(y,s),this),_=`plot-marker-${++l9}`;g.setAttribute("id",_),b.set(y,w=`url(#${_})`)}this.setAttribute(m,w)}}t&&e.each(f("marker-start",t,u&&(m=>u(m)&s1))),r&&u&&e.each(f("marker-start",r,m=>!(u(m)&s1))),r&&e.each(f("marker-mid",r)),n&&e.each(f("marker-end",n,u&&(m=>u(m)&SM)))}function xh({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=_M(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function f1({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=_M(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function _M(e,t,r){return e===void 0&&t===void 0&&r===void 0?or?[1,0]:[.5,.5]:[t,r]}function vM(e,{interval:t}){return e={...ha(e)},e.interval=rh(e.interval===void 0?t:e.interval),e}function u1(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:c}=vM(o,r);if(s==null||c==null&&!n)return r;let u=ma(o);if(c==null){let p,h={transform:y=>p||(p=qt(y,s)),label:u};return{...r,[e]:void 0,[`${e}1`]:i===void 0?h:i,[`${e}2`]:a===void 0&&!(i===a&&n)?h:a}}let f,m;function l(p){return m!==void 0&&p===f?m:m=et(qt(f=p,s),h=>c.floor(h))}return t({...r,[e]:void 0,[`${e}1`]:i===void 0?{transform:l,label:u}:i,[`${e}2`]:a===void 0?{transform:p=>l(p).map(h=>c.offset(h)),label:u}:a})}function PM(e,t,r){let{[e]:n}=r,{value:o,interval:i}=vM(n,r);return o==null||i==null?r:t({...r,[e]:{label:ma(n),transform:a=>{let s=et(qt(a,o),u=>i.floor(u)),c=s.map(u=>i.offset(u));return s.map(Kt(s)?(u,f)=>u==null||isNaN(u=+u)||(f=c[f],f==null)||isNaN(f=+f)?void 0:new Date((u+f)/2):(u,f)=>u==null||(f=c[f],f==null)?NaN:(+u+ +f)/2)}}})}function TM(e={}){return u1("x",xh,e,!0)}function MM(e={}){return u1("x",xh,e)}function OM(e={}){return u1("y",f1,e)}function CM(e={}){return PM("x",xh,e)}function kM(e={}){return PM("y",f1,e)}var RM={ariaLabel:"rule",fill:null,stroke:"currentColor"},wh=class extends lt{constructor(t,r={}){let{x:n,y1:o,y2:i,inset:a=0,insetTop:s=a,insetBottom:c=a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:o,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},dl(r,"x"),RM),this.insetTop=Ot(s),this.insetBottom=Ot(c),hl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y1:u,y2:f}=n,{width:m,height:l,marginTop:p,marginRight:h,marginLeft:y,marginBottom:b}=o,{insetTop:w,insetBottom:g}=this;return ze("svg:g",i).call(ir,this,o,i).call(ar,this,{x:c&&a},or,0).call(_=>_.selectAll().data(t).enter().append("line").call(Wt,this).attr("x1",c?x=>c[x]:(y+m-h)/2).attr("x2",c?x=>c[x]:(y+m-h)/2).attr("y1",u&&!ba(s)?x=>u[x]+w:p+w).attr("y2",f&&!ba(s)?s.bandwidth?x=>f[x]+s.bandwidth()-g:x=>f[x]-g:l-b-g).call(Vr,this,n).call(c1,this,n,i)).node()}},Sh=class extends lt{constructor(t,r={}){let{x1:n,x2:o,y:i,inset:a=0,insetRight:s=a,insetLeft:c=a}=r;super(t,{y:{value:i,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:o,scale:"x",optional:!0}},dl(r,"y"),RM),this.insetRight=Ot(s),this.insetLeft=Ot(c),hl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{y:c,x1:u,x2:f}=n,{width:m,height:l,marginTop:p,marginRight:h,marginLeft:y,marginBottom:b}=o,{insetLeft:w,insetRight:g}=this;return ze("svg:g",i).call(ir,this,o,i).call(ar,this,{y:c&&s},0,or).call(_=>_.selectAll().data(t).enter().append("line").call(Wt,this).attr("x1",u&&!ba(a)?x=>u[x]+w:y+w).attr("x2",f&&!ba(a)?a.bandwidth?x=>f[x]+a.bandwidth()-g:x=>f[x]-g:m-h-g).attr("y1",c?x=>c[x]:(p+l-b)/2).attr("y2",c?x=>c[x]:(p+l-b)/2).call(Vr,this,n).call(c1,this,n,i)).node()}};function yl(e,t){let{x:r=St,y:n,y1:o,y2:i,...a}=OM(t);return[o,i]=NM(n,o,i),new wh(e,{...a,x:r,y1:o,y2:i})}function Qn(e,t){let{y:r=St,x:n,x1:o,x2:i,...a}=MM(t);return[o,i]=NM(n,o,i),new Sh(e,{...a,y:r,x1:o,x2:i})}function NM(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Qc(e,...t){let r=t.length;for(let n=0,o=!0;n{let o=e[0];for(let i=0;i=0))throw new Error(`invalid lineWidth: ${f}`);this.splitLines=y1(this),this.clipLine=b1(this)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,rotate:f,text:m,title:l,fontSize:p}=n,{rotate:h}=this,[y,b]=Vo(this,o);return ze("svg:g",i).call(ir,this,o,i).call(h1,this,m,o).call(ar,this,{x:c&&a,y:u&&s}).call(w=>w.selectAll().data(t).enter().append("text").call(Wt,this).call(d9,this,m,l).attr("transform",Qc`translate(${c?g=>c[g]:y},${u?g=>u[g]:b})${f?g=>` rotate(${f[g]})`:h?` rotate(${h})`:""}`).call(de,"font-size",p&&(g=>p[g])).call(Vr,this,n)).node()}};function p1(e){return e==null?null:Pr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function d9(e,t,r,n){if(!r)return;let{lineAnchor:o,lineHeight:i,textOverflow:a,splitLines:s,clipLine:c}=t;e.each(function(u){let f=s(Lo(r[u])??"").map(c),m=f.length,l=o==="top"?.71:o==="bottom"?1-m:(164-m*100)/200;if(m>1){let p=0;for(let h=0;ho&&r(e,o,s)>t&&(n.push(e.slice(o,i)+(e[i-1]===DM?"-":"")),o=a),c){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*x9(e){let t=0,r=0,n=e.length;for(;ri.split(/\r\n?|\n/g);let n=e?Bd:jd,o=t*100;return i=>fF(i,o,n)}function vb({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?Bd:jd,o=t*100;switch(r){case"clip-start":return i=>CM(i,o,n,"");case"clip-end":return i=>RM(i,o,n,"");case"ellipsis-start":return i=>CM(i,o,n,Wa);case"ellipsis-middle":return i=>uF(i,o,n,Wa);case"ellipsis-end":return i=>RM(i,o,n,Wa)}}var Wa="\u2026";function Xa(e,t,r,n){let o=[],i=0;for(let a=0,s=0,f=e.length;at){for(i+=n;i>t&&a>0;)s=a,a=o.pop(),i-=r(e,a,s);return[a,t-i]}i+=u,o.push(a)}return[-1,0]}function RM(e,t,r,n){e=e.trim();let o=r(n),[i]=Xa(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function uF(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=Xa(e,t/2,r,i),[f]=Xa(e,o-t/2-s+i,r,-i);return f<0?n:e.slice(0,a).trimEnd()+n+e.slice(Rf(e,f)).trimStart()}function CM(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=Xa(e,o-t+i,r,-i);return a<0?n:n+e.slice(Rf(e,a)).trimStart()}var bb=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,AM=/\p{Extended_Pictographic}/uy;function Rf(e,t){return t+=lF(e,t)?2:1,mF(e,t)&&(t=bb.lastIndex),pF(e,t)?Rf(e,t+1):t}function FM(e,t){return e.charCodeAt(t)<128}function lF(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function pF(e,t){return e.charCodeAt(t)===8205}function mF(e,t){return FM(e,t)?!1:(bb.lastIndex=t,bb.test(e))}function EM(e,t){return FM(e,t)?!1:(AM.lastIndex=t,AM.test(e))}var dF={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},$M=3.5,hF=$M*5,LM={draw(e,t,r){let n=t*r/hF;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},yF={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},xF=new Map([["arrow",LM],["spike",yF]]);function gF(e){return e&&typeof e.draw=="function"}function bF(e){if(gF(e))return e;let t=xF.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Gd=class extends ot{constructor(t,r={}){let{x:n,y:o,r:i=$M,length:a,rotate:s,shape:f=LM,anchor:u="middle",frameAnchor:c}=r,[m,l]=ht(a,12),[p,d]=ht(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:m,scale:"length",optional:!0},rotate:{value:p,optional:!0}},r,dF),this.r=+i,this.length=l,this.rotate=d,this.shape=bF(f),this.anchor=yr(u,"anchor",["start","middle","end"]),this.frameAnchor=Yi(c)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:f,y:u,length:c,rotate:m}=n,{length:l,rotate:p,anchor:d,shape:y,r:x}=this,[w,g]=_o(this,o);return Ve("svg:g",i).call(Qt,this,o,i).call(Jt,this,{x:f&&a,y:u&&s}).call(S=>S.selectAll().data(t).enter().append("path").call(Bt,this).attr("transform",Of`translate(${f?b=>f[b]:w},${u?b=>u[b]:g})${m?b=>` rotate(${m[b]})`:p?` rotate(${p})`:""}${d==="start"?"":d==="end"?c?b=>` translate(0,${c[b]})`:` translate(0,${l})`:c?b=>` translate(0,${c[b]/2})`:` translate(0,${l/2})`}`).attr("d",c?b=>{let T=En();return y.draw(T,c[b],x),T}:(()=>{let b=En();return y.draw(b,l,x),b})()).call(Ar,this,n)).node()}};function DM(e,t={}){let{x:r=dt,...n}=t;return new Gd(e,{...n,x:r})}function VM(e,t={}){let{y:r=dt,...n}=t;return new Gd(e,{...n,y:r})}function Zi(e,t){return arguments.length<2&&!hn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function zd({anchor:e}={},t){return e===void 0?t[0]:yr(e,"anchor",t)}function UM(e){return zd(e,["left","right"])}function jM(e){return zd(e,["right","left"])}function BM(e){return zd(e,["bottom","top"])}function GM(e){return zd(e,["top","bottom"])}function Mb(){let[e,t]=Zi(...arguments);return qM("y",UM(t),e,t)}function zM(){let[e,t]=Zi(...arguments);return qM("fy",jM(t),e,t)}function Ob(){let[e,t]=Zi(...arguments);return HM("x",BM(t),e,t)}function KM(){let[e,t]=Zi(...arguments);return HM("fx",GM(t),e,t)}function qM(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:f=n,fillOpacity:u=o,textAnchor:c,textStroke:m,textStrokeOpacity:l,textStrokeWidth:p,tickSize:d=e==="y"?6:0,tickPadding:y,tickRotate:x,x:w,margin:g,marginTop:S=g===void 0?20:g,marginRight:b=g===void 0?t==="right"?40:0:g,marginBottom:T=g===void 0?20:g,marginLeft:I=g===void 0?t==="left"?40:0:g,label:v,labelAnchor:O,labelArrow:C,labelOffset:E,ariaLabel:A=`${e}-axis`,...F}){return d=St(d),y=St(y),x=St(x),O!==void 0&&(O=yr(O,"labelAnchor",["center","top","bottom"])),C=i8(C),ib(d&&!Ut(i)?wF(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:d,tickPadding:y,tickRotate:x,x:w,ariaLabel:A,...F}):null,Ut(f)?null:IF(e,t,r,{fill:f,fillOpacity:u,stroke:m,strokeOpacity:l,strokeWidth:p,textAnchor:c,tickSize:d,tickPadding:y,tickRotate:x,x:w,marginTop:S,marginRight:b,marginBottom:T,marginLeft:I,ariaLabel:A,...F}),!Ut(f)&&v!==null?Sb([],t8({fill:f,fillOpacity:u,...F},function(H,j,M,U,D){let oe=U[e],{marginTop:V,marginRight:K,marginBottom:Y,marginLeft:Z}=e==="y"&&D.inset||D,J=O??(oe.bandwidth?"center":"top"),ye=E??(t==="right"?K:Z)-3;return J==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=J,this.frameAnchor=`${J}-${t}`,this.rotate=0),this.dy=J==="top"?3-V:J==="bottom"?Y-3:0,this.dx=t==="right"?ye:-ye,this.ariaLabel=`${A} label`,{facets:[[0]],channels:{text:{value:[o8(e,oe,{anchor:t,label:v,labelAnchor:J,labelArrow:C})]}}}})):null)}function HM(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:f=n,fillOpacity:u=o,textAnchor:c,textStroke:m,textStrokeOpacity:l,textStrokeWidth:p,tickSize:d=e==="x"?6:0,tickPadding:y,tickRotate:x,y:w,margin:g,marginTop:S=g===void 0?t==="top"?30:0:g,marginRight:b=g===void 0?20:g,marginBottom:T=g===void 0?t==="bottom"?30:0:g,marginLeft:I=g===void 0?20:g,label:v,labelAnchor:O,labelArrow:C,labelOffset:E,ariaLabel:A=`${e}-axis`,...F}){return d=St(d),y=St(y),x=St(x),O!==void 0&&(O=yr(O,"labelAnchor",["center","left","right"])),C=i8(C),ib(d&&!Ut(i)?SF(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:d,tickPadding:y,tickRotate:x,y:w,ariaLabel:A,...F}):null,Ut(f)?null:_F(e,t,r,{fill:f,fillOpacity:u,stroke:m,strokeOpacity:l,strokeWidth:p,textAnchor:c,tickSize:d,tickPadding:y,tickRotate:x,y:w,marginTop:S,marginRight:b,marginBottom:T,marginLeft:I,ariaLabel:A,...F}),!Ut(f)&&v!==null?Sb([],t8({fill:f,fillOpacity:u,...F},function(H,j,M,U,D){let oe=U[e],{marginTop:V,marginRight:K,marginBottom:Y,marginLeft:Z}=e==="x"&&D.inset||D,J=O??(oe.bandwidth?"center":"right"),ye=E??(t==="top"?V:Y)-3;return J==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${J}`,this.textAnchor=J==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-ye:ye,this.dx=J==="right"?K-3:J==="left"?3-Z:0,this.ariaLabel=`${A} label`,{facets:[[0]],channels:{text:{value:[o8(e,oe,{anchor:t,label:v,labelAnchor:J,labelArrow:C})]}}}})):null)}function wF(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="y"?"-empty":""),frameAnchor:s=t,tickSize:f,inset:u=0,insetLeft:c=u,insetRight:m=u,dx:l=0,y:p=e==="y"?void 0:null,ariaLabel:d,...y}){return Cf(VM,e,r,{ariaLabel:`${d} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:p,...y,dx:t==="left"?+l-Zt+ +c:+l+Zt-m,anchor:"start",length:f,shape:t==="left"?OF:RF})}function SF(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="x"?"-empty":""),frameAnchor:s=t,tickSize:f,inset:u=0,insetTop:c=u,insetBottom:m=u,dy:l=0,x:p=e==="x"?void 0:null,ariaLabel:d,...y}){return Cf(DM,e,r,{ariaLabel:`${d} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:p,...y,dy:t==="bottom"?+l-Zt-m:+l+Zt+ +c,anchor:"start",length:f,shape:t==="bottom"?TF:MF})}function IF(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:o=t,tickSize:i,tickRotate:a=0,tickPadding:s=Math.max(3,9-i)+(Math.abs(a)>60?4*Math.cos(a*lb):0),text:f,textAnchor:u=Math.abs(a)>60?"middle":t==="left"?"end":"start",lineAnchor:c=a>60?"top":a<-60?"bottom":"middle",fontVariant:m,inset:l=0,insetLeft:p=l,insetRight:d=l,dx:y=0,ariaLabel:x,y:w=e==="y"?void 0:null,...g}){return Cf(NM,e,r,{ariaLabel:`${x} tick label`},{facetAnchor:n,frameAnchor:o,text:f,textAnchor:u,lineAnchor:c,fontVariant:m,rotate:a,y:w,...g,dx:t==="left"?+y-i-s+ +p:+y+ +i+ +s-d},function(S,b,T,I,v){m===void 0&&(this.fontVariant=n8(S)),f===void 0&&(v.text=r8(S,b,T,I,t))})}function _F(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:o=t,tickSize:i,tickRotate:a=0,tickPadding:s=Math.max(3,9-i)+(Math.abs(a)>=10?4*Math.cos(a*lb):0),text:f,textAnchor:u=Math.abs(a)>=10?a<0^t==="bottom"?"start":"end":"middle",lineAnchor:c=Math.abs(a)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:m,inset:l=0,insetTop:p=l,insetBottom:d=l,dy:y=0,x=e==="x"?void 0:null,ariaLabel:w,...g}){return Cf(kM,e,r,{ariaLabel:`${w} tick label`},{facetAnchor:n,frameAnchor:o,text:f===void 0?null:f,textAnchor:u,lineAnchor:c,fontVariant:m,rotate:a,x,...g,dy:t==="bottom"?+y+ +i+ +s-d:+y-i-s+ +p},function(S,b,T,I,v){m===void 0&&(this.fontVariant=n8(S)),f===void 0&&(v.text=r8(S,b,T,I,t))})}function YM(){let[e,t]=Zi(...arguments);return QM("y",UM(t),e,t)}function WM(){let[e,t]=Zi(...arguments);return QM("fy",jM(t),e,t)}function XM(){let[e,t]=Zi(...arguments);return JM("x",BM(t),e,t)}function ZM(){let[e,t]=Zi(...arguments);return JM("fx",GM(t),e,t)}function QM(e,t,r,{y:n=e==="y"?void 0:null,x:o=null,x1:i=t==="left"?o:null,x2:a=t==="right"?o:null,ariaLabel:s=`${e}-grid`,ariaHidden:f=!0,...u}){return Cf(li,e,r,{ariaLabel:s,ariaHidden:f},{y:n,x1:i,x2:a,...e8(u)})}function JM(e,t,r,{x:n=e==="x"?void 0:null,y:o=null,y1:i=t==="top"?o:null,y2:a=t==="bottom"?o:null,ariaLabel:s=`${e}-grid`,ariaHidden:f=!0,...u}){return Cf(gb,e,r,{ariaLabel:s,ariaHidden:f},{x:n,y1:i,y2:a,...e8(u)})}function e8({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:o=1,...i}){return{stroke:r,strokeOpacity:n,strokeWidth:o,...i}}function t8({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:f,shapeRendering:u,clip:c=!1},m){return[,e]=go(e),[,t]=ht(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:f,shapeRendering:u,clip:c,initializer:m}}function Cf(e,t,r,n,o,i){let a;function s(c,m,l,p,d,y){let x=c==null&&(t==="fx"||t==="fy"),{[t]:w}=p;if(!w)throw new Error(`missing scale: ${t}`);let g=w.domain(),{interval:S,ticks:b,tickFormat:T,tickSpacing:I=t==="x"?80:35}=o;if(typeof b=="string"&&a8(w)&&(S=b,b=void 0),b===void 0&&(b=qi(S,w.type)??vF(w,I)),c==null){if(hn(b))c=bo(b);else if(v6(b))c=Tb(b,...Tr(g));else if(w.interval){let O=w.interval;if(w.ticks){let[C,E]=Tr(g),A=(E-C)/O[lf];O=gg(O,A/b)??O,c=Tb(O,C,E)}else{c=g;let C=c.length;O=gg(O,C/b)??O,O!==w.interval&&(c=Tb(O,...Tr(c)))}if(O===w.interval){let C=Math.round(c.length/b);C>1&&(c=c.filter((E,A)=>A%C===0))}}else w.ticks?c=w.ticks(b):c=g;if(!w.ticks&&c.length&&c!==g){let O=new Pn(g);c=c.filter(C=>O.has(C)),c.length||Cr(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?m=[Rr(c)]:a[t]={scale:t,value:dt}}i?.call(this,w,c,b,T,a);let v=Object.fromEntries(Object.entries(a).map(([O,C])=>[O,{...C,value:Vt(c,C.value)}]));return x&&(m=y.filterFacets(c,v)),{data:c,facets:m,channels:v}}let f=ai(o).initializer,u=e(r,ai({...o,initializer:s},f));return r==null?(a=u.channels,u.channels={}):a={},n!==void 0&&Object.assign(u,n),u.clip===void 0&&(u.clip=!1),u}function vF(e,t){let[r,n]=Tr(e.range());return(n-r)/t}function r8(e,t,r,n,o){return{value:Du(e,t,r,n,o)}}function Du(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Dt(t)?a6(e.type,t,o)??Io:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(Dt(e.domain())?ho:sn)(n):n===void 0?Io:Gr(n)}function Tb(e,t,r){return e.range(t,e.offset(e.floor(r)))}var TF={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},MF={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},OF={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},RF={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function n8(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function o8(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&a8(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),i==="auto"&&(i=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!i)return n;if(i===!0){let a=$T(t);a&&(i=/x$/.test(e)||o==="center"?/x$/.test(e)===a<0?"left":"right":a<0?"up":"down")}switch(i){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function i8(e="auto"){return Ut(e)?!1:typeof e=="boolean"?e:yr(e,"labelArrow",["auto","up","right","down","left"])}function a8(e){return Dt(e.domain())}function s8(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function f8(e,{opacity:t,...r}={}){if(!So(e)&&!Zg(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return u8(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",ht(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function c8(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:Ut(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},f){let[u,c]=go(t),[m,l]=go(n),p=s8(f,u),d=s8(f,m),y=a*a*Math.PI;return r=ht(r)[1],o=ht(o)[1],i=ht(i)[1],u8(e,s,(x,w,g,S)=>x.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",S).attr("fill",u==="color"?b=>p.scale(b):c).attr("fill-opacity",r).attr("stroke",m==="color"?b=>d.scale(b):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",b=>{let T=En();return e.scale(b).draw(T,y),T}))}function u8(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=Ld(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:f=a,marginLeft:u=0,className:c,style:m,width:l}=t,p=vf(t);c=Tf(c),o=Du(e.scale,e.domain,void 0,o);let d=Ve("div",p).attr("class",`${c}-swatches ${c}-swatches-${n!=null?"columns":"wrap"}`),y;return n!=null?(y=`:where(.${c}-swatches-columns .${c}-swatch) { +`:yield[t,r,!0],r+=o,t=r;break;default:++r;break}}yield[t,r,!0]}var AM={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function Ih(e,t=0,r=e.length){let n=0;for(let o=t;oi.split(/\r\n?|\n/g);let n=e?_h:Ih,o=t*100;return i=>g9(i,o,n)}function b1({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?_h:Ih,o=t*100;switch(r){case"clip-start":return i=>FM(i,o,n,"");case"clip-end":return i=>EM(i,o,n,"");case"ellipsis-start":return i=>FM(i,o,n,xs);case"ellipsis-middle":return i=>w9(i,o,n,xs);case"ellipsis-end":return i=>EM(i,o,n,xs)}}var xs="\u2026";function ws(e,t,r,n){let o=[],i=0;for(let a=0,s=0,c=e.length;at){for(i+=n;i>t&&a>0;)s=a,a=o.pop(),i-=r(e,a,s);return[a,t-i]}i+=u,o.push(a)}return[-1,0]}function EM(e,t,r,n){e=e.trim();let o=r(n),[i]=ws(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function w9(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=ws(e,t/2,r,i),[c]=ws(e,o-t/2-s+i,r,-i);return c<0?n:e.slice(0,a).trimEnd()+n+e.slice(tf(e,c)).trimStart()}function FM(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=ws(e,o-t+i,r,-i);return a<0?n:n+e.slice(tf(e,a)).trimStart()}var l1=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,$M=/\p{Extended_Pictographic}/uy;function tf(e,t){return t+=S9(e,t)?2:1,_9(e,t)&&(t=l1.lastIndex),I9(e,t)?tf(e,t+1):t}function LM(e,t){return e.charCodeAt(t)<128}function S9(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function I9(e,t){return e.charCodeAt(t)===8205}function _9(e,t){return LM(e,t)?!1:(l1.lastIndex=t,l1.test(e))}function VM(e,t){return LM(e,t)?!1:($M.lastIndex=t,$M.test(e))}var v9={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},jM=3.5,P9=jM*5,UM={draw(e,t,r){let n=t*r/P9;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},T9={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},M9=new Map([["arrow",UM],["spike",T9]]);function O9(e){return e&&typeof e.draw=="function"}function C9(e){if(O9(e))return e;let t=M9.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var vh=class extends lt{constructor(t,r={}){let{x:n,y:o,r:i=jM,length:a,rotate:s,shape:c=UM,anchor:u="middle",frameAnchor:f}=r,[m,l]=It(a,12),[p,h]=It(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:m,scale:"length",optional:!0},rotate:{value:p,optional:!0}},r,v9),this.r=+i,this.length=l,this.rotate=h,this.shape=C9(c),this.anchor=Pr(u,"anchor",["start","middle","end"]),this.frameAnchor=ya(f)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,length:f,rotate:m}=n,{length:l,rotate:p,anchor:h,shape:y,r:b}=this,[w,g]=Vo(this,o);return ze("svg:g",i).call(ir,this,o,i).call(ar,this,{x:c&&a,y:u&&s}).call(_=>_.selectAll().data(t).enter().append("path").call(Wt,this).attr("transform",Qc`translate(${c?x=>c[x]:w},${u?x=>u[x]:g})${m?x=>` rotate(${m[x]})`:p?` rotate(${p})`:""}${h==="start"?"":h==="end"?f?x=>` translate(0,${f[x]})`:` translate(0,${l})`:f?x=>` translate(0,${f[x]/2})`:` translate(0,${l/2})`}`).attr("d",f?x=>{let I=Hn();return y.draw(I,f[x],b),I}:(()=>{let x=Hn();return y.draw(x,l,b),x})()).call(Vr,this,n)).node()}};function BM(e,t={}){let{x:r=St,...n}=t;return new vh(e,{...n,x:r})}function zM(e,t={}){let{y:r=St,...n}=t;return new vh(e,{...n,y:r})}function xa(e,t){return arguments.length<2&&!Tn(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Ph({anchor:e}={},t){return e===void 0?t[0]:Pr(e,"anchor",t)}function GM(e){return Ph(e,["left","right"])}function KM(e){return Ph(e,["right","left"])}function qM(e){return Ph(e,["bottom","top"])}function HM(e){return Ph(e,["top","bottom"])}function x1(){let[e,t]=xa(...arguments);return XM("y",GM(t),e,t)}function YM(){let[e,t]=xa(...arguments);return XM("fy",KM(t),e,t)}function w1(){let[e,t]=xa(...arguments);return ZM("x",qM(t),e,t)}function WM(){let[e,t]=xa(...arguments);return ZM("fx",HM(t),e,t)}function XM(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:c=n,fillOpacity:u=o,textAnchor:f,textStroke:m,textStrokeOpacity:l,textStrokeWidth:p,tickSize:h=e==="y"?6:0,tickPadding:y,tickRotate:b,x:w,margin:g,marginTop:_=g===void 0?20:g,marginRight:x=g===void 0?t==="right"?40:0:g,marginBottom:I=g===void 0?20:g,marginLeft:S=g===void 0?t==="left"?40:0:g,label:v,labelAnchor:T,labelArrow:O,labelOffset:R,ariaLabel:C=`${e}-axis`,...k}){return h=Ot(h),y=Ot(y),b=Ot(b),T!==void 0&&(T=Pr(T,"labelAnchor",["center","top","bottom"])),O=fO(O),Qx(h&&!Ht(i)?k9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:y,tickRotate:b,x:w,ariaLabel:C,...k}):null,Ht(c)?null:N9(e,t,r,{fill:c,fillOpacity:u,stroke:m,strokeOpacity:l,strokeWidth:p,textAnchor:f,tickSize:h,tickPadding:y,tickRotate:b,x:w,marginTop:_,marginRight:x,marginBottom:I,marginLeft:S,ariaLabel:C,...k}),!Ht(c)&&v!==null?ef([],iO({fill:c,fillOpacity:u,...k},function(z,j,M,U,L){let re=U[e],{marginTop:V,marginRight:q,marginBottom:H,marginLeft:W}=e==="y"&&L.inset||L,te=T??(re.bandwidth?"center":"top"),be=R??(t==="right"?q:W)-3;return te==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=te,this.frameAnchor=`${te}-${t}`,this.rotate=0),this.dy=te==="top"?3-V:te==="bottom"?H-3:0,this.dx=t==="right"?be:-be,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[cO(e,re,{anchor:t,label:v,labelAnchor:te,labelArrow:O})]}}}})):null)}function ZM(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:c=n,fillOpacity:u=o,textAnchor:f,textStroke:m,textStrokeOpacity:l,textStrokeWidth:p,tickSize:h=e==="x"?6:0,tickPadding:y,tickRotate:b,y:w,margin:g,marginTop:_=g===void 0?t==="top"?30:0:g,marginRight:x=g===void 0?20:g,marginBottom:I=g===void 0?t==="bottom"?30:0:g,marginLeft:S=g===void 0?20:g,label:v,labelAnchor:T,labelArrow:O,labelOffset:R,ariaLabel:C=`${e}-axis`,...k}){return h=Ot(h),y=Ot(y),b=Ot(b),T!==void 0&&(T=Pr(T,"labelAnchor",["center","left","right"])),O=fO(O),Qx(h&&!Ht(i)?R9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:y,tickRotate:b,y:w,ariaLabel:C,...k}):null,Ht(c)?null:A9(e,t,r,{fill:c,fillOpacity:u,stroke:m,strokeOpacity:l,strokeWidth:p,textAnchor:f,tickSize:h,tickPadding:y,tickRotate:b,y:w,marginTop:_,marginRight:x,marginBottom:I,marginLeft:S,ariaLabel:C,...k}),!Ht(c)&&v!==null?ef([],iO({fill:c,fillOpacity:u,...k},function(z,j,M,U,L){let re=U[e],{marginTop:V,marginRight:q,marginBottom:H,marginLeft:W}=e==="x"&&L.inset||L,te=T??(re.bandwidth?"center":"right"),be=R??(t==="top"?V:H)-3;return te==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${te}`,this.textAnchor=te==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-be:be,this.dx=te==="right"?q-3:te==="left"?3-W:0,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[cO(e,re,{anchor:t,label:v,labelAnchor:te,labelArrow:O})]}}}})):null)}function k9(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="y"?"-empty":""),frameAnchor:s=t,tickSize:c,inset:u=0,insetLeft:f=u,insetRight:m=u,dx:l=0,y:p=e==="y"?void 0:null,ariaLabel:h,...y}){return rf(zM,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:p,...y,dx:t==="left"?+l-or+ +f:+l+or-m,anchor:"start",length:c,shape:t==="left"?D9:L9})}function R9(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="x"?"-empty":""),frameAnchor:s=t,tickSize:c,inset:u=0,insetTop:f=u,insetBottom:m=u,dy:l=0,x:p=e==="x"?void 0:null,ariaLabel:h,...y}){return rf(BM,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:p,...y,dy:t==="bottom"?+l-or-m:+l+or+ +f,anchor:"start",length:c,shape:t==="bottom"?F9:$9})}function N9(e,t,r,{facetAnchor:n=t+(e==="y"?"-empty":""),frameAnchor:o=t,tickSize:i,tickRotate:a=0,tickPadding:s=Math.max(3,9-i)+(Math.abs(a)>60?4*Math.cos(a*o1):0),text:c,textAnchor:u=Math.abs(a)>60?"middle":t==="left"?"end":"start",lineAnchor:f=a>60?"top":a<-60?"bottom":"middle",fontVariant:m,inset:l=0,insetLeft:p=l,insetRight:h=l,dx:y=0,ariaLabel:b,y:w=e==="y"?void 0:null,...g}){return rf(d1,e,r,{ariaLabel:`${b} tick label`},{facetAnchor:n,frameAnchor:o,text:c,textAnchor:u,lineAnchor:f,fontVariant:m,rotate:a,y:w,...g,dx:t==="left"?+y-i-s+ +p:+y+ +i+ +s-h},function(_,x,I,S,v){m===void 0&&(this.fontVariant=sO(_)),c===void 0&&(v.text=aO(_,x,I,S,t))})}function A9(e,t,r,{facetAnchor:n=t+(e==="x"?"-empty":""),frameAnchor:o=t,tickSize:i,tickRotate:a=0,tickPadding:s=Math.max(3,9-i)+(Math.abs(a)>=10?4*Math.cos(a*o1):0),text:c,textAnchor:u=Math.abs(a)>=10?a<0^t==="bottom"?"start":"end":"middle",lineAnchor:f=Math.abs(a)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:m,inset:l=0,insetTop:p=l,insetBottom:h=l,dy:y=0,x:b=e==="x"?void 0:null,ariaLabel:w,...g}){return rf(m1,e,r,{ariaLabel:`${w} tick label`},{facetAnchor:n,frameAnchor:o,text:c===void 0?null:c,textAnchor:u,lineAnchor:f,fontVariant:m,rotate:a,x:b,...g,dy:t==="bottom"?+y+ +i+ +s-h:+y-i-s+ +p},function(_,x,I,S,v){m===void 0&&(this.fontVariant=sO(_)),c===void 0&&(v.text=aO(_,x,I,S,t))})}function QM(){let[e,t]=xa(...arguments);return rO("y",GM(t),e,t)}function JM(){let[e,t]=xa(...arguments);return rO("fy",KM(t),e,t)}function eO(){let[e,t]=xa(...arguments);return nO("x",qM(t),e,t)}function tO(){let[e,t]=xa(...arguments);return nO("fx",HM(t),e,t)}function rO(e,t,r,{y:n=e==="y"?void 0:null,x:o=null,x1:i=t==="left"?o:null,x2:a=t==="right"?o:null,ariaLabel:s=`${e}-grid`,ariaHidden:c=!0,...u}){return rf(Qn,e,r,{ariaLabel:s,ariaHidden:c},{y:n,x1:i,x2:a,...oO(u)})}function nO(e,t,r,{x:n=e==="x"?void 0:null,y:o=null,y1:i=t==="top"?o:null,y2:a=t==="bottom"?o:null,ariaLabel:s=`${e}-grid`,ariaHidden:c=!0,...u}){return rf(yl,e,r,{ariaLabel:s,ariaHidden:c},{x:n,y1:i,y2:a,...oO(u)})}function oO({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:o=1,...i}){return{stroke:r,strokeOpacity:n,strokeWidth:o,...i}}function iO({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:c,shapeRendering:u,clip:f=!1},m){return[,e]=Eo(e),[,t]=It(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:c,shapeRendering:u,clip:f,initializer:m}}function rf(e,t,r,n,o,i){let a;function s(f,m,l,p,h,y){let b=f==null&&(t==="fx"||t==="fy"),{[t]:w}=p;if(!w)throw new Error(`missing scale: ${t}`);let g=w.domain(),{interval:_,ticks:x,tickFormat:I,tickSpacing:S=t==="x"?80:35}=o;if(typeof x=="string"&&uO(w)&&(_=x,x=void 0),x===void 0&&(x=da(_,w.type)??E9(w,S)),f==null){if(Tn(x))f=Fo(x);else if(kT(x))f=g1(x,...Er(g));else if(w.interval){let T=w.interval;if(w.ticks){let[O,R]=Er(g),C=(R-O)/T[$c];T=lx(T,C/x)??T,f=g1(T,O,R)}else{f=g;let O=f.length;T=lx(T,O/x)??T,T!==w.interval&&(f=g1(T,...Er(f)))}if(T===w.interval){let O=Math.round(f.length/x);O>1&&(f=f.filter((R,C)=>C%O===0))}}else w.ticks?f=w.ticks(x):f=g;if(!w.ticks&&f.length&&f!==g){let T=new zn(g);f=f.filter(O=>T.has(O)),f.length||Lr(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?m=[Dr(f)]:a[t]={scale:t,value:St}}i?.call(this,w,f,x,I,a);let v=Object.fromEntries(Object.entries(a).map(([T,O])=>[T,{...O,value:qt(f,O.value)}]));return b&&(m=y.filterFacets(f,v)),{data:f,facets:m,channels:v}}let c=Ti(o).initializer,u=e(r,Ti({...o,initializer:s},c));return r==null?(a=u.channels,u.channels={}):a={},n!==void 0&&Object.assign(u,n),u.clip===void 0&&(u.clip=!1),u}function E9(e,t){let[r,n]=Er(e.range());return(n-r)/t}function aO(e,t,r,n,o){return{value:bl(e,t,r,n,o)}}function bl(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Kt(t)?pT(e.type,t,o)??Lo:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(Kt(e.domain())?Ro:gn)(n):n===void 0?Lo:en(n)}function g1(e,t,r){return e.range(t,e.offset(e.floor(r)))}var F9={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},$9={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},D9={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},L9={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function sO(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function cO(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&uO(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),i==="auto"&&(i=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!i)return n;if(i===!0){let a=B6(t);a&&(i=/x$/.test(e)||o==="center"?/x$/.test(e)===a<0?"left":"right":a<0?"up":"down")}switch(i){case"left":return`\u2190 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function fO(e="auto"){return Ht(e)?!1:typeof e=="boolean"?e:Pr(e,"labelArrow",["auto","up","right","down","left"])}function uO(e){return Kt(e.domain())}function lO(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function pO(e,{opacity:t,...r}={}){if(!Do(e)&&!Gx(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return dO(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",It(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function mO(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:Ht(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},c){let[u,f]=Eo(t),[m,l]=Eo(n),p=lO(c,u),h=lO(c,m),y=a*a*Math.PI;return r=It(r)[1],o=It(o)[1],i=It(i)[1],dO(e,s,(b,w,g,_)=>b.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",_).attr("fill",u==="color"?x=>p.scale(x):f).attr("fill-opacity",r).attr("stroke",m==="color"?x=>h.scale(x):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",x=>{let I=Hn();return e.scale(x).draw(I,y),I}))}function dO(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=gh(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:c=a,marginLeft:u=0,className:f,style:m,width:l}=t,p=Wc(t);f=Xc(f),o=bl(e.scale,e.domain,void 0,o);let h=ze("div",p).attr("class",`${f}-swatches ${f}-swatches-${n!=null?"columns":"wrap"}`),y;return n!=null?(y=`:where(.${f}-swatches-columns .${f}-swatch) { display: flex; align-items: center; break-inside: avoid; padding-bottom: 1px; } -:where(.${c}-swatches-columns .${c}-swatch::before) { +:where(.${f}-swatches-columns .${f}-swatch::before) { flex-shrink: 0; } -:where(.${c}-swatches-columns .${c}-swatch-label) { +:where(.${f}-swatches-columns .${f}-swatch-label) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -}`,d.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${c}-swatch`).call(r,e,s,f).call(x=>x.append("div").attr("class",`${c}-swatch-label`).attr("title",o).text(o))):(y=`:where(.${c}-swatches-wrap) { +}`,h.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${f}-swatch`).call(r,e,s,c).call(b=>b.append("div").attr("class",`${f}-swatch-label`).attr("title",o).text(o))):(y=`:where(.${f}-swatches-wrap) { display: flex; align-items: center; min-height: 33px; flex-wrap: wrap; } -:where(.${c}-swatches-wrap .${c}-swatch) { +:where(.${f}-swatches-wrap .${f}-swatch) { display: inline-flex; align-items: center; margin-right: 1em; -}`,d.selectAll().data(e.domain).enter().append("span").attr("class",`${c}-swatch`).call(r,e,s,f).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),d.call(x=>x.insert("style","*").text(`:where(.${c}-swatches) { +}`,h.selectAll().data(e.domain).enter().append("span").attr("class",`${f}-swatch`).call(r,e,s,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(b=>b.insert("style","*").text(`:where(.${f}-swatches) { font-family: system-ui, sans-serif; font-size: 10px; margin-bottom: 0.5em; } -:where(.${c}-swatch > svg) { +:where(.${f}-swatch > svg) { margin-right: 0.5em; overflow: visible; } -${y}`)).style("margin-left",u?`${+u}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",yt(i,"normal")).call(Mf,m).node()}var Rb=new Map([["symbol",c8],["color",m8],["opacity",CF]]);function l8(e,t,r={}){return(n,o)=>{if(!Rb.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return Rb.get(n)(e[n],p8(t,r[n],o),i=>e[i])}}function p8({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return P6(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function m8(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return f8(e,r);case"ramp":return lM(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function CF({type:e,interpolate:t,...r},{legend:n=!0,color:o=on(0,0,0),...i}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return m8({type:e,...r,interpolate:AF(o)},{legend:n,...i})}function AF(e){let{r:t,g:r,b:n}=on(e)||on(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function d8(e,t,r){let n=[];for(let[o,i]of Rb){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],p8(t,e[o],a),f=>e[f]);s!=null&&n.push(s)}}return n}function h8(e={},t="y"){return Rg(e)?e:{...e,[t]:dt}}function y8(e,t){if(t.length===1)return{data:e,facets:t};let r=zi(e),n=new Uint8Array(r),o=0;for(let s of t)for(let f of s)n[f]&&++o,n[f]=1;if(o===0)return{data:e,facets:t};e=Bi(e);let i=e[Sg]=new Uint32Array(r+o);t=t.map(s=>Bi(s,Uint32Array));let a=r;n.fill(0);for(let s of t)for(let f=0,u=s.length;f{({data:y,facets:x}=y8(y,x));let g=e==null?void 0:c(I6(Vt(y,e),w?.[r])),S=Vt(y,t,Float64Array),b=Vt(y,f),T=i&&i(y,g,S,b),I=zi(y),v=l(new Float64Array(I)),O=d(new Float64Array(I)),C=[];for(let E of x){let A=g?Array.from(Vo(E,F=>g[F]).values()):[E];if(T)for(let F of A)F.sort(T);for(let F of A){let H=0,j=0;a&&F.reverse();for(let M of F){let U=S[M];U<0?H=O[M]=(v[M]=H)+U:U>0?j=O[M]=(v[M]=j)+U:O[M]=v[M]=j}}C.push(A)}return o&&o(C,v,O,b),{data:y,facets:x}}),u,m,p]}function EF(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return $F;case"center":case"silhouette":return LF;case"wiggle":return S8}throw new Error(`unknown offset: ${e}`)}}function w8(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function $F(e,t,r){for(let n of e)for(let o of n){let[i,a]=w8(o,r);for(let s of o){let f=1/(a-i||1);t[s]=f*(t[s]-i),r[s]=f*(r[s]-i)}}}function LF(e,t,r){for(let n of e){for(let o of n){let[i,a]=w8(o,r);for(let s of o){let f=(a+i)/2;t[s]-=f,r[s]-=f}}I8(n,t,r)}_8(e,t,r)}function S8(e,t,r,n){for(let o of e){let i=new pr,a=0;for(let s of o){let f=-1,u=s.map(p=>Math.abs(r[p]-t[p])),c=s.map(p=>{f=n?n[p]:++f;let d=r[p]-t[p],y=i.has(f)?d-i.get(f):0;return i.set(f,d),y}),m=[0,...Rl(c)];for(let p of s)t[p]+=a,r[p]+=a;let l=rn(u);l&&(a-=rn(u,(p,d)=>(c[d]/2+m[d])*p)/l)}I8(o,t,r)}_8(e,t,r)}function I8(e,t,r){let n=mr(e,o=>mr(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function _8(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(mr(s,f=>t[f])+Nt(s,f=>r[f]))/2),a=mr(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function UF(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function jF(e){return Kd(e,(t,r,n,o)=>Ms(Rr(t),i=>rn(i,a=>n[a]),i=>o[i]))}function BF(e){return Kd(e,(t,r,n,o)=>Ms(Rr(t),i=>r[cc(i,a=>n[a])],i=>o[i]))}function x8(e){return Kd(e,(t,r,n,o)=>{let i=Rr(t),a=Ms(i,m=>r[cc(m,l=>n[l])],m=>o[m]),s=Qn(i,m=>rn(m,l=>n[l]),m=>o[m]),f=[],u=[],c=0;for(let m of a)c<0?(c+=s.get(m),f.push(m)):(c-=s.get(m),u.push(m));return u.reverse().concat(f)})}function g8(e){return t=>{let r=Vt(t,e);return(n,o)=>Or(r[n],r[o])}}function GF(e){return t=>Dn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function zF(e){return Kd(Or,()=>e)}function Kd(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new pr(t(r,n,o,i).map((s,f)=>[s,f]));return(s,f)=>e(a.get(i[s]),a.get(i[f]))}}var KF={ariaLabel:"rect"},Yd=class extends ot{constructor(t,r={}){let{x1:n,y1:o,x2:i,y2:a}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&i==null?"band":void 0,optional:!0},y1:{value:o,scale:"y",type:o!=null&&a==null?"band":void 0,optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},r,KF),Cb(this,r),Ab(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x1:f,y1:u,x2:c,y2:m}=n,{marginTop:l,marginRight:p,marginBottom:d,marginLeft:y,width:x,height:w}=o,{projection:g}=i,{insetTop:S,insetRight:b,insetBottom:T,insetLeft:I}=this,{rx:v,ry:O,rx1y1:C,rx1y2:E,rx2y1:A,rx2y2:F}=this;(f||c)&&!g&&Wi(a)&&(f=c=null),(u||m)&&!g&&Wi(s)&&(u=m=null);let H=a?.bandwidth?a.bandwidth():0,j=s?.bandwidth?s.bandwidth():0;return Ve("svg:g",i).call(Qt,this,o,i).call(Jt,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(C||E||A||F?U=>U.append("path").call(Bt,this).call(Pb,f&&c?D=>f[D]+(c[D]f[D]+I:y+I,u&&m?D=>u[D]+(m[D]u[D]+S:l+S,f&&c?D=>c[D]-(c[D]f[D]+H-b:x-p-b,u&&m?D=>m[D]-(m[D]u[D]+j-T:w-d-T,this).call(Ar,this,n):U=>U.append("rect").call(Bt,this).attr("x",f?c?D=>Math.min(f[D],c[D])+I:D=>f[D]+I:y+I).attr("y",u?m?D=>Math.min(u[D],m[D])+S:D=>u[D]+S:l+S).attr("width",f?c?D=>Math.max(0,Math.abs(c[D]-f[D])+H-I-b):H-I-b:x-p-y-b-I).attr("height",u?m?D=>Math.max(0,Math.abs(u[D]-m[D])+j-S-T):j-S-T:w-l-d-S-T).call(pe,"rx",v).call(pe,"ry",O).call(Ar,this,n))).node()}};function Cb(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=St(r),e.insetRight=St(n),e.insetBottom=St(o),e.insetLeft=St(i)}function Ab(e,{r:t,rx:r,ry:n,rx1:o=t,ry1:i=t,rx2:a=t,ry2:s=t,rx1y1:f=o!==void 0?+o:i!==void 0?+i:0,rx1y2:u=o!==void 0?+o:s!==void 0?+s:0,rx2y1:c=a!==void 0?+a:i!==void 0?+i:0,rx2y2:m=a!==void 0?+a:s!==void 0?+s:0}={}){f||u||c||m?(e.rx1y1=f,e.rx1y2=u,e.rx2y1=c,e.rx2y2=m):(e.rx=yt(r,"auto"),e.ry=yt(n,"auto"))}function Pb(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:f,rx2y2:u}=i;typeof t!="function"&&(t=Gr(t)),typeof r!="function"&&(r=Gr(r)),typeof n!="function"&&(n=Gr(n)),typeof o!="function"&&(o=Gr(o));let c=Math.max(Math.abs(a+f),Math.abs(s+u)),m=Math.max(Math.abs(a+s),Math.abs(f+u));e.attr("d",l=>{let p=t(l),d=r(l),y=n(l),x=o(l),w=p>y,g=d>x,S=w?y:p,b=w?p:y,T=g?x:d,I=g?d:x,v=Math.min(1,(b-S)/c,(I-T)/m),O=v*(w?g?u:f:g?s:a),C=v*(w?g?s:a:g?u:f),E=v*(w?g?a:s:g?f:u),A=v*(w?g?f:u:g?a:s);return`M${S},${T+Hd(O,A)}A${O},${O} 0 0 ${O<0?0:1} ${S+qd(O,A)},${T}H${b-qd(C,E)}A${C},${C} 0 0 ${C<0?0:1} ${b},${T+Hd(C,E)}V${I-Hd(E,C)}A${E},${E} 0 0 ${E<0?0:1} ${b-qd(E,C)},${I}H${S+qd(A,O)}A${A},${A} 0 0 ${A<0?0:1} ${S},${I-Hd(A,O)}Z`})}function qd(e,t){return t<0?e:Math.abs(e)}function Hd(e,t){return t<0?Math.abs(e):e}function Vu(e,t={}){return x6(t)||(t={...t,x:Ru,y2:dt,interval:1}),new Yd(e,b8(wM(h8(t))))}var qF={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},HF={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},kb=class extends ot{constructor(t={}){let{anchor:r=null}=t;super(pf,void 0,t,r==null?qF:HF),this.anchor=Og(r,"anchor",["top","right","bottom","left"]),Cb(this,t),r||Ab(this,t)}render(t,r,n,o,i){let{marginTop:a,marginRight:s,marginBottom:f,marginLeft:u,width:c,height:m}=o,{anchor:l,insetTop:p,insetRight:d,insetBottom:y,insetLeft:x}=this,{rx:w,ry:g,rx1y1:S,rx1y2:b,rx2y1:T,rx2y2:I}=this,v=u+x,O=c-s-d,C=a+p,E=m-f-y;return Ve(l?"svg:line":S||b||T||I?"svg:path":"svg:rect",i).datum(0).call(Qt,this,o,i).call(Bt,this).call(Ar,this,n).call(Jt,this,{}).call(l==="left"?A=>A.attr("x1",v).attr("x2",v).attr("y1",C).attr("y2",E):l==="right"?A=>A.attr("x1",O).attr("x2",O).attr("y1",C).attr("y2",E):l==="top"?A=>A.attr("x1",v).attr("x2",O).attr("y1",C).attr("y2",C):l==="bottom"?A=>A.attr("x1",v).attr("x2",O).attr("y1",E).attr("y2",E):S||b||T||I?A=>A.call(Pb,v,C,O,E,this):A=>A.attr("x",v).attr("y",C).attr("width",O-v).attr("height",E-C).attr("rx",w).attr("ry",g)).node()}};function Nb(e){return new kb(e)}var Fb={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},YF=new Set(["geometry","href","src","ariaLabel","scales"]),Eb=class extends ot{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&hn(t)&&Id(t)&&(r={...r,title:dt});let{x:n,y:o,x1:i,x2:a,y1:s,y2:f,anchor:u,preferredAnchor:c="bottom",monospace:m,fontFamily:l=m?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:d,fontVariant:y,fontWeight:x,lineHeight:w=1,lineWidth:g=20,frameAnchor:S,format:b,textAnchor:T="start",textOverflow:I,textPadding:v=8,title:O,pointerSize:C=12,pathFilter:E="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:i!=null&&a!=null?null:n,scale:"x",optional:!0},y:{value:s!=null&&f!=null?null:o,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:a==null},y1:{value:s,scale:"y",optional:f==null},x2:{value:a,scale:"x",optional:i==null},y2:{value:f,scale:"y",optional:s==null},title:{value:O,optional:!0}},r,Fb),this.anchor=vd(u,"anchor"),this.preferredAnchor=vd(c,"preferredAnchor"),this.frameAnchor=Yi(S),this.textAnchor=yt(T,"middle"),this.textPadding=+v,this.pointerSize=+C,this.pathFilter=wt(E),this.lineHeight=+w,this.lineWidth=+g,this.textOverflow=wb(I),this.monospace=!!m,this.fontFamily=wt(l),this.fontSize=St(p),this.fontStyle=wt(d),this.fontVariant=wt(y),this.fontWeight=wt(x);for(let A in Fb)A in this.channels&&(this[A]=Fb[A]);this.splitLines=_b(this),this.clipLine=vb(this),this.format=typeof b=="string"||typeof b=="function"?{title:b}:{...b}}render(t,r,n,o,i){let a=this,{x:s,y:f,fx:u,fy:c}=r,{ownerSVGElement:m,document:l}=i,{anchor:p,monospace:d,lineHeight:y,lineWidth:x}=this,{textPadding:w,pointerSize:g,pathFilter:S}=this,{marginTop:b,marginLeft:T}=o,{x1:I,y1:v,x2:O,y2:C,x:E=I??O,y:A=v??C}=n,F=u?u(t.fx)-T:0,H=c?c(t.fy)-b:0,[j,M]=_o(this,o),U=cb(n,j),D=ub(n,M),oe=d?Bd:jd,V=oe(Wa),K,Y;"title"in n?(K=v8.call(this,{title:n.channels.title},r),Y=QF):(K=v8.call(this,n.channels,r),Y=JF);let Z=Ve("svg:g",i).call(Qt,this,o,i).call(Ib,this).call(Jt,this,{x:E&&s,y:A&&f}).call(B=>B.selectAll().data(t).enter().append("g").attr("transform",W=>`translate(${Math.round(U(W))},${Math.round(D(W))})`).call(Bt,this).call(W=>W.append("path").attr("filter",S)).call(W=>W.append("text").each(function(X){let le=nn(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let L=Y.call(a,X,t,K,r,n);if(typeof L=="string")for(let Q of a.splitLines(L))J(le,{value:a.clipLine(Q)});else{let Q=new Set;for(let re of L){let{label:$=""}=re;$&&Q.has($)||(Q.add($),J(le,re))}}})));function J(B,{label:W,value:X,color:le,opacity:L}){W??="",X??="";let Q=le!=null||L!=null,re,$=x*100,[ke]=Xa(W,$,oe,V);if(ke>=0)W=W.slice(0,ke).trimEnd()+Wa,re=X.trim(),X="";else{(W||!X&&!Q)&&(X=" "+X);let[ae]=Xa(X,$-oe(W),oe,V);ae>=0&&(re=X.trim(),X=X.slice(0,ae).trimEnd()+Wa)}let G=B.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");W&&G.append("tspan").attr("font-weight","bold").text(W),X&&G.append(()=>l.createTextNode(X)),Q&&G.append("tspan").text(" \u25A0").attr("fill",le).attr("fill-opacity",L).style("user-select","none"),re&&G.append("title").text(re)}function ye(){let{width:B,height:W}=o.facet??o;Z.selectChildren().each(function(X){let{x:le,width:L,height:Q}=this.getBBox();L=Math.round(L),Q=Math.round(Q);let re=p;if(re===void 0){let G=U(X)+F,ae=D(X)+H,xe=G+L+g+w*20,Pt=ae+Q+g+w*20;re=xe&&Ge?Pt&&qt?a.preferredAnchor:qt?"bottom":"top":Pt&&qt?xe?"left":"right":(xe||Ge)&&(Pt||qt)?`${qt?"bottom":"top"}-${xe?"left":"right"}`:a.preferredAnchor}let $=this.firstChild,ke=this.lastChild;if($.setAttribute("d",ZF(re,g,w,L,Q)),le)for(let G of ke.childNodes)G.setAttribute("x",-le);ke.setAttribute("y",`${+WF(re,ke.childNodes.length,y).toFixed(6)}em`),ke.setAttribute("transform",`translate(${XF(re,g,w,L,Q)})`)}),Z.attr("visibility",null)}return t.length&&(Z.attr("visibility","hidden"),m.isConnected?Promise.resolve().then(ye):typeof requestAnimationFrame<"u"&&requestAnimationFrame(ye)),Z.node()}};function R8(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=ii(t,r)),new Eb(e,{...n,x:t,y:r})}function WF(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function XF(e,t,r,n,o){switch(e){case"middle":return[-n/2,o/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,o/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,o/2]}}function ZF(e,t,r,n,o){let i=n+r*2,a=o+r*2;switch(e){case"middle":return`M${-i/2},${-a/2}h${i}v${a}h${-i}z`;case"top-left":return`M0,0l${t},${t}h${i-t}v${a}h${-i}z`;case"top":return`M0,0l${t/2},${t/2}h${(i-t)/2}v${a}h${-i}v${-a}h${(i-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-i}v${a}h${i}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-a/2}h${-i}v${a}h${i}v${t/2-a/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${i-t}v${-a}h${-i}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(i-t)/2}v${-a}h${-i}v${a}h${(i-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-i}v${-a}h${i}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-a/2}h${i}v${a}h${-i}v${t/2-a/2}z`}}function v8(e,t){let r={},n=this.format;n=T8(n,e,"x"),n=T8(n,e,"y"),this.format=n;for(let o in n){let i=n[o];if(!(i===null||i===!1))if(o==="fx"||o==="fy")r[o]=!0;else{let a=Vg(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||YF.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=Vg(e,o);if(i){if(i.scale==null&&i.defaultScale==="color")continue;r[o]=i}}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let o in r){let i=this.format[o];if(typeof i=="string"){let a=r[o]?.value??t[o]?.domain()??[];this.format[o]=(Dt(a)?ho:sn)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?Du(a,a.domain()):Io}}return r}function T8(e,t,r){if(!(r in e))return e;let n=`${r}1`,o=`${r}2`;if((n in e||!(n in t))&&(o in e||!(o in t)))return e;let i=Object.entries(e),a=e[r];return i.splice(i.findIndex(([s])=>s===r)+1,0,[n,a],[o,a]),Object.fromEntries(i)}function QF(e,t,{title:r}){return this.format.title(r.value[e],e)}function*JF(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:Wd(n,r,i),value:this.format[i](t[i],e)};continue}if(i==="x1"&&"x2"in r||i==="y1"&&"y2"in r)continue;let a=r[i];if(i==="x2"&&"x1"in r)yield{label:O8(n,r,"x"),value:M8(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:O8(n,r,"y"),value:M8(this.format.y2,r.y1,a,e)};else{let s=a.value[e],f=a.scale;if(!mn(s)&&f==null)continue;yield{label:Wd(n,r,i),value:this.format[i](s,e),color:f==="color"?o[i][e]:null,opacity:f==="opacity"?o[i][e]:null}}}}function M8(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function O8(e,t,r){let n=Wd(e,t,`${r}1`,r),o=Wd(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function Wd(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function vo(e={}){let{facet:t,style:r,title:n,subtitle:o,caption:i,ariaLabel:a,ariaDescription:s}=e,f=Tf(e.className),u=e.marks===void 0?[]:A8(e.marks);u.push(...iE(u));let c=nE(t,e),m=new Map;for(let V of u){let K=P8(V,c,e);K&&m.set(V,K)}let l=new Map;c&&Uu(l,[c],e),Uu(l,m,e);let p=A8(aE(u,l,e));for(let V of p){let K=P8(V,c,e);K&&m.set(V,K)}u.unshift(...p);let d=jT(l,e);if(d!==void 0){let V=c?Nd(d,c):void 0;for(let Y of u){if(Y.facet===null||Y.facet==="super")continue;let Z=m.get(Y);Z!==void 0&&(Z.facetsIndex=Y.fx!=null||Y.fy!=null?Nd(d,Z):V)}let K=new Set;for(let{facetsIndex:Y}of m.values())Y?.forEach((Z,J)=>{Z?.length>0&&K.add(J)});d.forEach(0Y.empty=!K.has(Z):Y=>Y.empty=!1);for(let Y of u)if(Y.facet==="exclude"){let Z=m.get(Y);Z!==void 0&&(Z.facetsIndex=zT(Z.facetsIndex))}}for(let V of Be.keys())mf(e[V])&&V!=="fx"&&V!=="fy"&&l.set(V,[]);let y=new Map;for(let V of u){if(y.has(V))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:K,channels:Y}=m.get(V)??{},{data:Z,facets:J,channels:ye}=V.initialize(K,Y,e);Db(ye,e),y.set(V,{data:Z,facets:J,channels:ye})}let x=Nu(Uu(l,y,e),e),w=sM(x,u,e);ET(x,w);let g=Wg(x),{fx:S,fy:b}=g,T=S||b?Xg(x,w):w,I=S||b?mE(g,w):w,v=vf(e),O=v.document,C=Go("svg").call(O.documentElement),E=C;v.ownerSVGElement=C,v.className=f,v.projection=HT(e,T),v.path=function(){return Ks(this.projection??JT(g))},v.filterFacets=(V,K)=>Nd(d,{channels:K,groups:Pd(V,K)}),v.getMarkState=V=>{let K=y.get(V),Y=m.get(V);return{...K,channels:{...K.channels,...Y?.channels}}},v.dispatchValue=V=>{E.value!==V&&(E.value=V,E.dispatchEvent(new v.document.defaultView.Event("input",{bubbles:!0})))};let A=new Set;for(let[V,K]of y)if(V.initializer!=null){let Y=V.facet==="super"?I:T,Z=V.initializer(K.data,K.facets,K.channels,g,Y,v);if(Z.data!==void 0&&(K.data=Z.data),Z.facets!==void 0&&(K.facets=Z.facets),Z.channels!==void 0){let{fx:J,fy:ye,...B}=Z.channels;rE(B),Object.assign(K.channels,B);for(let W of Object.values(B)){let{scale:X}=W;X!=null&&!E6(Be.get(X))&&(F8(W,e),A.add(X))}(J!=null||ye!=null)&&m.set(V,!0)}}if(A.size){let V=new Map;Uu(V,y,e,J=>A.has(J)),Uu(l,y,e,J=>A.has(J));let K=pE(Nu(V,e),x),{scales:Y,...Z}=Wg(K);Object.assign(x,K),Object.assign(g,Z),Object.assign(g.scales,Y)}let F,H;d!==void 0&&(F={x:S?.domain(),y:b?.domain()},d=BT(d,F),H=GT(S,b,w));for(let[V,K]of y)K.values=V.scale(K.channels,g,v);let{width:j,height:M}=w;nn(C).attr("class",f).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",j).attr("height",M).attr("viewBox",`0 0 ${j} ${M}`).attr("aria-label",a).attr("aria-description",s).call(V=>V.append("style").text(`:where(.${f}) { +${y}`)).style("margin-left",u?`${+u}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",_t(i,"normal")).call(Zc,m).node()}var S1=new Map([["symbol",mO],["color",bO],["opacity",V9]]);function hO(e,t,r={}){return(n,o)=>{if(!S1.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return S1.get(n)(e[n],yO(t,r[n],o),i=>e[i])}}function yO({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return DT(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function bO(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return pO(e,r);case"ramp":return bM(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function V9({type:e,interpolate:t,...r},{legend:n=!0,color:o=yn(0,0,0),...i}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return bO({type:e,...r,interpolate:j9(o)},{legend:n,...i})}function j9(e){let{r:t,g:r,b:n}=yn(e)||yn(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function gO(e,t,r){let n=[];for(let[o,i]of S1){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],yO(t,e[o],a),c=>e[c]);s!=null&&n.push(s)}}return n}function xO(e={},t="y"){return Sx(e)?e:{...e,[t]:St}}function wO(e,t){if(t.length===1)return{data:e,facets:t};let r=pa(e),n=new Uint8Array(r),o=0;for(let s of t)for(let c of s)n[c]&&++o,n[c]=1;if(o===0)return{data:e,facets:t};e=ua(e);let i=e[dx]=new Uint32Array(r+o);t=t.map(s=>ua(s,Uint32Array));let a=r;n.fill(0);for(let s of t)for(let c=0,u=s.length;c{({data:y,facets:b}=wO(y,b));let g=e==null?void 0:f(OT(qt(y,e),w?.[r])),_=qt(y,t,Float64Array),x=qt(y,c),I=i&&i(y,g,_,x),S=pa(y),v=l(new Float64Array(S)),T=h(new Float64Array(S)),O=[];for(let R of b){let C=g?Array.from(ii(R,k=>g[k]).values()):[R];if(I)for(let k of C)k.sort(I);for(let k of C){let z=0,j=0;a&&k.reverse();for(let M of k){let U=_[M];U<0?z=T[M]=(v[M]=z)+U:U>0?j=T[M]=(v[M]=j)+U:T[M]=v[M]=j}}O.push(C)}return o&&o(O,v,T,x),{data:y,facets:b}}),u,m,p]}function G9(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return K9;case"center":case"silhouette":return q9;case"wiggle":return PO}throw new Error(`unknown offset: ${e}`)}}function vO(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function K9(e,t,r){for(let n of e)for(let o of n){let[i,a]=vO(o,r);for(let s of o){let c=1/(a-i||1);t[s]=c*(t[s]-i),r[s]=c*(r[s]-i)}}}function q9(e,t,r){for(let n of e){for(let o of n){let[i,a]=vO(o,r);for(let s of o){let c=(a+i)/2;t[s]-=c,r[s]-=c}}TO(n,t,r)}MO(e,t,r)}function PO(e,t,r,n){for(let o of e){let i=new Sr,a=0;for(let s of o){let c=-1,u=s.map(p=>Math.abs(r[p]-t[p])),f=s.map(p=>{c=n?n[p]:++c;let h=r[p]-t[p],y=i.has(c)?h-i.get(c):0;return i.set(c,h),y}),m=[0,...fp(f)];for(let p of s)t[p]+=a,r[p]+=a;let l=dn(u);l&&(a-=dn(u,(p,h)=>(f[h]/2+m[h])*p)/l)}TO(o,t,r)}MO(e,t,r)}function TO(e,t,r){let n=Ir(e,o=>Ir(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function MO(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(Ir(s,c=>t[c])+jt(s,c=>r[c]))/2),a=Ir(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function W9(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function X9(e){return Mh(e,(t,r,n,o)=>Qs(Dr(t),i=>dn(i,a=>n[a]),i=>o[i]))}function Z9(e){return Mh(e,(t,r,n,o)=>Qs(Dr(t),i=>r[Bf(i,a=>n[a])],i=>o[i]))}function SO(e){return Mh(e,(t,r,n,o)=>{let i=Dr(t),a=Qs(i,m=>r[Bf(m,l=>n[l])],m=>o[m]),s=ho(i,m=>dn(m,l=>n[l]),m=>o[m]),c=[],u=[],f=0;for(let m of a)f<0?(f+=s.get(m),c.push(m)):(f-=s.get(m),u.push(m));return u.reverse().concat(c)})}function IO(e){return t=>{let r=qt(t,e);return(n,o)=>$r(r[n],r[o])}}function Q9(e){return t=>Xn(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function J9(e){return Mh($r,()=>e)}function Mh(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new Sr(t(r,n,o,i).map((s,c)=>[s,c]));return(s,c)=>e(a.get(i[s]),a.get(i[c]))}}var e$={ariaLabel:"rect"},kh=class extends lt{constructor(t,r={}){let{x1:n,y1:o,x2:i,y2:a}=r;super(t,{x1:{value:n,scale:"x",type:n!=null&&i==null?"band":void 0,optional:!0},y1:{value:o,scale:"y",type:o!=null&&a==null?"band":void 0,optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},r,e$),I1(this,r),_1(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x1:c,y1:u,x2:f,y2:m}=n,{marginTop:l,marginRight:p,marginBottom:h,marginLeft:y,width:b,height:w}=o,{projection:g}=i,{insetTop:_,insetRight:x,insetBottom:I,insetLeft:S}=this,{rx:v,ry:T,rx1y1:O,rx1y2:R,rx2y1:C,rx2y2:k}=this;(c||f)&&!g&&ba(a)&&(c=f=null),(u||m)&&!g&&ba(s)&&(u=m=null);let z=a?.bandwidth?a.bandwidth():0,j=s?.bandwidth?s.bandwidth():0;return ze("svg:g",i).call(ir,this,o,i).call(ar,this,{},0,0).call(M=>M.selectAll().data(t).enter().call(O||R||C||k?U=>U.append("path").call(Wt,this).call(v1,c&&f?L=>c[L]+(f[L]c[L]+S:y+S,u&&m?L=>u[L]+(m[L]u[L]+_:l+_,c&&f?L=>f[L]-(f[L]c[L]+z-x:b-p-x,u&&m?L=>m[L]-(m[L]u[L]+j-I:w-h-I,this).call(Vr,this,n):U=>U.append("rect").call(Wt,this).attr("x",c?f?L=>Math.min(c[L],f[L])+S:L=>c[L]+S:y+S).attr("y",u?m?L=>Math.min(u[L],m[L])+_:L=>u[L]+_:l+_).attr("width",c?f?L=>Math.max(0,Math.abs(f[L]-c[L])+z-S-x):z-S-x:b-p-y-x-S).attr("height",u?m?L=>Math.max(0,Math.abs(u[L]-m[L])+j-_-I):j-_-I:w-l-h-_-I).call(de,"rx",v).call(de,"ry",T).call(Vr,this,n))).node()}};function I1(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=Ot(r),e.insetRight=Ot(n),e.insetBottom=Ot(o),e.insetLeft=Ot(i)}function _1(e,{r:t,rx:r,ry:n,rx1:o=t,ry1:i=t,rx2:a=t,ry2:s=t,rx1y1:c=o!==void 0?+o:i!==void 0?+i:0,rx1y2:u=o!==void 0?+o:s!==void 0?+s:0,rx2y1:f=a!==void 0?+a:i!==void 0?+i:0,rx2y2:m=a!==void 0?+a:s!==void 0?+s:0}={}){c||u||f||m?(e.rx1y1=c,e.rx1y2=u,e.rx2y1=f,e.rx2y2=m):(e.rx=_t(r,"auto"),e.ry=_t(n,"auto"))}function v1(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:c,rx2y2:u}=i;typeof t!="function"&&(t=en(t)),typeof r!="function"&&(r=en(r)),typeof n!="function"&&(n=en(n)),typeof o!="function"&&(o=en(o));let f=Math.max(Math.abs(a+c),Math.abs(s+u)),m=Math.max(Math.abs(a+s),Math.abs(c+u));e.attr("d",l=>{let p=t(l),h=r(l),y=n(l),b=o(l),w=p>y,g=h>b,_=w?y:p,x=w?p:y,I=g?b:h,S=g?h:b,v=Math.min(1,(x-_)/f,(S-I)/m),T=v*(w?g?u:c:g?s:a),O=v*(w?g?s:a:g?u:c),R=v*(w?g?a:s:g?c:u),C=v*(w?g?c:u:g?a:s);return`M${_},${I+Ch(T,C)}A${T},${T} 0 0 ${T<0?0:1} ${_+Oh(T,C)},${I}H${x-Oh(O,R)}A${O},${O} 0 0 ${O<0?0:1} ${x},${I+Ch(O,R)}V${S-Ch(R,O)}A${R},${R} 0 0 ${R<0?0:1} ${x-Oh(R,O)},${S}H${_+Oh(C,T)}A${C},${C} 0 0 ${C<0?0:1} ${_},${S-Ch(C,T)}Z`})}function Oh(e,t){return t<0?e:Math.abs(e)}function Ch(e,t){return t<0?Math.abs(e):e}function Ri(e,t={}){return _T(t)||(t={...t,x:sl,y2:St,interval:1}),new kh(e,_O(TM(xO(t))))}var t$={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},r$={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},P1=class extends lt{constructor(t={}){let{anchor:r=null}=t;super(Dc,void 0,t,r==null?t$:r$),this.anchor=wx(r,"anchor",["top","right","bottom","left"]),I1(this,t),r||_1(this,t)}render(t,r,n,o,i){let{marginTop:a,marginRight:s,marginBottom:c,marginLeft:u,width:f,height:m}=o,{anchor:l,insetTop:p,insetRight:h,insetBottom:y,insetLeft:b}=this,{rx:w,ry:g,rx1y1:_,rx1y2:x,rx2y1:I,rx2y2:S}=this,v=u+b,T=f-s-h,O=a+p,R=m-c-y;return ze(l?"svg:line":_||x||I||S?"svg:path":"svg:rect",i).datum(0).call(ir,this,o,i).call(Wt,this).call(Vr,this,n).call(ar,this,{}).call(l==="left"?C=>C.attr("x1",v).attr("x2",v).attr("y1",O).attr("y2",R):l==="right"?C=>C.attr("x1",T).attr("x2",T).attr("y1",O).attr("y2",R):l==="top"?C=>C.attr("x1",v).attr("x2",T).attr("y1",O).attr("y2",O):l==="bottom"?C=>C.attr("x1",v).attr("x2",T).attr("y1",R).attr("y2",R):_||x||I||S?C=>C.call(v1,v,O,T,R,this):C=>C.attr("x",v).attr("y",O).attr("width",T-v).attr("height",R-O).attr("rx",w).attr("ry",g)).node()}};function T1(e){return new P1(e)}var M1={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},n$=new Set(["geometry","href","src","ariaLabel","scales"]),O1=class extends lt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&Tn(t)&&nh(t)&&(r={...r,title:St});let{x:n,y:o,x1:i,x2:a,y1:s,y2:c,anchor:u,preferredAnchor:f="bottom",monospace:m,fontFamily:l=m?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:h,fontVariant:y,fontWeight:b,lineHeight:w=1,lineWidth:g=20,frameAnchor:_,format:x,textAnchor:I="start",textOverflow:S,textPadding:v=8,title:T,pointerSize:O=12,pathFilter:R="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:i!=null&&a!=null?null:n,scale:"x",optional:!0},y:{value:s!=null&&c!=null?null:o,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:a==null},y1:{value:s,scale:"y",optional:c==null},x2:{value:a,scale:"x",optional:i==null},y2:{value:c,scale:"y",optional:s==null},title:{value:T,optional:!0}},r,M1),this.anchor=ih(u,"anchor"),this.preferredAnchor=ih(f,"preferredAnchor"),this.frameAnchor=ya(_),this.textAnchor=_t(I,"middle"),this.textPadding=+v,this.pointerSize=+O,this.pathFilter=Mt(R),this.lineHeight=+w,this.lineWidth=+g,this.textOverflow=p1(S),this.monospace=!!m,this.fontFamily=Mt(l),this.fontSize=Ot(p),this.fontStyle=Mt(h),this.fontVariant=Mt(y),this.fontWeight=Mt(b);for(let C in M1)C in this.channels&&(this[C]=M1[C]);this.splitLines=y1(this),this.clipLine=b1(this),this.format=typeof x=="string"||typeof x=="function"?{title:x}:{...x}}render(t,r,n,o,i){let a=this,{x:s,y:c,fx:u,fy:f}=r,{ownerSVGElement:m,document:l}=i,{anchor:p,monospace:h,lineHeight:y,lineWidth:b}=this,{textPadding:w,pointerSize:g,pathFilter:_}=this,{marginTop:x,marginLeft:I}=o,{x1:S,y1:v,x2:T,y2:O,x:R=S??T,y:C=v??O}=n,k=u?u(t.fx)-I:0,z=f?f(t.fy)-x:0,[j,M]=Vo(this,o),U=r1(n,j),L=n1(n,M),re=h?_h:Ih,V=re(xs),q,H;"title"in n?(q=OO.call(this,{title:n.channels.title},r),H=s$):(q=OO.call(this,n.channels,r),H=c$);let W=ze("svg:g",i).call(ir,this,o,i).call(h1,this).call(ar,this,{x:R&&s,y:C&&c}).call(K=>K.selectAll().data(t).enter().append("g").attr("transform",Z=>`translate(${Math.round(U(Z))},${Math.round(L(Z))})`).call(Wt,this).call(Z=>Z.append("path").attr("filter",_)).call(Z=>Z.append("text").each(function(Y){let ee=hn(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let A=H.call(a,Y,t,q,r,n);if(typeof A=="string")for(let B of a.splitLines(A))te(ee,{value:a.clipLine(B)});else{let B=new Set;for(let Q of A){let{label:E=""}=Q;E&&B.has(E)||(B.add(E),te(ee,Q))}}})));function te(K,{label:Z,value:Y,color:ee,opacity:A}){Z??="",Y??="";let B=ee!=null||A!=null,Q,E=b*100,[me]=ws(Z,E,re,V);if(me>=0)Z=Z.slice(0,me).trimEnd()+xs,Q=Y.trim(),Y="";else{(Z||!Y&&!B)&&(Y=" "+Y);let[oe]=ws(Y,E-re(Z),re,V);oe>=0&&(Q=Y.trim(),Y=Y.slice(0,oe).trimEnd()+xs)}let G=K.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");Z&&G.append("tspan").attr("font-weight","bold").text(Z),Y&&G.append(()=>l.createTextNode(Y)),B&&G.append("tspan").text(" \u25A0").attr("fill",ee).attr("fill-opacity",A).style("user-select","none"),Q&&G.append("title").text(Q)}function be(){let{width:K,height:Z}=o.facet??o;W.selectChildren().each(function(Y){let{x:ee,width:A,height:B}=this.getBBox();A=Math.round(A),B=Math.round(B);let Q=p;if(Q===void 0){let G=U(Y)+k,oe=L(Y)+z,ue=G+A+g+w*20,Ge=oe+B+g+w*20;Q=ue&&Ce?Ge&&bt?a.preferredAnchor:bt?"bottom":"top":Ge&&bt?ue?"left":"right":(ue||Ce)&&(Ge||bt)?`${bt?"bottom":"top"}-${ue?"left":"right"}`:a.preferredAnchor}let E=this.firstChild,me=this.lastChild;if(E.setAttribute("d",a$(Q,g,w,A,B)),ee)for(let G of me.childNodes)G.setAttribute("x",-ee);me.setAttribute("y",`${+o$(Q,me.childNodes.length,y).toFixed(6)}em`),me.setAttribute("transform",`translate(${i$(Q,g,w,A,B)})`)}),W.attr("visibility",null)}return t.length&&(W.attr("visibility","hidden"),m.isConnected?Promise.resolve().then(be):typeof requestAnimationFrame<"u"&&requestAnimationFrame(be)),W.node()}};function NO(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Pi(t,r)),new O1(e,{...n,x:t,y:r})}function o$(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function i$(e,t,r,n,o){switch(e){case"middle":return[-n/2,o/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,o/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,o/2]}}function a$(e,t,r,n,o){let i=n+r*2,a=o+r*2;switch(e){case"middle":return`M${-i/2},${-a/2}h${i}v${a}h${-i}z`;case"top-left":return`M0,0l${t},${t}h${i-t}v${a}h${-i}z`;case"top":return`M0,0l${t/2},${t/2}h${(i-t)/2}v${a}h${-i}v${-a}h${(i-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-i}v${a}h${i}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-a/2}h${-i}v${a}h${i}v${t/2-a/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${i-t}v${-a}h${-i}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(i-t)/2}v${-a}h${-i}v${a}h${(i-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-i}v${-a}h${i}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-a/2}h${i}v${a}h${-i}v${t/2-a/2}z`}}function OO(e,t){let r={},n=this.format;n=CO(n,e,"x"),n=CO(n,e,"y"),this.format=n;for(let o in n){let i=n[o];if(!(i===null||i===!1))if(o==="fx"||o==="fy")r[o]=!0;else{let a=Nx(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||n$.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=Nx(e,o);if(i){if(i.scale==null&&i.defaultScale==="color")continue;r[o]=i}}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let o in r){let i=this.format[o];if(typeof i=="string"){let a=r[o]?.value??t[o]?.domain()??[];this.format[o]=(Kt(a)?Ro:gn)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?bl(a,a.domain()):Lo}}return r}function CO(e,t,r){if(!(r in e))return e;let n=`${r}1`,o=`${r}2`;if((n in e||!(n in t))&&(o in e||!(o in t)))return e;let i=Object.entries(e),a=e[r];return i.splice(i.findIndex(([s])=>s===r)+1,0,[n,a],[o,a]),Object.fromEntries(i)}function s$(e,t,{title:r}){return this.format.title(r.value[e],e)}function*c$(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:Rh(n,r,i),value:this.format[i](t[i],e)};continue}if(i==="x1"&&"x2"in r||i==="y1"&&"y2"in r)continue;let a=r[i];if(i==="x2"&&"x1"in r)yield{label:RO(n,r,"x"),value:kO(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:RO(n,r,"y"),value:kO(this.format.y2,r.y1,a,e)};else{let s=a.value[e],c=a.scale;if(!vn(s)&&c==null)continue;yield{label:Rh(n,r,i),value:this.format[i](s,e),color:c==="color"?o[i][e]:null,opacity:c==="opacity"?o[i][e]:null}}}}function kO(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function RO(e,t,r){let n=Rh(e,t,`${r}1`,r),o=Rh(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function Rh(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function jo(e={}){let{facet:t,style:r,title:n,subtitle:o,caption:i,ariaLabel:a,ariaDescription:s}=e,c=Xc(e.className),u=e.marks===void 0?[]:EO(e.marks);u.push(...d$(u));let f=p$(t,e),m=new Map;for(let V of u){let q=FO(V,f,e);q&&m.set(V,q)}let l=new Map;f&&gl(l,[f],e),gl(l,m,e);let p=EO(h$(u,l,e));for(let V of p){let q=FO(V,f,e);q&&m.set(V,q)}u.unshift(...p);let h=H6(l,e);if(h!==void 0){let V=f?dh(h,f):void 0;for(let H of u){if(H.facet===null||H.facet==="super")continue;let W=m.get(H);W!==void 0&&(W.facetsIndex=H.fx!=null||H.fy!=null?dh(h,W):V)}let q=new Set;for(let{facetsIndex:H}of m.values())H?.forEach((W,te)=>{W?.length>0&&q.add(te)});h.forEach(0H.empty=!q.has(W):H=>H.empty=!1);for(let H of u)if(H.facet==="exclude"){let W=m.get(H);W!==void 0&&(W.facetsIndex=X6(W.facetsIndex))}}for(let V of He.keys())Lc(e[V])&&V!=="fx"&&V!=="fy"&&l.set(V,[]);let y=new Map;for(let V of u){if(y.has(V))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:q,channels:H}=m.get(V)??{},{data:W,facets:te,channels:be}=V.initialize(q,H,e);R1(be,e),y.set(V,{data:W,facets:te,channels:be})}let b=pl(gl(l,y,e),e),w=mM(b,u,e);U6(b,w);let g=Bx(b),{fx:_,fy:x}=g,I=_||x?zx(b,w):w,S=_||x?I$(g,w):w,v=Wc(e),T=v.document,O=fi("svg").call(T.documentElement),R=O;v.ownerSVGElement=O,v.className=c,v.projection=J6(e,I),v.path=function(){return bc(this.projection??iM(g))},v.filterFacets=(V,q)=>dh(h,{channels:q,groups:ph(V,q)}),v.getMarkState=V=>{let q=y.get(V),H=m.get(V);return{...q,channels:{...q.channels,...H?.channels}}},v.dispatchValue=V=>{R.value!==V&&(R.value=V,R.dispatchEvent(new v.document.defaultView.Event("input",{bubbles:!0})))};let C=new Set;for(let[V,q]of y)if(V.initializer!=null){let H=V.facet==="super"?S:I,W=V.initializer(q.data,q.facets,q.channels,g,H,v);if(W.data!==void 0&&(q.data=W.data),W.facets!==void 0&&(q.facets=W.facets),W.channels!==void 0){let{fx:te,fy:be,...K}=W.channels;l$(K),Object.assign(q.channels,K);for(let Z of Object.values(K)){let{scale:Y}=Z;Y!=null&&!UT(He.get(Y))&&(LO(Z,e),C.add(Y))}(te!=null||be!=null)&&m.set(V,!0)}}if(C.size){let V=new Map;gl(V,y,e,te=>C.has(te)),gl(l,y,e,te=>C.has(te));let q=S$(pl(V,e),b),{scales:H,...W}=Bx(q);Object.assign(b,q),Object.assign(g,W),Object.assign(g.scales,H)}let k,z;h!==void 0&&(k={x:_?.domain(),y:x?.domain()},h=Y6(h,k),z=W6(_,x,w));for(let[V,q]of y)q.values=V.scale(q.channels,g,v);let{width:j,height:M}=w;hn(O).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",j).attr("height",M).attr("viewBox",`0 0 ${j} ${M}`).attr("aria-label",a).attr("aria-description",s).call(V=>V.append("style").text(`:where(.${c}) { --plot-background: white; display: block; height: auto; height: intrinsic; max-width: 100%; } -:where(.${f} text), -:where(.${f} tspan) { +:where(.${c} text), +:where(.${c} tspan) { white-space: pre; -}`)).call(Mf,r);for(let V of u){let{channels:K,values:Y,facets:Z}=y.get(V);if(d===void 0||V.facet==="super"){let J=null;if(Z&&(J=Z[0],J=V.filter(J,K,Y),J.length===0))continue;let ye=V.render(J,g,Y,I,v);if(ye==null)continue;C.appendChild(ye)}else{let J;for(let ye of d){if(!(V.facetAnchor?.(d,F,ye)??!ye.empty))continue;let B=null;if(Z){let X=m.has(V);if(B=Z[X?ye.i:0],B=V.filter(B,K,Y),B.length===0)continue;!X&&B===Z[0]&&(B=b6(B)),B.fx=ye.x,B.fy=ye.y,B.fi=ye.i}let W=V.render(B,g,Y,T,v);if(W!=null){(J??=nn(C).append("g")).append(()=>W).datum(ye);for(let X of["aria-label","aria-description","aria-hidden","transform"])W.hasAttribute(X)&&(J.attr(X,W.getAttribute(X)),W.removeAttribute(X))}}J?.selectChildren().each(H)}}let U=d8(x,v,e),{figure:D=n!=null||o!=null||i!=null||U.length>0}=e;D&&(E=O.createElement("figure"),E.className=`${f}-figure`,E.style.maxWidth="initial",n!=null&&E.append(C8(O,n,"h2")),o!=null&&E.append(C8(O,o,"h3")),E.append(...U,C),i!=null&&E.append(eE(O,i)),"value"in C&&(E.value=C.value,delete C.value)),E.scale=VT(g.scales),E.legend=l8(x,v,e);let oe=yT();return oe>0&&nn(C).append("text").attr("x",j).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${oe.toLocaleString("en-US")} warning${oe===1?"":"s"}. Please check the console.`),E}function C8(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function eE(e,t){let r=e.createElement("figcaption");return r.append(t),r}function A8(e){return e.flat(1/0).filter(t=>t!=null).map(tE)}function tE(e){return typeof e.render=="function"?e:new Lb(e)}var Lb=class extends ot{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function Db(e,t){for(let r in e)F8(e[r],t);return e}function F8(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:o,percent:i,interval:a,transform:s=i?f=>f==null?NaN:f*100:Cg(a,o)}=t[r]??{};s!=null&&(e.value=We(e.value,s),e.transform=!1)}function rE(e){for(let t in e)Dg(t,e[t])}function Uu(e,t,r,n=p6){for(let{channels:o}of t.values())for(let i in o){let a=o[i],{scale:s}=a;if(s!=null&&n(s))if(s==="projection"){if(!XT(r)){let f=r.x?.domain===void 0,u=r.y?.domain===void 0;if(f||u){let[c,m]=QT(a);f&&$b(e,"x",c),u&&$b(e,"y",m)}}}else $b(e,s,a)}return e}function $b(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function nE(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=oi(e.data);if(o==null)throw new Error("missing facet data");let i={};r!=null&&(i.fx=gf(o,{value:r,scale:"fx"})),n!=null&&(i.fy=gf(o,{value:n,scale:"fy"})),Db(i,t);let a=Pd(o,i);return{channels:i,groups:a,data:e.data}}function P8(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let f=oi(e.data??n??o);if(f===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(f===null)return;let u={};return n!=null&&(u.fx=gf(f,{value:n,scale:"fx"})),o!=null&&(u.fy=gf(f,{value:o,scale:"fy"})),Db(u,r),{channels:u,groups:Pd(f,u)}}if(t===void 0)return;let{channels:i,groups:a,data:s}=t;if(e.facet!=="auto"||e.data===s)return{channels:i,groups:a};s.length>0&&(a.size>1||a.size===1&&i.fx&&i.fy&&[...a][0][1].size>1)&&zi(oi(e.data))===zi(s)&&Cr(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function oE(e,t={}){return ai({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function iE(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:o,preferredAnchor:i}=n;o=/^x$/i.test(o)?uM:/^y$/i.test(o)?fb:cM,n=o(oE(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===fb?"left":"bottom");let a=R8(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function aE(e,t,r){let{projection:n,x:o={},y:i={},fx:a={},fy:s={},axis:f,grid:u,facet:c={},facet:{axis:m=f,grid:l}=c,x:{axis:p=f,grid:d=p===null?null:u}=o,y:{axis:y=f,grid:x=y===null?null:u}=i,fx:{axis:w=m,grid:g=w===null?null:l}=a,fy:{axis:S=m,grid:b=S===null?null:l}=s}=r;(n||!mf(o)&&!k8("x",e))&&(p=d=null),(n||!mf(i)&&!k8("y",e))&&(y=x=null),t.has("fx")||(w=g=null),t.has("fy")||(S=b=null),p===void 0&&(p=!Qd(e,"x")),y===void 0&&(y=!Qd(e,"y")),w===void 0&&(w=!Qd(e,"fx")),S===void 0&&(S=!Qd(e,"fy")),p===!0&&(p="bottom"),y===!0&&(y="left"),w===!0&&(w=p==="top"||p===null?"bottom":"top"),S===!0&&(S=y==="right"||y===null?"left":"right");let T=[];return Zd(T,b,WM,s),Xd(T,S,zM,"right","left",c,s),Zd(T,g,ZM,a),Xd(T,w,KM,"top","bottom",c,a),Zd(T,x,YM,i),Xd(T,y,Mb,"left","right",r,i),Zd(T,d,XM,o),Xd(T,p,Ob,"bottom","top",r,o),T}function Xd(e,t,r,n,o,i,a){if(!t)return;let s=sE(t);a=fE(s?n:t,i,a);let{line:f}=a;(r===Mb||r===Ob)&&f&&!Ka(f)&&e.push(Nb(cE(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function Zd(e,t,r,n){!t||Ka(t)||e.push(r(uE(t,n)))}function sE(e){return/^\s*both\s*$/i.test(e)}function fE(e,t,{line:r=t.line,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:f,fontVariant:u,ariaLabel:c,ariaDescription:m,label:l=t.label,labelAnchor:p,labelArrow:d=t.labelArrow,labelOffset:y}){return{anchor:e,line:r,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:f,fontVariant:u,ariaLabel:c,ariaDescription:m,label:l,labelAnchor:p,labelArrow:d,labelOffset:y}}function cE(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function uE(e,{stroke:t=hf(e)?e:void 0,ticks:r=lE(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function lE(e){switch(typeof e){case"number":return!0;case"string":return!hf(e)}return hn(e)||typeof e?.range=="function"}function Qd(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function k8(e,t){for(let r of t)for(let n in r.channels){let{scale:o}=r.channels[n];if(o===e||o==="projection")return!0}return!1}function pE(e,t){for(let r in e){let n=e[r],o=t[r];n.label===void 0&&o&&(n.label=o.label)}return e}function mE({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:f}=Cd(r),u=e&&N8(e),c=t&&N8(t);return{marginTop:t?c[0]:n,marginRight:e?s-u[1]:o,marginBottom:t?f-c[1]:i,marginLeft:e?u[0]:a,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:s,height:f}}function N8(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let r=e(t[0]),n=e(t[t.length-1]);return nb.selectAll().data(t).enter().append(g?"circle":"path").call(Bt,this).call(g?T=>{T.attr("cx",f?I=>f[I]:x).attr("cy",u?I=>u[I]:w).attr("r",c?I=>c[I]:p)}:T=>{T.attr("transform",Of`translate(${f?I=>f[I]:x},${u?I=>u[I]:w})${m?I=>` rotate(${m[I]})`:d?` rotate(${d})`:""}`).attr("d",c&&l?I=>{let v=En();return l[I].draw(v,c[I]*c[I]*Math.PI),v}:c?I=>{let v=En();return y.draw(v,c[I]*c[I]*Math.PI),v}:l?I=>{let v=En();return l[I].draw(v,S),v}:(()=>{let I=En();return y.draw(I,S),I})())}).call(Ar,this,n)).node()}};function Za(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=ii(t,r)),new Jd(e,{...n,x:t,y:r})}var gE={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},eh=class extends ot{constructor(t,r={}){let{x:n,y:o,z:i,curve:a,tension:s}=r;super(t,{x:{value:n,scale:"x"},y:{value:o,scale:"y"},z:{value:bd(r),optional:!0}},r,gE),this.z=i,this.curve=E8(a,s),$u(this,r)}filter(t){return t}project(t,r,n){this.curve!==ju&&super.project(t,r,n)}render(t,r,n,o,i){let{x:a,y:s}=n,{curve:f}=this;return Ve("svg:g",i).call(Qt,this,o,i).call(Jt,this,r).call(u=>u.selectAll().data(oM(t,[a,s],this,n)).enter().append("path").call(Bt,this).call(nM,this,n).call(dM,this,n,i).attr("d",f===ju&&i.projection?bE(i.path(),a,s):Ux().curve(f).defined(c=>c>=0).x(c=>a[c]).y(c=>s[c]))).node()}};function bE(e,t,r){return t=za(t),r=za(r),n=>{let o=[],i=[o];for(let a of n)a===-1?(o=[],i.push(o)):o.push([t[a],r[a]]);return e({type:"MultiLineString",coordinates:i})}}function Ct(e,{x:t,y:r,...n}={}){return[t,r]=ii(t,r),new eh(e,{...n,x:t,y:r})}ot.prototype.plot=function({marks:e=[],...t}={}){return vo({...t,marks:[...e,this]})};var wE=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],$8={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function SE(e,t){let r=[...t?[e.model]:[],`Predicted: ${e.predicted.toFixed(3)}`,`Observed: ${e.observed.toFixed(3)}`];return e.method==="discrete"&&e.events!==void 0&&e.total!==void 0&&(r[r.length-1]+=` ( ${e.events} / ${e.total} )`),r.join(` -`)}function IE(e){let r=[...new Set(e.data.map(p=>p.model))].length>1,n=r?wE:["#000000"],o=e.data.map(p=>({...p,tooltip:SE(p,r)})),i=[];e.references?.some(p=>p.type==="identity")&&i.push(Ct([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(Ct(o,{x:"predicted",y:"observed",stroke:"model",strokeWidth:2,title:"tooltip",tip:!0}));let a=o.filter(p=>p.method==="discrete");a.length>0&&i.push(Za(a,{x:"predicted",y:"observed",fill:"model",stroke:"white",strokeWidth:1.5,r:5,title:"tooltip",tip:!0}));let s=(e.distribution?.length??0)>0,f=vo({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:$8,x:{label:s?null:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6,axis:s?null:"bottom"},y:{label:e.yAxis.label,domain:e.yAxis.domain,grid:!1,ticks:6},color:{legend:r,range:n},marks:i});if(!s||!e.distribution)return f;let u=e.distribution.map(p=>({...p,tooltip:`${r?`${p.model} -`:""}${p.count} observations in [${(p.midpoint-p.binWidth/2).toFixed(3)}, ${(p.midpoint+p.binWidth/2).toFixed(3)}]`})),c=new Set(e.distribution.map(p=>p.model)).size,m=vo({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:$8,x:{label:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6},y:{label:null,grid:!1,ticks:3},color:{legend:!1,range:n},marks:[Vu(u,{x1:p=>p.midpoint-p.binWidth/2,x2:p=>p.midpoint+p.binWidth/2,y:"count",fill:"model",fillOpacity:1/Math.max(c,1),title:"tooltip",tip:!0})]}),l=document.createElement("div");return l.style.width="600px",l.style.maxWidth="100%",l.append(f,m),l}var L8=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],xr={width:600,height:500,margins:{top:28,right:28,bottom:58,left:66},background:"#ffffff",frame:{color:"#444444",width:1},typography:{fontFamily:"Arial, Helvetica, sans-serif",fontSize:12,axisTitleSize:14,axisTitleWeight:400,legendSize:12},axis:{color:"#444444",tickSize:5,tickPadding:7,ticks:6,numberFormat:".1f"},colors:L8,line:{width:2,dash:null},marker:{radius:2.5,fill:null,stroke:"#ffffff",strokeWidth:.5},reference:{color:"#BEBEBE",width:1.5,dash:"2,3"},legend:{position:"top",swatchWidth:12,columns:null},tip:{digits:3}};function _E(e){let t=e.theme??{};return{...xr,width:e.width??xr.width,height:e.height??xr.height,background:t.background??xr.background,colors:e.colors??xr.colors,margins:{...xr.margins,...t.margins},frame:{...xr.frame,...t.frame},typography:{...xr.typography,...t.typography},axis:{...xr.axis,...t.axis},line:{...xr.line,...t.line},marker:{...xr.marker,...t.marker},reference:{...xr.reference,...t.reference},legend:{...xr.legend,...t.legend},tip:{...xr.tip,...t.tip}}}function To(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,f)=>`group-${f+1}`):[...e]),n=_E(t);if(!Number.isFinite(n.width)||n.width<=0||!Number.isFinite(n.height)||n.height<=0)throw new Error("Renderer width and height must be positive finite numbers");if(!Number.isInteger(n.tip.digits)||n.tip.digits<0||n.tip.digits>20)throw new Error("Renderer tip digits must be an integer between 0 and 20");let o=r.length<=1?["#000000"]:[...n.colors];if(o.length1;return{theme:{...n,colors:i},groups:r,colors:i,colorByGroup:new Map(r.map((s,f)=>[s,i[f]])),showLegend:a}}function D8(e){if(!e.operatingPoint)return[];let t=e.operatingPoint.dimension,r=t==="probability_threshold"?e.type==="decision_curve"||e.type==="interventions_avoided"?"threshold":"cutoff":"ppcr";if(t==="probability_threshold"){let n=e.series.map(i=>i.id);if(n.length===0)return[];let o=null;for(let i of n){let s=e.data.filter(u=>u.seriesId===i).map(u=>u[r]).filter(u=>typeof u=="number"&&Number.isFinite(u)),f=new Set(s);if(o===null)o=f;else{let u=o;o=new Set(Array.from(u).filter(c=>f.has(c)))}}return Array.from(o??[]).sort((i,a)=>i-a)}else{let n=e.data.map(i=>i[r]).filter(i=>typeof i=="number"&&Number.isFinite(i));return[...new Set(n)].sort((i,a)=>i-a)}}function vE(e,t){let r=e.series.filter(o=>t.has(o.display.group)),n=new Set(r.map(o=>o.id));return{...e,series:r,data:e.data.filter(o=>n.has(o.seriesId))}}function Af(e,t,r,n,o){let i=Gu(e),a=n;if(i.length<=1)return r(e,t,a,g=>{a=g,o&&o(g)});let s={...t,allGroups:i,showLegend:!1},f=To(i,s),{theme:u,colorByGroup:c}=f,m=new Map(e.series.map(g=>[g.display.group,g.display.label])),l=new Set(i),p=document.createElement("div");p.className="rtichoke-legend-chart",p.style.maxWidth=`${u.width}px`;let d=document.createElement("div");d.className="rtichoke-legend",d.style.paddingLeft=`${u.margins.left}px`,d.setAttribute("aria-label","Chart legend");let y=new Map;i.forEach(g=>{let S=document.createElement("button");S.type="button",S.className="rtichoke-legend-item",S.setAttribute("aria-pressed","true");let b=m.get(g)??g;S.setAttribute("aria-label",`Toggle series ${b}`);let T=document.createElement("span");T.className="rtichoke-legend-swatch";let I=document.createElement("span");I.className="rtichoke-legend-line",I.style.backgroundColor=c.get(g)??"#000000",T.append(I);let v=document.createElement("span");v.className="rtichoke-legend-label",v.textContent=b,S.append(T,v),d.append(S),y.set(g,S)});let x=document.createElement("div");x.className="rtichoke-legend-content";let w=()=>{let g=vE(e,l),S=r(g,s,a,b=>{a=b,o&&o(b)});x.replaceChildren(S)};return i.forEach(g=>{let S=y.get(g);S.addEventListener("click",()=>{if(l.has(g)){if(l.size<=1)return;l.delete(g),S.setAttribute("aria-pressed","false")}else l.add(g),S.setAttribute("aria-pressed","true");w()})}),p.append(d,x),w(),p}function Qa(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=D8(e);if(i.length===0)return r(e,void 0);let a=To(Gu(e),t),{theme:s}=a,f=document.createElement("div");f.className="rtichoke-operating-point-chart",f.style.maxWidth=`${s.width}px`;let u=document.createElement("div");u.className="rtichoke-operating-point-control",u.style.marginLeft=`${s.margins.left}px`,u.style.marginRight=`${s.margins.right}px`;let c=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"Predicted positives condition rate (PPCR)",m=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"PPCR",l=document.createElement("label");l.className="rtichoke-operating-point-label";let p=document.createElement("span");p.textContent=`${m}: `;let d=document.createElement("span");d.className="rtichoke-operating-point-value";let y=document.createElement("input");y.type="range",y.className="rtichoke-operating-point-slider",y.min="0",y.max=String(i.length-1),y.step="1",y.setAttribute("aria-label",c);let x=0;if(n!==void 0){let T=i.indexOf(n);T!==-1&&(x=T)}let w=i[x];y.value=String(x);let g=w.toFixed(s.tip.digits);d.textContent=g,y.setAttribute("aria-valuetext",g),o&&o(w),l.append(p,d),u.append(l,y);let S=document.createElement("div");S.className="rtichoke-operating-point-content";let b=T=>{S.replaceChildren(r(e,T))};return y.addEventListener("input",()=>{let T=Number(y.value),I=i[T],v=I.toFixed(s.tip.digits);d.textContent=v,y.setAttribute("aria-valuetext",v),o&&o(I),b(I)}),f.append(S,u),b(w),f}function TE(e){return new Map(e.series.map(t=>[t.id,t.display]))}function Gu(e){return[...new Set(e.series.map(t=>t.display.group))]}function th(e,t){let r=TE(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}function Ji(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` -`)}function rh(e,t){let{theme:r}=e,n=new Map(t.series.map(o=>[o.display.group,o.display.label]));return{width:r.width,height:r.height,marginTop:r.margins.top,marginRight:r.margins.right,marginBottom:r.margins.bottom,marginLeft:r.margins.left,style:{background:r.background,color:r.axis.color,fontFamily:r.typography.fontFamily,fontSize:`${r.typography.fontSize}px`},color:{legend:e.showLegend,domain:e.groups,range:e.colors,tickFormat:o=>n.get(o)??o}}}function Qi(e,t,r){return{label:t,domain:r,grid:!1,line:!0,ticks:e.axis.ticks,tickSize:e.axis.tickSize,tickPadding:e.axis.tickPadding,tickFormat:e.axis.numberFormat}}function Vb(e,t){let r={stroke:t.reference.color,strokeWidth:t.reference.width,strokeDasharray:t.reference.dash},n=[];for(let o of e.references??[])o.type==="identity"?n.push(Ct([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",...r,title:o.label})):o.type==="horizontal"&&o.value!==void 0?n.push(li([o.value],{...r,title:o.label})):o.type==="path"&&o.points&&n.push(Ct(o.points,{x:"x",y:"y",...r,title:o.label}));return n}function nh(e,t){return e}function ME(e,t,r=40){let n=new Map;for(let i of e){let a=t(i),s=n.get(a);s||(s=[],n.set(a,s)),s.push(i)}let o=[];for(let i of n.values()){let a=i.length;if(a<=r)o.push(...i);else{let s=new Set;for(let f=0;fc.seriesId,40),a=n.theme,s=o?.marker?.radius??a.marker.radius,f=o?.marker?.stroke??a.marker.stroke,u=o?.marker?.strokeWidth??a.marker.strokeWidth;return Za(i,{ariaLabel:"ordinary-point",x:t,y:r,fill:"group",stroke:f,strokeWidth:u,r:s,title:c=>c.title,tip:!0})}function kf(e,t,r,n,o){let i=n.groups.length>1,a=o?.marker?.fill??(i?"group":"#f6e3be"),s=o?.marker?.stroke??"#1a1a1a",f=o?.marker?.strokeWidth??2.5,u=o?.marker?.radius??7.5;return Za(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:f,r:u,title:c=>c.title,tip:!0})}function ea(e,t){let r=vo(e);for(let n of r.querySelectorAll('[aria-label$="axis label"] text'))n.style.fontSize=`${t.typography.axisTitleSize}px`,n.style.fontWeight=String(t.typography.axisTitleWeight);for(let n of r.querySelectorAll('[aria-label="frame"]'))n.setAttribute("stroke",t.frame.color);if(r instanceof HTMLElement){r.style.fontSize=`${t.typography.legendSize}px`;for(let n of r.querySelectorAll('svg[width="15"], div[class*="-swatches"] svg'))n.setAttribute("width",String(t.legend.swatchWidth)),n.setAttribute("height","10")}return r}function OE(e,t={},r){Lo(e);let n=To(Gu(e),t),{theme:o}=n,i=e.operatingPoint?.dimension,a=th(e,e.data).map(f=>{let u=1-f.specificity,c=[["Series",f.label]];return i==="ppcr"?(f.ppcr!==void 0&&c.push(["PPCR",f.ppcr]),c.push(["Cutoff",f.cutoff])):(c.push(["Cutoff",f.cutoff]),f.ppcr!==void 0&&c.push(["PPCR",f.ppcr])),c.push(["Sensitivity",f.sensitivity],["Specificity",f.specificity],["False Positive Rate",u]),{...f,false_positive_rate:u,title:Ji(o.tip.digits,c)}}),s=Vb(e,o);if(s.push(Ct(a,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0,title:f=>f.title,tip:!0}),Pf(a,"false_positive_rate","sensitivity",n,t.theme)),r!==void 0&&e.operatingPoint){let f=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",u=a.filter(c=>c[f]===r);u.length>0&&s.push(kf(u,"false_positive_rate","sensitivity",n,t.theme))}return ea({...rh(n,e),x:Qi(o,e.xAxis.label,e.xAxis.domain),y:Qi(o,e.yAxis.label,e.yAxis.domain),marks:nh(s,o)},o)}function Ub(e,t={}){return Af(e,t,(r,n,o,i)=>Nf(r,(a,s,f)=>Qa(a,n,(u,c)=>OE(u,n,c),s,f),o,i))}function jb(e,t={}){Lo(e);let r=To(Gu(e),t),{theme:n}=r,o=th(e,e.data).map(y=>({...y,title:Ji(n.tip.digits,[["Series",y.label],["Predicted",y.predicted],["Observed",y.observed],["Events",y.events],["Total",y.total]])})),i=Vb(e,n);i.push(Ct(o,{x:"predicted",y:"observed",z:"seriesId",stroke:"group",strokeWidth:n.line.width,strokeDasharray:n.line.dash??void 0,title:y=>y.title,tip:!0}));let a=o.filter(y=>y.method==="discrete");a.length>0&&i.push(Za(a,{x:"predicted",y:"observed",fill:n.marker.fill??"group",stroke:n.marker.stroke,strokeWidth:n.marker.strokeWidth,r:n.marker.radius,title:y=>y.title,tip:!0}));let s=(e.distribution?.length??0)>0,f=s?Math.round(n.height*.8):n.height,u=o.map(y=>y.observed).filter(Number.isFinite),c=e.yAxis.domain??[Math.min(0,...u),Math.max(1,...u)],m=ea({...rh(r,e),height:f,marginBottom:s?8:n.margins.bottom,x:s?{...Qi(n,e.xAxis.label,e.xAxis.domain),axis:null,label:null}:Qi(n,e.xAxis.label,e.xAxis.domain),y:Qi(n,e.yAxis.label,c),marks:nh(i,n)},n);if(!s||!e.distribution)return m;let l=th(e,e.distribution).map(y=>({...y,title:Ji(n.tip.digits,[["Series",y.label],["Midpoint",y.midpoint],["Count",y.count]])})),p=ea({...rh(r,e),height:n.height-f,marginTop:0,marginBottom:n.margins.bottom,x:Qi(n,e.xAxis.label,e.xAxis.domain),y:{label:null,grid:!1,ticks:3,tickSize:n.axis.tickSize,tickPadding:n.axis.tickPadding},color:{legend:!1,domain:r.groups,range:r.colors},marks:nh([Vu(l,{x1:y=>y.midpoint-y.binWidth/2,x2:y=>y.midpoint+y.binWidth/2,y:"count",fill:"group",fillOpacity:1/Math.max(r.groups.length,1),title:y=>y.title,tip:!0})],n)},n),d=document.createElement("div");return d.className="rtichoke-calibration",d.style.width=`${n.width}px`,d.style.maxWidth="100%",d.append(m,p),d}function RE(e,t,r,n,o){Lo(e);let i=To(Gu(e),t),{theme:a}=i,s=e.operatingPoint?.dimension,f=th(e,e.data).map(c=>{let m=c,l=[["Series",c.label]];return e.type==="precision_recall"?(s==="ppcr"?(m.ppcr!==void 0&&l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])):(l.push(["Cutoff",m.cutoff]),m.ppcr!==void 0&&l.push(["PPCR",m.ppcr])),l.push(["Sensitivity",m.sensitivity],["PPV",m.ppv])):e.type==="gains"?(s==="probability_threshold"?(l.push(["Cutoff",m.cutoff]),l.push(["PPCR",m.ppcr])):(l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])),l.push(["Sensitivity",m.sensitivity])):e.type==="lift"&&(s==="probability_threshold"?(l.push(["Cutoff",m.cutoff]),l.push(["PPCR",m.ppcr])):(l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])),l.push(["Lift",m.lift])),{...c,title:Ji(a.tip.digits,l)}}),u=Vb(e,a);if(u.push(Ct(f,{x:r,y:n,z:"seriesId",stroke:"group",strokeWidth:a.line.width,strokeDasharray:a.line.dash??void 0,title:c=>c.title,tip:!0}),Pf(f,r,n,i,t.theme)),o!==void 0&&e.operatingPoint){let m=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",l=f.filter(p=>p[m]===o);l.length>0&&u.push(kf(l,r,n,i,t.theme))}return ea({...rh(i,e),x:Qi(a,e.xAxis.label,e.xAxis.domain),y:Qi(a,e.yAxis.label,e.yAxis.domain),marks:nh(u,a)},a)}function CE(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function AE(e,t){let r=e.series.filter(o=>o.horizon===void 0||o.horizon===t),n=new Set(r.map(o=>o.id));return{...e,series:r,data:e.data.filter(o=>n.has(o.seriesId)),references:e.references?.filter(o=>o.scope!=="population_horizon"||o.horizon===t)}}function Nf(e,t,r,n){let o=CE(e);if(o.length<=1)return t(e,r,n);let i=r,a=document.createElement("div");a.className="rtichoke-horizon-chart";let s=document.createElement("label");s.className="rtichoke-horizon-control",s.textContent="Fixed Time Horizon: ";let f=document.createElement("select");f.className="rtichoke-horizon-select",f.setAttribute("aria-label","Fixed Time Horizon");for(let m of o){let l=document.createElement("option");l.value=String(m),l.textContent=String(m),f.append(l)}s.append(f);let u=document.createElement("div"),c=m=>{u.replaceChildren(t(AE(e,m),i,l=>{i=l,n&&n(l)}))};return f.addEventListener("change",()=>c(Number(f.value))),a.append(s,u),c(o[0]),a}function Bb(e,t,r,n){return Af(e,t,(o,i,a,s)=>Nf(o,(f,u,c)=>Qa(f,i,(m,l)=>RE(m,i,r,n,l),u,c),a,s))}function Gb(e,t={}){return Bb(e,t,"sensitivity","ppv")}function zb(e,t={}){return Bb(e,t,"ppcr","sensitivity")}function Kb(e,t={}){return Bb(e,t,"ppcr","lift")}function qb(e,t={}){return Lo(e),Af(e,t,(r,n,o,i)=>Nf(r,(a,s,f)=>Qa(a,n,(u,c)=>PE(u,n,c),s,f),o,i))}function PE(e,t,r){let n=[...new Set(e.series.map(p=>p.display.group))],o=To(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(p=>[p.id,p.display])),s=new Map(e.series.map(p=>[p.display.group,p.display.label])),f=e.data.map(p=>({...p,group:a.get(p.seriesId).group,label:a.get(p.seriesId).label,title:Ji(i.tip.digits,[["Series",a.get(p.seriesId).label],["Threshold",p.threshold],["Net Benefit",p.netBenefit]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},c={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:"4,3"},m=[];for(let p of e.references)p.benchmark==="treat_none"?m.push(li([0],{...u,title:()=>p.label??"Treat None"})):m.push(Ct(p.points,{x:"x",y:"y",...c,title:()=>p.label??`Treat All \u2014 ${p.population}`}));if(m.push(Ct(f,{x:"threshold",y:"netBenefit",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Pf(f,"threshold","netBenefit",o,t.theme)),r!==void 0&&e.operatingPoint){let p=f.filter(d=>d.threshold===r);p.length>0&&m.push(kf(p,"threshold","netBenefit",o,t.theme))}let l=(p,d)=>({label:p,domain:d,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return ea({width:i.width,height:i.height,marginTop:i.margins.top,marginRight:i.margins.right,marginBottom:i.margins.bottom,marginLeft:i.margins.left,style:{background:i.background,color:i.axis.color,fontFamily:i.typography.fontFamily,fontSize:`${i.typography.fontSize}px`},color:{legend:o.showLegend,domain:o.groups,range:o.colors,tickFormat:p=>s.get(p)??p},x:l(e.xAxis.label,e.xAxis.domain),y:l(e.yAxis.label,e.yAxis.domain),marks:m},i)}function Hb(e,t={}){return Lo(e),Af(e,t,(r,n,o,i)=>Nf(r,(a,s,f)=>Qa(a,n,(u,c)=>kE(u,n,c),s,f),o,i))}function kE(e,t,r){let n=[...new Set(e.series.map(p=>p.display.group))],o=To(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(p=>[p.id,p.display])),s=new Map(e.series.map(p=>[p.display.group,p.display.label])),f=e.data.map(p=>({...p,group:a.get(p.seriesId).group,label:a.get(p.seriesId).label,title:Ji(i.tip.digits,[["Series",a.get(p.seriesId).label],["Threshold",p.threshold],["Interventions Avoided",p.interventionsAvoided]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},c={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:"4,3"},m=[];for(let p of e.references)p.benchmark==="treat_all"?m.push(li([0],{...u,title:()=>p.label??"Treat All"})):m.push(Ct(p.points,{x:"x",y:"y",...c,title:()=>p.label??`Treat None \u2014 ${p.population}`}));if(m.push(Ct(f,{x:"threshold",y:"interventionsAvoided",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Pf(f,"threshold","interventionsAvoided",o,t.theme)),r!==void 0&&e.operatingPoint){let p=f.filter(d=>d.threshold===r);p.length>0&&m.push(kf(p,"threshold","interventionsAvoided",o,t.theme))}let l=(p,d)=>({label:p,domain:d,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return ea({width:i.width,height:i.height,marginTop:i.margins.top,marginRight:i.margins.right,marginBottom:i.margins.bottom,marginLeft:i.margins.left,style:{background:i.background,color:i.axis.color,fontFamily:i.typography.fontFamily,fontSize:`${i.typography.fontSize}px`},color:{legend:o.showLegend,domain:o.groups,range:o.colors,tickFormat:p=>s.get(p)??p},x:l(e.xAxis.label,e.xAxis.domain),y:l(e.yAxis.label,e.yAxis.domain),marks:m},i)}var Pr="\u2014",NE=[{id:"sensitivity",defaultLabel:"Sensitivity"},{id:"specificity",defaultLabel:"Specificity"},{id:"ppv",defaultLabel:"PPV"},{id:"npv",defaultLabel:"NPV"},{id:"lift",defaultLabel:"Lift"},{id:"net_benefit",defaultLabel:"Net Benefit"}];function Un(e,t,r){let n=e.createElement("td"),o=e.createElement("span");return o.className="rtichoke-performance-table__cell-text",o.textContent=t,n.append(o),r&&(n.className=r),n}function ut(e,t,r){let n=e.createElement("th");return n.scope=r?.scope??"col",r?.colSpan&&(n.colSpan=r.colSpan),r?.rowSpan&&(n.rowSpan=r.rowSpan),n.textContent=t,r?.className&&(n.className=r.className),r?.ariaLabel&&n.setAttribute("aria-label",r.ariaLabel),n}function FE(e){let t=new Map(e.map(a=>[a.metricId,a.estimate])),r=t.get("true_positives"),n=t.get("true_negatives"),o=t.get("false_positives"),i=t.get("false_negatives");return r==null||isNaN(r)||n===void 0||n===null||isNaN(n)||o===void 0||o===null||isNaN(o)||i===void 0||i===null||isNaN(i)?null:{tp:r,tn:n,fp:o,fn:i}}function ta(e,t,r,n){let o=e.createElement("td");o.className=n;let i=e.createElement("span");i.className="rtichoke-performance-table__confusion-val",i.textContent=oh(t);let a=e.createElement("span");if(a.className="rtichoke-performance-table__confusion-pct",r>0&&!isNaN(t)&&!isNaN(r)){let s=t/r*100;a.textContent=`${s.toFixed(2)}%`}else a.textContent=Pr;return o.append(i,a),o}var EE=0;function V8(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function oh(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function $E(e){return e.toFixed(2)}function LE(e){if(e.length<=1)return 2;let t=2;for(;t<=6;){let r=e.map(o=>o.toFixed(t));if(new Set(r).size===new Set(e).size)return t;t++}return t}function DE(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return Pr;let r=t(e.estimate);if(e.lower===void 0&&e.upper===void 0)return r;let n=e.lower===void 0||e.lower===null||isNaN(e.lower)?Pr:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?Pr:t(e.upper);return`${r} [${n}, ${o}]`}function zu(e,t,r,n=!1,o=!1,i="positive"){if(isNaN(r)||!isFinite(r))return;let a=t.createElement("div");a.className="rtichoke-performance-table__bar";let s=t.createElement("div");if(s.className="rtichoke-performance-table__bar-fill",n){let f=Math.min(Math.max(r,0),50);s.style.width=`${f}%`,o?(s.classList.add("rtichoke-performance-table__bar-fill--negative"),s.style.right="50%",s.style.left="auto"):(s.classList.add("rtichoke-performance-table__bar-fill--positive"),s.style.left="50%",s.style.right="auto")}else{let f=Math.min(Math.max(r,0),100);s.style.width=`${f}%`,i==="neutral"?s.classList.add("rtichoke-performance-table__bar-fill--neutral"):s.classList.add("rtichoke-performance-table__bar-fill--positive")}a.append(s),e.append(a)}function Yb(e,t=globalThis.document){A0(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let B=t.createElement("div");B.className="rtichoke-performance-table__title",B.textContent=e.title,r.append(B)}let n=t.createElement("div");n.className="rtichoke-performance-table__scroll";let o=t.createElement("table");o.className="rtichoke-performance-table__table";let i=new Map(e.evaluations.map(B=>[B.id,B])),a=new Set(e.evaluations.map(B=>B.model).filter(Boolean)),s=new Set(e.evaluations.map(B=>B.population).filter(Boolean)),f=a.size>1,u=s.size>1,c=f,m=u||!f&&a.size===0&&s.size>1,l=e.evaluations.some(B=>B.label?!!(f&&B.label!==B.model||u&&B.label!==B.population||!f&&!u&&B.label!==B.model&&B.label!==B.population):!1),p=e.rows.some(B=>B.horizon!==void 0),d=e.rows.some(B=>B.context?.censoringHeuristic!==void 0),y=e.rows.some(B=>B.context?.competingEventHeuristic!==void 0),x=new Set(e.rows.map(B=>B.operatingPoint.type)),w=x.size===1&&x.has("probability_threshold"),g=x.size===1&&x.has("ppcr"),S=new Set(e.metrics.map(B=>B.id)),b=S.has("predicted_positives"),T=S.has("ppcr"),I=b&&(T||g),v=w||!g&&x.has("probability_threshold"),O=I,C=g&&!I,E=!w&&!g&&!I,A=e.rows.filter(B=>B.operatingPoint.type==="probability_threshold").map(B=>B.operatingPoint.value),F=LE(A),H=NE.map(B=>{let W=e.metrics.find(X=>X.id===B.id);return W?{id:W.id,label:W.label||B.defaultLabel}:null}).filter(B=>B!==null),j=new Set,M=H.filter(B=>j.has(B.label)?!1:(j.add(B.label),!0)),U=0,D=0;for(let B of e.rows)for(let W of B.values)if(W.metricId==="lift"&&W.estimate!==null&&W.estimate!==void 0&&isFinite(W.estimate)&&W.estimate>U&&(U=W.estimate),W.metricId==="net_benefit"&&W.estimate!==null&&W.estimate!==void 0&&isFinite(W.estimate)){let X=Math.abs(W.estimate);X>D&&(D=X)}let oe=++EE,V=t.createElement("thead");V.className="rtichoke-performance-table__header";let K=t.createElement("tr"),Y=t.createElement("tr"),Z=1;if(Y.append(ut(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),c&&(Z++,Y.append(ut(t,"Model"))),m&&(Z++,Y.append(ut(t,"Population"))),l&&(Z++,Y.append(ut(t,"Evaluation"))),v&&(Z++,Y.append(ut(t,"Probability Threshold"))),O&&(Z++,Y.append(ut(t,"Predicted Positives"))),C&&(Z++,Y.append(ut(t,"PPCR"))),E&&(Z++,Y.append(ut(t,"Operating Point"))),p&&(Z++,Y.append(ut(t,"Time Horizon"))),d&&(Z++,Y.append(ut(t,"Censoring"))),y&&(Z++,Y.append(ut(t,"Competing Event"))),M.length>0){let B=ut(t,"",{colSpan:Z,className:"rtichoke-performance-table__spanner--empty"});K.append(B)}if(M.length>0){let B=ut(t,"Performance Metrics",{colSpan:M.length,className:"rtichoke-performance-table__spanner"});K.append(B);for(let W of M)Y.append(ut(t,W.label,{className:"rtichoke-performance-table__metric-header"}))}V.append(K),V.append(Y),o.append(V);let J=Z+M.length,ye=t.createElement("tbody");for(let B=0;B0?"100.00%":Pr,Th.append(Mh,Oh),Uf.append(Th),Wu.append(Uf),qt.append(Wu),xe.append(qt),ae.append(xe),$.append(ae),G.addEventListener("click",()=>{if(!$)return;let di=G.getAttribute("aria-expanded")==="true";G.setAttribute("aria-expanded",di?"false":"true"),G.setAttribute("aria-label",di?"Show confusion matrix detail":"Hide confusion matrix detail"),G.textContent=di?"\u25B8":"\u25BE",$.hidden=di})}le.append(re),c&&le.append(Un(t,X?.model??Pr,"rtichoke-performance-table__model")),m&&le.append(Un(t,X?.population??Pr,"rtichoke-performance-table__population")),l&&le.append(Un(t,X?.label??X?.id??Pr,"rtichoke-performance-table__evaluation"));let ke=new Map(W.values.map(G=>[G.metricId,G]));if(v){let G=W.operatingPoint.type==="probability_threshold"?W.operatingPoint.value:void 0,ae=G!==void 0?G.toFixed(F):Pr;le.append(Un(t,ae,"rtichoke-performance-table__op"))}if(O){let G=ke.get("predicted_positives")?.estimate,ae=ke.get("ppcr")?.estimate??(W.operatingPoint.type==="ppcr"?W.operatingPoint.value:void 0),xe=Pr,Ge=NaN;if(G!=null&&ae!==void 0&&ae!==null){let qt=oh(G),ts=(ae*100).toFixed(2);xe=`${qt} (${ts}%)`,Ge=ae*100}else ae!=null&&(xe=`${(ae*100).toFixed(2)}%`,Ge=ae*100);let Pt=Un(t,xe,"rtichoke-performance-table__op");isNaN(Ge)||zu(Pt,t,Ge,!1,!1,"neutral"),le.append(Pt)}if(C){let G=W.operatingPoint.type==="ppcr"?W.operatingPoint.value:ke.get("ppcr")?.estimate,ae=G!=null?`PPCR ${G.toFixed(2)}`:Pr,xe=Un(t,ae,"rtichoke-performance-table__op");G!=null&&zu(xe,t,G*100,!1,!1,"neutral"),le.append(xe)}if(E){let G=W.operatingPoint.type==="ppcr"?`PPCR ${W.operatingPoint.value.toFixed(2)}`:`Threshold ${W.operatingPoint.value.toFixed(F)}`;le.append(Un(t,G,"rtichoke-performance-table__op"))}if(p&&le.append(Un(t,W.horizon!==void 0?oh(W.horizon):Pr,"rtichoke-performance-table__horizon")),d){let G=W.context?.censoringHeuristic;le.append(Un(t,G?V8(G):Pr,"rtichoke-performance-table__context"))}if(y){let G=W.context?.competingEventHeuristic;le.append(Un(t,G?V8(G):Pr,"rtichoke-performance-table__context"))}for(let G of M){let ae=ke.get(G.id),xe=DE(ae,$E),Ge=Un(t,xe,"rtichoke-performance-table__metric");if(Ge.dataset.metricId=G.id,ae&&ae.estimate!==null&&ae.estimate!==void 0&&isFinite(ae.estimate)){let Pt=ae.estimate;if(["sensitivity","specificity","ppv","npv"].includes(G.id))zu(Ge,t,Pt*100);else if(G.id==="lift"){let qt=U>0?Pt/U*100:0;zu(Ge,t,qt)}else if(G.id==="net_benefit"&&D>0){let qt=Pt<0,ts=Math.abs(Pt)/D*50;zu(Ge,t,ts,!0,qt)}}le.append(Ge)}ye.append(le),$&&ye.append($)}return o.append(ye),n.append(o),r.append(n),r}var VE="\u2014";function Wb(e,t,r){let n=e.createElement("td");return n.textContent=t,r&&(n.className=r),n}function UE(e,t){let r=e.createElement("th");return r.scope="col",r.textContent=t,r}function jE(e){return e===null?VE:e.toFixed(2)}function Xb(e,t=globalThis.document){P0(e);let r=t.createElement("div");if(r.className="rtichoke-summary-metrics",e.title){let p=t.createElement("div");p.className="rtichoke-summary-metrics__title",p.textContent=e.title,r.append(p)}let n=[];for(let p of e.metrics)"horizon"in p&&p.horizon!==void 0&&(n.includes(p.horizon)||n.push(p.horizon));let o=n.length>0?n[0]:void 0,i=[];if(n.length>1){let p=t.createElement("label");p.className="rtichoke-horizon-control",p.textContent="Fixed Time Horizon: ";let d=t.createElement("select");d.className="rtichoke-horizon-select",d.setAttribute("aria-label","Fixed Time Horizon");for(let y of n){let x=t.createElement("option");x.value=String(y),x.textContent=String(y),d.append(x)}d.value=String(o),d.addEventListener("change",()=>{o=Number(d.value),l()}),p.append(d),r.append(p)}let a=t.createElement("table");a.className="rtichoke-summary-metrics__table";let s=t.createElement("thead"),f=t.createElement("tr");for(let p of["Owner","Metric","Estimate"])f.append(UE(t,p));s.append(f),a.append(s);let u=new Map(e.evaluations.map(p=>[p.id,p])),c=new Map(e.populations.map(p=>[p.id,p])),m=t.createElement("tbody");for(let p of e.metrics){let d=t.createElement("tr"),y="",x="",w;if(p.metric==="auroc"){let S=u.get(p.owner.evaluationId);y=S.label??S.model??S.population??S.id,x="AUROC",d.dataset.metric="auroc",d.dataset.evaluationId=p.owner.evaluationId}else p.metric==="prevalence"?(y=c.get(p.owner.populationId).label,x="Prevalence",d.dataset.metric="prevalence",d.dataset.populationId=p.owner.populationId):p.metric==="event_risk"&&(y=c.get(p.owner.populationId).label,x="Event Risk",w=p.horizon,d.dataset.metric="event_risk",d.dataset.populationId=p.owner.populationId,d.dataset.horizon=String(p.horizon));d.append(Wb(t,y,"rtichoke-summary-metrics__owner"),Wb(t,x,"rtichoke-summary-metrics__metric"));let g=Wb(t,jE(p.estimate),"rtichoke-summary-metrics__estimate");p.estimate===null?g.dataset.unavailable="true":g.dataset.estimate=String(p.estimate),d.append(g),i.push({element:d,horizon:w}),m.append(d)}a.append(m),r.append(a);function l(){for(let{element:p,horizon:d}of i)d===void 0||d===o?p.style.display="":p.style.display="none"}return l(),r}function BE(e){switch(e.errorType){case R.ArrayContains:return"Expected array to contain at least one matching value";case R.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case R.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case R.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case R.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case R.ArrayUniqueItems:return"Expected array elements to be unique";case R.Array:return"Expected array";case R.AsyncIterator:return"Expected AsyncIterator";case R.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case R.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case R.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case R.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case R.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case R.BigInt:return"Expected bigint";case R.Boolean:return"Expected boolean";case R.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case R.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case R.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case R.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case R.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case R.Date:return"Expected Date";case R.Function:return"Expected function";case R.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case R.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case R.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case R.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case R.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case R.Integer:return"Expected integer";case R.IntersectUnevaluatedProperties:return"Unexpected property";case R.Intersect:return"Expected all values to match";case R.Iterator:return"Expected Iterator";case R.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case R.Never:return"Never";case R.Not:return"Value should not match";case R.Null:return"Expected null";case R.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case R.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case R.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case R.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case R.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case R.Number:return"Expected number";case R.Object:return"Expected object";case R.ObjectAdditionalProperties:return"Unexpected property";case R.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case R.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case R.ObjectRequiredProperty:return"Expected required property";case R.Promise:return"Expected Promise";case R.RegExp:return"Expected string to match regular expression";case R.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case R.StringFormat:return`Expected string to match '${e.schema.format}' format`;case R.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case R.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case R.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case R.String:return"Expected string";case R.Symbol:return"Expected symbol";case R.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case R.Tuple:return"Expected tuple";case R.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case R.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case R.Uint8Array:return"Expected Uint8Array";case R.Undefined:return"Expected undefined";case R.Union:return"Expected union value";case R.Void:return"Expected void";case R.Kind:return`Expected kind '${e.schema[k]}'`;default:return"Unknown error type"}}var GE=BE;function U8(){return GE}var Zb=class extends ce{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function zE(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new Zb(e);return Pe(r,t)}function Gt(e,t){return!Ee(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function Pe(e,t){return e[k]==="This"||e[k]==="Ref"?zE(e,t):e}var Qb=class extends ce{constructor(t){super("Unable to hash value"),this.value=t}},Kr;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(Kr||(Kr={}));var Ff=BigInt("14695981039346656037"),[KE,qE]=[BigInt("1099511628211"),BigInt("18446744073709551616")],HE=Array.from({length:256}).map((e,t)=>BigInt(t)),j8=new Float64Array(1),B8=new DataView(j8.buffer),G8=new Uint8Array(j8.buffer);function*YE(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r>8*(t-1-r)&255}function WE(e){cr(Kr.Array);for(let t of e)Ef(t)}function XE(e){cr(Kr.Boolean),cr(e?1:0)}function ZE(e){cr(Kr.BigInt),B8.setBigInt64(0,e);for(let t of G8)cr(t)}function QE(e){cr(Kr.Date),Ef(e.getTime())}function JE(e){cr(Kr.Null)}function e$(e){cr(Kr.Number),B8.setFloat64(0,e);for(let t of G8)cr(t)}function t$(e){cr(Kr.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())Ef(t),Ef(e[t])}function r$(e){cr(Kr.String);for(let t=0;t=e.minItems)||we(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!zt(e.items,t,i))return!1;if(e.uniqueItems===!0&&!(function(){let i=new Set;for(let a of r){let s=$f(a);if(i.has(s))return!1;i.add(s)}return!0})())return!1;if(!(we(e.contains)||Qe(e.minContains)||Qe(e.maxContains)))return!0;let n=we(e.contains)?e.contains:ge(),o=r.reduce((i,a)=>zt(n,t,a)?i+1:i,0);return!(o===0||Qe(e.minContains)&&oe.maxContains)}function u$(e,t,r){return Qu(r)}function l$(e,t,r){return!(!xn(r)||we(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||we(e.maximum)&&!(r<=e.maximum)||we(e.minimum)&&!(r>=e.minimum)||we(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function p$(e,t,r){return Yn(r)}function m$(e,t,r){return zt(e.returns,t,r.prototype)}function d$(e,t,r){return!(!ur(r)||we(e.exclusiveMaximumTimestamp)&&!(r.getTime()e.exclusiveMinimumTimestamp)||we(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||we(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||we(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function h$(e,t,r){return hi(r)}function y$(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return zt(o,[...t,...n],r)}function x$(e,t,r){return!(!tl(r)||we(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||we(e.maximum)&&!(r<=e.maximum)||we(e.minimum)&&!(r>=e.minimum)||we(e.multipleOf)&&r%e.multipleOf!==0)}function g$(e,t,r){let n=e.allOf.every(o=>zt(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(ys(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a));return n&&i}else if(rt(e.unevaluatedProperties)){let o=new RegExp(ys(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||zt(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function b$(e,t,r){return Ju(r)}function w$(e,t,r){return r===e.const}function S$(e,t,r){return!1}function I$(e,t,r){return!zt(e.not,t,r)}function _$(e,t,r){return Co(r)}function v$(e,t,r){return!(!It.IsNumberLike(r)||we(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||we(e.minimum)&&!(r>=e.minimum)||we(e.maximum)&&!(r<=e.maximum)||we(e.multipleOf)&&r%e.multipleOf!==0)}function T$(e,t,r){if(!It.IsObjectLike(r)||we(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||we(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let n=Object.getOwnPropertyNames(e.properties);for(let o of n){let i=e.properties[o];if(e.required&&e.required.includes(o)){if(!zt(i,t,r[o])||(ma(i)||a$(i))&&!(o in r))return!1}else if(It.IsExactOptionalProperty(r,o)&&!zt(i,t,r[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(r);return e.required&&e.required.length===n.length&&o.length===n.length?!0:o.every(i=>n.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(r).every(i=>n.includes(i)||zt(e.additionalProperties,t,r[i])):!0}function M$(e,t,r){return el(r)}function O$(e,t,r){if(!It.IsRecordLike(r)||we(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||we(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),a=Object.entries(r).every(([u,c])=>i.test(u)?zt(o,t,c):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([u,c])=>i.test(u)?!0:zt(e.additionalProperties,t,c)):!0,f=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(u=>i.test(u)):!0;return a&&s&&f}function R$(e,t,r){return zt(Pe(e,t),t,r)}function C$(e,t,r){let n=new RegExp(e.source,e.flags);return we(e.minLength)&&!(r.length>=e.minLength)||we(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function A$(e,t,r){return!Ee(r)||we(e.minLength)&&!(r.length>=e.minLength)||we(e.maxLength)&&!(r.length<=e.maxLength)||we(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:we(e.format)?wi.Has(e.format)?wi.Get(e.format)(r):!1:!0}function P$(e,t,r){return Ao(r)}function k$(e,t,r){return Ee(r)&&new RegExp(e.pattern).test(r)}function N$(e,t,r){return zt(Pe(e,t),t,r)}function F$(e,t,r){if(!fe(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;nzt(n,t,r))}function L$(e,t,r){return!(!ns(r)||we(e.maxByteLength)&&!(r.length<=e.maxByteLength)||we(e.minByteLength)&&!(r.length>=e.minByteLength))}function D$(e,t,r){return!0}function V$(e,t,r){return It.IsVoidLike(r)}function U$(e,t,r){return Tn.Has(e[k])?Tn.Get(e[k])(e,r):!1}function zt(e,t,r){let n=we(e.$id)?Gt(e,t):t,o=e;switch(o[k]){case"Any":return s$(o,n,r);case"Argument":return f$(o,n,r);case"Array":return c$(o,n,r);case"AsyncIterator":return u$(o,n,r);case"BigInt":return l$(o,n,r);case"Boolean":return p$(o,n,r);case"Constructor":return m$(o,n,r);case"Date":return d$(o,n,r);case"Function":return h$(o,n,r);case"Import":return y$(o,n,r);case"Integer":return x$(o,n,r);case"Intersect":return g$(o,n,r);case"Iterator":return b$(o,n,r);case"Literal":return w$(o,n,r);case"Never":return S$(o,n,r);case"Not":return I$(o,n,r);case"Null":return _$(o,n,r);case"Number":return v$(o,n,r);case"Object":return T$(o,n,r);case"Promise":return M$(o,n,r);case"Record":return O$(o,n,r);case"Ref":return R$(o,n,r);case"RegExp":return C$(o,n,r);case"String":return A$(o,n,r);case"Symbol":return P$(o,n,r);case"TemplateLiteral":return k$(o,n,r);case"This":return N$(o,n,r);case"Tuple":return F$(o,n,r);case"Undefined":return E$(o,n,r);case"Union":return $$(o,n,r);case"Uint8Array":return L$(o,n,r);case"Unknown":return D$(o,n,r);case"Void":return V$(o,n,r);default:if(!Tn.Has(o[k]))throw new Jb(o);return U$(o,n,r)}}function he(...e){return e.length===3?zt(e[0],e[1],e[2]):zt(e[0],[],e[1])}var R;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(R||(R={}));var e1=class extends ce{constructor(t){super("Unknown type"),this.schema=t}};function pi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Se(e){return e!==void 0}var ra=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function q(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:U8()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*j$(e,t,r,n){}function*B$(e,t,r,n){}function*G$(e,t,r,n){if(!fe(n))return yield q(R.Array,e,r,n);Se(e.minItems)&&!(n.length>=e.minItems)&&(yield q(R.ArrayMinItems,e,r,n)),Se(e.maxItems)&&!(n.length<=e.maxItems)&&(yield q(R.ArrayMaxItems,e,r,n));for(let a=0;aKt(o,t,`${r}${f}`,s).next().done===!0?a+1:a,0);i===0&&(yield q(R.ArrayContains,e,r,n)),Qe(e.minContains)&&ie.maxContains&&(yield q(R.ArrayMaxContains,e,r,n))}function*z$(e,t,r,n){Qu(n)||(yield q(R.AsyncIterator,e,r,n))}function*K$(e,t,r,n){if(!xn(n))return yield q(R.BigInt,e,r,n);Se(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield q(R.BigIntExclusiveMinimum,e,r,n)),Se(e.maximum)&&!(n<=e.maximum)&&(yield q(R.BigIntMaximum,e,r,n)),Se(e.minimum)&&!(n>=e.minimum)&&(yield q(R.BigIntMinimum,e,r,n)),Se(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield q(R.BigIntMultipleOf,e,r,n))}function*q$(e,t,r,n){Yn(n)||(yield q(R.Boolean,e,r,n))}function*H$(e,t,r,n){yield*Kt(e.returns,t,r,n.prototype)}function*Y$(e,t,r,n){if(!ur(n))return yield q(R.Date,e,r,n);Se(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield q(R.DateExclusiveMinimumTimestamp,e,r,n)),Se(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield q(R.DateMaximumTimestamp,e,r,n)),Se(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield q(R.DateMinimumTimestamp,e,r,n)),Se(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield q(R.DateMultipleOfTimestamp,e,r,n))}function*W$(e,t,r,n){hi(n)||(yield q(R.Function,e,r,n))}function*X$(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*Kt(i,[...t,...o],r,n)}function*Z$(e,t,r,n){if(!tl(n))return yield q(R.Integer,e,r,n);Se(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield q(R.IntegerExclusiveMinimum,e,r,n)),Se(e.maximum)&&!(n<=e.maximum)&&(yield q(R.IntegerMaximum,e,r,n)),Se(e.minimum)&&!(n>=e.minimum)&&(yield q(R.IntegerMinimum,e,r,n)),Se(e.multipleOf)&&n%e.multipleOf!==0&&(yield q(R.IntegerMultipleOf,e,r,n))}function*Q$(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of Kt(i,t,r,n))o=!0,yield a;if(o)return yield q(R.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(ys(e));for(let a of Object.getOwnPropertyNames(n))i.test(a)||(yield q(R.IntersectUnevaluatedProperties,e,`${r}/${a}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(ys(e));for(let a of Object.getOwnPropertyNames(n))if(!i.test(a)){let s=Kt(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*J$(e,t,r,n){Ju(n)||(yield q(R.Iterator,e,r,n))}function*eL(e,t,r,n){n!==e.const&&(yield q(R.Literal,e,r,n))}function*tL(e,t,r,n){yield q(R.Never,e,r,n)}function*rL(e,t,r,n){Kt(e.not,t,r,n).next().done===!0&&(yield q(R.Not,e,r,n))}function*nL(e,t,r,n){Co(n)||(yield q(R.Null,e,r,n))}function*oL(e,t,r,n){if(!It.IsNumberLike(n))return yield q(R.Number,e,r,n);Se(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield q(R.NumberExclusiveMinimum,e,r,n)),Se(e.maximum)&&!(n<=e.maximum)&&(yield q(R.NumberMaximum,e,r,n)),Se(e.minimum)&&!(n>=e.minimum)&&(yield q(R.NumberMinimum,e,r,n)),Se(e.multipleOf)&&n%e.multipleOf!==0&&(yield q(R.NumberMultipleOf,e,r,n))}function*iL(e,t,r,n){if(!It.IsObjectLike(n))return yield q(R.Object,e,r,n);Se(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield q(R.ObjectMinProperties,e,r,n)),Se(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield q(R.ObjectMaxProperties,e,r,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(n);for(let s of o)a.includes(s)||(yield q(R.ObjectRequiredProperty,e.properties[s],`${r}/${pi(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield q(R.ObjectAdditionalProperties,e,`${r}/${pi(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*Kt(e.additionalProperties,t,`${r}/${pi(s)}`,n[s]));for(let s of i){let f=e.properties[s];e.required&&e.required.includes(s)?(yield*Kt(f,t,`${r}/${pi(s)}`,n[s]),ma(e)&&!(s in n)&&(yield q(R.ObjectRequiredProperty,f,`${r}/${pi(s)}`,void 0))):It.IsExactOptionalProperty(n,s)&&(yield*Kt(f,t,`${r}/${pi(s)}`,n[s]))}}function*aL(e,t,r,n){el(n)||(yield q(R.Promise,e,r,n))}function*sL(e,t,r,n){if(!It.IsRecordLike(n))return yield q(R.Object,e,r,n);Se(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield q(R.ObjectMinProperties,e,r,n)),Se(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield q(R.ObjectMaxProperties,e,r,n));let[o,i]=Object.entries(e.patternProperties)[0],a=new RegExp(o);for(let[s,f]of Object.entries(n))a.test(s)&&(yield*Kt(i,t,`${r}/${pi(s)}`,f));if(typeof e.additionalProperties=="object")for(let[s,f]of Object.entries(n))a.test(s)||(yield*Kt(e.additionalProperties,t,`${r}/${pi(s)}`,f));if(e.additionalProperties===!1){for(let[s,f]of Object.entries(n))if(!a.test(s))return yield q(R.ObjectAdditionalProperties,e,`${r}/${pi(s)}`,f)}}function*fL(e,t,r,n){yield*Kt(Pe(e,t),t,r,n)}function*cL(e,t,r,n){if(!Ee(n))return yield q(R.String,e,r,n);if(Se(e.minLength)&&!(n.length>=e.minLength)&&(yield q(R.StringMinLength,e,r,n)),Se(e.maxLength)&&!(n.length<=e.maxLength)&&(yield q(R.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield q(R.RegExp,e,r,n)}function*uL(e,t,r,n){if(!Ee(n))return yield q(R.String,e,r,n);Se(e.minLength)&&!(n.length>=e.minLength)&&(yield q(R.StringMinLength,e,r,n)),Se(e.maxLength)&&!(n.length<=e.maxLength)&&(yield q(R.StringMaxLength,e,r,n)),Ee(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield q(R.StringPattern,e,r,n))),Ee(e.format)&&(wi.Has(e.format)?wi.Get(e.format)(n)||(yield q(R.StringFormat,e,r,n)):yield q(R.StringFormatUnknown,e,r,n))}function*lL(e,t,r,n){Ao(n)||(yield q(R.Symbol,e,r,n))}function*pL(e,t,r,n){if(!Ee(n))return yield q(R.String,e,r,n);new RegExp(e.pattern).test(n)||(yield q(R.StringPattern,e,r,n))}function*mL(e,t,r,n){yield*Kt(Pe(e,t),t,r,n)}function*dL(e,t,r,n){if(!fe(n))return yield q(R.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield q(R.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield q(R.TupleLength,e,r,n);if(e.items)for(let o=0;onew ra(Kt(i,t,r,n)));yield q(R.Union,e,r,n,o)}function*xL(e,t,r,n){if(!ns(n))return yield q(R.Uint8Array,e,r,n);Se(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield q(R.Uint8ArrayMaxByteLength,e,r,n)),Se(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield q(R.Uint8ArrayMinByteLength,e,r,n))}function*gL(e,t,r,n){}function*bL(e,t,r,n){It.IsVoidLike(n)||(yield q(R.Void,e,r,n))}function*wL(e,t,r,n){Tn.Get(e[k])(e,n)||(yield q(R.Kind,e,r,n))}function*Kt(e,t,r,n){let o=Se(e.$id)?[...t,e]:t,i=e;switch(i[k]){case"Any":return yield*j$(i,o,r,n);case"Argument":return yield*B$(i,o,r,n);case"Array":return yield*G$(i,o,r,n);case"AsyncIterator":return yield*z$(i,o,r,n);case"BigInt":return yield*K$(i,o,r,n);case"Boolean":return yield*q$(i,o,r,n);case"Constructor":return yield*H$(i,o,r,n);case"Date":return yield*Y$(i,o,r,n);case"Function":return yield*W$(i,o,r,n);case"Import":return yield*X$(i,o,r,n);case"Integer":return yield*Z$(i,o,r,n);case"Intersect":return yield*Q$(i,o,r,n);case"Iterator":return yield*J$(i,o,r,n);case"Literal":return yield*eL(i,o,r,n);case"Never":return yield*tL(i,o,r,n);case"Not":return yield*rL(i,o,r,n);case"Null":return yield*nL(i,o,r,n);case"Number":return yield*oL(i,o,r,n);case"Object":return yield*iL(i,o,r,n);case"Promise":return yield*aL(i,o,r,n);case"Record":return yield*sL(i,o,r,n);case"Ref":return yield*fL(i,o,r,n);case"RegExp":return yield*cL(i,o,r,n);case"String":return yield*uL(i,o,r,n);case"Symbol":return yield*lL(i,o,r,n);case"TemplateLiteral":return yield*pL(i,o,r,n);case"This":return yield*mL(i,o,r,n);case"Tuple":return yield*dL(i,o,r,n);case"Undefined":return yield*hL(i,o,r,n);case"Union":return yield*yL(i,o,r,n);case"Uint8Array":return yield*xL(i,o,r,n);case"Unknown":return yield*gL(i,o,r,n);case"Void":return yield*bL(i,o,r,n);default:if(!Tn.Has(i[k]))throw new e1(e);return yield*wL(i,o,r,n)}}function na(...e){let t=e.length===3?Kt(e[0],e[1],"",e[2]):Kt(e[0],[],"",e[1]);return new ra(t)}var SL=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},K8=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},t1,ih,q8,r1=class extends ce{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),t1.add(this),ih.set(this,void 0),SL(this,ih,t,"f"),this.error=r}Errors(){return new ra(K8(this,t1,"m",q8).call(this))}};ih=new WeakMap,t1=new WeakSet,q8=function*(){this.error&&(yield this.error),yield*K8(this,ih,"f")};function z8(e,t,r){if(!he(e,t,r))throw new r1(na(e,t,r))}function ah(...e){return e.length===3?z8(e[0],e[1],e[2]):z8(e[0],[],e[1])}function IL(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Me(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Me(e[r]);return t}function _L(e){return e.map(t=>Me(t))}function vL(e){return e.slice()}function TL(e){return new Map(Me([...e.entries()]))}function ML(e){return new Set(Me([...e.entries()]))}function OL(e){return new Date(e.toISOString())}function Me(e){if(fe(e))return _L(e);if(ur(e))return OL(e);if(Yr(e))return vL(e);if(p1(e))return TL(e);if(m1(e))return ML(e);if(me(e))return IL(e);if(Fr(e))return e;throw new Error("ValueClone: Unable to clone value")}var qr=class extends ce{constructor(t,r){super(r),this.schema=t}};function Oe(e){return hi(e)?e():Me(e)}function RL(e,t){return se(e,"default")?Oe(e.default):{}}function CL(e,t){return{}}function AL(e,t){if(e.uniqueItems===!0&&!se(e,"default"))throw new qr(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!se(e,"default"))throw new qr(e,"Array with the contains constraint requires a default value");return"default"in e?Oe(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>Hr(e.items,t)):[]}function PL(e,t){return se(e,"default")?Oe(e.default):(async function*(){})()}function kL(e,t){return se(e,"default")?Oe(e.default):BigInt(0)}function NL(e,t){return se(e,"default")?Oe(e.default):!1}function FL(e,t){if(se(e,"default"))return Oe(e.default);{let r=Hr(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,o]of Object.entries(r)){let i=this;i[n]=o}}}:class{}}}function EL(e,t){return se(e,"default")?Oe(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function $L(e,t){return se(e,"default")?Oe(e.default):()=>Hr(e.returns,t)}function LL(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return Hr(n,[...t,...r])}function DL(e,t){return se(e,"default")?Oe(e.default):e.minimum!==void 0?e.minimum:0}function VL(e,t){if(se(e,"default"))return Oe(e.default);{let r=e.allOf.reduce((n,o)=>{let i=Hr(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!he(e,t,r))throw new qr(e,"Intersect produced invalid value. Consider using a default value.");return r}}function UL(e,t){return se(e,"default")?Oe(e.default):(function*(){})()}function jL(e,t){return se(e,"default")?Oe(e.default):e.const}function BL(e,t){if(se(e,"default"))return Oe(e.default);throw new qr(e,"Never types cannot be created. Consider using a default value.")}function GL(e,t){if(se(e,"default"))return Oe(e.default);throw new qr(e,"Not types must have a default value")}function zL(e,t){return se(e,"default")?Oe(e.default):null}function KL(e,t){return se(e,"default")?Oe(e.default):e.minimum!==void 0?e.minimum:0}function qL(e,t){if(se(e,"default"))return Oe(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=Hr(i,t));return n}}function HL(e,t){return se(e,"default")?Oe(e.default):Promise.resolve(Hr(e.item,t))}function YL(e,t){return se(e,"default")?Oe(e.default):{}}function WL(e,t){return se(e,"default")?Oe(e.default):Hr(Pe(e,t),t)}function XL(e,t){if(se(e,"default"))return Oe(e.default);throw new qr(e,"RegExp types cannot be created. Consider using a default value.")}function ZL(e,t){if(e.pattern!==void 0){if(se(e,"default"))return Oe(e.default);throw new qr(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(se(e,"default"))return Oe(e.default);throw new qr(e,"String types with formats must specify a default value")}else return se(e,"default")?Oe(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function QL(e,t){return se(e,"default")?Oe(e.default):"value"in e?Symbol.for(e.value):Symbol()}function JL(e,t){if(se(e,"default"))return Oe(e.default);if(!il(e))throw new qr(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return ps(e)[0]}function eD(e,t){if(H8++>fD)throw new qr(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return se(e,"default")?Oe(e.default):Hr(Pe(e,t),t)}function tD(e,t){return se(e,"default")?Oe(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>Hr(e.items[n],t))}function rD(e,t){if(se(e,"default"))return Oe(e.default)}function nD(e,t){if(se(e,"default"))return Oe(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return Hr(e.anyOf[0],t)}function oD(e,t){return se(e,"default")?Oe(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function iD(e,t){return se(e,"default")?Oe(e.default):{}}function aD(e,t){if(se(e,"default"))return Oe(e.default)}function sD(e,t){if(se(e,"default"))return Oe(e.default);throw new Error("User defined types must specify a default value")}function Hr(e,t){let r=Gt(e,t),n=e;switch(n[k]){case"Any":return RL(n,r);case"Argument":return CL(n,r);case"Array":return AL(n,r);case"AsyncIterator":return PL(n,r);case"BigInt":return kL(n,r);case"Boolean":return NL(n,r);case"Constructor":return FL(n,r);case"Date":return EL(n,r);case"Function":return $L(n,r);case"Import":return LL(n,r);case"Integer":return DL(n,r);case"Intersect":return VL(n,r);case"Iterator":return UL(n,r);case"Literal":return jL(n,r);case"Never":return BL(n,r);case"Not":return GL(n,r);case"Null":return zL(n,r);case"Number":return KL(n,r);case"Object":return qL(n,r);case"Promise":return HL(n,r);case"Record":return YL(n,r);case"Ref":return WL(n,r);case"RegExp":return XL(n,r);case"String":return ZL(n,r);case"Symbol":return QL(n,r);case"TemplateLiteral":return JL(n,r);case"This":return eD(n,r);case"Tuple":return tD(n,r);case"Undefined":return rD(n,r);case"Union":return nD(n,r);case"Uint8Array":return oD(n,r);case"Unknown":return iD(n,r);case"Void":return aD(n,r);default:if(!Tn.Has(n[k]))throw new qr(n,"Unknown type");return sD(n,r)}}var fD=512,H8=0;function jn(...e){return H8=0,e.length===2?Hr(e[0],e[1]):Hr(e[0],[])}var sh=class extends ce{constructor(t,r){super(r),this.schema=t}};function Y8(e,t,r){if(e[k]==="Object"&&typeof r=="object"&&!Co(r)){let n=e,o=Object.getOwnPropertyNames(r);return Object.entries(n.properties).reduce((a,[s,f])=>{let u=f[k]==="Literal"&&f.const===r[s]?100:0,c=he(f,t,r[s])?10:0,m=o.includes(s)?1:0;return a+(u+c+m)},0)}else if(e[k]==="Union"){let o=e.anyOf.map(i=>Pe(i,t)).map(i=>Y8(i,t,r));return Math.max(...o)}else return he(e,t,r)?1:0}function cD(e,t,r){let n=e.anyOf.map(a=>Pe(a,t)),[o,i]=[n[0],0];for(let a of n){let s=Y8(a,t,r);s>i&&(o=a,i=s)}return o}function uD(e,t,r){if("default"in e)return typeof r=="function"?e.default:Me(e.default);{let n=cD(e,t,r);return Ku(n,t,r)}}function lD(e,t,r){return he(e,t,r)?Me(r):jn(e,t)}function pD(e,t,r){return he(e,t,r)?r:jn(e,t)}function mD(e,t,r){if(he(e,t,r))return Me(r);let n=fe(r)?Me(r):jn(e,t),o=Qe(e.minItems)&&n.lengthnull)]:n,a=(Qe(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(f=>Bn(e.items,t,f));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!he(e,t,s))throw new sh(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function dD(e,t,r){if(he(e,t,r))return jn(e,t);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,a]of Object.entries(e.returns.properties))!n.has(i)&&r.prototype[i]===void 0||(o.prototype[i]=Bn(a,t,r.prototype[i]));return o}function hD(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Bn(o,[...t,...n],r)}function W8(e,t){return me(e)&&!me(t)||!me(e)&&me(t)?e:!me(e)||!me(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?W8(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function yD(e,t,r){if(he(e,t,r))return r;let n=jn(e,t),o=W8(n,r);return he(e,t,o)?o:n}function xD(e,t,r){throw new sh(e,"Never types cannot be cast")}function gD(e,t,r){if(he(e,t,r))return r;if(r===null||typeof r!="object")return jn(e,t);let n=new Set(e.required||[]),o={};for(let[i,a]of Object.entries(e.properties))!n.has(i)&&r[i]===void 0||(o[i]=Bn(a,t,r[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(r))i.includes(a)||(o[a]=Bn(e.additionalProperties,t,r[a]))}return o}function bD(e,t,r){if(he(e,t,r))return Me(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return jn(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=Bn(o,t,s);return i}function wD(e,t,r){return Bn(Pe(e,t),t,r)}function SD(e,t,r){return Bn(Pe(e,t),t,r)}function ID(e,t,r){return he(e,t,r)?Me(r):fe(r)?e.items===void 0?[]:e.items.map((n,o)=>Bn(n,t,r[o])):jn(e,t)}function _D(e,t,r){return he(e,t,r)?Me(r):uD(e,t,r)}function Bn(e,t,r){let n=Ee(e.$id)?Gt(e,t):t,o=e;switch(e[k]){case"Array":return mD(o,n,r);case"Constructor":return dD(o,n,r);case"Import":return hD(o,n,r);case"Intersect":return yD(o,n,r);case"Never":return xD(o,n,r);case"Object":return gD(o,n,r);case"Record":return bD(o,n,r);case"Ref":return wD(o,n,r);case"This":return SD(o,n,r);case"Tuple":return ID(o,n,r);case"Union":return _D(o,n,r);case"Date":case"Symbol":case"Uint8Array":return lD(e,t,r);default:return pD(o,n,r)}}function Ku(...e){return e.length===3?Bn(e[0],e[1],e[2]):Bn(e[0],[],e[1])}function vD(e){return xi(e)&&e[k]!=="Unsafe"}function TD(e,t,r){return fe(r)?r.map(n=>kr(e.items,t,n)):r}function MD(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return kr(o,[...t,...n],r)}function OD(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>kr(s,t,Me(r))).reduce((s,f)=>me(f)?{...s,...f}:f,{});if(!me(r)||!me(i)||!xi(n))return i;let a=Ir(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||he(n,t,r[s])&&(i[s]=kr(n,t,r[s]));return i}function RD(e,t,r){if(!me(r)||fe(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(se(e.properties,o)){r[o]=kr(e.properties[o],t,r[o]);continue}if(xi(n)&&he(n,t,r[o])){r[o]=kr(n,t,r[o]);continue}delete r[o]}return r}function CD(e,t,r){if(!me(r))return r;let n=e.additionalProperties,o=Object.getOwnPropertyNames(r),[i,a]=Object.entries(e.patternProperties)[0],s=new RegExp(i);for(let f of o){if(s.test(f)){r[f]=kr(a,t,r[f]);continue}if(xi(n)&&he(n,t,r[f])){r[f]=kr(n,t,r[f]);continue}delete r[f]}return r}function AD(e,t,r){return kr(Pe(e,t),t,r)}function PD(e,t,r){return kr(Pe(e,t),t,r)}function kD(e,t,r){if(!fe(r))return r;if(Ze(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function ND(e,t,r){for(let n of e.anyOf)if(vD(n)&&he(n,t,r))return kr(n,t,r);return r}function kr(e,t,r){let n=Ee(e.$id)?Gt(e,t):t,o=e;switch(o[k]){case"Array":return TD(o,n,r);case"Import":return MD(o,n,r);case"Intersect":return OD(o,n,r);case"Object":return RD(o,n,r);case"Record":return CD(o,n,r);case"Ref":return AD(o,n,r);case"This":return PD(o,n,r);case"Tuple":return kD(o,n,r);case"Union":return ND(o,n,r);default:return r}}function fh(...e){return e.length===3?kr(e[0],e[1],e[2]):kr(e[0],[],e[1])}function ch(e){return Ee(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function FD(e){return xn(e)||Yn(e)||Qe(e)}function qu(e){return e===!0||Qe(e)&&e===1||xn(e)&&e===BigInt("1")||Ee(e)&&(e.toLowerCase()==="true"||e==="1")}function Hu(e){return e===!1||Qe(e)&&(e===0||Object.is(e,-0))||xn(e)&&e===BigInt("0")||Ee(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function ED(e){return Ee(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function $D(e){return Ee(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function LD(e){return Ee(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function DD(e){return Ee(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function VD(e){return Ee(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function UD(e,t){let r=Z8(e);return r===t?r:e}function jD(e,t){let r=Q8(e);return r===t?r:e}function BD(e,t){let r=X8(e);return r===t?r:e}function GD(e,t){return Ee(e.const)?UD(t,e.const):Qe(e.const)?jD(t,e.const):Yn(e.const)?BD(t,e.const):t}function X8(e){return qu(e)?!0:Hu(e)?!1:e}function zD(e){let t=r=>r.split(".")[0];return ch(e)?BigInt(t(e)):Qe(e)?BigInt(Math.trunc(e)):Hu(e)?BigInt(0):qu(e)?BigInt(1):e}function Z8(e){return Ao(e)&&e.description!==void 0?e.description.toString():FD(e)?e.toString():e}function Q8(e){return ch(e)?parseFloat(e):qu(e)?1:Hu(e)?0:e}function KD(e){return ch(e)?parseInt(e):Qe(e)?Math.trunc(e):qu(e)?1:Hu(e)?0:e}function qD(e){return Ee(e)&&e.toLowerCase()==="null"?null:e}function HD(e){return Ee(e)&&e==="undefined"?void 0:e}function YD(e){return ur(e)?e:Qe(e)?new Date(e):qu(e)?new Date(1):Hu(e)?new Date(0):ch(e)?new Date(parseInt(e)):$D(e)?new Date(`1970-01-01T${e}.000Z`):ED(e)?new Date(`1970-01-01T${e}`):DD(e)?new Date(`${e}.000Z`):LD(e)?new Date(e):VD(e)?new Date(`${e}T00:00:00.000Z`):e}function WD(e,t,r){return(fe(r)?r:[r]).map(o=>Gn(e.items,t,o))}function XD(e,t,r){return zD(r)}function ZD(e,t,r){return X8(r)}function QD(e,t,r){return YD(r)}function JD(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Gn(o,[...t,...n],r)}function eV(e,t,r){return KD(r)}function tV(e,t,r){return e.allOf.reduce((n,o)=>Gn(o,t,n),r)}function rV(e,t,r){return GD(e,r)}function nV(e,t,r){return qD(r)}function oV(e,t,r){return Q8(r)}function iV(e,t,r){if(!me(r)||fe(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))se(r,n)&&(r[n]=Gn(e.properties[n],t,r[n]));return r}function aV(e,t,r){if(!(me(r)&&!fe(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=Gn(i,t,s);return r}function sV(e,t,r){return Gn(Pe(e,t),t,r)}function fV(e,t,r){return Z8(r)}function cV(e,t,r){return Ee(r)||Qe(r)?Symbol(r):r}function uV(e,t,r){return Gn(Pe(e,t),t,r)}function lV(e,t,r){return fe(r)&&!Ze(e.items)?r.map((o,i)=>izn(e.items,t,`${r}/${i}`,o))):at(e,r,n)}function hV(e,t,r,n){if(!me(n)||Fr(n))return at(e,r,n);let o=ul(e),i=o.map(c=>c[0]),a={...n};for(let[c,m]of o)c in a&&(a[c]=zn(m,t,`${r}/${c}`,a[c]));if(!Re(e.unevaluatedProperties))return at(e,r,a);let s=Object.getOwnPropertyNames(a),f=e.unevaluatedProperties,u={...a};for(let c of s)i.includes(c)||(u[c]=at(f,`${r}/${c}`,u[c]));return at(e,r,u)}function yV(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=zn(i,[...t,...o],r,n);return at(e,r,a)}function xV(e,t,r,n){return at(e,r,zn(e.not,t,r,n))}function gV(e,t,r,n){if(!me(n))return at(e,r,n);let o=Ir(e),i={...n};for(let u of o)se(i,u)&&(Ze(i[u])&&(!No(e.properties[u])||It.IsExactOptionalProperty(i,u))||(i[u]=zn(e.properties[u],t,`${r}/${u}`,i[u])));if(!rt(e.additionalProperties))return at(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,f={...i};for(let u of a)o.includes(u)||(f[u]=at(s,`${r}/${u}`,f[u]));return at(e,r,f)}function bV(e,t,r,n){if(!me(n))return at(e,r,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),a={...n};for(let c of Object.getOwnPropertyNames(n))i.test(c)&&(a[c]=zn(e.patternProperties[o],t,`${r}/${c}`,a[c]));if(!rt(e.additionalProperties))return at(e,r,a);let s=Object.getOwnPropertyNames(a),f=e.additionalProperties,u={...a};for(let c of s)i.test(c)||(u[c]=at(f,`${r}/${c}`,u[c]));return at(e,r,u)}function wV(e,t,r,n){let o=Pe(e,t);return at(e,r,zn(o,t,r,n))}function SV(e,t,r,n){let o=Pe(e,t);return at(e,r,zn(o,t,r,n))}function IV(e,t,r,n){return fe(n)&&fe(e.items)?at(e,r,e.items.map((o,i)=>zn(o,t,`${r}/${i}`,n[i]))):at(e,r,n)}function _V(e,t,r,n){for(let o of e.anyOf){if(!he(o,t,n))continue;let i=zn(o,t,r,n);return at(e,r,i)}return at(e,r,n)}function zn(e,t,r,n){let o=Gt(e,t),i=e;switch(e[k]){case"Array":return dV(i,o,r,n);case"Import":return yV(i,o,r,n);case"Intersect":return hV(i,o,r,n);case"Not":return xV(i,o,r,n);case"Object":return gV(i,o,r,n);case"Record":return bV(i,o,r,n);case"Ref":return wV(i,o,r,n);case"Symbol":return at(i,r,n);case"This":return SV(i,o,r,n);case"Tuple":return IV(i,o,r,n);case"Union":return _V(i,o,r,n);default:return at(i,r,n)}}function ph(e,t,r){return zn(e,t,"",r)}var mh=class extends ce{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},o1=class extends ce{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=r,this.value=n,this.error=o}};function er(e,t,r){try{return Re(e)?e[tt].Encode(r):r}catch(n){throw new o1(e,t,r,n)}}function vV(e,t,r,n){let o=er(e,r,n);return fe(o)?o.map((i,a)=>Kn(e.items,t,`${r}/${a}`,i)):o}function TV(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=er(e,r,n);return Kn(i,[...t,...o],r,a)}function MV(e,t,r,n){let o=er(e,r,n);if(!me(n)||Fr(n))return o;let i=ul(e),a=i.map(m=>m[0]),s={...o};for(let[m,l]of i)m in s&&(s[m]=Kn(l,t,`${r}/${m}`,s[m]));if(!Re(e.unevaluatedProperties))return s;let f=Object.getOwnPropertyNames(s),u=e.unevaluatedProperties,c={...s};for(let m of f)a.includes(m)||(c[m]=er(u,`${r}/${m}`,c[m]));return c}function OV(e,t,r,n){return er(e.not,r,er(e,r,n))}function RV(e,t,r,n){let o=er(e,r,n);if(!me(o))return o;let i=Ir(e),a={...o};for(let c of i)se(a,c)&&(Ze(a[c])&&(!No(e.properties[c])||It.IsExactOptionalProperty(a,c))||(a[c]=Kn(e.properties[c],t,`${r}/${c}`,a[c])));if(!rt(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),f=e.additionalProperties,u={...a};for(let c of s)i.includes(c)||(u[c]=er(f,`${r}/${c}`,u[c]));return u}function CV(e,t,r,n){let o=er(e,r,n);if(!me(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),s={...o};for(let m of Object.getOwnPropertyNames(n))a.test(m)&&(s[m]=Kn(e.patternProperties[i],t,`${r}/${m}`,s[m]));if(!rt(e.additionalProperties))return s;let f=Object.getOwnPropertyNames(s),u=e.additionalProperties,c={...s};for(let m of f)a.test(m)||(c[m]=er(u,`${r}/${m}`,c[m]));return c}function AV(e,t,r,n){let o=Pe(e,t),i=Kn(o,t,r,n);return er(e,r,i)}function PV(e,t,r,n){let o=Pe(e,t),i=Kn(o,t,r,n);return er(e,r,i)}function kV(e,t,r,n){let o=er(e,r,n);return fe(e.items)?e.items.map((i,a)=>Kn(i,t,`${r}/${a}`,o[a])):[]}function NV(e,t,r,n){for(let o of e.anyOf){if(!he(o,t,n))continue;let i=Kn(o,t,r,n);return er(e,r,i)}for(let o of e.anyOf){let i=Kn(o,t,r,n);if(he(e,t,i))return er(e,r,i)}return er(e,r,n)}function Kn(e,t,r,n){let o=Gt(e,t),i=e;switch(e[k]){case"Array":return vV(i,o,r,n);case"Import":return TV(i,o,r,n);case"Intersect":return MV(i,o,r,n);case"Not":return OV(i,o,r,n);case"Object":return RV(i,o,r,n);case"Record":return CV(i,o,r,n);case"Ref":return AV(i,o,r,n);case"This":return PV(i,o,r,n);case"Tuple":return kV(i,o,r,n);case"Union":return NV(i,o,r,n);default:return er(i,r,n)}}function dh(e,t,r){return Kn(e,t,"",r)}function FV(e,t){return Re(e)||At(e.items,t)}function EV(e,t){return Re(e)||At(e.items,t)}function $V(e,t){return Re(e)||At(e.returns,t)||e.parameters.some(r=>At(r,t))}function LV(e,t){return Re(e)||At(e.returns,t)||e.parameters.some(r=>At(r,t))}function DV(e,t){return Re(e)||Re(e.unevaluatedProperties)||e.allOf.some(r=>At(r,t))}function VV(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Re(e)||At(n,[...r,...t])}function UV(e,t){return Re(e)||At(e.items,t)}function jV(e,t){return Re(e)||At(e.not,t)}function BV(e,t){return Re(e)||Object.values(e.properties).some(r=>At(r,t))||rt(e.additionalProperties)&&At(e.additionalProperties,t)}function GV(e,t){return Re(e)||At(e.item,t)}function zV(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Re(e)||At(n,t)||rt(e.additionalProperties)&&Re(e.additionalProperties)}function KV(e,t){return Re(e)?!0:At(Pe(e,t),t)}function qV(e,t){return Re(e)?!0:At(Pe(e,t),t)}function HV(e,t){return Re(e)||!Ze(e.items)&&e.items.some(r=>At(r,t))}function YV(e,t){return Re(e)||e.anyOf.some(r=>At(r,t))}function At(e,t){let r=Gt(e,t),n=e;if(e.$id&&i1.has(e.$id))return!1;switch(e.$id&&i1.add(e.$id),e[k]){case"Array":return FV(n,r);case"AsyncIterator":return EV(n,r);case"Constructor":return $V(n,r);case"Function":return LV(n,r);case"Import":return VV(n,r);case"Intersect":return DV(n,r);case"Iterator":return UV(n,r);case"Not":return jV(n,r);case"Object":return BV(n,r);case"Promise":return GV(n,r);case"Record":return zV(n,r);case"Ref":return KV(n,r);case"This":return qV(n,r);case"Tuple":return HV(n,r);case"Union":return YV(n,r);default:return Re(e)}}var i1=new Set;function Ja(e,t){return i1.clear(),At(e,t)}function J8(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!he(t,r,n))throw new lh(t,n,na(t,r,n).First());return Ja(t,r)?ph(t,r,n):n}function mi(e,t){let r=se(e,"default")?e.default:void 0,n=hi(r)?r():Me(r);return Ze(t)?n:me(t)&&me(n)?Object.assign(n,t):t}function a1(e){return xi(e)&&"default"in e}function WV(e,t,r){if(fe(r)){for(let o=0;o{let a=gr(i,t,n);return me(a)?{...o,...a}:a},{})}function JV(e,t,r){let n=mi(e,r);if(!me(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=gr(e.properties[i],t,n[i]);Ze(a)||(n[i]=gr(e.properties[i],t,n[i]))}if(!a1(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=gr(e.additionalProperties,t,n[i]));return n}function eU(e,t,r){let n=mi(e,r);if(!me(n))return n;let o=e.additionalProperties,[i,a]=Object.entries(e.patternProperties)[0],s=new RegExp(i);for(let f of Object.getOwnPropertyNames(n))s.test(f)&&a1(a)&&(n[f]=gr(a,t,n[f]));if(!a1(o))return n;for(let f of Object.getOwnPropertyNames(n))s.test(f)||(n[f]=gr(o,t,n[f]));return n}function tU(e,t,r){return gr(Pe(e,t),t,mi(e,r))}function rU(e,t,r){return gr(Pe(e,t),t,r)}function nU(e,t,r){let n=mi(e,r);if(!fe(n)||Ze(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;aaU,Format:()=>Yu,Get:()=>fU,Has:()=>sU,Set:()=>iU,ValuePointerRootDeleteError:()=>xh,ValuePointerRootSetError:()=>yh});var yh=class extends ce{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},xh=class extends ce{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function e3(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Yu(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;nes(e[o],t[o]))}function uU(e,t){return ur(t)&&e.getTime()===t.getTime()}function lU(e,t){return!fe(t)||e.length!==t.length?!1:e.every((r,n)=>es(r,t[n]))}function pU(e,t){return!Yr(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>es(r,t[n]))}function mU(e,t){return e===t}function es(e,t){if(ur(e))return uU(e,t);if(Yr(e))return pU(e,t);if(fe(e))return lU(e,t);if(me(e))return cU(e,t);if(Fr(e))return mU(e,t);throw new Error("ValueEquals: Unable to compare value")}var dU=Ae({type:_e("insert"),path:lr(),value:Mn()}),hU=Ae({type:_e("update"),path:lr(),value:Mn()}),yU=Ae({type:_e("delete"),path:lr()}),r3=Ce([dU,hU,yU]),gh=class extends ce{constructor(t,r){super(r),this.value=t}};function bh(e,t){return{type:"update",path:e,value:t}}function n3(e,t){return{type:"insert",path:e,value:t}}function o3(e){return{type:"delete",path:e}}function t3(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new gh(e,"Cannot diff objects with symbols")}function*xU(e,t,r){if(t3(t),t3(r),!Nh(r))return yield bh(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)se(t,i)||(yield n3(`${e}/${i}`,r[i]));for(let i of n)se(r,i)&&(es(t,r)||(yield*wh(`${e}/${i}`,t[i],r[i])));for(let i of n)se(r,i)||(yield o3(`${e}/${i}`))}function*gU(e,t,r){if(!fe(r))return yield bh(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function IU(e){return e.length===0}function a3(e,t){if(SU(t))return Me(t[0].value);if(IU(t))return Me(e);let r=Me(e);for(let n of t)switch(n.type){case"insert":{qn.Set(r,n.path,n.value);break}case"update":{qn.Set(r,n.path,n.value);break}case"delete":{qn.Delete(r,n.path);break}}return r}function s3(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Ja(t,r)?dh(t,r,n):n;if(!he(t,r,o))throw new mh(t,o,na(t,r,o).First());return o}function Sh(e){return me(e)&&!fe(e)}var Ih=class extends ce{constructor(t){super(t)}};function _U(e,t,r,n){if(!Sh(r))qn.Set(e,t,Me(n));else{let o=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(n);for(let a of o)i.includes(a)||delete r[a];for(let a of i)o.includes(a)||(r[a]=null);for(let a of i)s1(e,`${t}/${a}`,r[a],n[a])}}function vU(e,t,r,n){if(!fe(r))qn.Set(e,t,Me(n));else{for(let o=0;o(ah(i,a,s),s)],["Cast",(i,a,s)=>Ku(i,a,s)],["Clean",(i,a,s)=>fh(i,a,s)],["Clone",(i,a,s)=>Me(s)],["Convert",(i,a,s)=>uh(i,a,s)],["Decode",(i,a,s)=>Ja(i,a)?ph(i,a,s):s],["Default",(i,a,s)=>hh(i,a,s)],["Encode",(i,a,s)=>Ja(i,a)?dh(i,a,s):s]]);function r(i){t.delete(i)}e.Delete=r;function n(i,a){t.set(i,a)}e.Set=n;function o(i){return t.get(i)}e.Get=o})(f1||(f1={}));var u3=["Clone","Clean","Default","Convert","Assert","Decode"];function RU(e,t,r,n){return e.reduce((o,i)=>{let a=f1.Get(i);if(Ze(a))throw new _h(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function l3(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?fe(e[0])?[e[0],e[1],[],e[2]]:[u3,e[0],e[1],e[2]]:e.length===2?[u3,e[0],[],e[1]]:(()=>{throw new _h("Invalid Arguments")})();return RU(t,r,n,o)}var Lf={};oa(Lf,{Assert:()=>ah,Cast:()=>Ku,Check:()=>he,Clean:()=>fh,Clone:()=>Me,Convert:()=>uh,Create:()=>jn,Decode:()=>J8,Default:()=>hh,Diff:()=>i3,Edit:()=>r3,Encode:()=>s3,Equal:()=>es,Errors:()=>na,Hash:()=>$f,Mutate:()=>c3,Parse:()=>l3,Patch:()=>a3,ValueErrorIterator:()=>ra});function vh(e){switch(e.type){case"summary_metrics":return Xb(e);case"performance_table":return Yb(e);case"roc":return Ub(e);case"calibration":return jb(e);case"precision_recall":return Gb(e);case"gains":return zb(e);case"lift":return Kb(e);case"decision_curve":return qb(e);case"interventions_avoided":return Hb(e)}}function Mo(e,t){let r=e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"id";/^[a-z]/i.test(r)||(r=`id-${r}`);let n=r,o=1;for(;t.has(n);)n=`${r}-${o}`,o++;return t.add(n),n}function c1(e,t){let r=(n,o=!0)=>{e.forEach((i,a)=>{let s=a===n;i.setAttribute("aria-selected",s?"true":"false"),i.tabIndex=s?0:-1,t[a].hidden=!s}),o&&e[n].focus()};e.forEach((n,o)=>{n.addEventListener("click",()=>{r(o,!1)}),n.addEventListener("keydown",i=>{let a=null;i.key==="ArrowRight"?a=(o+1)%e.length:i.key==="ArrowLeft"?a=(o-1+e.length)%e.length:i.key==="Home"?a=0:i.key==="End"&&(a=e.length-1),a!==null&&(i.preventDefault(),r(a,!0))})})}function CU(e){if(!Lf.Check(vl,e))throw new Error("Invalid ReportSpec");Ml(e);let t=document.createElement("div");if(t.className="rtichoke-report",e.title){let r=document.createElement("h1");r.className="rtichoke-report__title",r.textContent=e.title,t.append(r)}for(let r of e.components){let n=document.createElement("section");if(n.className="rtichoke-report__component",n.dataset.componentId=r.id,r.title){let i=document.createElement("h2");i.className="rtichoke-report__component-title",i.textContent=r.title,n.append(i)}let o=document.createElement("div");o.className="rtichoke-report__component-content",o.append(vh(r.spec)),n.append(o),t.append(n)}return t}function AU(e,t){if(!Lf.Check(Tl,e))throw new Error("Invalid ReportSpec");Ml(e);let r=!!e.title,n=new Set,o=document.createElement("article");if(o.className="rtichoke-report",e.title){let p=document.createElement("header");p.className="rtichoke-report__header";let d=document.createElement("h1");d.className="rtichoke-report__title",d.textContent=e.title,p.append(d),o.append(p)}let i=[],a=0;for(let p of e.sections){let d=Mo(p.id,n);a++;let y=[];for(let x of p.items)if(x.type==="group"){let w=Mo(x.id,n);a++,y.push({rawId:x.id,title:x.title,domId:w})}i.push({rawId:p.id,title:p.title,domId:d,groups:y})}if(a>1){let p=document.createElement("nav");p.className="rtichoke-report__nav",p.setAttribute("aria-label","Report sections");let d=document.createElement("ul");d.className="rtichoke-report__nav-list";for(let y of i){let x=document.createElement("li");x.className="rtichoke-report__nav-item";let w=document.createElement("a");if(w.className="rtichoke-report__nav-link",w.href=`#${y.domId}`,w.textContent=y.title,x.append(w),y.groups.length>0){let g=document.createElement("ul");g.className="rtichoke-report__nav-sublist";for(let S of y.groups){let b=document.createElement("li");b.className="rtichoke-report__nav-subitem";let T=document.createElement("a");T.className="rtichoke-report__nav-link",T.href=`#${S.domId}`,T.textContent=S.title,b.append(T),g.append(b)}x.append(g)}d.append(x)}p.append(d),o.append(p)}let s=r?"h2":"h1",f=r?"h3":"h2",u=r?"h3":"h2",c=r?"h4":"h3",m=(p,d)=>{let y=document.createElement("section");if(y.className="rtichoke-report__component",y.dataset.componentId=p.id,p.title){let w=Mo(`heading-${p.id}`,n),g=document.createElement(d);g.className="rtichoke-report__component-title",g.id=w,g.textContent=p.title,y.setAttribute("aria-labelledby",w),y.append(g)}let x=document.createElement("div");return x.className="rtichoke-report__component-content",x.append(vh(p.spec)),y.append(x),y},l=(p,d,y)=>{let x=document.createElement("section");x.className="rtichoke-report__group",x.id=d.domId,x.dataset.groupId=p.id;let w=Mo(`heading-${p.id}`,n),g=document.createElement(f);if(g.className="rtichoke-report__group-title",y&&g.classList.add("rtichoke-report__group-title--tab-panel"),g.id=w,g.textContent=p.title,x.setAttribute("aria-labelledby",y??w),x.append(g),t.groupPresentation==="tabs"){let S=document.createElement("div");S.className="rtichoke-report__tablist",S.setAttribute("role","tablist"),S.setAttribute("aria-labelledby",w);let b=[],T=[];p.components.forEach((I,v)=>{let O=Mo(`tab-${p.id}-${I.id}`,n),C=Mo(`panel-${p.id}-${I.id}`,n),E=document.createElement("button");E.className="rtichoke-report__tab",E.type="button",E.id=O,E.setAttribute("role","tab"),E.setAttribute("aria-controls",C),E.setAttribute("aria-selected",v===0?"true":"false"),E.tabIndex=v===0?0:-1,E.textContent=I.title||I.id;let A=document.createElement("section");A.className="rtichoke-report__component rtichoke-report__tabpanel",A.id=C,A.setAttribute("role","tabpanel"),A.setAttribute("aria-labelledby",O),A.tabIndex=0,A.dataset.componentId=I.id,A.hidden=v!==0;let F=document.createElement("div");F.className="rtichoke-report__component-content",F.append(vh(I.spec)),A.append(F),b.push(E),T.push(A),S.append(E)}),c1(b,T),x.append(S,...T)}else for(let S of p.components)x.append(m(S,c));return x};for(let p=0;pO.type==="group"),b=t.sectionGroupPresentation==="tabs"&&S.length>1,T=0,I=!1,v=0;for(;v1){let F=document.createElement("div");F.className="rtichoke-report__tablist",F.setAttribute("role","tablist"),F.setAttribute("aria-labelledby",w);let H=[],j=[];E.forEach((M,U)=>{let D=Mo(`tab-${d.id}-${M.id}`,n),oe=Mo(`panel-${d.id}-${M.id}`,n),V=document.createElement("button");V.className="rtichoke-report__tab",V.type="button",V.id=D,V.setAttribute("role","tab"),V.setAttribute("aria-controls",oe),V.setAttribute("aria-selected",U===0?"true":"false"),V.tabIndex=U===0?0:-1,V.textContent=M.title||M.id;let K=document.createElement("section");K.className="rtichoke-report__component rtichoke-report__tabpanel",K.id=oe,K.setAttribute("role","tabpanel"),K.setAttribute("aria-labelledby",D),K.tabIndex=0,K.dataset.componentId=M.id,K.hidden=U!==0;let Y=document.createElement("div");Y.className="rtichoke-report__component-content",Y.append(vh(M.spec)),K.append(Y),H.push(V),j.push(K),F.append(V)}),c1(H,j),x.append(F,...j),v=C}else x.append(m(O,u)),v++}else if(O.type==="group"){if(b){if(!I){I=!0;let C=document.createElement("div");C.className="rtichoke-report__tablist rtichoke-report__section-group-tablist",C.setAttribute("role","tablist"),C.setAttribute("aria-labelledby",w);let E=[],A=[];S.forEach((F,H)=>{let j=y.groups[H],M=Mo(`section-group-tab-${d.id}-${F.id}`,n),U=document.createElement("button");U.className="rtichoke-report__tab",U.type="button",U.id=M,U.setAttribute("role","tab"),U.setAttribute("aria-controls",j.domId),U.setAttribute("aria-selected",H===0?"true":"false"),U.tabIndex=H===0?0:-1,U.textContent=F.title;let D=l(F,j,M);D.classList.add("rtichoke-report__tabpanel"),D.setAttribute("role","tabpanel"),D.setAttribute("aria-labelledby",M),D.tabIndex=0,D.hidden=H!==0,E.push(U),A.push(D),C.append(U)}),c1(E,A),x.append(C,...A)}}else x.append(l(O,y.groups[T++]));v++}}o.append(x)}return o}function PU(e,t){if(!e||typeof e!="object")throw new Error("Invalid ReportSpec");let r=t?.groupPresentation??"stacked",n=t?.sectionGroupPresentation??"stacked",o=t?.sectionComponentPresentation??"stacked";if(t!==void 0&&(typeof t!="object"||t===null||t.groupPresentation!==void 0&&t.groupPresentation!=="stacked"&&t.groupPresentation!=="tabs"))throw new Error("Invalid render options: groupPresentation must be 'stacked' or 'tabs'");if(t!==void 0&&t.sectionGroupPresentation!==void 0&&t.sectionGroupPresentation!=="stacked"&&t.sectionGroupPresentation!=="tabs")throw new Error("Invalid render options: sectionGroupPresentation must be 'stacked' or 'tabs'");if(t!==void 0&&t.sectionComponentPresentation!==void 0&&t.sectionComponentPresentation!=="stacked"&&t.sectionComponentPresentation!=="tabs")throw new Error("Invalid render options: sectionComponentPresentation must be 'stacked' or 'tabs'");if(e.schemaVersion==="1.0")return CU(e);if(e.schemaVersion==="1.1")return AU(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var kU=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function NU(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[Ct(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(Ct([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),vo({width:600,height:600,marginLeft:64,marginBottom:56,style:{background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"},x:{label:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6},y:{label:e.yAxis.label,domain:e.yAxis.domain,grid:!1,ticks:6},color:{legend:!0,range:kU},marks:r})}export{T0 as AUROCSummaryMetricSchema,l0 as CalibrationSpecSchema,Pw as CalibrationV2DatumSchema,d0 as CalibrationV2SpecSchema,Nw as DecisionCurveV2DatumSchema,Fw as DecisionCurveV2EvaluationSchema,Dw as DecisionCurveV2ReferenceSchema,Ew as DecisionCurveV2SeriesSchema,h0 as DecisionCurveV2SpecSchema,Cw as DiscreteCalibrationV2DatumSchema,Mw as DisplayGroupingSpecSchema,Tw as DisplayRoleSchema,An as EvaluationSpecSchema,y0 as GainsV2SpecSchema,Gw as InterventionsAvoidedTreatAllReferenceSchema,zw as InterventionsAvoidedTreatNoneReferenceSchema,Uw as InterventionsAvoidedV2DatumSchema,jw as InterventionsAvoidedV2EvaluationSchema,Kw as InterventionsAvoidedV2ReferenceSchema,Bw as InterventionsAvoidedV2SeriesSchema,x0 as InterventionsAvoidedV2SpecSchema,g0 as LiftV2SpecSchema,Rw as OperatingPointDimensionSchema,Yw as OperatingPointSchema,$o as OperatingPointSpecSchema,Ww as PerformanceEvaluationContextSchema,qw as PerformanceMetricDefinitionSchema,I0 as PerformanceMetricIdSchema,Hw as PerformanceMetricValueSchema,Xw as PerformanceTableRowSchema,_0 as PerformanceTableSpecSchema,v0 as PopulationSummaryOwnerSpecSchema,b0 as PrecisionRecallV2SpecSchema,M0 as PrevalenceSummaryMetricSchema,xr as RTICHOKE_BROWSER_THEME,L8 as RTICHOKE_COLORS,Ow as ReferenceLineV2SpecSchema,Qw as ReportComponentSchema,C0 as ReportComponentV1_1Schema,Jw as ReportGroupSchema,eS as ReportSectionSchema,vC as ReportSpecSchema,vl as ReportSpecV1_0Schema,Tl as ReportSpecV1_1Schema,p0 as RocSpecSchema,w0 as RocV2SpecSchema,cC as RtichokeChartSpecSchema,S0 as RtichokeChartSpecV2Schema,vs as SeriesSpecSchema,Aw as SmoothCalibrationV2DatumSchema,R0 as StandaloneCanonicalSpecSchema,SC as SummaryMetricSchema,O0 as SummaryMetricsSpecSchema,Lw as TreatAllReferenceSchema,$w as TreatNoneReferenceSchema,A0 as assertPerformanceTableReferentialIntegrity,Ml as assertReportReferentialIntegrity,P0 as assertSummaryMetricsReferentialIntegrity,Lo as assertV2ReferentialIntegrity,OC as calibrationSpecFromRtichokeRows,PC as calibrationV2SpecFromRtichokeRows,D8 as extractOperatingPointValues,IE as renderCalibration,jb as renderCalibrationV2,qb as renderDecisionCurveV2,zb as renderGainsV2,Hb as renderInterventionsAvoidedV2,Kb as renderLiftV2,Yb as renderPerformanceTable,Gb as renderPrecisionRecallV2,PU as renderReport,NU as renderRoc,Ub as renderRocV2,Xb as renderSummaryMetrics,Qa as renderWithOperatingPointSelection,To as resolveV2RenderOptions,MC as rocSpecFromRtichokePython,TC as rocSpecFromRtichokeR,AC as rocV2SpecFromRtichokePython,CC as rocV2SpecFromRtichokeR}; +}`)).call(Zc,r);for(let V of u){let{channels:q,values:H,facets:W}=y.get(V);if(h===void 0||V.facet==="super"){let te=null;if(W&&(te=W[0],te=V.filter(te,q,H),te.length===0))continue;let be=V.render(te,g,H,S,v);if(be==null)continue;O.appendChild(be)}else{let te;for(let be of h){if(!(V.facetAnchor?.(h,k,be)??!be.empty))continue;let K=null;if(W){let Y=m.has(V);if(K=W[Y?be.i:0],K=V.filter(K,q,H),K.length===0)continue;!Y&&K===W[0]&&(K=PT(K)),K.fx=be.x,K.fy=be.y,K.fi=be.i}let Z=V.render(K,g,H,I,v);if(Z!=null){(te??=hn(O).append("g")).append(()=>Z).datum(be);for(let Y of["aria-label","aria-description","aria-hidden","transform"])Z.hasAttribute(Y)&&(te.attr(Y,Z.getAttribute(Y)),Z.removeAttribute(Y))}}te?.selectChildren().each(z)}}let U=gO(b,v,e),{figure:L=n!=null||o!=null||i!=null||U.length>0}=e;L&&(R=T.createElement("figure"),R.className=`${c}-figure`,R.style.maxWidth="initial",n!=null&&R.append(AO(T,n,"h2")),o!=null&&R.append(AO(T,o,"h3")),R.append(...U,O),i!=null&&R.append(f$(T,i)),"value"in O&&(R.value=O.value,delete O.value)),R.scale=K6(g.scales),R.legend=hO(b,v,e);let re=I6();return re>0&&hn(O).append("text").attr("x",j).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${re.toLocaleString("en-US")} warning${re===1?"":"s"}. Please check the console.`),R}function AO(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function f$(e,t){let r=e.createElement("figcaption");return r.append(t),r}function EO(e){return e.flat(1/0).filter(t=>t!=null).map(u$)}function u$(e){return typeof e.render=="function"?e:new k1(e)}var k1=class extends lt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function R1(e,t){for(let r in e)LO(e[r],t);return e}function LO(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:o,percent:i,interval:a,transform:s=i?c=>c==null?NaN:c*100:Ix(a,o)}=t[r]??{};s!=null&&(e.value=et(e.value,s),e.transform=!1)}function l$(e){for(let t in e)Rx(t,e[t])}function gl(e,t,r,n=gT){for(let{channels:o}of t.values())for(let i in o){let a=o[i],{scale:s}=a;if(s!=null&&n(s))if(s==="projection"){if(!rM(r)){let c=r.x?.domain===void 0,u=r.y?.domain===void 0;if(c||u){let[f,m]=oM(a);c&&C1(e,"x",f),u&&C1(e,"y",m)}}}else C1(e,s,a)}return e}function C1(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function p$(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=vi(e.data);if(o==null)throw new Error("missing facet data");let i={};r!=null&&(i.fx=zc(o,{value:r,scale:"fx"})),n!=null&&(i.fy=zc(o,{value:n,scale:"fy"})),R1(i,t);let a=ph(o,i);return{channels:i,groups:a,data:e.data}}function FO(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let c=vi(e.data??n??o);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let u={};return n!=null&&(u.fx=zc(c,{value:n,scale:"fx"})),o!=null&&(u.fy=zc(c,{value:o,scale:"fy"})),R1(u,r),{channels:u,groups:ph(c,u)}}if(t===void 0)return;let{channels:i,groups:a,data:s}=t;if(e.facet!=="auto"||e.data===s)return{channels:i,groups:a};s.length>0&&(a.size>1||a.size===1&&i.fx&&i.fy&&[...a][0][1].size>1)&&pa(vi(e.data))===pa(s)&&Lr(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function m$(e,t={}){return Ti({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function d$(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:o,preferredAnchor:i}=n;o=/^x$/i.test(o)?yM:/^y$/i.test(o)?t1:hM,n=o(m$(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===t1?"left":"bottom");let a=NO(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function h$(e,t,r){let{projection:n,x:o={},y:i={},fx:a={},fy:s={},axis:c,grid:u,facet:f={},facet:{axis:m=c,grid:l}=f,x:{axis:p=c,grid:h=p===null?null:u}=o,y:{axis:y=c,grid:b=y===null?null:u}=i,fx:{axis:w=m,grid:g=w===null?null:l}=a,fy:{axis:_=m,grid:x=_===null?null:l}=s}=r;(n||!Lc(o)&&!$O("x",e))&&(p=h=null),(n||!Lc(i)&&!$O("y",e))&&(y=b=null),t.has("fx")||(w=g=null),t.has("fy")||(_=x=null),p===void 0&&(p=!Eh(e,"x")),y===void 0&&(y=!Eh(e,"y")),w===void 0&&(w=!Eh(e,"fx")),_===void 0&&(_=!Eh(e,"fy")),p===!0&&(p="bottom"),y===!0&&(y="left"),w===!0&&(w=p==="top"||p===null?"bottom":"top"),_===!0&&(_=y==="right"||y===null?"left":"right");let I=[];return Ah(I,x,JM,s),Nh(I,_,YM,"right","left",f,s),Ah(I,g,tO,a),Nh(I,w,WM,"top","bottom",f,a),Ah(I,b,QM,i),Nh(I,y,x1,"left","right",r,i),Ah(I,h,eO,o),Nh(I,p,w1,"bottom","top",r,o),I}function Nh(e,t,r,n,o,i,a){if(!t)return;let s=y$(t);a=b$(s?n:t,i,a);let{line:c}=a;(r===x1||r===w1)&&c&&!hs(c)&&e.push(T1(g$(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function Ah(e,t,r,n){!t||hs(t)||e.push(r(x$(t,n)))}function y$(e){return/^\s*both\s*$/i.test(e)}function b$(e,t,{line:r=t.line,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:m,label:l=t.label,labelAnchor:p,labelArrow:h=t.labelArrow,labelOffset:y}){return{anchor:e,line:r,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:m,label:l,labelAnchor:p,labelArrow:h,labelOffset:y}}function g$(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function x$(e,{stroke:t=jc(e)?e:void 0,ticks:r=w$(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function w$(e){switch(typeof e){case"number":return!0;case"string":return!jc(e)}return Tn(e)||typeof e?.range=="function"}function Eh(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function $O(e,t){for(let r of t)for(let n in r.channels){let{scale:o}=r.channels[n];if(o===e||o==="projection")return!0}return!1}function S$(e,t){for(let r in e){let n=e[r],o=t[r];n.label===void 0&&o&&(n.label=o.label)}return e}function I$({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=uh(r),u=e&&DO(e),f=t&&DO(t);return{marginTop:t?f[0]:n,marginRight:e?s-u[1]:o,marginBottom:t?c-f[1]:i,marginLeft:e?u[0]:a,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:s,height:c}}function DO(e){let t=e.domain();if(t.length===0)return[0,e.bandwidth()];let r=e(t[0]),n=e(t[t.length-1]);return nx.selectAll().data(t).enter().append(g?"circle":"path").call(Wt,this).call(g?I=>{I.attr("cx",c?S=>c[S]:b).attr("cy",u?S=>u[S]:w).attr("r",f?S=>f[S]:p)}:I=>{I.attr("transform",Qc`translate(${c?S=>c[S]:b},${u?S=>u[S]:w})${m?S=>` rotate(${m[S]})`:h?` rotate(${h})`:""}`).attr("d",f&&l?S=>{let v=Hn();return l[S].draw(v,f[S]*f[S]*Math.PI),v}:f?S=>{let v=Hn();return y.draw(v,f[S]*f[S]*Math.PI),v}:l?S=>{let v=Hn();return l[S].draw(v,_),v}:(()=>{let S=Hn();return y.draw(S,_),S})())}).call(Vr,this,n)).node()}};function Ss(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Pi(t,r)),new Fh(e,{...n,x:t,y:r})}var M$={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},$h=class extends lt{constructor(t,r={}){let{x:n,y:o,z:i,curve:a,tension:s}=r;super(t,{x:{value:n,scale:"x"},y:{value:o,scale:"y"},z:{value:eh(r),optional:!0}},r,M$),this.z=i,this.curve=VO(a,s),hl(this,r)}filter(t){return t}project(t,r,n){this.curve!==xl&&super.project(t,r,n)}render(t,r,n,o,i){let{x:a,y:s}=n,{curve:c}=this;return ze("svg:g",i).call(ir,this,o,i).call(ar,this,r).call(u=>u.selectAll().data(uM(t,[a,s],this,n)).enter().append("path").call(Wt,this).call(fM,this,n).call(wM,this,n,i).attr("d",c===xl&&i.projection?O$(i.path(),a,s):Ag().curve(c).defined(f=>f>=0).x(f=>a[f]).y(f=>s[f]))).node()}};function O$(e,t,r){return t=ds(t),r=ds(r),n=>{let o=[],i=[o];for(let a of n)a===-1?(o=[],i.push(o)):o.push([t[a],r[a]]);return e({type:"MultiLineString",coordinates:i})}}function Dt(e,{x:t,y:r,...n}={}){return[t,r]=Pi(t,r),new $h(e,{...n,x:t,y:r})}lt.prototype.plot=function({marks:e=[],...t}={}){return jo({...t,marks:[...e,this]})};var C$=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],jO={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function k$(e,t){let r=[...t?[e.model]:[],`Predicted: ${e.predicted.toFixed(3)}`,`Observed: ${e.observed.toFixed(3)}`];return e.method==="discrete"&&e.events!==void 0&&e.total!==void 0&&(r[r.length-1]+=` ( ${e.events} / ${e.total} )`),r.join(` +`)}function R$(e){let r=[...new Set(e.data.map(p=>p.model))].length>1,n=r?C$:["#000000"],o=e.data.map(p=>({...p,tooltip:k$(p,r)})),i=[];e.references?.some(p=>p.type==="identity")&&i.push(Dt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(Dt(o,{x:"predicted",y:"observed",stroke:"model",strokeWidth:2,title:"tooltip",tip:!0}));let a=o.filter(p=>p.method==="discrete");a.length>0&&i.push(Ss(a,{x:"predicted",y:"observed",fill:"model",stroke:"white",strokeWidth:1.5,r:5,title:"tooltip",tip:!0}));let s=(e.distribution?.length??0)>0,c=jo({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:jO,x:{label:s?null:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6,axis:s?null:"bottom"},y:{label:e.yAxis.label,domain:e.yAxis.domain,grid:!1,ticks:6},color:{legend:r,range:n},marks:i});if(!s||!e.distribution)return c;let u=e.distribution.map(p=>({...p,tooltip:`${r?`${p.model} +`:""}${p.count} observations in [${(p.midpoint-p.binWidth/2).toFixed(3)}, ${(p.midpoint+p.binWidth/2).toFixed(3)}]`})),f=new Set(e.distribution.map(p=>p.model)).size,m=jo({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:jO,x:{label:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6},y:{label:null,grid:!1,ticks:3},color:{legend:!1,range:n},marks:[Ri(u,{x1:p=>p.midpoint-p.binWidth/2,x2:p=>p.midpoint+p.binWidth/2,y:"count",fill:"model",fillOpacity:1/Math.max(f,1),title:"tooltip",tip:!0})]}),l=document.createElement("div");return l.style.width="600px",l.style.maxWidth="100%",l.append(c,m),l}var UO=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],yr={width:600,height:500,margins:{top:28,right:28,bottom:58,left:66},background:"#ffffff",frame:{color:"#444444",width:1},typography:{fontFamily:"Arial, Helvetica, sans-serif",fontSize:12,axisTitleSize:14,axisTitleWeight:400,legendSize:12},axis:{color:"#444444",tickSize:5,tickPadding:7,ticks:6,numberFormat:".1f"},colors:UO,line:{width:2,dash:null},marker:{radius:2.5,fill:null,stroke:"#ffffff",strokeWidth:.5},reference:{color:"#BEBEBE",width:1.5,dash:"2,3"},legend:{position:"top",swatchWidth:12,columns:null},tip:{digits:3},predictionDistribution:{emphasizedTrue:"#009E73",nonEmphasizedTrue:"#F4FFF0",emphasizedFalse:"#FAC8CD",nonEmphasizedFalse:"#FFF7F8",observedPositive:"#4C5454",observedNegative:"#E0E0E0"}};function N$(e){let t=e.theme??{};return{...yr,width:e.width??yr.width,height:e.height??yr.height,background:t.background??yr.background,colors:e.colors??yr.colors,margins:{...yr.margins,...t.margins},frame:{...yr.frame,...t.frame},typography:{...yr.typography,...t.typography},axis:{...yr.axis,...t.axis},line:{...yr.line,...t.line},marker:{...yr.marker,...t.marker},reference:{...yr.reference,...t.reference},legend:{...yr.legend,...t.legend},tip:{...yr.tip,...t.tip},predictionDistribution:{...yr.predictionDistribution,...t.predictionDistribution}}}function On(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,c)=>`group-${c+1}`):[...e]),n=N$(t);if(!Number.isFinite(n.width)||n.width<=0||!Number.isFinite(n.height)||n.height<=0)throw new Error("Renderer width and height must be positive finite numbers");if(!Number.isInteger(n.tip.digits)||n.tip.digits<0||n.tip.digits>20)throw new Error("Renderer tip digits must be an integer between 0 and 20");let o=r.length<=1?["#000000"]:[...n.colors];if(o.length1;return{theme:{...n,colors:i},groups:r,colors:i,colorByGroup:new Map(r.map((s,c)=>[s,i[c]])),showLegend:a}}function BO(e){if(!e.operatingPoint)return[];let t=e.operatingPoint.dimension,r=t==="probability_threshold"?e.type==="decision_curve"||e.type==="interventions_avoided"?"threshold":"cutoff":"ppcr";if(t==="probability_threshold"){let n=e.series.map(i=>i.id);if(n.length===0)return[];let o=null;for(let i of n){let s=e.data.filter(u=>u.seriesId===i).map(u=>u[r]).filter(u=>typeof u=="number"&&Number.isFinite(u)),c=new Set(s);if(o===null)o=c;else{let u=o;o=new Set(Array.from(u).filter(f=>c.has(f)))}}return Array.from(o??[]).sort((i,a)=>i-a)}else{let n=e.data.map(i=>i[r]).filter(i=>typeof i=="number"&&Number.isFinite(i));return[...new Set(n)].sort((i,a)=>i-a)}}function A$(e,t){let r=e.series.filter(o=>t.has(o.display.group)),n=new Set(r.map(o=>o.id));return{...e,series:r,data:e.data.filter(o=>n.has(o.seriesId))}}function of(e,t,r,n,o){let i=wl(e),a=n;if(i.length<=1)return r(e,t,a,g=>{a=g,o&&o(g)});let s={...t,allGroups:i,showLegend:!1},c=On(i,s),{theme:u,colorByGroup:f}=c,m=new Map(e.series.map(g=>[g.display.group,g.display.label])),l=new Set(i),p=document.createElement("div");p.className="rtichoke-legend-chart",p.style.maxWidth=`${u.width}px`;let h=document.createElement("div");h.className="rtichoke-legend",h.style.paddingLeft=`${u.margins.left}px`,h.setAttribute("aria-label","Chart legend");let y=new Map;i.forEach(g=>{let _=document.createElement("button");_.type="button",_.className="rtichoke-legend-item",_.setAttribute("aria-pressed","true");let x=m.get(g)??g;_.setAttribute("aria-label",`Toggle series ${x}`);let I=document.createElement("span");I.className="rtichoke-legend-swatch";let S=document.createElement("span");S.className="rtichoke-legend-line",S.style.backgroundColor=f.get(g)??"#000000",I.append(S);let v=document.createElement("span");v.className="rtichoke-legend-label",v.textContent=x,_.append(I,v),h.append(_),y.set(g,_)});let b=document.createElement("div");b.className="rtichoke-legend-content";let w=()=>{let g=A$(e,l),_=r(g,s,a,x=>{a=x,o&&o(x)});b.replaceChildren(_)};return i.forEach(g=>{let _=y.get(g);_.addEventListener("click",()=>{if(l.has(g)){if(l.size<=1)return;l.delete(g),_.setAttribute("aria-pressed","false")}else l.add(g),_.setAttribute("aria-pressed","true");w()})}),p.append(h,b),w(),p}function Is(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=BO(e);if(i.length===0)return r(e,void 0);let a=On(wl(e),t),{theme:s}=a,c=document.createElement("div");c.className="rtichoke-operating-point-chart",c.style.maxWidth=`${s.width}px`;let u=document.createElement("div");u.className="rtichoke-operating-point-control",u.style.marginLeft=`${s.margins.left}px`,u.style.marginRight=`${s.margins.right}px`;let f=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"Predicted positives condition rate (PPCR)",m=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"PPCR",l=document.createElement("label");l.className="rtichoke-operating-point-label";let p=document.createElement("span");p.textContent=`${m}: `;let h=document.createElement("span");h.className="rtichoke-operating-point-value";let y=document.createElement("input");y.type="range",y.className="rtichoke-operating-point-slider",y.min="0",y.max=String(i.length-1),y.step="1",y.setAttribute("aria-label",f);let b=0;if(n!==void 0){let I=i.indexOf(n);I!==-1&&(b=I)}let w=i[b];y.value=String(b);let g=w.toFixed(s.tip.digits);h.textContent=g,y.setAttribute("aria-valuetext",g),o&&o(w),l.append(p,h),u.append(l,y);let _=document.createElement("div");_.className="rtichoke-operating-point-content";let x=I=>{_.replaceChildren(r(e,I))};return y.addEventListener("input",()=>{let I=Number(y.value),S=i[I],v=S.toFixed(s.tip.digits);h.textContent=v,y.setAttribute("aria-valuetext",v),o&&o(S),x(S)}),c.append(_,u),x(w),c}function E$(e){return new Map(e.series.map(t=>[t.id,t.display]))}function wl(e){return[...new Set(e.series.map(t=>t.display.group))]}function Dh(e,t){let r=E$(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}function Ct(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` +`)}function Lh(e,t){let{theme:r}=e,n=new Map(t.series.map(o=>[o.display.group,o.display.label]));return{width:r.width,height:r.height,marginTop:r.margins.top,marginRight:r.margins.right,marginBottom:r.margins.bottom,marginLeft:r.margins.left,style:{background:r.background,color:r.axis.color,fontFamily:r.typography.fontFamily,fontSize:`${r.typography.fontSize}px`},color:{legend:e.showLegend,domain:e.groups,range:e.colors,tickFormat:o=>n.get(o)??o}}}function wa(e,t,r){return{label:t,domain:r,grid:!1,line:!0,ticks:e.axis.ticks,tickSize:e.axis.tickSize,tickPadding:e.axis.tickPadding,tickFormat:e.axis.numberFormat}}function N1(e,t){let r={stroke:t.reference.color,strokeWidth:t.reference.width,strokeDasharray:t.reference.dash},n=[];for(let o of e.references??[])o.type==="identity"?n.push(Dt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",...r,title:o.label})):o.type==="horizontal"&&o.value!==void 0?n.push(Qn([o.value],{...r,title:o.label})):o.type==="path"&&o.points&&n.push(Dt(o.points,{x:"x",y:"y",...r,title:o.label}));return n}function Vh(e,t){return e}function F$(e,t,r=40){let n=new Map;for(let i of e){let a=t(i),s=n.get(a);s||(s=[],n.set(a,s)),s.push(i)}let o=[];for(let i of n.values()){let a=i.length;if(a<=r)o.push(...i);else{let s=new Set;for(let c=0;cf.seriesId,40),a=n.theme,s=o?.marker?.radius??a.marker.radius,c=o?.marker?.stroke??a.marker.stroke,u=o?.marker?.strokeWidth??a.marker.strokeWidth;return Ss(i,{ariaLabel:"ordinary-point",x:t,y:r,fill:"group",stroke:c,strokeWidth:u,r:s,title:f=>f.title,tip:!0})}function sf(e,t,r,n,o){let i=n.groups.length>1,a=o?.marker?.fill??(i?"group":"#f6e3be"),s=o?.marker?.stroke??"#1a1a1a",c=o?.marker?.strokeWidth??2.5,u=o?.marker?.radius??7.5;return Ss(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:c,r:u,title:f=>f.title,tip:!0})}function Uo(e,t){let r=jo(e);for(let n of r.querySelectorAll('[aria-label$="axis label"] text'))n.style.fontSize=`${t.typography.axisTitleSize}px`,n.style.fontWeight=String(t.typography.axisTitleWeight);for(let n of r.querySelectorAll('[aria-label="frame"]'))n.setAttribute("stroke",t.frame.color);if(r instanceof HTMLElement){r.style.fontSize=`${t.typography.legendSize}px`;for(let n of r.querySelectorAll('svg[width="15"], div[class*="-swatches"] svg'))n.setAttribute("width",String(t.legend.swatchWidth)),n.setAttribute("height","10")}return r}function $$(e,t={},r){ni(e);let n=On(wl(e),t),{theme:o}=n,i=e.operatingPoint?.dimension,a=Dh(e,e.data).map(c=>{let u=1-c.specificity,f=[["Series",c.label]];return i==="ppcr"?(c.ppcr!==void 0&&f.push(["PPCR",c.ppcr]),f.push(["Cutoff",c.cutoff])):(f.push(["Cutoff",c.cutoff]),c.ppcr!==void 0&&f.push(["PPCR",c.ppcr])),f.push(["Sensitivity",c.sensitivity],["Specificity",c.specificity],["False Positive Rate",u]),{...c,false_positive_rate:u,title:Ct(o.tip.digits,f)}}),s=N1(e,o);if(s.push(Dt(a,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0,title:c=>c.title,tip:!0}),af(a,"false_positive_rate","sensitivity",n,t.theme)),r!==void 0&&e.operatingPoint){let c=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",u=a.filter(f=>f[c]===r);u.length>0&&s.push(sf(u,"false_positive_rate","sensitivity",n,t.theme))}return Uo({...Lh(n,e),x:wa(o,e.xAxis.label,e.xAxis.domain),y:wa(o,e.yAxis.label,e.yAxis.domain),marks:Vh(s,o)},o)}function A1(e,t={}){return of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Is(a,n,(u,f)=>$$(u,n,f),s,c),o,i))}function E1(e,t={}){ni(e);let r=On(wl(e),t),{theme:n}=r,o=Dh(e,e.data).map(y=>({...y,title:Ct(n.tip.digits,[["Series",y.label],["Predicted",y.predicted],["Observed",y.observed],["Events",y.events],["Total",y.total]])})),i=N1(e,n);i.push(Dt(o,{x:"predicted",y:"observed",z:"seriesId",stroke:"group",strokeWidth:n.line.width,strokeDasharray:n.line.dash??void 0,title:y=>y.title,tip:!0}));let a=o.filter(y=>y.method==="discrete");a.length>0&&i.push(Ss(a,{x:"predicted",y:"observed",fill:n.marker.fill??"group",stroke:n.marker.stroke,strokeWidth:n.marker.strokeWidth,r:n.marker.radius,title:y=>y.title,tip:!0}));let s=(e.distribution?.length??0)>0,c=s?Math.round(n.height*.8):n.height,u=o.map(y=>y.observed).filter(Number.isFinite),f=e.yAxis.domain??[Math.min(0,...u),Math.max(1,...u)],m=Uo({...Lh(r,e),height:c,marginBottom:s?8:n.margins.bottom,x:s?{...wa(n,e.xAxis.label,e.xAxis.domain),axis:null,label:null}:wa(n,e.xAxis.label,e.xAxis.domain),y:wa(n,e.yAxis.label,f),marks:Vh(i,n)},n);if(!s||!e.distribution)return m;let l=Dh(e,e.distribution).map(y=>({...y,title:Ct(n.tip.digits,[["Series",y.label],["Midpoint",y.midpoint],["Count",y.count]])})),p=Uo({...Lh(r,e),height:n.height-c,marginTop:0,marginBottom:n.margins.bottom,x:wa(n,e.xAxis.label,e.xAxis.domain),y:{label:null,grid:!1,ticks:3,tickSize:n.axis.tickSize,tickPadding:n.axis.tickPadding},color:{legend:!1,domain:r.groups,range:r.colors},marks:Vh([Ri(l,{x1:y=>y.midpoint-y.binWidth/2,x2:y=>y.midpoint+y.binWidth/2,y:"count",fill:"group",fillOpacity:1/Math.max(r.groups.length,1),title:y=>y.title,tip:!0})],n)},n),h=document.createElement("div");return h.className="rtichoke-calibration",h.style.width=`${n.width}px`,h.style.maxWidth="100%",h.append(m,p),h}function D$(e,t,r,n,o){ni(e);let i=On(wl(e),t),{theme:a}=i,s=e.operatingPoint?.dimension,c=Dh(e,e.data).map(f=>{let m=f,l=[["Series",f.label]];return e.type==="precision_recall"?(s==="ppcr"?(m.ppcr!==void 0&&l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])):(l.push(["Cutoff",m.cutoff]),m.ppcr!==void 0&&l.push(["PPCR",m.ppcr])),l.push(["Sensitivity",m.sensitivity],["PPV",m.ppv])):e.type==="gains"?(s==="probability_threshold"?(l.push(["Cutoff",m.cutoff]),l.push(["PPCR",m.ppcr])):(l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])),l.push(["Sensitivity",m.sensitivity])):e.type==="lift"&&(s==="probability_threshold"?(l.push(["Cutoff",m.cutoff]),l.push(["PPCR",m.ppcr])):(l.push(["PPCR",m.ppcr]),l.push(["Cutoff",m.cutoff])),l.push(["Lift",m.lift])),{...f,title:Ct(a.tip.digits,l)}}),u=N1(e,a);if(u.push(Dt(c,{x:r,y:n,z:"seriesId",stroke:"group",strokeWidth:a.line.width,strokeDasharray:a.line.dash??void 0,title:f=>f.title,tip:!0}),af(c,r,n,i,t.theme)),o!==void 0&&e.operatingPoint){let m=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",l=c.filter(p=>p[m]===o);l.length>0&&u.push(sf(l,r,n,i,t.theme))}return Uo({...Lh(i,e),x:wa(a,e.xAxis.label,e.xAxis.domain),y:wa(a,e.yAxis.label,e.yAxis.domain),marks:Vh(u,a)},a)}function L$(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function V$(e,t){let r=e.series.filter(o=>o.horizon===void 0||o.horizon===t),n=new Set(r.map(o=>o.id));return{...e,series:r,data:e.data.filter(o=>n.has(o.seriesId)),references:e.references?.filter(o=>o.scope!=="population_horizon"||o.horizon===t)}}function cf(e,t,r,n){let o=L$(e);if(o.length<=1)return t(e,r,n);let i=r,a=document.createElement("div");a.className="rtichoke-horizon-chart";let s=document.createElement("label");s.className="rtichoke-horizon-control",s.textContent="Fixed Time Horizon: ";let c=document.createElement("select");c.className="rtichoke-horizon-select",c.setAttribute("aria-label","Fixed Time Horizon");for(let m of o){let l=document.createElement("option");l.value=String(m),l.textContent=String(m),c.append(l)}s.append(c);let u=document.createElement("div"),f=m=>{u.replaceChildren(t(V$(e,m),i,l=>{i=l,n&&n(l)}))};return c.addEventListener("change",()=>f(Number(c.value))),a.append(s,u),f(o[0]),a}function F1(e,t,r,n){return of(e,t,(o,i,a,s)=>cf(o,(c,u,f)=>Is(c,i,(m,l)=>D$(m,i,r,n,l),u,f),a,s))}function $1(e,t={}){return F1(e,t,"sensitivity","ppv")}function D1(e,t={}){return F1(e,t,"ppcr","sensitivity")}function L1(e,t={}){return F1(e,t,"ppcr","lift")}function V1(e,t={}){return ni(e),of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Is(a,n,(u,f)=>j$(u,n,f),s,c),o,i))}function j$(e,t,r){let n=[...new Set(e.series.map(p=>p.display.group))],o=On(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(p=>[p.id,p.display])),s=new Map(e.series.map(p=>[p.display.group,p.display.label])),c=e.data.map(p=>({...p,group:a.get(p.seriesId).group,label:a.get(p.seriesId).label,title:Ct(i.tip.digits,[["Series",a.get(p.seriesId).label],["Threshold",p.threshold],["Net Benefit",p.netBenefit]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},f={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:"4,3"},m=[];for(let p of e.references)p.benchmark==="treat_none"?m.push(Qn([0],{...u,title:()=>p.label??"Treat None"})):m.push(Dt(p.points,{x:"x",y:"y",...f,title:()=>p.label??`Treat All \u2014 ${p.population}`}));if(m.push(Dt(c,{x:"threshold",y:"netBenefit",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),af(c,"threshold","netBenefit",o,t.theme)),r!==void 0&&e.operatingPoint){let p=c.filter(h=>h.threshold===r);p.length>0&&m.push(sf(p,"threshold","netBenefit",o,t.theme))}let l=(p,h)=>({label:p,domain:h,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return Uo({width:i.width,height:i.height,marginTop:i.margins.top,marginRight:i.margins.right,marginBottom:i.margins.bottom,marginLeft:i.margins.left,style:{background:i.background,color:i.axis.color,fontFamily:i.typography.fontFamily,fontSize:`${i.typography.fontSize}px`},color:{legend:o.showLegend,domain:o.groups,range:o.colors,tickFormat:p=>s.get(p)??p},x:l(e.xAxis.label,e.xAxis.domain),y:l(e.yAxis.label,e.yAxis.domain),marks:m},i)}function j1(e,t={}){return ni(e),of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Is(a,n,(u,f)=>U$(u,n,f),s,c),o,i))}function U$(e,t,r){let n=[...new Set(e.series.map(p=>p.display.group))],o=On(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(p=>[p.id,p.display])),s=new Map(e.series.map(p=>[p.display.group,p.display.label])),c=e.data.map(p=>({...p,group:a.get(p.seriesId).group,label:a.get(p.seriesId).label,title:Ct(i.tip.digits,[["Series",a.get(p.seriesId).label],["Threshold",p.threshold],["Interventions Avoided",p.interventionsAvoided]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},f={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:"4,3"},m=[];for(let p of e.references)p.benchmark==="treat_all"?m.push(Qn([0],{...u,title:()=>p.label??"Treat All"})):m.push(Dt(p.points,{x:"x",y:"y",...f,title:()=>p.label??`Treat None \u2014 ${p.population}`}));if(m.push(Dt(c,{x:"threshold",y:"interventionsAvoided",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),af(c,"threshold","interventionsAvoided",o,t.theme)),r!==void 0&&e.operatingPoint){let p=c.filter(h=>h.threshold===r);p.length>0&&m.push(sf(p,"threshold","interventionsAvoided",o,t.theme))}let l=(p,h)=>({label:p,domain:h,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return Uo({width:i.width,height:i.height,marginTop:i.margins.top,marginRight:i.margins.right,marginBottom:i.margins.bottom,marginLeft:i.margins.left,style:{background:i.background,color:i.axis.color,fontFamily:i.typography.fontFamily,fontSize:`${i.typography.fontSize}px`},color:{legend:o.showLegend,domain:o.groups,range:o.colors,tickFormat:p=>s.get(p)??p},x:l(e.xAxis.label,e.xAxis.domain),y:l(e.yAxis.label,e.yAxis.domain),marks:m},i)}var jr="\u2014",B$=[{id:"sensitivity",defaultLabel:"Sensitivity"},{id:"specificity",defaultLabel:"Specificity"},{id:"ppv",defaultLabel:"PPV"},{id:"npv",defaultLabel:"NPV"},{id:"lift",defaultLabel:"Lift"},{id:"net_benefit",defaultLabel:"Net Benefit"}];function Jn(e,t,r){let n=e.createElement("td"),o=e.createElement("span");return o.className="rtichoke-performance-table__cell-text",o.textContent=t,n.append(o),r&&(n.className=r),n}function yt(e,t,r){let n=e.createElement("th");return n.scope=r?.scope??"col",r?.colSpan&&(n.colSpan=r.colSpan),r?.rowSpan&&(n.rowSpan=r.rowSpan),n.textContent=t,r?.className&&(n.className=r.className),r?.ariaLabel&&n.setAttribute("aria-label",r.ariaLabel),n}function z$(e){let t=new Map(e.map(a=>[a.metricId,a.estimate])),r=t.get("true_positives"),n=t.get("true_negatives"),o=t.get("false_positives"),i=t.get("false_negatives");return r==null||isNaN(r)||n===void 0||n===null||isNaN(n)||o===void 0||o===null||isNaN(o)||i===void 0||i===null||isNaN(i)?null:{tp:r,tn:n,fp:o,fn:i}}function Sa(e,t,r,n){let o=e.createElement("td");o.className=n;let i=e.createElement("span");i.className="rtichoke-performance-table__confusion-val",i.textContent=jh(t);let a=e.createElement("span");if(a.className="rtichoke-performance-table__confusion-pct",r>0&&!isNaN(t)&&!isNaN(r)){let s=t/r*100;a.textContent=`${s.toFixed(2)}%`}else a.textContent=jr;return o.append(i,a),o}var G$=0;function zO(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function jh(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function K$(e){return e.toFixed(2)}function q$(e){if(e.length<=1)return 2;let t=2;for(;t<=6;){let r=e.map(o=>o.toFixed(t));if(new Set(r).size===new Set(e).size)return t;t++}return t}function H$(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return jr;let r=t(e.estimate);if(e.lower===void 0&&e.upper===void 0)return r;let n=e.lower===void 0||e.lower===null||isNaN(e.lower)?jr:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?jr:t(e.upper);return`${r} [${n}, ${o}]`}function Sl(e,t,r,n=!1,o=!1,i="positive"){if(isNaN(r)||!isFinite(r))return;let a=t.createElement("div");a.className="rtichoke-performance-table__bar";let s=t.createElement("div");if(s.className="rtichoke-performance-table__bar-fill",n){let c=Math.min(Math.max(r,0),50);s.style.width=`${c}%`,o?(s.classList.add("rtichoke-performance-table__bar-fill--negative"),s.style.right="50%",s.style.left="auto"):(s.classList.add("rtichoke-performance-table__bar-fill--positive"),s.style.left="50%",s.style.right="auto")}else{let c=Math.min(Math.max(r,0),100);s.style.width=`${c}%`,i==="neutral"?s.classList.add("rtichoke-performance-table__bar-fill--neutral"):s.classList.add("rtichoke-performance-table__bar-fill--positive")}a.append(s),e.append(a)}function U1(e,t=globalThis.document){_y(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let K=t.createElement("div");K.className="rtichoke-performance-table__title",K.textContent=e.title,r.append(K)}let n=t.createElement("div");n.className="rtichoke-performance-table__scroll";let o=t.createElement("table");o.className="rtichoke-performance-table__table";let i=new Map(e.evaluations.map(K=>[K.id,K])),a=new Set(e.evaluations.map(K=>K.model).filter(Boolean)),s=new Set(e.evaluations.map(K=>K.population).filter(Boolean)),c=a.size>1,u=s.size>1,f=c,m=u||!c&&a.size===0&&s.size>1,l=e.evaluations.some(K=>K.label?!!(c&&K.label!==K.model||u&&K.label!==K.population||!c&&!u&&K.label!==K.model&&K.label!==K.population):!1),p=e.rows.some(K=>K.horizon!==void 0),h=e.rows.some(K=>K.context?.censoringHeuristic!==void 0),y=e.rows.some(K=>K.context?.competingEventHeuristic!==void 0),b=new Set(e.rows.map(K=>K.operatingPoint.type)),w=b.size===1&&b.has("probability_threshold"),g=b.size===1&&b.has("ppcr"),_=new Set(e.metrics.map(K=>K.id)),x=_.has("predicted_positives"),I=_.has("ppcr"),S=x&&(I||g),v=w||!g&&b.has("probability_threshold"),T=S,O=g&&!S,R=!w&&!g&&!S,C=e.rows.filter(K=>K.operatingPoint.type==="probability_threshold").map(K=>K.operatingPoint.value),k=q$(C),z=B$.map(K=>{let Z=e.metrics.find(Y=>Y.id===K.id);return Z?{id:Z.id,label:Z.label||K.defaultLabel}:null}).filter(K=>K!==null),j=new Set,M=z.filter(K=>j.has(K.label)?!1:(j.add(K.label),!0)),U=0,L=0;for(let K of e.rows)for(let Z of K.values)if(Z.metricId==="lift"&&Z.estimate!==null&&Z.estimate!==void 0&&isFinite(Z.estimate)&&Z.estimate>U&&(U=Z.estimate),Z.metricId==="net_benefit"&&Z.estimate!==null&&Z.estimate!==void 0&&isFinite(Z.estimate)){let Y=Math.abs(Z.estimate);Y>L&&(L=Y)}let re=++G$,V=t.createElement("thead");V.className="rtichoke-performance-table__header";let q=t.createElement("tr"),H=t.createElement("tr"),W=1;if(H.append(yt(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),f&&(W++,H.append(yt(t,"Model"))),m&&(W++,H.append(yt(t,"Population"))),l&&(W++,H.append(yt(t,"Evaluation"))),v&&(W++,H.append(yt(t,"Probability Threshold"))),T&&(W++,H.append(yt(t,"Predicted Positives"))),O&&(W++,H.append(yt(t,"PPCR"))),R&&(W++,H.append(yt(t,"Operating Point"))),p&&(W++,H.append(yt(t,"Time Horizon"))),h&&(W++,H.append(yt(t,"Censoring"))),y&&(W++,H.append(yt(t,"Competing Event"))),M.length>0){let K=yt(t,"",{colSpan:W,className:"rtichoke-performance-table__spanner--empty"});q.append(K)}if(M.length>0){let K=yt(t,"Performance Metrics",{colSpan:M.length,className:"rtichoke-performance-table__spanner"});q.append(K);for(let Z of M)H.append(yt(t,Z.label,{className:"rtichoke-performance-table__metric-header"}))}V.append(q),V.append(H),o.append(V);let te=W+M.length,be=t.createElement("tbody");for(let K=0;K0?"100.00%":jr,mf.append(we,Me),Ta.append(mf),va.append(Ta),bt.append(va),ue.append(bt),oe.append(ue),E.append(oe),G.addEventListener("click",()=>{if(!E)return;let he=G.getAttribute("aria-expanded")==="true";G.setAttribute("aria-expanded",he?"false":"true"),G.setAttribute("aria-label",he?"Show confusion matrix detail":"Hide confusion matrix detail"),G.textContent=he?"\u25B8":"\u25BE",E.hidden=he})}ee.append(Q),f&&ee.append(Jn(t,Y?.model??jr,"rtichoke-performance-table__model")),m&&ee.append(Jn(t,Y?.population??jr,"rtichoke-performance-table__population")),l&&ee.append(Jn(t,Y?.label??Y?.id??jr,"rtichoke-performance-table__evaluation"));let me=new Map(Z.values.map(G=>[G.metricId,G]));if(v){let G=Z.operatingPoint.type==="probability_threshold"?Z.operatingPoint.value:void 0,oe=G!==void 0?G.toFixed(k):jr;ee.append(Jn(t,oe,"rtichoke-performance-table__op"))}if(T){let G=me.get("predicted_positives")?.estimate,oe=me.get("ppcr")?.estimate??(Z.operatingPoint.type==="ppcr"?Z.operatingPoint.value:void 0),ue=jr,Ce=NaN;if(G!=null&&oe!==void 0&&oe!==null){let bt=jh(G),ao=(oe*100).toFixed(2);ue=`${bt} (${ao}%)`,Ce=oe*100}else oe!=null&&(ue=`${(oe*100).toFixed(2)}%`,Ce=oe*100);let Ge=Jn(t,ue,"rtichoke-performance-table__op");isNaN(Ce)||Sl(Ge,t,Ce,!1,!1,"neutral"),ee.append(Ge)}if(O){let G=Z.operatingPoint.type==="ppcr"?Z.operatingPoint.value:me.get("ppcr")?.estimate,oe=G!=null?`PPCR ${G.toFixed(2)}`:jr,ue=Jn(t,oe,"rtichoke-performance-table__op");G!=null&&Sl(ue,t,G*100,!1,!1,"neutral"),ee.append(ue)}if(R){let G=Z.operatingPoint.type==="ppcr"?`PPCR ${Z.operatingPoint.value.toFixed(2)}`:`Threshold ${Z.operatingPoint.value.toFixed(k)}`;ee.append(Jn(t,G,"rtichoke-performance-table__op"))}if(p&&ee.append(Jn(t,Z.horizon!==void 0?jh(Z.horizon):jr,"rtichoke-performance-table__horizon")),h){let G=Z.context?.censoringHeuristic;ee.append(Jn(t,G?zO(G):jr,"rtichoke-performance-table__context"))}if(y){let G=Z.context?.competingEventHeuristic;ee.append(Jn(t,G?zO(G):jr,"rtichoke-performance-table__context"))}for(let G of M){let oe=me.get(G.id),ue=H$(oe,K$),Ce=Jn(t,ue,"rtichoke-performance-table__metric");if(Ce.dataset.metricId=G.id,oe&&oe.estimate!==null&&oe.estimate!==void 0&&isFinite(oe.estimate)){let Ge=oe.estimate;if(["sensitivity","specificity","ppv","npv"].includes(G.id))Sl(Ce,t,Ge*100);else if(G.id==="lift"){let bt=U>0?Ge/U*100:0;Sl(Ce,t,bt)}else if(G.id==="net_benefit"&&L>0){let bt=Ge<0,ao=Math.abs(Ge)/L*50;Sl(Ce,t,ao,!0,bt)}}ee.append(Ce)}be.append(ee),E&&be.append(E)}return o.append(be),n.append(o),r.append(n),r}var Y$=0;function W$(e,t){let{emphasizedTrue:r,nonEmphasizedTrue:n,emphasizedFalse:o,nonEmphasizedFalse:i}=e;switch(t){case"predicted_positives":return{tp:r,fp:o,tn:n,fn:i};case"predicted_negatives":return{tn:r,fn:o,tp:n,fp:i};case"real_positives":return{tp:r,fn:o,tn:n,fp:i};case"real_negatives":return{tn:r,fp:o,tp:n,fn:i};case"all_observations":default:return{tp:r,fp:o,tn:r,fn:o}}}function GO(e,t,r,n,o){let i=e.operatingPoints.filter(I=>I.evaluationId===t&&I.type===r).sort((I,S)=>I.value-S.value),a=i.find(I=>Math.abs(I.value-n)<1e-6)??i[0],s=a?a.cutoff:0,c=a?a.realizedPpcr:0,u=e.bins.filter(I=>I.evaluationId===t).sort((I,S)=>I.lower-S.lower),f=0;for(let I of u)f+=I.nPositive+I.nNegative;let m=null,l=null;if(a?.performance&&a.performance.length>0){let I=M=>{let U=a.performance?.find(L=>L.metricId===M);return U&&U.estimate!==void 0&&U.estimate!==null?U.estimate:null},S=I("true_positives"),v=I("false_positives"),T=I("true_negatives"),O=I("false_negatives"),R=I("sensitivity"),C=I("specificity"),k=I("ppv"),z=I("npv"),j=I("lift");if((R!==null||C!==null||k!==null||z!==null||j!==null)&&(m={sensitivity:R,specificity:C,ppv:k,npv:z,lift:j}),S!==null&&v!==null&&T!==null&&O!==null){let M=S+O,U=T+v,L=S+v,re=T+O;l={tp:S,fp:v,tn:T,fn:O,totalPositives:M,totalNegatives:U,totalPredictedPos:L,totalPredictedNeg:re}}}let p=e.evaluations.find(I=>I.id===t),h=p?.label??p?.model??p?.population??t,y=[],b=[];if(r==="probability_threshold"){let I=u.find(v=>v.lower===0&&v.upper===0),S=u.filter(v=>!(v.lower===0&&v.upper===0));if(I){let v=s===0?!0:I.upper>s,T=v?"TP":"FN",O=v?"True Positive (TP)":"False Negative (FN)",R=v?"FP":"TN",C=v?"False Positive (FP)":"True Negative (TN)";I.nPositive>0&&b.push({category:"Observed Positives",count:I.nPositive,classificationCell:T,cellLabel:O,title:Ct(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Positive"],["Count",I.nPositive],["Classification",O]])}),I.nNegative>0&&b.push({category:"Observed Negatives",count:I.nNegative,classificationCell:R,cellLabel:C,title:Ct(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Negative"],["Count",I.nNegative],["Classification",C]])})}for(let v=0;vs,z=k?"TP":"FN",j=k?"True Positive (TP)":"False Negative (FN)",M=k?"FP":"TN",U=k?"False Positive (FP)":"True Negative (TN)",L=s===0?!0:T.upper>s,re=L?"TP":"FN",V=L?"True Positive (TP)":"False Negative (FN)",q=L?"FP":"TN",H=L?"False Positive (FP)":"True Negative (TN)",W=I.nPositive+T.nPositive,te=I.nNegative+T.nNegative;z===re?W>0&&y.push({x1:O,x2:R,category:"Observed Positives",count:W,classificationCell:re,cellLabel:V,isPredictedPositive:L,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",W],["Classification",V]])}):(I.nPositive>0&&y.push({x1:O,x2:R,category:"Observed Positives",count:I.nPositive,classificationCell:z,cellLabel:j,isPredictedPositive:k,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",I.nPositive],["Classification",j]])}),T.nPositive>0&&y.push({x1:O,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:re,cellLabel:V,isPredictedPositive:L,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",V]])})),M===q?te>0&&y.push({x1:O,x2:R,category:"Observed Negatives",count:te,classificationCell:q,cellLabel:H,isPredictedPositive:L,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",te],["Classification",H]])}):(I.nNegative>0&&y.push({x1:O,x2:R,category:"Observed Negatives",count:I.nNegative,classificationCell:M,cellLabel:U,isPredictedPositive:k,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",I.nNegative],["Classification",U]])}),T.nNegative>0&&y.push({x1:O,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:q,cellLabel:H,isPredictedPositive:L,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",H]])}))}else{let k=s===0?!0:T.upper>s,z=k?"TP":"FN",j=k?"True Positive (TP)":"False Negative (FN)",M=k?"FP":"TN",U=k?"False Positive (FP)":"True Negative (TN)";T.nPositive>0&&y.push({x1:O,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:z,cellLabel:j,isPredictedPositive:k,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",j]])}),T.nNegative>0&&y.push({x1:O,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:M,cellLabel:U,isPredictedPositive:k,title:Ct(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",U]])})}}}else{let I=(e.rankBins??[]).filter(S=>S.evaluationId===t).sort((S,v)=>S.rankLower-v.rankLower);for(let S of I){let v=S.rankLower,T=S.rankUpper,O=S.positiveMass+S.negativeMass,R=v>=1-n-1e-9,C=R?"TP":"FN",k=R?"True Positive (TP)":"False Negative (FN)",z=R?"FP":"TN",j=R?"False Positive (FP)":"True Negative (TN)";if(O>0){let M=`[${v.toFixed(o)}, ${T.toFixed(o)}]`;S.positiveMass>0&&y.push({x1:v,x2:T,category:"Observed Positives",count:S.positiveMass,classificationCell:C,cellLabel:k,isPredictedPositive:R,title:Ct(o,[["Evaluation",h],["Population Rank Percentile",M],["Outcome","Observed Positive"],["Count",S.positiveMass],["Classification",k]])}),S.negativeMass>0&&y.push({x1:v,x2:T,category:"Observed Negatives",count:S.negativeMass,classificationCell:z,cellLabel:j,isPredictedPositive:R,title:Ct(o,[["Evaluation",h],["Population Rank Percentile",M],["Outcome","Observed Negative"],["Count",S.negativeMass],["Classification",j]])})}}}let w=s,g="Prediction Score",_="Count",x=1;if(r==="probability_threshold"){w=s,g="Prediction Score";let I=0,S=new Map;for(let v of y)S.set(v.x1,(S.get(v.x1)??0)+v.count);for(let v of S.values())I=Math.max(I,v);x=Math.max(1,Math.ceil(I*1.15))}else{w=1-n,g="Risk Percentile";let I=0,S=new Map;for(let v of y)S.set(v.x1,(S.get(v.x1)??0)+v.count);for(let v of S.values())I=Math.max(I,v);x=Math.max(1,Math.ceil(I*1.15))}return{evalId:t,evalLabel:h,dim:r,currentValue:n,cutoff:s,realizedPpcr:c,cutoffX:w,xAxisLabel:g,yAxisLabel:_,yMax:x,totalN:f,performanceMetrics:m,confusion:l,ordinaryPlotData:y,zeroAtomPlotData:b}}function B1(e,t={}){$f(e);let r=++Y$,n=On(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=ee=>{let A=new Set;for(let Q of e.operatingPoints)Q.evaluationId===ee&&A.add(Q.type);let B=[];return A.has("probability_threshold")&&B.push("probability_threshold"),A.has("ppcr")&&B.push("ppcr"),B},c=(ee,A)=>e.operatingPoints.filter(B=>B.evaluationId===ee&&B.type===A).sort((B,Q)=>B.value-Q.value),u=s(a),f=e.operatingPoint?.dimension&&u.includes(e.operatingPoint.dimension)?e.operatingPoint.dimension:u[0]??"probability_threshold",m=(ee,A)=>{let B=c(ee,A);return[...new Set(B.map(Q=>Q.value))].sort((Q,E)=>Q-E)},l=(ee,A,B)=>{let Q=m(ee,A);return Q.length===0?0:B!==void 0&&Q.some(E=>Math.abs(E-B)<1e-6)?B:Q.some(E=>Math.abs(E-.5)<1e-6)?.5:Q[0]},p=l(a,f),h="stacked",y="confusion_matrix_cell",b="all_observations",w=document.createElement("div");w.className="rtichoke-prediction-distribution",w.style.width=`${o.width}px`,w.style.maxWidth="100%";let g=document.createElement("div");g.className="rtichoke-prediction-distribution__controls";let _=document.createElement("select");_.className="rtichoke-prediction-distribution__select",_.setAttribute("aria-label","Evaluation"),_.style.display="none";let x=document.createElement("select");x.className="rtichoke-prediction-distribution__select",x.setAttribute("aria-label","Color bars by"),x.style.display="none";let I=document.createElement("option");I.value="confusion_matrix_cell",I.textContent="Confusion matrix cell";let S=document.createElement("option");S.value="observed_outcome",S.textContent="Observed outcome",x.append(I,S);let v=document.createElement("label");v.className="rtichoke-prediction-distribution__control-group";let T=document.createElement("select");T.className="rtichoke-prediction-distribution__select",T.setAttribute("aria-label","Condition on");let O=document.createElement("option");O.value="predicted_positives",O.textContent="Predicted positives";let R=document.createElement("option");R.value="predicted_negatives",R.textContent="Predicted negatives";let C=document.createElement("option");C.value="real_positives",C.textContent="Real positives";let k=document.createElement("option");k.value="real_negatives",k.textContent="Real negatives",T.append(O,R,C,k),v.append(T);let z=document.createElement("select");z.className="rtichoke-prediction-distribution__select",z.setAttribute("aria-label","Operating point dimension"),z.style.display="none",_.addEventListener("change",()=>{a=_.value,Y()}),x.addEventListener("change",()=>{y=x.value,Y()}),T.addEventListener("change",()=>{b=T.value,Y()}),z.addEventListener("change",()=>{f=z.value,p=l(a,f,p),Y()});let j=(ee,A,B,Q,E)=>{let me=document.createElement("div");me.className="rtichoke-pd-radio-group",me.setAttribute("role","radiogroup"),me.setAttribute("aria-label",ee);let G=document.createElement("span");G.className="rtichoke-pd-radio-group-label",G.textContent=`${ee}:`,me.append(G);let oe=document.createElement("div");oe.className="rtichoke-pd-radio-options";for(let ue of B){let Ce=document.createElement("label");Ce.className="rtichoke-pd-radio-option";let Ge=document.createElement("input");Ge.type="radio",Ge.name=A,Ge.value=ue.value,Ge.checked=ue.value===Q,Ge.addEventListener("change",()=>{Ge.checked&&E(ue.value)});let bt=document.createElement("span");bt.textContent=ue.label,Ce.append(Ge,bt),oe.append(Ce)}return me.append(oe),me},M=document.createElement("div");M.className="rtichoke-pd-controls-row";let U=()=>{M.replaceChildren(),_.replaceChildren();for(let ee of e.evaluations){let A=document.createElement("option");A.value=ee.id,A.textContent=ee.label??ee.model??ee.population??ee.id,_.append(A)}if(_.value=a,e.evaluations.length>1){let ee=e.evaluations.map(B=>({value:B.id,label:B.label??B.model??B.population??B.id})),A=j("Reference Group",`pd-ref-group-${r}`,ee,a,B=>{a=B,Y()});M.append(A)}},L=document.createElement("div");L.className="rtichoke-pd-controls-row";let re=document.createElement("div");re.className="rtichoke-operating-point-control",re.style.marginLeft=`${o.margins.left}px`,re.style.marginRight=`${o.margins.right}px`;let V=document.createElement("label");V.className="rtichoke-operating-point-label";let q=document.createElement("span"),H=document.createElement("span");H.className="rtichoke-operating-point-value",V.append(q,H);let W=document.createElement("input");W.type="range",W.className="rtichoke-operating-point-slider",re.append(V,W);let te=document.createElement("div");te.className="rtichoke-legend",te.style.paddingLeft=`${o.margins.left}px`;let be=(ee,A)=>{let B=document.createElement("div");B.className="rtichoke-legend-item";let Q=document.createElement("span");Q.className="rtichoke-legend-swatch";let E=document.createElement("span");E.className="rtichoke-legend-line",E.style.backgroundColor=A,E.style.border=`1px solid ${o.axis.color}`,E.style.boxSizing="border-box",E.style.height="10px",E.style.borderRadius="2px",Q.append(E);let me=document.createElement("span");return me.className="rtichoke-legend-label",me.textContent=ee,B.append(Q,me),B},K=document.createElement("div");K.className="rtichoke-prediction-distribution__chart";let Z=document.createElement("div");Z.className="rtichoke-prediction-distribution__summary",g.append(M,L),w.append(g,Z,re,te,K);let Y=()=>{U(),L.replaceChildren(),x.value=y,T.value=b==="all_observations"?"predicted_positives":b,v.style.display=y==="observed_outcome"?"none":"inline-flex",z.replaceChildren();let ee=s(a);for(let we of ee){let Me=document.createElement("option");Me.value=we,Me.textContent=we==="probability_threshold"?"Probability threshold":"PPCR",z.append(Me)}z.value=f;let A=j("Display",`pd-display-${r}`,[{value:"stacked",label:"Stacked"},{value:"mirrored",label:"Mirrored"}],h,we=>{h=we,Y()}),B=j("Color Bars By",`pd-color-${r}`,[{value:"confusion_matrix_cell",label:"Confusion Matrix Cell"},{value:"observed_outcome",label:"Observed Outcome"}],y,we=>{y=we,Y()});if(L.append(A,B,_,x,v,z),ee.length>1){let we=j("Dimension",`pd-dim-${r}`,[{value:"probability_threshold",label:"Probability Threshold"},{value:"ppcr",label:"PPCR"}],f,Me=>{f=Me,p=l(a,f,p),Y()});L.append(we)}let Q=m(a,f),E=Q.find(we=>Math.abs(we-p)<1e-6);E!==void 0?p=E:p=l(a,f,p);let me=Q.indexOf(p);W.min="0",W.max=String(Math.max(0,Q.length-1)),W.step="1",W.value=String(Math.max(0,me));let G=f==="probability_threshold"?"Probability threshold":"PPCR";q.textContent=`${G}: `,H.textContent=p.toFixed(i),W.setAttribute("aria-label",G),W.setAttribute("aria-valuetext",p.toFixed(i));let oe=GO(e,a,f,p,i),{cutoff:ue,cutoffX:Ce,xAxisLabel:Ge,yAxisLabel:bt,yMax:ao,totalN:so,performanceMetrics:zo,confusion:va,ordinaryPlotData:Mr}=oe,co=W$(o.predictionDistribution,b);te.replaceChildren(),y==="observed_outcome"&&te.append(be("Observed Positives",o.predictionDistribution.observedPositive),be("Observed Negatives",o.predictionDistribution.observedNegative));let Go=[],s0=f==="probability_threshold"?`Cutoff = ${ue.toFixed(i)}`:`PPCR = ${p.toFixed(i)}`,Tl=ao,Pa=h==="mirrored"?-ao:0;Go.push(yl([Ce],{stroke:o.axis.color,strokeWidth:2,strokeDasharray:"4,3"})),Go.push(ef([{x:Ce,label:s0}],{x:"x",y:Tl,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700})),h==="mirrored"&&Go.push(Qn([0],{stroke:o.axis.color,strokeWidth:1.5}));let Ko=we=>{let Me="";if(y==="observed_outcome")Me=we.category==="Observed Positives"?o.predictionDistribution.observedPositive:o.predictionDistribution.observedNegative;else switch(we.classificationCell){case"TP":Me=co.tp;break;case"FP":Me=co.fp;break;case"TN":Me=co.tn;break;case"FN":Me=co.fn;break}let he=!0;switch(b){case"all_observations":he=!0;break;case"predicted_positives":he=we.isPredictedPositive;break;case"predicted_negatives":he=!we.isPredictedPositive;break;case"real_positives":he=we.category==="Observed Positives";break;case"real_negatives":he=we.category==="Observed Negatives";break}return{fill:Me,fillOpacity:he?.88:.18,strokeOpacity:he?.4:.1}};if(h==="stacked"){let we=Mr.map(Me=>{let{fill:he,fillOpacity:gr,strokeOpacity:fo}=Ko(Me);return{...Me,fill:he,fillOpacity:gr,strokeOpacity:fo}});Go.push(Ri(we,Th({x1:"x1",x2:"x2",y:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Me=>Me.title,tip:!0})))}else{let we=Mr.filter(he=>he.category==="Observed Positives").map(he=>{let{fill:gr,fillOpacity:fo,strokeOpacity:Ei}=Ko(he);return{...he,fill:gr,fillOpacity:fo,strokeOpacity:Ei}}),Me=Mr.filter(he=>he.category==="Observed Negatives").map(he=>{let{fill:gr,fillOpacity:fo,strokeOpacity:Ei}=Ko(he);return{...he,fill:gr,fillOpacity:fo,strokeOpacity:Ei}});we.length>0&&Go.push(Ri(we,{x1:"x1",x2:"x2",y1:0,y2:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:he=>he.title,tip:!0})),Me.length>0&&Go.push(Ri(Me,{x1:"x1",x2:"x2",y1:0,y2:he=>-he.count,fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:he=>he.title,tip:!0}))}let Ta={width:o.width,height:Math.round(o.height*.68),marginTop:o.margins.top+10,marginRight:o.margins.right,marginBottom:o.margins.bottom,marginLeft:o.margins.left,style:{background:o.background,color:o.axis.color,fontFamily:o.typography.fontFamily,fontSize:`${o.typography.fontSize}px`},x:{label:Ge,domain:[0,1],grid:!1,line:!0,ticks:o.axis.ticks,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:o.axis.numberFormat},y:{label:bt,domain:[Pa,Tl],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:we=>String(Math.abs(we))},marks:Go},mf=Uo(Ta,o);if(K.replaceChildren(mf),Z.replaceChildren(),va){let{tp:we,fp:Me,tn:he,fn:gr,totalPositives:fo,totalNegatives:Ei,totalPredictedPos:Ml,totalPredictedNeg:Jt}=va,Br=document.createElement("table");Br.className="rtichoke-pd-matrix";let df=document.createElement("colgroup"),Ps=document.createElement("col");Ps.style.width="28%";let Ts=document.createElement("col");Ts.style.width="24%";let Ms=document.createElement("col");Ms.style.width="24%";let Ol=document.createElement("col");Ol.style.width="24%",df.append(Ps,Ts,Ms,Ol),Br.append(df);let hf=(Ye,tt)=>{let Fi=document.createElement("label");Fi.className=`rtichoke-pd-cond-option ${b===Ye?"rtichoke-pd-cond-option--active":""}`;let Cn=document.createElement("input");Cn.type="radio",Cn.name=`pd-cond-${r}`,Cn.value=Ye,Cn.checked=b===Ye,Cn.addEventListener("change",()=>{Cn.checked&&(b=Ye,Y())});let qo=document.createElement("span");return qo.textContent=tt,Fi.append(Cn,qo),Fi},ow=document.createElement("thead"),iw=document.createElement("tr"),c0=document.createElement("th");c0.className="rtichoke-pd-matrix__corner",c0.append(hf("all_observations","All Observations"));let f0=document.createElement("th");f0.className=`rtichoke-pd-matrix__col-header ${b==="real_positives"?"rtichoke-pd-matrix__col-header--active":""}`,f0.append(hf("real_positives","Real Positive"));let u0=document.createElement("th");u0.className=`rtichoke-pd-matrix__col-header ${b==="real_negatives"?"rtichoke-pd-matrix__col-header--active":""}`,u0.append(hf("real_negatives","Real Negative"));let aw=document.createElement("th");aw.className="rtichoke-pd-matrix__col-header rtichoke-pd-matrix__col-header--blank",iw.append(c0,f0,u0,aw),ow.append(iw);let sw=document.createElement("tbody"),bC=y==="observed_outcome"?o.predictionDistribution.observedPositive:co.tp,gC=y==="observed_outcome"?o.predictionDistribution.observedPositive:co.fn,xC=y==="observed_outcome"?o.predictionDistribution.observedNegative:co.fp,wC=y==="observed_outcome"?o.predictionDistribution.observedNegative:co.tn,SC=o.predictionDistribution.observedPositive,IC=o.predictionDistribution.observedNegative,l0="#E5E7EB",_C=Ye=>{if(so===0)return null;switch(b){case"all_observations":return`(${((Ye==="TP"?we:Ye==="FP"?Me:Ye==="TN"?he:gr)/so*100).toFixed(1)}%)`;case"predicted_positives":{let tt=we+Me;return tt===0?null:Ye==="TP"?`(${(we/tt*100).toFixed(1)}%)`:Ye==="FP"?`(${(Me/tt*100).toFixed(1)}%)`:null}case"predicted_negatives":{let tt=he+gr;return tt===0?null:Ye==="TN"?`(${(he/tt*100).toFixed(1)}%)`:Ye==="FN"?`(${(gr/tt*100).toFixed(1)}%)`:null}case"real_positives":{let tt=we+gr;return tt===0?null:Ye==="TP"?`(${(we/tt*100).toFixed(1)}%)`:Ye==="FN"?`(${(gr/tt*100).toFixed(1)}%)`:null}case"real_negatives":{let tt=he+Me;return tt===0?null:Ye==="TN"?`(${(he/tt*100).toFixed(1)}%)`:Ye==="FP"?`(${(Me/tt*100).toFixed(1)}%)`:null}}},Cl=(Ye,tt,Fi,Cn)=>{Ye.replaceChildren(),Ye.className=`rtichoke-prediction-distribution__cell--${tt.toLowerCase()} rtichoke-pd-matrix__cell`,Ye.style.backgroundColor="#ffffff",Ye.style.color=o.axis.color;let qo=so>0?Fi/so*100:0,$i=document.createElement("div");$i.className="rtichoke-pd-cell-bar",$i.style.width=`${qo}%`,$i.style.backgroundColor=Cn;let Ma=document.createElement("div");Ma.className="rtichoke-pd-cell-content";let b0=document.createElement("span");b0.className="rtichoke-pd-cell-label",b0.textContent=tt;let g0=document.createElement("div");g0.className="rtichoke-pd-cell-num";let x0=document.createElement("span");x0.className="rtichoke-pd-cell-count",x0.textContent=Fi.toLocaleString();let vC=_C(tt),w0=document.createElement("span");w0.className="rtichoke-pd-cell-pct",w0.textContent=vC??"",g0.append(x0,w0),Ma.append(b0,g0),Ye.append($i,Ma)},yf=(Ye,tt,Fi)=>{Ye.replaceChildren(),Ye.className="rtichoke-prediction-distribution__cell--total rtichoke-pd-matrix__cell",Ye.style.backgroundColor="#ffffff";let Cn=so>0?tt/so*100:0,qo=document.createElement("div");qo.className="rtichoke-pd-cell-bar",qo.style.width=`${Cn}%`,qo.style.backgroundColor=Fi;let $i=document.createElement("div");$i.className="rtichoke-pd-cell-content rtichoke-pd-cell-content--margin";let Ma=document.createElement("span");Ma.className="rtichoke-pd-cell-count",Ma.textContent=tt.toLocaleString(),$i.append(Ma),Ye.append(qo,$i)},p0=document.createElement("tr");b==="predicted_positives"&&(p0.className="rtichoke-pd-matrix__row--active");let m0=document.createElement("th");m0.className=`rtichoke-pd-matrix__row-header ${b==="predicted_positives"?"rtichoke-pd-matrix__row-header--active":""}`,m0.append(hf("predicted_positives","Predicted Positive"));let cw=document.createElement("td");Cl(cw,"TP",we,bC);let fw=document.createElement("td");Cl(fw,"FP",Me,xC);let uw=document.createElement("td");yf(uw,Ml,l0),p0.append(m0,cw,fw,uw);let d0=document.createElement("tr");b==="predicted_negatives"&&(d0.className="rtichoke-pd-matrix__row--active");let h0=document.createElement("th");h0.className=`rtichoke-pd-matrix__row-header ${b==="predicted_negatives"?"rtichoke-pd-matrix__row-header--active":""}`,h0.append(hf("predicted_negatives","Predicted Negative"));let lw=document.createElement("td");Cl(lw,"FN",gr,gC);let pw=document.createElement("td");Cl(pw,"TN",he,wC);let mw=document.createElement("td");yf(mw,Jt,l0),d0.append(h0,lw,pw,mw);let y0=document.createElement("tr");y0.className="rtichoke-pd-matrix__tot-row";let dw=document.createElement("th");dw.className="rtichoke-pd-matrix__row-header rtichoke-pd-matrix__row-header--blank";let hw=document.createElement("td");yf(hw,fo,SC);let yw=document.createElement("td");yf(yw,Ei,IC);let bw=document.createElement("td");yf(bw,so,l0),y0.append(dw,hw,yw,bw),sw.append(p0,d0,y0),Br.append(ow,sw),Z.append(Br)}if(zo){let we=document.createElement("div");we.className="rtichoke-pd-metrics-container rtichoke-performance-table";let Me=document.createElement("table");Me.className="rtichoke-performance-table__table rtichoke-pd-metrics-table";let he=document.createElement("thead"),gr=document.createElement("tr"),fo=[{id:"sensitivity",label:"Sensitivity",val:zo.sensitivity,isEmphasized:b==="real_positives",isRatio:!1},{id:"specificity",label:"Specificity",val:zo.specificity,isEmphasized:b==="real_negatives",isRatio:!1},{id:"ppv",label:"PPV",val:zo.ppv,isEmphasized:b==="predicted_positives",isRatio:!1},{id:"npv",label:"NPV",val:zo.npv,isEmphasized:b==="predicted_negatives",isRatio:!1},{id:"lift",label:"Lift",val:zo.lift,isEmphasized:b==="predicted_positives",isRatio:!0}];for(let Jt of fo){let Br=document.createElement("th");Br.className=`rtichoke-performance-table__metric-header ${Jt.isEmphasized?"rtichoke-pd-metric--emphasized-header":""}`,Br.textContent=Jt.label,gr.append(Br)}he.append(gr);let Ei=document.createElement("tbody"),Ml=document.createElement("tr");for(let Jt of fo){let Br=document.createElement("td");Br.className=`rtichoke-performance-table__metric ${Jt.isEmphasized?"rtichoke-pd-metric--emphasized-cell":""}`;let df="\u2014";if(Jt.val!==null&&Jt.val!==void 0&&(df=Jt.isRatio?Jt.val.toFixed(2):(Jt.val*100).toFixed(1)+"%"),Jt.val!==null&&Jt.val!==void 0&&isFinite(Jt.val)){let Ts=document.createElement("div");Ts.className="rtichoke-performance-table__bar";let Ms=document.createElement("div");Ms.className="rtichoke-performance-table__bar-fill rtichoke-performance-table__bar-fill--positive";let Ol=Jt.isRatio?Math.min(100,Jt.val/3*100):Math.min(100,Jt.val*100);Ms.style.width=`${Ol}%`,Ts.append(Ms),Br.append(Ts)}let Ps=document.createElement("span");Ps.className="rtichoke-performance-table__cell-text",Ps.textContent=df,Br.append(Ps),Ml.append(Br)}Ei.append(Ml),Me.append(he,Ei),we.append(Me),Z.append(we)}};return W.addEventListener("input",()=>{let ee=m(a,f),A=Number(W.value);A>=0&&A0?n[0]:void 0,i=[];if(n.length>1){let p=t.createElement("label");p.className="rtichoke-horizon-control",p.textContent="Fixed Time Horizon: ";let h=t.createElement("select");h.className="rtichoke-horizon-select",h.setAttribute("aria-label","Fixed Time Horizon");for(let y of n){let b=t.createElement("option");b.value=String(y),b.textContent=String(y),h.append(b)}h.value=String(o),h.addEventListener("change",()=>{o=Number(h.value),l()}),p.append(h),r.append(p)}let a=t.createElement("table");a.className="rtichoke-summary-metrics__table";let s=t.createElement("thead"),c=t.createElement("tr");for(let p of["Owner","Metric","Estimate"])c.append(Z$(t,p));s.append(c),a.append(s);let u=new Map(e.evaluations.map(p=>[p.id,p])),f=new Map(e.populations.map(p=>[p.id,p])),m=t.createElement("tbody");for(let p of e.metrics){let h=t.createElement("tr"),y="",b="",w;if(p.metric==="auroc"){let _=u.get(p.owner.evaluationId);y=_.label??_.model??_.population??_.id,b="AUROC",h.dataset.metric="auroc",h.dataset.evaluationId=p.owner.evaluationId}else p.metric==="prevalence"?(y=f.get(p.owner.populationId).label,b="Prevalence",h.dataset.metric="prevalence",h.dataset.populationId=p.owner.populationId):p.metric==="event_risk"&&(y=f.get(p.owner.populationId).label,b="Event Risk",w=p.horizon,h.dataset.metric="event_risk",h.dataset.populationId=p.owner.populationId,h.dataset.horizon=String(p.horizon));h.append(z1(t,y,"rtichoke-summary-metrics__owner"),z1(t,b,"rtichoke-summary-metrics__metric"));let g=z1(t,Q$(p.estimate),"rtichoke-summary-metrics__estimate");p.estimate===null?g.dataset.unavailable="true":g.dataset.estimate=String(p.estimate),h.append(g),i.push({element:h,horizon:w}),m.append(h)}a.append(m),r.append(a);function l(){for(let{element:p,horizon:h}of i)h===void 0||h===o?p.style.display="":p.style.display="none"}return l(),r}function J$(e){switch(e.errorType){case N.ArrayContains:return"Expected array to contain at least one matching value";case N.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case N.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case N.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case N.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case N.ArrayUniqueItems:return"Expected array elements to be unique";case N.Array:return"Expected array";case N.AsyncIterator:return"Expected AsyncIterator";case N.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case N.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case N.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case N.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case N.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case N.BigInt:return"Expected bigint";case N.Boolean:return"Expected boolean";case N.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case N.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case N.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case N.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case N.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case N.Date:return"Expected Date";case N.Function:return"Expected function";case N.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case N.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case N.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case N.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case N.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case N.Integer:return"Expected integer";case N.IntersectUnevaluatedProperties:return"Unexpected property";case N.Intersect:return"Expected all values to match";case N.Iterator:return"Expected Iterator";case N.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case N.Never:return"Never";case N.Not:return"Value should not match";case N.Null:return"Expected null";case N.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case N.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case N.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case N.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case N.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case N.Number:return"Expected number";case N.Object:return"Expected object";case N.ObjectAdditionalProperties:return"Unexpected property";case N.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case N.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case N.ObjectRequiredProperty:return"Expected required property";case N.Promise:return"Expected Promise";case N.RegExp:return"Expected string to match regular expression";case N.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case N.StringFormat:return`Expected string to match '${e.schema.format}' format`;case N.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case N.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case N.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case N.String:return"Expected string";case N.Symbol:return"Expected symbol";case N.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case N.Tuple:return"Expected tuple";case N.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case N.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case N.Uint8Array:return"Expected Uint8Array";case N.Undefined:return"Expected undefined";case N.Union:return"Expected union value";case N.Void:return"Expected void";case N.Kind:return`Expected kind '${e.schema[$]}'`;default:return"Unknown error type"}}var eD=J$;function KO(){return eD}var K1=class extends le{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function tD(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new K1(e);return $e(r,t)}function Xt(e,t){return!Ve(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function $e(e,t){return e[$]==="This"||e[$]==="Ref"?tD(e,t):e}var q1=class extends le{constructor(t){super("Unable to hash value"),this.value=t}},rn;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(rn||(rn={}));var ff=BigInt("14695981039346656037"),[rD,nD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],oD=Array.from({length:256}).map((e,t)=>BigInt(t)),qO=new Float64Array(1),HO=new DataView(qO.buffer),YO=new Uint8Array(qO.buffer);function*iD(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r>8*(t-1-r)&255}function aD(e){br(rn.Array);for(let t of e)uf(t)}function sD(e){br(rn.Boolean),br(e?1:0)}function cD(e){br(rn.BigInt),HO.setBigInt64(0,e);for(let t of YO)br(t)}function fD(e){br(rn.Date),uf(e.getTime())}function uD(e){br(rn.Null)}function lD(e){br(rn.Number),HO.setFloat64(0,e);for(let t of YO)br(t)}function pD(e){br(rn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())uf(t),uf(e[t])}function mD(e){br(rn.String);for(let t=0;t=e.minItems)||_e(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!Zt(e.items,t,i))return!1;if(e.uniqueItems===!0&&!(function(){let i=new Set;for(let a of r){let s=lf(a);if(i.has(s))return!1;i.add(s)}return!0})())return!1;if(!(_e(e.contains)||ot(e.minContains)||ot(e.maxContains)))return!0;let n=_e(e.contains)?e.contains:Se(),o=r.reduce((i,a)=>Zt(n,t,a)?i+1:i,0);return!(o===0||ot(e.minContains)&&oe.maxContains)}function SD(e,t,r){return Nl(r)}function ID(e,t,r){return!(!kn(r)||_e(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||_e(e.maximum)&&!(r<=e.maximum)||_e(e.minimum)&&!(r>=e.minimum)||_e(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function _D(e,t,r){return uo(r)}function vD(e,t,r){return Zt(e.returns,t,r.prototype)}function PD(e,t,r){return!(!xr(r)||_e(e.exclusiveMaximumTimestamp)&&!(r.getTime()e.exclusiveMinimumTimestamp)||_e(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||_e(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||_e(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function TD(e,t,r){return Di(r)}function MD(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Zt(o,[...t,...n],r)}function OD(e,t,r){return!(!Fl(r)||_e(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||_e(e.maximum)&&!(r<=e.maximum)||_e(e.minimum)&&!(r>=e.minimum)||_e(e.multipleOf)&&r%e.multipleOf!==0)}function CD(e,t,r){let n=e.allOf.every(o=>Zt(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(Bs(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a));return n&&i}else if(ft(e.unevaluatedProperties)){let o=new RegExp(Bs(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||Zt(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function kD(e,t,r){return Al(r)}function RD(e,t,r){return r===e.const}function ND(e,t,r){return!1}function AD(e,t,r){return!Zt(e.not,t,r)}function ED(e,t,r){return Wo(r)}function FD(e,t,r){return!(!kt.IsNumberLike(r)||_e(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||_e(e.minimum)&&!(r>=e.minimum)||_e(e.maximum)&&!(r<=e.maximum)||_e(e.multipleOf)&&r%e.multipleOf!==0)}function $D(e,t,r){if(!kt.IsObjectLike(r)||_e(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||_e(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let n=Object.getOwnPropertyNames(e.properties);for(let o of n){let i=e.properties[o];if(e.required&&e.required.includes(o)){if(!Zt(i,t,r[o])||(Da(i)||bD(i))&&!(o in r))return!1}else if(kt.IsExactOptionalProperty(r,o)&&!Zt(i,t,r[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(r);return e.required&&e.required.length===n.length&&o.length===n.length?!0:o.every(i=>n.includes(i))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(r).every(i=>n.includes(i)||Zt(e.additionalProperties,t,r[i])):!0}function DD(e,t,r){return El(r)}function LD(e,t,r){if(!kt.IsRecordLike(r)||_e(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||_e(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),a=Object.entries(r).every(([u,f])=>i.test(u)?Zt(o,t,f):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([u,f])=>i.test(u)?!0:Zt(e.additionalProperties,t,f)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(u=>i.test(u)):!0;return a&&s&&c}function VD(e,t,r){return Zt($e(e,t),t,r)}function jD(e,t,r){let n=new RegExp(e.source,e.flags);return _e(e.minLength)&&!(r.length>=e.minLength)||_e(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function UD(e,t,r){return!Ve(r)||_e(e.minLength)&&!(r.length>=e.minLength)||_e(e.maxLength)&&!(r.length<=e.maxLength)||_e(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:_e(e.format)?Bi.Has(e.format)?Bi.Get(e.format)(r):!1:!0}function BD(e,t,r){return Xo(r)}function zD(e,t,r){return Ve(r)&&new RegExp(e.pattern).test(r)}function GD(e,t,r){return Zt($e(e,t),t,r)}function KD(e,t,r){if(!fe(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;nZt(n,t,r))}function YD(e,t,r){return!(!Cs(r)||_e(e.maxByteLength)&&!(r.length<=e.maxByteLength)||_e(e.minByteLength)&&!(r.length>=e.minByteLength))}function WD(e,t,r){return!0}function XD(e,t,r){return kt.IsVoidLike(r)}function ZD(e,t,r){return Ln.Has(e[$])?Ln.Get(e[$])(e,r):!1}function Zt(e,t,r){let n=_e(e.$id)?Xt(e,t):t,o=e;switch(o[$]){case"Any":return gD(o,n,r);case"Argument":return xD(o,n,r);case"Array":return wD(o,n,r);case"AsyncIterator":return SD(o,n,r);case"BigInt":return ID(o,n,r);case"Boolean":return _D(o,n,r);case"Constructor":return vD(o,n,r);case"Date":return PD(o,n,r);case"Function":return TD(o,n,r);case"Import":return MD(o,n,r);case"Integer":return OD(o,n,r);case"Intersect":return CD(o,n,r);case"Iterator":return kD(o,n,r);case"Literal":return RD(o,n,r);case"Never":return ND(o,n,r);case"Not":return AD(o,n,r);case"Null":return ED(o,n,r);case"Number":return FD(o,n,r);case"Object":return $D(o,n,r);case"Promise":return DD(o,n,r);case"Record":return LD(o,n,r);case"Ref":return VD(o,n,r);case"RegExp":return jD(o,n,r);case"String":return UD(o,n,r);case"Symbol":return BD(o,n,r);case"TemplateLiteral":return zD(o,n,r);case"This":return GD(o,n,r);case"Tuple":return KD(o,n,r);case"Undefined":return qD(o,n,r);case"Union":return HD(o,n,r);case"Uint8Array":return YD(o,n,r);case"Unknown":return WD(o,n,r);case"Void":return XD(o,n,r);default:if(!Ln.Has(o[$]))throw new H1(o);return ZD(o,n,r)}}function xe(...e){return e.length===3?Zt(e[0],e[1],e[2]):Zt(e[0],[],e[1])}var N;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(N||(N={}));var Y1=class extends le{constructor(t){super("Unknown type"),this.schema=t}};function Ni(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ve(e){return e!==void 0}var Ia=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function J(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:KO()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*QD(e,t,r,n){}function*JD(e,t,r,n){}function*eL(e,t,r,n){if(!fe(n))return yield J(N.Array,e,r,n);ve(e.minItems)&&!(n.length>=e.minItems)&&(yield J(N.ArrayMinItems,e,r,n)),ve(e.maxItems)&&!(n.length<=e.maxItems)&&(yield J(N.ArrayMaxItems,e,r,n));for(let a=0;aQt(o,t,`${r}${c}`,s).next().done===!0?a+1:a,0);i===0&&(yield J(N.ArrayContains,e,r,n)),ot(e.minContains)&&ie.maxContains&&(yield J(N.ArrayMaxContains,e,r,n))}function*tL(e,t,r,n){Nl(n)||(yield J(N.AsyncIterator,e,r,n))}function*rL(e,t,r,n){if(!kn(n))return yield J(N.BigInt,e,r,n);ve(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield J(N.BigIntExclusiveMinimum,e,r,n)),ve(e.maximum)&&!(n<=e.maximum)&&(yield J(N.BigIntMaximum,e,r,n)),ve(e.minimum)&&!(n>=e.minimum)&&(yield J(N.BigIntMinimum,e,r,n)),ve(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield J(N.BigIntMultipleOf,e,r,n))}function*nL(e,t,r,n){uo(n)||(yield J(N.Boolean,e,r,n))}function*oL(e,t,r,n){yield*Qt(e.returns,t,r,n.prototype)}function*iL(e,t,r,n){if(!xr(n))return yield J(N.Date,e,r,n);ve(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield J(N.DateExclusiveMinimumTimestamp,e,r,n)),ve(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield J(N.DateMaximumTimestamp,e,r,n)),ve(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield J(N.DateMinimumTimestamp,e,r,n)),ve(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield J(N.DateMultipleOfTimestamp,e,r,n))}function*aL(e,t,r,n){Di(n)||(yield J(N.Function,e,r,n))}function*sL(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*Qt(i,[...t,...o],r,n)}function*cL(e,t,r,n){if(!Fl(n))return yield J(N.Integer,e,r,n);ve(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield J(N.IntegerExclusiveMinimum,e,r,n)),ve(e.maximum)&&!(n<=e.maximum)&&(yield J(N.IntegerMaximum,e,r,n)),ve(e.minimum)&&!(n>=e.minimum)&&(yield J(N.IntegerMinimum,e,r,n)),ve(e.multipleOf)&&n%e.multipleOf!==0&&(yield J(N.IntegerMultipleOf,e,r,n))}function*fL(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of Qt(i,t,r,n))o=!0,yield a;if(o)return yield J(N.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(Bs(e));for(let a of Object.getOwnPropertyNames(n))i.test(a)||(yield J(N.IntersectUnevaluatedProperties,e,`${r}/${a}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(Bs(e));for(let a of Object.getOwnPropertyNames(n))if(!i.test(a)){let s=Qt(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*uL(e,t,r,n){Al(n)||(yield J(N.Iterator,e,r,n))}function*lL(e,t,r,n){n!==e.const&&(yield J(N.Literal,e,r,n))}function*pL(e,t,r,n){yield J(N.Never,e,r,n)}function*mL(e,t,r,n){Qt(e.not,t,r,n).next().done===!0&&(yield J(N.Not,e,r,n))}function*dL(e,t,r,n){Wo(n)||(yield J(N.Null,e,r,n))}function*hL(e,t,r,n){if(!kt.IsNumberLike(n))return yield J(N.Number,e,r,n);ve(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield J(N.NumberExclusiveMinimum,e,r,n)),ve(e.maximum)&&!(n<=e.maximum)&&(yield J(N.NumberMaximum,e,r,n)),ve(e.minimum)&&!(n>=e.minimum)&&(yield J(N.NumberMinimum,e,r,n)),ve(e.multipleOf)&&n%e.multipleOf!==0&&(yield J(N.NumberMultipleOf,e,r,n))}function*yL(e,t,r,n){if(!kt.IsObjectLike(n))return yield J(N.Object,e,r,n);ve(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield J(N.ObjectMinProperties,e,r,n)),ve(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield J(N.ObjectMaxProperties,e,r,n));let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(n);for(let s of o)a.includes(s)||(yield J(N.ObjectRequiredProperty,e.properties[s],`${r}/${Ni(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield J(N.ObjectAdditionalProperties,e,`${r}/${Ni(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*Qt(e.additionalProperties,t,`${r}/${Ni(s)}`,n[s]));for(let s of i){let c=e.properties[s];e.required&&e.required.includes(s)?(yield*Qt(c,t,`${r}/${Ni(s)}`,n[s]),Da(e)&&!(s in n)&&(yield J(N.ObjectRequiredProperty,c,`${r}/${Ni(s)}`,void 0))):kt.IsExactOptionalProperty(n,s)&&(yield*Qt(c,t,`${r}/${Ni(s)}`,n[s]))}}function*bL(e,t,r,n){El(n)||(yield J(N.Promise,e,r,n))}function*gL(e,t,r,n){if(!kt.IsRecordLike(n))return yield J(N.Object,e,r,n);ve(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield J(N.ObjectMinProperties,e,r,n)),ve(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield J(N.ObjectMaxProperties,e,r,n));let[o,i]=Object.entries(e.patternProperties)[0],a=new RegExp(o);for(let[s,c]of Object.entries(n))a.test(s)&&(yield*Qt(i,t,`${r}/${Ni(s)}`,c));if(typeof e.additionalProperties=="object")for(let[s,c]of Object.entries(n))a.test(s)||(yield*Qt(e.additionalProperties,t,`${r}/${Ni(s)}`,c));if(e.additionalProperties===!1){for(let[s,c]of Object.entries(n))if(!a.test(s))return yield J(N.ObjectAdditionalProperties,e,`${r}/${Ni(s)}`,c)}}function*xL(e,t,r,n){yield*Qt($e(e,t),t,r,n)}function*wL(e,t,r,n){if(!Ve(n))return yield J(N.String,e,r,n);if(ve(e.minLength)&&!(n.length>=e.minLength)&&(yield J(N.StringMinLength,e,r,n)),ve(e.maxLength)&&!(n.length<=e.maxLength)&&(yield J(N.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield J(N.RegExp,e,r,n)}function*SL(e,t,r,n){if(!Ve(n))return yield J(N.String,e,r,n);ve(e.minLength)&&!(n.length>=e.minLength)&&(yield J(N.StringMinLength,e,r,n)),ve(e.maxLength)&&!(n.length<=e.maxLength)&&(yield J(N.StringMaxLength,e,r,n)),Ve(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield J(N.StringPattern,e,r,n))),Ve(e.format)&&(Bi.Has(e.format)?Bi.Get(e.format)(n)||(yield J(N.StringFormat,e,r,n)):yield J(N.StringFormatUnknown,e,r,n))}function*IL(e,t,r,n){Xo(n)||(yield J(N.Symbol,e,r,n))}function*_L(e,t,r,n){if(!Ve(n))return yield J(N.String,e,r,n);new RegExp(e.pattern).test(n)||(yield J(N.StringPattern,e,r,n))}function*vL(e,t,r,n){yield*Qt($e(e,t),t,r,n)}function*PL(e,t,r,n){if(!fe(n))return yield J(N.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield J(N.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield J(N.TupleLength,e,r,n);if(e.items)for(let o=0;onew Ia(Qt(i,t,r,n)));yield J(N.Union,e,r,n,o)}function*OL(e,t,r,n){if(!Cs(n))return yield J(N.Uint8Array,e,r,n);ve(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield J(N.Uint8ArrayMaxByteLength,e,r,n)),ve(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield J(N.Uint8ArrayMinByteLength,e,r,n))}function*CL(e,t,r,n){}function*kL(e,t,r,n){kt.IsVoidLike(n)||(yield J(N.Void,e,r,n))}function*RL(e,t,r,n){Ln.Get(e[$])(e,n)||(yield J(N.Kind,e,r,n))}function*Qt(e,t,r,n){let o=ve(e.$id)?[...t,e]:t,i=e;switch(i[$]){case"Any":return yield*QD(i,o,r,n);case"Argument":return yield*JD(i,o,r,n);case"Array":return yield*eL(i,o,r,n);case"AsyncIterator":return yield*tL(i,o,r,n);case"BigInt":return yield*rL(i,o,r,n);case"Boolean":return yield*nL(i,o,r,n);case"Constructor":return yield*oL(i,o,r,n);case"Date":return yield*iL(i,o,r,n);case"Function":return yield*aL(i,o,r,n);case"Import":return yield*sL(i,o,r,n);case"Integer":return yield*cL(i,o,r,n);case"Intersect":return yield*fL(i,o,r,n);case"Iterator":return yield*uL(i,o,r,n);case"Literal":return yield*lL(i,o,r,n);case"Never":return yield*pL(i,o,r,n);case"Not":return yield*mL(i,o,r,n);case"Null":return yield*dL(i,o,r,n);case"Number":return yield*hL(i,o,r,n);case"Object":return yield*yL(i,o,r,n);case"Promise":return yield*bL(i,o,r,n);case"Record":return yield*gL(i,o,r,n);case"Ref":return yield*xL(i,o,r,n);case"RegExp":return yield*wL(i,o,r,n);case"String":return yield*SL(i,o,r,n);case"Symbol":return yield*IL(i,o,r,n);case"TemplateLiteral":return yield*_L(i,o,r,n);case"This":return yield*vL(i,o,r,n);case"Tuple":return yield*PL(i,o,r,n);case"Undefined":return yield*TL(i,o,r,n);case"Union":return yield*ML(i,o,r,n);case"Uint8Array":return yield*OL(i,o,r,n);case"Unknown":return yield*CL(i,o,r,n);case"Void":return yield*kL(i,o,r,n);default:if(!Ln.Has(i[$]))throw new Y1(e);return yield*RL(i,o,r,n)}}function _a(...e){let t=e.length===3?Qt(e[0],e[1],"",e[2]):Qt(e[0],[],"",e[1]);return new Ia(t)}var NL=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},XO=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},W1,Uh,ZO,X1=class extends le{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),W1.add(this),Uh.set(this,void 0),NL(this,Uh,t,"f"),this.error=r}Errors(){return new Ia(XO(this,W1,"m",ZO).call(this))}};Uh=new WeakMap,W1=new WeakSet,ZO=function*(){this.error&&(yield this.error),yield*XO(this,Uh,"f")};function WO(e,t,r){if(!xe(e,t,r))throw new X1(_a(e,t,r))}function Bh(...e){return e.length===3?WO(e[0],e[1],e[2]):WO(e[0],[],e[1])}function AL(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Re(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Re(e[r]);return t}function EL(e){return e.map(t=>Re(t))}function FL(e){return e.slice()}function $L(e){return new Map(Re([...e.entries()]))}function DL(e){return new Set(Re([...e.entries()]))}function LL(e){return new Date(e.toISOString())}function Re(e){if(fe(e))return EL(e);if(xr(e))return LL(e);if(an(e))return FL(e);if(gw(e))return $L(e);if(xw(e))return DL(e);if(ye(e))return AL(e);if(Gr(e))return e;throw new Error("ValueClone: Unable to clone value")}var nn=class extends le{constructor(t,r){super(r),this.schema=t}};function Ne(e){return Di(e)?e():Re(e)}function VL(e,t){return ce(e,"default")?Ne(e.default):{}}function jL(e,t){return{}}function UL(e,t){if(e.uniqueItems===!0&&!ce(e,"default"))throw new nn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!ce(e,"default"))throw new nn(e,"Array with the contains constraint requires a default value");return"default"in e?Ne(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>on(e.items,t)):[]}function BL(e,t){return ce(e,"default")?Ne(e.default):(async function*(){})()}function zL(e,t){return ce(e,"default")?Ne(e.default):BigInt(0)}function GL(e,t){return ce(e,"default")?Ne(e.default):!1}function KL(e,t){if(ce(e,"default"))return Ne(e.default);{let r=on(e.returns,t);return typeof r=="object"&&!Array.isArray(r)?class{constructor(){for(let[n,o]of Object.entries(r)){let i=this;i[n]=o}}}:class{}}}function qL(e,t){return ce(e,"default")?Ne(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function HL(e,t){return ce(e,"default")?Ne(e.default):()=>on(e.returns,t)}function YL(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return on(n,[...t,...r])}function WL(e,t){return ce(e,"default")?Ne(e.default):e.minimum!==void 0?e.minimum:0}function XL(e,t){if(ce(e,"default"))return Ne(e.default);{let r=e.allOf.reduce((n,o)=>{let i=on(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!xe(e,t,r))throw new nn(e,"Intersect produced invalid value. Consider using a default value.");return r}}function ZL(e,t){return ce(e,"default")?Ne(e.default):(function*(){})()}function QL(e,t){return ce(e,"default")?Ne(e.default):e.const}function JL(e,t){if(ce(e,"default"))return Ne(e.default);throw new nn(e,"Never types cannot be created. Consider using a default value.")}function eV(e,t){if(ce(e,"default"))return Ne(e.default);throw new nn(e,"Not types must have a default value")}function tV(e,t){return ce(e,"default")?Ne(e.default):null}function rV(e,t){return ce(e,"default")?Ne(e.default):e.minimum!==void 0?e.minimum:0}function nV(e,t){if(ce(e,"default"))return Ne(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=on(i,t));return n}}function oV(e,t){return ce(e,"default")?Ne(e.default):Promise.resolve(on(e.item,t))}function iV(e,t){return ce(e,"default")?Ne(e.default):{}}function aV(e,t){return ce(e,"default")?Ne(e.default):on($e(e,t),t)}function sV(e,t){if(ce(e,"default"))return Ne(e.default);throw new nn(e,"RegExp types cannot be created. Consider using a default value.")}function cV(e,t){if(e.pattern!==void 0){if(ce(e,"default"))return Ne(e.default);throw new nn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(ce(e,"default"))return Ne(e.default);throw new nn(e,"String types with formats must specify a default value")}else return ce(e,"default")?Ne(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function fV(e,t){return ce(e,"default")?Ne(e.default):"value"in e?Symbol.for(e.value):Symbol()}function uV(e,t){if(ce(e,"default"))return Ne(e.default);if(!Vl(e))throw new nn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Ls(e)[0]}function lV(e,t){if(QO++>xV)throw new nn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return ce(e,"default")?Ne(e.default):on($e(e,t),t)}function pV(e,t){return ce(e,"default")?Ne(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>on(e.items[n],t))}function mV(e,t){if(ce(e,"default"))return Ne(e.default)}function dV(e,t){if(ce(e,"default"))return Ne(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return on(e.anyOf[0],t)}function hV(e,t){return ce(e,"default")?Ne(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function yV(e,t){return ce(e,"default")?Ne(e.default):{}}function bV(e,t){if(ce(e,"default"))return Ne(e.default)}function gV(e,t){if(ce(e,"default"))return Ne(e.default);throw new Error("User defined types must specify a default value")}function on(e,t){let r=Xt(e,t),n=e;switch(n[$]){case"Any":return VL(n,r);case"Argument":return jL(n,r);case"Array":return UL(n,r);case"AsyncIterator":return BL(n,r);case"BigInt":return zL(n,r);case"Boolean":return GL(n,r);case"Constructor":return KL(n,r);case"Date":return qL(n,r);case"Function":return HL(n,r);case"Import":return YL(n,r);case"Integer":return WL(n,r);case"Intersect":return XL(n,r);case"Iterator":return ZL(n,r);case"Literal":return QL(n,r);case"Never":return JL(n,r);case"Not":return eV(n,r);case"Null":return tV(n,r);case"Number":return rV(n,r);case"Object":return nV(n,r);case"Promise":return oV(n,r);case"Record":return iV(n,r);case"Ref":return aV(n,r);case"RegExp":return sV(n,r);case"String":return cV(n,r);case"Symbol":return fV(n,r);case"TemplateLiteral":return uV(n,r);case"This":return lV(n,r);case"Tuple":return pV(n,r);case"Undefined":return mV(n,r);case"Union":return dV(n,r);case"Uint8Array":return hV(n,r);case"Unknown":return yV(n,r);case"Void":return bV(n,r);default:if(!Ln.Has(n[$]))throw new nn(n,"Unknown type");return gV(n,r)}}var xV=512,QO=0;function eo(...e){return QO=0,e.length===2?on(e[0],e[1]):on(e[0],[])}var zh=class extends le{constructor(t,r){super(r),this.schema=t}};function JO(e,t,r){if(e[$]==="Object"&&typeof r=="object"&&!Wo(r)){let n=e,o=Object.getOwnPropertyNames(r);return Object.entries(n.properties).reduce((a,[s,c])=>{let u=c[$]==="Literal"&&c.const===r[s]?100:0,f=xe(c,t,r[s])?10:0,m=o.includes(s)?1:0;return a+(u+f+m)},0)}else if(e[$]==="Union"){let o=e.anyOf.map(i=>$e(i,t)).map(i=>JO(i,t,r));return Math.max(...o)}else return xe(e,t,r)?1:0}function wV(e,t,r){let n=e.anyOf.map(a=>$e(a,t)),[o,i]=[n[0],0];for(let a of n){let s=JO(a,t,r);s>i&&(o=a,i=s)}return o}function SV(e,t,r){if("default"in e)return typeof r=="function"?e.default:Re(e.default);{let n=wV(e,t,r);return Il(n,t,r)}}function IV(e,t,r){return xe(e,t,r)?Re(r):eo(e,t)}function _V(e,t,r){return xe(e,t,r)?r:eo(e,t)}function vV(e,t,r){if(xe(e,t,r))return Re(r);let n=fe(r)?Re(r):eo(e,t),o=ot(e.minItems)&&n.lengthnull)]:n,a=(ot(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>to(e.items,t,c));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!xe(e,t,s))throw new zh(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function PV(e,t,r){if(xe(e,t,r))return eo(e,t);let n=new Set(e.returns.required||[]),o=function(){};for(let[i,a]of Object.entries(e.returns.properties))!n.has(i)&&r.prototype[i]===void 0||(o.prototype[i]=to(a,t,r.prototype[i]));return o}function TV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return to(o,[...t,...n],r)}function eC(e,t){return ye(e)&&!ye(t)||!ye(e)&&ye(t)?e:!ye(e)||!ye(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?eC(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function MV(e,t,r){if(xe(e,t,r))return r;let n=eo(e,t),o=eC(n,r);return xe(e,t,o)?o:n}function OV(e,t,r){throw new zh(e,"Never types cannot be cast")}function CV(e,t,r){if(xe(e,t,r))return r;if(r===null||typeof r!="object")return eo(e,t);let n=new Set(e.required||[]),o={};for(let[i,a]of Object.entries(e.properties))!n.has(i)&&r[i]===void 0||(o[i]=to(a,t,r[i]));if(typeof e.additionalProperties=="object"){let i=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(r))i.includes(a)||(o[a]=to(e.additionalProperties,t,r[a]))}return o}function kV(e,t,r){if(xe(e,t,r))return Re(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return eo(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=to(o,t,s);return i}function RV(e,t,r){return to($e(e,t),t,r)}function NV(e,t,r){return to($e(e,t),t,r)}function AV(e,t,r){return xe(e,t,r)?Re(r):fe(r)?e.items===void 0?[]:e.items.map((n,o)=>to(n,t,r[o])):eo(e,t)}function EV(e,t,r){return xe(e,t,r)?Re(r):SV(e,t,r)}function to(e,t,r){let n=Ve(e.$id)?Xt(e,t):t,o=e;switch(e[$]){case"Array":return vV(o,n,r);case"Constructor":return PV(o,n,r);case"Import":return TV(o,n,r);case"Intersect":return MV(o,n,r);case"Never":return OV(o,n,r);case"Object":return CV(o,n,r);case"Record":return kV(o,n,r);case"Ref":return RV(o,n,r);case"This":return NV(o,n,r);case"Tuple":return AV(o,n,r);case"Union":return EV(o,n,r);case"Date":case"Symbol":case"Uint8Array":return IV(e,t,r);default:return _V(o,n,r)}}function Il(...e){return e.length===3?to(e[0],e[1],e[2]):to(e[0],[],e[1])}function FV(e){return Vi(e)&&e[$]!=="Unsafe"}function $V(e,t,r){return fe(r)?r.map(n=>Ur(e.items,t,n)):r}function DV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Ur(o,[...t,...n],r)}function LV(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>Ur(s,t,Re(r))).reduce((s,c)=>ye(c)?{...s,...c}:c,{});if(!ye(r)||!ye(i)||!Vi(n))return i;let a=Rr(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||xe(n,t,r[s])&&(i[s]=Ur(n,t,r[s]));return i}function VV(e,t,r){if(!ye(r)||fe(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(ce(e.properties,o)){r[o]=Ur(e.properties[o],t,r[o]);continue}if(Vi(n)&&xe(n,t,r[o])){r[o]=Ur(n,t,r[o]);continue}delete r[o]}return r}function jV(e,t,r){if(!ye(r))return r;let n=e.additionalProperties,o=Object.getOwnPropertyNames(r),[i,a]=Object.entries(e.patternProperties)[0],s=new RegExp(i);for(let c of o){if(s.test(c)){r[c]=Ur(a,t,r[c]);continue}if(Vi(n)&&xe(n,t,r[c])){r[c]=Ur(n,t,r[c]);continue}delete r[c]}return r}function UV(e,t,r){return Ur($e(e,t),t,r)}function BV(e,t,r){return Ur($e(e,t),t,r)}function zV(e,t,r){if(!fe(r))return r;if(nt(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function GV(e,t,r){for(let n of e.anyOf)if(FV(n)&&xe(n,t,r))return Ur(n,t,r);return r}function Ur(e,t,r){let n=Ve(e.$id)?Xt(e,t):t,o=e;switch(o[$]){case"Array":return $V(o,n,r);case"Import":return DV(o,n,r);case"Intersect":return LV(o,n,r);case"Object":return VV(o,n,r);case"Record":return jV(o,n,r);case"Ref":return UV(o,n,r);case"This":return BV(o,n,r);case"Tuple":return zV(o,n,r);case"Union":return GV(o,n,r);default:return r}}function Gh(...e){return e.length===3?Ur(e[0],e[1],e[2]):Ur(e[0],[],e[1])}function Kh(e){return Ve(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function KV(e){return kn(e)||uo(e)||ot(e)}function _l(e){return e===!0||ot(e)&&e===1||kn(e)&&e===BigInt("1")||Ve(e)&&(e.toLowerCase()==="true"||e==="1")}function vl(e){return e===!1||ot(e)&&(e===0||Object.is(e,-0))||kn(e)&&e===BigInt("0")||Ve(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function qV(e){return Ve(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function HV(e){return Ve(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function YV(e){return Ve(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function WV(e){return Ve(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function XV(e){return Ve(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function ZV(e,t){let r=rC(e);return r===t?r:e}function QV(e,t){let r=nC(e);return r===t?r:e}function JV(e,t){let r=tC(e);return r===t?r:e}function ej(e,t){return Ve(e.const)?ZV(t,e.const):ot(e.const)?QV(t,e.const):uo(e.const)?JV(t,e.const):t}function tC(e){return _l(e)?!0:vl(e)?!1:e}function tj(e){let t=r=>r.split(".")[0];return Kh(e)?BigInt(t(e)):ot(e)?BigInt(Math.trunc(e)):vl(e)?BigInt(0):_l(e)?BigInt(1):e}function rC(e){return Xo(e)&&e.description!==void 0?e.description.toString():KV(e)?e.toString():e}function nC(e){return Kh(e)?parseFloat(e):_l(e)?1:vl(e)?0:e}function rj(e){return Kh(e)?parseInt(e):ot(e)?Math.trunc(e):_l(e)?1:vl(e)?0:e}function nj(e){return Ve(e)&&e.toLowerCase()==="null"?null:e}function oj(e){return Ve(e)&&e==="undefined"?void 0:e}function ij(e){return xr(e)?e:ot(e)?new Date(e):_l(e)?new Date(1):vl(e)?new Date(0):Kh(e)?new Date(parseInt(e)):HV(e)?new Date(`1970-01-01T${e}.000Z`):qV(e)?new Date(`1970-01-01T${e}`):WV(e)?new Date(`${e}.000Z`):YV(e)?new Date(e):XV(e)?new Date(`${e}T00:00:00.000Z`):e}function aj(e,t,r){return(fe(r)?r:[r]).map(o=>ro(e.items,t,o))}function sj(e,t,r){return tj(r)}function cj(e,t,r){return tC(r)}function fj(e,t,r){return ij(r)}function uj(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return ro(o,[...t,...n],r)}function lj(e,t,r){return rj(r)}function pj(e,t,r){return e.allOf.reduce((n,o)=>ro(o,t,n),r)}function mj(e,t,r){return ej(e,r)}function dj(e,t,r){return nj(r)}function hj(e,t,r){return nC(r)}function yj(e,t,r){if(!ye(r)||fe(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))ce(r,n)&&(r[n]=ro(e.properties[n],t,r[n]));return r}function bj(e,t,r){if(!(ye(r)&&!fe(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=ro(i,t,s);return r}function gj(e,t,r){return ro($e(e,t),t,r)}function xj(e,t,r){return rC(r)}function wj(e,t,r){return Ve(r)||ot(r)?Symbol(r):r}function Sj(e,t,r){return ro($e(e,t),t,r)}function Ij(e,t,r){return fe(r)&&!nt(e.items)?r.map((o,i)=>ino(e.items,t,`${r}/${i}`,o))):pt(e,r,n)}function Tj(e,t,r,n){if(!ye(n)||Gr(n))return pt(e,r,n);let o=Gl(e),i=o.map(f=>f[0]),a={...n};for(let[f,m]of o)f in a&&(a[f]=no(m,t,`${r}/${f}`,a[f]));if(!Ae(e.unevaluatedProperties))return pt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=pt(c,`${r}/${f}`,u[f]));return pt(e,r,u)}function Mj(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=no(i,[...t,...o],r,n);return pt(e,r,a)}function Oj(e,t,r,n){return pt(e,r,no(e.not,t,r,n))}function Cj(e,t,r,n){if(!ye(n))return pt(e,r,n);let o=Rr(e),i={...n};for(let u of o)ce(i,u)&&(nt(i[u])&&(!Jo(e.properties[u])||kt.IsExactOptionalProperty(i,u))||(i[u]=no(e.properties[u],t,`${r}/${u}`,i[u])));if(!ft(e.additionalProperties))return pt(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,c={...i};for(let u of a)o.includes(u)||(c[u]=pt(s,`${r}/${u}`,c[u]));return pt(e,r,c)}function kj(e,t,r,n){if(!ye(n))return pt(e,r,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),a={...n};for(let f of Object.getOwnPropertyNames(n))i.test(f)&&(a[f]=no(e.patternProperties[o],t,`${r}/${f}`,a[f]));if(!ft(e.additionalProperties))return pt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.test(f)||(u[f]=pt(c,`${r}/${f}`,u[f]));return pt(e,r,u)}function Rj(e,t,r,n){let o=$e(e,t);return pt(e,r,no(o,t,r,n))}function Nj(e,t,r,n){let o=$e(e,t);return pt(e,r,no(o,t,r,n))}function Aj(e,t,r,n){return fe(n)&&fe(e.items)?pt(e,r,e.items.map((o,i)=>no(o,t,`${r}/${i}`,n[i]))):pt(e,r,n)}function Ej(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=no(o,t,r,n);return pt(e,r,i)}return pt(e,r,n)}function no(e,t,r,n){let o=Xt(e,t),i=e;switch(e[$]){case"Array":return Pj(i,o,r,n);case"Import":return Mj(i,o,r,n);case"Intersect":return Tj(i,o,r,n);case"Not":return Oj(i,o,r,n);case"Object":return Cj(i,o,r,n);case"Record":return kj(i,o,r,n);case"Ref":return Rj(i,o,r,n);case"Symbol":return pt(i,r,n);case"This":return Nj(i,o,r,n);case"Tuple":return Aj(i,o,r,n);case"Union":return Ej(i,o,r,n);default:return pt(i,r,n)}}function Yh(e,t,r){return no(e,t,"",r)}var Wh=class extends le{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Q1=class extends le{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=r,this.value=n,this.error=o}};function sr(e,t,r){try{return Ae(e)?e[ct].Encode(r):r}catch(n){throw new Q1(e,t,r,n)}}function Fj(e,t,r,n){let o=sr(e,r,n);return fe(o)?o.map((i,a)=>oo(e.items,t,`${r}/${a}`,i)):o}function $j(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=sr(e,r,n);return oo(i,[...t,...o],r,a)}function Dj(e,t,r,n){let o=sr(e,r,n);if(!ye(n)||Gr(n))return o;let i=Gl(e),a=i.map(m=>m[0]),s={...o};for(let[m,l]of i)m in s&&(s[m]=oo(l,t,`${r}/${m}`,s[m]));if(!Ae(e.unevaluatedProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.unevaluatedProperties,f={...s};for(let m of c)a.includes(m)||(f[m]=sr(u,`${r}/${m}`,f[m]));return f}function Lj(e,t,r,n){return sr(e.not,r,sr(e,r,n))}function Vj(e,t,r,n){let o=sr(e,r,n);if(!ye(o))return o;let i=Rr(e),a={...o};for(let f of i)ce(a,f)&&(nt(a[f])&&(!Jo(e.properties[f])||kt.IsExactOptionalProperty(a,f))||(a[f]=oo(e.properties[f],t,`${r}/${f}`,a[f])));if(!ft(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=sr(c,`${r}/${f}`,u[f]));return u}function jj(e,t,r,n){let o=sr(e,r,n);if(!ye(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),s={...o};for(let m of Object.getOwnPropertyNames(n))a.test(m)&&(s[m]=oo(e.patternProperties[i],t,`${r}/${m}`,s[m]));if(!ft(e.additionalProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.additionalProperties,f={...s};for(let m of c)a.test(m)||(f[m]=sr(u,`${r}/${m}`,f[m]));return f}function Uj(e,t,r,n){let o=$e(e,t),i=oo(o,t,r,n);return sr(e,r,i)}function Bj(e,t,r,n){let o=$e(e,t),i=oo(o,t,r,n);return sr(e,r,i)}function zj(e,t,r,n){let o=sr(e,r,n);return fe(e.items)?e.items.map((i,a)=>oo(i,t,`${r}/${a}`,o[a])):[]}function Gj(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=oo(o,t,r,n);return sr(e,r,i)}for(let o of e.anyOf){let i=oo(o,t,r,n);if(xe(e,t,i))return sr(e,r,i)}return sr(e,r,n)}function oo(e,t,r,n){let o=Xt(e,t),i=e;switch(e[$]){case"Array":return Fj(i,o,r,n);case"Import":return $j(i,o,r,n);case"Intersect":return Dj(i,o,r,n);case"Not":return Lj(i,o,r,n);case"Object":return Vj(i,o,r,n);case"Record":return jj(i,o,r,n);case"Ref":return Uj(i,o,r,n);case"This":return Bj(i,o,r,n);case"Tuple":return zj(i,o,r,n);case"Union":return Gj(i,o,r,n);default:return sr(i,r,n)}}function Xh(e,t,r){return oo(e,t,"",r)}function Kj(e,t){return Ae(e)||Lt(e.items,t)}function qj(e,t){return Ae(e)||Lt(e.items,t)}function Hj(e,t){return Ae(e)||Lt(e.returns,t)||e.parameters.some(r=>Lt(r,t))}function Yj(e,t){return Ae(e)||Lt(e.returns,t)||e.parameters.some(r=>Lt(r,t))}function Wj(e,t){return Ae(e)||Ae(e.unevaluatedProperties)||e.allOf.some(r=>Lt(r,t))}function Xj(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Ae(e)||Lt(n,[...r,...t])}function Zj(e,t){return Ae(e)||Lt(e.items,t)}function Qj(e,t){return Ae(e)||Lt(e.not,t)}function Jj(e,t){return Ae(e)||Object.values(e.properties).some(r=>Lt(r,t))||ft(e.additionalProperties)&&Lt(e.additionalProperties,t)}function eU(e,t){return Ae(e)||Lt(e.item,t)}function tU(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Ae(e)||Lt(n,t)||ft(e.additionalProperties)&&Ae(e.additionalProperties)}function rU(e,t){return Ae(e)?!0:Lt($e(e,t),t)}function nU(e,t){return Ae(e)?!0:Lt($e(e,t),t)}function oU(e,t){return Ae(e)||!nt(e.items)&&e.items.some(r=>Lt(r,t))}function iU(e,t){return Ae(e)||e.anyOf.some(r=>Lt(r,t))}function Lt(e,t){let r=Xt(e,t),n=e;if(e.$id&&J1.has(e.$id))return!1;switch(e.$id&&J1.add(e.$id),e[$]){case"Array":return Kj(n,r);case"AsyncIterator":return qj(n,r);case"Constructor":return Hj(n,r);case"Function":return Yj(n,r);case"Import":return Xj(n,r);case"Intersect":return Wj(n,r);case"Iterator":return Zj(n,r);case"Not":return Qj(n,r);case"Object":return Jj(n,r);case"Promise":return eU(n,r);case"Record":return tU(n,r);case"Ref":return rU(n,r);case"This":return nU(n,r);case"Tuple":return oU(n,r);case"Union":return iU(n,r);default:return Ae(e)}}var J1=new Set;function _s(e,t){return J1.clear(),Lt(e,t)}function oC(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!xe(t,r,n))throw new Hh(t,n,_a(t,r,n).First());return _s(t,r)?Yh(t,r,n):n}function Ai(e,t){let r=ce(e,"default")?e.default:void 0,n=Di(r)?r():Re(r);return nt(t)?n:ye(t)&&ye(n)?Object.assign(n,t):t}function ew(e){return Vi(e)&&"default"in e}function aU(e,t,r){if(fe(r)){for(let o=0;o{let a=Tr(i,t,n);return ye(a)?{...o,...a}:a},{})}function uU(e,t,r){let n=Ai(e,r);if(!ye(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=Tr(e.properties[i],t,n[i]);nt(a)||(n[i]=Tr(e.properties[i],t,n[i]))}if(!ew(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=Tr(e.additionalProperties,t,n[i]));return n}function lU(e,t,r){let n=Ai(e,r);if(!ye(n))return n;let o=e.additionalProperties,[i,a]=Object.entries(e.patternProperties)[0],s=new RegExp(i);for(let c of Object.getOwnPropertyNames(n))s.test(c)&&ew(a)&&(n[c]=Tr(a,t,n[c]));if(!ew(o))return n;for(let c of Object.getOwnPropertyNames(n))s.test(c)||(n[c]=Tr(o,t,n[c]));return n}function pU(e,t,r){return Tr($e(e,t),t,Ai(e,r))}function mU(e,t,r){return Tr($e(e,t),t,r)}function dU(e,t,r){let n=Ai(e,r);if(!fe(n)||nt(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;abU,Format:()=>Pl,Get:()=>xU,Has:()=>gU,Set:()=>yU,ValuePointerRootDeleteError:()=>Jh,ValuePointerRootSetError:()=>Qh});var Qh=class extends le{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},Jh=class extends le{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function iC(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Pl(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;nvs(e[o],t[o]))}function SU(e,t){return xr(t)&&e.getTime()===t.getTime()}function IU(e,t){return!fe(t)||e.length!==t.length?!1:e.every((r,n)=>vs(r,t[n]))}function _U(e,t){return!an(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>vs(r,t[n]))}function vU(e,t){return e===t}function vs(e,t){if(xr(e))return SU(e,t);if(an(e))return _U(e,t);if(fe(e))return IU(e,t);if(ye(e))return wU(e,t);if(Gr(e))return vU(e,t);throw new Error("ValueEquals: Unable to compare value")}var PU=Fe({type:Te("insert"),path:wr(),value:Vn()}),TU=Fe({type:Te("update"),path:wr(),value:Vn()}),MU=Fe({type:Te("delete"),path:wr()}),sC=Ee([PU,TU,MU]),e0=class extends le{constructor(t,r){super(r),this.value=t}};function t0(e,t){return{type:"update",path:e,value:t}}function cC(e,t){return{type:"insert",path:e,value:t}}function fC(e){return{type:"delete",path:e}}function aC(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new e0(e,"Cannot diff objects with symbols")}function*OU(e,t,r){if(aC(t),aC(r),!T0(r))return yield t0(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)ce(t,i)||(yield cC(`${e}/${i}`,r[i]));for(let i of n)ce(r,i)&&(vs(t,r)||(yield*r0(`${e}/${i}`,t[i],r[i])));for(let i of n)ce(r,i)||(yield fC(`${e}/${i}`))}function*CU(e,t,r){if(!fe(r))return yield t0(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function AU(e){return e.length===0}function lC(e,t){if(NU(t))return Re(t[0].value);if(AU(t))return Re(e);let r=Re(e);for(let n of t)switch(n.type){case"insert":{io.Set(r,n.path,n.value);break}case"update":{io.Set(r,n.path,n.value);break}case"delete":{io.Delete(r,n.path);break}}return r}function pC(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=_s(t,r)?Xh(t,r,n):n;if(!xe(t,r,o))throw new Wh(t,o,_a(t,r,o).First());return o}function n0(e){return ye(e)&&!fe(e)}var o0=class extends le{constructor(t){super(t)}};function EU(e,t,r,n){if(!n0(r))io.Set(e,t,Re(n));else{let o=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(n);for(let a of o)i.includes(a)||delete r[a];for(let a of i)o.includes(a)||(r[a]=null);for(let a of i)tw(e,`${t}/${a}`,r[a],n[a])}}function FU(e,t,r,n){if(!fe(r))io.Set(e,t,Re(n));else{for(let o=0;o(Bh(i,a,s),s)],["Cast",(i,a,s)=>Il(i,a,s)],["Clean",(i,a,s)=>Gh(i,a,s)],["Clone",(i,a,s)=>Re(s)],["Convert",(i,a,s)=>qh(i,a,s)],["Decode",(i,a,s)=>_s(i,a)?Yh(i,a,s):s],["Default",(i,a,s)=>Zh(i,a,s)],["Encode",(i,a,s)=>_s(i,a)?Xh(i,a,s):s]]);function r(i){t.delete(i)}e.Delete=r;function n(i,a){t.set(i,a)}e.Set=n;function o(i){return t.get(i)}e.Get=o})(rw||(rw={}));var hC=["Clone","Clean","Default","Convert","Assert","Decode"];function VU(e,t,r,n){return e.reduce((o,i)=>{let a=rw.Get(i);if(nt(a))throw new i0(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function yC(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?fe(e[0])?[e[0],e[1],[],e[2]]:[hC,e[0],e[1],e[2]]:e.length===2?[hC,e[0],[],e[1]]:(()=>{throw new i0("Invalid Arguments")})();return VU(t,r,n,o)}var pf={};Oa(pf,{Assert:()=>Bh,Cast:()=>Il,Check:()=>xe,Clean:()=>Gh,Clone:()=>Re,Convert:()=>qh,Create:()=>eo,Decode:()=>oC,Default:()=>Zh,Diff:()=>uC,Edit:()=>sC,Encode:()=>pC,Equal:()=>vs,Errors:()=>_a,Hash:()=>lf,Mutate:()=>dC,Parse:()=>yC,Patch:()=>lC,ValueErrorIterator:()=>Ia});function a0(e){switch(e.type){case"summary_metrics":return G1(e);case"performance_table":return U1(e);case"prediction_distribution":return B1(e);case"roc":return A1(e);case"calibration":return E1(e);case"precision_recall":return $1(e);case"gains":return D1(e);case"lift":return L1(e);case"decision_curve":return V1(e);case"interventions_avoided":return j1(e)}}function Bo(e,t){let r=e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"id";/^[a-z]/i.test(r)||(r=`id-${r}`);let n=r,o=1;for(;t.has(n);)n=`${r}-${o}`,o++;return t.add(n),n}function nw(e,t){let r=(n,o=!0)=>{e.forEach((i,a)=>{let s=a===n;i.setAttribute("aria-selected",s?"true":"false"),i.tabIndex=s?0:-1,t[a].hidden=!s}),o&&e[n].focus()};e.forEach((n,o)=>{n.addEventListener("click",()=>{r(o,!1)}),n.addEventListener("keydown",i=>{let a=null;i.key==="ArrowRight"?a=(o+1)%e.length:i.key==="ArrowLeft"?a=(o-1+e.length)%e.length:i.key==="Home"?a=0:i.key==="End"&&(a=e.length-1),a!==null&&(i.preventDefault(),r(a,!0))})})}function jU(e){if(!pf.Check(ip,e))throw new Error("Invalid ReportSpec");sp(e);let t=document.createElement("div");if(t.className="rtichoke-report",e.title){let r=document.createElement("h1");r.className="rtichoke-report__title",r.textContent=e.title,t.append(r)}for(let r of e.components){let n=document.createElement("section");if(n.className="rtichoke-report__component",n.dataset.componentId=r.id,r.title){let i=document.createElement("h2");i.className="rtichoke-report__component-title",i.textContent=r.title,n.append(i)}let o=document.createElement("div");o.className="rtichoke-report__component-content",o.append(a0(r.spec)),n.append(o),t.append(n)}return t}function UU(e,t){if(!pf.Check(ap,e))throw new Error("Invalid ReportSpec");sp(e);let r=!!e.title,n=new Set,o=document.createElement("article");if(o.className="rtichoke-report",e.title){let p=document.createElement("header");p.className="rtichoke-report__header";let h=document.createElement("h1");h.className="rtichoke-report__title",h.textContent=e.title,p.append(h),o.append(p)}let i=[],a=0;for(let p of e.sections){let h=Bo(p.id,n);a++;let y=[];for(let b of p.items)if(b.type==="group"){let w=Bo(b.id,n);a++,y.push({rawId:b.id,title:b.title,domId:w})}i.push({rawId:p.id,title:p.title,domId:h,groups:y})}if(a>1){let p=document.createElement("nav");p.className="rtichoke-report__nav",p.setAttribute("aria-label","Report sections");let h=document.createElement("ul");h.className="rtichoke-report__nav-list";for(let y of i){let b=document.createElement("li");b.className="rtichoke-report__nav-item";let w=document.createElement("a");if(w.className="rtichoke-report__nav-link",w.href=`#${y.domId}`,w.textContent=y.title,b.append(w),y.groups.length>0){let g=document.createElement("ul");g.className="rtichoke-report__nav-sublist";for(let _ of y.groups){let x=document.createElement("li");x.className="rtichoke-report__nav-subitem";let I=document.createElement("a");I.className="rtichoke-report__nav-link",I.href=`#${_.domId}`,I.textContent=_.title,x.append(I),g.append(x)}b.append(g)}h.append(b)}p.append(h),o.append(p)}let s=r?"h2":"h1",c=r?"h3":"h2",u=r?"h3":"h2",f=r?"h4":"h3",m=(p,h)=>{let y=document.createElement("section");if(y.className="rtichoke-report__component",y.dataset.componentId=p.id,p.title){let w=Bo(`heading-${p.id}`,n),g=document.createElement(h);g.className="rtichoke-report__component-title",g.id=w,g.textContent=p.title,y.setAttribute("aria-labelledby",w),y.append(g)}let b=document.createElement("div");return b.className="rtichoke-report__component-content",b.append(a0(p.spec)),y.append(b),y},l=(p,h,y)=>{let b=document.createElement("section");b.className="rtichoke-report__group",b.id=h.domId,b.dataset.groupId=p.id;let w=Bo(`heading-${p.id}`,n),g=document.createElement(c);if(g.className="rtichoke-report__group-title",y&&g.classList.add("rtichoke-report__group-title--tab-panel"),g.id=w,g.textContent=p.title,b.setAttribute("aria-labelledby",y??w),b.append(g),t.groupPresentation==="tabs"){let _=document.createElement("div");_.className="rtichoke-report__tablist",_.setAttribute("role","tablist"),_.setAttribute("aria-labelledby",w);let x=[],I=[];p.components.forEach((S,v)=>{let T=Bo(`tab-${p.id}-${S.id}`,n),O=Bo(`panel-${p.id}-${S.id}`,n),R=document.createElement("button");R.className="rtichoke-report__tab",R.type="button",R.id=T,R.setAttribute("role","tab"),R.setAttribute("aria-controls",O),R.setAttribute("aria-selected",v===0?"true":"false"),R.tabIndex=v===0?0:-1,R.textContent=S.title||S.id;let C=document.createElement("section");C.className="rtichoke-report__component rtichoke-report__tabpanel",C.id=O,C.setAttribute("role","tabpanel"),C.setAttribute("aria-labelledby",T),C.tabIndex=0,C.dataset.componentId=S.id,C.hidden=v!==0;let k=document.createElement("div");k.className="rtichoke-report__component-content",k.append(a0(S.spec)),C.append(k),x.push(R),I.push(C),_.append(R)}),nw(x,I),b.append(_,...I)}else for(let _ of p.components)b.append(m(_,f));return b};for(let p=0;pT.type==="group"),x=t.sectionGroupPresentation==="tabs"&&_.length>1,I=0,S=!1,v=0;for(;v1){let k=document.createElement("div");k.className="rtichoke-report__tablist",k.setAttribute("role","tablist"),k.setAttribute("aria-labelledby",w);let z=[],j=[];R.forEach((M,U)=>{let L=Bo(`tab-${h.id}-${M.id}`,n),re=Bo(`panel-${h.id}-${M.id}`,n),V=document.createElement("button");V.className="rtichoke-report__tab",V.type="button",V.id=L,V.setAttribute("role","tab"),V.setAttribute("aria-controls",re),V.setAttribute("aria-selected",U===0?"true":"false"),V.tabIndex=U===0?0:-1,V.textContent=M.title||M.id;let q=document.createElement("section");q.className="rtichoke-report__component rtichoke-report__tabpanel",q.id=re,q.setAttribute("role","tabpanel"),q.setAttribute("aria-labelledby",L),q.tabIndex=0,q.dataset.componentId=M.id,q.hidden=U!==0;let H=document.createElement("div");H.className="rtichoke-report__component-content",H.append(a0(M.spec)),q.append(H),z.push(V),j.push(q),k.append(V)}),nw(z,j),b.append(k,...j),v=O}else b.append(m(T,u)),v++}else if(T.type==="group"){if(x){if(!S){S=!0;let O=document.createElement("div");O.className="rtichoke-report__tablist rtichoke-report__section-group-tablist",O.setAttribute("role","tablist"),O.setAttribute("aria-labelledby",w);let R=[],C=[];_.forEach((k,z)=>{let j=y.groups[z],M=Bo(`section-group-tab-${h.id}-${k.id}`,n),U=document.createElement("button");U.className="rtichoke-report__tab",U.type="button",U.id=M,U.setAttribute("role","tab"),U.setAttribute("aria-controls",j.domId),U.setAttribute("aria-selected",z===0?"true":"false"),U.tabIndex=z===0?0:-1,U.textContent=k.title;let L=l(k,j,M);L.classList.add("rtichoke-report__tabpanel"),L.setAttribute("role","tabpanel"),L.setAttribute("aria-labelledby",M),L.tabIndex=0,L.hidden=z!==0,R.push(U),C.push(L),O.append(U)}),nw(R,C),b.append(O,...C)}}else b.append(l(T,y.groups[I++]));v++}}o.append(b)}return o}function BU(e,t){if(!e||typeof e!="object")throw new Error("Invalid ReportSpec");let r=t?.groupPresentation??"stacked",n=t?.sectionGroupPresentation??"stacked",o=t?.sectionComponentPresentation??"stacked";if(t!==void 0&&(typeof t!="object"||t===null||t.groupPresentation!==void 0&&t.groupPresentation!=="stacked"&&t.groupPresentation!=="tabs"))throw new Error("Invalid render options: groupPresentation must be 'stacked' or 'tabs'");if(t!==void 0&&t.sectionGroupPresentation!==void 0&&t.sectionGroupPresentation!=="stacked"&&t.sectionGroupPresentation!=="tabs")throw new Error("Invalid render options: sectionGroupPresentation must be 'stacked' or 'tabs'");if(t!==void 0&&t.sectionComponentPresentation!==void 0&&t.sectionComponentPresentation!=="stacked"&&t.sectionComponentPresentation!=="tabs")throw new Error("Invalid render options: sectionComponentPresentation must be 'stacked' or 'tabs'");if(e.schemaVersion==="1.0")return jU(e);if(e.schemaVersion==="1.1")return UU(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var zU=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function GU(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[Dt(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(Dt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),jo({width:600,height:600,marginLeft:64,marginBottom:56,style:{background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"},x:{label:e.xAxis.label,domain:e.xAxis.domain,grid:!1,ticks:6},y:{label:e.yAxis.label,domain:e.yAxis.domain,grid:!1,ticks:6},color:{legend:!0,range:zU},marks:r})}export{gy as AUROCSummaryMetricSchema,oy as CalibrationSpecSchema,$S as CalibrationV2DatumSchema,sy as CalibrationV2SpecSchema,LS as DecisionCurveV2DatumSchema,VS as DecisionCurveV2EvaluationSchema,zS as DecisionCurveV2ReferenceSchema,jS as DecisionCurveV2SeriesSchema,cy as DecisionCurveV2SpecSchema,ES as DiscreteCalibrationV2DatumSchema,NS as DisplayGroupingSpecSchema,RS as DisplayRoleSchema,Xr as EvaluationSpecSchema,fy as GainsV2SpecSchema,YS as InterventionsAvoidedTreatAllReferenceSchema,WS as InterventionsAvoidedTreatNoneReferenceSchema,KS as InterventionsAvoidedV2DatumSchema,qS as InterventionsAvoidedV2EvaluationSchema,XS as InterventionsAvoidedV2ReferenceSchema,HS as InterventionsAvoidedV2SeriesSchema,uy as InterventionsAvoidedV2SpecSchema,ly as LiftV2SpecSchema,Ef as OperatingPointDimensionSchema,QS as OperatingPointSchema,ri as OperatingPointSpecSchema,JS as PerformanceEvaluationContextSchema,ZS as PerformanceMetricDefinitionSchema,my as PerformanceMetricIdSchema,op as PerformanceMetricValueSchema,eI as PerformanceTableRowSchema,dy as PerformanceTableSpecSchema,by as PopulationSummaryOwnerSpecSchema,py as PrecisionRecallV2SpecSchema,tI as PredictionDistributionBinSchema,rI as PredictionDistributionOperatingPointSchema,Ff as PredictionDistributionSpecSchema,xy as PrevalenceSummaryMetricSchema,yr as RTICHOKE_BROWSER_THEME,UO as RTICHOKE_COLORS,AS as ReferenceLineV2SpecSchema,oI as ReportComponentSchema,Iy as ReportComponentV1_1Schema,iI as ReportGroupSchema,aI as ReportSectionSchema,ER as ReportSpecSchema,ip as ReportSpecV1_0Schema,ap as ReportSpecV1_1Schema,iy as RocSpecSchema,hy as RocV2SpecSchema,gR as RtichokeChartSpecSchema,yy as RtichokeChartSpecV2Schema,Xs as SeriesSpecSchema,FS as SmoothCalibrationV2DatumSchema,Sy as StandaloneCanonicalSpecSchema,RR as SummaryMetricSchema,wy as SummaryMetricsSpecSchema,BS as TreatAllReferenceSchema,US as TreatNoneReferenceSchema,_y as assertPerformanceTableReferentialIntegrity,$f as assertPredictionDistributionReferentialIntegrity,sp as assertReportReferentialIntegrity,vy as assertSummaryMetricsReferentialIntegrity,ni as assertV2ReferentialIntegrity,DR as calibrationSpecFromRtichokeRows,UR as calibrationV2SpecFromRtichokeRows,BO as extractOperatingPointValues,GO as preparePredictionDistributionPlotData,R$ as renderCalibration,E1 as renderCalibrationV2,V1 as renderDecisionCurveV2,D1 as renderGainsV2,j1 as renderInterventionsAvoidedV2,L1 as renderLiftV2,U1 as renderPerformanceTable,$1 as renderPrecisionRecallV2,B1 as renderPredictionDistribution,BU as renderReport,GU as renderRoc,A1 as renderRocV2,G1 as renderSummaryMetrics,Is as renderWithOperatingPointSelection,On as resolveV2RenderOptions,$R as rocSpecFromRtichokePython,FR as rocSpecFromRtichokeR,jR as rocV2SpecFromRtichokePython,VR as rocV2SpecFromRtichokeR}; diff --git a/src/rtichoke/_viz_spec_v2.py b/src/rtichoke/_viz_spec_v2.py index a861af66..120eb1c5 100644 --- a/src/rtichoke/_viz_spec_v2.py +++ b/src/rtichoke/_viz_spec_v2.py @@ -7,11 +7,20 @@ from __future__ import annotations +import math from collections.abc import Mapping +from typing import Any import polars as pl -from rtichoke.processing.evaluation_semantics import _EvaluationMetadata +from rtichoke.performance_data.performance_data import prepare_performance_data +from rtichoke.performance_data.probs_distribution import ( + _prepare_probs_distribution_data, +) +from rtichoke.processing.evaluation_semantics import ( + _EvaluationMetadata, + _build_evaluation_metadata, +) _REQUIRED_ROC_COLUMNS = { "reference_group", @@ -52,6 +61,250 @@ } +def _to_json_number(value: Any) -> float | None: + """Convert numpy/python scalars to float or None for invalid/non-finite numbers.""" + if value is None: + return None + try: + val = float(value) + except (ValueError, TypeError): + return None + if math.isnan(val) or math.isinf(val): + return None + return val + + +def _to_json_int(value: Any) -> int | None: + """Convert numpy/python scalars to int or None for invalid/non-finite numbers.""" + if value is None: + return None + try: + val = float(value) + except (ValueError, TypeError): + return None + if math.isnan(val) or math.isinf(val): + return None + return int(val) + + +def _validate_stratified_by(stratified_by: Any) -> tuple[str, ...]: + if isinstance(stratified_by, str): + raise ValueError( + f"`stratified_by` must be a sequence of strings (e.g. ({stratified_by!r},)), got plain string {stratified_by!r}." + ) + + if not isinstance(stratified_by, (list, tuple)): + try: + strat_tuple = tuple(stratified_by) + except TypeError as err: + raise ValueError("`stratified_by` must be a sequence of strings.") from err + else: + strat_tuple = tuple(stratified_by) + + if len(strat_tuple) != 1: + raise ValueError( + f"`stratified_by` must contain exactly one element, got {len(strat_tuple)} elements: {strat_tuple!r}." + ) + + dimension = strat_tuple[0] + if dimension not in ("probability_threshold", "ppcr"): + raise ValueError( + f"Unsupported stratification key {dimension!r}. Must be 'probability_threshold' or 'ppcr'." + ) + + return strat_tuple + + +def _prediction_distribution_v2_spec( + distribution_data: Any, + performance_data: pl.DataFrame, + evaluation_metadata: Mapping[str, _EvaluationMetadata], + stratified_by: tuple[str, ...] = ("probability_threshold",), +) -> dict[str, object]: + """Map pre-computed distribution and performance data to canonical PredictionDistributionSpec.""" + strat_tuple = _validate_stratified_by(stratified_by) + evaluation_keys = list(evaluation_metadata.keys()) + evaluation_ids = { + group: f"evaluation-{index}" + for index, group in enumerate(evaluation_keys, start=1) + } + + evaluations: list[dict[str, object]] = [] + for group in evaluation_keys: + metadata = evaluation_metadata[group] + evaluation: dict[str, object] = { + "id": evaluation_ids[group], + "population": metadata.population, + } + if metadata.model is not None: + evaluation["model"] = metadata.model + evaluations.append(evaluation) + + # Convert Bins + bins_data: list[dict[str, object]] = [] + for row in distribution_data["bins"].iter_rows(named=True): + group = str(row["evaluation"]) + if group not in evaluation_ids: + raise ValueError(f"Unknown reference group in bins: {group!r}") + bins_data.append( + { + "evaluationId": evaluation_ids[group], + "lower": float(row["lower"]), + "upper": float(row["upper"]), + "includeLower": bool(row["include_lower"]), + "includeUpper": bool(row["include_upper"]), + "nPositive": int(row["n_positive"]), + "nNegative": int(row["n_negative"]), + } + ) + + # Convert Rank Bins + rank_bins_data: list[dict[str, object]] = [] + for row in distribution_data["rank_bins"].iter_rows(named=True): + group = str(row["evaluation"]) + if group not in evaluation_ids: + raise ValueError(f"Unknown reference group in rank bins: {group!r}") + rank_bins_data.append( + { + "evaluationId": evaluation_ids[group], + "rankLower": float(row["rank_lower"]), + "rankUpper": float(row["rank_upper"]), + "positiveMass": int(row["n_positive"]), + "negativeMass": int(row["n_negative"]), + } + ) + + # Convert Operating Points and Join Performance Metrics + operating_points_data: list[dict[str, object]] = [] + dimension = strat_tuple[0] + + for row in distribution_data["operating_points"].iter_rows(named=True): + group = str(row["evaluation"]) + if group not in evaluation_ids: + raise ValueError(f"Unknown reference group in operating points: {group!r}") + + req_val = float(row["value"]) + if not math.isfinite(req_val): + raise ValueError(f"Non-finite operating point value: {req_val}") + + # Exact join to performance row + if dimension == "probability_threshold": + matches = performance_data.filter( + (pl.col("reference_group") == group) + & (pl.col("stratified_by") == "probability_threshold") + & (pl.col("chosen_cutoff") == req_val) + ) + elif dimension == "ppcr": + matches = performance_data.filter( + (pl.col("reference_group") == group) + & (pl.col("stratified_by") == "ppcr") + & (pl.col("ppcr") == req_val) + ) + else: + raise ValueError(f"Unexpected dimension: {dimension!r}") + + if len(matches) == 0: + raise ValueError( + f"Missing performance row for evaluation {group!r}, dimension {dimension!r}, value {req_val}" + ) + if len(matches) > 1: + raise ValueError( + f"Duplicate performance match for evaluation {group!r}, dimension {dimension!r}, value {req_val}" + ) + + perf_row = matches.to_dicts()[0] + + canonical_metrics = [ + { + "metricId": "true_positives", + "estimate": _to_json_int(perf_row.get("true_positives")), + }, + { + "metricId": "true_negatives", + "estimate": _to_json_int(perf_row.get("true_negatives")), + }, + { + "metricId": "false_positives", + "estimate": _to_json_int(perf_row.get("false_positives")), + }, + { + "metricId": "false_negatives", + "estimate": _to_json_int(perf_row.get("false_negatives")), + }, + { + "metricId": "sensitivity", + "estimate": _to_json_number(perf_row.get("sensitivity")), + }, + { + "metricId": "specificity", + "estimate": _to_json_number(perf_row.get("specificity")), + }, + {"metricId": "ppv", "estimate": _to_json_number(perf_row.get("ppv"))}, + {"metricId": "npv", "estimate": _to_json_number(perf_row.get("npv"))}, + {"metricId": "lift", "estimate": _to_json_number(perf_row.get("lift"))}, + ] + + operating_points_data.append( + { + "evaluationId": evaluation_ids[group], + "type": dimension, + "value": req_val, + "cutoff": float(row["cutoff"]), + "realizedPpcr": float(row["realized_ppcr"]), + "performance": canonical_metrics, + } + ) + + # Validate evaluation coverage + covered_op_evals = {op["evaluationId"] for op in operating_points_data} + all_eval_ids = set(evaluation_ids.values()) + if covered_op_evals != all_eval_ids: + raise ValueError("Incomplete evaluation coverage in operating points.") + + return { + "schemaVersion": "2.0", + "type": "prediction_distribution", + "evaluations": evaluations, + "operatingPoint": {"dimension": dimension}, + "bins": bins_data, + "rankBins": rank_bins_data, + "operatingPoints": operating_points_data, + } + + +def _prediction_distribution_v2_spec_from_performance_data( + probs: dict[str, Any], + reals: Any, + by: float = 0.01, + stratified_by: tuple[str, ...] = ("probability_threshold",), +) -> dict[str, object]: + """Build exact v0.22.1 PredictionDistributionSpec from raw inputs.""" + strat_tuple = _validate_stratified_by(stratified_by) + dummy_times = pl.Series(dtype=pl.Float64).to_numpy() + evaluation_metadata = _build_evaluation_metadata(probs, reals, dummy_times) + + distribution_data = _prepare_probs_distribution_data( + probs=probs, + reals=reals, + stratified_by=strat_tuple, + by=by, + ) + + performance_data = prepare_performance_data( + probs=probs, + reals=reals, + stratified_by=strat_tuple, + by=by, + ) + + return _prediction_distribution_v2_spec( + distribution_data=distribution_data, + performance_data=performance_data, + evaluation_metadata=evaluation_metadata, + stratified_by=strat_tuple, + ) + + def _add_operating_point_to_spec( spec: dict[str, object], operating_point_dimension: str | None ) -> None: diff --git a/src/rtichoke/probs_distribution.py b/src/rtichoke/probs_distribution.py new file mode 100644 index 00000000..e212590d --- /dev/null +++ b/src/rtichoke/probs_distribution.py @@ -0,0 +1,127 @@ +"""Public API for standalone prediction distribution visualization.""" + +from __future__ import annotations + +from typing import Any, Sequence + +from rtichoke._renderers import RtichokeBrowserChart +from rtichoke._viz_spec_v2 import ( + _prediction_distribution_v2_spec_from_performance_data, +) + + +def create_probs_histogram( + probs: dict[str, Any], + reals: Any, + by: float = 0.01, + stratified_by: Sequence[str] = ("probability_threshold",), +) -> RtichokeBrowserChart: + """Create a standalone Prediction Distribution browser chart. + + This function generates a canonical prediction distribution chart displaying + predicted probability histograms or risk percentile rank distributions, + decomposed by observed binary outcome, with interactive threshold and PPCR + operating-point controls. + + In Probability Threshold mode, the x-axis represents predicted probability + intervals. In PPCR (Predicted Positives Condition Rate) mode, the x-axis + displays the producer-owned risk-rank distribution (percentile strata). + Bars in each bin are decomposed by observed binary outcome (positives and + negatives). Moving the operating-point control changes the classification + partition and updates performance metrics attached to each operating point. + Because tied predictions are never split across boundaries, ties may cause + the realized classified-positive proportion to differ from the requested PPCR. + This visualization displays model distribution and performance across operating + points and does not identify an optimal threshold. + + Parameters + ---------- + probs : dict[str, numpy.ndarray] + Nonempty dictionary mapping model or evaluation names to predicted + probability arrays. + reals : numpy.ndarray or dict[str, numpy.ndarray] + True binary labels (0 or 1), as a single shared array or a dictionary of + arrays matching keys in ``probs``. + by : float, optional + Grid resolution step size for evaluation cutoffs and percentiles. + Defaults to ``0.01``. + stratified_by : Sequence[str], optional + Sequence containing exactly one stratification key, either + ``("probability_threshold",)`` or ``("ppcr",)``. Defaults to + ``("probability_threshold",)``. + + Returns + ------- + RtichokeBrowserChart + A browser chart instance that renders the canonical prediction distribution. + + Examples + -------- + Create a prediction distribution chart in Probability Threshold mode: + + >>> import numpy as np + >>> import rtichoke + >>> probs = {"model_1": np.array([0.1, 0.4, 0.7, 0.8])} + >>> reals = np.array([0, 0, 1, 1]) + >>> chart = rtichoke.create_probs_histogram(probs=probs, reals=reals) + + Create a prediction distribution chart in PPCR / Risk Percentile mode: + + >>> chart = rtichoke.create_probs_histogram( + ... probs=probs, + ... reals=reals, + ... stratified_by=("ppcr",), + ... ) + + Compare multiple models sharing one outcome population: + + >>> probs = { + ... "model_1": np.array([0.1, 0.4, 0.7, 0.8]), + ... "model_2": np.array([0.2, 0.3, 0.6, 0.9]), + ... } + >>> reals = np.array([0, 0, 1, 1]) + >>> chart = rtichoke.create_probs_histogram(probs=probs, reals=reals) + + Compare multiple populations with population-keyed outcome arrays: + + >>> probs = { + ... "pop_1": np.array([0.1, 0.4, 0.7, 0.8]), + ... "pop_2": np.array([0.2, 0.5, 0.9]), + ... } + >>> reals = { + ... "pop_1": np.array([0, 0, 1, 1]), + ... "pop_2": np.array([0, 1, 1]), + ... } + >>> chart = rtichoke.create_probs_histogram(probs=probs, reals=reals) + """ + if isinstance(stratified_by, str): + raise ValueError( + f"`stratified_by` must be a sequence of strings (e.g. ({stratified_by!r},)), got plain string {stratified_by!r}." + ) + + if not isinstance(stratified_by, (list, tuple)): + try: + strat_tuple = tuple(stratified_by) + except TypeError as err: + raise ValueError("`stratified_by` must be a sequence of strings.") from err + else: + strat_tuple = tuple(stratified_by) + + if len(strat_tuple) != 1: + raise ValueError( + f"`stratified_by` must contain exactly one element, got {len(strat_tuple)} elements: {strat_tuple!r}." + ) + + dimension = strat_tuple[0] + if dimension not in ("probability_threshold", "ppcr"): + raise ValueError( + f"Unsupported stratification key {dimension!r}. Must be 'probability_threshold' or 'ppcr'." + ) + + spec = _prediction_distribution_v2_spec_from_performance_data( + probs=probs, + reals=reals, + by=by, + stratified_by=strat_tuple, + ) + return RtichokeBrowserChart(spec=spec) diff --git a/tests/test_probs_histogram.py b/tests/test_probs_histogram.py new file mode 100644 index 00000000..cbe8e91f --- /dev/null +++ b/tests/test_probs_histogram.py @@ -0,0 +1,582 @@ +"""Deterministic unit tests for standalone create_probs_histogram() adapter and canonical spec.""" + +import json +from pathlib import Path +from unittest.mock import patch +from jsonschema import Draft202012Validator +import numpy as np +import polars as pl +import pytest + +import rtichoke +from rtichoke._viz_spec_v2 import ( + _prediction_distribution_v2_spec, + _prediction_distribution_v2_spec_from_performance_data, +) +from rtichoke.performance_data.performance_data import prepare_performance_data +from rtichoke.performance_data.probs_distribution import ( + _prepare_probs_distribution_data, +) +from rtichoke.processing.evaluation_semantics import _build_evaluation_metadata + +_SCHEMA_PATH = ( + Path(__file__).parents[1] + / "src" + / "rtichoke" + / "_vendor" + / "rtichoke_viz" + / "rtichoke-viz-v2.schema.json" +) + + +def test_frozen_tied_fixture_exact_canonical_spec(): + probs = {"m1": np.array([0.00, 0.15, 0.30, 0.50, 0.50, 0.50, 0.65, 0.80, 1.00])} + reals = np.array([0, 1, 0, 1, 0, 1, 1, 0, 1]) + by = 0.20 + + chart = rtichoke.create_probs_histogram( + probs=probs, + reals=reals, + by=by, + stratified_by=("ppcr",), + ) + spec = chart.spec + + assert spec["schemaVersion"] == "2.0" + assert spec["type"] == "prediction_distribution" + assert spec["evaluations"] == [ + {"id": "evaluation-1", "population": "__shared_population__", "model": "m1"} + ] + assert spec["operatingPoint"] == {"dimension": "ppcr"} + + # Expected rank bins literal assertion + expected_rank_bins = [ + { + "evaluationId": "evaluation-1", + "rankLower": 0.00, + "rankUpper": 0.20, + "positiveMass": 1, + "negativeMass": 1, + }, + { + "evaluationId": "evaluation-1", + "rankLower": 0.20, + "rankUpper": 0.40, + "positiveMass": 2, + "negativeMass": 2, + }, + { + "evaluationId": "evaluation-1", + "rankLower": 0.40, + "rankUpper": 0.60, + "positiveMass": 0, + "negativeMass": 0, + }, + { + "evaluationId": "evaluation-1", + "rankLower": 0.60, + "rankUpper": 0.80, + "positiveMass": 1, + "negativeMass": 0, + }, + { + "evaluationId": "evaluation-1", + "rankLower": 0.80, + "rankUpper": 1.00, + "positiveMass": 1, + "negativeMass": 1, + }, + ] + assert spec["rankBins"] == expected_rank_bins + + # Expected PPCR operating points literal assertion + op_points = spec["operatingPoints"] + assert len(op_points) == 6 + + expected_ops = [ + { + "value": 0.00, + "cutoff": 1.00, + "realizedPpcr": 0.0 / 9.0, + "TP": 0, + "FP": 0, + "TN": 4, + "FN": 5, + }, + { + "value": 0.20, + "cutoff": 0.71, + "realizedPpcr": 2.0 / 9.0, + "TP": 1, + "FP": 1, + "TN": 3, + "FN": 4, + }, + { + "value": 0.40, + "cutoff": 0.50, + "realizedPpcr": 3.0 / 9.0, + "TP": 2, + "FP": 1, + "TN": 3, + "FN": 3, + }, + { + "value": 0.60, + "cutoff": 0.50, + "realizedPpcr": 3.0 / 9.0, + "TP": 2, + "FP": 1, + "TN": 3, + "FN": 3, + }, + { + "value": 0.80, + "cutoff": 0.24, + "realizedPpcr": 7.0 / 9.0, + "TP": 4, + "FP": 3, + "TN": 1, + "FN": 1, + }, + { + "value": 1.00, + "cutoff": 0.00, + "realizedPpcr": 9.0 / 9.0, + "TP": 5, + "FP": 4, + "TN": 0, + "FN": 0, + }, + ] + + for op, exp in zip(op_points, expected_ops): + assert op["evaluationId"] == "evaluation-1" + assert op["type"] == "ppcr" + assert pytest.approx(op["value"]) == exp["value"] + assert pytest.approx(op["cutoff"]) == exp["cutoff"] + assert pytest.approx(op["realizedPpcr"]) == exp["realizedPpcr"] + + metrics = {m["metricId"]: m["estimate"] for m in op["performance"]} + assert metrics["true_positives"] == exp["TP"] + assert isinstance(metrics["true_positives"], int) + assert metrics["false_positives"] == exp["FP"] + assert isinstance(metrics["false_positives"], int) + assert metrics["true_negatives"] == exp["TN"] + assert isinstance(metrics["true_negatives"], int) + assert metrics["false_negatives"] == exp["FN"] + assert isinstance(metrics["false_negatives"], int) + + +def test_prepared_data_builder_does_not_call_statistical_producers(): + probs = {"m1": np.array([0.1, 0.4, 0.7])} + reals = np.array([0, 1, 1]) + + dist_data = _prepare_probs_distribution_data(probs, reals, by=0.5) + perf_data = prepare_performance_data(probs, reals, by=0.5) + eval_meta = _build_evaluation_metadata(probs, reals, np.array([])) + + with ( + patch("rtichoke._viz_spec_v2.prepare_performance_data") as mock_perf, + patch("rtichoke._viz_spec_v2._prepare_probs_distribution_data") as mock_dist, + ): + spec = _prediction_distribution_v2_spec( + distribution_data=dist_data, + performance_data=perf_data, + evaluation_metadata=eval_meta, + stratified_by=("probability_threshold",), + ) + mock_perf.assert_not_called() + mock_dist.assert_not_called() + assert spec["type"] == "prediction_distribution" + + +def test_public_wrapper_and_prepared_builder_produce_identical_spec(): + probs = {"m1": np.array([0.0, 0.25, 0.5, 0.75, 1.0])} + reals = np.array([0, 0, 1, 1, 1]) + by = 0.25 + + spec_wrapper = _prediction_distribution_v2_spec_from_performance_data( + probs=probs, reals=reals, by=by, stratified_by=("probability_threshold",) + ) + + dist_data = _prepare_probs_distribution_data(probs, reals, by=by) + perf_data = prepare_performance_data(probs, reals, by=by) + eval_meta = _build_evaluation_metadata(probs, reals, np.array([])) + + spec_direct = _prediction_distribution_v2_spec( + distribution_data=dist_data, + performance_data=perf_data, + evaluation_metadata=eval_meta, + stratified_by=("probability_threshold",), + ) + + assert spec_wrapper == spec_direct + + +def test_confusion_matrix_estimates_are_integers(): + probs = {"m1": np.array([0.1, 0.5, 0.9])} + reals = np.array([0, 1, 1]) + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=0.5) + spec = chart.spec + + for op in spec["operatingPoints"]: + metrics = {m["metricId"]: m["estimate"] for m in op["performance"]} + for metric_id in ( + "true_positives", + "true_negatives", + "false_positives", + "false_negatives", + ): + val = metrics[metric_id] + assert isinstance(val, int), f"{metric_id} should be int, got {type(val)}" + + +def test_undefined_metrics_null_serialization(): + probs = {"m1": np.array([0.1, 0.4, 0.7])} + reals = np.array([0, 0, 0]) # No positives -> sensitivity & PPV undefined + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=0.5) + spec = chart.spec + + # Check metric estimates + op = spec["operatingPoints"][0] + metrics = {m["metricId"]: m["estimate"] for m in op["performance"]} + assert metrics["sensitivity"] is None + + # Check serialized JSON + tmp_path = Path("tmp_chart.html") + try: + chart.write_html(tmp_path) + content = tmp_path.read_text(encoding="utf-8") + assert '{"metricId":"sensitivity","estimate":null}' in content + + # Check that the embedded JSON spec payload has no NaN + spec_text = content.split( + '")[0] + assert "NaN" not in spec_text + spec_data = json.loads(spec_text) + assert spec_data["operatingPoints"][0]["performance"][4]["estimate"] is None + finally: + if tmp_path.exists(): + tmp_path.unlink() + + +def test_n_less_than_q_empty_rank_bins_and_mass_conservation(): + probs = {"m1": np.array([0.2, 0.8])} + reals = np.array([0, 1]) + by = 0.10 # q = 10, N = 2 + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=by) + spec = chart.spec + + rank_bins = spec["rankBins"] + assert len(rank_bins) == 10 + + total_pos = sum(rb["positiveMass"] for rb in rank_bins) + total_neg = sum(rb["negativeMass"] for rb in rank_bins) + + assert total_pos == 1 + assert total_neg == 1 + # Verify some explicit empty rank bins exist + empty_bins = [ + rb for rb in rank_bins if rb["positiveMass"] == 0 and rb["negativeMass"] == 0 + ] + assert len(empty_bins) > 0 + + +def test_threshold_endpoints(): + probs = {"m1": np.array([0.00, 0.25, 0.50, 0.75, 1.00])} + reals = np.array([0, 1, 0, 1, 1]) + + chart = rtichoke.create_probs_histogram( + probs=probs, + reals=reals, + by=0.25, + stratified_by=("probability_threshold",), + ) + spec = chart.spec + ops = {op["value"]: op for op in spec["operatingPoints"]} + + # Cutoff 0.0: everybody predicted positive (including exact-zero score) + op_0 = ops[0.0] + metrics_0 = {m["metricId"]: m["estimate"] for m in op_0["performance"]} + assert metrics_0["true_positives"] == 3 + assert metrics_0["false_positives"] == 2 + assert op_0["realizedPpcr"] == 1.0 + + # Cutoff 0.50: predicted positive iff probability > 0.50 (i.e. scores 0.75 and 1.00) + op_50 = ops[0.50] + metrics_50 = {m["metricId"]: m["estimate"] for m in op_50["performance"]} + assert metrics_50["true_positives"] == 2 # 0.75 and 1.00 (both outcome 1) + assert metrics_50["false_positives"] == 0 + + # Cutoff 1.00: nobody predicted positive + op_1 = ops[1.00] + metrics_1 = {m["metricId"]: m["estimate"] for m in op_1["performance"]} + assert metrics_1["true_positives"] == 0 + assert metrics_1["false_positives"] == 0 + assert op_1["realizedPpcr"] == 0.0 + + +def test_multiple_models_shared_population(): + probs = { + "m1": np.array([0.1, 0.4, 0.7]), + "m2": np.array([0.2, 0.5, 0.8]), + } + reals = np.array([0, 1, 1]) + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=0.5) + spec = chart.spec + + assert spec["evaluations"] == [ + {"id": "evaluation-1", "population": "__shared_population__", "model": "m1"}, + {"id": "evaluation-2", "population": "__shared_population__", "model": "m2"}, + ] + + eval_ids = {bin_item["evaluationId"] for bin_item in spec["bins"]} + assert eval_ids == {"evaluation-1", "evaluation-2"} + + +def test_multiple_populations(): + probs = { + "pop_a": np.array([0.1, 0.6, 0.9]), + "pop_b": np.array([0.3, 0.7]), + } + reals = { + "pop_a": np.array([0, 1, 1]), + "pop_b": np.array([0, 1]), + } + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=0.5) + spec = chart.spec + + assert spec["evaluations"] == [ + {"id": "evaluation-1", "population": "pop_a"}, + {"id": "evaluation-2", "population": "pop_b"}, + ] + for ev in spec["evaluations"]: + assert "model" not in ev + + pop_a_rank_bins = [ + rb for rb in spec["rankBins"] if rb["evaluationId"] == "evaluation-1" + ] + pop_b_rank_bins = [ + rb for rb in spec["rankBins"] if rb["evaluationId"] == "evaluation-2" + ] + + assert sum(rb["positiveMass"] + rb["negativeMass"] for rb in pop_a_rank_bins) == 3 + assert sum(rb["positiveMass"] + rb["negativeMass"] for rb in pop_b_rank_bins) == 2 + + +def test_join_failures(): + probs = {"m1": np.array([0.1, 0.5, 0.9])} + reals = np.array([0, 1, 1]) + + with patch("rtichoke._viz_spec_v2.prepare_performance_data") as mock_perf: + # 1. Missing performance row + mock_perf.return_value = pl.DataFrame( + schema={ + "reference_group": pl.String, + "stratified_by": pl.String, + "chosen_cutoff": pl.Float64, + "ppcr": pl.Float64, + } + ) + with pytest.raises(ValueError, match="Missing performance row"): + _prediction_distribution_v2_spec_from_performance_data(probs, reals, by=0.5) + + # 2. Duplicated performance row + dup_row = { + "reference_group": "m1", + "stratified_by": "probability_threshold", + "chosen_cutoff": 0.0, + "ppcr": 1.0, + "true_positives": 2, + "true_negatives": 0, + "false_positives": 1, + "false_negatives": 0, + "sensitivity": 1.0, + "specificity": 0.0, + "ppv": 0.66, + "npv": None, + "lift": 1.0, + } + mock_perf.return_value = pl.DataFrame([dup_row, dup_row]) + with pytest.raises(ValueError, match="Duplicate performance match"): + _prediction_distribution_v2_spec_from_performance_data(probs, reals, by=0.5) + + +def test_authoritative_v0221_schema_validation_probability_threshold_and_ppcr(): + schema = json.loads(_SCHEMA_PATH.read_text(encoding="utf-8")) + validator = Draft202012Validator(schema) + + # Confirm all 8 v2 chart type branches are represented in the authoritative schema + chart_types: list[str] = [] + for item in schema.get("anyOf", []): + + def search(obj: object) -> None: + if isinstance(obj, dict): + if "properties" in obj and "type" in obj["properties"]: + tc = obj["properties"]["type"].get("const") + if tc and tc not in ("identity", "horizontal", "vertical", "path"): + chart_types.append(str(tc)) + for v in obj.values(): + search(v) + elif isinstance(obj, list): + for elem in obj: + search(elem) + + search(item) + + expected_types = { + "roc", + "calibration", + "precision_recall", + "gains", + "lift", + "decision_curve", + "interventions_avoided", + "prediction_distribution", + } + assert set(chart_types) == expected_types + + probs = {"m1": np.array([0.00, 0.15, 0.30, 0.50, 0.50, 0.50, 0.65, 0.80, 1.00])} + reals = np.array([0, 1, 0, 1, 0, 1, 1, 0, 1]) + + # 1. Probability Threshold mode schema validation + chart_thresh = rtichoke.create_probs_histogram( + probs=probs, reals=reals, by=0.20, stratified_by=("probability_threshold",) + ) + errors_thresh = list(validator.iter_errors(chart_thresh.spec)) + assert not errors_thresh, ( + f"Schema validation errors in probability_threshold mode: {errors_thresh}" + ) + + # 2. PPCR mode schema validation + chart_ppcr = rtichoke.create_probs_histogram( + probs=probs, reals=reals, by=0.20, stratified_by=("ppcr",) + ) + errors_ppcr = list(validator.iter_errors(chart_ppcr.spec)) + assert not errors_ppcr, f"Schema validation errors in PPCR mode: {errors_ppcr}" + + # 3. Negative schema validation: missing required property 'bins' + bad_spec_missing_bins = dict(chart_thresh.spec) + del bad_spec_missing_bins["bins"] + assert not validator.is_valid(bad_spec_missing_bins) + + # 4. Negative schema validation: unsupported chart type + bad_spec_unsupported_type = dict(chart_thresh.spec, type="unsupported_type") + assert not validator.is_valid(bad_spec_unsupported_type) + + +def test_stratified_by_boundary_validation(): + probs = {"m1": np.array([0.1, 0.5, 0.9])} + reals = np.array([0, 1, 1]) + + # Plain string error + with pytest.raises(ValueError, match="plain string"): + rtichoke.create_probs_histogram( + probs, reals, stratified_by="probability_threshold" + ) + + # Empty sequence error + with pytest.raises(ValueError, match="contain exactly one element"): + rtichoke.create_probs_histogram(probs, reals, stratified_by=()) + + # Sequence with > 1 elements + with pytest.raises(ValueError, match="contain exactly one element"): + rtichoke.create_probs_histogram( + probs, reals, stratified_by=("probability_threshold", "ppcr") + ) + + # Unsupported dimension key error + with pytest.raises(ValueError, match="Unsupported stratification key"): + rtichoke.create_probs_histogram( + probs, reals, stratified_by=("unsupported_key",) + ) + + +def test_negative_contract_failures(): + probs = {"m1": np.array([0.1, 0.5, 0.9])} + reals = np.array([0, 1, 1]) + + dist_data = _prepare_probs_distribution_data(probs, reals, by=0.5) + perf_data = prepare_performance_data(probs, reals, by=0.5) + eval_meta = _build_evaluation_metadata(probs, reals, np.array([])) + + # 1. Unknown reference group in bins + bad_bins = dist_data["bins"].with_columns( + pl.lit("unknown_group").alias("evaluation") + ) + bad_dist = dict(dist_data, bins=bad_bins) + with pytest.raises(ValueError, match="Unknown reference group in bins"): + _prediction_distribution_v2_spec(bad_dist, perf_data, eval_meta) + + # 2. Unknown reference group in rank bins + bad_rank_bins = dist_data["rank_bins"].with_columns( + pl.lit("unknown_group").alias("evaluation") + ) + bad_dist_rank = dict(dist_data, rank_bins=bad_rank_bins) + with pytest.raises(ValueError, match="Unknown reference group in rank bins"): + _prediction_distribution_v2_spec(bad_dist_rank, perf_data, eval_meta) + + # 3. Unknown reference group in operating points + bad_ops = dist_data["operating_points"].with_columns( + pl.lit("unknown_group").alias("evaluation") + ) + bad_dist_op = dict(dist_data, operating_points=bad_ops) + with pytest.raises(ValueError, match="Unknown reference group in operating points"): + _prediction_distribution_v2_spec(bad_dist_op, perf_data, eval_meta) + + # 4. Non-finite requested operating-point value + bad_op_value = dist_data["operating_points"].with_columns( + pl.when(pl.col("value") == 0.0) + .then(float("nan")) + .otherwise(pl.col("value")) + .alias("value") + ) + bad_dist_nan = dict(dist_data, operating_points=bad_op_value) + with pytest.raises(ValueError, match="Non-finite operating point value"): + _prediction_distribution_v2_spec(bad_dist_nan, perf_data, eval_meta) + + # 5. Incomplete evaluation coverage + partial_meta = {"m1": eval_meta["m1"], "m2": eval_meta["m1"]} + with pytest.raises( + ValueError, match="Missing performance row|Incomplete evaluation coverage" + ): + _prediction_distribution_v2_spec(dist_data, perf_data, partial_meta) + + +def test_producer_owned_performance_wins(): + probs = {"m1": np.array([0.1, 0.5, 0.9])} + reals = np.array([0, 1, 1]) + + # Patch prepare_performance_data to return a distinct patched value 999 + with patch("rtichoke._viz_spec_v2.prepare_performance_data") as mock_perf: + from rtichoke.performance_data.performance_data import prepare_performance_data + + real_df = prepare_performance_data( + probs, reals, stratified_by=("probability_threshold",), by=0.5 + ) + patched_df = real_df.with_columns( + pl.when(pl.col("chosen_cutoff") == 0.0) + .then(999) + .otherwise(pl.col("true_positives")) + .alias("true_positives") + ) + mock_perf.return_value = patched_df + + spec = _prediction_distribution_v2_spec_from_performance_data( + probs, reals, by=0.5 + ) + op_0 = [op for op in spec["operatingPoints"] if op["value"] == 0.0][0] + tp_estimate = [ + m["estimate"] + for m in op_0["performance"] + if m["metricId"] == "true_positives" + ][0] + assert tp_estimate == 999 + assert isinstance(tp_estimate, int) diff --git a/tests/test_probs_histogram_browser_acceptance.py b/tests/test_probs_histogram_browser_acceptance.py new file mode 100644 index 00000000..291044a7 --- /dev/null +++ b/tests/test_probs_histogram_browser_acceptance.py @@ -0,0 +1,169 @@ +from contextlib import contextmanager +from functools import partial +from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path +from threading import Thread +from typing import Iterator + +import numpy as np +import pytest + +import rtichoke + + +@contextmanager +def _serve(directory: Path) -> Iterator[str]: + handler = partial(SimpleHTTPRequestHandler, directory=str(directory)) + server = ThreadingHTTPServer(("127.0.0.1", 0), handler) + thread = Thread(target=server.serve_forever, daemon=True) + thread.start() + try: + yield f"http://127.0.0.1:{server.server_port}" + finally: + server.shutdown() + thread.join() + server.server_close() + + +def test_probs_histogram_browser_acceptance_http_and_file_uri(tmp_path: Path): + try: + from playwright.sync_api import sync_playwright + except ImportError: + pytest.skip("playwright is not available") + + probs = {"m1": np.array([0.00, 0.15, 0.30, 0.50, 0.50, 0.50, 0.65, 0.80, 1.00])} + reals = np.array([0, 1, 0, 1, 0, 1, 1, 0, 1]) + + chart = rtichoke.create_probs_histogram(probs=probs, reals=reals, by=0.20) + html_file = tmp_path / "probs_histogram.html" + chart.write_html(html_file) + + # 1. Test via HTTP server + with _serve(tmp_path) as base_url: + with sync_playwright() as p: + browser = p.chromium.launch(headless=True) + page = browser.new_page() + errors: list[str] = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) + if msg.type in ["error", "warning"] + else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(f"{base_url}/probs_histogram.html") + page.wait_for_selector("svg") + + content = page.content() + assert "m1" in content + assert page.locator("svg").count() >= 1 + assert len(errors) == 0, f"Console errors found over HTTP: {errors}" + browser.close() + + # 2. Test direct file:// access (with --allow-file-access-from-files) + with sync_playwright() as p: + browser = p.chromium.launch( + headless=True, + args=["--allow-file-access-from-files"], + ) + page = browser.new_page() + errors = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) if msg.type in ["error", "warning"] else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(html_file.as_uri()) + page.wait_for_selector("svg") + + content = page.content() + assert "m1" in content + assert page.locator("svg").count() >= 1 + assert len(errors) == 0, f"Console errors found over file://: {errors}" + + # 3. Test changing operating point / controls and verify downstream state changes + initial_text = page.locator("body").inner_text() + assert "Sensitivity" in initial_text + assert "100.0%" in initial_text + + op_slider = page.locator("input[type='range']") + assert op_slider.count() > 0 + page.evaluate(""" + const el = document.querySelector("input[type='range']"); + el.value = 2; + el.dispatchEvent(new Event('input', { bubbles: true })); + el.dispatchEvent(new Event('change', { bubbles: true })); + """) + assert op_slider.input_value() == "2" + + updated_text = page.locator("body").inner_text() + assert updated_text != initial_text + # Verify specific updated downstream performance values (sensitivity changed from 100% to 80%) + assert "80.0%" in updated_text + + # Verify no sidecar JS/CSS files were written to the output directory + assert not (tmp_path / "rtichoke-viz.js").exists() + assert not (tmp_path / "rtichoke-viz.css").exists() + + browser.close() + + +def test_probs_histogram_ppcr_mode_browser_acceptance(tmp_path: Path): + try: + from playwright.sync_api import sync_playwright + except ImportError: + pytest.skip("playwright is not available") + + probs = {"m1": np.array([0.00, 0.15, 0.30, 0.50, 0.50, 0.50, 0.65, 0.80, 1.00])} + reals = np.array([0, 1, 0, 1, 0, 1, 1, 0, 1]) + + chart = rtichoke.create_probs_histogram( + probs=probs, reals=reals, by=0.20, stratified_by=("ppcr",) + ) + html_file = tmp_path / "probs_histogram_ppcr.html" + chart.write_html(html_file) + + with sync_playwright() as p: + browser = p.chromium.launch( + headless=True, + args=["--allow-file-access-from-files"], + ) + page = browser.new_page() + errors: list[str] = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) if msg.type in ["error", "warning"] else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(html_file.as_uri()) + page.wait_for_selector("svg") + + assert len(errors) == 0, f"Console errors found in PPCR mode: {errors}" + + # Capture initial rect heights representing rank bin bars + initial_rects = page.locator("svg rect").evaluate_all( + "nodes => nodes.map(n => n.getAttribute('height'))" + ) + + # Change PPCR slider position + page.evaluate(""" + const el = document.querySelector("input[type='range']"); + if (el) { + el.value = 3; + el.dispatchEvent(new Event('input', { bubbles: true })); + el.dispatchEvent(new Event('change', { bubbles: true })); + } + """) + + switched_rects = page.locator("svg rect").evaluate_all( + "nodes => nodes.map(n => n.getAttribute('height'))" + ) + # Verify rank distribution bars remain unchanged while PPCR operating point moves + assert switched_rects == initial_rects + browser.close() diff --git a/tests/test_public_exports.py b/tests/test_public_exports.py index 72398d16..0c8e9365 100644 --- a/tests/test_public_exports.py +++ b/tests/test_public_exports.py @@ -2,6 +2,7 @@ EXPECTED_PUBLIC_EXPORTS = { + "create_probs_histogram", "create_roc_curve", "create_roc_curve_times", "plot_roc_curve", diff --git a/tests/test_rtichoke_viz_vendor.py b/tests/test_rtichoke_viz_vendor.py index d99a1b94..f8f95580 100644 --- a/tests/test_rtichoke_viz_vendor.py +++ b/tests/test_rtichoke_viz_vendor.py @@ -3,19 +3,19 @@ from pathlib import Path _VENDOR = Path(__file__).parents[1] / "src" / "rtichoke" / "_vendor" / "rtichoke_viz" -_RELEASE_DIR = "rtichoke-viz-0.20.2" -_SHA256 = "2e4851159ceea0e3b2420c7e0aa22a566b94ec7057c27b13b7db7da88de34d11" -_SOURCE_COMMIT = "40748bdeff7d535f516744886b64056f3aaa518d" +_RELEASE_DIR = "rtichoke-viz-0.22.1" +_SHA256 = "b812f3fc283d404d3d5982cd1a84157c3cce1f13afcdc87c392d7c9ddc029189" +_SOURCE_COMMIT = "7cc8e8c23ee2f073ff3d8e4f32198eaac4785eb2" -def test_vendored_rtichoke_viz_v0202_provenance_archive_and_schemas(): +def test_vendored_rtichoke_viz_v0221_provenance_archive_and_schemas(): provenance = (_VENDOR / "VENDORED_FROM").read_text() - assert "release=v0.20.2" in provenance + assert "release=v0.22.1" in provenance assert f"source_commit={_SOURCE_COMMIT}" in provenance - assert "archive=rtichoke-viz-0.20.2.tar.gz" in provenance + assert "archive=rtichoke-viz-0.22.1.tar.gz" in provenance assert f"sha256={_SHA256}" in provenance - archive = _VENDOR / "rtichoke-viz-0.20.2.tar.gz" + archive = _VENDOR / "rtichoke-viz-0.22.1.tar.gz" assert hashlib.sha256(archive.read_bytes()).hexdigest() == _SHA256 with tarfile.open(archive, "r:gz") as release: assert set(release.getnames()) == { @@ -30,7 +30,7 @@ def test_vendored_rtichoke_viz_v0202_provenance_archive_and_schemas(): manifest = release.extractfile(f"{_RELEASE_DIR}/MANIFEST") assert manifest is not None assert manifest.read().decode() == ( - f"version=0.20.2\ncommit={_SOURCE_COMMIT}\n" + f"version=0.22.1\ncommit={_SOURCE_COMMIT}\n" ) for filename in ( "rtichoke-viz.css", @@ -43,6 +43,8 @@ def test_vendored_rtichoke_viz_v0202_provenance_archive_and_schemas(): assert packaged is not None assert (_VENDOR / filename).read_bytes() == packaged.read() + assert not (_VENDOR / "rtichoke-viz-0.22.0.tar.gz").exists() + assert not (_VENDOR / "rtichoke-viz-0.20.2.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.20.1.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.20.0.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.19.0.tar.gz").exists() @@ -61,7 +63,7 @@ def test_vendored_rtichoke_viz_v0202_provenance_archive_and_schemas(): assert '"summary_metrics"' in report_schema -def test_v0202_bundle_keeps_existing_exports_and_time_dependent_surfaces(): +def test_v0221_bundle_keeps_existing_exports_and_prediction_distribution(): bundle = (_VENDOR / "rtichoke-viz.js").read_text(encoding="utf-8") for export_name in ( "renderRoc", @@ -79,6 +81,8 @@ def test_v0202_bundle_keeps_existing_exports_and_time_dependent_surfaces(): "renderPerformanceTable", "renderReport", "SummaryMetricsSpecSchema", + "renderPredictionDistribution", + "PredictionDistributionSpecSchema", ): assert export_name in bundle