=i))return[];const u=o-i+1,c=new Array(u);if(r)if(a<0)for(let t=0;t0?(t=Math.floor(t/i)*i,n=Math.ceil(n/i)*i):i<0&&(t=Math.ceil(t*i)/i,n=Math.floor(n*i)/i),r=i}}function Q(t){return Math.ceil(Math.log(_(t))/Math.LN2)+1}function J(){var t=C,n=T,e=Q;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,a,u=r.length,c=new Array(u);for(i=0;i=h)if(t>=h&&n===T){const t=W(s,h,e);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,y=p;d[g]<=s;)++g;for(;d[y-1]>h;)--y;(g||y0?d[i-1]:s,v.x1=i
0)for(i=0;i=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function nt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e=o)&&(e=o,r=i);return r}function et(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function rt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e>n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e>o||void 0===e&&o>=o)&&(e=o,r=i);return r}function it(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?B:O(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(a-o/2<0?-1:1);it(t,n,Math.max(e,Math.floor(n-a*c/o+f)),Math.min(r,Math.floor(n+(o-a)*c/o+f)),i)}const o=t[n];let a=e,u=r;for(ot(t,e,n),i(t[r],o)>0&&ot(t,e,r);a0;)--u}0===i(t[e],o)?ot(t,e,u):(++u,ot(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function ot(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function at(t,e=n){let r,i=!1;if(1===e.length){let o;for(const a of t){const t=e(a);(i?n(t,o)>0:0===n(t,t))&&(r=a,o=t,i=!0)}}else for(const n of t)(i?e(n,r)>0:0===e(n,n))&&(r=n,i=!0);return r}function ut(t,n,e){if((r=(t=Float64Array.from(a(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return et(t);if(n>=1)return tt(t);var r,i=(r-1)*n,o=Math.floor(i),u=tt(it(t,o).subarray(0,o+1));return u+(et(t.subarray(o+1))-u)*(i-o)}}function ct(t,n,e=o){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function ft(t,n,e){if((r=(t=Float64Array.from(a(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return rt(t);if(n>=1)return nt(t);var r,i=Math.floor((r-1)*n),o=it(Uint32Array.from(t,((t,n)=>n)),i,0,r-1,((n,e)=>B(t[n],t[e])));return at(o.subarray(0,i+1),(n=>t[n]))}}function st(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function lt(t,n){return[t,n]}function ht(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r+t(n)}function St(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function Et(){return!this.__axis}function Nt(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,f=1===t||4===t?-1:1,s=4===t||2===t?"x":"y",l=1===t||3===t?Mt:Tt;function h(h){var d=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):xt:i,g=Math.max(o,0)+u,y=n.range(),v=+y[0]+c,_=+y[y.length-1]+c,b=(n.bandwidth?St:At)(n.copy(),c),m=h.selection?h.selection():h,x=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(d,n).order(),M=w.exit(),T=w.enter().append("g").attr("class","tick"),A=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(T),A=A.merge(T.append("line").attr("stroke","currentColor").attr(s+"2",f*o)),S=S.merge(T.append("text").attr("fill","currentColor").attr(s,f*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==m&&(x=x.transition(h),w=w.transition(h),A=A.transition(h),S=S.transition(h),M=M.transition(h).attr("opacity",wt).attr("transform",(function(t){return isFinite(t=b(t))?l(t+c):this.getAttribute("transform")})),T.attr("opacity",wt).attr("transform",(function(t){var n=this.parentNode.__axis;return l((n&&isFinite(n=n(t))?n:b(t))+c)}))),M.remove(),x.attr("d",4===t||2===t?a?"M"+f*a+","+v+"H"+c+"V"+_+"H"+f*a:"M"+c+","+v+"V"+_:a?"M"+v+","+f*a+"V"+c+"H"+_+"V"+f*a:"M"+v+","+c+"H"+_),w.attr("opacity",1).attr("transform",(function(t){return l(b(t)+c)})),A.attr(s+"2",f*o),S.attr(s,f*g).text(p),m.filter(Et).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),m.each((function(){this.__axis=b}))}return h.scale=function(t){return arguments.length?(n=t,h):n},h.ticks=function(){return e=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),h):e.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(o=a=+t,h):o},h.tickSizeInner=function(t){return arguments.length?(o=+t,h):o},h.tickSizeOuter=function(t){return arguments.length?(a=+t,h):a},h.tickPadding=function(t){return arguments.length?(u=+t,h):u},h.offset=function(t){return arguments.length?(c=+t,h):c},h}var kt={value:()=>{}};function Ct(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function $t(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Ft.hasOwnProperty(n)?{space:Ft[n],local:t}:t}function Ut(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Rt&&n.documentElement.namespaceURI===Rt?n.createElement(t):n.createElementNS(e,t)}}function It(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ot(t){var n=qt(t);return(n.local?It:Ut)(n)}function Bt(){}function Yt(t){return null==t?Bt:function(){return this.querySelector(t)}}function Lt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function jt(){return[]}function Ht(t){return null==t?jt:function(){return this.querySelectorAll(t)}}function Xt(t){return function(){return this.matches(t)}}function Gt(t){return function(n){return n.matches(t)}}var Vt=Array.prototype.find;function Wt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Kt(){return Array.from(this.children)}function Qt(t){return new Array(t.length)}function Jt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function tn(t){return function(){return t}}function nn(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;un?1:t>=n?0:NaN}function un(t){return function(){this.removeAttribute(t)}}function cn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function fn(t,n){return function(){this.setAttribute(t,n)}}function sn(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function ln(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function hn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function dn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function pn(t){return function(){this.style.removeProperty(t)}}function gn(t,n,e){return function(){this.style.setProperty(t,n,e)}}function yn(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function vn(t,n){return t.style.getPropertyValue(n)||dn(t).getComputedStyle(t,null).getPropertyValue(n)}function _n(t){return function(){delete this[t]}}function bn(t,n){return function(){this[t]=n}}function mn(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function xn(t){return t.trim().split(/^|\s+/)}function wn(t){return t.classList||new Mn(t)}function Mn(t){this._node=t,this._names=xn(t.getAttribute("class")||"")}function Tn(t,n){for(var e=wn(t),r=-1,i=n.length;++r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function Yn(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Gn=[null];function Vn(t,n){this._groups=t,this._parents=n}function Wn(){return new Vn([[document.documentElement]],Gn)}function Zn(t){return"string"==typeof t?new Vn([[document.querySelector(t)]],[document.documentElement]):new Vn([[t]],Gn)}Vn.prototype=Wn.prototype={constructor:Vn,select:function(t){"function"!=typeof t&&(t=Yt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=x&&(x=m+1);!(b=y[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=an);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?pn:"function"==typeof n?yn:gn)(t,n,null==e?"":e)):vn(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?_n:"function"==typeof n?mn:bn)(t,n)):this.node()[t]},classed:function(t,n){var e=xn(t+"");if(arguments.length<2){for(var r=wn(this.node()),i=-1,o=e.length;++i()=>t;function fe(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:c,dy:f,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:s}})}function se(t){return!t.ctrlKey&&!t.button}function le(){return this.parentNode}function he(t,n){return null==n?{x:t.x,y:t.y}:n}function de(){return navigator.maxTouchPoints||"ontouchstart"in this}function pe(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function ge(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ye(){}fe.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ve=.7,_e=1/ve,be="\\s*([+-]?\\d+)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",we=/^#([0-9a-f]{3,8})$/,Me=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Te=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),Ae=new RegExp(`^rgba\\(${be},${be},${be},${me}\\)$`),Se=new RegExp(`^rgba\\(${xe},${xe},${xe},${me}\\)$`),Ee=new RegExp(`^hsl\\(${me},${xe},${xe}\\)$`),Ne=new RegExp(`^hsla\\(${me},${xe},${xe},${me}\\)$`),ke={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ce(){return this.rgb().formatHex()}function Pe(){return this.rgb().formatRgb()}function ze(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=we.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?$e(n):3===e?new qe(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?De(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?De(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Me.exec(t))?new qe(n[1],n[2],n[3],1):(n=Te.exec(t))?new qe(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ae.exec(t))?De(n[1],n[2],n[3],n[4]):(n=Se.exec(t))?De(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Ee.exec(t))?Le(n[1],n[2]/100,n[3]/100,1):(n=Ne.exec(t))?Le(n[1],n[2]/100,n[3]/100,n[4]):ke.hasOwnProperty(t)?$e(ke[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function $e(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function De(t,n,e,r){return r<=0&&(t=n=e=NaN),new qe(t,n,e,r)}function Re(t){return t instanceof ye||(t=ze(t)),t?new qe((t=t.rgb()).r,t.g,t.b,t.opacity):new qe}function Fe(t,n,e,r){return 1===arguments.length?Re(t):new qe(t,n,e,null==r?1:r)}function qe(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ue(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}`}function Ie(){const t=Oe(this.opacity);return`${1===t?"rgb(":"rgba("}${Be(this.r)}, ${Be(this.g)}, ${Be(this.b)}${1===t?")":`, ${t})`}`}function Oe(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Be(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ye(t){return((t=Be(t))<16?"0":"")+t.toString(16)}function Le(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Xe(t,n,e,r)}function je(t){if(t instanceof Xe)return new Xe(t.h,t.s,t.l,t.opacity);if(t instanceof ye||(t=ze(t)),!t)return new Xe;if(t instanceof Xe)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&c<1?0:a,new Xe(a,u,c,t.opacity)}function He(t,n,e,r){return 1===arguments.length?je(t):new Xe(t,n,e,null==r?1:r)}function Xe(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ge(t){return(t=(t||0)%360)<0?t+360:t}function Ve(t){return Math.max(0,Math.min(1,t||0))}function We(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}pe(ye,ze,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ce,formatHex:Ce,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return je(this).formatHsl()},formatRgb:Pe,toString:Pe}),pe(qe,Fe,ge(ye,{brighter(t){return t=null==t?_e:Math.pow(_e,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Be(this.r),Be(this.g),Be(this.b),Oe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ue,formatHex:Ue,formatHex8:function(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}${Ye(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ie,toString:Ie})),pe(Xe,He,ge(ye,{brighter(t){return t=null==t?_e:Math.pow(_e,t),new Xe(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ve:Math.pow(ve,t),new Xe(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new qe(We(t>=240?t-240:t+120,i,r),We(t,i,r),We(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Xe(Ge(this.h),Ve(this.s),Ve(this.l),Oe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Oe(this.opacity);return`${1===t?"hsl(":"hsla("}${Ge(this.h)}, ${100*Ve(this.s)}%, ${100*Ve(this.l)}%${1===t?")":`, ${t})`}`}}));const Ze=Math.PI/180,Ke=180/Math.PI,Qe=.96422,Je=.82521,tr=4/29,nr=6/29,er=3*nr*nr;function rr(t){if(t instanceof or)return new or(t.l,t.a,t.b,t.opacity);if(t instanceof hr)return dr(t);t instanceof qe||(t=Re(t));var n,e,r=fr(t.r),i=fr(t.g),o=fr(t.b),a=ar((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=ar((.4360747*r+.3850649*i+.1430804*o)/Qe),e=ar((.0139322*r+.0971045*i+.7141733*o)/Je)),new or(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ir(t,n,e,r){return 1===arguments.length?rr(t):new or(t,n,e,null==r?1:r)}function or(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ar(t){return t>.008856451679035631?Math.pow(t,1/3):t/er+tr}function ur(t){return t>nr?t*t*t:er*(t-tr)}function cr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function fr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sr(t){if(t instanceof hr)return new hr(t.h,t.c,t.l,t.opacity);if(t instanceof or||(t=rr(t)),0===t.a&&0===t.b)return new hr(NaN,0=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r()=>t;function kr(t,n){return function(e){return t+e*n}}function Cr(t,n){var e=n-t;return e?kr(t,e>180||e<-180?e-360*Math.round(e/360):e):Nr(isNaN(t)?n:t)}function Pr(t){return 1==(t=+t)?zr:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Nr(isNaN(n)?e:n)}}function zr(t,n){var e=n-t;return e?kr(t,e):Nr(isNaN(t)?n:t)}var $r=function t(n){var e=Pr(n);function r(t,n){var r=e((t=Fe(t)).r,(n=Fe(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=zr(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Dr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;eo&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Br(e,r)})),o=jr.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Br(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Br(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Br(t,e)},{i:u-2,x:Br(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e=0&&n._call.call(void 0,t),n=n._next;--gi}function Ni(){bi=(_i=xi.now())+mi,gi=yi=0;try{Ei()}finally{gi=0,function(){var t,n,e=di,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:di=n);pi=t,Ci(r)}(),bi=0}}function ki(){var t=xi.now(),n=t-_i;n>1e3&&(mi-=n,_i=t)}function Ci(t){gi||(yi&&(yi=clearTimeout(yi)),t-bi>24?(t<1/0&&(yi=setTimeout(Ni,t-xi.now()-mi)),vi&&(vi=clearInterval(vi))):(vi||(_i=xi.now(),vi=setInterval(ki,1e3)),gi=1,wi(Ni)))}function Pi(t,n,e){var r=new Ai;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Ai.prototype=Si.prototype={constructor:Ai,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Mi():+e)+(null==n?0:+n),this._next||pi===this||(pi?pi._next=this:di=this,pi=this),this._call=t,this._time=e,Ci()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ci())}};var zi=Ct("start","end","cancel","interrupt"),$i=[];function Di(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(t){e.state=1,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var f,s,l,h;if(1!==e.state)return c();for(f in i)if((h=i[f]).name===e.name){if(3===h.state)return Pi(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f0)throw new Error("too late; already scheduled");return e}function Fi(t,n){var e=qi(t,n);if(e.state>3)throw new Error("too late; already running");return e}function qi(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Ui(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Ii(t,n){var e,r;return function(){var i=Fi(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Ri:Fi;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var oo=Wn.prototype.constructor;function ao(t){return function(){this.style.removeProperty(t)}}function uo(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function co(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&uo(t,o,e)),r}return o._value=n,o}function fo(t){return function(n){this.textContent=t.call(this,n)}}function so(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&fo(r)),n}return r._value=t,r}var lo=0;function ho(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function po(t){return Wn().transition(t)}function go(){return++lo}var yo=Wn.prototype;ho.prototype=po.prototype={constructor:ho,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Yt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>t;function Lo(t,{sourceEvent:n,target:e,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function jo(t){t.stopImmediatePropagation()}function Ho(t){t.preventDefault(),t.stopImmediatePropagation()}var Xo={name:"drag"},Go={name:"space"},Vo={name:"handle"},Wo={name:"center"};const{abs:Zo,max:Ko,min:Qo}=Math;function Jo(t){return[+t[0],+t[1]]}function ta(t){return[Jo(t[0]),Jo(t[1])]}var na={name:"x",handles:["w","e"].map(fa),input:function(t,n){return null==t?null:[[+t[0],n[0][1]],[+t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},ea={name:"y",handles:["n","s"].map(fa),input:function(t,n){return null==t?null:[[n[0][0],+t[0]],[n[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},ra={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(fa),input:function(t){return null==t?null:ta(t)},output:function(t){return t}},ia={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},oa={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},aa={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},ua={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ca={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function fa(t){return{type:t}}function sa(t){return!t.ctrlKey&&!t.button}function la(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function ha(){return navigator.maxTouchPoints||"ontouchstart"in this}function da(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function pa(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function ga(t){var n,e=la,r=sa,i=ha,o=!0,a=Ct("start","brush","end"),u=6;function c(n){var e=n.property("__brush",g).selectAll(".overlay").data([fa("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ia.overlay).merge(e).each((function(){var t=da(this).extent;Zn(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),n.selectAll(".selection").data([fa("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ia.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=n.selectAll(".handle").data(t.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return ia[t.type]})),n.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(i).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){var t=Zn(this),n=da(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-u/2:n[0][0]-u/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-u/2:n[0][1]-u/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+u:u})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+u:u}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n,e){var r=t.__brush.emitter;return!r||e&&r.clean?new l(t,n,e):r}function l(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function h(e){if((!n||e.touches)&&r.apply(this,arguments)){var i,a,u,c,l,h,d,p,g,y,v,_=this,b=e.target.__data__.type,m="selection"===(o&&e.metaKey?b="overlay":b)?Xo:o&&e.altKey?Wo:Vo,x=t===ea?null:ua[b],w=t===na?null:ca[b],M=da(_),T=M.extent,A=M.selection,S=T[0][0],E=T[0][1],N=T[1][0],k=T[1][1],C=0,P=0,z=x&&w&&o&&e.shiftKey,$=Array.from(e.touches||[e],(t=>{const n=t.identifier;return(t=ne(t,_)).point0=t.slice(),t.identifier=n,t}));Ui(_);var D=s(_,arguments,!0).beforestart();if("overlay"===b){A&&(g=!0);const n=[$[0],$[1]||$[0]];M.selection=A=[[i=t===ea?S:Qo(n[0][0],n[1][0]),u=t===na?E:Qo(n[0][1],n[1][1])],[l=t===ea?N:Ko(n[0][0],n[1][0]),d=t===na?k:Ko(n[0][1],n[1][1])]],$.length>1&&I(e)}else i=A[0][0],u=A[0][1],l=A[1][0],d=A[1][1];a=i,c=u,h=l,p=d;var R=Zn(_).attr("pointer-events","none"),F=R.selectAll(".overlay").attr("cursor",ia[b]);if(e.touches)D.moved=U,D.ended=O;else{var q=Zn(e.view).on("mousemove.brush",U,!0).on("mouseup.brush",O,!0);o&&q.on("keydown.brush",B,!0).on("keyup.brush",Y,!0),ae(e.view)}f.call(_),D.start(e,m.name)}function U(t){for(const n of t.changedTouches||[t])for(const t of $)t.identifier===n.identifier&&(t.cur=ne(n,_));if(z&&!y&&!v&&1===$.length){const t=$[0];Zo(t.cur[0]-t[0])>Zo(t.cur[1]-t[1])?v=!0:y=!0}for(const t of $)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Ho(t),I(t)}function I(t){const n=$[0],e=n.point0;var r;switch(C=n[0]-e[0],P=n[1]-e[1],m){case Go:case Xo:x&&(C=Ko(S-i,Qo(N-l,C)),a=i+C,h=l+C),w&&(P=Ko(E-u,Qo(k-d,P)),c=u+P,p=d+P);break;case Vo:$[1]?(x&&(a=Ko(S,Qo(N,$[0][0])),h=Ko(S,Qo(N,$[1][0])),x=1),w&&(c=Ko(E,Qo(k,$[0][1])),p=Ko(E,Qo(k,$[1][1])),w=1)):(x<0?(C=Ko(S-i,Qo(N-i,C)),a=i+C,h=l):x>0&&(C=Ko(S-l,Qo(N-l,C)),a=i,h=l+C),w<0?(P=Ko(E-u,Qo(k-u,P)),c=u+P,p=d):w>0&&(P=Ko(E-d,Qo(k-d,P)),c=u,p=d+P));break;case Wo:x&&(a=Ko(S,Qo(N,i-C*x)),h=Ko(S,Qo(N,l+C*x))),w&&(c=Ko(E,Qo(k,u-P*w)),p=Ko(E,Qo(k,d+P*w)))}h0&&(i=a-C),w<0?d=p-P:w>0&&(u=c-P),m=Go,F.attr("cursor",ia.selection),I(t));break;default:return}Ho(t)}function Y(t){switch(t.keyCode){case 16:z&&(y=v=z=!1,I(t));break;case 18:m===Wo&&(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=Vo,I(t));break;case 32:m===Go&&(t.altKey?(x&&(l=h-C*x,i=a+C*x),w&&(d=p-P*w,u=c+P*w),m=Wo):(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=Vo),F.attr("cursor",ia[b]),I(t));break;default:return}Ho(t)}}function d(t){s(this,arguments).moved(t)}function p(t){s(this,arguments).ended(t)}function g(){var n=this.__brush||{selection:null};return n.extent=ta(e.apply(this,arguments)),n.dim=t,n}return c.move=function(n,e,r){n.tween?n.on("start.brush",(function(t){s(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){s(this,arguments).end(t)})).tween("brush",(function(){var n=this,r=n.__brush,i=s(n,arguments),o=r.selection,a=t.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=Xr(o,a);function c(t){r.selection=1===t&&null===a?null:u(t),f.call(n),i.brush()}return null!==o&&null!==a?c:c(1)})):n.each((function(){var n=this,i=arguments,o=n.__brush,a=t.input("function"==typeof e?e.apply(n,i):e,o.extent),u=s(n,i).beforestart();Ui(n),o.selection=null===a?null:a,f.call(n),u.start(r).brush(r).end(r)}))},c.clear=function(t,n){c.move(t,null,n)},l.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,n){return this.starting?(this.starting=!1,this.emit("start",t,n)):this.emit("brush",t),this},brush:function(t,n){return this.emit("brush",t,n),this},end:function(t,n){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,n)),this},emit:function(n,e,r){var i=Zn(this.that).datum();a.call(n,this.that,new Lo(n,{sourceEvent:e,target:c,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},c.extent=function(t){return arguments.length?(e="function"==typeof t?t:Yo(ta(t)),c):e},c.filter=function(t){return arguments.length?(r="function"==typeof t?t:Yo(!!t),c):r},c.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Yo(!!t),c):i},c.handleSize=function(t){return arguments.length?(u=+t,c):u},c.keyModifiers=function(t){return arguments.length?(o=!!t,c):o},c.on=function(){var t=a.on.apply(a,arguments);return t===a?c:t},c}var ya=Math.abs,va=Math.cos,_a=Math.sin,ba=Math.PI,ma=ba/2,xa=2*ba,wa=Math.max,Ma=1e-12;function Ta(t,n){return Array.from({length:n-t},((n,e)=>t+e))}function Aa(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}function Sa(t,n){var e=0,r=null,i=null,o=null;function a(a){var u,c=a.length,f=new Array(c),s=Ta(0,c),l=new Array(c*c),h=new Array(c),d=0;a=Float64Array.from({length:c*c},n?(t,n)=>a[n%c][n/c|0]:(t,n)=>a[n/c|0][n%c]);for(let n=0;nr(f[t],f[n])));for(const e of s){const r=n;if(t){const t=Ta(1+~c,c).filter((t=>t<0?a[~t*c+e]:a[e*c+t]));i&&t.sort(((t,n)=>i(t<0?-a[~t*c+e]:a[e*c+t],n<0?-a[~n*c+e]:a[e*c+n])));for(const r of t)if(r<0){(l[~r*c+e]||(l[~r*c+e]={source:null,target:null})).target={index:e,startAngle:n,endAngle:n+=a[~r*c+e]*d,value:a[~r*c+e]}}else{(l[e*c+r]||(l[e*c+r]={source:null,target:null})).source={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]}}h[e]={index:e,startAngle:r,endAngle:n,value:f[e]}}else{const t=Ta(0,c).filter((t=>a[e*c+t]||a[t*c+e]));i&&t.sort(((t,n)=>i(a[e*c+t],a[e*c+n])));for(const r of t){let t;if(e=0))throw new Error(`invalid digits: ${t}`);if(n>15)return Pa;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;nka)if(Math.abs(s*u-c*f)>ka&&i){let h=e-o,d=r-a,p=u*u+c*c,g=h*h+d*d,y=Math.sqrt(p),v=Math.sqrt(l),_=i*Math.tan((Ea-Math.acos((p+l-g)/(2*y*v)))/2),b=_/v,m=_/y;Math.abs(b-1)>ka&&this._append`L${t+b*f},${n+b*s}`,this._append`A${i},${i},0,0,${+(s*h>f*d)},${this._x1=t+m*u},${this._y1=n+m*c}`}else this._append`L${this._x1=t},${this._y1=n}`;else;}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;null===this._x1?this._append`M${c},${f}`:(Math.abs(this._x1-c)>ka||Math.abs(this._y1-f)>ka)&&this._append`L${c},${f}`,e&&(l<0&&(l=l%Na+Na),l>Ca?this._append`A${e},${e},0,1,${s},${t-a},${n-u}A${e},${e},0,1,${s},${this._x1=c},${this._y1=f}`:l>ka&&this._append`A${e},${e},0,${+(l>=Ea)},${s},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function $a(){return new za}$a.prototype=za.prototype;var Da=Array.prototype.slice;function Ra(t){return function(){return t}}function Fa(t){return t.source}function qa(t){return t.target}function Ua(t){return t.radius}function Ia(t){return t.startAngle}function Oa(t){return t.endAngle}function Ba(){return 0}function Ya(){return 10}function La(t){var n=Fa,e=qa,r=Ua,i=Ua,o=Ia,a=Oa,u=Ba,c=null;function f(){var f,s=n.apply(this,arguments),l=e.apply(this,arguments),h=u.apply(this,arguments)/2,d=Da.call(arguments),p=+r.apply(this,(d[0]=s,d)),g=o.apply(this,d)-ma,y=a.apply(this,d)-ma,v=+i.apply(this,(d[0]=l,d)),_=o.apply(this,d)-ma,b=a.apply(this,d)-ma;if(c||(c=f=$a()),h>Ma&&(ya(y-g)>2*h+Ma?y>g?(g+=h,y-=h):(g-=h,y+=h):g=y=(g+y)/2,ya(b-_)>2*h+Ma?b>_?(_+=h,b-=h):(_-=h,b+=h):_=b=(_+b)/2),c.moveTo(p*va(g),p*_a(g)),c.arc(0,0,p,g,y),g!==_||y!==b)if(t){var m=+t.apply(this,arguments),x=v-m,w=(_+b)/2;c.quadraticCurveTo(0,0,x*va(_),x*_a(_)),c.lineTo(v*va(w),v*_a(w)),c.lineTo(x*va(b),x*_a(b))}else c.quadraticCurveTo(0,0,v*va(_),v*_a(_)),c.arc(0,0,v,_,b);if(c.quadraticCurveTo(0,0,p*va(g),p*_a(g)),c.closePath(),f)return c=null,f+""||null}return t&&(f.headRadius=function(n){return arguments.length?(t="function"==typeof n?n:Ra(+n),f):t}),f.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:Ra(+t),f):r},f.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:Ra(+t),f):r},f.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:Ra(+t),f):i},f.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:Ra(+t),f):o},f.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ra(+t),f):a},f.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:Ra(+t),f):u},f.source=function(t){return arguments.length?(n=t,f):n},f.target=function(t){return arguments.length?(e=t,f):e},f.context=function(t){return arguments.length?(c=null==t?null:t,f):c},f}var ja=Array.prototype.slice;function Ha(t,n){return t-n}var Xa=t=>()=>t;function Ga(t,n){for(var e,r=-1,i=n.length;++rr!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function Wa(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function Za(){}var Ka=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Qa(){var t=1,n=1,e=Q,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(Ha);else{const e=T(t,Ja);for(n=V(...K(e[0],e[1],n),n);n[n.length-1]>=e[1];)n.pop();for(;n[1]o(t,n)))}function o(e,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var u=[],c=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=tu(e[0],r),Ka[f<<1].forEach(p);for(;++o=r,Ka[s<<2].forEach(p);for(;++o0?u.push([t]):c.push(t)})),c.forEach((function(t){for(var n,e=0,r=u.length;e0&&o0&&a=0&&o>=0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?Xa(ja.call(t)):Xa(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:Za,i):r===u},i}function Ja(t){return isFinite(t)?t:NaN}function tu(t,n){return null!=t&&+t>=n}function nu(t){return null==t||isNaN(t=+t)?-1/0:t}function eu(t,n,e,r){const i=r-n,o=e-n,a=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(a)?t:t+a-.5}function ru(t){return t[0]}function iu(t){return t[1]}function ou(){return 1}const au=134217729;function uu(t,n,e,r,i){let o,a,u,c,f=n[0],s=r[0],l=0,h=0;s>f==s>-f?(o=f,f=n[++l]):(o=s,s=r[++h]);let d=0;if(lf==s>-f?(a=f+o,u=o-(a-f),f=n[++l]):(a=s+o,u=o-(a-s),s=r[++h]),o=a,0!==u&&(i[d++]=u);lf==s>-f?(a=o+f,c=a-o,u=o-(a-c)+(f-c),f=n[++l]):(a=o+s,c=a-o,u=o-(a-c)+(s-c),s=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l0!=u>0)return c;const f=Math.abs(a+u);return Math.abs(c)>=33306690738754716e-32*f?c:-function(t,n,e,r,i,o,a){let u,c,f,s,l,h,d,p,g,y,v,_,b,m,x,w,M,T;const A=t-i,S=e-i,E=n-o,N=r-o;m=A*N,h=au*A,d=h-(h-A),p=A-d,h=au*N,g=h-(h-N),y=N-g,x=p*y-(m-d*g-p*g-d*y),w=E*S,h=au*E,d=h-(h-E),p=E-d,h=au*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,fu[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,fu[1]=b-(v+l)+(l-w),T=_+v,l=T-_,fu[2]=_-(T-l)+(v-l),fu[3]=T;let k=function(t,n){let e=n[0];for(let r=1;r=C||-k>=C)return k;if(l=t-A,u=t-(A+l)+(l-i),l=e-S,f=e-(S+l)+(l-i),l=n-E,c=n-(E+l)+(l-o),l=r-N,s=r-(N+l)+(l-o),0===u&&0===c&&0===f&&0===s)return k;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(k),k+=A*s+N*u-(E*f+S*c),k>=C||-k>=C)return k;m=u*N,h=au*u,d=h-(h-u),p=u-d,h=au*N,g=h-(h-N),y=N-g,x=p*y-(m-d*g-p*g-d*y),w=c*S,h=au*c,d=h-(h-c),p=c-d,h=au*S,g=h-(h-S),y=S-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,du[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,du[1]=b-(v+l)+(l-w),T=_+v,l=T-_,du[2]=_-(T-l)+(v-l),du[3]=T;const P=uu(4,fu,4,du,su);m=A*s,h=au*A,d=h-(h-A),p=A-d,h=au*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=E*f,h=au*E,d=h-(h-E),p=E-d,h=au*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,du[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,du[1]=b-(v+l)+(l-w),T=_+v,l=T-_,du[2]=_-(T-l)+(v-l),du[3]=T;const z=uu(P,su,4,du,lu);m=u*s,h=au*u,d=h-(h-u),p=u-d,h=au*s,g=h-(h-s),y=s-g,x=p*y-(m-d*g-p*g-d*y),w=c*f,h=au*c,d=h-(h-c),p=c-d,h=au*f,g=h-(h-f),y=f-g,M=p*y-(w-d*g-p*g-d*y),v=x-M,l=x-v,du[0]=x-(v+l)+(l-M),_=m+v,l=_-m,b=m-(_-l)+(v-l),v=b-w,l=b-v,du[1]=b-(v+l)+(l-w),T=_+v,l=T-_,du[2]=_-(T-l)+(v-l),du[3]=T;const $=uu(z,lu,4,du,hu);return hu[$-1]}(t,n,e,r,i,o,f)}const gu=Math.pow(2,-52),yu=new Uint32Array(512);class vu{static from(t,n=Mu,e=Tu){const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,c=-1/0,f=-1/0;for(let n=0;nc&&(c=e),r>f&&(f=r),this._ids[n]=n}const s=(a+c)/2,l=(u+f)/2;let h,d,p,g=1/0;for(let n=0;n0&&(d=n,g=e)}let _=t[2*d],b=t[2*d+1],m=1/0;for(let n=0;nr&&(n[e++]=i,r=this._dists[i])}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(pu(y,v,_,b,x,w)<0){const t=d,n=_,e=b;d=p,_=x,b=w,p=t,x=n,w=e}const M=function(t,n,e,r,i,o){const a=e-t,u=r-n,c=i-t,f=o-n,s=a*a+u*u,l=c*c+f*f,h=.5/(a*f-u*c),d=t+(f*s-u*l)*h,p=n+(a*l-c*s)*h;return{x:d,y:p}}(y,v,_,b,x,w);this._cx=M.x,this._cy=M.y;for(let n=0;n0&&Math.abs(f-o)<=gu&&Math.abs(s-a)<=gu)continue;if(o=f,a=s,c===h||c===d||c===p)continue;let l=0;for(let t=0,n=this._hashKey(f,s);t=0;)if(y=g,y===l){y=-1;break}if(-1===y)continue;let v=this._addTriangle(y,c,e[y],-1,-1,r[y]);r[c]=this._legalize(v+2),r[y]=v,T++;let _=e[y];for(;g=e[_],pu(f,s,t[2*_],t[2*_+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(_,c,g,r[c],-1,r[_]),r[c]=this._legalize(v+2),e[_]=_,T--,_=g;if(y===l)for(;g=n[y],pu(f,s,t[2*g],t[2*g+1],t[2*y],t[2*y+1])<0;)v=this._addTriangle(g,c,y,-1,r[y],r[g]),this._legalize(v+2),r[g]=v,e[y]=y,T--,y=g;this._hullStart=n[c]=y,e[y]=n[_]=c,e[c]=_,i[this._hashKey(f,s)]=c,i[this._hashKey(t[2*y],t[2*y+1])]=y}this.hull=new Uint32Array(T);for(let t=0,n=this._hullStart;t0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=yu[--i];continue}const c=a-a%3,f=u+(t+1)%3,s=c+(a+2)%3,l=n[o],h=n[t],d=n[f],p=n[s];if(bu(r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){n[t]=p,n[a]=l;const r=e[s];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===s){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,s);const u=c+(a+1)%3;i=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;wu(t,e+r>>1,i),n[t[e]]>n[t[r]]&&wu(t,e,r),n[t[i]]>n[t[r]]&&wu(t,i,r),n[t[e]]>n[t[i]]&&wu(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]u);if(o=o-e?(xu(t,n,i,r),xu(t,n,e,o-1)):(xu(t,n,e,o-1),xu(t,n,i,r))}}function wu(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function Mu(t){return t[0]}function Tu(t){return t[1]}const Au=1e-6;class Su{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Au||Math.abs(this._y1-i)>Au)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class Eu{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class Nu{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let n,r,o=0,a=0,u=e.length;o1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)this.xmax?2:0)|(nthis.ymax?8:0)}}const ku=2*Math.PI,Cu=Math.pow;function Pu(t){return t[0]}function zu(t){return t[1]}function $u(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class Du{static from(t,n=Pu,e=zu,r){return new Du("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new Nu(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:c}=this;if(-1===r[t]||!c.length)return(t+1)%(c.length>>1);let f=t,s=Cu(n-c[2*t],2)+Cu(e-c[2*t+1],2);const l=r[t];let h=l;do{let r=u[h];const l=Cu(n-c[2*r],2)+Cu(e-c[2*r+1],2);if(l9999?"+"+Iu(n,6):Iu(n,4))+"-"+Iu(t.getUTCMonth()+1,2)+"-"+Iu(t.getUTCDate(),2)+(o?"T"+Iu(e,2)+":"+Iu(r,2)+":"+Iu(i,2)+"."+Iu(o,3)+"Z":i?"T"+Iu(e,2)+":"+Iu(r,2)+":"+Iu(i,2)+"Z":r||e?"T"+Iu(e,2)+":"+Iu(r,2)+"Z":"")}function Bu(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,c=o<=0,f=!1;function s(){if(c)return Fu;if(f)return f=!1,Ru;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++=o?c=!0:10===(r=t.charCodeAt(a++))?f=!0:13===r&&(f=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;acc(n,e).then((n=>(new DOMParser).parseFromString(n,t)))}var pc=dc("application/xml"),gc=dc("text/html"),yc=dc("image/svg+xml");function vc(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,c,f,s,l,h,d=t._root,p={data:r},g=t._x0,y=t._y0,v=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((f=n>=(o=(g+v)/2))?g=o:v=o,(s=e>=(a=(y+_)/2))?y=a:_=a,i=d,!(d=d[l=s<<1|f]))return i[l]=p,t;if(u=+t._x.call(null,d.data),c=+t._y.call(null,d.data),n===u&&e===c)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(f=n>=(o=(g+v)/2))?g=o:v=o,(s=e>=(a=(y+_)/2))?y=a:_=a}while((l=s<<1|f)==(h=(c>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function _c(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function bc(t){return t[0]}function mc(t){return t[1]}function xc(t,n,e){var r=new wc(null==n?bc:n,null==e?mc:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function wc(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Mc(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var Tc=xc.prototype=wc.prototype;function Ac(t){return function(){return t}}function Sc(t){return 1e-6*(t()-.5)}function Ec(t){return t.x+t.vx}function Nc(t){return t.y+t.vy}function kc(t){return t.index}function Cc(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}Tc.copy=function(){var t,n,e=new wc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=Mc(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=Mc(n));return e},Tc.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return vc(this.cover(n,e),n,e,t)},Tc.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,f=1/0,s=-1/0,l=-1/0;for(e=0;es&&(s=r),il&&(l=i));if(c>s||f>l)return this;for(this.cover(c,f).cover(s,l),e=0;et||t>=i||r>n||n>=o;)switch(u=(nh||(o=c.y0)>d||(a=c.x1)=v)<<1|t>=y)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var _=t-+this._x.call(null,g.data),b=n-+this._y.call(null,g.data),m=_*_+b*b;if(m=(u=(p+y)/2))?p=u:y=u,(s=a>=(c=(g+v)/2))?g=c:v=c,n=d,!(d=d[l=s<<1|f]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},Tc.removeAll=function(t){for(var n=0,e=t.length;n1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Fc(t){return(t=Rc(Math.abs(t)))?t[1]:NaN}var qc,Uc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ic(t){if(!(n=Uc.exec(t)))throw new Error("invalid format: "+t);var n;return new Oc({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Oc(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Bc(t,n){var e=Rc(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Ic.prototype=Oc.prototype,Oc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Yc={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Bc(100*t,n),r:Bc,s:function(t,n){var e=Rc(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(qc=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Rc(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Lc(t){return t}var jc,Hc=Array.prototype.map,Xc=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gc(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Lc:(n=Hc.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Lc:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Hc.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Ic(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,y=t.precision,v=t.trim,_=t.type;"n"===_?(g=!0,_="g"):Yc[_]||(void 0===y&&(y=12),v=!0,_="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",m="$"===h?o:/[%p]/.test(_)?c:"",x=Yc[_],w=/[defgprs%]/.test(_);function M(t){var i,o,c,h=b,M=m;if("c"===_)M=x(t)+M,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?s:x(Math.abs(t),y),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),T&&0==+t&&"+"!==l&&(T=!1),h=(T?"("===l?l:f:"-"===l||"("===l?"":l)+h,M=("s"===_?Xc[8+qc/3]:"")+M+(T&&"("===l?")":""),w)for(i=-1,o=t.length;++i(c=t.charCodeAt(i))||c>57){M=(46===c?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,S=A>1)+h+t+M+S.slice(A);break;default:t=S+h+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:l,formatPrefix:function(t,n){var e=l(((t=Ic(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Fc(n)/3))),i=Math.pow(10,-r),o=Xc[8+r/3];return function(t){return e(i*t)+o}}}}function Vc(n){return jc=Gc(n),t.format=jc.format,t.formatPrefix=jc.formatPrefix,jc}function Wc(t){return Math.max(0,-Fc(Math.abs(t)))}function Zc(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Fc(n)/3)))-Fc(Math.abs(t)))}function Kc(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Fc(n)-Fc(t))+1}t.format=void 0,t.formatPrefix=void 0,Vc({thousands:",",grouping:[3],currency:["$",""]});var Qc=1e-6,Jc=1e-12,tf=Math.PI,nf=tf/2,ef=tf/4,rf=2*tf,of=180/tf,af=tf/180,uf=Math.abs,cf=Math.atan,ff=Math.atan2,sf=Math.cos,lf=Math.ceil,hf=Math.exp,df=Math.hypot,pf=Math.log,gf=Math.pow,yf=Math.sin,vf=Math.sign||function(t){return t>0?1:t<0?-1:0},_f=Math.sqrt,bf=Math.tan;function mf(t){return t>1?0:t<-1?tf:Math.acos(t)}function xf(t){return t>1?nf:t<-1?-nf:Math.asin(t)}function wf(t){return(t=yf(t/2))*t}function Mf(){}function Tf(t,n){t&&Sf.hasOwnProperty(t.type)&&Sf[t.type](t,n)}var Af={Feature:function(t,n){Tf(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,o=sf(n=(n*=af)/2+ef),a=yf(n),u=Df*a,c=$f*o+u*sf(i),f=u*r*yf(i);Xf.add(ff(f,c)),zf=t,$f=o,Df=a}function Jf(t){return[ff(t[1],t[0]),xf(t[2])]}function ts(t){var n=t[0],e=t[1],r=sf(e);return[r*sf(n),r*yf(n),yf(e)]}function ns(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function es(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function rs(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function is(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function os(t){var n=_f(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var as,us,cs,fs,ss,ls,hs,ds,ps,gs,ys,vs,_s,bs,ms,xs,ws={point:Ms,lineStart:As,lineEnd:Ss,polygonStart:function(){ws.point=Es,ws.lineStart=Ns,ws.lineEnd=ks,Lf=new A,Vf.polygonStart()},polygonEnd:function(){Vf.polygonEnd(),ws.point=Ms,ws.lineStart=As,ws.lineEnd=Ss,Xf<0?(Rf=-(qf=180),Ff=-(Uf=90)):Lf>Qc?Uf=90:Lf<-1e-6&&(Ff=-90),Hf[0]=Rf,Hf[1]=qf},sphere:function(){Rf=-(qf=180),Ff=-(Uf=90)}};function Ms(t,n){jf.push(Hf=[Rf=t,qf=t]),nUf&&(Uf=n)}function Ts(t,n){var e=ts([t*af,n*af]);if(Yf){var r=es(Yf,e),i=es([r[1],-r[0],0],r);os(i),i=Jf(i);var o,a=t-If,u=a>0?1:-1,c=i[0]*of*u,f=uf(a)>180;f^(u*IfUf&&(Uf=o):f^(u*If<(c=(c+360)%360-180)&&cUf&&(Uf=n)),f?tCs(Rf,qf)&&(qf=t):Cs(t,qf)>Cs(Rf,qf)&&(Rf=t):qf>=Rf?(tqf&&(qf=t)):t>If?Cs(Rf,t)>Cs(Rf,qf)&&(qf=t):Cs(t,qf)>Cs(Rf,qf)&&(Rf=t)}else jf.push(Hf=[Rf=t,qf=t]);nUf&&(Uf=n),Yf=e,If=t}function As(){ws.point=Ts}function Ss(){Hf[0]=Rf,Hf[1]=qf,ws.point=Ms,Yf=null}function Es(t,n){if(Yf){var e=t-If;Lf.add(uf(e)>180?e+(e>0?360:-360):e)}else Of=t,Bf=n;Vf.point(t,n),Ts(t,n)}function Ns(){Vf.lineStart()}function ks(){Es(Of,Bf),Vf.lineEnd(),uf(Lf)>Qc&&(Rf=-(qf=180)),Hf[0]=Rf,Hf[1]=qf,Yf=null}function Cs(t,n){return(n-=t)<0?n+360:n}function Ps(t,n){return t[0]-n[0]}function zs(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:ntf&&(t-=Math.round(t/rf)*rf),[t,n]}function Gs(t,n,e){return(t%=rf)?n||e?Hs(Ws(t),Zs(n,e)):Ws(t):n||e?Zs(n,e):Xs}function Vs(t){return function(n,e){return uf(n+=t)>tf&&(n-=Math.round(n/rf)*rf),[n,e]}}function Ws(t){var n=Vs(t);return n.invert=Vs(-t),n}function Zs(t,n){var e=sf(t),r=yf(t),i=sf(n),o=yf(n);function a(t,n){var a=sf(n),u=sf(t)*a,c=yf(t)*a,f=yf(n),s=f*e+u*r;return[ff(c*i-s*o,u*e-f*r),xf(s*i+c*o)]}return a.invert=function(t,n){var a=sf(n),u=sf(t)*a,c=yf(t)*a,f=yf(n),s=f*i-c*o;return[ff(c*i+f*o,u*e+s*r),xf(s*e-u*r)]},a}function Ks(t){function n(n){return(n=t(n[0]*af,n[1]*af))[0]*=of,n[1]*=of,n}return t=Gs(t[0]*af,t[1]*af,t.length>2?t[2]*af:0),n.invert=function(n){return(n=t.invert(n[0]*af,n[1]*af))[0]*=of,n[1]*=of,n},n}function Qs(t,n,e,r,i,o){if(e){var a=sf(n),u=yf(n),c=r*e;null==i?(i=n+r*rf,o=n-c/2):(i=Js(a,i),o=Js(a,o),(r>0?io)&&(i+=r*rf));for(var f,s=i;r>0?s>o:s1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function nl(t,n){return uf(t[0]-n[0])=0;--o)i.point((s=f[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}f=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function il(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,E=S*T,N=E>tf,k=y*w;if(c.add(ff(k*S*yf(E),v*M+k*sf(E))),a+=N?T+S*rf:T,N^p>=e^m>=e){var C=es(ts(d),ts(b));os(C);var P=es(o,C);os(P);var z=(N^T>=0?-1:1)*xf(P[2]);(r>z||r===z&&(C[0]||C[1]))&&(u+=N^T>=0?1:-1)}}return(a<-1e-6||a0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t1&&2&c&&h.push(h.pop().concat(h.shift())),a.push(h.filter(cl))}return h}}function cl(t){return t.length>1}function fl(t,n){return((t=t.x)[0]<0?t[1]-nf-Qc:nf-t[1])-((n=n.x)[0]<0?n[1]-nf-Qc:nf-n[1])}Xs.invert=Xs;var sl=ul((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?tf:-tf,c=uf(o-e);uf(c-tf)0?nf:-nf),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=tf&&(uf(e-i)Qc?cf((yf(n)*(o=sf(r))*yf(e)-yf(r)*(i=sf(n))*yf(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*nf,r.point(-tf,i),r.point(0,i),r.point(tf,i),r.point(tf,0),r.point(tf,-i),r.point(0,-i),r.point(-tf,-i),r.point(-tf,0),r.point(-tf,i);else if(uf(t[0]-n[0])>Qc){var o=t[0]0,i=uf(n)>Qc;function o(t,e){return sf(t)*sf(e)>n}function a(t,e,r){var i=[1,0,0],o=es(ts(t),ts(e)),a=ns(o,o),u=o[0],c=a-u*u;if(!c)return!r&&t;var f=n*a/c,s=-n*u/c,l=es(i,o),h=is(i,f);rs(h,is(o,s));var d=l,p=ns(h,d),g=ns(d,d),y=p*p-g*(ns(h,h)-1);if(!(y<0)){var v=_f(y),_=is(d,(-p-v)/g);if(rs(_,h),_=Jf(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x0^_[1]<(uf(_[0]-m)tf^(m<=_[0]&&_[0]<=x)){var S=is(d,(-p+v)/g);return rs(S,h),[_,Jf(S)]}}}function u(n,e){var i=r?t:tf-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return ul(o,(function(t){var n,e,c,f,s;return{lineStart:function(){f=c=!1,s=1},point:function(l,h){var d,p=[l,h],g=o(l,h),y=r?g?0:u(l,h):g?u(l+(l<0?tf:-tf),h):0;if(!n&&(f=c=g)&&t.lineStart(),g!==c&&(!(d=a(n,p))||nl(n,d)||nl(p,d))&&(p[2]=1),g!==c)s=0,g?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1],2),t.lineEnd()),n=d;else if(i&&n&&r^g){var v;y&e||!(v=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!g||n&&nl(n,p)||t.point(p[0],p[1]),n=p,c=g,e=y},lineEnd:function(){c&&t.lineEnd(),n=null},clean:function(){return s|(f&&c)<<1}}}),(function(n,r,i,o){Qs(o,t,e,i,n,r)}),r?[0,-t]:[-tf,t-tf])}var hl,dl,pl,gl,yl=1e9,vl=-yl;function _l(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,f){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||c(i,o)<0^u>0)do{f.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else f.point(o[0],o[1])}function a(r,i){return uf(r[0]-t)0?0:3:uf(r[0]-e)0?2:1:uf(r[1]-n)0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,f,s,l,h,d,p,g,y,v,_,b=a,m=tl(),x={point:w,lineStart:function(){x.point=M,f&&f.push(s=[]);v=!0,y=!1,p=g=NaN},lineEnd:function(){c&&(M(l,h),d&&y&&m.rejoin(),c.push(m.result()));x.point=w,y&&b.lineEnd()},polygonStart:function(){b=m,c=[],f=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=f.length;er&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(c=st(c)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&rl(c,u,n,o,a),a.polygonEnd());b=a,c=f=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(f&&s.push([o,a]),v)l=o,h=a,d=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&y)b.point(o,a);else{var c=[p=Math.max(vl,Math.min(yl,p)),g=Math.max(vl,Math.min(yl,g))],m=[o=Math.max(vl,Math.min(yl,o)),a=Math.max(vl,Math.min(yl,a))];!function(t,n,e,r,i,o){var a,u=t[0],c=t[1],f=0,s=1,l=n[0]-u,h=n[1]-c;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a0){if(a>s)return;a>f&&(f=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>f&&(f=a)}else if(l>0){if(a0)){if(a/=h,h<0){if(a0){if(a>s)return;a>f&&(f=a)}if(a=o-c,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>f&&(f=a)}else if(h>0){if(a0&&(t[0]=u+f*l,t[1]=c+f*h),s<1&&(n[0]=u+s*l,n[1]=c+s*h),!0}}}}}(c,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(y||(b.lineStart(),b.point(c[0],c[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,g=a,y=u}return x}}var bl={sphere:Mf,point:Mf,lineStart:function(){bl.point=xl,bl.lineEnd=ml},lineEnd:Mf,polygonStart:Mf,polygonEnd:Mf};function ml(){bl.point=bl.lineEnd=Mf}function xl(t,n){dl=t*=af,pl=yf(n*=af),gl=sf(n),bl.point=wl}function wl(t,n){t*=af;var e=yf(n*=af),r=sf(n),i=uf(t-dl),o=sf(i),a=r*yf(i),u=gl*e-pl*r*o,c=pl*e+gl*r*o;hl.add(ff(_f(a*a+u*u),c)),dl=t,pl=e,gl=r}function Ml(t){return hl=new A,kf(t,bl),+hl}var Tl=[null,null],Al={type:"LineString",coordinates:Tl};function Sl(t,n){return Tl[0]=t,Tl[1]=n,Ml(Al)}var El={Feature:function(t,n){return kl(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r0&&(i=Sl(t[o],t[o-1]))>0&&e<=i&&r<=i&&(e+r-i)*(1-Math.pow((e-r)/i,2))Qc})).map(c)).concat(ht(lf(o/d)*d,i,d).filter((function(t){return uf(t%g)>Qc})).map(f))}return v.lines=function(){return _().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(y)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(y)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(y=+h,c=Rl(o,i,90),f=Fl(n,t,y),s=Rl(u,a,90),l=Fl(r,e,y),v):y},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var Ul,Il,Ol,Bl,Yl=t=>t,Ll=new A,jl=new A,Hl={point:Mf,lineStart:Mf,lineEnd:Mf,polygonStart:function(){Hl.lineStart=Xl,Hl.lineEnd=Wl},polygonEnd:function(){Hl.lineStart=Hl.lineEnd=Hl.point=Mf,Ll.add(uf(jl)),jl=new A},result:function(){var t=Ll/2;return Ll=new A,t}};function Xl(){Hl.point=Gl}function Gl(t,n){Hl.point=Vl,Ul=Ol=t,Il=Bl=n}function Vl(t,n){jl.add(Bl*t-Ol*n),Ol=t,Bl=n}function Wl(){Vl(Ul,Il)}var Zl=Hl,Kl=1/0,Ql=Kl,Jl=-Kl,th=Jl,nh={point:function(t,n){tJl&&(Jl=t);nth&&(th=n)},lineStart:Mf,lineEnd:Mf,polygonStart:Mf,polygonEnd:Mf,result:function(){var t=[[Kl,Ql],[Jl,th]];return Jl=th=-(Ql=Kl=1/0),t}};var eh,rh,ih,oh,ah=nh,uh=0,ch=0,fh=0,sh=0,lh=0,hh=0,dh=0,ph=0,gh=0,yh={point:vh,lineStart:_h,lineEnd:xh,polygonStart:function(){yh.lineStart=wh,yh.lineEnd=Mh},polygonEnd:function(){yh.point=vh,yh.lineStart=_h,yh.lineEnd=xh},result:function(){var t=gh?[dh/gh,ph/gh]:hh?[sh/hh,lh/hh]:fh?[uh/fh,ch/fh]:[NaN,NaN];return uh=ch=fh=sh=lh=hh=dh=ph=gh=0,t}};function vh(t,n){uh+=t,ch+=n,++fh}function _h(){yh.point=bh}function bh(t,n){yh.point=mh,vh(ih=t,oh=n)}function mh(t,n){var e=t-ih,r=n-oh,i=_f(e*e+r*r);sh+=i*(ih+t)/2,lh+=i*(oh+n)/2,hh+=i,vh(ih=t,oh=n)}function xh(){yh.point=vh}function wh(){yh.point=Th}function Mh(){Ah(eh,rh)}function Th(t,n){yh.point=Ah,vh(eh=ih=t,rh=oh=n)}function Ah(t,n){var e=t-ih,r=n-oh,i=_f(e*e+r*r);sh+=i*(ih+t)/2,lh+=i*(oh+n)/2,hh+=i,dh+=(i=oh*t-ih*n)*(ih+t),ph+=i*(oh+n),gh+=3*i,vh(ih=t,oh=n)}var Sh=yh;function Eh(t){this._context=t}Eh.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,rf)}},result:Mf};var Nh,kh,Ch,Ph,zh,$h=new A,Dh={point:Mf,lineStart:function(){Dh.point=Rh},lineEnd:function(){Nh&&Fh(kh,Ch),Dh.point=Mf},polygonStart:function(){Nh=!0},polygonEnd:function(){Nh=null},result:function(){var t=+$h;return $h=new A,t}};function Rh(t,n){Dh.point=Fh,kh=Ph=t,Ch=zh=n}function Fh(t,n){Ph-=t,zh-=n,$h.add(_f(Ph*Ph+zh*zh)),Ph=t,zh=n}var qh=Dh;let Uh,Ih,Oh,Bh;class Yh{constructor(t){this._append=null==t?Lh:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return Lh;if(n!==Uh){const t=10**n;Uh=n,Ih=function(n){let e=1;this._+=n[0];for(const r=n.length;e4*n&&g--){var m=a+h,x=u+d,w=c+p,M=_f(m*m+x*x+w*w),T=xf(w/=M),A=uf(uf(w)-1)n||uf((v*k+_*C)/b-.5)>.3||a*h+u*d+c*p2?t[2]%360*af:0,k()):[y*of,v*of,_*of]},E.angle=function(t){return arguments.length?(b=t%360*af,k()):b*of},E.reflectX=function(t){return arguments.length?(m=t?-1:1,k()):m<0},E.reflectY=function(t){return arguments.length?(x=t?-1:1,k()):x<0},E.precision=function(t){return arguments.length?(a=Qh(u,S=t*t),C()):_f(S)},E.fitExtent=function(t,n){return Gh(E,t,n)},E.fitSize=function(t,n){return Vh(E,t,n)},E.fitWidth=function(t,n){return Wh(E,t,n)},E.fitHeight=function(t,n){return Zh(E,t,n)},function(){return n=t.apply(this,arguments),E.invert=n.invert&&N,k()}}function rd(t){var n=0,e=tf/3,r=ed(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*af,e=t[1]*af):[n*of,e*of]},i}function id(t,n){var e=yf(t),r=(e+yf(n))/2;if(uf(r)0?n<-nf+Qc&&(n=-nf+Qc):n>nf-Qc&&(n=nf-Qc);var e=i/gf(dd(n),r);return[e*yf(r*t),i-e*sf(r*t)]}return o.invert=function(t,n){var e=i-n,o=vf(r)*_f(t*t+e*e),a=ff(t,uf(e))*vf(e);return e*r<0&&(a-=tf*vf(t)*vf(e)),[a/r,2*cf(gf(i/o,1/r))-nf]},o}function gd(t,n){return[t,n]}function yd(t,n){var e=sf(t),r=t===n?yf(t):(e-sf(n))/(n-t),i=e/r+t;if(uf(r)=0;)n+=e[r].value;else n=1;t.value=n}function zd(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=Dd)):void 0===n&&(n=$d);for(var e,r,i,o,a,u=new qd(t),c=[u];e=c.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)c.push(r=i[o]=new qd(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(Fd)}function $d(t){return t.children}function Dd(t){return Array.isArray(t)?t[1]:null}function Rd(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Fd(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function qd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Ud(t){return null==t?null:Id(t)}function Id(t){if("function"!=typeof t)throw new Error;return t}function Od(){return 0}function Bd(t){return function(){return t}}wd.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(vd+_d*i+o*(bd+md*i))-n)/(vd+3*_d*i+o*(7*bd+9*md*i)))*r)*i*i,!(uf(e)Qc&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Ad.invert=cd(xf),Sd.invert=cd((function(t){return 2*cf(t)})),Ed.invert=function(t,n){return[-n,2*cf(hf(t))-nf]},qd.prototype=zd.prototype={constructor:qd,count:function(){return this.eachAfter(Pd)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],c=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return zd(this).eachBefore(Rd)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e(t=(1664525*t+1013904223)%Yd)/Yd}function jd(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i0&&e*e>r*r+i*i}function Vd(t,n){for(var e=0;e1e-6?(E+Math.sqrt(E*E-4*S*N))/(2*S):N/E);return{x:r+w+M*k,y:i+T+A*k,r:k}}function Qd(t,n,e){var r,i,o,a,u=t.x-n.x,c=t.y-n.y,f=u*u+c*c;f?(i=n.r+e.r,i*=i,a=t.r+e.r,i>(a*=a)?(r=(f+a-i)/(2*f),o=Math.sqrt(Math.max(0,a/f-r*r)),e.x=t.x-r*u-o*c,e.y=t.y-r*c+o*u):(r=(f+i-a)/(2*f),o=Math.sqrt(Math.max(0,i/f-r*r)),e.x=n.x+r*u-o*c,e.y=n.y+r*c+o*u)):(e.x=n.x+e.r,e.y=n.y)}function Jd(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function tp(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function np(t){this._=t,this.next=null,this.previous=null}function ep(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,c,f,s,l,h;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;Qd(r,e,i=t[2]),e=new np(e),r=new np(r),i=new np(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(c=3;c1&&!gp(t,n););return t.slice(0,n)}function gp(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(0==(1&e))return!0}return!1}function yp(t,n){return t.parent===n.parent?1:2}function vp(t){var n=t.children;return n?n[0]:t.t}function _p(t){var n=t.children;return n?n[n.length-1]:t.t}function bp(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function mp(t,n,e){return t.a.parent===n.parent?t.a:e}function xp(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function wp(t,n,e,r,i){for(var o,a=t.children,u=-1,c=a.length,f=t.value&&(i-e)/t.value;++uh&&(h=u),y=s*s*g,(d=Math.max(h/y,y/l))>p){s-=u;break}p=d}v.push(a={value:s,dice:c1?n:1)},e}(Mp);var Sp=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,c,f,s,l=-1,h=a.length,d=t.value;++l1?n:1)},e}(Mp);function Ep(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function Np(t,n){return t[0]-n[0]||t[1]-n[1]}function kp(t){const n=t.length,e=[0,1];let r,i=2;for(r=2;r1&&Ep(t[e[i-2]],t[e[i-1]],t[r])<=0;)--i;e[i++]=r}return e.slice(0,i)}var Cp=Math.random,Pp=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(Cp),zp=function t(n){function e(t,e){return arguments.length<2&&(e=t,t=0),t=Math.floor(t),e=Math.floor(e)-t,function(){return Math.floor(n()*e+t)}}return e.source=t,e}(Cp),$p=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(Cp),Dp=function t(n){var e=$p.source(n);function r(){var t=e.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Cp),Rp=function t(n){function e(t){return(t=+t)<=0?()=>0:function(){for(var e=0,r=t;r>1;--r)e+=n();return e+r*n()}}return e.source=t,e}(Cp),Fp=function t(n){var e=Rp.source(n);function r(t){if(0==(t=+t))return n;var r=e(t);return function(){return r()/t}}return r.source=t,r}(Cp),qp=function t(n){function e(t){return function(){return-Math.log1p(-n())/t}}return e.source=t,e}(Cp),Up=function t(n){function e(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-n(),t)}}return e.source=t,e}(Cp),Ip=function t(n){function e(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(n()+t)}}return e.source=t,e}(Cp),Op=function t(n){function e(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-n())/t)})}return e.source=t,e}(Cp),Bp=function t(n){var e=$p.source(n)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-n())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(n(),1/t):()=>1;return function(){do{do{var t=e(),u=1+o*t}while(u<=0);u*=u*u;var c=1-n()}while(c>=1-.0331*t*t*t*t&&Math.log(c)>=.5*t*t+i*(1-u+Math.log(u)));return i*u*a()*r}}return r.source=t,r}(Cp),Yp=function t(n){var e=Bp.source(n);function r(t,n){var r=e(t),i=e(n);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Cp),Lp=function t(n){var e=Op.source(n),r=Yp.source(n);function i(t,n){return t=+t,(n=+n)>=1?()=>t:n<=0?()=>0:function(){for(var i=0,o=t,a=n;o*a>16&&o*(1-a)>16;){var u=Math.floor((o+1)*a),c=r(u,o-u+1)();c<=a?(i+=u,o-=u,a=(a-c)/(1-c)):(o=u-1,a/=c)}for(var f=a<.5,s=e(f?a:1-a),l=s(),h=0;l<=o;++h)l+=s();return i+(f?h:o-h)}}return i.source=t,i}(Cp),jp=function t(n){function e(t,e,r){var i;return 0==(t=+t)?i=t=>-Math.log(t):(t=1/t,i=n=>Math.pow(n,t)),e=null==e?0:+e,r=null==r?1:+r,function(){return e+r*i(-Math.log1p(-n()))}}return e.source=t,e}(Cp),Hp=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,function(){return t+e*Math.tan(Math.PI*n())}}return e.source=t,e}(Cp),Xp=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,function(){var r=n();return t+e*Math.log(r/(1-r))}}return e.source=t,e}(Cp),Gp=function t(n){var e=Bp.source(n),r=Lp.source(n);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),u=e(a)();if(u>o)return i+r(a-1,o/u)();i+=a,o-=u}for(var c=-Math.log1p(-n()),f=0;c<=o;++f)c-=Math.log1p(-n());return i+f}}return i.source=t,i}(Cp);const Vp=1/4294967296;function Wp(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Zp(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const Kp=Symbol("implicit");function Qp(){var t=new InternMap,n=[],e=[],r=Kp;function i(i){let o=t.get(i);if(void 0===o){if(r!==Kp)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new InternMap;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Qp(n,e).unknown(r)},Wp.apply(i,arguments),i}function Jp(){var t,n,e=Qp().unknown(void 0),r=e.domain,i=e.range,o=0,a=1,u=!1,c=0,f=0,s=.5;function l(){var e=r().length,l=an&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?ag:og,i=o=null,l}function l(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,c)))(t(f(n)))}return l.invert=function(e){return f(n((o||(o=r(u,a.map(t),Br)))(e)))},l.domain=function(t){return arguments.length?(a=Array.from(t,ng),s()):a.slice()},l.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},l.rangeRound=function(t){return u=Array.from(t),c=Gr,s()},l.clamp=function(t){return arguments.length?(f=!!t||rg,s()):f!==rg},l.interpolate=function(t){return arguments.length?(c=t,s()):c},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,s()}}function fg(){return cg()(rg,rg)}function sg(n,e,r,i){var o,a=Z(n,e,r);switch((i=Ic(null==i?",f":i)).type){case"s":var u=Math.max(Math.abs(n),Math.abs(e));return null!=i.precision||isNaN(o=Zc(a,u))||(i.precision=o),t.formatPrefix(i,u);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=Kc(a,Math.max(Math.abs(n),Math.abs(e))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=Wc(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function lg(t){var n=t.domain;return t.ticks=function(t){var e=n();return V(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return sg(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,c=o[a],f=o[u],s=10;for(f0;){if((i=W(c,f,e))===r)return o[a]=c,o[u]=f,n(o);if(i>0)c=Math.floor(c/i)*i,f=Math.ceil(f/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,f=Math.floor(f*i)/i}r=i}return t},t}function hg(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a-t(-n,e)}function bg(n){const e=n(dg,pg),r=e.domain;let i,o,a=10;function u(){return i=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(a),o=function(t){return 10===t?vg:t===Math.E?Math.exp:n=>Math.pow(t,n)}(a),r()[0]<0?(i=_g(i),o=_g(o),n(gg,yg)):n(dg,pg),e}return e.base=function(t){return arguments.length?(a=+t,u()):a},e.domain=function(t){return arguments.length?(r(t),u()):r()},e.ticks=t=>{const n=r();let e=n[0],u=n[n.length-1];const c=u0){for(;l<=h;++l)for(f=1;f