import{Path as t}from"d3-path";function constant(t){return function constant(){return t}}const n=Math.abs;const i=Math.atan2;const e=Math.cos;const s=Math.max;const o=Math.min;const a=Math.sin;const r=Math.sqrt;const h=1e-12;const l=Math.PI;const c=l/2;const _=2*l;function acos(t){return t>1?0:t<-1?l:Math.acos(t)}function asin(t){return t>=1?c:t<=-1?-c:Math.asin(t)}function withPath(n){let i=3;n.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return n};return()=>new t(i)}function arcInnerRadius(t){return t.innerRadius}function arcOuterRadius(t){return t.outerRadius}function arcStartAngle(t){return t.startAngle}function arcEndAngle(t){return t.endAngle}function arcPadAngle(t){return t&&t.padAngle}function intersect(t,n,i,e,s,o,a,r){var l=i-t,c=e-n,_=a-s,u=r-o,f=u*l-_*c;if(!(f*f$*$+B*B&&(N=P,E=A);return{cx:N,cy:E,x01:-u,y01:-f,x11:N*(o/R-1),y11:E*(o/R-1)}}function arc(){var t=arcInnerRadius,s=arcOuterRadius,u=constant(0),f=null,p=arcStartAngle,d=arcEndAngle,v=arcPadAngle,m=null,T=withPath(arc);function arc(){var b,g,k=+t.apply(this,arguments),w=+s.apply(this,arguments),R=p.apply(this,arguments)-c,C=d.apply(this,arguments)-c,S=n(C-R),N=C>R;m||(m=b=T());wh)if(S>_-h){m.moveTo(w*e(R),w*a(R));m.arc(0,0,w,R,C,!N);if(k>h){m.moveTo(k*e(C),k*a(C));m.arc(0,0,k,C,R,N)}}else{var E,P,A=R,M=C,O=R,$=C,B=S,X=S,Y=v.apply(this,arguments)/2,z=Y>h&&(f?+f.apply(this,arguments):r(k*k+w*w)),L=o(n(w-k)/2,+u.apply(this,arguments)),I=L,q=L;if(z>h){var V=asin(z/k*a(Y)),D=asin(z/w*a(Y));(B-=2*V)>h?(V*=N?1:-1,O+=V,$-=V):(B=0,O=$=(R+C)/2);(X-=2*D)>h?(D*=N?1:-1,A+=D,M-=D):(X=0,A=M=(R+C)/2)}var j=w*e(A),H=w*a(A),W=k*e($),F=k*a($);if(L>h){var G,J=w*e(M),K=w*a(M),Q=k*e(O),U=k*a(O);if(Sh)if(q>h){E=cornerTangents(Q,U,j,H,w,q,N);P=cornerTangents(J,K,W,F,w,q,N);m.moveTo(E.cx+E.x01,E.cy+E.y01);if(qh&&B>h)if(I>h){E=cornerTangents(W,F,J,K,k,-I,N);P=cornerTangents(j,H,Q,U,k,-I,N);m.lineTo(E.cx+E.x01,E.cy+E.y01);if(I=_;--u)r.point(m[u],T[u]);r.lineEnd();r.areaEnd()}if(v){m[c]=+t(f,c,l),T[c]=+n(f,c,l);r.point(e?+e(f,c,l):m[c],i?+i(f,c,l):T[c])}}if(p)return r=null,p+""||null}function arealine(){return line().defined(s).curve(a).context(o)}area.x=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),e=null,area):t};area.x0=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),area):t};area.x1=function(t){return arguments.length?(e=null==t?null:"function"===typeof t?t:constant(+t),area):e};area.y=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),i=null,area):n};area.y0=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),area):n};area.y1=function(t){return arguments.length?(i=null==t?null:"function"===typeof t?t:constant(+t),area):i};area.lineX0=area.lineY0=function(){return arealine().x(t).y(n)};area.lineY1=function(){return arealine().x(t).y(i)};area.lineX1=function(){return arealine().x(e).y(n)};area.defined=function(t){return arguments.length?(s="function"===typeof t?t:constant(!!t),area):s};area.curve=function(t){return arguments.length?(a=t,null!=o&&(r=a(o)),area):a};area.context=function(t){return arguments.length?(null==t?o=r=null:r=a(o=t),area):o};return area}function descending$1(t,n){return nt?1:n>=t?0:NaN}function identity(t){return t}function pie(){var t=identity,n=descending$1,i=null,e=constant(0),s=constant(_),o=constant(0);function pie(a){var r,h,l,c,u,f=(a=array(a)).length,p=0,d=new Array(f),v=new Array(f),m=+e.apply(this,arguments),T=Math.min(_,Math.max(-_,s.apply(this,arguments)-m)),b=Math.min(Math.abs(T)/f,o.apply(this,arguments)),g=b*(T<0?-1:1);for(r=0;r0&&(p+=u);null!=n?d.sort((function(t,i){return n(v[t],v[i])})):null!=i&&d.sort((function(t,n){return i(a[t],a[n])}));for(r=0,l=p?(T-f*g)/p:0;r0?u*l:0)+g,v[h]={data:a[h],index:r,value:u,startAngle:m,endAngle:c,padAngle:b};return v}pie.value=function(n){return arguments.length?(t="function"===typeof n?n:constant(+n),pie):t};pie.sortValues=function(t){return arguments.length?(n=t,i=null,pie):n};pie.sort=function(t){return arguments.length?(i=t,n=null,pie):i};pie.startAngle=function(t){return arguments.length?(e="function"===typeof t?t:constant(+t),pie):e};pie.endAngle=function(t){return arguments.length?(s="function"===typeof t?t:constant(+t),pie):s};pie.padAngle=function(t){return arguments.length?(o="function"===typeof t?t:constant(+t),pie):o};return pie}var f=curveRadial(curveLinear);function Radial(t){this._curve=t}Radial.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};function curveRadial(t){function radial(n){return new Radial(t(n))}radial._curve=t;return radial}function lineRadial(t){var n=t.curve;t.angle=t.x,delete t.x;t.radius=t.y,delete t.y;t.curve=function(t){return arguments.length?n(curveRadial(t)):n()._curve};return t}function lineRadial$1(){return lineRadial(line().curve(f))}function areaRadial(){var t=area().curve(f),n=t.curve,i=t.lineX0,e=t.lineX1,s=t.lineY0,o=t.lineY1;t.angle=t.x,delete t.x;t.startAngle=t.x0,delete t.x0;t.endAngle=t.x1,delete t.x1;t.radius=t.y,delete t.y;t.innerRadius=t.y0,delete t.y0;t.outerRadius=t.y1,delete t.y1;t.lineStartAngle=function(){return lineRadial(i())},delete t.lineX0;t.lineEndAngle=function(){return lineRadial(e())},delete t.lineX1;t.lineInnerRadius=function(){return lineRadial(s())},delete t.lineY0;t.lineOuterRadius=function(){return lineRadial(o())},delete t.lineY1;t.curve=function(t){return arguments.length?n(curveRadial(t)):n()._curve};return t}function pointRadial(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}class Bump{constructor(t,n){this._context=t;this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line}point(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}this._x0=t,this._y0=n}}class BumpRadial{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,n){t=+t,n=+n;if(0===this._point)this._point=1;else{const i=pointRadial(this._x0,this._y0);const e=pointRadial(this._x0,this._y0=(this._y0+n)/2);const s=pointRadial(t,this._y0);const o=pointRadial(t,n);this._context.moveTo(...i);this._context.bezierCurveTo(...e,...s,...o)}this._x0=t,this._y0=n}}function bumpX(t){return new Bump(t,true)}function bumpY(t){return new Bump(t,false)}function bumpRadial(t){return new BumpRadial(t)}function linkSource(t){return t.source}function linkTarget(t){return t.target}function link(t){let n=linkSource,i=linkTarget,e=x,s=y,o=null,a=null,r=withPath(link);function link(){let h;const l=u.call(arguments);const c=n.apply(this,l);const _=i.apply(this,l);null==o&&(a=t(h=r()));a.lineStart();l[0]=c,a.point(+e.apply(this,l),+s.apply(this,l));l[0]=_,a.point(+e.apply(this,l),+s.apply(this,l));a.lineEnd();if(h)return a=null,h+""||null}link.source=function(t){return arguments.length?(n=t,link):n};link.target=function(t){return arguments.length?(i=t,link):i};link.x=function(t){return arguments.length?(e="function"===typeof t?t:constant(+t),link):e};link.y=function(t){return arguments.length?(s="function"===typeof t?t:constant(+t),link):s};link.context=function(n){return arguments.length?(null==n?o=a=null:a=t(o=n),link):o};return link}function linkHorizontal(){return link(bumpX)}function linkVertical(){return link(bumpY)}function linkRadial(){const t=link(bumpRadial);t.angle=t.x,delete t.x;t.radius=t.y,delete t.y;return t}const p=r(3);var d={draw(t,n){const i=.59436*r(n+o(n/28,.75));const e=i/2;const s=e*p;t.moveTo(0,i);t.lineTo(0,-i);t.moveTo(-s,-e);t.lineTo(s,e);t.moveTo(-s,e);t.lineTo(s,-e)}};var v={draw(t,n){const i=r(n/l);t.moveTo(i,0);t.arc(0,0,i,0,_)}};var m={draw(t,n){const i=r(n/5)/2;t.moveTo(-3*i,-i);t.lineTo(-i,-i);t.lineTo(-i,-3*i);t.lineTo(i,-3*i);t.lineTo(i,-i);t.lineTo(3*i,-i);t.lineTo(3*i,i);t.lineTo(i,i);t.lineTo(i,3*i);t.lineTo(-i,3*i);t.lineTo(-i,i);t.lineTo(-3*i,i);t.closePath()}};const T=r(1/3);const b=2*T;var g={draw(t,n){const i=r(n/b);const e=i*T;t.moveTo(0,-i);t.lineTo(e,0);t.lineTo(0,i);t.lineTo(-e,0);t.closePath()}};var k={draw(t,n){const i=.62625*r(n);t.moveTo(0,-i);t.lineTo(i,0);t.lineTo(0,i);t.lineTo(-i,0);t.closePath()}};var w={draw(t,n){const i=.87559*r(n-o(n/7,2));t.moveTo(-i,0);t.lineTo(i,0);t.moveTo(0,i);t.lineTo(0,-i)}};var R={draw(t,n){const i=r(n);const e=-i/2;t.rect(e,e,i,i)}};var C={draw(t,n){const i=.4431*r(n);t.moveTo(i,i);t.lineTo(i,-i);t.lineTo(-i,-i);t.lineTo(-i,i);t.closePath()}};const S=.8908130915292852;const N=a(l/10)/a(7*l/10);const E=a(_/10)*N;const P=-e(_/10)*N;var A={draw(t,n){const i=r(n*S);const s=E*i;const o=P*i;t.moveTo(0,-i);t.lineTo(s,o);for(let n=1;n<5;++n){const r=_*n/5;const h=e(r);const l=a(r);t.lineTo(l*i,-h*i);t.lineTo(h*s-l*o,l*s+h*o)}t.closePath()}};const M=r(3);var O={draw(t,n){const i=-r(n/(3*M));t.moveTo(0,2*i);t.lineTo(-M*i,-i);t.lineTo(M*i,-i);t.closePath()}};const $=r(3);var B={draw(t,n){const i=.6824*r(n);const e=i/2;const s=i*$/2;t.moveTo(0,-i);t.lineTo(s,e);t.lineTo(-s,e);t.closePath()}};const X=-.5;const Y=r(3)/2;const z=1/r(12);const L=3*(z/2+1);var I={draw(t,n){const i=r(n/L);const e=i/2,s=i*z;const o=e,a=i*z+i;const h=-o,l=a;t.moveTo(e,s);t.lineTo(o,a);t.lineTo(h,l);t.lineTo(X*e-Y*s,Y*e+X*s);t.lineTo(X*o-Y*a,Y*o+X*a);t.lineTo(X*h-Y*l,Y*h+X*l);t.lineTo(X*e+Y*s,X*s-Y*e);t.lineTo(X*o+Y*a,X*a-Y*o);t.lineTo(X*h+Y*l,X*l-Y*h);t.closePath()}};var q={draw(t,n){const i=.6189*r(n-o(n/6,1.7));t.moveTo(-i,-i);t.lineTo(i,i);t.moveTo(-i,i);t.lineTo(i,-i)}};const V=[v,m,g,R,A,O,I];const D=[v,w,q,B,d,C,k];function Symbol$1(t,n){let i=null,e=withPath(symbol);t="function"===typeof t?t:constant(t||v);n="function"===typeof n?n:constant(void 0===n?64:+n);function symbol(){let s;i||(i=s=e());t.apply(this,arguments).draw(i,+n.apply(this,arguments));if(s)return i=null,s+""||null}symbol.type=function(n){return arguments.length?(t="function"===typeof n?n:constant(n),symbol):t};symbol.size=function(t){return arguments.length?(n="function"===typeof t?t:constant(+t),symbol):n};symbol.context=function(t){return arguments.length?(i=null==t?null:t,symbol):i};return symbol}function noop(){}function point$3(t,n,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+i)/6)}function Basis(t){this._context=t}Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){switch(this._point){case 3:point$3(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basis(t){return new Basis(t)}function BasisClosed(t){this._context=t}BasisClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2);this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3);this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3);this._context.closePath();break;case 3:this.point(this._x2,this._y2);this.point(this._x3,this._y3);this.point(this._x4,this._y4);break}},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._x2=t,this._y2=n;break;case 1:this._point=2;this._x3=t,this._y3=n;break;case 2:this._point=3;this._x4=t,this._y4=n;this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basisClosed(t){return new BasisClosed(t)}function BasisOpen(t){this._context=t}BasisOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN;this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(i,e):this._context.moveTo(i,e);break;case 3:this._point=4;default:point$3(this,t,n);break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n}};function basisOpen(t){return new BasisOpen(t)}function Bundle(t,n){this._basis=new Basis(t);this._beta=n}Bundle.prototype={lineStart:function(){this._x=[];this._y=[];this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,i=t.length-1;if(i>0){var e,s=t[0],o=n[0],a=t[i]-s,r=n[i]-o,h=-1;while(++h<=i){e=h/i;this._basis.point(this._beta*t[h]+(1-this._beta)*(s+e*a),this._beta*n[h]+(1-this._beta)*(o+e*r))}}this._x=this._y=null;this._basis.lineEnd()},point:function(t,n){this._x.push(+t);this._y.push(+n)}};var j=function custom(t){function bundle(n){return 1===t?new Basis(n):new Bundle(n,t)}bundle.beta=function(t){return custom(+t)};return bundle}(.85);function point$2(t,n,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function Cardinal(t,n){this._context=t;this._k=(1-n)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$2(this,this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;this._x1=t,this._y1=n;break;case 2:this._point=3;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var H=function custom(t){function cardinal(n){return new Cardinal(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function CardinalClosed(t,n){this._context=t;this._k=(1-n)/6}CardinalClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3);this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3);this._context.closePath();break;case 3:this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._x3=t,this._y3=n;break;case 1:this._point=2;this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3;this._x5=t,this._y5=n;break;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var W=function custom(t){function cardinal(n){return new CardinalClosed(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function CardinalOpen(t,n){this._context=t;this._k=(1-n)/6}CardinalOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$2(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var F=function custom(t){function cardinal(n){return new CardinalOpen(n,t)}cardinal.tension=function(t){return custom(+t)};return cardinal}(0);function point$1(t,n,i){var e=t._x1,s=t._y1,o=t._x2,a=t._y2;if(t._l01_a>h){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l;s=(s*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>h){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,_=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/_;a=(a*c+t._y1*t._l23_2a-i*t._l12_2a)/_}t._context.bezierCurveTo(e,s,o,a,t._x2,t._y2)}function CatmullRom(t,n){this._context=t;this._alpha=n}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var G=function custom(t){function catmullRom(n){return t?new CatmullRom(n,t):new Cardinal(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function CatmullRomClosed(t,n){this._context=t;this._alpha=n}CatmullRomClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3);this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3);this._context.closePath();break;case 3:this.point(this._x3,this._y3);this.point(this._x4,this._y4);this.point(this._x5,this._y5);break}},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;this._x3=t,this._y3=n;break;case 1:this._point=2;this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3;this._x5=t,this._y5=n;break;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var J=function custom(t){function catmullRom(n){return t?new CatmullRomClosed(n,t):new CardinalClosed(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function CatmullRomOpen(t,n){this._context=t;this._alpha=n}CatmullRomOpen.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN;this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){t=+t,n=+n;if(this._point){var i=this._x2-t,e=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:point$1(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a;this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a;this._x0=this._x1,this._x1=this._x2,this._x2=t;this._y0=this._y1,this._y1=this._y2,this._y2=n}};var K=function custom(t){function catmullRom(n){return t?new CatmullRomOpen(n,t):new CardinalOpen(n,0)}catmullRom.alpha=function(t){return custom(+t)};return catmullRom}(.5);function LinearClosed(t){this._context=t}LinearClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n;this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};function linearClosed(t){return new LinearClosed(t)}function sign(t){return t<0?-1:1}function slope3(t,n,i){var e=t._x1-t._x0,s=n-t._x1,o=(t._y1-t._y0)/(e||s<0&&-0),a=(i-t._y1)/(s||e<0&&-0),r=(o*s+a*e)/(e+s);return(sign(o)+sign(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(r))||0}function slope2(t,n){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-n)/2:n}function point(t,n,i){var e=t._x0,s=t._y0,o=t._x1,a=t._y1,r=(o-e)/3;t._context.bezierCurveTo(e+r,s+r*n,o-r,a-r*i,o,a)}function MonotoneX(t){this._context=t}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN;this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point(this,this._t0,slope2(this,this._t0));break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath();this._line=1-this._line},point:function(t,n){var i=NaN;t=+t,n=+n;if(t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;point(this,slope2(this,i=slope3(this,t,n)),i);break;default:point(this,this._t0,i=slope3(this,t,n));break}this._x0=this._x1,this._x1=t;this._y0=this._y1,this._y1=n;this._t0=i}}};function MonotoneY(t){this._context=new ReflectContext(t)}(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(t,n){MonotoneX.prototype.point.call(this,n,t)};function ReflectContext(t){this._context=t}ReflectContext.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,i,e,s,o){this._context.bezierCurveTo(n,t,e,i,o,s)}};function monotoneX(t){return new MonotoneX(t)}function monotoneY(t){return new MonotoneY(t)}function Natural(t){this._context=t}Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[];this._y=[]},lineEnd:function(){var t=this._x,n=this._y,i=t.length;if(i){this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]);if(2===i)this._context.lineTo(t[1],n[1]);else{var e=controlPoints(t),s=controlPoints(n);for(var o=0,a=1;a=0;--n)s[n]=(a[n]-s[n+1])/o[n];o[e-1]=(t[e]+s[e-1])/2;for(n=0;n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){t=+t,n=+n;switch(this._point){case 0:this._point=1;this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0){this._context.lineTo(this._x,n);this._context.lineTo(t,n)}else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y);this._context.lineTo(i,n)}break}this._x=t,this._y=n}};function step(t){return new Step(t,.5)}function stepBefore(t){return new Step(t,0)}function stepAfter(t){return new Step(t,1)}function none$1(t,n){if((s=t.length)>1)for(var i,e,s,o=1,a=t[n[0]],r=a.length;o=0)i[n]=n;return i}function stackValue(t,n){return t[n]}function stackSeries(t){const n=[];n.key=t;return n}function stack(){var t=constant([]),n=none,i=none$1,e=stackValue;function stack(s){var o,a,r=Array.from(t.apply(this,arguments),stackSeries),h=r.length,l=-1;for(const t of s)for(o=0,++l;o0){for(var i,e,s,o=0,a=t[0].length;o0)for(var i,e,s,o,a,r,h=0,l=t[n[0]].length;h0?(e[0]=o,e[1]=o+=s):s<0?(e[1]=a,e[0]=a+=s):(e[0]=0,e[1]=s)}function silhouette(t,n){if((i=t.length)>0){for(var i,e=0,s=t[n[0]],o=s.length;e0&&(e=(i=t[n[0]]).length)>0){for(var i,e,s,o=0,a=1;ao&&(o=n,e=i);return e}function ascending(t){var n=t.map(sum);return none(t).sort((function(t,i){return n[t]-n[i]}))}function sum(t){var n,i=0,e=-1,s=t.length;while(++e