| 12 |
- // @observablehq/plot v0.6.17 Copyright 2020-2025 Observable, Inc.
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3@7.9.0/dist/d3.min.js")):"function"==typeof define&&define.amd?define(["exports","d3@7.9.0/dist/d3.min.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Plot=t.Plot||{},t.d3)}(this,(function(t,e){"use strict";function n(t){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 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):e}function d(t){if(null==t)return;const n=t[0],r=t[t.length-1];return e.descending(n,r)}const p=1e3,m=6e4,y=36e5,g=864e5,v=6048e5,x=2592e6,w=31536e6,b=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",p],["5 seconds",5e3],["15 seconds",15e3],["30 seconds",3e4],["minute",m],["5 minutes",3e5],["15 minutes",9e5],["30 minutes",18e5],["hour",y],["3 hours",108e5],["6 hours",216e5],["12 hours",432e5],["day",g],["2 days",1728e5],["week",v],["2 weeks",12096e5],["month",x],["3 months",7776e6],["6 months",15552e6],["year",w],["2 years",63072e6],["5 years",15768e7],["10 years",31536e7],["20 years",63072e7],["50 years",15768e8],["100 years",31536e8]],k=new Map([["second",p],["minute",m],["hour",y],["day",g],["monday",v],["tuesday",v],["wednesday",v],["thursday",v],["friday",v],["saturday",v],["sunday",v],["week",v],["month",x],["year",w]]),$=new Map([["second",e.timeSecond],["minute",e.timeMinute],["hour",e.timeHour],["day",e.timeDay],["monday",e.timeMonday],["tuesday",e.timeTuesday],["wednesday",e.timeWednesday],["thursday",e.timeThursday],["friday",e.timeFriday],["saturday",e.timeSaturday],["sunday",e.timeSunday],["week",e.timeWeek],["month",e.timeMonth],["year",e.timeYear]]),M=new Map([["second",e.utcSecond],["minute",e.utcMinute],["hour",e.utcHour],["day",e.unixDay],["monday",e.utcMonday],["tuesday",e.utcTuesday],["wednesday",e.utcWednesday],["thursday",e.utcThursday],["friday",e.utcFriday],["saturday",e.utcSaturday],["sunday",e.utcSunday],["week",e.utcWeek],["month",e.utcMonth],["year",e.utcYear]]),A=Symbol("intervalDuration"),L=Symbol("intervalType");for(const[t,e]of $)e[A]=k.get(t),e[L]="time";for(const[t,e]of M)e[A]=k.get(t),e[L]="utc";const S=[["year",e.utcYear,"utc"],["month",e.utcMonth,"utc"],["day",e.unixDay,"utc",15552e6],["hour",e.utcHour,"utc",2592e5],["minute",e.utcMinute,"utc",216e5],["second",e.utcSecond,"utc",18e5]],z=[["year",e.timeYear,"time"],["month",e.timeMonth,"time"],["day",e.timeDay,"time",15552e6],["hour",e.timeHour,"time",2592e5],["minute",e.timeMinute,"time",216e5],["second",e.timeSecond,"time",18e5]],O=[S[0],z[0],S[1],z[1],S[2],z[2],...S.slice(3)];function E(t){let e=`${t}`.toLowerCase();e.endsWith("s")&&(e=e.slice(0,-1));let n=1;const r=/^(?:(\d+)\s+)/.exec(e);switch(r&&(e=e.slice(r[0].length),n=+r[1]),e){case"quarter":e="month",n*=3;break;case"half":e="month",n*=6}let o=M.get(e);if(!o)throw new Error(`unknown interval: ${t}`);if(n>1&&!o.every)throw new Error(`non-periodic interval: ${e}`);return[e,n]}function R(t){return N(E(t),"time")}function C(t){return N(E(t),"utc")}function N([t,e],n){let r=("time"===n?$:M).get(t);return e>1&&(r=r.every(e),r[A]=k.get(t)*e,r[L]=n),r}function T(t,n){if(!(n>1))return;const r=t[A];if(!b.some((([,t])=>t===r)))return;if(r%g==0&&g<r&&r<x)return;const[o]=b[e.bisector((([,t])=>Math.log(t))).center(b,Math.log(r*n))];return("time"===t[L]?R:C)(o)}function B(t,n,r){const o="time"===n?e.timeFormat:e.utcFormat;if(null==r)return o("year"===t?"%Y":"month"===t?"%Y-%m":"day"===t?"%Y-%m-%d":"hour"===t||"minute"===t?"%Y-%m-%dT%H:%M":"second"===t?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");const i=function(t){return"left"===t||"right"===t?(t,e)=>`\n${t}\n${e}`:"top"===t?(t,e)=>`${e}\n${t}`:(t,e)=>`${t}\n${e}`}(r);switch(t){case"millisecond":return P(o(".%L"),o(":%M:%S"),i);case"second":return P(o(":%S"),o("%-I:%M"),i);case"minute":return P(o("%-I:%M"),o("%p"),i);case"hour":return P(o("%-I %p"),o("%b %-d"),i);case"day":return P(o("%-d"),o("%b"),i);case"month":return P(o("%b"),o("%Y"),i);case"year":return o("%Y")}throw new Error("unable to format time ticks")}function I(t,n,r){const o=e.max(e.pairs(n,((t,e)=>Math.abs(e-t))));if(o<1e3)return B("millisecond","utc",r);for(const[e,i,a,l]of function(t){return"time"===t?z:"utc"===t?S:O}(t)){if(o>l)break;if("hour"===e&&!o)break;if(n.every((t=>i.floor(t)>=t)))return B(e,a,r)}}function P(t,e,n){return(r,o,i)=>{const a=t(r,o),l=e(r,o),s=o-d(i);return o!==s&&void 0!==i[s]&&l===e(i[s],s)?a:n(a,l)}}const W=Object.getPrototypeOf(Uint8Array),j=Object.prototype.toString;function F(t){return t instanceof Array||t instanceof W}function q(t){return t instanceof W&&!function(t){return t instanceof BigInt64Array||t instanceof BigUint64Array}(t)}function D(t){return t?.prototype instanceof W&&!function(t){return t===BigInt64Array||t===BigUint64Array}(t)}const Y=Symbol("reindex");function _(t,e,n){const r=typeof e;return"string"===r?de(t)?H(t.getChild(e),n):G(t,Z(e),n):"function"===r?G(t,e,n):"number"===r||e instanceof Date||"boolean"===r?wt(t,lt(e),n):"function"==typeof e?.transform?X(e.transform(t),n):function(t,e){return null!=t&&e?Tt(t,e):t}(X(e,n),t?.[Y])}function G(t,e,n){return wt(t,D(n)?(t,n)=>ut(e(t,n)):e,n)}function X(t,e){return void 0===e?vt(t):pe(t)?H(t,e):t instanceof e?t:e.from(t,D(e)&&!q(t)?ut:void 0)}function H(t,e){return null==t?t:void 0!==e&&e!==Array||!function(t){return t&&(8===t.typeId||10===t.typeId)&&1===t.unit}(t.type)?X(U(t),e):ft(U(t))}function U(t){return t.nullCount?t.toJSON():t.toArray()}const V=[null],Z=t=>e=>{const n=e[t];return void 0===n&&"Feature"===e.type?e.properties?.[t]:n},J={transform:Nt},Q={transform:t=>t},K=()=>1,tt=()=>!0,et=t=>null==t?t:`${t}`,nt=t=>null==t?t:+t,rt=t=>t?t[0]:void 0,ot=t=>t?t[1]:void 0,at=t=>t?t[2]:void 0,lt=t=>()=>t;function st(t){const n=+`${t}`.slice(1)/100;return(t,r)=>e.quantile(t,n,r)}function ct(t){return q(t)?t:wt(t,ut,Float64Array)}function ut(t){return null==t?NaN:Number(t)}function ft(t){return wt(t,ht)}function ht(t){return t instanceof Date&&!isNaN(t)?t:"string"==typeof t?h(t):null==t||isNaN(t=Number(t))?void 0:new Date(t)}function dt(t,e){return void 0===t&&(t=e),null===t?[void 0,"none"]:ie(t)?[void 0,t]:[t,void 0]}function pt(t,e){return void 0===t&&(t=e),null===t||"number"==typeof t?[void 0,t]:[t,void 0]}function mt(t,e,n){if(null!=t)return yt(t,e,n)}function yt(t,e,n){const r=`${t}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${e}: ${t}`);return r}function gt(t){return de(t)?t:vt(t)}function vt(t){if(null==t||F(t))return t;if(pe(t))return H(t);if(xt(t))switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;default:return[t]}return Array.from(t)}function xt(t){switch(t?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function wt(t,e,n=Array){return null==t?t:t instanceof n?t.map(e):n.from(t,e)}function bt(t,e=Array){return t instanceof e?t.slice():e.from(t)}function kt({x:t,x1:e,x2:n}){return void 0!==t||void 0!==e||void 0!==n}function $t({y:t,y1:e,y2:n}){return void 0!==t||void 0!==e||void 0!==n}function Mt(t){return kt(t)||$t(t)||void 0!==t.interval}function At(t){return t?.toString===j}function Lt(t){return At(t)&&(void 0!==t.type||void 0!==t.domain)}function St(t){return At(t)&&"function"!=typeof t.transform}function zt(t){return St(t)&&void 0===t.value&&void 0===t.channel}function Ot(t,e,n,r=Q){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 Et(t,e){return void 0===t&&void 0===e?[rt,ot]:[t,e]}function Rt({z:t,fill:e,stroke:n}={}){return void 0===t&&([t]=dt(e)),void 0===t&&([t]=dt(n)),t}function Ct(t){return F(t)?t.length:t?.numRows}function Nt(t){const e=Ct(t),n=new Uint32Array(e);for(let t=0;t<e;++t)n[t]=t;return n}function Tt(t,e){return F(t)?wt(e,(e=>t[e]),t.constructor):wt(e,(e=>t.at(e)))}function Bt(t){return 1===t.length?(e,n)=>t(Tt(n,e)):t}function It(t,e,n){return t.subarray?t.subarray(e,n):t.slice(e,n)}function Pt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Wt(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 jt(t){let e;return[{transform:()=>e,label:qt(t)},t=>e=t]}function Ft(t){return null==t?[t]:jt(t)}function qt(t,e){return"string"==typeof t?t:t&&void 0!==t.label?t.label:e}function Dt(t,e){return{transform(n){const r=t.transform(n),o=e.transform(n);return Kt(r)||Kt(o)?wt(r,((t,e)=>new Date((+r[e]+ +o[e])/2))):wt(r,((t,e)=>(+r[e]+ +o[e])/2),Float64Array)},label:t.label}}function Yt(t,e){const n=_t(e?.interval,e?.type);return n?wt(t,n):t}function _t(t,e){const r=Gt(t,e);return r&&(t=>n(t)?r.floor(t):t)}function Gt(t,e){if(null!=t){if("number"==typeof t)return Xt(t);if("string"==typeof t)return("time"===e?R:C)(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 Xt(t){0<(t=+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,e=1)=>(t*n+Math.floor(e))/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,e=1)=>t+n*Math.floor(e),range:(t,r)=>e.range(Math.ceil(t/n),r/n).map((t=>t*n))}}function Ht(t,e){if((t=Gt(t,e))&&"function"!=typeof t.range)throw new Error("invalid interval: missing range method");return t}function Ut(t){return"function"==typeof t?.range}function Vt(t){return void 0===t||St(t)?t:{value:t}}function Zt(t){return t&&"function"==typeof t[Symbol.iterator]}function Jt(t){for(const e of t)if(null!=e)return"object"!=typeof e||e instanceof Date}function Qt(t){for(const e of t){if(null==e)continue;const t=typeof e;return"string"===t||"boolean"===t}}function Kt(t){for(const e of t)if(null!=e)return e instanceof Date}function te(t){for(const e of t)if(null!=e)return"string"==typeof e&&isNaN(e)&&h(e)}function ee(t){for(const e of t)if(null!=e){if("string"!=typeof e)return!1;if(e.trim())return!isNaN(e)}}function ne(t){for(const e of t)if(null!=e)return"number"==typeof e}function re(t,e){let n;for(const r of t)if(null!=r){if(!e(r))return!1;n=!0}return n}const oe=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function ie(t){return"string"==typeof t&&(t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||oe.has(t))}function ae(t){return"number"==typeof t&&(0<=t&&t<=1||isNaN(t))}function le(t){return null==t||se(t)}function se(t){return/^\s*none\s*$/i.test(t)}function ce(t,e){return mt(t,e,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ue(t="middle"){return ce(t,"frameAnchor")}function fe(t){return Zt(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}function he(t){return!0===t?t="frame":!1===t?t=null:xt(t)||null==t||"sphere"===(t=yt(t,"clip",["frame","sphere"]))&&(t={type:"Sphere"}),t}function de(t){return t&&"function"==typeof t.getChild&&"function"==typeof t.toArray&&t.schema&&Array.isArray(t.schema.fields)}function pe(t){return t&&"function"==typeof t.toArray&&t.type}const me=Symbol("position"),ye=Symbol("color"),ge=Symbol("radius"),ve=Symbol("length"),xe=Symbol("opacity"),we=Symbol("symbol"),be=Symbol("projection"),ke=new Map([["x",me],["y",me],["fx",me],["fy",me],["r",ge],["color",ye],["opacity",xe],["symbol",we],["length",ve],["projection",be]]);const $e=Math.sqrt(3),Me=2/$e,Ae={draw(t,e){const n=Math.sqrt(e/Math.PI),r=n*Me,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()}},Le=new Map([["asterisk",e.symbolAsterisk],["circle",e.symbolCircle],["cross",e.symbolCross],["diamond",e.symbolDiamond],["diamond2",e.symbolDiamond2],["hexagon",Ae],["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 Se(t){return t&&"function"==typeof t.draw}function ze(t){return!!Se(t)||"string"==typeof t&&Le.has(t.toLowerCase())}function Oe(t){if(null==t||Se(t))return t;const e=Le.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid symbol: ${t}`)}function Ee({filter:t,sort:e,reverse:n,transform:r,initializer:o,...i}={},a){if(void 0===r&&(null!=t&&(r=Be(t)),null==e||zt(e)||(r=Ce(r,We(e))),n&&(r=Ce(r,Ie))),null!=a&&null!=o)throw new Error("transforms cannot be applied after initializers");return{...i,...(null===e||zt(e))&&{sort:e},transform:Ce(r,a)}}function Re({filter:t,sort:e,reverse:n,initializer:r,...o}={},i){return void 0===r&&(null!=t&&(r=Be(t)),null==e||zt(e)||(r=Ne(r,We(e))),n&&(r=Ne(r,Ie))),{...o,...(null===e||zt(e))&&{sort:e},initializer:Ne(r,i)}}function Ce(t,e){return null==t?null===e?void 0:e:null==e?null===t?void 0:t:function(n,r,o){return({data:n,facets:r}=t.call(this,n,r,o)),e.call(this,gt(n),r,o)}}function Ne(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 Te(t,e){return(null!=t.initializer?Re:Ee)(t,e)}function Be(t){return(e,n)=>{const r=_(e,t);return{data:e,facets:n.map((t=>t.filter((t=>r[t]))))}}}function Ie(t,e){return{data:t,facets:e.map((t=>t.slice().reverse()))}}function Pe(t,{sort:e,...n}={}){return{...(St(t)&&void 0!==t.channel?Re:Te)(n,We(t)),sort:zt(e)?e:null}}function We(t){return("function"==typeof t&&1!==t.length?je:Fe)(t)}function je(t){return(e,n)=>{const r=F(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r));return{data:e,facets:n.map((t=>t.slice().sort(r)))}}}function Fe(t){let e,n;({channel:e,value:t,order:n}={...Vt(t)});const i=e?.startsWith("-");if(i&&(e=e.slice(1)),void 0===n&&(n=i?o:r),"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=_(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 qe(t,e){return Ge(null,null,t,e)}function De(t={y:"count"},e={}){const{x:n=Q}=e;if(null==n)throw new Error("missing channel: x");return Ge(n,null,t,e)}function Ye(t={x:"count"},e={}){const{y:n=Q}=e;if(null==n)throw new Error("missing channel: y");return Ge(null,n,t,e)}function _e(t={fill:"count"},e={}){let{x:n,y:r}=e;if([n,r]=Et(n,r),null==n)throw new Error("missing channel: x");if(null==r)throw new Error("missing channel: y");return Ge(n,r,t,e)}function Ge(t,e,{data:n=cn,filter:r,sort:o,reverse:i,...a}={},l={}){a=Ke(a,l),n=nn(n,Q),o=null==o?void 0:tn("sort",o,l),r=null==r?void 0:en("filter",r,l);const[s,c]=Ft(t),[u,f]=Ft(e),{z:h,fill:d,stroke:p,x1:m,x2:y,y1:g,y2:v,...x}=l,[w,b]=Ft(h),[k]=dt(d),[$]=dt(p),[M,A]=Ft(k),[L,S]=Ft($);return{..."z"in l&&{z:w||h},..."fill"in l&&{fill:M||d},..."stroke"in l&&{stroke:L||p},...Ee(x,((l,s,u)=>{const d=Yt(_(l,t),u?.x),p=Yt(_(l,e),u?.y),m=_(l,h),y=_(l,k),g=_(l,$),v=on(a,{z:m,fill:y,stroke:g}),x=[],w=[],M=d&&c([]),L=p&&f([]),z=m&&b([]),O=y&&A([]),E=g&&S([]);let R=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 Ze(t,v))for(const[t,c]of Ze(s,p))for(const[s,u]of Ze(c,d)){const c={data:l};if(d&&(c.x=s),p&&(c.y=t),v&&(c.z=i),!r||r.reduce(u,c)){e.push(R++),w.push(n.reduceIndex(u,l,c)),d&&M.push(s),p&&L.push(t),m&&z.push(v===m?i:m[u[0]]),y&&O.push(v===y?i:y[u[0]]),g&&E.push(v===g?i:g[u[0]]);for(const t of a)t.reduce(u,c);o&&o.reduce(u,c)}}x.push(e)}return an(x,o,i),{data:w,facets:x}})),...!Xe(a,"x")&&(s?{x:s}:{x1:m,x2:y}),...!Xe(a,"y")&&(u?{y:u}:{y1:g,y2:v}),...Object.fromEntries(a.map((({name:t,output:e})=>[t,e])))}}function Xe(t,...e){for(const{name:n}of t)if(e.includes(n))return!0;return!1}function He(t,e,n=Ue){const r=Object.entries(t);return null!=e.title&&void 0===t.title&&r.push(["title",fn]),null!=e.href&&void 0===t.href&&r.push(["href",un]),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 Ue(t,e,n,r=Ve){let o;At(e)&&"reduce"in e&&(o=e.scale,e=e.reduce);const i=r(t,e,n),[a,l]=jt(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 Ve(t,e,n,r=Je){const o=Wt(t,n),i=r(e,o);let a,l;return{label:qt(i===dn?null:o,i.label),initialize(t){a=void 0===o?t:_(t,o),"data"===i.scope&&(l=i.reduceIndex(Nt(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 Ze(t,n){return n?e.group(t,(t=>n[t])):[[,t]]}function Je(t,n,r=Qe){if(null==t)return r(t);if("function"==typeof t.reduceIndex)return t;if("function"==typeof t.reduce&&At(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(Tt(e,t),n)};var o;if(/^p\d{2}$/i.test(t))return ln(st(t));switch(`${t}`.toLowerCase()){case"first":return un;case"last":return hn;case"identity":return cn;case"count":return dn;case"distinct":return pn;case"sum":return null==n?dn:mn;case"proportion":return yn(n,"data");case"proportion-facet":return yn(n,"facet");case"deviation":return ln(e.deviation);case"min":return ln(e.min);case"min-index":return ln(e.minIndex);case"max":return ln(e.max);case"max-index":return ln(e.maxIndex);case"mean":return sn(e.mean);case"median":return sn(e.median);case"variance":return ln(e.variance);case"mode":return ln(e.mode)}return r(t)}function Qe(t){throw new Error(`invalid reduce: ${t}`)}function Ke(t,e){return He(t,e,tn)}function tn(t,e,n){return Ue(t,e,n,en)}function en(t,e,n){return Ve(t,e,n,nn)}function nn(t,e){return Je(t,e,rn)}function rn(t){switch(`${t}`.toLowerCase()){case"x":return gn;case"y":return vn;case"z":return xn}throw new Error(`invalid group reduce: ${t}`)}function on(t,e){for(const n in e){const r=e[n];if(void 0!==r&&!t.some((t=>t.name===n)))return r}}function an(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 ln(t){return{reduceIndex:(e,n)=>t(e,(t=>n[t]))}}function sn(t){return{reduceIndex(e,n){const r=t(e,(t=>n[t]));return Kt(n)?new Date(r):r}}}const cn={reduceIndex:(t,e)=>Tt(e,t)},un={reduceIndex:(t,e)=>e[t[0]]},fn={reduceIndex(t,n){const r=e.sort(e.rollup(t,(t=>t.length),(t=>n[t])),ot),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,ot)]}return o.map((([t,e])=>`${t} (${e.toLocaleString("en-US")})`)).join("\n")}},hn={reduceIndex:(t,e)=>e[t[t.length-1]]},dn={label:"Frequency",reduceIndex:t=>t.length},pn={label:"Distinct",reduceIndex(t,n){const r=new e.InternSet;for(const e of t)r.add(n[e]);return r.size}},mn=ln(e.sum);function yn(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}}const gn={reduceIndex:(t,e,{x:n})=>n},vn={reduceIndex:(t,e,{y:n})=>n},xn={reduceIndex:(t,e,{z:n})=>n};function wn(t,{scale:e,type:n,value:r,filter:o,hint:i,label:a=qt(r)},l){return void 0===i&&"function"==typeof r?.transform&&(i=r.hint),$n(l,{scale:e,type:n,value:_(t,r),label:a,filter:o,hint:i})}function bn(t,e){return Object.fromEntries(Object.entries(t).map((([t,n])=>[t,wn(e,n,t)])))}function kn(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:wt(r,o)]})));return n.channels=t,n}function $n(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&&re(r,ie)?null:"color",e.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":e.scale=!0!==n&&re(r,ae)?null:"opacity",e.defaultScale="opacity";break;case"symbol":!0!==n&&re(r,ze)?(e.scale=null,e.value=wt(r,Oe)):e.scale="symbol",e.defaultScale="symbol";break;default:e.scale=ke.has(t)?t:null}else if(!1===n)e.scale=null;else if(null!=n&&!ke.has(n))throw new Error(`unknown scale: ${n}`);return e}function Mn(t,e){for(const n in t){const r=t[n];if(r.scale===e)return r}}function An(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 Ln(t,e,n){const r=Sn(t,e);return wt(Sn(t,n),((t,e)=>Math.abs(t-r[e])),Float64Array)}function Sn(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 zn(t){if(null==t||"function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"ascending":return On;case"descending":return En}throw new Error(`invalid order: ${t}`)}function On([t,e],[n,o]){return r(e,o)||r(t,n)}function En([t,e],[n,i]){return o(e,i)||r(t,n)}function Rn(t,e){let n=t[e];if(n){for(;n.source;)n=n.source;return null===n.source?null:n}}const Cn=new Map([["accent",e.schemeAccent],["category10",e.schemeCategory10],["dark2",e.schemeDark2],["observable10",e.schemeObservable10],["paired",e.schemePaired],["pastel1",e.schemePastel1],["pastel2",e.schemePastel2],["set1",e.schemeSet1],["set2",e.schemeSet2],["set3",e.schemeSet3],["tableau10",e.schemeTableau10]]);const Nn=new Map([...Cn,["brbg",Bn(e.schemeBrBG,e.interpolateBrBG)],["prgn",Bn(e.schemePRGn,e.interpolatePRGn)],["piyg",Bn(e.schemePiYG,e.interpolatePiYG)],["puor",Bn(e.schemePuOr,e.interpolatePuOr)],["rdbu",Bn(e.schemeRdBu,e.interpolateRdBu)],["rdgy",Bn(e.schemeRdGy,e.interpolateRdGy)],["rdylbu",Bn(e.schemeRdYlBu,e.interpolateRdYlBu)],["rdylgn",Bn(e.schemeRdYlGn,e.interpolateRdYlGn)],["spectral",Bn(e.schemeSpectral,e.interpolateSpectral)],["burd",In(e.schemeRdBu,e.interpolateRdBu)],["buylrd",In(e.schemeRdYlBu,e.interpolateRdYlBu)],["blues",Tn(e.schemeBlues,e.interpolateBlues)],["greens",Tn(e.schemeGreens,e.interpolateGreens)],["greys",Tn(e.schemeGreys,e.interpolateGreys)],["oranges",Tn(e.schemeOranges,e.interpolateOranges)],["purples",Tn(e.schemePurples,e.interpolatePurples)],["reds",Tn(e.schemeReds,e.interpolateReds)],["turbo",Pn(e.interpolateTurbo)],["viridis",Pn(e.interpolateViridis)],["magma",Pn(e.interpolateMagma)],["inferno",Pn(e.interpolateInferno)],["plasma",Pn(e.interpolatePlasma)],["cividis",Pn(e.interpolateCividis)],["cubehelix",Pn(e.interpolateCubehelixDefault)],["warm",Pn(e.interpolateWarm)],["cool",Pn(e.interpolateCool)],["bugn",Tn(e.schemeBuGn,e.interpolateBuGn)],["bupu",Tn(e.schemeBuPu,e.interpolateBuPu)],["gnbu",Tn(e.schemeGnBu,e.interpolateGnBu)],["orrd",Tn(e.schemeOrRd,e.interpolateOrRd)],["pubu",Tn(e.schemePuBu,e.interpolatePuBu)],["pubugn",Tn(e.schemePuBuGn,e.interpolatePuBuGn)],["purd",Tn(e.schemePuRd,e.interpolatePuRd)],["rdpu",Tn(e.schemeRdPu,e.interpolateRdPu)],["ylgn",Tn(e.schemeYlGn,e.interpolateYlGn)],["ylgnbu",Tn(e.schemeYlGnBu,e.interpolateYlGnBu)],["ylorbr",Tn(e.schemeYlOrBr,e.interpolateYlOrBr)],["ylorrd",Tn(e.schemeYlOrRd,e.interpolateYlOrRd)],["rainbow",Wn(e.interpolateRainbow)],["sinebow",Wn(e.interpolateSinebow)]]);function Tn(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 Bn(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 In(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 Pn(t){return({length:n})=>e.quantize(t,Math.max(2,Math.floor(n)))}function Wn(t){return({length:n})=>e.quantize(t,Math.floor(n)+1).slice(0,-1)}function jn(t){const e=`${t}`.toLowerCase();if(!Nn.has(e))throw new Error(`unknown ordinal scheme: ${e}`);return Nn.get(e)}function Fn(t,e){const n=jn(t),r="function"==typeof n?n({length:e}):n;return r.length!==e?r.slice(0,e):r}const qn=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 Dn(t){const e=`${t}`.toLowerCase();if(!qn.has(e))throw new Error(`unknown quantitative scheme: ${e}`);return qn.get(e)}const Yn=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);const _n=t=>e=>t(1-e),Gn=[0,1],Xn=new Map([["number",e.interpolateNumber],["rgb",e.interpolateRgb],["hsl",e.interpolateHsl],["hcl",e.interpolateHcl],["lab",e.interpolateLab]]);function Hn(t){const e=`${t}`.toLowerCase();if(!Xn.has(e))throw new Error(`unknown interpolator: ${e}`);return Xn.get(e)}function Un(t,n,r,{type:o,nice:i,clamp:a,zero:l,domain:s=Kn(t,r),unknown:c,round:u,scheme:f,interval:h,range:p=(ke.get(t)===ge?er(r,s):ke.get(t)===ve?nr(r,s):ke.get(t)===xe?Gn:void 0),interpolate:m=(ke.get(t)===ye?null==f&&void 0!==p?e.interpolateRgb:Dn(void 0!==f?f:"cyclical"===o?"rainbow":"turbo"):u?e.interpolateRound:e.interpolateNumber),reverse:y}){if(s=Vn(s),h=Ht(h,o),"cyclical"!==o&&"sequential"!==o||(o="linear"),"function"!=typeof m&&(m=Hn(m)),y=!!y,void 0!==p){if(s.length!==(p=Vn(p)).length){if(1===m.length)throw new Error("invalid piecewise interpolator");m=e.piecewise(m,p),p=void 0}}if(1===m.length?(y&&(m=_n(m),y=!1),void 0===p&&2===(p=Float64Array.from(s,((t,e)=>e/(s.length-1)))).length&&(p=Gn),n.interpolate((p===Gn?lt:ir)(m))):n.interpolate(m),l){const[t,n]=e.extent(s);if(t>0||n<0){(d(s=bt(s))||1)===Math.sign(t)?s[0]=0:s[s.length-1]=0}}return y&&(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=Ht(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!==p&&n.range(p),a&&n.clamp(a),{type:o,domain:s,range:p,scale:n,interpolate:m,interval:h}}function Vn(t){return(t=vt(t)).length>=2?t:[t[0],t[0]]}function Zn(t,n,{exponent:r=1,...o}){return Un(t,e.scalePow().exponent(r),n,{...o,type:"pow"})}function Jn(t,n,{domain:r=[0],unknown:o,scheme:i="rdylbu",interpolate:a,range:l=(void 0!==a?e.quantize(a,r.length+1):ke.get(t)===ye?Fn(i,r.length+1):void 0),reverse:s}){const c=d(r=vt(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 Qn(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 Kn(t,e){const n=ke.get(t);return(n===ge||n===xe||n===ve?tr:Qn)(e)}function tr(t){return[0,t.length?e.max(t,(({value:t})=>void 0===t?t:e.max(t,a))):1]}function er(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 nr(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 rr(t){for(const{value:e}of t)if(void 0!==e)for(let n of e){if(n>0)return Qn(t,l);if(n<0)return Qn(t,s)}return[1,10]}function or(t){const e=[];for(const{value:n}of t)if(void 0!==n)for(const t of n)e.push(t);return e}function ir(t){return(e,n)=>r=>t(e+r*(n-e))}let ar,lr=0;function sr(t){t!==ar&&(ar=t,console.warn(t),++lr)}function cr(t,n,r,o,{type:i,nice:a,clamp:l,domain:s=Qn(o),unknown:c,pivot:u=0,scheme:f,range:h,symmetric:d=!0,interpolate:p=(ke.get(t)===ye?null==f&&void 0!==h?e.interpolateRgb:Dn(void 0!==f?f:"rdbu"):e.interpolateNumber),reverse:m}){u=+u,s=vt(s);let[y,g]=s;if(s.length>2&&sr(`Warning: the diverging ${t} scale domain contains extra elements.`),e.descending(y,g)<0&&([y,g]=[g,y],m=!m),y=Math.min(y,u),g=Math.max(g,u),"function"!=typeof p&&(p=Hn(p)),void 0!==h&&(p=1===p.length?ir(p)(...h):e.piecewise(p,h)),m&&(p=_n(p)),d){const t=r.apply(u),e=t-r.apply(y),n=r.apply(g)-t;e<n?y=r.invert(t-n):e>n&&(g=r.invert(t+e))}return n.domain([y,u,g]).unknown(c).interpolator(p),l&&n.clamp(l),a&&n.nice(a),{type:i,domain:[y,g],pivot:u,interpolate:p,scale:n}}function ur(t,n,{exponent:r=1,...o}){return cr(t,e.scaleDivergingPow().exponent(r=+r),function(t){return.5===t?pr:{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 fr(t,n,{constant:r=1,...o}){return cr(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 hr={apply:t=>t,invert:t=>t},dr={apply:Math.log,invert:Math.exp},pr={apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*(t*t)};function mr(t,e,n,r){return Un(t,e,n,r)}const yr=Symbol("ordinal");function gr(t,n,r,{type:o,interval:i,domain:a,range:l,reverse:s,hint:c}){return i=Ht(i,o),void 0===a&&(a=wr(r,i,t)),"categorical"!==o&&o!==yr||(o="ordinal"),s&&(a=e.reverse(a)),a=n.domain(a).domain(),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 vr(t,n,{type:r,interval:o,domain:i,range:a,scheme:l,unknown:s,...c}){let u;if(o=Ht(o,r),void 0===i&&(i=wr(n,o,t)),ke.get(t)===we)u=function(t){return{fill:br(t,"fill"),stroke:br(t,"stroke")}}(n),a=void 0===a?function(t){return le(t.fill)?e.symbolsStroke:e.symbolsFill}(u):wt(a,Oe);else if(ke.get(t)===ye&&(void 0!==a||"ordinal"!==r&&r!==yr||(a=function(t,e="greys"){const n=new Set,[r,o]=Fn(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":"observable10"),void 0!==l))if(void 0!==a){const t=Dn(l),n=a[0],r=a[1]-a[0];a=({length:o})=>e.quantize((e=>t(n+r*e)),o)}else a=jn(l);if(s===e.scaleImplicit)throw new Error(`implicit unknown on ${t} scale is not supported`);return gr(t,e.scaleOrdinal().unknown(s),n,{...c,type:r,domain:i,range:a,hint:u})}function xr(t,e,n,r){let{round:o}=n;return void 0!==o&&t.round(o=!!o),(t=gr(r,t,e,n)).round=o,t}function wr(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&&ke.get(o)===me)throw new Error(`implicit ordinal domain of ${o} scale has more than 10,000 values`);return e.sort(i,r)}function br(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 kr(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 y={};for(const[n,g]of t){const t=m[n],v=Nr(n,g,{round:ke.get(n)===me?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?Mr(g,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),y[n]=v}}return y}function $r(t){const e={},n={scales:e};for(const[r,o]of Object.entries(t)){const{scale:t,type:i,interval:a,label:l}=o;e[r]=Yr(o),n[r]=t,t.type=i,null!=a&&(t.interval=a),null!=l&&(t.label=l)}return n}function Mr(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)return!Wr(e)&&e.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Ar(t){return Math.sign(d(t.domain()))*Math.sign(d(t.range()))}function Lr(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 Sr({fx:t,fy:e},n){const{marginTop:r,marginRight:o,marginBottom:i,marginLeft:a,width:l,height:s}=Lr(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,facet:{width:l,height:s}}}function zr(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)],Wr(t)||(t.range=Rr(t)),t.scale.range(t.range)}Er(t)}function Or(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],Wr(t)?t.range.reverse():t.range=Rr(t),t.scale.range(t.range)}Er(t)}function Er(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 Rr(t){const e=t.scale.domain().length+jr(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 Cr(t,e,n){return Nr(t,void 0===n?void 0:[{hint:n}],{...e})}function Nr(t,n=[],r={}){const o=function(t,e,{type:n,domain:r,range:o,scheme:i,pivot:a,projection:l}){if(n=Br(n),"fx"===t||"fy"===t)return"band";"x"!==t&&"y"!==t||null==l||(n=Ir);for(const t of e){const e=Br(t.type);if(void 0!==e)if(void 0===n)n=e;else if(n!==e)throw new Error(`scale incompatible with channel: ${n} !== ${e}`)}if(n===Ir)return;if(void 0!==n)return n;if(void 0===r&&!e.some((({value:t})=>void 0!==t)))return;const s=ke.get(t);if(s===ge)return"sqrt";if(s===xe||s===ve)return"linear";if(s===we)return"ordinal";const c=(r??o)?.length;if(c<2||c>2)return Pr(s);if(void 0!==r){if(Qt(r))return Pr(s);if(Kt(r))return"utc"}else{const t=e.map((({value:t})=>t)).filter((t=>void 0!==t));if(t.some(Qt))return Pr(s);if(t.some(Kt))return"utc"}if(s===ye){if(null!=a||function(t){return null!=t&&Yn.has(`${t}`.toLowerCase())}(i))return"diverging";if(function(t){return null!=t&&Cn.has(`${t}`.toLowerCase())}(i))return"categorical"}return"linear"}(t,n,r);if(void 0===r.type&&void 0===r.domain&&void 0===r.range&&null==r.interval&&"fx"!==t&&"fy"!==t&&Wr({type:o})){const e=n.map((({value:t})=>t)).filter((t=>void 0!==t));e.some(Kt)?sr(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Tr(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 "${Tr(o)}".`):e.some(te)?sr(`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 "${Tr(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 "${Tr(o)}".`):e.some(ee)&&sr(`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 "${Tr(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 "${Tr(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=qr(n,r,ct);break;case"identity":switch(ke.get(t)){case me:r=qr(n,r,ct);break;case we:r=qr(n,r,Dr)}break;case"utc":case"time":r=qr(n,r,ft)}switch(o){case"diverging":return function(t,n,r){return cr(t,e.scaleDiverging(),hr,n,r)}(t,n,r);case"diverging-sqrt":return function(t,e,n){return ur(t,e,{...n,exponent:.5})}(t,n,r);case"diverging-pow":return ur(t,n,r);case"diverging-log":return function(t,n,{base:r=10,pivot:o=1,domain:i=Qn(n,o<0?s:l),...a}){return cr(t,e.scaleDivergingLog().base(r=+r),dr,n,{domain:i,pivot:o,...a})}(t,n,r);case"diverging-symlog":return fr(t,n,r);case"categorical":case"ordinal":case yr:return vr(t,n,r);case"cyclical":case"sequential":case"linear":return function(t,n,r){return Un(t,e.scaleLinear(),n,r)}(t,n,r);case"sqrt":return function(t,e,n){return Zn(t,e,{...n,exponent:.5})}(t,n,r);case"threshold":return Jn(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=or(n),unknown:s,interpolate:c,reverse:u}){return void 0===r&&(r=void 0!==c?e.quantize(c,i):ke.get(t)===ye?Fn(a,i):void 0),l.length>0&&(l=e.scaleQuantile(l,void 0===r?{length:i}:r).quantiles()),Jn(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=Kn(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):ke.get(t)===ye?Fn(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))))),d(vt(a))<0&&h.reverse(),Jn(t,0,{domain:h,range:r,reverse:c,unknown:l})}(t,n,r);case"pow":return Zn(t,n,r);case"log":return function(t,n,{base:r=10,domain:o=rr(n),...i}){return Un(t,e.scaleLog().base(r),n,{...i,domain:o})}(t,n,r);case"symlog":return function(t,n,{constant:r=1,...o}){return Un(t,e.scaleSymlog().constant(r),n,o)}(t,n,r);case"utc":return function(t,n,r){return mr(t,e.scaleUtc(),n,r)}(t,n,r);case"time":return function(t,n,r){return mr(t,e.scaleTime(),n,r)}(t,n,r);case"point":return function(t,n,{align:r=.5,padding:o=.5,...i}){return xr(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 xr(e.scaleBand().align(r).paddingInner(i).paddingOuter(a),n,l,t)}(t,n,r);case"identity":return function(t){return{type:"identity",scale:(n=ke.get(t),n===me||n===ge||n===ve||n===xe?e.scaleIdentity():t=>t)};var n}(t);case void 0:return;default:throw new Error(`unknown scale type: ${o}`)}}function Tr(t){return"symbol"==typeof t?t.description:t}function Br(t){return"string"==typeof t?`${t}`.toLowerCase():t}const Ir={toString:()=>"projection"};function Pr(t){switch(t){case me:return"point";case ye:return yr;default:return"ordinal"}}function Wr({type:t}){return"ordinal"===t||"point"===t||"band"===t||t===yr}function jr({type:t}){return"threshold"===t}function Fr(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 qr(t,{domain:e,...n},r){for(const n of t)void 0!==n.value&&(void 0===e&&(e=n.value?.domain),n.value=r(n.value));return{domain:void 0===e?e:r(e),...n}}function Dr(t){return wt(t,Oe)}function Yr({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:bt(n),...void 0!==r&&{range:bt(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 _r(t,{fx:n,fy:r}){const o=Nt(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 Gr(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 Xr=new Map([["top",Jr],["right",to],["bottom",Qr],["left",Kr],["top-left",eo(Jr,Kr)],["top-right",eo(Jr,to)],["bottom-left",eo(Qr,Kr)],["bottom-right",eo(Qr,to)],["top-empty",function(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;const i=Vr(e,r);if(i>0)return Zr(t,n,e[i-1])}],["right-empty",function(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;const i=Vr(e,n);if(i<e.length-1)return Zr(t,e[i+1],r)}],["bottom-empty",function(t,{y:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;const i=Vr(e,r);if(i<e.length-1)return Zr(t,n,e[i+1])}],["left-empty",function(t,{x:e},{x:n,y:r,empty:o}){if(o)return!1;if(!e)return;const i=Vr(e,n);if(i>0)return Zr(t,e[i-1],r)}],["empty",function(t,e,{empty:n}){return n}]]);const Hr=new WeakMap;function Ur(t){let n=Hr.get(t);return n||Hr.set(t,n=new e.InternMap(wt(t,((t,e)=>[t,e])))),n}function Vr(t,e){return Ur(t).get(e)}function Zr(t,e,n){return function(t,e,n){return e=Pt(e),n=Pt(n),t.find((t=>Object.is(Pt(t.x),e)&&Object.is(Pt(t.y),n)))}(t,e,n)?.empty}function Jr(t,{y:e},{y:n}){return!e||0===Vr(e,n)}function Qr(t,{y:e},{y:n}){return!e||Vr(e,n)===e.length-1}function Kr(t,{x:e},{x:n}){return!e||0===Vr(e,n)}function to(t,{x:e},{x:n}){return!e||Vr(e,n)===e.length-1}function eo(t,e){return function(){return t.apply(null,arguments)&&e.apply(null,arguments)}}function no(t,{channels:{fx:e,fy:n},groups:r}){return e&&n?t.map((({x:t,y:e})=>r.get(t)?.get(e)??[])):e?t.map((({x:t})=>r.get(t)??[])):t.map((({y:t})=>r.get(t)??[]))}const ro=Math.PI,oo=2*ro,io=.618;function ao({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(At(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}=lo(t));const{width:f,height:h,marginLeft:d,marginRight:p,marginTop:m,marginBottom:y}=l,g=f-d-p-a-o,v=h-m-y-r-i;if(t=t?.({width:g,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-y);let x,w=d+a,b=m+r;if(null!=c){const[[n,r],[o,i]]=e.geoPath(t).bounds(c),a=Math.min(g/(o-n),v/(i-r));a>0?(w-=(a*(n+o)-g)/2,b-=(a*(r+i)-v)/2,x=e.geoTransform({point(t,e){this.stream.point(t*a+w,e*a+b)}})):sr("Warning: the projection could not be fit to the specified domain; using the default scale.")}return x??=0===w&&0===b?uo():e.geoTransform({point(t,e){this.stream.point(t+w,e+b)}}),{stream:e=>t.stream(x.stream(u(e)))}}function lo(t){switch(`${t}`.toLowerCase()){case"albers-usa":return so(e.geoAlbersUsa,.7463,.4673);case"albers":return co(e.geoAlbers,.7463,.4673);case"azimuthal-equal-area":return so(e.geoAzimuthalEqualArea,4,4);case"azimuthal-equidistant":return so(e.geoAzimuthalEquidistant,oo,oo);case"conic-conformal":return co(e.geoConicConformal,oo,oo);case"conic-equal-area":return co(e.geoConicEqualArea,6.1702,2.9781);case"conic-equidistant":return co(e.geoConicEquidistant,7.312,3.6282);case"equal-earth":return so(e.geoEqualEarth,5.4133,2.6347);case"equirectangular":return so(e.geoEquirectangular,oo,ro);case"gnomonic":return so(e.geoGnomonic,3.4641,3.4641);case"identity":return{type:uo};case"reflect-y":return{type:fo};case"mercator":return so(e.geoMercator,oo,oo);case"orthographic":return so(e.geoOrthographic,2,2);case"stereographic":return so(e.geoStereographic,2,2);case"transverse-mercator":return so(e.geoTransverseMercator,oo,oo);default:throw new Error(`unknown projection type: ${t}`)}}function so(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),null!=r&&(s.scale(Math.min(r/e,o/n)),s.translate([r/2,o/2])),s},aspectRatio:n/e}}function co(t,e,n){const{type:r,aspectRatio:o}=so(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&&null!=o&&a.fitSize([o,i],{type:"Sphere"})),a},aspectRatio:o}}const uo=lt({stream:t=>t}),fo=lt(e.geoTransform({point(t,e){this.stream.point(t,-e)}}));function ho(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])}function po({projection:t}={}){return null!=t&&("function"==typeof t.stream||(At(t)&&(t=t.type),null!=t))}function mo(t,e,{projection:n}){const{x:r,y:o}=t;let i={};return r&&(i.x=r),o&&(i.y=o),i=kn(i,e),n&&"x"===r?.scale&&"y"===o?.scale&&ho("x","y",i,n),r&&(i.x=ct(i.x)),o&&(i.y=ct(i.y)),i}function yo(t){const n=[],r=[],o={scale:"x",value:n},i={scale:"y",value:r},a={point(t,e){n.push(t),r.push(e)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(const n of t.value)e.geoStream(n,a);return[o,i]}function go(t={}){const{document:e=("undefined"!=typeof window?window.document:void 0),clip:n}=t;return{document:e,clip:he(n)}}function vo(t,{document:n}){return e.select(e.creator(t).call(n.documentElement))}const xo=Symbol("unset");function wo(t){return(1===t.length?bo:ko)(t)}function bo(t){let e,n=xo;return r=>(Object.is(n,r)||(n=r,e=t(r)),e)}function ko(t){let e,n;return(...r)=>((n?.length!==r.length||n.some(((t,e)=>!Object.is(t,r[e]))))&&(n=r,e=t(...r)),e)}const $o=wo((t=>new Intl.NumberFormat(t))),Mo=wo(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{month:e}}))),Ao=wo(((t,e)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e&&{weekday:e}})));function Lo(t="en-US"){const e=$o(t);return t=>null==t||isNaN(t)?void 0:e.format(t)}function So(t){return c(t,"Invalid Date")}const zo=function(t="en-US"){const e=Lo(t);return t=>(t instanceof Date?So:"number"==typeof t?e:et)(t)}(),Oo=("undefined"!=typeof window?window.devicePixelRatio>1:"undefined"==typeof it)?0:.5;let Eo=0,Ro=0;function Co(){return"plot-clip-"+ ++Eo}function No(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:y,opacity:g,mixBlendMode:v,imageFilter:x,paintOrder:w,pointerEvents:b,shapeRendering:k,channels:$},{ariaLabel:M,fill:A="currentColor",fillOpacity:L,stroke:S="none",strokeOpacity:z,strokeWidth:O,strokeLinecap:E,strokeLinejoin:R,strokeMiterlimit:C,paintOrder:N}){null===A&&(l=null,s=null),null===S&&(c=null,f=null),le(A)?le(S)||le(l)&&!$?.fill||(S="none"):!le(S)||le(c)&&!$?.stroke||(A="none");const[T,B]=dt(l,A),[I,P]=pt(s,L),[W,j]=dt(c,S),[F,q]=pt(f,z),[D,Y]=pt(g);se(j)||(void 0===u&&(u=O),void 0===d&&(d=E),void 0===h&&(h=R),void 0!==p||/^\s*round\s*$/i.test(h)||(p=C),se(B)||void 0!==w||(w=N));const[_,G]=pt(u);return null!==A&&(t.fill=Vo(B,"currentColor"),t.fillOpacity=Zo(P,1)),null!==S&&(t.stroke=Vo(j,"none"),t.strokeWidth=Zo(G,1),t.strokeOpacity=Zo(q,1),t.strokeLinejoin=Vo(h,"miter"),t.strokeLinecap=Vo(d,"butt"),t.strokeMiterlimit=Zo(p,4),t.strokeDasharray=Vo(m,"none"),t.strokeDashoffset=Vo(y,"0")),t.target=et(a),t.ariaLabel=et(M),t.ariaDescription=et(o),t.ariaHidden=et(i),t.opacity=Zo(Y,1),t.mixBlendMode=Vo(v,"normal"),t.imageFilter=Vo(x,"none"),t.paintOrder=Vo(w,"normal"),t.pointerEvents=Vo(b,"auto"),t.shapeRendering=Vo(k,"auto"),{title:{value:e,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:T,scale:"auto",optional:!0},fillOpacity:{value:I,scale:"auto",optional:!0},stroke:{value:W,scale:"auto",optional:!0},strokeOpacity:{value:F,scale:"auto",optional:!0},strokeWidth:{value:_,optional:!0},opacity:{value:D,scale:"auto",optional:!0}}}function To(t,e){e&&t.text((t=>zo(e[t])))}function Bo(t,e){e&&t.text((([t])=>zo(e[t])))}function Io(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:a,fillOpacity:l,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:h}){r&&Ho(t,"aria-label",(t=>r[t])),a&&Ho(t,"fill",(t=>a[t])),l&&Ho(t,"fill-opacity",(t=>l[t])),s&&Ho(t,"stroke",(t=>s[t])),c&&Ho(t,"stroke-opacity",(t=>c[t])),u&&Ho(t,"stroke-width",(t=>u[t])),f&&Ho(t,"opacity",(t=>f[t])),h&&Xo(t,(t=>h[t]),e),n||function(t,e){e&&t.filter((t=>i(e[t]))).append("title").call(To,e)}(t,o)}function Po(t,{target:e,tip:n},{ariaLabel:r,title:o,fill:a,fillOpacity:l,stroke:s,strokeOpacity:c,strokeWidth:u,opacity:f,href:h}){r&&Ho(t,"aria-label",(([t])=>r[t])),a&&Ho(t,"fill",(([t])=>a[t])),l&&Ho(t,"fill-opacity",(([t])=>l[t])),s&&Ho(t,"stroke",(([t])=>s[t])),c&&Ho(t,"stroke-opacity",(([t])=>c[t])),u&&Ho(t,"stroke-width",(([t])=>u[t])),f&&Ho(t,"opacity",(([t])=>f[t])),h&&Xo(t,(([t])=>h[t]),e),n||function(t,e){e&&t.filter((([t])=>i(e[t]))).append("title").call(Bo,e)}(t,o)}function Wo(t,n,r){const o=e.group(t,(t=>n[t]));return void 0===r&&o.size>1+t.length>>1&&sr("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*jo(t,e,r,o){const{z:i}=r,{z:a}=o,l=function({ariaLabel:t,title:e,fill:n,fillOpacity:r,stroke:o,strokeOpacity:i,strokeWidth:a,opacity:l,href:s},{tip:c}){return[t,c?void 0:e,n,r,o,i,a,l,s].filter((t=>void 0!==t))}(o,r),s=[...e,...l];for(const e of a?Wo(t,a,i):[t]){let t,r;t:for(const o of e){for(const t of s)if(!n(t[o])){r&&r.push(-1);continue t}if(void 0!==t){r.push(o);for(let e=0;e<l.length;++e){if(Pt(l[e][o])!==t[e]){yield r,t=l.map((t=>Pt(t[o]))),r=[o];continue t}}}else r&&(yield r),t=l.map((t=>Pt(t[o]))),r=[o]}r&&(yield r)}}function Fo(t,n,r,o){let i;const{clip:a=o.clip}=n;"frame"===a?(t=vo("svg:g",o).each((function(){this.appendChild(t.node()),t.node=()=>this})),i=qo(o,r)):a&&(i=function(t,n){let r,o;(r=Do.get(n))||Do.set(n,r=new WeakMap);"Sphere"===t.type&&(t=Yo);if(!(o=r.get(t))){const i=Co();e.select(n.ownerSVGElement).append("clipPath").attr("id",i).append("path").attr("d",n.path()(t)),r.set(t,o=`url(#${i})`)}return o}(a,o)),Ho(t,"aria-label",n.ariaLabel),Ho(t,"aria-description",n.ariaDescription),Ho(t,"aria-hidden",n.ariaHidden),Ho(t,"clip-path",i)}const qo=function(t){const n=new WeakMap;return(r,o)=>{let i=n.get(r);if(!i){const a=Co();e.select(r.ownerSVGElement).append("clipPath").attr("id",a).call(t,r,o),n.set(r,i=`url(#${a})`)}return i}}(((t,e,n)=>{const{width:r,height:o,marginLeft:i,marginRight:a,marginTop:l,marginBottom:s}=n;t.append("rect").attr("x",i).attr("y",l).attr("width",r-a-i).attr("height",o-l-s)})),Do=new WeakMap,Yo={type:"Sphere"};function _o(t,e,n,r){Fo(t,e,n,r),Ho(t,"class",e.className),Ho(t,"fill",e.fill),Ho(t,"fill-opacity",e.fillOpacity),Ho(t,"stroke",e.stroke),Ho(t,"stroke-width",e.strokeWidth),Ho(t,"stroke-opacity",e.strokeOpacity),Ho(t,"stroke-linejoin",e.strokeLinejoin),Ho(t,"stroke-linecap",e.strokeLinecap),Ho(t,"stroke-miterlimit",e.strokeMiterlimit),Ho(t,"stroke-dasharray",e.strokeDasharray),Ho(t,"stroke-dashoffset",e.strokeDashoffset),Ho(t,"shape-rendering",e.shapeRendering),Ho(t,"filter",e.imageFilter),Ho(t,"paint-order",e.paintOrder);const{pointerEvents:o=(!1===r.pointerSticky?"none":void 0)}=e;Ho(t,"pointer-events",o)}function Go(t,e){!function(t,e,n){null!=n&&t.style(e,n)}(t,"mix-blend-mode",e.mixBlendMode),Ho(t,"opacity",e.opacity)}function Xo(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 Ho(t,e,n){null!=n&&t.attr(e,n)}function Uo(t,e,{x:n,y:r},o=Oo,i=Oo){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 Vo(t,e){if((t=et(t))!==e)return t}function Zo(t,e){if((t=nt(t))!==e)return t}const Jo=/^-?([_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 Qo(t){if(void 0===t)return"plot-d6a7b5";if(t=`${t}`,!Jo.test(t))throw new Error(`invalid class name: ${t}`);return t}function Ko(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 ti({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]}class ei{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,className:y,clip:g=r?.clip,channels:v,tip:x,render:w}=n;if(this.data=t,this.sort=zt(s)?s:null,this.initializer=Re(n).initializer,this.transform=this.initializer?n.transform:Ee(n).transform,null===o||!1===o?this.facet=null:(this.facet=yt(!0===o?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===V&&"string"==typeof a?[a]:a,this.fy=t===V&&"string"==typeof l?[l]:l),this.facetAnchor=function(t){if(null==t)return null;const e=Xr.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid facet anchor: ${t}`)}(i),e=fe(e),void 0!==v&&(e={...oi(v),...e}),void 0!==r&&(e={...No(this,n,r),...e}),this.channels=Object.fromEntries(Object.entries(e).map((([e,n])=>{if(St(n.value)){const{value:t,label:e=n.label,scale:r=n.scale}=n.value;n={...n,label:e,scale:r,value:t}}if(t===V&&"string"==typeof n.value){const{value:t}=n;n={...n,value:[t]}}return[e,n]})).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=he(g),this.tip=function(t){return!0===t?"xy":!1===t||null==t?null:"string"==typeof t?yt(t,"tip",["x","y","xy"]):t}(x),this.className=et(y),"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")}}null!=w&&(this.render=ri(w,this.render))}initialize(t,n,r){let o=gt(this.data);void 0===t&&null!=o&&(t=[Nt(o)]);const i=t;null!=this.transform&&(({facets:t,data:o}=this.transform(o,t,r)),o=gt(o)),void 0!==t&&(t.original=i);const a=bn(this.channels,o);return null!=this.sort&&function(t,n,r,o,i){const{order:a,reverse:l,reduce:s=!0,limit:c}=i;for(const u in i){if(!ke.has(u))continue;let{value:f,order:h=a,reverse:d=l,reduce:p=s,limit:m=c}=Vt(i[u]);const y=f?.startsWith("-");if(y&&(f=f.slice(1)),h=void 0===h?y!==("width"===f||"height"===f)?En:On:zn(h),null==p||!1===p)continue;const g="fx"===u||"fy"===u?An(n,o[u]):Mn(r,u);if(!g)throw new Error(`missing channel for scale: ${u}`);const v=g.value,[x=0,w=1/0]=Zt(m)?m:m<0?[m]:[0,m];if(null==f)g.domain=()=>{let t=Array.from(new e.InternSet(v));return d&&(t=t.reverse()),0===x&&w===1/0||(t=t.slice(x,w)),t};else{const n="data"===f?t:"height"===f?Ln(r,"y1","y2"):"width"===f?Ln(r,"x1","x2"):Sn(r,f,"y"===f?"y2":"x"===f?"x2":void 0),o=Je(!0===p?"max":p,n);g.domain=()=>{let t=e.rollups(Nt(v),(t=>o.reduceIndex(t,n)),(t=>v[t]));return h&&t.sort(h),d&&t.reverse(),0===x&&w===1/0||(t=t.slice(x,w)),t.map(rt)}}}}(o,t,a,n,this.sort),{data:o,facets:t,channels:a}}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){for(const r in t)if("x"===t[r].scale&&/^x|x$/.test(r)){const o=r.replace(/^x|x$/,"y");o in t&&"y"===t[o].scale&&ho(r,o,e,n.projection)}}scale(t,e,n){const r=kn(t,e);return n.projection&&this.project(t,r,n),r}}function ni(...t){return t.plot=ei.prototype.plot,t}function ri(t,e){if(null==t)return null===e?void 0:e;if(null==e)return null===t?void 0:t;if("function"!=typeof t)throw new TypeError(`invalid render transform: ${t}`);if("function"!=typeof e)throw new TypeError(`invalid render transform: ${e}`);return function(n,r,o,i,a,l){return t.call(this,n,r,o,i,a,((t,n,r,o,i)=>e.call(this,t,n,r,o,i,l)))}}function oi(t){return Object.fromEntries(Object.entries(fe(t)).map((([t,e])=>(void 0===(e="string"==typeof e?{value:e,label:t}:Vt(e)).filter&&null==e.scale&&(e={...e,filter:null}),[t,e]))))}function ii(t,e){return!0===t?.tip?{...t,tip:e}:At(t?.tip)&&void 0===t.tip.pointer?{...t,tip:{...t.tip,pointer:e}}:t}function ai({x:t,y:n,fy:r,fx:o},{projection:i,aspectRatio:a},{width:l,marginTopDefault:s,marginRightDefault:c,marginBottomDefault:u,marginLeftDefault:f}){const h=r&&r.scale.domain().length||1,d=function(t){if("function"==typeof t?.stream)return io;if(At(t)){let n,r;if(({domain:n,type:t,...r}=t),null!=n&&null!=t){const o="string"==typeof t?lo(t).type:t,[[i,a],[l,s]]=e.geoPath(o({...r,width:100,height:100})).bounds(n),c=(s-a)/(l-i);return c&&isFinite(c)?c<.2?.2:c>5?5:c:io}}if(null!=t){if("function"!=typeof t){const{aspectRatio:e}=lo(t);if(e)return e}return io}}(i);if(d){const t=(1.1*h-.1)/(1.1*(o?o.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=n?Wr(n)?n.scale.domain().length||1:Math.max(7,17/h):1;if(null!=a){if(a=+a,!(isFinite(a)&&a>0))throw new Error(`invalid aspectRatio: ${a}`);const e=li("y",n)/(li("x",t)*a),i=o?o.scale.bandwidth():1,h=r?r.scale.bandwidth():1;return(e*(i*(l-f-c)-t.insetLeft-t.insetRight)+n.insetTop+n.insetBottom)/h+s+u}return!(!n&&!r)*Math.max(1,Math.min(60,p*h))*20+30*!!o+60}function li(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))}const si=new WeakMap;function ci(t,n,{x:r,y:o,px:i,py:a,maxRadius:l=40,channels:s,render:c,...u}={}){return l=+l,null!=i&&(r??=null,s={...s,px:{value:i,scale:"x"}}),null!=a&&(o??=null,s={...s,py:{value:a,scale:"y"}}),{x:r,y:o,channels:s,...u,render:ri((function(r,o,i,a,s,c){const u=(s={...s,pointerSticky:!1}).ownerSVGElement,{data:f}=s.getMarkState(this);let h=si.get(u);h||si.set(u,h={sticky:!1,roots:[],renders:[]});let d=h.renders.push(N)-1;const{x:p,y:m,fx:y,fy:g}=o;let v=y?y(r.fx)-a.marginLeft:0,x=g?g(r.fy)-a.marginTop:0;p?.bandwidth&&(v+=p.bandwidth()/2),m?.bandwidth&&(x+=m.bandwidth()/2);const w=null!=r.fi;let b;if(w){let t=h.facetStates;t||(h.facetStates=t=new Map),b=t.get(this),b||t.set(this,b=new Map)}const[k,$]=ti(this,a),{px:M,py:A}=i,L=M?t=>M[t]:di(i,k),S=A?t=>A[t]:pi(i,$);let z,O,E,R;function C(t,e){if(w){if(R&&(R=cancelAnimationFrame(R)),null!=t)return b.set(r.fi,e),void(R=requestAnimationFrame((()=>{R=null;for(const[n,o]of b)if(o<e||o===e&&n<r.fi){t=null;break}N(t)})));b.delete(r.fi)}N(t)}function N(t){if(z===t&&E===h.sticky)return;z=t,E=s.pointerSticky=h.sticky;const e=null==z?[]:[z];w&&(e.fx=r.fx,e.fy=r.fy,e.fi=r.fi);const n=c(e,o,i,a,s);if(O){if(w){const t=O.parentNode,e=O.getAttribute("transform"),r=n.getAttribute("transform");e?n.setAttribute("transform",e):n.removeAttribute("transform"),r?t.setAttribute("transform",r):t.removeAttribute("transform"),n.removeAttribute("aria-label"),n.removeAttribute("aria-description"),n.removeAttribute("aria-hidden")}O.replaceWith(n)}if(h.roots[d]=O=n,!(null==z&&b?.size>1)){const t=null==z?null:F(f)?f[z]:f.get(z);s.dispatchValue(t)}return n}function T(o){if(h.sticky||"mouse"===o.pointerType&&1===o.buttons)return;let[i,s]=e.pointer(o);i-=v,s-=x;const c=i<a.marginLeft||i>a.width-a.marginRight?1:t,u=s<a.marginTop||s>a.height-a.marginBottom?1:n;let f=null,d=l*l;for(const t of r){const e=c*(L(t)-i),n=u*(S(t)-s),r=e*e+n*n;r<=d&&(f=t,d=r)}if(null!=f&&(1!==t||1!==n)){const t=L(f)-i,e=S(f)-s;d=t*t+e*e}C(f,d)}return u.addEventListener("pointerenter",T),u.addEventListener("pointermove",T),u.addEventListener("pointerdown",(function(t){"mouse"===t.pointerType&&null!=z&&(h.sticky&&h.roots.some((e=>e?.contains(t.target)))||(h.sticky?(h.sticky=!1,h.renders.forEach((t=>t(null)))):(h.sticky=!0,N(z)),t.stopImmediatePropagation()))})),u.addEventListener("pointerleave",(function(t){"mouse"===t.pointerType&&(h.sticky||C(null))})),N(null)}),c)}}function ui(t){return ci(1,1,t)}function fi(t){return ci(1,.01,t)}function hi(t){return ci(.01,1,t)}function di({x1:t,x2:e,x:n=t},r){return t&&e?n=>(t[n]+e[n])/2:n?t=>n[t]:()=>r}function pi({y1:t,y2:e,y:n=t},r){return t&&e?n=>(t[n]+e[n])/2:n?t=>n[t]:()=>r}function mi(t){return Wr(t)&&void 0===t.interval?void 0:"tabular-nums"}const yi=Math.PI/180;function gi(t,{marker:e,markerStart:n=e,markerMid:r=e,markerEnd:o=e}={}){t.markerStart=vi(n),t.markerMid=vi(r),t.markerEnd=vi(o)}function vi(t){if(null==t||!1===t)return null;if(!0===t)return bi;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return xi("auto");case"arrow-reverse":return xi("auto-start-reverse");case"dot":return wi;case"circle":case"circle-fill":return bi;case"circle-stroke":return ki;case"tick":return $i("auto");case"tick-x":return $i(90);case"tick-y":return $i(0)}throw new Error(`invalid marker: ${t}`)}function xi(t){return(e,n)=>vo("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",e).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 wi(t,e){return vo("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 bi(t,e){return vo("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call((t=>t.append("circle").attr("r",3))).node()}function ki(t,e){return vo("svg:marker",e).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call((t=>t.append("circle").attr("r",3))).node()}function $i(t){return(e,n)=>vo("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",e).call((t=>t.append("path").attr("d","M0,-3v6"))).node()}let Mi=0;function Ai(t,e,{stroke:n},r){return Oi(t,e,n&&(t=>n[t]),null,r)}function Li(t,e,{stroke:n,z:r},o){return Oi(t,e,n&&(([t])=>n[t]),r,o)}const Si=1,zi=2;function Oi(t,{markerStart:e,markerMid:n,markerEnd:r,stroke:o},i=()=>o,a,l){if(!e&&!n&&!r)return;const s=new Map,c=a&&function(t,e){const n=new Uint8Array(e.length),r=t.data().filter((t=>t.length>1)),o=r.length;for(let t=0,i=xo;t<o;++t){const o=r[t];if(o.length>1){const t=o[0];i!==(i=Pt(e[t]))&&(n[t]|=Si)}}for(let t=o-1,i=xo;t>=0;--t){const o=r[t];if(o.length>1){const t=o[0];i!==(i=Pt(e[t]))&&(n[t]|=zi)}}return([t])=>n[t]}(t,a);function u(t,e,n){return function(r){if(n&&!n(r))return;const o=i(r);let a=s.get(e);a||s.set(e,a=new Map);let c=a.get(o);if(!c){const t=this.parentNode.insertBefore(e(o,l),this),n="plot-marker-"+ ++Mi;t.setAttribute("id",n),a.set(o,c=`url(#${n})`)}this.setAttribute(t,c)}}e&&t.each(u("marker-start",e,c&&(t=>c(t)&Si))),n&&c&&t.each(u("marker-start",n,(t=>!(c(t)&Si)))),n&&t.each(u("marker-mid",n)),r&&t.each(u("marker-end",r,c&&(t=>c(t)&zi)))}function Ei({inset:t,insetLeft:e,insetRight:n,...r}={}){return[e,n]=Ci(t,e,n),{inset:t,insetLeft:e,insetRight:n,...r}}function Ri({inset:t,insetTop:e,insetBottom:n,...r}={}){return[e,n]=Ci(t,e,n),{inset:t,insetTop:e,insetBottom:n,...r}}function Ci(t,e,n){return void 0===t&&void 0===e&&void 0===n?Oo?[1,0]:[.5,.5]:[e,n]}function Ni(t,{interval:e}){return(t={...Vt(t)}).interval=Gt(void 0===t.interval?e:t.interval),t}function Ti(t,e,n,r){const{[t]:o,[`${t}1`]:i,[`${t}2`]:a}=n,{value:l,interval:s}=Ni(o,n);if(null==l||null==s&&!r)return n;const c=qt(o);if(null==s){let e;const o={transform:t=>e||(e=_(t,l)),label:c};return{...n,[t]:void 0,[`${t}1`]:void 0===i?o:i,[`${t}2`]:void 0!==a||i===a&&r?a:o}}let u,f;function h(t){return void 0!==f&&t===u?f:f=wt(_(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 Bi(t,e,n){const{[t]:r}=n,{value:o,interval:i}=Ni(r,n);return null==o||null==i?n:e({...n,[t]:{label:qt(r),transform:t=>{const e=wt(_(t,o),(t=>i.floor(t))),n=e.map((t=>i.offset(t)));return e.map(Kt(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 Ii(t={}){return Ti("x",Ei,t,!0)}function Pi(t={}){return Ti("y",Ri,t,!0)}function Wi(t={}){return Ti("x",Ei,t)}function ji(t={}){return Ti("y",Ri,t)}function Fi(t={}){return Bi("x",Ei,t)}function qi(t={}){return Bi("y",Ri,t)}const Di={ariaLabel:"rule",fill:null,stroke:"currentColor"};class Yi extends ei{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}},ii(e,"x"),Di),this.insetTop=nt(a),this.insetBottom=nt(l),gi(this,e)}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:y,insetBottom:g}=this;return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,{x:l&&i},Oo,0).call((e=>e.selectAll().data(t).enter().append("line").call(Go,this).attr("x1",l?t=>l[t]:(p+u-d)/2).attr("x2",l?t=>l[t]:(p+u-d)/2).attr("y1",s&&!Fr(a)?t=>s[t]+y:h+y).attr("y2",c&&!Fr(a)?a.bandwidth?t=>c[t]+a.bandwidth()-g:t=>c[t]-g:f-m-g).call(Io,this,n).call(Ai,this,n,o))).node()}}class _i extends ei{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}},ii(e,"y"),Di),this.insetRight=nt(a),this.insetLeft=nt(l),gi(this,e)}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:y,insetRight:g}=this;return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,{y:l&&a},0,Oo).call((e=>e.selectAll().data(t).enter().append("line").call(Go,this).attr("x1",s&&!Fr(i)?t=>s[t]+y:p+y).attr("x2",c&&!Fr(i)?i.bandwidth?t=>c[t]+i.bandwidth()-g:t=>c[t]-g:u-d-g).attr("y1",l?t=>l[t]:(h+f-m)/2).attr("y2",l?t=>l[t]:(h+f-m)/2).call(Io,this,n).call(Ai,this,n,o))).node()}}function Gi(t,e){let{x:n=Q,y:r,y1:o,y2:i,...a}=ji(e);return[o,i]=Hi(r,o,i),new Yi(t,{...a,x:n,y1:o,y2:i})}function Xi(t,e){let{y:n=Q,x:r,x1:o,x2:i,...a}=Wi(e);return[o,i]=Hi(r,o,i),new _i(t,{...a,y:n,x1:o,x2:i})}function Hi(t,e,n){if(null==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 Ui(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 Vi={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"};class Zi extends ei{constructor(t,e={}){const{x:n,y:r,text:o=(Zt(t)&&Jt(t)?Q:J),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:y,fontWeight:g,rotate:v}=e,[x,w]=pt(v,0),[b,k]=function(t){return null==t||"number"==typeof t?[void 0,t]:"string"!=typeof t?[t,void 0]:(t=t.trim().toLowerCase(),ra.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}(p);var $;if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},fontSize:{value:b,optional:!0},rotate:{value:($=x,null==$?null:{transform:t=>_(t,$,Float64Array),label:qt($)}),optional:!0},text:{value:o,filter:i,optional:!0}},e,Vi),this.rotate=w,this.textAnchor=Vo(l,"middle"),this.lineAnchor=yt(s,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+c,this.lineWidth=+u,this.textOverflow=Ji(f),this.monospace=!!h,this.fontFamily=et(d),this.fontSize=k,this.fontStyle=et(m),this.fontVariant=et(y),this.fontWeight=et(g),this.frameAnchor=ue(a),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=sa(this),this.clipLine=ca(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]=ti(this,r);return vo("svg:g",o).call(_o,this,r,o).call(na,this,u,r).call(Uo,this,{x:l&&i,y:s&&a}).call((e=>e.selectAll().data(t).enter().append("text").call(Go,this).call(Qi,this,u,f).attr("transform",Ui`translate(${l?t=>l[t]:p},${s?t=>s[t]:m})${c?t=>` rotate(${c[t]})`:d?` rotate(${d})`:""}`).call(Ho,"font-size",h&&(t=>h[t])).call(Io,this,n))).node()}}function Ji(t){return null==t?null:yt(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function Qi(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(zo(r[t])??"").map(c),u=n.length,f="top"===i?.71:"bottom"===i?1-u:(164-100*u)/200;if(u>1){let t=0;for(let r=0;r<u;++r){if(++t,!n[r])continue;const o=this.ownerDocument.createElementNS(e.namespaces.svg,"tspan");o.setAttribute("x",0),r===t-1?o.setAttribute("y",(f+r)*a+"em"):o.setAttribute("dy",t*a+"em"),o.textContent=n[r],this.appendChild(o),t=0}}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 Ki(t,{x:e,y:n,...r}={}){return void 0===r.frameAnchor&&([e,n]=Et(e,n)),new Zi(t,{...r,x:e,y:n})}function ta(t,{x:e=Q,...n}={}){return new Zi(t,qi({...n,x:e}))}function ea(t,{y:e=Q,...n}={}){return new Zi(t,Fi({...n,y:e}))}function na(t,e,n){Ho(t,"text-anchor",e.textAnchor),Ho(t,"font-family",e.fontFamily),Ho(t,"font-size",e.fontSize),Ho(t,"font-style",e.fontStyle),Ho(t,"font-variant",void 0===e.fontVariant?function(t){return t&&(ne(t)||Kt(t))?"tabular-nums":void 0}(n):e.fontVariant),Ho(t,"font-weight",e.fontWeight)}const ra=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function oa(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"":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]?"-":"")),o=a),s?(r.push(t.slice(o,l)),o=void 0):i=l;return r}const ia={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 aa(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=ya(t,o))r+=ia[t[o]]??(va(t,o)?120:ia.e);return r}function la(t,e=0,n=t.length){let r=0;for(let o=e;o<n;o=ya(t,o))r+=va(t,o)?126:63;return r}function sa({monospace:t,lineWidth:e,textOverflow:n}){if(null!=n||e==1/0)return t=>t.split(/\r\n?|\n/g);const r=t?la:aa,o=100*e;return t=>oa(t,o,r)}function ca({monospace:t,lineWidth:e,textOverflow:n}){if(null==n||e==1/0)return t=>t;const r=t?la:aa,o=100*e;switch(n){case"clip-start":return t=>da(t,o,r,"");case"clip-end":return t=>ha(t,o,r,"");case"ellipsis-start":return t=>da(t,o,r,ua);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]=fa(t,e/2,n,i),[s]=fa(t,o-e/2-l+i,n,-i);return s<0?r:t.slice(0,a).trimEnd()+r+t.slice(ya(t,s)).trimStart()}(t,o,r,ua);case"ellipsis-end":return t=>ha(t,o,r,ua)}}const ua="…";function fa(t,e,n,r){const o=[];let i=0;for(let a=0,l=0,s=t.length;a<s;a=l){l=ya(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 ha(t,e,n,r){t=t.trim();const o=n(r),[i]=fa(t,e,n,o);return i<0?t:t.slice(0,i).trimEnd()+r}function da(t,e,n,r){const o=n(t=t.trim());if(o<=e)return t;const i=n(r),[a]=fa(t,o-e+i,n,-i);return a<0?r:r+t.slice(ya(t,a)).trimStart()}const pa=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,ma=/\p{Extended_Pictographic}/uy;function ya(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!ga(t,e)&&(pa.lastIndex=e,pa.test(t))}(t,e)&&(e=pa.lastIndex),function(t,e){return 8205===t.charCodeAt(e)}(t,e)?ya(t,e+1):e}function ga(t,e){return t.charCodeAt(e)<128}function va(t,e){return!ga(t,e)&&(ma.lastIndex=e,ma.test(t))}const xa={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},wa=3.5,ba=5*wa,ka={draw(t,e,n){const r=e*n/ba;t.moveTo(0,0),t.lineTo(0,-e),t.moveTo(-r,r-e),t.lineTo(0,-e),t.lineTo(r,r-e)}},$a={draw(t,e,n){t.moveTo(-n,0),t.lineTo(0,-e),t.lineTo(n,0)}},Ma=new Map([["arrow",ka],["spike",$a]]);class Aa extends ei{constructor(t,e={}){const{x:n,y:r,r:o=wa,length:i,rotate:a,shape:l=ka,anchor:s="middle",frameAnchor:c}=e,[u,f]=pt(i,12),[h,d]=pt(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,xa),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=Ma.get(`${t}`.toLowerCase());if(e)return e;throw new Error(`invalid shape: ${t}`)}(l),this.anchor=yt(s,"anchor",["start","middle","end"]),this.frameAnchor=ue(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:y}=this,[g,v]=ti(this,o);return vo("svg:g",i).call(_o,this,o,i).call(Uo,this,{x:s&&a,y:c&&l}).call((n=>n.selectAll().data(t).enter().append("path").call(Go,this).attr("transform",Ui`translate(${s?t=>s[t]:g},${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],y),n}:(()=>{const t=e.pathRound();return m.draw(t,h,y),t})()).call(Io,this,r))).node()}}function La(t,e={}){let{x:n,y:r,...o}=e;return void 0===e.frameAnchor&&([n,r]=Et(n,r)),new Aa(t,{...o,x:n,y:r})}function Sa(t,e={}){const{x:n=Q,...r}=e;return new Aa(t,{...r,x:n})}function za(t,e={}){const{y:n=Q,...r}=e;return new Aa(t,{...r,y:n})}function Oa(t,e){return arguments.length<2&&!Zt(t)&&(e=t,t=null),void 0===e&&(e={}),[t,e]}function Ea({anchor:t}={},e){return void 0===t?e[0]:yt(t,"anchor",e)}function Ra(t){return Ea(t,["left","right"])}function Ca(t){return Ea(t,["right","left"])}function Na(t){return Ea(t,["bottom","top"])}function Ta(t){return Ea(t,["top","bottom"])}function Ba(){const[t,e]=Oa(...arguments);return ja("y",Ra(e),t,e)}function Ia(){const[t,e]=Oa(...arguments);return ja("fy",Ca(e),t,e)}function Pa(){const[t,e]=Oa(...arguments);return Fa("x",Na(e),t,e)}function Wa(){const[t,e]=Oa(...arguments);return Fa("fx",Ta(e),t,e)}function ja(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:y,x:g,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:$,labelAnchor:M,labelArrow:A,labelOffset:L,ariaLabel:S=`${t}-axis`,...z}){return p=nt(p),m=nt(m),y=nt(y),void 0!==M&&(M=yt(M,"labelAnchor",["center","top","bottom"])),A=il(A),ni(p&&!le(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),ariaLabel:p,...m}){return Va(za,t,n,{ariaLabel:`${p} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:o,strokeLinejoin:i,facetAnchor:a,frameAnchor:l,y:d,...m,dx:"left"===e?+h-Oo+ +u:+h+Oo-f,anchor:"start",length:s,shape:"left"===e?el:nl})}(t,e,n,{stroke:i,strokeOpacity:a,strokeWidth:l,tickSize:p,tickPadding:m,tickRotate:y,x:g,ariaLabel:S,...z}):null,le(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*yi):0),text:s,textAnchor:c=(Math.abs(a)>60?"middle":"left"===e?"end":"start"),lineAnchor:u=(a>60?"top":a<-60?"bottom":"middle"),fontVariant:f,inset:h=0,insetLeft:d=h,insetRight:p=h,dx:m=0,ariaLabel:y,y:g=("y"===t?void 0:null),...v}){return Va(ea,t,n,{ariaLabel:`${y} tick label`},{facetAnchor:r,frameAnchor:o,text:s,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:a,y:g,...v,dx:"left"===e?+m-i-l+ +d:+m+ +i+ +l-p},(function(t,n,r,o,i){void 0===f&&(this.fontVariant=rl(t)),void 0===s&&(i.text=Za(t,n,r,o,e))}))}(t,e,n,{fill:s,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:x,marginRight:w,marginBottom:b,marginLeft:k,ariaLabel:S,...z}),le(s)||null===$?null:Ki([],Ua({fill:s,fillOpacity:c,...z},(function(n,r,o,i,a){const l=i[t],{marginTop:s,marginRight:c,marginBottom:u,marginLeft:f}="y"===t&&a.inset||a,h=M??(l.bandwidth?"center":"top"),d=L??("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=`${S} label`,{facets:[[0]],channels:{text:{value:[ol(t,l,{anchor:e,label:$,labelAnchor:h,labelArrow:A})]}}}}))))}function Fa(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:y,y:g,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,labelArrow:A,labelOffset:L,ariaLabel:S=`${t}-axis`,...z}){return p=nt(p),m=nt(m),y=nt(y),void 0!==M&&(M=yt(M,"labelAnchor",["center","left","right"])),A=il(A),ni(p&&!le(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),ariaLabel:p,...m}){return Va(Sa,t,n,{ariaLabel:`${p} tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:i,strokeLinecap:o,facetAnchor:a,frameAnchor:l,x:d,...m,dy:"bottom"===e?+h-Oo-f:+h+Oo+ +u,anchor:"start",length:s,shape:"bottom"===e?Ka:tl})}(t,e,n,{stroke:i,strokeOpacity:a,strokeWidth:l,tickSize:p,tickPadding:m,tickRotate:y,y:g,ariaLabel:S,...z}):null,le(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*yi):0),text:s,textAnchor:c=(Math.abs(a)>=10?a<0^"bottom"===e?"start":"end":"middle"),lineAnchor:u=(Math.abs(a)>=10?"middle":"bottom"===e?"top":"bottom"),fontVariant:f,inset:h=0,insetTop:d=h,insetBottom:p=h,dy:m=0,x:y=("x"===t?void 0:null),ariaLabel:g,...v}){return Va(ta,t,n,{ariaLabel:`${g} tick label`},{facetAnchor:r,frameAnchor:o,text:void 0===s?null:s,textAnchor:c,lineAnchor:u,fontVariant:f,rotate:a,x:y,...v,dy:"bottom"===e?+m+ +i+ +l-p:+m-i-l+ +d},(function(t,n,r,o,i){void 0===f&&(this.fontVariant=rl(t)),void 0===s&&(i.text=Za(t,n,r,o,e))}))}(t,e,n,{fill:s,fillOpacity:c,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:x,marginRight:w,marginBottom:b,marginLeft:k,ariaLabel:S,...z}),le(s)||null===$?null:Ki([],Ua({fill:s,fillOpacity:c,...z},(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=`${S} label`,{facets:[[0]],channels:{text:{value:[ol(t,l,{anchor:e,label:$,labelAnchor:h,labelArrow:A})]}}}}))))}function qa(){const[t,e]=Oa(...arguments);return Ga("y",Ra(e),t,e)}function Da(){const[t,e]=Oa(...arguments);return Ga("fy",Ca(e),t,e)}function Ya(){const[t,e]=Oa(...arguments);return Xa("x",Na(e),t,e)}function _a(){const[t,e]=Oa(...arguments);return Xa("fx",Ta(e),t,e)}function Ga(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),ariaLabel:l=`${t}-grid`,ariaHidden:s=!0,...c}){return Va(Xi,t,n,{ariaLabel:l,ariaHidden:s},{y:r,x1:i,x2:a,...Ha(c)})}function Xa(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),ariaLabel:l=`${t}-grid`,ariaHidden:s=!0,...c}){return Va(Gi,t,n,{ariaLabel:l,ariaHidden:s},{x:r,y1:i,y2:a,...Ha(c)})}function Ha({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 Ua({fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:a,monospace:l,pointerEvents:s,shapeRendering:c,clip:u=!1},f){return[,t]=dt(t),[,e]=pt(e),{facet:"super",x:null,y:null,fill:t,fillOpacity:e,fontFamily:n,fontSize:r,fontStyle:o,fontVariant:i,fontWeight:a,monospace:l,pointerEvents:s,shapeRendering:c,clip:u,initializer:f}}function Va(t,n,r,o,i,a){let l;const s=Re(i).initializer,c=t(r,Re({...i,initializer:function(t,r,o,s,c,u){const f=null==t&&("fx"===n||"fy"===n),{[n]:h}=s;if(!h)throw new Error(`missing scale: ${n}`);const d=h.domain();let{interval:p,ticks:m,tickFormat:y,tickSpacing:g=("x"===n?80:35)}=i;if("string"==typeof m&&al(h)&&(p=m,m=void 0),void 0===m&&(m=Ht(p,h.type)??function(t,n){const[r,o]=e.extent(t.range());return(o-r)/n}(h,g)),null==t){if(Zt(m))t=vt(m);else if(Ut(m))t=Qa(m,...e.extent(d));else if(h.interval){let n=h.interval;if(h.ticks){const[r,o]=e.extent(d);n=T(n,(o-r)/n[A]/m)??n,t=Qa(n,r,o)}else{n=T(n,(t=d).length/m)??n,n!==h.interval&&(t=Qa(n,...e.extent(t)))}if(n===h.interval){const e=Math.round(t.length/m);e>1&&(t=t.filter(((t,n)=>n%e==0)))}}else t=h.ticks?h.ticks(m):d;if(!h.ticks&&t.length&&t!==d){const r=new e.InternSet(d);(t=t.filter((t=>r.has(t)))).length||sr(`Warning: the ${n}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}"y"===n||"x"===n?r=[Nt(t)]:l[n]={scale:n,value:Q}}a?.call(this,h,t,m,y,l);const v=Object.fromEntries(Object.entries(l).map((([e,n])=>[e,{...n,value:_(t,n.value)}])));return f&&(r=u.filterFacets(t,v)),{data:t,facets:r,channels:v}}},s));return null==r?(l=c.channels,c.channels={}):l={},void 0!==o&&Object.assign(c,o),void 0===c.clip&&(c.clip=!1),c}function Za(t,e,n,r,o){return{value:Ja(t,e,n,r,o)}}function Ja(t,n,r,o,i){return"function"!=typeof o||"log"===t.type&&t.tickFormat?void 0===o&&n&&Kt(n)?I(t.type,n,i)??zo:t.tickFormat?t.tickFormat("number"==typeof r?r:null,o):"string"==typeof o&&t.domain().length>0?(Kt(t.domain())?e.utcFormat:e.format)(o):void 0===o?zo:lt(o):o}function Qa(t,e,n){return t.range(e,t.offset(t.floor(n)))}const Ka={draw(t,e){t.moveTo(0,0),t.lineTo(0,e)}},tl={draw(t,e){t.moveTo(0,0),t.lineTo(0,-e)}},el={draw(t,e){t.moveTo(0,0),t.lineTo(-e,0)}},nl={draw(t,e){t.moveTo(0,0),t.lineTo(e,0)}};function rl(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function ol(t,e,{anchor:n,label:r=e.label,labelAnchor:o,labelArrow:i}={}){if(!(null==r||r.inferred&&al(e)&&/^(date|time|year)$/i.test(r))){if(r=String(r),"auto"===i&&(i=(!e.bandwidth||e.interval)&&!/[↑↓→←]/.test(r)),!i)return r;if(!0===i){const n=Ar(e);n&&(i=/x$/.test(t)||"center"===o?/x$/.test(t)===n<0?"left":"right":n<0?"up":"down")}switch(i){case"left":return`← ${r}`;case"right":return`${r} →`;case"up":return"right"===n?`${r} ↑`:`↑ ${r}`;case"down":return"right"===n?`${r} ↓`:`↓ ${r}`}return r}}function il(t="auto"){return!le(t)&&("boolean"==typeof t?t:yt(t,"labelArrow",["auto","up","right","down","left"]))}function al(t){return Kt(t.domain())}function ll(t,e){if(null==e)return e;const n=t(e);if(!n)throw new Error(`scale not found: ${e}`);return n}function sl(t,e={},n){let{columns:r,tickFormat:o,fontVariant:i=mi(t),swatchSize:a=15,swatchWidth:l=a,swatchHeight:s=a,marginLeft:c=0,className:u,style:f,width:h}=e;const d=go(e);u=Qo(u),o=Ja(t.scale,t.domain,void 0,o);const p=vo("div",d).attr("class",`${u}-swatches ${u}-swatches-${null!=r?"columns":"wrap"}`);let m;return null!=r?(m=`:where(.${u}-swatches-columns .${u}-swatch) {\n display: flex;\n align-items: center;\n break-inside: avoid;\n padding-bottom: 1px;\n}\n:where(.${u}-swatches-columns .${u}-swatch::before) {\n flex-shrink: 0;\n}\n:where(.${u}-swatches-columns .${u}-swatch-label) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}`,p.style("columns",r).selectAll().data(t.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,t,l,s).call((t=>t.append("div").attr("class",`${u}-swatch-label`).attr("title",o).text(o)))):(m=`:where(.${u}-swatches-wrap) {\n display: flex;\n align-items: center;\n min-height: 33px;\n flex-wrap: wrap;\n}\n:where(.${u}-swatches-wrap .${u}-swatch) {\n display: inline-flex;\n align-items: center;\n margin-right: 1em;\n}`,p.selectAll().data(t.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,t,l,s).append((function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))}))),p.call((t=>t.insert("style","*").text(`:where(.${u}-swatches) {\n font-family: system-ui, sans-serif;\n font-size: 10px;\n margin-bottom: 0.5em;\n}\n:where(.${u}-swatch > svg) {\n margin-right: 0.5em;\n overflow: visible;\n}\n${m}`))).style("margin-left",c?+c+"px":null).style("width",void 0===h?null:+h+"px").style("font-variant",Vo(i,"normal")).call(Ko,f).node()}const cl=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:le(n)?"currentColor":"none"),strokeOpacity:i=1,strokeWidth:a=1.5,r:l=4.5,...s}={},c){const[u,f]=dt(n),[h,d]=dt(o),p=ll(c,u),m=ll(c,h),y=l*l*Math.PI;return r=pt(r)[1],i=pt(i)[1],a=pt(a)[1],sl(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,y),r}))))}],["color",fl],["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 fl({type:t,...r,interpolate:hl(i)},{legend:o,...a})}]]);function ul({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 fl(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(!Wr(t)&&!jr(t))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return sl(t,n,((t,n,r,o)=>t.append("svg").attr("width",r).attr("height",o).attr("fill",n.scale).attr("fill-opacity",pt(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=mi(t),round:m=!0,opacity:y,className:g}=n;const v=go(n);g=Qo(g),y=pt(y)[1],null===d&&(d=()=>null);const x=vo("svg",v).attr("class",`${g}-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(`:where(.${g}-ramp) {\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n overflow: visible;\n}\n:where(.${g}-ramp text) {\n white-space: pre;\n}`))).call(Ko,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:A,interpolate:L,scale:S,pivot:z}=t;if(L){const t=void 0===A?L:e.piecewise(1===L.length?ir(L):L,A);w=k(S.copy(),e.quantize(e.interpolateNumber(u,i-s),Math.min(M.length+(void 0!==z),void 0===A?1/0:A.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",y).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,A.length-1]),[u,i-s]),x.append("g").attr("fill-opacity",y).selectAll().data(A).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=wt(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",y).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",S),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",Vo(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 hl(t){const{r:n,g:r,b:o}=e.rgb(t)||e.rgb(0,0,0);return t=>`rgba(${n},${r},${o},${t})`}function dl(t={},e="x"){return kt(t)?t:{...t,[e]:Q}}function pl(t={},e="y"){return $t(t)?t:{...t,[e]:Q}}function ml(t,e){if(1===e.length)return{data:t,facets:e};const n=Ct(t),r=new Uint8Array(n);let o=0;for(const t of e)for(const e of t)r[e]&&++o,r[e]=1;if(0===o)return{data:t,facets:e};const i=(t=bt(t))[Y]=new Uint32Array(n+o);e=e.map((t=>bt(t,Uint32Array)));let a=n;r.fill(0);for(const n of e)for(let e=0,o=n.length;e<o;++e){const o=n[e];r[o]?(n[e]=a,t[a]=t[o],i[a]=o,++a):i[o]=o,r[o]=1}return{data:t,facets:e}}function yl(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{y1:n,y:r=n,x:o,...i}=e,[a,l,s,c]=kl(r,o,"y","x",t,i);return{...a,y1:n,y:l,x1:s,x2:c,x:Dt(s,c)}}function gl(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{x1:n,x:r=n,y:o,...i}=e,[a,l,s,c]=kl(r,o,"x","y",t,i);return{...a,x1:n,x:l,y1:s,y2:c,y:Dt(s,c)}}function vl({x:t,x1:e,x2:n,...r}={}){return r=ii(r,"y"),void 0===e&&void 0===n?yl({x:t,...r}):([e,n]=Ot(t,e,n),{...r,x1:e,x2:n})}function xl({y:t,y1:e,y2:n,...r}={}){return r=ii(r,"x"),void 0===e&&void 0===n?gl({y:t,...r}):([e,n]=Ot(t,e,n),{...r,y1:e,y2:n})}function wl(t){const{offset:e,order:n,reverse:r,...o}=t;return[{offset:e,order:n,reverse:r},o]}const bl={length:!0};function kl(t,n=K,i,a,{offset:l,order:s,reverse:c},u){if(null===n)throw new Error(`stack requires ${a}`);const f=Rt(u),[h,d]=Ft(t),[p,m]=jt(n),[y,g]=jt(n);return p.hint=y.hint=bl,l=function(t){if(null==t)return;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return Ml;case"center":case"silhouette":return Al;case"wiggle":return Ll}throw new Error(`unknown offset: ${t}`)}(l),s=function(t,n,i){if(void 0===t&&n===Ll)return Ol(r);if(null==t)return;if("string"==typeof t){const n=t.startsWith("-"),a=n?o:r;switch((n?t.slice(1):t).toLowerCase()){case"value":case i:return function(t){return(e,n,r)=>(e,n)=>t(r[e],r[n])}(a);case"z":return function(t){return(e,n,r,o)=>(e,n)=>t(o[e],o[n])}(a);case"sum":return function(t){return Cl(t,((t,n,r,o)=>e.groupSort(Nt(t),(t=>e.sum(t,(t=>r[t]))),(t=>o[t]))))}(a);case"appearance":return function(t){return Cl(t,((t,n,r,o)=>e.groupSort(Nt(t),(t=>n[e.greatest(t,(t=>r[t]))]),(t=>o[t]))))}(a);case"inside-out":return Ol(a)}return El(Z(t))}if("function"==typeof t)return(1===t.length?El:Rl)(t);if(F(t))return a=t,Cl(r,(()=>a));var a;throw new Error(`invalid order: ${t}`)}(s,l,a),[Ee(u,((r,o,a)=>{({data:r,facets:o}=ml(r,o));const u=null==t?void 0:d(Yt(_(r,t),a?.[i])),h=_(r,n,Float64Array),p=_(r,f),y=s&&s(r,u,h,p),v=Ct(r),x=m(new Float64Array(v)),w=g(new Float64Array(v)),b=[];for(const t of o){const n=u?Array.from(e.group(t,(t=>u[t])).values()):[t];if(y)for(const t of n)t.sort(y);for(const t of n){let e=0,n=0;c&&t.reverse();for(const r of t){const t=h[r];t<0?e=w[r]=(x[r]=e)+t:t>0?n=w[r]=(x[r]=n)+t:w[r]=x[r]=n}}b.push(n)}return l&&l(b,x,w,p),{data:r,facets:o}})),h,p,y]}function $l(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 Ml(t,e,n){for(const r of t)for(const t of r){const[r,o]=$l(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 Al(t,e,n){for(const r of t){for(const t of r){const[r,o]=$l(t,n);for(const i of t){const t=(o+r)/2;e[i]-=t,n[i]-=t}}Sl(r,e,n)}zl(t,e,n)}function Ll(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)}Sl(i,n,r)}zl(t,n,r)}function Sl(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 zl(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 Ol(t){return Cl(t,((t,n,r,o)=>{const i=Nt(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 c.reverse().concat(s)}))}function El(t){return e=>{const n=_(e,t);return(t,e)=>r(n[t],n[e])}}function Rl(t){return e=>F(e)?(n,r)=>t(e[n],e[r]):(n,r)=>t(e.get(n),e.get(r))}function Cl(t,n){return(r,o,i,a)=>{if(!a)throw new Error("missing channel: z");const l=new e.InternMap(n(r,o,i,a).map(((t,e)=>[t,e])));return(e,n)=>t(l.get(a[e]),l.get(a[n]))}}const Nl={ariaLabel:"rect"};class Tl extends ei{constructor(t,e={}){const{x1:n,y1:r,x2:o,y2:i}=e;super(t,{x1:{value:n,scale:"x",type:null!=n&&null==o?"band":void 0,optional:!0},y1:{value:r,scale:"y",type:null!=r&&null==i?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:i,scale:"y",optional:!0}},e,Nl),Bl(this,e),Il(this,e)}render(t,e,n,r,o){const{x:i,y:a}=e;let{x1:l,y1:s,x2:c,y2:u}=n;const{marginTop:f,marginRight:h,marginBottom:d,marginLeft:p,width:m,height:y}=r,{projection:g}=o,{insetTop:v,insetRight:x,insetBottom:w,insetLeft:b}=this,{rx:k,ry:$,rx1y1:M,rx1y2:A,rx2y1:L,rx2y2:S}=this;(l||c)&&!g&&Fr(i)&&(l=c=null),(s||u)&&!g&&Fr(a)&&(s=u=null);const z=i?.bandwidth?i.bandwidth():0,O=a?.bandwidth?a.bandwidth():0;return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,{},0,0).call((e=>e.selectAll().data(t).enter().call(M||A||L||S?t=>t.append("path").call(Go,this).call(Pl,l&&c?t=>l[t]+(c[t]<l[t]?-x:b):l?t=>l[t]+b:p+b,s&&u?t=>s[t]+(u[t]<s[t]?-w:v):s?t=>s[t]+v:f+v,l&&c?t=>c[t]-(c[t]<l[t]?-b:x):l?t=>l[t]+z-x:m-h-x,s&&u?t=>u[t]-(u[t]<s[t]?-v:w):s?t=>s[t]+O-w:y-d-w,this).call(Io,this,n):t=>t.append("rect").call(Go,this).attr("x",l?c?t=>Math.min(l[t],c[t])+b:t=>l[t]+b:p+b).attr("y",s?u?t=>Math.min(s[t],u[t])+v:t=>s[t]+v:f+v).attr("width",l?c?t=>Math.max(0,Math.abs(c[t]-l[t])+z-b-x):z-b-x:m-h-p-x-b).attr("height",s?u?t=>Math.max(0,Math.abs(s[t]-u[t])+O-v-w):O-v-w:y-f-d-v-w).call(Ho,"rx",k).call(Ho,"ry",$).call(Io,this,n)))).node()}}function Bl(t,{inset:e=0,insetTop:n=e,insetRight:r=e,insetBottom:o=e,insetLeft:i=e}={}){t.insetTop=nt(n),t.insetRight=nt(r),t.insetBottom=nt(o),t.insetLeft=nt(i)}function Il(t,{r:e,rx:n,ry:r,rx1:o=e,ry1:i=e,rx2:a=e,ry2:l=e,rx1y1:s=(void 0!==o?+o:void 0!==i?+i:0),rx1y2:c=(void 0!==o?+o:void 0!==l?+l:0),rx2y1:u=(void 0!==a?+a:void 0!==i?+i:0),rx2y2:f=(void 0!==a?+a:void 0!==l?+l:0)}={}){s||c||u||f?(t.rx1y1=s,t.rx1y2=c,t.rx2y1=u,t.rx2y2=f):(t.rx=Vo(n,"auto"),t.ry=Vo(r,"auto"))}function Pl(t,e,n,r,o,i){const{rx1y1:a,rx1y2:l,rx2y1:s,rx2y2:c}=i;"function"!=typeof e&&(e=lt(e)),"function"!=typeof n&&(n=lt(n)),"function"!=typeof r&&(r=lt(r)),"function"!=typeof o&&(o=lt(o));const u=Math.max(Math.abs(a+s),Math.abs(l+c)),f=Math.max(Math.abs(a+l),Math.abs(s+c));t.attr("d",(t=>{const i=e(t),h=n(t),d=r(t),p=o(t),m=i>d,y=h>p,g=m?d:i,v=m?i:d,x=y?p:h,w=y?h:p,b=Math.min(1,(v-g)/u,(w-x)/f),k=b*(m?y?c:s:y?l:a),$=b*(m?y?l:a:y?c:s),M=b*(m?y?a:l:y?s:c),A=b*(m?y?s:c:y?a:l);return`M${g},${x+jl(k,A)}A${k},${k} 0 0 ${k<0?0:1} ${g+Wl(k,A)},${x}H${v-Wl($,M)}A${$},${$} 0 0 ${$<0?0:1} ${v},${x+jl($,M)}V${w-jl(M,$)}A${M},${M} 0 0 ${M<0?0:1} ${v-Wl(M,$)},${w}H${g+Wl(A,k)}A${A},${A} 0 0 ${A<0?0:1} ${g},${w-jl(A,k)}Z`}))}function Wl(t,e){return e<0?t:Math.abs(t)}function jl(t,e){return e<0?Math.abs(t):t}function Fl(t,e){return new Tl(t,Ii(Pi(e)))}function ql(t,e={}){return Mt(e)||(e={...e,y:J,x2:Q,interval:1}),new Tl(t,vl(Pi(dl(e))))}function Dl(t,e={}){return Mt(e)||(e={...e,x:J,y2:Q,interval:1}),new Tl(t,xl(Ii(pl(e))))}const Yl={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},_l={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class Gl extends ei{constructor(t={}){const{anchor:e=null}=t;super(V,void 0,t,null==e?Yl:_l),this.anchor=mt(e,"anchor",["top","right","bottom","left"]),Bl(this,t),e||Il(this,t)}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}=this,{rx:y,ry:g,rx1y1:v,rx1y2:x,rx2y1:w,rx2y2:b}=this,k=s+m,$=c-a-d,M=i+h,A=u-l-p;return vo(f?"svg:line":v||x||w||b?"svg:path":"svg:rect",o).datum(0).call(_o,this,r,o).call(Go,this).call(Io,this,n).call(Uo,this,{}).call("left"===f?t=>t.attr("x1",k).attr("x2",k).attr("y1",M).attr("y2",A):"right"===f?t=>t.attr("x1",$).attr("x2",$).attr("y1",M).attr("y2",A):"top"===f?t=>t.attr("x1",k).attr("x2",$).attr("y1",M).attr("y2",M):"bottom"===f?t=>t.attr("x1",k).attr("x2",$).attr("y1",A).attr("y2",A):v||x||w||b?t=>t.call(Pl,k,M,$,A,this):t=>t.attr("x",k).attr("y",M).attr("width",$-k).attr("height",A-M).attr("rx",y).attr("ry",g)).node()}}function Xl(t){return new Gl(t)}const Hl={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Ul=new Set(["geometry","href","src","ariaLabel","scales"]);class Vl extends ei{constructor(t,e={}){e.tip&&(e={...e,tip:!1}),void 0===e.title&&Zt(t)&&Jt(t)&&(e={...e,title:Q});const{x:n,y:r,x1:o,x2:i,y1:a,y2:l,anchor:s,preferredAnchor:c="bottom",monospace:u,fontFamily:f=(u?"ui-monospace, monospace":void 0),fontSize:h,fontStyle:d,fontVariant:p,fontWeight:m,lineHeight:y=1,lineWidth:g=20,frameAnchor:v,format:x,textAnchor:w="start",textOverflow:b,textPadding:k=8,title:$,pointerSize:M=12,pathFilter:A="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=e;super(t,{x:{value:null!=o&&null!=i?null:n,scale:"x",optional:!0},y:{value:null!=a&&null!=l?null:r,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:null==i},y1:{value:a,scale:"y",optional:null==l},x2:{value:i,scale:"x",optional:null==o},y2:{value:l,scale:"y",optional:null==a},title:{value:$,optional:!0}},e,Hl),this.anchor=ce(s,"anchor"),this.preferredAnchor=ce(c,"preferredAnchor"),this.frameAnchor=ue(v),this.textAnchor=Vo(w,"middle"),this.textPadding=+k,this.pointerSize=+M,this.pathFilter=et(A),this.lineHeight=+y,this.lineWidth=+g,this.textOverflow=Ji(b),this.monospace=!!u,this.fontFamily=et(f),this.fontSize=nt(h),this.fontStyle=et(d),this.fontVariant=et(p),this.fontWeight=et(m);for(const t in Hl)t in this.channels&&(this[t]=Hl[t]);this.splitLines=sa(this),this.clipLine=ca(this),this.format="string"==typeof x||"function"==typeof x?{title:x}:{...x}}render(t,n,r,o,i){const a=this,{x:l,y:s,fx:c,fy:u}=n,{ownerSVGElement:f,document:h}=i,{anchor:d,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:v,pathFilter:x}=this,{marginTop:w,marginLeft:b}=o,{x1:k,y1:$,x2:M,y2:A,x:L=k??M,y:S=$??A}=r,z=c?c(t.fx)-b:0,O=u?u(t.fy)-w:0,[E,R]=ti(this,o),C=di(r,E),N=pi(r,R),T=p?la:aa,B=T(ua);let I,P;"title"in r?(I=Jl.call(this,{title:r.channels.title},n),P=Kl):(I=Jl.call(this,r.channels,n),P=ts);const W=vo("svg:g",i).call(_o,this,o,i).call(na,this).call(Uo,this,{x:L&&l,y:S&&s}).call((o=>o.selectAll().data(t).enter().append("g").attr("transform",(t=>`translate(${Math.round(C(t))},${Math.round(N(t))})`)).call(Go,this).call((t=>t.append("path").attr("filter",x))).call((o=>o.append("text").each((function(o){const i=e.select(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");const l=P.call(a,o,t,I,n,r);if("string"==typeof l)for(const t of a.splitLines(l))j(i,{value:a.clipLine(t)});else{const t=new Set;for(const e of l){const{label:n=""}=e;n&&t.has(n)||(t.add(n),j(i,e))}}}))))));function j(t,{label:e,value:n,color:r,opacity:o}){e??="",n??="";const i=null!=r||null!=o;let a,l=100*y;const[s]=fa(e,l,T,B);if(s>=0)e=e.slice(0,s).trimEnd()+ua,a=n.trim(),n="";else{(e||!n&&!i)&&(n=" "+n);const[t]=fa(n,l-T(e),T,B);t>=0&&(a=n.trim(),n=n.slice(0,t).trimEnd()+ua)}const c=t.append("tspan").attr("x",0).attr("dy",`${m}em`).text("");e&&c.append("tspan").attr("font-weight","bold").text(e),n&&c.append((()=>h.createTextNode(n))),i&&c.append("tspan").text(" ■").attr("fill",r).attr("fill-opacity",o).style("user-select","none"),a&&c.append("title").text(a)}function F(){const{width:t,height:e}=o.facet??o;W.selectChildren().each((function(n){let{x:r,width:o,height:i}=this.getBBox();o=Math.round(o),i=Math.round(i);let l=d;if(void 0===l){const r=C(n)+z,s=N(n)+O,c=r+o+v+2*g<t,u=r-o-v-2*g>0,f=s+i+v+2*g<e,h=s-i-v-2*g>0;l=c&&u?f&&h?a.preferredAnchor:h?"bottom":"top":f&&h?c?"left":"right":(c||u)&&(f||h)?`${h?"bottom":"top"}-${c?"left":"right"}`:a.preferredAnchor}const s=this.firstChild,c=this.lastChild;if(s.setAttribute("d",function(t,e,n,r,o){const i=r+2*n,a=o+2*n;switch(t){case"middle":return`M${-i/2},${-a/2}h${i}v${a}h${-i}z`;case"top-left":return`M0,0l${e},${e}h${i-e}v${a}h${-i}z`;case"top":return`M0,0l${e/2},${e/2}h${(i-e)/2}v${a}h${-i}v${-a}h${(i-e)/2}z`;case"top-right":return`M0,0l${-e},${e}h${e-i}v${a}h${i}z`;case"right":return`M0,0l${-e/2},${-e/2}v${e/2-a/2}h${-i}v${a}h${i}v${e/2-a/2}z`;case"bottom-left":return`M0,0l${e},${-e}h${i-e}v${-a}h${-i}z`;case"bottom":return`M0,0l${e/2},${-e/2}h${(i-e)/2}v${-a}h${-i}v${a}h${(i-e)/2}z`;case"bottom-right":return`M0,0l${-e},${-e}h${e-i}v${-a}h${i}z`;case"left":return`M0,0l${e/2},${-e/2}v${e/2-a/2}h${i}v${a}h${-i}v${e/2-a/2}z`}}(l,v,g,o,i)),r)for(const t of c.childNodes)t.setAttribute("x",-r);c.setAttribute("y",+function(t,e,n){return/^top(?:-|$)/.test(t)?.94-n:-.29-e*n}(l,c.childNodes.length,m).toFixed(6)+"em"),c.setAttribute("transform",`translate(${function(t,e,n,r,o){switch(t){case"middle":return[-r/2,o/2];case"top-left":return[n,e+n];case"top":return[-r/2,e/2+n];case"top-right":return[-r-n,e+n];case"right":return[-e/2-r-n,o/2];case"bottom-left":return[n,-e-n];case"bottom":return[-r/2,-e/2-n];case"bottom-right":return[-r-n,-e-n];case"left":return[n+e/2,o/2]}}(l,v,g,o,i)})`)})),W.attr("visibility",null)}return t.length&&(W.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(F):"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(F)),W.node()}}function Zl(t,{x:e,y:n,...r}={}){return void 0===r.frameAnchor&&([e,n]=Et(e,n)),new Vl(t,{...r,x:e,y:n})}function Jl(t,n){const r={};let o=this.format;o=Ql(o,t,"x"),o=Ql(o,t,"y"),this.format=o;for(const e in o){const n=o[e];if(null!==n&&!1!==n)if("fx"===e||"fy"===e)r[e]=!0;else{const n=Rn(t,e);n&&(r[e]=n)}}for(const e in t){if(e in r||e in o||Ul.has(e))continue;if(("x"===e||"y"===e)&&t.geometry)continue;const n=Rn(t,e);if(n){if(null==n.scale&&"color"===n.defaultScale)continue;r[e]=n}}this.facet&&(n.fx&&!("fx"in o)&&(r.fx=!0),n.fy&&!("fy"in o)&&(r.fy=!0));for(const t in r){const o=this.format[t];if("string"==typeof o){const i=r[t]?.value??n[t]?.domain()??[];this.format[t]=(Kt(i)?e.utcFormat:e.format)(o)}else if(void 0===o||!0===o){const e=n[t];this.format[t]=e?.bandwidth?Ja(e,e.domain()):zo}}return r}function Ql(t,e,n){if(!(n in t))return t;const r=`${n}1`,o=`${n}2`;if(!(!(r in t)&&r in e||!(o in t)&&o in e))return t;const i=Object.entries(t),a=t[n];return i.splice(i.findIndex((([t])=>t===n))+1,0,[r,a],[o,a]),Object.fromEntries(i)}function Kl(t,e,{title:n}){return this.format.title(n.value[t],t)}function*ts(t,e,r,o,i){for(const a in r){if("fx"===a||"fy"===a){yield{label:rs(o,r,a),value:this.format[a](e[a],t)};continue}if("x1"===a&&"x2"in r)continue;if("y1"===a&&"y2"in r)continue;const l=r[a];if("x2"===a&&"x1"in r)yield{label:ns(o,r,"x"),value:es(this.format.x2,r.x1,l,t)};else if("y2"===a&&"y1"in r)yield{label:ns(o,r,"y"),value:es(this.format.y2,r.y1,l,t)};else{const e=l.value[t],s=l.scale;if(!n(e)&&null==s)continue;yield{label:rs(o,r,a),value:this.format[a](e,t),color:"color"===s?i[a][t]:null,opacity:"opacity"===s?i[a][t]:null}}}}function es(t,e,n,r){return n.hint?.length?`${t(n.value[r]-e.value[r],r)}`:`${t(e.value[r],r)}–${t(n.value[r],r)}`}function ns(t,e,n){const r=rs(t,e,`${n}1`,n),o=rs(t,e,`${n}2`,n);return r===o?r:`${r}–${o}`}function rs(t,e,n,r=n){const o=e[n],i=t[o?.scale??n];return String(i?.label??o?.label??r)}function os(t={}){const{facet:n,style:r,title:o,subtitle:i,caption:a,ariaLabel:l,ariaDescription:s}=t,c=Qo(t.className),u=void 0===t.marks?[]:as(t.marks);u.push(...function(t){const e=[];for(const n of t){let t=n.tip;if(t){!0===t?t={}:"string"==typeof t&&(t={pointer:t});let{pointer:r,preferredAnchor:o}=t;r=/^x$/i.test(r)?fi:/^y$/i.test(r)?hi:ui,t=r(ms(n,t)),t.title=null,void 0===o&&(t.preferredAnchor=r===hi?"left":"bottom");const i=Zl(n.data,t);i.facet=n.facet,i.facetAnchor=n.facetAnchor,e.push(i)}}return e}(u));const f=function(t,e){if(null==t)return;const{x:n,y:r}=t;if(null==n&&null==r)return;const o=gt(t.data);if(null==o)throw new Error("missing facet data");const i={};null!=n&&(i.fx=wn(o,{value:n,scale:"fx"}));null!=r&&(i.fy=wn(o,{value:r,scale:"fy"}));cs(i,e);const a=_r(o,i);return{channels:i,groups:a,data:t.data}}(n,t),h=new Map;for(const e of u){const n=ps(e,f,t);n&&h.set(e,n)}const d=new Map;f&&hs(d,[f],t),hs(d,h,t);const p=as(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:y=(null===m?null:c)}=i,fx:{axis:g=f,grid:v=(null===g?null:h)}=a,fy:{axis:x=f,grid:w=(null===x?null:h)}=l}=n;(r||!Lt(o)&&!ws("x",t))&&(d=p=null);(r||!Lt(i)&&!ws("y",t))&&(m=y=null);e.has("fx")||(g=v=null);e.has("fy")||(x=w=null);void 0===d&&(d=!xs(t,"x"));void 0===m&&(m=!xs(t,"y"));void 0===g&&(g=!xs(t,"fx"));void 0===x&&(x=!xs(t,"fy"));!0===d&&(d="bottom");!0===m&&(m="left");!0===g&&(g="top"===d||null===d?"bottom":"top");!0===x&&(x="right"===m||null===m?"left":"right");const b=[];return gs(b,w,Da,l),ys(b,x,Ia,"right","left",u,l),gs(b,v,_a,a),ys(b,g,Wa,"top","bottom",u,a),gs(b,y,qa,i),ys(b,m,Ba,"left","right",n,i),gs(b,p,Ya,o),ys(b,d,Pa,"bottom","top",n,o),b}(u,d,t));for(const e of p){const n=ps(e,f,t);n&&h.set(e,n)}u.unshift(...p);let m=function(t,n){const{fx:r,fy:o}=kr(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}(d,t);if(void 0!==m){const t=f?no(m,f):void 0;for(const e of u){if(null===e.facet||"super"===e.facet)continue;const n=h.get(e);void 0!==n&&(n.facetsIndex=null!=e.fx||null!=e.fy?no(m,n):t)}const e=new Set;for(const{facetsIndex:t}of h.values())t?.forEach(((t,n)=>{t?.length>0&&e.add(n)}));m.forEach(0<e.size&&e.size<m.length?(t,n)=>t.empty=!e.has(n):t=>t.empty=!1);for(const t of u)if("exclude"===t.facet){const e=h.get(t);void 0!==e&&(e.facetsIndex=Gr(e.facetsIndex))}}for(const e of ke.keys())Lt(t[e])&&"fx"!==e&&"fy"!==e&&d.set(e,[]);const y=new Map;for(const e of u){if(y.has(e))throw new Error("duplicate mark; each mark must be unique");const{facetsIndex:n,channels:r}=h.get(e)??{},{data:o,facets:i,channels:a}=e.initialize(n,r,t);cs(a,t),y.set(e,{data:o,facets:i,channels:a})}const g=kr(hs(d,y,t),t),v=function(t,e,n={}){let r=.5-Oo,o=.5+Oo,i=.5+Oo,a=.5-Oo;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=ai(t,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}(g,u,t);!function(t,e){const{x:n,y:r,fx:o,fy:i}=t,a=o||i?Lr(e):e;o&&zr(o,a),i&&Or(i,a);const l=o||i?Sr(t,e):e;n&&zr(n,l),r&&Or(r,l)}(g,v);const x=$r(g),{fx:w,fy:b}=x,k=w||b?Sr(g,v):v,$=w||b?function({fx:t,fy:e},n){const{marginTop:r,marginRight:o,marginBottom:i,marginLeft:a,width:l,height:s}=Lr(n),c=t&&bs(t),u=e&&bs(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}}(x,v):v,M=go(t),A=M.document,L=e.creator("svg").call(A.documentElement);let S=L;M.ownerSVGElement=L,M.className=c,M.projection=ao(t,k),M.path=function(){return e.geoPath(this.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))}})}(x))},M.filterFacets=(t,e)=>no(m,{channels:e,groups:_r(t,e)}),M.getMarkState=t=>{const e=y.get(t),n=h.get(t);return{...e,channels:{...e.channels,...n?.channels}}},M.dispatchValue=t=>{S.value!==t&&(S.value=t,S.dispatchEvent(new M.document.defaultView.Event("input",{bubbles:!0})))};const z=new Set;for(const[e,n]of y)if(null!=e.initializer){const r="super"===e.facet?$:k,o=e.initializer(n.data,n.facets,n.channels,x,r,M);if(void 0!==o.data&&(n.data=o.data),void 0!==o.facets&&(n.facets=o.facets),void 0!==o.channels){const{fx:r,fy:i,...a}=o.channels;fs(a),Object.assign(n.channels,a);for(const e of Object.values(a)){const{scale:n}=e;null!=n&&((O=ke.get(n))!==me&&O!==be)&&(us(e,t),z.add(n))}null==r&&null==i||h.set(e,!0)}}var O;if(z.size){const e=new Map;hs(e,y,t,(t=>z.has(t))),hs(d,y,t,(t=>z.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}(kr(e,t),g),{scales:r,...o}=$r(n);Object.assign(g,n),Object.assign(x,o),Object.assign(x.scales,r)}let E,R;void 0!==m&&(E={x:w?.domain(),y:b?.domain()},m=function(t,{x:e,y:n}){return e&&=Ur(e),n&&=Ur(n),t.filter(e&&n?t=>e.has(t.x)&&n.has(t.y):e?t=>e.has(t.x):t=>n.has(t.y)).sort(e&&n?(t,r)=>e.get(t.x)-e.get(r.x)||n.get(t.y)-n.get(r.y):e?(t,n)=>e.get(t.x)-e.get(n.x):(t,e)=>n.get(t.y)-n.get(e.y))}(m,E),R=function(t,e,{marginTop:n,marginLeft:r}){const o=t?({x:e})=>t(e)-r:()=>0,i=e?({y:t})=>e(t)-n:()=>0;return function(t){"svg"===this.tagName?(this.setAttribute("x",o(t)),this.setAttribute("y",i(t))):this.setAttribute("transform",`translate(${o(t)},${i(t)})`)}}(w,b,v));for(const[t,e]of y)e.values=t.scale(e.channels,x,M);const{width:C,height:N}=v;e.select(L).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",C).attr("height",N).attr("viewBox",`0 0 ${C} ${N}`).attr("aria-label",l).attr("aria-description",s).call((t=>t.append("style").text(`:where(.${c}) {\n --plot-background: white;\n display: block;\n height: auto;\n height: intrinsic;\n max-width: 100%;\n}\n:where(.${c} text),\n:where(.${c} tspan) {\n white-space: pre;\n}`))).call(Ko,r);for(const t of u){const{channels:n,values:r,facets:o}=y.get(t);if(void 0===m||"super"===t.facet){let e=null;if(o&&(e=o[0],e=t.filter(e,n,r),0===e.length))continue;const i=t.render(e,x,r,$,M);if(null==i)continue;L.appendChild(i)}else{let i;for(const a of m){if(!(t.facetAnchor?.(m,E,a)??!a.empty))continue;let l=null;if(o){const e=h.has(t);if(l=o[e?a.i:0],l=t.filter(l,n,r),0===l.length)continue;e||l!==o[0]||(l=It(l)),l.fx=a.x,l.fy=a.y,l.fi=a.i}const s=t.render(l,x,r,k,M);if(null!=s){(i??=e.select(L).append("g")).append((()=>s)).datum(a);for(const t of["aria-label","aria-description","aria-hidden","transform"])s.hasAttribute(t)&&(i.attr(t,s.getAttribute(t)),s.removeAttribute(t))}}i?.selectChildren().each(R)}}const T=function(t,e,n){const r=[];for(const[o,i]of cl){const a=n[o];if(a?.legend&&o in t){const n=i(t[o],ul(e,t[o],a),(e=>t[e]));null!=n&&r.push(n)}}return r}(g,M,t),{figure:B=null!=o||null!=i||null!=a||T.length>0}=t;B&&(S=A.createElement("figure"),S.className=`${c}-figure`,S.style.maxWidth="initial",null!=o&&S.append(is(A,o,"h2")),null!=i&&S.append(is(A,i,"h3")),S.append(...T,L),null!=a&&S.append(function(t,e){const n=t.createElement("figcaption");return n.append(e),n}(A,a)),"value"in L&&(S.value=L.value,delete L.value)),S.scale=function(t){return e=>{if(!ke.has(e=`${e}`))throw new Error(`unknown scale: ${e}`);return t[e]}}(x.scales),S.legend=function(t,e,n={}){return(r,o)=>{if(!cl.has(r))throw new Error(`unknown legend type: ${r}`);if(r in t)return cl.get(r)(t[r],ul(e,n[r],o),(e=>t[e]))}}(g,M,t);const I=function(){const t=lr;return lr=0,ar=void 0,t}();return I>0&&e.select(L).append("text").attr("x",C).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("⚠️").append("title").text(`${I.toLocaleString("en-US")} warning${1===I?"":"s"}. Please check the console.`),S}function is(t,e,n){if(e.ownerDocument)return e;const r=t.createElement(n);return r.append(e),r}function as(t){return t.flat(1/0).filter((t=>null!=t)).map(ls)}function ls(t){return"function"==typeof t.render?t:new ss(t)}class ss extends ei{constructor(t){if("function"!=typeof t)throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}}function cs(t,e){for(const n in t)us(t[n],e);return t}function us(t,e){const{scale:n,transform:r=!0}=t;if(null==n||!r)return;const{type:o,percent:i,interval:a,transform:l=(i?t=>null==t?NaN:100*t:_t(a,o))}=e[n]??{};null!=l&&(t.value=wt(t.value,l),t.transform=!1)}function fs(t){for(const e in t)$n(e,t[e])}function hs(t,e,n,r=tt){for(const{channels:o}of e.values())for(const e in o){const i=o[e],{scale:a}=i;if(null!=a&&r(a))if("projection"===a){if(!po(n)){const e=void 0===n.x?.domain,r=void 0===n.y?.domain;if(e||r){const[n,o]=yo(i);e&&ds(t,"x",n),r&&ds(t,"y",o)}}}else ds(t,a,i)}return t}function ds(t,e,n){const r=t.get(e);void 0!==r?r.push(n):t.set(e,[n])}function ps(t,e,n){if(null===t.facet||"super"===t.facet)return;const{fx:r,fy:o}=t;if(null!=r||null!=o){const e=gt(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=wn(e,{value:r,scale:"fx"})),null!=o&&(i.fy=wn(e,{value:o,scale:"fy"})),cs(i,n),{channels:i,groups:_r(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)&&Ct(gt(t.data))===Ct(l)&&sr(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function ms(t,e={}){return Re({...e,x:null,y:null},((e,n,r,o,i,a)=>a.getMarkState(t)))}function ys(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,labelArrow:p=e.labelArrow,labelOffset:m}){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,labelArrow:p,labelOffset:m}}(l?r:e,i,a);const{line:s}=a;n!==Ba&&n!==Pa||!s||se(s)||t.push(Xl(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 gs(t,e,n,r){e&&!se(e)&&t.push(n(function(t,{stroke:e=(ie(t)?t:void 0),ticks:n=(vs(t)?t:void 0),tickSpacing:r,ariaLabel:o,ariaDescription:i}){return{stroke:e,ticks:n,tickSpacing:r,ariaLabel:o,ariaDescription:i}}(e,r)))}function vs(t){switch(typeof t){case"number":return!0;case"string":return!ie(t)}return Zt(t)||"function"==typeof t?.range}function xs(t,e){const n=`${e}-axis `;return t.some((t=>t.ariaLabel?.startsWith(n)))}function ws(t,e){for(const n of e)for(const e in n.channels){const{scale:r}=n.channels[e];if(r===t||"projection"===r)return!0}return!1}function bs(t){const e=t.domain();if(0===e.length)return[0,t.bandwidth()];let n=t(e[0]),r=t(e[e.length-1]);return r<n&&([n,r]=[r,n]),[n,r+t.bandwidth()]}const ks=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 $s(t=e.curveLinear,n){if("function"==typeof t)return t;const r=ks.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 Ms(t=As,e){return"function"!=typeof t&&"auto"===`${t}`.toLowerCase()?As:$s(t,e)}function As(t){return e.curveLinear(t)}function Ls(t={y:"count"},e={}){[t,e]=Ns(t,e);const{x:n,y:r}=e;return Cs(Ts(n,e,Q),null,null,r,t,Ei(e))}function Ss(t={x:"count"},e={}){[t,e]=Ns(t,e);const{x:n,y:r}=e;return Cs(null,Ts(r,e,Q),n,null,t,Ri(e))}function zs(t={fill:"count"},e={}){[t,e]=Ns(t,e);const{x:n,y:r}=function(t){let{x:e,y:n}=t;return e=Ts(e,t),n=Ts(n,t),[e.value,n.value]=Et(e.value,n.value),{x:e,y:n}}(e);return Cs(n,r,null,null,t,Ei(Ri(e)))}function Os(t,e,n={}){if(null==n?.interval)return n;const{reduce:r=un}=n,o={filter:null};return null!=n[e]&&(o[e]=r),null!=n[`${e}1`]&&(o[`${e}1`]=r),null!=n[`${e}2`]&&(o[`${e}2`]=r),t(o,n)}function Es(t={}){return Os(Ls,"y",ii(t,"x"))}function Rs(t={}){return Os(Ss,"x",ii(t,"y"))}function Cs(t,e,n,r,{data:o=cn,filter:i=dn,sort:a,reverse:l,...s}={},c={}){t=Bs(t),e=Bs(e),s=function(t,e){return He(t,e,Ps)}(s,c),o=js(o,Q),a=null==a?void 0:Ps("sort",a,c),i=null==i?void 0:Ws("filter",i,c),null!=n&&Xe(s,"x","x1","x2")&&(n=null),null!=r&&Xe(s,"y","y1","y2")&&(r=null);const[u,f]=Ft(t),[h,d]=Ft(t),[p,m]=Ft(e),[y,g]=Ft(e),[v,x]=null!=n?[n,"x"]:null!=r?[r,"y"]:[],[w,b]=Ft(v),{x:k,y:$,z:M,fill:A,stroke:L,x1:S,x2:z,y1:O,y2:E,domain:R,cumulative:C,thresholds:N,interval:T,...B}=c,[I,P]=Ft(M),[W]=dt(A),[j]=dt(L),[F,q]=Ft(W),[D,Y]=Ft(j);return{..."z"in c&&{z:I||M},..."fill"in c&&{fill:F||A},..."stroke"in c&&{stroke:D||L},...Ee(B,((n,r,c)=>{const u=Yt(_(n,v),c?.[x]),h=_(n,M),p=_(n,W),y=_(n,j),w=on(s,{z:h,fill:p,stroke:y}),k=[],$=[],A=u&&b([]),L=h&&P([]),S=p&&q([]),z=y&&Y([]),O=t&&f([]),E=t&&d([]),R=e&&m([]),C=e&&g([]),N=function(t,e,n){const r=t?.(n),o=e?.(n);return r&&o?function*(t){const e=r.bin(t);for(const[t,[i,a]]of r.entries()){const r=o.bin(e[t]);for(const[t,[e,l]]of o.entries())yield[r[t],{data:n,x1:i,y1:e,x2:a,y2:l}]}}:r?function*(t){const e=r.bin(t);for(const[t,[o,i]]of r.entries())yield[e[t],{data:n,x1:o,x2:i}]}:function*(t){const e=o.bin(t);for(const[t,[r,i]]of o.entries())yield[e[t],{data:n,y1:r,y2:i}]}}(t,e,n);let T=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 Ze(t,w))for(const[t,c]of Ze(l,u))for(const[l,f]of N(c))if(w&&(f.z=r),!i||i.reduce(l,f)){e.push(T++),$.push(o.reduceIndex(l,n,f)),u&&A.push(t),h&&L.push(w===h?r:h[(l.length>0?l:c)[0]]),p&&S.push(w===p?r:p[(l.length>0?l:c)[0]]),y&&z.push(w===y?r:y[(l.length>0?l:c)[0]]),O&&(O.push(f.x1),E.push(f.x2)),R&&(R.push(f.y1),C.push(f.y2));for(const t of s)t.reduce(l,f);a&&a.reduce(l,f)}k.push(e)}return an(k,a,l),{data:$,facets:k}})),...!Xe(s,"x")&&(u?{x1:u,x2:h,x:Dt(u,h)}:{x:k,x1:S,x2:z}),...!Xe(s,"y")&&(p?{y1:p,y2:y,y:Dt(p,y)}:{y:$,y1:O,y2:E}),...w&&{[x]:w},...Object.fromEntries(s.map((({name:t,output:e})=>[t,e])))}}function Ns({cumulative:t,domain:e,thresholds:n,interval:r,...o},i){return[o,{cumulative:t,domain:e,thresholds:n,interval:r,...i}]}function Ts(t,{cumulative:e,domain:n,thresholds:r,interval:o},i){return void 0===(t={...Vt(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=Is(t.thresholds,t.interval),t}function Bs(t){if(null==t)return;const{value:n,cumulative:r,domain:o=e.extent,thresholds:i}=t,a=t=>{let a,l=_(t,n);if(Kt(l)||(function(t){return Ut(t)&&"function"==typeof t?.floor&&t.floor()instanceof Date}(s=i)||Zt(s)&&Kt(s))){l=wt(l,ht,Float64Array);let[t,n]="function"==typeof o?o(l):o,r="function"!=typeof i||Ut(i)?i:i(l,t,n);"number"==typeof r&&(r=e.utcTickInterval(t,n,r)),Ut(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=ct(l);let[t,n]="function"==typeof o?o(l):o,r="function"!=typeof i||Ut(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 Ut(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?_s:r>0?Ys:Ds)(c,a,l),c};return a.label=qt(n),a}function Is(t,n,r=qs){if(void 0===t)return void 0===n?r:Ht(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 qs}return C(t)}return t}function Ps(t,e,n){return Ue(t,e,n,Ws)}function Ws(t,e,n){return Ve(t,e,n,js)}function js(t,e){return Je(t,e,Fs)}function Fs(t){switch(`${t}`.toLowerCase()){case"x":return Xs;case"x1":return Us;case"x2":return Vs;case"y":return Hs;case"y1":return Zs;case"y2":return Js;case"z":return xn}throw new Error(`invalid bin reduce: ${t}`)}function qs(t,n,r){return Math.min(200,e.thresholdScott(t,n,r))}function Ds(t,n,r){return n=ct(n),o=>{const i=t.map((()=>[]));for(const t of o)i[e.bisect(n,r[t])-1]?.push(t);return i}}function Ys(t,e,n){const r=Ds(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 _s(t,e,n){const r=Ds(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 Gs(t,e){const n=(+t+ +e)/2;return t instanceof Date?new Date(n):n}const Xs={reduceIndex:(t,e,{x1:n,x2:r})=>Gs(n,r)},Hs={reduceIndex:(t,e,{y1:n,y2:r})=>Gs(n,r)},Us={reduceIndex:(t,e,{x1:n})=>n},Vs={reduceIndex:(t,e,{x2:n})=>n},Zs={reduceIndex:(t,e,{y1:n})=>n},Js={reduceIndex:(t,e,{y2:n})=>n},Qs={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Ks extends ei{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:Rt(e),optional:!0}},e,Qs),this.z=a,this.curve=$s(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 vo("svg:g",i).call(_o,this,o,i).call(Uo,this,n,0,0).call((n=>n.selectAll().data(jo(t,[a,l,s,c],this,r)).enter().append("path").call(Go,this).call(Po,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 tc(t,e){return void 0===e?nc(t,{x:rt,y:ot}):new Ks(t,e)}function ec(t,e){const{y:n=J,...r}=Rs(e);return new Ks(t,vl(dl({...r,y1:n,y2:void 0},n===J?"x2":"x")))}function nc(t,e){const{x:n=J,...r}=Es(e);return new Ks(t,xl(pl({...r,x1:n,x2:void 0},n===J?"y2":"y")))}const rc={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class oc extends ei{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,rc),this.curve=Ms(a,l),gi(this,e)}project(t,e,n){this.curve!==As&&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 vo("svg:g",i).call(_o,this,o,i).call(Uo,this,n).call((n=>n.selectAll().data(t).enter().append("path").call(Go,this).attr("d",u===As&&i.projection?function(t,e,n,r,o){return e=ct(e),n=ct(n),r=ct(r),o=ct(o),i=>t({type:"LineString",coordinates:[[e[i],n[i]],[r[i],o[i]]]})}(i.path(),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(Io,this,r).call(Ai,this,r,i))).node()}}function ic(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:a,...l}={}){return[n,r]=ac(e,n,r),[i,a]=ac(o,i,a),new oc(t,{...l,x1:n,x2:r,y1:i,y2:a})}function ac(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 lc={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5};class sc extends ei{constructor(t,n={}){const{x1:r,y1:o,x2:i,y2:a,bend:l=0,headAngle:s=60,headLength:c=8,inset:u=0,insetStart:f=u,insetEnd:h=u,sweep:d}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:o,scale:"y"},x2:{value:i,scale:"x",optional:!0},y2:{value:a,scale:"y",optional:!0}},n,lc),this.bend=!0===l?22.5:Math.max(-90,Math.min(90,l)),this.headAngle=+s,this.headLength=+c,this.insetStart=+f,this.insetEnd=+h,this.sweep=function(t=1){if("number"==typeof t)return lt(Math.sign(t));if("function"==typeof t)return(e,n,r,o)=>Math.sign(t(e,n,r,o));switch(yt(t,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>e.ascending(t,r);case"-x":return(t,n,r)=>e.descending(t,r);case"+y":return(t,n,r,o)=>e.ascending(n,o);case"-y":return(t,n,r,o)=>e.descending(n,o)}}(d)}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,y=c?t=>c[t]:lt(void 0===u?1:u),g=h*yi/2,v=d/1.5;return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,e).call((e=>e.selectAll().data(t).enter().append("path").call(Go,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 h=Math.min(v*y(t),c/3),d=this.sweep(e,n,r,o)*f*yi,x=Math.hypot(c/Math.tan(d),c)/2;if(p||m)if(x<1e5){const t=Math.sign(d),[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],x,t);if(p&&([e,n]=cc([i,a,x],[e,n,p],-t*Math.sign(p))),m){const[e,n]=cc([i,a,x],[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 w=u+d,b=w+g,k=w-g,$=r-h*Math.cos(b),M=o-h*Math.sin(b),A=r-h*Math.cos(k),L=o-h*Math.sin(k);return`M${e},${n}${x<1e5?`A${x},${x} 0,0,${d>0?1:0} `:"L"}${r},${o}${h?`M${$},${M}L${r},${o}L${A},${L}`:""}`})).call(Io,this,n))).node()}}function cc([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]}const uc={ariaLabel:"bar"};class fc extends ei{constructor(t,e,n={},r=uc){super(t,e,n,r),Bl(this,n),Il(this,n)}render(t,e,n,r,o){const{rx:i,ry:a,rx1y1:l,rx1y2:s,rx2y1:c,rx2y2:u}=this,f=this._x(e,n,r),h=this._y(e,n,r),d=this._width(e,n,r),p=this._height(e,n,r);return vo("svg:g",o).call(_o,this,r,o).call(this._transform,this,e).call((e=>e.selectAll().data(t).enter().call(l||s||c||u?t=>t.append("path").call(Go,this).call(Pl,f,h,hc(f,d),hc(h,p),this).call(Io,this,n):t=>t.append("rect").call(Go,this).attr("x",f).attr("width",d).attr("y",h).attr("height",p).call(Ho,"rx",i).call(Ho,"ry",a).call(Io,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)}}function hc(t,e){return"function"==typeof t&&"function"==typeof e?n=>t(n)+e(n):"function"==typeof t?n=>t(n)+e:"function"==typeof e?n=>t+e(n):t+e}class dc extends fc{constructor(t,e={},n){const{x1:r,x2:o,y:i}=e;super(t,{x1:{value:r,scale:"x"},x2:{value:o,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},e,n)}_transform(t,e,{x:n}){t.call(Uo,e,{x:n},0,0)}_x({x:t},{x1:e,x2:n},{marginLeft:r}){const{insetLeft:o}=this;return Fr(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 Fr(t)?i-r-o-a-l:t=>Math.max(0,Math.abs(n[t]-e[t])-a-l)}}class pc extends fc{constructor(t,e={},n){const{x:r,y1:o,y2:i}=e;super(t,{y1:{value:o,scale:"y"},y2:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},e,n)}_transform(t,e,{y:n}){t.call(Uo,e,{y:n},0,0)}_y({y:t},{y1:e,y2:n},{marginTop:r}){const{insetTop:o}=this;return Fr(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 Fr(t)?i-r-o-a-l:t=>Math.max(0,Math.abs(n[t]-e[t])-a-l)}}function mc(t,e={}){return Mt(e)||(e={...e,y:J,x2:Q}),new dc(t,vl(Wi(dl(e))))}function yc(t,e={}){return Mt(e)||(e={...e,x:J,y2:Q}),new pc(t,xl(ji(pl(e))))}const gc={ariaLabel:"cell"};class vc extends fc{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,gc)}_transform(t,e){t.call(Uo,e,{},0,0)}}function xc(t,{x:e,y:n,...r}={}){return[e,n]=Et(e,n),new vc(t,{...r,x:e,y:n})}const wc={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function bc(t){return void 0===t.sort&&void 0===t.reverse?Pe({channel:"-r"},t):t}class kc extends ei{constructor(t,n={}){const{x:r,y:o,r:i,rotate:a,symbol:s=e.symbolCircle,frameAnchor:c}=n,[u,f]=pt(a,0),[h,d]=function(t){if(null==t||Se(t))return[void 0,t];if("string"==typeof t){const e=Le.get(`${t}`.toLowerCase());if(e)return[void 0,e]}return[t,void 0]}(s),[p,m]=pt(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}},bc(n),wc),this.r=m,this.rotate=f,this.symbol=d,this.frameAnchor=ue(c);const{channels:y}=this,{symbol:g}=y;if(g){const{fill:t,stroke:e}=y;g.hint={fill:t?t.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:e?e.value===g.value?"color":"currentColor":this.stroke??"none"}}}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:y}=this,[g,v]=ti(this,o),x=y===e.symbolCircle,w=f?void 0:p*p*Math.PI;return s(p)&&(t=[]),vo("svg:g",i).call(_o,this,o,i).call(Uo,this,{x:c&&a,y:u&&l}).call((n=>n.selectAll().data(t).enter().append(x?"circle":"path").call(Go,this).call(x?t=>{t.attr("cx",c?t=>c[t]:g).attr("cy",u?t=>u[t]:v).attr("r",f?t=>f[t]:p)}:t=>{t.attr("transform",Ui`translate(${c?t=>c[t]:g},${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 y.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 y.draw(t,w),t})())}).call(Io,this,r))).node()}}function $c(t,{x:e,y:n,...r}={}){return void 0===r.frameAnchor&&([e,n]=Et(e,n)),new kc(t,{...r,x:e,y:n})}const Mc={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Ac extends ei{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:Rt(e),optional:!0}},e,Mc),this.z=o,this.curve=Ms(i,a),gi(this,e)}filter(t){return t}project(t,e,n){this.curve!==As&&super.project(t,e,n)}render(t,n,r,o,i){const{x:a,y:l}=r,{curve:s}=this;return vo("svg:g",i).call(_o,this,o,i).call(Uo,this,n).call((n=>n.selectAll().data(jo(t,[a,l],this,r)).enter().append("path").call(Go,this).call(Po,this,r).call(Li,this,r,i).attr("d",s===As&&i.projection?function(t,e,n){return e=ct(e),n=ct(n),r=>{let o=[];const i=[o];for(const t of r)-1===t?(o=[],i.push(o)):o.push([e[t],n[t]]);return t({type:"MultiLineString",coordinates:i})}}(i.path(),a,l):e.line().curve(s).defined((t=>t>=0)).x((t=>a[t])).y((t=>l[t]))))).node()}}function Lc(t,{x:e,y:n,...r}={}){return[e,n]=Et(e,n),new Ac(t,{...r,x:e,y:n})}function Sc(t,{x:e=Q,y:n=J,...r}={}){return new Ac(t,Rs({...r,x:e,y:n}))}function zc(t,{x:e=J,y:n=Q,...r}={}){return new Ac(t,Es({...r,x:e,y:n}))}function Oc(t,e){e=function({x:t,y:e,color:n,size:r,fx:o,fy:i,mark:a}={}){St(t)||(t=Cc(t));St(e)||(e=Cc(e));St(n)||(n=ie(n)?{color:n}:Cc(n));St(r)||(r=Cc(r));St(o)&&({value:o}=Cc(o));St(i)&&({value:i}=Cc(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=Rc(t,n),l=Rc(t,r),s=Rc(t,o),c=Rc(t,i);let u,f,h,{fx:d,fy:p,x:{value:m,reduce:y,zero:g,...v},y:{value:x,reduce:w,zero:b,...k},color:{value:$,color:M,reduce:A},size:{value:L,reduce:S},mark:z}=e;if(void 0===y&&(y=null==w&&null==m&&null==L&&null!=x?"count":null),void 0===w&&(w=null==y&&null==x&&null==L&&null!=m?"count":null),void 0!==S||null!=L||null!=A||null!=y||null!=w||null!=m&&!Qt(a)||null!=x&&!Qt(l)||(S="count"),void 0===g&&(g=!!Nc(y)||void 0),void 0===b&&(b=!!Nc(w)||void 0),null==m&&null==x)throw new Error("must specify x or y");if(null!=y&&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!=L||null!=S?"dot":Nc(y)||Nc(w)||null!=A?"bar":null!=m&&null!=x?Qt(a)||Qt(l)||null==y&&null==w&&!Ec(a)&&!Ec(l)?"dot":"line":null!=m||null!=x?"rule":null),z){case"dot":h=$c,f="stroke";break;case"line":h=a&&l||null!=y||null!=w?b||null!=w||a&&Ec(a)?zc:g||null!=y||l&&Ec(l)?Sc:Lc:a?Sc:zc,f="stroke",Bc(s)&&(u=null);break;case"area":h=!b&&null==w&&(g||null!=y||l&&Ec(l))?ec:nc,f="fill",Bc(s)&&(u=null);break;case"rule":h=a?Gi:Xi,f="stroke";break;case"bar":h=null!=y?Qt(l)?Tc(y)&&a&&Qt(a)?xc:mc:ql:null!=w?Qt(a)?Tc(w)&&l&&Qt(l)?xc:yc:Dl:null!=A||null!=S?a&&Qt(a)&&l&&Qt(l)?xc:a&&Qt(a)?yc:l&&Qt(l)?mc:Fl:!a||!ne(a)||l&&ne(l)?!l||!ne(l)||a&&ne(a)?xc:yc:mc,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,tip:!0},R={[f]:A??void 0,r:S??void 0};if(null!=y&&null!=w)throw new Error("cannot reduce both x and y");return null!=w?(R.y=w,O=Qt(a)?De:Ls):null!=y?(R.x=y,O=Qt(l)?Ye:Ss):null==A&&null==S||(a&&l?O=Qt(a)&&Qt(l)?_e:Qt(a)?Ss:Qt(l)?Ls:zs:a?O=Qt(a)?De:Ls:l&&(O=Qt(l)?Ye:Ss)),O!==zs&&O!==Ls||(E.x={value:a,...v}),O!==zs&&O!==Ss||(E.y={value:l,...k}),void 0===g&&(g=a&&!(O===zs||O===Ls)&&(h===mc||h===ec||h===ql||h===Xi)),void 0===b&&(b=l&&!(O===zs||O===Ss)&&(h===yc||h===nc||h===Dl||h===Gi)),{fx:d??null,fy:p??null,x:{value:m??null,reduce:y??null,zero:!!g,...v},y:{value:x??null,reduce:w??null,zero:!!b,...k},color:{value:$??null,reduce:A??null,...void 0!==M&&{color:M}},size:{value:L??null,reduce:S??null},mark:z,markImpl:Pc[h],markOptions:E,transformImpl:Pc[O],transformOptions:R,colorMode:f}}function Ec(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 Rc(t,e){const n=_(t,e.value);return n&&(n.label=qt(e.value)),n}function Cc(t){return function(t){if(null==t)return!1;if("function"==typeof t.reduceIndex)return!0;if("function"==typeof t.reduce&&At(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 Nc(t){return/^(?:distinct|count|sum|proportion)$/i.test(t)}function Tc(t){return/^(?:first|last|mode)$/i.test(t)}function Bc(t){return!!t&&new e.InternSet(t).size>t.length>>1}const Ic={dot:$c,line:Lc,lineX:Sc,lineY:zc,areaX:ec,areaY:nc,ruleX:Gi,ruleY:Xi,barX:mc,barY:yc,rect:Fl,rectX:ql,rectY:Dl,cell:xc,bin:zs,binX:Ls,binY:Ss,group:_e,groupX:De,groupY:Ye},Pc=Object.fromEntries(Object.entries(Ic).map((([t,e])=>[e,t])));function Wc(t,e={}){let{x:n,x1:r,x2:o}=e;void 0===n&&void 0===r&&void 0===o&&(e={...e,x:n=Q});const i={};return null!=n&&(i.x=t),null!=r&&(i.x1=t),null!=o&&(i.x2=t),Fc(i,e)}function jc(t,e={}){let{y:n,y1:r,y2:o}=e;void 0===n&&void 0===r&&void 0===o&&(e={...e,y:n=Q});const i={};return null!=n&&(i.y=t),null!=r&&(i.y1=t),null!=o&&(i.y2=t),Fc(i,e)}function Fc(t={},n={}){const r=Rt(n),o=Object.entries(t).map((([t,e])=>{const r=Wt(t,n);if(null==r)throw new Error(`missing channel: ${t}`);const[o,i]=jt(r);return{key:t,input:r,output:o,setOutput:i,map:qc(e)}}));return{...Ee(n,((t,n)=>{const i=_(t,r),a=o.map((({input:e})=>_(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])))}}function qc(t){if(null==t)throw new Error("missing map");if("function"==typeof t.mapIndex)return t;if("function"==typeof t.map&&At(t))return function(t){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:t.map.bind(t)}}(t);if("function"==typeof t)return Dc(Bt(t));switch(`${t}`.toLowerCase()){case"cumsum":return Yc;case"rank":return Dc(((t,n)=>e.rank(t,(t=>n[t]))));case"quantile":return Dc(((t,n)=>function(t,n){const r=e.count(t,n)-1;return e.rank(t,n).map((t=>t/r))}(t,(t=>n[t]))))}throw new Error(`invalid map: ${t}`)}function Dc(t){return{mapIndex(e,n,r){const o=t(e,n);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 Yc={mapIndex(t,e,n){let r=0;for(const o of t)n[o]=r+=e[o]}};function _c(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),sr(`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 Gc(st(t));switch(t.toLowerCase()){case"deviation":return Gc(e.deviation);case"max":return Xc(((t,n)=>e.max(t,(t=>n[t]))));case"mean":return Uc;case"median":return Gc(e.median);case"min":return Xc(((t,n)=>e.min(t,(t=>n[t]))));case"mode":return Xc(((t,n)=>e.mode(t,(t=>n[t]))));case"sum":return Hc;case"variance":return Gc(e.variance);case"difference":return Kc;case"ratio":return tu;case"first":return eu;case"last":return nu}}if("function"!=typeof t)throw new Error(`invalid reduce: ${t}`);return Xc(Bt(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 Gc(t){return(e,n,r)=>r?{mapIndex(r,o,i){const a=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(It(r,o,o+e),a):NaN,isNaN(a(o))&&--l}}:{mapIndex(r,o,i){const a=t=>null==o[t]?NaN:+o[t];for(let o=-n;o<0;++o)i[r[o+n]]=t(It(r,0,o+e),a);for(let o=0,l=r.length-n;o<l;++o)i[r[o+n]]=t(It(r,o,o+e),a)}}}function Xc(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(It(o,s,s+e),i)),l-=n(i[o[s]])}}:{mapIndex(n,o,i){for(let a=-r;a<0;++a)i[n[a+r]]=t(It(n,0,a+e),o);for(let a=0,l=n.length-r;a<l;++a)i[n[a+r]]=t(It(n,a,a+e),o)}}}function Hc(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 Uc(t,e,n){if(n){const r=Hc(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 Vc(t,e,r,o){for(let i=r+o;r<i;++r){const o=t[e[r]];if(n(o))return o}}function Zc(t,e,r,o){for(let i=r+o-1;i>=r;--i){const r=t[e[i]];if(n(r))return r}}function Jc(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 Qc(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 Kc(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]]=Qc(r,n,i,t)-Jc(r,n,i,t)}}}function tu(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]]=Qc(r,n,i,t)/Jc(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)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]]=Vc(r,n,i,t)}}}function nu(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]]=Zc(r,n,i,t)}}}const ru=20,ou=2,iu="currentColor",au=.2,lu=!0,su="end";function cu({n:t=ru,k:n=0,strict:r=lu,anchor:o=su}={}){return _c({k:t,reduce:t=>e.mean(t)+n*(e.deviation(t)||0),strict:r,anchor:o})}const uu={ariaLabel:"tick",fill:null,stroke:"currentColor"};class fu extends ei{constructor(t,e,n){super(t,e,n,uu),gi(this,n)}render(t,e,n,r,o){return vo("svg:g",o).call(_o,this,r,o).call(this._transform,this,e).call((i=>i.selectAll().data(t).enter().append("line").call(Go,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(Io,this,n).call(Ai,this,n,o))).node()}}class hu extends fu{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=nt(i),this.insetBottom=nt(a)}_transform(t,e,{x:n}){t.call(Uo,e,{x:n},Oo,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 du extends fu{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=nt(i),this.insetLeft=nt(a)}_transform(t,e,{y:n}){t.call(Uo,e,{y:n},0,Oo)}_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 pu(t,{x:e=Q,...n}={}){return new hu(t,{...n,x:e})}function mu(t,{y:e=Q,...n}={}){return new du(t,{...n,y:e})}function yu(t){const e=gu(t),n=vu(t);return t.map((t=>t<e||t>n?t:NaN))}function gu(t){const n=2.5*xu(t)-1.5*wu(t);return e.min(t,(t=>t>=n?t:NaN))}function vu(t){const n=2.5*wu(t)-1.5*xu(t);return e.max(t,(t=>t<=n?t:NaN))}function xu(t){return e.quantile(t,.25)}function wu(t){return e.quantile(t,.75)}const bu={ariaLabel:"raster",stroke:null,pixelSize:1};function ku(t,e){const n=+t;if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}function $u(t,e){const n=Math.floor(t);if(isNaN(n))throw new Error(`invalid ${e}: ${t}`);return n}class Mu extends ei{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=$u(o,"width")),null!=i&&(i=$u(i,"height")),null!=s&&(s=ku(s,"x1")),null!=c&&(c=ku(c,"y1")),null!=u&&(u=ku(u,"x2")),null!=f&&(f=ku(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=ku(h,"pixelSize"),this.blur=ku(d,"blur"),this.interpolate=null==a||null==l?null:function(t){if("function"==typeof t)return t;if(null==t)return Eu;switch(`${t}`.toLowerCase()){case"none":return Eu;case"nearest":return Tu;case"barycentric":return Ru();case"random-walk":return Bu()}throw new Error(`invalid interpolate: ${t}`)}(p)}}class Au extends Mu{constructor(t,e={}){const{imageRendering:n}=e;if(null==t){const{fill:t,fillOpacity:n}=e;void 0!==pt(n)[0]&&(e=Ou("fillOpacity",e)),void 0!==dt(t)[0]&&(e=Ou("fill",e))}super(t,void 0,e,bu),this.imageRendering=Vo(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]=Su(r,o,i),p=h-u,m=d-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:v=Math.round(Math.abs(m)/y)}=this,x=g*v;let{fill:w,fillOpacity:b}=r,k=0;if(this.interpolate){const e=g/p,n=v/m,r=wt(l,(t=>(t-u)*e),Float64Array),o=wt(s,(t=>(t-f)*n),Float64Array);w&&(w=this.interpolate(t,g,v,r,o,w)),b&&(b=this.interpolate(t,g,v,r,o,b))}else null==this.data&&t&&(k=t.fi*x);const $=c.createElement("canvas");$.width=g,$.height=v;const M=$.getContext("2d"),A=M.createImageData(g,v),L=A.data;let{r:S,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){L[n+3]=0;continue}({r:S,g:z,b:O}=e.rgb(r))}b&&(E=255*b[t+k]),L[n+0]=S,L[n+1]=z,L[n+2]=O,L[n+3]=E}return this.blur>0&&e.blurImage(A,this.blur),M.putImageData(A,0,0),vo("svg:g",i).call(_o,this,o,i).call(Uo,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(Ho,"image-rendering",this.imageRendering).call(Go,this).attr("xlink:href",$.toDataURL()))).node()}}function Lu(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(!Zt(t))return!1;for(const e of t)if(null!=e)return"object"==typeof e&&"0"in e&&"1"in e}(e)&&(r=rt,o=ot,void 0===i&&(i=at)),[e,{...a,x:r,y:o,[t]:i}]}function Su({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 zu({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),Su(kn(l,o),i,a)}function Ou(t,e={}){const{[t]:n}=e;if("function"!=typeof n)throw new Error(`invalid ${t}: not a function`);return Re({...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]=zu(i,a,l,s),m=d-f,y=p-h,{pixelSize:g}=this,{width:v=Math.round(Math.abs(m)/g),height:x=Math.round(Math.abs(y)/g)}=e,w=new Array(v*x*(o?o.length:1)),b=m/v,k=y/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 Eu(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 Ru({random:t=e.randomLcg(42)}={}){return(n,r,o,i,a,l)=>{const{points:s,triangles:c,hull:u}=e.Delaunay.from(n,(t=>i[t]),(t=>a[t])),f=new l.constructor(r*o).fill(NaN),h=new Uint8Array(r*o),d=function(t,e){return ne(t)||Kt(t)?Iu: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<c.length;t+=3){const e=c[t],i=c[t+1],a=c[t+2],u=s[2*e],p=s[2*i],m=s[2*a],y=s[2*e+1],g=s[2*i+1],v=s[2*a+1],x=Math.min(u,p,m),w=Math.max(u,p,m),b=Math.min(y,g,v),k=Math.max(y,g,v),$=(g-v)*(u-m)+(y-v)*(m-p);if(!$)continue;const M=l[n[e]],A=l[n[i]],L=l[n[a]];for(let t=Math.floor(x);t<w;++t)for(let e=Math.floor(b);e<k;++e){if(t<0||t>=r||e<0||e>=o)continue;const n=t+.5,i=e+.5,a=Math.sign($),l=(g-v)*(n-m)+(i-v)*(m-p);if(l*a<0)continue;const s=(v-y)*(n-m)+(i-v)*(u-m);if(s*a<0)continue;const c=$-(l+s);if(c*a<0)continue;const x=t+r*e;f[x]=d(M,l/$,A,s/$,L,c/$,t,e),h[x]=1}}return function(t,e,n,r,o,i,a,l,s,c){n=Float64Array.from(l,(t=>n[s[t]])),r=Float64Array.from(l,(t=>r[s[t]])),o=Array.from(l,(t=>o[s[t]]));const u=n.length,f=Array.from({length:u},((t,e)=>function(t,e,n){const r=e.length,o=e.at(t-2),i=n.at(t-2),a=e.at(t-1),l=n.at(t-1),s=e[t],c=n[t],u=e.at(t+1-r),f=n.at(t+1-r),h=a-s,d=l-c,p=o-a,m=i-l,y=s-u,g=c-f,v=Math.hypot(h,d),x=Math.hypot(p,m),w=Math.hypot(y,g);return(t,e)=>{const n=t-a,r=e-l,o=t-s,i=e-c;return Nu(n,r,o,i)>-1e-6&&Nu(n,r,h,d)*x-Nu(n,r,p,m)*v>-1e-6&&Nu(o,i,y,g)*v-Nu(o,i,h,d)*w<=0}}(e,n,r)));let h=0;for(let l=0;l<a;++l){const a=l+.5;for(let s=0;s<i;++s){const d=s+i*l;if(!e[d]){const e=s+.5;for(let i=0;i<u;++i){const p=(u+h+(i%2?(i+1)/2:-i/2))%u;if(f[p](e,a)){const i=Cu(n.at(p-1),r.at(p-1),n[p],r[p],e,a);t[d]=c(o.at(p-1),i,o[p],1-i,o[p],0,s,l),h=p;break}}}}}}(f,h,i,a,l,r,o,u,n,d),f}}function Cu(t,e,n,r,o,i){const a=n-t,l=r-e,s=a*(n-o)+l*(r-i),c=a*(o-t)+l*(i-e);return s>0&&c>0?s/(s+c):+(s>c)}function Nu(t,e,n,r){return t*r-n*e}function Tu(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 Bu({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,y=a,g=e;p=d=f.find(y,g,d),.5===a&&(h=d);let v=0;for(;(i=Math.hypot(l[o[p]]-y,s[o[p]]-g))>n&&v<r;){const n=2*t(a,e,v)*Math.PI;y+=Math.cos(n)*i,g+=Math.sin(n)*i,p=f.find(y,g,p),++v}u[m]=c[o[p]]}}return u}}function Iu(t,e,n,r,o,i){return e*t+r*n+i*o}const Pu={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2};class Wu extends Mu{constructor(t,{smooth:n=!0,value:r,...o}={}){const i=No({},o,Pu);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:qt(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=Ou("value",{value:r,...o}),r=null}else{let{interpolate:t}=o;void 0===r&&(r=Q),void 0===t&&(o.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},function({thresholds:t,interval:n,...r}){return t=Is(t,n,e.thresholdSturges),Re(r,(function(n,r,o,i,a,l){const[s,c,u,f]=zu(o,i,a,l),h=u-s,d=f-c,{pixelSize:p,width:m=Math.round(Math.abs(h)/p),height:y=Math.round(Math.abs(d)/p)}=this,g=m/h,v=y/d,x=o.value.value,w=[];if(this.interpolate){const{x:t,y:e}=mo(o,i,l),n=wt(t,(t=>(t-s)*g),Float64Array),a=wt(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,y,n,a,x))}}else if(r){const t=m*y,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:y},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 vt(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,ju))),e.max(t,(t=>e.max(t,ju)))]}(w));if(null===b)throw new Error(`unsupported thresholds: ${t}`);const{contour:k}=e.contours().size([m,y]).smooth(this.smooth),$=[],M=[];for(const t of w)M.push(e.range($.length,$.push(...wt(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]/g+s,e[1]=e[1]/v+c;return{data:$,facets:M,channels:bn(this.contourChannels,$)}}))}(o),Pu);const a={geometry:{value:Q}};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 vo("svg:g",i).call(_o,this,o,i).call(Uo,this,n).call((e=>{e.selectAll().data(t).enter().append("path").call(Go,this).attr("d",(t=>l(a[t]))).call(Io,this,r)})).node()}}function ju(t){return isFinite(t)?t:NaN}function Fu(t,e,n={}){const{x:r,y:o,maxRadius:i}=n,a=t({px:r,py:o,maxRadius:i}),l=[];null!=r&&l.push(Gi(e,Yu("x",{...a,inset:-6},n))),null!=o&&l.push(Xi(e,Yu("y",{...a,inset:-6},n))),null!=r&&l.push(Ki(e,_u("x",{...a,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),null!=o&&l.push(Ki(e,_u("y",{...a,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(const t of l)t.ariaLabel=`crosshair ${t.ariaLabel}`;return ni(...l)}function qu(t,{channels:e,...n},{facet:r,facetAnchor:o,fx:i,fy:a,[t]:l,channels:s,transform:c,initializer:u}){return{...n,facet:r,facetAnchor:o,fx:i,fy:a,[t]:l,channels:{...e,...s},transform:c,initializer:Du(t,u)}}function Du(t,e){return null==e?e:function(n,r,{x:o,y:i,px:a,py:l,...s},...c){const{channels:{x:u,y:f,...h}={},...d}=e.call(this,n,r,{...s,x:a,y:l},...c);return{channels:{...h,...u&&{px:u,..."x"===t&&{x:u}},...f&&{py:f,..."y"===t&&{y:f}}},...d}}}function Yu(t,e,n){const{color:r="currentColor",opacity:o=.2,ruleStroke:i=r,ruleStrokeOpacity:a=o,ruleStrokeWidth:l}=n;return{...qu(t,e,n),stroke:i,strokeOpacity:a,strokeWidth:l}}function _u(t,e,n){const{color:r="currentColor",textFill:o=r,textFillOpacity:i,textStroke:a="var(--plot-background)",textStrokeOpacity:l,textStrokeWidth:s=5}=n;return{...qu(t,e,Gu(t,n)),fill:o,fillOpacity:i,stroke:a,strokeOpacity:l,strokeWidth:s}}function Gu(t,e){return Re(e,((e,n,r)=>({channels:{text:{value:Rn(r,t)?.value}}})))}const Xu={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Hu={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Uu={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Vu={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Zu={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2};class Ju extends ei{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,Xu),this.curve=$s(i,a),gi(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]=ti(this,o),p=s?t=>s[t]:lt(h),m=c?t=>c[t]:lt(d),y=this;function g(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:g,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<g.length;++t)h(g[t],g[(t+1)%g.length]);e.select(this).selectAll().data(o).enter().append("path").call(Go,y).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(Io,y,a).call(Ai,y,a,i)}return vo("svg:g",i).call(_o,this,o,i).call(Uo,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 Qu extends ei{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]=ti(this,o),d=s?t=>s[t]:lt(f),p=c?t=>c[t]:lt(h),m=this;function y(t){const n=e.Delaunay.from(t,d,p);e.select(this).append("path").datum(t[0]).call(Go,m).attr("d",m._render(n,o)).call(Io,m,r)}return vo("svg:g",i).call(_o,this,o,i).call(Uo,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 Ku extends Qu{constructor(t,e={}){super(t,e,Hu),this.fill="none"}_render(t){return t.render()}}class tf extends Qu{constructor(t,e={}){super(t,e,Uu,Rt)}_render(t){return t.renderHull()}}class ef extends ei{constructor(t,r={}){const{x:o,y:i,z:a}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:a,optional:!0}},Re(r,(function(t,r,o,i,a,l){let{x:s,y:c,z:u}=o;({x:s,y:c}=mo(o,i,l)),u=u?.value;const f=new Array((s??c).length).fill(null),[h,d]=ti(this,a),p=s?t=>s[t]:lt(h),m=c?t=>c[t]:lt(d);for(let t of r){s&&(t=t.filter((t=>n(p(t))))),c&&(t=t.filter((t=>n(m(t)))));for(const[,n]of Ze(t,u)){const t=rf(e.Delaunay.from(n,p,m),a);for(let e=0,r=n.length;e<r;++e)f[n[e]]=t.renderCell(e)}}return{data:t,facets:r,channels:{cells:{value:f}}}})),Vu)}render(t,e,n,r,o){const{x:i,y:a}=e,{x:l,y:s,cells:c}=n;return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,{x:l&&i,y:s&&a}).call((e=>{e.selectAll().data(t).enter().append("path").call(Go,this).attr("d",(t=>c[t])).call(Io,this,n)})).node()}}class nf extends Qu{constructor(t,e){super(t,e,Zu),this.fill="none"}_render(t,e){return rf(t,e).render()}}function rf(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 of(t,e,{x:n,y:r,...o}={}){return[n,r]=Et(n,r),new t(e,{...o,x:n,y:r})}const af={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1};class lf extends ei{constructor(t,{x:n,y:r,z:o,weight:i,fill:a,stroke:l,...s}={}){const c=cf(a)&&(a="currentColor",!0),u=cf(l)&&(l="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Rt({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]?ct(a):+a,Re(t,(function(t,l,s,c,u,f){const h=s.weight?ct(s.weight.value):null,d=s.z?.value,{z:p}=this,[m,y]=ti(this,u),{width:g,height:v}=u,{x:x,y:w}=mo(s,c,f),b=Object.fromEntries(Object.entries(s).filter((([t])=>!sf.has(t))).map((([t,e])=>[t,{...e,value:[]}]))),k=n&&[],$=r&&[],M=e.contourDensity().x(x?t=>x[t]:m).y(w?t=>w[t]:y).weight(h?t=>h[t]:1).size([g,v]).bandwidth(i),A=[];for(const t of l){const e=[];A.push(e);for(const n of d?Wo(t,d,p):[t]){const t=M.contours(n);e.push([n,t])}}let L=a;if(!(L instanceof W)){let t=0;for(const e of A)for(const[,n]of e){const e=n.max;e>t&&(t=e)}L=Float64Array.from({length:a-1},((e,n)=>t*o*(n+1)/a))}const S=[],z=[];for(const t of A){const e=[];S.push(e);for(const[n,r]of t)for(const t of L){e.push(z.length),z.push(r(t/o)),k&&k.push(t),$&&$.push(t);for(const t in b)b[t].value.push(s[t].value[n[0]])}}return k&&k.push(0),$&&$.push(0),{data:t,facets:S,channels:{...b,...k&&{fill:{value:k,scale:"color"}},...$&&{stroke:{value:$,scale:"color"}},contours:{value:z}}}}))}({...s,fill:a,stroke:l},c,u),af),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 vo("svg:g",i).call(_o,this,o,i).call(Uo,this,{}).call((e=>e.selectAll().data(t).enter().append("path").call(Go,this).call(Io,this,r).attr("d",(t=>l(a[t]))))).node()}}const sf=new Set(["x","y","z","weight"]);function cf(t){return/^density$/i.test(t)}function uf(t,e,{x1:n,x2:r,y1:o,y2:i,x:a=(void 0===n&&void 0===r?"y"===t?J:Q:void 0),y:l=(void 0===o&&void 0===i?"x"===t?J:Q:void 0),fill:s,positiveFill:c="#3ca951",negativeFill:u="#4269d0",fillOpacity:f=1,positiveFillOpacity:h=f,negativeFillOpacity:d=f,stroke:p,strokeOpacity:m,z:y=dt(p)[0],clip:g,tip:v,render:x,...w}={}){return[n,r]=ff(a,n,r),[o,i]=ff(l,o,i),n===r&&o===i&&("y"===t?o=hf(0):n=hf(0)),({tip:v}=ii({tip:v},"y"===t?"x":"y")),ni(le(c)?null:Object.assign(tc(e,{x1:n,x2:r,y1:o,y2:i,z:y,fill:c,fillOpacity:h,render:ri(x,df(t,!0)),clip:g,...w}),{ariaLabel:"positive difference"}),le(u)?null:Object.assign(tc(e,{x1:n,x2:r,y1:o,y2:i,z:y,fill:u,fillOpacity:d,render:ri(x,df(t,!1)),clip:g,...w}),{ariaLabel:"negative difference"}),Lc(e,{x:r,y:i,z:y,stroke:p,strokeOpacity:m,tip:v,clip:!0,...w}))}function ff(t,e,n){return void 0===e&&void 0===n?e=n=hf(t):void 0===e?(n=hf(n),e=void 0===t?n:hf(t)):void 0===n?(e=hf(e),n=void 0===t?e:hf(t)):(e=hf(e),n=hf(n)),[e,n]}function hf(t){let e;const{value:n,label:r=qt(n)}=Vt(t);return{transform:t=>e||(e=_(t,n)),label:r}}function df(t,e){const n="x"===t?"y":"x",r=`${n}1`,o=`${n}2`,i=`${t}1`,a=`${t}2`;return(n,l,s,c,u,f)=>{const{[r]:h,[o]:d}=s,p=new Float32Array(h.length),m=new Float32Array(d.length),y=c["y"===t?"height":"width"];(e===Ar(l[t])<0?p:m).fill(y);const g=f(n,l,{...s,[o]:h,[a]:m},c,u),v=f(n,l,{...s,[r]:d,[i]:p},c,u),x=g.querySelector("g")??g,w=v.querySelector("g")??v;for(let t=0;x.firstChild;t+=2){const e=Co(),n=vo("svg:clipPath",u).attr("id",e).node();n.appendChild(x.firstChild),w.childNodes[t].setAttribute("clip-path",`url(#${e})`),w.insertBefore(n,w.childNodes[t])}return v}}function pf({geometry:t=Q,...e}={}){const n=wo((e=>_(e,t)));return Re({...e,x:null,y:null,geometry:{transform:n}},((t,e,r,o,i,a)=>{const l=n(t),s=l.length,c=new Float64Array(s),u=new Float64Array(s),{centroid:f}=a.path();for(let t=0;t<s;++t)[c[t],u[t]]=f(l[t]);return{data:t,facets:e,channels:{x:{value:c,scale:null,source:null},y:{value:u,scale:null,source:null}}}}))}const mf={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class yf extends ei{constructor(t,e={}){const[n,r]=pt(e.r,3);super(t,{x:{value:e.tip?e.x:null,scale:"x",optional:!0},y:{value:e.tip?e.y:null,scale:"y",optional:!0},r:{value:n,scale:"r",filter:l,optional:!0},geometry:{value:e.geometry,scale:"projection"}},bc(e),mf),this.r=r}render(t,e,n,r,o){const{geometry:i,r:a}=n,l=o.path(),{r:c}=this;return s(c)?t=[]:void 0!==c&&l.pointRadius(c),vo("svg:g",o).call(_o,this,r,o).call(Uo,this,e).call((e=>{e.selectAll().data(t).enter().append("path").call(Go,this).attr("d",a?t=>l.pointRadius(a[t])(i[t]):t=>l(i[t])).call(Io,this,n)})).node()}}function gf(t,e={}){return e.tip&&void 0===e.x&&void 0===e.y?e=pf(e):void 0===e.geometry&&(e={...e,geometry:Q}),new yf(t,e)}const vf=.5;function xf(t,e,n,r,o){const i=o*(1.5/$e),a=new Map;for(const l of e){let e=n[l],s=r[l];if(isNaN(e)||isNaN(s))continue;let c=Math.round(s=(s-0)/i),u=Math.round(e=(e-vf)/o-(1&c)/2),f=s-c;if(3*Math.abs(f)>1){let t=e-u,n=u+(e<u?-1:1)/2,r=c+(s<c?-1:1),o=e-n,i=s-r;t*t+f*f>o*o+i*i&&(u=n+(1&c?1:-1)/2,c=r)}const h=`${u},${c}`;let d=a.get(h);void 0===d&&(d={index:[],extent:{data:t,x:(u+(1&c)/2)*o+vf,y:c*i+0}},a.set(h,d)),d.index.push(l)}return a.values()}const wf={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};class bf extends ei{constructor({binWidth:t=20,clip:e=!0,...n}={}){super(V,void 0,{clip:e,...n},wf),this.binWidth=nt(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-vf,d=u-l-vf,p=a-0,m=f-s-0,y=i/2,g=y*Me,v=g/2,x=2*y,w=1.5*g,b=Math.floor(h/x),k=Math.ceil(d/x),$=Math.floor((p+v)/w),M=Math.ceil((m-v)/w)+1,A=`m0,${kf(-g)}l${kf(y)},${kf(v)}v${kf(g)}l${kf(-y)},${kf(v)}`;let L=A;for(let t=$;t<M;++t)for(let e=b;e<k;++e)L+=`M${kf(e*x+(1&t)*y)},${kf(t*w)}${A}`;return vo("svg:g",o).datum(0).call(_o,this,r,o).call(Uo,this,{},Oo+vf,Oo+0).call((t=>t.append("path").call(Go,this).call(Io,this,n).attr("d",L))).node()}}function kf(t){return Math.round(1e3*t)/1e3}const $f={ariaLabel:"image",fill:null,stroke:null};class Mf extends ei{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(y=c)&&(function(t){return/^\.*\//.test(t)}(y)||function(t){return/^(blob|data|file|http|https):/i.test(t)}(y))?[void 0,y]:[y,void 0];var y;const[g,v]=pt(o),[x,w]=pt(i,void 0!==v?2*v:void 0),[b,k]=pt(a,void 0!==v?2*v:void 0),[$,M]=pt(s,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},r:{value:g,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}},bc(e),$f),this.src=m,this.width=w,this.rotate=M,this.height=k,this.r=v,this.preserveAspectRatio=Vo(u,"xMidYMid"),this.crossOrigin=et(f),this.frameAnchor=ue(h),this.imageRendering=Vo(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:y,rotate:g}=this,[v,x]=ti(this,r);return vo("svg:g",o).call(_o,this,r,o).call(Uo,this,{x:l&&i,y:s&&a}).call((e=>e.selectAll().data(t).enter().append("image").call(Go,this).attr("x",Af(l,c,f,v,m,p)).attr("y",Af(s,u,f,x,y,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!==y?y:f?t=>2*f[t]:2*p).attr("transform",h?t=>`rotate(${h[t]})`:g?`rotate(${g})`:null).attr("transform-origin",h||g?Ui`${l?t=>l[t]:v}px ${s?t=>s[t]:x}px`:null).call(Ho,"href",d?t=>d[t]:this.src).call(Ho,"preserveAspectRatio",this.preserveAspectRatio).call(Ho,"crossorigin",this.crossOrigin).call(Ho,"image-rendering",this.imageRendering).call(Ho,"clip-path",f?t=>`circle(${f[t]}px)`:void 0!==p?`circle(${p}px)`:null).call(Io,this,n))).node()}}function Af(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 Lf(t,e,n){var r=0===t||1===t?0:Math.exp(zf(e+n)-zf(e)-zf(n)+e*Math.log(t)+n*Math.log(1-t));return!(t<0||t>1)&&(t<(e+1)/(e+n+2)?r*Sf(t,e,n)/e:1-r*Sf(1-t,n,e)/n)}function Sf(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 zf(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 Of(t,e){var n=function(t,e,n){var r,o,i,a,l,s,c,u=e-1,f=n-1,h=0;if(t<=0)return 0;if(t>=1)return 1;for(r=Math.log(e/(e+n)),o=Math.log(n/(e+n)),l=t<(i=Math.exp(e*r)/e)/(s=i+(a=Math.exp(n*o)/n))?Math.pow(e*s*t,1/e):1-Math.pow(n*s*(1-t),1/n),c=-zf(e)-zf(n)+zf(e+n);h<10;h++){if(0===l||1===l)return l;if((l-=i=(a=(Lf(l,e,n)-t)/(i=Math.exp(u*Math.log(l)+f*Math.log(1-l)+c)))/(1-.5*Math.min(1,a*(u/l-f/(1-l)))))<=0&&(l=.5*(l+i)),l>=1&&(l=.5*(l+i+1)),Math.abs(i)<1e-8*l&&h>0)break}return l}(2*Math.min(t,1-t),.5*e,.5);return n=Math.sqrt(e*(1-n)/n),t>.5?n:-n}const Ef={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1};class Rf extends ei{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:Rt(e),optional:!0}},e,Ef),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 vo("svg:g",o).call(_o,this,r,o).call(Uo,this,e).call((e=>e.selectAll().data(l?Wo(t,l,this.z):[t]).enter().call((t=>t.append("path").attr("fill","none").call(Go,this).call(Po,this,{...n,fill:null,fillOpacity:null}).attr("d",(t=>this._renderLine(t,i,a))).call(s&&!se(this.fill)?t=>t.select(Cf).attr("stroke","none").call(Go,this).call(Po,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",(t=>this._renderBand(t,i,a))):()=>{}))))).node()}}function Cf(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(e.namespaces.svg,"path"),this)}class Nf extends Rf{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=Bf(t,r,n),c=If(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=Bf(t,r,n);return`M${a(o)},${o}L${a(i)},${i}`}}class Tf extends Rf{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=Bf(t,n,r),c=If(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=Bf(t,n,r);return`M${o},${a(o)}L${i},${a(i)}`}}function Bf(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 If(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=Of(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 Pf({path:t=Q,delimiter:n,frameAnchor:r,treeLayout:o=e.tree,treeSort:i,treeSeparation:a,treeAnchor:l,treeFilter:s,...c}={}){l=jf(l),i=Df(i),null!=s&&(s=Uf(s)),void 0===r&&(r=l.frameAnchor);const u=_f(n),f=lh(c,Uf),[h,d]=jt(),[p,m]=jt();return{x:h,y:p,frameAnchor:r,...Ee(c,((n,r)=>{const c=u(_(n,t)),h=d([]),p=m([]);let y=-1;const g=[],v=[],x=e.stratify().path((t=>c[t])),w=F(n)?t=>t.data=n[t.data]:t=>t.data=n.get(t.data),b=o();b.nodeSize&&b.nodeSize([1,1]),b.separation&&void 0!==a&&b.separation(a??K);for(const t of f)t[ah]=t[oh]([]);for(const t of r){const e=[],n=x(t.filter((t=>null!=c[t]))).each(w);null!=i&&n.sort(i),b(n);for(const t of n.descendants())if(null==s||s(t)){e.push(++y),g[y]=t.data,l.position(t,y,h,p);for(const e of f)e[ah][y]=e[ih](t)}v.push(e)}return{data:g,facets:v}})),...Object.fromEntries(f)}}function Wf({path:t=Q,delimiter:n,curve:r="bump-x",stroke:o="#555",strokeWidth:i=1.5,strokeOpacity:a=.5,treeLayout:l=e.tree,treeSort:s,treeSeparation:c,treeAnchor:u,treeFilter:f,...h}={}){u=jf(u),s=Df(s),null!=f&&(f=Vf(f)),h={curve:r,stroke:o,strokeWidth:i,strokeOpacity:a,...h};const d=_f(n),p=lh(h,Vf),[m,y]=jt(),[g,v]=jt(),[x,w]=jt(),[b,k]=jt();return{x1:m,x2:g,y1:x,y2:b,...Ee(h,((n,r)=>{const o=d(_(n,t)),i=y([]),a=v([]),h=w([]),m=k([]);let g=-1;const x=[],b=[],$=e.stratify().path((t=>o[t])),M=l();M.nodeSize&&M.nodeSize([1,1]),M.separation&&void 0!==c&&M.separation(c??K);for(const t of p)t[ah]=t[oh]([]);for(const t of r){const e=[],r=$(t.filter((t=>null!=o[t]))).each((t=>t.data=n[t.data]));null!=s&&r.sort(s),M(r);for(const{source:t,target:n}of r.links())if(null==f||f(n,t)){e.push(++g),x[g]=n.data,u.position(t,g,i,h),u.position(n,g,a,m);for(const e of p)e[ah][g]=e[ih](n,t)}b.push(e)}return{data:x,facets:b}})),...Object.fromEntries(p)}}function jf(t="left"){switch(`${t}`.trim().toLowerCase()){case"left":return Ff;case"right":return qf}throw new Error(`invalid tree anchor: ${t}`)}const Ff={frameAnchor:"left",dx:6,position({x:t,y:e},n,r,o){r[n]=e,o[n]=-t}},qf={frameAnchor:"right",dx:-6,position({x:t,y:e},n,r,o){r[n]=-e,o[n]=-t}};function Df(t){return null==t||"function"==typeof t?t:`${t}`.trim().toLowerCase().startsWith("node:")?Yf(Uf(t)):Yf(function(t){return e=>e.data?.[t]}(t))}function Yf(t){return(e,n)=>r(t(e),t(n))}function _f(t="/"){if("/"===(t=`${t}`))return t=>t;if(1!==t.length)throw new Error("delimiter must be exactly one character");const e=t.charCodeAt(0);return t=>t.map((t=>function(t,e){if(e===Gf)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,o=t.length;r<o;++r){switch(t.charCodeAt(r)){case Gf:if(!n){n=!0;continue}break;case e:n?(t=t.slice(0,r-1)+t.slice(r),--r,--o):t=t.slice(0,r)+"/"+t.slice(r+1);break;case Xf:n?(t=t.slice(0,r)+"\\\\"+t.slice(r),r+=2,o+=2):(t=t.slice(0,r)+"\\"+t.slice(r),++r,++o)}n=!1}return t}(t,e)))}const Gf=92,Xf=47;function Hf(t){return At(t)&&"function"==typeof t.node}function Uf(t){if(Hf(t))return t.node;if((t=`${t}`.trim().toLowerCase()).startsWith("node:")){switch(t){case"node:name":return Jf;case"node:path":return Zf;case"node:internal":return th;case"node:external":return eh;case"node:depth":return Qf;case"node:height":return Kf}throw new Error(`invalid node value: ${t}`)}}function Vf(t){if(Hf(t))return t.node;if(At(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 nh(Jf);case"parent:path":return nh(Zf);case"parent:depth":return nh(Qf);case"parent:height":return nh(Kf);case"node:name":return Jf;case"node:path":return Zf;case"node:internal":return th;case"node:external":return eh;case"node:depth":return Qf;case"node:height":return Kf}throw new Error(`invalid link value: ${t}`)}}function Zf(t){return t.id}function Jf(t){return function(t){let e=t.length;for(;--e>0&&!rh(t,e););return function(t){let e=!1;for(let n=0,r=t.length;n<r;++n){switch(t.charCodeAt(n)){case Gf:if(!e){e=!0;continue}case Xf:e&&(t=t.slice(0,n-1)+t.slice(n),--n,--r)}e=!1}return t}(t.slice(e+1))}(t.id)}function Qf(t){return t.depth}function Kf(t){return t.height}function th(t){return!!t.children}function eh(t){return!t.children}function nh(t){return(e,n)=>null==n?void 0:t(n)}function rh(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}const oh=2,ih=3,ah=4;function lh(t,e){const n=[];for(const r in t){const o=t[r],i=e(o);void 0!==i&&n.push([r,...jt(o),i])}return n}function sh(t,{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=le(h)&&le(d),text:m="node:name",textStroke:y="var(--plot-background)",title:g="node:path",dx:v,dy:x,textAnchor:w,treeLayout:b=e.tree,textLayout:k=(b===e.tree||b===e.cluster?"mirrored":"normal"),tip:$,...M}={}){if(void 0===v&&(v=jf(M.treeAnchor).dx),void 0!==w)throw new Error("textAnchor is not a configurable tree option");function A(e){return Ki(t,Pf({treeLayout:b,text:m,fill:void 0===n?"currentColor":n,stroke:y,dx:v,dy:x,title:g,...e,...M}))}return k=yt(k,"textLayout",["mirrored","normal"]),ni(ic(t,Wf({treeLayout:b,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,...M})),p?$c(t,Pf({treeLayout:b,fill:void 0===n?"node:internal":n,title:g,tip:$,...M})):null,null!=m?"mirrored"===k?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-v})]:A():null)}const ch={ariaLabel:"waffle"};class uh extends dc{constructor(t,{unit:e=1,gap:n=1,round:r,multiple:o,...i}={}){super(t,hh("x",i),ch),this.unit=Math.max(0,e),this.gap=+n,this.round=mh(r),this.multiple=yh(o)}}class fh extends pc{constructor(t,{unit:e=1,gap:n=1,round:r,multiple:o,...i}={}){super(t,hh("y",i),ch),this.unit=Math.max(0,e),this.gap=+n,this.round=mh(r),this.multiple=yh(o)}}function hh(t,n){const r="y"===t?"x":"y",o=`${t}1`,i=`${t}2`;return Re(function({render:t,...n}){return{...n,render:ri(t,(function(t,n,r,o,i){const{gap:a,rx:l,ry:s}=this,{channels:c,ariaLabel:u,href:f,title:h,...d}=r,{document:p}=i,m=c.polygon.value,[y,g]=c.cx.value,[v,x]=c.cy.value,w="plot-pattern-"+ ++Ro,b=p.createElementNS(e.namespaces.svg,"pattern");b.setAttribute("width",y),b.setAttribute("height",v),b.setAttribute("patternUnits","userSpaceOnUse");const k=b.appendChild(p.createElementNS(e.namespaces.svg,"rect"));return k.setAttribute("x",a/2),k.setAttribute("y",a/2),k.setAttribute("width",y-a),k.setAttribute("height",v-a),null!=l&&k.setAttribute("rx",l),null!=s&&k.setAttribute("ry",s),vo("svg:g",i).call(_o,this,o,i).call(this._transform,this,n).call((e=>e.selectAll().data(t).enter().append((()=>b.cloneNode(!0))).attr("id",(t=>`${w}-${t}`)).select("rect").call(Go,this).call(Io,this,d))).call((e=>e.selectAll().data(t).enter().append("path").attr("transform",Ui`translate(${g},${x})`).attr("d",(t=>`M${m[t].join("L")}Z`)).attr("fill",(t=>`url(#${w}-${t})`)).attr("stroke",null==this.stroke?null:"none").call(Io,this,{ariaLabel:u,href:f,title:h}))).node()}))}}(n),(function(e,n,a,l,s){const{round:c,unit:u}=this,f=a[o].value,h=a[i].value,d=kn({...r in a&&{[r]:a[r]},[o]:a[o],[i]:a[i]},l),p=this["y"===t?"_width":"_height"](l,d,s),m=this["y"===t?"_x":"_y"](l,d,s),y=u*function({domain:t,range:e}){return gh(e)/gh(t)}(l.scales[t]),{multiple:g=Math.max(1,Math.floor(Math.sqrt(p/y)))}=this,v=Math.min(p/g,y*g),x=y*g,w=(p-g*v)/2,b="function"==typeof m?t=>m(t)+w:m+w,k=l[t](0),$="y"===t?([t,e])=>[t*v,-e*x]:([t,e])=>[e*x,t*v],M="function"==typeof b?t=>b(t)-p/2:()=>b,[A,L]="y"===t?[0,1]:[1,0],S=h.length,z=new Array(S),O=new Float64Array(S),E=new Float64Array(S);for(let t=0;t<S;++t){z[t]=dh(c(f[t]/u),c(h[t]/u),g).map($);const e=z[t].pop();O[t]=e[A]+M(t),E[t]=e[L]+k}return{channels:{polygon:{value:z,source:null,filter:null},[`c${r}`]:{value:[v,b],source:null,filter:null},[`c${t}`]:{value:[x,k],source:null,filter:null},[r]:{value:O,scale:null,source:null},[o]:{value:E,scale:null,source:a[o]},[i]:{value:E,scale:null,source:a[i]}}}}))}function dh(t,e,n){if(e<t)return dh(e,t,n);if(t<0)return function(t,e,n,r){return dh(t+r*n,e+r*n,n).map((([t,e])=>[t,e-r]))}(t,e,n,Math.ceil(-Math.min(t,e)/n));const r=Math.floor(t%n),o=Math.ceil(t%n),i=Math.floor(e%n),a=Math.ceil(e%n),l=Math.floor(t/n),s=Math.ceil(t/n),c=Math.floor(e/n),u=Math.ceil(e/n),f=[];return u>s&&f.push([0,s]),f.push([r,s],[r,l+t%1],[o,l+t%1]),t%n>n-1||(f.push([o,l]),c>l&&f.push([n,l])),c>l&&f.push([n,c]),f.push([a,c],[a,c+e%1],[i,c+e%1]),e%n<1||(f.push([i,u]),u>s&&f.push([0,u])),f.push(function(t,e,n){const r=Math.floor(e/n)-Math.floor(t/n);return 0===r?ph(t,e,n):1===r?Math.floor(e%n)>Math.ceil(t%n)?[(Math.floor(e%n)+Math.ceil(t%n))/2,Math.floor(e/n)]:e%n>n-t%n?ph(e-e%n,e,n):ph(t,n*Math.ceil(t/n),n):[n/2,(Math.round(t/n)+Math.round(e/n))/2]}(t,e,n)),f}function ph(t,e,n){const r=Math.floor(e)-Math.floor(t);return 0===r?[Math.floor(t%n)+.5,Math.floor(t/n)+(t+e)/2%1]:1===r?e%1-t%1>.5?[Math.ceil(t%n),Math.floor(e/n)+(t%1+e%1)/2]:e%1>1-t%1?[Math.floor(e%n)+.5,Math.floor(e/n)+e%1/2]:[Math.floor(t%n)+.5,Math.floor(t/n)+(1+t%1)/2]:[Math.ceil(t%n)+Math.ceil(Math.floor(e)-Math.ceil(t))/2,Math.floor(t/n)+(e>=1+t?.5:(t+e)/2%1)]}function mh(t){if(void 0===t||!1===t)return Number;if(!0===t)return Math.round;if("function"!=typeof t)throw new Error(`invalid round: ${t}`);return t}function yh(t){return void 0===t?void 0:Math.max(1,Math.floor(t))}function gh(t){const[n,r]=e.extent(t);return r-n}function vh(t){return!0===t?{maxRadius:1/0}:At(t)&&void 0===t.maxRadius?{...t,maxRadius:1/0}:void 0}function xh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var wh,bh,kh,$h;var Mh=function(){if($h)return kh;$h=1;var t=function(){if(bh)return wh;function t(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 e(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 n(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 r(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 o(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 i(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)}return bh=1,wh={ge:function(e,n,r,o,a){return i(e,n,r,o,a,t)},gt:function(t,n,r,o,a){return i(t,n,r,o,a,e)},lt:function(t,e,r,o,a){return i(t,e,r,o,a,n)},le:function(t,e,n,o,a){return i(t,e,n,o,a,r)},eq:function(t,e,n,r,a){return i(t,e,n,r,a,o)}}}();function e(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}kh=function(t){if(!t||0===t.length)return new p(null);return new p(d(t))};var n=e.prototype;function r(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 o(t,e){var n=d(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 i(t,e){var n=t.intervals([]);n.push(e),o(t,n)}function a(t,e){var n=t.intervals([]),r=n.indexOf(e);return r<0?0:(n.splice(r,1),o(t,n),1)}function l(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 s(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 c(t,e){for(var n=0;n<t.length;++n){var r=e(t[n]);if(r)return r}}function u(t,e){return t-e}function f(t,e){var n=t[0]-e[0];return n||t[1]-e[1]}function h(t,e){var n=t[1]-e[1];return n||t[0]-e[0]}function d(t){if(0===t.length)return null;for(var n=[],r=0;r<t.length;++r)n.push(t[r][0],t[r][1]);n.sort(u);var o=n[n.length>>1],i=[],a=[],l=[];for(r=0;r<t.length;++r){var s=t[r];s[1]<o?i.push(s):o<s[0]?a.push(s):l.push(s)}var c=l,p=l.slice();return c.sort(f),p.sort(h),new e(o,d(i),d(a),c,p)}function p(t){this.root=t}n.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},n.insert=function(e){var n=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(n+1)?i(this,e):this.left.insert(e):this.left=d([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(n+1)?i(this,e):this.right.insert(e):this.right=d([e]);else{var r=t.ge(this.leftPoints,e,f),o=t.ge(this.rightPoints,e,h);this.leftPoints.splice(r,0,e),this.rightPoints.splice(o,0,e)}},n.remove=function(e){var n=this.count-this.leftPoints;if(e[1]<this.mid)return this.left?4*(this.right?this.right.count:0)>3*(n-1)?a(this,e):2===(s=this.left.remove(e))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(e[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(n-1)?a(this,e):2===(s=this.right.remove(e))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===e?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,i=this.left;i.right;)o=i,i=i.right;if(o===this)i.right=this.right;else{var l=this.left,s=this.right;o.count-=i.count,o.right=i.left,i.left=l,i.right=s}r(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?r(this,this.left):r(this,this.right);return 1}for(l=t.ge(this.leftPoints,e,f);l<this.leftPoints.length&&this.leftPoints[l][0]===e[0];++l)if(this.leftPoints[l]===e){this.count-=1,this.leftPoints.splice(l,1);for(s=t.ge(this.rightPoints,e,h);s<this.rightPoints.length&&this.rightPoints[s][1]===e[1];++s)if(this.rightPoints[s]===e)return this.rightPoints.splice(s,1),1}return 0},n.queryPoint=function(t,e){if(t<this.mid){if(this.left)if(n=this.left.queryPoint(t,e))return n;return l(this.leftPoints,t,e)}if(t>this.mid){var n;if(this.right)if(n=this.right.queryPoint(t,e))return n;return s(this.rightPoints,t,e)}return c(this.leftPoints,e)},n.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?l(this.leftPoints,e,n):t>this.mid?s(this.rightPoints,t,n):c(this.leftPoints,n)};var m=p.prototype;return m.insert=function(t){this.root?this.root.insert(t):this.root=new e(t[0],null,null,[t],[t])},m.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},m.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},m.queryInterval=function(t,e,n){if(t<=e&&this.root)return this.root.queryInterval(t,e,n)},Object.defineProperty(m,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(m,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}}),kh}(),Ah=xh(Mh);const Lh=({marginLeft:t})=>[1,t],Sh=({width:t,marginRight:e})=>[-1,t-e],zh=({width:t,marginLeft:e,marginRight:n})=>[0,(e+t-n)/2],Oh=({marginTop:t})=>[1,t],Eh=({height:t,marginBottom:e})=>[-1,t-e],Rh=({height:t,marginTop:e,marginBottom:n})=>[0,(e+t-n)/2];function Ch(t){return"string"==typeof t?{anchor:t}:t}function Nh(t){const{anchor:e,padding:n,...r}=t,{r:o}=r;return[{anchor:e,padding:n,r:o},r]}function Th(t,e,n,r,o,i){if(null!=o&&"number"!=typeof o){let{channels:t,sort:e,reverse:n}=i;t=fe(t),void 0===t?.r&&(i={...i,channels:{...t,r:{value:o,scale:"r"}}}),void 0===e&&void 0===n&&(i.sort={channel:"-r"})}return Re(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}=mo(c,u,h));const m=p?void 0:void 0!==o?nt(o):void 0!==this.r?this.r:3;p&&(p=_(p.value,u[p.scale]||Q,Float64Array));let[y,g]=n(f);const v=y?Ih:Bh,x=new Float64Array(d.length),w=p?t=>p[t]:()=>m;for(let t of s){const e=Ah();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=w(o),i=y?t+r:0,a=d[o]-t,l=d[o]+t;let s=2;e.queryInterval(a-r,l+r,(([,,t])=>{const e=x[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);y&&(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;x[o]=t+i;break}e.insert([a,l,o])}}y||(y=1);for(const t of s)for(const e of t)x[e]=x[e]*y+g;return{data:i,facets:s,channels:{[t]:{value:x,source:null},[e]:{value:d,source:c[e]},...p&&{r:{value:p,source:c.r}}}}}))}function Bh(t,e){return Math.abs(t)-Math.abs(e)}function Ih(t,e){return t-e}function Ph(t){if(void 0===t)return qh;if("function"==typeof t)return Wh(Bt(t));if(/^p\d{2}$/i.test(t))return jh(st(t));switch(`${t}`.toLowerCase()){case"deviation":return Yh;case"first":return qh;case"last":return Dh;case"max":return _h;case"mean":return Gh;case"median":return Xh;case"min":return Hh;case"sum":return Uh;case"extent":return Fh}throw new Error(`invalid basis: ${t}`)}function Wh(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 jh(t){return Wh(((e,n)=>t(e,(t=>n[t]))))}const Fh={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}},qh=Wh(((t,e)=>{for(let r=0;r<t.length;++r){const o=e[t[r]];if(n(o))return o}})),Dh=Wh(((t,e)=>{for(let r=t.length-1;r>=0;--r){const o=e[t[r]];if(n(o))return o}})),Yh={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}},_h=jh(e.max),Gh=jh(e.mean),Xh=jh(e.median),Hh=jh(e.min),Uh=jh(e.sum);function Vh(t,n,r={}){let o,i=1;if("number"==typeof n)i=n,o=(t,e)=>+t+e;else{if("string"==typeof n){const t=n.startsWith("-")?-1:1;[n,i]=E(n.replace(/^[+-]/,"")),i*=t}n=Gt(n),o=(t,e)=>n.offset(t,e)}const a=`${t}1`,l=`${t}2`,s=Fc({[a]:t=>t.map((t=>o(t,i))),[l]:t=>t},r),c=s[l].transform;return s[l].transform=()=>{const t=c(),[n,r]=e.extent(t);return t.domain=i<0?[n,o(r,i)]:[o(n,i),r],t},s}function Zh(t){if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"min":return ed;case"max":return nd}throw new Error(`unknown selector: ${t}`)}function Jh(t){return rd(null,Kh,t)}function Qh(t){return rd(null,td,t)}function*Kh(t){yield t[0]}function*td(t){yield t[t.length-1]}function*ed(t,n){yield e.least(t,(t=>n[t]))}function*nd(t,n){yield e.greatest(t,(t=>n[t]))}function rd(t,n,r){if(null!=t){if(null==r[t])throw new Error(`missing channel: ${t}`);t=r[t]}const o=Rt(r);return Ee(r,((r,i)=>{const a=_(r,o),l=_(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}}))}ei.prototype.plot=function({marks:t=[],...e}={}){return os({...e,marks:[...t,this]})},t.Area=Ks,t.Arrow=sc,t.BarX=dc,t.BarY=pc,t.Cell=vc,t.Contour=Wu,t.Density=lf,t.Dot=kc,t.Frame=Gl,t.Geo=yf,t.Hexgrid=bf,t.Image=Mf,t.Line=Ac,t.Link=oc,t.Mark=ei,t.Raster=Au,t.Rect=Tl,t.RuleX=Yi,t.RuleY=_i,t.Text=Zi,t.TickX=hu,t.TickY=du,t.Tip=Vl,t.Vector=Aa,t.WaffleX=uh,t.WaffleY=fh,t.area=tc,t.areaX=ec,t.areaY=nc,t.arrow=function(t,{x:e,x1:n,x2:r,y:o,y1:i,y2:a,...l}={}){return[n,r]=ac(e,n,r),[i,a]=ac(o,i,a),new sc(t,{...l,x1:n,x2:r,y1:i,y2:a})},t.auto=function(t,e){const n=Oc(t,e),{fx:r,fy:o,x:{zero:i},y:{zero:a},markOptions:l,transformOptions:s,colorMode:c}=n,u=Ic[n.markImpl],f=Ic[n.transformImpl],h=null!=r||null!=o?Xl({strokeOpacity:.1}):null,d=[i?Gi([0]):null,a?Xi([0]):null],p=u(t,f?f(s,l):l);return"stroke"===c?ni(h,d,p):ni(h,p,d)},t.autoSpec=Oc,t.axisFx=Wa,t.axisFy=Ia,t.axisX=Pa,t.axisY=Ba,t.barX=mc,t.barY=yc,t.bin=zs,t.binX=Ls,t.binY=Ss,t.bollinger=cu,t.bollingerX=function(t,{x:e=Q,y:n,k:r=ou,color:o=iu,opacity:i=au,fill:a=o,fillOpacity:l=i,stroke:s=o,strokeOpacity:c,strokeWidth:u,...f}={}){return ni(le(a)?null:ec(t,Fc({x1:cu({k:-r,...f}),x2:cu({k:r,...f})},{x1:e,x2:e,y:n,fill:a,fillOpacity:l,...f})),le(s)?null:Sc(t,Fc({x:cu(f)},{x:e,y:n,stroke:s,strokeOpacity:c,strokeWidth:u,...f})))},t.bollingerY=function(t,{x:e,y:n=Q,k:r=ou,color:o=iu,opacity:i=au,fill:a=o,fillOpacity:l=i,stroke:s=o,strokeOpacity:c,strokeWidth:u,...f}={}){return ni(le(a)?null:nc(t,Fc({y1:cu({k:-r,...f}),y2:cu({k:r,...f})},{x:e,y1:n,y2:n,fill:a,fillOpacity:l,...f})),le(s)?null:zc(t,Fc({y:cu(f)},{x:e,y:n,stroke:s,strokeOpacity:c,strokeWidth:u,...f})))},t.boxX=function(t,{x:e=Q,y:n=null,r:r,fill:o="#ccc",fillOpacity:i,stroke:a="currentColor",strokeOpacity:l,strokeWidth:s=2,sort:c,...u}={}){const f=null!=n?Ye:qe;return ni(Xi(t,f({x1:gu,x2:vu},{x:e,y:n,stroke:a,strokeOpacity:l,...u})),mc(t,f({x1:"p25",x2:"p75"},{x:e,y:n,fill:o,fillOpacity:i,...u})),pu(t,f({x:"p50"},{x:e,y:n,stroke:a,strokeOpacity:l,strokeWidth:s,sort:c,...u})),$c(t,Fc({x:yu},{x:e,y:n,z:n,r:r,stroke:a,strokeOpacity:l,...u})))},t.boxY=function(t,{y:e=Q,x:n=null,r:r,fill:o="#ccc",fillOpacity:i,stroke:a="currentColor",strokeOpacity:l,strokeWidth:s=2,sort:c,...u}={}){const f=null!=n?De:qe;return ni(Gi(t,f({y1:gu,y2:vu},{x:n,y:e,stroke:a,strokeOpacity:l,...u})),yc(t,f({y1:"p25",y2:"p75"},{x:n,y:e,fill:o,fillOpacity:i,...u})),mu(t,f({y:"p50"},{x:n,y:e,stroke:a,strokeOpacity:l,strokeWidth:s,sort:c,...u})),$c(t,Fc({y:yu},{x:n,y:e,z:n,r:r,stroke:a,strokeOpacity:l,...u})))},t.cell=xc,t.cellX=function(t,{x:e=J,fill:n,stroke:r,...o}={}){return void 0===n&&void 0===dt(r)[0]&&(n=Q),new vc(t,{...o,x:e,fill:n,stroke:r})},t.cellY=function(t,{y:e=J,fill:n,stroke:r,...o}={}){return void 0===n&&void 0===dt(r)[0]&&(n=Q),new vc(t,{...o,y:e,fill:n,stroke:r})},t.centroid=pf,t.circle=function(t,e){return $c(t,{...e,symbol:"circle"})},t.cluster=function(t,n){return sh(t,{...n,treeLayout:e.cluster})},t.column=jt,t.contour=function(){return new Wu(...Lu("value",...arguments))},t.crosshair=function(t,e){return Fu(ui,t,e)},t.crosshairX=function(t,e={}){return Fu(fi,t,e)},t.crosshairY=function(t,e={}){return Fu(hi,t,e)},t.delaunayLink=function(t,e){return of(Ju,t,e)},t.delaunayMesh=function(t,e){return of(Ku,t,e)},t.density=function(t,{x:e,y:n,...r}={}){return[e,n]=Et(e,n),new lf(t,{...r,x:e,y:n})},t.differenceX=function(t,e){return uf("x",t,e)},t.differenceY=function(t,e){return uf("y",t,e)},t.dodgeX=function(t={},e={}){1===arguments.length&&([t,e]=Nh(t));let{anchor:n="left",padding:r=1,r:o=e.r}=Ch(t);switch(`${n}`.toLowerCase()){case"left":n=Lh;break;case"right":n=Sh;break;case"middle":n=zh;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Th("x","y",n,nt(r),o,e)},t.dodgeY=function(t={},e={}){1===arguments.length&&([t,e]=Nh(t));let{anchor:n="bottom",padding:r=1,r:o=e.r}=Ch(t);switch(`${n}`.toLowerCase()){case"top":n=Oh;break;case"bottom":n=Eh;break;case"middle":n=Rh;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Th("y","x",n,nt(r),o,e)},t.dot=$c,t.dotX=function(t,{x:e=Q,...n}={}){return new kc(t,qi({...n,x:e}))},t.dotY=function(t,{y:e=Q,...n}={}){return new kc(t,Fi({...n,y:e}))},t.filter=function(t,e){return Te(e,Be(t))},t.find=function(t){if("function"!=typeof t)throw new Error(`invalid test function: ${t}`);return{reduceIndex:(e,n,{data:r})=>n[e.find(F(r)?e=>t(r[e],e,r):e=>t(r.get(e),e,r))]}},t.formatIsoDate=So,t.formatMonth=function(t="en-US",e="short"){const n=Mo(t,e);return t=>null==t||isNaN(t=+new Date(Date.UTC(2e3,+t)))?void 0:n.format(t)},t.formatNumber=Lo,t.formatWeekday=function(t="en-US",e="short"){const n=Ao(t,e);return t=>null==t||isNaN(t=+new Date(Date.UTC(2001,0,+t)))?void 0:n.format(t)},t.frame=Xl,t.geo=gf,t.geoCentroid=function({geometry:t=Q,...n}={}){const r=wo((e=>_(e,t))),o=wo((t=>_(r(t),e.geoCentroid)));return{...n,x:{transform:t=>Float64Array.from(o(t),(([t])=>t))},y:{transform:t=>Float64Array.from(o(t),(([,t])=>t))},geometry:{transform:r}}},t.graticule=function({strokeOpacity:t=.1,...n}={}){return gf(e.geoGraticule10(),{strokeOpacity:t,...n})},t.gridFx=_a,t.gridFy=Da,t.gridX=Ya,t.gridY=qa,t.group=_e,t.groupX=De,t.groupY=Ye,t.groupZ=qe,t.hexagon=function(t,e){return $c(t,{...e,symbol:"hexagon"})},t.hexbin=function(t={fill:"count"},{binWidth:e,...n}={}){const{z:r}=n;return e=void 0===e?20:nt(e),Xe(t=Ke(t,n),"fill")&&(n.channels={...n.channels,fill:{value:[]}}),void 0===n.symbol&&(n.symbol="hexagon"),void 0!==n.r||Xe(t,"r")||(n.r=e/2),Re(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}=mo(i,a,s)),f=f?f.value:_(n,r),h=h?.value,d=d?.value,p=p?.value;const m=on(t,{z:f,fill:h,stroke:d,symbol:p}),y=f&&[],g=h&&[],v=d&&[],x=p&&[],w=[],b=[],k=[];let $=-1;for(const e of t)e.initialize(n);for(const r of o){const o=[];for(const e of t)e.scope("facet",r);for(const[i,a]of Ze(r,m))for(const{index:r,extent:l}of xf(n,a,c,u,e)){o.push(++$),b.push(l.x),k.push(l.y),f&&y.push(m===f?i:f[r[0]]),h&&g.push(m===h?i:h[r[0]]),d&&v.push(m===d?i:d[r[0]]),p&&x.push(m===p?i:p[r[0]]);for(const e of t)e.reduce(r,l)}w.push(o)}const M=i.x.scale,A=i.y.scale;return{data:n,facets:w,channels:{x:{value:b,source:a[M]?{value:wt(b,a[M].invert),scale:M}:null},y:{value:k,source:a[A]?{value:wt(k,a[A].invert),scale:A}:null},...f&&{z:{value:y}},...h&&{fill:{value:g,scale:"auto"}},...d&&{stroke:{value:v,scale:"auto"}},...p&&{symbol:{value:x,scale:"auto"}},...Object.fromEntries(t.map((({name:t,output:n})=>[t,{scale:"auto",label:n.label,radius:"r"===t?e/2:void 0,value:n.transform()}])))}}}))},t.hexgrid=function(t){return new bf(t)},t.hull=function(t,e){return of(tf,t,e)},t.identity=Q,t.image=function(t,{x:e,y:n,...r}={}){return void 0===r.frameAnchor&&([e,n]=Et(e,n)),new Mf(t,{...r,x:e,y:n})},t.indexOf=J,t.initializer=Re,t.interpolateNearest=Tu,t.interpolateNone=Eu,t.interpolatorBarycentric=Ru,t.interpolatorRandomWalk=Bu,t.legend=function(t={}){for(const[e,n]of cl){const r=t[e];if(Lt(r)){const o=go(t);let i;if("symbol"===e){const{fill:e,stroke:n=(void 0===e&&Lt(t.color)?"color":void 0)}=t;i={fill:e,stroke:n}}return n(Cr(e,r,i),ul(o,r,t),(e=>Lt(t[e])?Cr(e,t[e]):null))}}throw new Error("unknown legend type; no scale found")},t.line=Lc,t.lineX=Sc,t.lineY=zc,t.linearRegressionX=function(t,{y:e=J,x:n=Q,stroke:r,fill:o=(le(r)?"currentColor":r),...i}={}){return new Nf(t,Rs({...i,x:n,y:e,fill:o,stroke:r}))},t.linearRegressionY=function(t,{x:e=J,y:n=Q,stroke:r,fill:o=(le(r)?"currentColor":r),...i}={}){return new Tf(t,Es({...i,x:e,y:n,fill:o,stroke:r}))},t.link=ic,t.map=Fc,t.mapX=Wc,t.mapY=jc,t.marks=ni,t.normalize=Ph,t.normalizeX=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),Wc(Ph(t),e)},t.normalizeY=function(t,e){return 1===arguments.length&&({basis:t,...e}=t),jc(Ph(t),e)},t.numberInterval=Xt,t.plot=os,t.pointer=ui,t.pointerX=fi,t.pointerY=hi,t.raster=function(){const[t,e]=Lu("fill",...arguments);return new Au(t,null==t||void 0!==e.fill||void 0!==e.fillOpacity?e:{...e,fill:Q})},t.rect=Fl,t.rectX=ql,t.rectY=Dl,t.reverse=function({sort:t,...e}={}){return{...Te(e,Ie),sort:zt(t)?t:null}},t.ruleX=Gi,t.ruleY=Xi,t.scale=function(t={}){let e;for(const n in t)if(ke.has(n)&&Lt(t[n])){if(void 0!==e)throw new Error("ambiguous scale definition; multiple scales found");e=Yr(Cr(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 Jh(e);case"last":return Qh(e)}if("function"==typeof t)return rd(null,t,e);let n,r;for(n in t){if(void 0!==r)throw new Error("ambiguous selector; multiple inputs");r=Zh(t[n])}if(void 0===r)throw new Error(`invalid selector: ${t}`);return rd(n,r,e)},t.selectFirst=Jh,t.selectLast=Qh,t.selectMaxX=function(t){return rd("x",nd,t)},t.selectMaxY=function(t){return rd("y",nd,t)},t.selectMinX=function(t){return rd("x",ed,t)},t.selectMinY=function(t){return rd("y",ed,t)},t.shiftX=function(t,e){return Vh("x",t,e)},t.shiftY=function(t,e){return Vh("y",t,e)},t.shuffle=function({seed:t,sort:n,...r}={}){return{...Te(r,Fe(null==t?Math.random:e.randomLcg(t))),sort:zt(n)?n:null}},t.sort=Pe,t.sphere=function({strokeWidth:t=1.5,...e}={}){return gf({type:"Sphere"},{strokeWidth:t,...e})},t.spike=function(t,e={}){const{shape:n=$a,stroke:r=xa.stroke,strokeWidth:o=1,fill:i=r,fillOpacity:a=.3,anchor:l="start",...s}=e;return La(t,{...s,shape:n,stroke:r,strokeWidth:o,fill:i,fillOpacity:a,anchor:l})},t.stackX=yl,t.stackX1=function(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{y1:n,y:r=n,x:o}=e,[i,a,l]=kl(r,o,"y","x",t,e);return{...i,y1:n,y:a,x:l}},t.stackX2=function(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{y1:n,y:r=n,x:o}=e,[i,a,,l]=kl(r,o,"y","x",t,e);return{...i,y1:n,y:a,x:l}},t.stackY=gl,t.stackY1=function(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{x1:n,x:r=n,y:o}=e,[i,a,l]=kl(r,o,"x","y",t,e);return{...i,x1:n,x:a,y:l}},t.stackY2=function(t={},e={}){1===arguments.length&&([t,e]=wl(t));const{x1:n,x:r=n,y:o}=e,[i,a,,l]=kl(r,o,"x","y",t,e);return{...i,x1:n,x:a,y:l}},t.text=Ki,t.textX=ta,t.textY=ea,t.tickX=pu,t.tickY=mu,t.timeInterval=R,t.tip=Zl,t.transform=Ee,t.tree=sh,t.treeLink=Wf,t.treeNode=Pf,t.utcInterval=C,t.valueof=_,t.vector=La,t.vectorX=Sa,t.vectorY=za,t.version="0.6.17",t.voronoi=function(t,{x:e,y:n,initializer:r,...o}={}){return of(ef,t,{...Ee({...o,x:e,y:n},ml),initializer:r})},t.voronoiMesh=function(t,e){return of(nf,t,e)},t.waffleX=function(t,{tip:e,...n}={}){return Mt(n)||(n={...n,y:J,x2:Q}),new uh(t,{tip:vh(e),...vl(Wi(dl(n)))})},t.waffleY=function(t,{tip:e,...n}={}){return Mt(n)||(n={...n,x:J,y2:Q}),new fh(t,{tip:vh(e),...xl(ji(pl(n)))})},t.window=_c,t.windowX=function(t={},e){return 1===arguments.length&&(e=t),Wc(_c(t),e)},t.windowY=function(t={},e){return 1===arguments.length&&(e=t),jc(_c(t),e)}}));
|