diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1a578548..9716c2c5 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.23.2.tar.gz", + f"{prefix}rtichoke-viz-0.24.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.23.2.tar.gz" not in names assert f"{prefix}rtichoke-viz-0.23.0.tar.gz" not in 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 diff --git a/pyproject.toml b/pyproject.toml index c98d32ea..1cf5104d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ license = {text = "MIT"} requires-python = ">=3.12" dependencies = [ "plotly>=6.0.0,<7.0.0", - "polarstate==0.1.8", + "polarstate==0.1.10", "smoothstate>=0.1.1", "polars>=1.31.0", "reactable>=0.1.5", diff --git a/src/rtichoke/__init__.py b/src/rtichoke/__init__.py index e431ec94..de4e5c1f 100644 --- a/src/rtichoke/__init__.py +++ b/src/rtichoke/__init__.py @@ -62,6 +62,7 @@ ) from rtichoke.reals_distribution import ( + create_reals_distribution_steps as create_reals_distribution_steps, create_reals_distribution_times as create_reals_distribution_times, ) @@ -72,6 +73,7 @@ __all__ = [ "create_probs_histogram", + "create_reals_distribution_steps", "create_reals_distribution_times", "create_roc_curve", "create_roc_curve_times", diff --git a/src/rtichoke/_renderers.py b/src/rtichoke/_renderers.py index 2d10c95f..46ce75e0 100644 --- a/src/rtichoke/_renderers.py +++ b/src/rtichoke/_renderers.py @@ -95,6 +95,7 @@ def write_html(self, path: str | Path) -> Path: "lift": "renderLiftV2", "decision_curve": "renderDecisionCurveV2", "interventions_avoided": "renderInterventionsAvoidedV2", + "outcome_distribution": "renderOutcomeDistribution", }.get(chart_type) if render_export is None: raise ValueError( diff --git a/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM b/src/rtichoke/_vendor/rtichoke_viz/VENDORED_FROM index 3972b40c..1f38a6f0 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.23.2 -source_commit=af70152c884b351ed7c407047a92cad5c1bd7007 -archive=rtichoke-viz-0.23.2.tar.gz -sha256=63981f4e4f78b38e6442b663052c17592d3355312ba16fb370321d25af456bfe +release=v0.24.0 +source_commit=9ff8c40138c7b2d11332483e0ede900d8b50b935 +archive=rtichoke-viz-0.24.0.tar.gz +sha256=58f153fbfb5aa57affbec983c4e4960fd0889c26e64ef1d25dbf982654fa90f0 diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.2.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.2.tar.gz deleted file mode 100644 index bea15815..00000000 Binary files a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.23.2.tar.gz and /dev/null differ diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.24.0.tar.gz b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.24.0.tar.gz new file mode 100644 index 00000000..edd1b89b Binary files /dev/null and b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-0.24.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 73f6b2e5..b377a290 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-report.schema.json @@ -5615,6 +5615,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -6782,6 +6786,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -6989,6 +6997,18 @@ "title": { "type": "string" }, + "stateScale": { + "anyOf": [ + { + "const": "ordinal", + "type": "string" + }, + { + "const": "nominal", + "type": "string" + } + ] + }, "evaluations": { "minItems": 1, "type": "array", @@ -7050,6 +7070,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -12881,6 +12905,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -14048,6 +14076,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -14255,6 +14287,18 @@ "title": { "type": "string" }, + "stateScale": { + "anyOf": [ + { + "const": "ordinal", + "type": "string" + }, + { + "const": "nominal", + "type": "string" + } + ] + }, "evaluations": { "minItems": 1, "type": "array", @@ -14316,6 +14360,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -20125,6 +20173,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -21292,6 +21344,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, @@ -21499,6 +21555,18 @@ "title": { "type": "string" }, + "stateScale": { + "anyOf": [ + { + "const": "ordinal", + "type": "string" + }, + { + "const": "nominal", + "type": "string" + } + ] + }, "evaluations": { "minItems": 1, "type": "array", @@ -21560,6 +21628,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, 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 b25a490a..ce59380f 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz-v2.schema.json @@ -5574,6 +5574,10 @@ { "const": "fixed_time_horizon", "type": "string" + }, + { + "const": "observed_step", + "type": "string" } ] }, diff --git a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js index b2a40e2a..f9a48784 100644 --- a/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js +++ b/src/rtichoke/_vendor/rtichoke_viz/rtichoke-viz.js @@ -1,52 +1,52 @@ -var M6=Object.defineProperty;var Ba=(e,t)=>{for(var r in t)M6(e,r,{get:t[r],enumerable:!0})};var xr={};Ba(xr,{HasPropertyKey:()=>sp,IsArray:()=>kt,IsAsyncIterator:()=>uy,IsBigInt:()=>ju,IsBoolean:()=>li,IsDate:()=>Ga,IsFunction:()=>fy,IsIterator:()=>ly,IsNull:()=>py,IsNumber:()=>an,IsObject:()=>Ge,IsRegExp:()=>Uu,IsString:()=>et,IsSymbol:()=>my,IsUint8Array:()=>pi,IsUndefined:()=>Nt});function sp(e,t){return t in e}function uy(e){return Ge(e)&&!kt(e)&&!pi(e)&&Symbol.asyncIterator in e}function kt(e){return Array.isArray(e)}function ju(e){return typeof e=="bigint"}function li(e){return typeof e=="boolean"}function Ga(e){return e instanceof globalThis.Date}function fy(e){return typeof e=="function"}function ly(e){return Ge(e)&&!kt(e)&&!pi(e)&&Symbol.iterator in e}function py(e){return e===null}function an(e){return typeof e=="number"}function Ge(e){return typeof e=="object"&&e!==null}function Uu(e){return e instanceof globalThis.RegExp}function et(e){return typeof e=="string"}function my(e){return typeof e=="symbol"}function pi(e){return e instanceof globalThis.Uint8Array}function Nt(e){return e===void 0}function C6(e){return e.map(t=>cp(t))}function O6(e){return new Date(e.getTime())}function k6(e){return new Uint8Array(e)}function N6(e){return new RegExp(e.source,e.flags)}function R6(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=cp(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=cp(e[r]);return t}function cp(e){return kt(e)?C6(e):Ga(e)?O6(e):pi(e)?k6(e):Uu(e)?N6(e):Ge(e)?R6(e):e}function ut(e){return cp(e)}function Ys(e,t){return t===void 0?ut(e):ut({...t,...e})}function up(e){return xe(e)&&globalThis.Symbol.asyncIterator in e}function fp(e){return xe(e)&&globalThis.Symbol.iterator in e}function dy(e){return xe(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function lp(e){return e instanceof globalThis.Promise}function Nr(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function p2(e){return e instanceof globalThis.Map}function m2(e){return e instanceof globalThis.Set}function Pn(e){return globalThis.ArrayBuffer.isView(e)}function Ws(e){return e instanceof globalThis.Uint8Array}function pe(e,t){return t in e}function xe(e){return e!==null&&typeof e=="object"}function me(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function ft(e){return e===void 0}function mi(e){return e===null}function No(e){return typeof e=="boolean"}function lt(e){return typeof e=="number"}function pp(e){return globalThis.Number.isInteger(e)}function Yn(e){return typeof e=="bigint"}function Be(e){return typeof e=="string"}function ea(e){return typeof e=="function"}function di(e){return typeof e=="symbol"}function sn(e){return Yn(e)||No(e)||mi(e)||lt(e)||Be(e)||di(e)||ft(e)}var jt;(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=xe(a);return e.AllowArrayObject?s:s&&!me(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?lt(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=ft(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(jt||(jt={}));function E6(e){return globalThis.Object.freeze(e).map(t=>zu(t))}function A6(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=zu(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=zu(e[r]);return globalThis.Object.freeze(t)}function zu(e){return kt(e)?E6(e):Ga(e)?e:pi(e)?e:Uu(e)?e:Ge(e)?A6(e):e}function L(e,t){let r=t!==void 0?{...t,...e}:e;switch(jt.InstanceMode){case"freeze":return zu(r);case"clone":return ut(r);default:return r}}var ge=class extends Error{constructor(t){super(t)}};var gt=Symbol.for("TypeBox.Transform"),Wn=Symbol.for("TypeBox.Readonly"),pr=Symbol.for("TypeBox.Optional"),Tn=Symbol.for("TypeBox.Hint"),V=Symbol.for("TypeBox.Kind");function Xs(e){return Ge(e)&&e[Wn]==="Readonly"}function Gr(e){return Ge(e)&&e[pr]==="Optional"}function hy(e){return Ce(e,"Any")}function gy(e){return Ce(e,"Argument")}function Xn(e){return Ce(e,"Array")}function Ka(e){return Ce(e,"AsyncIterator")}function qa(e){return Ce(e,"BigInt")}function hi(e){return Ce(e,"Boolean")}function Zn(e){return Ce(e,"Computed")}function Qn(e){return Ce(e,"Constructor")}function F6(e){return Ce(e,"Date")}function Jn(e){return Ce(e,"Function")}function eo(e){return Ce(e,"Integer")}function wt(e){return Ce(e,"Intersect")}function Ha(e){return Ce(e,"Iterator")}function Ce(e,t){return Ge(e)&&V in e&&e[V]===t}function mp(e){return li(e)||an(e)||et(e)}function cn(e){return Ce(e,"Literal")}function un(e){return Ce(e,"MappedKey")}function pt(e){return Ce(e,"MappedResult")}function ta(e){return Ce(e,"Never")}function $6(e){return Ce(e,"Not")}function Bu(e){return Ce(e,"Null")}function to(e){return Ce(e,"Number")}function Rt(e){return Ce(e,"Object")}function Ya(e){return Ce(e,"Promise")}function Wa(e){return Ce(e,"Record")}function Pt(e){return Ce(e,"Ref")}function yy(e){return Ce(e,"RegExp")}function gi(e){return Ce(e,"String")}function Gu(e){return Ce(e,"Symbol")}function fn(e){return Ce(e,"TemplateLiteral")}function D6(e){return Ce(e,"This")}function Ae(e){return Ge(e)&> in e}function ln(e){return Ce(e,"Tuple")}function yi(e){return Ce(e,"Undefined")}function ke(e){return Ce(e,"Union")}function L6(e){return Ce(e,"Uint8Array")}function V6(e){return Ce(e,"Unknown")}function j6(e){return Ce(e,"Unsafe")}function U6(e){return Ce(e,"Void")}function ra(e){return Ge(e)&&V in e&&et(e[V])}function yt(e){return hy(e)||gy(e)||Xn(e)||hi(e)||qa(e)||Ka(e)||Zn(e)||Qn(e)||F6(e)||Jn(e)||eo(e)||wt(e)||Ha(e)||cn(e)||un(e)||pt(e)||ta(e)||$6(e)||Bu(e)||to(e)||Rt(e)||Ya(e)||Wa(e)||Pt(e)||yy(e)||gi(e)||Gu(e)||fn(e)||D6(e)||ln(e)||yi(e)||ke(e)||L6(e)||V6(e)||j6(e)||U6(e)||ra(e)}var k={};Ba(k,{IsAny:()=>y2,IsArgument:()=>b2,IsArray:()=>x2,IsAsyncIterator:()=>w2,IsBigInt:()=>S2,IsBoolean:()=>v2,IsComputed:()=>I2,IsConstructor:()=>_2,IsDate:()=>P2,IsFunction:()=>T2,IsImport:()=>H6,IsInteger:()=>M2,IsIntersect:()=>C2,IsIterator:()=>O2,IsKind:()=>tS,IsKindOf:()=>Pe,IsLiteral:()=>qu,IsLiteralBoolean:()=>Y6,IsLiteralNumber:()=>N2,IsLiteralString:()=>k2,IsLiteralValue:()=>R2,IsMappedKey:()=>E2,IsMappedResult:()=>A2,IsNever:()=>F2,IsNot:()=>$2,IsNull:()=>D2,IsNumber:()=>L2,IsObject:()=>V2,IsOptional:()=>q6,IsPromise:()=>j2,IsProperties:()=>dp,IsReadonly:()=>K6,IsRecord:()=>U2,IsRecursive:()=>W6,IsRef:()=>z2,IsRegExp:()=>B2,IsSchema:()=>Jt,IsString:()=>G2,IsSymbol:()=>K2,IsTemplateLiteral:()=>q2,IsThis:()=>H2,IsTransform:()=>Y2,IsTuple:()=>W2,IsUint8Array:()=>Z2,IsUndefined:()=>X2,IsUnion:()=>Sy,IsUnionLiteral:()=>X6,IsUnknown:()=>Q2,IsUnsafe:()=>J2,IsVoid:()=>eS,TypeGuardUnknownTypeError:()=>by});var by=class extends ge{},z6=["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 d2(e){try{return new RegExp(e),!0}catch{return!1}}function xy(e){if(!et(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function h2(e){return wy(e)||Jt(e)}function Ku(e){return Nt(e)||ju(e)}function tt(e){return Nt(e)||an(e)}function wy(e){return Nt(e)||li(e)}function Ke(e){return Nt(e)||et(e)}function B6(e){return Nt(e)||et(e)&&xy(e)&&d2(e)}function G6(e){return Nt(e)||et(e)&&xy(e)}function g2(e){return Nt(e)||Jt(e)}function K6(e){return Ge(e)&&e[Wn]==="Readonly"}function q6(e){return Ge(e)&&e[pr]==="Optional"}function y2(e){return Pe(e,"Any")&&Ke(e.$id)}function b2(e){return Pe(e,"Argument")&&an(e.index)}function x2(e){return Pe(e,"Array")&&e.type==="array"&&Ke(e.$id)&&Jt(e.items)&&tt(e.minItems)&&tt(e.maxItems)&&wy(e.uniqueItems)&&g2(e.contains)&&tt(e.minContains)&&tt(e.maxContains)}function w2(e){return Pe(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Ke(e.$id)&&Jt(e.items)}function S2(e){return Pe(e,"BigInt")&&e.type==="bigint"&&Ke(e.$id)&&Ku(e.exclusiveMaximum)&&Ku(e.exclusiveMinimum)&&Ku(e.maximum)&&Ku(e.minimum)&&Ku(e.multipleOf)}function v2(e){return Pe(e,"Boolean")&&e.type==="boolean"&&Ke(e.$id)}function I2(e){return Pe(e,"Computed")&&et(e.target)&&kt(e.parameters)&&e.parameters.every(t=>Jt(t))}function _2(e){return Pe(e,"Constructor")&&e.type==="Constructor"&&Ke(e.$id)&&kt(e.parameters)&&e.parameters.every(t=>Jt(t))&&Jt(e.returns)}function P2(e){return Pe(e,"Date")&&e.type==="Date"&&Ke(e.$id)&&tt(e.exclusiveMaximumTimestamp)&&tt(e.exclusiveMinimumTimestamp)&&tt(e.maximumTimestamp)&&tt(e.minimumTimestamp)&&tt(e.multipleOfTimestamp)}function T2(e){return Pe(e,"Function")&&e.type==="Function"&&Ke(e.$id)&&kt(e.parameters)&&e.parameters.every(t=>Jt(t))&&Jt(e.returns)}function H6(e){return Pe(e,"Import")&&sp(e,"$defs")&&Ge(e.$defs)&&dp(e.$defs)&&sp(e,"$ref")&&et(e.$ref)&&e.$ref in e.$defs}function M2(e){return Pe(e,"Integer")&&e.type==="integer"&&Ke(e.$id)&&tt(e.exclusiveMaximum)&&tt(e.exclusiveMinimum)&&tt(e.maximum)&&tt(e.minimum)&&tt(e.multipleOf)}function dp(e){return Ge(e)&&Object.entries(e).every(([t,r])=>xy(t)&&Jt(r))}function C2(e){return Pe(e,"Intersect")&&!(et(e.type)&&e.type!=="object")&&kt(e.allOf)&&e.allOf.every(t=>Jt(t)&&!Y2(t))&&Ke(e.type)&&(wy(e.unevaluatedProperties)||g2(e.unevaluatedProperties))&&Ke(e.$id)}function O2(e){return Pe(e,"Iterator")&&e.type==="Iterator"&&Ke(e.$id)&&Jt(e.items)}function Pe(e,t){return Ge(e)&&V in e&&e[V]===t}function k2(e){return qu(e)&&et(e.const)}function N2(e){return qu(e)&&an(e.const)}function Y6(e){return qu(e)&&li(e.const)}function qu(e){return Pe(e,"Literal")&&Ke(e.$id)&&R2(e.const)}function R2(e){return li(e)||an(e)||et(e)}function E2(e){return Pe(e,"MappedKey")&&kt(e.keys)&&e.keys.every(t=>an(t)||et(t))}function A2(e){return Pe(e,"MappedResult")&&dp(e.properties)}function F2(e){return Pe(e,"Never")&&Ge(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function $2(e){return Pe(e,"Not")&&Jt(e.not)}function D2(e){return Pe(e,"Null")&&e.type==="null"&&Ke(e.$id)}function L2(e){return Pe(e,"Number")&&e.type==="number"&&Ke(e.$id)&&tt(e.exclusiveMaximum)&&tt(e.exclusiveMinimum)&&tt(e.maximum)&&tt(e.minimum)&&tt(e.multipleOf)}function V2(e){return Pe(e,"Object")&&e.type==="object"&&Ke(e.$id)&&dp(e.properties)&&h2(e.additionalProperties)&&tt(e.minProperties)&&tt(e.maxProperties)}function j2(e){return Pe(e,"Promise")&&e.type==="Promise"&&Ke(e.$id)&&Jt(e.item)}function U2(e){return Pe(e,"Record")&&e.type==="object"&&Ke(e.$id)&&h2(e.additionalProperties)&&Ge(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&d2(r[0])&&Ge(t.patternProperties)&&Jt(t.patternProperties[r[0]])})(e)}function W6(e){return Ge(e)&&Tn in e&&e[Tn]==="Recursive"}function z2(e){return Pe(e,"Ref")&&Ke(e.$id)&&et(e.$ref)}function B2(e){return Pe(e,"RegExp")&&Ke(e.$id)&&et(e.source)&&et(e.flags)&&tt(e.maxLength)&&tt(e.minLength)}function G2(e){return Pe(e,"String")&&e.type==="string"&&Ke(e.$id)&&tt(e.minLength)&&tt(e.maxLength)&&B6(e.pattern)&&G6(e.format)}function K2(e){return Pe(e,"Symbol")&&e.type==="symbol"&&Ke(e.$id)}function q2(e){return Pe(e,"TemplateLiteral")&&e.type==="string"&&et(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function H2(e){return Pe(e,"This")&&Ke(e.$id)&&et(e.$ref)}function Y2(e){return Ge(e)&> in e}function W2(e){return Pe(e,"Tuple")&&e.type==="array"&&Ke(e.$id)&&an(e.minItems)&&an(e.maxItems)&&e.minItems===e.maxItems&&(Nt(e.items)&&Nt(e.additionalItems)&&e.minItems===0||kt(e.items)&&e.items.every(t=>Jt(t)))}function X2(e){return Pe(e,"Undefined")&&e.type==="undefined"&&Ke(e.$id)}function X6(e){return Sy(e)&&e.anyOf.every(t=>k2(t)||N2(t))}function Sy(e){return Pe(e,"Union")&&Ke(e.$id)&&Ge(e)&&kt(e.anyOf)&&e.anyOf.every(t=>Jt(t))}function Z2(e){return Pe(e,"Uint8Array")&&e.type==="Uint8Array"&&Ke(e.$id)&&tt(e.minByteLength)&&tt(e.maxByteLength)}function Q2(e){return Pe(e,"Unknown")&&Ke(e.$id)}function J2(e){return Pe(e,"Unsafe")}function eS(e){return Pe(e,"Void")&&e.type==="void"&&Ke(e.$id)}function tS(e){return Ge(e)&&V in e&&et(e[V])&&!z6.includes(e[V])}function Jt(e){return Ge(e)&&(y2(e)||b2(e)||x2(e)||v2(e)||S2(e)||w2(e)||I2(e)||_2(e)||P2(e)||T2(e)||M2(e)||C2(e)||O2(e)||qu(e)||E2(e)||A2(e)||F2(e)||$2(e)||D2(e)||L2(e)||V2(e)||j2(e)||U2(e)||z2(e)||B2(e)||G2(e)||K2(e)||q2(e)||H2(e)||W2(e)||X2(e)||Sy(e)||Z2(e)||Q2(e)||J2(e)||eS(e)||tS(e))}var vy="(true|false)",Hu="(0|[1-9][0-9]*)",Iy="(.*)",Z6="(?!.*)",XB=`^${vy}$`,na=`^${Hu}$`,oa=`^${Iy}$`,rS=`^${Z6}$`;var ia={};Ba(ia,{Clear:()=>J6,Delete:()=>e5,Entries:()=>Q6,Get:()=>n5,Has:()=>t5,Set:()=>r5});var Zs=new Map;function Q6(){return new Map(Zs)}function J6(){return Zs.clear()}function e5(e){return Zs.delete(e)}function t5(e){return Zs.has(e)}function r5(e,t){Zs.set(e,t)}function n5(e){return Zs.get(e)}var ro={};Ba(ro,{Clear:()=>i5,Delete:()=>a5,Entries:()=>o5,Get:()=>u5,Has:()=>s5,Set:()=>c5});var Qs=new Map;function o5(){return new Map(Qs)}function i5(){return Qs.clear()}function a5(e){return Qs.delete(e)}function s5(e){return Qs.has(e)}function c5(e,t){Qs.set(e,t)}function u5(e){return Qs.get(e)}function nS(e,t){return e.includes(t)}function oS(e){return[...new Set(e)]}function f5(e,t){return e.filter(r=>t.includes(r))}function l5(e,t){return e.reduce((r,n)=>f5(r,n),t)}function iS(e){return e.length===1?e[0]:e.length>1?l5(e.slice(1),e[0]):[]}function aS(e){let t=[];for(let r of e)t.push(...r);return t}function aa(e){return L({[V]:"Any"},e)}function Js(e,t){return L({[V]:"Array",type:"array",items:e},t)}function sS(e){return L({[V]:"Argument",index:e})}function ec(e,t){return L({[V]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function at(e,t,r){return L({[V]:"Computed",target:e,parameters:t},r)}function p5(e,t){let{[t]:r,...n}=e;return n}function St(e,t){return t.reduce((r,n)=>p5(r,n),e)}function _e(e){return L({[V]:"Never",not:{}},e)}function Ne(e){return L({[V]:"MappedResult",properties:e})}function tc(e,t,r){return L({[V]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function Ro(e,t,r){return L({[V]:"Function",type:"Function",parameters:e,returns:t},r)}function Yu(e,t){return L({[V]:"Union",anyOf:e},t)}function m5(e){return e.some(t=>Gr(t))}function cS(e){return e.map(t=>Gr(t)?d5(t):t)}function d5(e){return St(e,[pr])}function h5(e,t){return m5(e)?wr(Yu(cS(e),t)):Yu(cS(e),t)}function Eo(e,t){return e.length===1?L(e[0],t):e.length===0?_e(t):h5(e,t)}function Fe(e,t){return e.length===0?_e(t):e.length===1?L(e[0],t):Yu(e,t)}var hp=class extends ge{};function g5(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function _y(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function xi(e,t){return _y(e,t,"(")}function Wu(e,t){return _y(e,t,")")}function uS(e,t){return _y(e,t,"|")}function y5(e){if(!(xi(e,0)&&Wu(e,e.length-1)))return!1;let t=0;for(let r=0;r0&&n.push(rc(a)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(rc(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function v5(e){function t(o,i){if(!xi(o,i))throw new hp("TemplateLiteralParser: Index must point to open parens");let a=0;for(let s=i;s0&&n.push(rc(s)),o=a-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function rc(e){return y5(e)?rc(b5(e)):x5(e)?S5(e):w5(e)?v5(e):{type:"const",const:g5(e)}}function nc(e){return rc(e.slice(1,e.length-1))}var Py=class extends ge{};function I5(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 _5(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 Xa(e){return I5(e)||P5(e)?!1:_5(e)?!0:e.type==="and"?e.expr.every(t=>Xa(t)):e.type==="or"?e.expr.every(t=>Xa(t)):e.type==="const"?!0:(()=>{throw new Py("Unknown expression type")})()}function gp(e){let t=nc(e.pattern);return Xa(t)}var Ty=class extends ge{};function*fS(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of fS(e.slice(1)))yield`${t}${r}`}function*T5(e){return yield*fS(e.expr.map(t=>[...Xu(t)]))}function*M5(e){for(let t of e.expr)yield*Xu(t)}function*C5(e){return yield e.const}function*Xu(e){return e.type==="and"?yield*T5(e):e.type==="or"?yield*M5(e):e.type==="const"?yield*C5(e):(()=>{throw new Ty("Unknown expression")})()}function oc(e){let t=nc(e.pattern);return Xa(t)?[...Xu(t)]:[]}function Oe(e,t){return L({[V]:"Literal",const:e,type:typeof e},t)}function yp(e){return L({[V]:"Boolean",type:"boolean"},e)}function ic(e){return L({[V]:"BigInt",type:"bigint"},e)}function Mn(e){return L({[V]:"Number",type:"number"},e)}function Rr(e){return L({[V]:"String",type:"string"},e)}function*O5(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield yp():t==="number"?yield Mn():t==="bigint"?yield ic():t==="string"?yield Rr():yield(()=>{let r=t.split("|").map(n=>Oe(n.trim()));return r.length===0?_e():r.length===1?r[0]:Eo(r)})()}function*k5(e){if(e[1]!=="{"){let t=Oe("$"),r=My(e.slice(1));return yield*[t,...r]}for(let t=2;tpS(r,t)).join("|")})`:to(e)?`${t}${Hu}`:eo(e)?`${t}${Hu}`:qa(e)?`${t}${Hu}`:gi(e)?`${t}${Iy}`:cn(e)?`${t}${N5(e.const.toString())}`:hi(e)?`${t}${vy}`:(()=>{throw new Cy(`Unexpected Kind '${e[V]}'`)})()}function Oy(e){return`^${e.map(t=>pS(t,"")).join("")}$`}function Za(e){let r=oc(e).map(n=>Oe(n));return Eo(r)}function bp(e,t){let r=et(e)?Oy(lS(e)):Oy(e);return L({[V]:"TemplateLiteral",type:"string",pattern:r},t)}function R5(e){return oc(e).map(r=>r.toString())}function E5(e){let t=[];for(let r of e)t.push(...Kr(r));return t}function A5(e){return[e.toString()]}function Kr(e){return[...new Set(fn(e)?R5(e):ke(e)?E5(e.anyOf):cn(e)?A5(e.const):to(e)?["[number]"]:eo(e)?["[number]"]:[])]}function F5(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=sa(e,Kr(t[o]),r);return n}function $5(e,t,r){return F5(e,t.properties,r)}function mS(e,t,r){let n=$5(e,t,r);return Ne(n)}function hS(e,t){return e.map(r=>gS(r,t))}function D5(e){return e.filter(t=>!ta(t))}function L5(e,t){return xp(D5(hS(e,t)))}function V5(e){return e.some(t=>ta(t))?[]:e}function j5(e,t){return Eo(V5(hS(e,t)))}function U5(e,t){return t in e?e[t]:t==="[number]"?Eo(e):_e()}function z5(e,t){return t==="[number]"?e:_e()}function B5(e,t){return t in e?e[t]:_e()}function gS(e,t){return wt(e)?L5(e.allOf,t):ke(e)?j5(e.anyOf,t):ln(e)?U5(e.items??[],t):Xn(e)?z5(e.items,t):Rt(e)?B5(e.properties,t):_e()}function Zu(e,t){return t.map(r=>gS(e,r))}function dS(e,t){return Eo(Zu(e,t))}function sa(e,t,r){if(Pt(e)||Pt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!yt(e)||!yt(t))throw new ge(n);return at("Index",[e,t])}return pt(t)?mS(e,t,r):un(t)?yS(e,t,r):L(yt(t)?dS(e,Kr(t)):dS(e,t),r)}function G5(e,t,r){return{[t]:sa(e,[t],ut(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 yS(e,t,r){let n=q5(e,t,r);return Ne(n)}function ac(e,t){return L({[V]:"Iterator",type:"Iterator",items:e},t)}function H5(e){return globalThis.Object.keys(e).filter(t=>!Gr(e[t]))}function Y5(e,t){let r=H5(e),n=r.length>0?{[V]:"Object",type:"object",required:r,properties:e}:{[V]:"Object",type:"object",properties:e};return L(n,t)}var $e=Y5;function wp(e,t){return L({[V]:"Promise",type:"Promise",item:e},t)}function W5(e){return L(St(e,[Wn]))}function X5(e){return L({...e,[Wn]:"Readonly"})}function Z5(e,t){return t===!1?W5(e):X5(e)}function qr(e,t){let r=t??!0;return pt(e)?bS(e,r):Z5(e,r)}function Q5(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=qr(e[n],t);return r}function J5(e,t){return Q5(e.properties,t)}function bS(e,t){let r=J5(e,t);return Ne(r)}function Cn(e,t){return L(e.length>0?{[V]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[V]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function xS(e,t){return e in t?On(e,t[e]):Ne(t)}function eN(e){return{[e]:Oe(e)}}function tN(e){let t={};for(let r of e)t[r]=Oe(r);return t}function rN(e,t){return nS(t,e)?eN(e):tN(t)}function nN(e,t){let r=rN(e,t);return xS(e,r)}function Qu(e,t){return t.map(r=>On(e,r))}function oN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=On(e,t[n]);return r}function On(e,t){let r={...t};return Gr(t)?wr(On(e,St(t,[pr]))):Xs(t)?qr(On(e,St(t,[Wn]))):pt(t)?xS(e,t.properties):un(t)?nN(e,t.keys):Qn(t)?tc(Qu(e,t.parameters),On(e,t.returns),r):Jn(t)?Ro(Qu(e,t.parameters),On(e,t.returns),r):Ka(t)?ec(On(e,t.items),r):Ha(t)?ac(On(e,t.items),r):wt(t)?Sr(Qu(e,t.allOf),r):ke(t)?Fe(Qu(e,t.anyOf),r):ln(t)?Cn(Qu(e,t.items??[]),r):Rt(t)?$e(oN(e,t.properties),r):Xn(t)?Js(On(e,t.items),r):Ya(t)?wp(On(e,t.item),r):t}function iN(e,t){let r={};for(let n of e)r[n]=On(n,t);return r}function wS(e,t,r){let n=yt(e)?Kr(e):e,o=t({[V]:"MappedKey",keys:n}),i=iN(n,o);return $e(i,r)}function aN(e){return L(St(e,[pr]))}function sN(e){return L({...e,[pr]:"Optional"})}function cN(e,t){return t===!1?aN(e):sN(e)}function wr(e,t){let r=t??!0;return pt(e)?SS(e,r):cN(e,r)}function uN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=wr(e[n],t);return r}function fN(e,t){return uN(e.properties,t)}function SS(e,t){let r=fN(e,t);return Ne(r)}function Ju(e,t={}){let r=e.every(o=>Rt(o)),n=yt(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return L(t.unevaluatedProperties===!1||yt(t.unevaluatedProperties)||r?{...n,[V]:"Intersect",type:"object",allOf:e}:{...n,[V]:"Intersect",allOf:e},t)}function lN(e){return e.every(t=>Gr(t))}function pN(e){return St(e,[pr])}function vS(e){return e.map(t=>Gr(t)?pN(t):t)}function mN(e,t){return lN(e)?wr(Ju(vS(e),t)):Ju(vS(e),t)}function xp(e,t={}){if(e.length===1)return L(e[0],t);if(e.length===0)return _e(t);if(e.some(r=>Ae(r)))throw new Error("Cannot intersect transform types");return mN(e,t)}function Sr(e,t){if(e.length===1)return L(e[0],t);if(e.length===0)return _e(t);if(e.some(r=>Ae(r)))throw new Error("Cannot intersect transform types");return Ju(e,t)}function Ao(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new ge("Ref: $ref must be a string");return L({[V]:"Ref",$ref:t},r)}function dN(e,t){return at("Awaited",[at(e,t)])}function hN(e){return at("Awaited",[Ao(e)])}function gN(e){return Sr(IS(e))}function yN(e){return Fe(IS(e))}function bN(e){return sc(e)}function IS(e){return e.map(t=>sc(t))}function sc(e,t){return L(Zn(e)?dN(e.target,e.parameters):wt(e)?gN(e.allOf):ke(e)?yN(e.anyOf):Ya(e)?bN(e.item):Pt(e)?hN(e.$ref):e,t)}function _S(e){let t=[];for(let r of e)t.push(Hr(r));return t}function xN(e){let t=_S(e);return aS(t)}function wN(e){let t=_S(e);return iS(t)}function SN(e){return e.map((t,r)=>r.toString())}function vN(e){return["[number]"]}function IN(e){return globalThis.Object.getOwnPropertyNames(e)}function _N(e){return ky?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Hr(e){return wt(e)?xN(e.allOf):ke(e)?wN(e.anyOf):ln(e)?SN(e.items??[]):Xn(e)?vN(e.items):Rt(e)?IN(e.properties):Wa(e)?_N(e.patternProperties):[]}var ky=!1;function cc(e){ky=!0;let t=Hr(e);return ky=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function PN(e,t){return at("KeyOf",[at(e,t)])}function TN(e){return at("KeyOf",[Ao(e)])}function MN(e,t){let r=Hr(e),n=CN(r),o=Eo(n);return L(o,t)}function CN(e){return e.map(t=>t==="[number]"?Mn():Oe(t))}function uc(e,t){return Zn(e)?PN(e.target,e.parameters):Pt(e)?TN(e.$ref):pt(e)?PS(e,t):MN(e,t)}function ON(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=uc(e[n],ut(t));return r}function kN(e,t){return ON(e.properties,t)}function PS(e,t){let r=kN(e,t);return Ne(r)}function Sp(e){let t=Hr(e),r=Zu(e,t);return t.map((n,o)=>[t[o],r[o]])}function NN(e){let t=[];for(let r of e)t.push(...Hr(r));return oS(t)}function RN(e){return e.filter(t=>!ta(t))}function EN(e,t){let r=[];for(let n of e)r.push(...Zu(n,[t]));return RN(r)}function AN(e,t){let r={};for(let n of t)r[n]=xp(EN(e,n));return r}function TS(e,t){let r=NN(e),n=AN(e,r);return $e(n,t)}function vp(e){return L({[V]:"Date",type:"Date"},e)}function Ip(e){return L({[V]:"Null",type:"null"},e)}function _p(e){return L({[V]:"Symbol",type:"symbol"},e)}function Pp(e){return L({[V]:"Undefined",type:"undefined"},e)}function Tp(e){return L({[V]:"Uint8Array",type:"Uint8Array"},e)}function no(e){return L({[V]:"Unknown"},e)}function FN(e){return e.map(t=>Ny(t,!1))}function $N(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=qr(Ny(e[r],!1));return t}function Mp(e,t){return t===!0?e:qr(e)}function Ny(e,t){return uy(e)?Mp(aa(),t):ly(e)?Mp(aa(),t):kt(e)?qr(Cn(FN(e))):pi(e)?Tp():Ga(e)?vp():Ge(e)?Mp($e($N(e)),t):fy(e)?Mp(Ro([],no()),t):Nt(e)?Pp():py(e)?Ip():my(e)?_p():ju(e)?ic():an(e)?Oe(e):li(e)?Oe(e):et(e)?Oe(e):$e({})}function MS(e,t){return L(Ny(e,!0),t)}function CS(e,t){return Qn(e)?Cn(e.parameters,t):_e(t)}function OS(e,t){if(Nt(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,[Tn]:"Enum"})}var Ey=class extends ge{},j;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(j||(j={}));function kn(e){return e===j.False?e:j.True}function fc(e){throw new Ey(e)}function Ut(e){return k.IsNever(e)||k.IsIntersect(e)||k.IsUnion(e)||k.IsUnknown(e)||k.IsAny(e)}function zt(e,t){return k.IsNever(t)?$S(e,t):k.IsIntersect(t)?Cp(e,t):k.IsUnion(t)?Dy(e,t):k.IsUnknown(t)?jS(e,t):k.IsAny(t)?$y(e,t):fc("StructuralRight")}function $y(e,t){return j.True}function DN(e,t){return k.IsIntersect(t)?Cp(e,t):k.IsUnion(t)&&t.anyOf.some(r=>k.IsAny(r)||k.IsUnknown(r))?j.True:k.IsUnion(t)?j.Union:k.IsUnknown(t)||k.IsAny(t)?j.True:j.Union}function LN(e,t){return k.IsUnknown(e)?j.False:k.IsAny(e)?j.Union:k.IsNever(e)?j.True:j.False}function VN(e,t){return k.IsObject(t)&&Op(t)?j.True:Ut(t)?zt(e,t):k.IsArray(t)?kn(qe(e.items,t.items)):j.False}function jN(e,t){return Ut(t)?zt(e,t):k.IsAsyncIterator(t)?kn(qe(e.items,t.items)):j.False}function UN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsBigInt(t)?j.True:j.False}function AS(e,t){return k.IsLiteralBoolean(e)||k.IsBoolean(e)?j.True:j.False}function zN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsBoolean(t)?j.True:j.False}function BN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsConstructor(t)?e.parameters.length>t.parameters.length?j.False:e.parameters.every((r,n)=>kn(qe(t.parameters[n],r))===j.True)?kn(qe(e.returns,t.returns)):j.False:j.False}function GN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsDate(t)?j.True:j.False}function KN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsFunction(t)?e.parameters.length>t.parameters.length?j.False:e.parameters.every((r,n)=>kn(qe(t.parameters[n],r))===j.True)?kn(qe(e.returns,t.returns)):j.False:j.False}function FS(e,t){return k.IsLiteral(e)&&xr.IsNumber(e.const)||k.IsNumber(e)||k.IsInteger(e)?j.True:j.False}function qN(e,t){return k.IsInteger(t)||k.IsNumber(t)?j.True:Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):j.False}function Cp(e,t){return t.allOf.every(r=>qe(e,r)===j.True)?j.True:j.False}function HN(e,t){return e.allOf.some(r=>qe(r,t)===j.True)?j.True:j.False}function YN(e,t){return Ut(t)?zt(e,t):k.IsIterator(t)?kn(qe(e.items,t.items)):j.False}function WN(e,t){return k.IsLiteral(t)&&t.const===e.const?j.True:Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsString(t)?VS(e,t):k.IsNumber(t)?DS(e,t):k.IsInteger(t)?FS(e,t):k.IsBoolean(t)?AS(e,t):j.False}function $S(e,t){return j.False}function XN(e,t){return j.True}function kS(e){let[t,r]=[e,0];for(;k.IsNot(t);)t=t.not,r+=1;return r%2===0?t:no()}function ZN(e,t){return k.IsNot(e)?qe(kS(e),t):k.IsNot(t)?qe(e,kS(t)):fc("Invalid fallthrough for Not")}function QN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsNull(t)?j.True:j.False}function DS(e,t){return k.IsLiteralNumber(e)||k.IsNumber(e)||k.IsInteger(e)?j.True:j.False}function JN(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsInteger(t)||k.IsNumber(t)?j.True:j.False}function Yr(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function NS(e){return Op(e)}function RS(e){return Yr(e,0)||Yr(e,1)&&"description"in e.properties&&k.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(k.IsString(e.properties.description.anyOf[0])&&k.IsUndefined(e.properties.description.anyOf[1])||k.IsString(e.properties.description.anyOf[1])&&k.IsUndefined(e.properties.description.anyOf[0]))}function Ry(e){return Yr(e,0)}function ES(e){return Yr(e,0)}function eR(e){return Yr(e,0)}function tR(e){return Yr(e,0)}function rR(e){return Op(e)}function nR(e){let t=Mn();return Yr(e,0)||Yr(e,1)&&"length"in e.properties&&kn(qe(e.properties.length,t))===j.True}function oR(e){return Yr(e,0)}function Op(e){let t=Mn();return Yr(e,0)||Yr(e,1)&&"length"in e.properties&&kn(qe(e.properties.length,t))===j.True}function iR(e){let t=Ro([aa()],aa());return Yr(e,0)||Yr(e,1)&&"then"in e.properties&&kn(qe(e.properties.then,t))===j.True}function LS(e,t){return qe(e,t)===j.False||k.IsOptional(e)&&!k.IsOptional(t)?j.False:j.True}function vr(e,t){return k.IsUnknown(e)?j.False:k.IsAny(e)?j.Union:k.IsNever(e)||k.IsLiteralString(e)&&NS(t)||k.IsLiteralNumber(e)&&Ry(t)||k.IsLiteralBoolean(e)&&ES(t)||k.IsSymbol(e)&&RS(t)||k.IsBigInt(e)&&eR(t)||k.IsString(e)&&NS(t)||k.IsSymbol(e)&&RS(t)||k.IsNumber(e)&&Ry(t)||k.IsInteger(e)&&Ry(t)||k.IsBoolean(e)&&ES(t)||k.IsUint8Array(e)&&rR(t)||k.IsDate(e)&&tR(t)||k.IsConstructor(e)&&oR(t)||k.IsFunction(e)&&nR(t)?j.True:k.IsRecord(e)&&k.IsString(Ay(e))?t[Tn]==="Record"?j.True:j.False:k.IsRecord(e)&&k.IsNumber(Ay(e))?Yr(t,0)?j.True:j.False:j.False}function aR(e,t){return Ut(t)?zt(e,t):k.IsRecord(t)?Nn(e,t):k.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!k.IsOptional(t.properties[r]))return j.False;if(k.IsOptional(t.properties[r]))return j.True;if(LS(e.properties[r],t.properties[r])===j.False)return j.False}return j.True})():j.False}function sR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)&&iR(t)?j.True:k.IsPromise(t)?kn(qe(e.item,t.item)):j.False}function Ay(e){return na in e.patternProperties?Mn():oa in e.patternProperties?Rr():fc("Unknown record key pattern")}function Fy(e){return na in e.patternProperties?e.patternProperties[na]:oa in e.patternProperties?e.patternProperties[oa]:fc("Unable to get record value schema")}function Nn(e,t){let[r,n]=[Ay(t),Fy(t)];return k.IsLiteralString(e)&&k.IsNumber(r)&&kn(qe(e,n))===j.True?j.True:k.IsUint8Array(e)&&k.IsNumber(r)||k.IsString(e)&&k.IsNumber(r)||k.IsArray(e)&&k.IsNumber(r)?qe(e,n):k.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(LS(n,e.properties[o])===j.False)return j.False;return j.True})():j.False}function cR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?qe(Fy(e),Fy(t)):j.False}function uR(e,t){let r=k.IsRegExp(e)?Rr():e,n=k.IsRegExp(t)?Rr():t;return qe(r,n)}function VS(e,t){return k.IsLiteral(e)&&xr.IsString(e.const)||k.IsString(e)?j.True:j.False}function fR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsString(t)?j.True:j.False}function lR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsSymbol(t)?j.True:j.False}function pR(e,t){return k.IsTemplateLiteral(e)?qe(Za(e),t):k.IsTemplateLiteral(t)?qe(e,Za(t)):fc("Invalid fallthrough for TemplateLiteral")}function mR(e,t){return k.IsArray(t)&&e.items!==void 0&&e.items.every(r=>qe(r,t.items)===j.True)}function dR(e,t){return k.IsNever(e)?j.True:k.IsUnknown(e)?j.False:k.IsAny(e)?j.Union:j.False}function hR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)&&Op(t)||k.IsArray(t)&&mR(e,t)?j.True:k.IsTuple(t)?xr.IsUndefined(e.items)&&!xr.IsUndefined(t.items)||!xr.IsUndefined(e.items)&&xr.IsUndefined(t.items)?j.False:xr.IsUndefined(e.items)&&!xr.IsUndefined(t.items)||e.items.every((r,n)=>qe(r,t.items[n])===j.True)?j.True:j.False:j.False}function gR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsUint8Array(t)?j.True:j.False}function yR(e,t){return Ut(t)?zt(e,t):k.IsObject(t)?vr(e,t):k.IsRecord(t)?Nn(e,t):k.IsVoid(t)?wR(e,t):k.IsUndefined(t)?j.True:j.False}function Dy(e,t){return t.anyOf.some(r=>qe(e,r)===j.True)?j.True:j.False}function bR(e,t){return e.anyOf.every(r=>qe(r,t)===j.True)?j.True:j.False}function jS(e,t){return j.True}function xR(e,t){return k.IsNever(t)?$S(e,t):k.IsIntersect(t)?Cp(e,t):k.IsUnion(t)?Dy(e,t):k.IsAny(t)?$y(e,t):k.IsString(t)?VS(e,t):k.IsNumber(t)?DS(e,t):k.IsInteger(t)?FS(e,t):k.IsBoolean(t)?AS(e,t):k.IsArray(t)?LN(e,t):k.IsTuple(t)?dR(e,t):k.IsObject(t)?vr(e,t):k.IsUnknown(t)?j.True:j.False}function wR(e,t){return k.IsUndefined(e)||k.IsUndefined(e)?j.True:j.False}function SR(e,t){return k.IsIntersect(t)?Cp(e,t):k.IsUnion(t)?Dy(e,t):k.IsUnknown(t)?jS(e,t):k.IsAny(t)?$y(e,t):k.IsObject(t)?vr(e,t):k.IsVoid(t)?j.True:j.False}function qe(e,t){return k.IsTemplateLiteral(e)||k.IsTemplateLiteral(t)?pR(e,t):k.IsRegExp(e)||k.IsRegExp(t)?uR(e,t):k.IsNot(e)||k.IsNot(t)?ZN(e,t):k.IsAny(e)?DN(e,t):k.IsArray(e)?VN(e,t):k.IsBigInt(e)?UN(e,t):k.IsBoolean(e)?zN(e,t):k.IsAsyncIterator(e)?jN(e,t):k.IsConstructor(e)?BN(e,t):k.IsDate(e)?GN(e,t):k.IsFunction(e)?KN(e,t):k.IsInteger(e)?qN(e,t):k.IsIntersect(e)?HN(e,t):k.IsIterator(e)?YN(e,t):k.IsLiteral(e)?WN(e,t):k.IsNever(e)?XN(e,t):k.IsNull(e)?QN(e,t):k.IsNumber(e)?JN(e,t):k.IsObject(e)?aR(e,t):k.IsRecord(e)?cR(e,t):k.IsString(e)?fR(e,t):k.IsSymbol(e)?lR(e,t):k.IsTuple(e)?hR(e,t):k.IsPromise(e)?sR(e,t):k.IsUint8Array(e)?gR(e,t):k.IsUndefined(e)?yR(e,t):k.IsUnion(e)?bR(e,t):k.IsUnknown(e)?xR(e,t):k.IsVoid(e)?SR(e,t):fc(`Unknown left type operand '${e[V]}'`)}function ca(e,t){return qe(e,t)}function vR(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=lc(e[a],t,r,n,ut(o));return i}function IR(e,t,r,n,o){return vR(e.properties,t,r,n,o)}function US(e,t,r,n,o){let i=IR(e,t,r,n,o);return Ne(i)}function _R(e,t,r,n){let o=ca(e,t);return o===j.Union?Fe([r,n]):o===j.True?r:n}function lc(e,t,r,n,o){return pt(e)?US(e,t,r,n,o):un(e)?L(zS(e,t,r,n,o)):L(_R(e,t,r,n),o)}function PR(e,t,r,n,o){return{[e]:lc(Oe(e),t,r,n,ut(o))}}function TR(e,t,r,n,o){return e.reduce((i,a)=>({...i,...PR(a,t,r,n,o)}),{})}function MR(e,t,r,n,o){return TR(e.keys,t,r,n,o)}function zS(e,t,r,n,o){let i=MR(e,t,r,n,o);return Ne(i)}function CR(e){return e.allOf.every(t=>Qa(t))}function OR(e){return e.anyOf.some(t=>Qa(t))}function kR(e){return!Qa(e.not)}function Qa(e){return e[V]==="Intersect"?CR(e):e[V]==="Union"?OR(e):e[V]==="Not"?kR(e):e[V]==="Undefined"}function BS(e,t){return pc(Za(e),t)}function NR(e,t){let r=e.filter(n=>ca(n,t)===j.False);return r.length===1?r[0]:Fe(r)}function pc(e,t,r={}){return fn(e)?L(BS(e,t),r):pt(e)?L(GS(e,t),r):L(ke(e)?NR(e.anyOf,t):ca(e,t)!==j.False?_e():e,r)}function RR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=pc(e[n],t);return r}function ER(e,t){return RR(e.properties,t)}function GS(e,t){let r=ER(e,t);return Ne(r)}function KS(e,t){return mc(Za(e),t)}function AR(e,t){let r=e.filter(n=>ca(n,t)!==j.False);return r.length===1?r[0]:Fe(r)}function mc(e,t,r){return fn(e)?L(KS(e,t),r):pt(e)?L(qS(e,t),r):L(ke(e)?AR(e.anyOf,t):ca(e,t)!==j.False?e:_e(),r)}function FR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=mc(e[n],t);return r}function $R(e,t){return FR(e.properties,t)}function qS(e,t){let r=$R(e,t);return Ne(r)}function HS(e,t){return Qn(e)?L(e.returns,t):_e(t)}function kp(e){return qr(wr(e))}function Ja(e,t,r){return L({[V]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Ly(e,t,r){let n={};for(let o of e)n[o]=t;return $e(n,{...r,[Tn]:"Record"})}function DR(e,t,r){return gp(e)?Ly(Kr(e),t,r):Ja(e.pattern,t,r)}function LR(e,t,r){return Ly(Kr(Fe(e)),t,r)}function VR(e,t,r){return Ly([e.toString()],t,r)}function jR(e,t,r){return Ja(e.source,t,r)}function UR(e,t,r){let n=Nt(e.pattern)?oa:e.pattern;return Ja(n,t,r)}function zR(e,t,r){return Ja(oa,t,r)}function BR(e,t,r){return Ja(rS,t,r)}function GR(e,t,r){return $e({true:t,false:t},r)}function KR(e,t,r){return Ja(na,t,r)}function qR(e,t,r){return Ja(na,t,r)}function Np(e,t,r={}){return ke(e)?LR(e.anyOf,t,r):fn(e)?DR(e,t,r):cn(e)?VR(e.const,t,r):hi(e)?GR(e,t,r):eo(e)?KR(e,t,r):to(e)?qR(e,t,r):yy(e)?jR(e,t,r):gi(e)?UR(e,t,r):hy(e)?zR(e,t,r):ta(e)?BR(e,t,r):_e(r)}function Rp(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function YS(e){let t=Rp(e);return t===oa?Rr():t===na?Mn():Rr({pattern:t})}function Ep(e){return e.patternProperties[Rp(e)]}function HR(e,t){return t.parameters=ef(e,t.parameters),t.returns=oo(e,t.returns),t}function YR(e,t){return t.parameters=ef(e,t.parameters),t.returns=oo(e,t.returns),t}function WR(e,t){return t.allOf=ef(e,t.allOf),t}function XR(e,t){return t.anyOf=ef(e,t.anyOf),t}function ZR(e,t){return Nt(t.items)||(t.items=ef(e,t.items)),t}function QR(e,t){return t.items=oo(e,t.items),t}function JR(e,t){return t.items=oo(e,t.items),t}function e8(e,t){return t.items=oo(e,t.items),t}function t8(e,t){return t.item=oo(e,t.item),t}function r8(e,t){let r=a8(e,t.properties);return{...t,...$e(r)}}function n8(e,t){let r=oo(e,YS(t)),n=oo(e,Ep(t)),o=Np(r,n);return{...t,...o}}function o8(e,t){return t.index in e?e[t.index]:no()}function i8(e,t){let r=Xs(t),n=Gr(t),o=oo(e,t);return r&&n?kp(o):r&&!n?qr(o):!r&&n?wr(o):o}function a8(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:i8(e,t[n])}),{})}function ef(e,t){return t.map(r=>oo(e,r))}function oo(e,t){return Qn(t)?HR(e,t):Jn(t)?YR(e,t):wt(t)?WR(e,t):ke(t)?XR(e,t):ln(t)?ZR(e,t):Xn(t)?QR(e,t):Ka(t)?JR(e,t):Ha(t)?e8(e,t):Ya(t)?t8(e,t):Rt(t)?r8(e,t):Wa(t)?n8(e,t):gy(t)?o8(e,t):t}function WS(e,t){return oo(t,Ys(e))}function XS(e){return L({[V]:"Integer",type:"integer"},e)}function s8(e,t,r){return{[e]:io(Oe(e),t,ut(r))}}function c8(e,t,r){return e.reduce((o,i)=>({...o,...s8(i,t,r)}),{})}function u8(e,t,r){return c8(e.keys,t,r)}function ZS(e,t,r){let n=u8(e,t,r);return Ne(n)}function f8(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function l8(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function p8(e){return e.toUpperCase()}function m8(e){return e.toLowerCase()}function d8(e,t,r){let n=nc(e.pattern);if(!Xa(n))return{...e,pattern:QS(e.pattern,t)};let a=[...Xu(n)].map(u=>Oe(u)),s=JS(a,t),c=Fe(s);return bp([c],r)}function QS(e,t){return typeof e=="string"?t==="Uncapitalize"?f8(e):t==="Capitalize"?l8(e):t==="Uppercase"?p8(e):t==="Lowercase"?m8(e):e:e.toString()}function JS(e,t){return e.map(r=>io(r,t))}function io(e,t,r={}){return un(e)?ZS(e,t,r):fn(e)?d8(e,t,r):ke(e)?Fe(JS(e.anyOf,t),r):cn(e)?Oe(QS(e.const,t),r):L(e,r)}function ev(e,t={}){return io(e,"Capitalize",t)}function tv(e,t={}){return io(e,"Lowercase",t)}function rv(e,t={}){return io(e,"Uncapitalize",t)}function nv(e,t={}){return io(e,"Uppercase",t)}function h8(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=ua(e[o],t,ut(r));return n}function g8(e,t,r){return h8(e.properties,t,r)}function ov(e,t,r){let n=g8(e,t,r);return Ne(n)}function y8(e,t){return e.map(r=>Vy(r,t))}function b8(e,t){return e.map(r=>Vy(r,t))}function x8(e,t){let{[t]:r,...n}=e;return n}function w8(e,t){return t.reduce((r,n)=>x8(r,n),e)}function S8(e,t,r){let n=St(e,[gt,"$id","required","properties"]),o=w8(r,t);return $e(o,n)}function v8(e){let t=e.reduce((r,n)=>mp(n)?[...r,Oe(n)]:r,[]);return Fe(t)}function Vy(e,t){return wt(e)?Sr(y8(e.allOf,t)):ke(e)?Fe(b8(e.anyOf,t)):Rt(e)?S8(e,t,e.properties):$e({})}function ua(e,t,r){let n=kt(t)?v8(t):t,o=yt(t)?Kr(t):t,i=Pt(e),a=Pt(t);return pt(e)?ov(e,o,r):un(t)?iv(e,t,r):i&&a?at("Omit",[e,n],r):!i&&a?at("Omit",[e,n],r):i&&!a?at("Omit",[e,n],r):L({...Vy(e,o),...r})}function I8(e,t,r){return{[t]:ua(e,[t],ut(r))}}function _8(e,t,r){return t.reduce((n,o)=>({...n,...I8(e,o,r)}),{})}function P8(e,t,r){return _8(e,t.keys,r)}function iv(e,t,r){let n=P8(e,t,r);return Ne(n)}function T8(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=fa(e[o],t,ut(r));return n}function M8(e,t,r){return T8(e.properties,t,r)}function av(e,t,r){let n=M8(e,t,r);return Ne(n)}function C8(e,t){return e.map(r=>jy(r,t))}function O8(e,t){return e.map(r=>jy(r,t))}function k8(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function N8(e,t,r){let n=St(e,[gt,"$id","required","properties"]),o=k8(r,t);return $e(o,n)}function R8(e){let t=e.reduce((r,n)=>mp(n)?[...r,Oe(n)]:r,[]);return Fe(t)}function jy(e,t){return wt(e)?Sr(C8(e.allOf,t)):ke(e)?Fe(O8(e.anyOf,t)):Rt(e)?N8(e,t,e.properties):$e({})}function fa(e,t,r){let n=kt(t)?R8(t):t,o=yt(t)?Kr(t):t,i=Pt(e),a=Pt(t);return pt(e)?av(e,o,r):un(t)?sv(e,t,r):i&&a?at("Pick",[e,n],r):!i&&a?at("Pick",[e,n],r):i&&!a?at("Pick",[e,n],r):L({...jy(e,o),...r})}function E8(e,t,r){return{[t]:fa(e,[t],ut(r))}}function A8(e,t,r){return t.reduce((n,o)=>({...n,...E8(e,o,r)}),{})}function F8(e,t,r){return A8(e,t.keys,r)}function sv(e,t,r){let n=F8(e,t,r);return Ne(n)}function $8(e,t){return at("Partial",[at(e,t)])}function D8(e){return at("Partial",[Ao(e)])}function L8(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=wr(e[r]);return t}function V8(e,t){let r=St(e,[gt,"$id","required","properties"]),n=L8(t);return $e(n,r)}function cv(e){return e.map(t=>uv(t))}function uv(e){return Zn(e)?$8(e.target,e.parameters):Pt(e)?D8(e.$ref):wt(e)?Sr(cv(e.allOf)):ke(e)?Fe(cv(e.anyOf)):Rt(e)?V8(e,e.properties):qa(e)||hi(e)||eo(e)||cn(e)||Bu(e)||to(e)||gi(e)||Gu(e)||yi(e)?e:$e({})}function dc(e,t){return pt(e)?fv(e,t):L({...uv(e),...t})}function j8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=dc(e[n],ut(t));return r}function U8(e,t){return j8(e.properties,t)}function fv(e,t){let r=U8(e,t);return Ne(r)}function z8(e,t){return at("Required",[at(e,t)])}function B8(e){return at("Required",[Ao(e)])}function G8(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=St(e[r],[pr]);return t}function K8(e,t){let r=St(e,[gt,"$id","required","properties"]),n=G8(t);return $e(n,r)}function lv(e){return e.map(t=>pv(t))}function pv(e){return Zn(e)?z8(e.target,e.parameters):Pt(e)?B8(e.$ref):wt(e)?Sr(lv(e.allOf)):ke(e)?Fe(lv(e.anyOf)):Rt(e)?K8(e,e.properties):qa(e)||hi(e)||eo(e)||cn(e)||Bu(e)||to(e)||gi(e)||Gu(e)||yi(e)?e:$e({})}function hc(e,t){return pt(e)?mv(e,t):L({...pv(e),...t})}function q8(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=hc(e[n],t);return r}function H8(e,t){return q8(e.properties,t)}function mv(e,t){let r=H8(e,t);return Ne(r)}function Y8(e,t){return t.map(r=>Pt(r)?Uy(e,r.$ref):pn(e,r))}function Uy(e,t){return t in e?Pt(e[t])?Uy(e,e[t].$ref):pn(e,e[t]):_e()}function W8(e){return sc(e[0])}function X8(e){return sa(e[0],e[1])}function Z8(e){return uc(e[0])}function Q8(e){return dc(e[0])}function J8(e){return ua(e[0],e[1])}function e3(e){return fa(e[0],e[1])}function t3(e){return hc(e[0])}function r3(e,t,r){let n=Y8(e,r);return t==="Awaited"?W8(n):t==="Index"?X8(n):t==="KeyOf"?Z8(n):t==="Partial"?Q8(n):t==="Omit"?J8(n):t==="Pick"?e3(n):t==="Required"?t3(n):_e()}function n3(e,t){return Js(pn(e,t))}function o3(e,t){return ec(pn(e,t))}function i3(e,t,r){return tc(tf(e,t),pn(e,r))}function a3(e,t,r){return Ro(tf(e,t),pn(e,r))}function s3(e,t){return Sr(tf(e,t))}function c3(e,t){return ac(pn(e,t))}function u3(e,t){return $e(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:pn(e,t[n])}),{}))}function f3(e,t){let[r,n]=[pn(e,Ep(t)),Rp(t)],o=Ys(t);return o.patternProperties[n]=r,o}function l3(e,t){return Pt(t)?{...Uy(e,t.$ref),[gt]:t[gt]}:t}function p3(e,t){return Cn(tf(e,t))}function m3(e,t){return Fe(tf(e,t))}function tf(e,t){return t.map(r=>pn(e,r))}function pn(e,t){return Gr(t)?L(pn(e,St(t,[pr])),t):Xs(t)?L(pn(e,St(t,[Wn])),t):Ae(t)?L(l3(e,t),t):Xn(t)?L(n3(e,t.items),t):Ka(t)?L(o3(e,t.items),t):Zn(t)?L(r3(e,t.target,t.parameters)):Qn(t)?L(i3(e,t.parameters,t.returns),t):Jn(t)?L(a3(e,t.parameters,t.returns),t):wt(t)?L(s3(e,t.allOf),t):Ha(t)?L(c3(e,t.items),t):Rt(t)?L(u3(e,t.properties),t):Wa(t)?L(f3(e,t)):ln(t)?L(p3(e,t.items||[]),t):ke(t)?L(m3(e,t.anyOf),t):t}function d3(e,t){return t in e?pn(e,e[t]):_e()}function dv(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:d3(e,r)}),{})}var zy=class{constructor(t){let r=dv(t),n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){let n={...this.$defs,[t]:L(this.$defs[t],r)};return L({[V]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:{...t[n],$id:n}}),{})}};function hv(e){return new zy(e)}function gv(e,t){return L({[V]:"Not",not:e},t)}function yv(e,t){return Jn(e)?Cn(e.parameters,t):_e()}var h3=0;function bv(e,t={}){Nt(t.$id)&&(t.$id=`T${h3++}`);let r=Ys(e({[V]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,L({[Tn]:"Recursive",...r},t)}function xv(e,t){let r=et(e)?new globalThis.RegExp(e):e;return L({[V]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function g3(e){return wt(e)?e.allOf:ke(e)?e.anyOf:ln(e)?e.items??[]:[]}function wv(e){return g3(e)}function Sv(e,t){return Jn(e)?L(e.returns,t):_e(t)}var By=class{constructor(t){this.schema=t}Decode(t){return new Gy(this.schema,t)}},Gy=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[gt].Encode(t(a)),Decode:a=>this.decode(r[gt].Decode(a))};return{...r,[gt]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[gt]:n}}Encode(t){return Ae(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function vv(e){return new By(e)}function Iv(e={}){return L({[V]:e[V]??"Unsafe"},e)}function _v(e){return L({[V]:"Void",type:"void"},e)}var Ky={};Ba(Ky,{Any:()=>aa,Argument:()=>sS,Array:()=>Js,AsyncIterator:()=>ec,Awaited:()=>sc,BigInt:()=>ic,Boolean:()=>yp,Capitalize:()=>ev,Composite:()=>TS,Const:()=>MS,Constructor:()=>tc,ConstructorParameters:()=>CS,Date:()=>vp,Enum:()=>OS,Exclude:()=>pc,Extends:()=>lc,Extract:()=>mc,Function:()=>Ro,Index:()=>sa,InstanceType:()=>HS,Instantiate:()=>WS,Integer:()=>XS,Intersect:()=>Sr,Iterator:()=>ac,KeyOf:()=>uc,Literal:()=>Oe,Lowercase:()=>tv,Mapped:()=>wS,Module:()=>hv,Never:()=>_e,Not:()=>gv,Null:()=>Ip,Number:()=>Mn,Object:()=>$e,Omit:()=>ua,Optional:()=>wr,Parameters:()=>yv,Partial:()=>dc,Pick:()=>fa,Promise:()=>wp,Readonly:()=>qr,ReadonlyOptional:()=>kp,Record:()=>Np,Recursive:()=>bv,Ref:()=>Ao,RegExp:()=>xv,Required:()=>hc,Rest:()=>wv,ReturnType:()=>Sv,String:()=>Rr,Symbol:()=>_p,TemplateLiteral:()=>bp,Transform:()=>vv,Tuple:()=>Cn,Uint8Array:()=>Tp,Uncapitalize:()=>rv,Undefined:()=>Pp,Union:()=>Fe,Unknown:()=>no,Unsafe:()=>Iv,Uppercase:()=>nv,Void:()=>_v});var d=Ky;var ao=d.Object({label:d.String(),domain:d.Optional(d.Tuple([d.Number(),d.Number()]))}),rf=d.Object({type:d.Union([d.Literal("identity"),d.Literal("horizontal"),d.Literal("vertical")]),value:d.Optional(d.Number())}),yee=d.Object({schemaVersion:d.Literal("1.0"),title:d.Optional(d.String()),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(rf))});var y3=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}))}),b3=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})}),qy=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("calibration"),data:d.Array(y3),distribution:d.Optional(d.Array(b3)),x:d.Literal("predicted"),y:d.Literal("observed"),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(rf))});var x3=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})}),Hy=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("roc"),data:d.Array(x3),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity"),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(rf))});var w3=d.Union([Hy,qy],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var Er=d.Object({id:d.String(),model:d.Optional(d.String()),population:d.String(),label:d.Optional(d.String())}),Pv=d.Union([d.Literal("model"),d.Literal("population"),d.Literal("evaluation"),d.Literal("context")]),Tv=d.Object({label:d.String(),group:d.String(),role:Pv}),gc=d.Object({id:d.String(),evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),display:Tv}),S3=d.Object({x:d.Number(),y:d.Number()}),Yy=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(S3,{minItems:2}),label:d.Optional(d.String())})]),v3=d.Intersect([Yy,d.Object({scope:d.Literal("global")})]),I3=d.Intersect([Yy,d.Object({scope:d.Literal("population"),population:d.String()})]),_3=d.Intersect([Yy,d.Object({scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),Mv=d.Union([v3,I3,_3]),Wr=d.Object({schemaVersion:d.Literal("2.0"),title:d.Optional(d.String()),evaluations:d.Array(Er),series:d.Array(gc),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(Mv))}),nf=d.Union([d.Literal("probability_threshold"),d.Literal("ppcr")]),wi=d.Object({operatingPoint:d.Optional(d.Object({dimension:nf}))}),Ap=d.Object({operatingPoint:d.Optional(d.Object({dimension:d.Literal("probability_threshold")}))});var Cv=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}))}),Ov=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}))}),kv=d.Union([Cv,Ov]),P3=d.Object({seriesId:d.String(),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),Wy=d.Intersect([Wr,d.Object({type:d.Literal("calibration"),data:d.Array(kv),distribution:d.Optional(d.Array(P3)),x:d.Literal("predicted"),y:d.Literal("observed")})]);var Xy=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")]),Nv=d.Object({id:Xy,label:d.String()}),Ir=d.Object({metricId:Xy,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()]))}),Rv=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})})]),Ev=d.Object({censoringHeuristic:d.Optional(d.String()),competingEventHeuristic:d.Optional(d.String())}),Av=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),operatingPoint:Rv,context:d.Optional(Ev),values:d.Array(Ir)}),Zy=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("performance_table"),title:d.Optional(d.String()),evaluations:d.Array(Er),metrics:d.Array(Nv),rows:d.Array(Av)});var $v=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),netBenefit:d.Number(),performance:d.Optional(d.Array(Ir))}),Dv=d.Intersect([Er,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Lv=d.Intersect([gc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Vv=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_none")}),Fv={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")},jv=d.Union([d.Object({...Fv,scope:d.Literal("population"),population:d.String()}),d.Object({...Fv,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),Uv=d.Union([Vv,jv]),Qy=d.Intersect([Wr,Ap,d.Object({type:d.Literal("decision_curve"),evaluations:d.Array(Dv,{minItems:1}),series:d.Array(Lv,{minItems:1}),data:d.Array($v),x:d.Literal("threshold"),y:d.Literal("netBenefit"),references:d.Array(Uv,{minItems:2})})]);var T3=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(Ir))}),Jy=d.Intersect([Wr,wi,d.Object({type:d.Literal("gains"),data:d.Array(T3),x:d.Literal("ppcr"),y:d.Literal("sensitivity")})]);var Bv=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),interventionsAvoided:d.Number(),performance:d.Optional(d.Array(Ir))}),Gv=d.Intersect([Er,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Kv=d.Intersect([gc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),qv=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_all")}),zv={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")},Hv=d.Union([d.Object({...zv,scope:d.Literal("population"),population:d.String()}),d.Object({...zv,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),Yv=d.Union([qv,Hv]),eb=d.Intersect([Wr,Ap,d.Object({type:d.Literal("interventions_avoided"),evaluations:d.Array(Gv,{minItems:1}),series:d.Array(Kv,{minItems:1}),data:d.Array(Bv),x:d.Literal("threshold"),y:d.Literal("interventionsAvoided"),references:d.Array(Yv,{minItems:2})})]);var M3=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),lift:d.Number(),performance:d.Optional(d.Array(Ir))}),tb=d.Intersect([Wr,wi,d.Object({type:d.Literal("lift"),data:d.Array(M3),x:d.Literal("ppcr"),y:d.Literal("lift")})]);var C3=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(Ir))}),rb=d.Intersect([Wr,wi,d.Object({type:d.Literal("precision_recall"),data:d.Array(C3),x:d.Literal("sensitivity"),y:d.Literal("ppv")})]);var Wv=d.Object({stateId:d.String(),label:d.Optional(d.String()),estimate:d.Optional(d.Union([d.Number(),d.Null()])),mass:d.Optional(d.Union([d.Number(),d.Null()])),count:d.Optional(d.Union([d.Integer(),d.Null()])),lower:d.Optional(d.Union([d.Number(),d.Null()])),upper:d.Optional(d.Union([d.Number(),d.Null()]))}),Xv=d.Object({type:d.String(),lower:d.Optional(d.Union([d.Number(),d.Null()])),upper:d.Optional(d.Union([d.Number(),d.Null()])),includeLower:d.Optional(d.Boolean()),includeUpper:d.Optional(d.Boolean()),rankLower:d.Optional(d.Union([d.Number(),d.Null()])),rankUpper:d.Optional(d.Union([d.Number(),d.Null()])),operatingPointType:d.Optional(d.String()),cutoff:d.Optional(d.Union([d.Number(),d.Null()])),value:d.Optional(d.Union([d.Number(),d.Null()])),realizedPpcr:d.Optional(d.Union([d.Number(),d.Null()]))}),of=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Union([d.Number(),d.Null()])),estimator:d.String(),estimateOrigin:d.Optional(d.Union([d.Literal("event_table"),d.Literal("fixed_time_horizon")])),stratum:d.Optional(Xv),region:d.Optional(d.String()),censoringHeuristic:d.Optional(d.String()),competingHeuristic:d.Optional(d.String()),states:d.Array(Wv,{minItems:1}),regimeId:d.Optional(d.String()),interventionId:d.Optional(d.String()),estimand:d.Optional(d.String()),contrastId:d.Optional(d.String())});var Zv=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})}),O3=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})}),Qv=d.Object({evaluationId:d.String(),type:nf,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(Ir))}),af=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("prediction_distribution"),title:d.Optional(d.String()),evaluations:d.Array(Er,{minItems:1}),operatingPoint:d.Optional(d.Object({dimension:nf})),bins:d.Array(Zv,{minItems:1}),rankBins:d.Optional(d.Array(O3)),operatingPoints:d.Array(Qv,{minItems:1}),stateDistributions:d.Optional(d.Array(of))});var k3=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(Ir))}),nb=d.Intersect([Wr,wi,d.Object({type:d.Literal("roc"),data:d.Array(k3),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity")})]);var ob=d.Union([nb,Wy,rb,Jy,tb,Qy,eb,af],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var ib=d.Object({id:d.String(),label:d.String()}),ab=d.Object({metric:d.Literal("auroc"),owner:d.Object({type:d.Literal("evaluation"),evaluationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),sb=d.Object({metric:d.Literal("prevalence"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),N3=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()])}),R3=d.Union([ab,sb]),Jv=d.Union([ab,sb,N3]),E3=Jv,A3=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(Er),populations:d.Array(ib),metrics:d.Array(R3)}),F3=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array(Er),populations:d.Array(ib),metrics:d.Array(Jv)}),cb=d.Union([A3,F3],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var ub=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("outcome_distribution"),title:d.Optional(d.String()),evaluations:d.Array(Er,{minItems:1}),stateDistributions:d.Array(of,{minItems:1})});var fb=d.Union([ob,Zy,cb,af,ub]),eI=d.Object({id:d.String(),title:d.Optional(d.String()),spec:fb}),Fp=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("report"),title:d.Optional(d.String()),components:d.Array(eI,{minItems:1})}),lb=d.Object({type:d.Literal("component"),id:d.String(),title:d.Optional(d.String()),spec:fb}),tI=d.Object({type:d.Literal("group"),id:d.String(),title:d.String(),components:d.Array(lb,{minItems:1})}),rI=d.Object({id:d.String(),title:d.String(),items:d.Array(d.Union([lb,tI]),{minItems:1})}),$p=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("report"),title:d.Optional(d.String()),sections:d.Array(rI,{minItems:1})}),$3=d.Union([Fp,$p],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function Dp(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 pb(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 Lp(e,t){if(t&&!t.has(e.evaluationId))throw new Error(`unknown evaluation id: ${e.evaluationId}`);if(e.horizon!==void 0&&e.horizon!==null&&(!Number.isFinite(e.horizon)||e.horizon<0))throw new Error(`horizon must be finite and non-negative for evaluation ${e.evaluationId}`);if(e.estimateOrigin!==void 0&&e.estimateOrigin!==null&&e.estimateOrigin!=="event_table"&&e.estimateOrigin!=="fixed_time_horizon")throw new Error(`invalid estimateOrigin '${e.estimateOrigin}' for evaluation ${e.evaluationId}`);if(!e.states||e.states.length===0)throw new Error(`states must be non-empty for evaluation ${e.evaluationId}`);for(let r of e.states){if(r.estimate!==void 0&&r.estimate!==null&&(!Number.isFinite(r.estimate)||r.estimate<0||r.estimate>1))throw new Error(`estimate must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.lower!==void 0&&r.lower!==null&&(!Number.isFinite(r.lower)||r.lower<0||r.lower>1))throw new Error(`lower bound must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.upper!==void 0&&r.upper!==null&&(!Number.isFinite(r.upper)||r.upper<0||r.upper>1))throw new Error(`upper bound must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.lower!==void 0&&r.lower!==null&&r.upper!==void 0&&r.upper!==null&&r.lower>r.upper)throw new Error(`lower bound ${r.lower} cannot exceed upper bound ${r.upper} for state ${r.stateId}`);if(r.mass!==void 0&&r.mass!==null&&(!Number.isFinite(r.mass)||r.mass<0))throw new Error(`mass must be finite and non-negative for state ${r.stateId}`);if(r.count!==void 0&&r.count!==null&&(!Number.isInteger(r.count)||r.count<0))throw new Error(`count must be a non-negative integer for state ${r.stateId}`)}if(e.stratum){let r=e.stratum;if(r.lower!==void 0&&r.lower!==null&&r.upper!==void 0&&r.upper!==null&&r.lower>r.upper)throw new Error(`stratum lower bound ${r.lower} cannot exceed upper bound ${r.upper} for evaluation ${e.evaluationId}`);if(r.rankLower!==void 0&&r.rankLower!==null&&r.rankUpper!==void 0&&r.rankUpper!==null&&r.rankLower>r.rankUpper)throw new Error(`stratum rankLower ${r.rankLower} cannot exceed rankUpper ${r.rankUpper} for evaluation ${e.evaluationId}`)}}function mb(e){let t=new Set;for(let r of e.evaluations){if(t.has(r.id))throw new Error(`duplicate evaluation id: ${r.id}`);t.add(r.id)}if(!e.stateDistributions||e.stateDistributions.length===0)throw new Error("stateDistributions must be non-empty");for(let r of e.stateDistributions)Lp(r,t)}function sf(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)}if(e.stateDistributions)for(let i of e.stateDistributions)Lp(i,t);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 db(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"){sf(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 nI(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 D3(e){return nI(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function L3(e){return nI(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function V3(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 j3(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 hb(e,t){return[...new Set(e)].map(n=>j3(n,t))}function U3(e,t="population"){let r=hb(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 z3(e,t){let r=hb(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 B3(e,t,r,n){let o=hb(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 vt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Rn(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function vi(e){let t,r,n;e.length!==2?(t=vt,r=(s,c)=>vt(e(s),c),n=(s,c)=>e(s)-c):(t=e===vt||e===Rn?e:G3,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 G3(){return 0}function cf(e){return e===null?NaN:+e}function*oI(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 iI=vi(vt),aI=iI.right,K3=iI.left,q3=vi(cf).center,Ii=aI;function es(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(o=+o)>=o&&++r}return r}function H3(e){return e.length|0}function Y3(e){return!(e>0)}function W3(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function X3(e){return t=>e(...t)}function Vp(...e){let t=typeof e[e.length-1]=="function"&&X3(e.pop());e=e.map(W3);let r=e.map(H3),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some(Y3))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 jp(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 yc(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 bc(e,t){let r=yc(e,t);return r&&Math.sqrt(r)}function Yt(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 Ar=class extends Map{constructor(t,r=uI){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(gb(this,t))}has(t){return super.has(gb(this,t))}set(t,r){return super.set(sI(this,t),r)}delete(t){return super.delete(cI(this,t))}},so=class extends Set{constructor(t,r=uI){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(gb(this,t))}add(t){return super.add(sI(this,t))}delete(t){return super.delete(cI(this,t))}};function gb({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function sI({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function cI({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function uI(e){return e!==null&&typeof e=="object"?e.valueOf():e}function uf(e){return e}function Fo(e,...t){return bb(e,uf,uf,t)}function co(e,t,...r){return bb(e,uf,t,r)}function yb(e,t,...r){return bb(e,Array.from,t,r)}function bb(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new Ar,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 xb(e,t){return Array.from(t,r=>e[r])}function _i(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=ff(a[o],a[i]);if(s)return s}})):(r=e.map(r),n.sort((o,i)=>ff(r[o],r[i]))),xb(e,n)}return e.sort(wb(r))}function wb(e=vt){if(e===vt)return ff;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 ff(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function xc(e,t,r){return(t.length!==2?_i(co(e,t,r),(([n,o],[i,a])=>vt(o,a)||vt(n,i))):_i(Fo(e,r),(([n,o],[i,a])=>t(o,a)||vt(n,i)))).map(([n])=>n)}var Z3=Math.sqrt(50),Q3=Math.sqrt(10),J3=Math.sqrt(2);function Up(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>=Z3?10:i>=Q3?5:i>=J3?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 Bp(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 Fr(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 Gp(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 Kp(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?ff:wb(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));Kp(e,t,m,h,o)}let i=e[t],a=r,s=n;for(lf(e,r,t),o(e[n],i)>0&&lf(e,r,n);a0;)--s}o(e[r],i)===0?lf(e,r,s):(++s,lf(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function lf(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function pf(e,t=vt){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?vt(a,o)>0:vt(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 En(e,t,r){if(e=Float64Array.from(oI(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Fr(e);if(t>=1)return er(e);var n,o=(n-1)*t,i=Math.floor(o),a=er(Kp(e,i).subarray(0,i+1)),s=Fr(e.subarray(i+1));return a+(s-a)*(o-i)}}function Sb(e,t,r=cf){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 qp(e,t,r){let n=es(e),o=En(e,.75)-En(e,.25);return n&&o?Math.ceil((r-t)/(2*o*Math.pow(n,-1/3))):1}function mf(e,t,r){let n=es(e),o=bc(e);return n&&o?Math.ceil((r-t)*Math.cbrt(n)/(3.49*o)):1}function Hp(e,t){let r=0,n=0;if(t===void 0)for(let o of e)o!=null&&(o=+o)>=o&&(++r,n+=o);else{let o=-1;for(let i of e)(i=t(i,++o,e))!=null&&(i=+i)>=i&&(++r,n+=i)}if(r)return n/r}function rs(e,t){return En(e,.5,t)}function*tE(e){for(let t of e)yield*t}function Sc(e){return Array.from(tE(e))}function Yp(e,t){let r=new Ar;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 Wp(e,t=rE){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function rE(e,t){return[e,t]}function ns(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 aE(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function sE(){return!this.__axis}function cE(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===vb||e===Xp?-1:1,f=e===Xp||e===Ib?"x":"y",p=e===vb||e===_b?nE:oE;function l(m){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),b=o??(t.tickFormat?t.tickFormat.apply(t,r):fI),y=Math.max(i,0)+s,x=t.range(),g=+x[0]+c,S=+x[x.length-1]+c,w=(t.bandwidth?aE:iE)(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"),C=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)),C=C.merge(P.append("text").attr("fill","currentColor").attr(f,u*y).attr("dy",e===vb?"0em":e===_b?"0.71em":"0.32em")),m!==_&&(v=v.transition(m),I=I.transition(m),R=R.transition(m),C=C.transition(m),T=T.transition(m).attr("opacity",lI).attr("transform",function(N){return isFinite(N=w(N))?p(N+c):this.getAttribute("transform")}),P.attr("opacity",lI).attr("transform",function(N){var G=this.parentNode.__axis;return p((G&&isFinite(G=G(N))?G:w(N))+c)})),T.remove(),v.attr("d",e===Xp||e===Ib?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),C.attr(f,u*y).text(b),_.filter(sE).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Ib?"start":e===Xp?"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 Pb(e){return cE(_b,e)}var uE={value:()=>{}};function mI(){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}})}Zp.prototype=mI.prototype={constructor:Zp,on:function(e,t){var r=this._,n=fE(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)),$o.hasOwnProperty(t)?{space:$o[t],local:e}:e}function pE(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Qp&&t.documentElement.namespaceURI===Qp?t.createElement(e):t.createElementNS(r,e)}}function mE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ti(e){var t=Pi(e);return(t.local?mE:pE)(t)}function dE(){}function os(e){return e==null?dE:function(){return this.querySelector(e)}}function dI(e){typeof e!="function"&&(e=os(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 TI(e){e||(e=ME);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 MI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function CI(){return Array.from(this)}function OI(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?AE:typeof t=="function"?$E:FE)(e,t,r??"")):pa(this.node(),e)}function pa(e,t){return e.style.getPropertyValue(t)||tm(e).getComputedStyle(e,null).getPropertyValue(t)}function DE(e){return function(){delete this[e]}}function LE(e,t){return function(){this[e]=t}}function VE(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function FI(e,t){return arguments.length>1?this.each((t==null?DE:typeof t=="function"?VE:LE)(e,t)):this.node()[e]}function $I(e){return e.trim().split(/^|\s+/)}function Cb(e){return e.classList||new DI(e)}function DI(e){this._node=e,this._names=$I(e.getAttribute("class")||"")}DI.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 LI(e,t){for(var r=Cb(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function nA(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?rm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?rm(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=uA.exec(e))?new Bt(t[1],t[2],t[3],1):(t=fA.exec(e))?new Bt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lA.exec(e))?rm(t[1],t[2],t[3],t[4]):(t=pA.exec(e))?rm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mA.exec(e))?c_(t[1],t[2]/100,t[3]/100,1):(t=dA.exec(e))?c_(t[1],t[2]/100,t[3]/100,t[4]):r_.hasOwnProperty(e)?i_(r_[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function i_(e){return new Bt(e>>16&255,e>>8&255,e&255,1)}function rm(e,t,r,n){return n<=0&&(e=t=r=NaN),new Bt(e,t,r,n)}function bf(e){return e instanceof Lo||(e=hn(e)),e?(e=e.rgb(),new Bt(e.r,e.g,e.b,e.opacity)):new Bt}function An(e,t,r,n){return arguments.length===1?bf(e):new Bt(e,t,r,n??1)}function Bt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ci(Bt,An,da(Lo,{brighter(e){return e=e==null?ss:Math.pow(ss,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Bt(as(this.r),as(this.g),as(this.b),om(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:a_,formatHex:a_,formatHex8:yA,formatRgb:s_,toString:s_}));function a_(){return`#${is(this.r)}${is(this.g)}${is(this.b)}`}function yA(){return`#${is(this.r)}${is(this.g)}${is(this.b)}${is((isNaN(this.opacity)?1:this.opacity)*255)}`}function s_(){let e=om(this.opacity);return`${e===1?"rgb(":"rgba("}${as(this.r)}, ${as(this.g)}, ${as(this.b)}${e===1?")":`, ${e})`}`}function om(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function as(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function is(e){return e=as(e),(e<16?"0":"")+e.toString(16)}function c_(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new fo(e,t,r,n)}function f_(e){if(e instanceof fo)return new fo(e.h,e.s,e.l,e.opacity);if(e instanceof Lo||(e=hn(e)),!e)return new fo;if(e instanceof fo)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 fo(a,s,c,e.opacity)}function xf(e,t,r,n){return arguments.length===1?f_(e):new fo(e,t,r,n??1)}function fo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ci(fo,xf,da(Lo,{brighter(e){return e=e==null?ss:Math.pow(ss,e),new fo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new fo(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 Bt(kb(e>=240?e-240:e+120,o,n),kb(e,o,n),kb(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new fo(u_(this.h),nm(this.s),nm(this.l),om(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=om(this.opacity);return`${e===1?"hsl(":"hsla("}${u_(this.h)}, ${nm(this.s)*100}%, ${nm(this.l)*100}%${e===1?")":`, ${e})`}`}}));function u_(e){return e=(e||0)%360,e<0?e+360:e}function nm(e){return Math.max(0,Math.min(1,e||0))}function kb(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 im=Math.PI/180,am=180/Math.PI;var sm=18,l_=.96422,p_=1,m_=.82521,d_=4/29,Ic=6/29,h_=3*Ic*Ic,bA=Ic*Ic*Ic;function g_(e){if(e instanceof Vo)return new Vo(e.l,e.a,e.b,e.opacity);if(e instanceof Oi)return y_(e);e instanceof Bt||(e=bf(e));var t=Ab(e.r),r=Ab(e.g),n=Ab(e.b),o=Nb((.2225045*t+.7168786*r+.0606169*n)/p_),i,a;return t===r&&r===n?i=a=o:(i=Nb((.4360747*t+.3850649*r+.1430804*n)/l_),a=Nb((.0139322*t+.0971045*r+.7141733*n)/m_)),new Vo(116*o-16,500*(i-o),200*(o-a),e.opacity)}function _c(e,t,r,n){return arguments.length===1?g_(e):new Vo(e,t,r,n??1)}function Vo(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ci(Vo,_c,da(Lo,{brighter(e){return new Vo(this.l+sm*(e??1),this.a,this.b,this.opacity)},darker(e){return new Vo(this.l-sm*(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=l_*Rb(t),e=p_*Rb(e),r=m_*Rb(r),new Bt(Eb(3.1338561*t-1.6168667*e-.4906146*r),Eb(-.9787684*t+1.9161415*e+.033454*r),Eb(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function Nb(e){return e>bA?Math.pow(e,1/3):e/h_+d_}function Rb(e){return e>Ic?e*e*e:h_*(e-d_)}function Eb(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ab(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xA(e){if(e instanceof Oi)return new Oi(e.h,e.c,e.l,e.opacity);if(e instanceof Vo||(e=g_(e)),e.a===0&&e.b===0)return new Oi(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 __(e,t){return function(r){return e+r*t}}function SA(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 Tc(e,t){var r=t-e;return r?__(e,r>180||r<-180?r-360*Math.round(r/360):r):Pc(isNaN(e)?t:e)}function P_(e){return(e=+e)==1?bt:function(t,r){return r-t?SA(t,r,e):Pc(isNaN(t)?r:t)}}function bt(e,t){var r=t-e;return r?__(e,r):Pc(isNaN(e)?t:e)}var Fn=(function e(t){var r=P_(t);function n(o,i){var a=r((o=An(o)).r,(i=An(i)).r),s=r(o.g,i.g),c=r(o.b,i.b),u=bt(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 T_(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:mt(n,o)})),r=Vb.lastIndex;return r180?f+=360:f-u>180&&(u+=360),l.push({i:p.push(o(p)+"rotate(",null,n)-2,x:mt(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:mt(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:mt(u,p)},{i:b-2,x:mt(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;--Cc}function V_(){fs=(mm=Tf.now())+dm,Cc=_f=0;try{z_()}finally{Cc=0,kA(),fs=0}}function OA(){var e=Tf.now(),t=e-mm;t>j_&&(dm-=t,mm=e)}function kA(){for(var e,t=pm,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:pm=r);Pf=e,qb(n)}function qb(e){if(!Cc){_f&&(_f=clearTimeout(_f));var t=e-fs;t>24?(e<1/0&&(_f=setTimeout(V_,e-Tf.now()-dm)),If&&(If=clearInterval(If))):(If||(mm=Tf.now(),If=setInterval(OA,j_)),Cc=1,U_(V_))}}function gm(e,t,r){var n=new Mf;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,r),n}var NA=Tb("start","end","cancel","interrupt"),RA=[],K_=0,B_=1,bm=2,ym=3,G_=4,xm=5,Of=6;function ga(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;EA(e,r,{name:t,index:n,group:o,on:NA,tween:RA,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:K_})}function kf(e,t){var r=Wt(e,t);if(r.state>K_)throw new Error("too late; already scheduled");return r}function mr(e,t){var r=Wt(e,t);if(r.state>ym)throw new Error("too late; already running");return r}function Wt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function EA(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=hm(i,0,r.time);function i(u){r.state=B_,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!==B_)return c();for(f in n)if(m=n[f],m.name===r.name){if(m.state===ym)return gm(a);m.state===G_?(m.state=Of,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[f]):+fbm&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function JA(e,t,r){var n,o,i=QA(t)?kf:mr;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function rP(e,t){var r=this._id;return arguments.length<2?Wt(this.node(),r).on.on(e):this.each(JA(r,e,t))}function e4(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function nP(){return this.on("end.remove",e4(this._id))}function oP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=os(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 yP;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;ols)if(!(Math.abs(p*c-u*f)>ls)||!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((Yb-Math.acos((b+l-y)/(2*x*g)))/2),w=S/g,_=S/x;Math.abs(w-1)>ls&&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)>ls||Math.abs(this._y1-f)>ls)&&this._append`L${u},${f}`,n&&(l<0&&(l=l%Wb+Wb),l>g4?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>ls&&this._append`A${n},${n},0,${+(l>=Yb)},${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 bP(){return new ya}bP.prototype=ya.prototype;function po(e=3){return new ya(+e)}function xP(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ps(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 Uo(e){return e=ps(Math.abs(e)),e?e[1]:NaN}function wP(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 SP(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var b4=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zo(e){if(!(t=b4.exec(e)))throw new Error("invalid format: "+e);var t;return new _m({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zo.prototype=_m.prototype;function _m(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}_m.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function vP(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 Nf;function IP(e,t){var r=ps(e,t);if(!r)return Nf=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(Nf=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")+ps(e,Math.max(0,t+i-1))[0]}function Xb(e,t){var r=ps(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 Zb={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:xP,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)=>Xb(e*100,t),r:Xb,s:IP,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Qb(e){return e}var _P=Array.prototype.map,PP=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function TP(e){var t=e.grouping===void 0||e.thousands===void 0?Qb:wP(_P.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?Qb:SP(_P.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=zo(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"):Zb[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=Zb[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 C(N){var G=I,D=T,O,z,U;if(v==="c")D=P(N)+D,N="";else{N=+N;var W=N<0||1/N<0;if(N=isNaN(N)?c:P(Math.abs(N),w),_&&(N=vP(N)),W&&+N==0&&b!=="+"&&(W=!1),G=(W?b==="("?b:s:b==="-"||b==="("?"":b)+G,D=(v==="s"&&!isNaN(N)&&Nf!==void 0?PP[8+Nf/3]:"")+D+(W&&b==="("?")":""),R){for(O=-1,z=N.length;++OU||U>57){D=(U===46?o+N.slice(O+1):N.slice(O))+D,N=N.slice(0,O);break}}}S&&!x&&(N=t(N,1/0));var B=G.length+N.length+D.length,q=B>1)+G+N+D+q.slice(B);break;default:N=q+G+N+D;break}return i(N)}return C.toString=function(){return p+""},C}function f(p,l){var m=Math.max(-8,Math.min(8,Math.floor(Uo(l)/3)))*3,h=Math.pow(10,-m),b=u((p=zo(p),p.type="f",p),{suffix:PP[8+m/3]});return function(y){return b(h*y)}}return{format:u,formatPrefix:f}}var Pm,$n,Tm;Jb({thousands:",",grouping:[3],currency:["$",""]});function Jb(e){return Pm=TP(e),$n=Pm.format,Tm=Pm.formatPrefix,Pm}function e0(e){return Math.max(0,-Uo(Math.abs(e)))}function t0(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Uo(t)/3)))*3-Uo(Math.abs(e)))}function r0(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Uo(t)-Uo(e))+1}var ce=1e-6,Mm=1e-12,ye=Math.PI,He=ye/2,n0=ye/4,tr=ye*2,Xt=180/ye,Ye=ye/180,ve=Math.abs,Dn=Math.atan,dr=Math.atan2,se=Math.cos;var Cm=Math.exp;var ms=Math.log,Om=Math.pow,ae=Math.sin,Pr=Math.sign||function(e){return e>0?1:e<0?-1:0},st=Math.sqrt,kc=Math.tan;function km(e){return e>1?0:e<-1?ye:Math.acos(e)}function Mt(e){return e>1?He:e<-1?-He:Math.asin(e)}function rr(){}function Nm(e,t){e&&CP.hasOwnProperty(e.type)&&CP[e.type](e,t)}var MP={Feature:function(e,t){Nm(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++nye&&(e-=Math.round(e/tr)*tr),[e,t]}i0.invert=i0;function a0(e,t,r){return(e%=tr)?t||r?$f(NP(e),RP(t,r)):NP(e):t||r?RP(t,r):i0}function kP(e){return function(t,r){return t+=e,ve(t)>ye&&(t-=Math.round(t/tr)*tr),[t,r]}}function NP(e){var t=kP(e);return t.invert=kP(-e),t}function RP(e,t){var r=se(e),n=ae(e),o=se(t),i=ae(t);function a(s,c){var u=se(c),f=se(s)*u,p=ae(s)*u,l=ae(c),m=l*r+f*n;return[dr(p*o-m*i,f*r-l*n),Mt(m*o+p*i)]}return a.invert=function(s,c){var u=se(c),f=se(s)*u,p=ae(s)*u,l=ae(c),m=l*o-p*i;return[dr(p*o+l*i,f*r+m*n),Mt(m*r-f*n)]},a}function EP(e){e=a0(e[0]*Ye,e[1]*Ye,e.length>2?e[2]*Ye:0);function t(r){return r=e(r[0]*Ye,r[1]*Ye),r[0]*=Xt,r[1]*=Xt,r}return t.invert=function(r){return r=e.invert(r[0]*Ye,r[1]*Ye),r[0]*=Xt,r[1]*=Xt,r},t}function FP(e,t,r,n,o,i){if(r){var a=se(t),s=ae(t),c=n*r;o==null?(o=t+n*tr,i=t-c/2):(o=AP(a,o),i=AP(a,i),(n>0?oi)&&(o+=n*tr));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 Rc(e,t){return ve(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 $P(e){if(t=e.length){for(var t,r=0,n=e[0],o;++r=0?1:-1,R=P*T,C=R>ye,N=y*v;if(c.add(dr(N*P*ae(R),x*I+N*se(R))),a+=C?T+P*tr:T,C^h>=r^w>=r){var G=Nc(Bo(m),Bo(S));Ff(G);var D=Nc(i,G);Ff(D);var O=(C^T>=0?-1:1)*Mt(D[2]);(n>O||n===O&&(G[0]||G[1]))&&(s+=C^T>=0?1:-1)}}return(a<-ce||a0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v1&&w&2&&_.push(_.pop().concat(_.shift())),f.push(_.filter(x4))}}return l}}function x4(e){return e.length>1}function w4(e,t){return((e=e.x)[0]<0?e[1]-He-ce:He-e[1])-((t=t.x)[0]<0?t[1]-He-ce:He-t[1])}var c0=$m(function(){return!0},S4,I4,[-ye,-He]);function S4(e){var t=NaN,r=NaN,n=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,a){var s=i>0?ye:-ye,c=ve(i-t);ve(c-ye)0?He:-He),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(i,r),o=0):n!==s&&c>=ye&&(ve(t-n)ce?Dn((ae(t)*(i=se(n))*ae(r)-ae(n)*(o=se(t))*ae(e))/(o*i*a)):(t+n)/2}function I4(e,t,r,n){var o;if(e==null)o=r*He,n.point(-ye,o),n.point(0,o),n.point(ye,o),n.point(ye,0),n.point(ye,-o),n.point(0,-o),n.point(-ye,-o),n.point(-ye,0),n.point(-ye,o);else if(ve(e[0]-t[0])>ce){var i=e[0]0,o=ve(t)>ce;function i(f,p,l,m){FP(m,e,r,l,f,p)}function a(f,p){return se(f)*se(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?ye:-ye),x):0;if(!p&&(h=m=w)&&f.lineStart(),w!==m&&(S=c(p,g),(!S||Rc(p,S)||Rc(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||!Rc(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=Bo(f),h=Bo(p),b=[1,0,0],y=Nc(m,h),x=Ef(y,y),g=y[0],S=x-g*g;if(!S)return!l&&f;var w=t*x/S,_=-t*g/S,v=Nc(b,y),I=Af(b,w),T=Af(y,_);Rm(I,T);var P=v,R=Ef(I,P),C=Ef(P,P),N=R*R-C*(Ef(I,I)-1);if(!(N<0)){var G=st(N),D=Af(P,(-R-G)/C);if(Rm(D,I),D=Rf(D),!l)return D;var O=f[0],z=p[0],U=f[1],W=p[1],B;z0^D[1]<(ve(D[0]-O)ye^(O<=D[0]&&D[0]<=z)){var A=Af(P,(-R+G)/C);return Rm(A,I),[D,Rf(A)]}}}function u(f,p){var l=n?e:ye-e,m=0;return f<-l?m|=1:f>l&&(m|=2),p<-l?m|=4:p>l&&(m|=8),m}return $m(a,s,i,n?[0,-e]:[-ye,e-ye])}function VP(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 Df=1e9,Dm=-Df;function Ec(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 ve(u[0]-e)0?0:3:ve(u[0]-r)0?2:1:ve(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=Em(),l,m,h,b,y,x,g,S,w,_,v,I={point:T,lineStart:N,lineEnd:G,polygonStart:R,polygonEnd:C};function T(O,z){o(O,z)&&f.point(O,z)}function P(){for(var O=0,z=0,U=m.length;zn&&(K-J)*(n-A)>(Y-A)*(e-J)&&++O:Y<=n&&(K-J)*(n-A)<(Y-A)*(e-J)&&--O;return O}function R(){f=p,l=[],m=[],v=!0}function C(){var O=P(),z=v&&O,U=(l=Sc(l)).length;(z||U)&&(u.polygonStart(),z&&(u.lineStart(),i(null,null,1,u),u.lineEnd()),U&&Fm(l,s,O,i,u),u.polygonEnd()),f=u,l=m=h=null}function N(){I.point=D,m&&m.push(h=[]),_=!0,w=!1,g=S=NaN}function G(){l&&(D(b,y),x&&w&&p.rejoin(),l.push(p.result())),I.point=T,w&&f.lineEnd()}function D(O,z){var U=o(O,z);if(m&&h.push([O,z]),_)b=O,y=z,x=U,_=!1,U&&(f.lineStart(),f.point(O,z));else if(U&&w)f.point(O,z);else{var W=[g=Math.max(Dm,Math.min(Df,g)),S=Math.max(Dm,Math.min(Df,S))],B=[O=Math.max(Dm,Math.min(Df,O)),z=Math.max(Dm,Math.min(Df,z))];VP(W,B,e,t,r,n)?(w||(f.lineStart(),f.point(W[0],W[1])),f.point(B[0],B[1]),U||f.lineEnd(),v=!1):U&&(f.lineStart(),f.point(O,z),v=!1)}g=O,S=z,w=U}return I}}var Lf=e=>e;var u0=new mn,f0=new mn,jP,UP,l0,p0,ba={point:rr,lineStart:rr,lineEnd:rr,polygonStart:function(){ba.lineStart=_4,ba.lineEnd=T4},polygonEnd:function(){ba.lineStart=ba.lineEnd=ba.point=rr,u0.add(ve(f0)),f0=new mn},result:function(){var e=u0/2;return u0=new mn,e}};function _4(){ba.point=P4}function P4(e,t){ba.point=zP,jP=l0=e,UP=p0=t}function zP(e,t){f0.add(p0*e-l0*t),l0=e,p0=t}function T4(){zP(jP,UP)}var m0=ba;var Ac=1/0,Lm=Ac,Vf=-Ac,Vm=Vf,M4={point:C4,lineStart:rr,lineEnd:rr,polygonStart:rr,polygonEnd:rr,result:function(){var e=[[Ac,Lm],[Vf,Vm]];return Vf=Vm=-(Lm=Ac=1/0),e}};function C4(e,t){eVf&&(Vf=e),tVm&&(Vm=t)}var Fc=M4;var d0=0,h0=0,jf=0,jm=0,Um=0,$c=0,g0=0,y0=0,Uf=0,KP,qP,Go,Ko,ho={point:ds,lineStart:BP,lineEnd:GP,polygonStart:function(){ho.lineStart=N4,ho.lineEnd=R4},polygonEnd:function(){ho.point=ds,ho.lineStart=BP,ho.lineEnd=GP},result:function(){var e=Uf?[g0/Uf,y0/Uf]:$c?[jm/$c,Um/$c]:jf?[d0/jf,h0/jf]:[NaN,NaN];return d0=h0=jf=jm=Um=$c=g0=y0=Uf=0,e}};function ds(e,t){d0+=e,h0+=t,++jf}function BP(){ho.point=O4}function O4(e,t){ho.point=k4,ds(Go=e,Ko=t)}function k4(e,t){var r=e-Go,n=t-Ko,o=st(r*r+n*n);jm+=o*(Go+e)/2,Um+=o*(Ko+t)/2,$c+=o,ds(Go=e,Ko=t)}function GP(){ho.point=ds}function N4(){ho.point=E4}function R4(){HP(KP,qP)}function E4(e,t){ho.point=HP,ds(KP=Go=e,qP=Ko=t)}function HP(e,t){var r=e-Go,n=t-Ko,o=st(r*r+n*n);jm+=o*(Go+e)/2,Um+=o*(Ko+t)/2,$c+=o,o=Ko*e-Go*t,g0+=o*(Go+e),y0+=o*(Ko+t),Uf+=o*3,ds(Go=e,Ko=t)}var b0=ho;function zm(e){this._context=e}zm.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,tr);break}}},result:rr};var w0=new mn,x0,YP,WP,zf,Bf,Bm={point:rr,lineStart:function(){Bm.point=A4},lineEnd:function(){x0&&XP(YP,WP),Bm.point=rr},polygonStart:function(){x0=!0},polygonEnd:function(){x0=null},result:function(){var e=+w0;return w0=new mn,e}};function A4(e,t){Bm.point=XP,YP=zf=e,WP=Bf=t}function XP(e,t){zf-=e,Bf-=t,w0.add(st(zf*zf+Bf*Bf)),zf=e,Bf=t}var S0=Bm;var ZP,Gm,QP,JP,Dc=class{constructor(t){this._append=t==null?eT:F4(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!==QP||this._append!==Gm){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`,QP=n,Gm=this._append,JP=this._,this._=o}this._+=JP;break}}}result(){let t=this._;return this._="",t.length?t:null}};function eT(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return eT;if(t!==ZP){let r=10**t;ZP=t,Gm=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 Dc(r)),a},a.projection(e).digits(r).context(t)}function Vc(e){return{stream:jc(e)}}function jc(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 I0(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),mo(r,e.stream(Fc)),t(Fc.result()),n!=null&&e.clipExtent(n),e}function Gf(e,t,r){return I0(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 Km(e,t,r){return Gf(e,[[0,0],t],r)}function qm(e,t,r){return I0(e,function(n){var o=+t,i=o/(n[1][0]-n[0][0]),a=(o-i*(n[1][0]+n[0][0]))/2,s=-i*n[0][1];e.scale(150*i).translate([a,s])},r)}function Hm(e,t,r){return I0(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 tT=16,$4=se(30*Ye);function _0(e,t){return+t?L4(e,t):D4(e)}function D4(e){return jc({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function L4(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=st(w*w+_*_+v*v),T=Mt(v/=I),P=ve(ve(v)-1)t||ve((x*G+g*D)/S-.5)>.3||a*l+s*m+c*h<$4)&&(r(n,o,i,a,s,c,C,N,P,w/=I,_/=I,v,b,y),y.point(C,N),r(C,N,P,w,_,v,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=_},polygonEnd:function(){n.polygonEnd(),y.lineStart=g}};function x(T,P){T=e(T,P),n.point(T[0],T[1])}function g(){p=NaN,y.point=S,n.lineStart()}function S(T,P){var R=Bo([T,P]),C=e(T,P);r(p,l,f,m,h,b,p=C[0],l=C[1],f=T,m=R[0],h=R[1],b=R[2],tT,n),n.point(p,l)}function w(){y.point=x,n.lineEnd()}function _(){g(),y.point=v,y.lineEnd=I}function v(T,P){S(o=T,P),i=p,a=l,s=m,c=h,u=b,y.point=S}function I(){r(p,l,f,m,h,b,i,a,o,s,c,u,tT,n),y.lineEnd=w,w()}return y}}var V4=jc({point:function(e,t){this.stream.point(e*Ye,t*Ye)}});function j4(e){return jc({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function U4(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 rT(e,t,r,n,o,i){if(!i)return U4(e,t,r,n,o);var a=se(i),s=ae(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 hr(e){return P0(function(){return e})()}function P0(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=c0,y=null,x,g,S,w=Lf,_=.5,v,I,T,P,R;function C(O){return T(O[0]*Ye,O[1]*Ye)}function N(O){return O=T.invert(O[0],O[1]),O&&[O[0]*Xt,O[1]*Xt]}C.stream=function(O){return P&&R===O?P:P=V4(j4(f)(b(v(w(R=O)))))},C.preclip=function(O){return arguments.length?(b=O,h=void 0,D()):b},C.postclip=function(O){return arguments.length?(w=O,y=x=g=S=null,D()):w},C.clipAngle=function(O){return arguments.length?(b=+O?LP(h=O*Ye):(h=null,c0),D()):h*Xt},C.clipExtent=function(O){return arguments.length?(w=O==null?(y=x=g=S=null,Lf):Ec(y=+O[0][0],x=+O[0][1],g=+O[1][0],S=+O[1][1]),D()):y==null?null:[[y,x],[g,S]]},C.scale=function(O){return arguments.length?(r=+O,G()):r},C.translate=function(O){return arguments.length?(n=+O[0],o=+O[1],G()):[n,o]},C.center=function(O){return arguments.length?(i=O[0]%360*Ye,a=O[1]%360*Ye,G()):[i*Xt,a*Xt]},C.rotate=function(O){return arguments.length?(s=O[0]%360*Ye,c=O[1]%360*Ye,u=O.length>2?O[2]%360*Ye:0,G()):[s*Xt,c*Xt,u*Xt]},C.angle=function(O){return arguments.length?(p=O%360*Ye,G()):p*Xt},C.reflectX=function(O){return arguments.length?(l=O?-1:1,G()):l<0},C.reflectY=function(O){return arguments.length?(m=O?-1:1,G()):m<0},C.precision=function(O){return arguments.length?(v=_0(I,_=O*O),D()):st(_)},C.fitExtent=function(O,z){return Gf(C,O,z)},C.fitSize=function(O,z){return Km(C,O,z)},C.fitWidth=function(O,z){return qm(C,O,z)},C.fitHeight=function(O,z){return Hm(C,O,z)};function G(){var O=rT(r,0,0,l,m,p).apply(null,t(i,a)),z=rT(r,n-O[0],o-O[1],l,m,p);return f=a0(s,c,u),I=$f(t,z),T=$f(f,I),v=_0(I,_),D()}function D(){return P=R=null,C}return function(){return t=e.apply(this,arguments),C.invert=t.invert&&N,G()}}function Uc(e){var t=0,r=ye/3,n=P0(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*Ye,r=i[1]*Ye):[t*Xt,r*Xt]},o}function nT(e){var t=se(e);function r(n,o){return[n*t,ae(o)/t]}return r.invert=function(n,o){return[n/t,Mt(o*t)]},r}function oT(e,t){var r=ae(e),n=(r+ae(t))/2;if(ve(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=z4([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+ce,b+.12*m+ce],[h-.214*m-ce,b+.234*m-ce]]).stream(u),s=a.translate([h-.205*m,b+.212*m]).clipExtent([[h-.214*m+ce,b+.166*m+ce],[h-.115*m-ce,b+.234*m-ce]]).stream(u),p()},f.fitExtent=function(l,m){return Gf(f,l,m)},f.fitSize=function(l,m){return Km(f,l,m)},f.fitWidth=function(l,m){return qm(f,l,m)},f.fitHeight=function(l,m){return Hm(f,l,m)};function p(){return e=t=null,f}return f.scale(1070)}function Ym(e){return function(t,r){var n=se(t),o=se(r),i=e(n*o);return i===1/0?[2,0]:[i*o*ae(t),i*ae(r)]}}function qo(e){return function(t,r){var n=st(t*t+r*r),o=e(n),i=ae(o),a=se(o);return[dr(t*i,n*a),Mt(n&&r*i/n)]}}var M0=Ym(function(e){return st(2/(1+e))});M0.invert=qo(function(e){return 2*Mt(e/2)});function C0(){return hr(M0).scale(124.75).clipAngle(180-.001)}var O0=Ym(function(e){return(e=km(e))&&e/ae(e)});O0.invert=qo(function(e){return e});function k0(){return hr(O0).scale(79.4188).clipAngle(180-.001)}function zc(e,t){return[e,ms(kc((He+t)/2))]}zc.invert=function(e,t){return[e,2*Dn(Cm(t))-He]};function N0(){return R0(zc).scale(961/tr)}function R0(e){var t=hr(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=ye*n(),l=t(EP(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:e===zc?[[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 Wm(e){return kc((He+e)/2)}function iT(e,t){var r=se(e),n=e===t?ae(e):ms(r/se(t))/ms(Wm(t)/Wm(e)),o=r*Om(Wm(e),n)/n;if(!n)return zc;function i(a,s){o>0?s<-He+ce&&(s=-He+ce):s>He-ce&&(s=He-ce);var c=o/Om(Wm(s),n);return[c*ae(n*a),o-c*se(n*a)]}return i.invert=function(a,s){var c=o-s,u=Pr(n)*st(a*a+c*c),f=dr(a,ve(c))*Pr(c);return c*n<0&&(f-=ye*Pr(a)*Pr(c)),[f/n,2*Dn(Om(o/u,1/n))-He]},i}function E0(){return Uc(iT).scale(109.5).parallels([30,30])}function Bc(e,t){return[e,t]}Bc.invert=Bc;function A0(){return hr(Bc).scale(152.63)}function aT(e,t){var r=se(e),n=e===t?ae(e):(r-se(t))/(t-e),o=r/n+e;if(ve(n)2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Gt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Xf(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 Zf=Symbol("implicit");function hs(){var e=new Ar,t=[],r=[],n=Zf;function o(i){let a=e.get(i);if(a===void 0){if(n!==Zf)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 Ar;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 hs(t,r).unknown(n)},Gt.apply(o,arguments),o}function wa(){var e=hs().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 K4(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?q4:K4,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),mt)))(l)))},p.domain=function(l){return arguments.length?(e=Array.from(l,Gc),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=us,f()},p.clamp=function(l){return arguments.length?(a=l?!0:Xr,f()):a!==Xr},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 Qf(){return gs()(Xr,Xr)}function W0(e,t,r,n){var o=wc(e,t,r),i;switch(n=zo(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=t0(o,a))&&(n.precision=i),Tm(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=r0(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=e0(o))&&(n.precision=i-(n.type==="%")*2);break}}return $n(n)}function Ni(e){var t=e.domain;return e.ticks=function(r){var n=t();return uo(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return W0(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=ts(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 ys(){var e=Qf();return e.copy=function(){return Ho(e,ys())},Gt.apply(e,arguments),Ni(e)}function Jf(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,Gc),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Jf(e).unknown(t)},e=arguments.length?Array.from(e,Gc):[0,1],Ni(r)}function el(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 Z4(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 lT(e){return(t,r)=>-e(-t,r)}function X0(e){let t=e(uT,fT),r=t.domain,n=10,o,i;function a(){return o=Z4(n),i=X4(n),r()[0]<0?(o=lT(o),i=lT(i),e(H4,Y4)):e(uT,fT),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=zo(c)).precision==null&&(c.trim=!0),c=$n(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(el(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function tl(){let e=X0(gs()).domain([1,10]);return e.copy=()=>Ho(e,tl()).base(e.base()),Gt.apply(e,arguments),e}function pT(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function mT(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Z0(e){var t=1,r=e(pT(t),mT(t));return r.constant=function(n){return arguments.length?e(pT(t=+n),mT(t)):t},Ni(r)}function rl(){var e=Z0(gs());return e.copy=function(){return Ho(e,rl()).constant(e.constant())},Gt.apply(e,arguments)}function dT(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Q4(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function J4(e){return e<0?-e*e:e*e}function Q0(e){var t=e(Xr,Xr),r=1;function n(){return r===1?e(Xr,Xr):r===.5?e(Q4,J4):e(dT(r),dT(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},Ni(t)}function nl(){var e=Q0(gs());return e.copy=function(){return Ho(e,nl()).exponent(e.exponent())},Gt.apply(e,arguments),e}function ol(){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(urt(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)=>(J0.setTime(+i),ex.setTime(+a),e(J0),e(ex),Math.floor(r(J0,ex))),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 al=rt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);al.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?rt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):al);var Jde=al.range;var nr=rt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),hT=nr.range;var Ri=rt(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=Ri.range,Ei=rt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),t7=Ei.range;var Ai=rt(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=Ai.range,Fi=rt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),n7=Fi.range;var Ln=rt(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=Ln.range,ws=rt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),i7=ws.range,Ss=rt(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=Ss.range;function vs(e){return rt(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 gn=vs(0),Sa=vs(1),Zm=vs(2),Qm=vs(3),Wo=vs(4),Jm=vs(5),ed=vs(6),yT=gn.range,s7=Sa.range,c7=Zm.range,u7=Qm.range,f7=Wo.range,l7=Jm.range,p7=ed.range;function Is(e){return rt(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 yn=Is(0),va=Is(1),td=Is(2),rd=Is(3),Xo=Is(4),nd=Is(5),od=Is(6),bT=yn.range,m7=va.range,d7=td.range,h7=rd.range,g7=Xo.range,y7=nd.range,b7=od.range;var $i=rt(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=$i.range,Di=rt(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=Di.range;var Tr=rt(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());Tr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:rt(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=Tr.range,Mr=rt(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());Mr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:rt(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 v7=Mr.range;function wT(e,t,r,n,o,i){let a=[[nr,1,1e3],[nr,5,5*1e3],[nr,15,15*1e3],[nr,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(wc(u/31536e6,f/31536e6,p));if(m===0)return al.every(Math.max(wc(u,f,p),1));let[h,b]=a[l/a[m-1][2]53)return null;"w"in E||(E.w=1),"Z"in E?(oe=ix(ul(E.y,0,1)),be=oe.getUTCDay(),oe=be>4||be===0?va.ceil(oe):va(oe),oe=ws.offset(oe,(E.V-1)*7),E.y=oe.getUTCFullYear(),E.m=oe.getUTCMonth(),E.d=oe.getUTCDate()+(E.w+6)%7):(oe=ox(ul(E.y,0,1)),be=oe.getDay(),oe=be>4||be===0?Sa.ceil(oe):Sa(oe),oe=Ln.offset(oe,(E.V-1)*7),E.y=oe.getFullYear(),E.m=oe.getMonth(),E.d=oe.getDate()+(E.w+6)%7)}else("W"in E||"U"in E)&&("w"in E||(E.w="u"in E?E.u%7:"W"in E?1:0),be="Z"in E?ix(ul(E.y,0,1)).getUTCDay():ox(ul(E.y,0,1)).getDay(),E.m=0,E.d="W"in E?(E.w+6)%7+E.W*7-(be+5)%7:E.w+E.U*7-(be+6)%7);return"Z"in E?(E.H+=E.Z/100|0,E.M+=E.Z%100,ix(E)):ox(E)}}function T(M,$,H,E){for(var re=0,oe=$.length,be=H.length,we,Ve;re=be)return-1;if(we=$.charCodeAt(re++),we===37){if(we=$.charAt(re++),Ve=_[we in ST?$.charAt(re++):we],!Ve||(E=Ve(M,H,E))<0)return-1}else if(we!=H.charCodeAt(E++))return-1}return E}function P(M,$,H){var E=u.exec($.slice(H));return E?(M.p=f.get(E[0].toLowerCase()),H+E[0].length):-1}function R(M,$,H){var E=m.exec($.slice(H));return E?(M.w=h.get(E[0].toLowerCase()),H+E[0].length):-1}function C(M,$,H){var E=p.exec($.slice(H));return E?(M.w=l.get(E[0].toLowerCase()),H+E[0].length):-1}function N(M,$,H){var E=x.exec($.slice(H));return E?(M.m=g.get(E[0].toLowerCase()),H+E[0].length):-1}function G(M,$,H){var E=b.exec($.slice(H));return E?(M.m=y.get(E[0].toLowerCase()),H+E[0].length):-1}function D(M,$,H){return T(M,t,$,H)}function O(M,$,H){return T(M,r,$,H)}function z(M,$,H){return T(M,n,$,H)}function U(M){return a[M.getDay()]}function W(M){return i[M.getDay()]}function B(M){return c[M.getMonth()]}function q(M){return s[M.getMonth()]}function X(M){return o[+(M.getHours()>=12)]}function J(M){return 1+~~(M.getMonth()/3)}function A(M){return a[M.getUTCDay()]}function K(M){return i[M.getUTCDay()]}function Y(M){return c[M.getUTCMonth()]}function ee(M){return s[M.getUTCMonth()]}function Z(M){return o[+(M.getUTCHours()>=12)]}function ne(M){return 1+~~(M.getUTCMonth()/3)}return{format:function(M){var $=v(M+="",S);return $.toString=function(){return M},$},parse:function(M){var $=I(M+="",!1);return $.toString=function(){return M},$},utcFormat:function(M){var $=v(M+="",w);return $.toString=function(){return M},$},utcParse:function(M){var $=I(M+="",!0);return $.toString=function(){return M},$}}}var ST={"-":"",_:" ",0:"0"},or=/^\s*\d+/,_7=/^%/,P7=/[\\^$*+?|[\]().{}]/g;function je(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=or.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function C7(e,t,r){var n=or.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function O7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function k7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function N7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function vT(e,t,r){var n=or.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function IT(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function R7(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 E7(e,t,r){var n=or.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function A7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function _T(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function F7(e,t,r){var n=or.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function PT(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function $7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function D7(e,t,r){var n=or.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function L7(e,t,r){var n=or.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function V7(e,t,r){var n=or.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function j7(e,t,r){var n=_7.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function U7(e,t,r){var n=or.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function z7(e,t,r){var n=or.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function TT(e,t){return je(e.getDate(),t,2)}function B7(e,t){return je(e.getHours(),t,2)}function G7(e,t){return je(e.getHours()%12||12,t,2)}function K7(e,t){return je(1+Ln.count(Tr(e),e),t,3)}function NT(e,t){return je(e.getMilliseconds(),t,3)}function q7(e,t){return NT(e,t)+"000"}function H7(e,t){return je(e.getMonth()+1,t,2)}function Y7(e,t){return je(e.getMinutes(),t,2)}function W7(e,t){return je(e.getSeconds(),t,2)}function X7(e){var t=e.getDay();return t===0?7:t}function Z7(e,t){return je(gn.count(Tr(e)-1,e),t,2)}function RT(e){var t=e.getDay();return t>=4||t===0?Wo(e):Wo.ceil(e)}function Q7(e,t){return e=RT(e),je(Wo.count(Tr(e),e)+(Tr(e).getDay()===4),t,2)}function J7(e){return e.getDay()}function eF(e,t){return je(Sa.count(Tr(e)-1,e),t,2)}function tF(e,t){return je(e.getFullYear()%100,t,2)}function rF(e,t){return e=RT(e),je(e.getFullYear()%100,t,2)}function nF(e,t){return je(e.getFullYear()%1e4,t,4)}function oF(e,t){var r=e.getDay();return e=r>=4||r===0?Wo(e):Wo.ceil(e),je(e.getFullYear()%1e4,t,4)}function iF(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+je(t/60|0,"0",2)+je(t%60,"0",2)}function MT(e,t){return je(e.getUTCDate(),t,2)}function aF(e,t){return je(e.getUTCHours(),t,2)}function sF(e,t){return je(e.getUTCHours()%12||12,t,2)}function cF(e,t){return je(1+ws.count(Mr(e),e),t,3)}function ET(e,t){return je(e.getUTCMilliseconds(),t,3)}function uF(e,t){return ET(e,t)+"000"}function fF(e,t){return je(e.getUTCMonth()+1,t,2)}function lF(e,t){return je(e.getUTCMinutes(),t,2)}function pF(e,t){return je(e.getUTCSeconds(),t,2)}function mF(e){var t=e.getUTCDay();return t===0?7:t}function dF(e,t){return je(yn.count(Mr(e)-1,e),t,2)}function AT(e){var t=e.getUTCDay();return t>=4||t===0?Xo(e):Xo.ceil(e)}function hF(e,t){return e=AT(e),je(Xo.count(Mr(e),e)+(Mr(e).getUTCDay()===4),t,2)}function gF(e){return e.getUTCDay()}function yF(e,t){return je(va.count(Mr(e)-1,e),t,2)}function bF(e,t){return je(e.getUTCFullYear()%100,t,2)}function xF(e,t){return e=AT(e),je(e.getUTCFullYear()%100,t,2)}function wF(e,t){return je(e.getUTCFullYear()%1e4,t,4)}function SF(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Xo(e):Xo.ceil(e),je(e.getUTCFullYear()%1e4,t,4)}function vF(){return"+0000"}function CT(){return"%"}function OT(e){return+e}function kT(e){return Math.floor(+e/1e3)}var Kc,qc,FT,Zo,$T;sx({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 sx(e){return Kc=ax(e),qc=Kc.format,FT=Kc.parse,Zo=Kc.utcFormat,$T=Kc.utcParse,Kc}function IF(e){return new Date(e)}function _F(e){return e instanceof Date?+e:+new Date(+e)}function id(e,t,r,n,o,i,a,s,c,u){var f=Qf(),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)Lb(e[e.length-1]);var pd=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Q),md=ue(pd);var dd=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Q),hd=ue(dd);var gd=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Q),yd=ue(gd);var bd=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Q),xd=ue(bd);var dl=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Q),Hc=ue(dl);var wd=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Q),Sd=ue(wd);var hl=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Q),Yc=ue(hl);var vd=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Q),Id=ue(vd);var _d=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Q),Pd=ue(_d);var Td=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Q),Md=ue(Td);var Cd=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Q),Od=ue(Cd);var kd=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Q),Nd=ue(kd);var Rd=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Q),Ed=ue(Rd);var Ad=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Q),Fd=ue(Ad);var $d=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Q),Dd=ue($d);var Ld=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Q),Vd=ue(Ld);var jd=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Q),Ud=ue(jd);var zd=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Q),Bd=ue(zd);var Gd=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Q),Kd=ue(Gd);var qd=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Q),Hd=ue(qd);var Yd=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Q),Wd=ue(Yd);var Xd=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Q),Zd=ue(Xd);var Qd=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Q),Jd=ue(Qd);var eh=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Q),th=ue(eh);var rh=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Q),nh=ue(rh);var oh=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Q),ih=ue(oh);var ah=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Q),sh=ue(ah);function ch(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 uh=Mc(Dr(300,.5,0),Dr(-240,.5,1));var lh=Mc(Dr(-100,.75,.35),Dr(80,1.5,.8)),ph=Mc(Dr(260,.75,.35),Dr(80,1.5,.8)),fh=Dr();function mh(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return fh.h=360*e-100,fh.s=1.5-1.5*t,fh.l=.8-.9*t,fh+""}var dh=An(),PF=Math.PI/3,TF=Math.PI*2/3;function hh(e){var t;return e=(.5-e)*Math.PI,dh.r=255*(t=Math.sin(e))*t,dh.g=255*(t=Math.sin(e+PF))*t,dh.b=255*(t=Math.sin(e+TF))*t,dh+""}function gh(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 yh(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var bh=yh(Q("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),xh=yh(Q("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),wh=yh(Q("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Sh=yh(Q("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Kt(e){return function(){return e}}var xx=Math.cos;var Wc=Math.min,gl=Math.sin,Ue=Math.sqrt,wx=1e-12,_s=Math.PI,_0e=_s/2,Xc=2*_s;function vh(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 ya(t)}var C0e=Array.prototype.slice;function Ih(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function DT(e){this._context=e}DT.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 Li(e){return new DT(e)}function _h(e){return e[0]}function Ph(e){return e[1]}function yl(e,t){var r=Kt(!0),n=null,o=Li,i=null,a=vh(s);e=typeof e=="function"?e:e===void 0?_h:Kt(e),t=typeof t=="function"?t:t===void 0?Ph:Kt(t);function s(c){var u,f=(c=Ih(c)).length,p,l=!1,m;for(n==null&&(i=o(m=a())),u=0;u<=f;++u)!(u=m;--h)s.point(S[h],w[h]);s.lineEnd(),s.areaEnd()}x&&(S[l]=+e(y,l,p),w[l]=+t(y,l,p),s.point(n?+n(y,l,p):S[l],r?+r(y,l,p):w[l]))}if(g)return s=null,g+""||null}function f(){return yl().defined(o).curve(a).context(i)}return u.x=function(p){return arguments.length?(e=typeof p=="function"?p:Kt(+p),n=null,u):e},u.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Kt(+p),u):e},u.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Kt(+p),u):n},u.y=function(p){return arguments.length?(t=typeof p=="function"?p:Kt(+p),r=null,u):t},u.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Kt(+p),u):t},u.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Kt(+p),u):r},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(r)},u.lineX1=function(){return f().x(n).y(t)},u.defined=function(p){return arguments.length?(o=typeof p=="function"?p:Kt(!!p),u):o},u.curve=function(p){return arguments.length?(a=p,i!=null&&(s=a(i)),u):a},u.context=function(p){return arguments.length?(p==null?i=s=null:s=a(i=p),u):i},u}var Th=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function vx(e){return new Th(e,!0)}function Ix(e){return new Th(e,!1)}var MF=Ue(3),bl={draw(e,t){let r=Ue(t+Wc(t/28,.75))*.59436,n=r/2,o=n*MF;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-o,-n),e.lineTo(o,n),e.moveTo(-o,n),e.lineTo(o,-n)}};var Vi={draw(e,t){let r=Ue(t/_s);e.moveTo(r,0),e.arc(0,0,r,0,Xc)}};var xl={draw(e,t){let r=Ue(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var LT=Ue(1/3),CF=LT*2,wl={draw(e,t){let r=Ue(t/CF),n=r*LT;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var Sl={draw(e,t){let r=Ue(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var vl={draw(e,t){let r=Ue(t-Wc(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var Il={draw(e,t){let r=Ue(t),n=-r/2;e.rect(n,n,r,r)}};var _l={draw(e,t){let r=Ue(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var OF=.8908130915292852,VT=gl(_s/10)/gl(7*_s/10),kF=gl(Xc/10)*VT,NF=-xx(Xc/10)*VT,Pl={draw(e,t){let r=Ue(t*OF),n=kF*r,o=NF*r;e.moveTo(0,-r),e.lineTo(n,o);for(let i=1;i<5;++i){let a=Xc*i/5,s=xx(a),c=gl(a);e.lineTo(c*r,-s*r),e.lineTo(s*n-c*o,c*n+s*o)}e.closePath()}};var _x=Ue(3),Tl={draw(e,t){let r=-Ue(t/(_x*3));e.moveTo(0,r*2),e.lineTo(-_x*r,-r),e.lineTo(_x*r,-r),e.closePath()}};var RF=Ue(3),Ml={draw(e,t){let r=Ue(t)*.6824,n=r/2,o=r*RF/2;e.moveTo(0,-r),e.lineTo(o,n),e.lineTo(-o,n),e.closePath()}};var Vn=-.5,jn=Ue(3)/2,Px=1/Ue(12),EF=(Px/2+1)*3,Cl={draw(e,t){let r=Ue(t/EF),n=r/2,o=r*Px,i=n,a=r*Px+r,s=-i,c=a;e.moveTo(n,o),e.lineTo(i,a),e.lineTo(s,c),e.lineTo(Vn*n-jn*o,jn*n+Vn*o),e.lineTo(Vn*i-jn*a,jn*i+Vn*a),e.lineTo(Vn*s-jn*c,jn*s+Vn*c),e.lineTo(Vn*n+jn*o,Vn*o-jn*n),e.lineTo(Vn*i+jn*a,Vn*a-jn*i),e.lineTo(Vn*s+jn*c,Vn*c-jn*s),e.closePath()}};var Zc={draw(e,t){let r=Ue(t-Wc(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var Mh=[Vi,xl,wl,Il,Pl,Tl,Cl],Tx=[Vi,vl,Zc,Ml,bl,_l,Sl];function Un(){}function Qc(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Ol(e){this._context=e}Ol.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Mx(e){return new Ol(e)}function jT(e){this._context=e}jT.prototype={areaStart:Un,areaEnd:Un,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Cx(e){return new jT(e)}function UT(e){this._context=e}UT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ox(e){return new UT(e)}function zT(e,t){this._basis=new Ol(e),this._beta=t}zT.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)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 kx=(function e(t){function r(n){return t===1?new Ol(n):new zT(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Jc(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 Ch(e,t){this._context=e,this._k=(1-t)/6}Ch.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:Jc(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:Jc(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 Nx=(function e(t){function r(n){return new Ch(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Oh(e,t){this._context=e,this._k=(1-t)/6}Oh.prototype={areaStart:Un,areaEnd:Un,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:Jc(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 Rx=(function e(t){function r(n){return new Oh(n,t)}return r.tension=function(n){return e(+n)},r})(0);function kh(e,t){this._context=e,this._k=(1-t)/6}kh.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:Jc(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 Ex=(function e(t){function r(n){return new kh(n,t)}return r.tension=function(n){return e(+n)},r})(0);function kl(e,t,r){var n=e._x1,o=e._y1,i=e._x2,a=e._y2;if(e._l01_a>wx){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>wx){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 BT(e,t){this._context=e,this._alpha=t}BT.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:kl(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 Ax=(function e(t){function r(n){return t?new BT(n,t):new Ch(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function GT(e,t){this._context=e,this._alpha=t}GT.prototype={areaStart:Un,areaEnd:Un,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:kl(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 Fx=(function e(t){function r(n){return t?new GT(n,t):new Oh(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function KT(e,t){this._context=e,this._alpha=t}KT.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:kl(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 $x=(function e(t){function r(n){return t?new KT(n,t):new kh(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function qT(e){this._context=e}qT.prototype={areaStart:Un,areaEnd:Un,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 Dx(e){return new qT(e)}function HT(e){return e<0?-1:1}function YT(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(HT(i)+HT(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function WT(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Lx(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 Nh(e){this._context=e}Nh.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:Lx(this,this._t0,WT(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var 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,Lx(this,WT(this,r=YT(this,e,t)),r);break;default:Lx(this,this._t0,r=YT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function XT(e){this._context=new ZT(e)}(XT.prototype=Object.create(Nh.prototype)).point=function(e,t){Nh.prototype.point.call(this,t,e)};function ZT(e){this._context=e}ZT.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 Vx(e){return new Nh(e)}function jx(e){return new XT(e)}function JT(e){this._context=e}JT.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=QT(e),o=QT(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 zx(e){return new Rh(e,.5)}function Bx(e){return new Rh(e,0)}function Gx(e){return new Rh(e,1)}function Ia(e,t,r){this.k=e,this.x=t,this.y=r}Ia.prototype={constructor:Ia,scale:function(e){return e===1?this:new Ia(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ia(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 Kx=new Ia(1,0,0);qx.prototype=Ia.prototype;function qx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Kx;return e.__zoom}function zn(e){return e!=null&&!Number.isNaN(e)}function Cr(e,t){return+zn(t)-+zn(e)||vt(e,t)}function Ps(e,t){return+zn(t)-+zn(e)||Rn(e,t)}function Nl(e){return e!=null&&`${e}`!=""}function Hx(e){return isFinite(e)?e:NaN}function Ts(e){return e>0&&isFinite(e)?e:NaN}function eu(e){return e<0&&isFinite(e)?e:NaN}function Eh(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`${AF(e.getUTCFullYear(),4)}-${ji(e.getUTCMonth()+1,2)}-${ji(e.getUTCDate(),2)}${r||n||o||i?`T${ji(r,2)}:${ji(n,2)}${o||i?`:${ji(o,2)}${i?`.${ji(i,3)}`:""}`:""}Z`:""}`}function AF(e){return e<0?`-${ji(-e,6)}`:e>9999?`+${ji(e,6)}`:ji(e,4)}function ji(e,t){return`${e}`.padStart(t,"0")}var FF=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Rl(e,t){return FF.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ui(e){if(e==null)return;let t=e[0],r=e[e.length-1];return Rn(t,r)}var ru=1e3,Pa=ru*60,Ta=Pa*60,Jo=Ta*24,Qo=Jo*7,Ms=Jo*30,_a=Jo*365,Yx=[["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",ru],["5 seconds",5*ru],["15 seconds",15*ru],["30 seconds",30*ru],["minute",Pa],["5 minutes",5*Pa],["15 minutes",15*Pa],["30 minutes",30*Pa],["hour",Ta],["3 hours",3*Ta],["6 hours",6*Ta],["12 hours",12*Ta],["day",Jo],["2 days",2*Jo],["week",Qo],["2 weeks",2*Qo],["month",Ms],["3 months",3*Ms],["6 months",6*Ms],["year",_a],["2 years",2*_a],["5 years",5*_a],["10 years",10*_a],["20 years",20*_a],["50 years",50*_a],["100 years",100*_a]],Wx=new Map([["second",ru],["minute",Pa],["hour",Ta],["day",Jo],["monday",Qo],["tuesday",Qo],["wednesday",Qo],["thursday",Qo],["friday",Qo],["saturday",Qo],["sunday",Qo],["week",Qo],["month",Ms],["year",_a]]),tM=new Map([["second",nr],["minute",Ri],["hour",Ai],["day",Ln],["monday",Sa],["tuesday",Zm],["wednesday",Qm],["thursday",Wo],["friday",Jm],["saturday",ed],["sunday",gn],["week",gn],["month",$i],["year",Tr]]),Xx=new Map([["second",nr],["minute",Ei],["hour",Fi],["day",Ss],["monday",va],["tuesday",td],["wednesday",rd],["thursday",Xo],["friday",nd],["saturday",od],["sunday",yn],["week",yn],["month",Di],["year",Mr]]),nu=Symbol("intervalDuration"),Fh=Symbol("intervalType");for(let[e,t]of tM)t[nu]=Wx.get(e),t[Fh]="time";for(let[e,t]of Xx)t[nu]=Wx.get(e),t[Fh]="utc";var El=[["year",Mr,"utc"],["month",Di,"utc"],["day",Ss,"utc",6*Ms],["hour",Fi,"utc",3*Jo],["minute",Ei,"utc",6*Ta],["second",nr,"utc",30*Pa]],Ah=[["year",Tr,"time"],["month",$i,"time"],["day",Ln,"time",6*Ms],["hour",Ai,"time",3*Jo],["minute",Ri,"time",6*Ta],["second",nr,"time",30*Pa]],$F=[El[0],Ah[0],El[1],Ah[1],El[2],Ah[2],...El.slice(3)];function rM(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=Xx.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 Zx(e){return nM(rM(e),"time")}function Al(e){return nM(rM(e),"utc")}function nM([e,t],r){let n=(r==="time"?tM:Xx).get(e);return t>1&&(n=n.every(t),n[nu]=Wx.get(e)*t,n[Fh]=r),n}function Qx(e,t){if(!(t>1))return;let r=e[nu];if(!Yx.some(([,o])=>o===r)||r%Jo===0&&JoMath.log(o)).center(Yx,Math.log(r*t))];return(e[Fh]==="time"?Zx:Al)(n)}function eM(e,t,r){let n=t==="time"?qc:Zo;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=DF(r);switch(e){case"millisecond":return tu(n(".%L"),n(":%M:%S"),o);case"second":return tu(n(":%S"),n("%-I:%M"),o);case"minute":return tu(n("%-I:%M"),n("%p"),o);case"hour":return tu(n("%-I %p"),n("%b %-d"),o);case"day":return tu(n("%-d"),n("%b"),o);case"month":return tu(n("%b"),n("%Y"),o);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function DF(e){return e==="left"||e==="right"?(t,r)=>` +var k6=Object.defineProperty;var Ga=(e,t)=>{for(var r in t)k6(e,r,{get:t[r],enumerable:!0})};var vr={};Ga(vr,{HasPropertyKey:()=>fp,IsArray:()=>Nt,IsAsyncIterator:()=>pb,IsBigInt:()=>ju,IsBoolean:()=>pi,IsDate:()=>Ka,IsFunction:()=>mb,IsIterator:()=>db,IsNull:()=>hb,IsNumber:()=>sn,IsObject:()=>Ke,IsRegExp:()=>Uu,IsString:()=>tt,IsSymbol:()=>gb,IsUint8Array:()=>mi,IsUndefined:()=>Rt});function fp(e,t){return t in e}function pb(e){return Ke(e)&&!Nt(e)&&!mi(e)&&Symbol.asyncIterator in e}function Nt(e){return Array.isArray(e)}function ju(e){return typeof e=="bigint"}function pi(e){return typeof e=="boolean"}function Ka(e){return e instanceof globalThis.Date}function mb(e){return typeof e=="function"}function db(e){return Ke(e)&&!Nt(e)&&!mi(e)&&Symbol.iterator in e}function hb(e){return e===null}function sn(e){return typeof e=="number"}function Ke(e){return typeof e=="object"&&e!==null}function Uu(e){return e instanceof globalThis.RegExp}function tt(e){return typeof e=="string"}function gb(e){return typeof e=="symbol"}function mi(e){return e instanceof globalThis.Uint8Array}function Rt(e){return e===void 0}function N6(e){return e.map(t=>lp(t))}function R6(e){return new Date(e.getTime())}function E6(e){return new Uint8Array(e)}function A6(e){return new RegExp(e.source,e.flags)}function F6(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=lp(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=lp(e[r]);return t}function lp(e){return Nt(e)?N6(e):Ka(e)?R6(e):mi(e)?E6(e):Uu(e)?A6(e):Ke(e)?F6(e):e}function ut(e){return lp(e)}function Ys(e,t){return t===void 0?ut(e):ut({...t,...e})}function pp(e){return we(e)&&globalThis.Symbol.asyncIterator in e}function mp(e){return we(e)&&globalThis.Symbol.iterator in e}function bb(e){return we(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function dp(e){return e instanceof globalThis.Promise}function Ar(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function y2(e){return e instanceof globalThis.Map}function x2(e){return e instanceof globalThis.Set}function Pn(e){return globalThis.ArrayBuffer.isView(e)}function Ws(e){return e instanceof globalThis.Uint8Array}function pe(e,t){return t in e}function we(e){return e!==null&&typeof e=="object"}function de(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function ft(e){return e===void 0}function di(e){return e===null}function Eo(e){return typeof e=="boolean"}function lt(e){return typeof e=="number"}function hp(e){return globalThis.Number.isInteger(e)}function Yn(e){return typeof e=="bigint"}function Be(e){return typeof e=="string"}function ea(e){return typeof e=="function"}function hi(e){return typeof e=="symbol"}function cn(e){return Yn(e)||Eo(e)||di(e)||lt(e)||Be(e)||hi(e)||ft(e)}var zt;(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=we(a);return e.AllowArrayObject?s:s&&!de(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?lt(a):Number.isFinite(a)}e.IsNumberLike=o;function i(a){let s=ft(a);return e.AllowNullVoid?s||a===null:s}e.IsVoidLike=i})(zt||(zt={}));function $6(e){return globalThis.Object.freeze(e).map(t=>Bu(t))}function D6(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Bu(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Bu(e[r]);return globalThis.Object.freeze(t)}function Bu(e){return Nt(e)?$6(e):Ka(e)?e:mi(e)?e:Uu(e)?e:Ke(e)?D6(e):e}function j(e,t){let r=t!==void 0?{...t,...e}:e;switch(zt.InstanceMode){case"freeze":return Bu(r);case"clone":return ut(r);default:return r}}var be=class extends Error{constructor(t){super(t)}};var gt=Symbol.for("TypeBox.Transform"),Wn=Symbol.for("TypeBox.Readonly"),hr=Symbol.for("TypeBox.Optional"),Mn=Symbol.for("TypeBox.Hint"),U=Symbol.for("TypeBox.Kind");function Xs(e){return Ke(e)&&e[Wn]==="Readonly"}function qr(e){return Ke(e)&&e[hr]==="Optional"}function yb(e){return Ce(e,"Any")}function xb(e){return Ce(e,"Argument")}function Xn(e){return Ce(e,"Array")}function qa(e){return Ce(e,"AsyncIterator")}function Ha(e){return Ce(e,"BigInt")}function gi(e){return Ce(e,"Boolean")}function Zn(e){return Ce(e,"Computed")}function Qn(e){return Ce(e,"Constructor")}function L6(e){return Ce(e,"Date")}function Jn(e){return Ce(e,"Function")}function eo(e){return Ce(e,"Integer")}function wt(e){return Ce(e,"Intersect")}function Ya(e){return Ce(e,"Iterator")}function Ce(e,t){return Ke(e)&&U in e&&e[U]===t}function gp(e){return pi(e)||sn(e)||tt(e)}function un(e){return Ce(e,"Literal")}function fn(e){return Ce(e,"MappedKey")}function pt(e){return Ce(e,"MappedResult")}function ta(e){return Ce(e,"Never")}function V6(e){return Ce(e,"Not")}function Gu(e){return Ce(e,"Null")}function to(e){return Ce(e,"Number")}function Et(e){return Ce(e,"Object")}function Wa(e){return Ce(e,"Promise")}function Xa(e){return Ce(e,"Record")}function Mt(e){return Ce(e,"Ref")}function wb(e){return Ce(e,"RegExp")}function bi(e){return Ce(e,"String")}function Ku(e){return Ce(e,"Symbol")}function ln(e){return Ce(e,"TemplateLiteral")}function z6(e){return Ce(e,"This")}function Fe(e){return Ke(e)&> in e}function pn(e){return Ce(e,"Tuple")}function yi(e){return Ce(e,"Undefined")}function Ne(e){return Ce(e,"Union")}function j6(e){return Ce(e,"Uint8Array")}function U6(e){return Ce(e,"Unknown")}function B6(e){return Ce(e,"Unsafe")}function G6(e){return Ce(e,"Void")}function ra(e){return Ke(e)&&U in e&&tt(e[U])}function bt(e){return yb(e)||xb(e)||Xn(e)||gi(e)||Ha(e)||qa(e)||Zn(e)||Qn(e)||L6(e)||Jn(e)||eo(e)||wt(e)||Ya(e)||un(e)||fn(e)||pt(e)||ta(e)||V6(e)||Gu(e)||to(e)||Et(e)||Wa(e)||Xa(e)||Mt(e)||wb(e)||bi(e)||Ku(e)||ln(e)||z6(e)||pn(e)||yi(e)||Ne(e)||j6(e)||U6(e)||B6(e)||G6(e)||ra(e)}var k={};Ga(k,{IsAny:()=>I2,IsArgument:()=>_2,IsArray:()=>P2,IsAsyncIterator:()=>M2,IsBigInt:()=>T2,IsBoolean:()=>O2,IsComputed:()=>C2,IsConstructor:()=>k2,IsDate:()=>N2,IsFunction:()=>R2,IsImport:()=>X6,IsInteger:()=>E2,IsIntersect:()=>A2,IsIterator:()=>F2,IsKind:()=>sS,IsKindOf:()=>Pe,IsLiteral:()=>Hu,IsLiteralBoolean:()=>Z6,IsLiteralNumber:()=>D2,IsLiteralString:()=>$2,IsLiteralValue:()=>L2,IsMappedKey:()=>V2,IsMappedResult:()=>z2,IsNever:()=>j2,IsNot:()=>U2,IsNull:()=>B2,IsNumber:()=>G2,IsObject:()=>K2,IsOptional:()=>W6,IsPromise:()=>q2,IsProperties:()=>bp,IsReadonly:()=>Y6,IsRecord:()=>H2,IsRecursive:()=>Q6,IsRef:()=>Y2,IsRegExp:()=>W2,IsSchema:()=>rr,IsString:()=>X2,IsSymbol:()=>Z2,IsTemplateLiteral:()=>Q2,IsThis:()=>J2,IsTransform:()=>eS,IsTuple:()=>tS,IsUint8Array:()=>nS,IsUndefined:()=>rS,IsUnion:()=>_b,IsUnionLiteral:()=>J6,IsUnknown:()=>oS,IsUnsafe:()=>iS,IsVoid:()=>aS,TypeGuardUnknownTypeError:()=>Sb});var Sb=class extends be{},K6=["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 w2(e){try{return new RegExp(e),!0}catch{return!1}}function vb(e){if(!tt(e))return!1;for(let t=0;t=7&&r<=13||r===27||r===127)return!1}return!0}function S2(e){return Ib(e)||rr(e)}function qu(e){return Rt(e)||ju(e)}function rt(e){return Rt(e)||sn(e)}function Ib(e){return Rt(e)||pi(e)}function qe(e){return Rt(e)||tt(e)}function q6(e){return Rt(e)||tt(e)&&vb(e)&&w2(e)}function H6(e){return Rt(e)||tt(e)&&vb(e)}function v2(e){return Rt(e)||rr(e)}function Y6(e){return Ke(e)&&e[Wn]==="Readonly"}function W6(e){return Ke(e)&&e[hr]==="Optional"}function I2(e){return Pe(e,"Any")&&qe(e.$id)}function _2(e){return Pe(e,"Argument")&&sn(e.index)}function P2(e){return Pe(e,"Array")&&e.type==="array"&&qe(e.$id)&&rr(e.items)&&rt(e.minItems)&&rt(e.maxItems)&&Ib(e.uniqueItems)&&v2(e.contains)&&rt(e.minContains)&&rt(e.maxContains)}function M2(e){return Pe(e,"AsyncIterator")&&e.type==="AsyncIterator"&&qe(e.$id)&&rr(e.items)}function T2(e){return Pe(e,"BigInt")&&e.type==="bigint"&&qe(e.$id)&&qu(e.exclusiveMaximum)&&qu(e.exclusiveMinimum)&&qu(e.maximum)&&qu(e.minimum)&&qu(e.multipleOf)}function O2(e){return Pe(e,"Boolean")&&e.type==="boolean"&&qe(e.$id)}function C2(e){return Pe(e,"Computed")&&tt(e.target)&&Nt(e.parameters)&&e.parameters.every(t=>rr(t))}function k2(e){return Pe(e,"Constructor")&&e.type==="Constructor"&&qe(e.$id)&&Nt(e.parameters)&&e.parameters.every(t=>rr(t))&&rr(e.returns)}function N2(e){return Pe(e,"Date")&&e.type==="Date"&&qe(e.$id)&&rt(e.exclusiveMaximumTimestamp)&&rt(e.exclusiveMinimumTimestamp)&&rt(e.maximumTimestamp)&&rt(e.minimumTimestamp)&&rt(e.multipleOfTimestamp)}function R2(e){return Pe(e,"Function")&&e.type==="Function"&&qe(e.$id)&&Nt(e.parameters)&&e.parameters.every(t=>rr(t))&&rr(e.returns)}function X6(e){return Pe(e,"Import")&&fp(e,"$defs")&&Ke(e.$defs)&&bp(e.$defs)&&fp(e,"$ref")&&tt(e.$ref)&&e.$ref in e.$defs}function E2(e){return Pe(e,"Integer")&&e.type==="integer"&&qe(e.$id)&&rt(e.exclusiveMaximum)&&rt(e.exclusiveMinimum)&&rt(e.maximum)&&rt(e.minimum)&&rt(e.multipleOf)}function bp(e){return Ke(e)&&Object.entries(e).every(([t,r])=>vb(t)&&rr(r))}function A2(e){return Pe(e,"Intersect")&&!(tt(e.type)&&e.type!=="object")&&Nt(e.allOf)&&e.allOf.every(t=>rr(t)&&!eS(t))&&qe(e.type)&&(Ib(e.unevaluatedProperties)||v2(e.unevaluatedProperties))&&qe(e.$id)}function F2(e){return Pe(e,"Iterator")&&e.type==="Iterator"&&qe(e.$id)&&rr(e.items)}function Pe(e,t){return Ke(e)&&U in e&&e[U]===t}function $2(e){return Hu(e)&&tt(e.const)}function D2(e){return Hu(e)&&sn(e.const)}function Z6(e){return Hu(e)&&pi(e.const)}function Hu(e){return Pe(e,"Literal")&&qe(e.$id)&&L2(e.const)}function L2(e){return pi(e)||sn(e)||tt(e)}function V2(e){return Pe(e,"MappedKey")&&Nt(e.keys)&&e.keys.every(t=>sn(t)||tt(t))}function z2(e){return Pe(e,"MappedResult")&&bp(e.properties)}function j2(e){return Pe(e,"Never")&&Ke(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function U2(e){return Pe(e,"Not")&&rr(e.not)}function B2(e){return Pe(e,"Null")&&e.type==="null"&&qe(e.$id)}function G2(e){return Pe(e,"Number")&&e.type==="number"&&qe(e.$id)&&rt(e.exclusiveMaximum)&&rt(e.exclusiveMinimum)&&rt(e.maximum)&&rt(e.minimum)&&rt(e.multipleOf)}function K2(e){return Pe(e,"Object")&&e.type==="object"&&qe(e.$id)&&bp(e.properties)&&S2(e.additionalProperties)&&rt(e.minProperties)&&rt(e.maxProperties)}function q2(e){return Pe(e,"Promise")&&e.type==="Promise"&&qe(e.$id)&&rr(e.item)}function H2(e){return Pe(e,"Record")&&e.type==="object"&&qe(e.$id)&&S2(e.additionalProperties)&&Ke(e.patternProperties)&&(t=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&w2(r[0])&&Ke(t.patternProperties)&&rr(t.patternProperties[r[0]])})(e)}function Q6(e){return Ke(e)&&Mn in e&&e[Mn]==="Recursive"}function Y2(e){return Pe(e,"Ref")&&qe(e.$id)&&tt(e.$ref)}function W2(e){return Pe(e,"RegExp")&&qe(e.$id)&&tt(e.source)&&tt(e.flags)&&rt(e.maxLength)&&rt(e.minLength)}function X2(e){return Pe(e,"String")&&e.type==="string"&&qe(e.$id)&&rt(e.minLength)&&rt(e.maxLength)&&q6(e.pattern)&&H6(e.format)}function Z2(e){return Pe(e,"Symbol")&&e.type==="symbol"&&qe(e.$id)}function Q2(e){return Pe(e,"TemplateLiteral")&&e.type==="string"&&tt(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function J2(e){return Pe(e,"This")&&qe(e.$id)&&tt(e.$ref)}function eS(e){return Ke(e)&> in e}function tS(e){return Pe(e,"Tuple")&&e.type==="array"&&qe(e.$id)&&sn(e.minItems)&&sn(e.maxItems)&&e.minItems===e.maxItems&&(Rt(e.items)&&Rt(e.additionalItems)&&e.minItems===0||Nt(e.items)&&e.items.every(t=>rr(t)))}function rS(e){return Pe(e,"Undefined")&&e.type==="undefined"&&qe(e.$id)}function J6(e){return _b(e)&&e.anyOf.every(t=>$2(t)||D2(t))}function _b(e){return Pe(e,"Union")&&qe(e.$id)&&Ke(e)&&Nt(e.anyOf)&&e.anyOf.every(t=>rr(t))}function nS(e){return Pe(e,"Uint8Array")&&e.type==="Uint8Array"&&qe(e.$id)&&rt(e.minByteLength)&&rt(e.maxByteLength)}function oS(e){return Pe(e,"Unknown")&&qe(e.$id)}function iS(e){return Pe(e,"Unsafe")}function aS(e){return Pe(e,"Void")&&e.type==="void"&&qe(e.$id)}function sS(e){return Ke(e)&&U in e&&tt(e[U])&&!K6.includes(e[U])}function rr(e){return Ke(e)&&(I2(e)||_2(e)||P2(e)||O2(e)||T2(e)||M2(e)||C2(e)||k2(e)||N2(e)||R2(e)||E2(e)||A2(e)||F2(e)||Hu(e)||V2(e)||z2(e)||j2(e)||U2(e)||B2(e)||G2(e)||K2(e)||q2(e)||H2(e)||Y2(e)||W2(e)||X2(e)||Z2(e)||Q2(e)||J2(e)||tS(e)||rS(e)||_b(e)||nS(e)||oS(e)||iS(e)||aS(e)||sS(e))}var Pb="(true|false)",Yu="(0|[1-9][0-9]*)",Mb="(.*)",e5="(?!.*)",oG=`^${Pb}$`,na=`^${Yu}$`,oa=`^${Mb}$`,cS=`^${e5}$`;var ia={};Ga(ia,{Clear:()=>r5,Delete:()=>n5,Entries:()=>t5,Get:()=>a5,Has:()=>o5,Set:()=>i5});var Zs=new Map;function t5(){return new Map(Zs)}function r5(){return Zs.clear()}function n5(e){return Zs.delete(e)}function o5(e){return Zs.has(e)}function i5(e,t){Zs.set(e,t)}function a5(e){return Zs.get(e)}var ro={};Ga(ro,{Clear:()=>c5,Delete:()=>u5,Entries:()=>s5,Get:()=>p5,Has:()=>f5,Set:()=>l5});var Qs=new Map;function s5(){return new Map(Qs)}function c5(){return Qs.clear()}function u5(e){return Qs.delete(e)}function f5(e){return Qs.has(e)}function l5(e,t){Qs.set(e,t)}function p5(e){return Qs.get(e)}function uS(e,t){return e.includes(t)}function fS(e){return[...new Set(e)]}function m5(e,t){return e.filter(r=>t.includes(r))}function d5(e,t){return e.reduce((r,n)=>m5(r,n),t)}function lS(e){return e.length===1?e[0]:e.length>1?d5(e.slice(1),e[0]):[]}function pS(e){let t=[];for(let r of e)t.push(...r);return t}function aa(e){return j({[U]:"Any"},e)}function Js(e,t){return j({[U]:"Array",type:"array",items:e},t)}function mS(e){return j({[U]:"Argument",index:e})}function ec(e,t){return j({[U]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function at(e,t,r){return j({[U]:"Computed",target:e,parameters:t},r)}function h5(e,t){let{[t]:r,...n}=e;return n}function St(e,t){return t.reduce((r,n)=>h5(r,n),e)}function _e(e){return j({[U]:"Never",not:{}},e)}function Re(e){return j({[U]:"MappedResult",properties:e})}function tc(e,t,r){return j({[U]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function Ao(e,t,r){return j({[U]:"Function",type:"Function",parameters:e,returns:t},r)}function Wu(e,t){return j({[U]:"Union",anyOf:e},t)}function g5(e){return e.some(t=>qr(t))}function dS(e){return e.map(t=>qr(t)?b5(t):t)}function b5(e){return St(e,[hr])}function y5(e,t){return g5(e)?Ir(Wu(dS(e),t)):Wu(dS(e),t)}function Fo(e,t){return e.length===1?j(e[0],t):e.length===0?_e(t):y5(e,t)}function $e(e,t){return e.length===0?_e(t):e.length===1?j(e[0],t):Wu(e,t)}var yp=class extends be{};function x5(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Tb(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function wi(e,t){return Tb(e,t,"(")}function Xu(e,t){return Tb(e,t,")")}function hS(e,t){return Tb(e,t,"|")}function w5(e){if(!(wi(e,0)&&Xu(e,e.length-1)))return!1;let t=0;for(let r=0;r0&&n.push(rc(a)),r=i+1}let o=e.slice(r);return o.length>0&&n.push(rc(o)),n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"or",expr:n}}function P5(e){function t(o,i){if(!wi(o,i))throw new yp("TemplateLiteralParser: Index must point to open parens");let a=0;for(let s=i;s0&&n.push(rc(s)),o=a-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function rc(e){return w5(e)?rc(S5(e)):v5(e)?_5(e):I5(e)?P5(e):{type:"const",const:x5(e)}}function nc(e){return rc(e.slice(1,e.length-1))}var Ob=class extends be{};function M5(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 T5(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 O5(e){return e.type==="const"&&e.const===".*"}function Za(e){return M5(e)||O5(e)?!1:T5(e)?!0:e.type==="and"?e.expr.every(t=>Za(t)):e.type==="or"?e.expr.every(t=>Za(t)):e.type==="const"?!0:(()=>{throw new Ob("Unknown expression type")})()}function xp(e){let t=nc(e.pattern);return Za(t)}var Cb=class extends be{};function*gS(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of gS(e.slice(1)))yield`${t}${r}`}function*C5(e){return yield*gS(e.expr.map(t=>[...Zu(t)]))}function*k5(e){for(let t of e.expr)yield*Zu(t)}function*N5(e){return yield e.const}function*Zu(e){return e.type==="and"?yield*C5(e):e.type==="or"?yield*k5(e):e.type==="const"?yield*N5(e):(()=>{throw new Cb("Unknown expression")})()}function oc(e){let t=nc(e.pattern);return Za(t)?[...Zu(t)]:[]}function ke(e,t){return j({[U]:"Literal",const:e,type:typeof e},t)}function wp(e){return j({[U]:"Boolean",type:"boolean"},e)}function ic(e){return j({[U]:"BigInt",type:"bigint"},e)}function Tn(e){return j({[U]:"Number",type:"number"},e)}function Fr(e){return j({[U]:"String",type:"string"},e)}function*R5(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield wp():t==="number"?yield Tn():t==="bigint"?yield ic():t==="string"?yield Fr():yield(()=>{let r=t.split("|").map(n=>ke(n.trim()));return r.length===0?_e():r.length===1?r[0]:Fo(r)})()}function*E5(e){if(e[1]!=="{"){let t=ke("$"),r=kb(e.slice(1));return yield*[t,...r]}for(let t=2;tyS(r,t)).join("|")})`:to(e)?`${t}${Yu}`:eo(e)?`${t}${Yu}`:Ha(e)?`${t}${Yu}`:bi(e)?`${t}${Mb}`:un(e)?`${t}${A5(e.const.toString())}`:gi(e)?`${t}${Pb}`:(()=>{throw new Nb(`Unexpected Kind '${e[U]}'`)})()}function Rb(e){return`^${e.map(t=>yS(t,"")).join("")}$`}function Qa(e){let r=oc(e).map(n=>ke(n));return Fo(r)}function Sp(e,t){let r=tt(e)?Rb(bS(e)):Rb(e);return j({[U]:"TemplateLiteral",type:"string",pattern:r},t)}function F5(e){return oc(e).map(r=>r.toString())}function $5(e){let t=[];for(let r of e)t.push(...Hr(r));return t}function D5(e){return[e.toString()]}function Hr(e){return[...new Set(ln(e)?F5(e):Ne(e)?$5(e.anyOf):un(e)?D5(e.const):to(e)?["[number]"]:eo(e)?["[number]"]:[])]}function L5(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=sa(e,Hr(t[o]),r);return n}function V5(e,t,r){return L5(e,t.properties,r)}function xS(e,t,r){let n=V5(e,t,r);return Re(n)}function SS(e,t){return e.map(r=>vS(r,t))}function z5(e){return e.filter(t=>!ta(t))}function j5(e,t){return vp(z5(SS(e,t)))}function U5(e){return e.some(t=>ta(t))?[]:e}function B5(e,t){return Fo(U5(SS(e,t)))}function G5(e,t){return t in e?e[t]:t==="[number]"?Fo(e):_e()}function K5(e,t){return t==="[number]"?e:_e()}function q5(e,t){return t in e?e[t]:_e()}function vS(e,t){return wt(e)?j5(e.allOf,t):Ne(e)?B5(e.anyOf,t):pn(e)?G5(e.items??[],t):Xn(e)?K5(e.items,t):Et(e)?q5(e.properties,t):_e()}function Qu(e,t){return t.map(r=>vS(e,r))}function wS(e,t){return Fo(Qu(e,t))}function sa(e,t,r){if(Mt(e)||Mt(t)){let n="Index types using Ref parameters require both Type and Key to be of TSchema";if(!bt(e)||!bt(t))throw new be(n);return at("Index",[e,t])}return pt(t)?xS(e,t,r):fn(t)?IS(e,t,r):j(bt(t)?wS(e,Hr(t)):wS(e,t),r)}function H5(e,t,r){return{[t]:sa(e,[t],ut(r))}}function Y5(e,t,r){return t.reduce((n,o)=>({...n,...H5(e,o,r)}),{})}function W5(e,t,r){return Y5(e,t.keys,r)}function IS(e,t,r){let n=W5(e,t,r);return Re(n)}function ac(e,t){return j({[U]:"Iterator",type:"Iterator",items:e},t)}function X5(e){return globalThis.Object.keys(e).filter(t=>!qr(e[t]))}function Z5(e,t){let r=X5(e),n=r.length>0?{[U]:"Object",type:"object",required:r,properties:e}:{[U]:"Object",type:"object",properties:e};return j(n,t)}var De=Z5;function Ip(e,t){return j({[U]:"Promise",type:"Promise",item:e},t)}function Q5(e){return j(St(e,[Wn]))}function J5(e){return j({...e,[Wn]:"Readonly"})}function eN(e,t){return t===!1?Q5(e):J5(e)}function Yr(e,t){let r=t??!0;return pt(e)?_S(e,r):eN(e,r)}function tN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Yr(e[n],t);return r}function rN(e,t){return tN(e.properties,t)}function _S(e,t){let r=rN(e,t);return Re(r)}function On(e,t){return j(e.length>0?{[U]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[U]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function PS(e,t){return e in t?Cn(e,t[e]):Re(t)}function nN(e){return{[e]:ke(e)}}function oN(e){let t={};for(let r of e)t[r]=ke(r);return t}function iN(e,t){return uS(t,e)?nN(e):oN(t)}function aN(e,t){let r=iN(e,t);return PS(e,r)}function Ju(e,t){return t.map(r=>Cn(e,r))}function sN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=Cn(e,t[n]);return r}function Cn(e,t){let r={...t};return qr(t)?Ir(Cn(e,St(t,[hr]))):Xs(t)?Yr(Cn(e,St(t,[Wn]))):pt(t)?PS(e,t.properties):fn(t)?aN(e,t.keys):Qn(t)?tc(Ju(e,t.parameters),Cn(e,t.returns),r):Jn(t)?Ao(Ju(e,t.parameters),Cn(e,t.returns),r):qa(t)?ec(Cn(e,t.items),r):Ya(t)?ac(Cn(e,t.items),r):wt(t)?_r(Ju(e,t.allOf),r):Ne(t)?$e(Ju(e,t.anyOf),r):pn(t)?On(Ju(e,t.items??[]),r):Et(t)?De(sN(e,t.properties),r):Xn(t)?Js(Cn(e,t.items),r):Wa(t)?Ip(Cn(e,t.item),r):t}function cN(e,t){let r={};for(let n of e)r[n]=Cn(n,t);return r}function MS(e,t,r){let n=bt(e)?Hr(e):e,o=t({[U]:"MappedKey",keys:n}),i=cN(n,o);return De(i,r)}function uN(e){return j(St(e,[hr]))}function fN(e){return j({...e,[hr]:"Optional"})}function lN(e,t){return t===!1?uN(e):fN(e)}function Ir(e,t){let r=t??!0;return pt(e)?TS(e,r):lN(e,r)}function pN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ir(e[n],t);return r}function mN(e,t){return pN(e.properties,t)}function TS(e,t){let r=mN(e,t);return Re(r)}function ef(e,t={}){let r=e.every(o=>Et(o)),n=bt(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return j(t.unevaluatedProperties===!1||bt(t.unevaluatedProperties)||r?{...n,[U]:"Intersect",type:"object",allOf:e}:{...n,[U]:"Intersect",allOf:e},t)}function dN(e){return e.every(t=>qr(t))}function hN(e){return St(e,[hr])}function OS(e){return e.map(t=>qr(t)?hN(t):t)}function gN(e,t){return dN(e)?Ir(ef(OS(e),t)):ef(OS(e),t)}function vp(e,t={}){if(e.length===1)return j(e[0],t);if(e.length===0)return _e(t);if(e.some(r=>Fe(r)))throw new Error("Cannot intersect transform types");return gN(e,t)}function _r(e,t){if(e.length===1)return j(e[0],t);if(e.length===0)return _e(t);if(e.some(r=>Fe(r)))throw new Error("Cannot intersect transform types");return ef(e,t)}function $o(...e){let[t,r]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new be("Ref: $ref must be a string");return j({[U]:"Ref",$ref:t},r)}function bN(e,t){return at("Awaited",[at(e,t)])}function yN(e){return at("Awaited",[$o(e)])}function xN(e){return _r(CS(e))}function wN(e){return $e(CS(e))}function SN(e){return sc(e)}function CS(e){return e.map(t=>sc(t))}function sc(e,t){return j(Zn(e)?bN(e.target,e.parameters):wt(e)?xN(e.allOf):Ne(e)?wN(e.anyOf):Wa(e)?SN(e.item):Mt(e)?yN(e.$ref):e,t)}function kS(e){let t=[];for(let r of e)t.push(Wr(r));return t}function vN(e){let t=kS(e);return pS(t)}function IN(e){let t=kS(e);return lS(t)}function _N(e){return e.map((t,r)=>r.toString())}function PN(e){return["[number]"]}function MN(e){return globalThis.Object.getOwnPropertyNames(e)}function TN(e){return Eb?globalThis.Object.getOwnPropertyNames(e).map(r=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r):[]}function Wr(e){return wt(e)?vN(e.allOf):Ne(e)?IN(e.anyOf):pn(e)?_N(e.items??[]):Xn(e)?PN(e.items):Et(e)?MN(e.properties):Xa(e)?TN(e.patternProperties):[]}var Eb=!1;function cc(e){Eb=!0;let t=Wr(e);return Eb=!1,`^(${t.map(n=>`(${n})`).join("|")})$`}function ON(e,t){return at("KeyOf",[at(e,t)])}function CN(e){return at("KeyOf",[$o(e)])}function kN(e,t){let r=Wr(e),n=NN(r),o=Fo(n);return j(o,t)}function NN(e){return e.map(t=>t==="[number]"?Tn():ke(t))}function uc(e,t){return Zn(e)?ON(e.target,e.parameters):Mt(e)?CN(e.$ref):pt(e)?NS(e,t):kN(e,t)}function RN(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=uc(e[n],ut(t));return r}function EN(e,t){return RN(e.properties,t)}function NS(e,t){let r=EN(e,t);return Re(r)}function _p(e){let t=Wr(e),r=Qu(e,t);return t.map((n,o)=>[t[o],r[o]])}function AN(e){let t=[];for(let r of e)t.push(...Wr(r));return fS(t)}function FN(e){return e.filter(t=>!ta(t))}function $N(e,t){let r=[];for(let n of e)r.push(...Qu(n,[t]));return FN(r)}function DN(e,t){let r={};for(let n of t)r[n]=vp($N(e,n));return r}function RS(e,t){let r=AN(e),n=DN(e,r);return De(n,t)}function Pp(e){return j({[U]:"Date",type:"Date"},e)}function Mp(e){return j({[U]:"Null",type:"null"},e)}function Tp(e){return j({[U]:"Symbol",type:"symbol"},e)}function Op(e){return j({[U]:"Undefined",type:"undefined"},e)}function Cp(e){return j({[U]:"Uint8Array",type:"Uint8Array"},e)}function no(e){return j({[U]:"Unknown"},e)}function LN(e){return e.map(t=>Ab(t,!1))}function VN(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Yr(Ab(e[r],!1));return t}function kp(e,t){return t===!0?e:Yr(e)}function Ab(e,t){return pb(e)?kp(aa(),t):db(e)?kp(aa(),t):Nt(e)?Yr(On(LN(e))):mi(e)?Cp():Ka(e)?Pp():Ke(e)?kp(De(VN(e)),t):mb(e)?kp(Ao([],no()),t):Rt(e)?Op():hb(e)?Mp():gb(e)?Tp():ju(e)?ic():sn(e)?ke(e):pi(e)?ke(e):tt(e)?ke(e):De({})}function ES(e,t){return j(Ab(e,!0),t)}function AS(e,t){return Qn(e)?On(e.parameters,t):_e(t)}function FS(e,t){if(Rt(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=>ke(i));return $e(o,{...t,[Mn]:"Enum"})}var $b=class extends be{},B;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(B||(B={}));function kn(e){return e===B.False?e:B.True}function fc(e){throw new $b(e)}function jt(e){return k.IsNever(e)||k.IsIntersect(e)||k.IsUnion(e)||k.IsUnknown(e)||k.IsAny(e)}function Ut(e,t){return k.IsNever(t)?US(e,t):k.IsIntersect(t)?Np(e,t):k.IsUnion(t)?zb(e,t):k.IsUnknown(t)?qS(e,t):k.IsAny(t)?Vb(e,t):fc("StructuralRight")}function Vb(e,t){return B.True}function zN(e,t){return k.IsIntersect(t)?Np(e,t):k.IsUnion(t)&&t.anyOf.some(r=>k.IsAny(r)||k.IsUnknown(r))?B.True:k.IsUnion(t)?B.Union:k.IsUnknown(t)||k.IsAny(t)?B.True:B.Union}function jN(e,t){return k.IsUnknown(e)?B.False:k.IsAny(e)?B.Union:k.IsNever(e)?B.True:B.False}function UN(e,t){return k.IsObject(t)&&Rp(t)?B.True:jt(t)?Ut(e,t):k.IsArray(t)?kn(He(e.items,t.items)):B.False}function BN(e,t){return jt(t)?Ut(e,t):k.IsAsyncIterator(t)?kn(He(e.items,t.items)):B.False}function GN(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsBigInt(t)?B.True:B.False}function zS(e,t){return k.IsLiteralBoolean(e)||k.IsBoolean(e)?B.True:B.False}function KN(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsBoolean(t)?B.True:B.False}function qN(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsConstructor(t)?e.parameters.length>t.parameters.length?B.False:e.parameters.every((r,n)=>kn(He(t.parameters[n],r))===B.True)?kn(He(e.returns,t.returns)):B.False:B.False}function HN(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsDate(t)?B.True:B.False}function YN(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsFunction(t)?e.parameters.length>t.parameters.length?B.False:e.parameters.every((r,n)=>kn(He(t.parameters[n],r))===B.True)?kn(He(e.returns,t.returns)):B.False:B.False}function jS(e,t){return k.IsLiteral(e)&&vr.IsNumber(e.const)||k.IsNumber(e)||k.IsInteger(e)?B.True:B.False}function WN(e,t){return k.IsInteger(t)||k.IsNumber(t)?B.True:jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):B.False}function Np(e,t){return t.allOf.every(r=>He(e,r)===B.True)?B.True:B.False}function XN(e,t){return e.allOf.some(r=>He(r,t)===B.True)?B.True:B.False}function ZN(e,t){return jt(t)?Ut(e,t):k.IsIterator(t)?kn(He(e.items,t.items)):B.False}function QN(e,t){return k.IsLiteral(t)&&t.const===e.const?B.True:jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsString(t)?KS(e,t):k.IsNumber(t)?BS(e,t):k.IsInteger(t)?jS(e,t):k.IsBoolean(t)?zS(e,t):B.False}function US(e,t){return B.False}function JN(e,t){return B.True}function $S(e){let[t,r]=[e,0];for(;k.IsNot(t);)t=t.not,r+=1;return r%2===0?t:no()}function eR(e,t){return k.IsNot(e)?He($S(e),t):k.IsNot(t)?He(e,$S(t)):fc("Invalid fallthrough for Not")}function tR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsNull(t)?B.True:B.False}function BS(e,t){return k.IsLiteralNumber(e)||k.IsNumber(e)||k.IsInteger(e)?B.True:B.False}function rR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsInteger(t)||k.IsNumber(t)?B.True:B.False}function Xr(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function DS(e){return Rp(e)}function LS(e){return Xr(e,0)||Xr(e,1)&&"description"in e.properties&&k.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(k.IsString(e.properties.description.anyOf[0])&&k.IsUndefined(e.properties.description.anyOf[1])||k.IsString(e.properties.description.anyOf[1])&&k.IsUndefined(e.properties.description.anyOf[0]))}function Fb(e){return Xr(e,0)}function VS(e){return Xr(e,0)}function nR(e){return Xr(e,0)}function oR(e){return Xr(e,0)}function iR(e){return Rp(e)}function aR(e){let t=Tn();return Xr(e,0)||Xr(e,1)&&"length"in e.properties&&kn(He(e.properties.length,t))===B.True}function sR(e){return Xr(e,0)}function Rp(e){let t=Tn();return Xr(e,0)||Xr(e,1)&&"length"in e.properties&&kn(He(e.properties.length,t))===B.True}function cR(e){let t=Ao([aa()],aa());return Xr(e,0)||Xr(e,1)&&"then"in e.properties&&kn(He(e.properties.then,t))===B.True}function GS(e,t){return He(e,t)===B.False||k.IsOptional(e)&&!k.IsOptional(t)?B.False:B.True}function Pr(e,t){return k.IsUnknown(e)?B.False:k.IsAny(e)?B.Union:k.IsNever(e)||k.IsLiteralString(e)&&DS(t)||k.IsLiteralNumber(e)&&Fb(t)||k.IsLiteralBoolean(e)&&VS(t)||k.IsSymbol(e)&&LS(t)||k.IsBigInt(e)&&nR(t)||k.IsString(e)&&DS(t)||k.IsSymbol(e)&&LS(t)||k.IsNumber(e)&&Fb(t)||k.IsInteger(e)&&Fb(t)||k.IsBoolean(e)&&VS(t)||k.IsUint8Array(e)&&iR(t)||k.IsDate(e)&&oR(t)||k.IsConstructor(e)&&sR(t)||k.IsFunction(e)&&aR(t)?B.True:k.IsRecord(e)&&k.IsString(Db(e))?t[Mn]==="Record"?B.True:B.False:k.IsRecord(e)&&k.IsNumber(Db(e))?Xr(t,0)?B.True:B.False:B.False}function uR(e,t){return jt(t)?Ut(e,t):k.IsRecord(t)?Nn(e,t):k.IsObject(t)?(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!k.IsOptional(t.properties[r]))return B.False;if(k.IsOptional(t.properties[r]))return B.True;if(GS(e.properties[r],t.properties[r])===B.False)return B.False}return B.True})():B.False}function fR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)&&cR(t)?B.True:k.IsPromise(t)?kn(He(e.item,t.item)):B.False}function Db(e){return na in e.patternProperties?Tn():oa in e.patternProperties?Fr():fc("Unknown record key pattern")}function Lb(e){return na in e.patternProperties?e.patternProperties[na]:oa in e.patternProperties?e.patternProperties[oa]:fc("Unable to get record value schema")}function Nn(e,t){let[r,n]=[Db(t),Lb(t)];return k.IsLiteralString(e)&&k.IsNumber(r)&&kn(He(e,n))===B.True?B.True:k.IsUint8Array(e)&&k.IsNumber(r)||k.IsString(e)&&k.IsNumber(r)||k.IsArray(e)&&k.IsNumber(r)?He(e,n):k.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(GS(n,e.properties[o])===B.False)return B.False;return B.True})():B.False}function lR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?He(Lb(e),Lb(t)):B.False}function pR(e,t){let r=k.IsRegExp(e)?Fr():e,n=k.IsRegExp(t)?Fr():t;return He(r,n)}function KS(e,t){return k.IsLiteral(e)&&vr.IsString(e.const)||k.IsString(e)?B.True:B.False}function mR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsString(t)?B.True:B.False}function dR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsSymbol(t)?B.True:B.False}function hR(e,t){return k.IsTemplateLiteral(e)?He(Qa(e),t):k.IsTemplateLiteral(t)?He(e,Qa(t)):fc("Invalid fallthrough for TemplateLiteral")}function gR(e,t){return k.IsArray(t)&&e.items!==void 0&&e.items.every(r=>He(r,t.items)===B.True)}function bR(e,t){return k.IsNever(e)?B.True:k.IsUnknown(e)?B.False:k.IsAny(e)?B.Union:B.False}function yR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)&&Rp(t)||k.IsArray(t)&&gR(e,t)?B.True:k.IsTuple(t)?vr.IsUndefined(e.items)&&!vr.IsUndefined(t.items)||!vr.IsUndefined(e.items)&&vr.IsUndefined(t.items)?B.False:vr.IsUndefined(e.items)&&!vr.IsUndefined(t.items)||e.items.every((r,n)=>He(r,t.items[n])===B.True)?B.True:B.False:B.False}function xR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsUint8Array(t)?B.True:B.False}function wR(e,t){return jt(t)?Ut(e,t):k.IsObject(t)?Pr(e,t):k.IsRecord(t)?Nn(e,t):k.IsVoid(t)?IR(e,t):k.IsUndefined(t)?B.True:B.False}function zb(e,t){return t.anyOf.some(r=>He(e,r)===B.True)?B.True:B.False}function SR(e,t){return e.anyOf.every(r=>He(r,t)===B.True)?B.True:B.False}function qS(e,t){return B.True}function vR(e,t){return k.IsNever(t)?US(e,t):k.IsIntersect(t)?Np(e,t):k.IsUnion(t)?zb(e,t):k.IsAny(t)?Vb(e,t):k.IsString(t)?KS(e,t):k.IsNumber(t)?BS(e,t):k.IsInteger(t)?jS(e,t):k.IsBoolean(t)?zS(e,t):k.IsArray(t)?jN(e,t):k.IsTuple(t)?bR(e,t):k.IsObject(t)?Pr(e,t):k.IsUnknown(t)?B.True:B.False}function IR(e,t){return k.IsUndefined(e)||k.IsUndefined(e)?B.True:B.False}function _R(e,t){return k.IsIntersect(t)?Np(e,t):k.IsUnion(t)?zb(e,t):k.IsUnknown(t)?qS(e,t):k.IsAny(t)?Vb(e,t):k.IsObject(t)?Pr(e,t):k.IsVoid(t)?B.True:B.False}function He(e,t){return k.IsTemplateLiteral(e)||k.IsTemplateLiteral(t)?hR(e,t):k.IsRegExp(e)||k.IsRegExp(t)?pR(e,t):k.IsNot(e)||k.IsNot(t)?eR(e,t):k.IsAny(e)?zN(e,t):k.IsArray(e)?UN(e,t):k.IsBigInt(e)?GN(e,t):k.IsBoolean(e)?KN(e,t):k.IsAsyncIterator(e)?BN(e,t):k.IsConstructor(e)?qN(e,t):k.IsDate(e)?HN(e,t):k.IsFunction(e)?YN(e,t):k.IsInteger(e)?WN(e,t):k.IsIntersect(e)?XN(e,t):k.IsIterator(e)?ZN(e,t):k.IsLiteral(e)?QN(e,t):k.IsNever(e)?JN(e,t):k.IsNull(e)?tR(e,t):k.IsNumber(e)?rR(e,t):k.IsObject(e)?uR(e,t):k.IsRecord(e)?lR(e,t):k.IsString(e)?mR(e,t):k.IsSymbol(e)?dR(e,t):k.IsTuple(e)?yR(e,t):k.IsPromise(e)?fR(e,t):k.IsUint8Array(e)?xR(e,t):k.IsUndefined(e)?wR(e,t):k.IsUnion(e)?SR(e,t):k.IsUnknown(e)?vR(e,t):k.IsVoid(e)?_R(e,t):fc(`Unknown left type operand '${e[U]}'`)}function ca(e,t){return He(e,t)}function PR(e,t,r,n,o){let i={};for(let a of globalThis.Object.getOwnPropertyNames(e))i[a]=lc(e[a],t,r,n,ut(o));return i}function MR(e,t,r,n,o){return PR(e.properties,t,r,n,o)}function HS(e,t,r,n,o){let i=MR(e,t,r,n,o);return Re(i)}function TR(e,t,r,n){let o=ca(e,t);return o===B.Union?$e([r,n]):o===B.True?r:n}function lc(e,t,r,n,o){return pt(e)?HS(e,t,r,n,o):fn(e)?j(YS(e,t,r,n,o)):j(TR(e,t,r,n),o)}function OR(e,t,r,n,o){return{[e]:lc(ke(e),t,r,n,ut(o))}}function CR(e,t,r,n,o){return e.reduce((i,a)=>({...i,...OR(a,t,r,n,o)}),{})}function kR(e,t,r,n,o){return CR(e.keys,t,r,n,o)}function YS(e,t,r,n,o){let i=kR(e,t,r,n,o);return Re(i)}function NR(e){return e.allOf.every(t=>Ja(t))}function RR(e){return e.anyOf.some(t=>Ja(t))}function ER(e){return!Ja(e.not)}function Ja(e){return e[U]==="Intersect"?NR(e):e[U]==="Union"?RR(e):e[U]==="Not"?ER(e):e[U]==="Undefined"}function WS(e,t){return pc(Qa(e),t)}function AR(e,t){let r=e.filter(n=>ca(n,t)===B.False);return r.length===1?r[0]:$e(r)}function pc(e,t,r={}){return ln(e)?j(WS(e,t),r):pt(e)?j(XS(e,t),r):j(Ne(e)?AR(e.anyOf,t):ca(e,t)!==B.False?_e():e,r)}function FR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=pc(e[n],t);return r}function $R(e,t){return FR(e.properties,t)}function XS(e,t){let r=$R(e,t);return Re(r)}function ZS(e,t){return mc(Qa(e),t)}function DR(e,t){let r=e.filter(n=>ca(n,t)!==B.False);return r.length===1?r[0]:$e(r)}function mc(e,t,r){return ln(e)?j(ZS(e,t),r):pt(e)?j(QS(e,t),r):j(Ne(e)?DR(e.anyOf,t):ca(e,t)!==B.False?e:_e(),r)}function LR(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=mc(e[n],t);return r}function VR(e,t){return LR(e.properties,t)}function QS(e,t){let r=VR(e,t);return Re(r)}function JS(e,t){return Qn(e)?j(e.returns,t):_e(t)}function Ep(e){return Yr(Ir(e))}function es(e,t,r){return j({[U]:"Record",type:"object",patternProperties:{[e]:t}},r)}function jb(e,t,r){let n={};for(let o of e)n[o]=t;return De(n,{...r,[Mn]:"Record"})}function zR(e,t,r){return xp(e)?jb(Hr(e),t,r):es(e.pattern,t,r)}function jR(e,t,r){return jb(Hr($e(e)),t,r)}function UR(e,t,r){return jb([e.toString()],t,r)}function BR(e,t,r){return es(e.source,t,r)}function GR(e,t,r){let n=Rt(e.pattern)?oa:e.pattern;return es(n,t,r)}function KR(e,t,r){return es(oa,t,r)}function qR(e,t,r){return es(cS,t,r)}function HR(e,t,r){return De({true:t,false:t},r)}function YR(e,t,r){return es(na,t,r)}function WR(e,t,r){return es(na,t,r)}function Ap(e,t,r={}){return Ne(e)?jR(e.anyOf,t,r):ln(e)?zR(e,t,r):un(e)?UR(e.const,t,r):gi(e)?HR(e,t,r):eo(e)?YR(e,t,r):to(e)?WR(e,t,r):wb(e)?BR(e,t,r):bi(e)?GR(e,t,r):yb(e)?KR(e,t,r):ta(e)?qR(e,t,r):_e(r)}function Fp(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function ev(e){let t=Fp(e);return t===oa?Fr():t===na?Tn():Fr({pattern:t})}function $p(e){return e.patternProperties[Fp(e)]}function XR(e,t){return t.parameters=tf(e,t.parameters),t.returns=oo(e,t.returns),t}function ZR(e,t){return t.parameters=tf(e,t.parameters),t.returns=oo(e,t.returns),t}function QR(e,t){return t.allOf=tf(e,t.allOf),t}function JR(e,t){return t.anyOf=tf(e,t.anyOf),t}function eE(e,t){return Rt(t.items)||(t.items=tf(e,t.items)),t}function tE(e,t){return t.items=oo(e,t.items),t}function rE(e,t){return t.items=oo(e,t.items),t}function nE(e,t){return t.items=oo(e,t.items),t}function oE(e,t){return t.item=oo(e,t.item),t}function iE(e,t){let r=uE(e,t.properties);return{...t,...De(r)}}function aE(e,t){let r=oo(e,ev(t)),n=oo(e,$p(t)),o=Ap(r,n);return{...t,...o}}function sE(e,t){return t.index in e?e[t.index]:no()}function cE(e,t){let r=Xs(t),n=qr(t),o=oo(e,t);return r&&n?Ep(o):r&&!n?Yr(o):!r&&n?Ir(o):o}function uE(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:cE(e,t[n])}),{})}function tf(e,t){return t.map(r=>oo(e,r))}function oo(e,t){return Qn(t)?XR(e,t):Jn(t)?ZR(e,t):wt(t)?QR(e,t):Ne(t)?JR(e,t):pn(t)?eE(e,t):Xn(t)?tE(e,t):qa(t)?rE(e,t):Ya(t)?nE(e,t):Wa(t)?oE(e,t):Et(t)?iE(e,t):Xa(t)?aE(e,t):xb(t)?sE(e,t):t}function tv(e,t){return oo(t,Ys(e))}function rv(e){return j({[U]:"Integer",type:"integer"},e)}function fE(e,t,r){return{[e]:io(ke(e),t,ut(r))}}function lE(e,t,r){return e.reduce((o,i)=>({...o,...fE(i,t,r)}),{})}function pE(e,t,r){return lE(e.keys,t,r)}function nv(e,t,r){let n=pE(e,t,r);return Re(n)}function mE(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function dE(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function hE(e){return e.toUpperCase()}function gE(e){return e.toLowerCase()}function bE(e,t,r){let n=nc(e.pattern);if(!Za(n))return{...e,pattern:ov(e.pattern,t)};let a=[...Zu(n)].map(f=>ke(f)),s=iv(a,t),c=$e(s);return Sp([c],r)}function ov(e,t){return typeof e=="string"?t==="Uncapitalize"?mE(e):t==="Capitalize"?dE(e):t==="Uppercase"?hE(e):t==="Lowercase"?gE(e):e:e.toString()}function iv(e,t){return e.map(r=>io(r,t))}function io(e,t,r={}){return fn(e)?nv(e,t,r):ln(e)?bE(e,t,r):Ne(e)?$e(iv(e.anyOf,t),r):un(e)?ke(ov(e.const,t),r):j(e,r)}function av(e,t={}){return io(e,"Capitalize",t)}function sv(e,t={}){return io(e,"Lowercase",t)}function cv(e,t={}){return io(e,"Uncapitalize",t)}function uv(e,t={}){return io(e,"Uppercase",t)}function yE(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=ua(e[o],t,ut(r));return n}function xE(e,t,r){return yE(e.properties,t,r)}function fv(e,t,r){let n=xE(e,t,r);return Re(n)}function wE(e,t){return e.map(r=>Ub(r,t))}function SE(e,t){return e.map(r=>Ub(r,t))}function vE(e,t){let{[t]:r,...n}=e;return n}function IE(e,t){return t.reduce((r,n)=>vE(r,n),e)}function _E(e,t,r){let n=St(e,[gt,"$id","required","properties"]),o=IE(r,t);return De(o,n)}function PE(e){let t=e.reduce((r,n)=>gp(n)?[...r,ke(n)]:r,[]);return $e(t)}function Ub(e,t){return wt(e)?_r(wE(e.allOf,t)):Ne(e)?$e(SE(e.anyOf,t)):Et(e)?_E(e,t,e.properties):De({})}function ua(e,t,r){let n=Nt(t)?PE(t):t,o=bt(t)?Hr(t):t,i=Mt(e),a=Mt(t);return pt(e)?fv(e,o,r):fn(t)?lv(e,t,r):i&&a?at("Omit",[e,n],r):!i&&a?at("Omit",[e,n],r):i&&!a?at("Omit",[e,n],r):j({...Ub(e,o),...r})}function ME(e,t,r){return{[t]:ua(e,[t],ut(r))}}function TE(e,t,r){return t.reduce((n,o)=>({...n,...ME(e,o,r)}),{})}function OE(e,t,r){return TE(e,t.keys,r)}function lv(e,t,r){let n=OE(e,t,r);return Re(n)}function CE(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=fa(e[o],t,ut(r));return n}function kE(e,t,r){return CE(e.properties,t,r)}function pv(e,t,r){let n=kE(e,t,r);return Re(n)}function NE(e,t){return e.map(r=>Bb(r,t))}function RE(e,t){return e.map(r=>Bb(r,t))}function EE(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}function AE(e,t,r){let n=St(e,[gt,"$id","required","properties"]),o=EE(r,t);return De(o,n)}function FE(e){let t=e.reduce((r,n)=>gp(n)?[...r,ke(n)]:r,[]);return $e(t)}function Bb(e,t){return wt(e)?_r(NE(e.allOf,t)):Ne(e)?$e(RE(e.anyOf,t)):Et(e)?AE(e,t,e.properties):De({})}function fa(e,t,r){let n=Nt(t)?FE(t):t,o=bt(t)?Hr(t):t,i=Mt(e),a=Mt(t);return pt(e)?pv(e,o,r):fn(t)?mv(e,t,r):i&&a?at("Pick",[e,n],r):!i&&a?at("Pick",[e,n],r):i&&!a?at("Pick",[e,n],r):j({...Bb(e,o),...r})}function $E(e,t,r){return{[t]:fa(e,[t],ut(r))}}function DE(e,t,r){return t.reduce((n,o)=>({...n,...$E(e,o,r)}),{})}function LE(e,t,r){return DE(e,t.keys,r)}function mv(e,t,r){let n=LE(e,t,r);return Re(n)}function VE(e,t){return at("Partial",[at(e,t)])}function zE(e){return at("Partial",[$o(e)])}function jE(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ir(e[r]);return t}function UE(e,t){let r=St(e,[gt,"$id","required","properties"]),n=jE(t);return De(n,r)}function dv(e){return e.map(t=>hv(t))}function hv(e){return Zn(e)?VE(e.target,e.parameters):Mt(e)?zE(e.$ref):wt(e)?_r(dv(e.allOf)):Ne(e)?$e(dv(e.anyOf)):Et(e)?UE(e,e.properties):Ha(e)||gi(e)||eo(e)||un(e)||Gu(e)||to(e)||bi(e)||Ku(e)||yi(e)?e:De({})}function dc(e,t){return pt(e)?gv(e,t):j({...hv(e),...t})}function BE(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=dc(e[n],ut(t));return r}function GE(e,t){return BE(e.properties,t)}function gv(e,t){let r=GE(e,t);return Re(r)}function KE(e,t){return at("Required",[at(e,t)])}function qE(e){return at("Required",[$o(e)])}function HE(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=St(e[r],[hr]);return t}function YE(e,t){let r=St(e,[gt,"$id","required","properties"]),n=HE(t);return De(n,r)}function bv(e){return e.map(t=>yv(t))}function yv(e){return Zn(e)?KE(e.target,e.parameters):Mt(e)?qE(e.$ref):wt(e)?_r(bv(e.allOf)):Ne(e)?$e(bv(e.anyOf)):Et(e)?YE(e,e.properties):Ha(e)||gi(e)||eo(e)||un(e)||Gu(e)||to(e)||bi(e)||Ku(e)||yi(e)?e:De({})}function hc(e,t){return pt(e)?xv(e,t):j({...yv(e),...t})}function WE(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=hc(e[n],t);return r}function XE(e,t){return WE(e.properties,t)}function xv(e,t){let r=XE(e,t);return Re(r)}function ZE(e,t){return t.map(r=>Mt(r)?Gb(e,r.$ref):mn(e,r))}function Gb(e,t){return t in e?Mt(e[t])?Gb(e,e[t].$ref):mn(e,e[t]):_e()}function QE(e){return sc(e[0])}function JE(e){return sa(e[0],e[1])}function e8(e){return uc(e[0])}function t8(e){return dc(e[0])}function r8(e){return ua(e[0],e[1])}function n8(e){return fa(e[0],e[1])}function o8(e){return hc(e[0])}function i8(e,t,r){let n=ZE(e,r);return t==="Awaited"?QE(n):t==="Index"?JE(n):t==="KeyOf"?e8(n):t==="Partial"?t8(n):t==="Omit"?r8(n):t==="Pick"?n8(n):t==="Required"?o8(n):_e()}function a8(e,t){return Js(mn(e,t))}function s8(e,t){return ec(mn(e,t))}function c8(e,t,r){return tc(rf(e,t),mn(e,r))}function u8(e,t,r){return Ao(rf(e,t),mn(e,r))}function f8(e,t){return _r(rf(e,t))}function l8(e,t){return ac(mn(e,t))}function p8(e,t){return De(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:mn(e,t[n])}),{}))}function m8(e,t){let[r,n]=[mn(e,$p(t)),Fp(t)],o=Ys(t);return o.patternProperties[n]=r,o}function d8(e,t){return Mt(t)?{...Gb(e,t.$ref),[gt]:t[gt]}:t}function h8(e,t){return On(rf(e,t))}function g8(e,t){return $e(rf(e,t))}function rf(e,t){return t.map(r=>mn(e,r))}function mn(e,t){return qr(t)?j(mn(e,St(t,[hr])),t):Xs(t)?j(mn(e,St(t,[Wn])),t):Fe(t)?j(d8(e,t),t):Xn(t)?j(a8(e,t.items),t):qa(t)?j(s8(e,t.items),t):Zn(t)?j(i8(e,t.target,t.parameters)):Qn(t)?j(c8(e,t.parameters,t.returns),t):Jn(t)?j(u8(e,t.parameters,t.returns),t):wt(t)?j(f8(e,t.allOf),t):Ya(t)?j(l8(e,t.items),t):Et(t)?j(p8(e,t.properties),t):Xa(t)?j(m8(e,t)):pn(t)?j(h8(e,t.items||[]),t):Ne(t)?j(g8(e,t.anyOf),t):t}function b8(e,t){return t in e?mn(e,e[t]):_e()}function wv(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:b8(e,r)}),{})}var Kb=class{constructor(t){let r=wv(t),n=this.WithIdentifiers(r);this.$defs=n}Import(t,r){let n={...this.$defs,[t]:j(this.$defs[t],r)};return j({[U]:"Import",$defs:n,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:{...t[n],$id:n}}),{})}};function Sv(e){return new Kb(e)}function vv(e,t){return j({[U]:"Not",not:e},t)}function Iv(e,t){return Jn(e)?On(e.parameters,t):_e()}var y8=0;function _v(e,t={}){Rt(t.$id)&&(t.$id=`T${y8++}`);let r=Ys(e({[U]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,j({[Mn]:"Recursive",...r},t)}function Pv(e,t){let r=tt(e)?new globalThis.RegExp(e):e;return j({[U]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function x8(e){return wt(e)?e.allOf:Ne(e)?e.anyOf:pn(e)?e.items??[]:[]}function Mv(e){return x8(e)}function Tv(e,t){return Jn(e)?j(e.returns,t):_e(t)}var qb=class{constructor(t){this.schema=t}Decode(t){return new Hb(this.schema,t)}},Hb=class{constructor(t,r){this.schema=t,this.decode=r}EncodeTransform(t,r){let i={Encode:a=>r[gt].Encode(t(a)),Decode:a=>this.decode(r[gt].Decode(a))};return{...r,[gt]:i}}EncodeSchema(t,r){let n={Decode:this.decode,Encode:t};return{...r,[gt]:n}}Encode(t){return Fe(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function Ov(e){return new qb(e)}function Cv(e={}){return j({[U]:e[U]??"Unsafe"},e)}function kv(e){return j({[U]:"Void",type:"void"},e)}var Yb={};Ga(Yb,{Any:()=>aa,Argument:()=>mS,Array:()=>Js,AsyncIterator:()=>ec,Awaited:()=>sc,BigInt:()=>ic,Boolean:()=>wp,Capitalize:()=>av,Composite:()=>RS,Const:()=>ES,Constructor:()=>tc,ConstructorParameters:()=>AS,Date:()=>Pp,Enum:()=>FS,Exclude:()=>pc,Extends:()=>lc,Extract:()=>mc,Function:()=>Ao,Index:()=>sa,InstanceType:()=>JS,Instantiate:()=>tv,Integer:()=>rv,Intersect:()=>_r,Iterator:()=>ac,KeyOf:()=>uc,Literal:()=>ke,Lowercase:()=>sv,Mapped:()=>MS,Module:()=>Sv,Never:()=>_e,Not:()=>vv,Null:()=>Mp,Number:()=>Tn,Object:()=>De,Omit:()=>ua,Optional:()=>Ir,Parameters:()=>Iv,Partial:()=>dc,Pick:()=>fa,Promise:()=>Ip,Readonly:()=>Yr,ReadonlyOptional:()=>Ep,Record:()=>Ap,Recursive:()=>_v,Ref:()=>$o,RegExp:()=>Pv,Required:()=>hc,Rest:()=>Mv,ReturnType:()=>Tv,String:()=>Fr,Symbol:()=>Tp,TemplateLiteral:()=>Sp,Transform:()=>Ov,Tuple:()=>On,Uint8Array:()=>Cp,Uncapitalize:()=>cv,Undefined:()=>Op,Union:()=>$e,Unknown:()=>no,Unsafe:()=>Cv,Uppercase:()=>uv,Void:()=>kv});var d=Yb;var ao=d.Object({label:d.String(),domain:d.Optional(d.Tuple([d.Number(),d.Number()]))}),nf=d.Object({type:d.Union([d.Literal("identity"),d.Literal("horizontal"),d.Literal("vertical")]),value:d.Optional(d.Number())}),Pee=d.Object({schemaVersion:d.Literal("1.0"),title:d.Optional(d.String()),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(nf))});var w8=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}))}),S8=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})}),Wb=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("calibration"),data:d.Array(w8),distribution:d.Optional(d.Array(S8)),x:d.Literal("predicted"),y:d.Literal("observed"),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(nf))});var v8=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})}),Xb=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("roc"),data:d.Array(v8),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity"),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(nf))});var I8=d.Union([Xb,Wb],{$id:"https://rtichoke.dev/schema/viz/1.0.json",title:"rtichoke visualization specification"});var $r=d.Object({id:d.String(),model:d.Optional(d.String()),population:d.String(),label:d.Optional(d.String())}),Nv=d.Union([d.Literal("model"),d.Literal("population"),d.Literal("evaluation"),d.Literal("context")]),Rv=d.Object({label:d.String(),group:d.String(),role:Nv}),gc=d.Object({id:d.String(),evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),display:Rv}),_8=d.Object({x:d.Number(),y:d.Number()}),Zb=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(_8,{minItems:2}),label:d.Optional(d.String())})]),P8=d.Intersect([Zb,d.Object({scope:d.Literal("global")})]),M8=d.Intersect([Zb,d.Object({scope:d.Literal("population"),population:d.String()})]),T8=d.Intersect([Zb,d.Object({scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),Ev=d.Union([P8,M8,T8]),Zr=d.Object({schemaVersion:d.Literal("2.0"),title:d.Optional(d.String()),evaluations:d.Array($r),series:d.Array(gc),xAxis:ao,yAxis:ao,references:d.Optional(d.Array(Ev))}),of=d.Union([d.Literal("probability_threshold"),d.Literal("ppcr")]),Si=d.Object({operatingPoint:d.Optional(d.Object({dimension:of}))}),Dp=d.Object({operatingPoint:d.Optional(d.Object({dimension:d.Literal("probability_threshold")}))});var Av=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}))}),Fv=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}))}),$v=d.Union([Av,Fv]),O8=d.Object({seriesId:d.String(),midpoint:d.Number({minimum:0,maximum:1}),count:d.Number({minimum:0}),binWidth:d.Number({exclusiveMinimum:0,maximum:1})}),Qb=d.Intersect([Zr,d.Object({type:d.Literal("calibration"),data:d.Array($v),distribution:d.Optional(d.Array(O8)),x:d.Literal("predicted"),y:d.Literal("observed")})]);var Jb=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")]),Dv=d.Object({id:Jb,label:d.String()}),Mr=d.Object({metricId:Jb,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()]))}),Lv=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})})]),Vv=d.Object({censoringHeuristic:d.Optional(d.String()),competingEventHeuristic:d.Optional(d.String())}),zv=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Number({minimum:0})),operatingPoint:Lv,context:d.Optional(Vv),values:d.Array(Mr)}),ey=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("performance_table"),title:d.Optional(d.String()),evaluations:d.Array($r),metrics:d.Array(Dv),rows:d.Array(zv)});var Uv=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),netBenefit:d.Number(),performance:d.Optional(d.Array(Mr))}),Bv=d.Intersect([$r,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Gv=d.Intersect([gc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Kv=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_none")}),jv={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")},qv=d.Union([d.Object({...jv,scope:d.Literal("population"),population:d.String()}),d.Object({...jv,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),Hv=d.Union([Kv,qv]),ty=d.Intersect([Zr,Dp,d.Object({type:d.Literal("decision_curve"),evaluations:d.Array(Bv,{minItems:1}),series:d.Array(Gv,{minItems:1}),data:d.Array(Uv),x:d.Literal("threshold"),y:d.Literal("netBenefit"),references:d.Array(Hv,{minItems:2})})]);var C8=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(Mr))}),ry=d.Intersect([Zr,Si,d.Object({type:d.Literal("gains"),data:d.Array(C8),x:d.Literal("ppcr"),y:d.Literal("sensitivity")})]);var Wv=d.Object({seriesId:d.String(),threshold:d.Number({minimum:0,maximum:1}),interventionsAvoided:d.Number(),performance:d.Optional(d.Array(Mr))}),Xv=d.Intersect([$r,d.Object({id:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Zv=d.Intersect([gc,d.Object({id:d.String({pattern:"^series-[1-9][0-9]*$"}),evaluationId:d.String({pattern:"^evaluation-[1-9][0-9]*$"})})]),Qv=d.Object({type:d.Literal("horizontal"),value:d.Literal(0),label:d.Optional(d.String()),scope:d.Literal("global"),benchmark:d.Literal("treat_all")}),Yv={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")},Jv=d.Union([d.Object({...Yv,scope:d.Literal("population"),population:d.String()}),d.Object({...Yv,scope:d.Literal("population_horizon"),population:d.String(),horizon:d.Number({minimum:0})})]),eI=d.Union([Qv,Jv]),ny=d.Intersect([Zr,Dp,d.Object({type:d.Literal("interventions_avoided"),evaluations:d.Array(Xv,{minItems:1}),series:d.Array(Zv,{minItems:1}),data:d.Array(Wv),x:d.Literal("threshold"),y:d.Literal("interventionsAvoided"),references:d.Array(eI,{minItems:2})})]);var k8=d.Object({seriesId:d.String(),cutoff:d.Number(),ppcr:d.Number({minimum:0,maximum:1}),lift:d.Number(),performance:d.Optional(d.Array(Mr))}),oy=d.Intersect([Zr,Si,d.Object({type:d.Literal("lift"),data:d.Array(k8),x:d.Literal("ppcr"),y:d.Literal("lift")})]);var N8=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(Mr))}),iy=d.Intersect([Zr,Si,d.Object({type:d.Literal("precision_recall"),data:d.Array(N8),x:d.Literal("sensitivity"),y:d.Literal("ppv")})]);var tI=d.Object({stateId:d.String(),label:d.Optional(d.String()),estimate:d.Optional(d.Union([d.Number(),d.Null()])),mass:d.Optional(d.Union([d.Number(),d.Null()])),count:d.Optional(d.Union([d.Integer(),d.Null()])),lower:d.Optional(d.Union([d.Number(),d.Null()])),upper:d.Optional(d.Union([d.Number(),d.Null()]))}),rI=d.Object({type:d.String(),lower:d.Optional(d.Union([d.Number(),d.Null()])),upper:d.Optional(d.Union([d.Number(),d.Null()])),includeLower:d.Optional(d.Boolean()),includeUpper:d.Optional(d.Boolean()),rankLower:d.Optional(d.Union([d.Number(),d.Null()])),rankUpper:d.Optional(d.Union([d.Number(),d.Null()])),operatingPointType:d.Optional(d.String()),cutoff:d.Optional(d.Union([d.Number(),d.Null()])),value:d.Optional(d.Union([d.Number(),d.Null()])),realizedPpcr:d.Optional(d.Union([d.Number(),d.Null()]))}),af=d.Object({evaluationId:d.String(),horizon:d.Optional(d.Union([d.Number(),d.Null()])),estimator:d.String(),estimateOrigin:d.Optional(d.Union([d.Literal("event_table"),d.Literal("fixed_time_horizon"),d.Literal("observed_step")])),stratum:d.Optional(rI),region:d.Optional(d.String()),censoringHeuristic:d.Optional(d.String()),competingHeuristic:d.Optional(d.String()),states:d.Array(tI,{minItems:1}),regimeId:d.Optional(d.String()),interventionId:d.Optional(d.String()),estimand:d.Optional(d.String()),contrastId:d.Optional(d.String())});var nI=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})}),R8=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})}),oI=d.Object({evaluationId:d.String(),type:of,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(Mr))}),sf=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("prediction_distribution"),title:d.Optional(d.String()),evaluations:d.Array($r,{minItems:1}),operatingPoint:d.Optional(d.Object({dimension:of})),bins:d.Array(nI,{minItems:1}),rankBins:d.Optional(d.Array(R8)),operatingPoints:d.Array(oI,{minItems:1}),stateDistributions:d.Optional(d.Array(af))});var E8=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(Mr))}),ay=d.Intersect([Zr,Si,d.Object({type:d.Literal("roc"),data:d.Array(E8),x:d.Literal("false_positive_rate"),y:d.Literal("sensitivity")})]);var sy=d.Union([ay,Qb,iy,ry,oy,ty,ny,sf],{$id:"https://rtichoke.dev/schema/viz/2.0.json",title:"rtichoke visualization specification v2"});var cy=d.Object({id:d.String(),label:d.String()}),uy=d.Object({metric:d.Literal("auroc"),owner:d.Object({type:d.Literal("evaluation"),evaluationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),fy=d.Object({metric:d.Literal("prevalence"),owner:d.Object({type:d.Literal("population"),populationId:d.String()}),estimate:d.Union([d.Number(),d.Null()])}),A8=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()])}),F8=d.Union([uy,fy]),iI=d.Union([uy,fy,A8]),$8=iI,D8=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array($r),populations:d.Array(cy),metrics:d.Array(F8)}),L8=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("summary_metrics"),title:d.Optional(d.String()),evaluations:d.Array($r),populations:d.Array(cy),metrics:d.Array(iI)}),ly=d.Union([D8,L8],{$id:"https://rtichoke.dev/schema/viz/summary-metrics.json",title:"rtichoke summary metrics specification"});var py=d.Object({schemaVersion:d.Literal("2.0"),type:d.Literal("outcome_distribution"),title:d.Optional(d.String()),stateScale:d.Optional(d.Union([d.Literal("ordinal"),d.Literal("nominal")])),evaluations:d.Array($r,{minItems:1}),stateDistributions:d.Array(af,{minItems:1})});var my=d.Union([sy,ey,ly,sf,py]),aI=d.Object({id:d.String(),title:d.Optional(d.String()),spec:my}),Lp=d.Object({schemaVersion:d.Literal("1.0"),type:d.Literal("report"),title:d.Optional(d.String()),components:d.Array(aI,{minItems:1})}),dy=d.Object({type:d.Literal("component"),id:d.String(),title:d.Optional(d.String()),spec:my}),sI=d.Object({type:d.Literal("group"),id:d.String(),title:d.String(),components:d.Array(dy,{minItems:1})}),cI=d.Object({id:d.String(),title:d.String(),items:d.Array(d.Union([dy,sI]),{minItems:1})}),Vp=d.Object({schemaVersion:d.Literal("1.1"),type:d.Literal("report"),title:d.Optional(d.String()),sections:d.Array(cI,{minItems:1})}),V8=d.Union([Lp,Vp],{$id:"https://rtichoke.dev/schema/viz/report.json",title:"rtichoke report specification"});function zp(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 hy(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 jp(e,t){if(t&&!t.has(e.evaluationId))throw new Error(`unknown evaluation id: ${e.evaluationId}`);if(e.horizon!==void 0&&e.horizon!==null&&(!Number.isFinite(e.horizon)||e.horizon<0))throw new Error(`horizon must be finite and non-negative for evaluation ${e.evaluationId}`);if(e.estimateOrigin==="observed_step"){if(e.horizon===void 0||e.horizon===null||!Number.isInteger(e.horizon)||e.horizon<0)throw new Error(`step (horizon) must be a non-negative integer for observed_step in evaluation ${e.evaluationId}`);if(e.estimator!=="raw"&&e.estimator!=="aalen_johansen")throw new Error(`unsupported estimator '${e.estimator}' for observed_step in evaluation ${e.evaluationId}`)}if(e.estimateOrigin!==void 0&&e.estimateOrigin!==null&&e.estimateOrigin!=="event_table"&&e.estimateOrigin!=="fixed_time_horizon"&&e.estimateOrigin!=="observed_step")throw new Error(`invalid estimateOrigin '${e.estimateOrigin}' for evaluation ${e.evaluationId}`);if(!e.states||e.states.length===0)throw new Error(`states must be non-empty for evaluation ${e.evaluationId}`);if(e.estimateOrigin==="observed_step"){if(e.estimator==="raw"){let r=0;for(let n of e.states){if(n.count===void 0||n.count===null)throw new Error(`count is required for state ${n.stateId} when estimator is 'raw' in observed_step`);if(!Number.isInteger(n.count)||n.count<0)throw new Error(`count must be a non-negative integer for state ${n.stateId}`);r+=n.count}if(r===0)throw new Error(`total observed count across states must be greater than zero for step ${e.horizon}`)}else if(e.estimator==="aalen_johansen"){let r=0;for(let n of e.states){if(n.estimate===void 0||n.estimate===null)throw new Error(`estimate is required for state ${n.stateId} when estimator is 'aalen_johansen' in observed_step`);if(!Number.isFinite(n.estimate)||n.estimate<0||n.estimate>1)throw new Error(`estimate must be a finite probability in [0, 1] for state ${n.stateId}`);r+=n.estimate}if(Math.abs(r-1)>1e-8)throw new Error(`occupancy estimates across states must sum to 1.0 (got ${r}) for step ${e.horizon}`)}}for(let r of e.states){if(r.estimate!==void 0&&r.estimate!==null&&(!Number.isFinite(r.estimate)||r.estimate<0||r.estimate>1))throw new Error(`estimate must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.lower!==void 0&&r.lower!==null&&(!Number.isFinite(r.lower)||r.lower<0||r.lower>1))throw new Error(`lower bound must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.upper!==void 0&&r.upper!==null&&(!Number.isFinite(r.upper)||r.upper<0||r.upper>1))throw new Error(`upper bound must be a finite probability in [0, 1] for state ${r.stateId}`);if(r.lower!==void 0&&r.lower!==null&&r.upper!==void 0&&r.upper!==null&&r.lower>r.upper)throw new Error(`lower bound ${r.lower} cannot exceed upper bound ${r.upper} for state ${r.stateId}`);if(r.mass!==void 0&&r.mass!==null&&(!Number.isFinite(r.mass)||r.mass<0))throw new Error(`mass must be finite and non-negative for state ${r.stateId}`);if(r.count!==void 0&&r.count!==null&&(!Number.isInteger(r.count)||r.count<0))throw new Error(`count must be a non-negative integer for state ${r.stateId}`)}if(e.stratum){let r=e.stratum;if(r.lower!==void 0&&r.lower!==null&&r.upper!==void 0&&r.upper!==null&&r.lower>r.upper)throw new Error(`stratum lower bound ${r.lower} cannot exceed upper bound ${r.upper} for evaluation ${e.evaluationId}`);if(r.rankLower!==void 0&&r.rankLower!==null&&r.rankUpper!==void 0&&r.rankUpper!==null&&r.rankLower>r.rankUpper)throw new Error(`stratum rankLower ${r.rankLower} cannot exceed rankUpper ${r.rankUpper} for evaluation ${e.evaluationId}`)}}function gy(e){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)}if(!e.stateDistributions||e.stateDistributions.length===0)throw new Error("stateDistributions must be non-empty");let r=new Set,n=new Set,o=new Map;for(let i of e.stateDistributions){jp(i,t);let a=i.estimateOrigin??"unspecified",s=`${i.evaluationId}|${a}:${i.horizon??0}`;if(n.has(s))throw new Error(`multiple state distributions defined for evaluation ${i.evaluationId} at step/horizon ${i.horizon??0}`);if(n.add(s),i.estimateOrigin==="observed_step"){let c=`${i.evaluationId}|${i.estimator}|${i.horizon}|${i.censoringHeuristic??""}|${i.competingHeuristic??""}`;if(r.has(c))throw new Error(`duplicate distribution for evaluation ${i.evaluationId}, estimator ${i.estimator}, and step ${i.horizon}`);r.add(c);let f=i.states.map(l=>l.stateId),u=`${i.evaluationId}|${i.estimator}`,p=o.get(u);if(!p)o.set(u,f);else if(f.length!==p.length||!f.every((l,m)=>l===p[m]))throw new Error(`inconsistent state ordering across steps for evaluation ${i.evaluationId}`)}}}function cf(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)}if(e.stateDistributions)for(let i of e.stateDistributions)jp(i,t);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 f=new Set([0]),u=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`);f.add(l.upper),u+=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(u<=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&&!f.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=u;else for(let h of a)h.upper>p.cutoff&&(l+=h.nPositive+h.nNegative);let m=l/u;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 by(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 vi(e){if(e.type==="prediction_distribution"){cf(e);return}let t=new Set(e.evaluations.map(o=>o.id)),r=new Set;if(t.size!==e.evaluations.length)throw new Error("duplicate evaluation id");for(let o of e.series){if(r.has(o.id))throw new Error(`duplicate series id: ${o.id}`);if(r.add(o.id),!t.has(o.evaluationId))throw new Error(`unknown evaluation id: ${o.evaluationId}`)}for(let o of e.data)if(!r.has(o.seriesId))throw new Error(`unknown series id: ${o.seriesId}`);if(e.type==="calibration"){for(let o of e.distribution??[])if(!r.has(o.seriesId))throw new Error(`unknown distribution series id: ${o.seriesId}`)}let n=new Set(e.evaluations.map(o=>o.population));for(let o of e.references??[])if((o.scope==="population"||o.scope==="population_horizon")&&!n.has(o.population))throw new Error(`unknown reference population: ${o.population}`);if(e.type==="decision_curve"){let o=e,i=o.references;o.evaluations.forEach((h,y)=>{let b=`evaluation-${y+1}`;if(h.id!==b)throw new Error(`decision curve evaluation ids must be ordinal: expected ${b}`)});let a=o.series.filter(h=>h.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("decision curve cannot mix static and horizon-qualified series");let s=a>0,c=[...new Set(o.series.map(h=>h.horizon).filter(h=>h!==void 0))],f=new Set;if(o.series.forEach((h,y)=>{if(h.id!==`series-${y+1}`)throw new Error(`decision curve series ids must be ordinal: expected series-${y+1}`);let b=o.evaluations.find(w=>w.id===h.evaluationId),x=b.model??b.population,g=b.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(f.has(S))throw new Error(`duplicate decision curve evaluation-horizon series: ${h.evaluationId}`);f.add(S)}),s){if(!o.evaluations.every(y=>c.every(b=>f.has(`${y.id}\0${b}`)))||o.series.length!==o.evaluations.length*c.length)throw new Error("decision curve requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(h=>!f.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 y=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(y))throw new Error(`duplicate Treat All owner: ${h.population}`);l.add(y)}let m=s?[...n].flatMap(h=>c.map(y=>`${h}\0${y}`)):[...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,y)=>{let b=`evaluation-${y+1}`;if(h.id!==b)throw new Error(`interventions avoided evaluation ids must be ordinal: expected ${b}`)});let a=o.series.filter(h=>h.horizon!==void 0).length;if(a!==0&&a!==o.series.length)throw new Error("interventions avoided cannot mix static and horizon-qualified series");let s=a>0,c=[...new Set(o.series.map(h=>h.horizon).filter(h=>h!==void 0))],f=new Set;if(o.series.forEach((h,y)=>{if(h.id!==`series-${y+1}`)throw new Error(`interventions avoided series ids must be ordinal: expected series-${y+1}`);let b=o.evaluations.find(w=>w.id===h.evaluationId);if(!b)throw new Error(`unknown evaluation id: ${h.evaluationId}`);let x=b.model??b.population,g=b.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(f.has(S))throw new Error(`duplicate interventions avoided evaluation-horizon series: ${h.evaluationId}`);f.add(S)}),s){if(!o.evaluations.every(y=>c.every(b=>f.has(`${y.id}\0${b}`)))||o.series.length!==o.evaluations.length*c.length)throw new Error("interventions avoided requires exactly one series per evaluation and horizon")}else if(o.series.length!==o.evaluations.length||o.evaluations.some(h=>!f.has(`${h.id}\0static`)))throw new Error("interventions avoided requires exactly one series per evaluation");let u=i.filter(h=>"benchmark"in h&&h.benchmark==="treat_all");if(u.length!==1)throw new Error("interventions avoided requires exactly one Treat All reference");if(u[0].scope!=="global"||u[0].type!=="horizontal"||u[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 y=h.scope==="population_horizon"?`${h.population}\0${h.horizon}`:h.population;if(l.has(y))throw new Error(`duplicate Treat None owner: ${h.population}`);l.add(y)}let m=s?[...n].flatMap(h=>c.map(y=>`${h}\0${y}`)):[...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 uI(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 z8(e){return uI(e.map(t=>({model:t.model,cutoff:t.probability_threshold,sensitivity:t.sensitivity,specificity:t.specificity})))}function j8(e){return uI(e.map(t=>({model:t.reference_group,cutoff:t.chosen_cutoff,sensitivity:t.sensitivity,specificity:t.specificity})))}function U8(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 B8(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 yy(e,t){return[...new Set(e)].map(n=>B8(n,t))}function G8(e,t="population"){let r=yy(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 K8(e,t){let r=yy(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 q8(e,t,r,n){let o=yy(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 f=c.sum_reals??c.n_reals,u=c.total_obs??c.n;return{seriesId:`series:${c.reference_group}`,predicted:c.x,observed:c.y,method:t,...t==="discrete"&&f!==void 0?{events:f}:{},...t==="discrete"&&u!==void 0?{total:u}:{}}}),...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 vt(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Rn(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ii(e){let t,r,n;e.length!==2?(t=vt,r=(s,c)=>vt(e(s),c),n=(s,c)=>e(s)-c):(t=e===vt||e===Rn?e:H8,r=e,n=e);function o(s,c,f=0,u=s.length){if(f>>1;r(s[p],c)<0?f=p+1:u=p}while(f>>1;r(s[p],c)<=0?f=p+1:u=p}while(ff&&n(s[p-1],c)>-n(s[p],c)?p-1:p}return{left:o,center:a,right:i}}function H8(){return 0}function uf(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 lI=Ii(vt),pI=lI.right,Y8=lI.left,W8=Ii(uf).center,_i=pI;function ts(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let o of e)(o=t(o,++n,e))!=null&&(o=+o)>=o&&++r}return r}function X8(e){return e.length|0}function Z8(e){return!(e>0)}function Q8(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function J8(e){return t=>e(...t)}function Up(...e){let t=typeof e[e.length-1]=="function"&&J8(e.pop());e=e.map(Q8);let r=e.map(X8),n=e.length-1,o=new Array(n+1).fill(0),i=[];if(n<0||r.some(Z8))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 Bp(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 bc(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 yc(e,t){let r=bc(e,t);return r&&Math.sqrt(r)}function Wt(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 Dr=class extends Map{constructor(t,r=hI){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(xy(this,t))}has(t){return super.has(xy(this,t))}set(t,r){return super.set(mI(this,t),r)}delete(t){return super.delete(dI(this,t))}},so=class extends Set{constructor(t,r=hI){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(xy(this,t))}add(t){return super.add(mI(this,t))}delete(t){return super.delete(dI(this,t))}};function xy({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function mI({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function dI({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function hI(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ff(e){return e}function Do(e,...t){return Sy(e,ff,ff,t)}function co(e,t,...r){return Sy(e,ff,t,r)}function wy(e,t,...r){return Sy(e,Array.from,t,r)}function Sy(e,t,r,n){return(function o(i,a){if(a>=n.length)return r(i);let s=new Dr,c=n[a++],f=-1;for(let u of i){let p=c(u,++f,i),l=s.get(p);l?l.push(u):s.set(p,[u])}for(let[u,p]of s)s.set(u,o(p,a));return t(s)})(e,0)}function vy(e,t){return Array.from(t,r=>e[r])}function Pi(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=lf(a[o],a[i]);if(s)return s}})):(r=e.map(r),n.sort((o,i)=>lf(r[o],r[i]))),vy(e,n)}return e.sort(Iy(r))}function Iy(e=vt){if(e===vt)return lf;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 lf(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}function xc(e,t,r){return(t.length!==2?Pi(co(e,t,r),(([n,o],[i,a])=>vt(o,a)||vt(n,i))):Pi(Do(e,r),(([n,o],[i,a])=>t(o,a)||vt(n,i)))).map(([n])=>n)}var e3=Math.sqrt(50),t3=Math.sqrt(10),r3=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>=e3?10:i>=t3?5:i>=r3?2:1,s,c,f;return o<0?(f=Math.pow(10,-o)/a,s=Math.round(e*f),c=Math.round(t*f),s/ft&&--c,f=-f):(f=Math.pow(10,o)*a,s=Math.round(e/f),c=Math.round(t/f),s*ft&&--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 f=0;f=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 qp(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 Lr(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 Hp(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 Yp(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?lf:Iy(o);n>r;){if(n-r>600){let c=n-r+1,f=t-r+1,u=Math.log(c),p=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*p*(c-p)/c)*(f-c/2<0?-1:1),m=Math.max(r,Math.floor(t-f*p/c+l)),h=Math.min(n,Math.floor(t+(c-f)*p/c+l));Yp(e,t,m,h,o)}let i=e[t],a=r,s=n;for(pf(e,r,t),o(e[n],i)>0&&pf(e,r,n);a0;)--s}o(e[r],i)===0?pf(e,r,s):(++s,pf(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function pf(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function mf(e,t=vt){let r,n=!1;if(t.length===1){let o;for(let i of e){let a=t(i);(n?vt(a,o)>0:vt(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 En(e,t,r){if(e=Float64Array.from(fI(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Lr(e);if(t>=1)return nr(e);var n,o=(n-1)*t,i=Math.floor(o),a=nr(Yp(e,i).subarray(0,i+1)),s=Lr(e.subarray(i+1));return a+(s-a)*(o-i)}}function _y(e,t,r=uf){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,r){let n=ts(e),o=En(e,.75)-En(e,.25);return n&&o?Math.ceil((r-t)/(2*o*Math.pow(n,-1/3))):1}function df(e,t,r){let n=ts(e),o=yc(e);return n&&o?Math.ceil((r-t)*Math.cbrt(n)/(3.49*o)):1}function Xp(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 ns(e,t){return En(e,.5,t)}function*o3(e){for(let t of e)yield*t}function Sc(e){return Array.from(o3(e))}function Zp(e,t){let r=new Dr;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 Qp(e,t=i3){let r=[],n,o=!1;for(let i of e)o&&r.push(t(n,i)),n=i,o=!0;return r}function i3(e,t){return[e,t]}function os(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 u3(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function f3(){return!this.__axis}function l3(e,t){var r=[],n=null,o=null,i=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,f=e===Py||e===Jp?-1:1,u=e===Jp||e===My?"x":"y",p=e===Py||e===Ty?a3:s3;function l(m){var h=n??(t.ticks?t.ticks.apply(t,r):t.domain()),y=o??(t.tickFormat?t.tickFormat.apply(t,r):gI),b=Math.max(i,0)+s,x=t.range(),g=+x[0]+c,S=+x[x.length-1]+c,w=(t.bandwidth?u3:c3)(t.copy(),c),_=m.selection?m.selection():m,v=_.selectAll(".domain").data([null]),I=_.selectAll(".tick").data(h,t).order(),O=I.exit(),M=I.enter().append("g").attr("class","tick"),E=I.select("line"),C=I.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(M),E=E.merge(M.append("line").attr("stroke","currentColor").attr(u+"2",f*i)),C=C.merge(M.append("text").attr("fill","currentColor").attr(u,f*b).attr("dy",e===Py?"0em":e===Ty?"0.71em":"0.32em")),m!==_&&(v=v.transition(m),I=I.transition(m),E=E.transition(m),C=C.transition(m),O=O.transition(m).attr("opacity",bI).attr("transform",function(N){return isFinite(N=w(N))?p(N+c):this.getAttribute("transform")}),M.attr("opacity",bI).attr("transform",function(N){var K=this.parentNode.__axis;return p((K&&isFinite(K=K(N))?K:w(N))+c)})),O.remove(),v.attr("d",e===Jp||e===My?a?"M"+f*a+","+g+"H"+c+"V"+S+"H"+f*a:"M"+c+","+g+"V"+S:a?"M"+g+","+f*a+"V"+c+"H"+S+"V"+f*a:"M"+g+","+c+"H"+S),I.attr("opacity",1).attr("transform",function(N){return p(w(N)+c)}),E.attr(u+"2",f*i),C.attr(u,f*b).text(y),_.filter(f3).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===My?"start":e===Jp?"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 Oy(e){return l3(Ty,e)}var p3={value:()=>{}};function xI(){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}})}em.prototype=xI.prototype={constructor:em,on:function(e,t){var r=this._,n=m3(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)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function h3(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===tm&&t.documentElement.namespaceURI===tm?t.createElement(e):t.createElementNS(r,e)}}function g3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ti(e){var t=Mi(e);return(t.local?g3:h3)(t)}function b3(){}function is(e){return e==null?b3:function(){return this.querySelector(e)}}function wI(e){typeof e!="function"&&(e=is(e));for(var t=this._groups,r=t.length,n=new Array(r),o=0;o=S&&(S=g+1);!(_=b[S])&&++S=0;)(a=n[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function RI(e){e||(e=k3);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 EI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AI(){return Array.from(this)}function FI(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?D3:typeof t=="function"?V3:L3)(e,t,r??"")):pa(this.node(),e)}function pa(e,t){return e.style.getPropertyValue(t)||om(e).getComputedStyle(e,null).getPropertyValue(t)}function z3(e){return function(){delete this[e]}}function j3(e,t){return function(){this[e]=t}}function U3(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function jI(e,t){return arguments.length>1?this.each((t==null?z3:typeof t=="function"?U3:j3)(e,t)):this.node()[e]}function UI(e){return e.trim().split(/^|\s+/)}function Ny(e){return e.classList||new BI(e)}function BI(e){this._node=e,this._names=UI(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 GI(e,t){for(var r=Ny(e),n=-1,o=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function aA(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?im(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?im(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=pA.exec(e))?new Bt(t[1],t[2],t[3],1):(t=mA.exec(e))?new Bt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dA.exec(e))?im(t[1],t[2],t[3],t[4]):(t=hA.exec(e))?im(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gA.exec(e))?d_(t[1],t[2]/100,t[3]/100,1):(t=bA.exec(e))?d_(t[1],t[2]/100,t[3]/100,t[4]):c_.hasOwnProperty(e)?l_(c_[e]):e==="transparent"?new Bt(NaN,NaN,NaN,0):null}function l_(e){return new Bt(e>>16&255,e>>8&255,e&255,1)}function im(e,t,r,n){return n<=0&&(e=t=r=NaN),new Bt(e,t,r,n)}function xf(e){return e instanceof zo||(e=gn(e)),e?(e=e.rgb(),new Bt(e.r,e.g,e.b,e.opacity)):new Bt}function An(e,t,r,n){return arguments.length===1?xf(e):new Bt(e,t,r,n??1)}function Bt(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ci(Bt,An,da(zo,{brighter(e){return e=e==null?cs:Math.pow(cs,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new Bt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Bt(ss(this.r),ss(this.g),ss(this.b),sm(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:p_,formatHex:p_,formatHex8:wA,formatRgb:m_,toString:m_}));function p_(){return`#${as(this.r)}${as(this.g)}${as(this.b)}`}function wA(){return`#${as(this.r)}${as(this.g)}${as(this.b)}${as((isNaN(this.opacity)?1:this.opacity)*255)}`}function m_(){let e=sm(this.opacity);return`${e===1?"rgb(":"rgba("}${ss(this.r)}, ${ss(this.g)}, ${ss(this.b)}${e===1?")":`, ${e})`}`}function sm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ss(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function as(e){return e=ss(e),(e<16?"0":"")+e.toString(16)}function d_(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new fo(e,t,r,n)}function g_(e){if(e instanceof fo)return new fo(e.h,e.s,e.l,e.opacity);if(e instanceof zo||(e=gn(e)),!e)return new fo;if(e instanceof fo)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 fo(a,s,c,e.opacity)}function wf(e,t,r,n){return arguments.length===1?g_(e):new fo(e,t,r,n??1)}function fo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ci(fo,wf,da(zo,{brighter(e){return e=e==null?cs:Math.pow(cs,e),new fo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new fo(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 Bt(Ey(e>=240?e-240:e+120,o,n),Ey(e,o,n),Ey(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new fo(h_(this.h),am(this.s),am(this.l),sm(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=sm(this.opacity);return`${e===1?"hsl(":"hsla("}${h_(this.h)}, ${am(this.s)*100}%, ${am(this.l)*100}%${e===1?")":`, ${e})`}`}}));function h_(e){return e=(e||0)%360,e<0?e+360:e}function am(e){return Math.max(0,Math.min(1,e||0))}function Ey(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 cm=Math.PI/180,um=180/Math.PI;var fm=18,b_=.96422,y_=1,x_=.82521,w_=4/29,Ic=6/29,S_=3*Ic*Ic,SA=Ic*Ic*Ic;function v_(e){if(e instanceof jo)return new jo(e.l,e.a,e.b,e.opacity);if(e instanceof ki)return I_(e);e instanceof Bt||(e=xf(e));var t=Dy(e.r),r=Dy(e.g),n=Dy(e.b),o=Ay((.2225045*t+.7168786*r+.0606169*n)/y_),i,a;return t===r&&r===n?i=a=o:(i=Ay((.4360747*t+.3850649*r+.1430804*n)/b_),a=Ay((.0139322*t+.0971045*r+.7141733*n)/x_)),new jo(116*o-16,500*(i-o),200*(o-a),e.opacity)}function _c(e,t,r,n){return arguments.length===1?v_(e):new jo(e,t,r,n??1)}function jo(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Ci(jo,_c,da(zo,{brighter(e){return new jo(this.l+fm*(e??1),this.a,this.b,this.opacity)},darker(e){return new jo(this.l-fm*(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_*Fy(t),e=y_*Fy(e),r=x_*Fy(r),new Bt($y(3.1338561*t-1.6168667*e-.4906146*r),$y(-.9787684*t+1.9161415*e+.033454*r),$y(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function Ay(e){return e>SA?Math.pow(e,1/3):e/S_+w_}function Fy(e){return e>Ic?e*e*e:S_*(e-w_)}function $y(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Dy(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function vA(e){if(e instanceof ki)return new ki(e.h,e.c,e.l,e.opacity);if(e instanceof jo||(e=v_(e)),e.a===0&&e.b===0)return new ki(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 k_(e,t){return function(r){return e+r*t}}function _A(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 Mc(e,t){var r=t-e;return r?k_(e,r>180||r<-180?r-360*Math.round(r/360):r):Pc(isNaN(e)?t:e)}function N_(e){return(e=+e)==1?yt:function(t,r){return r-t?_A(t,r,e):Pc(isNaN(t)?r:t)}}function yt(e,t){var r=t-e;return r?k_(e,r):Pc(isNaN(e)?t:e)}var Fn=(function e(t){var r=N_(t);function n(o,i){var a=r((o=An(o)).r,(i=An(i)).r),s=r(o.g,i.g),c=r(o.b,i.b),f=yt(o.opacity,i.opacity);return function(u){return o.r=a(u),o.g=s(u),o.b=c(u),o.opacity=f(u),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:mt(n,o)})),r=Uy.lastIndex;return r180?u+=360:u-f>180&&(f+=360),l.push({i:p.push(o(p)+"rotate(",null,n)-2,x:mt(f,u)})):u&&p.push(o(p)+"rotate("+u+n)}function s(f,u,p,l){f!==u?l.push({i:p.push(o(p)+"skewX(",null,n)-2,x:mt(f,u)}):u&&p.push(o(p)+"skewX("+u+n)}function c(f,u,p,l,m,h){if(f!==p||u!==l){var y=m.push(o(m)+"scale(",null,",",null,")");h.push({i:y-4,x:mt(f,p)},{i:y-2,x:mt(u,l)})}else(p!==1||l!==1)&&m.push(o(m)+"scale("+p+","+l+")")}return function(f,u){var p=[],l=[];return f=e(f),u=e(u),i(f.translateX,f.translateY,u.translateX,u.translateY,p,l),a(f.rotate,u.rotate,p,l),s(f.skewX,u.skewX,p,l),c(f.scaleX,f.scaleY,u.scaleX,u.scaleY,p,l),f=u=null,function(m){for(var h=-1,y=l.length,b;++h=0&&e._call.call(void 0,t),e=e._next;--Oc}function K_(){ls=(gm=Tf.now())+bm,Oc=Pf=0;try{Y_()}finally{Oc=0,EA(),ls=0}}function RA(){var e=Tf.now(),t=e-gm;t>q_&&(bm-=t,gm=e)}function EA(){for(var e,t=hm,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:hm=r);Mf=e,Wy(n)}function Wy(e){if(!Oc){Pf&&(Pf=clearTimeout(Pf));var t=e-ls;t>24?(e<1/0&&(Pf=setTimeout(K_,e-Tf.now()-bm)),_f&&(_f=clearInterval(_f))):(_f||(gm=Tf.now(),_f=setInterval(RA,q_)),Oc=1,H_(K_))}}function xm(e,t,r){var n=new Of;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,r),n}var AA=Cy("start","end","cancel","interrupt"),FA=[],Z_=0,W_=1,Sm=2,wm=3,X_=4,vm=5,kf=6;function ga(e,t,r,n,o,i){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;$A(e,r,{name:t,index:n,group:o,on:AA,tween:FA,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Z_})}function Nf(e,t){var r=Xt(e,t);if(r.state>Z_)throw new Error("too late; already scheduled");return r}function gr(e,t){var r=Xt(e,t);if(r.state>wm)throw new Error("too late; already running");return r}function Xt(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function $A(e,t,r){var n=e.__transition,o;n[t]=r,r.timer=ym(i,0,r.time);function i(f){r.state=W_,r.timer.restart(a,r.delay,r.time),r.delay<=f&&a(f-r.delay)}function a(f){var u,p,l,m;if(r.state!==W_)return c();for(u in n)if(m=n[u],m.name===r.name){if(m.state===wm)return xm(a);m.state===X_?(m.state=kf,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[u]):+uSm&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function r4(e,t,r){var n,o,i=t4(t)?Nf:gr;return function(){var a=i(this,e),s=a.on;s!==n&&(o=(n=s).copy()).on(t,r),a.on=o}}function cP(e,t){var r=this._id;return arguments.length<2?Xt(this.node(),r).on.on(e):this.each(r4(r,e,t))}function n4(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function uP(){return this.on("end.remove",n4(this._id))}function fP(e){var t=this._name,r=this._id;typeof e!="function"&&(e=is(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 IP;let r=10**t;return function(n){this._+=n[0];for(let o=1,i=n.length;ops)if(!(Math.abs(p*c-f*u)>ps)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let m=n-a,h=o-s,y=c*c+f*f,b=m*m+h*h,x=Math.sqrt(y),g=Math.sqrt(l),S=i*Math.tan((Zy-Math.acos((y+l-b)/(2*x*g)))/2),w=S/g,_=S/x;Math.abs(w-1)>ps&&this._append`L${t+w*u},${r+w*p}`,this._append`A${i},${i},0,0,${+(p*m>u*h)},${this._x1=t+_*c},${this._y1=r+_*f}`}}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),f=t+s,u=r+c,p=1^a,l=a?o-i:i-o;this._x1===null?this._append`M${f},${u}`:(Math.abs(this._x1-f)>ps||Math.abs(this._y1-u)>ps)&&this._append`L${f},${u}`,n&&(l<0&&(l=l%Qy+Qy),l>x4?this._append`A${n},${n},0,1,${p},${t-s},${r-c}A${n},${n},0,1,${p},${this._x1=f},${this._y1=u}`:l>ps&&this._append`A${n},${n},0,${+(l>=Zy)},${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 _P(){return new ba}_P.prototype=ba.prototype;function po(e=3){return new ba(+e)}function PP(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ms(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 Bo(e){return e=ms(Math.abs(e)),e?e[1]:NaN}function MP(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 TP(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var S4=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Go(e){if(!(t=S4.exec(e)))throw new Error("invalid format: "+e);var t;return new Tm({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]})}Go.prototype=Tm.prototype;function Tm(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+""}Tm.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 OP(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 Rf;function CP(e,t){var r=ms(e,t);if(!r)return Rf=void 0,e.toPrecision(t);var n=r[0],o=r[1],i=o-(Rf=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")+ms(e,Math.max(0,t+i-1))[0]}function Jy(e,t){var r=ms(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 e0={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:PP,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)=>Jy(e*100,t),r:Jy,s:CP,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function t0(e){return e}var kP=Array.prototype.map,NP=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function RP(e){var t=e.grouping===void 0||e.thousands===void 0?t0:MP(kP.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?t0:TP(kP.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 f(p,l){p=Go(p);var m=p.fill,h=p.align,y=p.sign,b=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"):e0[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:"")+(b==="$"?r:b==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():""),O=(b==="$"?n:/[%p]/.test(v)?a:"")+(l&&l.suffix!==void 0?l.suffix:""),M=e0[v],E=/[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 C(N){var K=I,F=O,T,V,D;if(v==="c")F=M(N)+F,N="";else{N=+N;var H=N<0||1/N<0;if(N=isNaN(N)?c:M(Math.abs(N),w),_&&(N=OP(N)),H&&+N==0&&y!=="+"&&(H=!1),K=(H?y==="("?y:s:y==="-"||y==="("?"":y)+K,F=(v==="s"&&!isNaN(N)&&Rf!==void 0?NP[8+Rf/3]:"")+F+(H&&y==="("?")":""),E){for(T=-1,V=N.length;++TD||D>57){F=(D===46?o+N.slice(T+1):N.slice(T))+F,N=N.slice(0,T);break}}}S&&!x&&(N=t(N,1/0));var G=K.length+N.length+F.length,Y=G>1)+K+N+F+Y.slice(G);break;default:N=Y+K+N+F;break}return i(N)}return C.toString=function(){return p+""},C}function u(p,l){var m=Math.max(-8,Math.min(8,Math.floor(Bo(l)/3)))*3,h=Math.pow(10,-m),y=f((p=Go(p),p.type="f",p),{suffix:NP[8+m/3]});return function(b){return y(h*b)}}return{format:f,formatPrefix:u}}var Om,$n,Cm;r0({thousands:",",grouping:[3],currency:["$",""]});function r0(e){return Om=RP(e),$n=Om.format,Cm=Om.formatPrefix,Om}function n0(e){return Math.max(0,-Bo(Math.abs(e)))}function o0(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bo(t)/3)))*3-Bo(Math.abs(e)))}function i0(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bo(t)-Bo(e))+1}var ce=1e-6,km=1e-12,ye=Math.PI,Ye=ye/2,a0=ye/4,or=ye*2,Zt=180/ye,We=ye/180,ve=Math.abs,Dn=Math.atan,br=Math.atan2,se=Math.cos;var Nm=Math.exp;var ds=Math.log,Rm=Math.pow,ae=Math.sin,Or=Math.sign||function(e){return e>0?1:e<0?-1:0},st=Math.sqrt,kc=Math.tan;function Em(e){return e>1?0:e<-1?ye:Math.acos(e)}function Ot(e){return e>1?Ye:e<-1?-Ye:Math.asin(e)}function ir(){}function Am(e,t){e&&AP.hasOwnProperty(e.type)&&AP[e.type](e,t)}var EP={Feature:function(e,t){Am(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,o=r.length;++nye&&(e-=Math.round(e/or)*or),[e,t]}c0.invert=c0;function u0(e,t,r){return(e%=or)?t||r?Df(DP(e),LP(t,r)):DP(e):t||r?LP(t,r):c0}function $P(e){return function(t,r){return t+=e,ve(t)>ye&&(t-=Math.round(t/or)*or),[t,r]}}function DP(e){var t=$P(e);return t.invert=$P(-e),t}function LP(e,t){var r=se(e),n=ae(e),o=se(t),i=ae(t);function a(s,c){var f=se(c),u=se(s)*f,p=ae(s)*f,l=ae(c),m=l*r+u*n;return[br(p*o-m*i,u*r-l*n),Ot(m*o+p*i)]}return a.invert=function(s,c){var f=se(c),u=se(s)*f,p=ae(s)*f,l=ae(c),m=l*o-p*i;return[br(p*o+l*i,u*r+m*n),Ot(m*r-u*n)]},a}function VP(e){e=u0(e[0]*We,e[1]*We,e.length>2?e[2]*We:0);function t(r){return r=e(r[0]*We,r[1]*We),r[0]*=Zt,r[1]*=Zt,r}return t.invert=function(r){return r=e.invert(r[0]*We,r[1]*We),r[0]*=Zt,r[1]*=Zt,r},t}function jP(e,t,r,n,o,i){if(r){var a=se(t),s=ae(t),c=n*r;o==null?(o=t+n*or,i=t-c/2):(o=zP(a,o),i=zP(a,i),(n>0?oi)&&(o+=n*or));for(var f,u=o;n>0?u>i:u1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Rc(e,t){return ve(e[0]-t[0])=0;--s)o.point((p=u[s])[0],p[1]);else n(l.x,l.p.x,-1,o);l=l.p}l=l.o,u=l.z,m=!m}while(!l.v);o.lineEnd()}}}function UP(e){if(t=e.length){for(var t,r=0,n=e[0],o;++r=0?1:-1,E=M*O,C=E>ye,N=b*v;if(c.add(br(N*M*ae(E),x*I+N*se(E))),a+=C?O+M*or:O,C^h>=r^w>=r){var K=Nc(Ko(m),Ko(S));$f(K);var F=Nc(i,K);$f(F);var T=(C^O>=0?-1:1)*Ot(F[2]);(n>T||n===T&&(K[0]||K[1]))&&(s+=C^O>=0?1:-1)}}return(a<-ce||a0){for(c||(o.polygonStart(),c=!0),o.lineStart(),v=0;v1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(v4))}}return l}}function v4(e){return e.length>1}function I4(e,t){return((e=e.x)[0]<0?e[1]-Ye-ce:Ye-e[1])-((t=t.x)[0]<0?t[1]-Ye-ce:Ye-t[1])}var l0=Vm(function(){return!0},_4,M4,[-ye,-Ye]);function _4(e){var t=NaN,r=NaN,n=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(i,a){var s=i>0?ye:-ye,c=ve(i-t);ve(c-ye)0?Ye:-Ye),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(i,r),o=0):n!==s&&c>=ye&&(ve(t-n)ce?Dn((ae(t)*(i=se(n))*ae(r)-ae(n)*(o=se(t))*ae(e))/(o*i*a)):(t+n)/2}function M4(e,t,r,n){var o;if(e==null)o=r*Ye,n.point(-ye,o),n.point(0,o),n.point(ye,o),n.point(ye,0),n.point(ye,-o),n.point(0,-o),n.point(-ye,-o),n.point(-ye,0),n.point(-ye,o);else if(ve(e[0]-t[0])>ce){var i=e[0]0,o=ve(t)>ce;function i(u,p,l,m){jP(m,e,r,l,u,p)}function a(u,p){return se(u)*se(p)>t}function s(u){var p,l,m,h,y;return{lineStart:function(){h=m=!1,y=1},point:function(b,x){var g=[b,x],S,w=a(b,x),_=n?w?0:f(b,x):w?f(b+(b<0?ye:-ye),x):0;if(!p&&(h=m=w)&&u.lineStart(),w!==m&&(S=c(p,g),(!S||Rc(p,S)||Rc(g,S))&&(g[2]=1)),w!==m)y=0,w?(u.lineStart(),S=c(g,p),u.point(S[0],S[1])):(S=c(p,g),u.point(S[0],S[1],2),u.lineEnd()),p=S;else if(o&&p&&n^w){var v;!(_&l)&&(v=c(g,p,!0))&&(y=0,n?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!p||!Rc(p,g))&&u.point(g[0],g[1]),p=g,m=w,l=_},lineEnd:function(){m&&u.lineEnd(),p=null},clean:function(){return y|(h&&m)<<1}}}function c(u,p,l){var m=Ko(u),h=Ko(p),y=[1,0,0],b=Nc(m,h),x=Af(b,b),g=b[0],S=x-g*g;if(!S)return!l&&u;var w=t*x/S,_=-t*g/S,v=Nc(y,b),I=Ff(y,w),O=Ff(b,_);Fm(I,O);var M=v,E=Af(I,M),C=Af(M,M),N=E*E-C*(Af(I,I)-1);if(!(N<0)){var K=st(N),F=Ff(M,(-E-K)/C);if(Fm(F,I),F=Ef(F),!l)return F;var T=u[0],V=p[0],D=u[1],H=p[1],G;V0^F[1]<(ve(F[0]-T)ye^(T<=F[0]&&F[0]<=V)){var q=Ff(M,(-E+K)/C);return Fm(q,I),[F,Ef(q)]}}}function f(u,p){var l=n?e:ye-e,m=0;return u<-l?m|=1:u>l&&(m|=2),p<-l?m|=4:p>l&&(m|=8),m}return Vm(a,s,i,n?[0,-e]:[-ye,e-ye])}function KP(e,t,r,n,o,i){var a=e[0],s=e[1],c=t[0],f=t[1],u=0,p=1,l=c-a,m=f-s,h;if(h=r-a,!(!l&&h>0)){if(h/=l,l<0){if(h0){if(h>p)return;h>u&&(u=h)}if(h=o-a,!(!l&&h<0)){if(h/=l,l<0){if(h>p)return;h>u&&(u=h)}else if(l>0){if(h0)){if(h/=m,m<0){if(h0){if(h>p)return;h>u&&(u=h)}if(h=i-s,!(!m&&h<0)){if(h/=m,m<0){if(h>p)return;h>u&&(u=h)}else if(m>0){if(h0&&(e[0]=a+u*l,e[1]=s+u*m),p<1&&(t[0]=a+p*l,t[1]=s+p*m),!0}}}}}var Lf=1e9,zm=-Lf;function Ec(e,t,r,n){function o(f,u){return e<=f&&f<=r&&t<=u&&u<=n}function i(f,u,p,l){var m=0,h=0;if(f==null||(m=a(f,p))!==(h=a(u,p))||c(f,u)<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(u[0],u[1])}function a(f,u){return ve(f[0]-e)0?0:3:ve(f[0]-r)0?2:1:ve(f[1]-t)0?1:0:u>0?3:2}function s(f,u){return c(f.x,u.x)}function c(f,u){var p=a(f,1),l=a(u,1);return p!==l?p-l:p===0?u[1]-f[1]:p===1?f[0]-u[0]:p===2?f[1]-u[1]:u[0]-f[0]}return function(f){var u=f,p=$m(),l,m,h,y,b,x,g,S,w,_,v,I={point:O,lineStart:N,lineEnd:K,polygonStart:E,polygonEnd:C};function O(T,V){o(T,V)&&u.point(T,V)}function M(){for(var T=0,V=0,D=m.length;Vn&&(ie-Z)*(n-q)>(ee-q)*(e-Z)&&++T:ee<=n&&(ie-Z)*(n-q)<(ee-q)*(e-Z)&&--T;return T}function E(){u=p,l=[],m=[],v=!0}function C(){var T=M(),V=v&&T,D=(l=Sc(l)).length;(V||D)&&(f.polygonStart(),V&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),D&&Lm(l,s,T,i,f),f.polygonEnd()),u=f,l=m=h=null}function N(){I.point=F,m&&m.push(h=[]),_=!0,w=!1,g=S=NaN}function K(){l&&(F(y,b),x&&w&&p.rejoin(),l.push(p.result())),I.point=O,w&&u.lineEnd()}function F(T,V){var D=o(T,V);if(m&&h.push([T,V]),_)y=T,b=V,x=D,_=!1,D&&(u.lineStart(),u.point(T,V));else if(D&&w)u.point(T,V);else{var H=[g=Math.max(zm,Math.min(Lf,g)),S=Math.max(zm,Math.min(Lf,S))],G=[T=Math.max(zm,Math.min(Lf,T)),V=Math.max(zm,Math.min(Lf,V))];KP(H,G,e,t,r,n)?(w||(u.lineStart(),u.point(H[0],H[1])),u.point(G[0],G[1]),D||u.lineEnd(),v=!1):D&&(u.lineStart(),u.point(T,V),v=!1)}g=T,S=V,w=D}return I}}var Vf=e=>e;var p0=new dn,m0=new dn,qP,HP,d0,h0,ya={point:ir,lineStart:ir,lineEnd:ir,polygonStart:function(){ya.lineStart=T4,ya.lineEnd=C4},polygonEnd:function(){ya.lineStart=ya.lineEnd=ya.point=ir,p0.add(ve(m0)),m0=new dn},result:function(){var e=p0/2;return p0=new dn,e}};function T4(){ya.point=O4}function O4(e,t){ya.point=YP,qP=d0=e,HP=h0=t}function YP(e,t){m0.add(h0*e-d0*t),d0=e,h0=t}function C4(){YP(qP,HP)}var g0=ya;var Ac=1/0,jm=Ac,zf=-Ac,Um=zf,k4={point:N4,lineStart:ir,lineEnd:ir,polygonStart:ir,polygonEnd:ir,result:function(){var e=[[Ac,jm],[zf,Um]];return zf=Um=-(jm=Ac=1/0),e}};function N4(e,t){ezf&&(zf=e),tUm&&(Um=t)}var Fc=k4;var b0=0,y0=0,jf=0,Bm=0,Gm=0,$c=0,x0=0,w0=0,Uf=0,ZP,QP,qo,Ho,ho={point:hs,lineStart:WP,lineEnd:XP,polygonStart:function(){ho.lineStart=A4,ho.lineEnd=F4},polygonEnd:function(){ho.point=hs,ho.lineStart=WP,ho.lineEnd=XP},result:function(){var e=Uf?[x0/Uf,w0/Uf]:$c?[Bm/$c,Gm/$c]:jf?[b0/jf,y0/jf]:[NaN,NaN];return b0=y0=jf=Bm=Gm=$c=x0=w0=Uf=0,e}};function hs(e,t){b0+=e,y0+=t,++jf}function WP(){ho.point=R4}function R4(e,t){ho.point=E4,hs(qo=e,Ho=t)}function E4(e,t){var r=e-qo,n=t-Ho,o=st(r*r+n*n);Bm+=o*(qo+e)/2,Gm+=o*(Ho+t)/2,$c+=o,hs(qo=e,Ho=t)}function XP(){ho.point=hs}function A4(){ho.point=$4}function F4(){JP(ZP,QP)}function $4(e,t){ho.point=JP,hs(ZP=qo=e,QP=Ho=t)}function JP(e,t){var r=e-qo,n=t-Ho,o=st(r*r+n*n);Bm+=o*(qo+e)/2,Gm+=o*(Ho+t)/2,$c+=o,o=Ho*e-qo*t,x0+=o*(qo+e),w0+=o*(Ho+t),Uf+=o*3,hs(qo=e,Ho=t)}var S0=ho;function Km(e){this._context=e}Km.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,or);break}}},result:ir};var I0=new dn,v0,eM,tM,Bf,Gf,qm={point:ir,lineStart:function(){qm.point=D4},lineEnd:function(){v0&&rM(eM,tM),qm.point=ir},polygonStart:function(){v0=!0},polygonEnd:function(){v0=null},result:function(){var e=+I0;return I0=new dn,e}};function D4(e,t){qm.point=rM,eM=Bf=e,tM=Gf=t}function rM(e,t){Bf-=e,Gf-=t,I0.add(st(Bf*Bf+Gf*Gf)),Bf=e,Gf=t}var _0=qm;var nM,Hm,oM,iM,Dc=class{constructor(t){this._append=t==null?aM:L4(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!==oM||this._append!==Hm){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`,oM=n,Hm=this._append,iM=this._,this._=o}this._+=iM;break}}}result(){let t=this._;return this._="",t.length?t:null}};function aM(e){let t=1;this._+=e[0];for(let r=e.length;t=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return aM;if(t!==nM){let r=10**t;nM=t,Hm=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 Dc(r)),a},a.projection(e).digits(r).context(t)}function Vc(e){return{stream:zc(e)}}function zc(e){return function(t){var r=new P0;for(var n in e)r[n]=e[n];return r.stream=t,r}}function P0(){}P0.prototype={constructor:P0,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 M0(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),mo(r,e.stream(Fc)),t(Fc.result()),n!=null&&e.clipExtent(n),e}function Kf(e,t,r){return M0(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 Ym(e,t,r){return Kf(e,[[0,0],t],r)}function Wm(e,t,r){return M0(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 Xm(e,t,r){return M0(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 sM=16,V4=se(30*We);function T0(e,t){return+t?j4(e,t):z4(e)}function z4(e){return zc({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function j4(e,t){function r(n,o,i,a,s,c,f,u,p,l,m,h,y,b){var x=f-n,g=u-o,S=x*x+g*g;if(S>4*t&&y--){var w=a+l,_=s+m,v=c+h,I=st(w*w+_*_+v*v),O=Ot(v/=I),M=ve(ve(v)-1)t||ve((x*K+g*F)/S-.5)>.3||a*l+s*m+c*h2?T[2]%360*We:0,K()):[s*Zt,c*Zt,f*Zt]},C.angle=function(T){return arguments.length?(p=T%360*We,K()):p*Zt},C.reflectX=function(T){return arguments.length?(l=T?-1:1,K()):l<0},C.reflectY=function(T){return arguments.length?(m=T?-1:1,K()):m<0},C.precision=function(T){return arguments.length?(v=T0(I,_=T*T),F()):st(_)},C.fitExtent=function(T,V){return Kf(C,T,V)},C.fitSize=function(T,V){return Ym(C,T,V)},C.fitWidth=function(T,V){return Wm(C,T,V)},C.fitHeight=function(T,V){return Xm(C,T,V)};function K(){var T=cM(r,0,0,l,m,p).apply(null,t(i,a)),V=cM(r,n-T[0],o-T[1],l,m,p);return u=u0(s,c,f),I=Df(t,V),O=Df(u,I),v=T0(I,_),F()}function F(){return M=E=null,C}return function(){return t=e.apply(this,arguments),C.invert=t.invert&&N,K()}}function jc(e){var t=0,r=ye/3,n=O0(e),o=n(t,r);return o.parallels=function(i){return arguments.length?n(t=i[0]*We,r=i[1]*We):[t*Zt,r*Zt]},o}function uM(e){var t=se(e);function r(n,o){return[n*t,ae(o)/t]}return r.invert=function(n,o){return[n/t,Ot(o*t)]},r}function fM(e,t){var r=ae(e),n=(r+ae(t))/2;if(ve(n)=.12&&b<.234&&y>=-.425&&y<-.214?o:b>=.166&&b<.234&&y>=-.214&&y<-.115?a:r).invert(l)},u.stream=function(l){return e&&t===l?e:e=K4([r.stream(t=l),o.stream(l),a.stream(l)])},u.precision=function(l){return arguments.length?(r.precision(l),o.precision(l),a.precision(l),p()):r.precision()},u.scale=function(l){return arguments.length?(r.scale(l),o.scale(l*.35),a.scale(l),u.translate(r.translate())):r.scale()},u.translate=function(l){if(!arguments.length)return r.translate();var m=r.scale(),h=+l[0],y=+l[1];return n=r.translate(l).clipExtent([[h-.455*m,y-.238*m],[h+.455*m,y+.238*m]]).stream(f),i=o.translate([h-.307*m,y+.201*m]).clipExtent([[h-.425*m+ce,y+.12*m+ce],[h-.214*m-ce,y+.234*m-ce]]).stream(f),s=a.translate([h-.205*m,y+.212*m]).clipExtent([[h-.214*m+ce,y+.166*m+ce],[h-.115*m-ce,y+.234*m-ce]]).stream(f),p()},u.fitExtent=function(l,m){return Kf(u,l,m)},u.fitSize=function(l,m){return Ym(u,l,m)},u.fitWidth=function(l,m){return Wm(u,l,m)},u.fitHeight=function(l,m){return Xm(u,l,m)};function p(){return e=t=null,u}return u.scale(1070)}function Zm(e){return function(t,r){var n=se(t),o=se(r),i=e(n*o);return i===1/0?[2,0]:[i*o*ae(t),i*ae(r)]}}function Yo(e){return function(t,r){var n=st(t*t+r*r),o=e(n),i=ae(o),a=se(o);return[br(t*i,n*a),Ot(n&&r*i/n)]}}var k0=Zm(function(e){return st(2/(1+e))});k0.invert=Yo(function(e){return 2*Ot(e/2)});function N0(){return yr(k0).scale(124.75).clipAngle(180-.001)}var R0=Zm(function(e){return(e=Em(e))&&e/ae(e)});R0.invert=Yo(function(e){return e});function E0(){return yr(R0).scale(79.4188).clipAngle(180-.001)}function Uc(e,t){return[e,ds(kc((Ye+t)/2))]}Uc.invert=function(e,t){return[e,2*Dn(Nm(t))-Ye]};function A0(){return F0(Uc).scale(961/or)}function F0(e){var t=yr(e),r=t.center,n=t.scale,o=t.translate,i=t.clipExtent,a=null,s,c,f;t.scale=function(p){return arguments.length?(n(p),u()):n()},t.translate=function(p){return arguments.length?(o(p),u()):o()},t.center=function(p){return arguments.length?(r(p),u()):r()},t.clipExtent=function(p){return arguments.length?(p==null?a=s=c=f=null:(a=+p[0][0],s=+p[0][1],c=+p[1][0],f=+p[1][1]),u()):a==null?null:[[a,s],[c,f]]};function u(){var p=ye*n(),l=t(VP(t.rotate()).invert([0,0]));return i(a==null?[[l[0]-p,l[1]-p],[l[0]+p,l[1]+p]]:e===Uc?[[Math.max(l[0]-p,a),s],[Math.min(l[0]+p,c),f]]:[[a,Math.max(l[1]-p,s)],[c,Math.min(l[1]+p,f)]])}return u()}function Qm(e){return kc((Ye+e)/2)}function lM(e,t){var r=se(e),n=e===t?ae(e):ds(r/se(t))/ds(Qm(t)/Qm(e)),o=r*Rm(Qm(e),n)/n;if(!n)return Uc;function i(a,s){o>0?s<-Ye+ce&&(s=-Ye+ce):s>Ye-ce&&(s=Ye-ce);var c=o/Rm(Qm(s),n);return[c*ae(n*a),o-c*se(n*a)]}return i.invert=function(a,s){var c=o-s,f=Or(n)*st(a*a+c*c),u=br(a,ve(c))*Or(c);return c*n<0&&(u-=ye*Or(a)*Or(c)),[u/n,2*Dn(Rm(o/f,1/n))-Ye]},i}function $0(){return jc(lM).scale(109.5).parallels([30,30])}function Bc(e,t){return[e,t]}Bc.invert=Bc;function D0(){return yr(Bc).scale(152.63)}function pM(e,t){var r=se(e),n=e===t?ae(e):(r-se(t))/(t-e),o=r/n+e;if(ve(n)2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Gt(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Zf(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 Qf=Symbol("implicit");function gs(){var e=new Dr,t=[],r=[],n=Qf;function o(i){let a=e.get(i);if(a===void 0){if(n!==Qf)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 Dr;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 gs(t,r).unknown(n)},Gt.apply(o,arguments),o}function wa(){var e=gs().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,i,a,s=!1,c=0,f=0,u=.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 Y4(e,t,r){var n=e[0],o=e[1],i=t[0],a=t[1];return o2?W4:Y4,c=f=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((f||(f=s(t,e.map(n),mt)))(l)))},p.domain=function(l){return arguments.length?(e=Array.from(l,Gc),u()):e.slice()},p.range=function(l){return arguments.length?(t=Array.from(l),u()):t.slice()},p.rangeRound=function(l){return t=Array.from(l),r=fs,u()},p.clamp=function(l){return arguments.length?(a=l?!0:Qr,u()):a!==Qr},p.interpolate=function(l){return arguments.length?(r=l,u()):r},p.unknown=function(l){return arguments.length?(i=l,p):i},function(l,m){return n=l,o=m,u()}}function Jf(){return bs()(Qr,Qr)}function Q0(e,t,r,n){var o=wc(e,t,r),i;switch(n=Go(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=o0(o,a))&&(n.precision=i),Cm(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=i0(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=n0(o))&&(n.precision=i-(n.type==="%")*2);break}}return $n(n)}function Ri(e){var t=e.domain;return e.ticks=function(r){var n=t();return uo(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return Q0(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,f,u=10;for(s0;){if(f=rs(a,s,r),f===c)return n[o]=a,n[i]=s,t(n);if(f>0)a=Math.floor(a/f)*f,s=Math.ceil(s/f)*f;else if(f<0)a=Math.ceil(a*f)/f,s=Math.floor(s*f)/f;else break;c=f}return e},e}function ys(){var e=Jf();return e.copy=function(){return Wo(e,ys())},Gt.apply(e,arguments),Ri(e)}function el(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,Gc),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return el(e).unknown(t)},e=arguments.length?Array.from(e,Gc):[0,1],Ri(r)}function tl(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 e7(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 bM(e){return(t,r)=>-e(-t,r)}function J0(e){let t=e(hM,gM),r=t.domain,n=10,o,i;function a(){return o=e7(n),i=J4(n),r()[0]<0?(o=bM(o),i=bM(i),e(X4,Z4)):e(hM,gM),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(),f=c[0],u=c[c.length-1],p=u0){for(;l<=m;++l)for(h=1;hu)break;x.push(y)}}else for(;l<=m;++l)for(h=n-1;h>=1;--h)if(y=l>0?h/i(-l):h*i(l),!(yu)break;x.push(y)}x.length*2{if(s==null&&(s=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Go(c)).precision==null&&(c.trim=!0),c=$n(c)),s===1/0)return c;let f=Math.max(1,n*s/t.ticks().length);return u=>{let p=u/i(Math.round(o(u)));return p*nr(tl(r(),{floor:s=>i(Math.floor(o(s))),ceil:s=>i(Math.ceil(o(s)))})),t}function rl(){let e=J0(bs()).domain([1,10]);return e.copy=()=>Wo(e,rl()).base(e.base()),Gt.apply(e,arguments),e}function yM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function xM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ex(e){var t=1,r=e(yM(t),xM(t));return r.constant=function(n){return arguments.length?e(yM(t=+n),xM(t)):t},Ri(r)}function nl(){var e=ex(bs());return e.copy=function(){return Wo(e,nl()).constant(e.constant())},Gt.apply(e,arguments)}function wM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function t7(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function r7(e){return e<0?-e*e:e*e}function tx(e){var t=e(Qr,Qr),r=1;function n(){return r===1?e(Qr,Qr):r===.5?e(t7,r7):e(wM(r),wM(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},Ri(t)}function ol(){var e=tx(bs());return e.copy=function(){return Wo(e,ol()).exponent(e.exponent())},Gt.apply(e,arguments),e}function il(){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 f;do c.push(f=new Date(+i)),t(i,s),e(i);while(fnt(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)=>(rx.setTime(+i),nx.setTime(+a),e(rx),e(nx),Math.floor(r(rx,nx))),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 sl=nt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);sl.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?nt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):sl);var she=sl.range;var ar=nt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),SM=ar.range;var Ei=nt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),n7=Ei.range,Ai=nt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),o7=Ai.range;var Fi=nt(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()),i7=Fi.range,$i=nt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),a7=$i.range;var Ln=nt(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),s7=Ln.range,Ss=nt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),c7=Ss.range,vs=nt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),u7=vs.range;function Is(e){return nt(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 bn=Is(0),Sa=Is(1),ed=Is(2),td=Is(3),Zo=Is(4),rd=Is(5),nd=Is(6),IM=bn.range,f7=Sa.range,l7=ed.range,p7=td.range,m7=Zo.range,d7=rd.range,h7=nd.range;function _s(e){return nt(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 yn=_s(0),va=_s(1),od=_s(2),id=_s(3),Qo=_s(4),ad=_s(5),sd=_s(6),_M=yn.range,g7=va.range,b7=od.range,y7=id.range,x7=Qo.range,w7=ad.range,S7=sd.range;var Di=nt(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()),v7=Di.range,Li=nt(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()),I7=Li.range;var Cr=nt(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());Cr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:nt(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 _7=Cr.range,kr=nt(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());kr.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:nt(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 P7=kr.range;function MM(e,t,r,n,o,i){let a=[[ar,1,1e3],[ar,5,5*1e3],[ar,15,15*1e3],[ar,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(f,u,p){let l=ub).right(a,l);if(m===a.length)return e.every(wc(f/31536e6,u/31536e6,p));if(m===0)return sl.every(Math.max(wc(f,u,p),1));let[h,y]=a[l/a[m-1][2]53)return null;"w"in R||(R.w=1),"Z"in R?(X=cx(fl(R.y,0,1)),le=X.getUTCDay(),X=le>4||le===0?va.ceil(X):va(X),X=Ss.offset(X,(R.V-1)*7),R.y=X.getUTCFullYear(),R.m=X.getUTCMonth(),R.d=X.getUTCDate()+(R.w+6)%7):(X=sx(fl(R.y,0,1)),le=X.getDay(),X=le>4||le===0?Sa.ceil(X):Sa(X),X=Ln.offset(X,(R.V-1)*7),R.y=X.getFullYear(),R.m=X.getMonth(),R.d=X.getDate()+(R.w+6)%7)}else("W"in R||"U"in R)&&("w"in R||(R.w="u"in R?R.u%7:"W"in R?1:0),le="Z"in R?cx(fl(R.y,0,1)).getUTCDay():sx(fl(R.y,0,1)).getDay(),R.m=0,R.d="W"in R?(R.w+6)%7+R.W*7-(le+5)%7:R.w+R.U*7-(le+6)%7);return"Z"in R?(R.H+=R.Z/100|0,R.M+=R.Z%100,cx(R)):sx(R)}}function O(P,A,z,R){for(var Q=0,X=A.length,le=z.length,xe,Me;Q=le)return-1;if(xe=A.charCodeAt(Q++),xe===37){if(xe=A.charAt(Q++),Me=_[xe in TM?A.charAt(Q++):xe],!Me||(R=Me(P,z,R))<0)return-1}else if(xe!=z.charCodeAt(R++))return-1}return R}function M(P,A,z){var R=f.exec(A.slice(z));return R?(P.p=u.get(R[0].toLowerCase()),z+R[0].length):-1}function E(P,A,z){var R=m.exec(A.slice(z));return R?(P.w=h.get(R[0].toLowerCase()),z+R[0].length):-1}function C(P,A,z){var R=p.exec(A.slice(z));return R?(P.w=l.get(R[0].toLowerCase()),z+R[0].length):-1}function N(P,A,z){var R=x.exec(A.slice(z));return R?(P.m=g.get(R[0].toLowerCase()),z+R[0].length):-1}function K(P,A,z){var R=y.exec(A.slice(z));return R?(P.m=b.get(R[0].toLowerCase()),z+R[0].length):-1}function F(P,A,z){return O(P,t,A,z)}function T(P,A,z){return O(P,r,A,z)}function V(P,A,z){return O(P,n,A,z)}function D(P){return a[P.getDay()]}function H(P){return i[P.getDay()]}function G(P){return c[P.getMonth()]}function Y(P){return s[P.getMonth()]}function W(P){return o[+(P.getHours()>=12)]}function Z(P){return 1+~~(P.getMonth()/3)}function q(P){return a[P.getUTCDay()]}function ie(P){return i[P.getUTCDay()]}function ee(P){return c[P.getUTCMonth()]}function oe(P){return s[P.getUTCMonth()]}function re(P){return o[+(P.getUTCHours()>=12)]}function L(P){return 1+~~(P.getUTCMonth()/3)}return{format:function(P){var A=v(P+="",S);return A.toString=function(){return P},A},parse:function(P){var A=I(P+="",!1);return A.toString=function(){return P},A},utcFormat:function(P){var A=v(P+="",w);return A.toString=function(){return P},A},utcParse:function(P){var A=I(P+="",!0);return A.toString=function(){return P},A}}}var TM={"-":"",_:" ",0:"0"},sr=/^\s*\d+/,T7=/^%/,O7=/[\\^$*+?|[\]().{}]/g;function ze(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",i=o.length;return n+(i[t.toLowerCase(),r]))}function k7(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function N7(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function R7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function E7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function A7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function OM(e,t,r){var n=sr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function CM(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function F7(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 $7(e,t,r){var n=sr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function D7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function kM(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function L7(e,t,r){var n=sr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function NM(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function V7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function z7(e,t,r){var n=sr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function j7(e,t,r){var n=sr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function U7(e,t,r){var n=sr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function B7(e,t,r){var n=T7.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function G7(e,t,r){var n=sr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function K7(e,t,r){var n=sr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function RM(e,t){return ze(e.getDate(),t,2)}function q7(e,t){return ze(e.getHours(),t,2)}function H7(e,t){return ze(e.getHours()%12||12,t,2)}function Y7(e,t){return ze(1+Ln.count(Cr(e),e),t,3)}function DM(e,t){return ze(e.getMilliseconds(),t,3)}function W7(e,t){return DM(e,t)+"000"}function X7(e,t){return ze(e.getMonth()+1,t,2)}function Z7(e,t){return ze(e.getMinutes(),t,2)}function Q7(e,t){return ze(e.getSeconds(),t,2)}function J7(e){var t=e.getDay();return t===0?7:t}function eF(e,t){return ze(bn.count(Cr(e)-1,e),t,2)}function LM(e){var t=e.getDay();return t>=4||t===0?Zo(e):Zo.ceil(e)}function tF(e,t){return e=LM(e),ze(Zo.count(Cr(e),e)+(Cr(e).getDay()===4),t,2)}function rF(e){return e.getDay()}function nF(e,t){return ze(Sa.count(Cr(e)-1,e),t,2)}function oF(e,t){return ze(e.getFullYear()%100,t,2)}function iF(e,t){return e=LM(e),ze(e.getFullYear()%100,t,2)}function aF(e,t){return ze(e.getFullYear()%1e4,t,4)}function sF(e,t){var r=e.getDay();return e=r>=4||r===0?Zo(e):Zo.ceil(e),ze(e.getFullYear()%1e4,t,4)}function cF(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ze(t/60|0,"0",2)+ze(t%60,"0",2)}function EM(e,t){return ze(e.getUTCDate(),t,2)}function uF(e,t){return ze(e.getUTCHours(),t,2)}function fF(e,t){return ze(e.getUTCHours()%12||12,t,2)}function lF(e,t){return ze(1+Ss.count(kr(e),e),t,3)}function VM(e,t){return ze(e.getUTCMilliseconds(),t,3)}function pF(e,t){return VM(e,t)+"000"}function mF(e,t){return ze(e.getUTCMonth()+1,t,2)}function dF(e,t){return ze(e.getUTCMinutes(),t,2)}function hF(e,t){return ze(e.getUTCSeconds(),t,2)}function gF(e){var t=e.getUTCDay();return t===0?7:t}function bF(e,t){return ze(yn.count(kr(e)-1,e),t,2)}function zM(e){var t=e.getUTCDay();return t>=4||t===0?Qo(e):Qo.ceil(e)}function yF(e,t){return e=zM(e),ze(Qo.count(kr(e),e)+(kr(e).getUTCDay()===4),t,2)}function xF(e){return e.getUTCDay()}function wF(e,t){return ze(va.count(kr(e)-1,e),t,2)}function SF(e,t){return ze(e.getUTCFullYear()%100,t,2)}function vF(e,t){return e=zM(e),ze(e.getUTCFullYear()%100,t,2)}function IF(e,t){return ze(e.getUTCFullYear()%1e4,t,4)}function _F(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Qo(e):Qo.ceil(e),ze(e.getUTCFullYear()%1e4,t,4)}function PF(){return"+0000"}function AM(){return"%"}function FM(e){return+e}function $M(e){return Math.floor(+e/1e3)}var Kc,qc,jM,Jo,UM;fx({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 fx(e){return Kc=ux(e),qc=Kc.format,jM=Kc.parse,Jo=Kc.utcFormat,UM=Kc.utcParse,Kc}function MF(e){return new Date(e)}function TF(e){return e instanceof Date?+e:+new Date(+e)}function cd(e,t,r,n,o,i,a,s,c,f){var u=Jf(),p=u.invert,l=u.domain,m=f(".%L"),h=f(":%S"),y=f("%I:%M"),b=f("%I %p"),x=f("%a %d"),g=f("%b %d"),S=f("%B"),w=f("%Y");function _(v){return(c(v)jy(e[e.length-1]);var hd=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(J),gd=ue(hd);var bd=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(J),yd=ue(bd);var xd=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(J),wd=ue(xd);var Sd=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(J),vd=ue(Sd);var hl=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(J),Hc=ue(hl);var Id=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(J),_d=ue(Id);var gl=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(J),Yc=ue(gl);var Pd=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(J),Md=ue(Pd);var Td=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(J),Od=ue(Td);var Cd=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(J),kd=ue(Cd);var Nd=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(J),Rd=ue(Nd);var Ed=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(J),Ad=ue(Ed);var Fd=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(J),$d=ue(Fd);var Dd=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(J),Ld=ue(Dd);var Vd=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(J),zd=ue(Vd);var jd=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(J),Ud=ue(jd);var Bd=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(J),Gd=ue(Bd);var Kd=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(J),qd=ue(Kd);var Hd=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(J),Yd=ue(Hd);var Wd=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(J),Xd=ue(Wd);var Zd=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(J),Qd=ue(Zd);var Jd=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(J),eh=ue(Jd);var th=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(J),rh=ue(th);var nh=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(J),oh=ue(nh);var ih=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(J),ah=ue(ih);var sh=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(J),ch=ue(sh);var uh=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(J),fh=ue(uh);function lh(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 ph=Tc(zr(300,.5,0),zr(-240,.5,1));var dh=Tc(zr(-100,.75,.35),zr(80,1.5,.8)),hh=Tc(zr(260,.75,.35),zr(80,1.5,.8)),mh=zr();function gh(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return mh.h=360*e-100,mh.s=1.5-1.5*t,mh.l=.8-.9*t,mh+""}var bh=An(),OF=Math.PI/3,CF=Math.PI*2/3;function yh(e){var t;return e=(.5-e)*Math.PI,bh.r=255*(t=Math.sin(e))*t,bh.g=255*(t=Math.sin(e+OF))*t,bh.b=255*(t=Math.sin(e+CF))*t,bh+""}function xh(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 wh(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var Sh=wh(J("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),vh=wh(J("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Ih=wh(J("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),_h=wh(J("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Kt(e){return function(){return e}}var vx=Math.cos;var Wc=Math.min,bl=Math.sin,je=Math.sqrt,Ix=1e-12,Ps=Math.PI,R0e=Ps/2,Xc=2*Ps;function Ph(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 ba(t)}var $0e=Array.prototype.slice;function Mh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function BM(e){this._context=e}BM.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 Vi(e){return new BM(e)}function Th(e){return e[0]}function Oh(e){return e[1]}function yl(e,t){var r=Kt(!0),n=null,o=Vi,i=null,a=Ph(s);e=typeof e=="function"?e:e===void 0?Th:Kt(e),t=typeof t=="function"?t:t===void 0?Oh:Kt(t);function s(c){var f,u=(c=Mh(c)).length,p,l=!1,m;for(n==null&&(i=o(m=a())),f=0;f<=u;++f)!(f=m;--h)s.point(S[h],w[h]);s.lineEnd(),s.areaEnd()}x&&(S[l]=+e(b,l,p),w[l]=+t(b,l,p),s.point(n?+n(b,l,p):S[l],r?+r(b,l,p):w[l]))}if(g)return s=null,g+""||null}function u(){return yl().defined(o).curve(a).context(i)}return f.x=function(p){return arguments.length?(e=typeof p=="function"?p:Kt(+p),n=null,f):e},f.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Kt(+p),f):e},f.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Kt(+p),f):n},f.y=function(p){return arguments.length?(t=typeof p=="function"?p:Kt(+p),r=null,f):t},f.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Kt(+p),f):t},f.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Kt(+p),f):r},f.lineX0=f.lineY0=function(){return u().x(e).y(t)},f.lineY1=function(){return u().x(e).y(r)},f.lineX1=function(){return u().x(n).y(t)},f.defined=function(p){return arguments.length?(o=typeof p=="function"?p:Kt(!!p),f):o},f.curve=function(p){return arguments.length?(a=p,i!=null&&(s=a(i)),f):a},f.context=function(p){return arguments.length?(p==null?i=s=null:s=a(i=p),f):i},f}var Ch=class{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function Px(e){return new Ch(e,!0)}function Mx(e){return new Ch(e,!1)}var kF=je(3),xl={draw(e,t){let r=je(t+Wc(t/28,.75))*.59436,n=r/2,o=n*kF;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-o,-n),e.lineTo(o,n),e.moveTo(-o,n),e.lineTo(o,-n)}};var zi={draw(e,t){let r=je(t/Ps);e.moveTo(r,0),e.arc(0,0,r,0,Xc)}};var wl={draw(e,t){let r=je(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var GM=je(1/3),NF=GM*2,Sl={draw(e,t){let r=je(t/NF),n=r*GM;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var vl={draw(e,t){let r=je(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var Il={draw(e,t){let r=je(t-Wc(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var _l={draw(e,t){let r=je(t),n=-r/2;e.rect(n,n,r,r)}};var Pl={draw(e,t){let r=je(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var RF=.8908130915292852,KM=bl(Ps/10)/bl(7*Ps/10),EF=bl(Xc/10)*KM,AF=-vx(Xc/10)*KM,Ml={draw(e,t){let r=je(t*RF),n=EF*r,o=AF*r;e.moveTo(0,-r),e.lineTo(n,o);for(let i=1;i<5;++i){let a=Xc*i/5,s=vx(a),c=bl(a);e.lineTo(c*r,-s*r),e.lineTo(s*n-c*o,c*n+s*o)}e.closePath()}};var Tx=je(3),Tl={draw(e,t){let r=-je(t/(Tx*3));e.moveTo(0,r*2),e.lineTo(-Tx*r,-r),e.lineTo(Tx*r,-r),e.closePath()}};var FF=je(3),Ol={draw(e,t){let r=je(t)*.6824,n=r/2,o=r*FF/2;e.moveTo(0,-r),e.lineTo(o,n),e.lineTo(-o,n),e.closePath()}};var Vn=-.5,zn=je(3)/2,Ox=1/je(12),$F=(Ox/2+1)*3,Cl={draw(e,t){let r=je(t/$F),n=r/2,o=r*Ox,i=n,a=r*Ox+r,s=-i,c=a;e.moveTo(n,o),e.lineTo(i,a),e.lineTo(s,c),e.lineTo(Vn*n-zn*o,zn*n+Vn*o),e.lineTo(Vn*i-zn*a,zn*i+Vn*a),e.lineTo(Vn*s-zn*c,zn*s+Vn*c),e.lineTo(Vn*n+zn*o,Vn*o-zn*n),e.lineTo(Vn*i+zn*a,Vn*a-zn*i),e.lineTo(Vn*s+zn*c,Vn*c-zn*s),e.closePath()}};var Zc={draw(e,t){let r=je(t-Wc(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var kh=[zi,wl,Sl,_l,Ml,Tl,Cl],Cx=[zi,Il,Zc,Ol,xl,Pl,vl];function jn(){}function Qc(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function kl(e){this._context=e}kl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function kx(e){return new kl(e)}function qM(e){this._context=e}qM.prototype={areaStart:jn,areaEnd:jn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Nx(e){return new qM(e)}function HM(e){this._context=e}HM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Qc(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Rx(e){return new HM(e)}function YM(e,t){this._basis=new kl(e),this._beta=t}YM.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)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 Ex=(function e(t){function r(n){return t===1?new kl(n):new YM(n,t)}return r.beta=function(n){return e(+n)},r})(.85);function Jc(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 Nh(e,t){this._context=e,this._k=(1-t)/6}Nh.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:Jc(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:Jc(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 Ax=(function e(t){function r(n){return new Nh(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Rh(e,t){this._context=e,this._k=(1-t)/6}Rh.prototype={areaStart:jn,areaEnd:jn,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:Jc(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 Fx=(function e(t){function r(n){return new Rh(n,t)}return r.tension=function(n){return e(+n)},r})(0);function Eh(e,t){this._context=e,this._k=(1-t)/6}Eh.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:Jc(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 $x=(function e(t){function r(n){return new Eh(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>Ix){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>Ix){var f=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*f+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*f+e._y1*e._l23_2a-r*e._l12_2a)/u}e._context.bezierCurveTo(n,o,i,a,e._x2,e._y2)}function WM(e,t){this._context=e,this._alpha=t}WM.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 Dx=(function e(t){function r(n){return t?new WM(n,t):new Nh(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function XM(e,t){this._context=e,this._alpha=t}XM.prototype={areaStart:jn,areaEnd:jn,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 Lx=(function e(t){function r(n){return t?new XM(n,t):new Rh(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function ZM(e,t){this._context=e,this._alpha=t}ZM.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 Vx=(function e(t){function r(n){return t?new ZM(n,t):new Eh(n,0)}return r.alpha=function(n){return e(+n)},r})(.5);function QM(e){this._context=e}QM.prototype={areaStart:jn,areaEnd:jn,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 zx(e){return new QM(e)}function JM(e){return e<0?-1:1}function eT(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(JM(i)+JM(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(s))||0}function tT(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function jx(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 Ah(e){this._context=e}Ah.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:jx(this,this._t0,tT(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,jx(this,tT(this,r=eT(this,e,t)),r);break;default:jx(this,this._t0,r=eT(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function rT(e){this._context=new nT(e)}(rT.prototype=Object.create(Ah.prototype)).point=function(e,t){Ah.prototype.point.call(this,t,e)};function nT(e){this._context=e}nT.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 Ux(e){return new Ah(e)}function Bx(e){return new rT(e)}function iT(e){this._context=e}iT.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=oT(e),o=oT(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 Kx(e){return new Fh(e,.5)}function qx(e){return new Fh(e,0)}function Hx(e){return new Fh(e,1)}function Ia(e,t,r){this.k=e,this.x=t,this.y=r}Ia.prototype={constructor:Ia,scale:function(e){return e===1?this:new Ia(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ia(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 Yx=new Ia(1,0,0);Wx.prototype=Ia.prototype;function Wx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Yx;return e.__zoom}function Un(e){return e!=null&&!Number.isNaN(e)}function Nr(e,t){return+Un(t)-+Un(e)||vt(e,t)}function Ms(e,t){return+Un(t)-+Un(e)||Rn(e,t)}function Rl(e){return e!=null&&`${e}`!=""}function Xx(e){return isFinite(e)?e:NaN}function Ts(e){return e>0&&isFinite(e)?e:NaN}function eu(e){return e<0&&isFinite(e)?e:NaN}function $h(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`${DF(e.getUTCFullYear(),4)}-${ji(e.getUTCMonth()+1,2)}-${ji(e.getUTCDate(),2)}${r||n||o||i?`T${ji(r,2)}:${ji(n,2)}${o||i?`:${ji(o,2)}${i?`.${ji(i,3)}`:""}`:""}Z`:""}`}function DF(e){return e<0?`-${ji(-e,6)}`:e>9999?`+${ji(e,6)}`:ji(e,4)}function ji(e,t){return`${e}`.padStart(t,"0")}var LF=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function El(e,t){return LF.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Ui(e){if(e==null)return;let t=e[0],r=e[e.length-1];return Rn(t,r)}var ru=1e3,Pa=ru*60,Ma=Pa*60,ti=Ma*24,ei=ti*7,Os=ti*30,_a=ti*365,Zx=[["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",ru],["5 seconds",5*ru],["15 seconds",15*ru],["30 seconds",30*ru],["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",ti],["2 days",2*ti],["week",ei],["2 weeks",2*ei],["month",Os],["3 months",3*Os],["6 months",6*Os],["year",_a],["2 years",2*_a],["5 years",5*_a],["10 years",10*_a],["20 years",20*_a],["50 years",50*_a],["100 years",100*_a]],Qx=new Map([["second",ru],["minute",Pa],["hour",Ma],["day",ti],["monday",ei],["tuesday",ei],["wednesday",ei],["thursday",ei],["friday",ei],["saturday",ei],["sunday",ei],["week",ei],["month",Os],["year",_a]]),sT=new Map([["second",ar],["minute",Ei],["hour",Fi],["day",Ln],["monday",Sa],["tuesday",ed],["wednesday",td],["thursday",Zo],["friday",rd],["saturday",nd],["sunday",bn],["week",bn],["month",Di],["year",Cr]]),Jx=new Map([["second",ar],["minute",Ai],["hour",$i],["day",vs],["monday",va],["tuesday",od],["wednesday",id],["thursday",Qo],["friday",ad],["saturday",sd],["sunday",yn],["week",yn],["month",Li],["year",kr]]),nu=Symbol("intervalDuration"),Lh=Symbol("intervalType");for(let[e,t]of sT)t[nu]=Qx.get(e),t[Lh]="time";for(let[e,t]of Jx)t[nu]=Qx.get(e),t[Lh]="utc";var Al=[["year",kr,"utc"],["month",Li,"utc"],["day",vs,"utc",6*Os],["hour",$i,"utc",3*ti],["minute",Ai,"utc",6*Ma],["second",ar,"utc",30*Pa]],Dh=[["year",Cr,"time"],["month",Di,"time"],["day",Ln,"time",6*Os],["hour",Fi,"time",3*ti],["minute",Ei,"time",6*Ma],["second",ar,"time",30*Pa]],VF=[Al[0],Dh[0],Al[1],Dh[1],Al[2],Dh[2],...Al.slice(3)];function cT(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=Jx.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 e1(e){return uT(cT(e),"time")}function Fl(e){return uT(cT(e),"utc")}function uT([e,t],r){let n=(r==="time"?sT:Jx).get(e);return t>1&&(n=n.every(t),n[nu]=Qx.get(e)*t,n[Lh]=r),n}function t1(e,t){if(!(t>1))return;let r=e[nu];if(!Zx.some(([,o])=>o===r)||r%ti===0&&tiMath.log(o)).center(Zx,Math.log(r*t))];return(e[Lh]==="time"?e1:Fl)(n)}function aT(e,t,r){let n=t==="time"?qc:Jo;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=zF(r);switch(e){case"millisecond":return tu(n(".%L"),n(":%M:%S"),o);case"second":return tu(n(":%S"),n("%-I:%M"),o);case"minute":return tu(n("%-I:%M"),n("%p"),o);case"hour":return tu(n("%-I %p"),n("%b %-d"),o);case"day":return tu(n("%-d"),n("%b"),o);case"month":return tu(n("%b"),n("%Y"),o);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function zF(e){return e==="left"||e==="right"?(t,r)=>` ${t} ${r}`:e==="top"?(t,r)=>`${r} ${t}`:(t,r)=>`${t} -${r}`}function LF(e){return e==="time"?Ah:e==="utc"?El:$F}function oM(e,t,r){let n=er(Wp(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return eM("millisecond","utc",r);for(let[o,i,a,s]of LF(e)){if(n>s||o==="hour"&&!n)break;if(t.every(c=>i.floor(c)>=c))return eM(o,a,r)}}function tu(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),c=o-Ui(i);return o!==c&&i[c]!==void 0&&s===t(i[c],c)?a:r(a,s)}}var e1=Object.getPrototypeOf(Uint8Array),VF=Object.prototype.toString;function go(e){return e instanceof Array||e instanceof e1}function sM(e){return e instanceof e1&&!jF(e)}function cM(e){return e?.prototype instanceof e1&&!UF(e)}function jF(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function UF(e){return e===BigInt64Array||e===BigUint64Array}var t1=Symbol("reindex");function dt(e,t,r){let n=typeof t;return n==="string"?TM(e)?r1(e.getChild(t),r):iM(e,n1(t),r):n==="function"?iM(e,t,r):n==="number"||t instanceof Date||n==="boolean"?We(e,bn(t),r):typeof t?.transform=="function"?Jx(t.transform(e),r):zF(Jx(t,r),e?.[t1])}function zF(e,t){return e!=null&&t?Lh(e,t):e}function iM(e,t,r){return We(e,cM(r)?(n,o)=>o1(t(n,o)):t,r)}function Jx(e,t){return t===void 0?ri(e):MM(e)?r1(e,t):e instanceof t?e:t.from(e,cM(t)&&!sM(e)?o1:void 0)}function r1(e,t){return e==null?e:(t===void 0||t===Array)&&qF(e.type)?i1(aM(e)):Jx(aM(e),t)}function aM(e){return e.nullCount?e.toJSON():e.toArray()}var ou=[null],n1=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},ei={transform:jr},nt={transform:e=>e};var uM=()=>1,fM=()=>!0,At=e=>e==null?e:`${e}`,Ft=e=>e==null?e:+e;var $h=e=>e?e[0]:void 0,Fl=e=>e?e[1]:void 0;var bn=e=>()=>e;function lM(e){let t=+`${e}`.slice(1)/100;return(r,n)=>En(r,t,n)}function ti(e){return sM(e)?e:We(e,o1,Float64Array)}function o1(e){return e==null?NaN:Number(e)}function i1(e){return We(e,a1)}function a1(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Rl(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Zr(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:uu(e)?[void 0,e]:[e,void 0]}function Ct(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function s1(e,t,r){if(e!=null)return Vr(e,t,r)}function Vr(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function zi(e){return TM(e)?e:ri(e)}function ri(e){if(e==null||go(e))return e;if(MM(e))return r1(e);if(pM(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function pM(e){switch(e?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function We(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function Ma(e,t=Array){return e instanceof t?e.slice():t.from(e)}function mM({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function c1({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Dh(e){return mM(e)||c1(e)||e.interval!==void 0}function yo(e){return e?.toString===VF}function iu(e){return yo(e)&&(e.type!==void 0||e.domain!==void 0)}function au(e){return yo(e)&&typeof e.transform!="function"}function Ca(e){return au(e)&&e.value===void 0&&e.channel===void 0}function dM(e,t,r,n=nt){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 bo(e,t){return e===void 0&&t===void 0?[$h,Fl]:[e,t]}function su({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=Zr(t)),e===void 0&&([e]=Zr(r)),e}function Oa(e){return go(e)?e.length:e?.numRows}function jr(e){let t=Oa(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):We(t,r=>e.at(r))}function hM(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Bn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function gM(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function cu(e){let t;return[{transform:()=>t,label:xo(e)},r=>t=r]}function Gn(e){return e==null?[e]:cu(e)}function xo(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function $l(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return Et(n)||Et(o)?We(n,(i,a)=>new Date((+n[a]+ +o[a])/2)):We(n,(i,a)=>(+n[a]+ +o[a])/2,Float64Array)},label:e.label}}function Dl(e,t){let r=u1(t?.interval,t?.type);return r?We(e,r):e}function u1(e,t){let r=Vh(e,t);return r&&(n=>zn(n)?r.floor(n):n)}function Vh(e,t){if(e!=null){if(typeof e=="number")return BF(e);if(typeof e=="string")return(t==="time"?Zx:Al)(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 BF(e){e=+e,0Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>ns(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)=>ns(Math.ceil(r/t),n/t).map(o=>o*t)}}function ni(e,t){if(e=Vh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function yM(e,t){if(e=ni(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function bM(e){return ka(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function ka(e){return typeof e?.range=="function"}function oi(e){return e===void 0||au(e)?e:{value:e}}function xM(e){return e==null?null:{transform:t=>dt(t,e,Float64Array),label:xo(e)}}function Qr(e){return e&&typeof e[Symbol.iterator]=="function"}function jh(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function f1(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function Et(e){for(let t of e)if(t!=null)return t instanceof Date}function wM(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Rl(t)}function SM(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function vM(e){for(let t of e)if(t!=null)return typeof t=="number"}function Uh(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var GF=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 uu(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)||GF.has(e))}function IM(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ir(e){return e==null||Cs(e)}function Cs(e){return/^\s*none\s*$/i.test(e)}function _M(e){return/^\s*round\s*$/i.test(e)}function zh(e,t){return s1(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Na(e="middle"){return zh(e,"frameAnchor")}function PM(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 KF(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 l1(e){return Qr(e)?KF(e):e}function Bh(e){return e===!0?e="frame":e===!1?e=null:!pM(e)&&e!=null&&(e=Vr(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function TM(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function MM(e){return e&&typeof e.toArray=="function"&&e.type}function qF(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Kn=Symbol("position"),xn=Symbol("color"),Os=Symbol("radius"),ks=Symbol("length"),Ns=Symbol("opacity"),fu=Symbol("symbol"),CM=Symbol("projection"),Xe=new Map([["x",Kn],["y",Kn],["fx",Kn],["fy",Kn],["r",Os],["color",xn],["opacity",Ns],["symbol",fu],["length",ks],["projection",CM]]);function OM(e){return e===Kn||e===CM}function kM(e){return e===Kn||e===Os||e===ks||e===Ns}var HF=Math.sqrt(3),YF=2/HF,WF={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*YF,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()}},p1=new Map([["asterisk",bl],["circle",Vi],["cross",xl],["diamond",wl],["diamond2",Sl],["hexagon",WF],["plus",vl],["square",Il],["square2",_l],["star",Pl],["times",Zc],["triangle",Tl],["triangle2",Ml],["wye",Cl]]);function m1(e){return e&&typeof e.draw=="function"}function NM(e){return m1(e)?!0:typeof e!="string"?!1:p1.has(e.toLowerCase())}function lu(e){if(e==null||m1(e))return e;let t=p1.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function RM(e){if(e==null||m1(e))return[void 0,e];if(typeof e=="string"){let t=p1.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function Rs({filter:e,sort:t,reverse:r,transform:n,initializer:o,...i}={},a){if(n===void 0&&(e!=null&&(n=EM(e)),t!=null&&!Ca(t)&&(n=d1(n,g1(t))),r&&(n=d1(n,AM))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||Ca(t))&&{sort:t},transform:d1(n,a)}}function Bi({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=EM(e)),t!=null&&!Ca(t)&&(n=h1(n,g1(t))),r&&(n=h1(n,AM))),{...o,...(t===null||Ca(t))&&{sort:t},initializer:h1(n,i)}}function d1(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,zi(r),n,o)}}function h1(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 XF(e,t){return(e.initializer!=null?Bi:Rs)(e,t)}function EM(e){return(t,r)=>{let n=dt(t,e);return{data:t,facets:r.map(o=>o.filter(i=>n[i]))}}}function AM(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function FM(e,{sort:t,...r}={}){return{...(au(e)&&e.channel!==void 0?Bi:XF)(r,g1(e)),sort:Ca(t)?t:null}}function g1(e){return(typeof e=="function"&&e.length!==1?ZF:QF)(e)}function ZF(e){return(t,r)=>{let n=go(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 QF(e){let t,r;({channel:t,value:e,order:r}={...oi(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Ps:Cr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Cr;break;case"descending":r=Ps;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=dt(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 Vl(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function LM(e,t,r=y1){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",n9]),t.href!=null&&e.href===void 0&&n.push(["href",Gh]),n.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?JF(o):r(o,i,t))}function y1(e,t,r,n=b1){let o;yo(t)&&"reduce"in t&&(o=t.scale,t=t.reduce);let i=n(e,t,r),[a,s]=cu(i.label),c;return{name:e,output:o===void 0?a:{value:a,scale:o},initialize(u){i.initialize(u),c=s([])},scope(u,f){i.scope(u,f)},reduce(u,f){c.push(i.reduce(u,f))}}}function JF(e){return{name:e,initialize(){},scope(){},reduce(){}}}function b1(e,t,r,n=jl){let o=gM(e,r),i=n(t,o),a,s;return{label:xo(i===Ll?null:o,i.label),initialize(c){a=o===void 0?c:dt(c,o),i.scope==="data"&&(s=i.reduceIndex(jr(c),a))},scope(c,u){i.scope===c&&(s=i.reduceIndex(u,a))},reduce(c,u){return i.scope==null?i.reduceIndex(c,a,u):i.reduceIndex(c,a,s,u)}}}function x1(e,t){return t?Fo(e,r=>t[r]):[[,e]]}function jl(e,t,r=e9){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&yo(e))return t9(e);if(typeof e=="function")return r9(e);if(/^p\d{2}$/i.test(e))return Gi(lM(e));switch(`${e}`.toLowerCase()){case"first":return Gh;case"last":return o9;case"identity":return w1;case"count":return Ll;case"distinct":return i9;case"sum":return t==null?Ll:a9;case"proportion":return DM(t,"data");case"proportion-facet":return DM(t,"facet");case"deviation":return Gi(bc);case"min":return Gi(Fr);case"min-index":return Gi(Gp);case"max":return Gi(er);case"max-index":return Gi(Bp);case"mean":return $M(Hp);case"median":return $M(rs);case"variance":return Gi(yc);case"mode":return Gi(Yp)}return r(e)}function e9(e){throw new Error(`invalid reduce: ${e}`)}function VM(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(o=>o.name===r))return n}}function jM(e,t,r){if(t){let n=t.output.transform(),o=(i,a)=>Cr(n[i],n[a]);e.forEach(i=>i.sort(o))}r&&e.forEach(n=>n.reverse())}function t9(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function r9(e){return{reduceIndex(t,r,n){return e(Lh(r,t),n)}}}function Gi(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function $M(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return Et(r)?new Date(n):n}}}var w1={reduceIndex(e,t){return Lh(t,e)}},Gh={reduceIndex(e,t){return t[e[0]]}},n9={reduceIndex(e,t){let n=_i(co(e,i=>i.length,i=>t[i]),Fl),o=n.slice(-5).reverse();if(o.length`${i} (${a.toLocaleString("en-US")})`).join(` -`)}},o9={reduceIndex(e,t){return t[e[e.length-1]]}},Ll={label:"Frequency",reduceIndex(e){return e.length}},i9={label:"Distinct",reduceIndex(e,t){let r=new so;for(let n of e)r.add(t[n]);return r.size}},a9=Gi(dn);function DM(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>dn(r,i=>n[i])/o}}var UM={reduceIndex(e,t,{z:r}){return r}};function pu(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=xo(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),v1(s,{scale:t,type:r,value:dt(e,n),label:a,filter:o,hint:i})}function BM(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,pu(t,n,r)]))}function GM(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:o,value:i}])=>{let a=o==null?null:t[o];return[n,a==null?i:We(i,a)]}));return r.channels=e,r}function v1(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&&Uh(n,uu)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&Uh(n,IM)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&Uh(n,NM)?(t.scale=null,t.value=We(n,lu)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=Xe.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Xe.has(r))throw new Error(`unknown scale: ${r}`);return t}function KM(e,t,r,n,o){let{order:i,reverse:a,reduce:s=!0,limit:c}=o;for(let u in o){if(!Xe.has(u))continue;let{value:f,order:p=i,reverse:l=a,reduce:m=s,limit:h=c}=oi(o[u]),b=f?.startsWith("-");if(b&&(f=f.slice(1)),p=p===void 0?b!==(f==="width"||f==="height")?HM:qM:u9(p),m==null||m===!1)continue;let y=u==="fx"||u==="fy"?c9(t,n[u]):s9(r,u);if(!y)throw new Error(`missing channel for scale: ${u}`);let x=y.value,[g=0,S=1/0]=Qr(h)?h:h<0?[h]:[0,h];if(f==null)y.domain=()=>{let w=Array.from(new so(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"?zM(r,"y1","y2"):f==="width"?zM(r,"x1","x2"):S1(r,f,f==="y"?"y2":f==="x"?"x2":void 0),_=jl(m===!0?"max":m,w);y.domain=()=>{let v=yb(jr(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($h)}}}}function s9(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function c9(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 S1(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 u9(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return qM;case"descending":return HM}throw new Error(`invalid order: ${e}`)}function qM([e,t],[r,n]){return Cr(t,n)||Cr(e,r)}function HM([e,t],[r,n]){return Ps(t,n)||Cr(e,r)}function I1(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var QM=new Map([["accent",ux],["category10",cx],["dark2",fx],["observable10",lx],["paired",px],["pastel1",mx],["pastel2",dx],["set1",hx],["set2",gx],["set3",yx],["tableau10",bx]]);function JM(e){return e!=null&&QM.has(`${e}`.toLowerCase())}var YM=new Map([...QM,["brbg",Ki(pd,md)],["prgn",Ki(dd,hd)],["piyg",Ki(gd,yd)],["puor",Ki(bd,xd)],["rdbu",Ki(dl,Hc)],["rdgy",Ki(wd,Sd)],["rdylbu",Ki(hl,Yc)],["rdylgn",Ki(vd,Id)],["spectral",Ki(_d,Pd)],["burd",WM(dl,Hc)],["buylrd",WM(hl,Yc)],["blues",ar(Xd,Zd)],["greens",ar(Qd,Jd)],["greys",ar(eh,th)],["oranges",ar(ah,sh)],["purples",ar(rh,nh)],["reds",ar(oh,ih)],["turbo",qi(gh)],["viridis",qi(bh)],["magma",qi(xh)],["inferno",qi(wh)],["plasma",qi(Sh)],["cividis",qi(ch)],["cubehelix",qi(uh)],["warm",qi(lh)],["cool",qi(ph)],["bugn",ar(Td,Md)],["bupu",ar(Cd,Od)],["gnbu",ar(kd,Nd)],["orrd",ar(Rd,Ed)],["pubu",ar($d,Dd)],["pubugn",ar(Ad,Fd)],["purd",ar(Ld,Vd)],["rdpu",ar(jd,Ud)],["ylgn",ar(Gd,Kd)],["ylgnbu",ar(zd,Bd)],["ylorbr",ar(qd,Hd)],["ylorrd",ar(Yd,Wd)],["rainbow",XM(mh)],["sinebow",XM(hh)]]);function ar(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?_r(t,r):e[r])}function Ki(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?_r(t,r):e[r])}function WM(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?_r(n=>t(1-n),r):e[r].slice().reverse())}function qi(e){return({length:t})=>_r(e,Math.max(2,Math.floor(t)))}function XM(e){return({length:t})=>_r(e,Math.floor(t)+1).slice(0,-1)}function _1(e){let t=`${e}`.toLowerCase();if(!YM.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return YM.get(t)}function Ul(e,t){let r=_1(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function eC(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 ZM=new Map([["brbg",md],["prgn",hd],["piyg",yd],["puor",xd],["rdbu",Hc],["rdgy",Sd],["rdylbu",Yc],["rdylgn",Id],["spectral",Pd],["burd",e=>Hc(1-e)],["buylrd",e=>Yc(1-e)],["blues",Zd],["greens",Jd],["greys",th],["purples",nh],["reds",ih],["oranges",sh],["turbo",gh],["viridis",bh],["magma",xh],["inferno",wh],["plasma",Sh],["cividis",ch],["cubehelix",uh],["warm",lh],["cool",ph],["bugn",Md],["bupu",Od],["gnbu",Nd],["orrd",Ed],["pubugn",Fd],["pubu",Dd],["purd",Vd],["rdpu",Ud],["ylgnbu",Bd],["ylgn",Kd],["ylorbr",Hd],["ylorrd",Wd],["rainbow",mh],["sinebow",hh]]);function mu(e){let t=`${e}`.toLowerCase();if(!ZM.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return ZM.get(t)}var f9=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function tC(e){return e!=null&&f9.has(`${e}`.toLowerCase())}var T1=e=>t=>e(1-t),P1=[0,1],rC=new Map([["number",mt],["rgb",Fn],["hsl",Gb],["hcl",Kb],["lab",lm]]);function M1(e){let t=`${e}`.toLowerCase();if(!rC.has(t))throw new Error(`unknown interpolator: ${t}`);return rC.get(t)}function hu(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=lC(e,r),unknown:c,round:u,scheme:f,interval:p,range:l=Xe.get(e)===Os?d9(r,s):Xe.get(e)===ks?h9(r,s):Xe.get(e)===Ns?P1:void 0,interpolate:m=Xe.get(e)===xn?f==null&&l!==void 0?Fn:mu(f!==void 0?f:n==="cyclical"?"rainbow":"turbo"):u?us:mt,reverse:h}){if(s=nC(s),p=ni(p,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof m!="function"&&(m=M1(m)),h=!!h,l!==void 0){let b=s.length,y=(l=nC(l)).length;if(b!==y){if(m.length===1)throw new Error("invalid piecewise interpolator");m=jo(m,l),l=void 0}}if(m.length===1?(h&&(m=T1(m),h=!1),l===void 0&&(l=Float64Array.from(s,(b,y)=>y/(s.length-1)),l.length===2&&(l=P1)),t.interpolate((l===P1?bn:zl)(m))):t.interpolate(m),a){let[b,y]=Yt(s);(b>0||y<0)&&(s=Ma(s),(Ui(s)||1)===Math.sign(b)?s[0]=0:s[s.length-1]=0)}return h&&(s=la(s)),t.domain(s).unknown(c),o&&(t.nice(l9(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 nC(e){return e=ri(e),e.length>=2?e:[e[0],e[0]]}function l9(e,t){return e===!0?void 0:typeof e=="number"?e:yM(e,t)}function oC(e,t,r){return hu(e,ys(),t,r)}function iC(e,t,r){return C1(e,t,{...r,exponent:.5})}function C1(e,t,{exponent:r=1,...n}){return hu(e,nl().exponent(r),t,{...n,type:"pow"})}function aC(e,t,{base:r=10,domain:n=g9(t),...o}){return hu(e,tl().base(r),t,{...o,domain:n})}function sC(e,t,{constant:r=1,...n}){return hu(e,rl().constant(r),t,n)}function cC(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=y9(t),unknown:s,interpolate:c,reverse:u}){return r===void 0&&(r=c!==void 0?_r(c,o):Xe.get(e)===xn?Ul(i,o):void 0),a.length>0&&(a=ol(a,r===void 0?{length:o}:r).quantiles()),Kh(e,t,{domain:a,range:r,reverse:u,unknown:s})}function uC(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=lC(e,t),unknown:a,interpolate:s,reverse:c}){let[u,f]=Yt(i),p;return r===void 0?(p=uo(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?_r(s,n):Xe.get(e)===xn?Ul(o,n):void 0):(p=_r(mt(u,f),n+1).slice(1,-1),u instanceof Date&&(p=p.map(l=>new Date(l)))),Ui(ri(i))<0&&p.reverse(),Kh(e,t,{domain:p,range:r,reverse:c,unknown:a})}function Kh(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?_r(i,r.length+1):Xe.get(e)===xn?Ul(o,r.length+1):void 0,reverse:s}){r=ri(r);let c=Ui(r);if(!isNaN(c)&&!p9(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=la(a)),{type:"threshold",scale:il(c<0?la(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function p9(e,t){for(let r=1,n=e.length,o=e[0];rt}}function du(e,t=Hx){return e.length?[Fr(e,({value:r})=>r===void 0?r:Fr(r,t)),er(e,({value:r})=>r===void 0?r:er(r,t))]:[0,1]}function lC(e,t){let r=Xe.get(e);return(r===Os||r===Ns||r===ks?m9:du)(t)}function m9(e){return[0,e.length?er(e,({value:t})=>t===void 0?t:er(t,Hx)):1]}function d9(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=En(e,.5,({value:a})=>a===void 0?NaN:En(a,.25,Ts)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/er(o);return i<1?o.map(a=>a*i):o}function h9(e,t){let r=rs(e,({value:i})=>i===void 0?NaN:rs(i,Math.abs)),n=t.map(i=>12*i/r),o=60/er(n);return o<1?n.map(i=>i*o):n}function g9(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return du(e,Ts);if(r<0)return du(e,eu)}return[1,10]}function y9(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function zl(e){return(t,r)=>n=>e(t+n*(r-t))}var O1=0,k1;function pC(){let e=O1;return O1=0,k1=void 0,e}function Jr(e){e!==k1&&(k1=e,console.warn(e),++O1)}function qh(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=du(n),unknown:c,pivot:u=0,scheme:f,range:p,symmetric:l=!0,interpolate:m=Xe.get(e)===xn?f==null&&p!==void 0?Fn:mu(f!==void 0?f:"rdbu"):mt,reverse:h}){u=+u,s=ri(s);let[b,y]=s;if(s.length>2&&Jr(`Warning: the diverging ${e} scale domain contains extra elements.`),Rn(b,y)<0&&([b,y]=[y,b],h=!h),b=Math.min(b,u),y=Math.max(y,u),typeof m!="function"&&(m=M1(m)),p!==void 0&&(m=m.length===1?zl(m)(...p):jo(m,p)),h&&(m=T1(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 mC(e,t,r){return qh(e,ml(),b9,t,r)}function dC(e,t,r){return N1(e,t,{...r,exponent:.5})}function N1(e,t,{exponent:r=1,...n}){return qh(e,ld().exponent(r=+r),S9(r),t,{...n,type:"diverging-pow"})}function hC(e,t,{base:r=10,pivot:n=1,domain:o=du(t,n<0?eu:Ts),...i}){return qh(e,ud().base(r=+r),x9,t,{domain:o,pivot:n,...i})}function gC(e,t,{constant:r=1,...n}){return qh(e,fd().constant(r=+r),v9(r),t,n)}var b9={apply(e){return e},invert(e){return e}},x9={apply:Math.log,invert:Math.exp},w9={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function S9(e){return e===.5?w9:{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 v9(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 yC(e,t,r,n){return hu(e,t,r,n)}function bC(e,t,r){return yC(e,ad(),t,r)}function xC(e,t,r){return yC(e,sd(),t,r)}var gu=Symbol("ordinal");function SC(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:c}){return o=ni(o,n),i===void 0&&(i=TC(r,o,e)),(n==="categorical"||n===gu)&&(n="ordinal"),s&&(i=la(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 vC(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...c}){n=ni(n,r),o===void 0&&(o=TC(t,n,e));let u;if(Xe.get(e)===fu)u=I9(t),i=i===void 0?_9(u):We(i,lu);else if(Xe.get(e)===xn&&(i===void 0&&(r==="ordinal"||r===gu)&&(i=eC(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=mu(a),p=i[0],l=i[1]-i[0];i=({length:m})=>_r(h=>f(p+l*h),m)}else i=_1(a);if(s===Zf)throw new Error(`implicit unknown on ${e} scale is not supported`);return SC(e,hs().unknown(s),t,{...c,type:r,domain:o,range:i,hint:u})}function IC(e,t,{align:r=.5,padding:n=.5,...o}){return PC(q0().align(r).padding(n),t,o,e)}function _C(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return PC(wa().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function PC(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=SC(n,e,t,r),e.round=o,e}function TC(e,t,r){let n=new so;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]=Yt(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&Xe.get(r)===Kn)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return _i(n,Cr)}function wC(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 I9(e){return{fill:wC(e,"fill"),stroke:wC(e,"stroke")}}function _9(e){return ir(e.fill)?Tx:Mh}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=M9(x,g,{round:Xe.get(x)===Kn?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:C=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?P9(g,w):_,w.transform=I,x==="x"||x==="fx"?(w.insetLeft=+N,w.insetRight=+R):(x==="y"||x==="fy")&&(w.insetTop=+P,w.insetBottom=+C),y[x]=w}}return y}function E1(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]=N9(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),c!=null&&(i.label=c)}return r}function NC(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?Yh(t):t;o&&MC(o,a),i&&CC(i,a);let s=o||i?A1(e,t):t;r&&MC(r,s),n&&CC(n,s)}function P9(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!ii(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function RC(e){return Math.sign(Ui(e.domain()))*Math.sign(Ui(e.range()))}function Yh(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 A1({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=Yh(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 MC(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)],ii(e)||(e.range=AC(e)),e.scale.range(e.range)}EC(e)}function CC(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],ii(e)?e.range.reverse():e.range=AC(e),e.scale.range(e.range)}EC(e)}function EC(e){e.round===void 0&&O9(e)&&T9(e)<=30&&e.scale.round(!0)}function T9({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 AC(e){let t=e.scale.domain().length+F1(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 M9(e,t=[],r={}){let n=C9(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&ii({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(Et)?Jr(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${yu(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 "${yu(n)}".`):o.some(wM)?Jr(`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 "${yu(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 "${yu(n)}".`):o.some(SM)&&Jr(`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 "${yu(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 "${yu(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=Hh(t,r,ti);break;case"identity":switch(Xe.get(e)){case Kn:r=Hh(t,r,ti);break;case fu:r=Hh(t,r,k9);break}break;case"utc":case"time":r=Hh(t,r,i1);break}switch(n){case"diverging":return mC(e,t,r);case"diverging-sqrt":return dC(e,t,r);case"diverging-pow":return N1(e,t,r);case"diverging-log":return hC(e,t,r);case"diverging-symlog":return gC(e,t,r);case"categorical":case"ordinal":case gu:return vC(e,t,r);case"cyclical":case"sequential":case"linear":return oC(e,t,r);case"sqrt":return iC(e,t,r);case"threshold":return Kh(e,t,r);case"quantile":return cC(e,t,r);case"quantize":return uC(e,t,r);case"pow":return C1(e,t,r);case"log":return aC(e,t,r);case"symlog":return sC(e,t,r);case"utc":return xC(e,t,r);case"time":return bC(e,t,r);case"point":return IC(e,t,r);case"band":return _C(e,t,r);case"identity":return fC(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function yu(e){return typeof e=="symbol"?e.description:e}function OC(e){return typeof e=="string"?`${e}`.toLowerCase():e}var kC={toString:()=>"projection"};function C9(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=OC(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=kC);for(let f of t){let p=OC(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===kC)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:f})=>f!==void 0))return;let c=Xe.get(e);if(c===Os)return"sqrt";if(c===Ns||c===ks)return"linear";if(c===fu)return"ordinal";let u=(n??o)?.length;if(u<2||u>2)return R1(c);if(n!==void 0){if(f1(n))return R1(c);if(Et(n))return"utc"}else{let f=t.map(({value:p})=>p).filter(p=>p!==void 0);if(f.some(f1))return R1(c);if(f.some(Et))return"utc"}if(c===xn){if(a!=null||tC(i))return"diverging";if(JM(i))return"categorical"}return"linear"}function R1(e){switch(e){case Kn:return"point";case xn:return gu;default:return"ordinal"}}function ii({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===gu}function F1({type:e}){return e==="threshold"}function O9({type:e}){return e==="point"||e==="band"}function wo(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,o=t.length;n{if(!Xe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function N9({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:Ma(r),...n!==void 0&&{range:Ma(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 DC(e,t){let{fx:r,fy:n}=Bl(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?Vp(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 LC(e,{x:t,y:r}){return t&&=j1(t),r&&=j1(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 Xh(e,{fx:t,fy:r}){let n=jr(e),o=t?.value,i=r?.value;return t&&r?co(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?co(n,a=>(a.fx=o[a[0]],a),a=>o[a]):co(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function VC(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 jC(e){let t=[],r=new Uint32Array(dn(e,n=>n.length));for(let n of e){let o=0;for(let i of e)n!==i&&(r.set(i,o),o+=i.length);t.push(r.slice(0,o))}return t}var R9=new Map([["top",$1],["right",V1],["bottom",D1],["left",L1],["top-left",Wh($1,L1)],["top-right",Wh($1,V1)],["bottom-left",Wh(D1,L1)],["bottom-right",Wh(D1,V1)],["top-empty",A9],["right-empty",D9],["bottom-empty",F9],["left-empty",$9],["empty",L9]]);function UC(e){if(e==null)return null;let t=R9.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var $C=new WeakMap;function j1(e){let t=$C.get(e);return t||$C.set(e,t=new Ar(We(e,(r,n)=>[r,n]))),t}function Ra(e,t){return j1(e).get(t)}function E9(e,t,r){return t=Bn(t),r=Bn(r),e.find(n=>Object.is(Bn(n.x),t)&&Object.is(Bn(n.y),r))}function Zh(e,t,r){return E9(e,t,r)?.empty}function $1(e,{y:t},{y:r}){return t?Ra(t,r)===0:!0}function D1(e,{y:t},{y:r}){return t?Ra(t,r)===t.length-1:!0}function L1(e,{x:t},{x:r}){return t?Ra(t,r)===0:!0}function V1(e,{x:t},{x:r}){return t?Ra(t,r)===t.length-1:!0}function A9(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,n);if(i>0)return Zh(e,r,t[i-1])}function F9(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,n);if(i0)return Zh(e,t[i-1],n)}function D9(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var zC=Math.PI,Hi=2*zC,U1=.618;function BC({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(yo(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}=z1(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=V9(u,l,h,f-m,p-b);let g=l+i,S=h+r,w;if(c!=null){let[[_,v],[I,T]]=Lc(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=Vc({point(R,C){this.stream.point(R*P+g,C*P+S)}})):Jr("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=g===0&&S===0?GC():Vc({point(_,v){this.stream.point(_+g,v+S)}}),{stream:_=>e.stream(w.stream(u(_)))}}function z1(e){switch(`${e}`.toLowerCase()){case"albers-usa":return So(T0,.7463,.4673);case"albers":return Jh(Kf,.7463,.4673);case"azimuthal-equal-area":return So(C0,4,4);case"azimuthal-equidistant":return So(k0,Hi,Hi);case"conic-conformal":return Jh(E0,Hi,Hi);case"conic-equal-area":return Jh(xa,6.1702,2.9781);case"conic-equidistant":return Jh(F0,7.312,3.6282);case"equal-earth":return So(D0,5.4133,2.6347);case"equirectangular":return So(A0,Hi,zC);case"gnomonic":return So(V0,3.4641,3.4641);case"identity":return{type:GC};case"reflect-y":return{type:j9};case"mercator":return So(N0,Hi,Hi);case"orthographic":return So(U0,2,2);case"stereographic":return So(B0,2,2);case"transverse-mercator":return So(K0,Hi,Hi);default:throw new Error(`unknown projection type: ${e}`)}}function V9(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 Ec(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 Jh(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 GC=bn({stream:e=>e}),j9=bn(Vc({point(e,t){this.stream.point(e,-t)}}));function KC(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:U1}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=z1(e);if(t)return t}return U1}}function YC(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)mo(a,i);return[n,o]}function WC({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Vc({point(r,n){this.stream.point(e(r),t(n))}})}function bu(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:Bh(r)}}function De(e,{document:t}){return $r(Ti(e).call(t.documentElement))}var eg=Symbol("unset");function tg(e){return(e.length===1?U9:z9)(e)}function U9(e){let t,r=eg;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function z9(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 B9=tg(e=>new Intl.NumberFormat(e)),OSe=tg((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),kSe=tg((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function G9(e="en-US"){let t=B9(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function K9(e){return Eh(e,"Invalid Date")}function q9(e="en-US"){let t=G9(e);return r=>(r instanceof Date?K9:typeof r=="number"?t:At)(r)}var ai=q9();var gr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,H9=0;function ZC(){return`plot-clip-${++H9}`}function QC(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:C="none",strokeOpacity:N,strokeWidth:G,strokeLinecap:D,strokeLinejoin:O,strokeMiterlimit:z,paintOrder:U}){P===null&&(s=null,c=null),C===null&&(u=null,p=null),ir(P)?!ir(C)&&(!ir(s)||I?.fill)&&(C="none"):ir(C)&&(!ir(u)||I?.stroke)&&(P="none");let[W,B]=Zr(s,P),[q,X]=Ct(c,R),[J,A]=Zr(u,C),[K,Y]=Ct(p,N),[ee,Z]=Ct(x);Cs(A)||(f===void 0&&(f=G),m===void 0&&(m=D),l===void 0&&(l=O),h===void 0&&!_M(l)&&(h=z),!Cs(B)&&w===void 0&&(w=U));let[ne,M]=Ct(f);return P!==null&&(e.fill=Ot(B,"currentColor"),e.fillOpacity=Gl(X,1)),C!==null&&(e.stroke=Ot(A,"none"),e.strokeWidth=Gl(M,1),e.strokeOpacity=Gl(Y,1),e.strokeLinejoin=Ot(l,"miter"),e.strokeLinecap=Ot(m,"butt"),e.strokeMiterlimit=Gl(h,4),e.strokeDasharray=Ot(b,"none"),e.strokeDashoffset=Ot(y,"0")),e.target=At(a),e.ariaLabel=At(T),e.ariaDescription=At(o),e.ariaHidden=At(i),e.opacity=Gl(Z,1),e.mixBlendMode=Ot(g,"normal"),e.imageFilter=Ot(S,"none"),e.paintOrder=Ot(w,"normal"),e.pointerEvents=Ot(_,"auto"),e.shapeRendering=Ot(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:W,scale:"auto",optional:!0},fillOpacity:{value:q,scale:"auto",optional:!0},stroke:{value:J,scale:"auto",optional:!0},strokeOpacity:{value:K,scale:"auto",optional:!0},strokeWidth:{value:ne,optional:!0},opacity:{value:ee,scale:"auto",optional:!0}}}function Y9(e,t){t&&e.filter(r=>Nl(t[r])).append("title").call(X9,t)}function W9(e,t){t&&e.filter(([r])=>Nl(t[r])).append("title").call(Z9,t)}function X9(e,t){t&&e.text(r=>ai(t[r]))}function Z9(e,t){t&&e.text(([r])=>ai(t[r]))}function yr(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&&JC(e,l=>p[l],t),r||Y9(e,o)}function rg(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&&JC(e,([l])=>p[l],t),r||W9(e,o)}function Q9({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 J9(e,t,r){let n=Fo(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&Jr("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*ng(e,t,r,n){let{z:o}=r,{z:i}=n,a=Q9(n,r),s=[...t,...a];for(let c of i?J9(e,i,o):[e]){let u,f;e:for(let p of c){for(let l of s)if(!zn(l[p])){f&&f.push(-1);continue e}if(u===void 0){f&&(yield f),u=a.map(l=>Bn(l[p])),f=[p];continue}f.push(p);for(let l=0;lBn(h[p])),f=[p];continue e}}f&&(yield f)}}function e$(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=De("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=r$(n,r)):i&&(o=o$(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 t$(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=ZC();$r(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var r$=t$((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)}),XC=new WeakMap,n$={type:"Sphere"};function o$(e,t){let r,n;if((r=XC.get(t))||XC.set(t,r=new WeakMap),e.type==="Sphere"&&(e=n$),!(n=r.get(e))){let o=ZC();$r(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function $t(e,t,r,n){e$(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 It(e,t){i$(e,"mix-blend-mode",t.mixBlendMode),de(e,"opacity",t.opacity)}function JC(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS($o.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS($o.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 i$(e,t,r){r!=null&&e.style(t,r)}function Dt(e,t,{x:r,y:n},o=gr,i=gr){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 Ot(e,t){if((e=At(e))!==t)return e}function Gl(e,t){if((e=Ft(e))!==t)return e}var a$=/^-?([_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 xu(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!a$.test(e))throw new Error(`invalid class name: ${e}`);return e}function wu(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 si({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 Ze=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=Ca(u)?u:null,this.initializer=Bi(n).initializer,this.transform=this.initializer?n.transform:Rs(n).transform,i===null||i===!1?this.facet=null:(this.facet=Vr(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=t===ou&&typeof s=="string"?[s]:s,this.fy=t===ou&&typeof c=="string"?[c]:c),this.facetAnchor=UC(a),r=l1(r),S!==void 0&&(r={...s$(S),...r}),o!==void 0&&(r={...QC(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([v,I])=>{if(au(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===ou&&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=Bh(g),this.tip=c$(w),this.className=At(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=G1(_,this.render))}initialize(t,r,n){let o=zi(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=zi(o)),t!==void 0&&(t.original=i);let a=BM(this.channels,o);return this.sort!=null&&KM(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=zn}=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"&&KC(o,i,r,n.projection)}}scale(t,r,n){let o=GM(t,r);return n.projection&&this.project(t,o,n),o}};function B1(...e){return e.plot=Ze.prototype.plot,e}function G1(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 s$(e){return Object.fromEntries(Object.entries(l1(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:oi(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function c$(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Vr(e,"tip",["x","y","xy"]):e}function Es(e,t){return e?.tip===!0?{...e,tip:t}:yo(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function tO(e,t,r={}){let n=.5-gr,o=.5+gr,i=.5+gr,a=.5-gr;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=u$(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 u$({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=HC(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?ii(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=eO("y",t)/(eO("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 eO(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]=Yt(n);return Math.abs(o(a)-o(i))}var rO=new WeakMap;function K1(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:G1(function(f,p,l,m,h,b){h={...h,pointerSticky:!1};let y=h.ownerSVGElement,{data:x}=h.getMarkState(this),g=rO.get(y);g||rO.set(y,g={sticky:!1,roots:[],renders:[]});let S=g.renders.push(A)-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,C;if(R){let Z=g.facetStates;Z||(g.facetStates=Z=new Map),C=Z.get(this),C||Z.set(this,C=new Map)}let[N,G]=si(this,m),{px:D,py:O}=l,z=D?Z=>D[Z]:H1(l,N),U=O?Z=>O[Z]:Y1(l,G),W,B,q,X;function J(Z,ne){if(R)if(X&&(X=cancelAnimationFrame(X)),Z==null)C.delete(f.fi);else{C.set(f.fi,ne),X=requestAnimationFrame(()=>{X=null;for(let[M,$]of C)if($1)){let $=W==null?null:go(x)?x[W]:x.get(W);h.dispatchValue($)}return M}function K(Z){if(g.sticky||Z.pointerType==="mouse"&&Z.buttons===1)return;let[ne,M]=ma(Z);ne-=T,M-=P;let $=nem.width-m.marginRight?1:e,H=Mm.height-m.marginBottom?1:t,E=null,re=a*a;for(let oe of f){let be=$*(z(oe)-ne),we=H*(U(oe)-M),Ve=be*be+we*we;Ve<=re&&(E=oe,re=Ve)}if(E!=null&&(e!==1||t!==1)){let oe=z(E)-ne,be=U(E)-M;re=oe*oe+be*be}J(E,re)}function Y(Z){Z.pointerType==="mouse"&&W!=null&&(g.sticky&&g.roots.some(ne=>ne?.contains(Z.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(ne=>ne(null))):(g.sticky=!0,A(W)),Z.stopImmediatePropagation()))}function ee(Z){Z.pointerType==="mouse"&&(g.sticky||J(null))}return y.addEventListener("pointerenter",K),y.addEventListener("pointermove",K),y.addEventListener("pointerdown",Y),y.addEventListener("pointerleave",ee),A(null)},c)}}function nO(e){return K1(1,1,e)}function oO(e){return K1(1,.01,e)}function q1(e){return K1(.01,1,e)}function H1({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function Y1({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function og(e){return ii(e)&&e.interval===void 0?void 0:"tabular-nums"}function iO(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=og(e),round:h=!0,opacity:b,className:y}=t,x=bu(t);y=xu(y),b=Ct(b)[1],l===null&&(l=()=>null);let g=De("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 jF(e){return e==="time"?Dh:e==="utc"?Al:VF}function fT(e,t,r){let n=nr(Qp(t,(o,i)=>Math.abs(i-o)));if(n<1e3)return aT("millisecond","utc",r);for(let[o,i,a,s]of jF(e)){if(n>s||o==="hour"&&!n)break;if(t.every(c=>i.floor(c)>=c))return aT(o,a,r)}}function tu(e,t,r){return(n,o,i)=>{let a=e(n,o),s=t(n,o),c=o-Ui(i);return o!==c&&i[c]!==void 0&&s===t(i[c],c)?a:r(a,s)}}var n1=Object.getPrototypeOf(Uint8Array),UF=Object.prototype.toString;function go(e){return e instanceof Array||e instanceof n1}function mT(e){return e instanceof n1&&!BF(e)}function dT(e){return e?.prototype instanceof n1&&!GF(e)}function BF(e){return e instanceof BigInt64Array||e instanceof BigUint64Array}function GF(e){return e===BigInt64Array||e===BigUint64Array}var o1=Symbol("reindex");function dt(e,t,r){let n=typeof t;return n==="string"?RT(e)?i1(e.getChild(t),r):lT(e,a1(t),r):n==="function"?lT(e,t,r):n==="number"||t instanceof Date||n==="boolean"?Xe(e,xn(t),r):typeof t?.transform=="function"?r1(t.transform(e),r):KF(r1(t,r),e?.[o1])}function KF(e,t){return e!=null&&t?jh(e,t):e}function lT(e,t,r){return Xe(e,dT(r)?(n,o)=>s1(t(n,o)):t,r)}function r1(e,t){return t===void 0?ni(e):ET(e)?i1(e,t):e instanceof t?e:t.from(e,dT(t)&&!mT(e)?s1:void 0)}function i1(e,t){return e==null?e:(t===void 0||t===Array)&&WF(e.type)?c1(pT(e)):r1(pT(e),t)}function pT(e){return e.nullCount?e.toJSON():e.toArray()}var ou=[null],a1=e=>t=>{let r=t[e];return r===void 0&&t.type==="Feature"?t.properties?.[e]:r},bo={transform:Br},Ze={transform:e=>e};var hT=()=>1,gT=()=>!0,Ft=e=>e==null?e:`${e}`,$t=e=>e==null?e:+e;var Vh=e=>e?e[0]:void 0,$l=e=>e?e[1]:void 0;var xn=e=>()=>e;function bT(e){let t=+`${e}`.slice(1)/100;return(r,n)=>En(r,t,n)}function ri(e){return mT(e)?e:Xe(e,s1,Float64Array)}function s1(e){return e==null?NaN:Number(e)}function c1(e){return Xe(e,u1)}function u1(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?El(e):e==null||isNaN(e=Number(e))?void 0:new Date(e)}function Jr(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:uu(e)?[void 0,e]:[e,void 0]}function Ct(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function f1(e,t,r){if(e!=null)return Ur(e,t,r)}function Ur(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Bi(e){return RT(e)?e:ni(e)}function ni(e){if(e==null||go(e))return e;if(ET(e))return i1(e);if(yT(e))switch(e.type){case"FeatureCollection":return e.features;case"GeometryCollection":return e.geometries;default:return[e]}return Array.from(e)}function yT(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 Xe(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function Ta(e,t=Array){return e instanceof t?e.slice():t.from(e)}function xT({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function l1({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function zh(e){return xT(e)||l1(e)||e.interval!==void 0}function yo(e){return e?.toString===UF}function iu(e){return yo(e)&&(e.type!==void 0||e.domain!==void 0)}function au(e){return yo(e)&&typeof e.transform!="function"}function Oa(e){return au(e)&&e.value===void 0&&e.channel===void 0}function wT(e,t,r,n=Ze){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 xo(e,t){return e===void 0&&t===void 0?[Vh,$l]:[e,t]}function su({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=Jr(t)),e===void 0&&([e]=Jr(r)),e}function Ca(e){return go(e)?e.length:e?.numRows}function Br(e){let t=Ca(e),r=new Uint32Array(t);for(let n=0;ne[r],e.constructor):Xe(t,r=>e.at(r))}function ST(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function Bn(e){return e!==null&&typeof e=="object"?e.valueOf():e}function vT(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function cu(e){let t;return[{transform:()=>t,label:wo(e)},r=>t=r]}function Gn(e){return e==null?[e]:cu(e)}function wo(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Dl(e,t){return{transform(r){let n=e.transform(r),o=t.transform(r);return At(n)||At(o)?Xe(n,(i,a)=>new Date((+n[a]+ +o[a])/2)):Xe(n,(i,a)=>(+n[a]+ +o[a])/2,Float64Array)},label:e.label}}function Ll(e,t){let r=p1(t?.interval,t?.type);return r?Xe(e,r):e}function p1(e,t){let r=Uh(e,t);return r&&(n=>Un(n)?r.floor(n):n)}function Uh(e,t){if(e!=null){if(typeof e=="number")return qF(e);if(typeof e=="string")return(t==="time"?e1:Fl)(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 qF(e){e=+e,0Math.floor(r*t)/t,offset:(r,n=1)=>(r*t+Math.floor(n))/t,range:(r,n)=>os(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)=>os(Math.ceil(r/t),n/t).map(o=>o*t)}}function oi(e,t){if(e=Uh(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function IT(e,t){if(e=oi(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function _T(e){return ka(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function ka(e){return typeof e?.range=="function"}function ii(e){return e===void 0||au(e)?e:{value:e}}function PT(e){return e==null?null:{transform:t=>dt(t,e,Float64Array),label:wo(e)}}function en(e){return e&&typeof e[Symbol.iterator]=="function"}function Bh(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function m1(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function At(e){for(let t of e)if(t!=null)return t instanceof Date}function MT(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&El(t)}function TT(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function OT(e){for(let t of e)if(t!=null)return typeof t=="number"}function Gh(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var HF=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 uu(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)||HF.has(e))}function CT(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function cr(e){return e==null||Cs(e)}function Cs(e){return/^\s*none\s*$/i.test(e)}function kT(e){return/^\s*round\s*$/i.test(e)}function Kh(e,t){return f1(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Na(e="middle"){return Kh(e,"frameAnchor")}function NT(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 YF(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 d1(e){return en(e)?YF(e):e}function qh(e){return e===!0?e="frame":e===!1?e=null:!yT(e)&&e!=null&&(e=Ur(e,"clip",["frame","sphere"]),e==="sphere"&&(e={type:"Sphere"})),e}function RT(e){return e&&typeof e.getChild=="function"&&typeof e.toArray=="function"&&e.schema&&Array.isArray(e.schema.fields)}function ET(e){return e&&typeof e.toArray=="function"&&e.type}function WF(e){return e&&(e.typeId===8||e.typeId===10)&&e.unit===1}var Kn=Symbol("position"),wn=Symbol("color"),ks=Symbol("radius"),Ns=Symbol("length"),Rs=Symbol("opacity"),fu=Symbol("symbol"),AT=Symbol("projection"),Qe=new Map([["x",Kn],["y",Kn],["fx",Kn],["fy",Kn],["r",ks],["color",wn],["opacity",Rs],["symbol",fu],["length",Ns],["projection",AT]]);function FT(e){return e===Kn||e===AT}function $T(e){return e===Kn||e===ks||e===Ns||e===Rs}var XF=Math.sqrt(3),ZF=2/XF,QF={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*ZF,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()}},h1=new Map([["asterisk",xl],["circle",zi],["cross",wl],["diamond",Sl],["diamond2",vl],["hexagon",QF],["plus",Il],["square",_l],["square2",Pl],["star",Ml],["times",Zc],["triangle",Tl],["triangle2",Ol],["wye",Cl]]);function g1(e){return e&&typeof e.draw=="function"}function DT(e){return g1(e)?!0:typeof e!="string"?!1:h1.has(e.toLowerCase())}function lu(e){if(e==null||g1(e))return e;let t=h1.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function LT(e){if(e==null||g1(e))return[void 0,e];if(typeof e=="string"){let t=h1.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function Es({filter:e,sort:t,reverse:r,transform:n,initializer:o,...i}={},a){if(n===void 0&&(e!=null&&(n=VT(e)),t!=null&&!Oa(t)&&(n=b1(n,x1(t))),r&&(n=b1(n,zT))),a!=null&&o!=null)throw new Error("transforms cannot be applied after initializers");return{...i,...(t===null||Oa(t))&&{sort:t},transform:b1(n,a)}}function Gi({filter:e,sort:t,reverse:r,initializer:n,...o}={},i){return n===void 0&&(e!=null&&(n=VT(e)),t!=null&&!Oa(t)&&(n=y1(n,x1(t))),r&&(n=y1(n,zT))),{...o,...(t===null||Oa(t))&&{sort:t},initializer:y1(n,i)}}function b1(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,Bi(r),n,o)}}function y1(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,f,u,p;return{data:s=r,facets:c=n,channels:a}=e.call(this,r,n,o,...i),{data:u=s,facets:p=c,channels:f}=t.call(this,s,c,{...o,...a},...i),{data:u,facets:p,channels:{...a,...f}}}}function JF(e,t){return(e.initializer!=null?Gi:Es)(e,t)}function VT(e){return(t,r)=>{let n=dt(t,e);return{data:t,facets:r.map(o=>o.filter(i=>n[i]))}}}function zT(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function jT(e,{sort:t,...r}={}){return{...(au(e)&&e.channel!==void 0?Gi:JF)(r,x1(e)),sort:Oa(t)?t:null}}function x1(e){return(typeof e=="function"&&e.length!==1?e$:t$)(e)}function e$(e){return(t,r)=>{let n=go(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 t$(e){let t,r;({channel:t,value:e,order:r}={...ii(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?Ms:Nr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Nr;break;case"descending":r=Ms;break;default:throw new Error(`invalid order: ${r}`)}return(o,i,a)=>{let s;if(t===void 0)s=dt(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=(f,u)=>r(s[f],s[u]);return{data:o,facets:i.map(f=>f.slice().sort(c))}}}function zl(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function GT(e,t,r=w1){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",a$]),t.href!=null&&e.href===void 0&&n.push(["href",Hh]),n.filter(([,o])=>o!==void 0).map(([o,i])=>i===null?r$(o):r(o,i,t))}function w1(e,t,r,n=S1){let o;yo(t)&&"reduce"in t&&(o=t.scale,t=t.reduce);let i=n(e,t,r),[a,s]=cu(i.label),c;return{name:e,output:o===void 0?a:{value:a,scale:o},initialize(f){i.initialize(f),c=s([])},scope(f,u){i.scope(f,u)},reduce(f,u){c.push(i.reduce(f,u))}}}function r$(e){return{name:e,initialize(){},scope(){},reduce(){}}}function S1(e,t,r,n=jl){let o=vT(e,r),i=n(t,o),a,s;return{label:wo(i===Vl?null:o,i.label),initialize(c){a=o===void 0?c:dt(c,o),i.scope==="data"&&(s=i.reduceIndex(Br(c),a))},scope(c,f){i.scope===c&&(s=i.reduceIndex(f,a))},reduce(c,f){return i.scope==null?i.reduceIndex(c,a,f):i.reduceIndex(c,a,s,f)}}}function v1(e,t){return t?Do(e,r=>t[r]):[[,e]]}function jl(e,t,r=n$){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&yo(e))return o$(e);if(typeof e=="function")return i$(e);if(/^p\d{2}$/i.test(e))return Ki(bT(e));switch(`${e}`.toLowerCase()){case"first":return Hh;case"last":return s$;case"identity":return I1;case"count":return Vl;case"distinct":return c$;case"sum":return t==null?Vl:u$;case"proportion":return BT(t,"data");case"proportion-facet":return BT(t,"facet");case"deviation":return Ki(yc);case"min":return Ki(Lr);case"min-index":return Ki(Hp);case"max":return Ki(nr);case"max-index":return Ki(qp);case"mean":return UT(Xp);case"median":return UT(ns);case"variance":return Ki(bc);case"mode":return Ki(Zp)}return r(e)}function n$(e){throw new Error(`invalid reduce: ${e}`)}function KT(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(o=>o.name===r))return n}}function qT(e,t,r){if(t){let n=t.output.transform(),o=(i,a)=>Nr(n[i],n[a]);e.forEach(i=>i.sort(o))}r&&e.forEach(n=>n.reverse())}function o$(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function i$(e){return{reduceIndex(t,r,n){return e(jh(r,t),n)}}}function Ki(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function UT(e){return{reduceIndex(t,r){let n=e(t,o=>r[o]);return At(r)?new Date(n):n}}}var I1={reduceIndex(e,t){return jh(t,e)}},Hh={reduceIndex(e,t){return t[e[0]]}},a$={reduceIndex(e,t){let n=Pi(co(e,i=>i.length,i=>t[i]),$l),o=n.slice(-5).reverse();if(o.length`${i} (${a.toLocaleString("en-US")})`).join(` +`)}},s$={reduceIndex(e,t){return t[e[e.length-1]]}},Vl={label:"Frequency",reduceIndex(e){return e.length}},c$={label:"Distinct",reduceIndex(e,t){let r=new so;for(let n of e)r.add(t[n]);return r.size}},u$=Ki(hn);function BT(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,o=1)=>r.length/o}:{scope:t,reduceIndex:(r,n,o=1)=>hn(r,i=>n[i])/o}}var HT={reduceIndex(e,t,{z:r}){return r}};function pu(e,{scale:t,type:r,value:n,filter:o,hint:i,label:a=wo(n)},s){return i===void 0&&typeof n?.transform=="function"&&(i=n.hint),P1(s,{scale:t,type:r,value:dt(e,n),label:a,filter:o,hint:i})}function WT(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,pu(t,n,r)]))}function XT(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:Xe(i,a)]}));return r.channels=e,r}function P1(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&&Gh(n,uu)?null:"color",t.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&Gh(n,CT)?null:"opacity",t.defaultScale="opacity";break;case"symbol":r!==!0&&Gh(n,DT)?(t.scale=null,t.value=Xe(n,lu)):t.scale="symbol",t.defaultScale="symbol";break;default:t.scale=Qe.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Qe.has(r))throw new Error(`unknown scale: ${r}`);return t}function ZT(e,t,r,n,o){let{order:i,reverse:a,reduce:s=!0,limit:c}=o;for(let f in o){if(!Qe.has(f))continue;let{value:u,order:p=i,reverse:l=a,reduce:m=s,limit:h=c}=ii(o[f]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),p=p===void 0?y!==(u==="width"||u==="height")?JT:QT:p$(p),m==null||m===!1)continue;let b=f==="fx"||f==="fy"?l$(t,n[f]):f$(r,f);if(!b)throw new Error(`missing channel for scale: ${f}`);let x=b.value,[g=0,S=1/0]=en(h)?h:h<0?[h]:[0,h];if(u==null)b.domain=()=>{let w=Array.from(new so(x));return l&&(w=w.reverse()),(g!==0||S!==1/0)&&(w=w.slice(g,S)),w};else{let w=u==="data"?e:u==="height"?YT(r,"y1","y2"):u==="width"?YT(r,"x1","x2"):_1(r,u,u==="y"?"y2":u==="x"?"x2":void 0),_=jl(m===!0?"max":m,w);b.domain=()=>{let v=wy(Br(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(Vh)}}}}function f$(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function l$(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 _1(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 p$(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return QT;case"descending":return JT}throw new Error(`invalid order: ${e}`)}function QT([e,t],[r,n]){return Nr(t,n)||Nr(e,r)}function JT([e,t],[r,n]){return Ms(t,n)||Nr(e,r)}function M1(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}var oO=new Map([["accent",px],["category10",lx],["dark2",mx],["observable10",dx],["paired",hx],["pastel1",gx],["pastel2",bx],["set1",yx],["set2",xx],["set3",wx],["tableau10",Sx]]);function iO(e){return e!=null&&oO.has(`${e}`.toLowerCase())}var eO=new Map([...oO,["brbg",qi(hd,gd)],["prgn",qi(bd,yd)],["piyg",qi(xd,wd)],["puor",qi(Sd,vd)],["rdbu",qi(hl,Hc)],["rdgy",qi(Id,_d)],["rdylbu",qi(gl,Yc)],["rdylgn",qi(Pd,Md)],["spectral",qi(Td,Od)],["burd",tO(hl,Hc)],["buylrd",tO(gl,Yc)],["blues",ur(Jd,eh)],["greens",ur(th,rh)],["greys",ur(nh,oh)],["oranges",ur(uh,fh)],["purples",ur(ih,ah)],["reds",ur(sh,ch)],["turbo",Hi(xh)],["viridis",Hi(Sh)],["magma",Hi(vh)],["inferno",Hi(Ih)],["plasma",Hi(_h)],["cividis",Hi(lh)],["cubehelix",Hi(ph)],["warm",Hi(dh)],["cool",Hi(hh)],["bugn",ur(Cd,kd)],["bupu",ur(Nd,Rd)],["gnbu",ur(Ed,Ad)],["orrd",ur(Fd,$d)],["pubu",ur(Vd,zd)],["pubugn",ur(Dd,Ld)],["purd",ur(jd,Ud)],["rdpu",ur(Bd,Gd)],["ylgn",ur(Hd,Yd)],["ylgnbu",ur(Kd,qd)],["ylorbr",ur(Wd,Xd)],["ylorrd",ur(Zd,Qd)],["rainbow",rO(gh)],["sinebow",rO(yh)]]);function ur(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?Tr(t,r):e[r])}function qi(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?Tr(t,r):e[r])}function tO(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?Tr(n=>t(1-n),r):e[r].slice().reverse())}function Hi(e){return({length:t})=>Tr(e,Math.max(2,Math.floor(t)))}function rO(e){return({length:t})=>Tr(e,Math.floor(t)+1).slice(0,-1)}function T1(e){let t=`${e}`.toLowerCase();if(!eO.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return eO.get(t)}function Ul(e,t){let r=T1(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function aO(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 nO=new Map([["brbg",gd],["prgn",yd],["piyg",wd],["puor",vd],["rdbu",Hc],["rdgy",_d],["rdylbu",Yc],["rdylgn",Md],["spectral",Od],["burd",e=>Hc(1-e)],["buylrd",e=>Yc(1-e)],["blues",eh],["greens",rh],["greys",oh],["purples",ah],["reds",ch],["oranges",fh],["turbo",xh],["viridis",Sh],["magma",vh],["inferno",Ih],["plasma",_h],["cividis",lh],["cubehelix",ph],["warm",dh],["cool",hh],["bugn",kd],["bupu",Rd],["gnbu",Ad],["orrd",$d],["pubugn",Ld],["pubu",zd],["purd",Ud],["rdpu",Gd],["ylgnbu",qd],["ylgn",Yd],["ylorbr",Xd],["ylorrd",Qd],["rainbow",gh],["sinebow",yh]]);function mu(e){let t=`${e}`.toLowerCase();if(!nO.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return nO.get(t)}var m$=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function sO(e){return e!=null&&m$.has(`${e}`.toLowerCase())}var C1=e=>t=>e(1-t),O1=[0,1],cO=new Map([["number",mt],["rgb",Fn],["hsl",Hy],["hcl",Yy],["lab",dm]]);function k1(e){let t=`${e}`.toLowerCase();if(!cO.has(t))throw new Error(`unknown interpolator: ${t}`);return cO.get(t)}function hu(e,t,r,{type:n,nice:o,clamp:i,zero:a,domain:s=bO(e,r),unknown:c,round:f,scheme:u,interval:p,range:l=Qe.get(e)===ks?b$(r,s):Qe.get(e)===Ns?y$(r,s):Qe.get(e)===Rs?O1:void 0,interpolate:m=Qe.get(e)===wn?u==null&&l!==void 0?Fn:mu(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):f?fs:mt,reverse:h}){if(s=uO(s),p=oi(p,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof m!="function"&&(m=k1(m)),h=!!h,l!==void 0){let y=s.length,b=(l=uO(l)).length;if(y!==b){if(m.length===1)throw new Error("invalid piecewise interpolator");m=Uo(m,l),l=void 0}}if(m.length===1?(h&&(m=C1(m),h=!1),l===void 0&&(l=Float64Array.from(s,(y,b)=>b/(s.length-1)),l.length===2&&(l=O1)),t.interpolate((l===O1?xn:Bl)(m))):t.interpolate(m),a){let[y,b]=Wt(s);(y>0||b<0)&&(s=Ta(s),(Ui(s)||1)===Math.sign(y)?s[0]=0:s[s.length-1]=0)}return h&&(s=la(s)),t.domain(s).unknown(c),o&&(t.nice(d$(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 uO(e){return e=ni(e),e.length>=2?e:[e[0],e[0]]}function d$(e,t){return e===!0?void 0:typeof e=="number"?e:IT(e,t)}function fO(e,t,r){return hu(e,ys(),t,r)}function lO(e,t,r){return N1(e,t,{...r,exponent:.5})}function N1(e,t,{exponent:r=1,...n}){return hu(e,ol().exponent(r),t,{...n,type:"pow"})}function pO(e,t,{base:r=10,domain:n=x$(t),...o}){return hu(e,rl().base(r),t,{...o,domain:n})}function mO(e,t,{constant:r=1,...n}){return hu(e,nl().constant(r),t,n)}function dO(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:o=n,scheme:i="rdylbu",domain:a=w$(t),unknown:s,interpolate:c,reverse:f}){return r===void 0&&(r=c!==void 0?Tr(c,o):Qe.get(e)===wn?Ul(i,o):void 0),a.length>0&&(a=il(a,r===void 0?{length:o}:r).quantiles()),Yh(e,t,{domain:a,range:r,reverse:f,unknown:s})}function hO(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:o="rdylbu",domain:i=bO(e,t),unknown:a,interpolate:s,reverse:c}){let[f,u]=Wt(i),p;return r===void 0?(p=uo(f,u,n),p[0]<=f&&p.splice(0,1),p[p.length-1]>=u&&p.pop(),n=p.length+1,r=s!==void 0?Tr(s,n):Qe.get(e)===wn?Ul(o,n):void 0):(p=Tr(mt(f,u),n+1).slice(1,-1),f instanceof Date&&(p=p.map(l=>new Date(l)))),Ui(ni(i))<0&&p.reverse(),Yh(e,t,{domain:p,range:r,reverse:c,unknown:a})}function Yh(e,t,{domain:r=[0],unknown:n,scheme:o="rdylbu",interpolate:i,range:a=i!==void 0?Tr(i,r.length+1):Qe.get(e)===wn?Ul(o,r.length+1):void 0,reverse:s}){r=ni(r);let c=Ui(r);if(!isNaN(c)&&!h$(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return s&&(a=la(a)),{type:"threshold",scale:al(c<0?la(r):r,a===void 0?[]:a).unknown(n),domain:r,range:a}}function h$(e,t){for(let r=1,n=e.length,o=e[0];rt}}function du(e,t=Xx){return e.length?[Lr(e,({value:r})=>r===void 0?r:Lr(r,t)),nr(e,({value:r})=>r===void 0?r:nr(r,t))]:[0,1]}function bO(e,t){let r=Qe.get(e);return(r===ks||r===Rs||r===Ns?g$:du)(t)}function g$(e){return[0,e.length?nr(e,({value:t})=>t===void 0?t:nr(t,Xx)):1]}function b$(e,t){let r=e.find(({radius:a})=>a!==void 0);if(r!==void 0)return[0,r.radius];let n=En(e,.5,({value:a})=>a===void 0?NaN:En(a,.25,Ts)),o=t.map(a=>3*Math.sqrt(a/n)),i=30/nr(o);return i<1?o.map(a=>a*i):o}function y$(e,t){let r=ns(e,({value:i})=>i===void 0?NaN:ns(i,Math.abs)),n=t.map(i=>12*i/r),o=60/nr(n);return o<1?n.map(i=>i*o):n}function x$(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return du(e,Ts);if(r<0)return du(e,eu)}return[1,10]}function w$(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function Bl(e){return(t,r)=>n=>e(t+n*(r-t))}var R1=0,E1;function yO(){let e=R1;return R1=0,E1=void 0,e}function tn(e){e!==E1&&(E1=e,console.warn(e),++R1)}function Wh(e,t,r,n,{type:o,nice:i,clamp:a,domain:s=du(n),unknown:c,pivot:f=0,scheme:u,range:p,symmetric:l=!0,interpolate:m=Qe.get(e)===wn?u==null&&p!==void 0?Fn:mu(u!==void 0?u:"rdbu"):mt,reverse:h}){f=+f,s=ni(s);let[y,b]=s;if(s.length>2&&tn(`Warning: the diverging ${e} scale domain contains extra elements.`),Rn(y,b)<0&&([y,b]=[b,y],h=!h),y=Math.min(y,f),b=Math.max(b,f),typeof m!="function"&&(m=k1(m)),p!==void 0&&(m=m.length===1?Bl(m)(...p):Uo(m,p)),h&&(m=C1(m)),l){let x=r.apply(f),g=x-r.apply(y),S=r.apply(b)-x;gS&&(b=r.invert(x+g))}return t.domain([y,f,b]).unknown(c).interpolator(m),a&&t.clamp(a),i&&t.nice(i),{type:o,domain:[y,b],pivot:f,interpolate:m,scale:t}}function xO(e,t,r){return Wh(e,dl(),S$,t,r)}function wO(e,t,r){return A1(e,t,{...r,exponent:.5})}function A1(e,t,{exponent:r=1,...n}){return Wh(e,dd().exponent(r=+r),_$(r),t,{...n,type:"diverging-pow"})}function SO(e,t,{base:r=10,pivot:n=1,domain:o=du(t,n<0?eu:Ts),...i}){return Wh(e,pd().base(r=+r),v$,t,{domain:o,pivot:n,...i})}function vO(e,t,{constant:r=1,...n}){return Wh(e,md().constant(r=+r),P$(r),t,n)}var S$={apply(e){return e},invert(e){return e}},v$={apply:Math.log,invert:Math.exp},I$={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function _$(e){return e===.5?I$:{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 P$(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 IO(e,t,r,n){return hu(e,t,r,n)}function _O(e,t,r){return IO(e,ud(),t,r)}function PO(e,t,r){return IO(e,fd(),t,r)}var gu=Symbol("ordinal");function TO(e,t,r,{type:n,interval:o,domain:i,range:a,reverse:s,hint:c}){return o=oi(o,n),i===void 0&&(i=RO(r,o,e)),(n==="categorical"||n===gu)&&(n="ordinal"),s&&(i=la(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 OO(e,t,{type:r,interval:n,domain:o,range:i,scheme:a,unknown:s,...c}){n=oi(n,r),o===void 0&&(o=RO(t,n,e));let f;if(Qe.get(e)===fu)f=M$(t),i=i===void 0?T$(f):Xe(i,lu);else if(Qe.get(e)===wn&&(i===void 0&&(r==="ordinal"||r===gu)&&(i=aO(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 u=mu(a),p=i[0],l=i[1]-i[0];i=({length:m})=>Tr(h=>u(p+l*h),m)}else i=T1(a);if(s===Qf)throw new Error(`implicit unknown on ${e} scale is not supported`);return TO(e,gs().unknown(s),t,{...c,type:r,domain:o,range:i,hint:f})}function CO(e,t,{align:r=.5,padding:n=.5,...o}){return NO(W0().align(r).padding(n),t,o,e)}function kO(e,t,{align:r=.5,padding:n=.1,paddingInner:o=n,paddingOuter:i=e==="fx"||e==="fy"?0:n,...a}){return NO(wa().align(r).paddingInner(o).paddingOuter(i),t,a,e)}function NO(e,t,r,n){let{round:o}=r;return o!==void 0&&e.round(o=!!o),e=TO(n,e,t,r),e.round=o,e}function RO(e,t,r){let n=new so;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]=Wt(n).map(t.floor,t);return t.range(o,t.offset(i))}if(n.size>1e4&&Qe.get(r)===Kn)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Pi(n,Nr)}function MO(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 M$(e){return{fill:MO(e,"fill"),stroke:MO(e,"stroke")}}function T$(e){return cr(e.fill)?Cx:kh}function Gl(e,{label:t,inset:r=0,insetTop:n=r,insetRight:o=r,insetBottom:i=r,insetLeft:a=r,round:s,nice:c,clamp:f,zero:u,align:p,padding:l,projection:m,facet:{label:h=t}={},...y}={}){let b={};for(let[x,g]of e){let S=y[x],w=k$(x,g,{round:Qe.get(x)===Kn?s:void 0,nice:c,clamp:f,zero:u,align:p,padding:l,projection:m,...S});if(w){let{label:_=x==="fx"||x==="fy"?h:t,percent:v,transform:I,inset:O,insetTop:M=O!==void 0?O:x==="y"?n:0,insetRight:E=O!==void 0?O:x==="x"?o:0,insetBottom:C=O!==void 0?O:x==="y"?i:0,insetLeft:N=O!==void 0?O: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?O$(g,w):_,w.transform=I,x==="x"||x==="fx"?(w.insetLeft=+N,w.insetRight=+E):(x==="y"||x==="fy")&&(w.insetTop=+M,w.insetBottom=+C),b[x]=w}}return b}function $1(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]=A$(o),r[n]=i,i.type=a,s!=null&&(i.interval=s),c!=null&&(i.label=c)}return r}function DO(e,t){let{x:r,y:n,fx:o,fy:i}=e,a=o||i?Zh(t):t;o&&EO(o,a),i&&AO(i,a);let s=o||i?D1(e,t):t;r&&EO(r,s),n&&AO(n,s)}function O$(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!ai(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function LO(e){return Math.sign(Ui(e.domain()))*Math.sign(Ui(e.range()))}function Zh(e){let{marginTop:t,marginRight:r,marginBottom:n,marginLeft:o,width:i,height:a,facet:{marginTop:s,marginRight:c,marginBottom:f,marginLeft:u}}=e;return{marginTop:Math.max(t,s),marginRight:Math.max(r,c),marginBottom:Math.max(n,f),marginLeft:Math.max(o,u),width:i,height:a}}function D1({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=Zh(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 EO(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)],ai(e)||(e.range=zO(e)),e.scale.range(e.range)}VO(e)}function AO(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],ai(e)?e.range.reverse():e.range=zO(e),e.scale.range(e.range)}VO(e)}function VO(e){e.round===void 0&&R$(e)&&C$(e)<=30&&e.scale.round(!0)}function C$({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 zO(e){let t=e.scale.domain().length+L1(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 k$(e,t=[],r={}){let n=N$(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&ai({type:n})){let o=t.map(({value:i})=>i).filter(i=>i!==void 0);o.some(At)?tn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${bu(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 "${bu(n)}".`):o.some(MT)?tn(`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 "${bu(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 "${bu(n)}".`):o.some(TT)&&tn(`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 "${bu(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 "${bu(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=Xh(t,r,ri);break;case"identity":switch(Qe.get(e)){case Kn:r=Xh(t,r,ri);break;case fu:r=Xh(t,r,E$);break}break;case"utc":case"time":r=Xh(t,r,c1);break}switch(n){case"diverging":return xO(e,t,r);case"diverging-sqrt":return wO(e,t,r);case"diverging-pow":return A1(e,t,r);case"diverging-log":return SO(e,t,r);case"diverging-symlog":return vO(e,t,r);case"categorical":case"ordinal":case gu:return OO(e,t,r);case"cyclical":case"sequential":case"linear":return fO(e,t,r);case"sqrt":return lO(e,t,r);case"threshold":return Yh(e,t,r);case"quantile":return dO(e,t,r);case"quantize":return hO(e,t,r);case"pow":return N1(e,t,r);case"log":return pO(e,t,r);case"symlog":return mO(e,t,r);case"utc":return PO(e,t,r);case"time":return _O(e,t,r);case"point":return CO(e,t,r);case"band":return kO(e,t,r);case"identity":return gO(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function bu(e){return typeof e=="symbol"?e.description:e}function FO(e){return typeof e=="string"?`${e}`.toLowerCase():e}var $O={toString:()=>"projection"};function N$(e,t,{type:r,domain:n,range:o,scheme:i,pivot:a,projection:s}){if(r=FO(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&s!=null&&(r=$O);for(let u of t){let p=FO(u.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===$O)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:u})=>u!==void 0))return;let c=Qe.get(e);if(c===ks)return"sqrt";if(c===Rs||c===Ns)return"linear";if(c===fu)return"ordinal";let f=(n??o)?.length;if(f<2||f>2)return F1(c);if(n!==void 0){if(m1(n))return F1(c);if(At(n))return"utc"}else{let u=t.map(({value:p})=>p).filter(p=>p!==void 0);if(u.some(m1))return F1(c);if(u.some(At))return"utc"}if(c===wn){if(a!=null||sO(i))return"diverging";if(iO(i))return"categorical"}return"linear"}function F1(e){switch(e){case Kn:return"point";case wn:return gu;default:return"ordinal"}}function ai({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===gu}function L1({type:e}){return e==="threshold"}function R$({type:e}){return e==="point"||e==="band"}function So(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,o=t.length;n{if(!Qe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function A$({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:u=>u,invert:u=>u};let f=e.unknown?e.unknown():void 0;return{type:t,domain:Ta(r),...n!==void 0&&{range:Ta(n)},...a!==void 0&&{transform:a},...s&&{percent:s},...f!==void 0&&{unknown:f},...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:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function BO(e,t){let{fx:r,fy:n}=Gl(e,t),o=r?.scale.domain(),i=n?.scale.domain();return o&&i?Up(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 GO(e,{x:t,y:r}){return t&&=B1(t),r&&=B1(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 Jh(e,{fx:t,fy:r}){let n=Br(e),o=t?.value,i=r?.value;return t&&r?co(n,a=>(a.fx=o[a[0]],a.fy=i[a[0]],a),a=>o[a],a=>i[a]):t?co(n,a=>(a.fx=o[a[0]],a),a=>o[a]):co(n,a=>(a.fy=i[a[0]],a),a=>i[a])}function KO(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 qO(e){let t=[],r=new Uint32Array(hn(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 F$=new Map([["top",V1],["right",U1],["bottom",z1],["left",j1],["top-left",Qh(V1,j1)],["top-right",Qh(V1,U1)],["bottom-left",Qh(z1,j1)],["bottom-right",Qh(z1,U1)],["top-empty",D$],["right-empty",z$],["bottom-empty",L$],["left-empty",V$],["empty",j$]]);function HO(e){if(e==null)return null;let t=F$.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var UO=new WeakMap;function B1(e){let t=UO.get(e);return t||UO.set(e,t=new Dr(Xe(e,(r,n)=>[r,n]))),t}function Ra(e,t){return B1(e).get(t)}function $$(e,t,r){return t=Bn(t),r=Bn(r),e.find(n=>Object.is(Bn(n.x),t)&&Object.is(Bn(n.y),r))}function eg(e,t,r){return $$(e,t,r)?.empty}function V1(e,{y:t},{y:r}){return t?Ra(t,r)===0:!0}function z1(e,{y:t},{y:r}){return t?Ra(t,r)===t.length-1:!0}function j1(e,{x:t},{x:r}){return t?Ra(t,r)===0:!0}function U1(e,{x:t},{x:r}){return t?Ra(t,r)===t.length-1:!0}function D$(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,n);if(i>0)return eg(e,r,t[i-1])}function L$(e,{y:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,n);if(i0)return eg(e,t[i-1],n)}function z$(e,{x:t},{x:r,y:n,empty:o}){if(o)return!1;if(!t)return;let i=Ra(t,r);if(in.get(o)?.get(i)??[]):t?e.map(({x:o})=>n.get(o)??[]):e.map(({y:o})=>n.get(o)??[])}var YO=Math.PI,Yi=2*YO,G1=.618;function WO({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,f="frame";if(yo(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:f=f,...s}=e,e==null)return}typeof e!="function"&&({type:e}=K1(e));let{width:u,height:p,marginLeft:l,marginRight:m,marginTop:h,marginBottom:y}=a,b=u-l-m-i-n,x=p-h-y-r-o;if(e=e?.({width:b,height:x,clip:f,...s}),e==null)return;f=U$(f,l,h,u-m,p-y);let g=l+i,S=h+r,w;if(c!=null){let[[_,v],[I,O]]=Lc(e).bounds(c),M=Math.min(b/(I-_),x/(O-v));M>0?(g-=(M*(_+I)-b)/2,S-=(M*(v+O)-x)/2,w=Vc({point(E,C){this.stream.point(E*M+g,C*M+S)}})):tn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=g===0&&S===0?XO():Vc({point(_,v){this.stream.point(_+g,v+S)}}),{stream:_=>e.stream(w.stream(f(_)))}}function K1(e){switch(`${e}`.toLowerCase()){case"albers-usa":return vo(C0,.7463,.4673);case"albers":return rg(qf,.7463,.4673);case"azimuthal-equal-area":return vo(N0,4,4);case"azimuthal-equidistant":return vo(E0,Yi,Yi);case"conic-conformal":return rg($0,Yi,Yi);case"conic-equal-area":return rg(xa,6.1702,2.9781);case"conic-equidistant":return rg(L0,7.312,3.6282);case"equal-earth":return vo(z0,5.4133,2.6347);case"equirectangular":return vo(D0,Yi,YO);case"gnomonic":return vo(U0,3.4641,3.4641);case"identity":return{type:XO};case"reflect-y":return{type:B$};case"mercator":return vo(A0,Yi,Yi);case"orthographic":return vo(G0,2,2);case"stereographic":return vo(q0,2,2);case"transverse-mercator":return vo(Y0,Yi,Yi);default:throw new Error(`unknown projection type: ${e}`)}}function U$(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 Ec(t,r,n,o);default:throw new Error(`unknown projection clip type: ${e}`)}}function vo(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 rg(e,t,r){let{type:n,aspectRatio:o}=vo(e,t,r);return{type:i=>{let{parallels:a,domain:s,width:c,height:f}=i,u=n(i);return a!=null&&(u.parallels(a),s===void 0&&c!=null&&u.fitSize([c,f],{type:"Sphere"})),u},aspectRatio:o}}var XO=xn({stream:e=>e}),B$=xn(Vc({point(e,t){this.stream.point(e,-t)}}));function ZO(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),f,u=n.stream({point(p,l){s[f]=p,c[f]=l}});for(f=0;f5?5:c:G1}}if(e!=null){if(typeof e!="function"){let{aspectRatio:t}=K1(e);if(t)return t}return G1}}function eC(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)mo(a,i);return[n,o]}function tC({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Vc({point(r,n){this.stream.point(e(r),t(n))}})}function yu(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:qh(r)}}function Le(e,{document:t}){return Vr(Ti(e).call(t.documentElement))}var ng=Symbol("unset");function og(e){return(e.length===1?G$:K$)(e)}function G$(e){let t,r=ng;return n=>(Object.is(r,n)||(r=n,t=e(n)),t)}function K$(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 q$=og(e=>new Intl.NumberFormat(e)),DSe=og((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),LSe=og((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function H$(e="en-US"){let t=q$(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function Y$(e){return $h(e,"Invalid Date")}function W$(e="en-US"){let t=H$(e);return r=>(r instanceof Date?Y$:typeof r=="number"?t:Ft)(r)}var si=W$();var xr=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,X$=0;function nC(){return`plot-clip-${++X$}`}function oC(e,{title:t,href:r,ariaLabel:n,ariaDescription:o,ariaHidden:i,target:a,fill:s,fillOpacity:c,stroke:f,strokeWidth:u,strokeOpacity:p,strokeLinejoin:l,strokeLinecap:m,strokeMiterlimit:h,strokeDasharray:y,strokeDashoffset:b,opacity:x,mixBlendMode:g,imageFilter:S,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:I},{ariaLabel:O,fill:M="currentColor",fillOpacity:E,stroke:C="none",strokeOpacity:N,strokeWidth:K,strokeLinecap:F,strokeLinejoin:T,strokeMiterlimit:V,paintOrder:D}){M===null&&(s=null,c=null),C===null&&(f=null,p=null),cr(M)?!cr(C)&&(!cr(s)||I?.fill)&&(C="none"):cr(C)&&(!cr(f)||I?.stroke)&&(M="none");let[H,G]=Jr(s,M),[Y,W]=Ct(c,E),[Z,q]=Jr(f,C),[ie,ee]=Ct(p,N),[oe,re]=Ct(x);Cs(q)||(u===void 0&&(u=K),m===void 0&&(m=F),l===void 0&&(l=T),h===void 0&&!kT(l)&&(h=V),!Cs(G)&&w===void 0&&(w=D));let[L,P]=Ct(u);return M!==null&&(e.fill=kt(G,"currentColor"),e.fillOpacity=Kl(W,1)),C!==null&&(e.stroke=kt(q,"none"),e.strokeWidth=Kl(P,1),e.strokeOpacity=Kl(ee,1),e.strokeLinejoin=kt(l,"miter"),e.strokeLinecap=kt(m,"butt"),e.strokeMiterlimit=Kl(h,4),e.strokeDasharray=kt(y,"none"),e.strokeDashoffset=kt(b,"0")),e.target=Ft(a),e.ariaLabel=Ft(O),e.ariaDescription=Ft(o),e.ariaHidden=Ft(i),e.opacity=Kl(re,1),e.mixBlendMode=kt(g,"normal"),e.imageFilter=kt(S,"none"),e.paintOrder=kt(w,"normal"),e.pointerEvents=kt(_,"auto"),e.shapeRendering=kt(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:Y,scale:"auto",optional:!0},stroke:{value:Z,scale:"auto",optional:!0},strokeOpacity:{value:ie,scale:"auto",optional:!0},strokeWidth:{value:L,optional:!0},opacity:{value:oe,scale:"auto",optional:!0}}}function Z$(e,t){t&&e.filter(r=>Rl(t[r])).append("title").call(J$,t)}function Q$(e,t){t&&e.filter(([r])=>Rl(t[r])).append("title").call(e9,t)}function J$(e,t){t&&e.text(r=>si(t[r]))}function e9(e,t){t&&e.text(([r])=>si(t[r]))}function wr(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){n&&he(e,"aria-label",l=>n[l]),i&&he(e,"fill",l=>i[l]),a&&he(e,"fill-opacity",l=>a[l]),s&&he(e,"stroke",l=>s[l]),c&&he(e,"stroke-opacity",l=>c[l]),f&&he(e,"stroke-width",l=>f[l]),u&&he(e,"opacity",l=>u[l]),p&&iC(e,l=>p[l],t),r||Z$(e,o)}function ig(e,{target:t,tip:r},{ariaLabel:n,title:o,fill:i,fillOpacity:a,stroke:s,strokeOpacity:c,strokeWidth:f,opacity:u,href:p}){n&&he(e,"aria-label",([l])=>n[l]),i&&he(e,"fill",([l])=>i[l]),a&&he(e,"fill-opacity",([l])=>a[l]),s&&he(e,"stroke",([l])=>s[l]),c&&he(e,"stroke-opacity",([l])=>c[l]),f&&he(e,"stroke-width",([l])=>f[l]),u&&he(e,"opacity",([l])=>u[l]),p&&iC(e,([l])=>p[l],t),r||Q$(e,o)}function t9({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:i,strokeWidth:a,opacity:s,href:c},{tip:f}){return[e,f?void 0:t,r,n,o,i,a,s,c].filter(u=>u!==void 0)}function r9(e,t,r){let n=Do(e,o=>t[o]);return r===void 0&&n.size>1+e.length>>1&&tn("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*ag(e,t,r,n){let{z:o}=r,{z:i}=n,a=t9(n,r),s=[...t,...a];for(let c of i?r9(e,i,o):[e]){let f,u;e:for(let p of c){for(let l of s)if(!Un(l[p])){u&&u.push(-1);continue e}if(f===void 0){u&&(yield u),f=a.map(l=>Bn(l[p])),u=[p];continue}u.push(p);for(let l=0;lBn(h[p])),u=[p];continue e}}u&&(yield u)}}function n9(e,t,r,n){let o,{clip:i=n.clip}=t;i==="frame"?(e=Le("svg:g",n).each(function(){this.appendChild(e.node()),e.node=()=>this}),o=i9(n,r)):i&&(o=s9(i,n)),he(e,"aria-label",t.ariaLabel),he(e,"aria-description",t.ariaDescription),he(e,"aria-hidden",t.ariaHidden),he(e,"clip-path",o)}function o9(e){let t=new WeakMap;return(r,n)=>{let o=t.get(r);if(!o){let i=nC();Vr(r.ownerSVGElement).append("clipPath").attr("id",i).call(e,r,n),t.set(r,o=`url(#${i})`)}return o}}var i9=o9((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)}),rC=new WeakMap,a9={type:"Sphere"};function s9(e,t){let r,n;if((r=rC.get(t))||rC.set(t,r=new WeakMap),e.type==="Sphere"&&(e=a9),!(n=r.get(e))){let o=nC();Vr(t.ownerSVGElement).append("clipPath").attr("id",o).append("path").attr("d",t.path()(e)),r.set(e,n=`url(#${o})`)}return n}function Dt(e,t,r,n){n9(e,t,r,n),he(e,"class",t.className),he(e,"fill",t.fill),he(e,"fill-opacity",t.fillOpacity),he(e,"stroke",t.stroke),he(e,"stroke-width",t.strokeWidth),he(e,"stroke-opacity",t.strokeOpacity),he(e,"stroke-linejoin",t.strokeLinejoin),he(e,"stroke-linecap",t.strokeLinecap),he(e,"stroke-miterlimit",t.strokeMiterlimit),he(e,"stroke-dasharray",t.strokeDasharray),he(e,"stroke-dashoffset",t.strokeDashoffset),he(e,"shape-rendering",t.shapeRendering),he(e,"filter",t.imageFilter),he(e,"paint-order",t.paintOrder);let{pointerEvents:o=n.pointerSticky===!1?"none":void 0}=t;he(e,"pointer-events",o)}function It(e,t){c9(e,"mix-blend-mode",t.mixBlendMode),he(e,"opacity",t.opacity)}function iC(e,t,r){e.each(function(n){let o=t(n);if(o!=null){let i=this.ownerDocument.createElementNS(Lo.svg,"a");i.setAttribute("fill","inherit"),i.setAttributeNS(Lo.xlink,"href",o),r!=null&&i.setAttribute("target",r),this.parentNode.insertBefore(i,this).appendChild(this)}})}function he(e,t,r){r!=null&&e.attr(t,r)}function c9(e,t,r){r!=null&&e.style(t,r)}function Lt(e,t,{x:r,y:n},o=xr,i=xr){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 kt(e,t){if((e=Ft(e))!==t)return e}function Kl(e,t){if((e=$t(e))!==t)return e}var u9=/^-?([_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 xu(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!u9.test(e))throw new Error(`invalid class name: ${e}`);return e}function wu(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 ci({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 Je=class{constructor(t,r={},n={},o){let{facet:i="auto",facetAnchor:a,fx:s,fy:c,sort:f,dx:u=0,dy:p=0,margin:l=0,marginTop:m=l,marginRight:h=l,marginBottom:y=l,marginLeft:b=l,className:x,clip:g=o?.clip,channels:S,tip:w,render:_}=n;if(this.data=t,this.sort=Oa(f)?f:null,this.initializer=Gi(n).initializer,this.transform=this.initializer?n.transform:Es(n).transform,i===null||i===!1?this.facet=null:(this.facet=Ur(i===!0?"include":i,"facet",["auto","include","exclude","super"]),this.fx=t===ou&&typeof s=="string"?[s]:s,this.fy=t===ou&&typeof c=="string"?[c]:c),this.facetAnchor=HO(a),r=d1(r),S!==void 0&&(r={...f9(S),...r}),o!==void 0&&(r={...oC(this,n,o),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([v,I])=>{if(au(I.value)){let{value:O,label:M=I.label,scale:E=I.scale}=I.value;I={...I,label:M,scale:E,value:O}}if(t===ou&&typeof I.value=="string"){let{value:O}=I;I={...I,value:[O]}}return[v,I]}).filter(([v,{value:I,optional:O}])=>{if(I!=null)return!0;if(O)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+p,this.marginTop=+m,this.marginRight=+h,this.marginBottom=+y,this.marginLeft=+b,this.clip=qh(g),this.tip=l9(w),this.className=Ft(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=H1(_,this.render))}initialize(t,r,n){let o=Bi(this.data);t===void 0&&o!=null&&(t=[Br(o)]);let i=t;this.transform!=null&&({facets:t,data:o}=this.transform(o,t,n),o=Bi(o)),t!==void 0&&(t.original=i);let a=WT(this.channels,o);return this.sort!=null&&ZT(o,t,a,r,this.sort),{data:o,facets:t,channels:a}}filter(t,r,n){for(let o in r){let{filter:i=Un}=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"&&ZO(o,i,r,n.projection)}}scale(t,r,n){let o=XT(t,r);return n.projection&&this.project(t,o,n),o}};function q1(...e){return e.plot=Je.prototype.plot,e}function H1(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,f,u,p,l)=>t.call(this,c,f,u,p,l,s))}}function f9(e){return Object.fromEntries(Object.entries(d1(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:ii(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function l9(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ur(e,"tip",["x","y","xy"]):e}function As(e,t){return e?.tip===!0?{...e,tip:t}:yo(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}function sC(e,t,r={}){let n=.5-xr,o=.5+xr,i=.5+xr,a=.5-xr;for(let{marginTop:y,marginRight:b,marginBottom:x,marginLeft:g}of t)y>n&&(n=y),b>o&&(o=b),x>i&&(i=x),g>a&&(a=g);let{margin:s,marginTop:c=s!==void 0?s:n,marginRight:f=s!==void 0?s:o,marginBottom:u=s!==void 0?s:i,marginLeft:p=s!==void 0?s:a}=r;c=+c,f=+f,u=+u,p=+p;let{width:l=640,height:m=p9(e,r,{width:l,marginTopDefault:n,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,c-n+u-i)}=r;l=+l,m=+m;let h={width:l,height:m,marginTop:c,marginRight:f,marginBottom:u,marginLeft:p};if(e.fx||e.fy){let{margin:y,marginTop:b=y!==void 0?y:c,marginRight:x=y!==void 0?y:f,marginBottom:g=y!==void 0?y:u,marginLeft:S=y!==void 0?y:p}=r.facet??{};b=+b,x=+x,g=+g,S=+S,h.facet={marginTop:b,marginRight:x,marginBottom:g,marginLeft:S}}return h}function p9({x:e,y:t,fy:r,fx:n},{projection:o,aspectRatio:i},{width:a,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:f,marginLeftDefault:u}){let p=r&&r.scale.domain().length||1,l=JO(o);if(l){let h=n?n.scale.domain().length:1,y=(1.1*p-.1)/(1.1*h-.1)*l,b=Math.max(.1,Math.min(10,y));return Math.round((a-u-c)*b+s+f)}let m=t?ai(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=aC("y",t)/(aC("x",e)*i),y=n?n.scale.bandwidth():1,b=r?r.scale.bandwidth():1,x=y*(a-u-c)-e.insetLeft-e.insetRight;return(h*x+t.insetTop+t.insetBottom)/b+s+f}return!!(t||r)*Math.max(1,Math.min(60,m*p))*20+!!n*30+60}function aC(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]=Wt(n);return Math.abs(o(a)-o(i))}var cC=new WeakMap;function Y1(e,t,{x:r,y:n,px:o,py:i,maxRadius:a=40,channels:s,render:c,...f}={}){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,...f,render:H1(function(u,p,l,m,h,y){h={...h,pointerSticky:!1};let b=h.ownerSVGElement,{data:x}=h.getMarkState(this),g=cC.get(b);g||cC.set(b,g={sticky:!1,roots:[],renders:[]});let S=g.renders.push(q)-1,{x:w,y:_,fx:v,fy:I}=p,O=v?v(u.fx)-m.marginLeft:0,M=I?I(u.fy)-m.marginTop:0;w?.bandwidth&&(O+=w.bandwidth()/2),_?.bandwidth&&(M+=_.bandwidth()/2);let E=u.fi!=null,C;if(E){let re=g.facetStates;re||(g.facetStates=re=new Map),C=re.get(this),C||re.set(this,C=new Map)}let[N,K]=ci(this,m),{px:F,py:T}=l,V=F?re=>F[re]:X1(l,N),D=T?re=>T[re]:Z1(l,K),H,G,Y,W;function Z(re,L){if(E)if(W&&(W=cancelAnimationFrame(W)),re==null)C.delete(u.fi);else{C.set(u.fi,L),W=requestAnimationFrame(()=>{W=null;for(let[P,A]of C)if(A1)){let A=H==null?null:go(x)?x[H]:x.get(H);h.dispatchValue(A)}return P}function ie(re){if(g.sticky||re.pointerType==="mouse"&&re.buttons===1)return;let[L,P]=ma(re);L-=O,P-=M;let A=Lm.width-m.marginRight?1:e,z=Pm.height-m.marginBottom?1:t,R=null,Q=a*a;for(let X of u){let le=A*(V(X)-L),xe=z*(D(X)-P),Me=le*le+xe*xe;Me<=Q&&(R=X,Q=Me)}if(R!=null&&(e!==1||t!==1)){let X=V(R)-L,le=D(R)-P;Q=X*X+le*le}Z(R,Q)}function ee(re){re.pointerType==="mouse"&&H!=null&&(g.sticky&&g.roots.some(L=>L?.contains(re.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(L=>L(null))):(g.sticky=!0,q(H)),re.stopImmediatePropagation()))}function oe(re){re.pointerType==="mouse"&&(g.sticky||Z(null))}return b.addEventListener("pointerenter",ie),b.addEventListener("pointermove",ie),b.addEventListener("pointerdown",ee),b.addEventListener("pointerleave",oe),q(null)},c)}}function uC(e){return Y1(1,1,e)}function fC(e){return Y1(1,.01,e)}function W1(e){return Y1(.01,1,e)}function X1({x1:e,x2:t,x:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function Z1({y1:e,y2:t,y:r=e},n){return e&&t?o=>(e[o]+t[o])/2:r?o=>r[o]:()=>n}function sg(e){return ai(e)&&e.interval===void 0?void 0:"tabular-nums"}function lC(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:f=0,style:u,ticks:p=(o-f-s)/64,tickFormat:l,fontVariant:m=sg(e),round:h=!0,opacity:y,className:b}=t,x=yu(t);b=xu(b),y=Ct(y)[1],l===null&&(l=()=>null);let g=Le("svg",x).attr("class",`${b}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",i).attr("viewBox",`0 0 ${o} ${i}`).call(N=>N.append("style").text(`:where(.${b}-ramp) { display: block; height: auto; height: intrinsic; max-width: 100%; overflow: visible; } -:where(.${y}-ramp text) { +:where(.${b}-ramp text) { white-space: pre; -}`)).call(wu,f),S=N=>N.selectAll(".tick line").attr("y1",a+c-i),w,_=h?(N,G)=>N.rangeRound(G):(N,G)=>N.range(G),{type:v,domain:I,range:T,interpolate:P,scale:R,pivot:C}=e;if(P){let N=T===void 0?P:jo(P.length===1?zl(P):P,T);w=_(R.copy(),_r(mt(u,o-s),Math.min(I.length+(C!==void 0),T===void 0?1/0:T.length)));let G=256,D=x.document.createElement("canvas");D.width=G,D.height=1;let O=D.getContext("2d");for(let z=0,U=G-1;zD:typeof l=="string"?$n(l):l;w=_(ys().domain([-1,T.length-1]),[u,o-s]),g.append("g").attr("fill-opacity",b).selectAll().data(T).enter().append("rect").attr("x",(D,O)=>w(O-1)).attr("y",a).attr("width",(D,O)=>w(O)-w(O-1)).attr("height",i-a-c).attr("fill",D=>D),p=We(N,(D,O)=>O),l=D=>G(N[D],D)}else w=_(wa().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(Pb(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",Ot(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 W1=Math.PI/180;function Kl(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=X1(r),e.markerMid=X1(n),e.markerEnd=X1(o)}function X1(e){if(e==null||e===!1)return null;if(e===!0)return sO;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return aO("auto");case"arrow-reverse":return aO("auto-start-reverse");case"dot":return f$;case"circle":case"circle-fill":return sO;case"circle-stroke":return l$;case"tick":return Z1("auto");case"tick-x":return Z1(90);case"tick-y":return Z1(0)}throw new Error(`invalid marker: ${e}`)}function aO(e){return(t,r)=>De("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 f$(e,t){return De("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 sO(e,t){return De("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 l$(e,t){return De("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 Z1(e){return(t,r)=>De("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 p$=0;function J1(e,t,{stroke:r},n){return fO(e,t,r&&(o=>r[o]),null,n)}function cO(e,t,{stroke:r,z:n},o){return fO(e,t,r&&(([i])=>r[i]),n,o)}var Q1=1,uO=2;function m$(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=eg;i1){let c=s[0];a!==(a=Bn(t[c]))&&(r[c]|=Q1)}}for(let i=o-1,a=eg;i>=0;--i){let s=n[i];if(s.length>1){let c=s[0];a!==(a=Bn(t[c]))&&(r[c]|=uO)}}return([i])=>r[i]}function fO(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let c=new Map,u=a&&m$(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-${++p$}`;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)&Q1))),r&&u&&e.each(f("marker-start",r,p=>!(u(p)&Q1))),r&&e.each(f("marker-mid",r)),n&&e.each(f("marker-end",n,u&&(p=>u(p)&uO)))}function Su({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=lO(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function ig({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=lO(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function lO(e,t,r){return e===void 0&&t===void 0&&r===void 0?gr?[1,0]:[.5,.5]:[t,r]}function pO(e,{interval:t}){return e={...oi(e)},e.interval=Vh(e.interval===void 0?t:e.interval),e}function ew(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:c}=pO(o,r);if(s==null||c==null&&!n)return r;let u=xo(o);if(c==null){let m,h={transform:b=>m||(m=dt(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=We(dt(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 mO(e,t,r){let{[e]:n}=r,{value:o,interval:i}=pO(n,r);return o==null||i==null?r:t({...r,[e]:{label:xo(n),transform:a=>{let s=We(dt(a,o),u=>i.floor(u)),c=s.map(u=>i.offset(u));return s.map(Et(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 dO(e={}){return ew("x",Su,e,!0)}function tw(e={}){return ew("x",Su,e)}function ag(e={}){return ew("y",ig,e)}function hO(e={}){return mO("x",Su,e)}function gO(e={}){return mO("y",ig,e)}var yO={ariaLabel:"rule",fill:null,stroke:"currentColor"},sg=class extends Ze{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}},Es(r,"x"),yO),this.insetTop=Ft(s),this.insetBottom=Ft(c),Kl(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 De("svg:g",i).call($t,this,o,i).call(Dt,this,{x:c&&a},gr,0).call(S=>S.selectAll().data(t).enter().append("line").call(It,this).attr("x1",c?w=>c[w]:(b+p-h)/2).attr("x2",c?w=>c[w]:(b+p-h)/2).attr("y1",u&&!wo(s)?w=>u[w]+x:m+x).attr("y2",f&&!wo(s)?s.bandwidth?w=>f[w]+s.bandwidth()-g:w=>f[w]-g:l-y-g).call(yr,this,n).call(J1,this,n,i)).node()}},cg=class extends Ze{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}},Es(r,"y"),yO),this.insetRight=Ft(s),this.insetLeft=Ft(c),Kl(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 De("svg:g",i).call($t,this,o,i).call(Dt,this,{y:c&&s},0,gr).call(S=>S.selectAll().data(t).enter().append("line").call(It,this).attr("x1",u&&!wo(a)?w=>u[w]+x:b+x).attr("x2",f&&!wo(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(yr,this,n).call(J1,this,n,i)).node()}};function As(e,t){let{x:r=nt,y:n,y1:o,y2:i,...a}=ag(t);return[o,i]=bO(n,o,i),new sg(e,{...a,x:r,y1:o,y2:i})}function vo(e,t){let{y:r=nt,x:n,x1:o,x2:i,...a}=tw(t);return[o,i]=bO(n,o,i),new cg(e,{...a,y:r,x1:o,x2:i})}function bO(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 vu(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=sw(this),this.clipLine=cw(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]=si(this,o);return De("svg:g",i).call($t,this,o,i).call(aw,this,p,o).call(Dt,this,{x:c&&a,y:u&&s}).call(x=>x.selectAll().data(t).enter().append("text").call(It,this).call(h$,this,p,l).attr("transform",vu`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(yr,this,n)).node()}};function nw(e){return e==null?null:Vr(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function h$(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(ai(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]===IO?"-":"")),o=a),c){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*w$(e){let t=0,r=0,n=e.length;for(;rN.selectAll(".tick line").attr("y1",a+c-i),w,_=h?(N,K)=>N.rangeRound(K):(N,K)=>N.range(K),{type:v,domain:I,range:O,interpolate:M,scale:E,pivot:C}=e;if(M){let N=O===void 0?M:Uo(M.length===1?Bl(M):M,O);w=_(E.copy(),Tr(mt(f,o-s),Math.min(I.length+(C!==void 0),O===void 0?1/0:O.length)));let K=256,F=x.document.createElement("canvas");F.width=K,F.height=1;let T=F.getContext("2d");for(let V=0,D=K-1;VF:typeof l=="string"?$n(l):l;w=_(ys().domain([-1,O.length-1]),[f,o-s]),g.append("g").attr("fill-opacity",y).selectAll().data(O).enter().append("rect").attr("x",(F,T)=>w(T-1)).attr("y",a).attr("width",(F,T)=>w(T)-w(T-1)).attr("height",i-a-c).attr("fill",F=>F),p=Xe(N,(F,T)=>T),l=F=>K(N[F],F)}else w=_(wa().domain(I),[f,o-s]),g.append("g").attr("fill-opacity",y).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",E),S=()=>{};return g.append("g").attr("transform",`translate(0,${i-c})`).call(Oy(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",kt(m,"normal")).call(S).call(N=>N.select(".domain").remove()),r!==void 0&&g.append("text").attr("x",f).attr("y",a-6).attr("fill","currentColor").attr("font-weight","bold").text(r),g.node()}var Q1=Math.PI/180;function ql(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:o=t}={}){e.markerStart=J1(r),e.markerMid=J1(n),e.markerEnd=J1(o)}function J1(e){if(e==null||e===!1)return null;if(e===!0)return mC;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return pC("auto");case"arrow-reverse":return pC("auto-start-reverse");case"dot":return m9;case"circle":case"circle-fill":return mC;case"circle-stroke":return d9;case"tick":return ew("auto");case"tick-x":return ew(90);case"tick-y":return ew(0)}throw new Error(`invalid marker: ${e}`)}function pC(e){return(t,r)=>Le("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 m9(e,t){return Le("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 mC(e,t){return Le("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 d9(e,t){return Le("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 ew(e){return(t,r)=>Le("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 h9=0;function rw(e,t,{stroke:r},n){return gC(e,t,r&&(o=>r[o]),null,n)}function dC(e,t,{stroke:r,z:n},o){return gC(e,t,r&&(([i])=>r[i]),n,o)}var tw=1,hC=2;function g9(e,t){let r=new Uint8Array(t.length),n=e.data().filter(i=>i.length>1),o=n.length;for(let i=0,a=ng;i1){let c=s[0];a!==(a=Bn(t[c]))&&(r[c]|=tw)}}for(let i=o-1,a=ng;i>=0;--i){let s=n[i];if(s.length>1){let c=s[0];a!==(a=Bn(t[c]))&&(r[c]|=hC)}}return([i])=>r[i]}function gC(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:o},i=()=>o,a,s){if(!t&&!r&&!n)return;let c=new Map,f=a&&g9(e,a);function u(p,l,m){return function(h){if(m&&!m(h))return;let y=i(h),b=c.get(l);b||c.set(l,b=new Map);let x=b.get(y);if(!x){let g=this.parentNode.insertBefore(l(y,s),this),S=`plot-marker-${++h9}`;g.setAttribute("id",S),b.set(y,x=`url(#${S})`)}this.setAttribute(p,x)}}t&&e.each(u("marker-start",t,f&&(p=>f(p)&tw))),r&&f&&e.each(u("marker-start",r,p=>!(f(p)&tw))),r&&e.each(u("marker-mid",r)),n&&e.each(u("marker-end",n,f&&(p=>f(p)&hC)))}function Su({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=bC(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function cg({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=bC(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function bC(e,t,r){return e===void 0&&t===void 0&&r===void 0?xr?[1,0]:[.5,.5]:[t,r]}function yC(e,{interval:t}){return e={...ii(e)},e.interval=Uh(e.interval===void 0?t:e.interval),e}function nw(e,t,r,n){let{[e]:o,[`${e}1`]:i,[`${e}2`]:a}=r,{value:s,interval:c}=yC(o,r);if(s==null||c==null&&!n)return r;let f=wo(o);if(c==null){let m,h={transform:y=>m||(m=dt(y,s)),label:f};return{...r,[e]:void 0,[`${e}1`]:i===void 0?h:i,[`${e}2`]:a===void 0&&!(i===a&&n)?h:a}}let u,p;function l(m){return p!==void 0&&m===u?p:p=Xe(dt(u=m,s),h=>c.floor(h))}return t({...r,[e]:void 0,[`${e}1`]:i===void 0?{transform:l,label:f}:i,[`${e}2`]:a===void 0?{transform:m=>l(m).map(h=>c.offset(h)),label:f}:a})}function xC(e,t,r){let{[e]:n}=r,{value:o,interval:i}=yC(n,r);return o==null||i==null?r:t({...r,[e]:{label:wo(n),transform:a=>{let s=Xe(dt(a,o),f=>i.floor(f)),c=s.map(f=>i.offset(f));return s.map(At(s)?(f,u)=>f==null||isNaN(f=+f)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((f+u)/2):(f,u)=>f==null||(u=c[u],u==null)?NaN:(+f+ +u)/2)}}})}function wC(e={}){return nw("x",Su,e,!0)}function ow(e={}){return nw("x",Su,e)}function ug(e={}){return nw("y",cg,e)}function SC(e={}){return xC("x",Su,e)}function vC(e={}){return xC("y",cg,e)}var IC={ariaLabel:"rule",fill:null,stroke:"currentColor"},fg=class extends Je{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}},As(r,"x"),IC),this.insetTop=$t(s),this.insetBottom=$t(c),ql(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y1:f,y2:u}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:y,marginBottom:b}=o,{insetTop:x,insetBottom:g}=this;return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,{x:c&&a},xr,0).call(S=>S.selectAll().data(t).enter().append("line").call(It,this).attr("x1",c?w=>c[w]:(y+p-h)/2).attr("x2",c?w=>c[w]:(y+p-h)/2).attr("y1",f&&!So(s)?w=>f[w]+x:m+x).attr("y2",u&&!So(s)?s.bandwidth?w=>u[w]+s.bandwidth()-g:w=>u[w]-g:l-b-g).call(wr,this,n).call(rw,this,n,i)).node()}},lg=class extends Je{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}},As(r,"y"),IC),this.insetRight=$t(s),this.insetLeft=$t(c),ql(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{y:c,x1:f,x2:u}=n,{width:p,height:l,marginTop:m,marginRight:h,marginLeft:y,marginBottom:b}=o,{insetLeft:x,insetRight:g}=this;return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,{y:c&&s},0,xr).call(S=>S.selectAll().data(t).enter().append("line").call(It,this).attr("x1",f&&!So(a)?w=>f[w]+x:y+x).attr("x2",u&&!So(a)?a.bandwidth?w=>u[w]+a.bandwidth()-g:w=>u[w]-g:p-h-g).attr("y1",c?w=>c[w]:(m+l-b)/2).attr("y2",c?w=>c[w]:(m+l-b)/2).call(wr,this,n).call(rw,this,n,i)).node()}};function Fs(e,t){let{x:r=Ze,y:n,y1:o,y2:i,...a}=ug(t);return[o,i]=_C(n,o,i),new fg(e,{...a,x:r,y1:o,y2:i})}function Io(e,t){let{y:r=Ze,x:n,x1:o,x2:i,...a}=ow(t);return[o,i]=_C(n,o,i),new lg(e,{...a,y:r,x1:o,x2:i})}function _C(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 vu(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: ${u}`);this.splitLines=fw(this),this.clipLine=lw(this)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:f,rotate:u,text:p,title:l,fontSize:m}=n,{rotate:h}=this,[y,b]=ci(this,o);return Le("svg:g",i).call(Dt,this,o,i).call(uw,this,p,o).call(Lt,this,{x:c&&a,y:f&&s}).call(x=>x.selectAll().data(t).enter().append("text").call(It,this).call(y9,this,p,l).attr("transform",vu`translate(${c?g=>c[g]:y},${f?g=>f[g]:b})${u?g=>` rotate(${u[g]})`:h?` rotate(${h})`:""}`).call(he,"font-size",m&&(g=>m[g])).call(wr,this,n)).node()}};function aw(e){return e==null?null:Ur(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function y9(e,t,r,n){if(!r)return;let{lineAnchor:o,lineHeight:i,textOverflow:a,splitLines:s,clipLine:c}=t;e.each(function(f){let u=s(si(r[f])??"").map(c),p=u.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]===CC?"-":"")),o=a),c){n.push(e.slice(o,s)),o=void 0;continue}i=s}return n}function*I9(e){let t=0,r=0,n=e.length;for(;ri.split(/\r\n?|\n/g);let n=e?fg:ug,o=t*100;return i=>x$(i,o,n)}function cw({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?fg:ug,o=t*100;switch(r){case"clip-start":return i=>SO(i,o,n,"");case"clip-end":return i=>wO(i,o,n,"");case"ellipsis-start":return i=>SO(i,o,n,Fs);case"ellipsis-middle":return i=>S$(i,o,n,Fs);case"ellipsis-end":return i=>wO(i,o,n,Fs)}}var Fs="\u2026";function $s(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 wO(e,t,r,n){e=e.trim();let o=r(n),[i]=$s(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function S$(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=$s(e,t/2,r,i),[c]=$s(e,o-t/2-s+i,r,-i);return c<0?n:e.slice(0,a).trimEnd()+n+e.slice(_u(e,c)).trimStart()}function SO(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=$s(e,o-t+i,r,-i);return a<0?n:n+e.slice(_u(e,a)).trimStart()}var rw=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,vO=/\p{Extended_Pictographic}/uy;function _u(e,t){return t+=v$(e,t)?2:1,_$(e,t)&&(t=rw.lastIndex),I$(e,t)?_u(e,t+1):t}function _O(e,t){return e.charCodeAt(t)<128}function v$(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 I$(e,t){return e.charCodeAt(t)===8205}function _$(e,t){return _O(e,t)?!1:(rw.lastIndex=t,rw.test(e))}function PO(e,t){return _O(e,t)?!1:(vO.lastIndex=t,vO.test(e))}var P$={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},TO=3.5,T$=TO*5,MO={draw(e,t,r){let n=t*r/T$;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},M$={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},C$=new Map([["arrow",MO],["spike",M$]]);function O$(e){return e&&typeof e.draw=="function"}function k$(e){if(O$(e))return e;let t=C$.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var lg=class extends Ze{constructor(t,r={}){let{x:n,y:o,r:i=TO,length:a,rotate:s,shape:c=MO,anchor:u="middle",frameAnchor:f}=r,[p,l]=Ct(a,12),[m,h]=Ct(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,P$),this.r=+i,this.length=l,this.rotate=h,this.shape=k$(c),this.anchor=Vr(u,"anchor",["start","middle","end"]),this.frameAnchor=Na(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]=si(this,o);return De("svg:g",i).call($t,this,o,i).call(Dt,this,{x:c&&a,y:u&&s}).call(S=>S.selectAll().data(t).enter().append("path").call(It,this).attr("transform",vu`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 _=po();return b.draw(_,f[w],y),_}:(()=>{let w=po();return b.draw(w,l,y),w})()).call(yr,this,n)).node()}};function CO(e,t={}){let{x:r=nt,...n}=t;return new lg(e,{...n,x:r})}function OO(e,t={}){let{y:r=nt,...n}=t;return new lg(e,{...n,y:r})}function Aa(e,t){return arguments.length<2&&!Qr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function pg({anchor:e}={},t){return e===void 0?t[0]:Vr(e,"anchor",t)}function kO(e){return pg(e,["left","right"])}function NO(e){return pg(e,["right","left"])}function RO(e){return pg(e,["bottom","top"])}function EO(e){return pg(e,["top","bottom"])}function fw(){let[e,t]=Aa(...arguments);return $O("y",kO(t),e,t)}function AO(){let[e,t]=Aa(...arguments);return $O("fy",NO(t),e,t)}function lw(){let[e,t]=Aa(...arguments);return DO("x",RO(t),e,t)}function FO(){let[e,t]=Aa(...arguments);return DO("fx",EO(t),e,t)}function $O(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:C=`${e}-axis`,...N}){return h=Ft(h),b=Ft(b),y=Ft(y),T!==void 0&&(T=Vr(T,"labelAnchor",["center","top","bottom"])),P=WO(P),B1(h&&!ir(i)?N$(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,x,ariaLabel:C,...N}):null,ir(c)?null:E$(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:C,...N}),!ir(c)&&I!==null?Ea([],KO({fill:c,fillOpacity:u,...N},function(G,D,O,z,U){let W=z[e],{marginTop:B,marginRight:q,marginBottom:X,marginLeft:J}=e==="y"&&U.inset||U,A=T??(W.bandwidth?"center":"top"),K=R??(t==="right"?q:J)-3;return A==="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=A,this.frameAnchor=`${A}-${t}`,this.rotate=0),this.dy=A==="top"?3-B:A==="bottom"?X-3:0,this.dx=t==="right"?K:-K,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[YO(e,W,{anchor:t,label:I,labelAnchor:A,labelArrow:P})]}}}})):null)}function DO(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:C=`${e}-axis`,...N}){return h=Ft(h),b=Ft(b),y=Ft(y),T!==void 0&&(T=Vr(T,"labelAnchor",["center","left","right"])),P=WO(P),B1(h&&!ir(i)?R$(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:b,tickRotate:y,y:x,ariaLabel:C,...N}):null,ir(c)?null:A$(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:C,...N}),!ir(c)&&I!==null?Ea([],KO({fill:c,fillOpacity:u,...N},function(G,D,O,z,U){let W=z[e],{marginTop:B,marginRight:q,marginBottom:X,marginLeft:J}=e==="x"&&U.inset||U,A=T??(W.bandwidth?"center":"right"),K=R??(t==="top"?B:X)-3;return A==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${A}`,this.textAnchor=A==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-K:K,this.dx=A==="right"?q-3:A==="left"?3-J:0,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[YO(e,W,{anchor:t,label:I,labelAnchor:A,labelArrow:P})]}}}})):null)}function N$(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 Pu(OO,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:m,...b,dx:t==="left"?+l-gr+ +f:+l+gr-p,anchor:"start",length:c,shape:t==="left"?L$:V$})}function R$(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 Pu(CO,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:m,...b,dy:t==="bottom"?+l-gr-p:+l+gr+ +f,anchor:"start",length:c,shape:t==="bottom"?$$:D$})}function E$(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*W1):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 Pu(iw,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=HO(S)),c===void 0&&(I.text=qO(S,w,_,v,t))})}function A$(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*W1):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 Pu(ow,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=HO(S)),c===void 0&&(I.text=qO(S,w,_,v,t))})}function LO(){let[e,t]=Aa(...arguments);return zO("y",kO(t),e,t)}function VO(){let[e,t]=Aa(...arguments);return zO("fy",NO(t),e,t)}function jO(){let[e,t]=Aa(...arguments);return BO("x",RO(t),e,t)}function UO(){let[e,t]=Aa(...arguments);return BO("fx",EO(t),e,t)}function zO(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 Pu(vo,e,r,{ariaLabel:s,ariaHidden:c},{y:n,x1:i,x2:a,...GO(u)})}function BO(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 Pu(As,e,r,{ariaLabel:s,ariaHidden:c},{x:n,y1:i,y2:a,...GO(u)})}function GO({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 KO({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]=Zr(e),[,t]=Ct(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 Pu(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"&&XO(x)&&(S=w,w=void 0),w===void 0&&(w=ni(S,x.type)??F$(x,v)),f==null){if(Qr(w))f=ri(w);else if(ka(w))f=uw(w,...Yt(g));else if(x.interval){let T=x.interval;if(x.ticks){let[P,R]=Yt(g),C=(R-P)/T[nu];T=Qx(T,C/w)??T,f=uw(T,P,R)}else{f=g;let P=f.length;T=Qx(T,P/w)??T,T!==x.interval&&(f=uw(T,...Yt(f)))}if(T===x.interval){let P=Math.round(f.length/w);P>1&&(f=f.filter((R,C)=>C%P===0))}}else x.ticks?f=x.ticks(w):f=g;if(!x.ticks&&f.length&&f!==g){let T=new so(g);f=f.filter(P=>T.has(P)),f.length||Jr(`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:nt}}i?.call(this,x,f,w,_,a);let I=Object.fromEntries(Object.entries(a).map(([T,P])=>[T,{...P,value:dt(f,P.value)}]));return y&&(p=b.filterFacets(f,I)),{data:f,facets:p,channels:I}}let c=Bi(o).initializer,u=e(r,Bi({...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 F$(e,t){let[r,n]=Yt(e.range());return(n-r)/t}function qO(e,t,r,n,o){return{value:ql(e,t,r,n,o)}}function ql(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&Et(t)?oM(e.type,t,o)??ai:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(Et(e.domain())?Zo:$n)(n):n===void 0?ai:bn(n)}function uw(e,t,r){return e.range(t,e.offset(e.floor(r)))}var $$={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},D$={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},L$={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},V$={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function HO(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function YO(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&XO(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=RC(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 WO(e="auto"){return ir(e)?!1:typeof e=="boolean"?e:Vr(e,"labelArrow",["auto","up","right","down","left"])}function XO(e){return Et(e.domain())}function ZO(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function QO(e,{opacity:t,...r}={}){if(!ii(e)&&!F1(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return ek(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",Ct(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function JO(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:ir(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},c){let[u,f]=Zr(t),[p,l]=Zr(n),m=ZO(c,u),h=ZO(c,p),b=a*a*Math.PI;return r=Ct(r)[1],o=Ct(o)[1],i=Ct(i)[1],ek(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 _=po();return e.scale(w).draw(_,b),_}))}function ek(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=og(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:c=a,marginLeft:u=0,className:f,style:p,width:l}=t,m=bu(t);f=xu(f),o=ql(e.scale,e.domain,void 0,o);let h=De("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 PC={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 pg(e,t=0,r=e.length){let n=0;for(let o=t;oi.split(/\r\n?|\n/g);let n=e?mg:pg,o=t*100;return i=>v9(i,o,n)}function lw({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return i=>i;let n=e?mg:pg,o=t*100;switch(r){case"clip-start":return i=>TC(i,o,n,"");case"clip-end":return i=>MC(i,o,n,"");case"ellipsis-start":return i=>TC(i,o,n,$s);case"ellipsis-middle":return i=>_9(i,o,n,$s);case"ellipsis-end":return i=>MC(i,o,n,$s)}}var $s="\u2026";function Ds(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+=f,o.push(a)}return[-1,0]}function MC(e,t,r,n){e=e.trim();let o=r(n),[i]=Ds(e,t,r,o);return i<0?e:e.slice(0,i).trimEnd()+n}function _9(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n)/2,[a,s]=Ds(e,t/2,r,i),[c]=Ds(e,o-t/2-s+i,r,-i);return c<0?n:e.slice(0,a).trimEnd()+n+e.slice(_u(e,c)).trimStart()}function TC(e,t,r,n){e=e.trim();let o=r(e);if(o<=t)return e;let i=r(n),[a]=Ds(e,o-t+i,r,-i);return a<0?n:n+e.slice(_u(e,a)).trimStart()}var iw=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,OC=/\p{Extended_Pictographic}/uy;function _u(e,t){return t+=P9(e,t)?2:1,T9(e,t)&&(t=iw.lastIndex),M9(e,t)?_u(e,t+1):t}function kC(e,t){return e.charCodeAt(t)<128}function P9(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 M9(e,t){return e.charCodeAt(t)===8205}function T9(e,t){return kC(e,t)?!1:(iw.lastIndex=t,iw.test(e))}function NC(e,t){return kC(e,t)?!1:(OC.lastIndex=t,OC.test(e))}var O9={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},RC=3.5,C9=RC*5,EC={draw(e,t,r){let n=t*r/C9;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},k9={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},N9=new Map([["arrow",EC],["spike",k9]]);function R9(e){return e&&typeof e.draw=="function"}function E9(e){if(R9(e))return e;let t=N9.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var dg=class extends Je{constructor(t,r={}){let{x:n,y:o,r:i=RC,length:a,rotate:s,shape:c=EC,anchor:f="middle",frameAnchor:u}=r,[p,l]=Ct(a,12),[m,h]=Ct(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,O9),this.r=+i,this.length=l,this.rotate=h,this.shape=E9(c),this.anchor=Ur(f,"anchor",["start","middle","end"]),this.frameAnchor=Na(u)}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:f,length:u,rotate:p}=n,{length:l,rotate:m,anchor:h,shape:y,r:b}=this,[x,g]=ci(this,o);return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,{x:c&&a,y:f&&s}).call(S=>S.selectAll().data(t).enter().append("path").call(It,this).attr("transform",vu`translate(${c?w=>c[w]:x},${f?w=>f[w]:g})${p?w=>` rotate(${p[w]})`:m?` rotate(${m})`:""}${h==="start"?"":h==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${l})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${l/2})`}`).attr("d",u?w=>{let _=po();return y.draw(_,u[w],b),_}:(()=>{let w=po();return y.draw(w,l,b),w})()).call(wr,this,n)).node()}};function AC(e,t={}){let{x:r=Ze,...n}=t;return new dg(e,{...n,x:r})}function FC(e,t={}){let{y:r=Ze,...n}=t;return new dg(e,{...n,y:r})}function Aa(e,t){return arguments.length<2&&!en(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function hg({anchor:e}={},t){return e===void 0?t[0]:Ur(e,"anchor",t)}function $C(e){return hg(e,["left","right"])}function DC(e){return hg(e,["right","left"])}function LC(e){return hg(e,["bottom","top"])}function VC(e){return hg(e,["top","bottom"])}function mw(){let[e,t]=Aa(...arguments);return UC("y",$C(t),e,t)}function zC(){let[e,t]=Aa(...arguments);return UC("fy",DC(t),e,t)}function dw(){let[e,t]=Aa(...arguments);return BC("x",LC(t),e,t)}function jC(){let[e,t]=Aa(...arguments);return BC("fx",VC(t),e,t)}function UC(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:c=n,fillOpacity:f=o,textAnchor:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="y"?6:0,tickPadding:y,tickRotate:b,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:O,labelArrow:M,labelOffset:E,ariaLabel:C=`${e}-axis`,...N}){return h=$t(h),y=$t(y),b=$t(b),O!==void 0&&(O=Ur(O,"labelAnchor",["center","top","bottom"])),M=tk(M),q1(h&&!cr(i)?A9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:y,tickRotate:b,x,ariaLabel:C,...N}):null,cr(c)?null:$9(e,t,r,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:u,tickSize:h,tickPadding:y,tickRotate:b,x,marginTop:S,marginRight:w,marginBottom:_,marginLeft:v,ariaLabel:C,...N}),!cr(c)&&I!==null?Ea([],ZC({fill:c,fillOpacity:f,...N},function(K,F,T,V,D){let H=V[e],{marginTop:G,marginRight:Y,marginBottom:W,marginLeft:Z}=e==="y"&&D.inset||D,q=O??(H.bandwidth?"center":"top"),ie=E??(t==="right"?Y:Z)-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-G:q==="bottom"?W-3:0,this.dx=t==="right"?ie:-ie,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[ek(e,H,{anchor:t,label:I,labelAnchor:q,labelArrow:M})]}}}})):null)}function BC(e,t,r,{color:n="currentColor",opacity:o=1,stroke:i=n,strokeOpacity:a=o,strokeWidth:s=1,fill:c=n,fillOpacity:f=o,textAnchor:u,textStroke:p,textStrokeOpacity:l,textStrokeWidth:m,tickSize:h=e==="x"?6:0,tickPadding:y,tickRotate:b,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:O,labelArrow:M,labelOffset:E,ariaLabel:C=`${e}-axis`,...N}){return h=$t(h),y=$t(y),b=$t(b),O!==void 0&&(O=Ur(O,"labelAnchor",["center","left","right"])),M=tk(M),q1(h&&!cr(i)?F9(e,t,r,{stroke:i,strokeOpacity:a,strokeWidth:s,tickSize:h,tickPadding:y,tickRotate:b,y:x,ariaLabel:C,...N}):null,cr(c)?null:D9(e,t,r,{fill:c,fillOpacity:f,stroke:p,strokeOpacity:l,strokeWidth:m,textAnchor:u,tickSize:h,tickPadding:y,tickRotate:b,y:x,marginTop:S,marginRight:w,marginBottom:_,marginLeft:v,ariaLabel:C,...N}),!cr(c)&&I!==null?Ea([],ZC({fill:c,fillOpacity:f,...N},function(K,F,T,V,D){let H=V[e],{marginTop:G,marginRight:Y,marginBottom:W,marginLeft:Z}=e==="x"&&D.inset||D,q=O??(H.bandwidth?"center":"right"),ie=E??(t==="top"?G:W)-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"?-ie:ie,this.dx=q==="right"?Y-3:q==="left"?3-Z:0,this.ariaLabel=`${C} label`,{facets:[[0]],channels:{text:{value:[ek(e,H,{anchor:t,label:I,labelAnchor:q,labelArrow:M})]}}}})):null)}function A9(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="y"?"-empty":""),frameAnchor:s=t,tickSize:c,inset:f=0,insetLeft:u=f,insetRight:p=f,dx:l=0,y:m=e==="y"?void 0:null,ariaLabel:h,...y}){return Pu(FC,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:s,y:m,...y,dx:t==="left"?+l-xr+ +u:+l+xr-p,anchor:"start",length:c,shape:t==="left"?j9:U9})}function F9(e,t,r,{strokeWidth:n=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=t+(e==="x"?"-empty":""),frameAnchor:s=t,tickSize:c,inset:f=0,insetTop:u=f,insetBottom:p=f,dy:l=0,x:m=e==="x"?void 0:null,ariaLabel:h,...y}){return Pu(AC,e,r,{ariaLabel:`${h} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:s,x:m,...y,dy:t==="bottom"?+l-xr-p:+l+xr+ +u,anchor:"start",length:c,shape:t==="bottom"?V9:z9})}function $9(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*Q1):0),text:c,textAnchor:f=Math.abs(a)>60?"middle":t==="left"?"end":"start",lineAnchor:u=a>60?"top":a<-60?"bottom":"middle",fontVariant:p,inset:l=0,insetLeft:m=l,insetRight:h=l,dx:y=0,ariaLabel:b,y:x=e==="y"?void 0:null,...g}){return Pu(cw,e,r,{ariaLabel:`${b} tick label`},{facetAnchor:n,frameAnchor:o,text:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:a,y:x,...g,dx:t==="left"?+y-i-s+ +m:+y+ +i+ +s-h},function(S,w,_,v,I){p===void 0&&(this.fontVariant=JC(S)),c===void 0&&(I.text=QC(S,w,_,v,t))})}function D9(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*Q1):0),text:c,textAnchor:f=Math.abs(a)>=10?a<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(a)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:p,inset:l=0,insetTop:m=l,insetBottom:h=l,dy:y=0,x:b=e==="x"?void 0:null,ariaLabel:x,...g}){return Pu(sw,e,r,{ariaLabel:`${x} tick label`},{facetAnchor:n,frameAnchor:o,text:c===void 0?null:c,textAnchor:f,lineAnchor:u,fontVariant:p,rotate:a,x:b,...g,dy:t==="bottom"?+y+ +i+ +s-h:+y-i-s+ +m},function(S,w,_,v,I){p===void 0&&(this.fontVariant=JC(S)),c===void 0&&(I.text=QC(S,w,_,v,t))})}function GC(){let[e,t]=Aa(...arguments);return YC("y",$C(t),e,t)}function KC(){let[e,t]=Aa(...arguments);return YC("fy",DC(t),e,t)}function qC(){let[e,t]=Aa(...arguments);return WC("x",LC(t),e,t)}function HC(){let[e,t]=Aa(...arguments);return WC("fx",VC(t),e,t)}function YC(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,...f}){return Pu(Io,e,r,{ariaLabel:s,ariaHidden:c},{y:n,x1:i,x2:a,...XC(f)})}function WC(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,...f}){return Pu(Fs,e,r,{ariaLabel:s,ariaHidden:c},{x:n,y1:i,y2:a,...XC(f)})}function XC({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 ZC({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:o,fontVariant:i,fontWeight:a,monospace:s,pointerEvents:c,shapeRendering:f,clip:u=!1},p){return[,e]=Jr(e),[,t]=Ct(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:f,clip:u,initializer:p}}function Pu(e,t,r,n,o,i){let a;function s(u,p,l,m,h,y){let b=u==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"&&rk(x)&&(S=w,w=void 0),w===void 0&&(w=oi(S,x.type)??L9(x,v)),u==null){if(en(w))u=ni(w);else if(ka(w))u=pw(w,...Wt(g));else if(x.interval){let O=x.interval;if(x.ticks){let[M,E]=Wt(g),C=(E-M)/O[nu];O=t1(O,C/w)??O,u=pw(O,M,E)}else{u=g;let M=u.length;O=t1(O,M/w)??O,O!==x.interval&&(u=pw(O,...Wt(u)))}if(O===x.interval){let M=Math.round(u.length/w);M>1&&(u=u.filter((E,C)=>C%M===0))}}else x.ticks?u=x.ticks(w):u=g;if(!x.ticks&&u.length&&u!==g){let O=new so(g);u=u.filter(M=>O.has(M)),u.length||tn(`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=[Br(u)]:a[t]={scale:t,value:Ze}}i?.call(this,x,u,w,_,a);let I=Object.fromEntries(Object.entries(a).map(([O,M])=>[O,{...M,value:dt(u,M.value)}]));return b&&(p=y.filterFacets(u,I)),{data:u,facets:p,channels:I}}let c=Gi(o).initializer,f=e(r,Gi({...o,initializer:s},c));return r==null?(a=f.channels,f.channels={}):a={},n!==void 0&&Object.assign(f,n),f.clip===void 0&&(f.clip=!1),f}function L9(e,t){let[r,n]=Wt(e.range());return(n-r)/t}function QC(e,t,r,n,o){return{value:Hl(e,t,r,n,o)}}function Hl(e,t,r,n,o){return typeof n=="function"&&!(e.type==="log"&&e.tickFormat)?n:n===void 0&&t&&At(t)?fT(e.type,t,o)??si:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):typeof n=="string"&&e.domain().length>0?(At(e.domain())?Jo:$n)(n):n===void 0?si:xn(n)}function pw(e,t,r){return e.range(t,e.offset(e.floor(r)))}var V9={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},z9={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},j9={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},U9={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function JC(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function ek(e,t,{anchor:r,label:n=t.label,labelAnchor:o,labelArrow:i}={}){if(!(n==null||n.inferred&&rk(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=LO(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 tk(e="auto"){return cr(e)?!1:typeof e=="boolean"?e:Ur(e,"labelArrow",["auto","up","right","down","left"])}function rk(e){return At(e.domain())}function nk(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function ok(e,{opacity:t,...r}={}){if(!ai(e)&&!L1(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return ak(e,r,(n,o,i,a)=>n.append("svg").attr("width",i).attr("height",a).attr("fill",o.scale).attr("fill-opacity",Ct(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function ik(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:cr(t)?"currentColor":"none",strokeOpacity:o=1,strokeWidth:i=1.5,r:a=4.5,...s}={},c){let[f,u]=Jr(t),[p,l]=Jr(n),m=nk(c,f),h=nk(c,p),y=a*a*Math.PI;return r=Ct(r)[1],o=Ct(o)[1],i=Ct(i)[1],ak(e,s,(b,x,g,S)=>b.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",S).attr("fill",f==="color"?w=>m.scale(w):u).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 _=po();return e.scale(w).draw(_,y),_}))}function ak(e,t={},r){let{columns:n,tickFormat:o,fontVariant:i=sg(e),swatchSize:a=15,swatchWidth:s=a,swatchHeight:c=a,marginLeft:f=0,className:u,style:p,width:l}=t,m=yu(t);u=xu(u),o=Hl(e.scale,e.domain,void 0,o);let h=Le("div",m).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),y;return n!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) { display: flex; align-items: center; break-inside: avoid; padding-bottom: 1px; } -:where(.${f}-swatches-columns .${f}-swatch::before) { +:where(.${u}-swatches-columns .${u}-swatch::before) { flex-shrink: 0; } -:where(.${f}-swatches-columns .${f}-swatch-label) { +:where(.${u}-swatches-columns .${u}-swatch-label) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -}`,h.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${f}-swatch`).call(r,e,s,c).call(y=>y.append("div").attr("class",`${f}-swatch-label`).attr("title",o).text(o))):(b=`:where(.${f}-swatches-wrap) { +}`,h.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(r,e,s,c).call(b=>b.append("div").attr("class",`${u}-swatch-label`).attr("title",o).text(o))):(y=`:where(.${u}-swatches-wrap) { display: flex; align-items: center; min-height: 33px; flex-wrap: wrap; } -:where(.${f}-swatches-wrap .${f}-swatch) { +:where(.${u}-swatches-wrap .${u}-swatch) { display: inline-flex; align-items: center; margin-right: 1em; -}`,h.selectAll().data(e.domain).enter().append("span").attr("class",`${f}-swatch`).call(r,e,s,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(y=>y.insert("style","*").text(`:where(.${f}-swatches) { +}`,h.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(r,e,s,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),h.call(b=>b.insert("style","*").text(`:where(.${u}-swatches) { font-family: system-ui, sans-serif; font-size: 10px; margin-bottom: 0.5em; } -:where(.${f}-swatch > svg) { +:where(.${u}-swatch > svg) { 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",Ot(i,"normal")).call(wu,p).node()}var pw=new Map([["symbol",JO],["color",nk],["opacity",j$]]);function tk(e,t,r={}){return(n,o)=>{if(!pw.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return pw.get(n)(e[n],rk(t,r[n],o),i=>e[i])}}function rk({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return PM(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function nk(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return QO(e,r);case"ramp":return iO(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function j$({type:e,interpolate:t,...r},{legend:n=!0,color:o=An(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 nk({type:e,...r,interpolate:U$(o)},{legend:n,...i})}function U$(e){let{r:t,g:r,b:n}=An(e)||An(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function ok(e,t,r){let n=[];for(let[o,i]of pw){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],rk(t,e[o],a),c=>e[c]);s!=null&&n.push(s)}}return n}function Tu(e={},t="y"){return c1(e)?e:{...e,[t]:nt}}function ik(e,t){if(t.length===1)return{data:e,facets:t};let r=Oa(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=Ma(e);let i=e[t1]=new Uint32Array(r+o);t=t.map(s=>Ma(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}=ik(b,y));let g=e==null?void 0:f(Dl(dt(b,e),x?.[r])),S=dt(b,t,Float64Array),w=dt(b,c),_=i&&i(b,g,S,w),v=Oa(b),I=l(new Float64Array(v)),T=h(new Float64Array(v)),P=[];for(let R of y){let C=g?Array.from(Fo(R,N=>g[N]).values()):[R];if(_)for(let N of C)N.sort(_);for(let N of C){let G=0,D=0;a&&N.reverse();for(let O of N){let z=S[O];z<0?G=T[O]=(I[O]=G)+z:z>0?D=T[O]=(I[O]=D)+z:T[O]=I[O]=D}}P.push(C)}return o&&o(P,I,T,w),{data:b,facets:y}}),u,p,m]}function K$(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return q$;case"center":case"silhouette":return H$;case"wiggle":return uk}throw new Error(`unknown offset: ${e}`)}}function ck(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function q$(e,t,r){for(let n of e)for(let o of n){let[i,a]=ck(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 H$(e,t,r){for(let n of e){for(let o of n){let[i,a]=ck(o,r);for(let s of o){let c=(a+i)/2;t[s]-=c,r[s]-=c}}fk(n,t,r)}lk(e,t,r)}function uk(e,t,r,n){for(let o of e){let i=new Ar,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,...jp(f)];for(let m of s)t[m]+=a,r[m]+=a;let l=dn(u);l&&(a-=dn(u,(m,h)=>(f[h]/2+p[h])*m)/l)}fk(o,t,r)}lk(e,t,r)}function fk(e,t,r){let n=Fr(e,o=>Fr(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function lk(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(Fr(s,c=>t[c])+er(s,c=>r[c]))/2),a=Fr(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function X$(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function Z$(e){return mg(e,(t,r,n,o)=>xc(jr(t),i=>dn(i,a=>n[a]),i=>o[i]))}function Q$(e){return mg(e,(t,r,n,o)=>xc(jr(t),i=>r[pf(i,a=>n[a])],i=>o[i]))}function ak(e){return mg(e,(t,r,n,o)=>{let i=jr(t),a=xc(i,p=>r[pf(p,l=>n[l])],p=>o[p]),s=co(i,p=>dn(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 sk(e){return t=>{let r=dt(t,e);return(n,o)=>Cr(r[n],r[o])}}function J$(e){return t=>go(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function eD(e){return mg(Cr,()=>e)}function mg(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new Ar(t(r,n,o,i).map((s,c)=>[s,c]));return(s,c)=>e(a.get(i[s]),a.get(i[c]))}}var tD={ariaLabel:"rect"},gg=class extends Ze{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,tD),Hl(this,r),Yl(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:C,rx2y2:N}=this;(c||f)&&!g&&wo(a)&&(c=f=null),(u||p)&&!g&&wo(s)&&(u=p=null);let G=a?.bandwidth?a.bandwidth():0,D=s?.bandwidth?s.bandwidth():0;return De("svg:g",i).call($t,this,o,i).call(Dt,this,{},0,0).call(O=>O.selectAll().data(t).enter().call(P||R||C||N?z=>z.append("path").call(It,this).call(Wl,c&&f?U=>c[U]+(f[U]c[U]+v:b+v,u&&p?U=>u[U]+(p[U]u[U]+S:l+S,c&&f?U=>f[U]-(f[U]c[U]+G-w:y-m-w,u&&p?U=>p[U]-(p[U]u[U]+D-_:x-h-_,this).call(yr,this,n):z=>z.append("rect").call(It,this).attr("x",c?f?U=>Math.min(c[U],f[U])+v:U=>c[U]+v:b+v).attr("y",u?p?U=>Math.min(u[U],p[U])+S:U=>u[U]+S:l+S).attr("width",c?f?U=>Math.max(0,Math.abs(f[U]-c[U])+G-v-w):G-v-w:y-m-b-w-v).attr("height",u?p?U=>Math.max(0,Math.abs(u[U]-p[U])+D-S-_):D-S-_:x-l-h-S-_).call(de,"rx",I).call(de,"ry",T).call(yr,this,n))).node()}};function Hl(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=Ft(r),e.insetRight=Ft(n),e.insetBottom=Ft(o),e.insetLeft=Ft(i)}function Yl(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=Ot(r,"auto"),e.ry=Ot(n,"auto"))}function Wl(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:c,rx2y2:u}=i;typeof t!="function"&&(t=bn(t)),typeof r!="function"&&(r=bn(r)),typeof n!="function"&&(n=bn(n)),typeof o!="function"&&(o=bn(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),C=I*(x?g?c:u:g?a:s);return`M${S},${_+hg(T,C)}A${T},${T} 0 0 ${T<0?0:1} ${S+dg(T,C)},${_}H${w-dg(P,R)}A${P},${P} 0 0 ${P<0?0:1} ${w},${_+hg(P,R)}V${v-hg(R,P)}A${R},${R} 0 0 ${R<0?0:1} ${w-dg(R,P)},${v}H${S+dg(C,T)}A${C},${C} 0 0 ${C<0?0:1} ${S},${v-hg(C,T)}Z`})}function dg(e,t){return t<0?e:Math.abs(e)}function hg(e,t){return t<0?Math.abs(e):e}function Yi(e,t={}){return Dh(t)||(t={...t,x:ei,y2:nt,interval:1}),new gg(e,Mu(dO(Tu(t))))}var rD={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},nD={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},mw=class extends Ze{constructor(t={}){let{anchor:r=null}=t;super(ou,void 0,t,r==null?rD:nD),this.anchor=s1(r,"anchor",["top","right","bottom","left"]),Hl(this,t),r||Yl(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 De(l?"svg:line":S||w||_||v?"svg:path":"svg:rect",i).datum(0).call($t,this,o,i).call(It,this).call(yr,this,n).call(Dt,this,{}).call(l==="left"?C=>C.attr("x1",I).attr("x2",I).attr("y1",P).attr("y2",R):l==="right"?C=>C.attr("x1",T).attr("x2",T).attr("y1",P).attr("y2",R):l==="top"?C=>C.attr("x1",I).attr("x2",T).attr("y1",P).attr("y2",P):l==="bottom"?C=>C.attr("x1",I).attr("x2",T).attr("y1",R).attr("y2",R):S||w||_||v?C=>C.call(Wl,I,P,T,R,this):C=>C.attr("x",I).attr("y",P).attr("width",T-I).attr("height",R-P).attr("rx",x).attr("ry",g)).node()}};function dw(e){return new mw(e)}var hw={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},oD=new Set(["geometry","href","src","ariaLabel","scales"]),gw=class extends Ze{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&Qr(t)&&jh(t)&&(r={...r,title:nt});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,hw),this.anchor=zh(u,"anchor"),this.preferredAnchor=zh(f,"preferredAnchor"),this.frameAnchor=Na(S),this.textAnchor=Ot(_,"middle"),this.textPadding=+I,this.pointerSize=+P,this.pathFilter=At(R),this.lineHeight=+x,this.lineWidth=+g,this.textOverflow=nw(v),this.monospace=!!p,this.fontFamily=At(l),this.fontSize=Ft(m),this.fontStyle=At(h),this.fontVariant=At(b),this.fontWeight=At(y);for(let C in hw)C in this.channels&&(this[C]=hw[C]);this.splitLines=sw(this),this.clipLine=cw(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:C=I??P}=n,N=u?u(t.fx)-_:0,G=f?f(t.fy)-w:0,[D,O]=si(this,o),z=H1(n,D),U=Y1(n,O),W=h?fg:ug,B=W(Fs),q,X;"title"in n?(q=dk.call(this,{title:n.channels.title},r),X=cD):(q=dk.call(this,n.channels,r),X=uD);let J=De("svg:g",i).call($t,this,o,i).call(aw,this).call(Dt,this,{x:R&&s,y:C&&c}).call(Y=>Y.selectAll().data(t).enter().append("g").attr("transform",ee=>`translate(${Math.round(z(ee))},${Math.round(U(ee))})`).call(It,this).call(ee=>ee.append("path").attr("filter",S)).call(ee=>ee.append("text").each(function(Z){let ne=$r(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let M=X.call(a,Z,t,q,r,n);if(typeof M=="string")for(let $ of a.splitLines(M))A(ne,{value:a.clipLine($)});else{let $=new Set;for(let H of M){let{label:E=""}=H;E&&$.has(E)||($.add(E),A(ne,H))}}})));function A(Y,{label:ee,value:Z,color:ne,opacity:M}){ee??="",Z??="";let $=ne!=null||M!=null,H,E=y*100,[re]=$s(ee,E,W,B);if(re>=0)ee=ee.slice(0,re).trimEnd()+Fs,H=Z.trim(),Z="";else{(ee||!Z&&!$)&&(Z=" "+Z);let[be]=$s(Z,E-W(ee),W,B);be>=0&&(H=Z.trim(),Z=Z.slice(0,be).trimEnd()+Fs)}let oe=Y.append("tspan").attr("x",0).attr("dy",`${b}em`).text("\u200B");ee&&oe.append("tspan").attr("font-weight","bold").text(ee),Z&&oe.append(()=>l.createTextNode(Z)),$&&oe.append("tspan").text(" \u25A0").attr("fill",ne).attr("fill-opacity",M).style("user-select","none"),H&&oe.append("title").text(H)}function K(){let{width:Y,height:ee}=o.facet??o;J.selectChildren().each(function(Z){let{x:ne,width:M,height:$}=this.getBBox();M=Math.round(M),$=Math.round($);let H=m;if(H===void 0){let oe=z(Z)+N,be=U(Z)+G,we=oe+M+g+x*20,ie=be+$+g+x*20;H=we&&Ve?ie&&fe?a.preferredAnchor:fe?"bottom":"top":ie&&fe?we?"left":"right":(we||Ve)&&(ie||fe)?`${fe?"bottom":"top"}-${we?"left":"right"}`:a.preferredAnchor}let E=this.firstChild,re=this.lastChild;if(E.setAttribute("d",sD(H,g,x,M,$)),ne)for(let oe of re.childNodes)oe.setAttribute("x",-ne);re.setAttribute("y",`${+iD(H,re.childNodes.length,b).toFixed(6)}em`),re.setAttribute("transform",`translate(${aD(H,g,x,M,$)})`)}),J.attr("visibility",null)}return t.length&&(J.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(K):typeof requestAnimationFrame<"u"&&requestAnimationFrame(K)),J.node()}};function bk(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=bo(t,r)),new gw(e,{...n,x:t,y:r})}function iD(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function aD(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 sD(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 dk(e,t){let r={},n=this.format;n=hk(n,e,"x"),n=hk(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=I1(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||oD.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=I1(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]=(Et(a)?Zo:$n)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?ql(a,a.domain()):ai}}return r}function hk(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 cD(e,t,{title:r}){return this.format.title(r.value[e],e)}function*uD(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:yg(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:yk(n,r,"x"),value:gk(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:yk(n,r,"y"),value:gk(this.format.y2,r.y1,a,e)};else{let s=a.value[e],c=a.scale;if(!zn(s)&&c==null)continue;yield{label:yg(n,r,i),value:this.format[i](s,e),color:c==="color"?o[i][e]:null,opacity:c==="opacity"?o[i][e]:null}}}}function gk(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 yk(e,t,r){let n=yg(e,t,`${r}1`,r),o=yg(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function yg(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function ci(e={}){let{facet:t,style:r,title:n,subtitle:o,caption:i,ariaLabel:a,ariaDescription:s}=e,c=xu(e.className),u=e.marks===void 0?[]:wk(e.marks);u.push(...hD(u));let f=mD(t,e),p=new Map;for(let B of u){let q=Sk(B,f,e);q&&p.set(B,q)}let l=new Map;f&&Xl(l,[f],e),Xl(l,p,e);let m=wk(gD(u,l,e));for(let B of m){let q=Sk(B,f,e);q&&p.set(B,q)}u.unshift(...m);let h=DC(l,e);if(h!==void 0){let B=f?Qh(h,f):void 0;for(let X of u){if(X.facet===null||X.facet==="super")continue;let J=p.get(X);J!==void 0&&(J.facetsIndex=X.fx!=null||X.fy!=null?Qh(h,J):B)}let q=new Set;for(let{facetsIndex:X}of p.values())X?.forEach((J,A)=>{J?.length>0&&q.add(A)});h.forEach(0X.empty=!q.has(J):X=>X.empty=!1);for(let X of u)if(X.facet==="exclude"){let J=p.get(X);J!==void 0&&(J.facetsIndex=jC(J.facetsIndex))}}for(let B of Xe.keys())iu(e[B])&&B!=="fx"&&B!=="fy"&&l.set(B,[]);let b=new Map;for(let B of u){if(b.has(B))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:q,channels:X}=p.get(B)??{},{data:J,facets:A,channels:K}=B.initialize(q,X,e);xw(K,e),b.set(B,{data:J,facets:A,channels:K})}let y=Bl(Xl(l,b,e),e),x=tO(y,u,e);NC(y,x);let g=E1(y),{fx:S,fy:w}=g,_=S||w?A1(y,x):x,v=S||w?ID(g,x):x,I=bu(e),T=I.document,P=Ti("svg").call(T.documentElement),R=P;I.ownerSVGElement=P,I.className=c,I.projection=BC(e,_),I.path=function(){return Lc(this.projection??WC(g))},I.filterFacets=(B,q)=>Qh(h,{channels:q,groups:Xh(B,q)}),I.getMarkState=B=>{let q=b.get(B),X=p.get(B);return{...q,channels:{...q.channels,...X?.channels}}},I.dispatchValue=B=>{R.value!==B&&(R.value=B,R.dispatchEvent(new I.document.defaultView.Event("input",{bubbles:!0})))};let C=new Set;for(let[B,q]of b)if(B.initializer!=null){let X=B.facet==="super"?v:_,J=B.initializer(q.data,q.facets,q.channels,g,X,I);if(J.data!==void 0&&(q.data=J.data),J.facets!==void 0&&(q.facets=J.facets),J.channels!==void 0){let{fx:A,fy:K,...Y}=J.channels;pD(Y),Object.assign(q.channels,Y);for(let ee of Object.values(Y)){let{scale:Z}=ee;Z!=null&&!OM(Xe.get(Z))&&(_k(ee,e),C.add(Z))}(A!=null||K!=null)&&p.set(B,!0)}}if(C.size){let B=new Map;Xl(B,b,e,A=>C.has(A)),Xl(l,b,e,A=>C.has(A));let q=vD(Bl(B,e),y),{scales:X,...J}=E1(q);Object.assign(y,q),Object.assign(g,J),Object.assign(g.scales,X)}let N,G;h!==void 0&&(N={x:S?.domain(),y:w?.domain()},h=LC(h,N),G=VC(S,w,x));for(let[B,q]of b)q.values=B.scale(q.channels,g,I);let{width:D,height:O}=x;$r(P).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",D).attr("height",O).attr("viewBox",`0 0 ${D} ${O}`).attr("aria-label",a).attr("aria-description",s).call(B=>B.append("style").text(`:where(.${c}) { +${y}`)).style("margin-left",f?`${+f}px`:null).style("width",l===void 0?null:`${+l}px`).style("font-variant",kt(i,"normal")).call(wu,p).node()}var hw=new Map([["symbol",ik],["color",uk],["opacity",B9]]);function sk(e,t,r={}){return(n,o)=>{if(!hw.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return hw.get(n)(e[n],ck(t,r[n],o),i=>e[i])}}function ck({className:e,...t},{label:r,ticks:n,tickFormat:o}={},i){return NT(i,{className:e,...t},{label:r,ticks:n,tickFormat:o})}function uk(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return ok(e,r);case"ramp":return lC(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function B9({type:e,interpolate:t,...r},{legend:n=!0,color:o=An(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 uk({type:e,...r,interpolate:G9(o)},{legend:n,...i})}function G9(e){let{r:t,g:r,b:n}=An(e)||An(0,0,0);return o=>`rgba(${t},${r},${n},${o})`}function fk(e,t,r){let n=[];for(let[o,i]of hw){let a=r[o];if(a?.legend&&o in e){let s=i(e[o],ck(t,e[o],a),c=>e[c]);s!=null&&n.push(s)}}return n}function Mu(e={},t="y"){return l1(e)?e:{...e,[t]:Ze}}function lk(e,t){if(t.length===1)return{data:e,facets:t};let r=Ca(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=Ta(e);let i=e[o1]=new Uint32Array(r+o);t=t.map(s=>Ta(s,Uint32Array));let a=r;n.fill(0);for(let s of t)for(let c=0,f=s.length;c{({data:y,facets:b}=lk(y,b));let g=e==null?void 0:u(Ll(dt(y,e),x?.[r])),S=dt(y,t,Float64Array),w=dt(y,c),_=i&&i(y,g,S,w),v=Ca(y),I=l(new Float64Array(v)),O=h(new Float64Array(v)),M=[];for(let E of b){let C=g?Array.from(Do(E,N=>g[N]).values()):[E];if(_)for(let N of C)N.sort(_);for(let N of C){let K=0,F=0;a&&N.reverse();for(let T of N){let V=S[T];V<0?K=O[T]=(I[T]=K)+V:V>0?F=O[T]=(I[T]=F)+V:O[T]=I[T]=F}}M.push(C)}return o&&o(M,I,O,w),{data:y,facets:b}}),f,p,m]}function Y9(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return W9;case"center":case"silhouette":return X9;case"wiggle":return hk}throw new Error(`unknown offset: ${e}`)}}function dk(e,t){let r=0,n=0;for(let o of e){let i=t[o];in&&(n=i)}return[r,n]}function W9(e,t,r){for(let n of e)for(let o of n){let[i,a]=dk(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 X9(e,t,r){for(let n of e){for(let o of n){let[i,a]=dk(o,r);for(let s of o){let c=(a+i)/2;t[s]-=c,r[s]-=c}}gk(n,t,r)}bk(e,t,r)}function hk(e,t,r,n){for(let o of e){let i=new Dr,a=0;for(let s of o){let c=-1,f=s.map(m=>Math.abs(r[m]-t[m])),u=s.map(m=>{c=n?n[m]:++c;let h=r[m]-t[m],y=i.has(c)?h-i.get(c):0;return i.set(c,h),y}),p=[0,...Bp(u)];for(let m of s)t[m]+=a,r[m]+=a;let l=hn(f);l&&(a-=hn(f,(m,h)=>(u[h]/2+p[h])*m)/l)}gk(o,t,r)}bk(e,t,r)}function gk(e,t,r){let n=Lr(e,o=>Lr(o,i=>t[i]));for(let o of e)for(let i of o)t[i]-=n,r[i]-=n}function bk(e,t,r){let n=e.length;if(n===1)return;let o=e.map(s=>s.flat()),i=o.map(s=>(Lr(s,c=>t[c])+nr(s,c=>r[c]))/2),a=Lr(i);for(let s=0;s(o,i)=>e(n[o],n[i])}function J9(e){return(t,r,n,o)=>(i,a)=>e(o[i],o[a])}function eD(e){return gg(e,(t,r,n,o)=>xc(Br(t),i=>hn(i,a=>n[a]),i=>o[i]))}function tD(e){return gg(e,(t,r,n,o)=>xc(Br(t),i=>r[mf(i,a=>n[a])],i=>o[i]))}function pk(e){return gg(e,(t,r,n,o)=>{let i=Br(t),a=xc(i,p=>r[mf(p,l=>n[l])],p=>o[p]),s=co(i,p=>hn(p,l=>n[l]),p=>o[p]),c=[],f=[],u=0;for(let p of a)u<0?(u+=s.get(p),c.push(p)):(u-=s.get(p),f.push(p));return f.reverse().concat(c)})}function mk(e){return t=>{let r=dt(t,e);return(n,o)=>Nr(r[n],r[o])}}function rD(e){return t=>go(t)?(r,n)=>e(t[r],t[n]):(r,n)=>e(t.get(r),t.get(n))}function nD(e){return gg(Nr,()=>e)}function gg(e,t){return(r,n,o,i)=>{if(!i)throw new Error("missing channel: z");let a=new Dr(t(r,n,o,i).map((s,c)=>[s,c]));return(s,c)=>e(a.get(i[s]),a.get(i[c]))}}var oD={ariaLabel:"rect"},xg=class extends Je{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,oD),Yl(this,r),Wl(this,r)}render(t,r,n,o,i){let{x:a,y:s}=r,{x1:c,y1:f,x2:u,y2:p}=n,{marginTop:l,marginRight:m,marginBottom:h,marginLeft:y,width:b,height:x}=o,{projection:g}=i,{insetTop:S,insetRight:w,insetBottom:_,insetLeft:v}=this,{rx:I,ry:O,rx1y1:M,rx1y2:E,rx2y1:C,rx2y2:N}=this;(c||u)&&!g&&So(a)&&(c=u=null),(f||p)&&!g&&So(s)&&(f=p=null);let K=a?.bandwidth?a.bandwidth():0,F=s?.bandwidth?s.bandwidth():0;return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,{},0,0).call(T=>T.selectAll().data(t).enter().call(M||E||C||N?V=>V.append("path").call(It,this).call(Xl,c&&u?D=>c[D]+(u[D]c[D]+v:y+v,f&&p?D=>f[D]+(p[D]f[D]+S:l+S,c&&u?D=>u[D]-(u[D]c[D]+K-w:b-m-w,f&&p?D=>p[D]-(p[D]f[D]+F-_:x-h-_,this).call(wr,this,n):V=>V.append("rect").call(It,this).attr("x",c?u?D=>Math.min(c[D],u[D])+v:D=>c[D]+v:y+v).attr("y",f?p?D=>Math.min(f[D],p[D])+S:D=>f[D]+S:l+S).attr("width",c?u?D=>Math.max(0,Math.abs(u[D]-c[D])+K-v-w):K-v-w:b-m-y-w-v).attr("height",f?p?D=>Math.max(0,Math.abs(f[D]-p[D])+F-S-_):F-S-_:x-l-h-S-_).call(he,"rx",I).call(he,"ry",O).call(wr,this,n))).node()}};function Yl(e,{inset:t=0,insetTop:r=t,insetRight:n=t,insetBottom:o=t,insetLeft:i=t}={}){e.insetTop=$t(r),e.insetRight=$t(n),e.insetBottom=$t(o),e.insetLeft=$t(i)}function Wl(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:f=o!==void 0?+o:s!==void 0?+s:0,rx2y1:u=a!==void 0?+a:i!==void 0?+i:0,rx2y2:p=a!==void 0?+a:s!==void 0?+s:0}={}){c||f||u||p?(e.rx1y1=c,e.rx1y2=f,e.rx2y1=u,e.rx2y2=p):(e.rx=kt(r,"auto"),e.ry=kt(n,"auto"))}function Xl(e,t,r,n,o,i){let{rx1y1:a,rx1y2:s,rx2y1:c,rx2y2:f}=i;typeof t!="function"&&(t=xn(t)),typeof r!="function"&&(r=xn(r)),typeof n!="function"&&(n=xn(n)),typeof o!="function"&&(o=xn(o));let u=Math.max(Math.abs(a+c),Math.abs(s+f)),p=Math.max(Math.abs(a+s),Math.abs(c+f));e.attr("d",l=>{let m=t(l),h=r(l),y=n(l),b=o(l),x=m>y,g=h>b,S=x?y:m,w=x?m:y,_=g?b:h,v=g?h:b,I=Math.min(1,(w-S)/u,(v-_)/p),O=I*(x?g?f:c:g?s:a),M=I*(x?g?s:a:g?f:c),E=I*(x?g?a:s:g?c:f),C=I*(x?g?c:f:g?a:s);return`M${S},${_+yg(O,C)}A${O},${O} 0 0 ${O<0?0:1} ${S+bg(O,C)},${_}H${w-bg(M,E)}A${M},${M} 0 0 ${M<0?0:1} ${w},${_+yg(M,E)}V${v-yg(E,M)}A${E},${E} 0 0 ${E<0?0:1} ${w-bg(E,M)},${v}H${S+bg(C,O)}A${C},${C} 0 0 ${C<0?0:1} ${S},${v-yg(C,O)}Z`})}function bg(e,t){return t<0?e:Math.abs(e)}function yg(e,t){return t<0?Math.abs(e):e}function Wi(e,t={}){return zh(t)||(t={...t,x:bo,y2:Ze,interval:1}),new xg(e,Tu(wC(Mu(t))))}var iD={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},aD={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},gw=class extends Je{constructor(t={}){let{anchor:r=null}=t;super(ou,void 0,t,r==null?iD:aD),this.anchor=f1(r,"anchor",["top","right","bottom","left"]),Yl(this,t),r||Wl(this,t)}render(t,r,n,o,i){let{marginTop:a,marginRight:s,marginBottom:c,marginLeft:f,width:u,height:p}=o,{anchor:l,insetTop:m,insetRight:h,insetBottom:y,insetLeft:b}=this,{rx:x,ry:g,rx1y1:S,rx1y2:w,rx2y1:_,rx2y2:v}=this,I=f+b,O=u-s-h,M=a+m,E=p-c-y;return Le(l?"svg:line":S||w||_||v?"svg:path":"svg:rect",i).datum(0).call(Dt,this,o,i).call(It,this).call(wr,this,n).call(Lt,this,{}).call(l==="left"?C=>C.attr("x1",I).attr("x2",I).attr("y1",M).attr("y2",E):l==="right"?C=>C.attr("x1",O).attr("x2",O).attr("y1",M).attr("y2",E):l==="top"?C=>C.attr("x1",I).attr("x2",O).attr("y1",M).attr("y2",M):l==="bottom"?C=>C.attr("x1",I).attr("x2",O).attr("y1",E).attr("y2",E):S||w||_||v?C=>C.call(Xl,I,M,O,E,this):C=>C.attr("x",I).attr("y",M).attr("width",O-I).attr("height",E-M).attr("rx",x).attr("ry",g)).node()}};function bw(e){return new gw(e)}var yw={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},sD=new Set(["geometry","href","src","ariaLabel","scales"]),xw=class extends Je{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&en(t)&&Bh(t)&&(r={...r,title:Ze});let{x:n,y:o,x1:i,x2:a,y1:s,y2:c,anchor:f,preferredAnchor:u="bottom",monospace:p,fontFamily:l=p?"ui-monospace, monospace":void 0,fontSize:m,fontStyle:h,fontVariant:y,fontWeight:b,lineHeight:x=1,lineWidth:g=20,frameAnchor:S,format:w,textAnchor:_="start",textOverflow:v,textPadding:I=8,title:O,pointerSize:M=12,pathFilter:E="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:i!=null&&a!=null?null:n,scale:"x",optional:!0},y:{value:s!=null&&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:O,optional:!0}},r,yw),this.anchor=Kh(f,"anchor"),this.preferredAnchor=Kh(u,"preferredAnchor"),this.frameAnchor=Na(S),this.textAnchor=kt(_,"middle"),this.textPadding=+I,this.pointerSize=+M,this.pathFilter=Ft(E),this.lineHeight=+x,this.lineWidth=+g,this.textOverflow=aw(v),this.monospace=!!p,this.fontFamily=Ft(l),this.fontSize=$t(m),this.fontStyle=Ft(h),this.fontVariant=Ft(y),this.fontWeight=Ft(b);for(let C in yw)C in this.channels&&(this[C]=yw[C]);this.splitLines=fw(this),this.clipLine=lw(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:f,fy:u}=r,{ownerSVGElement:p,document:l}=i,{anchor:m,monospace:h,lineHeight:y,lineWidth:b}=this,{textPadding:x,pointerSize:g,pathFilter:S}=this,{marginTop:w,marginLeft:_}=o,{x1:v,y1:I,x2:O,y2:M,x:E=v??O,y:C=I??M}=n,N=f?f(t.fx)-_:0,K=u?u(t.fy)-w:0,[F,T]=ci(this,o),V=X1(n,F),D=Z1(n,T),H=h?mg:pg,G=H($s),Y,W;"title"in n?(Y=wk.call(this,{title:n.channels.title},r),W=lD):(Y=wk.call(this,n.channels,r),W=pD);let Z=Le("svg:g",i).call(Dt,this,o,i).call(uw,this).call(Lt,this,{x:E&&s,y:C&&c}).call(ee=>ee.selectAll().data(t).enter().append("g").attr("transform",oe=>`translate(${Math.round(V(oe))},${Math.round(D(oe))})`).call(It,this).call(oe=>oe.append("path").attr("filter",S)).call(oe=>oe.append("text").each(function(re){let L=Vr(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let P=W.call(a,re,t,Y,r,n);if(typeof P=="string")for(let A of a.splitLines(P))q(L,{value:a.clipLine(A)});else{let A=new Set;for(let z of P){let{label:R=""}=z;R&&A.has(R)||(A.add(R),q(L,z))}}})));function q(ee,{label:oe,value:re,color:L,opacity:P}){oe??="",re??="";let A=L!=null||P!=null,z,R=b*100,[Q]=Ds(oe,R,H,G);if(Q>=0)oe=oe.slice(0,Q).trimEnd()+$s,z=re.trim(),re="";else{(oe||!re&&!A)&&(re=" "+re);let[le]=Ds(re,R-H(oe),H,G);le>=0&&(z=re.trim(),re=re.slice(0,le).trimEnd()+$s)}let X=ee.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");oe&&X.append("tspan").attr("font-weight","bold").text(oe),re&&X.append(()=>l.createTextNode(re)),A&&X.append("tspan").text(" \u25A0").attr("fill",L).attr("fill-opacity",P).style("user-select","none"),z&&X.append("title").text(z)}function ie(){let{width:ee,height:oe}=o.facet??o;Z.selectChildren().each(function(re){let{x:L,width:P,height:A}=this.getBBox();P=Math.round(P),A=Math.round(A);let z=m;if(z===void 0){let X=V(re)+N,le=D(re)+K,xe=X+P+g+x*20,ne=le+A+g+x*20;z=xe&&Me?ne&&me?a.preferredAnchor:me?"bottom":"top":ne&&me?xe?"left":"right":(xe||Me)&&(ne||me)?`${me?"bottom":"top"}-${xe?"left":"right"}`:a.preferredAnchor}let R=this.firstChild,Q=this.lastChild;if(R.setAttribute("d",fD(z,g,x,P,A)),L)for(let X of Q.childNodes)X.setAttribute("x",-L);Q.setAttribute("y",`${+cD(z,Q.childNodes.length,y).toFixed(6)}em`),Q.setAttribute("transform",`translate(${uD(z,g,x,P,A)})`)}),Z.attr("visibility",null)}return t.length&&(Z.attr("visibility","hidden"),p.isConnected?Promise.resolve().then(ie):typeof requestAnimationFrame<"u"&&requestAnimationFrame(ie)),Z.node()}};function _k(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=xo(t,r)),new xw(e,{...n,x:t,y:r})}function cD(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function uD(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 fD(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 wk(e,t){let r={},n=this.format;n=Sk(n,e,"x"),n=Sk(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=M1(e,o);a&&(r[o]=a)}}for(let o in e){if(o in r||o in n||sD.has(o)||(o==="x"||o==="y")&&e.geometry)continue;let i=M1(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]=(At(a)?Jo:$n)(i)}else if(i===void 0||i===!0){let a=t[o];this.format[o]=a?.bandwidth?Hl(a,a.domain()):si}}return r}function Sk(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 lD(e,t,{title:r}){return this.format.title(r.value[e],e)}function*pD(e,t,r,n,o){for(let i in r){if(i==="fx"||i==="fy"){yield{label:wg(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:Ik(n,r,"x"),value:vk(this.format.x2,r.x1,a,e)};else if(i==="y2"&&"y1"in r)yield{label:Ik(n,r,"y"),value:vk(this.format.y2,r.y1,a,e)};else{let s=a.value[e],c=a.scale;if(!Un(s)&&c==null)continue;yield{label:wg(n,r,i),value:this.format[i](s,e),color:c==="color"?o[i][e]:null,opacity:c==="opacity"?o[i][e]:null}}}}function vk(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 Ik(e,t,r){let n=wg(e,t,`${r}1`,r),o=wg(e,t,`${r}2`,r);return n===o?n:`${n}\u2013${o}`}function wg(e,t,r,n=r){let o=t[r],i=e[o?.scale??r];return String(i?.label??o?.label??n)}function ui(e={}){let{facet:t,style:r,title:n,subtitle:o,caption:i,ariaLabel:a,ariaDescription:s}=e,c=xu(e.className),f=e.marks===void 0?[]:Mk(e.marks);f.push(...yD(f));let u=gD(t,e),p=new Map;for(let G of f){let Y=Tk(G,u,e);Y&&p.set(G,Y)}let l=new Map;u&&Zl(l,[u],e),Zl(l,p,e);let m=Mk(xD(f,l,e));for(let G of m){let Y=Tk(G,u,e);Y&&p.set(G,Y)}f.unshift(...m);let h=BO(l,e);if(h!==void 0){let G=u?tg(h,u):void 0;for(let W of f){if(W.facet===null||W.facet==="super")continue;let Z=p.get(W);Z!==void 0&&(Z.facetsIndex=W.fx!=null||W.fy!=null?tg(h,Z):G)}let Y=new Set;for(let{facetsIndex:W}of p.values())W?.forEach((Z,q)=>{Z?.length>0&&Y.add(q)});h.forEach(0W.empty=!Y.has(Z):W=>W.empty=!1);for(let W of f)if(W.facet==="exclude"){let Z=p.get(W);Z!==void 0&&(Z.facetsIndex=qO(Z.facetsIndex))}}for(let G of Qe.keys())iu(e[G])&&G!=="fx"&&G!=="fy"&&l.set(G,[]);let y=new Map;for(let G of f){if(y.has(G))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:Y,channels:W}=p.get(G)??{},{data:Z,facets:q,channels:ie}=G.initialize(Y,W,e);vw(ie,e),y.set(G,{data:Z,facets:q,channels:ie})}let b=Gl(Zl(l,y,e),e),x=sC(b,f,e);DO(b,x);let g=$1(b),{fx:S,fy:w}=g,_=S||w?D1(b,x):x,v=S||w?MD(g,x):x,I=yu(e),O=I.document,M=Ti("svg").call(O.documentElement),E=M;I.ownerSVGElement=M,I.className=c,I.projection=WO(e,_),I.path=function(){return Lc(this.projection??tC(g))},I.filterFacets=(G,Y)=>tg(h,{channels:Y,groups:Jh(G,Y)}),I.getMarkState=G=>{let Y=y.get(G),W=p.get(G);return{...Y,channels:{...Y.channels,...W?.channels}}},I.dispatchValue=G=>{E.value!==G&&(E.value=G,E.dispatchEvent(new I.document.defaultView.Event("input",{bubbles:!0})))};let C=new Set;for(let[G,Y]of y)if(G.initializer!=null){let W=G.facet==="super"?v:_,Z=G.initializer(Y.data,Y.facets,Y.channels,g,W,I);if(Z.data!==void 0&&(Y.data=Z.data),Z.facets!==void 0&&(Y.facets=Z.facets),Z.channels!==void 0){let{fx:q,fy:ie,...ee}=Z.channels;hD(ee),Object.assign(Y.channels,ee);for(let oe of Object.values(ee)){let{scale:re}=oe;re!=null&&!FT(Qe.get(re))&&(kk(oe,e),C.add(re))}(q!=null||ie!=null)&&p.set(G,!0)}}if(C.size){let G=new Map;Zl(G,y,e,q=>C.has(q)),Zl(l,y,e,q=>C.has(q));let Y=PD(Gl(G,e),b),{scales:W,...Z}=$1(Y);Object.assign(b,Y),Object.assign(g,Z),Object.assign(g.scales,W)}let N,K;h!==void 0&&(N={x:S?.domain(),y:w?.domain()},h=GO(h,N),K=KO(S,w,x));for(let[G,Y]of y)Y.values=G.scale(Y.channels,g,I);let{width:F,height:T}=x;Vr(M).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",F).attr("height",T).attr("viewBox",`0 0 ${F} ${T}`).attr("aria-label",a).attr("aria-description",s).call(G=>G.append("style").text(`:where(.${c}) { --plot-background: white; display: block; height: auto; @@ -56,7 +56,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(wu,r);for(let B of u){let{channels:q,values:X,facets:J}=b.get(B);if(h===void 0||B.facet==="super"){let A=null;if(J&&(A=J[0],A=B.filter(A,q,X),A.length===0))continue;let K=B.render(A,g,X,v,I);if(K==null)continue;P.appendChild(K)}else{let A;for(let K of h){if(!(B.facetAnchor?.(h,N,K)??!K.empty))continue;let Y=null;if(J){let Z=p.has(B);if(Y=J[Z?K.i:0],Y=B.filter(Y,q,X),Y.length===0)continue;!Z&&Y===J[0]&&(Y=hM(Y)),Y.fx=K.x,Y.fy=K.y,Y.fi=K.i}let ee=B.render(Y,g,X,_,I);if(ee!=null){(A??=$r(P).append("g")).append(()=>ee).datum(K);for(let Z of["aria-label","aria-description","aria-hidden","transform"])ee.hasAttribute(Z)&&(A.attr(Z,ee.getAttribute(Z)),ee.removeAttribute(Z))}}A?.selectChildren().each(G)}}let z=ok(y,I,e),{figure:U=n!=null||o!=null||i!=null||z.length>0}=e;U&&(R=T.createElement("figure"),R.className=`${c}-figure`,R.style.maxWidth="initial",n!=null&&R.append(xk(T,n,"h2")),o!=null&&R.append(xk(T,o,"h3")),R.append(...z,P),i!=null&&R.append(fD(T,i)),"value"in P&&(R.value=P.value,delete P.value)),R.scale=FC(g.scales),R.legend=tk(y,I,e);let W=pC();return W>0&&$r(P).append("text").attr("x",D).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${W.toLocaleString("en-US")} warning${W===1?"":"s"}. Please check the console.`),R}function xk(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function fD(e,t){let r=e.createElement("figcaption");return r.append(t),r}function wk(e){return e.flat(1/0).filter(t=>t!=null).map(lD)}function lD(e){return typeof e.render=="function"?e:new bw(e)}var bw=class extends Ze{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function xw(e,t){for(let r in e)_k(e[r],t);return e}function _k(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:u1(a,o)}=t[r]??{};s!=null&&(e.value=We(e.value,s),e.transform=!1)}function pD(e){for(let t in e)v1(t,e[t])}function Xl(e,t,r,n=fM){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(!qC(r)){let c=r.x?.domain===void 0,u=r.y?.domain===void 0;if(c||u){let[f,p]=YC(a);c&&yw(e,"x",f),u&&yw(e,"y",p)}}}else yw(e,s,a)}return e}function yw(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function mD(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=zi(e.data);if(o==null)throw new Error("missing facet data");let i={};r!=null&&(i.fx=pu(o,{value:r,scale:"fx"})),n!=null&&(i.fy=pu(o,{value:n,scale:"fy"})),xw(i,t);let a=Xh(o,i);return{channels:i,groups:a,data:e.data}}function Sk(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let c=zi(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=pu(c,{value:n,scale:"fx"})),o!=null&&(u.fy=pu(c,{value:o,scale:"fy"})),xw(u,r),{channels:u,groups:Xh(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)&&Oa(zi(e.data))===Oa(s)&&Jr(`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 dD(e,t={}){return Bi({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function hD(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)?oO:/^y$/i.test(o)?q1:nO,n=o(dD(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===q1?"left":"bottom");let a=bk(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function gD(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||!iu(o)&&!vk("x",e))&&(m=h=null),(n||!iu(i)&&!vk("y",e))&&(b=y=null),t.has("fx")||(x=g=null),t.has("fy")||(S=w=null),m===void 0&&(m=!wg(e,"x")),b===void 0&&(b=!wg(e,"y")),x===void 0&&(x=!wg(e,"fx")),S===void 0&&(S=!wg(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 xg(_,w,VO,s),bg(_,S,AO,"right","left",f,s),xg(_,g,UO,a),bg(_,x,FO,"top","bottom",f,a),xg(_,y,LO,i),bg(_,b,fw,"left","right",r,i),xg(_,h,jO,o),bg(_,m,lw,"bottom","top",r,o),_}function bg(e,t,r,n,o,i,a){if(!t)return;let s=yD(t);a=bD(s?n:t,i,a);let{line:c}=a;(r===fw||r===lw)&&c&&!Cs(c)&&e.push(dw(xD(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function xg(e,t,r,n){!t||Cs(t)||e.push(r(wD(t,n)))}function yD(e){return/^\s*both\s*$/i.test(e)}function bD(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 xD(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function wD(e,{stroke:t=uu(e)?e:void 0,ticks:r=SD(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function SD(e){switch(typeof e){case"number":return!0;case"string":return!uu(e)}return Qr(e)||typeof e?.range=="function"}function wg(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function vk(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 vD(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 ID({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=Yh(r),u=e&&Ik(e),f=t&&Ik(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 Ik(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 n{let H=Dl(dt(ne,g),$?.[S]),E=dt(ne,T),re=dt(ne,J),oe=dt(ne,A),be=VM(c,{z:E,fill:re,stroke:oe}),we=[],Ve=[],ie=H&&_([]),fe=E&&X([]),Qe=re&&Y([]),ht=oe&&Z([]),ot=e&&p([]),Vt=e&&m([]),In=t&&b([]),Zi=t&&x([]),nn=AD(e,t,ne),zr=0;for(let qt of c)qt.initialize(ne);a&&a.initialize(ne),i&&i.initialize(ne);for(let qt of M){let ja=[];for(let ko of c)ko.scope("facet",qt);a&&a.scope("facet",qt),i&&i.scope("facet",qt);for(let[ko,Ua]of x1(qt,be))for(let[$u,_n]of x1(Ua,H))for(let[le,he]of nn(_n))if(be&&(he.z=ko),!(i&&!i.reduce(le,he))){ja.push(zr++),Ve.push(o.reduceIndex(le,ne,he)),H&&ie.push($u),E&&fe.push(be===E?ko:E[(le.length>0?le:_n)[0]]),re&&Qe.push(be===re?ko:re[(le.length>0?le:_n)[0]]),oe&&ht.push(be===oe?ko:oe[(le.length>0?le:_n)[0]]),ot&&(ot.push(he.x1),Vt.push(he.x2)),In&&(In.push(he.y1),Zi.push(he.y2));for(let Se of c)Se.reduce(le,he);a&&a.reduce(le,he)}we.push(ja)}return jM(we,a,s),{data:Ve,facets:we}}),...!Vl(c,"x")&&(f?{x1:f,x2:l,x:$l(f,l)}:{x:v,x1:C,x2:N}),...!Vl(c,"y")&&(h?{y1:h,y2:y,y:$l(h,y)}:{y:I,y1:G,y2:D}),...w&&{[S]:w},...Object.fromEntries(c.map(({name:ne,output:M})=>[ne,M]))}}function CD({cumulative:e,domain:t,thresholds:r,interval:n,...o},i){return[o,{cumulative:e,domain:t,thresholds:r,interval:n,...i}]}function OD(e,{cumulative:t,domain:r,thresholds:n,interval:o},i){return e={...oi(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=o),e.value===void 0&&(e.value=i),e.thresholds=kD(e.thresholds,e.interval),e}function Tk(e){if(e==null)return;let{value:t,cumulative:r,domain:n=Yt,thresholds:o}=e,i=a=>{let s=dt(a,t),c;if(Et(s)||ED(o)){s=We(s,a1,Float64Array);let[f,p]=typeof n=="function"?n(s):n,l=typeof o=="function"&&!ka(o)?o(s,f,p):o;typeof l=="number"&&(l=cl(f,p,l)),ka(l)&&(n===Yt&&(f=l.floor(f),p=l.offset(l.floor(p))),l=l.range(f,l.offset(p))),c=l}else{s=ti(s);let[f,p]=typeof n=="function"?n(s):n,l=typeof o=="function"&&!ka(o)?o(s,f,p):o;if(typeof l=="number")if(n===Yt){let m=ts(f,p,l);if(isFinite(m))if(m>0){let h=Math.round(f/m),b=Math.round(p/m);h*m<=f||--h,b*m>p||++b;let y=b-h+1;l=new Float64Array(y);for(let x=0;xp||++b;let y=b-h+1;l=new Float64Array(y);for(let x=0;x0?FD:Sw)(u,c,s),u};return i.label=xo(t),i}function kD(e,t,r=Mk){if(e===void 0)return t===void 0?r:ni(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return qp;case"scott":return mf;case"sturges":return zp;case"auto":return Mk}return Al(e)}return e}function ND(e,t){return LM(e,t,Ok)}function Ok(e,t,r){return y1(e,t,r,kk)}function kk(e,t,r){return b1(e,t,r,Nk)}function Nk(e,t){return jl(e,t,RD)}function RD(e){switch(`${e}`.toLowerCase()){case"x":return DD;case"x1":return VD;case"x2":return jD;case"y":return LD;case"y1":return UD;case"y2":return zD;case"z":return UM}throw new Error(`invalid bin reduce: ${e}`)}function Mk(e,t,r){return Math.min(200,mf(e,t,r))}function ED(e){return bM(e)||Qr(e)&&Et(e)}function AD(e,t,r){let n=e?.(r),o=t?.(r);return n&&o?function*(i){let a=n.bin(i);for(let[s,[c,u]]of n.entries()){let f=o.bin(a[s]);for(let[p,[l,m]]of o.entries())yield[f[p],{data:r,x1:c,y1:l,x2:u,y2:m}]}}:n?function*(i){let a=n.bin(i);for(let[s,[c,u]]of n.entries())yield[a[s],{data:r,x1:c,x2:u}]}:function*(i){let a=o.bin(i);for(let[s,[c,u]]of o.entries())yield[a[s],{data:r,y1:c,y2:u}]}}function Sw(e,t,r){return t=ti(t),n=>{let o=e.map(()=>[]);for(let i of n)o[Ii(t,r[i])-1]?.push(i);return o}}function FD(e,t,r){let n=Sw(e,t,r);return o=>{let i=n(o);for(let a=1,s=i.length;a{let i=n(o);for(let a=i.length-2;a>=0;--a){let s=i[a+1],c=i[a];for(let u of s)c.push(u)}return i}}function Rk(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var DD={reduceIndex(e,t,{x1:r,x2:n}){return Rk(r,n)}},LD={reduceIndex(e,t,{y1:r,y2:n}){return Rk(r,n)}},VD={reduceIndex(e,t,{x1:r}){return r}},jD={reduceIndex(e,t,{x2:r}){return r}},UD={reduceIndex(e,t,{y1:r}){return r}},zD={reduceIndex(e,t,{y2:r}){return r}};var BD={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Sg=class extends Ze{constructor(t,r={}){let{x1:n,y1:o,x2:i,y2:a,z:s,curve:c,tension:u}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0},z:{value:su(r),optional:!0}},r,BD),this.z=s,this.curve=ww(c,u)}filter(t){return t}render(t,r,n,o,i){let{x1:a,y1:s,x2:c=a,y2:u=s}=n;return De("svg:g",i).call($t,this,o,i).call(Dt,this,r,0,0).call(f=>f.selectAll().data(ng(t,[a,s,c,u],this,n)).enter().append("path").call(It,this).call(rg,this,n).attr("d",Sx().curve(this.curve).defined(p=>p>=0).x0(p=>a[p]).y0(p=>s[p]).x1(p=>c[p]).y1(p=>u[p]))).node()}};function vw(e,t){let{x:r=ei,...n}=Ck(t);return new Sg(e,Mu(Tu({...n,x1:r,x2:void 0},r===ei?"y2":"y")))}var GD={ariaLabel:"bar"},Iw=class extends Ze{constructor(t,r,n={},o=GD){super(t,r,n,o),Hl(this,n),Yl(this,n)}render(t,r,n,o,i){let{rx:a,ry:s,rx1y1:c,rx1y2:u,rx2y1:f,rx2y2:p}=this,l=this._x(r,n,o),m=this._y(r,n,o),h=this._width(r,n,o),b=this._height(r,n,o);return De("svg:g",i).call($t,this,o,i).call(this._transform,this,r).call(y=>y.selectAll().data(t).enter().call(c||u||f||p?x=>x.append("path").call(It,this).call(Wl,l,m,Ek(l,h),Ek(m,b),this).call(yr,this,n):x=>x.append("rect").call(It,this).attr("x",l).attr("width",h).attr("y",m).attr("height",b).call(de,"rx",a).call(de,"ry",s).call(yr,this,n))).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:o}=this;return r?i=>r[i]+o:n+o}_y(t,{y:r},{marginTop:n}){let{insetTop:o}=this;return r?i=>r[i]+o:n+o}_width({x:t},{x:r},{marginRight:n,marginLeft:o,width:i}){let{insetLeft:a,insetRight:s}=this,c=r&&t?t.bandwidth():i-n-o;return Math.max(0,c-a-s)}_height({y:t},{y:r},{marginTop:n,marginBottom:o,height:i}){let{insetTop:a,insetBottom:s}=this,c=r&&t?t.bandwidth():i-n-o;return Math.max(0,c-a-s)}};function Ek(e,t){return typeof e=="function"&&typeof t=="function"?r=>e(r)+t(r):typeof e=="function"?r=>e(r)+t:typeof t=="function"?r=>e+t(r):e+t}var vg=class extends Iw{constructor(t,r={},n){let{x:o,y1:i,y2:a}=r;super(t,{y1:{value:i,scale:"y"},y2:{value:a,scale:"y"},x:{value:o,scale:"x",type:"band",optional:!0}},r,n)}_transform(t,r,{y:n}){t.call(Dt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:o}){let{insetTop:i}=this;return wo(t)?o+i:a=>Math.min(r[a],n[a])+i}_height({y:t},{y1:r,y2:n},{marginTop:o,marginBottom:i,height:a}){let{insetTop:s,insetBottom:c}=this;return wo(t)?a-o-i-s-c:u=>Math.max(0,Math.abs(n[u]-r[u])-s-c)}};function _w(e,t={}){return Dh(t)||(t={...t,x:ei,y2:nt}),new vg(e,Mu(ag(Tu(t))))}var KD={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function qD(e){return e.sort===void 0&&e.reverse===void 0?FM({channel:"-r"},e):e}var Ig=class extends Ze{constructor(t,r={}){let{x:n,y:o,r:i,rotate:a,symbol:s=Vi,frameAnchor:c}=r,[u,f]=Ct(a,0),[p,l]=RM(s),[m,h]=Ct(i,p==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:m,scale:"r",filter:Ts,optional:!0},rotate:{value:u,optional:!0},symbol:{value:p,scale:"auto",optional:!0}},qD(r),KD),this.r=h,this.rotate=f,this.symbol=l,this.frameAnchor=Na(c);let{channels:b}=this,{symbol:y}=b;if(y){let{fill:x,stroke:g}=b;y.hint={fill:x?x.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===y.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:u,r:f,rotate:p,symbol:l}=n,{r:m,rotate:h,symbol:b}=this,[y,x]=si(this,o),g=b===Vi,S=f?void 0:m*m*Math.PI;return eu(m)&&(t=[]),De("svg:g",i).call($t,this,o,i).call(Dt,this,{x:c&&a,y:u&&s}).call(w=>w.selectAll().data(t).enter().append(g?"circle":"path").call(It,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",vu`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=po();return l[v].draw(I,f[v]*f[v]*Math.PI),I}:f?v=>{let I=po();return b.draw(I,f[v]*f[v]*Math.PI),I}:l?v=>{let I=po();return l[v].draw(I,S),I}:(()=>{let v=po();return b.draw(v,S),v})())}).call(yr,this,n)).node()}};function Ls(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=bo(t,r)),new Ig(e,{...n,x:t,y:r})}var HD={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},_g=class extends Ze{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:su(r),optional:!0}},r,HD),this.z=i,this.curve=Pk(a,s),Kl(this,r)}filter(t){return t}project(t,r,n){this.curve!==Zl&&super.project(t,r,n)}render(t,r,n,o,i){let{x:a,y:s}=n,{curve:c}=this;return De("svg:g",i).call($t,this,o,i).call(Dt,this,r).call(u=>u.selectAll().data(ng(t,[a,s],this,n)).enter().append("path").call(It,this).call(rg,this,n).call(cO,this,n,i).attr("d",c===Zl&&i.projection?YD(i.path(),a,s):yl().curve(c).defined(f=>f>=0).x(f=>a[f]).y(f=>s[f]))).node()}};function YD(e,t,r){return t=ti(t),r=ti(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 Zt(e,{x:t,y:r,...n}={}){return[t,r]=bo(t,r),new _g(e,{...n,x:t,y:r})}Ze.prototype.plot=function({marks:e=[],...t}={}){return ci({...t,marks:[...e,this]})};var WD=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],Ak={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function XD(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 ZD(e){let r=[...new Set(e.data.map(m=>m.model))].length>1,n=r?WD:["#000000"],o=e.data.map(m=>({...m,tooltip:XD(m,r)})),i=[];e.references?.some(m=>m.type==="identity")&&i.push(Zt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(Zt(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(Ls(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=ci({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:Ak,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=ci({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:Ak,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:[Yi(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 QD=0,$k=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],Or={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:$k,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 JD(e){let t=e.theme??{};return{...Or,width:e.width??Or.width,height:e.height??Or.height,background:t.background??Or.background,colors:e.colors??Or.colors,margins:{...Or.margins,...t.margins},frame:{...Or.frame,...t.frame},typography:{...Or.typography,...t.typography},axis:{...Or.axis,...t.axis},line:{...Or.line,...t.line},marker:{...Or.marker,...t.marker},reference:{...Or.reference,...t.reference},legend:{...Or.legend,...t.legend},tip:{...Or.tip,...t.tip},predictionDistribution:{...Or.predictionDistribution,...t.predictionDistribution}}}function en(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,c)=>`group-${c+1}`):[...e]),n=JD(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 Dk(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 eL(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 Cu(e,t,r,n,o){let i=Ql(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=en(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=eL(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 Us(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=Dk(e);if(i.length===0)return r(e,void 0);let a=en(Ql(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-${++QD}`,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 tL(e){return new Map(e.series.map(t=>[t.id,t.display]))}function Ql(e){return[...new Set(e.series.map(t=>t.display.group))]}function Pg(e,t){let r=tL(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}var rL={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"},nL=new Set(["true_positives","true_negatives","false_positives","false_negatives","predicted_positives"]);function oL(e,t,r){if(t!=null)return nL.has(e)&&Number.isInteger(t)?String(t):t.toFixed(r)}function $a(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=rL[a]??a,u=oL(a,s,r);u!==void 0&&i.push([c,u])}return i}function ze(e,t){if(e!=null)return typeof e=="number"?e.toFixed(t):String(e)}function Lt(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` -`)}function Tg(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 Fa(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 Tw(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(Zt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",...r})):o.type==="horizontal"&&o.value!==void 0?n.push(vo([o.value],{...r})):o.type==="path"&&o.points&&n.push(Zt(o.points,{x:"x",y:"y",...r}));return n}function Mg(e,t){return e}function iL(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 Ls(i,{ariaLabel:"ordinary-point",x:t,y:r,fill:"group",stroke:c,strokeWidth:u,r:s})}function ku(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 Ls(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:c,r:u})}function aL(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 sL(e){let t=hn(e);if(!t)return"#ffffff";let r=t.rgb(),n=aL(r.r,r.g,r.b),o=(1+.05)/(n+.05);return(n+.05)/(0+.05)>=o?"#000000":"#ffffff"}function zs(e,t){let r=typeof SVGSVGElement<"u"&&e instanceof SVGSVGElement?e:e.querySelector("svg[class^='plot-']")??e.querySelector("svg");if(!r)return;let n=$r(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(([,Y])=>Y!=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":sL(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(([Y,ee],Z)=>{let ne=p.append("tspan").attr("x","0").attr("dy",Z===0?"1em":I?"1.3em":"1.2em"),M=Y!==""&&Y!==null&&Y!==void 0,$=ee!==""&&ee!==null&&ee!==void 0;M&&$?(ne.append("tspan").attr("font-weight","bold").text(`${Y}: `),ne.append("tspan").attr("font-weight","normal").text(String(ee))):M?ne.append("tspan").attr("font-weight","bold").text(String(Y)):$&&ne.append("tspan").attr("font-weight","normal").text(String(ee))});let C=p.node();if(!C)return;let N=C.getBBox(),G=8,D=6,O=Math.max(N.width+G*2,60),z=N.height+D*2,[U,W]=ma(y,r),B=r?.viewBox?.baseVal,q=B&&B.width>0?B.width:r?.width?.baseVal?.value||t.theme.width,X=B&&B.height>0?B.height:r?.height?.baseVal?.value||t.theme.height,J=t.theme.margins,A=U+12;A+O>q-J.right&&(A=U-12-O),AX-J.bottom&&(K=X-J.bottom-z),I){let Y=A>U?A:A+O;u.attr("d",`M${U},${W} L${Y},${W-6} L${Y},${W+6} Z`).attr("fill",T).attr("stroke",R).attr("stroke-width",1)}else u.attr("d",null);f.attr("x",A).attr("y",K).attr("width",O).attr("height",z).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(${A+G-N.x}, ${K+D-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]=ma(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,C=t.xDomain?t.xDomain[0]:0,N=t.xDomain?t.xDomain[1]:1,G;if(typeof o.invert=="function")G=o.invert(T);else{let U=R!==P?(T-P)/(R-P):0;G=C+U*(N-C)}let D=Math.max(w,Math.min(_,G)),O=js(D),z=[[y.label,""],["Predicted",O],["Observed",O]];l(I,z,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]=ma(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 cL=100;function js(e){if(!Number.isFinite(e))return String(e);let t=Math.round(e*1e3)/1e3;return String(t)}function Fk(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 uL(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:Fk(r,t.x),y:Fk(n,t.y)}}function Pw(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 qn(e,t){let r=ci(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 fL=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],lL=["sensitivity","ppv","specificity","false_positive_rate","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],pL=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],mL=["lift","sensitivity","specificity","false_positive_rate","ppv","npv","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function dL(e,t={},r){Si(e);let n=en(Ql(e),t),{theme:o,colorByGroup:i}=n,a=e.operatingPoint?.dimension,s=Pg(e,e.data).map(x=>{let g=1-x.specificity,S=[["Series",x.label]];return a==="ppcr"?(x.ppcr!==void 0&&S.push(["PPCR",ze(x.ppcr,o.tip.digits)]),S.push(["Cutoff",ze(x.cutoff,o.tip.digits)])):(S.push(["Cutoff",ze(x.cutoff,o.tip.digits)]),x.ppcr!==void 0&&S.push(["PPCR",ze(x.ppcr,o.tip.digits)])),x.performance&&x.performance.length>0?S.push(["Sensitivity",ze(x.sensitivity,o.tip.digits)],["Specificity",ze(x.specificity,o.tip.digits)],["FPR",ze(g,o.tip.digits)],...$a(x.performance,fL,o.tip.digits,new Set(["sensitivity","specificity","false_positive_rate"]))):S.push(["Sensitivity",ze(x.sensitivity,o.tip.digits)],["Specificity",ze(x.specificity,o.tip.digits)],["False Positive Rate",ze(g,o.tip.digits)]),{...x,false_positive_rate:g,tooltipFields:S,title:Lt(o.tip.digits,S)}}),c=Tw(e,o);c.push(Zt(s,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0}),Ou(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(ku(u,"false_positive_rate","sensitivity",n,t.theme))}let f=e.xAxis.domain??[0,1],p=e.yAxis.domain??[0,1],l=Pw(o.width,o.margins,f,p),m=qn({...Tg(n,e),height:l,x:Fa(o,e.xAxis.label,f),y:Fa(o,e.yAxis.label,p),marks:Mg(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 zs(m,{items:h,selectedOperatingPointItems:b,references:y,theme:o}),m}function Mw(e,t={}){return Cu(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>Us(a,n,(u,f)=>dL(u,n,f),s,c),o,i))}function hL(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=$r(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(([,W])=>W!=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(([W,B],q)=>{let X=u.append("tspan").attr("x","0").attr("dy",q===0?"1em":"1.2em"),J=W!==""&&W!==null&&W!==void 0,A=B!==""&&B!==null&&B!==void 0;J&&A?(X.append("tspan").attr("font-weight","bold").text(`${W}: `),X.append("tspan").attr("font-weight","normal").text(String(B))):J?X.append("tspan").attr("font-weight","bold").text(String(W)):A&&X.append("tspan").attr("font-weight","normal").text(String(B))});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]=ma(b,n),C=n?.viewBox?.baseVal,N=C&&C.width>0?C.width:n?.width?.baseVal?.value||r.theme.width,G=C&&C.height>0?C.height:n?.height?.baseVal?.value||r.theme.height,D=r.theme.margins,O=P+12;O+I>N-D.right&&(O=P-12-I),OG-D.bottom&&(z=G-D.bottom-T);let U=O>P?O:O+I;s.attr("d",`M${P},${R} L${U},${R-6} L${U},${R+6} Z`).attr("fill",x).attr("stroke","#ffffff").attr("stroke-width",1),c.attr("x",O).attr("y",z).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(${O+_-w.x}, ${z+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=js(g),_=js(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),C=Math.min(P,R),N=Math.max(Math.abs(R-P),2),G=0,D=r.height??r.theme.height;if(m){let O=m.apply(0),z=m.apply(b.count);G=Math.min(O,z),D=Math.max(Math.abs(O-z),4)}l.append("rect").attr("class","rtichoke-hover-hist-target").attr("x",C).attr("width",N).attr("y",G).attr("height",D).attr("fill","transparent").style("pointer-events","all").on("pointermove",O=>f(O,T,r.colorByGroup.get(b.group)??"#1b9e77")).on("mouseleave pointerleave",p)}o.on("mouseleave pointerleave",p)}function gL(e,t,r,n){Si(e);let o=en(Ql(e),t),{theme:i,colorByGroup:a}=o,s=Pg(e,e.data).map(P=>{let R=[];o.groups.length>1&&R.push([P.label,""]);let C=js(P.predicted),N=js(P.observed);if(P.method==="discrete"&&P.events!==void 0&&P.total!==void 0){let G=Number.isInteger(P.events)?String(P.events):js(P.events),D=Number.isInteger(P.total)?String(P.total):js(P.total);N+=` ( ${G} / ${D} )`}return R.push(["Predicted",C]),R.push(["Observed",N]),{...P,tooltipFields:R}}),c=Tw(e,i);c.push(Zt(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(Ls(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=cL,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 D=378.3;y=Math.round(N);let O=550,z=Math.max(50,O-40),U=Math.max(50,D),W=Math.abs(l[1]-l[0])||1,B=Math.abs(p[1]-p[0])||1,q=Math.min(z/W,U/B),X=W*q,J=B*q,A=Math.max(10,(O-X)/2),K=Math.max(10,O-X-A),Y=Math.max(0,D-J),ee=25+Y/2;y=Math.round(N)+Y/2,m=550-h,b={...i,width:O,margins:{top:ee,left:A,right:K,bottom:y}}}else f?(y=8,m=Pw(i.width,i.margins,l,p,y)):m=Pw(i.width,i.margins,l,p,i.margins.bottom);let g={...o,theme:b},S=qn({...Tg(g,e),height:m,marginBottom:y,x:f?{...Fa(b,e.xAxis.label,l),axis:null,label:null}:Fa(b,e.xAxis.label,l),y:Fa(b,e.yAxis.label,p),marks:Mg(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 C=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]));C<=N&&_.push({type:"identity",points:[{x:C,y:C},{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(zs(S,{items:w,references:_,theme:b,tooltipStyle:"plotly",xDomain:l,yDomain:p}),!f||!e.distribution)return S;let v=Pg(e,e.distribution),I=qn({...Tg(g,e),height:h,marginTop:0,marginBottom:x,x:Fa(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:Mg([Yi(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",hL(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 Lk(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=uL(e,o),a=s=>{let c=gL(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 yL(e,t={}){return Lk(e,t,!1)}function Vk(e){return Lk(e,{},!0)}function bL(e,t,r,n,o){Si(e);let i=en(Ql(e),t),{theme:a,colorByGroup:s}=i,c=e.operatingPoint?.dimension,u=Pg(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",ze(x.ppcr,a.tip.digits)]),g.push(["Cutoff",ze(x.cutoff,a.tip.digits)])):(g.push(["Cutoff",ze(x.cutoff,a.tip.digits)]),x.ppcr!==void 0&&g.push(["PPCR",ze(x.ppcr,a.tip.digits)])),g.push(["Sensitivity",ze(x.sensitivity,a.tip.digits)],["PPV",ze(x.ppv,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...$a(x.performance,lL,a.tip.digits,new Set(["sensitivity","ppv"])))):e.type==="gains"?(c==="probability_threshold"?(g.push(["Cutoff",ze(x.cutoff,a.tip.digits)]),g.push(["PPCR",ze(x.ppcr,a.tip.digits)])):(g.push(["PPCR",ze(x.ppcr,a.tip.digits)]),g.push(["Cutoff",ze(x.cutoff,a.tip.digits)])),g.push(["Sensitivity",ze(x.sensitivity,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...$a(x.performance,pL,a.tip.digits,new Set(["sensitivity"])))):e.type==="lift"&&(c==="probability_threshold"?(g.push(["Cutoff",ze(x.cutoff,a.tip.digits)]),g.push(["PPCR",ze(x.ppcr,a.tip.digits)])):(g.push(["PPCR",ze(x.ppcr,a.tip.digits)]),g.push(["Cutoff",ze(x.cutoff,a.tip.digits)])),g.push(["Lift",ze(x.lift,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...$a(x.performance,mL,a.tip.digits,new Set(["lift"])))),{...y,tooltipFields:g,title:Lt(a.tip.digits,g)}}),f=Tw(e,a);f.push(Zt(u,{x:r,y:n,z:"seriesId",stroke:"group",strokeWidth:a.line.width,strokeDasharray:a.line.dash??void 0}),Ou(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(ku(p,r,n,i,t.theme))}let l=qn({...Tg(i,e),x:Fa(a,e.xAxis.label,e.xAxis.domain),y:Fa(a,e.yAxis.label,e.yAxis.domain),marks:Mg(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 zs(l,{items:m,selectedOperatingPointItems:h,references:b,theme:a}),l}function xL(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function wL(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 Nu(e,t,r,n){let o=xL(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(wL(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 Cw(e,t,r,n){return Cu(e,t,(o,i,a,s)=>Nu(o,(c,u,f)=>Us(c,i,(p,l)=>bL(p,i,r,n,l),u,f),a,s))}function Ow(e,t={}){return Cw(e,t,"sensitivity","ppv")}function kw(e,t={}){return Cw(e,t,"ppcr","sensitivity")}function Nw(e,t={}){return Cw(e,t,"ppcr","lift")}var SL=["net_benefit","ppcr","sensitivity","specificity","false_positive_rate","ppv","npv","lift","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function Rw(e,t={}){return Si(e),Cu(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>Us(a,n,(u,f)=>vL(u,n,f),s,c),o,i))}function vL(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=en(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",ze(g.threshold,i.tip.digits)],["Net Benefit",ze(g.netBenefit,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...$a(g.performance,SL,i.tip.digits,new Set(["net_benefit"]))),{...g,group:s.get(g.seriesId).group,label:s.get(g.seriesId).label,tooltipFields:S,title:Lt(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(vo([0],{...f})):p.push(Zt(g.points,{x:"x",y:"y",...f}));p.push(Zt(u,{x:"threshold",y:"netBenefit",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Ou(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(ku(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=qn({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 zs(h,{items:b,selectedOperatingPointItems:y,references:x,theme:i}),h}var IL=["net_benefit_interventions_avoided","net_benefit","predicted_positives","ppcr","true_negatives","false_negatives"];function Ew(e,t={}){return Si(e),Cu(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>Us(a,n,(u,f)=>_L(u,n,f),s,c),o,i))}function _L(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=en(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",ze(g.threshold,i.tip.digits)],["Interventions Avoided",ze(g.interventionsAvoided,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...$a(g.performance,IL,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:Lt(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(vo([0],{...f})):p.push(Zt(g.points,{x:"x",y:"y",...f}));p.push(Zt(u,{x:"threshold",y:"interventionsAvoided",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Ou(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(ku(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=qn({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 zs(h,{items:b,selectedOperatingPointItems:y,references:x,theme:i}),h}var PL=0,TL=0,jk={real_positive:"Event",target_event:"Event",real_competing:"Competing event",competing_outcome:"Competing event",real_negative:"Event-free",no_target_event:"Event-free",real_censored:"Censored",unknown:"Censored"},Uk={real_positive:"#4C5454",real_positives_est:"#4C5454",target_event:"#4C5454",real_competing:"#C880B7",real_competing_est:"#C880B7",competing_outcome:"#C880B7",real_negative:"#E0E0E0",real_negatives_est:"#E0E0E0",no_target_event:"#E0E0E0",real_censored:"#E3F09B",real_censored_est:"#E3F09B",unknown:"#E3F09B"},zk=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"];function ML(e,t){return t&&t.trim()!==""?t:jk[e]?jk[e]:e}function Bk(e){let t=e.horizon??0,r=e.states,n=!1,o=!1,i=!1;for(let u of r)u.estimate!==void 0&&u.estimate!==null&&(n=!0),u.mass!==void 0&&u.mass!==null&&(o=!0),u.count!==void 0&&u.count!==null&&(i=!0);let a=null,s=null;o&&(a=r.reduce((u,f)=>u+(f.mass!==void 0&&f.mass!==null?f.mass:0),0)),i&&(s=r.reduce((u,f)=>u+(f.count!==void 0&&f.count!==null?f.count:0),0));let c=r.map(u=>{let f=ML(u.stateId,u.label),p=0;return n&&u.estimate!==void 0&&u.estimate!==null?p=u.estimate:o&&u.mass!==void 0&&u.mass!==null&&a&&a>0?p=u.mass/a:i&&u.count!==void 0&&u.count!==null&&s&&s>0&&(p=u.count/s),{stateId:u.stateId,label:f,proportion:p,percentage:p*100,estimate:u.estimate??null,mass:u.mass??null,count:u.count??null}});return{evaluationId:e.evaluationId,horizon:t,estimator:e.estimator,estimateOrigin:e.estimateOrigin,censoringHeuristic:e.censoringHeuristic,competingHeuristic:e.competingHeuristic,states:c,totalMass:a,totalCount:s}}function Gk(e,t,r,n,o,i){let a=[];a.push([i?"Time":"Horizon",e]),a.push(["Outcome status",t.label]);let s=t.count??t.mass,c=r??n;return s!=null&&a.push(["Count",s]),a.push(["Percent",`${t.percentage.toFixed(1)}%`]),c!=null&&a.push(["Denominator",c]),a.push(["Accounting","Raw observed status"]),(t.stateId==="real_censored"||t.label.toLowerCase().includes("censored"))&&a.push(["Note","Censored before horizon; no censoring adjustment is applied."]),Lt(o,a)}function Aw(e,t={}){mb(e);let r=++PL,n=en(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=document.createElement("div");s.className="rtichoke-outcome-distribution",s.style.width=`${o.width}px`,s.style.maxWidth="100%";let c=e.title??"Outcome Distribution",u=document.createElement("h3");u.className="rtichoke-outcome-distribution__title",u.textContent=c,s.append(u);let f=document.createElement("div");f.className="rtichoke-outcome-distribution__controls",s.append(f);let p=document.createElement("div");p.className="rtichoke-outcome-distribution__readout",s.append(p);let l=document.createElement("div");l.className="rtichoke-operating-point-control",l.style.marginLeft=`${o.margins.left}px`,l.style.marginRight=`${o.margins.right}px`;let m=`rtichoke-od-slider-${++TL}`,h=document.createElement("label");h.className="rtichoke-operating-point-label",h.htmlFor=m;let b=document.createElement("span"),y=document.createElement("span");y.className="rtichoke-operating-point-value",h.append(b,y);let x=document.createElement("input");x.type="range",x.id=m,x.className="rtichoke-operating-point-slider",l.append(h,x);let g=document.createElement("div");g.className="rtichoke-legend",g.style.paddingLeft=`${o.margins.left}px`;let S=document.createElement("div");S.className="rtichoke-outcome-distribution__chart",s.append(l,g,S);let w=new Map,_=0,v=(P,R)=>{let C=`${P}:${R}`;if(w.has(C))return w.get(C);if(Uk[P]){let G=Uk[P];return w.set(C,G),G}let N=zk[_%zk.length];return _++,w.set(C,N),N},I=null,T=()=>{if(f.replaceChildren(),e.evaluations.length>1){let A=document.createElement("div");A.className="rtichoke-pd-radio-group",A.setAttribute("role","radiogroup"),A.setAttribute("aria-label","Evaluation");let K=document.createElement("span");K.className="rtichoke-pd-radio-group-label",K.textContent="Evaluation:",A.append(K);let Y=document.createElement("div");Y.className="rtichoke-pd-radio-options";for(let ee of e.evaluations){let Z=ee.label??ee.model??ee.population??ee.id,ne=document.createElement("label");ne.className="rtichoke-pd-radio-option";let M=document.createElement("input");M.type="radio",M.name=`od-eval-${r}`,M.value=ee.id,M.checked=ee.id===a,M.addEventListener("change",()=>{M.checked&&(a=ee.id,I=null,T())});let $=document.createElement("span");$.textContent=Z,ne.append(M,$),Y.append(ne)}A.append(Y),f.append(A)}let P=e.stateDistributions.filter(A=>A.evaluationId===a);if(P.length===0){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let A=document.createElement("p");A.className="rtichoke-outcome-distribution__empty",A.textContent="No state distribution data available.",S.append(A);return}let R=new Set,C=!1;for(let A of P){let Y=`${A.estimateOrigin??"unspecified"}:${A.horizon??0}`;if(R.has(Y)){C=!0;break}R.add(Y)}if(C){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let A=document.createElement("p");A.className="rtichoke-outcome-distribution__empty",A.textContent="Multiple heuristic/method variants detected for evaluation; unsupported data state.",S.append(A);return}let N=P.filter(A=>A.estimateOrigin==="event_table").map(Bk).sort((A,K)=>A.horizon-K.horizon),G=P.filter(A=>A.estimateOrigin==="fixed_time_horizon").map(Bk).sort((A,K)=>A.horizon-K.horizon),D=Array.from(new Set(G.map(A=>A.horizon))).sort((A,K)=>A-K);if(N.length===0&&G.length===0){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let A=document.createElement("p");A.className="rtichoke-outcome-distribution__empty",A.textContent="No outcome distribution data found for current selection.",S.append(A);return}let O=N.length>0;if(D.length>0){l.style.display="flex",(I===null||!D.includes(I))&&(I=D[D.length-1]);let A=D.indexOf(I);x.min="0",x.max=String(Math.max(0,D.length-1)),x.step="1",x.value=String(Math.max(0,A)),b.textContent="Time: ",y.textContent=I.toFixed(i),x.setAttribute("aria-label","Time horizon"),x.setAttribute("aria-valuetext",I.toFixed(i))}else l.style.display="none";p.replaceChildren();let z=G.find(A=>A.horizon===I)??N.find(A=>A.horizon===I);if(z){let A=document.createElement("div");A.className="rtichoke-outcome-distribution__readout-card";let K=document.createElement("div");K.className="rtichoke-outcome-distribution__readout-header",K.textContent=`Active Horizon: Time = ${z.horizon.toFixed(i)}`,A.append(K);let Y=document.createElement("table");Y.className="rtichoke-outcome-distribution__readout-table";let ee=document.createElement("thead"),Z=document.createElement("tr"),ne=document.createElement("th");ne.textContent="Outcome";let M=document.createElement("th");M.textContent="Count / Total (%)",Z.append(ne,M),ee.append(Z),Y.append(ee);let $=document.createElement("tbody"),H=z.totalCount??z.totalMass;for(let E of z.states){let re=document.createElement("tr"),oe=document.createElement("td"),be=document.createElement("span");be.className="rtichoke-performance-table__badge";let we=v(E.stateId,E.label);be.style.backgroundColor=we,oe.append(be,document.createTextNode(E.label));let Ve=document.createElement("td");Ve.className="rtichoke-outcome-distribution__readout-cell";let ie=document.createElement("div");ie.className="rtichoke-performance-table__bar";let fe=document.createElement("div");fe.className="rtichoke-performance-table__bar-fill",fe.style.backgroundColor=we,fe.style.opacity="0.45";let Qe=Math.min(Math.max(E.percentage,0),100);fe.style.width=`${Qe}%`,ie.append(fe);let ht=document.createElement("span");ht.className="rtichoke-performance-table__cell-text";let ot=E.count??E.mass;ot!=null&&H!==null&&H!==void 0?ht.textContent=`${ot.toLocaleString()} / ${H.toLocaleString()} (${E.percentage.toFixed(1)}%)`:ht.textContent=`${E.percentage.toFixed(1)}%`,Ve.append(ie,ht),re.append(oe,Ve),$.append(re)}Y.append($),A.append(Y),p.append(A)}g.replaceChildren(),g.style.display="flex";let U=document.createElement("span");U.style.fontWeight="600",U.style.marginRight="0.5rem",U.textContent="Outcome:",g.append(U);let W=new Map,B=O?N:G;for(let A of B)for(let K of A.states)W.has(K.label)||W.set(K.label,{stateId:K.stateId,label:K.label});for(let A of W.values()){let K=document.createElement("div");K.className="rtichoke-legend-item";let Y=document.createElement("span");Y.className="rtichoke-legend-swatch";let ee=document.createElement("span");ee.className="rtichoke-legend-line",ee.style.backgroundColor=v(A.stateId,A.label),ee.style.height="10px",ee.style.borderRadius="2px",Y.append(ee);let Z=document.createElement("span");Z.className="rtichoke-legend-label",Z.textContent=A.label,K.append(Y,Z),g.append(K)}let q=[];if(O){let A=[];for(let K of N)for(let Y of K.states){let ee=v(Y.stateId,Y.label),Z=Gk(K.horizon,Y,K.totalCount,K.totalMass,i,!0);A.push({horizon:K.horizon,stateId:Y.stateId,label:Y.label,percentage:Y.percentage,color:ee,title:Z})}q.push(vw(A,Ds({x:"horizon",y:"percentage",fill:K=>K.color,fillOpacity:.85,stroke:o.axis.color,strokeWidth:.5,curve:"step-after",title:K=>K.title})));for(let K of D){let Y=K===I;q.push(As([K],{stroke:o.axis.color,strokeWidth:Y?2.5:1,strokeDasharray:Y?void 0:"3,3"})),Y&&q.push(Ea([{x:K,label:`Time = ${K.toFixed(i)}`}],{x:"x",y:102,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700}))}}else{let A=[];for(let K of G)for(let Y of K.states){let ee=v(Y.stateId,Y.label),Z=Gk(K.horizon,Y,K.totalCount,K.totalMass,i,!1);A.push({horizonLabel:`Time: ${K.horizon}`,horizon:K.horizon,stateId:Y.stateId,label:Y.label,percentage:Y.percentage,color:ee,title:Z})}q.push(_w(A,Ds({x:"horizonLabel",y:"percentage",fill:K=>K.color,fillOpacity:.88,stroke:o.axis.color,strokeWidth:.75,title:K=>K.title})))}let X={width:o.width,height:Math.round(o.height*.65),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:O?{label:"Time",grid:!1,line:!0,ticks:o.axis.ticks,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding}:{label:"Time",grid:!1,line:!0},y:{label:"Outcomes",domain:[0,100],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:A=>`${A}%`},marks:q},J=qn(X,o);S.replaceChildren(J)};return x.addEventListener("input",()=>{let P=e.stateDistributions.filter(N=>N.evaluationId===a),R=Array.from(new Set(P.filter(N=>N.estimateOrigin==="fixed_time_horizon").map(N=>N.horizon??0))).sort((N,G)=>N-G),C=Number(x.value);C>=0&&C[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 Da(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=Og(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=tn;return o.append(i,a),o}var kL=0;function Kk(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function Og(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function NL(e){return e.toFixed(2)}function RL(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 EL(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return tn;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)?tn:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?tn:t(e.upper);return`${r} [${n}, ${o}]`}function Jl(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 Fw(e,t=globalThis.document){pb(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let M=t.createElement("div");M.className="rtichoke-performance-table__title",M.textContent=e.title,r.append(M)}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(M=>[M.id,M])),a=new Set(e.evaluations.map(M=>M.model).filter(Boolean)),s=new Set(e.evaluations.map(M=>M.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 M of e.evaluations)M.model&&!l.has(M.model)&&(l.set(M.model,Cg[m%Cg.length]),m++);let h=new Map,b=0;for(let M of e.evaluations)M.population&&!h.has(M.population)&&(h.set(M.population,Cg[b%Cg.length]),b++);let y=e.evaluations.some(M=>M.label?!!(c&&M.label!==M.model||u&&M.label!==M.population||!c&&!u&&M.label!==M.model&&M.label!==M.population):!1),x=e.rows.some(M=>M.horizon!==void 0),g=e.rows.some(M=>M.context?.censoringHeuristic!==void 0),S=e.rows.some(M=>M.context?.competingEventHeuristic!==void 0),w=new Set(e.rows.map(M=>M.operatingPoint.type)),_=w.size===1&&w.has("probability_threshold"),v=w.size===1&&w.has("ppcr"),I=new Set(e.metrics.map(M=>M.id)),T=I.has("predicted_positives"),P=I.has("ppcr"),R=T&&(P||v),C=_||!v&&w.has("probability_threshold"),N=R,G=v&&!R,D=!_&&!v&&!R,O=e.rows.filter(M=>M.operatingPoint.type==="probability_threshold").map(M=>M.operatingPoint.value),z=RL(O),U=CL.map(M=>{let $=e.metrics.find(H=>H.id===M.id);return $?{id:$.id,label:$.label||M.defaultLabel}:null}).filter(M=>M!==null),W=new Set,B=U.filter(M=>W.has(M.label)?!1:(W.add(M.label),!0)),q=0,X=0;for(let M of e.rows)for(let $ of M.values)if($.metricId==="lift"&&$.estimate!==null&&$.estimate!==void 0&&isFinite($.estimate)&&$.estimate>q&&(q=$.estimate),$.metricId==="net_benefit"&&$.estimate!==null&&$.estimate!==void 0&&isFinite($.estimate)){let H=Math.abs($.estimate);H>X&&(X=H)}let J=++kL,A=t.createElement("thead");A.className="rtichoke-performance-table__header";let K=t.createElement("tr"),Y=t.createElement("tr"),ee=1;if(Y.append(_t(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),f&&(ee++,Y.append(_t(t,"Model"))),p&&(ee++,Y.append(_t(t,"Population"))),y&&(ee++,Y.append(_t(t,"Evaluation"))),C&&(ee++,Y.append(_t(t,"Probability Threshold"))),N&&(ee++,Y.append(_t(t,"Predicted Positives"))),G&&(ee++,Y.append(_t(t,"PPCR"))),D&&(ee++,Y.append(_t(t,"Operating Point"))),x&&(ee++,Y.append(_t(t,"Time Horizon"))),g&&(ee++,Y.append(_t(t,"Censoring"))),S&&(ee++,Y.append(_t(t,"Competing Event"))),B.length>0){let M=_t(t,"",{colSpan:ee,className:"rtichoke-performance-table__spanner--empty"});K.append(M)}if(B.length>0){let M=_t(t,"Performance Metrics",{colSpan:B.length,className:"rtichoke-performance-table__spanner"});K.append(M);for(let $ of B)Y.append(_t(t,$.label,{className:"rtichoke-performance-table__metric-header"}))}A.append(K),A.append(Y),o.append(A);let Z=ee+B.length,ne=t.createElement("tbody");for(let M=0;M0?"100.00%":tn,Se.append(Ht,Br),he.append(Se),zr.append(he),Vt.append(zr),Qe.append(Vt),fe.append(Qe),we.append(fe),ie.addEventListener("click",()=>{if(!we)return;let fr=ie.getAttribute("aria-expanded")==="true";ie.setAttribute("aria-expanded",fr?"false":"true"),ie.setAttribute("aria-label",fr?"Show confusion matrix detail":"Hide confusion matrix detail"),ie.textContent=fr?"\u25B8":"\u25BE",we.hidden=fr})}if(E.append(be),f){let ie=H?.model??tn,fe=H?.model?l.get(H.model):void 0;E.append(Io(t,ie,"rtichoke-performance-table__model",fe))}if(p){let ie=H?.population??tn,fe=H?.population?h.get(H.population):void 0;E.append(Io(t,ie,"rtichoke-performance-table__population",fe))}y&&E.append(Io(t,H?.label??H?.id??tn,"rtichoke-performance-table__evaluation"));let Ve=new Map($.values.map(ie=>[ie.metricId,ie]));if(C){let ie=$.operatingPoint.type==="probability_threshold"?$.operatingPoint.value:void 0,fe=ie!==void 0?ie.toFixed(z):tn;E.append(Io(t,fe,"rtichoke-performance-table__op"))}if(N){let ie=Ve.get("predicted_positives")?.estimate,fe=Ve.get("ppcr")?.estimate??($.operatingPoint.type==="ppcr"?$.operatingPoint.value:void 0),Qe=tn,ht=NaN;if(ie!=null&&fe!==void 0&&fe!==null){let Vt=Og(ie),In=(fe*100).toFixed(2);Qe=`${Vt} (${In}%)`,ht=fe*100}else fe!=null&&(Qe=`${(fe*100).toFixed(2)}%`,ht=fe*100);let ot=Io(t,Qe,"rtichoke-performance-table__op");isNaN(ht)||Jl(ot,t,ht,!1,!1,"neutral"),E.append(ot)}if(G){let ie=$.operatingPoint.type==="ppcr"?$.operatingPoint.value:Ve.get("ppcr")?.estimate,fe=ie!=null?`PPCR ${ie.toFixed(2)}`:tn,Qe=Io(t,fe,"rtichoke-performance-table__op");ie!=null&&Jl(Qe,t,ie*100,!1,!1,"neutral"),E.append(Qe)}if(D){let ie=$.operatingPoint.type==="ppcr"?`PPCR ${$.operatingPoint.value.toFixed(2)}`:`Threshold ${$.operatingPoint.value.toFixed(z)}`;E.append(Io(t,ie,"rtichoke-performance-table__op"))}if(x&&E.append(Io(t,$.horizon!==void 0?Og($.horizon):tn,"rtichoke-performance-table__horizon")),g){let ie=$.context?.censoringHeuristic;E.append(Io(t,ie?Kk(ie):tn,"rtichoke-performance-table__context"))}if(S){let ie=$.context?.competingEventHeuristic;E.append(Io(t,ie?Kk(ie):tn,"rtichoke-performance-table__context"))}for(let ie of B){let fe=Ve.get(ie.id),Qe=EL(fe,NL),ht=Io(t,Qe,"rtichoke-performance-table__metric");if(ht.dataset.metricId=ie.id,fe&&fe.estimate!==null&&fe.estimate!==void 0&&isFinite(fe.estimate)){let ot=fe.estimate;if(["sensitivity","specificity","ppv","npv"].includes(ie.id))Jl(ht,t,ot*100);else if(ie.id==="lift"){let Vt=q>0?ot/q*100:0;Jl(ht,t,Vt)}else if(ie.id==="net_benefit"&&X>0){let Vt=ot<0,In=Math.abs(ot)/X*50;Jl(ht,t,In,!0,Vt)}}E.append(ht)}ne.append(E),we&&ne.append(we)}return o.append(ne),n.append(o),r.append(n),r}var AL=0,FL=0;function $L(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 qk(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 _=O=>{let z=a.performance?.find(U=>U.metricId===O);return z&&z.estimate!==void 0&&z.estimate!==null?z.estimate:null},v=_("true_positives"),I=_("false_positives"),T=_("true_negatives"),P=_("false_negatives"),R=_("sensitivity"),C=_("specificity"),N=_("ppv"),G=_("npv"),D=_("lift");if((R!==null||C!==null||N!==null||G!==null||D!==null)&&(p={sensitivity:R,specificity:C,ppv:N,npv:G,lift:D}),v!==null&&I!==null&&T!==null&&P!==null){let O=v+P,z=T+I,U=v+I,W=T+P;l={tp:v,fp:I,tn:T,fn:P,totalPositives:O,totalNegatives:z,totalPredictedPos:U,totalPredictedNeg:W}}}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",C=I?"False Positive (FP)":"True Negative (TN)";_.nPositive>0&&y.push({category:"Observed Positives",count:_.nPositive,classificationCell:T,cellLabel:P,title:Lt(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:C,title:Lt(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",C]])})}for(let I=0;Is,G=N?"TP":"FN",D=N?"True Positive (TP)":"False Negative (FN)",O=N?"FP":"TN",z=N?"False Positive (FP)":"True Negative (TN)",U=s===0?!0:T.upper>s,W=U?"TP":"FN",B=U?"True Positive (TP)":"False Negative (FN)",q=U?"FP":"TN",X=U?"False Positive (FP)":"True Negative (TN)",J=_.nPositive+T.nPositive,A=_.nNegative+T.nNegative;G===W?J>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:J,classificationCell:W,cellLabel:B,isPredictedPositive:U,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",J],["Classification",B]])}):(_.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:_.nPositive,classificationCell:G,cellLabel:D,isPredictedPositive:N,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",_.nPositive],["Classification",D]])}),T.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:W,cellLabel:B,isPredictedPositive:U,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",B]])})),O===q?A>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:A,classificationCell:q,cellLabel:X,isPredictedPositive:U,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",A],["Classification",X]])}):(_.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:_.nNegative,classificationCell:O,cellLabel:z,isPredictedPositive:N,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",z]])}),T.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:q,cellLabel:X,isPredictedPositive:U,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",X]])}))}else{let N=s===0?!0:T.upper>s,G=N?"TP":"FN",D=N?"True Positive (TP)":"False Negative (FN)",O=N?"FP":"TN",z=N?"False Positive (FP)":"True Negative (TN)";T.nPositive>0&&b.push({x1:P,x2:R,category:"Observed Positives",count:T.nPositive,classificationCell:G,cellLabel:D,isPredictedPositive:N,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",T.nPositive],["Classification",D]])}),T.nNegative>0&&b.push({x1:P,x2:R,category:"Observed Negatives",count:T.nNegative,classificationCell:O,cellLabel:z,isPredictedPositive:N,title:Lt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",T.nNegative],["Classification",z]])})}}}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,C=R?"TP":"FN",N=R?"True Positive (TP)":"False Negative (FN)",G=R?"FP":"TN",D=R?"False Positive (FP)":"True Negative (TN)";if(P>0){let O=`[${I.toFixed(o)}, ${T.toFixed(o)}]`;v.positiveMass>0&&b.push({x1:I,x2:T,category:"Observed Positives",count:v.positiveMass,classificationCell:C,cellLabel:N,isPredictedPositive:R,title:Lt(o,[["Evaluation",h],["Population Rank Percentile",O],["Outcome","Observed Positive"],["Count",v.positiveMass],["Classification",N]])}),v.negativeMass>0&&b.push({x1:I,x2:T,category:"Observed Negatives",count:v.negativeMass,classificationCell:G,cellLabel:D,isPredictedPositive:R,title:Lt(o,[["Evaluation",h],["Population Rank Percentile",O],["Outcome","Observed Negative"],["Count",v.negativeMass],["Classification",D]])})}}}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 $w(e,t={}){sf(e);let r=++FL,n=en(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=M=>{let $=new Set;for(let E of e.operatingPoints)E.evaluationId===M&&$.add(E.type);let H=[];return $.has("probability_threshold")&&H.push("probability_threshold"),$.has("ppcr")&&H.push("ppcr"),H},c=(M,$)=>e.operatingPoints.filter(H=>H.evaluationId===M&&H.type===$).sort((H,E)=>H.value-E.value),u=s(a),f=e.operatingPoint?.dimension&&u.includes(e.operatingPoint.dimension)?e.operatingPoint.dimension:u[0]??"probability_threshold",p=(M,$)=>{let H=c(M,$);return[...new Set(H.map(E=>E.value))].sort((E,re)=>E-re)},l=(M,$,H)=>{let E=p(M,$);return E.length===0?0:H!==void 0&&E.some(re=>Math.abs(re-H)<1e-6)?H:E.some(re=>Math.abs(re-.5)<1e-6)?.5:E[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 C=document.createElement("option");C.value="real_positives",C.textContent="Real positives";let N=document.createElement("option");N.value="real_negatives",N.textContent="Real negatives",T.append(P,R,C,N),I.append(T);let G=document.createElement("select");G.className="rtichoke-prediction-distribution__select",G.setAttribute("aria-label","Operating point dimension"),G.style.display="none",S.addEventListener("change",()=>{a=S.value,ne()}),w.addEventListener("change",()=>{b=w.value,ne()}),T.addEventListener("change",()=>{y=T.value,ne()}),G.addEventListener("change",()=>{f=G.value,m=l(a,f,m),ne()});let D=(M,$,H,E,re)=>{let oe=document.createElement("div");oe.className="rtichoke-pd-radio-group",oe.setAttribute("role","radiogroup"),oe.setAttribute("aria-label",M);let be=document.createElement("span");be.className="rtichoke-pd-radio-group-label",be.textContent=`${M}:`,oe.append(be);let we=document.createElement("div");we.className="rtichoke-pd-radio-options";for(let Ve of H){let ie=document.createElement("label");ie.className="rtichoke-pd-radio-option";let fe=document.createElement("input");fe.type="radio",fe.name=$,fe.value=Ve.value,fe.checked=Ve.value===E,fe.addEventListener("change",()=>{fe.checked&&re(Ve.value)});let Qe=document.createElement("span");Qe.textContent=Ve.label,ie.append(fe,Qe),we.append(ie)}return oe.append(we),oe},O=document.createElement("div");O.className="rtichoke-pd-controls-row";let z=()=>{O.replaceChildren(),S.replaceChildren();for(let M of e.evaluations){let $=document.createElement("option");$.value=M.id,$.textContent=M.label??M.model??M.population??M.id,S.append($)}if(S.value=a,e.evaluations.length>1){let M=e.evaluations.map(H=>({value:H.id,label:H.label??H.model??H.population??H.id})),$=D("Reference Group",`pd-ref-group-${r}`,M,a,H=>{a=H,ne()});O.append($)}},U=document.createElement("div");U.className="rtichoke-pd-controls-row";let W=document.createElement("div");W.className="rtichoke-operating-point-control",W.style.marginLeft=`${o.margins.left}px`,W.style.marginRight=`${o.margins.right}px`;let B=`rtichoke-pd-slider-${++AL}`,q=document.createElement("label");q.className="rtichoke-operating-point-label",q.htmlFor=B;let X=document.createElement("span"),J=document.createElement("span");J.className="rtichoke-operating-point-value",q.append(X,J);let A=document.createElement("input");A.type="range",A.id=B,A.className="rtichoke-operating-point-slider",W.append(q,A);let K=document.createElement("div");K.className="rtichoke-legend",K.style.paddingLeft=`${o.margins.left}px`;let Y=(M,$)=>{let H=document.createElement("div");H.className="rtichoke-legend-item";let E=document.createElement("span");E.className="rtichoke-legend-swatch";let re=document.createElement("span");re.className="rtichoke-legend-line",re.style.backgroundColor=$,re.style.border=`1px solid ${o.axis.color}`,re.style.boxSizing="border-box",re.style.height="10px",re.style.borderRadius="2px",E.append(re);let oe=document.createElement("span");return oe.className="rtichoke-legend-label",oe.textContent=M,H.append(E,oe),H},ee=document.createElement("div");ee.className="rtichoke-prediction-distribution__chart";let Z=document.createElement("div");Z.className="rtichoke-prediction-distribution__summary",g.append(O,U),x.append(g,Z,W,K,ee);let ne=()=>{z(),U.replaceChildren(),w.value=b,T.value=y==="all_observations"?"predicted_positives":y,I.style.display=b==="observed_outcome"?"none":"inline-flex",G.replaceChildren();let M=s(a);for(let le of M){let he=document.createElement("option");he.value=le,he.textContent=le==="probability_threshold"?"Probability threshold":"PPCR",G.append(he)}G.value=f;let $=D("Display",`pd-display-${r}`,[{value:"stacked",label:"Stacked"},{value:"mirrored",label:"Mirrored"}],h,le=>{h=le,ne()}),H=D("Color Bars By",`pd-color-${r}`,[{value:"confusion_matrix_cell",label:"Confusion Matrix Cell"},{value:"observed_outcome",label:"Observed Outcome"}],b,le=>{b=le,ne()});if(U.append($,H,S,w,I,G),M.length>1){let le=D("Dimension",`pd-dim-${r}`,[{value:"probability_threshold",label:"Probability Threshold"},{value:"ppcr",label:"PPCR"}],f,he=>{f=he,m=l(a,f,m),ne()});U.append(le)}let E=p(a,f),re=E.find(le=>Math.abs(le-m)<1e-6);re!==void 0?m=re:m=l(a,f,m);let oe=E.indexOf(m);A.min="0",A.max=String(Math.max(0,E.length-1)),A.step="1",A.value=String(Math.max(0,oe));let be=f==="probability_threshold"?"Probability threshold":"PPCR";X.textContent=`${be}: `,J.textContent=m.toFixed(i),A.setAttribute("aria-label",be),A.setAttribute("aria-valuetext",m.toFixed(i));let we=qk(e,a,f,m,i),{cutoff:Ve,cutoffX:ie,xAxisLabel:fe,yAxisLabel:Qe,yMax:ht,totalN:ot,performanceMetrics:Vt,confusion:In,ordinaryPlotData:Zi}=we,nn=$L(o.predictionDistribution,y);K.replaceChildren(),b==="observed_outcome"&&K.append(Y("Observed Positives",o.predictionDistribution.observedPositive),Y("Observed Negatives",o.predictionDistribution.observedNegative));let zr=[],qt=f==="probability_threshold"?`Cutoff = ${Ve.toFixed(i)}`:`PPCR = ${m.toFixed(i)}`,ja=ht,ko=h==="mirrored"?-ht:0;zr.push(As([ie],{stroke:o.axis.color,strokeWidth:2,strokeDasharray:"4,3"})),zr.push(Ea([{x:ie,label:qt}],{x:"x",y:ja,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700})),h==="mirrored"&&zr.push(vo([0],{stroke:o.axis.color,strokeWidth:1.5}));let Ua=le=>{let he="";if(b==="observed_outcome")he=le.category==="Observed Positives"?o.predictionDistribution.observedPositive:o.predictionDistribution.observedNegative;else switch(le.classificationCell){case"TP":he=nn.tp;break;case"FP":he=nn.fp;break;case"TN":he=nn.tn;break;case"FN":he=nn.fn;break}let Se=!0;switch(y){case"all_observations":Se=!0;break;case"predicted_positives":Se=le.isPredictedPositive;break;case"predicted_negatives":Se=!le.isPredictedPositive;break;case"real_positives":Se=le.category==="Observed Positives";break;case"real_negatives":Se=le.category==="Observed Negatives";break}return{fill:he,fillOpacity:Se?.88:.18,strokeOpacity:Se?.4:.1}};if(h==="stacked"){let le=Zi.map(he=>{let{fill:Se,fillOpacity:Ht,strokeOpacity:Br}=Ua(he);return{...he,fill:Se,fillOpacity:Ht,strokeOpacity:Br}});zr.push(Yi(le,Ds({x1:"x1",x2:"x2",y:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:he=>he.title,tip:!0})))}else{let le=Zi.filter(Se=>Se.category==="Observed Positives").map(Se=>{let{fill:Ht,fillOpacity:Br,strokeOpacity:fr}=Ua(Se);return{...Se,fill:Ht,fillOpacity:Br,strokeOpacity:fr}}),he=Zi.filter(Se=>Se.category==="Observed Negatives").map(Se=>{let{fill:Ht,fillOpacity:Br,strokeOpacity:fr}=Ua(Se);return{...Se,fill:Ht,fillOpacity:Br,strokeOpacity:fr}});le.length>0&&zr.push(Yi(le,{x1:"x1",x2:"x2",y1:0,y2:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Se=>Se.title,tip:!0})),he.length>0&&zr.push(Yi(he,{x1:"x1",x2:"x2",y1:0,y2:Se=>-Se.count,fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Se=>Se.title,tip:!0}))}let $u={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:fe,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:Qe,domain:[ko,ja],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:le=>String(Math.abs(le))},marks:zr},_n=qn($u,o);if(ee.replaceChildren(_n),Z.replaceChildren(),In){let{tp:le,fp:he,tn:Se,fn:Ht,totalPositives:Br,totalNegatives:fr,totalPredictedPos:op,totalPredictedNeg:lr}=In,on=document.createElement("table");on.className="rtichoke-pd-matrix";let Du=document.createElement("colgroup"),Ks=document.createElement("col");Ks.style.width="28%";let qs=document.createElement("col");qs.style.width="24%";let Hs=document.createElement("col");Hs.style.width="24%";let ip=document.createElement("col");ip.style.width="24%",Du.append(Ks,qs,Hs,ip),on.append(Du);let Lu=(Je,ct)=>{let Qi=document.createElement("label");Qi.className=`rtichoke-pd-cond-option ${y===Je?"rtichoke-pd-cond-option--active":""}`;let Hn=document.createElement("input");Hn.type="radio",Hn.name=`pd-cond-${r}`,Hn.value=Je,Hn.checked=y===Je,Hn.addEventListener("change",()=>{Hn.checked&&(y=Je,ne())});let fi=document.createElement("span");return fi.textContent=ct,Qi.append(Hn,fi),Qi},Qw=document.createElement("thead"),Jw=document.createElement("tr"),Xg=document.createElement("th");Xg.className="rtichoke-pd-matrix__corner",Xg.append(Lu("all_observations","All Observations"));let Zg=document.createElement("th");Zg.className=`rtichoke-pd-matrix__col-header ${y==="real_positives"?"rtichoke-pd-matrix__col-header--active":""}`,Zg.append(Lu("real_positives","Real Positive"));let Qg=document.createElement("th");Qg.className=`rtichoke-pd-matrix__col-header ${y==="real_negatives"?"rtichoke-pd-matrix__col-header--active":""}`,Qg.append(Lu("real_negatives","Real Negative"));let e2=document.createElement("th");e2.className="rtichoke-pd-matrix__col-header rtichoke-pd-matrix__col-header--blank",Jw.append(Xg,Zg,Qg,e2),Qw.append(Jw);let t2=document.createElement("tbody"),x6=b==="observed_outcome"?o.predictionDistribution.observedPositive:nn.tp,w6=b==="observed_outcome"?o.predictionDistribution.observedPositive:nn.fn,S6=b==="observed_outcome"?o.predictionDistribution.observedNegative:nn.fp,v6=b==="observed_outcome"?o.predictionDistribution.observedNegative:nn.tn,I6=o.predictionDistribution.observedPositive,_6=o.predictionDistribution.observedNegative,Jg="#E5E7EB",P6=Je=>{if(ot===0)return null;switch(y){case"all_observations":return`(${((Je==="TP"?le:Je==="FP"?he:Je==="TN"?Se:Ht)/ot*100).toFixed(1)}%)`;case"predicted_positives":{let ct=le+he;return ct===0?null:Je==="TP"?`(${(le/ct*100).toFixed(1)}%)`:Je==="FP"?`(${(he/ct*100).toFixed(1)}%)`:null}case"predicted_negatives":{let ct=Se+Ht;return ct===0?null:Je==="TN"?`(${(Se/ct*100).toFixed(1)}%)`:Je==="FN"?`(${(Ht/ct*100).toFixed(1)}%)`:null}case"real_positives":{let ct=le+Ht;return ct===0?null:Je==="TP"?`(${(le/ct*100).toFixed(1)}%)`:Je==="FN"?`(${(Ht/ct*100).toFixed(1)}%)`:null}case"real_negatives":{let ct=Se+he;return ct===0?null:Je==="TN"?`(${(Se/ct*100).toFixed(1)}%)`:Je==="FP"?`(${(he/ct*100).toFixed(1)}%)`:null}}},ap=(Je,ct,Qi,Hn)=>{Je.replaceChildren(),Je.className=`rtichoke-prediction-distribution__cell--${ct.toLowerCase()} rtichoke-pd-matrix__cell`,Je.style.backgroundColor="#ffffff",Je.style.color=o.axis.color;let fi=ot>0?Qi/ot*100:0,Ji=document.createElement("div");Ji.className="rtichoke-pd-cell-bar",Ji.style.width=`${fi}%`,Ji.style.backgroundColor=Hn;let za=document.createElement("div");za.className="rtichoke-pd-cell-content";let iy=document.createElement("span");iy.className="rtichoke-pd-cell-label",iy.textContent=ct;let ay=document.createElement("div");ay.className="rtichoke-pd-cell-num";let sy=document.createElement("span");sy.className="rtichoke-pd-cell-count",sy.textContent=Qi.toLocaleString();let T6=P6(ct),cy=document.createElement("span");cy.className="rtichoke-pd-cell-pct",cy.textContent=T6??"",ay.append(sy,cy),za.append(iy,ay),Je.append(Ji,za)},Vu=(Je,ct,Qi)=>{Je.replaceChildren(),Je.className="rtichoke-prediction-distribution__cell--total rtichoke-pd-matrix__cell",Je.style.backgroundColor="#ffffff";let Hn=ot>0?ct/ot*100:0,fi=document.createElement("div");fi.className="rtichoke-pd-cell-bar",fi.style.width=`${Hn}%`,fi.style.backgroundColor=Qi;let Ji=document.createElement("div");Ji.className="rtichoke-pd-cell-content rtichoke-pd-cell-content--margin";let za=document.createElement("span");za.className="rtichoke-pd-cell-count",za.textContent=ct.toLocaleString(),Ji.append(za),Je.append(fi,Ji)},ey=document.createElement("tr");y==="predicted_positives"&&(ey.className="rtichoke-pd-matrix__row--active");let ty=document.createElement("th");ty.className=`rtichoke-pd-matrix__row-header ${y==="predicted_positives"?"rtichoke-pd-matrix__row-header--active":""}`,ty.append(Lu("predicted_positives","Predicted Positive"));let r2=document.createElement("td");ap(r2,"TP",le,x6);let n2=document.createElement("td");ap(n2,"FP",he,S6);let o2=document.createElement("td");Vu(o2,op,Jg),ey.append(ty,r2,n2,o2);let ry=document.createElement("tr");y==="predicted_negatives"&&(ry.className="rtichoke-pd-matrix__row--active");let ny=document.createElement("th");ny.className=`rtichoke-pd-matrix__row-header ${y==="predicted_negatives"?"rtichoke-pd-matrix__row-header--active":""}`,ny.append(Lu("predicted_negatives","Predicted Negative"));let i2=document.createElement("td");ap(i2,"FN",Ht,w6);let a2=document.createElement("td");ap(a2,"TN",Se,v6);let s2=document.createElement("td");Vu(s2,lr,Jg),ry.append(ny,i2,a2,s2);let oy=document.createElement("tr");oy.className="rtichoke-pd-matrix__tot-row";let c2=document.createElement("th");c2.className="rtichoke-pd-matrix__row-header rtichoke-pd-matrix__row-header--blank";let u2=document.createElement("td");Vu(u2,Br,I6);let f2=document.createElement("td");Vu(f2,fr,_6);let l2=document.createElement("td");Vu(l2,ot,Jg),oy.append(c2,u2,f2,l2),t2.append(ey,ry,oy),on.append(Qw,t2),Z.append(on)}if(Vt){let le=document.createElement("div");le.className="rtichoke-pd-metrics-container rtichoke-performance-table";let he=document.createElement("table");he.className="rtichoke-performance-table__table rtichoke-pd-metrics-table";let Se=document.createElement("thead"),Ht=document.createElement("tr"),Br=[{id:"sensitivity",label:"Sensitivity",val:Vt.sensitivity,isEmphasized:y==="real_positives",isRatio:!1},{id:"specificity",label:"Specificity",val:Vt.specificity,isEmphasized:y==="real_negatives",isRatio:!1},{id:"ppv",label:"PPV",val:Vt.ppv,isEmphasized:y==="predicted_positives",isRatio:!1},{id:"npv",label:"NPV",val:Vt.npv,isEmphasized:y==="predicted_negatives",isRatio:!1},{id:"lift",label:"Lift",val:Vt.lift,isEmphasized:y==="predicted_positives",isRatio:!0}];for(let lr of Br){let on=document.createElement("th");on.className=`rtichoke-performance-table__metric-header ${lr.isEmphasized?"rtichoke-pd-metric--emphasized-header":""}`,on.textContent=lr.label,Ht.append(on)}Se.append(Ht);let fr=document.createElement("tbody"),op=document.createElement("tr");for(let lr of Br){let on=document.createElement("td");on.className=`rtichoke-performance-table__metric ${lr.isEmphasized?"rtichoke-pd-metric--emphasized-cell":""}`;let Du="\u2014";if(lr.val!==null&&lr.val!==void 0&&(Du=lr.isRatio?lr.val.toFixed(2):(lr.val*100).toFixed(1)+"%"),lr.val!==null&&lr.val!==void 0&&isFinite(lr.val)){let qs=document.createElement("div");qs.className="rtichoke-performance-table__bar";let Hs=document.createElement("div");Hs.className="rtichoke-performance-table__bar-fill rtichoke-performance-table__bar-fill--positive";let ip=lr.isRatio?Math.min(100,lr.val/3*100):Math.min(100,lr.val*100);Hs.style.width=`${ip}%`,qs.append(Hs),on.append(qs)}let Ks=document.createElement("span");Ks.className="rtichoke-performance-table__cell-text",Ks.textContent=Du,on.append(Ks),op.append(on)}fr.append(op),he.append(Se,fr),le.append(he),Z.append(le)}};return A.addEventListener("input",()=>{let M=p(a,f),$=Number(A.value);$>=0&&$0?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(LL(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(Dw(t,b,"rtichoke-summary-metrics__owner"),Dw(t,y,"rtichoke-summary-metrics__metric"));let g=Dw(t,VL(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 jL(e){switch(e.errorType){case F.ArrayContains:return"Expected array to contain at least one matching value";case F.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case F.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case F.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case F.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case F.ArrayUniqueItems:return"Expected array elements to be unique";case F.Array:return"Expected array";case F.AsyncIterator:return"Expected AsyncIterator";case F.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case F.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case F.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case F.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case F.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case F.BigInt:return"Expected bigint";case F.Boolean:return"Expected boolean";case F.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case F.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case F.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case F.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case F.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case F.Date:return"Expected Date";case F.Function:return"Expected function";case F.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case F.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case F.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case F.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case F.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case F.Integer:return"Expected integer";case F.IntersectUnevaluatedProperties:return"Unexpected property";case F.Intersect:return"Expected all values to match";case F.Iterator:return"Expected Iterator";case F.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case F.Never:return"Never";case F.Not:return"Value should not match";case F.Null:return"Expected null";case F.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case F.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case F.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case F.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case F.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case F.Number:return"Expected number";case F.Object:return"Expected object";case F.ObjectAdditionalProperties:return"Unexpected property";case F.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case F.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case F.ObjectRequiredProperty:return"Expected required property";case F.Promise:return"Expected Promise";case F.RegExp:return"Expected string to match regular expression";case F.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case F.StringFormat:return`Expected string to match '${e.schema.format}' format`;case F.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case F.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case F.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case F.String:return"Expected string";case F.Symbol:return"Expected symbol";case F.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case F.Tuple:return"Expected tuple";case F.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case F.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case F.Uint8Array:return"Expected Uint8Array";case F.Undefined:return"Expected undefined";case F.Union:return"Expected union value";case F.Void:return"Expected void";case F.Kind:return`Expected kind '${e.schema[V]}'`;default:return"Unknown error type"}}var UL=jL;function Hk(){return UL}var Vw=class extends ge{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function zL(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new Vw(e);return Le(r,t)}function sr(e,t){return!Be(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function Le(e,t){return e[V]==="This"||e[V]==="Ref"?zL(e,t):e}var jw=class extends ge{constructor(t){super("Unable to hash value"),this.value=t}},wn;(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"})(wn||(wn={}));var Ru=BigInt("14695981039346656037"),[BL,GL]=[BigInt("1099511628211"),BigInt("18446744073709551616")],KL=Array.from({length:256}).map((e,t)=>BigInt(t)),Yk=new Float64Array(1),Wk=new DataView(Yk.buffer),Xk=new Uint8Array(Yk.buffer);function*qL(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 HL(e){kr(wn.Array);for(let t of e)Eu(t)}function YL(e){kr(wn.Boolean),kr(e?1:0)}function WL(e){kr(wn.BigInt),Wk.setBigInt64(0,e);for(let t of Xk)kr(t)}function XL(e){kr(wn.Date),Eu(e.getTime())}function ZL(e){kr(wn.Null)}function QL(e){kr(wn.Number),Wk.setFloat64(0,e);for(let t of Xk)kr(t)}function JL(e){kr(wn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())Eu(t),Eu(e[t])}function eV(e){kr(wn.String);for(let t=0;t=e.minItems)||Te(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!cr(e.items,t,i))return!1;if(e.uniqueItems===!0&&!(function(){let i=new Set;for(let a of r){let s=Au(a);if(i.has(s))return!1;i.add(s)}return!0})())return!1;if(!(Te(e.contains)||lt(e.minContains)||lt(e.maxContains)))return!0;let n=Te(e.contains)?e.contains:_e(),o=r.reduce((i,a)=>cr(n,t,a)?i+1:i,0);return!(o===0||lt(e.minContains)&&oe.maxContains)}function cV(e,t,r){return up(r)}function uV(e,t,r){return!(!Yn(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function fV(e,t,r){return No(r)}function lV(e,t,r){return cr(e.returns,t,r.prototype)}function pV(e,t,r){return!(!Nr(r)||Te(e.exclusiveMaximumTimestamp)&&!(r.getTime()e.exclusiveMinimumTimestamp)||Te(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||Te(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||Te(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function mV(e,t,r){return ea(r)}function dV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return cr(o,[...t,...n],r)}function hV(e,t,r){return!(!pp(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.multipleOf)&&r%e.multipleOf!==0)}function gV(e,t,r){let n=e.allOf.every(o=>cr(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(cc(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a));return n&&i}else if(yt(e.unevaluatedProperties)){let o=new RegExp(cc(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||cr(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function yV(e,t,r){return fp(r)}function bV(e,t,r){return r===e.const}function xV(e,t,r){return!1}function wV(e,t,r){return!cr(e.not,t,r)}function SV(e,t,r){return mi(r)}function vV(e,t,r){return!(!jt.IsNumberLike(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.multipleOf)&&r%e.multipleOf!==0)}function IV(e,t,r){if(!jt.IsObjectLike(r)||Te(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Te(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(!cr(i,t,r[o])||(Qa(i)||oV(i))&&!(o in r))return!1}else if(jt.IsExactOptionalProperty(r,o)&&!cr(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)||cr(e.additionalProperties,t,r[i])):!0}function _V(e,t,r){return lp(r)}function PV(e,t,r){if(!jt.IsRecordLike(r)||Te(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Te(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)?cr(o,t,f):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([u,f])=>i.test(u)?!0:cr(e.additionalProperties,t,f)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(u=>i.test(u)):!0;return a&&s&&c}function TV(e,t,r){return cr(Le(e,t),t,r)}function MV(e,t,r){let n=new RegExp(e.source,e.flags);return Te(e.minLength)&&!(r.length>=e.minLength)||Te(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function CV(e,t,r){return!Be(r)||Te(e.minLength)&&!(r.length>=e.minLength)||Te(e.maxLength)&&!(r.length<=e.maxLength)||Te(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:Te(e.format)?ia.Has(e.format)?ia.Get(e.format)(r):!1:!0}function OV(e,t,r){return di(r)}function kV(e,t,r){return Be(r)&&new RegExp(e.pattern).test(r)}function NV(e,t,r){return cr(Le(e,t),t,r)}function RV(e,t,r){if(!me(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;ncr(n,t,r))}function FV(e,t,r){return!(!Ws(r)||Te(e.maxByteLength)&&!(r.length<=e.maxByteLength)||Te(e.minByteLength)&&!(r.length>=e.minByteLength))}function $V(e,t,r){return!0}function DV(e,t,r){return jt.IsVoidLike(r)}function LV(e,t,r){return ro.Has(e[V])?ro.Get(e[V])(e,r):!1}function cr(e,t,r){let n=Te(e.$id)?sr(e,t):t,o=e;switch(o[V]){case"Any":return iV(o,n,r);case"Argument":return aV(o,n,r);case"Array":return sV(o,n,r);case"AsyncIterator":return cV(o,n,r);case"BigInt":return uV(o,n,r);case"Boolean":return fV(o,n,r);case"Constructor":return lV(o,n,r);case"Date":return pV(o,n,r);case"Function":return mV(o,n,r);case"Import":return dV(o,n,r);case"Integer":return hV(o,n,r);case"Intersect":return gV(o,n,r);case"Iterator":return yV(o,n,r);case"Literal":return bV(o,n,r);case"Never":return xV(o,n,r);case"Not":return wV(o,n,r);case"Null":return SV(o,n,r);case"Number":return vV(o,n,r);case"Object":return IV(o,n,r);case"Promise":return _V(o,n,r);case"Record":return PV(o,n,r);case"Ref":return TV(o,n,r);case"RegExp":return MV(o,n,r);case"String":return CV(o,n,r);case"Symbol":return OV(o,n,r);case"TemplateLiteral":return kV(o,n,r);case"This":return NV(o,n,r);case"Tuple":return RV(o,n,r);case"Undefined":return EV(o,n,r);case"Union":return AV(o,n,r);case"Uint8Array":return FV(o,n,r);case"Unknown":return $V(o,n,r);case"Void":return DV(o,n,r);default:if(!ro.Has(o[V]))throw new Uw(o);return LV(o,n,r)}}function Ie(...e){return e.length===3?cr(e[0],e[1],e[2]):cr(e[0],[],e[1])}var F;(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"})(F||(F={}));var zw=class extends ge{constructor(t){super("Unknown type"),this.schema=t}};function Wi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Me(e){return e!==void 0}var La=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 te(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:Hk()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*VV(e,t,r,n){}function*jV(e,t,r,n){}function*UV(e,t,r,n){if(!me(n))return yield te(F.Array,e,r,n);Me(e.minItems)&&!(n.length>=e.minItems)&&(yield te(F.ArrayMinItems,e,r,n)),Me(e.maxItems)&&!(n.length<=e.maxItems)&&(yield te(F.ArrayMaxItems,e,r,n));for(let a=0;aur(o,t,`${r}${c}`,s).next().done===!0?a+1:a,0);i===0&&(yield te(F.ArrayContains,e,r,n)),lt(e.minContains)&&ie.maxContains&&(yield te(F.ArrayMaxContains,e,r,n))}function*zV(e,t,r,n){up(n)||(yield te(F.AsyncIterator,e,r,n))}function*BV(e,t,r,n){if(!Yn(n))return yield te(F.BigInt,e,r,n);Me(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te(F.BigIntExclusiveMinimum,e,r,n)),Me(e.maximum)&&!(n<=e.maximum)&&(yield te(F.BigIntMaximum,e,r,n)),Me(e.minimum)&&!(n>=e.minimum)&&(yield te(F.BigIntMinimum,e,r,n)),Me(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield te(F.BigIntMultipleOf,e,r,n))}function*GV(e,t,r,n){No(n)||(yield te(F.Boolean,e,r,n))}function*KV(e,t,r,n){yield*ur(e.returns,t,r,n.prototype)}function*qV(e,t,r,n){if(!Nr(n))return yield te(F.Date,e,r,n);Me(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield te(F.DateExclusiveMinimumTimestamp,e,r,n)),Me(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield te(F.DateMaximumTimestamp,e,r,n)),Me(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield te(F.DateMinimumTimestamp,e,r,n)),Me(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield te(F.DateMultipleOfTimestamp,e,r,n))}function*HV(e,t,r,n){ea(n)||(yield te(F.Function,e,r,n))}function*YV(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*ur(i,[...t,...o],r,n)}function*WV(e,t,r,n){if(!pp(n))return yield te(F.Integer,e,r,n);Me(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te(F.IntegerExclusiveMinimum,e,r,n)),Me(e.maximum)&&!(n<=e.maximum)&&(yield te(F.IntegerMaximum,e,r,n)),Me(e.minimum)&&!(n>=e.minimum)&&(yield te(F.IntegerMinimum,e,r,n)),Me(e.multipleOf)&&n%e.multipleOf!==0&&(yield te(F.IntegerMultipleOf,e,r,n))}function*XV(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of ur(i,t,r,n))o=!0,yield a;if(o)return yield te(F.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(cc(e));for(let a of Object.getOwnPropertyNames(n))i.test(a)||(yield te(F.IntersectUnevaluatedProperties,e,`${r}/${a}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(cc(e));for(let a of Object.getOwnPropertyNames(n))if(!i.test(a)){let s=ur(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*ZV(e,t,r,n){fp(n)||(yield te(F.Iterator,e,r,n))}function*QV(e,t,r,n){n!==e.const&&(yield te(F.Literal,e,r,n))}function*JV(e,t,r,n){yield te(F.Never,e,r,n)}function*ej(e,t,r,n){ur(e.not,t,r,n).next().done===!0&&(yield te(F.Not,e,r,n))}function*tj(e,t,r,n){mi(n)||(yield te(F.Null,e,r,n))}function*rj(e,t,r,n){if(!jt.IsNumberLike(n))return yield te(F.Number,e,r,n);Me(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te(F.NumberExclusiveMinimum,e,r,n)),Me(e.maximum)&&!(n<=e.maximum)&&(yield te(F.NumberMaximum,e,r,n)),Me(e.minimum)&&!(n>=e.minimum)&&(yield te(F.NumberMinimum,e,r,n)),Me(e.multipleOf)&&n%e.multipleOf!==0&&(yield te(F.NumberMultipleOf,e,r,n))}function*nj(e,t,r,n){if(!jt.IsObjectLike(n))return yield te(F.Object,e,r,n);Me(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield te(F.ObjectMinProperties,e,r,n)),Me(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield te(F.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 te(F.ObjectRequiredProperty,e.properties[s],`${r}/${Wi(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield te(F.ObjectAdditionalProperties,e,`${r}/${Wi(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*ur(e.additionalProperties,t,`${r}/${Wi(s)}`,n[s]));for(let s of i){let c=e.properties[s];e.required&&e.required.includes(s)?(yield*ur(c,t,`${r}/${Wi(s)}`,n[s]),Qa(e)&&!(s in n)&&(yield te(F.ObjectRequiredProperty,c,`${r}/${Wi(s)}`,void 0))):jt.IsExactOptionalProperty(n,s)&&(yield*ur(c,t,`${r}/${Wi(s)}`,n[s]))}}function*oj(e,t,r,n){lp(n)||(yield te(F.Promise,e,r,n))}function*ij(e,t,r,n){if(!jt.IsRecordLike(n))return yield te(F.Object,e,r,n);Me(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield te(F.ObjectMinProperties,e,r,n)),Me(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield te(F.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*ur(i,t,`${r}/${Wi(s)}`,c));if(typeof e.additionalProperties=="object")for(let[s,c]of Object.entries(n))a.test(s)||(yield*ur(e.additionalProperties,t,`${r}/${Wi(s)}`,c));if(e.additionalProperties===!1){for(let[s,c]of Object.entries(n))if(!a.test(s))return yield te(F.ObjectAdditionalProperties,e,`${r}/${Wi(s)}`,c)}}function*aj(e,t,r,n){yield*ur(Le(e,t),t,r,n)}function*sj(e,t,r,n){if(!Be(n))return yield te(F.String,e,r,n);if(Me(e.minLength)&&!(n.length>=e.minLength)&&(yield te(F.StringMinLength,e,r,n)),Me(e.maxLength)&&!(n.length<=e.maxLength)&&(yield te(F.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield te(F.RegExp,e,r,n)}function*cj(e,t,r,n){if(!Be(n))return yield te(F.String,e,r,n);Me(e.minLength)&&!(n.length>=e.minLength)&&(yield te(F.StringMinLength,e,r,n)),Me(e.maxLength)&&!(n.length<=e.maxLength)&&(yield te(F.StringMaxLength,e,r,n)),Be(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield te(F.StringPattern,e,r,n))),Be(e.format)&&(ia.Has(e.format)?ia.Get(e.format)(n)||(yield te(F.StringFormat,e,r,n)):yield te(F.StringFormatUnknown,e,r,n))}function*uj(e,t,r,n){di(n)||(yield te(F.Symbol,e,r,n))}function*fj(e,t,r,n){if(!Be(n))return yield te(F.String,e,r,n);new RegExp(e.pattern).test(n)||(yield te(F.StringPattern,e,r,n))}function*lj(e,t,r,n){yield*ur(Le(e,t),t,r,n)}function*pj(e,t,r,n){if(!me(n))return yield te(F.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield te(F.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield te(F.TupleLength,e,r,n);if(e.items)for(let o=0;onew La(ur(i,t,r,n)));yield te(F.Union,e,r,n,o)}function*hj(e,t,r,n){if(!Ws(n))return yield te(F.Uint8Array,e,r,n);Me(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield te(F.Uint8ArrayMaxByteLength,e,r,n)),Me(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield te(F.Uint8ArrayMinByteLength,e,r,n))}function*gj(e,t,r,n){}function*yj(e,t,r,n){jt.IsVoidLike(n)||(yield te(F.Void,e,r,n))}function*bj(e,t,r,n){ro.Get(e[V])(e,n)||(yield te(F.Kind,e,r,n))}function*ur(e,t,r,n){let o=Me(e.$id)?[...t,e]:t,i=e;switch(i[V]){case"Any":return yield*VV(i,o,r,n);case"Argument":return yield*jV(i,o,r,n);case"Array":return yield*UV(i,o,r,n);case"AsyncIterator":return yield*zV(i,o,r,n);case"BigInt":return yield*BV(i,o,r,n);case"Boolean":return yield*GV(i,o,r,n);case"Constructor":return yield*KV(i,o,r,n);case"Date":return yield*qV(i,o,r,n);case"Function":return yield*HV(i,o,r,n);case"Import":return yield*YV(i,o,r,n);case"Integer":return yield*WV(i,o,r,n);case"Intersect":return yield*XV(i,o,r,n);case"Iterator":return yield*ZV(i,o,r,n);case"Literal":return yield*QV(i,o,r,n);case"Never":return yield*JV(i,o,r,n);case"Not":return yield*ej(i,o,r,n);case"Null":return yield*tj(i,o,r,n);case"Number":return yield*rj(i,o,r,n);case"Object":return yield*nj(i,o,r,n);case"Promise":return yield*oj(i,o,r,n);case"Record":return yield*ij(i,o,r,n);case"Ref":return yield*aj(i,o,r,n);case"RegExp":return yield*sj(i,o,r,n);case"String":return yield*cj(i,o,r,n);case"Symbol":return yield*uj(i,o,r,n);case"TemplateLiteral":return yield*fj(i,o,r,n);case"This":return yield*lj(i,o,r,n);case"Tuple":return yield*pj(i,o,r,n);case"Undefined":return yield*mj(i,o,r,n);case"Union":return yield*dj(i,o,r,n);case"Uint8Array":return yield*hj(i,o,r,n);case"Unknown":return yield*gj(i,o,r,n);case"Void":return yield*yj(i,o,r,n);default:if(!ro.Has(i[V]))throw new zw(e);return yield*bj(i,o,r,n)}}function Va(...e){let t=e.length===3?ur(e[0],e[1],"",e[2]):ur(e[0],[],"",e[1]);return new La(t)}var xj=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},Qk=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)},Bw,kg,Jk,Gw=class extends ge{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),Bw.add(this),kg.set(this,void 0),xj(this,kg,t,"f"),this.error=r}Errors(){return new La(Qk(this,Bw,"m",Jk).call(this))}};kg=new WeakMap,Bw=new WeakSet,Jk=function*(){this.error&&(yield this.error),yield*Qk(this,kg,"f")};function Zk(e,t,r){if(!Ie(e,t,r))throw new Gw(Va(e,t,r))}function Ng(...e){return e.length===3?Zk(e[0],e[1],e[2]):Zk(e[0],[],e[1])}function wj(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Re(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Re(e[r]);return t}function Sj(e){return e.map(t=>Re(t))}function vj(e){return e.slice()}function Ij(e){return new Map(Re([...e.entries()]))}function _j(e){return new Set(Re([...e.entries()]))}function Pj(e){return new Date(e.toISOString())}function Re(e){if(me(e))return Sj(e);if(Nr(e))return Pj(e);if(Pn(e))return vj(e);if(p2(e))return Ij(e);if(m2(e))return _j(e);if(xe(e))return wj(e);if(sn(e))return e;throw new Error("ValueClone: Unable to clone value")}var Sn=class extends ge{constructor(t,r){super(r),this.schema=t}};function Ee(e){return ea(e)?e():Re(e)}function Tj(e,t){return pe(e,"default")?Ee(e.default):{}}function Mj(e,t){return{}}function Cj(e,t){if(e.uniqueItems===!0&&!pe(e,"default"))throw new Sn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!pe(e,"default"))throw new Sn(e,"Array with the contains constraint requires a default value");return"default"in e?Ee(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(r=>vn(e.items,t)):[]}function Oj(e,t){return pe(e,"default")?Ee(e.default):(async function*(){})()}function kj(e,t){return pe(e,"default")?Ee(e.default):BigInt(0)}function Nj(e,t){return pe(e,"default")?Ee(e.default):!1}function Rj(e,t){if(pe(e,"default"))return Ee(e.default);{let r=vn(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 Ej(e,t){return pe(e,"default")?Ee(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function Aj(e,t){return pe(e,"default")?Ee(e.default):()=>vn(e.returns,t)}function Fj(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return vn(n,[...t,...r])}function $j(e,t){return pe(e,"default")?Ee(e.default):e.minimum!==void 0?e.minimum:0}function Dj(e,t){if(pe(e,"default"))return Ee(e.default);{let r=e.allOf.reduce((n,o)=>{let i=vn(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!Ie(e,t,r))throw new Sn(e,"Intersect produced invalid value. Consider using a default value.");return r}}function Lj(e,t){return pe(e,"default")?Ee(e.default):(function*(){})()}function Vj(e,t){return pe(e,"default")?Ee(e.default):e.const}function jj(e,t){if(pe(e,"default"))return Ee(e.default);throw new Sn(e,"Never types cannot be created. Consider using a default value.")}function Uj(e,t){if(pe(e,"default"))return Ee(e.default);throw new Sn(e,"Not types must have a default value")}function zj(e,t){return pe(e,"default")?Ee(e.default):null}function Bj(e,t){return pe(e,"default")?Ee(e.default):e.minimum!==void 0?e.minimum:0}function Gj(e,t){if(pe(e,"default"))return Ee(e.default);{let r=new Set(e.required),n={};for(let[o,i]of Object.entries(e.properties))r.has(o)&&(n[o]=vn(i,t));return n}}function Kj(e,t){return pe(e,"default")?Ee(e.default):Promise.resolve(vn(e.item,t))}function qj(e,t){return pe(e,"default")?Ee(e.default):{}}function Hj(e,t){return pe(e,"default")?Ee(e.default):vn(Le(e,t),t)}function Yj(e,t){if(pe(e,"default"))return Ee(e.default);throw new Sn(e,"RegExp types cannot be created. Consider using a default value.")}function Wj(e,t){if(e.pattern!==void 0){if(pe(e,"default"))return Ee(e.default);throw new Sn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(pe(e,"default"))return Ee(e.default);throw new Sn(e,"String types with formats must specify a default value")}else return pe(e,"default")?Ee(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function Xj(e,t){return pe(e,"default")?Ee(e.default):"value"in e?Symbol.for(e.value):Symbol()}function Zj(e,t){if(pe(e,"default"))return Ee(e.default);if(!gp(e))throw new Sn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return oc(e)[0]}function Qj(e,t){if(e6++>aU)throw new Sn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return pe(e,"default")?Ee(e.default):vn(Le(e,t),t)}function Jj(e,t){return pe(e,"default")?Ee(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>vn(e.items[n],t))}function eU(e,t){if(pe(e,"default"))return Ee(e.default)}function tU(e,t){if(pe(e,"default"))return Ee(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return vn(e.anyOf[0],t)}function rU(e,t){return pe(e,"default")?Ee(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function nU(e,t){return pe(e,"default")?Ee(e.default):{}}function oU(e,t){if(pe(e,"default"))return Ee(e.default)}function iU(e,t){if(pe(e,"default"))return Ee(e.default);throw new Error("User defined types must specify a default value")}function vn(e,t){let r=sr(e,t),n=e;switch(n[V]){case"Any":return Tj(n,r);case"Argument":return Mj(n,r);case"Array":return Cj(n,r);case"AsyncIterator":return Oj(n,r);case"BigInt":return kj(n,r);case"Boolean":return Nj(n,r);case"Constructor":return Rj(n,r);case"Date":return Ej(n,r);case"Function":return Aj(n,r);case"Import":return Fj(n,r);case"Integer":return $j(n,r);case"Intersect":return Dj(n,r);case"Iterator":return Lj(n,r);case"Literal":return Vj(n,r);case"Never":return jj(n,r);case"Not":return Uj(n,r);case"Null":return zj(n,r);case"Number":return Bj(n,r);case"Object":return Gj(n,r);case"Promise":return Kj(n,r);case"Record":return qj(n,r);case"Ref":return Hj(n,r);case"RegExp":return Yj(n,r);case"String":return Wj(n,r);case"Symbol":return Xj(n,r);case"TemplateLiteral":return Zj(n,r);case"This":return Qj(n,r);case"Tuple":return Jj(n,r);case"Undefined":return eU(n,r);case"Union":return tU(n,r);case"Uint8Array":return rU(n,r);case"Unknown":return nU(n,r);case"Void":return oU(n,r);default:if(!ro.Has(n[V]))throw new Sn(n,"Unknown type");return iU(n,r)}}var aU=512,e6=0;function _o(...e){return e6=0,e.length===2?vn(e[0],e[1]):vn(e[0],[])}var Rg=class extends ge{constructor(t,r){super(r),this.schema=t}};function t6(e,t,r){if(e[V]==="Object"&&typeof r=="object"&&!mi(r)){let n=e,o=Object.getOwnPropertyNames(r);return Object.entries(n.properties).reduce((a,[s,c])=>{let u=c[V]==="Literal"&&c.const===r[s]?100:0,f=Ie(c,t,r[s])?10:0,p=o.includes(s)?1:0;return a+(u+f+p)},0)}else if(e[V]==="Union"){let o=e.anyOf.map(i=>Le(i,t)).map(i=>t6(i,t,r));return Math.max(...o)}else return Ie(e,t,r)?1:0}function sU(e,t,r){let n=e.anyOf.map(a=>Le(a,t)),[o,i]=[n[0],0];for(let a of n){let s=t6(a,t,r);s>i&&(o=a,i=s)}return o}function cU(e,t,r){if("default"in e)return typeof r=="function"?e.default:Re(e.default);{let n=sU(e,t,r);return ep(n,t,r)}}function uU(e,t,r){return Ie(e,t,r)?Re(r):_o(e,t)}function fU(e,t,r){return Ie(e,t,r)?r:_o(e,t)}function lU(e,t,r){if(Ie(e,t,r))return Re(r);let n=me(r)?Re(r):_o(e,t),o=lt(e.minItems)&&n.lengthnull)]:n,a=(lt(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>Po(e.items,t,c));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!Ie(e,t,s))throw new Rg(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function pU(e,t,r){if(Ie(e,t,r))return _o(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]=Po(a,t,r.prototype[i]));return o}function mU(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Po(o,[...t,...n],r)}function r6(e,t){return xe(e)&&!xe(t)||!xe(e)&&xe(t)?e:!xe(e)||!xe(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?r6(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function dU(e,t,r){if(Ie(e,t,r))return r;let n=_o(e,t),o=r6(n,r);return Ie(e,t,o)?o:n}function hU(e,t,r){throw new Rg(e,"Never types cannot be cast")}function gU(e,t,r){if(Ie(e,t,r))return r;if(r===null||typeof r!="object")return _o(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]=Po(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]=Po(e.additionalProperties,t,r[a]))}return o}function yU(e,t,r){if(Ie(e,t,r))return Re(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return _o(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=Po(o,t,s);return i}function bU(e,t,r){return Po(Le(e,t),t,r)}function xU(e,t,r){return Po(Le(e,t),t,r)}function wU(e,t,r){return Ie(e,t,r)?Re(r):me(r)?e.items===void 0?[]:e.items.map((n,o)=>Po(n,t,r[o])):_o(e,t)}function SU(e,t,r){return Ie(e,t,r)?Re(r):cU(e,t,r)}function Po(e,t,r){let n=Be(e.$id)?sr(e,t):t,o=e;switch(e[V]){case"Array":return lU(o,n,r);case"Constructor":return pU(o,n,r);case"Import":return mU(o,n,r);case"Intersect":return dU(o,n,r);case"Never":return hU(o,n,r);case"Object":return gU(o,n,r);case"Record":return yU(o,n,r);case"Ref":return bU(o,n,r);case"This":return xU(o,n,r);case"Tuple":return wU(o,n,r);case"Union":return SU(o,n,r);case"Date":case"Symbol":case"Uint8Array":return uU(e,t,r);default:return fU(o,n,r)}}function ep(...e){return e.length===3?Po(e[0],e[1],e[2]):Po(e[0],[],e[1])}function vU(e){return ra(e)&&e[V]!=="Unsafe"}function IU(e,t,r){return me(r)?r.map(n=>rn(e.items,t,n)):r}function _U(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return rn(o,[...t,...n],r)}function PU(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>rn(s,t,Re(r))).reduce((s,c)=>xe(c)?{...s,...c}:c,{});if(!xe(r)||!xe(i)||!ra(n))return i;let a=Hr(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||Ie(n,t,r[s])&&(i[s]=rn(n,t,r[s]));return i}function TU(e,t,r){if(!xe(r)||me(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(pe(e.properties,o)){r[o]=rn(e.properties[o],t,r[o]);continue}if(ra(n)&&Ie(n,t,r[o])){r[o]=rn(n,t,r[o]);continue}delete r[o]}return r}function MU(e,t,r){if(!xe(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]=rn(a,t,r[c]);continue}if(ra(n)&&Ie(n,t,r[c])){r[c]=rn(n,t,r[c]);continue}delete r[c]}return r}function CU(e,t,r){return rn(Le(e,t),t,r)}function OU(e,t,r){return rn(Le(e,t),t,r)}function kU(e,t,r){if(!me(r))return r;if(ft(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function NU(e,t,r){for(let n of e.anyOf)if(vU(n)&&Ie(n,t,r))return rn(n,t,r);return r}function rn(e,t,r){let n=Be(e.$id)?sr(e,t):t,o=e;switch(o[V]){case"Array":return IU(o,n,r);case"Import":return _U(o,n,r);case"Intersect":return PU(o,n,r);case"Object":return TU(o,n,r);case"Record":return MU(o,n,r);case"Ref":return CU(o,n,r);case"This":return OU(o,n,r);case"Tuple":return kU(o,n,r);case"Union":return NU(o,n,r);default:return r}}function Eg(...e){return e.length===3?rn(e[0],e[1],e[2]):rn(e[0],[],e[1])}function Ag(e){return Be(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function RU(e){return Yn(e)||No(e)||lt(e)}function tp(e){return e===!0||lt(e)&&e===1||Yn(e)&&e===BigInt("1")||Be(e)&&(e.toLowerCase()==="true"||e==="1")}function rp(e){return e===!1||lt(e)&&(e===0||Object.is(e,-0))||Yn(e)&&e===BigInt("0")||Be(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function EU(e){return Be(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function AU(e){return Be(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function FU(e){return Be(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 $U(e){return Be(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 DU(e){return Be(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function LU(e,t){let r=o6(e);return r===t?r:e}function VU(e,t){let r=i6(e);return r===t?r:e}function jU(e,t){let r=n6(e);return r===t?r:e}function UU(e,t){return Be(e.const)?LU(t,e.const):lt(e.const)?VU(t,e.const):No(e.const)?jU(t,e.const):t}function n6(e){return tp(e)?!0:rp(e)?!1:e}function zU(e){let t=r=>r.split(".")[0];return Ag(e)?BigInt(t(e)):lt(e)?BigInt(Math.trunc(e)):rp(e)?BigInt(0):tp(e)?BigInt(1):e}function o6(e){return di(e)&&e.description!==void 0?e.description.toString():RU(e)?e.toString():e}function i6(e){return Ag(e)?parseFloat(e):tp(e)?1:rp(e)?0:e}function BU(e){return Ag(e)?parseInt(e):lt(e)?Math.trunc(e):tp(e)?1:rp(e)?0:e}function GU(e){return Be(e)&&e.toLowerCase()==="null"?null:e}function KU(e){return Be(e)&&e==="undefined"?void 0:e}function qU(e){return Nr(e)?e:lt(e)?new Date(e):tp(e)?new Date(1):rp(e)?new Date(0):Ag(e)?new Date(parseInt(e)):AU(e)?new Date(`1970-01-01T${e}.000Z`):EU(e)?new Date(`1970-01-01T${e}`):$U(e)?new Date(`${e}.000Z`):FU(e)?new Date(e):DU(e)?new Date(`${e}T00:00:00.000Z`):e}function HU(e,t,r){return(me(r)?r:[r]).map(o=>To(e.items,t,o))}function YU(e,t,r){return zU(r)}function WU(e,t,r){return n6(r)}function XU(e,t,r){return qU(r)}function ZU(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return To(o,[...t,...n],r)}function QU(e,t,r){return BU(r)}function JU(e,t,r){return e.allOf.reduce((n,o)=>To(o,t,n),r)}function ez(e,t,r){return UU(e,r)}function tz(e,t,r){return GU(r)}function rz(e,t,r){return i6(r)}function nz(e,t,r){if(!xe(r)||me(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))pe(r,n)&&(r[n]=To(e.properties[n],t,r[n]));return r}function oz(e,t,r){if(!(xe(r)&&!me(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=To(i,t,s);return r}function iz(e,t,r){return To(Le(e,t),t,r)}function az(e,t,r){return o6(r)}function sz(e,t,r){return Be(r)||lt(r)?Symbol(r):r}function cz(e,t,r){return To(Le(e,t),t,r)}function uz(e,t,r){return me(r)&&!ft(e.items)?r.map((o,i)=>iMo(e.items,t,`${r}/${i}`,o))):xt(e,r,n)}function mz(e,t,r,n){if(!xe(n)||sn(n))return xt(e,r,n);let o=Sp(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(!Ae(e.unevaluatedProperties))return xt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=xt(c,`${r}/${f}`,u[f]));return xt(e,r,u)}function dz(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=Mo(i,[...t,...o],r,n);return xt(e,r,a)}function hz(e,t,r,n){return xt(e,r,Mo(e.not,t,r,n))}function gz(e,t,r,n){if(!xe(n))return xt(e,r,n);let o=Hr(e),i={...n};for(let u of o)pe(i,u)&&(ft(i[u])&&(!yi(e.properties[u])||jt.IsExactOptionalProperty(i,u))||(i[u]=Mo(e.properties[u],t,`${r}/${u}`,i[u])));if(!yt(e.additionalProperties))return xt(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,c={...i};for(let u of a)o.includes(u)||(c[u]=xt(s,`${r}/${u}`,c[u]));return xt(e,r,c)}function yz(e,t,r,n){if(!xe(n))return xt(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(!yt(e.additionalProperties))return xt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.test(f)||(u[f]=xt(c,`${r}/${f}`,u[f]));return xt(e,r,u)}function bz(e,t,r,n){let o=Le(e,t);return xt(e,r,Mo(o,t,r,n))}function xz(e,t,r,n){let o=Le(e,t);return xt(e,r,Mo(o,t,r,n))}function wz(e,t,r,n){return me(n)&&me(e.items)?xt(e,r,e.items.map((o,i)=>Mo(o,t,`${r}/${i}`,n[i]))):xt(e,r,n)}function Sz(e,t,r,n){for(let o of e.anyOf){if(!Ie(o,t,n))continue;let i=Mo(o,t,r,n);return xt(e,r,i)}return xt(e,r,n)}function Mo(e,t,r,n){let o=sr(e,t),i=e;switch(e[V]){case"Array":return pz(i,o,r,n);case"Import":return dz(i,o,r,n);case"Intersect":return mz(i,o,r,n);case"Not":return hz(i,o,r,n);case"Object":return gz(i,o,r,n);case"Record":return yz(i,o,r,n);case"Ref":return bz(i,o,r,n);case"Symbol":return xt(i,r,n);case"This":return xz(i,o,r,n);case"Tuple":return wz(i,o,r,n);case"Union":return Sz(i,o,r,n);default:return xt(i,r,n)}}function Dg(e,t,r){return Mo(e,t,"",r)}var Lg=class extends ge{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},qw=class extends ge{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 br(e,t,r){try{return Ae(e)?e[gt].Encode(r):r}catch(n){throw new qw(e,t,r,n)}}function vz(e,t,r,n){let o=br(e,r,n);return me(o)?o.map((i,a)=>Co(e.items,t,`${r}/${a}`,i)):o}function Iz(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=br(e,r,n);return Co(i,[...t,...o],r,a)}function _z(e,t,r,n){let o=br(e,r,n);if(!xe(n)||sn(n))return o;let i=Sp(e),a=i.map(p=>p[0]),s={...o};for(let[p,l]of i)p in s&&(s[p]=Co(l,t,`${r}/${p}`,s[p]));if(!Ae(e.unevaluatedProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.unevaluatedProperties,f={...s};for(let p of c)a.includes(p)||(f[p]=br(u,`${r}/${p}`,f[p]));return f}function Pz(e,t,r,n){return br(e.not,r,br(e,r,n))}function Tz(e,t,r,n){let o=br(e,r,n);if(!xe(o))return o;let i=Hr(e),a={...o};for(let f of i)pe(a,f)&&(ft(a[f])&&(!yi(e.properties[f])||jt.IsExactOptionalProperty(a,f))||(a[f]=Co(e.properties[f],t,`${r}/${f}`,a[f])));if(!yt(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,u={...a};for(let f of s)i.includes(f)||(u[f]=br(c,`${r}/${f}`,u[f]));return u}function Mz(e,t,r,n){let o=br(e,r,n);if(!xe(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]=Co(e.patternProperties[i],t,`${r}/${p}`,s[p]));if(!yt(e.additionalProperties))return s;let c=Object.getOwnPropertyNames(s),u=e.additionalProperties,f={...s};for(let p of c)a.test(p)||(f[p]=br(u,`${r}/${p}`,f[p]));return f}function Cz(e,t,r,n){let o=Le(e,t),i=Co(o,t,r,n);return br(e,r,i)}function Oz(e,t,r,n){let o=Le(e,t),i=Co(o,t,r,n);return br(e,r,i)}function kz(e,t,r,n){let o=br(e,r,n);return me(e.items)?e.items.map((i,a)=>Co(i,t,`${r}/${a}`,o[a])):[]}function Nz(e,t,r,n){for(let o of e.anyOf){if(!Ie(o,t,n))continue;let i=Co(o,t,r,n);return br(e,r,i)}for(let o of e.anyOf){let i=Co(o,t,r,n);if(Ie(e,t,i))return br(e,r,i)}return br(e,r,n)}function Co(e,t,r,n){let o=sr(e,t),i=e;switch(e[V]){case"Array":return vz(i,o,r,n);case"Import":return Iz(i,o,r,n);case"Intersect":return _z(i,o,r,n);case"Not":return Pz(i,o,r,n);case"Object":return Tz(i,o,r,n);case"Record":return Mz(i,o,r,n);case"Ref":return Cz(i,o,r,n);case"This":return Oz(i,o,r,n);case"Tuple":return kz(i,o,r,n);case"Union":return Nz(i,o,r,n);default:return br(i,r,n)}}function Vg(e,t,r){return Co(e,t,"",r)}function Rz(e,t){return Ae(e)||Qt(e.items,t)}function Ez(e,t){return Ae(e)||Qt(e.items,t)}function Az(e,t){return Ae(e)||Qt(e.returns,t)||e.parameters.some(r=>Qt(r,t))}function Fz(e,t){return Ae(e)||Qt(e.returns,t)||e.parameters.some(r=>Qt(r,t))}function $z(e,t){return Ae(e)||Ae(e.unevaluatedProperties)||e.allOf.some(r=>Qt(r,t))}function Dz(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Ae(e)||Qt(n,[...r,...t])}function Lz(e,t){return Ae(e)||Qt(e.items,t)}function Vz(e,t){return Ae(e)||Qt(e.not,t)}function jz(e,t){return Ae(e)||Object.values(e.properties).some(r=>Qt(r,t))||yt(e.additionalProperties)&&Qt(e.additionalProperties,t)}function Uz(e,t){return Ae(e)||Qt(e.item,t)}function zz(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Ae(e)||Qt(n,t)||yt(e.additionalProperties)&&Ae(e.additionalProperties)}function Bz(e,t){return Ae(e)?!0:Qt(Le(e,t),t)}function Gz(e,t){return Ae(e)?!0:Qt(Le(e,t),t)}function Kz(e,t){return Ae(e)||!ft(e.items)&&e.items.some(r=>Qt(r,t))}function qz(e,t){return Ae(e)||e.anyOf.some(r=>Qt(r,t))}function Qt(e,t){let r=sr(e,t),n=e;if(e.$id&&Hw.has(e.$id))return!1;switch(e.$id&&Hw.add(e.$id),e[V]){case"Array":return Rz(n,r);case"AsyncIterator":return Ez(n,r);case"Constructor":return Az(n,r);case"Function":return Fz(n,r);case"Import":return Dz(n,r);case"Intersect":return $z(n,r);case"Iterator":return Lz(n,r);case"Not":return Vz(n,r);case"Object":return jz(n,r);case"Promise":return Uz(n,r);case"Record":return zz(n,r);case"Ref":return Bz(n,r);case"This":return Gz(n,r);case"Tuple":return Kz(n,r);case"Union":return qz(n,r);default:return Ae(e)}}var Hw=new Set;function Bs(e,t){return Hw.clear(),Qt(e,t)}function a6(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Ie(t,r,n))throw new $g(t,n,Va(t,r,n).First());return Bs(t,r)?Dg(t,r,n):n}function Xi(e,t){let r=pe(e,"default")?e.default:void 0,n=ea(r)?r():Re(r);return ft(t)?n:xe(t)&&xe(n)?Object.assign(n,t):t}function Yw(e){return ra(e)&&"default"in e}function Hz(e,t,r){if(me(r)){for(let o=0;o{let a=Ur(i,t,n);return xe(a)?{...o,...a}:a},{})}function Zz(e,t,r){let n=Xi(e,r);if(!xe(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=Ur(e.properties[i],t,n[i]);ft(a)||(n[i]=Ur(e.properties[i],t,n[i]))}if(!Yw(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=Ur(e.additionalProperties,t,n[i]));return n}function Qz(e,t,r){let n=Xi(e,r);if(!xe(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)&&Yw(a)&&(n[c]=Ur(a,t,n[c]));if(!Yw(o))return n;for(let c of Object.getOwnPropertyNames(n))s.test(c)||(n[c]=Ur(o,t,n[c]));return n}function Jz(e,t,r){return Ur(Le(e,t),t,Xi(e,r))}function eB(e,t,r){return Ur(Le(e,t),t,r)}function tB(e,t,r){let n=Xi(e,r);if(!me(n)||ft(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;aoB,Format:()=>np,Get:()=>aB,Has:()=>iB,Set:()=>nB,ValuePointerRootDeleteError:()=>zg,ValuePointerRootSetError:()=>Ug});var Ug=class extends ge{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},zg=class extends ge{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function s6(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*np(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;nGs(e[o],t[o]))}function cB(e,t){return Nr(t)&&e.getTime()===t.getTime()}function uB(e,t){return!me(t)||e.length!==t.length?!1:e.every((r,n)=>Gs(r,t[n]))}function fB(e,t){return!Pn(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>Gs(r,t[n]))}function lB(e,t){return e===t}function Gs(e,t){if(Nr(e))return cB(e,t);if(Pn(e))return fB(e,t);if(me(e))return uB(e,t);if(xe(e))return sB(e,t);if(sn(e))return lB(e,t);throw new Error("ValueEquals: Unable to compare value")}var pB=$e({type:Oe("insert"),path:Rr(),value:no()}),mB=$e({type:Oe("update"),path:Rr(),value:no()}),dB=$e({type:Oe("delete"),path:Rr()}),u6=Fe([pB,mB,dB]),Bg=class extends ge{constructor(t,r){super(r),this.value=t}};function Gg(e,t){return{type:"update",path:e,value:t}}function f6(e,t){return{type:"insert",path:e,value:t}}function l6(e){return{type:"delete",path:e}}function c6(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new Bg(e,"Cannot diff objects with symbols")}function*hB(e,t,r){if(c6(t),c6(r),!dy(r))return yield Gg(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)pe(t,i)||(yield f6(`${e}/${i}`,r[i]));for(let i of n)pe(r,i)&&(Gs(t,r)||(yield*Kg(`${e}/${i}`,t[i],r[i])));for(let i of n)pe(r,i)||(yield l6(`${e}/${i}`))}function*gB(e,t,r){if(!me(r))return yield Gg(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function wB(e){return e.length===0}function m6(e,t){if(xB(t))return Re(t[0].value);if(wB(t))return Re(e);let r=Re(e);for(let n of t)switch(n.type){case"insert":{Oo.Set(r,n.path,n.value);break}case"update":{Oo.Set(r,n.path,n.value);break}case"delete":{Oo.Delete(r,n.path);break}}return r}function d6(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Bs(t,r)?Vg(t,r,n):n;if(!Ie(t,r,o))throw new Lg(t,o,Va(t,r,o).First());return o}function qg(e){return xe(e)&&!me(e)}var Hg=class extends ge{constructor(t){super(t)}};function SB(e,t,r,n){if(!qg(r))Oo.Set(e,t,Re(n));else{let o=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(n);for(let a of o)i.includes(a)||delete r[a];for(let a of i)o.includes(a)||(r[a]=null);for(let a of i)Ww(e,`${t}/${a}`,r[a],n[a])}}function vB(e,t,r,n){if(!me(r))Oo.Set(e,t,Re(n));else{for(let o=0;o(Ng(i,a,s),s)],["Cast",(i,a,s)=>ep(i,a,s)],["Clean",(i,a,s)=>Eg(i,a,s)],["Clone",(i,a,s)=>Re(s)],["Convert",(i,a,s)=>Fg(i,a,s)],["Decode",(i,a,s)=>Bs(i,a)?Dg(i,a,s):s],["Default",(i,a,s)=>jg(i,a,s)],["Encode",(i,a,s)=>Bs(i,a)?Vg(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})(Xw||(Xw={}));var y6=["Clone","Clean","Default","Convert","Assert","Decode"];function TB(e,t,r,n){return e.reduce((o,i)=>{let a=Xw.Get(i);if(ft(a))throw new Yg(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function b6(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?me(e[0])?[e[0],e[1],[],e[2]]:[y6,e[0],e[1],e[2]]:e.length===2?[y6,e[0],[],e[1]]:(()=>{throw new Yg("Invalid Arguments")})();return TB(t,r,n,o)}var Fu={};Ba(Fu,{Assert:()=>Ng,Cast:()=>ep,Check:()=>Ie,Clean:()=>Eg,Clone:()=>Re,Convert:()=>Fg,Create:()=>_o,Decode:()=>a6,Default:()=>jg,Diff:()=>p6,Edit:()=>u6,Encode:()=>d6,Equal:()=>Gs,Errors:()=>Va,Hash:()=>Au,Mutate:()=>g6,Parse:()=>b6,Patch:()=>m6,ValueErrorIterator:()=>La});function Wg(e){switch(e.type){case"summary_metrics":return Lw(e);case"performance_table":return Fw(e);case"prediction_distribution":return $w(e);case"outcome_distribution":return Aw(e);case"roc":return Mw(e);case"calibration":return Vk(e);case"precision_recall":return Ow(e);case"gains":return kw(e);case"lift":return Nw(e);case"decision_curve":return Rw(e);case"interventions_avoided":return Ew(e)}}function ui(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 Zw(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 MB(e){if(!Fu.Check(Fp,e))throw new Error("Invalid ReportSpec");Dp(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(Wg(r.spec)),n.append(o),t.append(n)}return t}function CB(e,t){if(!Fu.Check($p,e))throw new Error("Invalid ReportSpec");Dp(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=ui(m.id,n);a++;let b=[];for(let y of m.items)if(y.type==="group"){let x=ui(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=ui(`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(Wg(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=ui(`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=ui(`tab-${m.id}-${v.id}`,n),P=ui(`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 C=document.createElement("section");C.className="rtichoke-report__component rtichoke-report__tabpanel",C.id=P,C.setAttribute("role","tabpanel"),C.setAttribute("aria-labelledby",T),C.tabIndex=0,C.dataset.componentId=v.id,C.hidden=I!==0;let N=document.createElement("div");N.className="rtichoke-report__component-content",N.append(Wg(v.spec)),C.append(N),w.push(R),_.push(C),S.append(R)}),Zw(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 G=[],D=[];R.forEach((O,z)=>{let U=ui(`tab-${h.id}-${O.id}`,n),W=ui(`panel-${h.id}-${O.id}`,n),B=document.createElement("button");B.className="rtichoke-report__tab",B.type="button",B.id=U,B.setAttribute("role","tab"),B.setAttribute("aria-controls",W),B.setAttribute("aria-selected",z===0?"true":"false"),B.tabIndex=z===0?0:-1,B.textContent=O.title||O.id;let q=document.createElement("section");q.className="rtichoke-report__component rtichoke-report__tabpanel",q.id=W,q.setAttribute("role","tabpanel"),q.setAttribute("aria-labelledby",U),q.tabIndex=0,q.dataset.componentId=O.id,q.hidden=z!==0;let X=document.createElement("div");X.className="rtichoke-report__component-content",X.append(Wg(O.spec)),q.append(X),G.push(B),D.push(q),N.append(B)}),Zw(G,D),y.append(N,...D),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=[],C=[];S.forEach((N,G)=>{let D=b.groups[G],O=ui(`section-group-tab-${h.id}-${N.id}`,n),z=document.createElement("button");z.className="rtichoke-report__tab",z.type="button",z.id=O,z.setAttribute("role","tab"),z.setAttribute("aria-controls",D.domId),z.setAttribute("aria-selected",G===0?"true":"false"),z.tabIndex=G===0?0:-1,z.textContent=N.title;let U=l(N,D,O);U.classList.add("rtichoke-report__tabpanel"),U.setAttribute("role","tabpanel"),U.setAttribute("aria-labelledby",O),U.tabIndex=0,U.hidden=G!==0,R.push(z),C.push(U),P.append(z)}),Zw(R,C),y.append(P,...C)}}else y.append(l(T,b.groups[_++]));I++}}o.append(y)}return o}function OB(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 MB(e);if(e.schemaVersion==="1.1")return CB(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var kB=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function NB(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[Zt(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(Zt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),ci({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:kB},marks:r})}export{ab as AUROCSummaryMetricSchema,qy as CalibrationSpecSchema,kv as CalibrationV2DatumSchema,Wy as CalibrationV2SpecSchema,$v as DecisionCurveV2DatumSchema,Dv as DecisionCurveV2EvaluationSchema,Uv as DecisionCurveV2ReferenceSchema,Lv as DecisionCurveV2SeriesSchema,Qy as DecisionCurveV2SpecSchema,Cv as DiscreteCalibrationV2DatumSchema,Tv as DisplayGroupingSpecSchema,Pv as DisplayRoleSchema,Er as EvaluationSpecSchema,Jy as GainsV2SpecSchema,qv as InterventionsAvoidedTreatAllReferenceSchema,Hv as InterventionsAvoidedTreatNoneReferenceSchema,Bv as InterventionsAvoidedV2DatumSchema,Gv as InterventionsAvoidedV2EvaluationSchema,Yv as InterventionsAvoidedV2ReferenceSchema,Kv as InterventionsAvoidedV2SeriesSchema,eb as InterventionsAvoidedV2SpecSchema,tb as LiftV2SpecSchema,nf as OperatingPointDimensionSchema,Rv as OperatingPointSchema,wi as OperatingPointSpecSchema,ub as OutcomeDistributionSpecSchema,Wv as OutcomeStateSchema,Ev as PerformanceEvaluationContextSchema,Nv as PerformanceMetricDefinitionSchema,Xy as PerformanceMetricIdSchema,Ir as PerformanceMetricValueSchema,Av as PerformanceTableRowSchema,Zy as PerformanceTableSpecSchema,ib as PopulationSummaryOwnerSpecSchema,rb as PrecisionRecallV2SpecSchema,Zv as PredictionDistributionBinSchema,Qv as PredictionDistributionOperatingPointSchema,af as PredictionDistributionSpecSchema,sb as PrevalenceSummaryMetricSchema,Or as RTICHOKE_BROWSER_THEME,$k as RTICHOKE_COLORS,Mv as ReferenceLineV2SpecSchema,eI as ReportComponentSchema,lb as ReportComponentV1_1Schema,tI as ReportGroupSchema,rI as ReportSectionSchema,$3 as ReportSpecSchema,Fp as ReportSpecV1_0Schema,$p as ReportSpecV1_1Schema,Hy as RocSpecSchema,nb as RocV2SpecSchema,w3 as RtichokeChartSpecSchema,ob as RtichokeChartSpecV2Schema,gc as SeriesSpecSchema,Ov as SmoothCalibrationV2DatumSchema,fb as StandaloneCanonicalSpecSchema,of as StateDistributionSchema,Xv as StateStratumSchema,E3 as SummaryMetricSchema,cb as SummaryMetricsSpecSchema,jv as TreatAllReferenceSchema,Vv as TreatNoneReferenceSchema,mb as assertOutcomeDistributionReferentialIntegrity,pb as assertPerformanceTableReferentialIntegrity,sf as assertPredictionDistributionReferentialIntegrity,Dp as assertReportReferentialIntegrity,Lp as assertStateDistributionValid,db as assertSummaryMetricsReferentialIntegrity,Si as assertV2ReferentialIntegrity,V3 as calibrationSpecFromRtichokeRows,B3 as calibrationV2SpecFromRtichokeRows,Dk as extractOperatingPointValues,qk as preparePredictionDistributionPlotData,ZD as renderCalibration,yL as renderCalibrationV2,Rw as renderDecisionCurveV2,kw as renderGainsV2,Ew as renderInterventionsAvoidedV2,Nw as renderLiftV2,Aw as renderOutcomeDistribution,Fw as renderPerformanceTable,Ow as renderPrecisionRecallV2,$w as renderPredictionDistribution,OB as renderReport,NB as renderRoc,Mw as renderRocV2,Lw as renderSummaryMetrics,Us as renderWithOperatingPointSelection,en as resolveV2RenderOptions,L3 as rocSpecFromRtichokePython,D3 as rocSpecFromRtichokeR,z3 as rocV2SpecFromRtichokePython,U3 as rocV2SpecFromRtichokeR}; +}`)).call(wu,r);for(let G of f){let{channels:Y,values:W,facets:Z}=y.get(G);if(h===void 0||G.facet==="super"){let q=null;if(Z&&(q=Z[0],q=G.filter(q,Y,W),q.length===0))continue;let ie=G.render(q,g,W,v,I);if(ie==null)continue;M.appendChild(ie)}else{let q;for(let ie of h){if(!(G.facetAnchor?.(h,N,ie)??!ie.empty))continue;let ee=null;if(Z){let re=p.has(G);if(ee=Z[re?ie.i:0],ee=G.filter(ee,Y,W),ee.length===0)continue;!re&&ee===Z[0]&&(ee=ST(ee)),ee.fx=ie.x,ee.fy=ie.y,ee.fi=ie.i}let oe=G.render(ee,g,W,_,I);if(oe!=null){(q??=Vr(M).append("g")).append(()=>oe).datum(ie);for(let re of["aria-label","aria-description","aria-hidden","transform"])oe.hasAttribute(re)&&(q.attr(re,oe.getAttribute(re)),oe.removeAttribute(re))}}q?.selectChildren().each(K)}}let V=fk(b,I,e),{figure:D=n!=null||o!=null||i!=null||V.length>0}=e;D&&(E=O.createElement("figure"),E.className=`${c}-figure`,E.style.maxWidth="initial",n!=null&&E.append(Pk(O,n,"h2")),o!=null&&E.append(Pk(O,o,"h3")),E.append(...V,M),i!=null&&E.append(mD(O,i)),"value"in M&&(E.value=M.value,delete M.value)),E.scale=jO(g.scales),E.legend=sk(b,I,e);let H=yO();return H>0&&Vr(M).append("text").attr("x",F).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.`),E}function Pk(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function mD(e,t){let r=e.createElement("figcaption");return r.append(t),r}function Mk(e){return e.flat(1/0).filter(t=>t!=null).map(dD)}function dD(e){return typeof e.render=="function"?e:new Sw(e)}var Sw=class extends Je{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function vw(e,t){for(let r in e)kk(e[r],t);return e}function kk(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:p1(a,o)}=t[r]??{};s!=null&&(e.value=Xe(e.value,s),e.transform=!1)}function hD(e){for(let t in e)P1(t,e[t])}function Zl(e,t,r,n=gT){for(let{channels:o}of t.values())for(let i in o){let a=o[i],{scale:s}=a;if(s!=null&&n(s))if(s==="projection"){if(!QO(r)){let c=r.x?.domain===void 0,f=r.y?.domain===void 0;if(c||f){let[u,p]=eC(a);c&&ww(e,"x",u),f&&ww(e,"y",p)}}}else ww(e,s,a)}return e}function ww(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function gD(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let o=Bi(e.data);if(o==null)throw new Error("missing facet data");let i={};r!=null&&(i.fx=pu(o,{value:r,scale:"fx"})),n!=null&&(i.fy=pu(o,{value:n,scale:"fy"})),vw(i,t);let a=Jh(o,i);return{channels:i,groups:a,data:e.data}}function Tk(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:o}=e;if(n!=null||o!=null){let c=Bi(e.data??n??o);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let f={};return n!=null&&(f.fx=pu(c,{value:n,scale:"fx"})),o!=null&&(f.fy=pu(c,{value:o,scale:"fy"})),vw(f,r),{channels:f,groups:Jh(c,f)}}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)&&Ca(Bi(e.data))===Ca(s)&&tn(`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 bD(e,t={}){return Gi({...t,x:null,y:null},(r,n,o,i,a,s)=>s.getMarkState(e))}function yD(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)?fC:/^y$/i.test(o)?W1:uC,n=o(bD(r,n)),n.title=null,i===void 0&&(n.preferredAnchor=o===W1?"left":"bottom");let a=_k(r.data,n);a.facet=r.facet,a.facetAnchor=r.facetAnchor,t.push(a)}}return t}function xD(e,t,r){let{projection:n,x:o={},y:i={},fx:a={},fy:s={},axis:c,grid:f,facet:u={},facet:{axis:p=c,grid:l}=u,x:{axis:m=c,grid:h=m===null?null:f}=o,y:{axis:y=c,grid:b=y===null?null:f}=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||!iu(o)&&!Ok("x",e))&&(m=h=null),(n||!iu(i)&&!Ok("y",e))&&(y=b=null),t.has("fx")||(x=g=null),t.has("fy")||(S=w=null),m===void 0&&(m=!Ig(e,"x")),y===void 0&&(y=!Ig(e,"y")),x===void 0&&(x=!Ig(e,"fx")),S===void 0&&(S=!Ig(e,"fy")),m===!0&&(m="bottom"),y===!0&&(y="left"),x===!0&&(x=m==="top"||m===null?"bottom":"top"),S===!0&&(S=y==="right"||y===null?"left":"right");let _=[];return vg(_,w,KC,s),Sg(_,S,zC,"right","left",u,s),vg(_,g,HC,a),Sg(_,x,jC,"top","bottom",u,a),vg(_,b,GC,i),Sg(_,y,mw,"left","right",r,i),vg(_,h,qC,o),Sg(_,m,dw,"bottom","top",r,o),_}function Sg(e,t,r,n,o,i,a){if(!t)return;let s=wD(t);a=SD(s?n:t,i,a);let{line:c}=a;(r===mw||r===dw)&&c&&!Cs(c)&&e.push(bw(vD(a))),e.push(r(a)),s&&e.push(r({...a,anchor:o,label:null}))}function vg(e,t,r,n){!t||Cs(t)||e.push(r(ID(t,n)))}function wD(e){return/^\s*both\s*$/i.test(e)}function SD(e,t,{line:r=t.line,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l=t.label,labelAnchor:m,labelArrow:h=t.labelArrow,labelOffset:y}){return{anchor:e,line:r,ticks:n,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:s,tickRotate:c,fontVariant:f,ariaLabel:u,ariaDescription:p,label:l,labelAnchor:m,labelArrow:h,labelOffset:y}}function vD(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function ID(e,{stroke:t=uu(e)?e:void 0,ticks:r=_D(e)?e:void 0,tickSpacing:n,ariaLabel:o,ariaDescription:i}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:o,ariaDescription:i}}function _D(e){switch(typeof e){case"number":return!0;case"string":return!uu(e)}return en(e)||typeof e?.range=="function"}function Ig(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function Ok(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 PD(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 MD({fx:e,fy:t},r){let{marginTop:n,marginRight:o,marginBottom:i,marginLeft:a,width:s,height:c}=Zh(r),f=e&&Ck(e),u=t&&Ck(t);return{marginTop:t?u[0]:n,marginRight:e?s-f[1]:o,marginBottom:t?c-u[1]:i,marginLeft:e?f[0]:a,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:s,height:c}}function Ck(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 n{let z=Ll(dt(L,g),A?.[S]),R=dt(L,O),Q=dt(L,Z),X=dt(L,q),le=KT(c,{z:R,fill:Q,stroke:X}),xe=[],Me=[],ne=z&&_([]),me=R&&W([]),Ge=Q&&ee([]),Pt=X&&re([]),ot=e&&p([]),ht=e&&m([]),er=t&&y([]),No=t&&x([]),qt=DD(e,t,L),tr=0;for(let Ht of c)Ht.initialize(L);a&&a.initialize(L),i&&i.initialize(L);for(let Ht of P){let ja=[];for(let Ro of c)Ro.scope("facet",Ht);a&&a.scope("facet",Ht),i&&i.scope("facet",Ht);for(let[Ro,Ua]of v1(Ht,le))for(let[Du,_n]of v1(Ua,z))for(let[fe,ge]of qt(_n))if(le&&(ge.z=Ro),!(i&&!i.reduce(fe,ge))){ja.push(tr++),Me.push(o.reduceIndex(fe,L,ge)),z&&ne.push(Du),R&&me.push(le===R?Ro:R[(fe.length>0?fe:_n)[0]]),Q&&Ge.push(le===Q?Ro:Q[(fe.length>0?fe:_n)[0]]),X&&Pt.push(le===X?Ro:X[(fe.length>0?fe:_n)[0]]),ot&&(ot.push(ge.x1),ht.push(ge.x2)),er&&(er.push(ge.y1),No.push(ge.y2));for(let Se of c)Se.reduce(fe,ge);a&&a.reduce(fe,ge)}xe.push(ja)}return qT(xe,a,s),{data:Me,facets:xe}}),...!zl(c,"x")&&(u?{x1:u,x2:l,x:Dl(u,l)}:{x:v,x1:C,x2:N}),...!zl(c,"y")&&(h?{y1:h,y2:b,y:Dl(h,b)}:{y:I,y1:K,y2:F}),...w&&{[S]:w},...Object.fromEntries(c.map(({name:L,output:P})=>[L,P]))}}function ND({cumulative:e,domain:t,thresholds:r,interval:n,...o},i){return[o,{cumulative:e,domain:t,thresholds:r,interval:n,...i}]}function RD(e,{cumulative:t,domain:r,thresholds:n,interval:o},i){return e={...ii(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=o),e.value===void 0&&(e.value=i),e.thresholds=ED(e.thresholds,e.interval),e}function Rk(e){if(e==null)return;let{value:t,cumulative:r,domain:n=Wt,thresholds:o}=e,i=a=>{let s=dt(a,t),c;if(At(s)||$D(o)){s=Xe(s,u1,Float64Array);let[u,p]=typeof n=="function"?n(s):n,l=typeof o=="function"&&!ka(o)?o(s,u,p):o;typeof l=="number"&&(l=ul(u,p,l)),ka(l)&&(n===Wt&&(u=l.floor(u),p=l.offset(l.floor(p))),l=l.range(u,l.offset(p))),c=l}else{s=ri(s);let[u,p]=typeof n=="function"?n(s):n,l=typeof o=="function"&&!ka(o)?o(s,u,p):o;if(typeof l=="number")if(n===Wt){let m=rs(u,p,l);if(isFinite(m))if(m>0){let h=Math.round(u/m),y=Math.round(p/m);h*m<=u||--h,y*m>p||++y;let b=y-h+1;l=new Float64Array(b);for(let x=0;xp||++y;let b=y-h+1;l=new Float64Array(b);for(let x=0;x0?LD:_w)(f,c,s),f};return i.label=wo(t),i}function ED(e,t,r=Ek){if(e===void 0)return t===void 0?r:oi(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Wp;case"scott":return df;case"sturges":return Kp;case"auto":return Ek}return Fl(e)}return e}function AD(e,t){return GT(e,t,Ak)}function Ak(e,t,r){return w1(e,t,r,Fk)}function Fk(e,t,r){return S1(e,t,r,$k)}function $k(e,t){return jl(e,t,FD)}function FD(e){switch(`${e}`.toLowerCase()){case"x":return zD;case"x1":return UD;case"x2":return BD;case"y":return jD;case"y1":return GD;case"y2":return KD;case"z":return HT}throw new Error(`invalid bin reduce: ${e}`)}function Ek(e,t,r){return Math.min(200,df(e,t,r))}function $D(e){return _T(e)||en(e)&&At(e)}function DD(e,t,r){let n=e?.(r),o=t?.(r);return n&&o?function*(i){let a=n.bin(i);for(let[s,[c,f]]of n.entries()){let u=o.bin(a[s]);for(let[p,[l,m]]of o.entries())yield[u[p],{data:r,x1:c,y1:l,x2:f,y2:m}]}}:n?function*(i){let a=n.bin(i);for(let[s,[c,f]]of n.entries())yield[a[s],{data:r,x1:c,x2:f}]}:function*(i){let a=o.bin(i);for(let[s,[c,f]]of o.entries())yield[a[s],{data:r,y1:c,y2:f}]}}function _w(e,t,r){return t=ri(t),n=>{let o=e.map(()=>[]);for(let i of n)o[_i(t,r[i])-1]?.push(i);return o}}function LD(e,t,r){let n=_w(e,t,r);return o=>{let i=n(o);for(let a=1,s=i.length;a{let i=n(o);for(let a=i.length-2;a>=0;--a){let s=i[a+1],c=i[a];for(let f of s)c.push(f)}return i}}function Dk(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var zD={reduceIndex(e,t,{x1:r,x2:n}){return Dk(r,n)}},jD={reduceIndex(e,t,{y1:r,y2:n}){return Dk(r,n)}},UD={reduceIndex(e,t,{x1:r}){return r}},BD={reduceIndex(e,t,{x2:r}){return r}},GD={reduceIndex(e,t,{y1:r}){return r}},KD={reduceIndex(e,t,{y2:r}){return r}};var HD={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Pg=class extends Je{constructor(t,r={}){let{x1:n,y1:o,x2:i,y2:a,z:s,curve:c,tension:f}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0},z:{value:su(r),optional:!0}},r,HD),this.z=s,this.curve=Iw(c,f)}filter(t){return t}render(t,r,n,o,i){let{x1:a,y1:s,x2:c=a,y2:f=s}=n;return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,r,0,0).call(u=>u.selectAll().data(ag(t,[a,s,c,f],this,n)).enter().append("path").call(It,this).call(ig,this,n).attr("d",_x().curve(this.curve).defined(p=>p>=0).x0(p=>a[p]).y0(p=>s[p]).x1(p=>c[p]).y1(p=>f[p]))).node()}};function Pw(e,t){let{x:r=bo,...n}=_g(t);return new Pg(e,Tu(Mu({...n,x1:r,x2:void 0},r===bo?"y2":"y")))}var YD={ariaLabel:"bar"},Mw=class extends Je{constructor(t,r,n={},o=YD){super(t,r,n,o),Yl(this,n),Wl(this,n)}render(t,r,n,o,i){let{rx:a,ry:s,rx1y1:c,rx1y2:f,rx2y1:u,rx2y2:p}=this,l=this._x(r,n,o),m=this._y(r,n,o),h=this._width(r,n,o),y=this._height(r,n,o);return Le("svg:g",i).call(Dt,this,o,i).call(this._transform,this,r).call(b=>b.selectAll().data(t).enter().call(c||f||u||p?x=>x.append("path").call(It,this).call(Xl,l,m,Lk(l,h),Lk(m,y),this).call(wr,this,n):x=>x.append("rect").call(It,this).attr("x",l).attr("width",h).attr("y",m).attr("height",y).call(he,"rx",a).call(he,"ry",s).call(wr,this,n))).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:o}=this;return r?i=>r[i]+o:n+o}_y(t,{y:r},{marginTop:n}){let{insetTop:o}=this;return r?i=>r[i]+o:n+o}_width({x:t},{x:r},{marginRight:n,marginLeft:o,width:i}){let{insetLeft:a,insetRight:s}=this,c=r&&t?t.bandwidth():i-n-o;return Math.max(0,c-a-s)}_height({y:t},{y:r},{marginTop:n,marginBottom:o,height:i}){let{insetTop:a,insetBottom:s}=this,c=r&&t?t.bandwidth():i-n-o;return Math.max(0,c-a-s)}};function Lk(e,t){return typeof e=="function"&&typeof t=="function"?r=>e(r)+t(r):typeof e=="function"?r=>e(r)+t:typeof t=="function"?r=>e+t(r):e+t}var Mg=class extends Mw{constructor(t,r={},n){let{x:o,y1:i,y2:a}=r;super(t,{y1:{value:i,scale:"y"},y2:{value:a,scale:"y"},x:{value:o,scale:"x",type:"band",optional:!0}},r,n)}_transform(t,r,{y:n}){t.call(Lt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:o}){let{insetTop:i}=this;return So(t)?o+i:a=>Math.min(r[a],n[a])+i}_height({y:t},{y1:r,y2:n},{marginTop:o,marginBottom:i,height:a}){let{insetTop:s,insetBottom:c}=this;return So(t)?a-o-i-s-c:f=>Math.max(0,Math.abs(n[f]-r[f])-s-c)}};function Jl(e,t={}){return zh(t)||(t={...t,x:bo,y2:Ze}),new Mg(e,Tu(ug(Mu(t))))}var WD={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function XD(e){return e.sort===void 0&&e.reverse===void 0?jT({channel:"-r"},e):e}var Tg=class extends Je{constructor(t,r={}){let{x:n,y:o,r:i,rotate:a,symbol:s=zi,frameAnchor:c}=r,[f,u]=Ct(a,0),[p,l]=LT(s),[m,h]=Ct(i,p==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:m,scale:"r",filter:Ts,optional:!0},rotate:{value:f,optional:!0},symbol:{value:p,scale:"auto",optional:!0}},XD(r),WD),this.r=h,this.rotate=u,this.symbol=l,this.frameAnchor=Na(c);let{channels:y}=this,{symbol:b}=y;if(b){let{fill:x,stroke:g}=y;b.hint={fill:x?x.value===b.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===b.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,o,i){let{x:a,y:s}=r,{x:c,y:f,r:u,rotate:p,symbol:l}=n,{r:m,rotate:h,symbol:y}=this,[b,x]=ci(this,o),g=y===zi,S=u?void 0:m*m*Math.PI;return eu(m)&&(t=[]),Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,{x:c&&a,y:f&&s}).call(w=>w.selectAll().data(t).enter().append(g?"circle":"path").call(It,this).call(g?_=>{_.attr("cx",c?v=>c[v]:b).attr("cy",f?v=>f[v]:x).attr("r",u?v=>u[v]:m)}:_=>{_.attr("transform",vu`translate(${c?v=>c[v]:b},${f?v=>f[v]:x})${p?v=>` rotate(${p[v]})`:h?` rotate(${h})`:""}`).attr("d",u&&l?v=>{let I=po();return l[v].draw(I,u[v]*u[v]*Math.PI),I}:u?v=>{let I=po();return y.draw(I,u[v]*u[v]*Math.PI),I}:l?v=>{let I=po();return l[v].draw(I,S),I}:(()=>{let v=po();return y.draw(v,S),v})())}).call(wr,this,n)).node()}};function Ls(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=xo(t,r)),new Tg(e,{...n,x:t,y:r})}var ZD={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},ep=class extends Je{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:su(r),optional:!0}},r,ZD),this.z=i,this.curve=Nk(a,s),ql(this,r)}filter(t){return t}project(t,r,n){this.curve!==Ql&&super.project(t,r,n)}render(t,r,n,o,i){let{x:a,y:s}=n,{curve:c}=this;return Le("svg:g",i).call(Dt,this,o,i).call(Lt,this,r).call(f=>f.selectAll().data(ag(t,[a,s],this,n)).enter().append("path").call(It,this).call(ig,this,n).call(dC,this,n,i).attr("d",c===Ql&&i.projection?QD(i.path(),a,s):yl().curve(c).defined(u=>u>=0).x(u=>a[u]).y(u=>s[u]))).node()}};function QD(e,t,r){return t=ri(t),r=ri(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 Qt(e,{x:t,y:r,...n}={}){return[t,r]=xo(t,r),new ep(e,{...n,x:t,y:r})}function Tw(e,{x:t=bo,y:r=Ze,...n}={}){return new ep(e,_g({...n,x:t,y:r}))}Je.prototype.plot=function({marks:e=[],...t}={}){return ui({...t,marks:[...e,this]})};var JD=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],Vk={background:"transparent",color:"#222",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"13px"};function eL(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 tL(e){let r=[...new Set(e.data.map(m=>m.model))].length>1,n=r?JD:["#000000"],o=e.data.map(m=>({...m,tooltip:eL(m,r)})),i=[];e.references?.some(m=>m.type==="identity")&&i.push(Qt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2,strokeDasharray:"4,4"})),i.push(Qt(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(Ls(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=ui({width:600,height:s?480:600,marginLeft:64,marginBottom:s?16:56,style:Vk,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 f=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)}]`})),u=new Set(e.distribution.map(m=>m.model)).size,p=ui({width:600,height:120,marginLeft:64,marginTop:0,marginBottom:48,style:Vk,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:[Wi(f,{x1:m=>m.midpoint-m.binWidth/2,x2:m=>m.midpoint+m.binWidth/2,y:"count",fill:"model",fillOpacity:1/Math.max(u,1),title:"tooltip",tip:!0})]}),l=document.createElement("div");return l.style.width="600px",l.style.maxWidth="100%",l.append(c,p),l}var rL=0,jk=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"],Rr={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:jk,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 nL(e){let t=e.theme??{};return{...Rr,width:e.width??Rr.width,height:e.height??Rr.height,background:t.background??Rr.background,colors:e.colors??Rr.colors,margins:{...Rr.margins,...t.margins},frame:{...Rr.frame,...t.frame},typography:{...Rr.typography,...t.typography},axis:{...Rr.axis,...t.axis},line:{...Rr.line,...t.line},marker:{...Rr.marker,...t.marker},reference:{...Rr.reference,...t.reference},legend:{...Rr.legend,...t.legend},tip:{...Rr.tip,...t.tip},predictionDistribution:{...Rr.predictionDistribution,...t.predictionDistribution}}}function rn(e,t={}){let r=t.allGroups??(typeof e=="number"?Array.from({length:e},(s,c)=>`group-${c+1}`):[...e]),n=nL(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 Uk(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(f=>f.seriesId===i).map(f=>f[r]).filter(f=>typeof f=="number"&&Number.isFinite(f)),c=new Set(s);if(o===null)o=c;else{let f=o;o=new Set(Array.from(f).filter(u=>c.has(u)))}}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 oL(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 Ou(e,t,r,n,o){let i=tp(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=rn(i,s),{theme:f,colorByGroup:u}=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=`${f.width}px`;let h=document.createElement("div");h.className="rtichoke-legend",h.style.paddingLeft=`${f.margins.left}px`,h.setAttribute("aria-label","Chart legend");let y=new Map;i.forEach(g=>{let S=document.createElement("button");S.type="button",S.className="rtichoke-legend-item",S.setAttribute("aria-pressed","true");let 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=u.get(g)??"#000000",_.append(v);let I=document.createElement("span");I.className="rtichoke-legend-label",I.textContent=w,S.append(_,I),h.append(S),y.set(g,S)});let b=document.createElement("div");b.className="rtichoke-legend-content";let x=()=>{let g=oL(e,l),S=r(g,s,a,w=>{a=w,o&&o(w)});b.replaceChildren(S)};return i.forEach(g=>{let S=y.get(g);S.addEventListener("click",()=>{if(l.has(g)){if(l.size<=1)return;l.delete(g),S.setAttribute("aria-pressed","false")}else l.add(g),S.setAttribute("aria-pressed","true");x()})}),m.append(h,b),x(),m}function js(e,t,r,n,o){if(!e.operatingPoint)return r(e,void 0);let i=Uk(e);if(i.length===0)return r(e,void 0);let a=rn(tp(e),t),{theme:s}=a,c=document.createElement("div");c.className="rtichoke-operating-point-chart",c.style.maxWidth=`${s.width}px`;let f=document.createElement("div");f.className="rtichoke-operating-point-control",f.style.marginLeft=`${s.margins.left}px`,f.style.marginRight=`${s.margins.right}px`;let u=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-${++rL}`,m=document.createElement("label");m.className="rtichoke-operating-point-label",m.htmlFor=l;let h=document.createElement("span");h.textContent=`${p}: `;let y=document.createElement("span");y.className="rtichoke-operating-point-value";let b=document.createElement("input");b.type="range",b.id=l,b.className="rtichoke-operating-point-slider",b.min="0",b.max=String(i.length-1),b.step="1",b.setAttribute("aria-label",u);let x=0;if(n!==void 0){let v=i.indexOf(n);v!==-1&&(x=v)}let g=i[x];b.value=String(x);let S=g.toFixed(s.tip.digits);y.textContent=S,b.setAttribute("aria-valuetext",S),o&&o(g),m.append(h,y),f.append(m,b);let w=document.createElement("div");w.className="rtichoke-operating-point-content";let _=v=>{w.replaceChildren(r(e,v))};return b.addEventListener("input",()=>{let v=Number(b.value),I=i[v],O=I.toFixed(s.tip.digits);y.textContent=O,b.setAttribute("aria-valuetext",O),o&&o(I),_(I)}),c.append(w,f),_(g),c}function iL(e){return new Map(e.series.map(t=>[t.id,t.display]))}function tp(e){return[...new Set(e.series.map(t=>t.display.group))]}function Og(e,t){let r=iL(e);return t.map(n=>({...n,group:r.get(n.seriesId).group,label:r.get(n.seriesId).label}))}var aL={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"},sL=new Set(["true_positives","true_negatives","false_positives","false_negatives","predicted_positives"]);function cL(e,t,r){if(t!=null)return sL.has(e)&&Number.isInteger(t)?String(t):t.toFixed(r)}function Da(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=aL[a]??a,f=cL(a,s,r);f!==void 0&&i.push([c,f])}return i}function Ue(e,t){if(e!=null)return typeof e=="number"?e.toFixed(t):String(e)}function Vt(e,t){return t.filter(([,r])=>r!==void 0).map(([r,n])=>`${r}: ${typeof n=="number"?n.toFixed(e):String(n)}`).join(` +`)}function Cg(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 Cw(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(Qt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",...r})):o.type==="horizontal"&&o.value!==void 0?n.push(Io([o.value],{...r})):o.type==="path"&&o.points&&n.push(Qt(o.points,{x:"x",y:"y",...r}));return n}function kg(e,t){return e}function uL(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;cu.seriesId,40),a=n.theme,s=o?.marker?.radius??a.marker.radius,c=o?.marker?.stroke??a.marker.stroke,f=o?.marker?.strokeWidth??a.marker.strokeWidth;return Ls(i,{ariaLabel:"ordinary-point",x:t,y:r,fill:"group",stroke:c,strokeWidth:f,r:s})}function ku(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,f=o?.marker?.radius??6;return Ls(e,{className:"rtichoke-selected-operating-point",x:t,y:r,fill:a,stroke:s,strokeWidth:c,r:f})}function fL(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 lL(e){let t=gn(e);if(!t)return"#ffffff";let r=t.rgb(),n=fL(r.r,r.g,r.b),o=(1+.05)/(n+.05);return(n+.05)/(0+.05)>=o?"#000000":"#ffffff"}function Us(e,t){let r=typeof SVGSVGElement<"u"&&e instanceof SVGSVGElement?e:e.querySelector("svg[class^='plot-']")??e.querySelector("svg");if(!r)return;let n=Vr(r),o=e.scale?.("x")??r.scale?.("x"),i=e.scale?.("y")??r.scale?.("y");if(!o||!i)return;let a=t.items.filter(b=>Number.isFinite(b.xValue)&&Number.isFinite(b.yValue)).map(b=>({...b,px:o.apply(b.xValue),py:i.apply(b.yValue)})),s=(t.selectedOperatingPointItems??[]).filter(b=>Number.isFinite(b.xValue)&&Number.isFinite(b.yValue)).map(b=>({...b,px:o.apply(b.xValue),py:i.apply(b.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 f=c.select("path.rtichoke-hover-tooltip-arrow"),u=c.select("rect.rtichoke-hover-tooltip-bg"),p=c.select("text.rtichoke-hover-tooltip-text");function l(b,x,g,S=!1){let w=x.filter(([,ee])=>ee!=null);if(w.length===0)return;let _=S||x.length===1&&x[0][0]==="Reference",v=t.tooltipStyle==="light",I=t.tooltipStyle==="plotly",O=v?"#ffffff":_&&!I?"#f3f4f6":g,M=v?"#1f2937":I?_?t.theme.frame.color:"#ffffff":_?"#1f2937":lL(g),E=v?"#d1d5db":I?_?t.theme.frame.color:"#ffffff":_?"#d1d5db":"#374151";p.attr("fill",M).attr("font-family",t.theme.typography.fontFamily).attr("font-size",I?"13px":"11px").attr("transform",null),p.selectAll("tspan").remove(),w.forEach(([ee,oe],re)=>{let L=p.append("tspan").attr("x","0").attr("dy",re===0?"1em":I?"1.3em":"1.2em"),P=ee!==""&&ee!==null&&ee!==void 0,A=oe!==""&&oe!==null&&oe!==void 0;P&&A?(L.append("tspan").attr("font-weight","bold").text(`${ee}: `),L.append("tspan").attr("font-weight","normal").text(String(oe))):P?L.append("tspan").attr("font-weight","bold").text(String(ee)):A&&L.append("tspan").attr("font-weight","normal").text(String(oe))});let C=p.node();if(!C)return;let N=C.getBBox(),K=8,F=6,T=Math.max(N.width+K*2,60),V=N.height+F*2,[D,H]=ma(b,r),G=r?.viewBox?.baseVal,Y=G&&G.width>0?G.width:r?.width?.baseVal?.value||t.theme.width,W=G&&G.height>0?G.height:r?.height?.baseVal?.value||t.theme.height,Z=t.theme.margins,q=D+12;q+T>Y-Z.right&&(q=D-12-T),qW-Z.bottom&&(ie=W-Z.bottom-V),I){let ee=q>D?q:q+T;f.attr("d",`M${D},${H} L${ee},${H-6} L${ee},${H+6} Z`).attr("fill",O).attr("stroke",E).attr("stroke-width",1)}else f.attr("d",null);u.attr("x",q).attr("y",ie).attr("width",T).attr("height",V).attr("fill",O).attr("stroke",E).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+K-N.x}, ${ie+F-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 b of t.references??[]){let x=b.backgroundColor??"#f3f4f6",g=[["Reference",b.label]];if(b.type==="identity"){let S=b.points&&b.points.length>=2?b.points:[{x:0,y:0},{x:1,y:1}],w=S[0].x,_=S[S.length-1].x,v=S.map((I,O)=>`${O===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[O]=ma(I,r),M=Array.isArray(o.range)?o.range[0]:typeof o.range=="function"?o.range()[0]:t.theme.margins.left,E=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,C=t.xDomain?t.xDomain[0]:0,N=t.xDomain?t.xDomain[1]:1,K;if(typeof o.invert=="function")K=o.invert(O);else{let D=E!==M?(O-M)/(E-M):0;K=C+D*(N-C)}let F=Math.max(w,Math.min(_,K)),T=zs(F),V=[[b.label,""],["Predicted",T],["Observed",T]];l(I,V,x,!0)}else l(I,g,x,!0)}).on("mouseleave pointerleave",m)}else if(b.type==="horizontal"&&b.value!==void 0){let S=i.apply(b.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(b.type==="path"&&b.points&&b.points.length>0){let S=b.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 y=new Map;for(let b of a){let x=y.get(b.seriesId);x||(x=[],y.set(b.seriesId,x)),x.push(b)}for(let b of y.values()){if(b.length<2)continue;let x=b.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]=ma(g,r),_=1/0,v=b[0];for(let I of b){let O=I.px-S,M=I.py-w,E=O*O+M*M;E<_&&(_=E,v=I)}l(g,v.tooltipFields,v.backgroundColor)}).on("mouseleave pointerleave",m)}for(let b of a)h.append("circle").attr("class","rtichoke-hover-point-target").attr("cx",b.px).attr("cy",b.py).attr("r",8).attr("fill","transparent").style("pointer-events","all").on("pointermove",x=>l(x,b.tooltipFields,b.backgroundColor)).on("mouseleave pointerleave",m);for(let b of s)h.append("circle").attr("class","rtichoke-hover-op-target").attr("cx",b.px).attr("cy",b.py).attr("r",10).attr("fill","transparent").style("pointer-events","all").on("pointermove",x=>l(x,b.tooltipFields,b.backgroundColor)).on("mouseleave pointerleave",m);n.on("mouseleave pointerleave",m)}var pL=100;function zs(e){if(!Number.isFinite(e))return String(e);let t=Math.round(e*1e3)/1e3;return String(t)}function zk(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 mL(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:zk(r,t.x),y:zk(n,t.y)}}function Ow(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,f=Number.isFinite(s)&&s>0?s:1,u=i*(f/c),p=o??t.bottom;return Math.round(t.top+u+p)}function qn(e,t){let r=ui(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 dL=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],hL=["sensitivity","ppv","specificity","false_positive_rate","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],gL=["sensitivity","specificity","false_positive_rate","ppv","npv","lift","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"],bL=["lift","sensitivity","specificity","false_positive_rate","ppv","npv","net_benefit","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function yL(e,t={},r){vi(e);let n=rn(tp(e),t),{theme:o,colorByGroup:i}=n,a=e.operatingPoint?.dimension,s=Og(e,e.data).map(x=>{let g=1-x.specificity,S=[["Series",x.label]];return a==="ppcr"?(x.ppcr!==void 0&&S.push(["PPCR",Ue(x.ppcr,o.tip.digits)]),S.push(["Cutoff",Ue(x.cutoff,o.tip.digits)])):(S.push(["Cutoff",Ue(x.cutoff,o.tip.digits)]),x.ppcr!==void 0&&S.push(["PPCR",Ue(x.ppcr,o.tip.digits)])),x.performance&&x.performance.length>0?S.push(["Sensitivity",Ue(x.sensitivity,o.tip.digits)],["Specificity",Ue(x.specificity,o.tip.digits)],["FPR",Ue(g,o.tip.digits)],...Da(x.performance,dL,o.tip.digits,new Set(["sensitivity","specificity","false_positive_rate"]))):S.push(["Sensitivity",Ue(x.sensitivity,o.tip.digits)],["Specificity",Ue(x.specificity,o.tip.digits)],["False Positive Rate",Ue(g,o.tip.digits)]),{...x,false_positive_rate:g,tooltipFields:S,title:Vt(o.tip.digits,S)}}),c=Cw(e,o);c.push(Qt(s,{x:"false_positive_rate",y:"sensitivity",z:"seriesId",stroke:"group",strokeWidth:o.line.width,strokeDasharray:o.line.dash??void 0}),Cu(s,"false_positive_rate","sensitivity",n,t.theme));let f=[];if(r!==void 0&&e.operatingPoint){let x=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr";f=s.filter(g=>g[x]===r),f.length>0&&c.push(ku(f,"false_positive_rate","sensitivity",n,t.theme))}let u=e.xAxis.domain??[0,1],p=e.yAxis.domain??[0,1],l=Ow(o.width,o.margins,u,p),m=qn({...Cg(n,e),height:l,x:$a(o,e.xAxis.label,u),y:$a(o,e.yAxis.label,p),marks:kg(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"})),y=f.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=[];for(let x of e.references??[]){let g=x.label??(x.type==="identity"?"Identity":"Reference");x.type==="identity"?b.push({type:"identity",points:[{x:0,y:0},{x:1,y:1}],label:g}):x.type==="horizontal"&&x.value!==void 0?b.push({type:"horizontal",value:x.value,label:g}):x.type==="path"&&x.points&&b.push({type:"path",points:x.points,label:g})}return Us(m,{items:h,selectedOperatingPointItems:y,references:b,theme:o}),m}function kw(e,t={}){return Ou(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>js(a,n,(f,u)=>yL(f,n,u),s,c),o,i))}function xL(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=Vr(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"),f=a.select("text.rtichoke-hover-tooltip-text");function u(y,b,x){let g=b.filter(([,H])=>H!=null);if(g.length===0)return;f.attr("fill","#ffffff").attr("font-family",r.theme.typography.fontFamily).attr("font-size","13px").attr("transform",null),f.selectAll("tspan").remove(),g.forEach(([H,G],Y)=>{let W=f.append("tspan").attr("x","0").attr("dy",Y===0?"1em":"1.2em"),Z=H!==""&&H!==null&&H!==void 0,q=G!==""&&G!==null&&G!==void 0;Z&&q?(W.append("tspan").attr("font-weight","bold").text(`${H}: `),W.append("tspan").attr("font-weight","normal").text(String(G))):Z?W.append("tspan").attr("font-weight","bold").text(String(H)):q&&W.append("tspan").attr("font-weight","normal").text(String(G))});let S=f.node();if(!S)return;let w=S.getBBox(),_=8,v=6,I=Math.max(w.width+_*2,60),O=w.height+v*2,[M,E]=ma(y,n),C=n?.viewBox?.baseVal,N=C&&C.width>0?C.width:n?.width?.baseVal?.value||r.theme.width,K=C&&C.height>0?C.height:n?.height?.baseVal?.value||r.theme.height,F=r.theme.margins,T=M+12;T+I>N-F.right&&(T=M-12-I),TK-F.bottom&&(V=K-F.bottom-O);let D=T>M?T:T+I;s.attr("d",`M${M},${E} L${D},${E-6} L${D},${E+6} Z`).attr("fill",x).attr("stroke","#ffffff").attr("stroke-width",1),c.attr("x",T).attr("y",V).attr("width",I).attr("height",O).attr("fill",x).attr("stroke","#ffffff").attr("stroke-width",1).attr("rx",0).attr("ry",0).style("filter",null),f.attr("transform",`translate(${T+_-w.x}, ${V+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((y,b)=>b.count-y.count);for(let y of h){if(y.count<=0)continue;let b=y.midpoint-y.binWidth/2,x=y.midpoint+y.binWidth/2,g=Math.abs(b)<1e-9?0:b,S=Math.abs(x)<1e-9?0:x,w=zs(g),_=zs(S),v=g<=0?`[0,${_}]`:`( ${w} , ${_} ]`,I=`${y.count} observations in ${v}`,O=[];r.groupCount>1&&O.push([y.label,""]),O.push(["",I]);let M=i.apply(b),E=i.apply(x),C=Math.min(M,E),N=Math.max(Math.abs(E-M),2),K=0,F=r.height??r.theme.height;if(m){let T=m.apply(0),V=m.apply(y.count);K=Math.min(T,V),F=Math.max(Math.abs(T-V),4)}l.append("rect").attr("class","rtichoke-hover-hist-target").attr("x",C).attr("width",N).attr("y",K).attr("height",F).attr("fill","transparent").style("pointer-events","all").on("pointermove",T=>u(T,O,r.colorByGroup.get(y.group)??"#1b9e77")).on("mouseleave pointerleave",p)}o.on("mouseleave pointerleave",p)}function wL(e,t,r,n){vi(e);let o=rn(tp(e),t),{theme:i,colorByGroup:a}=o,s=Og(e,e.data).map(M=>{let E=[];o.groups.length>1&&E.push([M.label,""]);let C=zs(M.predicted),N=zs(M.observed);if(M.method==="discrete"&&M.events!==void 0&&M.total!==void 0){let K=Number.isInteger(M.events)?String(M.events):zs(M.events),F=Number.isInteger(M.total)?String(M.total):zs(M.total);N+=` ( ${K} / ${F} )`}return E.push(["Predicted",C]),E.push(["Observed",N]),{...M,tooltipFields:E}}),c=Cw(e,i);c.push(Qt(s,{x:"predicted",y:"observed",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}));let f=s.filter(M=>M.method==="discrete");f.length>0&&c.push(Ls(f,{x:"predicted",y:"observed",fill:i.marker.fill??"group",stroke:i.marker.stroke,strokeWidth:i.marker.strokeWidth,r:i.marker.radius}));let u=(e.distribution?.length??0)>0,p=n.y,l=n.x,m,h=pL,y=i,b=u?8:i.margins.bottom,x=i.margins.bottom;if(r){x=40;let N=19.4;h=Math.round(87.3+x);let F=378.3;b=Math.round(N);let T=550,V=Math.max(50,T-40),D=Math.max(50,F),H=Math.abs(l[1]-l[0])||1,G=Math.abs(p[1]-p[0])||1,Y=Math.min(V/H,D/G),W=H*Y,Z=G*Y,q=Math.max(10,(T-W)/2),ie=Math.max(10,T-W-q),ee=Math.max(0,F-Z),oe=25+ee/2;b=Math.round(N)+ee/2,m=550-h,y={...i,width:T,margins:{top:oe,left:q,right:ie,bottom:b}}}else u?(b=8,m=Ow(i.width,i.margins,l,p,b)):m=Ow(i.width,i.margins,l,p,i.margins.bottom);let g={...o,theme:y},S=qn({...Cg(g,e),height:m,marginBottom:b,x:u?{...$a(y,e.xAxis.label,l),axis:null,label:null}:$a(y,e.xAxis.label,l),y:$a(y,e.yAxis.label,p),marks:kg(c,y)},y);S.style.cursor="crosshair";let w=s.map(M=>({seriesId:M.seriesId,group:M.group,xValue:M.predicted,yValue:M.observed,tooltipFields:M.tooltipFields,backgroundColor:a.get(M.group)??"#1b9e77"})),_=[];for(let M of e.references??[]){let E=M.label&&M.label!=="Identity"?M.label:M.type==="identity"?"Perfectly Calibrated":"Reference";if(M.type==="identity"){let C=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]));C<=N&&_.push({type:"identity",points:[{x:C,y:C},{x:N,y:N}],label:E,backgroundColor:y.reference.color})}else M.type==="horizontal"&&M.value!==void 0?_.push({type:"horizontal",value:M.value,label:E,backgroundColor:y.reference.color}):M.type==="path"&&M.points&&_.push({type:"path",points:M.points,label:E,backgroundColor:y.reference.color})}if(Us(S,{items:w,references:_,theme:y,tooltipStyle:"plotly",xDomain:l,yDomain:p}),!u||!e.distribution)return S;let v=Og(e,e.distribution),I=qn({...Cg(g,e),height:h,marginTop:0,marginBottom:x,x:$a(y,e.xAxis.label,l),y:{label:null,grid:!1,ticks:3,tickSize:y.axis.tickSize,tickPadding:y.axis.tickPadding},color:{legend:!1,domain:o.groups,range:o.colors},marks:kg([Wi(v,{x1:M=>M.midpoint-M.binWidth/2,x2:M=>M.midpoint+M.binWidth/2,y:"count",fill:"group",fillOpacity:1/Math.max(o.groups.length,1)})],y)},y);I.style.cursor="crosshair",xL(I,v,{theme:y,xDomain:l,groupCount:o.groups.length,colorByGroup:a,height:h});let O=document.createElement("div");return O.className="rtichoke-calibration",O.style.width=`${y.width}px`,O.style.maxWidth="100%",O.append(S,I),O}function Bk(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=mL(e,o),a=s=>{let c=wL(e,t,r,s?i:o);return c.dataset.calibrationZoom=s?"autorange":"configured",c.addEventListener("dblclick",f=>{f.preventDefault();let u=a(!s);c.replaceWith(u)}),c};return a(!1)}function SL(e,t={}){return Bk(e,t,!1)}function Gk(e){return Bk(e,{},!0)}function vL(e,t,r,n,o){vi(e);let i=rn(tp(e),t),{theme:a,colorByGroup:s}=i,c=e.operatingPoint?.dimension,f=Og(e,e.data).map(b=>{let x=b,g=[["Series",b.label]];return e.type==="precision_recall"?(c==="ppcr"?(x.ppcr!==void 0&&g.push(["PPCR",Ue(x.ppcr,a.tip.digits)]),g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)])):(g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)]),x.ppcr!==void 0&&g.push(["PPCR",Ue(x.ppcr,a.tip.digits)])),g.push(["Sensitivity",Ue(x.sensitivity,a.tip.digits)],["PPV",Ue(x.ppv,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Da(x.performance,hL,a.tip.digits,new Set(["sensitivity","ppv"])))):e.type==="gains"?(c==="probability_threshold"?(g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)]),g.push(["PPCR",Ue(x.ppcr,a.tip.digits)])):(g.push(["PPCR",Ue(x.ppcr,a.tip.digits)]),g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)])),g.push(["Sensitivity",Ue(x.sensitivity,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Da(x.performance,gL,a.tip.digits,new Set(["sensitivity"])))):e.type==="lift"&&(c==="probability_threshold"?(g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)]),g.push(["PPCR",Ue(x.ppcr,a.tip.digits)])):(g.push(["PPCR",Ue(x.ppcr,a.tip.digits)]),g.push(["Cutoff",Ue(x.cutoff,a.tip.digits)])),g.push(["Lift",Ue(x.lift,a.tip.digits)]),x.performance&&x.performance.length>0&&g.push(...Da(x.performance,bL,a.tip.digits,new Set(["lift"])))),{...b,tooltipFields:g,title:Vt(a.tip.digits,g)}}),u=Cw(e,a);u.push(Qt(f,{x:r,y:n,z:"seriesId",stroke:"group",strokeWidth:a.line.width,strokeDasharray:a.line.dash??void 0}),Cu(f,r,n,i,t.theme));let p=[];if(o!==void 0&&e.operatingPoint){let x=e.operatingPoint.dimension==="probability_threshold"?"cutoff":"ppcr";p=f.filter(g=>g[x]===o),p.length>0&&u.push(ku(p,r,n,i,t.theme))}let l=qn({...Cg(i,e),x:$a(a,e.xAxis.label,e.xAxis.domain),y:$a(a,e.yAxis.label,e.yAxis.domain),marks:kg(u,a)},a),m=f.map(b=>({seriesId:b.seriesId,group:b.group,xValue:Number(b[r]),yValue:Number(b[n]),tooltipFields:b.tooltipFields,backgroundColor:s.get(b.group)??"#1b9e77"})),h=p.map(b=>({seriesId:b.seriesId,group:b.group,xValue:Number(b[r]),yValue:Number(b[n]),tooltipFields:b.tooltipFields,backgroundColor:s.get(b.group)??"#1b9e77"})),y=[];for(let b of e.references??[]){let x=b.label??(b.type==="identity"?"Identity":"Reference");b.type==="identity"?y.push({type:"identity",points:[{x:0,y:0},{x:1,y:1}],label:x}):b.type==="horizontal"&&b.value!==void 0?y.push({type:"horizontal",value:b.value,label:x}):b.type==="path"&&b.points&&y.push({type:"path",points:b.points,label:x})}return Us(l,{items:m,selectedOperatingPointItems:h,references:y,theme:a}),l}function IL(e){return[...new Set(e.series.map(t=>t.horizon).filter(t=>t!==void 0))]}function _L(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 Nu(e,t,r,n){let o=IL(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 f=document.createElement("div"),u=p=>{f.replaceChildren(t(_L(e,p),i,l=>{i=l,n&&n(l)}))};return c.addEventListener("change",()=>u(Number(c.value))),a.append(s,f),u(o[0]),a}function Nw(e,t,r,n){return Ou(e,t,(o,i,a,s)=>Nu(o,(c,f,u)=>js(c,i,(p,l)=>vL(p,i,r,n,l),f,u),a,s))}function Rw(e,t={}){return Nw(e,t,"sensitivity","ppv")}function Ew(e,t={}){return Nw(e,t,"ppcr","sensitivity")}function Aw(e,t={}){return Nw(e,t,"ppcr","lift")}var PL=["net_benefit","ppcr","sensitivity","specificity","false_positive_rate","ppv","npv","lift","predicted_positives","true_positives","true_negatives","false_positives","false_negatives"];function Fw(e,t={}){return vi(e),Ou(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>js(a,n,(f,u)=>ML(f,n,u),s,c),o,i))}function ML(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=rn(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])),f=e.data.map(g=>{let S=[["Series",s.get(g.seriesId).label],["Threshold",Ue(g.threshold,i.tip.digits)],["Net Benefit",Ue(g.netBenefit,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...Da(g.performance,PL,i.tip.digits,new Set(["net_benefit"]))),{...g,group:s.get(g.seriesId).group,label:s.get(g.seriesId).label,tooltipFields:S,title:Vt(i.tip.digits,S)}}),u={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(Io([0],{...u})):p.push(Qt(g.points,{x:"x",y:"y",...u}));p.push(Qt(f,{x:"threshold",y:"netBenefit",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Cu(f,"threshold","netBenefit",o,t.theme));let l=[];r!==void 0&&e.operatingPoint&&(l=f.filter(g=>g.threshold===r),l.length>0&&p.push(ku(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=qn({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),y=f.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.netBenefit,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),b=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 Us(h,{items:y,selectedOperatingPointItems:b,references:x,theme:i}),h}var TL=["net_benefit_interventions_avoided","net_benefit","predicted_positives","ppcr","true_negatives","false_negatives"];function $w(e,t={}){return vi(e),Ou(e,t,(r,n,o,i)=>Nu(r,(a,s,c)=>js(a,n,(f,u)=>OL(f,n,u),s,c),o,i))}function OL(e,t,r){let n=[...new Set(e.series.map(g=>g.display.group))],o=rn(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])),f=e.data.map(g=>{let S=[["Series",s.get(g.seriesId).label],["Threshold",Ue(g.threshold,i.tip.digits)],["Interventions Avoided",Ue(g.interventionsAvoided,i.tip.digits)]];return g.performance&&g.performance.length>0&&S.push(...Da(g.performance,TL,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:Vt(i.tip.digits,S)}}),u={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(Io([0],{...u})):p.push(Qt(g.points,{x:"x",y:"y",...u}));p.push(Qt(f,{x:"threshold",y:"interventionsAvoided",z:"seriesId",stroke:"group",strokeWidth:i.line.width,strokeDasharray:i.line.dash??void 0}),Cu(f,"threshold","interventionsAvoided",o,t.theme));let l=[];r!==void 0&&e.operatingPoint&&(l=f.filter(g=>g.threshold===r),l.length>0&&p.push(ku(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=qn({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),y=f.map(g=>({seriesId:g.seriesId,group:g.group,xValue:g.threshold,yValue:g.interventionsAvoided,tooltipFields:g.tooltipFields,backgroundColor:a.get(g.group)??"#1b9e77"})),b=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 Us(h,{items:y,selectedOperatingPointItems:b,references:x,theme:i}),h}var CL=0,kL=0,Kk={real_positive:"Event",target_event:"Event",real_competing:"Competing event",competing_outcome:"Competing event",real_negative:"Event-free",no_target_event:"Event-free",real_censored:"Censored",unknown:"Censored"},qk={real_positive:"#4C5454",real_positives_est:"#4C5454",target_event:"#4C5454",real_competing:"#C880B7",real_competing_est:"#C880B7",competing_outcome:"#C880B7",real_negative:"#E0E0E0",real_negatives_est:"#E0E0E0",no_target_event:"#E0E0E0",real_censored:"#E3F09B",real_censored_est:"#E3F09B",unknown:"#E3F09B"},NL=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Ru=["#EDF5FD","#D5E8FA","#AFD4F3","#7EB9E7","#4999D7","#2477BB","#155A98","#103C70"],Dw=["#2672B9","#FFC247","#9E91CF","#E68A31","#7CC4E4","#6D7797","#D7B86B","#B9B1CC"];function Hk(e){let t=e.replace("#",""),r=parseInt(t,16);return[r>>16&255,r>>8&255,r&255]}function RL(e,t,r){let n=o=>Math.min(255,Math.max(0,Math.round(o))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(r)}`.toUpperCase()}function EL(e,t,r){let[n,o,i]=Hk(e),[a,s,c]=Hk(t);return RL(n+r*(a-n),o+r*(s-o),i+r*(c-i))}function AL(e){if(e<=0)return[];if(e===1)return[Ru[Ru.length-1]];let t=Ru.length-1,r=[];for(let n=0;nu+(p.mass!==void 0&&p.mass!==null?p.mass:0),0)),a&&(c=r.reduce((u,p)=>u+(p.count!==void 0&&p.count!==null?p.count:0),0));let f=r.map(u=>{let p=FL(u.stateId,u.label,n),l=0;return e.estimator==="aalen_johansen"&&u.estimate!==void 0&&u.estimate!==null?l=u.estimate:e.estimator==="raw"&&u.count!==void 0&&u.count!==null&&c&&c>0?l=u.count/c:o&&u.estimate!==void 0&&u.estimate!==null?l=u.estimate:i&&u.mass!==void 0&&u.mass!==null&&s&&s>0?l=u.mass/s:a&&u.count!==void 0&&u.count!==null&&c&&c>0&&(l=u.count/c),{stateId:u.stateId,label:p,proportion:l,percentage:l*100,estimate:u.estimate??null,mass:u.mass??null,count:u.count??null}});return{evaluationId:e.evaluationId,horizon:t,estimator:e.estimator,estimateOrigin:e.estimateOrigin,censoringHeuristic:e.censoringHeuristic,competingHeuristic:e.competingHeuristic,states:f,totalMass:s,totalCount:c}}function Vw(e,t,r,n,o,i,a,s){let c=[];if(s==="observed_step")c.push(["Step",e]),c.push(["State",t.label]),a==="aalen_johansen"?(t.estimate!==null&&c.push(["AJ estimated occupancy",t.estimate.toFixed(o)]),c.push(["Percentage",`${t.percentage.toFixed(1)}%`])):(t.count!==null&&c.push(["Observed count",t.count]),r!==null&&c.push(["Observed denominator",r]),c.push(["Observed percentage",`${t.percentage.toFixed(1)}%`]));else{c.push([i?"Time":"Horizon",e]),c.push(["Outcome status",t.label]);let f=t.count??t.mass,u=r??n;f!=null&&c.push(["Count",f]),c.push(["Percent",`${t.percentage.toFixed(1)}%`]),u!=null&&c.push(["Denominator",u]),c.push(["Accounting","Raw observed status"]),(t.stateId==="real_censored"||t.label.toLowerCase().includes("censored"))&&c.push(["Note","Censored before horizon; no censoring adjustment is applied."])}return Vt(o,c)}function zw(e,t={}){gy(e);let r=++CL,n=rn(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=document.createElement("div");s.className="rtichoke-outcome-distribution",s.style.width=`${o.width}px`,s.style.maxWidth="100%";let c=e.title??"Outcome Distribution",f=document.createElement("h3");f.className="rtichoke-outcome-distribution__title",f.textContent=c,s.append(f);let u=document.createElement("div");u.className="rtichoke-outcome-distribution__controls",s.append(u);let p=document.createElement("div");p.className="rtichoke-outcome-distribution__readout",s.append(p);let l=document.createElement("div");l.className="rtichoke-operating-point-control",l.style.marginLeft=`${o.margins.left}px`,l.style.marginRight=`${o.margins.right}px`;let m=`rtichoke-od-slider-${++kL}`,h=document.createElement("label");h.className="rtichoke-operating-point-label",h.htmlFor=m;let y=document.createElement("span"),b=document.createElement("span");b.className="rtichoke-operating-point-value",h.append(y,b);let x=document.createElement("input");x.type="range",x.id=m,x.className="rtichoke-operating-point-slider",l.append(h,x);let g=document.createElement("div");g.className="rtichoke-legend",g.style.paddingLeft=`${o.margins.left}px`;let S=document.createElement("div");S.className="rtichoke-outcome-distribution__chart",s.append(l,g,S);let _=(e.stateScale??"nominal")==="ordinal",v=new Map;if(e.stateDistributions.length>0){let C=e.stateDistributions.some(F=>F.estimateOrigin==="observed_step"),N=[];for(let F of e.stateDistributions)for(let T of F.states)N.includes(T.stateId)||N.push(T.stateId);let K=N.length;if(_){let F=AL(K);N.forEach((T,V)=>{v.set(T,F[V])})}else C&&N.forEach((F,T)=>{let V=Dw[T%Dw.length];v.set(F,V)})}let I=0,O=C=>{if(v.has(C))return v.get(C);let N=e.stateDistributions.some(T=>T.estimateOrigin==="observed_step");if(!_&&!N&&qk[C]){let T=qk[C];return v.set(C,T),T}let K=N?Dw:NL,F=K[I%K.length];return I++,v.set(C,F),F},M=null,E=()=>{if(u.replaceChildren(),e.evaluations.length>1){let L=document.createElement("div");L.className="rtichoke-pd-radio-group",L.setAttribute("role","radiogroup"),L.setAttribute("aria-label","Evaluation");let P=document.createElement("span");P.className="rtichoke-pd-radio-group-label",P.textContent="Evaluation:",L.append(P);let A=document.createElement("div");A.className="rtichoke-pd-radio-options";for(let z of e.evaluations){let R=z.label??z.model??z.population??z.id,Q=document.createElement("label");Q.className="rtichoke-pd-radio-option";let X=document.createElement("input");X.type="radio",X.name=`od-eval-${r}`,X.value=z.id,X.checked=z.id===a,X.addEventListener("change",()=>{X.checked&&(a=z.id,M=null,E())});let le=document.createElement("span");le.textContent=R,Q.append(X,le),A.append(Q)}L.append(A),u.append(L)}let C=e.stateDistributions.filter(L=>L.evaluationId===a);if(C.length===0){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let L=document.createElement("p");L.className="rtichoke-outcome-distribution__empty",L.textContent="No state distribution data available.",S.append(L);return}let N=new Set,K=!1;for(let L of C){let A=`${L.estimateOrigin??"unspecified"}:${L.horizon??0}`;if(N.has(A)){K=!0;break}N.add(A)}if(K){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let L=document.createElement("p");L.className="rtichoke-outcome-distribution__empty",L.textContent="Multiple heuristic/method variants detected for evaluation; unsupported data state.",S.append(L);return}let F=C.filter(L=>L.estimateOrigin==="event_table").map(Lw).sort((L,P)=>L.horizon-P.horizon),T=C.filter(L=>L.estimateOrigin==="fixed_time_horizon").map(Lw).sort((L,P)=>L.horizon-P.horizon),V=C.filter(L=>L.estimateOrigin==="observed_step").map(Lw).sort((L,P)=>L.horizon-P.horizon),D=V.length>0,H=D?Array.from(new Set(V.map(L=>L.horizon))).sort((L,P)=>L-P):Array.from(new Set(T.map(L=>L.horizon))).sort((L,P)=>L-P);if(F.length===0&&T.length===0&&V.length===0){l.style.display="none",g.style.display="none",p.replaceChildren(),S.replaceChildren();let L=document.createElement("p");L.className="rtichoke-outcome-distribution__empty",L.textContent="No outcome distribution data found for current selection.",S.append(L);return}let G=F.length>0||D&&V.length>1,Y=D&&V.length===1;if(D)if(V.length>1){l.style.display="flex",(M===null||!H.includes(M))&&(M=H[H.length-1]);let L=H.indexOf(M),P=H.length-1;x.min="0",x.max=String(Math.max(0,P)),x.step="1",x.value=String(Math.max(0,L)),y.textContent="Step: ",b.textContent=String(M),x.setAttribute("aria-label","Step"),x.setAttribute("aria-valuetext",String(M))}else l.style.display="none",M=H[0];else if(H.length>0){l.style.display="flex",(M===null||!H.includes(M))&&(M=H[H.length-1]);let L=H.indexOf(M),P=H.length-1;x.min="0",x.max=String(Math.max(0,P)),x.step="1",x.value=String(Math.max(0,L)),y.textContent="Time: ",b.textContent=M.toFixed(i),x.setAttribute("aria-label","Time horizon"),x.setAttribute("aria-valuetext",M.toFixed(i))}else l.style.display="none";p.replaceChildren();let W=D?V.find(L=>L.horizon===M):T.find(L=>L.horizon===M)??F.find(L=>L.horizon===M);if(W){let L=document.createElement("div");L.className="rtichoke-outcome-distribution__readout-card";let P=document.createElement("div");P.className="rtichoke-outcome-distribution__readout-header",P.textContent=D?`Active Step: Step = ${W.horizon}`:`Active Horizon: Time = ${W.horizon.toFixed(i)}`,L.append(P);let A=document.createElement("table");A.className="rtichoke-outcome-distribution__readout-table";let z=document.createElement("thead"),R=document.createElement("tr"),Q=document.createElement("th");Q.textContent=D?"State":"Outcome";let X=document.createElement("th");D&&W.estimator==="aalen_johansen"?X.textContent="Occupancy (%)":X.textContent="Count / Total (%)",R.append(Q,X),z.append(R),A.append(z);let le=document.createElement("tbody"),xe=W.totalCount??W.totalMass;for(let Me of W.states){let ne=document.createElement("tr"),me=document.createElement("td"),Ge=document.createElement("span");Ge.className="rtichoke-performance-table__badge";let Pt=O(Me.stateId);Ge.style.backgroundColor=Pt,me.append(Ge,document.createTextNode(Me.label));let ot=document.createElement("td");ot.className="rtichoke-outcome-distribution__readout-cell";let ht=document.createElement("div");ht.className="rtichoke-performance-table__bar";let er=document.createElement("div");er.className="rtichoke-performance-table__bar-fill",er.style.backgroundColor=Pt,er.style.opacity="0.45";let No=Math.min(Math.max(Me.percentage,0),100);er.style.width=`${No}%`,ht.append(er);let qt=document.createElement("span");if(qt.className="rtichoke-performance-table__cell-text",D&&W.estimator==="aalen_johansen")qt.textContent=`${Me.percentage.toFixed(1)}%`;else{let tr=Me.count??Me.mass;tr!=null&&xe!==null&&xe!==void 0?qt.textContent=`${tr.toLocaleString()} / ${xe.toLocaleString()} (${Me.percentage.toFixed(1)}%)`:qt.textContent=`${Me.percentage.toFixed(1)}%`}ot.append(ht,qt),ne.append(me,ot),le.append(ne)}A.append(le),L.append(A),p.append(L)}g.replaceChildren(),g.style.display="flex";let Z=document.createElement("span");Z.style.fontWeight="600",Z.style.marginRight="0.5rem",Z.textContent="Outcome:",g.append(Z);let q=new Map,ie=D?V:G?F:T;for(let L of ie)for(let P of L.states)q.has(P.label)||q.set(P.label,{stateId:P.stateId,label:P.label});for(let L of q.values()){let P=document.createElement("div");P.className="rtichoke-legend-item";let A=document.createElement("span");A.className="rtichoke-legend-swatch";let z=document.createElement("span");z.className="rtichoke-legend-line",z.style.backgroundColor=O(L.stateId),z.style.height="10px",z.style.borderRadius="2px",A.append(z);let R=document.createElement("span");R.className="rtichoke-legend-label",R.textContent=L.label,P.append(A,R),g.append(P)}let ee=[];if(D){let L=[];for(let P of V)for(let A of P.states){let z=O(A.stateId),R=Vw(P.horizon,A,P.totalCount,P.totalMass,i,!1,P.estimator,P.estimateOrigin);L.push({step:P.horizon,stepLabel:`Step ${P.horizon}`,stateId:A.stateId,label:A.label,percentage:A.percentage,color:z,title:R})}ee.push(Jl(L,Fa({x:"step",y:"percentage",z:"stateId",fill:P=>P.color,fillOpacity:P=>M===null||P.step<=M?.88:.28,stroke:o.axis.color,strokeWidth:.75,title:P=>P.title}))),M!==null&&ee.push(Jl([{step:M,percentage:100}],{x:"step",y:"percentage",fill:"none",stroke:o.axis.color,strokeWidth:2.5}))}else if(F.length>0){let L=[];for(let z of F)for(let R of z.states){let Q=O(R.stateId),X=Vw(z.horizon,R,z.totalCount,z.totalMass,i,!0,z.estimator,z.estimateOrigin);L.push({horizon:z.horizon,stateId:R.stateId,label:R.label,percentage:R.percentage,color:Q,title:X})}ee.push(Pw(L,Fa({x:"horizon",y:"percentage",z:"stateId",fill:z=>z.color,fillOpacity:.85,curve:"step-after"})));let A=(F[0]?.states??[]).length-1;if(A>0){let z=[];for(let R of F){let Q=0;for(let X=0;XP.color,fillOpacity:.88,stroke:o.axis.color,strokeWidth:.75,title:P=>P.title})))}let oe={width:o.width,height:Math.round(o.height*.65),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:D?G?{label:"Step",grid:!1,line:!0,ticks:H,tickFormat:L=>String(L),tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding}:{label:"Step",grid:!1,line:!0}:G?{label:"Time",grid:!1,line:!0,ticks:o.axis.ticks,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding}:{label:"Time",grid:!1,line:!0},y:{label:D?"State occupancy (%)":"Outcomes",domain:[0,100],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:L=>`${L}%`},marks:ee},re=qn(oe,o);S.replaceChildren(re)};return x.addEventListener("input",()=>{let C=e.stateDistributions.filter(T=>T.evaluationId===a),K=C.some(T=>T.estimateOrigin==="observed_step")?Array.from(new Set(C.filter(T=>T.estimateOrigin==="observed_step").map(T=>T.horizon??0))).sort((T,V)=>T-V):Array.from(new Set(C.filter(T=>T.estimateOrigin==="fixed_time_horizon").map(T=>T.horizon??0))).sort((T,V)=>T-V),F=Number(x.value);F>=0&&F[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 La(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=Rg(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=nn;return o.append(i,a),o}var LL=0;function Yk(e){return e.split("_").map((t,r)=>r===0?t.charAt(0).toUpperCase()+t.slice(1):t).join(" ")}function Rg(e){return Number.isInteger(e)?e.toString():new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e)}function VL(e){return e.toFixed(2)}function zL(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 jL(e,t){if(!e||e.estimate===null||e.estimate===void 0||isNaN(e.estimate))return nn;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)?nn:t(e.lower),o=e.upper===void 0||e.upper===null||isNaN(e.upper)?nn:t(e.upper);return`${r} [${n}, ${o}]`}function rp(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 jw(e,t=globalThis.document){hy(e);let r=t.createElement("div");if(r.className="rtichoke-performance-table",e.title){let P=t.createElement("div");P.className="rtichoke-performance-table__title",P.textContent=e.title,r.append(P)}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(P=>[P.id,P])),a=new Set(e.evaluations.map(P=>P.model).filter(Boolean)),s=new Set(e.evaluations.map(P=>P.population).filter(Boolean)),c=a.size>1,f=s.size>1,u=c,p=f||!c&&a.size===0&&s.size>1,l=new Map,m=0;for(let P of e.evaluations)P.model&&!l.has(P.model)&&(l.set(P.model,Ng[m%Ng.length]),m++);let h=new Map,y=0;for(let P of e.evaluations)P.population&&!h.has(P.population)&&(h.set(P.population,Ng[y%Ng.length]),y++);let b=e.evaluations.some(P=>P.label?!!(c&&P.label!==P.model||f&&P.label!==P.population||!c&&!f&&P.label!==P.model&&P.label!==P.population):!1),x=e.rows.some(P=>P.horizon!==void 0),g=e.rows.some(P=>P.context?.censoringHeuristic!==void 0),S=e.rows.some(P=>P.context?.competingEventHeuristic!==void 0),w=new Set(e.rows.map(P=>P.operatingPoint.type)),_=w.size===1&&w.has("probability_threshold"),v=w.size===1&&w.has("ppcr"),I=new Set(e.metrics.map(P=>P.id)),O=I.has("predicted_positives"),M=I.has("ppcr"),E=O&&(M||v),C=_||!v&&w.has("probability_threshold"),N=E,K=v&&!E,F=!_&&!v&&!E,T=e.rows.filter(P=>P.operatingPoint.type==="probability_threshold").map(P=>P.operatingPoint.value),V=zL(T),D=$L.map(P=>{let A=e.metrics.find(z=>z.id===P.id);return A?{id:A.id,label:A.label||P.defaultLabel}:null}).filter(P=>P!==null),H=new Set,G=D.filter(P=>H.has(P.label)?!1:(H.add(P.label),!0)),Y=0,W=0;for(let P of e.rows)for(let A of P.values)if(A.metricId==="lift"&&A.estimate!==null&&A.estimate!==void 0&&isFinite(A.estimate)&&A.estimate>Y&&(Y=A.estimate),A.metricId==="net_benefit"&&A.estimate!==null&&A.estimate!==void 0&&isFinite(A.estimate)){let z=Math.abs(A.estimate);z>W&&(W=z)}let Z=++LL,q=t.createElement("thead");q.className="rtichoke-performance-table__header";let ie=t.createElement("tr"),ee=t.createElement("tr"),oe=1;if(ee.append(_t(t,"",{ariaLabel:"Row details",className:"rtichoke-performance-table__toggle-header"})),u&&(oe++,ee.append(_t(t,"Model"))),p&&(oe++,ee.append(_t(t,"Population"))),b&&(oe++,ee.append(_t(t,"Evaluation"))),C&&(oe++,ee.append(_t(t,"Probability Threshold"))),N&&(oe++,ee.append(_t(t,"Predicted Positives"))),K&&(oe++,ee.append(_t(t,"PPCR"))),F&&(oe++,ee.append(_t(t,"Operating Point"))),x&&(oe++,ee.append(_t(t,"Time Horizon"))),g&&(oe++,ee.append(_t(t,"Censoring"))),S&&(oe++,ee.append(_t(t,"Competing Event"))),G.length>0){let P=_t(t,"",{colSpan:oe,className:"rtichoke-performance-table__spanner--empty"});ie.append(P)}if(G.length>0){let P=_t(t,"Performance Metrics",{colSpan:G.length,className:"rtichoke-performance-table__spanner"});ie.append(P);for(let A of G)ee.append(_t(t,A.label,{className:"rtichoke-performance-table__metric-header"}))}q.append(ie),q.append(ee),o.append(q);let re=oe+G.length,L=t.createElement("tbody");for(let P=0;P0?"100.00%":nn,Se.append(Yt,Kr),ge.append(Se),tr.append(ge),ht.append(tr),Ge.append(ht),me.append(Ge),xe.append(me),ne.addEventListener("click",()=>{if(!xe)return;let mr=ne.getAttribute("aria-expanded")==="true";ne.setAttribute("aria-expanded",mr?"false":"true"),ne.setAttribute("aria-label",mr?"Show confusion matrix detail":"Hide confusion matrix detail"),ne.textContent=mr?"\u25B8":"\u25BE",xe.hidden=mr})}if(R.append(le),u){let ne=z?.model??nn,me=z?.model?l.get(z.model):void 0;R.append(_o(t,ne,"rtichoke-performance-table__model",me))}if(p){let ne=z?.population??nn,me=z?.population?h.get(z.population):void 0;R.append(_o(t,ne,"rtichoke-performance-table__population",me))}b&&R.append(_o(t,z?.label??z?.id??nn,"rtichoke-performance-table__evaluation"));let Me=new Map(A.values.map(ne=>[ne.metricId,ne]));if(C){let ne=A.operatingPoint.type==="probability_threshold"?A.operatingPoint.value:void 0,me=ne!==void 0?ne.toFixed(V):nn;R.append(_o(t,me,"rtichoke-performance-table__op"))}if(N){let ne=Me.get("predicted_positives")?.estimate,me=Me.get("ppcr")?.estimate??(A.operatingPoint.type==="ppcr"?A.operatingPoint.value:void 0),Ge=nn,Pt=NaN;if(ne!=null&&me!==void 0&&me!==null){let ht=Rg(ne),er=(me*100).toFixed(2);Ge=`${ht} (${er}%)`,Pt=me*100}else me!=null&&(Ge=`${(me*100).toFixed(2)}%`,Pt=me*100);let ot=_o(t,Ge,"rtichoke-performance-table__op");isNaN(Pt)||rp(ot,t,Pt,!1,!1,"neutral"),R.append(ot)}if(K){let ne=A.operatingPoint.type==="ppcr"?A.operatingPoint.value:Me.get("ppcr")?.estimate,me=ne!=null?`PPCR ${ne.toFixed(2)}`:nn,Ge=_o(t,me,"rtichoke-performance-table__op");ne!=null&&rp(Ge,t,ne*100,!1,!1,"neutral"),R.append(Ge)}if(F){let ne=A.operatingPoint.type==="ppcr"?`PPCR ${A.operatingPoint.value.toFixed(2)}`:`Threshold ${A.operatingPoint.value.toFixed(V)}`;R.append(_o(t,ne,"rtichoke-performance-table__op"))}if(x&&R.append(_o(t,A.horizon!==void 0?Rg(A.horizon):nn,"rtichoke-performance-table__horizon")),g){let ne=A.context?.censoringHeuristic;R.append(_o(t,ne?Yk(ne):nn,"rtichoke-performance-table__context"))}if(S){let ne=A.context?.competingEventHeuristic;R.append(_o(t,ne?Yk(ne):nn,"rtichoke-performance-table__context"))}for(let ne of G){let me=Me.get(ne.id),Ge=jL(me,VL),Pt=_o(t,Ge,"rtichoke-performance-table__metric");if(Pt.dataset.metricId=ne.id,me&&me.estimate!==null&&me.estimate!==void 0&&isFinite(me.estimate)){let ot=me.estimate;if(["sensitivity","specificity","ppv","npv"].includes(ne.id))rp(Pt,t,ot*100);else if(ne.id==="lift"){let ht=Y>0?ot/Y*100:0;rp(Pt,t,ht)}else if(ne.id==="net_benefit"&&W>0){let ht=ot<0,er=Math.abs(ot)/W*50;rp(Pt,t,er,!0,ht)}}R.append(Pt)}L.append(R),xe&&L.append(xe)}return o.append(L),n.append(o),r.append(n),r}var UL=0,BL=0;function GL(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 Wk(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,f=e.bins.filter(_=>_.evaluationId===t).sort((_,v)=>_.lower-v.lower),u=0;for(let _ of f)u+=_.nPositive+_.nNegative;let p=null,l=null;if(a?.performance&&a.performance.length>0){let _=T=>{let V=a.performance?.find(D=>D.metricId===T);return V&&V.estimate!==void 0&&V.estimate!==null?V.estimate:null},v=_("true_positives"),I=_("false_positives"),O=_("true_negatives"),M=_("false_negatives"),E=_("sensitivity"),C=_("specificity"),N=_("ppv"),K=_("npv"),F=_("lift");if((E!==null||C!==null||N!==null||K!==null||F!==null)&&(p={sensitivity:E,specificity:C,ppv:N,npv:K,lift:F}),v!==null&&I!==null&&O!==null&&M!==null){let T=v+M,V=O+I,D=v+I,H=O+M;l={tp:v,fp:I,tn:O,fn:M,totalPositives:T,totalNegatives:V,totalPredictedPos:D,totalPredictedNeg:H}}}let m=e.evaluations.find(_=>_.id===t),h=m?.label??m?.model??m?.population??t,y=[],b=[];if(r==="probability_threshold"){let _=f.find(I=>I.lower===0&&I.upper===0),v=f.filter(I=>!(I.lower===0&&I.upper===0));if(_){let I=s===0?!0:_.upper>s,O=I?"TP":"FN",M=I?"True Positive (TP)":"False Negative (FN)",E=I?"FP":"TN",C=I?"False Positive (FP)":"True Negative (TN)";_.nPositive>0&&b.push({category:"Observed Positives",count:_.nPositive,classificationCell:O,cellLabel:M,title:Vt(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Positive"],["Count",_.nPositive],["Classification",M]])}),_.nNegative>0&&b.push({category:"Observed Negatives",count:_.nNegative,classificationCell:E,cellLabel:C,title:Vt(o,[["Evaluation",h],["Score Interval","[0, 0]"],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",C]])})}for(let I=0;Is,K=N?"TP":"FN",F=N?"True Positive (TP)":"False Negative (FN)",T=N?"FP":"TN",V=N?"False Positive (FP)":"True Negative (TN)",D=s===0?!0:O.upper>s,H=D?"TP":"FN",G=D?"True Positive (TP)":"False Negative (FN)",Y=D?"FP":"TN",W=D?"False Positive (FP)":"True Negative (TN)",Z=_.nPositive+O.nPositive,q=_.nNegative+O.nNegative;K===H?Z>0&&y.push({x1:M,x2:E,category:"Observed Positives",count:Z,classificationCell:H,cellLabel:G,isPredictedPositive:D,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",Z],["Classification",G]])}):(_.nPositive>0&&y.push({x1:M,x2:E,category:"Observed Positives",count:_.nPositive,classificationCell:K,cellLabel:F,isPredictedPositive:N,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",_.nPositive],["Classification",F]])}),O.nPositive>0&&y.push({x1:M,x2:E,category:"Observed Positives",count:O.nPositive,classificationCell:H,cellLabel:G,isPredictedPositive:D,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",O.nPositive],["Classification",G]])})),T===Y?q>0&&y.push({x1:M,x2:E,category:"Observed Negatives",count:q,classificationCell:Y,cellLabel:W,isPredictedPositive:D,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",q],["Classification",W]])}):(_.nNegative>0&&y.push({x1:M,x2:E,category:"Observed Negatives",count:_.nNegative,classificationCell:T,cellLabel:V,isPredictedPositive:N,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",_.nNegative],["Classification",V]])}),O.nNegative>0&&y.push({x1:M,x2:E,category:"Observed Negatives",count:O.nNegative,classificationCell:Y,cellLabel:W,isPredictedPositive:D,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",O.nNegative],["Classification",W]])}))}else{let N=s===0?!0:O.upper>s,K=N?"TP":"FN",F=N?"True Positive (TP)":"False Negative (FN)",T=N?"FP":"TN",V=N?"False Positive (FP)":"True Negative (TN)";O.nPositive>0&&y.push({x1:M,x2:E,category:"Observed Positives",count:O.nPositive,classificationCell:K,cellLabel:F,isPredictedPositive:N,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Positive"],["Count",O.nPositive],["Classification",F]])}),O.nNegative>0&&y.push({x1:M,x2:E,category:"Observed Negatives",count:O.nNegative,classificationCell:T,cellLabel:V,isPredictedPositive:N,title:Vt(o,[["Evaluation",h],["Score Interval",C],["Outcome","Observed Negative"],["Count",O.nNegative],["Classification",V]])})}}}else{let _=(e.rankBins??[]).filter(v=>v.evaluationId===t).sort((v,I)=>v.rankLower-I.rankLower);for(let v of _){let I=v.rankLower,O=v.rankUpper,M=v.positiveMass+v.negativeMass,E=I>=1-n-1e-9,C=E?"TP":"FN",N=E?"True Positive (TP)":"False Negative (FN)",K=E?"FP":"TN",F=E?"False Positive (FP)":"True Negative (TN)";if(M>0){let T=`[${I.toFixed(o)}, ${O.toFixed(o)}]`;v.positiveMass>0&&y.push({x1:I,x2:O,category:"Observed Positives",count:v.positiveMass,classificationCell:C,cellLabel:N,isPredictedPositive:E,title:Vt(o,[["Evaluation",h],["Population Rank Percentile",T],["Outcome","Observed Positive"],["Count",v.positiveMass],["Classification",N]])}),v.negativeMass>0&&y.push({x1:I,x2:O,category:"Observed Negatives",count:v.negativeMass,classificationCell:K,cellLabel:F,isPredictedPositive:E,title:Vt(o,[["Evaluation",h],["Population Rank Percentile",T],["Outcome","Observed Negative"],["Count",v.negativeMass],["Classification",F]])})}}}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 y)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 y)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:u,performanceMetrics:p,confusion:l,ordinaryPlotData:y,zeroAtomPlotData:b}}function Uw(e,t={}){cf(e);let r=++BL,n=rn(2,t),{theme:o}=n,i=o.tip.digits,a=e.evaluations[0].id,s=P=>{let A=new Set;for(let R of e.operatingPoints)R.evaluationId===P&&A.add(R.type);let z=[];return A.has("probability_threshold")&&z.push("probability_threshold"),A.has("ppcr")&&z.push("ppcr"),z},c=(P,A)=>e.operatingPoints.filter(z=>z.evaluationId===P&&z.type===A).sort((z,R)=>z.value-R.value),f=s(a),u=e.operatingPoint?.dimension&&f.includes(e.operatingPoint.dimension)?e.operatingPoint.dimension:f[0]??"probability_threshold",p=(P,A)=>{let z=c(P,A);return[...new Set(z.map(R=>R.value))].sort((R,Q)=>R-Q)},l=(P,A,z)=>{let R=p(P,A);return R.length===0?0:z!==void 0&&R.some(Q=>Math.abs(Q-z)<1e-6)?z:R.some(Q=>Math.abs(Q-.5)<1e-6)?.5:R[0]},m=l(a,u),h="stacked",y="confusion_matrix_cell",b="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 O=document.createElement("select");O.className="rtichoke-prediction-distribution__select",O.setAttribute("aria-label","Condition on");let M=document.createElement("option");M.value="predicted_positives",M.textContent="Predicted positives";let E=document.createElement("option");E.value="predicted_negatives",E.textContent="Predicted negatives";let C=document.createElement("option");C.value="real_positives",C.textContent="Real positives";let N=document.createElement("option");N.value="real_negatives",N.textContent="Real negatives",O.append(M,E,C,N),I.append(O);let K=document.createElement("select");K.className="rtichoke-prediction-distribution__select",K.setAttribute("aria-label","Operating point dimension"),K.style.display="none",S.addEventListener("change",()=>{a=S.value,L()}),w.addEventListener("change",()=>{y=w.value,L()}),O.addEventListener("change",()=>{b=O.value,L()}),K.addEventListener("change",()=>{u=K.value,m=l(a,u,m),L()});let F=(P,A,z,R,Q)=>{let X=document.createElement("div");X.className="rtichoke-pd-radio-group",X.setAttribute("role","radiogroup"),X.setAttribute("aria-label",P);let le=document.createElement("span");le.className="rtichoke-pd-radio-group-label",le.textContent=`${P}:`,X.append(le);let xe=document.createElement("div");xe.className="rtichoke-pd-radio-options";for(let Me of z){let ne=document.createElement("label");ne.className="rtichoke-pd-radio-option";let me=document.createElement("input");me.type="radio",me.name=A,me.value=Me.value,me.checked=Me.value===R,me.addEventListener("change",()=>{me.checked&&Q(Me.value)});let Ge=document.createElement("span");Ge.textContent=Me.label,ne.append(me,Ge),xe.append(ne)}return X.append(xe),X},T=document.createElement("div");T.className="rtichoke-pd-controls-row";let V=()=>{T.replaceChildren(),S.replaceChildren();for(let P of e.evaluations){let A=document.createElement("option");A.value=P.id,A.textContent=P.label??P.model??P.population??P.id,S.append(A)}if(S.value=a,e.evaluations.length>1){let P=e.evaluations.map(z=>({value:z.id,label:z.label??z.model??z.population??z.id})),A=F("Reference Group",`pd-ref-group-${r}`,P,a,z=>{a=z,L()});T.append(A)}},D=document.createElement("div");D.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 G=`rtichoke-pd-slider-${++UL}`,Y=document.createElement("label");Y.className="rtichoke-operating-point-label",Y.htmlFor=G;let W=document.createElement("span"),Z=document.createElement("span");Z.className="rtichoke-operating-point-value",Y.append(W,Z);let q=document.createElement("input");q.type="range",q.id=G,q.className="rtichoke-operating-point-slider",H.append(Y,q);let ie=document.createElement("div");ie.className="rtichoke-legend",ie.style.paddingLeft=`${o.margins.left}px`;let ee=(P,A)=>{let z=document.createElement("div");z.className="rtichoke-legend-item";let R=document.createElement("span");R.className="rtichoke-legend-swatch";let Q=document.createElement("span");Q.className="rtichoke-legend-line",Q.style.backgroundColor=A,Q.style.border=`1px solid ${o.axis.color}`,Q.style.boxSizing="border-box",Q.style.height="10px",Q.style.borderRadius="2px",R.append(Q);let X=document.createElement("span");return X.className="rtichoke-legend-label",X.textContent=P,z.append(R,X),z},oe=document.createElement("div");oe.className="rtichoke-prediction-distribution__chart";let re=document.createElement("div");re.className="rtichoke-prediction-distribution__summary",g.append(T,D),x.append(g,re,H,ie,oe);let L=()=>{V(),D.replaceChildren(),w.value=y,O.value=b==="all_observations"?"predicted_positives":b,I.style.display=y==="observed_outcome"?"none":"inline-flex",K.replaceChildren();let P=s(a);for(let fe of P){let ge=document.createElement("option");ge.value=fe,ge.textContent=fe==="probability_threshold"?"Probability threshold":"PPCR",K.append(ge)}K.value=u;let A=F("Display",`pd-display-${r}`,[{value:"stacked",label:"Stacked"},{value:"mirrored",label:"Mirrored"}],h,fe=>{h=fe,L()}),z=F("Color Bars By",`pd-color-${r}`,[{value:"confusion_matrix_cell",label:"Confusion Matrix Cell"},{value:"observed_outcome",label:"Observed Outcome"}],y,fe=>{y=fe,L()});if(D.append(A,z,S,w,I,K),P.length>1){let fe=F("Dimension",`pd-dim-${r}`,[{value:"probability_threshold",label:"Probability Threshold"},{value:"ppcr",label:"PPCR"}],u,ge=>{u=ge,m=l(a,u,m),L()});D.append(fe)}let R=p(a,u),Q=R.find(fe=>Math.abs(fe-m)<1e-6);Q!==void 0?m=Q:m=l(a,u,m);let X=R.indexOf(m);q.min="0",q.max=String(Math.max(0,R.length-1)),q.step="1",q.value=String(Math.max(0,X));let le=u==="probability_threshold"?"Probability threshold":"PPCR";W.textContent=`${le}: `,Z.textContent=m.toFixed(i),q.setAttribute("aria-label",le),q.setAttribute("aria-valuetext",m.toFixed(i));let xe=Wk(e,a,u,m,i),{cutoff:Me,cutoffX:ne,xAxisLabel:me,yAxisLabel:Ge,yMax:Pt,totalN:ot,performanceMetrics:ht,confusion:er,ordinaryPlotData:No}=xe,qt=GL(o.predictionDistribution,b);ie.replaceChildren(),y==="observed_outcome"&&ie.append(ee("Observed Positives",o.predictionDistribution.observedPositive),ee("Observed Negatives",o.predictionDistribution.observedNegative));let tr=[],Ht=u==="probability_threshold"?`Cutoff = ${Me.toFixed(i)}`:`PPCR = ${m.toFixed(i)}`,ja=Pt,Ro=h==="mirrored"?-Pt:0;tr.push(Fs([ne],{stroke:o.axis.color,strokeWidth:2,strokeDasharray:"4,3"})),tr.push(Ea([{x:ne,label:Ht}],{x:"x",y:ja,text:"label",dy:-10,fill:o.axis.color,fontSize:11,fontWeight:700})),h==="mirrored"&&tr.push(Io([0],{stroke:o.axis.color,strokeWidth:1.5}));let Ua=fe=>{let ge="";if(y==="observed_outcome")ge=fe.category==="Observed Positives"?o.predictionDistribution.observedPositive:o.predictionDistribution.observedNegative;else switch(fe.classificationCell){case"TP":ge=qt.tp;break;case"FP":ge=qt.fp;break;case"TN":ge=qt.tn;break;case"FN":ge=qt.fn;break}let Se=!0;switch(b){case"all_observations":Se=!0;break;case"predicted_positives":Se=fe.isPredictedPositive;break;case"predicted_negatives":Se=!fe.isPredictedPositive;break;case"real_positives":Se=fe.category==="Observed Positives";break;case"real_negatives":Se=fe.category==="Observed Negatives";break}return{fill:ge,fillOpacity:Se?.88:.18,strokeOpacity:Se?.4:.1}};if(h==="stacked"){let fe=No.map(ge=>{let{fill:Se,fillOpacity:Yt,strokeOpacity:Kr}=Ua(ge);return{...ge,fill:Se,fillOpacity:Yt,strokeOpacity:Kr}});tr.push(Wi(fe,Fa({x1:"x1",x2:"x2",y:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:ge=>ge.title,tip:!0})))}else{let fe=No.filter(Se=>Se.category==="Observed Positives").map(Se=>{let{fill:Yt,fillOpacity:Kr,strokeOpacity:mr}=Ua(Se);return{...Se,fill:Yt,fillOpacity:Kr,strokeOpacity:mr}}),ge=No.filter(Se=>Se.category==="Observed Negatives").map(Se=>{let{fill:Yt,fillOpacity:Kr,strokeOpacity:mr}=Ua(Se);return{...Se,fill:Yt,fillOpacity:Kr,strokeOpacity:mr}});fe.length>0&&tr.push(Wi(fe,{x1:"x1",x2:"x2",y1:0,y2:"count",fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Se=>Se.title,tip:!0})),ge.length>0&&tr.push(Wi(ge,{x1:"x1",x2:"x2",y1:0,y2:Se=>-Se.count,fill:"fill",fillOpacity:"fillOpacity",stroke:o.axis.color,strokeOpacity:"strokeOpacity",strokeWidth:.75,title:Se=>Se.title,tip:!0}))}let Du={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:me,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:Ge,domain:[Ro,ja],grid:!1,line:!0,ticks:5,tickSize:o.axis.tickSize,tickPadding:o.axis.tickPadding,tickFormat:fe=>String(Math.abs(fe))},marks:tr},_n=qn(Du,o);if(oe.replaceChildren(_n),re.replaceChildren(),er){let{tp:fe,fp:ge,tn:Se,fn:Yt,totalPositives:Kr,totalNegatives:mr,totalPredictedPos:sp,totalPredictedNeg:dr}=er,an=document.createElement("table");an.className="rtichoke-pd-matrix";let Lu=document.createElement("colgroup"),Ks=document.createElement("col");Ks.style.width="28%";let qs=document.createElement("col");qs.style.width="24%";let Hs=document.createElement("col");Hs.style.width="24%";let cp=document.createElement("col");cp.style.width="24%",Lu.append(Ks,qs,Hs,cp),an.append(Lu);let Vu=(et,ct)=>{let Qi=document.createElement("label");Qi.className=`rtichoke-pd-cond-option ${b===et?"rtichoke-pd-cond-option--active":""}`;let Hn=document.createElement("input");Hn.type="radio",Hn.name=`pd-cond-${r}`,Hn.value=et,Hn.checked=b===et,Hn.addEventListener("change",()=>{Hn.checked&&(b=et,L())});let li=document.createElement("span");return li.textContent=ct,Qi.append(Hn,li),Qi},o2=document.createElement("thead"),i2=document.createElement("tr"),Jg=document.createElement("th");Jg.className="rtichoke-pd-matrix__corner",Jg.append(Vu("all_observations","All Observations"));let eb=document.createElement("th");eb.className=`rtichoke-pd-matrix__col-header ${b==="real_positives"?"rtichoke-pd-matrix__col-header--active":""}`,eb.append(Vu("real_positives","Real Positive"));let tb=document.createElement("th");tb.className=`rtichoke-pd-matrix__col-header ${b==="real_negatives"?"rtichoke-pd-matrix__col-header--active":""}`,tb.append(Vu("real_negatives","Real Negative"));let a2=document.createElement("th");a2.className="rtichoke-pd-matrix__col-header rtichoke-pd-matrix__col-header--blank",i2.append(Jg,eb,tb,a2),o2.append(i2);let s2=document.createElement("tbody"),v6=y==="observed_outcome"?o.predictionDistribution.observedPositive:qt.tp,I6=y==="observed_outcome"?o.predictionDistribution.observedPositive:qt.fn,_6=y==="observed_outcome"?o.predictionDistribution.observedNegative:qt.fp,P6=y==="observed_outcome"?o.predictionDistribution.observedNegative:qt.tn,M6=o.predictionDistribution.observedPositive,T6=o.predictionDistribution.observedNegative,rb="#E5E7EB",O6=et=>{if(ot===0)return null;switch(b){case"all_observations":return`(${((et==="TP"?fe:et==="FP"?ge:et==="TN"?Se:Yt)/ot*100).toFixed(1)}%)`;case"predicted_positives":{let ct=fe+ge;return ct===0?null:et==="TP"?`(${(fe/ct*100).toFixed(1)}%)`:et==="FP"?`(${(ge/ct*100).toFixed(1)}%)`:null}case"predicted_negatives":{let ct=Se+Yt;return ct===0?null:et==="TN"?`(${(Se/ct*100).toFixed(1)}%)`:et==="FN"?`(${(Yt/ct*100).toFixed(1)}%)`:null}case"real_positives":{let ct=fe+Yt;return ct===0?null:et==="TP"?`(${(fe/ct*100).toFixed(1)}%)`:et==="FN"?`(${(Yt/ct*100).toFixed(1)}%)`:null}case"real_negatives":{let ct=Se+ge;return ct===0?null:et==="TN"?`(${(Se/ct*100).toFixed(1)}%)`:et==="FP"?`(${(ge/ct*100).toFixed(1)}%)`:null}}},up=(et,ct,Qi,Hn)=>{et.replaceChildren(),et.className=`rtichoke-prediction-distribution__cell--${ct.toLowerCase()} rtichoke-pd-matrix__cell`,et.style.backgroundColor="#ffffff",et.style.color=o.axis.color;let li=ot>0?Qi/ot*100:0,Ji=document.createElement("div");Ji.className="rtichoke-pd-cell-bar",Ji.style.width=`${li}%`,Ji.style.backgroundColor=Hn;let Ba=document.createElement("div");Ba.className="rtichoke-pd-cell-content";let cb=document.createElement("span");cb.className="rtichoke-pd-cell-label",cb.textContent=ct;let ub=document.createElement("div");ub.className="rtichoke-pd-cell-num";let fb=document.createElement("span");fb.className="rtichoke-pd-cell-count",fb.textContent=Qi.toLocaleString();let C6=O6(ct),lb=document.createElement("span");lb.className="rtichoke-pd-cell-pct",lb.textContent=C6??"",ub.append(fb,lb),Ba.append(cb,ub),et.append(Ji,Ba)},zu=(et,ct,Qi)=>{et.replaceChildren(),et.className="rtichoke-prediction-distribution__cell--total rtichoke-pd-matrix__cell",et.style.backgroundColor="#ffffff";let Hn=ot>0?ct/ot*100:0,li=document.createElement("div");li.className="rtichoke-pd-cell-bar",li.style.width=`${Hn}%`,li.style.backgroundColor=Qi;let Ji=document.createElement("div");Ji.className="rtichoke-pd-cell-content rtichoke-pd-cell-content--margin";let Ba=document.createElement("span");Ba.className="rtichoke-pd-cell-count",Ba.textContent=ct.toLocaleString(),Ji.append(Ba),et.append(li,Ji)},nb=document.createElement("tr");b==="predicted_positives"&&(nb.className="rtichoke-pd-matrix__row--active");let ob=document.createElement("th");ob.className=`rtichoke-pd-matrix__row-header ${b==="predicted_positives"?"rtichoke-pd-matrix__row-header--active":""}`,ob.append(Vu("predicted_positives","Predicted Positive"));let c2=document.createElement("td");up(c2,"TP",fe,v6);let u2=document.createElement("td");up(u2,"FP",ge,_6);let f2=document.createElement("td");zu(f2,sp,rb),nb.append(ob,c2,u2,f2);let ib=document.createElement("tr");b==="predicted_negatives"&&(ib.className="rtichoke-pd-matrix__row--active");let ab=document.createElement("th");ab.className=`rtichoke-pd-matrix__row-header ${b==="predicted_negatives"?"rtichoke-pd-matrix__row-header--active":""}`,ab.append(Vu("predicted_negatives","Predicted Negative"));let l2=document.createElement("td");up(l2,"FN",Yt,I6);let p2=document.createElement("td");up(p2,"TN",Se,P6);let m2=document.createElement("td");zu(m2,dr,rb),ib.append(ab,l2,p2,m2);let sb=document.createElement("tr");sb.className="rtichoke-pd-matrix__tot-row";let d2=document.createElement("th");d2.className="rtichoke-pd-matrix__row-header rtichoke-pd-matrix__row-header--blank";let h2=document.createElement("td");zu(h2,Kr,M6);let g2=document.createElement("td");zu(g2,mr,T6);let b2=document.createElement("td");zu(b2,ot,rb),sb.append(d2,h2,g2,b2),s2.append(nb,ib,sb),an.append(o2,s2),re.append(an)}if(ht){let fe=document.createElement("div");fe.className="rtichoke-pd-metrics-container rtichoke-performance-table";let ge=document.createElement("table");ge.className="rtichoke-performance-table__table rtichoke-pd-metrics-table";let Se=document.createElement("thead"),Yt=document.createElement("tr"),Kr=[{id:"sensitivity",label:"Sensitivity",val:ht.sensitivity,isEmphasized:b==="real_positives",isRatio:!1},{id:"specificity",label:"Specificity",val:ht.specificity,isEmphasized:b==="real_negatives",isRatio:!1},{id:"ppv",label:"PPV",val:ht.ppv,isEmphasized:b==="predicted_positives",isRatio:!1},{id:"npv",label:"NPV",val:ht.npv,isEmphasized:b==="predicted_negatives",isRatio:!1},{id:"lift",label:"Lift",val:ht.lift,isEmphasized:b==="predicted_positives",isRatio:!0}];for(let dr of Kr){let an=document.createElement("th");an.className=`rtichoke-performance-table__metric-header ${dr.isEmphasized?"rtichoke-pd-metric--emphasized-header":""}`,an.textContent=dr.label,Yt.append(an)}Se.append(Yt);let mr=document.createElement("tbody"),sp=document.createElement("tr");for(let dr of Kr){let an=document.createElement("td");an.className=`rtichoke-performance-table__metric ${dr.isEmphasized?"rtichoke-pd-metric--emphasized-cell":""}`;let Lu="\u2014";if(dr.val!==null&&dr.val!==void 0&&(Lu=dr.isRatio?dr.val.toFixed(2):(dr.val*100).toFixed(1)+"%"),dr.val!==null&&dr.val!==void 0&&isFinite(dr.val)){let qs=document.createElement("div");qs.className="rtichoke-performance-table__bar";let Hs=document.createElement("div");Hs.className="rtichoke-performance-table__bar-fill rtichoke-performance-table__bar-fill--positive";let cp=dr.isRatio?Math.min(100,dr.val/3*100):Math.min(100,dr.val*100);Hs.style.width=`${cp}%`,qs.append(Hs),an.append(qs)}let Ks=document.createElement("span");Ks.className="rtichoke-performance-table__cell-text",Ks.textContent=Lu,an.append(Ks),sp.append(an)}mr.append(sp),ge.append(Se,mr),fe.append(ge),re.append(fe)}};return q.addEventListener("input",()=>{let P=p(a,u),A=Number(q.value);A>=0&&A0?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 y of n){let b=t.createElement("option");b.value=String(y),b.textContent=String(y),h.append(b)}h.value=String(o),h.addEventListener("change",()=>{o=Number(h.value),l()}),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(qL(t,m));s.append(c),a.append(s);let f=new Map(e.evaluations.map(m=>[m.id,m])),u=new Map(e.populations.map(m=>[m.id,m])),p=t.createElement("tbody");for(let m of e.metrics){let h=t.createElement("tr"),y="",b="",x;if(m.metric==="auroc"){let S=f.get(m.owner.evaluationId);y=S.label??S.model??S.population??S.id,b="AUROC",h.dataset.metric="auroc",h.dataset.evaluationId=m.owner.evaluationId}else m.metric==="prevalence"?(y=u.get(m.owner.populationId).label,b="Prevalence",h.dataset.metric="prevalence",h.dataset.populationId=m.owner.populationId):m.metric==="event_risk"&&(y=u.get(m.owner.populationId).label,b="Event Probability",x=m.horizon,h.dataset.metric="event_risk",h.dataset.populationId=m.owner.populationId,h.dataset.horizon=String(m.horizon));h.append(Bw(t,y,"rtichoke-summary-metrics__owner"),Bw(t,b,"rtichoke-summary-metrics__metric"));let g=Bw(t,HL(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 YL(e){switch(e.errorType){case $.ArrayContains:return"Expected array to contain at least one matching value";case $.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case $.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case $.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case $.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case $.ArrayUniqueItems:return"Expected array elements to be unique";case $.Array:return"Expected array";case $.AsyncIterator:return"Expected AsyncIterator";case $.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case $.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case $.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case $.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case $.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case $.BigInt:return"Expected bigint";case $.Boolean:return"Expected boolean";case $.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case $.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case $.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case $.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case $.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case $.Date:return"Expected Date";case $.Function:return"Expected function";case $.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case $.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case $.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case $.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case $.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case $.Integer:return"Expected integer";case $.IntersectUnevaluatedProperties:return"Unexpected property";case $.Intersect:return"Expected all values to match";case $.Iterator:return"Expected Iterator";case $.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case $.Never:return"Never";case $.Not:return"Value should not match";case $.Null:return"Expected null";case $.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case $.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case $.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case $.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case $.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case $.Number:return"Expected number";case $.Object:return"Expected object";case $.ObjectAdditionalProperties:return"Unexpected property";case $.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case $.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case $.ObjectRequiredProperty:return"Expected required property";case $.Promise:return"Expected Promise";case $.RegExp:return"Expected string to match regular expression";case $.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case $.StringFormat:return`Expected string to match '${e.schema.format}' format`;case $.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case $.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case $.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case $.String:return"Expected string";case $.Symbol:return"Expected symbol";case $.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case $.Tuple:return"Expected tuple";case $.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case $.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case $.Uint8Array:return"Expected Uint8Array";case $.Undefined:return"Expected undefined";case $.Union:return"Expected union value";case $.Void:return"Expected void";case $.Kind:return`Expected kind '${e.schema[U]}'`;default:return"Unknown error type"}}var WL=YL;function Xk(){return WL}var Kw=class extends be{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function XL(e,t){let r=t.find(n=>n.$id===e.$ref);if(r===void 0)throw new Kw(e);return Ve(r,t)}function fr(e,t){return!Be(e.$id)||t.some(r=>r.$id===e.$id)||t.push(e),t}function Ve(e,t){return e[U]==="This"||e[U]==="Ref"?XL(e,t):e}var qw=class extends be{constructor(t){super("Unable to hash value"),this.value=t}},Sn;(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"})(Sn||(Sn={}));var Eu=BigInt("14695981039346656037"),[ZL,QL]=[BigInt("1099511628211"),BigInt("18446744073709551616")],JL=Array.from({length:256}).map((e,t)=>BigInt(t)),Zk=new Float64Array(1),Qk=new DataView(Zk.buffer),Jk=new Uint8Array(Zk.buffer);function*eV(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 tV(e){Er(Sn.Array);for(let t of e)Au(t)}function rV(e){Er(Sn.Boolean),Er(e?1:0)}function nV(e){Er(Sn.BigInt),Qk.setBigInt64(0,e);for(let t of Jk)Er(t)}function oV(e){Er(Sn.Date),Au(e.getTime())}function iV(e){Er(Sn.Null)}function aV(e){Er(Sn.Number),Qk.setFloat64(0,e);for(let t of Jk)Er(t)}function sV(e){Er(Sn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())Au(t),Au(e[t])}function cV(e){Er(Sn.String);for(let t=0;t=e.minItems)||Te(e.maxItems)&&!(r.length<=e.maxItems))return!1;for(let i of r)if(!lr(e.items,t,i))return!1;if(e.uniqueItems===!0&&!(function(){let i=new Set;for(let a of r){let s=Fu(a);if(i.has(s))return!1;i.add(s)}return!0})())return!1;if(!(Te(e.contains)||lt(e.minContains)||lt(e.maxContains)))return!0;let n=Te(e.contains)?e.contains:_e(),o=r.reduce((i,a)=>lr(n,t,a)?i+1:i,0);return!(o===0||lt(e.minContains)&&oe.maxContains)}function gV(e,t,r){return pp(r)}function bV(e,t,r){return!(!Yn(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.multipleOf)&&r%e.multipleOf!==BigInt(0))}function yV(e,t,r){return Eo(r)}function xV(e,t,r){return lr(e.returns,t,r.prototype)}function wV(e,t,r){return!(!Ar(r)||Te(e.exclusiveMaximumTimestamp)&&!(r.getTime()e.exclusiveMinimumTimestamp)||Te(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)||Te(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)||Te(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)}function SV(e,t,r){return ea(r)}function vV(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return lr(o,[...t,...n],r)}function IV(e,t,r){return!(!hp(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.multipleOf)&&r%e.multipleOf!==0)}function _V(e,t,r){let n=e.allOf.every(o=>lr(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(cc(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a));return n&&i}else if(bt(e.unevaluatedProperties)){let o=new RegExp(cc(e)),i=Object.getOwnPropertyNames(r).every(a=>o.test(a)||lr(e.unevaluatedProperties,t,r[a]));return n&&i}else return n}function PV(e,t,r){return mp(r)}function MV(e,t,r){return r===e.const}function TV(e,t,r){return!1}function OV(e,t,r){return!lr(e.not,t,r)}function CV(e,t,r){return di(r)}function kV(e,t,r){return!(!zt.IsNumberLike(r)||Te(e.exclusiveMaximum)&&!(re.exclusiveMinimum)||Te(e.minimum)&&!(r>=e.minimum)||Te(e.maximum)&&!(r<=e.maximum)||Te(e.multipleOf)&&r%e.multipleOf!==0)}function NV(e,t,r){if(!zt.IsObjectLike(r)||Te(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Te(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(!lr(i,t,r[o])||(Ja(i)||pV(i))&&!(o in r))return!1}else if(zt.IsExactOptionalProperty(r,o)&&!lr(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)||lr(e.additionalProperties,t,r[i])):!0}function RV(e,t,r){return dp(r)}function EV(e,t,r){if(!zt.IsRecordLike(r)||Te(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)||Te(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(([f,u])=>i.test(f)?lr(o,t,u):!0),s=typeof e.additionalProperties=="object"?Object.entries(r).every(([f,u])=>i.test(f)?!0:lr(e.additionalProperties,t,u)):!0,c=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every(f=>i.test(f)):!0;return a&&s&&c}function AV(e,t,r){return lr(Ve(e,t),t,r)}function FV(e,t,r){let n=new RegExp(e.source,e.flags);return Te(e.minLength)&&!(r.length>=e.minLength)||Te(e.maxLength)&&!(r.length<=e.maxLength)?!1:n.test(r)}function $V(e,t,r){return!Be(r)||Te(e.minLength)&&!(r.length>=e.minLength)||Te(e.maxLength)&&!(r.length<=e.maxLength)||Te(e.pattern)&&!new RegExp(e.pattern).test(r)?!1:Te(e.format)?ia.Has(e.format)?ia.Get(e.format)(r):!1:!0}function DV(e,t,r){return hi(r)}function LV(e,t,r){return Be(r)&&new RegExp(e.pattern).test(r)}function VV(e,t,r){return lr(Ve(e,t),t,r)}function zV(e,t,r){if(!de(r)||e.items===void 0&&r.length!==0||r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;nlr(n,t,r))}function BV(e,t,r){return!(!Ws(r)||Te(e.maxByteLength)&&!(r.length<=e.maxByteLength)||Te(e.minByteLength)&&!(r.length>=e.minByteLength))}function GV(e,t,r){return!0}function KV(e,t,r){return zt.IsVoidLike(r)}function qV(e,t,r){return ro.Has(e[U])?ro.Get(e[U])(e,r):!1}function lr(e,t,r){let n=Te(e.$id)?fr(e,t):t,o=e;switch(o[U]){case"Any":return mV(o,n,r);case"Argument":return dV(o,n,r);case"Array":return hV(o,n,r);case"AsyncIterator":return gV(o,n,r);case"BigInt":return bV(o,n,r);case"Boolean":return yV(o,n,r);case"Constructor":return xV(o,n,r);case"Date":return wV(o,n,r);case"Function":return SV(o,n,r);case"Import":return vV(o,n,r);case"Integer":return IV(o,n,r);case"Intersect":return _V(o,n,r);case"Iterator":return PV(o,n,r);case"Literal":return MV(o,n,r);case"Never":return TV(o,n,r);case"Not":return OV(o,n,r);case"Null":return CV(o,n,r);case"Number":return kV(o,n,r);case"Object":return NV(o,n,r);case"Promise":return RV(o,n,r);case"Record":return EV(o,n,r);case"Ref":return AV(o,n,r);case"RegExp":return FV(o,n,r);case"String":return $V(o,n,r);case"Symbol":return DV(o,n,r);case"TemplateLiteral":return LV(o,n,r);case"This":return VV(o,n,r);case"Tuple":return zV(o,n,r);case"Undefined":return jV(o,n,r);case"Union":return UV(o,n,r);case"Uint8Array":return BV(o,n,r);case"Unknown":return GV(o,n,r);case"Void":return KV(o,n,r);default:if(!ro.Has(o[U]))throw new Hw(o);return qV(o,n,r)}}function Ie(...e){return e.length===3?lr(e[0],e[1],e[2]):lr(e[0],[],e[1])}var $;(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"})($||($={}));var Yw=class extends be{constructor(t){super("Unknown type"),this.schema=t}};function Xi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Oe(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 te(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:Xk()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*HV(e,t,r,n){}function*YV(e,t,r,n){}function*WV(e,t,r,n){if(!de(n))return yield te($.Array,e,r,n);Oe(e.minItems)&&!(n.length>=e.minItems)&&(yield te($.ArrayMinItems,e,r,n)),Oe(e.maxItems)&&!(n.length<=e.maxItems)&&(yield te($.ArrayMaxItems,e,r,n));for(let a=0;apr(o,t,`${r}${c}`,s).next().done===!0?a+1:a,0);i===0&&(yield te($.ArrayContains,e,r,n)),lt(e.minContains)&&ie.maxContains&&(yield te($.ArrayMaxContains,e,r,n))}function*XV(e,t,r,n){pp(n)||(yield te($.AsyncIterator,e,r,n))}function*ZV(e,t,r,n){if(!Yn(n))return yield te($.BigInt,e,r,n);Oe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te($.BigIntExclusiveMinimum,e,r,n)),Oe(e.maximum)&&!(n<=e.maximum)&&(yield te($.BigIntMaximum,e,r,n)),Oe(e.minimum)&&!(n>=e.minimum)&&(yield te($.BigIntMinimum,e,r,n)),Oe(e.multipleOf)&&n%e.multipleOf!==BigInt(0)&&(yield te($.BigIntMultipleOf,e,r,n))}function*QV(e,t,r,n){Eo(n)||(yield te($.Boolean,e,r,n))}function*JV(e,t,r,n){yield*pr(e.returns,t,r,n.prototype)}function*ez(e,t,r,n){if(!Ar(n))return yield te($.Date,e,r,n);Oe(e.exclusiveMaximumTimestamp)&&!(n.getTime()e.exclusiveMinimumTimestamp)&&(yield te($.DateExclusiveMinimumTimestamp,e,r,n)),Oe(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)&&(yield te($.DateMaximumTimestamp,e,r,n)),Oe(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)&&(yield te($.DateMinimumTimestamp,e,r,n)),Oe(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0&&(yield te($.DateMultipleOfTimestamp,e,r,n))}function*tz(e,t,r,n){ea(n)||(yield te($.Function,e,r,n))}function*rz(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*pr(i,[...t,...o],r,n)}function*nz(e,t,r,n){if(!hp(n))return yield te($.Integer,e,r,n);Oe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te($.IntegerExclusiveMinimum,e,r,n)),Oe(e.maximum)&&!(n<=e.maximum)&&(yield te($.IntegerMaximum,e,r,n)),Oe(e.minimum)&&!(n>=e.minimum)&&(yield te($.IntegerMinimum,e,r,n)),Oe(e.multipleOf)&&n%e.multipleOf!==0&&(yield te($.IntegerMultipleOf,e,r,n))}function*oz(e,t,r,n){let o=!1;for(let i of e.allOf)for(let a of pr(i,t,r,n))o=!0,yield a;if(o)return yield te($.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(cc(e));for(let a of Object.getOwnPropertyNames(n))i.test(a)||(yield te($.IntersectUnevaluatedProperties,e,`${r}/${a}`,n))}if(typeof e.unevaluatedProperties=="object"){let i=new RegExp(cc(e));for(let a of Object.getOwnPropertyNames(n))if(!i.test(a)){let s=pr(e.unevaluatedProperties,t,`${r}/${a}`,n[a]).next();s.done||(yield s.value)}}}function*iz(e,t,r,n){mp(n)||(yield te($.Iterator,e,r,n))}function*az(e,t,r,n){n!==e.const&&(yield te($.Literal,e,r,n))}function*sz(e,t,r,n){yield te($.Never,e,r,n)}function*cz(e,t,r,n){pr(e.not,t,r,n).next().done===!0&&(yield te($.Not,e,r,n))}function*uz(e,t,r,n){di(n)||(yield te($.Null,e,r,n))}function*fz(e,t,r,n){if(!zt.IsNumberLike(n))return yield te($.Number,e,r,n);Oe(e.exclusiveMaximum)&&!(ne.exclusiveMinimum)&&(yield te($.NumberExclusiveMinimum,e,r,n)),Oe(e.maximum)&&!(n<=e.maximum)&&(yield te($.NumberMaximum,e,r,n)),Oe(e.minimum)&&!(n>=e.minimum)&&(yield te($.NumberMinimum,e,r,n)),Oe(e.multipleOf)&&n%e.multipleOf!==0&&(yield te($.NumberMultipleOf,e,r,n))}function*lz(e,t,r,n){if(!zt.IsObjectLike(n))return yield te($.Object,e,r,n);Oe(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield te($.ObjectMinProperties,e,r,n)),Oe(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield te($.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 te($.ObjectRequiredProperty,e.properties[s],`${r}/${Xi(s)}`,void 0));if(e.additionalProperties===!1)for(let s of a)i.includes(s)||(yield te($.ObjectAdditionalProperties,e,`${r}/${Xi(s)}`,n[s]));if(typeof e.additionalProperties=="object")for(let s of a)i.includes(s)||(yield*pr(e.additionalProperties,t,`${r}/${Xi(s)}`,n[s]));for(let s of i){let c=e.properties[s];e.required&&e.required.includes(s)?(yield*pr(c,t,`${r}/${Xi(s)}`,n[s]),Ja(e)&&!(s in n)&&(yield te($.ObjectRequiredProperty,c,`${r}/${Xi(s)}`,void 0))):zt.IsExactOptionalProperty(n,s)&&(yield*pr(c,t,`${r}/${Xi(s)}`,n[s]))}}function*pz(e,t,r,n){dp(n)||(yield te($.Promise,e,r,n))}function*mz(e,t,r,n){if(!zt.IsRecordLike(n))return yield te($.Object,e,r,n);Oe(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)&&(yield te($.ObjectMinProperties,e,r,n)),Oe(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties)&&(yield te($.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*pr(i,t,`${r}/${Xi(s)}`,c));if(typeof e.additionalProperties=="object")for(let[s,c]of Object.entries(n))a.test(s)||(yield*pr(e.additionalProperties,t,`${r}/${Xi(s)}`,c));if(e.additionalProperties===!1){for(let[s,c]of Object.entries(n))if(!a.test(s))return yield te($.ObjectAdditionalProperties,e,`${r}/${Xi(s)}`,c)}}function*dz(e,t,r,n){yield*pr(Ve(e,t),t,r,n)}function*hz(e,t,r,n){if(!Be(n))return yield te($.String,e,r,n);if(Oe(e.minLength)&&!(n.length>=e.minLength)&&(yield te($.StringMinLength,e,r,n)),Oe(e.maxLength)&&!(n.length<=e.maxLength)&&(yield te($.StringMaxLength,e,r,n)),!new RegExp(e.source,e.flags).test(n))return yield te($.RegExp,e,r,n)}function*gz(e,t,r,n){if(!Be(n))return yield te($.String,e,r,n);Oe(e.minLength)&&!(n.length>=e.minLength)&&(yield te($.StringMinLength,e,r,n)),Oe(e.maxLength)&&!(n.length<=e.maxLength)&&(yield te($.StringMaxLength,e,r,n)),Be(e.pattern)&&(new RegExp(e.pattern).test(n)||(yield te($.StringPattern,e,r,n))),Be(e.format)&&(ia.Has(e.format)?ia.Get(e.format)(n)||(yield te($.StringFormat,e,r,n)):yield te($.StringFormatUnknown,e,r,n))}function*bz(e,t,r,n){hi(n)||(yield te($.Symbol,e,r,n))}function*yz(e,t,r,n){if(!Be(n))return yield te($.String,e,r,n);new RegExp(e.pattern).test(n)||(yield te($.StringPattern,e,r,n))}function*xz(e,t,r,n){yield*pr(Ve(e,t),t,r,n)}function*wz(e,t,r,n){if(!de(n))return yield te($.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield te($.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield te($.TupleLength,e,r,n);if(e.items)for(let o=0;onew Va(pr(i,t,r,n)));yield te($.Union,e,r,n,o)}function*Iz(e,t,r,n){if(!Ws(n))return yield te($.Uint8Array,e,r,n);Oe(e.maxByteLength)&&!(n.length<=e.maxByteLength)&&(yield te($.Uint8ArrayMaxByteLength,e,r,n)),Oe(e.minByteLength)&&!(n.length>=e.minByteLength)&&(yield te($.Uint8ArrayMinByteLength,e,r,n))}function*_z(e,t,r,n){}function*Pz(e,t,r,n){zt.IsVoidLike(n)||(yield te($.Void,e,r,n))}function*Mz(e,t,r,n){ro.Get(e[U])(e,n)||(yield te($.Kind,e,r,n))}function*pr(e,t,r,n){let o=Oe(e.$id)?[...t,e]:t,i=e;switch(i[U]){case"Any":return yield*HV(i,o,r,n);case"Argument":return yield*YV(i,o,r,n);case"Array":return yield*WV(i,o,r,n);case"AsyncIterator":return yield*XV(i,o,r,n);case"BigInt":return yield*ZV(i,o,r,n);case"Boolean":return yield*QV(i,o,r,n);case"Constructor":return yield*JV(i,o,r,n);case"Date":return yield*ez(i,o,r,n);case"Function":return yield*tz(i,o,r,n);case"Import":return yield*rz(i,o,r,n);case"Integer":return yield*nz(i,o,r,n);case"Intersect":return yield*oz(i,o,r,n);case"Iterator":return yield*iz(i,o,r,n);case"Literal":return yield*az(i,o,r,n);case"Never":return yield*sz(i,o,r,n);case"Not":return yield*cz(i,o,r,n);case"Null":return yield*uz(i,o,r,n);case"Number":return yield*fz(i,o,r,n);case"Object":return yield*lz(i,o,r,n);case"Promise":return yield*pz(i,o,r,n);case"Record":return yield*mz(i,o,r,n);case"Ref":return yield*dz(i,o,r,n);case"RegExp":return yield*hz(i,o,r,n);case"String":return yield*gz(i,o,r,n);case"Symbol":return yield*bz(i,o,r,n);case"TemplateLiteral":return yield*yz(i,o,r,n);case"This":return yield*xz(i,o,r,n);case"Tuple":return yield*wz(i,o,r,n);case"Undefined":return yield*Sz(i,o,r,n);case"Union":return yield*vz(i,o,r,n);case"Uint8Array":return yield*Iz(i,o,r,n);case"Unknown":return yield*_z(i,o,r,n);case"Void":return yield*Pz(i,o,r,n);default:if(!ro.Has(i[U]))throw new Yw(e);return yield*Mz(i,o,r,n)}}function za(...e){let t=e.length===3?pr(e[0],e[1],"",e[2]):pr(e[0],[],"",e[1]);return new Va(t)}var Tz=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},t6=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)},Ww,Eg,r6,Xw=class extends be{constructor(t){let r=t.First();super(r===void 0?"Invalid Value":r.message),Ww.add(this),Eg.set(this,void 0),Tz(this,Eg,t,"f"),this.error=r}Errors(){return new Va(t6(this,Ww,"m",r6).call(this))}};Eg=new WeakMap,Ww=new WeakSet,r6=function*(){this.error&&(yield this.error),yield*t6(this,Eg,"f")};function e6(e,t,r){if(!Ie(e,t,r))throw new Xw(za(e,t,r))}function Ag(...e){return e.length===3?e6(e[0],e[1],e[2]):e6(e[0],[],e[1])}function Oz(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=Ee(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=Ee(e[r]);return t}function Cz(e){return e.map(t=>Ee(t))}function kz(e){return e.slice()}function Nz(e){return new Map(Ee([...e.entries()]))}function Rz(e){return new Set(Ee([...e.entries()]))}function Ez(e){return new Date(e.toISOString())}function Ee(e){if(de(e))return Cz(e);if(Ar(e))return Ez(e);if(Pn(e))return kz(e);if(y2(e))return Nz(e);if(x2(e))return Rz(e);if(we(e))return Oz(e);if(cn(e))return e;throw new Error("ValueClone: Unable to clone value")}var vn=class extends be{constructor(t,r){super(r),this.schema=t}};function Ae(e){return ea(e)?e():Ee(e)}function Az(e,t){return pe(e,"default")?Ae(e.default):{}}function Fz(e,t){return{}}function $z(e,t){if(e.uniqueItems===!0&&!pe(e,"default"))throw new vn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!pe(e,"default"))throw new vn(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=>In(e.items,t)):[]}function Dz(e,t){return pe(e,"default")?Ae(e.default):(async function*(){})()}function Lz(e,t){return pe(e,"default")?Ae(e.default):BigInt(0)}function Vz(e,t){return pe(e,"default")?Ae(e.default):!1}function zz(e,t){if(pe(e,"default"))return Ae(e.default);{let r=In(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 jz(e,t){return pe(e,"default")?Ae(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function Uz(e,t){return pe(e,"default")?Ae(e.default):()=>In(e.returns,t)}function Bz(e,t){let r=globalThis.Object.values(e.$defs),n=e.$defs[e.$ref];return In(n,[...t,...r])}function Gz(e,t){return pe(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function Kz(e,t){if(pe(e,"default"))return Ae(e.default);{let r=e.allOf.reduce((n,o)=>{let i=In(o,t);return typeof i=="object"?{...n,...i}:i},{});if(!Ie(e,t,r))throw new vn(e,"Intersect produced invalid value. Consider using a default value.");return r}}function qz(e,t){return pe(e,"default")?Ae(e.default):(function*(){})()}function Hz(e,t){return pe(e,"default")?Ae(e.default):e.const}function Yz(e,t){if(pe(e,"default"))return Ae(e.default);throw new vn(e,"Never types cannot be created. Consider using a default value.")}function Wz(e,t){if(pe(e,"default"))return Ae(e.default);throw new vn(e,"Not types must have a default value")}function Xz(e,t){return pe(e,"default")?Ae(e.default):null}function Zz(e,t){return pe(e,"default")?Ae(e.default):e.minimum!==void 0?e.minimum:0}function Qz(e,t){if(pe(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]=In(i,t));return n}}function Jz(e,t){return pe(e,"default")?Ae(e.default):Promise.resolve(In(e.item,t))}function ej(e,t){return pe(e,"default")?Ae(e.default):{}}function tj(e,t){return pe(e,"default")?Ae(e.default):In(Ve(e,t),t)}function rj(e,t){if(pe(e,"default"))return Ae(e.default);throw new vn(e,"RegExp types cannot be created. Consider using a default value.")}function nj(e,t){if(e.pattern!==void 0){if(pe(e,"default"))return Ae(e.default);throw new vn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(pe(e,"default"))return Ae(e.default);throw new vn(e,"String types with formats must specify a default value")}else return pe(e,"default")?Ae(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function oj(e,t){return pe(e,"default")?Ae(e.default):"value"in e?Symbol.for(e.value):Symbol()}function ij(e,t){if(pe(e,"default"))return Ae(e.default);if(!xp(e))throw new vn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return oc(e)[0]}function aj(e,t){if(n6++>dj)throw new vn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return pe(e,"default")?Ae(e.default):In(Ve(e,t),t)}function sj(e,t){return pe(e,"default")?Ae(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((r,n)=>In(e.items[n],t))}function cj(e,t){if(pe(e,"default"))return Ae(e.default)}function uj(e,t){if(pe(e,"default"))return Ae(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return In(e.anyOf[0],t)}function fj(e,t){return pe(e,"default")?Ae(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function lj(e,t){return pe(e,"default")?Ae(e.default):{}}function pj(e,t){if(pe(e,"default"))return Ae(e.default)}function mj(e,t){if(pe(e,"default"))return Ae(e.default);throw new Error("User defined types must specify a default value")}function In(e,t){let r=fr(e,t),n=e;switch(n[U]){case"Any":return Az(n,r);case"Argument":return Fz(n,r);case"Array":return $z(n,r);case"AsyncIterator":return Dz(n,r);case"BigInt":return Lz(n,r);case"Boolean":return Vz(n,r);case"Constructor":return zz(n,r);case"Date":return jz(n,r);case"Function":return Uz(n,r);case"Import":return Bz(n,r);case"Integer":return Gz(n,r);case"Intersect":return Kz(n,r);case"Iterator":return qz(n,r);case"Literal":return Hz(n,r);case"Never":return Yz(n,r);case"Not":return Wz(n,r);case"Null":return Xz(n,r);case"Number":return Zz(n,r);case"Object":return Qz(n,r);case"Promise":return Jz(n,r);case"Record":return ej(n,r);case"Ref":return tj(n,r);case"RegExp":return rj(n,r);case"String":return nj(n,r);case"Symbol":return oj(n,r);case"TemplateLiteral":return ij(n,r);case"This":return aj(n,r);case"Tuple":return sj(n,r);case"Undefined":return cj(n,r);case"Union":return uj(n,r);case"Uint8Array":return fj(n,r);case"Unknown":return lj(n,r);case"Void":return pj(n,r);default:if(!ro.Has(n[U]))throw new vn(n,"Unknown type");return mj(n,r)}}var dj=512,n6=0;function Po(...e){return n6=0,e.length===2?In(e[0],e[1]):In(e[0],[])}var Fg=class extends be{constructor(t,r){super(r),this.schema=t}};function o6(e,t,r){if(e[U]==="Object"&&typeof r=="object"&&!di(r)){let n=e,o=Object.getOwnPropertyNames(r);return Object.entries(n.properties).reduce((a,[s,c])=>{let f=c[U]==="Literal"&&c.const===r[s]?100:0,u=Ie(c,t,r[s])?10:0,p=o.includes(s)?1:0;return a+(f+u+p)},0)}else if(e[U]==="Union"){let o=e.anyOf.map(i=>Ve(i,t)).map(i=>o6(i,t,r));return Math.max(...o)}else return Ie(e,t,r)?1:0}function hj(e,t,r){let n=e.anyOf.map(a=>Ve(a,t)),[o,i]=[n[0],0];for(let a of n){let s=o6(a,t,r);s>i&&(o=a,i=s)}return o}function gj(e,t,r){if("default"in e)return typeof r=="function"?e.default:Ee(e.default);{let n=hj(e,t,r);return np(n,t,r)}}function bj(e,t,r){return Ie(e,t,r)?Ee(r):Po(e,t)}function yj(e,t,r){return Ie(e,t,r)?r:Po(e,t)}function xj(e,t,r){if(Ie(e,t,r))return Ee(r);let n=de(r)?Ee(r):Po(e,t),o=lt(e.minItems)&&n.lengthnull)]:n,a=(lt(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(c=>Mo(e.items,t,c));if(e.uniqueItems!==!0)return a;let s=[...new Set(a)];if(!Ie(e,t,s))throw new Fg(e,"Array cast produced invalid data due to uniqueItems constraint");return s}function wj(e,t,r){if(Ie(e,t,r))return Po(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]=Mo(a,t,r.prototype[i]));return o}function Sj(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Mo(o,[...t,...n],r)}function i6(e,t){return we(e)&&!we(t)||!we(e)&&we(t)?e:!we(e)||!we(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((r,n)=>{let o=n in t?i6(e[n],t[n]):e[n];return{...r,[n]:o}},{})}function vj(e,t,r){if(Ie(e,t,r))return r;let n=Po(e,t),o=i6(n,r);return Ie(e,t,o)?o:n}function Ij(e,t,r){throw new Fg(e,"Never types cannot be cast")}function _j(e,t,r){if(Ie(e,t,r))return r;if(r===null||typeof r!="object")return Po(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]=Mo(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]=Mo(e.additionalProperties,t,r[a]))}return o}function Pj(e,t,r){if(Ie(e,t,r))return Ee(r);if(r===null||typeof r!="object"||Array.isArray(r)||r instanceof Date)return Po(e,t);let n=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[n],i={};for(let[a,s]of Object.entries(r))i[a]=Mo(o,t,s);return i}function Mj(e,t,r){return Mo(Ve(e,t),t,r)}function Tj(e,t,r){return Mo(Ve(e,t),t,r)}function Oj(e,t,r){return Ie(e,t,r)?Ee(r):de(r)?e.items===void 0?[]:e.items.map((n,o)=>Mo(n,t,r[o])):Po(e,t)}function Cj(e,t,r){return Ie(e,t,r)?Ee(r):gj(e,t,r)}function Mo(e,t,r){let n=Be(e.$id)?fr(e,t):t,o=e;switch(e[U]){case"Array":return xj(o,n,r);case"Constructor":return wj(o,n,r);case"Import":return Sj(o,n,r);case"Intersect":return vj(o,n,r);case"Never":return Ij(o,n,r);case"Object":return _j(o,n,r);case"Record":return Pj(o,n,r);case"Ref":return Mj(o,n,r);case"This":return Tj(o,n,r);case"Tuple":return Oj(o,n,r);case"Union":return Cj(o,n,r);case"Date":case"Symbol":case"Uint8Array":return bj(e,t,r);default:return yj(o,n,r)}}function np(...e){return e.length===3?Mo(e[0],e[1],e[2]):Mo(e[0],[],e[1])}function kj(e){return ra(e)&&e[U]!=="Unsafe"}function Nj(e,t,r){return de(r)?r.map(n=>on(e.items,t,n)):r}function Rj(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return on(o,[...t,...n],r)}function Ej(e,t,r){let n=e.unevaluatedProperties,i=e.allOf.map(s=>on(s,t,Ee(r))).reduce((s,c)=>we(c)?{...s,...c}:c,{});if(!we(r)||!we(i)||!ra(n))return i;let a=Wr(e);for(let s of Object.getOwnPropertyNames(r))a.includes(s)||Ie(n,t,r[s])&&(i[s]=on(n,t,r[s]));return i}function Aj(e,t,r){if(!we(r)||de(r))return r;let n=e.additionalProperties;for(let o of Object.getOwnPropertyNames(r)){if(pe(e.properties,o)){r[o]=on(e.properties[o],t,r[o]);continue}if(ra(n)&&Ie(n,t,r[o])){r[o]=on(n,t,r[o]);continue}delete r[o]}return r}function Fj(e,t,r){if(!we(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]=on(a,t,r[c]);continue}if(ra(n)&&Ie(n,t,r[c])){r[c]=on(n,t,r[c]);continue}delete r[c]}return r}function $j(e,t,r){return on(Ve(e,t),t,r)}function Dj(e,t,r){return on(Ve(e,t),t,r)}function Lj(e,t,r){if(!de(r))return r;if(ft(e.items))return[];let n=Math.min(r.length,e.items.length);for(let o=0;on?r.slice(0,n):r}function Vj(e,t,r){for(let n of e.anyOf)if(kj(n)&&Ie(n,t,r))return on(n,t,r);return r}function on(e,t,r){let n=Be(e.$id)?fr(e,t):t,o=e;switch(o[U]){case"Array":return Nj(o,n,r);case"Import":return Rj(o,n,r);case"Intersect":return Ej(o,n,r);case"Object":return Aj(o,n,r);case"Record":return Fj(o,n,r);case"Ref":return $j(o,n,r);case"This":return Dj(o,n,r);case"Tuple":return Lj(o,n,r);case"Union":return Vj(o,n,r);default:return r}}function $g(...e){return e.length===3?on(e[0],e[1],e[2]):on(e[0],[],e[1])}function Dg(e){return Be(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function zj(e){return Yn(e)||Eo(e)||lt(e)}function op(e){return e===!0||lt(e)&&e===1||Yn(e)&&e===BigInt("1")||Be(e)&&(e.toLowerCase()==="true"||e==="1")}function ip(e){return e===!1||lt(e)&&(e===0||Object.is(e,-0))||Yn(e)&&e===BigInt("0")||Be(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function jj(e){return Be(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function Uj(e){return Be(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function Bj(e){return Be(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 Gj(e){return Be(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 Kj(e){return Be(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function qj(e,t){let r=s6(e);return r===t?r:e}function Hj(e,t){let r=c6(e);return r===t?r:e}function Yj(e,t){let r=a6(e);return r===t?r:e}function Wj(e,t){return Be(e.const)?qj(t,e.const):lt(e.const)?Hj(t,e.const):Eo(e.const)?Yj(t,e.const):t}function a6(e){return op(e)?!0:ip(e)?!1:e}function Xj(e){let t=r=>r.split(".")[0];return Dg(e)?BigInt(t(e)):lt(e)?BigInt(Math.trunc(e)):ip(e)?BigInt(0):op(e)?BigInt(1):e}function s6(e){return hi(e)&&e.description!==void 0?e.description.toString():zj(e)?e.toString():e}function c6(e){return Dg(e)?parseFloat(e):op(e)?1:ip(e)?0:e}function Zj(e){return Dg(e)?parseInt(e):lt(e)?Math.trunc(e):op(e)?1:ip(e)?0:e}function Qj(e){return Be(e)&&e.toLowerCase()==="null"?null:e}function Jj(e){return Be(e)&&e==="undefined"?void 0:e}function eU(e){return Ar(e)?e:lt(e)?new Date(e):op(e)?new Date(1):ip(e)?new Date(0):Dg(e)?new Date(parseInt(e)):Uj(e)?new Date(`1970-01-01T${e}.000Z`):jj(e)?new Date(`1970-01-01T${e}`):Gj(e)?new Date(`${e}.000Z`):Bj(e)?new Date(e):Kj(e)?new Date(`${e}T00:00:00.000Z`):e}function tU(e,t,r){return(de(r)?r:[r]).map(o=>To(e.items,t,o))}function rU(e,t,r){return Xj(r)}function nU(e,t,r){return a6(r)}function oU(e,t,r){return eU(r)}function iU(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return To(o,[...t,...n],r)}function aU(e,t,r){return Zj(r)}function sU(e,t,r){return e.allOf.reduce((n,o)=>To(o,t,n),r)}function cU(e,t,r){return Wj(e,r)}function uU(e,t,r){return Qj(r)}function fU(e,t,r){return c6(r)}function lU(e,t,r){if(!we(r)||de(r))return r;for(let n of Object.getOwnPropertyNames(e.properties))pe(r,n)&&(r[n]=To(e.properties[n],t,r[n]));return r}function pU(e,t,r){if(!(we(r)&&!de(r)))return r;let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[o];for(let[a,s]of Object.entries(r))r[a]=To(i,t,s);return r}function mU(e,t,r){return To(Ve(e,t),t,r)}function dU(e,t,r){return s6(r)}function hU(e,t,r){return Be(r)||lt(r)?Symbol(r):r}function gU(e,t,r){return To(Ve(e,t),t,r)}function bU(e,t,r){return de(r)&&!ft(e.items)?r.map((o,i)=>iOo(e.items,t,`${r}/${i}`,o))):xt(e,r,n)}function SU(e,t,r,n){if(!we(n)||cn(n))return xt(e,r,n);let o=_p(e),i=o.map(u=>u[0]),a={...n};for(let[u,p]of o)u in a&&(a[u]=Oo(p,t,`${r}/${u}`,a[u]));if(!Fe(e.unevaluatedProperties))return xt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.unevaluatedProperties,f={...a};for(let u of s)i.includes(u)||(f[u]=xt(c,`${r}/${u}`,f[u]));return xt(e,r,f)}function vU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=Oo(i,[...t,...o],r,n);return xt(e,r,a)}function IU(e,t,r,n){return xt(e,r,Oo(e.not,t,r,n))}function _U(e,t,r,n){if(!we(n))return xt(e,r,n);let o=Wr(e),i={...n};for(let f of o)pe(i,f)&&(ft(i[f])&&(!yi(e.properties[f])||zt.IsExactOptionalProperty(i,f))||(i[f]=Oo(e.properties[f],t,`${r}/${f}`,i[f])));if(!bt(e.additionalProperties))return xt(e,r,i);let a=Object.getOwnPropertyNames(i),s=e.additionalProperties,c={...i};for(let f of a)o.includes(f)||(c[f]=xt(s,`${r}/${f}`,c[f]));return xt(e,r,c)}function PU(e,t,r,n){if(!we(n))return xt(e,r,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),a={...n};for(let u of Object.getOwnPropertyNames(n))i.test(u)&&(a[u]=Oo(e.patternProperties[o],t,`${r}/${u}`,a[u]));if(!bt(e.additionalProperties))return xt(e,r,a);let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,f={...a};for(let u of s)i.test(u)||(f[u]=xt(c,`${r}/${u}`,f[u]));return xt(e,r,f)}function MU(e,t,r,n){let o=Ve(e,t);return xt(e,r,Oo(o,t,r,n))}function TU(e,t,r,n){let o=Ve(e,t);return xt(e,r,Oo(o,t,r,n))}function OU(e,t,r,n){return de(n)&&de(e.items)?xt(e,r,e.items.map((o,i)=>Oo(o,t,`${r}/${i}`,n[i]))):xt(e,r,n)}function CU(e,t,r,n){for(let o of e.anyOf){if(!Ie(o,t,n))continue;let i=Oo(o,t,r,n);return xt(e,r,i)}return xt(e,r,n)}function Oo(e,t,r,n){let o=fr(e,t),i=e;switch(e[U]){case"Array":return wU(i,o,r,n);case"Import":return vU(i,o,r,n);case"Intersect":return SU(i,o,r,n);case"Not":return IU(i,o,r,n);case"Object":return _U(i,o,r,n);case"Record":return PU(i,o,r,n);case"Ref":return MU(i,o,r,n);case"Symbol":return xt(i,r,n);case"This":return TU(i,o,r,n);case"Tuple":return OU(i,o,r,n);case"Union":return CU(i,o,r,n);default:return xt(i,r,n)}}function zg(e,t,r){return Oo(e,t,"",r)}var jg=class extends be{constructor(t,r,n){super("The encoded value does not match the expected schema"),this.schema=t,this.value=r,this.error=n}},Qw=class extends be{constructor(t,r,n,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=r,this.value=n,this.error=o}};function Sr(e,t,r){try{return Fe(e)?e[gt].Encode(r):r}catch(n){throw new Qw(e,t,r,n)}}function kU(e,t,r,n){let o=Sr(e,r,n);return de(o)?o.map((i,a)=>Co(e.items,t,`${r}/${a}`,i)):o}function NU(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],a=Sr(e,r,n);return Co(i,[...t,...o],r,a)}function RU(e,t,r,n){let o=Sr(e,r,n);if(!we(n)||cn(n))return o;let i=_p(e),a=i.map(p=>p[0]),s={...o};for(let[p,l]of i)p in s&&(s[p]=Co(l,t,`${r}/${p}`,s[p]));if(!Fe(e.unevaluatedProperties))return s;let c=Object.getOwnPropertyNames(s),f=e.unevaluatedProperties,u={...s};for(let p of c)a.includes(p)||(u[p]=Sr(f,`${r}/${p}`,u[p]));return u}function EU(e,t,r,n){return Sr(e.not,r,Sr(e,r,n))}function AU(e,t,r,n){let o=Sr(e,r,n);if(!we(o))return o;let i=Wr(e),a={...o};for(let u of i)pe(a,u)&&(ft(a[u])&&(!yi(e.properties[u])||zt.IsExactOptionalProperty(a,u))||(a[u]=Co(e.properties[u],t,`${r}/${u}`,a[u])));if(!bt(e.additionalProperties))return a;let s=Object.getOwnPropertyNames(a),c=e.additionalProperties,f={...a};for(let u of s)i.includes(u)||(f[u]=Sr(c,`${r}/${u}`,f[u]));return f}function FU(e,t,r,n){let o=Sr(e,r,n);if(!we(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]=Co(e.patternProperties[i],t,`${r}/${p}`,s[p]));if(!bt(e.additionalProperties))return s;let c=Object.getOwnPropertyNames(s),f=e.additionalProperties,u={...s};for(let p of c)a.test(p)||(u[p]=Sr(f,`${r}/${p}`,u[p]));return u}function $U(e,t,r,n){let o=Ve(e,t),i=Co(o,t,r,n);return Sr(e,r,i)}function DU(e,t,r,n){let o=Ve(e,t),i=Co(o,t,r,n);return Sr(e,r,i)}function LU(e,t,r,n){let o=Sr(e,r,n);return de(e.items)?e.items.map((i,a)=>Co(i,t,`${r}/${a}`,o[a])):[]}function VU(e,t,r,n){for(let o of e.anyOf){if(!Ie(o,t,n))continue;let i=Co(o,t,r,n);return Sr(e,r,i)}for(let o of e.anyOf){let i=Co(o,t,r,n);if(Ie(e,t,i))return Sr(e,r,i)}return Sr(e,r,n)}function Co(e,t,r,n){let o=fr(e,t),i=e;switch(e[U]){case"Array":return kU(i,o,r,n);case"Import":return NU(i,o,r,n);case"Intersect":return RU(i,o,r,n);case"Not":return EU(i,o,r,n);case"Object":return AU(i,o,r,n);case"Record":return FU(i,o,r,n);case"Ref":return $U(i,o,r,n);case"This":return DU(i,o,r,n);case"Tuple":return LU(i,o,r,n);case"Union":return VU(i,o,r,n);default:return Sr(i,r,n)}}function Ug(e,t,r){return Co(e,t,"",r)}function zU(e,t){return Fe(e)||Jt(e.items,t)}function jU(e,t){return Fe(e)||Jt(e.items,t)}function UU(e,t){return Fe(e)||Jt(e.returns,t)||e.parameters.some(r=>Jt(r,t))}function BU(e,t){return Fe(e)||Jt(e.returns,t)||e.parameters.some(r=>Jt(r,t))}function GU(e,t){return Fe(e)||Fe(e.unevaluatedProperties)||e.allOf.some(r=>Jt(r,t))}function KU(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return Fe(e)||Jt(n,[...r,...t])}function qU(e,t){return Fe(e)||Jt(e.items,t)}function HU(e,t){return Fe(e)||Jt(e.not,t)}function YU(e,t){return Fe(e)||Object.values(e.properties).some(r=>Jt(r,t))||bt(e.additionalProperties)&&Jt(e.additionalProperties,t)}function WU(e,t){return Fe(e)||Jt(e.item,t)}function XU(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return Fe(e)||Jt(n,t)||bt(e.additionalProperties)&&Fe(e.additionalProperties)}function ZU(e,t){return Fe(e)?!0:Jt(Ve(e,t),t)}function QU(e,t){return Fe(e)?!0:Jt(Ve(e,t),t)}function JU(e,t){return Fe(e)||!ft(e.items)&&e.items.some(r=>Jt(r,t))}function eB(e,t){return Fe(e)||e.anyOf.some(r=>Jt(r,t))}function Jt(e,t){let r=fr(e,t),n=e;if(e.$id&&Jw.has(e.$id))return!1;switch(e.$id&&Jw.add(e.$id),e[U]){case"Array":return zU(n,r);case"AsyncIterator":return jU(n,r);case"Constructor":return UU(n,r);case"Function":return BU(n,r);case"Import":return KU(n,r);case"Intersect":return GU(n,r);case"Iterator":return qU(n,r);case"Not":return HU(n,r);case"Object":return YU(n,r);case"Promise":return WU(n,r);case"Record":return XU(n,r);case"Ref":return ZU(n,r);case"This":return QU(n,r);case"Tuple":return JU(n,r);case"Union":return eB(n,r);default:return Fe(e)}}var Jw=new Set;function Bs(e,t){return Jw.clear(),Jt(e,t)}function u6(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Ie(t,r,n))throw new Vg(t,n,za(t,r,n).First());return Bs(t,r)?zg(t,r,n):n}function Zi(e,t){let r=pe(e,"default")?e.default:void 0,n=ea(r)?r():Ee(r);return ft(t)?n:we(t)&&we(n)?Object.assign(n,t):t}function e2(e){return ra(e)&&"default"in e}function tB(e,t,r){if(de(r)){for(let o=0;o{let a=Gr(i,t,n);return we(a)?{...o,...a}:a},{})}function iB(e,t,r){let n=Zi(e,r);if(!we(n))return n;let o=Object.getOwnPropertyNames(e.properties);for(let i of o){let a=Gr(e.properties[i],t,n[i]);ft(a)||(n[i]=Gr(e.properties[i],t,n[i]))}if(!e2(e.additionalProperties))return n;for(let i of Object.getOwnPropertyNames(n))o.includes(i)||(n[i]=Gr(e.additionalProperties,t,n[i]));return n}function aB(e,t,r){let n=Zi(e,r);if(!we(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)&&e2(a)&&(n[c]=Gr(a,t,n[c]));if(!e2(o))return n;for(let c of Object.getOwnPropertyNames(n))s.test(c)||(n[c]=Gr(o,t,n[c]));return n}function sB(e,t,r){return Gr(Ve(e,t),t,Zi(e,r))}function cB(e,t,r){return Gr(Ve(e,t),t,r)}function uB(e,t,r){let n=Zi(e,r);if(!de(n)||ft(e.items))return n;let[o,i]=[e.items,Math.max(e.items.length,n.length)];for(let a=0;apB,Format:()=>ap,Get:()=>dB,Has:()=>mB,Set:()=>lB,ValuePointerRootDeleteError:()=>Kg,ValuePointerRootSetError:()=>Gg});var Gg=class extends be{constructor(t,r,n){super("Cannot set root value"),this.value=t,this.path=r,this.update=n}},Kg=class extends be{constructor(t,r){super("Cannot delete root value"),this.value=t,this.path=r}};function f6(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*ap(e){if(e==="")return;let[t,r]=[0,0];for(let n=0;nGs(e[o],t[o]))}function gB(e,t){return Ar(t)&&e.getTime()===t.getTime()}function bB(e,t){return!de(t)||e.length!==t.length?!1:e.every((r,n)=>Gs(r,t[n]))}function yB(e,t){return!Pn(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((r,n)=>Gs(r,t[n]))}function xB(e,t){return e===t}function Gs(e,t){if(Ar(e))return gB(e,t);if(Pn(e))return yB(e,t);if(de(e))return bB(e,t);if(we(e))return hB(e,t);if(cn(e))return xB(e,t);throw new Error("ValueEquals: Unable to compare value")}var wB=De({type:ke("insert"),path:Fr(),value:no()}),SB=De({type:ke("update"),path:Fr(),value:no()}),vB=De({type:ke("delete"),path:Fr()}),p6=$e([wB,SB,vB]),qg=class extends be{constructor(t,r){super(r),this.value=t}};function Hg(e,t){return{type:"update",path:e,value:t}}function m6(e,t){return{type:"insert",path:e,value:t}}function d6(e){return{type:"delete",path:e}}function l6(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new qg(e,"Cannot diff objects with symbols")}function*IB(e,t,r){if(l6(t),l6(r),!bb(r))return yield Hg(e,r);let n=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(r);for(let i of o)pe(t,i)||(yield m6(`${e}/${i}`,r[i]));for(let i of n)pe(r,i)&&(Gs(t,r)||(yield*Yg(`${e}/${i}`,t[i],r[i])));for(let i of n)pe(r,i)||(yield d6(`${e}/${i}`))}function*_B(e,t,r){if(!de(r))return yield Hg(e,r);for(let n=0;n=0;n--)n0&&e[0].path===""&&e[0].type==="update"}function OB(e){return e.length===0}function g6(e,t){if(TB(t))return Ee(t[0].value);if(OB(t))return Ee(e);let r=Ee(e);for(let n of t)switch(n.type){case"insert":{ko.Set(r,n.path,n.value);break}case"update":{ko.Set(r,n.path,n.value);break}case"delete":{ko.Delete(r,n.path);break}}return r}function b6(...e){let[t,r,n]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Bs(t,r)?Ug(t,r,n):n;if(!Ie(t,r,o))throw new jg(t,o,za(t,r,o).First());return o}function Wg(e){return we(e)&&!de(e)}var Xg=class extends be{constructor(t){super(t)}};function CB(e,t,r,n){if(!Wg(r))ko.Set(e,t,Ee(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)t2(e,`${t}/${a}`,r[a],n[a])}}function kB(e,t,r,n){if(!de(r))ko.Set(e,t,Ee(n));else{for(let o=0;o(Ag(i,a,s),s)],["Cast",(i,a,s)=>np(i,a,s)],["Clean",(i,a,s)=>$g(i,a,s)],["Clone",(i,a,s)=>Ee(s)],["Convert",(i,a,s)=>Lg(i,a,s)],["Decode",(i,a,s)=>Bs(i,a)?zg(i,a,s):s],["Default",(i,a,s)=>Bg(i,a,s)],["Encode",(i,a,s)=>Bs(i,a)?Ug(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})(r2||(r2={}));var w6=["Clone","Clean","Default","Convert","Assert","Decode"];function AB(e,t,r,n){return e.reduce((o,i)=>{let a=r2.Get(i);if(ft(a))throw new Zg(`Unable to find Parse operation '${i}'`);return a(t,r,o)},n)}function S6(...e){let[t,r,n,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?de(e[0])?[e[0],e[1],[],e[2]]:[w6,e[0],e[1],e[2]]:e.length===2?[w6,e[0],[],e[1]]:(()=>{throw new Zg("Invalid Arguments")})();return AB(t,r,n,o)}var $u={};Ga($u,{Assert:()=>Ag,Cast:()=>np,Check:()=>Ie,Clean:()=>$g,Clone:()=>Ee,Convert:()=>Lg,Create:()=>Po,Decode:()=>u6,Default:()=>Bg,Diff:()=>h6,Edit:()=>p6,Encode:()=>b6,Equal:()=>Gs,Errors:()=>za,Hash:()=>Fu,Mutate:()=>x6,Parse:()=>S6,Patch:()=>g6,ValueErrorIterator:()=>Va});function Qg(e){switch(e.type){case"summary_metrics":return Gw(e);case"performance_table":return jw(e);case"prediction_distribution":return Uw(e);case"outcome_distribution":return zw(e);case"roc":return kw(e);case"calibration":return Gk(e);case"precision_recall":return Rw(e);case"gains":return Ew(e);case"lift":return Aw(e);case"decision_curve":return Fw(e);case"interventions_avoided":return $w(e)}}function fi(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 n2(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 FB(e){if(!$u.Check(Lp,e))throw new Error("Invalid ReportSpec");zp(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(Qg(r.spec)),n.append(o),t.append(n)}return t}function $B(e,t){if(!$u.Check(Vp,e))throw new Error("Invalid ReportSpec");zp(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=fi(m.id,n);a++;let y=[];for(let b of m.items)if(b.type==="group"){let x=fi(b.id,n);a++,y.push({rawId:b.id,title:b.title,domId:x})}i.push({rawId:m.id,title:m.title,domId:h,groups:y})}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 y of i){let b=document.createElement("li");b.className="rtichoke-report__nav-item";let x=document.createElement("a");if(x.className="rtichoke-report__nav-link",x.href=`#${y.domId}`,x.textContent=y.title,b.append(x),y.groups.length>0){let g=document.createElement("ul");g.className="rtichoke-report__nav-sublist";for(let S of y.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)}b.append(g)}h.append(b)}m.append(h),o.append(m)}let s=r?"h2":"h1",c=r?"h3":"h2",f=r?"h3":"h2",u=r?"h4":"h3",p=(m,h)=>{let y=document.createElement("section");if(y.className="rtichoke-report__component",y.dataset.componentId=m.id,m.title){let x=fi(`heading-${m.id}`,n),g=document.createElement(h);g.className="rtichoke-report__component-title",g.id=x,g.textContent=m.title,y.setAttribute("aria-labelledby",x),y.append(g)}let b=document.createElement("div");return b.className="rtichoke-report__component-content",b.append(Qg(m.spec)),y.append(b),y},l=(m,h,y)=>{let b=document.createElement("section");b.className="rtichoke-report__group",b.id=h.domId,b.dataset.groupId=m.id;let x=fi(`heading-${m.id}`,n),g=document.createElement(c);if(g.className="rtichoke-report__group-title",y&&g.classList.add("rtichoke-report__group-title--tab-panel"),g.id=x,g.textContent=m.title,b.setAttribute("aria-labelledby",y??x),b.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 O=fi(`tab-${m.id}-${v.id}`,n),M=fi(`panel-${m.id}-${v.id}`,n),E=document.createElement("button");E.className="rtichoke-report__tab",E.type="button",E.id=O,E.setAttribute("role","tab"),E.setAttribute("aria-controls",M),E.setAttribute("aria-selected",I===0?"true":"false"),E.tabIndex=I===0?0:-1,E.textContent=v.title||v.id;let C=document.createElement("section");C.className="rtichoke-report__component rtichoke-report__tabpanel",C.id=M,C.setAttribute("role","tabpanel"),C.setAttribute("aria-labelledby",O),C.tabIndex=0,C.dataset.componentId=v.id,C.hidden=I!==0;let N=document.createElement("div");N.className="rtichoke-report__component-content",N.append(Qg(v.spec)),C.append(N),w.push(E),_.push(C),S.append(E)}),n2(w,_),b.append(S,..._)}else for(let S of m.components)b.append(p(S,u));return b};for(let m=0;mO.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 K=[],F=[];E.forEach((T,V)=>{let D=fi(`tab-${h.id}-${T.id}`,n),H=fi(`panel-${h.id}-${T.id}`,n),G=document.createElement("button");G.className="rtichoke-report__tab",G.type="button",G.id=D,G.setAttribute("role","tab"),G.setAttribute("aria-controls",H),G.setAttribute("aria-selected",V===0?"true":"false"),G.tabIndex=V===0?0:-1,G.textContent=T.title||T.id;let Y=document.createElement("section");Y.className="rtichoke-report__component rtichoke-report__tabpanel",Y.id=H,Y.setAttribute("role","tabpanel"),Y.setAttribute("aria-labelledby",D),Y.tabIndex=0,Y.dataset.componentId=T.id,Y.hidden=V!==0;let W=document.createElement("div");W.className="rtichoke-report__component-content",W.append(Qg(T.spec)),Y.append(W),K.push(G),F.push(Y),N.append(G)}),n2(K,F),b.append(N,...F),I=M}else b.append(p(O,f)),I++}else if(O.type==="group"){if(w){if(!v){v=!0;let M=document.createElement("div");M.className="rtichoke-report__tablist rtichoke-report__section-group-tablist",M.setAttribute("role","tablist"),M.setAttribute("aria-labelledby",x);let E=[],C=[];S.forEach((N,K)=>{let F=y.groups[K],T=fi(`section-group-tab-${h.id}-${N.id}`,n),V=document.createElement("button");V.className="rtichoke-report__tab",V.type="button",V.id=T,V.setAttribute("role","tab"),V.setAttribute("aria-controls",F.domId),V.setAttribute("aria-selected",K===0?"true":"false"),V.tabIndex=K===0?0:-1,V.textContent=N.title;let D=l(N,F,T);D.classList.add("rtichoke-report__tabpanel"),D.setAttribute("role","tabpanel"),D.setAttribute("aria-labelledby",T),D.tabIndex=0,D.hidden=K!==0,E.push(V),C.push(D),M.append(V)}),n2(E,C),b.append(M,...C)}}else b.append(l(O,y.groups[_++]));I++}}o.append(b)}return o}function DB(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 FB(e);if(e.schemaVersion==="1.1")return $B(e,{groupPresentation:r,sectionGroupPresentation:n,sectionComponentPresentation:o});throw new Error("Invalid ReportSpec")}var LB=["#1b9e77","#d95f02","#7570b3","#e7298a","#07004D","#E6AB02","#FE5F55","#54494B","#006E90","#BC96E6"];function VB(e){let t=e.data.map(n=>({...n,false_positive_rate:1-n.specificity})),r=[Qt(t,{x:"false_positive_rate",y:"sensitivity",stroke:"model",strokeWidth:2,tip:!0})];return e.references?.some(n=>n.type==="identity")&&r.unshift(Qt([{x:0,y:0},{x:1,y:1}],{x:"x",y:"y",stroke:"#BEBEBE",strokeWidth:2})),ui({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:LB},marks:r})}export{uy as AUROCSummaryMetricSchema,Wb as CalibrationSpecSchema,$v as CalibrationV2DatumSchema,Qb as CalibrationV2SpecSchema,Uv as DecisionCurveV2DatumSchema,Bv as DecisionCurveV2EvaluationSchema,Hv as DecisionCurveV2ReferenceSchema,Gv as DecisionCurveV2SeriesSchema,ty as DecisionCurveV2SpecSchema,Av as DiscreteCalibrationV2DatumSchema,Rv as DisplayGroupingSpecSchema,Nv as DisplayRoleSchema,$r as EvaluationSpecSchema,ry as GainsV2SpecSchema,Qv as InterventionsAvoidedTreatAllReferenceSchema,Jv as InterventionsAvoidedTreatNoneReferenceSchema,Wv as InterventionsAvoidedV2DatumSchema,Xv as InterventionsAvoidedV2EvaluationSchema,eI as InterventionsAvoidedV2ReferenceSchema,Zv as InterventionsAvoidedV2SeriesSchema,ny as InterventionsAvoidedV2SpecSchema,oy as LiftV2SpecSchema,of as OperatingPointDimensionSchema,Lv as OperatingPointSchema,Si as OperatingPointSpecSchema,py as OutcomeDistributionSpecSchema,tI as OutcomeStateSchema,Vv as PerformanceEvaluationContextSchema,Dv as PerformanceMetricDefinitionSchema,Jb as PerformanceMetricIdSchema,Mr as PerformanceMetricValueSchema,zv as PerformanceTableRowSchema,ey as PerformanceTableSpecSchema,cy as PopulationSummaryOwnerSpecSchema,iy as PrecisionRecallV2SpecSchema,nI as PredictionDistributionBinSchema,oI as PredictionDistributionOperatingPointSchema,sf as PredictionDistributionSpecSchema,fy as PrevalenceSummaryMetricSchema,Rr as RTICHOKE_BROWSER_THEME,jk as RTICHOKE_COLORS,Ev as ReferenceLineV2SpecSchema,aI as ReportComponentSchema,dy as ReportComponentV1_1Schema,sI as ReportGroupSchema,cI as ReportSectionSchema,V8 as ReportSpecSchema,Lp as ReportSpecV1_0Schema,Vp as ReportSpecV1_1Schema,Xb as RocSpecSchema,ay as RocV2SpecSchema,I8 as RtichokeChartSpecSchema,sy as RtichokeChartSpecV2Schema,gc as SeriesSpecSchema,Fv as SmoothCalibrationV2DatumSchema,my as StandaloneCanonicalSpecSchema,af as StateDistributionSchema,rI as StateStratumSchema,$8 as SummaryMetricSchema,ly as SummaryMetricsSpecSchema,qv as TreatAllReferenceSchema,Kv as TreatNoneReferenceSchema,gy as assertOutcomeDistributionReferentialIntegrity,hy as assertPerformanceTableReferentialIntegrity,cf as assertPredictionDistributionReferentialIntegrity,zp as assertReportReferentialIntegrity,jp as assertStateDistributionValid,by as assertSummaryMetricsReferentialIntegrity,vi as assertV2ReferentialIntegrity,U8 as calibrationSpecFromRtichokeRows,q8 as calibrationV2SpecFromRtichokeRows,Uk as extractOperatingPointValues,Wk as preparePredictionDistributionPlotData,tL as renderCalibration,SL as renderCalibrationV2,Fw as renderDecisionCurveV2,Ew as renderGainsV2,$w as renderInterventionsAvoidedV2,Aw as renderLiftV2,zw as renderOutcomeDistribution,jw as renderPerformanceTable,Rw as renderPrecisionRecallV2,Uw as renderPredictionDistribution,DB as renderReport,VB as renderRoc,kw as renderRocV2,Gw as renderSummaryMetrics,js as renderWithOperatingPointSelection,rn as resolveV2RenderOptions,j8 as rocSpecFromRtichokePython,z8 as rocSpecFromRtichokeR,K8 as rocV2SpecFromRtichokePython,G8 as rocV2SpecFromRtichokeR}; diff --git a/src/rtichoke/reals_distribution.py b/src/rtichoke/reals_distribution.py index 1af95615..4b2c2f77 100644 --- a/src/rtichoke/reals_distribution.py +++ b/src/rtichoke/reals_distribution.py @@ -3,9 +3,11 @@ from __future__ import annotations import math -from typing import Any, Dict, List, Literal, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Sequence, Union import numpy as np +import polars as pl +import polarstate from rtichoke._renderers import RtichokeBrowserChart @@ -194,3 +196,218 @@ def create_reals_distribution_times( title="Outcome Distribution", ) return RtichokeBrowserChart(spec=spec) + + +def create_reals_distribution_steps( + data: pl.DataFrame, + *, + id_col: str = "id", + step_col: str = "step", + reals_col: str = "reals", + reals_order: Sequence[Any] | None = None, + reals_scale: Literal["auto", "nominal", "ordinal"] = "auto", + censoring_heuristic: Literal["excluded", "adjusted"] = "excluded", + title: str = "Outcome Distribution", + renderer: RealsDistributionRenderer = "browser", +) -> RtichokeBrowserChart: + """Create a discrete-step reals/outcome distribution browser chart.""" + if not isinstance(data, pl.DataFrame): + raise TypeError(f"data must be a Polars DataFrame, got {type(data).__name__}") + + if renderer not in _SUPPORTED_REALS_DISTRIBUTION_RENDERERS: + supported = ", ".join( + repr(r) for h, r in enumerate(_SUPPORTED_REALS_DISTRIBUTION_RENDERERS) + ) + raise ValueError( + f"Unsupported renderer {renderer!r}. 'create_reals_distribution_steps' supports {supported}." + ) + + if censoring_heuristic not in ("excluded", "adjusted"): + raise ValueError( + f"Invalid censoring_heuristic {censoring_heuristic!r}. Expected 'excluded' or 'adjusted'." + ) + + if reals_scale not in ("auto", "nominal", "ordinal"): + raise ValueError( + f"Invalid reals_scale {reals_scale!r}. Expected 'auto', 'nominal', or 'ordinal'." + ) + + # Validate column presence + missing_cols = [c for c in (id_col, step_col, reals_col) if c not in data.columns] + if missing_cols: + raise ValueError(f"Missing required columns in DataFrame: {missing_cols}") + + # Validate non-null IDs and steps + if data[id_col].null_count() > 0: + raise ValueError(f"Column {id_col!r} contains missing/null values.") + + if data[step_col].null_count() > 0: + raise ValueError(f"Column {step_col!r} contains missing/null values.") + + # Validate steps are non-negative integers + step_series = data[step_col] + if not step_series.dtype.is_integer(): + # Check if values can be losslessly represented as non-negative integers + try: + step_floats = step_series.to_numpy().astype(float) + if not np.all(np.equal(np.mod(step_floats, 1), 0)): + raise ValueError + except Exception: + raise ValueError( + f"Column {step_col!r} must contain non-negative integer values." + ) + + if (step_series < 0).any(): + raise ValueError(f"Column {step_col!r} contains negative step values.") + + # Reject duplicate subject-step records + dup_count = data.select([id_col, step_col]).is_duplicated().sum() + if dup_count > 0: + raise ValueError( + f"Duplicate records found for subject-step pairs ({id_col!r}, {step_col!r})." + ) + + # Determine resolved outcome categories (reals_order) + reals_dtype = data[reals_col].dtype + + if reals_order is not None: + resolved_reals_order = [str(x) for x in reals_order] + # Verify no identity collisions in string conversions + if len(set(resolved_reals_order)) != len(reals_order): + raise ValueError( + "Distinct values in 'reals_order' collapsed into identical string representations." + ) + elif isinstance(reals_dtype, pl.Enum): + resolved_reals_order = [str(x) for x in reals_dtype.categories] + else: + # Unique non-null observed values, sorted deterministically + non_null_vals = data[reals_col].drop_nulls().unique() + if non_null_vals.len() == 0: + resolved_reals_order = [] + else: + sorted_vals = non_null_vals.sort() + resolved_reals_order = [str(x) for x in sorted_vals.to_list()] + + # Validate string identity uniqueness + if len(set(resolved_reals_order)) != len(resolved_reals_order): + raise ValueError( + "Distinct category values collapsed into duplicate string representations in reals_order." + ) + + # Verify all non-null observed values are present in resolved_reals_order + observed_non_null = [ + str(x) for x in data[reals_col].drop_nulls().unique().to_list() + ] + unrecognized = set(observed_non_null) - set(resolved_reals_order) + if unrecognized: + raise ValueError( + f"Observed outcomes contain values not present in declared 'reals_order': {sorted(unrecognized)}" + ) + + # Resolve reals_scale + if reals_scale == "auto": + if isinstance(reals_dtype, pl.Enum) or reals_dtype.is_numeric(): + resolved_scale = "ordinal" + else: + resolved_scale = "nominal" + else: + resolved_scale = reals_scale + + evaluations = [ + { + "id": "evaluation-1", + "population": "__shared_population__", + } + ] + + state_distributions: list[dict[str, Any]] = [] + + if censoring_heuristic == "excluded": + # Raw empirical distribution per step + steps_present = sorted(data[step_col].unique().to_list()) + + for step_val in steps_present: + step_sub = data.filter(pl.col(step_col) == step_val) + observed_reals = step_sub[reals_col].drop_nulls() + + if observed_reals.len() == 0: + continue + + # Count occurrences of each category + counts_df = observed_reals.cast(pl.String).value_counts() + counts_dict = dict( + zip(counts_df[reals_col].to_list(), counts_df["count"].to_list()) + ) + + states_list = [ + { + "stateId": cat_str, + "label": cat_str, + "count": int(counts_dict.get(cat_str, 0)), + } + for cat_str in resolved_reals_order + ] + + state_distributions.append( + { + "evaluationId": "evaluation-1", + "horizon": int(step_val), + "estimator": "raw", + "estimateOrigin": "observed_step", + "states": states_list, + } + ) + + else: + # AJ-adjusted distribution using polarstate + tt = polarstate.prepare_transition_table_steps( + data, + id_col=id_col, + step_col=step_col, + state_col=reals_col, + state_order=resolved_reals_order, + ) + aj_df = polarstate.predict_aj_estimates(tt) + + # Build stateDistributions from aj_df + # aj_df has columns: 'step', 'state', 'state_occupancy_probability' + steps_present = sorted(aj_df["step"].unique().to_list()) + + for step_val in steps_present: + step_sub = aj_df.filter(pl.col("step") == step_val) + prob_dict = dict( + zip( + step_sub["state"].cast(pl.String).to_list(), + step_sub["state_occupancy_probability"].to_list(), + ) + ) + + states_list = [ + { + "stateId": cat_str, + "label": cat_str, + "estimate": float(prob_dict.get(cat_str, 0.0)), + } + for cat_str in resolved_reals_order + ] + + state_distributions.append( + { + "evaluationId": "evaluation-1", + "horizon": int(step_val), + "estimator": "aalen_johansen", + "estimateOrigin": "observed_step", + "states": states_list, + } + ) + + spec: dict[str, Any] = { + "schemaVersion": "2.0", + "type": "outcome_distribution", + "title": title, + "stateScale": resolved_scale, + "evaluations": evaluations, + "stateDistributions": state_distributions, + } + + return RtichokeBrowserChart(spec=spec) diff --git a/tests/test_public_exports.py b/tests/test_public_exports.py index 93b3a5e5..0dbc15be 100644 --- a/tests/test_public_exports.py +++ b/tests/test_public_exports.py @@ -3,6 +3,7 @@ EXPECTED_PUBLIC_EXPORTS = { "create_probs_histogram", + "create_reals_distribution_steps", "create_reals_distribution_times", "create_roc_curve", "create_roc_curve_times", diff --git a/tests/test_reals_distribution_steps.py b/tests/test_reals_distribution_steps.py new file mode 100644 index 00000000..7408e230 --- /dev/null +++ b/tests/test_reals_distribution_steps.py @@ -0,0 +1,322 @@ +"""Tests for create_reals_distribution_steps and discrete-step outcome distributions.""" + +import polars as pl +import pytest +import rtichoke +from rtichoke.reals_distribution import create_reals_distribution_steps + + +def test_public_export(): + assert hasattr(rtichoke, "create_reals_distribution_steps") + assert "create_reals_distribution_steps" in rtichoke.__all__ + + +def test_input_validation(): + # Non-DataFrame input + with pytest.raises(TypeError, match="must be a Polars DataFrame"): + create_reals_distribution_steps([{"id": 1, "step": 0, "reals": "Mild"}]) # type: ignore + + df = pl.DataFrame({"id": [1], "step": [0], "reals": ["Mild"]}) + + # Unsupported renderer + with pytest.raises(ValueError, match="Unsupported renderer"): + create_reals_distribution_steps(df, renderer="plotly") # type: ignore + + # Invalid censoring_heuristic + with pytest.raises(ValueError, match="Invalid censoring_heuristic"): + create_reals_distribution_steps(df, censoring_heuristic="invalid") # type: ignore + + # Invalid reals_scale + with pytest.raises(ValueError, match="Invalid reals_scale"): + create_reals_distribution_steps(df, reals_scale="invalid") # type: ignore + + # Missing column + with pytest.raises(ValueError, match="Missing required columns"): + create_reals_distribution_steps(df, reals_col="missing") + + # Missing/null IDs + df_null_id = pl.DataFrame( + {"id": [None, 1], "step": [0, 1], "reals": ["Mild", "Moderate"]} + ) + with pytest.raises(ValueError, match="contains missing/null values"): + create_reals_distribution_steps(df_null_id) + + # Missing/null steps + df_null_step = pl.DataFrame( + {"id": [1, 2], "step": [0, None], "reals": ["Mild", "Moderate"]} + ) + with pytest.raises(ValueError, match="contains missing/null values"): + create_reals_distribution_steps(df_null_step) + + # Negative steps + df_neg_step = pl.DataFrame({"id": [1], "step": [-1], "reals": ["Mild"]}) + with pytest.raises(ValueError, match="negative step values"): + create_reals_distribution_steps(df_neg_step) + + # Non-integer step values + df_float_step = pl.DataFrame({"id": [1], "step": [1.5], "reals": ["Mild"]}) + with pytest.raises(ValueError, match="non-negative integer values"): + create_reals_distribution_steps(df_float_step) + + # Duplicate subject-step pairs + df_dup = pl.DataFrame({"id": [1, 1], "step": [0, 0], "reals": ["Mild", "Moderate"]}) + with pytest.raises(ValueError, match="Duplicate records found"): + create_reals_distribution_steps(df_dup) + + # Observed outcomes not in declared reals_order + df_unrecognized = pl.DataFrame( + {"id": [1, 2], "step": [0, 0], "reals": ["Mild", "Severe"]} + ) + with pytest.raises( + ValueError, match="Observed outcomes contain values not present in declared" + ): + create_reals_distribution_steps(df_unrecognized, reals_order=["None", "Mild"]) + + +def test_reals_order_and_scale_resolution(): + # 1. Explicit reals_order on ordinary strings remains nominal under auto + df = pl.DataFrame( + {"id": [1, 2, 3], "step": [0, 0, 0], "reals": ["Blue", "Green", "Red"]} + ) + chart = create_reals_distribution_steps(df, reals_order=["Red", "Green", "Blue"]) + assert ( + chart.spec["stateScale"] == "nominal" + ) # Explicit reals_order alone does NOT imply ordinal scale + states = chart.spec["stateDistributions"][0]["states"] + assert [s["stateId"] for s in states] == ["Red", "Green", "Blue"] + + # 2. Explicit reals_scale="ordinal" overrides default nominal + chart_ord = create_reals_distribution_steps( + df, reals_order=["Red", "Green", "Blue"], reals_scale="ordinal" + ) + assert chart_ord.spec["stateScale"] == "ordinal" + + # 3. Polars Enum auto-resolves to ordinal + enum_dtype = pl.Enum(["None", "Mild", "Moderate"]) + df_enum = pl.DataFrame( + { + "id": [1, 2, 3], + "step": [0, 0, 0], + "reals": pl.Series(["Moderate", "Mild", "None"], dtype=enum_dtype), + } + ) + chart_enum = create_reals_distribution_steps(df_enum) + assert chart_enum.spec["stateScale"] == "ordinal" + states_enum = chart_enum.spec["stateDistributions"][0]["states"] + assert [s["stateId"] for s in states_enum] == ["None", "Mild", "Moderate"] + + # 4. Numeric outcome categories auto-resolve to ordinal + df_num = pl.DataFrame({"id": [1, 2, 3], "step": [0, 0, 0], "reals": [2, 0, 1]}) + chart_num = create_reals_distribution_steps(df_num) + assert chart_num.spec["stateScale"] == "ordinal" + states_num = chart_num.spec["stateDistributions"][0]["states"] + assert [s["stateId"] for s in states_num] == ["0", "1", "2"] + + +def test_mass_conservation_and_sum_checks(): + df = pl.DataFrame( + { + "id": [1, 1, 1, 2, 2, 2, 3, 3, 3], + "step": [0, 1, 2, 0, 1, 2, 0, 1, 2], + "reals": [ + "None", + "Mild", + "Moderate", + "None", + "Mild", + "Mild", + "None", + "None", + "Mild", + ], + } + ) + + # Raw counts sum check + chart_raw = create_reals_distribution_steps( + data=df, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="excluded", + ) + for dist in chart_raw.spec["stateDistributions"]: + total_counts = sum(s["count"] for s in dist["states"]) + assert total_counts == 3 + + # AJ probabilities sum to 1.0 check + chart_aj = create_reals_distribution_steps( + data=df, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="adjusted", + ) + for dist in chart_aj.spec["stateDistributions"]: + total_prob = sum(s["estimate"] for s in dist["states"]) + assert pytest.approx(total_prob, abs=1e-6) == 1.0 + + +def test_aj_scenarios_and_independent_validation(): + # 1. Complete panel + df_complete = pl.DataFrame( + { + "id": [1, 1, 1, 2, 2, 2], + "step": [0, 1, 2, 0, 1, 2], + "reals": ["None", "Mild", "Moderate", "None", "Mild", "Mild"], + } + ) + chart_complete = create_reals_distribution_steps( + df_complete, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="adjusted", + ) + dist_c = chart_complete.spec["stateDistributions"] + # Step 0: None=1.0, Mild=0.0, Moderate=0.0 + assert dist_c[0]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 1.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 0.0}, + {"stateId": "Moderate", "label": "Moderate", "estimate": 0.0}, + ] + # Step 1: None=0.0, Mild=1.0, Moderate=0.0 + assert dist_c[1]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 0.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 1.0}, + {"stateId": "Moderate", "label": "Moderate", "estimate": 0.0}, + ] + # Step 2: None=0.0, Mild=0.5, Moderate=0.5 + assert dist_c[2]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 0.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 0.5}, + {"stateId": "Moderate", "label": "Moderate", "estimate": 0.5}, + ] + + # 2. Terminal dropout / incomplete panel + # Patient 2 drops out after step 1 + df_dropout = pl.DataFrame( + { + "id": [1, 1, 1, 2, 2], + "step": [0, 1, 2, 0, 1], + "reals": ["None", "Mild", "Moderate", "None", "Mild"], + } + ) + chart_dropout = create_reals_distribution_steps( + df_dropout, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="adjusted", + ) + dist_d = chart_dropout.spec["stateDistributions"] + # Step 2: Subject 1 moved Mild -> Moderate. Subject 2 dropped out while in Mild. + # AJ occupancy at step 2: None=0.0, Mild=0.0, Moderate=1.0 + assert dist_d[2]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 0.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 0.0}, + {"stateId": "Moderate", "label": "Moderate", "estimate": 1.0}, + ] + + # 3. Intermittent missing outcomes under 'excluded' vs 'adjusted' + df_intermittent = pl.DataFrame( + { + "id": [1, 1, 1, 2, 2, 2], + "step": [0, 1, 2, 0, 1, 2], + "reals": ["None", "Mild", "Moderate", "None", None, "Mild"], + } + ) + chart_excl = create_reals_distribution_steps( + df_intermittent, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="excluded", + ) + # Under 'excluded', at step 1 only subject 1 is observed (Mild), subject 2 is excluded from denominator. + assert chart_excl.spec["stateDistributions"][1]["states"] == [ + {"stateId": "None", "label": "None", "count": 0}, + {"stateId": "Mild", "label": "Mild", "count": 1}, + {"stateId": "Moderate", "label": "Moderate", "count": 0}, + ] + + +def test_baseline_only_subjects(): + # Patient 2 observed only at step 0 + df = pl.DataFrame( + { + "id": [1, 1, 2], + "step": [0, 1, 0], + "reals": ["None", "Mild", "None"], + } + ) + chart = create_reals_distribution_steps( + df, + reals_order=["None", "Mild"], + censoring_heuristic="adjusted", + ) + dist = chart.spec["stateDistributions"] + assert len(dist) == 2 + # Step 0: None=1.0, Mild=0.0 + assert dist[0]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 1.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 0.0}, + ] + # Step 1: Subject 2 dropped out from None. Subject 1 transitioned None -> Mild. + # AJ occupancy at step 1: None=0.0, Mild=1.0 + assert dist[1]["states"] == [ + {"stateId": "None", "label": "None", "estimate": 0.0}, + {"stateId": "Mild", "label": "Mild", "estimate": 1.0}, + ] + + +def test_nonconsecutive_steps_and_no_step_0(): + df = pl.DataFrame( + {"id": [1, 1, 2, 2], "step": [5, 10, 5, 10], "reals": ["A", "B", "A", "A"]} + ) + + chart = create_reals_distribution_steps(df, censoring_heuristic="excluded") + dist = chart.spec["stateDistributions"] + assert len(dist) == 2 + assert dist[0]["horizon"] == 5 + assert dist[1]["horizon"] == 10 + + +def test_zero_count_category_preservation(): + df = pl.DataFrame({"id": [1, 2], "step": [0, 0], "reals": ["Mild", "Mild"]}) + + chart = create_reals_distribution_steps( + df, reals_order=["None", "Mild", "Severe"], censoring_heuristic="excluded" + ) + states = chart.spec["stateDistributions"][0]["states"] + assert states == [ + {"stateId": "None", "label": "None", "count": 0}, + {"stateId": "Mild", "label": "Mild", "count": 2}, + {"stateId": "Severe", "label": "Severe", "count": 0}, + ] + + +def test_write_html_outcome_distribution(tmp_path): + df = pl.DataFrame( + { + "id": [1, 1, 2, 2], + "step": [0, 1, 0, 1], + "reals": ["None", "Mild", "None", "Moderate"], + } + ) + + # 1. Censoring heuristic: excluded + chart_excluded = create_reals_distribution_steps( + df, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="excluded", + ) + out_excluded = chart_excluded.write_html(tmp_path / "excluded.html") + assert out_excluded.exists() + content_excluded = out_excluded.read_text(encoding="utf-8") + assert "renderOutcomeDistribution" in content_excluded + assert "rtichoke-viz.js" in content_excluded + assert "outcome_distribution" in content_excluded + + # 2. Censoring heuristic: adjusted + chart_adjusted = create_reals_distribution_steps( + df, + reals_order=["None", "Mild", "Moderate"], + censoring_heuristic="adjusted", + ) + out_adjusted = chart_adjusted.write_html(tmp_path / "adjusted.html") + assert out_adjusted.exists() + content_adjusted = out_adjusted.read_text(encoding="utf-8") + assert "renderOutcomeDistribution" in content_adjusted + assert "rtichoke-viz.js" in content_adjusted + assert "outcome_distribution" in content_adjusted diff --git a/tests/test_reals_distribution_steps_browser_acceptance.py b/tests/test_reals_distribution_steps_browser_acceptance.py new file mode 100644 index 00000000..cfc53215 --- /dev/null +++ b/tests/test_reals_distribution_steps_browser_acceptance.py @@ -0,0 +1,183 @@ +from contextlib import contextmanager +from functools import partial +from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path +from threading import Thread +from typing import Iterator + +import polars as pl +import pytest +from rtichoke.reals_distribution import create_reals_distribution_steps + + +@contextmanager +def _serve(directory: Path) -> Iterator[str]: + handler = partial(SimpleHTTPRequestHandler, directory=str(directory)) + server = ThreadingHTTPServer(("127.0.0.1", 0), handler) + thread = Thread(target=server.serve_forever, daemon=True) + thread.start() + try: + yield f"http://127.0.0.1:{server.server_port}" + finally: + server.shutdown() + thread.join() + server.server_close() + + +def test_reals_distribution_steps_browser_acceptance(tmp_path: Path): + try: + from playwright.sync_api import sync_playwright + except ImportError: + pytest.skip("playwright is not available") + + df = pl.DataFrame( + { + "id": [1, 1, 1, 2, 2, 2, 3, 3, 3], + "step": [0, 1, 2, 0, 1, 2, 0, 1, 2], + "reals": [ + "None", + "Mild", + "Moderate", + "None", + "Mild", + "Mild", + "None", + "None", + "Mild", + ], + } + ) + + # 1. Raw / Excluded outcome distribution chart + chart_excl = create_reals_distribution_steps( + df, + reals_order=["None", "Mild", "Moderate"], + reals_scale="ordinal", + censoring_heuristic="excluded", + ) + html_file_excl = tmp_path / "reals_dist_excl.html" + chart_excl.write_html(html_file_excl) + + # 2. AJ / Adjusted outcome distribution chart + chart_adj = create_reals_distribution_steps( + df, + reals_order=["None", "Mild", "Moderate"], + reals_scale="ordinal", + censoring_heuristic="adjusted", + ) + html_file_adj = tmp_path / "reals_dist_adj.html" + chart_adj.write_html(html_file_adj) + + # Verify rendering over local HTTP server + with _serve(tmp_path) as base_url: + with sync_playwright() as p: + browser = p.chromium.launch(headless=True) + + # Test Excluded Mode HTML + page = browser.new_page() + errors: list[str] = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) + if msg.type in ["error", "warning"] + else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(f"{base_url}/reals_dist_excl.html") + page.wait_for_selector("svg") + + assert page.locator("svg").count() >= 1 + assert len(errors) == 0, f"Console errors in excluded mode: {errors}" + page.close() + + # Test Adjusted Mode HTML + page_adj = browser.new_page() + errors_adj: list[str] = [] + page_adj.on( + "console", + lambda msg: ( + errors_adj.append(msg.text) + if msg.type in ["error", "warning"] + else None + ), + ) + page_adj.on("pageerror", lambda err: errors_adj.append(str(err))) + page_adj.goto(f"{base_url}/reals_dist_adj.html") + page_adj.wait_for_selector("svg") + + assert page_adj.locator("svg").count() >= 1 + assert len(errors_adj) == 0, ( + f"Console errors in adjusted mode: {errors_adj}" + ) + page_adj.close() + + browser.close() + + # Verify direct file:// loading + with sync_playwright() as p: + browser = p.chromium.launch( + headless=True, + args=["--allow-file-access-from-files"], + ) + page = browser.new_page() + errors = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) if msg.type in ["error", "warning"] else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(html_file_excl.as_uri()) + page.wait_for_selector("svg") + + assert page.locator("svg").count() >= 1 + assert len(errors) == 0, f"Console errors found over file://: {errors}" + browser.close() + + +def test_reals_distribution_nominal_browser_acceptance(tmp_path: Path): + try: + from playwright.sync_api import sync_playwright + except ImportError: + pytest.skip("playwright is not available") + + df = pl.DataFrame( + { + "id": [1, 1, 2, 2], + "step": [0, 1, 0, 1], + "reals": ["Red", "Blue", "Green", "Red"], + } + ) + + chart = create_reals_distribution_steps( + df, + reals_order=["Red", "Green", "Blue"], + reals_scale="nominal", + censoring_heuristic="excluded", + ) + html_file = tmp_path / "reals_dist_nominal.html" + chart.write_html(html_file) + + with sync_playwright() as p: + browser = p.chromium.launch( + headless=True, + args=["--allow-file-access-from-files"], + ) + page = browser.new_page() + errors: list[str] = [] + page.on( + "console", + lambda msg: ( + errors.append(msg.text) if msg.type in ["error", "warning"] else None + ), + ) + page.on("pageerror", lambda err: errors.append(str(err))) + page.goto(html_file.as_uri()) + page.wait_for_selector("svg") + + assert page.locator("svg").count() >= 1 + assert len(errors) == 0, f"Console errors in nominal mode: {errors}" + browser.close() diff --git a/tests/test_rtichoke_viz_vendor.py b/tests/test_rtichoke_viz_vendor.py index d7ed7ddc..e63e8df4 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.23.2" -_SHA256 = "63981f4e4f78b38e6442b663052c17592d3355312ba16fb370321d25af456bfe" -_SOURCE_COMMIT = "af70152c884b351ed7c407047a92cad5c1bd7007" +_RELEASE_DIR = "rtichoke-viz-0.24.0" +_SHA256 = "58f153fbfb5aa57affbec983c4e4960fd0889c26e64ef1d25dbf982654fa90f0" +_SOURCE_COMMIT = "9ff8c40138c7b2d11332483e0ede900d8b50b935" -def test_vendored_rtichoke_viz_v0232_provenance_archive_and_schemas(): +def test_vendored_rtichoke_viz_v0240_provenance_archive_and_schemas(): provenance = (_VENDOR / "VENDORED_FROM").read_text() - assert "release=v0.23.2" in provenance + assert "release=v0.24.0" in provenance assert f"source_commit={_SOURCE_COMMIT}" in provenance - assert "archive=rtichoke-viz-0.23.2.tar.gz" in provenance + assert "archive=rtichoke-viz-0.24.0.tar.gz" in provenance assert f"sha256={_SHA256}" in provenance - archive = _VENDOR / "rtichoke-viz-0.23.2.tar.gz" + archive = _VENDOR / "rtichoke-viz-0.24.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_v0232_provenance_archive_and_schemas(): manifest = release.extractfile(f"{_RELEASE_DIR}/MANIFEST") assert manifest is not None assert manifest.read().decode() == ( - f"version=0.23.2\ncommit={_SOURCE_COMMIT}\n" + f"version=0.24.0\ncommit={_SOURCE_COMMIT}\n" ) for filename in ( "rtichoke-viz.css", @@ -43,6 +43,7 @@ def test_vendored_rtichoke_viz_v0232_provenance_archive_and_schemas(): assert packaged is not None assert (_VENDOR / filename).read_bytes() == packaged.read() + assert not (_VENDOR / "rtichoke-viz-0.23.2.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.23.0.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.22.3.tar.gz").exists() assert not (_VENDOR / "rtichoke-viz-0.22.2.tar.gz").exists() @@ -67,7 +68,7 @@ def test_vendored_rtichoke_viz_v0232_provenance_archive_and_schemas(): assert '"summary_metrics"' in report_schema -def test_v0232_bundle_keeps_existing_exports_and_prediction_distribution(): +def test_v0240_bundle_keeps_existing_exports_and_outcome_distribution(): bundle = (_VENDOR / "rtichoke-viz.js").read_text(encoding="utf-8") for export_name in ( "renderRoc", @@ -87,6 +88,8 @@ def test_v0232_bundle_keeps_existing_exports_and_prediction_distribution(): "SummaryMetricsSpecSchema", "renderPredictionDistribution", "PredictionDistributionSpecSchema", + "renderOutcomeDistribution", + "OutcomeDistributionSpecSchema", ): assert export_name in bundle diff --git a/uv.lock b/uv.lock index 28e2e333..8eded4f0 100644 --- a/uv.lock +++ b/uv.lock @@ -2069,14 +2069,14 @@ wheels = [ [[package]] name = "polarstate" -version = "0.1.8" +version = "0.1.10" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "polars" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/9b/09/107eb49e8fc33392d1f226c353adbaa2c345e9e77b82039bf0b9edbfadfc/polarstate-0.1.8.tar.gz", hash = "sha256:803e158f5961f234700aa0121e47ca754ff76796d01dc0230e5133f020cbe7bd", size = 3155, upload-time = "2025-07-29T02:24:27.829Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f3/ee/5642831bcf8427fb167568adfade20623afa5ae1781b8f85b83bd5df7f5b/polarstate-0.1.10.tar.gz", hash = "sha256:3953d282f648dc837fc410d9e9245e92f635cbd309622dfc2b34f7310c901d4d", size = 8829, upload-time = "2026-10-18T09:49:46.909Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d4/68/c80de613a28e48be2ce15e00118bf8a018b74229349fd1c26347b352dcee/polarstate-0.1.8-py3-none-any.whl", hash = "sha256:710d791e67ea09c46f79030ecd1253e67a9d2f100aceb848c25967d88314db6a", size = 4403, upload-time = "2025-07-29T02:24:27.122Z" }, + { url = "https://files.pythonhosted.org/packages/5d/39/19cd5b706cedb4bba9d53db03dbe19627eee00d2891cd0cf5d164678748f/polarstate-0.1.10-py3-none-any.whl", hash = "sha256:beb28cc1979e2863c4136aacbc51931c292267bf171cbd4149ce5568505a9c02", size = 11073, upload-time = "2026-10-18T09:49:46.073Z" }, ] [[package]] @@ -2616,7 +2616,7 @@ requires-dist = [ { name = "matplotlib", marker = "extra == 'matplotlib'", specifier = ">=3.9.0" }, { name = "plotly", specifier = ">=6.0.0,<7.0.0" }, { name = "polars", specifier = ">=1.31.0" }, - { name = "polarstate", specifier = "==0.1.8" }, + { name = "polarstate", specifier = "==0.1.10" }, { name = "reactable", specifier = ">=0.1.5" }, { name = "scikit-learn", specifier = ">=1.6.1" }, { name = "smoothstate", specifier = ">=0.1.1" },