(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function e(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=e(i);fetch(i.href,o)}})();function Kt(t,n){return t==null||n==null?NaN:tn?1:t>=n?0:NaN}function _i(t,n){return t==null||n==null?NaN:nt?1:n>=t?0:NaN}function qt(t){let n,e,r;t.length!==2?(n=Kt,e=(s,c)=>Kt(t(s),c),r=(s,c)=>t(s)-c):(n=t===Kt||t===_i?t:wi,e=t,r=t);function i(s,c,u=0,l=s.length){if(u>>1;e(s[f],c)<0?u=f+1:l=f}while(u>>1;e(s[f],c)<=0?u=f+1:l=f}while(uu&&r(s[f-1],c)>-r(s[f],c)?f-1:f}return{left:i,center:a,right:o}}function wi(){return 0}function vi(t){return t===null?NaN:+t}const xi=qt(Kt),Mi=xi.right;qt(vi).center;function rr(t,n){let e,r;if(n===void 0)for(const i of t)i!=null&&(e===void 0?i>=i&&(e=r=i):(e>i&&(e=i),r=o&&(e=r=o):(e>o&&(e=o),r=bi?10:o>=Ti?5:o>=ki?2:1;let s,c,u;return i<0?(u=Math.pow(10,-i)/a,s=Math.round(t*u),c=Math.round(n*u),s/un&&--c,u=-u):(u=Math.pow(10,i)*a,s=Math.round(t/u),c=Math.round(n/u),s*un&&--c),c0))return[];if(t===n)return[t];const r=n=i))return[];const s=o-i+1,c=new Array(s);if(r)if(a<0)for(let u=0;u=r)&&(e=r);else{let r=-1;for(let i of t)(i=n(i,++r,t))!=null&&(e=i)&&(e=i)}return e}function me(t,n){let e;if(n===void 0)for(const r of t)r!=null&&(e>r||e===void 0&&r>=r)&&(e=r);else{let r=-1;for(let i of t)(i=n(i,++r,t))!=null&&(e>i||e===void 0&&i>=i)&&(e=i)}return e}function $i(t){return t}var $n=1,Sn=2,Rn=3,It=4,ye=1e-6;function Si(t){return"translate("+t+",0)"}function Ni(t){return"translate(0,"+t+")"}function Ai(t){return n=>+t(n)}function Di(t,n){return n=Math.max(0,t.bandwidth()-n*2)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function Ui(){return!this.__axis}function ir(t,n){var e=[],r=null,i=null,o=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=t===$n||t===It?-1:1,l=t===It||t===Sn?"x":"y",f=t===$n||t===Rn?Si:Ni;function h(d){var y=r??(n.ticks?n.ticks.apply(n,e):n.domain()),T=i??(n.tickFormat?n.tickFormat.apply(n,e):$i),x=Math.max(o,0)+s,N=n.range(),g=+N[0]+c,w=+N[N.length-1]+c,C=(n.bandwidth?Di:Ai)(n.copy(),c),M=d.selection?d.selection():d,v=M.selectAll(".domain").data([null]),b=M.selectAll(".tick").data(y,n).order(),I=b.exit(),A=b.enter().append("g").attr("class","tick"),Y=b.select("line"),_=b.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(A),Y=Y.merge(A.append("line").attr("stroke","currentColor").attr(l+"2",u*o)),_=_.merge(A.append("text").attr("fill","currentColor").attr(l,u*x).attr("dy",t===$n?"0em":t===Rn?"0.71em":"0.32em")),d!==M&&(v=v.transition(d),b=b.transition(d),Y=Y.transition(d),_=_.transition(d),I=I.transition(d).attr("opacity",ye).attr("transform",function(U){return isFinite(U=C(U))?f(U+c):this.getAttribute("transform")}),A.attr("opacity",ye).attr("transform",function(U){var D=this.parentNode.__axis;return f((D&&isFinite(D=D(U))?D:C(U))+c)})),I.remove(),v.attr("d",t===It||t===Sn?a?"M"+u*a+","+g+"H"+c+"V"+w+"H"+u*a:"M"+c+","+g+"V"+w:a?"M"+g+","+u*a+"V"+c+"H"+w+"V"+u*a:"M"+g+","+c+"H"+w),b.attr("opacity",1).attr("transform",function(U){return f(C(U)+c)}),Y.attr(l+"2",u*o),_.attr(l,u*x).text(T),M.filter(Ui).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Sn?"start":t===It?"end":"middle"),M.each(function(){this.__axis=C})}return h.scale=function(d){return arguments.length?(n=d,h):n},h.ticks=function(){return e=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(e=d==null?[]:Array.from(d),h):e.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(o=a=+d,h):o},h.tickSizeInner=function(d){return arguments.length?(o=+d,h):o},h.tickSizeOuter=function(d){return arguments.length?(a=+d,h):a},h.tickPadding=function(d){return arguments.length?(s=+d,h):s},h.offset=function(d){return arguments.length?(c=+d,h):c},h}function or(t){return ir(Rn,t)}function ar(t){return ir(It,t)}var Ei={value:()=>{}};function sr(){for(var t=0,n=arguments.length,e={},r;t=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}jt.prototype=sr.prototype={constructor:jt,on:function(t,n){var e=this._,r=Fi(t+"",e),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var e=new Array(i),r=0,i,o;r=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),we.hasOwnProperty(n)?{space:we[n],local:t}:t}function Yi(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Pn&&n.documentElement.namespaceURI===Pn?n.createElement(t):n.createElementNS(e,t)}}function Ii(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ur(t){var n=_n(t);return(n.local?Ii:Yi)(n)}function Li(){}function Jn(t){return t==null?Li:function(){return this.querySelector(t)}}function Ri(t){typeof t!="function"&&(t=Jn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=w&&(w=g+1);!(M=x[w])&&++w=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function co(t){t||(t=lo);function n(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var e=this._groups,r=e.length,i=new Array(r),o=0;on?1:t>=n?0:NaN}function fo(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ho(){return Array.from(this)}function po(){for(var t=this._groups,n=0,e=t.length;n1?this.each((n==null?ko:typeof n=="function"?$o:Co)(t,n,e??"")):Ct(this.node(),t)}function Ct(t,n){return t.style.getPropertyValue(n)||pr(t).getComputedStyle(t,null).getPropertyValue(n)}function No(t){return function(){delete this[t]}}function Ao(t,n){return function(){this[t]=n}}function Do(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function Uo(t,n){return arguments.length>1?this.each((n==null?No:typeof n=="function"?Do:Ao)(t,n)):this.node()[t]}function gr(t){return t.trim().split(/^|\s+/)}function Kn(t){return t.classList||new mr(t)}function mr(t){this._node=t,this._names=gr(t.getAttribute("class")||"")}mr.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function yr(t,n){for(var e=Kn(t),r=-1,i=n.length;++r=0&&(e=n.slice(r+1),n=n.slice(0,r)),{type:n,name:e}})}function aa(t){return function(){var n=this.__on;if(n){for(var e=0,r=-1,i=n.length,o;e>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):e===8?Bt(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):e===4?Bt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=ma.exec(t))?new L(n[1],n[2],n[3],1):(n=ya.exec(t))?new L(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=_a.exec(t))?Bt(n[1],n[2],n[3],n[4]):(n=wa.exec(t))?Bt(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=va.exec(t))?Ce(n[1],n[2]/100,n[3]/100,1):(n=xa.exec(t))?Ce(n[1],n[2]/100,n[3]/100,n[4]):ve.hasOwnProperty(t)?be(ve[t]):t==="transparent"?new L(NaN,NaN,NaN,0):null}function be(t){return new L(t>>16&255,t>>8&255,t&255,1)}function Bt(t,n,e,r){return r<=0&&(t=n=e=NaN),new L(t,n,e,r)}function xr(t){return t instanceof Ut||(t=gt(t)),t?(t=t.rgb(),new L(t.r,t.g,t.b,t.opacity)):new L}function On(t,n,e,r){return arguments.length===1?xr(t):new L(t,n,e,r??1)}function L(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}wn(L,On,te(Ut,{brighter(t){return t=t==null?$t:Math.pow($t,t),new L(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?pt:Math.pow(pt,t),new L(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new L(ht(this.r),ht(this.g),ht(this.b),sn(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:Te,formatHex:Te,formatHex8:Ta,formatRgb:ke,toString:ke}));function Te(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}`}function Ta(){return`#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity)?1:this.opacity)*255)}`}function ke(){const t=sn(this.opacity);return`${t===1?"rgb(":"rgba("}${ht(this.r)}, ${ht(this.g)}, ${ht(this.b)}${t===1?")":`, ${t})`}`}function sn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ht(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ft(t){return t=ht(t),(t<16?"0":"")+t.toString(16)}function Ce(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Z(t,n,e,r)}function Mr(t){if(t instanceof Z)return new Z(t.h,t.s,t.l,t.opacity);if(t instanceof Ut||(t=gt(t)),!t)return new Z;if(t instanceof Z)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,c=(o+i)/2;return s?(n===o?a=(e-r)/s+(e0&&c<1?0:a,new Z(a,s,c,t.opacity)}function ka(t,n,e,r){return arguments.length===1?Mr(t):new Z(t,n,e,r??1)}function Z(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}wn(Z,ka,te(Ut,{brighter(t){return t=t==null?$t:Math.pow($t,t),new Z(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?pt:Math.pow(pt,t),new Z(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,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 L(Nn(t>=240?t-240:t+120,i,r),Nn(t,i,r),Nn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Z($e(this.h),Gt(this.s),Gt(this.l),sn(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=sn(this.opacity);return`${t===1?"hsl(":"hsla("}${$e(this.h)}, ${Gt(this.s)*100}%, ${Gt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function $e(t){return t=(t||0)%360,t<0?t+360:t}function Gt(t){return Math.max(0,Math.min(1,t||0))}function Nn(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}const Ca=Math.PI/180,$a=180/Math.PI;var br=-.14861,ne=1.78277,ee=-.29227,vn=-.90649,Wt=1.97294,Se=Wt*vn,Ne=Wt*ne,Ae=ne*ee-vn*br;function Sa(t){if(t instanceof dt)return new dt(t.h,t.s,t.l,t.opacity);t instanceof L||(t=xr(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Ae*r+Se*n-Ne*e)/(Ae+Se-Ne),o=r-i,a=(Wt*(e-i)-ee*o)/vn,s=Math.sqrt(a*a+o*o)/(Wt*i*(1-i)),c=s?Math.atan2(a,o)*$a-120:NaN;return new dt(c<0?c+360:c,s,i,t.opacity)}function ut(t,n,e,r){return arguments.length===1?Sa(t):new dt(t,n,e,r??1)}function dt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}wn(dt,ut,te(Ut,{brighter(t){return t=t==null?$t:Math.pow($t,t),new dt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?pt:Math.pow(pt,t),new dt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Ca,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new L(255*(n+e*(br*r+ne*i)),255*(n+e*(ee*r+vn*i)),255*(n+e*(Wt*r)),this.opacity)}}));const xn=t=>()=>t;function Tr(t,n){return function(e){return t+e*n}}function Na(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)}}function Aa(t,n){var e=n-t;return e?Tr(t,e>180||e<-180?e-360*Math.round(e/360):e):xn(isNaN(t)?n:t)}function Da(t){return(t=+t)==1?kt:function(n,e){return e-n?Na(n,e,t):xn(isNaN(n)?e:n)}}function kt(t,n){var e=n-t;return e?Tr(t,e):xn(isNaN(t)?n:t)}const un=function t(n){var e=Da(n);function r(i,o){var a=e((i=On(i)).r,(o=On(o)).r),s=e(i.g,o.g),c=e(i.b,o.b),u=kt(i.opacity,o.opacity);return function(l){return i.r=a(l),i.g=s(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=t,r}(1);function Ua(t,n){n||(n=[]);var e=t?Math.min(n.length,t.length):0,r=n.slice(),i;return function(o){for(i=0;ie&&(o=n.slice(e,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:G(r,i)})),e=An.lastIndex;return e180?l+=360:l-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:G(u,l)})):l&&f.push(i(f)+"rotate("+l+r)}function s(u,l,f,h){u!==l?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:G(u,l)}):l&&f.push(i(f)+"skewX("+l+r)}function c(u,l,f,h,d,y){if(u!==f||l!==h){var T=d.push(i(d)+"scale(",null,",",null,")");y.push({i:T-4,x:G(u,f)},{i:T-2,x:G(l,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(u,l){var f=[],h=[];return u=t(u),l=t(l),o(u.translateX,u.translateY,l.translateX,l.translateY,f,h),a(u.rotate,l.rotate,f,h),s(u.skewX,l.skewX,f,h),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,h),u=l=null,function(d){for(var y=-1,T=h.length,x;++y=0&&t._call.call(void 0,n),t=t._next;--St}function Ue(){mt=(ln=zt.now())+bn,St=Lt=0;try{qa()}finally{St=0,Va(),mt=0}}function Xa(){var t=zt.now(),n=t-ln;n>Dr&&(bn-=n,ln=t)}function Va(){for(var t,n=cn,e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:cn=e);Rt=t,qn(r)}function qn(t){if(!St){Lt&&(Lt=clearTimeout(Lt));var n=t-mt;n>24?(t<1/0&&(Lt=setTimeout(Ue,t-zt.now()-bn)),Et&&(Et=clearInterval(Et))):(Et||(ln=zt.now(),Et=setInterval(Xa,Dr)),St=1,Ur(Ue))}}function Ee(t,n,e){var r=new fn;return n=n==null?0:+n,r.restart(i=>{r.stop(),t(i+n)},n,e),r}var Ba=sr("start","end","cancel","interrupt"),Ga=[],Fr=0,Fe=1,Xn=2,tn=3,He=4,Vn=5,nn=6;function Tn(t,n,e,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(e in a)return;Za(t,e,{name:n,index:r,group:i,on:Ba,tween:Ga,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Fr})}function ie(t,n){var e=Q(t,n);if(e.state>Fr)throw new Error("too late; already scheduled");return e}function K(t,n){var e=Q(t,n);if(e.state>tn)throw new Error("too late; already running");return e}function Q(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Za(t,n,e){var r=t.__transition,i;r[n]=e,e.timer=Er(o,0,e.time);function o(u){e.state=Fe,e.timer.restart(a,e.delay,e.time),e.delay<=u&&a(u-e.delay)}function a(u){var l,f,h,d;if(e.state!==Fe)return c();for(l in r)if(d=r[l],d.name===e.name){if(d.state===tn)return Ee(a);d.state===He?(d.state=nn,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[l]):+lXn&&r.state=0&&(n=n.slice(0,e)),!n||n==="start"})}function Cs(t,n,e){var r,i,o=ks(n)?ie:K;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}function $s(t,n){var e=this._id;return arguments.length<2?Q(this.node(),e).on.on(t):this.each(Cs(e,t,n))}function Ss(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Ns(){return this.on("end.remove",Ss(this._id))}function As(t){var n=this._name,e=this._id;typeof t!="function"&&(t=Jn(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=0))throw new Error(`invalid digits: ${t}`);if(n>15)return Lr;const e=10**n;return function(r){this._+=r[0];for(let i=1,o=r.length;ilt)if(!(Math.abs(f*c-u*l)>lt)||!o)this._append`L${this._x1=n},${this._y1=e}`;else{let d=r-a,y=i-s,T=c*c+u*u,x=d*d+y*y,N=Math.sqrt(T),g=Math.sqrt(h),w=o*Math.tan((Bn-Math.acos((T+h-x)/(2*N*g)))/2),C=w/g,M=w/N;Math.abs(C-1)>lt&&this._append`L${n+C*l},${e+C*f}`,this._append`A${o},${o},0,0,${+(f*d>l*y)},${this._x1=n+M*c},${this._y1=e+M*u}`}}arc(n,e,r,i,o,a){if(n=+n,e=+e,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),u=n+s,l=e+c,f=1^a,h=a?i-o:o-i;this._x1===null?this._append`M${u},${l}`:(Math.abs(this._x1-u)>lt||Math.abs(this._y1-l)>lt)&&this._append`L${u},${l}`,r&&(h<0&&(h=h%Gn+Gn),h>nu?this._append`A${r},${r},0,1,${f},${n-s},${e-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=l}`:h>lt&&this._append`A${r},${r},0,${+(h>=Bn)},${f},${this._x1=n+r*Math.cos(o)},${this._y1=e+r*Math.sin(o)}`)}rect(n,e,r,i){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function iu(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function hn(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Nt(t){return t=hn(Math.abs(t)),t?t[1]:NaN}function ou(t,n){return function(e,r){for(var i=e.length,o=[],a=0,s=t[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),o.push(e.substring(i-=s,i+s)),!((c+=s+1)>r));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}}function au(t){return function(n){return n.replace(/[0-9]/g,function(e){return t[+e]})}}var su=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function dn(t){if(!(n=su.exec(t)))throw new Error("invalid format: "+t);var n;return new ae({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]})}dn.prototype=ae.prototype;function ae(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}ae.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function uu(t){t:for(var n=t.length,e=1,r=-1,i;e0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Rr;function cu(t,n){var e=hn(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Rr=Math.max(-8,Math.min(8,Math.floor(i/3)))*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")+hn(t,Math.max(0,n+o-1))[0]}function Ye(t,n){var e=hn(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")}const Ie={"%":(t,n)=>(t*100).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:iu,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)=>Ye(t*100,n),r:Ye,s:cu,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Le(t){return t}var Re=Array.prototype.map,Pe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lu(t){var n=t.grouping===void 0||t.thousands===void 0?Le:ou(Re.call(t.grouping,Number),t.thousands+""),e=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Le:au(Re.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=dn(f);var h=f.fill,d=f.align,y=f.sign,T=f.symbol,x=f.zero,N=f.width,g=f.comma,w=f.precision,C=f.trim,M=f.type;M==="n"?(g=!0,M="g"):Ie[M]||(w===void 0&&(w=12),C=!0,M="g"),(x||h==="0"&&d==="=")&&(x=!0,h="0",d="=");var v=T==="$"?e:T==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",b=T==="$"?r:/[%p]/.test(M)?a:"",I=Ie[M],A=/[defgprs%]/.test(M);w=w===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function Y(_){var U=v,D=b,R,V,j;if(M==="c")D=I(_)+D,_="";else{_=+_;var tt=_<0||1/_<0;if(_=isNaN(_)?c:I(Math.abs(_),w),C&&(_=uu(_)),tt&&+_==0&&y!=="+"&&(tt=!1),U=(tt?y==="("?y:s:y==="-"||y==="("?"":y)+U,D=(M==="s"?Pe[8+Rr/3]:"")+D+(tt&&y==="("?")":""),A){for(R=-1,V=_.length;++Rj||j>57){D=(j===46?i+_.slice(R+1):_.slice(R))+D,_=_.slice(0,R);break}}}g&&!x&&(_=n(_,1/0));var vt=U.length+_.length+D.length,B=vt>1)+U+_+D+B.slice(vt);break;default:_=B+U+_+D;break}return o(_)}return Y.toString=function(){return f+""},Y}function l(f,h){var d=u((f=dn(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(Nt(h)/3)))*3,T=Math.pow(10,-y),x=Pe[8+y/3];return function(N){return d(T*N)+x}}return{format:u,formatPrefix:l}}var Qt,se,Pr;fu({thousands:",",grouping:[3],currency:["$",""]});function fu(t){return Qt=lu(t),se=Qt.format,Pr=Qt.formatPrefix,Qt}function hu(t){return Math.max(0,-Nt(Math.abs(t)))}function du(t,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nt(n)/3)))*3-Nt(Math.abs(t)))}function pu(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Nt(n)-Nt(t))+1}function Or(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t);break}return this}function gu(t,n){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof n=="function"?this.interpolator(n):this.range(n);break}}return this}function mu(t){return function(){return t}}function yu(t){return+t}var Oe=[0,1];function st(t){return t}function Zn(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:mu(isNaN(n)?NaN:.5)}function _u(t,n){var e;return t>n&&(e=t,t=n,n=e),function(r){return Math.max(t,Math.min(n,r))}}function wu(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i2?vu:wu,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=s(t.map(r),n,e)))(r(a(h)))}return f.invert=function(h){return a(i((u||(u=s(n,t.map(r),G)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,yu),l()):t.slice()},f.range=function(h){return arguments.length?(n=Array.from(h),l()):n.slice()},f.rangeRound=function(h){return n=Array.from(h),e=Cr,l()},f.clamp=function(h){return arguments.length?(a=h?!0:st,l()):a!==st},f.interpolate=function(h){return arguments.length?(e=h,l()):e},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,d){return r=h,i=d,l()}}function zr(){return xu()(st,st)}function Mu(t,n,e,r){var i=Ln(t,n,e),o;switch(r=dn(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(n));return r.precision==null&&!isNaN(o=du(i,a))&&(r.precision=o),Pr(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=pu(i,Math.max(Math.abs(t),Math.abs(n))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=hu(i))&&(r.precision=o-(r.type==="%")*2);break}}return se(r)}function qr(t){var n=t.domain;return t.ticks=function(e){var r=n();return Ci(r[0],r[r.length-1],e??10)},t.tickFormat=function(e,r){var i=n();return Mu(i[0],i[i.length-1],e??10,r)},t.nice=function(e){e==null&&(e=10);var r=n(),i=0,o=r.length-1,a=r[i],s=r[o],c,u,l=10;for(s0;){if(u=In(a,s,e),u===c)return r[i]=a,r[o]=s,n(r);if(u>0)a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u;else if(u<0)a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u;else break;c=u}return t},t}function ue(){var t=zr();return t.copy=function(){return Wr(t,ue())},Or.apply(t,arguments),qr(t)}function bu(t,n){t=t.slice();var e=0,r=t.length-1,i=t[e],o=t[r],a;return o(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),n(o,1),t(o),o),i.round=o=>{const a=i(o),s=i.ceil(o);return o-a(n(o=new Date(+o),a==null?1:Math.floor(a)),o),i.range=(o,a,s)=>{const c=[];if(o=i.ceil(o),s=s==null?1:Math.floor(s),!(o0))return c;let u;do c.push(u=new Date(+o)),n(o,s),t(o);while(uF(a=>{if(a>=a)for(;t(a),!o(a);)a.setTime(a-1)},(a,s)=>{if(a>=a)if(s<0)for(;++s<=0;)for(;n(a,-1),!o(a););else for(;--s>=0;)for(;n(a,1),!o(a););}),e&&(i.count=(o,a)=>(Dn.setTime(+o),Un.setTime(+a),t(Dn),t(Un),Math.floor(e(Dn,Un))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?a=>r(a)%o===0:a=>i.count(0,a)%o===0):i)),i}const pn=F(()=>{},(t,n)=>{t.setTime(+t+n)},(t,n)=>n-t);pn.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?F(n=>{n.setTime(Math.floor(n/t)*t)},(n,e)=>{n.setTime(+n+e*t)},(n,e)=>(e-n)/t):pn);pn.range;const et=1e3,X=et*60,rt=X*60,ot=rt*24,ce=ot*7,We=ot*30,En=ot*365,bt=F(t=>{t.setTime(t-t.getMilliseconds())},(t,n)=>{t.setTime(+t+n*et)},(t,n)=>(n-t)/et,t=>t.getUTCSeconds());bt.range;const le=F(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*et)},(t,n)=>{t.setTime(+t+n*X)},(t,n)=>(n-t)/X,t=>t.getMinutes());le.range;const Tu=F(t=>{t.setUTCSeconds(0,0)},(t,n)=>{t.setTime(+t+n*X)},(t,n)=>(n-t)/X,t=>t.getUTCMinutes());Tu.range;const fe=F(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*et-t.getMinutes()*X)},(t,n)=>{t.setTime(+t+n*rt)},(t,n)=>(n-t)/rt,t=>t.getHours());fe.range;const ku=F(t=>{t.setUTCMinutes(0,0,0)},(t,n)=>{t.setTime(+t+n*rt)},(t,n)=>(n-t)/rt,t=>t.getUTCHours());ku.range;const Vt=F(t=>t.setHours(0,0,0,0),(t,n)=>t.setDate(t.getDate()+n),(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*X)/ot,t=>t.getDate()-1);Vt.range;const he=F(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/ot,t=>t.getUTCDate()-1);he.range;const Cu=F(t=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>(n-t)/ot,t=>Math.floor(t/ot));Cu.range;function _t(t){return F(n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},(n,e)=>{n.setDate(n.getDate()+e*7)},(n,e)=>(e-n-(e.getTimezoneOffset()-n.getTimezoneOffset())*X)/ce)}const kn=_t(0),gn=_t(1),$u=_t(2),Su=_t(3),At=_t(4),Nu=_t(5),Au=_t(6);kn.range;gn.range;$u.range;Su.range;At.range;Nu.range;Au.range;function wt(t){return F(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCDate(n.getUTCDate()+e*7)},(n,e)=>(e-n)/ce)}const Xr=wt(0),mn=wt(1),Du=wt(2),Uu=wt(3),Dt=wt(4),Eu=wt(5),Fu=wt(6);Xr.range;mn.range;Du.range;Uu.range;Dt.range;Eu.range;Fu.range;const de=F(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,n)=>{t.setMonth(t.getMonth()+n)},(t,n)=>n.getMonth()-t.getMonth()+(n.getFullYear()-t.getFullYear())*12,t=>t.getMonth());de.range;const Hu=F(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)},(t,n)=>n.getUTCMonth()-t.getUTCMonth()+(n.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Hu.range;const at=F(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n)},(t,n)=>n.getFullYear()-t.getFullYear(),t=>t.getFullYear());at.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:F(n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,e)=>{n.setFullYear(n.getFullYear()+e*t)});at.range;const yt=F(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)},(t,n)=>n.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());yt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:F(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)});yt.range;function Yu(t,n,e,r,i,o){const a=[[bt,1,et],[bt,5,5*et],[bt,15,15*et],[bt,30,30*et],[o,1,X],[o,5,5*X],[o,15,15*X],[o,30,30*X],[i,1,rt],[i,3,3*rt],[i,6,6*rt],[i,12,12*rt],[r,1,ot],[r,2,2*ot],[e,1,ce],[n,1,We],[n,3,3*We],[t,1,En]];function s(u,l,f){const h=lx).right(a,h);if(d===a.length)return t.every(Ln(u/En,l/En,f));if(d===0)return pn.every(Math.max(Ln(u,l,f),1));const[y,T]=a[h/a[d-1][2]53)return null;"w"in p||(p.w=1),"Z"in p?(E=Hn(Ft(p.y,0,1)),W=E.getUTCDay(),E=W>4||W===0?mn.ceil(E):mn(E),E=he.offset(E,(p.V-1)*7),p.y=E.getUTCFullYear(),p.m=E.getUTCMonth(),p.d=E.getUTCDate()+(p.w+6)%7):(E=Fn(Ft(p.y,0,1)),W=E.getDay(),E=W>4||W===0?gn.ceil(E):gn(E),E=Vt.offset(E,(p.V-1)*7),p.y=E.getFullYear(),p.m=E.getMonth(),p.d=E.getDate()+(p.w+6)%7)}else("W"in p||"U"in p)&&("w"in p||(p.w="u"in p?p.u%7:"W"in p?1:0),W="Z"in p?Hn(Ft(p.y,0,1)).getUTCDay():Fn(Ft(p.y,0,1)).getDay(),p.m=0,p.d="W"in p?(p.w+6)%7+p.W*7-(W+5)%7:p.w+p.U*7-(W+6)%7);return"Z"in p?(p.H+=p.Z/100|0,p.M+=p.Z%100,Hn(p)):Fn(p)}}function I(m,k,$,p){for(var O=0,E=k.length,W=$.length,z,ct;O=W)return-1;if(z=k.charCodeAt(O++),z===37){if(z=k.charAt(O++),ct=M[z in ze?k.charAt(O++):z],!ct||(p=ct(m,$,p))<0)return-1}else if(z!=$.charCodeAt(p++))return-1}return p}function A(m,k,$){var p=u.exec(k.slice($));return p?(m.p=l.get(p[0].toLowerCase()),$+p[0].length):-1}function Y(m,k,$){var p=d.exec(k.slice($));return p?(m.w=y.get(p[0].toLowerCase()),$+p[0].length):-1}function _(m,k,$){var p=f.exec(k.slice($));return p?(m.w=h.get(p[0].toLowerCase()),$+p[0].length):-1}function U(m,k,$){var p=N.exec(k.slice($));return p?(m.m=g.get(p[0].toLowerCase()),$+p[0].length):-1}function D(m,k,$){var p=T.exec(k.slice($));return p?(m.m=x.get(p[0].toLowerCase()),$+p[0].length):-1}function R(m,k,$){return I(m,n,k,$)}function V(m,k,$){return I(m,e,k,$)}function j(m,k,$){return I(m,r,k,$)}function tt(m){return a[m.getDay()]}function vt(m){return o[m.getDay()]}function B(m){return c[m.getMonth()]}function ci(m){return s[m.getMonth()]}function li(m){return i[+(m.getHours()>=12)]}function fi(m){return 1+~~(m.getMonth()/3)}function hi(m){return a[m.getUTCDay()]}function di(m){return o[m.getUTCDay()]}function pi(m){return c[m.getUTCMonth()]}function gi(m){return s[m.getUTCMonth()]}function mi(m){return i[+(m.getUTCHours()>=12)]}function yi(m){return 1+~~(m.getUTCMonth()/3)}return{format:function(m){var k=v(m+="",w);return k.toString=function(){return m},k},parse:function(m){var k=b(m+="",!1);return k.toString=function(){return m},k},utcFormat:function(m){var k=v(m+="",C);return k.toString=function(){return m},k},utcParse:function(m){var k=b(m+="",!0);return k.toString=function(){return m},k}}}var ze={"-":"",_:" ",0:"0"},H=/^\s*\d+/,Pu=/^%/,Ou=/[\\^$*+?|[\]().{}]/g;function S(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[n.toLowerCase(),e]))}function zu(t,n,e){var r=H.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function qu(t,n,e){var r=H.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Xu(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Vu(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Bu(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function qe(t,n,e){var r=H.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Xe(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Gu(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Zu(t,n,e){var r=H.exec(n.slice(e,e+1));return r?(t.q=r[0]*3-3,e+r[0].length):-1}function Qu(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Ve(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Ju(t,n,e){var r=H.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Be(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Ku(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ju(t,n,e){var r=H.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function tc(t,n,e){var r=H.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function nc(t,n,e){var r=H.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function ec(t,n,e){var r=Pu.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function rc(t,n,e){var r=H.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function ic(t,n,e){var r=H.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Ge(t,n){return S(t.getDate(),n,2)}function oc(t,n){return S(t.getHours(),n,2)}function ac(t,n){return S(t.getHours()%12||12,n,2)}function sc(t,n){return S(1+Vt.count(at(t),t),n,3)}function Vr(t,n){return S(t.getMilliseconds(),n,3)}function uc(t,n){return Vr(t,n)+"000"}function cc(t,n){return S(t.getMonth()+1,n,2)}function lc(t,n){return S(t.getMinutes(),n,2)}function fc(t,n){return S(t.getSeconds(),n,2)}function hc(t){var n=t.getDay();return n===0?7:n}function dc(t,n){return S(kn.count(at(t)-1,t),n,2)}function Br(t){var n=t.getDay();return n>=4||n===0?At(t):At.ceil(t)}function pc(t,n){return t=Br(t),S(At.count(at(t),t)+(at(t).getDay()===4),n,2)}function gc(t){return t.getDay()}function mc(t,n){return S(gn.count(at(t)-1,t),n,2)}function yc(t,n){return S(t.getFullYear()%100,n,2)}function _c(t,n){return t=Br(t),S(t.getFullYear()%100,n,2)}function wc(t,n){return S(t.getFullYear()%1e4,n,4)}function vc(t,n){var e=t.getDay();return t=e>=4||e===0?At(t):At.ceil(t),S(t.getFullYear()%1e4,n,4)}function xc(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+S(n/60|0,"0",2)+S(n%60,"0",2)}function Ze(t,n){return S(t.getUTCDate(),n,2)}function Mc(t,n){return S(t.getUTCHours(),n,2)}function bc(t,n){return S(t.getUTCHours()%12||12,n,2)}function Tc(t,n){return S(1+he.count(yt(t),t),n,3)}function Gr(t,n){return S(t.getUTCMilliseconds(),n,3)}function kc(t,n){return Gr(t,n)+"000"}function Cc(t,n){return S(t.getUTCMonth()+1,n,2)}function $c(t,n){return S(t.getUTCMinutes(),n,2)}function Sc(t,n){return S(t.getUTCSeconds(),n,2)}function Nc(t){var n=t.getUTCDay();return n===0?7:n}function Ac(t,n){return S(Xr.count(yt(t)-1,t),n,2)}function Zr(t){var n=t.getUTCDay();return n>=4||n===0?Dt(t):Dt.ceil(t)}function Dc(t,n){return t=Zr(t),S(Dt.count(yt(t),t)+(yt(t).getUTCDay()===4),n,2)}function Uc(t){return t.getUTCDay()}function Ec(t,n){return S(mn.count(yt(t)-1,t),n,2)}function Fc(t,n){return S(t.getUTCFullYear()%100,n,2)}function Hc(t,n){return t=Zr(t),S(t.getUTCFullYear()%100,n,2)}function Yc(t,n){return S(t.getUTCFullYear()%1e4,n,4)}function Ic(t,n){var e=t.getUTCDay();return t=e>=4||e===0?Dt(t):Dt.ceil(t),S(t.getUTCFullYear()%1e4,n,4)}function Lc(){return"+0000"}function Qe(){return"%"}function Je(t){return+t}function Ke(t){return Math.floor(+t/1e3)}var xt,Cn,Qr;Rc({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Rc(t){return xt=Ru(t),Cn=xt.format,Qr=xt.parse,xt.utcFormat,xt.utcParse,xt}function Pc(t){return new Date(t)}function Oc(t){return t instanceof Date?+t:+new Date(+t)}function Jr(t,n,e,r,i,o,a,s,c,u){var l=zr(),f=l.invert,h=l.domain,d=u(".%L"),y=u(":%S"),T=u("%I:%M"),x=u("%I %p"),N=u("%a %d"),g=u("%b %d"),w=u("%B"),C=u("%Y");function M(v){return(c(v)1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Jt.h=360*t-100,Jt.s=1.5-1.5*n,Jt.l=.8-.9*n,Jt+""}function Mt(t){return function(){return t}}function qc(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{const r=Math.floor(e);if(!(r>=0))throw new RangeError(`invalid digits: ${e}`);n=r}return t},()=>new ru(n)}function Xc(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ti(t){this._context=t}ti.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,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._context.lineTo(t,n);break}}};function Vc(t){return new ti(t)}function Bc(t){return t[0]}function Gc(t){return t[1]}function ni(t,n){var e=Mt(!0),r=null,i=Vc,o=null,a=qc(s);t=typeof t=="function"?t:t===void 0?Bc:Mt(t),n=typeof n=="function"?n:n===void 0?Gc:Mt(n);function s(c){var u,l=(c=Xc(c)).length,f,h=!1,d;for(r==null&&(o=i(d=a())),u=0;u<=l;++u)!(u({name:`Prediction ${i+1}`,values:r.map(o=>({time:Qn(o.time),price:o.price}))}))}catch(t){return console.error("Error fetching data:",t),null}}async function Zc(){try{const t=await fetch("https://synth.mode.network/leaderboard/latest",{method:"GET",headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const n=await t.json();return console.log("Leaderboard data structure:",n[0]),n}catch(t){return console.error("Error fetching leaderboard:",t),null}}function Qc(t){const n=q("#table");n.selectAll("*").remove();const e=n.append("table").attr("class","leaderboard-table");e.append("thead").append("tr").selectAll("th").data(["Position","Miner ID","Miner","Incentive"]).enter().append("th").text(a=>a);const o=e.append("tbody").selectAll("tr").data(t).enter().append("tr");o.append("td").attr("class",(a,s)=>s===0?"position-cell":s===1?"position-cell second":s===2?"position-cell third":"position-cell other").text((a,s)=>`#${s+1}`),o.append("td").text(a=>a.neuron_uid),o.append("td").text(a=>a.coldkey.slice(0,10)+"..."),o.append("td").text(a=>a.incentive.toFixed(5))}async function ai(){try{const t=new Date,n=new Date(t);n.setHours(n.getHours()-24);const e=c=>{const u=x=>String(x).padStart(2,"0"),l=c.getUTCFullYear(),f=u(c.getUTCMonth()+1),h=u(c.getUTCDate()),d=u(c.getUTCHours()),y=u(c.getUTCMinutes()),T=u(c.getUTCSeconds());return encodeURIComponent(`${l}-${f}-${h} ${d}:${y}:${T}+00`)},r=e(n),i=e(t),o=`https://synth.mode.network/leaderboard/historical?start_time=${r}&end_time=${i}`;console.log("Fetching historical data from:",o);const a=await fetch(o,{method:"GET",headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(t){return console.error("Error fetching historical leaderboard:",t),null}}function si(t){if(!t||!Array.isArray(t)||t.length===0){console.error("Invalid or empty historical data received");const g=document.getElementById("historical-rewards-chart");q(g).selectAll("*").remove(),q(g).append("div").attr("class","loading").text("No historical data available");return}const n=document.getElementById("historical-rewards-chart"),e=n.clientWidth,r={top:20,right:20,bottom:30,left:60},i=e-r.left-r.right,o=400-r.top-r.bottom;q("#historical-rewards-chart").selectAll("*").remove();const a=q("#historical-rewards-chart").append("svg").attr("width",i+r.left+r.right).attr("height",o+r.top+r.bottom).attr("viewBox",`0 0 ${i+r.left+r.right} ${o+r.top+r.bottom}`).append("g").attr("transform",`translate(${r.left},${r.top})`),s=new Map;if(t.forEach(g=>{if(g&&typeof g=="object"&&"neuron_uid"in g&&"updated_at"in g&&"incentive"in g&&"coldkey"in g){s.has(g.neuron_uid)||s.set(g.neuron_uid,[]);const w=Qn(g.updated_at);w&&s.get(g.neuron_uid).push({time:w,incentive:g.incentive,miner:g.coldkey.slice(0,10),neuron_uid:g.neuron_uid})}}),s.size===0){console.error("No valid miner data found"),q(n).append("div").attr("class","loading").text("No valid historical data available");return}const c=Array.from(s.entries()).map(([g,w])=>({id:g,miner:w[0].miner,values:w.sort((C,M)=>C.time-M.time),totalIncentive:w.reduce((C,M)=>C+M.incentive,0)})).sort((g,w)=>w.totalIncentive-g.totalIncentive).slice(0,10),u=pe().domain([0,c.length]).interpolator(jr),l=Kr().domain(rr(t,g=>Qn(g.updated_at))).range([0,i]),f=ue().domain([0,rn(c,g=>rn(g.values,w=>w.incentive))]).range([o,0]);a.append("g").attr("class","grid").selectAll("line").data(f.ticks()).join("line").attr("x1",0).attr("x2",i).attr("y1",g=>f(g)).attr("y2",g=>f(g)),a.append("g").attr("transform",`translate(0,${o})`).call(or(l).ticks(6).tickFormat(Cn("%H:%M"))),a.append("g").call(ar(f));const h=ni().x(g=>l(g.time)).y(g=>f(g.incentive)).curve(ei),d=a.append("g").attr("class","lines");c.forEach((g,w)=>{d.append("path").datum(g.values).attr("class",`historical-line historical-line-${w}`).attr("fill","none").attr("stroke",u(w)).attr("stroke-width",1).attr("d",h)});const y=a.append("circle").attr("r",4).style("opacity",0).style("fill","#ffffff").style("pointer-events","none"),T=a.append("line").attr("class","vertical-line").attr("y1",0).attr("y2",o).style("stroke","#323232").style("stroke-width","1px").style("opacity",0),x=q("#historical-rewards-chart").append("div").attr("class","tooltip").style("opacity",0).style("position","absolute").style("pointer-events","none").style("z-index",1e3);a.append("g").attr("class","mouse-over-effects").append("rect").attr("width",i).attr("height",o).attr("fill","none").attr("pointer-events","all").on("mouseout",()=>{an(".historical-line").attr("stroke",(g,w)=>u(w)).attr("stroke-width",1).attr("opacity",1),y.style("opacity",0),T.style("opacity",0),x.style("opacity",0)}).on("mousemove",function(g){const w=a.node();w.getBoundingClientRect();const C=vr(g,w),M=C[0],v=C[1];T.attr("x1",M).attr("x2",M).style("opacity",1);const b=l.invert(M),I=qt(_=>_.time).left;let A=null,Y=1/0;if(c.forEach((_,U)=>{const D=I(_.values,b,1);if(D>=_.values.length)return;const R=_.values[D-1],V=_.values[D];if(!R||!V)return;const j=b-R.time>V.time-b?V:R,tt=Math.abs(f(j.incentive)-v);tt
${ri(A.point.time)}
Neuron: ${A.series.id}
Miner: ${A.series.miner}
Reward: ${ii(A.point.incentive)}
`)}})}async function Jc(){try{console.log("Starting data fetching...");const[t,n,e]=await Promise.all([oi(),Zc(),ai()]);t&&ui(t),n&&Qc(n),e&&si(e)}catch(t){console.error("Error in initialize:",t)}}function ui(t){q("#chart").selectAll("*").remove();const n=document.getElementById("chart"),e=n.clientWidth,r={top:20,right:20,bottom:30,left:60},i=e-r.left-r.right,o=Math.min(600,window.innerHeight-100)-r.top-r.bottom,a=q("#chart").append("svg").attr("width",i+r.left+r.right).attr("height",o+r.top+r.bottom).attr("viewBox",`0 0 ${i+r.left+r.right} ${o+r.top+r.bottom}`).append("g").attr("transform",`translate(${r.left},${r.top})`),s=pe().domain([0,t.length]).interpolator(jr),c=Kr().domain(rr(t[0].values,x=>x.time)).range([0,i]),u=ue().domain([me(t,x=>me(x.values,N=>N.price))*.999,rn(t,x=>rn(x.values,N=>N.price))*1.001]).range([o,0]);a.append("g").attr("transform",`translate(0,${o})`).call(or(c)),a.append("g").call(ar(u)),a.append("g").attr("class","grid").selectAll("line").data(u.ticks()).join("line").attr("x1",0).attr("x2",i).attr("y1",x=>u(x)).attr("y2",x=>u(x)).style("stroke","#323232").style("stroke-opacity",.7);const l=q("#chart").append("div").attr("class","tooltip").style("opacity",0).style("position","absolute").style("pointer-events","none").style("z-index",1e3),f=ni().x(x=>c(x.time)).y(x=>u(x.price)).curve(ei),h=a.append("g").attr("class","lines");t.forEach((x,N)=>{h.append("path").datum(x.values).attr("class",`line line-${N}`).attr("fill","none").attr("stroke",s(N)).attr("stroke-width",1).attr("d",f)});const d=a.append("circle").attr("r",4).style("opacity",0).style("fill","#ffffff").style("pointer-events","none"),y=a.append("line").attr("class","vertical-line").attr("y1",0).attr("y2",o).style("stroke","#323232").style("stroke-width","1px").style("opacity",0);a.append("g").attr("class","mouse-over-effects").append("rect").attr("width",i).attr("height",o).attr("fill","none").attr("pointer-events","all").on("mouseout",()=>{an(".line").attr("stroke",(x,N)=>s(N)).attr("stroke-width",1).attr("opacity",1),d.style("opacity",0),y.style("opacity",0),l.style("opacity",0)}).on("mousemove",function(x){const N=a.node();N.getBoundingClientRect();const g=vr(x,N),w=g[0],C=g[1];y.attr("x1",w).attr("x2",w).style("opacity",1);const M=c.invert(w),v=qt(A=>A.time).left;let b=null,I=1/0;if(t.forEach((A,Y)=>{const _=v(A.values,M,1),U=A.values[_-1],D=A.values[_];if(!U||!D)return;const R=M-U.time>D.time-M?D:U,V=Math.abs(u(R.price)-C);V
${ri(b.point.time)}
${b.series.name}: ${ii(b.point.price)}
`)}})}let er;window.addEventListener("resize",()=>{clearTimeout(er),er=setTimeout(async()=>{const[t,n]=await Promise.all([oi(),ai()]);t&&ui(t),n&&si(n)},250)});Jc();