@stacksjs/charts 0.70.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/index.js +5 -0
- package/dist/src/colors.d.ts +4 -0
- package/dist/src/index.d.ts +24 -0
- package/dist/src/ticks.d.ts +13 -0
- package/dist/src/types.d.ts +87 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @stacksjs/charts
|
|
2
|
+
|
|
3
|
+
Chart.js-compatible charting for Stacks dashboards, rendered to HTML5 canvas.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Chart.js was previously a direct dependency. This package wraps the chart.js
|
|
8
|
+
API (`new Chart(ctx, { type, data, options })`) so dashboards can keep their
|
|
9
|
+
existing call sites while the framework drops the upstream dependency.
|
|
10
|
+
|
|
11
|
+
The implementation is canvas-native and uses [`ts-charts`][1] for scale and
|
|
12
|
+
format helpers. Supported chart types: `line`, `bar`, `doughnut`, `pie`. Most
|
|
13
|
+
common option shapes (responsive, scales with `beginAtZero`/`stacked`/`grid`/
|
|
14
|
+
`ticks.callback`, legends, tooltip callbacks, dual y-axes via `yAxisID: 'y1'`)
|
|
15
|
+
are honoured. Less-common features (radar, animations, plugin pipeline,
|
|
16
|
+
gradients on dataset properties) fall back to sensible defaults rather than
|
|
17
|
+
throwing.
|
|
18
|
+
|
|
19
|
+
[1]: https://github.com/stacksjs/ts-charts
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const { Chart, registerables } = await import('@stacksjs/charts')
|
|
25
|
+
Chart.register(...registerables) // no-op, kept for chart.js parity
|
|
26
|
+
|
|
27
|
+
const chart = new Chart(canvas, {
|
|
28
|
+
type: 'line',
|
|
29
|
+
data: {
|
|
30
|
+
labels: ['Jan', 'Feb', 'Mar'],
|
|
31
|
+
datasets: [{ label: 'Revenue', data: [10, 20, 30], borderColor: '#3b82f6' }],
|
|
32
|
+
},
|
|
33
|
+
options: {
|
|
34
|
+
responsive: true,
|
|
35
|
+
maintainAspectRatio: false,
|
|
36
|
+
scales: { y: { beginAtZero: true } },
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
chart.update()
|
|
41
|
+
chart.destroy()
|
|
42
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function mn(t,n){return t==null||n==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function cu(t,n){return t==null||n==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Ni(t){let n,e,i;if(t.length!==2)n=mn,e=(a,s)=>mn(t(a),s),i=(a,s)=>t(a)-s;else n=t===mn||t===cu?t:_u,e=t,i=t;function u(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<0)l=f+1;else h=f}while(l<h)}return l}function r(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<=0)l=f+1;else h=f}while(l<h)}return l}function o(a,s,l=0,h=a.length){let f=u(a,s,l,h-1);return f>l&&i(a[f-1],s)>-i(a[f],s)?f-1:f}return{left:u,center:o,right:r}}function _u(){return 0}function gu(t){return t===null?NaN:+t}var bi=Ni(mn),yu=bi.right,ts=bi.left,ns=Ni(gu).center,pu=yu,es=$i(ki),is=$i(mu);function $i(t){return function(n,e,i=e){if(!((e=+e)>=0))throw RangeError("invalid rx");if(!((i=+i)>=0))throw RangeError("invalid ry");let{data:u,width:r,height:o}=n;if(!((r=Math.floor(r))>=0))throw RangeError("invalid width");if(!((o=Math.floor(o!==void 0?o:u.length/r))>=0))throw RangeError("invalid height");if(!r||!o||!e&&!i)return n;let a=e&&t(e),s=i&&t(i),l=u.slice();if(a&&s)Et(a,l,u,r,o),Et(a,u,l,r,o),Et(a,l,u,r,o),Ft(s,u,l,r,o),Ft(s,l,u,r,o),Ft(s,u,l,r,o);else if(a)Et(a,u,l,r,o),Et(a,l,u,r,o),Et(a,u,l,r,o);else if(s)Ft(s,u,l,r,o),Ft(s,l,u,r,o),Ft(s,u,l,r,o);return n}}function Et(t,n,e,i,u){for(let r=0,o=i*u;r<o;)t(n,e,r,r+=i,1)}function Ft(t,n,e,i,u){for(let r=0,o=i*u;r<i;++r)t(n,e,r,r+o,i)}function mu(t){let n=ki(t);return(e,i,u,r,o)=>{u<<=2,r<<=2,o<<=2,n(e,i,u+0,r+0,o),n(e,i,u+1,r+1,o),n(e,i,u+2,r+2,o),n(e,i,u+3,r+3,o)}}function ki(t){let n=Math.floor(t);if(n===t)return Mu(t);let e=t-n,i=2*t+1;return(u,r,o,a,s)=>{if(!((a-=s)>=o))return;let l=n*r[o],h=s*n,f=h+s;for(let c=o,_=o+h;c<_;c+=s)l+=r[Math.min(a,c)];for(let c=o,_=a;c<=_;c+=s)l+=r[Math.min(a,c+h)],u[c]=(l+e*(r[Math.max(o,c-f)]+r[Math.min(a,c+f)]))/i,l-=r[Math.max(o,c-h)]}}function Mu(t){let n=2*t+1;return(e,i,u,r,o)=>{if(!((r-=o)>=u))return;let a=t*i[u],s=o*t;for(let l=u,h=u+s;l<h;l+=o)a+=i[Math.min(r,l)];for(let l=u,h=r;l<=h;l+=o)a+=i[Math.min(r,l+s)],e[l]=a/n,a-=i[Math.max(u,l-s)]}}function xu(t){return t!==null&&typeof t==="object"?t.valueOf():t}function Ae({_intern:t,_key:n},e){let i=n(e);return t.has(i)?t.get(i):e}function du({_intern:t,_key:n},e){let i=n(e);if(t.has(i))return t.get(i);return t.set(i,e),e}function wu({_intern:t,_key:n},e){let i=n(e);if(t.has(i))e=t.get(i),t.delete(i);return e}class Bn extends Map{_intern;_key;constructor(t,n=xu){super();if(this._intern=new Map,this._key=n,t!=null)for(let[e,i]of t)this.set(e,i)}get(t){return super.get(Ae(this,t))}has(t){return super.has(Ae(this,t))}set(t,n){return super.set(du(this,t),n)}delete(t){return super.delete(wu(this,t))}}var Si=Array.prototype,rs=Si.slice,us=Si.map,vu=Math.sqrt(50),Tu=Math.sqrt(10),Nu=Math.sqrt(2);function dn(t,n,e){let i=(n-t)/Math.max(0,e),u=Math.floor(Math.log10(i)),r=i/Math.pow(10,u),o=r>=vu?10:r>=Tu?5:r>=Nu?2:1,a,s,l;if(u<0){if(l=Math.pow(10,-u)/o,a=Math.round(t*l),s=Math.round(n*l),a/l<t)++a;if(s/l>n)--s;l=-l}else{if(l=Math.pow(10,u)*o,a=Math.round(t/l),s=Math.round(n/l),a*l<t)++a;if(s*l>n)--s}if(s<a&&0.5<=e&&e<2)return dn(t,n,e*2);return[a,s,l]}function bu(t,n,e){if(n=+n,t=+t,e=+e,!(e>0))return[];if(t===n)return[t];let i=n<t,[u,r,o]=i?dn(n,t,e):dn(t,n,e);if(!(r>=u))return[];let a=r-u+1,s=Array(a);if(i)if(o<0)for(let l=0;l<a;++l)s[l]=(r-l)/-o;else for(let l=0;l<a;++l)s[l]=(r-l)*o;else if(o<0)for(let l=0;l<a;++l)s[l]=(u+l)/-o;else for(let l=0;l<a;++l)s[l]=(u+l)*o;return s}function Wn(t,n,e){return n=+n,t=+t,e=+e,dn(t,n,e)[2]}function $u(t,n,e){n=+n,t=+t,e=+e;let i=n<t,u=i?Wn(n,t,e):Wn(t,n,e);return(i?-1:1)*(u<0?1/-u:u)}function ku(t,n,e){t=+t;let i=arguments.length;if(i<2)n=t,t=0,e=1;else n=+n,e=i<3?1:+e;let u=-1,r=Math.max(0,Math.ceil((n-t)/e))|0,o=Array(r);while(++u<r)o[u]=t+u*e;return o}function Su(t){return function(n,e=0,i=n.length){let u=i-(e=+e);while(u){let r=t()*u--|0,o=n[u+e];n[u+e]=n[r+e],n[r+e]=o}return n}}var os=Su(Math.random);function ue(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t);break}return this}var Re=Symbol("implicit");function Ci(){let t=new Bn,n=[],e=[],i=Re;function u(r){let o=t.get(r);if(o===void 0){if(i!==Re)return i;t.set(r,o=n.push(r)-1)}return e[o%e.length]}return u.domain=function(r){if(!arguments.length)return n.slice();n=[],t=new Bn;for(let o of r){if(t.has(o))continue;t.set(o,n.push(o)-1)}return u},u.range=function(r){return arguments.length?(e=Array.from(r),u):e.slice()},u.unknown=function(r){return arguments.length?(i=r,u):i},u.copy=function(){return Ci().domain(n).range(e).unknown(i)},ue.apply(u,arguments),u}function oe(...t){let n=Ci().unknown(void 0),e=n.domain,i=n.range,u=0,r=1,o,a,s=!1,l=0,h=0,f=0.5;delete n.unknown;function c(){let g=e().length,m=r<u,M=m?r:u,x=m?u:r,T=M;if(o=(x-T)/Math.max(1,g-l+h*2),s)o=Math.floor(o);if(T+=(x-T-o*(g-l))*f,a=o*(1-l),s)T=Math.round(T),a=Math.round(a);let w=ku(g).map(function(v){return T+o*v});return i(m?w.reverse():w),n}let _=n;return _.domain=function(g){return arguments.length?(e(g),c()):e()},_.range=function(g){return arguments.length?([u,r]=Array.from(g),u=+u,r=+r,c()):[u,r]},_.rangeRound=function(g){return[u,r]=Array.from(g),u=+u,r=+r,s=!0,c()},_.bandwidth=function(){return a},_.step=function(){return o},_.round=function(g){return arguments.length?(s=!!g,c()):s},_.padding=function(g){return arguments.length?(l=Math.min(1,h=+g),c()):l},_.paddingInner=function(g){return arguments.length?(l=Math.min(1,+g),c()):l},_.paddingOuter=function(g){return arguments.length?(h=+g,c()):h},_.align=function(g){return arguments.length?(f=Math.max(0,Math.min(1,+g)),c()):f},_.copy=function(){let g=oe().domain(e()).range([u,r]);return g.round(s),g.paddingInner(l),g.paddingOuter(h),g.align(f),g},ue.apply(c(),arguments)}var Oe=0.7,je=1.4285714285714286,Cu=/^#([0-9a-f]{3,8})$/,Uu=new RegExp("^rgb\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*\\)$"),Du=new RegExp("^rgb\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),Eu=new RegExp("^rgba\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),Fu=new RegExp("^rgba\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),Yu=new RegExp("^hsl\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),qu=new RegExp("^hsla\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),Xe={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 wn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Tt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vt(t){return t=Tt(t),(t<16?"0":"")+t.toString(16)}function Ze(t){return t=(t||0)%360,t<0?t+360:t}function _n(t){return Math.max(0,Math.min(1,t||0))}function zn(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}class at{opacity;copy(t){return Object.assign(Object.create(Object.getPrototypeOf(this)),this,t)}displayable(){return this.rgb().displayable()}formatHex(){return this.rgb().formatHex()}formatHex8(){return this.rgb().formatHex8()}formatHsl(){return Ui(this).formatHsl()}formatRgb(){return this.rgb().formatRgb()}toString(){return this.rgb().formatRgb()}rgb(){return this.rgb()}hex(){return this.formatHex()}}at.prototype.hex=at.prototype.formatHex;class j extends at{r;g;b;constructor(t,n,e,i){super();this.r=+t,this.g=+n,this.b=+e,this.opacity=+i}brighter(t){return t=t==null?1.4285714285714286:Math.pow(1.4285714285714286,t),new j(this.r*t,this.g*t,this.b*t,this.opacity)}darker(t){return t=t==null?0.7:Math.pow(0.7,t),new j(this.r*t,this.g*t,this.b*t,this.opacity)}rgb(){return this}clamp(){return new j(Tt(this.r),Tt(this.g),Tt(this.b),wn(this.opacity))}displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)}formatHex(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}`}hex(){return this.formatHex()}formatHex8(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}${vt((isNaN(this.opacity)?1:this.opacity)*255)}`}formatRgb(){let t=wn(this.opacity);return`${t===1?"rgb(":"rgba("}${Tt(this.r)}, ${Tt(this.g)}, ${Tt(this.b)}${t===1?")":`, ${t})`}`}toString(){return this.formatRgb()}}j.prototype.hex=j.prototype.formatHex;class rt extends at{h;s;l;constructor(t,n,e,i){super();this.h=+t,this.s=+n,this.l=+e,this.opacity=+i}brighter(t){return t=t==null?1.4285714285714286:Math.pow(1.4285714285714286,t),new rt(this.h,this.s,this.l*t,this.opacity)}darker(t){return t=t==null?0.7:Math.pow(0.7,t),new rt(this.h,this.s,this.l*t,this.opacity)}rgb(){let t=this.h%360+(this.h<0?360:0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<0.5?e:1-e)*n,u=2*e-i;return new j(zn(t>=240?t-240:t+120,u,i),zn(t,u,i),zn(t<120?t+240:t-120,u,i),this.opacity)}clamp(){return new rt(Ze(this.h),_n(this.s),_n(this.l),wn(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(){let t=wn(this.opacity);return`${t===1?"hsl(":"hsla("}${Ze(this.h)}, ${_n(this.s)*100}%, ${_n(this.l)*100}%${t===1?")":`, ${t})`}`}}function Le(t){return new j(t>>16&255,t>>8&255,t&255,1)}function gn(t,n,e,i){if(i<=0)t=n=e=NaN;return new j(t,n,e,i)}function Qe(t,n,e,i){if(i<=0)t=n=e=NaN;else if(e<=0||e>=1)t=n=NaN;else if(n<=0)t=NaN;return new rt(t,n,e,i)}function ae(t){let n;if(t=`${t}`.trim().toLowerCase(),n=Cu.exec(t)){let e=n[1].length,i=parseInt(n[1],16);if(e===6)return Le(i);if(e===3)return new j(i>>8&15|i>>4&240,i>>4&15|i&240,(i&15)<<4|i&15,1);if(e===8)return gn(i>>24&255,i>>16&255,i>>8&255,(i&255)/255);if(e===4)return gn(i>>12&15|i>>8&240,i>>8&15|i>>4&240,i>>4&15|i&240,((i&15)<<4|i&15)/255);return null}if(n=Uu.exec(t))return new j(+n[1],+n[2],+n[3],1);if(n=Du.exec(t))return new j(+n[1]*255/100,+n[2]*255/100,+n[3]*255/100,1);if(n=Eu.exec(t))return gn(+n[1],+n[2],+n[3],+n[4]);if(n=Fu.exec(t))return gn(+n[1]*255/100,+n[2]*255/100,+n[3]*255/100,+n[4]);if(n=Yu.exec(t))return Qe(+n[1],+n[2]/100,+n[3]/100,1);if(n=qu.exec(t))return Qe(+n[1],+n[2]/100,+n[3]/100,+n[4]);if(Object.prototype.hasOwnProperty.call(Xe,t))return Le(Xe[t]);if(t==="transparent")return new j(NaN,NaN,NaN,0);return null}function le(t){if(!(t instanceof at))t=ae(t);if(!t)return new j(NaN,NaN,NaN,NaN);let n=t.rgb();return new j(n.r,n.g,n.b,n.opacity)}function te(t,n,e,i){if(n===void 0&&e===void 0)return le(t);return new j(t,n,e,i==null?1:i)}function Ui(t){if(t instanceof rt)return new rt(t.h,t.s,t.l,t.opacity);if(!(t instanceof at))t=ae(t);if(!t)return new rt(NaN,NaN,NaN,NaN);if(t instanceof rt)return t;let n=t.rgb(),e=n.r/255,i=n.g/255,u=n.b/255,r=Math.min(e,i,u),o=Math.max(e,i,u),a=NaN,s=o-r,l=(o+r)/2;if(s){if(e===o)a=(i-u)/s+(i<u?6:0);else if(i===o)a=(u-e)/s+2;else a=(e-i)/s+4;s/=l<0.5?o+r:2-o-r,a*=60}else s=l>0&&l<1?0:a;return new rt(a,s,l,n.opacity)}function Ve(t,n,e,i){if(n===void 0&&e===void 0)return Ui(t);return new rt(t,n,e,i==null?1:i)}var Di=Math.PI/180,Ei=180/Math.PI,vn=18,Fi=0.96422,Yi=1,qi=0.82521,Hi=0.13793103448275862,Rt=0.20689655172413793,Pi=3*Rt*Rt,Hu=Rt*Rt*Rt;function An(t){return t>Hu?Math.pow(t,0.3333333333333333):t/Pi+Hi}function Rn(t){return t>Rt?t*t*t:Pi*(t-Hi)}function On(t){return 255*(t<=0.0031308?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)}function jn(t){return(t/=255)<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function Pu(t){if(t instanceof ct)return new ct(t.l,t.a,t.b,t.opacity);if(t instanceof ft)return zi(t);if(!(t instanceof j))t=le(t);let n=t,e=jn(n.r),i=jn(n.g),u=jn(n.b),r=An((0.2225045*e+0.7168786*i+0.0606169*u)/Yi),o,a;if(e===i&&i===u)o=a=r;else o=An((0.4360747*e+0.3850649*i+0.1430804*u)/Fi),a=An((0.0139322*e+0.0971045*i+0.7141733*u)/qi);return new ct(116*r-16,500*(o-r),200*(r-a),n.opacity)}class ct extends at{l;a;b;constructor(t,n,e,i){super();this.l=+t,this.a=+n,this.b=+e,this.opacity=+i}brighter(t){return new ct(this.l+vn*(t==null?1:t),this.a,this.b,this.opacity)}darker(t){return new ct(this.l-vn*(t==null?1:t),this.a,this.b,this.opacity)}rgb(){let t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200,i=Fi*Rn(n),u=Yi*Rn(t),r=qi*Rn(e);return new j(On(3.1338561*i-1.6168667*u-0.4906146*r),On(-0.9787684*i+1.9161415*u+0.033454*r),On(0.0719453*i-0.2289914*u+1.4052427*r),this.opacity)}}function zu(t){if(t instanceof ft)return new ft(t.h,t.c,t.l,t.opacity);if(!(t instanceof ct))t=Pu(t);let n=t;if(n.a===0&&n.b===0)return new ft(NaN,0<n.l&&n.l<100?0:NaN,n.l,n.opacity);let e=Math.atan2(n.b,n.a)*Ei;return new ft(e<0?e+360:e,Math.sqrt(n.a*n.a+n.b*n.b),n.l,n.opacity)}function Je(t,n,e,i){if(n===void 0&&e===void 0)return zu(t);return new ft(t,n,e,i==null?1:i)}function zi(t){if(isNaN(t.h))return new ct(t.l,0,0,t.opacity);let n=t.h*Di;return new ct(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}class ft extends at{h;c;l;constructor(t,n,e,i){super();this.h=+t,this.c=+n,this.l=+e,this.opacity=+i}brighter(t){return new ft(this.h,this.c,this.l+vn*(t==null?1:t),this.opacity)}darker(t){return new ft(this.h,this.c,this.l-vn*(t==null?1:t),this.opacity)}rgb(){return zi(this).rgb()}}var Ai=-0.14861,se=1.78277,he=-0.29227,Sn=-0.90649,an=1.97294,Ie=an*Sn,Ke=an*se,Ge=se*he-Sn*Ai;function Au(t){if(t instanceof Nt)return new Nt(t.h,t.s,t.l,t.opacity);if(!(t instanceof j))t=le(t);let n=t,e=n.r/255,i=n.g/255,u=n.b/255,r=(Ge*u+Ie*e-Ke*i)/(Ge+Ie-Ke),o=u-r,a=(an*(i-r)-he*o)/Sn,s=Math.sqrt(a*a+o*o)/(an*r*(1-r)),l=s?Math.atan2(a,o)*Ei-120:NaN;return new Nt(l<0?l+360:l,s,r,n.opacity)}function Be(t,n,e,i){if(n===void 0&&e===void 0)return Au(t);return new Nt(t,n,e,i==null?1:i)}class Nt extends at{h;s;l;constructor(t,n,e,i){super();this.h=+t,this.s=+n,this.l=+e,this.opacity=+i}brighter(t){return t=t==null?je:Math.pow(je,t),new Nt(this.h,this.s,this.l*t,this.opacity)}darker(t){return t=t==null?Oe:Math.pow(Oe,t),new Nt(this.h,this.s,this.l*t,this.opacity)}rgb(){let t=isNaN(this.h)?0:(this.h+120)*Di,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),i=Math.cos(t),u=Math.sin(t);return new j(255*(n+e*(Ai*i+se*u)),255*(n+e*(he*i+Sn*u)),255*(n+e*(an*i)),this.opacity)}}function Ri(t,n,e,i,u){let r=t*t,o=r*t;return((1-3*t+3*r-o)*n+(4-6*r+3*o)*e+(1+3*t+3*r-3*o)*i+o*u)/6}function Ru(t){let n=t.length-1;return function(e){let i=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),u=t[i],r=t[i+1],o=i>0?t[i-1]:2*u-r,a=i<n-1?t[i+2]:2*r-u;return Ri((e-i/n)*n,o,u,r,a)}}function Ou(t){let n=t.length;return function(e){let i=Math.floor(((e%=1)<0?++e:e)*n),u=t[(i+n-1)%n],r=t[i%n],o=t[(i+1)%n],a=t[(i+2)%n];return Ri((e-i/n)*n,u,r,o,a)}}var ju=(t)=>()=>t,Cn=ju;function Oi(t,n){return function(e){return t+e*n}}function Xu(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(i){return Math.pow(t+i*n,e)}}function fe(t,n){let e=n-t;return e?Oi(t,e>180||e<-180?e-360*Math.round(e/360):e):Cn(isNaN(t)?n:t)}function Zu(t){return(t=+t)===1?G:function(n,e){return e-n?Xu(n,e,t):Cn(isNaN(n)?e:n)}}function G(t,n){let e=n-t;return e?Oi(t,e):Cn(isNaN(t)?n:t)}var We=function t(n){let e=Zu(n);function i(u,r){let o=te(u),a=te(r),s=e(o.r,a.r),l=e(o.g,a.g),h=e(o.b,a.b),f=G(o.opacity,a.opacity);return function(c){return o.r=s(c),o.g=l(c),o.b=h(c),o.opacity=f(c),`${o}`}}return i.gamma=t,i}(1);function ji(t){return function(n){let e=n.length,i=Array(e),u=Array(e),r=Array(e),o,a;for(o=0;o<e;++o)a=te(n[o]),i[o]=a.r||0,u[o]=a.g||0,r[o]=a.b||0;let s=t(i),l=t(u),h=t(r);return a.opacity=1,function(f){return a.r=s(f),a.g=l(f),a.b=h(f),`${a}`}}}var as=ji(Ru),ls=ji(Ou);function Lu(t,n){if(!n)n=[];let e=t?Math.min(n.length,t.length):0,i=ArrayBuffer.isView(n)?new n.constructor(n):Array.prototype.slice.call(n),u;return function(r){for(u=0;u<e;++u)i[u]=t[u]*(1-r)+n[u]*r;return i}}function Qu(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Vu(t,n){let e=n?n.length:0,i=t?Math.min(e,t.length):0,u=Array(i),r=Array(e),o;for(o=0;o<i;++o)u[o]=ce(t[o],n[o]);for(;o<e;++o)r[o]=n[o];return function(a){for(o=0;o<i;++o)r[o]=u[o](a);return r}}function Ju(t,n){let e=new Date,i=+t,u=+n;return function(r){return e.setTime(i*(1-r)+u*r),e}}function ht(t,n){let e=+t,i=+n;return function(u){return e*(1-u)+i*u}}function Iu(t,n){let e={},i={},u;if(t===null||typeof t!=="object")t={};if(n===null||typeof n!=="object")n={};for(u in n)if(u in t)e[u]=ce(t[u],n[u]);else i[u]=n[u];return function(r){for(u in e)i[u]=e[u](r);return i}}var ne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xn=new RegExp(ne.source,"g");function Ku(t){return function(){return t}}function Gu(t){return function(n){return`${t(n)}`}}function Bu(t,n){let e=ne.lastIndex=Xn.lastIndex=0,i,u,r,o=-1,a=[],s=[],l=`${t}`,h=`${n}`;while((i=ne.exec(l))&&(u=Xn.exec(h))){if((r=u.index)>e)if(r=h.slice(e,r),a[o])a[o]+=r;else a[++o]=r;if(i===u)if(a[o])a[o]+=u[0];else a[++o]=u[0];else a[++o]=null,s.push({i:o,x:ht(+i[0],+u[0])});e=Xn.lastIndex}if(e<h.length)if(r=h.slice(e),a[o])a[o]+=r;else a[++o]=r;return a.length<2?s[0]?Gu(s[0].x):Ku(h):(h=s.length,function(f){for(let c=0,_;c<h;++c)a[(_=s[c]).i]=_.x(f);return a.join("")})}function ce(t,n){let e=typeof n,i;return n==null||e==="boolean"?Cn(n):(e==="number"?ht:e==="string"?(i=ae(n))?(n=i,We):Bu:n instanceof at?We:n instanceof Date?Ju:Qu(n)?Lu:Array.isArray(n)?Vu:typeof n.valueOf!=="function"&&typeof n.toString!=="function"||isNaN(n)?Iu:ht)(t,n)}function Wu(t,n){let e=+t,i=+n;return function(u){return Math.round(e*(1-u)+i*u)}}var ti=180/Math.PI,ee={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Xi(t,n,e,i,u,r){let o,a,s;if(o=Math.sqrt(t*t+n*n))t/=o,n/=o;if(s=t*e+n*i)e-=t*s,i-=n*s;if(a=Math.sqrt(e*e+i*i))e/=a,i/=a,s/=a;if(t*i<n*e)t=-t,n=-n,s=-s,o=-o;return{translateX:u,translateY:r,rotate:Math.atan2(n,t)*ti,skewX:Math.atan(s)*ti,scaleX:o,scaleY:a}}var yn;function to(t){let n=new(typeof DOMMatrix==="function"?DOMMatrix:globalThis.WebKitCSSMatrix)(`${t}`);return n.isIdentity?ee:Xi(n.a,n.b,n.c,n.d,n.e,n.f)}function no(t){if(t==null)return ee;if(!yn)yn=document.createElementNS("http://www.w3.org/2000/svg","g");yn.setAttribute("transform",t);let n=yn.transform.baseVal.consolidate();if(!n)return ee;let e=n.matrix;return Xi(e.a,e.b,e.c,e.d,e.e,e.f)}function Zi(t,n,e,i){function u(l){return l.length?`${l.pop()} `:""}function r(l,h,f,c,_,g){if(l!==f||h!==c){let m=_.push("translate(",null,n,null,e);g.push({i:m-4,x:ht(l,f)},{i:m-2,x:ht(h,c)})}else if(f||c)_.push(`translate(${f}${n}${c}${e}`)}function o(l,h,f,c){if(l!==h){if(l-h>180)h+=360;else if(h-l>180)l+=360;c.push({i:f.push(`${u(f)}rotate(`,null,i)-2,x:ht(l,h)})}else if(h)f.push(`${u(f)}rotate(${h}${i}`)}function a(l,h,f,c){if(l!==h)c.push({i:f.push(`${u(f)}skewX(`,null,i)-2,x:ht(l,h)});else if(h)f.push(`${u(f)}skewX(${h}${i}`)}function s(l,h,f,c,_,g){if(l!==f||h!==c){let m=_.push(`${u(_)}scale(`,null,",",null,")");g.push({i:m-4,x:ht(l,f)},{i:m-2,x:ht(h,c)})}else if(f!==1||c!==1)_.push(`${u(_)}scale(${f},${c})`)}return function(l,h){let f=[],c=[],_=t(l),g=t(h);return r(_.translateX,_.translateY,g.translateX,g.translateY,f,c),o(_.rotate,g.rotate,f,c),a(_.skewX,g.skewX,f,c),s(_.scaleX,_.scaleY,g.scaleX,g.scaleY,f,c),function(m){let M=-1,x=c.length,T;while(++M<x)f[(T=c[M]).i]=T.x(m);return f.join("")}}}var ss=Zi(to,"px, ","px)","deg)"),hs=Zi(no,", ",")",")");function ni(t){return((t=Math.exp(t))+1/t)/2}function eo(t){return((t=Math.exp(t))-1/t)/2}function io(t){return((t=Math.exp(2*t))-1)/(t+1)}var fs=function t(n,e,i){function u(r,o){let a=r[0],s=r[1],l=r[2],h=o[0],f=o[1],c=o[2],_=h-a,g=f-s,m=_*_+g*g,M,x;if(m<0.000000000001)x=Math.log(c/l)/n,M=function(T){return[a+T*_,s+T*g,l*Math.exp(n*T*x)]};else{let T=Math.sqrt(m),w=(c*c-l*l+i*m)/(2*l*e*T),v=(c*c-l*l-i*m)/(2*c*e*T),$=Math.log(Math.sqrt(w*w+1)-w);x=(Math.log(Math.sqrt(v*v+1)-v)-$)/n,M=function(S){let b=S*x,F=ni($),P=l/(e*T)*(F*io(n*b+$)-eo($));return[a+P*_,s+P*g,l*F/ni(n*b+$)]}}return M.duration=x*1000*n/Math.SQRT2,M}return u.rho=function(r){let o=Math.max(0.001,+r),a=o*o,s=a*a;return t(o,a,s)},u}(Math.SQRT2,2,4);function Li(t){return function(n,e){let i=Ve(n),u=Ve(e),r=t(i.h,u.h),o=G(i.s,u.s),a=G(i.l,u.l),s=G(i.opacity,u.opacity);return function(l){return i.h=r(l),i.s=o(l),i.l=a(l),i.opacity=s(l),`${i}`}}}var cs=Li(fe),_s=Li(G);function Qi(t){return function(n,e){let i=Je(n),u=Je(e),r=t(i.h,u.h),o=G(i.c,u.c),a=G(i.l,u.l),s=G(i.opacity,u.opacity);return function(l){return i.h=r(l),i.c=o(l),i.l=a(l),i.opacity=s(l),`${i}`}}}var gs=Qi(fe),ys=Qi(G);function Vi(t){return function n(e){e=+e;function i(u,r){let o=Be(u),a=Be(r),s=t(o.h,a.h),l=G(o.s,a.s),h=G(o.l,a.l),f=G(o.opacity,a.opacity);return function(c){return o.h=s(c),o.s=l(c),o.l=h(Math.pow(c,e)),o.opacity=f(c),`${o}`}}return i.gamma=n,i}(1)}var ps=Vi(fe),ms=Vi(G);function ro(t){return function(){return t}}function uo(t){return+t}var ei=[0,1];function At(t){return t}function ie(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:ro(isNaN(n)?NaN:0.5)}function oo(t,n){let e;if(t>n)e=t,t=n,n=e;return function(i){return Math.max(t,Math.min(n,i))}}function ao(t,n,e){let i=t[0],u=t[1],r=n[0],o=n[1],a,s;if(u<i)a=ie(u,i),s=e(o,r);else a=ie(i,u),s=e(r,o);return function(l){return s(a(l))}}function lo(t,n,e){let i=Math.min(t.length,n.length)-1,u=Array(i),r=Array(i),o=-1;if(t[i]<t[0])t=t.slice().reverse(),n=n.slice().reverse();while(++o<i)u[o]=ie(t[o],t[o+1]),r[o]=e(n[o],n[o+1]);return function(a){let s=pu(t,a,1,i)-1;return r[s](u[s](a))}}function so(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ho(){let t=ei,n=ei,e=ce,i,u,r,o=At,a,s,l;function h(){let c=Math.min(t.length,n.length);if(o!==At)o=oo(t[0],t[c-1]);return a=c>2?lo:ao,s=l=null,f}function f(c){return c==null||isNaN(c=+c)?r:(s||(s=a(t.map(i),n,e)))(i(o(c)))}return f.invert=function(c){return o(u((l||(l=a(n,t.map(i),ht)))(c)))},f.domain=function(c){return arguments.length?(t=Array.from(c,uo),h()):t.slice()},f.range=function(c){return arguments.length?(n=Array.from(c),h()):n.slice()},f.rangeRound=function(c){return n=Array.from(c),e=Wu,h()},f.clamp=function(c){return arguments.length?(o=c?!0:At,h()):o!==At},f.interpolate=function(c){return arguments.length?(e=c,h()):e},f.unknown=function(c){return arguments.length?(r=c,f):r},function(c,_){return i=c,u=_,h()}}function fo(){return ho()(At,At)}function co(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Tn(t,n){if(!isFinite(t)||t===0)return null;let e=n?t.toExponential(n-1):t.toExponential(),i=e.indexOf("e"),u=e.slice(0,i);return[u.length>1?u[0]+u.slice(2):u,+e.slice(i+1)]}function Ot(t){let n=Tn(Math.abs(t));return n?n[1]:NaN}function _o(t,n){return function(e,i){let u=e.length,r=[],o=0,a=t[0],s=0;while(u>0&&a>0){if(s+a+1>i)a=Math.max(1,i-s);if(r.push(e.substring(u-=a,u+a)),(s+=a+1)>i)break;a=t[o=(o+1)%t.length]}return r.reverse().join(n)}}function go(t){return function(n){return n.replace(/[0-9]/g,function(e){return t[+e]})}}var yo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;class _e{fill;align;sign;symbol;zero;width;comma;precision;trim;type;constructor(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}`}toString(){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 Ji(t){let n=yo.exec(t);if(!n)throw Error(`invalid format: ${t}`);return new _e({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]})}Ji.prototype=_e.prototype;var po=Ji,re=po;function mo(t){let n=-1,e=0;t:for(let i=t.length,u=1;u<i;++u)switch(t[u]){case".":n=e=u;break;case"0":if(n===0)n=u;e=u;break;default:if(!+t[u])break t;if(n>0)n=0;break}return n>0?t.slice(0,n)+t.slice(e+1):t}var on;function Mo(t,n){let e=Tn(t,n);if(!e)return on=void 0,t.toPrecision(n);let i=e[0],u=e[1];on=Math.max(-8,Math.min(8,Math.floor(u/3)))*3;let r=u-on+1,o=i.length;return r===o?i:r>o?`${i}${Array(r-o+1).join("0")}`:r>0?`${i.slice(0,r)}.${i.slice(r)}`:`0.${Array(1-r).join("0")}${Tn(t,Math.max(0,n+r-1))[0]}`}function ii(t,n){let e=Tn(t,n);if(!e)return`${t}`;let i=e[0],u=e[1];return u<0?`0.${Array(-u).join("0")}${i}`:i.length>u+1?`${i.slice(0,u+1)}.${i.slice(u+1)}`:`${i}${Array(u-i.length+2).join("0")}`}var xo={"%":(t,n)=>(t*100).toFixed(n),b:(t)=>Math.round(t).toString(2),c:(t)=>`${t}`,d:co,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)=>ii(t*100,n),r:ii,s:Mo,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)},ri=xo;function ui(t){return t}var oi=Array.prototype.map,ai=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function wo(t){let n=t.grouping===void 0||t.thousands===void 0?ui:_o(oi.call(t.grouping,Number),`${t.thousands}`),e=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",u=t.decimal===void 0?".":`${t.decimal}`,r=t.numerals===void 0?ui:go(oi.call(t.numerals,String)),o=t.percent===void 0?"%":`${t.percent}`,a=t.minus===void 0?"\u2212":`${t.minus}`,s=t.nan===void 0?"NaN":`${t.nan}`;function l(f,c){let _=re(f),g=_.fill,m=_.align,M=_.sign,x=_.symbol,T=_.zero,w=_.width,v=_.comma,$=_.precision,S=_.trim,b=_.type;if(b==="n")v=!0,b="g";else if(!ri[b]){if($===void 0)$=12;S=!0,b="g"}if(T||g==="0"&&m==="=")T=!0,g="0",m="=";let F=(c&&c.prefix!==void 0?c.prefix:"")+(x==="$"?e:x==="#"&&/[boxX]/.test(b)?`0${b.toLowerCase()}`:""),P=(x==="$"?i:/[%p]/.test(b)?o:"")+(c&&c.suffix!==void 0?c.suffix:""),z=ri[b],R=/[defgprs%]/.test(b);$=$===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,$)):Math.max(0,Math.min(20,$));function O(y){let N=F,k=P,H,nt,Q;if(b==="c")k=z(y)+k,y="";else{y=+y;let A=y<0||1/y<0;if(y=isNaN(y)?s:z(Math.abs(y),$),S)y=mo(y);if(A&&+y===0&&M!=="+")A=!1;if(N=(A?M==="("?M:a:M==="-"||M==="("?"":M)+N,k=(b==="s"&&!isNaN(y)&&on!==void 0?ai[8+on/3]:"")+k+(A&&M==="("?")":""),R){H=-1,nt=y.length;while(++H<nt)if(Q=y.charCodeAt(H),48>Q||Q>57){k=(Q===46?u+y.slice(H+1):y.slice(H))+k,y=y.slice(0,H);break}}}if(v&&!T)y=n(y,1/0);let et=N.length+y.length+k.length,Y=et<(w??0)?Array((w??0)-et+1).join(g):"";if(v&&T)y=n(Y+y,Y.length?(w??0)-k.length:1/0),Y="";switch(m){case"<":y=N+y+k+Y;break;case"=":y=N+Y+y+k;break;case"^":{let A=Y.length>>1;y=Y.slice(0,A)+N+y+k+Y.slice(A);break}default:y=Y+N+y+k;break}return r(y)}return O.toString=function(){return`${_}`},O}function h(f,c){let _=re(f);_.type="f";let g=Math.max(-8,Math.min(8,Math.floor(Ot(c)/3)))*3,m=Math.pow(10,-g),M=l(`${_}`,{suffix:ai[8+g/3]});return function(x){return M(m*x)}}return{format:l,formatPrefix:h}}var pn,Ii,Ki;vo({thousands:",",grouping:[3],currency:["$",""]});function vo(t){return pn=wo(t),Ii=pn.format,Ki=pn.formatPrefix,pn}function To(t){return Math.max(0,-Ot(Math.abs(t)))}function No(t,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ot(n)/3)))*3-Ot(Math.abs(t)))}function bo(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Ot(n)-Ot(t))+1}function $o(t,n,e,i){let u=$u(t,n,e),r,o=re(i==null?",f":i);switch(o.type){case"s":{let a=Math.max(Math.abs(t),Math.abs(n));if(o.precision==null&&!isNaN(r=No(u,a)))o.precision=r;return Ki(o.toString(),a)}case"":case"e":case"g":case"p":case"r":{if(o.precision==null&&!isNaN(r=bo(u,Math.max(Math.abs(t),Math.abs(n)))))o.precision=r-(o.type==="e"?1:0);break}case"f":case"%":{if(o.precision==null&&!isNaN(r=To(u)))o.precision=r-(o.type==="%"?1:0)*2;break}}return Ii(o.toString())}function ko(t){let n=t.domain;return t.ticks=function(e){let i=n();return bu(i[0],i[i.length-1],e==null?10:e)},t.tickFormat=function(e,i){let u=n();return $o(u[0],u[u.length-1],e==null?10:e,i)},t.nice=function(e){if(e==null)e=10;let i=n(),u=0,r=i.length-1,o=i[u],a=i[r],s,l,h=10;if(a<o)l=o,o=a,a=l,l=u,u=r,r=l;while(h-- >0){if(l=Wn(o,a,e),l===s)return i[u]=o,i[r]=a,t.domain(i);else if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;s=l}return t},t}function Qt(...t){let n=fo();return n.copy=function(){return so(n,Qt())},ue.apply(n,arguments),ko(n)}var Zn=new Date,Ln=new Date;function X(t,n,e,i){function u(r){let o=r==null?new Date:new Date(+r);return t(o),o}if(u.floor=(r)=>{let o=new Date(+r);return t(o),o},u.ceil=(r)=>{let o=new Date(+r-1);return t(o),n(o,1),t(o),o},u.round=(r)=>{let o=u(r),a=u.ceil(r);return+r-+o<+a-+r?o:a},u.offset=(r,o)=>{let a=new Date(+r);return n(a,o==null?1:Math.floor(o)),a},u.range=(r,o,a)=>{let s=[],l=u.ceil(r),h=a==null?1:Math.floor(a);if(!(l<new Date(+o))||!(h>0))return s;let f;do f=new Date(+l),s.push(f),n(l,h),t(l);while(f<l&&l<new Date(+o));return s},u.filter=(r)=>{return X((o)=>{if(o>=o)while(t(o),!r(o))o.setTime(+o-1)},(o,a)=>{if(o>=o)if(a<0)while(++a<=0)while(n(o,-1),!r(o));else while(--a>=0)while(n(o,1),!r(o));})},e)u.count=(r,o)=>{return Zn.setTime(+r),Ln.setTime(+o),t(Zn),t(Ln),Math.floor(e(Zn,Ln))},u.every=(r)=>{return r=Math.floor(r),!isFinite(r)||!(r>0)?null:!(r>1)?u:u.filter(i?(o)=>i(o)%r===0:(o)=>u.count(0,o)%r===0)};return u}var Nn=X(()=>{},(t,n)=>{t.setTime(+t+n)},(t,n)=>{return+n-+t});Nn.every=(t)=>{if(t=Math.floor(t),!isFinite(t)||!(t>0))return null;if(!(t>1))return Nn;return X((n)=>{n.setTime(Math.floor(+n/t)*t)},(n,e)=>{n.setTime(+n+e*t)},(n,e)=>{return(+e-+n)/t})};var Ms=Nn.range,_t=1000,ut=60000,gt=3600000,jt=86400000,ge=604800000,li=2592000000,Qn=31536000000,rn=X((t)=>{t.setTime(+t-t.getMilliseconds())},(t,n)=>{t.setTime(+t+n*_t)},(t,n)=>{return(+n-+t)/_t},(t)=>{return t.getUTCSeconds()}),xs=rn.range,Gi=X((t)=>{t.setTime(+t-t.getMilliseconds()-t.getSeconds()*_t)},(t,n)=>{t.setTime(+t+n*ut)},(t,n)=>{return(+n-+t)/ut},(t)=>{return t.getMinutes()}),ds=Gi.range,Bi=X((t)=>{t.setUTCSeconds(0,0)},(t,n)=>{t.setTime(+t+n*ut)},(t,n)=>{return(+n-+t)/ut},(t)=>{return t.getUTCMinutes()}),ws=Bi.range,Wi=X((t)=>{t.setTime(+t-t.getMilliseconds()-t.getSeconds()*_t-t.getMinutes()*ut)},(t,n)=>{t.setTime(+t+n*gt)},(t,n)=>{return(+n-+t)/gt},(t)=>{return t.getHours()}),vs=Wi.range,tr=X((t)=>{t.setUTCMinutes(0,0,0)},(t,n)=>{t.setTime(+t+n*gt)},(t,n)=>{return(+n-+t)/gt},(t)=>{return t.getUTCHours()}),Ts=tr.range,nr=X((t)=>{t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n)},(t,n)=>(+n-+t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ut)/jt,(t)=>t.getDate()-1),Ns=nr.range,So=X((t)=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>{return(+n-+t)/jt},(t)=>{return t.getUTCDate()-1}),bs=So.range,er=X((t)=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>{return(+n-+t)/jt},(t)=>{return Math.floor(+t/jt)}),$s=er.range;function bt(t){return X((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)=>{return(+e-+n-(e.getTimezoneOffset()-n.getTimezoneOffset())*ut)/ge})}var ir=bt(0),Co=bt(1),Uo=bt(2),Do=bt(3),Eo=bt(4),Fo=bt(5),Yo=bt(6),ks=ir.range,Ss=Co.range,Cs=Uo.range,Us=Do.range,Ds=Eo.range,Es=Fo.range,Fs=Yo.range;function $t(t){return X((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)=>{return(+e-+n)/ge})}var rr=$t(0),qo=$t(1),Ho=$t(2),Po=$t(3),zo=$t(4),Ao=$t(5),Ro=$t(6),Ys=rr.range,qs=qo.range,Hs=Ho.range,Ps=Po.range,zs=zo.range,As=Ao.range,Rs=Ro.range,ur=X((t)=>{t.setDate(1),t.setHours(0,0,0,0)},(t,n)=>{t.setMonth(t.getMonth()+n)},(t,n)=>{return n.getMonth()-t.getMonth()+(n.getFullYear()-t.getFullYear())*12},(t)=>{return t.getMonth()}),Os=ur.range,or=X((t)=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)},(t,n)=>{return n.getUTCMonth()-t.getUTCMonth()+(n.getUTCFullYear()-t.getUTCFullYear())*12},(t)=>{return t.getUTCMonth()}),js=or.range,ye=X((t)=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n)},(t,n)=>{return n.getFullYear()-t.getFullYear()},(t)=>{return t.getFullYear()});ye.every=(t)=>{return t=Math.floor(t),!isFinite(t)||!(t>0)?null:X((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)})};var Xs=ye.range,pe=X((t)=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)},(t,n)=>{return n.getUTCFullYear()-t.getUTCFullYear()},(t)=>{return t.getUTCFullYear()});pe.every=(t)=>{return t=Math.floor(t),!isFinite(t)||!(t>0)?null:X((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)})};var Zs=pe.range;function Mn(t,n){return t==null||n==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Oo(t,n){return t==null||n==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function me(t){let n,e,i;if(t.length!==2)n=Mn,e=(a,s)=>Mn(t(a),s),i=(a,s)=>t(a)-s;else n=t===Mn||t===Oo?t:jo,e=t,i=t;function u(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<0)l=f+1;else h=f}while(l<h)}return l}function r(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<=0)l=f+1;else h=f}while(l<h)}return l}function o(a,s,l=0,h=a.length){let f=u(a,s,l,h-1);return f>l&&i(a[f-1],s)>-i(a[f],s)?f-1:f}return{left:u,center:o,right:r}}function jo(){return 0}function Xo(t){return t===null?NaN:+t}var ar=me(Mn),Ls=ar.right,Qs=ar.left,Vs=me(Xo).center,Js=lr(sr),Is=lr(Zo);function lr(t){return function(n,e,i=e){if(!((e=+e)>=0))throw RangeError("invalid rx");if(!((i=+i)>=0))throw RangeError("invalid ry");let{data:u,width:r,height:o}=n;if(!((r=Math.floor(r))>=0))throw RangeError("invalid width");if(!((o=Math.floor(o!==void 0?o:u.length/r))>=0))throw RangeError("invalid height");if(!r||!o||!e&&!i)return n;let a=e&&t(e),s=i&&t(i),l=u.slice();if(a&&s)Yt(a,l,u,r,o),Yt(a,u,l,r,o),Yt(a,l,u,r,o),qt(s,u,l,r,o),qt(s,l,u,r,o),qt(s,u,l,r,o);else if(a)Yt(a,u,l,r,o),Yt(a,l,u,r,o),Yt(a,u,l,r,o);else if(s)qt(s,u,l,r,o),qt(s,l,u,r,o),qt(s,u,l,r,o);return n}}function Yt(t,n,e,i,u){for(let r=0,o=i*u;r<o;)t(n,e,r,r+=i,1)}function qt(t,n,e,i,u){for(let r=0,o=i*u;r<i;++r)t(n,e,r,r+o,i)}function Zo(t){let n=sr(t);return(e,i,u,r,o)=>{u<<=2,r<<=2,o<<=2,n(e,i,u+0,r+0,o),n(e,i,u+1,r+1,o),n(e,i,u+2,r+2,o),n(e,i,u+3,r+3,o)}}function sr(t){let n=Math.floor(t);if(n===t)return Lo(t);let e=t-n,i=2*t+1;return(u,r,o,a,s)=>{if(!((a-=s)>=o))return;let l=n*r[o],h=s*n,f=h+s;for(let c=o,_=o+h;c<_;c+=s)l+=r[Math.min(a,c)];for(let c=o,_=a;c<=_;c+=s)l+=r[Math.min(a,c+h)],u[c]=(l+e*(r[Math.max(o,c-f)]+r[Math.min(a,c+f)]))/i,l-=r[Math.max(o,c-h)]}}function Lo(t){let n=2*t+1;return(e,i,u,r,o)=>{if(!((r-=o)>=u))return;let a=t*i[u],s=o*t;for(let l=u,h=u+s;l<h;l+=o)a+=i[Math.min(r,l)];for(let l=u,h=r;l<=h;l+=o)a+=i[Math.min(r,l+s)],e[l]=a/n,a-=i[Math.max(u,l-s)]}}var hr=Array.prototype,Ks=hr.slice,Gs=hr.map,Qo=Math.sqrt(50),Vo=Math.sqrt(10),Jo=Math.sqrt(2);function fr(t,n,e){let i=(n-t)/Math.max(0,e),u=Math.floor(Math.log10(i)),r=i/Math.pow(10,u),o=r>=Qo?10:r>=Vo?5:r>=Jo?2:1,a,s,l;if(u<0){if(l=Math.pow(10,-u)/o,a=Math.round(t*l),s=Math.round(n*l),a/l<t)++a;if(s/l>n)--s;l=-l}else{if(l=Math.pow(10,u)*o,a=Math.round(t/l),s=Math.round(n/l),a*l<t)++a;if(s*l>n)--s}if(s<a&&0.5<=e&&e<2)return fr(t,n,e*2);return[a,s,l]}function si(t,n,e){return n=+n,t=+t,e=+e,fr(t,n,e)[2]}function hi(t,n,e){n=+n,t=+t,e=+e;let i=n<t,u=i?si(n,t,e):si(t,n,e);return(i?-1:1)*(u<0?1/-u:u)}function Io(t){return function(n,e=0,i=n.length){let u=i-(e=+e);while(u){let r=t()*u--|0,o=n[u+e];n[u+e]=n[r+e],n[r+e]=o}return n}}var Bs=Io(Math.random);function cr(t,n,e,i,u,r){let o=[[rn,1,_t],[rn,5,5*_t],[rn,15,15*_t],[rn,30,30*_t],[r,1,ut],[r,5,5*ut],[r,15,15*ut],[r,30,30*ut],[u,1,gt],[u,3,3*gt],[u,6,6*gt],[u,12,12*gt],[i,1,jt],[i,2,2*jt],[e,1,ge],[n,1,li],[n,3,3*li],[t,1,Qn]];function a(l,h,f){let c=h<l;if(c)[l,h]=[h,l];let _=f&&typeof f.range==="function"?f:s(l,h,f),g=_?_.range(l,+h+1):[];return c?g.reverse():g}function s(l,h,f){let c=Math.abs(+h-+l)/f,_=me(([,,M])=>M).right(o,c);if(_===o.length)return t.every(hi(+l/Qn,+h/Qn,f));if(_===0)return Nn.every(Math.max(hi(+l,+h,f),1));let[g,m]=o[c/o[_-1][2]<o[_][2]/c?_-1:_];return g.every(m)}return[a,s]}var _r=cr(pe,or,rr,er,tr,Bi),gr=cr(ye,ur,ir,nr,Wi,Gi),Ws=_r[0],th=_r[1],nh=gr[0],eh=gr[1],Vn=new Date,Jn=new Date;function Z(t,n,e,i){function u(r){let o=r==null?new Date:new Date(+r);return t(o),o}if(u.floor=(r)=>{let o=new Date(+r);return t(o),o},u.ceil=(r)=>{let o=new Date(+r-1);return t(o),n(o,1),t(o),o},u.round=(r)=>{let o=u(r),a=u.ceil(r);return+r-+o<+a-+r?o:a},u.offset=(r,o)=>{let a=new Date(+r);return n(a,o==null?1:Math.floor(o)),a},u.range=(r,o,a)=>{let s=[],l=u.ceil(r),h=a==null?1:Math.floor(a);if(!(l<new Date(+o))||!(h>0))return s;let f;do f=new Date(+l),s.push(f),n(l,h),t(l);while(f<l&&l<new Date(+o));return s},u.filter=(r)=>{return Z((o)=>{if(o>=o)while(t(o),!r(o))o.setTime(+o-1)},(o,a)=>{if(o>=o)if(a<0)while(++a<=0)while(n(o,-1),!r(o));else while(--a>=0)while(n(o,1),!r(o));})},e)u.count=(r,o)=>{return Vn.setTime(+r),Jn.setTime(+o),t(Vn),t(Jn),Math.floor(e(Vn,Jn))},u.every=(r)=>{return r=Math.floor(r),!isFinite(r)||!(r>0)?null:!(r>1)?u:u.filter(i?(o)=>i(o)%r===0:(o)=>u.count(0,o)%r===0)};return u}var bn=Z(()=>{},(t,n)=>{t.setTime(+t+n)},(t,n)=>{return+n-+t});bn.every=(t)=>{if(t=Math.floor(t),!isFinite(t)||!(t>0))return null;if(!(t>1))return bn;return Z((n)=>{n.setTime(Math.floor(+n/t)*t)},(n,e)=>{n.setTime(+n+e*t)},(n,e)=>{return(+e-+n)/t})};var ih=bn.range,yt=1000,ot=60000,pt=3600000,Xt=86400000,Me=604800000,fi=2592000000,In=31536000000,un=Z((t)=>{t.setTime(+t-t.getMilliseconds())},(t,n)=>{t.setTime(+t+n*yt)},(t,n)=>{return(+n-+t)/yt},(t)=>{return t.getUTCSeconds()}),rh=un.range,yr=Z((t)=>{t.setTime(+t-t.getMilliseconds()-t.getSeconds()*yt)},(t,n)=>{t.setTime(+t+n*ot)},(t,n)=>{return(+n-+t)/ot},(t)=>{return t.getMinutes()}),uh=yr.range,pr=Z((t)=>{t.setUTCSeconds(0,0)},(t,n)=>{t.setTime(+t+n*ot)},(t,n)=>{return(+n-+t)/ot},(t)=>{return t.getUTCMinutes()}),oh=pr.range,mr=Z((t)=>{t.setTime(+t-t.getMilliseconds()-t.getSeconds()*yt-t.getMinutes()*ot)},(t,n)=>{t.setTime(+t+n*pt)},(t,n)=>{return(+n-+t)/pt},(t)=>{return t.getHours()}),ah=mr.range,Mr=Z((t)=>{t.setUTCMinutes(0,0,0)},(t,n)=>{t.setTime(+t+n*pt)},(t,n)=>{return(+n-+t)/pt},(t)=>{return t.getUTCHours()}),lh=Mr.range,Un=Z((t)=>{t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n)},(t,n)=>(+n-+t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ot)/Xt,(t)=>t.getDate()-1),sh=Un.range,xe=Z((t)=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>{return(+n-+t)/Xt},(t)=>{return t.getUTCDate()-1}),hh=xe.range,xr=Z((t)=>{t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n)},(t,n)=>{return(+n-+t)/Xt},(t)=>{return Math.floor(+t/Xt)}),fh=xr.range;function kt(t){return Z((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)=>{return(+e-+n-(e.getTimezoneOffset()-n.getTimezoneOffset())*ot)/Me})}var de=kt(0),$n=kt(1),Ko=kt(2),Go=kt(3),Zt=kt(4),Bo=kt(5),Wo=kt(6),ch=de.range,_h=$n.range,gh=Ko.range,yh=Go.range,ph=Zt.range,mh=Bo.range,Mh=Wo.range;function St(t){return Z((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)=>{return(+e-+n)/Me})}var we=St(0),kn=St(1),ta=St(2),na=St(3),Lt=St(4),ea=St(5),ia=St(6),xh=we.range,dh=kn.range,wh=ta.range,vh=na.range,Th=Lt.range,Nh=ea.range,bh=ia.range,dr=Z((t)=>{t.setDate(1),t.setHours(0,0,0,0)},(t,n)=>{t.setMonth(t.getMonth()+n)},(t,n)=>{return n.getMonth()-t.getMonth()+(n.getFullYear()-t.getFullYear())*12},(t)=>{return t.getMonth()}),$h=dr.range,wr=Z((t)=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)},(t,n)=>{return n.getUTCMonth()-t.getUTCMonth()+(n.getUTCFullYear()-t.getUTCFullYear())*12},(t)=>{return t.getUTCMonth()}),kh=wr.range,mt=Z((t)=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n)},(t,n)=>{return n.getFullYear()-t.getFullYear()},(t)=>{return t.getFullYear()});mt.every=(t)=>{return t=Math.floor(t),!isFinite(t)||!(t>0)?null:Z((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)})};var Sh=mt.range,Mt=Z((t)=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)},(t,n)=>{return n.getUTCFullYear()-t.getUTCFullYear()},(t)=>{return t.getUTCFullYear()});Mt.every=(t)=>{return t=Math.floor(t),!isFinite(t)||!(t>0)?null:Z((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)})};var Ch=Mt.range;function xn(t,n){return t==null||n==null?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function ra(t,n){return t==null||n==null?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function ve(t){let n,e,i;if(t.length!==2)n=xn,e=(a,s)=>xn(t(a),s),i=(a,s)=>t(a)-s;else n=t===xn||t===ra?t:ua,e=t,i=t;function u(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<0)l=f+1;else h=f}while(l<h)}return l}function r(a,s,l=0,h=a.length){if(l<h){if(n(s,s)!==0)return h;do{let f=l+h>>>1;if(e(a[f],s)<=0)l=f+1;else h=f}while(l<h)}return l}function o(a,s,l=0,h=a.length){let f=u(a,s,l,h-1);return f>l&&i(a[f-1],s)>-i(a[f],s)?f-1:f}return{left:u,center:o,right:r}}function ua(){return 0}function oa(t){return t===null?NaN:+t}var vr=ve(xn),Uh=vr.right,Dh=vr.left,Eh=ve(oa).center,Fh=Tr(Nr),Yh=Tr(aa);function Tr(t){return function(n,e,i=e){if(!((e=+e)>=0))throw RangeError("invalid rx");if(!((i=+i)>=0))throw RangeError("invalid ry");let{data:u,width:r,height:o}=n;if(!((r=Math.floor(r))>=0))throw RangeError("invalid width");if(!((o=Math.floor(o!==void 0?o:u.length/r))>=0))throw RangeError("invalid height");if(!r||!o||!e&&!i)return n;let a=e&&t(e),s=i&&t(i),l=u.slice();if(a&&s)Ht(a,l,u,r,o),Ht(a,u,l,r,o),Ht(a,l,u,r,o),Pt(s,u,l,r,o),Pt(s,l,u,r,o),Pt(s,u,l,r,o);else if(a)Ht(a,u,l,r,o),Ht(a,l,u,r,o),Ht(a,u,l,r,o);else if(s)Pt(s,u,l,r,o),Pt(s,l,u,r,o),Pt(s,u,l,r,o);return n}}function Ht(t,n,e,i,u){for(let r=0,o=i*u;r<o;)t(n,e,r,r+=i,1)}function Pt(t,n,e,i,u){for(let r=0,o=i*u;r<i;++r)t(n,e,r,r+o,i)}function aa(t){let n=Nr(t);return(e,i,u,r,o)=>{u<<=2,r<<=2,o<<=2,n(e,i,u+0,r+0,o),n(e,i,u+1,r+1,o),n(e,i,u+2,r+2,o),n(e,i,u+3,r+3,o)}}function Nr(t){let n=Math.floor(t);if(n===t)return la(t);let e=t-n,i=2*t+1;return(u,r,o,a,s)=>{if(!((a-=s)>=o))return;let l=n*r[o],h=s*n,f=h+s;for(let c=o,_=o+h;c<_;c+=s)l+=r[Math.min(a,c)];for(let c=o,_=a;c<=_;c+=s)l+=r[Math.min(a,c+h)],u[c]=(l+e*(r[Math.max(o,c-f)]+r[Math.min(a,c+f)]))/i,l-=r[Math.max(o,c-h)]}}function la(t){let n=2*t+1;return(e,i,u,r,o)=>{if(!((r-=o)>=u))return;let a=t*i[u],s=o*t;for(let l=u,h=u+s;l<h;l+=o)a+=i[Math.min(r,l)];for(let l=u,h=r;l<=h;l+=o)a+=i[Math.min(r,l+s)],e[l]=a/n,a-=i[Math.max(u,l-s)]}}var br=Array.prototype,qh=br.slice,Hh=br.map,sa=Math.sqrt(50),ha=Math.sqrt(10),fa=Math.sqrt(2);function $r(t,n,e){let i=(n-t)/Math.max(0,e),u=Math.floor(Math.log10(i)),r=i/Math.pow(10,u),o=r>=sa?10:r>=ha?5:r>=fa?2:1,a,s,l;if(u<0){if(l=Math.pow(10,-u)/o,a=Math.round(t*l),s=Math.round(n*l),a/l<t)++a;if(s/l>n)--s;l=-l}else{if(l=Math.pow(10,u)*o,a=Math.round(t/l),s=Math.round(n/l),a*l<t)++a;if(s*l>n)--s}if(s<a&&0.5<=e&&e<2)return $r(t,n,e*2);return[a,s,l]}function ci(t,n,e){return n=+n,t=+t,e=+e,$r(t,n,e)[2]}function _i(t,n,e){n=+n,t=+t,e=+e;let i=n<t,u=i?ci(n,t,e):ci(t,n,e);return(i?-1:1)*(u<0?1/-u:u)}function ca(t){return function(n,e=0,i=n.length){let u=i-(e=+e);while(u){let r=t()*u--|0,o=n[u+e];n[u+e]=n[r+e],n[r+e]=o}return n}}var Ph=ca(Math.random);function kr(t,n,e,i,u,r){let o=[[un,1,yt],[un,5,5*yt],[un,15,15*yt],[un,30,30*yt],[r,1,ot],[r,5,5*ot],[r,15,15*ot],[r,30,30*ot],[u,1,pt],[u,3,3*pt],[u,6,6*pt],[u,12,12*pt],[i,1,Xt],[i,2,2*Xt],[e,1,Me],[n,1,fi],[n,3,3*fi],[t,1,In]];function a(l,h,f){let c=h<l;if(c)[l,h]=[h,l];let _=f&&typeof f.range==="function"?f:s(l,h,f),g=_?_.range(l,+h+1):[];return c?g.reverse():g}function s(l,h,f){let c=Math.abs(+h-+l)/f,_=ve(([,,M])=>M).right(o,c);if(_===o.length)return t.every(_i(+l/In,+h/In,f));if(_===0)return bn.every(Math.max(_i(+l,+h,f),1));let[g,m]=o[c/o[_-1][2]<o[_][2]/c?_-1:_];return g.every(m)}return[a,s]}var Sr=kr(Mt,wr,we,xr,Mr,pr),Cr=kr(mt,dr,de,Un,mr,yr),zh=Sr[0],Ah=Sr[1],Rh=Cr[0],Oh=Cr[1];function Kn(t){if(0<=t.y&&t.y<100){let n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Gn(t){if(0<=t.y&&t.y<100){let n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function tn(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function _a(t){let{dateTime:n,date:e,time:i,periods:u,days:r,shortDays:o,months:a,shortMonths:s}=t,l=nn(u),h=en(u),f=nn(r),c=en(r),_=nn(o),g=en(o),m=nn(a),M=en(a),x=nn(s),T=en(s),w={a:nt,A:Q,b:et,B:Y,c:null,d:xi,e:xi,f:Ha,g:Qa,G:Ja,H:Fa,I:Ya,j:qa,L:Ur,m:Pa,M:za,p:A,q:Kt,Q:vi,s:Ti,S:Aa,u:Ra,U:Oa,V:ja,w:Xa,W:Za,x:null,X:null,y:La,Y:Va,Z:Ia,"%":wi},v={a:V,A:st,b:Gt,B:Bt,c:null,d:di,e:di,f:Wa,g:sl,G:fl,H:Ka,I:Ga,j:Ba,L:Er,m:tl,M:nl,p:Wt,q:cn,Q:vi,s:Ti,S:el,u:il,U:rl,V:ul,w:ol,W:al,x:null,X:null,y:ll,Y:hl,Z:cl,"%":wi},$={a:z,A:R,b:O,B:y,c:N,d:mi,e:mi,f:Ca,g:pi,G:yi,H:Mi,I:Mi,j:ba,L:Sa,m:Na,M:$a,p:P,q:Ta,Q:Da,s:Ea,S:ka,u:Ma,U:xa,V:da,w:ma,W:wa,x:k,X:H,y:pi,Y:yi,Z:va,"%":Ua};w.x=S(e,w),w.X=S(i,w),w.c=S(n,w),v.x=S(e,v),v.X=S(i,v),v.c=S(n,v);function S(d,U){return function(D){let p=[],K=-1,q=0,B=d.length,W,wt,ze;if(!(D instanceof Date))D=new Date(+D);while(++K<B)if(d.charCodeAt(K)===37){if(p.push(d.slice(q,K)),(wt=gi[W=d.charAt(++K)])!=null)W=d.charAt(++K);else wt=W==="e"?" ":"0";if(ze=U[W])W=ze(D,wt);p.push(W),q=K+1}return p.push(d.slice(q,K)),p.join("")}}function b(d,U){return function(D){let p=tn(1900,void 0,1),K=F(p,d,D+="",0),q,B;if(K!=D.length)return null;if("Q"in p)return new Date(p.Q);if("s"in p)return new Date(p.s*1000+("L"in p?p.L:0));if(U&&!("Z"in p))p.Z=0;if("p"in p)p.H=p.H%12+p.p*12;if(p.m===void 0)p.m="q"in p?p.q:0;if("V"in p){if(p.V<1||p.V>53)return null;if(!("w"in p))p.w=1;if("Z"in p)q=Gn(tn(p.y,0,1)),B=q.getUTCDay(),q=B>4||B===0?kn.ceil(q):kn(q),q=xe.offset(q,(p.V-1)*7),p.y=q.getUTCFullYear(),p.m=q.getUTCMonth(),p.d=q.getUTCDate()+(p.w+6)%7;else q=Kn(tn(p.y,0,1)),B=q.getDay(),q=B>4||B===0?$n.ceil(q):$n(q),q=Un.offset(q,(p.V-1)*7),p.y=q.getFullYear(),p.m=q.getMonth(),p.d=q.getDate()+(p.w+6)%7}else if("W"in p||"U"in p){if(!("w"in p))p.w="u"in p?p.u%7:("W"in p)?1:0;B="Z"in p?Gn(tn(p.y,0,1)).getUTCDay():Kn(tn(p.y,0,1)).getDay(),p.m=0,p.d="W"in p?(p.w+6)%7+p.W*7-(B+5)%7:p.w+p.U*7-(B+6)%7}if("Z"in p)return p.H+=p.Z/100|0,p.M+=p.Z%100,Gn(p);return Kn(p)}}function F(d,U,D,p){let K=0,q=U.length,B=D.length,W,wt;while(K<q){if(p>=B)return-1;if(W=U.charCodeAt(K++),W===37){if(W=U.charAt(K++),wt=$[W in gi?U.charAt(K++):W],!wt||(p=wt(d,D,p))<0)return-1}else if(W!=D.charCodeAt(p++))return-1}return p}function P(d,U,D){let p=l.exec(U.slice(D));return p?(d.p=h.get(p[0].toLowerCase()),D+p[0].length):-1}function z(d,U,D){let p=_.exec(U.slice(D));return p?(d.w=g.get(p[0].toLowerCase()),D+p[0].length):-1}function R(d,U,D){let p=f.exec(U.slice(D));return p?(d.w=c.get(p[0].toLowerCase()),D+p[0].length):-1}function O(d,U,D){let p=x.exec(U.slice(D));return p?(d.m=T.get(p[0].toLowerCase()),D+p[0].length):-1}function y(d,U,D){let p=m.exec(U.slice(D));return p?(d.m=M.get(p[0].toLowerCase()),D+p[0].length):-1}function N(d,U,D){return F(d,n,U,D)}function k(d,U,D){return F(d,e,U,D)}function H(d,U,D){return F(d,i,U,D)}function nt(d){return o[d.getDay()]}function Q(d){return r[d.getDay()]}function et(d){return s[d.getMonth()]}function Y(d){return a[d.getMonth()]}function A(d){return u[+(d.getHours()>=12)]}function Kt(d){return 1+~~(d.getMonth()/3)}function V(d){return o[d.getUTCDay()]}function st(d){return r[d.getUTCDay()]}function Gt(d){return s[d.getUTCMonth()]}function Bt(d){return a[d.getUTCMonth()]}function Wt(d){return u[+(d.getUTCHours()>=12)]}function cn(d){return 1+~~(d.getUTCMonth()/3)}return{format(d){let U=S(d+="",w);return Object.assign(U,{toString(){return d}})},parse(d){let U=b(d+="",!1);return Object.assign(U,{toString(){return d}})},utcFormat(d){let U=S(d+="",v);return Object.assign(U,{toString(){return d}})},utcParse(d){let U=b(d+="",!0);return Object.assign(U,{toString(){return d}})}}}var gi={"-":"",_:" ","0":"0"},L=/^\s*\d+/,ga=/^%/,ya=/[\\^$*+?|[\]().{}]/g;function E(t,n,e){let i=t<0?"-":"",u=`${i?-t:t}`,r=u.length;return i+(r<e?Array(e-r+1).join(n)+u:u)}function pa(t){return t.replace(ya,"\\$&")}function nn(t){return new RegExp(`^(?:${t.map(pa).join("|")})`,"i")}function en(t){return new Map(t.map((n,e)=>[n.toLowerCase(),e]))}function ma(t,n,e){let i=L.exec(n.slice(e,e+1));return i?(t.w=+i[0],e+i[0].length):-1}function Ma(t,n,e){let i=L.exec(n.slice(e,e+1));return i?(t.u=+i[0],e+i[0].length):-1}function xa(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.U=+i[0],e+i[0].length):-1}function da(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.V=+i[0],e+i[0].length):-1}function wa(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.W=+i[0],e+i[0].length):-1}function yi(t,n,e){let i=L.exec(n.slice(e,e+4));return i?(t.y=+i[0],e+i[0].length):-1}function pi(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2000),e+i[0].length):-1}function va(t,n,e){let i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return i?(t.Z=i[1]?0:-+(i[2]+(i[3]||"00")),e+i[0].length):-1}function Ta(t,n,e){let i=L.exec(n.slice(e,e+1));return i?(t.q=+i[0]*3-3,e+i[0].length):-1}function Na(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.m=+i[0]-1,e+i[0].length):-1}function mi(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.d=+i[0],e+i[0].length):-1}function ba(t,n,e){let i=L.exec(n.slice(e,e+3));return i?(t.m=0,t.d=+i[0],e+i[0].length):-1}function Mi(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.H=+i[0],e+i[0].length):-1}function $a(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.M=+i[0],e+i[0].length):-1}function ka(t,n,e){let i=L.exec(n.slice(e,e+2));return i?(t.S=+i[0],e+i[0].length):-1}function Sa(t,n,e){let i=L.exec(n.slice(e,e+3));return i?(t.L=+i[0],e+i[0].length):-1}function Ca(t,n,e){let i=L.exec(n.slice(e,e+6));return i?(t.L=Math.floor(+i[0]/1000),e+i[0].length):-1}function Ua(t,n,e){let i=ga.exec(n.slice(e,e+1));return i?e+i[0].length:-1}function Da(t,n,e){let i=L.exec(n.slice(e));return i?(t.Q=+i[0],e+i[0].length):-1}function Ea(t,n,e){let i=L.exec(n.slice(e));return i?(t.s=+i[0],e+i[0].length):-1}function xi(t,n){return E(t.getDate(),n,2)}function Fa(t,n){return E(t.getHours(),n,2)}function Ya(t,n){return E(t.getHours()%12||12,n,2)}function qa(t,n){return E(1+Un.count(mt(t),t),n,3)}function Ur(t,n){return E(t.getMilliseconds(),n,3)}function Ha(t,n){return`${Ur(t,n)}000`}function Pa(t,n){return E(t.getMonth()+1,n,2)}function za(t,n){return E(t.getMinutes(),n,2)}function Aa(t,n){return E(t.getSeconds(),n,2)}function Ra(t){let n=t.getDay();return n===0?7:n}function Oa(t,n){return E(de.count(mt(t).getTime()-1,t),n,2)}function Dr(t){let n=t.getDay();return n>=4||n===0?Zt(t):Zt.ceil(t)}function ja(t,n){return t=Dr(t),E(Zt.count(mt(t),t)+(mt(t).getDay()===4?1:0),n,2)}function Xa(t){return t.getDay()}function Za(t,n){return E($n.count(mt(t).getTime()-1,t),n,2)}function La(t,n){return E(t.getFullYear()%100,n,2)}function Qa(t,n){return t=Dr(t),E(t.getFullYear()%100,n,2)}function Va(t,n){return E(t.getFullYear()%1e4,n,4)}function Ja(t,n){let e=t.getDay();return t=e>=4||e===0?Zt(t):Zt.ceil(t),E(t.getFullYear()%1e4,n,4)}function Ia(t){let n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+E(n/60|0,"0",2)+E(n%60,"0",2)}function di(t,n){return E(t.getUTCDate(),n,2)}function Ka(t,n){return E(t.getUTCHours(),n,2)}function Ga(t,n){return E(t.getUTCHours()%12||12,n,2)}function Ba(t,n){return E(1+xe.count(Mt(t),t),n,3)}function Er(t,n){return E(t.getUTCMilliseconds(),n,3)}function Wa(t,n){return`${Er(t,n)}000`}function tl(t,n){return E(t.getUTCMonth()+1,n,2)}function nl(t,n){return E(t.getUTCMinutes(),n,2)}function el(t,n){return E(t.getUTCSeconds(),n,2)}function il(t){let n=t.getUTCDay();return n===0?7:n}function rl(t,n){return E(we.count(Mt(t).getTime()-1,t),n,2)}function Fr(t){let n=t.getUTCDay();return n>=4||n===0?Lt(t):Lt.ceil(t)}function ul(t,n){return t=Fr(t),E(Lt.count(Mt(t),t)+(Mt(t).getUTCDay()===4?1:0),n,2)}function ol(t){return t.getUTCDay()}function al(t,n){return E(kn.count(Mt(t).getTime()-1,t),n,2)}function ll(t,n){return E(t.getUTCFullYear()%100,n,2)}function sl(t,n){return t=Fr(t),E(t.getUTCFullYear()%100,n,2)}function hl(t,n){return E(t.getUTCFullYear()%1e4,n,4)}function fl(t,n){let e=t.getUTCDay();return t=e>=4||e===0?Lt(t):Lt.ceil(t),E(t.getUTCFullYear()%1e4,n,4)}function cl(){return"+0000"}function wi(){return"%"}function vi(t){return+t}function Ti(t){return Math.floor(+t/1000)}var zt,_l,gl,Yr,qr;yl({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 yl(t){return zt=_a(t),_l=zt.format,gl=zt.parse,Yr=zt.utcFormat,qr=zt.utcParse,zt}var Hr="%Y-%m-%dT%H:%M:%S.%LZ";function pl(t){return t.toISOString()}var jh=typeof Date.prototype.toISOString==="function"?pl:Yr(Hr);function ml(t){let n=new Date(t);return isNaN(+n)?null:n}var Xh=+new Date("2000-01-01T00:00:00.000Z")?ml:qr(Hr);function C(t){return function(){return t}}var{abs:Pr,atan2:J,cos:xt,max:Ml,min:Te,sin:tt,sqrt:it}=Math,I=0.000000000001,Ct=Math.PI,En=Ct/2,Vt=2*Ct;function xl(t){return t>1?0:t<-1?Ct:Math.acos(t)}function zr(t){return t>=1?En:t<=-1?-En:Math.asin(t)}var be=Math.PI,$e=2*be,dl=$e-0.000001;function Xr(t,...n){this._+=t[0];for(let e=1,i=t.length;e<i;++e)this._+=n[e-1]+t[e]}function wl(t){let n=Math.floor(t);if(!(n>=0))throw Error(`invalid digits: ${t}`);if(n>15)return Xr;let e=10**n;return function(i,...u){this._+=i[0];for(let r=1,o=i.length;r<o;++r)this._+=Math.round(u[r-1]*e)/e+i[r]}}class Fn{_x0;_y0;_x1;_y1;_;_append;constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Xr:wl(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){if(this._x1!==null)this._x1=this._x0,this._y1=this._y0,this._append`Z`}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,i){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+i}`}bezierCurveTo(t,n,e,i,u,r){this._append`C${+t},${+n},${+e},${+i},${this._x1=+u},${this._y1=+r}`}arcTo(t,n,e,i,u){if(t=+t,n=+n,e=+e,i=+i,u=+u,u<0)throw Error(`negative radius: ${u}`);let r=this._x1,o=this._y1,a=e-t,s=i-n,l=r-t,h=o-n,f=l*l+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(!(f>0.000001));else if(!(Math.abs(h*a-s*l)>0.000001)||!u)this._append`L${this._x1=t},${this._y1=n}`;else{let c=e-r,_=i-o,g=a*a+s*s,m=c*c+_*_,M=Math.sqrt(g),x=Math.sqrt(f),T=u*Math.tan((be-Math.acos((g+f-m)/(2*M*x)))/2),w=T/x,v=T/M;if(Math.abs(w-1)>0.000001)this._append`L${t+w*l},${n+w*h}`;this._append`A${u},${u},0,0,${+(h*c>l*_)},${this._x1=t+v*a},${this._y1=n+v*s}`}}arc(t,n,e,i,u,r){if(t=+t,n=+n,e=+e,r=!!r,e<0)throw Error(`negative radius: ${e}`);let o=e*Math.cos(i),a=e*Math.sin(i),s=t+o,l=n+a,h=1^r,f=r?i-u:u-i;if(this._x1===null)this._append`M${s},${l}`;else if(Math.abs(this._x1-s)>0.000001||Math.abs(this._y1-l)>0.000001)this._append`L${s},${l}`;if(!e)return;if(f<0)f=f%$e+$e;if(f>dl)this._append`A${e},${e},0,1,${h},${t-o},${n-a}A${e},${e},0,1,${h},${this._x1=s},${this._y1=l}`;else if(f>0.000001)this._append`A${e},${e},0,${+(f>=be)},${h},${this._x1=t+e*Math.cos(u)},${this._y1=n+e*Math.sin(u)}`}rect(t,n,e,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+i}h${-e}Z`}toString(){return this._}}function vl(){return new Fn}Object.defineProperty(vl,Symbol.hasInstance,{value:(t)=>t instanceof Fn});function ke(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let i=Math.floor(e);if(!(i>=0))throw RangeError(`invalid digits: ${e}`);n=i}return t},()=>new Fn(n)}function Tl(t){return t.innerRadius}function Nl(t){return t.outerRadius}function bl(t){return t.startAngle}function $l(t){return t.endAngle}function kl(t){return t&&t.padAngle}function Sl(t,n,e,i,u,r,o,a){let s=e-t,l=i-n,h=o-u,f=a-r,c=f*s-h*l;if(c*c<I)return;return c=(h*(n-r)-f*(t-u))/c,[t+c*s,n+c*l]}function Dn(t,n,e,i,u,r,o){let a=t-e,s=n-i,l=(o?r:-r)/it(a*a+s*s),h=l*s,f=-l*a,c=t+h,_=n+f,g=e+h,m=i+f,M=(c+g)/2,x=(_+m)/2,T=g-c,w=m-_,v=T*T+w*w,$=u-r,S=c*m-g*_,b=(w<0?-1:1)*it(Ml(0,$*$*v-S*S)),F=(S*w-T*b)/v,P=(-S*T-w*b)/v,z=(S*w+T*b)/v,R=(-S*T+w*b)/v,O=F-M,y=P-x,N=z-M,k=R-x;if(O*O+y*y>N*N+k*k)F=z,P=R;return{cx:F,cy:P,x01:-h,y01:-f,x11:F*(u/$-1),y11:P*(u/$-1)}}function Zr(){let t=Tl,n=Nl,e=C(0),i=null,u=bl,r=$l,o=kl,a=null,s=ke(l);function l(){let h,f,c=+t.apply(this,arguments),_=+n.apply(this,arguments),g=u.apply(this,arguments)-En,m=r.apply(this,arguments)-En,M=Pr(m-g),x=m>g;if(!a)a=h=s();if(_<c)f=_,_=c,c=f;if(!(_>I))a.moveTo(0,0);else if(M>Vt-I){if(a.moveTo(_*xt(g),_*tt(g)),a.arc(0,0,_,g,m,!x),c>I)a.moveTo(c*xt(m),c*tt(m)),a.arc(0,0,c,m,g,x)}else{let T=g,w=m,v=g,$=m,S=M,b=M,F=o.apply(this,arguments)/2,P=F>I?i?+i.apply(this,arguments):it(c*c+_*_):0,z=Te(Pr(_-c)/2,+e.apply(this,arguments)),R=z,O=z,y,N;if(P>I){let V=zr(P/c*tt(F)),st=zr(P/_*tt(F));if((S-=V*2)>I)V*=x?1:-1,v+=V,$-=V;else S=0,v=$=(g+m)/2;if((b-=st*2)>I)st*=x?1:-1,T+=st,w-=st;else b=0,T=w=(g+m)/2}let k=_*xt(T),H=_*tt(T),nt=c*xt($),Q=c*tt($),et=_*xt(w),Y=_*tt(w),A=c*xt(v),Kt=c*tt(v);if(z>I){let V;if(M<Ct)if(V=Sl(k,H,A,Kt,et,Y,nt,Q)){let st=k-V[0],Gt=H-V[1],Bt=et-V[0],Wt=Y-V[1],cn=1/tt(xl((st*Bt+Gt*Wt)/(it(st*st+Gt*Gt)*it(Bt*Bt+Wt*Wt)))/2),d=it(V[0]*V[0]+V[1]*V[1]);R=Te(z,(c-d)/(cn-1)),O=Te(z,(_-d)/(cn+1))}else R=O=0}if(!(b>I))a.moveTo(k,H);else if(O>I)if(y=Dn(A,Kt,k,H,_,O,x),N=Dn(et,Y,nt,Q,_,O,x),a.moveTo(y.cx+y.x01,y.cy+y.y01),O<z)a.arc(y.cx,y.cy,O,J(y.y01,y.x01),J(N.y01,N.x01),!x);else a.arc(y.cx,y.cy,O,J(y.y01,y.x01),J(y.y11,y.x11),!x),a.arc(0,0,_,J(y.cy+y.y11,y.cx+y.x11),J(N.cy+N.y11,N.cx+N.x11),!x),a.arc(N.cx,N.cy,O,J(N.y11,N.x11),J(N.y01,N.x01),!x);else a.moveTo(k,H),a.arc(0,0,_,T,w,!x);if(!(c>I)||!(S>I))a.lineTo(nt,Q);else if(R>I)if(y=Dn(nt,Q,et,Y,c,-R,x),N=Dn(k,H,A,Kt,c,-R,x),a.lineTo(y.cx+y.x01,y.cy+y.y01),R<z)a.arc(y.cx,y.cy,R,J(y.y01,y.x01),J(N.y01,N.x01),!x);else a.arc(y.cx,y.cy,R,J(y.y01,y.x01),J(y.y11,y.x11),!x),a.arc(0,0,c,J(y.cy+y.y11,y.cx+y.x11),J(N.cy+N.y11,N.cx+N.x11),x),a.arc(N.cx,N.cy,R,J(N.y11,N.x11),J(N.y01,N.x01),!x);else a.arc(0,0,c,$,v,x)}if(a.closePath(),h)return a=null,h+""||null}return l.centroid=function(){let h=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,f=(+u.apply(this,arguments)+ +r.apply(this,arguments))/2-Ct/2;return[xt(f)*h,tt(f)*h]},l.innerRadius=function(h){return arguments.length?(t=typeof h==="function"?h:C(+h),l):t},l.outerRadius=function(h){return arguments.length?(n=typeof h==="function"?h:C(+h),l):n},l.cornerRadius=function(h){return arguments.length?(e=typeof h==="function"?h:C(+h),l):e},l.padRadius=function(h){return arguments.length?(i=h==null?null:typeof h==="function"?h:C(+h),l):i},l.startAngle=function(h){return arguments.length?(u=typeof h==="function"?h:C(+h),l):u},l.endAngle=function(h){return arguments.length?(r=typeof h==="function"?h:C(+h),l):r},l.padAngle=function(h){return arguments.length?(o=typeof h==="function"?h:C(+h),l):o},l.context=function(h){return arguments.length?(a=h==null?null:h,l):a},l}var Lh=Array.prototype.slice;function Se(t){return typeof t==="object"&&"length"in t?t:Array.from(t)}function Lr(t){this._context=t}Lr.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._point=0},lineEnd(){if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point(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,this._context.lineTo(t,n);break;default:this._context.lineTo(t,n);break}}};function sn(t){return new Lr(t)}function Qr(t){return t[0]}function Vr(t){return t[1]}function Ce(t,n){let e=C(!0),i=null,u=sn,r=null,o=ke(a);t=typeof t==="function"?t:t===void 0?Qr:C(t),n=typeof n==="function"?n:n===void 0?Vr:C(n);function a(s){let l,h=(s=Se(s)).length,f,c=!1,_;if(i==null)r=u(_=o());for(l=0;l<=h;++l){if(!(l<h&&e(f=s[l],l,s))===c)if(c=!c)r.lineStart();else r.lineEnd();if(c)r.point(+t(f,l,s),+n(f,l,s))}if(_)return r=null,_+""||null}return a.x=function(s){return arguments.length?(t=typeof s==="function"?s:C(+s),a):t},a.y=function(s){return arguments.length?(n=typeof s==="function"?s:C(+s),a):n},a.defined=function(s){return arguments.length?(e=typeof s==="function"?s:C(!!s),a):e},a.curve=function(s){return arguments.length?(u=s,i!=null&&(r=u(i)),a):u},a.context=function(s){return arguments.length?(s==null?i=r=null:r=u(i=s),a):i},a}function Jr(t,n,e){let i=null,u=C(!0),r=null,o=sn,a=null,s=ke(l);t=typeof t==="function"?t:t===void 0?Qr:C(+t),n=typeof n==="function"?n:n===void 0?C(0):C(+n),e=typeof e==="function"?e:e===void 0?Vr:C(+e);function l(f){let c,_=0,g,m=(f=Se(f)).length,M,x=!1,T,w=Array(m),v=Array(m);if(r==null)a=o(T=s());for(c=0;c<=m;++c){if(!(c<m&&u(M=f[c],c,f))===x)if(x=!x)_=c,a.areaStart(),a.lineStart();else{a.lineEnd(),a.lineStart();for(g=c-1;g>=_;--g)a.point(w[g],v[g]);a.lineEnd(),a.areaEnd()}if(x)w[c]=+t(M,c,f),v[c]=+n(M,c,f),a.point(i?+i(M,c,f):w[c],e?+e(M,c,f):v[c])}if(T)return a=null,`${T}`||null}function h(){return Ce().defined(u).curve(o).context(r)}return l.x=function(f){return arguments.length?(t=typeof f==="function"?f:C(+f),i=null,l):t},l.x0=function(f){return arguments.length?(t=typeof f==="function"?f:C(+f),l):t},l.x1=function(f){return arguments.length?(i=f==null?null:typeof f==="function"?f:C(+f),l):i},l.y=function(f){return arguments.length?(n=typeof f==="function"?f:C(+f),e=null,l):n},l.y0=function(f){return arguments.length?(n=typeof f==="function"?f:C(+f),l):n},l.y1=function(f){return arguments.length?(e=f==null?null:typeof f==="function"?f:C(+f),l):e},l.lineX0=l.lineY0=function(){return h().x(t).y(n)},l.lineY1=function(){return h().x(t).y(e)},l.lineX1=function(){return h().x(i).y(n)},l.defined=function(f){return arguments.length?(u=typeof f==="function"?f:C(!!f),l):u},l.curve=function(f){return arguments.length?(o=f,r!=null&&(a=o(r)),l):o},l.context=function(f){return arguments.length?(f==null?r=a=null:a=o(r=f),l):r},l}function Cl(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function Ul(t){return t}function Ir(){let t=Ul,n=Cl,e=null,i=C(0),u=C(Vt),r=C(0);function o(a){let s,l=(a=Se(a)).length,h,f,c=0,_=Array(l),g=Array(l),m=+i.apply(this,arguments),M=Math.min(Vt,Math.max(-Vt,u.apply(this,arguments)-m)),x,T=Math.min(Math.abs(M)/l,r.apply(this,arguments)),w=T*(M<0?-1:1),v;for(s=0;s<l;++s)if((v=g[_[s]=s]=+t(a[s],s,a))>0)c+=v;if(n!=null)_.sort(function($,S){return n(g[$],g[S])});else if(e!=null)_.sort(function($,S){return e(a[$],a[S])});for(s=0,f=c?(M-l*w)/c:0;s<l;++s,m=x)h=_[s],v=g[h],x=m+(v>0?v*f:0)+w,g[h]={data:a[h],index:s,value:v,startAngle:m,endAngle:x,padAngle:T};return g}return o.value=function(a){return arguments.length?(t=typeof a==="function"?a:C(+a),o):t},o.sortValues=function(a){return arguments.length?(n=a,e=null,o):n},o.sort=function(a){return arguments.length?(e=a,n=null,o):e},o.startAngle=function(a){return arguments.length?(i=typeof a==="function"?a:C(+a),o):i},o.endAngle=function(a){return arguments.length?(u=typeof a==="function"?a:C(+a),o):u},o.padAngle=function(a){return arguments.length?(r=typeof a==="function"?a:C(+a),o):r},o}function Kr(t){this._curve=t}Kr.prototype={areaStart(){this._curve.areaStart()},areaEnd(){this._curve.areaEnd()},lineStart(){this._curve.lineStart()},lineEnd(){this._curve.lineEnd()},point(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};function Dl(t){function n(e){return new Kr(t(e))}return n._curve=t,n}var Qh=Dl(sn);var Vh=it(3);var El=it(0.3333333333333333),Jh=El*2;var Gr=tt(Ct/10)/tt(7*Ct/10),Ih=tt(Vt/10)*Gr,Kh=-xt(Vt/10)*Gr;var Gh=it(3);var Bh=it(3);var Wh=it(3)/2,Fl=1/it(12),t0=(Fl/2+1)*3;function dt(){}function Jt(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Ue(t){this._context=t}Ue.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd(){switch(this._point){case 3:Jt(this,this._x1,this._y1),this._context.lineTo(this._x1,this._y1);break;case 2:this._context.lineTo(this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point(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;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6),Jt(this,t,n);break;default:Jt(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};function Yl(t){this._context=t}Yl.prototype={areaStart:dt,areaEnd:dt,lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Jt(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};function ql(t){this._context=t}ql.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;{let e=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,i):this._context.moveTo(e,i);break}case 3:this._point=4,Jt(this,t,n);break;default:Jt(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};function Br(t,n){this._basis=new Ue(t),this._beta=n}Br.prototype={lineStart(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd(){let t=this._x,n=this._y,e=t.length-1;if(e>0){let i=t[0],u=n[0],r=t[e]-i,o=n[e]-u,a=-1,s;while(++a<=e)s=a/e,this._basis.point(this._beta*t[a]+(1-this._beta)*(i+s*r),this._beta*n[a]+(1-this._beta)*(u+s*o))}this._x=this._y=null,this._basis.lineEnd()},point(t,n){this._x.push(+t),this._y.push(+n)}};var n0=function t(n){function e(i){return n===1?new Ue(i):new Br(i,n)}return e.beta=function(i){return t(+i)},e}(0.85);function It(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function De(t,n){this._context=t,this._k=(1-n)/6}De.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:It(this,this._x1,this._y1);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point(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,this._x1=t,this._y1=n;break;case 2:this._point=3,It(this,t,n);break;default:It(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var e0=function t(n){function e(i){return new De(i,n)}return e.tension=function(i){return t(+i)},e}(0);function Ee(t,n){this._context=t,this._k=(1-n)/6}Ee.prototype={areaStart:dt,areaEnd:dt,lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:It(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var i0=function t(n){function e(i){return new Ee(i,n)}return e.tension=function(i){return t(+i)},e}(0);function Fe(t,n){this._context=t,this._k=(1-n)/6}Fe.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4,It(this,t,n);break;default:It(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var r0=function t(n){function e(i){return new Fe(i,n)}return e.tension=function(i){return t(+i)},e}(0);function ln(t,n,e){let{_x1:i,_y1:u,_x2:r,_y2:o}=t;if(t._l01_a>I){let a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,u=(u*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>I){let a=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);r=(r*a+t._x1*t._l23_2a-n*t._l12_2a)/s,o=(o*a+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(i,u,r,o,t._x2,t._y2)}function Wr(t,n){this._context=t,this._alpha=n}Wr.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point(t,n){if(t=+t,n=+n,this._point){let e=this._x2-t,i=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,ln(this,t,n);break;default:ln(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var u0=function t(n){function e(i){return n?new Wr(i,n):new De(i,0)}return e.alpha=function(i){return t(+i)},e}(0.5);function tu(t,n){this._context=t,this._alpha=n}tu.prototype={areaStart:dt,areaEnd:dt,lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point(t,n){if(t=+t,n=+n,this._point){let e=this._x2-t,i=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:ln(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var o0=function t(n){function e(i){return n?new tu(i,n):new Ee(i,0)}return e.alpha=function(i){return t(+i)},e}(0.5);function nu(t,n){this._context=t,this._alpha=n}nu.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd(){if(this._line||this._line!==0&&this._point===3)this._context.closePath();this._line=1-this._line},point(t,n){if(t=+t,n=+n,this._point){let e=this._x2-t,i=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4,ln(this,t,n);break;default:ln(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var a0=function t(n){function e(i){return n?new nu(i,n):new Fe(i,0)}return e.alpha=function(i){return t(+i)},e}(0.5);function Hl(t){this._context=t}Hl.prototype={areaStart:dt,areaEnd:dt,lineStart(){this._point=0},lineEnd(){if(this._point)this._context.closePath()},point(t,n){if(t=+t,n=+n,this._point)this._context.lineTo(t,n);else this._point=1,this._context.moveTo(t,n)}};function Ar(t){return t<0?-1:1}function Rr(t,n,e){let i=t._x1-t._x0,u=n-t._x1,r=(t._y1-t._y0)/(i||(u<0?-0:0)),o=(e-t._y1)/(u||(i<0?-0:0)),a=(r*u+o*i)/(i+u);return(Ar(r)+Ar(o))*Math.min(Math.abs(r),Math.abs(o),0.5*Math.abs(a))||0}function Or(t,n){let e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Ne(t,n,e){let{_x0:i,_y0:u,_x1:r,_y1:o}=t,a=(r-i)/3;t._context.bezierCurveTo(i+a,u+a*n,r-a,o-a*e,r,o)}function Yn(t){this._context=t}Yn.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ne(this,this._t0,Or(this,this._t0));break}if(this._line||this._line!==0&&this._point===1)this._context.closePath();this._line=1-this._line},point(t,n){let e=NaN;if(t=+t,n=+n,t===this._x1&&n===this._y1)return;switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Ne(this,Or(this,e=Rr(this,t,n)),e);break;default:Ne(this,this._t0,e=Rr(this,t,n));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}};function eu(t){this._context=new iu(t)}eu.prototype=Object.create(Yn.prototype);eu.prototype.point=function(t,n){Yn.prototype.point.call(this,n,t)};function iu(t){this._context=t}iu.prototype={moveTo(t,n){this._context.moveTo(n,t)},closePath(){this._context.closePath()},lineTo(t,n){this._context.lineTo(n,t)},bezierCurveTo(t,n,e,i,u,r){this._context.bezierCurveTo(n,t,i,e,r,u)}};function ru(t){return new Yn(t)}function Pl(t){this._context=t}Pl.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x=[],this._y=[]},lineEnd(){let t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),e===2)this._context.lineTo(t[1],n[1]);else{let i=jr(t),u=jr(n);for(let r=0,o=1;o<e;++r,++o)this._context.bezierCurveTo(i[0][r],u[0][r],i[1][r],u[1][r],t[o],n[o])}if(this._line||this._line!==0&&e===1)this._context.closePath();this._line=1-this._line,this._x=this._y=null},point(t,n){this._x.push(+t),this._y.push(+n)}};function jr(t){let n,e=t.length-1,i,u=Array(e),r=Array(e),o=Array(e);u[0]=0,r[0]=2,o[0]=t[0]+2*t[1];for(n=1;n<e-1;++n)u[n]=1,r[n]=4,o[n]=4*t[n]+2*t[n+1];u[e-1]=2,r[e-1]=7,o[e-1]=8*t[e-1]+t[e];for(n=1;n<e;++n)i=u[n]/r[n-1],r[n]-=i,o[n]-=i*o[n-1];u[e-1]=o[e-1]/r[e-1];for(n=e-2;n>=0;--n)u[n]=(o[n]-u[n+1])/r[n];r[e-1]=(t[e]+u[e-1])/2;for(n=0;n<e-1;++n)r[n]=2*t[n+1]-u[n+1];return[u,r]}function zl(t,n){this._context=t,this._t=n}zl.prototype={areaStart(){this._line=0},areaEnd(){this._line=NaN},lineStart(){this._x=this._y=NaN,this._point=0},lineEnd(){if(0<this._t&&this._t<1&&this._point===2)this._context.lineTo(this._x,this._y);if(this._line||this._line!==0&&this._point===1)this._context.closePath();if(this._line>=0)this._t=1-this._t,this._line=1-this._line},point(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:{if(this._point=2,this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{let e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}break}default:{if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{let e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}break}}this._x=t,this._y=n}};var qn=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function lt(t){return qn[t%qn.length]??qn[0]}function Ye(t,n){if(t.startsWith("#")){let e=t.slice(1),i=Number.parseInt(e.slice(0,2),16),u=Number.parseInt(e.slice(2,4),16),r=Number.parseInt(e.slice(4,6),16);return`rgba(${i}, ${u}, ${r}, ${n})`}if(t.startsWith("rgb("))return t.replace("rgb(","rgba(").replace(")",`, ${n})`);return t}function Al(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Pn(t,n){if(!isFinite(t)||t===0)return null;let e=n?t.toExponential(n-1):t.toExponential(),i=e.indexOf("e"),u=e.slice(0,i);return[u.length>1?u[0]+u.slice(2):u,+e.slice(i+1)]}function Rl(t){let n=Pn(Math.abs(t));return n?n[1]:NaN}function Ol(t,n){return function(e,i){let u=e.length,r=[],o=0,a=t[0],s=0;while(u>0&&a>0){if(s+a+1>i)a=Math.max(1,i-s);if(r.push(e.substring(u-=a,u+a)),(s+=a+1)>i)break;a=t[o=(o+1)%t.length]}return r.reverse().join(n)}}function jl(t){return function(n){return n.replace(/[0-9]/g,function(e){return t[+e]})}}var Xl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;class qe{fill;align;sign;symbol;zero;width;comma;precision;trim;type;constructor(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}`}toString(){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 fu(t){let n=Xl.exec(t);if(!n)throw Error(`invalid format: ${t}`);return new qe({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]})}fu.prototype=qe.prototype;var Zl=fu,uu=Zl;function Ll(t){let n=-1,e=0;t:for(let i=t.length,u=1;u<i;++u)switch(t[u]){case".":n=e=u;break;case"0":if(n===0)n=u;e=u;break;default:if(!+t[u])break t;if(n>0)n=0;break}return n>0?t.slice(0,n)+t.slice(e+1):t}var hn;function Ql(t,n){let e=Pn(t,n);if(!e)return hn=void 0,t.toPrecision(n);let i=e[0],u=e[1];hn=Math.max(-8,Math.min(8,Math.floor(u/3)))*3;let r=u-hn+1,o=i.length;return r===o?i:r>o?`${i}${Array(r-o+1).join("0")}`:r>0?`${i.slice(0,r)}.${i.slice(r)}`:`0.${Array(1-r).join("0")}${Pn(t,Math.max(0,n+r-1))[0]}`}function ou(t,n){let e=Pn(t,n);if(!e)return`${t}`;let i=e[0],u=e[1];return u<0?`0.${Array(-u).join("0")}${i}`:i.length>u+1?`${i.slice(0,u+1)}.${i.slice(u+1)}`:`${i}${Array(u-i.length+2).join("0")}`}var Vl={"%":(t,n)=>(t*100).toFixed(n),b:(t)=>Math.round(t).toString(2),c:(t)=>`${t}`,d:Al,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)=>ou(t*100,n),r:ou,s:Ql,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)},au=Vl;function lu(t){return t}var su=Array.prototype.map,hu=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Jl(t){let n=t.grouping===void 0||t.thousands===void 0?lu:Ol(su.call(t.grouping,Number),`${t.thousands}`),e=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",u=t.decimal===void 0?".":`${t.decimal}`,r=t.numerals===void 0?lu:jl(su.call(t.numerals,String)),o=t.percent===void 0?"%":`${t.percent}`,a=t.minus===void 0?"\u2212":`${t.minus}`,s=t.nan===void 0?"NaN":`${t.nan}`;function l(f,c){let _=uu(f),g=_.fill,m=_.align,M=_.sign,x=_.symbol,T=_.zero,w=_.width,v=_.comma,$=_.precision,S=_.trim,b=_.type;if(b==="n")v=!0,b="g";else if(!au[b]){if($===void 0)$=12;S=!0,b="g"}if(T||g==="0"&&m==="=")T=!0,g="0",m="=";let F=(c&&c.prefix!==void 0?c.prefix:"")+(x==="$"?e:x==="#"&&/[boxX]/.test(b)?`0${b.toLowerCase()}`:""),P=(x==="$"?i:/[%p]/.test(b)?o:"")+(c&&c.suffix!==void 0?c.suffix:""),z=au[b],R=/[defgprs%]/.test(b);$=$===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,$)):Math.max(0,Math.min(20,$));function O(y){let N=F,k=P,H,nt,Q;if(b==="c")k=z(y)+k,y="";else{y=+y;let A=y<0||1/y<0;if(y=isNaN(y)?s:z(Math.abs(y),$),S)y=Ll(y);if(A&&+y===0&&M!=="+")A=!1;if(N=(A?M==="("?M:a:M==="-"||M==="("?"":M)+N,k=(b==="s"&&!isNaN(y)&&hn!==void 0?hu[8+hn/3]:"")+k+(A&&M==="("?")":""),R){H=-1,nt=y.length;while(++H<nt)if(Q=y.charCodeAt(H),48>Q||Q>57){k=(Q===46?u+y.slice(H+1):y.slice(H))+k,y=y.slice(0,H);break}}}if(v&&!T)y=n(y,1/0);let et=N.length+y.length+k.length,Y=et<(w??0)?Array((w??0)-et+1).join(g):"";if(v&&T)y=n(Y+y,Y.length?(w??0)-k.length:1/0),Y="";switch(m){case"<":y=N+y+k+Y;break;case"=":y=N+Y+y+k;break;case"^":{let A=Y.length>>1;y=Y.slice(0,A)+N+y+k+Y.slice(A);break}default:y=Y+N+y+k;break}return r(y)}return O.toString=function(){return`${_}`},O}function h(f,c){let _=uu(f);_.type="f";let g=Math.max(-8,Math.min(8,Math.floor(Rl(c)/3)))*3,m=Math.pow(10,-g),M=l(`${_}`,{suffix:hu[8+g/3]});return function(x){return M(m*x)}}return{format:l,formatPrefix:h}}var Hn,He,Il;Kl({thousands:",",grouping:[3],currency:["$",""]});function Kl(t){return Hn=Jl(t),He=Hn.format,Il=Hn.formatPrefix,Hn}function Pe(t,n,e=8){if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return[Number.isFinite(t)?t:0];let u=Qt().domain([t,n]).nice(e).ticks(e);if(u.length===0)return[t,n];return u}var Gl=He("~s");function Ut(t){if(!Number.isFinite(t))return"";if(Math.abs(t)>=1000)return Gl(t).replace("G","B").toUpperCase();if(Number.isInteger(t))return t.toString();return t.toFixed(2)}var Bl="rgba(148, 163, 184, 0.18)",Dt="#64748b",Wl="rgba(15, 23, 42, 0.92)";class fn{static instances=new WeakMap;static register(...t){}type;data;options;canvas;ctx;resizeObserver=null;hitItems=[];tooltipEl=null;boundMove=(t)=>this.handleMouseMove(t);boundLeave=()=>this.hideTooltip();constructor(t,n){this.canvas=t instanceof HTMLCanvasElement?t:t.canvas;let e=this.canvas.getContext("2d");if(!e)throw Error("Chart: 2D canvas context unavailable");this.ctx=e,this.type=n.type,this.data=n.data,this.options=n.options??{},fn.instances.set(this.canvas,this),this.attachInteractions(),this.observeResize(),this.render()}update(){this.render()}resize(){this.render()}destroy(){if(this.resizeObserver)this.resizeObserver.disconnect(),this.resizeObserver=null;if(this.canvas.removeEventListener("mousemove",this.boundMove),this.canvas.removeEventListener("mouseleave",this.boundLeave),this.tooltipEl?.parentNode)this.tooltipEl.parentNode.removeChild(this.tooltipEl);this.tooltipEl=null,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),fn.instances.delete(this.canvas)}observeResize(){if(this.options.responsive===!1||typeof ResizeObserver>"u")return;this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this.canvas.parentElement??this.canvas)}attachInteractions(){if(this.options.plugins?.tooltip?.enabled===!1)return;this.canvas.addEventListener("mousemove",this.boundMove),this.canvas.addEventListener("mouseleave",this.boundLeave)}syncCanvasSize(){let t=typeof window<"u"?window.devicePixelRatio||1:1,n=this.canvas.getBoundingClientRect(),e=n.width||this.canvas.clientWidth||this.canvas.width,i=n.height||this.canvas.clientHeight||this.canvas.height,u=Math.max(1,Math.floor(e*t)),r=Math.max(1,Math.floor(i*t));if(this.canvas.width!==u)this.canvas.width=u;if(this.canvas.height!==r)this.canvas.height=r;return this.ctx.setTransform(t,0,0,t,0,0),{width:e,height:i}}render(){let{width:t,height:n}=this.syncCanvasSize();if(this.ctx.clearRect(0,0,t,n),this.hitItems=[],this.type==="doughnut"||this.type==="pie"){this.renderRadial(t,n);return}if(this.type==="radar"){this.renderCartesian(t,n,"line");return}this.renderCartesian(t,n,this.type)}renderCartesian(t,n,e){let i=this.data.labels??[],u=this.data.datasets,r=this.layoutLegend(t,n),a=8+(this.options.plugins?.title?.display?24:0)+(r.position==="top"?r.h:0),s=28+(r.position==="bottom"?r.h:0),l=48+(r.position==="left"?r.w:0),h=16+(r.position==="right"?r.w:0)+(this.hasRightAxis()?40:0),f={x:l,y:a,w:Math.max(1,t-l-h),h:Math.max(1,n-a-s)};if(this.options.plugins?.title?.display&&this.options.plugins.title.text){let g=this.options.plugins.title;this.ctx.fillStyle=g.color??Dt,this.ctx.font=`${g.font?.size??14}px system-ui, sans-serif`,this.ctx.textAlign="center",this.ctx.textBaseline="top",this.ctx.fillText(g.text??"",t/2,8)}this.drawLegend(r,u);let c=this.computeAxis(u.filter((g)=>(g.yAxisID??"y")==="y"),"y"),_=this.hasRightAxis()?this.computeAxis(u.filter((g)=>g.yAxisID==="y1"),"y1"):null;if(this.drawGridAndYAxis(f,c,"left"),_)this.drawYAxis(f,_,"right");if(this.drawXAxis(f,i),e==="bar")this.drawBars(f,i,u,c,_);else this.drawLines(f,i,u,c,_)}hasRightAxis(){return this.data.datasets.some((t)=>t.yAxisID==="y1")}computeAxis(t,n){let e=this.options.scales?.[n]??{},i=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(e.stacked){let o=this.data.labels??[];for(let a=0;a<o.length;a++){let s=0,l=0;for(let h of t){let f=h.data[a]??0;if(f>=0)s+=f;else l+=f}if(s>u)u=s;if(l<i)i=l}}else for(let o of t)for(let a of o.data){if(a<i)i=a;if(a>u)u=a}if(!Number.isFinite(i))i=0;if(!Number.isFinite(u))u=1;if(e.beginAtZero!==!1&&i>0)i=0;if(e.min!==void 0)i=e.min;if(e.max!==void 0)u=e.max;if(i===u)u=i+1;let r=Pe(i,u,e.ticks?.maxTicksLimit??6);return{ticks:r,min:r[0]??i,max:r[r.length-1]??u}}drawGridAndYAxis(t,n,e){let i=this.options.scales?.y??{},u=i.grid?.display!==!1,r=i.ticks?.color??Dt,o=i.grid?.color??Bl;this.ctx.save(),this.ctx.font=`${i.ticks?.font?.size??11}px system-ui, sans-serif`,this.ctx.textBaseline="middle";for(let a of n.ticks){let s=this.scaleY(t,n,a);if(u)this.ctx.strokeStyle=o,this.ctx.lineWidth=1,this.ctx.beginPath(),this.ctx.moveTo(t.x,s),this.ctx.lineTo(t.x+t.w,s),this.ctx.stroke();let l=i.ticks?.callback?i.ticks.callback(a,n.ticks.indexOf(a),n.ticks):Ut(a);this.ctx.fillStyle=r,this.ctx.textAlign=e==="left"?"right":"left";let h=e==="left"?t.x-8:t.x+t.w+8;this.ctx.fillText(String(l),h,s)}this.ctx.restore()}drawYAxis(t,n,e){let i=this.options.scales?.y1??{},u=i.ticks?.color??Dt;this.ctx.save(),this.ctx.font=`${i.ticks?.font?.size??11}px system-ui, sans-serif`,this.ctx.textBaseline="middle";for(let r of n.ticks){let o=this.scaleY(t,n,r),a=i.ticks?.callback?i.ticks.callback(r,n.ticks.indexOf(r),n.ticks):Ut(r);this.ctx.fillStyle=u,this.ctx.textAlign=e==="left"?"right":"left";let s=e==="left"?t.x-8:t.x+t.w+8;this.ctx.fillText(String(a),s,o)}this.ctx.restore()}drawXAxis(t,n){let e=this.options.scales?.x??{},i=e.ticks?.color??Dt;if(e.display===!1||n.length===0)return;this.ctx.save(),this.ctx.font=`${e.ticks?.font?.size??11}px system-ui, sans-serif`,this.ctx.textBaseline="top",this.ctx.textAlign="center",this.ctx.fillStyle=i;let u=Math.min(n.length,Math.max(2,Math.floor(t.w/60))),r=Math.max(1,Math.floor(n.length/u));for(let o=0;o<n.length;o+=r){let a=this.scaleX(t,n.length,o);this.ctx.fillText(n[o]??"",a,t.y+t.h+8)}this.ctx.restore()}scaleX(t,n,e){if(n<=1)return t.x+t.w/2;return Qt().domain([0,n-1]).range([t.x,t.x+t.w])(e)}scaleY(t,n,e){if(n.max===n.min)return t.y+t.h/2;return Qt().domain([n.min,n.max]).range([t.y+t.h,t.y])(e)}drawLines(t,n,e,i,u){e.forEach((r,o)=>{let a=r.yAxisID==="y1"&&u?u:i;if(r.type==="bar"){this.drawBarSeries(t,n,[r],i,u);return}let s=(typeof r.borderColor==="string"?r.borderColor:null)??lt(o),l=r.backgroundColor&&typeof r.backgroundColor==="string"?r.backgroundColor:r.fill?Ye(s,0.15):null,h=r.data.map((g,m)=>({x:this.scaleX(t,n.length||r.data.length,m),y:this.scaleY(t,a,g),value:g}));if(h.length===0)return;let f=(r.tension??0)>0?ru:sn;if(l){let g=t.y+t.h,m=Jr().x((M)=>M.x).y0(()=>g).y1((M)=>M.y).curve(f).context(this.ctx);this.ctx.beginPath(),m(h),this.ctx.fillStyle=l,this.ctx.fill(),m.context(null)}let c=Ce().x((g)=>g.x).y((g)=>g.y).curve(f).context(this.ctx);this.ctx.beginPath(),c(h),this.ctx.lineWidth=r.borderWidth??2,this.ctx.strokeStyle=s,this.ctx.lineJoin="round",this.ctx.lineCap="round",this.ctx.stroke(),c.context(null);let _=r.pointRadius??0;if(_>0){this.ctx.fillStyle=r.pointBackgroundColor??s;for(let g of h)this.ctx.beginPath(),this.ctx.arc(g.x,g.y,_,0,Math.PI*2),this.ctx.fill()}h.forEach((g,m)=>{this.hitItems.push({datasetIndex:o,dataIndex:m,x:g.x,y:g.y,label:n[m]??String(m),value:g.value})})})}drawBars(t,n,e,i,u){this.drawBarSeries(t,n,e,i,u)}drawBarSeries(t,n,e,i,u){let r=n.length||(e[0]?.data.length??0);if(r===0)return;let a=!!this.options.scales?.y?.stacked,s=Array.from({length:r},(c,_)=>_),l=oe().domain(s).range([t.x,t.x+t.w]).paddingInner(0.3),h=l.bandwidth(),f=a?h:h/Math.max(1,e.length);for(let c=0;c<r;c++){let _=l(c),g=0,m=0;e.forEach((M,x)=>{let T=M.yAxisID==="y1"&&u?u:i,w=M.data[c]??0,v=a?w>=0?g:m:0,$=v+w,S=this.scaleY(t,T,v),b=this.scaleY(t,T,$),F=a?_:_+x*f,P=Math.min(S,b),z=Math.abs(b-S),R=Array.isArray(M.backgroundColor)?M.backgroundColor[c]??lt(x):typeof M.backgroundColor==="string"?M.backgroundColor:lt(x);if(this.ctx.fillStyle=R,this.ctx.fillRect(F,P,Math.max(1,f-2),z),M.borderWidth&&M.borderColor&&typeof M.borderColor==="string")this.ctx.lineWidth=M.borderWidth,this.ctx.strokeStyle=M.borderColor,this.ctx.strokeRect(F,P,Math.max(1,f-2),z);if(a)if(w>=0)g=$;else m=$;this.hitItems.push({datasetIndex:x,dataIndex:c,x:F+f/2,y:P,label:n[c]??String(c),value:w})})}}renderRadial(t,n){let e=this.data.datasets;if(e.length===0)return;let i=e[0];if(!i)return;let u=this.data.labels??[],r=this.layoutLegend(t,n),o=t,a=n,s=0,l=0;if(r.position==="right")o=t-r.w;else if(r.position==="left")o=t-r.w,s=r.w;else if(r.position==="top")a=n-r.h,l=r.h;else if(r.position==="bottom")a=n-r.h;this.drawLegend(r,e.map((w,v)=>({...w,label:u[v]??w.label})),u);let h=s+o/2,f=l+a/2,c=Math.min(o,a)/2-8,_=this.options.cutout,g=typeof _==="string"&&_.endsWith("%")?Number.parseFloat(_)/100:this.type==="doughnut"?0.6:0,m=c*g,x=Ir().value((w)=>Math.max(0,w||0)).startAngle(-Math.PI/2).endAngle(-Math.PI/2+Math.PI*2).sort(null)(i.data),T=Zr().innerRadius(m).outerRadius(c);this.ctx.save(),this.ctx.translate(h,f);for(let w of x){let v=w.index,$=i.data[v]??0,S=Array.isArray(i.backgroundColor)?i.backgroundColor[v]??lt(v):typeof i.backgroundColor==="string"?i.backgroundColor:lt(v);this.ctx.beginPath(),T.context(this.ctx)(w),this.ctx.fillStyle=S,this.ctx.fill();let b=(w.startAngle+w.endAngle)/2-Math.PI/2,F=(c+m)/2;this.hitItems.push({datasetIndex:0,dataIndex:v,x:h+Math.cos(b)*F,y:f+Math.sin(b)*F,label:u[v]??String(v),value:$})}this.ctx.restore(),T.context(null)}layoutLegend(t,n){let e=this.options.plugins?.legend;if(e?.display===!1||!this.data.datasets.some((u)=>u.label))return{w:0,h:0,position:"none"};let i=e?.position??"top";if(i==="left"||i==="right")return{w:100,h:0,position:i};return{w:0,h:Math.max(24,Math.ceil(this.data.datasets.length/4)*18+8),position:i}}drawLegend(t,n,e){if(t.position==="none")return;let i=this.options.plugins?.legend,u=e&&(this.type==="pie"||this.type==="doughnut")?e.map((a,s)=>{let l=n[0],h=Array.isArray(l?.backgroundColor)?l.backgroundColor[s]??lt(s):typeof l?.backgroundColor==="string"?l.backgroundColor:lt(s);return{label:a,color:h}}):n.map((a,s)=>({label:a.label??`Dataset ${s+1}`,color:typeof a.borderColor==="string"?a.borderColor:Array.isArray(a.backgroundColor)?a.backgroundColor[0]??lt(s):typeof a.backgroundColor==="string"?a.backgroundColor:lt(s)}));if(u.length===0)return;this.ctx.save(),this.ctx.font=`${i?.labels?.font?.size??12}px system-ui, sans-serif`,this.ctx.fillStyle=i?.labels?.color??Dt,this.ctx.textBaseline="middle";let r=i?.labels?.boxWidth??12,o=i?.labels?.padding??8;if(t.position==="top"||t.position==="bottom"){let a=t.position==="top"?12:(this.canvas.clientHeight||0)-12,s=o;this.ctx.textAlign="left";for(let l of u)this.ctx.fillStyle=l.color,this.ctx.fillRect(s,a-r/2,r,r),s+=r+4,this.ctx.fillStyle=i?.labels?.color??Dt,this.ctx.fillText(l.label,s,a),s+=this.ctx.measureText(l.label).width+o*2}else{let a=t.position==="right"?(this.canvas.clientWidth||0)-110:8,s=o+6;for(let l of u)this.ctx.fillStyle=l.color,this.ctx.fillRect(a,s-r/2,r,r),this.ctx.fillStyle=i?.labels?.color??Dt,this.ctx.textAlign="left",this.ctx.fillText(l.label,a+r+4,s),s+=18}this.ctx.restore()}handleMouseMove(t){if(this.hitItems.length===0)return;let n=this.canvas.getBoundingClientRect(),e=t.clientX-n.left,i=t.clientY-n.top;if((this.options.interaction?.mode??this.options.plugins?.tooltip?.mode??"nearest")==="index"){let a=this.findClosestByIndex(e);if(a)this.showTooltip(t.clientX,t.clientY,a);else this.hideTooltip();return}let r=null,o=Number.POSITIVE_INFINITY;for(let a of this.hitItems){let s=a.x-e,l=a.y-i,h=s*s+l*l;if(h<o)o=h,r=a}if(r&&o<3600)this.showTooltip(t.clientX,t.clientY,[r]);else this.hideTooltip()}findClosestByIndex(t){let n=-1,e=Number.POSITIVE_INFINITY;for(let i of this.hitItems){let u=Math.abs(i.x-t);if(u<e)e=u,n=i.dataIndex}if(n<0)return null;return this.hitItems.filter((i)=>i.dataIndex===n)}showTooltip(t,n,e){if(!this.tooltipEl)this.tooltipEl=document.createElement("div"),Object.assign(this.tooltipEl.style,{position:"fixed",pointerEvents:"none",background:this.options.plugins?.tooltip?.backgroundColor??Wl,color:this.options.plugins?.tooltip?.bodyColor??"#fff",padding:"6px 10px",borderRadius:"6px",font:"12px system-ui, sans-serif",zIndex:"9999",whiteSpace:"pre-line",transform:"translate(8px, 8px)"}),document.body.appendChild(this.tooltipEl);let i=this.options.plugins?.tooltip?.callbacks,u=[];e.forEach((s)=>{let l=this.data.datasets[s.datasetIndex];if(!l)return;let h={dataset:l,datasetIndex:s.datasetIndex,dataIndex:s.dataIndex,parsed:{y:s.value},raw:s.value,label:s.label,formattedValue:Ut(s.value)},f=i?.label?i.label(h):`${l.label??""}: ${Ut(s.value)}`,c=Array.isArray(f)?f.join(`
|
|
3
|
+
`):f;u.push(c)});let r=i?.title?i.title(e.flatMap((s)=>{let l=this.data.datasets[s.datasetIndex];if(!l)return[];return[{dataset:l,datasetIndex:s.datasetIndex,dataIndex:s.dataIndex,parsed:{y:s.value},raw:s.value,label:s.label,formattedValue:Ut(s.value)}]})):e[0]?.label,o=Array.isArray(r)?r.join(`
|
|
4
|
+
`):r;if(this.tooltipEl.textContent="",o){let s=document.createElement("strong");s.textContent=o,this.tooltipEl.appendChild(s),this.tooltipEl.appendChild(document.createElement("br"))}let a=document.createTextNode(u.join(`
|
|
5
|
+
`));this.tooltipEl.appendChild(a),this.tooltipEl.style.left=`${t}px`,this.tooltipEl.style.top=`${n}px`,this.tooltipEl.style.display="block"}hideTooltip(){if(this.tooltipEl)this.tooltipEl.style.display="none"}}var v0=fn,d0=[];export{Ye as withAlpha,d0 as registerables,lt as paletteColor,Pe as niceTicks,Ut as formatTick,v0 as default,qn as DEFAULT_PALETTE,fn as Chart};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function paletteColor(index: number): string;
|
|
2
|
+
export declare function withAlpha(color: string, alpha: number): string;
|
|
3
|
+
/** @defaultValue `[ '#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#14b8a6', '#f97316', '#6366f1', '#84cc16', ]` */
|
|
4
|
+
export declare const DEFAULT_PALETTE: string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Chart } from './chart';
|
|
2
|
+
export type {
|
|
3
|
+
ChartConfig,
|
|
4
|
+
ChartData,
|
|
5
|
+
ChartDataset,
|
|
6
|
+
ChartOptions,
|
|
7
|
+
ChartType,
|
|
8
|
+
LegendConfig,
|
|
9
|
+
ScaleConfig,
|
|
10
|
+
TooltipCallbackContext,
|
|
11
|
+
TooltipConfig,
|
|
12
|
+
} from './types';
|
|
13
|
+
/**
|
|
14
|
+
* Chart.js compatibility shim — `chart.js/auto` exposes a `registerables`
|
|
15
|
+
* array used to opt-in to all chart types and plugins. We auto-register
|
|
16
|
+
* everything by default, so the shim is intentionally empty; export it
|
|
17
|
+
* so existing call sites that destructure `{ Chart, registerables }` and
|
|
18
|
+
* call `Chart.register(...registerables)` keep working unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export declare const registerables: unknown[];
|
|
21
|
+
export { Chart };
|
|
22
|
+
export { DEFAULT_PALETTE, paletteColor, withAlpha } from './colors';
|
|
23
|
+
export { formatTick, niceTicks } from './ticks';
|
|
24
|
+
export default Chart;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute "nice" tick values for a numeric range.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to `@ts-charts/scale`'s `scaleLinear().nice().ticks()` so we
|
|
5
|
+
* inherit the same 1/2/5×10ⁿ progression D3 has battle-tested for a decade.
|
|
6
|
+
*/
|
|
7
|
+
export declare function niceTicks(min: number, max: number, count?: number): number[];
|
|
8
|
+
/**
|
|
9
|
+
* Format a tick value compactly. Uses ts-charts SI notation (`1.5k`, `2.5M`)
|
|
10
|
+
* which is what the dashboards expect, falling back to integer/2dp for
|
|
11
|
+
* values under 1000.
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatTick(value: number): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export declare interface ChartDataset {
|
|
2
|
+
label?: string
|
|
3
|
+
data: number[]
|
|
4
|
+
backgroundColor?: string | string[] | CanvasGradient
|
|
5
|
+
borderColor?: string | string[] | CanvasGradient
|
|
6
|
+
borderWidth?: number
|
|
7
|
+
fill?: boolean
|
|
8
|
+
tension?: number
|
|
9
|
+
pointRadius?: number
|
|
10
|
+
pointBackgroundColor?: string
|
|
11
|
+
pointBorderColor?: string
|
|
12
|
+
stack?: string
|
|
13
|
+
yAxisID?: string
|
|
14
|
+
type?: ChartType
|
|
15
|
+
}
|
|
16
|
+
export declare interface ChartData {
|
|
17
|
+
labels?: string[]
|
|
18
|
+
datasets: ChartDataset[]
|
|
19
|
+
}
|
|
20
|
+
export declare interface ScaleConfig {
|
|
21
|
+
beginAtZero?: boolean
|
|
22
|
+
display?: boolean
|
|
23
|
+
stacked?: boolean
|
|
24
|
+
grid?: { display?: boolean, color?: string, drawBorder?: boolean }
|
|
25
|
+
ticks?: {
|
|
26
|
+
color?: string
|
|
27
|
+
font?: { size?: number, family?: string }
|
|
28
|
+
callback?: (value: number, index: number, ticks: any[]) => string
|
|
29
|
+
stepSize?: number
|
|
30
|
+
maxTicksLimit?: number
|
|
31
|
+
}
|
|
32
|
+
min?: number
|
|
33
|
+
max?: number
|
|
34
|
+
position?: 'left' | 'right' | 'top' | 'bottom'
|
|
35
|
+
title?: { display?: boolean, text?: string, color?: string }
|
|
36
|
+
}
|
|
37
|
+
export declare interface LegendConfig {
|
|
38
|
+
display?: boolean
|
|
39
|
+
position?: 'top' | 'right' | 'bottom' | 'left'
|
|
40
|
+
align?: 'start' | 'center' | 'end'
|
|
41
|
+
labels?: { color?: string, font?: { size?: number }, boxWidth?: number, padding?: number }
|
|
42
|
+
}
|
|
43
|
+
export declare interface TooltipCallbackContext {
|
|
44
|
+
dataset: ChartDataset
|
|
45
|
+
datasetIndex: number
|
|
46
|
+
dataIndex: number
|
|
47
|
+
parsed: { x?: number, y: number }
|
|
48
|
+
raw: number
|
|
49
|
+
label: string
|
|
50
|
+
formattedValue: string
|
|
51
|
+
}
|
|
52
|
+
export declare interface TooltipConfig {
|
|
53
|
+
enabled?: boolean
|
|
54
|
+
mode?: 'index' | 'point' | 'nearest' | 'dataset'
|
|
55
|
+
intersect?: boolean
|
|
56
|
+
callbacks?: {
|
|
57
|
+
label?: (ctx: TooltipCallbackContext) => string | string[]
|
|
58
|
+
title?: (ctx: TooltipCallbackContext[]) => string | string[]
|
|
59
|
+
}
|
|
60
|
+
backgroundColor?: string
|
|
61
|
+
titleColor?: string
|
|
62
|
+
bodyColor?: string
|
|
63
|
+
borderColor?: string
|
|
64
|
+
borderWidth?: number
|
|
65
|
+
padding?: number
|
|
66
|
+
}
|
|
67
|
+
export declare interface ChartOptions {
|
|
68
|
+
responsive?: boolean
|
|
69
|
+
maintainAspectRatio?: boolean
|
|
70
|
+
cutout?: string | number
|
|
71
|
+
interaction?: { mode?: 'index' | 'point' | 'nearest' | 'dataset', intersect?: boolean }
|
|
72
|
+
scales?: Record<string, ScaleConfig>
|
|
73
|
+
plugins?: {
|
|
74
|
+
legend?: LegendConfig
|
|
75
|
+
tooltip?: TooltipConfig
|
|
76
|
+
title?: { display?: boolean, text?: string, color?: string, font?: { size?: number } }
|
|
77
|
+
}
|
|
78
|
+
animation?: false | { duration?: number }
|
|
79
|
+
layout?: { padding?: number | { top?: number, right?: number, bottom?: number, left?: number } }
|
|
80
|
+
}
|
|
81
|
+
export declare interface ChartConfig {
|
|
82
|
+
type: ChartType
|
|
83
|
+
data: ChartData
|
|
84
|
+
options?: ChartOptions
|
|
85
|
+
}
|
|
86
|
+
export type ChartType = 'line' | 'bar' | 'doughnut' | 'pie' | 'radar';
|
|
87
|
+
export type CanvasContext = HTMLCanvasElement | CanvasRenderingContext2D;
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stacksjs/charts",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.70.23",
|
|
5
|
+
"description": "Chart rendering for Stacks. Built on ts-charts (D3 in TypeScript).",
|
|
6
|
+
"author": "Chris Breuer",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"Chris Breuer <chris@stacksjs.com>"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
12
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/charts#readme",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
16
|
+
"directory": "./storage/framework/core/charts"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/stacksjs/stacks/issues"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"charts",
|
|
23
|
+
"visualization",
|
|
24
|
+
"canvas",
|
|
25
|
+
"stacks",
|
|
26
|
+
"ts-charts",
|
|
27
|
+
"d3"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"bun": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./*": {
|
|
36
|
+
"bun": "./src/*",
|
|
37
|
+
"import": "./dist/*"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"module": "dist/index.js",
|
|
41
|
+
"types": "dist/index.d.ts",
|
|
42
|
+
"files": [
|
|
43
|
+
"README.md",
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "bun build.ts",
|
|
48
|
+
"typecheck": "bun tsc --noEmit",
|
|
49
|
+
"prepublishOnly": "bun run build"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@ts-charts/format": "^0.2.0",
|
|
53
|
+
"@ts-charts/scale": "^0.2.0",
|
|
54
|
+
"@ts-charts/shape": "^0.2.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"better-dx": "^0.2.12"
|
|
58
|
+
}
|
|
59
|
+
}
|