diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bd2f4b61..740e177d 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.22.3.tar.gz", + f"{prefix}rtichoke-viz-0.23.0.tar.gz", f"{prefix}rtichoke-viz.js", f"{prefix}rtichoke-viz.css", f"{prefix}rtichoke-viz.schema.json", @@ -60,6 +60,7 @@ jobs: f"{prefix}rtichoke-viz-report.schema.json", } assert required <= names + assert f"{prefix}rtichoke-viz-0.22.3.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.22.2.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.22.1.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.22.0.tar.gz" not in names diff --git a/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM b/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM index dbdd3904..070d66b1 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.22.3 -source_commit=05a2d9d96a9a3fafcd484da8ecaa28b331906f90 -archive=rtichoke-viz-0.22.3.tar.gz -sha256=9ad35b6acae507ff5017a936404066ef43a86282c374d88b9c32e9358f3bf572 +release=v0.23.0 +source_commit=7cbdf940f5375b771e741191b875b07cd6935fe3 +archive=rtichoke-viz-0.23.0.tar.gz +sha256=55bc510522f3efeb62faaec24fe6a6476169ee05002be8f24cb812c99031384a diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.3.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.3.tar.gz deleted file mode 100644 index 160d5a40..00000000 Binary files a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.22.3.tar.gz and /dev/null differ diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.0.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.0.tar.gz new file mode 100644 index 00000000..d0c077b9 Binary files /dev/null and b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.0.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 e570ef8e..36eb712c 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json @@ -611,6 +611,108 @@ "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" + } + ] + } + } + } } } } @@ -1827,6 +1929,108 @@ "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" + } + ] + } + } + } } } } @@ -2406,6 +2610,108 @@ "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" + } + ] + } + } + } } } } @@ -2983,6 +3289,108 @@ }, "lift": { "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" + } + ] + } + } + } } } } @@ -3675,6 +4083,108 @@ }, "netBenefit": { "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" + } + ] + } + } + } } } } @@ -4512,6 +5022,108 @@ }, "interventionsAvoided": { "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" + } + ] + } + } + } } } } @@ -6557,6 +7169,108 @@ "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" + } + ] + } + } + } } } } @@ -7773,6 +8487,108 @@ "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" + } + ] + } + } + } } } } @@ -8352,6 +9168,108 @@ "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" + } + ] + } + } + } } } } @@ -8929,6 +9847,108 @@ }, "lift": { "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" + } + ] + } + } + } } } } @@ -9621,6 +10641,108 @@ }, "netBenefit": { "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" + } + ] + } + } + } } } } @@ -10458,6 +11580,108 @@ }, "interventionsAvoided": { "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" + } + ] + } + } + } } } } @@ -12481,6 +13705,108 @@ "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" + } + ] + } + } + } } } } @@ -13697,6 +15023,108 @@ "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" + } + ] + } + } + } } } } @@ -14276,6 +15704,108 @@ "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" + } + ] + } + } + } } } } @@ -14853,6 +16383,108 @@ }, "lift": { "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" + } + ] + } + } + } } } } @@ -15545,6 +17177,108 @@ }, "netBenefit": { "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" + } + ] + } + } + } } } } @@ -16382,6 +18116,108 @@ }, "interventionsAvoided": { "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 aed3d411..33ffbd1d 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json @@ -570,6 +570,108 @@ "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" + } + ] + } + } + } } } } @@ -1786,6 +1888,108 @@ "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" + } + ] + } + } + } } } } @@ -2365,6 +2569,108 @@ "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" + } + ] + } + } + } } } } @@ -2942,6 +3248,108 @@ }, "lift": { "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" + } + ] + } + } + } } } } @@ -3634,6 +4042,108 @@ }, "netBenefit": { "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" + } + ] + } + } + } } } } @@ -4471,6 +4981,108 @@ }, "interventionsAvoided": { "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 84e43688..5bcf32d0 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.css @@ -75,6 +75,7 @@ display: flex; flex-direction: column; gap: 0.5rem; + font-family: Arial, Helvetica, sans-serif; } .rtichoke-operating-point-content { @@ -90,27 +91,99 @@ .rtichoke-operating-point-label { font-family: inherit; - font-size: 0.875rem; - font-weight: 500; - color: #374151; + font-size: 16px; + font-weight: 400; + color: #000000; } .rtichoke-operating-point-value { - font-weight: 600; - color: #111827; + font-weight: 400; + color: #000000; } .rtichoke-operating-point-slider { + -webkit-appearance: none; + appearance: none; width: 100%; + height: 24px; + min-height: 24px; margin: 0; box-sizing: border-box; - cursor: pointer; + cursor: ew-resize; + background: transparent; +} + +.rtichoke-operating-point-slider:focus { + outline: none; +} + +.rtichoke-operating-point-slider:focus-visible { + outline: 2px solid #2563eb; + outline-offset: 2px; + border-radius: 4px; +} + +/* WebKit Track & Thumb */ +.rtichoke-operating-point-slider::-webkit-slider-runnable-track { + width: 100%; + height: 5px; + background-color: #f8fafc; + border: 1px solid #bec8d9; + border-radius: 2px; + box-sizing: border-box; + cursor: ew-resize; +} + +.rtichoke-operating-point-slider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 20px; + height: 20px; + border-radius: 50%; + background-color: #f6f8fa; + border: 1px solid #bec8d9; + box-shadow: none; + margin-top: -8.5px; /* center 20px thumb on 5px (3px inner) track */ + cursor: ew-resize; + transition: background-color 0.15s ease, border-color 0.15s ease; +} + +.rtichoke-operating-point-slider:active::-webkit-slider-thumb { + background-color: #dbdde0; +} + +/* Firefox Track & Thumb */ +.rtichoke-operating-point-slider::-moz-range-track { + width: 100%; + height: 5px; + background-color: #f8fafc; + border: 1px solid #bec8d9; + border-radius: 2px; + box-sizing: border-box; + cursor: ew-resize; +} + +.rtichoke-operating-point-slider::-moz-range-thumb { + width: 20px; + height: 20px; + border-radius: 50%; + background-color: #f6f8fa; + border: 1px solid #bec8d9; + box-shadow: none; + box-sizing: border-box; + cursor: ew-resize; + transition: background-color 0.15s ease, border-color 0.15s ease; +} + +.rtichoke-operating-point-slider:active::-moz-range-thumb { + background-color: #dbdde0; } .rtichoke-horizon-chart { display: flex; flex-direction: column; gap: 0.5rem; + font-family: Arial, Helvetica, sans-serif; } .rtichoke-horizon-control { @@ -134,7 +207,7 @@ /* Performance Table Scoped Styling */ .rtichoke-performance-table { - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.4; color: #1f2937; @@ -426,7 +499,7 @@ max-width: 1200px; margin: 0 auto; box-sizing: border-box; - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + font-family: Arial, Helvetica, sans-serif; color: #1a1a1a; } @@ -638,6 +711,7 @@ flex-direction: column; gap: 0.75rem; box-sizing: border-box; + font-family: Arial, Helvetica, sans-serif; } .rtichoke-prediction-distribution__controls { @@ -966,3 +1040,76 @@ background-color: #f0fdf4 !important; font-weight: 700 !important; } + +/* Summary Metrics Scoped Styling */ +.rtichoke-summary-metrics { + font-family: Arial, Helvetica, sans-serif; + font-size: 13px; + line-height: 1.4; + color: #1f2937; + margin: 0; + padding: 0; +} + +.rtichoke-summary-metrics__title { + font-size: 1.1rem; + font-weight: 600; + color: #111827; + margin-bottom: 0.5rem; +} + +.rtichoke-summary-metrics__table { + width: 100%; + max-width: 520px; + border-collapse: collapse; + text-align: left; + border-spacing: 0; + border: 1px solid #e5e7eb; + border-radius: 6px; + overflow: hidden; + background-color: #ffffff; +} + +.rtichoke-summary-metrics__table th { + padding: 0.4rem 0.65rem; + font-weight: 600; + font-size: 12px; + color: #374151; + background-color: #f9fafb; + border-bottom: 1px solid #e5e7eb; + white-space: nowrap; +} + +.rtichoke-summary-metrics__table th:last-child { + text-align: right; +} + +.rtichoke-summary-metrics__table td { + padding: 0.4rem 0.65rem; + border-bottom: 1px solid #f3f4f6; + white-space: nowrap; +} + +.rtichoke-summary-metrics__table tbody tr:last-child td { + border-bottom: none; +} + +.rtichoke-summary-metrics__table tbody tr:hover { + background-color: #f9fafb; +} + +.rtichoke-summary-metrics__owner { + font-weight: 500; + color: #111827; +} + +.rtichoke-summary-metrics__metric { + color: #374151; +} + +.rtichoke-summary-metrics__estimate { + font-variant-numeric: tabular-nums; + font-weight: 600; + text-align: right; + color: #111827; +} diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js index cc140912..1bd750b8 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js @@ -1,8 +1,8 @@ -var MO=Object.defineProperty;var Ma=(e,t)=>{for(var r in t)MO(e,r,{get:t[r],enumerable:!0})};var mr={};Ma(mr,{HasPropertyKey:()=>Cl,IsArray:()=>Tt,IsAsyncIterator:()=>I0,IsBigInt:()=>yf,IsBoolean:()=>Xo,IsDate:()=>Ca,IsFunction:()=>_0,IsIterator:()=>v0,IsNull:()=>P0,IsNumber:()=>Wr,IsObject:()=>je,IsRegExp:()=>gf,IsString:()=>We,IsSymbol:()=>T0,IsUint8Array:()=>Zo,IsUndefined:()=>Mt});function Cl(e,t){return t in e}function I0(e){return je(e)&&!Tt(e)&&!Zo(e)&&Symbol.asyncIterator in e}function Tt(e){return Array.isArray(e)}function yf(e){return typeof e=="bigint"}function Xo(e){return typeof e=="boolean"}function Ca(e){return e instanceof globalThis.Date}function _0(e){return typeof e=="function"}function v0(e){return je(e)&&!Tt(e)&&!Zo(e)&&Symbol.iterator in e}function P0(e){return e===null}function Wr(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 T0(e){return typeof e=="symbol"}function Zo(e){return e instanceof globalThis.Uint8Array}function Mt(e){return e===void 0}function CO(e){return e.map(t=>Ol(t))}function OO(e){return new Date(e.getTime())}function kO(e){return new Uint8Array(e)}function RO(e){return new RegExp(e.source,e.flags)}function NO(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Ol(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Ol(e[r]);return t}function Ol(e){return Tt(e)?CO(e):Ca(e)?OO(e):Zo(e)?kO(e):gf(e)?RO(e):je(e)?NO(e):e}function nt(e){return Ol(e)}function Cs(e,t){return t===void 0?nt(e):nt({...t,...e})}function kl(e){return de(e)&&globalThis.Symbol.asyncIterator in e}function Rl(e){return de(e)&&globalThis.Symbol.iterator in e}function M0(e){return de(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function Nl(e){return e instanceof globalThis.Promise}function Ir(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function xw(e){return e instanceof globalThis.Map}function ww(e){return e instanceof globalThis.Set}function mn(e){return globalThis.ArrayBuffer.isView(e)}function Os(e){return e instanceof globalThis.Uint8Array}function fe(e,t){return t in e}function de(e){return e!==null&&typeof e=="object"}function ue(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function ot(e){return e===void 0}function Qo(e){return e===null}function yo(e){return typeof e=="boolean"}function at(e){return typeof e=="number"}function Al(e){return globalThis.Number.isInteger(e)}function Ln(e){return typeof e=="bigint"}function Ue(e){return typeof e=="string"}function Vi(e){return typeof e=="function"}function Jo(e){return typeof e=="symbol"}function Xr(e){return Ln(e)||yo(e)||Qo(e)||at(e)||Ue(e)||Jo(e)||ot(e)}var Nt;(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=de(a);return e.AllowArrayObject?s:s&&!ue(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?at(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=ot(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(Nt||(Nt={}));function AO(e){return globalThis.Object.freeze(e).map(t=>xf(t))}function EO(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 Tt(e)?AO(e):Ca(e)?e:Zo(e)?e:gf(e)?e:je(e)?EO(e):e}function F(e,t){let r=t!==void 0?{...t,...e}:e;switch(Nt.InstanceMode){case"freeze":return xf(r);case"clone":return nt(r);default:return r}}var le=class extends Error{constructor(t){super(t)}};var ft=Symbol.for("TypeBox.Transform"),Vn=Symbol.for("TypeBox.Readonly"),ir=Symbol.for("TypeBox.Optional"),dn=Symbol.for("TypeBox.Hint"),$=Symbol.for("TypeBox.Kind");function ks(e){return je(e)&&e[Vn]==="Readonly"}function Nr(e){return je(e)&&e[ir]==="Optional"}function C0(e){return Me(e,"Any")}function O0(e){return Me(e,"Argument")}function Un(e){return Me(e,"Array")}function Oa(e){return Me(e,"AsyncIterator")}function ka(e){return Me(e,"BigInt")}function ei(e){return Me(e,"Boolean")}function jn(e){return Me(e,"Computed")}function Bn(e){return Me(e,"Constructor")}function FO(e){return Me(e,"Date")}function zn(e){return Me(e,"Function")}function Gn(e){return Me(e,"Integer")}function dt(e){return Me(e,"Intersect")}function Ra(e){return Me(e,"Iterator")}function Me(e,t){return je(e)&&$ in e&&e[$]===t}function El(e){return Xo(e)||Wr(e)||We(e)}function Zr(e){return Me(e,"Literal")}function Qr(e){return Me(e,"MappedKey")}function st(e){return Me(e,"MappedResult")}function Ui(e){return Me(e,"Never")}function $O(e){return Me(e,"Not")}function wf(e){return Me(e,"Null")}function Kn(e){return Me(e,"Number")}function Ct(e){return Me(e,"Object")}function Na(e){return Me(e,"Promise")}function Aa(e){return Me(e,"Record")}function xt(e){return Me(e,"Ref")}function k0(e){return Me(e,"RegExp")}function ti(e){return Me(e,"String")}function Sf(e){return Me(e,"Symbol")}function Jr(e){return Me(e,"TemplateLiteral")}function DO(e){return Me(e,"This")}function Ee(e){return je(e)&&ft in e}function en(e){return Me(e,"Tuple")}function ri(e){return Me(e,"Undefined")}function ke(e){return Me(e,"Union")}function LO(e){return Me(e,"Uint8Array")}function VO(e){return Me(e,"Unknown")}function UO(e){return Me(e,"Unsafe")}function jO(e){return Me(e,"Void")}function ji(e){return je(e)&&$ in e&&We(e[$])}function ut(e){return C0(e)||O0(e)||Un(e)||ei(e)||ka(e)||Oa(e)||jn(e)||Bn(e)||FO(e)||zn(e)||Gn(e)||dt(e)||Ra(e)||Zr(e)||Qr(e)||st(e)||Ui(e)||$O(e)||wf(e)||Kn(e)||Ct(e)||Na(e)||Aa(e)||xt(e)||k0(e)||ti(e)||Sf(e)||Jr(e)||DO(e)||en(e)||ri(e)||ke(e)||LO(e)||VO(e)||UO(e)||jO(e)||ji(e)}var P={};Ma(P,{IsAny:()=>vw,IsArgument:()=>Pw,IsArray:()=>Tw,IsAsyncIterator:()=>Mw,IsBigInt:()=>Cw,IsBoolean:()=>Ow,IsComputed:()=>kw,IsConstructor:()=>Rw,IsDate:()=>Nw,IsFunction:()=>Aw,IsImport:()=>HO,IsInteger:()=>Ew,IsIntersect:()=>Fw,IsIterator:()=>$w,IsKind:()=>c2,IsKindOf:()=>Ie,IsLiteral:()=>_f,IsLiteralBoolean:()=>YO,IsLiteralNumber:()=>Lw,IsLiteralString:()=>Dw,IsLiteralValue:()=>Vw,IsMappedKey:()=>Uw,IsMappedResult:()=>jw,IsNever:()=>Bw,IsNot:()=>zw,IsNull:()=>Gw,IsNumber:()=>Kw,IsObject:()=>qw,IsOptional:()=>qO,IsPromise:()=>Hw,IsProperties:()=>Fl,IsReadonly:()=>KO,IsRecord:()=>Yw,IsRecursive:()=>WO,IsRef:()=>Ww,IsRegExp:()=>Xw,IsSchema:()=>zt,IsString:()=>Zw,IsSymbol:()=>Qw,IsTemplateLiteral:()=>Jw,IsThis:()=>e2,IsTransform:()=>t2,IsTuple:()=>r2,IsUint8Array:()=>o2,IsUndefined:()=>n2,IsUnion:()=>E0,IsUnionLiteral:()=>XO,IsUnknown:()=>i2,IsUnsafe:()=>a2,IsVoid:()=>s2,TypeGuardUnknownTypeError:()=>R0});var R0=class extends le{},BO=["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 Sw(e){try{return new RegExp(e),!0}catch{return!1}}function N0(e){if(!We(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function Iw(e){return A0(e)||zt(e)}function If(e){return Mt(e)||yf(e)}function Xe(e){return Mt(e)||Wr(e)}function A0(e){return Mt(e)||Xo(e)}function Be(e){return Mt(e)||We(e)}function zO(e){return Mt(e)||We(e)&&N0(e)&&Sw(e)}function GO(e){return Mt(e)||We(e)&&N0(e)}function _w(e){return Mt(e)||zt(e)}function KO(e){return je(e)&&e[Vn]==="Readonly"}function qO(e){return je(e)&&e[ir]==="Optional"}function vw(e){return Ie(e,"Any")&&Be(e.$id)}function Pw(e){return Ie(e,"Argument")&&Wr(e.index)}function Tw(e){return Ie(e,"Array")&&e.type==="array"&&Be(e.$id)&&zt(e.items)&&Xe(e.minItems)&&Xe(e.maxItems)&&A0(e.uniqueItems)&&_w(e.contains)&&Xe(e.minContains)&&Xe(e.maxContains)}function Mw(e){return Ie(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Be(e.$id)&&zt(e.items)}function Cw(e){return Ie(e,"BigInt")&&e.type==="bigint"&&Be(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"&&Be(e.$id)}function kw(e){return Ie(e,"Computed")&&We(e.target)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))}function Rw(e){return Ie(e,"Constructor")&&e.type==="Constructor"&&Be(e.$id)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))&&zt(e.returns)}function Nw(e){return Ie(e,"Date")&&e.type==="Date"&&Be(e.$id)&&Xe(e.exclusiveMaximumTimestamp)&&Xe(e.exclusiveMinimumTimestamp)&&Xe(e.maximumTimestamp)&&Xe(e.minimumTimestamp)&&Xe(e.multipleOfTimestamp)}function Aw(e){return Ie(e,"Function")&&e.type==="Function"&&Be(e.$id)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))&&zt(e.returns)}function HO(e){return Ie(e,"Import")&&Cl(e,"$defs")&&je(e.$defs)&&Fl(e.$defs)&&Cl(e,"$ref")&&We(e.$ref)&&e.$ref in e.$defs}function Ew(e){return Ie(e,"Integer")&&e.type==="integer"&&Be(e.$id)&&Xe(e.exclusiveMaximum)&&Xe(e.exclusiveMinimum)&&Xe(e.maximum)&&Xe(e.minimum)&&Xe(e.multipleOf)}function Fl(e){return je(e)&&Object.entries(e).every(([t,r])=>N0(t)&&zt(r))}function Fw(e){return Ie(e,"Intersect")&&!(We(e.type)&&e.type!=="object")&&Tt(e.allOf)&&e.allOf.every(t=>zt(t)&&!t2(t))&&Be(e.type)&&(A0(e.unevaluatedProperties)||_w(e.unevaluatedProperties))&&Be(e.$id)}function $w(e){return Ie(e,"Iterator")&&e.type==="Iterator"&&Be(e.$id)&&zt(e.items)}function Ie(e,t){return je(e)&&$ in e&&e[$]===t}function Dw(e){return _f(e)&&We(e.const)}function Lw(e){return _f(e)&&Wr(e.const)}function YO(e){return _f(e)&&Xo(e.const)}function _f(e){return Ie(e,"Literal")&&Be(e.$id)&&Vw(e.const)}function Vw(e){return Xo(e)||Wr(e)||We(e)}function Uw(e){return Ie(e,"MappedKey")&&Tt(e.keys)&&e.keys.every(t=>Wr(t)||We(t))}function jw(e){return Ie(e,"MappedResult")&&Fl(e.properties)}function Bw(e){return Ie(e,"Never")&&je(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function zw(e){return Ie(e,"Not")&&zt(e.not)}function Gw(e){return Ie(e,"Null")&&e.type==="null"&&Be(e.$id)}function Kw(e){return Ie(e,"Number")&&e.type==="number"&&Be(e.$id)&&Xe(e.exclusiveMaximum)&&Xe(e.exclusiveMinimum)&&Xe(e.maximum)&&Xe(e.minimum)&&Xe(e.multipleOf)}function qw(e){return Ie(e,"Object")&&e.type==="object"&&Be(e.$id)&&Fl(e.properties)&&Iw(e.additionalProperties)&&Xe(e.minProperties)&&Xe(e.maxProperties)}function Hw(e){return Ie(e,"Promise")&&e.type==="Promise"&&Be(e.$id)&&zt(e.item)}function Yw(e){return Ie(e,"Record")&&e.type==="object"&&Be(e.$id)&&Iw(e.additionalProperties)&&je(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&Sw(r[0])&&je(t.patternProperties)&&zt(t.patternProperties[r[0]])})(e)}function WO(e){return je(e)&&dn in e&&e[dn]==="Recursive"}function Ww(e){return Ie(e,"Ref")&&Be(e.$id)&&We(e.$ref)}function Xw(e){return Ie(e,"RegExp")&&Be(e.$id)&&We(e.source)&&We(e.flags)&&Xe(e.maxLength)&&Xe(e.minLength)}function Zw(e){return Ie(e,"String")&&e.type==="string"&&Be(e.$id)&&Xe(e.minLength)&&Xe(e.maxLength)&&zO(e.pattern)&&GO(e.format)}function Qw(e){return Ie(e,"Symbol")&&e.type==="symbol"&&Be(e.$id)}function Jw(e){return Ie(e,"TemplateLiteral")&&e.type==="string"&&We(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function e2(e){return Ie(e,"This")&&Be(e.$id)&&We(e.$ref)}function t2(e){return je(e)&&ft in e}function r2(e){return Ie(e,"Tuple")&&e.type==="array"&&Be(e.$id)&&Wr(e.minItems)&&Wr(e.maxItems)&&e.minItems===e.maxItems&&(Mt(e.items)&&Mt(e.additionalItems)&&e.minItems===0||Tt(e.items)&&e.items.every(t=>zt(t)))}function n2(e){return Ie(e,"Undefined")&&e.type==="undefined"&&Be(e.$id)}function XO(e){return E0(e)&&e.anyOf.every(t=>Dw(t)||Lw(t))}function E0(e){return Ie(e,"Union")&&Be(e.$id)&&je(e)&&Tt(e.anyOf)&&e.anyOf.every(t=>zt(t))}function o2(e){return Ie(e,"Uint8Array")&&e.type==="Uint8Array"&&Be(e.$id)&&Xe(e.minByteLength)&&Xe(e.maxByteLength)}function i2(e){return Ie(e,"Unknown")&&Be(e.$id)}function a2(e){return Ie(e,"Unsafe")}function s2(e){return Ie(e,"Void")&&e.type==="void"&&Be(e.$id)}function c2(e){return je(e)&&$ in e&&We(e[$])&&!BO.includes(e[$])}function zt(e){return je(e)&&(vw(e)||Pw(e)||Tw(e)||Ow(e)||Cw(e)||Mw(e)||kw(e)||Rw(e)||Nw(e)||Aw(e)||Ew(e)||Fw(e)||$w(e)||_f(e)||Uw(e)||jw(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)||e2(e)||r2(e)||n2(e)||E0(e)||o2(e)||i2(e)||a2(e)||s2(e)||c2(e))}var F0="(true|false)",vf="(0|[1-9][0-9]*)",$0="(.*)",ZO="(?!.*)",pB=`^${F0}$`,Bi=`^${vf}$`,zi=`^${$0}$`,f2=`^${ZO}$`;var Gi={};Ma(Gi,{Clear:()=>JO,Delete:()=>e5,Entries:()=>QO,Get:()=>n5,Has:()=>t5,Set:()=>r5});var Rs=new Map;function QO(){return new Map(Rs)}function JO(){return Rs.clear()}function e5(e){return Rs.delete(e)}function t5(e){return Rs.has(e)}function r5(e,t){Rs.set(e,t)}function n5(e){return Rs.get(e)}var qn={};Ma(qn,{Clear:()=>i5,Delete:()=>a5,Entries:()=>o5,Get:()=>f5,Has:()=>s5,Set:()=>c5});var Ns=new Map;function o5(){return new Map(Ns)}function i5(){return Ns.clear()}function a5(e){return Ns.delete(e)}function s5(e){return Ns.has(e)}function c5(e,t){Ns.set(e,t)}function f5(e){return Ns.get(e)}function u2(e,t){return e.includes(t)}function l2(e){return[...new Set(e)]}function u5(e,t){return e.filter(r=>t.includes(r))}function l5(e,t){return e.reduce((r,n)=>u5(r,n),t)}function p2(e){return e.length===1?e[0]:e.length>1?l5(e.slice(1),e[0]):[]}function m2(e){let t=[];for(let r of e)t.push(...r);return t}function Ki(e){return F({[$]:"Any"},e)}function As(e,t){return F({[$]:"Array",type:"array",items:e},t)}function d2(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 p5(e,t){let{[t]:r,...n}=e;return n}function ht(e,t){return t.reduce((r,n)=>p5(r,n),e)}function Se(e){return F({[$]:"Never",not:{}},e)}function Re(e){return F({[$]:"MappedResult",properties:e})}function Fs(e,t,r){return F({[$]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function go(e,t,r){return F({[$]:"Function",type:"Function",parameters:e,returns:t},r)}function Pf(e,t){return F({[$]:"Union",anyOf:e},t)}function m5(e){return e.some(t=>Nr(t))}function h2(e){return e.map(t=>Nr(t)?d5(t):t)}function d5(e){return ht(e,[ir])}function h5(e,t){return m5(e)?dr(Pf(h2(e),t)):Pf(h2(e),t)}function xo(e,t){return e.length===1?F(e[0],t):e.length===0?Se(t):h5(e,t)}function Fe(e,t){return e.length===0?Se(t):e.length===1?F(e[0],t):Pf(e,t)}var $l=class extends le{};function b5(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function D0(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function oi(e,t){return D0(e,t,"(")}function Tf(e,t){return D0(e,t,")")}function b2(e,t){return D0(e,t,"|")}function y5(e){if(!(oi(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 I5(e){function t(o,i){if(!oi(o,i))throw new $l("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 y5(e)?$s(g5(e)):x5(e)?S5(e):w5(e)?I5(e):{type:"const",const:b5(e)}}function Ds(e){return $s(e.slice(1,e.length-1))}var L0=class extends le{};function _5(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 v5(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 P5(e){return e.type==="const"&&e.const===".*"}function Ea(e){return _5(e)||P5(e)?!1:v5(e)?!0:e.type==="and"?e.expr.every(t=>Ea(t)):e.type==="or"?e.expr.every(t=>Ea(t)):e.type==="const"?!0:(()=>{throw new L0("Unknown expression type")})()}function Dl(e){let t=Ds(e.pattern);return Ea(t)}var V0=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*T5(e){return yield*y2(e.expr.map(t=>[...Mf(t)]))}function*M5(e){for(let t of e.expr)yield*Mf(t)}function*C5(e){return yield e.const}function*Mf(e){return e.type==="and"?yield*T5(e):e.type==="or"?yield*M5(e):e.type==="const"?yield*C5(e):(()=>{throw new V0("Unknown expression")})()}function Ls(e){let t=Ds(e.pattern);return Ea(t)?[...Mf(t)]:[]}function Ce(e,t){return F({[$]:"Literal",const:e,type:typeof e},t)}function Ll(e){return F({[$]:"Boolean",type:"boolean"},e)}function Vs(e){return F({[$]:"BigInt",type:"bigint"},e)}function hn(e){return F({[$]:"Number",type:"number"},e)}function _r(e){return F({[$]:"String",type:"string"},e)}function*O5(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield Ll():t==="number"?yield hn():t==="bigint"?yield Vs():t==="string"?yield _r():yield(()=>{let r=t.split("|").map(n=>Ce(n.trim()));return r.length===0?Se():r.length===1?r[0]:xo(r)})()}function*k5(e){if(e[1]!=="{"){let t=Ce("$"),r=U0(e.slice(1));return yield*[t,...r]}for(let t=2;tx2(r,t)).join("|")})`:Kn(e)?`${t}${vf}`:Gn(e)?`${t}${vf}`:ka(e)?`${t}${vf}`:ti(e)?`${t}${$0}`:Zr(e)?`${t}${R5(e.const.toString())}`:ei(e)?`${t}${F0}`:(()=>{throw new j0(`Unexpected Kind '${e[$]}'`)})()}function B0(e){return`^${e.map(t=>x2(t,"")).join("")}$`}function Fa(e){let r=Ls(e).map(n=>Ce(n));return xo(r)}function Vl(e,t){let r=We(e)?B0(g2(e)):B0(e);return F({[$]:"TemplateLiteral",type:"string",pattern:r},t)}function N5(e){return Ls(e).map(r=>r.toString())}function A5(e){let t=[];for(let r of e)t.push(...Ar(r));return t}function E5(e){return[e.toString()]}function Ar(e){return[...new Set(Jr(e)?N5(e):ke(e)?A5(e.anyOf):Zr(e)?E5(e.const):Kn(e)?["[number]"]:Gn(e)?["[number]"]:[])]}function F5(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=qi(e,Ar(t[o]),r);return n}function $5(e,t,r){return F5(e,t.properties,r)}function w2(e,t,r){let n=$5(e,t,r);return Re(n)}function I2(e,t){return e.map(r=>_2(r,t))}function D5(e){return e.filter(t=>!Ui(t))}function L5(e,t){return Ul(D5(I2(e,t)))}function V5(e){return e.some(t=>Ui(t))?[]:e}function U5(e,t){return xo(V5(I2(e,t)))}function j5(e,t){return t in e?e[t]:t==="[number]"?xo(e):Se()}function B5(e,t){return t==="[number]"?e:Se()}function z5(e,t){return t in e?e[t]:Se()}function _2(e,t){return dt(e)?L5(e.allOf,t):ke(e)?U5(e.anyOf,t):en(e)?j5(e.items??[],t):Un(e)?B5(e.items,t):Ct(e)?z5(e.properties,t):Se()}function Cf(e,t){return t.map(r=>_2(e,r))}function S2(e,t){return xo(Cf(e,t))}function qi(e,t,r){if(xt(e)||xt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!ut(e)||!ut(t))throw new le(n);return Qe("Index",[e,t])}return st(t)?w2(e,t,r):Qr(t)?v2(e,t,r):F(ut(t)?S2(e,Ar(t)):S2(e,t),r)}function G5(e,t,r){return{[t]:qi(e,[t],nt(r))}}function K5(e,t,r){return t.reduce((n,o)=>({...n,...G5(e,o,r)}),{})}function q5(e,t,r){return K5(e,t.keys,r)}function v2(e,t,r){let n=q5(e,t,r);return Re(n)}function Us(e,t){return F({[$]:"Iterator",type:"Iterator",items:e},t)}function H5(e){return globalThis.Object.keys(e).filter(t=>!Nr(e[t]))}function Y5(e,t){let r=H5(e),n=r.length>0?{[$]:"Object",type:"object",required:r,properties:e}:{[$]:"Object",type:"object",properties:e};return F(n,t)}var $e=Y5;function jl(e,t){return F({[$]:"Promise",type:"Promise",item:e},t)}function W5(e){return F(ht(e,[Vn]))}function X5(e){return F({...e,[Vn]:"Readonly"})}function Z5(e,t){return t===!1?W5(e):X5(e)}function Er(e,t){let r=t??!0;return st(e)?P2(e,r):Z5(e,r)}function Q5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Er(e[n],t);return r}function J5(e,t){return Q5(e.properties,t)}function P2(e,t){let r=J5(e,t);return Re(r)}function bn(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 T2(e,t){return e in t?yn(e,t[e]):Re(t)}function e8(e){return{[e]:Ce(e)}}function t8(e){let t={};for(let r of e)t[r]=Ce(r);return t}function r8(e,t){return u2(t,e)?e8(e):t8(t)}function n8(e,t){let r=r8(e,t);return T2(e,r)}function Of(e,t){return t.map(r=>yn(e,r))}function o8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=yn(e,t[n]);return r}function yn(e,t){let r={...t};return Nr(t)?dr(yn(e,ht(t,[ir]))):ks(t)?Er(yn(e,ht(t,[Vn]))):st(t)?T2(e,t.properties):Qr(t)?n8(e,t.keys):Bn(t)?Fs(Of(e,t.parameters),yn(e,t.returns),r):zn(t)?go(Of(e,t.parameters),yn(e,t.returns),r):Oa(t)?Es(yn(e,t.items),r):Ra(t)?Us(yn(e,t.items),r):dt(t)?hr(Of(e,t.allOf),r):ke(t)?Fe(Of(e,t.anyOf),r):en(t)?bn(Of(e,t.items??[]),r):Ct(t)?$e(o8(e,t.properties),r):Un(t)?As(yn(e,t.items),r):Na(t)?jl(yn(e,t.item),r):t}function i8(e,t){let r={};for(let n of e)r[n]=yn(n,t);return r}function M2(e,t,r){let n=ut(e)?Ar(e):e,o=t({[$]:"MappedKey",keys:n}),i=i8(n,o);return $e(i,r)}function a8(e){return F(ht(e,[ir]))}function s8(e){return F({...e,[ir]:"Optional"})}function c8(e,t){return t===!1?a8(e):s8(e)}function dr(e,t){let r=t??!0;return st(e)?C2(e,r):c8(e,r)}function f8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=dr(e[n],t);return r}function u8(e,t){return f8(e.properties,t)}function C2(e,t){let r=u8(e,t);return Re(r)}function kf(e,t={}){let r=e.every(o=>Ct(o)),n=ut(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return F(t.unevaluatedProperties===!1||ut(t.unevaluatedProperties)||r?{...n,[$]:"Intersect",type:"object",allOf:e}:{...n,[$]:"Intersect",allOf:e},t)}function l8(e){return e.every(t=>Nr(t))}function p8(e){return ht(e,[ir])}function O2(e){return e.map(t=>Nr(t)?p8(t):t)}function m8(e,t){return l8(e)?dr(kf(O2(e),t)):kf(O2(e),t)}function Ul(e,t={}){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ee(r)))throw new Error("Cannot intersect transform types");return m8(e,t)}function hr(e,t){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ee(r)))throw new Error("Cannot intersect transform types");return kf(e,t)}function wo(...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 d8(e,t){return Qe("Awaited",[Qe(e,t)])}function h8(e){return Qe("Awaited",[wo(e)])}function b8(e){return hr(k2(e))}function y8(e){return Fe(k2(e))}function g8(e){return js(e)}function k2(e){return e.map(t=>js(t))}function js(e,t){return F(jn(e)?d8(e.target,e.parameters):dt(e)?b8(e.allOf):ke(e)?y8(e.anyOf):Na(e)?g8(e.item):xt(e)?h8(e.$ref):e,t)}function R2(e){let t=[];for(let r of e)t.push(Fr(r));return t}function x8(e){let t=R2(e);return m2(t)}function w8(e){let t=R2(e);return p2(t)}function S8(e){return e.map((t,r)=>r.toString())}function I8(e){return["[number]"]}function _8(e){return globalThis.Object.getOwnPropertyNames(e)}function v8(e){return z0?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Fr(e){return dt(e)?x8(e.allOf):ke(e)?w8(e.anyOf):en(e)?S8(e.items??[]):Un(e)?I8(e.items):Ct(e)?_8(e.properties):Aa(e)?v8(e.patternProperties):[]}var z0=!1;function Bs(e){z0=!0;let t=Fr(e);return z0=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function P8(e,t){return Qe("KeyOf",[Qe(e,t)])}function T8(e){return Qe("KeyOf",[wo(e)])}function M8(e,t){let r=Fr(e),n=C8(r),o=xo(n);return F(o,t)}function C8(e){return e.map(t=>t==="[number]"?hn():Ce(t))}function zs(e,t){return jn(e)?P8(e.target,e.parameters):xt(e)?T8(e.$ref):st(e)?N2(e,t):M8(e,t)}function O8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=zs(e[n],nt(t));return r}function k8(e,t){return O8(e.properties,t)}function N2(e,t){let r=k8(e,t);return Re(r)}function Bl(e){let t=Fr(e),r=Cf(e,t);return t.map((n,o)=>[t[o],r[o]])}function R8(e){let t=[];for(let r of e)t.push(...Fr(r));return l2(t)}function N8(e){return e.filter(t=>!Ui(t))}function A8(e,t){let r=[];for(let n of e)r.push(...Cf(n,[t]));return N8(r)}function E8(e,t){let r={};for(let n of t)r[n]=Ul(A8(e,n));return r}function A2(e,t){let r=R8(e),n=E8(e,r);return $e(n,t)}function zl(e){return F({[$]:"Date",type:"Date"},e)}function Gl(e){return F({[$]:"Null",type:"null"},e)}function Kl(e){return F({[$]:"Symbol",type:"symbol"},e)}function ql(e){return F({[$]:"Undefined",type:"undefined"},e)}function Hl(e){return F({[$]:"Uint8Array",type:"Uint8Array"},e)}function Hn(e){return F({[$]:"Unknown"},e)}function F8(e){return e.map(t=>G0(t,!1))}function $8(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Er(G0(e[r],!1));return t}function Yl(e,t){return t===!0?e:Er(e)}function G0(e,t){return I0(e)?Yl(Ki(),t):v0(e)?Yl(Ki(),t):Tt(e)?Er(bn(F8(e))):Zo(e)?Hl():Ca(e)?zl():je(e)?Yl($e($8(e)),t):_0(e)?Yl(go([],Hn()),t):Mt(e)?ql():P0(e)?Gl():T0(e)?Kl():yf(e)?Vs():Wr(e)?Ce(e):Xo(e)?Ce(e):We(e)?Ce(e):$e({})}function E2(e,t){return F(G0(e,!0),t)}function F2(e,t){return Bn(e)?bn(e.parameters,t):Se(t)}function $2(e,t){if(Mt(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=>Ce(i));return Fe(o,{...t,[dn]:"Enum"})}var q0=class extends le{},D;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(D||(D={}));function gn(e){return e===D.False?e:D.True}function Gs(e){throw new q0(e)}function At(e){return P.IsNever(e)||P.IsIntersect(e)||P.IsUnion(e)||P.IsUnknown(e)||P.IsAny(e)}function Et(e,t){return P.IsNever(t)?z2(e,t):P.IsIntersect(t)?Wl(e,t):P.IsUnion(t)?X0(e,t):P.IsUnknown(t)?H2(e,t):P.IsAny(t)?W0(e,t):Gs("StructuralRight")}function W0(e,t){return D.True}function D8(e,t){return P.IsIntersect(t)?Wl(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 L8(e,t){return P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:P.IsNever(e)?D.True:D.False}function V8(e,t){return P.IsObject(t)&&Xl(t)?D.True:At(t)?Et(e,t):P.IsArray(t)?gn(ze(e.items,t.items)):D.False}function U8(e,t){return At(t)?Et(e,t):P.IsAsyncIterator(t)?gn(ze(e.items,t.items)):D.False}function j8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(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 B8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsBoolean(t)?D.True:D.False}function z8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsConstructor(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>gn(ze(t.parameters[n],r))===D.True)?gn(ze(e.returns,t.returns)):D.False:D.False}function G8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsDate(t)?D.True:D.False}function K8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsFunction(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>gn(ze(t.parameters[n],r))===D.True)?gn(ze(e.returns,t.returns)):D.False:D.False}function B2(e,t){return P.IsLiteral(e)&&mr.IsNumber(e.const)||P.IsNumber(e)||P.IsInteger(e)?D.True:D.False}function q8(e,t){return P.IsInteger(t)||P.IsNumber(t)?D.True:At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):D.False}function Wl(e,t){return t.allOf.every(r=>ze(e,r)===D.True)?D.True:D.False}function H8(e,t){return e.allOf.some(r=>ze(r,t)===D.True)?D.True:D.False}function Y8(e,t){return At(t)?Et(e,t):P.IsIterator(t)?gn(ze(e.items,t.items)):D.False}function W8(e,t){return P.IsLiteral(t)&&t.const===e.const?D.True:At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsString(t)?q2(e,t):P.IsNumber(t)?G2(e,t):P.IsInteger(t)?B2(e,t):P.IsBoolean(t)?j2(e,t):D.False}function z2(e,t){return D.False}function X8(e,t){return D.True}function D2(e){let[t,r]=[e,0];for(;P.IsNot(t);)t=t.not,r+=1;return r%2===0?t:Hn()}function Z8(e,t){return P.IsNot(e)?ze(D2(e),t):P.IsNot(t)?ze(e,D2(t)):Gs("Invalid fallthrough for Not")}function Q8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsNull(t)?D.True:D.False}function G2(e,t){return P.IsLiteralNumber(e)||P.IsNumber(e)||P.IsInteger(e)?D.True:D.False}function J8(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsInteger(t)||P.IsNumber(t)?D.True:D.False}function $r(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function L2(e){return Xl(e)}function V2(e){return $r(e,0)||$r(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 K0(e){return $r(e,0)}function U2(e){return $r(e,0)}function e3(e){return $r(e,0)}function t3(e){return $r(e,0)}function r3(e){return Xl(e)}function n3(e){let t=hn();return $r(e,0)||$r(e,1)&&"length"in e.properties&&gn(ze(e.properties.length,t))===D.True}function o3(e){return $r(e,0)}function Xl(e){let t=hn();return $r(e,0)||$r(e,1)&&"length"in e.properties&&gn(ze(e.properties.length,t))===D.True}function i3(e){let t=go([Ki()],Ki());return $r(e,0)||$r(e,1)&&"then"in e.properties&&gn(ze(e.properties.then,t))===D.True}function K2(e,t){return ze(e,t)===D.False||P.IsOptional(e)&&!P.IsOptional(t)?D.False:D.True}function br(e,t){return P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:P.IsNever(e)||P.IsLiteralString(e)&&L2(t)||P.IsLiteralNumber(e)&&K0(t)||P.IsLiteralBoolean(e)&&U2(t)||P.IsSymbol(e)&&V2(t)||P.IsBigInt(e)&&e3(t)||P.IsString(e)&&L2(t)||P.IsSymbol(e)&&V2(t)||P.IsNumber(e)&&K0(t)||P.IsInteger(e)&&K0(t)||P.IsBoolean(e)&&U2(t)||P.IsUint8Array(e)&&r3(t)||P.IsDate(e)&&t3(t)||P.IsConstructor(e)&&o3(t)||P.IsFunction(e)&&n3(t)?D.True:P.IsRecord(e)&&P.IsString(H0(e))?t[dn]==="Record"?D.True:D.False:P.IsRecord(e)&&P.IsNumber(H0(e))?$r(t,0)?D.True:D.False:D.False}function a3(e,t){return At(t)?Et(e,t):P.IsRecord(t)?xn(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(K2(e.properties[r],t.properties[r])===D.False)return D.False}return D.True})():D.False}function s3(e,t){return At(t)?Et(e,t):P.IsObject(t)&&i3(t)?D.True:P.IsPromise(t)?gn(ze(e.item,t.item)):D.False}function H0(e){return Bi in e.patternProperties?hn():zi in e.patternProperties?_r():Gs("Unknown record key pattern")}function Y0(e){return Bi in e.patternProperties?e.patternProperties[Bi]:zi in e.patternProperties?e.patternProperties[zi]:Gs("Unable to get record value schema")}function xn(e,t){let[r,n]=[H0(t),Y0(t)];return P.IsLiteralString(e)&&P.IsNumber(r)&&gn(ze(e,n))===D.True?D.True:P.IsUint8Array(e)&&P.IsNumber(r)||P.IsString(e)&&P.IsNumber(r)||P.IsArray(e)&&P.IsNumber(r)?ze(e,n):P.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(K2(n,e.properties[o])===D.False)return D.False;return D.True})():D.False}function c3(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?ze(Y0(e),Y0(t)):D.False}function f3(e,t){let r=P.IsRegExp(e)?_r():e,n=P.IsRegExp(t)?_r():t;return ze(r,n)}function q2(e,t){return P.IsLiteral(e)&&mr.IsString(e.const)||P.IsString(e)?D.True:D.False}function u3(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsString(t)?D.True:D.False}function l3(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsSymbol(t)?D.True:D.False}function p3(e,t){return P.IsTemplateLiteral(e)?ze(Fa(e),t):P.IsTemplateLiteral(t)?ze(e,Fa(t)):Gs("Invalid fallthrough for TemplateLiteral")}function m3(e,t){return P.IsArray(t)&&e.items!==void 0&&e.items.every(r=>ze(r,t.items)===D.True)}function d3(e,t){return P.IsNever(e)?D.True:P.IsUnknown(e)?D.False:P.IsAny(e)?D.Union:D.False}function h3(e,t){return At(t)?Et(e,t):P.IsObject(t)&&Xl(t)||P.IsArray(t)&&m3(e,t)?D.True:P.IsTuple(t)?mr.IsUndefined(e.items)&&!mr.IsUndefined(t.items)||!mr.IsUndefined(e.items)&&mr.IsUndefined(t.items)?D.False:mr.IsUndefined(e.items)&&!mr.IsUndefined(t.items)||e.items.every((r,n)=>ze(r,t.items[n])===D.True)?D.True:D.False:D.False}function b3(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsUint8Array(t)?D.True:D.False}function y3(e,t){return At(t)?Et(e,t):P.IsObject(t)?br(e,t):P.IsRecord(t)?xn(e,t):P.IsVoid(t)?w3(e,t):P.IsUndefined(t)?D.True:D.False}function X0(e,t){return t.anyOf.some(r=>ze(e,r)===D.True)?D.True:D.False}function g3(e,t){return e.anyOf.every(r=>ze(r,t)===D.True)?D.True:D.False}function H2(e,t){return D.True}function x3(e,t){return P.IsNever(t)?z2(e,t):P.IsIntersect(t)?Wl(e,t):P.IsUnion(t)?X0(e,t):P.IsAny(t)?W0(e,t):P.IsString(t)?q2(e,t):P.IsNumber(t)?G2(e,t):P.IsInteger(t)?B2(e,t):P.IsBoolean(t)?j2(e,t):P.IsArray(t)?L8(e,t):P.IsTuple(t)?d3(e,t):P.IsObject(t)?br(e,t):P.IsUnknown(t)?D.True:D.False}function w3(e,t){return P.IsUndefined(e)||P.IsUndefined(e)?D.True:D.False}function S3(e,t){return P.IsIntersect(t)?Wl(e,t):P.IsUnion(t)?X0(e,t):P.IsUnknown(t)?H2(e,t):P.IsAny(t)?W0(e,t):P.IsObject(t)?br(e,t):P.IsVoid(t)?D.True:D.False}function ze(e,t){return P.IsTemplateLiteral(e)||P.IsTemplateLiteral(t)?p3(e,t):P.IsRegExp(e)||P.IsRegExp(t)?f3(e,t):P.IsNot(e)||P.IsNot(t)?Z8(e,t):P.IsAny(e)?D8(e,t):P.IsArray(e)?V8(e,t):P.IsBigInt(e)?j8(e,t):P.IsBoolean(e)?B8(e,t):P.IsAsyncIterator(e)?U8(e,t):P.IsConstructor(e)?z8(e,t):P.IsDate(e)?G8(e,t):P.IsFunction(e)?K8(e,t):P.IsInteger(e)?q8(e,t):P.IsIntersect(e)?H8(e,t):P.IsIterator(e)?Y8(e,t):P.IsLiteral(e)?W8(e,t):P.IsNever(e)?X8(e,t):P.IsNull(e)?Q8(e,t):P.IsNumber(e)?J8(e,t):P.IsObject(e)?a3(e,t):P.IsRecord(e)?c3(e,t):P.IsString(e)?u3(e,t):P.IsSymbol(e)?l3(e,t):P.IsTuple(e)?h3(e,t):P.IsPromise(e)?s3(e,t):P.IsUint8Array(e)?b3(e,t):P.IsUndefined(e)?y3(e,t):P.IsUnion(e)?g3(e,t):P.IsUnknown(e)?x3(e,t):P.IsVoid(e)?S3(e,t):Gs(`Unknown left type operand '${e[$]}'`)}function Hi(e,t){return ze(e,t)}function I3(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=Ks(e[a],t,r,n,nt(o));return i}function _3(e,t,r,n,o){return I3(e.properties,t,r,n,o)}function Y2(e,t,r,n,o){let i=_3(e,t,r,n,o);return Re(i)}function v3(e,t,r,n){let o=Hi(e,t);return o===D.Union?Fe([r,n]):o===D.True?r:n}function Ks(e,t,r,n,o){return st(e)?Y2(e,t,r,n,o):Qr(e)?F(W2(e,t,r,n,o)):F(v3(e,t,r,n),o)}function P3(e,t,r,n,o){return{[e]:Ks(Ce(e),t,r,n,nt(o))}}function T3(e,t,r,n,o){return e.reduce((i,a)=>({...i,...P3(a,t,r,n,o)}),{})}function M3(e,t,r,n,o){return T3(e.keys,t,r,n,o)}function W2(e,t,r,n,o){let i=M3(e,t,r,n,o);return Re(i)}function C3(e){return e.allOf.every(t=>$a(t))}function O3(e){return e.anyOf.some(t=>$a(t))}function k3(e){return!$a(e.not)}function $a(e){return e[$]==="Intersect"?C3(e):e[$]==="Union"?O3(e):e[$]==="Not"?k3(e):e[$]==="Undefined"}function X2(e,t){return qs(Fa(e),t)}function R3(e,t){let r=e.filter(n=>Hi(n,t)===D.False);return r.length===1?r[0]:Fe(r)}function qs(e,t,r={}){return Jr(e)?F(X2(e,t),r):st(e)?F(Z2(e,t),r):F(ke(e)?R3(e.anyOf,t):Hi(e,t)!==D.False?Se():e,r)}function N3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=qs(e[n],t);return r}function A3(e,t){return N3(e.properties,t)}function Z2(e,t){let r=A3(e,t);return Re(r)}function Q2(e,t){return Hs(Fa(e),t)}function E3(e,t){let r=e.filter(n=>Hi(n,t)!==D.False);return r.length===1?r[0]:Fe(r)}function Hs(e,t,r){return Jr(e)?F(Q2(e,t),r):st(e)?F(J2(e,t),r):F(ke(e)?E3(e.anyOf,t):Hi(e,t)!==D.False?e:Se(),r)}function F3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Hs(e[n],t);return r}function $3(e,t){return F3(e.properties,t)}function J2(e,t){let r=$3(e,t);return Re(r)}function eS(e,t){return Bn(e)?F(e.returns,t):Se(t)}function Zl(e){return Er(dr(e))}function Da(e,t,r){return F({[$]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Z0(e,t,r){let n={};for(let o of e)n[o]=t;return $e(n,{...r,[dn]:"Record"})}function D3(e,t,r){return Dl(e)?Z0(Ar(e),t,r):Da(e.pattern,t,r)}function L3(e,t,r){return Z0(Ar(Fe(e)),t,r)}function V3(e,t,r){return Z0([e.toString()],t,r)}function U3(e,t,r){return Da(e.source,t,r)}function j3(e,t,r){let n=Mt(e.pattern)?zi:e.pattern;return Da(n,t,r)}function B3(e,t,r){return Da(zi,t,r)}function z3(e,t,r){return Da(f2,t,r)}function G3(e,t,r){return $e({true:t,false:t},r)}function K3(e,t,r){return Da(Bi,t,r)}function q3(e,t,r){return Da(Bi,t,r)}function Ql(e,t,r={}){return ke(e)?L3(e.anyOf,t,r):Jr(e)?D3(e,t,r):Zr(e)?V3(e.const,t,r):ei(e)?G3(e,t,r):Gn(e)?K3(e,t,r):Kn(e)?q3(e,t,r):k0(e)?U3(e,t,r):ti(e)?j3(e,t,r):C0(e)?B3(e,t,r):Ui(e)?z3(e,t,r):Se(r)}function Jl(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function tS(e){let t=Jl(e);return t===zi?_r():t===Bi?hn():_r({pattern:t})}function ep(e){return e.patternProperties[Jl(e)]}function H3(e,t){return t.parameters=Rf(e,t.parameters),t.returns=Yn(e,t.returns),t}function Y3(e,t){return t.parameters=Rf(e,t.parameters),t.returns=Yn(e,t.returns),t}function W3(e,t){return t.allOf=Rf(e,t.allOf),t}function X3(e,t){return t.anyOf=Rf(e,t.anyOf),t}function Z3(e,t){return Mt(t.items)||(t.items=Rf(e,t.items)),t}function Q3(e,t){return t.items=Yn(e,t.items),t}function J3(e,t){return t.items=Yn(e,t.items),t}function ek(e,t){return t.items=Yn(e,t.items),t}function tk(e,t){return t.item=Yn(e,t.item),t}function rk(e,t){let r=ak(e,t.properties);return{...t,...$e(r)}}function nk(e,t){let r=Yn(e,tS(t)),n=Yn(e,ep(t)),o=Ql(r,n);return{...t,...o}}function ok(e,t){return t.index in e?e[t.index]:Hn()}function ik(e,t){let r=ks(t),n=Nr(t),o=Yn(e,t);return r&&n?Zl(o):r&&!n?Er(o):!r&&n?dr(o):o}function ak(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:ik(e,t[n])}),{})}function Rf(e,t){return t.map(r=>Yn(e,r))}function Yn(e,t){return Bn(t)?H3(e,t):zn(t)?Y3(e,t):dt(t)?W3(e,t):ke(t)?X3(e,t):en(t)?Z3(e,t):Un(t)?Q3(e,t):Oa(t)?J3(e,t):Ra(t)?ek(e,t):Na(t)?tk(e,t):Ct(t)?rk(e,t):Aa(t)?nk(e,t):O0(t)?ok(e,t):t}function rS(e,t){return Yn(t,Cs(e))}function nS(e){return F({[$]:"Integer",type:"integer"},e)}function sk(e,t,r){return{[e]:Wn(Ce(e),t,nt(r))}}function ck(e,t,r){return e.reduce((o,i)=>({...o,...sk(i,t,r)}),{})}function fk(e,t,r){return ck(e.keys,t,r)}function oS(e,t,r){let n=fk(e,t,r);return Re(n)}function uk(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function lk(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function pk(e){return e.toUpperCase()}function mk(e){return e.toLowerCase()}function dk(e,t,r){let n=Ds(e.pattern);if(!Ea(n))return{...e,pattern:iS(e.pattern,t)};let a=[...Mf(n)].map(u=>Ce(u)),s=aS(a,t),c=Fe(s);return Vl([c],r)}function iS(e,t){return typeof e=="string"?t==="Uncapitalize"?uk(e):t==="Capitalize"?lk(e):t==="Uppercase"?pk(e):t==="Lowercase"?mk(e):e:e.toString()}function aS(e,t){return e.map(r=>Wn(r,t))}function Wn(e,t,r={}){return Qr(e)?oS(e,t,r):Jr(e)?dk(e,t,r):ke(e)?Fe(aS(e.anyOf,t),r):Zr(e)?Ce(iS(e.const,t),r):F(e,r)}function sS(e,t={}){return Wn(e,"Capitalize",t)}function cS(e,t={}){return Wn(e,"Lowercase",t)}function fS(e,t={}){return Wn(e,"Uncapitalize",t)}function uS(e,t={}){return Wn(e,"Uppercase",t)}function hk(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Yi(e[o],t,nt(r));return n}function bk(e,t,r){return hk(e.properties,t,r)}function lS(e,t,r){let n=bk(e,t,r);return Re(n)}function yk(e,t){return e.map(r=>Q0(r,t))}function gk(e,t){return e.map(r=>Q0(r,t))}function xk(e,t){let{[t]:r,...n}=e;return n}function wk(e,t){return t.reduce((r,n)=>xk(r,n),e)}function Sk(e,t,r){let n=ht(e,[ft,"$id","required","properties"]),o=wk(r,t);return $e(o,n)}function Ik(e){let t=e.reduce((r,n)=>El(n)?[...r,Ce(n)]:r,[]);return Fe(t)}function Q0(e,t){return dt(e)?hr(yk(e.allOf,t)):ke(e)?Fe(gk(e.anyOf,t)):Ct(e)?Sk(e,t,e.properties):$e({})}function Yi(e,t,r){let n=Tt(t)?Ik(t):t,o=ut(t)?Ar(t):t,i=xt(e),a=xt(t);return st(e)?lS(e,o,r):Qr(t)?pS(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({...Q0(e,o),...r})}function _k(e,t,r){return{[t]:Yi(e,[t],nt(r))}}function vk(e,t,r){return t.reduce((n,o)=>({...n,..._k(e,o,r)}),{})}function Pk(e,t,r){return vk(e,t.keys,r)}function pS(e,t,r){let n=Pk(e,t,r);return Re(n)}function Tk(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Wi(e[o],t,nt(r));return n}function Mk(e,t,r){return Tk(e.properties,t,r)}function mS(e,t,r){let n=Mk(e,t,r);return Re(n)}function Ck(e,t){return e.map(r=>J0(r,t))}function Ok(e,t){return e.map(r=>J0(r,t))}function kk(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function Rk(e,t,r){let n=ht(e,[ft,"$id","required","properties"]),o=kk(r,t);return $e(o,n)}function Nk(e){let t=e.reduce((r,n)=>El(n)?[...r,Ce(n)]:r,[]);return Fe(t)}function J0(e,t){return dt(e)?hr(Ck(e.allOf,t)):ke(e)?Fe(Ok(e.anyOf,t)):Ct(e)?Rk(e,t,e.properties):$e({})}function Wi(e,t,r){let n=Tt(t)?Nk(t):t,o=ut(t)?Ar(t):t,i=xt(e),a=xt(t);return st(e)?mS(e,o,r):Qr(t)?dS(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({...J0(e,o),...r})}function Ak(e,t,r){return{[t]:Wi(e,[t],nt(r))}}function Ek(e,t,r){return t.reduce((n,o)=>({...n,...Ak(e,o,r)}),{})}function Fk(e,t,r){return Ek(e,t.keys,r)}function dS(e,t,r){let n=Fk(e,t,r);return Re(n)}function $k(e,t){return Qe("Partial",[Qe(e,t)])}function Dk(e){return Qe("Partial",[wo(e)])}function Lk(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=dr(e[r]);return t}function Vk(e,t){let r=ht(e,[ft,"$id","required","properties"]),n=Lk(t);return $e(n,r)}function hS(e){return e.map(t=>bS(t))}function bS(e){return jn(e)?$k(e.target,e.parameters):xt(e)?Dk(e.$ref):dt(e)?hr(hS(e.allOf)):ke(e)?Fe(hS(e.anyOf)):Ct(e)?Vk(e,e.properties):ka(e)||ei(e)||Gn(e)||Zr(e)||wf(e)||Kn(e)||ti(e)||Sf(e)||ri(e)?e:$e({})}function Ys(e,t){return st(e)?yS(e,t):F({...bS(e),...t})}function Uk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ys(e[n],nt(t));return r}function jk(e,t){return Uk(e.properties,t)}function yS(e,t){let r=jk(e,t);return Re(r)}function Bk(e,t){return Qe("Required",[Qe(e,t)])}function zk(e){return Qe("Required",[wo(e)])}function Gk(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=ht(e[r],[ir]);return t}function Kk(e,t){let r=ht(e,[ft,"$id","required","properties"]),n=Gk(t);return $e(n,r)}function gS(e){return e.map(t=>xS(t))}function xS(e){return jn(e)?Bk(e.target,e.parameters):xt(e)?zk(e.$ref):dt(e)?hr(gS(e.allOf)):ke(e)?Fe(gS(e.anyOf)):Ct(e)?Kk(e,e.properties):ka(e)||ei(e)||Gn(e)||Zr(e)||wf(e)||Kn(e)||ti(e)||Sf(e)||ri(e)?e:$e({})}function Ws(e,t){return st(e)?wS(e,t):F({...xS(e),...t})}function qk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ws(e[n],t);return r}function Hk(e,t){return qk(e.properties,t)}function wS(e,t){let r=Hk(e,t);return Re(r)}function Yk(e,t){return t.map(r=>xt(r)?eb(e,r.$ref):tn(e,r))}function eb(e,t){return t in e?xt(e[t])?eb(e,e[t].$ref):tn(e,e[t]):Se()}function Wk(e){return js(e[0])}function Xk(e){return qi(e[0],e[1])}function Zk(e){return zs(e[0])}function Qk(e){return Ys(e[0])}function Jk(e){return Yi(e[0],e[1])}function eR(e){return Wi(e[0],e[1])}function tR(e){return Ws(e[0])}function rR(e,t,r){let n=Yk(e,r);return t==="Awaited"?Wk(n):t==="Index"?Xk(n):t==="KeyOf"?Zk(n):t==="Partial"?Qk(n):t==="Omit"?Jk(n):t==="Pick"?eR(n):t==="Required"?tR(n):Se()}function nR(e,t){return As(tn(e,t))}function oR(e,t){return Es(tn(e,t))}function iR(e,t,r){return Fs(Nf(e,t),tn(e,r))}function aR(e,t,r){return go(Nf(e,t),tn(e,r))}function sR(e,t){return hr(Nf(e,t))}function cR(e,t){return Us(tn(e,t))}function fR(e,t){return $e(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:tn(e,t[n])}),{}))}function uR(e,t){let[r,n]=[tn(e,ep(t)),Jl(t)],o=Cs(t);return o.patternProperties[n]=r,o}function lR(e,t){return xt(t)?{...eb(e,t.$ref),[ft]:t[ft]}:t}function pR(e,t){return bn(Nf(e,t))}function mR(e,t){return Fe(Nf(e,t))}function Nf(e,t){return t.map(r=>tn(e,r))}function tn(e,t){return Nr(t)?F(tn(e,ht(t,[ir])),t):ks(t)?F(tn(e,ht(t,[Vn])),t):Ee(t)?F(lR(e,t),t):Un(t)?F(nR(e,t.items),t):Oa(t)?F(oR(e,t.items),t):jn(t)?F(rR(e,t.target,t.parameters)):Bn(t)?F(iR(e,t.parameters,t.returns),t):zn(t)?F(aR(e,t.parameters,t.returns),t):dt(t)?F(sR(e,t.allOf),t):Ra(t)?F(cR(e,t.items),t):Ct(t)?F(fR(e,t.properties),t):Aa(t)?F(uR(e,t)):en(t)?F(pR(e,t.items||[]),t):ke(t)?F(mR(e,t.anyOf),t):t}function dR(e,t){return t in e?tn(e,e[t]):Se()}function SS(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:dR(e,r)}),{})}var tb=class{constructor(t){let r=SS(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 IS(e){return new tb(e)}function _S(e,t){return F({[$]:"Not",not:e},t)}function vS(e,t){return zn(e)?bn(e.parameters,t):Se()}var hR=0;function PS(e,t={}){Mt(t.$id)&&(t.$id=`T${hR++}`);let r=Cs(e({[$]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,F({[dn]:"Recursive",...r},t)}function TS(e,t){let r=We(e)?new globalThis.RegExp(e):e;return F({[$]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function bR(e){return dt(e)?e.allOf:ke(e)?e.anyOf:en(e)?e.items??[]:[]}function MS(e){return bR(e)}function CS(e,t){return zn(e)?F(e.returns,t):Se(t)}var rb=class{constructor(t){this.schema=t}Decode(t){return new nb(this.schema,t)}},nb=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[ft].Encode(t(a)),Decode:a=>this.decode(r[ft].Decode(a))};return{...r,[ft]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[ft]:n}}Encode(t){return Ee(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function OS(e){return new rb(e)}function kS(e={}){return F({[$]:e[$]??"Unsafe"},e)}function RS(e){return F({[$]:"Void",type:"void"},e)}var ob={};Ma(ob,{Any:()=>Ki,Argument:()=>d2,Array:()=>As,AsyncIterator:()=>Es,Awaited:()=>js,BigInt:()=>Vs,Boolean:()=>Ll,Capitalize:()=>sS,Composite:()=>A2,Const:()=>E2,Constructor:()=>Fs,ConstructorParameters:()=>F2,Date:()=>zl,Enum:()=>$2,Exclude:()=>qs,Extends:()=>Ks,Extract:()=>Hs,Function:()=>go,Index:()=>qi,InstanceType:()=>eS,Instantiate:()=>rS,Integer:()=>nS,Intersect:()=>hr,Iterator:()=>Us,KeyOf:()=>zs,Literal:()=>Ce,Lowercase:()=>cS,Mapped:()=>M2,Module:()=>IS,Never:()=>Se,Not:()=>_S,Null:()=>Gl,Number:()=>hn,Object:()=>$e,Omit:()=>Yi,Optional:()=>dr,Parameters:()=>vS,Partial:()=>Ys,Pick:()=>Wi,Promise:()=>jl,Readonly:()=>Er,ReadonlyOptional:()=>Zl,Record:()=>Ql,Recursive:()=>PS,Ref:()=>wo,RegExp:()=>TS,Required:()=>Ws,Rest:()=>MS,ReturnType:()=>CS,String:()=>_r,Symbol:()=>Kl,TemplateLiteral:()=>Vl,Transform:()=>OS,Tuple:()=>bn,Uint8Array:()=>Hl,Uncapitalize:()=>fS,Undefined:()=>ql,Union:()=>Fe,Unknown:()=>Hn,Unsafe:()=>kS,Uppercase:()=>uS,Void:()=>RS});var d=ob;var Xn=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())}),AQ=d.Object({schemaVersion:d.Literal("1.0"),title:d.Optional(d.String()),xAxis:Xn,yAxis:Xn,references:d.Optional(d.Array(Af))});var yR=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}))}),gR=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})}),ib=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("calibration"),data:d.Array(yR),distribution:d.Optional(d.Array(gR)),x:d.Literal("predicted"),y:d.Literal("observed"),xAxis:Xn,yAxis:Xn,references:d.Optional(d.Array(Af))});var xR=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})}),ab=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("roc"),data:d.Array(xR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity"),xAxis:Xn,yAxis:Xn,references:d.Optional(d.Array(Af))});var wR=d.Union([ab,ib],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var rn=d.Object({id:d.String(),model:d.Optional(d.String()),population:d.String(),label:d.Optional(d.String())}),NS=d.Union([d.Literal("model"),d.Literal("population"),d.Literal("evaluation"),d.Literal("context")]),AS=d.Object({label:d.String(),group:d.String(),role:NS}),Xs=d.Object({id:d.String(),evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),display:AS}),SR=d.Object({x:d.Number(),y:d.Number()}),sb=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(SR,{minItems:2}),label:d.Optional(d.String())})]),IR=d.Intersect([sb,d.Object({scope:d.Literal("global")})]),_R=d.Intersect([sb,d.Object({scope:d.Literal("population"),population:d.String()})]),vR=d.Intersect([sb,d.Object({scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),ES=d.Union([IR,_R,vR]),Dr=d.Object({schemaVersion:d.Literal("2.0"),title:d.Optional(d.String()),evaluations:d.Array(rn),series:d.Array(Xs),xAxis:Xn,yAxis:Xn,references:d.Optional(d.Array(ES))}),Ef=d.Union([d.Literal("probability_threshold"),d.Literal("ppcr")]),ii=d.Object({operatingPoint:d.Optional(d.Object({dimension:Ef}))}),tp=d.Object({operatingPoint:d.Optional(d.Object({dimension:d.Literal("probability_threshold")}))});var FS=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}))}),$S=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}))}),DS=d.Union([FS,$S]),PR=d.Object({seriesId:d.String(),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),cb=d.Intersect([Dr,d.Object({type:d.Literal("calibration"),data:d.Array(DS),distribution:d.Optional(d.Array(PR)),x:d.Literal("predicted"),y:d.Literal("observed")})]);var VS=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),netBenefit:d.Number()}),US=d.Intersect([rn,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]*$"})})]),BS=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_none")}),LS={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")},zS=d.Union([d.Object({...LS,scope:d.Literal("population"),population:d.String()}),d.Object({...LS,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),GS=d.Union([BS,zS]),fb=d.Intersect([Dr,tp,d.Object({type:d.Literal("decision_curve"),evaluations:d.Array(US,{minItems:1}),series:d.Array(jS,{minItems:1}),data:d.Array(VS),x:d.Literal("threshold"),y:d.Literal("netBenefit"),references:d.Array(GS,{minItems:2})})]);var TR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),sensitivity:d.Number({minimum:0,maximum:1})}),ub=d.Intersect([Dr,ii,d.Object({type:d.Literal("gains"),data:d.Array(TR),x:d.Literal("ppcr"),y:d.Literal("sensitivity")})]);var qS=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),interventionsAvoided:d.Number()}),HS=d.Intersect([rn,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),YS=d.Intersect([Xs,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),WS=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_all")}),KS={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")},XS=d.Union([d.Object({...KS,scope:d.Literal("population"),population:d.String()}),d.Object({...KS,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),ZS=d.Union([WS,XS]),lb=d.Intersect([Dr,tp,d.Object({type:d.Literal("interventions_avoided"),evaluations:d.Array(HS,{minItems:1}),series:d.Array(YS,{minItems:1}),data:d.Array(qS),x:d.Literal("threshold"),y:d.Literal("interventionsAvoided"),references:d.Array(ZS,{minItems:2})})]);var MR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),lift:d.Number()}),pb=d.Intersect([Dr,ii,d.Object({type:d.Literal("lift"),data:d.Array(MR),x:d.Literal("ppcr"),y:d.Literal("lift")})]);var CR=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})}),mb=d.Intersect([Dr,ii,d.Object({type:d.Literal("precision_recall"),data:d.Array(CR),x:d.Literal("sensitivity"),y:d.Literal("ppv")})]);var db=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")]),QS=d.Object({id:db,label:d.String()}),rp=d.Object({metricId:db,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()]))}),JS=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})})]),eI=d.Object({censoringHeuristic:d.Optional(d.String()),competingEventHeuristic:d.Optional(d.String())}),tI=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),operatingPoint:JS,context:d.Optional(eI),values:d.Array(rp)}),hb=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("performance_table"),title:d.Optional(d.String()),evaluations:d.Array(rn),metrics:d.Array(QS),rows:d.Array(tI)});var rI=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})}),OR=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})}),nI=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(rp))}),Ff=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("prediction_distribution"),title:d.Optional(d.String()),evaluations:d.Array(rn,{minItems:1}),operatingPoint:d.Optional(d.Object({dimension:Ef})),bins:d.Array(rI,{minItems:1}),rankBins:d.Optional(d.Array(OR)),operatingPoints:d.Array(nI,{minItems:1})});var kR=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})}),bb=d.Intersect([Dr,ii,d.Object({type:d.Literal("roc"),data:d.Array(kR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity")})]);var yb=d.Union([bb,cb,mb,ub,pb,fb,lb,Ff],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var gb=d.Object({id:d.String(),label:d.String()}),xb=d.Object({metric:d.Literal("auroc"),owner:d.Object({type:d.Literal("evaluation"),evaluationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),wb=d.Object({metric:d.Literal("prevalence"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),RR=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()])}),NR=d.Union([xb,wb]),oI=d.Union([xb,wb,RR]),AR=oI,ER=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(rn),populations:d.Array(gb),metrics:d.Array(NR)}),FR=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(rn),populations:d.Array(gb),metrics:d.Array(oI)}),Sb=d.Union([ER,FR],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var Ib=d.Union([yb,hb,Sb,Ff]),iI=d.Object({id:d.String(),title:d.Optional(d.String()),spec:Ib}),np=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("report"),title:d.Optional(d.String()),components:d.Array(iI,{minItems:1})}),_b=d.Object({type:d.Literal("component"),id:d.String(),title:d.Optional(d.String()),spec:Ib}),aI=d.Object({type:d.Literal("group"),id:d.String(),title:d.String(),components:d.Array(_b,{minItems:1})}),sI=d.Object({id:d.String(),title:d.String(),items:d.Array(d.Union([_b,aI]),{minItems:1})}),op=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("report"),title:d.Optional(d.String()),sections:d.Array(sI,{minItems:1})}),$R=d.Union([np,op],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function ip(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 vb(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 p=1;p1||!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 ${p} for evaluation ${i} must be (lower, upper]`);if(l.lower>=l.upper)throw new Error(`bin ${p} for evaluation ${i} must be nondegenerate`);if(l.lower!==a[p-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 p of s)if(p.type==="probability_threshold"){if(p.cutoff!==0&&!u.has(p.cutoff))throw new Error(`operating point cutoff ${p.cutoff} for evaluation ${i} does not match any bin upper boundary`);let l=0;if(p.cutoff===0)l=f;else for(let h of a)h.upper>p.cutoff&&(l+=h.nPositive+h.nNegative);let m=l/f;if(Math.abs(p.realizedPpcr-m)>1e-6)throw new Error(`operating point realizedPpcr ${p.realizedPpcr} for evaluation ${i} does not match reconstructed count fraction ${m}`)}}}function Pb(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 ai(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,b)=>{let y=`evaluation-${b+1}`;if(h.id!==y)throw new Error(`decision curve evaluation ids must be ordinal: expected ${y}`)});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,b)=>{if(h.id!==`series-${b+1}`)throw new Error(`decision curve series ids must be ordinal: expected series-${b+1}`);let y=o.evaluations.find(w=>w.id===h.evaluationId),x=y.model??y.population,g=y.model===void 0?"population":"model";if(h.display.label!==x||h.display.group!==x||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(b=>c.every(y=>u.has(`${b.id}\0${y}`)))||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 p=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_all"),l=new Set;for(let h of p){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 b=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(b))throw new Error(`duplicate Treat All owner: ${h.population}`);l.add(b)}let m=s?[...n].flatMap(h=>c.map(b=>`${h}\0${b}`)):[...n];if(l.size!==m.length||m.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,b)=>{let y=`evaluation-${b+1}`;if(h.id!==y)throw new Error(`interventions avoided evaluation ids must be ordinal: expected ${y}`)});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,b)=>{if(h.id!==`series-${b+1}`)throw new Error(`interventions avoided series ids must be ordinal: expected series-${b+1}`);let y=o.evaluations.find(w=>w.id===h.evaluationId);if(!y)throw new Error(`unknown evaluation id: ${h.evaluationId}`);let x=y.model??y.population,g=y.model===void 0?"population":"model";if(h.display.label!==x||h.display.group!==x||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(b=>c.every(y=>u.has(`${b.id}\0${y}`)))||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 p=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_none"),l=new Set;for(let h of p){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 b=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(b))throw new Error(`duplicate Treat None owner: ${h.population}`);l.add(b)}let m=s?[...n].flatMap(h=>c.map(b=>`${h}\0${b}`)):[...n];if(l.size!==m.length||m.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 cI(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 DR(e){return cI(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function LR(e){return cI(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function VR(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 UR(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 Tb(e,t){return[...new Set(e)].map(n=>UR(n,t))}function jR(e,t="population"){let r=Tb(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 BR(e,t){let r=Tb(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 zR(e,t,r,n){let o=Tb(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 bt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function wn(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function si(e){let t,r,n;e.length!==2?(t=bt,r=(s,c)=>bt(e(s),c),n=(s,c)=>e(s)-c):(t=e===bt||e===wn?e:GR,r=e,n=e);function o(s,c,u=0,f=s.length){if(u>>1;r(s[p],c)<0?u=p+1:f=p}while(u>>1;r(s[p],c)<=0?u=p+1:f=p}while(uu&&n(s[p-1],c)>-n(s[p],c)?p-1:p}return{left:o,center:a,right:i}}function GR(){return 0}function Df(e){return e===null?NaN:+e}function*fI(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 uI=si(bt),lI=uI.right,KR=uI.left,qR=si(Df).center,La=lI;function HR(e){return e.length|0}function YR(e){return!(e>0)}function WR(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function XR(e){return t=>e(...t)}function ap(...e){let t=typeof e[e.length-1]=="function"&&XR(e.pop());e=e.map(WR);let r=e.map(HR),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some(YR))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 sp(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 cp(e,t){let r=Zs(e,t);return r&&Math.sqrt(r)}function Lr(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 vr=class extends Map{constructor(t,r=dI){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(Mb(this,t))}has(t){return super.has(Mb(this,t))}set(t,r){return super.set(pI(this,t),r)}delete(t){return super.delete(mI(this,t))}},Zn=class extends Set{constructor(t,r=dI){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(Mb(this,t))}add(t){return super.add(pI(this,t))}delete(t){return super.delete(mI(this,t))}};function Mb({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function pI({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function mI({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function dI(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Lf(e){return e}function ci(e,...t){return Ob(e,Lf,Lf,t)}function So(e,t,...r){return Ob(e,Lf,t,r)}function Cb(e,t,...r){return Ob(e,Array.from,t,r)}function Ob(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new vr,c=n[a++],u=-1;for(let f of i){let p=c(f,++u,i),l=s.get(p);l?l.push(f):s.set(p,[f])}for(let[f,p]of s)s.set(f,o(p,a));return t(s)})(e,0)}function kb(e,t){return Array.from(t,r=>e[r])}function Xi(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]))),kb(e,n)}return e.sort(Rb(r))}function Rb(e=bt){if(e===bt)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?Xi(So(e,t,r),(([n,o],[i,a])=>bt(o,a)||bt(n,i))):Xi(ci(e,r),(([n,o],[i,a])=>t(o,a)||bt(n,i)))).map(([n])=>n)}var ZR=Math.sqrt(50),QR=Math.sqrt(10),JR=Math.sqrt(2);function fp(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>=ZR?10:i>=QR?5:i>=JR?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 up(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 Pr(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 lp(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 pp(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:Rb(o);n>r;){if(n-r>600){let c=n-r+1,u=t-r+1,f=Math.log(c),p=.5*Math.exp(2*f/3),l=.5*Math.sqrt(f*p*(c-p)/c)*(u-c/2<0?-1:1),m=Math.max(r,Math.floor(t-u*p/c+l)),h=Math.min(n,Math.floor(t+(c-u)*p/c+l));pp(e,t,m,h,o)}let i=e[t],a=r,s=n;for(jf(e,r,t),o(e[n],i)>0&&jf(e,r,n);a0;)--s}o(e[r],i)===0?jf(e,r,s):(++s,jf(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function jf(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Bf(e,t=bt){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?bt(a,o)>0:bt(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 ui(e,t,r){if(e=Float64Array.from(fI(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Pr(e);if(t>=1)return Gt(e);var n,o=(n-1)*t,i=Math.floor(o),a=Gt(pp(e,i).subarray(0,i+1)),s=Pr(e.subarray(i+1));return a+(s-a)*(o-i)}}function Nb(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 mp(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 Va(e,t){return ui(e,.5,t)}function*tN(e){for(let t of e)yield*t}function ec(e){return Array.from(tN(e))}function dp(e,t){let r=new vr;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 hp(e,t=rN){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function rN(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 aN(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function sN(){return!this.__axis}function cN(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===Ab||e===bp?-1:1,f=e===bp||e===Eb?"x":"y",p=e===Ab||e===Fb?nN:oN;function l(m){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),b=o??(t.tickFormat?t.tickFormat.apply(t,r):hI),y=Math.max(i,0)+s,x=t.range(),g=+x[0]+c,_=+x[x.length-1]+c,w=(t.bandwidth?aN:iN)(t.copy(),c),I=m.selection?m.selection():m,S=I.selectAll(".domain").data([null]),v=I.selectAll(".tick").data(h,t).order(),M=v.exit(),C=v.enter().append("g").attr("class","tick"),R=v.select("line"),O=v.select("text");S=S.merge(S.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(C),R=R.merge(C.append("line").attr("stroke","currentColor").attr(f+"2",u*i)),O=O.merge(C.append("text").attr("fill","currentColor").attr(f,u*y).attr("dy",e===Ab?"0em":e===Fb?"0.71em":"0.32em")),m!==I&&(S=S.transition(m),v=v.transition(m),R=R.transition(m),O=O.transition(m),M=M.transition(m).attr("opacity",bI).attr("transform",function(N){return isFinite(N=w(N))?p(N+c):this.getAttribute("transform")}),C.attr("opacity",bI).attr("transform",function(N){var z=this.parentNode.__axis;return p((z&&isFinite(z=z(N))?z:w(N))+c)})),M.remove(),S.attr("d",e===bp||e===Eb?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(N){return p(w(N)+c)}),R.attr(f+"2",u*i),O.attr(f,u*y).text(b),I.filter(sN).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Eb?"start":e===bp?"end":"middle"),I.each(function(){this.__axis=w})}return l.scale=function(m){return arguments.length?(t=m,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(m){return arguments.length?(r=m==null?[]:Array.from(m),l):r.slice()},l.tickValues=function(m){return arguments.length?(n=m==null?null:Array.from(m),l):n&&n.slice()},l.tickFormat=function(m){return arguments.length?(o=m,l):o},l.tickSize=function(m){return arguments.length?(i=a=+m,l):i},l.tickSizeInner=function(m){return arguments.length?(i=+m,l):i},l.tickSizeOuter=function(m){return arguments.length?(a=+m,l):a},l.tickPadding=function(m){return arguments.length?(s=+m,l):s},l.offset=function(m){return arguments.length?(c=+m,l):c},l}function $b(e){return cN(Fb,e)}var fN={value:()=>{}};function gI(){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}})}yp.prototype=gI.prototype={constructor:yp,on:function(e,t){var r=this._,n=uN(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)),Io.hasOwnProperty(t)?{space:Io[t],local:e}:e}function pN(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===gp&&t.documentElement.namespaceURI===gp?t.createElement(e):t.createElementNS(r,e)}}function mN(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pi(e){var t=li(e);return(t.local?mN:pN)(t)}function dN(){}function ja(e){return e==null?dN:function(){return this.querySelector(e)}}function xI(e){typeof e!="function"&&(e=ja(e));for(var t=this._groups,r=t.length,n=new Array(r),o=0;o=_&&(_=g+1);!(I=y[_])&&++_=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function RI(e){e||(e=MN);function t(p,l){return p&&l?e(p.__data__,l.__data__):!p-!l}for(var r=this._groups,n=r.length,o=new Array(n),i=0;it?1:e>=t?0:NaN}function NI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AI(){return Array.from(this)}function EI(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?EN:typeof t=="function"?$N:FN)(e,t,r??"")):Qi(this.node(),e)}function Qi(e,t){return e.style.getPropertyValue(t)||Sp(e).getComputedStyle(e,null).getPropertyValue(t)}function DN(e){return function(){delete this[e]}}function LN(e,t){return function(){this[e]=t}}function VN(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function UI(e,t){return arguments.length>1?this.each((t==null?DN:typeof t=="function"?VN:LN)(e,t)):this.node()[e]}function jI(e){return e.trim().split(/^|\s+/)}function Vb(e){return e.classList||new BI(e)}function BI(e){this._node=e,this._names=jI(e.getAttribute("class")||"")}BI.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 zI(e,t){for(var r=Vb(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function n4(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?Ip(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Ip(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=f4.exec(e))?new Ft(t[1],t[2],t[3],1):(t=u4.exec(e))?new Ft(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=l4.exec(e))?Ip(t[1],t[2],t[3],t[4]):(t=p4.exec(e))?Ip(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=m4.exec(e))?m_(t[1],t[2]/100,t[3]/100,1):(t=d4.exec(e))?m_(t[1],t[2]/100,t[3]/100,t[4]):s_.hasOwnProperty(e)?u_(s_[e]):e==="transparent"?new Ft(NaN,NaN,NaN,0):null}function u_(e){return new Ft(e>>16&255,e>>8&255,e&255,1)}function Ip(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ft(e,t,r,n)}function Hf(e){return e instanceof vo||(e=Jn(e)),e?(e=e.rgb(),new Ft(e.r,e.g,e.b,e.opacity)):new Ft}function _n(e,t,r,n){return arguments.length===1?Hf(e):new Ft(e,t,r,n??1)}function Ft(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}di(Ft,_n,Ji(vo,{brighter(e){return e=e==null?Ga:Math.pow(Ga,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new Ft(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ft(za(this.r),za(this.g),za(this.b),vp(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:l_,formatHex:l_,formatHex8:y4,formatRgb:p_,toString:p_}));function l_(){return`#${Ba(this.r)}${Ba(this.g)}${Ba(this.b)}`}function y4(){return`#${Ba(this.r)}${Ba(this.g)}${Ba(this.b)}${Ba((isNaN(this.opacity)?1:this.opacity)*255)}`}function p_(){let e=vp(this.opacity);return`${e===1?"rgb(":"rgba("}${za(this.r)}, ${za(this.g)}, ${za(this.b)}${e===1?")":`, ${e})`}`}function vp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function za(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ba(e){return e=za(e),(e<16?"0":"")+e.toString(16)}function m_(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Qn(e,t,r,n)}function h_(e){if(e instanceof Qn)return new Qn(e.h,e.s,e.l,e.opacity);if(e instanceof vo||(e=Jn(e)),!e)return new Qn;if(e instanceof Qn)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 Qn(a,s,c,e.opacity)}function Yf(e,t,r,n){return arguments.length===1?h_(e):new Qn(e,t,r,n??1)}function Qn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}di(Qn,Yf,Ji(vo,{brighter(e){return e=e==null?Ga:Math.pow(Ga,e),new Qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ea:Math.pow(ea,e),new Qn(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 Ft(Bb(e>=240?e-240:e+120,o,n),Bb(e,o,n),Bb(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new Qn(d_(this.h),_p(this.s),_p(this.l),vp(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=vp(this.opacity);return`${e===1?"hsl(":"hsla("}${d_(this.h)}, ${_p(this.s)*100}%, ${_p(this.l)*100}%${e===1?")":`, ${e})`}`}}));function d_(e){return e=(e||0)%360,e<0?e+360:e}function _p(e){return Math.max(0,Math.min(1,e||0))}function Bb(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 Pp=Math.PI/180,Tp=180/Math.PI;var Mp=18,b_=.96422,y_=1,g_=.82521,x_=4/29,rc=6/29,w_=3*rc*rc,g4=rc*rc*rc;function S_(e){if(e instanceof Po)return new Po(e.l,e.a,e.b,e.opacity);if(e instanceof hi)return I_(e);e instanceof Ft||(e=Hf(e));var t=qb(e.r),r=qb(e.g),n=qb(e.b),o=zb((.2225045*t+.7168786*r+.0606169*n)/y_),i,a;return t===r&&r===n?i=a=o:(i=zb((.4360747*t+.3850649*r+.1430804*n)/b_),a=zb((.0139322*t+.0971045*r+.7141733*n)/g_)),new Po(116*o-16,500*(i-o),200*(o-a),e.opacity)}function nc(e,t,r,n){return arguments.length===1?S_(e):new Po(e,t,r,n??1)}function Po(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}di(Po,nc,Ji(vo,{brighter(e){return new Po(this.l+Mp*(e??1),this.a,this.b,this.opacity)},darker(e){return new Po(this.l-Mp*(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=b_*Gb(t),e=y_*Gb(e),r=g_*Gb(r),new Ft(Kb(3.1338561*t-1.6168667*e-.4906146*r),Kb(-.9787684*t+1.9161415*e+.033454*r),Kb(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function zb(e){return e>g4?Math.pow(e,1/3):e/w_+x_}function Gb(e){return e>rc?e*e*e:w_*(e-x_)}function Kb(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qb(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function x4(e){if(e instanceof hi)return new hi(e.h,e.c,e.l,e.opacity);if(e instanceof Po||(e=S_(e)),e.a===0&&e.b===0)return new hi(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 S4(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 k_(e){return(e=+e)==1?lt:function(t,r){return r-t?S4(t,r,e):oc(isNaN(t)?r:t)}}function lt(e,t){var r=t-e;return r?O_(e,r):oc(isNaN(e)?t:e)}var vn=(function e(t){var r=k_(t);function n(o,i){var a=r((o=_n(o)).r,(i=_n(i)).r),s=r(o.g,i.g),c=r(o.b,i.b),u=lt(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 R_(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:ct(n,o)})),r=Zb.lastIndex;return r180?f+=360:f-u>180&&(u+=360),l.push({i:p.push(o(p)+"rotate(",null,n)-2,x:ct(u,f)})):f&&p.push(o(p)+"rotate("+f+n)}function s(u,f,p,l){u!==f?l.push({i:p.push(o(p)+"skewX(",null,n)-2,x:ct(u,f)}):f&&p.push(o(p)+"skewX("+f+n)}function c(u,f,p,l,m,h){if(u!==p||f!==l){var b=m.push(o(m)+"scale(",null,",",null,")");h.push({i:b-4,x:ct(u,p)},{i:b-2,x:ct(f,l)})}else(p!==1||l!==1)&&m.push(o(m)+"scale("+p+","+l+")")}return function(u,f){var p=[],l=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,p,l),a(u.rotate,f.rotate,p,l),s(u.skewX,f.skewX,p,l),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,p,l),u=f=null,function(m){for(var h=-1,b=l.length,y;++h=0&&e._call.call(void 0,t),e=e._next;--sc}function G_(){Ha=(Ap=tu.now())+Ep,sc=Jf=0;try{H_()}finally{sc=0,k4(),Ha=0}}function O4(){var e=tu.now(),t=e-Ap;t>K_&&(Ep-=t,Ap=e)}function k4(){for(var e,t=Np,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:Np=r);eu=e,oy(n)}function oy(e){if(!sc){Jf&&(Jf=clearTimeout(Jf));var t=e-Ha;t>24?(e<1/0&&(Jf=setTimeout(G_,e-tu.now()-Ep)),Qf&&(Qf=clearInterval(Qf))):(Qf||(Ap=tu.now(),Qf=setInterval(O4,K_)),sc=1,q_(G_))}}function $p(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 R4=Db("start","end","cancel","interrupt"),N4=[],X_=0,Y_=1,Lp=2,Dp=3,W_=4,Vp=5,ou=6;function ta(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;A4(e,r,{name:t,index:n,group:o,on:R4,tween:N4,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:X_})}function iu(e,t){var r=Lt(e,t);if(r.state>X_)throw new Error("too late; already scheduled");return r}function ar(e,t){var r=Lt(e,t);if(r.state>Dp)throw new Error("too late; already running");return r}function Lt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function A4(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=Fp(i,0,r.time);function i(u){r.state=Y_,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var f,p,l,m;if(r.state!==Y_)return c();for(f in n)if(m=n[f],m.name===r.name){if(m.state===Dp)return $p(a);m.state===W_?(m.state=ou,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[f]):+fLp&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function J4(e,t,r){var n,o,i=Q4(t)?iu:ar;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function sv(e,t){var r=this._id;return arguments.length<2?Lt(this.node(),r).on.on(e):this.each(J4(r,e,t))}function eA(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function cv(){return this.on("end.remove",eA(this._id))}function fv(e){var t=this._name,r=this._id;typeof e!="function"&&(e=ja(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 Iv;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;oYa)if(!(Math.abs(p*c-u*f)>Ya)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-a,h=o-s,b=c*c+u*u,y=m*m+h*h,x=Math.sqrt(b),g=Math.sqrt(l),_=i*Math.tan((ay-Math.acos((b+l-y)/(2*x*g)))/2),w=_/g,I=_/x;Math.abs(w-1)>Ya&&this._append`L${t+w*f},${r+w*p}`,this._append`A${i},${i},0,0,${+(p*m>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,p=1^a,l=a?o-i:i-o;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>Ya||Math.abs(this._y1-f)>Ya)&&this._append`L${u},${f}`,n&&(l<0&&(l=l%sy+sy),l>bA?this._append`A${n},${n},0,1,${p},${t-s},${r-c}A${n},${n},0,1,${p},${this._x1=u},${this._y1=f}`:l>Ya&&this._append`A${n},${n},0,${+(l>=ay)},${p},${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 _v(){return new ra}_v.prototype=ra.prototype;function to(e=3){return new ra(+e)}function vv(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Wa(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 Mo(e){return e=Wa(Math.abs(e)),e?e[1]:NaN}function Pv(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 Tv(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var gA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Co(e){if(!(t=gA.exec(e)))throw new Error("invalid format: "+e);var t;return new Gp({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]})}Co.prototype=Gp.prototype;function Gp(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+""}Gp.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 Mv(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 Cv(e,t){var r=Wa(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")+Wa(e,Math.max(0,t+i-1))[0]}function cy(e,t){var r=Wa(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 fy={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:vv,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)=>cy(e*100,t),r:cy,s:Cv,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uy(e){return e}var Ov=Array.prototype.map,kv=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Rv(e){var t=e.grouping===void 0||e.thousands===void 0?uy:Pv(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?uy:Tv(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(p,l){p=Co(p);var m=p.fill,h=p.align,b=p.sign,y=p.symbol,x=p.zero,g=p.width,_=p.comma,w=p.precision,I=p.trim,S=p.type;S==="n"?(_=!0,S="g"):fy[S]||(w===void 0&&(w=12),I=!0,S="g"),(x||m==="0"&&h==="=")&&(x=!0,m="0",h="=");var v=(l&&l.prefix!==void 0?l.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),M=(y==="$"?n:/[%p]/.test(S)?a:"")+(l&&l.suffix!==void 0?l.suffix:""),C=fy[S],R=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(N){var z=v,j=M,k,B,V;if(S==="c")j=C(N)+j,N="";else{N=+N;var Q=N<0||1/N<0;if(N=isNaN(N)?c:C(Math.abs(N),w),I&&(N=Mv(N)),Q&&+N==0&&b!=="+"&&(Q=!1),z=(Q?b==="("?b:s:b==="-"||b==="("?"":b)+z,j=(S==="s"&&!isNaN(N)&&au!==void 0?kv[8+au/3]:"")+j+(Q&&b==="("?")":""),R){for(k=-1,B=N.length;++kV||V>57){j=(V===46?o+N.slice(k+1):N.slice(k))+j,N=N.slice(0,k);break}}}_&&!x&&(N=t(N,1/0));var U=z.length+N.length+j.length,K=U>1)+z+N+j+K.slice(U);break;default:N=K+z+N+j;break}return i(N)}return O.toString=function(){return p+""},O}function f(p,l){var m=Math.max(-8,Math.min(8,Math.floor(Mo(l)/3)))*3,h=Math.pow(10,-m),b=u((p=Co(p),p.type="f",p),{suffix:kv[8+m/3]});return function(y){return b(h*y)}}return{format:u,formatPrefix:f}}var Kp,Pn,qp;ly({thousands:",",grouping:[3],currency:["$",""]});function ly(e){return Kp=Rv(e),Pn=Kp.format,qp=Kp.formatPrefix,Kp}function py(e){return Math.max(0,-Mo(Math.abs(e)))}function my(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mo(t)/3)))*3-Mo(Math.abs(e)))}function dy(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Mo(t)-Mo(e))+1}var oe=1e-6,Hp=1e-12,pe=Math.PI,Ke=pe/2,hy=pe/4,Kt=pe*2,Vt=180/pe,qe=pe/180,ge=Math.abs,Tn=Math.atan,sr=Math.atan2,ne=Math.cos;var Yp=Math.exp;var Xa=Math.log,Wp=Math.pow,re=Math.sin,gr=Math.sign||function(e){return e>0?1:e<0?-1:0},Je=Math.sqrt,fc=Math.tan;function Xp(e){return e>1?0:e<-1?pe:Math.acos(e)}function St(e){return e>1?Ke:e<-1?-Ke:Math.asin(e)}function qt(){}function Zp(e,t){e&&Av.hasOwnProperty(e.type)&&Av[e.type](e,t)}var Nv={Feature:function(e,t){Zp(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++npe&&(e-=Math.round(e/Kt)*Kt),[e,t]}yy.invert=yy;function gy(e,t,r){return(e%=Kt)?t||r?lu($v(e),Dv(t,r)):$v(e):t||r?Dv(t,r):yy}function Fv(e){return function(t,r){return t+=e,ge(t)>pe&&(t-=Math.round(t/Kt)*Kt),[t,r]}}function $v(e){var t=Fv(e);return t.invert=Fv(-e),t}function Dv(e,t){var r=ne(e),n=re(e),o=ne(t),i=re(t);function a(s,c){var u=ne(c),f=ne(s)*u,p=re(s)*u,l=re(c),m=l*r+f*n;return[sr(p*o-m*i,f*r-l*n),St(m*o+p*i)]}return a.invert=function(s,c){var u=ne(c),f=ne(s)*u,p=re(s)*u,l=re(c),m=l*o-p*i;return[sr(p*o+l*i,f*r+m*n),St(m*r-f*n)]},a}function Lv(e){e=gy(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]*=Vt,r[1]*=Vt,r}return t.invert=function(r){return r=e.invert(r[0]*qe,r[1]*qe),r[0]*=Vt,r[1]*=Vt,r},t}function Uv(e,t,r,n,o,i){if(r){var a=ne(t),s=re(t),c=n*r;o==null?(o=t+n*Kt,i=t-c/2):(o=Vv(a,o),i=Vv(a,i),(n>0?oi)&&(o+=n*Kt));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((p=f[s])[0],p[1]);else n(l.x,l.p.x,-1,o);l=l.p}l=l.o,f=l.z,m=!m}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=C*M,O=R>pe,N=y*S;if(c.add(sr(N*C*re(R),x*v+N*ne(R))),a+=O?M+C*Kt:M,O^h>=r^w>=r){var z=uc(Oo(m),Oo(_));uu(z);var j=uc(i,z);uu(j);var k=(O^M>=0?-1:1)*St(j[2]);(n>k||n===k&&(z[0]||z[1]))&&(s+=O^M>=0?1:-1)}}return(a<-oe||a0){for(c||(o.polygonStart(),c=!0),o.lineStart(),S=0;S1&&w&2&&I.push(I.pop().concat(I.shift())),f.push(I.filter(xA))}}return l}}function xA(e){return e.length>1}function wA(e,t){return((e=e.x)[0]<0?e[1]-Ke-oe:Ke-e[1])-((t=t.x)[0]<0?t[1]-Ke-oe:Ke-t[1])}var wy=rm(function(){return!0},SA,_A,[-pe,-Ke]);function SA(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)oe?Tn((re(t)*(i=ne(n))*re(r)-re(n)*(o=ne(t))*re(e))/(o*i*a)):(t+n)/2}function _A(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])>oe){var i=e[0]0,o=ge(t)>oe;function i(f,p,l,m){Uv(m,e,r,l,f,p)}function a(f,p){return ne(f)*ne(p)>t}function s(f){var p,l,m,h,b;return{lineStart:function(){h=m=!1,b=1},point:function(y,x){var g=[y,x],_,w=a(y,x),I=n?w?0:u(y,x):w?u(y+(y<0?pe:-pe),x):0;if(!p&&(h=m=w)&&f.lineStart(),w!==m&&(_=c(p,g),(!_||lc(p,_)||lc(g,_))&&(g[2]=1)),w!==m)b=0,w?(f.lineStart(),_=c(g,p),f.point(_[0],_[1])):(_=c(p,g),f.point(_[0],_[1],2),f.lineEnd()),p=_;else if(o&&p&&n^w){var S;!(I&l)&&(S=c(g,p,!0))&&(b=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)))}w&&(!p||!lc(p,g))&&f.point(g[0],g[1]),p=g,m=w,l=I},lineEnd:function(){m&&f.lineEnd(),p=null},clean:function(){return b|(h&&m)<<1}}}function c(f,p,l){var m=Oo(f),h=Oo(p),b=[1,0,0],y=uc(m,h),x=cu(y,y),g=y[0],_=x-g*g;if(!_)return!l&&f;var w=t*x/_,I=-t*g/_,S=uc(b,y),v=fu(b,w),M=fu(y,I);Qp(v,M);var C=S,R=cu(v,C),O=cu(C,C),N=R*R-O*(cu(v,v)-1);if(!(N<0)){var z=Je(N),j=fu(C,(-R-z)/O);if(Qp(j,v),j=su(j),!l)return j;var k=f[0],B=p[0],V=f[1],Q=p[1],U;B0^j[1]<(ge(j[0]-k)pe^(k<=j[0]&&j[0]<=B)){var X=fu(C,(-R+z)/O);return Qp(X,v),[j,su(X)]}}}function u(f,p){var l=n?e:pe-e,m=0;return f<-l?m|=1:f>l&&(m|=2),p<-l?m|=4:p>l&&(m|=8),m}return rm(a,s,i,n?[0,-e]:[-pe,e-pe])}function Gv(e,t,r,n,o,i){var a=e[0],s=e[1],c=t[0],u=t[1],f=0,p=1,l=c-a,m=u-s,h;if(h=r-a,!(!l&&h>0)){if(h/=l,l<0){if(h0){if(h>p)return;h>f&&(f=h)}if(h=o-a,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>f&&(f=h)}else if(l>0){if(h0)){if(h/=m,m<0){if(h0){if(h>p)return;h>f&&(f=h)}if(h=i-s,!(!m&&h<0)){if(h/=m,m<0){if(h>p)return;h>f&&(f=h)}else if(m>0){if(h0&&(e[0]=a+f*l,e[1]=s+f*m),p<1&&(t[0]=a+p*l,t[1]=s+p*m),!0}}}}}var pu=1e9,nm=-pu;function pc(e,t,r,n){function o(u,f){return e<=u&&u<=r&&t<=f&&f<=n}function i(u,f,p,l){var m=0,h=0;if(u==null||(m=a(u,p))!==(h=a(f,p))||c(u,f)<0^p>0)do l.point(m===0||m===3?e:r,m>1?n:t);while((m=(m+p+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 p=a(u,1),l=a(f,1);return p!==l?p-l:p===0?f[1]-u[1]:p===1?u[0]-f[0]:p===2?u[1]-f[1]:f[0]-u[0]}return function(u){var f=u,p=Jp(),l,m,h,b,y,x,g,_,w,I,S,v={point:M,lineStart:N,lineEnd:z,polygonStart:R,polygonEnd:O};function M(k,B){o(k,B)&&f.point(k,B)}function C(){for(var k=0,B=0,V=m.length;Bn&&(he-Z)*(n-X)>(se-X)*(e-Z)&&++k:se<=n&&(he-Z)*(n-X)<(se-X)*(e-Z)&&--k;return k}function R(){f=p,l=[],m=[],S=!0}function O(){var k=C(),B=S&&k,V=(l=ec(l)).length;(B||V)&&(u.polygonStart(),B&&(u.lineStart(),i(null,null,1,u),u.lineEnd()),V&&tm(l,s,k,i,u),u.polygonEnd()),f=u,l=m=h=null}function N(){v.point=j,m&&m.push(h=[]),I=!0,w=!1,g=_=NaN}function z(){l&&(j(b,y),x&&w&&p.rejoin(),l.push(p.result())),v.point=M,w&&f.lineEnd()}function j(k,B){var V=o(k,B);if(m&&h.push([k,B]),I)b=k,y=B,x=V,I=!1,V&&(f.lineStart(),f.point(k,B));else if(V&&w)f.point(k,B);else{var Q=[g=Math.max(nm,Math.min(pu,g)),_=Math.max(nm,Math.min(pu,_))],U=[k=Math.max(nm,Math.min(pu,k)),B=Math.max(nm,Math.min(pu,B))];Gv(Q,U,e,t,r,n)?(w||(f.lineStart(),f.point(Q[0],Q[1])),f.point(U[0],U[1]),V||f.lineEnd(),S=!1):V&&(f.lineStart(),f.point(k,B),S=!1)}g=k,_=B,w=V}return v}}var mu=e=>e;var Sy=new nn,Iy=new nn,Kv,qv,_y,vy,na={point:qt,lineStart:qt,lineEnd:qt,polygonStart:function(){na.lineStart=vA,na.lineEnd=TA},polygonEnd:function(){na.lineStart=na.lineEnd=na.point=qt,Sy.add(ge(Iy)),Iy=new nn},result:function(){var e=Sy/2;return Sy=new nn,e}};function vA(){na.point=PA}function PA(e,t){na.point=Hv,Kv=_y=e,qv=vy=t}function Hv(e,t){Iy.add(vy*e-_y*t),_y=e,vy=t}function TA(){Hv(Kv,qv)}var Py=na;var mc=1/0,om=mc,du=-mc,im=du,MA={point:CA,lineStart:qt,lineEnd:qt,polygonStart:qt,polygonEnd:qt,result:function(){var e=[[mc,om],[du,im]];return du=im=-(om=mc=1/0),e}};function CA(e,t){edu&&(du=e),tim&&(im=t)}var dc=MA;var Ty=0,My=0,hu=0,am=0,sm=0,hc=0,Cy=0,Oy=0,bu=0,Xv,Zv,ko,Ro,no={point:Za,lineStart:Yv,lineEnd:Wv,polygonStart:function(){no.lineStart=RA,no.lineEnd=NA},polygonEnd:function(){no.point=Za,no.lineStart=Yv,no.lineEnd=Wv},result:function(){var e=bu?[Cy/bu,Oy/bu]:hc?[am/hc,sm/hc]:hu?[Ty/hu,My/hu]:[NaN,NaN];return Ty=My=hu=am=sm=hc=Cy=Oy=bu=0,e}};function Za(e,t){Ty+=e,My+=t,++hu}function Yv(){no.point=OA}function OA(e,t){no.point=kA,Za(ko=e,Ro=t)}function kA(e,t){var r=e-ko,n=t-Ro,o=Je(r*r+n*n);am+=o*(ko+e)/2,sm+=o*(Ro+t)/2,hc+=o,Za(ko=e,Ro=t)}function Wv(){no.point=Za}function RA(){no.point=AA}function NA(){Qv(Xv,Zv)}function AA(e,t){no.point=Qv,Za(Xv=ko=e,Zv=Ro=t)}function Qv(e,t){var r=e-ko,n=t-Ro,o=Je(r*r+n*n);am+=o*(ko+e)/2,sm+=o*(Ro+t)/2,hc+=o,o=Ro*e-ko*t,Cy+=o*(ko+e),Oy+=o*(Ro+t),bu+=o*3,Za(ko=e,Ro=t)}var ky=no;function cm(e){this._context=e}cm.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,Kt);break}}},result:qt};var Ny=new nn,Ry,Jv,eP,yu,gu,fm={point:qt,lineStart:function(){fm.point=EA},lineEnd:function(){Ry&&tP(Jv,eP),fm.point=qt},polygonStart:function(){Ry=!0},polygonEnd:function(){Ry=null},result:function(){var e=+Ny;return Ny=new nn,e}};function EA(e,t){fm.point=tP,Jv=yu=e,eP=gu=t}function tP(e,t){yu-=e,gu-=t,Ny.add(Je(yu*yu+gu*gu)),yu=e,gu=t}var Ay=fm;var rP,um,nP,oP,bc=class{constructor(t){this._append=t==null?iP:FA(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!==nP||this._append!==um){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`,nP=n,um=this._append,oP=this._,this._=o}this._+=oP;break}}}result(){let t=this._;return this._="",t.length?t:null}};function iP(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return iP;if(t!==rP){let r=10**t;rP=t,um=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 bc(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 Ey;for(var n in e)r[n]=e[n];return r.stream=t,r}}function Ey(){}Ey.prototype={constructor:Ey,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 Fy(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),ro(r,e.stream(dc)),t(dc.result()),n!=null&&e.clipExtent(n),e}function xu(e,t,r){return Fy(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 lm(e,t,r){return xu(e,[[0,0],t],r)}function pm(e,t,r){return Fy(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 mm(e,t,r){return Fy(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 aP=16,$A=ne(30*qe);function $y(e,t){return+t?LA(e,t):DA(e)}function DA(e){return xc({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function LA(e,t){function r(n,o,i,a,s,c,u,f,p,l,m,h,b,y){var x=u-n,g=f-o,_=x*x+g*g;if(_>4*t&&b--){var w=a+l,I=s+m,S=c+h,v=Je(w*w+I*I+S*S),M=St(S/=v),C=ge(ge(S)-1)t||ge((x*z+g*j)/_-.5)>.3||a*l+s*m+c*h<$A)&&(r(n,o,i,a,s,c,O,N,C,w/=v,I/=v,S,b,y),y.point(O,N),r(O,N,C,w,I,S,u,f,p,l,m,h,b,y))}}return function(n){var o,i,a,s,c,u,f,p,l,m,h,b,y={point:x,lineStart:g,lineEnd:w,polygonStart:function(){n.polygonStart(),y.lineStart=I},polygonEnd:function(){n.polygonEnd(),y.lineStart=g}};function x(M,C){M=e(M,C),n.point(M[0],M[1])}function g(){p=NaN,y.point=_,n.lineStart()}function _(M,C){var R=Oo([M,C]),O=e(M,C);r(p,l,f,m,h,b,p=O[0],l=O[1],f=M,m=R[0],h=R[1],b=R[2],aP,n),n.point(p,l)}function w(){y.point=x,n.lineEnd()}function I(){g(),y.point=S,y.lineEnd=v}function S(M,C){_(o=M,C),i=p,a=l,s=m,c=h,u=b,y.point=_}function v(){r(p,l,f,m,h,b,i,a,o,s,c,u,aP,n),y.lineEnd=w,w()}return y}}var VA=xc({point:function(e,t){this.stream.point(e*qe,t*qe)}});function UA(e){return xc({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function jA(e,t,r,n,o){function i(a,s){return a*=n,s*=o,[t+e*a,r-e*s]}return i.invert=function(a,s){return[(a-t)/e*n,(r-s)/e*o]},i}function sP(e,t,r,n,o,i){if(!i)return jA(e,t,r,n,o);var a=ne(i),s=re(i),c=a*e,u=s*e,f=a/e,p=s/e,l=(s*r-a*t)/e,m=(s*t+a*r)/e;function h(b,y){return b*=n,y*=o,[c*b-u*y+t,r-u*b-c*y]}return h.invert=function(b,y){return[n*(f*b-p*y+l),o*(m-p*b-f*y)]},h}function cr(e){return Dy(function(){return e})()}function Dy(e){var t,r=150,n=480,o=250,i=0,a=0,s=0,c=0,u=0,f,p=0,l=1,m=1,h=null,b=wy,y=null,x,g,_,w=mu,I=.5,S,v,M,C,R;function O(k){return M(k[0]*qe,k[1]*qe)}function N(k){return k=M.invert(k[0],k[1]),k&&[k[0]*Vt,k[1]*Vt]}O.stream=function(k){return C&&R===k?C:C=VA(UA(f)(b(S(w(R=k)))))},O.preclip=function(k){return arguments.length?(b=k,h=void 0,j()):b},O.postclip=function(k){return arguments.length?(w=k,y=x=g=_=null,j()):w},O.clipAngle=function(k){return arguments.length?(b=+k?zv(h=k*qe):(h=null,wy),j()):h*Vt},O.clipExtent=function(k){return arguments.length?(w=k==null?(y=x=g=_=null,mu):pc(y=+k[0][0],x=+k[0][1],g=+k[1][0],_=+k[1][1]),j()):y==null?null:[[y,x],[g,_]]},O.scale=function(k){return arguments.length?(r=+k,z()):r},O.translate=function(k){return arguments.length?(n=+k[0],o=+k[1],z()):[n,o]},O.center=function(k){return arguments.length?(i=k[0]%360*qe,a=k[1]%360*qe,z()):[i*Vt,a*Vt]},O.rotate=function(k){return arguments.length?(s=k[0]%360*qe,c=k[1]%360*qe,u=k.length>2?k[2]%360*qe:0,z()):[s*Vt,c*Vt,u*Vt]},O.angle=function(k){return arguments.length?(p=k%360*qe,z()):p*Vt},O.reflectX=function(k){return arguments.length?(l=k?-1:1,z()):l<0},O.reflectY=function(k){return arguments.length?(m=k?-1:1,z()):m<0},O.precision=function(k){return arguments.length?(S=$y(v,I=k*k),j()):Je(I)},O.fitExtent=function(k,B){return xu(O,k,B)},O.fitSize=function(k,B){return lm(O,k,B)},O.fitWidth=function(k,B){return pm(O,k,B)},O.fitHeight=function(k,B){return mm(O,k,B)};function z(){var k=sP(r,0,0,l,m,p).apply(null,t(i,a)),B=sP(r,n-k[0],o-k[1],l,m,p);return f=gy(s,c,u),v=lu(t,B),M=lu(f,v),S=$y(v,I),j()}function j(){return C=R=null,O}return function(){return t=e.apply(this,arguments),O.invert=t.invert&&N,z()}}function wc(e){var t=0,r=pe/3,n=Dy(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*qe,r=i[1]*qe):[t*Vt,r*Vt]},o}function cP(e){var t=ne(e);function r(n,o){return[n*t,re(o)/t]}return r.invert=function(n,o){return[n/t,St(o*t)]},r}function fP(e,t){var r=re(e),n=(r+re(t))/2;if(ge(n)=.12&&y<.234&&b>=-.425&&b<-.214?o:y>=.166&&y<.234&&b>=-.214&&b<-.115?a:r).invert(l)},f.stream=function(l){return e&&t===l?e:e=BA([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),p()):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 m=r.scale(),h=+l[0],b=+l[1];return n=r.translate(l).clipExtent([[h-.455*m,b-.238*m],[h+.455*m,b+.238*m]]).stream(u),i=o.translate([h-.307*m,b+.201*m]).clipExtent([[h-.425*m+oe,b+.12*m+oe],[h-.214*m-oe,b+.234*m-oe]]).stream(u),s=a.translate([h-.205*m,b+.212*m]).clipExtent([[h-.214*m+oe,b+.166*m+oe],[h-.115*m-oe,b+.234*m-oe]]).stream(u),p()},f.fitExtent=function(l,m){return xu(f,l,m)},f.fitSize=function(l,m){return lm(f,l,m)},f.fitWidth=function(l,m){return pm(f,l,m)},f.fitHeight=function(l,m){return mm(f,l,m)};function p(){return e=t=null,f}return f.scale(1070)}function dm(e){return function(t,r){var n=ne(t),o=ne(r),i=e(n*o);return i===1/0?[2,0]:[i*o*re(t),i*re(r)]}}function No(e){return function(t,r){var n=Je(t*t+r*r),o=e(n),i=re(o),a=ne(o);return[sr(t*i,n*a),St(n&&r*i/n)]}}var Vy=dm(function(e){return Je(2/(1+e))});Vy.invert=No(function(e){return 2*St(e/2)});function Uy(){return cr(Vy).scale(124.75).clipAngle(180-.001)}var jy=dm(function(e){return(e=Xp(e))&&e/re(e)});jy.invert=No(function(e){return e});function By(){return cr(jy).scale(79.4188).clipAngle(180-.001)}function Sc(e,t){return[e,Xa(fc((Ke+t)/2))]}Sc.invert=function(e,t){return[e,2*Tn(Yp(t))-Ke]};function zy(){return Gy(Sc).scale(961/Kt)}function Gy(e){var t=cr(e),r=t.center,n=t.scale,o=t.translate,i=t.clipExtent,a=null,s,c,u;t.scale=function(p){return arguments.length?(n(p),f()):n()},t.translate=function(p){return arguments.length?(o(p),f()):o()},t.center=function(p){return arguments.length?(r(p),f()):r()},t.clipExtent=function(p){return arguments.length?(p==null?a=s=c=u=null:(a=+p[0][0],s=+p[0][1],c=+p[1][0],u=+p[1][1]),f()):a==null?null:[[a,s],[c,u]]};function f(){var p=pe*n(),l=t(Lv(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:e===Sc?[[Math.max(l[0]-p,a),s],[Math.min(l[0]+p,c),u]]:[[a,Math.max(l[1]-p,s)],[c,Math.min(l[1]+p,u)]])}return f()}function hm(e){return fc((Ke+e)/2)}function uP(e,t){var r=ne(e),n=e===t?re(e):Xa(r/ne(t))/Xa(hm(t)/hm(e)),o=r*Wp(hm(e),n)/n;if(!n)return Sc;function i(a,s){o>0?s<-Ke+oe&&(s=-Ke+oe):s>Ke-oe&&(s=Ke-oe);var c=o/Wp(hm(s),n);return[c*re(n*a),o-c*ne(n*a)]}return i.invert=function(a,s){var c=o-s,u=gr(n)*Je(a*a+c*c),f=sr(a,ge(c))*gr(c);return c*n<0&&(f-=pe*gr(a)*gr(c)),[f/n,2*Tn(Wp(o/u,1/n))-Ke]},i}function Ky(){return wc(uP).scale(109.5).parallels([30,30])}function Ic(e,t){return[e,t]}Ic.invert=Ic;function qy(){return cr(Ic).scale(152.63)}function lP(e,t){var r=ne(e),n=e===t?re(e):(r-ne(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 $t(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 Qa(){var e=new vr,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 vr;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 Qa(t,r).unknown(n)},$t.apply(o,arguments),o}function ia(){var e=Qa().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 p(){var l=t().length,m=ot&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function KA(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?qA:KA,c=u=null,p}function p(l){return l==null||isNaN(l=+l)?i:(c||(c=s(e.map(n),t,r)))(n(a(l)))}return p.invert=function(l){return a(o((u||(u=s(t,e.map(n),ct)))(l)))},p.domain=function(l){return arguments.length?(e=Array.from(l,_c),f()):e.slice()},p.range=function(l){return arguments.length?(t=Array.from(l),f()):t.slice()},p.rangeRound=function(l){return t=Array.from(l),r=qa,f()},p.clamp=function(l){return arguments.length?(a=l?!0:Vr,f()):a!==Vr},p.interpolate=function(l){return arguments.length?(r=l,f()):r},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,m){return n=l,o=m,f()}}function Mu(){return Ja()(Vr,Vr)}function sg(e,t,r,n){var o=Js(e,t,r),i;switch(n=Co(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=my(o,a))&&(n.precision=i),qp(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=dy(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=py(o))&&(n.precision=i-(n.type==="%")*2);break}}return Pn(n)}function yi(e){var t=e.domain;return e.ticks=function(r){var n=t();return fi(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return sg(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=Uf(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 es(){var e=Mu();return e.copy=function(){return Ao(e,es())},$t.apply(e,arguments),yi(e)}function Cu(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 Cu(e).unknown(t)},e=arguments.length?Array.from(e,_c):[0,1],yi(r)}function Ou(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 ZA(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 bP(e){return(t,r)=>-e(-t,r)}function cg(e){let t=e(dP,hP),r=t.domain,n=10,o,i;function a(){return o=ZA(n),i=XA(n),r()[0]<0?(o=bP(o),i=bP(i),e(HA,YA)):e(dP,hP),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],p=f0){for(;l<=m;++l)for(h=1;hf)break;x.push(b)}}else for(;l<=m;++l)for(h=n-1;h>=1;--h)if(b=l>0?h/i(-l):h*i(l),!(bf)break;x.push(b)}x.length*2{if(s==null&&(s=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Co(c)).precision==null&&(c.trim=!0),c=Pn(c)),s===1/0)return c;let u=Math.max(1,n*s/t.ticks().length);return f=>{let p=f/i(Math.round(o(f)));return p*nr(Ou(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function ku(){let e=cg(Ja()).domain([1,10]);return e.copy=()=>Ao(e,ku()).base(e.base()),$t.apply(e,arguments),e}function yP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function gP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function fg(e){var t=1,r=e(yP(t),gP(t));return r.constant=function(n){return arguments.length?e(yP(t=+n),gP(t)):t},yi(r)}function Ru(){var e=fg(Ja());return e.copy=function(){return Ao(e,Ru()).constant(e.constant())},$t.apply(e,arguments)}function xP(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function QA(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function JA(e){return e<0?-e*e:e*e}function ug(e){var t=e(Vr,Vr),r=1;function n(){return r===1?e(Vr,Vr):r===.5?e(QA,JA):e(xP(r),xP(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},yi(t)}function Nu(){var e=ug(Ja());return e.copy=function(){return Ao(e,Nu()).exponent(e.exponent())},$t.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)=>(lg.setTime(+i),pg.setTime(+a),e(lg),e(pg),Math.floor(r(lg,pg))),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 jpe=Fu.range;var Ht=Ze(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),wP=Ht.range;var gi=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()),e7=gi.range,xi=Ze(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),t7=xi.range;var wi=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()),r7=wi.range,Si=Ze(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),n7=Si.range;var Mn=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),o7=Mn.range,ns=Ze(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),i7=ns.range,os=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)),a7=os.range;function is(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 on=is(0),aa=is(1),ym=is(2),gm=is(3),Fo=is(4),xm=is(5),wm=is(6),IP=on.range,s7=aa.range,c7=ym.range,f7=gm.range,u7=Fo.range,l7=xm.range,p7=wm.range;function as(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 an=as(0),sa=as(1),Sm=as(2),Im=as(3),$o=as(4),_m=as(5),vm=as(6),_P=an.range,m7=sa.range,d7=Sm.range,h7=Im.range,b7=$o.range,y7=_m.range,g7=vm.range;var Ii=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()),x7=Ii.range,_i=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()),w7=_i.range;var xr=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());xr.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 S7=xr.range,wr=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());wr.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 I7=wr.range;function PP(e,t,r,n,o,i){let a=[[Ht,1,1e3],[Ht,5,5*1e3],[Ht,15,15*1e3],[Ht,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,p){let l=fy).right(a,l);if(m===a.length)return e.every(Js(u/31536e6,f/31536e6,p));if(m===0)return Fu.every(Math.max(Js(u,f,p),1));let[h,b]=a[l/a[m-1][2]53)return null;"w"in A||(A.w=1),"Z"in A?(ae=gg(Du(A.y,0,1)),Oe=ae.getUTCDay(),ae=Oe>4||Oe===0?sa.ceil(ae):sa(ae),ae=ns.offset(ae,(A.V-1)*7),A.y=ae.getUTCFullYear(),A.m=ae.getUTCMonth(),A.d=ae.getUTCDate()+(A.w+6)%7):(ae=yg(Du(A.y,0,1)),Oe=ae.getDay(),ae=Oe>4||Oe===0?aa.ceil(ae):aa(ae),ae=Mn.offset(ae,(A.V-1)*7),A.y=ae.getFullYear(),A.m=ae.getMonth(),A.d=ae.getDate()+(A.w+6)%7)}else("W"in A||"U"in A)&&("w"in A||(A.w="u"in A?A.u%7:"W"in A?1:0),Oe="Z"in A?gg(Du(A.y,0,1)).getUTCDay():yg(Du(A.y,0,1)).getDay(),A.m=0,A.d="W"in A?(A.w+6)%7+A.W*7-(Oe+5)%7:A.w+A.U*7-(Oe+6)%7);return"Z"in A?(A.H+=A.Z/100|0,A.M+=A.Z%100,gg(A)):yg(A)}}function M(T,L,G,A){for(var te=0,ae=L.length,Oe=G.length,_e,tt;te=Oe)return-1;if(_e=L.charCodeAt(te++),_e===37){if(_e=L.charAt(te++),tt=I[_e in TP?L.charAt(te++):_e],!tt||(A=tt(T,G,A))<0)return-1}else if(_e!=G.charCodeAt(A++))return-1}return A}function C(T,L,G){var A=u.exec(L.slice(G));return A?(T.p=f.get(A[0].toLowerCase()),G+A[0].length):-1}function R(T,L,G){var A=m.exec(L.slice(G));return A?(T.w=h.get(A[0].toLowerCase()),G+A[0].length):-1}function O(T,L,G){var A=p.exec(L.slice(G));return A?(T.w=l.get(A[0].toLowerCase()),G+A[0].length):-1}function N(T,L,G){var A=x.exec(L.slice(G));return A?(T.m=g.get(A[0].toLowerCase()),G+A[0].length):-1}function z(T,L,G){var A=b.exec(L.slice(G));return A?(T.m=y.get(A[0].toLowerCase()),G+A[0].length):-1}function j(T,L,G){return M(T,t,L,G)}function k(T,L,G){return M(T,r,L,G)}function B(T,L,G){return M(T,n,L,G)}function V(T){return a[T.getDay()]}function Q(T){return i[T.getDay()]}function U(T){return c[T.getMonth()]}function K(T){return s[T.getMonth()]}function W(T){return o[+(T.getHours()>=12)]}function Z(T){return 1+~~(T.getMonth()/3)}function X(T){return a[T.getUTCDay()]}function he(T){return i[T.getUTCDay()]}function se(T){return c[T.getUTCMonth()]}function ce(T){return s[T.getUTCMonth()]}function Y(T){return o[+(T.getUTCHours()>=12)]}function ee(T){return 1+~~(T.getUTCMonth()/3)}return{format:function(T){var L=S(T+="",_);return L.toString=function(){return T},L},parse:function(T){var L=v(T+="",!1);return L.toString=function(){return T},L},utcFormat:function(T){var L=S(T+="",w);return L.toString=function(){return T},L},utcParse:function(T){var L=v(T+="",!0);return L.toString=function(){return T},L}}}var TP={"-":"",_:" ",0:"0"},Yt=/^\s*\d+/,v7=/^%/,P7=/[\\^$*+?|[\]().{}]/g;function Le(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i[t.toLowerCase(),r]))}function M7(e,t,r){var n=Yt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function C7(e,t,r){var n=Yt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function O7(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function k7(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function R7(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function MP(e,t,r){var n=Yt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function CP(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function N7(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 A7(e,t,r){var n=Yt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function E7(e,t,r){var n=Yt.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=Yt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function F7(e,t,r){var n=Yt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function kP(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function $7(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function D7(e,t,r){var n=Yt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function L7(e,t,r){var n=Yt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function V7(e,t,r){var n=Yt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function U7(e,t,r){var n=v7.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function j7(e,t,r){var n=Yt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function B7(e,t,r){var n=Yt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function RP(e,t){return Le(e.getDate(),t,2)}function z7(e,t){return Le(e.getHours(),t,2)}function G7(e,t){return Le(e.getHours()%12||12,t,2)}function K7(e,t){return Le(1+Mn.count(xr(e),e),t,3)}function $P(e,t){return Le(e.getMilliseconds(),t,3)}function q7(e,t){return $P(e,t)+"000"}function H7(e,t){return Le(e.getMonth()+1,t,2)}function Y7(e,t){return Le(e.getMinutes(),t,2)}function W7(e,t){return Le(e.getSeconds(),t,2)}function X7(e){var t=e.getDay();return t===0?7:t}function Z7(e,t){return Le(on.count(xr(e)-1,e),t,2)}function DP(e){var t=e.getDay();return t>=4||t===0?Fo(e):Fo.ceil(e)}function Q7(e,t){return e=DP(e),Le(Fo.count(xr(e),e)+(xr(e).getDay()===4),t,2)}function J7(e){return e.getDay()}function eE(e,t){return Le(aa.count(xr(e)-1,e),t,2)}function tE(e,t){return Le(e.getFullYear()%100,t,2)}function rE(e,t){return e=DP(e),Le(e.getFullYear()%100,t,2)}function nE(e,t){return Le(e.getFullYear()%1e4,t,4)}function oE(e,t){var r=e.getDay();return e=r>=4||r===0?Fo(e):Fo.ceil(e),Le(e.getFullYear()%1e4,t,4)}function iE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Le(t/60|0,"0",2)+Le(t%60,"0",2)}function NP(e,t){return Le(e.getUTCDate(),t,2)}function aE(e,t){return Le(e.getUTCHours(),t,2)}function sE(e,t){return Le(e.getUTCHours()%12||12,t,2)}function cE(e,t){return Le(1+ns.count(wr(e),e),t,3)}function LP(e,t){return Le(e.getUTCMilliseconds(),t,3)}function fE(e,t){return LP(e,t)+"000"}function uE(e,t){return Le(e.getUTCMonth()+1,t,2)}function lE(e,t){return Le(e.getUTCMinutes(),t,2)}function pE(e,t){return Le(e.getUTCSeconds(),t,2)}function mE(e){var t=e.getUTCDay();return t===0?7:t}function dE(e,t){return Le(an.count(wr(e)-1,e),t,2)}function VP(e){var t=e.getUTCDay();return t>=4||t===0?$o(e):$o.ceil(e)}function hE(e,t){return e=VP(e),Le($o.count(wr(e),e)+(wr(e).getUTCDay()===4),t,2)}function bE(e){return e.getUTCDay()}function yE(e,t){return Le(sa.count(wr(e)-1,e),t,2)}function gE(e,t){return Le(e.getUTCFullYear()%100,t,2)}function xE(e,t){return e=VP(e),Le(e.getUTCFullYear()%100,t,2)}function wE(e,t){return Le(e.getUTCFullYear()%1e4,t,4)}function SE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?$o(e):$o.ceil(e),Le(e.getUTCFullYear()%1e4,t,4)}function IE(){return"+0000"}function AP(){return"%"}function EP(e){return+e}function FP(e){return Math.floor(+e/1e3)}var vc,Pc,UP,Do,jP;wg({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 wg(e){return vc=xg(e),Pc=vc.format,UP=vc.parse,Do=vc.utcFormat,jP=vc.utcParse,vc}function _E(e){return new Date(e)}function vE(e){return e instanceof Date?+e:+new Date(+e)}function Pm(e,t,r,n,o,i,a,s,c,u){var f=Mu(),p=f.invert,l=f.domain,m=u(".%L"),h=u(":%S"),b=u("%I:%M"),y=u("%I %p"),x=u("%a %d"),g=u("%b %d"),_=u("%B"),w=u("%Y");function I(S){return(c(S)Xb(e[e.length-1]);var Nm=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(q),Am=ie(Nm);var Em=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(q),Fm=ie(Em);var $m=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(q),Dm=ie($m);var Lm=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(q),Vm=ie(Lm);var Bu=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(q),Tc=ie(Bu);var Um=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(q),jm=ie(Um);var zu=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(q),Mc=ie(zu);var Bm=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(q),zm=ie(Bm);var Gm=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(q),Km=ie(Gm);var qm=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(q),Hm=ie(qm);var Ym=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(q),Wm=ie(Ym);var Xm=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(q),Zm=ie(Xm);var Qm=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(q),Jm=ie(Qm);var ed=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(q),td=ie(ed);var rd=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(q),nd=ie(rd);var od=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(q),id=ie(od);var ad=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(q),sd=ie(ad);var cd=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(q),fd=ie(cd);var ud=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(q),ld=ie(ud);var pd=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(q),md=ie(pd);var dd=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(q),hd=ie(dd);var bd=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(q),yd=ie(bd);var gd=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(q),xd=ie(gd);var wd=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(q),Sd=ie(wd);var Id=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(q),_d=ie(Id);var vd=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(q),Pd=ie(vd);var Td=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(q),Md=ie(Td);function Cd(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 Od=ac(Tr(300,.5,0),Tr(-240,.5,1));var Rd=ac(Tr(-100,.75,.35),Tr(80,1.5,.8)),Nd=ac(Tr(260,.75,.35),Tr(80,1.5,.8)),kd=Tr();function Ad(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return kd.h=360*e-100,kd.s=1.5-1.5*t,kd.l=.8-.9*t,kd+""}var Ed=_n(),PE=Math.PI/3,TE=Math.PI*2/3;function Fd(e){var t;return e=(.5-e)*Math.PI,Ed.r=255*(t=Math.sin(e))*t,Ed.g=255*(t=Math.sin(e+PE))*t,Ed.b=255*(t=Math.sin(e+TE))*t,Ed+""}function $d(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 Dd(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var Ld=Dd(q("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Vd=Dd(q("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Ud=Dd(q("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),jd=Dd(q("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ss(e){return function(){return e}}var Ng=Math.cos;var Cc=Math.min,Gu=Math.sin,Ve=Math.sqrt,Ag=1e-12,cs=Math.PI,pbe=cs/2,Oc=2*cs;function BP(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 ra(t)}var bbe=Array.prototype.slice;function zP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function GP(e){this._context=e}GP.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 fs(e){return new GP(e)}function KP(e){return e[0]}function qP(e){return e[1]}function Eg(e,t){var r=ss(!0),n=null,o=fs,i=null,a=BP(s);e=typeof e=="function"?e:e===void 0?KP:ss(e),t=typeof t=="function"?t:t===void 0?qP:ss(t);function s(c){var u,f=(c=zP(c)).length,p,l=!1,m;for(n==null&&(i=o(m=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 zg=(function e(t){function r(n){return t===1?new rl(n):new ZP(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 Gd(e,t){this._context=e,this._k=(1-t)/6}Gd.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 Gg=(function e(t){function r(n){return new Gd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Kd(e,t){this._context=e,this._k=(1-t)/6}Kd.prototype={areaStart:kn,areaEnd:kn,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 Kg=(function e(t){function r(n){return new Kd(n,t)}return r.tension=function(n){return e(+n)},r})(0);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(){(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 qg=(function e(t){function r(n){return new qd(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>Ag){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>Ag){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 QP(e,t){this._context=e,this._alpha=t}QP.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 Hg=(function e(t){function r(n){return t?new QP(n,t):new Gd(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:kn,areaEnd:kn,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 Yg=(function e(t){function r(n){return t?new JP(n,t):new Kd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function eT(e,t){this._context=e,this._alpha=t}eT.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 Wg=(function e(t){function r(n){return t?new eT(n,t):new qd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function tT(e){this._context=e}tT.prototype={areaStart:kn,areaEnd:kn,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 Xg(e){return new tT(e)}function rT(e){return e<0?-1:1}function nT(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(rT(i)+rT(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function oT(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Zg(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 Hd(e){this._context=e}Hd.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:Zg(this,this._t0,oT(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,Zg(this,oT(this,r=nT(this,e,t)),r);break;default:Zg(this,this._t0,r=nT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function iT(e){this._context=new aT(e)}(iT.prototype=Object.create(Hd.prototype)).point=function(e,t){Hd.prototype.point.call(this,t,e)};function aT(e){this._context=e}aT.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 Qg(e){return new Hd(e)}function Jg(e){return new iT(e)}function cT(e){this._context=e}cT.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=sT(e),o=sT(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 tx(e){return new Yd(e,.5)}function rx(e){return new Yd(e,0)}function nx(e){return new Yd(e,1)}function ca(e,t,r){this.k=e,this.x=t,this.y=r}ca.prototype={constructor:ca,scale:function(e){return e===1?this:new ca(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ca(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 ox=new ca(1,0,0);ix.prototype=ca.prototype;function ix(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ox;return e.__zoom}function Rn(e){return e!=null&&!Number.isNaN(e)}function Ur(e,t){return+Rn(t)-+Rn(e)||bt(e,t)}function us(e,t){return+Rn(t)-+Rn(e)||wn(e,t)}function ol(e){return e!=null&&`${e}`!=""}function ax(e){return isFinite(e)?e:NaN}function ls(e){return e>0&&isFinite(e)?e:NaN}function Ac(e){return e<0&&isFinite(e)?e:NaN}function Wd(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`${EE(e.getUTCFullYear(),4)}-${Pi(e.getUTCMonth()+1,2)}-${Pi(e.getUTCDate(),2)}${r||n||o||i?`T${Pi(r,2)}:${Pi(n,2)}${o||i?`:${Pi(o,2)}${i?`.${Pi(i,3)}`:""}`:""}Z`:""}`}function EE(e){return e<0?`-${Pi(-e,6)}`:e>9999?`+${Pi(e,6)}`:Pi(e,4)}function Pi(e,t){return`${e}`.padStart(t,"0")}var FE=/^(?:[-+]\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 FE.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ti(e){if(e==null)return;let t=e[0],r=e[e.length-1];return wn(t,r)}var Fc=1e3,ua=Fc*60,la=ua*60,Vo=la*24,Lo=Vo*7,ps=Vo*30,fa=Vo*365,sx=[["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",ua],["5 minutes",5*ua],["15 minutes",15*ua],["30 minutes",30*ua],["hour",la],["3 hours",3*la],["6 hours",6*la],["12 hours",12*la],["day",Vo],["2 days",2*Vo],["week",Lo],["2 weeks",2*Lo],["month",ps],["3 months",3*ps],["6 months",6*ps],["year",fa],["2 years",2*fa],["5 years",5*fa],["10 years",10*fa],["20 years",20*fa],["50 years",50*fa],["100 years",100*fa]],cx=new Map([["second",Fc],["minute",ua],["hour",la],["day",Vo],["monday",Lo],["tuesday",Lo],["wednesday",Lo],["thursday",Lo],["friday",Lo],["saturday",Lo],["sunday",Lo],["week",Lo],["month",ps],["year",fa]]),uT=new Map([["second",Ht],["minute",gi],["hour",wi],["day",Mn],["monday",aa],["tuesday",ym],["wednesday",gm],["thursday",Fo],["friday",xm],["saturday",wm],["sunday",on],["week",on],["month",Ii],["year",xr]]),fx=new Map([["second",Ht],["minute",xi],["hour",Si],["day",os],["monday",sa],["tuesday",Sm],["wednesday",Im],["thursday",$o],["friday",_m],["saturday",vm],["sunday",an],["week",an],["month",_i],["year",wr]]),$c=Symbol("intervalDuration"),Zd=Symbol("intervalType");for(let[e,t]of uT)t[$c]=cx.get(e),t[Zd]="time";for(let[e,t]of fx)t[$c]=cx.get(e),t[Zd]="utc";var al=[["year",wr,"utc"],["month",_i,"utc"],["day",os,"utc",6*ps],["hour",Si,"utc",3*Vo],["minute",xi,"utc",6*la],["second",Ht,"utc",30*ua]],Xd=[["year",xr,"time"],["month",Ii,"time"],["day",Mn,"time",6*ps],["hour",wi,"time",3*Vo],["minute",gi,"time",6*la],["second",Ht,"time",30*ua]],$E=[al[0],Xd[0],al[1],Xd[1],al[2],Xd[2],...al.slice(3)];function lT(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=fx.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 ux(e){return pT(lT(e),"time")}function lx(e){return pT(lT(e),"utc")}function pT([e,t],r){let n=(r==="time"?uT:fx).get(e);return t>1&&(n=n.every(t),n[$c]=cx.get(e)*t,n[Zd]=r),n}function px(e,t){if(!(t>1))return;let r=e[$c];if(!sx.some(([,o])=>o===r)||r%Vo===0&&VoMath.log(o)).center(sx,Math.log(r*t))];return(e[Zd]==="time"?ux:lx)(n)}function fT(e,t,r){let n=t==="time"?Pc:Do;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=DE(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 DE(e){return e==="left"||e==="right"?(t,r)=>` +var EO=Object.defineProperty;var Ra=(e,t)=>{for(var r in t)EO(e,r,{get:t[r],enumerable:!0})};var hr={};Ra(hr,{HasPropertyKey:()=>$l,IsArray:()=>Tt,IsAsyncIterator:()=>Cg,IsBigInt:()=>If,IsBoolean:()=>Zo,IsDate:()=>Na,IsFunction:()=>Og,IsIterator:()=>kg,IsNull:()=>Rg,IsNumber:()=>Zr,IsObject:()=>Ge,IsRegExp:()=>_f,IsString:()=>Xe,IsSymbol:()=>Ng,IsUint8Array:()=>Qo,IsUndefined:()=>Mt});function $l(e,t){return t in e}function Cg(e){return Ge(e)&&!Tt(e)&&!Qo(e)&&Symbol.asyncIterator in e}function Tt(e){return Array.isArray(e)}function If(e){return typeof e=="bigint"}function Zo(e){return typeof e=="boolean"}function Na(e){return e instanceof globalThis.Date}function Og(e){return typeof e=="function"}function kg(e){return Ge(e)&&!Tt(e)&&!Qo(e)&&Symbol.iterator in e}function Rg(e){return e===null}function Zr(e){return typeof e=="number"}function Ge(e){return typeof e=="object"&&e!==null}function _f(e){return e instanceof globalThis.RegExp}function Xe(e){return typeof e=="string"}function Ng(e){return typeof e=="symbol"}function Qo(e){return e instanceof globalThis.Uint8Array}function Mt(e){return e===void 0}function FO(e){return e.map(t=>Dl(t))}function $O(e){return new Date(e.getTime())}function DO(e){return new Uint8Array(e)}function LO(e){return new RegExp(e.source,e.flags)}function VO(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Dl(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Dl(e[r]);return t}function Dl(e){return Tt(e)?FO(e):Na(e)?$O(e):Qo(e)?DO(e):_f(e)?LO(e):Ge(e)?VO(e):e}function ot(e){return Dl(e)}function Es(e,t){return t===void 0?ot(e):ot({...t,...e})}function Ll(e){return ge(e)&&globalThis.Symbol.asyncIterator in e}function Vl(e){return ge(e)&&globalThis.Symbol.iterator in e}function Ag(e){return ge(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function jl(e){return e instanceof globalThis.Promise}function Tr(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function _w(e){return e instanceof globalThis.Map}function Pw(e){return e instanceof globalThis.Set}function yn(e){return globalThis.ArrayBuffer.isView(e)}function Fs(e){return e instanceof globalThis.Uint8Array}function ue(e,t){return t in e}function ge(e){return e!==null&&typeof e=="object"}function le(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function at(e){return e===void 0}function Jo(e){return e===null}function yo(e){return typeof e=="boolean"}function st(e){return typeof e=="number"}function Ul(e){return globalThis.Number.isInteger(e)}function Un(e){return typeof e=="bigint"}function Ue(e){return typeof e=="string"}function ji(e){return typeof e=="function"}function ei(e){return typeof e=="symbol"}function Qr(e){return Un(e)||yo(e)||Jo(e)||st(e)||Ue(e)||ei(e)||at(e)}var Rt;(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=ge(a);return e.AllowArrayObject?s:s&&!le(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?st(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=at(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(Rt||(Rt={}));function jO(e){return globalThis.Object.freeze(e).map(t=>Pf(t))}function UO(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Pf(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Pf(e[r]);return globalThis.Object.freeze(t)}function Pf(e){return Tt(e)?jO(e):Na(e)?e:Qo(e)?e:_f(e)?e:Ge(e)?UO(e):e}function F(e,t){let r=t!==void 0?{...t,...e}:e;switch(Rt.InstanceMode){case"freeze":return Pf(r);case"clone":return ot(r);default:return r}}var pe=class extends Error{constructor(t){super(t)}};var ut=Symbol.for("TypeBox.Transform"),Gn=Symbol.for("TypeBox.Readonly"),sr=Symbol.for("TypeBox.Optional"),bn=Symbol.for("TypeBox.Hint"),$=Symbol.for("TypeBox.Kind");function $s(e){return Ge(e)&&e[Gn]==="Readonly"}function $r(e){return Ge(e)&&e[sr]==="Optional"}function Eg(e){return Ce(e,"Any")}function Fg(e){return Ce(e,"Argument")}function Bn(e){return Ce(e,"Array")}function Aa(e){return Ce(e,"AsyncIterator")}function Ea(e){return Ce(e,"BigInt")}function ti(e){return Ce(e,"Boolean")}function zn(e){return Ce(e,"Computed")}function Kn(e){return Ce(e,"Constructor")}function GO(e){return Ce(e,"Date")}function qn(e){return Ce(e,"Function")}function Hn(e){return Ce(e,"Integer")}function gt(e){return Ce(e,"Intersect")}function Fa(e){return Ce(e,"Iterator")}function Ce(e,t){return Ge(e)&&$ in e&&e[$]===t}function Gl(e){return Zo(e)||Zr(e)||Xe(e)}function Jr(e){return Ce(e,"Literal")}function en(e){return Ce(e,"MappedKey")}function ct(e){return Ce(e,"MappedResult")}function Ui(e){return Ce(e,"Never")}function BO(e){return Ce(e,"Not")}function Tf(e){return Ce(e,"Null")}function Yn(e){return Ce(e,"Number")}function Ct(e){return Ce(e,"Object")}function $a(e){return Ce(e,"Promise")}function Da(e){return Ce(e,"Record")}function wt(e){return Ce(e,"Ref")}function $g(e){return Ce(e,"RegExp")}function ri(e){return Ce(e,"String")}function Mf(e){return Ce(e,"Symbol")}function tn(e){return Ce(e,"TemplateLiteral")}function zO(e){return Ce(e,"This")}function Ee(e){return Ge(e)&&ut in e}function rn(e){return Ce(e,"Tuple")}function ni(e){return Ce(e,"Undefined")}function ke(e){return Ce(e,"Union")}function KO(e){return Ce(e,"Uint8Array")}function qO(e){return Ce(e,"Unknown")}function HO(e){return Ce(e,"Unsafe")}function YO(e){return Ce(e,"Void")}function Gi(e){return Ge(e)&&$ in e&&Xe(e[$])}function lt(e){return Eg(e)||Fg(e)||Bn(e)||ti(e)||Ea(e)||Aa(e)||zn(e)||Kn(e)||GO(e)||qn(e)||Hn(e)||gt(e)||Fa(e)||Jr(e)||en(e)||ct(e)||Ui(e)||BO(e)||Tf(e)||Yn(e)||Ct(e)||$a(e)||Da(e)||wt(e)||$g(e)||ri(e)||Mf(e)||tn(e)||zO(e)||rn(e)||ni(e)||ke(e)||KO(e)||qO(e)||HO(e)||YO(e)||Gi(e)}var M={};Ra(M,{IsAny:()=>Ow,IsArgument:()=>kw,IsArray:()=>Rw,IsAsyncIterator:()=>Nw,IsBigInt:()=>Aw,IsBoolean:()=>Ew,IsComputed:()=>Fw,IsConstructor:()=>$w,IsDate:()=>Dw,IsFunction:()=>Lw,IsImport:()=>e5,IsInteger:()=>Vw,IsIntersect:()=>jw,IsIterator:()=>Uw,IsKind:()=>m2,IsKindOf:()=>ve,IsLiteral:()=>Of,IsLiteralBoolean:()=>t5,IsLiteralNumber:()=>Bw,IsLiteralString:()=>Gw,IsLiteralValue:()=>zw,IsMappedKey:()=>Kw,IsMappedResult:()=>qw,IsNever:()=>Hw,IsNot:()=>Yw,IsNull:()=>Ww,IsNumber:()=>Xw,IsObject:()=>Zw,IsOptional:()=>JO,IsPromise:()=>Qw,IsProperties:()=>Bl,IsReadonly:()=>QO,IsRecord:()=>Jw,IsRecursive:()=>r5,IsRef:()=>e2,IsRegExp:()=>t2,IsSchema:()=>zt,IsString:()=>r2,IsSymbol:()=>n2,IsTemplateLiteral:()=>o2,IsThis:()=>i2,IsTransform:()=>a2,IsTuple:()=>s2,IsUint8Array:()=>f2,IsUndefined:()=>c2,IsUnion:()=>jg,IsUnionLiteral:()=>n5,IsUnknown:()=>u2,IsUnsafe:()=>l2,IsVoid:()=>p2,TypeGuardUnknownTypeError:()=>Dg});var Dg=class extends pe{},WO=["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 Tw(e){try{return new RegExp(e),!0}catch{return!1}}function Lg(e){if(!Xe(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function Mw(e){return Vg(e)||zt(e)}function Cf(e){return Mt(e)||If(e)}function Ze(e){return Mt(e)||Zr(e)}function Vg(e){return Mt(e)||Zo(e)}function Be(e){return Mt(e)||Xe(e)}function XO(e){return Mt(e)||Xe(e)&&Lg(e)&&Tw(e)}function ZO(e){return Mt(e)||Xe(e)&&Lg(e)}function Cw(e){return Mt(e)||zt(e)}function QO(e){return Ge(e)&&e[Gn]==="Readonly"}function JO(e){return Ge(e)&&e[sr]==="Optional"}function Ow(e){return ve(e,"Any")&&Be(e.$id)}function kw(e){return ve(e,"Argument")&&Zr(e.index)}function Rw(e){return ve(e,"Array")&&e.type==="array"&&Be(e.$id)&&zt(e.items)&&Ze(e.minItems)&&Ze(e.maxItems)&&Vg(e.uniqueItems)&&Cw(e.contains)&&Ze(e.minContains)&&Ze(e.maxContains)}function Nw(e){return ve(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Be(e.$id)&&zt(e.items)}function Aw(e){return ve(e,"BigInt")&&e.type==="bigint"&&Be(e.$id)&&Cf(e.exclusiveMaximum)&&Cf(e.exclusiveMinimum)&&Cf(e.maximum)&&Cf(e.minimum)&&Cf(e.multipleOf)}function Ew(e){return ve(e,"Boolean")&&e.type==="boolean"&&Be(e.$id)}function Fw(e){return ve(e,"Computed")&&Xe(e.target)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))}function $w(e){return ve(e,"Constructor")&&e.type==="Constructor"&&Be(e.$id)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))&&zt(e.returns)}function Dw(e){return ve(e,"Date")&&e.type==="Date"&&Be(e.$id)&&Ze(e.exclusiveMaximumTimestamp)&&Ze(e.exclusiveMinimumTimestamp)&&Ze(e.maximumTimestamp)&&Ze(e.minimumTimestamp)&&Ze(e.multipleOfTimestamp)}function Lw(e){return ve(e,"Function")&&e.type==="Function"&&Be(e.$id)&&Tt(e.parameters)&&e.parameters.every(t=>zt(t))&&zt(e.returns)}function e5(e){return ve(e,"Import")&&$l(e,"$defs")&&Ge(e.$defs)&&Bl(e.$defs)&&$l(e,"$ref")&&Xe(e.$ref)&&e.$ref in e.$defs}function Vw(e){return ve(e,"Integer")&&e.type==="integer"&&Be(e.$id)&&Ze(e.exclusiveMaximum)&&Ze(e.exclusiveMinimum)&&Ze(e.maximum)&&Ze(e.minimum)&&Ze(e.multipleOf)}function Bl(e){return Ge(e)&&Object.entries(e).every(([t,r])=>Lg(t)&&zt(r))}function jw(e){return ve(e,"Intersect")&&!(Xe(e.type)&&e.type!=="object")&&Tt(e.allOf)&&e.allOf.every(t=>zt(t)&&!a2(t))&&Be(e.type)&&(Vg(e.unevaluatedProperties)||Cw(e.unevaluatedProperties))&&Be(e.$id)}function Uw(e){return ve(e,"Iterator")&&e.type==="Iterator"&&Be(e.$id)&&zt(e.items)}function ve(e,t){return Ge(e)&&$ in e&&e[$]===t}function Gw(e){return Of(e)&&Xe(e.const)}function Bw(e){return Of(e)&&Zr(e.const)}function t5(e){return Of(e)&&Zo(e.const)}function Of(e){return ve(e,"Literal")&&Be(e.$id)&&zw(e.const)}function zw(e){return Zo(e)||Zr(e)||Xe(e)}function Kw(e){return ve(e,"MappedKey")&&Tt(e.keys)&&e.keys.every(t=>Zr(t)||Xe(t))}function qw(e){return ve(e,"MappedResult")&&Bl(e.properties)}function Hw(e){return ve(e,"Never")&&Ge(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Yw(e){return ve(e,"Not")&&zt(e.not)}function Ww(e){return ve(e,"Null")&&e.type==="null"&&Be(e.$id)}function Xw(e){return ve(e,"Number")&&e.type==="number"&&Be(e.$id)&&Ze(e.exclusiveMaximum)&&Ze(e.exclusiveMinimum)&&Ze(e.maximum)&&Ze(e.minimum)&&Ze(e.multipleOf)}function Zw(e){return ve(e,"Object")&&e.type==="object"&&Be(e.$id)&&Bl(e.properties)&&Mw(e.additionalProperties)&&Ze(e.minProperties)&&Ze(e.maxProperties)}function Qw(e){return ve(e,"Promise")&&e.type==="Promise"&&Be(e.$id)&&zt(e.item)}function Jw(e){return ve(e,"Record")&&e.type==="object"&&Be(e.$id)&&Mw(e.additionalProperties)&&Ge(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&Tw(r[0])&&Ge(t.patternProperties)&&zt(t.patternProperties[r[0]])})(e)}function r5(e){return Ge(e)&&bn in e&&e[bn]==="Recursive"}function e2(e){return ve(e,"Ref")&&Be(e.$id)&&Xe(e.$ref)}function t2(e){return ve(e,"RegExp")&&Be(e.$id)&&Xe(e.source)&&Xe(e.flags)&&Ze(e.maxLength)&&Ze(e.minLength)}function r2(e){return ve(e,"String")&&e.type==="string"&&Be(e.$id)&&Ze(e.minLength)&&Ze(e.maxLength)&&XO(e.pattern)&&ZO(e.format)}function n2(e){return ve(e,"Symbol")&&e.type==="symbol"&&Be(e.$id)}function o2(e){return ve(e,"TemplateLiteral")&&e.type==="string"&&Xe(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function i2(e){return ve(e,"This")&&Be(e.$id)&&Xe(e.$ref)}function a2(e){return Ge(e)&&ut in e}function s2(e){return ve(e,"Tuple")&&e.type==="array"&&Be(e.$id)&&Zr(e.minItems)&&Zr(e.maxItems)&&e.minItems===e.maxItems&&(Mt(e.items)&&Mt(e.additionalItems)&&e.minItems===0||Tt(e.items)&&e.items.every(t=>zt(t)))}function c2(e){return ve(e,"Undefined")&&e.type==="undefined"&&Be(e.$id)}function n5(e){return jg(e)&&e.anyOf.every(t=>Gw(t)||Bw(t))}function jg(e){return ve(e,"Union")&&Be(e.$id)&&Ge(e)&&Tt(e.anyOf)&&e.anyOf.every(t=>zt(t))}function f2(e){return ve(e,"Uint8Array")&&e.type==="Uint8Array"&&Be(e.$id)&&Ze(e.minByteLength)&&Ze(e.maxByteLength)}function u2(e){return ve(e,"Unknown")&&Be(e.$id)}function l2(e){return ve(e,"Unsafe")}function p2(e){return ve(e,"Void")&&e.type==="void"&&Be(e.$id)}function m2(e){return Ge(e)&&$ in e&&Xe(e[$])&&!WO.includes(e[$])}function zt(e){return Ge(e)&&(Ow(e)||kw(e)||Rw(e)||Ew(e)||Aw(e)||Nw(e)||Fw(e)||$w(e)||Dw(e)||Lw(e)||Vw(e)||jw(e)||Uw(e)||Of(e)||Kw(e)||qw(e)||Hw(e)||Yw(e)||Ww(e)||Xw(e)||Zw(e)||Qw(e)||Jw(e)||e2(e)||t2(e)||r2(e)||n2(e)||o2(e)||i2(e)||s2(e)||c2(e)||jg(e)||f2(e)||u2(e)||l2(e)||p2(e)||m2(e))}var Ug="(true|false)",kf="(0|[1-9][0-9]*)",Gg="(.*)",o5="(?!.*)",$G=`^${Ug}$`,Bi=`^${kf}$`,zi=`^${Gg}$`,d2=`^${o5}$`;var Ki={};Ra(Ki,{Clear:()=>a5,Delete:()=>s5,Entries:()=>i5,Get:()=>u5,Has:()=>c5,Set:()=>f5});var Ds=new Map;function i5(){return new Map(Ds)}function a5(){return Ds.clear()}function s5(e){return Ds.delete(e)}function c5(e){return Ds.has(e)}function f5(e,t){Ds.set(e,t)}function u5(e){return Ds.get(e)}var Wn={};Ra(Wn,{Clear:()=>p5,Delete:()=>m5,Entries:()=>l5,Get:()=>g5,Has:()=>d5,Set:()=>h5});var Ls=new Map;function l5(){return new Map(Ls)}function p5(){return Ls.clear()}function m5(e){return Ls.delete(e)}function d5(e){return Ls.has(e)}function h5(e,t){Ls.set(e,t)}function g5(e){return Ls.get(e)}function h2(e,t){return e.includes(t)}function g2(e){return[...new Set(e)]}function y5(e,t){return e.filter(r=>t.includes(r))}function b5(e,t){return e.reduce((r,n)=>y5(r,n),t)}function y2(e){return e.length===1?e[0]:e.length>1?b5(e.slice(1),e[0]):[]}function b2(e){let t=[];for(let r of e)t.push(...r);return t}function qi(e){return F({[$]:"Any"},e)}function Vs(e,t){return F({[$]:"Array",type:"array",items:e},t)}function x2(e){return F({[$]:"Argument",index:e})}function js(e,t){return F({[$]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function Je(e,t,r){return F({[$]:"Computed",target:e,parameters:t},r)}function x5(e,t){let{[t]:r,...n}=e;return n}function yt(e,t){return t.reduce((r,n)=>x5(r,n),e)}function Se(e){return F({[$]:"Never",not:{}},e)}function Re(e){return F({[$]:"MappedResult",properties:e})}function Us(e,t,r){return F({[$]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function bo(e,t,r){return F({[$]:"Function",type:"Function",parameters:e,returns:t},r)}function Rf(e,t){return F({[$]:"Union",anyOf:e},t)}function w5(e){return e.some(t=>$r(t))}function w2(e){return e.map(t=>$r(t)?S5(t):t)}function S5(e){return yt(e,[sr])}function v5(e,t){return w5(e)?gr(Rf(w2(e),t)):Rf(w2(e),t)}function xo(e,t){return e.length===1?F(e[0],t):e.length===0?Se(t):v5(e,t)}function Fe(e,t){return e.length===0?Se(t):e.length===1?F(e[0],t):Rf(e,t)}var zl=class extends pe{};function I5(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Bg(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function ii(e,t){return Bg(e,t,"(")}function Nf(e,t){return Bg(e,t,")")}function S2(e,t){return Bg(e,t,"|")}function _5(e){if(!(ii(e,0)&&Nf(e,e.length-1)))return!1;let t=0;for(let r=0;r0&&n.push(Gs(a)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(Gs(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function O5(e){function t(o,i){if(!ii(o,i))throw new zl("TemplateLiteralParser: Index must point to open parens");let a=0;for(let s=i;s0&&n.push(Gs(s)),o=a-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Gs(e){return _5(e)?Gs(P5(e)):T5(e)?C5(e):M5(e)?O5(e):{type:"const",const:I5(e)}}function Bs(e){return Gs(e.slice(1,e.length-1))}var zg=class extends pe{};function k5(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 R5(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 N5(e){return e.type==="const"&&e.const===".*"}function La(e){return k5(e)||N5(e)?!1:R5(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 zg("Unknown expression type")})()}function Kl(e){let t=Bs(e.pattern);return La(t)}var Kg=class extends pe{};function*v2(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of v2(e.slice(1)))yield`${t}${r}`}function*A5(e){return yield*v2(e.expr.map(t=>[...Af(t)]))}function*E5(e){for(let t of e.expr)yield*Af(t)}function*F5(e){return yield e.const}function*Af(e){return e.type==="and"?yield*A5(e):e.type==="or"?yield*E5(e):e.type==="const"?yield*F5(e):(()=>{throw new Kg("Unknown expression")})()}function zs(e){let t=Bs(e.pattern);return La(t)?[...Af(t)]:[]}function Oe(e,t){return F({[$]:"Literal",const:e,type:typeof e},t)}function ql(e){return F({[$]:"Boolean",type:"boolean"},e)}function Ks(e){return F({[$]:"BigInt",type:"bigint"},e)}function xn(e){return F({[$]:"Number",type:"number"},e)}function Mr(e){return F({[$]:"String",type:"string"},e)}function*$5(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield ql():t==="number"?yield xn():t==="bigint"?yield Ks():t==="string"?yield Mr():yield(()=>{let r=t.split("|").map(n=>Oe(n.trim()));return r.length===0?Se():r.length===1?r[0]:xo(r)})()}function*D5(e){if(e[1]!=="{"){let t=Oe("$"),r=qg(e.slice(1));return yield*[t,...r]}for(let t=2;t_2(r,t)).join("|")})`:Yn(e)?`${t}${kf}`:Hn(e)?`${t}${kf}`:Ea(e)?`${t}${kf}`:ri(e)?`${t}${Gg}`:Jr(e)?`${t}${L5(e.const.toString())}`:ti(e)?`${t}${Ug}`:(()=>{throw new Hg(`Unexpected Kind '${e[$]}'`)})()}function Yg(e){return`^${e.map(t=>_2(t,"")).join("")}$`}function Va(e){let r=zs(e).map(n=>Oe(n));return xo(r)}function Hl(e,t){let r=Xe(e)?Yg(I2(e)):Yg(e);return F({[$]:"TemplateLiteral",type:"string",pattern:r},t)}function V5(e){return zs(e).map(r=>r.toString())}function j5(e){let t=[];for(let r of e)t.push(...Dr(r));return t}function U5(e){return[e.toString()]}function Dr(e){return[...new Set(tn(e)?V5(e):ke(e)?j5(e.anyOf):Jr(e)?U5(e.const):Yn(e)?["[number]"]:Hn(e)?["[number]"]:[])]}function G5(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=Hi(e,Dr(t[o]),r);return n}function B5(e,t,r){return G5(e,t.properties,r)}function P2(e,t,r){let n=B5(e,t,r);return Re(n)}function M2(e,t){return e.map(r=>C2(r,t))}function z5(e){return e.filter(t=>!Ui(t))}function K5(e,t){return Yl(z5(M2(e,t)))}function q5(e){return e.some(t=>Ui(t))?[]:e}function H5(e,t){return xo(q5(M2(e,t)))}function Y5(e,t){return t in e?e[t]:t==="[number]"?xo(e):Se()}function W5(e,t){return t==="[number]"?e:Se()}function X5(e,t){return t in e?e[t]:Se()}function C2(e,t){return gt(e)?K5(e.allOf,t):ke(e)?H5(e.anyOf,t):rn(e)?Y5(e.items??[],t):Bn(e)?W5(e.items,t):Ct(e)?X5(e.properties,t):Se()}function Ef(e,t){return t.map(r=>C2(e,r))}function T2(e,t){return xo(Ef(e,t))}function Hi(e,t,r){if(wt(e)||wt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!lt(e)||!lt(t))throw new pe(n);return Je("Index",[e,t])}return ct(t)?P2(e,t,r):en(t)?O2(e,t,r):F(lt(t)?T2(e,Dr(t)):T2(e,t),r)}function Z5(e,t,r){return{[t]:Hi(e,[t],ot(r))}}function Q5(e,t,r){return t.reduce((n,o)=>({...n,...Z5(e,o,r)}),{})}function J5(e,t,r){return Q5(e,t.keys,r)}function O2(e,t,r){let n=J5(e,t,r);return Re(n)}function qs(e,t){return F({[$]:"Iterator",type:"Iterator",items:e},t)}function ek(e){return globalThis.Object.keys(e).filter(t=>!$r(e[t]))}function tk(e,t){let r=ek(e),n=r.length>0?{[$]:"Object",type:"object",required:r,properties:e}:{[$]:"Object",type:"object",properties:e};return F(n,t)}var $e=tk;function Wl(e,t){return F({[$]:"Promise",type:"Promise",item:e},t)}function rk(e){return F(yt(e,[Gn]))}function nk(e){return F({...e,[Gn]:"Readonly"})}function ok(e,t){return t===!1?rk(e):nk(e)}function Lr(e,t){let r=t??!0;return ct(e)?k2(e,r):ok(e,r)}function ik(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Lr(e[n],t);return r}function ak(e,t){return ik(e.properties,t)}function k2(e,t){let r=ak(e,t);return Re(r)}function wn(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 R2(e,t){return e in t?Sn(e,t[e]):Re(t)}function sk(e){return{[e]:Oe(e)}}function ck(e){let t={};for(let r of e)t[r]=Oe(r);return t}function fk(e,t){return h2(t,e)?sk(e):ck(t)}function uk(e,t){let r=fk(e,t);return R2(e,r)}function Ff(e,t){return t.map(r=>Sn(e,r))}function lk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=Sn(e,t[n]);return r}function Sn(e,t){let r={...t};return $r(t)?gr(Sn(e,yt(t,[sr]))):$s(t)?Lr(Sn(e,yt(t,[Gn]))):ct(t)?R2(e,t.properties):en(t)?uk(e,t.keys):Kn(t)?Us(Ff(e,t.parameters),Sn(e,t.returns),r):qn(t)?bo(Ff(e,t.parameters),Sn(e,t.returns),r):Aa(t)?js(Sn(e,t.items),r):Fa(t)?qs(Sn(e,t.items),r):gt(t)?yr(Ff(e,t.allOf),r):ke(t)?Fe(Ff(e,t.anyOf),r):rn(t)?wn(Ff(e,t.items??[]),r):Ct(t)?$e(lk(e,t.properties),r):Bn(t)?Vs(Sn(e,t.items),r):$a(t)?Wl(Sn(e,t.item),r):t}function pk(e,t){let r={};for(let n of e)r[n]=Sn(n,t);return r}function N2(e,t,r){let n=lt(e)?Dr(e):e,o=t({[$]:"MappedKey",keys:n}),i=pk(n,o);return $e(i,r)}function mk(e){return F(yt(e,[sr]))}function dk(e){return F({...e,[sr]:"Optional"})}function hk(e,t){return t===!1?mk(e):dk(e)}function gr(e,t){let r=t??!0;return ct(e)?A2(e,r):hk(e,r)}function gk(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=gr(e[n],t);return r}function yk(e,t){return gk(e.properties,t)}function A2(e,t){let r=yk(e,t);return Re(r)}function $f(e,t={}){let r=e.every(o=>Ct(o)),n=lt(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return F(t.unevaluatedProperties===!1||lt(t.unevaluatedProperties)||r?{...n,[$]:"Intersect",type:"object",allOf:e}:{...n,[$]:"Intersect",allOf:e},t)}function bk(e){return e.every(t=>$r(t))}function xk(e){return yt(e,[sr])}function E2(e){return e.map(t=>$r(t)?xk(t):t)}function wk(e,t){return bk(e)?gr($f(E2(e),t)):$f(E2(e),t)}function Yl(e,t={}){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ee(r)))throw new Error("Cannot intersect transform types");return wk(e,t)}function yr(e,t){if(e.length===1)return F(e[0],t);if(e.length===0)return Se(t);if(e.some(r=>Ee(r)))throw new Error("Cannot intersect transform types");return $f(e,t)}function wo(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new pe("Ref: $ref must be a string");return F({[$]:"Ref",$ref:t},r)}function Sk(e,t){return Je("Awaited",[Je(e,t)])}function vk(e){return Je("Awaited",[wo(e)])}function Ik(e){return yr(F2(e))}function _k(e){return Fe(F2(e))}function Pk(e){return Hs(e)}function F2(e){return e.map(t=>Hs(t))}function Hs(e,t){return F(zn(e)?Sk(e.target,e.parameters):gt(e)?Ik(e.allOf):ke(e)?_k(e.anyOf):$a(e)?Pk(e.item):wt(e)?vk(e.$ref):e,t)}function $2(e){let t=[];for(let r of e)t.push(Vr(r));return t}function Tk(e){let t=$2(e);return b2(t)}function Mk(e){let t=$2(e);return y2(t)}function Ck(e){return e.map((t,r)=>r.toString())}function Ok(e){return["[number]"]}function kk(e){return globalThis.Object.getOwnPropertyNames(e)}function Rk(e){return Wg?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Vr(e){return gt(e)?Tk(e.allOf):ke(e)?Mk(e.anyOf):rn(e)?Ck(e.items??[]):Bn(e)?Ok(e.items):Ct(e)?kk(e.properties):Da(e)?Rk(e.patternProperties):[]}var Wg=!1;function Ys(e){Wg=!0;let t=Vr(e);return Wg=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function Nk(e,t){return Je("KeyOf",[Je(e,t)])}function Ak(e){return Je("KeyOf",[wo(e)])}function Ek(e,t){let r=Vr(e),n=Fk(r),o=xo(n);return F(o,t)}function Fk(e){return e.map(t=>t==="[number]"?xn():Oe(t))}function Ws(e,t){return zn(e)?Nk(e.target,e.parameters):wt(e)?Ak(e.$ref):ct(e)?D2(e,t):Ek(e,t)}function $k(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ws(e[n],ot(t));return r}function Dk(e,t){return $k(e.properties,t)}function D2(e,t){let r=Dk(e,t);return Re(r)}function Xl(e){let t=Vr(e),r=Ef(e,t);return t.map((n,o)=>[t[o],r[o]])}function Lk(e){let t=[];for(let r of e)t.push(...Vr(r));return g2(t)}function Vk(e){return e.filter(t=>!Ui(t))}function jk(e,t){let r=[];for(let n of e)r.push(...Ef(n,[t]));return Vk(r)}function Uk(e,t){let r={};for(let n of t)r[n]=Yl(jk(e,n));return r}function L2(e,t){let r=Lk(e),n=Uk(e,r);return $e(n,t)}function Zl(e){return F({[$]:"Date",type:"Date"},e)}function Ql(e){return F({[$]:"Null",type:"null"},e)}function Jl(e){return F({[$]:"Symbol",type:"symbol"},e)}function ep(e){return F({[$]:"Undefined",type:"undefined"},e)}function tp(e){return F({[$]:"Uint8Array",type:"Uint8Array"},e)}function Xn(e){return F({[$]:"Unknown"},e)}function Gk(e){return e.map(t=>Xg(t,!1))}function Bk(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Lr(Xg(e[r],!1));return t}function rp(e,t){return t===!0?e:Lr(e)}function Xg(e,t){return Cg(e)?rp(qi(),t):kg(e)?rp(qi(),t):Tt(e)?Lr(wn(Gk(e))):Qo(e)?tp():Na(e)?Zl():Ge(e)?rp($e(Bk(e)),t):Og(e)?rp(bo([],Xn()),t):Mt(e)?ep():Rg(e)?Ql():Ng(e)?Jl():If(e)?Ks():Zr(e)?Oe(e):Zo(e)?Oe(e):Xe(e)?Oe(e):$e({})}function V2(e,t){return F(Xg(e,!0),t)}function j2(e,t){return Kn(e)?wn(e.parameters,t):Se(t)}function U2(e,t){if(Mt(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=>Oe(i));return Fe(o,{...t,[bn]:"Enum"})}var Qg=class extends pe{},D;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(D||(D={}));function vn(e){return e===D.False?e:D.True}function Xs(e){throw new Qg(e)}function Nt(e){return M.IsNever(e)||M.IsIntersect(e)||M.IsUnion(e)||M.IsUnknown(e)||M.IsAny(e)}function At(e,t){return M.IsNever(t)?Y2(e,t):M.IsIntersect(t)?np(e,t):M.IsUnion(t)?ry(e,t):M.IsUnknown(t)?Q2(e,t):M.IsAny(t)?ty(e,t):Xs("StructuralRight")}function ty(e,t){return D.True}function zk(e,t){return M.IsIntersect(t)?np(e,t):M.IsUnion(t)&&t.anyOf.some(r=>M.IsAny(r)||M.IsUnknown(r))?D.True:M.IsUnion(t)?D.Union:M.IsUnknown(t)||M.IsAny(t)?D.True:D.Union}function Kk(e,t){return M.IsUnknown(e)?D.False:M.IsAny(e)?D.Union:M.IsNever(e)?D.True:D.False}function qk(e,t){return M.IsObject(t)&&op(t)?D.True:Nt(t)?At(e,t):M.IsArray(t)?vn(ze(e.items,t.items)):D.False}function Hk(e,t){return Nt(t)?At(e,t):M.IsAsyncIterator(t)?vn(ze(e.items,t.items)):D.False}function Yk(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsBigInt(t)?D.True:D.False}function q2(e,t){return M.IsLiteralBoolean(e)||M.IsBoolean(e)?D.True:D.False}function Wk(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsBoolean(t)?D.True:D.False}function Xk(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsConstructor(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>vn(ze(t.parameters[n],r))===D.True)?vn(ze(e.returns,t.returns)):D.False:D.False}function Zk(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsDate(t)?D.True:D.False}function Qk(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsFunction(t)?e.parameters.length>t.parameters.length?D.False:e.parameters.every((r,n)=>vn(ze(t.parameters[n],r))===D.True)?vn(ze(e.returns,t.returns)):D.False:D.False}function H2(e,t){return M.IsLiteral(e)&&hr.IsNumber(e.const)||M.IsNumber(e)||M.IsInteger(e)?D.True:D.False}function Jk(e,t){return M.IsInteger(t)||M.IsNumber(t)?D.True:Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):D.False}function np(e,t){return t.allOf.every(r=>ze(e,r)===D.True)?D.True:D.False}function e8(e,t){return e.allOf.some(r=>ze(r,t)===D.True)?D.True:D.False}function t8(e,t){return Nt(t)?At(e,t):M.IsIterator(t)?vn(ze(e.items,t.items)):D.False}function r8(e,t){return M.IsLiteral(t)&&t.const===e.const?D.True:Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsString(t)?Z2(e,t):M.IsNumber(t)?W2(e,t):M.IsInteger(t)?H2(e,t):M.IsBoolean(t)?q2(e,t):D.False}function Y2(e,t){return D.False}function n8(e,t){return D.True}function G2(e){let[t,r]=[e,0];for(;M.IsNot(t);)t=t.not,r+=1;return r%2===0?t:Xn()}function o8(e,t){return M.IsNot(e)?ze(G2(e),t):M.IsNot(t)?ze(e,G2(t)):Xs("Invalid fallthrough for Not")}function i8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsNull(t)?D.True:D.False}function W2(e,t){return M.IsLiteralNumber(e)||M.IsNumber(e)||M.IsInteger(e)?D.True:D.False}function a8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsInteger(t)||M.IsNumber(t)?D.True:D.False}function jr(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function B2(e){return op(e)}function z2(e){return jr(e,0)||jr(e,1)&&"description"in e.properties&&M.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(M.IsString(e.properties.description.anyOf[0])&&M.IsUndefined(e.properties.description.anyOf[1])||M.IsString(e.properties.description.anyOf[1])&&M.IsUndefined(e.properties.description.anyOf[0]))}function Zg(e){return jr(e,0)}function K2(e){return jr(e,0)}function s8(e){return jr(e,0)}function c8(e){return jr(e,0)}function f8(e){return op(e)}function u8(e){let t=xn();return jr(e,0)||jr(e,1)&&"length"in e.properties&&vn(ze(e.properties.length,t))===D.True}function l8(e){return jr(e,0)}function op(e){let t=xn();return jr(e,0)||jr(e,1)&&"length"in e.properties&&vn(ze(e.properties.length,t))===D.True}function p8(e){let t=bo([qi()],qi());return jr(e,0)||jr(e,1)&&"then"in e.properties&&vn(ze(e.properties.then,t))===D.True}function X2(e,t){return ze(e,t)===D.False||M.IsOptional(e)&&!M.IsOptional(t)?D.False:D.True}function br(e,t){return M.IsUnknown(e)?D.False:M.IsAny(e)?D.Union:M.IsNever(e)||M.IsLiteralString(e)&&B2(t)||M.IsLiteralNumber(e)&&Zg(t)||M.IsLiteralBoolean(e)&&K2(t)||M.IsSymbol(e)&&z2(t)||M.IsBigInt(e)&&s8(t)||M.IsString(e)&&B2(t)||M.IsSymbol(e)&&z2(t)||M.IsNumber(e)&&Zg(t)||M.IsInteger(e)&&Zg(t)||M.IsBoolean(e)&&K2(t)||M.IsUint8Array(e)&&f8(t)||M.IsDate(e)&&c8(t)||M.IsConstructor(e)&&l8(t)||M.IsFunction(e)&&u8(t)?D.True:M.IsRecord(e)&&M.IsString(Jg(e))?t[bn]==="Record"?D.True:D.False:M.IsRecord(e)&&M.IsNumber(Jg(e))?jr(t,0)?D.True:D.False:D.False}function m8(e,t){return Nt(t)?At(e,t):M.IsRecord(t)?In(e,t):M.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!M.IsOptional(t.properties[r]))return D.False;if(M.IsOptional(t.properties[r]))return D.True;if(X2(e.properties[r],t.properties[r])===D.False)return D.False}return D.True})():D.False}function d8(e,t){return Nt(t)?At(e,t):M.IsObject(t)&&p8(t)?D.True:M.IsPromise(t)?vn(ze(e.item,t.item)):D.False}function Jg(e){return Bi in e.patternProperties?xn():zi in e.patternProperties?Mr():Xs("Unknown record key pattern")}function ey(e){return Bi in e.patternProperties?e.patternProperties[Bi]:zi in e.patternProperties?e.patternProperties[zi]:Xs("Unable to get record value schema")}function In(e,t){let[r,n]=[Jg(t),ey(t)];return M.IsLiteralString(e)&&M.IsNumber(r)&&vn(ze(e,n))===D.True?D.True:M.IsUint8Array(e)&&M.IsNumber(r)||M.IsString(e)&&M.IsNumber(r)||M.IsArray(e)&&M.IsNumber(r)?ze(e,n):M.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(X2(n,e.properties[o])===D.False)return D.False;return D.True})():D.False}function h8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?ze(ey(e),ey(t)):D.False}function g8(e,t){let r=M.IsRegExp(e)?Mr():e,n=M.IsRegExp(t)?Mr():t;return ze(r,n)}function Z2(e,t){return M.IsLiteral(e)&&hr.IsString(e.const)||M.IsString(e)?D.True:D.False}function y8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsString(t)?D.True:D.False}function b8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsSymbol(t)?D.True:D.False}function x8(e,t){return M.IsTemplateLiteral(e)?ze(Va(e),t):M.IsTemplateLiteral(t)?ze(e,Va(t)):Xs("Invalid fallthrough for TemplateLiteral")}function w8(e,t){return M.IsArray(t)&&e.items!==void 0&&e.items.every(r=>ze(r,t.items)===D.True)}function S8(e,t){return M.IsNever(e)?D.True:M.IsUnknown(e)?D.False:M.IsAny(e)?D.Union:D.False}function v8(e,t){return Nt(t)?At(e,t):M.IsObject(t)&&op(t)||M.IsArray(t)&&w8(e,t)?D.True:M.IsTuple(t)?hr.IsUndefined(e.items)&&!hr.IsUndefined(t.items)||!hr.IsUndefined(e.items)&&hr.IsUndefined(t.items)?D.False:hr.IsUndefined(e.items)&&!hr.IsUndefined(t.items)||e.items.every((r,n)=>ze(r,t.items[n])===D.True)?D.True:D.False:D.False}function I8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsUint8Array(t)?D.True:D.False}function _8(e,t){return Nt(t)?At(e,t):M.IsObject(t)?br(e,t):M.IsRecord(t)?In(e,t):M.IsVoid(t)?M8(e,t):M.IsUndefined(t)?D.True:D.False}function ry(e,t){return t.anyOf.some(r=>ze(e,r)===D.True)?D.True:D.False}function P8(e,t){return e.anyOf.every(r=>ze(r,t)===D.True)?D.True:D.False}function Q2(e,t){return D.True}function T8(e,t){return M.IsNever(t)?Y2(e,t):M.IsIntersect(t)?np(e,t):M.IsUnion(t)?ry(e,t):M.IsAny(t)?ty(e,t):M.IsString(t)?Z2(e,t):M.IsNumber(t)?W2(e,t):M.IsInteger(t)?H2(e,t):M.IsBoolean(t)?q2(e,t):M.IsArray(t)?Kk(e,t):M.IsTuple(t)?S8(e,t):M.IsObject(t)?br(e,t):M.IsUnknown(t)?D.True:D.False}function M8(e,t){return M.IsUndefined(e)||M.IsUndefined(e)?D.True:D.False}function C8(e,t){return M.IsIntersect(t)?np(e,t):M.IsUnion(t)?ry(e,t):M.IsUnknown(t)?Q2(e,t):M.IsAny(t)?ty(e,t):M.IsObject(t)?br(e,t):M.IsVoid(t)?D.True:D.False}function ze(e,t){return M.IsTemplateLiteral(e)||M.IsTemplateLiteral(t)?x8(e,t):M.IsRegExp(e)||M.IsRegExp(t)?g8(e,t):M.IsNot(e)||M.IsNot(t)?o8(e,t):M.IsAny(e)?zk(e,t):M.IsArray(e)?qk(e,t):M.IsBigInt(e)?Yk(e,t):M.IsBoolean(e)?Wk(e,t):M.IsAsyncIterator(e)?Hk(e,t):M.IsConstructor(e)?Xk(e,t):M.IsDate(e)?Zk(e,t):M.IsFunction(e)?Qk(e,t):M.IsInteger(e)?Jk(e,t):M.IsIntersect(e)?e8(e,t):M.IsIterator(e)?t8(e,t):M.IsLiteral(e)?r8(e,t):M.IsNever(e)?n8(e,t):M.IsNull(e)?i8(e,t):M.IsNumber(e)?a8(e,t):M.IsObject(e)?m8(e,t):M.IsRecord(e)?h8(e,t):M.IsString(e)?y8(e,t):M.IsSymbol(e)?b8(e,t):M.IsTuple(e)?v8(e,t):M.IsPromise(e)?d8(e,t):M.IsUint8Array(e)?I8(e,t):M.IsUndefined(e)?_8(e,t):M.IsUnion(e)?P8(e,t):M.IsUnknown(e)?T8(e,t):M.IsVoid(e)?C8(e,t):Xs(`Unknown left type operand '${e[$]}'`)}function Yi(e,t){return ze(e,t)}function O8(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=Zs(e[a],t,r,n,ot(o));return i}function k8(e,t,r,n,o){return O8(e.properties,t,r,n,o)}function J2(e,t,r,n,o){let i=k8(e,t,r,n,o);return Re(i)}function R8(e,t,r,n){let o=Yi(e,t);return o===D.Union?Fe([r,n]):o===D.True?r:n}function Zs(e,t,r,n,o){return ct(e)?J2(e,t,r,n,o):en(e)?F(eS(e,t,r,n,o)):F(R8(e,t,r,n),o)}function N8(e,t,r,n,o){return{[e]:Zs(Oe(e),t,r,n,ot(o))}}function A8(e,t,r,n,o){return e.reduce((i,a)=>({...i,...N8(a,t,r,n,o)}),{})}function E8(e,t,r,n,o){return A8(e.keys,t,r,n,o)}function eS(e,t,r,n,o){let i=E8(e,t,r,n,o);return Re(i)}function F8(e){return e.allOf.every(t=>ja(t))}function $8(e){return e.anyOf.some(t=>ja(t))}function D8(e){return!ja(e.not)}function ja(e){return e[$]==="Intersect"?F8(e):e[$]==="Union"?$8(e):e[$]==="Not"?D8(e):e[$]==="Undefined"}function tS(e,t){return Qs(Va(e),t)}function L8(e,t){let r=e.filter(n=>Yi(n,t)===D.False);return r.length===1?r[0]:Fe(r)}function Qs(e,t,r={}){return tn(e)?F(tS(e,t),r):ct(e)?F(rS(e,t),r):F(ke(e)?L8(e.anyOf,t):Yi(e,t)!==D.False?Se():e,r)}function V8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Qs(e[n],t);return r}function j8(e,t){return V8(e.properties,t)}function rS(e,t){let r=j8(e,t);return Re(r)}function nS(e,t){return Js(Va(e),t)}function U8(e,t){let r=e.filter(n=>Yi(n,t)!==D.False);return r.length===1?r[0]:Fe(r)}function Js(e,t,r){return tn(e)?F(nS(e,t),r):ct(e)?F(oS(e,t),r):F(ke(e)?U8(e.anyOf,t):Yi(e,t)!==D.False?e:Se(),r)}function G8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Js(e[n],t);return r}function B8(e,t){return G8(e.properties,t)}function oS(e,t){let r=B8(e,t);return Re(r)}function iS(e,t){return Kn(e)?F(e.returns,t):Se(t)}function ip(e){return Lr(gr(e))}function Ua(e,t,r){return F({[$]:"Record",type:"object",patternProperties:{[e]:t}},r)}function ny(e,t,r){let n={};for(let o of e)n[o]=t;return $e(n,{...r,[bn]:"Record"})}function z8(e,t,r){return Kl(e)?ny(Dr(e),t,r):Ua(e.pattern,t,r)}function K8(e,t,r){return ny(Dr(Fe(e)),t,r)}function q8(e,t,r){return ny([e.toString()],t,r)}function H8(e,t,r){return Ua(e.source,t,r)}function Y8(e,t,r){let n=Mt(e.pattern)?zi:e.pattern;return Ua(n,t,r)}function W8(e,t,r){return Ua(zi,t,r)}function X8(e,t,r){return Ua(d2,t,r)}function Z8(e,t,r){return $e({true:t,false:t},r)}function Q8(e,t,r){return Ua(Bi,t,r)}function J8(e,t,r){return Ua(Bi,t,r)}function ap(e,t,r={}){return ke(e)?K8(e.anyOf,t,r):tn(e)?z8(e,t,r):Jr(e)?q8(e.const,t,r):ti(e)?Z8(e,t,r):Hn(e)?Q8(e,t,r):Yn(e)?J8(e,t,r):$g(e)?H8(e,t,r):ri(e)?Y8(e,t,r):Eg(e)?W8(e,t,r):Ui(e)?X8(e,t,r):Se(r)}function sp(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function aS(e){let t=sp(e);return t===zi?Mr():t===Bi?xn():Mr({pattern:t})}function cp(e){return e.patternProperties[sp(e)]}function e3(e,t){return t.parameters=Df(e,t.parameters),t.returns=Zn(e,t.returns),t}function t3(e,t){return t.parameters=Df(e,t.parameters),t.returns=Zn(e,t.returns),t}function r3(e,t){return t.allOf=Df(e,t.allOf),t}function n3(e,t){return t.anyOf=Df(e,t.anyOf),t}function o3(e,t){return Mt(t.items)||(t.items=Df(e,t.items)),t}function i3(e,t){return t.items=Zn(e,t.items),t}function a3(e,t){return t.items=Zn(e,t.items),t}function s3(e,t){return t.items=Zn(e,t.items),t}function c3(e,t){return t.item=Zn(e,t.item),t}function f3(e,t){let r=m3(e,t.properties);return{...t,...$e(r)}}function u3(e,t){let r=Zn(e,aS(t)),n=Zn(e,cp(t)),o=ap(r,n);return{...t,...o}}function l3(e,t){return t.index in e?e[t.index]:Xn()}function p3(e,t){let r=$s(t),n=$r(t),o=Zn(e,t);return r&&n?ip(o):r&&!n?Lr(o):!r&&n?gr(o):o}function m3(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:p3(e,t[n])}),{})}function Df(e,t){return t.map(r=>Zn(e,r))}function Zn(e,t){return Kn(t)?e3(e,t):qn(t)?t3(e,t):gt(t)?r3(e,t):ke(t)?n3(e,t):rn(t)?o3(e,t):Bn(t)?i3(e,t):Aa(t)?a3(e,t):Fa(t)?s3(e,t):$a(t)?c3(e,t):Ct(t)?f3(e,t):Da(t)?u3(e,t):Fg(t)?l3(e,t):t}function sS(e,t){return Zn(t,Es(e))}function cS(e){return F({[$]:"Integer",type:"integer"},e)}function d3(e,t,r){return{[e]:Qn(Oe(e),t,ot(r))}}function h3(e,t,r){return e.reduce((o,i)=>({...o,...d3(i,t,r)}),{})}function g3(e,t,r){return h3(e.keys,t,r)}function fS(e,t,r){let n=g3(e,t,r);return Re(n)}function y3(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function b3(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function x3(e){return e.toUpperCase()}function w3(e){return e.toLowerCase()}function S3(e,t,r){let n=Bs(e.pattern);if(!La(n))return{...e,pattern:uS(e.pattern,t)};let a=[...Af(n)].map(u=>Oe(u)),s=lS(a,t),c=Fe(s);return Hl([c],r)}function uS(e,t){return typeof e=="string"?t==="Uncapitalize"?y3(e):t==="Capitalize"?b3(e):t==="Uppercase"?x3(e):t==="Lowercase"?w3(e):e:e.toString()}function lS(e,t){return e.map(r=>Qn(r,t))}function Qn(e,t,r={}){return en(e)?fS(e,t,r):tn(e)?S3(e,t,r):ke(e)?Fe(lS(e.anyOf,t),r):Jr(e)?Oe(uS(e.const,t),r):F(e,r)}function pS(e,t={}){return Qn(e,"Capitalize",t)}function mS(e,t={}){return Qn(e,"Lowercase",t)}function dS(e,t={}){return Qn(e,"Uncapitalize",t)}function hS(e,t={}){return Qn(e,"Uppercase",t)}function v3(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Wi(e[o],t,ot(r));return n}function I3(e,t,r){return v3(e.properties,t,r)}function gS(e,t,r){let n=I3(e,t,r);return Re(n)}function _3(e,t){return e.map(r=>oy(r,t))}function P3(e,t){return e.map(r=>oy(r,t))}function T3(e,t){let{[t]:r,...n}=e;return n}function M3(e,t){return t.reduce((r,n)=>T3(r,n),e)}function C3(e,t,r){let n=yt(e,[ut,"$id","required","properties"]),o=M3(r,t);return $e(o,n)}function O3(e){let t=e.reduce((r,n)=>Gl(n)?[...r,Oe(n)]:r,[]);return Fe(t)}function oy(e,t){return gt(e)?yr(_3(e.allOf,t)):ke(e)?Fe(P3(e.anyOf,t)):Ct(e)?C3(e,t,e.properties):$e({})}function Wi(e,t,r){let n=Tt(t)?O3(t):t,o=lt(t)?Dr(t):t,i=wt(e),a=wt(t);return ct(e)?gS(e,o,r):en(t)?yS(e,t,r):i&&a?Je("Omit",[e,n],r):!i&&a?Je("Omit",[e,n],r):i&&!a?Je("Omit",[e,n],r):F({...oy(e,o),...r})}function k3(e,t,r){return{[t]:Wi(e,[t],ot(r))}}function R3(e,t,r){return t.reduce((n,o)=>({...n,...k3(e,o,r)}),{})}function N3(e,t,r){return R3(e,t.keys,r)}function yS(e,t,r){let n=N3(e,t,r);return Re(n)}function A3(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=Xi(e[o],t,ot(r));return n}function E3(e,t,r){return A3(e.properties,t,r)}function bS(e,t,r){let n=E3(e,t,r);return Re(n)}function F3(e,t){return e.map(r=>iy(r,t))}function $3(e,t){return e.map(r=>iy(r,t))}function D3(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function L3(e,t,r){let n=yt(e,[ut,"$id","required","properties"]),o=D3(r,t);return $e(o,n)}function V3(e){let t=e.reduce((r,n)=>Gl(n)?[...r,Oe(n)]:r,[]);return Fe(t)}function iy(e,t){return gt(e)?yr(F3(e.allOf,t)):ke(e)?Fe($3(e.anyOf,t)):Ct(e)?L3(e,t,e.properties):$e({})}function Xi(e,t,r){let n=Tt(t)?V3(t):t,o=lt(t)?Dr(t):t,i=wt(e),a=wt(t);return ct(e)?bS(e,o,r):en(t)?xS(e,t,r):i&&a?Je("Pick",[e,n],r):!i&&a?Je("Pick",[e,n],r):i&&!a?Je("Pick",[e,n],r):F({...iy(e,o),...r})}function j3(e,t,r){return{[t]:Xi(e,[t],ot(r))}}function U3(e,t,r){return t.reduce((n,o)=>({...n,...j3(e,o,r)}),{})}function G3(e,t,r){return U3(e,t.keys,r)}function xS(e,t,r){let n=G3(e,t,r);return Re(n)}function B3(e,t){return Je("Partial",[Je(e,t)])}function z3(e){return Je("Partial",[wo(e)])}function K3(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=gr(e[r]);return t}function q3(e,t){let r=yt(e,[ut,"$id","required","properties"]),n=K3(t);return $e(n,r)}function wS(e){return e.map(t=>SS(t))}function SS(e){return zn(e)?B3(e.target,e.parameters):wt(e)?z3(e.$ref):gt(e)?yr(wS(e.allOf)):ke(e)?Fe(wS(e.anyOf)):Ct(e)?q3(e,e.properties):Ea(e)||ti(e)||Hn(e)||Jr(e)||Tf(e)||Yn(e)||ri(e)||Mf(e)||ni(e)?e:$e({})}function ec(e,t){return ct(e)?vS(e,t):F({...SS(e),...t})}function H3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=ec(e[n],ot(t));return r}function Y3(e,t){return H3(e.properties,t)}function vS(e,t){let r=Y3(e,t);return Re(r)}function W3(e,t){return Je("Required",[Je(e,t)])}function X3(e){return Je("Required",[wo(e)])}function Z3(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=yt(e[r],[sr]);return t}function Q3(e,t){let r=yt(e,[ut,"$id","required","properties"]),n=Z3(t);return $e(n,r)}function IS(e){return e.map(t=>_S(t))}function _S(e){return zn(e)?W3(e.target,e.parameters):wt(e)?X3(e.$ref):gt(e)?yr(IS(e.allOf)):ke(e)?Fe(IS(e.anyOf)):Ct(e)?Q3(e,e.properties):Ea(e)||ti(e)||Hn(e)||Jr(e)||Tf(e)||Yn(e)||ri(e)||Mf(e)||ni(e)?e:$e({})}function tc(e,t){return ct(e)?PS(e,t):F({..._S(e),...t})}function J3(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=tc(e[n],t);return r}function eR(e,t){return J3(e.properties,t)}function PS(e,t){let r=eR(e,t);return Re(r)}function tR(e,t){return t.map(r=>wt(r)?ay(e,r.$ref):nn(e,r))}function ay(e,t){return t in e?wt(e[t])?ay(e,e[t].$ref):nn(e,e[t]):Se()}function rR(e){return Hs(e[0])}function nR(e){return Hi(e[0],e[1])}function oR(e){return Ws(e[0])}function iR(e){return ec(e[0])}function aR(e){return Wi(e[0],e[1])}function sR(e){return Xi(e[0],e[1])}function cR(e){return tc(e[0])}function fR(e,t,r){let n=tR(e,r);return t==="Awaited"?rR(n):t==="Index"?nR(n):t==="KeyOf"?oR(n):t==="Partial"?iR(n):t==="Omit"?aR(n):t==="Pick"?sR(n):t==="Required"?cR(n):Se()}function uR(e,t){return Vs(nn(e,t))}function lR(e,t){return js(nn(e,t))}function pR(e,t,r){return Us(Lf(e,t),nn(e,r))}function mR(e,t,r){return bo(Lf(e,t),nn(e,r))}function dR(e,t){return yr(Lf(e,t))}function hR(e,t){return qs(nn(e,t))}function gR(e,t){return $e(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:nn(e,t[n])}),{}))}function yR(e,t){let[r,n]=[nn(e,cp(t)),sp(t)],o=Es(t);return o.patternProperties[n]=r,o}function bR(e,t){return wt(t)?{...ay(e,t.$ref),[ut]:t[ut]}:t}function xR(e,t){return wn(Lf(e,t))}function wR(e,t){return Fe(Lf(e,t))}function Lf(e,t){return t.map(r=>nn(e,r))}function nn(e,t){return $r(t)?F(nn(e,yt(t,[sr])),t):$s(t)?F(nn(e,yt(t,[Gn])),t):Ee(t)?F(bR(e,t),t):Bn(t)?F(uR(e,t.items),t):Aa(t)?F(lR(e,t.items),t):zn(t)?F(fR(e,t.target,t.parameters)):Kn(t)?F(pR(e,t.parameters,t.returns),t):qn(t)?F(mR(e,t.parameters,t.returns),t):gt(t)?F(dR(e,t.allOf),t):Fa(t)?F(hR(e,t.items),t):Ct(t)?F(gR(e,t.properties),t):Da(t)?F(yR(e,t)):rn(t)?F(xR(e,t.items||[]),t):ke(t)?F(wR(e,t.anyOf),t):t}function SR(e,t){return t in e?nn(e,e[t]):Se()}function TS(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:SR(e,r)}),{})}var sy=class{constructor(t){let r=TS(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 MS(e){return new sy(e)}function CS(e,t){return F({[$]:"Not",not:e},t)}function OS(e,t){return qn(e)?wn(e.parameters,t):Se()}var vR=0;function kS(e,t={}){Mt(t.$id)&&(t.$id=`T${vR++}`);let r=Es(e({[$]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,F({[bn]:"Recursive",...r},t)}function RS(e,t){let r=Xe(e)?new globalThis.RegExp(e):e;return F({[$]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function IR(e){return gt(e)?e.allOf:ke(e)?e.anyOf:rn(e)?e.items??[]:[]}function NS(e){return IR(e)}function AS(e,t){return qn(e)?F(e.returns,t):Se(t)}var cy=class{constructor(t){this.schema=t}Decode(t){return new fy(this.schema,t)}},fy=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[ut].Encode(t(a)),Decode:a=>this.decode(r[ut].Decode(a))};return{...r,[ut]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[ut]:n}}Encode(t){return Ee(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function ES(e){return new cy(e)}function FS(e={}){return F({[$]:e[$]??"Unsafe"},e)}function $S(e){return F({[$]:"Void",type:"void"},e)}var uy={};Ra(uy,{Any:()=>qi,Argument:()=>x2,Array:()=>Vs,AsyncIterator:()=>js,Awaited:()=>Hs,BigInt:()=>Ks,Boolean:()=>ql,Capitalize:()=>pS,Composite:()=>L2,Const:()=>V2,Constructor:()=>Us,ConstructorParameters:()=>j2,Date:()=>Zl,Enum:()=>U2,Exclude:()=>Qs,Extends:()=>Zs,Extract:()=>Js,Function:()=>bo,Index:()=>Hi,InstanceType:()=>iS,Instantiate:()=>sS,Integer:()=>cS,Intersect:()=>yr,Iterator:()=>qs,KeyOf:()=>Ws,Literal:()=>Oe,Lowercase:()=>mS,Mapped:()=>N2,Module:()=>MS,Never:()=>Se,Not:()=>CS,Null:()=>Ql,Number:()=>xn,Object:()=>$e,Omit:()=>Wi,Optional:()=>gr,Parameters:()=>OS,Partial:()=>ec,Pick:()=>Xi,Promise:()=>Wl,Readonly:()=>Lr,ReadonlyOptional:()=>ip,Record:()=>ap,Recursive:()=>kS,Ref:()=>wo,RegExp:()=>RS,Required:()=>tc,Rest:()=>NS,ReturnType:()=>AS,String:()=>Mr,Symbol:()=>Jl,TemplateLiteral:()=>Hl,Transform:()=>ES,Tuple:()=>wn,Uint8Array:()=>tp,Uncapitalize:()=>dS,Undefined:()=>ep,Union:()=>Fe,Unknown:()=>Xn,Unsafe:()=>FS,Uppercase:()=>hS,Void:()=>$S});var d=uy;var Jn=d.Object({label:d.String(),domain:d.Optional(d.Tuple([d.Number(),d.Number()]))}),Vf=d.Object({type:d.Union([d.Literal("identity"),d.Literal("horizontal"),d.Literal("vertical")]),value:d.Optional(d.Number())}),nJ=d.Object({schemaVersion:d.Literal("1.0"),title:d.Optional(d.String()),xAxis:Jn,yAxis:Jn,references:d.Optional(d.Array(Vf))});var _R=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}))}),PR=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})}),ly=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("calibration"),data:d.Array(_R),distribution:d.Optional(d.Array(PR)),x:d.Literal("predicted"),y:d.Literal("observed"),xAxis:Jn,yAxis:Jn,references:d.Optional(d.Array(Vf))});var TR=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})}),py=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("roc"),data:d.Array(TR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity"),xAxis:Jn,yAxis:Jn,references:d.Optional(d.Array(Vf))});var MR=d.Union([py,ly],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var on=d.Object({id:d.String(),model:d.Optional(d.String()),population:d.String(),label:d.Optional(d.String())}),DS=d.Union([d.Literal("model"),d.Literal("population"),d.Literal("evaluation"),d.Literal("context")]),LS=d.Object({label:d.String(),group:d.String(),role:DS}),rc=d.Object({id:d.String(),evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),display:LS}),CR=d.Object({x:d.Number(),y:d.Number()}),my=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(CR,{minItems:2}),label:d.Optional(d.String())})]),OR=d.Intersect([my,d.Object({scope:d.Literal("global")})]),kR=d.Intersect([my,d.Object({scope:d.Literal("population"),population:d.String()})]),RR=d.Intersect([my,d.Object({scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),VS=d.Union([OR,kR,RR]),Ur=d.Object({schemaVersion:d.Literal("2.0"),title:d.Optional(d.String()),evaluations:d.Array(on),series:d.Array(rc),xAxis:Jn,yAxis:Jn,references:d.Optional(d.Array(VS))}),jf=d.Union([d.Literal("probability_threshold"),d.Literal("ppcr")]),ai=d.Object({operatingPoint:d.Optional(d.Object({dimension:jf}))}),fp=d.Object({operatingPoint:d.Optional(d.Object({dimension:d.Literal("probability_threshold")}))});var jS=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}))}),US=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}))}),GS=d.Union([jS,US]),NR=d.Object({seriesId:d.String(),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),dy=d.Intersect([Ur,d.Object({type:d.Literal("calibration"),data:d.Array(GS),distribution:d.Optional(d.Array(NR)),x:d.Literal("predicted"),y:d.Literal("observed")})]);var hy=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")]),BS=d.Object({id:hy,label:d.String()}),xr=d.Object({metricId:hy,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()]))}),zS=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})})]),KS=d.Object({censoringHeuristic:d.Optional(d.String()),competingEventHeuristic:d.Optional(d.String())}),qS=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),operatingPoint:zS,context:d.Optional(KS),values:d.Array(xr)}),gy=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("performance_table"),title:d.Optional(d.String()),evaluations:d.Array(on),metrics:d.Array(BS),rows:d.Array(qS)});var YS=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),netBenefit:d.Number(),performance:d.Optional(d.Array(xr))}),WS=d.Intersect([on,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),XS=d.Intersect([rc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),ZS=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_none")}),HS={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")},QS=d.Union([d.Object({...HS,scope:d.Literal("population"),population:d.String()}),d.Object({...HS,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),JS=d.Union([ZS,QS]),yy=d.Intersect([Ur,fp,d.Object({type:d.Literal("decision_curve"),evaluations:d.Array(WS,{minItems:1}),series:d.Array(XS,{minItems:1}),data:d.Array(YS),x:d.Literal("threshold"),y:d.Literal("netBenefit"),references:d.Array(JS,{minItems:2})})]);var AR=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),sensitivity:d.Number({minimum:0,maximum:1}),performance:d.Optional(d.Array(xr))}),by=d.Intersect([Ur,ai,d.Object({type:d.Literal("gains"),data:d.Array(AR),x:d.Literal("ppcr"),y:d.Literal("sensitivity")})]);var tv=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),interventionsAvoided:d.Number(),performance:d.Optional(d.Array(xr))}),rv=d.Intersect([on,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),nv=d.Intersect([rc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),ov=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_all")}),ev={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")},iv=d.Union([d.Object({...ev,scope:d.Literal("population"),population:d.String()}),d.Object({...ev,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),av=d.Union([ov,iv]),xy=d.Intersect([Ur,fp,d.Object({type:d.Literal("interventions_avoided"),evaluations:d.Array(rv,{minItems:1}),series:d.Array(nv,{minItems:1}),data:d.Array(tv),x:d.Literal("threshold"),y:d.Literal("interventionsAvoided"),references:d.Array(av,{minItems:2})})]);var ER=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),lift:d.Number(),performance:d.Optional(d.Array(xr))}),wy=d.Intersect([Ur,ai,d.Object({type:d.Literal("lift"),data:d.Array(ER),x:d.Literal("ppcr"),y:d.Literal("lift")})]);var FR=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}),performance:d.Optional(d.Array(xr))}),Sy=d.Intersect([Ur,ai,d.Object({type:d.Literal("precision_recall"),data:d.Array(FR),x:d.Literal("sensitivity"),y:d.Literal("ppv")})]);var sv=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})}),$R=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})}),cv=d.Object({evaluationId:d.String(),type:jf,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(xr))}),Uf=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("prediction_distribution"),title:d.Optional(d.String()),evaluations:d.Array(on,{minItems:1}),operatingPoint:d.Optional(d.Object({dimension:jf})),bins:d.Array(sv,{minItems:1}),rankBins:d.Optional(d.Array($R)),operatingPoints:d.Array(cv,{minItems:1})});var DR=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}),performance:d.Optional(d.Array(xr))}),vy=d.Intersect([Ur,ai,d.Object({type:d.Literal("roc"),data:d.Array(DR),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity")})]);var Iy=d.Union([vy,dy,Sy,by,wy,yy,xy,Uf],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var _y=d.Object({id:d.String(),label:d.String()}),Py=d.Object({metric:d.Literal("auroc"),owner:d.Object({type:d.Literal("evaluation"),evaluationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),Ty=d.Object({metric:d.Literal("prevalence"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),LR=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()])}),VR=d.Union([Py,Ty]),fv=d.Union([Py,Ty,LR]),jR=fv,UR=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(on),populations:d.Array(_y),metrics:d.Array(VR)}),GR=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(on),populations:d.Array(_y),metrics:d.Array(fv)}),My=d.Union([UR,GR],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var Cy=d.Union([Iy,gy,My,Uf]),uv=d.Object({id:d.String(),title:d.Optional(d.String()),spec:Cy}),up=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("report"),title:d.Optional(d.String()),components:d.Array(uv,{minItems:1})}),Oy=d.Object({type:d.Literal("component"),id:d.String(),title:d.Optional(d.String()),spec:Cy}),lv=d.Object({type:d.Literal("group"),id:d.String(),title:d.String(),components:d.Array(Oy,{minItems:1})}),pv=d.Object({id:d.String(),title:d.String(),items:d.Array(d.Union([Oy,lv]),{minItems:1})}),lp=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("report"),title:d.Optional(d.String()),sections:d.Array(pv,{minItems:1})}),BR=d.Union([up,lp],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function pp(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 ky(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 Gf(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 p=1;p1||!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 ${p} for evaluation ${i} must be (lower, upper]`);if(l.lower>=l.upper)throw new Error(`bin ${p} for evaluation ${i} must be nondegenerate`);if(l.lower!==a[p-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 p of s)if(p.type==="probability_threshold"){if(p.cutoff!==0&&!u.has(p.cutoff))throw new Error(`operating point cutoff ${p.cutoff} for evaluation ${i} does not match any bin upper boundary`);let l=0;if(p.cutoff===0)l=f;else for(let h of a)h.upper>p.cutoff&&(l+=h.nPositive+h.nNegative);let m=l/f;if(Math.abs(p.realizedPpcr-m)>1e-6)throw new Error(`operating point realizedPpcr ${p.realizedPpcr} for evaluation ${i} does not match reconstructed count fraction ${m}`)}}}function Ry(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 si(e){if(e.type==="prediction_distribution"){Gf(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,b)=>{let y=`evaluation-${b+1}`;if(h.id!==y)throw new Error(`decision curve evaluation ids must be ordinal: expected ${y}`)});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,b)=>{if(h.id!==`series-${b+1}`)throw new Error(`decision curve series ids must be ordinal: expected series-${b+1}`);let y=o.evaluations.find(w=>w.id===h.evaluationId),x=y.model??y.population,g=y.model===void 0?"population":"model";if(h.display.label!==x||h.display.group!==x||h.display.role!==g)throw new Error("decision curve display must follow evaluation semantics");let S=`${h.evaluationId}\0${h.horizon??"static"}`;if(u.has(S))throw new Error(`duplicate decision curve evaluation-horizon series: ${h.evaluationId}`);u.add(S)}),s){if(!o.evaluations.every(b=>c.every(y=>u.has(`${b.id}\0${y}`)))||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 p=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_all"),l=new Set;for(let h of p){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 b=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(b))throw new Error(`duplicate Treat All owner: ${h.population}`);l.add(b)}let m=s?[...n].flatMap(h=>c.map(b=>`${h}\0${b}`)):[...n];if(l.size!==m.length||m.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,b)=>{let y=`evaluation-${b+1}`;if(h.id!==y)throw new Error(`interventions avoided evaluation ids must be ordinal: expected ${y}`)});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,b)=>{if(h.id!==`series-${b+1}`)throw new Error(`interventions avoided series ids must be ordinal: expected series-${b+1}`);let y=o.evaluations.find(w=>w.id===h.evaluationId);if(!y)throw new Error(`unknown evaluation id: ${h.evaluationId}`);let x=y.model??y.population,g=y.model===void 0?"population":"model";if(h.display.label!==x||h.display.group!==x||h.display.role!==g)throw new Error("interventions avoided display must follow evaluation semantics");let S=`${h.evaluationId}\0${h.horizon??"static"}`;if(u.has(S))throw new Error(`duplicate interventions avoided evaluation-horizon series: ${h.evaluationId}`);u.add(S)}),s){if(!o.evaluations.every(b=>c.every(y=>u.has(`${b.id}\0${y}`)))||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 p=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_none"),l=new Set;for(let h of p){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 b=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(b))throw new Error(`duplicate Treat None owner: ${h.population}`);l.add(b)}let m=s?[...n].flatMap(h=>c.map(b=>`${h}\0${b}`)):[...n];if(l.size!==m.length||m.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 mv(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 zR(e){return mv(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function KR(e){return mv(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function qR(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 HR(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 Ny(e,t){return[...new Set(e)].map(n=>HR(n,t))}function YR(e,t="population"){let r=Ny(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 WR(e,t){let r=Ny(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 XR(e,t,r,n){let o=Ny(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 bt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function _n(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function ci(e){let t,r,n;e.length!==2?(t=bt,r=(s,c)=>bt(e(s),c),n=(s,c)=>e(s)-c):(t=e===bt||e===_n?e:ZR,r=e,n=e);function o(s,c,u=0,f=s.length){if(u>>1;r(s[p],c)<0?u=p+1:f=p}while(u>>1;r(s[p],c)<=0?u=p+1:f=p}while(uu&&n(s[p-1],c)>-n(s[p],c)?p-1:p}return{left:o,center:a,right:i}}function ZR(){return 0}function Bf(e){return e===null?NaN:+e}function*dv(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 hv=ci(bt),gv=hv.right,QR=hv.left,JR=ci(Bf).center,Ga=gv;function eN(e){return e.length|0}function tN(e){return!(e>0)}function rN(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function nN(e){return t=>e(...t)}function mp(...e){let t=typeof e[e.length-1]=="function"&&nN(e.pop());e=e.map(rN);let r=e.map(eN),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some(tN))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 dp(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 nc(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 hp(e,t){let r=nc(e,t);return r&&Math.sqrt(r)}function Gr(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 Cr=class extends Map{constructor(t,r=xv){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(Ay(this,t))}has(t){return super.has(Ay(this,t))}set(t,r){return super.set(yv(this,t),r)}delete(t){return super.delete(bv(this,t))}},eo=class extends Set{constructor(t,r=xv){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(Ay(this,t))}add(t){return super.add(yv(this,t))}delete(t){return super.delete(bv(this,t))}};function Ay({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function yv({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function bv({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function xv(e){return e!==null&&typeof e=="object"?e.valueOf():e}function zf(e){return e}function fi(e,...t){return Fy(e,zf,zf,t)}function So(e,t,...r){return Fy(e,zf,t,r)}function Ey(e,t,...r){return Fy(e,Array.from,t,r)}function Fy(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new Cr,c=n[a++],u=-1;for(let f of i){let p=c(f,++u,i),l=s.get(p);l?l.push(f):s.set(p,[f])}for(let[f,p]of s)s.set(f,o(p,a));return t(s)})(e,0)}function $y(e,t){return Array.from(t,r=>e[r])}function Zi(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=Kf(a[o],a[i]);if(s)return s}})):(r=e.map(r),n.sort((o,i)=>Kf(r[o],r[i]))),$y(e,n)}return e.sort(Dy(r))}function Dy(e=bt){if(e===bt)return Kf;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 Kf(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function oc(e,t,r){return(t.length!==2?Zi(So(e,t,r),(([n,o],[i,a])=>bt(o,a)||bt(n,i))):Zi(fi(e,r),(([n,o],[i,a])=>t(o,a)||bt(n,i)))).map(([n])=>n)}var oN=Math.sqrt(50),iN=Math.sqrt(10),aN=Math.sqrt(2);function gp(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>=oN?10:i>=iN?5:i>=aN?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 yp(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 Or(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 bp(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 xp(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?Kf:Dy(o);n>r;){if(n-r>600){let c=n-r+1,u=t-r+1,f=Math.log(c),p=.5*Math.exp(2*f/3),l=.5*Math.sqrt(f*p*(c-p)/c)*(u-c/2<0?-1:1),m=Math.max(r,Math.floor(t-u*p/c+l)),h=Math.min(n,Math.floor(t+(c-u)*p/c+l));xp(e,t,m,h,o)}let i=e[t],a=r,s=n;for(Hf(e,r,t),o(e[n],i)>0&&Hf(e,r,n);a0;)--s}o(e[r],i)===0?Hf(e,r,s):(++s,Hf(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function Hf(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Yf(e,t=bt){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?bt(a,o)>0:bt(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 li(e,t,r){if(e=Float64Array.from(dv(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Or(e);if(t>=1)return Kt(e);var n,o=(n-1)*t,i=Math.floor(o),a=Kt(xp(e,i).subarray(0,i+1)),s=Or(e.subarray(i+1));return a+(s-a)*(o-i)}}function Ly(e,t,r=Bf){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 wp(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 Ba(e,t){return li(e,.5,t)}function*cN(e){for(let t of e)yield*t}function ac(e){return Array.from(cN(e))}function Sp(e,t){let r=new Cr;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 vp(e,t=fN){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function fN(e,t){return[e,t]}function za(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 mN(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function dN(){return!this.__axis}function hN(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===Vy||e===Ip?-1:1,f=e===Ip||e===jy?"x":"y",p=e===Vy||e===Uy?uN:lN;function l(m){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),b=o??(t.tickFormat?t.tickFormat.apply(t,r):wv),y=Math.max(i,0)+s,x=t.range(),g=+x[0]+c,S=+x[x.length-1]+c,w=(t.bandwidth?mN:pN)(t.copy(),c),_=m.selection?m.selection():m,v=_.selectAll(".domain").data([null]),I=_.selectAll(".tick").data(h,t).order(),T=I.exit(),P=I.enter().append("g").attr("class","tick"),R=I.select("line"),k=I.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(P),R=R.merge(P.append("line").attr("stroke","currentColor").attr(f+"2",u*i)),k=k.merge(P.append("text").attr("fill","currentColor").attr(f,u*y).attr("dy",e===Vy?"0em":e===Uy?"0.71em":"0.32em")),m!==_&&(v=v.transition(m),I=I.transition(m),R=R.transition(m),k=k.transition(m),T=T.transition(m).attr("opacity",Sv).attr("transform",function(N){return isFinite(N=w(N))?p(N+c):this.getAttribute("transform")}),P.attr("opacity",Sv).attr("transform",function(N){var B=this.parentNode.__axis;return p((B&&isFinite(B=B(N))?B:w(N))+c)})),T.remove(),v.attr("d",e===Ip||e===jy?a?"M"+u*a+","+g+"H"+c+"V"+S+"H"+u*a:"M"+c+","+g+"V"+S:a?"M"+g+","+u*a+"V"+c+"H"+S+"V"+u*a:"M"+g+","+c+"H"+S),I.attr("opacity",1).attr("transform",function(N){return p(w(N)+c)}),R.attr(f+"2",u*i),k.attr(f,u*y).text(b),_.filter(dN).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===jy?"start":e===Ip?"end":"middle"),_.each(function(){this.__axis=w})}return l.scale=function(m){return arguments.length?(t=m,l):t},l.ticks=function(){return r=Array.from(arguments),l},l.tickArguments=function(m){return arguments.length?(r=m==null?[]:Array.from(m),l):r.slice()},l.tickValues=function(m){return arguments.length?(n=m==null?null:Array.from(m),l):n&&n.slice()},l.tickFormat=function(m){return arguments.length?(o=m,l):o},l.tickSize=function(m){return arguments.length?(i=a=+m,l):i},l.tickSizeInner=function(m){return arguments.length?(i=+m,l):i},l.tickSizeOuter=function(m){return arguments.length?(a=+m,l):a},l.tickPadding=function(m){return arguments.length?(s=+m,l):s},l.offset=function(m){return arguments.length?(c=+m,l):c},l}function Gy(e){return hN(Uy,e)}var gN={value:()=>{}};function Iv(){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}})}_p.prototype=Iv.prototype={constructor:_p,on:function(e,t){var r=this._,n=yN(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)),vo.hasOwnProperty(t)?{space:vo[t],local:e}:e}function xN(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Pp&&t.documentElement.namespaceURI===Pp?t.createElement(e):t.createElementNS(r,e)}}function wN(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mi(e){var t=pi(e);return(t.local?wN:xN)(t)}function SN(){}function Ka(e){return e==null?SN:function(){return this.querySelector(e)}}function _v(e){typeof e!="function"&&(e=Ka(e));for(var t=this._groups,r=t.length,n=new Array(r),o=0;o=S&&(S=g+1);!(_=y[S])&&++S=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function $v(e){e||(e=EN);function t(p,l){return p&&l?e(p.__data__,l.__data__):!p-!l}for(var r=this._groups,n=r.length,o=new Array(n),i=0;it?1:e>=t?0:NaN}function Dv(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Lv(){return Array.from(this)}function Vv(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?UN:typeof t=="function"?BN:GN)(e,t,r??"")):Ji(this.node(),e)}function Ji(e,t){return e.style.getPropertyValue(t)||Cp(e).getComputedStyle(e,null).getPropertyValue(t)}function zN(e){return function(){delete this[e]}}function KN(e,t){return function(){this[e]=t}}function qN(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Kv(e,t){return arguments.length>1?this.each((t==null?zN:typeof t=="function"?qN:KN)(e,t)):this.node()[e]}function qv(e){return e.trim().split(/^|\s+/)}function Ky(e){return e.classList||new Hv(e)}function Hv(e){this._node=e,this._names=qv(e.getAttribute("class")||"")}Hv.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 Yv(e,t){for(var r=Ky(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function uA(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?Op(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Op(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=gA.exec(e))?new Et(t[1],t[2],t[3],1):(t=yA.exec(e))?new Et(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=bA.exec(e))?Op(t[1],t[2],t[3],t[4]):(t=xA.exec(e))?Op(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wA.exec(e))?bI(t[1],t[2]/100,t[3]/100,1):(t=SA.exec(e))?bI(t[1],t[2]/100,t[3]/100,t[4]):pI.hasOwnProperty(e)?hI(pI[e]):e==="transparent"?new Et(NaN,NaN,NaN,0):null}function hI(e){return new Et(e>>16&255,e>>8&255,e&255,1)}function Op(e,t,r,n){return n<=0&&(e=t=r=NaN),new Et(e,t,r,n)}function Jf(e){return e instanceof _o||(e=sn(e)),e?(e=e.rgb(),new Et(e.r,e.g,e.b,e.opacity)):new Et}function Tn(e,t,r,n){return arguments.length===1?Jf(e):new Et(e,t,r,n??1)}function Et(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}hi(Et,Tn,ta(_o,{brighter(e){return e=e==null?Ya:Math.pow(Ya,e),new Et(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ra:Math.pow(ra,e),new Et(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Et(Ha(this.r),Ha(this.g),Ha(this.b),Rp(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:gI,formatHex:gI,formatHex8:_A,formatRgb:yI,toString:yI}));function gI(){return`#${qa(this.r)}${qa(this.g)}${qa(this.b)}`}function _A(){return`#${qa(this.r)}${qa(this.g)}${qa(this.b)}${qa((isNaN(this.opacity)?1:this.opacity)*255)}`}function yI(){let e=Rp(this.opacity);return`${e===1?"rgb(":"rgba("}${Ha(this.r)}, ${Ha(this.g)}, ${Ha(this.b)}${e===1?")":`, ${e})`}`}function Rp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ha(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qa(e){return e=Ha(e),(e<16?"0":"")+e.toString(16)}function bI(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new to(e,t,r,n)}function wI(e){if(e instanceof to)return new to(e.h,e.s,e.l,e.opacity);if(e instanceof _o||(e=sn(e)),!e)return new to;if(e instanceof to)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 to(a,s,c,e.opacity)}function eu(e,t,r,n){return arguments.length===1?wI(e):new to(e,t,r,n??1)}function to(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}hi(to,eu,ta(_o,{brighter(e){return e=e==null?Ya:Math.pow(Ya,e),new to(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ra:Math.pow(ra,e),new to(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 Et(Hy(e>=240?e-240:e+120,o,n),Hy(e,o,n),Hy(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new to(xI(this.h),kp(this.s),kp(this.l),Rp(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=Rp(this.opacity);return`${e===1?"hsl(":"hsla("}${xI(this.h)}, ${kp(this.s)*100}%, ${kp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xI(e){return e=(e||0)%360,e<0?e+360:e}function kp(e){return Math.max(0,Math.min(1,e||0))}function Hy(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 Np=Math.PI/180,Ap=180/Math.PI;var Ep=18,SI=.96422,vI=1,II=.82521,_I=4/29,cc=6/29,PI=3*cc*cc,PA=cc*cc*cc;function TI(e){if(e instanceof Po)return new Po(e.l,e.a,e.b,e.opacity);if(e instanceof gi)return MI(e);e instanceof Et||(e=Jf(e));var t=Zy(e.r),r=Zy(e.g),n=Zy(e.b),o=Yy((.2225045*t+.7168786*r+.0606169*n)/vI),i,a;return t===r&&r===n?i=a=o:(i=Yy((.4360747*t+.3850649*r+.1430804*n)/SI),a=Yy((.0139322*t+.0971045*r+.7141733*n)/II)),new Po(116*o-16,500*(i-o),200*(o-a),e.opacity)}function fc(e,t,r,n){return arguments.length===1?TI(e):new Po(e,t,r,n??1)}function Po(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}hi(Po,fc,ta(_o,{brighter(e){return new Po(this.l+Ep*(e??1),this.a,this.b,this.opacity)},darker(e){return new Po(this.l-Ep*(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=SI*Wy(t),e=vI*Wy(e),r=II*Wy(r),new Et(Xy(3.1338561*t-1.6168667*e-.4906146*r),Xy(-.9787684*t+1.9161415*e+.033454*r),Xy(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function Yy(e){return e>PA?Math.pow(e,1/3):e/PI+_I}function Wy(e){return e>cc?e*e*e:PI*(e-_I)}function Xy(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Zy(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function TA(e){if(e instanceof gi)return new gi(e.h,e.c,e.l,e.opacity);if(e instanceof Po||(e=TI(e)),e.a===0&&e.b===0)return new gi(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 EI(e,t){return function(r){return e+r*t}}function CA(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 lc(e,t){var r=t-e;return r?EI(e,r>180||r<-180?r-360*Math.round(r/360):r):uc(isNaN(e)?t:e)}function FI(e){return(e=+e)==1?pt:function(t,r){return r-t?CA(t,r,e):uc(isNaN(t)?r:t)}}function pt(e,t){var r=t-e;return r?EI(e,r):uc(isNaN(e)?t:e)}var Mn=(function e(t){var r=FI(t);function n(o,i){var a=r((o=Tn(o)).r,(i=Tn(i)).r),s=r(o.g,i.g),c=r(o.b,i.b),u=pt(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 $I(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:ft(n,o)})),r=r0.lastIndex;return r180?f+=360:f-u>180&&(u+=360),l.push({i:p.push(o(p)+"rotate(",null,n)-2,x:ft(u,f)})):f&&p.push(o(p)+"rotate("+f+n)}function s(u,f,p,l){u!==f?l.push({i:p.push(o(p)+"skewX(",null,n)-2,x:ft(u,f)}):f&&p.push(o(p)+"skewX("+f+n)}function c(u,f,p,l,m,h){if(u!==p||f!==l){var b=m.push(o(m)+"scale(",null,",",null,")");h.push({i:b-4,x:ft(u,p)},{i:b-2,x:ft(f,l)})}else(p!==1||l!==1)&&m.push(o(m)+"scale("+p+","+l+")")}return function(u,f){var p=[],l=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,p,l),a(u.rotate,f.rotate,p,l),s(u.skewX,f.skewX,p,l),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,p,l),u=f=null,function(m){for(var h=-1,b=l.length,y;++h=0&&e._call.call(void 0,t),e=e._next;--mc}function WI(){Za=(jp=su.now())+Up,mc=iu=0;try{QI()}finally{mc=0,DA(),Za=0}}function $A(){var e=su.now(),t=e-jp;t>XI&&(Up-=t,jp=e)}function DA(){for(var e,t=Vp,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:Vp=r);au=e,f0(n)}function f0(e){if(!mc){iu&&(iu=clearTimeout(iu));var t=e-Za;t>24?(e<1/0&&(iu=setTimeout(WI,e-su.now()-Up)),ou&&(ou=clearInterval(ou))):(ou||(jp=su.now(),ou=setInterval($A,XI)),mc=1,ZI(WI))}}function Bp(e,t,r){var n=new cu;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,r),n}var LA=By("start","end","cancel","interrupt"),VA=[],t_=0,JI=1,Kp=2,zp=3,e_=4,qp=5,uu=6;function na(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;jA(e,r,{name:t,index:n,group:o,on:LA,tween:VA,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:t_})}function lu(e,t){var r=Lt(e,t);if(r.state>t_)throw new Error("too late; already scheduled");return r}function cr(e,t){var r=Lt(e,t);if(r.state>zp)throw new Error("too late; already running");return r}function Lt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function jA(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=Gp(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 f,p,l,m;if(r.state!==JI)return c();for(f in n)if(m=n[f],m.name===r.name){if(m.state===zp)return Bp(a);m.state===e_?(m.state=uu,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[f]):+fKp&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function a4(e,t,r){var n,o,i=i4(t)?lu:cr;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function p_(e,t){var r=this._id;return arguments.length<2?Lt(this.node(),r).on.on(e):this.each(a4(r,e,t))}function s4(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function m_(){return this.on("end.remove",s4(this._id))}function d_(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ka(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 M_;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;oQa)if(!(Math.abs(p*c-u*f)>Qa)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-a,h=o-s,b=c*c+u*u,y=m*m+h*h,x=Math.sqrt(b),g=Math.sqrt(l),S=i*Math.tan((l0-Math.acos((b+l-y)/(2*x*g)))/2),w=S/g,_=S/x;Math.abs(w-1)>Qa&&this._append`L${t+w*f},${r+w*p}`,this._append`A${i},${i},0,0,${+(p*m>f*h)},${this._x1=t+_*c},${this._y1=r+_*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,p=1^a,l=a?o-i:i-o;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>Qa||Math.abs(this._y1-f)>Qa)&&this._append`L${u},${f}`,n&&(l<0&&(l=l%p0+p0),l>I4?this._append`A${n},${n},0,1,${p},${t-s},${r-c}A${n},${n},0,1,${p},${this._x1=u},${this._y1=f}`:l>Qa&&this._append`A${n},${n},0,${+(l>=l0)},${p},${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 C_(){return new oa}C_.prototype=oa.prototype;function no(e=3){return new oa(+e)}function O_(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ja(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 Mo(e){return e=Ja(Math.abs(e)),e?e[1]:NaN}function k_(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 R_(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var P4=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Co(e){if(!(t=P4.exec(e)))throw new Error("invalid format: "+e);var t;return new Zp({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]})}Co.prototype=Zp.prototype;function Zp(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+""}Zp.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 N_(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 pu;function A_(e,t){var r=Ja(e,t);if(!r)return pu=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(pu=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")+Ja(e,Math.max(0,t+i-1))[0]}function m0(e,t){var r=Ja(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 d0={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:O_,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)=>m0(e*100,t),r:m0,s:A_,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function h0(e){return e}var E_=Array.prototype.map,F_=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function $_(e){var t=e.grouping===void 0||e.thousands===void 0?h0:k_(E_.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?h0:R_(E_.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(p,l){p=Co(p);var m=p.fill,h=p.align,b=p.sign,y=p.symbol,x=p.zero,g=p.width,S=p.comma,w=p.precision,_=p.trim,v=p.type;v==="n"?(S=!0,v="g"):d0[v]||(w===void 0&&(w=12),_=!0,v="g"),(x||m==="0"&&h==="=")&&(x=!0,m="0",h="=");var I=(l&&l.prefix!==void 0?l.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():""),T=(y==="$"?n:/[%p]/.test(v)?a:"")+(l&&l.suffix!==void 0?l.suffix:""),P=d0[v],R=/[defgprs%]/.test(v);w=w===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function k(N){var B=I,V=T,C,G,j;if(v==="c")V=P(N)+V,N="";else{N=+N;var H=N<0||1/N<0;if(N=isNaN(N)?c:P(Math.abs(N),w),_&&(N=N_(N)),H&&+N==0&&b!=="+"&&(H=!1),B=(H?b==="("?b:s:b==="-"||b==="("?"":b)+B,V=(v==="s"&&!isNaN(N)&&pu!==void 0?F_[8+pu/3]:"")+V+(H&&b==="("?")":""),R){for(C=-1,G=N.length;++Cj||j>57){V=(j===46?o+N.slice(C+1):N.slice(C))+V,N=N.slice(0,C);break}}}S&&!x&&(N=t(N,1/0));var U=B.length+N.length+V.length,z=U>1)+B+N+V+z.slice(U);break;default:N=z+B+N+V;break}return i(N)}return k.toString=function(){return p+""},k}function f(p,l){var m=Math.max(-8,Math.min(8,Math.floor(Mo(l)/3)))*3,h=Math.pow(10,-m),b=u((p=Co(p),p.type="f",p),{suffix:F_[8+m/3]});return function(y){return b(h*y)}}return{format:u,formatPrefix:f}}var Qp,Cn,Jp;g0({thousands:",",grouping:[3],currency:["$",""]});function g0(e){return Qp=$_(e),Cn=Qp.format,Jp=Qp.formatPrefix,Qp}function y0(e){return Math.max(0,-Mo(Math.abs(e)))}function b0(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Mo(t)/3)))*3-Mo(Math.abs(e)))}function x0(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Mo(t)-Mo(e))+1}var se=1e-6,em=1e-12,me=Math.PI,qe=me/2,w0=me/4,qt=me*2,Vt=180/me,He=me/180,be=Math.abs,On=Math.atan,fr=Math.atan2,ie=Math.cos;var tm=Math.exp;var es=Math.log,rm=Math.pow,ne=Math.sin,Sr=Math.sign||function(e){return e>0?1:e<0?-1:0},et=Math.sqrt,hc=Math.tan;function nm(e){return e>1?0:e<-1?me:Math.acos(e)}function vt(e){return e>1?qe:e<-1?-qe:Math.asin(e)}function Ht(){}function om(e,t){e&&L_.hasOwnProperty(e.type)&&L_[e.type](e,t)}var D_={Feature:function(e,t){om(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++nme&&(e-=Math.round(e/qt)*qt),[e,t]}v0.invert=v0;function I0(e,t,r){return(e%=qt)?t||r?yu(U_(e),G_(t,r)):U_(e):t||r?G_(t,r):v0}function j_(e){return function(t,r){return t+=e,be(t)>me&&(t-=Math.round(t/qt)*qt),[t,r]}}function U_(e){var t=j_(e);return t.invert=j_(-e),t}function G_(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,p=ne(s)*u,l=ne(c),m=l*r+f*n;return[fr(p*o-m*i,f*r-l*n),vt(m*o+p*i)]}return a.invert=function(s,c){var u=ie(c),f=ie(s)*u,p=ne(s)*u,l=ne(c),m=l*o-p*i;return[fr(p*o+l*i,f*r+m*n),vt(m*r-f*n)]},a}function B_(e){e=I0(e[0]*He,e[1]*He,e.length>2?e[2]*He:0);function t(r){return r=e(r[0]*He,r[1]*He),r[0]*=Vt,r[1]*=Vt,r}return t.invert=function(r){return r=e.invert(r[0]*He,r[1]*He),r[0]*=Vt,r[1]*=Vt,r},t}function K_(e,t,r,n,o,i){if(r){var a=ie(t),s=ne(t),c=n*r;o==null?(o=t+n*qt,i=t-c/2):(o=z_(a,o),i=z_(a,i),(n>0?oi)&&(o+=n*qt));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 yc(e,t){return be(e[0]-t[0])=0;--s)o.point((p=f[s])[0],p[1]);else n(l.x,l.p.x,-1,o);l=l.p}l=l.o,f=l.z,m=!m}while(!l.v);o.lineEnd()}}}function q_(e){if(t=e.length){for(var t,r=0,n=e[0],o;++r=0?1:-1,R=P*T,k=R>me,N=y*v;if(c.add(fr(N*P*ne(R),x*I+N*ie(R))),a+=k?T+P*qt:T,k^h>=r^w>=r){var B=gc(Oo(m),Oo(S));gu(B);var V=gc(i,B);gu(V);var C=(k^T>=0?-1:1)*vt(V[2]);(n>C||n===C&&(B[0]||B[1]))&&(s+=k^T>=0?1:-1)}}return(a<-se||a0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v1&&w&2&&_.push(_.pop().concat(_.shift())),f.push(_.filter(T4))}}return l}}function T4(e){return e.length>1}function M4(e,t){return((e=e.x)[0]<0?e[1]-qe-se:qe-e[1])-((t=t.x)[0]<0?t[1]-qe-se:qe-t[1])}var P0=fm(function(){return!0},C4,k4,[-me,-qe]);function C4(e){var t=NaN,r=NaN,n=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,a){var s=i>0?me:-me,c=be(i-t);be(c-me)0?qe:-qe),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(i,r),o=0):n!==s&&c>=me&&(be(t-n)se?On((ne(t)*(i=ie(n))*ne(r)-ne(n)*(o=ie(t))*ne(e))/(o*i*a)):(t+n)/2}function k4(e,t,r,n){var o;if(e==null)o=r*qe,n.point(-me,o),n.point(0,o),n.point(me,o),n.point(me,0),n.point(me,-o),n.point(0,-o),n.point(-me,-o),n.point(-me,0),n.point(-me,o);else if(be(e[0]-t[0])>se){var i=e[0]0,o=be(t)>se;function i(f,p,l,m){K_(m,e,r,l,f,p)}function a(f,p){return ie(f)*ie(p)>t}function s(f){var p,l,m,h,b;return{lineStart:function(){h=m=!1,b=1},point:function(y,x){var g=[y,x],S,w=a(y,x),_=n?w?0:u(y,x):w?u(y+(y<0?me:-me),x):0;if(!p&&(h=m=w)&&f.lineStart(),w!==m&&(S=c(p,g),(!S||yc(p,S)||yc(g,S))&&(g[2]=1)),w!==m)b=0,w?(f.lineStart(),S=c(g,p),f.point(S[0],S[1])):(S=c(p,g),f.point(S[0],S[1],2),f.lineEnd()),p=S;else if(o&&p&&n^w){var v;!(_&l)&&(v=c(g,p,!0))&&(b=0,n?(f.lineStart(),f.point(v[0][0],v[0][1]),f.point(v[1][0],v[1][1]),f.lineEnd()):(f.point(v[1][0],v[1][1]),f.lineEnd(),f.lineStart(),f.point(v[0][0],v[0][1],3)))}w&&(!p||!yc(p,g))&&f.point(g[0],g[1]),p=g,m=w,l=_},lineEnd:function(){m&&f.lineEnd(),p=null},clean:function(){return b|(h&&m)<<1}}}function c(f,p,l){var m=Oo(f),h=Oo(p),b=[1,0,0],y=gc(m,h),x=du(y,y),g=y[0],S=x-g*g;if(!S)return!l&&f;var w=t*x/S,_=-t*g/S,v=gc(b,y),I=hu(b,w),T=hu(y,_);im(I,T);var P=v,R=du(I,P),k=du(P,P),N=R*R-k*(du(I,I)-1);if(!(N<0)){var B=et(N),V=hu(P,(-R-B)/k);if(im(V,I),V=mu(V),!l)return V;var C=f[0],G=p[0],j=f[1],H=p[1],U;G0^V[1]<(be(V[0]-C)me^(C<=V[0]&&V[0]<=G)){var q=hu(P,(-R+B)/k);return im(q,I),[V,mu(q)]}}}function u(f,p){var l=n?e:me-e,m=0;return f<-l?m|=1:f>l&&(m|=2),p<-l?m|=4:p>l&&(m|=8),m}return fm(a,s,i,n?[0,-e]:[-me,e-me])}function W_(e,t,r,n,o,i){var a=e[0],s=e[1],c=t[0],u=t[1],f=0,p=1,l=c-a,m=u-s,h;if(h=r-a,!(!l&&h>0)){if(h/=l,l<0){if(h0){if(h>p)return;h>f&&(f=h)}if(h=o-a,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>f&&(f=h)}else if(l>0){if(h0)){if(h/=m,m<0){if(h0){if(h>p)return;h>f&&(f=h)}if(h=i-s,!(!m&&h<0)){if(h/=m,m<0){if(h>p)return;h>f&&(f=h)}else if(m>0){if(h0&&(e[0]=a+f*l,e[1]=s+f*m),p<1&&(t[0]=a+p*l,t[1]=s+p*m),!0}}}}}var bu=1e9,um=-bu;function bc(e,t,r,n){function o(u,f){return e<=u&&u<=r&&t<=f&&f<=n}function i(u,f,p,l){var m=0,h=0;if(u==null||(m=a(u,p))!==(h=a(f,p))||c(u,f)<0^p>0)do l.point(m===0||m===3?e:r,m>1?n:t);while((m=(m+p+4)%4)!==h);else l.point(f[0],f[1])}function a(u,f){return be(u[0]-e)0?0:3:be(u[0]-r)0?2:1:be(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 p=a(u,1),l=a(f,1);return p!==l?p-l:p===0?f[1]-u[1]:p===1?u[0]-f[0]:p===2?u[1]-f[1]:f[0]-u[0]}return function(u){var f=u,p=am(),l,m,h,b,y,x,g,S,w,_,v,I={point:T,lineStart:N,lineEnd:B,polygonStart:R,polygonEnd:k};function T(C,G){o(C,G)&&f.point(C,G)}function P(){for(var C=0,G=0,j=m.length;Gn&&(ae-X)*(n-q)>(J-q)*(e-X)&&++C:J<=n&&(ae-X)*(n-q)<(J-q)*(e-X)&&--C;return C}function R(){f=p,l=[],m=[],v=!0}function k(){var C=P(),G=v&&C,j=(l=ac(l)).length;(G||j)&&(u.polygonStart(),G&&(u.lineStart(),i(null,null,1,u),u.lineEnd()),j&&cm(l,s,C,i,u),u.polygonEnd()),f=u,l=m=h=null}function N(){I.point=V,m&&m.push(h=[]),_=!0,w=!1,g=S=NaN}function B(){l&&(V(b,y),x&&w&&p.rejoin(),l.push(p.result())),I.point=T,w&&f.lineEnd()}function V(C,G){var j=o(C,G);if(m&&h.push([C,G]),_)b=C,y=G,x=j,_=!1,j&&(f.lineStart(),f.point(C,G));else if(j&&w)f.point(C,G);else{var H=[g=Math.max(um,Math.min(bu,g)),S=Math.max(um,Math.min(bu,S))],U=[C=Math.max(um,Math.min(bu,C)),G=Math.max(um,Math.min(bu,G))];W_(H,U,e,t,r,n)?(w||(f.lineStart(),f.point(H[0],H[1])),f.point(U[0],U[1]),j||f.lineEnd(),v=!1):j&&(f.lineStart(),f.point(C,G),v=!1)}g=C,S=G,w=j}return I}}var xu=e=>e;var T0=new an,M0=new an,X_,Z_,C0,O0,ia={point:Ht,lineStart:Ht,lineEnd:Ht,polygonStart:function(){ia.lineStart=R4,ia.lineEnd=A4},polygonEnd:function(){ia.lineStart=ia.lineEnd=ia.point=Ht,T0.add(be(M0)),M0=new an},result:function(){var e=T0/2;return T0=new an,e}};function R4(){ia.point=N4}function N4(e,t){ia.point=Q_,X_=C0=e,Z_=O0=t}function Q_(e,t){M0.add(O0*e-C0*t),C0=e,O0=t}function A4(){Q_(X_,Z_)}var k0=ia;var xc=1/0,lm=xc,wu=-xc,pm=wu,E4={point:F4,lineStart:Ht,lineEnd:Ht,polygonStart:Ht,polygonEnd:Ht,result:function(){var e=[[xc,lm],[wu,pm]];return wu=pm=-(lm=xc=1/0),e}};function F4(e,t){ewu&&(wu=e),tpm&&(pm=t)}var wc=E4;var R0=0,N0=0,Su=0,mm=0,dm=0,Sc=0,A0=0,E0=0,vu=0,tP,rP,ko,Ro,io={point:ts,lineStart:J_,lineEnd:eP,polygonStart:function(){io.lineStart=L4,io.lineEnd=V4},polygonEnd:function(){io.point=ts,io.lineStart=J_,io.lineEnd=eP},result:function(){var e=vu?[A0/vu,E0/vu]:Sc?[mm/Sc,dm/Sc]:Su?[R0/Su,N0/Su]:[NaN,NaN];return R0=N0=Su=mm=dm=Sc=A0=E0=vu=0,e}};function ts(e,t){R0+=e,N0+=t,++Su}function J_(){io.point=$4}function $4(e,t){io.point=D4,ts(ko=e,Ro=t)}function D4(e,t){var r=e-ko,n=t-Ro,o=et(r*r+n*n);mm+=o*(ko+e)/2,dm+=o*(Ro+t)/2,Sc+=o,ts(ko=e,Ro=t)}function eP(){io.point=ts}function L4(){io.point=j4}function V4(){nP(tP,rP)}function j4(e,t){io.point=nP,ts(tP=ko=e,rP=Ro=t)}function nP(e,t){var r=e-ko,n=t-Ro,o=et(r*r+n*n);mm+=o*(ko+e)/2,dm+=o*(Ro+t)/2,Sc+=o,o=Ro*e-ko*t,A0+=o*(ko+e),E0+=o*(Ro+t),vu+=o*3,ts(ko=e,Ro=t)}var F0=io;function hm(e){this._context=e}hm.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,qt);break}}},result:Ht};var D0=new an,$0,oP,iP,Iu,_u,gm={point:Ht,lineStart:function(){gm.point=U4},lineEnd:function(){$0&&aP(oP,iP),gm.point=Ht},polygonStart:function(){$0=!0},polygonEnd:function(){$0=null},result:function(){var e=+D0;return D0=new an,e}};function U4(e,t){gm.point=aP,oP=Iu=e,iP=_u=t}function aP(e,t){Iu-=e,_u-=t,D0.add(et(Iu*Iu+_u*_u)),Iu=e,_u=t}var L0=gm;var sP,ym,cP,fP,vc=class{constructor(t){this._append=t==null?uP:G4(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!==cP||this._append!==ym){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`,cP=n,ym=this._append,fP=this._,this._=o}this._+=fP;break}}}result(){let t=this._;return this._="",t.length?t:null}};function uP(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return uP;if(t!==sP){let r=10**t;sP=t,ym=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 vc(r)),a},a.projection(e).digits(r).context(t)}function _c(e){return{stream:Pc(e)}}function Pc(e){return function(t){var r=new V0;for(var n in e)r[n]=e[n];return r.stream=t,r}}function V0(){}V0.prototype={constructor:V0,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 j0(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),oo(r,e.stream(wc)),t(wc.result()),n!=null&&e.clipExtent(n),e}function Pu(e,t,r){return j0(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 bm(e,t,r){return Pu(e,[[0,0],t],r)}function xm(e,t,r){return j0(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 wm(e,t,r){return j0(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 lP=16,B4=ie(30*He);function U0(e,t){return+t?K4(e,t):z4(e)}function z4(e){return Pc({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function K4(e,t){function r(n,o,i,a,s,c,u,f,p,l,m,h,b,y){var x=u-n,g=f-o,S=x*x+g*g;if(S>4*t&&b--){var w=a+l,_=s+m,v=c+h,I=et(w*w+_*_+v*v),T=vt(v/=I),P=be(be(v)-1)t||be((x*B+g*V)/S-.5)>.3||a*l+s*m+c*h2?C[2]%360*He:0,B()):[s*Vt,c*Vt,u*Vt]},k.angle=function(C){return arguments.length?(p=C%360*He,B()):p*Vt},k.reflectX=function(C){return arguments.length?(l=C?-1:1,B()):l<0},k.reflectY=function(C){return arguments.length?(m=C?-1:1,B()):m<0},k.precision=function(C){return arguments.length?(v=U0(I,_=C*C),V()):et(_)},k.fitExtent=function(C,G){return Pu(k,C,G)},k.fitSize=function(C,G){return bm(k,C,G)},k.fitWidth=function(C,G){return xm(k,C,G)},k.fitHeight=function(C,G){return wm(k,C,G)};function B(){var C=pP(r,0,0,l,m,p).apply(null,t(i,a)),G=pP(r,n-C[0],o-C[1],l,m,p);return f=I0(s,c,u),I=yu(t,G),T=yu(f,I),v=U0(I,_),V()}function V(){return P=R=null,k}return function(){return t=e.apply(this,arguments),k.invert=t.invert&&N,B()}}function Tc(e){var t=0,r=me/3,n=G0(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*He,r=i[1]*He):[t*Vt,r*Vt]},o}function mP(e){var t=ie(e);function r(n,o){return[n*t,ne(o)/t]}return r.invert=function(n,o){return[n/t,vt(o*t)]},r}function dP(e,t){var r=ne(e),n=(r+ne(t))/2;if(be(n)=.12&&y<.234&&b>=-.425&&b<-.214?o:y>=.166&&y<.234&&b>=-.214&&b<-.115?a:r).invert(l)},f.stream=function(l){return e&&t===l?e:e=W4([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),p()):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 m=r.scale(),h=+l[0],b=+l[1];return n=r.translate(l).clipExtent([[h-.455*m,b-.238*m],[h+.455*m,b+.238*m]]).stream(u),i=o.translate([h-.307*m,b+.201*m]).clipExtent([[h-.425*m+se,b+.12*m+se],[h-.214*m-se,b+.234*m-se]]).stream(u),s=a.translate([h-.205*m,b+.212*m]).clipExtent([[h-.214*m+se,b+.166*m+se],[h-.115*m-se,b+.234*m-se]]).stream(u),p()},f.fitExtent=function(l,m){return Pu(f,l,m)},f.fitSize=function(l,m){return bm(f,l,m)},f.fitWidth=function(l,m){return xm(f,l,m)},f.fitHeight=function(l,m){return wm(f,l,m)};function p(){return e=t=null,f}return f.scale(1070)}function Sm(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 No(e){return function(t,r){var n=et(t*t+r*r),o=e(n),i=ne(o),a=ie(o);return[fr(t*i,n*a),vt(n&&r*i/n)]}}var z0=Sm(function(e){return et(2/(1+e))});z0.invert=No(function(e){return 2*vt(e/2)});function K0(){return ur(z0).scale(124.75).clipAngle(180-.001)}var q0=Sm(function(e){return(e=nm(e))&&e/ne(e)});q0.invert=No(function(e){return e});function H0(){return ur(q0).scale(79.4188).clipAngle(180-.001)}function Mc(e,t){return[e,es(hc((qe+t)/2))]}Mc.invert=function(e,t){return[e,2*On(tm(t))-qe]};function Y0(){return W0(Mc).scale(961/qt)}function W0(e){var t=ur(e),r=t.center,n=t.scale,o=t.translate,i=t.clipExtent,a=null,s,c,u;t.scale=function(p){return arguments.length?(n(p),f()):n()},t.translate=function(p){return arguments.length?(o(p),f()):o()},t.center=function(p){return arguments.length?(r(p),f()):r()},t.clipExtent=function(p){return arguments.length?(p==null?a=s=c=u=null:(a=+p[0][0],s=+p[0][1],c=+p[1][0],u=+p[1][1]),f()):a==null?null:[[a,s],[c,u]]};function f(){var p=me*n(),l=t(B_(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:e===Mc?[[Math.max(l[0]-p,a),s],[Math.min(l[0]+p,c),u]]:[[a,Math.max(l[1]-p,s)],[c,Math.min(l[1]+p,u)]])}return f()}function vm(e){return hc((qe+e)/2)}function hP(e,t){var r=ie(e),n=e===t?ne(e):es(r/ie(t))/es(vm(t)/vm(e)),o=r*rm(vm(e),n)/n;if(!n)return Mc;function i(a,s){o>0?s<-qe+se&&(s=-qe+se):s>qe-se&&(s=qe-se);var c=o/rm(vm(s),n);return[c*ne(n*a),o-c*ie(n*a)]}return i.invert=function(a,s){var c=o-s,u=Sr(n)*et(a*a+c*c),f=fr(a,be(c))*Sr(c);return c*n<0&&(f-=me*Sr(a)*Sr(c)),[f/n,2*On(rm(o/u,1/n))-qe]},i}function X0(){return Tc(hP).scale(109.5).parallels([30,30])}function Cc(e,t){return[e,t]}Cc.invert=Cc;function Z0(){return ur(Cc).scale(152.63)}function gP(e,t){var r=ie(e),n=e===t?ne(e):(r-ie(t))/(t-e),o=r/n+e;if(be(n)2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Ft(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Ru(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 Nu=Symbol("implicit");function rs(){var e=new Cr,t=[],r=[],n=Nu;function o(i){let a=e.get(i);if(a===void 0){if(n!==Nu)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 Cr;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 rs(t,r).unknown(n)},Ft.apply(o,arguments),o}function sa(){var e=rs().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 p(){var l=t().length,m=ot&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Q4(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?J4:Q4,c=u=null,p}function p(l){return l==null||isNaN(l=+l)?i:(c||(c=s(e.map(n),t,r)))(n(a(l)))}return p.invert=function(l){return a(o((u||(u=s(t,e.map(n),ft)))(l)))},p.domain=function(l){return arguments.length?(e=Array.from(l,Oc),f()):e.slice()},p.range=function(l){return arguments.length?(t=Array.from(l),f()):t.slice()},p.rangeRound=function(l){return t=Array.from(l),r=Xa,f()},p.clamp=function(l){return arguments.length?(a=l?!0:Br,f()):a!==Br},p.interpolate=function(l){return arguments.length?(r=l,f()):r},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,m){return n=l,o=m,f()}}function Au(){return ns()(Br,Br)}function pb(e,t,r,n){var o=ic(e,t,r),i;switch(n=Co(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=b0(o,a))&&(n.precision=i),Jp(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=x0(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=y0(o))&&(n.precision=i-(n.type==="%")*2);break}}return Cn(n)}function bi(e){var t=e.domain;return e.ticks=function(r){var n=t();return ui(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return pb(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=qf(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 os(){var e=Au();return e.copy=function(){return Ao(e,os())},Ft.apply(e,arguments),bi(e)}function Eu(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,Oc),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Eu(e).unknown(t)},e=arguments.length?Array.from(e,Oc):[0,1],bi(r)}function Fu(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 oE(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 SP(e){return(t,r)=>-e(-t,r)}function mb(e){let t=e(xP,wP),r=t.domain,n=10,o,i;function a(){return o=oE(n),i=nE(n),r()[0]<0?(o=SP(o),i=SP(i),e(eE,tE)):e(xP,wP),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],p=f0){for(;l<=m;++l)for(h=1;hf)break;x.push(b)}}else for(;l<=m;++l)for(h=n-1;h>=1;--h)if(b=l>0?h/i(-l):h*i(l),!(bf)break;x.push(b)}x.length*2{if(s==null&&(s=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Co(c)).precision==null&&(c.trim=!0),c=Cn(c)),s===1/0)return c;let u=Math.max(1,n*s/t.ticks().length);return f=>{let p=f/i(Math.round(o(f)));return p*nr(Fu(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function $u(){let e=mb(ns()).domain([1,10]);return e.copy=()=>Ao(e,$u()).base(e.base()),Ft.apply(e,arguments),e}function vP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function IP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function db(e){var t=1,r=e(vP(t),IP(t));return r.constant=function(n){return arguments.length?e(vP(t=+n),IP(t)):t},bi(r)}function Du(){var e=db(ns());return e.copy=function(){return Ao(e,Du()).constant(e.constant())},Ft.apply(e,arguments)}function _P(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function iE(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function aE(e){return e<0?-e*e:e*e}function hb(e){var t=e(Br,Br),r=1;function n(){return r===1?e(Br,Br):r===.5?e(iE,aE):e(_P(r),_P(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},bi(t)}function Lu(){var e=hb(ns());return e.copy=function(){return Ao(e,Lu()).exponent(e.exponent())},Ft.apply(e,arguments),e}function Vu(){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(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)=>(gb.setTime(+i),yb.setTime(+a),e(gb),e(yb),Math.floor(r(gb,yb))),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 Uu=Qe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Uu.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):Uu);var yme=Uu.range;var Yt=Qe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),PP=Yt.range;var xi=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()),sE=xi.range,wi=Qe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),cE=wi.range;var Si=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()),fE=Si.range,vi=Qe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),uE=vi.range;var kn=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),lE=kn.range,ss=Qe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),pE=ss.range,cs=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)),mE=cs.range;function fs(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 cn=fs(0),ca=fs(1),_m=fs(2),Pm=fs(3),Fo=fs(4),Tm=fs(5),Mm=fs(6),MP=cn.range,dE=ca.range,hE=_m.range,gE=Pm.range,yE=Fo.range,bE=Tm.range,xE=Mm.range;function us(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 fn=us(0),fa=us(1),Cm=us(2),Om=us(3),$o=us(4),km=us(5),Rm=us(6),CP=fn.range,wE=fa.range,SE=Cm.range,vE=Om.range,IE=$o.range,_E=km.range,PE=Rm.range;var Ii=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()),TE=Ii.range,_i=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()),ME=_i.range;var vr=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());vr.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 CE=vr.range,Ir=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());Ir.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 OE=Ir.range;function kP(e,t,r,n,o,i){let a=[[Yt,1,1e3],[Yt,5,5*1e3],[Yt,15,15*1e3],[Yt,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,p){let l=fy).right(a,l);if(m===a.length)return e.every(ic(u/31536e6,f/31536e6,p));if(m===0)return Uu.every(Math.max(ic(u,f,p),1));let[h,b]=a[l/a[m-1][2]53)return null;"w"in A||(A.w=1),"Z"in A?(re=Ib(Bu(A.y,0,1)),Te=re.getUTCDay(),re=Te>4||Te===0?fa.ceil(re):fa(re),re=ss.offset(re,(A.V-1)*7),A.y=re.getUTCFullYear(),A.m=re.getUTCMonth(),A.d=re.getUTCDate()+(A.w+6)%7):(re=vb(Bu(A.y,0,1)),Te=re.getDay(),re=Te>4||Te===0?ca.ceil(re):ca(re),re=kn.offset(re,(A.V-1)*7),A.y=re.getFullYear(),A.m=re.getMonth(),A.d=re.getDate()+(A.w+6)%7)}else("W"in A||"U"in A)&&("w"in A||(A.w="u"in A?A.u%7:"W"in A?1:0),Te="Z"in A?Ib(Bu(A.y,0,1)).getUTCDay():vb(Bu(A.y,0,1)).getDay(),A.m=0,A.d="W"in A?(A.w+6)%7+A.W*7-(Te+5)%7:A.w+A.U*7-(Te+6)%7);return"Z"in A?(A.H+=A.Z/100|0,A.M+=A.Z%100,Ib(A)):vb(A)}}function T(O,L,K,A){for(var ee=0,re=L.length,Te=K.length,Me,rt;ee=Te)return-1;if(Me=L.charCodeAt(ee++),Me===37){if(Me=L.charAt(ee++),rt=_[Me in RP?L.charAt(ee++):Me],!rt||(A=rt(O,K,A))<0)return-1}else if(Me!=K.charCodeAt(A++))return-1}return A}function P(O,L,K){var A=u.exec(L.slice(K));return A?(O.p=f.get(A[0].toLowerCase()),K+A[0].length):-1}function R(O,L,K){var A=m.exec(L.slice(K));return A?(O.w=h.get(A[0].toLowerCase()),K+A[0].length):-1}function k(O,L,K){var A=p.exec(L.slice(K));return A?(O.w=l.get(A[0].toLowerCase()),K+A[0].length):-1}function N(O,L,K){var A=x.exec(L.slice(K));return A?(O.m=g.get(A[0].toLowerCase()),K+A[0].length):-1}function B(O,L,K){var A=b.exec(L.slice(K));return A?(O.m=y.get(A[0].toLowerCase()),K+A[0].length):-1}function V(O,L,K){return T(O,t,L,K)}function C(O,L,K){return T(O,r,L,K)}function G(O,L,K){return T(O,n,L,K)}function j(O){return a[O.getDay()]}function H(O){return i[O.getDay()]}function U(O){return c[O.getMonth()]}function z(O){return s[O.getMonth()]}function Y(O){return o[+(O.getHours()>=12)]}function X(O){return 1+~~(O.getMonth()/3)}function q(O){return a[O.getUTCDay()]}function ae(O){return i[O.getUTCDay()]}function J(O){return c[O.getUTCMonth()]}function oe(O){return s[O.getUTCMonth()]}function Q(O){return o[+(O.getUTCHours()>=12)]}function fe(O){return 1+~~(O.getUTCMonth()/3)}return{format:function(O){var L=v(O+="",S);return L.toString=function(){return O},L},parse:function(O){var L=I(O+="",!1);return L.toString=function(){return O},L},utcFormat:function(O){var L=v(O+="",w);return L.toString=function(){return O},L},utcParse:function(O){var L=I(O+="",!0);return L.toString=function(){return O},L}}}var RP={"-":"",_:" ",0:"0"},Wt=/^\s*\d+/,RE=/^%/,NE=/[\\^$*+?|[\]().{}]/g;function Le(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i[t.toLowerCase(),r]))}function EE(e,t,r){var n=Wt.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function FE(e,t,r){var n=Wt.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function $E(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function DE(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function LE(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function NP(e,t,r){var n=Wt.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function AP(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function VE(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 jE(e,t,r){var n=Wt.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function UE(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function EP(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function GE(e,t,r){var n=Wt.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function FP(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function BE(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function zE(e,t,r){var n=Wt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function KE(e,t,r){var n=Wt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function qE(e,t,r){var n=Wt.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function HE(e,t,r){var n=RE.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function YE(e,t,r){var n=Wt.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function WE(e,t,r){var n=Wt.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function $P(e,t){return Le(e.getDate(),t,2)}function XE(e,t){return Le(e.getHours(),t,2)}function ZE(e,t){return Le(e.getHours()%12||12,t,2)}function QE(e,t){return Le(1+kn.count(vr(e),e),t,3)}function UP(e,t){return Le(e.getMilliseconds(),t,3)}function JE(e,t){return UP(e,t)+"000"}function e7(e,t){return Le(e.getMonth()+1,t,2)}function t7(e,t){return Le(e.getMinutes(),t,2)}function r7(e,t){return Le(e.getSeconds(),t,2)}function n7(e){var t=e.getDay();return t===0?7:t}function o7(e,t){return Le(cn.count(vr(e)-1,e),t,2)}function GP(e){var t=e.getDay();return t>=4||t===0?Fo(e):Fo.ceil(e)}function i7(e,t){return e=GP(e),Le(Fo.count(vr(e),e)+(vr(e).getDay()===4),t,2)}function a7(e){return e.getDay()}function s7(e,t){return Le(ca.count(vr(e)-1,e),t,2)}function c7(e,t){return Le(e.getFullYear()%100,t,2)}function f7(e,t){return e=GP(e),Le(e.getFullYear()%100,t,2)}function u7(e,t){return Le(e.getFullYear()%1e4,t,4)}function l7(e,t){var r=e.getDay();return e=r>=4||r===0?Fo(e):Fo.ceil(e),Le(e.getFullYear()%1e4,t,4)}function p7(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Le(t/60|0,"0",2)+Le(t%60,"0",2)}function DP(e,t){return Le(e.getUTCDate(),t,2)}function m7(e,t){return Le(e.getUTCHours(),t,2)}function d7(e,t){return Le(e.getUTCHours()%12||12,t,2)}function h7(e,t){return Le(1+ss.count(Ir(e),e),t,3)}function BP(e,t){return Le(e.getUTCMilliseconds(),t,3)}function g7(e,t){return BP(e,t)+"000"}function y7(e,t){return Le(e.getUTCMonth()+1,t,2)}function b7(e,t){return Le(e.getUTCMinutes(),t,2)}function x7(e,t){return Le(e.getUTCSeconds(),t,2)}function w7(e){var t=e.getUTCDay();return t===0?7:t}function S7(e,t){return Le(fn.count(Ir(e)-1,e),t,2)}function zP(e){var t=e.getUTCDay();return t>=4||t===0?$o(e):$o.ceil(e)}function v7(e,t){return e=zP(e),Le($o.count(Ir(e),e)+(Ir(e).getUTCDay()===4),t,2)}function I7(e){return e.getUTCDay()}function _7(e,t){return Le(fa.count(Ir(e)-1,e),t,2)}function P7(e,t){return Le(e.getUTCFullYear()%100,t,2)}function T7(e,t){return e=zP(e),Le(e.getUTCFullYear()%100,t,2)}function M7(e,t){return Le(e.getUTCFullYear()%1e4,t,4)}function C7(e,t){var r=e.getUTCDay();return e=r>=4||r===0?$o(e):$o.ceil(e),Le(e.getUTCFullYear()%1e4,t,4)}function O7(){return"+0000"}function LP(){return"%"}function VP(e){return+e}function jP(e){return Math.floor(+e/1e3)}var kc,Rc,KP,Do,qP;Pb({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 Pb(e){return kc=_b(e),Rc=kc.format,KP=kc.parse,Do=kc.utcFormat,qP=kc.utcParse,kc}function k7(e){return new Date(e)}function R7(e){return e instanceof Date?+e:+new Date(+e)}function Nm(e,t,r,n,o,i,a,s,c,u){var f=Au(),p=f.invert,l=f.domain,m=u(".%L"),h=u(":%S"),b=u("%I:%M"),y=u("%I %p"),x=u("%a %d"),g=u("%b %d"),S=u("%B"),w=u("%Y");function _(v){return(c(v)t0(e[e.length-1]);var Vm=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(W),jm=ce(Vm);var Um=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(W),Gm=ce(Um);var Bm=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(W),zm=ce(Bm);var Km=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(W),qm=ce(Km);var Yu=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(W),Nc=ce(Yu);var Hm=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(W),Ym=ce(Hm);var Wu=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(W),Ac=ce(Wu);var Wm=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(W),Xm=ce(Wm);var Zm=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(W),Qm=ce(Zm);var Jm=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(W),ed=ce(Jm);var td=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(W),rd=ce(td);var nd=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(W),od=ce(nd);var id=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(W),ad=ce(id);var sd=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(W),cd=ce(sd);var fd=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(W),ud=ce(fd);var ld=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(W),pd=ce(ld);var md=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(W),dd=ce(md);var hd=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(W),gd=ce(hd);var yd=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(W),bd=ce(yd);var xd=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(W),wd=ce(xd);var Sd=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(W),vd=ce(Sd);var Id=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(W),_d=ce(Id);var Pd=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(W),Td=ce(Pd);var Md=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(W),Cd=ce(Md);var Od=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(W),kd=ce(Od);var Rd=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(W),Nd=ce(Rd);var Ad=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(W),Ed=ce(Ad);function Fd(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 $d=pc(Rr(300,.5,0),Rr(-240,.5,1));var Ld=pc(Rr(-100,.75,.35),Rr(80,1.5,.8)),Vd=pc(Rr(260,.75,.35),Rr(80,1.5,.8)),Dd=Rr();function jd(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Dd.h=360*e-100,Dd.s=1.5-1.5*t,Dd.l=.8-.9*t,Dd+""}var Ud=Tn(),N7=Math.PI/3,A7=Math.PI*2/3;function Gd(e){var t;return e=(.5-e)*Math.PI,Ud.r=255*(t=Math.sin(e))*t,Ud.g=255*(t=Math.sin(e+N7))*t,Ud.b=255*(t=Math.sin(e+A7))*t,Ud+""}function Bd(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 zd(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var Kd=zd(W("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),qd=zd(W("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Hd=zd(W("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Yd=zd(W("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ls(e){return function(){return e}}var Db=Math.cos;var Ec=Math.min,Xu=Math.sin,Ve=Math.sqrt,Lb=1e-12,ps=Math.PI,Gye=ps/2,Fc=2*ps;function HP(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 oa(t)}var qye=Array.prototype.slice;function YP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function WP(e){this._context=e}WP.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 ms(e){return new WP(e)}function XP(e){return e[0]}function ZP(e){return e[1]}function Vb(e,t){var r=ls(!0),n=null,o=ms,i=null,a=HP(s);e=typeof e=="function"?e:e===void 0?XP:ls(e),t=typeof t=="function"?t:t===void 0?ZP:ls(t);function s(c){var u,f=(c=YP(c)).length,p,l=!1,m;for(n==null&&(i=o(m=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 Yb=(function e(t){function r(n){return t===1?new cl(n):new rT(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Lc(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 Zd(e,t){this._context=e,this._k=(1-t)/6}Zd.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:Lc(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:Lc(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 Wb=(function e(t){function r(n){return new Zd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Qd(e,t){this._context=e,this._k=(1-t)/6}Qd.prototype={areaStart:An,areaEnd:An,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:Lc(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 Xb=(function e(t){function r(n){return new Qd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Jd(e,t){this._context=e,this._k=(1-t)/6}Jd.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:Lc(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 Zb=(function e(t){function r(n){return new Jd(n,t)}return r.tension=function(n){return e(+n)},r})(0);function fl(e,t,r){var n=e._x1,o=e._y1,i=e._x2,a=e._y2;if(e._l01_a>Lb){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>Lb){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 nT(e,t){this._context=e,this._alpha=t}nT.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:fl(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 Qb=(function e(t){function r(n){return t?new nT(n,t):new Zd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function oT(e,t){this._context=e,this._alpha=t}oT.prototype={areaStart:An,areaEnd:An,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:fl(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 Jb=(function e(t){function r(n){return t?new oT(n,t):new Qd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function iT(e,t){this._context=e,this._alpha=t}iT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._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:fl(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 ex=(function e(t){function r(n){return t?new iT(n,t):new Jd(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function aT(e){this._context=e}aT.prototype={areaStart:An,areaEnd:An,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 tx(e){return new aT(e)}function sT(e){return e<0?-1:1}function cT(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(sT(i)+sT(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function fT(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function rx(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 eh(e){this._context=e}eh.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:rx(this,this._t0,fT(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,rx(this,fT(this,r=cT(this,e,t)),r);break;default:rx(this,this._t0,r=cT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function uT(e){this._context=new lT(e)}(uT.prototype=Object.create(eh.prototype)).point=function(e,t){eh.prototype.point.call(this,t,e)};function lT(e){this._context=e}lT.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 nx(e){return new eh(e)}function ox(e){return new uT(e)}function mT(e){this._context=e}mT.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=pT(e),o=pT(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 ax(e){return new th(e,.5)}function sx(e){return new th(e,0)}function cx(e){return new th(e,1)}function ua(e,t,r){this.k=e,this.x=t,this.y=r}ua.prototype={constructor:ua,scale:function(e){return e===1?this:new ua(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ua(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 fx=new ua(1,0,0);ux.prototype=ua.prototype;function ux(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fx;return e.__zoom}function En(e){return e!=null&&!Number.isNaN(e)}function zr(e,t){return+En(t)-+En(e)||bt(e,t)}function ds(e,t){return+En(t)-+En(e)||_n(e,t)}function ul(e){return e!=null&&`${e}`!=""}function lx(e){return isFinite(e)?e:NaN}function hs(e){return e>0&&isFinite(e)?e:NaN}function Vc(e){return e<0&&isFinite(e)?e:NaN}function rh(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`${U7(e.getUTCFullYear(),4)}-${Ti(e.getUTCMonth()+1,2)}-${Ti(e.getUTCDate(),2)}${r||n||o||i?`T${Ti(r,2)}:${Ti(n,2)}${o||i?`:${Ti(o,2)}${i?`.${Ti(i,3)}`:""}`:""}Z`:""}`}function U7(e){return e<0?`-${Ti(-e,6)}`:e>9999?`+${Ti(e,6)}`:Ti(e,4)}function Ti(e,t){return`${e}`.padStart(t,"0")}var G7=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function ll(e,t){return G7.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Mi(e){if(e==null)return;let t=e[0],r=e[e.length-1];return _n(t,r)}var Uc=1e3,pa=Uc*60,ma=pa*60,Vo=ma*24,Lo=Vo*7,gs=Vo*30,la=Vo*365,px=[["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",Uc],["5 seconds",5*Uc],["15 seconds",15*Uc],["30 seconds",30*Uc],["minute",pa],["5 minutes",5*pa],["15 minutes",15*pa],["30 minutes",30*pa],["hour",ma],["3 hours",3*ma],["6 hours",6*ma],["12 hours",12*ma],["day",Vo],["2 days",2*Vo],["week",Lo],["2 weeks",2*Lo],["month",gs],["3 months",3*gs],["6 months",6*gs],["year",la],["2 years",2*la],["5 years",5*la],["10 years",10*la],["20 years",20*la],["50 years",50*la],["100 years",100*la]],mx=new Map([["second",Uc],["minute",pa],["hour",ma],["day",Vo],["monday",Lo],["tuesday",Lo],["wednesday",Lo],["thursday",Lo],["friday",Lo],["saturday",Lo],["sunday",Lo],["week",Lo],["month",gs],["year",la]]),hT=new Map([["second",Yt],["minute",xi],["hour",Si],["day",kn],["monday",ca],["tuesday",_m],["wednesday",Pm],["thursday",Fo],["friday",Tm],["saturday",Mm],["sunday",cn],["week",cn],["month",Ii],["year",vr]]),dx=new Map([["second",Yt],["minute",wi],["hour",vi],["day",cs],["monday",fa],["tuesday",Cm],["wednesday",Om],["thursday",$o],["friday",km],["saturday",Rm],["sunday",fn],["week",fn],["month",_i],["year",Ir]]),Gc=Symbol("intervalDuration"),oh=Symbol("intervalType");for(let[e,t]of hT)t[Gc]=mx.get(e),t[oh]="time";for(let[e,t]of dx)t[Gc]=mx.get(e),t[oh]="utc";var pl=[["year",Ir,"utc"],["month",_i,"utc"],["day",cs,"utc",6*gs],["hour",vi,"utc",3*Vo],["minute",wi,"utc",6*ma],["second",Yt,"utc",30*pa]],nh=[["year",vr,"time"],["month",Ii,"time"],["day",kn,"time",6*gs],["hour",Si,"time",3*Vo],["minute",xi,"time",6*ma],["second",Yt,"time",30*pa]],B7=[pl[0],nh[0],pl[1],nh[1],pl[2],nh[2],...pl.slice(3)];function gT(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=dx.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 hx(e){return yT(gT(e),"time")}function gx(e){return yT(gT(e),"utc")}function yT([e,t],r){let n=(r==="time"?hT:dx).get(e);return t>1&&(n=n.every(t),n[Gc]=mx.get(e)*t,n[oh]=r),n}function yx(e,t){if(!(t>1))return;let r=e[Gc];if(!px.some(([,o])=>o===r)||r%Vo===0&&VoMath.log(o)).center(px,Math.log(r*t))];return(e[oh]==="time"?hx:gx)(n)}function dT(e,t,r){let n=t==="time"?Rc:Do;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=z7(r);switch(e){case"millisecond":return jc(n(".%L"),n(":%M:%S"),o);case"second":return jc(n(":%S"),n("%-I:%M"),o);case"minute":return jc(n("%-I:%M"),n("%p"),o);case"hour":return jc(n("%-I %p"),n("%b %-d"),o);case"day":return jc(n("%-d"),n("%b"),o);case"month":return jc(n("%b"),n("%Y"),o);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function z7(e){return e==="left"||e==="right"?(t,r)=>` ${t} ${r}`:e==="top"?(t,r)=>`${r} ${t}`:(t,r)=>`${t} -${r}`}function LE(e){return e==="time"?Xd:e==="utc"?al:$E}function mT(e,t,r){let n=Gt(hp(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return fT("millisecond","utc",r);for(let[o,i,a,s]of LE(e)){if(n>s||o==="hour"&&!n)break;if(t.every(c=>i.floor(c)>=c))return fT(o,a,r)}}function Ec(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),c=o-Ti(i);return o!==c&&i[c]!==void 0&&s===t(i[c],c)?a:r(a,s)}}var dx=Object.getPrototypeOf(Uint8Array),VE=Object.prototype.toString;function oo(e){return e instanceof Array||e instanceof dx}function bT(e){return e instanceof dx&&!UE(e)}function yT(e){return e?.prototype instanceof dx&&!jE(e)}function UE(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function jE(e){return e===BigInt64Array||e===BigUint64Array}var hx=Symbol("reindex");function Xt(e,t,r){let n=typeof t;return n==="string"?VT(e)?bx(e.getChild(t),r):dT(e,yx(t),r):n==="function"?dT(e,t,r):n==="number"||t instanceof Date||n==="boolean"?et(e,sn(t),r):typeof t?.transform=="function"?mx(t.transform(e),r):BE(mx(t,r),e?.[hx])}function BE(e,t){return e!=null&&t?Jd(e,t):e}function dT(e,t,r){return et(e,yT(r)?(n,o)=>xx(t(n,o)):t,r)}function mx(e,t){return t===void 0?jo(e):UT(e)?bx(e,t):e instanceof t?e:t.from(e,yT(t)&&!bT(e)?xx:void 0)}function bx(e,t){return e==null?e:(t===void 0||t===Array)&&HE(e.type)?wx(hT(e)):mx(hT(e),t)}function hT(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:jr},It={transform:e=>e};var gT=()=>1,xT=()=>!0,Ot=e=>e==null?e:`${e}`,kt=e=>e==null?e:+e;var gx=e=>e?e[0]:void 0,wT=e=>e?e[1]:void 0;var sn=e=>()=>e;function ST(e){let t=+`${e}`.slice(1)/100;return(r,n)=>ui(r,t,n)}function ms(e){return bT(e)?e:et(e,xx,Float64Array)}function xx(e){return e==null?NaN:Number(e)}function wx(e){return et(e,zE)}function zE(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 Uo(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Uc(e)?[void 0,e]:[e,void 0]}function _t(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function Sx(e,t,r){if(e!=null)return Cr(e,t,r)}function Cr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Mi(e){return VT(e)?e:jo(e)}function jo(e){if(e==null||oo(e))return e;if(UT(e))return bx(e);if(IT(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function IT(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 pa(e,t=Array){return e instanceof t?e.slice():t.from(e)}function _T({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function Ix({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function vT(e){return _T(e)||Ix(e)||e.interval!==void 0}function Bo(e){return e?.toString===VE}function Lc(e){return Bo(e)&&(e.type!==void 0||e.domain!==void 0)}function Vc(e){return Bo(e)&&typeof e.transform!="function"}function ma(e){return Vc(e)&&e.value===void 0&&e.channel===void 0}function PT(e,t,r,n=It){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 Ci(e,t){return e===void 0&&t===void 0?[gx,wT]:[e,t]}function Qd({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=Uo(t)),e===void 0&&([e]=Uo(r)),e}function da(e){return oo(e)?e.length:e?.numRows}function jr(e){let t=da(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):et(t,r=>e.at(r))}function TT(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Nn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cl(e){let t;return[{transform:()=>t,label:ha(e)},r=>t=r]}function MT(e){return e==null?[e]:cl(e)}function ha(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function CT(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return Wt(n)||Wt(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=_x(t?.interval,t?.type);return r?et(e,r):e}function _x(e,t){let r=eh(e,t);return r&&(n=>Rn(n)?r.floor(n):n)}function eh(e,t){if(e!=null){if(typeof e=="number")return GE(e);if(typeof e=="string")return(t==="time"?ux:lx)(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 GE(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 ba(e,t){if(e=eh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function kT(e,t){if(e=ba(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function RT(e){return typeof e?.range=="function"}function ya(e){return e===void 0||Vc(e)?e:{value:e}}function NT(e){return e==null?null:{transform:t=>Xt(t,e,Float64Array),label:ha(e)}}function An(e){return e&&typeof e[Symbol.iterator]=="function"}function th(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function vx(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Wt(e){for(let t of e)if(t!=null)return t instanceof Date}function AT(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&il(t)}function ET(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function FT(e){for(let t of e)if(t!=null)return typeof t=="number"}function rh(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var KE=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 Uc(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)||KE.has(e))}function $T(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Zt(e){return e==null||ds(e)}function ds(e){return/^\s*none\s*$/i.test(e)}function DT(e){return/^\s*round\s*$/i.test(e)}function nh(e,t){return Sx(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ga(e="middle"){return nh(e,"frameAnchor")}function LT(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 qE(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 Px(e){return An(e)?qE(e):e}function oh(e){return e===!0?e="frame":e===!1?e=null:!IT(e)&&e!=null&&(e=Cr(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function VT(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function UT(e){return e&&typeof e.toArray=="function"&&e.type}function HE(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var En=Symbol("position"),cn=Symbol("color"),hs=Symbol("radius"),bs=Symbol("length"),ys=Symbol("opacity"),jc=Symbol("symbol"),jT=Symbol("projection"),He=new Map([["x",En],["y",En],["fx",En],["fy",En],["r",hs],["color",cn],["opacity",ys],["symbol",jc],["length",bs],["projection",jT]]);function BT(e){return e===En||e===jT}function zT(e){return e===En||e===hs||e===bs||e===ys}var YE=Math.sqrt(3),WE=2/YE,XE={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*WE,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()}},Tx=new Map([["asterisk",Ku],["circle",vi],["cross",qu],["diamond",Hu],["diamond2",Yu],["hexagon",XE],["plus",Wu],["square",Xu],["square2",Zu],["star",Qu],["times",kc],["triangle",Ju],["triangle2",el],["wye",tl]]);function Mx(e){return e&&typeof e.draw=="function"}function GT(e){return Mx(e)?!0:typeof e!="string"?!1:Tx.has(e.toLowerCase())}function Bc(e){if(e==null||Mx(e))return e;let t=Tx.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function KT(e){if(e==null||Mx(e))return[void 0,e];if(typeof e=="string"){let t=Tx.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=qT(e)),t!=null&&!ma(t)&&(n=Cx(n,kx(t))),r&&(n=Cx(n,HT))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||ma(t))&&{sort:t},transform:Cx(n,a)}}function Oi({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=qT(e)),t!=null&&!ma(t)&&(n=Ox(n,kx(t))),r&&(n=Ox(n,HT))),{...o,...(t===null||ma(t))&&{sort:t},initializer:Ox(n,i)}}function Cx(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,Mi(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,p;return{data:s=r,facets:c=n,channels:a}=e.call(this,r,n,o,...i),{data:f=s,facets:p=c,channels:u}=t.call(this,s,c,{...o,...a},...i),{data:f,facets:p,channels:{...a,...u}}}}function ZE(e,t){return(e.initializer!=null?Oi:fl)(e,t)}function qT(e){return(t,r)=>{let n=Xt(t,e);return{data:t,facets:r.map(o=>o.filter(i=>n[i]))}}}function HT(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function YT(e,{sort:t,...r}={}){return{...(Vc(e)&&e.channel!==void 0?Oi:ZE)(r,kx(e)),sort:ma(t)?t:null}}function kx(e){return(typeof e=="function"&&e.length!==1?QE:JE)(e)}function QE(e){return(t,r)=>{let n=oo(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 JE(e){let t,r;({channel:t,value:e,order:r}={...ya(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?us:Ur),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Ur;break;case"descending":r=us;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=Xt(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 QT(e,t,r=eF){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Bo(e))return tF(e);if(typeof e=="function")return rF(e);if(/^p\d{2}$/i.test(e))return ki(ST(e));switch(`${e}`.toLowerCase()){case"first":return oF;case"last":return iF;case"identity":return nF;case"count":return XT;case"distinct":return aF;case"sum":return t==null?XT:sF;case"proportion":return ZT(t,"data");case"proportion-facet":return ZT(t,"facet");case"deviation":return ki(cp);case"min":return ki(Pr);case"min-index":return ki(lp);case"max":return ki(Gt);case"max-index":return ki(up);case"mean":return WT(mp);case"median":return WT(Va);case"variance":return ki(Zs);case"mode":return ki(dp)}return r(e)}function eF(e){throw new Error(`invalid reduce: ${e}`)}function tF(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function rF(e){return{reduceIndex(t,r,n){return e(Jd(r,t),n)}}}function ki(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function WT(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return Wt(r)?new Date(n):n}}}var nF={reduceIndex(e,t){return Jd(t,e)}},oF={reduceIndex(e,t){return t[e[0]]}};var iF={reduceIndex(e,t){return t[e[e.length-1]]}},XT={label:"Frequency",reduceIndex(e){return e.length}},aF={label:"Distinct",reduceIndex(e,t){let r=new Zn;for(let n of e)r.add(t[n]);return r.size}},sF=ki(Sn);function ZT(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>Sn(r,i=>n[i])/o}}function zc(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=ha(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),Nx(s,{scale:t,type:r,value:Xt(e,n),label:a,filter:o,hint:i})}function e6(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,zc(t,n,r)]))}function t6(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 Nx(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&&rh(n,Uc)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&rh(n,$T)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&rh(n,GT)?(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 r6(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:p=i,reverse:l=a,reduce:m=s,limit:h=c}=ya(o[u]),b=f?.startsWith("-");if(b&&(f=f.slice(1)),p=p===void 0?b!==(f==="width"||f==="height")?o6:n6:uF(p),m==null||m===!1)continue;let y=u==="fx"||u==="fy"?fF(t,n[u]):cF(r,u);if(!y)throw new Error(`missing channel for scale: ${u}`);let x=y.value,[g=0,_=1/0]=An(h)?h:h<0?[h]:[0,h];if(f==null)y.domain=()=>{let w=Array.from(new Zn(x));return l&&(w=w.reverse()),(g!==0||_!==1/0)&&(w=w.slice(g,_)),w};else{let w=f==="data"?e:f==="height"?JT(r,"y1","y2"):f==="width"?JT(r,"x1","x2"):Rx(r,f,f==="y"?"y2":f==="x"?"x2":void 0),I=QT(m===!0?"max":m,w);y.domain=()=>{let S=Cb(jr(x),v=>I.reduceIndex(v,w),v=>x[v]);return p&&S.sort(p),l&&S.reverse(),(g!==0||_!==1/0)&&(S=S.slice(g,_)),S.map(gx)}}}}function cF(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function fF(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 Rx(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 uF(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return n6;case"descending":return o6}throw new Error(`invalid order: ${e}`)}function n6([e,t],[r,n]){return Ur(t,n)||Ur(e,r)}function o6([e,t],[r,n]){return us(t,n)||Ur(e,r)}function Ax(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var f6=new Map([["accent",Ig],["category10",Sg],["dark2",_g],["observable10",vg],["paired",Pg],["pastel1",Tg],["pastel2",Mg],["set1",Cg],["set2",Og],["set3",kg],["tableau10",Rg]]);function u6(e){return e!=null&&f6.has(`${e}`.toLowerCase())}var i6=new Map([...f6,["brbg",Ri(Nm,Am)],["prgn",Ri(Em,Fm)],["piyg",Ri($m,Dm)],["puor",Ri(Lm,Vm)],["rdbu",Ri(Bu,Tc)],["rdgy",Ri(Um,jm)],["rdylbu",Ri(zu,Mc)],["rdylgn",Ri(Bm,zm)],["spectral",Ri(Gm,Km)],["burd",a6(Bu,Tc)],["buylrd",a6(zu,Mc)],["blues",Qt(bd,yd)],["greens",Qt(gd,xd)],["greys",Qt(wd,Sd)],["oranges",Qt(Td,Md)],["purples",Qt(Id,_d)],["reds",Qt(vd,Pd)],["turbo",Ni($d)],["viridis",Ni(Ld)],["magma",Ni(Vd)],["inferno",Ni(Ud)],["plasma",Ni(jd)],["cividis",Ni(Cd)],["cubehelix",Ni(Od)],["warm",Ni(Rd)],["cool",Ni(Nd)],["bugn",Qt(qm,Hm)],["bupu",Qt(Ym,Wm)],["gnbu",Qt(Xm,Zm)],["orrd",Qt(Qm,Jm)],["pubu",Qt(rd,nd)],["pubugn",Qt(ed,td)],["purd",Qt(od,id)],["rdpu",Qt(ad,sd)],["ylgn",Qt(ud,ld)],["ylgnbu",Qt(cd,fd)],["ylorbr",Qt(pd,md)],["ylorrd",Qt(dd,hd)],["rainbow",s6(Ad)],["sinebow",s6(Fd)]]);function Qt(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?yr(t,r):e[r])}function Ri(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?yr(t,r):e[r])}function a6(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?yr(n=>t(1-n),r):e[r].slice().reverse())}function Ni(e){return({length:t})=>yr(e,Math.max(2,Math.floor(t)))}function s6(e){return({length:t})=>yr(e,Math.floor(t)+1).slice(0,-1)}function Ex(e){let t=`${e}`.toLowerCase();if(!i6.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return i6.get(t)}function ul(e,t){let r=Ex(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function l6(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 c6=new Map([["brbg",Am],["prgn",Fm],["piyg",Dm],["puor",Vm],["rdbu",Tc],["rdgy",jm],["rdylbu",Mc],["rdylgn",zm],["spectral",Km],["burd",e=>Tc(1-e)],["buylrd",e=>Mc(1-e)],["blues",yd],["greens",xd],["greys",Sd],["purples",_d],["reds",Pd],["oranges",Md],["turbo",$d],["viridis",Ld],["magma",Vd],["inferno",Ud],["plasma",jd],["cividis",Cd],["cubehelix",Od],["warm",Rd],["cool",Nd],["bugn",Hm],["bupu",Wm],["gnbu",Zm],["orrd",Jm],["pubugn",td],["pubu",nd],["purd",id],["rdpu",sd],["ylgnbu",fd],["ylgn",ld],["ylorbr",md],["ylorrd",hd],["rainbow",Ad],["sinebow",Fd]]);function Gc(e){let t=`${e}`.toLowerCase();if(!c6.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return c6.get(t)}var lF=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function p6(e){return e!=null&&lF.has(`${e}`.toLowerCase())}var $x=e=>t=>e(1-t),Fx=[0,1],m6=new Map([["number",ct],["rgb",vn],["hsl",ry],["hcl",ny],["lab",Rp]]);function Dx(e){let t=`${e}`.toLowerCase();if(!m6.has(t))throw new Error(`unknown interpolator: ${t}`);return m6.get(t)}function qc(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=I6(e,r),unknown:c,round:u,scheme:f,interval:p,range:l=He.get(e)===hs?hF(r,s):He.get(e)===bs?bF(r,s):He.get(e)===ys?Fx:void 0,interpolate:m=He.get(e)===cn?f==null&&l!==void 0?vn:Gc(f!==void 0?f:n==="cyclical"?"rainbow":"turbo"):u?qa:ct,reverse:h}){if(s=d6(s),p=ba(p,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof m!="function"&&(m=Dx(m)),h=!!h,l!==void 0){let b=s.length,y=(l=d6(l)).length;if(b!==y){if(m.length===1)throw new Error("invalid piecewise interpolator");m=To(m,l),l=void 0}}if(m.length===1?(h&&(m=$x(m),h=!1),l===void 0&&(l=Float64Array.from(s,(b,y)=>y/(s.length-1)),l.length===2&&(l=Fx)),t.interpolate((l===Fx?sn:ll)(m))):t.interpolate(m),a){let[b,y]=Lr(s);(b>0||y<0)&&(s=pa(s),(Ti(s)||1)===Math.sign(b)?s[0]=0:s[s.length-1]=0)}return h&&(s=Zi(s)),t.domain(s).unknown(c),o&&(t.nice(pF(o,n)),s=t.domain()),l!==void 0&&t.range(l),i&&t.clamp(i),{type:n,domain:s,range:l,scale:t,interpolate:m,interval:p}}function d6(e){return e=jo(e),e.length>=2?e:[e[0],e[0]]}function pF(e,t){return e===!0?void 0:typeof e=="number"?e:kT(e,t)}function h6(e,t,r){return qc(e,es(),t,r)}function b6(e,t,r){return Lx(e,t,{...r,exponent:.5})}function Lx(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=yF(t),...o}){return qc(e,ku().base(r),t,{...o,domain:n})}function g6(e,t,{constant:r=1,...n}){return qc(e,Ru().constant(r),t,n)}function x6(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=gF(t),unknown:s,interpolate:c,reverse:u}){return r===void 0&&(r=c!==void 0?yr(c,o):He.get(e)===cn?ul(i,o):void 0),a.length>0&&(a=Au(a,r===void 0?{length:o}:r).quantiles()),ih(e,t,{domain:a,range:r,reverse:u,unknown:s})}function w6(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=I6(e,t),unknown:a,interpolate:s,reverse:c}){let[u,f]=Lr(i),p;return r===void 0?(p=fi(u,f,n),p[0]<=u&&p.splice(0,1),p[p.length-1]>=f&&p.pop(),n=p.length+1,r=s!==void 0?yr(s,n):He.get(e)===cn?ul(o,n):void 0):(p=yr(ct(u,f),n+1).slice(1,-1),u instanceof Date&&(p=p.map(l=>new Date(l)))),Ti(jo(i))<0&&p.reverse(),ih(e,t,{domain:p,range:r,reverse:c,unknown:a})}function ih(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?yr(i,r.length+1):He.get(e)===cn?ul(o,r.length+1):void 0,reverse:s}){r=jo(r);let c=Ti(r);if(!isNaN(c)&&!mF(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=Zi(a)),{type:"threshold",scale:Eu(c<0?Zi(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function mF(e,t){for(let r=1,n=e.length,o=e[0];rt}}function Kc(e,t=ax){return e.length?[Pr(e,({value:r})=>r===void 0?r:Pr(r,t)),Gt(e,({value:r})=>r===void 0?r:Gt(r,t))]:[0,1]}function I6(e,t){let r=He.get(e);return(r===hs||r===ys||r===bs?dF:Kc)(t)}function dF(e){return[0,e.length?Gt(e,({value:t})=>t===void 0?t:Gt(t,ax)):1]}function hF(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=ui(e,.5,({value:a})=>a===void 0?NaN:ui(a,.25,ls)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/Gt(o);return i<1?o.map(a=>a*i):o}function bF(e,t){let r=Va(e,({value:i})=>i===void 0?NaN:Va(i,Math.abs)),n=t.map(i=>12*i/r),o=60/Gt(n);return o<1?n.map(i=>i*o):n}function yF(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Kc(e,ls);if(r<0)return Kc(e,Ac)}return[1,10]}function gF(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 Vx=0,Ux;function _6(){let e=Vx;return Vx=0,Ux=void 0,e}function Br(e){e!==Ux&&(Ux=e,console.warn(e),++Vx)}function ah(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=Kc(n),unknown:c,pivot:u=0,scheme:f,range:p,symmetric:l=!0,interpolate:m=He.get(e)===cn?f==null&&p!==void 0?vn:Gc(f!==void 0?f:"rdbu"):ct,reverse:h}){u=+u,s=jo(s);let[b,y]=s;if(s.length>2&&Br(`Warning: the diverging ${e} scale domain contains extra elements.`),wn(b,y)<0&&([b,y]=[y,b],h=!h),b=Math.min(b,u),y=Math.max(y,u),typeof m!="function"&&(m=Dx(m)),p!==void 0&&(m=m.length===1?ll(m)(...p):To(m,p)),h&&(m=$x(m)),l){let x=r.apply(u),g=x-r.apply(b),_=r.apply(y)-x;g<_?b=r.invert(x-_):g>_&&(y=r.invert(x+g))}return t.domain([b,u,y]).unknown(c).interpolator(m),a&&t.clamp(a),i&&t.nice(i),{type:o,domain:[b,y],pivot:u,interpolate:m,scale:t}}function v6(e,t,r){return ah(e,ju(),xF,t,r)}function P6(e,t,r){return jx(e,t,{...r,exponent:.5})}function jx(e,t,{exponent:r=1,...n}){return ah(e,Rm().exponent(r=+r),IF(r),t,{...n,type:"diverging-pow"})}function T6(e,t,{base:r=10,pivot:n=1,domain:o=Kc(t,n<0?Ac:ls),...i}){return ah(e,Om().base(r=+r),wF,t,{domain:o,pivot:n,...i})}function M6(e,t,{constant:r=1,...n}){return ah(e,km().constant(r=+r),_F(r),t,n)}var xF={apply(e){return e},invert(e){return e}},wF={apply:Math.log,invert:Math.exp},SF={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function IF(e){return e===.5?SF:{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 _F(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 C6(e,t,r,n){return qc(e,t,r,n)}function O6(e,t,r){return C6(e,Tm(),t,r)}function k6(e,t,r){return C6(e,Mm(),t,r)}var Hc=Symbol("ordinal");function N6(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:c}){return o=ba(o,n),i===void 0&&(i=D6(r,o,e)),(n==="categorical"||n===Hc)&&(n="ordinal"),s&&(i=Zi(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 A6(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...c}){n=ba(n,r),o===void 0&&(o=D6(t,n,e));let u;if(He.get(e)===jc)u=vF(t),i=i===void 0?PF(u):et(i,Bc);else if(He.get(e)===cn&&(i===void 0&&(r==="ordinal"||r===Hc)&&(i=l6(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),p=i[0],l=i[1]-i[0];i=({length:m})=>yr(h=>f(p+l*h),m)}else i=Ex(a);if(s===Tu)throw new Error(`implicit unknown on ${e} scale is not supported`);return N6(e,Qa().unknown(s),t,{...c,type:r,domain:o,range:i,hint:u})}function E6(e,t,{align:r=.5,padding:n=.5,...o}){return $6(og().align(r).padding(n),t,o,e)}function F6(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return $6(ia().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function $6(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=N6(n,e,t,r),e.round=o,e}function D6(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]=Lr(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&He.get(r)===En)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Xi(n,Ur)}function R6(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 vF(e){return{fill:R6(e,"fill"),stroke:R6(e,"stroke")}}function PF(e){return Zt(e.fill)?Vg:zd}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:p,padding:l,projection:m,facet:{label:h=t}={},...b}={}){let y={};for(let[x,g]of e){let _=b[x],w=CF(x,g,{round:He.get(x)===En?s:void 0,nice:c,clamp:u,zero:f,align:p,padding:l,projection:m,..._});if(w){let{label:I=x==="fx"||x==="fy"?h:t,percent:S,transform:v,inset:M,insetTop:C=M!==void 0?M:x==="y"?n:0,insetRight:R=M!==void 0?M:x==="x"?o:0,insetBottom:O=M!==void 0?M:x==="y"?i:0,insetLeft:N=M!==void 0?M:x==="x"?a:0}=_||{};if(v==null)v=void 0;else if(typeof v!="function")throw new Error("invalid scale transform; not a function");w.percent=!!S,w.label=I===void 0?TF(g,w):I,w.transform=v,x==="x"||x==="fx"?(w.insetLeft=+N,w.insetRight=+R):(x==="y"||x==="fy")&&(w.insetTop=+C,w.insetBottom=+O),y[x]=w}}return y}function zx(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]=NF(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),c!=null&&(i.label=c)}return r}function B6(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?ch(t):t;o&&L6(o,a),i&&V6(i,a);let s=o||i?Gx(e,t):t;r&&L6(r,s),n&&V6(n,s)}function TF(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!zo(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function z6(e){return Math.sign(Ti(e.domain()))*Math.sign(Ti(e.range()))}function ch(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 Gx({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=ch(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 L6(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)],zo(e)||(e.range=K6(e)),e.scale.range(e.range)}G6(e)}function V6(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],zo(e)?e.range.reverse():e.range=K6(e),e.scale.range(e.range)}G6(e)}function G6(e){e.round===void 0&&kF(e)&&MF(e)<=30&&e.scale.round(!0)}function MF({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 K6(e){let t=e.scale.domain().length+Kx(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 CF(e,t=[],r={}){let n=OF(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&zo({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(Wt)?Br(`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(AT)?Br(`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(ET)&&Br(`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=sh(t,r,ms);break;case"identity":switch(He.get(e)){case En:r=sh(t,r,ms);break;case jc:r=sh(t,r,RF);break}break;case"utc":case"time":r=sh(t,r,wx);break}switch(n){case"diverging":return v6(e,t,r);case"diverging-sqrt":return P6(e,t,r);case"diverging-pow":return jx(e,t,r);case"diverging-log":return T6(e,t,r);case"diverging-symlog":return M6(e,t,r);case"categorical":case"ordinal":case Hc:return A6(e,t,r);case"cyclical":case"sequential":case"linear":return h6(e,t,r);case"sqrt":return b6(e,t,r);case"threshold":return ih(e,t,r);case"quantile":return x6(e,t,r);case"quantize":return w6(e,t,r);case"pow":return Lx(e,t,r);case"log":return y6(e,t,r);case"symlog":return g6(e,t,r);case"utc":return k6(e,t,r);case"time":return O6(e,t,r);case"point":return E6(e,t,r);case"band":return F6(e,t,r);case"identity":return S6(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Yc(e){return typeof e=="symbol"?e.description:e}function U6(e){return typeof e=="string"?`${e}`.toLowerCase():e}var j6={toString:()=>"projection"};function OF(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=U6(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=j6);for(let f of t){let p=U6(f.type);if(p!==void 0){if(r===void 0)r=p;else if(r!==p)throw new Error(`scale incompatible with channel: ${r} !== ${p}`)}}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===hs)return"sqrt";if(c===ys||c===bs)return"linear";if(c===jc)return"ordinal";let u=(n??o)?.length;if(u<2||u>2)return Bx(c);if(n!==void 0){if(vx(n))return Bx(c);if(Wt(n))return"utc"}else{let f=t.map(({value:p})=>p).filter(p=>p!==void 0);if(f.some(vx))return Bx(c);if(f.some(Wt))return"utc"}if(c===cn){if(a!=null||p6(i))return"diverging";if(u6(i))return"categorical"}return"linear"}function Bx(e){switch(e){case En:return"point";case cn:return Hc;default:return"ordinal"}}function zo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Hc}function Kx({type:e}){return e==="threshold"}function kF({type:e}){return e==="point"||e==="band"}function xa(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 NF({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:pa(r),...n!==void 0&&{range:pa(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 Y6(e,t){let{fx:r,fy:n}=pl(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?ap(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 W6(e,{x:t,y:r}){return t&&=Xx(t),r&&=Xx(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 uh(e,{fx:t,fy:r}){let n=jr(e),o=t?.value,i=r?.value;return t&&r?So(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?So(n,a=>(a.fx=o[a[0]],a),a=>o[a]):So(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function X6(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 Z6(e){let t=[],r=new Uint32Array(Sn(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 AF=new Map([["top",qx],["right",Wx],["bottom",Hx],["left",Yx],["top-left",fh(qx,Yx)],["top-right",fh(qx,Wx)],["bottom-left",fh(Hx,Yx)],["bottom-right",fh(Hx,Wx)],["top-empty",FF],["right-empty",LF],["bottom-empty",$F],["left-empty",DF],["empty",VF]]);function Q6(e){if(e==null)return null;let t=AF.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var H6=new WeakMap;function Xx(e){let t=H6.get(e);return t||H6.set(e,t=new vr(et(e,(r,n)=>[r,n]))),t}function wa(e,t){return Xx(e).get(t)}function EF(e,t,r){return t=Nn(t),r=Nn(r),e.find(n=>Object.is(Nn(n.x),t)&&Object.is(Nn(n.y),r))}function lh(e,t,r){return EF(e,t,r)?.empty}function qx(e,{y:t},{y:r}){return t?wa(t,r)===0:!0}function Hx(e,{y:t},{y:r}){return t?wa(t,r)===t.length-1:!0}function Yx(e,{x:t},{x:r}){return t?wa(t,r)===0:!0}function Wx(e,{x:t},{x:r}){return t?wa(t,r)===t.length-1:!0}function FF(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=wa(t,n);if(i>0)return lh(e,r,t[i-1])}function $F(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=wa(t,n);if(i0)return lh(e,t[i-1],n)}function LF(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=wa(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var J6=Math.PI,Ai=2*J6,Zx=.618;function eM({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(Bo(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}=Qx(e));let{width:f,height:p,marginLeft:l,marginRight:m,marginTop:h,marginBottom:b}=a,y=f-l-m-i-n,x=p-h-b-r-o;if(e=e?.({width:y,height:x,clip:u,...s}),e==null)return;u=UF(u,l,h,f-m,p-b);let g=l+i,_=h+r,w;if(c!=null){let[[I,S],[v,M]]=yc(e).bounds(c),C=Math.min(y/(v-I),x/(M-S));C>0?(g-=(C*(I+v)-y)/2,_-=(C*(S+M)-x)/2,w=gc({point(R,O){this.stream.point(R*C+g,O*C+_)}})):Br("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=g===0&&_===0?tM():gc({point(I,S){this.stream.point(I+g,S+_)}}),{stream:I=>e.stream(w.stream(u(I)))}}function Qx(e){switch(`${e}`.toLowerCase()){case"albers-usa":return io(Ly,.7463,.4673);case"albers":return mh(wu,.7463,.4673);case"azimuthal-equal-area":return io(Uy,4,4);case"azimuthal-equidistant":return io(By,Ai,Ai);case"conic-conformal":return mh(Ky,Ai,Ai);case"conic-equal-area":return mh(oa,6.1702,2.9781);case"conic-equidistant":return mh(Hy,7.312,3.6282);case"equal-earth":return io(Wy,5.4133,2.6347);case"equirectangular":return io(qy,Ai,J6);case"gnomonic":return io(Zy,3.4641,3.4641);case"identity":return{type:tM};case"reflect-y":return{type:jF};case"mercator":return io(zy,Ai,Ai);case"orthographic":return io(Jy,2,2);case"stereographic":return io(tg,2,2);case"transverse-mercator":return io(ng,Ai,Ai);default:throw new Error(`unknown projection type: ${e}`)}}function UF(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 io(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 mh(e,t,r){let{type:n,aspectRatio:o}=io(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 tM=sn({stream:e=>e}),jF=sn(gc({point(e,t){this.stream.point(e,-t)}}));function rM(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(p,l){s[u]=p,c[u]=l}});for(u=0;u5?5:c:Zx}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=Qx(e);if(t)return t}return Zx}}function iM(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)ro(a,i);return[n,o]}function aM({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:oh(r)}}function Ge(e,{document:t}){return In(pi(e).call(t.documentElement))}var dh=Symbol("unset");function hh(e){return(e.length===1?BF:zF)(e)}function BF(e){let t,r=dh;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function zF(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 GF=hh(e=>new Intl.NumberFormat(e)),swe=hh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),cwe=hh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function KF(e="en-US"){let t=GF(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function qF(e){return Wd(e,"Invalid Date")}function HF(e="en-US"){let t=KF(e);return r=>(r instanceof Date?qF:typeof r=="number"?t:Ot)(r)}var Go=HF();var fr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,YF=0;function cM(){return`plot-clip-${++YF}`}function fM(e,{title:t,href:r,ariaLabel:n,ariaDescription:o,ariaHidden:i,target:a,fill:s,fillOpacity:c,stroke:u,strokeWidth:f,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:m,strokeMiterlimit:h,strokeDasharray:b,strokeDashoffset:y,opacity:x,mixBlendMode:g,imageFilter:_,paintOrder:w,pointerEvents:I,shapeRendering:S,channels:v},{ariaLabel:M,fill:C="currentColor",fillOpacity:R,stroke:O="none",strokeOpacity:N,strokeWidth:z,strokeLinecap:j,strokeLinejoin:k,strokeMiterlimit:B,paintOrder:V}){C===null&&(s=null,c=null),O===null&&(u=null,p=null),Zt(C)?!Zt(O)&&(!Zt(s)||v?.fill)&&(O="none"):Zt(O)&&(!Zt(u)||v?.stroke)&&(C="none");let[Q,U]=Uo(s,C),[K,W]=_t(c,R),[Z,X]=Uo(u,O),[he,se]=_t(p,N),[ce,Y]=_t(x);ds(X)||(f===void 0&&(f=z),m===void 0&&(m=j),l===void 0&&(l=k),h===void 0&&!DT(l)&&(h=B),!ds(U)&&w===void 0&&(w=V));let[ee,T]=_t(f);return C!==null&&(e.fill=vt(U,"currentColor"),e.fillOpacity=ml(W,1)),O!==null&&(e.stroke=vt(X,"none"),e.strokeWidth=ml(T,1),e.strokeOpacity=ml(se,1),e.strokeLinejoin=vt(l,"miter"),e.strokeLinecap=vt(m,"butt"),e.strokeMiterlimit=ml(h,4),e.strokeDasharray=vt(b,"none"),e.strokeDashoffset=vt(y,"0")),e.target=Ot(a),e.ariaLabel=Ot(M),e.ariaDescription=Ot(o),e.ariaHidden=Ot(i),e.opacity=ml(Y,1),e.mixBlendMode=vt(g,"normal"),e.imageFilter=vt(_,"none"),e.paintOrder=vt(w,"normal"),e.pointerEvents=vt(I,"auto"),e.shapeRendering=vt(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:Q,scale:"auto",optional:!0},fillOpacity:{value:K,scale:"auto",optional:!0},stroke:{value:Z,scale:"auto",optional:!0},strokeOpacity:{value:he,scale:"auto",optional:!0},strokeWidth:{value:ee,optional:!0},opacity:{value:ce,scale:"auto",optional:!0}}}function WF(e,t){t&&e.filter(r=>ol(t[r])).append("title").call(ZF,t)}function XF(e,t){t&&e.filter(([r])=>ol(t[r])).append("title").call(QF,t)}function ZF(e,t){t&&e.text(r=>Go(t[r]))}function QF(e,t){t&&e.text(([r])=>Go(t[r]))}function zr(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:p}){n&&me(e,"aria-label",l=>n[l]),i&&me(e,"fill",l=>i[l]),a&&me(e,"fill-opacity",l=>a[l]),s&&me(e,"stroke",l=>s[l]),c&&me(e,"stroke-opacity",l=>c[l]),u&&me(e,"stroke-width",l=>u[l]),f&&me(e,"opacity",l=>f[l]),p&&pM(e,l=>p[l],t),r||WF(e,o)}function uM(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:p}){n&&me(e,"aria-label",([l])=>n[l]),i&&me(e,"fill",([l])=>i[l]),a&&me(e,"fill-opacity",([l])=>a[l]),s&&me(e,"stroke",([l])=>s[l]),c&&me(e,"stroke-opacity",([l])=>c[l]),u&&me(e,"stroke-width",([l])=>u[l]),f&&me(e,"opacity",([l])=>f[l]),p&&pM(e,([l])=>p[l],t),r||XF(e,o)}function JF({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 e9(e,t,r){let n=ci(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&Br("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*lM(e,t,r,n){let{z:o}=r,{z:i}=n,a=JF(n,r),s=[...t,...a];for(let c of i?e9(e,i,o):[e]){let u,f;e:for(let p of c){for(let l of s)if(!Rn(l[p])){f&&f.push(-1);continue e}if(u===void 0){f&&(yield f),u=a.map(l=>Nn(l[p])),f=[p];continue}f.push(p);for(let l=0;lNn(h[p])),f=[p];continue e}}f&&(yield f)}}function t9(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=Ge("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=n9(n,r)):i&&(o=i9(i,n)),me(e,"aria-label",t.ariaLabel),me(e,"aria-description",t.ariaDescription),me(e,"aria-hidden",t.ariaHidden),me(e,"clip-path",o)}function r9(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=cM();In(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var n9=r9((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)}),sM=new WeakMap,o9={type:"Sphere"};function i9(e,t){let r,n;if((r=sM.get(t))||sM.set(t,r=new WeakMap),e.type==="Sphere"&&(e=o9),!(n=r.get(e))){let o=cM();In(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function ur(e,t,r,n){t9(e,t,r,n),me(e,"class",t.className),me(e,"fill",t.fill),me(e,"fill-opacity",t.fillOpacity),me(e,"stroke",t.stroke),me(e,"stroke-width",t.strokeWidth),me(e,"stroke-opacity",t.strokeOpacity),me(e,"stroke-linejoin",t.strokeLinejoin),me(e,"stroke-linecap",t.strokeLinecap),me(e,"stroke-miterlimit",t.strokeMiterlimit),me(e,"stroke-dasharray",t.strokeDasharray),me(e,"stroke-dashoffset",t.strokeDashoffset),me(e,"shape-rendering",t.shapeRendering),me(e,"filter",t.imageFilter),me(e,"paint-order",t.paintOrder);let{pointerEvents:o=n.pointerSticky===!1?"none":void 0}=t;me(e,"pointer-events",o)}function Jt(e,t){a9(e,"mix-blend-mode",t.mixBlendMode),me(e,"opacity",t.opacity)}function pM(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS(Io.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Io.xlink,"href",o),r!=null&&i.setAttribute("target",r),this.parentNode.insertBefore(i,this).appendChild(this)}})}function me(e,t,r){r!=null&&e.attr(t,r)}function a9(e,t,r){r!=null&&e.style(t,r)}function lr(e,t,{x:r,y:n},o=fr,i=fr){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 vt(e,t){if((e=Ot(e))!==t)return e}function ml(e,t){if((e=kt(e))!==t)return e}var s9=/^-?([_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}`,!s9.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 Ko({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 pt=class{constructor(t,r={},n={},o){let{facet:i="auto",facetAnchor:a,fx:s,fy:c,sort:u,dx:f=0,dy:p=0,margin:l=0,marginTop:m=l,marginRight:h=l,marginBottom:b=l,marginLeft:y=l,className:x,clip:g=o?.clip,channels:_,tip:w,render:I}=n;if(this.data=t,this.sort=ma(u)?u:null,this.initializer=Oi(n).initializer,this.transform=this.initializer?n.transform:fl(n).transform,i===null||i===!1?this.facet=null:(this.facet=Cr(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=Q6(a),r=Px(r),_!==void 0&&(r={...c9(_),...r}),o!==void 0&&(r={...fM(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([S,v])=>{if(Vc(v.value)){let{value:M,label:C=v.label,scale:R=v.scale}=v.value;v={...v,label:C,scale:R,value:M}}if(t===Dc&&typeof v.value=="string"){let{value:M}=v;v={...v,value:[M]}}return[S,v]}).filter(([S,{value:v,optional:M}])=>{if(v!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${S}`)})),this.dx=+f,this.dy=+p,this.marginTop=+m,this.marginRight=+h,this.marginBottom=+b,this.marginLeft=+y,this.clip=oh(g),this.tip=f9(w),this.className=Ot(x),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=e1(I,this.render))}initialize(t,r,n){let o=Mi(this.data);t===void 0&&o!=null&&(t=[jr(o)]);let i=t;this.transform!=null&&({facets:t,data:o}=this.transform(o,t,n),o=Mi(o)),t!==void 0&&(t.original=i);let a=e6(this.channels,o);return this.sort!=null&&r6(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=Rn}=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"&&rM(o,i,r,n.projection)}}scale(t,r,n){let o=t6(t,r);return n.projection&&this.project(t,o,n),o}};function Jx(...e){return e.plot=pt.prototype.plot,e}function e1(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,p,l)=>t.call(this,c,u,f,p,l,s))}}function c9(e){return Object.fromEntries(Object.entries(Px(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:ya(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function f9(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Cr(e,"tip",["x","y","xy"]):e}function dl(e,t){return e?.tip===!0?{...e,tip:t}:Bo(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function dM(e,t,r={}){let n=.5-fr,o=.5+fr,i=.5+fr,a=.5-fr;for(let{marginTop:b,marginRight:y,marginBottom:x,marginLeft:g}of t)b>n&&(n=b),y>o&&(o=y),x>i&&(i=x),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:p=s!==void 0?s:a}=r;c=+c,u=+u,f=+f,p=+p;let{width:l=640,height:m=u9(e,r,{width:l,marginTopDefault:n,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,c-n+f-i)}=r;l=+l,m=+m;let h={width:l,height:m,marginTop:c,marginRight:u,marginBottom:f,marginLeft:p};if(e.fx||e.fy){let{margin:b,marginTop:y=b!==void 0?b:c,marginRight:x=b!==void 0?b:u,marginBottom:g=b!==void 0?b:f,marginLeft:_=b!==void 0?b:p}=r.facet??{};y=+y,x=+x,g=+g,_=+_,h.facet={marginTop:y,marginRight:x,marginBottom:g,marginLeft:_}}return h}function u9({x:e,y:t,fy:r,fx:n},{projection:o,aspectRatio:i},{width:a,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:u,marginLeftDefault:f}){let p=r&&r.scale.domain().length||1,l=oM(o);if(l){let h=n?n.scale.domain().length:1,b=(1.1*p-.1)/(1.1*h-.1)*l,y=Math.max(.1,Math.min(10,b));return Math.round((a-f-c)*y+s+u)}let m=t?zo(t)?t.scale.domain().length||1:Math.max(7,17/p):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=mM("y",t)/(mM("x",e)*i),b=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,x=b*(a-f-c)-e.insetLeft-e.insetRight;return(h*x+t.insetTop+t.insetBottom)/y+s+u}return!!(t||r)*Math.max(1,Math.min(60,m*p))*20+!!n*30+60}function mM(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]=Lr(n);return Math.abs(o(a)-o(i))}var hM=new WeakMap;function t1(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:e1(function(f,p,l,m,h,b){h={...h,pointerSticky:!1};let y=h.ownerSVGElement,{data:x}=h.getMarkState(this),g=hM.get(y);g||hM.set(y,g={sticky:!1,roots:[],renders:[]});let _=g.renders.push(X)-1,{x:w,y:I,fx:S,fy:v}=p,M=S?S(f.fx)-m.marginLeft:0,C=v?v(f.fy)-m.marginTop:0;w?.bandwidth&&(M+=w.bandwidth()/2),I?.bandwidth&&(C+=I.bandwidth()/2);let R=f.fi!=null,O;if(R){let Y=g.facetStates;Y||(g.facetStates=Y=new Map),O=Y.get(this),O||Y.set(this,O=new Map)}let[N,z]=Ko(this,m),{px:j,py:k}=l,B=j?Y=>j[Y]:n1(l,N),V=k?Y=>k[Y]:o1(l,z),Q,U,K,W;function Z(Y,ee){if(R)if(W&&(W=cancelAnimationFrame(W)),Y==null)O.delete(f.fi);else{O.set(f.fi,ee),W=requestAnimationFrame(()=>{W=null;for(let[T,L]of O)if(L1)){let L=Q==null?null:oo(x)?x[Q]:x.get(Q);h.dispatchValue(L)}return T}function he(Y){if(g.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[ee,T]=jb(Y);ee-=M,T-=C;let L=eem.width-m.marginRight?1:e,G=Tm.height-m.marginBottom?1:t,A=null,te=a*a;for(let ae of f){let Oe=L*(B(ae)-ee),_e=G*(V(ae)-T),tt=Oe*Oe+_e*_e;tt<=te&&(A=ae,te=tt)}if(A!=null&&(e!==1||t!==1)){let ae=B(A)-ee,Oe=V(A)-T;te=ae*ae+Oe*Oe}Z(A,te)}function se(Y){Y.pointerType==="mouse"&&Q!=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,X(Q)),Y.stopImmediatePropagation()))}function ce(Y){Y.pointerType==="mouse"&&(g.sticky||Z(null))}return y.addEventListener("pointerenter",he),y.addEventListener("pointermove",he),y.addEventListener("pointerdown",se),y.addEventListener("pointerleave",ce),X(null)},c)}}function bM(e){return t1(1,1,e)}function yM(e){return t1(1,.01,e)}function r1(e){return t1(.01,1,e)}function n1({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function o1({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function bh(e){return zo(e)&&e.interval===void 0?void 0:"tabular-nums"}function gM(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:p=(o-u-s)/64,tickFormat:l,fontVariant:m=bh(e),round:h=!0,opacity:b,className:y}=t,x=Wc(t);y=Xc(y),b=_t(b)[1],l===null&&(l=()=>null);let g=Ge("svg",x).attr("class",`${y}-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(N=>N.append("style").text(`:where(.${y}-ramp) { +${r}`}function K7(e){return e==="time"?nh:e==="utc"?pl:B7}function bT(e,t,r){let n=Kt(vp(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return dT("millisecond","utc",r);for(let[o,i,a,s]of K7(e)){if(n>s||o==="hour"&&!n)break;if(t.every(c=>i.floor(c)>=c))return dT(o,a,r)}}function jc(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),c=o-Mi(i);return o!==c&&i[c]!==void 0&&s===t(i[c],c)?a:r(a,s)}}var xx=Object.getPrototypeOf(Uint8Array),q7=Object.prototype.toString;function ao(e){return e instanceof Array||e instanceof xx}function ST(e){return e instanceof xx&&!H7(e)}function vT(e){return e?.prototype instanceof xx&&!Y7(e)}function H7(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function Y7(e){return e===BigInt64Array||e===BigUint64Array}var wx=Symbol("reindex");function Zt(e,t,r){let n=typeof t;return n==="string"?zT(e)?Sx(e.getChild(t),r):xT(e,vx(t),r):n==="function"?xT(e,t,r):n==="number"||t instanceof Date||n==="boolean"?tt(e,un(t),r):typeof t?.transform=="function"?bx(t.transform(e),r):W7(bx(t,r),e?.[wx])}function W7(e,t){return e!=null&&t?ah(e,t):e}function xT(e,t,r){return tt(e,vT(r)?(n,o)=>_x(t(n,o)):t,r)}function bx(e,t){return t===void 0?Uo(e):KT(e)?Sx(e,t):e instanceof t?e:t.from(e,vT(t)&&!ST(e)?_x:void 0)}function Sx(e,t){return e==null?e:(t===void 0||t===Array)&&eF(e.type)?Px(wT(e)):bx(wT(e),t)}function wT(e){return e.nullCount?e.toJSON():e.toArray()}var Bc=[null],vx=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},ml={transform:Kr},It={transform:e=>e};var IT=()=>1,_T=()=>!0,Ot=e=>e==null?e:`${e}`,kt=e=>e==null?e:+e;var Ix=e=>e?e[0]:void 0,PT=e=>e?e[1]:void 0;var un=e=>()=>e;function TT(e){let t=+`${e}`.slice(1)/100;return(r,n)=>li(r,t,n)}function ys(e){return ST(e)?e:tt(e,_x,Float64Array)}function _x(e){return e==null?NaN:Number(e)}function Px(e){return tt(e,X7)}function X7(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?ll(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function jo(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:qc(e)?[void 0,e]:[e,void 0]}function _t(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function Tx(e,t,r){if(e!=null)return Ar(e,t,r)}function Ar(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Ci(e){return zT(e)?e:Uo(e)}function Uo(e){if(e==null||ao(e))return e;if(KT(e))return Sx(e);if(MT(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function MT(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 tt(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function da(e,t=Array){return e instanceof t?e.slice():t.from(e)}function CT({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function Mx({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function OT(e){return CT(e)||Mx(e)||e.interval!==void 0}function Go(e){return e?.toString===q7}function zc(e){return Go(e)&&(e.type!==void 0||e.domain!==void 0)}function Kc(e){return Go(e)&&typeof e.transform!="function"}function ha(e){return Kc(e)&&e.value===void 0&&e.channel===void 0}function kT(e,t,r,n=It){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 Oi(e,t){return e===void 0&&t===void 0?[Ix,PT]:[e,t]}function ih({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=jo(t)),e===void 0&&([e]=jo(r)),e}function ga(e){return ao(e)?e.length:e?.numRows}function Kr(e){let t=ga(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):tt(t,r=>e.at(r))}function RT(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Fn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function dl(e){let t;return[{transform:()=>t,label:ya(e)},r=>t=r]}function NT(e){return e==null?[e]:dl(e)}function ya(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function AT(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return Xt(n)||Xt(o)?tt(n,(i,a)=>new Date((+n[a]+ +o[a])/2)):tt(n,(i,a)=>(+n[a]+ +o[a])/2,Float64Array)},label:e.label}}function ET(e,t){let r=Cx(t?.interval,t?.type);return r?tt(e,r):e}function Cx(e,t){let r=sh(e,t);return r&&(n=>En(n)?r.floor(n):n)}function sh(e,t){if(e!=null){if(typeof e=="number")return Z7(e);if(typeof e=="string")return(t==="time"?hx:gx)(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 Z7(e){e=+e,0Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>za(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)=>za(Math.ceil(r/t),n/t).map(o=>o*t)}}function ba(e,t){if(e=sh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function FT(e,t){if(e=ba(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function $T(e){return typeof e?.range=="function"}function xa(e){return e===void 0||Kc(e)?e:{value:e}}function DT(e){return e==null?null:{transform:t=>Zt(t,e,Float64Array),label:ya(e)}}function $n(e){return e&&typeof e[Symbol.iterator]=="function"}function ch(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ox(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Xt(e){for(let t of e)if(t!=null)return t instanceof Date}function LT(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&ll(t)}function VT(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function jT(e){for(let t of e)if(t!=null)return typeof t=="number"}function fh(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var Q7=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 qc(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)||Q7.has(e))}function UT(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Qt(e){return e==null||bs(e)}function bs(e){return/^\s*none\s*$/i.test(e)}function GT(e){return/^\s*round\s*$/i.test(e)}function uh(e,t){return Tx(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function wa(e="middle"){return uh(e,"frameAnchor")}function BT(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 J7(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 kx(e){return $n(e)?J7(e):e}function lh(e){return e===!0?e="frame":e===!1?e=null:!MT(e)&&e!=null&&(e=Ar(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function zT(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function KT(e){return e&&typeof e.toArray=="function"&&e.type}function eF(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Dn=Symbol("position"),ln=Symbol("color"),xs=Symbol("radius"),ws=Symbol("length"),Ss=Symbol("opacity"),Hc=Symbol("symbol"),qT=Symbol("projection"),Ye=new Map([["x",Dn],["y",Dn],["fx",Dn],["fy",Dn],["r",xs],["color",ln],["opacity",Ss],["symbol",Hc],["length",ws],["projection",qT]]);function HT(e){return e===Dn||e===qT}function YT(e){return e===Dn||e===xs||e===ws||e===Ss}var tF=Math.sqrt(3),rF=2/tF,nF={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*rF,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()}},Rx=new Map([["asterisk",Zu],["circle",Pi],["cross",Qu],["diamond",Ju],["diamond2",el],["hexagon",nF],["plus",tl],["square",rl],["square2",nl],["star",ol],["times",$c],["triangle",il],["triangle2",al],["wye",sl]]);function Nx(e){return e&&typeof e.draw=="function"}function WT(e){return Nx(e)?!0:typeof e!="string"?!1:Rx.has(e.toLowerCase())}function Yc(e){if(e==null||Nx(e))return e;let t=Rx.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function XT(e){if(e==null||Nx(e))return[void 0,e];if(typeof e=="string"){let t=Rx.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function hl({filter:e,sort:t,reverse:r,transform:n,initializer:o,...i}={},a){if(n===void 0&&(e!=null&&(n=ZT(e)),t!=null&&!ha(t)&&(n=Ax(n,Fx(t))),r&&(n=Ax(n,QT))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||ha(t))&&{sort:t},transform:Ax(n,a)}}function ki({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=ZT(e)),t!=null&&!ha(t)&&(n=Ex(n,Fx(t))),r&&(n=Ex(n,QT))),{...o,...(t===null||ha(t))&&{sort:t},initializer:Ex(n,i)}}function Ax(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,Ci(r),n,o)}}function Ex(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,p;return{data:s=r,facets:c=n,channels:a}=e.call(this,r,n,o,...i),{data:f=s,facets:p=c,channels:u}=t.call(this,s,c,{...o,...a},...i),{data:f,facets:p,channels:{...a,...u}}}}function oF(e,t){return(e.initializer!=null?ki:hl)(e,t)}function ZT(e){return(t,r)=>{let n=Zt(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 JT(e,{sort:t,...r}={}){return{...(Kc(e)&&e.channel!==void 0?ki:oF)(r,Fx(e)),sort:ha(t)?t:null}}function Fx(e){return(typeof e=="function"&&e.length!==1?iF:aF)(e)}function iF(e){return(t,r)=>{let n=ao(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 aF(e){let t,r;({channel:t,value:e,order:r}={...xa(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?ds:zr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=zr;break;case"descending":r=ds;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=Zt(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 nM(e,t,r=sF){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Go(e))return cF(e);if(typeof e=="function")return fF(e);if(/^p\d{2}$/i.test(e))return Ri(TT(e));switch(`${e}`.toLowerCase()){case"first":return lF;case"last":return pF;case"identity":return uF;case"count":return tM;case"distinct":return mF;case"sum":return t==null?tM:dF;case"proportion":return rM(t,"data");case"proportion-facet":return rM(t,"facet");case"deviation":return Ri(hp);case"min":return Ri(Or);case"min-index":return Ri(bp);case"max":return Ri(Kt);case"max-index":return Ri(yp);case"mean":return eM(wp);case"median":return eM(Ba);case"variance":return Ri(nc);case"mode":return Ri(Sp)}return r(e)}function sF(e){throw new Error(`invalid reduce: ${e}`)}function cF(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function fF(e){return{reduceIndex(t,r,n){return e(ah(r,t),n)}}}function Ri(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function eM(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return Xt(r)?new Date(n):n}}}var uF={reduceIndex(e,t){return ah(t,e)}},lF={reduceIndex(e,t){return t[e[0]]}};var pF={reduceIndex(e,t){return t[e[e.length-1]]}},tM={label:"Frequency",reduceIndex(e){return e.length}},mF={label:"Distinct",reduceIndex(e,t){let r=new eo;for(let n of e)r.add(t[n]);return r.size}},dF=Ri(Pn);function rM(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>Pn(r,i=>n[i])/o}}function Wc(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=ya(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),Dx(s,{scale:t,type:r,value:Zt(e,n),label:a,filter:o,hint:i})}function iM(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Wc(t,n,r)]))}function aM(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:tt(i,a)]}));return r.channels=e,r}function Dx(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&&fh(n,qc)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&fh(n,UT)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&fh(n,WT)?(t.scale=null,t.value=tt(n,Yc)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=Ye.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Ye.has(r))throw new Error(`unknown scale: ${r}`);return t}function sM(e,t,r,n,o){let{order:i,reverse:a,reduce:s=!0,limit:c}=o;for(let u in o){if(!Ye.has(u))continue;let{value:f,order:p=i,reverse:l=a,reduce:m=s,limit:h=c}=xa(o[u]),b=f?.startsWith("-");if(b&&(f=f.slice(1)),p=p===void 0?b!==(f==="width"||f==="height")?fM:cM:yF(p),m==null||m===!1)continue;let y=u==="fx"||u==="fy"?gF(t,n[u]):hF(r,u);if(!y)throw new Error(`missing channel for scale: ${u}`);let x=y.value,[g=0,S=1/0]=$n(h)?h:h<0?[h]:[0,h];if(f==null)y.domain=()=>{let w=Array.from(new eo(x));return l&&(w=w.reverse()),(g!==0||S!==1/0)&&(w=w.slice(g,S)),w};else{let w=f==="data"?e:f==="height"?oM(r,"y1","y2"):f==="width"?oM(r,"x1","x2"):$x(r,f,f==="y"?"y2":f==="x"?"x2":void 0),_=nM(m===!0?"max":m,w);y.domain=()=>{let v=Ey(Kr(x),I=>_.reduceIndex(I,w),I=>x[I]);return p&&v.sort(p),l&&v.reverse(),(g!==0||S!==1/0)&&(v=v.slice(g,S)),v.map(Ix)}}}}function hF(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function gF(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 $x(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 yF(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return cM;case"descending":return fM}throw new Error(`invalid order: ${e}`)}function cM([e,t],[r,n]){return zr(t,n)||zr(e,r)}function fM([e,t],[r,n]){return ds(t,n)||zr(e,r)}function Lx(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var dM=new Map([["accent",Mb],["category10",Tb],["dark2",Cb],["observable10",Ob],["paired",kb],["pastel1",Rb],["pastel2",Nb],["set1",Ab],["set2",Eb],["set3",Fb],["tableau10",$b]]);function hM(e){return e!=null&&dM.has(`${e}`.toLowerCase())}var uM=new Map([...dM,["brbg",Ni(Vm,jm)],["prgn",Ni(Um,Gm)],["piyg",Ni(Bm,zm)],["puor",Ni(Km,qm)],["rdbu",Ni(Yu,Nc)],["rdgy",Ni(Hm,Ym)],["rdylbu",Ni(Wu,Ac)],["rdylgn",Ni(Wm,Xm)],["spectral",Ni(Zm,Qm)],["burd",lM(Yu,Nc)],["buylrd",lM(Wu,Ac)],["blues",Jt(Id,_d)],["greens",Jt(Pd,Td)],["greys",Jt(Md,Cd)],["oranges",Jt(Ad,Ed)],["purples",Jt(Od,kd)],["reds",Jt(Rd,Nd)],["turbo",Ai(Bd)],["viridis",Ai(Kd)],["magma",Ai(qd)],["inferno",Ai(Hd)],["plasma",Ai(Yd)],["cividis",Ai(Fd)],["cubehelix",Ai($d)],["warm",Ai(Ld)],["cool",Ai(Vd)],["bugn",Jt(Jm,ed)],["bupu",Jt(td,rd)],["gnbu",Jt(nd,od)],["orrd",Jt(id,ad)],["pubu",Jt(fd,ud)],["pubugn",Jt(sd,cd)],["purd",Jt(ld,pd)],["rdpu",Jt(md,dd)],["ylgn",Jt(yd,bd)],["ylgnbu",Jt(hd,gd)],["ylorbr",Jt(xd,wd)],["ylorrd",Jt(Sd,vd)],["rainbow",pM(jd)],["sinebow",pM(Gd)]]);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?wr(t,r):e[r])}function Ni(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?wr(t,r):e[r])}function lM(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?wr(n=>t(1-n),r):e[r].slice().reverse())}function Ai(e){return({length:t})=>wr(e,Math.max(2,Math.floor(t)))}function pM(e){return({length:t})=>wr(e,Math.floor(t)+1).slice(0,-1)}function Vx(e){let t=`${e}`.toLowerCase();if(!uM.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return uM.get(t)}function gl(e,t){let r=Vx(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function gM(e,t="greys"){let r=new Set,[n,o]=gl(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 mM=new Map([["brbg",jm],["prgn",Gm],["piyg",zm],["puor",qm],["rdbu",Nc],["rdgy",Ym],["rdylbu",Ac],["rdylgn",Xm],["spectral",Qm],["burd",e=>Nc(1-e)],["buylrd",e=>Ac(1-e)],["blues",_d],["greens",Td],["greys",Cd],["purples",kd],["reds",Nd],["oranges",Ed],["turbo",Bd],["viridis",Kd],["magma",qd],["inferno",Hd],["plasma",Yd],["cividis",Fd],["cubehelix",$d],["warm",Ld],["cool",Vd],["bugn",ed],["bupu",rd],["gnbu",od],["orrd",ad],["pubugn",cd],["pubu",ud],["purd",pd],["rdpu",dd],["ylgnbu",gd],["ylgn",bd],["ylorbr",wd],["ylorrd",vd],["rainbow",jd],["sinebow",Gd]]);function Xc(e){let t=`${e}`.toLowerCase();if(!mM.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return mM.get(t)}var bF=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function yM(e){return e!=null&&bF.has(`${e}`.toLowerCase())}var Ux=e=>t=>e(1-t),jx=[0,1],bM=new Map([["number",ft],["rgb",Mn],["hsl",s0],["hcl",c0],["lab",Lp]]);function Gx(e){let t=`${e}`.toLowerCase();if(!bM.has(t))throw new Error(`unknown interpolator: ${t}`);return bM.get(t)}function Qc(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=MM(e,r),unknown:c,round:u,scheme:f,interval:p,range:l=Ye.get(e)===xs?vF(r,s):Ye.get(e)===ws?IF(r,s):Ye.get(e)===Ss?jx:void 0,interpolate:m=Ye.get(e)===ln?f==null&&l!==void 0?Mn:Xc(f!==void 0?f:n==="cyclical"?"rainbow":"turbo"):u?Xa:ft,reverse:h}){if(s=xM(s),p=ba(p,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof m!="function"&&(m=Gx(m)),h=!!h,l!==void 0){let b=s.length,y=(l=xM(l)).length;if(b!==y){if(m.length===1)throw new Error("invalid piecewise interpolator");m=To(m,l),l=void 0}}if(m.length===1?(h&&(m=Ux(m),h=!1),l===void 0&&(l=Float64Array.from(s,(b,y)=>y/(s.length-1)),l.length===2&&(l=jx)),t.interpolate((l===jx?un:yl)(m))):t.interpolate(m),a){let[b,y]=Gr(s);(b>0||y<0)&&(s=da(s),(Mi(s)||1)===Math.sign(b)?s[0]=0:s[s.length-1]=0)}return h&&(s=Qi(s)),t.domain(s).unknown(c),o&&(t.nice(xF(o,n)),s=t.domain()),l!==void 0&&t.range(l),i&&t.clamp(i),{type:n,domain:s,range:l,scale:t,interpolate:m,interval:p}}function xM(e){return e=Uo(e),e.length>=2?e:[e[0],e[0]]}function xF(e,t){return e===!0?void 0:typeof e=="number"?e:FT(e,t)}function wM(e,t,r){return Qc(e,os(),t,r)}function SM(e,t,r){return Bx(e,t,{...r,exponent:.5})}function Bx(e,t,{exponent:r=1,...n}){return Qc(e,Lu().exponent(r),t,{...n,type:"pow"})}function vM(e,t,{base:r=10,domain:n=_F(t),...o}){return Qc(e,$u().base(r),t,{...o,domain:n})}function IM(e,t,{constant:r=1,...n}){return Qc(e,Du().constant(r),t,n)}function _M(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=PF(t),unknown:s,interpolate:c,reverse:u}){return r===void 0&&(r=c!==void 0?wr(c,o):Ye.get(e)===ln?gl(i,o):void 0),a.length>0&&(a=Vu(a,r===void 0?{length:o}:r).quantiles()),ph(e,t,{domain:a,range:r,reverse:u,unknown:s})}function PM(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=MM(e,t),unknown:a,interpolate:s,reverse:c}){let[u,f]=Gr(i),p;return r===void 0?(p=ui(u,f,n),p[0]<=u&&p.splice(0,1),p[p.length-1]>=f&&p.pop(),n=p.length+1,r=s!==void 0?wr(s,n):Ye.get(e)===ln?gl(o,n):void 0):(p=wr(ft(u,f),n+1).slice(1,-1),u instanceof Date&&(p=p.map(l=>new Date(l)))),Mi(Uo(i))<0&&p.reverse(),ph(e,t,{domain:p,range:r,reverse:c,unknown:a})}function ph(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?wr(i,r.length+1):Ye.get(e)===ln?gl(o,r.length+1):void 0,reverse:s}){r=Uo(r);let c=Mi(r);if(!isNaN(c)&&!wF(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=Qi(a)),{type:"threshold",scale:ju(c<0?Qi(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function wF(e,t){for(let r=1,n=e.length,o=e[0];rt}}function Zc(e,t=lx){return e.length?[Or(e,({value:r})=>r===void 0?r:Or(r,t)),Kt(e,({value:r})=>r===void 0?r:Kt(r,t))]:[0,1]}function MM(e,t){let r=Ye.get(e);return(r===xs||r===Ss||r===ws?SF:Zc)(t)}function SF(e){return[0,e.length?Kt(e,({value:t})=>t===void 0?t:Kt(t,lx)):1]}function vF(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=li(e,.5,({value:a})=>a===void 0?NaN:li(a,.25,hs)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/Kt(o);return i<1?o.map(a=>a*i):o}function IF(e,t){let r=Ba(e,({value:i})=>i===void 0?NaN:Ba(i,Math.abs)),n=t.map(i=>12*i/r),o=60/Kt(n);return o<1?n.map(i=>i*o):n}function _F(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Zc(e,hs);if(r<0)return Zc(e,Vc)}return[1,10]}function PF(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function yl(e){return(t,r)=>n=>e(t+n*(r-t))}var zx=0,Kx;function CM(){let e=zx;return zx=0,Kx=void 0,e}function qr(e){e!==Kx&&(Kx=e,console.warn(e),++zx)}function mh(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=Zc(n),unknown:c,pivot:u=0,scheme:f,range:p,symmetric:l=!0,interpolate:m=Ye.get(e)===ln?f==null&&p!==void 0?Mn:Xc(f!==void 0?f:"rdbu"):ft,reverse:h}){u=+u,s=Uo(s);let[b,y]=s;if(s.length>2&&qr(`Warning: the diverging ${e} scale domain contains extra elements.`),_n(b,y)<0&&([b,y]=[y,b],h=!h),b=Math.min(b,u),y=Math.max(y,u),typeof m!="function"&&(m=Gx(m)),p!==void 0&&(m=m.length===1?yl(m)(...p):To(m,p)),h&&(m=Ux(m)),l){let x=r.apply(u),g=x-r.apply(b),S=r.apply(y)-x;gS&&(y=r.invert(x+g))}return t.domain([b,u,y]).unknown(c).interpolator(m),a&&t.clamp(a),i&&t.nice(i),{type:o,domain:[b,y],pivot:u,interpolate:m,scale:t}}function OM(e,t,r){return mh(e,Hu(),TF,t,r)}function kM(e,t,r){return qx(e,t,{...r,exponent:.5})}function qx(e,t,{exponent:r=1,...n}){return mh(e,Lm().exponent(r=+r),OF(r),t,{...n,type:"diverging-pow"})}function RM(e,t,{base:r=10,pivot:n=1,domain:o=Zc(t,n<0?Vc:hs),...i}){return mh(e,$m().base(r=+r),MF,t,{domain:o,pivot:n,...i})}function NM(e,t,{constant:r=1,...n}){return mh(e,Dm().constant(r=+r),kF(r),t,n)}var TF={apply(e){return e},invert(e){return e}},MF={apply:Math.log,invert:Math.exp},CF={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function OF(e){return e===.5?CF:{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 kF(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 AM(e,t,r,n){return Qc(e,t,r,n)}function EM(e,t,r){return AM(e,Am(),t,r)}function FM(e,t,r){return AM(e,Em(),t,r)}var Jc=Symbol("ordinal");function DM(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:c}){return o=ba(o,n),i===void 0&&(i=GM(r,o,e)),(n==="categorical"||n===Jc)&&(n="ordinal"),s&&(i=Qi(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 LM(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...c}){n=ba(n,r),o===void 0&&(o=GM(t,n,e));let u;if(Ye.get(e)===Hc)u=RF(t),i=i===void 0?NF(u):tt(i,Yc);else if(Ye.get(e)===ln&&(i===void 0&&(r==="ordinal"||r===Jc)&&(i=gM(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=Xc(a),p=i[0],l=i[1]-i[0];i=({length:m})=>wr(h=>f(p+l*h),m)}else i=Vx(a);if(s===Nu)throw new Error(`implicit unknown on ${e} scale is not supported`);return DM(e,rs().unknown(s),t,{...c,type:r,domain:o,range:i,hint:u})}function VM(e,t,{align:r=.5,padding:n=.5,...o}){return UM(fb().align(r).padding(n),t,o,e)}function jM(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return UM(sa().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function UM(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=DM(n,e,t,r),e.round=o,e}function GM(e,t,r){let n=new eo;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]=Gr(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&Ye.get(r)===Dn)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Zi(n,zr)}function $M(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 RF(e){return{fill:$M(e,"fill"),stroke:$M(e,"stroke")}}function NF(e){return Qt(e.fill)?zb:Xd}function bl(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:p,padding:l,projection:m,facet:{label:h=t}={},...b}={}){let y={};for(let[x,g]of e){let S=b[x],w=FF(x,g,{round:Ye.get(x)===Dn?s:void 0,nice:c,clamp:u,zero:f,align:p,padding:l,projection:m,...S});if(w){let{label:_=x==="fx"||x==="fy"?h:t,percent:v,transform:I,inset:T,insetTop:P=T!==void 0?T:x==="y"?n:0,insetRight:R=T!==void 0?T:x==="x"?o:0,insetBottom:k=T!==void 0?T:x==="y"?i:0,insetLeft:N=T!==void 0?T:x==="x"?a:0}=S||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?AF(g,w):_,w.transform=I,x==="x"||x==="fx"?(w.insetLeft=+N,w.insetRight=+R):(x==="y"||x==="fy")&&(w.insetTop=+P,w.insetBottom=+k),y[x]=w}}return y}function Yx(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]=VF(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),c!=null&&(i.label=c)}return r}function HM(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?hh(t):t;o&&BM(o,a),i&&zM(i,a);let s=o||i?Wx(e,t):t;r&&BM(r,s),n&&zM(n,s)}function AF(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!Bo(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function YM(e){return Math.sign(Mi(e.domain()))*Math.sign(Mi(e.range()))}function hh(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 Wx({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=hh(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 BM(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)],Bo(e)||(e.range=XM(e)),e.scale.range(e.range)}WM(e)}function zM(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],Bo(e)?e.range.reverse():e.range=XM(e),e.scale.range(e.range)}WM(e)}function WM(e){e.round===void 0&&DF(e)&&EF(e)<=30&&e.scale.round(!0)}function EF({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 XM(e){let t=e.scale.domain().length+Xx(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 FF(e,t=[],r={}){let n=$F(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&Bo({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(Xt)?qr(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${ef(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 "${ef(n)}".`):o.some(LT)?qr(`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 "${ef(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 "${ef(n)}".`):o.some(VT)&&qr(`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 "${ef(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 "${ef(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=dh(t,r,ys);break;case"identity":switch(Ye.get(e)){case Dn:r=dh(t,r,ys);break;case Hc:r=dh(t,r,LF);break}break;case"utc":case"time":r=dh(t,r,Px);break}switch(n){case"diverging":return OM(e,t,r);case"diverging-sqrt":return kM(e,t,r);case"diverging-pow":return qx(e,t,r);case"diverging-log":return RM(e,t,r);case"diverging-symlog":return NM(e,t,r);case"categorical":case"ordinal":case Jc:return LM(e,t,r);case"cyclical":case"sequential":case"linear":return wM(e,t,r);case"sqrt":return SM(e,t,r);case"threshold":return ph(e,t,r);case"quantile":return _M(e,t,r);case"quantize":return PM(e,t,r);case"pow":return Bx(e,t,r);case"log":return vM(e,t,r);case"symlog":return IM(e,t,r);case"utc":return FM(e,t,r);case"time":return EM(e,t,r);case"point":return VM(e,t,r);case"band":return jM(e,t,r);case"identity":return TM(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function ef(e){return typeof e=="symbol"?e.description:e}function KM(e){return typeof e=="string"?`${e}`.toLowerCase():e}var qM={toString:()=>"projection"};function $F(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=KM(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=qM);for(let f of t){let p=KM(f.type);if(p!==void 0){if(r===void 0)r=p;else if(r!==p)throw new Error(`scale incompatible with channel: ${r} !== ${p}`)}}if(r===qM)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:f})=>f!==void 0))return;let c=Ye.get(e);if(c===xs)return"sqrt";if(c===Ss||c===ws)return"linear";if(c===Hc)return"ordinal";let u=(n??o)?.length;if(u<2||u>2)return Hx(c);if(n!==void 0){if(Ox(n))return Hx(c);if(Xt(n))return"utc"}else{let f=t.map(({value:p})=>p).filter(p=>p!==void 0);if(f.some(Ox))return Hx(c);if(f.some(Xt))return"utc"}if(c===ln){if(a!=null||yM(i))return"diverging";if(hM(i))return"categorical"}return"linear"}function Hx(e){switch(e){case Dn:return"point";case ln:return Jc;default:return"ordinal"}}function Bo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Jc}function Xx({type:e}){return e==="threshold"}function DF({type:e}){return e==="point"||e==="band"}function Sa(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,o=t.length;n{if(!Ye.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function VF({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:da(r),...n!==void 0&&{range:da(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 JM(e,t){let{fx:r,fy:n}=bl(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?mp(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 eC(e,{x:t,y:r}){return t&&=t1(t),r&&=t1(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 yh(e,{fx:t,fy:r}){let n=Kr(e),o=t?.value,i=r?.value;return t&&r?So(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?So(n,a=>(a.fx=o[a[0]],a),a=>o[a]):So(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function tC(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 rC(e){let t=[],r=new Uint32Array(Pn(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 jF=new Map([["top",Zx],["right",e1],["bottom",Qx],["left",Jx],["top-left",gh(Zx,Jx)],["top-right",gh(Zx,e1)],["bottom-left",gh(Qx,Jx)],["bottom-right",gh(Qx,e1)],["top-empty",GF],["right-empty",KF],["bottom-empty",BF],["left-empty",zF],["empty",qF]]);function nC(e){if(e==null)return null;let t=jF.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var QM=new WeakMap;function t1(e){let t=QM.get(e);return t||QM.set(e,t=new Cr(tt(e,(r,n)=>[r,n]))),t}function va(e,t){return t1(e).get(t)}function UF(e,t,r){return t=Fn(t),r=Fn(r),e.find(n=>Object.is(Fn(n.x),t)&&Object.is(Fn(n.y),r))}function bh(e,t,r){return UF(e,t,r)?.empty}function Zx(e,{y:t},{y:r}){return t?va(t,r)===0:!0}function Qx(e,{y:t},{y:r}){return t?va(t,r)===t.length-1:!0}function Jx(e,{x:t},{x:r}){return t?va(t,r)===0:!0}function e1(e,{x:t},{x:r}){return t?va(t,r)===t.length-1:!0}function GF(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=va(t,n);if(i>0)return bh(e,r,t[i-1])}function BF(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=va(t,n);if(i0)return bh(e,t[i-1],n)}function KF(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=va(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var oC=Math.PI,Ei=2*oC,r1=.618;function iC({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(Go(e)){let _;if({type:e,domain:c,inset:_,insetTop:r=_!==void 0?_:r,insetRight:n=_!==void 0?_:n,insetBottom:o=_!==void 0?_:o,insetLeft:i=_!==void 0?_:i,clip:u=u,...s}=e,e==null)return}typeof e!="function"&&({type:e}=n1(e));let{width:f,height:p,marginLeft:l,marginRight:m,marginTop:h,marginBottom:b}=a,y=f-l-m-i-n,x=p-h-b-r-o;if(e=e?.({width:y,height:x,clip:u,...s}),e==null)return;u=HF(u,l,h,f-m,p-b);let g=l+i,S=h+r,w;if(c!=null){let[[_,v],[I,T]]=Ic(e).bounds(c),P=Math.min(y/(I-_),x/(T-v));P>0?(g-=(P*(_+I)-y)/2,S-=(P*(v+T)-x)/2,w=_c({point(R,k){this.stream.point(R*P+g,k*P+S)}})):qr("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=g===0&&S===0?aC():_c({point(_,v){this.stream.point(_+g,v+S)}}),{stream:_=>e.stream(w.stream(u(_)))}}function n1(e){switch(`${e}`.toLowerCase()){case"albers-usa":return so(B0,.7463,.4673);case"albers":return wh(Tu,.7463,.4673);case"azimuthal-equal-area":return so(K0,4,4);case"azimuthal-equidistant":return so(H0,Ei,Ei);case"conic-conformal":return wh(X0,Ei,Ei);case"conic-equal-area":return wh(aa,6.1702,2.9781);case"conic-equidistant":return wh(Q0,7.312,3.6282);case"equal-earth":return so(eb,5.4133,2.6347);case"equirectangular":return so(Z0,Ei,oC);case"gnomonic":return so(rb,3.4641,3.4641);case"identity":return{type:aC};case"reflect-y":return{type:YF};case"mercator":return so(Y0,Ei,Ei);case"orthographic":return so(ob,2,2);case"stereographic":return so(ab,2,2);case"transverse-mercator":return so(cb,Ei,Ei);default:throw new Error(`unknown projection type: ${e}`)}}function HF(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 bc(t,r,n,o);default:throw new Error(`unknown projection clip type: ${e}`)}}function so(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 wh(e,t,r){let{type:n,aspectRatio:o}=so(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 aC=un({stream:e=>e}),YF=un(_c({point(e,t){this.stream.point(e,-t)}}));function sC(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(p,l){s[u]=p,c[u]=l}});for(u=0;u5?5:c:r1}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=n1(e);if(t)return t}return r1}}function uC(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)oo(a,i);return[n,o]}function lC({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,_c({point(r,n){this.stream.point(e(r),t(n))}})}function tf(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:lh(r)}}function Ke(e,{document:t}){return kr(mi(e).call(t.documentElement))}var Sh=Symbol("unset");function vh(e){return(e.length===1?WF:XF)(e)}function WF(e){let t,r=Sh;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function XF(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 ZF=vh(e=>new Intl.NumberFormat(e)),Dwe=vh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),Lwe=vh((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function QF(e="en-US"){let t=ZF(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function JF(e){return rh(e,"Invalid Date")}function e9(e="en-US"){let t=QF(e);return r=>(r instanceof Date?JF:typeof r=="number"?t:Ot)(r)}var zo=e9();var lr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,t9=0;function mC(){return`plot-clip-${++t9}`}function dC(e,{title:t,href:r,ariaLabel:n,ariaDescription:o,ariaHidden:i,target:a,fill:s,fillOpacity:c,stroke:u,strokeWidth:f,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:m,strokeMiterlimit:h,strokeDasharray:b,strokeDashoffset:y,opacity:x,mixBlendMode:g,imageFilter:S,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:I},{ariaLabel:T,fill:P="currentColor",fillOpacity:R,stroke:k="none",strokeOpacity:N,strokeWidth:B,strokeLinecap:V,strokeLinejoin:C,strokeMiterlimit:G,paintOrder:j}){P===null&&(s=null,c=null),k===null&&(u=null,p=null),Qt(P)?!Qt(k)&&(!Qt(s)||I?.fill)&&(k="none"):Qt(k)&&(!Qt(u)||I?.stroke)&&(P="none");let[H,U]=jo(s,P),[z,Y]=_t(c,R),[X,q]=jo(u,k),[ae,J]=_t(p,N),[oe,Q]=_t(x);bs(q)||(f===void 0&&(f=B),m===void 0&&(m=V),l===void 0&&(l=C),h===void 0&&!GT(l)&&(h=G),!bs(U)&&w===void 0&&(w=j));let[fe,O]=_t(f);return P!==null&&(e.fill=Pt(U,"currentColor"),e.fillOpacity=xl(Y,1)),k!==null&&(e.stroke=Pt(q,"none"),e.strokeWidth=xl(O,1),e.strokeOpacity=xl(J,1),e.strokeLinejoin=Pt(l,"miter"),e.strokeLinecap=Pt(m,"butt"),e.strokeMiterlimit=xl(h,4),e.strokeDasharray=Pt(b,"none"),e.strokeDashoffset=Pt(y,"0")),e.target=Ot(a),e.ariaLabel=Ot(T),e.ariaDescription=Ot(o),e.ariaHidden=Ot(i),e.opacity=xl(Q,1),e.mixBlendMode=Pt(g,"normal"),e.imageFilter=Pt(S,"none"),e.paintOrder=Pt(w,"normal"),e.pointerEvents=Pt(_,"auto"),e.shapeRendering=Pt(v,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:H,scale:"auto",optional:!0},fillOpacity:{value:z,scale:"auto",optional:!0},stroke:{value:X,scale:"auto",optional:!0},strokeOpacity:{value:ae,scale:"auto",optional:!0},strokeWidth:{value:fe,optional:!0},opacity:{value:oe,scale:"auto",optional:!0}}}function r9(e,t){t&&e.filter(r=>ul(t[r])).append("title").call(o9,t)}function n9(e,t){t&&e.filter(([r])=>ul(t[r])).append("title").call(i9,t)}function o9(e,t){t&&e.text(r=>zo(t[r]))}function i9(e,t){t&&e.text(([r])=>zo(t[r]))}function Hr(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:p}){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]),p&&yC(e,l=>p[l],t),r||r9(e,o)}function hC(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:p}){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]),p&&yC(e,([l])=>p[l],t),r||n9(e,o)}function a9({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 s9(e,t,r){let n=fi(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&qr("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*gC(e,t,r,n){let{z:o}=r,{z:i}=n,a=a9(n,r),s=[...t,...a];for(let c of i?s9(e,i,o):[e]){let u,f;e:for(let p of c){for(let l of s)if(!En(l[p])){f&&f.push(-1);continue e}if(u===void 0){f&&(yield f),u=a.map(l=>Fn(l[p])),f=[p];continue}f.push(p);for(let l=0;lFn(h[p])),f=[p];continue e}}f&&(yield f)}}function c9(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=Ke("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=u9(n,r)):i&&(o=p9(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 f9(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=mC();kr(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var u9=f9((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)}),pC=new WeakMap,l9={type:"Sphere"};function p9(e,t){let r,n;if((r=pC.get(t))||pC.set(t,r=new WeakMap),e.type==="Sphere"&&(e=l9),!(n=r.get(e))){let o=mC();kr(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function pr(e,t,r,n){c9(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 er(e,t){m9(e,"mix-blend-mode",t.mixBlendMode),de(e,"opacity",t.opacity)}function yC(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS(vo.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(vo.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 m9(e,t,r){r!=null&&e.style(t,r)}function mr(e,t,{x:r,y:n},o=lr,i=lr){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 Pt(e,t){if((e=Ot(e))!==t)return e}function xl(e,t){if((e=kt(e))!==t)return e}var d9=/^-?([_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 rf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!d9.test(e))throw new Error(`invalid class name: ${e}`);return e}function nf(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 Ko({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 mt=class{constructor(t,r={},n={},o){let{facet:i="auto",facetAnchor:a,fx:s,fy:c,sort:u,dx:f=0,dy:p=0,margin:l=0,marginTop:m=l,marginRight:h=l,marginBottom:b=l,marginLeft:y=l,className:x,clip:g=o?.clip,channels:S,tip:w,render:_}=n;if(this.data=t,this.sort=ha(u)?u:null,this.initializer=ki(n).initializer,this.transform=this.initializer?n.transform:hl(n).transform,i===null||i===!1?this.facet=null:(this.facet=Ar(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=t===Bc&&typeof s=="string"?[s]:s,this.fy=t===Bc&&typeof c=="string"?[c]:c),this.facetAnchor=nC(a),r=kx(r),S!==void 0&&(r={...h9(S),...r}),o!==void 0&&(r={...dC(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([v,I])=>{if(Kc(I.value)){let{value:T,label:P=I.label,scale:R=I.scale}=I.value;I={...I,label:P,scale:R,value:T}}if(t===Bc&&typeof I.value=="string"){let{value:T}=I;I={...I,value:[T]}}return[v,I]}).filter(([v,{value:I,optional:T}])=>{if(I!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+f,this.dy=+p,this.marginTop=+m,this.marginRight=+h,this.marginBottom=+b,this.marginLeft=+y,this.clip=lh(g),this.tip=g9(w),this.className=Ot(x),this.facet==="super"){if(s||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:I}=r[v];if(!(I!=="x"&&I!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=i1(_,this.render))}initialize(t,r,n){let o=Ci(this.data);t===void 0&&o!=null&&(t=[Kr(o)]);let i=t;this.transform!=null&&({facets:t,data:o}=this.transform(o,t,n),o=Ci(o)),t!==void 0&&(t.original=i);let a=iM(this.channels,o);return this.sort!=null&&sM(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=En}=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"&&sC(o,i,r,n.projection)}}scale(t,r,n){let o=aM(t,r);return n.projection&&this.project(t,o,n),o}};function o1(...e){return e.plot=mt.prototype.plot,e}function i1(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,p,l)=>t.call(this,c,u,f,p,l,s))}}function h9(e){return Object.fromEntries(Object.entries(kx(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:xa(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function g9(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ar(e,"tip",["x","y","xy"]):e}function wl(e,t){return e?.tip===!0?{...e,tip:t}:Go(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function xC(e,t,r={}){let n=.5-lr,o=.5+lr,i=.5+lr,a=.5-lr;for(let{marginTop:b,marginRight:y,marginBottom:x,marginLeft:g}of t)b>n&&(n=b),y>o&&(o=y),x>i&&(i=x),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:p=s!==void 0?s:a}=r;c=+c,u=+u,f=+f,p=+p;let{width:l=640,height:m=y9(e,r,{width:l,marginTopDefault:n,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,c-n+f-i)}=r;l=+l,m=+m;let h={width:l,height:m,marginTop:c,marginRight:u,marginBottom:f,marginLeft:p};if(e.fx||e.fy){let{margin:b,marginTop:y=b!==void 0?b:c,marginRight:x=b!==void 0?b:u,marginBottom:g=b!==void 0?b:f,marginLeft:S=b!==void 0?b:p}=r.facet??{};y=+y,x=+x,g=+g,S=+S,h.facet={marginTop:y,marginRight:x,marginBottom:g,marginLeft:S}}return h}function y9({x:e,y:t,fy:r,fx:n},{projection:o,aspectRatio:i},{width:a,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:u,marginLeftDefault:f}){let p=r&&r.scale.domain().length||1,l=fC(o);if(l){let h=n?n.scale.domain().length:1,b=(1.1*p-.1)/(1.1*h-.1)*l,y=Math.max(.1,Math.min(10,b));return Math.round((a-f-c)*y+s+u)}let m=t?Bo(t)?t.scale.domain().length||1:Math.max(7,17/p):1;if(i!=null){if(i=+i,!(isFinite(i)&&i>0))throw new Error(`invalid aspectRatio: ${i}`);let h=bC("y",t)/(bC("x",e)*i),b=n?n.scale.bandwidth():1,y=r?r.scale.bandwidth():1,x=b*(a-f-c)-e.insetLeft-e.insetRight;return(h*x+t.insetTop+t.insetBottom)/y+s+u}return!!(t||r)*Math.max(1,Math.min(60,m*p))*20+!!n*30+60}function bC(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]=Gr(n);return Math.abs(o(a)-o(i))}var wC=new WeakMap;function a1(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:i1(function(f,p,l,m,h,b){h={...h,pointerSticky:!1};let y=h.ownerSVGElement,{data:x}=h.getMarkState(this),g=wC.get(y);g||wC.set(y,g={sticky:!1,roots:[],renders:[]});let S=g.renders.push(q)-1,{x:w,y:_,fx:v,fy:I}=p,T=v?v(f.fx)-m.marginLeft:0,P=I?I(f.fy)-m.marginTop:0;w?.bandwidth&&(T+=w.bandwidth()/2),_?.bandwidth&&(P+=_.bandwidth()/2);let R=f.fi!=null,k;if(R){let Q=g.facetStates;Q||(g.facetStates=Q=new Map),k=Q.get(this),k||Q.set(this,k=new Map)}let[N,B]=Ko(this,m),{px:V,py:C}=l,G=V?Q=>V[Q]:c1(l,N),j=C?Q=>C[Q]:f1(l,B),H,U,z,Y;function X(Q,fe){if(R)if(Y&&(Y=cancelAnimationFrame(Y)),Q==null)k.delete(f.fi);else{k.set(f.fi,fe),Y=requestAnimationFrame(()=>{Y=null;for(let[O,L]of k)if(L1)){let L=H==null?null:ao(x)?x[H]:x.get(H);h.dispatchValue(L)}return O}function ae(Q){if(g.sticky||Q.pointerType==="mouse"&&Q.buttons===1)return;let[fe,O]=ea(Q);fe-=T,O-=P;let L=fem.width-m.marginRight?1:e,K=Om.height-m.marginBottom?1:t,A=null,ee=a*a;for(let re of f){let Te=L*(G(re)-fe),Me=K*(j(re)-O),rt=Te*Te+Me*Me;rt<=ee&&(A=re,ee=rt)}if(A!=null&&(e!==1||t!==1)){let re=G(A)-fe,Te=j(A)-O;ee=re*re+Te*Te}X(A,ee)}function J(Q){Q.pointerType==="mouse"&&H!=null&&(g.sticky&&g.roots.some(fe=>fe?.contains(Q.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(fe=>fe(null))):(g.sticky=!0,q(H)),Q.stopImmediatePropagation()))}function oe(Q){Q.pointerType==="mouse"&&(g.sticky||X(null))}return y.addEventListener("pointerenter",ae),y.addEventListener("pointermove",ae),y.addEventListener("pointerdown",J),y.addEventListener("pointerleave",oe),q(null)},c)}}function SC(e){return a1(1,1,e)}function vC(e){return a1(1,.01,e)}function s1(e){return a1(.01,1,e)}function c1({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function f1({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function Ih(e){return Bo(e)&&e.interval===void 0?void 0:"tabular-nums"}function IC(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:p=(o-u-s)/64,tickFormat:l,fontVariant:m=Ih(e),round:h=!0,opacity:b,className:y}=t,x=tf(t);y=rf(y),b=_t(b)[1],l===null&&(l=()=>null);let g=Ke("svg",x).attr("class",`${y}-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(N=>N.append("style").text(`:where(.${y}-ramp) { display: block; height: auto; height: intrinsic; @@ -11,9 +11,9 @@ ${r}`}function LE(e){return e==="time"?Xd:e==="utc"?al:$E}function mT(e,t,r){let } :where(.${y}-ramp text) { white-space: pre; -}`)).call(Zc,f),_=N=>N.selectAll(".tick line").attr("y1",a+c-i),w,I=h?(N,z)=>N.rangeRound(z):(N,z)=>N.range(z),{type:S,domain:v,range:M,interpolate:C,scale:R,pivot:O}=e;if(C){let N=M===void 0?C:To(C.length===1?ll(C):C,M);w=I(R.copy(),yr(ct(u,o-s),Math.min(v.length+(O!==void 0),M===void 0?1/0:M.length)));let z=256,j=x.document.createElement("canvas");j.width=z,j.height=1;let k=j.getContext("2d");for(let B=0,V=z-1;Bj:typeof l=="string"?Pn(l):l;w=I(es().domain([-1,M.length-1]),[u,o-s]),g.append("g").attr("fill-opacity",b).selectAll().data(M).enter().append("rect").attr("x",(j,k)=>w(k-1)).attr("y",a).attr("width",(j,k)=>w(k)-w(k-1)).attr("height",i-a-c).attr("fill",j=>j),p=et(N,(j,k)=>k),l=j=>z(N[j],j)}else w=I(ia().domain(v),[u,o-s]),g.append("g").attr("fill-opacity",b).selectAll().data(v).enter().append("rect").attr("x",w).attr("y",a).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-a-c).attr("fill",R),_=()=>{};return g.append("g").attr("transform",`translate(0,${i-c})`).call($b(w).ticks(Array.isArray(p)?null:p,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(n).tickValues(Array.isArray(p)?p:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",vt(m,"normal")).call(_).call(N=>N.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 i1=Math.PI/180;function hl(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=a1(r),e.markerMid=a1(n),e.markerEnd=a1(o)}function a1(e){if(e==null||e===!1)return null;if(e===!0)return wM;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return xM("auto");case"arrow-reverse":return xM("auto-start-reverse");case"dot":return l9;case"circle":case"circle-fill":return wM;case"circle-stroke":return p9;case"tick":return s1("auto");case"tick-x":return s1(90);case"tick-y":return s1(0)}throw new Error(`invalid marker: ${e}`)}function xM(e){return(t,r)=>Ge("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 l9(e,t){return Ge("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 wM(e,t){return Ge("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 p9(e,t){return Ge("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 s1(e){return(t,r)=>Ge("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 m9=0;function f1(e,t,{stroke:r},n){return _M(e,t,r&&(o=>r[o]),null,n)}function SM(e,t,{stroke:r,z:n},o){return _M(e,t,r&&(([i])=>r[i]),n,o)}var c1=1,IM=2;function d9(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=dh;i1){let c=s[0];a!==(a=Nn(t[c]))&&(r[c]|=c1)}}for(let i=o-1,a=dh;i>=0;--i){let s=n[i];if(s.length>1){let c=s[0];a!==(a=Nn(t[c]))&&(r[c]|=IM)}}return([i])=>r[i]}function _M(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let c=new Map,u=a&&d9(e,a);function f(p,l,m){return function(h){if(m&&!m(h))return;let b=i(h),y=c.get(l);y||c.set(l,y=new Map);let x=y.get(b);if(!x){let g=this.parentNode.insertBefore(l(b,s),this),_=`plot-marker-${++m9}`;g.setAttribute("id",_),y.set(b,x=`url(#${_})`)}this.setAttribute(p,x)}}t&&e.each(f("marker-start",t,u&&(p=>u(p)&c1))),r&&u&&e.each(f("marker-start",r,p=>!(u(p)&c1))),r&&e.each(f("marker-mid",r)),n&&e.each(f("marker-end",n,u&&(p=>u(p)&IM)))}function yh({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=vM(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function u1({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=vM(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function vM(e,t,r){return e===void 0&&t===void 0&&r===void 0?fr?[1,0]:[.5,.5]:[t,r]}function PM(e,{interval:t}){return e={...ya(e)},e.interval=eh(e.interval===void 0?t:e.interval),e}function l1(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:c}=PM(o,r);if(s==null||c==null&&!n)return r;let u=ha(o);if(c==null){let m,h={transform:b=>m||(m=Xt(b,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,p;function l(m){return p!==void 0&&m===f?p:p=et(Xt(f=m,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:m=>l(m).map(h=>c.offset(h)),label:u}:a})}function TM(e,t,r){let{[e]:n}=r,{value:o,interval:i}=PM(n,r);return o==null||i==null?r:t({...r,[e]:{label:ha(n),transform:a=>{let s=et(Xt(a,o),u=>i.floor(u)),c=s.map(u=>i.offset(u));return s.map(Wt(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 MM(e={}){return l1("x",yh,e,!0)}function CM(e={}){return l1("x",yh,e)}function OM(e={}){return l1("y",u1,e)}function kM(e={}){return TM("x",yh,e)}function RM(e={}){return TM("y",u1,e)}var NM={ariaLabel:"rule",fill:null,stroke:"currentColor"},gh=class extends pt{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"),NM),this.insetTop=kt(s),this.insetBottom=kt(c),hl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y1:u,y2:f}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:b,marginBottom:y}=o,{insetTop:x,insetBottom:g}=this;return Ge("svg:g",i).call(ur,this,o,i).call(lr,this,{x:c&&a},fr,0).call(_=>_.selectAll().data(t).enter().append("line").call(Jt,this).attr("x1",c?w=>c[w]:(b+p-h)/2).attr("x2",c?w=>c[w]:(b+p-h)/2).attr("y1",u&&!xa(s)?w=>u[w]+x:m+x).attr("y2",f&&!xa(s)?s.bandwidth?w=>f[w]+s.bandwidth()-g:w=>f[w]-g:l-y-g).call(zr,this,n).call(f1,this,n,i)).node()}},xh=class extends pt{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"),NM),this.insetRight=kt(s),this.insetLeft=kt(c),hl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{y:c,x1:u,x2:f}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:b,marginBottom:y}=o,{insetLeft:x,insetRight:g}=this;return Ge("svg:g",i).call(ur,this,o,i).call(lr,this,{y:c&&s},0,fr).call(_=>_.selectAll().data(t).enter().append("line").call(Jt,this).attr("x1",u&&!xa(a)?w=>u[w]+x:b+x).attr("x2",f&&!xa(a)?a.bandwidth?w=>f[w]+a.bandwidth()-g:w=>f[w]-g:p-h-g).attr("y1",c?w=>c[w]:(m+l-y)/2).attr("y2",c?w=>c[w]:(m+l-y)/2).call(zr,this,n).call(f1,this,n,i)).node()}};function bl(e,t){let{x:r=It,y:n,y1:o,y2:i,...a}=OM(t);return[o,i]=AM(n,o,i),new gh(e,{...a,x:r,y1:o,y2:i})}function ao(e,t){let{y:r=It,x:n,x1:o,x2:i,...a}=CM(t);return[o,i]=AM(n,o,i),new xh(e,{...a,y:r,x1:o,x2:i})}function AM(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=g1(this)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,rotate:f,text:p,title:l,fontSize:m}=n,{rotate:h}=this,[b,y]=Ko(this,o);return Ge("svg:g",i).call(ur,this,o,i).call(b1,this,p,o).call(lr,this,{x:c&&a,y:u&&s}).call(x=>x.selectAll().data(t).enter().append("text").call(Jt,this).call(b9,this,p,l).attr("transform",Qc`translate(${c?g=>c[g]:b},${u?g=>u[g]:y})${f?g=>` rotate(${f[g]})`:h?` rotate(${h})`:""}`).call(me,"font-size",m&&(g=>m[g])).call(zr,this,n)).node()}};function m1(e){return e==null?null:Cr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function b9(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(Go(r[u])??"").map(c),p=f.length,l=o==="top"?.71:o==="bottom"?1-p:(164-p*100)/200;if(p>1){let m=0;for(let h=0;ho&&r(e,o,s)>t&&(n.push(e.slice(o,i)+(e[i-1]===LM?"-":"")),o=a),c){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*S9(e){let t=0,r=0,n=e.length;for(;rN.selectAll(".tick line").attr("y1",a+c-i),w,_=h?(N,B)=>N.rangeRound(B):(N,B)=>N.range(B),{type:v,domain:I,range:T,interpolate:P,scale:R,pivot:k}=e;if(P){let N=T===void 0?P:To(P.length===1?yl(P):P,T);w=_(R.copy(),wr(ft(u,o-s),Math.min(I.length+(k!==void 0),T===void 0?1/0:T.length)));let B=256,V=x.document.createElement("canvas");V.width=B,V.height=1;let C=V.getContext("2d");for(let G=0,j=B-1;GV:typeof l=="string"?Cn(l):l;w=_(os().domain([-1,T.length-1]),[u,o-s]),g.append("g").attr("fill-opacity",b).selectAll().data(T).enter().append("rect").attr("x",(V,C)=>w(C-1)).attr("y",a).attr("width",(V,C)=>w(C)-w(C-1)).attr("height",i-a-c).attr("fill",V=>V),p=tt(N,(V,C)=>C),l=V=>B(N[V],V)}else w=_(sa().domain(I),[u,o-s]),g.append("g").attr("fill-opacity",b).selectAll().data(I).enter().append("rect").attr("x",w).attr("y",a).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",i-a-c).attr("fill",R),S=()=>{};return g.append("g").attr("transform",`translate(0,${i-c})`).call(Gy(w).ticks(Array.isArray(p)?null:p,typeof l=="string"?l:void 0).tickFormat(typeof l=="function"?l:void 0).tickSize(n).tickValues(Array.isArray(p)?p:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Pt(m,"normal")).call(S).call(N=>N.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 u1=Math.PI/180;function Sl(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=l1(r),e.markerMid=l1(n),e.markerEnd=l1(o)}function l1(e){if(e==null||e===!1)return null;if(e===!0)return PC;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return _C("auto");case"arrow-reverse":return _C("auto-start-reverse");case"dot":return b9;case"circle":case"circle-fill":return PC;case"circle-stroke":return x9;case"tick":return p1("auto");case"tick-x":return p1(90);case"tick-y":return p1(0)}throw new Error(`invalid marker: ${e}`)}function _C(e){return(t,r)=>Ke("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 b9(e,t){return Ke("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 PC(e,t){return Ke("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 x9(e,t){return Ke("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 p1(e){return(t,r)=>Ke("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 w9=0;function d1(e,t,{stroke:r},n){return CC(e,t,r&&(o=>r[o]),null,n)}function TC(e,t,{stroke:r,z:n},o){return CC(e,t,r&&(([i])=>r[i]),n,o)}var m1=1,MC=2;function S9(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=Sh;i1){let c=s[0];a!==(a=Fn(t[c]))&&(r[c]|=m1)}}for(let i=o-1,a=Sh;i>=0;--i){let s=n[i];if(s.length>1){let c=s[0];a!==(a=Fn(t[c]))&&(r[c]|=MC)}}return([i])=>r[i]}function CC(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let c=new Map,u=a&&S9(e,a);function f(p,l,m){return function(h){if(m&&!m(h))return;let b=i(h),y=c.get(l);y||c.set(l,y=new Map);let x=y.get(b);if(!x){let g=this.parentNode.insertBefore(l(b,s),this),S=`plot-marker-${++w9}`;g.setAttribute("id",S),y.set(b,x=`url(#${S})`)}this.setAttribute(p,x)}}t&&e.each(f("marker-start",t,u&&(p=>u(p)&m1))),r&&u&&e.each(f("marker-start",r,p=>!(u(p)&m1))),r&&e.each(f("marker-mid",r)),n&&e.each(f("marker-end",n,u&&(p=>u(p)&MC)))}function _h({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=OC(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function h1({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=OC(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function OC(e,t,r){return e===void 0&&t===void 0&&r===void 0?lr?[1,0]:[.5,.5]:[t,r]}function kC(e,{interval:t}){return e={...xa(e)},e.interval=sh(e.interval===void 0?t:e.interval),e}function g1(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:c}=kC(o,r);if(s==null||c==null&&!n)return r;let u=ya(o);if(c==null){let m,h={transform:b=>m||(m=Zt(b,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,p;function l(m){return p!==void 0&&m===f?p:p=tt(Zt(f=m,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:m=>l(m).map(h=>c.offset(h)),label:u}:a})}function RC(e,t,r){let{[e]:n}=r,{value:o,interval:i}=kC(n,r);return o==null||i==null?r:t({...r,[e]:{label:ya(n),transform:a=>{let s=tt(Zt(a,o),u=>i.floor(u)),c=s.map(u=>i.offset(u));return s.map(Xt(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 NC(e={}){return g1("x",_h,e,!0)}function AC(e={}){return g1("x",_h,e)}function EC(e={}){return g1("y",h1,e)}function FC(e={}){return RC("x",_h,e)}function $C(e={}){return RC("y",h1,e)}var DC={ariaLabel:"rule",fill:null,stroke:"currentColor"},Ph=class extends mt{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}},wl(r,"x"),DC),this.insetTop=kt(s),this.insetBottom=kt(c),Sl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y1:u,y2:f}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:b,marginBottom:y}=o,{insetTop:x,insetBottom:g}=this;return Ke("svg:g",i).call(pr,this,o,i).call(mr,this,{x:c&&a},lr,0).call(S=>S.selectAll().data(t).enter().append("line").call(er,this).attr("x1",c?w=>c[w]:(b+p-h)/2).attr("x2",c?w=>c[w]:(b+p-h)/2).attr("y1",u&&!Sa(s)?w=>u[w]+x:m+x).attr("y2",f&&!Sa(s)?s.bandwidth?w=>f[w]+s.bandwidth()-g:w=>f[w]-g:l-y-g).call(Hr,this,n).call(d1,this,n,i)).node()}},Th=class extends mt{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}},wl(r,"y"),DC),this.insetRight=kt(s),this.insetLeft=kt(c),Sl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{y:c,x1:u,x2:f}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:b,marginBottom:y}=o,{insetLeft:x,insetRight:g}=this;return Ke("svg:g",i).call(pr,this,o,i).call(mr,this,{y:c&&s},0,lr).call(S=>S.selectAll().data(t).enter().append("line").call(er,this).attr("x1",u&&!Sa(a)?w=>u[w]+x:b+x).attr("x2",f&&!Sa(a)?a.bandwidth?w=>f[w]+a.bandwidth()-g:w=>f[w]-g:p-h-g).attr("y1",c?w=>c[w]:(m+l-y)/2).attr("y2",c?w=>c[w]:(m+l-y)/2).call(Hr,this,n).call(d1,this,n,i)).node()}};function vl(e,t){let{x:r=It,y:n,y1:o,y2:i,...a}=EC(t);return[o,i]=LC(n,o,i),new Ph(e,{...a,x:r,y1:o,y2:i})}function co(e,t){let{y:r=It,x:n,x1:o,x2:i,...a}=AC(t);return[o,i]=LC(n,o,i),new Th(e,{...a,y:r,x1:o,x2:i})}function LC(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: ${f}`);this.splitLines=v1(this),this.clipLine=I1(this)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,rotate:f,text:p,title:l,fontSize:m}=n,{rotate:h}=this,[b,y]=Ko(this,o);return Ke("svg:g",i).call(pr,this,o,i).call(S1,this,p,o).call(mr,this,{x:c&&a,y:u&&s}).call(x=>x.selectAll().data(t).enter().append("text").call(er,this).call(I9,this,p,l).attr("transform",of`translate(${c?g=>c[g]:b},${u?g=>u[g]:y})${f?g=>` rotate(${f[g]})`:h?` rotate(${h})`:""}`).call(de,"font-size",m&&(g=>m[g])).call(Hr,this,n)).node()}};function b1(e){return e==null?null:Ar(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function I9(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(zo(r[u])??"").map(c),p=f.length,l=o==="top"?.71:o==="bottom"?1-p:(164-p*100)/200;if(p>1){let m=0;for(let h=0;ho&&r(e,o,s)>t&&(n.push(e.slice(o,i)+(e[i-1]===BC?"-":"")),o=a),c){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*C9(e){let t=0,r=0,n=e.length;for(;ri.split(/\r\n?|\n/g);let n=e?Sh:wh,o=t*100;return i=>w9(i,o,n)}function g1({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?Sh:wh,o=t*100;switch(r){case"clip-start":return i=>$M(i,o,n,"");case"clip-end":return i=>FM(i,o,n,"");case"ellipsis-start":return i=>$M(i,o,n,gs);case"ellipsis-middle":return i=>I9(i,o,n,gs);case"ellipsis-end":return i=>FM(i,o,n,gs)}}var gs="\u2026";function xs(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 FM(e,t,r,n){e=e.trim();let o=r(n),[i]=xs(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function I9(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=xs(e,t/2,r,i),[c]=xs(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 $M(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=xs(e,o-t+i,r,-i);return a<0?n:n+e.slice(tf(e,a)).trimStart()}var p1=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,DM=/\p{Extended_Pictographic}/uy;function tf(e,t){return t+=_9(e,t)?2:1,P9(e,t)&&(t=p1.lastIndex),v9(e,t)?tf(e,t+1):t}function VM(e,t){return e.charCodeAt(t)<128}function _9(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 v9(e,t){return e.charCodeAt(t)===8205}function P9(e,t){return VM(e,t)?!1:(p1.lastIndex=t,p1.test(e))}function UM(e,t){return VM(e,t)?!1:(DM.lastIndex=t,DM.test(e))}var T9={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},jM=3.5,M9=jM*5,BM={draw(e,t,r){let n=t*r/M9;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},C9={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},O9=new Map([["arrow",BM],["spike",C9]]);function k9(e){return e&&typeof e.draw=="function"}function R9(e){if(k9(e))return e;let t=O9.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Ih=class extends pt{constructor(t,r={}){let{x:n,y:o,r:i=jM,length:a,rotate:s,shape:c=BM,anchor:u="middle",frameAnchor:f}=r,[p,l]=_t(a,12),[m,h]=_t(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:p,scale:"length",optional:!0},rotate:{value:m,optional:!0}},r,T9),this.r=+i,this.length=l,this.rotate=h,this.shape=R9(c),this.anchor=Cr(u,"anchor",["start","middle","end"]),this.frameAnchor=ga(f)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,length:f,rotate:p}=n,{length:l,rotate:m,anchor:h,shape:b,r:y}=this,[x,g]=Ko(this,o);return Ge("svg:g",i).call(ur,this,o,i).call(lr,this,{x:c&&a,y:u&&s}).call(_=>_.selectAll().data(t).enter().append("path").call(Jt,this).attr("transform",Qc`translate(${c?w=>c[w]:x},${u?w=>u[w]:g})${p?w=>` rotate(${p[w]})`:m?` rotate(${m})`:""}${h==="start"?"":h==="end"?f?w=>` translate(0,${f[w]})`:` translate(0,${l})`:f?w=>` translate(0,${f[w]/2})`:` translate(0,${l/2})`}`).attr("d",f?w=>{let I=to();return b.draw(I,f[w],y),I}:(()=>{let w=to();return b.draw(w,l,y),w})()).call(zr,this,n)).node()}};function zM(e,t={}){let{x:r=It,...n}=t;return new Ih(e,{...n,x:r})}function GM(e,t={}){let{y:r=It,...n}=t;return new Ih(e,{...n,y:r})}function Sa(e,t){return arguments.length<2&&!An(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function _h({anchor:e}={},t){return e===void 0?t[0]:Cr(e,"anchor",t)}function KM(e){return _h(e,["left","right"])}function qM(e){return _h(e,["right","left"])}function HM(e){return _h(e,["bottom","top"])}function YM(e){return _h(e,["top","bottom"])}function w1(){let[e,t]=Sa(...arguments);return ZM("y",KM(t),e,t)}function WM(){let[e,t]=Sa(...arguments);return ZM("fy",qM(t),e,t)}function S1(){let[e,t]=Sa(...arguments);return QM("x",HM(t),e,t)}function XM(){let[e,t]=Sa(...arguments);return QM("fx",YM(t),e,t)}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:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="y"?6:0,tickPadding:b,tickRotate:y,x,margin:g,marginTop:_=g===void 0?20:g,marginRight:w=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:M,labelArrow:C,labelOffset:R,ariaLabel:O=`${e}-axis`,...N}){return h=kt(h),b=kt(b),y=kt(y),M!==void 0&&(M=Cr(M,"labelAnchor",["center","top","bottom"])),C=uC(C),Jx(h&&!Zt(i)?N9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,x,ariaLabel:O,...N}):null,Zt(c)?null:E9(e,t,r,{fill:c,fillOpacity:u,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:f,tickSize:h,tickPadding:b,tickRotate:y,x,marginTop:_,marginRight:w,marginBottom:I,marginLeft:S,ariaLabel:O,...N}),!Zt(c)&&v!==null?ef([],aC({fill:c,fillOpacity:u,...N},function(z,j,k,B,V){let Q=B[e],{marginTop:U,marginRight:K,marginBottom:W,marginLeft:Z}=e==="y"&&V.inset||V,X=M??(Q.bandwidth?"center":"top"),he=R??(t==="right"?K:Z)-3;return X==="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=X,this.frameAnchor=`${X}-${t}`,this.rotate=0),this.dy=X==="top"?3-U:X==="bottom"?W-3:0,this.dx=t==="right"?he:-he,this.ariaLabel=`${O} label`,{facets:[[0]],channels:{text:{value:[fC(e,Q,{anchor:t,label:v,labelAnchor:X,labelArrow:C})]}}}})):null)}function QM(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:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="x"?6:0,tickPadding:b,tickRotate:y,y:x,margin:g,marginTop:_=g===void 0?t==="top"?30:0:g,marginRight:w=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:M,labelArrow:C,labelOffset:R,ariaLabel:O=`${e}-axis`,...N}){return h=kt(h),b=kt(b),y=kt(y),M!==void 0&&(M=Cr(M,"labelAnchor",["center","left","right"])),C=uC(C),Jx(h&&!Zt(i)?A9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,y:x,ariaLabel:O,...N}):null,Zt(c)?null:F9(e,t,r,{fill:c,fillOpacity:u,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:f,tickSize:h,tickPadding:b,tickRotate:y,y:x,marginTop:_,marginRight:w,marginBottom:I,marginLeft:S,ariaLabel:O,...N}),!Zt(c)&&v!==null?ef([],aC({fill:c,fillOpacity:u,...N},function(z,j,k,B,V){let Q=B[e],{marginTop:U,marginRight:K,marginBottom:W,marginLeft:Z}=e==="x"&&V.inset||V,X=M??(Q.bandwidth?"center":"right"),he=R??(t==="top"?U:W)-3;return X==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${X}`,this.textAnchor=X==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-he:he,this.dx=X==="right"?K-3:X==="left"?3-Z:0,this.ariaLabel=`${O} label`,{facets:[[0]],channels:{text:{value:[fC(e,Q,{anchor:t,label:v,labelAnchor:X,labelArrow:C})]}}}})):null)}function N9(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:p=u,dx:l=0,y:m=e==="y"?void 0:null,ariaLabel:h,...b}){return rf(GM,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:m,...b,dx:t==="left"?+l-fr+ +f:+l+fr-p,anchor:"start",length:c,shape:t==="left"?V9:U9})}function A9(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:p=u,dy:l=0,x:m=e==="x"?void 0:null,ariaLabel:h,...b}){return rf(zM,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:m,...b,dy:t==="bottom"?+l-fr-p:+l+fr+ +f,anchor:"start",length:c,shape:t==="bottom"?D9:L9})}function E9(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*i1):0),text:c,textAnchor:u=Math.abs(a)>60?"middle":t==="left"?"end":"start",lineAnchor:f=a>60?"top":a<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:m=l,insetRight:h=l,dx:b=0,ariaLabel:y,y:x=e==="y"?void 0:null,...g}){return rf(h1,e,r,{ariaLabel:`${y} tick label`},{facetAnchor:n,frameAnchor:o,text:c,textAnchor:u,lineAnchor:f,fontVariant:p,rotate:a,y:x,...g,dx:t==="left"?+b-i-s+ +m:+b+ +i+ +s-h},function(_,w,I,S,v){p===void 0&&(this.fontVariant=cC(_)),c===void 0&&(v.text=sC(_,w,I,S,t))})}function F9(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*i1):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:p,inset:l=0,insetTop:m=l,insetBottom:h=l,dy:b=0,x:y=e==="x"?void 0:null,ariaLabel:x,...g}){return rf(d1,e,r,{ariaLabel:`${x} tick label`},{facetAnchor:n,frameAnchor:o,text:c===void 0?null:c,textAnchor:u,lineAnchor:f,fontVariant:p,rotate:a,x:y,...g,dy:t==="bottom"?+b+ +i+ +s-h:+b-i-s+ +m},function(_,w,I,S,v){p===void 0&&(this.fontVariant=cC(_)),c===void 0&&(v.text=sC(_,w,I,S,t))})}function JM(){let[e,t]=Sa(...arguments);return nC("y",KM(t),e,t)}function eC(){let[e,t]=Sa(...arguments);return nC("fy",qM(t),e,t)}function tC(){let[e,t]=Sa(...arguments);return oC("x",HM(t),e,t)}function rC(){let[e,t]=Sa(...arguments);return oC("fx",YM(t),e,t)}function nC(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(ao,e,r,{ariaLabel:s,ariaHidden:c},{y:n,x1:i,x2:a,...iC(u)})}function oC(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(bl,e,r,{ariaLabel:s,ariaHidden:c},{x:n,y1:i,y2:a,...iC(u)})}function iC({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 aC({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:c,shapeRendering:u,clip:f=!1},p){return[,e]=Uo(e),[,t]=_t(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:p}}function rf(e,t,r,n,o,i){let a;function s(f,p,l,m,h,b){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=m;if(!x)throw new Error(`missing scale: ${t}`);let g=x.domain(),{interval:_,ticks:w,tickFormat:I,tickSpacing:S=t==="x"?80:35}=o;if(typeof w=="string"&&lC(x)&&(_=w,w=void 0),w===void 0&&(w=ba(_,x.type)??$9(x,S)),f==null){if(An(w))f=jo(w);else if(RT(w))f=x1(w,...Lr(g));else if(x.interval){let M=x.interval;if(x.ticks){let[C,R]=Lr(g),O=(R-C)/M[$c];M=px(M,O/w)??M,f=x1(M,C,R)}else{f=g;let C=f.length;M=px(M,C/w)??M,M!==x.interval&&(f=x1(M,...Lr(f)))}if(M===x.interval){let C=Math.round(f.length/w);C>1&&(f=f.filter((R,O)=>O%C===0))}}else x.ticks?f=x.ticks(w):f=g;if(!x.ticks&&f.length&&f!==g){let M=new Zn(g);f=f.filter(C=>M.has(C)),f.length||Br(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?p=[jr(f)]:a[t]={scale:t,value:It}}i?.call(this,x,f,w,I,a);let v=Object.fromEntries(Object.entries(a).map(([M,C])=>[M,{...C,value:Xt(f,C.value)}]));return y&&(p=b.filterFacets(f,v)),{data:f,facets:p,channels:v}}let c=Oi(o).initializer,u=e(r,Oi({...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 $9(e,t){let[r,n]=Lr(e.range());return(n-r)/t}function sC(e,t,r,n,o){return{value:yl(e,t,r,n,o)}}function yl(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Wt(t)?mT(e.type,t,o)??Go:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(Wt(e.domain())?Do:Pn)(n):n===void 0?Go:sn(n)}function x1(e,t,r){return e.range(t,e.offset(e.floor(r)))}var D9={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},L9={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},V9={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},U9={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function cC(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function fC(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&lC(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=z6(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 uC(e="auto"){return Zt(e)?!1:typeof e=="boolean"?e:Cr(e,"labelArrow",["auto","up","right","down","left"])}function lC(e){return Wt(e.domain())}function pC(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function mC(e,{opacity:t,...r}={}){if(!zo(e)&&!Kx(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return hC(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",_t(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function dC(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:Zt(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},c){let[u,f]=Uo(t),[p,l]=Uo(n),m=pC(c,u),h=pC(c,p),b=a*a*Math.PI;return r=_t(r)[1],o=_t(o)[1],i=_t(i)[1],hC(e,s,(y,x,g,_)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",_).attr("fill",u==="color"?w=>m.scale(w):f).attr("fill-opacity",r).attr("stroke",p==="color"?w=>h.scale(w):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let I=to();return e.scale(w).draw(I,b),I}))}function hC(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=bh(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:c=a,marginLeft:u=0,className:f,style:p,width:l}=t,m=Wc(t);f=Xc(f),o=yl(e.scale,e.domain,void 0,o);let h=Ge("div",m).attr("class",`${f}-swatches ${f}-swatches-${n!=null?"columns":"wrap"}`),b;return n!=null?(b=`:where(.${f}-swatches-columns .${f}-swatch) { +`:yield[t,r,!0],r+=o,t=r;break;default:++r;break}}yield[t,r,!0]}var VC={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 Mh(e,t=0,r=e.length){let n=0;for(let o=t;oi.split(/\r\n?|\n/g);let n=e?Ch:Mh,o=t*100;return i=>M9(i,o,n)}function I1({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?Ch:Mh,o=t*100;switch(r){case"clip-start":return i=>UC(i,o,n,"");case"clip-end":return i=>jC(i,o,n,"");case"ellipsis-start":return i=>UC(i,o,n,vs);case"ellipsis-middle":return i=>O9(i,o,n,vs);case"ellipsis-end":return i=>jC(i,o,n,vs)}}var vs="\u2026";function Is(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 jC(e,t,r,n){e=e.trim();let o=r(n),[i]=Is(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function O9(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=Is(e,t/2,r,i),[c]=Is(e,o-t/2-s+i,r,-i);return c<0?n:e.slice(0,a).trimEnd()+n+e.slice(cf(e,c)).trimStart()}function UC(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=Is(e,o-t+i,r,-i);return a<0?n:n+e.slice(cf(e,a)).trimStart()}var y1=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,GC=/\p{Extended_Pictographic}/uy;function cf(e,t){return t+=k9(e,t)?2:1,N9(e,t)&&(t=y1.lastIndex),R9(e,t)?cf(e,t+1):t}function zC(e,t){return e.charCodeAt(t)<128}function k9(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 R9(e,t){return e.charCodeAt(t)===8205}function N9(e,t){return zC(e,t)?!1:(y1.lastIndex=t,y1.test(e))}function KC(e,t){return zC(e,t)?!1:(GC.lastIndex=t,GC.test(e))}var A9={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},qC=3.5,E9=qC*5,HC={draw(e,t,r){let n=t*r/E9;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},F9={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},$9=new Map([["arrow",HC],["spike",F9]]);function D9(e){return e&&typeof e.draw=="function"}function L9(e){if(D9(e))return e;let t=$9.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Oh=class extends mt{constructor(t,r={}){let{x:n,y:o,r:i=qC,length:a,rotate:s,shape:c=HC,anchor:u="middle",frameAnchor:f}=r,[p,l]=_t(a,12),[m,h]=_t(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},length:{value:p,scale:"length",optional:!0},rotate:{value:m,optional:!0}},r,A9),this.r=+i,this.length=l,this.rotate=h,this.shape=L9(c),this.anchor=Ar(u,"anchor",["start","middle","end"]),this.frameAnchor=wa(f)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,length:f,rotate:p}=n,{length:l,rotate:m,anchor:h,shape:b,r:y}=this,[x,g]=Ko(this,o);return Ke("svg:g",i).call(pr,this,o,i).call(mr,this,{x:c&&a,y:u&&s}).call(S=>S.selectAll().data(t).enter().append("path").call(er,this).attr("transform",of`translate(${c?w=>c[w]:x},${u?w=>u[w]:g})${p?w=>` rotate(${p[w]})`:m?` rotate(${m})`:""}${h==="start"?"":h==="end"?f?w=>` translate(0,${f[w]})`:` translate(0,${l})`:f?w=>` translate(0,${f[w]/2})`:` translate(0,${l/2})`}`).attr("d",f?w=>{let _=no();return b.draw(_,f[w],y),_}:(()=>{let w=no();return b.draw(w,l,y),w})()).call(Hr,this,n)).node()}};function YC(e,t={}){let{x:r=It,...n}=t;return new Oh(e,{...n,x:r})}function WC(e,t={}){let{y:r=It,...n}=t;return new Oh(e,{...n,y:r})}function Ia(e,t){return arguments.length<2&&!$n(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function kh({anchor:e}={},t){return e===void 0?t[0]:Ar(e,"anchor",t)}function XC(e){return kh(e,["left","right"])}function ZC(e){return kh(e,["right","left"])}function QC(e){return kh(e,["bottom","top"])}function JC(e){return kh(e,["top","bottom"])}function P1(){let[e,t]=Ia(...arguments);return r6("y",XC(t),e,t)}function e6(){let[e,t]=Ia(...arguments);return r6("fy",ZC(t),e,t)}function T1(){let[e,t]=Ia(...arguments);return n6("x",QC(t),e,t)}function t6(){let[e,t]=Ia(...arguments);return n6("fx",JC(t),e,t)}function r6(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:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="y"?6:0,tickPadding:b,tickRotate:y,x,margin:g,marginTop:S=g===void 0?20:g,marginRight:w=g===void 0?t==="right"?40:0:g,marginBottom:_=g===void 0?20:g,marginLeft:v=g===void 0?t==="left"?40:0:g,label:I,labelAnchor:T,labelArrow:P,labelOffset:R,ariaLabel:k=`${e}-axis`,...N}){return h=kt(h),b=kt(b),y=kt(y),T!==void 0&&(T=Ar(T,"labelAnchor",["center","top","bottom"])),P=h6(P),o1(h&&!Qt(i)?V9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,x,ariaLabel:k,...N}):null,Qt(c)?null:U9(e,t,r,{fill:c,fillOpacity:u,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:f,tickSize:h,tickPadding:b,tickRotate:y,x,marginTop:S,marginRight:w,marginBottom:_,marginLeft:v,ariaLabel:k,...N}),!Qt(c)&&I!==null?sf([],l6({fill:c,fillOpacity:u,...N},function(B,V,C,G,j){let H=G[e],{marginTop:U,marginRight:z,marginBottom:Y,marginLeft:X}=e==="y"&&j.inset||j,q=T??(H.bandwidth?"center":"top"),ae=R??(t==="right"?z:X)-3;return q==="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=q,this.frameAnchor=`${q}-${t}`,this.rotate=0),this.dy=q==="top"?3-U:q==="bottom"?Y-3:0,this.dx=t==="right"?ae:-ae,this.ariaLabel=`${k} label`,{facets:[[0]],channels:{text:{value:[d6(e,H,{anchor:t,label:I,labelAnchor:q,labelArrow:P})]}}}})):null)}function n6(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:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="x"?6:0,tickPadding:b,tickRotate:y,y:x,margin:g,marginTop:S=g===void 0?t==="top"?30:0:g,marginRight:w=g===void 0?20:g,marginBottom:_=g===void 0?t==="bottom"?30:0:g,marginLeft:v=g===void 0?20:g,label:I,labelAnchor:T,labelArrow:P,labelOffset:R,ariaLabel:k=`${e}-axis`,...N}){return h=kt(h),b=kt(b),y=kt(y),T!==void 0&&(T=Ar(T,"labelAnchor",["center","left","right"])),P=h6(P),o1(h&&!Qt(i)?j9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,y:x,ariaLabel:k,...N}):null,Qt(c)?null:G9(e,t,r,{fill:c,fillOpacity:u,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:f,tickSize:h,tickPadding:b,tickRotate:y,y:x,marginTop:S,marginRight:w,marginBottom:_,marginLeft:v,ariaLabel:k,...N}),!Qt(c)&&I!==null?sf([],l6({fill:c,fillOpacity:u,...N},function(B,V,C,G,j){let H=G[e],{marginTop:U,marginRight:z,marginBottom:Y,marginLeft:X}=e==="x"&&j.inset||j,q=T??(H.bandwidth?"center":"right"),ae=R??(t==="top"?U:Y)-3;return q==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${q}`,this.textAnchor=q==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-ae:ae,this.dx=q==="right"?z-3:q==="left"?3-X:0,this.ariaLabel=`${k} label`,{facets:[[0]],channels:{text:{value:[d6(e,H,{anchor:t,label:I,labelAnchor:q,labelArrow:P})]}}}})):null)}function V9(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:p=u,dx:l=0,y:m=e==="y"?void 0:null,ariaLabel:h,...b}){return ff(WC,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:m,...b,dx:t==="left"?+l-lr+ +f:+l+lr-p,anchor:"start",length:c,shape:t==="left"?q9:H9})}function j9(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:p=u,dy:l=0,x:m=e==="x"?void 0:null,ariaLabel:h,...b}){return ff(YC,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:m,...b,dy:t==="bottom"?+l-lr-p:+l+lr+ +f,anchor:"start",length:c,shape:t==="bottom"?z9:K9})}function U9(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*u1):0),text:c,textAnchor:u=Math.abs(a)>60?"middle":t==="left"?"end":"start",lineAnchor:f=a>60?"top":a<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:m=l,insetRight:h=l,dx:b=0,ariaLabel:y,y:x=e==="y"?void 0:null,...g}){return ff(w1,e,r,{ariaLabel:`${y} tick label`},{facetAnchor:n,frameAnchor:o,text:c,textAnchor:u,lineAnchor:f,fontVariant:p,rotate:a,y:x,...g,dx:t==="left"?+b-i-s+ +m:+b+ +i+ +s-h},function(S,w,_,v,I){p===void 0&&(this.fontVariant=m6(S)),c===void 0&&(I.text=p6(S,w,_,v,t))})}function G9(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*u1):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:p,inset:l=0,insetTop:m=l,insetBottom:h=l,dy:b=0,x:y=e==="x"?void 0:null,ariaLabel:x,...g}){return ff(x1,e,r,{ariaLabel:`${x} tick label`},{facetAnchor:n,frameAnchor:o,text:c===void 0?null:c,textAnchor:u,lineAnchor:f,fontVariant:p,rotate:a,x:y,...g,dy:t==="bottom"?+b+ +i+ +s-h:+b-i-s+ +m},function(S,w,_,v,I){p===void 0&&(this.fontVariant=m6(S)),c===void 0&&(I.text=p6(S,w,_,v,t))})}function o6(){let[e,t]=Ia(...arguments);return c6("y",XC(t),e,t)}function i6(){let[e,t]=Ia(...arguments);return c6("fy",ZC(t),e,t)}function a6(){let[e,t]=Ia(...arguments);return f6("x",QC(t),e,t)}function s6(){let[e,t]=Ia(...arguments);return f6("fx",JC(t),e,t)}function c6(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 ff(co,e,r,{ariaLabel:s,ariaHidden:c},{y:n,x1:i,x2:a,...u6(u)})}function f6(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 ff(vl,e,r,{ariaLabel:s,ariaHidden:c},{x:n,y1:i,y2:a,...u6(u)})}function u6({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 l6({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:c,shapeRendering:u,clip:f=!1},p){return[,e]=jo(e),[,t]=_t(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:p}}function ff(e,t,r,n,o,i){let a;function s(f,p,l,m,h,b){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=m;if(!x)throw new Error(`missing scale: ${t}`);let g=x.domain(),{interval:S,ticks:w,tickFormat:_,tickSpacing:v=t==="x"?80:35}=o;if(typeof w=="string"&&g6(x)&&(S=w,w=void 0),w===void 0&&(w=ba(S,x.type)??B9(x,v)),f==null){if($n(w))f=Uo(w);else if($T(w))f=_1(w,...Gr(g));else if(x.interval){let T=x.interval;if(x.ticks){let[P,R]=Gr(g),k=(R-P)/T[Gc];T=yx(T,k/w)??T,f=_1(T,P,R)}else{f=g;let P=f.length;T=yx(T,P/w)??T,T!==x.interval&&(f=_1(T,...Gr(f)))}if(T===x.interval){let P=Math.round(f.length/w);P>1&&(f=f.filter((R,k)=>k%P===0))}}else x.ticks?f=x.ticks(w):f=g;if(!x.ticks&&f.length&&f!==g){let T=new eo(g);f=f.filter(P=>T.has(P)),f.length||qr(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?p=[Kr(f)]:a[t]={scale:t,value:It}}i?.call(this,x,f,w,_,a);let I=Object.fromEntries(Object.entries(a).map(([T,P])=>[T,{...P,value:Zt(f,P.value)}]));return y&&(p=b.filterFacets(f,I)),{data:f,facets:p,channels:I}}let c=ki(o).initializer,u=e(r,ki({...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 B9(e,t){let[r,n]=Gr(e.range());return(n-r)/t}function p6(e,t,r,n,o){return{value:Il(e,t,r,n,o)}}function Il(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Xt(t)?bT(e.type,t,o)??zo:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(Xt(e.domain())?Do:Cn)(n):n===void 0?zo:un(n)}function _1(e,t,r){return e.range(t,e.offset(e.floor(r)))}var z9={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},K9={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},q9={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},H9={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function m6(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function d6(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&g6(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=YM(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 h6(e="auto"){return Qt(e)?!1:typeof e=="boolean"?e:Ar(e,"labelArrow",["auto","up","right","down","left"])}function g6(e){return Xt(e.domain())}function y6(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function b6(e,{opacity:t,...r}={}){if(!Bo(e)&&!Xx(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return w6(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",_t(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function x6(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:Qt(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},c){let[u,f]=jo(t),[p,l]=jo(n),m=y6(c,u),h=y6(c,p),b=a*a*Math.PI;return r=_t(r)[1],o=_t(o)[1],i=_t(i)[1],w6(e,s,(y,x,g,S)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",S).attr("fill",u==="color"?w=>m.scale(w):f).attr("fill-opacity",r).attr("stroke",p==="color"?w=>h.scale(w):l).attr("stroke-opacity",o).attr("stroke-width",i).append("path").attr("d",w=>{let _=no();return e.scale(w).draw(_,b),_}))}function w6(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=Ih(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:c=a,marginLeft:u=0,className:f,style:p,width:l}=t,m=tf(t);f=rf(f),o=Il(e.scale,e.domain,void 0,o);let h=Ke("div",m).attr("class",`${f}-swatches ${f}-swatches-${n!=null?"columns":"wrap"}`),b;return n!=null?(b=`:where(.${f}-swatches-columns .${f}-swatch) { display: flex; align-items: center; break-inside: avoid; @@ -45,7 +45,7 @@ ${r}`}function LE(e){return e==="time"?Xd:e==="utc"?al:$E}function mT(e,t,r){let margin-right: 0.5em; overflow: visible; } -${b}`)).style("margin-left",u?`${+u}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",vt(i,"normal")).call(Zc,p).node()}var I1=new Map([["symbol",dC],["color",gC],["opacity",j9]]);function bC(e,t,r={}){return(n,o)=>{if(!I1.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return I1.get(n)(e[n],yC(t,r[n],o),i=>e[i])}}function yC({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return LT(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function gC(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return mC(e,r);case"ramp":return gM(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function j9({type:e,interpolate:t,...r},{legend:n=!0,color:o=_n(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 gC({type:e,...r,interpolate:B9(o)},{legend:n,...i})}function B9(e){let{r:t,g:r,b:n}=_n(e)||_n(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function xC(e,t,r){let n=[];for(let[o,i]of I1){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],yC(t,e[o],a),c=>e[c]);s!=null&&n.push(s)}}return n}function wC(e={},t="y"){return Ix(e)?e:{...e,[t]:It}}function SC(e,t){if(t.length===1)return{data:e,facets:t};let r=da(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=pa(e);let i=e[hx]=new Uint32Array(r+o);t=t.map(s=>pa(s,Uint32Array));let a=r;n.fill(0);for(let s of t)for(let c=0,u=s.length;c{({data:b,facets:y}=SC(b,y));let g=e==null?void 0:f(OT(Xt(b,e),x?.[r])),_=Xt(b,t,Float64Array),w=Xt(b,c),I=i&&i(b,g,_,w),S=da(b),v=l(new Float64Array(S)),M=h(new Float64Array(S)),C=[];for(let R of y){let O=g?Array.from(ci(R,N=>g[N]).values()):[R];if(I)for(let N of O)N.sort(I);for(let N of O){let z=0,j=0;a&&N.reverse();for(let k of N){let B=_[k];B<0?z=M[k]=(v[k]=z)+B:B>0?j=M[k]=(v[k]=j)+B:M[k]=v[k]=j}}C.push(O)}return o&&o(C,v,M,w),{data:b,facets:y}}),u,p,m]}function q9(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return H9;case"center":case"silhouette":return Y9;case"wiggle":return TC}throw new Error(`unknown offset: ${e}`)}}function PC(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function H9(e,t,r){for(let n of e)for(let o of n){let[i,a]=PC(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 Y9(e,t,r){for(let n of e){for(let o of n){let[i,a]=PC(o,r);for(let s of o){let c=(a+i)/2;t[s]-=c,r[s]-=c}}MC(n,t,r)}CC(e,t,r)}function TC(e,t,r,n){for(let o of e){let i=new vr,a=0;for(let s of o){let c=-1,u=s.map(m=>Math.abs(r[m]-t[m])),f=s.map(m=>{c=n?n[m]:++c;let h=r[m]-t[m],b=i.has(c)?h-i.get(c):0;return i.set(c,h),b}),p=[0,...sp(f)];for(let m of s)t[m]+=a,r[m]+=a;let l=Sn(u);l&&(a-=Sn(u,(m,h)=>(f[h]/2+p[h])*m)/l)}MC(o,t,r)}CC(e,t,r)}function MC(e,t,r){let n=Pr(e,o=>Pr(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function CC(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(Pr(s,c=>t[c])+Gt(s,c=>r[c]))/2),a=Pr(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function Z9(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function Q9(e){return Ph(e,(t,r,n,o)=>Qs(jr(t),i=>Sn(i,a=>n[a]),i=>o[i]))}function J9(e){return Ph(e,(t,r,n,o)=>Qs(jr(t),i=>r[Bf(i,a=>n[a])],i=>o[i]))}function IC(e){return Ph(e,(t,r,n,o)=>{let i=jr(t),a=Qs(i,p=>r[Bf(p,l=>n[l])],p=>o[p]),s=So(i,p=>Sn(p,l=>n[l]),p=>o[p]),c=[],u=[],f=0;for(let p of a)f<0?(f+=s.get(p),c.push(p)):(f-=s.get(p),u.push(p));return u.reverse().concat(c)})}function _C(e){return t=>{let r=Xt(t,e);return(n,o)=>Ur(r[n],r[o])}}function e$(e){return t=>oo(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function t$(e){return Ph(Ur,()=>e)}function Ph(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new vr(t(r,n,o,i).map((s,c)=>[s,c]));return(s,c)=>e(a.get(i[s]),a.get(i[c]))}}var r$={ariaLabel:"rect"},Ch=class extends pt{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,r$),_1(this,r),v1(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x1:c,y1:u,x2:f,y2:p}=n,{marginTop:l,marginRight:m,marginBottom:h,marginLeft:b,width:y,height:x}=o,{projection:g}=i,{insetTop:_,insetRight:w,insetBottom:I,insetLeft:S}=this,{rx:v,ry:M,rx1y1:C,rx1y2:R,rx2y1:O,rx2y2:N}=this;(c||f)&&!g&&xa(a)&&(c=f=null),(u||p)&&!g&&xa(s)&&(u=p=null);let z=a?.bandwidth?a.bandwidth():0,j=s?.bandwidth?s.bandwidth():0;return Ge("svg:g",i).call(ur,this,o,i).call(lr,this,{},0,0).call(k=>k.selectAll().data(t).enter().call(C||R||O||N?B=>B.append("path").call(Jt,this).call(P1,c&&f?V=>c[V]+(f[V]c[V]+S:b+S,u&&p?V=>u[V]+(p[V]u[V]+_:l+_,c&&f?V=>f[V]-(f[V]c[V]+z-w:y-m-w,u&&p?V=>p[V]-(p[V]u[V]+j-I:x-h-I,this).call(zr,this,n):B=>B.append("rect").call(Jt,this).attr("x",c?f?V=>Math.min(c[V],f[V])+S:V=>c[V]+S:b+S).attr("y",u?p?V=>Math.min(u[V],p[V])+_:V=>u[V]+_:l+_).attr("width",c?f?V=>Math.max(0,Math.abs(f[V]-c[V])+z-S-w):z-S-w:y-m-b-w-S).attr("height",u?p?V=>Math.max(0,Math.abs(u[V]-p[V])+j-_-I):j-_-I:x-l-h-_-I).call(me,"rx",v).call(me,"ry",M).call(zr,this,n))).node()}};function _1(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=kt(r),e.insetRight=kt(n),e.insetBottom=kt(o),e.insetLeft=kt(i)}function v1(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:p=a!==void 0?+a:s!==void 0?+s:0}={}){c||u||f||p?(e.rx1y1=c,e.rx1y2=u,e.rx2y1=f,e.rx2y2=p):(e.rx=vt(r,"auto"),e.ry=vt(n,"auto"))}function P1(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:c,rx2y2:u}=i;typeof t!="function"&&(t=sn(t)),typeof r!="function"&&(r=sn(r)),typeof n!="function"&&(n=sn(n)),typeof o!="function"&&(o=sn(o));let f=Math.max(Math.abs(a+c),Math.abs(s+u)),p=Math.max(Math.abs(a+s),Math.abs(c+u));e.attr("d",l=>{let m=t(l),h=r(l),b=n(l),y=o(l),x=m>b,g=h>y,_=x?b:m,w=x?m:b,I=g?y:h,S=g?h:y,v=Math.min(1,(w-_)/f,(S-I)/p),M=v*(x?g?u:c:g?s:a),C=v*(x?g?s:a:g?u:c),R=v*(x?g?a:s:g?c:u),O=v*(x?g?c:u:g?a:s);return`M${_},${I+Mh(M,O)}A${M},${M} 0 0 ${M<0?0:1} ${_+Th(M,O)},${I}H${w-Th(C,R)}A${C},${C} 0 0 ${C<0?0:1} ${w},${I+Mh(C,R)}V${S-Mh(R,C)}A${R},${R} 0 0 ${R<0?0:1} ${w-Th(R,C)},${S}H${_+Th(O,M)}A${O},${O} 0 0 ${O<0?0:1} ${_},${S-Mh(O,M)}Z`})}function Th(e,t){return t<0?e:Math.abs(e)}function Mh(e,t){return t<0?Math.abs(e):e}function Ei(e,t={}){return vT(t)||(t={...t,x:sl,y2:It,interval:1}),new Ch(e,vC(MM(wC(t))))}var n$={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},o$={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},T1=class extends pt{constructor(t={}){let{anchor:r=null}=t;super(Dc,void 0,t,r==null?n$:o$),this.anchor=Sx(r,"anchor",["top","right","bottom","left"]),_1(this,t),r||v1(this,t)}render(t,r,n,o,i){let{marginTop:a,marginRight:s,marginBottom:c,marginLeft:u,width:f,height:p}=o,{anchor:l,insetTop:m,insetRight:h,insetBottom:b,insetLeft:y}=this,{rx:x,ry:g,rx1y1:_,rx1y2:w,rx2y1:I,rx2y2:S}=this,v=u+y,M=f-s-h,C=a+m,R=p-c-b;return Ge(l?"svg:line":_||w||I||S?"svg:path":"svg:rect",i).datum(0).call(ur,this,o,i).call(Jt,this).call(zr,this,n).call(lr,this,{}).call(l==="left"?O=>O.attr("x1",v).attr("x2",v).attr("y1",C).attr("y2",R):l==="right"?O=>O.attr("x1",M).attr("x2",M).attr("y1",C).attr("y2",R):l==="top"?O=>O.attr("x1",v).attr("x2",M).attr("y1",C).attr("y2",C):l==="bottom"?O=>O.attr("x1",v).attr("x2",M).attr("y1",R).attr("y2",R):_||w||I||S?O=>O.call(P1,v,C,M,R,this):O=>O.attr("x",v).attr("y",C).attr("width",M-v).attr("height",R-C).attr("rx",x).attr("ry",g)).node()}};function M1(e){return new T1(e)}var C1={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},i$=new Set(["geometry","href","src","ariaLabel","scales"]),O1=class extends pt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&An(t)&&th(t)&&(r={...r,title:It});let{x:n,y:o,x1:i,x2:a,y1:s,y2:c,anchor:u,preferredAnchor:f="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:m,fontStyle:h,fontVariant:b,fontWeight:y,lineHeight:x=1,lineWidth:g=20,frameAnchor:_,format:w,textAnchor:I="start",textOverflow:S,textPadding:v=8,title:M,pointerSize:C=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:M,optional:!0}},r,C1),this.anchor=nh(u,"anchor"),this.preferredAnchor=nh(f,"preferredAnchor"),this.frameAnchor=ga(_),this.textAnchor=vt(I,"middle"),this.textPadding=+v,this.pointerSize=+C,this.pathFilter=Ot(R),this.lineHeight=+x,this.lineWidth=+g,this.textOverflow=m1(S),this.monospace=!!p,this.fontFamily=Ot(l),this.fontSize=kt(m),this.fontStyle=Ot(h),this.fontVariant=Ot(b),this.fontWeight=Ot(y);for(let O in C1)O in this.channels&&(this[O]=C1[O]);this.splitLines=y1(this),this.clipLine=g1(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(t,r,n,o,i){let a=this,{x:s,y:c,fx:u,fy:f}=r,{ownerSVGElement:p,document:l}=i,{anchor:m,monospace:h,lineHeight:b,lineWidth:y}=this,{textPadding:x,pointerSize:g,pathFilter:_}=this,{marginTop:w,marginLeft:I}=o,{x1:S,y1:v,x2:M,y2:C,x:R=S??M,y:O=v??C}=n,N=u?u(t.fx)-I:0,z=f?f(t.fy)-w:0,[j,k]=Ko(this,o),B=n1(n,j),V=o1(n,k),Q=h?Sh:wh,U=Q(gs),K,W;"title"in n?(K=OC.call(this,{title:n.channels.title},r),W=f$):(K=OC.call(this,n.channels,r),W=u$);let Z=Ge("svg:g",i).call(ur,this,o,i).call(b1,this).call(lr,this,{x:R&&s,y:O&&c}).call(se=>se.selectAll().data(t).enter().append("g").attr("transform",ce=>`translate(${Math.round(B(ce))},${Math.round(V(ce))})`).call(Jt,this).call(ce=>ce.append("path").attr("filter",_)).call(ce=>ce.append("text").each(function(Y){let ee=In(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let T=W.call(a,Y,t,K,r,n);if(typeof T=="string")for(let L of a.splitLines(T))X(ee,{value:a.clipLine(L)});else{let L=new Set;for(let G of T){let{label:A=""}=G;A&&L.has(A)||(L.add(A),X(ee,G))}}})));function X(se,{label:ce,value:Y,color:ee,opacity:T}){ce??="",Y??="";let L=ee!=null||T!=null,G,A=y*100,[te]=xs(ce,A,Q,U);if(te>=0)ce=ce.slice(0,te).trimEnd()+gs,G=Y.trim(),Y="";else{(ce||!Y&&!L)&&(Y=" "+Y);let[Oe]=xs(Y,A-Q(ce),Q,U);Oe>=0&&(G=Y.trim(),Y=Y.slice(0,Oe).trimEnd()+gs)}let ae=se.append("tspan").attr("x",0).attr("dy",`${b}em`).text("\u200B");ce&&ae.append("tspan").attr("font-weight","bold").text(ce),Y&&ae.append(()=>l.createTextNode(Y)),L&&ae.append("tspan").text(" \u25A0").attr("fill",ee).attr("fill-opacity",T).style("user-select","none"),G&&ae.append("title").text(G)}function he(){let{width:se,height:ce}=o.facet??o;Z.selectChildren().each(function(Y){let{x:ee,width:T,height:L}=this.getBBox();T=Math.round(T),L=Math.round(L);let G=m;if(G===void 0){let ae=B(Y)+N,Oe=V(Y)+z,_e=ae+T+g+x*20,J=Oe+L+g+x*20;G=_e&&tt?J&&we?a.preferredAnchor:we?"bottom":"top":J&&we?_e?"left":"right":(_e||tt)&&(J||we)?`${we?"bottom":"top"}-${_e?"left":"right"}`:a.preferredAnchor}let A=this.firstChild,te=this.lastChild;if(A.setAttribute("d",c$(G,g,x,T,L)),ee)for(let ae of te.childNodes)ae.setAttribute("x",-ee);te.setAttribute("y",`${+a$(G,te.childNodes.length,b).toFixed(6)}em`),te.setAttribute("transform",`translate(${s$(G,g,x,T,L)})`)}),Z.attr("visibility",null)}return t.length&&(Z.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(he):typeof requestAnimationFrame<"u"&&requestAnimationFrame(he)),Z.node()}};function AC(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ci(t,r)),new O1(e,{...n,x:t,y:r})}function a$(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function s$(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 c$(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 OC(e,t){let r={},n=this.format;n=kC(n,e,"x"),n=kC(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=Ax(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||i$.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=Ax(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]=(Wt(a)?Do:Pn)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?yl(a,a.domain()):Go}}return r}function kC(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 f$(e,t,{title:r}){return this.format.title(r.value[e],e)}function*u$(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:Oh(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:NC(n,r,"x"),value:RC(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:NC(n,r,"y"),value:RC(this.format.y2,r.y1,a,e)};else{let s=a.value[e],c=a.scale;if(!Rn(s)&&c==null)continue;yield{label:Oh(n,r,i),value:this.format[i](s,e),color:c==="color"?o[i][e]:null,opacity:c==="opacity"?o[i][e]:null}}}}function RC(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 NC(e,t,r){let n=Oh(e,t,`${r}1`,r),o=Oh(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function Oh(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function qo(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?[]:FC(e.marks);u.push(...b$(u));let f=d$(t,e),p=new Map;for(let U of u){let K=$C(U,f,e);K&&p.set(U,K)}let l=new Map;f&&gl(l,[f],e),gl(l,p,e);let m=FC(y$(u,l,e));for(let U of m){let K=$C(U,f,e);K&&p.set(U,K)}u.unshift(...m);let h=Y6(l,e);if(h!==void 0){let U=f?ph(h,f):void 0;for(let W of u){if(W.facet===null||W.facet==="super")continue;let Z=p.get(W);Z!==void 0&&(Z.facetsIndex=W.fx!=null||W.fy!=null?ph(h,Z):U)}let K=new Set;for(let{facetsIndex:W}of p.values())W?.forEach((Z,X)=>{Z?.length>0&&K.add(X)});h.forEach(0W.empty=!K.has(Z):W=>W.empty=!1);for(let W of u)if(W.facet==="exclude"){let Z=p.get(W);Z!==void 0&&(Z.facetsIndex=Z6(Z.facetsIndex))}}for(let U of He.keys())Lc(e[U])&&U!=="fx"&&U!=="fy"&&l.set(U,[]);let b=new Map;for(let U of u){if(b.has(U))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:K,channels:W}=p.get(U)??{},{data:Z,facets:X,channels:he}=U.initialize(K,W,e);N1(he,e),b.set(U,{data:Z,facets:X,channels:he})}let y=pl(gl(l,b,e),e),x=dM(y,u,e);B6(y,x);let g=zx(y),{fx:_,fy:w}=g,I=_||w?Gx(y,x):x,S=_||w?v$(g,x):x,v=Wc(e),M=v.document,C=pi("svg").call(M.documentElement),R=C;v.ownerSVGElement=C,v.className=c,v.projection=eM(e,I),v.path=function(){return yc(this.projection??aM(g))},v.filterFacets=(U,K)=>ph(h,{channels:K,groups:uh(U,K)}),v.getMarkState=U=>{let K=b.get(U),W=p.get(U);return{...K,channels:{...K.channels,...W?.channels}}},v.dispatchValue=U=>{R.value!==U&&(R.value=U,R.dispatchEvent(new v.document.defaultView.Event("input",{bubbles:!0})))};let O=new Set;for(let[U,K]of b)if(U.initializer!=null){let W=U.facet==="super"?S:I,Z=U.initializer(K.data,K.facets,K.channels,g,W,v);if(Z.data!==void 0&&(K.data=Z.data),Z.facets!==void 0&&(K.facets=Z.facets),Z.channels!==void 0){let{fx:X,fy:he,...se}=Z.channels;m$(se),Object.assign(K.channels,se);for(let ce of Object.values(se)){let{scale:Y}=ce;Y!=null&&!BT(He.get(Y))&&(VC(ce,e),O.add(Y))}(X!=null||he!=null)&&p.set(U,!0)}}if(O.size){let U=new Map;gl(U,b,e,X=>O.has(X)),gl(l,b,e,X=>O.has(X));let K=_$(pl(U,e),y),{scales:W,...Z}=zx(K);Object.assign(y,K),Object.assign(g,Z),Object.assign(g.scales,W)}let N,z;h!==void 0&&(N={x:_?.domain(),y:w?.domain()},h=W6(h,N),z=X6(_,w,x));for(let[U,K]of b)K.values=U.scale(K.channels,g,v);let{width:j,height:k}=x;In(C).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",k).attr("viewBox",`0 0 ${j} ${k}`).attr("aria-label",a).attr("aria-description",s).call(U=>U.append("style").text(`:where(.${c}) { +${b}`)).style("margin-left",u?`${+u}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",Pt(i,"normal")).call(nf,p).node()}var M1=new Map([["symbol",x6],["color",I6],["opacity",Y9]]);function S6(e,t,r={}){return(n,o)=>{if(!M1.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return M1.get(n)(e[n],v6(t,r[n],o),i=>e[i])}}function v6({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return BT(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function I6(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return b6(e,r);case"ramp":return IC(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Y9({type:e,interpolate:t,...r},{legend:n=!0,color:o=Tn(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 I6({type:e,...r,interpolate:W9(o)},{legend:n,...i})}function W9(e){let{r:t,g:r,b:n}=Tn(e)||Tn(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function _6(e,t,r){let n=[];for(let[o,i]of M1){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],v6(t,e[o],a),c=>e[c]);s!=null&&n.push(s)}}return n}function P6(e={},t="y"){return Mx(e)?e:{...e,[t]:It}}function T6(e,t){if(t.length===1)return{data:e,facets:t};let r=ga(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=da(e);let i=e[wx]=new Uint32Array(r+o);t=t.map(s=>da(s,Uint32Array));let a=r;n.fill(0);for(let s of t)for(let c=0,u=s.length;c{({data:b,facets:y}=T6(b,y));let g=e==null?void 0:f(ET(Zt(b,e),x?.[r])),S=Zt(b,t,Float64Array),w=Zt(b,c),_=i&&i(b,g,S,w),v=ga(b),I=l(new Float64Array(v)),T=h(new Float64Array(v)),P=[];for(let R of y){let k=g?Array.from(fi(R,N=>g[N]).values()):[R];if(_)for(let N of k)N.sort(_);for(let N of k){let B=0,V=0;a&&N.reverse();for(let C of N){let G=S[C];G<0?B=T[C]=(I[C]=B)+G:G>0?V=T[C]=(I[C]=V)+G:T[C]=I[C]=V}}P.push(k)}return o&&o(P,I,T,w),{data:b,facets:y}}),u,p,m]}function J9(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return e$;case"center":case"silhouette":return t$;case"wiggle":return R6}throw new Error(`unknown offset: ${e}`)}}function k6(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function e$(e,t,r){for(let n of e)for(let o of n){let[i,a]=k6(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 t$(e,t,r){for(let n of e){for(let o of n){let[i,a]=k6(o,r);for(let s of o){let c=(a+i)/2;t[s]-=c,r[s]-=c}}N6(n,t,r)}A6(e,t,r)}function R6(e,t,r,n){for(let o of e){let i=new Cr,a=0;for(let s of o){let c=-1,u=s.map(m=>Math.abs(r[m]-t[m])),f=s.map(m=>{c=n?n[m]:++c;let h=r[m]-t[m],b=i.has(c)?h-i.get(c):0;return i.set(c,h),b}),p=[0,...dp(f)];for(let m of s)t[m]+=a,r[m]+=a;let l=Pn(u);l&&(a-=Pn(u,(m,h)=>(f[h]/2+p[h])*m)/l)}N6(o,t,r)}A6(e,t,r)}function N6(e,t,r){let n=Or(e,o=>Or(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function A6(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(Or(s,c=>t[c])+Kt(s,c=>r[c]))/2),a=Or(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function o$(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function i$(e){return Nh(e,(t,r,n,o)=>oc(Kr(t),i=>Pn(i,a=>n[a]),i=>o[i]))}function a$(e){return Nh(e,(t,r,n,o)=>oc(Kr(t),i=>r[Yf(i,a=>n[a])],i=>o[i]))}function M6(e){return Nh(e,(t,r,n,o)=>{let i=Kr(t),a=oc(i,p=>r[Yf(p,l=>n[l])],p=>o[p]),s=So(i,p=>Pn(p,l=>n[l]),p=>o[p]),c=[],u=[],f=0;for(let p of a)f<0?(f+=s.get(p),c.push(p)):(f-=s.get(p),u.push(p));return u.reverse().concat(c)})}function C6(e){return t=>{let r=Zt(t,e);return(n,o)=>zr(r[n],r[o])}}function s$(e){return t=>ao(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function c$(e){return Nh(zr,()=>e)}function Nh(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new Cr(t(r,n,o,i).map((s,c)=>[s,c]));return(s,c)=>e(a.get(i[s]),a.get(i[c]))}}var f$={ariaLabel:"rect"},Fh=class extends mt{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,f$),C1(this,r),O1(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x1:c,y1:u,x2:f,y2:p}=n,{marginTop:l,marginRight:m,marginBottom:h,marginLeft:b,width:y,height:x}=o,{projection:g}=i,{insetTop:S,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:I,ry:T,rx1y1:P,rx1y2:R,rx2y1:k,rx2y2:N}=this;(c||f)&&!g&&Sa(a)&&(c=f=null),(u||p)&&!g&&Sa(s)&&(u=p=null);let B=a?.bandwidth?a.bandwidth():0,V=s?.bandwidth?s.bandwidth():0;return Ke("svg:g",i).call(pr,this,o,i).call(mr,this,{},0,0).call(C=>C.selectAll().data(t).enter().call(P||R||k||N?G=>G.append("path").call(er,this).call(k1,c&&f?j=>c[j]+(f[j]c[j]+v:b+v,u&&p?j=>u[j]+(p[j]u[j]+S:l+S,c&&f?j=>f[j]-(f[j]c[j]+B-w:y-m-w,u&&p?j=>p[j]-(p[j]u[j]+V-_:x-h-_,this).call(Hr,this,n):G=>G.append("rect").call(er,this).attr("x",c?f?j=>Math.min(c[j],f[j])+v:j=>c[j]+v:b+v).attr("y",u?p?j=>Math.min(u[j],p[j])+S:j=>u[j]+S:l+S).attr("width",c?f?j=>Math.max(0,Math.abs(f[j]-c[j])+B-v-w):B-v-w:y-m-b-w-v).attr("height",u?p?j=>Math.max(0,Math.abs(u[j]-p[j])+V-S-_):V-S-_:x-l-h-S-_).call(de,"rx",I).call(de,"ry",T).call(Hr,this,n))).node()}};function C1(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=kt(r),e.insetRight=kt(n),e.insetBottom=kt(o),e.insetLeft=kt(i)}function O1(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:p=a!==void 0?+a:s!==void 0?+s:0}={}){c||u||f||p?(e.rx1y1=c,e.rx1y2=u,e.rx2y1=f,e.rx2y2=p):(e.rx=Pt(r,"auto"),e.ry=Pt(n,"auto"))}function k1(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:c,rx2y2:u}=i;typeof t!="function"&&(t=un(t)),typeof r!="function"&&(r=un(r)),typeof n!="function"&&(n=un(n)),typeof o!="function"&&(o=un(o));let f=Math.max(Math.abs(a+c),Math.abs(s+u)),p=Math.max(Math.abs(a+s),Math.abs(c+u));e.attr("d",l=>{let m=t(l),h=r(l),b=n(l),y=o(l),x=m>b,g=h>y,S=x?b:m,w=x?m:b,_=g?y:h,v=g?h:y,I=Math.min(1,(w-S)/f,(v-_)/p),T=I*(x?g?u:c:g?s:a),P=I*(x?g?s:a:g?u:c),R=I*(x?g?a:s:g?c:u),k=I*(x?g?c:u:g?a:s);return`M${S},${_+Eh(T,k)}A${T},${T} 0 0 ${T<0?0:1} ${S+Ah(T,k)},${_}H${w-Ah(P,R)}A${P},${P} 0 0 ${P<0?0:1} ${w},${_+Eh(P,R)}V${v-Eh(R,P)}A${R},${R} 0 0 ${R<0?0:1} ${w-Ah(R,P)},${v}H${S+Ah(k,T)}A${k},${k} 0 0 ${k<0?0:1} ${S},${v-Eh(k,T)}Z`})}function Ah(e,t){return t<0?e:Math.abs(e)}function Eh(e,t){return t<0?Math.abs(e):e}function Fi(e,t={}){return OT(t)||(t={...t,x:ml,y2:It,interval:1}),new Fh(e,O6(NC(P6(t))))}var u$={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},l$={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},R1=class extends mt{constructor(t={}){let{anchor:r=null}=t;super(Bc,void 0,t,r==null?u$:l$),this.anchor=Tx(r,"anchor",["top","right","bottom","left"]),C1(this,t),r||O1(this,t)}render(t,r,n,o,i){let{marginTop:a,marginRight:s,marginBottom:c,marginLeft:u,width:f,height:p}=o,{anchor:l,insetTop:m,insetRight:h,insetBottom:b,insetLeft:y}=this,{rx:x,ry:g,rx1y1:S,rx1y2:w,rx2y1:_,rx2y2:v}=this,I=u+y,T=f-s-h,P=a+m,R=p-c-b;return Ke(l?"svg:line":S||w||_||v?"svg:path":"svg:rect",i).datum(0).call(pr,this,o,i).call(er,this).call(Hr,this,n).call(mr,this,{}).call(l==="left"?k=>k.attr("x1",I).attr("x2",I).attr("y1",P).attr("y2",R):l==="right"?k=>k.attr("x1",T).attr("x2",T).attr("y1",P).attr("y2",R):l==="top"?k=>k.attr("x1",I).attr("x2",T).attr("y1",P).attr("y2",P):l==="bottom"?k=>k.attr("x1",I).attr("x2",T).attr("y1",R).attr("y2",R):S||w||_||v?k=>k.call(k1,I,P,T,R,this):k=>k.attr("x",I).attr("y",P).attr("width",T-I).attr("height",R-P).attr("rx",x).attr("ry",g)).node()}};function N1(e){return new R1(e)}var A1={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},p$=new Set(["geometry","href","src","ariaLabel","scales"]),E1=class extends mt{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&$n(t)&&ch(t)&&(r={...r,title:It});let{x:n,y:o,x1:i,x2:a,y1:s,y2:c,anchor:u,preferredAnchor:f="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:m,fontStyle:h,fontVariant:b,fontWeight:y,lineHeight:x=1,lineWidth:g=20,frameAnchor:S,format:w,textAnchor:_="start",textOverflow:v,textPadding:I=8,title:T,pointerSize:P=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,A1),this.anchor=uh(u,"anchor"),this.preferredAnchor=uh(f,"preferredAnchor"),this.frameAnchor=wa(S),this.textAnchor=Pt(_,"middle"),this.textPadding=+I,this.pointerSize=+P,this.pathFilter=Ot(R),this.lineHeight=+x,this.lineWidth=+g,this.textOverflow=b1(v),this.monospace=!!p,this.fontFamily=Ot(l),this.fontSize=kt(m),this.fontStyle=Ot(h),this.fontVariant=Ot(b),this.fontWeight=Ot(y);for(let k in A1)k in this.channels&&(this[k]=A1[k]);this.splitLines=v1(this),this.clipLine=I1(this),this.format=typeof w=="string"||typeof w=="function"?{title:w}:{...w}}render(t,r,n,o,i){let a=this,{x:s,y:c,fx:u,fy:f}=r,{ownerSVGElement:p,document:l}=i,{anchor:m,monospace:h,lineHeight:b,lineWidth:y}=this,{textPadding:x,pointerSize:g,pathFilter:S}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:I,x2:T,y2:P,x:R=v??T,y:k=I??P}=n,N=u?u(t.fx)-_:0,B=f?f(t.fy)-w:0,[V,C]=Ko(this,o),G=c1(n,V),j=f1(n,C),H=h?Ch:Mh,U=H(vs),z,Y;"title"in n?(z=E6.call(this,{title:n.channels.title},r),Y=g$):(z=E6.call(this,n.channels,r),Y=y$);let X=Ke("svg:g",i).call(pr,this,o,i).call(S1,this).call(mr,this,{x:R&&s,y:k&&c}).call(J=>J.selectAll().data(t).enter().append("g").attr("transform",oe=>`translate(${Math.round(G(oe))},${Math.round(j(oe))})`).call(er,this).call(oe=>oe.append("path").attr("filter",S)).call(oe=>oe.append("text").each(function(Q){let fe=kr(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let O=Y.call(a,Q,t,z,r,n);if(typeof O=="string")for(let L of a.splitLines(O))q(fe,{value:a.clipLine(L)});else{let L=new Set;for(let K of O){let{label:A=""}=K;A&&L.has(A)||(L.add(A),q(fe,K))}}})));function q(J,{label:oe,value:Q,color:fe,opacity:O}){oe??="",Q??="";let L=fe!=null||O!=null,K,A=y*100,[ee]=Is(oe,A,H,U);if(ee>=0)oe=oe.slice(0,ee).trimEnd()+vs,K=Q.trim(),Q="";else{(oe||!Q&&!L)&&(Q=" "+Q);let[Te]=Is(Q,A-H(oe),H,U);Te>=0&&(K=Q.trim(),Q=Q.slice(0,Te).trimEnd()+vs)}let re=J.append("tspan").attr("x",0).attr("dy",`${b}em`).text("\u200B");oe&&re.append("tspan").attr("font-weight","bold").text(oe),Q&&re.append(()=>l.createTextNode(Q)),L&&re.append("tspan").text(" \u25A0").attr("fill",fe).attr("fill-opacity",O).style("user-select","none"),K&&re.append("title").text(K)}function ae(){let{width:J,height:oe}=o.facet??o;X.selectChildren().each(function(Q){let{x:fe,width:O,height:L}=this.getBBox();O=Math.round(O),L=Math.round(L);let K=m;if(K===void 0){let re=G(Q)+N,Te=j(Q)+B,Me=re+O+g+x*20,te=Te+L+g+x*20;K=Me&&rt?te&&he?a.preferredAnchor:he?"bottom":"top":te&&he?Me?"left":"right":(Me||rt)&&(te||he)?`${he?"bottom":"top"}-${Me?"left":"right"}`:a.preferredAnchor}let A=this.firstChild,ee=this.lastChild;if(A.setAttribute("d",h$(K,g,x,O,L)),fe)for(let re of ee.childNodes)re.setAttribute("x",-fe);ee.setAttribute("y",`${+m$(K,ee.childNodes.length,b).toFixed(6)}em`),ee.setAttribute("transform",`translate(${d$(K,g,x,O,L)})`)}),X.attr("visibility",null)}return t.length&&(X.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(ae):typeof requestAnimationFrame<"u"&&requestAnimationFrame(ae)),X.node()}};function L6(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Oi(t,r)),new E1(e,{...n,x:t,y:r})}function m$(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function d$(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 h$(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 E6(e,t){let r={},n=this.format;n=F6(n,e,"x"),n=F6(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=Lx(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||p$.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=Lx(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]=(Xt(a)?Do:Cn)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?Il(a,a.domain()):zo}}return r}function F6(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 g$(e,t,{title:r}){return this.format.title(r.value[e],e)}function*y$(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:$h(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:D6(n,r,"x"),value:$6(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:D6(n,r,"y"),value:$6(this.format.y2,r.y1,a,e)};else{let s=a.value[e],c=a.scale;if(!En(s)&&c==null)continue;yield{label:$h(n,r,i),value:this.format[i](s,e),color:c==="color"?o[i][e]:null,opacity:c==="opacity"?o[i][e]:null}}}}function $6(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 D6(e,t,r){let n=$h(e,t,`${r}1`,r),o=$h(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function $h(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function qo(e={}){let{facet:t,style:r,title:n,subtitle:o,caption:i,ariaLabel:a,ariaDescription:s}=e,c=rf(e.className),u=e.marks===void 0?[]:j6(e.marks);u.push(...I$(u));let f=S$(t,e),p=new Map;for(let U of u){let z=U6(U,f,e);z&&p.set(U,z)}let l=new Map;f&&_l(l,[f],e),_l(l,p,e);let m=j6(_$(u,l,e));for(let U of m){let z=U6(U,f,e);z&&p.set(U,z)}u.unshift(...m);let h=JM(l,e);if(h!==void 0){let U=f?xh(h,f):void 0;for(let Y of u){if(Y.facet===null||Y.facet==="super")continue;let X=p.get(Y);X!==void 0&&(X.facetsIndex=Y.fx!=null||Y.fy!=null?xh(h,X):U)}let z=new Set;for(let{facetsIndex:Y}of p.values())Y?.forEach((X,q)=>{X?.length>0&&z.add(q)});h.forEach(0Y.empty=!z.has(X):Y=>Y.empty=!1);for(let Y of u)if(Y.facet==="exclude"){let X=p.get(Y);X!==void 0&&(X.facetsIndex=rC(X.facetsIndex))}}for(let U of Ye.keys())zc(e[U])&&U!=="fx"&&U!=="fy"&&l.set(U,[]);let b=new Map;for(let U of u){if(b.has(U))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:z,channels:Y}=p.get(U)??{},{data:X,facets:q,channels:ae}=U.initialize(z,Y,e);D1(ae,e),b.set(U,{data:X,facets:q,channels:ae})}let y=bl(_l(l,b,e),e),x=xC(y,u,e);HM(y,x);let g=Yx(y),{fx:S,fy:w}=g,_=S||w?Wx(y,x):x,v=S||w?R$(g,x):x,I=tf(e),T=I.document,P=mi("svg").call(T.documentElement),R=P;I.ownerSVGElement=P,I.className=c,I.projection=iC(e,_),I.path=function(){return Ic(this.projection??lC(g))},I.filterFacets=(U,z)=>xh(h,{channels:z,groups:yh(U,z)}),I.getMarkState=U=>{let z=b.get(U),Y=p.get(U);return{...z,channels:{...z.channels,...Y?.channels}}},I.dispatchValue=U=>{R.value!==U&&(R.value=U,R.dispatchEvent(new I.document.defaultView.Event("input",{bubbles:!0})))};let k=new Set;for(let[U,z]of b)if(U.initializer!=null){let Y=U.facet==="super"?v:_,X=U.initializer(z.data,z.facets,z.channels,g,Y,I);if(X.data!==void 0&&(z.data=X.data),X.facets!==void 0&&(z.facets=X.facets),X.channels!==void 0){let{fx:q,fy:ae,...J}=X.channels;w$(J),Object.assign(z.channels,J);for(let oe of Object.values(J)){let{scale:Q}=oe;Q!=null&&!HT(Ye.get(Q))&&(z6(oe,e),k.add(Q))}(q!=null||ae!=null)&&p.set(U,!0)}}if(k.size){let U=new Map;_l(U,b,e,q=>k.has(q)),_l(l,b,e,q=>k.has(q));let z=k$(bl(U,e),y),{scales:Y,...X}=Yx(z);Object.assign(y,z),Object.assign(g,X),Object.assign(g.scales,Y)}let N,B;h!==void 0&&(N={x:S?.domain(),y:w?.domain()},h=eC(h,N),B=tC(S,w,x));for(let[U,z]of b)z.values=U.scale(z.channels,g,I);let{width:V,height:C}=x;kr(P).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",V).attr("height",C).attr("viewBox",`0 0 ${V} ${C}`).attr("aria-label",a).attr("aria-description",s).call(U=>U.append("style").text(`:where(.${c}) { --plot-background: white; display: block; height: auto; @@ -55,7 +55,7 @@ ${b}`)).style("margin-left",u?`${+u}px`:null).style("width",l===void 0?null:`${+ :where(.${c} text), :where(.${c} tspan) { white-space: pre; -}`)).call(Zc,r);for(let U of u){let{channels:K,values:W,facets:Z}=b.get(U);if(h===void 0||U.facet==="super"){let X=null;if(Z&&(X=Z[0],X=U.filter(X,K,W),X.length===0))continue;let he=U.render(X,g,W,S,v);if(he==null)continue;C.appendChild(he)}else{let X;for(let he of h){if(!(U.facetAnchor?.(h,N,he)??!he.empty))continue;let se=null;if(Z){let Y=p.has(U);if(se=Z[Y?he.i:0],se=U.filter(se,K,W),se.length===0)continue;!Y&&se===Z[0]&&(se=TT(se)),se.fx=he.x,se.fy=he.y,se.fi=he.i}let ce=U.render(se,g,W,I,v);if(ce!=null){(X??=In(C).append("g")).append(()=>ce).datum(he);for(let Y of["aria-label","aria-description","aria-hidden","transform"])ce.hasAttribute(Y)&&(X.attr(Y,ce.getAttribute(Y)),ce.removeAttribute(Y))}}X?.selectChildren().each(z)}}let B=xC(y,v,e),{figure:V=n!=null||o!=null||i!=null||B.length>0}=e;V&&(R=M.createElement("figure"),R.className=`${c}-figure`,R.style.maxWidth="initial",n!=null&&R.append(EC(M,n,"h2")),o!=null&&R.append(EC(M,o,"h3")),R.append(...B,C),i!=null&&R.append(l$(M,i)),"value"in C&&(R.value=C.value,delete C.value)),R.scale=q6(g.scales),R.legend=bC(y,v,e);let Q=_6();return Q>0&&In(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(`${Q.toLocaleString("en-US")} warning${Q===1?"":"s"}. Please check the console.`),R}function EC(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function l$(e,t){let r=e.createElement("figcaption");return r.append(t),r}function FC(e){return e.flat(1/0).filter(t=>t!=null).map(p$)}function p$(e){return typeof e.render=="function"?e:new R1(e)}var R1=class extends pt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function N1(e,t){for(let r in e)VC(e[r],t);return e}function VC(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:_x(a,o)}=t[r]??{};s!=null&&(e.value=et(e.value,s),e.transform=!1)}function m$(e){for(let t in e)Nx(t,e[t])}function gl(e,t,r,n=xT){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(!nM(r)){let c=r.x?.domain===void 0,u=r.y?.domain===void 0;if(c||u){let[f,p]=iM(a);c&&k1(e,"x",f),u&&k1(e,"y",p)}}}else k1(e,s,a)}return e}function k1(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function d$(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=Mi(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"})),N1(i,t);let a=uh(o,i);return{channels:i,groups:a,data:e.data}}function $C(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let c=Mi(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"})),N1(u,r),{channels:u,groups:uh(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)&&da(Mi(e.data))===da(s)&&Br(`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 h$(e,t={}){return Oi({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function b$(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)?r1:bM,n=o(h$(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===r1?"left":"bottom");let a=AC(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function y$(e,t,r){let{projection:n,x:o={},y:i={},fx:a={},fy:s={},axis:c,grid:u,facet:f={},facet:{axis:p=c,grid:l}=f,x:{axis:m=c,grid:h=m===null?null:u}=o,y:{axis:b=c,grid:y=b===null?null:u}=i,fx:{axis:x=p,grid:g=x===null?null:l}=a,fy:{axis:_=p,grid:w=_===null?null:l}=s}=r;(n||!Lc(o)&&!DC("x",e))&&(m=h=null),(n||!Lc(i)&&!DC("y",e))&&(b=y=null),t.has("fx")||(x=g=null),t.has("fy")||(_=w=null),m===void 0&&(m=!Nh(e,"x")),b===void 0&&(b=!Nh(e,"y")),x===void 0&&(x=!Nh(e,"fx")),_===void 0&&(_=!Nh(e,"fy")),m===!0&&(m="bottom"),b===!0&&(b="left"),x===!0&&(x=m==="top"||m===null?"bottom":"top"),_===!0&&(_=b==="right"||b===null?"left":"right");let I=[];return Rh(I,w,eC,s),kh(I,_,WM,"right","left",f,s),Rh(I,g,rC,a),kh(I,x,XM,"top","bottom",f,a),Rh(I,y,JM,i),kh(I,b,w1,"left","right",r,i),Rh(I,h,tC,o),kh(I,m,S1,"bottom","top",r,o),I}function kh(e,t,r,n,o,i,a){if(!t)return;let s=g$(t);a=x$(s?n:t,i,a);let{line:c}=a;(r===w1||r===S1)&&c&&!ds(c)&&e.push(M1(w$(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function Rh(e,t,r,n){!t||ds(t)||e.push(r(S$(t,n)))}function g$(e){return/^\s*both\s*$/i.test(e)}function x$(e,t,{line:r=t.line,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:p,label:l=t.label,labelAnchor:m,labelArrow:h=t.labelArrow,labelOffset:b}){return{anchor:e,line:r,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:p,label:l,labelAnchor:m,labelArrow:h,labelOffset:b}}function w$(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function S$(e,{stroke:t=Uc(e)?e:void 0,ticks:r=I$(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function I$(e){switch(typeof e){case"number":return!0;case"string":return!Uc(e)}return An(e)||typeof e?.range=="function"}function Nh(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function DC(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 _$(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 v$({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=ch(r),u=e&&LC(e),f=t&&LC(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 LC(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 nw.selectAll().data(t).enter().append(g?"circle":"path").call(Jt,this).call(g?I=>{I.attr("cx",c?S=>c[S]:y).attr("cy",u?S=>u[S]:x).attr("r",f?S=>f[S]:m)}:I=>{I.attr("transform",Qc`translate(${c?S=>c[S]:y},${u?S=>u[S]:x})${p?S=>` rotate(${p[S]})`:h?` rotate(${h})`:""}`).attr("d",f&&l?S=>{let v=to();return l[S].draw(v,f[S]*f[S]*Math.PI),v}:f?S=>{let v=to();return b.draw(v,f[S]*f[S]*Math.PI),v}:l?S=>{let v=to();return l[S].draw(v,_),v}:(()=>{let S=to();return b.draw(S,_),S})())}).call(zr,this,n)).node()}};function ws(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Ci(t,r)),new Ah(e,{...n,x:t,y:r})}var O$={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Eh=class extends pt{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:Qd(r),optional:!0}},r,O$),this.z=i,this.curve=UC(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 Ge("svg:g",i).call(ur,this,o,i).call(lr,this,r).call(u=>u.selectAll().data(lM(t,[a,s],this,n)).enter().append("path").call(Jt,this).call(uM,this,n).call(SM,this,n,i).attr("d",c===xl&&i.projection?k$(i.path(),a,s):Eg().curve(c).defined(f=>f>=0).x(f=>a[f]).y(f=>s[f]))).node()}};function k$(e,t,r){return t=ms(t),r=ms(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 Ut(e,{x:t,y:r,...n}={}){return[t,r]=Ci(t,r),new Eh(e,{...n,x:t,y:r})}pt.prototype.plot=function({marks:e=[],...t}={}){return qo({...t,marks:[...e,this]})};var R$=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],jC={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function N$(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 A$(e){let r=[...new Set(e.data.map(m=>m.model))].length>1,n=r?R$:["#000000"],o=e.data.map(m=>({...m,tooltip:N$(m,r)})),i=[];e.references?.some(m=>m.type==="identity")&&i.push(Ut([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(Ut(o,{x:"predicted",y:"observed",stroke:"model",strokeWidth:2,title:"tooltip",tip:!0}));let a=o.filter(m=>m.method==="discrete");a.length>0&&i.push(ws(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=qo({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:jC,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(m=>({...m,tooltip:`${r?`${m.model} -`:""}${m.count} observations in [${(m.midpoint-m.binWidth/2).toFixed(3)}, ${(m.midpoint+m.binWidth/2).toFixed(3)}]`})),f=new Set(e.distribution.map(m=>m.model)).size,p=qo({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:jC,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:[Ei(u,{x1:m=>m.midpoint-m.binWidth/2,x2:m=>m.midpoint+m.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,p),l}var BC=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],er={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:BC,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 E$(e){let t=e.theme??{};return{...er,width:e.width??er.width,height:e.height??er.height,background:t.background??er.background,colors:e.colors??er.colors,margins:{...er.margins,...t.margins},frame:{...er.frame,...t.frame},typography:{...er.typography,...t.typography},axis:{...er.axis,...t.axis},line:{...er.line,...t.line},marker:{...er.marker,...t.marker},reference:{...er.reference,...t.reference},legend:{...er.legend,...t.legend},tip:{...er.tip,...t.tip},predictionDistribution:{...er.predictionDistribution,...t.predictionDistribution}}}function Fn(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,c)=>`group-${c+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,c)=>[s,i[c]])),showLegend:a}}function zC(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 F$(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=Fn(i,s),{theme:u,colorByGroup:f}=c,p=new Map(e.series.map(g=>[g.display.group,g.display.label])),l=new Set(i),m=document.createElement("div");m.className="rtichoke-legend-chart",m.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 b=new Map;i.forEach(g=>{let _=document.createElement("button");_.type="button",_.className="rtichoke-legend-item",_.setAttribute("aria-pressed","true");let w=p.get(g)??g;_.setAttribute("aria-label",`Toggle series ${w}`);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=w,_.append(I,v),h.append(_),b.set(g,_)});let y=document.createElement("div");y.className="rtichoke-legend-content";let x=()=>{let g=F$(e,l),_=r(g,s,a,w=>{a=w,o&&o(w)});y.replaceChildren(_)};return i.forEach(g=>{let _=b.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");x()})}),m.append(h,y),x(),m}function Ss(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=zC(e);if(i.length===0)return r(e,void 0);let a=Fn(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)",p=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"PPCR",l=document.createElement("label");l.className="rtichoke-operating-point-label";let m=document.createElement("span");m.textContent=`${p}: `;let h=document.createElement("span");h.className="rtichoke-operating-point-value";let b=document.createElement("input");b.type="range",b.className="rtichoke-operating-point-slider",b.min="0",b.max=String(i.length-1),b.step="1",b.setAttribute("aria-label",f);let y=0;if(n!==void 0){let I=i.indexOf(n);I!==-1&&(y=I)}let x=i[y];b.value=String(y);let g=x.toFixed(s.tip.digits);h.textContent=g,b.setAttribute("aria-valuetext",g),o&&o(x),l.append(m,h),u.append(l,b);let _=document.createElement("div");_.className="rtichoke-operating-point-content";let w=I=>{_.replaceChildren(r(e,I))};return b.addEventListener("input",()=>{let I=Number(b.value),S=i[I],v=S.toFixed(s.tip.digits);h.textContent=v,b.setAttribute("aria-valuetext",v),o&&o(S),w(S)}),c.append(_,u),w(x),c}function $$(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 Fh(e,t){let r=$$(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}function Rt(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` -`)}function $h(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 Ia(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 A1(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(Ut([{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(ao([o.value],{...r,title:o.label})):o.type==="path"&&o.points&&n.push(Ut(o.points,{x:"x",y:"y",...r,title:o.label}));return n}function Dh(e,t){return e}function D$(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 ws(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 ws(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:c,r:u,title:f=>f.title,tip:!0})}var L$=er.height-Math.round(er.height*.8);function GC(e,t,r=[0,1],n=[0,1],o){let i=e-t.left-t.right,a=Math.abs(r[1]-r[0]),s=Math.abs(n[1]-n[0]),c=Number.isFinite(a)&&a>0?a:1,u=Number.isFinite(s)&&s>0?s:1,f=i*(u/c),p=o??t.bottom;return Math.round(t.top+f+p)}function Ho(e,t){let r=qo(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 V$(e,t={},r){ai(e);let n=Fn(wl(e),t),{theme:o}=n,i=e.operatingPoint?.dimension,a=Fh(e,e.data).map(p=>{let l=1-p.specificity,m=[["Series",p.label]];return i==="ppcr"?(p.ppcr!==void 0&&m.push(["PPCR",p.ppcr]),m.push(["Cutoff",p.cutoff])):(m.push(["Cutoff",p.cutoff]),p.ppcr!==void 0&&m.push(["PPCR",p.ppcr])),m.push(["Sensitivity",p.sensitivity],["Specificity",p.specificity],["False Positive Rate",l]),{...p,false_positive_rate:l,title:Rt(o.tip.digits,m)}}),s=A1(e,o);if(s.push(Ut(a,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0,title:p=>p.title,tip:!0}),af(a,"false_positive_rate","sensitivity",n,t.theme)),r!==void 0&&e.operatingPoint){let p=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",l=a.filter(m=>m[p]===r);l.length>0&&s.push(sf(l,"false_positive_rate","sensitivity",n,t.theme))}let c=e.xAxis.domain??[0,1],u=e.yAxis.domain??[0,1],f=GC(o.width,o.margins,c,u);return Ho({...$h(n,e),height:f,x:Ia(o,e.xAxis.label,c),y:Ia(o,e.yAxis.label,u),marks:Dh(s,o)},o)}function E1(e,t={}){return of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Ss(a,n,(u,f)=>V$(u,n,f),s,c),o,i))}function F1(e,t={}){ai(e);let r=Fn(wl(e),t),{theme:n}=r,o=Fh(e,e.data).map(x=>({...x,title:Rt(n.tip.digits,[["Series",x.label],["Predicted",x.predicted],["Observed",x.observed],["Events",x.events],["Total",x.total]])})),i=A1(e,n);i.push(Ut(o,{x:"predicted",y:"observed",z:"seriesId",stroke:"group",strokeWidth:n.line.width,strokeDasharray:n.line.dash??void 0,title:x=>x.title,tip:!0}));let a=o.filter(x=>x.method==="discrete");a.length>0&&i.push(ws(a,{x:"predicted",y:"observed",fill:n.marker.fill??"group",stroke:n.marker.stroke,strokeWidth:n.marker.strokeWidth,r:n.marker.radius,title:x=>x.title,tip:!0}));let s=(e.distribution?.length??0)>0,c=o.map(x=>x.observed).filter(Number.isFinite),u=e.yAxis.domain??[Math.min(0,...c),Math.max(1,...c)],f=e.xAxis.domain??[0,1],p=s?8:n.margins.bottom,l=GC(n.width,n.margins,f,u,p),m=Ho({...$h(r,e),height:l,marginBottom:p,x:s?{...Ia(n,e.xAxis.label,f),axis:null,label:null}:Ia(n,e.xAxis.label,f),y:Ia(n,e.yAxis.label,u),marks:Dh(i,n)},n);if(!s||!e.distribution)return m;let h=Fh(e,e.distribution).map(x=>({...x,title:Rt(n.tip.digits,[["Series",x.label],["Midpoint",x.midpoint],["Count",x.count]])})),b=Ho({...$h(r,e),height:L$,marginTop:0,marginBottom:n.margins.bottom,x:Ia(n,e.xAxis.label,f),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:Dh([Ei(h,{x1:x=>x.midpoint-x.binWidth/2,x2:x=>x.midpoint+x.binWidth/2,y:"count",fill:"group",fillOpacity:1/Math.max(r.groups.length,1),title:x=>x.title,tip:!0})],n)},n),y=document.createElement("div");return y.className="rtichoke-calibration",y.style.width=`${n.width}px`,y.style.maxWidth="100%",y.append(m,b),y}function U$(e,t,r,n,o){ai(e);let i=Fn(wl(e),t),{theme:a}=i,s=e.operatingPoint?.dimension,c=Fh(e,e.data).map(f=>{let p=f,l=[["Series",f.label]];return e.type==="precision_recall"?(s==="ppcr"?(p.ppcr!==void 0&&l.push(["PPCR",p.ppcr]),l.push(["Cutoff",p.cutoff])):(l.push(["Cutoff",p.cutoff]),p.ppcr!==void 0&&l.push(["PPCR",p.ppcr])),l.push(["Sensitivity",p.sensitivity],["PPV",p.ppv])):e.type==="gains"?(s==="probability_threshold"?(l.push(["Cutoff",p.cutoff]),l.push(["PPCR",p.ppcr])):(l.push(["PPCR",p.ppcr]),l.push(["Cutoff",p.cutoff])),l.push(["Sensitivity",p.sensitivity])):e.type==="lift"&&(s==="probability_threshold"?(l.push(["Cutoff",p.cutoff]),l.push(["PPCR",p.ppcr])):(l.push(["PPCR",p.ppcr]),l.push(["Cutoff",p.cutoff])),l.push(["Lift",p.lift])),{...f,title:Rt(a.tip.digits,l)}}),u=A1(e,a);if(u.push(Ut(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 p=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr",l=c.filter(m=>m[p]===o);l.length>0&&u.push(sf(l,r,n,i,t.theme))}return Ho({...$h(i,e),x:Ia(a,e.xAxis.label,e.xAxis.domain),y:Ia(a,e.yAxis.label,e.yAxis.domain),marks:Dh(u,a)},a)}function j$(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function B$(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=j$(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 p of o){let l=document.createElement("option");l.value=String(p),l.textContent=String(p),c.append(l)}s.append(c);let u=document.createElement("div"),f=p=>{u.replaceChildren(t(B$(e,p),i,l=>{i=l,n&&n(l)}))};return c.addEventListener("change",()=>f(Number(c.value))),a.append(s,u),f(o[0]),a}function $1(e,t,r,n){return of(e,t,(o,i,a,s)=>cf(o,(c,u,f)=>Ss(c,i,(p,l)=>U$(p,i,r,n,l),u,f),a,s))}function D1(e,t={}){return $1(e,t,"sensitivity","ppv")}function L1(e,t={}){return $1(e,t,"ppcr","sensitivity")}function V1(e,t={}){return $1(e,t,"ppcr","lift")}function U1(e,t={}){return ai(e),of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Ss(a,n,(u,f)=>z$(u,n,f),s,c),o,i))}function z$(e,t,r){let n=[...new Set(e.series.map(l=>l.display.group))],o=Fn(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(l=>[l.id,l.display])),s=new Map(e.series.map(l=>[l.display.group,l.display.label])),c=e.data.map(l=>({...l,group:a.get(l.seriesId).group,label:a.get(l.seriesId).label,title:Rt(i.tip.digits,[["Series",a.get(l.seriesId).label],["Threshold",l.threshold],["Net Benefit",l.netBenefit]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},f=[];for(let l of e.references)l.benchmark==="treat_none"?f.push(ao([0],{...u,title:()=>l.label??"Treat None"})):f.push(Ut(l.points,{x:"x",y:"y",...u,title:()=>l.label??`Treat All \u2014 ${l.population}`}));if(f.push(Ut(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 l=c.filter(m=>m.threshold===r);l.length>0&&f.push(sf(l,"threshold","netBenefit",o,t.theme))}let p=(l,m)=>({label:l,domain:m,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return Ho({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:l=>s.get(l)??l},x:p(e.xAxis.label,e.xAxis.domain),y:p(e.yAxis.label,e.yAxis.domain),marks:f},i)}function j1(e,t={}){return ai(e),of(e,t,(r,n,o,i)=>cf(r,(a,s,c)=>Ss(a,n,(u,f)=>G$(u,n,f),s,c),o,i))}function G$(e,t,r){let n=[...new Set(e.series.map(l=>l.display.group))],o=Fn(n,{...t,showLegend:!1}),{theme:i}=o,a=new Map(e.series.map(l=>[l.id,l.display])),s=new Map(e.series.map(l=>[l.display.group,l.display.label])),c=e.data.map(l=>({...l,group:a.get(l.seriesId).group,label:a.get(l.seriesId).label,title:Rt(i.tip.digits,[["Series",a.get(l.seriesId).label],["Threshold",l.threshold],["Interventions Avoided",l.interventionsAvoided]])})),u={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},f=[];for(let l of e.references)l.benchmark==="treat_all"?f.push(ao([0],{...u,title:()=>l.label??"Treat All"})):f.push(Ut(l.points,{x:"x",y:"y",...u,title:()=>l.label??`Treat None \u2014 ${l.population}`}));if(f.push(Ut(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 l=c.filter(m=>m.threshold===r);l.length>0&&f.push(sf(l,"threshold","interventionsAvoided",o,t.theme))}let p=(l,m)=>({label:l,domain:m,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat});return Ho({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:l=>s.get(l)??l},x:p(e.xAxis.label,e.xAxis.domain),y:p(e.yAxis.label,e.yAxis.domain),marks:f},i)}var Gr="\u2014",Lh=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],K$=[{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 so(e,t,r,n){let o=e.createElement("td"),i=e.createElement("span");if(i.className="rtichoke-performance-table__cell-text",n){let s=e.createElement("span");s.className="rtichoke-performance-table__badge",s.setAttribute("aria-hidden","true"),s.style.backgroundColor=n,i.append(s)}let a=e.createTextNode(t);return i.append(a),o.append(i),r&&(o.className=r),o}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 q$(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 _a(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=Vh(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=Gr;return o.append(i,a),o}var H$=0;function KC(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function Vh(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function Y$(e){return e.toFixed(2)}function W$(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 X$(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return Gr;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)?Gr:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?Gr: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 B1(e,t=globalThis.document){vb(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let T=t.createElement("div");T.className="rtichoke-performance-table__title",T.textContent=e.title,r.append(T)}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(T=>[T.id,T])),a=new Set(e.evaluations.map(T=>T.model).filter(Boolean)),s=new Set(e.evaluations.map(T=>T.population).filter(Boolean)),c=a.size>1,u=s.size>1,f=c,p=u||!c&&a.size===0&&s.size>1,l=new Map,m=0;for(let T of e.evaluations)T.model&&!l.has(T.model)&&(l.set(T.model,Lh[m%Lh.length]),m++);let h=new Map,b=0;for(let T of e.evaluations)T.population&&!h.has(T.population)&&(h.set(T.population,Lh[b%Lh.length]),b++);let y=e.evaluations.some(T=>T.label?!!(c&&T.label!==T.model||u&&T.label!==T.population||!c&&!u&&T.label!==T.model&&T.label!==T.population):!1),x=e.rows.some(T=>T.horizon!==void 0),g=e.rows.some(T=>T.context?.censoringHeuristic!==void 0),_=e.rows.some(T=>T.context?.competingEventHeuristic!==void 0),w=new Set(e.rows.map(T=>T.operatingPoint.type)),I=w.size===1&&w.has("probability_threshold"),S=w.size===1&&w.has("ppcr"),v=new Set(e.metrics.map(T=>T.id)),M=v.has("predicted_positives"),C=v.has("ppcr"),R=M&&(C||S),O=I||!S&&w.has("probability_threshold"),N=R,z=S&&!R,j=!I&&!S&&!R,k=e.rows.filter(T=>T.operatingPoint.type==="probability_threshold").map(T=>T.operatingPoint.value),B=W$(k),V=K$.map(T=>{let L=e.metrics.find(G=>G.id===T.id);return L?{id:L.id,label:L.label||T.defaultLabel}:null}).filter(T=>T!==null),Q=new Set,U=V.filter(T=>Q.has(T.label)?!1:(Q.add(T.label),!0)),K=0,W=0;for(let T of e.rows)for(let L of T.values)if(L.metricId==="lift"&&L.estimate!==null&&L.estimate!==void 0&&isFinite(L.estimate)&&L.estimate>K&&(K=L.estimate),L.metricId==="net_benefit"&&L.estimate!==null&&L.estimate!==void 0&&isFinite(L.estimate)){let G=Math.abs(L.estimate);G>W&&(W=G)}let Z=++H$,X=t.createElement("thead");X.className="rtichoke-performance-table__header";let he=t.createElement("tr"),se=t.createElement("tr"),ce=1;if(se.append(yt(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),f&&(ce++,se.append(yt(t,"Model"))),p&&(ce++,se.append(yt(t,"Population"))),y&&(ce++,se.append(yt(t,"Evaluation"))),O&&(ce++,se.append(yt(t,"Probability Threshold"))),N&&(ce++,se.append(yt(t,"Predicted Positives"))),z&&(ce++,se.append(yt(t,"PPCR"))),j&&(ce++,se.append(yt(t,"Operating Point"))),x&&(ce++,se.append(yt(t,"Time Horizon"))),g&&(ce++,se.append(yt(t,"Censoring"))),_&&(ce++,se.append(yt(t,"Competing Event"))),U.length>0){let T=yt(t,"",{colSpan:ce,className:"rtichoke-performance-table__spanner--empty"});he.append(T)}if(U.length>0){let T=yt(t,"Performance Metrics",{colSpan:U.length,className:"rtichoke-performance-table__spanner"});he.append(T);for(let L of U)se.append(yt(t,L.label,{className:"rtichoke-performance-table__metric-header"}))}X.append(he),X.append(se),o.append(X);let Y=ce+U.length,ee=t.createElement("tbody");for(let T=0;T0?"100.00%":Gr,Dt.append(Rr,pn),ye.append(Dt),vs.append(ye),kr.append(vs),gt.append(kr),we.append(gt),_e.append(we),J.addEventListener("click",()=>{if(!_e)return;let Hr=J.getAttribute("aria-expanded")==="true";J.setAttribute("aria-expanded",Hr?"false":"true"),J.setAttribute("aria-label",Hr?"Show confusion matrix detail":"Hide confusion matrix detail"),J.textContent=Hr?"\u25B8":"\u25BE",_e.hidden=Hr})}if(A.append(Oe),f){let J=G?.model??Gr,we=G?.model?l.get(G.model):void 0;A.append(so(t,J,"rtichoke-performance-table__model",we))}if(p){let J=G?.population??Gr,we=G?.population?h.get(G.population):void 0;A.append(so(t,J,"rtichoke-performance-table__population",we))}y&&A.append(so(t,G?.label??G?.id??Gr,"rtichoke-performance-table__evaluation"));let tt=new Map(L.values.map(J=>[J.metricId,J]));if(O){let J=L.operatingPoint.type==="probability_threshold"?L.operatingPoint.value:void 0,we=J!==void 0?J.toFixed(B):Gr;A.append(so(t,we,"rtichoke-performance-table__op"))}if(N){let J=tt.get("predicted_positives")?.estimate,we=tt.get("ppcr")?.estimate??(L.operatingPoint.type==="ppcr"?L.operatingPoint.value:void 0),gt=Gr,Pt=NaN;if(J!=null&&we!==void 0&&we!==null){let kr=Vh(J),ho=(we*100).toFixed(2);gt=`${kr} (${ho}%)`,Pt=we*100}else we!=null&&(gt=`${(we*100).toFixed(2)}%`,Pt=we*100);let Bt=so(t,gt,"rtichoke-performance-table__op");isNaN(Pt)||Sl(Bt,t,Pt,!1,!1,"neutral"),A.append(Bt)}if(z){let J=L.operatingPoint.type==="ppcr"?L.operatingPoint.value:tt.get("ppcr")?.estimate,we=J!=null?`PPCR ${J.toFixed(2)}`:Gr,gt=so(t,we,"rtichoke-performance-table__op");J!=null&&Sl(gt,t,J*100,!1,!1,"neutral"),A.append(gt)}if(j){let J=L.operatingPoint.type==="ppcr"?`PPCR ${L.operatingPoint.value.toFixed(2)}`:`Threshold ${L.operatingPoint.value.toFixed(B)}`;A.append(so(t,J,"rtichoke-performance-table__op"))}if(x&&A.append(so(t,L.horizon!==void 0?Vh(L.horizon):Gr,"rtichoke-performance-table__horizon")),g){let J=L.context?.censoringHeuristic;A.append(so(t,J?KC(J):Gr,"rtichoke-performance-table__context"))}if(_){let J=L.context?.competingEventHeuristic;A.append(so(t,J?KC(J):Gr,"rtichoke-performance-table__context"))}for(let J of U){let we=tt.get(J.id),gt=X$(we,Y$),Pt=so(t,gt,"rtichoke-performance-table__metric");if(Pt.dataset.metricId=J.id,we&&we.estimate!==null&&we.estimate!==void 0&&isFinite(we.estimate)){let Bt=we.estimate;if(["sensitivity","specificity","ppv","npv"].includes(J.id))Sl(Pt,t,Bt*100);else if(J.id==="lift"){let kr=K>0?Bt/K*100:0;Sl(Pt,t,kr)}else if(J.id==="net_benefit"&&W>0){let kr=Bt<0,ho=Math.abs(Bt)/W*50;Sl(Pt,t,ho,!0,kr)}}A.append(Pt)}ee.append(A),_e&&ee.append(_e)}return o.append(ee),n.append(o),r.append(n),r}var Z$=0;function Q$(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 qC(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 p=null,l=null;if(a?.performance&&a.performance.length>0){let I=k=>{let B=a.performance?.find(V=>V.metricId===k);return B&&B.estimate!==void 0&&B.estimate!==null?B.estimate:null},S=I("true_positives"),v=I("false_positives"),M=I("true_negatives"),C=I("false_negatives"),R=I("sensitivity"),O=I("specificity"),N=I("ppv"),z=I("npv"),j=I("lift");if((R!==null||O!==null||N!==null||z!==null||j!==null)&&(p={sensitivity:R,specificity:O,ppv:N,npv:z,lift:j}),S!==null&&v!==null&&M!==null&&C!==null){let k=S+C,B=M+v,V=S+v,Q=M+C;l={tp:S,fp:v,tn:M,fn:C,totalPositives:k,totalNegatives:B,totalPredictedPos:V,totalPredictedNeg:Q}}}let m=e.evaluations.find(I=>I.id===t),h=m?.label??m?.model??m?.population??t,b=[],y=[];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,M=v?"TP":"FN",C=v?"True Positive (TP)":"False Negative (FN)",R=v?"FP":"TN",O=v?"False Positive (FP)":"True Negative (TN)";I.nPositive>0&&y.push({category:"Observed Positives",count:I.nPositive,classificationCell:M,cellLabel:C,title:Rt(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Positive"],["Count",I.nPositive],["Classification",C]])}),I.nNegative>0&&y.push({category:"Observed Negatives",count:I.nNegative,classificationCell:R,cellLabel:O,title:Rt(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Negative"],["Count",I.nNegative],["Classification",O]])})}for(let v=0;vs,z=N?"TP":"FN",j=N?"True Positive (TP)":"False Negative (FN)",k=N?"FP":"TN",B=N?"False Positive (FP)":"True Negative (TN)",V=s===0?!0:M.upper>s,Q=V?"TP":"FN",U=V?"True Positive (TP)":"False Negative (FN)",K=V?"FP":"TN",W=V?"False Positive (FP)":"True Negative (TN)",Z=I.nPositive+M.nPositive,X=I.nNegative+M.nNegative;z===Q?Z>0&&b.push({x1:C,x2:R,category:"Observed Positives",count:Z,classificationCell:Q,cellLabel:U,isPredictedPositive:V,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Positive"],["Count",Z],["Classification",U]])}):(I.nPositive>0&&b.push({x1:C,x2:R,category:"Observed Positives",count:I.nPositive,classificationCell:z,cellLabel:j,isPredictedPositive:N,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Positive"],["Count",I.nPositive],["Classification",j]])}),M.nPositive>0&&b.push({x1:C,x2:R,category:"Observed Positives",count:M.nPositive,classificationCell:Q,cellLabel:U,isPredictedPositive:V,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Positive"],["Count",M.nPositive],["Classification",U]])})),k===K?X>0&&b.push({x1:C,x2:R,category:"Observed Negatives",count:X,classificationCell:K,cellLabel:W,isPredictedPositive:V,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Negative"],["Count",X],["Classification",W]])}):(I.nNegative>0&&b.push({x1:C,x2:R,category:"Observed Negatives",count:I.nNegative,classificationCell:k,cellLabel:B,isPredictedPositive:N,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Negative"],["Count",I.nNegative],["Classification",B]])}),M.nNegative>0&&b.push({x1:C,x2:R,category:"Observed Negatives",count:M.nNegative,classificationCell:K,cellLabel:W,isPredictedPositive:V,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Negative"],["Count",M.nNegative],["Classification",W]])}))}else{let N=s===0?!0:M.upper>s,z=N?"TP":"FN",j=N?"True Positive (TP)":"False Negative (FN)",k=N?"FP":"TN",B=N?"False Positive (FP)":"True Negative (TN)";M.nPositive>0&&b.push({x1:C,x2:R,category:"Observed Positives",count:M.nPositive,classificationCell:z,cellLabel:j,isPredictedPositive:N,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Positive"],["Count",M.nPositive],["Classification",j]])}),M.nNegative>0&&b.push({x1:C,x2:R,category:"Observed Negatives",count:M.nNegative,classificationCell:k,cellLabel:B,isPredictedPositive:N,title:Rt(o,[["Evaluation",h],["Score Interval",O],["Outcome","Observed Negative"],["Count",M.nNegative],["Classification",B]])})}}}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,M=S.rankUpper,C=S.positiveMass+S.negativeMass,R=v>=1-n-1e-9,O=R?"TP":"FN",N=R?"True Positive (TP)":"False Negative (FN)",z=R?"FP":"TN",j=R?"False Positive (FP)":"True Negative (TN)";if(C>0){let k=`[${v.toFixed(o)}, ${M.toFixed(o)}]`;S.positiveMass>0&&b.push({x1:v,x2:M,category:"Observed Positives",count:S.positiveMass,classificationCell:O,cellLabel:N,isPredictedPositive:R,title:Rt(o,[["Evaluation",h],["Population Rank Percentile",k],["Outcome","Observed Positive"],["Count",S.positiveMass],["Classification",N]])}),S.negativeMass>0&&b.push({x1:v,x2:M,category:"Observed Negatives",count:S.negativeMass,classificationCell:z,cellLabel:j,isPredictedPositive:R,title:Rt(o,[["Evaluation",h],["Population Rank Percentile",k],["Outcome","Observed Negative"],["Count",S.negativeMass],["Classification",j]])})}}}let x=s,g="Prediction Score",_="Count",w=1;if(r==="probability_threshold"){x=s,g="Prediction Score";let I=0,S=new Map;for(let v of b)S.set(v.x1,(S.get(v.x1)??0)+v.count);for(let v of S.values())I=Math.max(I,v);w=Math.max(1,Math.ceil(I*1.15))}else{x=1-n,g="Prediction Percentile";let I=0,S=new Map;for(let v of b)S.set(v.x1,(S.get(v.x1)??0)+v.count);for(let v of S.values())I=Math.max(I,v);w=Math.max(1,Math.ceil(I*1.15))}return{evalId:t,evalLabel:h,dim:r,currentValue:n,cutoff:s,realizedPpcr:c,cutoffX:x,xAxisLabel:g,yAxisLabel:_,yMax:w,totalN:f,performanceMetrics:p,confusion:l,ordinaryPlotData:b,zeroAtomPlotData:y}}function z1(e,t={}){$f(e);let r=++Z$,n=Fn(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=ee=>{let T=new Set;for(let G of e.operatingPoints)G.evaluationId===ee&&T.add(G.type);let L=[];return T.has("probability_threshold")&&L.push("probability_threshold"),T.has("ppcr")&&L.push("ppcr"),L},c=(ee,T)=>e.operatingPoints.filter(L=>L.evaluationId===ee&&L.type===T).sort((L,G)=>L.value-G.value),u=s(a),f=e.operatingPoint?.dimension&&u.includes(e.operatingPoint.dimension)?e.operatingPoint.dimension:u[0]??"probability_threshold",p=(ee,T)=>{let L=c(ee,T);return[...new Set(L.map(G=>G.value))].sort((G,A)=>G-A)},l=(ee,T,L)=>{let G=p(ee,T);return G.length===0?0:L!==void 0&&G.some(A=>Math.abs(A-L)<1e-6)?L:G.some(A=>Math.abs(A-.5)<1e-6)?.5:G[0]},m=l(a,f),h="stacked",b="confusion_matrix_cell",y="all_observations",x=document.createElement("div");x.className="rtichoke-prediction-distribution",x.style.width=`${o.width}px`,x.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 w=document.createElement("select");w.className="rtichoke-prediction-distribution__select",w.setAttribute("aria-label","Color bars by"),w.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",w.append(I,S);let v=document.createElement("label");v.className="rtichoke-prediction-distribution__control-group";let M=document.createElement("select");M.className="rtichoke-prediction-distribution__select",M.setAttribute("aria-label","Condition on");let C=document.createElement("option");C.value="predicted_positives",C.textContent="Predicted positives";let R=document.createElement("option");R.value="predicted_negatives",R.textContent="Predicted negatives";let O=document.createElement("option");O.value="real_positives",O.textContent="Real positives";let N=document.createElement("option");N.value="real_negatives",N.textContent="Real negatives",M.append(C,R,O,N),v.append(M);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()}),w.addEventListener("change",()=>{b=w.value,Y()}),M.addEventListener("change",()=>{y=M.value,Y()}),z.addEventListener("change",()=>{f=z.value,m=l(a,f,m),Y()});let j=(ee,T,L,G,A)=>{let te=document.createElement("div");te.className="rtichoke-pd-radio-group",te.setAttribute("role","radiogroup"),te.setAttribute("aria-label",ee);let ae=document.createElement("span");ae.className="rtichoke-pd-radio-group-label",ae.textContent=`${ee}:`,te.append(ae);let Oe=document.createElement("div");Oe.className="rtichoke-pd-radio-options";for(let _e of L){let tt=document.createElement("label");tt.className="rtichoke-pd-radio-option";let J=document.createElement("input");J.type="radio",J.name=T,J.value=_e.value,J.checked=_e.value===G,J.addEventListener("change",()=>{J.checked&&A(_e.value)});let we=document.createElement("span");we.textContent=_e.label,tt.append(J,we),Oe.append(tt)}return te.append(Oe),te},k=document.createElement("div");k.className="rtichoke-pd-controls-row";let B=()=>{k.replaceChildren(),_.replaceChildren();for(let ee of e.evaluations){let T=document.createElement("option");T.value=ee.id,T.textContent=ee.label??ee.model??ee.population??ee.id,_.append(T)}if(_.value=a,e.evaluations.length>1){let ee=e.evaluations.map(L=>({value:L.id,label:L.label??L.model??L.population??L.id})),T=j("Reference Group",`pd-ref-group-${r}`,ee,a,L=>{a=L,Y()});k.append(T)}},V=document.createElement("div");V.className="rtichoke-pd-controls-row";let Q=document.createElement("div");Q.className="rtichoke-operating-point-control",Q.style.marginLeft=`${o.margins.left}px`,Q.style.marginRight=`${o.margins.right}px`;let U=document.createElement("label");U.className="rtichoke-operating-point-label";let K=document.createElement("span"),W=document.createElement("span");W.className="rtichoke-operating-point-value",U.append(K,W);let Z=document.createElement("input");Z.type="range",Z.className="rtichoke-operating-point-slider",Q.append(U,Z);let X=document.createElement("div");X.className="rtichoke-legend",X.style.paddingLeft=`${o.margins.left}px`;let he=(ee,T)=>{let L=document.createElement("div");L.className="rtichoke-legend-item";let G=document.createElement("span");G.className="rtichoke-legend-swatch";let A=document.createElement("span");A.className="rtichoke-legend-line",A.style.backgroundColor=T,A.style.border=`1px solid ${o.axis.color}`,A.style.boxSizing="border-box",A.style.height="10px",A.style.borderRadius="2px",G.append(A);let te=document.createElement("span");return te.className="rtichoke-legend-label",te.textContent=ee,L.append(G,te),L},se=document.createElement("div");se.className="rtichoke-prediction-distribution__chart";let ce=document.createElement("div");ce.className="rtichoke-prediction-distribution__summary",g.append(k,V),x.append(g,ce,Q,X,se);let Y=()=>{B(),V.replaceChildren(),w.value=b,M.value=y==="all_observations"?"predicted_positives":y,v.style.display=b==="observed_outcome"?"none":"inline-flex",z.replaceChildren();let ee=s(a);for(let be of ee){let ve=document.createElement("option");ve.value=be,ve.textContent=be==="probability_threshold"?"Probability threshold":"PPCR",z.append(ve)}z.value=f;let T=j("Display",`pd-display-${r}`,[{value:"stacked",label:"Stacked"},{value:"mirrored",label:"Mirrored"}],h,be=>{h=be,Y()}),L=j("Color Bars By",`pd-color-${r}`,[{value:"confusion_matrix_cell",label:"Confusion Matrix Cell"},{value:"observed_outcome",label:"Observed Outcome"}],b,be=>{b=be,Y()});if(V.append(T,L,_,w,v,z),ee.length>1){let be=j("Dimension",`pd-dim-${r}`,[{value:"probability_threshold",label:"Probability Threshold"},{value:"ppcr",label:"PPCR"}],f,ve=>{f=ve,m=l(a,f,m),Y()});V.append(be)}let G=p(a,f),A=G.find(be=>Math.abs(be-m)<1e-6);A!==void 0?m=A:m=l(a,f,m);let te=G.indexOf(m);Z.min="0",Z.max=String(Math.max(0,G.length-1)),Z.step="1",Z.value=String(Math.max(0,te));let ae=f==="probability_threshold"?"Probability threshold":"PPCR";K.textContent=`${ae}: `,W.textContent=m.toFixed(i),Z.setAttribute("aria-label",ae),Z.setAttribute("aria-valuetext",m.toFixed(i));let Oe=qC(e,a,f,m,i),{cutoff:_e,cutoffX:tt,xAxisLabel:J,yAxisLabel:we,yMax:gt,totalN:Pt,performanceMetrics:Bt,confusion:kr,ordinaryPlotData:ho}=Oe,$n=Q$(o.predictionDistribution,y);X.replaceChildren(),b==="observed_outcome"&&X.append(he("Observed Positives",o.predictionDistribution.observedPositive),he("Observed Negatives",o.predictionDistribution.observedNegative));let bo=[],vs=f==="probability_threshold"?`Cutoff = ${_e.toFixed(i)}`:`PPCR = ${m.toFixed(i)}`,qr=gt,a0=h==="mirrored"?-gt:0;bo.push(bl([tt],{stroke:o.axis.color,strokeWidth:2,strokeDasharray:"4,3"})),bo.push(ef([{x:tt,label:vs}],{x:"x",y:qr,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700})),h==="mirrored"&&bo.push(ao([0],{stroke:o.axis.color,strokeWidth:1.5}));let mf=be=>{let ve="";if(b==="observed_outcome")ve=be.category==="Observed Positives"?o.predictionDistribution.observedPositive:o.predictionDistribution.observedNegative;else switch(be.classificationCell){case"TP":ve=$n.tp;break;case"FP":ve=$n.fp;break;case"TN":ve=$n.tn;break;case"FN":ve=$n.fn;break}let ye=!0;switch(y){case"all_observations":ye=!0;break;case"predicted_positives":ye=be.isPredictedPositive;break;case"predicted_negatives":ye=!be.isPredictedPositive;break;case"real_positives":ye=be.category==="Observed Positives";break;case"real_negatives":ye=be.category==="Observed Negatives";break}return{fill:ve,fillOpacity:ye?.88:.18,strokeOpacity:ye?.4:.1}};if(h==="stacked"){let be=ho.map(ve=>{let{fill:ye,fillOpacity:Dt,strokeOpacity:Rr}=mf(ve);return{...ve,fill:ye,fillOpacity:Dt,strokeOpacity:Rr}});bo.push(Ei(be,vh({x1:"x1",x2:"x2",y:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:ve=>ve.title,tip:!0})))}else{let be=ho.filter(ye=>ye.category==="Observed Positives").map(ye=>{let{fill:Dt,fillOpacity:Rr,strokeOpacity:pn}=mf(ye);return{...ye,fill:Dt,fillOpacity:Rr,strokeOpacity:pn}}),ve=ho.filter(ye=>ye.category==="Observed Negatives").map(ye=>{let{fill:Dt,fillOpacity:Rr,strokeOpacity:pn}=mf(ye);return{...ye,fill:Dt,fillOpacity:Rr,strokeOpacity:pn}});be.length>0&&bo.push(Ei(be,{x1:"x1",x2:"x2",y1:0,y2:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:ye=>ye.title,tip:!0})),ve.length>0&&bo.push(Ei(ve,{x1:"x1",x2:"x2",y1:0,y2:ye=>-ye.count,fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:ye=>ye.title,tip:!0}))}let s0={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:J,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:we,domain:[a0,qr],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:be=>String(Math.abs(be))},marks:bo},c0=Ho(s0,o);if(se.replaceChildren(c0),ce.replaceChildren(),kr){let{tp:be,fp:ve,tn:ye,fn:Dt,totalPositives:Rr,totalNegatives:pn,totalPredictedPos:Hr,totalPredictedNeg:or}=kr,Yr=document.createElement("table");Yr.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 Tl=document.createElement("col");Tl.style.width="24%",df.append(Ps,Ts,Ms,Tl),Yr.append(df);let hf=(Ye,rt)=>{let Di=document.createElement("label");Di.className=`rtichoke-pd-cond-option ${y===Ye?"rtichoke-pd-cond-option--active":""}`;let Dn=document.createElement("input");Dn.type="radio",Dn.name=`pd-cond-${r}`,Dn.value=Ye,Dn.checked=y===Ye,Dn.addEventListener("change",()=>{Dn.checked&&(y=Ye,Y())});let Wo=document.createElement("span");return Wo.textContent=rt,Di.append(Dn,Wo),Di},iw=document.createElement("thead"),aw=document.createElement("tr"),f0=document.createElement("th");f0.className="rtichoke-pd-matrix__corner",f0.append(hf("all_observations","All Observations"));let u0=document.createElement("th");u0.className=`rtichoke-pd-matrix__col-header ${y==="real_positives"?"rtichoke-pd-matrix__col-header--active":""}`,u0.append(hf("real_positives","Real Positive"));let l0=document.createElement("th");l0.className=`rtichoke-pd-matrix__col-header ${y==="real_negatives"?"rtichoke-pd-matrix__col-header--active":""}`,l0.append(hf("real_negatives","Real Negative"));let sw=document.createElement("th");sw.className="rtichoke-pd-matrix__col-header rtichoke-pd-matrix__col-header--blank",aw.append(f0,u0,l0,sw),iw.append(aw);let cw=document.createElement("tbody"),xO=b==="observed_outcome"?o.predictionDistribution.observedPositive:$n.tp,wO=b==="observed_outcome"?o.predictionDistribution.observedPositive:$n.fn,SO=b==="observed_outcome"?o.predictionDistribution.observedNegative:$n.fp,IO=b==="observed_outcome"?o.predictionDistribution.observedNegative:$n.tn,_O=o.predictionDistribution.observedPositive,vO=o.predictionDistribution.observedNegative,p0="#E5E7EB",PO=Ye=>{if(Pt===0)return null;switch(y){case"all_observations":return`(${((Ye==="TP"?be:Ye==="FP"?ve:Ye==="TN"?ye:Dt)/Pt*100).toFixed(1)}%)`;case"predicted_positives":{let rt=be+ve;return rt===0?null:Ye==="TP"?`(${(be/rt*100).toFixed(1)}%)`:Ye==="FP"?`(${(ve/rt*100).toFixed(1)}%)`:null}case"predicted_negatives":{let rt=ye+Dt;return rt===0?null:Ye==="TN"?`(${(ye/rt*100).toFixed(1)}%)`:Ye==="FN"?`(${(Dt/rt*100).toFixed(1)}%)`:null}case"real_positives":{let rt=be+Dt;return rt===0?null:Ye==="TP"?`(${(be/rt*100).toFixed(1)}%)`:Ye==="FN"?`(${(Dt/rt*100).toFixed(1)}%)`:null}case"real_negatives":{let rt=ye+ve;return rt===0?null:Ye==="TN"?`(${(ye/rt*100).toFixed(1)}%)`:Ye==="FP"?`(${(ve/rt*100).toFixed(1)}%)`:null}}},Ml=(Ye,rt,Di,Dn)=>{Ye.replaceChildren(),Ye.className=`rtichoke-prediction-distribution__cell--${rt.toLowerCase()} rtichoke-pd-matrix__cell`,Ye.style.backgroundColor="#ffffff",Ye.style.color=o.axis.color;let Wo=Pt>0?Di/Pt*100:0,Li=document.createElement("div");Li.className="rtichoke-pd-cell-bar",Li.style.width=`${Wo}%`,Li.style.backgroundColor=Dn;let Ta=document.createElement("div");Ta.className="rtichoke-pd-cell-content";let g0=document.createElement("span");g0.className="rtichoke-pd-cell-label",g0.textContent=rt;let x0=document.createElement("div");x0.className="rtichoke-pd-cell-num";let w0=document.createElement("span");w0.className="rtichoke-pd-cell-count",w0.textContent=Di.toLocaleString();let TO=PO(rt),S0=document.createElement("span");S0.className="rtichoke-pd-cell-pct",S0.textContent=TO??"",x0.append(w0,S0),Ta.append(g0,x0),Ye.append(Li,Ta)},bf=(Ye,rt,Di)=>{Ye.replaceChildren(),Ye.className="rtichoke-prediction-distribution__cell--total rtichoke-pd-matrix__cell",Ye.style.backgroundColor="#ffffff";let Dn=Pt>0?rt/Pt*100:0,Wo=document.createElement("div");Wo.className="rtichoke-pd-cell-bar",Wo.style.width=`${Dn}%`,Wo.style.backgroundColor=Di;let Li=document.createElement("div");Li.className="rtichoke-pd-cell-content rtichoke-pd-cell-content--margin";let Ta=document.createElement("span");Ta.className="rtichoke-pd-cell-count",Ta.textContent=rt.toLocaleString(),Li.append(Ta),Ye.append(Wo,Li)},m0=document.createElement("tr");y==="predicted_positives"&&(m0.className="rtichoke-pd-matrix__row--active");let d0=document.createElement("th");d0.className=`rtichoke-pd-matrix__row-header ${y==="predicted_positives"?"rtichoke-pd-matrix__row-header--active":""}`,d0.append(hf("predicted_positives","Predicted Positive"));let fw=document.createElement("td");Ml(fw,"TP",be,xO);let uw=document.createElement("td");Ml(uw,"FP",ve,SO);let lw=document.createElement("td");bf(lw,Hr,p0),m0.append(d0,fw,uw,lw);let h0=document.createElement("tr");y==="predicted_negatives"&&(h0.className="rtichoke-pd-matrix__row--active");let b0=document.createElement("th");b0.className=`rtichoke-pd-matrix__row-header ${y==="predicted_negatives"?"rtichoke-pd-matrix__row-header--active":""}`,b0.append(hf("predicted_negatives","Predicted Negative"));let pw=document.createElement("td");Ml(pw,"FN",Dt,wO);let mw=document.createElement("td");Ml(mw,"TN",ye,IO);let dw=document.createElement("td");bf(dw,or,p0),h0.append(b0,pw,mw,dw);let y0=document.createElement("tr");y0.className="rtichoke-pd-matrix__tot-row";let hw=document.createElement("th");hw.className="rtichoke-pd-matrix__row-header rtichoke-pd-matrix__row-header--blank";let bw=document.createElement("td");bf(bw,Rr,_O);let yw=document.createElement("td");bf(yw,pn,vO);let gw=document.createElement("td");bf(gw,Pt,p0),y0.append(hw,bw,yw,gw),cw.append(m0,h0,y0),Yr.append(iw,cw),ce.append(Yr)}if(Bt){let be=document.createElement("div");be.className="rtichoke-pd-metrics-container rtichoke-performance-table";let ve=document.createElement("table");ve.className="rtichoke-performance-table__table rtichoke-pd-metrics-table";let ye=document.createElement("thead"),Dt=document.createElement("tr"),Rr=[{id:"sensitivity",label:"Sensitivity",val:Bt.sensitivity,isEmphasized:y==="real_positives",isRatio:!1},{id:"specificity",label:"Specificity",val:Bt.specificity,isEmphasized:y==="real_negatives",isRatio:!1},{id:"ppv",label:"PPV",val:Bt.ppv,isEmphasized:y==="predicted_positives",isRatio:!1},{id:"npv",label:"NPV",val:Bt.npv,isEmphasized:y==="predicted_negatives",isRatio:!1},{id:"lift",label:"Lift",val:Bt.lift,isEmphasized:y==="predicted_positives",isRatio:!0}];for(let or of Rr){let Yr=document.createElement("th");Yr.className=`rtichoke-performance-table__metric-header ${or.isEmphasized?"rtichoke-pd-metric--emphasized-header":""}`,Yr.textContent=or.label,Dt.append(Yr)}ye.append(Dt);let pn=document.createElement("tbody"),Hr=document.createElement("tr");for(let or of Rr){let Yr=document.createElement("td");Yr.className=`rtichoke-performance-table__metric ${or.isEmphasized?"rtichoke-pd-metric--emphasized-cell":""}`;let df="\u2014";if(or.val!==null&&or.val!==void 0&&(df=or.isRatio?or.val.toFixed(2):(or.val*100).toFixed(1)+"%"),or.val!==null&&or.val!==void 0&&isFinite(or.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 Tl=or.isRatio?Math.min(100,or.val/3*100):Math.min(100,or.val*100);Ms.style.width=`${Tl}%`,Ts.append(Ms),Yr.append(Ts)}let Ps=document.createElement("span");Ps.className="rtichoke-performance-table__cell-text",Ps.textContent=df,Yr.append(Ps),Hr.append(Yr)}pn.append(Hr),ve.append(ye,pn),be.append(ve),ce.append(be)}};return Z.addEventListener("input",()=>{let ee=p(a,f),T=Number(Z.value);T>=0&&T0?n[0]:void 0,i=[];if(n.length>1){let m=t.createElement("label");m.className="rtichoke-horizon-control",m.textContent="Fixed Time Horizon: ";let h=t.createElement("select");h.className="rtichoke-horizon-select",h.setAttribute("aria-label","Fixed Time Horizon");for(let b of n){let y=t.createElement("option");y.value=String(b),y.textContent=String(b),h.append(y)}h.value=String(o),h.addEventListener("change",()=>{o=Number(h.value),l()}),m.append(h),r.append(m)}let a=t.createElement("table");a.className="rtichoke-summary-metrics__table";let s=t.createElement("thead"),c=t.createElement("tr");for(let m of["Owner","Metric","Estimate"])c.append(eD(t,m));s.append(c),a.append(s);let u=new Map(e.evaluations.map(m=>[m.id,m])),f=new Map(e.populations.map(m=>[m.id,m])),p=t.createElement("tbody");for(let m of e.metrics){let h=t.createElement("tr"),b="",y="",x;if(m.metric==="auroc"){let _=u.get(m.owner.evaluationId);b=_.label??_.model??_.population??_.id,y="AUROC",h.dataset.metric="auroc",h.dataset.evaluationId=m.owner.evaluationId}else m.metric==="prevalence"?(b=f.get(m.owner.populationId).label,y="Prevalence",h.dataset.metric="prevalence",h.dataset.populationId=m.owner.populationId):m.metric==="event_risk"&&(b=f.get(m.owner.populationId).label,y="Event Probability",x=m.horizon,h.dataset.metric="event_risk",h.dataset.populationId=m.owner.populationId,h.dataset.horizon=String(m.horizon));h.append(G1(t,b,"rtichoke-summary-metrics__owner"),G1(t,y,"rtichoke-summary-metrics__metric"));let g=G1(t,tD(m.estimate),"rtichoke-summary-metrics__estimate");m.estimate===null?g.dataset.unavailable="true":g.dataset.estimate=String(m.estimate),h.append(g),i.push({element:h,horizon:x}),p.append(h)}a.append(p),r.append(a);function l(){for(let{element:m,horizon:h}of i)h===void 0||h===o?m.style.display="":m.style.display="none"}return l(),r}function rD(e){switch(e.errorType){case E.ArrayContains:return"Expected array to contain at least one matching value";case E.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case E.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case E.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case E.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case E.ArrayUniqueItems:return"Expected array elements to be unique";case E.Array:return"Expected array";case E.AsyncIterator:return"Expected AsyncIterator";case E.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case E.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case E.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case E.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case E.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case E.BigInt:return"Expected bigint";case E.Boolean:return"Expected boolean";case E.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case E.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case E.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case E.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case E.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case E.Date:return"Expected Date";case E.Function:return"Expected function";case E.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case E.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case E.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case E.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case E.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case E.Integer:return"Expected integer";case E.IntersectUnevaluatedProperties:return"Unexpected property";case E.Intersect:return"Expected all values to match";case E.Iterator:return"Expected Iterator";case E.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case E.Never:return"Never";case E.Not:return"Value should not match";case E.Null:return"Expected null";case E.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case E.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case E.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case E.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case E.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case E.Number:return"Expected number";case E.Object:return"Expected object";case E.ObjectAdditionalProperties:return"Unexpected property";case E.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case E.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case E.ObjectRequiredProperty:return"Expected required property";case E.Promise:return"Expected Promise";case E.RegExp:return"Expected string to match regular expression";case E.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case E.StringFormat:return`Expected string to match '${e.schema.format}' format`;case E.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case E.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case E.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case E.String:return"Expected string";case E.Symbol:return"Expected symbol";case E.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case E.Tuple:return"Expected tuple";case E.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case E.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case E.Uint8Array:return"Expected Uint8Array";case E.Undefined:return"Expected undefined";case E.Union:return"Expected union value";case E.Void:return"Expected void";case E.Kind:return`Expected kind '${e.schema[$]}'`;default:return"Unknown error type"}}var nD=rD;function HC(){return nD}var q1=class extends le{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function oD(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new q1(e);return De(r,t)}function tr(e,t){return!Ue(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function De(e,t){return e[$]==="This"||e[$]==="Ref"?oD(e,t):e}var H1=class extends le{constructor(t){super("Unable to hash value"),this.value=t}},fn;(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"})(fn||(fn={}));var ff=BigInt("14695981039346656037"),[iD,aD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],sD=Array.from({length:256}).map((e,t)=>BigInt(t)),YC=new Float64Array(1),WC=new DataView(YC.buffer),XC=new Uint8Array(YC.buffer);function*cD(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 fD(e){Sr(fn.Array);for(let t of e)uf(t)}function uD(e){Sr(fn.Boolean),Sr(e?1:0)}function lD(e){Sr(fn.BigInt),WC.setBigInt64(0,e);for(let t of XC)Sr(t)}function pD(e){Sr(fn.Date),uf(e.getTime())}function mD(e){Sr(fn.Null)}function dD(e){Sr(fn.Number),WC.setFloat64(0,e);for(let t of XC)Sr(t)}function hD(e){Sr(fn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())uf(t),uf(e[t])}function bD(e){Sr(fn.String);for(let t=0;t=e.minItems)||Pe(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!rr(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(!(Pe(e.contains)||at(e.minContains)||at(e.maxContains)))return!0;let n=Pe(e.contains)?e.contains:Se(),o=r.reduce((i,a)=>rr(n,t,a)?i+1:i,0);return!(o===0||at(e.minContains)&&oe.maxContains)}function vD(e,t,r){return kl(r)}function PD(e,t,r){return!(!Ln(r)||Pe(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Pe(e.maximum)&&!(r<=e.maximum)||Pe(e.minimum)&&!(r>=e.minimum)||Pe(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function TD(e,t,r){return yo(r)}function MD(e,t,r){return rr(e.returns,t,r.prototype)}function CD(e,t,r){return!(!Ir(r)||Pe(e.exclusiveMaximumTimestamp)&&!(r.getTime()e.exclusiveMinimumTimestamp)||Pe(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||Pe(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||Pe(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function OD(e,t,r){return Vi(r)}function kD(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return rr(o,[...t,...n],r)}function RD(e,t,r){return!(!Al(r)||Pe(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Pe(e.maximum)&&!(r<=e.maximum)||Pe(e.minimum)&&!(r>=e.minimum)||Pe(e.multipleOf)&&r%e.multipleOf!==0)}function ND(e,t,r){let n=e.allOf.every(o=>rr(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(ut(e.unevaluatedProperties)){let o=new RegExp(Bs(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||rr(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function AD(e,t,r){return Rl(r)}function ED(e,t,r){return r===e.const}function FD(e,t,r){return!1}function $D(e,t,r){return!rr(e.not,t,r)}function DD(e,t,r){return Qo(r)}function LD(e,t,r){return!(!Nt.IsNumberLike(r)||Pe(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Pe(e.minimum)&&!(r>=e.minimum)||Pe(e.maximum)&&!(r<=e.maximum)||Pe(e.multipleOf)&&r%e.multipleOf!==0)}function VD(e,t,r){if(!Nt.IsObjectLike(r)||Pe(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Pe(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(!rr(i,t,r[o])||($a(i)||wD(i))&&!(o in r))return!1}else if(Nt.IsExactOptionalProperty(r,o)&&!rr(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)||rr(e.additionalProperties,t,r[i])):!0}function UD(e,t,r){return Nl(r)}function jD(e,t,r){if(!Nt.IsRecordLike(r)||Pe(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Pe(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)?rr(o,t,f):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([u,f])=>i.test(u)?!0:rr(e.additionalProperties,t,f)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(u=>i.test(u)):!0;return a&&s&&c}function BD(e,t,r){return rr(De(e,t),t,r)}function zD(e,t,r){let n=new RegExp(e.source,e.flags);return Pe(e.minLength)&&!(r.length>=e.minLength)||Pe(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function GD(e,t,r){return!Ue(r)||Pe(e.minLength)&&!(r.length>=e.minLength)||Pe(e.maxLength)&&!(r.length<=e.maxLength)||Pe(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:Pe(e.format)?Gi.Has(e.format)?Gi.Get(e.format)(r):!1:!0}function KD(e,t,r){return Jo(r)}function qD(e,t,r){return Ue(r)&&new RegExp(e.pattern).test(r)}function HD(e,t,r){return rr(De(e,t),t,r)}function YD(e,t,r){if(!ue(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;nrr(n,t,r))}function ZD(e,t,r){return!(!Os(r)||Pe(e.maxByteLength)&&!(r.length<=e.maxByteLength)||Pe(e.minByteLength)&&!(r.length>=e.minByteLength))}function QD(e,t,r){return!0}function JD(e,t,r){return Nt.IsVoidLike(r)}function eL(e,t,r){return qn.Has(e[$])?qn.Get(e[$])(e,r):!1}function rr(e,t,r){let n=Pe(e.$id)?tr(e,t):t,o=e;switch(o[$]){case"Any":return SD(o,n,r);case"Argument":return ID(o,n,r);case"Array":return _D(o,n,r);case"AsyncIterator":return vD(o,n,r);case"BigInt":return PD(o,n,r);case"Boolean":return TD(o,n,r);case"Constructor":return MD(o,n,r);case"Date":return CD(o,n,r);case"Function":return OD(o,n,r);case"Import":return kD(o,n,r);case"Integer":return RD(o,n,r);case"Intersect":return ND(o,n,r);case"Iterator":return AD(o,n,r);case"Literal":return ED(o,n,r);case"Never":return FD(o,n,r);case"Not":return $D(o,n,r);case"Null":return DD(o,n,r);case"Number":return LD(o,n,r);case"Object":return VD(o,n,r);case"Promise":return UD(o,n,r);case"Record":return jD(o,n,r);case"Ref":return BD(o,n,r);case"RegExp":return zD(o,n,r);case"String":return GD(o,n,r);case"Symbol":return KD(o,n,r);case"TemplateLiteral":return qD(o,n,r);case"This":return HD(o,n,r);case"Tuple":return YD(o,n,r);case"Undefined":return WD(o,n,r);case"Union":return XD(o,n,r);case"Uint8Array":return ZD(o,n,r);case"Unknown":return QD(o,n,r);case"Void":return JD(o,n,r);default:if(!qn.Has(o[$]))throw new Y1(o);return eL(o,n,r)}}function xe(...e){return e.length===3?rr(e[0],e[1],e[2]):rr(e[0],[],e[1])}var E;(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"})(E||(E={}));var W1=class extends le{constructor(t){super("Unknown type"),this.schema=t}};function Fi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Te(e){return e!==void 0}var va=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 H(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:HC()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*tL(e,t,r,n){}function*rL(e,t,r,n){}function*nL(e,t,r,n){if(!ue(n))return yield H(E.Array,e,r,n);Te(e.minItems)&&!(n.length>=e.minItems)&&(yield H(E.ArrayMinItems,e,r,n)),Te(e.maxItems)&&!(n.length<=e.maxItems)&&(yield H(E.ArrayMaxItems,e,r,n));for(let a=0;anr(o,t,`${r}${c}`,s).next().done===!0?a+1:a,0);i===0&&(yield H(E.ArrayContains,e,r,n)),at(e.minContains)&&ie.maxContains&&(yield H(E.ArrayMaxContains,e,r,n))}function*oL(e,t,r,n){kl(n)||(yield H(E.AsyncIterator,e,r,n))}function*iL(e,t,r,n){if(!Ln(n))return yield H(E.BigInt,e,r,n);Te(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield H(E.BigIntExclusiveMinimum,e,r,n)),Te(e.maximum)&&!(n<=e.maximum)&&(yield H(E.BigIntMaximum,e,r,n)),Te(e.minimum)&&!(n>=e.minimum)&&(yield H(E.BigIntMinimum,e,r,n)),Te(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield H(E.BigIntMultipleOf,e,r,n))}function*aL(e,t,r,n){yo(n)||(yield H(E.Boolean,e,r,n))}function*sL(e,t,r,n){yield*nr(e.returns,t,r,n.prototype)}function*cL(e,t,r,n){if(!Ir(n))return yield H(E.Date,e,r,n);Te(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield H(E.DateExclusiveMinimumTimestamp,e,r,n)),Te(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield H(E.DateMaximumTimestamp,e,r,n)),Te(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield H(E.DateMinimumTimestamp,e,r,n)),Te(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield H(E.DateMultipleOfTimestamp,e,r,n))}function*fL(e,t,r,n){Vi(n)||(yield H(E.Function,e,r,n))}function*uL(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*nr(i,[...t,...o],r,n)}function*lL(e,t,r,n){if(!Al(n))return yield H(E.Integer,e,r,n);Te(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield H(E.IntegerExclusiveMinimum,e,r,n)),Te(e.maximum)&&!(n<=e.maximum)&&(yield H(E.IntegerMaximum,e,r,n)),Te(e.minimum)&&!(n>=e.minimum)&&(yield H(E.IntegerMinimum,e,r,n)),Te(e.multipleOf)&&n%e.multipleOf!==0&&(yield H(E.IntegerMultipleOf,e,r,n))}function*pL(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of nr(i,t,r,n))o=!0,yield a;if(o)return yield H(E.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 H(E.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=nr(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*mL(e,t,r,n){Rl(n)||(yield H(E.Iterator,e,r,n))}function*dL(e,t,r,n){n!==e.const&&(yield H(E.Literal,e,r,n))}function*hL(e,t,r,n){yield H(E.Never,e,r,n)}function*bL(e,t,r,n){nr(e.not,t,r,n).next().done===!0&&(yield H(E.Not,e,r,n))}function*yL(e,t,r,n){Qo(n)||(yield H(E.Null,e,r,n))}function*gL(e,t,r,n){if(!Nt.IsNumberLike(n))return yield H(E.Number,e,r,n);Te(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield H(E.NumberExclusiveMinimum,e,r,n)),Te(e.maximum)&&!(n<=e.maximum)&&(yield H(E.NumberMaximum,e,r,n)),Te(e.minimum)&&!(n>=e.minimum)&&(yield H(E.NumberMinimum,e,r,n)),Te(e.multipleOf)&&n%e.multipleOf!==0&&(yield H(E.NumberMultipleOf,e,r,n))}function*xL(e,t,r,n){if(!Nt.IsObjectLike(n))return yield H(E.Object,e,r,n);Te(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield H(E.ObjectMinProperties,e,r,n)),Te(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield H(E.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 H(E.ObjectRequiredProperty,e.properties[s],`${r}/${Fi(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield H(E.ObjectAdditionalProperties,e,`${r}/${Fi(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*nr(e.additionalProperties,t,`${r}/${Fi(s)}`,n[s]));for(let s of i){let c=e.properties[s];e.required&&e.required.includes(s)?(yield*nr(c,t,`${r}/${Fi(s)}`,n[s]),$a(e)&&!(s in n)&&(yield H(E.ObjectRequiredProperty,c,`${r}/${Fi(s)}`,void 0))):Nt.IsExactOptionalProperty(n,s)&&(yield*nr(c,t,`${r}/${Fi(s)}`,n[s]))}}function*wL(e,t,r,n){Nl(n)||(yield H(E.Promise,e,r,n))}function*SL(e,t,r,n){if(!Nt.IsRecordLike(n))return yield H(E.Object,e,r,n);Te(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield H(E.ObjectMinProperties,e,r,n)),Te(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield H(E.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*nr(i,t,`${r}/${Fi(s)}`,c));if(typeof e.additionalProperties=="object")for(let[s,c]of Object.entries(n))a.test(s)||(yield*nr(e.additionalProperties,t,`${r}/${Fi(s)}`,c));if(e.additionalProperties===!1){for(let[s,c]of Object.entries(n))if(!a.test(s))return yield H(E.ObjectAdditionalProperties,e,`${r}/${Fi(s)}`,c)}}function*IL(e,t,r,n){yield*nr(De(e,t),t,r,n)}function*_L(e,t,r,n){if(!Ue(n))return yield H(E.String,e,r,n);if(Te(e.minLength)&&!(n.length>=e.minLength)&&(yield H(E.StringMinLength,e,r,n)),Te(e.maxLength)&&!(n.length<=e.maxLength)&&(yield H(E.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield H(E.RegExp,e,r,n)}function*vL(e,t,r,n){if(!Ue(n))return yield H(E.String,e,r,n);Te(e.minLength)&&!(n.length>=e.minLength)&&(yield H(E.StringMinLength,e,r,n)),Te(e.maxLength)&&!(n.length<=e.maxLength)&&(yield H(E.StringMaxLength,e,r,n)),Ue(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield H(E.StringPattern,e,r,n))),Ue(e.format)&&(Gi.Has(e.format)?Gi.Get(e.format)(n)||(yield H(E.StringFormat,e,r,n)):yield H(E.StringFormatUnknown,e,r,n))}function*PL(e,t,r,n){Jo(n)||(yield H(E.Symbol,e,r,n))}function*TL(e,t,r,n){if(!Ue(n))return yield H(E.String,e,r,n);new RegExp(e.pattern).test(n)||(yield H(E.StringPattern,e,r,n))}function*ML(e,t,r,n){yield*nr(De(e,t),t,r,n)}function*CL(e,t,r,n){if(!ue(n))return yield H(E.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield H(E.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield H(E.TupleLength,e,r,n);if(e.items)for(let o=0;onew va(nr(i,t,r,n)));yield H(E.Union,e,r,n,o)}function*RL(e,t,r,n){if(!Os(n))return yield H(E.Uint8Array,e,r,n);Te(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield H(E.Uint8ArrayMaxByteLength,e,r,n)),Te(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield H(E.Uint8ArrayMinByteLength,e,r,n))}function*NL(e,t,r,n){}function*AL(e,t,r,n){Nt.IsVoidLike(n)||(yield H(E.Void,e,r,n))}function*EL(e,t,r,n){qn.Get(e[$])(e,n)||(yield H(E.Kind,e,r,n))}function*nr(e,t,r,n){let o=Te(e.$id)?[...t,e]:t,i=e;switch(i[$]){case"Any":return yield*tL(i,o,r,n);case"Argument":return yield*rL(i,o,r,n);case"Array":return yield*nL(i,o,r,n);case"AsyncIterator":return yield*oL(i,o,r,n);case"BigInt":return yield*iL(i,o,r,n);case"Boolean":return yield*aL(i,o,r,n);case"Constructor":return yield*sL(i,o,r,n);case"Date":return yield*cL(i,o,r,n);case"Function":return yield*fL(i,o,r,n);case"Import":return yield*uL(i,o,r,n);case"Integer":return yield*lL(i,o,r,n);case"Intersect":return yield*pL(i,o,r,n);case"Iterator":return yield*mL(i,o,r,n);case"Literal":return yield*dL(i,o,r,n);case"Never":return yield*hL(i,o,r,n);case"Not":return yield*bL(i,o,r,n);case"Null":return yield*yL(i,o,r,n);case"Number":return yield*gL(i,o,r,n);case"Object":return yield*xL(i,o,r,n);case"Promise":return yield*wL(i,o,r,n);case"Record":return yield*SL(i,o,r,n);case"Ref":return yield*IL(i,o,r,n);case"RegExp":return yield*_L(i,o,r,n);case"String":return yield*vL(i,o,r,n);case"Symbol":return yield*PL(i,o,r,n);case"TemplateLiteral":return yield*TL(i,o,r,n);case"This":return yield*ML(i,o,r,n);case"Tuple":return yield*CL(i,o,r,n);case"Undefined":return yield*OL(i,o,r,n);case"Union":return yield*kL(i,o,r,n);case"Uint8Array":return yield*RL(i,o,r,n);case"Unknown":return yield*NL(i,o,r,n);case"Void":return yield*AL(i,o,r,n);default:if(!qn.Has(i[$]))throw new W1(e);return yield*EL(i,o,r,n)}}function Pa(...e){let t=e.length===3?nr(e[0],e[1],"",e[2]):nr(e[0],[],"",e[1]);return new va(t)}var FL=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},QC=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)},X1,Uh,JC,Z1=class extends le{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),X1.add(this),Uh.set(this,void 0),FL(this,Uh,t,"f"),this.error=r}Errors(){return new va(QC(this,X1,"m",JC).call(this))}};Uh=new WeakMap,X1=new WeakSet,JC=function*(){this.error&&(yield this.error),yield*QC(this,Uh,"f")};function ZC(e,t,r){if(!xe(e,t,r))throw new Z1(Pa(e,t,r))}function jh(...e){return e.length===3?ZC(e[0],e[1],e[2]):ZC(e[0],[],e[1])}function $L(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Ne(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Ne(e[r]);return t}function DL(e){return e.map(t=>Ne(t))}function LL(e){return e.slice()}function VL(e){return new Map(Ne([...e.entries()]))}function UL(e){return new Set(Ne([...e.entries()]))}function jL(e){return new Date(e.toISOString())}function Ne(e){if(ue(e))return DL(e);if(Ir(e))return jL(e);if(mn(e))return LL(e);if(xw(e))return VL(e);if(ww(e))return UL(e);if(de(e))return $L(e);if(Xr(e))return e;throw new Error("ValueClone: Unable to clone value")}var un=class extends le{constructor(t,r){super(r),this.schema=t}};function Ae(e){return Vi(e)?e():Ne(e)}function BL(e,t){return fe(e,"default")?Ae(e.default):{}}function zL(e,t){return{}}function GL(e,t){if(e.uniqueItems===!0&&!fe(e,"default"))throw new un(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!fe(e,"default"))throw new un(e,"Array with the contains constraint requires a default value");return"default"in e?Ae(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>ln(e.items,t)):[]}function KL(e,t){return fe(e,"default")?Ae(e.default):(async function*(){})()}function qL(e,t){return fe(e,"default")?Ae(e.default):BigInt(0)}function HL(e,t){return fe(e,"default")?Ae(e.default):!1}function YL(e,t){if(fe(e,"default"))return Ae(e.default);{let r=ln(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 WL(e,t){return fe(e,"default")?Ae(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function XL(e,t){return fe(e,"default")?Ae(e.default):()=>ln(e.returns,t)}function ZL(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return ln(n,[...t,...r])}function QL(e,t){return fe(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function JL(e,t){if(fe(e,"default"))return Ae(e.default);{let r=e.allOf.reduce((n,o)=>{let i=ln(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!xe(e,t,r))throw new un(e,"Intersect produced invalid value. Consider using a default value.");return r}}function eV(e,t){return fe(e,"default")?Ae(e.default):(function*(){})()}function tV(e,t){return fe(e,"default")?Ae(e.default):e.const}function rV(e,t){if(fe(e,"default"))return Ae(e.default);throw new un(e,"Never types cannot be created. Consider using a default value.")}function nV(e,t){if(fe(e,"default"))return Ae(e.default);throw new un(e,"Not types must have a default value")}function oV(e,t){return fe(e,"default")?Ae(e.default):null}function iV(e,t){return fe(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function aV(e,t){if(fe(e,"default"))return Ae(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=ln(i,t));return n}}function sV(e,t){return fe(e,"default")?Ae(e.default):Promise.resolve(ln(e.item,t))}function cV(e,t){return fe(e,"default")?Ae(e.default):{}}function fV(e,t){return fe(e,"default")?Ae(e.default):ln(De(e,t),t)}function uV(e,t){if(fe(e,"default"))return Ae(e.default);throw new un(e,"RegExp types cannot be created. Consider using a default value.")}function lV(e,t){if(e.pattern!==void 0){if(fe(e,"default"))return Ae(e.default);throw new un(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(fe(e,"default"))return Ae(e.default);throw new un(e,"String types with formats must specify a default value")}else return fe(e,"default")?Ae(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function pV(e,t){return fe(e,"default")?Ae(e.default):"value"in e?Symbol.for(e.value):Symbol()}function mV(e,t){if(fe(e,"default"))return Ae(e.default);if(!Dl(e))throw new un(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return Ls(e)[0]}function dV(e,t){if(eO++>IV)throw new un(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return fe(e,"default")?Ae(e.default):ln(De(e,t),t)}function hV(e,t){return fe(e,"default")?Ae(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>ln(e.items[n],t))}function bV(e,t){if(fe(e,"default"))return Ae(e.default)}function yV(e,t){if(fe(e,"default"))return Ae(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return ln(e.anyOf[0],t)}function gV(e,t){return fe(e,"default")?Ae(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function xV(e,t){return fe(e,"default")?Ae(e.default):{}}function wV(e,t){if(fe(e,"default"))return Ae(e.default)}function SV(e,t){if(fe(e,"default"))return Ae(e.default);throw new Error("User defined types must specify a default value")}function ln(e,t){let r=tr(e,t),n=e;switch(n[$]){case"Any":return BL(n,r);case"Argument":return zL(n,r);case"Array":return GL(n,r);case"AsyncIterator":return KL(n,r);case"BigInt":return qL(n,r);case"Boolean":return HL(n,r);case"Constructor":return YL(n,r);case"Date":return WL(n,r);case"Function":return XL(n,r);case"Import":return ZL(n,r);case"Integer":return QL(n,r);case"Intersect":return JL(n,r);case"Iterator":return eV(n,r);case"Literal":return tV(n,r);case"Never":return rV(n,r);case"Not":return nV(n,r);case"Null":return oV(n,r);case"Number":return iV(n,r);case"Object":return aV(n,r);case"Promise":return sV(n,r);case"Record":return cV(n,r);case"Ref":return fV(n,r);case"RegExp":return uV(n,r);case"String":return lV(n,r);case"Symbol":return pV(n,r);case"TemplateLiteral":return mV(n,r);case"This":return dV(n,r);case"Tuple":return hV(n,r);case"Undefined":return bV(n,r);case"Union":return yV(n,r);case"Uint8Array":return gV(n,r);case"Unknown":return xV(n,r);case"Void":return wV(n,r);default:if(!qn.Has(n[$]))throw new un(n,"Unknown type");return SV(n,r)}}var IV=512,eO=0;function co(...e){return eO=0,e.length===2?ln(e[0],e[1]):ln(e[0],[])}var Bh=class extends le{constructor(t,r){super(r),this.schema=t}};function tO(e,t,r){if(e[$]==="Object"&&typeof r=="object"&&!Qo(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,p=o.includes(s)?1:0;return a+(u+f+p)},0)}else if(e[$]==="Union"){let o=e.anyOf.map(i=>De(i,t)).map(i=>tO(i,t,r));return Math.max(...o)}else return xe(e,t,r)?1:0}function _V(e,t,r){let n=e.anyOf.map(a=>De(a,t)),[o,i]=[n[0],0];for(let a of n){let s=tO(a,t,r);s>i&&(o=a,i=s)}return o}function vV(e,t,r){if("default"in e)return typeof r=="function"?e.default:Ne(e.default);{let n=_V(e,t,r);return Il(n,t,r)}}function PV(e,t,r){return xe(e,t,r)?Ne(r):co(e,t)}function TV(e,t,r){return xe(e,t,r)?r:co(e,t)}function MV(e,t,r){if(xe(e,t,r))return Ne(r);let n=ue(r)?Ne(r):co(e,t),o=at(e.minItems)&&n.lengthnull)]:n,a=(at(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>fo(e.items,t,c));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!xe(e,t,s))throw new Bh(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function CV(e,t,r){if(xe(e,t,r))return co(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]=fo(a,t,r.prototype[i]));return o}function OV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return fo(o,[...t,...n],r)}function rO(e,t){return de(e)&&!de(t)||!de(e)&&de(t)?e:!de(e)||!de(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?rO(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function kV(e,t,r){if(xe(e,t,r))return r;let n=co(e,t),o=rO(n,r);return xe(e,t,o)?o:n}function RV(e,t,r){throw new Bh(e,"Never types cannot be cast")}function NV(e,t,r){if(xe(e,t,r))return r;if(r===null||typeof r!="object")return co(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]=fo(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]=fo(e.additionalProperties,t,r[a]))}return o}function AV(e,t,r){if(xe(e,t,r))return Ne(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return co(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=fo(o,t,s);return i}function EV(e,t,r){return fo(De(e,t),t,r)}function FV(e,t,r){return fo(De(e,t),t,r)}function $V(e,t,r){return xe(e,t,r)?Ne(r):ue(r)?e.items===void 0?[]:e.items.map((n,o)=>fo(n,t,r[o])):co(e,t)}function DV(e,t,r){return xe(e,t,r)?Ne(r):vV(e,t,r)}function fo(e,t,r){let n=Ue(e.$id)?tr(e,t):t,o=e;switch(e[$]){case"Array":return MV(o,n,r);case"Constructor":return CV(o,n,r);case"Import":return OV(o,n,r);case"Intersect":return kV(o,n,r);case"Never":return RV(o,n,r);case"Object":return NV(o,n,r);case"Record":return AV(o,n,r);case"Ref":return EV(o,n,r);case"This":return FV(o,n,r);case"Tuple":return $V(o,n,r);case"Union":return DV(o,n,r);case"Date":case"Symbol":case"Uint8Array":return PV(e,t,r);default:return TV(o,n,r)}}function Il(...e){return e.length===3?fo(e[0],e[1],e[2]):fo(e[0],[],e[1])}function LV(e){return ji(e)&&e[$]!=="Unsafe"}function VV(e,t,r){return ue(r)?r.map(n=>Kr(e.items,t,n)):r}function UV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Kr(o,[...t,...n],r)}function jV(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>Kr(s,t,Ne(r))).reduce((s,c)=>de(c)?{...s,...c}:c,{});if(!de(r)||!de(i)||!ji(n))return i;let a=Fr(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||xe(n,t,r[s])&&(i[s]=Kr(n,t,r[s]));return i}function BV(e,t,r){if(!de(r)||ue(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(fe(e.properties,o)){r[o]=Kr(e.properties[o],t,r[o]);continue}if(ji(n)&&xe(n,t,r[o])){r[o]=Kr(n,t,r[o]);continue}delete r[o]}return r}function zV(e,t,r){if(!de(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]=Kr(a,t,r[c]);continue}if(ji(n)&&xe(n,t,r[c])){r[c]=Kr(n,t,r[c]);continue}delete r[c]}return r}function GV(e,t,r){return Kr(De(e,t),t,r)}function KV(e,t,r){return Kr(De(e,t),t,r)}function qV(e,t,r){if(!ue(r))return r;if(ot(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function HV(e,t,r){for(let n of e.anyOf)if(LV(n)&&xe(n,t,r))return Kr(n,t,r);return r}function Kr(e,t,r){let n=Ue(e.$id)?tr(e,t):t,o=e;switch(o[$]){case"Array":return VV(o,n,r);case"Import":return UV(o,n,r);case"Intersect":return jV(o,n,r);case"Object":return BV(o,n,r);case"Record":return zV(o,n,r);case"Ref":return GV(o,n,r);case"This":return KV(o,n,r);case"Tuple":return qV(o,n,r);case"Union":return HV(o,n,r);default:return r}}function zh(...e){return e.length===3?Kr(e[0],e[1],e[2]):Kr(e[0],[],e[1])}function Gh(e){return Ue(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function YV(e){return Ln(e)||yo(e)||at(e)}function _l(e){return e===!0||at(e)&&e===1||Ln(e)&&e===BigInt("1")||Ue(e)&&(e.toLowerCase()==="true"||e==="1")}function vl(e){return e===!1||at(e)&&(e===0||Object.is(e,-0))||Ln(e)&&e===BigInt("0")||Ue(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function WV(e){return Ue(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function XV(e){return Ue(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function ZV(e){return Ue(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 QV(e){return Ue(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 JV(e){return Ue(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function eU(e,t){let r=oO(e);return r===t?r:e}function tU(e,t){let r=iO(e);return r===t?r:e}function rU(e,t){let r=nO(e);return r===t?r:e}function nU(e,t){return Ue(e.const)?eU(t,e.const):at(e.const)?tU(t,e.const):yo(e.const)?rU(t,e.const):t}function nO(e){return _l(e)?!0:vl(e)?!1:e}function oU(e){let t=r=>r.split(".")[0];return Gh(e)?BigInt(t(e)):at(e)?BigInt(Math.trunc(e)):vl(e)?BigInt(0):_l(e)?BigInt(1):e}function oO(e){return Jo(e)&&e.description!==void 0?e.description.toString():YV(e)?e.toString():e}function iO(e){return Gh(e)?parseFloat(e):_l(e)?1:vl(e)?0:e}function iU(e){return Gh(e)?parseInt(e):at(e)?Math.trunc(e):_l(e)?1:vl(e)?0:e}function aU(e){return Ue(e)&&e.toLowerCase()==="null"?null:e}function sU(e){return Ue(e)&&e==="undefined"?void 0:e}function cU(e){return Ir(e)?e:at(e)?new Date(e):_l(e)?new Date(1):vl(e)?new Date(0):Gh(e)?new Date(parseInt(e)):XV(e)?new Date(`1970-01-01T${e}.000Z`):WV(e)?new Date(`1970-01-01T${e}`):QV(e)?new Date(`${e}.000Z`):ZV(e)?new Date(e):JV(e)?new Date(`${e}T00:00:00.000Z`):e}function fU(e,t,r){return(ue(r)?r:[r]).map(o=>uo(e.items,t,o))}function uU(e,t,r){return oU(r)}function lU(e,t,r){return nO(r)}function pU(e,t,r){return cU(r)}function mU(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return uo(o,[...t,...n],r)}function dU(e,t,r){return iU(r)}function hU(e,t,r){return e.allOf.reduce((n,o)=>uo(o,t,n),r)}function bU(e,t,r){return nU(e,r)}function yU(e,t,r){return aU(r)}function gU(e,t,r){return iO(r)}function xU(e,t,r){if(!de(r)||ue(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))fe(r,n)&&(r[n]=uo(e.properties[n],t,r[n]));return r}function wU(e,t,r){if(!(de(r)&&!ue(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=uo(i,t,s);return r}function SU(e,t,r){return uo(De(e,t),t,r)}function IU(e,t,r){return oO(r)}function _U(e,t,r){return Ue(r)||at(r)?Symbol(r):r}function vU(e,t,r){return uo(De(e,t),t,r)}function PU(e,t,r){return ue(r)&&!ot(e.items)?r.map((o,i)=>ilo(e.items,t,`${r}/${i}`,o))):mt(e,r,n)}function OU(e,t,r,n){if(!de(n)||Xr(n))return mt(e,r,n);let o=Bl(e),i=o.map(f=>f[0]),a={...n};for(let[f,p]of o)f in a&&(a[f]=lo(p,t,`${r}/${f}`,a[f]));if(!Ee(e.unevaluatedProperties))return mt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=mt(c,`${r}/${f}`,u[f]));return mt(e,r,u)}function kU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=lo(i,[...t,...o],r,n);return mt(e,r,a)}function RU(e,t,r,n){return mt(e,r,lo(e.not,t,r,n))}function NU(e,t,r,n){if(!de(n))return mt(e,r,n);let o=Fr(e),i={...n};for(let u of o)fe(i,u)&&(ot(i[u])&&(!ri(e.properties[u])||Nt.IsExactOptionalProperty(i,u))||(i[u]=lo(e.properties[u],t,`${r}/${u}`,i[u])));if(!ut(e.additionalProperties))return mt(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,c={...i};for(let u of a)o.includes(u)||(c[u]=mt(s,`${r}/${u}`,c[u]));return mt(e,r,c)}function AU(e,t,r,n){if(!de(n))return mt(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]=lo(e.patternProperties[o],t,`${r}/${f}`,a[f]));if(!ut(e.additionalProperties))return mt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.test(f)||(u[f]=mt(c,`${r}/${f}`,u[f]));return mt(e,r,u)}function EU(e,t,r,n){let o=De(e,t);return mt(e,r,lo(o,t,r,n))}function FU(e,t,r,n){let o=De(e,t);return mt(e,r,lo(o,t,r,n))}function $U(e,t,r,n){return ue(n)&&ue(e.items)?mt(e,r,e.items.map((o,i)=>lo(o,t,`${r}/${i}`,n[i]))):mt(e,r,n)}function DU(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=lo(o,t,r,n);return mt(e,r,i)}return mt(e,r,n)}function lo(e,t,r,n){let o=tr(e,t),i=e;switch(e[$]){case"Array":return CU(i,o,r,n);case"Import":return kU(i,o,r,n);case"Intersect":return OU(i,o,r,n);case"Not":return RU(i,o,r,n);case"Object":return NU(i,o,r,n);case"Record":return AU(i,o,r,n);case"Ref":return EU(i,o,r,n);case"Symbol":return mt(i,r,n);case"This":return FU(i,o,r,n);case"Tuple":return $U(i,o,r,n);case"Union":return DU(i,o,r,n);default:return mt(i,r,n)}}function Hh(e,t,r){return lo(e,t,"",r)}var Yh=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}},J1=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 pr(e,t,r){try{return Ee(e)?e[ft].Encode(r):r}catch(n){throw new J1(e,t,r,n)}}function LU(e,t,r,n){let o=pr(e,r,n);return ue(o)?o.map((i,a)=>po(e.items,t,`${r}/${a}`,i)):o}function VU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=pr(e,r,n);return po(i,[...t,...o],r,a)}function UU(e,t,r,n){let o=pr(e,r,n);if(!de(n)||Xr(n))return o;let i=Bl(e),a=i.map(p=>p[0]),s={...o};for(let[p,l]of i)p in s&&(s[p]=po(l,t,`${r}/${p}`,s[p]));if(!Ee(e.unevaluatedProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.unevaluatedProperties,f={...s};for(let p of c)a.includes(p)||(f[p]=pr(u,`${r}/${p}`,f[p]));return f}function jU(e,t,r,n){return pr(e.not,r,pr(e,r,n))}function BU(e,t,r,n){let o=pr(e,r,n);if(!de(o))return o;let i=Fr(e),a={...o};for(let f of i)fe(a,f)&&(ot(a[f])&&(!ri(e.properties[f])||Nt.IsExactOptionalProperty(a,f))||(a[f]=po(e.properties[f],t,`${r}/${f}`,a[f])));if(!ut(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=pr(c,`${r}/${f}`,u[f]));return u}function zU(e,t,r,n){let o=pr(e,r,n);if(!de(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),s={...o};for(let p of Object.getOwnPropertyNames(n))a.test(p)&&(s[p]=po(e.patternProperties[i],t,`${r}/${p}`,s[p]));if(!ut(e.additionalProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.additionalProperties,f={...s};for(let p of c)a.test(p)||(f[p]=pr(u,`${r}/${p}`,f[p]));return f}function GU(e,t,r,n){let o=De(e,t),i=po(o,t,r,n);return pr(e,r,i)}function KU(e,t,r,n){let o=De(e,t),i=po(o,t,r,n);return pr(e,r,i)}function qU(e,t,r,n){let o=pr(e,r,n);return ue(e.items)?e.items.map((i,a)=>po(i,t,`${r}/${a}`,o[a])):[]}function HU(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=po(o,t,r,n);return pr(e,r,i)}for(let o of e.anyOf){let i=po(o,t,r,n);if(xe(e,t,i))return pr(e,r,i)}return pr(e,r,n)}function po(e,t,r,n){let o=tr(e,t),i=e;switch(e[$]){case"Array":return LU(i,o,r,n);case"Import":return VU(i,o,r,n);case"Intersect":return UU(i,o,r,n);case"Not":return jU(i,o,r,n);case"Object":return BU(i,o,r,n);case"Record":return zU(i,o,r,n);case"Ref":return GU(i,o,r,n);case"This":return KU(i,o,r,n);case"Tuple":return qU(i,o,r,n);case"Union":return HU(i,o,r,n);default:return pr(i,r,n)}}function Wh(e,t,r){return po(e,t,"",r)}function YU(e,t){return Ee(e)||jt(e.items,t)}function WU(e,t){return Ee(e)||jt(e.items,t)}function XU(e,t){return Ee(e)||jt(e.returns,t)||e.parameters.some(r=>jt(r,t))}function ZU(e,t){return Ee(e)||jt(e.returns,t)||e.parameters.some(r=>jt(r,t))}function QU(e,t){return Ee(e)||Ee(e.unevaluatedProperties)||e.allOf.some(r=>jt(r,t))}function JU(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Ee(e)||jt(n,[...r,...t])}function ej(e,t){return Ee(e)||jt(e.items,t)}function tj(e,t){return Ee(e)||jt(e.not,t)}function rj(e,t){return Ee(e)||Object.values(e.properties).some(r=>jt(r,t))||ut(e.additionalProperties)&&jt(e.additionalProperties,t)}function nj(e,t){return Ee(e)||jt(e.item,t)}function oj(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Ee(e)||jt(n,t)||ut(e.additionalProperties)&&Ee(e.additionalProperties)}function ij(e,t){return Ee(e)?!0:jt(De(e,t),t)}function aj(e,t){return Ee(e)?!0:jt(De(e,t),t)}function sj(e,t){return Ee(e)||!ot(e.items)&&e.items.some(r=>jt(r,t))}function cj(e,t){return Ee(e)||e.anyOf.some(r=>jt(r,t))}function jt(e,t){let r=tr(e,t),n=e;if(e.$id&&ew.has(e.$id))return!1;switch(e.$id&&ew.add(e.$id),e[$]){case"Array":return YU(n,r);case"AsyncIterator":return WU(n,r);case"Constructor":return XU(n,r);case"Function":return ZU(n,r);case"Import":return JU(n,r);case"Intersect":return QU(n,r);case"Iterator":return ej(n,r);case"Not":return tj(n,r);case"Object":return rj(n,r);case"Promise":return nj(n,r);case"Record":return oj(n,r);case"Ref":return ij(n,r);case"This":return aj(n,r);case"Tuple":return sj(n,r);case"Union":return cj(n,r);default:return Ee(e)}}var ew=new Set;function Is(e,t){return ew.clear(),jt(e,t)}function aO(...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 qh(t,n,Pa(t,r,n).First());return Is(t,r)?Hh(t,r,n):n}function $i(e,t){let r=fe(e,"default")?e.default:void 0,n=Vi(r)?r():Ne(r);return ot(t)?n:de(t)&&de(n)?Object.assign(n,t):t}function tw(e){return ji(e)&&"default"in e}function fj(e,t,r){if(ue(r)){for(let o=0;o{let a=Or(i,t,n);return de(a)?{...o,...a}:a},{})}function mj(e,t,r){let n=$i(e,r);if(!de(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=Or(e.properties[i],t,n[i]);ot(a)||(n[i]=Or(e.properties[i],t,n[i]))}if(!tw(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=Or(e.additionalProperties,t,n[i]));return n}function dj(e,t,r){let n=$i(e,r);if(!de(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)&&tw(a)&&(n[c]=Or(a,t,n[c]));if(!tw(o))return n;for(let c of Object.getOwnPropertyNames(n))s.test(c)||(n[c]=Or(o,t,n[c]));return n}function hj(e,t,r){return Or(De(e,t),t,$i(e,r))}function bj(e,t,r){return Or(De(e,t),t,r)}function yj(e,t,r){let n=$i(e,r);if(!ue(n)||ot(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;awj,Format:()=>Pl,Get:()=>Ij,Has:()=>Sj,Set:()=>xj,ValuePointerRootDeleteError:()=>Qh,ValuePointerRootSetError:()=>Zh});var Zh=class extends le{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},Qh=class extends le{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function sO(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;n_s(e[o],t[o]))}function vj(e,t){return Ir(t)&&e.getTime()===t.getTime()}function Pj(e,t){return!ue(t)||e.length!==t.length?!1:e.every((r,n)=>_s(r,t[n]))}function Tj(e,t){return!mn(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>_s(r,t[n]))}function Mj(e,t){return e===t}function _s(e,t){if(Ir(e))return vj(e,t);if(mn(e))return Tj(e,t);if(ue(e))return Pj(e,t);if(de(e))return _j(e,t);if(Xr(e))return Mj(e,t);throw new Error("ValueEquals: Unable to compare value")}var Cj=$e({type:Ce("insert"),path:_r(),value:Hn()}),Oj=$e({type:Ce("update"),path:_r(),value:Hn()}),kj=$e({type:Ce("delete"),path:_r()}),fO=Fe([Cj,Oj,kj]),Jh=class extends le{constructor(t,r){super(r),this.value=t}};function e0(e,t){return{type:"update",path:e,value:t}}function uO(e,t){return{type:"insert",path:e,value:t}}function lO(e){return{type:"delete",path:e}}function cO(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new Jh(e,"Cannot diff objects with symbols")}function*Rj(e,t,r){if(cO(t),cO(r),!M0(r))return yield e0(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)fe(t,i)||(yield uO(`${e}/${i}`,r[i]));for(let i of n)fe(r,i)&&(_s(t,r)||(yield*t0(`${e}/${i}`,t[i],r[i])));for(let i of n)fe(r,i)||(yield lO(`${e}/${i}`))}function*Nj(e,t,r){if(!ue(r))return yield e0(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function $j(e){return e.length===0}function mO(e,t){if(Fj(t))return Ne(t[0].value);if($j(t))return Ne(e);let r=Ne(e);for(let n of t)switch(n.type){case"insert":{mo.Set(r,n.path,n.value);break}case"update":{mo.Set(r,n.path,n.value);break}case"delete":{mo.Delete(r,n.path);break}}return r}function dO(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Is(t,r)?Wh(t,r,n):n;if(!xe(t,r,o))throw new Yh(t,o,Pa(t,r,o).First());return o}function r0(e){return de(e)&&!ue(e)}var n0=class extends le{constructor(t){super(t)}};function Dj(e,t,r,n){if(!r0(r))mo.Set(e,t,Ne(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)rw(e,`${t}/${a}`,r[a],n[a])}}function Lj(e,t,r,n){if(!ue(r))mo.Set(e,t,Ne(n));else{for(let o=0;o(jh(i,a,s),s)],["Cast",(i,a,s)=>Il(i,a,s)],["Clean",(i,a,s)=>zh(i,a,s)],["Clone",(i,a,s)=>Ne(s)],["Convert",(i,a,s)=>Kh(i,a,s)],["Decode",(i,a,s)=>Is(i,a)?Hh(i,a,s):s],["Default",(i,a,s)=>Xh(i,a,s)],["Encode",(i,a,s)=>Is(i,a)?Wh(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})(nw||(nw={}));var yO=["Clone","Clean","Default","Convert","Assert","Decode"];function Bj(e,t,r,n){return e.reduce((o,i)=>{let a=nw.Get(i);if(ot(a))throw new o0(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function gO(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?ue(e[0])?[e[0],e[1],[],e[2]]:[yO,e[0],e[1],e[2]]:e.length===2?[yO,e[0],[],e[1]]:(()=>{throw new o0("Invalid Arguments")})();return Bj(t,r,n,o)}var pf={};Ma(pf,{Assert:()=>jh,Cast:()=>Il,Check:()=>xe,Clean:()=>zh,Clone:()=>Ne,Convert:()=>Kh,Create:()=>co,Decode:()=>aO,Default:()=>Xh,Diff:()=>pO,Edit:()=>fO,Encode:()=>dO,Equal:()=>_s,Errors:()=>Pa,Hash:()=>lf,Mutate:()=>bO,Parse:()=>gO,Patch:()=>mO,ValueErrorIterator:()=>va});function i0(e){switch(e.type){case"summary_metrics":return K1(e);case"performance_table":return B1(e);case"prediction_distribution":return z1(e);case"roc":return E1(e);case"calibration":return F1(e);case"precision_recall":return D1(e);case"gains":return L1(e);case"lift":return V1(e);case"decision_curve":return U1(e);case"interventions_avoided":return j1(e)}}function Yo(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 ow(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 zj(e){if(!pf.Check(np,e))throw new Error("Invalid ReportSpec");ip(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(i0(r.spec)),n.append(o),t.append(n)}return t}function Gj(e,t){if(!pf.Check(op,e))throw new Error("Invalid ReportSpec");ip(e);let r=!!e.title,n=new Set,o=document.createElement("article");if(o.className="rtichoke-report",e.title){let m=document.createElement("header");m.className="rtichoke-report__header";let h=document.createElement("h1");h.className="rtichoke-report__title",h.textContent=e.title,m.append(h),o.append(m)}let i=[],a=0;for(let m of e.sections){let h=Yo(m.id,n);a++;let b=[];for(let y of m.items)if(y.type==="group"){let x=Yo(y.id,n);a++,b.push({rawId:y.id,title:y.title,domId:x})}i.push({rawId:m.id,title:m.title,domId:h,groups:b})}if(a>1){let m=document.createElement("nav");m.className="rtichoke-report__nav",m.setAttribute("aria-label","Report sections");let h=document.createElement("ul");h.className="rtichoke-report__nav-list";for(let b of i){let y=document.createElement("li");y.className="rtichoke-report__nav-item";let x=document.createElement("a");if(x.className="rtichoke-report__nav-link",x.href=`#${b.domId}`,x.textContent=b.title,y.append(x),b.groups.length>0){let g=document.createElement("ul");g.className="rtichoke-report__nav-sublist";for(let _ of b.groups){let w=document.createElement("li");w.className="rtichoke-report__nav-subitem";let I=document.createElement("a");I.className="rtichoke-report__nav-link",I.href=`#${_.domId}`,I.textContent=_.title,w.append(I),g.append(w)}y.append(g)}h.append(y)}m.append(h),o.append(m)}let s=r?"h2":"h1",c=r?"h3":"h2",u=r?"h3":"h2",f=r?"h4":"h3",p=(m,h)=>{let b=document.createElement("section");if(b.className="rtichoke-report__component",b.dataset.componentId=m.id,m.title){let x=Yo(`heading-${m.id}`,n),g=document.createElement(h);g.className="rtichoke-report__component-title",g.id=x,g.textContent=m.title,b.setAttribute("aria-labelledby",x),b.append(g)}let y=document.createElement("div");return y.className="rtichoke-report__component-content",y.append(i0(m.spec)),b.append(y),b},l=(m,h,b)=>{let y=document.createElement("section");y.className="rtichoke-report__group",y.id=h.domId,y.dataset.groupId=m.id;let x=Yo(`heading-${m.id}`,n),g=document.createElement(c);if(g.className="rtichoke-report__group-title",b&&g.classList.add("rtichoke-report__group-title--tab-panel"),g.id=x,g.textContent=m.title,y.setAttribute("aria-labelledby",b??x),y.append(g),t.groupPresentation==="tabs"){let _=document.createElement("div");_.className="rtichoke-report__tablist",_.setAttribute("role","tablist"),_.setAttribute("aria-labelledby",x);let w=[],I=[];m.components.forEach((S,v)=>{let M=Yo(`tab-${m.id}-${S.id}`,n),C=Yo(`panel-${m.id}-${S.id}`,n),R=document.createElement("button");R.className="rtichoke-report__tab",R.type="button",R.id=M,R.setAttribute("role","tab"),R.setAttribute("aria-controls",C),R.setAttribute("aria-selected",v===0?"true":"false"),R.tabIndex=v===0?0:-1,R.textContent=S.title||S.id;let O=document.createElement("section");O.className="rtichoke-report__component rtichoke-report__tabpanel",O.id=C,O.setAttribute("role","tabpanel"),O.setAttribute("aria-labelledby",M),O.tabIndex=0,O.dataset.componentId=S.id,O.hidden=v!==0;let N=document.createElement("div");N.className="rtichoke-report__component-content",N.append(i0(S.spec)),O.append(N),w.push(R),I.push(O),_.append(R)}),ow(w,I),y.append(_,...I)}else for(let _ of m.components)y.append(p(_,f));return y};for(let m=0;mM.type==="group"),w=t.sectionGroupPresentation==="tabs"&&_.length>1,I=0,S=!1,v=0;for(;v1){let N=document.createElement("div");N.className="rtichoke-report__tablist",N.setAttribute("role","tablist"),N.setAttribute("aria-labelledby",x);let z=[],j=[];R.forEach((k,B)=>{let V=Yo(`tab-${h.id}-${k.id}`,n),Q=Yo(`panel-${h.id}-${k.id}`,n),U=document.createElement("button");U.className="rtichoke-report__tab",U.type="button",U.id=V,U.setAttribute("role","tab"),U.setAttribute("aria-controls",Q),U.setAttribute("aria-selected",B===0?"true":"false"),U.tabIndex=B===0?0:-1,U.textContent=k.title||k.id;let K=document.createElement("section");K.className="rtichoke-report__component rtichoke-report__tabpanel",K.id=Q,K.setAttribute("role","tabpanel"),K.setAttribute("aria-labelledby",V),K.tabIndex=0,K.dataset.componentId=k.id,K.hidden=B!==0;let W=document.createElement("div");W.className="rtichoke-report__component-content",W.append(i0(k.spec)),K.append(W),z.push(U),j.push(K),N.append(U)}),ow(z,j),y.append(N,...j),v=C}else y.append(p(M,u)),v++}else if(M.type==="group"){if(w){if(!S){S=!0;let C=document.createElement("div");C.className="rtichoke-report__tablist rtichoke-report__section-group-tablist",C.setAttribute("role","tablist"),C.setAttribute("aria-labelledby",x);let R=[],O=[];_.forEach((N,z)=>{let j=b.groups[z],k=Yo(`section-group-tab-${h.id}-${N.id}`,n),B=document.createElement("button");B.className="rtichoke-report__tab",B.type="button",B.id=k,B.setAttribute("role","tab"),B.setAttribute("aria-controls",j.domId),B.setAttribute("aria-selected",z===0?"true":"false"),B.tabIndex=z===0?0:-1,B.textContent=N.title;let V=l(N,j,k);V.classList.add("rtichoke-report__tabpanel"),V.setAttribute("role","tabpanel"),V.setAttribute("aria-labelledby",k),V.tabIndex=0,V.hidden=z!==0,R.push(B),O.push(V),C.append(B)}),ow(R,O),y.append(C,...O)}}else y.append(l(M,b.groups[I++]));v++}}o.append(y)}return o}function Kj(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 zj(e);if(e.schemaVersion==="1.1")return Gj(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var qj=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function Hj(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[Ut(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(Ut([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),qo({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:qj},marks:r})}export{xb as AUROCSummaryMetricSchema,ib as CalibrationSpecSchema,DS as CalibrationV2DatumSchema,cb as CalibrationV2SpecSchema,VS as DecisionCurveV2DatumSchema,US as DecisionCurveV2EvaluationSchema,GS as DecisionCurveV2ReferenceSchema,jS as DecisionCurveV2SeriesSchema,fb as DecisionCurveV2SpecSchema,FS as DiscreteCalibrationV2DatumSchema,AS as DisplayGroupingSpecSchema,NS as DisplayRoleSchema,rn as EvaluationSpecSchema,ub as GainsV2SpecSchema,WS as InterventionsAvoidedTreatAllReferenceSchema,XS as InterventionsAvoidedTreatNoneReferenceSchema,qS as InterventionsAvoidedV2DatumSchema,HS as InterventionsAvoidedV2EvaluationSchema,ZS as InterventionsAvoidedV2ReferenceSchema,YS as InterventionsAvoidedV2SeriesSchema,lb as InterventionsAvoidedV2SpecSchema,pb as LiftV2SpecSchema,Ef as OperatingPointDimensionSchema,JS as OperatingPointSchema,ii as OperatingPointSpecSchema,eI as PerformanceEvaluationContextSchema,QS as PerformanceMetricDefinitionSchema,db as PerformanceMetricIdSchema,rp as PerformanceMetricValueSchema,tI as PerformanceTableRowSchema,hb as PerformanceTableSpecSchema,gb as PopulationSummaryOwnerSpecSchema,mb as PrecisionRecallV2SpecSchema,rI as PredictionDistributionBinSchema,nI as PredictionDistributionOperatingPointSchema,Ff as PredictionDistributionSpecSchema,wb as PrevalenceSummaryMetricSchema,er as RTICHOKE_BROWSER_THEME,BC as RTICHOKE_COLORS,ES as ReferenceLineV2SpecSchema,iI as ReportComponentSchema,_b as ReportComponentV1_1Schema,aI as ReportGroupSchema,sI as ReportSectionSchema,$R as ReportSpecSchema,np as ReportSpecV1_0Schema,op as ReportSpecV1_1Schema,ab as RocSpecSchema,bb as RocV2SpecSchema,wR as RtichokeChartSpecSchema,yb as RtichokeChartSpecV2Schema,Xs as SeriesSpecSchema,$S as SmoothCalibrationV2DatumSchema,Ib as StandaloneCanonicalSpecSchema,AR as SummaryMetricSchema,Sb as SummaryMetricsSpecSchema,zS as TreatAllReferenceSchema,BS as TreatNoneReferenceSchema,vb as assertPerformanceTableReferentialIntegrity,$f as assertPredictionDistributionReferentialIntegrity,ip as assertReportReferentialIntegrity,Pb as assertSummaryMetricsReferentialIntegrity,ai as assertV2ReferentialIntegrity,VR as calibrationSpecFromRtichokeRows,zR as calibrationV2SpecFromRtichokeRows,zC as extractOperatingPointValues,qC as preparePredictionDistributionPlotData,A$ as renderCalibration,F1 as renderCalibrationV2,U1 as renderDecisionCurveV2,L1 as renderGainsV2,j1 as renderInterventionsAvoidedV2,V1 as renderLiftV2,B1 as renderPerformanceTable,D1 as renderPrecisionRecallV2,z1 as renderPredictionDistribution,Kj as renderReport,Hj as renderRoc,E1 as renderRocV2,K1 as renderSummaryMetrics,Ss as renderWithOperatingPointSelection,Fn as resolveV2RenderOptions,LR as rocSpecFromRtichokePython,DR as rocSpecFromRtichokeR,BR as rocV2SpecFromRtichokePython,jR as rocV2SpecFromRtichokeR}; +}`)).call(nf,r);for(let U of u){let{channels:z,values:Y,facets:X}=b.get(U);if(h===void 0||U.facet==="super"){let q=null;if(X&&(q=X[0],q=U.filter(q,z,Y),q.length===0))continue;let ae=U.render(q,g,Y,v,I);if(ae==null)continue;P.appendChild(ae)}else{let q;for(let ae of h){if(!(U.facetAnchor?.(h,N,ae)??!ae.empty))continue;let J=null;if(X){let Q=p.has(U);if(J=X[Q?ae.i:0],J=U.filter(J,z,Y),J.length===0)continue;!Q&&J===X[0]&&(J=RT(J)),J.fx=ae.x,J.fy=ae.y,J.fi=ae.i}let oe=U.render(J,g,Y,_,I);if(oe!=null){(q??=kr(P).append("g")).append(()=>oe).datum(ae);for(let Q of["aria-label","aria-description","aria-hidden","transform"])oe.hasAttribute(Q)&&(q.attr(Q,oe.getAttribute(Q)),oe.removeAttribute(Q))}}q?.selectChildren().each(B)}}let G=_6(y,I,e),{figure:j=n!=null||o!=null||i!=null||G.length>0}=e;j&&(R=T.createElement("figure"),R.className=`${c}-figure`,R.style.maxWidth="initial",n!=null&&R.append(V6(T,n,"h2")),o!=null&&R.append(V6(T,o,"h3")),R.append(...G,P),i!=null&&R.append(b$(T,i)),"value"in P&&(R.value=P.value,delete P.value)),R.scale=ZM(g.scales),R.legend=S6(y,I,e);let H=CM();return H>0&&kr(P).append("text").attr("x",V).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${H.toLocaleString("en-US")} warning${H===1?"":"s"}. Please check the console.`),R}function V6(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function b$(e,t){let r=e.createElement("figcaption");return r.append(t),r}function j6(e){return e.flat(1/0).filter(t=>t!=null).map(x$)}function x$(e){return typeof e.render=="function"?e:new $1(e)}var $1=class extends mt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function D1(e,t){for(let r in e)z6(e[r],t);return e}function z6(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:Cx(a,o)}=t[r]??{};s!=null&&(e.value=tt(e.value,s),e.transform=!1)}function w$(e){for(let t in e)Dx(t,e[t])}function _l(e,t,r,n=_T){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(!cC(r)){let c=r.x?.domain===void 0,u=r.y?.domain===void 0;if(c||u){let[f,p]=uC(a);c&&F1(e,"x",f),u&&F1(e,"y",p)}}}else F1(e,s,a)}return e}function F1(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function S$(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=Ci(e.data);if(o==null)throw new Error("missing facet data");let i={};r!=null&&(i.fx=Wc(o,{value:r,scale:"fx"})),n!=null&&(i.fy=Wc(o,{value:n,scale:"fy"})),D1(i,t);let a=yh(o,i);return{channels:i,groups:a,data:e.data}}function U6(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let c=Ci(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=Wc(c,{value:n,scale:"fx"})),o!=null&&(u.fy=Wc(c,{value:o,scale:"fy"})),D1(u,r),{channels:u,groups:yh(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)&&ga(Ci(e.data))===ga(s)&&qr(`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 v$(e,t={}){return ki({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function I$(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)?vC:/^y$/i.test(o)?s1:SC,n=o(v$(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===s1?"left":"bottom");let a=L6(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function _$(e,t,r){let{projection:n,x:o={},y:i={},fx:a={},fy:s={},axis:c,grid:u,facet:f={},facet:{axis:p=c,grid:l}=f,x:{axis:m=c,grid:h=m===null?null:u}=o,y:{axis:b=c,grid:y=b===null?null:u}=i,fx:{axis:x=p,grid:g=x===null?null:l}=a,fy:{axis:S=p,grid:w=S===null?null:l}=s}=r;(n||!zc(o)&&!G6("x",e))&&(m=h=null),(n||!zc(i)&&!G6("y",e))&&(b=y=null),t.has("fx")||(x=g=null),t.has("fy")||(S=w=null),m===void 0&&(m=!Vh(e,"x")),b===void 0&&(b=!Vh(e,"y")),x===void 0&&(x=!Vh(e,"fx")),S===void 0&&(S=!Vh(e,"fy")),m===!0&&(m="bottom"),b===!0&&(b="left"),x===!0&&(x=m==="top"||m===null?"bottom":"top"),S===!0&&(S=b==="right"||b===null?"left":"right");let _=[];return Lh(_,w,i6,s),Dh(_,S,e6,"right","left",f,s),Lh(_,g,s6,a),Dh(_,x,t6,"top","bottom",f,a),Lh(_,y,o6,i),Dh(_,b,P1,"left","right",r,i),Lh(_,h,a6,o),Dh(_,m,T1,"bottom","top",r,o),_}function Dh(e,t,r,n,o,i,a){if(!t)return;let s=P$(t);a=T$(s?n:t,i,a);let{line:c}=a;(r===P1||r===T1)&&c&&!bs(c)&&e.push(N1(M$(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function Lh(e,t,r,n){!t||bs(t)||e.push(r(C$(t,n)))}function P$(e){return/^\s*both\s*$/i.test(e)}function T$(e,t,{line:r=t.line,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:p,label:l=t.label,labelAnchor:m,labelArrow:h=t.labelArrow,labelOffset:b}){return{anchor:e,line:r,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:u,ariaLabel:f,ariaDescription:p,label:l,labelAnchor:m,labelArrow:h,labelOffset:b}}function M$(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function C$(e,{stroke:t=qc(e)?e:void 0,ticks:r=O$(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function O$(e){switch(typeof e){case"number":return!0;case"string":return!qc(e)}return $n(e)||typeof e?.range=="function"}function Vh(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function G6(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 k$(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 R$({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=hh(r),u=e&&B6(e),f=t&&B6(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 B6(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 nw.selectAll().data(t).enter().append(g?"circle":"path").call(er,this).call(g?_=>{_.attr("cx",c?v=>c[v]:y).attr("cy",u?v=>u[v]:x).attr("r",f?v=>f[v]:m)}:_=>{_.attr("transform",of`translate(${c?v=>c[v]:y},${u?v=>u[v]:x})${p?v=>` rotate(${p[v]})`:h?` rotate(${h})`:""}`).attr("d",f&&l?v=>{let I=no();return l[v].draw(I,f[v]*f[v]*Math.PI),I}:f?v=>{let I=no();return b.draw(I,f[v]*f[v]*Math.PI),I}:l?v=>{let I=no();return l[v].draw(I,S),I}:(()=>{let v=no();return b.draw(v,S),v})())}).call(Hr,this,n)).node()}};function _s(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=Oi(t,r)),new jh(e,{...n,x:t,y:r})}var $$={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Uh=class extends mt{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:ih(r),optional:!0}},r,$$),this.z=i,this.curve=K6(a,s),Sl(this,r)}filter(t){return t}project(t,r,n){this.curve!==Pl&&super.project(t,r,n)}render(t,r,n,o,i){let{x:a,y:s}=n,{curve:c}=this;return Ke("svg:g",i).call(pr,this,o,i).call(mr,this,r).call(u=>u.selectAll().data(gC(t,[a,s],this,n)).enter().append("path").call(er,this).call(hC,this,n).call(TC,this,n,i).attr("d",c===Pl&&i.projection?D$(i.path(),a,s):Vb().curve(c).defined(f=>f>=0).x(f=>a[f]).y(f=>s[f]))).node()}};function D$(e,t,r){return t=ys(t),r=ys(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 jt(e,{x:t,y:r,...n}={}){return[t,r]=Oi(t,r),new Uh(e,{...n,x:t,y:r})}mt.prototype.plot=function({marks:e=[],...t}={}){return qo({...t,marks:[...e,this]})};var L$=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],q6={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function V$(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 j$(e){let r=[...new Set(e.data.map(m=>m.model))].length>1,n=r?L$:["#000000"],o=e.data.map(m=>({...m,tooltip:V$(m,r)})),i=[];e.references?.some(m=>m.type==="identity")&&i.push(jt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(jt(o,{x:"predicted",y:"observed",stroke:"model",strokeWidth:2,title:"tooltip",tip:!0}));let a=o.filter(m=>m.method==="discrete");a.length>0&&i.push(_s(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=qo({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:q6,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(m=>({...m,tooltip:`${r?`${m.model} +`:""}${m.count} observations in [${(m.midpoint-m.binWidth/2).toFixed(3)}, ${(m.midpoint+m.binWidth/2).toFixed(3)}]`})),f=new Set(e.distribution.map(m=>m.model)).size,p=qo({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:q6,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:[Fi(u,{x1:m=>m.midpoint-m.binWidth/2,x2:m=>m.midpoint+m.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,p),l}var U$=0,Y6=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],_r={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:Y6,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 G$(e){let t=e.theme??{};return{..._r,width:e.width??_r.width,height:e.height??_r.height,background:t.background??_r.background,colors:e.colors??_r.colors,margins:{..._r.margins,...t.margins},frame:{..._r.frame,...t.frame},typography:{..._r.typography,...t.typography},axis:{..._r.axis,...t.axis},line:{..._r.line,...t.line},marker:{..._r.marker,...t.marker},reference:{..._r.reference,...t.reference},legend:{..._r.legend,...t.legend},tip:{..._r.tip,...t.tip},predictionDistribution:{..._r.predictionDistribution,...t.predictionDistribution}}}function Ln(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,c)=>`group-${c+1}`):[...e]),n=G$(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 W6(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 B$(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 lf(e,t,r,n,o){let i=Tl(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=Ln(i,s),{theme:u,colorByGroup:f}=c,p=new Map(e.series.map(g=>[g.display.group,g.display.label])),l=new Set(i),m=document.createElement("div");m.className="rtichoke-legend-chart",m.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 b=new Map;i.forEach(g=>{let S=document.createElement("button");S.type="button",S.className="rtichoke-legend-item",S.setAttribute("aria-pressed","true");let w=p.get(g)??g;S.setAttribute("aria-label",`Toggle series ${w}`);let _=document.createElement("span");_.className="rtichoke-legend-swatch";let v=document.createElement("span");v.className="rtichoke-legend-line",v.style.backgroundColor=f.get(g)??"#000000",_.append(v);let I=document.createElement("span");I.className="rtichoke-legend-label",I.textContent=w,S.append(_,I),h.append(S),b.set(g,S)});let y=document.createElement("div");y.className="rtichoke-legend-content";let x=()=>{let g=B$(e,l),S=r(g,s,a,w=>{a=w,o&&o(w)});y.replaceChildren(S)};return i.forEach(g=>{let S=b.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");x()})}),m.append(h,y),x(),m}function Ts(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=W6(e);if(i.length===0)return r(e,void 0);let a=Ln(Tl(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)",p=e.operatingPoint.dimension==="probability_threshold"?"Probability threshold":"PPCR",l=`rtichoke-v2-slider-${++U$}`,m=document.createElement("label");m.className="rtichoke-operating-point-label",m.htmlFor=l;let h=document.createElement("span");h.textContent=`${p}: `;let b=document.createElement("span");b.className="rtichoke-operating-point-value";let y=document.createElement("input");y.type="range",y.id=l,y.className="rtichoke-operating-point-slider",y.min="0",y.max=String(i.length-1),y.step="1",y.setAttribute("aria-label",f);let x=0;if(n!==void 0){let v=i.indexOf(n);v!==-1&&(x=v)}let g=i[x];y.value=String(x);let S=g.toFixed(s.tip.digits);b.textContent=S,y.setAttribute("aria-valuetext",S),o&&o(g),m.append(h,b),u.append(m,y);let w=document.createElement("div");w.className="rtichoke-operating-point-content";let _=v=>{w.replaceChildren(r(e,v))};return y.addEventListener("input",()=>{let v=Number(y.value),I=i[v],T=I.toFixed(s.tip.digits);b.textContent=T,y.setAttribute("aria-valuetext",T),o&&o(I),_(I)}),c.append(w,u),_(g),c}function z$(e){return new Map(e.series.map(t=>[t.id,t.display]))}function Tl(e){return[...new Set(e.series.map(t=>t.display.group))]}function Gh(e,t){let r=z$(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}var K$={true_positives:"TP",true_negatives:"TN",false_positives:"FP",false_negatives:"FN",sensitivity:"Sensitivity",specificity:"Specificity",false_positive_rate:"FPR",ppv:"PPV",npv:"NPV",lift:"Lift",predicted_positives:"Predicted Positives",ppcr:"PPCR",net_benefit:"Net Benefit",net_benefit_interventions_avoided:"Interventions Avoided"},q$=new Set(["true_positives","true_negatives","false_positives","false_negatives","predicted_positives"]);function H$(e,t,r){if(t!=null)return q$.has(e)&&Number.isInteger(t)?String(t):t.toFixed(r)}function Pa(e,t,r,n){if(!e||e.length===0)return[];let o=new Map;for(let a of e)a.estimate!==void 0&&a.estimate!==null&&o.set(a.metricId,a.estimate);let i=[];for(let a of t)if(!(n&&n.has(a))&&o.has(a)){let s=o.get(a),c=K$[a]??a,u=H$(a,s,r);u!==void 0&&i.push([c,u])}return i}function je(e,t){if(e!=null)return typeof e=="number"?e.toFixed(t):String(e)}function Ut(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` +`)}function Bh(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 _a(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 V1(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(jt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",...r})):o.type==="horizontal"&&o.value!==void 0?n.push(co([o.value],{...r})):o.type==="path"&&o.points&&n.push(jt(o.points,{x:"x",y:"y",...r}));return n}function zh(e,t){return e}function Y$(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 _s(i,{ariaLabel:"ordinary-point",x:t,y:r,fill:"group",stroke:c,strokeWidth:u,r:s})}function mf(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??6;return _s(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:c,r:u})}function W$(e,t,r){let n=e/255,o=t/255,i=r/255,a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),s=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4);return .2126*a+.7152*s+.0722*c}function X$(e){let t=sn(e);if(!t)return"#ffffff";let r=t.rgb(),n=W$(r.r,r.g,r.b),o=(1+.05)/(n+.05);return(n+.05)/(0+.05)>=o?"#000000":"#ffffff"}function Ms(e,t){let r=typeof SVGSVGElement<"u"&&e instanceof SVGSVGElement?e:e.querySelector("svg[class^='plot-']")??e.querySelector("svg");if(!r)return;let n=kr(r),o=e.scale?.("x")??r.scale?.("x"),i=e.scale?.("y")??r.scale?.("y");if(!o||!i)return;let a=t.items.filter(y=>Number.isFinite(y.xValue)&&Number.isFinite(y.yValue)).map(y=>({...y,px:o.apply(y.xValue),py:i.apply(y.yValue)})),s=(t.selectedOperatingPointItems??[]).filter(y=>Number.isFinite(y.xValue)&&Number.isFinite(y.yValue)).map(y=>({...y,px:o.apply(y.xValue),py:i.apply(y.yValue)})),c=n.select("g.rtichoke-hover-tooltip");c.empty()&&(c=n.append("g").attr("class","rtichoke-hover-tooltip").style("pointer-events","none").style("display","none"),c.append("path").attr("class","rtichoke-hover-tooltip-arrow"),c.append("rect").attr("class","rtichoke-hover-tooltip-bg"),c.append("text").attr("class","rtichoke-hover-tooltip-text"));let u=c.select("path.rtichoke-hover-tooltip-arrow"),f=c.select("rect.rtichoke-hover-tooltip-bg"),p=c.select("text.rtichoke-hover-tooltip-text");function l(y,x,g,S=!1){let w=x.filter(([,J])=>J!=null);if(w.length===0)return;let _=S||x.length===1&&x[0][0]==="Reference",v=t.tooltipStyle==="light",I=t.tooltipStyle==="plotly",T=v?"#ffffff":_&&!I?"#f3f4f6":g,P=v?"#1f2937":I?_?t.theme.frame.color:"#ffffff":_?"#1f2937":X$(g),R=v?"#d1d5db":I?_?t.theme.frame.color:"#ffffff":_?"#d1d5db":"#374151";p.attr("fill",P).attr("font-family",t.theme.typography.fontFamily).attr("font-size",I?"13px":"11px").attr("transform",null),p.selectAll("tspan").remove(),w.forEach(([J,oe],Q)=>{let fe=p.append("tspan").attr("x","0").attr("dy",Q===0?"1em":I?"1.3em":"1.2em"),O=J!==""&&J!==null&&J!==void 0,L=oe!==""&&oe!==null&&oe!==void 0;O&&L?(fe.append("tspan").attr("font-weight","bold").text(`${J}: `),fe.append("tspan").attr("font-weight","normal").text(String(oe))):O?fe.append("tspan").attr("font-weight","bold").text(String(J)):L&&fe.append("tspan").attr("font-weight","normal").text(String(oe))});let k=p.node();if(!k)return;let N=k.getBBox(),B=8,V=6,C=Math.max(N.width+B*2,60),G=N.height+V*2,[j,H]=ea(y,r),U=r?.viewBox?.baseVal,z=U&&U.width>0?U.width:r?.width?.baseVal?.value||t.theme.width,Y=U&&U.height>0?U.height:r?.height?.baseVal?.value||t.theme.height,X=t.theme.margins,q=j+12;q+C>z-X.right&&(q=j-12-C),qY-X.bottom&&(ae=Y-X.bottom-G),I){let J=q>j?q:q+C;u.attr("d",`M${j},${H} L${J},${H-6} L${J},${H+6} Z`).attr("fill",T).attr("stroke",R).attr("stroke-width",1)}else u.attr("d",null);f.attr("x",q).attr("y",ae).attr("width",C).attr("height",G).attr("fill",T).attr("stroke",R).attr("stroke-width",1).attr("rx",I?0:4).attr("ry",I?0:4).style("filter",I?"none":"drop-shadow(0 2px 4px rgba(0,0,0,0.15))"),p.attr("transform",`translate(${q+B-N.x}, ${ae+V-N.y})`),c.style("display",null)}function m(){c.style("display","none")}let h=n.select("g.rtichoke-hover-targets");h.empty()||h.remove(),h=n.insert("g","g.rtichoke-hover-tooltip").attr("class","rtichoke-hover-targets");for(let y of t.references??[]){let x=y.backgroundColor??"#f3f4f6",g=[["Reference",y.label]];if(y.type==="identity"){let S=y.points&&y.points.length>=2?y.points:[{x:0,y:0},{x:1,y:1}],w=S[0].x,_=S[S.length-1].x,v=S.map((I,T)=>`${T===0?"M":"L"}${o.apply(I.x)},${i.apply(I.y)}`).join(" ");h.append("path").attr("class","rtichoke-hover-ref-target").attr("d",v).attr("fill","none").attr("stroke","transparent").attr("stroke-width",12).style("pointer-events","stroke").on("pointermove",I=>{if(t.tooltipStyle==="light"||t.tooltipStyle==="plotly"){let[T]=ea(I,r),P=Array.isArray(o.range)?o.range[0]:typeof o.range=="function"?o.range()[0]:t.theme.margins.left,R=Array.isArray(o.range)?o.range[o.range.length-1]:typeof o.range=="function"?o.range()[o.range().length-1]:t.theme.width-t.theme.margins.right,k=t.xDomain?t.xDomain[0]:0,N=t.xDomain?t.xDomain[1]:1,B;if(typeof o.invert=="function")B=o.invert(T);else{let j=R!==P?(T-P)/(R-P):0;B=k+j*(N-k)}let V=Math.max(w,Math.min(_,B)),C=Ps(V),G=[[y.label,""],["Predicted",C],["Observed",C]];l(I,G,x,!0)}else l(I,g,x,!0)}).on("mouseleave pointerleave",m)}else if(y.type==="horizontal"&&y.value!==void 0){let S=i.apply(y.value);h.append("line").attr("class","rtichoke-hover-ref-target").attr("x1",t.theme.margins.left).attr("x2",t.theme.width-t.theme.margins.right).attr("y1",S).attr("y2",S).attr("stroke","transparent").attr("stroke-width",12).style("pointer-events","stroke").on("pointermove",w=>l(w,g,x,!0)).on("mouseleave pointerleave",m)}else if(y.type==="path"&&y.points&&y.points.length>0){let S=y.points.map((w,_)=>`${_===0?"M":"L"}${o.apply(w.x)},${i.apply(w.y)}`).join(" ");h.append("path").attr("class","rtichoke-hover-ref-target").attr("d",S).attr("fill","none").attr("stroke","transparent").attr("stroke-width",12).style("pointer-events","stroke").on("pointermove",w=>l(w,g,x,!0)).on("mouseleave pointerleave",m)}}let b=new Map;for(let y of a){let x=b.get(y.seriesId);x||(x=[],b.set(y.seriesId,x)),x.push(y)}for(let y of b.values()){if(y.length<2)continue;let x=y.map((g,S)=>`${S===0?"M":"L"}${g.px},${g.py}`).join(" ");h.append("path").attr("class","rtichoke-hover-line-target").attr("d",x).attr("fill","none").attr("stroke","transparent").attr("stroke-width",12).style("pointer-events","stroke").on("pointermove",g=>{let[S,w]=ea(g,r),_=1/0,v=y[0];for(let I of y){let T=I.px-S,P=I.py-w,R=T*T+P*P;R<_&&(_=R,v=I)}l(g,v.tooltipFields,v.backgroundColor)}).on("mouseleave pointerleave",m)}for(let y of a)h.append("circle").attr("class","rtichoke-hover-point-target").attr("cx",y.px).attr("cy",y.py).attr("r",8).attr("fill","transparent").style("pointer-events","all").on("pointermove",x=>l(x,y.tooltipFields,y.backgroundColor)).on("mouseleave pointerleave",m);for(let y of s)h.append("circle").attr("class","rtichoke-hover-op-target").attr("cx",y.px).attr("cy",y.py).attr("r",10).attr("fill","transparent").style("pointer-events","all").on("pointermove",x=>l(x,y.tooltipFields,y.backgroundColor)).on("mouseleave pointerleave",m);n.on("mouseleave pointerleave",m)}var Z$=100;function Ps(e){if(!Number.isFinite(e))return String(e);let t=Math.round(e*1e3)/1e3;return String(t)}function H6(e,t){let r=e.filter(Number.isFinite);if(r.length===0)return[...t];let n=Math.min(...r),o=Math.max(...r),i=Math.abs(t[1]-t[0]),s=(o-n||i||1)*.05;return[n-s,o+s]}function Q$(e,t){let r=e.data.map(o=>o.predicted),n=e.data.map(o=>o.observed);for(let o of e.distribution??[])r.push(o.midpoint-o.binWidth/2),r.push(o.midpoint+o.binWidth/2);for(let o of e.references??[])if(o.type==="identity")r.push(0,1),n.push(0,1);else if(o.type==="horizontal"&&o.value!==void 0)n.push(o.value);else if(o.type==="path")for(let i of o.points??[])r.push(i.x),n.push(i.y);return{x:H6(r,t.x),y:H6(n,t.y)}}function L1(e,t,r=[0,1],n=[0,1],o){let i=e-t.left-t.right,a=Math.abs(r[1]-r[0]),s=Math.abs(n[1]-n[0]),c=Number.isFinite(a)&&a>0?a:1,u=Number.isFinite(s)&&s>0?s:1,f=i*(u/c),p=o??t.bottom;return Math.round(t.top+f+p)}function Ho(e,t){let r=qo(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}var J$=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],eD=["sensitivity","ppv","specificity","false_positive_rate","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],tD=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],rD=["lift","sensitivity","specificity","false_positive_rate","ppv","npv","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function nD(e,t={},r){si(e);let n=Ln(Tl(e),t),{theme:o,colorByGroup:i}=n,a=e.operatingPoint?.dimension,s=Gh(e,e.data).map(x=>{let g=1-x.specificity,S=[["Series",x.label]];return a==="ppcr"?(x.ppcr!==void 0&&S.push(["PPCR",je(x.ppcr,o.tip.digits)]),S.push(["Cutoff",je(x.cutoff,o.tip.digits)])):(S.push(["Cutoff",je(x.cutoff,o.tip.digits)]),x.ppcr!==void 0&&S.push(["PPCR",je(x.ppcr,o.tip.digits)])),x.performance&&x.performance.length>0?S.push(["Sensitivity",je(x.sensitivity,o.tip.digits)],["Specificity",je(x.specificity,o.tip.digits)],["FPR",je(g,o.tip.digits)],...Pa(x.performance,J$,o.tip.digits,new Set(["sensitivity","specificity","false_positive_rate"]))):S.push(["Sensitivity",je(x.sensitivity,o.tip.digits)],["Specificity",je(x.specificity,o.tip.digits)],["False Positive Rate",je(g,o.tip.digits)]),{...x,false_positive_rate:g,tooltipFields:S,title:Ut(o.tip.digits,S)}}),c=V1(e,o);c.push(jt(s,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0}),pf(s,"false_positive_rate","sensitivity",n,t.theme));let u=[];if(r!==void 0&&e.operatingPoint){let x=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr";u=s.filter(g=>g[x]===r),u.length>0&&c.push(mf(u,"false_positive_rate","sensitivity",n,t.theme))}let f=e.xAxis.domain??[0,1],p=e.yAxis.domain??[0,1],l=L1(o.width,o.margins,f,p),m=Ho({...Bh(n,e),height:l,x:_a(o,e.xAxis.label,f),y:_a(o,e.yAxis.label,p),marks:zh(c,o)},o),h=s.map(x=>({seriesId:x.seriesId,group:x.group,xValue:x.false_positive_rate,yValue:x.sensitivity,tooltipFields:x.tooltipFields,backgroundColor:i.get(x.group)??"#1b9e77"})),b=u.map(x=>({seriesId:x.seriesId,group:x.group,xValue:x.false_positive_rate,yValue:x.sensitivity,tooltipFields:x.tooltipFields,backgroundColor:i.get(x.group)??"#1b9e77"})),y=[];for(let x of e.references??[]){let g=x.label??(x.type==="identity"?"Identity":"Reference");x.type==="identity"?y.push({type:"identity",points:[{x:0,y:0},{x:1,y:1}],label:g}):x.type==="horizontal"&&x.value!==void 0?y.push({type:"horizontal",value:x.value,label:g}):x.type==="path"&&x.points&&y.push({type:"path",points:x.points,label:g})}return Ms(m,{items:h,selectedOperatingPointItems:b,references:y,theme:o}),m}function j1(e,t={}){return lf(e,t,(r,n,o,i)=>df(r,(a,s,c)=>Ts(a,n,(u,f)=>nD(u,n,f),s,c),o,i))}function oD(e,t,r){let n=typeof SVGSVGElement<"u"&&e instanceof SVGSVGElement?e:e.querySelector("svg[class^='plot-']")??e.querySelector("svg");if(!n)return;let o=kr(n),i=e.scale?.("x")??n.scale?.("x");if(!i)return;let a=o.select("g.rtichoke-hover-tooltip");a.empty()&&(a=o.append("g").attr("class","rtichoke-hover-tooltip").style("pointer-events","none").style("display","none"),a.append("path").attr("class","rtichoke-hover-tooltip-arrow"),a.append("rect").attr("class","rtichoke-hover-tooltip-bg"),a.append("text").attr("class","rtichoke-hover-tooltip-text"));let s=a.select("path.rtichoke-hover-tooltip-arrow"),c=a.select("rect.rtichoke-hover-tooltip-bg"),u=a.select("text.rtichoke-hover-tooltip-text");function f(b,y,x){let g=y.filter(([,H])=>H!=null);if(g.length===0)return;u.attr("fill","#ffffff").attr("font-family",r.theme.typography.fontFamily).attr("font-size","13px").attr("transform",null),u.selectAll("tspan").remove(),g.forEach(([H,U],z)=>{let Y=u.append("tspan").attr("x","0").attr("dy",z===0?"1em":"1.2em"),X=H!==""&&H!==null&&H!==void 0,q=U!==""&&U!==null&&U!==void 0;X&&q?(Y.append("tspan").attr("font-weight","bold").text(`${H}: `),Y.append("tspan").attr("font-weight","normal").text(String(U))):X?Y.append("tspan").attr("font-weight","bold").text(String(H)):q&&Y.append("tspan").attr("font-weight","normal").text(String(U))});let S=u.node();if(!S)return;let w=S.getBBox(),_=8,v=6,I=Math.max(w.width+_*2,60),T=w.height+v*2,[P,R]=ea(b,n),k=n?.viewBox?.baseVal,N=k&&k.width>0?k.width:n?.width?.baseVal?.value||r.theme.width,B=k&&k.height>0?k.height:n?.height?.baseVal?.value||r.theme.height,V=r.theme.margins,C=P+12;C+I>N-V.right&&(C=P-12-I),CB-V.bottom&&(G=B-V.bottom-T);let j=C>P?C:C+I;s.attr("d",`M${P},${R} L${j},${R-6} L${j},${R+6} Z`).attr("fill",x).attr("stroke","#ffffff").attr("stroke-width",1),c.attr("x",C).attr("y",G).attr("width",I).attr("height",T).attr("fill",x).attr("stroke","#ffffff").attr("stroke-width",1).attr("rx",0).attr("ry",0).style("filter",null),u.attr("transform",`translate(${C+_-w.x}, ${G+v-w.y})`),a.style("display",null)}function p(){a.style("display","none")}let l=o.select("g.rtichoke-hover-targets");l.empty()||l.remove(),l=o.insert("g","g.rtichoke-hover-tooltip").attr("class","rtichoke-hover-targets");let m=e.scale?.("y")??n.scale?.("y"),h=[...t].sort((b,y)=>y.count-b.count);for(let b of h){if(b.count<=0)continue;let y=b.midpoint-b.binWidth/2,x=b.midpoint+b.binWidth/2,g=Math.abs(y)<1e-9?0:y,S=Math.abs(x)<1e-9?0:x,w=Ps(g),_=Ps(S),v=g<=0?`[0,${_}]`:`( ${w} , ${_} ]`,I=`${b.count} observations in ${v}`,T=[];r.groupCount>1&&T.push([b.label,""]),T.push(["",I]);let P=i.apply(y),R=i.apply(x),k=Math.min(P,R),N=Math.max(Math.abs(R-P),2),B=0,V=r.height??r.theme.height;if(m){let C=m.apply(0),G=m.apply(b.count);B=Math.min(C,G),V=Math.max(Math.abs(C-G),4)}l.append("rect").attr("class","rtichoke-hover-hist-target").attr("x",k).attr("width",N).attr("y",B).attr("height",V).attr("fill","transparent").style("pointer-events","all").on("pointermove",C=>f(C,T,r.colorByGroup.get(b.group)??"#1b9e77")).on("mouseleave pointerleave",p)}o.on("mouseleave pointerleave",p)}function iD(e,t,r,n){si(e);let o=Ln(Tl(e),t),{theme:i,colorByGroup:a}=o,s=Gh(e,e.data).map(P=>{let R=[];o.groups.length>1&&R.push([P.label,""]);let k=Ps(P.predicted),N=Ps(P.observed);if(P.method==="discrete"&&P.events!==void 0&&P.total!==void 0){let B=Number.isInteger(P.events)?String(P.events):Ps(P.events),V=Number.isInteger(P.total)?String(P.total):Ps(P.total);N+=` ( ${B} / ${V} )`}return R.push(["Predicted",k]),R.push(["Observed",N]),{...P,tooltipFields:R}}),c=V1(e,i);c.push(jt(s,{x:"predicted",y:"observed",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}));let u=s.filter(P=>P.method==="discrete");u.length>0&&c.push(_s(u,{x:"predicted",y:"observed",fill:i.marker.fill??"group",stroke:i.marker.stroke,strokeWidth:i.marker.strokeWidth,r:i.marker.radius}));let f=(e.distribution?.length??0)>0,p=n.y,l=n.x,m,h=Z$,b=i,y=f?8:i.margins.bottom,x=i.margins.bottom;if(r){x=40;let N=19.4;h=Math.round(87.3+x);let V=378.3;y=Math.round(N);let C=550,G=Math.max(50,C-40),j=Math.max(50,V),H=Math.abs(l[1]-l[0])||1,U=Math.abs(p[1]-p[0])||1,z=Math.min(G/H,j/U),Y=H*z,X=U*z,q=Math.max(10,(C-Y)/2),ae=Math.max(10,C-Y-q),J=Math.max(0,V-X),oe=25+J/2;y=Math.round(N)+J/2,m=550-h,b={...i,width:C,margins:{top:oe,left:q,right:ae,bottom:y}}}else f?(y=8,m=L1(i.width,i.margins,l,p,y)):m=L1(i.width,i.margins,l,p,i.margins.bottom);let g={...o,theme:b},S=Ho({...Bh(g,e),height:m,marginBottom:y,x:f?{..._a(b,e.xAxis.label,l),axis:null,label:null}:_a(b,e.xAxis.label,l),y:_a(b,e.yAxis.label,p),marks:zh(c,b)},b);S.style.cursor="crosshair";let w=s.map(P=>({seriesId:P.seriesId,group:P.group,xValue:P.predicted,yValue:P.observed,tooltipFields:P.tooltipFields,backgroundColor:a.get(P.group)??"#1b9e77"})),_=[];for(let P of e.references??[]){let R=P.label&&P.label!=="Identity"?P.label:P.type==="identity"?"Perfectly Calibrated":"Reference";if(P.type==="identity"){let k=Math.max(0,Math.min(l[0],l[1]),Math.min(p[0],p[1])),N=Math.min(1,Math.max(l[0],l[1]),Math.max(p[0],p[1]));k<=N&&_.push({type:"identity",points:[{x:k,y:k},{x:N,y:N}],label:R,backgroundColor:b.reference.color})}else P.type==="horizontal"&&P.value!==void 0?_.push({type:"horizontal",value:P.value,label:R,backgroundColor:b.reference.color}):P.type==="path"&&P.points&&_.push({type:"path",points:P.points,label:R,backgroundColor:b.reference.color})}if(Ms(S,{items:w,references:_,theme:b,tooltipStyle:"plotly",xDomain:l,yDomain:p}),!f||!e.distribution)return S;let v=Gh(e,e.distribution),I=Ho({...Bh(g,e),height:h,marginTop:0,marginBottom:x,x:_a(b,e.xAxis.label,l),y:{label:null,grid:!1,ticks:3,tickSize:b.axis.tickSize,tickPadding:b.axis.tickPadding},color:{legend:!1,domain:o.groups,range:o.colors},marks:zh([Fi(v,{x1:P=>P.midpoint-P.binWidth/2,x2:P=>P.midpoint+P.binWidth/2,y:"count",fill:"group",fillOpacity:1/Math.max(o.groups.length,1)})],b)},b);I.style.cursor="crosshair",oD(I,v,{theme:b,xDomain:l,groupCount:o.groups.length,colorByGroup:a,height:h});let T=document.createElement("div");return T.className="rtichoke-calibration",T.style.width=`${b.width}px`,T.style.maxWidth="100%",T.append(S,I),T}function X6(e,t,r){let n=e.data.map(s=>s.observed).filter(Number.isFinite),o={x:e.xAxis.domain??[0,1],y:e.yAxis.domain??[Math.min(0,...n),Math.max(1,...n)]},i=Q$(e,o),a=s=>{let c=iD(e,t,r,s?i:o);return c.dataset.calibrationZoom=s?"autorange":"configured",c.addEventListener("dblclick",u=>{u.preventDefault();let f=a(!s);c.replaceWith(f)}),c};return a(!1)}function aD(e,t={}){return X6(e,t,!1)}function Z6(e){return X6(e,{},!0)}function sD(e,t,r,n,o){si(e);let i=Ln(Tl(e),t),{theme:a,colorByGroup:s}=i,c=e.operatingPoint?.dimension,u=Gh(e,e.data).map(y=>{let x=y,g=[["Series",y.label]];return e.type==="precision_recall"?(c==="ppcr"?(x.ppcr!==void 0&&g.push(["PPCR",je(x.ppcr,a.tip.digits)]),g.push(["Cutoff",je(x.cutoff,a.tip.digits)])):(g.push(["Cutoff",je(x.cutoff,a.tip.digits)]),x.ppcr!==void 0&&g.push(["PPCR",je(x.ppcr,a.tip.digits)])),g.push(["Sensitivity",je(x.sensitivity,a.tip.digits)],["PPV",je(x.ppv,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Pa(x.performance,eD,a.tip.digits,new Set(["sensitivity","ppv"])))):e.type==="gains"?(c==="probability_threshold"?(g.push(["Cutoff",je(x.cutoff,a.tip.digits)]),g.push(["PPCR",je(x.ppcr,a.tip.digits)])):(g.push(["PPCR",je(x.ppcr,a.tip.digits)]),g.push(["Cutoff",je(x.cutoff,a.tip.digits)])),g.push(["Sensitivity",je(x.sensitivity,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Pa(x.performance,tD,a.tip.digits,new Set(["sensitivity"])))):e.type==="lift"&&(c==="probability_threshold"?(g.push(["Cutoff",je(x.cutoff,a.tip.digits)]),g.push(["PPCR",je(x.ppcr,a.tip.digits)])):(g.push(["PPCR",je(x.ppcr,a.tip.digits)]),g.push(["Cutoff",je(x.cutoff,a.tip.digits)])),g.push(["Lift",je(x.lift,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Pa(x.performance,rD,a.tip.digits,new Set(["lift"])))),{...y,tooltipFields:g,title:Ut(a.tip.digits,g)}}),f=V1(e,a);f.push(jt(u,{x:r,y:n,z:"seriesId",stroke:"group",strokeWidth:a.line.width,strokeDasharray:a.line.dash??void 0}),pf(u,r,n,i,t.theme));let p=[];if(o!==void 0&&e.operatingPoint){let x=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr";p=u.filter(g=>g[x]===o),p.length>0&&f.push(mf(p,r,n,i,t.theme))}let l=Ho({...Bh(i,e),x:_a(a,e.xAxis.label,e.xAxis.domain),y:_a(a,e.yAxis.label,e.yAxis.domain),marks:zh(f,a)},a),m=u.map(y=>({seriesId:y.seriesId,group:y.group,xValue:Number(y[r]),yValue:Number(y[n]),tooltipFields:y.tooltipFields,backgroundColor:s.get(y.group)??"#1b9e77"})),h=p.map(y=>({seriesId:y.seriesId,group:y.group,xValue:Number(y[r]),yValue:Number(y[n]),tooltipFields:y.tooltipFields,backgroundColor:s.get(y.group)??"#1b9e77"})),b=[];for(let y of e.references??[]){let x=y.label??(y.type==="identity"?"Identity":"Reference");y.type==="identity"?b.push({type:"identity",points:[{x:0,y:0},{x:1,y:1}],label:x}):y.type==="horizontal"&&y.value!==void 0?b.push({type:"horizontal",value:y.value,label:x}):y.type==="path"&&y.points&&b.push({type:"path",points:y.points,label:x})}return Ms(l,{items:m,selectedOperatingPointItems:h,references:b,theme:a}),l}function cD(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function fD(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 df(e,t,r,n){let o=cD(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 p of o){let l=document.createElement("option");l.value=String(p),l.textContent=String(p),c.append(l)}s.append(c);let u=document.createElement("div"),f=p=>{u.replaceChildren(t(fD(e,p),i,l=>{i=l,n&&n(l)}))};return c.addEventListener("change",()=>f(Number(c.value))),a.append(s,u),f(o[0]),a}function U1(e,t,r,n){return lf(e,t,(o,i,a,s)=>df(o,(c,u,f)=>Ts(c,i,(p,l)=>sD(p,i,r,n,l),u,f),a,s))}function G1(e,t={}){return U1(e,t,"sensitivity","ppv")}function B1(e,t={}){return U1(e,t,"ppcr","sensitivity")}function z1(e,t={}){return U1(e,t,"ppcr","lift")}var uD=["net_benefit","ppcr","sensitivity","specificity","false_positive_rate","ppv","npv","lift","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function K1(e,t={}){return si(e),lf(e,t,(r,n,o,i)=>df(r,(a,s,c)=>Ts(a,n,(u,f)=>lD(u,n,f),s,c),o,i))}function lD(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=Ln(n,{...t,showLegend:!1}),{theme:i,colorByGroup:a}=o,s=new Map(e.series.map(g=>[g.id,g.display])),c=new Map(e.series.map(g=>[g.display.group,g.display.label])),u=e.data.map(g=>{let S=[["Series",s.get(g.seriesId).label],["Threshold",je(g.threshold,i.tip.digits)],["Net Benefit",je(g.netBenefit,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...Pa(g.performance,uD,i.tip.digits,new Set(["net_benefit"]))),{...g,group:s.get(g.seriesId).group,label:s.get(g.seriesId).label,tooltipFields:S,title:Ut(i.tip.digits,S)}}),f={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},p=[];for(let g of e.references)g.benchmark==="treat_none"?p.push(co([0],{...f})):p.push(jt(g.points,{x:"x",y:"y",...f}));p.push(jt(u,{x:"threshold",y:"netBenefit",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),pf(u,"threshold","netBenefit",o,t.theme));let l=[];r!==void 0&&e.operatingPoint&&(l=u.filter(g=>g.threshold===r),l.length>0&&p.push(mf(l,"threshold","netBenefit",o,t.theme)));let m=(g,S)=>({label:g,domain:S,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat}),h=Ho({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:g=>c.get(g)??g},x:m(e.xAxis.label,e.xAxis.domain),y:m(e.yAxis.label,e.yAxis.domain),marks:p},i),b=u.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.netBenefit,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),y=l.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.netBenefit,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),x=e.references.map(g=>{if(g.type==="horizontal"){let S=g.label??"Treat None";return{type:"horizontal",value:g.value,label:S}}else if(g.type==="path"){let S=g.population?`Treat All \u2014 ${g.population}`:"Treat All",w=g.label??S;return{type:"path",points:g.points,label:w}}return{type:"horizontal",value:0,label:g.label??"Reference"}});return Ms(h,{items:b,selectedOperatingPointItems:y,references:x,theme:i}),h}var pD=["net_benefit_interventions_avoided","net_benefit","predicted_positives","ppcr","true_negatives","false_negatives"];function q1(e,t={}){return si(e),lf(e,t,(r,n,o,i)=>df(r,(a,s,c)=>Ts(a,n,(u,f)=>mD(u,n,f),s,c),o,i))}function mD(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=Ln(n,{...t,showLegend:!1}),{theme:i,colorByGroup:a}=o,s=new Map(e.series.map(g=>[g.id,g.display])),c=new Map(e.series.map(g=>[g.display.group,g.display.label])),u=e.data.map(g=>{let S=[["Series",s.get(g.seriesId).label],["Threshold",je(g.threshold,i.tip.digits)],["Interventions Avoided",je(g.interventionsAvoided,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...Pa(g.performance,pD,i.tip.digits,new Set(["net_benefit_interventions_avoided"]))),{...g,group:s.get(g.seriesId).group,label:s.get(g.seriesId).label,tooltipFields:S,title:Ut(i.tip.digits,S)}}),f={stroke:i.reference.color,strokeWidth:i.reference.width,strokeDasharray:i.reference.dash},p=[];for(let g of e.references)g.benchmark==="treat_all"?p.push(co([0],{...f})):p.push(jt(g.points,{x:"x",y:"y",...f}));p.push(jt(u,{x:"threshold",y:"interventionsAvoided",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),pf(u,"threshold","interventionsAvoided",o,t.theme));let l=[];r!==void 0&&e.operatingPoint&&(l=u.filter(g=>g.threshold===r),l.length>0&&p.push(mf(l,"threshold","interventionsAvoided",o,t.theme)));let m=(g,S)=>({label:g,domain:S,grid:!1,line:!0,ticks:i.axis.ticks,tickSize:i.axis.tickSize,tickPadding:i.axis.tickPadding,tickFormat:i.axis.numberFormat}),h=Ho({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:g=>c.get(g)??g},x:m(e.xAxis.label,e.xAxis.domain),y:m(e.yAxis.label,e.yAxis.domain),marks:p},i),b=u.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.interventionsAvoided,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),y=l.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.interventionsAvoided,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),x=e.references.map(g=>{if(g.type==="horizontal"){let S=g.label??"Treat All";return{type:"horizontal",value:g.value,label:S}}else if(g.type==="path"){let S=g.population?`Treat None \u2014 ${g.population}`:"Treat None",w=g.label??S;return{type:"path",points:g.points,label:w}}return{type:"horizontal",value:0,label:g.label??"Reference"}});return Ms(h,{items:b,selectedOperatingPointItems:y,references:x,theme:i}),h}var Yr="\u2014",Kh=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],dD=[{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 fo(e,t,r,n){let o=e.createElement("td"),i=e.createElement("span");if(i.className="rtichoke-performance-table__cell-text",n){let s=e.createElement("span");s.className="rtichoke-performance-table__badge",s.setAttribute("aria-hidden","true"),s.style.backgroundColor=n,i.append(s)}let a=e.createTextNode(t);return i.append(a),o.append(i),r&&(o.className=r),o}function xt(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 hD(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=qh(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=Yr;return o.append(i,a),o}var gD=0;function Q6(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function qh(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function yD(e){return e.toFixed(2)}function bD(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 xD(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return Yr;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)?Yr:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?Yr:t(e.upper);return`${r} [${n}, ${o}]`}function Ml(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 H1(e,t=globalThis.document){ky(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let O=t.createElement("div");O.className="rtichoke-performance-table__title",O.textContent=e.title,r.append(O)}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(O=>[O.id,O])),a=new Set(e.evaluations.map(O=>O.model).filter(Boolean)),s=new Set(e.evaluations.map(O=>O.population).filter(Boolean)),c=a.size>1,u=s.size>1,f=c,p=u||!c&&a.size===0&&s.size>1,l=new Map,m=0;for(let O of e.evaluations)O.model&&!l.has(O.model)&&(l.set(O.model,Kh[m%Kh.length]),m++);let h=new Map,b=0;for(let O of e.evaluations)O.population&&!h.has(O.population)&&(h.set(O.population,Kh[b%Kh.length]),b++);let y=e.evaluations.some(O=>O.label?!!(c&&O.label!==O.model||u&&O.label!==O.population||!c&&!u&&O.label!==O.model&&O.label!==O.population):!1),x=e.rows.some(O=>O.horizon!==void 0),g=e.rows.some(O=>O.context?.censoringHeuristic!==void 0),S=e.rows.some(O=>O.context?.competingEventHeuristic!==void 0),w=new Set(e.rows.map(O=>O.operatingPoint.type)),_=w.size===1&&w.has("probability_threshold"),v=w.size===1&&w.has("ppcr"),I=new Set(e.metrics.map(O=>O.id)),T=I.has("predicted_positives"),P=I.has("ppcr"),R=T&&(P||v),k=_||!v&&w.has("probability_threshold"),N=R,B=v&&!R,V=!_&&!v&&!R,C=e.rows.filter(O=>O.operatingPoint.type==="probability_threshold").map(O=>O.operatingPoint.value),G=bD(C),j=dD.map(O=>{let L=e.metrics.find(K=>K.id===O.id);return L?{id:L.id,label:L.label||O.defaultLabel}:null}).filter(O=>O!==null),H=new Set,U=j.filter(O=>H.has(O.label)?!1:(H.add(O.label),!0)),z=0,Y=0;for(let O of e.rows)for(let L of O.values)if(L.metricId==="lift"&&L.estimate!==null&&L.estimate!==void 0&&isFinite(L.estimate)&&L.estimate>z&&(z=L.estimate),L.metricId==="net_benefit"&&L.estimate!==null&&L.estimate!==void 0&&isFinite(L.estimate)){let K=Math.abs(L.estimate);K>Y&&(Y=K)}let X=++gD,q=t.createElement("thead");q.className="rtichoke-performance-table__header";let ae=t.createElement("tr"),J=t.createElement("tr"),oe=1;if(J.append(xt(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),f&&(oe++,J.append(xt(t,"Model"))),p&&(oe++,J.append(xt(t,"Population"))),y&&(oe++,J.append(xt(t,"Evaluation"))),k&&(oe++,J.append(xt(t,"Probability Threshold"))),N&&(oe++,J.append(xt(t,"Predicted Positives"))),B&&(oe++,J.append(xt(t,"PPCR"))),V&&(oe++,J.append(xt(t,"Operating Point"))),x&&(oe++,J.append(xt(t,"Time Horizon"))),g&&(oe++,J.append(xt(t,"Censoring"))),S&&(oe++,J.append(xt(t,"Competing Event"))),U.length>0){let O=xt(t,"",{colSpan:oe,className:"rtichoke-performance-table__spanner--empty"});ae.append(O)}if(U.length>0){let O=xt(t,"Performance Metrics",{colSpan:U.length,className:"rtichoke-performance-table__spanner"});ae.append(O);for(let L of U)J.append(xt(t,L.label,{className:"rtichoke-performance-table__metric-header"}))}q.append(ae),q.append(J),o.append(q);let Q=oe+U.length,fe=t.createElement("tbody");for(let O=0;O0?"100.00%":Yr,we.append(Dt,Fr),Ie.append(we),hn.append(Ie),Bt.append(hn),ht.append(Bt),he.append(ht),Me.append(he),te.addEventListener("click",()=>{if(!Me)return;let ir=te.getAttribute("aria-expanded")==="true";te.setAttribute("aria-expanded",ir?"false":"true"),te.setAttribute("aria-label",ir?"Show confusion matrix detail":"Hide confusion matrix detail"),te.textContent=ir?"\u25B8":"\u25BE",Me.hidden=ir})}if(A.append(Te),f){let te=K?.model??Yr,he=K?.model?l.get(K.model):void 0;A.append(fo(t,te,"rtichoke-performance-table__model",he))}if(p){let te=K?.population??Yr,he=K?.population?h.get(K.population):void 0;A.append(fo(t,te,"rtichoke-performance-table__population",he))}y&&A.append(fo(t,K?.label??K?.id??Yr,"rtichoke-performance-table__evaluation"));let rt=new Map(L.values.map(te=>[te.metricId,te]));if(k){let te=L.operatingPoint.type==="probability_threshold"?L.operatingPoint.value:void 0,he=te!==void 0?te.toFixed(G):Yr;A.append(fo(t,he,"rtichoke-performance-table__op"))}if(N){let te=rt.get("predicted_positives")?.estimate,he=rt.get("ppcr")?.estimate??(L.operatingPoint.type==="ppcr"?L.operatingPoint.value:void 0),ht=Yr,or=NaN;if(te!=null&&he!==void 0&&he!==null){let Bt=qh(te),Wo=(he*100).toFixed(2);ht=`${Bt} (${Wo}%)`,or=he*100}else he!=null&&(ht=`${(he*100).toFixed(2)}%`,or=he*100);let $t=fo(t,ht,"rtichoke-performance-table__op");isNaN(or)||Ml($t,t,or,!1,!1,"neutral"),A.append($t)}if(B){let te=L.operatingPoint.type==="ppcr"?L.operatingPoint.value:rt.get("ppcr")?.estimate,he=te!=null?`PPCR ${te.toFixed(2)}`:Yr,ht=fo(t,he,"rtichoke-performance-table__op");te!=null&&Ml(ht,t,te*100,!1,!1,"neutral"),A.append(ht)}if(V){let te=L.operatingPoint.type==="ppcr"?`PPCR ${L.operatingPoint.value.toFixed(2)}`:`Threshold ${L.operatingPoint.value.toFixed(G)}`;A.append(fo(t,te,"rtichoke-performance-table__op"))}if(x&&A.append(fo(t,L.horizon!==void 0?qh(L.horizon):Yr,"rtichoke-performance-table__horizon")),g){let te=L.context?.censoringHeuristic;A.append(fo(t,te?Q6(te):Yr,"rtichoke-performance-table__context"))}if(S){let te=L.context?.competingEventHeuristic;A.append(fo(t,te?Q6(te):Yr,"rtichoke-performance-table__context"))}for(let te of U){let he=rt.get(te.id),ht=xD(he,yD),or=fo(t,ht,"rtichoke-performance-table__metric");if(or.dataset.metricId=te.id,he&&he.estimate!==null&&he.estimate!==void 0&&isFinite(he.estimate)){let $t=he.estimate;if(["sensitivity","specificity","ppv","npv"].includes(te.id))Ml(or,t,$t*100);else if(te.id==="lift"){let Bt=z>0?$t/z*100:0;Ml(or,t,Bt)}else if(te.id==="net_benefit"&&Y>0){let Bt=$t<0,Wo=Math.abs($t)/Y*50;Ml(or,t,Wo,!0,Bt)}}A.append(or)}fe.append(A),Me&&fe.append(Me)}return o.append(fe),n.append(o),r.append(n),r}var wD=0,SD=0;function vD(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 J6(e,t,r,n,o){let i=e.operatingPoints.filter(_=>_.evaluationId===t&&_.type===r).sort((_,v)=>_.value-v.value),a=i.find(_=>Math.abs(_.value-n)<1e-6)??i[0],s=a?a.cutoff:0,c=a?a.realizedPpcr:0,u=e.bins.filter(_=>_.evaluationId===t).sort((_,v)=>_.lower-v.lower),f=0;for(let _ of u)f+=_.nPositive+_.nNegative;let p=null,l=null;if(a?.performance&&a.performance.length>0){let _=C=>{let G=a.performance?.find(j=>j.metricId===C);return G&&G.estimate!==void 0&&G.estimate!==null?G.estimate:null},v=_("true_positives"),I=_("false_positives"),T=_("true_negatives"),P=_("false_negatives"),R=_("sensitivity"),k=_("specificity"),N=_("ppv"),B=_("npv"),V=_("lift");if((R!==null||k!==null||N!==null||B!==null||V!==null)&&(p={sensitivity:R,specificity:k,ppv:N,npv:B,lift:V}),v!==null&&I!==null&&T!==null&&P!==null){let C=v+P,G=T+I,j=v+I,H=T+P;l={tp:v,fp:I,tn:T,fn:P,totalPositives:C,totalNegatives:G,totalPredictedPos:j,totalPredictedNeg:H}}}let m=e.evaluations.find(_=>_.id===t),h=m?.label??m?.model??m?.population??t,b=[],y=[];if(r==="probability_threshold"){let _=u.find(I=>I.lower===0&&I.upper===0),v=u.filter(I=>!(I.lower===0&&I.upper===0));if(_){let I=s===0?!0:_.upper>s,T=I?"TP":"FN",P=I?"True Positive (TP)":"False Negative (FN)",R=I?"FP":"TN",k=I?"False Positive (FP)":"True Negative (TN)";_.nPositive>0&&y.push({category:"Observed Positives",count:_.nPositive,classificationCell:T,cellLabel:P,title:Ut(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Positive"],["Count",_.nPositive],["Classification",P]])}),_.nNegative>0&&y.push({category:"Observed Negatives",count:_.nNegative,classificationCell:R,cellLabel:k,title:Ut(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",k]])})}for(let I=0;Is,B=N?"TP":"FN",V=N?"True Positive (TP)":"False Negative (FN)",C=N?"FP":"TN",G=N?"False Positive (FP)":"True Negative (TN)",j=s===0?!0:T.upper>s,H=j?"TP":"FN",U=j?"True Positive (TP)":"False Negative (FN)",z=j?"FP":"TN",Y=j?"False Positive (FP)":"True Negative (TN)",X=_.nPositive+T.nPositive,q=_.nNegative+T.nNegative;B===H?X>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:X,classificationCell:H,cellLabel:U,isPredictedPositive:j,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Positive"],["Count",X],["Classification",U]])}):(_.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:_.nPositive,classificationCell:B,cellLabel:V,isPredictedPositive:N,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Positive"],["Count",_.nPositive],["Classification",V]])}),T.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:H,cellLabel:U,isPredictedPositive:j,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",U]])})),C===z?q>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:q,classificationCell:z,cellLabel:Y,isPredictedPositive:j,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Negative"],["Count",q],["Classification",Y]])}):(_.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:_.nNegative,classificationCell:C,cellLabel:G,isPredictedPositive:N,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",G]])}),T.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:z,cellLabel:Y,isPredictedPositive:j,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",Y]])}))}else{let N=s===0?!0:T.upper>s,B=N?"TP":"FN",V=N?"True Positive (TP)":"False Negative (FN)",C=N?"FP":"TN",G=N?"False Positive (FP)":"True Negative (TN)";T.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:B,cellLabel:V,isPredictedPositive:N,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",V]])}),T.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:C,cellLabel:G,isPredictedPositive:N,title:Ut(o,[["Evaluation",h],["Score Interval",k],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",G]])})}}}else{let _=(e.rankBins??[]).filter(v=>v.evaluationId===t).sort((v,I)=>v.rankLower-I.rankLower);for(let v of _){let I=v.rankLower,T=v.rankUpper,P=v.positiveMass+v.negativeMass,R=I>=1-n-1e-9,k=R?"TP":"FN",N=R?"True Positive (TP)":"False Negative (FN)",B=R?"FP":"TN",V=R?"False Positive (FP)":"True Negative (TN)";if(P>0){let C=`[${I.toFixed(o)}, ${T.toFixed(o)}]`;v.positiveMass>0&&b.push({x1:I,x2:T,category:"Observed Positives",count:v.positiveMass,classificationCell:k,cellLabel:N,isPredictedPositive:R,title:Ut(o,[["Evaluation",h],["Population Rank Percentile",C],["Outcome","Observed Positive"],["Count",v.positiveMass],["Classification",N]])}),v.negativeMass>0&&b.push({x1:I,x2:T,category:"Observed Negatives",count:v.negativeMass,classificationCell:B,cellLabel:V,isPredictedPositive:R,title:Ut(o,[["Evaluation",h],["Population Rank Percentile",C],["Outcome","Observed Negative"],["Count",v.negativeMass],["Classification",V]])})}}}let x=s,g="Prediction Score",S="Count",w=1;if(r==="probability_threshold"){x=s,g="Prediction Score";let _=0,v=new Map;for(let I of b)v.set(I.x1,(v.get(I.x1)??0)+I.count);for(let I of v.values())_=Math.max(_,I);w=Math.max(1,Math.ceil(_*1.15))}else{x=1-n,g="Prediction Percentile";let _=0,v=new Map;for(let I of b)v.set(I.x1,(v.get(I.x1)??0)+I.count);for(let I of v.values())_=Math.max(_,I);w=Math.max(1,Math.ceil(_*1.15))}return{evalId:t,evalLabel:h,dim:r,currentValue:n,cutoff:s,realizedPpcr:c,cutoffX:x,xAxisLabel:g,yAxisLabel:S,yMax:w,totalN:f,performanceMetrics:p,confusion:l,ordinaryPlotData:b,zeroAtomPlotData:y}}function Y1(e,t={}){Gf(e);let r=++SD,n=Ln(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=O=>{let L=new Set;for(let A of e.operatingPoints)A.evaluationId===O&&L.add(A.type);let K=[];return L.has("probability_threshold")&&K.push("probability_threshold"),L.has("ppcr")&&K.push("ppcr"),K},c=(O,L)=>e.operatingPoints.filter(K=>K.evaluationId===O&&K.type===L).sort((K,A)=>K.value-A.value),u=s(a),f=e.operatingPoint?.dimension&&u.includes(e.operatingPoint.dimension)?e.operatingPoint.dimension:u[0]??"probability_threshold",p=(O,L)=>{let K=c(O,L);return[...new Set(K.map(A=>A.value))].sort((A,ee)=>A-ee)},l=(O,L,K)=>{let A=p(O,L);return A.length===0?0:K!==void 0&&A.some(ee=>Math.abs(ee-K)<1e-6)?K:A.some(ee=>Math.abs(ee-.5)<1e-6)?.5:A[0]},m=l(a,f),h="stacked",b="confusion_matrix_cell",y="all_observations",x=document.createElement("div");x.className="rtichoke-prediction-distribution",x.style.width=`${o.width}px`,x.style.maxWidth="100%";let g=document.createElement("div");g.className="rtichoke-prediction-distribution__controls";let S=document.createElement("select");S.className="rtichoke-prediction-distribution__select",S.setAttribute("aria-label","Evaluation"),S.style.display="none";let w=document.createElement("select");w.className="rtichoke-prediction-distribution__select",w.setAttribute("aria-label","Color bars by"),w.style.display="none";let _=document.createElement("option");_.value="confusion_matrix_cell",_.textContent="Confusion matrix cell";let v=document.createElement("option");v.value="observed_outcome",v.textContent="Observed outcome",w.append(_,v);let I=document.createElement("label");I.className="rtichoke-prediction-distribution__control-group";let T=document.createElement("select");T.className="rtichoke-prediction-distribution__select",T.setAttribute("aria-label","Condition on");let P=document.createElement("option");P.value="predicted_positives",P.textContent="Predicted positives";let R=document.createElement("option");R.value="predicted_negatives",R.textContent="Predicted negatives";let k=document.createElement("option");k.value="real_positives",k.textContent="Real positives";let N=document.createElement("option");N.value="real_negatives",N.textContent="Real negatives",T.append(P,R,k,N),I.append(T);let B=document.createElement("select");B.className="rtichoke-prediction-distribution__select",B.setAttribute("aria-label","Operating point dimension"),B.style.display="none",S.addEventListener("change",()=>{a=S.value,fe()}),w.addEventListener("change",()=>{b=w.value,fe()}),T.addEventListener("change",()=>{y=T.value,fe()}),B.addEventListener("change",()=>{f=B.value,m=l(a,f,m),fe()});let V=(O,L,K,A,ee)=>{let re=document.createElement("div");re.className="rtichoke-pd-radio-group",re.setAttribute("role","radiogroup"),re.setAttribute("aria-label",O);let Te=document.createElement("span");Te.className="rtichoke-pd-radio-group-label",Te.textContent=`${O}:`,re.append(Te);let Me=document.createElement("div");Me.className="rtichoke-pd-radio-options";for(let rt of K){let te=document.createElement("label");te.className="rtichoke-pd-radio-option";let he=document.createElement("input");he.type="radio",he.name=L,he.value=rt.value,he.checked=rt.value===A,he.addEventListener("change",()=>{he.checked&&ee(rt.value)});let ht=document.createElement("span");ht.textContent=rt.label,te.append(he,ht),Me.append(te)}return re.append(Me),re},C=document.createElement("div");C.className="rtichoke-pd-controls-row";let G=()=>{C.replaceChildren(),S.replaceChildren();for(let O of e.evaluations){let L=document.createElement("option");L.value=O.id,L.textContent=O.label??O.model??O.population??O.id,S.append(L)}if(S.value=a,e.evaluations.length>1){let O=e.evaluations.map(K=>({value:K.id,label:K.label??K.model??K.population??K.id})),L=V("Reference Group",`pd-ref-group-${r}`,O,a,K=>{a=K,fe()});C.append(L)}},j=document.createElement("div");j.className="rtichoke-pd-controls-row";let H=document.createElement("div");H.className="rtichoke-operating-point-control",H.style.marginLeft=`${o.margins.left}px`,H.style.marginRight=`${o.margins.right}px`;let U=`rtichoke-pd-slider-${++wD}`,z=document.createElement("label");z.className="rtichoke-operating-point-label",z.htmlFor=U;let Y=document.createElement("span"),X=document.createElement("span");X.className="rtichoke-operating-point-value",z.append(Y,X);let q=document.createElement("input");q.type="range",q.id=U,q.className="rtichoke-operating-point-slider",H.append(z,q);let ae=document.createElement("div");ae.className="rtichoke-legend",ae.style.paddingLeft=`${o.margins.left}px`;let J=(O,L)=>{let K=document.createElement("div");K.className="rtichoke-legend-item";let A=document.createElement("span");A.className="rtichoke-legend-swatch";let ee=document.createElement("span");ee.className="rtichoke-legend-line",ee.style.backgroundColor=L,ee.style.border=`1px solid ${o.axis.color}`,ee.style.boxSizing="border-box",ee.style.height="10px",ee.style.borderRadius="2px",A.append(ee);let re=document.createElement("span");return re.className="rtichoke-legend-label",re.textContent=O,K.append(A,re),K},oe=document.createElement("div");oe.className="rtichoke-prediction-distribution__chart";let Q=document.createElement("div");Q.className="rtichoke-prediction-distribution__summary",g.append(C,j),x.append(g,Q,H,ae,oe);let fe=()=>{G(),j.replaceChildren(),w.value=b,T.value=y==="all_observations"?"predicted_positives":y,I.style.display=b==="observed_outcome"?"none":"inline-flex",B.replaceChildren();let O=s(a);for(let ye of O){let Ie=document.createElement("option");Ie.value=ye,Ie.textContent=ye==="probability_threshold"?"Probability threshold":"PPCR",B.append(Ie)}B.value=f;let L=V("Display",`pd-display-${r}`,[{value:"stacked",label:"Stacked"},{value:"mirrored",label:"Mirrored"}],h,ye=>{h=ye,fe()}),K=V("Color Bars By",`pd-color-${r}`,[{value:"confusion_matrix_cell",label:"Confusion Matrix Cell"},{value:"observed_outcome",label:"Observed Outcome"}],b,ye=>{b=ye,fe()});if(j.append(L,K,S,w,I,B),O.length>1){let ye=V("Dimension",`pd-dim-${r}`,[{value:"probability_threshold",label:"Probability Threshold"},{value:"ppcr",label:"PPCR"}],f,Ie=>{f=Ie,m=l(a,f,m),fe()});j.append(ye)}let A=p(a,f),ee=A.find(ye=>Math.abs(ye-m)<1e-6);ee!==void 0?m=ee:m=l(a,f,m);let re=A.indexOf(m);q.min="0",q.max=String(Math.max(0,A.length-1)),q.step="1",q.value=String(Math.max(0,re));let Te=f==="probability_threshold"?"Probability threshold":"PPCR";Y.textContent=`${Te}: `,X.textContent=m.toFixed(i),q.setAttribute("aria-label",Te),q.setAttribute("aria-valuetext",m.toFixed(i));let Me=J6(e,a,f,m,i),{cutoff:rt,cutoffX:te,xAxisLabel:he,yAxisLabel:ht,yMax:or,totalN:$t,performanceMetrics:Bt,confusion:Wo,ordinaryPlotData:ks}=Me,Vn=vD(o.predictionDistribution,y);ae.replaceChildren(),b==="observed_outcome"&&ae.append(J("Observed Positives",o.predictionDistribution.observedPositive),J("Observed Negatives",o.predictionDistribution.observedNegative));let hn=[],gn=f==="probability_threshold"?`Cutoff = ${rt.toFixed(i)}`:`PPCR = ${m.toFixed(i)}`,Nl=or,mg=h==="mirrored"?-or:0;hn.push(vl([te],{stroke:o.axis.color,strokeWidth:2,strokeDasharray:"4,3"})),hn.push(sf([{x:te,label:gn}],{x:"x",y:Nl,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700})),h==="mirrored"&&hn.push(co([0],{stroke:o.axis.color,strokeWidth:1.5}));let xf=ye=>{let Ie="";if(b==="observed_outcome")Ie=ye.category==="Observed Positives"?o.predictionDistribution.observedPositive:o.predictionDistribution.observedNegative;else switch(ye.classificationCell){case"TP":Ie=Vn.tp;break;case"FP":Ie=Vn.fp;break;case"TN":Ie=Vn.tn;break;case"FN":Ie=Vn.fn;break}let we=!0;switch(y){case"all_observations":we=!0;break;case"predicted_positives":we=ye.isPredictedPositive;break;case"predicted_negatives":we=!ye.isPredictedPositive;break;case"real_positives":we=ye.category==="Observed Positives";break;case"real_negatives":we=ye.category==="Observed Negatives";break}return{fill:Ie,fillOpacity:we?.88:.18,strokeOpacity:we?.4:.1}};if(h==="stacked"){let ye=ks.map(Ie=>{let{fill:we,fillOpacity:Dt,strokeOpacity:Fr}=xf(Ie);return{...Ie,fill:we,fillOpacity:Dt,strokeOpacity:Fr}});hn.push(Fi(ye,Rh({x1:"x1",x2:"x2",y:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Ie=>Ie.title,tip:!0})))}else{let ye=ks.filter(we=>we.category==="Observed Positives").map(we=>{let{fill:Dt,fillOpacity:Fr,strokeOpacity:ir}=xf(we);return{...we,fill:Dt,fillOpacity:Fr,strokeOpacity:ir}}),Ie=ks.filter(we=>we.category==="Observed Negatives").map(we=>{let{fill:Dt,fillOpacity:Fr,strokeOpacity:ir}=xf(we);return{...we,fill:Dt,fillOpacity:Fr,strokeOpacity:ir}});ye.length>0&&hn.push(Fi(ye,{x1:"x1",x2:"x2",y1:0,y2:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:we=>we.title,tip:!0})),Ie.length>0&&hn.push(Fi(Ie,{x1:"x1",x2:"x2",y1:0,y2:we=>-we.count,fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:we=>we.title,tip:!0}))}let dg={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:he,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:ht,domain:[mg,Nl],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:ye=>String(Math.abs(ye))},marks:hn},Oa=Ho(dg,o);if(oe.replaceChildren(Oa),Q.replaceChildren(),Wo){let{tp:ye,fp:Ie,tn:we,fn:Dt,totalPositives:Fr,totalNegatives:ir,totalPredictedPos:Al,totalPredictedNeg:ar}=Wo,Xr=document.createElement("table");Xr.className="rtichoke-pd-matrix";let wf=document.createElement("colgroup"),Rs=document.createElement("col");Rs.style.width="28%";let Ns=document.createElement("col");Ns.style.width="24%";let As=document.createElement("col");As.style.width="24%";let El=document.createElement("col");El.style.width="24%",wf.append(Rs,Ns,As,El),Xr.append(wf);let Sf=(We,nt)=>{let Li=document.createElement("label");Li.className=`rtichoke-pd-cond-option ${y===We?"rtichoke-pd-cond-option--active":""}`;let jn=document.createElement("input");jn.type="radio",jn.name=`pd-cond-${r}`,jn.value=We,jn.checked=y===We,jn.addEventListener("change",()=>{jn.checked&&(y=We,fe())});let Xo=document.createElement("span");return Xo.textContent=nt,Li.append(jn,Xo),Li},uw=document.createElement("thead"),lw=document.createElement("tr"),hg=document.createElement("th");hg.className="rtichoke-pd-matrix__corner",hg.append(Sf("all_observations","All Observations"));let gg=document.createElement("th");gg.className=`rtichoke-pd-matrix__col-header ${y==="real_positives"?"rtichoke-pd-matrix__col-header--active":""}`,gg.append(Sf("real_positives","Real Positive"));let yg=document.createElement("th");yg.className=`rtichoke-pd-matrix__col-header ${y==="real_negatives"?"rtichoke-pd-matrix__col-header--active":""}`,yg.append(Sf("real_negatives","Real Negative"));let pw=document.createElement("th");pw.className="rtichoke-pd-matrix__col-header rtichoke-pd-matrix__col-header--blank",lw.append(hg,gg,yg,pw),uw.append(lw);let mw=document.createElement("tbody"),TO=b==="observed_outcome"?o.predictionDistribution.observedPositive:Vn.tp,MO=b==="observed_outcome"?o.predictionDistribution.observedPositive:Vn.fn,CO=b==="observed_outcome"?o.predictionDistribution.observedNegative:Vn.fp,OO=b==="observed_outcome"?o.predictionDistribution.observedNegative:Vn.tn,kO=o.predictionDistribution.observedPositive,RO=o.predictionDistribution.observedNegative,bg="#E5E7EB",NO=We=>{if($t===0)return null;switch(y){case"all_observations":return`(${((We==="TP"?ye:We==="FP"?Ie:We==="TN"?we:Dt)/$t*100).toFixed(1)}%)`;case"predicted_positives":{let nt=ye+Ie;return nt===0?null:We==="TP"?`(${(ye/nt*100).toFixed(1)}%)`:We==="FP"?`(${(Ie/nt*100).toFixed(1)}%)`:null}case"predicted_negatives":{let nt=we+Dt;return nt===0?null:We==="TN"?`(${(we/nt*100).toFixed(1)}%)`:We==="FN"?`(${(Dt/nt*100).toFixed(1)}%)`:null}case"real_positives":{let nt=ye+Dt;return nt===0?null:We==="TP"?`(${(ye/nt*100).toFixed(1)}%)`:We==="FN"?`(${(Dt/nt*100).toFixed(1)}%)`:null}case"real_negatives":{let nt=we+Ie;return nt===0?null:We==="TN"?`(${(we/nt*100).toFixed(1)}%)`:We==="FP"?`(${(Ie/nt*100).toFixed(1)}%)`:null}}},Fl=(We,nt,Li,jn)=>{We.replaceChildren(),We.className=`rtichoke-prediction-distribution__cell--${nt.toLowerCase()} rtichoke-pd-matrix__cell`,We.style.backgroundColor="#ffffff",We.style.color=o.axis.color;let Xo=$t>0?Li/$t*100:0,Vi=document.createElement("div");Vi.className="rtichoke-pd-cell-bar",Vi.style.width=`${Xo}%`,Vi.style.backgroundColor=jn;let ka=document.createElement("div");ka.className="rtichoke-pd-cell-content";let _g=document.createElement("span");_g.className="rtichoke-pd-cell-label",_g.textContent=nt;let Pg=document.createElement("div");Pg.className="rtichoke-pd-cell-num";let Tg=document.createElement("span");Tg.className="rtichoke-pd-cell-count",Tg.textContent=Li.toLocaleString();let AO=NO(nt),Mg=document.createElement("span");Mg.className="rtichoke-pd-cell-pct",Mg.textContent=AO??"",Pg.append(Tg,Mg),ka.append(_g,Pg),We.append(Vi,ka)},vf=(We,nt,Li)=>{We.replaceChildren(),We.className="rtichoke-prediction-distribution__cell--total rtichoke-pd-matrix__cell",We.style.backgroundColor="#ffffff";let jn=$t>0?nt/$t*100:0,Xo=document.createElement("div");Xo.className="rtichoke-pd-cell-bar",Xo.style.width=`${jn}%`,Xo.style.backgroundColor=Li;let Vi=document.createElement("div");Vi.className="rtichoke-pd-cell-content rtichoke-pd-cell-content--margin";let ka=document.createElement("span");ka.className="rtichoke-pd-cell-count",ka.textContent=nt.toLocaleString(),Vi.append(ka),We.append(Xo,Vi)},xg=document.createElement("tr");y==="predicted_positives"&&(xg.className="rtichoke-pd-matrix__row--active");let wg=document.createElement("th");wg.className=`rtichoke-pd-matrix__row-header ${y==="predicted_positives"?"rtichoke-pd-matrix__row-header--active":""}`,wg.append(Sf("predicted_positives","Predicted Positive"));let dw=document.createElement("td");Fl(dw,"TP",ye,TO);let hw=document.createElement("td");Fl(hw,"FP",Ie,CO);let gw=document.createElement("td");vf(gw,Al,bg),xg.append(wg,dw,hw,gw);let Sg=document.createElement("tr");y==="predicted_negatives"&&(Sg.className="rtichoke-pd-matrix__row--active");let vg=document.createElement("th");vg.className=`rtichoke-pd-matrix__row-header ${y==="predicted_negatives"?"rtichoke-pd-matrix__row-header--active":""}`,vg.append(Sf("predicted_negatives","Predicted Negative"));let yw=document.createElement("td");Fl(yw,"FN",Dt,MO);let bw=document.createElement("td");Fl(bw,"TN",we,OO);let xw=document.createElement("td");vf(xw,ar,bg),Sg.append(vg,yw,bw,xw);let Ig=document.createElement("tr");Ig.className="rtichoke-pd-matrix__tot-row";let ww=document.createElement("th");ww.className="rtichoke-pd-matrix__row-header rtichoke-pd-matrix__row-header--blank";let Sw=document.createElement("td");vf(Sw,Fr,kO);let vw=document.createElement("td");vf(vw,ir,RO);let Iw=document.createElement("td");vf(Iw,$t,bg),Ig.append(ww,Sw,vw,Iw),mw.append(xg,Sg,Ig),Xr.append(uw,mw),Q.append(Xr)}if(Bt){let ye=document.createElement("div");ye.className="rtichoke-pd-metrics-container rtichoke-performance-table";let Ie=document.createElement("table");Ie.className="rtichoke-performance-table__table rtichoke-pd-metrics-table";let we=document.createElement("thead"),Dt=document.createElement("tr"),Fr=[{id:"sensitivity",label:"Sensitivity",val:Bt.sensitivity,isEmphasized:y==="real_positives",isRatio:!1},{id:"specificity",label:"Specificity",val:Bt.specificity,isEmphasized:y==="real_negatives",isRatio:!1},{id:"ppv",label:"PPV",val:Bt.ppv,isEmphasized:y==="predicted_positives",isRatio:!1},{id:"npv",label:"NPV",val:Bt.npv,isEmphasized:y==="predicted_negatives",isRatio:!1},{id:"lift",label:"Lift",val:Bt.lift,isEmphasized:y==="predicted_positives",isRatio:!0}];for(let ar of Fr){let Xr=document.createElement("th");Xr.className=`rtichoke-performance-table__metric-header ${ar.isEmphasized?"rtichoke-pd-metric--emphasized-header":""}`,Xr.textContent=ar.label,Dt.append(Xr)}we.append(Dt);let ir=document.createElement("tbody"),Al=document.createElement("tr");for(let ar of Fr){let Xr=document.createElement("td");Xr.className=`rtichoke-performance-table__metric ${ar.isEmphasized?"rtichoke-pd-metric--emphasized-cell":""}`;let wf="\u2014";if(ar.val!==null&&ar.val!==void 0&&(wf=ar.isRatio?ar.val.toFixed(2):(ar.val*100).toFixed(1)+"%"),ar.val!==null&&ar.val!==void 0&&isFinite(ar.val)){let Ns=document.createElement("div");Ns.className="rtichoke-performance-table__bar";let As=document.createElement("div");As.className="rtichoke-performance-table__bar-fill rtichoke-performance-table__bar-fill--positive";let El=ar.isRatio?Math.min(100,ar.val/3*100):Math.min(100,ar.val*100);As.style.width=`${El}%`,Ns.append(As),Xr.append(Ns)}let Rs=document.createElement("span");Rs.className="rtichoke-performance-table__cell-text",Rs.textContent=wf,Xr.append(Rs),Al.append(Xr)}ir.append(Al),Ie.append(we,ir),ye.append(Ie),Q.append(ye)}};return q.addEventListener("input",()=>{let O=p(a,f),L=Number(q.value);L>=0&&L0?n[0]:void 0,i=[];if(n.length>1){let m=t.createElement("label");m.className="rtichoke-horizon-control",m.textContent="Fixed Time Horizon: ";let h=t.createElement("select");h.className="rtichoke-horizon-select",h.setAttribute("aria-label","Fixed Time Horizon");for(let b of n){let y=t.createElement("option");y.value=String(b),y.textContent=String(b),h.append(y)}h.value=String(o),h.addEventListener("change",()=>{o=Number(h.value),l()}),m.append(h),r.append(m)}let a=t.createElement("table");a.className="rtichoke-summary-metrics__table";let s=t.createElement("thead"),c=t.createElement("tr");for(let m of["Owner","Metric","Estimate"])c.append(_D(t,m));s.append(c),a.append(s);let u=new Map(e.evaluations.map(m=>[m.id,m])),f=new Map(e.populations.map(m=>[m.id,m])),p=t.createElement("tbody");for(let m of e.metrics){let h=t.createElement("tr"),b="",y="",x;if(m.metric==="auroc"){let S=u.get(m.owner.evaluationId);b=S.label??S.model??S.population??S.id,y="AUROC",h.dataset.metric="auroc",h.dataset.evaluationId=m.owner.evaluationId}else m.metric==="prevalence"?(b=f.get(m.owner.populationId).label,y="Prevalence",h.dataset.metric="prevalence",h.dataset.populationId=m.owner.populationId):m.metric==="event_risk"&&(b=f.get(m.owner.populationId).label,y="Event Probability",x=m.horizon,h.dataset.metric="event_risk",h.dataset.populationId=m.owner.populationId,h.dataset.horizon=String(m.horizon));h.append(W1(t,b,"rtichoke-summary-metrics__owner"),W1(t,y,"rtichoke-summary-metrics__metric"));let g=W1(t,PD(m.estimate),"rtichoke-summary-metrics__estimate");m.estimate===null?g.dataset.unavailable="true":g.dataset.estimate=String(m.estimate),h.append(g),i.push({element:h,horizon:x}),p.append(h)}a.append(p),r.append(a);function l(){for(let{element:m,horizon:h}of i)h===void 0||h===o?m.style.display="":m.style.display="none"}return l(),r}function TD(e){switch(e.errorType){case E.ArrayContains:return"Expected array to contain at least one matching value";case E.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case E.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case E.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case E.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case E.ArrayUniqueItems:return"Expected array elements to be unique";case E.Array:return"Expected array";case E.AsyncIterator:return"Expected AsyncIterator";case E.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case E.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case E.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case E.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case E.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case E.BigInt:return"Expected bigint";case E.Boolean:return"Expected boolean";case E.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case E.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case E.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case E.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case E.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case E.Date:return"Expected Date";case E.Function:return"Expected function";case E.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case E.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case E.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case E.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case E.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case E.Integer:return"Expected integer";case E.IntersectUnevaluatedProperties:return"Unexpected property";case E.Intersect:return"Expected all values to match";case E.Iterator:return"Expected Iterator";case E.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case E.Never:return"Never";case E.Not:return"Value should not match";case E.Null:return"Expected null";case E.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case E.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case E.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case E.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case E.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case E.Number:return"Expected number";case E.Object:return"Expected object";case E.ObjectAdditionalProperties:return"Unexpected property";case E.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case E.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case E.ObjectRequiredProperty:return"Expected required property";case E.Promise:return"Expected Promise";case E.RegExp:return"Expected string to match regular expression";case E.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case E.StringFormat:return`Expected string to match '${e.schema.format}' format`;case E.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case E.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case E.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case E.String:return"Expected string";case E.Symbol:return"Expected symbol";case E.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case E.Tuple:return"Expected tuple";case E.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case E.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case E.Uint8Array:return"Expected Uint8Array";case E.Undefined:return"Expected undefined";case E.Union:return"Expected union value";case E.Void:return"Expected void";case E.Kind:return`Expected kind '${e.schema[$]}'`;default:return"Unknown error type"}}var MD=TD;function eO(){return MD}var Z1=class extends pe{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function CD(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new Z1(e);return De(r,t)}function tr(e,t){return!Ue(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function De(e,t){return e[$]==="This"||e[$]==="Ref"?CD(e,t):e}var Q1=class extends pe{constructor(t){super("Unable to hash value"),this.value=t}},pn;(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"})(pn||(pn={}));var hf=BigInt("14695981039346656037"),[OD,kD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],RD=Array.from({length:256}).map((e,t)=>BigInt(t)),tO=new Float64Array(1),rO=new DataView(tO.buffer),nO=new Uint8Array(tO.buffer);function*ND(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){Pr(pn.Array);for(let t of e)gf(t)}function ED(e){Pr(pn.Boolean),Pr(e?1:0)}function FD(e){Pr(pn.BigInt),rO.setBigInt64(0,e);for(let t of nO)Pr(t)}function $D(e){Pr(pn.Date),gf(e.getTime())}function DD(e){Pr(pn.Null)}function LD(e){Pr(pn.Number),rO.setFloat64(0,e);for(let t of nO)Pr(t)}function VD(e){Pr(pn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())gf(t),gf(e[t])}function jD(e){Pr(pn.String);for(let t=0;t=e.minItems)||_e(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!rr(e.items,t,i))return!1;if(e.uniqueItems===!0&&!(function(){let i=new Set;for(let a of r){let s=yf(a);if(i.has(s))return!1;i.add(s)}return!0})())return!1;if(!(_e(e.contains)||st(e.minContains)||st(e.maxContains)))return!0;let n=_e(e.contains)?e.contains:Se(),o=r.reduce((i,a)=>rr(n,t,a)?i+1:i,0);return!(o===0||st(e.minContains)&&oe.maxContains)}function YD(e,t,r){return Ll(r)}function WD(e,t,r){return!(!Un(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 XD(e,t,r){return yo(r)}function ZD(e,t,r){return rr(e.returns,t,r.prototype)}function QD(e,t,r){return!(!Tr(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 JD(e,t,r){return ji(r)}function eL(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return rr(o,[...t,...n],r)}function tL(e,t,r){return!(!Ul(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 rL(e,t,r){let n=e.allOf.every(o=>rr(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(lt(e.unevaluatedProperties)){let o=new RegExp(Ys(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||rr(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function nL(e,t,r){return Vl(r)}function oL(e,t,r){return r===e.const}function iL(e,t,r){return!1}function aL(e,t,r){return!rr(e.not,t,r)}function sL(e,t,r){return Jo(r)}function cL(e,t,r){return!(!Rt.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 fL(e,t,r){if(!Rt.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(!rr(i,t,r[o])||(ja(i)||zD(i))&&!(o in r))return!1}else if(Rt.IsExactOptionalProperty(r,o)&&!rr(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)||rr(e.additionalProperties,t,r[i])):!0}function uL(e,t,r){return jl(r)}function lL(e,t,r){if(!Rt.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)?rr(o,t,f):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([u,f])=>i.test(u)?!0:rr(e.additionalProperties,t,f)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(u=>i.test(u)):!0;return a&&s&&c}function pL(e,t,r){return rr(De(e,t),t,r)}function mL(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 dL(e,t,r){return!Ue(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)?Ki.Has(e.format)?Ki.Get(e.format)(r):!1:!0}function hL(e,t,r){return ei(r)}function gL(e,t,r){return Ue(r)&&new RegExp(e.pattern).test(r)}function yL(e,t,r){return rr(De(e,t),t,r)}function bL(e,t,r){if(!le(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;nrr(n,t,r))}function SL(e,t,r){return!(!Fs(r)||_e(e.maxByteLength)&&!(r.length<=e.maxByteLength)||_e(e.minByteLength)&&!(r.length>=e.minByteLength))}function vL(e,t,r){return!0}function IL(e,t,r){return Rt.IsVoidLike(r)}function _L(e,t,r){return Wn.Has(e[$])?Wn.Get(e[$])(e,r):!1}function rr(e,t,r){let n=_e(e.$id)?tr(e,t):t,o=e;switch(o[$]){case"Any":return KD(o,n,r);case"Argument":return qD(o,n,r);case"Array":return HD(o,n,r);case"AsyncIterator":return YD(o,n,r);case"BigInt":return WD(o,n,r);case"Boolean":return XD(o,n,r);case"Constructor":return ZD(o,n,r);case"Date":return QD(o,n,r);case"Function":return JD(o,n,r);case"Import":return eL(o,n,r);case"Integer":return tL(o,n,r);case"Intersect":return rL(o,n,r);case"Iterator":return nL(o,n,r);case"Literal":return oL(o,n,r);case"Never":return iL(o,n,r);case"Not":return aL(o,n,r);case"Null":return sL(o,n,r);case"Number":return cL(o,n,r);case"Object":return fL(o,n,r);case"Promise":return uL(o,n,r);case"Record":return lL(o,n,r);case"Ref":return pL(o,n,r);case"RegExp":return mL(o,n,r);case"String":return dL(o,n,r);case"Symbol":return hL(o,n,r);case"TemplateLiteral":return gL(o,n,r);case"This":return yL(o,n,r);case"Tuple":return bL(o,n,r);case"Undefined":return xL(o,n,r);case"Union":return wL(o,n,r);case"Uint8Array":return SL(o,n,r);case"Unknown":return vL(o,n,r);case"Void":return IL(o,n,r);default:if(!Wn.Has(o[$]))throw new J1(o);return _L(o,n,r)}}function xe(...e){return e.length===3?rr(e[0],e[1],e[2]):rr(e[0],[],e[1])}var E;(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"})(E||(E={}));var ew=class extends pe{constructor(t){super("Unknown type"),this.schema=t}};function $i(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pe(e){return e!==void 0}var Ma=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 Z(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:eO()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*PL(e,t,r,n){}function*TL(e,t,r,n){}function*ML(e,t,r,n){if(!le(n))return yield Z(E.Array,e,r,n);Pe(e.minItems)&&!(n.length>=e.minItems)&&(yield Z(E.ArrayMinItems,e,r,n)),Pe(e.maxItems)&&!(n.length<=e.maxItems)&&(yield Z(E.ArrayMaxItems,e,r,n));for(let a=0;anr(o,t,`${r}${c}`,s).next().done===!0?a+1:a,0);i===0&&(yield Z(E.ArrayContains,e,r,n)),st(e.minContains)&&ie.maxContains&&(yield Z(E.ArrayMaxContains,e,r,n))}function*CL(e,t,r,n){Ll(n)||(yield Z(E.AsyncIterator,e,r,n))}function*OL(e,t,r,n){if(!Un(n))return yield Z(E.BigInt,e,r,n);Pe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield Z(E.BigIntExclusiveMinimum,e,r,n)),Pe(e.maximum)&&!(n<=e.maximum)&&(yield Z(E.BigIntMaximum,e,r,n)),Pe(e.minimum)&&!(n>=e.minimum)&&(yield Z(E.BigIntMinimum,e,r,n)),Pe(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield Z(E.BigIntMultipleOf,e,r,n))}function*kL(e,t,r,n){yo(n)||(yield Z(E.Boolean,e,r,n))}function*RL(e,t,r,n){yield*nr(e.returns,t,r,n.prototype)}function*NL(e,t,r,n){if(!Tr(n))return yield Z(E.Date,e,r,n);Pe(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield Z(E.DateExclusiveMinimumTimestamp,e,r,n)),Pe(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield Z(E.DateMaximumTimestamp,e,r,n)),Pe(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield Z(E.DateMinimumTimestamp,e,r,n)),Pe(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield Z(E.DateMultipleOfTimestamp,e,r,n))}function*AL(e,t,r,n){ji(n)||(yield Z(E.Function,e,r,n))}function*EL(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*nr(i,[...t,...o],r,n)}function*FL(e,t,r,n){if(!Ul(n))return yield Z(E.Integer,e,r,n);Pe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield Z(E.IntegerExclusiveMinimum,e,r,n)),Pe(e.maximum)&&!(n<=e.maximum)&&(yield Z(E.IntegerMaximum,e,r,n)),Pe(e.minimum)&&!(n>=e.minimum)&&(yield Z(E.IntegerMinimum,e,r,n)),Pe(e.multipleOf)&&n%e.multipleOf!==0&&(yield Z(E.IntegerMultipleOf,e,r,n))}function*$L(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of nr(i,t,r,n))o=!0,yield a;if(o)return yield Z(E.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 Z(E.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=nr(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*DL(e,t,r,n){Vl(n)||(yield Z(E.Iterator,e,r,n))}function*LL(e,t,r,n){n!==e.const&&(yield Z(E.Literal,e,r,n))}function*VL(e,t,r,n){yield Z(E.Never,e,r,n)}function*jL(e,t,r,n){nr(e.not,t,r,n).next().done===!0&&(yield Z(E.Not,e,r,n))}function*UL(e,t,r,n){Jo(n)||(yield Z(E.Null,e,r,n))}function*GL(e,t,r,n){if(!Rt.IsNumberLike(n))return yield Z(E.Number,e,r,n);Pe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield Z(E.NumberExclusiveMinimum,e,r,n)),Pe(e.maximum)&&!(n<=e.maximum)&&(yield Z(E.NumberMaximum,e,r,n)),Pe(e.minimum)&&!(n>=e.minimum)&&(yield Z(E.NumberMinimum,e,r,n)),Pe(e.multipleOf)&&n%e.multipleOf!==0&&(yield Z(E.NumberMultipleOf,e,r,n))}function*BL(e,t,r,n){if(!Rt.IsObjectLike(n))return yield Z(E.Object,e,r,n);Pe(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield Z(E.ObjectMinProperties,e,r,n)),Pe(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield Z(E.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 Z(E.ObjectRequiredProperty,e.properties[s],`${r}/${$i(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield Z(E.ObjectAdditionalProperties,e,`${r}/${$i(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*nr(e.additionalProperties,t,`${r}/${$i(s)}`,n[s]));for(let s of i){let c=e.properties[s];e.required&&e.required.includes(s)?(yield*nr(c,t,`${r}/${$i(s)}`,n[s]),ja(e)&&!(s in n)&&(yield Z(E.ObjectRequiredProperty,c,`${r}/${$i(s)}`,void 0))):Rt.IsExactOptionalProperty(n,s)&&(yield*nr(c,t,`${r}/${$i(s)}`,n[s]))}}function*zL(e,t,r,n){jl(n)||(yield Z(E.Promise,e,r,n))}function*KL(e,t,r,n){if(!Rt.IsRecordLike(n))return yield Z(E.Object,e,r,n);Pe(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield Z(E.ObjectMinProperties,e,r,n)),Pe(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield Z(E.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*nr(i,t,`${r}/${$i(s)}`,c));if(typeof e.additionalProperties=="object")for(let[s,c]of Object.entries(n))a.test(s)||(yield*nr(e.additionalProperties,t,`${r}/${$i(s)}`,c));if(e.additionalProperties===!1){for(let[s,c]of Object.entries(n))if(!a.test(s))return yield Z(E.ObjectAdditionalProperties,e,`${r}/${$i(s)}`,c)}}function*qL(e,t,r,n){yield*nr(De(e,t),t,r,n)}function*HL(e,t,r,n){if(!Ue(n))return yield Z(E.String,e,r,n);if(Pe(e.minLength)&&!(n.length>=e.minLength)&&(yield Z(E.StringMinLength,e,r,n)),Pe(e.maxLength)&&!(n.length<=e.maxLength)&&(yield Z(E.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield Z(E.RegExp,e,r,n)}function*YL(e,t,r,n){if(!Ue(n))return yield Z(E.String,e,r,n);Pe(e.minLength)&&!(n.length>=e.minLength)&&(yield Z(E.StringMinLength,e,r,n)),Pe(e.maxLength)&&!(n.length<=e.maxLength)&&(yield Z(E.StringMaxLength,e,r,n)),Ue(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield Z(E.StringPattern,e,r,n))),Ue(e.format)&&(Ki.Has(e.format)?Ki.Get(e.format)(n)||(yield Z(E.StringFormat,e,r,n)):yield Z(E.StringFormatUnknown,e,r,n))}function*WL(e,t,r,n){ei(n)||(yield Z(E.Symbol,e,r,n))}function*XL(e,t,r,n){if(!Ue(n))return yield Z(E.String,e,r,n);new RegExp(e.pattern).test(n)||(yield Z(E.StringPattern,e,r,n))}function*ZL(e,t,r,n){yield*nr(De(e,t),t,r,n)}function*QL(e,t,r,n){if(!le(n))return yield Z(E.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield Z(E.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield Z(E.TupleLength,e,r,n);if(e.items)for(let o=0;onew Ma(nr(i,t,r,n)));yield Z(E.Union,e,r,n,o)}function*tV(e,t,r,n){if(!Fs(n))return yield Z(E.Uint8Array,e,r,n);Pe(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield Z(E.Uint8ArrayMaxByteLength,e,r,n)),Pe(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield Z(E.Uint8ArrayMinByteLength,e,r,n))}function*rV(e,t,r,n){}function*nV(e,t,r,n){Rt.IsVoidLike(n)||(yield Z(E.Void,e,r,n))}function*oV(e,t,r,n){Wn.Get(e[$])(e,n)||(yield Z(E.Kind,e,r,n))}function*nr(e,t,r,n){let o=Pe(e.$id)?[...t,e]:t,i=e;switch(i[$]){case"Any":return yield*PL(i,o,r,n);case"Argument":return yield*TL(i,o,r,n);case"Array":return yield*ML(i,o,r,n);case"AsyncIterator":return yield*CL(i,o,r,n);case"BigInt":return yield*OL(i,o,r,n);case"Boolean":return yield*kL(i,o,r,n);case"Constructor":return yield*RL(i,o,r,n);case"Date":return yield*NL(i,o,r,n);case"Function":return yield*AL(i,o,r,n);case"Import":return yield*EL(i,o,r,n);case"Integer":return yield*FL(i,o,r,n);case"Intersect":return yield*$L(i,o,r,n);case"Iterator":return yield*DL(i,o,r,n);case"Literal":return yield*LL(i,o,r,n);case"Never":return yield*VL(i,o,r,n);case"Not":return yield*jL(i,o,r,n);case"Null":return yield*UL(i,o,r,n);case"Number":return yield*GL(i,o,r,n);case"Object":return yield*BL(i,o,r,n);case"Promise":return yield*zL(i,o,r,n);case"Record":return yield*KL(i,o,r,n);case"Ref":return yield*qL(i,o,r,n);case"RegExp":return yield*HL(i,o,r,n);case"String":return yield*YL(i,o,r,n);case"Symbol":return yield*WL(i,o,r,n);case"TemplateLiteral":return yield*XL(i,o,r,n);case"This":return yield*ZL(i,o,r,n);case"Tuple":return yield*QL(i,o,r,n);case"Undefined":return yield*JL(i,o,r,n);case"Union":return yield*eV(i,o,r,n);case"Uint8Array":return yield*tV(i,o,r,n);case"Unknown":return yield*rV(i,o,r,n);case"Void":return yield*nV(i,o,r,n);default:if(!Wn.Has(i[$]))throw new ew(e);return yield*oV(i,o,r,n)}}function Ca(...e){let t=e.length===3?nr(e[0],e[1],"",e[2]):nr(e[0],[],"",e[1]);return new Ma(t)}var iV=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},iO=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)},tw,Hh,aO,rw=class extends pe{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),tw.add(this),Hh.set(this,void 0),iV(this,Hh,t,"f"),this.error=r}Errors(){return new Ma(iO(this,tw,"m",aO).call(this))}};Hh=new WeakMap,tw=new WeakSet,aO=function*(){this.error&&(yield this.error),yield*iO(this,Hh,"f")};function oO(e,t,r){if(!xe(e,t,r))throw new rw(Ca(e,t,r))}function Yh(...e){return e.length===3?oO(e[0],e[1],e[2]):oO(e[0],[],e[1])}function aV(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Ne(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Ne(e[r]);return t}function sV(e){return e.map(t=>Ne(t))}function cV(e){return e.slice()}function fV(e){return new Map(Ne([...e.entries()]))}function uV(e){return new Set(Ne([...e.entries()]))}function lV(e){return new Date(e.toISOString())}function Ne(e){if(le(e))return sV(e);if(Tr(e))return lV(e);if(yn(e))return cV(e);if(_w(e))return fV(e);if(Pw(e))return uV(e);if(ge(e))return aV(e);if(Qr(e))return e;throw new Error("ValueClone: Unable to clone value")}var mn=class extends pe{constructor(t,r){super(r),this.schema=t}};function Ae(e){return ji(e)?e():Ne(e)}function pV(e,t){return ue(e,"default")?Ae(e.default):{}}function mV(e,t){return{}}function dV(e,t){if(e.uniqueItems===!0&&!ue(e,"default"))throw new mn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!ue(e,"default"))throw new mn(e,"Array with the contains constraint requires a default value");return"default"in e?Ae(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>dn(e.items,t)):[]}function hV(e,t){return ue(e,"default")?Ae(e.default):(async function*(){})()}function gV(e,t){return ue(e,"default")?Ae(e.default):BigInt(0)}function yV(e,t){return ue(e,"default")?Ae(e.default):!1}function bV(e,t){if(ue(e,"default"))return Ae(e.default);{let r=dn(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 xV(e,t){return ue(e,"default")?Ae(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function wV(e,t){return ue(e,"default")?Ae(e.default):()=>dn(e.returns,t)}function SV(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return dn(n,[...t,...r])}function vV(e,t){return ue(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function IV(e,t){if(ue(e,"default"))return Ae(e.default);{let r=e.allOf.reduce((n,o)=>{let i=dn(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!xe(e,t,r))throw new mn(e,"Intersect produced invalid value. Consider using a default value.");return r}}function _V(e,t){return ue(e,"default")?Ae(e.default):(function*(){})()}function PV(e,t){return ue(e,"default")?Ae(e.default):e.const}function TV(e,t){if(ue(e,"default"))return Ae(e.default);throw new mn(e,"Never types cannot be created. Consider using a default value.")}function MV(e,t){if(ue(e,"default"))return Ae(e.default);throw new mn(e,"Not types must have a default value")}function CV(e,t){return ue(e,"default")?Ae(e.default):null}function OV(e,t){return ue(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function kV(e,t){if(ue(e,"default"))return Ae(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=dn(i,t));return n}}function RV(e,t){return ue(e,"default")?Ae(e.default):Promise.resolve(dn(e.item,t))}function NV(e,t){return ue(e,"default")?Ae(e.default):{}}function AV(e,t){return ue(e,"default")?Ae(e.default):dn(De(e,t),t)}function EV(e,t){if(ue(e,"default"))return Ae(e.default);throw new mn(e,"RegExp types cannot be created. Consider using a default value.")}function FV(e,t){if(e.pattern!==void 0){if(ue(e,"default"))return Ae(e.default);throw new mn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(ue(e,"default"))return Ae(e.default);throw new mn(e,"String types with formats must specify a default value")}else return ue(e,"default")?Ae(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function $V(e,t){return ue(e,"default")?Ae(e.default):"value"in e?Symbol.for(e.value):Symbol()}function DV(e,t){if(ue(e,"default"))return Ae(e.default);if(!Kl(e))throw new mn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return zs(e)[0]}function LV(e,t){if(sO++>qV)throw new mn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return ue(e,"default")?Ae(e.default):dn(De(e,t),t)}function VV(e,t){return ue(e,"default")?Ae(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>dn(e.items[n],t))}function jV(e,t){if(ue(e,"default"))return Ae(e.default)}function UV(e,t){if(ue(e,"default"))return Ae(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return dn(e.anyOf[0],t)}function GV(e,t){return ue(e,"default")?Ae(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function BV(e,t){return ue(e,"default")?Ae(e.default):{}}function zV(e,t){if(ue(e,"default"))return Ae(e.default)}function KV(e,t){if(ue(e,"default"))return Ae(e.default);throw new Error("User defined types must specify a default value")}function dn(e,t){let r=tr(e,t),n=e;switch(n[$]){case"Any":return pV(n,r);case"Argument":return mV(n,r);case"Array":return dV(n,r);case"AsyncIterator":return hV(n,r);case"BigInt":return gV(n,r);case"Boolean":return yV(n,r);case"Constructor":return bV(n,r);case"Date":return xV(n,r);case"Function":return wV(n,r);case"Import":return SV(n,r);case"Integer":return vV(n,r);case"Intersect":return IV(n,r);case"Iterator":return _V(n,r);case"Literal":return PV(n,r);case"Never":return TV(n,r);case"Not":return MV(n,r);case"Null":return CV(n,r);case"Number":return OV(n,r);case"Object":return kV(n,r);case"Promise":return RV(n,r);case"Record":return NV(n,r);case"Ref":return AV(n,r);case"RegExp":return EV(n,r);case"String":return FV(n,r);case"Symbol":return $V(n,r);case"TemplateLiteral":return DV(n,r);case"This":return LV(n,r);case"Tuple":return VV(n,r);case"Undefined":return jV(n,r);case"Union":return UV(n,r);case"Uint8Array":return GV(n,r);case"Unknown":return BV(n,r);case"Void":return zV(n,r);default:if(!Wn.Has(n[$]))throw new mn(n,"Unknown type");return KV(n,r)}}var qV=512,sO=0;function uo(...e){return sO=0,e.length===2?dn(e[0],e[1]):dn(e[0],[])}var Wh=class extends pe{constructor(t,r){super(r),this.schema=t}};function cO(e,t,r){if(e[$]==="Object"&&typeof r=="object"&&!Jo(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,p=o.includes(s)?1:0;return a+(u+f+p)},0)}else if(e[$]==="Union"){let o=e.anyOf.map(i=>De(i,t)).map(i=>cO(i,t,r));return Math.max(...o)}else return xe(e,t,r)?1:0}function HV(e,t,r){let n=e.anyOf.map(a=>De(a,t)),[o,i]=[n[0],0];for(let a of n){let s=cO(a,t,r);s>i&&(o=a,i=s)}return o}function YV(e,t,r){if("default"in e)return typeof r=="function"?e.default:Ne(e.default);{let n=HV(e,t,r);return Cl(n,t,r)}}function WV(e,t,r){return xe(e,t,r)?Ne(r):uo(e,t)}function XV(e,t,r){return xe(e,t,r)?r:uo(e,t)}function ZV(e,t,r){if(xe(e,t,r))return Ne(r);let n=le(r)?Ne(r):uo(e,t),o=st(e.minItems)&&n.lengthnull)]:n,a=(st(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>lo(e.items,t,c));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!xe(e,t,s))throw new Wh(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function QV(e,t,r){if(xe(e,t,r))return uo(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]=lo(a,t,r.prototype[i]));return o}function JV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return lo(o,[...t,...n],r)}function fO(e,t){return ge(e)&&!ge(t)||!ge(e)&&ge(t)?e:!ge(e)||!ge(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?fO(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function ej(e,t,r){if(xe(e,t,r))return r;let n=uo(e,t),o=fO(n,r);return xe(e,t,o)?o:n}function tj(e,t,r){throw new Wh(e,"Never types cannot be cast")}function rj(e,t,r){if(xe(e,t,r))return r;if(r===null||typeof r!="object")return uo(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]=lo(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]=lo(e.additionalProperties,t,r[a]))}return o}function nj(e,t,r){if(xe(e,t,r))return Ne(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return uo(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=lo(o,t,s);return i}function oj(e,t,r){return lo(De(e,t),t,r)}function ij(e,t,r){return lo(De(e,t),t,r)}function aj(e,t,r){return xe(e,t,r)?Ne(r):le(r)?e.items===void 0?[]:e.items.map((n,o)=>lo(n,t,r[o])):uo(e,t)}function sj(e,t,r){return xe(e,t,r)?Ne(r):YV(e,t,r)}function lo(e,t,r){let n=Ue(e.$id)?tr(e,t):t,o=e;switch(e[$]){case"Array":return ZV(o,n,r);case"Constructor":return QV(o,n,r);case"Import":return JV(o,n,r);case"Intersect":return ej(o,n,r);case"Never":return tj(o,n,r);case"Object":return rj(o,n,r);case"Record":return nj(o,n,r);case"Ref":return oj(o,n,r);case"This":return ij(o,n,r);case"Tuple":return aj(o,n,r);case"Union":return sj(o,n,r);case"Date":case"Symbol":case"Uint8Array":return WV(e,t,r);default:return XV(o,n,r)}}function Cl(...e){return e.length===3?lo(e[0],e[1],e[2]):lo(e[0],[],e[1])}function cj(e){return Gi(e)&&e[$]!=="Unsafe"}function fj(e,t,r){return le(r)?r.map(n=>Wr(e.items,t,n)):r}function uj(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Wr(o,[...t,...n],r)}function lj(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>Wr(s,t,Ne(r))).reduce((s,c)=>ge(c)?{...s,...c}:c,{});if(!ge(r)||!ge(i)||!Gi(n))return i;let a=Vr(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||xe(n,t,r[s])&&(i[s]=Wr(n,t,r[s]));return i}function pj(e,t,r){if(!ge(r)||le(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(ue(e.properties,o)){r[o]=Wr(e.properties[o],t,r[o]);continue}if(Gi(n)&&xe(n,t,r[o])){r[o]=Wr(n,t,r[o]);continue}delete r[o]}return r}function mj(e,t,r){if(!ge(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]=Wr(a,t,r[c]);continue}if(Gi(n)&&xe(n,t,r[c])){r[c]=Wr(n,t,r[c]);continue}delete r[c]}return r}function dj(e,t,r){return Wr(De(e,t),t,r)}function hj(e,t,r){return Wr(De(e,t),t,r)}function gj(e,t,r){if(!le(r))return r;if(at(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function yj(e,t,r){for(let n of e.anyOf)if(cj(n)&&xe(n,t,r))return Wr(n,t,r);return r}function Wr(e,t,r){let n=Ue(e.$id)?tr(e,t):t,o=e;switch(o[$]){case"Array":return fj(o,n,r);case"Import":return uj(o,n,r);case"Intersect":return lj(o,n,r);case"Object":return pj(o,n,r);case"Record":return mj(o,n,r);case"Ref":return dj(o,n,r);case"This":return hj(o,n,r);case"Tuple":return gj(o,n,r);case"Union":return yj(o,n,r);default:return r}}function Xh(...e){return e.length===3?Wr(e[0],e[1],e[2]):Wr(e[0],[],e[1])}function Zh(e){return Ue(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function bj(e){return Un(e)||yo(e)||st(e)}function Ol(e){return e===!0||st(e)&&e===1||Un(e)&&e===BigInt("1")||Ue(e)&&(e.toLowerCase()==="true"||e==="1")}function kl(e){return e===!1||st(e)&&(e===0||Object.is(e,-0))||Un(e)&&e===BigInt("0")||Ue(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function xj(e){return Ue(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function wj(e){return Ue(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function Sj(e){return Ue(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 vj(e){return Ue(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 Ij(e){return Ue(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function _j(e,t){let r=lO(e);return r===t?r:e}function Pj(e,t){let r=pO(e);return r===t?r:e}function Tj(e,t){let r=uO(e);return r===t?r:e}function Mj(e,t){return Ue(e.const)?_j(t,e.const):st(e.const)?Pj(t,e.const):yo(e.const)?Tj(t,e.const):t}function uO(e){return Ol(e)?!0:kl(e)?!1:e}function Cj(e){let t=r=>r.split(".")[0];return Zh(e)?BigInt(t(e)):st(e)?BigInt(Math.trunc(e)):kl(e)?BigInt(0):Ol(e)?BigInt(1):e}function lO(e){return ei(e)&&e.description!==void 0?e.description.toString():bj(e)?e.toString():e}function pO(e){return Zh(e)?parseFloat(e):Ol(e)?1:kl(e)?0:e}function Oj(e){return Zh(e)?parseInt(e):st(e)?Math.trunc(e):Ol(e)?1:kl(e)?0:e}function kj(e){return Ue(e)&&e.toLowerCase()==="null"?null:e}function Rj(e){return Ue(e)&&e==="undefined"?void 0:e}function Nj(e){return Tr(e)?e:st(e)?new Date(e):Ol(e)?new Date(1):kl(e)?new Date(0):Zh(e)?new Date(parseInt(e)):wj(e)?new Date(`1970-01-01T${e}.000Z`):xj(e)?new Date(`1970-01-01T${e}`):vj(e)?new Date(`${e}.000Z`):Sj(e)?new Date(e):Ij(e)?new Date(`${e}T00:00:00.000Z`):e}function Aj(e,t,r){return(le(r)?r:[r]).map(o=>po(e.items,t,o))}function Ej(e,t,r){return Cj(r)}function Fj(e,t,r){return uO(r)}function $j(e,t,r){return Nj(r)}function Dj(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return po(o,[...t,...n],r)}function Lj(e,t,r){return Oj(r)}function Vj(e,t,r){return e.allOf.reduce((n,o)=>po(o,t,n),r)}function jj(e,t,r){return Mj(e,r)}function Uj(e,t,r){return kj(r)}function Gj(e,t,r){return pO(r)}function Bj(e,t,r){if(!ge(r)||le(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))ue(r,n)&&(r[n]=po(e.properties[n],t,r[n]));return r}function zj(e,t,r){if(!(ge(r)&&!le(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=po(i,t,s);return r}function Kj(e,t,r){return po(De(e,t),t,r)}function qj(e,t,r){return lO(r)}function Hj(e,t,r){return Ue(r)||st(r)?Symbol(r):r}function Yj(e,t,r){return po(De(e,t),t,r)}function Wj(e,t,r){return le(r)&&!at(e.items)?r.map((o,i)=>imo(e.items,t,`${r}/${i}`,o))):dt(e,r,n)}function Jj(e,t,r,n){if(!ge(n)||Qr(n))return dt(e,r,n);let o=Xl(e),i=o.map(f=>f[0]),a={...n};for(let[f,p]of o)f in a&&(a[f]=mo(p,t,`${r}/${f}`,a[f]));if(!Ee(e.unevaluatedProperties))return dt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=dt(c,`${r}/${f}`,u[f]));return dt(e,r,u)}function eU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=mo(i,[...t,...o],r,n);return dt(e,r,a)}function tU(e,t,r,n){return dt(e,r,mo(e.not,t,r,n))}function rU(e,t,r,n){if(!ge(n))return dt(e,r,n);let o=Vr(e),i={...n};for(let u of o)ue(i,u)&&(at(i[u])&&(!ni(e.properties[u])||Rt.IsExactOptionalProperty(i,u))||(i[u]=mo(e.properties[u],t,`${r}/${u}`,i[u])));if(!lt(e.additionalProperties))return dt(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,c={...i};for(let u of a)o.includes(u)||(c[u]=dt(s,`${r}/${u}`,c[u]));return dt(e,r,c)}function nU(e,t,r,n){if(!ge(n))return dt(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]=mo(e.patternProperties[o],t,`${r}/${f}`,a[f]));if(!lt(e.additionalProperties))return dt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.test(f)||(u[f]=dt(c,`${r}/${f}`,u[f]));return dt(e,r,u)}function oU(e,t,r,n){let o=De(e,t);return dt(e,r,mo(o,t,r,n))}function iU(e,t,r,n){let o=De(e,t);return dt(e,r,mo(o,t,r,n))}function aU(e,t,r,n){return le(n)&&le(e.items)?dt(e,r,e.items.map((o,i)=>mo(o,t,`${r}/${i}`,n[i]))):dt(e,r,n)}function sU(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=mo(o,t,r,n);return dt(e,r,i)}return dt(e,r,n)}function mo(e,t,r,n){let o=tr(e,t),i=e;switch(e[$]){case"Array":return Qj(i,o,r,n);case"Import":return eU(i,o,r,n);case"Intersect":return Jj(i,o,r,n);case"Not":return tU(i,o,r,n);case"Object":return rU(i,o,r,n);case"Record":return nU(i,o,r,n);case"Ref":return oU(i,o,r,n);case"Symbol":return dt(i,r,n);case"This":return iU(i,o,r,n);case"Tuple":return aU(i,o,r,n);case"Union":return sU(i,o,r,n);default:return dt(i,r,n)}}function eg(e,t,r){return mo(e,t,"",r)}var tg=class extends pe{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},ow=class extends pe{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 dr(e,t,r){try{return Ee(e)?e[ut].Encode(r):r}catch(n){throw new ow(e,t,r,n)}}function cU(e,t,r,n){let o=dr(e,r,n);return le(o)?o.map((i,a)=>ho(e.items,t,`${r}/${a}`,i)):o}function fU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=dr(e,r,n);return ho(i,[...t,...o],r,a)}function uU(e,t,r,n){let o=dr(e,r,n);if(!ge(n)||Qr(n))return o;let i=Xl(e),a=i.map(p=>p[0]),s={...o};for(let[p,l]of i)p in s&&(s[p]=ho(l,t,`${r}/${p}`,s[p]));if(!Ee(e.unevaluatedProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.unevaluatedProperties,f={...s};for(let p of c)a.includes(p)||(f[p]=dr(u,`${r}/${p}`,f[p]));return f}function lU(e,t,r,n){return dr(e.not,r,dr(e,r,n))}function pU(e,t,r,n){let o=dr(e,r,n);if(!ge(o))return o;let i=Vr(e),a={...o};for(let f of i)ue(a,f)&&(at(a[f])&&(!ni(e.properties[f])||Rt.IsExactOptionalProperty(a,f))||(a[f]=ho(e.properties[f],t,`${r}/${f}`,a[f])));if(!lt(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=dr(c,`${r}/${f}`,u[f]));return u}function mU(e,t,r,n){let o=dr(e,r,n);if(!ge(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(i),s={...o};for(let p of Object.getOwnPropertyNames(n))a.test(p)&&(s[p]=ho(e.patternProperties[i],t,`${r}/${p}`,s[p]));if(!lt(e.additionalProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.additionalProperties,f={...s};for(let p of c)a.test(p)||(f[p]=dr(u,`${r}/${p}`,f[p]));return f}function dU(e,t,r,n){let o=De(e,t),i=ho(o,t,r,n);return dr(e,r,i)}function hU(e,t,r,n){let o=De(e,t),i=ho(o,t,r,n);return dr(e,r,i)}function gU(e,t,r,n){let o=dr(e,r,n);return le(e.items)?e.items.map((i,a)=>ho(i,t,`${r}/${a}`,o[a])):[]}function yU(e,t,r,n){for(let o of e.anyOf){if(!xe(o,t,n))continue;let i=ho(o,t,r,n);return dr(e,r,i)}for(let o of e.anyOf){let i=ho(o,t,r,n);if(xe(e,t,i))return dr(e,r,i)}return dr(e,r,n)}function ho(e,t,r,n){let o=tr(e,t),i=e;switch(e[$]){case"Array":return cU(i,o,r,n);case"Import":return fU(i,o,r,n);case"Intersect":return uU(i,o,r,n);case"Not":return lU(i,o,r,n);case"Object":return pU(i,o,r,n);case"Record":return mU(i,o,r,n);case"Ref":return dU(i,o,r,n);case"This":return hU(i,o,r,n);case"Tuple":return gU(i,o,r,n);case"Union":return yU(i,o,r,n);default:return dr(i,r,n)}}function rg(e,t,r){return ho(e,t,"",r)}function bU(e,t){return Ee(e)||Gt(e.items,t)}function xU(e,t){return Ee(e)||Gt(e.items,t)}function wU(e,t){return Ee(e)||Gt(e.returns,t)||e.parameters.some(r=>Gt(r,t))}function SU(e,t){return Ee(e)||Gt(e.returns,t)||e.parameters.some(r=>Gt(r,t))}function vU(e,t){return Ee(e)||Ee(e.unevaluatedProperties)||e.allOf.some(r=>Gt(r,t))}function IU(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Ee(e)||Gt(n,[...r,...t])}function _U(e,t){return Ee(e)||Gt(e.items,t)}function PU(e,t){return Ee(e)||Gt(e.not,t)}function TU(e,t){return Ee(e)||Object.values(e.properties).some(r=>Gt(r,t))||lt(e.additionalProperties)&&Gt(e.additionalProperties,t)}function MU(e,t){return Ee(e)||Gt(e.item,t)}function CU(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Ee(e)||Gt(n,t)||lt(e.additionalProperties)&&Ee(e.additionalProperties)}function OU(e,t){return Ee(e)?!0:Gt(De(e,t),t)}function kU(e,t){return Ee(e)?!0:Gt(De(e,t),t)}function RU(e,t){return Ee(e)||!at(e.items)&&e.items.some(r=>Gt(r,t))}function NU(e,t){return Ee(e)||e.anyOf.some(r=>Gt(r,t))}function Gt(e,t){let r=tr(e,t),n=e;if(e.$id&&iw.has(e.$id))return!1;switch(e.$id&&iw.add(e.$id),e[$]){case"Array":return bU(n,r);case"AsyncIterator":return xU(n,r);case"Constructor":return wU(n,r);case"Function":return SU(n,r);case"Import":return IU(n,r);case"Intersect":return vU(n,r);case"Iterator":return _U(n,r);case"Not":return PU(n,r);case"Object":return TU(n,r);case"Promise":return MU(n,r);case"Record":return CU(n,r);case"Ref":return OU(n,r);case"This":return kU(n,r);case"Tuple":return RU(n,r);case"Union":return NU(n,r);default:return Ee(e)}}var iw=new Set;function Cs(e,t){return iw.clear(),Gt(e,t)}function mO(...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 Jh(t,n,Ca(t,r,n).First());return Cs(t,r)?eg(t,r,n):n}function Di(e,t){let r=ue(e,"default")?e.default:void 0,n=ji(r)?r():Ne(r);return at(t)?n:ge(t)&&ge(n)?Object.assign(n,t):t}function aw(e){return Gi(e)&&"default"in e}function AU(e,t,r){if(le(r)){for(let o=0;o{let a=Er(i,t,n);return ge(a)?{...o,...a}:a},{})}function DU(e,t,r){let n=Di(e,r);if(!ge(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=Er(e.properties[i],t,n[i]);at(a)||(n[i]=Er(e.properties[i],t,n[i]))}if(!aw(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=Er(e.additionalProperties,t,n[i]));return n}function LU(e,t,r){let n=Di(e,r);if(!ge(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)&&aw(a)&&(n[c]=Er(a,t,n[c]));if(!aw(o))return n;for(let c of Object.getOwnPropertyNames(n))s.test(c)||(n[c]=Er(o,t,n[c]));return n}function VU(e,t,r){return Er(De(e,t),t,Di(e,r))}function jU(e,t,r){return Er(De(e,t),t,r)}function UU(e,t,r){let n=Di(e,r);if(!le(n)||at(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;azU,Format:()=>Rl,Get:()=>qU,Has:()=>KU,Set:()=>BU,ValuePointerRootDeleteError:()=>ig,ValuePointerRootSetError:()=>og});var og=class extends pe{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},ig=class extends pe{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function dO(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*Rl(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;nOs(e[o],t[o]))}function YU(e,t){return Tr(t)&&e.getTime()===t.getTime()}function WU(e,t){return!le(t)||e.length!==t.length?!1:e.every((r,n)=>Os(r,t[n]))}function XU(e,t){return!yn(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>Os(r,t[n]))}function ZU(e,t){return e===t}function Os(e,t){if(Tr(e))return YU(e,t);if(yn(e))return XU(e,t);if(le(e))return WU(e,t);if(ge(e))return HU(e,t);if(Qr(e))return ZU(e,t);throw new Error("ValueEquals: Unable to compare value")}var QU=$e({type:Oe("insert"),path:Mr(),value:Xn()}),JU=$e({type:Oe("update"),path:Mr(),value:Xn()}),eG=$e({type:Oe("delete"),path:Mr()}),gO=Fe([QU,JU,eG]),ag=class extends pe{constructor(t,r){super(r),this.value=t}};function sg(e,t){return{type:"update",path:e,value:t}}function yO(e,t){return{type:"insert",path:e,value:t}}function bO(e){return{type:"delete",path:e}}function hO(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new ag(e,"Cannot diff objects with symbols")}function*tG(e,t,r){if(hO(t),hO(r),!Ag(r))return yield sg(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)ue(t,i)||(yield yO(`${e}/${i}`,r[i]));for(let i of n)ue(r,i)&&(Os(t,r)||(yield*cg(`${e}/${i}`,t[i],r[i])));for(let i of n)ue(r,i)||(yield bO(`${e}/${i}`))}function*rG(e,t,r){if(!le(r))return yield sg(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function aG(e){return e.length===0}function wO(e,t){if(iG(t))return Ne(t[0].value);if(aG(t))return Ne(e);let r=Ne(e);for(let n of t)switch(n.type){case"insert":{go.Set(r,n.path,n.value);break}case"update":{go.Set(r,n.path,n.value);break}case"delete":{go.Delete(r,n.path);break}}return r}function SO(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Cs(t,r)?rg(t,r,n):n;if(!xe(t,r,o))throw new tg(t,o,Ca(t,r,o).First());return o}function fg(e){return ge(e)&&!le(e)}var ug=class extends pe{constructor(t){super(t)}};function sG(e,t,r,n){if(!fg(r))go.Set(e,t,Ne(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)sw(e,`${t}/${a}`,r[a],n[a])}}function cG(e,t,r,n){if(!le(r))go.Set(e,t,Ne(n));else{for(let o=0;o(Yh(i,a,s),s)],["Cast",(i,a,s)=>Cl(i,a,s)],["Clean",(i,a,s)=>Xh(i,a,s)],["Clone",(i,a,s)=>Ne(s)],["Convert",(i,a,s)=>Qh(i,a,s)],["Decode",(i,a,s)=>Cs(i,a)?eg(i,a,s):s],["Default",(i,a,s)=>ng(i,a,s)],["Encode",(i,a,s)=>Cs(i,a)?rg(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})(cw||(cw={}));var _O=["Clone","Clean","Default","Convert","Assert","Decode"];function pG(e,t,r,n){return e.reduce((o,i)=>{let a=cw.Get(i);if(at(a))throw new lg(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function PO(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?le(e[0])?[e[0],e[1],[],e[2]]:[_O,e[0],e[1],e[2]]:e.length===2?[_O,e[0],[],e[1]]:(()=>{throw new lg("Invalid Arguments")})();return pG(t,r,n,o)}var bf={};Ra(bf,{Assert:()=>Yh,Cast:()=>Cl,Check:()=>xe,Clean:()=>Xh,Clone:()=>Ne,Convert:()=>Qh,Create:()=>uo,Decode:()=>mO,Default:()=>ng,Diff:()=>xO,Edit:()=>gO,Encode:()=>SO,Equal:()=>Os,Errors:()=>Ca,Hash:()=>yf,Mutate:()=>IO,Parse:()=>PO,Patch:()=>wO,ValueErrorIterator:()=>Ma});function pg(e){switch(e.type){case"summary_metrics":return X1(e);case"performance_table":return H1(e);case"prediction_distribution":return Y1(e);case"roc":return j1(e);case"calibration":return Z6(e);case"precision_recall":return G1(e);case"gains":return B1(e);case"lift":return z1(e);case"decision_curve":return K1(e);case"interventions_avoided":return q1(e)}}function Yo(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 fw(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 mG(e){if(!bf.Check(up,e))throw new Error("Invalid ReportSpec");pp(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(pg(r.spec)),n.append(o),t.append(n)}return t}function dG(e,t){if(!bf.Check(lp,e))throw new Error("Invalid ReportSpec");pp(e);let r=!!e.title,n=new Set,o=document.createElement("article");if(o.className="rtichoke-report",e.title){let m=document.createElement("header");m.className="rtichoke-report__header";let h=document.createElement("h1");h.className="rtichoke-report__title",h.textContent=e.title,m.append(h),o.append(m)}let i=[],a=0;for(let m of e.sections){let h=Yo(m.id,n);a++;let b=[];for(let y of m.items)if(y.type==="group"){let x=Yo(y.id,n);a++,b.push({rawId:y.id,title:y.title,domId:x})}i.push({rawId:m.id,title:m.title,domId:h,groups:b})}if(a>1){let m=document.createElement("nav");m.className="rtichoke-report__nav",m.setAttribute("aria-label","Report sections");let h=document.createElement("ul");h.className="rtichoke-report__nav-list";for(let b of i){let y=document.createElement("li");y.className="rtichoke-report__nav-item";let x=document.createElement("a");if(x.className="rtichoke-report__nav-link",x.href=`#${b.domId}`,x.textContent=b.title,y.append(x),b.groups.length>0){let g=document.createElement("ul");g.className="rtichoke-report__nav-sublist";for(let S of b.groups){let w=document.createElement("li");w.className="rtichoke-report__nav-subitem";let _=document.createElement("a");_.className="rtichoke-report__nav-link",_.href=`#${S.domId}`,_.textContent=S.title,w.append(_),g.append(w)}y.append(g)}h.append(y)}m.append(h),o.append(m)}let s=r?"h2":"h1",c=r?"h3":"h2",u=r?"h3":"h2",f=r?"h4":"h3",p=(m,h)=>{let b=document.createElement("section");if(b.className="rtichoke-report__component",b.dataset.componentId=m.id,m.title){let x=Yo(`heading-${m.id}`,n),g=document.createElement(h);g.className="rtichoke-report__component-title",g.id=x,g.textContent=m.title,b.setAttribute("aria-labelledby",x),b.append(g)}let y=document.createElement("div");return y.className="rtichoke-report__component-content",y.append(pg(m.spec)),b.append(y),b},l=(m,h,b)=>{let y=document.createElement("section");y.className="rtichoke-report__group",y.id=h.domId,y.dataset.groupId=m.id;let x=Yo(`heading-${m.id}`,n),g=document.createElement(c);if(g.className="rtichoke-report__group-title",b&&g.classList.add("rtichoke-report__group-title--tab-panel"),g.id=x,g.textContent=m.title,y.setAttribute("aria-labelledby",b??x),y.append(g),t.groupPresentation==="tabs"){let S=document.createElement("div");S.className="rtichoke-report__tablist",S.setAttribute("role","tablist"),S.setAttribute("aria-labelledby",x);let w=[],_=[];m.components.forEach((v,I)=>{let T=Yo(`tab-${m.id}-${v.id}`,n),P=Yo(`panel-${m.id}-${v.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",P),R.setAttribute("aria-selected",I===0?"true":"false"),R.tabIndex=I===0?0:-1,R.textContent=v.title||v.id;let k=document.createElement("section");k.className="rtichoke-report__component rtichoke-report__tabpanel",k.id=P,k.setAttribute("role","tabpanel"),k.setAttribute("aria-labelledby",T),k.tabIndex=0,k.dataset.componentId=v.id,k.hidden=I!==0;let N=document.createElement("div");N.className="rtichoke-report__component-content",N.append(pg(v.spec)),k.append(N),w.push(R),_.push(k),S.append(R)}),fw(w,_),y.append(S,..._)}else for(let S of m.components)y.append(p(S,f));return y};for(let m=0;mT.type==="group"),w=t.sectionGroupPresentation==="tabs"&&S.length>1,_=0,v=!1,I=0;for(;I1){let N=document.createElement("div");N.className="rtichoke-report__tablist",N.setAttribute("role","tablist"),N.setAttribute("aria-labelledby",x);let B=[],V=[];R.forEach((C,G)=>{let j=Yo(`tab-${h.id}-${C.id}`,n),H=Yo(`panel-${h.id}-${C.id}`,n),U=document.createElement("button");U.className="rtichoke-report__tab",U.type="button",U.id=j,U.setAttribute("role","tab"),U.setAttribute("aria-controls",H),U.setAttribute("aria-selected",G===0?"true":"false"),U.tabIndex=G===0?0:-1,U.textContent=C.title||C.id;let z=document.createElement("section");z.className="rtichoke-report__component rtichoke-report__tabpanel",z.id=H,z.setAttribute("role","tabpanel"),z.setAttribute("aria-labelledby",j),z.tabIndex=0,z.dataset.componentId=C.id,z.hidden=G!==0;let Y=document.createElement("div");Y.className="rtichoke-report__component-content",Y.append(pg(C.spec)),z.append(Y),B.push(U),V.push(z),N.append(U)}),fw(B,V),y.append(N,...V),I=P}else y.append(p(T,u)),I++}else if(T.type==="group"){if(w){if(!v){v=!0;let P=document.createElement("div");P.className="rtichoke-report__tablist rtichoke-report__section-group-tablist",P.setAttribute("role","tablist"),P.setAttribute("aria-labelledby",x);let R=[],k=[];S.forEach((N,B)=>{let V=b.groups[B],C=Yo(`section-group-tab-${h.id}-${N.id}`,n),G=document.createElement("button");G.className="rtichoke-report__tab",G.type="button",G.id=C,G.setAttribute("role","tab"),G.setAttribute("aria-controls",V.domId),G.setAttribute("aria-selected",B===0?"true":"false"),G.tabIndex=B===0?0:-1,G.textContent=N.title;let j=l(N,V,C);j.classList.add("rtichoke-report__tabpanel"),j.setAttribute("role","tabpanel"),j.setAttribute("aria-labelledby",C),j.tabIndex=0,j.hidden=B!==0,R.push(G),k.push(j),P.append(G)}),fw(R,k),y.append(P,...k)}}else y.append(l(T,b.groups[_++]));I++}}o.append(y)}return o}function hG(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 mG(e);if(e.schemaVersion==="1.1")return dG(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var gG=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function yG(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[jt(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(jt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),qo({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:gG},marks:r})}export{Py as AUROCSummaryMetricSchema,ly as CalibrationSpecSchema,GS as CalibrationV2DatumSchema,dy as CalibrationV2SpecSchema,YS as DecisionCurveV2DatumSchema,WS as DecisionCurveV2EvaluationSchema,JS as DecisionCurveV2ReferenceSchema,XS as DecisionCurveV2SeriesSchema,yy as DecisionCurveV2SpecSchema,jS as DiscreteCalibrationV2DatumSchema,LS as DisplayGroupingSpecSchema,DS as DisplayRoleSchema,on as EvaluationSpecSchema,by as GainsV2SpecSchema,ov as InterventionsAvoidedTreatAllReferenceSchema,iv as InterventionsAvoidedTreatNoneReferenceSchema,tv as InterventionsAvoidedV2DatumSchema,rv as InterventionsAvoidedV2EvaluationSchema,av as InterventionsAvoidedV2ReferenceSchema,nv as InterventionsAvoidedV2SeriesSchema,xy as InterventionsAvoidedV2SpecSchema,wy as LiftV2SpecSchema,jf as OperatingPointDimensionSchema,zS as OperatingPointSchema,ai as OperatingPointSpecSchema,KS as PerformanceEvaluationContextSchema,BS as PerformanceMetricDefinitionSchema,hy as PerformanceMetricIdSchema,xr as PerformanceMetricValueSchema,qS as PerformanceTableRowSchema,gy as PerformanceTableSpecSchema,_y as PopulationSummaryOwnerSpecSchema,Sy as PrecisionRecallV2SpecSchema,sv as PredictionDistributionBinSchema,cv as PredictionDistributionOperatingPointSchema,Uf as PredictionDistributionSpecSchema,Ty as PrevalenceSummaryMetricSchema,_r as RTICHOKE_BROWSER_THEME,Y6 as RTICHOKE_COLORS,VS as ReferenceLineV2SpecSchema,uv as ReportComponentSchema,Oy as ReportComponentV1_1Schema,lv as ReportGroupSchema,pv as ReportSectionSchema,BR as ReportSpecSchema,up as ReportSpecV1_0Schema,lp as ReportSpecV1_1Schema,py as RocSpecSchema,vy as RocV2SpecSchema,MR as RtichokeChartSpecSchema,Iy as RtichokeChartSpecV2Schema,rc as SeriesSpecSchema,US as SmoothCalibrationV2DatumSchema,Cy as StandaloneCanonicalSpecSchema,jR as SummaryMetricSchema,My as SummaryMetricsSpecSchema,QS as TreatAllReferenceSchema,ZS as TreatNoneReferenceSchema,ky as assertPerformanceTableReferentialIntegrity,Gf as assertPredictionDistributionReferentialIntegrity,pp as assertReportReferentialIntegrity,Ry as assertSummaryMetricsReferentialIntegrity,si as assertV2ReferentialIntegrity,qR as calibrationSpecFromRtichokeRows,XR as calibrationV2SpecFromRtichokeRows,W6 as extractOperatingPointValues,J6 as preparePredictionDistributionPlotData,j$ as renderCalibration,aD as renderCalibrationV2,K1 as renderDecisionCurveV2,B1 as renderGainsV2,q1 as renderInterventionsAvoidedV2,z1 as renderLiftV2,H1 as renderPerformanceTable,G1 as renderPrecisionRecallV2,Y1 as renderPredictionDistribution,hG as renderReport,yG as renderRoc,j1 as renderRocV2,X1 as renderSummaryMetrics,Ts as renderWithOperatingPointSelection,Ln as resolveV2RenderOptions,KR as rocSpecFromRtichokePython,zR as rocSpecFromRtichokeR,WR as rocV2SpecFromRtichokePython,YR as rocV2SpecFromRtichokeR}; diff --git a/tests/test_rtichoke_viz_vendor.py b/tests/test_rtichoke_viz_vendor.py index 263909b5..88f98a0d 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.22.3" -_SHA256 = "9ad35b6acae507ff5017a936404066ef43a86282c374d88b9c32e9358f3bf572" -_SOURCE_COMMIT = "05a2d9d96a9a3fafcd484da8ecaa28b331906f90" +_RELEASE_DIR = "rtichoke-viz-0.23.0" +_SHA256 = "55bc510522f3efeb62faaec24fe6a6476169ee05002be8f24cb812c99031384a" +_SOURCE_COMMIT = "7cbdf940f5375b771e741191b875b07cd6935fe3" -def test_vendored_rtichoke_viz_v0223_provenance_archive_and_schemas(): +def test_vendored_rtichoke_viz_v0230_provenance_archive_and_schemas(): provenance = (_VENDOR / "VENDORED_FROM").read_text() - assert "release=v0.22.3" in provenance + assert "release=v0.23.0" in provenance assert f"source_commit={_SOURCE_COMMIT}" in provenance - assert "archive=rtichoke-viz-0.22.3.tar.gz" in provenance + assert "archive=rtichoke-viz-0.23.0.tar.gz" in provenance assert f"sha256={_SHA256}" in provenance - archive = _VENDOR / "rtichoke-viz-0.22.3.tar.gz" + archive = _VENDOR / "rtichoke-viz-0.23.0.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_v0223_provenance_archive_and_schemas(): manifest = release.extractfile(f"{_RELEASE_DIR}/MANIFEST") assert manifest is not None assert manifest.read().decode() == ( - f"version=0.22.3\ncommit={_SOURCE_COMMIT}\n" + f"version=0.23.0\ncommit={_SOURCE_COMMIT}\n" ) for filename in ( "rtichoke-viz.css", @@ -43,6 +43,7 @@ def test_vendored_rtichoke_viz_v0223_provenance_archive_and_schemas(): assert packaged is not None assert (_VENDOR / filename).read_bytes() == packaged.read() + assert not (_VENDOR / "rtichoke-viz-0.22.3.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.22.2.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.22.1.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.22.0.tar.gz").exists() @@ -65,7 +66,7 @@ def test_vendored_rtichoke_viz_v0223_provenance_archive_and_schemas(): assert '"summary_metrics"' in report_schema -def test_v0223_bundle_keeps_existing_exports_and_prediction_distribution(): +def test_v0230_bundle_keeps_existing_exports_and_prediction_distribution(): bundle = (_VENDOR / "rtichoke-viz.js").read_text(encoding="utf-8") for export_name in ( "renderRoc",