// @observablehq/plot v0.6.1 Copyright 2020-2022 Observable, Inc. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3@7.7.0/dist/d3.min.js")):"function"==typeof define&&define.amd?define(["exports","d3@7.7.0/dist/d3.min.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Plot=t.Plot||{},t.d3)}(this,(function(t,e){"use strict";function n(t,e){if(t instanceof Date||(t=new Date(+t)),isNaN(t))return"function"==typeof e?e(t):e;const n=t.getUTCHours(),i=t.getUTCMinutes(),o=t.getUTCSeconds(),a=t.getUTCMilliseconds();return`${s=t.getUTCFullYear(),s<0?`-${r(-s,6)}`:s>9999?`+${r(s,6)}`:r(s,4)}-${r(t.getUTCMonth()+1,2)}-${r(t.getUTCDate(),2)}${n||i||o||a?`T${r(n,2)}:${r(i,2)}${o||a?`:${r(o,2)}${a?`.${r(a,3)}`:""}`:""}Z`:""}`;var s}function r(t,e){return`${t}`.padStart(e,"0")}const i=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function o(t,e){return i.test(t+="")?new Date(t):"function"==typeof e?e(t):e}const a=Object.getPrototypeOf(Uint8Array),s=Object.prototype.toString;function l(t,e,n){const r=typeof e;return"string"===r?A(t,c(e),n):"function"===r?A(t,e,n):"number"===r||e instanceof Date||"boolean"===r?A(t,x(e),n):e&&"function"==typeof e.transform?L(e.transform(t),n):L(e,n)}const c=t=>e=>e[t],u=(t,e)=>e,f={transform:t=>t},h=()=>1,d=()=>!0,p=t=>null==t?t:`${t}`,m=t=>null==t?t:+t,g=t=>null==t?t:!!t,y=t=>t?t[0]:void 0,v=t=>t?t[1]:void 0,x=t=>()=>t;function w(t){const n=+`${t}`.slice(1)/100;return(t,r)=>e.quantile(t,n,r)}function b(t,e){return void 0===t&&(t=e),null===t?[void 0,"none"]:tt(t)?[void 0,t]:[t,void 0]}function k(t,e){return void 0===t&&(t=e),null===t||"number"==typeof t?[void 0,t]:[t,void 0]}function $(t,e,n){if(null!=t)return M(t,e,n)}function M(t,e,n){const r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function L(t,e){return null==t?t:void 0===e?t instanceof Array||t instanceof a?t:Array.from(t):t instanceof e?t:e.from(t)}function A(t,e,n=Array){return t instanceof n?t.map(e):n.from(t,e)}function z(t,e=Array){return t instanceof e?t.slice():e.from(t)}function R(t){return t instanceof a}function O(t){return t?.toString===s}function C(t){return O(t)&&(void 0!==t.type||void 0!==t.domain)}function B(t){return O(t)&&"function"!=typeof t.transform}function E(t){return B(t)&&void 0===t.value&&void 0===t.channel}function N(t,e,n,r=f){return void 0===e&&void 0===n?(e=0,n=void 0===t?r:t):void 0===e?e=void 0===t?0:t:void 0===n&&(n=void 0===t?0:t),[e,n]}function S(t,e){return void 0===t&&void 0===e?[y,v]:[t,e]}function P({z:t,fill:e,stroke:n}={}){return void 0===t&&([t]=b(e)),void 0===t&&([t]=b(n)),t}function T(t){const e=t.length,n=new Uint32Array(e);for(let t=0;te(t[n],n,t)))}function j(t,e){return A(e,(e=>t[e]))}function q(t){return null!==t&&"object"==typeof t?t.valueOf():t}function W(t,e){if(void 0!==e[t])return e[t];switch(t){case"x1":case"x2":t="x";break;case"y1":case"y2":t="y"}return e[t]}function Y(t){let e;return[{transform:()=>e,label:F(t)},t=>e=t]}function I(t){return null==t?[t]:Y(t)}function F(t,e){return"string"==typeof t?t:t&&void 0!==t.label?t.label:e}function _(t,e){return{transform(n){const r=t.transform(n),i=e.transform(n);return H(r)||H(i)?A(r,((t,e)=>new Date((+r[e]+ +i[e])/2))):A(r,((t,e)=>(+r[e]+ +i[e])/2),Float64Array)},label:t.label}}function G(t){return void 0===t||B(t)?t:{value:t}}function X(t){return t&&"function"==typeof t[Symbol.iterator]}function U(t){for(const e of t)if(null!=e)return"object"!=typeof e||e instanceof Date}function V(t){for(const e of t){if(null==e)continue;const t=typeof e;return"string"===t||"boolean"===t}}function H(t){for(const e of t)if(null!=e)return e instanceof Date}function Z(t){for(const e of t)if(null!=e)return"string"==typeof e&&isNaN(e)&&o(e)}function Q(t){for(const e of t)if(null!=e){if("string"!=typeof e)return!1;if(e.trim())return!isNaN(e)}}function J(t,e){for(const n of t)if(null!=n)return e(n)}function K(t,e){for(const n of t)if(null!=n&&!e(n))return!1;return!0}function tt(t){return"string"==typeof t&&("none"===(t=t.toLowerCase().trim())||"currentcolor"===t||t.startsWith("url(")&&t.endsWith(")")||t.startsWith("var(")&&t.endsWith(")")||null!==e.color(t))}function et(t){return null==t||nt(t)}function nt(t){return/^\s*none\s*$/i.test(t)}function rt(t="middle"){return M(t,"frameAnchor",["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function it(t){if(null==t)return;const n=t[0],r=t[t.length-1];return e.descending(n,r)}function ot(t){return X(t)?function(t){console.warn("named iterables are deprecated; please use an object instead");const e=new Set;return Object.fromEntries(Array.from(t,(t=>{const{name:n}=t;if(null==n)throw new Error("missing name");const r=`${n}`;if("__proto__"===r)throw new Error(`illegal name: ${r}`);if(e.has(r))throw new Error(`duplicate name: ${r}`);return e.add(r),[n,t]})))}(t):t}const at=Symbol("position"),st=Symbol("color"),lt=Symbol("radius"),ct=Symbol("length"),ut=Symbol("opacity"),ft=Symbol("symbol"),ht=new Map([["x",at],["y",at],["fx",at],["fy",at],["r",lt],["color",st],["opacity",ut],["symbol",ft],["length",ct]]);function dt(t){return null!=t&&!Number.isNaN(t)}function pt(t,n){return+dt(n)-+dt(t)||e.ascending(t,n)}function mt(t,n){return+dt(n)-+dt(t)||e.descending(t,n)}function gt(t){return null!=t&&""!=`${t}`}function yt(t){return isFinite(t)?t:NaN}function vt(t){return t>0&&isFinite(t)?t:NaN}function xt(t){return t<0&&isFinite(t)?t:NaN}function wt(t={},e){let{filter:n,sort:r,reverse:i,transform:o,initializer:a,...s}=t;if(void 0===o&&(null!=n&&(o=Lt(n)),null==r||E(r)||(o=kt(o,Rt(r))),i&&(o=kt(o,At))),null!=e&&null!=a)throw new Error("transforms cannot be applied after initializers");return{...s,...(null===r||E(r))&&{sort:r},transform:kt(o,e)}}function bt(t={},e){let{filter:n,sort:r,reverse:i,initializer:o,...a}=t;return void 0===o&&(null!=n&&(o=Lt(n)),null==r||E(r)||(o=$t(o,Rt(r))),i&&(o=$t(o,At))),{...a,...(null===r||E(r))&&{sort:r},initializer:$t(o,e)}}function kt(t,e){return null==t?null===e?void 0:e:null==e?null===t?void 0:t:function(n,r){return({data:n,facets:r}=t.call(this,n,r)),e.call(this,L(n),r)}}function $t(t,e){return null==t?null===e?void 0:e:null==e?null===t?void 0:t:function(n,r,i,...o){let a,s,l,c,u,f;return({data:s=n,facets:l=r,channels:a}=t.call(this,n,r,i,...o)),({data:u=s,facets:f=l,channels:c}=e.call(this,s,l,{...i,...a},...o)),{data:u,facets:f,channels:{...a,...c}}}}function Mt(t,e){return(null!=t.initializer?bt:wt)(t,e)}function Lt(t){return(e,n)=>{const r=l(e,t);return{data:e,facets:n.map((t=>t.filter((t=>r[t]))))}}}function At(t,e){return{data:t,facets:e.map((t=>t.slice().reverse()))}}function zt(t,e){return{...(B(t)&&void 0!==t.channel?bt:Mt)(e,Rt(t)),sort:null}}function Rt(t){return("function"==typeof t&&1!==t.length?Ot:Ct)(t)}function Ot(t){return(e,n)=>{const r=(n,r)=>t(e[n],e[r]);return{data:e,facets:n.map((t=>t.slice().sort(r)))}}}function Ct(t){let e,n;if(({channel:e,value:t,order:n=pt}={...G(t)}),"function"!=typeof n)switch(`${n}`.toLowerCase()){case"ascending":n=pt;break;case"descending":n=mt;break;default:throw new Error(`invalid order: ${n}`)}return(r,i,o)=>{let a;if(void 0===e)a=l(r,t);else{if(void 0===o)throw new Error("channel sort requires an initializer");if(a=o[e],!a)return{};a=a.value}const s=(t,e)=>n(a[t],a[e]);return{data:r,facets:i.map((t=>t.slice().sort(s)))}}}function Bt(t,e){return St(null,null,t,e)}function Et(t={y:"count"},e={}){const{x:n=f}=e;if(null==n)throw new Error("missing channel: x");return St(n,null,t,e)}function Nt(t={x:"count"},e={}){const{y:n=f}=e;if(null==n)throw new Error("missing channel: y");return St(null,n,t,e)}function St(t,e,{data:n=Gt,filter:r,sort:i,reverse:o,...a}={},s={}){a=Tt(a,s),n=Wt(n,f),i=null==i?void 0:Dt("sort",i,s),r=null==r?void 0:jt("filter",r,s);const[c,u]=I(t),[h,d]=I(e),{z:p,fill:m,stroke:g,x1:y,x2:v,y1:x,y2:w,...k}=s,[$,M]=I(p),[L]=b(m),[A]=b(g),[z,R]=I(L),[O,C]=I(A);return{..."z"in s&&{z:$||p},..."fill"in s&&{fill:z||m},..."stroke"in s&&{stroke:O||g},...wt(k,((s,c)=>{const f=l(s,t),h=l(s,e),m=l(s,p),g=l(s,L),y=l(s,A),v=Yt(a,{z:m,fill:g,stroke:y}),x=[],w=[],b=f&&u([]),k=h&&d([]),$=m&&M([]),z=g&&R([]),O=y&&C([]);let B=0;for(const t of a)t.initialize(s);i&&i.initialize(s),r&&r.initialize(s);for(const t of c){const e=[];for(const e of a)e.scope("facet",t);i&&i.scope("facet",t),r&&r.scope("facet",t);for(const[o,l]of qt(t,v))for(const[t,c]of qt(l,h))for(const[l,u]of qt(c,f))if(!r||r.reduce(u)){e.push(B++),w.push(n.reduce(u,s)),f&&b.push(l),h&&k.push(t),m&&$.push(v===m?o:m[u[0]]),g&&z.push(v===g?o:g[u[0]]),y&&O.push(v===y?o:y[u[0]]);for(const t of a)t.reduce(u);i&&i.reduce(u)}x.push(e)}return It(x,i,o),{data:w,facets:x}})),...!Pt(a,"x")&&(c?{x:c}:{x1:y,x2:v}),...!Pt(a,"y")&&(h?{y:h}:{y1:x,y2:w}),...Object.fromEntries(a.map((({name:t,output:e})=>[t,e])))}}function Pt(t,...e){for(const{name:n}of t)if(e.includes(n))return!0;return!1}function Tt(t,e){const n=Object.entries(t);return null!=e.title&&void 0===t.title&&n.push(["title",Ut]),null!=e.href&&void 0===t.href&&n.push(["href",Xt]),n.map((([t,n])=>null==n?{name:t,initialize(){},scope(){},reduce(){}}:Dt(t,n,e)))}function Dt(t,e,n){const r=jt(t,e,n),[i,o]=Y(r.label);let a;return{name:t,output:i,initialize(t){r.initialize(t),a=o([])},scope(t,e){r.scope(t,e)},reduce(t,e){a.push(r.reduce(t,e))}}}function jt(t,e,n){const r=W(t,n),i=Wt(e,r);let o,a;return{label:F(i===Ht?null:r,i.label),initialize(t){o=void 0===r?t:l(t,r),"data"===i.scope&&(a=i.reduce(T(t),o))},scope(t,e){i.scope===t&&(a=i.reduce(e,o))},reduce:(t,e)=>null==i.scope?i.reduce(t,o,e):i.reduce(t,o,a,e)}}function qt(t,n){return n?e.sort(e.group(t,(t=>n[t])),y):[[,t]]}function Wt(t,n){if(t&&"function"==typeof t.reduce)return t;if("function"==typeof t)return r=t,{reduce:(t,e,n)=>r(j(e,t),n)};var r;if(/^p\d{2}$/i.test(t))return Ft(w(t));switch(`${t}`.toLowerCase()){case"first":return Xt;case"last":return Vt;case"count":return Ht;case"distinct":return Zt;case"sum":return null==n?Ht:Qt;case"proportion":return Jt(n,"data");case"proportion-facet":return Jt(n,"facet");case"deviation":return Ft(e.deviation);case"min":return Ft(e.min);case"min-index":return Ft(e.minIndex);case"max":return Ft(e.max);case"max-index":return Ft(e.maxIndex);case"mean":return _t(e.mean);case"median":return _t(e.median);case"variance":return Ft(e.variance);case"mode":return Ft(e.mode);case"x":return te;case"x1":return ne;case"x2":return re;case"y":return ee;case"y1":return ie;case"y2":return oe}throw new Error(`invalid reduce: ${t}`)}function Yt(t,e){for(const n in e){const r=e[n];if(void 0!==r&&!t.some((t=>t.name===n)))return r}}function It(t,e,n){if(e){const n=e.output.transform(),r=(t,e)=>pt(n[t],n[e]);t.forEach((t=>t.sort(r)))}n&&t.forEach((t=>t.reverse()))}function Ft(t){return{reduce:(e,n)=>t(e,(t=>n[t]))}}function _t(t){return{reduce(e,n){const r=t(e,(t=>n[t]));return H(n)?new Date(r):r}}}const Gt={reduce:(t,e)=>j(e,t)},Xt={reduce:(t,e)=>e[t[0]]},Ut={reduce(t,n){const r=e.sort(e.rollup(t,(t=>t.length),(t=>n[t])),v),i=r.slice(-5).reverse();if(i.length`${t} (${e.toLocaleString("en-US")})`)).join("\n")}},Vt={reduce:(t,e)=>e[t[t.length-1]]},Ht={label:"Frequency",reduce:t=>t.length},Zt={label:"Distinct",reduce:(t,n)=>{const r=new e.InternSet;for(const e of t)r.add(n[e]);return r.size}},Qt=Ft(e.sum);function Jt(t,n){return null==t?{scope:n,label:"Frequency",reduce:(t,e,n=1)=>t.length/n}:{scope:n,reduce:(t,n,r=1)=>e.sum(t,(t=>n[t]))/r}}function Kt(t,e){const n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}const te={reduce:(t,e,{x1:n,x2:r})=>Kt(n,r)},ee={reduce:(t,e,{y1:n,y2:r})=>Kt(n,r)},ne={reduce:(t,e,{x1:n})=>n},re={reduce:(t,e,{x2:n})=>n},ie={reduce:(t,e,{y1:n})=>n},oe={reduce:(t,e,{y2:n})=>n};function ae(t,{scale:e,type:n,value:r,filter:i,hint:o}){return{scale:e,type:n,value:l(t,r),label:F(r),filter:i,hint:o}}function se(t,e){return Object.fromEntries(Object.entries(t).map((([t,{scale:n,value:r}])=>{let i;return void 0!==n&&(i=e[n]),[t,void 0===i?r:A(r,i)]})))}function le(t,e){for(const n in t){const r=t[n];if(r.scale===e)return r}}function ce(t,e,n){const r=ue(t,e);return A(ue(t,n),((t,e)=>Math.abs(t-r[e])),Float64Array)}function ue(t,e,n){let r=t[e];if(r||void 0===n||(r=t[n]),r)return r.value;throw new Error(`missing channel: ${e}`)}function fe([t,n],[r,i]){return e.ascending(n,i)||e.ascending(t,r)}function he([t,n],[r,i]){return e.descending(n,i)||e.ascending(t,r)}const de=new Map([["accent",e.schemeAccent],["category10",e.schemeCategory10],["dark2",e.schemeDark2],["paired",e.schemePaired],["pastel1",e.schemePastel1],["pastel2",e.schemePastel2],["set1",e.schemeSet1],["set2",e.schemeSet2],["set3",e.schemeSet3],["tableau10",e.schemeTableau10],["brbg",me(e.schemeBrBG,e.interpolateBrBG)],["prgn",me(e.schemePRGn,e.interpolatePRGn)],["piyg",me(e.schemePiYG,e.interpolatePiYG)],["puor",me(e.schemePuOr,e.interpolatePuOr)],["rdbu",me(e.schemeRdBu,e.interpolateRdBu)],["rdgy",me(e.schemeRdGy,e.interpolateRdGy)],["rdylbu",me(e.schemeRdYlBu,e.interpolateRdYlBu)],["rdylgn",me(e.schemeRdYlGn,e.interpolateRdYlGn)],["spectral",me(e.schemeSpectral,e.interpolateSpectral)],["burd",ge(e.schemeRdBu,e.interpolateRdBu)],["buylrd",ge(e.schemeRdYlBu,e.interpolateRdYlBu)],["blues",pe(e.schemeBlues,e.interpolateBlues)],["greens",pe(e.schemeGreens,e.interpolateGreens)],["greys",pe(e.schemeGreys,e.interpolateGreys)],["oranges",pe(e.schemeOranges,e.interpolateOranges)],["purples",pe(e.schemePurples,e.interpolatePurples)],["reds",pe(e.schemeReds,e.interpolateReds)],["turbo",ye(e.interpolateTurbo)],["viridis",ye(e.interpolateViridis)],["magma",ye(e.interpolateMagma)],["inferno",ye(e.interpolateInferno)],["plasma",ye(e.interpolatePlasma)],["cividis",ye(e.interpolateCividis)],["cubehelix",ye(e.interpolateCubehelixDefault)],["warm",ye(e.interpolateWarm)],["cool",ye(e.interpolateCool)],["bugn",pe(e.schemeBuGn,e.interpolateBuGn)],["bupu",pe(e.schemeBuPu,e.interpolateBuPu)],["gnbu",pe(e.schemeGnBu,e.interpolateGnBu)],["orrd",pe(e.schemeOrRd,e.interpolateOrRd)],["pubu",pe(e.schemePuBu,e.interpolatePuBu)],["pubugn",pe(e.schemePuBuGn,e.interpolatePuBuGn)],["purd",pe(e.schemePuRd,e.interpolatePuRd)],["rdpu",pe(e.schemeRdPu,e.interpolateRdPu)],["ylgn",pe(e.schemeYlGn,e.interpolateYlGn)],["ylgnbu",pe(e.schemeYlGnBu,e.interpolateYlGnBu)],["ylorbr",pe(e.schemeYlOrBr,e.interpolateYlOrBr)],["ylorrd",pe(e.schemeYlOrRd,e.interpolateYlOrRd)],["rainbow",ve(e.interpolateRainbow)],["sinebow",ve(e.interpolateSinebow)]]);function pe(t,n){return({length:r})=>1===r?[t[3][1]]:2===r?[t[3][1],t[3][2]]:(r=Math.max(3,Math.floor(r)))>9?e.quantize(n,r):t[r]}function me(t,n){return({length:r})=>2===r?[t[3][0],t[3][2]]:(r=Math.max(3,Math.floor(r)))>11?e.quantize(n,r):t[r]}function ge(t,n){return({length:r})=>2===r?[t[3][2],t[3][0]]:(r=Math.max(3,Math.floor(r)))>11?e.quantize((t=>n(1-t)),r):t[r].slice().reverse()}function ye(t){return({length:n})=>e.quantize(t,Math.max(2,Math.floor(n)))}function ve(t){return({length:n})=>e.quantize(t,Math.floor(n)+1).slice(0,-1)}function xe(t){const e=`${t}`.toLowerCase();if(!de.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return de.get(e)}function we(t,e){const n=xe(t),r="function"==typeof n?n({length:e}):n;return r.length!==e?r.slice(0,e):r}const be=new Map([["brbg",e.interpolateBrBG],["prgn",e.interpolatePRGn],["piyg",e.interpolatePiYG],["puor",e.interpolatePuOr],["rdbu",e.interpolateRdBu],["rdgy",e.interpolateRdGy],["rdylbu",e.interpolateRdYlBu],["rdylgn",e.interpolateRdYlGn],["spectral",e.interpolateSpectral],["burd",t=>e.interpolateRdBu(1-t)],["buylrd",t=>e.interpolateRdYlBu(1-t)],["blues",e.interpolateBlues],["greens",e.interpolateGreens],["greys",e.interpolateGreys],["purples",e.interpolatePurples],["reds",e.interpolateReds],["oranges",e.interpolateOranges],["turbo",e.interpolateTurbo],["viridis",e.interpolateViridis],["magma",e.interpolateMagma],["inferno",e.interpolateInferno],["plasma",e.interpolatePlasma],["cividis",e.interpolateCividis],["cubehelix",e.interpolateCubehelixDefault],["warm",e.interpolateWarm],["cool",e.interpolateCool],["bugn",e.interpolateBuGn],["bupu",e.interpolateBuPu],["gnbu",e.interpolateGnBu],["orrd",e.interpolateOrRd],["pubugn",e.interpolatePuBuGn],["pubu",e.interpolatePuBu],["purd",e.interpolatePuRd],["rdpu",e.interpolateRdPu],["ylgnbu",e.interpolateYlGnBu],["ylgn",e.interpolateYlGn],["ylorbr",e.interpolateYlOrBr],["ylorrd",e.interpolateYlOrRd],["rainbow",e.interpolateRainbow],["sinebow",e.interpolateSinebow]]);function ke(t){const e=`${t}`.toLowerCase();if(!be.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return be.get(e)}const $e=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function Me(t){return null!=t&&$e.has(`${t}`.toLowerCase())}function Le(t){let e,n;return(...r)=>((n?.length!==r.length||n.some(((t,e)=>t!==r[e])))&&(n=r,e=t(...r)),e)}const Ae=Le((t=>new Intl.NumberFormat(t))),ze=Le(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}}))),Re=Le(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}})));function Oe(t){return n(t,"Invalid Date")}const Ce=function(t="en-US"){const e=function(t="en-US"){const e=Ae(t);return t=>null==t||isNaN(t)?void 0:e.format(t)}(t);return t=>(t instanceof Date?Oe:"number"==typeof t?e:p)(t)}();let Be=0;function Ee(t){console.warn(t),++Be}const Ne="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5;let Se=0;function Pe(){return"plot-clip-"+ ++Se}function Te(t,{title:e,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:a,fill:s,fillOpacity:l,stroke:c,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:m,strokeDasharray:g,strokeDashoffset:y,opacity:v,mixBlendMode:x,paintOrder:w,pointerEvents:$,shapeRendering:M},{ariaLabel:L,fill:A="currentColor",fillOpacity:z,stroke:R="none",strokeOpacity:O,strokeWidth:C,strokeLinecap:B,strokeLinejoin:E,strokeMiterlimit:N,paintOrder:S}){null===A&&(s=null,l=null),null===R&&(c=null,f=null),et(A)?et(R)||et(s)||(R="none"):et(R)&&!et(c)&&(A="none");const[P,T]=b(s,A),[D,j]=k(l,z),[q,W]=b(c,R),[Y,I]=k(f,O),[F,_]=k(v);nt(W)||(void 0===u&&(u=C),void 0===d&&(d=B),void 0===h&&(h=E),void 0!==m||/^\s*round\s*$/i.test(h)||(m=N),nt(T)||void 0!==w||(w=S));const[G,X]=k(u);return null!==A&&(t.fill=Ve(T,"currentColor"),t.fillOpacity=He(j,1)),null!==R&&(t.stroke=Ve(W,"none"),t.strokeWidth=He(X,1),t.strokeOpacity=He(I,1),t.strokeLinejoin=Ve(h,"miter"),t.strokeLinecap=Ve(d,"butt"),t.strokeMiterlimit=He(m,4),t.strokeDasharray=Ve(g,"none"),t.strokeDashoffset=Ve(y,"0")),t.target=p(a),t.ariaLabel=p(L),t.ariaDescription=p(i),t.ariaHidden=p(o),t.opacity=He(_,1),t.mixBlendMode=Ve(x,"normal"),t.paintOrder=Ve(w,"normal"),t.pointerEvents=Ve($,"auto"),t.shapeRendering=Ve(M,"auto"),{title:{value:e,optional:!0},href:{value:n,optional:!0},ariaLabel:{value:r,optional:!0},fill:{value:P,scale:"color",optional:!0},fillOpacity:{value:D,scale:"opacity",optional:!0},stroke:{value:q,scale:"color",optional:!0},strokeOpacity:{value:Y,scale:"opacity",optional:!0},strokeWidth:{value:G,optional:!0},opacity:{value:F,scale:"opacity",optional:!0}}}function De(t,e){e&&t.text((t=>Ce(e[t])))}function je(t,e){e&&t.text((([t])=>Ce(e[t])))}function qe(t,{target:e},{ariaLabel:n,title:r,fill:i,fillOpacity:o,stroke:a,strokeOpacity:s,strokeWidth:l,opacity:c,href:u}){n&&Xe(t,"aria-label",(t=>n[t])),i&&Xe(t,"fill",(t=>i[t])),o&&Xe(t,"fill-opacity",(t=>o[t])),a&&Xe(t,"stroke",(t=>a[t])),s&&Xe(t,"stroke-opacity",(t=>s[t])),l&&Xe(t,"stroke-width",(t=>l[t])),c&&Xe(t,"opacity",(t=>c[t])),u&&Ge(t,(t=>u[t]),e),function(t,e){e&&t.filter((t=>gt(e[t]))).append("title").call(De,e)}(t,r)}function We(t,{target:e},{ariaLabel:n,title:r,fill:i,fillOpacity:o,stroke:a,strokeOpacity:s,strokeWidth:l,opacity:c,href:u}){n&&Xe(t,"aria-label",(([t])=>n[t])),i&&Xe(t,"fill",(([t])=>i[t])),o&&Xe(t,"fill-opacity",(([t])=>o[t])),a&&Xe(t,"stroke",(([t])=>a[t])),s&&Xe(t,"stroke-opacity",(([t])=>s[t])),l&&Xe(t,"stroke-width",(([t])=>l[t])),c&&Xe(t,"opacity",(([t])=>c[t])),u&&Ge(t,(([t])=>u[t]),e),function(t,e){e&&t.filter((([t])=>gt(e[t]))).append("title").call(je,e)}(t,r)}function Ye(t,n,r){const i=e.group(t,(t=>n[t]));return void 0===r&&i.size>t.length>>1&&Ee("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."),i.values()}function*Ie(t,e,{z:n},r){const{z:i}=r,o=function({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:a,opacity:s,href:l}){return[t,e,n,r,i,o,a,s,l].filter((t=>void 0!==t))}(r),a=[...e,...o];for(const e of i?Ye(t,i,n):[t]){let t,n;t:for(const r of e){for(const t of a)if(!dt(t[r])){n&&n.push(-1);continue t}if(void 0!==t){n.push(r);for(let e=0;eq(t[r]))),n=[r];continue t}}}else n&&(yield n),t=o.map((t=>q(t[r]))),n=[r]}n&&(yield n)}}function Fe(t,n,r,i,o){switch(Xe(t,"aria-label",n.ariaLabel),Xe(t,"aria-description",n.ariaDescription),Xe(t,"aria-hidden",n.ariaHidden),Xe(t,"fill",n.fill),Xe(t,"fill-opacity",n.fillOpacity),Xe(t,"stroke",n.stroke),Xe(t,"stroke-width",n.strokeWidth),Xe(t,"stroke-opacity",n.strokeOpacity),Xe(t,"stroke-linejoin",n.strokeLinejoin),Xe(t,"stroke-linecap",n.strokeLinecap),Xe(t,"stroke-miterlimit",n.strokeMiterlimit),Xe(t,"stroke-dasharray",n.strokeDasharray),Xe(t,"stroke-dashoffset",n.strokeDashoffset),Xe(t,"shape-rendering",n.shapeRendering),Xe(t,"paint-order",n.paintOrder),Xe(t,"pointer-events",n.pointerEvents),n.clip){case"frame":{const{x:e,y:n}=r,{width:o,height:a,marginLeft:s,marginRight:l,marginTop:c,marginBottom:u}=i,f=Pe();t.attr("clip-path",`url(#${f})`).append("clipPath").attr("id",f).append("rect").attr("x",s-(e?.bandwidth?e.bandwidth()/2:0)).attr("y",c-(n?.bandwidth?n.bandwidth()/2:0)).attr("width",o-l-s).attr("height",a-c-u);break}case"sphere":{const{projection:n}=o;if(!n)throw new Error('the "sphere" clip option requires a projection');const r=Pe();t.attr("clip-path",`url(#${r})`).append("clipPath").attr("id",r).append("path").attr("d",e.geoPath(n)({type:"Sphere"}));break}}}function _e(t,e){!function(t,e,n){null!=n&&t.style(e,n)}(t,"mix-blend-mode",e.mixBlendMode),Xe(t,"opacity",e.opacity)}function Ge(t,n,r){t.each((function(t){const i=n(t);if(null!=i){const t=this.ownerDocument.createElementNS(e.namespaces.svg,"a");t.setAttribute("fill","inherit"),t.setAttributeNS(e.namespaces.xlink,"href",i),null!=r&&t.setAttribute("target",r),this.parentNode.insertBefore(t,this).appendChild(this)}}))}function Xe(t,e,n){null!=n&&t.attr(e,n)}function Ue(t,e,{x:n,y:r},i=Ne,o=Ne){i+=e.dx,o+=e.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&t.attr("transform",`translate(${i},${o})`)}function Ve(t,e){if((t=p(t))!==e)return t}function He(t,e){if((t=m(t))!==e)return t}const Ze=/^-?([_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])*$/;function Qe(t){if(void 0===t)return`plot-${Math.random().toString(16).slice(2)}`;if(t=`${t}`,!Ze.test(t))throw new Error(`invalid class name: ${t}`);return t}function Je(t,e){if("string"==typeof e)t.property("style",e);else if(null!=e)for(const n of t)Object.assign(n.style,e)}function Ke({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:a}){return[/left$/.test(t)?a:/right$/.test(t)?e-i:(a+e-i)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-o:(r+n-o)/2]}function tn({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=nn(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function en({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=nn(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function nn(t,e,n){return void 0===t&&void 0===e&&void 0===n?Ne?[1,0]:[.5,.5]:[e,n]}function rn(t){if(null!=t){if("number"==typeof t){const n=t;return{floor:t=>n*Math.floor(t/n),offset:t=>t+n,range:(t,r)=>e.range(Math.ceil(t/n),r/n).map((t=>n*t))}}if("function"!=typeof t.floor||"function"!=typeof t.offset)throw new Error("invalid interval; missing floor or offset function");return t}}function on(t,{interval:e}){return(t={...G(t)}).interval=rn(void 0===t.interval?e:t.interval),t}function an(t,e,n,r){const{[t]:i,[`${t}1`]:o,[`${t}2`]:a}=n,{value:s,interval:c}=on(i,n);if(null==s||null==c&&!r)return n;const u=F(i);if(null==c){let e;const r={transform:t=>e||(e=l(t,s)),label:u};return{...n,[t]:void 0,[`${t}1`]:void 0===o?r:o,[`${t}2`]:void 0===a?r:a}}let f,h;function d(t){return void 0!==h&&t===f?h:h=A(l(f=t,s),(t=>c.floor(t)))}return e({...n,[t]:void 0,[`${t}1`]:void 0===o?{transform:d,label:u}:o,[`${t}2`]:void 0===a?{transform:t=>d(t).map((t=>c.offset(t))),label:u}:a})}function sn(t,e,n){const{[t]:r}=n,{value:i,interval:o}=on(r,n);return null==i||null==o?n:e({...n,[t]:{label:F(r),transform:t=>{const e=A(l(t,i),(t=>o.floor(t))),n=e.map((t=>o.offset(t)));return e.map(H(e)?(t,e)=>null==t||isNaN(t=+t)||null==(e=n[e])||isNaN(e=+e)?void 0:new Date((t+e)/2):(t,e)=>null==t||null==(e=n[e])?NaN:(+t+ +e)/2)}}})}function ln(t={}){return an("x",tn,t,!0)}function cn(t={}){return an("y",en,t,!0)}function un(t={}){return an("x",tn,t)}function fn(t={}){return an("y",en,t)}function hn(t={}){return sn("x",tn,t)}function dn(t={}){return sn("y",en,t)}const pn=t=>e=>t(1-e),mn=[0,1],gn=new Map([["number",e.interpolateNumber],["rgb",e.interpolateRgb],["hsl",e.interpolateHsl],["hcl",e.interpolateHcl],["lab",e.interpolateLab]]);function yn(t){const e=`${t}`.toLowerCase();if(!gn.has(e))throw new Error(`unknown interpolator: ${e}`);return gn.get(e)}function vn(t,n,r,{type:i,nice:o,clamp:a,zero:s,domain:l=kn(t,r),unknown:c,round:u,scheme:f,interval:h,range:d=(ht.get(t)===lt?Mn(r,l):ht.get(t)===ct?Ln(r,l):ht.get(t)===ut?mn:void 0),interpolate:p=(ht.get(t)===st?null==f&&void 0!==d?e.interpolateRgb:ke(void 0!==f?f:"cyclical"===i?"rainbow":"turbo"):u?e.interpolateRound:e.interpolateNumber),reverse:m}){if(h=rn(h),"cyclical"!==i&&"sequential"!==i||(i="linear"),m=!!m,"function"!=typeof p&&(p=yn(p)),1===p.length?(m&&(p=pn(p),m=!1),void 0===d&&2===(d=Float64Array.from(l,((t,e)=>e/(l.length-1)))).length&&(d=mn),n.interpolate((d===mn?x:Rn)(p))):n.interpolate(p),s){const[t,n]=e.extent(l);(t>0||n<0)&&(it(l=z(l))!==Math.sign(t)?l[l.length-1]=0:l[0]=0)}return m&&(l=e.reverse(l)),n.domain(l).unknown(c),o&&(n.nice(!0===o?void 0:o),l=n.domain()),void 0!==d&&n.range(d),a&&n.clamp(a),{type:i,domain:l,range:d,scale:n,interpolate:p,interval:h}}function xn(t,n,{exponent:r=1,...i}){return vn(t,e.scalePow().exponent(r),n,{...i,type:"pow"})}function wn(t,n,{domain:r=[0],unknown:i,scheme:o="rdylbu",interpolate:a,range:s=(void 0!==a?e.quantize(a,r.length+1):ht.get(t)===st?we(o,r.length+1):void 0),reverse:l}){const c=it(L(r));if(!e.pairs(r).every((([t,n])=>function(t,n,r){const i=e.descending(t,n);return 0===i||i===r}(t,n,c))))throw new Error(`the ${t} scale has a non-monotonic domain`);return l&&(s=e.reverse(s)),{type:"threshold",scale:e.scaleThreshold(c<0?e.reverse(r):r,void 0===s?[]:s).unknown(i),domain:r,range:s}}function bn(t,n=yt){return t.length?[e.min(t,(({value:t})=>void 0===t?t:e.min(t,n))),e.max(t,(({value:t})=>void 0===t?t:e.max(t,n)))]:[0,1]}function kn(t,e){const n=ht.get(t);return(n===lt||n===ut||n===ct?$n:bn)(e)}function $n(t){return[0,t.length?e.max(t,(({value:t})=>void 0===t?t:e.max(t,yt))):1]}function Mn(t,n){const r=t.find((({radius:t})=>void 0!==t));if(void 0!==r)return[0,r.radius];const i=e.quantile(t,.5,(({value:t})=>void 0===t?NaN:e.quantile(t,.25,vt))),o=n.map((t=>3*Math.sqrt(t/i))),a=30/e.max(o);return a<1?o.map((t=>t*a)):o}function Ln(t,n){const r=e.median(t,(({value:t})=>void 0===t?NaN:e.median(t,Math.abs))),i=n.map((t=>12*t/r)),o=60/e.max(i);return o<1?i.map((t=>t*o)):i}function An(t){for(const{value:e}of t)if(void 0!==e)for(let n of e){if(n=+n,n>0)return bn(t,vt);if(n<0)return bn(t,xt)}return[1,10]}function zn(t){const e=[];for(const{value:n}of t)if(void 0!==n)for(const t of n)e.push(t);return e}function Rn(t){return(e,n)=>r=>t(e+r*(n-e))}function On(t,n,r,i,{type:o,nice:a,clamp:s,domain:l=bn(i),unknown:c,pivot:u=0,scheme:f,range:h,symmetric:d=!0,interpolate:p=(ht.get(t)===st?null==f&&void 0!==h?e.interpolateRgb:ke(void 0!==f?f:"rdbu"):e.interpolateNumber),reverse:m}){u=+u;let[g,y]=l;if(g=Math.min(g,u),y=Math.max(y,u),"function"!=typeof p&&(p=yn(p)),void 0!==h&&(p=1===p.length?Rn(p)(...h):e.piecewise(p,h)),m&&(p=pn(p)),d){const t=r.apply(u),e=t-r.apply(g),n=r.apply(y)-t;en&&(y=r.invert(t+e))}return n.domain([g,u,y]).unknown(c).interpolator(p),s&&n.clamp(s),a&&n.nice(a),{type:o,domain:[g,y],pivot:u,interpolate:p,scale:n}}function Cn(t,n,{exponent:r=1,...i}){return On(t,e.scaleDivergingPow().exponent(r=+r),function(t){return.5===t?Sn:{apply:e=>Math.sign(e)*Math.pow(Math.abs(e),t),invert:e=>Math.sign(e)*Math.pow(Math.abs(e),1/t)}}(r),n,{...i,type:"diverging-pow"})}function Bn(t,n,{constant:r=1,...i}){return On(t,e.scaleDivergingSymlog().constant(r=+r),function(t){return{apply:e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),invert:e=>Math.sign(e)*Math.expm1(Math.abs(e))*t}}(r),n,i)}const En={apply:t=>t,invert:t=>t},Nn={apply:Math.log,invert:Math.exp},Sn={apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*(t*t)};function Pn(t,e,n,r){return vn(t,e,n,r)}const Tn=Math.sqrt(3),Dn=2/Tn,jn={draw(t,e){const n=Math.sqrt(e/Math.PI),r=n*Dn,i=r/2;t.moveTo(0,r),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(0,-r),t.lineTo(-n,-i),t.lineTo(-n,i),t.closePath()}},qn=new Map([["asterisk",e.symbolAsterisk],["circle",e.symbolCircle],["cross",e.symbolCross],["diamond",e.symbolDiamond],["diamond2",e.symbolDiamond2],["hexagon",jn],["plus",e.symbolPlus],["square",e.symbolSquare],["square2",e.symbolSquare2],["star",e.symbolStar],["times",e.symbolX],["triangle",e.symbolTriangle],["triangle2",e.symbolTriangle2],["wye",e.symbolWye]]);function Wn(t){return t&&"function"==typeof t.draw}function Yn(t){return!!Wn(t)||"string"==typeof t&&qn.has(t.toLowerCase())}function In(t){if(null==t||Wn(t))return t;const e=qn.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}const Fn=Symbol("ordinal");function _n(t,n,r,{type:i,interval:o,domain:a,range:s,reverse:l,hint:c}){return o=rn(o),void 0===a&&(a=Un(r,o,t)),"categorical"!==i&&i!==Fn||(i="ordinal"),l&&(a=e.reverse(a)),n.domain(a),void 0!==s&&("function"==typeof s&&(s=s(a)),n.range(s)),{type:i,domain:a,range:s,scale:n,hint:c,interval:o}}function Gn(t,n,{type:r,interval:i,domain:o,range:a,scheme:s,unknown:l,...c}){let u;if(i=rn(i),void 0===o&&(o=Un(n,i,t)),ht.get(t)===ft)u=function(t){return{fill:Vn(t,"fill"),stroke:Vn(t,"stroke")}}(n),a=void 0===a?function(t){return et(t.fill)?e.symbolsStroke:e.symbolsFill}(u):A(a,In);else if(ht.get(t)===st&&(void 0!==a||"ordinal"!==r&&r!==Fn||(a=function(t,e="greys"){const n=new Set,[r,i]=we(e,2);for(const e of t)if(null!=e)if(!0===e)n.add(i);else{if(!1!==e)return;n.add(r)}return[...n]}(o,s),void 0!==a&&(s=void 0)),void 0===s&&void 0===a&&(s="ordinal"===r?"turbo":"tableau10"),void 0!==s))if(void 0!==a){const t=ke(s),n=a[0],r=a[1]-a[0];a=({length:i})=>e.quantize((e=>t(n+r*e)),i)}else a=xe(s);if(l===e.scaleImplicit)throw new Error("implicit unknown is not supported");return _n(t,e.scaleOrdinal().unknown(l),n,{...c,type:r,domain:o,range:a,hint:u})}function Xn(t,e,n,r){let{round:i}=n;return void 0!==i&&t.round(i=!!i),(t=_n(r,t,e,n)).round=i,t}function Un(t,n,r){const i=new e.InternSet;for(const{value:e,domain:n}of t){if(void 0!==n)return n();if(void 0!==e)for(const t of e)i.add(t)}if(void 0!==n){const[t,r]=e.extent(i).map(n.floor,n);return n.range(t,n.offset(r))}if(i.size>1e4&&ht.get(r)===at)throw new Error("implicit ordinal position domain has more than 10,000 values");return e.sort(i,pt)}function Vn(t,e){let n;for(const{hint:r}of t){const t=r?.[e];if(void 0!==t)if(void 0===n)n=t;else if(n!==t)return}return n}function Hn(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:i=e,insetLeft:o=e,round:a,nice:s,clamp:l,zero:c,align:u,padding:f,projection:h,...d}={}){const p={};for(const[e,m]of t){const t=d[e],g=nr(e,m,{round:ht.get(e)===at?a:void 0,nice:s,clamp:l,zero:c,align:u,padding:f,projection:h,...t});if(g){let{percent:a,transform:s,inset:l,insetTop:c=(void 0!==l?l:"y"===e?n:0),insetRight:u=(void 0!==l?l:"x"===e?r:0),insetBottom:f=(void 0!==l?l:"y"===e?i:0),insetLeft:h=(void 0!==l?l:"x"===e?o:0)}=t||{};if(null==s)s=void 0;else if("function"!=typeof s)throw new Error("invalid scale transform; not a function");g.percent=!!a,g.transform=s,"x"===e||"fx"===e?(g.insetLeft=+h,g.insetRight=+u):"y"!==e&&"fy"!==e||(g.insetTop=+c,g.insetBottom=+f),p[e]=g}}return p}function Zn(t){return Object.fromEntries(Object.entries(t).map((([t,{scale:e}])=>[t,e])))}function Qn(t,e){if(void 0===t.range){const{insetLeft:n,insetRight:r}=t,{width:i,marginLeft:o=0,marginRight:a=0}=e,s=o+n,l=i-a-r;t.range=[s,Math.max(s,l)],sr(t)||(t.range=tr(t)),t.scale.range(t.range)}Kn(t)}function Jn(t,e){if(void 0===t.range){const{insetTop:n,insetBottom:r}=t,{height:i,marginTop:o=0,marginBottom:a=0}=e,s=o+n,l=i-a-r;t.range=[Math.max(s,l),s],sr(t)?t.range.reverse():t.range=tr(t),t.scale.range(t.range)}Kn(t)}function Kn(t){void 0===t.round&&function({type:t}){return"point"===t||"band"===t}(t)&&function({scale:t}){const e=t.domain().length,[n,r]=t.range(),i=t.paddingInner?t.paddingInner():1,o=t.paddingOuter?t.paddingOuter():t.padding(),a=e-i,s=Math.abs(r-n)/Math.max(1,a+2*o);return(s-Math.floor(s))*a}(t)<=30&&t.scale.round(!0)}function tr(t){const e=t.scale.domain().length+lr(t);if(!(e>2))return t.range;const[n,r]=t.range;return Array.from({length:e},((t,i)=>n+i/(e-1)*(r-n)))}function er(t,e,n){return nr(t,void 0===n?void 0:[{hint:n}],{...e})}function nr(t,n=[],r={}){const i=function(t,e,{type:n,domain:r,range:i,scheme:o,pivot:a,projection:s}){if("fx"===t||"fy"===t)return"band";"x"!==t&&"y"!==t||null==s||(n=ir);for(const{type:t}of e)if(void 0!==t)if(void 0===n)n=t;else if(n!==t)throw new Error(`scale incompatible with channel: ${n} !== ${t}`);if(n===ir)return;if(void 0!==n)return n;if(void 0===r&&!e.some((({value:t})=>void 0!==t)))return;const l=ht.get(t);if(l===st&&void 0===i&&void 0===o&&ar(r,e,tt))return"identity";if(l===ft&&void 0===i&&ar(r,e,Yn))return"identity";if(l===lt)return"sqrt";if(l===ut||l===ct)return"linear";if(l===ft)return"ordinal";if((r||i||[]).length>2)return or(l);if(void 0!==r)return V(r)?or(l):H(r)?"utc":l!==st||null==a&&!Me(o)?"linear":"diverging";const c=e.map((({value:t})=>t)).filter((t=>void 0!==t));return c.some(V)?or(l):c.some(H)?"utc":l!==st||null==a&&!Me(o)?"linear":"diverging"}(t,n,r);if(void 0===r.type&&void 0===r.domain&&void 0===r.range&&null==r.interval&&"fx"!==t&&"fy"!==t&&sr({type:i})){const e=n.map((({value:t})=>t)).filter((t=>void 0!==t));e.some(H)?Ee(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${rr(i)}" 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 ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${rr(i)}".`):e.some(Z)?Ee(`Warning: some data associated with the ${t} 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 "${rr(i)}" 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 ${t} scale to "${rr(i)}".`):e.some(Q)&&Ee(`Warning: some data associated with the ${t} 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 "${rr(i)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${rr(i)}".`)}switch(r.type=i,i){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=fr(n,r,pr);break;case"identity":switch(ht.get(t)){case at:r=fr(n,r,pr);break;case ft:r=fr(n,r,hr)}break;case"utc":case"time":r=fr(n,r,dr)}switch(i){case"diverging":return function(t,n,r){return On(t,e.scaleDiverging(),En,n,r)}(t,n,r);case"diverging-sqrt":return function(t,e,n){return Cn(t,e,{...n,exponent:.5})}(t,n,r);case"diverging-pow":return Cn(t,n,r);case"diverging-log":return function(t,n,{base:r=10,pivot:i=1,domain:o=bn(n,i<0?xt:vt),...a}){return On(t,e.scaleDivergingLog().base(r=+r),Nn,n,{domain:o,pivot:i,...a})}(t,n,r);case"diverging-symlog":return Bn(t,n,r);case"categorical":case"ordinal":case Fn:return Gn(t,n,r);case"cyclical":case"sequential":case"linear":return function(t,n,r){return vn(t,e.scaleLinear(),n,r)}(t,n,r);case"sqrt":return function(t,e,n){return xn(t,e,{...n,exponent:.5})}(t,n,r);case"threshold":return wn(t,0,r);case"quantile":return function(t,n,{range:r,quantiles:i=(void 0===r?5:(r=[...r]).length),n:o=i,scheme:a="rdylbu",domain:s=zn(n),interpolate:l,reverse:c}){return void 0===r&&(r=void 0!==l?e.quantize(l,o):ht.get(t)===st?we(a,o):void 0),wn(t,0,{domain:e.scaleQuantile(s,void 0===r?{length:o}:r).quantiles(),range:r,reverse:c})}(t,n,r);case"quantize":return function(t,n,{range:r,n:i=(void 0===r?5:(r=[...r]).length),scheme:o="rdylbu",domain:a=kn(t,n),unknown:s,interpolate:l,reverse:c}){const[u,f]=e.extent(a);let h;return void 0===r?(h=e.ticks(u,f,i),h[0]<=u&&h.splice(0,1),h[h.length-1]>=f&&h.pop(),i=h.length+1,r=void 0!==l?e.quantize(l,i):ht.get(t)===st?we(o,i):void 0):(h=e.quantize(e.interpolateNumber(u,f),i+1).slice(1,-1),u instanceof Date&&(h=h.map((t=>new Date(t))))),it(L(a))<0&&h.reverse(),wn(t,0,{domain:h,range:r,reverse:c,unknown:s})}(t,n,r);case"pow":return xn(t,n,r);case"log":return function(t,n,{base:r=10,domain:i=An(n),...o}){return vn(t,e.scaleLog().base(r),n,{...o,domain:i})}(t,n,r);case"symlog":return function(t,n,{constant:r=1,...i}){return vn(t,e.scaleSymlog().constant(r),n,i)}(t,n,r);case"utc":return function(t,n,r){return Pn(t,e.scaleUtc(),n,r)}(t,n,r);case"time":return function(t,n,r){return Pn(t,e.scaleTime(),n,r)}(t,n,r);case"point":return function(t,n,{align:r=.5,padding:i=.5,...o}){return Xn(e.scalePoint().align(r).padding(i),n,o,t)}(t,n,r);case"band":return function(t,n,{align:r=.5,padding:i=.1,paddingInner:o=i,paddingOuter:a=("fx"===t||"fy"===t?0:i),...s}){return Xn(e.scaleBand().align(r).paddingInner(o).paddingOuter(a),n,s,t)}(t,n,r);case"identity":return ht.get(t)===at?{type:"identity",scale:e.scaleIdentity()}:{type:"identity"};case void 0:return;default:throw new Error(`unknown scale type: ${i}`)}}function rr(t){return"symbol"==typeof t?t.description:t}const ir={toString:()=>"projection"};function or(t){switch(t){case at:return"point";case st:return Fn;default:return"ordinal"}}function ar(t,e,n){return void 0!==t?J(t,n)&&K(t,n):e.some((({value:t})=>void 0!==t&&J(t,n)))&&e.every((({value:t})=>void 0===t||K(t,n)))}function sr({type:t}){return"ordinal"===t||"point"===t||"band"===t||t===Fn}function lr({type:t}){return"threshold"===t}function cr({range:t,domain:e=t}){return Math.sign(it(e))*Math.sign(it(t))}function ur(t){if(void 0===t)return!0;const e=t.domain(),n=t(e[0]);for(let r=1,i=e.length;rt,invert:t=>t};const u=t.unknown?t.unknown():void 0;return{type:e,domain:z(n),...void 0!==r&&{range:z(r)},...void 0!==s&&{transform:s},...l&&{percent:l},...void 0!==i&&{label:i},...void 0!==u&&{unknown:u},...void 0!==a&&{interval:a},...void 0!==o&&{interpolate:o},...t.clamp&&{clamp:t.clamp()},...void 0!==c&&{pivot:c,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:e=>t(e),...t.invert&&{invert:e=>t.invert(e)}}}const vr=Math.PI,xr=2*vr,wr=.618;function br({projection:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:a=n}={},s){if(null==t)return;if("function"==typeof t.stream)return t;let l,c,u="frame";if(O(t)){let e;if(({type:t,domain:c,inset:e,insetTop:r=(void 0!==e?e:r),insetRight:i=(void 0!==e?e:i),insetBottom:o=(void 0!==e?e:o),insetLeft:a=(void 0!==e?e:a),clip:u=u,...l}=t),null==t)return}"function"!=typeof t&&({type:t}=kr(t));const{width:f,height:h,marginLeft:d,marginRight:p,marginTop:m,marginBottom:g}=s,y=f-d-p-a-i,v=h-m-g-r-o;if(t=t?.({width:y,height:v,clip:u,...l}),null==t)return;u=function(t,n,r,i,o){if(!1===t||null==t||"number"==typeof t)return t=>t;!0===t&&(t="frame");if("frame"===`${t}`.toLowerCase())return e.geoClipRectangle(n,r,i,o);throw new Error(`unknown projection clip type: ${t}`)}(u,d,m,f-p,h-g);let x,w=d+a,b=m+r;if(null!=c){const[[n,r],[i,o]]=e.geoPath(t).bounds(c),a=Math.min(y/(i-n),v/(o-r));a>0?(w-=(a*(n+i)-y)/2,b-=(a*(r+o)-v)/2,x=e.geoTransform({point(t,e){this.stream.point(t*a+w,e*a+b)}})):Ee("Warning: the projection could not be fit to the specified domain; using the default scale.")}return x??=0===w&&0===b?Lr():e.geoTransform({point(t,e){this.stream.point(t+w,e+b)}}),{stream:e=>t.stream(x.stream(u(e)))}}function kr(t){switch(`${t}`.toLowerCase()){case"albers-usa":return $r(e.geoAlbersUsa,.7463,.4673);case"albers":return Mr(e.geoAlbers,.7463,.4673);case"azimuthal-equal-area":return $r(e.geoAzimuthalEqualArea,4,4);case"azimuthal-equidistant":return $r(e.geoAzimuthalEquidistant,xr,xr);case"conic-conformal":return Mr(e.geoConicConformal,xr,xr);case"conic-equal-area":return Mr(e.geoConicEqualArea,6.1702,2.9781);case"conic-equidistant":return Mr(e.geoConicEquidistant,7.312,3.6282);case"equal-earth":return $r(e.geoEqualEarth,5.4133,2.6347);case"equirectangular":return $r(e.geoEquirectangular,xr,vr);case"gnomonic":return $r(e.geoGnomonic,3.4641,3.4641);case"identity":return{type:Lr};case"reflect-y":return{type:Ar};case"mercator":return $r(e.geoMercator,xr,xr);case"orthographic":return $r(e.geoOrthographic,2,2);case"stereographic":return $r(e.geoStereographic,2,2);case"transverse-mercator":return $r(e.geoTransverseMercator,xr,xr);default:throw new Error(`unknown projection type: ${t}`)}}function $r(t,e,n){return{type:({width:r,height:i,rotate:o,precision:a=.15,clip:s})=>{const l=t();return null!=a&&l.precision?.(a),null!=o&&l.rotate?.(o),"number"==typeof s&&l.clipAngle?.(s),l.scale(Math.min(r/e,i/n)),l.translate([r/2,i/2]),l},aspectRatio:n/e}}function Mr(t,e,n){const{type:r,aspectRatio:i}=$r(t,e,n);return{type:t=>{const{parallels:e,domain:n,width:i,height:o}=t,a=r(t);return null!=e&&(a.parallels(e),void 0===n&&a.fitSize([i,o],{type:"Sphere"})),a},aspectRatio:i}}const Lr=x({stream:t=>t}),Ar=x(e.geoTransform({point(t,e){this.stream.point(t,-e)}}));function zr(t,e,n,r,i){const o=n[t]&&"x"===n[t].scale,a=n[e]&&"y"===n[e].scale;if(o&&a)!function(t,e,n,r){const i=n[t],o=n[e],a=i.length,s=n[t]=new Float64Array(a).fill(NaN),l=n[e]=new Float64Array(a).fill(NaN);let c;const u=r.stream({point(t,e){s[c]=t,l[c]=e}});for(c=0;c{}:t=>t.select(".domain").remove()).call(v?r?function(t,e,n){const r=e.bandwidth(),i=e.domain();return o=>o.selectAll(".tick").append("path").attr("stroke","currentColor").attr("stroke-opacity",.1).attr("d",(t?j(i,t):i).map((t=>`M0,${e(t)+n}v${r}`)).join(""))}(t,r,-A):(z=L*(l+a-o),t=>t.selectAll(".tick line").clone(!0).attr("stroke-opacity",.1).attr("y2",z)):()=>{}).call(x?t=>t.append("text").attr("fill","currentColor").attr("transform",`translate(${"center"===w?(i+c-s)/2:"right"===w?i+p:-d},${b*L})`).attr("dy","top"===g?"1em":"-0.32em").attr("text-anchor","center"===w?"middle":"right"===w?"end":"start").text(x):()=>{}).node();var z}}class Nr{constructor({name:t="y",axis:e,ticks:n,tickSize:r=("fy"===t?0:6),tickPadding:i=(0===r?9:3),tickFormat:o,fontVariant:a,grid:s,label:l,labelAnchor:c,labelOffset:u,line:f,tickRotate:h,ariaLabel:d,ariaDescription:y}={}){this.name=t,this.axis=M(e,"axis",["left","right"]),this.ticks=Pr(n),this.tickSize=m(r),this.tickPadding=m(i),this.tickFormat=Tr(o),this.fontVariant=Ve(a,"normal"),this.grid=g(s),this.label=p(l),this.labelAnchor=$(c,"labelAnchor",["center","top","bottom"]),this.labelOffset=m(u),this.line=g(f),this.tickRotate=m(h),this.ariaLabel=p(d),this.ariaDescription=p(y)}render(t,{[this.name]:n,fx:r},{width:i,height:o,marginTop:a,marginRight:s,marginBottom:l,marginLeft:c,offsetTop:u=0,facetMarginLeft:f,facetMarginRight:h},d){const{axis:p,fontVariant:m,grid:g,label:y,labelAnchor:v,labelOffset:x,line:w,name:b,tickRotate:k}=this,$="left"===p?-1:1,M=$*("y"===b?0:"left"===p?c-f:s-h)+("right"===p?i-s:c);return Cr("svg:g",d).call(Sr,this).attr("transform",`translate(${M},${u})`).call(jr("right"===p?e.axisRight:e.axisLeft,n,this)).call(qr,k).attr("font-size",null).attr("font-family",null).attr("font-variant",m).call(w?()=>{}:t=>t.select(".domain").remove()).call(g?r?function(t,e,n){const r=e.bandwidth(),i=e.domain();return o=>o.selectAll(".tick").append("path").attr("stroke","currentColor").attr("stroke-opacity",.1).attr("d",(t?j(i,t):i).map((t=>`M${e(t)+n},0h${r}`)).join(""))}(t,r,-M):(L=$*(c+s-i),t=>t.selectAll(".tick line").clone(!0).attr("stroke-opacity",.1).attr("x2",L)):()=>{}).call(y?t=>t.append("text").attr("fill","currentColor").attr("font-variant",null==m?null:"normal").attr("transform",`translate(${x*$},${"center"===v?(o+a-l)/2:"bottom"===v?o-l:a})${"center"===v?" rotate(-90)":""}`).attr("dy","center"===v?"right"===p?"-0.32em":"0.75em":"bottom"===v?"1.4em":"-1em").attr("text-anchor","center"===v?"middle":"right"===p?"end":"start").text(y):()=>{}).node();var L}}function Sr(t,{name:e,label:n,ariaLabel:r=`${e}-axis`,ariaDescription:i=n}){Xe(t,"aria-label",r),Xe(t,"aria-description",i)}function Pr(t){return null===t?[]:t}function Tr(t){return null===t?()=>null:t}function Dr(t,n){return void 0===t?H(n)?Oe:p:"function"==typeof t?t:("string"==typeof t?H(n)?e.utcFormat:e.format:x)(t)}function jr(t,e,{ticks:n,tickSize:r,tickPadding:i,tickFormat:o}){return e.tickFormat||(o=Dr(o,e.domain())),t(e).ticks(Array.isArray(n)?null:n,"function"==typeof o?null:o).tickFormat("function"==typeof o?o:null).tickSizeInner(r).tickSizeOuter(0).tickPadding(i).tickValues(Array.isArray(n)?n:null)}function qr(t,e){if(e=+e)for(const n of t.selectAll("text")){const t=+n.getAttribute("x"),r=+n.getAttribute("y");if(Math.abs(r)>Math.abs(t)){const t=Math.sign(r);n.setAttribute("transform",`translate(0, ${r+4*t*Math.cos(e*Br)}) rotate(${e})`),n.setAttribute("text-anchor",Math.abs(e)<10?"middle":e<0^t>0?"start":"end")}else{const r=Math.sign(t);n.setAttribute("transform",`translate(${t+4*r*Math.abs(Math.sin(e*Br))}, 0) rotate(${e})`),n.setAttribute("text-anchor",Math.abs(e)>60?"middle":r>0?"start":"end")}n.removeAttribute("x"),n.removeAttribute("y"),n.setAttribute("dy","0.32em")}}function Wr(t,n,r){if(void 0===n.ticks){const i=t.interval;if(void 0!==i){const[r,o]=e.extent(t.scale.domain());n.ticks=i.range(i.floor(r),i.offset(i.floor(o)))}else{const[i,o]=e.extent(t.scale.range());n.ticks=(o-i)/r}}void 0===n.tickFormat&&sr(t)&&(n.tickFormat=Ce)}function Yr(t,e,n){void 0===t.labelAnchor&&(t.labelAnchor=sr(e)?"center":cr(e)<0?"left":"right"),void 0===t.label&&(t.label=_r(n,e,t,"x")),e.label=t.label}function Ir(t,e,n,r){void 0===t.labelAnchor&&(t.labelAnchor=sr(n)?"center":e&&"top"===e.axis?"bottom":"top"),void 0===t.label&&(t.label=_r(r,n,t,"y")),n.label=t.label}function Fr(t,e,n,r){r&&(e.label=r.label),void 0===e.label&&(e.label=_r(n,e,null,t))}function _r(t=[],e,n,r){let i;for(const{label:e}of t)if(void 0!==e)if(void 0===i)i=e;else if(i!==e)return;if(void 0!==i){if(function({type:t}){return"time"===t||"utc"===t}(e)&&/^(date|time|year)$/i.test(i))return;if(!sr(e)&&(e.percent&&(i=`${i} (%)`),"x"===r||"y"===r)){const t=cr(e);t&&(i="x"===r||n&&"center"===n.labelAnchor?"x"===r==t<0?`← ${i}`:`${i} →`:`${t<0?"↑ ":"↓ "}${i}`)}}return i}function Gr(t){return sr(t)&&void 0===t.interval?void 0:"tabular-nums"}function Xr({y:t,fy:e,fx:n},r,{projection:i},{width:o,marginTopDefault:a,marginBottomDefault:s,marginRightDefault:l,marginLeftDefault:c}){const u=e?e.scale.domain().length:1,f=function(t,e){if("function"==typeof t?.stream)return wr;if(O(t)&&(t=t.type),null==t)return e?wr:void 0;if("function"!=typeof t){const{aspectRatio:e}=kr(t);if(e)return e}return wr}(i,r);if(f){const t=(1.1*u-.1)/(1.1*(n?n.scale.domain().length:1)-.1)*f,e=Math.max(.1,Math.min(10,t));return Math.round((o-c-l)*e+a+s)}const h=t?sr(t)?t.scale.domain().length:Math.max(7,17/u):1;return!(!t&&!e)*Math.max(1,Math.min(60,h*u))*20+30*!!n+60}function Ur(t,e){if(null==e)return e;const n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function Vr(t,e={},n,r){let{columns:i,tickFormat:o,fontVariant:a=Gr(t),swatchSize:s=15,swatchWidth:l=s,swatchHeight:c=s,marginLeft:u=0,className:f,style:h,width:d}=e;const p=Or(e);f=Qe(f),o=Dr(o,t.domain);const m=Cr("div",p).attr("class",f).attr("style",`\n --swatchWidth: ${+l}px;\n --swatchHeight: ${+c}px;\n `);let g;return null!=i?(g=`\n .${f}-swatch {\n display: flex;\n align-items: center;\n break-inside: avoid;\n padding-bottom: 1px;\n }\n .${f}-swatch::before {\n flex-shrink: 0;\n }\n .${f}-label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `,m.style("columns",i).selectAll().data(t.domain).enter().append("div").attr("class",`${f}-swatch`).call(n,t).call((t=>t.append("div").attr("class",`${f}-label`).attr("title",o).text(o)))):(g=`\n .${f} {\n display: flex;\n align-items: center;\n min-height: 33px;\n flex-wrap: wrap;\n }\n .${f}-swatch {\n display: inline-flex;\n align-items: center;\n margin-right: 1em;\n }\n `,m.selectAll().data(t.domain).enter().append("span").attr("class",`${f}-swatch`).call(n,t).append((function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))}))),m.call((t=>t.insert("style","*").text(`\n .${f} {\n font-family: system-ui, sans-serif;\n font-size: 10px;\n margin-bottom: 0.5em;${void 0===u?"":`\n margin-left: ${+u}px;`}${void 0===d?"":`\n width: ${d}px;`}\n }\n ${r(f)}\n ${g}\n `))).style("font-variant",Ve(a,"normal")).call(Je,h).node()}const Hr=new Map([["symbol",function(t,{fill:n=(void 0!==t.hint?.fill?t.hint.fill:"none"),fillOpacity:r=1,stroke:i=(void 0!==t.hint?.stroke?t.hint.stroke:et(n)?"currentColor":"none"),strokeOpacity:o=1,strokeWidth:a=1.5,r:s=4.5,...l}={},c){const[u,f]=b(n),[h,d]=b(i),p=Ur(c,u),m=Ur(c,h),g=s*s*Math.PI;return r=k(r)[1],o=k(o)[1],a=k(a)[1],Vr(t,l,(n=>n.append("svg").attr("viewBox","-8 -8 16 16").attr("fill","color"===u?t=>p.scale(t):null).attr("stroke","color"===h?t=>m.scale(t):null).append("path").attr("d",(n=>{const r=e.path();return t.scale(n).draw(r,g),r}))),(t=>`.${t}-swatch > svg {\n width: var(--swatchWidth);\n height: var(--swatchHeight);\n margin-right: 0.5em;\n overflow: visible;\n fill: ${f};\n fill-opacity: ${r};\n stroke: ${d};\n stroke-width: ${a}px;\n stroke-opacity: ${o};\n }`))}],["color",Qr],["opacity",function({type:t,interpolate:n,...r},{legend:i=!0,color:o=e.rgb(0,0,0),...a}){if(!n)throw new Error(`${t} opacity scales are not supported`);!0===i&&(i="ramp");if("ramp"!==`${i}`.toLowerCase())throw new Error(`${i} opacity legends are not supported`);return Qr({type:t,...r,interpolate:Jr(o)},{legend:i,...a})}]]);function Zr(t,{label:e,ticks:n,tickFormat:r}={},i){return function(t={},...e){let n=t;for(const r of e)for(const e in r)if(void 0===n[e]){const i=r[e];n===t?n={...n,[e]:i}:n[e]=i}return n}(i,t,{label:e,ticks:n,tickFormat:r})}function Qr(t,{legend:n=!0,...r}){if(!0===n&&(n="ordinal"===t.type?"swatches":"ramp"),void 0!==t.domain)switch(`${n}`.toLowerCase()){case"swatches":return function(t,e){if(!sr(t)&&!lr(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return Vr(t,e,((t,e)=>t.append("svg").attr("fill",e.scale).append("rect").attr("width","100%").attr("height","100%")),(t=>`.${t}-swatch svg {\n width: var(--swatchWidth);\n height: var(--swatchHeight);\n margin-right: 0.5em;\n }`))}(t,r);case"ramp":return function(t,n){let{label:r=t.label,tickSize:i=6,width:o=240,height:a=44+i,marginTop:s=18,marginRight:l=0,marginBottom:c=16+i,marginLeft:u=0,style:f,ticks:h=(o-u-l)/64,tickFormat:d,fontVariant:p=Gr(t),round:m=!0,className:g}=n;const y=Or(n);g=Qe(g),null===d&&(d=()=>null);const v=Cr("svg",y).attr("class",g).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",a).attr("viewBox",`0 0 ${o} ${a}`).call((t=>t.append("style").text(`\n .${g} {\n display: block;\n background: white;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n overflow: visible;\n }\n .${g} text {\n white-space: pre;\n }\n `))).call(Je,f);let x,w=t=>t.selectAll(".tick line").attr("y1",s+c-a);const b=m?(t,e)=>t.rangeRound(e):(t,e)=>t.range(e),{type:k,domain:$,range:M,interpolate:L,scale:z,pivot:R}=t;if(L){const t=void 0===M?L:e.piecewise(1===L.length?Rn(L):L,M);x=b(z.copy(),e.quantize(e.interpolateNumber(u,o-l),Math.min($.length+(void 0!==R),void 0===M?1/0:M.length)));const n=256,r=y.document.createElement("canvas");r.width=n,r.height=1;const i=r.getContext("2d");for(let e=0,r=n-1;et:"string"==typeof d?e.format(d):d;x=b(e.scaleLinear().domain([-1,M.length-1]),[u,o-l]),v.append("g").selectAll().data(M).enter().append("rect").attr("x",((t,e)=>x(e-1))).attr("y",s).attr("width",((t,e)=>x(e)-x(e-1))).attr("height",a-s-c).attr("fill",(t=>t)),h=A(t,((t,e)=>e)),d=e=>n(t[e],e)}else x=b(e.scaleBand().domain($),[u,o-l]),v.append("g").selectAll().data($).enter().append("rect").attr("x",x).attr("y",s).attr("width",Math.max(0,x.bandwidth()-1)).attr("height",a-s-c).attr("fill",z),w=()=>{};return v.append("g").attr("transform",`translate(0,${a-c})`).call(e.axisBottom(x).ticks(Array.isArray(h)?null:h,"string"==typeof d?d:void 0).tickFormat("function"==typeof d?d:void 0).tickSize(i).tickValues(Array.isArray(h)?h:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Ve(p,"normal")).call(w).call((t=>t.select(".domain").remove())),void 0!==r&&v.append("text").attr("x",u).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),v.node()}(t,r);default:throw new Error(`unknown legend type: ${n}`)}}function Jr(t){const{r:n,g:r,b:i}=e.rgb(t)||e.rgb(0,0,0);return t=>`rgba(${n},${r},${i},${t})`}function Kr(t={}){const{facet:n,style:r,caption:i,ariaLabel:o,ariaDescription:a}=t,s=Qe(t.className),l=void 0===t.marks?[]:t.marks.flat(1/0).map(ni),c=function(t,e){if(null==t)return;const{x:n,y:r}=t;if(null==n&&null==r)return;const i=L(t.data);if(null==i)throw new Error("missing facet data");const o={};null!=n&&(o.fx=ae(i,{value:n,scale:"fx"}));null!=r&&(o.fy=ae(i,{value:r,scale:"fy"}));ii(o,e);const a=li(i,o),s=a.size>1||o.fx&&o.fy&&1===a.size&&[...a][0][1].size>1?i.length:void 0;return{channels:o,groups:a,data:t.data,dataLength:s}}(n,t),u=new Map;for(const e of l){const n=fi(e,c,t);n&&u.set(e,n)}const f=new Map;c&&ai(f,[c]),ai(f,u);let h=function(t,n){const{fx:r,fy:i}=Hn(t,n),o=r?.scale.domain(),a=i?.scale.domain();return o&&a?e.cross(o,a).map((([t,e])=>({x:t,y:e}))):o?o.map((t=>({x:t}))):a?a.map((t=>({y:t}))):void 0}(f,t);if(void 0!==h){const t=c?hi(h,c):void 0;for(const e of l){if(null===e.facet)continue;const n=u.get(e);void 0!==n&&(n.facetsIndex=null!=e.fx||null!=e.fy?hi(h,n):t)}const e=new Set;for(const{facetsIndex:t}of u.values())t?.forEach(((t,n)=>{t?.length>0&&e.add(n)}));if(0e.has(n)));for(const t of u.values()){const{facetsIndex:n}=t;n&&(t.facetsIndex=n.filter(((t,n)=>e.has(n))))}}for(const t of l)if("exclude"===t.facet){const e=u.get(t);e.facetsIndex=ui(e.facetsIndex)}}for(const e of ht.keys())C(t[e])&&"fx"!==e&&"fy"!==e&&f.set(e,[]);const d=new Map;for(const e of l){if(d.has(e))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:n,channels:r}=u.get(e)||{},{data:i,facets:o,channels:a}=e.initialize(n,r);ii(a,t),d.set(e,{data:i,facets:o,channels:a})}const p=Hn(ai(f,d),t),m=Zn(p),g=function({x:t,y:e,fx:n,fy:r},{x:i={},y:o={},fx:a={},fy:s={},axis:l=!0,grid:c,line:u,label:f,facet:{axis:h=l,grid:d,label:p=f}={}}={}){let{axis:m=l}=i,{axis:g=l}=o,{axis:y=h}=a,{axis:v=h}=s;return t?!0===m&&(m="bottom"):m=null,e?!0===g&&(g="left"):g=null,n?!0===y&&(y="bottom"===m?"top":"bottom"):y=null,r?!0===v&&(v="left"===g?"right":"left"):v=null,{...m&&{x:new Er({grid:c,line:u,label:f,fontVariant:Gr(t),...i,axis:m})},...g&&{y:new Nr({grid:c,line:u,label:f,fontVariant:Gr(e),...o,axis:g})},...y&&{fx:new Er({name:"fx",grid:d,label:p,fontVariant:Gr(n),...a,axis:y})},...v&&{fy:new Nr({name:"fy",grid:d,label:p,fontVariant:Gr(r),...s,axis:v})}}}(p,t),y=function(t,e,n,r={}){const{x:{axis:i}={},y:{axis:o}={},fx:{axis:a}={},fy:{axis:s}={}}=n;let{facet:{margin:l,marginTop:c=(void 0!==l?l:"top"===a?30:0),marginRight:u=(void 0!==l?l:"right"===s?40:0),marginBottom:f=(void 0!==l?l:"bottom"===a?30:0),marginLeft:h=(void 0!==l?l:"left"===s?40:0)}={}}=r;c=+c,u=+u,f=+f,h=+h;const d=Math.max(("top"===i?30:0)+c,o||s?20:.5-Ne),p=Math.max(("bottom"===i?30:0)+f,o||s?20:.5+Ne),m=Math.max(("right"===o?40:0)+u,i||a?20:.5+Ne),g=Math.max(("left"===o?40:0)+h,i||a?20:.5-Ne);let{margin:y,marginTop:v=(void 0!==y?y:d),marginRight:x=(void 0!==y?y:m),marginBottom:w=(void 0!==y?y:p),marginLeft:b=(void 0!==y?y:g)}=r;v=+v,x=+x,w=+w,b=+b;let{width:k=640,height:$=Xr(t,e,r,{width:k,marginTopDefault:d,marginBottomDefault:p,marginRightDefault:m,marginLeftDefault:g})+Math.max(0,v-d+w-p)}=r;return k=+k,$=+$,{width:k,height:$,marginTop:v,marginRight:x,marginBottom:w,marginLeft:b,facetMarginTop:c,facetMarginRight:u,facetMarginBottom:f,facetMarginLeft:h}}(p,function(t){for(const{channels:e}of t.values())if(e.geometry)return!0;return!1}(d),g,t);!function({x:t,y:e,fx:n,fy:r},i){n&&Qn(n,i),r&&Jn(r,i),t&&Qn(t,n?{width:n.scale.bandwidth()}:i),e&&Jn(e,r?{height:r.scale.bandwidth()}:i)}(p,y),function({x:t,y:e,fx:n,fy:r},{x:i,y:o,fx:a,fy:s}){a&&Wr(n,a,80),s&&Wr(r,s,35),i&&Wr(t,i,80),o&&Wr(e,o,35)}(p,g);const{fx:v,fy:x}=m,w=x&&{marginTop:0,marginBottom:0,height:x.bandwidth()},b=v&&{marginRight:0,marginLeft:0,width:v.bandwidth()},k={...y,...b,...w},$=Or(t,k),M=new Set;for(const[e,n]of d)if(null!=e.initializer){const{facets:r,channels:i}=e.initializer(n.data,n.facets,n.channels,m,k,$);if(void 0!==r&&(n.facets=r),void 0!==i){oi(i),ii(i,t),Object.assign(n.channels,i);for(const{scale:t}of Object.values(i))null!=t&&M.add(t)}}if(M.size){for(const t of M)if(ht.get(t)===at)throw new Error(`initializers cannot declare position scales: ${t}`);const e=Hn(ai(new Map,d,(t=>M.has(t))),t),n=Zn(e);Object.assign(p,e),Object.assign(m,n)}!function(t,e,{x:n,y:r,fx:i,fy:o},a,s){if(i&&(Yr(i,e.fx,t.get("fx")),void 0===i.labelOffset)){const{facetMarginTop:t,facetMarginBottom:e}=a;i.labelOffset="top"===i.axis?t:e}if(o&&(Ir(o,i,e.fy,t.get("fy")),void 0===o.labelOffset)){const{facetMarginLeft:t,facetMarginRight:e}=a;o.labelOffset="left"===o.axis?t:e}if(n&&(Yr(n,e.x,t.get("x")),void 0===n.labelOffset)){const{marginTop:t,marginBottom:e,facetMarginTop:r,facetMarginBottom:i}=a;n.labelOffset="top"===n.axis?t-r:e-i}if(r&&(Ir(r,n,e.y,t.get("y")),void 0===r.labelOffset)){const{marginRight:t,marginLeft:e,facetMarginLeft:n,facetMarginRight:i}=a;r.labelOffset="left"===r.axis?e-n:t-i}for(const[n,r]of ht)r!==at&&e[n]&&Fr(n,e[n],t.get(n),s[n])}(f,p,g,y,t);for(const t of d.values())t.values=se(t.channels,m);if($.projection)for(const[t,e]of d)t.project(e.channels,e.values,$);const{width:A,height:z}=y,R=Cr("svg",$).attr("class",s).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",A).attr("height",z).attr("viewBox",`0 0 ${A} ${z}`).attr("aria-label",o).attr("aria-description",a).call((t=>t.append("style").text(`\n .${s} {\n display: block;\n background: white;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n }\n .${s} text,\n .${s} tspan {\n white-space: pre;\n }\n `))).call(Je,r).node(),O=g[void 0!==h&&x?"fy":"y"],B=g[void 0!==h&&v?"fx":"x"];if(O&&R.appendChild(O.render(null,m,y,$)),B&&R.appendChild(B.render(null,m,y,$)),void 0!==h){const t=v?.domain(),n=x?.domain(),r=e.select(R),i=v&&x&&(g.x||g.y)?e.group(h,(({x:t})=>t),(({y:t})=>t)):void 0;if(x&&g.y){const e=g.y,o=si(e),a="bottom"===e.labelAnchor?n.length-1:"center"===e.labelAnchor?n.length>>1:0;r.selectAll().data(n).enter().append(((n,r)=>(r===a?e:o).render(v&&D(t,(t=>i.get(t).has(n))),m,{...y,...w,offsetTop:x(n)},$)))}if(v&&g.x){const e=g.x,o=si(e),a="right"===e.labelAnchor?t.length-1:"center"===e.labelAnchor?t.length>>1:0,{marginLeft:s,marginRight:l}=y;r.selectAll().data(t).enter().append(((t,r)=>(r===a?e:o).render(x&&D(n,(e=>i.get(t).has(e))),m,{...y,...b,labelMarginLeft:s,labelMarginRight:l,offsetLeft:v(t)},$)))}const o=new Map(h.map(((t,e)=>[t,e])));r.selectAll().data(function(t,n,r){const i=n&&new e.InternMap(n.domain().map(((t,e)=>[t,e]))),o=r&&new e.InternMap(r.domain().map(((t,e)=>[t,e])));return e.sort(t,((t,e)=>i&&i.get(t.x)-i.get(e.x)||o&&o.get(t.y)-o.get(e.y)))}(h,v,x)).enter().append("g").attr("aria-label","facet").attr("transform",function(t,e){return t&&e?({x:n,y:r})=>`translate(${t(n)},${e(r)})`:t?({x:e})=>`translate(${t(e)},0)`:({y:t})=>`translate(0,${e(t)})`}(v,x)).each((function(t){for(const[e,{channels:n,values:r,facets:i}]of d){let a=null;if(i){if(a=i[o.get(t)]??i[0],!a)continue;a=e.filter(a,n,r)}const s=e.render(a,m,r,k,$);null!=s&&this.appendChild(s)}}))}else for(const[t,{channels:e,values:n,facets:r}]of d){let i=null;if(r){if(i=r[0],!i)continue;i=t.filter(i,e,n)}const o=t.render(i,m,n,y,$);null!=o&&R.appendChild(o)}let E=R;const N=function(t,e,n){const r=[];for(const[i,o]of Hr){const a=n[i];if(a?.legend&&i in t){const n=o(t[i],Zr(e,t[i],a),(e=>t[e]));null!=n&&r.push(n)}}return r}(p,$,t);if(null!=i||N.length>0){const{document:t}=$;E=t.createElement("figure"),E.style.maxWidth="initial";for(const t of N)E.appendChild(t);if(E.appendChild(R),null!=i){const e=t.createElement("figcaption");e.appendChild(i instanceof Node?i:t.createTextNode(i)),E.appendChild(e)}}E.scale=function(t){return e=>{if(!ht.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return e in t?yr(t[e]):void 0}}(p),E.legend=function(t,e,n={}){return(r,i)=>{if(!Hr.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return Hr.get(r)(t[r],Zr(e,n[r],i),(e=>t[e]))}}(p,$,t);const S=function(){const t=Be;return Be=0,t}();return S>0&&e.select(R).append("text").attr("x",A).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${S.toLocaleString("en-US")} warning${1===S?"":"s"}. Please check the console.`),E}class ti{constructor(t,e={},n={},r){const{facet:i="auto",fx:o,fy:a,sort:s,dx:l,dy:c,clip:u,channels:f}=n;this.data=t,this.sort=E(s)?s:null,this.initializer=bt(n).initializer,this.transform=this.initializer?n.transform:wt(n).transform,null===i||!1===i?this.facet=null:(this.facet=M(!0===i?"include":i,"facet",["auto","include","exclude"]),this.fx=o,this.fy=a),e=ot(e),void 0!==f&&(e={...ot(f),...e}),void 0!==r&&(e={...Te(this,n,r),...e}),this.channels=Object.fromEntries(Object.entries(e).filter((([t,{value:e,optional:n}])=>{if(null!=e)return!0;if(n)return!1;throw new Error(`missing channel value: ${t}`)}))),this.dx=+l||0,this.dy=+c||0,this.clip=function(t){return!0===t?t="frame":!1===t&&(t=null),$(t,"clip",["frame","sphere"])}(u)}initialize(t,n){let r=L(this.data);void 0===t&&null!=r&&(t=[T(r)]),null!=this.transform&&(({facets:t,data:r}=this.transform(r,t)),r=L(r));const i=function(t,e){return Object.fromEntries(Object.entries(t).map((([t,n])=>[t,ae(e,n)])))}(this.channels,r);return null!=this.sort&&function(t,n,r,i){const{reverse:o,reduce:a=!0,limit:s}=i;for(const l in i){if(!ht.has(l))continue;let{value:c,reverse:u=o,reduce:f=a,limit:h=s}=G(i[l]);if(void 0===u&&(u="width"===c||"height"===c),null==f||!1===f)continue;const d=le(t,l)||n&&le(n,l);if(!d)throw new Error(`missing channel for scale: ${l}`);const p=d.value,[m=0,g=1/0]=X(h)?h:h<0?[h]:[0,h];if(null==c)d.domain=()=>{let t=p;return u&&(t=t.slice().reverse()),0===m&&g===1/0||(t=t.slice(m,g)),t};else{const n="data"===c?r:"height"===c?ce(t,"y1","y2"):"width"===c?ce(t,"x1","x2"):ue(t,c,"y"===c?"y2":"x"===c?"x2":void 0),i=Wt(!0===f?"max":f,n);d.domain=()=>{let t=e.rollup(T(p),(t=>i.reduce(t,n)),(t=>p[t]));return t=e.sort(t,u?he:fe),0===m&&g===1/0||(t=t.slice(m,g)),t.map(y)}}}}(i,n,r,this.sort),{data:r,facets:t,channels:i}}filter(t,e,n){for(const r in e){const{filter:i=dt}=e[r];if(null!==i){const e=n[r];t=t.filter((t=>i(e[t])))}}return t}project(t,e,n){zr("x","y",t,e,n),zr("x1","y1",t,e,n),zr("x2","y2",t,e,n)}plot({marks:t=[],...e}={}){return Kr({...e,marks:[...t,this]})}}function ei(...t){return t.plot=ti.prototype.plot,t}function ni(t){return"function"==typeof t?.render?t:new ri(t)}class ri extends ti{constructor(t){if(super(),null!=t){if("function"!=typeof t)throw new TypeError("invalid mark; missing render function");this.render=t}}render(){}}function ii(t,e){for(const n in t){const r=t[n],{scale:i}=r;if(null!=i){const{percent:t,interval:n,transform:o=(t?t=>100*t:rn(n)?.floor)}=e[i]||{};null!=o&&(r.value=A(r.value,o))}}return t}function oi(t){for(const e in t){const n=t[e];let{scale:r}=n;if(!0===r){switch(e){case"fill":case"stroke":r="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":r="opacity";break;default:r=ht.has(e)?e:null}n.scale=r}}}function ai(t,e,n=d){for(const{channels:r}of e.values())for(const e in r){const i=r[e],{scale:o}=i;if(null!=o&&n(o)){const e=t.get(o);void 0!==e?e.push(i):t.set(o,[i])}}return t}function si(t){return void 0===t||void 0===t.label?t:Object.assign(Object.create(t),{label:void 0})}function li(t,{fx:n,fy:r}){const i=T(t);return n&&r?function(t,{value:n},{value:r}){return e.group(t,(t=>n[t]),(t=>r[t]))}(i,n,r):ci(i,n||r)}function ci(t,{value:n}){return e.group(t,(t=>n[t]))}function ui(t){const n=[],r=new Uint32Array(e.sum(t,(t=>t.length)));for(const e of t){let i=0;for(const n of t)e!==n&&(r.set(n,i),i+=n.length);n.push(r.slice(0,i))}return n}function fi(t,e,n){if(null===t.facet)return;const{fx:r,fy:i}=t;if(null!=r||null!=i){const e=L(t.data);if(null==e)throw new Error(`missing facet data in ${t.ariaLabel}`);const o={};return null!=r&&(o.fx=ae(e,{value:r,scale:"fx"})),null!=i&&(o.fy=ae(e,{value:i,scale:"fy"})),ii(o,n),{channels:o,groups:li(e,o)}}if(void 0===e)return;const{channels:o,groups:a,data:s,dataLength:l}=e;if("auto"!==t.facet||t.data===s)return{channels:o,groups:a};void 0!==l&&L(t.data)?.length===l&&Ee(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isn’t 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 hi(t,{channels:{fx:e,fy:n},groups:r}){return e&&n?t.map((({x:t,y:e})=>r.get(t)?.get(e))):e?t.map((({x:t})=>r.get(t))):t.map((({y:t})=>r.get(t)))}const di=new Map([["basis",e.curveBasis],["basis-closed",e.curveBasisClosed],["basis-open",e.curveBasisOpen],["bundle",e.curveBundle],["bump-x",e.curveBumpX],["bump-y",e.curveBumpY],["cardinal",e.curveCardinal],["cardinal-closed",e.curveCardinalClosed],["cardinal-open",e.curveCardinalOpen],["catmull-rom",e.curveCatmullRom],["catmull-rom-closed",e.curveCatmullRomClosed],["catmull-rom-open",e.curveCatmullRomOpen],["linear",e.curveLinear],["linear-closed",e.curveLinearClosed],["monotone-x",e.curveMonotoneX],["monotone-y",e.curveMonotoneY],["natural",e.curveNatural],["step",e.curveStep],["step-after",e.curveStepAfter],["step-before",e.curveStepBefore]]);function pi(t=e.curveLinear,n){if("function"==typeof t)return t;const r=di.get(`${t}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${t}`);if(void 0!==n){if("beta"in r)return r.beta(n);if("tension"in r)return r.tension(n);if("alpha"in r)return r.alpha(n)}return r}function mi(t={y:"count"},e={}){[t,e]=bi(t,e);const{x:n,y:r}=e;return wi(ki(n,e,f),null,null,r,t,tn(e))}function gi(t={x:"count"},e={}){[t,e]=bi(t,e);const{x:n,y:r}=e;return wi(null,ki(r,e,f),n,null,t,en(e))}function yi(t,e,n={}){return null==n?.interval?n:t({[e]:void 0===n?.reduce?Xt:n.reduce,filter:null},n)}function vi(t){return yi(mi,"y",t)}function xi(t){return yi(gi,"x",t)}function wi(t,e,n,r,{data:i=Gt,filter:o=Ht,sort:a,reverse:s,...c}={},u={}){t=$i(t),e=$i(e),c=Tt(c,u),i=Wt(i,f),a=null==a?void 0:Dt("sort",a,u),o=null==o?void 0:jt("filter",o,u),null!=n&&Pt(c,"x","x1","x2")&&(n=null),null!=r&&Pt(c,"y","y1","y2")&&(r=null);const[h,d]=I(t),[p,m]=I(t),[g,y]=I(e),[v,x]=I(e),[w,k]=null!=n?[n,"x"]:null!=r?[r,"y"]:[],[$,M]=I(w),{x:L,y:A,z:z,fill:R,stroke:O,x1:C,x2:B,y1:E,y2:N,domain:S,cumulative:P,thresholds:T,interval:D,...j}=u,[q,W]=I(z),[Y]=b(R),[F]=b(O),[G,X]=I(Y),[U,V]=I(F);return{..."z"in u&&{z:q||z},..."fill"in u&&{fill:G||R},..."stroke"in u&&{stroke:U||O},...wt(j,((n,r)=>{const u=l(n,w),f=l(n,z),h=l(n,Y),p=l(n,F),g=Yt(c,{z:f,fill:h,stroke:p}),v=[],b=[],k=u&&M([]),$=f&&W([]),L=h&&X([]),A=p&&V([]),R=t?t(n):[[,,t=>t]],O=e?e(n):[[,,t=>t]],C=t&&d([]),B=t&&m([]),E=e&&y([]),N=e&&x([]);let S=0;for(const t of c)t.initialize(n);a&&a.initialize(n),o&&o.initialize(n);for(const t of r){const e=[];for(const e of c)e.scope("facet",t);a&&a.scope("facet",t),o&&o.scope("facet",t);for(const[r,s]of qt(t,g))for(const[t,l]of qt(s,u))for(const[s,d,m]of R){const y=m(l);for(const[l,m,v]of O){const x={x1:s,x2:d,y1:l,y2:m},w=v(y);if(!o||o.reduce(w,x)){e.push(S++),b.push(i.reduce(w,n,x)),u&&k.push(t),f&&$.push(g===f?r:f[w[0]]),h&&L.push(g===h?r:h[w[0]]),p&&A.push(g===p?r:p[w[0]]),C&&(C.push(s),B.push(d)),E&&(E.push(l),N.push(m));for(const t of c)t.reduce(w,x);a&&a.reduce(w)}}}v.push(e)}return It(v,a,s),{data:b,facets:v}})),...!Pt(c,"x")&&(h?{x1:h,x2:p,x:_(h,p)}:{x:L,x1:C,x2:B}),...!Pt(c,"y")&&(g?{y1:g,y2:v,y:_(g,v)}:{y:A,y1:E,y2:N}),...$&&{[k]:$},...Object.fromEntries(c.map((({name:t,output:e})=>[t,e])))}}function bi({cumulative:t,domain:e,thresholds:n,interval:r,...i},o){return[i,{cumulative:t,domain:e,thresholds:n,interval:r,...o}]}function ki(t,{cumulative:n,domain:r,thresholds:i,interval:o},a){return void 0===(t={...G(t)}).domain&&(t.domain=r),void 0===t.cumulative&&(t.cumulative=n),void 0===t.thresholds&&(t.thresholds=i),void 0===t.interval&&(t.interval=o),void 0===t.value&&(t.value=a),t.thresholds=function(t,n){if(void 0===t)return void 0===n?Mi:function(t){if(t=rn(t),!Li(t))throw new Error(`invalid interval: ${t}`);return t}(n);if("string"==typeof t){switch(t.toLowerCase()){case"freedman-diaconis":return e.thresholdFreedmanDiaconis;case"scott":return e.thresholdScott;case"sturges":return e.thresholdSturges;case"auto":return Mi}throw new Error(`invalid thresholds: ${t}`)}return t}(t.thresholds,t.interval),t}function $i(t){if(null==t)return;const{value:n,cumulative:r,domain:i=e.extent,thresholds:o}=t,a=t=>{let a=l(t,n,Array);const s=e.bin().value((t=>a[t]));if(H(a)||(function(t){return Li(t)&&"function"==typeof t&&t()instanceof Date}(c=o)||X(c)&&H(c))){a=a.map(gr);let[t,n]="function"==typeof i?i(a):i,r="function"!=typeof o||Li(o)?o:o(a,t,n);"number"==typeof r&&(r=e.utcTickInterval(t,n,r)),Li(r)&&(i===e.extent&&(t=r.floor(t),n=r.ceil(new Date(+n+1))),r=r.range(t,n)),s.thresholds(r).domain([t,n])}else{a=a.map(mr);let t=i,n=o;if(Li(n)){let[r,i]="function"==typeof t?t(a):t;t===e.extent&&(r=n.floor(r),i=n.offset(n.floor(i)),t=[r,i]),n=n.range(r,i)}s.thresholds(n).domain(t)}var c;let u=s(T(t)).map(Ai);return r&&(u=(r<0?u.reverse():u).map(zi)),u.map(Ri)};return a.label=F(n),a}function Mi(t,n,r){return Math.min(200,e.thresholdScott(t,n,r))}function Li(t){return!!t&&"function"==typeof t.range}function Ai(t){return[t,new Set(t)]}function zi([t],e,n){return[t,{get size(){for(let t=0;t<=e;++t)if(n[t][1].size)return 1;return 0},has(t){for(let r=0;r<=e;++r)if(n[r][1].has(t))return!0;return!1}}]}function Ri([{x0:t,x1:e},n]){return[t,e,n.size?t=>t.filter(n.has,n):Oi]}function Oi(){return new Uint32Array(0)}function Ci(t={}){const{x:e,x1:n,x2:r}=t;return void 0===n&&void 0===r&&void 0===e?{...t,x:f}:t}function Bi(t={}){const{y:e,y1:n,y2:r}=t;return void 0===n&&void 0===r&&void 0===e?{...t,y:f}:t}function Ei(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{y1:n,y:r=n,x:i,...o}=e,[a,s,l,c]=Di(r,i,"x",t,o);return{...a,y1:n,y:s,x1:l,x2:c,x:_(l,c)}}function Ni(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{x1:n,x:r=n,y:i,...o}=e,[a,s,l,c]=Di(r,i,"y",t,o);return{...a,x1:n,x:s,y1:l,y2:c,y:_(l,c)}}function Si({x:t,x1:e,x2:n,...r}={}){return void 0===e&&void 0===n?Ei({x:t,...r}):([e,n]=N(t,e,n),{...r,x1:e,x2:n})}function Pi({y:t,y1:e,y2:n,...r}={}){return void 0===e&&void 0===n?Ni({y:t,...r}):([e,n]=N(t,e,n),{...r,y1:e,y2:n})}function Ti(t){const{offset:e,order:n,reverse:r,...i}=t;return[{offset:e,order:n,reverse:r},i]}const Di=function(t,n=h,r,{offset:i,order:o,reverse:a},s){const u=P(s),[f,d]=I(t),[p,m]=Y(n),[g,y]=Y(n);return i=function(t){if(null==t)return;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return qi;case"center":case"silhouette":return Wi;case"wiggle":return Yi}throw new Error(`unknown offset: ${t}`)}(i),o=function(t,e,n){if(void 0===t&&e===Yi)return Vi;if(null==t)return;if("string"==typeof t){switch(t.toLowerCase()){case"value":case n:return _i;case"z":return Gi;case"sum":return Xi;case"appearance":return Ui;case"inside-out":return Vi}return Hi(c(t))}if("function"==typeof t)return Hi(t);if(Array.isArray(t))return r=t,(t,e,n,i)=>Zi(i,r);var r;throw new Error(`invalid order: ${t}`)}(o,i,r),[wt(s,((r,s)=>{const c=null==t?void 0:d(l(r,t)),f=l(r,n,Float64Array),h=l(r,u),p=o&&o(r,c,f,h),g=r.length,v=m(new Float64Array(g)),x=y(new Float64Array(g)),w=[];for(const t of s){const n=c?Array.from(e.group(t,(t=>c[t])).values()):[t];p&&Qi(n,p);for(const t of n){let e=0,n=0;a&&t.reverse();for(const r of t){const t=f[r];t<0?e=x[r]=(v[r]=e)+t:t>0?n=x[r]=(v[r]=n)+t:x[r]=v[r]=n}}w.push(n)}return i&&i(w,v,x,h),{data:r,facets:s}})),f,p,g]};function ji(t,e){let n=0,r=0;for(const i of t){const t=e[i];tr&&(r=t)}return[n,r]}function qi(t,e,n){for(const r of t)for(const t of r){const[r,i]=ji(t,n);for(const o of t){const t=1/(i-r||1);e[o]=t*(e[o]-r),n[o]=t*(n[o]-r)}}}function Wi(t,e,n){for(const r of t){for(const t of r){const[r,i]=ji(t,n);for(const o of t){const t=(i+r)/2;e[o]-=t,n[o]-=t}}Ii(r,e,n)}Fi(t,e,n)}function Yi(t,n,r,i){for(const o of t){const t=new e.InternMap;let a=0;for(const s of o){let o=-1;const l=s.map((t=>Math.abs(r[t]-n[t]))),c=s.map((e=>{o=i?i[e]:++o;const a=r[e]-n[e],s=t.has(o)?a-t.get(o):0;return t.set(o,a),s})),u=[0,...e.cumsum(c)];for(const t of s)n[t]+=a,r[t]+=a;const f=e.sum(l);f&&(a-=e.sum(l,((t,e)=>(c[e]/2+u[e])*t))/f)}Ii(o,n,r)}Fi(t,n,r)}function Ii(t,n,r){const i=e.min(t,(t=>e.min(t,(t=>n[t]))));for(const e of t)for(const t of e)n[t]-=i,r[t]-=i}function Fi(t,n,r){const i=t.length;if(1===i)return;const o=t.map((t=>t.flat())),a=o.map((t=>(e.min(t,(t=>n[t]))+e.max(t,(t=>r[t])))/2)),s=e.min(a);for(let t=0;te.sum(t,(t=>r[t]))),(t=>i[t])))}function Ui(t,n,r,i){return Zi(i,e.groupSort(T(t),(t=>n[e.greatest(t,(t=>r[t]))]),(t=>i[t])))}function Vi(t,n,r,i){const o=T(t),a=e.groupSort(o,(t=>n[e.greatest(t,(t=>r[t]))]),(t=>i[t])),s=e.rollup(o,(t=>e.sum(t,(t=>r[t]))),(t=>i[t])),l=[],c=[];let u=0;for(const t of a)u<0?(u+=s.get(t),l.push(t)):(u-=s.get(t),c.push(t));return Zi(i,c.reverse().concat(l))}function Hi(t){return e=>l(e,t)}function Zi(t,n){return n=new e.InternMap(n.map(((t,e)=>[t,e]))),t.map((t=>n.get(t)))}function Qi(t,e){for(const n of t)n.sort(((t,n)=>pt(e[t],e[n])))}const Ji={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Ki extends ti{constructor(t,e={}){const{x1:n,y1:r,x2:i,y2:o,z:a,curve:s,tension:l}=e;super(t,{x1:{value:n,scale:"x"},y1:{value:r,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0},z:{value:P(e),optional:!0}},e,Ji),this.z=a,this.curve=pi(s,l)}filter(t){return t}render(t,n,r,i,o){const{x1:a,y1:s,x2:l=a,y2:c=s}=r;return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,n,0,0).call((n=>n.selectAll().data(Ie(t,[a,s,l,c],this,r)).enter().append("path").call(_e,this).call(We,this,r).attr("d",e.area().curve(this.curve).defined((t=>t>=0)).x0((t=>a[t])).y0((t=>s[t])).x1((t=>l[t])).y1((t=>c[t]))))).node()}}function to(t,e){const{x:n=u,...r}=vi(e);return new Ki(t,Pi(Bi({...r,x1:n,x2:void 0})))}function eo(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:i=e}={}){t.markerStart=no(n),t.markerMid=no(r),t.markerEnd=no(i)}function no(t){if(null==t||!1===t)return null;if(!0===t)return oo;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return ro;case"dot":return io;case"circle":case"circle-fill":return oo;case"circle-stroke":return ao}throw new Error(`invalid marker: ${t}`)}function ro(t,e){return Cr("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient","auto").attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call((t=>t.append("path").attr("d","M-1.5,-3l3,3l-3,3"))).node()}function io(t,e){return Cr("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call((t=>t.append("circle").attr("r",2.5))).node()}function oo(t,e){return Cr("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","white").attr("stroke-width",1.5).call((t=>t.append("circle").attr("r",3))).node()}function ao(t,e){return Cr("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","white").attr("stroke",t).attr("stroke-width",1.5).call((t=>t.append("circle").attr("r",3))).node()}let so=0;function lo(t,e,{stroke:n}={}){return uo(t,e,n&&(t=>n[t]))}function co(t,e,{stroke:n}={}){return uo(t,e,n&&(([t])=>n[t]))}function uo(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:i},o=(()=>i)){const a=new Map;function s(t){return function(e){const n=o(e);let r=a.get(t);r||a.set(t,r=new Map);let i=r.get(n);if(!i){const e={document:this.ownerDocument},o=this.parentNode.insertBefore(t(n,e),this),a="plot-marker-"+ ++so;o.setAttribute("id",a),r.set(n,i=`url(#${a})`)}return i}}e&&t.attr("marker-start",s(e)),n&&t.attr("marker-mid",s(n)),r&&t.attr("marker-end",s(r))}const fo={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class ho extends ti{constructor(t,e={}){const{x1:n,y1:r,x2:i,y2:o,curve:a,tension:s}=e;super(t,{x1:{value:n,scale:"x"},y1:{value:r,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},e,fo),this.curve=pi(a,s),eo(this,e)}render(t,n,r,i,o){const{x1:a,y1:s,x2:l=a,y2:c=s}=r,{curve:u}=this;return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,n).call((n=>n.selectAll().data(t).enter().append("path").call(_e,this).attr("d",(t=>{const n=e.path(),r=u(n);return r.lineStart(),r.point(a[t],s[t]),r.point(l[t],c[t]),r.lineEnd(),n})).call(qe,this,r).call(lo,this,r))).node()}}function po(t,e={}){let{x:n,x1:r,x2:i,y:o,y1:a,y2:s,...l}=e;return[r,i]=mo(n,r,i),[a,s]=mo(o,a,s),new ho(t,{...l,x1:r,x2:i,y1:a,y2:s})}function mo(t,e,n){if(void 0===t){if(void 0===e){if(void 0!==n)return[n]}else if(void 0===n)return[e]}else{if(void 0===e)return void 0===n?[t]:[t,n];if(void 0===n)return[t,e]}return[e,n]}const go={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class yo extends ti{constructor(t,e={}){const{x1:n,y1:r,x2:i,y2:o,bend:a=0,headAngle:s=60,headLength:l=8,inset:c=0,insetStart:u=c,insetEnd:f=c}=e;super(t,{x1:{value:n,scale:"x"},y1:{value:r,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},e,go),this.bend=!0===a?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+s,this.headLength=+l,this.insetStart=+u,this.insetEnd=+f}render(t,e,n,r,i){const{x1:o,y1:a,x2:s=o,y2:l=a,SW:c}=n,{strokeWidth:u,bend:f,headAngle:h,headLength:d,insetStart:p,insetEnd:m}=this,g=c?t=>c[t]:x(void 0===u?1:u),y=f*Br,v=h*Br/2,w=d/1.5;return Cr("svg:g",i).call(Fe,this,e,r,i).call(Ue,this,e).call((e=>e.selectAll().data(t).enter().append("path").call(_e,this).attr("d",(t=>{let e=o[t],n=a[t],r=s[t],i=l[t];const c=Math.hypot(r-e,i-n);if(c<=p+m)return null;let u=Math.atan2(i-n,r-e);const f=Math.min(w*g(t),c/3),h=Math.hypot(c/Math.tan(y),c)/2;if(p||m)if(h<1e5){const t=Math.sign(y),[o,a]=function([t,e],[n,r],i,o){const a=n-t,s=r-e,l=Math.hypot(a,s),c=o*Math.sqrt(i*i-l*l/4)/l;return[(t+n)/2-s*c,(e+r)/2+a*c]}([e,n],[r,i],h,t);if(p&&([e,n]=vo([o,a,h],[e,n,p],-t*Math.sign(p))),m){const[e,n]=vo([o,a,h],[r,i,m],t*Math.sign(m));u+=Math.atan2(n-a,e-o)-Math.atan2(i-a,r-o),r=e,i=n}}else{const t=r-e,o=i-n,a=Math.hypot(t,o);p&&(e+=t/a*p,n+=o/a*p),m&&(r-=t/a*m,i-=o/a*m)}const d=u+y,x=d+v,b=d-v,k=r-f*Math.cos(x),$=i-f*Math.sin(x),M=r-f*Math.cos(b),L=i-f*Math.sin(b);return`M${e},${n}${h<1e5?`A${h},${h} 0,0,${y>0?1:0} `:"L"}${r},${i}M${k},${$}L${r},${i}L${M},${L}`})).call(qe,this,n))).node()}}function vo([t,e,n],[r,i,o],a){const s=r-t,l=i-e,c=Math.hypot(s,l),u=(s*s+l*l-o*o+n*n)/(2*c),f=a*Math.sqrt(n*n-u*u);return[t+(s*u+l*f)/c,e+(l*u-s*f)/c]}class xo extends ti{constructor(t,e,n={},r){super(t,e,n,r);const{inset:i=0,insetTop:o=i,insetRight:a=i,insetBottom:s=i,insetLeft:l=i,rx:c,ry:u}=n;this.insetTop=m(o),this.insetRight=m(a),this.insetBottom=m(s),this.insetLeft=m(l),this.rx=Ve(c,"auto"),this.ry=Ve(u,"auto")}render(t,e,n,r,i){const{rx:o,ry:a}=this;return Cr("svg:g",i).call(Fe,this,e,r,i).call(this._transform,this,e).call((i=>i.selectAll().data(t).enter().append("rect").call(_e,this).attr("x",this._x(e,n,r)).attr("width",this._width(e,n,r)).attr("y",this._y(e,n,r)).attr("height",this._height(e,n,r)).call(Xe,"rx",o).call(Xe,"ry",a).call(qe,this,n))).node()}_x(t,{x:e},{marginLeft:n}){const{insetLeft:r}=this;return e?t=>e[t]+r:n+r}_y(t,{y:e},{marginTop:n}){const{insetTop:r}=this;return e?t=>e[t]+r:n+r}_width({x:t},{x:e},{marginRight:n,marginLeft:r,width:i}){const{insetLeft:o,insetRight:a}=this,s=e&&t?t.bandwidth():i-n-r;return Math.max(0,s-o-a)}_height({y:t},{y:e},{marginTop:n,marginBottom:r,height:i}){const{insetTop:o,insetBottom:a}=this,s=e&&t?t.bandwidth():i-n-r;return Math.max(0,s-o-a)}}const wo={ariaLabel:"bar"};class bo extends xo{constructor(t,e={}){const{x1:n,x2:r,y:i}=e;super(t,{x1:{value:n,scale:"x"},x2:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},e,wo)}_transform(t,e,{x:n}){t.call(Ue,e,{x:n},0,0)}_x({x:t},{x1:e,x2:n},{marginLeft:r}){const{insetLeft:i}=this;return ur(t)?r+i:t=>Math.min(e[t],n[t])+i}_width({x:t},{x1:e,x2:n},{marginRight:r,marginLeft:i,width:o}){const{insetLeft:a,insetRight:s}=this;return ur(t)?o-r-i-a-s:t=>Math.max(0,Math.abs(n[t]-e[t])-a-s)}}class ko extends xo{constructor(t,e={}){const{x:n,y1:r,y2:i}=e;super(t,{y1:{value:r,scale:"y"},y2:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},e,wo)}_transform(t,e,{y:n}){t.call(Ue,e,{y:n},0,0)}_y({y:t},{y1:e,y2:n},{marginTop:r}){const{insetTop:i}=this;return ur(t)?r+i:t=>Math.min(e[t],n[t])+i}_height({y:t},{y1:e,y2:n},{marginTop:r,marginBottom:i,height:o}){const{insetTop:a,insetBottom:s}=this;return ur(t)?o-r-i-a-s:t=>Math.max(0,Math.abs(n[t]-e[t])-a-s)}}function $o(t,e={y:u,x2:f}){return new bo(t,Si(un(Ci(e))))}function Mo(t,e={x:u,y2:f}){return new ko(t,Pi(fn(Bi(e))))}function Lo(t,e={}){return Ro(Object.fromEntries(["x","x1","x2"].filter((t=>null!=e[t])).map((e=>[e,t]))),e)}function Ao(t,e={}){return Ro(Object.fromEntries(["y","y1","y2"].filter((t=>null!=e[t])).map((e=>[e,t]))),e)}function zo(t={},n={}){const r=P(n),i=Object.entries(t).map((([t,e])=>{const r=W(t,n);if(null==r)throw new Error(`missing channel: ${t}`);const[i,o]=Y(r);return{key:t,input:r,output:i,setOutput:o,map:Oo(e)}}));return{...wt(n,((t,n)=>{const o=l(t,r),a=i.map((({input:e})=>l(t,e))),s=i.map((({setOutput:e})=>e(new Array(t.length))));for(const t of n)for(const n of o?e.group(t,(t=>o[t])).values():[t])i.forEach((({map:t},e)=>t.map(n,a[e],s[e])));return{data:t,facets:n}})),...Object.fromEntries(i.map((({key:t,output:e})=>[t,e])))}}const Ro=zo;function Oo(t){if(t&&"function"==typeof t.map)return t;if("function"==typeof t)return Bo(t);switch(`${t}`.toLowerCase()){case"cumsum":return Eo;case"rank":return Bo(e.rank);case"quantile":return Bo(Co)}throw new Error(`invalid map: ${t}`)}function Co(t){const n=e.count(t)-1;return e.rank(t).map((t=>t/n))}function Bo(t){return{map(e,n,r){const i=t(j(n,e));if(i.length!==e.length)throw new Error("map function returned a mismatched length");for(let t=0,n=e.length;tn.selectAll().data(t).enter().append(m?"circle":"path").call(_e,this).call(m?t=>{t.attr("cx",l?t=>l[t]:d).attr("cy",c?t=>c[t]:p).attr("r",u?t=>u[t]:g)}:t=>{const n=l&&c?t=>`translate(${l[t]},${c[t]})`:l?t=>`translate(${l[t]},${p})`:c?t=>`translate(${d},${c[t]})`:()=>`translate(${d},${p})`;t.attr("transform",f?t=>`${n(t)} rotate(${f[t]})`:this.rotate?t=>`${n(t)} rotate(${this.rotate})`:n).attr("d",(t=>{const n=e.path(),r=u?u[t]:g;return(h?h[t]:this.symbol).draw(n,r*r*Math.PI),n}))}).call(qe,this,r))).node()}}function To(t,e={}){let{x:n,y:r,...i}=e;return void 0===e.frameAnchor&&([n,r]=S(n,r)),new Po(t,{...i,x:n,y:r})}const Do={ariaLabel:"rule",fill:null,stroke:"currentColor"};class jo extends ti{constructor(t,e={}){const{x:n,y1:r,y2:i,inset:o=0,insetTop:a=o,insetBottom:s=o}=e;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:r,scale:"y",optional:!0},y2:{value:i,scale:"y",optional:!0}},e,Do),this.insetTop=m(a),this.insetBottom=m(s)}render(t,e,n,r,i){const{x:o,y:a}=e,{x:s,y1:l,y2:c}=n,{width:u,height:f,marginTop:h,marginRight:d,marginLeft:p,marginBottom:m}=r,{insetTop:g,insetBottom:y}=this;return Cr("svg:g",i).call(Fe,this,e,r).call(Ue,this,{x:s&&o},Ne,0).call((e=>e.selectAll().data(t).enter().append("line").call(_e,this).attr("x1",s?t=>s[t]:(p+u-d)/2).attr("x2",s?t=>s[t]:(p+u-d)/2).attr("y1",l&&!ur(a)?t=>l[t]+g:h+g).attr("y2",c&&!ur(a)?a.bandwidth?t=>c[t]+a.bandwidth()-y:t=>c[t]-y:f-m-y).call(qe,this,n))).node()}}class qo extends ti{constructor(t,e={}){const{x1:n,x2:r,y:i,inset:o=0,insetRight:a=o,insetLeft:s=o}=e;super(t,{y:{value:i,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:r,scale:"x",optional:!0}},e,Do),this.insetRight=m(a),this.insetLeft=m(s)}render(t,e,n,r,i){const{x:o,y:a}=e,{y:s,x1:l,x2:c}=n,{width:u,height:f,marginTop:h,marginRight:d,marginLeft:p,marginBottom:m}=r,{insetLeft:g,insetRight:y}=this;return Cr("svg:g",i).call(Fe,this,e,r,i).call(Ue,this,{y:s&&a},0,Ne).call((e=>e.selectAll().data(t).enter().append("line").call(_e,this).attr("x1",l&&!ur(o)?t=>l[t]+g:p+g).attr("x2",c&&!ur(o)?o.bandwidth?t=>c[t]+o.bandwidth()-y:t=>c[t]-y:u-d-y).attr("y1",s?t=>s[t]:(h+f-m)/2).attr("y2",s?t=>s[t]:(h+f-m)/2).call(qe,this,n))).node()}}function Wo(t,e){let{x:n=f,y:r,y1:i,y2:o,...a}=fn(e);return[i,o]=Io(r,i,o),new jo(t,{...a,x:n,y1:i,y2:o})}function Yo(t,e){let{y:n=f,x:r,x1:i,x2:o,...a}=un(e);return[i,o]=Io(r,i,o),new qo(t,{...a,y:n,x1:i,x2:o})}function Io(t,e,n){if(void 0===t){if(void 0===e){if(void 0!==n)return[0,n]}else if(void 0===n)return[0,e]}else{if(void 0===e)return void 0===n?[0,t]:[t,n];if(void 0===n)return[t,e]}return[e,n]}const Fo={ariaLabel:"tick",fill:null,stroke:"currentColor"};class _o extends ti{constructor(t,e,n){super(t,e,n,Fo)}render(t,e,n,r,i){return Cr("svg:g",i).call(Fe,this,e,r,i).call(this._transform,this,e).call((i=>i.selectAll().data(t).enter().append("line").call(_e,this).attr("x1",this._x1(e,n,r)).attr("x2",this._x2(e,n,r)).attr("y1",this._y1(e,n,r)).attr("y2",this._y2(e,n,r)).call(qe,this,n))).node()}}class Go extends _o{constructor(t,e={}){const{x:n,y:r,inset:i=0,insetTop:o=i,insetBottom:a=i}=e;super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y",type:"band",optional:!0}},e),this.insetTop=m(o),this.insetBottom=m(a)}_transform(t,e,{x:n}){t.call(Ue,e,{x:n},Ne,0)}_x1(t,{x:e}){return t=>e[t]}_x2(t,{x:e}){return t=>e[t]}_y1({y:t},{y:e},{marginTop:n}){const{insetTop:r}=this;return e&&t?t=>e[t]+r:n+r}_y2({y:t},{y:e},{height:n,marginBottom:r}){const{insetBottom:i}=this;return e&&t?n=>e[n]+t.bandwidth()-i:n-r-i}}class Xo extends _o{constructor(t,e={}){const{x:n,y:r,inset:i=0,insetRight:o=i,insetLeft:a=i}=e;super(t,{y:{value:r,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},e),this.insetRight=m(o),this.insetLeft=m(a)}_transform(t,e,{y:n}){t.call(Ue,e,{y:n},0,Ne)}_x1({x:t},{x:e},{marginLeft:n}){const{insetLeft:r}=this;return e&&t?t=>e[t]+r:n+r}_x2({x:t},{x:e},{width:n,marginRight:r}){const{insetRight:i}=this;return e&&t?n=>e[n]+t.bandwidth()-i:n-r-i}_y1(t,{y:e}){return t=>e[t]}_y2(t,{y:e}){return t=>e[t]}}function Uo(t,e={}){const{x:n=f,...r}=e;return new Go(t,{...r,x:n})}function Vo(t,e={}){const{y:n=f,...r}=e;return new Xo(t,{...r,y:n})}function Ho(t){const e=Zo(t),n=Qo(t);return t.map((t=>tn?t:NaN))}function Zo(t,n){const r=2.5*Jo(t,n)-1.5*Ko(t,n);return e.min(t,(t=>t>=r?t:NaN))}function Qo(t,n){const r=2.5*Ko(t,n)-1.5*Jo(t,n);return e.max(t,(t=>t<=r?t:NaN))}function Jo(t,n){return e.quantile(t,.25,n)}function Ko(t,n){return e.quantile(t,.75,n)}const ta={ariaLabel:"cell"};class ea extends xo{constructor(t,{x:e,y:n,...r}={}){super(t,{x:{value:e,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},r,ta)}_transform(t,e){t.call(Ue,e,{},0,0)}}const na={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ra={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},ia={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},oa={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},aa={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class sa extends ti{constructor(t,e={}){const{x:n,y:r,z:i,curve:o,tension:a}=e;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:i,optional:!0}},e,na),this.curve=pi(o,a),eo(this,e)}render(t,n,r,i,o){const{x:a,y:s}=n,{x:l,y:c,z:u}=r,{curve:f}=this,[h,d]=Ke(this,i),p=l?t=>l[t]:x(h),m=c?t=>c[t]:x(d),g=this;function y(t){let n=-1;const i=[],o={};for(const t in r)o[t]=[];const a=[],s=[],l=[],c=[];function u(e,u){e=t[e],u=t[u],i.push(++n),a[n]=p(e),l[n]=m(e),s[n]=p(u),c[n]=m(u);for(const t in r)o[t].push(r[t][u])}const{halfedges:h,hull:d,triangles:y}=e.Delaunay.from(t,p,m);for(let t=0;tt&&u(y[t],y[e])}for(let t=0;t{const n=e.path(),r=f(n);return r.lineStart(),r.point(a[t],l[t]),r.point(s[t],c[t]),r.lineEnd(),n})).call(qe,g,o).call(lo,g,o)}return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,{x:l&&a,y:c&&s}).call(u?n=>n.selectAll().data(e.group(t,(t=>u[t])).values()).enter().append("g").each(y):e=>e.datum(t).each(y)).node()}}class la extends ti{constructor(t,e={},n,r=(({z:t})=>t)){const{x:i,y:o}=e;super(t,{x:{value:i,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},z:{value:r(e),optional:!0}},e,n)}render(t,n,r,i,o){const{x:a,y:s}=n,{x:l,y:c,z:u}=r,[f,h]=Ke(this,i),d=l?t=>l[t]:x(f),p=c?t=>c[t]:x(h),m=this;function g(t){const n=e.Delaunay.from(t,d,p);e.select(this).append("path").datum(t[0]).call(_e,m).attr("d",m._render(n,i)).call(qe,m,r)}return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,{x:l&&a,y:c&&s}).call(u?n=>n.selectAll().data(e.group(t,(t=>u[t])).values()).enter().append("g").each(g):e=>e.datum(t).each(g)).node()}}class ca extends la{constructor(t,e={}){super(t,e,ra),this.fill="none"}_render(t){return t.render()}}class ua extends la{constructor(t,e={}){super(t,e,ia,P)}_render(t){return t.renderHull()}}class fa extends ti{constructor(t,e={}){const{x:n,y:r,z:i}=e;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:i,optional:!0}},e,oa)}render(t,n,r,i,o){const{x:a,y:s}=n,{x:l,y:c,z:u}=r,[f,h]=Ke(this,i),d=l?t=>l[t]:x(f),p=c?t=>c[t]:x(h);function m(t){const n=da(e.Delaunay.from(t,d,p),i);e.select(this).selectAll().data(t).enter().append("path").call(_e,this).attr("d",((t,e)=>n.renderCell(e))).call(qe,this,r)}return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,{x:l&&a,y:c&&s}).call(u?n=>n.selectAll().data(e.group(t,(t=>u[t])).values()).enter().append("g").each(m):e=>e.datum(t).each(m)).node()}}class ha extends la{constructor(t,e){super(t,e,aa),this.fill="none"}_render(t,e){return da(t,e).render()}}function da(t,e){const{width:n,height:r,marginTop:i,marginRight:o,marginBottom:a,marginLeft:s}=e;return t.voronoi([s,i,n-o,r-a])}function pa(t,e,{x:n,y:r,...i}={}){return[n,r]=S(n,r),new t(e,{...i,x:n,y:r})}const ma={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class ga extends ti{constructor(t,{x:n,y:r,z:i,weight:o,fill:a,stroke:s,...l}={}){const c=va(a)&&(a="currentColor",!0),u=va(s)&&(s="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:P({z:i,fill:a,stroke:s}),optional:!0},weight:{value:o,optional:!0}},function(t,n,r){const i=100;let{bandwidth:o,thresholds:a}=t;return o=void 0===o?20:+o,a=void 0===a?20:"function"==typeof a?.[Symbol.iterator]?pr(a):+a,bt(t,(function(t,s,l,c,u,f){const h=l.weight?pr(l.weight.value):null,d=l.z?.value,{z:p}=this,[m,g]=Ke(this,u),{width:y,height:v}=u,{x:x,y:w}=Rr(l,c,f),b=Object.fromEntries(Object.entries(l).filter((([t])=>!ya.has(t))).map((([t,e])=>[t,{...e,value:[]}]))),k=n&&[],$=r&&[],M=e.contourDensity().x(x?t=>x[t]:m).y(w?t=>w[t]:g).weight(h?t=>h[t]:1).size([y,v]).bandwidth(o),L=[];for(const t of s){const e=[];L.push(e);for(const n of d?Ye(t,d,p):[t]){const t=M.contours(n);e.push([n,t])}}let A=a;if(!R(A)){let t=0;for(const e of L)for(const[,n]of e){const e=n.max;e>t&&(t=e)}A=Float64Array.from({length:a-1},((e,n)=>t*i*(n+1)/a))}const z=[],O=[];for(const t of L){const e=[];z.push(e);for(const[n,r]of t)for(const t of A){e.push(O.length),O.push(r(t/i)),k&&k.push(t),$&&$.push(t);for(const t in b)b[t].value.push(l[t].value[n[0]])}}return k&&k.push(0),$&&$.push(0),{data:t,facets:z,channels:{...b,...k&&{fill:{value:k,scale:"color"}},...$&&{stroke:{value:$,scale:"color"}},contours:{value:O}}}}))}({...l,fill:a,stroke:s},c,u),ma),c&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){const{contours:a}=r,s=e.geoPath();return e.create("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,{}).call((e=>e.selectAll().data(t).enter().append("path").call(_e,this).call(qe,this,r).attr("d",(t=>s(a[t]))))).node()}}const ya=new Set(["x","y","z","weight"]);function va(t){return/^density$/i.test(t)}const xa={ariaLabel:"frame",fill:"none",stroke:"currentColor"};class wa extends ti{constructor(t={}){const{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:i=e,insetLeft:o=e,rx:a,ry:s}=t;super(void 0,void 0,t,xa),this.insetTop=m(n),this.insetRight=m(r),this.insetBottom=m(i),this.insetLeft=m(o),this.rx=m(a),this.ry=m(s)}render(t,e,n,r,i){const{marginTop:o,marginRight:a,marginBottom:s,marginLeft:l,width:c,height:u}=r,{insetTop:f,insetRight:h,insetBottom:d,insetLeft:p,rx:m,ry:g}=this;return Cr("svg:rect",i).call(Fe,this,e,r,i).call(_e,this).call(Ue,this,{}).attr("x",l+p).attr("y",o+f).attr("width",c-l-a-p-h).attr("height",u-o-s-f-d).attr("rx",m).attr("ry",g).node()}}const ba={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class ka extends ti{constructor(t,e={}){const[n,r]=k(e.r,3);super(t,{geometry:{value:e.geometry},r:{value:n,scale:"r",filter:vt,optional:!0}},So(e),ba),this.r=r}render(t,n,r,i,o){const{geometry:a,r:s}=r,l=e.geoPath(o.projection??function({x:t,y:n}){if(t||n)return t??=t=>t,n??=t=>t,e.geoTransform({point(e,r){this.stream.point(t(e),n(r))}})}(n)),{r:c}=this;return xt(c)?t=[]:void 0!==c&&l.pointRadius(c),Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,n).call((e=>{e.selectAll().data(t).enter().append("path").call(_e,this).attr("d",s?t=>l.pointRadius(s[t])(a[t]):t=>l(a[t])).call(qe,this,r)})).node()}}function $a(t,{geometry:e=f,...n}={}){switch(t?.type){case"FeatureCollection":t=t.features;break;case"GeometryCollection":t=t.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":t=[t]}return new ka(t,{geometry:e,...n})}const Ma=.5;function La(t,e,n,r){const i=r*(1.5/Tn),o=new Map;for(const a of t){let t=e[a],s=n[a];if(isNaN(t)||isNaN(s))continue;let l=Math.round(s=(s-0)/i),c=Math.round(t=(t-Ma)/r-(1&l)/2),u=s-l;if(3*Math.abs(u)>1){let e=t-c,n=c+(ti*i+o*o&&(c=n+(1&l?1:-1)/2,l=r)}const f=`${c},${l}`;let h=o.get(f);void 0===h&&(o.set(f,h=[]),h.x=(c+(1&l)/2)*r+Ma,h.y=l*i+0),h.push(a)}return o.values()}const Aa={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};class za extends ti{constructor({binWidth:t=20,clip:e=!0,...n}={}){super(void 0,void 0,{clip:e,...n},Aa),this.binWidth=m(t)}render(t,e,n,r,i){const{binWidth:o}=this,{marginTop:a,marginRight:s,marginBottom:l,marginLeft:c,width:u,height:f}=r,h=c-Ma,d=u-s-Ma,p=a-0,m=f-l-0,g=o/2,y=g*Dn,v=y/2,x=2*g,w=1.5*y,b=`m0,${-y}l${g},${v}v${y}l${-g},${v}`,k=Math.floor(h/x),$=Math.ceil(d/x),M=Math.floor((p+v)/w),L=Math.ceil((m-v)/w)+1,A=[];for(let t=M;tt.append("path").call(_e,this).call(Ue,this,{},Ne+Ma,Ne+0).attr("d",A.join("")))).node()}}const Ra={ariaLabel:"image",fill:null,stroke:null};class Oa extends ti{constructor(t,e={}){let{x:n,y:r,width:i,height:o,src:a,preserveAspectRatio:s,crossOrigin:l,frameAnchor:c}=e;void 0===i&&void 0!==o?i=o:void 0===o&&void 0!==i&&(o=i);const[u,f]="string"==typeof(h=a)&&(function(t){return/^\.*\//.test(t)}(h)||function(t){return/^(blob|data|file|http|https):/i.test(t)}(h))?[void 0,h]:[h,void 0];var h;const[d,m]=k(i,16),[g,y]=k(o,16);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},width:{value:d,filter:vt,optional:!0},height:{value:g,filter:vt,optional:!0},src:{value:u,optional:!0}},e,Ra),this.src=f,this.width=m,this.height=y,this.preserveAspectRatio=Ve(s,"xMidYMid"),this.crossOrigin=p(l),this.frameAnchor=rt(c)}render(t,e,n,r,i){const{x:o,y:a}=e,{x:s,y:l,width:c,height:u,src:f}=n,[h,d]=Ke(this,r);return Cr("svg:g",i).call(Fe,this,e,r,i).call(Ue,this,{x:s&&o,y:l&&a}).call((e=>e.selectAll().data(t).enter().append("image").call(_e,this).attr("x",c&&s?t=>s[t]-c[t]/2:c?t=>h-c[t]/2:s?t=>s[t]-this.width/2:h-this.width/2).attr("y",u&&l?t=>l[t]-u[t]/2:u?t=>d-u[t]/2:l?t=>l[t]-this.height/2:d-this.height/2).attr("width",c?t=>c[t]:this.width).attr("height",u?t=>u[t]:this.height).call(Xe,"href",f?t=>f[t]:this.src).call(Xe,"preserveAspectRatio",this.preserveAspectRatio).call(Xe,"crossorigin",this.crossOrigin).call(qe,this,n))).node()}}const Ca={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};function Ba(t){return e.curveLinear(t)}class Ea extends ti{constructor(t,e={}){const{x:n,y:r,z:i}=e;super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y"},z:{value:P(e),optional:!0}},e,Ca),this.z=i,this.curve=function({curve:t=Ba,tension:e}){return"function"!=typeof t&&"auto"===`${t}`.toLowerCase()?Ba:pi(t,e)}(e),eo(this,e)}filter(t){return t}project(t,e,n){this.curve!==Ba&&super.project(t,e,n)}render(t,n,r,i,o){const{x:a,y:s}=r,{curve:l}=this;return Cr("svg:g",o).call(Fe,this,n,i,o).call(Ue,this,n).call((n=>n.selectAll().data(Ie(t,[a,s],this,r)).enter().append("path").call(_e,this).call(We,this,r).call(co,this,r).attr("d",l===Ba&&o.projection?function(t,n,r){const i=e.geoPath(t);return n=pr(n),r=pr(r),t=>{let e=[];const o=[e];for(const i of t)-1===i?(e=[],o.push(e)):e.push([n[i],r[i]]);return i({type:"MultiLineString",coordinates:o})}}(o.projection,a,s):e.line().curve(l).defined((t=>t>=0)).x((t=>a[t])).y((t=>s[t]))))).node()}}function Na(t,e,n){var r=0===t||1===t?0:Math.exp(Pa(e+n)-Pa(e)-Pa(n)+e*Math.log(t)+n*Math.log(1-t));return!(t<0||t>1)&&(t<(e+1)/(e+n+2)?r*Sa(t,e,n)/e:1-r*Sa(1-t,n,e)/n)}function Sa(t,e,n){var r,i,o,a,s=1e-30,l=1,c=e+n,u=e+1,f=e-1,h=1,d=1-c*t/u;for(Math.abs(d)=1)return 1;for(e>=1&&n>=1?(o=t<.5?t:1-t,l=(2.30753+.27061*(a=Math.sqrt(-2*Math.log(o))))/(1+a*(.99229+.04481*a))-a,t<.5&&(l=-l),c=(l*l-3)/6,u=2/(1/(2*e-1)+1/(2*n-1)),f=l*Math.sqrt(c+u)/u-(1/(2*n-1)-1/(2*e-1))*(c+5/6-2/(3*u)),l=e/(e+n*Math.exp(2*f))):(r=Math.log(e/(e+n)),i=Math.log(n/(e+n)),l=t<(a=Math.exp(e*r)/e)/(f=a+(s=Math.exp(n*i)/n))?Math.pow(e*f*t,1/e):1-Math.pow(n*f*(1-t),1/n)),h=-Pa(e)-Pa(n)+Pa(e+n);m<10;m++){if(0===l||1===l)return l;if((l-=a=(s=(Na(l,e,n)-t)/(a=Math.exp(d*Math.log(l)+p*Math.log(1-l)+h)))/(1-.5*Math.min(1,s*(d/l-p/(1-l)))))<=0&&(l=.5*(l+a)),l>=1&&(l=.5*(l+a+1)),Math.abs(a)<1e-8*l&&m>0)break}return l}(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}const Da={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class ja extends ti{constructor(t,e={}){const{x:n,y:r,z:i,ci:o=.95,precision:a=4}=e;if(super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y"},z:{value:P(e),optional:!0}},e,Da),this.z=i,this.ci=+o,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${o}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,e,n,r,i){const{x:o,y:a,z:s}=n,{ci:l}=this;return Cr("svg:g",i).call(Fe,this,e,r,i).call(Ue,this,e).call((e=>e.selectAll().data(s?Ye(t,s,this.z):[t]).enter().call((t=>t.append("path").attr("fill","none").call(_e,this).call(We,this,{...n,fill:null,fillOpacity:null}).attr("d",(t=>this._renderLine(t,o,a))).call(l&&!nt(this.fill)?t=>t.select(qa).attr("stroke","none").call(_e,this).call(We,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",(t=>this._renderBand(t,o,a))):()=>{}))))).node()}}function qa(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(e.namespaces.svg,"path"),this)}class Wa extends ja{constructor(t,e){super(t,e)}_renderBand(t,n,r){const{ci:i,precision:o}=this,[a,s]=e.extent(t,(t=>r[t])),l=Ia(t,r,n),c=Fa(t,r,n,(1-i)/2,l);return e.area().y((t=>t)).x0((t=>c(t,-1))).x1((t=>c(t,1)))(e.range(a,s-o/2,o).concat(s))}_renderLine(t,n,r){const[i,o]=e.extent(t,(t=>r[t])),a=Ia(t,r,n);return`M${a(i)},${i}L${a(o)},${o}`}}class Ya extends ja{constructor(t,e){super(t,e)}_renderBand(t,n,r){const{ci:i,precision:o}=this,[a,s]=e.extent(t,(t=>n[t])),l=Ia(t,n,r),c=Fa(t,n,r,(1-i)/2,l);return e.area().x((t=>t)).y0((t=>c(t,-1))).y1((t=>c(t,1)))(e.range(a,s-o/2,o).concat(s))}_renderLine(t,n,r){const[i,o]=e.extent(t,(t=>n[t])),a=Ia(t,n,r);return`M${i},${a(i)}L${o},${a(o)}`}}function Ia(t,e,n){let r=0,i=0,o=0,a=0;for(const s of t){const t=e[s],l=n[s];r+=t,i+=l,o+=t*l,a+=t*t}const s=t.length,l=(s*o-r*i)/(s*a-r*r),c=(i-l*r)/s;return t=>l*t+c}function Fa(t,n,r,i,o){const a=e.sum(t,(t=>n[t]))/t.length;let s=0,l=0;for(const e of t)s+=(n[e]-a)**2,l+=(r[e]-o(n[e]))**2;const c=Math.sqrt(l/(t.length-2)),u=Ta(i,t.length-2);return(e,n)=>{const r=o(e),i=c*Math.sqrt(1/t.length+(e-a)**2/s);return r+n*u*i}}const _a={ariaLabel:"rect"};class Ga extends ti{constructor(t,e={}){const{x1:n,y1:r,x2:i,y2:o,inset:a=0,insetTop:s=a,insetRight:l=a,insetBottom:c=a,insetLeft:u=a,rx:f,ry:h}=e;super(t,{x1:{value:n,scale:"x",optional:!0},y1:{value:r,scale:"y",optional:!0},x2:{value:i,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},e,_a),this.insetTop=m(s),this.insetRight=m(l),this.insetBottom=m(c),this.insetLeft=m(u),this.rx=Ve(f,"auto"),this.ry=Ve(h,"auto")}render(t,e,n,r,i){const{x:o,y:a}=e,{x1:s,y1:l,x2:c,y2:u}=n,{marginTop:f,marginRight:h,marginBottom:d,marginLeft:p,width:m,height:g}=r,{projection:y}=i,{insetTop:v,insetRight:x,insetBottom:w,insetLeft:b,rx:k,ry:$}=this;return Cr("svg:g",i).call(Fe,this,e,r,i).call(Ue,this,{x:s&&c&&o,y:l&&u&&a},0,0).call((e=>e.selectAll().data(t).enter().append("rect").call(_e,this).attr("x",s&&c&&(y||!ur(o))?t=>Math.min(s[t],c[t])+b:p+b).attr("y",l&&u&&(y||!ur(a))?t=>Math.min(l[t],u[t])+v:f+v).attr("width",s&&c&&(y||!ur(o))?t=>Math.max(0,Math.abs(c[t]-s[t])-b-x):m-h-p-x-b).attr("height",l&&u&&(y||!ur(a))?t=>Math.max(0,Math.abs(l[t]-u[t])-v-w):g-f-d-v-w).call(Xe,"rx",k).call(Xe,"ry",$).call(qe,this,n))).node()}}const Xa={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"};class Ua extends ti{constructor(t,e={}){const{x:n,y:r,text:i=(X(t)&&U(t)?f:u),frameAnchor:o,textAnchor:a=(/right$/i.test(o)?"end":/left$/i.test(o)?"start":"middle"),lineAnchor:s=(/^top/i.test(o)?"top":/^bottom/i.test(o)?"bottom":"middle"),lineHeight:c=1,lineWidth:h=1/0,monospace:d,fontFamily:m=(d?"ui-monospace, monospace":void 0),fontSize:g,fontStyle:y,fontVariant:v,fontWeight:x,rotate:w}=e,[b,$]=k(w,0),[L,A]=function(t){return null==t||"number"==typeof t?[void 0,t]:"string"!=typeof t?[t,void 0]:(t=t.trim().toLowerCase(),Qa.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}(g);var z;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},fontSize:{value:L,optional:!0},rotate:{value:(z=b,null==z?null:{transform:t=>l(t,z,Float64Array),label:F(z)}),optional:!0},text:{value:i,filter:gt}},e,Xa),this.rotate=$,this.textAnchor=Ve(a,"middle"),this.lineAnchor=M(s,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+c,this.lineWidth=+h,this.monospace=!!d,this.fontFamily=p(m),this.fontSize=A,this.fontStyle=p(y),this.fontVariant=p(v),this.fontWeight=p(x),this.frameAnchor=rt(o)}render(t,e,n,r,i){const{x:o,y:a}=e,{x:s,y:l,rotate:c,text:u,fontSize:f}=n,{rotate:h}=this,[d,p]=Ke(this,r);return Cr("svg:g",i).call(Fe,this,e,r,i).call(Za,this,u,r).call(Ue,this,{x:s&&o,y:l&&a}).call((e=>e.selectAll().data(t).enter().append("text").call(_e,this).call(Va,this,u).attr("transform",c?s&&l?t=>`translate(${s[t]},${l[t]}) rotate(${c[t]})`:s?t=>`translate(${s[t]},${p}) rotate(${c[t]})`:l?t=>`translate(${d},${l[t]}) rotate(${c[t]})`:t=>`translate(${d},${p}) rotate(${c[t]})`:h?s&&l?t=>`translate(${s[t]},${l[t]}) rotate(${h})`:s?t=>`translate(${s[t]},${p}) rotate(${h})`:l?t=>`translate(${d},${l[t]}) rotate(${h})`:`translate(${d},${p}) rotate(${h})`:s&&l?t=>`translate(${s[t]},${l[t]})`:s?t=>`translate(${s[t]},${p})`:l?t=>`translate(${d},${l[t]})`:`translate(${d},${p})`).call(Xe,"font-size",f&&(t=>f[t])).call(qe,this,n))).node()}}function Va(t,{monospace:n,lineAnchor:r,lineHeight:i,lineWidth:o},a){if(!a)return;const s=isFinite(o)?n?t=>Ja(t,o,es):t=>Ja(t,100*o,ts):t=>t.split(/\r\n?|\n/g);t.each((function(t){const n=s(Ce(a[t])),o=n.length,l="top"===r?.71:"bottom"===r?1-o:(164-100*o)/200;if(o>1)for(let t=0;tn-e)){const r=[];let i,o=0;for(const[a,s,l]of function*(t){let e=0,n=0;const r=t.length;for(;ni&&n(t,i,s)>e&&(r.push(t.slice(i,o)),i=a),l?(r.push(t.slice(i,s)),i=void 0):o=s;return r}const Ka={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,"‘":31,"’":31,"“":47,"”":47};function ts(t,e,n){let r=0;for(let i=e;i=55296&&e<=56319){const e=t.charCodeAt(i+1);e>=56320&&e<=57343&&++i}}return r}function es(t,e,n){return n-e}function ns(t={}){let{path:n=f,delimiter:r,frameAnchor:i,treeLayout:o=e.tree,treeSort:a,treeSeparation:s,treeAnchor:c,...u}=t;c=is(c),a=ss(a),void 0===i&&(i=c.frameAnchor);const d=cs(r),p=$s(u,fs),[m,g]=Y(),[y,v]=Y();return{x:m,y:y,frameAnchor:i,...wt(u,((t,r)=>{const i=d(l(t,n)),u=g([]),f=v([]);let m=-1;const y=[],x=[],w=e.stratify().path((t=>i[t])),b=o();b.nodeSize&&b.nodeSize([1,1]),b.separation&&void 0!==s&&b.separation(s??h);for(const t of p)t[ks]=t[ws]([]);for(const e of r){const n=[],r=w(e.filter((t=>null!=i[t]))).each((e=>e.data=t[e.data]));null!=a&&r.sort(a),b(r);for(const t of r.descendants()){n.push(++m),y[m]=t.data,c.position(t,m,u,f);for(const e of p)e[ks][m]=e[bs](t)}x.push(n)}return{data:y,facets:x}})),...Object.fromEntries(p)}}function rs(t={}){let{path:n=f,delimiter:r,curve:i="bump-x",stroke:o="#555",strokeWidth:a=1.5,strokeOpacity:s=.5,treeLayout:c=e.tree,treeSort:u,treeSeparation:d,treeAnchor:p,...m}=t;p=is(p),u=ss(u),m={curve:i,stroke:o,strokeWidth:a,strokeOpacity:s,...m};const g=cs(r),y=$s(m,hs),[v,x]=Y(),[w,b]=Y(),[k,$]=Y(),[M,L]=Y();return{x1:v,x2:w,y1:k,y2:M,...wt(m,((t,r)=>{const i=g(l(t,n)),o=x([]),a=b([]),s=$([]),f=L([]);let m=-1;const v=[],w=[],k=e.stratify().path((t=>i[t])),M=c();M.nodeSize&&M.nodeSize([1,1]),M.separation&&void 0!==d&&M.separation(d??h);for(const t of y)t[ks]=t[ws]([]);for(const e of r){const n=[],r=k(e.filter((t=>null!=i[t]))).each((e=>e.data=t[e.data]));null!=u&&r.sort(u),M(r);for(const{source:t,target:e}of r.links()){n.push(++m),v[m]=e.data,p.position(t,m,o,s),p.position(e,m,a,f);for(const n of y)n[ks][m]=n[bs](e,t)}w.push(n)}return{data:v,facets:w}})),...Object.fromEntries(y)}}function is(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return os;case"right":return as}throw new Error(`invalid tree anchor: ${t}`)}const os={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,i){r[n]=e,i[n]=-t}},as={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,i){r[n]=-e,i[n]=-t}};function ss(t){return null==t||"function"==typeof t?t:`${t}`.trim().toLowerCase().startsWith("node:")?ls(fs(t)):ls(function(t){return e=>e.data?.[t]}(t))}function ls(t){return(e,n)=>pt(t(e),t(n))}function cs(t="/"){return"/"==`${t}`?t=>t:e=>{return e.map((n=t,r="/",n=new RegExp(function(t){return`${t}`.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}(n),"g"),t=>null==t?null:`${t}`.replace(n,r)));var n,r}}function us(t){return O(t)&&"function"==typeof t.node}function fs(t){if(us(t))return t.node;if((t=`${t}`.trim().toLowerCase()).startsWith("node:")){switch(t){case"node:name":return ps;case"node:path":return ds;case"node:internal":return ys;case"node:depth":return ms;case"node:height":return gs}throw new Error(`invalid node value: ${t}`)}}function hs(t){if(us(t))return t.node;if(O(e=t)&&"function"==typeof e.link)return t.link;var e;if((t=`${t}`.trim().toLowerCase()).startsWith("node:")||t.startsWith("parent:")){switch(t){case"parent:name":return vs(ps);case"parent:path":return vs(ds);case"parent:depth":return vs(ms);case"parent:height":return vs(gs);case"node:name":return ps;case"node:path":return ds;case"node:internal":return ys;case"node:depth":return ms;case"node:height":return gs}throw new Error(`invalid link value: ${t}`)}}function ds(t){return t.id}function ps(t){return function(t){let e=t.length;for(;--e>0&&!xs(t,e););return t.slice(e+1)}(t.id)}function ms(t){return t.depth}function gs(t){return t.height}function ys(t){return!!t.children}function vs(t){return(e,n)=>null==n?void 0:t(n)}function xs(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}const ws=2,bs=3,ks=4;function $s(t,e){const n=[];for(const r in t){const i=t[r],o=e(i);void 0!==o&&n.push([r,...Y(i),o])}return n}function Ms(t,e={}){let{fill:n,stroke:r,strokeWidth:i,strokeOpacity:o,strokeLinejoin:a,strokeLinecap:s,strokeMiterlimit:l,strokeDasharray:c,strokeDashoffset:u,marker:f,markerStart:h=f,markerEnd:d=f,dot:p=et(h)&&et(d),text:m="node:name",textStroke:g="white",title:y="node:path",dx:v,dy:x,...w}=e;return void 0===v&&(v=is(w.treeAnchor).dx),ei(po(t,rs({markerStart:h,markerEnd:d,stroke:void 0!==r?r:void 0===n?"node:internal":n,strokeWidth:i,strokeOpacity:o,strokeLinejoin:a,strokeLinecap:s,strokeMiterlimit:l,strokeDasharray:c,strokeDashoffset:u,...w})),p?To(t,ns({fill:void 0===n?"node:internal":n,title:y,...w})):null,null!=m?Ha(t,ns({text:m,fill:void 0===n?"currentColor":n,stroke:g,dx:v,dy:x,title:y,...w})):null)}const Ls={ariaLabel:"vector",fill:null,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"};class As extends ti{constructor(t,e={}){const{x:n,y:r,length:i,rotate:o,anchor:a="middle",frameAnchor:s}=e,[l,c]=k(i,12),[u,f]=k(o,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},length:{value:l,scale:"length",optional:!0},rotate:{value:u,optional:!0}},e,Ls),this.length=c,this.rotate=f,this.anchor=M(a,"anchor",["start","middle","end"]),this.frameAnchor=rt(s)}render(t,e,n,r,i){const{x:o,y:a}=e,{x:s,y:l,length:c,rotate:u}=n,{length:f,rotate:h,anchor:d}=this,[p,m]=Ke(this,r),g=c?t=>c[t]:()=>f,y=u?t=>u[t]:()=>h,v=s?t=>s[t]:()=>p,x=l?t=>l[t]:()=>m,w="start"===d?0:"end"===d?1:.5;return Cr("svg:g",i).attr("fill","none").call(Fe,this,e,r,i).call(Ue,this,{x:s&&o,y:l&&a}).call((e=>e.selectAll().data(t).enter().append("path").call(_e,this).attr("d",(t=>{const e=g(t),n=y(t)*Br,r=Math.sin(n)*e,i=-Math.cos(n)*e,o=(r+i)/5,a=(r-i)/5;return`M${v(t)-r*w},${x(t)-i*w}l${r},${i}m${-a},${-o}l${a},${o}l${-o},${a}`})).call(qe,this,n))).node()}}function zs(t,e,n,r,i){for(var o=i+1;r<=i;){var a=r+i>>>1,s=t[a];(void 0!==n?n(s,e):s-e)>=0?(o=a,i=a-1):r=a+1}return o}function Rs(t,e,n,r,i){for(var o=i+1;r<=i;){var a=r+i>>>1,s=t[a];(void 0!==n?n(s,e):s-e)>0?(o=a,i=a-1):r=a+1}return o}function Os(t,e,n,r,i){for(var o=r-1;r<=i;){var a=r+i>>>1,s=t[a];(void 0!==n?n(s,e):s-e)<0?(o=a,r=a+1):i=a-1}return o}function Cs(t,e,n,r,i){for(var o=r-1;r<=i;){var a=r+i>>>1,s=t[a];(void 0!==n?n(s,e):s-e)<=0?(o=a,r=a+1):i=a-1}return o}function Bs(t,e,n,r,i){for(;r<=i;){var o=r+i>>>1,a=t[o],s=void 0!==n?n(a,e):a-e;if(0===s)return o;s<=0?r=o+1:i=o-1}return-1}function Es(t,e,n,r,i,o){return"function"==typeof n?o(t,e,n,void 0===r?0:0|r,void 0===i?t.length-1:0|i):o(t,e,void 0,void 0===n?0:0|n,void 0===r?t.length-1:0|r)}var Ns={ge:function(t,e,n,r,i){return Es(t,e,n,r,i,zs)},gt:function(t,e,n,r,i){return Es(t,e,n,r,i,Rs)},lt:function(t,e,n,r,i){return Es(t,e,n,r,i,Os)},le:function(t,e,n,r,i){return Es(t,e,n,r,i,Cs)},eq:function(t,e,n,r,i){return Es(t,e,n,r,i,Bs)}},Ss=function(t){if(!t||0===t.length)return new Vs(null);return new Vs(Us(t))};function Ps(t,e,n,r,i){this.mid=t,this.left=e,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(e?e.count:0)+(n?n.count:0)+r.length}var Ts=Ps.prototype;function Ds(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function js(t,e){var n=Us(e);t.mid=n.mid,t.left=n.left,t.right=n.right,t.leftPoints=n.leftPoints,t.rightPoints=n.rightPoints,t.count=n.count}function qs(t,e){var n=t.intervals([]);n.push(e),js(t,n)}function Ws(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?0:(n.splice(r,1),js(t,n),1)}function Ys(t,e,n){for(var r=0;r=0&&t[r][1]>=e;--r){var i=n(t[r]);if(i)return i}}function Fs(t,e){for(var n=0;n>1],i=[],o=[],a=[];for(n=0;n3*(e+1)?qs(this,t):this.left.insert(t):this.left=Us([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?qs(this,t):this.right.insert(t):this.right=Us([t]);else{var n=Ns.ge(this.leftPoints,t,Gs),r=Ns.ge(this.rightPoints,t,Xs);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}},Ts.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?Ws(this,t):2===(o=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===o&&(this.count-=1),o):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?Ws(this,t):2===(o=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===o&&(this.count-=1),o):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,r=this.left;r.right;)n=r,r=r.right;if(n===this)r.right=this.right;else{var i=this.left,o=this.right;n.count-=r.count,n.right=r.left,r.left=i,r.right=o}Ds(this,r),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?Ds(this,this.left):Ds(this,this.right);return 1}for(i=Ns.ge(this.leftPoints,t,Gs);ithis.mid){var n;if(this.right)if(n=this.right.queryPoint(t,e))return n;return Is(this.rightPoints,t,e)}return Fs(this.leftPoints,e)},Ts.queryInterval=function(t,e,n){var r;if(tthis.mid&&this.right&&(r=this.right.queryInterval(t,e,n)))return r;return ethis.mid?Is(this.rightPoints,t,n):Fs(this.leftPoints,n)};var Hs=Vs.prototype;Hs.insert=function(t){this.root?this.root.insert(t):this.root=new Ps(t[0],null,null,[t],[t])},Hs.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},Hs.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},Hs.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)},Object.defineProperty(Hs,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(Hs,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});const Zs=({marginLeft:t})=>[1,t],Qs=({width:t,marginRight:e})=>[-1,t-e],Js=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],Ks=({marginTop:t})=>[1,t],tl=({height:t,marginBottom:e})=>[-1,t-e],el=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function nl(t){return"string"==typeof t?{anchor:t}:t}function rl(t){const{anchor:e,padding:n,...r}=t;return[{anchor:e,padding:n},r]}function il(t,e,n,r,i){const{r:o}=i;if(null!=o&&"number"!=typeof o){const{channels:t,sort:e,reverse:n}=i;i={...i,channels:{r:{value:o,scale:"r"},...ot(t)}},void 0===e&&void 0===n&&(i.sort={channel:"r",order:"descending"})}return bt(i,(function(o,a,s,c,u,h){let{[e]:d,r:p}=s;if(!s[e])throw new Error(`missing channel: ${e}`);({[e]:d}=Rr(s,c,h));const g=p?void 0:void 0!==this.r?this.r:void 0!==i.r?m(i.r):3;p&&(p=pr(l(p.value,c[p.scale]||f)));let[y,v]=n(u);const x=y?al:ol,w=new Float64Array(d.length),b=p?t=>p[t]:()=>g;for(let t of a){const e=Ss();t=t.filter(p?t=>yt(d[t])&&vt(p[t]):t=>yt(d[t]));const n=new Float64Array(2*t.length+2);for(const i of t){const t=b(i),o=y?t+r:0,a=d[i]-t,s=d[i]+t;let l=2;e.queryInterval(a-r,s+r,(([,,t])=>{const e=w[t]-o,a=d[i]-d[t],s=r+(p?p[i]+p[t]:2*g),c=Math.sqrt(s*s-a*a);n[l++]=e-c,n[l++]=e+c}));let c=n.slice(0,l);y&&(c=c.filter((t=>t>=0)));t:for(const t of c.sort(x)){for(let e=0;et(j(n,e))));if(/^p\d{2}$/i.test(t))return cl(w(t));switch(`${t}`.toLowerCase()){case"deviation":return dl;case"first":return fl;case"last":return hl;case"max":return pl;case"mean":return ml;case"median":return gl;case"min":return yl;case"sum":return vl;case"extent":return ul}throw new Error(`invalid basis: ${t}`)}function ll(t){return{map(e,n,r){const i=+t(e,n);for(const t of e)r[t]=null===n[t]?NaN:n[t]/i}}}function cl(t){return ll(((e,n)=>t(e,(t=>n[t]))))}const ul={map(t,n,r){const[i,o]=e.extent(t,(t=>n[t])),a=o-i;for(const e of t)r[e]=null===n[e]?NaN:(n[e]-i)/a}},fl=ll(((t,e)=>{for(let n=0;n{for(let n=t.length-1;n>=0;--n){const r=e[t[n]];if(dt(r))return r}})),dl={map(t,n,r){const i=e.mean(t,(t=>n[t])),o=e.deviation(t,(t=>n[t]));for(const e of t)r[e]=null===n[e]?NaN:o?(n[e]-i)/o:0}},pl=cl(e.max),ml=cl(e.mean),gl=cl(e.median),yl=cl(e.min),vl=cl(e.sum);function xl(t={}){"number"==typeof t&&(t={k:t});let{k:n,reduce:r,shift:i,anchor:o,strict:a}=t;if(void 0===o&&void 0!==i&&(o=function(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}(i),Ee(`Warning: the shift option is deprecated; please use anchor "${o}" instead.`)),!((n=Math.floor(n))>0))throw new Error(`invalid k: ${n}`);return function(t="mean"){if("string"==typeof t){if(/^p\d{2}$/i.test(t))return bl(w(t));switch(t.toLowerCase()){case"deviation":return bl(e.deviation);case"max":return kl(e.max);case"mean":return Ml;case"median":return bl(e.median);case"min":return kl(e.min);case"mode":return kl(e.mode);case"sum":return $l;case"variance":return bl(e.variance);case"difference":return Ol;case"ratio":return Cl;case"first":return Bl;case"last":return El}}if("function"!=typeof t)throw new Error(`invalid reduce: ${t}`);return kl(t)}(r)(n,function(t="middle",e){switch(`${t}`.toLowerCase()){case"middle":return e-1>>1;case"start":return 0;case"end":return e-1}throw new Error(`invalid anchor: ${t}`)}(o,n),a)}function wl(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function bl(t){return(e,n,r)=>r?{map(r,i,o){const a=Float64Array.from(r,(t=>null===i[t]?NaN:i[t]));let s=0;for(let t=0;tnull===i[t]?NaN:i[t]));for(let i=-n;i<0;++i)o[r[i+n]]=t(a.subarray(0,i+e));for(let i=0,s=r.length-n;ir?{map(r,i,o){let a=0;for(let t=0;t=n;--i){const n=t[e[i]];if(dt(n))return n}}function zl(t,e,n,r){for(let i=n+r;n=n;--i){let n=t[e[i]];if(null!==n&&!isNaN(n=+n))return n}}function Ol(t,e,n){return n?{map(n,r,i){for(let o=0,a=n.length-t;on[t]))}function*ql(t,n){yield e.greatest(t,(t=>n[t]))}function Wl(t,n,r){if(null!=t){if(null==r[t])throw new Error(`missing channel: ${t}`);t=r[t]}const i=P(r);return wt(r,((r,o)=>{const a=l(r,i),s=l(r,t),c=[];for(const t of o){const r=[];for(const i of a?e.group(t,(t=>a[t])).values():[t])for(const t of n(i,s))r.push(t);c.push(r)}return{data:r,facets:c}}))}t.Area=Ki,t.Arrow=yo,t.BarX=bo,t.BarY=ko,t.Cell=ea,t.Density=ga,t.Dot=Po,t.Frame=wa,t.Geo=ka,t.Hexgrid=za,t.Image=Oa,t.Line=Ea,t.Link=ho,t.Mark=ti,t.Rect=Ga,t.RuleX=jo,t.RuleY=qo,t.Text=Ua,t.TickX=Go,t.TickY=Xo,t.Vector=As,t.area=function(t,e){return void 0===e?to(t,{x:y,y:v}):new Ki(t,e)},t.areaX=function(t,e){const{y:n=u,...r}=xi(e);return new Ki(t,Si(Ci({...r,y1:n,y2:void 0})))},t.areaY=to,t.arrow=function(t,e={}){let{x:n,x1:r,x2:i,y:o,y1:a,y2:s,...l}=e;return[r,i]=mo(n,r,i),[a,s]=mo(o,a,s),new yo(t,{...l,x1:r,x2:i,y1:a,y2:s})},t.barX=$o,t.barY=Mo,t.bin=function(t={fill:"count"},e={}){[t,e]=bi(t,e);const{x:n,y:r}=function(t){let{x:e,y:n}=t;return e=ki(e,t),n=ki(n,t),[e.value,n.value]=S(e.value,n.value),{x:e,y:n}}(e);return wi(n,r,null,null,t,tn(en(e)))},t.binX=mi,t.binY=gi,t.boxX=function(t,e={}){const{x:n={transform:t=>t},y:r=null,fill:i="#ccc",fillOpacity:o,stroke:a="currentColor",strokeOpacity:s,strokeWidth:l=2,sort:c,...u}=e,f=null!=r?Nt:Bt;return ei(Yo(t,f({x1:Zo,x2:Qo},{x:n,y:r,stroke:a,strokeOpacity:s,...u})),$o(t,f({x1:"p25",x2:"p75"},{x:n,y:r,fill:i,fillOpacity:o,...u})),Uo(t,f({x:"p50"},{x:n,y:r,stroke:a,strokeOpacity:s,strokeWidth:l,sort:c,...u})),To(t,zo({x:Ho},{x:n,y:r,z:r,stroke:a,strokeOpacity:s,...u})))},t.boxY=function(t,e={}){const{y:n={transform:t=>t},x:r=null,fill:i="#ccc",fillOpacity:o,stroke:a="currentColor",strokeOpacity:s,strokeWidth:l=2,sort:c,...u}=e,f=null!=r?Et:Bt;return ei(Wo(t,f({y1:Zo,y2:Qo},{x:r,y:n,stroke:a,strokeOpacity:s,...u})),Mo(t,f({y1:"p25",y2:"p75"},{x:r,y:n,fill:i,fillOpacity:o,...u})),Vo(t,f({y:"p50"},{x:r,y:n,stroke:a,strokeOpacity:s,strokeWidth:l,sort:c,...u})),To(t,zo({y:Ho},{x:r,y:n,z:r,stroke:a,strokeOpacity:s,...u})))},t.cell=function(t,e={}){let{x:n,y:r,...i}=e;return[n,r]=S(n,r),new ea(t,{...i,x:n,y:r})},t.cellX=function(t,e={}){let{x:n=u,fill:r,stroke:i,...o}=e;return void 0===r&&void 0===b(i)[0]&&(r=f),new ea(t,{...o,x:n,fill:r,stroke:i})},t.cellY=function(t,e={}){let{y:n=u,fill:r,stroke:i,...o}=e;return void 0===r&&void 0===b(i)[0]&&(r=f),new ea(t,{...o,y:n,fill:r,stroke:i})},t.circle=function(t,e){return To(t,{...e,symbol:"circle"})},t.cluster=function(t,n){return Ms(t,{...n,treeLayout:e.cluster})},t.column=Y,t.delaunayLink=function(t,e){return pa(sa,t,e)},t.delaunayMesh=function(t,e){return pa(ca,t,e)},t.density=function(t,e={}){let{x:n,y:r,...i}=e;return[n,r]=S(n,r),new ga(t,{...i,x:n,y:r})},t.dodgeX=function(t={},e={}){1===arguments.length&&([t,e]=rl(t));let{anchor:n="left",padding:r=1}=nl(t);switch(`${n}`.toLowerCase()){case"left":n=Zs;break;case"right":n=Qs;break;case"middle":n=Js;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return il("x","y",n,m(r),e)},t.dodgeY=function(t={},e={}){1===arguments.length&&([t,e]=rl(t));let{anchor:n="bottom",padding:r=1}=nl(t);switch(`${n}`.toLowerCase()){case"top":n=Ks;break;case"bottom":n=tl;break;case"middle":n=el;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return il("y","x",n,m(r),e)},t.dot=To,t.dotX=function(t,e={}){const{x:n=f,...r}=e;return new Po(t,dn({...r,x:n}))},t.dotY=function(t,e={}){const{y:n=f,...r}=e;return new Po(t,hn({...r,y:n}))},t.filter=function(t,e){return Mt(e,Lt(t))},t.formatIsoDate=Oe,t.formatMonth=function(t="en-US",e="short"){const n=ze(t,e);return t=>null==t||isNaN(t=+new Date(Date.UTC(2e3,+t)))?void 0:n.format(t)},t.formatWeekday=function(t="en-US",e="short"){const n=Re(t,e);return t=>null==t||isNaN(t=+new Date(Date.UTC(2001,0,+t)))?void 0:n.format(t)},t.frame=function(t){return new wa(t)},t.geo=$a,t.graticule=function({strokeOpacity:t=.1,...n}={}){return $a(e.geoGraticule10(),{strokeOpacity:t,...n})},t.group=function(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=S(n,r),null==n)throw new Error("missing channel: x");if(null==r)throw new Error("missing channel: y");return St(n,r,t,e)},t.groupX=Et,t.groupY=Nt,t.groupZ=Bt,t.hexagon=function(t,e){return To(t,{...e,symbol:"hexagon"})},t.hexbin=function(t={fill:"count"},{binWidth:e,...n}={}){e=void 0===e?20:m(e),t=Tt(t,n);const{z:r,fill:i,stroke:o}=n;return void 0===o&&et(i)&&Pt(t,"fill")&&(n.stroke="none"),void 0===n.symbol&&(n.symbol="hexagon"),void 0!==n.r||Pt(t,"r")||(n.r=e/2),bt(n,((n,i,o,a,s,c)=>{let{x:u,y:f,z:h,fill:d,stroke:p,symbol:m}=o;if(void 0===u)throw new Error("missing channel: x");if(void 0===f)throw new Error("missing channel: y");({x:u,y:f}=Rr(o,a,c)),h=h?h.value:l(n,r),d=d?.value,p=p?.value,m=m?.value;const g=Yt(t,{z:h,fill:d,stroke:p,symbol:m}),y=h&&[],v=d&&[],x=p&&[],w=m&&[],b=[],k=[],$=[];let M=-1;for(const e of t)e.initialize(n);for(const n of i){const r=[];for(const e of t)e.scope("facet",n);for(const[i,o]of qt(n,g))for(const n of La(o,u,f,e)){r.push(++M),k.push(n.x),$.push(n.y),h&&y.push(g===h?i:h[n[0]]),d&&v.push(g===d?i:d[n[0]]),p&&x.push(g===p?i:p[n[0]]),m&&w.push(g===m?i:m[n[0]]);for(const e of t)e.reduce(n)}b.push(r)}return{data:n,facets:b,channels:{x:{value:k},y:{value:$},...h&&{z:{value:y}},...d&&{fill:{value:v,scale:!0}},...p&&{stroke:{value:x,scale:!0}},...m&&{symbol:{value:w,scale:!0}},...Object.fromEntries(t.map((({name:t,output:n})=>[t,{scale:!0,radius:"r"===t?e/2:void 0,value:n.transform()}])))}}}))},t.hexgrid=function(t){return new za(t)},t.hull=function(t,e){return pa(ua,t,e)},t.image=function(t,e={}){let{x:n,y:r,...i}=e;return void 0===e.frameAnchor&&([n,r]=S(n,r)),new Oa(t,{...i,x:n,y:r})},t.initializer=bt,t.legend=function(t={}){for(const[e,n]of Hr){const r=t[e];if(C(r)){const i=Or(t);let o;if("symbol"===e){const{fill:e,stroke:n=(void 0===e&&C(t.color)?"color":void 0)}=t;o={fill:e,stroke:n}}return n(er(e,r,o),Zr(i,r,t),(e=>C(t[e])?er(e,t[e]):null))}}throw new Error("unknown legend type; no scale found")},t.line=function(t,e={}){let{x:n,y:r,...i}=e;return[n,r]=S(n,r),new Ea(t,{...i,x:n,y:r})},t.lineX=function(t,e={}){const{x:n=f,y:r=u,...i}=e;return new Ea(t,xi({...i,x:n,y:r}))},t.lineY=function(t,e={}){const{x:n=u,y:r=f,...i}=e;return new Ea(t,vi({...i,x:n,y:r}))},t.linearRegressionX=function(t,e={}){const{y:n=u,x:r=f,stroke:i,fill:o=(et(i)?"currentColor":i),...a}=e;return new Wa(t,xi({...a,x:r,y:n,fill:o,stroke:i}))},t.linearRegressionY=function(t,e={}){const{x:n=u,y:r=f,stroke:i,fill:o=(et(i)?"currentColor":i),...a}=e;return new Ya(t,vi({...a,x:n,y:r,fill:o,stroke:i}))},t.link=po,t.map=zo,t.mapX=Lo,t.mapY=Ao,t.marks=ei,t.normalize=sl,t.normalizeX=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),Lo(sl(t),e)},t.normalizeY=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),Ao(sl(t),e)},t.plot=Kr,t.rect=function(t,e){return new Ga(t,ln(cn(e)))},t.rectX=function(t,e={y:u,interval:1,x2:f}){return new Ga(t,Si(cn(Ci(e))))},t.rectY=function(t,e={x:u,interval:1,y2:f}){return new Ga(t,Pi(ln(Bi(e))))},t.reverse=function(t){return{...Mt(t,At),sort:null}},t.ruleX=Wo,t.ruleY=Yo,t.scale=function(t={}){let e;for(const n in t)if(ht.has(n)&&C(t[n])){if(void 0!==e)throw new Error("ambiguous scale definition; multiple scales found");e=yr(er(n,t[n]))}if(void 0===e)throw new Error("invalid scale definition; no scale found");return e},t.select=function(t,e={}){if("string"==typeof t)switch(t.toLowerCase()){case"first":return Sl(e);case"last":return Pl(e)}if("function"==typeof t)return Wl(null,t,e);let n,r;for(n in t){if(void 0!==r)throw new Error("ambiguous selector; multiple inputs");r=Nl(t[n])}if(void 0===r)throw new Error(`invalid selector: ${t}`);return Wl(n,r,e)},t.selectFirst=Sl,t.selectLast=Pl,t.selectMaxX=function(t){return Wl("x",ql,t)},t.selectMaxY=function(t){return Wl("y",ql,t)},t.selectMinX=function(t){return Wl("x",jl,t)},t.selectMinY=function(t){return Wl("y",jl,t)},t.shuffle=function(t={}){const{seed:n,...r}=t;return{...Mt(r,Ct(null==n?Math.random:e.randomLcg(n))),sort:null}},t.sort=zt,t.sphere=function({strokeWidth:t=1.5,...e}={}){return $a({type:"Sphere"},{strokeWidth:t,...e})},t.stackX=Ei,t.stackX1=function(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{y1:n,y:r=n,x:i}=e,[o,a,s]=Di(r,i,"x",t,e);return{...o,y1:n,y:a,x:s}},t.stackX2=function(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{y1:n,y:r=n,x:i}=e,[o,a,,s]=Di(r,i,"x",t,e);return{...o,y1:n,y:a,x:s}},t.stackY=Ni,t.stackY1=function(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{x1:n,x:r=n,y:i}=e,[o,a,s]=Di(r,i,"y",t,e);return{...o,x1:n,x:a,y:s}},t.stackY2=function(t={},e={}){1===arguments.length&&([t,e]=Ti(t));const{x1:n,x:r=n,y:i}=e,[o,a,,s]=Di(r,i,"y",t,e);return{...o,x1:n,x:a,y:s}},t.text=Ha,t.textX=function(t,e={}){const{x:n=f,...r}=e;return new Ua(t,dn({...r,x:n}))},t.textY=function(t,e={}){const{y:n=f,...r}=e;return new Ua(t,hn({...r,y:n}))},t.tickX=Uo,t.tickY=Vo,t.transform=wt,t.tree=Ms,t.treeLink=rs,t.treeNode=ns,t.valueof=l,t.vector=function(t,e={}){let{x:n,y:r,...i}=e;return void 0===e.frameAnchor&&([n,r]=S(n,r)),new As(t,{...i,x:n,y:r})},t.vectorX=function(t,e={}){const{x:n=f,...r}=e;return new As(t,{...r,x:n})},t.vectorY=function(t,e={}){const{y:n=f,...r}=e;return new As(t,{...r,y:n})},t.version="0.6.1",t.voronoi=function(t,e){return pa(fa,t,e)},t.voronoiMesh=function(t,e){return pa(ha,t,e)},t.window=xl,t.windowX=function(t={},e){return 1===arguments.length&&(e=t),Lo(xl(t),e)},t.windowY=function(t={},e){return 1===arguments.length&&(e=t),Ao(xl(t),e)}}));