blob: 814c85818ae1a453e28fecd0867eed8ee18a4618 [file] [log] [blame]
// @observablehq/plot v0.6.6 Copyright 2020-2023 Observable, Inc.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3@7.8.4/dist/d3.min.js")):"function"==typeof define&&define.amd?define(["exports","d3@7.8.4/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){return null!=t&&!Number.isNaN(t)}function r(t,r){return+n(r)-+n(t)||e.ascending(t,r)}function o(t,r){return+n(r)-+n(t)||e.descending(t,r)}function i(t){return null!=t&&""!=`${t}`}function a(t){return isFinite(t)?t:NaN}function l(t){return t>0&&isFinite(t)?t:NaN}function s(t){return t<0&&isFinite(t)?t:NaN}function c(t,e){if(t instanceof Date||(t=new Date(+t)),isNaN(t))return"function"==typeof e?e(t):e;const n=t.getUTCHours(),r=t.getUTCMinutes(),o=t.getUTCSeconds(),i=t.getUTCMilliseconds();return`${a=t.getUTCFullYear(),a<0?`-${u(-a,6)}`:a>9999?`+${u(a,6)}`:u(a,4)}-${u(t.getUTCMonth()+1,2)}-${u(t.getUTCDate(),2)}${n||r||o||i?`T${u(n,2)}:${u(r,2)}${o||i?`:${u(o,2)}${i?`.${u(i,3)}`:""}`:""}Z`:""}`;var a}function u(t,e){return`${t}`.padStart(e,"0")}const f=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function h(t,e){return f.test(t+="")?new Date(t):"function"==typeof e?e(t):e}const d=new Map([["second",e.timeSecond],["minute",e.timeMinute],["hour",e.timeHour],["day",e.timeDay],["week",e.timeWeek],["month",e.timeMonth],["quarter",e.timeMonth.every(3)],["half",e.timeMonth.every(6)],["year",e.timeYear],["monday",e.timeMonday],["tuesday",e.timeTuesday],["wednesday",e.timeWednesday],["thursday",e.timeThursday],["friday",e.timeFriday],["saturday",e.timeSaturday],["sunday",e.timeSunday]]),p=new Map([["second",e.utcSecond],["minute",e.utcMinute],["hour",e.utcHour],["day",e.utcDay],["week",e.utcWeek],["month",e.utcMonth],["quarter",e.utcMonth.every(3)],["half",e.utcMonth.every(6)],["year",e.utcYear],["monday",e.utcMonday],["tuesday",e.utcTuesday],["wednesday",e.utcWednesday],["thursday",e.utcThursday],["friday",e.utcFriday],["saturday",e.utcSaturday],["sunday",e.utcSunday]]);function m(t){const e=d.get(`${t}`.toLowerCase());if(!e)throw new Error(`unknown interval: ${t}`);return e}function g(t){const e=p.get(`${t}`.toLowerCase());if(!e)throw new Error(`unknown interval: ${t}`);return e}const y=Object.getPrototypeOf(Uint8Array),v=Object.prototype.toString;function x(t,e,n){const r=typeof e;return"string"===r?w(t,k(e),n):"function"===r?w(t,e,n):"number"===r||e instanceof Date||"boolean"===r?Y(t,C(e),n):b("function"==typeof e?.transform?e.transform(t):e,n)}function w(t,e,n){return Y(t,n?.prototype instanceof y?function(t){return(e,n)=>N(t(e,n))}(e):e,n)}function b(t,e){return void 0===e?F(t):t instanceof e?t:e.prototype instanceof y&&!(t instanceof y)?e.from(t,N):e.from(t)}const k=t=>e=>e[t],$={transform:J},M={transform:t=>t},L=()=>1,A=()=>!0,R=t=>null==t?t:`${t}`,z=t=>null==t?t:+t,O=t=>t?t[0]:void 0,E=t=>t?t[1]:void 0,S=t=>t?t[2]:void 0,C=t=>()=>t;function B(t){const n=+`${t}`.slice(1)/100;return(t,r)=>e.quantile(t,n,r)}function T(t){return t instanceof y?t:Y(t,N,Float64Array)}function N(t){return null==t?NaN:Number(t)}function I(t){return Y(t,P)}function P(t){return t instanceof Date&&!isNaN(t)?t:"string"==typeof t?h(t):null==t||isNaN(t=+t)?void 0:new Date(t)}function j(t,e){return void 0===t&&(t=e),null===t?[void 0,"none"]:vt(t)?[void 0,t]:[t,void 0]}function W(t,e){return void 0===t&&(t=e),null===t||"number"==typeof t?[void 0,t]:[t,void 0]}function D(t,e,n){if(null!=t)return q(t,e,n)}function q(t,e,n){const r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function F(t){return null==t||t instanceof Array||t instanceof y?t:Array.from(t)}function Y(t,e,n=Array){return null==t?t:t instanceof n?t.map(e):n.from(t,e)}function _(t,e=Array){return t instanceof e?t.slice():e.from(t)}function G(t){return t?.toString===v}function X(t){return G(t)&&(void 0!==t.type||void 0!==t.domain)}function U(t){return G(t)&&"function"!=typeof t.transform}function H(t){return U(t)&&void 0===t.value&&void 0===t.channel}function V(t,e,n,r=M){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 Z(t,e){return void 0===t&&void 0===e?[O,E]:[t,e]}function Q({z:t,fill:e,stroke:n}={}){return void 0===t&&([t]=j(e)),void 0===t&&([t]=j(n)),t}function J(t){const e=t.length,n=new Uint32Array(e);for(let t=0;t<e;++t)n[t]=t;return n}function K(t,e){return Y(e,(e=>t[e]))}function tt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function et(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 nt(t){let e;return[{transform:()=>e,label:ot(t)},t=>e=t]}function rt(t){return null==t?[t]:nt(t)}function ot(t,e){return"string"==typeof t?t:t&&void 0!==t.label?t.label:e}function at(t,e){return{transform(n){const r=t.transform(n),o=e.transform(n);return dt(r)||dt(o)?Y(r,((t,e)=>new Date((+r[e]+ +o[e])/2))):Y(r,((t,e)=>(+r[e]+ +o[e])/2),Float64Array)},label:t.label}}function lt(t,n){if(null!=t){if("number"==typeof t){0<t&&t<1&&Number.isInteger(1/t)&&(t=-1/t);const n=Math.abs(t);return t<0?{floor:t=>Math.floor(t*n)/n,offset:t=>(t*n+1)/n,range:(t,r)=>e.range(Math.ceil(t*n),r*n).map((t=>t/n))}:{floor:t=>Math.floor(t/n)*n,offset:t=>t+n,range:(t,r)=>e.range(Math.ceil(t/n),r/n).map((t=>t*n))}}if("string"==typeof t)return("time"===n?m:g)(t);if("function"!=typeof t.floor)throw new Error("invalid interval; missing floor method");if("function"!=typeof t.offset)throw new Error("invalid interval; missing offset method");return t}}function st(t,e){if((t=lt(t,e))&&"function"!=typeof t.range)throw new Error("invalid interval: missing range method");return t}function ct(t){return void 0===t||U(t)?t:{value:t}}function ut(t){return t&&"function"==typeof t[Symbol.iterator]}function ft(t){for(const e of t)if(null!=e)return"object"!=typeof e||e instanceof Date}function ht(t){for(const e of t){if(null==e)continue;const t=typeof e;return"string"===t||"boolean"===t}}function dt(t){for(const e of t)if(null!=e)return e instanceof Date}function pt(t){for(const e of t)if(null!=e)return"string"==typeof e&&isNaN(e)&&h(e)}function mt(t){for(const e of t)if(null!=e){if("string"!=typeof e)return!1;if(e.trim())return!isNaN(e)}}function gt(t){for(const e of t)if(null!=e)return"number"==typeof e}function yt(t,e){let n;for(const r of t)if(null!=r){if(!e(r))return!1;n=!0}return n}function vt(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 xt(t){return"number"==typeof t&&(0<=t&&t<=1||isNaN(t))}function wt(t){return null==t||bt(t)}function bt(t){return/^\s*none\s*$/i.test(t)}function kt(t="middle"){return q(t,"frameAnchor",["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function $t(t){if(null==t)return;const n=t[0],r=t[t.length-1];return e.descending(n,r)}function Mt(t){return ut(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 Lt=Symbol("position"),At=Symbol("color"),Rt=Symbol("radius"),zt=Symbol("length"),Ot=Symbol("opacity"),Et=Symbol("symbol"),St=new Map([["x",Lt],["y",Lt],["fx",Lt],["fy",Lt],["r",Rt],["color",At],["opacity",Ot],["symbol",Et],["length",zt]]),Ct=Math.sqrt(3),Bt=2/Ct,Tt={draw(t,e){const n=Math.sqrt(e/Math.PI),r=n*Bt,o=r/2;t.moveTo(0,r),t.lineTo(n,o),t.lineTo(n,-o),t.lineTo(0,-r),t.lineTo(-n,-o),t.lineTo(-n,o),t.closePath()}},Nt=new Map([["asterisk",e.symbolAsterisk],["circle",e.symbolCircle],["cross",e.symbolCross],["diamond",e.symbolDiamond],["diamond2",e.symbolDiamond2],["hexagon",Tt],["plus",e.symbolPlus],["square",e.symbolSquare],["square2",e.symbolSquare2],["star",e.symbolStar],["times",e.symbolTimes],["triangle",e.symbolTriangle],["triangle2",e.symbolTriangle2],["wye",e.symbolWye]]);function It(t){return t&&"function"==typeof t.draw}function Pt(t){return!!It(t)||"string"==typeof t&&Nt.has(t.toLowerCase())}function jt(t){if(null==t||It(t))return t;const e=Nt.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function Wt({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},a){if(void 0===r&&(null!=t&&(r=_t(t)),null==e||H(e)||(r=qt(r,Ut(e))),n&&(r=qt(r,Gt))),null!=a&&null!=o)throw new Error("transforms cannot be applied after initializers");return{...i,...(null===e||H(e))&&{sort:e},transform:qt(r,a)}}function Dt({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return void 0===r&&(null!=t&&(r=_t(t)),null==e||H(e)||(r=Ft(r,Ut(e))),n&&(r=Ft(r,Gt))),{...o,...(null===e||H(e))&&{sort:e},initializer:Ft(r,i)}}function qt(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,F(n),r)}}function Ft(t,e){return null==t?null===e?void 0:e:null==e?null===t?void 0:t:function(n,r,o,...i){let a,l,s,c,u,f;return({data:l=n,facets:s=r,channels:a}=t.call(this,n,r,o,...i)),({data:u=l,facets:f=s,channels:c}=e.call(this,l,s,{...o,...a},...i)),{data:u,facets:f,channels:{...a,...c}}}}function Yt(t,e){return(null!=t.initializer?Dt:Wt)(t,e)}function _t(t){return(e,n)=>{const r=x(e,t);return{data:e,facets:n.map((t=>t.filter((t=>r[t]))))}}}function Gt(t,e){return{data:t,facets:e.map((t=>t.slice().reverse()))}}function Xt(t,{sort:e,...n}={}){return{...(U(t)&&void 0!==t.channel?Dt:Yt)(n,Ut(t)),sort:H(e)?e:null}}function Ut(t){return("function"==typeof t&&1!==t.length?Ht:Vt)(t)}function Ht(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 Vt(t){let e,n;if(({channel:e,value:t,order:n=r}={...ct(t)}),"function"!=typeof n)switch(`${n}`.toLowerCase()){case"ascending":n=r;break;case"descending":n=o;break;default:throw new Error(`invalid order: ${n}`)}return(r,o,i)=>{let a;if(void 0===e)a=x(r,t);else{if(void 0===i)throw new Error("channel sort requires an initializer");if(a=i[e],!a)return{};a=a.value}const l=(t,e)=>n(a[t],a[e]);return{data:r,facets:o.map((t=>t.slice().sort(l)))}}}function Zt(t,e){return te(null,null,t,e)}function Qt(t={y:"count"},e={}){const{x:n=M}=e;if(null==n)throw new Error("missing channel: x");return te(n,null,t,e)}function Jt(t={x:"count"},e={}){const{y:n=M}=e;if(null==n)throw new Error("missing channel: y");return te(null,n,t,e)}function Kt(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=Z(n,r),null==n)throw new Error("missing channel: x");if(null==r)throw new Error("missing channel: y");return te(n,r,t,e)}function te(t,e,{data:n=he,filter:r,sort:o,reverse:i,...a}={},l={}){a=ne(a,l),n=ae(n,M),o=null==o?void 0:re("sort",o,l),r=null==r?void 0:oe("filter",r,l);const[s,c]=rt(t),[u,f]=rt(e),{z:h,fill:d,stroke:p,x1:m,x2:g,y1:y,y2:v,...w}=l,[b,k]=rt(h),[$]=j(d),[L]=j(p),[A,R]=rt($),[z,O]=rt(L);return{..."z"in l&&{z:b||h},..."fill"in l&&{fill:A||d},..."stroke"in l&&{stroke:z||p},...Wt(w,((l,s)=>{const u=x(l,t),d=x(l,e),p=x(l,h),m=x(l,$),g=x(l,L),y=se(a,{z:p,fill:m,stroke:g}),v=[],w=[],b=u&&c([]),M=d&&f([]),A=p&&k([]),z=m&&R([]),E=g&&O([]);let S=0;for(const t of a)t.initialize(l);o&&o.initialize(l),r&&r.initialize(l);for(const t of s){const e=[];for(const e of a)e.scope("facet",t);o&&o.scope("facet",t),r&&r.scope("facet",t);for(const[i,s]of ie(t,y))for(const[t,c]of ie(s,d))for(const[s,f]of ie(c,u))if(!r||r.reduce(f)){e.push(S++),w.push(n.reduceIndex(f,l)),u&&b.push(s),d&&M.push(t),p&&A.push(y===p?i:p[f[0]]),m&&z.push(y===m?i:m[f[0]]),g&&E.push(y===g?i:g[f[0]]);for(const t of a)t.reduce(f);o&&o.reduce(f)}v.push(e)}return ce(v,o,i),{data:w,facets:v}})),...!ee(a,"x")&&(s?{x:s}:{x1:m,x2:g}),...!ee(a,"y")&&(u?{y:u}:{y1:y,y2:v}),...Object.fromEntries(a.map((({name:t,output:e})=>[t,e])))}}function ee(t,...e){for(const{name:n}of t)if(e.includes(n))return!0;return!1}function ne(t,e,n=re){const r=Object.entries(t);return null!=e.title&&void 0===t.title&&r.push(["title",pe]),null!=e.href&&void 0===t.href&&r.push(["href",de]),r.filter((([,t])=>void 0!==t)).map((([t,r])=>null===r?function(t){return{name:t,initialize(){},scope(){},reduce(){}}}(t):n(t,r,e)))}function re(t,e,n,r=oe){let o;G(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);const i=r(t,e,n),[a,l]=nt(i.label);let s;return{name:t,output:void 0===o?a:{value:a,scale:o},initialize(t){i.initialize(t),s=l([])},scope(t,e){i.scope(t,e)},reduce(t,e){s.push(i.reduce(t,e))}}}function oe(t,e,n,r=ae){const o=et(t,n),i=r(e,o);let a,l;return{label:ot(i===ge?null:o,i.label),initialize(t){a=void 0===o?t:x(t,o),"data"===i.scope&&(l=i.reduceIndex(J(t),a))},scope(t,e){i.scope===t&&(l=i.reduceIndex(e,a))},reduce:(t,e)=>null==i.scope?i.reduceIndex(t,a,e):i.reduceIndex(t,a,l,e)}}function ie(t,n){return n?e.sort(e.group(t,(t=>n[t])),O):[[,t]]}function ae(t,n,r=le){if(null==t)return r(t);if("function"==typeof t.reduceIndex)return t;if("function"==typeof t.reduce&&G(t))return function(t){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...t,reduceIndex:t.reduce.bind(t)}}(t);if("function"==typeof t)return o=t,{reduceIndex:(t,e,n)=>o(K(e,t),n)};var o;if(/^p\d{2}$/i.test(t))return ue(B(t));switch(`${t}`.toLowerCase()){case"first":return de;case"last":return me;case"identity":return he;case"count":return ge;case"distinct":return ye;case"sum":return null==n?ge:ve;case"proportion":return xe(n,"data");case"proportion-facet":return xe(n,"facet");case"deviation":return ue(e.deviation);case"min":return ue(e.min);case"min-index":return ue(e.minIndex);case"max":return ue(e.max);case"max-index":return ue(e.maxIndex);case"mean":return fe(e.mean);case"median":return fe(e.median);case"variance":return ue(e.variance);case"mode":return ue(e.mode)}return r(t)}function le(t){throw new Error(`invalid reduce: ${t}`)}function se(t,e){for(const n in e){const r=e[n];if(void 0!==r&&!t.some((t=>t.name===n)))return r}}function ce(t,e,n){if(e){const n=e.output.transform(),o=(t,e)=>r(n[t],n[e]);t.forEach((t=>t.sort(o)))}n&&t.forEach((t=>t.reverse()))}function ue(t){return{reduceIndex:(e,n)=>t(e,(t=>n[t]))}}function fe(t){return{reduceIndex(e,n){const r=t(e,(t=>n[t]));return dt(n)?new Date(r):r}}}const he={reduceIndex:(t,e)=>K(e,t)},de={reduceIndex:(t,e)=>e[t[0]]},pe={reduceIndex(t,n){const r=e.sort(e.rollup(t,(t=>t.length),(t=>n[t])),E),o=r.slice(-5).reverse();if(o.length<r.length){const t=r.slice(0,-4);o[4]=[`… ${t.length.toLocaleString("en-US")} more`,e.sum(t,E)]}return o.map((([t,e])=>`${t} (${e.toLocaleString("en-US")})`)).join("\n")}},me={reduceIndex:(t,e)=>e[t[t.length-1]]},ge={label:"Frequency",reduceIndex:t=>t.length},ye={label:"Distinct",reduceIndex(t,n){const r=new e.InternSet;for(const e of t)r.add(n[e]);return r.size}},ve=ue(e.sum);function xe(t,n){return null==t?{scope:n,label:"Frequency",reduceIndex:(t,e,n=1)=>t.length/n}:{scope:n,reduceIndex:(t,n,r=1)=>e.sum(t,(t=>n[t]))/r}}function we(t,{scale:e,type:n,value:r,filter:o,hint:i},a){return $e(a,{scale:e,type:n,value:x(t,r),label:ot(r),filter:o,hint:i})}function be(t,e){return Object.fromEntries(Object.entries(t).map((([t,n])=>[t,we(e,n,t)])))}function ke(t,e){const n=Object.fromEntries(Object.entries(t).map((([t,{scale:n,value:r}])=>{const o=null==n?null:e[n];return[t,null==o?r:Y(r,o)]})));return n.channels=t,n}function $e(t,e){const{scale:n,value:r}=e;if(!0===n||"auto"===n)switch(t){case"fill":case"stroke":case"color":e.scale=!0!==n&&yt(r,vt)?null:"color";break;case"fillOpacity":case"strokeOpacity":e.scale=!0!==n&&yt(r,xt)?null:"opacity";break;case"symbol":!0!==n&&yt(r,Pt)?(e.scale=null,e.value=Y(r,jt)):e.scale="symbol";break;default:e.scale=St.has(t)?t:null}else if(!1===n)e.scale=null;else if(null!=n&&!St.has(n))throw new Error(`unknown scale: ${n}`);return e}function Me(t,e){for(const n in t){const r=t[n];if(r.scale===e)return r}}function Le(t,e){const n=t.original;if(n===t)return e;const r=e.value,o=e.value=[];for(let e=0;e<n.length;++e){const i=r[n[e][0]];for(const n of t[e])o[n]=i}return e}function Ae(t,e,n){const r=Re(t,e);return Y(Re(t,n),((t,e)=>Math.abs(t-r[e])),Float64Array)}function Re(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 ze([t,e],[n,o]){return r(e,o)||r(t,n)}function Oe([t,e],[n,i]){return o(e,i)||r(t,n)}let Ee=0;function Se(t){console.warn(t),++Ee}const Ce=Math.PI,Be=2*Ce,Te=.618;function Ne({projection:t,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:a=n}={},l){if(null==t)return;if("function"==typeof t.stream)return t;let s,c,u="frame";if(G(t)){let e;if(({type:t,domain:c,inset:e,insetTop:r=(void 0!==e?e:r),insetRight:o=(void 0!==e?e:o),insetBottom:i=(void 0!==e?e:i),insetLeft:a=(void 0!==e?e:a),clip:u=u,...s}=t),null==t)return}"function"!=typeof t&&({type:t}=Ie(t));const{width:f,height:h,marginLeft:d,marginRight:p,marginTop:m,marginBottom:g}=l,y=f-d-p-a-o,v=h-m-g-r-i;if(t=t?.({width:y,height:v,clip:u,...s}),null==t)return;u=function(t,n,r,o,i){if(!1===t||null==t||"number"==typeof t)return t=>t;!0===t&&(t="frame");if("frame"===`${t}`.toLowerCase())return e.geoClipRectangle(n,r,o,i);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],[o,i]]=e.geoPath(t).bounds(c),a=Math.min(y/(o-n),v/(i-r));a>0?(w-=(a*(n+o)-y)/2,b-=(a*(r+i)-v)/2,x=e.geoTransform({point(t,e){this.stream.point(t*a+w,e*a+b)}})):Se("Warning: the projection could not be fit to the specified domain; using the default scale.")}return x??=0===w&&0===b?We():e.geoTransform({point(t,e){this.stream.point(t+w,e+b)}}),{stream:e=>t.stream(x.stream(u(e)))}}function Ie(t){switch(`${t}`.toLowerCase()){case"albers-usa":return Pe(e.geoAlbersUsa,.7463,.4673);case"albers":return je(e.geoAlbers,.7463,.4673);case"azimuthal-equal-area":return Pe(e.geoAzimuthalEqualArea,4,4);case"azimuthal-equidistant":return Pe(e.geoAzimuthalEquidistant,Be,Be);case"conic-conformal":return je(e.geoConicConformal,Be,Be);case"conic-equal-area":return je(e.geoConicEqualArea,6.1702,2.9781);case"conic-equidistant":return je(e.geoConicEquidistant,7.312,3.6282);case"equal-earth":return Pe(e.geoEqualEarth,5.4133,2.6347);case"equirectangular":return Pe(e.geoEquirectangular,Be,Ce);case"gnomonic":return Pe(e.geoGnomonic,3.4641,3.4641);case"identity":return{type:We};case"reflect-y":return{type:De};case"mercator":return Pe(e.geoMercator,Be,Be);case"orthographic":return Pe(e.geoOrthographic,2,2);case"stereographic":return Pe(e.geoStereographic,2,2);case"transverse-mercator":return Pe(e.geoTransverseMercator,Be,Be);default:throw new Error(`unknown projection type: ${t}`)}}function Pe(t,e,n){return{type:({width:r,height:o,rotate:i,precision:a=.15,clip:l})=>{const s=t();return null!=a&&s.precision?.(a),null!=i&&s.rotate?.(i),"number"==typeof l&&s.clipAngle?.(l),s.scale(Math.min(r/e,o/n)),s.translate([r/2,o/2]),s},aspectRatio:n/e}}function je(t,e,n){const{type:r,aspectRatio:o}=Pe(t,e,n);return{type:t=>{const{parallels:e,domain:n,width:o,height:i}=t,a=r(t);return null!=e&&(a.parallels(e),void 0===n&&a.fitSize([o,i],{type:"Sphere"})),a},aspectRatio:o}}const We=C({stream:t=>t}),De=C(e.geoTransform({point(t,e){this.stream.point(t,-e)}}));function qe(t,e,n,r,o){const i=n[t]&&"x"===n[t].scale,a=n[e]&&"y"===n[e].scale;if(i&&a)!function(t,e,n,r){const o=n[t],i=n[e],a=o.length,l=n[t]=new Float64Array(a).fill(NaN),s=n[e]=new Float64Array(a).fill(NaN);let c;const u=r.stream({point(t,e){l[c]=t,s[c]=e}});for(c=0;c<a;++c)u.point(o[c],i[c])}(t,e,r,o.projection);else{if(i)throw new Error(`projection requires paired x and y channels; ${t} is missing ${e}`);if(a)throw new Error(`projection requires paired x and y channels; ${e} is missing ${t}`)}}function Fe(t,e,n){const{x:r,y:o}=t;let i={};return r&&(i.x=r),o&&(i.y=o),i=ke(i,e),n.projection&&qe("x","y",t,i,n),r&&(i.x=T(i.x)),o&&(i.y=T(i.y)),i}function Ye(t={},e,n){const{document:r=("undefined"!=typeof window?window.document:void 0)}=t;return{document:r,className:n,projection:Ne(t,e)}}function _e(t,{document:n}){return e.select(e.creator(t).call(n.documentElement))}const Ge=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",Ue(e.schemeBrBG,e.interpolateBrBG)],["prgn",Ue(e.schemePRGn,e.interpolatePRGn)],["piyg",Ue(e.schemePiYG,e.interpolatePiYG)],["puor",Ue(e.schemePuOr,e.interpolatePuOr)],["rdbu",Ue(e.schemeRdBu,e.interpolateRdBu)],["rdgy",Ue(e.schemeRdGy,e.interpolateRdGy)],["rdylbu",Ue(e.schemeRdYlBu,e.interpolateRdYlBu)],["rdylgn",Ue(e.schemeRdYlGn,e.interpolateRdYlGn)],["spectral",Ue(e.schemeSpectral,e.interpolateSpectral)],["burd",He(e.schemeRdBu,e.interpolateRdBu)],["buylrd",He(e.schemeRdYlBu,e.interpolateRdYlBu)],["blues",Xe(e.schemeBlues,e.interpolateBlues)],["greens",Xe(e.schemeGreens,e.interpolateGreens)],["greys",Xe(e.schemeGreys,e.interpolateGreys)],["oranges",Xe(e.schemeOranges,e.interpolateOranges)],["purples",Xe(e.schemePurples,e.interpolatePurples)],["reds",Xe(e.schemeReds,e.interpolateReds)],["turbo",Ve(e.interpolateTurbo)],["viridis",Ve(e.interpolateViridis)],["magma",Ve(e.interpolateMagma)],["inferno",Ve(e.interpolateInferno)],["plasma",Ve(e.interpolatePlasma)],["cividis",Ve(e.interpolateCividis)],["cubehelix",Ve(e.interpolateCubehelixDefault)],["warm",Ve(e.interpolateWarm)],["cool",Ve(e.interpolateCool)],["bugn",Xe(e.schemeBuGn,e.interpolateBuGn)],["bupu",Xe(e.schemeBuPu,e.interpolateBuPu)],["gnbu",Xe(e.schemeGnBu,e.interpolateGnBu)],["orrd",Xe(e.schemeOrRd,e.interpolateOrRd)],["pubu",Xe(e.schemePuBu,e.interpolatePuBu)],["pubugn",Xe(e.schemePuBuGn,e.interpolatePuBuGn)],["purd",Xe(e.schemePuRd,e.interpolatePuRd)],["rdpu",Xe(e.schemeRdPu,e.interpolateRdPu)],["ylgn",Xe(e.schemeYlGn,e.interpolateYlGn)],["ylgnbu",Xe(e.schemeYlGnBu,e.interpolateYlGnBu)],["ylorbr",Xe(e.schemeYlOrBr,e.interpolateYlOrBr)],["ylorrd",Xe(e.schemeYlOrRd,e.interpolateYlOrRd)],["rainbow",Ze(e.interpolateRainbow)],["sinebow",Ze(e.interpolateSinebow)]]);function Xe(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 Ue(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 He(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 Ve(t){return({length:n})=>e.quantize(t,Math.max(2,Math.floor(n)))}function Ze(t){return({length:n})=>e.quantize(t,Math.floor(n)+1).slice(0,-1)}function Qe(t){const e=`${t}`.toLowerCase();if(!Ge.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return Ge.get(e)}function Je(t,e){const n=Qe(t),r="function"==typeof n?n({length:e}):n;return r.length!==e?r.slice(0,e):r}const Ke=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 tn(t){const e=`${t}`.toLowerCase();if(!Ke.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return Ke.get(e)}const en=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function nn(t){return null!=t&&en.has(`${t}`.toLowerCase())}const rn=t=>e=>t(1-e),on=[0,1],an=new Map([["number",e.interpolateNumber],["rgb",e.interpolateRgb],["hsl",e.interpolateHsl],["hcl",e.interpolateHcl],["lab",e.interpolateLab]]);function ln(t){const e=`${t}`.toLowerCase();if(!an.has(e))throw new Error(`unknown interpolator: ${e}`);return an.get(e)}function sn(t,n,r,{type:o,nice:i,clamp:a,zero:l,domain:s=hn(t,r),unknown:c,round:u,scheme:f,interval:h,range:d=(St.get(t)===Rt?pn(r,s):St.get(t)===zt?mn(r,s):St.get(t)===Ot?on:void 0),interpolate:p=(St.get(t)===At?null==f&&void 0!==d?e.interpolateRgb:tn(void 0!==f?f:"cyclical"===o?"rainbow":"turbo"):u?e.interpolateRound:e.interpolateNumber),reverse:m}){if(h=st(h,o),"cyclical"!==o&&"sequential"!==o||(o="linear"),m=!!m,"function"!=typeof p&&(p=ln(p)),1===p.length?(m&&(p=rn(p),m=!1),void 0===d&&2===(d=Float64Array.from(s,((t,e)=>e/(s.length-1)))).length&&(d=on),n.interpolate((d===on?C:vn)(p))):n.interpolate(p),l){const[t,n]=e.extent(s);(t>0||n<0)&&($t(s=_(s))!==Math.sign(t)?s[s.length-1]=0:s[0]=0)}return m&&(s=e.reverse(s)),n.domain(s).unknown(c),i&&(n.nice(function(t,e){return!0===t?void 0:"number"==typeof t?t:function(t,e){if((t=st(t,e))&&"function"!=typeof t.ceil)throw new Error("invalid interval: missing ceil method");return t}(t,e)}(i,o)),s=n.domain()),void 0!==d&&n.range(d),a&&n.clamp(a),{type:o,domain:s,range:d,scale:n,interpolate:p,interval:h}}function cn(t,n,{exponent:r=1,...o}){return sn(t,e.scalePow().exponent(r),n,{...o,type:"pow"})}function un(t,n,{domain:r=[0],unknown:o,scheme:i="rdylbu",interpolate:a,range:l=(void 0!==a?e.quantize(a,r.length+1):St.get(t)===At?Je(i,r.length+1):void 0),reverse:s}){const c=$t(r=F(r));if(!isNaN(c)&&!function(t,n){for(let r=1,o=t.length,i=t[0];r<o;++r){const o=e.descending(i,i=t[r]);if(0!==o&&o!==n)return!1}return!0}(r,c))throw new Error(`the ${t} scale has a non-monotonic domain`);return s&&(l=e.reverse(l)),{type:"threshold",scale:e.scaleThreshold(c<0?e.reverse(r):r,void 0===l?[]:l).unknown(o),domain:r,range:l}}function fn(t,n=a){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 hn(t,e){const n=St.get(t);return(n===Rt||n===Ot||n===zt?dn:fn)(e)}function dn(t){return[0,t.length?e.max(t,(({value:t})=>void 0===t?t:e.max(t,a))):1]}function pn(t,n){const r=t.find((({radius:t})=>void 0!==t));if(void 0!==r)return[0,r.radius];const o=e.quantile(t,.5,(({value:t})=>void 0===t?NaN:e.quantile(t,.25,l))),i=n.map((t=>3*Math.sqrt(t/o))),a=30/e.max(i);return a<1?i.map((t=>t*a)):i}function mn(t,n){const r=e.median(t,(({value:t})=>void 0===t?NaN:e.median(t,Math.abs))),o=n.map((t=>12*t/r)),i=60/e.max(o);return i<1?o.map((t=>t*i)):o}function gn(t){for(const{value:e}of t)if(void 0!==e)for(let n of e){if(n>0)return fn(t,l);if(n<0)return fn(t,s)}return[1,10]}function yn(t){const e=[];for(const{value:n}of t)if(void 0!==n)for(const t of n)e.push(t);return e}function vn(t){return(e,n)=>r=>t(e+r*(n-e))}function xn(t,n,r,o,{type:i,nice:a,clamp:l,domain:s=fn(o),unknown:c,pivot:u=0,scheme:f,range:h,symmetric:d=!0,interpolate:p=(St.get(t)===At?null==f&&void 0!==h?e.interpolateRgb:tn(void 0!==f?f:"rdbu"):e.interpolateNumber),reverse:m}){u=+u;let[g,y]=s;if(e.descending(g,y)<0&&([g,y]=[y,g],m=!m),g=Math.min(g,u),y=Math.max(y,u),"function"!=typeof p&&(p=ln(p)),void 0!==h&&(p=1===p.length?vn(p)(...h):e.piecewise(p,h)),m&&(p=rn(p)),d){const t=r.apply(u),e=t-r.apply(g),n=r.apply(y)-t;e<n?g=r.invert(t-n):e>n&&(y=r.invert(t+e))}return n.domain([g,u,y]).unknown(c).interpolator(p),l&&n.clamp(l),a&&n.nice(a),{type:i,domain:[g,y],pivot:u,interpolate:p,scale:n}}function wn(t,n,{exponent:r=1,...o}){return xn(t,e.scaleDivergingPow().exponent(r=+r),function(t){return.5===t?Mn:{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,{...o,type:"diverging-pow"})}function bn(t,n,{constant:r=1,...o}){return xn(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,o)}const kn={apply:t=>t,invert:t=>t},$n={apply:Math.log,invert:Math.exp},Mn={apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*(t*t)};function Ln(t,e,n,r){return sn(t,e,n,r)}const An=Symbol("ordinal");function Rn(t,n,r,{type:o,interval:i,domain:a,range:l,reverse:s,hint:c}){return i=st(i,o),void 0===a&&(a=En(r,i,t)),"categorical"!==o&&o!==An||(o="ordinal"),s&&(a=e.reverse(a)),n.domain(a),void 0!==l&&("function"==typeof l&&(l=l(a)),n.range(l)),{type:o,domain:a,range:l,scale:n,hint:c,interval:i}}function zn(t,n,{type:r,interval:o,domain:i,range:a,scheme:l,unknown:s,...c}){let u;if(o=st(o,r),void 0===i&&(i=En(n,o,t)),St.get(t)===Et)u=function(t){return{fill:Sn(t,"fill"),stroke:Sn(t,"stroke")}}(n),a=void 0===a?function(t){return wt(t.fill)?e.symbolsStroke:e.symbolsFill}(u):Y(a,jt);else if(St.get(t)===At&&(void 0!==a||"ordinal"!==r&&r!==An||(a=function(t,e="greys"){const n=new Set,[r,o]=Je(e,2);for(const e of t)if(null!=e)if(!0===e)n.add(o);else{if(!1!==e)return;n.add(r)}return[...n]}(i,l),void 0!==a&&(l=void 0)),void 0===l&&void 0===a&&(l="ordinal"===r?"turbo":"tableau10"),void 0!==l))if(void 0!==a){const t=tn(l),n=a[0],r=a[1]-a[0];a=({length:o})=>e.quantize((e=>t(n+r*e)),o)}else a=Qe(l);if(s===e.scaleImplicit)throw new Error(`implicit unknown on ${t} scale is not supported`);return Rn(t,e.scaleOrdinal().unknown(s),n,{...c,type:r,domain:i,range:a,hint:u})}function On(t,e,n,r){let{round:o}=n;return void 0!==o&&t.round(o=!!o),(t=Rn(r,t,e,n)).round=o,t}function En(t,n,o){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&&St.get(o)===Lt)throw new Error(`implicit ordinal domain of ${o} scale has more than 10,000 values`);return e.sort(i,r)}function Sn(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 Cn(t,{label:e,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:a=n,round:l,nice:s,clamp:c,zero:u,align:f,padding:h,projection:d,facet:{label:p=e}={},...m}={}){const g={};for(const[n,y]of t){const t=m[n],v=Fn(n,y,{round:St.get(n)===Lt?l:void 0,nice:s,clamp:c,zero:u,align:f,padding:h,projection:d,...t});if(v){let{label:l=("fx"===n||"fy"===n?p:e),percent:s,transform:c,inset:u,insetTop:f=(void 0!==u?u:"y"===n?r:0),insetRight:h=(void 0!==u?u:"x"===n?o:0),insetBottom:d=(void 0!==u?u:"y"===n?i:0),insetLeft:m=(void 0!==u?u:"x"===n?a:0)}=t||{};if(null==c)c=void 0;else if("function"!=typeof c)throw new Error("invalid scale transform; not a function");v.percent=!!s,v.label=void 0===l?Tn(y,v):l,v.transform=c,"x"===n||"fx"===n?(v.insetLeft=+m,v.insetRight=+h):"y"!==n&&"fy"!==n||(v.insetTop=+f,v.insetBottom=+d),g[n]=v}}return g}function Bn(t){return Object.fromEntries(Object.entries(t).filter((([,{scale:t}])=>t)).map((([t,{scale:e,type:n,interval:r,label:o}])=>(e.type=n,null!=r&&(e.interval=r),null!=o&&(e.label=o),[t,e]))))}function Tn(t=[],e){let n;for(const{label:e}of t)if(void 0!==e)if(void 0===n)n=e;else if(n!==e)return;if(!(void 0===n||Xn(e)&&/^(date|time|year)$/i.test(n)))return!Un(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Nn(t){const{marginTop:e,marginRight:n,marginBottom:r,marginLeft:o,width:i,height:a,facet:{marginTop:l,marginRight:s,marginBottom:c,marginLeft:u}}=t;return{marginTop:Math.max(e,l),marginRight:Math.max(n,s),marginBottom:Math.max(r,c),marginLeft:Math.max(o,u),width:i,height:a}}function In({fx:t,fy:e},n){const{marginTop:r,marginRight:o,marginBottom:i,marginLeft:a,width:l,height:s}=Nn(n);return{marginTop:r,marginRight:o,marginBottom:i,marginLeft:a,width:t?t.scale.bandwidth()+a+o:l,height:e?e.scale.bandwidth()+r+i:s}}function Pn(t,e){if(void 0===t.range){const{insetLeft:n,insetRight:r}=t,{width:o,marginLeft:i=0,marginRight:a=0}=e,l=i+n,s=o-a-r;t.range=[l,Math.max(l,s)],Un(t)||(t.range=Dn(t)),t.scale.range(t.range)}Wn(t)}function jn(t,e){if(void 0===t.range){const{insetTop:n,insetBottom:r}=t,{height:o,marginTop:i=0,marginBottom:a=0}=e,l=i+n,s=o-a-r;t.range=[Math.max(l,s),l],Un(t)?t.range.reverse():t.range=Dn(t),t.scale.range(t.range)}Wn(t)}function Wn(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(),o=t.paddingInner?t.paddingInner():1,i=t.paddingOuter?t.paddingOuter():t.padding(),a=e-o,l=Math.abs(r-n)/Math.max(1,a+2*i);return(l-Math.floor(l))*a}(t)<=30&&t.scale.round(!0)}function Dn(t){const e=t.scale.domain().length+Hn(t);if(!(e>2))return t.range;const[n,r]=t.range;return Array.from({length:e},((t,o)=>n+o/(e-1)*(r-n)))}function qn(t,e,n){return Fn(t,void 0===n?void 0:[{hint:n}],{...e})}function Fn(t,n=[],r={}){const o=function(t,e,{type:n,domain:r,range:o,scheme:i,pivot:a,projection:l}){if("fx"===t||"fy"===t)return"band";"x"!==t&&"y"!==t||null==l||(n=_n);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===_n)return;if(void 0!==n)return n;if(void 0===r&&!e.some((({value:t})=>void 0!==t)))return;const s=St.get(t);if(s===Rt)return"sqrt";if(s===Ot||s===zt)return"linear";if(s===Et)return"ordinal";if((r||o||[]).length>2)return Gn(s);if(void 0!==r)return ht(r)?Gn(s):dt(r)?"utc":s!==At||null==a&&!nn(i)?"linear":"diverging";const c=e.map((({value:t})=>t)).filter((t=>void 0!==t));return c.some(ht)?Gn(s):c.some(dt)?"utc":s!==At||null==a&&!nn(i)?"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&&Un({type:o})){const e=n.map((({value:t})=>t)).filter((t=>void 0!==t));e.some(dt)?Se(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Yn(o)}" 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 "${Yn(o)}".`):e.some(pt)?Se(`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 "${Yn(o)}" 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 "${Yn(o)}".`):e.some(mt)&&Se(`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 "${Yn(o)}" 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 "${Yn(o)}".`)}switch(r.type=o,o){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=Zn(n,r,T);break;case"identity":switch(St.get(t)){case Lt:r=Zn(n,r,T);break;case Et:r=Zn(n,r,Qn)}break;case"utc":case"time":r=Zn(n,r,I)}switch(o){case"diverging":return function(t,n,r){return xn(t,e.scaleDiverging(),kn,n,r)}(t,n,r);case"diverging-sqrt":return function(t,e,n){return wn(t,e,{...n,exponent:.5})}(t,n,r);case"diverging-pow":return wn(t,n,r);case"diverging-log":return function(t,n,{base:r=10,pivot:o=1,domain:i=fn(n,o<0?s:l),...a}){return xn(t,e.scaleDivergingLog().base(r=+r),$n,n,{domain:i,pivot:o,...a})}(t,n,r);case"diverging-symlog":return bn(t,n,r);case"categorical":case"ordinal":case An:return zn(t,n,r);case"cyclical":case"sequential":case"linear":return function(t,n,r){return sn(t,e.scaleLinear(),n,r)}(t,n,r);case"sqrt":return function(t,e,n){return cn(t,e,{...n,exponent:.5})}(t,n,r);case"threshold":return un(t,0,r);case"quantile":return function(t,n,{range:r,quantiles:o=(void 0===r?5:(r=[...r]).length),n:i=o,scheme:a="rdylbu",domain:l=yn(n),unknown:s,interpolate:c,reverse:u}){return void 0===r&&(r=void 0!==c?e.quantize(c,i):St.get(t)===At?Je(a,i):void 0),l.length>0&&(l=e.scaleQuantile(l,void 0===r?{length:i}:r).quantiles()),un(t,0,{domain:l,range:r,reverse:u,unknown:s})}(t,n,r);case"quantize":return function(t,n,{range:r,n:o=(void 0===r?5:(r=[...r]).length),scheme:i="rdylbu",domain:a=hn(t,n),unknown:l,interpolate:s,reverse:c}){const[u,f]=e.extent(a);let h;return void 0===r?(h=e.ticks(u,f,o),h[0]<=u&&h.splice(0,1),h[h.length-1]>=f&&h.pop(),o=h.length+1,r=void 0!==s?e.quantize(s,o):St.get(t)===At?Je(i,o):void 0):(h=e.quantize(e.interpolateNumber(u,f),o+1).slice(1,-1),u instanceof Date&&(h=h.map((t=>new Date(t))))),$t(F(a))<0&&h.reverse(),un(t,0,{domain:h,range:r,reverse:c,unknown:l})}(t,n,r);case"pow":return cn(t,n,r);case"log":return function(t,n,{base:r=10,domain:o=gn(n),...i}){return sn(t,e.scaleLog().base(r),n,{...i,domain:o})}(t,n,r);case"symlog":return function(t,n,{constant:r=1,...o}){return sn(t,e.scaleSymlog().constant(r),n,o)}(t,n,r);case"utc":return function(t,n,r){return Ln(t,e.scaleUtc(),n,r)}(t,n,r);case"time":return function(t,n,r){return Ln(t,e.scaleTime(),n,r)}(t,n,r);case"point":return function(t,n,{align:r=.5,padding:o=.5,...i}){return On(e.scalePoint().align(r).padding(o),n,i,t)}(t,n,r);case"band":return function(t,n,{align:r=.5,padding:o=.1,paddingInner:i=o,paddingOuter:a=("fx"===t||"fy"===t?0:o),...l}){return On(e.scaleBand().align(r).paddingInner(i).paddingOuter(a),n,l,t)}(t,n,r);case"identity":return St.get(t)===Lt?{type:"identity",scale:e.scaleIdentity()}:{type:"identity"};case void 0:return;default:throw new Error(`unknown scale type: ${o}`)}}function Yn(t){return"symbol"==typeof t?t.description:t}const _n={toString:()=>"projection"};function Gn(t){switch(t){case Lt:return"point";case At:return An;default:return"ordinal"}}function Xn({type:t}){return"time"===t||"utc"===t}function Un({type:t}){return"ordinal"===t||"point"===t||"band"===t||t===An}function Hn({type:t}){return"threshold"===t}function Vn(t){if(void 0===t)return!0;const e=t.domain(),n=t(e[0]);for(let r=1,o=e.length;r<o;++r)if(t(e[r])-n)return!1;return!0}function Zn(t,{domain:e,...n},r){for(const e of t)void 0!==e.value&&(e.value=r(e.value));return{domain:void 0===e?e:r(e),...n}}function Qn(t){return Y(t,jt)}function Jn({scale:t,type:e,domain:n,range:r,interpolate:o,interval:i,transform:a,percent:l,pivot:s}){if("identity"===e)return{type:"identity",apply:t=>t,invert:t=>t};const c=t.unknown?t.unknown():void 0;return{type:e,domain:_(n),...void 0!==r&&{range:_(r)},...void 0!==a&&{transform:a},...l&&{percent:l},...void 0!==c&&{unknown:c},...void 0!==i&&{interval:i},...void 0!==o&&{interpolate:o},...t.clamp&&{clamp:t.clamp()},...void 0!==s&&{pivot:s,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)}}}function Kn(t){let e,n;return(...r)=>((n?.length!==r.length||n.some(((t,e)=>t!==r[e])))&&(n=r,e=t(...r)),e)}const tr=Kn((t=>new Intl.NumberFormat(t))),er=Kn(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}}))),nr=Kn(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}})));function rr(t){return c(t,"Invalid Date")}const or=function(t="en-US"){const e=function(t="en-US"){const e=tr(t);return t=>null==t||isNaN(t)?void 0:e.format(t)}(t);return t=>(t instanceof Date?rr:"number"==typeof t?e:R)(t)}(),ir=("undefined"!=typeof window?window.devicePixelRatio>1:"undefined"==typeof it)?0:.5;let ar=0;function lr(){return"plot-clip-"+ ++ar}function sr(t,{title:e,href:n,ariaLabel:r,ariaDescription:o,ariaHidden:i,target:a,fill:l,fillOpacity:s,stroke:c,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:v,paintOrder:x,pointerEvents:w,shapeRendering:b},{ariaLabel:k,fill:$="currentColor",fillOpacity:M,stroke:L="none",strokeOpacity:A,strokeWidth:z,strokeLinecap:O,strokeLinejoin:E,strokeMiterlimit:S,paintOrder:C}){null===$&&(l=null,s=null),null===L&&(c=null,f=null),wt($)?wt(L)||wt(l)||(L="none"):wt(L)&&!wt(c)&&($="none");const[B,T]=j(l,$),[N,I]=W(s,M),[P,D]=j(c,L),[q,F]=W(f,A),[Y,_]=W(y);bt(D)||(void 0===u&&(u=z),void 0===d&&(d=O),void 0===h&&(h=E),void 0!==p||/^\s*round\s*$/i.test(h)||(p=S),bt(T)||void 0!==x||(x=C));const[G,X]=W(u);return null!==$&&(t.fill=wr(T,"currentColor"),t.fillOpacity=br(I,1)),null!==L&&(t.stroke=wr(D,"none"),t.strokeWidth=br(X,1),t.strokeOpacity=br(F,1),t.strokeLinejoin=wr(h,"miter"),t.strokeLinecap=wr(d,"butt"),t.strokeMiterlimit=br(p,4),t.strokeDasharray=wr(m,"none"),t.strokeDashoffset=wr(g,"0")),t.target=R(a),t.ariaLabel=R(k),t.ariaDescription=R(o),t.ariaHidden=R(i),t.opacity=br(_,1),t.mixBlendMode=wr(v,"normal"),t.paintOrder=wr(x,"normal"),t.pointerEvents=wr(w,"auto"),t.shapeRendering=wr(b,"auto"),{title:{value:e,optional:!0},href:{value:n,optional:!0},ariaLabel:{value:r,optional:!0},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:N,scale:"auto",optional:!0},stroke:{value:P,scale:"auto",optional:!0},strokeOpacity:{value:q,scale:"auto",optional:!0},strokeWidth:{value:G,optional:!0},opacity:{value:Y,scale:"auto",optional:!0}}}function cr(t,e){e&&t.text((t=>or(e[t])))}function ur(t,e){e&&t.text((([t])=>or(e[t])))}function fr(t,{target:e},{ariaLabel:n,title:r,fill:o,fillOpacity:a,stroke:l,strokeOpacity:s,strokeWidth:c,opacity:u,href:f}){n&&vr(t,"aria-label",(t=>n[t])),o&&vr(t,"fill",(t=>o[t])),a&&vr(t,"fill-opacity",(t=>a[t])),l&&vr(t,"stroke",(t=>l[t])),s&&vr(t,"stroke-opacity",(t=>s[t])),c&&vr(t,"stroke-width",(t=>c[t])),u&&vr(t,"opacity",(t=>u[t])),f&&yr(t,(t=>f[t]),e),function(t,e){e&&t.filter((t=>i(e[t]))).append("title").call(cr,e)}(t,r)}function hr(t,{target:e},{ariaLabel:n,title:r,fill:o,fillOpacity:a,stroke:l,strokeOpacity:s,strokeWidth:c,opacity:u,href:f}){n&&vr(t,"aria-label",(([t])=>n[t])),o&&vr(t,"fill",(([t])=>o[t])),a&&vr(t,"fill-opacity",(([t])=>a[t])),l&&vr(t,"stroke",(([t])=>l[t])),s&&vr(t,"stroke-opacity",(([t])=>s[t])),c&&vr(t,"stroke-width",(([t])=>c[t])),u&&vr(t,"opacity",(([t])=>u[t])),f&&yr(t,(([t])=>f[t]),e),function(t,e){e&&t.filter((([t])=>i(e[t]))).append("title").call(ur,e)}(t,r)}function dr(t,n,r){const o=e.group(t,(t=>n[t]));return void 0===r&&o.size>t.length>>1&&Se("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."),o.values()}function*pr(t,e,{z:r},o){const{z:i}=o,a=function({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:o,strokeOpacity:i,strokeWidth:a,opacity:l,href:s}){return[t,e,n,r,o,i,a,l,s].filter((t=>void 0!==t))}(o),l=[...e,...a];for(const e of i?dr(t,i,r):[t]){let t,r;t:for(const o of e){for(const t of l)if(!n(t[o])){r&&r.push(-1);continue t}if(void 0!==t){r.push(o);for(let e=0;e<a.length;++e){if(tt(a[e][o])!==t[e]){yield r,t=a.map((t=>tt(t[o]))),r=[o];continue t}}}else r&&(yield r),t=a.map((t=>tt(t[o]))),r=[o]}r&&(yield r)}}function mr(t,n,r,o){!function(t,n,r,o){let i;switch(n.clip){case"frame":{const{width:e,height:n,marginLeft:a,marginRight:l,marginTop:s,marginBottom:c}=r,u=lr();i=`url(#${u})`,t=_e("svg:g",o).call((t=>t.append("svg:clipPath").attr("id",u).append("rect").attr("x",a).attr("y",s).attr("width",e-l-a).attr("height",n-s-c))).each((function(){this.appendChild(t.node()),t.node=()=>this}));break}case"sphere":{const{projection:n}=o;if(!n)throw new Error('the "sphere" clip option requires a projection');const r=lr();i=`url(#${r})`,t.append("clipPath").attr("id",r).append("path").attr("d",e.geoPath(n)({type:"Sphere"}));break}}vr(t,"aria-label",n.ariaLabel),vr(t,"aria-description",n.ariaDescription),vr(t,"aria-hidden",n.ariaHidden),vr(t,"clip-path",i)}(t,n,r,o),vr(t,"fill",n.fill),vr(t,"fill-opacity",n.fillOpacity),vr(t,"stroke",n.stroke),vr(t,"stroke-width",n.strokeWidth),vr(t,"stroke-opacity",n.strokeOpacity),vr(t,"stroke-linejoin",n.strokeLinejoin),vr(t,"stroke-linecap",n.strokeLinecap),vr(t,"stroke-miterlimit",n.strokeMiterlimit),vr(t,"stroke-dasharray",n.strokeDasharray),vr(t,"stroke-dashoffset",n.strokeDashoffset),vr(t,"shape-rendering",n.shapeRendering),vr(t,"paint-order",n.paintOrder),vr(t,"pointer-events",n.pointerEvents)}function gr(t,e){!function(t,e,n){null!=n&&t.style(e,n)}(t,"mix-blend-mode",e.mixBlendMode),vr(t,"opacity",e.opacity)}function yr(t,n,r){t.each((function(t){const o=n(t);if(null!=o){const t=this.ownerDocument.createElementNS(e.namespaces.svg,"a");t.setAttribute("fill","inherit"),t.setAttributeNS(e.namespaces.xlink,"href",o),null!=r&&t.setAttribute("target",r),this.parentNode.insertBefore(t,this).appendChild(this)}}))}function vr(t,e,n){null!=n&&t.attr(e,n)}function xr(t,e,{x:n,y:r},o=ir,i=ir){o+=e.dx,i+=e.dy,n?.bandwidth&&(o+=n.bandwidth()/2),r?.bandwidth&&(i+=r.bandwidth()/2),(o||i)&&t.attr("transform",`translate(${o},${i})`)}function wr(t,e){if((t=R(t))!==e)return t}function br(t,e){if((t=z(t))!==e)return t}const kr=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function $r(t){if(void 0===t)return"plot-d6a7b5";if(t=`${t}`,!kr.test(t))throw new Error(`invalid class name: ${t}`);return t}function Mr(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 Lr({frameAnchor:t},{width:e,height:n,marginTop:r,marginRight:o,marginBottom:i,marginLeft:a}){return[/left$/.test(t)?a:/right$/.test(t)?e-o:(a+e-o)/2,/^top/.test(t)?r:/^bottom/.test(t)?n-i:(r+n-i)/2]}function Ar({x:t,y:e,fy:n,fx:r},o,{projection:i,aspectRatio:a},{width:l,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:u,marginLeftDefault:f}){const h=n?n.scale.domain().length:1,d=function(t,e){if("function"==typeof t?.stream)return Te;if(G(t)&&(t=t.type),null==t)return function(t){for(const e of t)if(e.channels.geometry)return!0;return!1}(e)?Te:void 0;if("function"!=typeof t){const{aspectRatio:e}=Ie(t);if(e)return e}return Te}(i,o);if(d){const t=(1.1*h-.1)/(1.1*(r?r.scale.domain().length:1)-.1)*d,e=Math.max(.1,Math.min(10,t));return Math.round((l-f-c)*e+s+u)}const p=e?Un(e)?e.scale.domain().length:Math.max(7,17/h):1;if(null!=a){if(a=+a,!(isFinite(a)&&a>0))throw new Error(`invalid aspectRatio: ${a}`);const o=Rr("y",e)/(Rr("x",t)*a),i=r?r.scale.bandwidth():1,h=n?n.scale.bandwidth():1;return(o*(i*(l-f-c)-t.insetLeft-t.insetRight)+e.insetTop+e.insetBottom)/h+s+u}return!(!e&&!n)*Math.max(1,Math.min(60,p*h))*20+30*!!r+60}function Rr(t,n){if(!n)throw new Error(`aspectRatio requires ${t} scale`);const{type:r,domain:o}=n;let i;switch(r){case"linear":case"utc":case"time":i=Number;break;case"pow":{const t=n.scale.exponent();i=e=>Math.pow(e,t);break}case"log":i=Math.log;break;case"point":case"band":return o.length;default:throw new Error(`unsupported ${t} scale for aspectRatio: ${r}`)}const[a,l]=e.extent(o);return Math.abs(i(l)-i(a))}function zr(t,{fx:n,fy:r}){const o=J(t),i=n?.value,a=r?.value;return n&&r?e.rollup(o,(t=>(t.fx=i[t[0]],t.fy=a[t[0]],t)),(t=>i[t]),(t=>a[t])):n?e.rollup(o,(t=>(t.fx=i[t[0]],t)),(t=>i[t])):e.rollup(o,(t=>(t.fy=a[t[0]],t)),(t=>a[t]))}function Or(t){const n=[],r=new Uint32Array(e.sum(t,(t=>t.length)));for(const e of t){let o=0;for(const n of t)e!==n&&(r.set(n,o),o+=n.length);n.push(r.slice(0,o))}return n}const Er=new Map([["top",Sr],["right",Tr],["bottom",Cr],["left",Br],["top-left",Nr(Sr,Br)],["top-right",Nr(Sr,Tr)],["bottom-left",Nr(Cr,Br)],["bottom-right",Nr(Cr,Tr)],["top-empty",function(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;const i=e?.indexOf(r);if(i>0){const r=e[i-1];return t.find((t=>t.x===n&&t.y===r))?.empty}}],["right-empty",function(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;const i=e?.indexOf(n);if(i<e?.length-1){const n=e[i+1];return t.find((t=>t.x===n&&t.y===r))?.empty}}],["bottom-empty",function(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;const i=e?.indexOf(r);if(i<e?.length-1){const r=e[i+1];return t.find((t=>t.x===n&&t.y===r))?.empty}}],["left-empty",function(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;const i=e?.indexOf(n);if(i>0){const n=e[i-1];return t.find((t=>t.x===n&&t.y===r))?.empty}}],["empty",function(t,e,{empty:n}){return n}]]);function Sr(t,{y:e},{y:n}){return!e||0===e.indexOf(n)}function Cr(t,{y:e},{y:n}){return!e||e.indexOf(n)===e.length-1}function Br(t,{x:e},{x:n}){return!e||0===e.indexOf(n)}function Tr(t,{x:e},{x:n}){return!e||e.indexOf(n)===e.length-1}function Nr(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function Ir(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)??[]))}function Pr(t){return Un(t)&&void 0===t.interval?void 0:"tabular-nums"}function jr(t,e){if(null==e)return e;const n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function Wr(t,n={},r){let{columns:o,tickFormat:i,fontVariant:a=Pr(t),swatchSize:l=15,swatchWidth:s=l,swatchHeight:c=l,marginLeft:u=0,className:f,style:h,width:d}=n;const p=Ye(n);f=$r(f),i=function(t,n){return void 0===t?dt(n)?rr:R:"function"==typeof t?t:("string"==typeof t?dt(n)?e.utcFormat:e.format:C)(t)}(i,t.domain);const m=_e("div",p).attr("class",`${f}-swatches ${f}-swatches-${null!=o?"columns":"wrap"}`);let g;return null!=o?(g=`.${f}-swatches-columns .${f}-swatch {\n display: flex;\n align-items: center;\n break-inside: avoid;\n padding-bottom: 1px;\n}\n.${f}-swatches-columns .${f}-swatch::before {\n flex-shrink: 0;\n}\n.${f}-swatches-columns .${f}-swatch-label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}`,m.style("columns",o).selectAll().data(t.domain).enter().append("div").attr("class",`${f}-swatch`).call(r,t,s,c).call((t=>t.append("div").attr("class",`${f}-swatch-label`).attr("title",i).text(i)))):(g=`.${f}-swatches-wrap {\n display: flex;\n align-items: center;\n min-height: 33px;\n flex-wrap: wrap;\n}\n.${f}-swatches-wrap .${f}-swatch {\n display: inline-flex;\n align-items: center;\n margin-right: 1em;\n}`,m.selectAll().data(t.domain).enter().append("span").attr("class",`${f}-swatch`).call(r,t,s,c).append((function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))}))),m.call((t=>t.insert("style","*").text(`.${f}-swatches {\n font-family: system-ui, sans-serif;\n font-size: 10px;\n margin-bottom: 0.5em;\n}\n.${f}-swatch > svg {\n margin-right: 0.5em;\n overflow: visible;\n}\n${g}`))).style("margin-left",u?+u+"px":null).style("width",void 0===d?null:+d+"px").style("font-variant",wr(a,"normal")).call(Mr,h).node()}const Dr=new Map([["symbol",function(t,{fill:n=(void 0!==t.hint?.fill?t.hint.fill:"none"),fillOpacity:r=1,stroke:o=(void 0!==t.hint?.stroke?t.hint.stroke:wt(n)?"currentColor":"none"),strokeOpacity:i=1,strokeWidth:a=1.5,r:l=4.5,...s}={},c){const[u,f]=j(n),[h,d]=j(o),p=jr(c,u),m=jr(c,h),g=l*l*Math.PI;return r=W(r)[1],i=W(i)[1],a=W(a)[1],Wr(t,s,((n,o,l,s)=>n.append("svg").attr("viewBox","-8 -8 16 16").attr("width",l).attr("height",s).attr("fill","color"===u?t=>p.scale(t):f).attr("fill-opacity",r).attr("stroke","color"===h?t=>m.scale(t):d).attr("stroke-opacity",i).attr("stroke-width",a).append("path").attr("d",(n=>{const r=e.pathRound();return t.scale(n).draw(r,g),r}))))}],["color",Fr],["opacity",function({type:t,interpolate:n,...r},{legend:o=!0,color:i=e.rgb(0,0,0),...a}){if(!n)throw new Error(`${t} opacity scales are not supported`);!0===o&&(o="ramp");if("ramp"!==`${o}`.toLowerCase())throw new Error(`${o} opacity legends are not supported`);return Fr({type:t,...r,interpolate:Yr(i)},{legend:o,...a})}]]);function qr({className:t,...e},{label:n,ticks:r,tickFormat:o}={},i){return function(t={},...e){let n=t;for(const r of e)for(const e in r)if(void 0===n[e]){const o=r[e];n===t?n={...n,[e]:o}:n[e]=o}return n}(i,{className:t,...e},{label:n,ticks:r,tickFormat:o})}function Fr(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,{opacity:e,...n}={}){if(!Un(t)&&!Hn(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return Wr(t,n,((t,n,r,o)=>t.append("svg").attr("width",r).attr("height",o).attr("fill",n.scale).attr("fill-opacity",W(e)[1]).append("rect").attr("width","100%").attr("height","100%")))}(t,r);case"ramp":return function(t,n){let{label:r=t.label,tickSize:o=6,width:i=240,height:a=44+o,marginTop:l=18,marginRight:s=0,marginBottom:c=16+o,marginLeft:u=0,style:f,ticks:h=(i-u-s)/64,tickFormat:d,fontVariant:p=Pr(t),round:m=!0,opacity:g,className:y}=n;const v=Ye(n);y=$r(y),g=W(g)[1],null===d&&(d=()=>null);const x=_e("svg",v).attr("class",`${y}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",a).attr("viewBox",`0 0 ${i} ${a}`).call((t=>t.append("style").text(`.${y}-ramp {\n display: block;\n background: white;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n overflow: visible;\n}\n.${y}-ramp text {\n white-space: pre;\n}`))).call(Mr,f);let w,b=t=>t.selectAll(".tick line").attr("y1",l+c-a);const k=m?(t,e)=>t.rangeRound(e):(t,e)=>t.range(e),{type:$,domain:M,range:L,interpolate:A,scale:R,pivot:z}=t;if(A){const t=void 0===L?A:e.piecewise(1===A.length?vn(A):A,L);w=k(R.copy(),e.quantize(e.interpolateNumber(u,i-s),Math.min(M.length+(void 0!==z),void 0===L?1/0:L.length)));const n=256,r=v.document.createElement("canvas");r.width=n,r.height=1;const o=r.getContext("2d");for(let e=0,r=n-1;e<n;++e)o.fillStyle=t(e/r),o.fillRect(e,0,1,1);x.append("image").attr("opacity",g).attr("x",u).attr("y",l).attr("width",i-u-s).attr("height",a-l-c).attr("preserveAspectRatio","none").attr("xlink:href",r.toDataURL())}else if("threshold"===$){const t=M,n=void 0===d?t=>t:"string"==typeof d?e.format(d):d;w=k(e.scaleLinear().domain([-1,L.length-1]),[u,i-s]),x.append("g").attr("fill-opacity",g).selectAll().data(L).enter().append("rect").attr("x",((t,e)=>w(e-1))).attr("y",l).attr("width",((t,e)=>w(e)-w(e-1))).attr("height",a-l-c).attr("fill",(t=>t)),h=Y(t,((t,e)=>e)),d=e=>n(t[e],e)}else w=k(e.scaleBand().domain(M),[u,i-s]),x.append("g").attr("fill-opacity",g).selectAll().data(M).enter().append("rect").attr("x",w).attr("y",l).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",a-l-c).attr("fill",R),b=()=>{};return x.append("g").attr("transform",`translate(0,${a-c})`).call(e.axisBottom(w).ticks(Array.isArray(h)?null:h,"string"==typeof d?d:void 0).tickFormat("function"==typeof d?d:void 0).tickSize(o).tickValues(Array.isArray(h)?h:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",wr(p,"normal")).call(b).call((t=>t.select(".domain").remove())),void 0!==r&&x.append("text").attr("x",u).attr("y",l-6).attr("fill","currentColor").attr("font-weight","bold").text(r),x.node()}(t,r);default:throw new Error(`unknown legend type: ${n}`)}}function Yr(t){const{r:n,g:r,b:o}=e.rgb(t)||e.rgb(0,0,0);return t=>`rgba(${n},${r},${o},${t})`}class _r{constructor(t,e={},n={},r){const{facet:o="auto",facetAnchor:i,fx:a,fy:l,sort:s,dx:c=0,dy:u=0,margin:f=0,marginTop:h=f,marginRight:d=f,marginBottom:p=f,marginLeft:m=f,clip:g,channels:y}=n;if(this.data=t,this.sort=H(s)?s:null,this.initializer=Dt(n).initializer,this.transform=this.initializer?n.transform:Wt(n).transform,null===o||!1===o?this.facet=null:(this.facet=q(!0===o?"include":o,"facet",["auto","include","exclude","super"]),this.fx=a,this.fy=l),this.facetAnchor=function(t){if(null==t)return null;const e=Er.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}(i),e=Mt(e),void 0!==y&&(e={...Mt(y),...e}),void 0!==r&&(e={...sr(this,n,r),...e}),this.channels=Object.fromEntries(Object.entries(e).map((([t,e])=>{const{value:n}=e;return U(n)&&(e={...e,value:n.value},void 0!==n.scale&&(e.scale=n.scale)),[t,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=+c,this.dy=+u,this.marginTop=+h,this.marginRight=+d,this.marginBottom=+p,this.marginLeft=+m,this.clip=function(t){return!0===t?t="frame":!1===t&&(t=null),D(t,"clip",["frame","sphere"])}(g),"super"===this.facet){if(a||l)throw new Error("super-faceting cannot use fx or fy");for(const t in this.channels){const{scale:n}=e[t];if("x"===n||"y"===n)throw new Error("super-faceting cannot use x or y")}}}initialize(t,n){let r=F(this.data);void 0===t&&null!=r&&(t=[J(r)]);const o=t;null!=this.transform&&(({facets:t,data:r}=this.transform(r,t)),r=F(r)),void 0!==t&&(t.original=o);const i=be(this.channels,r);return null!=this.sort&&function(t,n,r,o,i){const{reverse:a,reduce:l=!0,limit:s}=i;for(const c in i){if(!St.has(c))continue;let{value:u,reverse:f=a,reduce:h=l,limit:d=s}=ct(i[c]);if(void 0===f&&(f="width"===u||"height"===u),null==h||!1===h)continue;const p="fx"===c||"fy"===c?Le(n,o[c]):Me(r,c);if(!p)throw new Error(`missing channel for scale: ${c}`);const m=p.value,[g=0,y=1/0]=ut(d)?d:d<0?[d]:[0,d];if(null==u)p.domain=()=>{let t=Array.from(new e.InternSet(m));return f&&(t=t.reverse()),0===g&&y===1/0||(t=t.slice(g,y)),t};else{const n="data"===u?t:"height"===u?Ae(r,"y1","y2"):"width"===u?Ae(r,"x1","x2"):Re(r,u,"y"===u?"y2":"x"===u?"x2":void 0),o=ae(!0===h?"max":h,n);p.domain=()=>{let t=e.rollup(J(m),(t=>o.reduceIndex(t,n)),(t=>m[t]));return t=e.sort(t,f?Oe:ze),0===g&&y===1/0||(t=t.slice(g,y)),t.map(O)}}}}(r,t,i,n,this.sort),{data:r,facets:t,channels:i}}filter(t,e,r){for(const o in e){const{filter:i=n}=e[o];if(null!==i){const e=r[o];t=t.filter((t=>i(e[t])))}}return t}project(t,e,n){qe("x","y",t,e,n),qe("x1","y1",t,e,n),qe("x2","y2",t,e,n)}scale(t,e,n){const r=ke(t,e);return n.projection&&this.project(t,r,n),r}}function Gr(...t){return t.plot=_r.prototype.plot,t}const Xr=Math.PI/180;function Ur({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=Vr(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function Hr({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=Vr(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function Vr(t,e,n){return void 0===t&&void 0===e&&void 0===n?ir?[1,0]:[.5,.5]:[e,n]}function Zr(t,{interval:e}){return(t={...ct(t)}).interval=lt(void 0===t.interval?e:t.interval),t}function Qr(t,e,n,r){const{[t]:o,[`${t}1`]:i,[`${t}2`]:a}=n,{value:l,interval:s}=Zr(o,n);if(null==l||null==s&&!r)return n;const c=ot(o);if(null==s){let e;const r={transform:t=>e||(e=x(t,l)),label:c};return{...n,[t]:void 0,[`${t}1`]:void 0===i?r:i,[`${t}2`]:void 0===a?r:a}}let u,f;function h(t){return void 0!==f&&t===u?f:f=Y(x(u=t,l),(t=>s.floor(t)))}return e({...n,[t]:void 0,[`${t}1`]:void 0===i?{transform:h,label:c}:i,[`${t}2`]:void 0===a?{transform:t=>h(t).map((t=>s.offset(t))),label:c}:a})}function Jr(t,e,n){const{[t]:r}=n,{value:o,interval:i}=Zr(r,n);return null==o||null==i?n:e({...n,[t]:{label:ot(r),transform:t=>{const e=Y(x(t,o),(t=>i.floor(t))),n=e.map((t=>i.offset(t)));return e.map(dt(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 Kr(t={}){return Qr("x",Ur,t,!0)}function to(t={}){return Qr("y",Hr,t,!0)}function eo(t={}){return Qr("x",Ur,t)}function no(t={}){return Qr("y",Hr,t)}function ro(t={}){return Jr("x",Ur,t)}function oo(t={}){return Jr("y",Hr,t)}const io={ariaLabel:"rule",fill:null,stroke:"currentColor"};class ao extends _r{constructor(t,e={}){const{x:n,y1:r,y2:o,inset:i=0,insetTop:a=i,insetBottom:l=i}=e;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:r,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},e,io),this.insetTop=z(a),this.insetBottom=z(l)}render(t,e,n,r,o){const{x:i,y:a}=e,{x:l,y1:s,y2:c}=n,{width:u,height:f,marginTop:h,marginRight:d,marginLeft:p,marginBottom:m}=r,{insetTop:g,insetBottom:y}=this;return _e("svg:g",o).call(mr,this,r).call(xr,this,{x:l&&i},ir,0).call((e=>e.selectAll().data(t).enter().append("line").call(gr,this).attr("x1",l?t=>l[t]:(p+u-d)/2).attr("x2",l?t=>l[t]:(p+u-d)/2).attr("y1",s&&!Vn(a)?t=>s[t]+g:h+g).attr("y2",c&&!Vn(a)?a.bandwidth?t=>c[t]+a.bandwidth()-y:t=>c[t]-y:f-m-y).call(fr,this,n))).node()}}class lo extends _r{constructor(t,e={}){const{x1:n,x2:r,y:o,inset:i=0,insetRight:a=i,insetLeft:l=i}=e;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:r,scale:"x",optional:!0}},e,io),this.insetRight=z(a),this.insetLeft=z(l)}render(t,e,n,r,o){const{x:i,y:a}=e,{y:l,x1:s,x2:c}=n,{width:u,height:f,marginTop:h,marginRight:d,marginLeft:p,marginBottom:m}=r,{insetLeft:g,insetRight:y}=this;return _e("svg:g",o).call(mr,this,r,o).call(xr,this,{y:l&&a},0,ir).call((e=>e.selectAll().data(t).enter().append("line").call(gr,this).attr("x1",s&&!Vn(i)?t=>s[t]+g:p+g).attr("x2",c&&!Vn(i)?i.bandwidth?t=>c[t]+i.bandwidth()-y:t=>c[t]-y:u-d-y).attr("y1",l?t=>l[t]:(h+f-m)/2).attr("y2",l?t=>l[t]:(h+f-m)/2).call(fr,this,n))).node()}}function so(t,e){let{x:n=M,y:r,y1:o,y2:i,...a}=no(e);return[o,i]=uo(r,o,i),new ao(t,{...a,x:n,y1:o,y2:i})}function co(t,e){let{y:n=M,x:r,x1:o,x2:i,...a}=eo(e);return[o,i]=uo(r,o,i),new lo(t,{...a,y:n,x1:o,x2:i})}function uo(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]}function fo(t,...e){let n=e.length;for(let r=0,o=!0;r<n;++r)"function"!=typeof e[r]&&(o&&(t=t.slice(),o=!1),t.splice(r,2,t[r]+e[r]+t[r+1]),e.splice(r,1),--r,--n);return r=>{let o=t[0];for(let i=0;i<n;++i)o+=e[i](r)+t[i+1];return o}}const ho={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},po="­";class mo extends _r{constructor(t,e={}){const{x:n,y:r,text:o=(ut(t)&&ft(t)?M:$),frameAnchor:a,textAnchor:l=(/right$/i.test(a)?"end":/left$/i.test(a)?"start":"middle"),lineAnchor:s=(/^top/i.test(a)?"top":/^bottom/i.test(a)?"bottom":"middle"),lineHeight:c=1,lineWidth:u=1/0,textOverflow:f,monospace:h,fontFamily:d=(h?"ui-monospace, monospace":void 0),fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:v}=e,[w,b]=W(v,0),[k,L]=function(t){return null==t||"number"==typeof t?[void 0,t]:"string"!=typeof t?[t,void 0]:(t=t.trim().toLowerCase(),bo.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}(p);var A;if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},fontSize:{value:k,optional:!0},rotate:{value:(A=w,null==A?null:{transform:t=>x(t,A,Float64Array),label:ot(A)}),optional:!0},text:{value:o,filter:i,optional:!0}},e,ho),this.rotate=b,this.textAnchor=wr(l,"middle"),this.lineAnchor=q(s,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+c,this.lineWidth=+u,this.textOverflow=function(t){return null==t?null:q(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}(f),this.monospace=!!h,this.fontFamily=R(d),this.fontSize=L,this.fontStyle=R(m),this.fontVariant=R(g),this.fontWeight=R(y),this.frameAnchor=kt(a),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=function({monospace:t,lineWidth:e,textOverflow:n}){if(null!=n||e==1/0)return t=>t.split(/\r\n?|\n/g);const r=t?Mo:$o,o=100*e;return t=>function(t,e,n){const r=[];let o,i=0;for(const[a,l,s]of function*(t){let e=0,n=0;const r=t.length;for(;n<r;){let r=1;switch(t[n]){case po:case"-":++n,yield[e,n,!1],e=n;break;case" ":for(yield[e,n,!1];" "===t[++n];);e=n;break;case"\r":"\n"===t[n+1]&&++r;case"\n":yield[e,n,!0],n+=r,e=n;break;default:++n}}yield[e,n,!0]}(t))void 0===o&&(o=a),i>o&&n(t,o,l)>e&&(r.push(t.slice(o,i)+(t[i-1]===po?"-":"")),o=a),s?(r.push(t.slice(o,l)),o=void 0):i=l;return r}(t,o,r)}(this),this.clipLine=function({monospace:t,lineWidth:e,textOverflow:n}){if(null==n||e==1/0)return t=>t;const r=t?Mo:$o,o=100*e;switch(n){case"clip-start":return t=>Ro(t,o,r,"");case"clip-end":return t=>Ao(t,o,r,"");case"ellipsis-start":return t=>Ro(t,o,r,"…");case"ellipsis-middle":return t=>function(t,e,n,r){t=t.trim();const o=n(t);if(o<=e)return t;const i=n(r)/2,[a,l]=Lo(t,e/2,n,i),[s]=Lo(t,o-e/2-l+i,n,-i);return s<0?r:t.slice(0,a).trimEnd()+r+t.slice(Eo(t,s)).trimStart()}(t,o,r,"…");case"ellipsis-end":return t=>Ao(t,o,r,"…")}}(this)}render(t,e,n,r,o){const{x:i,y:a}=e,{x:l,y:s,rotate:c,text:u,title:f,fontSize:h}=n,{rotate:d}=this,[p,m]=Lr(this,r);return _e("svg:g",o).call(mr,this,r,o).call(wo,this,u,r).call(xr,this,{x:l&&i,y:s&&a}).call((e=>e.selectAll().data(t).enter().append("text").call(gr,this).call(go,this,u,f).attr("transform",fo`translate(${l?t=>l[t]:p},${s?t=>s[t]:m})${c?t=>` rotate(${c[t]})`:d?` rotate(${d})`:""}`).call(vr,"font-size",h&&(t=>h[t])).call(fr,this,n))).node()}}function go(t,n,r,o){if(!r)return;const{lineAnchor:i,lineHeight:a,textOverflow:l,splitLines:s,clipLine:c}=n;t.each((function(t){const n=s(or(r[t])??"").map(c),u=n.length,f="top"===i?.71:"bottom"===i?1-u:(164-100*u)/200;if(u>1)for(let t=0;t<u;++t){if(!n[t])continue;const r=this.ownerDocument.createElementNS(e.namespaces.svg,"tspan");r.setAttribute("x",0),r.setAttribute("y",(f+t)*a+"em"),r.textContent=n[t],this.appendChild(r)}else f&&this.setAttribute("y",f*a+"em"),this.textContent=n[0];if(l&&!o&&n[0]!==r[t]){const n=this.ownerDocument.createElementNS(e.namespaces.svg,"title");n.textContent=r[t],this.appendChild(n)}}))}function yo(t,e={}){let{x:n,y:r,...o}=e;return void 0===e.frameAnchor&&([n,r]=Z(n,r)),new mo(t,{...o,x:n,y:r})}function vo(t,e={}){const{x:n=M,...r}=e;return new mo(t,oo({...r,x:n}))}function xo(t,e={}){const{y:n=M,...r}=e;return new mo(t,ro({...r,y:n}))}function wo(t,e,n){vr(t,"text-anchor",e.textAnchor),vr(t,"font-family",e.fontFamily),vr(t,"font-size",e.fontSize),vr(t,"font-style",e.fontStyle),vr(t,"font-variant",void 0===e.fontVariant?function(t){return gt(t)||dt(t)?"tabular-nums":void 0}(n):e.fontVariant),vr(t,"font-weight",e.fontWeight)}const bo=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);const ko={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,"…":82};function $o(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Eo(t,o))r+=ko[t[o]]??(Co(t,o)?120:ko.e);return r}function Mo(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=Eo(t,o))r+=Co(t,o)?200:100;return r}function Lo(t,e,n,r){const o=[];let i=0;for(let a=0,l=0,s=t.length;a<s;a=l){l=Eo(t,a);const s=n(t,a,l);if(i+s>e){for(i+=r;i>e&&a>0;)l=a,a=o.pop(),i-=n(t,a,l);return[a,e-i]}i+=s,o.push(a)}return[-1,0]}function Ao(t,e,n,r){t=t.trim();const o=n(r),[i]=Lo(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function Ro(t,e,n,r){const o=n(t=t.trim());if(o<=e)return t;const i=n(r),[a]=Lo(t,o-e+i,n,-i);return a<0?r:r+t.slice(Eo(t,a)).trimStart()}const zo=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,Oo=/\p{Extended_Pictographic}/uy;function Eo(t,e){return e+=function(t,e){const n=t.charCodeAt(e);if(n>=55296&&n<56320){const n=t.charCodeAt(e+1);return n>=56320&&n<57344}return!1}(t,e)?2:1,function(t,e){return!So(t,e)&&(zo.lastIndex=e,zo.test(t))}(t,e)&&(e=zo.lastIndex),function(t,e){return 8205===t.charCodeAt(e)}(t,e)?Eo(t,e+1):e}function So(t,e){return t.charCodeAt(e)<128}function Co(t,e){return!So(t,e)&&(Oo.lastIndex=e,Oo.test(t))}const Bo={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},To=3.5,No=5*To,Io={draw(t,e,n){const r=e*n/No;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},Po={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},jo=new Map([["arrow",Io],["spike",Po]]);class Wo extends _r{constructor(t,e={}){const{x:n,y:r,r:o=To,length:i,rotate:a,shape:l=Io,anchor:s="middle",frameAnchor:c}=e,[u,f]=W(i,12),[h,d]=W(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},length:{value:u,scale:"length",optional:!0},rotate:{value:h,optional:!0}},e,Bo),this.r=+o,this.length=f,this.rotate=d,this.shape=function(t){if(function(t){return t&&"function"==typeof t.draw}(t))return t;const e=jo.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}(l),this.anchor=q(s,"anchor",["start","middle","end"]),this.frameAnchor=kt(c)}render(t,n,r,o,i){const{x:a,y:l}=n,{x:s,y:c,length:u,rotate:f}=r,{length:h,rotate:d,anchor:p,shape:m,r:g}=this,[y,v]=Lr(this,o);return _e("svg:g",i).call(mr,this,o,i).call(xr,this,{x:s&&a,y:c&&l}).call((n=>n.selectAll().data(t).enter().append("path").call(gr,this).attr("transform",fo`translate(${s?t=>s[t]:y},${c?t=>c[t]:v})${f?t=>` rotate(${f[t]})`:d?` rotate(${d})`:""}${"start"===p?"":"end"===p?u?t=>` translate(0,${u[t]})`:` translate(0,${h})`:u?t=>` translate(0,${u[t]/2})`:` translate(0,${h/2})`}`).attr("d",u?t=>{const n=e.pathRound();return m.draw(n,u[t],g),n}:(()=>{const t=e.pathRound();return m.draw(t,h,g),t})()).call(fr,this,r))).node()}}function Do(t,e={}){let{x:n,y:r,...o}=e;return void 0===e.frameAnchor&&([n,r]=Z(n,r)),new Wo(t,{...o,x:n,y:r})}function qo(t,e={}){const{x:n=M,...r}=e;return new Wo(t,{...r,x:n})}function Fo(t,e={}){const{y:n=M,...r}=e;return new Wo(t,{...r,y:n})}function Yo(t,e){return arguments.length<2&&!ut(t)&&(e=t,t=null),void 0===e&&(e={}),[t,e]}function _o({anchor:t}={},e){return void 0===t?e[0]:q(t,"anchor",e)}function Go(t){return _o(t,["left","right"])}function Xo(t){return _o(t,["right","left"])}function Uo(t){return _o(t,["bottom","top"])}function Ho(t){return _o(t,["top","bottom"])}function Vo(){const[t,e]=Yo(...arguments);return Ko("y",Go(e),t,e)}function Zo(){const[t,e]=Yo(...arguments);return Ko("fy",Xo(e),t,e)}function Qo(){const[t,e]=Yo(...arguments);return ti("x",Uo(e),t,e)}function Jo(){const[t,e]=Yo(...arguments);return ti("fx",Ho(e),t,e)}function Ko(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:a=o,strokeWidth:l=1,fill:s=r,fillOpacity:c=o,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=("y"===t?6:0),tickPadding:m,tickRotate:g,x:y,margin:v,marginTop:x=(void 0===v?20:v),marginRight:w=(void 0===v?"right"===e?40:0:v),marginBottom:b=(void 0===v?20:v),marginLeft:k=(void 0===v?"left"===e?40:0:v),label:$,labelOffset:M,labelAnchor:L,...A}){return p=z(p),m=z(m),g=z(g),void 0!==L&&(L=q(L,"labelAnchor",["center","top","bottom"])),Gr(p&&!wt(i)?function(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=e+("y"===t?"-empty":""),frameAnchor:l=e,tickSize:s,inset:c=0,insetLeft:u=c,insetRight:f=c,dx:h=0,y:d=("y"===t?void 0:null),...p}){return ci(Fo,t,`${t}-axis tick`,n,{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:l,y:d,...p,dx:"left"===e?+h-ir+ +u:+h+ir-f,anchor:"start",length:s,shape:"left"===e?pi:mi})}(t,e,n,{stroke:i,strokeOpacity:a,strokeWidth:l,tickSize:p,tickPadding:m,tickRotate:g,x:y,...A}):null,wt(s)?null:function(t,e,n,{facetAnchor:r=e+("y"===t?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:a=0,tickPadding:l=Math.max(3,9-i)+(Math.abs(a)>60?4*Math.cos(a*Xr):0),tickFormat:s,text:c=("function"==typeof s?s:void 0),textAnchor:u=(Math.abs(a)>60?"middle":"left"===e?"end":"start"),lineAnchor:f=(a>60?"top":a<-60?"bottom":"middle"),fontVariant:h,inset:d=0,insetLeft:p=d,insetRight:m=d,dx:g=0,y:y=("y"===t?void 0:null),...v}){return ci(xo,t,`${t}-axis tick label`,n,{facetAnchor:r,frameAnchor:o,text:void 0===c?null:c,textAnchor:u,lineAnchor:f,fontVariant:h,rotate:a,y:y,...v,dx:"left"===e?+g-i-l+ +p:+g+ +i+ +l-m},(function(t,e,n){void 0===h&&(this.fontVariant=gi(t)),void 0===c&&(n.text=ui(t,e,s))}))}(t,e,n,{fill:s,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:x,marginRight:w,marginBottom:b,marginLeft:k,...A}),wt(s)||null===$?null:yo([],si({fill:s,fillOpacity:c,...A},(function(n,r,o,i,a){const l=i[t],{marginTop:s,marginRight:c,marginBottom:u,marginLeft:f}="y"===t&&a.inset||a,h=L??(l.bandwidth?"center":"top"),d=M??("right"===e?c:f)-3;return"center"===h?(this.textAnchor=void 0,this.lineAnchor="right"===e?"bottom":"top",this.frameAnchor=e,this.rotate=-90):(this.textAnchor="right"===e?"end":"start",this.lineAnchor=h,this.frameAnchor=`${h}-${e}`,this.rotate=0),this.dy="top"===h?3-s:"bottom"===h?u-3:0,this.dx="right"===e?d:-d,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[void 0===$?yi(t,l,h):$]}}}}))))}function ti(t,e,n,{color:r="currentColor",opacity:o=1,stroke:i=r,strokeOpacity:a=o,strokeWidth:l=1,fill:s=r,fillOpacity:c=o,textAnchor:u,textStroke:f,textStrokeOpacity:h,textStrokeWidth:d,tickSize:p=("x"===t?6:0),tickPadding:m,tickRotate:g,y:y,margin:v,marginTop:x=(void 0===v?"top"===e?30:0:v),marginRight:w=(void 0===v?20:v),marginBottom:b=(void 0===v?"bottom"===e?30:0:v),marginLeft:k=(void 0===v?20:v),label:$,labelAnchor:M,labelOffset:L,...A}){return p=z(p),m=z(m),g=z(g),void 0!==M&&(M=q(M,"labelAnchor",["center","left","right"])),Gr(p&&!wt(i)?function(t,e,n,{strokeWidth:r=1,strokeLinecap:o=null,strokeLinejoin:i=null,facetAnchor:a=e+("x"===t?"-empty":""),frameAnchor:l=e,tickSize:s,inset:c=0,insetTop:u=c,insetBottom:f=c,dy:h=0,x:d=("x"===t?void 0:null),...p}){return ci(qo,t,`${t}-axis tick`,n,{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:l,x:d,...p,dy:"bottom"===e?+h-ir-f:+h+ir+ +u,anchor:"start",length:s,shape:"bottom"===e?hi:di})}(t,e,n,{stroke:i,strokeOpacity:a,strokeWidth:l,tickSize:p,tickPadding:m,tickRotate:g,y:y,...A}):null,wt(s)?null:function(t,e,n,{facetAnchor:r=e+("x"===t?"-empty":""),frameAnchor:o=e,tickSize:i,tickRotate:a=0,tickPadding:l=Math.max(3,9-i)+(Math.abs(a)>=10?4*Math.cos(a*Xr):0),tickFormat:s,text:c=("function"==typeof s?s:void 0),textAnchor:u=(Math.abs(a)>=10?a<0^"bottom"===e?"start":"end":"middle"),lineAnchor:f=(Math.abs(a)>=10?"middle":"bottom"===e?"top":"bottom"),fontVariant:h,inset:d=0,insetTop:p=d,insetBottom:m=d,dy:g=0,x:y=("x"===t?void 0:null),...v}){return ci(vo,t,`${t}-axis tick label`,n,{facetAnchor:r,frameAnchor:o,text:void 0===c?null:c,textAnchor:u,lineAnchor:f,fontVariant:h,rotate:a,x:y,...v,dy:"bottom"===e?+g+ +i+ +l-m:+g-i-l+ +p},(function(t,e,n){void 0===h&&(this.fontVariant=gi(t)),void 0===c&&(n.text=ui(t,e,s))}))}(t,e,n,{fill:s,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y:y,marginTop:x,marginRight:w,marginBottom:b,marginLeft:k,...A}),wt(s)||null===$?null:yo([],si({fill:s,fillOpacity:c,...A},(function(n,r,o,i,a){const l=i[t],{marginTop:s,marginRight:c,marginBottom:u,marginLeft:f}="x"===t&&a.inset||a,h=M??(l.bandwidth?"center":"right"),d=L??("top"===e?s:u)-3;return"center"===h?(this.frameAnchor=e,this.textAnchor=void 0):(this.frameAnchor=`${e}-${h}`,this.textAnchor="right"===h?"end":"start"),this.lineAnchor=e,this.dy="top"===e?-d:d,this.dx="right"===h?c-3:"left"===h?3-f:0,this.ariaLabel=`${t}-axis label`,{facets:[[0]],channels:{text:{value:[void 0===$?yi(t,l,h):$]}}}}))))}function ei(){const[t,e]=Yo(...arguments);return ii("y",Go(e),t,e)}function ni(){const[t,e]=Yo(...arguments);return ii("fy",Xo(e),t,e)}function ri(){const[t,e]=Yo(...arguments);return ai("x",Uo(e),t,e)}function oi(){const[t,e]=Yo(...arguments);return ai("fx",Ho(e),t,e)}function ii(t,e,n,{y:r=("y"===t?void 0:null),x:o=null,x1:i=("left"===e?o:null),x2:a=("right"===e?o:null),...l}){return ci(co,t,`${t}-grid`,n,{y:r,x1:i,x2:a,...li(l)})}function ai(t,e,n,{x:r=("x"===t?void 0:null),y:o=null,y1:i=("top"===e?o:null),y2:a=("bottom"===e?o:null),...l}){return ci(so,t,`${t}-grid`,n,{x:r,y1:i,y2:a,...li(l)})}function li({color:t="currentColor",opacity:e=.1,stroke:n=t,strokeOpacity:r=e,strokeWidth:o=1,...i}){return{stroke:n,strokeOpacity:r,strokeWidth:o,...i}}function si({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontWeight:i,monospace:a,pointerEvents:l,shapeRendering:s},c){return[,t]=j(t),[,e]=W(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontWeight:i,monospace:a,pointerEvents:l,shapeRendering:s,initializer:c}}function ci(t,n,r,o,i,a){let l;const s=t(o,Dt(i,(function(t,r,o,s){const{[n]:c}=s;if(!c)throw new Error(`missing scale: ${n}`);let{ticks:u,tickSpacing:f,interval:h}=i;if(Xn(c)&&"string"==typeof u&&(h=u,u=void 0),null==t){if(ut(u))t=F(u);else if(c.ticks)if(void 0!==u)t=c.ticks(u);else if(h=st(void 0===h?c.interval:h,c.type),void 0!==h){const[n,r]=e.extent(c.domain());t=h.range(n,h.offset(h.floor(r)))}else{const[r,o]=e.extent(c.range());u=(o-r)/(void 0===f?"x"===n?80:35:f),t=c.ticks(u)}else t=c.domain();"y"===n||"x"===n?r=[J(t)]:(l[n]={scale:n,value:M},r=void 0)}return a?.call(this,c,u,l),{data:t,facets:r,channels:Object.fromEntries(Object.entries(l).map((([e,n])=>[e,{...n,value:x(t,n.value)}])))}})));return null==o?(l=s.channels,s.channels={}):l={},s.ariaLabel=r,s}function ui(t,e,n){return{value:fi(t,e,n)}}function fi(t,n,r){return t.tickFormat?t.tickFormat(ut(n)?null:n,r):void 0===r?or:"string"==typeof r?(dt(t.domain())?e.utcFormat:e.format)(r):C(r)}const hi={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},di={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},pi={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},mi={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function gi(t){return t.bandwidth&&void 0===t.interval?void 0:"tabular-nums"}function yi(t,e,n){const r=e.label;if(e.bandwidth||!r?.inferred)return r;const o=function(t){return Math.sign($t(t.domain()))*Math.sign($t(t.range()))}(e);return o?"x"===t||"center"===n?"x"===t==o<0?`← ${r}`:`${r} →`:`${o<0?"↑ ":"↓ "}${r}`:r}const vi={ariaLabel:"frame",fill:"none",stroke:"currentColor"},xi={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square"};class wi extends _r{constructor(t={}){const{anchor:e=null,inset:n=0,insetTop:r=n,insetRight:o=n,insetBottom:i=n,insetLeft:a=n,rx:l,ry:s}=t;super(void 0,void 0,t,null==e?vi:xi),this.anchor=D(e,"anchor",["top","right","bottom","left"]),this.insetTop=z(r),this.insetRight=z(o),this.insetBottom=z(i),this.insetLeft=z(a),this.rx=z(l),this.ry=z(s)}render(t,e,n,r,o){const{marginTop:i,marginRight:a,marginBottom:l,marginLeft:s,width:c,height:u}=r,{anchor:f,insetTop:h,insetRight:d,insetBottom:p,insetLeft:m,rx:g,ry:y}=this,v=s+m,x=c-a-d,w=i+h,b=u-l-p;return _e(f?"svg:line":"svg:rect",o).call(mr,this,r,o).call(gr,this).call(xr,this,{}).call("left"===f?t=>t.attr("x1",v).attr("x2",v).attr("y1",w).attr("y2",b):"right"===f?t=>t.attr("x1",x).attr("x2",x).attr("y1",w).attr("y2",b):"top"===f?t=>t.attr("x1",v).attr("x2",x).attr("y1",w).attr("y2",w):"bottom"===f?t=>t.attr("x1",v).attr("x2",x).attr("y1",b).attr("y2",b):t=>t.attr("x",v).attr("y",w).attr("width",x-v).attr("height",b-w).attr("rx",g).attr("ry",y)).node()}}function bi(t){return new wi(t)}function ki(t={}){const{facet:n,style:r,caption:o,ariaLabel:i,ariaDescription:a}=t,l=$r(t.className),s=void 0===t.marks?[]:$i(t.marks),c=function(t,e){if(null==t)return;const{x:n,y:r}=t;if(null==n&&null==r)return;const o=F(t.data??n??r);if(void 0===o)throw new Error("missing facet data");const i={};null!=n&&(i.fx=we(o,{value:n,scale:"fx"}));null!=r&&(i.fy=we(o,{value:r,scale:"fy"}));Ai(i,e);const a=zr(o,i);return{channels:i,groups:a,data:t.data}}(n,t),u=new Map;for(const e of s){const n=Ei(e,c,t);n&&u.set(e,n)}const f=new Map;c&&Oi(f,[c]),Oi(f,u);const h=$i(function(t,e,n){let{projection:r,x:o={},y:i={},fx:a={},fy:l={},axis:s,grid:c,facet:u={},facet:{axis:f=s,grid:h}=u,x:{axis:d=s,grid:p=(null===d?null:c)}=o,y:{axis:m=s,grid:g=(null===m?null:c)}=i,fx:{axis:y=f,grid:v=(null===y?null:h)}=a,fy:{axis:x=f,grid:w=(null===x?null:h)}=l}=n;(r||!X(o)&&!Ni("x",t))&&(d=p=null);(r||!X(i)&&!Ni("y",t))&&(m=g=null);e.has("fx")||(y=v=null);e.has("fy")||(x=w=null);void 0===d&&(d=!Ti(t,"x"));void 0===m&&(m=!Ti(t,"y"));void 0===y&&(y=!Ti(t,"fx"));void 0===x&&(x=!Ti(t,"fy"));!0===d&&(d="bottom");!0===m&&(m="left");!0===y&&(y="top"===d||null===d?"bottom":"top");!0===x&&(x="right"===m||null===m?"left":"right");const b=[];return Ci(b,w,ni,l),Si(b,x,Zo,"right","left",u,l),Ci(b,v,oi,a),Si(b,y,Jo,"top","bottom",u,a),Ci(b,g,ei,i),Si(b,m,Vo,"left","right",n,i),Ci(b,p,ri,o),Si(b,d,Qo,"bottom","top",n,o),b}(s,f,t));for(const e of h){const n=Ei(e,c,t);n&&u.set(e,n)}s.unshift(...h);let d=function(t,n){const{fx:r,fy:o}=Cn(t,n),i=r?.scale.domain(),a=o?.scale.domain();return i&&a?e.cross(i,a).map((([t,e],n)=>({x:t,y:e,i:n}))):i?i.map(((t,e)=>({x:t,i:e}))):a?a.map(((t,e)=>({y:t,i:e}))):void 0}(f,t);if(void 0!==d){const t=c?Ir(d,c):void 0;for(const e of s){if(null===e.facet||"super"===e.facet)continue;const n=u.get(e);void 0!==n&&(n.facetsIndex=null!=e.fx||null!=e.fy?Ir(d,n):t)}const e=new Set;for(const{facetsIndex:t}of u.values())t?.forEach(((t,n)=>{t?.length>0&&e.add(n)}));d.forEach(0<e.size&&e.size<d.length?(t,n)=>t.empty=!e.has(n):t=>t.empty=!1);for(const t of s)if("exclude"===t.facet){const e=u.get(t);void 0!==e&&(e.facetsIndex=Or(e.facetsIndex))}}for(const e of St.keys())X(t[e])&&"fx"!==e&&"fy"!==e&&f.set(e,[]);const p=new Map;for(const e of s){if(p.has(e))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:n,channels:r}=u.get(e)??{},{data:o,facets:i,channels:a}=e.initialize(n,r);Ai(a,t),p.set(e,{data:o,facets:i,channels:a})}const m=Cn(Oi(f,p),t),g=Bn(m),y=function(t,e,n={}){let r=.5-ir,o=.5+ir,i=.5+ir,a=.5-ir;for(const{marginTop:t,marginRight:n,marginBottom:l,marginLeft:s}of e)t>r&&(r=t),n>o&&(o=n),l>i&&(i=l),s>a&&(a=s);let{margin:l,marginTop:s=(void 0!==l?l:r),marginRight:c=(void 0!==l?l:o),marginBottom:u=(void 0!==l?l:i),marginLeft:f=(void 0!==l?l:a)}=n;s=+s,c=+c,u=+u,f=+f;let{width:h=640,height:d=Ar(t,e,n,{width:h,marginTopDefault:r,marginRightDefault:o,marginBottomDefault:i,marginLeftDefault:a})+Math.max(0,s-r+u-i)}=n;h=+h,d=+d;const p={width:h,height:d,marginTop:s,marginRight:c,marginBottom:u,marginLeft:f};if(t.fx||t.fy){let{margin:t,marginTop:e=(void 0!==t?t:s),marginRight:r=(void 0!==t?t:c),marginBottom:o=(void 0!==t?t:u),marginLeft:i=(void 0!==t?t:f)}=n.facet??{};e=+e,r=+r,o=+o,i=+i,p.facet={marginTop:e,marginRight:r,marginBottom:o,marginLeft:i}}return p}(m,s,t);!function(t,e){const{x:n,y:r,fx:o,fy:i}=t,a=o||i?Nn(e):e;o&&Pn(o,a),i&&jn(i,a);const l=o||i?In(t,e):e;n&&Pn(n,l),r&&jn(r,l)}(m,y);const{fx:v,fy:x}=g,w=v||x?In(m,y):y,b=v||x?function({fx:t,fy:e},n){const{marginTop:r,marginRight:o,marginBottom:i,marginLeft:a,width:l,height:s}=Nn(n),c=t&&Ii(t),u=e&&Ii(e);return{marginTop:e?u[0]:r,marginRight:t?l-c[1]:o,marginBottom:e?s-u[1]:i,marginLeft:t?c[0]:a,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:l,height:s}}(g,y):y,k=Ye(t,w,l),$=new Set;for(const[e,n]of p)if(null!=e.initializer){const r="super"===e.facet?b:w,o=e.initializer(n.data,n.facets,n.channels,g,r,k);if(void 0!==o.data&&(n.data=o.data),void 0!==o.facets&&(n.facets=o.facets),void 0!==o.channels){zi(o.channels),Object.assign(n.channels,o.channels);for(const e of Object.values(o.channels)){const{scale:n}=e;null!=n&&St.get(n)!==Lt&&(Ri(e,t),$.add(n))}const{fx:r,fy:i}=o.channels;if(null!=r||null!=i){const t=u.get(e)??{channels:{}};null!=r&&(t.channels.fx=r),null!=i&&(t.channels.fy=i),t.groups=zr(n.data,t.channels),t.facetsIndex=n.facets=Ir(d,t),u.set(e,t)}}}if($.size){const e=new Map;Oi(e,p,(t=>$.has(t))),Oi(f,p,(t=>$.has(t)));const n=function(t,e){for(const n in t){const r=t[n],o=e[n];void 0===r.label&&o&&(r.label=o.label)}return t}(Cn(e,t),m),r=Bn(n);Object.assign(m,n),Object.assign(g,r)}for(const[t,e]of p)e.values=t.scale(e.channels,g,k);const{width:M,height:L}=y,A=_e("svg",k).attr("class",l).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",M).attr("height",L).attr("viewBox",`0 0 ${M} ${L}`).attr("aria-label",i).attr("aria-description",a).call((t=>t.append("style").text(`.${l} {\n display: block;\n background: white;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n}\n.${l} text,\n.${l} tspan {\n white-space: pre;\n}`))).call(Mr,r).node();if(void 0!==d){const t={x:v?.domain(),y:x?.domain()};d=function(t,{x:n,y:r}){return n&&=new e.InternMap(n.map(((t,e)=>[t,e]))),r&&=new e.InternMap(r.map(((t,e)=>[t,e]))),t.filter(n&&r?t=>n.has(t.x)&&r.has(t.y):n?t=>n.has(t.x):t=>r.has(t.y)).sort(n&&r?(t,e)=>n.get(t.x)-n.get(e.x)||r.get(t.y)-r.get(e.y):n?(t,e)=>n.get(t.x)-n.get(e.x):(t,e)=>r.get(t.y)-r.get(e.y))}(d,t),e.select(A).selectAll().data(d).enter().append("g").attr("aria-label","facet").attr("transform",function(t,e,{marginTop:n,marginLeft:r}){return t&&e?({x:o,y:i})=>`translate(${t(o)-r},${e(i)-n})`:t?({x:e})=>`translate(${t(e)-r},0)`:({y:t})=>`translate(0,${e(t)-n})`}(v,x,y)).each((function(e){let n=!0;for(const r of s){if("super"===r.facet)continue;const{channels:o,values:i,facets:a}=p.get(r);if(!(r.facetAnchor?.(d,t,e)??!e.empty))continue;let l=null;if(a){if(l=a[u.has(r)?e.i:0],l=r.filter(l,o,i),0===l.length)continue;l.fi=e.i}const s=r.render(l,g,i,w,k);null!=s&&(n=!1,this.appendChild(s))}n&&this.remove()}))}for(const t of s){if(void 0!==d&&"super"!==t.facet)continue;const{channels:e,values:n,facets:r}=p.get(t);let o=null;if(r&&(o=r[0],o=t.filter(o,e,n),0===o.length))continue;const i=t.render(o,g,n,b,k);null!=i&&A.appendChild(i)}let R=A;const z=function(t,e,n){const r=[];for(const[o,i]of Dr){const a=n[o];if(a?.legend&&o in t){const n=i(t[o],qr(e,t[o],a),(e=>t[e]));null!=n&&r.push(n)}}return r}(m,k,t);if(null!=o||z.length>0){const{document:t}=k;R=t.createElement("figure"),R.style.maxWidth="initial";for(const t of z)R.appendChild(t);if(R.appendChild(A),null!=o){const e=t.createElement("figcaption");e.appendChild(o?.ownerDocument?o:t.createTextNode(o)),R.appendChild(e)}}R.scale=function(t){return e=>{if(!St.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return e in t?Jn(t[e]):void 0}}(m),R.legend=function(t,e,n={}){return(r,o)=>{if(!Dr.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return Dr.get(r)(t[r],qr(e,n[r],o),(e=>t[e]))}}(m,k,t);const O=function(){const t=Ee;return Ee=0,t}();return O>0&&e.select(A).append("text").attr("x",M).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${O.toLocaleString("en-US")} warning${1===O?"":"s"}. Please check the console.`),R}function $i(t){return t.flat(1/0).filter((t=>null!=t)).map(Mi)}function Mi(t){return"function"==typeof t.render?t:new Li(t)}_r.prototype.plot=function({marks:t=[],...e}={}){return ki({...e,marks:[...t,this]})};class Li extends _r{constructor(t){if("function"!=typeof t)throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}}function Ai(t,e){for(const n in t)Ri(t[n],e);return t}function Ri(t,e){const{scale:n}=t;if(null==n)return;const{type:r,percent:o,interval:i,transform:a=(o?t=>100*t:lt(i,r)?.floor)}=e[n]??{};null!=a&&(t.value=Y(t.value,a))}function zi(t){for(const e in t)$e(e,t[e])}function Oi(t,e,n=A){for(const{channels:r}of e.values())for(const e in r){const o=r[e],{scale:i}=o;if(null!=i&&n(i)){const e=t.get(i);void 0!==e?e.push(o):t.set(i,[o])}}return t}function Ei(t,e,n){if(null===t.facet||"super"===t.facet)return;const{fx:r,fy:o}=t;if(null!=r||null!=o){const e=F(t.data??r??o);if(void 0===e)throw new Error(`missing facet data in ${t.ariaLabel}`);if(null===e)return;const i={};return null!=r&&(i.fx=we(e,{value:r,scale:"fx"})),null!=o&&(i.fy=we(e,{value:o,scale:"fy"})),Ai(i,n),{channels:i,groups:zr(e,i)}}if(void 0===e)return;const{channels:i,groups:a,data:l}=e;if("auto"!==t.facet||t.data===l)return{channels:i,groups:a};l.length>0&&(a.size>1||1===a.size&&i.fx&&i.fy&&[...a][0][1].size>1)&&F(t.data)?.length===l.length&&Se(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isnt 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 Si(t,e,n,r,o,i,a){if(!e)return;const l=/^\s*both\s*$/i.test(e);a=function(t,e,{line:n=e.line,ticks:r,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:l,tickRotate:s,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h=e.label,labelAnchor:d,labelOffset:p}){return{anchor:t,line:n,ticks:r,tickSize:o,tickSpacing:i,tickPadding:a,tickFormat:l,tickRotate:s,fontVariant:c,ariaLabel:u,ariaDescription:f,label:h,labelAnchor:d,labelOffset:p}}(l?r:e,i,a);const{line:s}=a;n!==Vo&&n!==Qo||!s||bt(s)||t.push(bi(function(t){const{anchor:e,line:n}=t;return{anchor:e,facetAnchor:e+"-empty",stroke:!0===n?void 0:n}}(a))),t.push(n(a)),l&&t.push(n({...a,anchor:o,label:null}))}function Ci(t,e,n,r){e&&!bt(e)&&t.push(n(function(t,{stroke:e=(vt(t)?t:void 0),ticks:n=(Bi(t)?t:void 0),tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}(e,r)))}function Bi(t){switch(typeof t){case"number":return!0;case"string":return!vt(t)}return ut(t)||"function"==typeof t?.range}function Ti(t,e){const n=`${e}-axis `;return t.some((t=>t.ariaLabel?.startsWith(n)))}function Ni(t,e){for(const n of e)for(const e in n.channels)if(n.channels[e].scale===t)return!0;return!1}function Ii(t){const e=t.domain();let n=t(e[0]),r=t(e[e.length-1]);return r<n&&([n,r]=[r,n]),[n,r+t.bandwidth()]}const Pi=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 ji(t=e.curveLinear,n){if("function"==typeof t)return t;const r=Pi.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 Wi(t=Di,e){return"function"!=typeof t&&"auto"===`${t}`.toLowerCase()?Di:ji(t,e)}function Di(t){return e.curveLinear(t)}function qi(t={y:"count"},e={}){[t,e]=Hi(t,e);const{x:n,y:r}=e;return Ui(Vi(n,e,M),null,null,r,t,Ur(e))}function Fi(t={x:"count"},e={}){[t,e]=Hi(t,e);const{x:n,y:r}=e;return Ui(null,Vi(r,e,M),n,null,t,Hr(e))}function Yi(t={fill:"count"},e={}){[t,e]=Hi(t,e);const{x:n,y:r}=function(t){let{x:e,y:n}=t;return e=Vi(e,t),n=Vi(n,t),[e.value,n.value]=Z(e.value,n.value),{x:e,y:n}}(e);return Ui(n,r,null,null,t,Ur(Hr(e)))}function _i(t,e,n={}){return null==n?.interval?n:t({[e]:void 0===n?.reduce?de:n.reduce,filter:null},n)}function Gi(t){return _i(qi,"y",t)}function Xi(t){return _i(Fi,"x",t)}function Ui(t,e,n,r,{data:o=he,filter:i=ge,sort:a,reverse:l,...s}={},c={}){t=Zi(t),e=Zi(e),s=function(t,e){return ne(t,e,Ji)}(s,c),o=ta(o,M),a=null==a?void 0:Ji("sort",a,c),i=null==i?void 0:Ki("filter",i,c),null!=n&&ee(s,"x","x1","x2")&&(n=null),null!=r&&ee(s,"y","y1","y2")&&(r=null);const[u,f]=rt(t),[h,d]=rt(t),[p,m]=rt(e),[g,y]=rt(e),[v,w]=null!=n?[n,"x"]:null!=r?[r,"y"]:[],[b,k]=rt(v),{x:$,y:L,z:A,fill:R,stroke:z,x1:O,x2:E,y1:S,y2:C,domain:B,cumulative:T,thresholds:N,interval:I,...P}=c,[W,D]=rt(A),[q]=j(R),[F]=j(z),[Y,_]=rt(q),[G,X]=rt(F);return{..."z"in c&&{z:W||A},..."fill"in c&&{fill:Y||R},..."stroke"in c&&{stroke:G||z},...Wt(P,((n,r)=>{const c=x(n,v),u=x(n,A),h=x(n,q),p=x(n,F),g=se(s,{z:u,fill:h,stroke:p}),w=[],b=[],$=c&&k([]),M=u&&D([]),L=h&&_([]),R=p&&X([]),z=t&&f([]),O=t&&d([]),E=e&&m([]),S=e&&y([]),C=(B=t?.(n),T=e?.(n),B&&T?function*(t){const e=B.bin(t);for(const[t,[n,r]]of B.entries()){const o=T.bin(e[t]);for(const[t,[e,i]]of T.entries())yield[o[t],{x1:n,y1:e,x2:r,y2:i}]}}:B?function*(t){const e=B.bin(t);for(const[t,[n,r]]of B.entries())yield[e[t],{x1:n,x2:r}]}:function*(t){const e=T.bin(t);for(const[t,[n,r]]of T.entries())yield[e[t],{y1:n,y2:r}]});var B,T;let N=0;for(const t of s)t.initialize(n);a&&a.initialize(n),i&&i.initialize(n);for(const t of r){const e=[];for(const e of s)e.scope("facet",t);a&&a.scope("facet",t),i&&i.scope("facet",t);for(const[r,l]of ie(t,g))for(const[t,f]of ie(l,c))for(const[l,d]of C(f))if(!i||i.reduce(l,d)){e.push(N++),b.push(o.reduceIndex(l,n,d)),c&&$.push(t),u&&M.push(g===u?r:u[l[0]]),h&&L.push(g===h?r:h[l[0]]),p&&R.push(g===p?r:p[l[0]]),z&&(z.push(d.x1),O.push(d.x2)),E&&(E.push(d.y1),S.push(d.y2));for(const t of s)t.reduce(l,d);a&&a.reduce(l)}w.push(e)}return ce(w,a,l),{data:b,facets:w}})),...!ee(s,"x")&&(u?{x1:u,x2:h,x:at(u,h)}:{x:$,x1:O,x2:E}),...!ee(s,"y")&&(p?{y1:p,y2:g,y:at(p,g)}:{y:L,y1:S,y2:C}),...b&&{[w]:b},...Object.fromEntries(s.map((({name:t,output:e})=>[t,e])))}}function Hi({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function Vi(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return void 0===(t={...ct(t)}).domain&&(t.domain=n),void 0===t.cumulative&&(t.cumulative=e),void 0===t.thresholds&&(t.thresholds=r),void 0===t.interval&&(t.interval=o),void 0===t.value&&(t.value=i),t.thresholds=Qi(t.thresholds,t.interval),t}function Zi(t){if(null==t)return;const{value:n,cumulative:r,domain:o=e.extent,thresholds:i}=t,a=t=>{let a,l=x(t,n);if(dt(l)||(function(t){return ra(t)&&"function"==typeof t&&t()instanceof Date}(s=i)||ut(s)&&dt(s))){l=Y(l,P,Float64Array);let[t,n]="function"==typeof o?o(l):o,r="function"!=typeof i||ra(i)?i:i(l,t,n);"number"==typeof r&&(r=e.utcTickInterval(t,n,r)),ra(r)&&(o===e.extent&&(t=r.floor(t),n=r.offset(r.floor(n))),r=r.range(t,r.offset(n))),a=r}else{l=T(l);let[t,n]="function"==typeof o?o(l):o,r="function"!=typeof i||ra(i)?i:i(l,t,n);if("number"==typeof r)if(o===e.extent){let o=e.tickIncrement(t,n,r);if(isFinite(o))if(o>0){let e=Math.round(t/o),i=Math.round(n/o);e*o<=t||--e,i*o>n||++i;let a=i-e+1;r=new Float64Array(a);for(let t=0;t<a;++t)r[t]=(e+t)*o}else if(o<0){o=-o;let e=Math.round(t*o),i=Math.round(n*o);e/o<=t||--e,i/o>n||++i;let a=i-e+1;r=new Float64Array(a);for(let t=0;t<a;++t)r[t]=(e+t)/o}else r=[t];else r=[t]}else r=e.ticks(t,n,r);else ra(r)&&(o===e.extent&&(t=r.floor(t),n=r.offset(r.floor(n))),r=r.range(t,r.offset(n)));a=r}var s;const c=[];if(1===a.length)c.push([a[0],a[0]]);else for(let t=1;t<a.length;++t)c.push([a[t-1],a[t]]);return c.bin=(r<0?aa:r>0?ia:oa)(c,a,l),c};return a.label=ot(n),a}function Qi(t,n,r=na){if(void 0===t)return void 0===n?r:st(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 na}return g(t)}return t}function Ji(t,e,n){return re(t,e,n,Ki)}function Ki(t,e,n){return oe(t,e,n,ta)}function ta(t,e){return ae(t,e,ea)}function ea(t){switch(`${t}`.toLowerCase()){case"x":return sa;case"x1":return ua;case"x2":return fa;case"y":return ca;case"y1":return ha;case"y2":return da}throw new Error(`invalid bin reduce: ${t}`)}function na(t,n,r){return Math.min(200,e.thresholdScott(t,n,r))}function ra(t){return"function"==typeof t?.range}function oa(t,n,r){return n=T(n),o=>{const i=t.map((()=>[]));for(const t of o)i[e.bisect(n,r[t])-1]?.push(t);return i}}function ia(t,e,n){const r=oa(t,e,n);return t=>{const e=r(t);for(let t=1,n=e.length;t<n;++t){const n=e[t-1],r=e[t];for(const t of n)r.push(t)}return e}}function aa(t,e,n){const r=oa(t,e,n);return t=>{const e=r(t);for(let t=e.length-2;t>=0;--t){const n=e[t+1],r=e[t];for(const t of n)r.push(t)}return e}}function la(t,e){const n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}const sa={reduceIndex:(t,e,{x1:n,x2:r})=>la(n,r)},ca={reduceIndex:(t,e,{y1:n,y2:r})=>la(n,r)},ua={reduceIndex:(t,e,{x1:n})=>n},fa={reduceIndex:(t,e,{x2:n})=>n},ha={reduceIndex:(t,e,{y1:n})=>n},da={reduceIndex:(t,e,{y2:n})=>n};function pa(t={}){const{x:e,x1:n,x2:r}=t;return void 0===n&&void 0===r&&void 0===e?{...t,x:M}:t}function ma(t={}){const{y:e,y1:n,y2:r}=t;return void 0===n&&void 0===r&&void 0===e?{...t,y:M}:t}function ga(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{y1:n,y:r=n,x:o,...i}=e,[a,l,s,c]=ba(r,o,"x",t,i);return{...a,y1:n,y:l,x1:s,x2:c,x:at(s,c)}}function ya(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{x1:n,x:r=n,y:o,...i}=e,[a,l,s,c]=ba(r,o,"y",t,i);return{...a,x1:n,x:l,y1:s,y2:c,y:at(s,c)}}function va({x:t,x1:e,x2:n,...r}={}){return void 0===e&&void 0===n?ga({x:t,...r}):([e,n]=V(t,e,n),{...r,x1:e,x2:n})}function xa({y:t,y1:e,y2:n,...r}={}){return void 0===e&&void 0===n?ya({y:t,...r}):([e,n]=V(t,e,n),{...r,y1:e,y2:n})}function wa(t){const{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}const ba=function(t,n=L,r,{offset:o,order:i,reverse:a},l){const s=Q(l),[c,u]=rt(t),[f,h]=nt(n),[d,p]=nt(n);return o=function(t){if(null==t)return;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return $a;case"center":case"silhouette":return Ma;case"wiggle":return La}throw new Error(`unknown offset: ${t}`)}(o),i=function(t,e,n){if(void 0===t&&e===La)return Ca;if(null==t)return;if("string"==typeof t){switch(t.toLowerCase()){case"value":case n:return za;case"z":return Oa;case"sum":return Ea;case"appearance":return Sa;case"inside-out":return Ca}return Ba(k(t))}if("function"==typeof t)return Ba(t);if(Array.isArray(t))return r=t,(t,e,n,o)=>Ta(o,r);var r;throw new Error(`invalid order: ${t}`)}(i,o,r),[Wt(l,((r,l)=>{const c=null==t?void 0:u(x(r,t)),f=x(r,n,Float64Array),d=x(r,s),m=i&&i(r,c,f,d),g=r.length,y=h(new Float64Array(g)),v=p(new Float64Array(g)),w=[];for(const t of l){const n=c?Array.from(e.group(t,(t=>c[t])).values()):[t];m&&Na(n,m);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=v[r]=(y[r]=e)+t:t>0?n=v[r]=(y[r]=n)+t:v[r]=y[r]=n}}w.push(n)}return o&&o(w,y,v,d),{data:r,facets:l}})),c,f,d]};function ka(t,e){let n=0,r=0;for(const o of t){const t=e[o];t<n&&(n=t),t>r&&(r=t)}return[n,r]}function $a(t,e,n){for(const r of t)for(const t of r){const[r,o]=ka(t,n);for(const i of t){const t=1/(o-r||1);e[i]=t*(e[i]-r),n[i]=t*(n[i]-r)}}}function Ma(t,e,n){for(const r of t){for(const t of r){const[r,o]=ka(t,n);for(const i of t){const t=(o+r)/2;e[i]-=t,n[i]-=t}}Aa(r,e,n)}Ra(t,e,n)}function La(t,n,r,o){for(const i of t){const t=new e.InternMap;let a=0;for(const l of i){let i=-1;const s=l.map((t=>Math.abs(r[t]-n[t]))),c=l.map((e=>{i=o?o[e]:++i;const a=r[e]-n[e],l=t.has(i)?a-t.get(i):0;return t.set(i,a),l})),u=[0,...e.cumsum(c)];for(const t of l)n[t]+=a,r[t]+=a;const f=e.sum(s);f&&(a-=e.sum(s,((t,e)=>(c[e]/2+u[e])*t))/f)}Aa(i,n,r)}Ra(t,n,r)}function Aa(t,n,r){const o=e.min(t,(t=>e.min(t,(t=>n[t]))));for(const e of t)for(const t of e)n[t]-=o,r[t]-=o}function Ra(t,n,r){const o=t.length;if(1===o)return;const i=t.map((t=>t.flat())),a=i.map((t=>(e.min(t,(t=>n[t]))+e.max(t,(t=>r[t])))/2)),l=e.min(a);for(let t=0;t<o;t++){const e=l-a[t];for(const o of i[t])n[o]+=e,r[o]+=e}}function za(t,e,n){return n}function Oa(t,e,n,r){return r}function Ea(t,n,r,o){return Ta(o,e.groupSort(J(t),(t=>e.sum(t,(t=>r[t]))),(t=>o[t])))}function Sa(t,n,r,o){return Ta(o,e.groupSort(J(t),(t=>n[e.greatest(t,(t=>r[t]))]),(t=>o[t])))}function Ca(t,n,r,o){const i=J(t),a=e.groupSort(i,(t=>n[e.greatest(t,(t=>r[t]))]),(t=>o[t])),l=e.rollup(i,(t=>e.sum(t,(t=>r[t]))),(t=>o[t])),s=[],c=[];let u=0;for(const t of a)u<0?(u+=l.get(t),s.push(t)):(u-=l.get(t),c.push(t));return Ta(o,c.reverse().concat(s))}function Ba(t){return e=>x(e,t)}function Ta(t,n){if(!t)throw new Error("missing channel: z");return n=new e.InternMap(n.map(((t,e)=>[t,e]))),t.map((t=>n.get(t)))}function Na(t,e){for(const n of t)n.sort(((t,n)=>r(e[t],e[n])))}const Ia={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Pa extends _r{constructor(t,e={}){const{x1:n,y1:r,x2:o,y2:i,z:a,curve:l,tension:s}=e;super(t,{x1:{value:n,scale:"x"},y1:{value:r,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:i,scale:"y",optional:!0},z:{value:Q(e),optional:!0}},e,Ia),this.z=a,this.curve=ji(l,s)}filter(t){return t}render(t,n,r,o,i){const{x1:a,y1:l,x2:s=a,y2:c=l}=r;return _e("svg:g",i).call(mr,this,o,i).call(xr,this,n,0,0).call((n=>n.selectAll().data(pr(t,[a,l,s,c],this,r)).enter().append("path").call(gr,this).call(hr,this,r).attr("d",e.area().curve(this.curve).defined((t=>t>=0)).x0((t=>a[t])).y0((t=>l[t])).x1((t=>s[t])).y1((t=>c[t]))))).node()}}function ja(t,e){const{y:n=$,...r}=Xi(e);return new Pa(t,va(pa({...r,y1:n,y2:void 0})))}function Wa(t,e){const{x:n=$,...r}=Gi(e);return new Pa(t,xa(ma({...r,x1:n,x2:void 0})))}function Da(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=qa(n),t.markerMid=qa(r),t.markerEnd=qa(o)}function qa(t){if(null==t||!1===t)return null;if(!0===t)return _a;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return Fa;case"dot":return Ya;case"circle":case"circle-fill":return _a;case"circle-stroke":return Ga}throw new Error(`invalid marker: ${t}`)}function Fa(t,e){return _e("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 Ya(t,e){return _e("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 _a(t,e){return _e("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 Ga(t,e){return _e("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 Xa=0;function Ua(t,e,{stroke:n},r){return Va(t,e,n&&(t=>n[t]),r)}function Ha(t,e,{stroke:n},r){return Va(t,e,n&&(([t])=>n[t]),r)}function Va(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=(()=>o),a){const l=new Map;function s(t){return function(e){const n=i(e);let r=l.get(t);r||l.set(t,r=new Map);let o=r.get(n);if(!o){const e=this.parentNode.insertBefore(t(n,a),this),i="plot-marker-"+ ++Xa;e.setAttribute("id",i),r.set(n,o=`url(#${i})`)}return o}}e&&t.attr("marker-start",s(e)),n&&t.attr("marker-mid",s(n)),r&&t.attr("marker-end",s(r))}const Za={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class Qa extends _r{constructor(t,e={}){const{x1:n,y1:r,x2:o,y2:i,curve:a,tension:l}=e;super(t,{x1:{value:n,scale:"x"},y1:{value:r,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:i,scale:"y",optional:!0}},e,Za),this.curve=Wi(a,l),Da(this,e)}project(t,e,n){this.curve!==Di&&super.project(t,e,n)}render(t,n,r,o,i){const{x1:a,y1:l,x2:s=a,y2:c=l}=r,{curve:u}=this;return _e("svg:g",i).call(mr,this,o,i).call(xr,this,n).call((n=>n.selectAll().data(t).enter().append("path").call(gr,this).attr("d",u===Di&&i.projection?function(t,n,r,o,i){const a=e.geoPath(t);return n=T(n),r=T(r),o=T(o),i=T(i),t=>a({type:"LineString",coordinates:[[n[t],r[t]],[o[t],i[t]]]})}(i.projection,a,l,s,c):t=>{const n=e.pathRound(),r=u(n);return r.lineStart(),r.point(a[t],l[t]),r.point(s[t],c[t]),r.lineEnd(),n}).call(fr,this,r).call(Ua,this,r,i))).node()}}function Ja(t,e={}){let{x:n,x1:r,x2:o,y:i,y1:a,y2:l,...s}=e;return[r,o]=Ka(n,r,o),[a,l]=Ka(i,a,l),new Qa(t,{...s,x1:r,x2:o,y1:a,y2:l})}function Ka(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 tl={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class el extends _r{constructor(t,e={}){const{x1:n,y1:r,x2:o,y2:i,bend:a=0,headAngle:l=60,headLength:s=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:o,scale:"x",optional:!0},y2:{value:i,scale:"y",optional:!0}},e,tl),this.bend=!0===a?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+l,this.headLength=+s,this.insetStart=+u,this.insetEnd=+f}render(t,e,n,r,o){const{x1:i,y1:a,x2:l=i,y2:s=a,SW:c}=n,{strokeWidth:u,bend:f,headAngle:h,headLength:d,insetStart:p,insetEnd:m}=this,g=c?t=>c[t]:C(void 0===u?1:u),y=f*Xr,v=h*Xr/2,x=d/1.5;return _e("svg:g",o).call(mr,this,r,o).call(xr,this,e).call((e=>e.selectAll().data(t).enter().append("path").call(gr,this).attr("d",(t=>{let e=i[t],n=a[t],r=l[t],o=s[t];const c=Math.hypot(r-e,o-n);if(c<=p+m)return null;let u=Math.atan2(o-n,r-e);const f=Math.min(x*g(t),c/3),h=Math.hypot(c/Math.tan(y),c)/2;if(p||m)if(h<1e5){const t=Math.sign(y),[i,a]=function([t,e],[n,r],o,i){const a=n-t,l=r-e,s=Math.hypot(a,l),c=i*Math.sqrt(o*o-s*s/4)/s;return[(t+n)/2-l*c,(e+r)/2+a*c]}([e,n],[r,o],h,t);if(p&&([e,n]=nl([i,a,h],[e,n,p],-t*Math.sign(p))),m){const[e,n]=nl([i,a,h],[r,o,m],t*Math.sign(m));u+=Math.atan2(n-a,e-i)-Math.atan2(o-a,r-i),r=e,o=n}}else{const t=r-e,i=o-n,a=Math.hypot(t,i);p&&(e+=t/a*p,n+=i/a*p),m&&(r-=t/a*m,o-=i/a*m)}const d=u+y,w=d+v,b=d-v,k=r-f*Math.cos(w),$=o-f*Math.sin(w),M=r-f*Math.cos(b),L=o-f*Math.sin(b);return`M${e},${n}${h<1e5?`A${h},${h} 0,0,${y>0?1:0} `:"L"}${r},${o}M${k},${$}L${r},${o}L${M},${L}`})).call(fr,this,n))).node()}}function nl([t,e,n],[r,o,i],a){const l=r-t,s=o-e,c=Math.hypot(l,s),u=(l*l+s*s-i*i+n*n)/(2*c),f=a*Math.sqrt(n*n-u*u);return[t+(l*u+s*f)/c,e+(s*u-l*f)/c]}class rl extends _r{constructor(t,e,n={},r){super(t,e,n,r);const{inset:o=0,insetTop:i=o,insetRight:a=o,insetBottom:l=o,insetLeft:s=o,rx:c,ry:u}=n;this.insetTop=z(i),this.insetRight=z(a),this.insetBottom=z(l),this.insetLeft=z(s),this.rx=wr(c,"auto"),this.ry=wr(u,"auto")}render(t,e,n,r,o){const{rx:i,ry:a}=this;return _e("svg:g",o).call(mr,this,r,o).call(this._transform,this,e).call((o=>o.selectAll().data(t).enter().append("rect").call(gr,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(vr,"rx",i).call(vr,"ry",a).call(fr,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:o}){const{insetLeft:i,insetRight:a}=this,l=e&&t?t.bandwidth():o-n-r;return Math.max(0,l-i-a)}_height({y:t},{y:e},{marginTop:n,marginBottom:r,height:o}){const{insetTop:i,insetBottom:a}=this,l=e&&t?t.bandwidth():o-n-r;return Math.max(0,l-i-a)}}const ol={ariaLabel:"bar"};class il extends rl{constructor(t,e={}){const{x1:n,x2:r,y:o}=e;super(t,{x1:{value:n,scale:"x"},x2:{value:r,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},e,ol)}_transform(t,e,{x:n}){t.call(xr,e,{x:n},0,0)}_x({x:t},{x1:e,x2:n},{marginLeft:r}){const{insetLeft:o}=this;return Vn(t)?r+o:t=>Math.min(e[t],n[t])+o}_width({x:t},{x1:e,x2:n},{marginRight:r,marginLeft:o,width:i}){const{insetLeft:a,insetRight:l}=this;return Vn(t)?i-r-o-a-l:t=>Math.max(0,Math.abs(n[t]-e[t])-a-l)}}class al extends rl{constructor(t,e={}){const{x:n,y1:r,y2:o}=e;super(t,{y1:{value:r,scale:"y"},y2:{value:o,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},e,ol)}_transform(t,e,{y:n}){t.call(xr,e,{y:n},0,0)}_y({y:t},{y1:e,y2:n},{marginTop:r}){const{insetTop:o}=this;return Vn(t)?r+o:t=>Math.min(e[t],n[t])+o}_height({y:t},{y1:e,y2:n},{marginTop:r,marginBottom:o,height:i}){const{insetTop:a,insetBottom:l}=this;return Vn(t)?i-r-o-a-l:t=>Math.max(0,Math.abs(n[t]-e[t])-a-l)}}function ll(t,e={y:$,x2:M}){return new il(t,va(eo(pa(e))))}function sl(t,e={x:$,y2:M}){return new al(t,xa(no(ma(e))))}const cl={ariaLabel:"cell"};class ul extends rl{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,cl)}_transform(t,e){t.call(xr,e,{},0,0)}}function fl(t,e={}){let{x:n,y:r,...o}=e;return[n,r]=Z(n,r),new ul(t,{...o,x:n,y:r})}const hl={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function dl(t){return void 0===t.sort&&void 0===t.reverse?Xt({channel:"r",order:"descending"},t):t}class pl extends _r{constructor(t,n={}){const{x:r,y:o,r:i,rotate:a,symbol:s=e.symbolCircle,frameAnchor:c}=n,[u,f]=W(a,0),[h,d]=function(t){if(null==t||It(t))return[void 0,t];if("string"==typeof t){const e=Nt.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}(s),[p,m]=W(i,null==h?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:o,scale:"y",optional:!0},r:{value:p,scale:"r",filter:l,optional:!0},rotate:{value:u,optional:!0},symbol:{value:h,scale:"auto",optional:!0}},dl(n),hl),this.r=m,this.rotate=f,this.symbol=d,this.frameAnchor=kt(c);const{channels:g}=this,{symbol:y}=g;if(y){const{fill:t,stroke:e}=g;y.hint={fill:t?t.value===y.value?"color":"currentColor":this.fill,stroke:e?e.value===y.value?"color":"currentColor":this.stroke}}}render(t,n,r,o,i){const{x:a,y:l}=n,{x:c,y:u,r:f,rotate:h,symbol:d}=r,{r:p,rotate:m,symbol:g}=this,[y,v]=Lr(this,o),x=this.symbol===e.symbolCircle,w=f?void 0:p*p*Math.PI;return s(p)&&(t=[]),_e("svg:g",i).call(mr,this,o,i).call(xr,this,{x:c&&a,y:u&&l}).call((n=>n.selectAll().data(t).enter().append(x?"circle":"path").call(gr,this).call(x?t=>{t.attr("cx",c?t=>c[t]:y).attr("cy",u?t=>u[t]:v).attr("r",f?t=>f[t]:p)}:t=>{t.attr("transform",fo`translate(${c?t=>c[t]:y},${u?t=>u[t]:v})${h?t=>` rotate(${h[t]})`:m?` rotate(${m})`:""}`).attr("d",f&&d?t=>{const n=e.pathRound();return d[t].draw(n,f[t]*f[t]*Math.PI),n}:f?t=>{const n=e.pathRound();return g.draw(n,f[t]*f[t]*Math.PI),n}:d?t=>{const n=e.pathRound();return d[t].draw(n,w),n}:(()=>{const t=e.pathRound();return g.draw(t,w),t})())}).call(fr,this,r))).node()}}function ml(t,e={}){let{x:n,y:r,...o}=e;return void 0===e.frameAnchor&&([n,r]=Z(n,r)),new pl(t,{...o,x:n,y:r})}const gl={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class yl extends _r{constructor(t,e={}){const{x:n,y:r,z:o,curve:i,tension:a}=e;super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y"},z:{value:Q(e),optional:!0}},e,gl),this.z=o,this.curve=Wi(i,a),Da(this,e)}filter(t){return t}project(t,e,n){this.curve!==Di&&super.project(t,e,n)}render(t,n,r,o,i){const{x:a,y:l}=r,{curve:s}=this;return _e("svg:g",i).call(mr,this,o,i).call(xr,this,n).call((n=>n.selectAll().data(pr(t,[a,l],this,r)).enter().append("path").call(gr,this).call(hr,this,r).call(Ha,this,r,i).attr("d",s===Di&&i.projection?function(t,n,r){const o=e.geoPath(t);return n=T(n),r=T(r),t=>{let e=[];const i=[e];for(const o of t)-1===o?(e=[],i.push(e)):e.push([n[o],r[o]]);return o({type:"MultiLineString",coordinates:i})}}(i.projection,a,l):e.line().curve(s).defined((t=>t>=0)).x((t=>a[t])).y((t=>l[t]))))).node()}}function vl(t,e={}){let{x:n,y:r,...o}=e;return[n,r]=Z(n,r),new yl(t,{...o,x:n,y:r})}function xl(t,e={}){const{x:n=M,y:r=$,...o}=e;return new yl(t,Xi({...o,x:n,y:r}))}function wl(t,e={}){const{x:n=$,y:r=M,...o}=e;return new yl(t,Gi({...o,x:n,y:r}))}const bl={ariaLabel:"rect"};class kl extends _r{constructor(t,e={}){const{x1:n,y1:r,x2:o,y2:i,inset:a=0,insetTop:l=a,insetRight:s=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:o,scale:"x",optional:!0},y2:{value:i,scale:"y",optional:!0}},e,bl),this.insetTop=z(l),this.insetRight=z(s),this.insetBottom=z(c),this.insetLeft=z(u),this.rx=wr(f,"auto"),this.ry=wr(h,"auto")}render(t,e,n,r,o){const{x:i,y:a}=e,{x1:l,y1:s,x2:c,y2:u}=n,{marginTop:f,marginRight:h,marginBottom:d,marginLeft:p,width:m,height:g}=r,{projection:y}=o,{insetTop:v,insetRight:x,insetBottom:w,insetLeft:b,rx:k,ry:$}=this;return _e("svg:g",o).call(mr,this,r,o).call(xr,this,{x:l&&c&&i,y:s&&u&&a},0,0).call((e=>e.selectAll().data(t).enter().append("rect").call(gr,this).attr("x",l&&c&&(y||!Vn(i))?t=>Math.min(l[t],c[t])+b:p+b).attr("y",s&&u&&(y||!Vn(a))?t=>Math.min(s[t],u[t])+v:f+v).attr("width",l&&c&&(y||!Vn(i))?t=>Math.max(0,Math.abs(c[t]-l[t])-b-x):m-h-p-x-b).attr("height",s&&u&&(y||!Vn(a))?t=>Math.max(0,Math.abs(s[t]-u[t])-v-w):g-f-d-v-w).call(vr,"rx",k).call(vr,"ry",$).call(fr,this,n))).node()}}function $l(t,e={y:$,interval:1,x2:M}){return new kl(t,va(to(pa(e))))}function Ml(t,e={x:$,interval:1,y2:M}){return new kl(t,xa(Kr(ma(e))))}function Ll(t,e){e=function({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:a}={}){U(t)||(t=zl(t));U(e)||(e=zl(e));U(n)||(n=vt(n)?{color:n}:zl(n));U(r)||(r=zl(r));U(o)&&({value:o}=zl(o));U(i)&&({value:i}=zl(i));null!=a&&(a=`${a}`.toLowerCase());return{x:t,y:e,color:n,size:r,fx:o,fy:i,mark:a}}(e);const{x:n,y:r,color:o,size:i}=e,a=Rl(t,n),l=Rl(t,r),s=Rl(t,o),c=Rl(t,i);let u,f,h,{fx:d,fy:p,x:{value:m,reduce:g,zero:y,...v},y:{value:x,reduce:w,zero:b,...k},color:{value:$,color:M,reduce:L},size:{value:A,reduce:R},mark:z}=e;if(void 0===g&&(g=null==w&&null==m&&null==A&&null!=x?"count":null),void 0===w&&(w=null==g&&null==x&&null==A&&null!=m?"count":null),void 0!==R||null!=A||null!=L||null!=g||null!=w||null!=m&&!ht(a)||null!=x&&!ht(l)||(R="count"),void 0===y&&(y=!!Ol(g)||void 0),void 0===b&&(b=!!Ol(w)||void 0),null==m&&null==x)throw new Error("must specify x or y");if(null!=g&&null==x)throw new Error("reducing x requires y");if(null!=w&&null==m)throw new Error("reducing y requires x");switch(void 0===z&&(z=null!=A||null!=R?"dot":Ol(g)||Ol(w)||null!=L?"bar":null!=m&&null!=x?ht(a)||ht(l)||null==g&&null==w&&!Al(a)&&!Al(l)?"dot":"line":null!=m||null!=x?"rule":null),z){case"dot":h=ml,f="stroke";break;case"line":h=a&&l?vl:a?xl:wl,f="stroke",Sl(s)&&(u=null);break;case"area":h=b?Wa:y||l&&Al(l)?ja:Wa,f="fill",Sl(s)&&(u=null);break;case"rule":h=a?so:co,f="stroke";break;case"bar":h=b?El(g,a)?sl:Ml:y?El(w,l)?ll:$l:El(g,a)&&El(w,l)?fl:El(g,a)?sl:El(w,l)?ll:Ml,f="fill";break;default:throw new Error(`invalid mark: ${z}`)}let O,E={fx:d,fy:p,x:a??void 0,y:l??void 0,[f]:s??M,z:u,r:c??void 0},S={[f]:L??void 0,r:R??void 0};if(null!=g&&null!=w)throw new Error("cannot reduce both x and y");return null!=w?(S.y=w,O=ht(a)?Qt:qi):null!=g?(S.x=g,O=ht(l)?Jt:Fi):null==L&&null==R||(a&&l?O=ht(a)&&ht(l)?Kt:ht(a)?Fi:ht(l)?qi:Yi:a?O=ht(a)?Qt:qi:l&&(O=ht(l)?Jt:Fi)),O!==Yi&&O!==qi||(E.x={value:a,...v}),O!==Yi&&O!==Fi||(E.y={value:l,...k}),void 0===y&&(y=a&&!(O===Yi||O===qi)&&(h===ll||h===ja||h===$l||h===co)),void 0===b&&(b=l&&!(O===Yi||O===Fi)&&(h===sl||h===Wa||h===Ml||h===so)),{fx:d??null,fy:p??null,x:{value:m??null,reduce:g??null,zero:!!y,...v},y:{value:x??null,reduce:w??null,zero:!!b,...k},color:{value:$??null,reduce:L??null,...void 0!==M&&{color:M}},size:{value:A??null,reduce:R??null},mark:z,markImpl:h,markOptions:E,transformImpl:O,transformOptions:S,colorMode:f}}function Al(t){let n,r;for(const o of t){if(null==o)continue;if(void 0===n){n=o;continue}const t=Math.sign(e.ascending(n,o));if(t){if(void 0!==r&&t!==r)return!1;n=o,r=t}}return!0}function Rl(t,e){const n=x(t,e.value);return n&&(n.label=ot(e.value)),n}function zl(t){return function(t){if(null==t)return!1;if("function"==typeof t.reduceIndex)return!0;if("function"==typeof t.reduce&&G(t))return!0;if(/^p\d{2}$/i.test(t))return!0;switch(`${t}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}(t)?{reduce:t}:{value:t}}function Ol(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function El(t,e){return!(null!=t&&!function(t){return/^(?:first|last|mode)$/i.test(t)}(t)||!e)&&ht(e)}function Sl(t){return!!t&&new e.InternSet(t).size>t.length>>1}function Cl(t,e={}){return Nl(Object.fromEntries(["x","x1","x2"].filter((t=>null!=e[t])).map((e=>[e,t]))),e)}function Bl(t,e={}){return Nl(Object.fromEntries(["y","y1","y2"].filter((t=>null!=e[t])).map((e=>[e,t]))),e)}function Tl(t={},n={}){const r=Q(n),o=Object.entries(t).map((([t,e])=>{const r=et(t,n);if(null==r)throw new Error(`missing channel: ${t}`);const[o,i]=nt(r);return{key:t,input:r,output:o,setOutput:i,map:Il(e)}}));return{...Wt(n,((t,n)=>{const i=x(t,r),a=o.map((({input:e})=>x(t,e))),l=o.map((({setOutput:e})=>e(new Array(t.length))));for(const t of n)for(const n of i?e.group(t,(t=>i[t])).values():[t])o.forEach((({map:t},e)=>t.mapIndex(n,a[e],l[e])));return{data:t,facets:n}})),...Object.fromEntries(o.map((({key:t,output:e})=>[t,e])))}}const Nl=Tl;function Il(t){if(null==t)throw new Error("missing map");if("function"==typeof t.mapIndex)return t;if("function"==typeof t.map&&G(t))return function(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}(t);if("function"==typeof t)return jl(t);switch(`${t}`.toLowerCase()){case"cumsum":return Wl;case"rank":return jl(e.rank);case"quantile":return jl(Pl)}throw new Error(`invalid map: ${t}`)}function Pl(t){const n=e.count(t)-1;return e.rank(t).map((t=>t/n))}function jl(t){return{mapIndex(e,n,r){const o=t(K(n,e));if(o.length!==e.length)throw new Error("map function returned a mismatched length");for(let t=0,n=e.length;t<n;++t)r[e[t]]=o[t]}}}const Wl={mapIndex(t,e,n){let r=0;for(const o of t)n[o]=r+=e[o]}},Dl={ariaLabel:"tick",fill:null,stroke:"currentColor"};class ql extends _r{constructor(t,e,n){super(t,e,n,Dl)}render(t,e,n,r,o){return _e("svg:g",o).call(mr,this,r,o).call(this._transform,this,e).call((o=>o.selectAll().data(t).enter().append("line").call(gr,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(fr,this,n))).node()}}class Fl extends ql{constructor(t,e={}){const{x:n,y:r,inset:o=0,insetTop:i=o,insetBottom:a=o}=e;super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y",type:"band",optional:!0}},e),this.insetTop=z(i),this.insetBottom=z(a)}_transform(t,e,{x:n}){t.call(xr,e,{x:n},ir,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:o}=this;return e&&t?n=>e[n]+t.bandwidth()-o:n-r-o}}class Yl extends ql{constructor(t,e={}){const{x:n,y:r,inset:o=0,insetRight:i=o,insetLeft:a=o}=e;super(t,{y:{value:r,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},e),this.insetRight=z(i),this.insetLeft=z(a)}_transform(t,e,{y:n}){t.call(xr,e,{y:n},0,ir)}_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:o}=this;return e&&t?n=>e[n]+t.bandwidth()-o:n-r-o}_y1(t,{y:e}){return t=>e[t]}_y2(t,{y:e}){return t=>e[t]}}function _l(t,e={}){const{x:n=M,...r}=e;return new Fl(t,{...r,x:n})}function Gl(t,e={}){const{y:n=M,...r}=e;return new Yl(t,{...r,y:n})}function Xl(t){const e=Ul(t),n=Hl(t);return t.map((t=>t<e||t>n?t:NaN))}function Ul(t){const n=2.5*Vl(t)-1.5*Zl(t);return e.min(t,(t=>t>=n?t:NaN))}function Hl(t){const n=2.5*Zl(t)-1.5*Vl(t);return e.max(t,(t=>t<=n?t:NaN))}function Vl(t){return e.quantile(t,.25)}function Zl(t){return e.quantile(t,.75)}const Ql={ariaLabel:"raster",stroke:null,pixelSize:1};function Jl(t,e){const n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function Kl(t,e){const n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}class ts extends _r{constructor(t,e,n={},r){let{width:o,height:i,x:a,y:l,x1:s=(null==a?0:void 0),y1:c=(null==l?0:void 0),x2:u=(null==a?o:void 0),y2:f=(null==l?i:void 0),pixelSize:h=r.pixelSize,blur:d=0,interpolate:p}=n;if(null!=o&&(o=Kl(o,"width")),null!=i&&(i=Kl(i,"height")),null!=s&&(s=Jl(s,"x1")),null!=c&&(c=Jl(c,"y1")),null!=u&&(u=Jl(u,"x2")),null!=f&&(f=Jl(f,"y2")),null==a&&(null==s||null==u))throw new Error("missing x");if(null==l&&(null==c||null==f))throw new Error("missing y");null!=t&&null!=o&&null!=i&&(void 0===a&&null!=s&&null!=u&&(a=function(t,e,n){return{transform(r){const o=r.length,i=new Float64Array(o),a=(e-t)/n,l=t+a/2;for(let t=0;t<o;++t)i[t]=t%n*a+l;return i}}}(s,u,o)),void 0===l&&null!=c&&null!=f&&(l=function(t,e,n,r){return{transform(o){const i=o.length,a=new Float64Array(i),l=(e-t)/r,s=t+l/2;for(let t=0;t<i;++t)a[t]=Math.floor(t/n)%r*l+s;return a}}}(c,f,o,i))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:l,scale:"y",optional:!0},x1:{value:null==s?null:[s],scale:"x",optional:!0,filter:null},y1:{value:null==c?null:[c],scale:"y",optional:!0,filter:null},x2:{value:null==u?null:[u],scale:"x",optional:!0,filter:null},y2:{value:null==f?null:[f],scale:"y",optional:!0,filter:null},...e},n,r),this.width=o,this.height=i,this.pixelSize=Jl(h,"pixelSize"),this.blur=Jl(d,"blur"),this.interpolate=null==a||null==l?null:function(t){if("function"==typeof t)return t;if(null==t)return as;switch(`${t}`.toLowerCase()){case"none":return as;case"nearest":return ss;case"barycentric":return ls();case"random-walk":return cs()}throw new Error(`invalid interpolate: ${t}`)}(p)}}class es extends ts{constructor(t,e={}){const{imageRendering:n}=e;if(null==t){const{fill:t,fillOpacity:n}=e;void 0!==W(n)[0]&&(e=is("fillOpacity",e)),void 0!==j(t)[0]&&(e=is("fill",e))}super(t,void 0,e,Ql),this.imageRendering=wr(n,"auto")}scale(t,{color:e,...n},r){return super.scale(t,n,r)}render(t,n,r,o,i){const a=n[r.channels.fill?.scale]??(t=>t),{x:l,y:s}=r,{document:c}=i,[u,f,h,d]=rs(r,o,i),p=h-u,m=d-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:v=Math.round(Math.abs(m)/g)}=this,x=y*v;let{fill:w,fillOpacity:b}=r,k=0;if(this.interpolate){const e=y/p,n=v/m,r=Y(l,(t=>(t-u)*e),Float64Array),o=Y(s,(t=>(t-f)*n),Float64Array);w&&(w=this.interpolate(t,y,v,r,o,w)),b&&(b=this.interpolate(t,y,v,r,o,b))}else null==this.data&&t&&(k=t.fi*x);const $=c.createElement("canvas");$.width=y,$.height=v;const M=$.getContext("2d"),L=M.createImageData(y,v),A=L.data;let{r:R,g:z,b:O}=e.rgb(this.fill)??{r:0,g:0,b:0},E=255*(this.fillOpacity??1);for(let t=0;t<x;++t){const n=t<<2;if(w){const r=a(w[t+k]);if(null==r){A[n+3]=0;continue}({r:R,g:z,b:O}=e.rgb(r))}b&&(E=255*b[t+k]),A[n+0]=R,A[n+1]=z,A[n+2]=O,A[n+3]=E}return this.blur>0&&e.blurImage(L,this.blur),M.putImageData(L,0,0),_e("svg:g",i).call(mr,this,o,i).call(xr,this,n).call((t=>t.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(vr,"image-rendering",this.imageRendering).call(gr,this).attr("xlink:href",$.toDataURL()))).node()}}function ns(t,e,n){arguments.length<3&&(n=e,e=null);let{x:r,y:o,[t]:i,...a}=n;return void 0===r&&void 0===o&&function(t){if(!ut(t))return!1;for(const e of t)if(null!=e)return"object"==typeof e&&"0"in e&&"1"in e}(e)&&(r=O,o=E,void 0===i&&(i=S)),[e,{...a,x:r,y:o,[t]:i}]}function rs({x1:t,y1:e,x2:n,y2:r},o,{projection:i}){const{width:a,height:l,marginTop:s,marginRight:c,marginBottom:u,marginLeft:f}=o;return[t&&null==i?t[0]:f,e&&null==i?e[0]:s,n&&null==i?n[0]:a-c,r&&null==i?r[0]:l-u]}function os({x1:t,y1:e,x2:n,y2:r},o,i,a){const l={};return t&&(l.x1=t),e&&(l.y1=e),n&&(l.x2=n),r&&(l.y2=r),rs(ke(l,o),i,a)}function is(t,e={}){const{[t]:n}=e;if("function"!=typeof n)throw new Error(`invalid ${t}: not a function`);return Dt({...e,[t]:void 0},(function(r,o,i,a,l,s){const{x:c,y:u}=a;if(!c)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");const[f,h,d,p]=os(i,a,l,s),m=d-f,g=p-h,{pixelSize:y}=this,{width:v=Math.round(Math.abs(m)/y),height:x=Math.round(Math.abs(g)/y)}=e,w=new Array(v*x*(o?o.length:1)),b=m/v,k=g/x;let $=0;for(const t of o??[void 0])for(let e=.5;e<x;++e)for(let r=.5;r<v;++r,++$)w[$]=n(c.invert(f+r*b),u.invert(h+e*k),t);return{data:w,facets:o,channels:{[t]:{value:w,scale:"auto"}}}}))}function as(t,e,n,r,o,i){const a=new Array(e*n);for(const l of t)r[l]<0||r[l]>=e||o[l]<0||o[l]>=n||(a[Math.floor(o[l])*e+Math.floor(r[l])]=i[l]);return a}function ls({random:t=e.randomLcg(42)}={}){return(n,r,o,i,a,l)=>{const s=n.length,c=r>>2,u=(o>>2)-1,f=s+2*c+2*u,h=new Float64Array(2*f);for(let t=0;t<s;++t)h[2*t]=i[n[t]],h[2*t+1]=a[n[t]];let d=s;const p=(t,e)=>(h[2*d]=t,h[2*d+1]=e,d++);for(let t=0;t<=c;++t)p(t/c*r,0),p(t/c*r,o);for(let t=0;t<u;++t)p(r,t/u*o),p(0,t/u*o);l=K(l,n);const m=new e.Delaunay(h.subarray(0,2*s));for(let t,e=s;e<f;++e)l[e]=l[t=m.find(h[2*e],h[2*e+1],t)];const{points:g,triangles:y}=new e.Delaunay(h),v=new l.constructor(r*o),x=function(t,e){return gt(t)||dt(t)?us:function(t){return(e,n,r,o,i,a,l,s)=>{const c=t(l,s);return c<n?e:c<n+o?r:i}}(e)}(l,t);for(let t=0;t<y.length;t+=3){const e=y[t],n=y[t+1],i=y[t+2],a=g[2*e],s=g[2*n],c=g[2*i],u=g[2*e+1],f=g[2*n+1],h=g[2*i+1],d=Math.min(a,s,c),p=Math.max(a,s,c),m=Math.min(u,f,h),w=Math.max(u,f,h),b=(f-h)*(a-c)+(u-h)*(c-s);if(!b)continue;const k=l[e],$=l[n],M=l[i];for(let t=Math.floor(d);t<p;++t)for(let e=Math.floor(m);e<w;++e){if(t<0||t>=r||e<0||e>=o)continue;const n=t+.5,i=e+.5,l=((f-h)*(n-c)+(i-h)*(c-s))/b;if(l<0)continue;const d=((h-u)*(n-c)+(i-h)*(a-c))/b;if(d<0)continue;const p=1-l-d;p<0||(v[t+r*e]=x(k,l,$,d,M,p,t,e))}}return v}}function ss(t,n,r,o,i,a){const l=new a.constructor(n*r),s=e.Delaunay.from(t,(t=>o[t]),(t=>i[t]));let c,u;for(let e=.5,o=0;e<r;++e){u=c;for(let r=.5;r<n;++r,++o)u=s.find(r,e,u),.5===r&&(c=u),l[o]=a[t[u]]}return l}function cs({random:t=e.randomLcg(42),minDistance:n=.5,maxSteps:r=2}={}){return(o,i,a,l,s,c)=>{const u=new c.constructor(i*a),f=e.Delaunay.from(o,(t=>l[t]),(t=>s[t]));let h,d,p;for(let e=.5,m=0;e<a;++e){d=h;for(let a=.5;a<i;++a,++m){let i,g=a,y=e;p=d=f.find(g,y,d),.5===a&&(h=d);let v=0;for(;(i=Math.hypot(l[o[p]]-g,s[o[p]]-y))>n&&v<r;){const n=2*t(a,e,v)*Math.PI;g+=Math.cos(n)*i,y+=Math.sin(n)*i,p=f.find(g,y,p),++v}u[m]=c[o[p]]}}return u}}function us(t,e,n,r,o,i){return e*t+r*n+i*o}const fs={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2};class hs extends ts{constructor(t,{smooth:n=!0,value:r,...o}={}){const i=sr({},o,fs);if(void 0===r)for(const t in i)if(null!=i[t].value){if(void 0!==r)throw new Error("ambiguous contour value");r=o[t],o[t]="value"}if(null!=r){const t={transform:t=>t.map((t=>t.value)),label:ot(r)};for(const e in i)"value"===o[e]&&(o[e]=t)}if(null==t){if(null==r)throw new Error("missing contour value");o=is("value",{value:r,...o}),r=null}else{let{interpolate:t}=o;void 0===r&&(r=M),void 0===t&&(o.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},function({thresholds:t,interval:n,...r}){return t=Qi(t,n,e.thresholdSturges),Dt(r,(function(n,r,o,i,a,l){const[s,c,u,f]=os(o,i,a,l),h=u-s,d=f-c,{pixelSize:p,width:m=Math.round(Math.abs(h)/p),height:g=Math.round(Math.abs(d)/p)}=this,y=m/h,v=g/d,x=o.value.value,w=[];if(this.interpolate){const{x:t,y:e}=Fe(o,i,l),n=Y(t,(t=>(t-s)*y),Float64Array),a=Y(e,(t=>(t-c)*v),Float64Array),u=[o.x,o.y,o.value],f=[n,a,x];for(const t of r){const e=this.filter(t,u,f);w.push(this.interpolate(e,m,g,n,a,x))}}else if(r){const t=m*g,e=r.length;for(let n=0;n<e;++n)w.push(x.slice(n*t,n*t+t))}else w.push(x);if(this.blur>0)for(const t of w)e.blur2({data:t,width:m,height:g},this.blur);const b=function(t,n,r,o){if("function"==typeof t?.range)return t.range(t.floor(r),o);"function"==typeof t&&(t=t(n,r,o));if("number"!=typeof t)return F(t);const i=e.ticks(...e.nice(r,o,t),t);for(;i[i.length-1]>=o;)i.pop();for(;i[1]<r;)i.shift();return i}(t,x,...function(t){return[e.min(t,(t=>e.min(t,ds))),e.max(t,(t=>e.max(t,ds)))]}(w));if(null===b)throw new Error(`unsupported thresholds: ${t}`);const{contour:k}=e.contours().size([m,g]).smooth(this.smooth),$=[],M=[];for(const t of w)M.push(e.range($.length,$.push(...Y(b,(e=>k(t,e))))));for(const{coordinates:t}of $)for(const e of t)for(const t of e)for(const e of t)e[0]=e[0]/y+s,e[1]=e[1]/v+c;return{data:$,facets:M,channels:be(this.contourChannels,$)}}))}(o),fs);const a={geometry:{value:M}};for(const t in this.channels){const e=this.channels[t],{scale:n}=e;"x"!==n&&"y"!==n&&"value"!==t&&(a[t]=e,delete this.channels[t])}this.contourChannels=a,this.smooth=!!n}filter(t,{x:e,y:n,value:r,...o},i){return super.filter(t,o,i)}render(t,n,r,o,i){const{geometry:a}=r,l=e.geoPath();return _e("svg:g",i).call(mr,this,o,i).call(xr,this,n).call((e=>{e.selectAll().data(t).enter().append("path").call(gr,this).attr("d",(t=>l(a[t]))).call(fr,this,r)})).node()}}function ds(t){return isFinite(t)?t:NaN}const ps={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ms={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},gs={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},ys={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vs={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class xs extends _r{constructor(t,e={}){const{x:n,y:r,z:o,curve:i,tension:a}=e;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:o,optional:!0}},e,ps),this.curve=ji(i,a),Da(this,e)}render(t,n,r,o,i){const{x:a,y:l}=n,{x:s,y:c,z:u}=r,{curve:f}=this,[h,d]=Lr(this,o),p=s?t=>s[t]:C(h),m=c?t=>c[t]:C(d),g=this;function y(t){let n=-1;const o=[],a={};for(const t in r)a[t]=[];const l=[],s=[],c=[],u=[];function h(e,i){e=t[e],i=t[i],o.push(++n),l[n]=p(e),c[n]=m(e),s[n]=p(i),u[n]=m(i);for(const t in r)a[t].push(r[t][i])}const{halfedges:d,hull:y,triangles:v}=e.Delaunay.from(t,p,m);for(let t=0;t<d.length;++t){const e=d[t];e>t&&h(v[t],v[e])}for(let t=0;t<y.length;++t)h(y[t],y[(t+1)%y.length]);e.select(this).selectAll().data(o).enter().append("path").call(gr,g).attr("d",(t=>{const n=e.pathRound(),r=f(n);return r.lineStart(),r.point(l[t],c[t]),r.point(s[t],u[t]),r.lineEnd(),n})).call(fr,g,a).call(Ua,g,a,i)}return _e("svg:g",i).call(mr,this,o,i).call(xr,this,{x:s&&a,y:c&&l}).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 ws extends _r{constructor(t,e={},n,r=(({z:t})=>t)){const{x:o,y:i}=e;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:r(e),optional:!0}},e,n)}render(t,n,r,o,i){const{x:a,y:l}=n,{x:s,y:c,z:u}=r,[f,h]=Lr(this,o),d=s?t=>s[t]:C(f),p=c?t=>c[t]:C(h),m=this;function g(t){const n=e.Delaunay.from(t,d,p);e.select(this).append("path").datum(t[0]).call(gr,m).attr("d",m._render(n,o)).call(fr,m,r)}return _e("svg:g",i).call(mr,this,o,i).call(xr,this,{x:s&&a,y:c&&l}).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 bs extends ws{constructor(t,e={}){super(t,e,ms),this.fill="none"}_render(t){return t.render()}}class ks extends ws{constructor(t,e={}){super(t,e,gs,Q)}_render(t){return t.renderHull()}}class $s extends _r{constructor(t,e={}){const{x:n,y:r,z:o}=e;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:o,optional:!0}},e,ys)}render(t,n,r,o,i){const{x:a,y:l}=n,{x:s,y:c,z:u}=r,[f,h]=Lr(this,o),d=s?t=>s[t]:C(f),p=c?t=>c[t]:C(h),m=this;function g(t){const n=Ls(e.Delaunay.from(t,d,p),o);e.select(this).selectAll().data(t).enter().append("path").call(gr,m).attr("d",((t,e)=>n.renderCell(e))).call(fr,m,r)}return _e("svg:g",i).call(mr,this,o,i).call(xr,this,{x:s&&a,y:c&&l}).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 Ms extends ws{constructor(t,e){super(t,e,vs),this.fill="none"}_render(t,e){return Ls(t,e).render()}}function Ls(t,e){const{width:n,height:r,marginTop:o,marginRight:i,marginBottom:a,marginLeft:l}=e;return t.voronoi([l,o,n-i,r-a])}function As(t,e,{x:n,y:r,...o}={}){return[n,r]=Z(n,r),new t(e,{...o,x:n,y:r})}const Rs={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class zs extends _r{constructor(t,{x:n,y:r,z:o,weight:i,fill:a,stroke:l,...s}={}){const c=Es(a)&&(a="currentColor",!0),u=Es(l)&&(l="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Q({z:o,fill:a,stroke:l}),optional:!0},weight:{value:i,optional:!0}},function(t,n,r){const o=100;let{bandwidth:i,thresholds:a}=t;return i=void 0===i?20:+i,a=void 0===a?20:"function"==typeof a?.[Symbol.iterator]?T(a):+a,Dt(t,(function(t,l,s,c,u,f){const h=s.weight?T(s.weight.value):null,d=s.z?.value,{z:p}=this,[m,g]=Lr(this,u),{width:v,height:x}=u,{x:w,y:b}=Fe(s,c,f),k=Object.fromEntries(Object.entries(s).filter((([t])=>!Os.has(t))).map((([t,e])=>[t,{...e,value:[]}]))),$=n&&[],M=r&&[],L=e.contourDensity().x(w?t=>w[t]:m).y(b?t=>b[t]:g).weight(h?t=>h[t]:1).size([v,x]).bandwidth(i),A=[];for(const t of l){const e=[];A.push(e);for(const n of d?dr(t,d,p):[t]){const t=L.contours(n);e.push([n,t])}}let R=a;if(!(R instanceof y)){let t=0;for(const e of A)for(const[,n]of e){const e=n.max;e>t&&(t=e)}R=Float64Array.from({length:a-1},((e,n)=>t*o*(n+1)/a))}const z=[],O=[];for(const t of A){const e=[];z.push(e);for(const[n,r]of t)for(const t of R){e.push(O.length),O.push(r(t/o)),$&&$.push(t),M&&M.push(t);for(const t in k)k[t].value.push(s[t].value[n[0]])}}return $&&$.push(0),M&&M.push(0),{data:t,facets:z,channels:{...k,...$&&{fill:{value:$,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:O}}}}))}({...s,fill:a,stroke:l},c,u),Rs),c&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=o}filter(t){return t}render(t,n,r,o,i){const{contours:a}=r,l=e.geoPath();return _e("svg:g",i).call(mr,this,o,i).call(xr,this,{}).call((e=>e.selectAll().data(t).enter().append("path").call(gr,this).call(fr,this,r).attr("d",(t=>l(a[t]))))).node()}}const Os=new Set(["x","y","z","weight"]);function Es(t){return/^density$/i.test(t)}const Ss={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Cs extends _r{constructor(t,e={}){const[n,r]=W(e.r,3);super(t,{geometry:{value:e.geometry},r:{value:n,scale:"r",filter:l,optional:!0}},dl(e),Ss),this.r=r}render(t,n,r,o,i){const{geometry:a,r:l}=r,c=e.geoPath(i.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:u}=this;return s(u)?t=[]:void 0!==u&&c.pointRadius(u),_e("svg:g",i).call(mr,this,o,i).call(xr,this,n).call((e=>{e.selectAll().data(t).enter().append("path").call(gr,this).attr("d",l?t=>c.pointRadius(l[t])(a[t]):t=>c(a[t])).call(fr,this,r)})).node()}}function Bs(t,{geometry:e=M,...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 Cs(t,{geometry:e,...n})}const Ts=.5,Ns=0;function Is(t,e,n,r){const o=r*(1.5/Ct),i=new Map;for(const a of t){let t=e[a],l=n[a];if(isNaN(t)||isNaN(l))continue;let s=Math.round(l=(l-Ns)/o),c=Math.round(t=(t-Ts)/r-(1&s)/2),u=l-s;if(3*Math.abs(u)>1){let e=t-c,n=c+(t<c?-1:1)/2,r=s+(l<s?-1:1),o=t-n,i=l-r;e*e+u*u>o*o+i*i&&(c=n+(1&s?1:-1)/2,s=r)}const f=`${c},${s}`;let h=i.get(f);void 0===h&&(i.set(f,h=[]),h.x=(c+(1&s)/2)*r+Ts,h.y=s*o+Ns),h.push(a)}return i.values()}const Ps={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};class js extends _r{constructor({binWidth:t=20,clip:e=!0,...n}={}){super(void 0,void 0,{clip:e,...n},Ps),this.binWidth=z(t)}render(t,e,n,r,o){const{binWidth:i}=this,{marginTop:a,marginRight:l,marginBottom:s,marginLeft:c,width:u,height:f}=r,h=c-Ts,d=u-l-Ts,p=a-Ns,m=f-s-Ns,g=i/2,y=g*Bt,v=y/2,x=2*g,w=1.5*y,b=Math.floor(h/x),k=Math.ceil(d/x),$=Math.floor((p+v)/w),M=Math.ceil((m-v)/w)+1,L=`m0,${Ws(-y)}l${Ws(g)},${Ws(v)}v${Ws(y)}l${Ws(-g)},${Ws(v)}`;let A=L;for(let t=$;t<M;++t)for(let e=b;e<k;++e)A+=`M${Ws(e*x+(1&t)*g)},${Ws(t*w)}${L}`;return _e("svg:g",o).call(mr,this,r,o).call(xr,this,{},ir+Ts,ir+Ns).call((t=>t.append("path").call(gr,this).attr("d",A))).node()}}function Ws(t){return Math.round(1e3*t)/1e3}const Ds={ariaLabel:"image",fill:null,stroke:null};class qs extends _r{constructor(t,e={}){let{x:n,y:r,r:o,width:i,height:a,rotate:s,src:c,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=e;null==o&&(o=void 0),void 0===o&&void 0===i&&void 0===a?i=a=16:void 0===i&&void 0!==a?i=a:void 0===a&&void 0!==i&&(a=i);const[p,m]="string"==typeof(g=c)&&(function(t){return/^\.*\//.test(t)}(g)||function(t){return/^(blob|data|file|http|https):/i.test(t)}(g))?[void 0,g]:[g,void 0];var g;const[y,v]=W(o),[x,w]=W(i,void 0!==v?2*v:void 0),[b,k]=W(a,void 0!==v?2*v:void 0),[$,M]=W(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},r:{value:y,scale:"r",filter:l,optional:!0},width:{value:x,filter:l,optional:!0},height:{value:b,filter:l,optional:!0},rotate:{value:$,optional:!0},src:{value:p,optional:!0}},dl(e),Ds),this.src=m,this.width=w,this.rotate=M,this.height=k,this.r=v,this.preserveAspectRatio=wr(u,"xMidYMid"),this.crossOrigin=R(f),this.frameAnchor=kt(h),this.imageRendering=wr(d,"auto")}render(t,e,n,r,o){const{x:i,y:a}=e,{x:l,y:s,width:c,height:u,r:f,rotate:h,src:d}=n,{r:p,width:m,height:g,rotate:y}=this,[v,x]=Lr(this,r);return _e("svg:g",o).call(mr,this,r,o).call(xr,this,{x:l&&i,y:s&&a}).call((e=>e.selectAll().data(t).enter().append("image").call(gr,this).attr("x",Fs(l,c,f,v,m,p)).attr("y",Fs(s,u,f,x,g,p)).attr("width",c?t=>c[t]:void 0!==m?m:f?t=>2*f[t]:2*p).attr("height",u?t=>u[t]:void 0!==g?g:f?t=>2*f[t]:2*p).attr("transform",h?t=>`rotate(${h[t]})`:y?`rotate(${y})`:null).attr("transform-origin",h||y?fo`${l?t=>l[t]:v}px ${s?t=>s[t]:x}px`:null).call(vr,"href",d?t=>d[t]:this.src).call(vr,"preserveAspectRatio",this.preserveAspectRatio).call(vr,"crossorigin",this.crossOrigin).call(vr,"image-rendering",this.imageRendering).call(vr,"clip-path",f?t=>`circle(${f[t]}px)`:void 0!==p?`circle(${p}px)`:null).call(fr,this,n))).node()}}function Fs(t,e,n,r,o,i){return e&&t?n=>t[n]-e[n]/2:e?t=>r-e[t]/2:t&&void 0!==o?e=>t[e]-o/2:void 0!==o?r-o/2:n&&t?e=>t[e]-n[e]:n?t=>r-n[t]:t?e=>t[e]-i:r-i}function Ys(t,e,n){var r=0===t||1===t?0:Math.exp(Gs(e+n)-Gs(e)-Gs(n)+e*Math.log(t)+n*Math.log(1-t));return!(t<0||t>1)&&(t<(e+1)/(e+n+2)?r*_s(t,e,n)/e:1-r*_s(1-t,n,e)/n)}function _s(t,e,n){var r,o,i,a,l=1e-30,s=1,c=e+n,u=e+1,f=e-1,h=1,d=1-c*t/u;for(Math.abs(d)<l&&(d=l),a=d=1/d;s<=100&&(d=1+(o=s*(n-s)*t/((f+(r=2*s))*(e+r)))*d,Math.abs(d)<l&&(d=l),h=1+o/h,Math.abs(h)<l&&(h=l),a*=(d=1/d)*h,d=1+(o=-(e+s)*(c+s)*t/((e+r)*(u+r)))*d,Math.abs(d)<l&&(d=l),h=1+o/h,Math.abs(h)<l&&(h=l),a*=i=(d=1/d)*h,!(Math.abs(i-1)<3e-7));s++);return a}function Gs(t){var e,n,r,o=0,i=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(r=(n=e=t)+5.5,r-=(e+.5)*Math.log(r);o<6;o++)a+=i[o]/++n;return Math.log(2.506628274631*a/e)-r}function Xs(t,e){var n=function(t,e,n){var r,o,i,a,l,s,c,u,f,h,d=e-1,p=n-1,m=0;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&n>=1?(i=t<.5?t:1-t,s=(2.30753+.27061*(a=Math.sqrt(-2*Math.log(i))))/(1+a*(.99229+.04481*a))-a,t<.5&&(s=-s),c=(s*s-3)/6,u=2/(1/(2*e-1)+1/(2*n-1)),f=s*Math.sqrt(c+u)/u-(1/(2*n-1)-1/(2*e-1))*(c+5/6-2/(3*u)),s=e/(e+n*Math.exp(2*f))):(r=Math.log(e/(e+n)),o=Math.log(n/(e+n)),s=t<(a=Math.exp(e*r)/e)/(f=a+(l=Math.exp(n*o)/n))?Math.pow(e*f*t,1/e):1-Math.pow(n*f*(1-t),1/n)),h=-Gs(e)-Gs(n)+Gs(e+n);m<10;m++){if(0===s||1===s)return s;if((s-=a=(l=(Ys(s,e,n)-t)/(a=Math.exp(d*Math.log(s)+p*Math.log(1-s)+h)))/(1-.5*Math.min(1,l*(d/s-p/(1-s)))))<=0&&(s=.5*(s+a)),s>=1&&(s=.5*(s+a+1)),Math.abs(a)<1e-8*s&&m>0)break}return s}(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}const Us={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Hs extends _r{constructor(t,e={}){const{x:n,y:r,z:o,ci:i=.95,precision:a=4}=e;if(super(t,{x:{value:n,scale:"x"},y:{value:r,scale:"y"},z:{value:Q(e),optional:!0}},e,Us),this.z=o,this.ci=+i,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${i}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,e,n,r,o){const{x:i,y:a,z:l}=n,{ci:s}=this;return _e("svg:g",o).call(mr,this,r,o).call(xr,this,e).call((e=>e.selectAll().data(l?dr(t,l,this.z):[t]).enter().call((t=>t.append("path").attr("fill","none").call(gr,this).call(hr,this,{...n,fill:null,fillOpacity:null}).attr("d",(t=>this._renderLine(t,i,a))).call(s&&!bt(this.fill)?t=>t.select(Vs).attr("stroke","none").call(gr,this).call(hr,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",(t=>this._renderBand(t,i,a))):()=>{}))))).node()}}function Vs(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(e.namespaces.svg,"path"),this)}class Zs extends Hs{constructor(t,e){super(t,e)}_renderBand(t,n,r){const{ci:o,precision:i}=this,[a,l]=e.extent(t,(t=>r[t])),s=Js(t,r,n),c=Ks(t,r,n,(1-o)/2,s);return e.area().y((t=>t)).x0((t=>c(t,-1))).x1((t=>c(t,1)))(e.range(a,l-i/2,i).concat(l))}_renderLine(t,n,r){const[o,i]=e.extent(t,(t=>r[t])),a=Js(t,r,n);return`M${a(o)},${o}L${a(i)},${i}`}}class Qs extends Hs{constructor(t,e){super(t,e)}_renderBand(t,n,r){const{ci:o,precision:i}=this,[a,l]=e.extent(t,(t=>n[t])),s=Js(t,n,r),c=Ks(t,n,r,(1-o)/2,s);return e.area().x((t=>t)).y0((t=>c(t,-1))).y1((t=>c(t,1)))(e.range(a,l-i/2,i).concat(l))}_renderLine(t,n,r){const[o,i]=e.extent(t,(t=>n[t])),a=Js(t,n,r);return`M${o},${a(o)}L${i},${a(i)}`}}function Js(t,e,n){let r=0,o=0,i=0,a=0;for(const l of t){const t=e[l],s=n[l];r+=t,o+=s,i+=t*s,a+=t*t}const l=t.length,s=(l*i-r*o)/(l*a-r*r),c=(o-s*r)/l;return t=>s*t+c}function Ks(t,n,r,o,i){const a=e.sum(t,(t=>n[t]))/t.length;let l=0,s=0;for(const e of t)l+=(n[e]-a)**2,s+=(r[e]-i(n[e]))**2;const c=Math.sqrt(s/(t.length-2)),u=Xs(o,t.length-2);return(e,n)=>{const r=i(e),o=c*Math.sqrt(1/t.length+(e-a)**2/l);return r+n*u*o}}function tc(t={}){let{path:n=M,delimiter:r,frameAnchor:o,treeLayout:i=e.tree,treeSort:a,treeSeparation:l,treeAnchor:s,...c}=t;s=nc(s),a=ic(a),void 0===o&&(o=s.frameAnchor);const u=lc(r),f=bc(c,cc),[h,d]=nt(),[p,m]=nt();return{x:h,y:p,frameAnchor:o,...Wt(c,((t,r)=>{const o=u(x(t,n)),c=d([]),h=m([]);let p=-1;const g=[],y=[],v=e.stratify().path((t=>o[t])),w=i();w.nodeSize&&w.nodeSize([1,1]),w.separation&&void 0!==l&&w.separation(l??L);for(const t of f)t[wc]=t[vc]([]);for(const e of r){const n=[],r=v(e.filter((t=>null!=o[t]))).each((e=>e.data=t[e.data]));null!=a&&r.sort(a),w(r);for(const t of r.descendants()){n.push(++p),g[p]=t.data,s.position(t,p,c,h);for(const e of f)e[wc][p]=e[xc](t)}y.push(n)}return{data:g,facets:y}})),...Object.fromEntries(f)}}function ec(t={}){let{path:n=M,delimiter:r,curve:o="bump-x",stroke:i="#555",strokeWidth:a=1.5,strokeOpacity:l=.5,treeLayout:s=e.tree,treeSort:c,treeSeparation:u,treeAnchor:f,...h}=t;f=nc(f),c=ic(c),h={curve:o,stroke:i,strokeWidth:a,strokeOpacity:l,...h};const d=lc(r),p=bc(h,uc),[m,g]=nt(),[y,v]=nt(),[w,b]=nt(),[k,$]=nt();return{x1:m,x2:y,y1:w,y2:k,...Wt(h,((t,r)=>{const o=d(x(t,n)),i=g([]),a=v([]),l=b([]),h=$([]);let m=-1;const y=[],w=[],k=e.stratify().path((t=>o[t])),M=s();M.nodeSize&&M.nodeSize([1,1]),M.separation&&void 0!==u&&M.separation(u??L);for(const t of p)t[wc]=t[vc]([]);for(const e of r){const n=[],r=k(e.filter((t=>null!=o[t]))).each((e=>e.data=t[e.data]));null!=c&&r.sort(c),M(r);for(const{source:t,target:e}of r.links()){n.push(++m),y[m]=e.data,f.position(t,m,i,l),f.position(e,m,a,h);for(const n of p)n[wc][m]=n[xc](e,t)}w.push(n)}return{data:y,facets:w}})),...Object.fromEntries(p)}}function nc(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return rc;case"right":return oc}throw new Error(`invalid tree anchor: ${t}`)}const rc={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},oc={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function ic(t){return null==t||"function"==typeof t?t:`${t}`.trim().toLowerCase().startsWith("node:")?ac(cc(t)):ac(function(t){return e=>e.data?.[t]}(t))}function ac(t){return(e,n)=>r(t(e),t(n))}function lc(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 sc(t){return G(t)&&"function"==typeof t.node}function cc(t){if(sc(t))return t.node;if((t=`${t}`.trim().toLowerCase()).startsWith("node:")){switch(t){case"node:name":return hc;case"node:path":return fc;case"node:internal":return mc;case"node:depth":return dc;case"node:height":return pc}throw new Error(`invalid node value: ${t}`)}}function uc(t){if(sc(t))return t.node;if(G(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 gc(hc);case"parent:path":return gc(fc);case"parent:depth":return gc(dc);case"parent:height":return gc(pc);case"node:name":return hc;case"node:path":return fc;case"node:internal":return mc;case"node:depth":return dc;case"node:height":return pc}throw new Error(`invalid link value: ${t}`)}}function fc(t){return t.id}function hc(t){return function(t){let e=t.length;for(;--e>0&&!yc(t,e););return t.slice(e+1)}(t.id)}function dc(t){return t.depth}function pc(t){return t.height}function mc(t){return!!t.children}function gc(t){return(e,n)=>null==n?void 0:t(n)}function yc(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}const vc=2,xc=3,wc=4;function bc(t,e){const n=[];for(const r in t){const o=t[r],i=e(o);void 0!==i&&n.push([r,...nt(o),i])}return n}function kc(t,e={}){let{fill:n,stroke:r,strokeWidth:o,strokeOpacity:i,strokeLinejoin:a,strokeLinecap:l,strokeMiterlimit:s,strokeDasharray:c,strokeDashoffset:u,marker:f,markerStart:h=f,markerEnd:d=f,dot:p=wt(h)&&wt(d),text:m="node:name",textStroke:g="white",title:y="node:path",dx:v,dy:x,...w}=e;return void 0===v&&(v=nc(w.treeAnchor).dx),Gr(Ja(t,ec({markerStart:h,markerEnd:d,stroke:void 0!==r?r:void 0===n?"node:internal":n,strokeWidth:o,strokeOpacity:i,strokeLinejoin:a,strokeLinecap:l,strokeMiterlimit:s,strokeDasharray:c,strokeDashoffset:u,...w})),p?ml(t,tc({fill:void 0===n?"node:internal":n,title:y,...w})):null,null!=m?yo(t,tc({text:m,fill:void 0===n?"currentColor":n,stroke:g,dx:v,dy:x,title:y,...w})):null)}function $c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mc(t,e,n,r,o){for(var i=o+1;r<=o;){var a=r+o>>>1,l=t[a];(void 0!==n?n(l,e):l-e)>=0?(i=a,o=a-1):r=a+1}return i}function Lc(t,e,n,r,o){for(var i=o+1;r<=o;){var a=r+o>>>1,l=t[a];(void 0!==n?n(l,e):l-e)>0?(i=a,o=a-1):r=a+1}return i}function Ac(t,e,n,r,o){for(var i=r-1;r<=o;){var a=r+o>>>1,l=t[a];(void 0!==n?n(l,e):l-e)<0?(i=a,r=a+1):o=a-1}return i}function Rc(t,e,n,r,o){for(var i=r-1;r<=o;){var a=r+o>>>1,l=t[a];(void 0!==n?n(l,e):l-e)<=0?(i=a,r=a+1):o=a-1}return i}function zc(t,e,n,r,o){for(;r<=o;){var i=r+o>>>1,a=t[i],l=void 0!==n?n(a,e):a-e;if(0===l)return i;l<=0?r=i+1:o=i-1}return-1}function Oc(t,e,n,r,o,i){return"function"==typeof n?i(t,e,n,void 0===r?0:0|r,void 0===o?t.length-1:0|o):i(t,e,void 0,void 0===n?0:0|n,void 0===r?t.length-1:0|r)}var Ec={ge:function(t,e,n,r,o){return Oc(t,e,n,r,o,Mc)},gt:function(t,e,n,r,o){return Oc(t,e,n,r,o,Lc)},lt:function(t,e,n,r,o){return Oc(t,e,n,r,o,Ac)},le:function(t,e,n,r,o){return Oc(t,e,n,r,o,Rc)},eq:function(t,e,n,r,o){return Oc(t,e,n,r,o,zc)}},Sc=0,Cc=1,Bc=function(t){if(!t||0===t.length)return new Uc(null);return new Uc(Xc(t))};function Tc(t,e,n,r,o){this.mid=t,this.left=e,this.right=n,this.leftPoints=r,this.rightPoints=o,this.count=(e?e.count:0)+(n?n.count:0)+r.length}var Nc=Tc.prototype;function Ic(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 Pc(t,e){var n=Xc(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 jc(t,e){var n=t.intervals([]);n.push(e),Pc(t,n)}function Wc(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?Sc:(n.splice(r,1),Pc(t,n),Cc)}function Dc(t,e,n){for(var r=0;r<t.length&&t[r][0]<=e;++r){var o=n(t[r]);if(o)return o}}function qc(t,e,n){for(var r=t.length-1;r>=0&&t[r][1]>=e;--r){var o=n(t[r]);if(o)return o}}function Fc(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}function Yc(t,e){return t-e}function _c(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function Gc(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function Xc(t){if(0===t.length)return null;for(var e=[],n=0;n<t.length;++n)e.push(t[n][0],t[n][1]);e.sort(Yc);var r=e[e.length>>1],o=[],i=[],a=[];for(n=0;n<t.length;++n){var l=t[n];l[1]<r?o.push(l):r<l[0]?i.push(l):a.push(l)}var s=a,c=a.slice();return s.sort(_c),c.sort(Gc),new Tc(r,Xc(o),Xc(i),s,c)}function Uc(t){this.root=t}Nc.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},Nc.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?jc(this,t):this.left.insert(t):this.left=Xc([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?jc(this,t):this.right.insert(t):this.right=Xc([t]);else{var n=Ec.ge(this.leftPoints,t,_c),r=Ec.ge(this.rightPoints,t,Gc);this.leftPoints.splice(n,0,t),this.rightPoints.splice(r,0,t)}},Nc.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid)return this.left?4*(this.right?this.right.count:0)>3*(e-1)?Wc(this,t):2===(i=this.left.remove(t))?(this.left=null,this.count-=1,Cc):(i===Cc&&(this.count-=1),i):Sc;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?Wc(this,t):2===(i=this.right.remove(t))?(this.right=null,this.count-=1,Cc):(i===Cc&&(this.count-=1),i):Sc;if(1===this.count)return this.leftPoints[0]===t?2:Sc;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 o=this.left,i=this.right;n.count-=r.count,n.right=r.left,r.left=o,r.right=i}Ic(this,r),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?Ic(this,this.left):Ic(this,this.right);return Cc}for(o=Ec.ge(this.leftPoints,t,_c);o<this.leftPoints.length&&this.leftPoints[o][0]===t[0];++o)if(this.leftPoints[o]===t){this.count-=1,this.leftPoints.splice(o,1);for(i=Ec.ge(this.rightPoints,t,Gc);i<this.rightPoints.length&&this.rightPoints[i][1]===t[1];++i)if(this.rightPoints[i]===t)return this.rightPoints.splice(i,1),Cc}return Sc},Nc.queryPoint=function(t,e){if(t<this.mid){if(this.left)if(n=this.left.queryPoint(t,e))return n;return Dc(this.leftPoints,t,e)}if(t>this.mid){var n;if(this.right)if(n=this.right.queryPoint(t,e))return n;return qc(this.rightPoints,t,e)}return Fc(this.leftPoints,e)},Nc.queryInterval=function(t,e,n){var r;if(t<this.mid&&this.left&&(r=this.left.queryInterval(t,e,n)))return r;if(e>this.mid&&this.right&&(r=this.right.queryInterval(t,e,n)))return r;return e<this.mid?Dc(this.leftPoints,e,n):t>this.mid?qc(this.rightPoints,t,n):Fc(this.leftPoints,n)};var Hc=Uc.prototype;Hc.insert=function(t){this.root?this.root.insert(t):this.root=new Tc(t[0],null,null,[t],[t])},Hc.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==Sc}return!1},Hc.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},Hc.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)},Object.defineProperty(Hc,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(Hc,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});var Vc=$c(Bc);const Zc=({marginLeft:t})=>[1,t],Qc=({width:t,marginRight:e})=>[-1,t-e],Jc=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],Kc=({marginTop:t})=>[1,t],tu=({height:t,marginBottom:e})=>[-1,t-e],eu=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function nu(t){return"string"==typeof t?{anchor:t}:t}function ru(t){const{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function ou(t,e,n,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"},...Mt(t)}},void 0===e&&void 0===n&&(i.sort={channel:"r",order:"descending"})}return Dt(i,(function(i,s,c,u,f,h){let{[e]:d,r:p}=c;if(!c[e])throw new Error(`missing channel: ${e}`);({[e]:d}=Fe(c,u,h));const m=p?void 0:void 0!==o?z(o):void 0!==this.r?this.r:3;p&&(p=x(p.value,u[p.scale]||M,Float64Array));let[g,y]=n(f);const v=g?au:iu,w=new Float64Array(d.length),b=p?t=>p[t]:()=>m;for(let t of s){const e=Vc();t=t.filter(p?t=>a(d[t])&&l(p[t]):t=>a(d[t]));const n=new Float64Array(2*t.length+2);for(const o of t){const t=b(o),i=g?t+r:0,a=d[o]-t,l=d[o]+t;let s=2;e.queryInterval(a-r,l+r,(([,,t])=>{const e=w[t]-i,a=d[o]-d[t],l=r+(p?p[o]+p[t]:2*m),c=Math.sqrt(l*l-a*a);n[s++]=e-c,n[s++]=e+c}));let c=n.slice(0,s);g&&(c=c.filter((t=>t>=0)));t:for(const t of c.sort(v)){for(let e=0;e<s;e+=2)if(n[e]+1e-6<t&&t<n[e+1]-1e-6)continue t;w[o]=t+i;break}e.insert([a,l,o])}}g||(g=1);for(const t of s)for(const e of t)w[e]=w[e]*g+y;return{data:i,facets:s,channels:{[e]:{value:d},[t]:{value:w},...p&&{r:{value:p}}}}}))}function iu(t,e){return Math.abs(t)-Math.abs(e)}function au(t,e){return t-e}function lu(t){if(void 0===t)return fu;if("function"==typeof t)return su(((e,n)=>t(K(n,e))));if(/^p\d{2}$/i.test(t))return cu(B(t));switch(`${t}`.toLowerCase()){case"deviation":return du;case"first":return fu;case"last":return hu;case"max":return pu;case"mean":return mu;case"median":return gu;case"min":return yu;case"sum":return vu;case"extent":return uu}throw new Error(`invalid basis: ${t}`)}function su(t){return{mapIndex(e,n,r){const o=+t(e,n);for(const t of e)r[t]=null===n[t]?NaN:n[t]/o}}}function cu(t){return su(((e,n)=>t(e,(t=>n[t]))))}const uu={mapIndex(t,n,r){const[o,i]=e.extent(t,(t=>n[t])),a=i-o;for(const e of t)r[e]=null===n[e]?NaN:(n[e]-o)/a}},fu=su(((t,e)=>{for(let r=0;r<t.length;++r){const o=e[t[r]];if(n(o))return o}})),hu=su(((t,e)=>{for(let r=t.length-1;r>=0;--r){const o=e[t[r]];if(n(o))return o}})),du={mapIndex(t,n,r){const o=e.mean(t,(t=>n[t])),i=e.deviation(t,(t=>n[t]));for(const e of t)r[e]=null===n[e]?NaN:i?(n[e]-o)/i:0}},pu=cu(e.max),mu=cu(e.mean),gu=cu(e.median),yu=cu(e.min),vu=cu(e.sum);function xu(t={}){"number"==typeof t&&(t={k:t});let{k:n,reduce:r,shift:o,anchor:i,strict:a}=t;if(void 0===i&&void 0!==o&&(i=function(t){switch(`${t}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${t}`)}(o),Se(`Warning: the shift option is deprecated; please use anchor "${i}" 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 bu(B(t));switch(t.toLowerCase()){case"deviation":return bu(e.deviation);case"max":return ku(e.max);case"mean":return Mu;case"median":return bu(e.median);case"min":return ku(e.min);case"mode":return ku(e.mode);case"sum":return $u;case"variance":return bu(e.variance);case"difference":return Ou;case"ratio":return Eu;case"first":return Su;case"last":return Cu}}if("function"!=typeof t)throw new Error(`invalid reduce: ${t}`);return ku(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}`)}(i,n),a)}function wu(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function bu(t){return(e,n,r)=>r?{mapIndex(r,o,i){const a=Float64Array.from(r,(t=>null===o[t]?NaN:o[t]));let l=0;for(let t=0;t<e-1;++t)isNaN(a[t])&&++l;for(let o=0,s=r.length-e+1;o<s;++o)isNaN(a[o+e-1])&&++l,i[r[o+n]]=0===l?t(a.subarray(o,o+e)):NaN,isNaN(a[o])&&--l}}:{mapIndex(r,o,i){const a=Float64Array.from(r,(t=>null===o[t]?NaN:o[t]));for(let o=-n;o<0;++o)i[r[o+n]]=t(a.subarray(0,o+e));for(let o=0,l=r.length-n;o<l;++o)i[r[o+n]]=t(a.subarray(o,o+e))}}}function ku(t){return(e,r,o)=>o?{mapIndex(o,i,a){let l=0;for(let t=0;t<e-1;++t)l+=n(i[o[t]]);for(let s=0,c=o.length-e+1;s<c;++s)l+=n(i[o[s+e-1]]),l===e&&(a[o[s+r]]=t(K(i,wu(o,s,s+e)))),l-=n(i[o[s]])}}:{mapIndex(n,o,i){for(let a=-r;a<0;++a)i[n[a+r]]=t(K(o,wu(n,0,a+e)));for(let a=0,l=n.length-r;a<l;++a)i[n[a+r]]=t(K(o,wu(n,a,a+e)))}}}function $u(t,e,n){return n?{mapIndex(n,r,o){let i=0,a=0;for(let e=0;e<t-1;++e){const t=r[n[e]];null===t||isNaN(t)?++i:a+=+t}for(let l=0,s=n.length-t+1;l<s;++l){const s=r[n[l]],c=r[n[l+t-1]];null===c||isNaN(c)?++i:a+=+c,o[n[l+e]]=0===i?a:NaN,null===s||isNaN(s)?--i:a-=+s}}}:{mapIndex(n,r,o){let i=0;const a=n.length;for(let o=0,l=Math.min(a,t-e-1);o<l;++o)i+=+r[n[o]]||0;for(let l=-e,s=a-e;l<s;++l)i+=+r[n[l+t-1]]||0,o[n[l+e]]=i,i-=+r[n[l]]||0}}}function Mu(t,e,n){if(n){const r=$u(t,e,n);return{mapIndex(n,o,i){r.mapIndex(n,o,i);for(let r=0,o=n.length-t+1;r<o;++r)i[n[r+e]]/=t}}}return{mapIndex(n,r,o){let i=0,a=0;const l=n.length;for(let o=0,s=Math.min(l,t-e-1);o<s;++o){let t=r[n[o]];null===t||isNaN(t=+t)||(i+=t,++a)}for(let s=-e,c=l-e;s<c;++s){let l=r[n[s+t-1]],c=r[n[s]];null===l||isNaN(l=+l)||(i+=l,++a),o[n[s+e]]=i/a,null===c||isNaN(c=+c)||(i-=c,--a)}}}}function Lu(t,e,r,o){for(let i=r+o;r<i;++r){const o=t[e[r]];if(n(o))return o}}function Au(t,e,r,o){for(let i=r+o-1;i>=r;--i){const r=t[e[i]];if(n(r))return r}}function Ru(t,e,n,r){for(let o=n+r;n<o;++n){let r=t[e[n]];if(null!==r&&!isNaN(r=+r))return r}}function zu(t,e,n,r){for(let o=n+r-1;o>=n;--o){let n=t[e[o]];if(null!==n&&!isNaN(n=+n))return n}}function Ou(t,e,n){return n?{mapIndex(n,r,o){for(let i=0,a=n.length-t;i<a;++i){const a=r[n[i]],l=r[n[i+t-1]];o[n[i+e]]=null===a||null===l?NaN:l-a}}}:{mapIndex(n,r,o){for(let i=-e,a=n.length-t+e+1;i<a;++i)o[n[i+e]]=zu(r,n,i,t)-Ru(r,n,i,t)}}}function Eu(t,e,n){return n?{mapIndex(n,r,o){for(let i=0,a=n.length-t;i<a;++i){const a=r[n[i]],l=r[n[i+t-1]];o[n[i+e]]=null===a||null===l?NaN:l/a}}}:{mapIndex(n,r,o){for(let i=-e,a=n.length-t+e+1;i<a;++i)o[n[i+e]]=zu(r,n,i,t)/Ru(r,n,i,t)}}}function Su(t,e,n){return n?{mapIndex(n,r,o){for(let i=0,a=n.length-t;i<a;++i)o[n[i+e]]=r[n[i]]}}:{mapIndex(n,r,o){for(let i=-e,a=n.length-t+e+1;i<a;++i)o[n[i+e]]=Lu(r,n,i,t)}}}function Cu(t,e,n){return n?{mapIndex(n,r,o){for(let i=0,a=n.length-t;i<a;++i)o[n[i+e]]=r[n[i+t-1]]}}:{mapIndex(n,r,o){for(let i=-e,a=n.length-t+e+1;i<a;++i)o[n[i+e]]=Au(r,n,i,t)}}}function Bu(t){if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"min":return ju;case"max":return Wu}throw new Error(`unknown selector: ${t}`)}function Tu(t){return Du(null,Iu,t)}function Nu(t){return Du(null,Pu,t)}function*Iu(t){yield t[0]}function*Pu(t){yield t[t.length-1]}function*ju(t,n){yield e.least(t,(t=>n[t]))}function*Wu(t,n){yield e.greatest(t,(t=>n[t]))}function Du(t,n,r){if(null!=t){if(null==r[t])throw new Error(`missing channel: ${t}`);t=r[t]}const o=Q(r);return Wt(r,((r,i)=>{const a=x(r,o),l=x(r,t),s=[];for(const t of i){const r=[];for(const o of a?e.group(t,(t=>a[t])).values():[t])for(const t of n(o,l))r.push(t);s.push(r)}return{data:r,facets:s}}))}t.Area=Pa,t.Arrow=el,t.BarX=il,t.BarY=al,t.Cell=ul,t.Contour=hs,t.Density=zs,t.Dot=pl,t.Frame=wi,t.Geo=Cs,t.Hexgrid=js,t.Image=qs,t.Line=yl,t.Link=Qa,t.Mark=_r,t.Raster=es,t.Rect=kl,t.RuleX=ao,t.RuleY=lo,t.Text=mo,t.TickX=Fl,t.TickY=Yl,t.Vector=Wo,t.area=function(t,e){return void 0===e?Wa(t,{x:O,y:E}):new Pa(t,e)},t.areaX=ja,t.areaY=Wa,t.arrow=function(t,e={}){let{x:n,x1:r,x2:o,y:i,y1:a,y2:l,...s}=e;return[r,o]=Ka(n,r,o),[a,l]=Ka(i,a,l),new el(t,{...s,x1:r,x2:o,y1:a,y2:l})},t.auto=function(t,e){const{fx:n,fy:r,x:{zero:o},y:{zero:i},markImpl:a,markOptions:l,transformImpl:s,transformOptions:c,colorMode:u}=Ll(t,e),f=null!=n||null!=r?bi({strokeOpacity:.1}):null,h=[o?so([0]):null,i?co([0]):null],d=a(t,s?s(c,l):l);return"stroke"===u?Gr(f,h,d):Gr(f,d,h)},t.autoSpec=function(t,e){const{x:n,y:r,fx:o,fy:i,color:a,size:l,mark:s}=Ll(t,e);return{x:n,y:r,fx:o,fy:i,color:a,size:l,mark:s}},t.axisFx=Jo,t.axisFy=Zo,t.axisX=Qo,t.axisY=Vo,t.barX=ll,t.barY=sl,t.bin=Yi,t.binX=qi,t.binY=Fi,t.boxX=function(t,e={}){const{x:n=M,y:r=null,fill:o="#ccc",fillOpacity:i,stroke:a="currentColor",strokeOpacity:l,strokeWidth:s=2,sort:c,...u}=e,f=null!=r?Jt:Zt;return Gr(co(t,f({x1:Ul,x2:Hl},{x:n,y:r,stroke:a,strokeOpacity:l,...u})),ll(t,f({x1:"p25",x2:"p75"},{x:n,y:r,fill:o,fillOpacity:i,...u})),_l(t,f({x:"p50"},{x:n,y:r,stroke:a,strokeOpacity:l,strokeWidth:s,sort:c,...u})),ml(t,Tl({x:Xl},{x:n,y:r,z:r,stroke:a,strokeOpacity:l,...u})))},t.boxY=function(t,e={}){const{y:n=M,x:r=null,fill:o="#ccc",fillOpacity:i,stroke:a="currentColor",strokeOpacity:l,strokeWidth:s=2,sort:c,...u}=e,f=null!=r?Qt:Zt;return Gr(so(t,f({y1:Ul,y2:Hl},{x:r,y:n,stroke:a,strokeOpacity:l,...u})),sl(t,f({y1:"p25",y2:"p75"},{x:r,y:n,fill:o,fillOpacity:i,...u})),Gl(t,f({y:"p50"},{x:r,y:n,stroke:a,strokeOpacity:l,strokeWidth:s,sort:c,...u})),ml(t,Tl({y:Xl},{x:r,y:n,z:r,stroke:a,strokeOpacity:l,...u})))},t.cell=fl,t.cellX=function(t,e={}){let{x:n=$,fill:r,stroke:o,...i}=e;return void 0===r&&void 0===j(o)[0]&&(r=M),new ul(t,{...i,x:n,fill:r,stroke:o})},t.cellY=function(t,e={}){let{y:n=$,fill:r,stroke:o,...i}=e;return void 0===r&&void 0===j(o)[0]&&(r=M),new ul(t,{...i,y:n,fill:r,stroke:o})},t.centroid=function({geometry:t=M,...n}={}){return Dt({...n,x:null,y:null},((n,r,o,i,a,{projection:l})=>{const s=x(n,t),c=s.length,u=new Float64Array(c),f=new Float64Array(c),h=e.geoPath(l);for(let t=0;t<c;++t)[u[t],f[t]]=h.centroid(s[t]);return{data:n,facets:r,channels:{x:{value:u},y:{value:f}}}}))},t.circle=function(t,e){return ml(t,{...e,symbol:"circle"})},t.cluster=function(t,n){return kc(t,{...n,treeLayout:e.cluster})},t.column=nt,t.contour=function(){return new hs(...ns("value",...arguments))},t.delaunayLink=function(t,e){return As(xs,t,e)},t.delaunayMesh=function(t,e){return As(bs,t,e)},t.density=function(t,e={}){let{x:n,y:r,...o}=e;return[n,r]=Z(n,r),new zs(t,{...o,x:n,y:r})},t.dodgeX=function(t={},e={}){1===arguments.length&&([t,e]=ru(t));let{anchor:n="left",padding:r=1,r:o=e.r}=nu(t);switch(`${n}`.toLowerCase()){case"left":n=Zc;break;case"right":n=Qc;break;case"middle":n=Jc;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return ou("x","y",n,z(r),o,e)},t.dodgeY=function(t={},e={}){1===arguments.length&&([t,e]=ru(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=nu(t);switch(`${n}`.toLowerCase()){case"top":n=Kc;break;case"bottom":n=tu;break;case"middle":n=eu;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return ou("y","x",n,z(r),o,e)},t.dot=ml,t.dotX=function(t,e={}){const{x:n=M,...r}=e;return new pl(t,oo({...r,x:n}))},t.dotY=function(t,e={}){const{y:n=M,...r}=e;return new pl(t,ro({...r,y:n}))},t.filter=function(t,e){return Yt(e,_t(t))},t.formatIsoDate=rr,t.formatMonth=function(t="en-US",e="short"){const n=er(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=nr(t,e);return t=>null==t||isNaN(t=+new Date(Date.UTC(2001,0,+t)))?void 0:n.format(t)},t.frame=bi,t.geo=Bs,t.geoCentroid=function({geometry:t=M,...n}={}){let r;return{...n,x:{transform:n=>Float64Array.from(r=x(x(n,t),e.geoCentroid),(([t])=>t))},y:{transform:()=>Float64Array.from(r,(([,t])=>t))}}},t.graticule=function({strokeOpacity:t=.1,...n}={}){return Bs(e.geoGraticule10(),{strokeOpacity:t,...n})},t.gridFx=oi,t.gridFy=ni,t.gridX=ri,t.gridY=ei,t.group=Kt,t.groupX=Qt,t.groupY=Jt,t.groupZ=Zt,t.hexagon=function(t,e){return ml(t,{...e,symbol:"hexagon"})},t.hexbin=function(t={fill:"count"},{binWidth:e,...n}={}){e=void 0===e?20:z(e),t=ne(t,n);const{z:r,fill:o,stroke:i}=n;return void 0===i&&wt(o)&&ee(t,"fill")&&(n.stroke="none"),void 0===n.symbol&&(n.symbol="hexagon"),void 0!==n.r||ee(t,"r")||(n.r=e/2),Dt(n,((n,o,i,a,l,s)=>{let{x:c,y:u,z:f,fill:h,stroke:d,symbol:p}=i;if(void 0===c)throw new Error("missing channel: x");if(void 0===u)throw new Error("missing channel: y");({x:c,y:u}=Fe(i,a,s)),f=f?f.value:x(n,r),h=h?.value,d=d?.value,p=p?.value;const m=se(t,{z:f,fill:h,stroke:d,symbol:p}),g=f&&[],y=h&&[],v=d&&[],w=p&&[],b=[],k=[],$=[];let M=-1;for(const e of t)e.initialize(n);for(const n of o){const r=[];for(const e of t)e.scope("facet",n);for(const[o,i]of ie(n,m))for(const n of Is(i,c,u,e)){r.push(++M),k.push(n.x),$.push(n.y),f&&g.push(m===f?o:f[n[0]]),h&&y.push(m===h?o:h[n[0]]),d&&v.push(m===d?o:d[n[0]]),p&&w.push(m===p?o:p[n[0]]);for(const e of t)e.reduce(n)}b.push(r)}return{data:n,facets:b,channels:{x:{value:k},y:{value:$},...f&&{z:{value:g}},...h&&{fill:{value:y,scale:"auto"}},...d&&{stroke:{value:v,scale:"auto"}},...p&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(t.map((({name:t,output:n})=>[t,{scale:"auto",radius:"r"===t?e/2:void 0,value:n.transform()}])))}}}))},t.hexgrid=function(t){return new js(t)},t.hull=function(t,e){return As(ks,t,e)},t.identity=M,t.image=function(t,e={}){let{x:n,y:r,...o}=e;return void 0===e.frameAnchor&&([n,r]=Z(n,r)),new qs(t,{...o,x:n,y:r})},t.indexOf=$,t.initializer=Dt,t.interpolateNearest=ss,t.interpolateNone=as,t.interpolatorBarycentric=ls,t.interpolatorRandomWalk=cs,t.legend=function(t={}){for(const[e,n]of Dr){const r=t[e];if(X(r)){const o=Ye(t);let i;if("symbol"===e){const{fill:e,stroke:n=(void 0===e&&X(t.color)?"color":void 0)}=t;i={fill:e,stroke:n}}return n(qn(e,r,i),qr(o,r,t),(e=>X(t[e])?qn(e,t[e]):null))}}throw new Error("unknown legend type; no scale found")},t.line=vl,t.lineX=xl,t.lineY=wl,t.linearRegressionX=function(t,e={}){const{y:n=$,x:r=M,stroke:o,fill:i=(wt(o)?"currentColor":o),...a}=e;return new Zs(t,Xi({...a,x:r,y:n,fill:i,stroke:o}))},t.linearRegressionY=function(t,e={}){const{x:n=$,y:r=M,stroke:o,fill:i=(wt(o)?"currentColor":o),...a}=e;return new Qs(t,Gi({...a,x:n,y:r,fill:i,stroke:o}))},t.link=Ja,t.map=Tl,t.mapX=Cl,t.mapY=Bl,t.marks=Gr,t.normalize=lu,t.normalizeX=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),Cl(lu(t),e)},t.normalizeY=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),Bl(lu(t),e)},t.plot=ki,t.raster=function(){const[t,e]=ns("fill",...arguments);return new es(t,null==t||void 0!==e.fill||void 0!==e.fillOpacity?e:{...e,fill:M})},t.rect=function(t,e){return new kl(t,Kr(to(e)))},t.rectX=$l,t.rectY=Ml,t.reverse=function({sort:t,...e}={}){return{...Yt(e,Gt),sort:H(t)?t:null}},t.ruleX=so,t.ruleY=co,t.scale=function(t={}){let e;for(const n in t)if(St.has(n)&&X(t[n])){if(void 0!==e)throw new Error("ambiguous scale definition; multiple scales found");e=Jn(qn(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 Tu(e);case"last":return Nu(e)}if("function"==typeof t)return Du(null,t,e);let n,r;for(n in t){if(void 0!==r)throw new Error("ambiguous selector; multiple inputs");r=Bu(t[n])}if(void 0===r)throw new Error(`invalid selector: ${t}`);return Du(n,r,e)},t.selectFirst=Tu,t.selectLast=Nu,t.selectMaxX=function(t){return Du("x",Wu,t)},t.selectMaxY=function(t){return Du("y",Wu,t)},t.selectMinX=function(t){return Du("x",ju,t)},t.selectMinY=function(t){return Du("y",ju,t)},t.shuffle=function({seed:t,sort:n,...r}={}){return{...Yt(r,Vt(null==t?Math.random:e.randomLcg(t))),sort:H(n)?n:null}},t.sort=Xt,t.sphere=function({strokeWidth:t=1.5,...e}={}){return Bs({type:"Sphere"},{strokeWidth:t,...e})},t.spike=function(t,e={}){const{shape:n=Po,stroke:r=Bo.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:a=.3,anchor:l="start",...s}=e;return Do(t,{...s,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:a,anchor:l})},t.stackX=ga,t.stackX1=function(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{y1:n,y:r=n,x:o}=e,[i,a,l]=ba(r,o,"x",t,e);return{...i,y1:n,y:a,x:l}},t.stackX2=function(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{y1:n,y:r=n,x:o}=e,[i,a,,l]=ba(r,o,"x",t,e);return{...i,y1:n,y:a,x:l}},t.stackY=ya,t.stackY1=function(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{x1:n,x:r=n,y:o}=e,[i,a,l]=ba(r,o,"y",t,e);return{...i,x1:n,x:a,y:l}},t.stackY2=function(t={},e={}){1===arguments.length&&([t,e]=wa(t));const{x1:n,x:r=n,y:o}=e,[i,a,,l]=ba(r,o,"y",t,e);return{...i,x1:n,x:a,y:l}},t.text=yo,t.textX=vo,t.textY=xo,t.tickX=_l,t.tickY=Gl,t.transform=Wt,t.tree=kc,t.treeLink=ec,t.treeNode=tc,t.valueof=x,t.vector=Do,t.vectorX=qo,t.vectorY=Fo,t.version="0.6.6",t.voronoi=function(t,e){return As($s,t,e)},t.voronoiMesh=function(t,e){return As(Ms,t,e)},t.window=xu,t.windowX=function(t={},e){return 1===arguments.length&&(e=t),Cl(xu(t),e)},t.windowY=function(t={},e){return 1===arguments.length&&(e=t),Bl(xu(t),e)}}));