@kong-ui-public/analytics-chart 5.0.8 → 5.0.10

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.
@@ -3,41 +3,41 @@
3
3
  * https://github.com/kurkle/color#readme
4
4
  * (c) 2023 Jukka Kurkela
5
5
  * Released under the MIT License
6
- */function li(n){return n+.5|0}const Xe=(n,t,e)=>Math.max(Math.min(n,e),t);function ci(n){return Xe(li(n*2.55),0,255)}function Ge(n){return Xe(li(n*255),0,255)}function Ae(n){return Xe(li(n/2.55)/100,0,1)}function To(n){return Xe(li(n*100),0,100)}const he={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},br=[..."0123456789ABCDEF"],zh=n=>br[n&15],Bh=n=>br[(n&240)>>4]+br[n&15],ns=n=>(n&240)>>4===(n&15),Hh=n=>ns(n.r)&&ns(n.g)&&ns(n.b)&&ns(n.a);function Wh(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&he[n[1]]*17,g:255&he[n[2]]*17,b:255&he[n[3]]*17,a:t===5?he[n[4]]*17:255}:(t===7||t===9)&&(e={r:he[n[1]]<<4|he[n[2]],g:he[n[3]]<<4|he[n[4]],b:he[n[5]]<<4|he[n[6]],a:t===9?he[n[7]]<<4|he[n[8]]:255})),e}const Yh=(n,t)=>n<255?t(n):"";function Vh(n){var t=Hh(n)?zh:Bh;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Yh(n.a,t):void 0}const jh=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Co(n,t,e){const i=t*Math.min(e,1-e),s=(r,a=(r+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function $h(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function Uh(n,t,e){const i=Co(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function qh(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function xr(n){const e=n.r/255,i=n.g/255,s=n.b/255,r=Math.max(e,i,s),a=Math.min(e,i,s),o=(r+a)/2;let l,c,u;return r!==a&&(u=r-a,c=o>.5?u/(2-r-a):u/(r+a),l=qh(e,i,s,u,r),l=l*60+.5),[l|0,c||0,o]}function _r(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(Ge)}function wr(n,t,e){return _r(Co,n,t,e)}function Xh(n,t,e){return _r(Uh,n,t,e)}function Gh(n,t,e){return _r($h,n,t,e)}function Po(n){return(n%360+360)%360}function Kh(n){const t=jh.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?ci(+t[5]):Ge(+t[5]));const s=Po(+t[2]),r=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Xh(s,r,a):t[1]==="hsv"?i=Gh(s,r,a):i=wr(s,r,a),{r:i[0],g:i[1],b:i[2],a:e}}function Zh(n,t){var e=xr(n);e[0]=Po(e[0]+t),e=wr(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Qh(n){if(!n)return;const t=xr(n),e=t[0],i=To(t[1]),s=To(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ae(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Oo={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Eo={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Jh(){const n={},t=Object.keys(Eo),e=Object.keys(Oo);let i,s,r,a,o;for(i=0;i<t.length;i++){for(a=o=t[i],s=0;s<e.length;s++)r=e[s],o=o.replace(r,Oo[r]);r=parseInt(Eo[a],16),n[o]=[r>>16&255,r>>8&255,r&255]}return n}let is;function tf(n){is||(is=Jh(),is.transparent=[0,0,0,0]);const t=is[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const ef=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function nf(n){const t=ef.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const a=+t[7];e=t[8]?ci(a):Xe(a*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?ci(i):Xe(i,0,255)),s=255&(t[4]?ci(s):Xe(s,0,255)),r=255&(t[6]?ci(r):Xe(r,0,255)),{r:i,g:s,b:r,a:e}}}function sf(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ae(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const vr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,zn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function rf(n,t,e){const i=zn(Ae(n.r)),s=zn(Ae(n.g)),r=zn(Ae(n.b));return{r:Ge(vr(i+e*(zn(Ae(t.r))-i))),g:Ge(vr(s+e*(zn(Ae(t.g))-s))),b:Ge(vr(r+e*(zn(Ae(t.b))-r))),a:n.a+e*(t.a-n.a)}}function ss(n,t,e){if(n){let i=xr(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=wr(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ao(n,t){return n&&Object.assign(t||{},n)}function Ro(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=Ge(n[3]))):(t=Ao(n,{r:0,g:0,b:0,a:1}),t.a=Ge(t.a)),t}function af(n){return n.charAt(0)==="r"?nf(n):Kh(n)}class ui{constructor(t){if(t instanceof ui)return t;const e=typeof t;let i;e==="object"?i=Ro(t):e==="string"&&(i=Wh(t)||tf(t)||af(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ao(this._rgb);return t&&(t.a=Ae(t.a)),t}set rgb(t){this._rgb=Ro(t)}rgbString(){return this._valid?sf(this._rgb):void 0}hexString(){return this._valid?Vh(this._rgb):void 0}hslString(){return this._valid?Qh(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const a=e===r?.5:e,o=2*a-1,l=i.a-s.a,c=((o*l===-1?o:(o+l)/(1+o*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=rf(this._rgb,t._rgb,e)),this}clone(){return new ui(this.rgb)}alpha(t){return this._rgb.a=Ge(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=li(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ss(this._rgb,2,t),this}darken(t){return ss(this._rgb,2,-t),this}saturate(t){return ss(this._rgb,1,t),this}desaturate(t){return ss(this._rgb,1,-t),this}rotate(t){return Zh(this._rgb,t),this}}/*!
6
+ */function li(n){return n+.5|0}const Xe=(n,t,e)=>Math.max(Math.min(n,e),t);function ci(n){return Xe(li(n*2.55),0,255)}function Ge(n){return Xe(li(n*255),0,255)}function Ae(n){return Xe(li(n/2.55)/100,0,1)}function To(n){return Xe(li(n*100),0,100)}const he={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},br=[..."0123456789ABCDEF"],zh=n=>br[n&15],Bh=n=>br[(n&240)>>4]+br[n&15],ns=n=>(n&240)>>4===(n&15),Hh=n=>ns(n.r)&&ns(n.g)&&ns(n.b)&&ns(n.a);function Wh(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&he[n[1]]*17,g:255&he[n[2]]*17,b:255&he[n[3]]*17,a:t===5?he[n[4]]*17:255}:(t===7||t===9)&&(e={r:he[n[1]]<<4|he[n[2]],g:he[n[3]]<<4|he[n[4]],b:he[n[5]]<<4|he[n[6]],a:t===9?he[n[7]]<<4|he[n[8]]:255})),e}const Yh=(n,t)=>n<255?t(n):"";function Vh(n){var t=Hh(n)?zh:Bh;return n?"#"+t(n.r)+t(n.g)+t(n.b)+Yh(n.a,t):void 0}const jh=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Co(n,t,e){const i=t*Math.min(e,1-e),s=(r,a=(r+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function $h(n,t,e){const i=(s,r=(s+n/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function qh(n,t,e){const i=Co(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Uh(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function xr(n){const e=n.r/255,i=n.g/255,s=n.b/255,r=Math.max(e,i,s),a=Math.min(e,i,s),o=(r+a)/2;let l,c,u;return r!==a&&(u=r-a,c=o>.5?u/(2-r-a):u/(r+a),l=Uh(e,i,s,u,r),l=l*60+.5),[l|0,c||0,o]}function _r(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(Ge)}function wr(n,t,e){return _r(Co,n,t,e)}function Xh(n,t,e){return _r(qh,n,t,e)}function Gh(n,t,e){return _r($h,n,t,e)}function Po(n){return(n%360+360)%360}function Kh(n){const t=jh.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?ci(+t[5]):Ge(+t[5]));const s=Po(+t[2]),r=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Xh(s,r,a):t[1]==="hsv"?i=Gh(s,r,a):i=wr(s,r,a),{r:i[0],g:i[1],b:i[2],a:e}}function Zh(n,t){var e=xr(n);e[0]=Po(e[0]+t),e=wr(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Qh(n){if(!n)return;const t=xr(n),e=t[0],i=To(t[1]),s=To(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ae(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Oo={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Eo={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Jh(){const n={},t=Object.keys(Eo),e=Object.keys(Oo);let i,s,r,a,o;for(i=0;i<t.length;i++){for(a=o=t[i],s=0;s<e.length;s++)r=e[s],o=o.replace(r,Oo[r]);r=parseInt(Eo[a],16),n[o]=[r>>16&255,r>>8&255,r&255]}return n}let is;function tf(n){is||(is=Jh(),is.transparent=[0,0,0,0]);const t=is[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const ef=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function nf(n){const t=ef.exec(n);let e=255,i,s,r;if(t){if(t[7]!==i){const a=+t[7];e=t[8]?ci(a):Xe(a*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?ci(i):Xe(i,0,255)),s=255&(t[4]?ci(s):Xe(s,0,255)),r=255&(t[6]?ci(r):Xe(r,0,255)),{r:i,g:s,b:r,a:e}}}function sf(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ae(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const vr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,zn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function rf(n,t,e){const i=zn(Ae(n.r)),s=zn(Ae(n.g)),r=zn(Ae(n.b));return{r:Ge(vr(i+e*(zn(Ae(t.r))-i))),g:Ge(vr(s+e*(zn(Ae(t.g))-s))),b:Ge(vr(r+e*(zn(Ae(t.b))-r))),a:n.a+e*(t.a-n.a)}}function ss(n,t,e){if(n){let i=xr(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=wr(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ao(n,t){return n&&Object.assign(t||{},n)}function Ro(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=Ge(n[3]))):(t=Ao(n,{r:0,g:0,b:0,a:1}),t.a=Ge(t.a)),t}function af(n){return n.charAt(0)==="r"?nf(n):Kh(n)}class ui{constructor(t){if(t instanceof ui)return t;const e=typeof t;let i;e==="object"?i=Ro(t):e==="string"&&(i=Wh(t)||tf(t)||af(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ao(this._rgb);return t&&(t.a=Ae(t.a)),t}set rgb(t){this._rgb=Ro(t)}rgbString(){return this._valid?sf(this._rgb):void 0}hexString(){return this._valid?Vh(this._rgb):void 0}hslString(){return this._valid?Qh(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let r;const a=e===r?.5:e,o=2*a-1,l=i.a-s.a,c=((o*l===-1?o:(o+l)/(1+o*l))+1)/2;r=1-c,i.r=255&c*i.r+r*s.r+.5,i.g=255&c*i.g+r*s.g+.5,i.b=255&c*i.b+r*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=rf(this._rgb,t._rgb,e)),this}clone(){return new ui(this.rgb)}alpha(t){return this._rgb.a=Ge(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=li(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ss(this._rgb,2,t),this}darken(t){return ss(this._rgb,2,-t),this}saturate(t){return ss(this._rgb,1,t),this}desaturate(t){return ss(this._rgb,1,-t),this}rotate(t){return Zh(this._rgb,t),this}}/*!
7
7
  * Chart.js v4.4.4
8
8
  * https://www.chartjs.org
9
9
  * (c) 2024 Chart.js Contributors
10
10
  * Released under the MIT License
11
- */function Re(){}const of=(()=>{let n=0;return()=>n++})();function J(n){return n===null||typeof n>"u"}function ot(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function it(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function kt(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function ce(n,t){return kt(n)?n:t}function K(n,t){return typeof n>"u"?t:n}const lf=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Lo=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ut(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function dt(n,t,e,i){let s,r,a;if(ot(n))for(r=n.length,s=0;s<r;s++)t.call(e,n[s],s);else if(it(n))for(a=Object.keys(n),r=a.length,s=0;s<r;s++)t.call(e,n[a[s]],a[s])}function rs(n,t){let e,i,s,r;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],r=t[e],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function as(n){if(ot(n))return n.map(as);if(it(n)){const t=Object.create(null),e=Object.keys(n),i=e.length;let s=0;for(;s<i;++s)t[e[s]]=as(n[e[s]]);return t}return n}function Io(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function cf(n,t,e,i){if(!Io(n))return;const s=t[n],r=e[n];it(s)&&it(r)?di(s,r,i):t[n]=as(r)}function di(n,t,e){const i=ot(t)?t:[t],s=i.length;if(!it(n))return n;e=e||{};const r=e.merger||cf;let a;for(let o=0;o<s;++o){if(a=i[o],!it(a))continue;const l=Object.keys(a);for(let c=0,u=l.length;c<u;++c)r(l[c],n,a,e)}return n}function hi(n,t){return di(n,t,{merger:uf})}function uf(n,t,e){if(!Io(n))return;const i=t[n],s=e[n];it(i)&&it(s)?hi(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=as(s))}const No={"":n=>n,x:n=>n.x,y:n=>n.y};function df(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function hf(n){const t=df(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Ke(n,t){return(No[t]||(No[t]=hf(t)))(n)}function kr(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Qt=n=>typeof n<"u",Jt=n=>typeof n=="function",Fo=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function ff(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const rt=Math.PI,yt=2*rt,gf=yt+rt,os=Number.POSITIVE_INFINITY,Mr=rt/180,bt=rt/2,fe=rt/4,ls=rt*2/3,Ze=Math.log10,Se=Math.sign;function fi(n,t,e){return Math.abs(n-t)<e}function zo(n){const t=Math.round(n);n=fi(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(Ze(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function pf(n){const t=[],e=Math.sqrt(n);let i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,r)=>s-r).pop(),t}function Qe(n){return!isNaN(parseFloat(n))&&isFinite(n)}function mf(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Bo(n,t,e){let i,s,r;for(i=0,s=n.length;i<s;i++)r=n[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function Nt(n){return n*(rt/180)}function cs(n){return n*(180/rt)}function Ho(n){if(!kt(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function Wo(n,t){const e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i);let r=Math.atan2(i,e);return r<-.5*rt&&(r+=yt),{angle:r,distance:s}}function Bn(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function yf(n,t){return(n-t+gf)%yt-rt}function ue(n){return(n%yt+yt)%yt}function gi(n,t,e,i){const s=ue(n),r=ue(t),a=ue(e),o=ue(r-s),l=ue(a-s),c=ue(s-r),u=ue(s-a);return s===r||s===a||i&&r===a||o>l&&c<u}function Ht(n,t,e){return Math.max(t,Math.min(e,n))}function bf(n){return Ht(n,-32768,32767)}function Le(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Sr(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,r;for(;i-s>1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Ie=(n,t,e,i)=>Sr(n,e,i?s=>{const r=n[s][t];return r<e||r===e&&n[s+1][t]===e}:s=>n[s][t]<e),xf=(n,t,e)=>Sr(n,e,i=>n[i][t]>=e);function _f(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}const Yo=["push","pop","shift","splice","unshift"];function wf(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Yo.forEach(e=>{const i="_onData"+kr(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const a=s.apply(this,r);return n._chartjs.listeners.forEach(o=>{typeof o[i]=="function"&&o[i](...r)}),a}})})}function Vo(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Yo.forEach(r=>{delete n[r]}),delete n._chartjs)}function jo(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const $o=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Uo(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,$o.call(window,()=>{i=!1,n.apply(t,e)}))}}function vf(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Dr=n=>n==="start"?"left":n==="end"?"right":"center",jt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,kf=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function qo(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:a,_parsed:o}=n,l=a.axis,{min:c,max:u,minDefined:d,maxDefined:h}=a.getUserBounds();d&&(s=Ht(Math.min(Ie(o,l,c).lo,e?i:Ie(t,l,a.getPixelForValue(c)).lo),0,i-1)),h?r=Ht(Math.max(Ie(o,a.axis,u,!0).hi+1,e?0:Ie(t,l,a.getPixelForValue(u),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Xo(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const us=n=>n===0||n===1,Go=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*yt/e)),Ko=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*yt/e)+1,pi={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*bt)+1,easeOutSine:n=>Math.sin(n*bt),easeInOutSine:n=>-.5*(Math.cos(rt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>us(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>us(n)?n:Go(n,.075,.3),easeOutElastic:n=>us(n)?n:Ko(n,.075,.3),easeInOutElastic(n){return us(n)?n:n<.5?.5*Go(n*2,.1125,.45):.5+.5*Ko(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-pi.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?pi.easeInBounce(n*2)*.5:pi.easeOutBounce(n*2-1)*.5+.5};function Tr(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Zo(n){return Tr(n)?n:new ui(n)}function Cr(n){return Tr(n)?n:new ui(n).saturate(.5).darken(.1).hexString()}const Mf=["x","y","borderWidth","radius","tension"],Sf=["color","borderColor","backgroundColor"];function Df(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Sf},numbers:{type:"number",properties:Mf}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Tf(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Qo=new Map;function Cf(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Qo.get(e);return i||(i=new Intl.NumberFormat(n,t),Qo.set(e,i)),i}function mi(n,t,e){return Cf(t,e).format(n)}const Jo={values(n){return ot(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=Pf(n,e)}const a=Ze(Math.abs(r)),o=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(l,this.options.ticks.format),mi(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(Ze(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Jo.numeric.call(this,n,t,e):""}};function Pf(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var ds={formatters:Jo};function Of(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ds.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const bn=Object.create(null),Pr=Object.create(null);function yi(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;i<s;++i){const r=e[i];n=n[r]||(n[r]=Object.create(null))}return n}function Or(n,t,e){return typeof t=="string"?di(yi(n,t),e):di(yi(n,""),t)}class Ef{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Cr(s.backgroundColor),this.hoverBorderColor=(i,s)=>Cr(s.borderColor),this.hoverColor=(i,s)=>Cr(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Or(this,t,e)}get(t){return yi(this,t)}describe(t,e){return Or(Pr,t,e)}override(t,e){return Or(bn,t,e)}route(t,e,i,s){const r=yi(this,t),a=yi(this,i),o="_"+e;Object.defineProperties(r,{[o]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[o],c=a[s];return it(l)?Object.assign({},c,l):K(l,c)},set(l){this[o]=l}}})}apply(t){t.forEach(e=>e(this))}}var Dt=new Ef({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Df,Tf,Of]);function Af(n){return!n||J(n.size)||J(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function hs(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function Rf(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let a=0;const o=e.length;let l,c,u,d,h;for(l=0;l<o;l++)if(d=e[l],d!=null&&!ot(d))a=hs(n,s,r,a,d);else if(ot(d))for(c=0,u=d.length;c<u;c++)h=d[c],h!=null&&!ot(h)&&(a=hs(n,s,r,a,h));n.restore();const g=r.length/2;if(g>e.length){for(l=0;l<g;l++)delete s[r[l]];r.splice(0,g)}return a}function xn(n,t,e){const i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function tl(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function Er(n,t,e,i){el(n,t,e,i,null)}function el(n,t,e,i,s){let r,a,o,l,c,u,d,h;const g=t.pointStyle,p=t.rotation,y=t.radius;let x=(p||0)*Mr;if(g&&typeof g=="object"&&(r=g.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(x),n.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),n.restore();return}if(!(isNaN(y)||y<=0)){switch(n.beginPath(),g){default:s?n.ellipse(e,i,s/2,y,0,0,yt):n.arc(e,i,y,0,yt),n.closePath();break;case"triangle":u=s?s/2:y,n.moveTo(e+Math.sin(x)*u,i-Math.cos(x)*y),x+=ls,n.lineTo(e+Math.sin(x)*u,i-Math.cos(x)*y),x+=ls,n.lineTo(e+Math.sin(x)*u,i-Math.cos(x)*y),n.closePath();break;case"rectRounded":c=y*.516,l=y-c,a=Math.cos(x+fe)*l,d=Math.cos(x+fe)*(s?s/2-c:l),o=Math.sin(x+fe)*l,h=Math.sin(x+fe)*(s?s/2-c:l),n.arc(e-d,i-o,c,x-rt,x-bt),n.arc(e+h,i-a,c,x-bt,x),n.arc(e+d,i+o,c,x,x+bt),n.arc(e-h,i+a,c,x+bt,x+rt),n.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*y,u=s?s/2:l,n.rect(e-u,i-l,2*u,2*l);break}x+=fe;case"rectRot":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+h,i-a),n.lineTo(e+d,i+o),n.lineTo(e-h,i+a),n.closePath();break;case"crossRot":x+=fe;case"cross":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a);break;case"star":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a),x+=fe,d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a);break;case"line":a=s?s/2:Math.cos(x)*y,o=Math.sin(x)*y,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(x)*(s?s/2:y),i+Math.sin(x)*y);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function Ne(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function bi(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function xi(n){n.restore()}function Lf(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){const r=(t.x+e.x)/2;n.lineTo(r,t.y),n.lineTo(r,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function If(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function Nf(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),J(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Ff(n,t,e,i,s){if(s.strikethrough||s.underline){const r=n.measureText(i),a=t-r.actualBoundingBoxLeft,o=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,u),n.lineTo(o,u),n.stroke()}}function zf(n,t){const e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function _n(n,t,e,i,s,r={}){const a=ot(t)?t:[t],o=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,Nf(n,r),l=0;l<a.length;++l)c=a[l],r.backdrop&&zf(n,r.backdrop),o&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),J(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,e,i,r.maxWidth)),n.fillText(c,e,i,r.maxWidth),Ff(n,e,i,c,r),i+=Number(s.lineHeight);n.restore()}function Hn(n,t){const{x:e,y:i,w:s,h:r,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*rt,rt,!0),n.lineTo(e,i+r-a.bottomLeft),n.arc(e+a.bottomLeft,i+r-a.bottomLeft,a.bottomLeft,rt,bt,!0),n.lineTo(e+s-a.bottomRight,i+r),n.arc(e+s-a.bottomRight,i+r-a.bottomRight,a.bottomRight,bt,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-bt,!0),n.lineTo(e+a.topLeft,i)}const Bf=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Hf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Wf(n,t){const e=(""+n).match(Bf);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}const Yf=n=>+n||0;function Ar(n,t){const e={},i=it(t),s=i?Object.keys(t):t,r=it(n)?i?a=>K(n[a],n[t[a]]):a=>n[a]:()=>n;for(const a of s)e[a]=Yf(r(a));return e}function nl(n){return Ar(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Je(n){return Ar(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Ft(n){const t=nl(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function xt(n,t){n=n||{},t=t||Dt.font;let e=K(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=K(n.style,t.style);i&&!(""+i).match(Hf)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:K(n.family,t.family),lineHeight:Wf(K(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:K(n.weight,t.weight),string:""};return s.string=Af(s),s}function _i(n,t,e,i){let s,r,a;for(s=0,r=n.length;s<r;++s)if(a=n[s],a!==void 0&&a!==void 0)return a}function Vf(n,t,e){const{min:i,max:s}=n,r=Lo(t,(s-i)/2),a=(o,l)=>e&&o===0?0:o+l;return{min:a(i,-Math.abs(r)),max:a(s,r)}}function tn(n,t){return Object.assign(Object.create(n),t)}function Rr(n,t=[""],e,i,s=()=>n[0]){const r=e||n;typeof i>"u"&&(i=ol("_fallback",n));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:o=>Rr([o,...n],t,r,i)};return new Proxy(a,{deleteProperty(o,l){return delete o[l],delete o._keys,delete n[0][l],!0},get(o,l){return sl(o,l,()=>Zf(l,t,n,o))},getOwnPropertyDescriptor(o,l){return Reflect.getOwnPropertyDescriptor(o._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,l){return ll(o).includes(l)},ownKeys(o){return ll(o)},set(o,l,c){const u=o._storage||(o._storage=s());return o[l]=u[l]=c,delete o._keys,!0}})}function Wn(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:il(n,i),setContext:r=>Wn(n,r,e,i),override:r=>Wn(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,a){return delete r[a],delete n[a],!0},get(r,a,o){return sl(r,a,()=>$f(r,a,o))},getOwnPropertyDescriptor(r,a){return r._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(r,a,o){return n[a]=o,delete r[a],!0}})}function il(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Jt(e)?e:()=>e,isIndexable:Jt(i)?i:()=>i}}const jf=(n,t)=>n?n+kr(t):t,Lr=(n,t)=>it(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function sl(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];const i=e();return n[t]=i,i}function $f(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:a}=n;let o=i[t];return Jt(o)&&a.isScriptable(t)&&(o=Uf(t,o,n,e)),ot(o)&&o.length&&(o=qf(t,o,n,a.isIndexable)),Lr(t,o)&&(o=Wn(o,s,r&&r[t],a)),o}function Uf(n,t,e,i){const{_proxy:s,_context:r,_subProxy:a,_stack:o}=e;if(o.has(n))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+n);o.add(n);let l=t(r,a||i);return o.delete(n),Lr(n,l)&&(l=Ir(s._scopes,s,n,l)),l}function qf(n,t,e,i){const{_proxy:s,_context:r,_subProxy:a,_descriptors:o}=e;if(typeof r.index<"u"&&i(n))return t[r.index%t.length];if(it(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const d=Ir(c,s,n,u);t.push(Wn(d,r,a&&a[n],o))}}return t}function rl(n,t,e){return Jt(n)?n(t,e):n}const Xf=(n,t)=>n===!0?t:typeof n=="string"?Ke(t,n):void 0;function Gf(n,t,e,i,s){for(const r of t){const a=Xf(e,r);if(a){n.add(a);const o=rl(a._fallback,e,s);if(typeof o<"u"&&o!==e&&o!==i)return o}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function Ir(n,t,e,i){const s=t._rootScopes,r=rl(t._fallback,e,i),a=[...n,...s],o=new Set;o.add(i);let l=al(o,a,e,r||e,i);return l===null||typeof r<"u"&&r!==e&&(l=al(o,a,r,l,i),l===null)?!1:Rr(Array.from(o),[""],s,r,()=>Kf(t,e,i))}function al(n,t,e,i,s){for(;e;)e=Gf(n,t,e,i,s);return e}function Kf(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return ot(s)&&it(e)?e:s||{}}function Zf(n,t,e,i){let s;for(const r of t)if(s=ol(jf(r,n),e),typeof s<"u")return Lr(n,s)?Ir(e,i,n,s):s}function ol(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function ll(n){let t=n._keys;return t||(t=n._keys=Qf(n._scopes)),t}function Qf(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function cl(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,a=new Array(i);let o,l,c,u;for(o=0,l=i;o<l;++o)c=o+e,u=t[c],a[o]={r:s.parse(Ke(u,r),c)};return a}const Jf=Number.EPSILON||1e-14,Yn=(n,t)=>t<n.length&&!n[t].skip&&n[t],ul=n=>n==="x"?"y":"x";function tg(n,t,e,i){const s=n.skip?t:n,r=t,a=e.skip?t:e,o=Bn(r,s),l=Bn(a,r);let c=o/(o+l),u=l/(o+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=i*c,h=i*u;return{previous:{x:r.x-d*(a.x-s.x),y:r.y-d*(a.y-s.y)},next:{x:r.x+h*(a.x-s.x),y:r.y+h*(a.y-s.y)}}}function eg(n,t,e){const i=n.length;let s,r,a,o,l,c=Yn(n,0);for(let u=0;u<i-1;++u)if(l=c,c=Yn(n,u+1),!(!l||!c)){if(fi(t[u],0,Jf)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],r=e[u+1]/t[u],o=Math.pow(s,2)+Math.pow(r,2),!(o<=9)&&(a=3/Math.sqrt(o),e[u]=s*a*t[u],e[u+1]=r*a*t[u])}}function ng(n,t,e="x"){const i=ul(e),s=n.length;let r,a,o,l=Yn(n,0);for(let c=0;c<s;++c){if(a=o,o=l,l=Yn(n,c+1),!o)continue;const u=o[e],d=o[i];a&&(r=(u-a[e])/3,o[`cp1${e}`]=u-r,o[`cp1${i}`]=d-r*t[c]),l&&(r=(l[e]-u)/3,o[`cp2${e}`]=u+r,o[`cp2${i}`]=d+r*t[c])}}function ig(n,t="x"){const e=ul(t),i=n.length,s=Array(i).fill(0),r=Array(i);let a,o,l,c=Yn(n,0);for(a=0;a<i;++a)if(o=l,l=c,c=Yn(n,a+1),!!l){if(c){const u=c[t]-l[t];s[a]=u!==0?(c[e]-l[e])/u:0}r[a]=o?c?Se(s[a-1])!==Se(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}eg(n,s,r),ng(n,r,t)}function fs(n,t,e){return Math.max(Math.min(n,e),t)}function sg(n,t){let e,i,s,r,a,o=Ne(n[0],t);for(e=0,i=n.length;e<i;++e)a=r,r=o,o=e<i-1&&Ne(n[e+1],t),r&&(s=n[e],a&&(s.cp1x=fs(s.cp1x,t.left,t.right),s.cp1y=fs(s.cp1y,t.top,t.bottom)),o&&(s.cp2x=fs(s.cp2x,t.left,t.right),s.cp2y=fs(s.cp2y,t.top,t.bottom)))}function rg(n,t,e,i,s){let r,a,o,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")ig(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,a=n.length;r<a;++r)o=n[r],l=tg(c,o,n[Math.min(r+1,a-(i?0:1))%a],t.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,c=o}t.capBezierPoints&&sg(n,e)}function Nr(){return typeof window<"u"&&typeof document<"u"}function Fr(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function gs(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}const ps=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function ag(n,t){return ps(n).getPropertyValue(t)}const og=["top","right","bottom","left"];function wn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=og[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const lg=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function cg(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let a=!1,o,l;if(lg(s,r,n.target))o=s,l=r;else{const c=t.getBoundingClientRect();o=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:o,y:l,box:a}}function en(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=ps(e),r=s.boxSizing==="border-box",a=wn(s,"padding"),o=wn(s,"border","width"),{x:l,y:c,box:u}=cg(n,e),d=a.left+(u&&o.left),h=a.top+(u&&o.top);let{width:g,height:p}=t;return r&&(g-=a.width+o.width,p-=a.height+o.height),{x:Math.round((l-d)/g*e.width/i),y:Math.round((c-h)/p*e.height/i)}}function ug(n,t,e){let i,s;if(t===void 0||e===void 0){const r=n&&Fr(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const a=r.getBoundingClientRect(),o=ps(r),l=wn(o,"border","width"),c=wn(o,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=gs(o.maxWidth,r,"clientWidth"),s=gs(o.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||os,maxHeight:s||os}}const ms=n=>Math.round(n*10)/10;function dg(n,t,e,i){const s=ps(n),r=wn(s,"margin"),a=gs(s.maxWidth,n,"clientWidth")||os,o=gs(s.maxHeight,n,"clientHeight")||os,l=ug(n,t,e);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const h=wn(s,"border","width"),g=wn(s,"padding");c-=g.width+h.width,u-=g.height+h.height}return c=Math.max(0,c-r.width),u=Math.max(0,i?c/i:u-r.height),c=ms(Math.min(c,a,l.maxWidth)),u=ms(Math.min(u,o,l.maxHeight)),c&&!u&&(u=ms(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ms(Math.floor(u*i))),{width:c,height:u}}function dl(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==r?(n.currentDevicePixelRatio=i,a.height=s,a.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const hg=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};Nr()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function hl(n,t){const e=ag(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function vn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function fg(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function gg(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},a=vn(n,s,e),o=vn(s,r,e),l=vn(r,t,e),c=vn(a,o,e),u=vn(o,l,e);return vn(c,u,e)}const pg=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},mg=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Vn(n,t,e){return n?pg(t,e):mg()}function fl(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function gl(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function pl(n){return n==="angle"?{between:gi,compare:yf,normalize:ue}:{between:Le,compare:(t,e)=>t-e,normalize:t=>t}}function ml({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function yg(n,t,e){const{property:i,start:s,end:r}=e,{between:a,normalize:o}=pl(i),l=t.length;let{start:c,end:u,loop:d}=n,h,g;if(d){for(c+=l,u+=l,h=0,g=l;h<g&&a(o(t[c%l][i]),s,r);++h)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:n.style}}function yl(n,t,e){if(!e)return[n];const{property:i,start:s,end:r}=e,a=t.length,{compare:o,between:l,normalize:c}=pl(i),{start:u,end:d,loop:h,style:g}=yg(n,t,e),p=[];let y=!1,x=null,w,v,M;const C=()=>l(s,M,w)&&o(s,M)!==0,D=()=>o(r,w)===0||l(r,M,w),E=()=>y||C(),T=()=>!y||D();for(let b=u,_=u;b<=d;++b)v=t[b%a],!v.skip&&(w=c(v[i]),w!==M&&(y=l(w,s,r),x===null&&E()&&(x=o(w,s)===0?b:_),x!==null&&T()&&(p.push(ml({start:x,end:b,loop:h,count:a,style:g})),x=null),_=b,M=w));return x!==null&&p.push(ml({start:x,end:d,loop:h,count:a,style:g})),p}function bl(n,t){const e=[],i=n.segments;for(let s=0;s<i.length;s++){const r=yl(i[s],n.points,t);r.length&&e.push(...r)}return e}function bg(n,t,e,i){let s=0,r=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(r+=s);r>s&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function xg(n,t,e,i){const s=n.length,r=[];let a=t,o=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?o.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=a=c.stop?l:null):(a=l,o.skip&&(t=l)),o=c}return a!==null&&r.push({start:t%s,end:a%s,loop:i}),r}function _g(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:a,end:o}=bg(e,s,r,i);if(i===!0)return xl(n,[{start:a,end:o,loop:r}],e,t);const l=o<a?o+s:o,c=!!n._fullLoop&&a===0&&o===s-1;return xl(n,xg(e,a,l,c),e,t)}function xl(n,t,e,i){return!i||!i.setContext||!e?t:wg(n,t,e,i)}function wg(n,t,e,i){const s=n._chart.getContext(),r=_l(n.options),{_datasetIndex:a,options:{spanGaps:o}}=n,l=e.length,c=[];let u=r,d=t[0].start,h=d;function g(p,y,x,w){const v=o?-1:1;if(p!==y){for(p+=l;e[p%l].skip;)p-=v;for(;e[y%l].skip;)y+=v;p%l!==y%l&&(c.push({start:p%l,end:y%l,loop:x,style:w}),u=w,d=y%l)}}for(const p of t){d=o?d:p.start;let y=e[d%l],x;for(h=d+1;h<=p.end;h++){const w=e[h%l];x=_l(i.setContext(tn(s,{type:"segment",p0:y,p1:w,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:a}))),vg(x,u)&&g(d,h-1,p.loop,u),y=w,u=x}d<h-1&&g(d,h-1,p.loop,u)}return c}function _l(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function vg(n,t){if(!t)return!1;const e=[],i=function(s,r){return Tr(r)?(e.includes(r)||e.push(r),e.indexOf(r)):r};return JSON.stringify(n,i)!==JSON.stringify(t,i)}/*!
11
+ */function Re(){}const of=(()=>{let n=0;return()=>n++})();function J(n){return n===null||typeof n>"u"}function ot(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function it(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function kt(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function ce(n,t){return kt(n)?n:t}function K(n,t){return typeof n>"u"?t:n}const lf=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Lo=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function ut(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function dt(n,t,e,i){let s,r,a;if(ot(n))for(r=n.length,s=0;s<r;s++)t.call(e,n[s],s);else if(it(n))for(a=Object.keys(n),r=a.length,s=0;s<r;s++)t.call(e,n[a[s]],a[s])}function rs(n,t){let e,i,s,r;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],r=t[e],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function as(n){if(ot(n))return n.map(as);if(it(n)){const t=Object.create(null),e=Object.keys(n),i=e.length;let s=0;for(;s<i;++s)t[e[s]]=as(n[e[s]]);return t}return n}function Io(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function cf(n,t,e,i){if(!Io(n))return;const s=t[n],r=e[n];it(s)&&it(r)?di(s,r,i):t[n]=as(r)}function di(n,t,e){const i=ot(t)?t:[t],s=i.length;if(!it(n))return n;e=e||{};const r=e.merger||cf;let a;for(let o=0;o<s;++o){if(a=i[o],!it(a))continue;const l=Object.keys(a);for(let c=0,u=l.length;c<u;++c)r(l[c],n,a,e)}return n}function hi(n,t){return di(n,t,{merger:uf})}function uf(n,t,e){if(!Io(n))return;const i=t[n],s=e[n];it(i)&&it(s)?hi(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=as(s))}const No={"":n=>n,x:n=>n.x,y:n=>n.y};function df(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function hf(n){const t=df(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Ke(n,t){return(No[t]||(No[t]=hf(t)))(n)}function kr(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Qt=n=>typeof n<"u",Jt=n=>typeof n=="function",Fo=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function ff(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const rt=Math.PI,yt=2*rt,gf=yt+rt,os=Number.POSITIVE_INFINITY,Mr=rt/180,bt=rt/2,fe=rt/4,ls=rt*2/3,Ze=Math.log10,Se=Math.sign;function fi(n,t,e){return Math.abs(n-t)<e}function zo(n){const t=Math.round(n);n=fi(n,t,n/1e3)?t:n;const e=Math.pow(10,Math.floor(Ze(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function pf(n){const t=[],e=Math.sqrt(n);let i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,r)=>s-r).pop(),t}function Qe(n){return!isNaN(parseFloat(n))&&isFinite(n)}function mf(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Bo(n,t,e){let i,s,r;for(i=0,s=n.length;i<s;i++)r=n[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function Nt(n){return n*(rt/180)}function cs(n){return n*(180/rt)}function Ho(n){if(!kt(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function Wo(n,t){const e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i);let r=Math.atan2(i,e);return r<-.5*rt&&(r+=yt),{angle:r,distance:s}}function Bn(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function yf(n,t){return(n-t+gf)%yt-rt}function ue(n){return(n%yt+yt)%yt}function gi(n,t,e,i){const s=ue(n),r=ue(t),a=ue(e),o=ue(r-s),l=ue(a-s),c=ue(s-r),u=ue(s-a);return s===r||s===a||i&&r===a||o>l&&c<u}function Ht(n,t,e){return Math.max(t,Math.min(e,n))}function bf(n){return Ht(n,-32768,32767)}function Le(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function Sr(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,r;for(;i-s>1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}const Ie=(n,t,e,i)=>Sr(n,e,i?s=>{const r=n[s][t];return r<e||r===e&&n[s+1][t]===e}:s=>n[s][t]<e),xf=(n,t,e)=>Sr(n,e,i=>n[i][t]>=e);function _f(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}const Yo=["push","pop","shift","splice","unshift"];function wf(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Yo.forEach(e=>{const i="_onData"+kr(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...r){const a=s.apply(this,r);return n._chartjs.listeners.forEach(o=>{typeof o[i]=="function"&&o[i](...r)}),a}})})}function Vo(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Yo.forEach(r=>{delete n[r]}),delete n._chartjs)}function jo(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const $o=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function qo(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,$o.call(window,()=>{i=!1,n.apply(t,e)}))}}function vf(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Dr=n=>n==="start"?"left":n==="end"?"right":"center",jt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,kf=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Uo(n,t,e){const i=t.length;let s=0,r=i;if(n._sorted){const{iScale:a,_parsed:o}=n,l=a.axis,{min:c,max:u,minDefined:d,maxDefined:h}=a.getUserBounds();d&&(s=Ht(Math.min(Ie(o,l,c).lo,e?i:Ie(t,l,a.getPixelForValue(c)).lo),0,i-1)),h?r=Ht(Math.max(Ie(o,a.axis,u,!0).hi+1,e?0:Ie(t,l,a.getPixelForValue(u),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Xo(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),r}const us=n=>n===0||n===1,Go=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*yt/e)),Ko=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*yt/e)+1,pi={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*bt)+1,easeOutSine:n=>Math.sin(n*bt),easeInOutSine:n=>-.5*(Math.cos(rt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>us(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>us(n)?n:Go(n,.075,.3),easeOutElastic:n=>us(n)?n:Ko(n,.075,.3),easeInOutElastic(n){return us(n)?n:n<.5?.5*Go(n*2,.1125,.45):.5+.5*Ko(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-pi.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?pi.easeInBounce(n*2)*.5:pi.easeOutBounce(n*2-1)*.5+.5};function Tr(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Zo(n){return Tr(n)?n:new ui(n)}function Cr(n){return Tr(n)?n:new ui(n).saturate(.5).darken(.1).hexString()}const Mf=["x","y","borderWidth","radius","tension"],Sf=["color","borderColor","backgroundColor"];function Df(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Sf},numbers:{type:"number",properties:Mf}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Tf(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Qo=new Map;function Cf(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Qo.get(e);return i||(i=new Intl.NumberFormat(n,t),Qo.set(e,i)),i}function mi(n,t,e){return Cf(t,e).format(n)}const Jo={values(n){return ot(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,r=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),r=Pf(n,e)}const a=Ze(Math.abs(r)),o=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(l,this.options.ticks.format),mi(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(Ze(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Jo.numeric.call(this,n,t,e):""}};function Pf(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var ds={formatters:Jo};function Of(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ds.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const bn=Object.create(null),Pr=Object.create(null);function yi(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.length;i<s;++i){const r=e[i];n=n[r]||(n[r]=Object.create(null))}return n}function Or(n,t,e){return typeof t=="string"?di(yi(n,t),e):di(yi(n,""),t)}class Ef{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Cr(s.backgroundColor),this.hoverBorderColor=(i,s)=>Cr(s.borderColor),this.hoverColor=(i,s)=>Cr(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Or(this,t,e)}get(t){return yi(this,t)}describe(t,e){return Or(Pr,t,e)}override(t,e){return Or(bn,t,e)}route(t,e,i,s){const r=yi(this,t),a=yi(this,i),o="_"+e;Object.defineProperties(r,{[o]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[o],c=a[s];return it(l)?Object.assign({},c,l):K(l,c)},set(l){this[o]=l}}})}apply(t){t.forEach(e=>e(this))}}var Dt=new Ef({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Df,Tf,Of]);function Af(n){return!n||J(n.size)||J(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function hs(n,t,e,i,s){let r=t[s];return r||(r=t[s]=n.measureText(s).width,e.push(s)),r>i&&(i=r),i}function Rf(n,t,e,i){i=i||{};let s=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},r=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let a=0;const o=e.length;let l,c,u,d,h;for(l=0;l<o;l++)if(d=e[l],d!=null&&!ot(d))a=hs(n,s,r,a,d);else if(ot(d))for(c=0,u=d.length;c<u;c++)h=d[c],h!=null&&!ot(h)&&(a=hs(n,s,r,a,h));n.restore();const g=r.length/2;if(g>e.length){for(l=0;l<g;l++)delete s[r[l]];r.splice(0,g)}return a}function xn(n,t,e){const i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function tl(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function Er(n,t,e,i){el(n,t,e,i,null)}function el(n,t,e,i,s){let r,a,o,l,c,u,d,h;const g=t.pointStyle,p=t.rotation,y=t.radius;let x=(p||0)*Mr;if(g&&typeof g=="object"&&(r=g.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(x),n.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),n.restore();return}if(!(isNaN(y)||y<=0)){switch(n.beginPath(),g){default:s?n.ellipse(e,i,s/2,y,0,0,yt):n.arc(e,i,y,0,yt),n.closePath();break;case"triangle":u=s?s/2:y,n.moveTo(e+Math.sin(x)*u,i-Math.cos(x)*y),x+=ls,n.lineTo(e+Math.sin(x)*u,i-Math.cos(x)*y),x+=ls,n.lineTo(e+Math.sin(x)*u,i-Math.cos(x)*y),n.closePath();break;case"rectRounded":c=y*.516,l=y-c,a=Math.cos(x+fe)*l,d=Math.cos(x+fe)*(s?s/2-c:l),o=Math.sin(x+fe)*l,h=Math.sin(x+fe)*(s?s/2-c:l),n.arc(e-d,i-o,c,x-rt,x-bt),n.arc(e+h,i-a,c,x-bt,x),n.arc(e+d,i+o,c,x,x+bt),n.arc(e-h,i+a,c,x+bt,x+rt),n.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*y,u=s?s/2:l,n.rect(e-u,i-l,2*u,2*l);break}x+=fe;case"rectRot":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+h,i-a),n.lineTo(e+d,i+o),n.lineTo(e-h,i+a),n.closePath();break;case"crossRot":x+=fe;case"cross":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a);break;case"star":d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a),x+=fe,d=Math.cos(x)*(s?s/2:y),a=Math.cos(x)*y,o=Math.sin(x)*y,h=Math.sin(x)*(s?s/2:y),n.moveTo(e-d,i-o),n.lineTo(e+d,i+o),n.moveTo(e+h,i-a),n.lineTo(e-h,i+a);break;case"line":a=s?s/2:Math.cos(x)*y,o=Math.sin(x)*y,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(x)*(s?s/2:y),i+Math.sin(x)*y);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function Ne(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function bi(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function xi(n){n.restore()}function Lf(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){const r=(t.x+e.x)/2;n.lineTo(r,t.y),n.lineTo(r,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function If(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function Nf(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),J(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Ff(n,t,e,i,s){if(s.strikethrough||s.underline){const r=n.measureText(i),a=t-r.actualBoundingBoxLeft,o=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,u),n.lineTo(o,u),n.stroke()}}function zf(n,t){const e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function _n(n,t,e,i,s,r={}){const a=ot(t)?t:[t],o=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,Nf(n,r),l=0;l<a.length;++l)c=a[l],r.backdrop&&zf(n,r.backdrop),o&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),J(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,e,i,r.maxWidth)),n.fillText(c,e,i,r.maxWidth),Ff(n,e,i,c,r),i+=Number(s.lineHeight);n.restore()}function Hn(n,t){const{x:e,y:i,w:s,h:r,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*rt,rt,!0),n.lineTo(e,i+r-a.bottomLeft),n.arc(e+a.bottomLeft,i+r-a.bottomLeft,a.bottomLeft,rt,bt,!0),n.lineTo(e+s-a.bottomRight,i+r),n.arc(e+s-a.bottomRight,i+r-a.bottomRight,a.bottomRight,bt,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-bt,!0),n.lineTo(e+a.topLeft,i)}const Bf=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Hf=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Wf(n,t){const e=(""+n).match(Bf);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}const Yf=n=>+n||0;function Ar(n,t){const e={},i=it(t),s=i?Object.keys(t):t,r=it(n)?i?a=>K(n[a],n[t[a]]):a=>n[a]:()=>n;for(const a of s)e[a]=Yf(r(a));return e}function nl(n){return Ar(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Je(n){return Ar(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Ft(n){const t=nl(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function xt(n,t){n=n||{},t=t||Dt.font;let e=K(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=K(n.style,t.style);i&&!(""+i).match(Hf)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:K(n.family,t.family),lineHeight:Wf(K(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:K(n.weight,t.weight),string:""};return s.string=Af(s),s}function _i(n,t,e,i){let s,r,a;for(s=0,r=n.length;s<r;++s)if(a=n[s],a!==void 0&&a!==void 0)return a}function Vf(n,t,e){const{min:i,max:s}=n,r=Lo(t,(s-i)/2),a=(o,l)=>e&&o===0?0:o+l;return{min:a(i,-Math.abs(r)),max:a(s,r)}}function tn(n,t){return Object.assign(Object.create(n),t)}function Rr(n,t=[""],e,i,s=()=>n[0]){const r=e||n;typeof i>"u"&&(i=ol("_fallback",n));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:r,_fallback:i,_getTarget:s,override:o=>Rr([o,...n],t,r,i)};return new Proxy(a,{deleteProperty(o,l){return delete o[l],delete o._keys,delete n[0][l],!0},get(o,l){return sl(o,l,()=>Zf(l,t,n,o))},getOwnPropertyDescriptor(o,l){return Reflect.getOwnPropertyDescriptor(o._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,l){return ll(o).includes(l)},ownKeys(o){return ll(o)},set(o,l,c){const u=o._storage||(o._storage=s());return o[l]=u[l]=c,delete o._keys,!0}})}function Wn(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:il(n,i),setContext:r=>Wn(n,r,e,i),override:r=>Wn(n.override(r),t,e,i)};return new Proxy(s,{deleteProperty(r,a){return delete r[a],delete n[a],!0},get(r,a,o){return sl(r,a,()=>$f(r,a,o))},getOwnPropertyDescriptor(r,a){return r._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(r,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(r,a,o){return n[a]=o,delete r[a],!0}})}function il(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:Jt(e)?e:()=>e,isIndexable:Jt(i)?i:()=>i}}const jf=(n,t)=>n?n+kr(t):t,Lr=(n,t)=>it(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function sl(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];const i=e();return n[t]=i,i}function $f(n,t,e){const{_proxy:i,_context:s,_subProxy:r,_descriptors:a}=n;let o=i[t];return Jt(o)&&a.isScriptable(t)&&(o=qf(t,o,n,e)),ot(o)&&o.length&&(o=Uf(t,o,n,a.isIndexable)),Lr(t,o)&&(o=Wn(o,s,r&&r[t],a)),o}function qf(n,t,e,i){const{_proxy:s,_context:r,_subProxy:a,_stack:o}=e;if(o.has(n))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+n);o.add(n);let l=t(r,a||i);return o.delete(n),Lr(n,l)&&(l=Ir(s._scopes,s,n,l)),l}function Uf(n,t,e,i){const{_proxy:s,_context:r,_subProxy:a,_descriptors:o}=e;if(typeof r.index<"u"&&i(n))return t[r.index%t.length];if(it(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const d=Ir(c,s,n,u);t.push(Wn(d,r,a&&a[n],o))}}return t}function rl(n,t,e){return Jt(n)?n(t,e):n}const Xf=(n,t)=>n===!0?t:typeof n=="string"?Ke(t,n):void 0;function Gf(n,t,e,i,s){for(const r of t){const a=Xf(e,r);if(a){n.add(a);const o=rl(a._fallback,e,s);if(typeof o<"u"&&o!==e&&o!==i)return o}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function Ir(n,t,e,i){const s=t._rootScopes,r=rl(t._fallback,e,i),a=[...n,...s],o=new Set;o.add(i);let l=al(o,a,e,r||e,i);return l===null||typeof r<"u"&&r!==e&&(l=al(o,a,r,l,i),l===null)?!1:Rr(Array.from(o),[""],s,r,()=>Kf(t,e,i))}function al(n,t,e,i,s){for(;e;)e=Gf(n,t,e,i,s);return e}function Kf(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return ot(s)&&it(e)?e:s||{}}function Zf(n,t,e,i){let s;for(const r of t)if(s=ol(jf(r,n),e),typeof s<"u")return Lr(n,s)?Ir(e,i,n,s):s}function ol(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function ll(n){let t=n._keys;return t||(t=n._keys=Qf(n._scopes)),t}function Qf(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function cl(n,t,e,i){const{iScale:s}=n,{key:r="r"}=this._parsing,a=new Array(i);let o,l,c,u;for(o=0,l=i;o<l;++o)c=o+e,u=t[c],a[o]={r:s.parse(Ke(u,r),c)};return a}const Jf=Number.EPSILON||1e-14,Yn=(n,t)=>t<n.length&&!n[t].skip&&n[t],ul=n=>n==="x"?"y":"x";function tg(n,t,e,i){const s=n.skip?t:n,r=t,a=e.skip?t:e,o=Bn(r,s),l=Bn(a,r);let c=o/(o+l),u=l/(o+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const d=i*c,h=i*u;return{previous:{x:r.x-d*(a.x-s.x),y:r.y-d*(a.y-s.y)},next:{x:r.x+h*(a.x-s.x),y:r.y+h*(a.y-s.y)}}}function eg(n,t,e){const i=n.length;let s,r,a,o,l,c=Yn(n,0);for(let u=0;u<i-1;++u)if(l=c,c=Yn(n,u+1),!(!l||!c)){if(fi(t[u],0,Jf)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],r=e[u+1]/t[u],o=Math.pow(s,2)+Math.pow(r,2),!(o<=9)&&(a=3/Math.sqrt(o),e[u]=s*a*t[u],e[u+1]=r*a*t[u])}}function ng(n,t,e="x"){const i=ul(e),s=n.length;let r,a,o,l=Yn(n,0);for(let c=0;c<s;++c){if(a=o,o=l,l=Yn(n,c+1),!o)continue;const u=o[e],d=o[i];a&&(r=(u-a[e])/3,o[`cp1${e}`]=u-r,o[`cp1${i}`]=d-r*t[c]),l&&(r=(l[e]-u)/3,o[`cp2${e}`]=u+r,o[`cp2${i}`]=d+r*t[c])}}function ig(n,t="x"){const e=ul(t),i=n.length,s=Array(i).fill(0),r=Array(i);let a,o,l,c=Yn(n,0);for(a=0;a<i;++a)if(o=l,l=c,c=Yn(n,a+1),!!l){if(c){const u=c[t]-l[t];s[a]=u!==0?(c[e]-l[e])/u:0}r[a]=o?c?Se(s[a-1])!==Se(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}eg(n,s,r),ng(n,r,t)}function fs(n,t,e){return Math.max(Math.min(n,e),t)}function sg(n,t){let e,i,s,r,a,o=Ne(n[0],t);for(e=0,i=n.length;e<i;++e)a=r,r=o,o=e<i-1&&Ne(n[e+1],t),r&&(s=n[e],a&&(s.cp1x=fs(s.cp1x,t.left,t.right),s.cp1y=fs(s.cp1y,t.top,t.bottom)),o&&(s.cp2x=fs(s.cp2x,t.left,t.right),s.cp2y=fs(s.cp2y,t.top,t.bottom)))}function rg(n,t,e,i,s){let r,a,o,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")ig(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,a=n.length;r<a;++r)o=n[r],l=tg(c,o,n[Math.min(r+1,a-(i?0:1))%a],t.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,c=o}t.capBezierPoints&&sg(n,e)}function Nr(){return typeof window<"u"&&typeof document<"u"}function Fr(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function gs(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}const ps=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function ag(n,t){return ps(n).getPropertyValue(t)}const og=["top","right","bottom","left"];function wn(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const r=og[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const lg=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function cg(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i;let a=!1,o,l;if(lg(s,r,n.target))o=s,l=r;else{const c=t.getBoundingClientRect();o=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:o,y:l,box:a}}function en(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=ps(e),r=s.boxSizing==="border-box",a=wn(s,"padding"),o=wn(s,"border","width"),{x:l,y:c,box:u}=cg(n,e),d=a.left+(u&&o.left),h=a.top+(u&&o.top);let{width:g,height:p}=t;return r&&(g-=a.width+o.width,p-=a.height+o.height),{x:Math.round((l-d)/g*e.width/i),y:Math.round((c-h)/p*e.height/i)}}function ug(n,t,e){let i,s;if(t===void 0||e===void 0){const r=n&&Fr(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{const a=r.getBoundingClientRect(),o=ps(r),l=wn(o,"border","width"),c=wn(o,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=gs(o.maxWidth,r,"clientWidth"),s=gs(o.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||os,maxHeight:s||os}}const ms=n=>Math.round(n*10)/10;function dg(n,t,e,i){const s=ps(n),r=wn(s,"margin"),a=gs(s.maxWidth,n,"clientWidth")||os,o=gs(s.maxHeight,n,"clientHeight")||os,l=ug(n,t,e);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const h=wn(s,"border","width"),g=wn(s,"padding");c-=g.width+h.width,u-=g.height+h.height}return c=Math.max(0,c-r.width),u=Math.max(0,i?c/i:u-r.height),c=ms(Math.min(c,a,l.maxWidth)),u=ms(Math.min(u,o,l.maxHeight)),c&&!u&&(u=ms(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ms(Math.floor(u*i))),{width:c,height:u}}function dl(n,t,e){const i=t||1,s=Math.floor(n.height*i),r=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==r?(n.currentDevicePixelRatio=i,a.height=s,a.width=r,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const hg=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};Nr()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function hl(n,t){const e=ag(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function vn(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function fg(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function gg(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},a=vn(n,s,e),o=vn(s,r,e),l=vn(r,t,e),c=vn(a,o,e),u=vn(o,l,e);return vn(c,u,e)}const pg=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},mg=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Vn(n,t,e){return n?pg(t,e):mg()}function fl(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function gl(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function pl(n){return n==="angle"?{between:gi,compare:yf,normalize:ue}:{between:Le,compare:(t,e)=>t-e,normalize:t=>t}}function ml({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function yg(n,t,e){const{property:i,start:s,end:r}=e,{between:a,normalize:o}=pl(i),l=t.length;let{start:c,end:u,loop:d}=n,h,g;if(d){for(c+=l,u+=l,h=0,g=l;h<g&&a(o(t[c%l][i]),s,r);++h)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:n.style}}function yl(n,t,e){if(!e)return[n];const{property:i,start:s,end:r}=e,a=t.length,{compare:o,between:l,normalize:c}=pl(i),{start:u,end:d,loop:h,style:g}=yg(n,t,e),p=[];let y=!1,x=null,w,v,M;const C=()=>l(s,M,w)&&o(s,M)!==0,D=()=>o(r,w)===0||l(r,M,w),E=()=>y||C(),T=()=>!y||D();for(let b=u,_=u;b<=d;++b)v=t[b%a],!v.skip&&(w=c(v[i]),w!==M&&(y=l(w,s,r),x===null&&E()&&(x=o(w,s)===0?b:_),x!==null&&T()&&(p.push(ml({start:x,end:b,loop:h,count:a,style:g})),x=null),_=b,M=w));return x!==null&&p.push(ml({start:x,end:d,loop:h,count:a,style:g})),p}function bl(n,t){const e=[],i=n.segments;for(let s=0;s<i.length;s++){const r=yl(i[s],n.points,t);r.length&&e.push(...r)}return e}function bg(n,t,e,i){let s=0,r=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(r+=s);r>s&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function xg(n,t,e,i){const s=n.length,r=[];let a=t,o=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?o.skip||(i=!1,r.push({start:t%s,end:(l-1)%s,loop:i}),t=a=c.stop?l:null):(a=l,o.skip&&(t=l)),o=c}return a!==null&&r.push({start:t%s,end:a%s,loop:i}),r}function _g(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const r=!!n._loop,{start:a,end:o}=bg(e,s,r,i);if(i===!0)return xl(n,[{start:a,end:o,loop:r}],e,t);const l=o<a?o+s:o,c=!!n._fullLoop&&a===0&&o===s-1;return xl(n,xg(e,a,l,c),e,t)}function xl(n,t,e,i){return!i||!i.setContext||!e?t:wg(n,t,e,i)}function wg(n,t,e,i){const s=n._chart.getContext(),r=_l(n.options),{_datasetIndex:a,options:{spanGaps:o}}=n,l=e.length,c=[];let u=r,d=t[0].start,h=d;function g(p,y,x,w){const v=o?-1:1;if(p!==y){for(p+=l;e[p%l].skip;)p-=v;for(;e[y%l].skip;)y+=v;p%l!==y%l&&(c.push({start:p%l,end:y%l,loop:x,style:w}),u=w,d=y%l)}}for(const p of t){d=o?d:p.start;let y=e[d%l],x;for(h=d+1;h<=p.end;h++){const w=e[h%l];x=_l(i.setContext(tn(s,{type:"segment",p0:y,p1:w,p0DataIndex:(h-1)%l,p1DataIndex:h%l,datasetIndex:a}))),vg(x,u)&&g(d,h-1,p.loop,u),y=w,u=x}d<h-1&&g(d,h-1,p.loop,u)}return c}function _l(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function vg(n,t){if(!t)return!1;const e=[],i=function(s,r){return Tr(r)?(e.includes(r)||e.push(r),e.indexOf(r)):r};return JSON.stringify(n,i)!==JSON.stringify(t,i)}/*!
12
12
  * Chart.js v4.4.4
13
13
  * https://www.chartjs.org
14
14
  * (c) 2024 Chart.js Contributors
15
15
  * Released under the MIT License
16
- */class kg{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const r=e.listeners[s],a=e.duration;r.forEach(o=>o({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=$o.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let a=r.length-1,o=!1,l;for(;a>=0;--a)l=r[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),o=!0):(r[a]=r[r.length-1],r.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Fe=new kg;const wl="transparent",Mg={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Zo(n||wl),s=i.valid&&Zo(t||wl);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Sg{constructor(t,e,i,s){const r=e[i];s=_i([t.to,s,r,t.from]);const a=_i([t.from,r,s]);this._active=!0,this._fn=t.fn||Mg[t.type||typeof a],this._easing=pi[t.easing]||pi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,a=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=_i([t.to,e,s,t.from]),this._from=_i([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,a=this._loop,o=this._to;let l;if(this._active=r!==o&&(a||e<i),!this._active){this._target[s]=o,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,o,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class zr{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!it(t))return;const e=Object.keys(Dt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const r=t[s];if(!it(r))return;const a={};for(const o of e)a[o]=r[o];(ot(r.properties)&&r.properties||[s]).forEach(o=>{(o===s||!i.has(o))&&i.set(o,a)})})}_animateOptions(t,e){const i=e.options,s=Tg(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&Dg(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[c];let d=r[c];const h=i.get(c);if(d)if(h&&d.active()){d.update(h,u,o);continue}else d.cancel();if(!h||!h.duration){t[c]=u;continue}r[c]=d=new Sg(h,t,c,u),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Fe.add(this._chart,i),!0}}function Dg(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const r=n[i[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function Tg(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function vl(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:s,end:i?s:r}}function Cg(n,t,e){if(e===!1)return!1;const i=vl(n,e),s=vl(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Pg(n){let t,e,i,s;return it(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function kl(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,r;for(s=0,r=i.length;s<r;++s)e.push(i[s].index);return e}function Ml(n,t,e,i={}){const s=n.keys,r=i.mode==="single";let a,o,l,c;if(t!==null){for(a=0,o=s.length;a<o;++a){if(l=+s[a],l===e){if(i.all)continue;break}c=n.values[l],kt(c)&&(r||t===0||Se(t)===Se(c))&&(t+=c)}return t}}function Og(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",r=i.axis==="x"?"x":"y",a=Object.keys(n),o=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],o[l]={[s]:u,[r]:n[u]};return o}function Sl(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function Eg(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Ag(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Rg(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Dl(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const r=n[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function Tl(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:a,index:o}=i,l=r.axis,c=a.axis,u=Eg(r,a,i),d=t.length;let h;for(let g=0;g<d;++g){const p=t[g],{[l]:y,[c]:x}=p,w=p._stacks||(p._stacks={});h=w[c]=Rg(s,u,y),h[o]=x,h._top=Dl(h,a,!0,i.type),h._bottom=Dl(h,a,!1,i.type);const v=h._visualValues||(h._visualValues={});v[o]=x}}function Br(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Lg(n,t){return tn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ig(n,t,e){return tn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function wi(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Hr=n=>n==="reset"||n==="none",Cl=(n,t)=>t?n:Object.assign({},n),Ng=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:kl(e,!0),values:null};class _e{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Sl(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&wi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,h,g,p)=>d==="x"?h:d==="r"?p:g,r=e.xAxisID=K(i.xAxisID,Br(t,"x")),a=e.yAxisID=K(i.yAxisID,Br(t,"y")),o=e.rAxisID=K(i.rAxisID,Br(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,a,o),u=e.vAxisID=s(l,a,r,o);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Vo(this._data,this),t._stacked&&wi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(it(e)){const s=this._cachedMeta;this._data=Og(e,s)}else if(i!==e){if(i){Vo(i,this);const s=this._cachedMeta;wi(s),s._parsed=[]}e&&Object.isExtensible(e)&&wf(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Sl(e.vScale,e),e.stack!==i.stack&&(s=!0,wi(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Tl(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:a}=i,o=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,d,h;if(this._parsing===!1)i._parsed=s,i._sorted=!0,h=s;else{ot(s[t])?h=this.parseArrayData(i,s,t,e):it(s[t])?h=this.parseObjectData(i,s,t,e):h=this.parsePrimitiveData(i,s,t,e);const g=()=>d[o]===null||c&&d[o]<c[o];for(u=0;u<e;++u)i._parsed[u+t]=d=h[u],l&&(g()&&(l=!1),c=d);i._sorted=l}a&&Tl(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:r,vScale:a}=t,o=r.axis,l=a.axis,c=r.getLabels(),u=r===a,d=new Array(s);let h,g,p;for(h=0,g=s;h<g;++h)p=h+i,d[h]={[o]:u||r.parse(c[p],p),[l]:a.parse(e[p],p)};return d}parseArrayData(t,e,i,s){const{xScale:r,yScale:a}=t,o=new Array(s);let l,c,u,d;for(l=0,c=s;l<c;++l)u=l+i,d=e[u],o[l]={x:r.parse(d[0],u),y:a.parse(d[1],u)};return o}parseObjectData(t,e,i,s){const{xScale:r,yScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,d,h,g;for(u=0,d=s;u<d;++u)h=u+i,g=e[h],c[u]={x:r.parse(Ke(g,o),h),y:a.parse(Ke(g,l),h)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,r=this._cachedMeta,a=e[t.axis],o={keys:kl(s,!0),values:e._stacks[t.axis]._visualValues};return Ml(o,a,r.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const r=i[e.axis];let a=r===null?NaN:r;const o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=Ml(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,r=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),l=Ng(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Ag(o);let h,g;function p(){g=s[h];const y=g[o.axis];return!kt(g[t.axis])||u>y||d<y}for(h=0;h<a&&!(!p()&&(this.updateRangeFromParsed(c,t,g,l),r));++h);if(r){for(h=a-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,a;for(s=0,r=e.length;s<r;++s)a=e[s][t.axis],kt(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Pg(K(this.options.clip,Cg(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],r=e.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||s.length-o,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,r,o,l),u=o;u<o+l;++u){const d=s[u];d.hidden||(d.active&&c?a.push(d):d.draw(t,r))}for(u=0;u<a.length;++u)a[u].draw(t,r)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];r=a.$context||(a.$context=Ig(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Lg(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",r=this._cachedDataOpts,a=t+"-"+e,o=r[a],l=this.enableOptionSharing&&Qt(i);if(o)return Cl(o,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Dt.elements[t]),p=()=>this.getContext(i,s,e),y=c.resolveNamedOptions(h,g,p,d);return y.$shared&&(y.$shared=l,r[a]=Object.freeze(Cl(y,l))),y}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,a=`animation-${e}`,o=r[a];if(o)return o;let l;if(s.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,e),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(t,i,e))}const c=new zr(s,l&&l.animations);return l&&l._cacheable&&(r[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Hr(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),a=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:a}}updateElement(t,e,i,s){Hr(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Hr(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];const s=i.length,r=e.length,a=Math.min(r,s);a&&this.parse(0,a),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,i=!0){const s=this._cachedMeta,r=s.data,a=t+e;let o;const l=c=>{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;o<a;++o)r[o]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&wi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}P(_e,"defaults",{}),P(_e,"datasetElementType",null),P(_e,"dataElementType",null);function Fg(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,r=e.length;s<r;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=jo(i.sort((s,r)=>s-r))}return n._cache.$bar}function zg(n){const t=n.iScale,e=Fg(t,n.type);let i=t._length,s,r,a,o;const l=()=>{a===32767||a===-32768||(Qt(o)&&(i=Math.min(i,Math.abs(a-o)||i)),o=a)};for(s=0,r=e.length;s<r;++s)a=t.getPixelForValue(e[s]),l();for(o=void 0,s=0,r=t.ticks.length;s<r;++s)a=t.getPixelForTick(s),l();return i}function Bg(n,t,e,i){const s=e.barThickness;let r,a;return J(s)?(r=t.min*e.categoryPercentage,a=e.barPercentage):(r=s*i,a=1),{chunk:r/i,ratio:a,start:t.pixels[n]-r/2}}function Hg(n,t,e,i){const s=t.pixels,r=s[n];let a=n>0?s[n-1]:null,o=n<s.length-1?s[n+1]:null;const l=e.categoryPercentage;a===null&&(a=r-(o===null?t.end-t.start:o-r)),o===null&&(o=r+r-a);const c=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/i,ratio:e.barPercentage,start:c}}function Wg(n,t,e,i){const s=e.parse(n[0],i),r=e.parse(n[1],i),a=Math.min(s,r),o=Math.max(s,r);let l=a,c=o;Math.abs(a)>Math.abs(o)&&(l=o,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:a,max:o}}function Pl(n,t,e,i){return ot(n)?Wg(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ol(n,t,e,i){const s=n.iScale,r=n.vScale,a=s.getLabels(),o=s===r,l=[];let c,u,d,h;for(c=e,u=e+i;c<u;++c)h=t[c],d={},d[s.axis]=o||s.parse(a[c],c),l.push(Pl(h,d,r,c));return l}function Wr(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function Yg(n,t,e){return n!==0?Se(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Vg(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:i,reverse:t,top:s,bottom:r}}function jg(n,t,e,i){let s=t.borderSkipped;const r={};if(!s){n.borderSkipped=r;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:o,reverse:l,top:c,bottom:u}=Vg(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=u:(r[El(u,a,o,l)]=!0,s=c)),r[El(s,a,o,l)]=!0,n.borderSkipped=r}function El(n,t,e,i){return i?(n=$g(n,t,e),n=Al(n,e,t)):n=Al(n,t,e),n}function $g(n,t,e){return n===t?e:n===e?t:n}function Al(n,t,e){return n==="start"?t:n==="end"?e:n}function Ug(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class vi extends _e{parsePrimitiveData(t,e,i,s){return Ol(t,e,i,s)}parseArrayData(t,e,i,s){return Ol(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:r,vScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?o:l,u=a.axis==="x"?o:l,d=[];let h,g,p,y;for(h=i,g=i+s;h<g;++h)y=e[h],p={},p[r.axis]=r.parse(Ke(y,c),h),d.push(Pl(Ke(y,u),p,a,h));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,r=this.getParsed(t),a=r._custom,o=Wr(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const r=s==="reset",{index:a,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),c=o.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,s);for(let g=e;g<e+i;g++){const p=this.getParsed(g),y=r||J(p[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),x=this._calculateBarIndexPixels(g,u),w=(p._stacks||{})[o.axis],v={horizontal:c,base:y.base,enableBorderRadius:!w||Wr(p._custom)||a===w._top||a===w._bottom,x:c?y.head:x.center,y:c?x.center:y.head,height:c?x.size:Math.abs(y.size),width:c?Math.abs(y.size):x.size};h&&(v.options=d||this.resolveDataElementOptions(g,t[g].active?"active":s));const M=v.options||t[g].options;jg(v,M,w,a),Ug(v,M,u.ratio),this.updateElement(t[g],g,v,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),r=i.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(e),l=o&&o[i.axis],c=u=>{const d=u._parsed.find(g=>g[i.axis]===l),h=d&&d[u.vScale.axis];if(J(h)||isNaN(h))return!0};for(const u of s)if(!(e!==void 0&&c(u))&&((r===!1||a.indexOf(u.stack)===-1||r===void 0&&u.stack===void 0)&&a.push(u.stack),u.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,a;for(r=0,a=e.data.length;r<a;++r)s.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));const o=t.barThickness;return{min:o||zg(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:r,minBarLength:a}}=this,o=r||0,l=this.getParsed(t),c=l._custom,u=Wr(c);let d=l[e.axis],h=0,g=i?this.applyStack(e,l,i):d,p,y;g!==d&&(h=g-d,g=d),u&&(d=c.barStart,g=c.barEnd-c.barStart,d!==0&&Se(d)!==Se(c.barEnd)&&(h=0),h+=d);const x=!J(r)&&!u?r:h;let w=e.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(h+g):p=w,y=p-w,Math.abs(y)<a){y=Yg(y,e,o)*a,d===o&&(w-=y/2);const v=e.getPixelForDecimal(0),M=e.getPixelForDecimal(1),C=Math.min(v,M),D=Math.max(v,M);w=Math.max(Math.min(w,D),C),p=w+y,i&&!u&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(w))}if(w===e.getPixelForValue(o)){const v=Se(y)*e.getLineWidthForValue(o)/2;w+=v,y-=v}return{size:y,base:w,head:p,center:p+y/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,r=s.skipNull,a=K(s.maxBarThickness,1/0);let o,l;if(e.grouped){const c=r?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?Hg(t,e,s,c):Bg(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);o=u.start+u.chunk*d+u.chunk/2,l=Math.min(a,u.chunk*u.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&!i[r].hidden&&i[r].draw(this._ctx)}}P(vi,"id","bar"),P(vi,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),P(vi,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ys extends _e{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const r=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+i).radius;return r}parseArrayData(t,e,i,s){const r=super.parseArrayData(t,e,i,s);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=K(o[2],this.resolveDataElementOptions(a+i).radius)}return r}parseObjectData(t,e,i,s){const r=super.parseObjectData(t,e,i,s);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=K(o&&o.r&&+o.r,this.resolveDataElementOptions(a+i).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),l=r.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+o+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=a.axis,d=o.axis;for(let h=e;h<e+i;h++){const g=t[h],p=!r&&this.getParsed(h),y={},x=y[u]=r?a.getPixelForDecimal(.5):a.getPixelForValue(p[u]),w=y[d]=r?o.getBasePixel():o.getPixelForValue(p[d]);y.skip=isNaN(x)||isNaN(w),c&&(y.options=l||this.resolveDataElementOptions(h,g.active?"active":s),r&&(y.options.radius=0)),this.updateElement(g,h,y,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=K(i&&i._custom,r),s}}P(ys,"id","bubble"),P(ys,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),P(ys,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function qg(n,t,e){let i=1,s=1,r=0,a=0;if(t<yt){const o=n,l=o+t,c=Math.cos(o),u=Math.sin(o),d=Math.cos(l),h=Math.sin(l),g=(M,C,D)=>gi(M,o,l,!0)?1:Math.max(C,C*e,D,D*e),p=(M,C,D)=>gi(M,o,l,!0)?-1:Math.min(C,C*e,D,D*e),y=g(0,c,d),x=g(bt,u,h),w=p(rt,c,d),v=p(rt+bt,u,h);i=(y-w)/2,s=(x-v)/2,r=-(y+w)/2,a=-(x+v)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:a}}class nn extends _e{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(it(i[t])){const{key:l="value"}=this._parsing;r=c=>+Ke(i[c],l)}let a,o;for(a=t,o=t+e;a<o;++a)s._parsed[a]=r(a)}}_getRotation(){return Nt(this.options.rotation-90)}_getCircumference(){return Nt(this.options.circumference)}_getRotationExtents(){let t=yt,e=-yt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,r=s._getRotation(),a=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,r=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(lf(this.options.cutout,o),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:g,offsetX:p,offsetY:y}=qg(d,u,l),x=(i.width-a)/h,w=(i.height-a)/g,v=Math.max(Math.min(x,w)/2,0),M=Lo(this.options.radius,v),C=Math.max(M*l,0),D=(M-C)/this._getVisibleDatasetWeightTotal();this.offsetX=p*M,this.offsetY=y*M,s.total=this.calculateTotal(),this.outerRadius=M-D*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-D*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/yt)}updateElements(t,e,i,s){const r=s==="reset",a=this.chart,o=a.chartArea,c=a.options.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,h=r&&c.animateScale,g=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:y,includeOptions:x}=this._getSharedOptions(e,s);let w=this._getRotation(),v;for(v=0;v<e;++v)w+=this._circumference(v,r);for(v=e;v<e+i;++v){const M=this._circumference(v,r),C=t[v],D={x:u+this.offsetX,y:d+this.offsetY,startAngle:w,endAngle:w+M,circumference:M,outerRadius:p,innerRadius:g};x&&(D.options=y||this.resolveDataElementOptions(v,C.active?"active":s)),w+=M,this.updateElement(C,v,D,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?yt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=mi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,a,o,l;if(!t){for(s=0,r=i.data.datasets.length;s<r;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,o=a.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=o.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(K(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}P(nn,"id","doughnut"),P(nn,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),P(nn,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),P(nn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class ki extends _e{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,a=this.chart._animationsDisabled;let{start:o,count:l}=qo(e,s,a);this._drawStart=o,this._drawCount=l,Xo(e)&&(o=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,o,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,s),h=a.axis,g=o.axis,{spanGaps:p,segment:y}=this.options,x=Qe(p)?p:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||r||s==="none",v=e+i,M=t.length;let C=e>0&&this.getParsed(e-1);for(let D=0;D<M;++D){const E=t[D],T=w?E:{};if(D<e||D>=v){T.skip=!0;continue}const b=this.getParsed(D),_=J(b[g]),S=T[h]=a.getPixelForValue(b[h],D),O=T[g]=r||_?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,b,l):b[g],D);T.skip=isNaN(S)||isNaN(O)||_,T.stop=D>0&&Math.abs(b[h]-C[h])>x,y&&(T.parsed=b,T.raw=c.data[D]),d&&(T.options=u||this.resolveDataElementOptions(D,E.active?"active":s)),w||this.updateElement(E,D,T,s),C=b}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}P(ki,"id","line"),P(ki,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),P(ki,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Mi extends _e{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=mi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return cl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),o=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const r=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,h=c.getIndexAngle(0)-.5*rt;let g=h,p;const y=360/this.countVisibleElements();for(p=0;p<e;++p)g+=this._computeAngle(p,s,y);for(p=e;p<e+i;p++){const x=t[p];let w=g,v=g+this._computeAngle(p,s,y),M=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;g=v,r&&(l.animateScale&&(M=0),l.animateRotate&&(w=v=h));const C={x:u,y:d,innerRadius:0,outerRadius:M,startAngle:w,endAngle:v,options:this.resolveDataElementOptions(p,x.active?"active":s)};this.updateElement(x,p,C,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Nt(this.resolveDataElementOptions(t,e).angle||i):0}}P(Mi,"id","polarArea"),P(Mi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),P(Mi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Yr extends nn{}P(Yr,"id","pie"),P(Yr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class bs extends _e{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return cl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const o={_loop:!0,_fullLoop:r.length===s.length,options:a};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,a=s==="reset";for(let o=e;o<e+i;o++){const l=t[o],c=this.resolveDataElementOptions(o,l.active?"active":s),u=r.getPointPositionForValue(o,this.getParsed(o).r),d=a?r.xCenter:u.x,h=a?r.yCenter:u.y,g={x:d,y:h,angle:u.angle,skip:isNaN(d)||isNaN(h),options:c};this.updateElement(l,o,g,s)}}}P(bs,"id","radar"),P(bs,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),P(bs,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class xs extends _e{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),l=r.getLabelForValue(a.y);return{label:i[t]||"",value:"("+o+", "+l+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=qo(e,i,s);if(this._drawStart=r,this._drawCount=a,Xo(e)&&(r=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:l}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!l._decimated,o.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(o,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,r,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(u),h=this.includeOptions(s,d),g=a.axis,p=o.axis,{spanGaps:y,segment:x}=this.options,w=Qe(y)?y:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||r||s==="none";let M=e>0&&this.getParsed(e-1);for(let C=e;C<e+i;++C){const D=t[C],E=this.getParsed(C),T=v?D:{},b=J(E[p]),_=T[g]=a.getPixelForValue(E[g],C),S=T[p]=r||b?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,E,l):E[p],C);T.skip=isNaN(_)||isNaN(S)||b,T.stop=C>0&&Math.abs(E[g]-M[g])>w,x&&(T.parsed=E,T.raw=c.data[C]),h&&(T.options=d||this.resolveDataElementOptions(C,D.active?"active":s)),v||this.updateElement(D,C,T,s),M=E}this.updateSharedOptions(d,s,u)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let o=0;for(let l=e.length-1;l>=0;--l)o=Math.max(o,e[l].size(this.resolveDataElementOptions(l))/2);return o>0&&o}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,a)/2}}P(xs,"id","scatter"),P(xs,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),P(xs,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var Xg=Object.freeze({__proto__:null,BarController:vi,BubbleController:ys,DoughnutController:nn,LineController:ki,PieController:Yr,PolarAreaController:Mi,RadarController:bs,ScatterController:xs});function kn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vr{constructor(t){P(this,"options");this.options=t||{}}static override(t){Object.assign(Vr.prototype,t)}init(){}formats(){return kn()}parse(){return kn()}format(){return kn()}add(){return kn()}diff(){return kn()}startOf(){return kn()}endOf(){return kn()}}var Rl={_date:Vr};function Gg(n,t,e,i){const{controller:s,data:r,_sorted:a}=n,o=s._cachedMeta.iScale;if(o&&t===o.axis&&t!=="r"&&a&&r.length){const l=o._reversePixels?xf:Ie;if(i){if(s._sharedOptions){const c=r[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const d=l(r,t,e-u),h=l(r,t,e+u);return{lo:d.lo,hi:h.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Si(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),a=e[t];for(let o=0,l=r.length;o<l;++o){const{index:c,data:u}=r[o],{lo:d,hi:h}=Gg(r[o],t,a,s);for(let g=d;g<=h;++g){const p=u[g];p.skip||i(p,c,g)}}}function Kg(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const r=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(a,2))}}function jr(n,t,e,i,s){const r=[];return!s&&!n.isPointInArea(t)||Si(n,e,t,function(o,l,c){!s&&!Ne(o,n.chartArea,0)||o.inRange(t.x,t.y,i)&&r.push({element:o,datasetIndex:l,index:c})},!0),r}function Zg(n,t,e,i){let s=[];function r(a,o,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],i),{angle:d}=Wo(a,{x:t.x,y:t.y});gi(d,c,u)&&s.push({element:a,datasetIndex:o,index:l})}return Si(n,e,t,r),s}function Qg(n,t,e,i,s,r){let a=[];const o=Kg(e);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const p=u.getCenterPoint(s);if(!(!!r||n.isPointInArea(p))&&!g)return;const x=o(t,p);x<l?(a=[{element:u,datasetIndex:d,index:h}],l=x):x===l&&a.push({element:u,datasetIndex:d,index:h})}return Si(n,e,t,c),a}function $r(n,t,e,i,s,r){return!r&&!n.isPointInArea(t)?[]:e==="r"&&!i?Zg(n,t,e,s):Qg(n,t,e,i,s,r)}function Ll(n,t,e,i,s){const r=[],a=e==="x"?"inXRange":"inYRange";let o=!1;return Si(n,e,t,(l,c,u)=>{l[a]&&l[a](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),o=o||l.inRange(t.x,t.y,s))}),i&&!o?[]:r}var Ur={evaluateInteractionItems:Si,modes:{index(n,t,e,i){const s=en(t,n),r=e.axis||"x",a=e.includeInvisible||!1,o=e.intersect?jr(n,s,r,i,a):$r(n,s,r,!1,i,a),l=[];return o.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const u=o[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;let o=e.intersect?jr(n,s,r,i,a):$r(n,s,r,!1,i,a);if(o.length>0){const l=o[0].datasetIndex,c=n.getDatasetMeta(l).data;o=[];for(let u=0;u<c.length;++u)o.push({element:c[u],datasetIndex:l,index:u})}return o},point(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return jr(n,s,r,i,a)},nearest(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return $r(n,s,r,e.intersect,i,a)},x(n,t,e,i){const s=en(t,n);return Ll(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=en(t,n);return Ll(n,s,"y",e.intersect,i)}}};const Il=["left","top","right","bottom"];function Di(n,t){return n.filter(e=>e.pos===t)}function Nl(n,t){return n.filter(e=>Il.indexOf(e.pos)===-1&&e.box.axis===t)}function Ti(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Jg(n){const t=[];let e,i,s,r,a,o;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:r,options:{stack:a,stackWeight:o=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&r+a,stackWeight:o});return t}function tp(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:r}=e;if(!i||!Il.includes(s))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=r}return t}function ep(n,t){const e=tp(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let r,a,o;for(r=0,a=n.length;r<a;++r){o=n[r];const{fullSize:l}=o.box,c=e[o.stack],u=c&&o.stackWeight/c.weight;o.horizontal?(o.width=u?u*i:l&&t.availableWidth,o.height=s):(o.width=i,o.height=u?u*s:l&&t.availableHeight)}return e}function np(n){const t=Jg(n),e=Ti(t.filter(c=>c.box.fullSize),!0),i=Ti(Di(t,"left"),!0),s=Ti(Di(t,"right")),r=Ti(Di(t,"top"),!0),a=Ti(Di(t,"bottom")),o=Nl(t,"x"),l=Nl(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(a).concat(o),chartArea:Di(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(a).concat(o)}}function Fl(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function zl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ip(n,t,e,i){const{pos:s,box:r}=e,a=n.maxPadding;if(!it(s)){e.size&&(n[s]-=e.size);const d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?r.height:r.width),e.size=d.size/d.count,n[s]+=e.size}r.getPadding&&zl(a,r.getPadding());const o=Math.max(0,t.outerWidth-Fl(a,n,"left","right")),l=Math.max(0,t.outerHeight-Fl(a,n,"top","bottom")),c=o!==n.w,u=l!==n.h;return n.w=o,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function sp(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function rp(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{r[a]=Math.max(t[a],e[a])}),r}return i(n?["left","right"]:["top","bottom"])}function Ci(n,t,e,i){const s=[];let r,a,o,l,c,u;for(r=0,a=n.length,c=0;r<a;++r){o=n[r],l=o.box,l.update(o.width||t.w,o.height||t.h,rp(o.horizontal,t));const{same:d,other:h}=ip(t,e,o,i);c|=d&&s.length,u=u||h,l.fullSize||s.push(o)}return c&&Ci(s,t,e,i)||u}function _s(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Bl(n,t,e,i){const s=e.padding;let{x:r,y:a}=t;for(const o of n){const l=o.box,c=i[o.stack]||{count:1,placed:0,weight:1},u=o.stackWeight/c.weight||1;if(o.horizontal){const d=t.w*u,h=c.size||l.height;Qt(c.start)&&(a=c.start),l.fullSize?_s(l,s.left,a,e.outerWidth-s.right-s.left,h):_s(l,t.left+c.placed,a,d,h),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*u,h=c.size||l.width;Qt(c.start)&&(r=c.start),l.fullSize?_s(l,r,s.top,h,e.outerHeight-s.bottom-s.top):_s(l,r,t.top+c.placed,h,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=a}var $t={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=Ft(n.options.layout.padding),r=Math.max(t-s.width,0),a=Math.max(e-s.height,0),o=np(n.boxes),l=o.vertical,c=o.horizontal;dt(n.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,x)=>x.box.options&&x.box.options.display===!1?y:y+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:a,vBoxMaxWidth:r/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},s);zl(h,Ft(i));const g=Object.assign({maxPadding:h,w:r,h:a,x:s.left,y:s.top},s),p=ep(l.concat(c),d);Ci(o.fullSize,g,d,p),Ci(l,g,d,p),Ci(c,g,d,p)&&Ci(l,g,d,p),sp(g),Bl(o.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,Bl(o.rightAndBottom,g,d,p),n.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},dt(o.chartArea,y=>{const x=y.box;Object.assign(x,n.chartArea),x.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Hl{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ap extends Hl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ws="$chartjs",op={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Wl=n=>n===null||n==="";function lp(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[ws]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Wl(s)){const r=hl(n,"width");r!==void 0&&(n.width=r)}if(Wl(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=hl(n,"height");r!==void 0&&(n.height=r)}return n}const Yl=hg?{passive:!0}:!1;function cp(n,t,e){n&&n.addEventListener(t,e,Yl)}function up(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Yl)}function dp(n,t){const e=op[n.type]||n.type,{x:i,y:s}=en(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function vs(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function hp(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||vs(o.addedNodes,i),a=a&&!vs(o.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function fp(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||vs(o.removedNodes,i),a=a&&!vs(o.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Pi=new Map;let Vl=0;function jl(){const n=window.devicePixelRatio;n!==Vl&&(Vl=n,Pi.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function gp(n,t){Pi.size||window.addEventListener("resize",jl),Pi.set(n,t)}function pp(n){Pi.delete(n),Pi.size||window.removeEventListener("resize",jl)}function mp(n,t,e){const i=n.canvas,s=i&&Fr(i);if(!s)return;const r=Uo((o,l)=>{const c=s.clientWidth;e(o,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(o=>{const l=o[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return a.observe(s),gp(n,r),a}function qr(n,t,e){e&&e.disconnect(),t==="resize"&&pp(n)}function yp(n,t,e){const i=n.canvas,s=Uo(r=>{n.ctx!==null&&e(dp(r,n))},n);return cp(i,t,s),s}class bp extends Hl{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(lp(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ws])return!1;const i=e[ws].initial;["height","width"].forEach(r=>{const a=i[r];J(a)?e.removeAttribute(r):e.setAttribute(r,a)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[ws],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:hp,detach:fp,resize:mp}[e]||yp;s[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:qr,detach:qr,resize:qr}[e]||up)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return dg(t,e,i,s)}isAttached(t){const e=t&&Fr(t);return!!(e&&e.isConnected)}}function xp(n){return!Nr()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?ap:bp}class Yt{constructor(){P(this,"x");P(this,"y");P(this,"active",!1);P(this,"options");P(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Qe(this.x)&&Qe(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}P(Yt,"defaults",{}),P(Yt,"defaultRoutes");function _p(n,t){const e=n.options.ticks,i=wp(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?kp(t):[],a=r.length,o=r[0],l=r[a-1],c=[];if(a>s)return Mp(t,c,r,a/s),c;const u=vp(r,t,s);if(a>0){let d,h;const g=a>1?Math.round((l-o)/(a-1)):null;for(ks(t,c,u,J(g)?0:o-g,o),d=0,h=a-1;d<h;d++)ks(t,c,u,r[d],r[d+1]);return ks(t,c,u,l,J(g)?t.length:l+g),c}return ks(t,c,u),c}function wp(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function vp(n,t,e){const i=Sp(n),s=t.length/e;if(!i)return Math.max(s,1);const r=pf(i);for(let a=0,o=r.length-1;a<o;a++){const l=r[a];if(l>s)return l}return Math.max(s,1)}function kp(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Mp(n,t,e,i){let s=0,r=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===r&&(t.push(n[a]),s++,r=e[s*i])}function ks(n,t,e,i,s){const r=K(i,0),a=Math.min(K(s,n.length),n.length);let o=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),u=r;u<0;)o++,u=Math.round(r+o*e);for(c=Math.max(r,0);c<a;c++)c===u&&(t.push(n[c]),o++,u=Math.round(r+o*e))}function Sp(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const Dp=n=>n==="left"?"right":n==="right"?"left":n,$l=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Ul=(n,t)=>Math.min(t||n,n);function ql(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;r<s;r+=i)e.push(n[Math.floor(r)]);return e}function Tp(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),r=n._startPixel,a=n._endPixel,o=1e-6;let l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-r,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-o||l>a+o)))return l}function Cp(n,t){dt(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;r<s;++r)delete e.data[i[r]];i.splice(0,s)}})}function Oi(n){return n.drawTicks?n.tickLength:0}function Xl(n,t){if(!n.display)return 0;const e=xt(n.font,t),i=Ft(n.padding);return(ot(n.text)?n.text.length:1)*e.lineHeight+i.height}function Pp(n,t){return tn(n,{scale:t,type:"scale"})}function Op(n,t,e){return tn(n,{tick:e,index:t,type:"tick"})}function Ep(n,t,e){let i=Dr(n);return(e&&t!=="right"||!e&&t==="right")&&(i=Dp(i)),i}function Ap(n,t,e,i){const{top:s,left:r,bottom:a,right:o,chart:l}=n,{chartArea:c,scales:u}=l;let d=0,h,g,p;const y=a-s,x=o-r;if(n.isHorizontal()){if(g=jt(i,r,o),it(e)){const w=Object.keys(e)[0],v=e[w];p=u[w].getPixelForValue(v)+y-t}else e==="center"?p=(c.bottom+c.top)/2+y-t:p=$l(n,e,t);h=o-r}else{if(it(e)){const w=Object.keys(e)[0],v=e[w];g=u[w].getPixelForValue(v)-x+t}else e==="center"?g=(c.left+c.right)/2-x+t:g=$l(n,e,t);p=jt(i,a,s),d=e==="left"?-bt:bt}return{titleX:g,titleY:p,maxWidth:h,rotation:d}}class Mn extends Yt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=ce(t,Number.POSITIVE_INFINITY),e=ce(e,Number.NEGATIVE_INFINITY),i=ce(i,Number.POSITIVE_INFINITY),s=ce(s,Number.NEGATIVE_INFINITY),{min:ce(t,i),max:ce(e,s),minDefined:kt(t),maxDefined:kt(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),a;if(s&&r)return{min:e,max:i};const o=this.getMatchingVisibleMetas();for(let l=0,c=o.length;l<c;++l)a=o[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),r||(i=Math.max(i,a.max));return e=r&&e>i?i:e,i=s&&e>i?e:i,{min:ce(e,ce(i,e)),max:ce(i,ce(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ut(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Vf(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o<this.ticks.length;this._convertTicksToLabels(l?ql(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=_p(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ut(this.options.afterUpdate,[this])}beforeSetDimensions(){ut(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ut(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ut(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ut(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,r;for(i=0,s=t.length;i<s;i++)r=t[i],r.label=ut(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){ut(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ut(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=Ul(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,r=e.maxRotation;let a=s,o,l,c;if(!this._isVisible()||!e.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,g=Ht(this.chart.width-d,0,this.maxWidth);o=t.offset?this.maxWidth/i:g/(i-1),d+6>o&&(o=g/(i-(t.offset?.5:1)),l=this.maxHeight-Oi(t.grid)-e.padding-Xl(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),a=cs(Math.min(Math.asin(Ht((u.highest.height+6)/o,-1,1)),Math.asin(Ht(l/c,-1,1))-Math.asin(Ht(h/c,-1,1)))),a=Math.max(s,Math.min(r,a))),this.labelRotation=a}afterCalculateLabelRotation(){ut(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ut(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const l=Xl(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Oi(r)+l):(t.height=this.maxHeight,t.width=Oi(r)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),g=i.padding*2,p=Nt(this.labelRotation),y=Math.cos(p),x=Math.sin(p);if(o){const w=i.mirror?0:x*d.width+y*h.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*d.width+x*h.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,x,y)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:a},position:o}=this.options,l=this.labelRotation!==0,c=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,g=0;l?c?(h=s*t.width,g=i*e.height):(h=i*t.height,g=s*e.width):r==="start"?g=e.width:r==="end"?h=t.width:r!=="inner"&&(h=t.width/2,g=e.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-d+a)*this.width/(this.width-d),0)}else{let u=e.height/2,d=t.height/2;r==="start"?(u=0,d=t.height):r==="end"&&(u=e.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ut(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)J(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ql(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:r}=this,a=[],o=[],l=Math.floor(e/Ul(e,i));let c=0,u=0,d,h,g,p,y,x,w,v,M,C,D;for(d=0;d<e;d+=l){if(p=t[d].label,y=this._resolveTickFontOptions(d),s.font=x=y.string,w=r[x]=r[x]||{data:{},gc:[]},v=y.lineHeight,M=C=0,!J(p)&&!ot(p))M=hs(s,w.data,w.gc,M,p),C=v;else if(ot(p))for(h=0,g=p.length;h<g;++h)D=p[h],!J(D)&&!ot(D)&&(M=hs(s,w.data,w.gc,M,D),C+=v);a.push(M),o.push(C),c=Math.max(M,c),u=Math.max(C,u)}Cp(r,e);const E=a.indexOf(c),T=o.indexOf(u),b=_=>({width:a[_]||0,height:o[_]||0});return{first:b(0),last:b(e-1),widest:b(E),highest:b(T),widths:a,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return bf(this._alignToPixels?xn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Op(this.getContext(),t,i))}return this.$context||(this.$context=Pp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Nt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),a=t.autoSkipPadding||0,o=r?r.widest.width+a:0,l=r?r.highest.height+a:0;return this.isHorizontal()?l*i>o*s?o/i:l/s:l*s<o*i?l/i:o/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:a,border:o}=s,l=r.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Oi(r),g=[],p=o.setContext(this.getContext()),y=p.display?p.width:0,x=y/2,w=function($){return xn(i,$,y)};let v,M,C,D,E,T,b,_,S,O,A,F;if(a==="top")v=w(this.bottom),T=this.bottom-h,_=v-x,O=w(t.top)+x,F=t.bottom;else if(a==="bottom")v=w(this.top),O=t.top,F=w(t.bottom)-x,T=v+x,_=this.top+h;else if(a==="left")v=w(this.right),E=this.right-h,b=v-x,S=w(t.left)+x,A=t.right;else if(a==="right")v=w(this.left),S=t.left,A=w(t.right)-x,E=v+x,b=this.left+h;else if(e==="x"){if(a==="center")v=w((t.top+t.bottom)/2+.5);else if(it(a)){const $=Object.keys(a)[0],N=a[$];v=w(this.chart.scales[$].getPixelForValue(N))}O=t.top,F=t.bottom,T=v+x,_=T+h}else if(e==="y"){if(a==="center")v=w((t.left+t.right)/2);else if(it(a)){const $=Object.keys(a)[0],N=a[$];v=w(this.chart.scales[$].getPixelForValue(N))}E=v-x,b=E-h,S=t.left,A=t.right}const j=K(s.ticks.maxTicksLimit,d),G=Math.max(1,Math.ceil(d/j));for(M=0;M<d;M+=G){const $=this.getContext(M),N=r.setContext($),st=o.setContext($),z=N.lineWidth,At=N.color,_t=st.dash||[],H=st.dashOffset,L=N.tickWidth,B=N.tickColor,V=N.tickBorderDash||[],q=N.tickBorderDashOffset;C=Tp(this,M,l),C!==void 0&&(D=xn(i,C,z),c?E=b=S=A=D:T=_=O=F=D,g.push({tx1:E,ty1:T,tx2:b,ty2:_,x1:S,y1:O,x2:A,y2:F,width:z,color:At,borderDash:_t,borderDashOffset:H,tickWidth:L,tickColor:B,tickBorderDash:V,tickBorderDashOffset:q}))}return this._ticksLength=d,this._borderValue=v,g}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:r}=i,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,h=Oi(i.grid),g=h+u,p=d?-u:g,y=-Nt(this.labelRotation),x=[];let w,v,M,C,D,E,T,b,_,S,O,A,F="middle";if(s==="top")E=this.bottom-p,T=this._getXAxisLabelAlignment();else if(s==="bottom")E=this.top+p,T=this._getXAxisLabelAlignment();else if(s==="left"){const G=this._getYAxisLabelAlignment(h);T=G.textAlign,D=G.x}else if(s==="right"){const G=this._getYAxisLabelAlignment(h);T=G.textAlign,D=G.x}else if(e==="x"){if(s==="center")E=(t.top+t.bottom)/2+g;else if(it(s)){const G=Object.keys(s)[0],$=s[G];E=this.chart.scales[G].getPixelForValue($)+g}T=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")D=(t.left+t.right)/2-g;else if(it(s)){const G=Object.keys(s)[0],$=s[G];D=this.chart.scales[G].getPixelForValue($)}T=this._getYAxisLabelAlignment(h).textAlign}e==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const j=this._getLabelSizes();for(w=0,v=o.length;w<v;++w){M=o[w],C=M.label;const G=r.setContext(this.getContext(w));b=this.getPixelForTick(w)+r.labelOffset,_=this._resolveTickFontOptions(w),S=_.lineHeight,O=ot(C)?C.length:1;const $=O/2,N=G.color,st=G.textStrokeColor,z=G.textStrokeWidth;let At=T;a?(D=b,T==="inner"&&(w===v-1?At=this.options.reverse?"left":"right":w===0?At=this.options.reverse?"right":"left":At="center"),s==="top"?c==="near"||y!==0?A=-O*S+S/2:c==="center"?A=-j.highest.height/2-$*S+S:A=-j.highest.height+S/2:c==="near"||y!==0?A=S/2:c==="center"?A=j.highest.height/2-$*S:A=j.highest.height-O*S,d&&(A*=-1),y!==0&&!G.showLabelBackdrop&&(D+=S/2*Math.sin(y))):(E=b,A=(1-O)*S/2);let _t;if(G.showLabelBackdrop){const H=Ft(G.backdropPadding),L=j.heights[w],B=j.widths[w];let V=A-H.top,q=0-H.left;switch(F){case"middle":V-=L/2;break;case"bottom":V-=L;break}switch(T){case"center":q-=B/2;break;case"right":q-=B;break;case"inner":w===v-1?q-=B:w>0&&(q-=B/2);break}_t={left:q,top:V,width:B+H.width,height:L+H.height,color:G.backdropColor}}x.push({label:C,font:_,textOffset:A,options:{rotation:y,color:N,strokeColor:st,strokeWidth:z,textAlign:At,textBaseline:F,translation:[D,E],backdrop:_t}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Nt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,a=this._getLabelSizes(),o=t+r,l=a.widest.width;let c,u;return e==="left"?s?(u=this.right+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,a;const o=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,a=s.length;r<a;++r){const l=s[r];e.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&o({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,r=i.setContext(this.getContext()),a=i.display?r.width:0;if(!a)return;const o=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=xn(t,this.left,a)-a/2,u=xn(t,this.right,o)+o/2,d=h=l):(d=xn(t,this.top,a)-a/2,h=xn(t,this.bottom,o)+o/2,c=u=l),e.save(),e.lineWidth=r.width,e.strokeStyle=r.color,e.beginPath(),e.moveTo(c,d),e.lineTo(u,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&bi(i,s);const r=this.getLabelItems(t);for(const a of r){const o=a.options,l=a.font,c=a.label,u=a.textOffset;_n(i,c,0,u,l,o)}s&&xi(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const r=xt(i.font),a=Ft(i.padding),o=i.align;let l=r.lineHeight/2;e==="bottom"||e==="center"||it(e)?(l+=a.bottom,ot(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=Ap(this,l,e,o);_n(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:h,textAlign:Ep(o,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=K(t.grid&&t.grid.z,-1),s=K(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Mn.prototype.draw?[{z:e,draw:r=>{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,a;for(r=0,a=e.length;r<a;++r){const o=e[r];o[i]===this.id&&(!t||o.type===t)&&s.push(o)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return xt(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ms{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;Ip(e)&&(i=this.register(e));const s=this.items,r=t.id,a=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,Rp(t,a,i),this.override&&Dt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in Dt[s]&&(delete Dt[s][i],this.override&&delete bn[i])}}function Rp(n,t,e){const i=di(Object.create(null),[e?Dt.get(e):{},Dt.get(t),n.defaults]);Dt.set(t,i),n.defaultRoutes&&Lp(t,n.defaultRoutes),n.descriptors&&Dt.describe(t,n.descriptors)}function Lp(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),a=t[e].split("."),o=a.pop(),l=a.join(".");Dt.route(r,s,l,o)})}function Ip(n){return"id"in n&&"defaults"in n}class Np{constructor(){this.controllers=new Ms(_e,"datasets",!0),this.elements=new Ms(Yt,"elements"),this.plugins=new Ms(Object,"plugins"),this.scales=new Ms(Mn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):dt(s,a=>{const o=i||this._getRegistryForType(a);this._exec(t,o,a)})})}_exec(t,e,i){const s=kr(t);ut(i["before"+s],[],i),e[t](i),ut(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var De=new Np;class Fp{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,s){s=s||{};for(const r of t){const a=r.plugin,o=a[i],l=[e,s,r.options];if(ut(o,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){J(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=K(i.options&&i.options.plugins,{}),r=zp(i);return s===!1&&!e?[]:Hp(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,a)=>r.filter(o=>!a.some(l=>o.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function zp(n){const t={},e=[],i=Object.keys(De.plugins.items);for(let r=0;r<i.length;r++)e.push(De.getPlugin(i[r]));const s=n.plugins||[];for(let r=0;r<s.length;r++){const a=s[r];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Bp(n,t){return!t&&n===!1?null:n===!0?{}:n}function Hp(n,{plugins:t,localIds:e},i,s){const r=[],a=n.getContext();for(const o of t){const l=o.id,c=Bp(i[l],s);c!==null&&r.push({plugin:o,options:Wp(n.config,{plugin:o,local:e[l]},c,a)})}return r}function Wp(n,{plugin:t,local:e},i,s){const r=n.pluginScopeKeys(t),a=n.getOptionScopes(i,r);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Xr(n,t){const e=Dt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Yp(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Vp(n,t){return n===t?"_index_":"_value_"}function Gl(n){if(n==="x"||n==="y"||n==="r")return n}function jp(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Gr(n,...t){if(Gl(n))return n;for(const e of t){const i=e.axis||jp(e.position)||n.length>1&&Gl(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Kl(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function $p(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Kl(n,"x",e[0])||Kl(n,"y",e[0])}return{}}function Up(n,t){const e=bn[n.type]||{scales:{}},i=t.scales||{},s=Xr(n.type,t),r=Object.create(null);return Object.keys(i).forEach(a=>{const o=i[a];if(!it(o))return console.error(`Invalid scale configuration for scale: ${a}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=Gr(a,o,$p(a,n),Dt.scales[o.type]),c=Vp(l,s),u=e.scales||{};r[a]=hi(Object.create(null),[{axis:l},o,u[l],u[c]])}),n.data.datasets.forEach(a=>{const o=a.type||n.type,l=a.indexAxis||Xr(o,t),u=(bn[o]||{}).scales||{};Object.keys(u).forEach(d=>{const h=Yp(d,l),g=a[h+"AxisID"]||h;r[g]=r[g]||Object.create(null),hi(r[g],[{axis:h},i[g],u[d]])})}),Object.keys(r).forEach(a=>{const o=r[a];hi(o,[Dt.scales[o.type],Dt.scale])}),r}function Zl(n){const t=n.options||(n.options={});t.plugins=K(t.plugins,{}),t.scales=Up(n,t)}function Ql(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function qp(n){return n=n||{},n.data=Ql(n.data),Zl(n),n}const Jl=new Map,tc=new Set;function Ss(n,t){let e=Jl.get(n);return e||(e=t(),Jl.set(n,e),tc.add(e)),e}const Ei=(n,t,e)=>{const i=Ke(t,e);i!==void 0&&n.add(i)};class Xp{constructor(t){this._config=qp(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ql(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Zl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ss(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ss(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ss(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Ss(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;const l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(d=>Ei(l,t,d))),u.forEach(d=>Ei(l,s,d)),u.forEach(d=>Ei(l,bn[r]||{},d)),u.forEach(d=>Ei(l,Dt,d)),u.forEach(d=>Ei(l,Pr,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),tc.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,bn[e]||{},Dt.datasets[e]||{},{type:e},Dt,Pr]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:a,subPrefixes:o}=ec(this._resolverCache,t,s);let l=a;if(Kp(a,e)){r.$shared=!1,i=Jt(i)?i():i;const c=this.createResolver(t,i,o);l=Wn(a,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=ec(this._resolverCache,t,i);return it(e)?Wn(r,e,void 0,s):r}}function ec(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:Rr(t,e),subPrefixes:e.filter(o=>!o.toLowerCase().includes("hover"))},i.set(s,r)),r}const Gp=n=>it(n)&&Object.getOwnPropertyNames(n).some(t=>Jt(n[t]));function Kp(n,t){const{isScriptable:e,isIndexable:i}=il(n);for(const s of t){const r=e(s),a=i(s),o=(a||r)&&n[s];if(r&&(Jt(o)||Gp(o))||a&&ot(o))return!0}return!1}var Zp="4.4.4";const Qp=["top","bottom","left","right","chartArea"];function nc(n,t){return n==="top"||n==="bottom"||Qp.indexOf(n)===-1&&t==="x"}function ic(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function sc(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ut(e&&e.onComplete,[n],t)}function Jp(n){const t=n.chart,e=t.options.animation;ut(e&&e.onProgress,[n],t)}function rc(n){return Nr()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Ds={},ac=n=>{const t=rc(n);return Object.values(Ds).filter(e=>e.canvas===t).pop()};function tm(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const a=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=a)}}}function em(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Ts(n,t,e){return n.options.clip?n[e]:t[e]}function nm(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Ts(e,t,"left"),right:Ts(e,t,"right"),top:Ts(i,t,"top"),bottom:Ts(i,t,"bottom")}:t}let ge=(fn=class{static register(...t){De.add(...t),oc()}static unregister(...t){De.remove(...t),oc()}constructor(t,e){const i=this.config=new Xp(e),s=rc(t),r=ac(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||xp(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,a.aspectRatio),l=o&&o.canvas,c=l&&l.height,u=l&&l.width;if(this.id=of(),this.ctx=o,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Fp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=vf(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ds[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Fe.listen(this,"complete",sc),Fe.listen(this,"progress",Jp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return J(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return De}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():dl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return tl(this.canvas,this.ctx),this}stop(){return Fe.stop(this),this}resize(t,e){Fe.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,r),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,dl(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),ut(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};dt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,o)=>(a[o]=!1,a),{});let r=[];e&&(r=r.concat(Object.keys(e).map(a=>{const o=e[a],l=Gr(a,o),c=l==="r",u=l==="x";return{options:o,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),dt(r,a=>{const o=a.options,l=o.id,c=Gr(l,o),u=K(o.type,a.dtype);(o.position===void 0||nc(o.position,c)!==nc(a.dposition))&&(o.position=a.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===u)d=i[l];else{const h=De.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(o,t)}),dt(s,(a,o)=>{a||delete i[o]}),dt(i,a=>{$t.configure(this,a,a.options),$t.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(ic("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const r=e[i];let a=this.getDatasetMeta(i);const o=r.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=o,a.indexAxis=r.indexAxis||Xr(o,this.options),a.order=r.order||0,a.index=i,a.label=""+r.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const l=De.getController(o),{datasetElementType:c,dataElementType:u}=Dt.datasets[o];Object.assign(l,{dataElementType:De.getElement(u),datasetElementType:c&&De.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){dt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),h=!s&&r.indexOf(d)===-1;d.buildOrUpdateElements(h),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||dt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ic("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){dt(this.scales,t=>{$t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Fo(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const a=i==="_removeElements"?-r:r;tm(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(a=>a[0]===r).map((a,o)=>o+","+a.splice(1).join(","))),s=i(0);for(let r=1;r<e;r++)if(!Fo(s,i(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$t.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],dt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Jt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Fe.has(this)?this.attached&&!Fe.running(this)&&Fe.start(this):(this.draw(),sc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,r;for(s=0,r=e.length;s<r;++s){const a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=nm(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&bi(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&xi(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return Ne(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=Ur.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=tn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,s);Qt(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(r,{visible:i}),this.update(o=>o.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Fe.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),tl(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ds[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(r,a)=>{e.addEventListener(this,r,a),t[r]=a},s=(r,a,o)=>{r.offsetX=a,r.offsetY=o,this._eventHandler(r)};dt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",r),i("detach",a)};a=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){dt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},dt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,a,o,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),o=0,l=t.length;o<l;++o){a=t[o];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:r,index:a})=>{const o=this.getDatasetMeta(r);if(!o)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:o.data[a],index:a}});!rs(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=r(e,t),o=i?t:r(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,a=e,o=this._getActiveElements(t,s,i,a),l=ff(t),c=em(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ut(r.onHover,[t,o,this],this),l&&ut(r.onClick,[t,o,this],this));const u=!rs(o,s);return(u||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},P(fn,"defaults",Dt),P(fn,"instances",Ds),P(fn,"overrides",bn),P(fn,"registry",De),P(fn,"version",Zp),P(fn,"getChart",ac),fn);function oc(){return dt(ge.instances,n=>n._plugins.invalidate())}function im(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:a,outerRadius:o,innerRadius:l}=t;let c=s/o;n.beginPath(),n.arc(r,a,o,i-c,e+c),l>s?(c=s/l,n.arc(r,a,l,e+c,i-c,!0)):n.arc(r,a,s,e+bt,i-bt),n.closePath(),n.clip()}function sm(n){return Ar(n,["outerStart","outerEnd","innerStart","innerEnd"])}function rm(n,t,e,i){const s=sm(n.options.borderRadius),r=(e-t)/2,a=Math.min(r,i*t/2),o=l=>{const c=(e-Math.min(r,l))*i/2;return Ht(l,0,Math.min(r,c))};return{outerStart:o(s.outerStart),outerEnd:o(s.outerEnd),innerStart:Ht(s.innerStart,0,a),innerEnd:Ht(s.innerEnd,0,a)}}function jn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function Cs(n,t,e,i,s,r){const{x:a,y:o,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+i+e-c,0),h=u>0?u+i+e+c:0;let g=0;const p=s-l;if(i){const G=u>0?u-i:0,$=d>0?d-i:0,N=(G+$)/2,st=N!==0?p*N/(N+i):p;g=(p-st)/2}const y=Math.max(.001,p*d-e/rt)/d,x=(p-y)/2,w=l+x+g,v=s-x-g,{outerStart:M,outerEnd:C,innerStart:D,innerEnd:E}=rm(t,h,d,v-w),T=d-M,b=d-C,_=w+M/T,S=v-C/b,O=h+D,A=h+E,F=w+D/O,j=v-E/A;if(n.beginPath(),r){const G=(_+S)/2;if(n.arc(a,o,d,_,G),n.arc(a,o,d,G,S),C>0){const z=jn(b,S,a,o);n.arc(z.x,z.y,C,S,v+bt)}const $=jn(A,v,a,o);if(n.lineTo($.x,$.y),E>0){const z=jn(A,j,a,o);n.arc(z.x,z.y,E,v+bt,j+Math.PI)}const N=(v-E/h+(w+D/h))/2;if(n.arc(a,o,h,v-E/h,N,!0),n.arc(a,o,h,N,w+D/h,!0),D>0){const z=jn(O,F,a,o);n.arc(z.x,z.y,D,F+Math.PI,w-bt)}const st=jn(T,w,a,o);if(n.lineTo(st.x,st.y),M>0){const z=jn(T,_,a,o);n.arc(z.x,z.y,M,w-bt,_)}}else{n.moveTo(a,o);const G=Math.cos(_)*d+a,$=Math.sin(_)*d+o;n.lineTo(G,$);const N=Math.cos(S)*d+a,st=Math.sin(S)*d+o;n.lineTo(N,st)}n.closePath()}function am(n,t,e,i,s){const{fullCircles:r,startAngle:a,circumference:o}=t;let l=t.endAngle;if(r){Cs(n,t,e,i,l,s);for(let c=0;c<r;++c)n.fill();isNaN(o)||(l=a+(o%yt||yt))}return Cs(n,t,e,i,l,s),n.fill(),l}function om(n,t,e,i,s){const{fullCircles:r,startAngle:a,circumference:o,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,g=l.borderAlign==="inner";if(!c)return;n.setLineDash(d||[]),n.lineDashOffset=h,g?(n.lineWidth=c*2,n.lineJoin=u||"round"):(n.lineWidth=c,n.lineJoin=u||"bevel");let p=t.endAngle;if(r){Cs(n,t,e,i,p,s);for(let y=0;y<r;++y)n.stroke();isNaN(o)||(p=a+(o%yt||yt))}g&&im(n,t,p),r||(Cs(n,t,e,i,p,s),n.stroke())}class Ai extends Yt{constructor(e){super();P(this,"circumference");P(this,"endAngle");P(this,"fullCircles");P(this,"innerRadius");P(this,"outerRadius");P(this,"pixelMargin");P(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.getProps(["x","y"],s),{angle:a,distance:o}=Wo(r,{x:e,y:i}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,p=K(h,c-l),y=gi(a,l,c)&&l!==c,x=p>=yt||y,w=Le(o,u+g,d+g);return x&&w}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:a,innerRadius:o,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:u}=this.options,d=(r+a)/2,h=(o+l+u+c)/2;return{x:i+Math.cos(d)*h,y:s+Math.sin(d)*h}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,a=(i.spacing||0)/2,o=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>yt?Math.floor(s/yt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(rt,s||0)),u=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,am(e,this,u,a,o),om(e,this,u,a,o),e.restore()}}P(Ai,"id","arc"),P(Ai,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),P(Ai,"defaultRoutes",{backgroundColor:"backgroundColor"}),P(Ai,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function lc(n,t,e=t){n.lineCap=K(e.borderCapStyle,t.borderCapStyle),n.setLineDash(K(e.borderDash,t.borderDash)),n.lineDashOffset=K(e.borderDashOffset,t.borderDashOffset),n.lineJoin=K(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=K(e.borderWidth,t.borderWidth),n.strokeStyle=K(e.borderColor,t.borderColor)}function lm(n,t,e){n.lineTo(e.x,e.y)}function cm(n){return n.stepped?Lf:n.tension||n.cubicInterpolationMode==="monotone"?If:lm}function cc(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:a,end:o}=t,l=Math.max(s,a),c=Math.min(r,o),u=s<a&&r<a||s>o&&r>o;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function um(n,t,e,i){const{points:s,options:r}=t,{count:a,start:o,loop:l,ilen:c}=cc(s,e,i),u=cm(r);let{move:d=!0,reverse:h}=i||{},g,p,y;for(g=0;g<=c;++g)p=s[(o+(h?c-g:g))%a],!p.skip&&(d?(n.moveTo(p.x,p.y),d=!1):u(n,y,p,h,r.stepped),y=p);return l&&(p=s[(o+(h?c:0))%a],u(n,y,p,h,r.stepped)),!!l}function dm(n,t,e,i){const s=t.points,{count:r,start:a,ilen:o}=cc(s,e,i),{move:l=!0,reverse:c}=i||{};let u=0,d=0,h,g,p,y,x,w;const v=C=>(a+(c?o-C:C))%r,M=()=>{y!==x&&(n.lineTo(u,x),n.lineTo(u,y),n.lineTo(u,w))};for(l&&(g=s[v(0)],n.moveTo(g.x,g.y)),h=0;h<=o;++h){if(g=s[v(h)],g.skip)continue;const C=g.x,D=g.y,E=C|0;E===p?(D<y?y=D:D>x&&(x=D),u=(d*u+C)/++d):(M(),n.lineTo(C,D),p=E,d=0,y=x=D),w=D}M()}function Kr(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?dm:um}function hm(n){return n.stepped?fg:n.tension||n.cubicInterpolationMode==="monotone"?gg:vn}function fm(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),lc(n,t.options),n.stroke(s)}function gm(n,t,e,i){const{segments:s,options:r}=t,a=Kr(t);for(const o of s)lc(n,r,o.style),n.beginPath(),a(n,t,o,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const pm=typeof Path2D=="function";function mm(n,t,e,i){pm&&!t.options.segment?fm(n,t,e,i):gm(n,t,e,i)}class sn extends Yt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;rg(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_g(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,a=bl(this,{property:e,start:s,end:s});if(!a.length)return;const o=[],l=hm(i);let c,u;for(c=0,u=a.length;c<u;++c){const{start:d,end:h}=a[c],g=r[d],p=r[h];if(g===p){o.push(g);continue}const y=Math.abs((s-g[e])/(p[e]-g[e])),x=l(g,p,y,i.stepped);x[e]=t[e],o.push(x)}return o.length===1?o[0]:o}pathSegment(t,e,i){return Kr(this)(t,this,e,i)}path(t,e,i){const s=this.segments,r=Kr(this);let a=this._loop;e=e||0,i=i||this.points.length-e;for(const o of s)a&=r(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),mm(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}P(sn,"id","line"),P(sn,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),P(sn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),P(sn,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function uc(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)<s.radius+s.hitRadius}class Ps extends Yt{constructor(e){super();P(this,"parsed");P(this,"skip");P(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.options,{x:a,y:o}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(i-o,2)<Math.pow(r.hitRadius+r.radius,2)}inXRange(e,i){return uc(this,e,"x",i)}inYRange(e,i){return uc(this,e,"y",i)}getCenterPoint(e){const{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);const s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){const s=this.options;this.skip||s.radius<.1||!Ne(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Er(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}P(Ps,"id","point"),P(Ps,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),P(Ps,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function dc(n,t){const{x:e,y:i,base:s,width:r,height:a}=n.getProps(["x","y","base","width","height"],t);let o,l,c,u,d;return n.horizontal?(d=a/2,o=Math.min(e,s),l=Math.max(e,s),c=i-d,u=i+d):(d=r/2,o=e-d,l=e+d,c=Math.min(i,s),u=Math.max(i,s)),{left:o,top:c,right:l,bottom:u}}function rn(n,t,e,i){return n?0:Ht(t,e,i)}function ym(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,r=nl(i);return{t:rn(s.top,r.top,0,e),r:rn(s.right,r.right,0,t),b:rn(s.bottom,r.bottom,0,e),l:rn(s.left,r.left,0,t)}}function bm(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=Je(s),a=Math.min(t,e),o=n.borderSkipped,l=i||it(s);return{topLeft:rn(!l||o.top||o.left,r.topLeft,0,a),topRight:rn(!l||o.top||o.right,r.topRight,0,a),bottomLeft:rn(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:rn(!l||o.bottom||o.right,r.bottomRight,0,a)}}function xm(n){const t=dc(n),e=t.right-t.left,i=t.bottom-t.top,s=ym(n,e/2,i/2),r=bm(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function Zr(n,t,e,i){const s=t===null,r=e===null,o=n&&!(s&&r)&&dc(n,i);return o&&(s||Le(t,o.left,o.right))&&(r||Le(e,o.top,o.bottom))}function _m(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function wm(n,t){n.rect(t.x,t.y,t.w,t.h)}function Qr(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,r=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+a,radius:n.radius}}class Os extends Yt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:a}=xm(this),o=_m(a.radius)?Hn:wm;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),o(t,Qr(a,e,r)),t.clip(),o(t,Qr(r,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,Qr(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Zr(this,t,e,i)}inXRange(t,e){return Zr(this,t,null,e)}inYRange(t,e){return Zr(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}P(Os,"id","bar"),P(Os,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),P(Os,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var vm=Object.freeze({__proto__:null,ArcElement:Ai,BarElement:Os,LineElement:sn,PointElement:Ps});const Jr=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],hc=Jr.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function fc(n){return Jr[n%Jr.length]}function gc(n){return hc[n%hc.length]}function km(n,t){return n.borderColor=fc(t),n.backgroundColor=gc(t),++t}function Mm(n,t){return n.backgroundColor=n.data.map(()=>fc(t++)),t}function Sm(n,t){return n.backgroundColor=n.data.map(()=>gc(t++)),t}function Dm(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof nn?t=Mm(e,t):s instanceof Mi?t=Sm(e,t):s&&(t=km(e,t))}}function pc(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Tm(n){return n&&(n.borderColor||n.backgroundColor)}var Cm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(pc(i)||Tm(s)||r&&pc(r)))return;const a=Dm(n);i.forEach(a)}};function Pm(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const a=[],o=(e-2)/(r-2);let l=0;const c=t+e-1;let u=t,d,h,g,p,y;for(a[l++]=n[u],d=0;d<r-2;d++){let x=0,w=0,v;const M=Math.floor((d+1)*o)+1+t,C=Math.min(Math.floor((d+2)*o)+1,e)+t,D=C-M;for(v=M;v<C;v++)x+=n[v].x,w+=n[v].y;x/=D,w/=D;const E=Math.floor(d*o)+1+t,T=Math.min(Math.floor((d+1)*o)+1,e)+t,{x:b,y:_}=n[u];for(g=p=-1,v=E;v<T;v++)p=.5*Math.abs((b-x)*(n[v].y-_)-(b-n[v].x)*(w-_)),p>g&&(g=p,h=n[v],y=v);a[l++]=h,u=y}return a[l++]=n[c],a}function Om(n,t,e,i){let s=0,r=0,a,o,l,c,u,d,h,g,p,y;const x=[],w=t+e-1,v=n[t].x,C=n[w].x-v;for(a=t;a<t+e;++a){o=n[a],l=(o.x-v)/C*i,c=o.y;const D=l|0;if(D===u)c<p?(p=c,d=a):c>y&&(y=c,h=a),s=(r*s+o.x)/++r;else{const E=a-1;if(!J(d)&&!J(h)){const T=Math.min(d,h),b=Math.max(d,h);T!==g&&T!==E&&x.push({...n[T],x:s}),b!==g&&b!==E&&x.push({...n[b],x:s})}a>0&&E!==g&&x.push(n[E]),x.push(o),u=D,r=0,p=y=c,d=h=g=a}}return x}function mc(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function yc(n){n.data.datasets.forEach(t=>{mc(t)})}function Em(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:a,max:o,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Ht(Ie(t,r.axis,a).lo,0,e-1)),c?s=Ht(Ie(t,r.axis,o).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Am={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){yc(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:a,indexAxis:o}=s,l=n.getDatasetMeta(r),c=a||s.data;if(_i([o,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=n.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:d,count:h}=Em(l,c);const g=e.threshold||4*i;if(h<=g){mc(s);return}J(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(y){this._data=y}}));let p;switch(e.algorithm){case"lttb":p=Pm(c,d,h,i,e);break;case"min-max":p=Om(c,d,h,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(n){yc(n)}};function Rm(n,t,e){const i=n.segments,s=n.points,r=t.points,a=[];for(const o of i){let{start:l,end:c}=o;c=ea(l,c,s);const u=ta(e,s[l],s[c],o.loop);if(!t.segments){a.push({source:o,target:u,start:s[l],end:s[c]});continue}const d=bl(t,u);for(const h of d){const g=ta(e,r[h.start],r[h.end],h.loop),p=yl(o,s,g);for(const y of p)a.push({source:y,target:h,start:{[e]:bc(u,g,"start",Math.max)},end:{[e]:bc(u,g,"end",Math.min)}})}}return a}function ta(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=ue(s),r=ue(r)),{property:n,start:s,end:r}}function Lm(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:a,end:o})=>{o=ea(a,o,s);const l=s[a],c=s[o];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function ea(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function bc(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function xc(n,t){let e=[],i=!1;return ot(n)?(i=!0,e=n):e=Lm(n,t),e.length?new sn({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function _c(n){return n&&n.fill!==!1}function Im(n,t,e){let s=n[t].fill;const r=[t];let a;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!kt(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;r.push(s),s=a.fill}return!1}function Nm(n,t,e){const i=Hm(n);if(it(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return kt(s)&&Math.floor(s)===s?Fm(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Fm(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function zm(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:it(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Bm(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:it(n)?i=n.value:i=t.getBaseValue(),i}function Hm(n){const t=n.options,e=t.fill;let i=K(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Wm(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,a=i.points,o=Ym(t,e);o.push(xc({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){const c=r[l];for(let u=c.start;u<=c.end;u++)Vm(s,a[u],o)}return new sn({points:s,options:{}})}function Ym(n,t){const e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const r=i[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function Vm(n,t,e){const i=[];for(let s=0;s<e.length;s++){const r=e[s],{first:a,last:o,point:l}=jm(r,t,"x");if(!(!l||a&&o)){if(a)i.unshift(l);else if(n.push(l),!o)break}}n.push(...i)}function jm(n,t,e){const i=n.interpolate(t,e);if(!i)return{};const s=i[e],r=n.segments,a=n.points;let o=!1,l=!1;for(let c=0;c<r.length;c++){const u=r[c],d=a[u.start][e],h=a[u.end][e];if(Le(s,d,h)){o=s===d,l=s===h;break}}return{first:o,last:l,point:i}}class wc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:r,radius:a}=this;return e=e||{start:0,end:yt},t.arc(s,r,a,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}}function $m(n){const{chart:t,fill:e,line:i}=n;if(kt(e))return Um(t,e);if(e==="stack")return Wm(n);if(e==="shape")return!0;const s=qm(n);return s instanceof wc?s:xc(s,i)}function Um(n,t){const e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function qm(n){return(n.scale||{}).getPointPositionForValue?Gm(n):Xm(n)}function Xm(n){const{scale:t={},fill:e}=n,i=zm(e,t);if(kt(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function Gm(n){const{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,r=i.reverse?t.max:t.min,a=Bm(e,t,r),o=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,r);return new wc({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)o.push(t.getPointPositionForValue(l,a));return o}function na(n,t,e){const i=$m(t),{line:s,scale:r,axis:a}=t,o=s.options,l=o.fill,c=o.backgroundColor,{above:u=c,below:d=c}=l||{};i&&s.points.length&&(bi(n,e),Km(n,{line:s,target:i,above:u,below:d,area:e,scale:r,axis:a}),xi(n))}function Km(n,t){const{line:e,target:i,above:s,below:r,area:a,scale:o}=t,l=e._loop?"angle":t.axis;n.save(),l==="x"&&r!==s&&(vc(n,i,a.top),kc(n,{line:e,target:i,color:s,scale:o,property:l}),n.restore(),n.save(),vc(n,i,a.bottom)),kc(n,{line:e,target:i,color:r,scale:o,property:l}),n.restore()}function vc(n,t,e){const{segments:i,points:s}=t;let r=!0,a=!1;n.beginPath();for(const o of i){const{start:l,end:c}=o,u=s[l],d=s[ea(l,c,s)];r?(n.moveTo(u.x,u.y),r=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),a=!!t.pathSegment(n,o,{move:a}),a?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function kc(n,t){const{line:e,target:i,property:s,color:r,scale:a}=t,o=Rm(e,i,s);for(const{source:l,target:c,start:u,end:d}of o){const{style:{backgroundColor:h=r}={}}=l,g=i!==!0;n.save(),n.fillStyle=h,Zm(n,a,g&&ta(s,u,d)),n.beginPath();const p=!!e.pathSegment(n,l);let y;if(g){p?n.closePath():Mc(n,i,d,s);const x=!!i.pathSegment(n,c,{move:p,reverse:!0});y=p&&x,y||Mc(n,i,u,s)}n.closePath(),n.fill(y?"evenodd":"nonzero"),n.restore()}}function Zm(n,t,e){const{top:i,bottom:s}=t.chart.chartArea,{property:r,start:a,end:o}=e||{};r==="x"&&(n.beginPath(),n.rect(a,i,o-a,s-i),n.clip())}function Mc(n,t,e,i){const s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var Qm={id:"filler",afterDatasetsUpdate(n,t,e){const i=(n.data.datasets||[]).length,s=[];let r,a,o,l;for(a=0;a<i;++a)r=n.getDatasetMeta(a),o=r.dataset,l=null,o&&o.options&&o instanceof sn&&(l={visible:n.isDatasetVisible(a),index:a,fill:Nm(o,a,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:o}),r.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=Im(s,a,e.propagate))},beforeDraw(n,t,e){const i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let a=s.length-1;a>=0;--a){const o=s[a].$filler;o&&(o.line.updateControlPoints(r,o.axis),i&&o.fill&&na(n.ctx,o,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;_c(r)&&na(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!_c(i)||e.drawTime!=="beforeDatasetDraw"||na(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Sc=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Jm=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Dc extends Yt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ut(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=xt(i.font),r=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Sc(i,r);let c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,r,o,l)+10):(u=this.maxHeight,c=this._fitCols(a,s,o,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+o;let d=t;r.textAlign="left",r.textBaseline="middle";let h=-1,g=-u;return this.legendItems.forEach((p,y)=>{const x=i+e/2+r.measureText(p.text).width;(y===0||c[c.length-1]+x+2*o>a)&&(d+=u,c[c.length-(y>0?0:1)]=0,g+=u,h++),l[y]={left:0,top:g,row:h,width:x,height:s},c[c.length-1]+=x+o}),d}_fitCols(t,e,i,s){const{ctx:r,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t;let d=o,h=0,g=0,p=0,y=0;return this.legendItems.forEach((x,w)=>{const{itemWidth:v,itemHeight:M}=ty(i,e,r,x,s);w>0&&g+M+2*o>u&&(d+=h+o,c.push({width:h,height:g}),p+=h+o,y++,h=g=0),l[w]={left:p,top:g,col:y,width:v,height:M},h=Math.max(h,v),g+=M+o}),d+=h,c.push({width:h,height:g}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,a=Vn(r,this.left,this.width);if(this.isHorizontal()){let o=0,l=jt(i,this.left+s,this.right-this.lineWidths[o]);for(const c of e)o!==c.row&&(o=c.row,l=jt(i,this.left+s,this.right-this.lineWidths[o])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let o=0,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(const c of e)c.col!==o&&(o=c.col,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[o].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;bi(t,this),this._draw(),xi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:a}=t,o=Dt.color,l=Vn(t.rtl,this.left,this.width),c=xt(a.font),{padding:u}=a,d=c.size,h=d/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:y,itemHeight:x}=Sc(a,d),w=function(E,T,b){if(isNaN(p)||p<=0||isNaN(y)||y<0)return;s.save();const _=K(b.lineWidth,1);if(s.fillStyle=K(b.fillStyle,o),s.lineCap=K(b.lineCap,"butt"),s.lineDashOffset=K(b.lineDashOffset,0),s.lineJoin=K(b.lineJoin,"miter"),s.lineWidth=_,s.strokeStyle=K(b.strokeStyle,o),s.setLineDash(K(b.lineDash,[])),a.usePointStyle){const S={radius:y*Math.SQRT2/2,pointStyle:b.pointStyle,rotation:b.rotation,borderWidth:_},O=l.xPlus(E,p/2),A=T+h;el(s,S,O,A,a.pointStyleWidth&&p)}else{const S=T+Math.max((d-y)/2,0),O=l.leftForLtr(E,p),A=Je(b.borderRadius);s.beginPath(),Object.values(A).some(F=>F!==0)?Hn(s,{x:O,y:S,w:p,h:y,radius:A}):s.rect(O,S,p,y),s.fill(),_!==0&&s.stroke()}s.restore()},v=function(E,T,b){_n(s,b.text,E,T+x/2,c,{strikethrough:b.hidden,textAlign:l.textAlign(b.textAlign)})},M=this.isHorizontal(),C=this._computeTitleHeight();M?g={x:jt(r,this.left+u,this.right-i[0]),y:this.top+u+C,line:0}:g={x:this.left+u,y:jt(r,this.top+C+u,this.bottom-e[0].height),line:0},fl(this.ctx,t.textDirection);const D=x+u;this.legendItems.forEach((E,T)=>{s.strokeStyle=E.fontColor,s.fillStyle=E.fontColor;const b=s.measureText(E.text).width,_=l.textAlign(E.textAlign||(E.textAlign=a.textAlign)),S=p+h+b;let O=g.x,A=g.y;l.setWidth(this.width),M?T>0&&O+S+u>this.right&&(A=g.y+=D,g.line++,O=g.x=jt(r,this.left+u,this.right-i[g.line])):T>0&&A+D>this.bottom&&(O=g.x=O+e[g.line].width+u,g.line++,A=g.y=jt(r,this.top+C+u,this.bottom-e[g.line].height));const F=l.x(O);if(w(F,A,E),O=kf(_,O+p+h,M?O+S:this.right,t.rtl),v(l.x(O),A,E),M)g.x+=S+u;else if(typeof E.text!="string"){const j=c.lineHeight;g.y+=Tc(E,j)+u}else g.y+=D}),gl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=xt(e.font),s=Ft(e.padding);if(!e.display)return;const r=Vn(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=i.size/2,c=s.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=jt(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((y,x)=>Math.max(y,x.height),0);u=c+jt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=jt(o,d,d+h);a.textAlign=r.textAlign(Dr(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,_n(a,e.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,e=xt(t.font),i=Ft(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Le(t,this.left,this.right)&&Le(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],Le(t,s.left,s.left+s.width)&&Le(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!iy(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,r=Jm(s,i);s&&!r&&ut(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!r&&ut(e.onHover,[t,i,this],this)}else i&&ut(e.onClick,[t,i,this],this)}}function ty(n,t,e,i,s){const r=ey(i,n,t,e),a=ny(s,i,t.lineHeight);return{itemWidth:r,itemHeight:a}}function ey(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((r,a)=>r.length>a.length?r:a)),t+e.size/2+i.measureText(s).width}function ny(n,t,e){let i=n;return typeof t.text!="string"&&(i=Tc(t,e)),i}function Tc(n,t){const e=n.text?n.text.length:0;return t*e}function iy(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var sy={id:"legend",_element:Dc,start(n,t,e){const i=n.legend=new Dc({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i)},stop(n){$t.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;$t.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:a,borderRadius:o}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),u=Ft(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(o||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class ia extends Yt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=ot(i.text)?i.text.length:1;this._padding=Ft(i.padding);const r=s*xt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:a}=this,o=a.align;let l=0,c,u,d;return this.isHorizontal()?(u=jt(o,i,r),d=e+t,c=r-i):(a.position==="left"?(u=i+t,d=jt(o,s,e),l=rt*-.5):(u=r-t,d=jt(o,e,s),l=rt*.5),c=s-e),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=xt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(r);_n(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Dr(e.align),textBaseline:"middle",translation:[a,o]})}}function ry(n,t){const e=new ia({ctx:n.ctx,options:t,chart:n});$t.configure(n,e,t),$t.addBox(n,e),n.titleBlock=e}var ay={id:"title",_element:ia,start(n,t,e){ry(n,e)},stop(n){const t=n.titleBlock;$t.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Es=new WeakMap;var oy={id:"subtitle",start(n,t,e){const i=new ia({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i),Es.set(n,i)},stop(n){$t.removeBox(n,Es.get(n)),Es.delete(n)},beforeUpdate(n,t,e){const i=Es.get(n);$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ri={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;t<e;++t){const o=n[t].element;if(o&&o.hasValue()){const l=o.tooltipPosition();i.add(l.x),s+=l.y,++r}}return r===0||i.size===0?!1:{x:[...i].reduce((o,l)=>o+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,a,o;for(r=0,a=n.length;r<a;++r){const l=n[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Bn(t,c);u<s&&(s=u,o=l)}}if(o){const l=o.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function Te(n,t){return t&&(ot(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function ze(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
16
+ */class kg{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const r=e.listeners[s],a=e.duration;r.forEach(o=>o({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=$o.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let a=r.length-1,o=!1,l;for(;a>=0;--a)l=r[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),o=!0):(r[a]=r[r.length-1],r.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Fe=new kg;const wl="transparent",Mg={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Zo(n||wl),s=i.valid&&Zo(t||wl);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Sg{constructor(t,e,i,s){const r=e[i];s=_i([t.to,s,r,t.from]);const a=_i([t.from,r,s]);this._active=!0,this._fn=t.fn||Mg[t.type||typeof a],this._easing=pi[t.easing]||pi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,a=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=_i([t.to,e,s,t.from]),this._from=_i([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,a=this._loop,o=this._to;let l;if(this._active=r!==o&&(a||e<i),!this._active){this._target[s]=o,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,o,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class zr{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!it(t))return;const e=Object.keys(Dt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const r=t[s];if(!it(r))return;const a={};for(const o of e)a[o]=r[o];(ot(r.properties)&&r.properties||[s]).forEach(o=>{(o===s||!i.has(o))&&i.set(o,a)})})}_animateOptions(t,e){const i=e.options,s=Tg(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&Dg(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[c];let d=r[c];const h=i.get(c);if(d)if(h&&d.active()){d.update(h,u,o);continue}else d.cancel();if(!h||!h.duration){t[c]=u;continue}r[c]=d=new Sg(h,t,c,u),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Fe.add(this._chart,i),!0}}function Dg(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const r=n[i[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function Tg(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function vl(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:s,end:i?s:r}}function Cg(n,t,e){if(e===!1)return!1;const i=vl(n,e),s=vl(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Pg(n){let t,e,i,s;return it(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function kl(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,r;for(s=0,r=i.length;s<r;++s)e.push(i[s].index);return e}function Ml(n,t,e,i={}){const s=n.keys,r=i.mode==="single";let a,o,l,c;if(t!==null){for(a=0,o=s.length;a<o;++a){if(l=+s[a],l===e){if(i.all)continue;break}c=n.values[l],kt(c)&&(r||t===0||Se(t)===Se(c))&&(t+=c)}return t}}function Og(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",r=i.axis==="x"?"x":"y",a=Object.keys(n),o=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],o[l]={[s]:u,[r]:n[u]};return o}function Sl(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function Eg(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Ag(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Rg(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Dl(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const r=n[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function Tl(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:a,index:o}=i,l=r.axis,c=a.axis,u=Eg(r,a,i),d=t.length;let h;for(let g=0;g<d;++g){const p=t[g],{[l]:y,[c]:x}=p,w=p._stacks||(p._stacks={});h=w[c]=Rg(s,u,y),h[o]=x,h._top=Dl(h,a,!0,i.type),h._bottom=Dl(h,a,!1,i.type);const v=h._visualValues||(h._visualValues={});v[o]=x}}function Br(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Lg(n,t){return tn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ig(n,t,e){return tn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function wi(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Hr=n=>n==="reset"||n==="none",Cl=(n,t)=>t?n:Object.assign({},n),Ng=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:kl(e,!0),values:null};class _e{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Sl(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&wi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,h,g,p)=>d==="x"?h:d==="r"?p:g,r=e.xAxisID=K(i.xAxisID,Br(t,"x")),a=e.yAxisID=K(i.yAxisID,Br(t,"y")),o=e.rAxisID=K(i.rAxisID,Br(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,a,o),u=e.vAxisID=s(l,a,r,o);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Vo(this._data,this),t._stacked&&wi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(it(e)){const s=this._cachedMeta;this._data=Og(e,s)}else if(i!==e){if(i){Vo(i,this);const s=this._cachedMeta;wi(s),s._parsed=[]}e&&Object.isExtensible(e)&&wf(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Sl(e.vScale,e),e.stack!==i.stack&&(s=!0,wi(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Tl(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:a}=i,o=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,d,h;if(this._parsing===!1)i._parsed=s,i._sorted=!0,h=s;else{ot(s[t])?h=this.parseArrayData(i,s,t,e):it(s[t])?h=this.parseObjectData(i,s,t,e):h=this.parsePrimitiveData(i,s,t,e);const g=()=>d[o]===null||c&&d[o]<c[o];for(u=0;u<e;++u)i._parsed[u+t]=d=h[u],l&&(g()&&(l=!1),c=d);i._sorted=l}a&&Tl(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:r,vScale:a}=t,o=r.axis,l=a.axis,c=r.getLabels(),u=r===a,d=new Array(s);let h,g,p;for(h=0,g=s;h<g;++h)p=h+i,d[h]={[o]:u||r.parse(c[p],p),[l]:a.parse(e[p],p)};return d}parseArrayData(t,e,i,s){const{xScale:r,yScale:a}=t,o=new Array(s);let l,c,u,d;for(l=0,c=s;l<c;++l)u=l+i,d=e[u],o[l]={x:r.parse(d[0],u),y:a.parse(d[1],u)};return o}parseObjectData(t,e,i,s){const{xScale:r,yScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,d,h,g;for(u=0,d=s;u<d;++u)h=u+i,g=e[h],c[u]={x:r.parse(Ke(g,o),h),y:a.parse(Ke(g,l),h)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,r=this._cachedMeta,a=e[t.axis],o={keys:kl(s,!0),values:e._stacks[t.axis]._visualValues};return Ml(o,a,r.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const r=i[e.axis];let a=r===null?NaN:r;const o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=Ml(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,r=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),l=Ng(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Ag(o);let h,g;function p(){g=s[h];const y=g[o.axis];return!kt(g[t.axis])||u>y||d<y}for(h=0;h<a&&!(!p()&&(this.updateRangeFromParsed(c,t,g,l),r));++h);if(r){for(h=a-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,a;for(s=0,r=e.length;s<r;++s)a=e[s][t.axis],kt(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Pg(K(this.options.clip,Cg(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],r=e.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||s.length-o,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,r,o,l),u=o;u<o+l;++u){const d=s[u];d.hidden||(d.active&&c?a.push(d):d.draw(t,r))}for(u=0;u<a.length;++u)a[u].draw(t,r)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];r=a.$context||(a.$context=Ig(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Lg(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",r=this._cachedDataOpts,a=t+"-"+e,o=r[a],l=this.enableOptionSharing&&Qt(i);if(o)return Cl(o,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Dt.elements[t]),p=()=>this.getContext(i,s,e),y=c.resolveNamedOptions(h,g,p,d);return y.$shared&&(y.$shared=l,r[a]=Object.freeze(Cl(y,l))),y}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,a=`animation-${e}`,o=r[a];if(o)return o;let l;if(s.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,e),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(t,i,e))}const c=new zr(s,l&&l.animations);return l&&l._cacheable&&(r[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Hr(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),a=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:a}}updateElement(t,e,i,s){Hr(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Hr(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];const s=i.length,r=e.length,a=Math.min(r,s);a&&this.parse(0,a),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,i=!0){const s=this._cachedMeta,r=s.data,a=t+e;let o;const l=c=>{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;o<a;++o)r[o]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&wi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}P(_e,"defaults",{}),P(_e,"datasetElementType",null),P(_e,"dataElementType",null);function Fg(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,r=e.length;s<r;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=jo(i.sort((s,r)=>s-r))}return n._cache.$bar}function zg(n){const t=n.iScale,e=Fg(t,n.type);let i=t._length,s,r,a,o;const l=()=>{a===32767||a===-32768||(Qt(o)&&(i=Math.min(i,Math.abs(a-o)||i)),o=a)};for(s=0,r=e.length;s<r;++s)a=t.getPixelForValue(e[s]),l();for(o=void 0,s=0,r=t.ticks.length;s<r;++s)a=t.getPixelForTick(s),l();return i}function Bg(n,t,e,i){const s=e.barThickness;let r,a;return J(s)?(r=t.min*e.categoryPercentage,a=e.barPercentage):(r=s*i,a=1),{chunk:r/i,ratio:a,start:t.pixels[n]-r/2}}function Hg(n,t,e,i){const s=t.pixels,r=s[n];let a=n>0?s[n-1]:null,o=n<s.length-1?s[n+1]:null;const l=e.categoryPercentage;a===null&&(a=r-(o===null?t.end-t.start:o-r)),o===null&&(o=r+r-a);const c=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/i,ratio:e.barPercentage,start:c}}function Wg(n,t,e,i){const s=e.parse(n[0],i),r=e.parse(n[1],i),a=Math.min(s,r),o=Math.max(s,r);let l=a,c=o;Math.abs(a)>Math.abs(o)&&(l=o,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:a,max:o}}function Pl(n,t,e,i){return ot(n)?Wg(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ol(n,t,e,i){const s=n.iScale,r=n.vScale,a=s.getLabels(),o=s===r,l=[];let c,u,d,h;for(c=e,u=e+i;c<u;++c)h=t[c],d={},d[s.axis]=o||s.parse(a[c],c),l.push(Pl(h,d,r,c));return l}function Wr(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function Yg(n,t,e){return n!==0?Se(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Vg(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:i,reverse:t,top:s,bottom:r}}function jg(n,t,e,i){let s=t.borderSkipped;const r={};if(!s){n.borderSkipped=r;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:o,reverse:l,top:c,bottom:u}=Vg(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=u:(r[El(u,a,o,l)]=!0,s=c)),r[El(s,a,o,l)]=!0,n.borderSkipped=r}function El(n,t,e,i){return i?(n=$g(n,t,e),n=Al(n,e,t)):n=Al(n,t,e),n}function $g(n,t,e){return n===t?e:n===e?t:n}function Al(n,t,e){return n==="start"?t:n==="end"?e:n}function qg(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class vi extends _e{parsePrimitiveData(t,e,i,s){return Ol(t,e,i,s)}parseArrayData(t,e,i,s){return Ol(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:r,vScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?o:l,u=a.axis==="x"?o:l,d=[];let h,g,p,y;for(h=i,g=i+s;h<g;++h)y=e[h],p={},p[r.axis]=r.parse(Ke(y,c),h),d.push(Pl(Ke(y,u),p,a,h));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,r=this.getParsed(t),a=r._custom,o=Wr(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const r=s==="reset",{index:a,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),c=o.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,s);for(let g=e;g<e+i;g++){const p=this.getParsed(g),y=r||J(p[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),x=this._calculateBarIndexPixels(g,u),w=(p._stacks||{})[o.axis],v={horizontal:c,base:y.base,enableBorderRadius:!w||Wr(p._custom)||a===w._top||a===w._bottom,x:c?y.head:x.center,y:c?x.center:y.head,height:c?x.size:Math.abs(y.size),width:c?Math.abs(y.size):x.size};h&&(v.options=d||this.resolveDataElementOptions(g,t[g].active?"active":s));const M=v.options||t[g].options;jg(v,M,w,a),qg(v,M,u.ratio),this.updateElement(t[g],g,v,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),r=i.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(e),l=o&&o[i.axis],c=u=>{const d=u._parsed.find(g=>g[i.axis]===l),h=d&&d[u.vScale.axis];if(J(h)||isNaN(h))return!0};for(const u of s)if(!(e!==void 0&&c(u))&&((r===!1||a.indexOf(u.stack)===-1||r===void 0&&u.stack===void 0)&&a.push(u.stack),u.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,a;for(r=0,a=e.data.length;r<a;++r)s.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));const o=t.barThickness;return{min:o||zg(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:r,minBarLength:a}}=this,o=r||0,l=this.getParsed(t),c=l._custom,u=Wr(c);let d=l[e.axis],h=0,g=i?this.applyStack(e,l,i):d,p,y;g!==d&&(h=g-d,g=d),u&&(d=c.barStart,g=c.barEnd-c.barStart,d!==0&&Se(d)!==Se(c.barEnd)&&(h=0),h+=d);const x=!J(r)&&!u?r:h;let w=e.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(h+g):p=w,y=p-w,Math.abs(y)<a){y=Yg(y,e,o)*a,d===o&&(w-=y/2);const v=e.getPixelForDecimal(0),M=e.getPixelForDecimal(1),C=Math.min(v,M),D=Math.max(v,M);w=Math.max(Math.min(w,D),C),p=w+y,i&&!u&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(w))}if(w===e.getPixelForValue(o)){const v=Se(y)*e.getLineWidthForValue(o)/2;w+=v,y-=v}return{size:y,base:w,head:p,center:p+y/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,r=s.skipNull,a=K(s.maxBarThickness,1/0);let o,l;if(e.grouped){const c=r?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?Hg(t,e,s,c):Bg(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);o=u.start+u.chunk*d+u.chunk/2,l=Math.min(a,u.chunk*u.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&!i[r].hidden&&i[r].draw(this._ctx)}}P(vi,"id","bar"),P(vi,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),P(vi,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ys extends _e{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const r=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+i).radius;return r}parseArrayData(t,e,i,s){const r=super.parseArrayData(t,e,i,s);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=K(o[2],this.resolveDataElementOptions(a+i).radius)}return r}parseObjectData(t,e,i,s){const r=super.parseObjectData(t,e,i,s);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=K(o&&o.r&&+o.r,this.resolveDataElementOptions(a+i).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),l=r.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+o+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=a.axis,d=o.axis;for(let h=e;h<e+i;h++){const g=t[h],p=!r&&this.getParsed(h),y={},x=y[u]=r?a.getPixelForDecimal(.5):a.getPixelForValue(p[u]),w=y[d]=r?o.getBasePixel():o.getPixelForValue(p[d]);y.skip=isNaN(x)||isNaN(w),c&&(y.options=l||this.resolveDataElementOptions(h,g.active?"active":s),r&&(y.options.radius=0)),this.updateElement(g,h,y,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=K(i&&i._custom,r),s}}P(ys,"id","bubble"),P(ys,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),P(ys,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function Ug(n,t,e){let i=1,s=1,r=0,a=0;if(t<yt){const o=n,l=o+t,c=Math.cos(o),u=Math.sin(o),d=Math.cos(l),h=Math.sin(l),g=(M,C,D)=>gi(M,o,l,!0)?1:Math.max(C,C*e,D,D*e),p=(M,C,D)=>gi(M,o,l,!0)?-1:Math.min(C,C*e,D,D*e),y=g(0,c,d),x=g(bt,u,h),w=p(rt,c,d),v=p(rt+bt,u,h);i=(y-w)/2,s=(x-v)/2,r=-(y+w)/2,a=-(x+v)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:a}}class nn extends _e{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(it(i[t])){const{key:l="value"}=this._parsing;r=c=>+Ke(i[c],l)}let a,o;for(a=t,o=t+e;a<o;++a)s._parsed[a]=r(a)}}_getRotation(){return Nt(this.options.rotation-90)}_getCircumference(){return Nt(this.options.circumference)}_getRotationExtents(){let t=yt,e=-yt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,r=s._getRotation(),a=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,r=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(lf(this.options.cutout,o),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:g,offsetX:p,offsetY:y}=Ug(d,u,l),x=(i.width-a)/h,w=(i.height-a)/g,v=Math.max(Math.min(x,w)/2,0),M=Lo(this.options.radius,v),C=Math.max(M*l,0),D=(M-C)/this._getVisibleDatasetWeightTotal();this.offsetX=p*M,this.offsetY=y*M,s.total=this.calculateTotal(),this.outerRadius=M-D*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-D*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/yt)}updateElements(t,e,i,s){const r=s==="reset",a=this.chart,o=a.chartArea,c=a.options.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,h=r&&c.animateScale,g=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:y,includeOptions:x}=this._getSharedOptions(e,s);let w=this._getRotation(),v;for(v=0;v<e;++v)w+=this._circumference(v,r);for(v=e;v<e+i;++v){const M=this._circumference(v,r),C=t[v],D={x:u+this.offsetX,y:d+this.offsetY,startAngle:w,endAngle:w+M,circumference:M,outerRadius:p,innerRadius:g};x&&(D.options=y||this.resolveDataElementOptions(v,C.active?"active":s)),w+=M,this.updateElement(C,v,D,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?yt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=mi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,a,o,l;if(!t){for(s=0,r=i.data.datasets.length;s<r;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,o=a.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=o.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(K(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}P(nn,"id","doughnut"),P(nn,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),P(nn,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),P(nn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class ki extends _e{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,a=this.chart._animationsDisabled;let{start:o,count:l}=Uo(e,s,a);this._drawStart=o,this._drawCount=l,Xo(e)&&(o=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,o,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,s),h=a.axis,g=o.axis,{spanGaps:p,segment:y}=this.options,x=Qe(p)?p:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||r||s==="none",v=e+i,M=t.length;let C=e>0&&this.getParsed(e-1);for(let D=0;D<M;++D){const E=t[D],T=w?E:{};if(D<e||D>=v){T.skip=!0;continue}const b=this.getParsed(D),_=J(b[g]),S=T[h]=a.getPixelForValue(b[h],D),O=T[g]=r||_?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,b,l):b[g],D);T.skip=isNaN(S)||isNaN(O)||_,T.stop=D>0&&Math.abs(b[h]-C[h])>x,y&&(T.parsed=b,T.raw=c.data[D]),d&&(T.options=u||this.resolveDataElementOptions(D,E.active?"active":s)),w||this.updateElement(E,D,T,s),C=b}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}P(ki,"id","line"),P(ki,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),P(ki,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Mi extends _e{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=mi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return cl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),o=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const r=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,h=c.getIndexAngle(0)-.5*rt;let g=h,p;const y=360/this.countVisibleElements();for(p=0;p<e;++p)g+=this._computeAngle(p,s,y);for(p=e;p<e+i;p++){const x=t[p];let w=g,v=g+this._computeAngle(p,s,y),M=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;g=v,r&&(l.animateScale&&(M=0),l.animateRotate&&(w=v=h));const C={x:u,y:d,innerRadius:0,outerRadius:M,startAngle:w,endAngle:v,options:this.resolveDataElementOptions(p,x.active?"active":s)};this.updateElement(x,p,C,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Nt(this.resolveDataElementOptions(t,e).angle||i):0}}P(Mi,"id","polarArea"),P(Mi,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),P(Mi,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Yr extends nn{}P(Yr,"id","pie"),P(Yr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class bs extends _e{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return cl.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const o={_loop:!0,_fullLoop:r.length===s.length,options:a};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,a=s==="reset";for(let o=e;o<e+i;o++){const l=t[o],c=this.resolveDataElementOptions(o,l.active?"active":s),u=r.getPointPositionForValue(o,this.getParsed(o).r),d=a?r.xCenter:u.x,h=a?r.yCenter:u.y,g={x:d,y:h,angle:u.angle,skip:isNaN(d)||isNaN(h),options:c};this.updateElement(l,o,g,s)}}}P(bs,"id","radar"),P(bs,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),P(bs,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class xs extends _e{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,a=this.getParsed(t),o=s.getLabelForValue(a.x),l=r.getLabelForValue(a.y);return{label:i[t]||"",value:"("+o+", "+l+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=Uo(e,i,s);if(this._drawStart=r,this._drawCount=a,Xo(e)&&(r=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:l}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!l._decimated,o.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(o,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,r,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(u),h=this.includeOptions(s,d),g=a.axis,p=o.axis,{spanGaps:y,segment:x}=this.options,w=Qe(y)?y:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||r||s==="none";let M=e>0&&this.getParsed(e-1);for(let C=e;C<e+i;++C){const D=t[C],E=this.getParsed(C),T=v?D:{},b=J(E[p]),_=T[g]=a.getPixelForValue(E[g],C),S=T[p]=r||b?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,E,l):E[p],C);T.skip=isNaN(_)||isNaN(S)||b,T.stop=C>0&&Math.abs(E[g]-M[g])>w,x&&(T.parsed=E,T.raw=c.data[C]),h&&(T.options=d||this.resolveDataElementOptions(C,D.active?"active":s)),v||this.updateElement(D,C,T,s),M=E}this.updateSharedOptions(d,s,u)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let o=0;for(let l=e.length-1;l>=0;--l)o=Math.max(o,e[l].size(this.resolveDataElementOptions(l))/2);return o>0&&o}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,a)/2}}P(xs,"id","scatter"),P(xs,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),P(xs,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var Xg=Object.freeze({__proto__:null,BarController:vi,BubbleController:ys,DoughnutController:nn,LineController:ki,PieController:Yr,PolarAreaController:Mi,RadarController:bs,ScatterController:xs});function kn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Vr{constructor(t){P(this,"options");this.options=t||{}}static override(t){Object.assign(Vr.prototype,t)}init(){}formats(){return kn()}parse(){return kn()}format(){return kn()}add(){return kn()}diff(){return kn()}startOf(){return kn()}endOf(){return kn()}}var Rl={_date:Vr};function Gg(n,t,e,i){const{controller:s,data:r,_sorted:a}=n,o=s._cachedMeta.iScale;if(o&&t===o.axis&&t!=="r"&&a&&r.length){const l=o._reversePixels?xf:Ie;if(i){if(s._sharedOptions){const c=r[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const d=l(r,t,e-u),h=l(r,t,e+u);return{lo:d.lo,hi:h.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Si(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),a=e[t];for(let o=0,l=r.length;o<l;++o){const{index:c,data:u}=r[o],{lo:d,hi:h}=Gg(r[o],t,a,s);for(let g=d;g<=h;++g){const p=u[g];p.skip||i(p,c,g)}}}function Kg(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const r=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(a,2))}}function jr(n,t,e,i,s){const r=[];return!s&&!n.isPointInArea(t)||Si(n,e,t,function(o,l,c){!s&&!Ne(o,n.chartArea,0)||o.inRange(t.x,t.y,i)&&r.push({element:o,datasetIndex:l,index:c})},!0),r}function Zg(n,t,e,i){let s=[];function r(a,o,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],i),{angle:d}=Wo(a,{x:t.x,y:t.y});gi(d,c,u)&&s.push({element:a,datasetIndex:o,index:l})}return Si(n,e,t,r),s}function Qg(n,t,e,i,s,r){let a=[];const o=Kg(e);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const p=u.getCenterPoint(s);if(!(!!r||n.isPointInArea(p))&&!g)return;const x=o(t,p);x<l?(a=[{element:u,datasetIndex:d,index:h}],l=x):x===l&&a.push({element:u,datasetIndex:d,index:h})}return Si(n,e,t,c),a}function $r(n,t,e,i,s,r){return!r&&!n.isPointInArea(t)?[]:e==="r"&&!i?Zg(n,t,e,s):Qg(n,t,e,i,s,r)}function Ll(n,t,e,i,s){const r=[],a=e==="x"?"inXRange":"inYRange";let o=!1;return Si(n,e,t,(l,c,u)=>{l[a]&&l[a](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),o=o||l.inRange(t.x,t.y,s))}),i&&!o?[]:r}var qr={evaluateInteractionItems:Si,modes:{index(n,t,e,i){const s=en(t,n),r=e.axis||"x",a=e.includeInvisible||!1,o=e.intersect?jr(n,s,r,i,a):$r(n,s,r,!1,i,a),l=[];return o.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const u=o[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;let o=e.intersect?jr(n,s,r,i,a):$r(n,s,r,!1,i,a);if(o.length>0){const l=o[0].datasetIndex,c=n.getDatasetMeta(l).data;o=[];for(let u=0;u<c.length;++u)o.push({element:c[u],datasetIndex:l,index:u})}return o},point(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return jr(n,s,r,i,a)},nearest(n,t,e,i){const s=en(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return $r(n,s,r,e.intersect,i,a)},x(n,t,e,i){const s=en(t,n);return Ll(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=en(t,n);return Ll(n,s,"y",e.intersect,i)}}};const Il=["left","top","right","bottom"];function Di(n,t){return n.filter(e=>e.pos===t)}function Nl(n,t){return n.filter(e=>Il.indexOf(e.pos)===-1&&e.box.axis===t)}function Ti(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Jg(n){const t=[];let e,i,s,r,a,o;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:r,options:{stack:a,stackWeight:o=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&r+a,stackWeight:o});return t}function tp(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:r}=e;if(!i||!Il.includes(s))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=r}return t}function ep(n,t){const e=tp(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let r,a,o;for(r=0,a=n.length;r<a;++r){o=n[r];const{fullSize:l}=o.box,c=e[o.stack],u=c&&o.stackWeight/c.weight;o.horizontal?(o.width=u?u*i:l&&t.availableWidth,o.height=s):(o.width=i,o.height=u?u*s:l&&t.availableHeight)}return e}function np(n){const t=Jg(n),e=Ti(t.filter(c=>c.box.fullSize),!0),i=Ti(Di(t,"left"),!0),s=Ti(Di(t,"right")),r=Ti(Di(t,"top"),!0),a=Ti(Di(t,"bottom")),o=Nl(t,"x"),l=Nl(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(a).concat(o),chartArea:Di(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(a).concat(o)}}function Fl(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function zl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ip(n,t,e,i){const{pos:s,box:r}=e,a=n.maxPadding;if(!it(s)){e.size&&(n[s]-=e.size);const d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?r.height:r.width),e.size=d.size/d.count,n[s]+=e.size}r.getPadding&&zl(a,r.getPadding());const o=Math.max(0,t.outerWidth-Fl(a,n,"left","right")),l=Math.max(0,t.outerHeight-Fl(a,n,"top","bottom")),c=o!==n.w,u=l!==n.h;return n.w=o,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function sp(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function rp(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{r[a]=Math.max(t[a],e[a])}),r}return i(n?["left","right"]:["top","bottom"])}function Ci(n,t,e,i){const s=[];let r,a,o,l,c,u;for(r=0,a=n.length,c=0;r<a;++r){o=n[r],l=o.box,l.update(o.width||t.w,o.height||t.h,rp(o.horizontal,t));const{same:d,other:h}=ip(t,e,o,i);c|=d&&s.length,u=u||h,l.fullSize||s.push(o)}return c&&Ci(s,t,e,i)||u}function _s(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Bl(n,t,e,i){const s=e.padding;let{x:r,y:a}=t;for(const o of n){const l=o.box,c=i[o.stack]||{count:1,placed:0,weight:1},u=o.stackWeight/c.weight||1;if(o.horizontal){const d=t.w*u,h=c.size||l.height;Qt(c.start)&&(a=c.start),l.fullSize?_s(l,s.left,a,e.outerWidth-s.right-s.left,h):_s(l,t.left+c.placed,a,d,h),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*u,h=c.size||l.width;Qt(c.start)&&(r=c.start),l.fullSize?_s(l,r,s.top,h,e.outerHeight-s.bottom-s.top):_s(l,r,t.top+c.placed,h,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=a}var $t={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=Ft(n.options.layout.padding),r=Math.max(t-s.width,0),a=Math.max(e-s.height,0),o=np(n.boxes),l=o.vertical,c=o.horizontal;dt(n.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,x)=>x.box.options&&x.box.options.display===!1?y:y+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:a,vBoxMaxWidth:r/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},s);zl(h,Ft(i));const g=Object.assign({maxPadding:h,w:r,h:a,x:s.left,y:s.top},s),p=ep(l.concat(c),d);Ci(o.fullSize,g,d,p),Ci(l,g,d,p),Ci(c,g,d,p)&&Ci(l,g,d,p),sp(g),Bl(o.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,Bl(o.rightAndBottom,g,d,p),n.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},dt(o.chartArea,y=>{const x=y.box;Object.assign(x,n.chartArea),x.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class Hl{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ap extends Hl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ws="$chartjs",op={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Wl=n=>n===null||n==="";function lp(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[ws]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Wl(s)){const r=hl(n,"width");r!==void 0&&(n.width=r)}if(Wl(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=hl(n,"height");r!==void 0&&(n.height=r)}return n}const Yl=hg?{passive:!0}:!1;function cp(n,t,e){n&&n.addEventListener(t,e,Yl)}function up(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Yl)}function dp(n,t){const e=op[n.type]||n.type,{x:i,y:s}=en(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function vs(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function hp(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||vs(o.addedNodes,i),a=a&&!vs(o.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function fp(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||vs(o.removedNodes,i),a=a&&!vs(o.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Pi=new Map;let Vl=0;function jl(){const n=window.devicePixelRatio;n!==Vl&&(Vl=n,Pi.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function gp(n,t){Pi.size||window.addEventListener("resize",jl),Pi.set(n,t)}function pp(n){Pi.delete(n),Pi.size||window.removeEventListener("resize",jl)}function mp(n,t,e){const i=n.canvas,s=i&&Fr(i);if(!s)return;const r=qo((o,l)=>{const c=s.clientWidth;e(o,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(o=>{const l=o[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return a.observe(s),gp(n,r),a}function Ur(n,t,e){e&&e.disconnect(),t==="resize"&&pp(n)}function yp(n,t,e){const i=n.canvas,s=qo(r=>{n.ctx!==null&&e(dp(r,n))},n);return cp(i,t,s),s}class bp extends Hl{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(lp(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ws])return!1;const i=e[ws].initial;["height","width"].forEach(r=>{const a=i[r];J(a)?e.removeAttribute(r):e.setAttribute(r,a)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[ws],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:hp,detach:fp,resize:mp}[e]||yp;s[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Ur,detach:Ur,resize:Ur}[e]||up)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return dg(t,e,i,s)}isAttached(t){const e=t&&Fr(t);return!!(e&&e.isConnected)}}function xp(n){return!Nr()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?ap:bp}class Yt{constructor(){P(this,"x");P(this,"y");P(this,"active",!1);P(this,"options");P(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Qe(this.x)&&Qe(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}P(Yt,"defaults",{}),P(Yt,"defaultRoutes");function _p(n,t){const e=n.options.ticks,i=wp(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?kp(t):[],a=r.length,o=r[0],l=r[a-1],c=[];if(a>s)return Mp(t,c,r,a/s),c;const u=vp(r,t,s);if(a>0){let d,h;const g=a>1?Math.round((l-o)/(a-1)):null;for(ks(t,c,u,J(g)?0:o-g,o),d=0,h=a-1;d<h;d++)ks(t,c,u,r[d],r[d+1]);return ks(t,c,u,l,J(g)?t.length:l+g),c}return ks(t,c,u),c}function wp(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function vp(n,t,e){const i=Sp(n),s=t.length/e;if(!i)return Math.max(s,1);const r=pf(i);for(let a=0,o=r.length-1;a<o;a++){const l=r[a];if(l>s)return l}return Math.max(s,1)}function kp(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Mp(n,t,e,i){let s=0,r=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===r&&(t.push(n[a]),s++,r=e[s*i])}function ks(n,t,e,i,s){const r=K(i,0),a=Math.min(K(s,n.length),n.length);let o=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),u=r;u<0;)o++,u=Math.round(r+o*e);for(c=Math.max(r,0);c<a;c++)c===u&&(t.push(n[c]),o++,u=Math.round(r+o*e))}function Sp(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const Dp=n=>n==="left"?"right":n==="right"?"left":n,$l=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,ql=(n,t)=>Math.min(t||n,n);function Ul(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;r<s;r+=i)e.push(n[Math.floor(r)]);return e}function Tp(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),r=n._startPixel,a=n._endPixel,o=1e-6;let l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-r,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-o||l>a+o)))return l}function Cp(n,t){dt(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;r<s;++r)delete e.data[i[r]];i.splice(0,s)}})}function Oi(n){return n.drawTicks?n.tickLength:0}function Xl(n,t){if(!n.display)return 0;const e=xt(n.font,t),i=Ft(n.padding);return(ot(n.text)?n.text.length:1)*e.lineHeight+i.height}function Pp(n,t){return tn(n,{scale:t,type:"scale"})}function Op(n,t,e){return tn(n,{tick:e,index:t,type:"tick"})}function Ep(n,t,e){let i=Dr(n);return(e&&t!=="right"||!e&&t==="right")&&(i=Dp(i)),i}function Ap(n,t,e,i){const{top:s,left:r,bottom:a,right:o,chart:l}=n,{chartArea:c,scales:u}=l;let d=0,h,g,p;const y=a-s,x=o-r;if(n.isHorizontal()){if(g=jt(i,r,o),it(e)){const w=Object.keys(e)[0],v=e[w];p=u[w].getPixelForValue(v)+y-t}else e==="center"?p=(c.bottom+c.top)/2+y-t:p=$l(n,e,t);h=o-r}else{if(it(e)){const w=Object.keys(e)[0],v=e[w];g=u[w].getPixelForValue(v)-x+t}else e==="center"?g=(c.left+c.right)/2-x+t:g=$l(n,e,t);p=jt(i,a,s),d=e==="left"?-bt:bt}return{titleX:g,titleY:p,maxWidth:h,rotation:d}}class Mn extends Yt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=ce(t,Number.POSITIVE_INFINITY),e=ce(e,Number.NEGATIVE_INFINITY),i=ce(i,Number.POSITIVE_INFINITY),s=ce(s,Number.NEGATIVE_INFINITY),{min:ce(t,i),max:ce(e,s),minDefined:kt(t),maxDefined:kt(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),a;if(s&&r)return{min:e,max:i};const o=this.getMatchingVisibleMetas();for(let l=0,c=o.length;l<c;++l)a=o[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),r||(i=Math.max(i,a.max));return e=r&&e>i?i:e,i=s&&e>i?e:i,{min:ce(e,ce(i,e)),max:ce(i,ce(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ut(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Vf(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o<this.ticks.length;this._convertTicksToLabels(l?Ul(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=_p(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ut(this.options.afterUpdate,[this])}beforeSetDimensions(){ut(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ut(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ut(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ut(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,r;for(i=0,s=t.length;i<s;i++)r=t[i],r.label=ut(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){ut(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ut(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=ql(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,r=e.maxRotation;let a=s,o,l,c;if(!this._isVisible()||!e.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,g=Ht(this.chart.width-d,0,this.maxWidth);o=t.offset?this.maxWidth/i:g/(i-1),d+6>o&&(o=g/(i-(t.offset?.5:1)),l=this.maxHeight-Oi(t.grid)-e.padding-Xl(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),a=cs(Math.min(Math.asin(Ht((u.highest.height+6)/o,-1,1)),Math.asin(Ht(l/c,-1,1))-Math.asin(Ht(h/c,-1,1)))),a=Math.max(s,Math.min(r,a))),this.labelRotation=a}afterCalculateLabelRotation(){ut(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ut(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const l=Xl(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Oi(r)+l):(t.height=this.maxHeight,t.width=Oi(r)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),g=i.padding*2,p=Nt(this.labelRotation),y=Math.cos(p),x=Math.sin(p);if(o){const w=i.mirror?0:x*d.width+y*h.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*d.width+x*h.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,x,y)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:a},position:o}=this.options,l=this.labelRotation!==0,c=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,g=0;l?c?(h=s*t.width,g=i*e.height):(h=i*t.height,g=s*e.width):r==="start"?g=e.width:r==="end"?h=t.width:r!=="inner"&&(h=t.width/2,g=e.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-d+a)*this.width/(this.width-d),0)}else{let u=e.height/2,d=t.height/2;r==="start"?(u=0,d=t.height):r==="end"&&(u=e.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ut(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)J(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Ul(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:r}=this,a=[],o=[],l=Math.floor(e/ql(e,i));let c=0,u=0,d,h,g,p,y,x,w,v,M,C,D;for(d=0;d<e;d+=l){if(p=t[d].label,y=this._resolveTickFontOptions(d),s.font=x=y.string,w=r[x]=r[x]||{data:{},gc:[]},v=y.lineHeight,M=C=0,!J(p)&&!ot(p))M=hs(s,w.data,w.gc,M,p),C=v;else if(ot(p))for(h=0,g=p.length;h<g;++h)D=p[h],!J(D)&&!ot(D)&&(M=hs(s,w.data,w.gc,M,D),C+=v);a.push(M),o.push(C),c=Math.max(M,c),u=Math.max(C,u)}Cp(r,e);const E=a.indexOf(c),T=o.indexOf(u),b=_=>({width:a[_]||0,height:o[_]||0});return{first:b(0),last:b(e-1),widest:b(E),highest:b(T),widths:a,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return bf(this._alignToPixels?xn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Op(this.getContext(),t,i))}return this.$context||(this.$context=Pp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Nt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),a=t.autoSkipPadding||0,o=r?r.widest.width+a:0,l=r?r.highest.height+a:0;return this.isHorizontal()?l*i>o*s?o/i:l/s:l*s<o*i?l/i:o/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:a,border:o}=s,l=r.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Oi(r),g=[],p=o.setContext(this.getContext()),y=p.display?p.width:0,x=y/2,w=function($){return xn(i,$,y)};let v,M,C,D,E,T,b,_,S,O,A,F;if(a==="top")v=w(this.bottom),T=this.bottom-h,_=v-x,O=w(t.top)+x,F=t.bottom;else if(a==="bottom")v=w(this.top),O=t.top,F=w(t.bottom)-x,T=v+x,_=this.top+h;else if(a==="left")v=w(this.right),E=this.right-h,b=v-x,S=w(t.left)+x,A=t.right;else if(a==="right")v=w(this.left),S=t.left,A=w(t.right)-x,E=v+x,b=this.left+h;else if(e==="x"){if(a==="center")v=w((t.top+t.bottom)/2+.5);else if(it(a)){const $=Object.keys(a)[0],N=a[$];v=w(this.chart.scales[$].getPixelForValue(N))}O=t.top,F=t.bottom,T=v+x,_=T+h}else if(e==="y"){if(a==="center")v=w((t.left+t.right)/2);else if(it(a)){const $=Object.keys(a)[0],N=a[$];v=w(this.chart.scales[$].getPixelForValue(N))}E=v-x,b=E-h,S=t.left,A=t.right}const j=K(s.ticks.maxTicksLimit,d),G=Math.max(1,Math.ceil(d/j));for(M=0;M<d;M+=G){const $=this.getContext(M),N=r.setContext($),st=o.setContext($),z=N.lineWidth,At=N.color,_t=st.dash||[],H=st.dashOffset,L=N.tickWidth,B=N.tickColor,V=N.tickBorderDash||[],U=N.tickBorderDashOffset;C=Tp(this,M,l),C!==void 0&&(D=xn(i,C,z),c?E=b=S=A=D:T=_=O=F=D,g.push({tx1:E,ty1:T,tx2:b,ty2:_,x1:S,y1:O,x2:A,y2:F,width:z,color:At,borderDash:_t,borderDashOffset:H,tickWidth:L,tickColor:B,tickBorderDash:V,tickBorderDashOffset:U}))}return this._ticksLength=d,this._borderValue=v,g}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:r}=i,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,h=Oi(i.grid),g=h+u,p=d?-u:g,y=-Nt(this.labelRotation),x=[];let w,v,M,C,D,E,T,b,_,S,O,A,F="middle";if(s==="top")E=this.bottom-p,T=this._getXAxisLabelAlignment();else if(s==="bottom")E=this.top+p,T=this._getXAxisLabelAlignment();else if(s==="left"){const G=this._getYAxisLabelAlignment(h);T=G.textAlign,D=G.x}else if(s==="right"){const G=this._getYAxisLabelAlignment(h);T=G.textAlign,D=G.x}else if(e==="x"){if(s==="center")E=(t.top+t.bottom)/2+g;else if(it(s)){const G=Object.keys(s)[0],$=s[G];E=this.chart.scales[G].getPixelForValue($)+g}T=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")D=(t.left+t.right)/2-g;else if(it(s)){const G=Object.keys(s)[0],$=s[G];D=this.chart.scales[G].getPixelForValue($)}T=this._getYAxisLabelAlignment(h).textAlign}e==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const j=this._getLabelSizes();for(w=0,v=o.length;w<v;++w){M=o[w],C=M.label;const G=r.setContext(this.getContext(w));b=this.getPixelForTick(w)+r.labelOffset,_=this._resolveTickFontOptions(w),S=_.lineHeight,O=ot(C)?C.length:1;const $=O/2,N=G.color,st=G.textStrokeColor,z=G.textStrokeWidth;let At=T;a?(D=b,T==="inner"&&(w===v-1?At=this.options.reverse?"left":"right":w===0?At=this.options.reverse?"right":"left":At="center"),s==="top"?c==="near"||y!==0?A=-O*S+S/2:c==="center"?A=-j.highest.height/2-$*S+S:A=-j.highest.height+S/2:c==="near"||y!==0?A=S/2:c==="center"?A=j.highest.height/2-$*S:A=j.highest.height-O*S,d&&(A*=-1),y!==0&&!G.showLabelBackdrop&&(D+=S/2*Math.sin(y))):(E=b,A=(1-O)*S/2);let _t;if(G.showLabelBackdrop){const H=Ft(G.backdropPadding),L=j.heights[w],B=j.widths[w];let V=A-H.top,U=0-H.left;switch(F){case"middle":V-=L/2;break;case"bottom":V-=L;break}switch(T){case"center":U-=B/2;break;case"right":U-=B;break;case"inner":w===v-1?U-=B:w>0&&(U-=B/2);break}_t={left:U,top:V,width:B+H.width,height:L+H.height,color:G.backdropColor}}x.push({label:C,font:_,textOffset:A,options:{rotation:y,color:N,strokeColor:st,strokeWidth:z,textAlign:At,textBaseline:F,translation:[D,E],backdrop:_t}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Nt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,a=this._getLabelSizes(),o=t+r,l=a.widest.width;let c,u;return e==="left"?s?(u=this.right+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,a;const o=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,a=s.length;r<a;++r){const l=s[r];e.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&o({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,r=i.setContext(this.getContext()),a=i.display?r.width:0;if(!a)return;const o=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=xn(t,this.left,a)-a/2,u=xn(t,this.right,o)+o/2,d=h=l):(d=xn(t,this.top,a)-a/2,h=xn(t,this.bottom,o)+o/2,c=u=l),e.save(),e.lineWidth=r.width,e.strokeStyle=r.color,e.beginPath(),e.moveTo(c,d),e.lineTo(u,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&bi(i,s);const r=this.getLabelItems(t);for(const a of r){const o=a.options,l=a.font,c=a.label,u=a.textOffset;_n(i,c,0,u,l,o)}s&&xi(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const r=xt(i.font),a=Ft(i.padding),o=i.align;let l=r.lineHeight/2;e==="bottom"||e==="center"||it(e)?(l+=a.bottom,ot(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=Ap(this,l,e,o);_n(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:h,textAlign:Ep(o,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=K(t.grid&&t.grid.z,-1),s=K(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Mn.prototype.draw?[{z:e,draw:r=>{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,a;for(r=0,a=e.length;r<a;++r){const o=e[r];o[i]===this.id&&(!t||o.type===t)&&s.push(o)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return xt(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ms{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;Ip(e)&&(i=this.register(e));const s=this.items,r=t.id,a=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,Rp(t,a,i),this.override&&Dt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in Dt[s]&&(delete Dt[s][i],this.override&&delete bn[i])}}function Rp(n,t,e){const i=di(Object.create(null),[e?Dt.get(e):{},Dt.get(t),n.defaults]);Dt.set(t,i),n.defaultRoutes&&Lp(t,n.defaultRoutes),n.descriptors&&Dt.describe(t,n.descriptors)}function Lp(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),a=t[e].split("."),o=a.pop(),l=a.join(".");Dt.route(r,s,l,o)})}function Ip(n){return"id"in n&&"defaults"in n}class Np{constructor(){this.controllers=new Ms(_e,"datasets",!0),this.elements=new Ms(Yt,"elements"),this.plugins=new Ms(Object,"plugins"),this.scales=new Ms(Mn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):dt(s,a=>{const o=i||this._getRegistryForType(a);this._exec(t,o,a)})})}_exec(t,e,i){const s=kr(t);ut(i["before"+s],[],i),e[t](i),ut(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var De=new Np;class Fp{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,s){s=s||{};for(const r of t){const a=r.plugin,o=a[i],l=[e,s,r.options];if(ut(o,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){J(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=K(i.options&&i.options.plugins,{}),r=zp(i);return s===!1&&!e?[]:Hp(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,a)=>r.filter(o=>!a.some(l=>o.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function zp(n){const t={},e=[],i=Object.keys(De.plugins.items);for(let r=0;r<i.length;r++)e.push(De.getPlugin(i[r]));const s=n.plugins||[];for(let r=0;r<s.length;r++){const a=s[r];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Bp(n,t){return!t&&n===!1?null:n===!0?{}:n}function Hp(n,{plugins:t,localIds:e},i,s){const r=[],a=n.getContext();for(const o of t){const l=o.id,c=Bp(i[l],s);c!==null&&r.push({plugin:o,options:Wp(n.config,{plugin:o,local:e[l]},c,a)})}return r}function Wp(n,{plugin:t,local:e},i,s){const r=n.pluginScopeKeys(t),a=n.getOptionScopes(i,r);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Xr(n,t){const e=Dt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Yp(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Vp(n,t){return n===t?"_index_":"_value_"}function Gl(n){if(n==="x"||n==="y"||n==="r")return n}function jp(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Gr(n,...t){if(Gl(n))return n;for(const e of t){const i=e.axis||jp(e.position)||n.length>1&&Gl(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Kl(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function $p(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Kl(n,"x",e[0])||Kl(n,"y",e[0])}return{}}function qp(n,t){const e=bn[n.type]||{scales:{}},i=t.scales||{},s=Xr(n.type,t),r=Object.create(null);return Object.keys(i).forEach(a=>{const o=i[a];if(!it(o))return console.error(`Invalid scale configuration for scale: ${a}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=Gr(a,o,$p(a,n),Dt.scales[o.type]),c=Vp(l,s),u=e.scales||{};r[a]=hi(Object.create(null),[{axis:l},o,u[l],u[c]])}),n.data.datasets.forEach(a=>{const o=a.type||n.type,l=a.indexAxis||Xr(o,t),u=(bn[o]||{}).scales||{};Object.keys(u).forEach(d=>{const h=Yp(d,l),g=a[h+"AxisID"]||h;r[g]=r[g]||Object.create(null),hi(r[g],[{axis:h},i[g],u[d]])})}),Object.keys(r).forEach(a=>{const o=r[a];hi(o,[Dt.scales[o.type],Dt.scale])}),r}function Zl(n){const t=n.options||(n.options={});t.plugins=K(t.plugins,{}),t.scales=qp(n,t)}function Ql(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Up(n){return n=n||{},n.data=Ql(n.data),Zl(n),n}const Jl=new Map,tc=new Set;function Ss(n,t){let e=Jl.get(n);return e||(e=t(),Jl.set(n,e),tc.add(e)),e}const Ei=(n,t,e)=>{const i=Ke(t,e);i!==void 0&&n.add(i)};class Xp{constructor(t){this._config=Up(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ql(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Zl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ss(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ss(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ss(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Ss(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;const l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(d=>Ei(l,t,d))),u.forEach(d=>Ei(l,s,d)),u.forEach(d=>Ei(l,bn[r]||{},d)),u.forEach(d=>Ei(l,Dt,d)),u.forEach(d=>Ei(l,Pr,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),tc.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,bn[e]||{},Dt.datasets[e]||{},{type:e},Dt,Pr]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:a,subPrefixes:o}=ec(this._resolverCache,t,s);let l=a;if(Kp(a,e)){r.$shared=!1,i=Jt(i)?i():i;const c=this.createResolver(t,i,o);l=Wn(a,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=ec(this._resolverCache,t,i);return it(e)?Wn(r,e,void 0,s):r}}function ec(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:Rr(t,e),subPrefixes:e.filter(o=>!o.toLowerCase().includes("hover"))},i.set(s,r)),r}const Gp=n=>it(n)&&Object.getOwnPropertyNames(n).some(t=>Jt(n[t]));function Kp(n,t){const{isScriptable:e,isIndexable:i}=il(n);for(const s of t){const r=e(s),a=i(s),o=(a||r)&&n[s];if(r&&(Jt(o)||Gp(o))||a&&ot(o))return!0}return!1}var Zp="4.4.4";const Qp=["top","bottom","left","right","chartArea"];function nc(n,t){return n==="top"||n==="bottom"||Qp.indexOf(n)===-1&&t==="x"}function ic(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function sc(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ut(e&&e.onComplete,[n],t)}function Jp(n){const t=n.chart,e=t.options.animation;ut(e&&e.onProgress,[n],t)}function rc(n){return Nr()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Ds={},ac=n=>{const t=rc(n);return Object.values(Ds).filter(e=>e.canvas===t).pop()};function tm(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const a=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=a)}}}function em(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Ts(n,t,e){return n.options.clip?n[e]:t[e]}function nm(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Ts(e,t,"left"),right:Ts(e,t,"right"),top:Ts(i,t,"top"),bottom:Ts(i,t,"bottom")}:t}let ge=(fn=class{static register(...t){De.add(...t),oc()}static unregister(...t){De.remove(...t),oc()}constructor(t,e){const i=this.config=new Xp(e),s=rc(t),r=ac(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||xp(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,a.aspectRatio),l=o&&o.canvas,c=l&&l.height,u=l&&l.width;if(this.id=of(),this.ctx=o,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Fp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=vf(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Ds[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Fe.listen(this,"complete",sc),Fe.listen(this,"progress",Jp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return J(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return De}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():dl(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return tl(this.canvas,this.ctx),this}stop(){return Fe.stop(this),this}resize(t,e){Fe.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,r),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,dl(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),ut(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};dt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,o)=>(a[o]=!1,a),{});let r=[];e&&(r=r.concat(Object.keys(e).map(a=>{const o=e[a],l=Gr(a,o),c=l==="r",u=l==="x";return{options:o,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),dt(r,a=>{const o=a.options,l=o.id,c=Gr(l,o),u=K(o.type,a.dtype);(o.position===void 0||nc(o.position,c)!==nc(a.dposition))&&(o.position=a.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===u)d=i[l];else{const h=De.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(o,t)}),dt(s,(a,o)=>{a||delete i[o]}),dt(i,a=>{$t.configure(this,a,a.options),$t.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(ic("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const r=e[i];let a=this.getDatasetMeta(i);const o=r.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=o,a.indexAxis=r.indexAxis||Xr(o,this.options),a.order=r.order||0,a.index=i,a.label=""+r.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const l=De.getController(o),{datasetElementType:c,dataElementType:u}=Dt.datasets[o];Object.assign(l,{dataElementType:De.getElement(u),datasetElementType:c&&De.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){dt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),h=!s&&r.indexOf(d)===-1;d.buildOrUpdateElements(h),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||dt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ic("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){dt(this.scales,t=>{$t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Fo(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const a=i==="_removeElements"?-r:r;tm(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(a=>a[0]===r).map((a,o)=>o+","+a.splice(1).join(","))),s=i(0);for(let r=1;r<e;r++)if(!Fo(s,i(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$t.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],dt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Jt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Fe.has(this)?this.attached&&!Fe.running(this)&&Fe.start(this):(this.draw(),sc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,r;for(s=0,r=e.length;s<r;++s){const a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=nm(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&bi(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&xi(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return Ne(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=qr.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=tn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,s);Qt(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(r,{visible:i}),this.update(o=>o.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Fe.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),tl(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ds[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(r,a)=>{e.addEventListener(this,r,a),t[r]=a},s=(r,a,o)=>{r.offsetX=a,r.offsetY=o,this._eventHandler(r)};dt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",r),i("detach",a)};a=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){dt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},dt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,a,o,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),o=0,l=t.length;o<l;++o){a=t[o];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:r,index:a})=>{const o=this.getDatasetMeta(r);if(!o)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:o.data[a],index:a}});!rs(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=r(e,t),o=i?t:r(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,a=e,o=this._getActiveElements(t,s,i,a),l=ff(t),c=em(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ut(r.onHover,[t,o,this],this),l&&ut(r.onClick,[t,o,this],this));const u=!rs(o,s);return(u||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},P(fn,"defaults",Dt),P(fn,"instances",Ds),P(fn,"overrides",bn),P(fn,"registry",De),P(fn,"version",Zp),P(fn,"getChart",ac),fn);function oc(){return dt(ge.instances,n=>n._plugins.invalidate())}function im(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:a,outerRadius:o,innerRadius:l}=t;let c=s/o;n.beginPath(),n.arc(r,a,o,i-c,e+c),l>s?(c=s/l,n.arc(r,a,l,e+c,i-c,!0)):n.arc(r,a,s,e+bt,i-bt),n.closePath(),n.clip()}function sm(n){return Ar(n,["outerStart","outerEnd","innerStart","innerEnd"])}function rm(n,t,e,i){const s=sm(n.options.borderRadius),r=(e-t)/2,a=Math.min(r,i*t/2),o=l=>{const c=(e-Math.min(r,l))*i/2;return Ht(l,0,Math.min(r,c))};return{outerStart:o(s.outerStart),outerEnd:o(s.outerEnd),innerStart:Ht(s.innerStart,0,a),innerEnd:Ht(s.innerEnd,0,a)}}function jn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function Cs(n,t,e,i,s,r){const{x:a,y:o,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+i+e-c,0),h=u>0?u+i+e+c:0;let g=0;const p=s-l;if(i){const G=u>0?u-i:0,$=d>0?d-i:0,N=(G+$)/2,st=N!==0?p*N/(N+i):p;g=(p-st)/2}const y=Math.max(.001,p*d-e/rt)/d,x=(p-y)/2,w=l+x+g,v=s-x-g,{outerStart:M,outerEnd:C,innerStart:D,innerEnd:E}=rm(t,h,d,v-w),T=d-M,b=d-C,_=w+M/T,S=v-C/b,O=h+D,A=h+E,F=w+D/O,j=v-E/A;if(n.beginPath(),r){const G=(_+S)/2;if(n.arc(a,o,d,_,G),n.arc(a,o,d,G,S),C>0){const z=jn(b,S,a,o);n.arc(z.x,z.y,C,S,v+bt)}const $=jn(A,v,a,o);if(n.lineTo($.x,$.y),E>0){const z=jn(A,j,a,o);n.arc(z.x,z.y,E,v+bt,j+Math.PI)}const N=(v-E/h+(w+D/h))/2;if(n.arc(a,o,h,v-E/h,N,!0),n.arc(a,o,h,N,w+D/h,!0),D>0){const z=jn(O,F,a,o);n.arc(z.x,z.y,D,F+Math.PI,w-bt)}const st=jn(T,w,a,o);if(n.lineTo(st.x,st.y),M>0){const z=jn(T,_,a,o);n.arc(z.x,z.y,M,w-bt,_)}}else{n.moveTo(a,o);const G=Math.cos(_)*d+a,$=Math.sin(_)*d+o;n.lineTo(G,$);const N=Math.cos(S)*d+a,st=Math.sin(S)*d+o;n.lineTo(N,st)}n.closePath()}function am(n,t,e,i,s){const{fullCircles:r,startAngle:a,circumference:o}=t;let l=t.endAngle;if(r){Cs(n,t,e,i,l,s);for(let c=0;c<r;++c)n.fill();isNaN(o)||(l=a+(o%yt||yt))}return Cs(n,t,e,i,l,s),n.fill(),l}function om(n,t,e,i,s){const{fullCircles:r,startAngle:a,circumference:o,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,g=l.borderAlign==="inner";if(!c)return;n.setLineDash(d||[]),n.lineDashOffset=h,g?(n.lineWidth=c*2,n.lineJoin=u||"round"):(n.lineWidth=c,n.lineJoin=u||"bevel");let p=t.endAngle;if(r){Cs(n,t,e,i,p,s);for(let y=0;y<r;++y)n.stroke();isNaN(o)||(p=a+(o%yt||yt))}g&&im(n,t,p),r||(Cs(n,t,e,i,p,s),n.stroke())}class Ai extends Yt{constructor(e){super();P(this,"circumference");P(this,"endAngle");P(this,"fullCircles");P(this,"innerRadius");P(this,"outerRadius");P(this,"pixelMargin");P(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.getProps(["x","y"],s),{angle:a,distance:o}=Wo(r,{x:e,y:i}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,p=K(h,c-l),y=gi(a,l,c)&&l!==c,x=p>=yt||y,w=Le(o,u+g,d+g);return x&&w}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:a,innerRadius:o,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:u}=this.options,d=(r+a)/2,h=(o+l+u+c)/2;return{x:i+Math.cos(d)*h,y:s+Math.sin(d)*h}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,a=(i.spacing||0)/2,o=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>yt?Math.floor(s/yt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(rt,s||0)),u=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,am(e,this,u,a,o),om(e,this,u,a,o),e.restore()}}P(Ai,"id","arc"),P(Ai,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),P(Ai,"defaultRoutes",{backgroundColor:"backgroundColor"}),P(Ai,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function lc(n,t,e=t){n.lineCap=K(e.borderCapStyle,t.borderCapStyle),n.setLineDash(K(e.borderDash,t.borderDash)),n.lineDashOffset=K(e.borderDashOffset,t.borderDashOffset),n.lineJoin=K(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=K(e.borderWidth,t.borderWidth),n.strokeStyle=K(e.borderColor,t.borderColor)}function lm(n,t,e){n.lineTo(e.x,e.y)}function cm(n){return n.stepped?Lf:n.tension||n.cubicInterpolationMode==="monotone"?If:lm}function cc(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:a,end:o}=t,l=Math.max(s,a),c=Math.min(r,o),u=s<a&&r<a||s>o&&r>o;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function um(n,t,e,i){const{points:s,options:r}=t,{count:a,start:o,loop:l,ilen:c}=cc(s,e,i),u=cm(r);let{move:d=!0,reverse:h}=i||{},g,p,y;for(g=0;g<=c;++g)p=s[(o+(h?c-g:g))%a],!p.skip&&(d?(n.moveTo(p.x,p.y),d=!1):u(n,y,p,h,r.stepped),y=p);return l&&(p=s[(o+(h?c:0))%a],u(n,y,p,h,r.stepped)),!!l}function dm(n,t,e,i){const s=t.points,{count:r,start:a,ilen:o}=cc(s,e,i),{move:l=!0,reverse:c}=i||{};let u=0,d=0,h,g,p,y,x,w;const v=C=>(a+(c?o-C:C))%r,M=()=>{y!==x&&(n.lineTo(u,x),n.lineTo(u,y),n.lineTo(u,w))};for(l&&(g=s[v(0)],n.moveTo(g.x,g.y)),h=0;h<=o;++h){if(g=s[v(h)],g.skip)continue;const C=g.x,D=g.y,E=C|0;E===p?(D<y?y=D:D>x&&(x=D),u=(d*u+C)/++d):(M(),n.lineTo(C,D),p=E,d=0,y=x=D),w=D}M()}function Kr(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?dm:um}function hm(n){return n.stepped?fg:n.tension||n.cubicInterpolationMode==="monotone"?gg:vn}function fm(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),lc(n,t.options),n.stroke(s)}function gm(n,t,e,i){const{segments:s,options:r}=t,a=Kr(t);for(const o of s)lc(n,r,o.style),n.beginPath(),a(n,t,o,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const pm=typeof Path2D=="function";function mm(n,t,e,i){pm&&!t.options.segment?fm(n,t,e,i):gm(n,t,e,i)}class sn extends Yt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;rg(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_g(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,a=bl(this,{property:e,start:s,end:s});if(!a.length)return;const o=[],l=hm(i);let c,u;for(c=0,u=a.length;c<u;++c){const{start:d,end:h}=a[c],g=r[d],p=r[h];if(g===p){o.push(g);continue}const y=Math.abs((s-g[e])/(p[e]-g[e])),x=l(g,p,y,i.stepped);x[e]=t[e],o.push(x)}return o.length===1?o[0]:o}pathSegment(t,e,i){return Kr(this)(t,this,e,i)}path(t,e,i){const s=this.segments,r=Kr(this);let a=this._loop;e=e||0,i=i||this.points.length-e;for(const o of s)a&=r(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),mm(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}P(sn,"id","line"),P(sn,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),P(sn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),P(sn,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function uc(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)<s.radius+s.hitRadius}class Ps extends Yt{constructor(e){super();P(this,"parsed");P(this,"skip");P(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.options,{x:a,y:o}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(i-o,2)<Math.pow(r.hitRadius+r.radius,2)}inXRange(e,i){return uc(this,e,"x",i)}inYRange(e,i){return uc(this,e,"y",i)}getCenterPoint(e){const{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);const s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){const s=this.options;this.skip||s.radius<.1||!Ne(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Er(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}P(Ps,"id","point"),P(Ps,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),P(Ps,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function dc(n,t){const{x:e,y:i,base:s,width:r,height:a}=n.getProps(["x","y","base","width","height"],t);let o,l,c,u,d;return n.horizontal?(d=a/2,o=Math.min(e,s),l=Math.max(e,s),c=i-d,u=i+d):(d=r/2,o=e-d,l=e+d,c=Math.min(i,s),u=Math.max(i,s)),{left:o,top:c,right:l,bottom:u}}function rn(n,t,e,i){return n?0:Ht(t,e,i)}function ym(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,r=nl(i);return{t:rn(s.top,r.top,0,e),r:rn(s.right,r.right,0,t),b:rn(s.bottom,r.bottom,0,e),l:rn(s.left,r.left,0,t)}}function bm(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=Je(s),a=Math.min(t,e),o=n.borderSkipped,l=i||it(s);return{topLeft:rn(!l||o.top||o.left,r.topLeft,0,a),topRight:rn(!l||o.top||o.right,r.topRight,0,a),bottomLeft:rn(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:rn(!l||o.bottom||o.right,r.bottomRight,0,a)}}function xm(n){const t=dc(n),e=t.right-t.left,i=t.bottom-t.top,s=ym(n,e/2,i/2),r=bm(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function Zr(n,t,e,i){const s=t===null,r=e===null,o=n&&!(s&&r)&&dc(n,i);return o&&(s||Le(t,o.left,o.right))&&(r||Le(e,o.top,o.bottom))}function _m(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function wm(n,t){n.rect(t.x,t.y,t.w,t.h)}function Qr(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,r=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+a,radius:n.radius}}class Os extends Yt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:a}=xm(this),o=_m(a.radius)?Hn:wm;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),o(t,Qr(a,e,r)),t.clip(),o(t,Qr(r,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,Qr(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Zr(this,t,e,i)}inXRange(t,e){return Zr(this,t,null,e)}inYRange(t,e){return Zr(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}P(Os,"id","bar"),P(Os,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),P(Os,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var vm=Object.freeze({__proto__:null,ArcElement:Ai,BarElement:Os,LineElement:sn,PointElement:Ps});const Jr=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],hc=Jr.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function fc(n){return Jr[n%Jr.length]}function gc(n){return hc[n%hc.length]}function km(n,t){return n.borderColor=fc(t),n.backgroundColor=gc(t),++t}function Mm(n,t){return n.backgroundColor=n.data.map(()=>fc(t++)),t}function Sm(n,t){return n.backgroundColor=n.data.map(()=>gc(t++)),t}function Dm(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof nn?t=Mm(e,t):s instanceof Mi?t=Sm(e,t):s&&(t=km(e,t))}}function pc(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Tm(n){return n&&(n.borderColor||n.backgroundColor)}var Cm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(pc(i)||Tm(s)||r&&pc(r)))return;const a=Dm(n);i.forEach(a)}};function Pm(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const a=[],o=(e-2)/(r-2);let l=0;const c=t+e-1;let u=t,d,h,g,p,y;for(a[l++]=n[u],d=0;d<r-2;d++){let x=0,w=0,v;const M=Math.floor((d+1)*o)+1+t,C=Math.min(Math.floor((d+2)*o)+1,e)+t,D=C-M;for(v=M;v<C;v++)x+=n[v].x,w+=n[v].y;x/=D,w/=D;const E=Math.floor(d*o)+1+t,T=Math.min(Math.floor((d+1)*o)+1,e)+t,{x:b,y:_}=n[u];for(g=p=-1,v=E;v<T;v++)p=.5*Math.abs((b-x)*(n[v].y-_)-(b-n[v].x)*(w-_)),p>g&&(g=p,h=n[v],y=v);a[l++]=h,u=y}return a[l++]=n[c],a}function Om(n,t,e,i){let s=0,r=0,a,o,l,c,u,d,h,g,p,y;const x=[],w=t+e-1,v=n[t].x,C=n[w].x-v;for(a=t;a<t+e;++a){o=n[a],l=(o.x-v)/C*i,c=o.y;const D=l|0;if(D===u)c<p?(p=c,d=a):c>y&&(y=c,h=a),s=(r*s+o.x)/++r;else{const E=a-1;if(!J(d)&&!J(h)){const T=Math.min(d,h),b=Math.max(d,h);T!==g&&T!==E&&x.push({...n[T],x:s}),b!==g&&b!==E&&x.push({...n[b],x:s})}a>0&&E!==g&&x.push(n[E]),x.push(o),u=D,r=0,p=y=c,d=h=g=a}}return x}function mc(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function yc(n){n.data.datasets.forEach(t=>{mc(t)})}function Em(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:a,max:o,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Ht(Ie(t,r.axis,a).lo,0,e-1)),c?s=Ht(Ie(t,r.axis,o).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Am={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){yc(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:a,indexAxis:o}=s,l=n.getDatasetMeta(r),c=a||s.data;if(_i([o,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=n.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:d,count:h}=Em(l,c);const g=e.threshold||4*i;if(h<=g){mc(s);return}J(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(y){this._data=y}}));let p;switch(e.algorithm){case"lttb":p=Pm(c,d,h,i,e);break;case"min-max":p=Om(c,d,h,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(n){yc(n)}};function Rm(n,t,e){const i=n.segments,s=n.points,r=t.points,a=[];for(const o of i){let{start:l,end:c}=o;c=ea(l,c,s);const u=ta(e,s[l],s[c],o.loop);if(!t.segments){a.push({source:o,target:u,start:s[l],end:s[c]});continue}const d=bl(t,u);for(const h of d){const g=ta(e,r[h.start],r[h.end],h.loop),p=yl(o,s,g);for(const y of p)a.push({source:y,target:h,start:{[e]:bc(u,g,"start",Math.max)},end:{[e]:bc(u,g,"end",Math.min)}})}}return a}function ta(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=ue(s),r=ue(r)),{property:n,start:s,end:r}}function Lm(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:a,end:o})=>{o=ea(a,o,s);const l=s[a],c=s[o];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function ea(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function bc(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function xc(n,t){let e=[],i=!1;return ot(n)?(i=!0,e=n):e=Lm(n,t),e.length?new sn({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function _c(n){return n&&n.fill!==!1}function Im(n,t,e){let s=n[t].fill;const r=[t];let a;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!kt(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;r.push(s),s=a.fill}return!1}function Nm(n,t,e){const i=Hm(n);if(it(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return kt(s)&&Math.floor(s)===s?Fm(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Fm(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function zm(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:it(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Bm(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:it(n)?i=n.value:i=t.getBaseValue(),i}function Hm(n){const t=n.options,e=t.fill;let i=K(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Wm(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,a=i.points,o=Ym(t,e);o.push(xc({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){const c=r[l];for(let u=c.start;u<=c.end;u++)Vm(s,a[u],o)}return new sn({points:s,options:{}})}function Ym(n,t){const e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const r=i[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function Vm(n,t,e){const i=[];for(let s=0;s<e.length;s++){const r=e[s],{first:a,last:o,point:l}=jm(r,t,"x");if(!(!l||a&&o)){if(a)i.unshift(l);else if(n.push(l),!o)break}}n.push(...i)}function jm(n,t,e){const i=n.interpolate(t,e);if(!i)return{};const s=i[e],r=n.segments,a=n.points;let o=!1,l=!1;for(let c=0;c<r.length;c++){const u=r[c],d=a[u.start][e],h=a[u.end][e];if(Le(s,d,h)){o=s===d,l=s===h;break}}return{first:o,last:l,point:i}}class wc{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:r,radius:a}=this;return e=e||{start:0,end:yt},t.arc(s,r,a,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}}function $m(n){const{chart:t,fill:e,line:i}=n;if(kt(e))return qm(t,e);if(e==="stack")return Wm(n);if(e==="shape")return!0;const s=Um(n);return s instanceof wc?s:xc(s,i)}function qm(n,t){const e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function Um(n){return(n.scale||{}).getPointPositionForValue?Gm(n):Xm(n)}function Xm(n){const{scale:t={},fill:e}=n,i=zm(e,t);if(kt(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function Gm(n){const{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,r=i.reverse?t.max:t.min,a=Bm(e,t,r),o=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,r);return new wc({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)o.push(t.getPointPositionForValue(l,a));return o}function na(n,t,e){const i=$m(t),{line:s,scale:r,axis:a}=t,o=s.options,l=o.fill,c=o.backgroundColor,{above:u=c,below:d=c}=l||{};i&&s.points.length&&(bi(n,e),Km(n,{line:s,target:i,above:u,below:d,area:e,scale:r,axis:a}),xi(n))}function Km(n,t){const{line:e,target:i,above:s,below:r,area:a,scale:o}=t,l=e._loop?"angle":t.axis;n.save(),l==="x"&&r!==s&&(vc(n,i,a.top),kc(n,{line:e,target:i,color:s,scale:o,property:l}),n.restore(),n.save(),vc(n,i,a.bottom)),kc(n,{line:e,target:i,color:r,scale:o,property:l}),n.restore()}function vc(n,t,e){const{segments:i,points:s}=t;let r=!0,a=!1;n.beginPath();for(const o of i){const{start:l,end:c}=o,u=s[l],d=s[ea(l,c,s)];r?(n.moveTo(u.x,u.y),r=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),a=!!t.pathSegment(n,o,{move:a}),a?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function kc(n,t){const{line:e,target:i,property:s,color:r,scale:a}=t,o=Rm(e,i,s);for(const{source:l,target:c,start:u,end:d}of o){const{style:{backgroundColor:h=r}={}}=l,g=i!==!0;n.save(),n.fillStyle=h,Zm(n,a,g&&ta(s,u,d)),n.beginPath();const p=!!e.pathSegment(n,l);let y;if(g){p?n.closePath():Mc(n,i,d,s);const x=!!i.pathSegment(n,c,{move:p,reverse:!0});y=p&&x,y||Mc(n,i,u,s)}n.closePath(),n.fill(y?"evenodd":"nonzero"),n.restore()}}function Zm(n,t,e){const{top:i,bottom:s}=t.chart.chartArea,{property:r,start:a,end:o}=e||{};r==="x"&&(n.beginPath(),n.rect(a,i,o-a,s-i),n.clip())}function Mc(n,t,e,i){const s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var Qm={id:"filler",afterDatasetsUpdate(n,t,e){const i=(n.data.datasets||[]).length,s=[];let r,a,o,l;for(a=0;a<i;++a)r=n.getDatasetMeta(a),o=r.dataset,l=null,o&&o.options&&o instanceof sn&&(l={visible:n.isDatasetVisible(a),index:a,fill:Nm(o,a,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:o}),r.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=Im(s,a,e.propagate))},beforeDraw(n,t,e){const i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let a=s.length-1;a>=0;--a){const o=s[a].$filler;o&&(o.line.updateControlPoints(r,o.axis),i&&o.fill&&na(n.ctx,o,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;_c(r)&&na(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!_c(i)||e.drawTime!=="beforeDatasetDraw"||na(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Sc=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Jm=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Dc extends Yt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ut(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=xt(i.font),r=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Sc(i,r);let c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,r,o,l)+10):(u=this.maxHeight,c=this._fitCols(a,s,o,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+o;let d=t;r.textAlign="left",r.textBaseline="middle";let h=-1,g=-u;return this.legendItems.forEach((p,y)=>{const x=i+e/2+r.measureText(p.text).width;(y===0||c[c.length-1]+x+2*o>a)&&(d+=u,c[c.length-(y>0?0:1)]=0,g+=u,h++),l[y]={left:0,top:g,row:h,width:x,height:s},c[c.length-1]+=x+o}),d}_fitCols(t,e,i,s){const{ctx:r,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t;let d=o,h=0,g=0,p=0,y=0;return this.legendItems.forEach((x,w)=>{const{itemWidth:v,itemHeight:M}=ty(i,e,r,x,s);w>0&&g+M+2*o>u&&(d+=h+o,c.push({width:h,height:g}),p+=h+o,y++,h=g=0),l[w]={left:p,top:g,col:y,width:v,height:M},h=Math.max(h,v),g+=M+o}),d+=h,c.push({width:h,height:g}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,a=Vn(r,this.left,this.width);if(this.isHorizontal()){let o=0,l=jt(i,this.left+s,this.right-this.lineWidths[o]);for(const c of e)o!==c.row&&(o=c.row,l=jt(i,this.left+s,this.right-this.lineWidths[o])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let o=0,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(const c of e)c.col!==o&&(o=c.col,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[o].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;bi(t,this),this._draw(),xi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:a}=t,o=Dt.color,l=Vn(t.rtl,this.left,this.width),c=xt(a.font),{padding:u}=a,d=c.size,h=d/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:y,itemHeight:x}=Sc(a,d),w=function(E,T,b){if(isNaN(p)||p<=0||isNaN(y)||y<0)return;s.save();const _=K(b.lineWidth,1);if(s.fillStyle=K(b.fillStyle,o),s.lineCap=K(b.lineCap,"butt"),s.lineDashOffset=K(b.lineDashOffset,0),s.lineJoin=K(b.lineJoin,"miter"),s.lineWidth=_,s.strokeStyle=K(b.strokeStyle,o),s.setLineDash(K(b.lineDash,[])),a.usePointStyle){const S={radius:y*Math.SQRT2/2,pointStyle:b.pointStyle,rotation:b.rotation,borderWidth:_},O=l.xPlus(E,p/2),A=T+h;el(s,S,O,A,a.pointStyleWidth&&p)}else{const S=T+Math.max((d-y)/2,0),O=l.leftForLtr(E,p),A=Je(b.borderRadius);s.beginPath(),Object.values(A).some(F=>F!==0)?Hn(s,{x:O,y:S,w:p,h:y,radius:A}):s.rect(O,S,p,y),s.fill(),_!==0&&s.stroke()}s.restore()},v=function(E,T,b){_n(s,b.text,E,T+x/2,c,{strikethrough:b.hidden,textAlign:l.textAlign(b.textAlign)})},M=this.isHorizontal(),C=this._computeTitleHeight();M?g={x:jt(r,this.left+u,this.right-i[0]),y:this.top+u+C,line:0}:g={x:this.left+u,y:jt(r,this.top+C+u,this.bottom-e[0].height),line:0},fl(this.ctx,t.textDirection);const D=x+u;this.legendItems.forEach((E,T)=>{s.strokeStyle=E.fontColor,s.fillStyle=E.fontColor;const b=s.measureText(E.text).width,_=l.textAlign(E.textAlign||(E.textAlign=a.textAlign)),S=p+h+b;let O=g.x,A=g.y;l.setWidth(this.width),M?T>0&&O+S+u>this.right&&(A=g.y+=D,g.line++,O=g.x=jt(r,this.left+u,this.right-i[g.line])):T>0&&A+D>this.bottom&&(O=g.x=O+e[g.line].width+u,g.line++,A=g.y=jt(r,this.top+C+u,this.bottom-e[g.line].height));const F=l.x(O);if(w(F,A,E),O=kf(_,O+p+h,M?O+S:this.right,t.rtl),v(l.x(O),A,E),M)g.x+=S+u;else if(typeof E.text!="string"){const j=c.lineHeight;g.y+=Tc(E,j)+u}else g.y+=D}),gl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=xt(e.font),s=Ft(e.padding);if(!e.display)return;const r=Vn(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=i.size/2,c=s.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=jt(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((y,x)=>Math.max(y,x.height),0);u=c+jt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=jt(o,d,d+h);a.textAlign=r.textAlign(Dr(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,_n(a,e.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,e=xt(t.font),i=Ft(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Le(t,this.left,this.right)&&Le(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],Le(t,s.left,s.left+s.width)&&Le(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!iy(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,r=Jm(s,i);s&&!r&&ut(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!r&&ut(e.onHover,[t,i,this],this)}else i&&ut(e.onClick,[t,i,this],this)}}function ty(n,t,e,i,s){const r=ey(i,n,t,e),a=ny(s,i,t.lineHeight);return{itemWidth:r,itemHeight:a}}function ey(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((r,a)=>r.length>a.length?r:a)),t+e.size/2+i.measureText(s).width}function ny(n,t,e){let i=n;return typeof t.text!="string"&&(i=Tc(t,e)),i}function Tc(n,t){const e=n.text?n.text.length:0;return t*e}function iy(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var sy={id:"legend",_element:Dc,start(n,t,e){const i=n.legend=new Dc({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i)},stop(n){$t.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;$t.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:a,borderRadius:o}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),u=Ft(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(o||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class ia extends Yt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=ot(i.text)?i.text.length:1;this._padding=Ft(i.padding);const r=s*xt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:a}=this,o=a.align;let l=0,c,u,d;return this.isHorizontal()?(u=jt(o,i,r),d=e+t,c=r-i):(a.position==="left"?(u=i+t,d=jt(o,s,e),l=rt*-.5):(u=r-t,d=jt(o,e,s),l=rt*.5),c=s-e),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=xt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(r);_n(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Dr(e.align),textBaseline:"middle",translation:[a,o]})}}function ry(n,t){const e=new ia({ctx:n.ctx,options:t,chart:n});$t.configure(n,e,t),$t.addBox(n,e),n.titleBlock=e}var ay={id:"title",_element:ia,start(n,t,e){ry(n,e)},stop(n){const t=n.titleBlock;$t.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Es=new WeakMap;var oy={id:"subtitle",start(n,t,e){const i=new ia({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i),Es.set(n,i)},stop(n){$t.removeBox(n,Es.get(n)),Es.delete(n)},beforeUpdate(n,t,e){const i=Es.get(n);$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ri={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;t<e;++t){const o=n[t].element;if(o&&o.hasValue()){const l=o.tooltipPosition();i.add(l.x),s+=l.y,++r}}return r===0||i.size===0?!1:{x:[...i].reduce((o,l)=>o+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,a,o;for(r=0,a=n.length;r<a;++r){const l=n[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Bn(t,c);u<s&&(s=u,o=l)}}if(o){const l=o.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function Te(n,t){return t&&(ot(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function ze(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
17
17
  `)>-1?n.split(`
18
- `):n}function ly(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:a,value:o}=r.getLabelAndValue(s);return{chart:n,label:a,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:o,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Cc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=xt(t.bodyFont),c=xt(t.titleFont),u=xt(t.footerFont),d=r.length,h=s.length,g=i.length,p=Ft(t.padding);let y=p.height,x=0,w=i.reduce((C,D)=>C+D.before.length+D.lines.length+D.after.length,0);if(w+=n.beforeBody.length+n.afterBody.length,d&&(y+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),w){const C=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;y+=g*C+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}h&&(y+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const M=function(C){x=Math.max(x,e.measureText(C).width+v)};return e.save(),e.font=c.string,dt(n.title,M),e.font=l.string,dt(n.beforeBody.concat(n.afterBody),M),v=t.displayColors?a+2+t.boxPadding:0,dt(i,C=>{dt(C.before,M),dt(C.lines,M),dt(C.after,M)}),v=0,e.font=u.string,dt(n.footer,M),e.restore(),x+=p.width,{width:x,height:y}}function cy(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function uy(n,t,e,i){const{x:s,width:r}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+r+a>t.width||n==="right"&&s-r-a<0)return!0}function dy(n,t,e,i){const{x:s,width:r}=e,{width:a,chartArea:{left:o,right:l}}=n;let c="center";return i==="center"?c=s<=(o+l)/2?"left":"right":s<=r/2?c="left":s>=a-r/2&&(c="right"),uy(c,n,t,e)&&(c="center"),c}function Pc(n,t,e){const i=e.yAlign||t.yAlign||cy(n,e);return{xAlign:e.xAlign||t.xAlign||dy(n,t,e,i),yAlign:i}}function hy(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function fy(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Oc(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:a}=n,{xAlign:o,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:g}=Je(a);let p=hy(t,o);const y=fy(t,l,c);return l==="center"?o==="left"?p+=c:o==="right"&&(p-=c):o==="left"?p-=Math.max(u,h)+s:o==="right"&&(p+=Math.max(d,g)+s),{x:Ht(p,0,i.width-t.width),y:Ht(y,0,i.height-t.height)}}function As(n,t,e){const i=Ft(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ec(n){return Te([],ze(n))}function gy(n,t,e){return tn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ac(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Rc={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Re,beforeBody:Re,beforeLabel:Re,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return J(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Re,afterBody:Re,beforeFooter:Re,footer:Re,afterFooter:Re};function te(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Rc[t].call(e,i):s}class sa extends Yt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new zr(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=gy(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=te(i,"beforeTitle",this,t),r=te(i,"title",this,t),a=te(i,"afterTitle",this,t);let o=[];return o=Te(o,ze(s)),o=Te(o,ze(r)),o=Te(o,ze(a)),o}getBeforeBody(t,e){return Ec(te(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return dt(t,r=>{const a={before:[],lines:[],after:[]},o=Ac(i,r);Te(a.before,ze(te(o,"beforeLabel",this,r))),Te(a.lines,te(o,"label",this,r)),Te(a.after,ze(te(o,"afterLabel",this,r))),s.push(a)}),s}getAfterBody(t,e){return Ec(te(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=te(i,"beforeFooter",this,t),r=te(i,"footer",this,t),a=te(i,"afterFooter",this,t);let o=[];return o=Te(o,ze(s)),o=Te(o,ze(r)),o=Te(o,ze(a)),o}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],a=[];let o=[],l,c;for(l=0,c=e.length;l<c;++l)o.push(ly(this.chart,e[l]));return t.filter&&(o=o.filter((u,d,h)=>t.filter(u,d,h,i))),t.itemSort&&(o=o.sort((u,d)=>t.itemSort(u,d,i))),dt(o,u=>{const d=Ac(t.callbacks,u);s.push(te(d,"labelColor",this,u)),r.push(te(d,"labelPointStyle",this,u)),a.push(te(d,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=o,o}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,a=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const o=Ri[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const l=this._size=Cc(this,i),c=Object.assign({},o,l),u=Pc(this.chart,i,c),d=Oc(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Je(o),{x:h,y:g}=t,{width:p,height:y}=e;let x,w,v,M,C,D;return r==="center"?(C=g+y/2,s==="left"?(x=h,w=x-a,M=C+a,D=C-a):(x=h+p,w=x+a,M=C-a,D=C+a),v=x):(s==="left"?w=h+Math.max(l,u)+a:s==="right"?w=h+p-Math.max(c,d)-a:w=this.caretX,r==="top"?(M=g,C=M-a,x=w-a,v=w+a):(M=g+y,C=M+a,x=w+a,v=w-a),D=M),{x1:x,x2:w,x3:v,y1:M,y2:C,y3:D}}drawTitle(t,e,i){const s=this.title,r=s.length;let a,o,l;if(r){const c=Vn(i.rtl,this.x,this.width);for(t.x=As(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=xt(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,l+1===r&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,r){const a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=r,u=xt(r.bodyFont),d=As(this,"left",r),h=s.x(d),g=l<u.lineHeight?(u.lineHeight-l)/2:0,p=e.y+g;if(r.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},x=s.leftForLtr(h,c)+c/2,w=p+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Er(t,y,x,w),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Er(t,y,x,w)}else{t.lineWidth=it(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const y=s.leftForLtr(h,c),x=s.leftForLtr(s.xPlus(h,1),c-2),w=Je(a.borderRadius);Object.values(w).some(v=>v!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Hn(t,{x:y,y:p,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Hn(t,{x,y:p+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:c,boxPadding:u}=i,d=xt(i.bodyFont);let h=d.lineHeight,g=0;const p=Vn(i.rtl,this.x,this.width),y=function(b){e.fillText(b,p.x(t.x+g),t.y+h/2),t.y+=h+r},x=p.textAlign(a);let w,v,M,C,D,E,T;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=As(this,x,i),e.fillStyle=i.bodyColor,dt(this.beforeBody,y),g=o&&x!=="right"?a==="center"?c/2+u:c+2+u:0,C=0,E=s.length;C<E;++C){for(w=s[C],v=this.labelTextColors[C],e.fillStyle=v,dt(w.before,y),M=w.lines,o&&M.length&&(this._drawColorBox(e,t,C,p,i),h=Math.max(d.lineHeight,l)),D=0,T=M.length;D<T;++D)y(M[D]),h=d.lineHeight;dt(w.after,y)}g=0,h=d.lineHeight,dt(this.afterBody,y),t.y-=r}drawFooter(t,e,i){const s=this.footer,r=s.length;let a,o;if(r){const l=Vn(i.rtl,this.x,this.width);for(t.x=As(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=xt(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<r;++o)e.fillText(s[o],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:r,yAlign:a}=this,{x:o,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:h,bottomLeft:g,bottomRight:p}=Je(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+d,l),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(o+c-h,l),e.quadraticCurveTo(o+c,l,o+c,l+h),a==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(o+c,l+u-p),e.quadraticCurveTo(o+c,l+u,o+c-p,l+u),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(o+g,l+u),e.quadraticCurveTo(o,l+u,o,l+u-g),a==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(o,l+d),e.quadraticCurveTo(o,l,o+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const a=Ri[t.position].call(this,this._active,this._eventPosition);if(!a)return;const o=this._size=Cc(this,t),l=Object.assign({},a,this._size),c=Pc(e,t,l),u=Oc(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Ft(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),fl(t,e.textDirection),r.y+=a.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),gl(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:o,index:l})=>{const c=this.chart.getDatasetMeta(o);if(!c)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:c.data[l],index:l}}),r=!rs(i,s),a=this._positionChanged(s,e);(r||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],a=this._getActiveElements(t,r,e,i),o=this._positionChanged(a,t),l=e||!rs(a,r)||o;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(o=>this.chart.data.datasets[o.datasetIndex]&&this.chart.getDatasetMeta(o.datasetIndex).controller.getParsed(o.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,a=Ri[r.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}}P(sa,"positioners",Ri);var Rs={id:"tooltip",_element:sa,positioners:Ri,afterInit(n,t,e){e&&(n.tooltip=new sa({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Rc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},py=Object.freeze({__proto__:null,Colors:Cm,Decimation:Am,Filler:Qm,Legend:sy,SubTitle:oy,Title:ay,Tooltip:Rs});const my=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function yy(n,t,e,i){const s=n.indexOf(t);if(s===-1)return my(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const by=(n,t)=>n===null?null:Ht(Math.round(n),0,t);function Lc(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class ra extends Mn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(J(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:yy(i,t,K(e,t),this._addedLabels),by(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Lc.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}P(ra,"id","category"),P(ra,"defaults",{ticks:{callback:Lc}});function xy(n,t){const e=[],{bounds:s,step:r,min:a,max:o,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=n,g=r||1,p=u-1,{min:y,max:x}=t,w=!J(a),v=!J(o),M=!J(c),C=(x-y)/(d+1);let D=zo((x-y)/p/g)*g,E,T,b,_;if(D<1e-14&&!w&&!v)return[{value:y},{value:x}];_=Math.ceil(x/D)-Math.floor(y/D),_>p&&(D=zo(_*D/p/g)*g),J(l)||(E=Math.pow(10,l),D=Math.ceil(D*E)/E),s==="ticks"?(T=Math.floor(y/D)*D,b=Math.ceil(x/D)*D):(T=y,b=x),w&&v&&r&&mf((o-a)/r,D/1e3)?(_=Math.round(Math.min((o-a)/D,u)),D=(o-a)/_,T=a,b=o):M?(T=w?a:T,b=v?o:b,_=c-1,D=(b-T)/_):(_=(b-T)/D,fi(_,Math.round(_),D/1e3)?_=Math.round(_):_=Math.ceil(_));const S=Math.max(Ho(D),Ho(T));E=Math.pow(10,J(l)?S:l),T=Math.round(T*E)/E,b=Math.round(b*E)/E;let O=0;for(w&&(h&&T!==a?(e.push({value:a}),T<a&&O++,fi(Math.round((T+O*D)*E)/E,a,Ic(a,C,n))&&O++):T<a&&O++);O<_;++O){const A=Math.round((T+O*D)*E)/E;if(v&&A>o)break;e.push({value:A})}return v&&h&&b!==o?e.length&&fi(e[e.length-1].value,o,Ic(o,C,n))?e[e.length-1].value=o:e.push({value:o}):(!v||b===o)&&e.push({value:b}),e}function Ic(n,t,{horizontal:e,minRotation:i}){const s=Nt(i),r=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/r,a)}class Ls extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return J(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const a=l=>s=e?s:l,o=l=>r=i?r:l;if(t){const l=Se(s),c=Se(r);l<0&&c<0?o(0):l>0&&c>0&&a(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);o(r+l),t||a(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,a=xy(s,r);return t.bounds==="ticks"&&Bo(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return mi(t,this.chart.options.locale,this.options.ticks.format)}}class aa extends Ls{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?t:0,this.max=kt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Nt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}P(aa,"id","linear"),P(aa,"defaults",{ticks:{callback:ds.formatters.numeric}});const Li=n=>Math.floor(Ze(n)),Sn=(n,t)=>Math.pow(10,Li(n)+t);function Nc(n){return n/Math.pow(10,Li(n))===1}function Fc(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function _y(n,t){const e=t-n;let i=Li(e);for(;Fc(n,t,i)>10;)i++;for(;Fc(n,t,i)<10;)i--;return Math.min(i,Li(n))}function wy(n,{min:t,max:e}){t=ce(n.min,t);const i=[],s=Li(t);let r=_y(t,e),a=r<0?Math.pow(10,Math.abs(r)):1;const o=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,u=Math.floor((t-l)/o/10)*o*10;let d=Math.floor((c-u)/Math.pow(10,r)),h=ce(n.min,Math.round((l+u+d*Math.pow(10,r))*a)/a);for(;h<e;)i.push({value:h,major:Nc(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(r++,d=2,a=r>=0?1:a),h=Math.round((l+u+d*Math.pow(10,r))*a)/a;const g=ce(n.max,h);return i.push({value:g,major:Nc(g),significand:d}),i}class oa extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Ls.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return kt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?Math.max(0,t):null,this.max=kt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!kt(this._userMin)&&(this.min=t===Sn(this.min,0)?Sn(this.min,-1):Sn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=o=>i=t?i:o,a=o=>s=e?s:o;i===s&&(i<=0?(r(1),a(10)):(r(Sn(i,-1)),a(Sn(s,1)))),i<=0&&r(Sn(s,-1)),s<=0&&a(Sn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=wy(e,this);return t.bounds==="ticks"&&Bo(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":mi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ze(t),this._valueRange=Ze(this.max)-Ze(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ze(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}P(oa,"id","logarithmic"),P(oa,"defaults",{ticks:{callback:ds.formatters.logarithmic,major:{enabled:!0}}});function la(n){const t=n.ticks;if(t.display&&n.display){const e=Ft(t.backdropPadding);return K(t.font&&t.font.size,Dt.font.size)+e.height}return 0}function vy(n,t,e){return e=ot(e)?e:[e],{w:Rf(n,t.string,e),h:e.length*t.lineHeight}}function zc(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function ky(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,a=n.options.pointLabels,o=a.centerPointLabels?rt/r:0;for(let l=0;l<r;l++){const c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;const u=n.getPointPosition(l,n.drawingArea+s[l],o),d=xt(c.font),h=vy(n.ctx,d,n._pointLabels[l]);i[l]=h;const g=ue(n.getIndexAngle(l)+o),p=Math.round(cs(g)),y=zc(p,u.x,h.w,0,180),x=zc(p,u.y,h.h,90,270);My(e,t,g,y,x)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=Ty(n,i,s)}function My(n,t,e,i,s){const r=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let o=0,l=0;i.start<t.l?(o=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-o)):i.end>t.r&&(o=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+o)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Sy(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:a,size:o}=e,l=n.getPointPosition(t,i+s+a,r),c=Math.round(cs(ue(l.angle+bt))),u=Oy(l.y,o.h,c),d=Cy(c),h=Py(l.x,o.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+o.w,bottom:u+o.h}}function Dy(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Ne({x:e,y:i},t)||Ne({x:e,y:r},t)||Ne({x:s,y:i},t)||Ne({x:s,y:r},t))}function Ty(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:a,display:o}=r.pointLabels,l={extra:la(r)/2,additionalAngle:a?rt/s:0};let c;for(let u=0;u<s;u++){l.padding=e[u],l.size=t[u];const d=Sy(n,u,l);i.push(d),o==="auto"&&(d.visible=Dy(d,c),d.visible&&(c=d))}return i}function Cy(n){return n===0||n===180?"center":n<180?"left":"right"}function Py(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function Oy(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Ey(n,t,e){const{left:i,top:s,right:r,bottom:a}=e,{backdropColor:o}=t;if(!J(o)){const l=Je(t.borderRadius),c=Ft(t.backdropPadding);n.fillStyle=o;const u=i-c.left,d=s-c.top,h=r-i+c.width,g=a-s+c.height;Object.values(l).some(p=>p!==0)?(n.beginPath(),Hn(n,{x:u,y:d,w:h,h:g,radius:l}),n.fill()):n.fillRect(u,d,h,g)}}function Ay(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const a=i.setContext(n.getPointLabelContext(s));Ey(e,a,r);const o=xt(a.font),{x:l,y:c,textAlign:u}=r;_n(e,n._pointLabels[s],l,c+o.lineHeight/2,o,{color:a.color,textAlign:u,textBaseline:"middle"})}}function Bc(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,yt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let a=1;a<i;a++)r=n.getPointPosition(a,t),s.lineTo(r.x,r.y)}}function Ry(n,t,e,i,s){const r=n.ctx,a=t.circular,{color:o,lineWidth:l}=t;!a&&!i||!o||!l||e<0||(r.save(),r.strokeStyle=o,r.lineWidth=l,r.setLineDash(s.dash),r.lineDashOffset=s.dashOffset,r.beginPath(),Bc(n,e,a,i),r.closePath(),r.stroke(),r.restore())}function Ly(n,t,e){return tn(n,{label:e,index:t,type:"pointLabel"})}class Ii extends Ls{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ft(la(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=kt(t)&&!isNaN(t)?t:0,this.max=kt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/la(this.options))}generateTickLabels(t){Ls.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ut(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?ky(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=yt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ue(t*e+Nt(i))}getDistanceFromCenterForValue(t){if(J(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(J(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Ly(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-bt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Bc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:r}=e,a=this._pointLabels.length;let o,l,c;if(e.pointLabels.display&&Ay(this,a),s.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),g=s.setContext(h),p=r.setContext(h);Ry(this,g,l,a,p)}}),i.display){for(t.save(),o=a-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(o,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=xt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,a=t.measureText(o.label).width,t.fillStyle=c.backdropColor;const d=Ft(c.backdropPadding);t.fillRect(-a/2-d.left,-r-u.size/2-d.top,a+d.width,u.size+d.height)}_n(t,o.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}P(Ii,"id","radialLinear"),P(Ii,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ds.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),P(Ii,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),P(Ii,"descriptors",{angleLines:{_fallback:"grid"}});const Is={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ee=Object.keys(Is);function Hc(n,t){return n-t}function Wc(n,t){if(J(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),kt(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Qe(r)||r===!0)?e.startOf(a,"isoWeek",r):e.startOf(a,s)),+a)}function Yc(n,t,e,i){const s=ee.length;for(let r=ee.indexOf(n);r<s-1;++r){const a=Is[ee[r]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(o*a.size))<=i)return ee[r]}return ee[s-1]}function Iy(n,t,e,i,s){for(let r=ee.length-1;r>=ee.indexOf(e);r--){const a=ee[r];if(Is[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return ee[e?ee.indexOf(e):0]}function Ny(n){for(let t=ee.indexOf(n)+1,e=ee.length;t<e;++t)if(Is[ee[t]].common)return ee[t]}function Vc(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=Sr(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function Fy(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),a=t[t.length-1].value;let o,l;for(o=r;o<=a;o=+s.add(o,1,i))l=e[o],l>=0&&(t[l].major=!0);return t}function jc(n,t,e){const i=[],s={},r=t.length;let a,o;for(a=0;a<r;++a)o=t[a],s[o]=a,i.push({value:o,major:!1});return r===0||!e?i:Fy(n,i,s,e)}class Ni extends Mn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Rl._date(t.adapters.date);s.init(e),hi(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Wc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:r,minDefined:a,maxDefined:o}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!o&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!a||!o)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=kt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=kt(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const r=this.min,a=this.max,o=_f(s,r,a);return this._unit=e.unit||(i.autoSkip?Yc(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Iy(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ny(this._unit),this.initOffsets(s),t.reverse&&o.reverse(),jc(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=Ht(e,0,a),i=Ht(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,a=r.unit||Yc(r.minUnit,e,i,this._getLabelCapacity(e)),o=K(s.ticks.stepSize,1),l=a==="week"?r.isoWeekday:!1,c=Qe(l)||l===!0,u={};let d=e,h,g;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+a);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(h=d,g=0;h<i;h=+t.add(h,o,a),g++)Vc(u,h,p);return(h===i||s.bounds==="ticks"||g===1)&&Vc(u,h,p),Object.keys(u).sort(Hc).map(y=>+y)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,a=e||s[r];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){const r=this.options,a=r.ticks.callback;if(a)return ut(a,[t,e,i],this);const o=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&o[l],d=c&&o[c],h=i[e],g=c&&d&&h&&h.major;return this._adapter.format(t,s||(g?d:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Nt(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),a=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*r+o*a,h:i*a+o*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,jc(this,[t],this._majorUnit),s),a=this._getLabelSize(r),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Wc(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return jo(t.sort(Hc))}}P(Ni,"id","time"),P(Ni,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ns(n,t,e){let i=0,s=n.length-1,r,a,o,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ie(n,"pos",t)),{pos:r,time:o}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ie(n,"time",t)),{time:r,pos:o}=n[i],{time:a,pos:l}=n[s]);const c=a-r;return c?o+(l-o)*(t-r)/c:o}class ca extends Ni{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ns(e,this.min),this._tableRange=Ns(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let a,o,l,c,u;for(a=0,o=t.length;a<o;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=s.length;a<o;++a)u=s[a+1],l=s[a-1],c=s[a],Math.round((u+l)/2)!==c&&r.push({time:c,pos:a/(o-1)});return r}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,r)=>s-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ns(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ns(this._table,i*this._tableRange+this._minPos,!0)}}P(ca,"id","timeseries"),P(ca,"defaults",Ni.defaults);var zy=Object.freeze({__proto__:null,CategoryScale:ra,LinearScale:aa,LogarithmicScale:oa,RadialLinearScale:Ii,TimeScale:Ni,TimeSeriesScale:ca});const By=[Xg,vm,py,zy],Hy=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Wy=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Yy=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Vy=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],$c=(n,t,e)=>{let i=n;return typeof t=="string"||Array.isArray(t)?i=n.toLocaleString(t,e):(t===!0||e!==void 0)&&(i=n.toLocaleString(void 0,e)),i};function ua(n,t){if(!Number.isFinite(n))throw new TypeError(`Expected a finite number, got ${typeof n}: ${n}`);t={bits:!1,binary:!1,space:!0,...t};const e=t.bits?t.binary?Vy:Yy:t.binary?Wy:Hy,i=t.space?" ":"";if(t.signed&&n===0)return` 0${i}${e[0]}`;const s=n<0,r=s?"-":t.signed?"+":"";s&&(n=-n);let a;if(t.minimumFractionDigits!==void 0&&(a={minimumFractionDigits:t.minimumFractionDigits}),t.maximumFractionDigits!==void 0&&(a={maximumFractionDigits:t.maximumFractionDigits,...a}),n<1){const u=$c(n,t.locale,a);return r+u+i+e[0]}const o=Math.min(Math.floor(t.binary?Math.log(n)/Math.log(1024):Math.log10(n)/3),e.length-1);n/=(t.binary?1024:1e3)**o,a||(n=n.toPrecision(3));const l=$c(Number(n),t.locale,a),c=e[o];return r+l+i+c}const Uc=6048e5,jy=864e5,Fi=6e4,$n=36e5,$y=1e3,qc=Symbol.for("constructDateFrom");function Ot(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&qc in n?n[qc](t):n instanceof Date?new n.constructor(t):new Date(t)}function tt(n,t){return Ot(t||n,n)}function Fs(n,t,e){const i=tt(n,e==null?void 0:e.in);return isNaN(t)?Ot((e==null?void 0:e.in)||n,NaN):(t&&i.setDate(i.getDate()+t),i)}function da(n,t,e){const i=tt(n,e==null?void 0:e.in);if(isNaN(t))return Ot(n,NaN);if(!t)return i;const s=i.getDate(),r=Ot(n,i.getTime());r.setMonth(i.getMonth()+t+1,0);const a=r.getDate();return s>=a?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}function ha(n,t,e){return Ot(n,+tt(n)+t)}function Uy(n,t,e){return ha(n,t*$n)}let qy={};function Dn(){return qy}function Ce(n,t){var o,l,c,u;const e=Dn(),i=(t==null?void 0:t.weekStartsOn)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,s=tt(n,t==null?void 0:t.in),r=s.getDay(),a=(r<i?7:0)+r-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Un(n,t){return Ce(n,{...t,weekStartsOn:1})}function Xc(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getFullYear(),s=Ot(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const r=Un(s),a=Ot(e,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const o=Un(a);return e.getTime()>=r.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function zs(n){const t=tt(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function Tn(n,...t){const e=Ot.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function fa(n,t){const e=tt(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function Gc(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=fa(i),a=fa(s),o=+r-zs(r),l=+a-zs(a);return Math.round((o-l)/jy)}function Xy(n,t){const e=Xc(n,t),i=Ot(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),Un(i)}function Gy(n,t,e){const i=tt(n,e==null?void 0:e.in);return i.setTime(i.getTime()+t*Fi),i}function Ky(n,t,e){return da(n,t*3,e)}function Zy(n,t,e){return ha(n,t*1e3)}function Qy(n,t,e){return Fs(n,t*7,e)}function Jy(n,t,e){return da(n,t*12,e)}function zi(n,t){const e=+tt(n)-+tt(t);return e<0?-1:e>0?1:e}function tb(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function ga(n){return!(!tb(n)&&typeof n!="number"||isNaN(+tt(n)))}function eb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=i.getFullYear()-s.getFullYear(),a=i.getMonth()-s.getMonth();return r*12+a}function nb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t);return i.getFullYear()-s.getFullYear()}function Kc(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=Zc(i,s),a=Math.abs(Gc(i,s));i.setDate(i.getDate()-r*a);const o=+(Zc(i,s)===-r),l=r*(a-o);return l===0?0:l}function Zc(n,t){const e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Bi(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function ib(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=(+i-+s)/$n;return Bi(e==null?void 0:e.roundingMethod)(r)}function pa(n,t){return+tt(n)-+tt(t)}function sb(n,t,e){const i=pa(n,t)/Fi;return Bi(e==null?void 0:e.roundingMethod)(i)}function Qc(n,t){const e=tt(n,t==null?void 0:t.in);return e.setHours(23,59,59,999),e}function Jc(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}function rb(n,t){const e=tt(n,t==null?void 0:t.in);return+Qc(e,t)==+Jc(e,t)}function tu(n,t,e){const[i,s,r]=Tn(e==null?void 0:e.in,n,n,t),a=zi(s,r),o=Math.abs(eb(s,r));if(o<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*o);let l=zi(s,r)===-a;rb(i)&&o===1&&zi(i,r)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function ab(n,t,e){const i=tu(n,t,e)/3;return Bi(e==null?void 0:e.roundingMethod)(i)}function ob(n,t,e){const i=pa(n,t)/1e3;return Bi(e==null?void 0:e.roundingMethod)(i)}function lb(n,t,e){const i=Kc(n,t,e)/7;return Bi(e==null?void 0:e.roundingMethod)(i)}function cb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=zi(i,s),a=Math.abs(nb(i,s));i.setFullYear(1584),s.setFullYear(1584);const o=zi(i,s)===-r,l=r*(a-+o);return l===0?0:l}function ub(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth(),s=i-i%3;return e.setMonth(s,1),e.setHours(0,0,0,0),e}function db(n,t){const e=tt(n,t==null?void 0:t.in);return e.setDate(1),e.setHours(0,0,0,0),e}function hb(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getFullYear();return e.setFullYear(i+1,0,0),e.setHours(23,59,59,999),e}function eu(n,t){const e=tt(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}function fb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMinutes(59,59,999),e}function gb(n,t){var o,l;const e=Dn(),i=e.weekStartsOn??((l=(o=e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??0,s=tt(n,t==null?void 0:t.in),r=s.getDay(),a=(r<i?-7:0)+6-(r-i);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function pb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setSeconds(59,999),e}function mb(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth(),s=i-i%3+3;return e.setMonth(s,0),e.setHours(23,59,59,999),e}function yb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMilliseconds(999),e}const bb={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},xb=(n,t,e)=>{let i;const s=bb[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function ma(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const _b={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wb={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vb={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kb={date:ma({formats:_b,defaultWidth:"full"}),time:ma({formats:wb,defaultWidth:"full"}),dateTime:ma({formats:vb,defaultWidth:"full"})},Mb={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Sb=(n,t,e,i)=>Mb[n];function Hi(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):a;s=n.formattingValues[o]||n.formattingValues[a]}else{const a=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[o]||n.values[a]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const Db={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Tb={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Cb={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pb={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ob={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Eb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ab={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:Hi({values:Db,defaultWidth:"wide"}),quarter:Hi({values:Tb,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Hi({values:Cb,defaultWidth:"wide"}),day:Hi({values:Pb,defaultWidth:"wide"}),dayPeriod:Hi({values:Ob,defaultWidth:"wide",formattingValues:Eb,defaultFormattingWidth:"wide"})};function Wi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const a=r[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?Lb(o,d=>d.test(a)):Rb(o,d=>d.test(a));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function Rb(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Lb(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Ib(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let a=n.valueCallback?n.valueCallback(r[0]):r[0];a=e.valueCallback?e.valueCallback(a):a;const o=t.slice(s.length);return{value:a,rest:o}}}const Nb=/^(\d+)(th|st|nd|rd)?/i,Fb=/\d+/i,zb={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Bb={any:[/^b/i,/^(a|c)/i]},Hb={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Wb={any:[/1/i,/2/i,/3/i,/4/i]},Yb={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Vb={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},jb={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},$b={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ub={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qb={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Xb={ordinalNumber:Ib({matchPattern:Nb,parsePattern:Fb,valueCallback:n=>parseInt(n,10)}),era:Wi({matchPatterns:zb,defaultMatchWidth:"wide",parsePatterns:Bb,defaultParseWidth:"any"}),quarter:Wi({matchPatterns:Hb,defaultMatchWidth:"wide",parsePatterns:Wb,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Wi({matchPatterns:Yb,defaultMatchWidth:"wide",parsePatterns:Vb,defaultParseWidth:"any"}),day:Wi({matchPatterns:jb,defaultMatchWidth:"wide",parsePatterns:$b,defaultParseWidth:"any"}),dayPeriod:Wi({matchPatterns:Ub,defaultMatchWidth:"any",parsePatterns:qb,defaultParseWidth:"any"})},nu={code:"en-US",formatDistance:xb,formatLong:kb,formatRelative:Sb,localize:Ab,match:Xb,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gb(n,t){const e=tt(n,t==null?void 0:t.in);return Gc(e,eu(e))+1}function iu(n,t){const e=tt(n,t==null?void 0:t.in),i=+Un(e)-+Xy(e);return Math.round(i/Uc)+1}function ya(n,t){var u,d,h,g;const e=tt(n,t==null?void 0:t.in),i=e.getFullYear(),s=Dn(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(h=s.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,a=Ot((t==null?void 0:t.in)||n,0);a.setFullYear(i+1,0,r),a.setHours(0,0,0,0);const o=Ce(a,t),l=Ot((t==null?void 0:t.in)||n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=Ce(l,t);return+e>=+o?i+1:+e>=+c?i:i-1}function Kb(n,t){var o,l,c,u;const e=Dn(),i=(t==null?void 0:t.firstWeekContainsDate)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,s=ya(n,t),r=Ot((t==null?void 0:t.in)||n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),Ce(r,t)}function su(n,t){const e=tt(n,t==null?void 0:t.in),i=+Ce(e,t)-+Kb(e,t);return Math.round(i/Uc)+1}function ht(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const an={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ht(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ht(e+1,2)},d(n,t){return ht(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ht(n.getHours()%12||12,t.length)},H(n,t){return ht(n.getHours(),t.length)},m(n,t){return ht(n.getMinutes(),t.length)},s(n,t){return ht(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ht(s,t.length)}},qn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ru={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return an.y(n,t)},Y:function(n,t,e,i){const s=ya(n,i),r=s>0?s:1-s;if(t==="YY"){const a=r%100;return ht(a,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ht(r,t.length)},R:function(n,t){const e=Xc(n);return ht(e,t.length)},u:function(n,t){const e=n.getFullYear();return ht(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return an.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=su(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(n,t,e){const i=iu(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):an.d(n,t)},D:function(n,t,e){const i=Gb(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ht(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ht(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=qn.noon:i===0?s=qn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=qn.evening:i>=12?s=qn.afternoon:i>=4?s=qn.morning:s=qn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return an.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):an.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):an.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):an.s(n,t)},S:function(n,t){return an.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return ou(i);case"XXXX":case"XX":return Cn(i);case"XXXXX":case"XXX":default:return Cn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return ou(i);case"xxxx":case"xx":return Cn(i);case"xxxxx":case"xxx":default:return Cn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+au(i,":");case"OOOO":default:return"GMT"+Cn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+au(i,":");case"zzzz":default:return"GMT"+Cn(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return ht(i,t.length)},T:function(n,t,e){return ht(+n,t.length)}};function au(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ht(r,2)}function ou(n,t){return n%60===0?(n>0?"-":"+")+ht(Math.abs(n)/60,2):Cn(n,t)}function Cn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ht(Math.trunc(i/60),2),r=ht(i%60,2);return e+s+t+r}const lu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},cu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ba={p:cu,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return lu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",lu(i,t)).replace("{{time}}",cu(s,t))}},Zb=/^D+$/,Qb=/^Y+$/,Jb=["D","DD","YY","YYYY"];function uu(n){return Zb.test(n)}function du(n){return Qb.test(n)}function xa(n,t,e){const i=t0(n,t,e);if(console.warn(i),Jb.includes(n))throw new RangeError(i)}function t0(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const e0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,n0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,i0=/^'([^]*?)'?$/,s0=/''/g,r0=/[a-zA-Z]/;function hu(n,t,e){var u,d,h,g,p,y,x,w;const i=Dn(),s=(e==null?void 0:e.locale)??i.locale??nu,r=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((g=(h=i.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,a=(e==null?void 0:e.weekStartsOn)??((y=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((w=(x=i.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,o=tt(n,e==null?void 0:e.in);if(!ga(o))throw new RangeError("Invalid time value");let l=t.match(n0).map(v=>{const M=v[0];if(M==="p"||M==="P"){const C=ba[M];return C(v,s.formatLong)}return v}).join("").match(e0).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:a0(v)};if(ru[M])return{isToken:!0,value:v};if(M.match(r0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(l=s.localize.preprocessor(o,l));const c={firstWeekContainsDate:r,weekStartsOn:a,locale:s};return l.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&du(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&uu(M))&&xa(M,t,String(n));const C=ru[M[0]];return C(o,M,s.localize,c)}).join("")}function a0(n){const t=n.match(i0);return t?t[1].replace(s0,"'"):n}function o0(){return Object.assign({},Dn())}function l0(n,t){const e=tt(n,t==null?void 0:t.in).getDay();return e===0?7:e}function c0(n,t){const e=u0(t)?new t(0):Ot(t,0);return e.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),e.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e}function u0(n){var t;return typeof n=="function"&&((t=n.prototype)==null?void 0:t.constructor)===n}const d0=10;class fu{constructor(){P(this,"subPriority",0)}validate(t,e){return!0}}class h0 extends fu{constructor(t,e,i,s,r){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=s,r&&(this.subPriority=r)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class f0 extends fu{constructor(e,i){super();P(this,"priority",d0);P(this,"subPriority",-1);this.context=e||(s=>Ot(i,s))}set(e,i){return i.timestampIsSet?e:Ot(e,c0(e,this.context))}}class lt{run(t,e,i,s){const r=this.parse(t,e,i,s);return r?{setter:new h0(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(t,e,i){return!0}}class g0 extends lt{constructor(){super(...arguments);P(this,"priority",140);P(this,"incompatibleTokens",["R","u","t","T"])}parse(e,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"});case"GGGGG":return s.era(e,{width:"narrow"});case"GGGG":default:return s.era(e,{width:"wide"})||s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"})}}set(e,i,s){return i.era=s,e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}const Lt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pe={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function It(n,t){return n&&{value:t(n.value),rest:n.rest}}function Tt(n,t){const e=t.match(n);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function Oe(n,t){const e=t.match(n);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const i=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,a=e[5]?parseInt(e[5],10):0;return{value:i*(s*$n+r*Fi+a*$y),rest:t.slice(e[0].length)}}function gu(n){return Tt(Lt.anyDigitsSigned,n)}function Et(n,t){switch(n){case 1:return Tt(Lt.singleDigit,t);case 2:return Tt(Lt.twoDigits,t);case 3:return Tt(Lt.threeDigits,t);case 4:return Tt(Lt.fourDigits,t);default:return Tt(new RegExp("^\\d{1,"+n+"}"),t)}}function Bs(n,t){switch(n){case 1:return Tt(Lt.singleDigitSigned,t);case 2:return Tt(Lt.twoDigitsSigned,t);case 3:return Tt(Lt.threeDigitsSigned,t);case 4:return Tt(Lt.fourDigitsSigned,t);default:return Tt(new RegExp("^-?\\d{1,"+n+"}"),t)}}function _a(n){switch(n){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function pu(n,t){const e=t>0,i=e?t:1-t;let s;if(i<=50)s=n||100;else{const r=i+50,a=Math.trunc(r/100)*100,o=n>=r%100;s=n+a-(o?100:0)}return e?s:1-s}function mu(n){return n%400===0||n%4===0&&n%100!==0}class p0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,i,s){const r=a=>({year:a,isTwoDigitYear:i==="yy"});switch(i){case"y":return It(Et(4,e),r);case"yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s){const r=e.getFullYear();if(s.isTwoDigitYear){const o=pu(s.year,r);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const a=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}}class m0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,i,s){const r=a=>({year:a,isTwoDigitYear:i==="YY"});switch(i){case"Y":return It(Et(4,e),r);case"Yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s,r){const a=ya(e,r);if(s.isTwoDigitYear){const l=pu(s.year,a);return e.setFullYear(l,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}const o=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(o,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}}class y0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,i){return Bs(i==="R"?4:i.length,e)}set(e,i,s){const r=Ot(e,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),Un(r)}}class b0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,i){return Bs(i==="u"?4:i.length,e)}set(e,i,s){return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class x0 extends lt{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"Q":case"QQ":return Et(i.length,e);case"Qo":return s.ordinalNumber(e,{unit:"quarter"});case"QQQ":return s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(e,{width:"wide",context:"formatting"})||s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class _0 extends lt{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"q":case"qq":return Et(i.length,e);case"qo":return s.ordinalNumber(e,{unit:"quarter"});case"qqq":return s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(e,{width:"wide",context:"standalone"})||s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class w0 extends lt{constructor(){super(...arguments);P(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);P(this,"priority",110)}parse(e,i,s){const r=a=>a-1;switch(i){case"M":return It(Tt(Lt.month,e),r);case"MM":return It(Et(2,e),r);case"Mo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"MMM":return s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(e,{width:"wide",context:"formatting"})||s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}class v0 extends lt{constructor(){super(...arguments);P(this,"priority",110);P(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,i,s){const r=a=>a-1;switch(i){case"L":return It(Tt(Lt.month,e),r);case"LL":return It(Et(2,e),r);case"Lo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"LLL":return s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(e,{width:"wide",context:"standalone"})||s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}function k0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=su(i,e)-t;return i.setDate(i.getDate()-s*7),tt(i,e==null?void 0:e.in)}class M0 extends lt{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,i,s){switch(i){case"w":return Tt(Lt.week,e);case"wo":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s,r){return Ce(k0(e,s,r),r)}}function S0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=iu(i,e)-t;return i.setDate(i.getDate()-s*7),i}class D0 extends lt{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,i,s){switch(i){case"I":return Tt(Lt.week,e);case"Io":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s){return Un(S0(e,s))}}const T0=[31,28,31,30,31,30,31,31,30,31,30,31],C0=[31,29,31,30,31,30,31,31,30,31,30,31];class P0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"subPriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"d":return Tt(Lt.date,e);case"do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear(),r=mu(s),a=e.getMonth();return r?i>=1&&i<=C0[a]:i>=1&&i<=T0[a]}set(e,i,s){return e.setDate(s),e.setHours(0,0,0,0),e}}class O0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"subpriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,i,s){switch(i){case"D":case"DD":return Tt(Lt.dayOfYear,e);case"Do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear();return mu(s)?i>=1&&i<=366:i>=1&&i<=365}set(e,i,s){return e.setMonth(0,s),e.setHours(0,0,0,0),e}}function wa(n,t,e){var d,h,g,p;const i=Dn(),s=(e==null?void 0:e.weekStartsOn)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??i.weekStartsOn??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.weekStartsOn)??0,r=tt(n,e==null?void 0:e.in),a=r.getDay(),l=(t%7+7)%7,c=7-s,u=t<0||t>6?t-(a+c)%7:(l+c)%7-(a+c)%7;return Fs(r,u,e)}class E0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}class A0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,i,s,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"e":case"ee":return It(Et(i.length,e),a);case"eo":return It(s.ordinalNumber(e,{unit:"day"}),a);case"eee":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeeee":return s.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}class R0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,i,s,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"c":case"cc":return It(Et(i.length,e),a);case"co":return It(s.ordinalNumber(e,{unit:"day"}),a);case"ccc":return s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"ccccc":return s.day(e,{width:"narrow",context:"standalone"});case"cccccc":return s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(e,{width:"wide",context:"standalone"})||s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}function L0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=l0(i,e),r=t-s;return Fs(i,r,e)}class I0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,i,s){const r=a=>a===0?7:a;switch(i){case"i":case"ii":return Et(i.length,e);case"io":return s.ordinalNumber(e,{unit:"day"});case"iii":return It(s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return It(s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return It(s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiii":default:return It(s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,i){return i>=1&&i<=7}set(e,i,s){return e=L0(e,s),e.setHours(0,0,0,0),e}}class N0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class F0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class z0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","b","t","T"])}parse(e,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class B0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,i,s){switch(i){case"h":return Tt(Lt.hour12h,e);case"ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=12}set(e,i,s){const r=e.getHours()>=12;return r&&s<12?e.setHours(s+12,0,0,0):!r&&s===12?e.setHours(0,0,0,0):e.setHours(s,0,0,0),e}}class H0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,i,s){switch(i){case"H":return Tt(Lt.hour23h,e);case"Ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=23}set(e,i,s){return e.setHours(s,0,0,0),e}}class W0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,i,s){switch(i){case"K":return Tt(Lt.hour11h,e);case"Ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.getHours()>=12&&s<12?e.setHours(s+12,0,0,0):e.setHours(s,0,0,0),e}}class Y0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,i,s){switch(i){case"k":return Tt(Lt.hour24h,e);case"ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=24}set(e,i,s){const r=s<=24?s%24:s;return e.setHours(r,0,0,0),e}}class V0 extends lt{constructor(){super(...arguments);P(this,"priority",60);P(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"m":return Tt(Lt.minute,e);case"mo":return s.ordinalNumber(e,{unit:"minute"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setMinutes(s,0,0),e}}class j0 extends lt{constructor(){super(...arguments);P(this,"priority",50);P(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"s":return Tt(Lt.second,e);case"so":return s.ordinalNumber(e,{unit:"second"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setSeconds(s,0),e}}class $0 extends lt{constructor(){super(...arguments);P(this,"priority",30);P(this,"incompatibleTokens",["t","T"])}parse(e,i){const s=r=>Math.trunc(r*Math.pow(10,-i.length+3));return It(Et(i.length,e),s)}set(e,i,s){return e.setMilliseconds(s),e}}class U0 extends lt{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","x"])}parse(e,i){switch(i){case"X":return Oe(Pe.basicOptionalMinutes,e);case"XX":return Oe(Pe.basic,e);case"XXXX":return Oe(Pe.basicOptionalSeconds,e);case"XXXXX":return Oe(Pe.extendedOptionalSeconds,e);case"XXX":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:Ot(e,e.getTime()-zs(e)-s)}}class q0 extends lt{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","X"])}parse(e,i){switch(i){case"x":return Oe(Pe.basicOptionalMinutes,e);case"xx":return Oe(Pe.basic,e);case"xxxx":return Oe(Pe.basicOptionalSeconds,e);case"xxxxx":return Oe(Pe.extendedOptionalSeconds,e);case"xxx":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:Ot(e,e.getTime()-zs(e)-s)}}class X0 extends lt{constructor(){super(...arguments);P(this,"priority",40);P(this,"incompatibleTokens","*")}parse(e){return gu(e)}set(e,i,s){return[Ot(e,s*1e3),{timestampIsSet:!0}]}}class G0 extends lt{constructor(){super(...arguments);P(this,"priority",20);P(this,"incompatibleTokens","*")}parse(e){return gu(e)}set(e,i,s){return[Ot(e,s),{timestampIsSet:!0}]}}const K0={G:new g0,y:new p0,Y:new m0,R:new y0,u:new b0,Q:new x0,q:new _0,M:new w0,L:new v0,w:new M0,I:new D0,d:new P0,D:new O0,E:new E0,e:new A0,c:new R0,i:new I0,a:new N0,b:new F0,B:new z0,h:new B0,H:new H0,K:new W0,k:new Y0,m:new V0,s:new j0,S:new $0,X:new U0,x:new q0,t:new X0,T:new G0},Z0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,J0=/^'([^]*?)'?$/,tx=/''/g,ex=/\S/,nx=/[a-zA-Z]/;function ix(n,t,e,i){var x,w,v,M,C,D,E,T;const s=()=>Ot((i==null?void 0:i.in)||e,NaN),r=o0(),a=(i==null?void 0:i.locale)??r.locale??nu,o=(i==null?void 0:i.firstWeekContainsDate)??((w=(x=i==null?void 0:i.locale)==null?void 0:x.options)==null?void 0:w.firstWeekContainsDate)??r.firstWeekContainsDate??((M=(v=r.locale)==null?void 0:v.options)==null?void 0:M.firstWeekContainsDate)??1,l=(i==null?void 0:i.weekStartsOn)??((D=(C=i==null?void 0:i.locale)==null?void 0:C.options)==null?void 0:D.weekStartsOn)??r.weekStartsOn??((T=(E=r.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(!t)return n?s():tt(e,i==null?void 0:i.in);const c={firstWeekContainsDate:o,weekStartsOn:l,locale:a},u=[new f0(i==null?void 0:i.in,e)],d=t.match(Q0).map(b=>{const _=b[0];if(_ in ba){const S=ba[_];return S(b,a.formatLong)}return b}).join("").match(Z0),h=[];for(let b of d){!(i!=null&&i.useAdditionalWeekYearTokens)&&du(b)&&xa(b,t,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&uu(b)&&xa(b,t,n);const _=b[0],S=K0[_];if(S){const{incompatibleTokens:O}=S;if(Array.isArray(O)){const F=h.find(j=>O.includes(j.token)||j.token===_);if(F)throw new RangeError(`The format string mustn't contain \`${F.fullToken}\` and \`${b}\` at the same time`)}else if(S.incompatibleTokens==="*"&&h.length>0)throw new RangeError(`The format string mustn't contain \`${b}\` and any other token at the same time`);h.push({token:_,fullToken:b});const A=S.run(n,b,a.match,c);if(!A)return s();u.push(A.setter),n=A.rest}else{if(_.match(nx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+_+"`");if(b==="''"?b="'":_==="'"&&(b=sx(b)),n.indexOf(b)===0)n=n.slice(b.length);else return s()}}if(n.length>0&&ex.test(n))return s();const g=u.map(b=>b.priority).sort((b,_)=>_-b).filter((b,_,S)=>S.indexOf(b)===_).map(b=>u.filter(_=>_.priority===b).sort((_,S)=>S.subPriority-_.subPriority)).map(b=>b[0]);let p=tt(e,i==null?void 0:i.in);if(isNaN(+p))return s();const y={};for(const b of g){if(!b.validate(p,c))return s();const _=b.set(p,y,c);Array.isArray(_)?(p=_[0],Object.assign(y,_[1])):p=_}return p}function sx(n){return n.match(J0)[1].replace(tx,"'")}function rx(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMinutes(0,0,0),e}function ax(n,t){const e=tt(n,t==null?void 0:t.in);return e.setSeconds(0,0),e}function ox(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMilliseconds(0),e}function lx(n){const t=n/$n;return Math.trunc(t)}function yu(n,t){const e=()=>Ot(t==null?void 0:t.in,NaN),i=(t==null?void 0:t.additionalDigits)??2,s=hx(n);let r;if(s.date){const c=fx(s.date,i);r=gx(c.restDateString,c.year)}if(!r||isNaN(+r))return e();const a=+r;let o=0,l;if(s.time&&(o=px(s.time),isNaN(o)))return e();if(s.timezone){if(l=mx(s.timezone),isNaN(l))return e()}else{const c=new Date(a+o),u=tt(0,t==null?void 0:t.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return tt(a+o+l,t==null?void 0:t.in)}const Hs={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},cx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ux=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,dx=/^([+-])(\d{2})(?::?(\d{2}))?$/;function hx(n){const t={},e=n.split(Hs.dateTimeDelimiter);let i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Hs.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Hs.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){const s=Hs.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function fx(n,t){const e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,r=i[2]?parseInt(i[2]):null;return{year:r===null?s:r*100,restDateString:n.slice((i[1]||i[2]).length)}}function gx(n,t){if(t===null)return new Date(NaN);const e=n.match(cx);if(!e)return new Date(NaN);const i=!!e[4],s=Yi(e[1]),r=Yi(e[2])-1,a=Yi(e[3]),o=Yi(e[4]),l=Yi(e[5])-1;if(i)return wx(t,o,l)?yx(t,o,l):new Date(NaN);{const c=new Date(0);return!xx(t,r,a)||!_x(t,s)?new Date(NaN):(c.setUTCFullYear(t,r,Math.max(s,a)),c)}}function Yi(n){return n?parseInt(n):1}function px(n){const t=n.match(ux);if(!t)return NaN;const e=va(t[1]),i=va(t[2]),s=va(t[3]);return vx(e,i,s)?e*$n+i*Fi+s*1e3:NaN}function va(n){return n&&parseFloat(n.replace(",","."))||0}function mx(n){if(n==="Z")return 0;const t=n.match(dx);if(!t)return 0;const e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return kx(i,s)?e*(i*$n+s*Fi):NaN}function yx(n,t,e){const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const bx=[31,null,31,30,31,30,31,31,30,31,30,31];function bu(n){return n%400===0||n%4===0&&n%100!==0}function xx(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(bx[t]||(bu(n)?29:28))}function _x(n,t){return t>=1&&t<=(bu(n)?366:365)}function wx(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function vx(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function kx(n,t){return t>=0&&t<=59}const ka=(n,t)=>{var s,r;const{tooltip:e}=t;if(e.opacity===0&&!n.locked){n.showTooltip=!1;return}const i=n.chartTooltipSortFn||((a,o)=>o.rawValue-a.rawValue);if(e.body&&!n.locked){const a=e.labelColors,o=((r=(s=t.chart.config)==null?void 0:s.options)==null?void 0:r.indexAxis)==="y"?"x":"y",l=["horizontal_bar","vertical_bar"].includes(n.chartType),c=["gauge","doughnut"].includes(n.chartType);n.tooltipContext=l?e.dataPoints.length>1?e.dataPoints[0].label:"":e.dataPoints[0].parsed.x,n.tooltipSeries=e.dataPoints.map((u,d)=>{const h=c?u.parsed:u.parsed[o];let g;if(n.units==="bytes")g=isNaN(h)?h:ua(h);else{const y=n.translateUnit(n.units,h);g=`${n.units==="usd"?"$":""}${h%1===0?Ws.format(h):Ws.format(Number(h.toFixed(_u)))} ${y}`}const p=l&&u.dataset.label!==u.label?u.dataset.label:c?u.dataset.labels[u.dataIndex]:u.dataset.label;return{backgroundColor:a[d].backgroundColor,borderColor:a[d].borderColor,label:p,value:g,rawValue:h}}).sort(i),n.left=`${e.x}px`,n.top=`${e.y}px`,n.showTooltip=!0}},Mx=n=>n&&n.datasets&&n.datasets.length,Sx=n=>Mx(n)&&n.datasets.some(t=>t.data.length),Dx=n=>Sx(n)&&n.datasets.some(t=>t.data.length>1),Tx=n=>Dx(n)&&n.datasets.some(t=>t.data[0]&&ga(t.data[0].x)),Cx=n=>Tx(n)&&n.datasets.some(t=>t.data[0]&&t.data[0].x.toString().length>=13),Ma=(n,t,e)=>{const s=Math.min(t/1150,1);return n.x<e?n.x+t*.15*(1-s):n.x-t*1.15*(1-s)},Px=(n,t,e)=>n.y<e?n.y+t*.15:n.y-t*.5;function xu(n,t){let e;return(...i)=>{clearTimeout(e),e=window.setTimeout(()=>{n(...i)},t)}}const _u=2,wu=10,vu=12,Ws=new Intl.NumberFormat(((vh=document==null?void 0:document.documentElement)==null?void 0:vh.lang)||"en-US"),Ys=10,ku={"1XXCount|1XX|1[0-9][0-9]":{solid:"#0072E5",light:"#4DA6FF",description:"Informational"},"SuccessfulRequests|2XXCount|2XX|2[0-9][0-9]|SUCCESS":{solid:"#0BB652",light:"#6FCC83",description:"Success"},"3XXCount|3XX|3[0-9][0-9]":{solid:"#FDC53B",light:"#FFD982",description:"Redirection"},"4XXCount|4XX|4[0-9][0-9]":{solid:"#FE9439",light:"#FFBA81",description:"Client Errors"},"5XXCount|5XX|5[0-9][0-9]":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},"errorCount|FailedRequests|FAILURE":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},nonStandard:{solid:"#6f7787",light:"#e7e7ec"},standard:{solid:"#1155cb",light:"#8ab3fa"},p99:{solid:"#1356cb",light:"#1356cb"},p95:{solid:"#1fbecd",light:"#1fbecd"},p50:{solid:"#1df97d",light:"#1df97d"},LatencyP99:{solid:"#1356cb",light:"#1356cb"},LatencyP95:{solid:"#1fbecd",light:"#1fbecd"},LatencyP50:{solid:"#1df97d",light:"#1df97d"}},Be=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Xn=(n,t)=>(t||Be)[n%Be.length],Mu=(n,t)=>{n[0]==="#"&&(n=n.slice(1));let e=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);e=e-t,i=i-t,s=s-t,e>255?e=255:e<0&&(e=0),i>255?i=255:i<0&&(i=0),s>255?s=255:s<0&&(s=0);const r=e.toString(16).length===1?"0"+e.toString(16):e.toString(16),a=i.toString(16).length===1?"0"+i.toString(16):i.toString(16),o=s.toString(16).length===1?"0"+s.toString(16):s.toString(16);return`#${r}${a}${o}`},Su="#6f7787",Du={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},Ox=n=>{var e;const t=Math.floor(parseInt(n,10)/100)*100;return((e=Du[t])==null?void 0:e.background)||"#fafafa"},Ex={SUCCESS:"#6FCC83",FAILURE:"#FF8484"},Ax={"4XX":"#FFBA81","5XX":"#FF8484"},Rx={LatencyP99:"#1356cb",LatencyP95:"#1fbecd",LatencyP50:"#1df97d"},Lx="#dad4c7",Ix=n=>{const t=Object.entries(ku).find(([e])=>new RegExp(e).test(n));return t&&t[1]||ku.standard},Nx={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},Fx=2,zx=0,Sa=new Map,Da=(n,t)=>t==="bytes"?ua(n):t==="count/minute"?n.toFixed(2):Ws.format(n),Tu=n=>{const e=document.createElement("canvas").getContext("2d"),i=xt({});return e.font=i.string,e.measureText(n).width},Bx=()=>{const n="label_height";if(!Sa.has(n)){const t=xt({});Sa.set(n,t.lineHeight)}return Sa.get(n)},Hx=n=>n.datasets.reduce((t,e)=>t+e.data.reduce((i,s)=>isNaN(s)?i:i+s,0),0),Cu=(n,t)=>t.datasets.reduce((e,i,s)=>n.isDatasetVisible(s)?e+i.data.reduce((r,a)=>isNaN(a)?r:r+a,0):e,0),Pu=(n,t)=>t===0?" (0.0%)":` (${(n/t*100).toFixed(1)}%)`,Ta="#e0e4ea",Wx={100:["#c8e2fd","#80bfff","#4da6ff","#1a8cff","#0072e5","#0059b2"],200:["#ceedd2","#9edca6","#89d595","#6fcc83","#44c26b","#0bb652","#0ca84a","#169643","#196e33","#1b572a"],300:["#fff4db","#ffe9b8","#ffe2a1","#ffd982","#ffd062","#fdc53b","#f4bb1e","#e8b00b","#d9a30f","#c89407"],400:["#ffead8","#ffd5b1","#ffc899","#ffba81","#ffae6b","#fe9439","#f6871d","#eb7c0c","#da700c","#cc6100"],500:["#ffd5d5","#ffb6b6","#ff9d9d","#ff8484","#ff6a6a","#ff4545","#fb1f1f","#e90b0b","#d40202","#be0202"]},Vi=(n,t)=>{let e=1;const i=Wx[n],s=new Map;for(const r of t)s.set(r,i[e]),e=e%(i.length-1)+1;return s.set(-1,i[0]),s},Ou=new Map([[100,Vi("100",[100,101,102,103])],[200,Vi("200",[200,201,202,203,204,205,206,207,208,226])],[300,Vi("300",[300,301,302,303,304,305,307,308])],[400,Vi("400",[400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,423,424,425,426,428,429,431,451])],[500,Vi("500",[500,501,502,503,504,505,506,507,508,510,511])]]),Ca=n=>{const t=parseInt(n,10),e=Math.floor(t/100)*100,i=Ou.get(e);return i===void 0?Ta:i.get(t)??i.get(-1)??Ta},Yx=n=>{const t=Ca(n);return{solid:t,light:t}},Vs={...Array.from({length:500},(n,t)=>100+t).reduce((n,t)=>(n[`${t}`]=Ca(`${t}`),n),{}),____OTHER____:"#DAD4C7","1XX":"#4DA6FF","2XX":"#6FCC83","3XX":"#FFD982","4XX":"#FFBA81","5XX":"#FF8484"};function Vx(n){const t={enabled:!1,position:"barChartTooltipPosition",callbacks:{label:s=>({label:s.dataset.label,value:s.label})}};Rs.positioners.barChartTooltipPosition=function(s,r){if(!s.length)return!1;const a=this.chart.canvas.getBoundingClientRect(),o=n.tooltipState.width||this.width,l=a.width/2,c=Ma(r,o,l),u=r.y,d=r.x<l?"left":"center";return{x:c-n.tooltipState.offsetX,y:u-n.tooltipState.offsetY,xAlign:d}},Ur.modes.customInteractionMode=function(s,r){const a=en(r,s),o=[];return Ur.evaluateInteractionItems(s,s.options.indexAxis||"x",a,(l,c,u)=>{s.options.indexAxis==="y"&&l.inYRange(a.y,!0)&&s.data.datasets[c].data[u]&&o.push({element:l,datasetIndex:c,index:u}),s.options.indexAxis==="x"&&l.inXRange(a.x,!0)&&s.data.datasets[c].data[u]&&o.push({element:l,datasetIndex:c,index:u})}),o};const e=n.numLabels.value>25?wu:vu;return f.computed(()=>{var s,r,a,o,l,c,u,d;return{indexAxis:n.indexAxis,skipNull:!0,scales:{x:{border:{display:!1},stacked:n.stacked.value,grid:{display:!1,drawBorder:!1},ticks:{maxRotation:90,autoSkip:!1,font:e,callback:function(h,g){const p=this;if(p.chart.options.indexAxis===p.axis){h=p.getLabelForValue(g);const y=10;return h&&h.length>y?h.slice(0,y)+"...":h}return p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="y"?!J((s=n.metricAxesTitle)==null?void 0:s.value):!J((r=n.dimensionAxesTitle)==null?void 0:r.value),text:n.indexAxis==="y"?(a=n.metricAxesTitle)==null?void 0:a.value:(o=n.dimensionAxesTitle)==null?void 0:o.value,padding:{top:10},font:{weight:"bold"}}},y:{border:{display:!1},stacked:n.stacked.value,beginAtZero:!0,grid:{display:!1,drawBorder:!1},ticks:{font:e,callback:function(h,g){const p=this;return p.chart.options.indexAxis===p.axis?(h=p.getLabelForValue(g),h&&h.length>Ys?h.slice(0,Ys)+"...":h):p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="x"?!J((l=n.metricAxesTitle)==null?void 0:l.value):!J((c=n.dimensionAxesTitle)==null?void 0:c.value),text:n.indexAxis==="x"?(u=n.metricAxesTitle)==null?void 0:u.value:(d=n.dimensionAxesTitle)==null?void 0:d.value,padding:{bottom:20},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:h=>{ka(n.tooltipState,h)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1}})}ge.register(...By);const jx=(n,t)=>{const e=t.datasets.map(s=>s.label),i=n.datasets.map(s=>s.label);return n.datasets.length===t.datasets.length&&e.every((s,r)=>s===i[r])};function $x(n,t,e,i,s){const r=f.shallowRef(null),a=(o,l)=>{if(t.value)return new ge(t.value,{type:n,data:o,plugins:i,options:l})};return f.onMounted(()=>{r.value=a(e.value,s.value)}),f.onBeforeUnmount(()=>{J(r.value)||r.value.destroy()}),f.watch(e,(o,l)=>{if(jx(l,o)&&!J(r.value)){for(const[c,u]of o.datasets.entries())Object.assign(r.value.data.datasets[c],u);r.value.data.labels=o.labels,r.value.update()}else J(r.value)||r.value.destroy(),r.value=a(o,s.value)}),f.watch(t,()=>{J(r.value)||r.value.destroy(),r.value=a(e.value,s.value)}),f.watch(s,(o,l)=>{(o.indexAxis!==l.indexAxis||JSON.stringify(o.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(o.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(J(r.value)||r.value.destroy(),r.value=a(e.value,o))}),r}var ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Eu={exports:{}};(function(n){(function(){function t(c,u){if(u.separator===!1||c<1e3)return c.toString();var d=typeof u.separator=="string"?u.separator:",",h=[],g=Math.round(c).toString().split("");return g.reverse().forEach(function(p,y){y&&y%3===0&&h.push(d),h.push(p)}),h.reverse().join("")}function e(c,u,d){var h=c/u,g=d.round?"round":"floor";return d.decimal===!1?(c=Math[g](h),c.toString()):(d.precision?c=h:c=h<10?Math[g](h*10)/10:Math[g](h),c=c.toString(),typeof d.decimal=="string"&&(c=c.replace(".",d.decimal)),c)}var i=1e3,s=1e4,r=1e6,a=1e9,o=1e12;function l(c,u){var d;u=u||{};var h=c<0;h&&(c=Math.abs(c)),u.precision&&(c=parseFloat(c.toPrecision(u.precision)));var g=u.min10k?s:i;return c<g||u.precision&&u.precision>Math.log10(c)?d=t(e(c,1,u),u):c<r?d=e(c,i,u)+"k":c<a?d=e(c,r,u)+"m":c<o?d=t(e(c,a,u),u)+"b":d=t(e(c,o,u),u)+"t",h&&(d="-"+d),u.capital&&(d=d.toUpperCase()),u.prefix&&(d=u.prefix+d),u.suffix&&(d=d+u.suffix),d}l.addCommas=t,n.exports=l})()})(Eu);var Ux=Eu.exports;const ji=Pa(Ux);function qx(n,t,e){const{i18n:i}=gt.useI18n(),{translateUnit:s}=gt.useTranslatedUnits();return{legendValues:f.computed(()=>n.value.datasets.reduce((a,o)=>{const l=o.total?o.total:o.data.reduce((u,d)=>u+(typeof d=="number"?Number(d)||0:Number(d&&d.y)||0),0);let c;if(e.value==="bytes")c=isNaN(l)?"0":ua(l);else{const u=s(e.value,l);c=i&&i.t("legend.datapointValueDisplay",{value:ji(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}}),unit:u})||`${ji(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}})} ${e.value}`}return{...a,[o.label]:{raw:l,formatted:c}}},{}))}}var Xx=Object.defineProperty,Gx=(n,t,e)=>t in n?Xx(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ee=(n,t,e)=>Gx(n,typeof t!="symbol"?t+"":t,e),Ct=(n=>(n.FIFTEEN_MIN="15m",n.ONE_HOUR="1h",n.SIX_HOUR="6h",n.TWELVE_HOUR="12h",n.ONE_DAY="24h",n.SEVEN_DAY="7d",n.THIRTY_DAY="30d",n.CURRENT_WEEK="current_week",n.CURRENT_MONTH="current_month",n.CURRENT_QUARTER="current_quarter",n.PREVIOUS_WEEK="previous_week",n.PREVIOUS_MONTH="previous_month",n.PREVIOUS_QUARTER="previous_quarter",n))(Ct||{});const Kx=["secondly","minutely","hourly","daily","weekly","trend"],$i=n=>n.filter(t=>t!=="time"),Au=["api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","route","status_code","status_code_grouped","time"],Zx=$i(Au),Qx=[...Au,"application","consumer","iso_code"],Jx=$i(Qx),t_=["control_plane","control_plane_group","gateway_service","consumer","application","route","ai_provider","ai_response_model","ai_request_model","llm_cache_status","llm_embeddings_provider","llm_embeddings_model","time"],e_=$i(t_);$i(["api_product","api_product_version","application","auth_type","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","gateway_service","header_host","header_user_agent","http_method","iso_code","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_uri","upstream_status_code_grouped","websocket"]),$i(["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","request_body_size","response_body_size","response_header_content_length","status_code","upstream_status_code"]),new Set(Zx),new Set(Jx),new Set(e_);const Ru=6048e5,n_=864e5,i_=60,s_=3600,Lu=Symbol.for("constructDateFrom");function pe(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Lu in n?n[Lu](t):n instanceof Date?new n.constructor(t):new Date(t)}function qt(n,t){return pe(t||n,n)}function Iu(n,t,e){const i=qt(n,void 0);return isNaN(t)?pe(n,NaN):(i.setDate(i.getDate()+t),i)}function r_(n,t,e){const i=qt(n,void 0);if(isNaN(t))return pe(n,NaN);const s=i.getDate(),r=pe(n,i.getTime());r.setMonth(i.getMonth()+t+1,0);const a=r.getDate();return s>=a?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}let a_={};function js(){return a_}function He(n,t){var e,i,s,r;const a=js(),o=(t==null?void 0:t.weekStartsOn)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.weekStartsOn)??a.weekStartsOn??((r=(s=a.locale)==null?void 0:s.options)==null?void 0:r.weekStartsOn)??0,l=qt(n,t==null?void 0:t.in),c=l.getDay(),u=(c<o?7:0)+c-o;return l.setDate(l.getDate()-u),l.setHours(0,0,0,0),l}function $s(n,t){return He(n,{...t,weekStartsOn:1})}function Nu(n,t){const e=qt(n,void 0),i=e.getFullYear(),s=pe(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const r=$s(s),a=pe(e,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const o=$s(a);return e.getTime()>=r.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function Fu(n){const t=qt(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function o_(n,...t){const e=pe.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function Us(n,t){const e=qt(n,void 0);return e.setHours(0,0,0,0),e}function l_(n,t,e){const[i,s]=o_(void 0,n,t),r=Us(i),a=Us(s),o=+r-Fu(r),l=+a-Fu(a);return Math.round((o-l)/n_)}function c_(n,t){const e=Nu(n),i=pe(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),$s(i)}function u_(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function d_(n){return!(!u_(n)&&typeof n!="number"||isNaN(+qt(n)))}function Gn(n,t){const e=qt(n,void 0);return e.setDate(1),e.setHours(0,0,0,0),e}function h_(n,t){const e=qt(n,void 0);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const f_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},g_=(n,t,e)=>{let i;const s=f_[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Oa(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const p_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},m_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},y_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},b_={date:Oa({formats:p_,defaultWidth:"full"}),time:Oa({formats:m_,defaultWidth:"full"}),dateTime:Oa({formats:y_,defaultWidth:"full"})},x_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},__=(n,t,e,i)=>x_[n];function Ui(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):a;s=n.formattingValues[o]||n.formattingValues[a]}else{const a=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[o]||n.values[a]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const w_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},v_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},k_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},M_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},S_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},D_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},T_=(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},C_={ordinalNumber:T_,era:Ui({values:w_,defaultWidth:"wide"}),quarter:Ui({values:v_,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Ui({values:k_,defaultWidth:"wide"}),day:Ui({values:M_,defaultWidth:"wide"}),dayPeriod:Ui({values:S_,defaultWidth:"wide",formattingValues:D_,defaultFormattingWidth:"wide"})};function qi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const a=r[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?O_(o,d=>d.test(a)):P_(o,d=>d.test(a));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function P_(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function O_(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function E_(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let a=n.valueCallback?n.valueCallback(r[0]):r[0];a=e.valueCallback?e.valueCallback(a):a;const o=t.slice(s.length);return{value:a,rest:o}}}const A_=/^(\d+)(th|st|nd|rd)?/i,R_=/\d+/i,L_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},I_={any:[/^b/i,/^(a|c)/i]},N_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},F_={any:[/1/i,/2/i,/3/i,/4/i]},z_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},B_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},H_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},W_={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Y_={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},V_={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},j_={ordinalNumber:E_({matchPattern:A_,parsePattern:R_,valueCallback:n=>parseInt(n,10)}),era:qi({matchPatterns:L_,defaultMatchWidth:"wide",parsePatterns:I_,defaultParseWidth:"any"}),quarter:qi({matchPatterns:N_,defaultMatchWidth:"wide",parsePatterns:F_,defaultParseWidth:"any",valueCallback:n=>n+1}),month:qi({matchPatterns:z_,defaultMatchWidth:"wide",parsePatterns:B_,defaultParseWidth:"any"}),day:qi({matchPatterns:H_,defaultMatchWidth:"wide",parsePatterns:W_,defaultParseWidth:"any"}),dayPeriod:qi({matchPatterns:Y_,defaultMatchWidth:"any",parsePatterns:V_,defaultParseWidth:"any"})},$_={code:"en-US",formatDistance:g_,formatLong:b_,formatRelative:__,localize:C_,match:j_,options:{weekStartsOn:0,firstWeekContainsDate:1}};function U_(n,t){const e=qt(n,void 0);return l_(e,h_(e))+1}function q_(n,t){const e=qt(n,void 0),i=+$s(e)-+c_(e);return Math.round(i/Ru)+1}function zu(n,t){var e,i,s,r;const a=qt(n,t==null?void 0:t.in),o=a.getFullYear(),l=js(),c=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??l.firstWeekContainsDate??((r=(s=l.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,u=pe((t==null?void 0:t.in)||n,0);u.setFullYear(o+1,0,c),u.setHours(0,0,0,0);const d=He(u,t),h=pe((t==null?void 0:t.in)||n,0);h.setFullYear(o,0,c),h.setHours(0,0,0,0);const g=He(h,t);return+a>=+d?o+1:+a>=+g?o:o-1}function X_(n,t){var e,i,s,r;const a=js(),o=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(s=a.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,l=zu(n,t),c=pe((t==null?void 0:t.in)||n,0);return c.setFullYear(l,0,o),c.setHours(0,0,0,0),He(c,t)}function G_(n,t){const e=qt(n,t==null?void 0:t.in),i=+He(e,t)-+X_(e,t);return Math.round(i/Ru)+1}function ft(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const on={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ft(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ft(e+1,2)},d(n,t){return ft(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ft(n.getHours()%12||12,t.length)},H(n,t){return ft(n.getHours(),t.length)},m(n,t){return ft(n.getMinutes(),t.length)},s(n,t){return ft(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ft(s,t.length)}},Kn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Bu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return on.y(n,t)},Y:function(n,t,e,i){const s=zu(n,i),r=s>0?s:1-s;if(t==="YY"){const a=r%100;return ft(a,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ft(r,t.length)},R:function(n,t){const e=Nu(n);return ft(e,t.length)},u:function(n,t){const e=n.getFullYear();return ft(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ft(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ft(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return on.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ft(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=G_(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ft(s,t.length)},I:function(n,t,e){const i=q_(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ft(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):on.d(n,t)},D:function(n,t,e){const i=U_(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ft(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ft(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ft(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ft(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const i=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=Kn.noon:i===0?s=Kn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=Kn.evening:i>=12?s=Kn.afternoon:i>=4?s=Kn.morning:s=Kn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return on.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):on.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):on.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):on.s(n,t)},S:function(n,t){return on.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Wu(i);case"XXXX":case"XX":return Pn(i);case"XXXXX":case"XXX":default:return Pn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Wu(i);case"xxxx":case"xx":return Pn(i);case"xxxxx":case"xxx":default:return Pn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Hu(i,":");case"OOOO":default:return"GMT"+Pn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Hu(i,":");case"zzzz":default:return"GMT"+Pn(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return ft(i,t.length)},T:function(n,t,e){return ft(+n,t.length)}};function Hu(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ft(r,2)}function Wu(n,t){return n%60===0?(n>0?"-":"+")+ft(Math.abs(n)/60,2):Pn(n,t)}function Pn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ft(Math.trunc(i/60),2),r=ft(i%60,2);return e+s+t+r}const Yu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Vu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},K_=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return Yu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",Yu(i,t)).replace("{{time}}",Vu(s,t))},Z_={p:Vu,P:K_},Q_=/^D+$/,J_=/^Y+$/,tw=["D","DD","YY","YYYY"];function ew(n){return Q_.test(n)}function nw(n){return J_.test(n)}function iw(n,t,e){const i=sw(n,t,e);if(console.warn(i),tw.includes(n))throw new RangeError(i)}function sw(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const rw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ow=/^'([^]*?)'?$/,lw=/''/g,cw=/[a-zA-Z]/;function uw(n,t,e){var i,s,r,a,o,l,c,u;const d=js(),h=(e==null?void 0:e.locale)??d.locale??$_,g=(e==null?void 0:e.firstWeekContainsDate)??((s=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:s.firstWeekContainsDate)??d.firstWeekContainsDate??((a=(r=d.locale)==null?void 0:r.options)==null?void 0:a.firstWeekContainsDate)??1,p=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((u=(c=d.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,y=qt(n,e==null?void 0:e.in);if(!d_(y))throw new RangeError("Invalid time value");let x=t.match(aw).map(v=>{const M=v[0];if(M==="p"||M==="P"){const C=Z_[M];return C(v,h.formatLong)}return v}).join("").match(rw).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:dw(v)};if(Bu[M])return{isToken:!0,value:v};if(M.match(cw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});h.localize.preprocessor&&(x=h.localize.preprocessor(y,x));const w={firstWeekContainsDate:g,weekStartsOn:p,locale:h};return x.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&nw(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&ew(M))&&iw(M,t,String(n));const C=Bu[M[0]];return C(y,M,h.localize,w)}).join("")}function dw(n){const t=n.match(ow);return t?t[1].replace(lw,"'"):n}function hw(n,t){const e=qt(n,void 0),i=e.getFullYear(),s=e.getMonth(),r=pe(e,0);return r.setFullYear(i,s+1,0),r.setHours(0,0,0,0),r.getDate()}function fw(n){return Math.trunc(n*s_)}function gw(n){const t=n/i_;return Math.trunc(t)}function ju(n,t,e){return r_(n,-t)}function $u(n,t,e){const i=yw(n,e.timeZone,e.locale);return"formatToParts"in i?pw(i,t):mw(i,t)}function pw(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function mw(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function yw(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function bw(n,t){const e=vw(t);return"formatToParts"in e?_w(e,n):ww(e,n)}const xw={year:0,month:1,day:2,hour:3,minute:4,second:5};function _w(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=xw[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function ww(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Ea={};function vw(n){if(!Ea[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";Ea[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Ea[n]}function Aa(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const Uu=36e5,kw=6e4,Ra={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Xi(n,t,e){if(!n)return 0;let i=Ra.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=Ra.timezoneHH.exec(n),i)return s=parseInt(i[1],10),qu(s)?-(s*Uu):NaN;if(i=Ra.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return qu(s,a)?(r=Math.abs(s)*Uu+a*kw,i[1]==="+"?-r:r):NaN}if(Dw(n)){t=new Date(t||Date.now());const a=e?t:Mw(t),o=La(a,n);return-(e?o:Sw(t,o,n))}return NaN}function Mw(n){return Aa(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function La(n,t){const e=bw(n,t),i=Aa(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function Sw(n,t,e){let i=n.getTime()-t;const s=La(new Date(i),e);if(t===s)return t;i-=s-t;const r=La(new Date(i),e);return s===r?s:Math.max(s,r)}function qu(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const Xu={};function Dw(n){if(Xu[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Xu[n]=!0,!0}catch{return!1}}const Tw=60*1e3,Cw={X:function(n,t,e){const i=Ia(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return Gu(i);case"XXXX":case"XX":return Zn(i);case"XXXXX":case"XXX":default:return Zn(i,":")}},x:function(n,t,e){const i=Ia(e.timeZone,n);switch(t){case"x":return Gu(i);case"xxxx":case"xx":return Zn(i);case"xxxxx":case"xxx":default:return Zn(i,":")}},O:function(n,t,e){const i=Ia(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+Pw(i,":");case"OOOO":default:return"GMT"+Zn(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return $u("short",n,e);case"zzzz":default:return $u("long",n,e)}}};function Ia(n,t){const e=n?Xi(n,t,!0)/Tw:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function qs(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function Zn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=qs(Math.floor(i/60),2),r=qs(Math.floor(i%60),2);return e+s+t+r}function Gu(n,t){return n%60===0?(n>0?"-":"+")+qs(Math.abs(n)/60,2):Zn(n,t)}function Pw(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+qs(r,2)}function Ku(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const Zu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Na=36e5,Qu=6e4,Ow=2,Xt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Zu};function Xs(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?Ow:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=Ew(n),{year:s,restDateString:r}=Aw(i.date,e),a=Rw(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=Lw(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Xi(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=Ku(new Date(o+l)),c=Ku(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function Ew(n){const t={};let e=Xt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Xt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Xt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function Aw(n,t){if(n){const e=Xt.YYY[t],i=Xt.YYYYY[t];let s=Xt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Xt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function Rw(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Xt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,ed(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Xt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return Fw(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Xt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return ed(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Xt.Www.exec(n),r)return s=parseInt(r[1],10)-1,nd(s)?Ju(t,s):new Date(NaN);if(r=Xt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return nd(s,a)?Ju(t,s,a):new Date(NaN)}return null}function Lw(n){let t,e,i=Xt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),Fa(t)?t%24*Na:NaN;if(i=Xt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),Fa(t,e)?t%24*Na+e*Qu:NaN;if(i=Xt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Fa(t,e,s)?t%24*Na+e*Qu+s*1e3:NaN}return null}function Ju(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const Iw=[31,28,31,30,31,30,31,31,30,31,30,31],Nw=[31,29,31,30,31,30,31,31,30,31,30,31];function td(n){return n%400===0||n%4===0&&n%100!==0}function ed(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=td(n);if(i&&e>Nw[t]||!i&&e>Iw[t])return!1}return!0}function Fw(n,t){if(t<1)return!1;const e=td(n);return!(e&&t>366||!e&&t>365)}function nd(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function Fa(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const zw=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Bw(n,t,e={}){t=String(t);const i=t.match(zw);if(i){const s=Xs(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+Cw[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return uw(n,t,e)}function id(n,t,e){n=Xs(n,e);const i=Xi(t,n,!0),s=new Date(n.getTime()-i),r=new Date(0);return r.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),r.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),r}function Hw(n,t,e,i){return i={...i,timeZone:t,originalDate:n},Bw(id(n,t,{timeZone:i.timeZone}),e,i)}function Ww(n,t,e){if(typeof n=="string"&&!n.match(Zu))return Xs(n,{...e,timeZone:t});n=Xs(n,e);const i=Aa(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),s=Xi(t,new Date(i));return new Date(i+s)}function Yw(n,t){return-Xi(n,t)}function za(n,t={}){if(!n)return n;const e=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(n);return Hw(s,e,i)}catch{return console.error("Invalid value passed to formatTime",n),"(invalid date)"}}const Vw={secondly:1e3,minutely:60*1e3,hourly:60*60*1e3,daily:60*60*24*1e3,weekly:60*60*24*7*1e3,trend:0};function Ba(n){return n&&Kx.find(t=>n<=Vw[t])||null}const Qn=(n,t)=>new Date(n.getTime()-Yw(t,n));class we{constructor(t){Ee(this,"timeframeText"),Ee(this,"key"),Ee(this,"display"),Ee(this,"timeframeLength"),Ee(this,"allowedTiers"),Ee(this,"defaultResponseGranularity"),Ee(this,"dataGranularity"),Ee(this,"isRelative"),Ee(this,"_startCustom"),Ee(this,"_endCustom"),this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(){const t=new Set,e=this.maximumTimeframeLength()/3600;return e<=6&&t.add("minutely"),e>=2&&e<=7*24&&t.add("hourly"),e>=2*24&&t.add("daily"),e>=2*24*14&&t.add("weekly"),t}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const e=Ww(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return id(e,t)}}class jw extends we{rawStart(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Qn(e,t)),e}maximumTimeframeLength(){return 60*60*24*7}}class $w extends we{rawStart(t){let e=Gn(this.tzAdjustedDate(t));return t&&(e=Qn(e,t)),e}maximumTimeframeLength(){return 60*60*24*31}}class Uw extends we{rawEnd(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Qn(e,t)),e}rawStart(t){const e=this.tzAdjustedDate(t);let i=He(e.setDate(e.getDate()-7),{weekStartsOn:1});return t&&(i=Qn(i,t)),i}}class qw extends we{rawEnd(t){let e=Gn(this.tzAdjustedDate(t));return t&&(e=Qn(e,t)),e}rawStart(t){let e=Gn(ju(this.tzAdjustedDate(t),1));return t&&(e=Qn(e,t)),e}}Ct.FIFTEEN_MIN,new we({key:Ct.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>60*15,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.ONE_HOUR,new we({key:Ct.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>60*60*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.SIX_HOUR,new we({key:Ct.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>60*60*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.TWELVE_HOUR,new we({key:Ct.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>60*60*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.ONE_DAY,new we({key:Ct.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>60*60*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.SEVEN_DAY,new we({key:Ct.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Ct.THIRTY_DAY,new we({key:Ct.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>60*60*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Ct.CURRENT_WEEK,new jw({key:Ct.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const n=He(new Date,{weekStartsOn:1});return(Us(Iu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.CURRENT_MONTH,new $w({key:Ct.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const n=Gn(new Date);return(Us(Iu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.PREVIOUS_WEEK,new Uw({key:Ct.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.PREVIOUS_MONTH,new qw({key:Ct.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let n=0;const t=Gn(new Date),e=Gn(ju(new Date,1));return t.getTimezoneOffset()!==e.getTimezoneOffset()&&(n=Xw(t,e)),60*60*24*hw(new Date().setMonth(new Date().getMonth()-1))+fw(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function Xw(n,t){return gw(n.getTimezoneOffset()-t.getTimezoneOffset())}function Gw(n){return f.computed(()=>{var s;if(!((s=n.value)!=null&&s.meta))return"";const e=n.value.meta.start_ms,i=n.value.meta.end_ms;return e&&i?`${za(e)} - ${za(i,{includeTZ:!0})}`:""})}function Kw(n){const t={enabled:!1,position:"doughnutChartTooltipPosition",callbacks:{label:i=>({label:i.dataset.label,value:i.label})}};return Rs.positioners.doughnutChartTooltipPosition=function(i,s){if(!i.length)return!1;const r=this.chart.canvas.getBoundingClientRect(),a=n.tooltipState.width||this.width,o=r.width/2,l=Ma(s,a,o),c=s.y,u=s.x<o?"left":"center";return{x:l-n.tooltipState.offsetX,y:c,xAlign:u}},{options:f.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:i=>{ka(n.tooltipState,i)}}}}))}}function Zw(n){const t=f.computed(()=>{var l,c;return{type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:10,autoSkipPadding:100,source:"auto",maxRotation:0},title:{display:!J((l=n.dimensionAxesTitle)==null?void 0:l.value),text:(c=n.dimensionAxesTitle)==null?void 0:c.value,padding:{top:2},font:{weight:"bold"}}}}),e=f.computed(()=>{var l,c;return{title:{display:!J((l=n.metricAxesTitle)==null?void 0:l.value),text:(c=n.metricAxesTitle)==null?void 0:c.value,padding:{bottom:10},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0}}),i={enabled:!1,position:"lineChartTooltipPosition"};Rs.positioners.lineChartTooltipPosition=function(l,c){if(!l.length||n.tooltipState.locked)return!1;const u=this.chart.canvas.getBoundingClientRect(),d=n.tooltipState.width||this.width,h=n.tooltipState.height||this.height,g=u.width/2,p=u.height/2,y=Ma(c,d,g);let x=Px(c,h,p);const w=c.y<p?"top":"bottom",v=c.x<g?"left":"center";return h>u.height&&(x=0),{x:y,y:x,xAlign:v,yAlign:w}};const s=f.computed(()=>{switch(n.granularity.value){case"minutely":return"minute";case"hourly":return"hour";case"daily":return"day";default:return"day"}}),r=f.computed(()=>lx(Number(n.timeRangeMs.value))>=24?"yyyy-MM-dd h:mm":"h:mm"),a=f.computed(()=>["daily","weekly"].includes(n.granularity.value)?"yyyy-MM-dd":"yyyy-MM-dd h:mm");return{options:f.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:{border:{display:!1},...t.value,stacked:n.stacked.value,time:{tooltipFormat:"h:mm:ss a",unit:s.value,displayFormats:{minute:"h:mm:ss a",hour:r.value,day:a.value}}},y:{border:{display:!1},...e.value,stacked:n.stacked.value}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},streaming:!1,tooltip:{...i,external:l=>{ka(n.tooltipState,l)}}},interaction:{mode:"index",intersect:!1}}))}}function Qw(n){const{isMultiMetric:t,hasDimensions:e,metricNames:i,barSegmentLabels:s,pivotRecords:r,rowLabels:a,colorPalette:o}=n,{i18n:l}=gt.useI18n();return t?i.map(u=>({label:l&&l.te(`chartLabels.${u}`)&&l.t(`chartLabels.${u}`)||u,backgroundColor:Xn(i.indexOf(u),Be),data:a.map((d,h)=>e?r[`${d.id},${u}`]||0:r[`${h},${u}`]||null)})):Array.from(s).flatMap((u,d)=>{if(!u)return[];const h={},g=Array.isArray(o)?Xn(d,o):o[u.name]||Xn(d);return h[u.name]=g,{label:l&&l.te(`chartLabels.${u.name}`)&&l.t(`chartLabels.${u.name}`)||u.name,backgroundColor:g,data:a.map(p=>r[`${p.id},${u.id}`]||null)}})}function Jw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:a}=t.value.meta,o=r&&Object.keys(r),l=a&&a.length>1,c=r&&o&&o.length>0;if(!s.length||!a)return{datasets:[],labels:[]};const u=c&&o||a,d=u[0],h=u.length>1?u[1]:u[0],g=Object.fromEntries(l?s.flatMap(T=>a.map((b,_)=>{const S=T.event[d],O=c?`${S},${b}`:`${_},${b}`,A=T.event[b];return[O,A]})):s.map(T=>{const b=c?`${T.event[d]},${T.event[h]}`:`${d},${h}`,_=T.event[a[0]];return[b,_]})),p=Object.keys(g).reduce((T,b)=>{const[_]=b.split(","),S=g[b];return T[_]?T[_]+=S:T[_]=S,T},{}),y=Object.entries(p).sort(([,T],[,b])=>Number(b)-Number(T)).map(([T])=>T),x=r[d],w=r[h],v=c&&x&&Object.entries(x).map(([T,b])=>({id:T,name:b.name}))||a.map(T=>({id:T,name:T})),M=c&&w&&Object.entries(w).map(([T,b])=>({id:T,name:b.name}))||a.map(T=>({id:T,name:T}));if(d!=="status_code"&&d!=="status_code_grouped"&&(v.sort((T,b)=>y.indexOf(T.id)-y.indexOf(b.id)),M.sort((T,b)=>y.indexOf(T.id)-y.indexOf(b.id))),!v||!M)return{labels:[],datasets:[]};const C=Qw({isMultiMetric:l,hasDimensions:c,metricNames:a,dimensionFieldNames:u,barSegmentLabels:M,pivotRecords:g,rowLabels:v,colorPalette:n.colorPalette||Be});return{labels:c?v.map(T=>e&&e.te(`chartLabels.${T.name}`)&&e.t(`chartLabels.${T.name}`)||T.name):a.map(T=>e&&e.te(`chartLabels.${T}`)&&e.t(`chartLabels.${T}`)||T),datasets:C}}}catch(s){return console.error(s),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const t1=(n,t,e=1)=>Array(Math.ceil((t-n)/e)).fill(n).map((i,s)=>i+s*e),e1=n=>{if(typeof n=="string"){const t=+n;if(t)return t;try{return yu(n).getTime()}catch(e){if(e instanceof RangeError)return 0;throw e}}return n},n1=(n,t,e,i,s)=>{const a=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),o=Math.floor((n-i)/e)*e+i,l=Math.floor((a-i)/e)*e+i+e;return t1(o,l,e)};function i1(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:a,start_ms:o,end_ms:l}=t.value.meta;if(!a)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const c=r&&Object.keys(r)||a,u=c&&c[0],d=r[u],h=r&&d&&Object.keys(d).map(D=>({id:D,name:d[D].name}))||a.map(D=>({id:D,name:D})),g=t.value.meta.granularity_ms;if(typeof g!="number"||isNaN(g)||!isFinite(g)||g===0)return console.error("Invalid step value:",g),{datasets:[],labels:[]};if(!s.length)return{datasets:[],labels:[]};const p=e1(o),y=n1(o,l,g,p,s),x=new Set,w=s!=null&&s.length?s.reduce((D,E)=>{const T=new Date(E.timestamp).valueOf(),b=E.event;for(const _ of a)x.add(_),T in D||(D[T]={}),_ in D[T]||(D[T][_]={});for(const _ of a)h.forEach(S=>{b[u]===S.id||_===S.id?(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[_])*1e3)/1e3):c.length||(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[S.id])*1e3)/1e3)});return D},{}):{},v=a.length===1?a.flatMap(D=>h.map(E=>[D,E.name])):h.map(D=>[D.name,D.name]),M={},C=[...v].map(([D,E],T)=>{const b=y.map(A=>A in w&&D in w[A]?{x:A,y:w[A][D][E]||0}:{x:A,y:0});let{colorPalette:_,fill:S}=n;J(_)&&(_=Be);const O=Array.isArray(_)?Xn(T,_):_[E]||Xn(T);return M[E]=O,{rawDimension:E,rawMetric:D,label:e&&e.te(`chartLabels.${E}`)&&e.t(`chartLabels.${E}`)||E,borderColor:O,backgroundColor:O,data:b,total:b.reduce((A,{y:F})=>A+Number(F),0),...Nx,fill:S,borderWidth:S?zx:Fx}});return C.sort((D,E)=>Number(D.total)<Number(E.total)?-1:1),{datasets:C,colorMap:M}}}catch(s){return console.error(s),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const s1=(n,t)=>{f.watch([n,t],(e,i,s)=>{const[r,a]=e;!a||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(a,r),s(()=>{var o;(o=window._AnalyticsChartDataInternal)==null||o.delete(a)}))},{immediate:!0})};function r1(){const{i18n:n}=gt.useI18n();return{translateUnit:(e,i)=>{const s=i===1,r=`chartUnits.${e}`;return e==="usd"?"":n.te(r)?n.t(r,{plural:s?"":"s"}):e}}}const gt={useBarChartOptions:Vx,useChartJSCommon:$x,useChartLegendValues:qx,useChartSelectedRange:Gw,useExploreResultToDatasets:Jw,useExploreResultToTimeDataset:i1,useDoughnutChartOptions:Kw,useLinechartOptions:Zw,useI18n:Fh,useReportChartDataForSynthetics:s1,useTranslatedUnits:r1};var Pt=(n=>(n.Hidden="hidden",n.Right="right",n.Bottom="bottom",n))(Pt||{}),Jn=(n=>(n.Hidden="hidden",n.SingleMetric="single",n.Full="full",n))(Jn||{});/*!
18
+ `):n}function ly(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:a,value:o}=r.getLabelAndValue(s);return{chart:n,label:a,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:o,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Cc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=xt(t.bodyFont),c=xt(t.titleFont),u=xt(t.footerFont),d=r.length,h=s.length,g=i.length,p=Ft(t.padding);let y=p.height,x=0,w=i.reduce((C,D)=>C+D.before.length+D.lines.length+D.after.length,0);if(w+=n.beforeBody.length+n.afterBody.length,d&&(y+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),w){const C=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;y+=g*C+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}h&&(y+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const M=function(C){x=Math.max(x,e.measureText(C).width+v)};return e.save(),e.font=c.string,dt(n.title,M),e.font=l.string,dt(n.beforeBody.concat(n.afterBody),M),v=t.displayColors?a+2+t.boxPadding:0,dt(i,C=>{dt(C.before,M),dt(C.lines,M),dt(C.after,M)}),v=0,e.font=u.string,dt(n.footer,M),e.restore(),x+=p.width,{width:x,height:y}}function cy(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function uy(n,t,e,i){const{x:s,width:r}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+r+a>t.width||n==="right"&&s-r-a<0)return!0}function dy(n,t,e,i){const{x:s,width:r}=e,{width:a,chartArea:{left:o,right:l}}=n;let c="center";return i==="center"?c=s<=(o+l)/2?"left":"right":s<=r/2?c="left":s>=a-r/2&&(c="right"),uy(c,n,t,e)&&(c="center"),c}function Pc(n,t,e){const i=e.yAlign||t.yAlign||cy(n,e);return{xAlign:e.xAlign||t.xAlign||dy(n,t,e,i),yAlign:i}}function hy(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function fy(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Oc(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:a}=n,{xAlign:o,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:g}=Je(a);let p=hy(t,o);const y=fy(t,l,c);return l==="center"?o==="left"?p+=c:o==="right"&&(p-=c):o==="left"?p-=Math.max(u,h)+s:o==="right"&&(p+=Math.max(d,g)+s),{x:Ht(p,0,i.width-t.width),y:Ht(y,0,i.height-t.height)}}function As(n,t,e){const i=Ft(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ec(n){return Te([],ze(n))}function gy(n,t,e){return tn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ac(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Rc={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Re,beforeBody:Re,beforeLabel:Re,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return J(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Re,afterBody:Re,beforeFooter:Re,footer:Re,afterFooter:Re};function te(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Rc[t].call(e,i):s}class sa extends Yt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new zr(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=gy(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=te(i,"beforeTitle",this,t),r=te(i,"title",this,t),a=te(i,"afterTitle",this,t);let o=[];return o=Te(o,ze(s)),o=Te(o,ze(r)),o=Te(o,ze(a)),o}getBeforeBody(t,e){return Ec(te(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return dt(t,r=>{const a={before:[],lines:[],after:[]},o=Ac(i,r);Te(a.before,ze(te(o,"beforeLabel",this,r))),Te(a.lines,te(o,"label",this,r)),Te(a.after,ze(te(o,"afterLabel",this,r))),s.push(a)}),s}getAfterBody(t,e){return Ec(te(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=te(i,"beforeFooter",this,t),r=te(i,"footer",this,t),a=te(i,"afterFooter",this,t);let o=[];return o=Te(o,ze(s)),o=Te(o,ze(r)),o=Te(o,ze(a)),o}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],a=[];let o=[],l,c;for(l=0,c=e.length;l<c;++l)o.push(ly(this.chart,e[l]));return t.filter&&(o=o.filter((u,d,h)=>t.filter(u,d,h,i))),t.itemSort&&(o=o.sort((u,d)=>t.itemSort(u,d,i))),dt(o,u=>{const d=Ac(t.callbacks,u);s.push(te(d,"labelColor",this,u)),r.push(te(d,"labelPointStyle",this,u)),a.push(te(d,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=o,o}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,a=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const o=Ri[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const l=this._size=Cc(this,i),c=Object.assign({},o,l),u=Pc(this.chart,i,c),d=Oc(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Je(o),{x:h,y:g}=t,{width:p,height:y}=e;let x,w,v,M,C,D;return r==="center"?(C=g+y/2,s==="left"?(x=h,w=x-a,M=C+a,D=C-a):(x=h+p,w=x+a,M=C-a,D=C+a),v=x):(s==="left"?w=h+Math.max(l,u)+a:s==="right"?w=h+p-Math.max(c,d)-a:w=this.caretX,r==="top"?(M=g,C=M-a,x=w-a,v=w+a):(M=g+y,C=M+a,x=w+a,v=w-a),D=M),{x1:x,x2:w,x3:v,y1:M,y2:C,y3:D}}drawTitle(t,e,i){const s=this.title,r=s.length;let a,o,l;if(r){const c=Vn(i.rtl,this.x,this.width);for(t.x=As(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=xt(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,l+1===r&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,r){const a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=r,u=xt(r.bodyFont),d=As(this,"left",r),h=s.x(d),g=l<u.lineHeight?(u.lineHeight-l)/2:0,p=e.y+g;if(r.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},x=s.leftForLtr(h,c)+c/2,w=p+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Er(t,y,x,w),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Er(t,y,x,w)}else{t.lineWidth=it(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const y=s.leftForLtr(h,c),x=s.leftForLtr(s.xPlus(h,1),c-2),w=Je(a.borderRadius);Object.values(w).some(v=>v!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Hn(t,{x:y,y:p,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Hn(t,{x,y:p+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:c,boxPadding:u}=i,d=xt(i.bodyFont);let h=d.lineHeight,g=0;const p=Vn(i.rtl,this.x,this.width),y=function(b){e.fillText(b,p.x(t.x+g),t.y+h/2),t.y+=h+r},x=p.textAlign(a);let w,v,M,C,D,E,T;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=As(this,x,i),e.fillStyle=i.bodyColor,dt(this.beforeBody,y),g=o&&x!=="right"?a==="center"?c/2+u:c+2+u:0,C=0,E=s.length;C<E;++C){for(w=s[C],v=this.labelTextColors[C],e.fillStyle=v,dt(w.before,y),M=w.lines,o&&M.length&&(this._drawColorBox(e,t,C,p,i),h=Math.max(d.lineHeight,l)),D=0,T=M.length;D<T;++D)y(M[D]),h=d.lineHeight;dt(w.after,y)}g=0,h=d.lineHeight,dt(this.afterBody,y),t.y-=r}drawFooter(t,e,i){const s=this.footer,r=s.length;let a,o;if(r){const l=Vn(i.rtl,this.x,this.width);for(t.x=As(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=xt(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<r;++o)e.fillText(s[o],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:r,yAlign:a}=this,{x:o,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:h,bottomLeft:g,bottomRight:p}=Je(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+d,l),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(o+c-h,l),e.quadraticCurveTo(o+c,l,o+c,l+h),a==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(o+c,l+u-p),e.quadraticCurveTo(o+c,l+u,o+c-p,l+u),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(o+g,l+u),e.quadraticCurveTo(o,l+u,o,l+u-g),a==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(o,l+d),e.quadraticCurveTo(o,l,o+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const a=Ri[t.position].call(this,this._active,this._eventPosition);if(!a)return;const o=this._size=Cc(this,t),l=Object.assign({},a,this._size),c=Pc(e,t,l),u=Oc(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Ft(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),fl(t,e.textDirection),r.y+=a.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),gl(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:o,index:l})=>{const c=this.chart.getDatasetMeta(o);if(!c)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:c.data[l],index:l}}),r=!rs(i,s),a=this._positionChanged(s,e);(r||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],a=this._getActiveElements(t,r,e,i),o=this._positionChanged(a,t),l=e||!rs(a,r)||o;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(o=>this.chart.data.datasets[o.datasetIndex]&&this.chart.getDatasetMeta(o.datasetIndex).controller.getParsed(o.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,a=Ri[r.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}}P(sa,"positioners",Ri);var Rs={id:"tooltip",_element:sa,positioners:Ri,afterInit(n,t,e){e&&(n.tooltip=new sa({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Rc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},py=Object.freeze({__proto__:null,Colors:Cm,Decimation:Am,Filler:Qm,Legend:sy,SubTitle:oy,Title:ay,Tooltip:Rs});const my=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function yy(n,t,e,i){const s=n.indexOf(t);if(s===-1)return my(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const by=(n,t)=>n===null?null:Ht(Math.round(n),0,t);function Lc(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class ra extends Mn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(J(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:yy(i,t,K(e,t),this._addedLabels),by(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Lc.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}P(ra,"id","category"),P(ra,"defaults",{ticks:{callback:Lc}});function xy(n,t){const e=[],{bounds:s,step:r,min:a,max:o,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=n,g=r||1,p=u-1,{min:y,max:x}=t,w=!J(a),v=!J(o),M=!J(c),C=(x-y)/(d+1);let D=zo((x-y)/p/g)*g,E,T,b,_;if(D<1e-14&&!w&&!v)return[{value:y},{value:x}];_=Math.ceil(x/D)-Math.floor(y/D),_>p&&(D=zo(_*D/p/g)*g),J(l)||(E=Math.pow(10,l),D=Math.ceil(D*E)/E),s==="ticks"?(T=Math.floor(y/D)*D,b=Math.ceil(x/D)*D):(T=y,b=x),w&&v&&r&&mf((o-a)/r,D/1e3)?(_=Math.round(Math.min((o-a)/D,u)),D=(o-a)/_,T=a,b=o):M?(T=w?a:T,b=v?o:b,_=c-1,D=(b-T)/_):(_=(b-T)/D,fi(_,Math.round(_),D/1e3)?_=Math.round(_):_=Math.ceil(_));const S=Math.max(Ho(D),Ho(T));E=Math.pow(10,J(l)?S:l),T=Math.round(T*E)/E,b=Math.round(b*E)/E;let O=0;for(w&&(h&&T!==a?(e.push({value:a}),T<a&&O++,fi(Math.round((T+O*D)*E)/E,a,Ic(a,C,n))&&O++):T<a&&O++);O<_;++O){const A=Math.round((T+O*D)*E)/E;if(v&&A>o)break;e.push({value:A})}return v&&h&&b!==o?e.length&&fi(e[e.length-1].value,o,Ic(o,C,n))?e[e.length-1].value=o:e.push({value:o}):(!v||b===o)&&e.push({value:b}),e}function Ic(n,t,{horizontal:e,minRotation:i}){const s=Nt(i),r=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/r,a)}class Ls extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return J(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const a=l=>s=e?s:l,o=l=>r=i?r:l;if(t){const l=Se(s),c=Se(r);l<0&&c<0?o(0):l>0&&c>0&&a(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);o(r+l),t||a(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,a=xy(s,r);return t.bounds==="ticks"&&Bo(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return mi(t,this.chart.options.locale,this.options.ticks.format)}}class aa extends Ls{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?t:0,this.max=kt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Nt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}P(aa,"id","linear"),P(aa,"defaults",{ticks:{callback:ds.formatters.numeric}});const Li=n=>Math.floor(Ze(n)),Sn=(n,t)=>Math.pow(10,Li(n)+t);function Nc(n){return n/Math.pow(10,Li(n))===1}function Fc(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function _y(n,t){const e=t-n;let i=Li(e);for(;Fc(n,t,i)>10;)i++;for(;Fc(n,t,i)<10;)i--;return Math.min(i,Li(n))}function wy(n,{min:t,max:e}){t=ce(n.min,t);const i=[],s=Li(t);let r=_y(t,e),a=r<0?Math.pow(10,Math.abs(r)):1;const o=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,u=Math.floor((t-l)/o/10)*o*10;let d=Math.floor((c-u)/Math.pow(10,r)),h=ce(n.min,Math.round((l+u+d*Math.pow(10,r))*a)/a);for(;h<e;)i.push({value:h,major:Nc(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(r++,d=2,a=r>=0?1:a),h=Math.round((l+u+d*Math.pow(10,r))*a)/a;const g=ce(n.max,h);return i.push({value:g,major:Nc(g),significand:d}),i}class oa extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Ls.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return kt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=kt(t)?Math.max(0,t):null,this.max=kt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!kt(this._userMin)&&(this.min=t===Sn(this.min,0)?Sn(this.min,-1):Sn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=o=>i=t?i:o,a=o=>s=e?s:o;i===s&&(i<=0?(r(1),a(10)):(r(Sn(i,-1)),a(Sn(s,1)))),i<=0&&r(Sn(s,-1)),s<=0&&a(Sn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=wy(e,this);return t.bounds==="ticks"&&Bo(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":mi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ze(t),this._valueRange=Ze(this.max)-Ze(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ze(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}P(oa,"id","logarithmic"),P(oa,"defaults",{ticks:{callback:ds.formatters.logarithmic,major:{enabled:!0}}});function la(n){const t=n.ticks;if(t.display&&n.display){const e=Ft(t.backdropPadding);return K(t.font&&t.font.size,Dt.font.size)+e.height}return 0}function vy(n,t,e){return e=ot(e)?e:[e],{w:Rf(n,t.string,e),h:e.length*t.lineHeight}}function zc(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function ky(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,a=n.options.pointLabels,o=a.centerPointLabels?rt/r:0;for(let l=0;l<r;l++){const c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;const u=n.getPointPosition(l,n.drawingArea+s[l],o),d=xt(c.font),h=vy(n.ctx,d,n._pointLabels[l]);i[l]=h;const g=ue(n.getIndexAngle(l)+o),p=Math.round(cs(g)),y=zc(p,u.x,h.w,0,180),x=zc(p,u.y,h.h,90,270);My(e,t,g,y,x)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=Ty(n,i,s)}function My(n,t,e,i,s){const r=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let o=0,l=0;i.start<t.l?(o=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-o)):i.end>t.r&&(o=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+o)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Sy(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:a,size:o}=e,l=n.getPointPosition(t,i+s+a,r),c=Math.round(cs(ue(l.angle+bt))),u=Oy(l.y,o.h,c),d=Cy(c),h=Py(l.x,o.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+o.w,bottom:u+o.h}}function Dy(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Ne({x:e,y:i},t)||Ne({x:e,y:r},t)||Ne({x:s,y:i},t)||Ne({x:s,y:r},t))}function Ty(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:a,display:o}=r.pointLabels,l={extra:la(r)/2,additionalAngle:a?rt/s:0};let c;for(let u=0;u<s;u++){l.padding=e[u],l.size=t[u];const d=Sy(n,u,l);i.push(d),o==="auto"&&(d.visible=Dy(d,c),d.visible&&(c=d))}return i}function Cy(n){return n===0||n===180?"center":n<180?"left":"right"}function Py(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function Oy(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Ey(n,t,e){const{left:i,top:s,right:r,bottom:a}=e,{backdropColor:o}=t;if(!J(o)){const l=Je(t.borderRadius),c=Ft(t.backdropPadding);n.fillStyle=o;const u=i-c.left,d=s-c.top,h=r-i+c.width,g=a-s+c.height;Object.values(l).some(p=>p!==0)?(n.beginPath(),Hn(n,{x:u,y:d,w:h,h:g,radius:l}),n.fill()):n.fillRect(u,d,h,g)}}function Ay(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const a=i.setContext(n.getPointLabelContext(s));Ey(e,a,r);const o=xt(a.font),{x:l,y:c,textAlign:u}=r;_n(e,n._pointLabels[s],l,c+o.lineHeight/2,o,{color:a.color,textAlign:u,textBaseline:"middle"})}}function Bc(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,yt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let a=1;a<i;a++)r=n.getPointPosition(a,t),s.lineTo(r.x,r.y)}}function Ry(n,t,e,i,s){const r=n.ctx,a=t.circular,{color:o,lineWidth:l}=t;!a&&!i||!o||!l||e<0||(r.save(),r.strokeStyle=o,r.lineWidth=l,r.setLineDash(s.dash),r.lineDashOffset=s.dashOffset,r.beginPath(),Bc(n,e,a,i),r.closePath(),r.stroke(),r.restore())}function Ly(n,t,e){return tn(n,{label:e,index:t,type:"pointLabel"})}class Ii extends Ls{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ft(la(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=kt(t)&&!isNaN(t)?t:0,this.max=kt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/la(this.options))}generateTickLabels(t){Ls.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ut(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?ky(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=yt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ue(t*e+Nt(i))}getDistanceFromCenterForValue(t){if(J(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(J(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Ly(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-bt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Bc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:r}=e,a=this._pointLabels.length;let o,l,c;if(e.pointLabels.display&&Ay(this,a),s.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),g=s.setContext(h),p=r.setContext(h);Ry(this,g,l,a,p)}}),i.display){for(t.save(),o=a-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(o,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=xt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,a=t.measureText(o.label).width,t.fillStyle=c.backdropColor;const d=Ft(c.backdropPadding);t.fillRect(-a/2-d.left,-r-u.size/2-d.top,a+d.width,u.size+d.height)}_n(t,o.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}P(Ii,"id","radialLinear"),P(Ii,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ds.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),P(Ii,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),P(Ii,"descriptors",{angleLines:{_fallback:"grid"}});const Is={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ee=Object.keys(Is);function Hc(n,t){return n-t}function Wc(n,t){if(J(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),kt(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Qe(r)||r===!0)?e.startOf(a,"isoWeek",r):e.startOf(a,s)),+a)}function Yc(n,t,e,i){const s=ee.length;for(let r=ee.indexOf(n);r<s-1;++r){const a=Is[ee[r]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(o*a.size))<=i)return ee[r]}return ee[s-1]}function Iy(n,t,e,i,s){for(let r=ee.length-1;r>=ee.indexOf(e);r--){const a=ee[r];if(Is[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return ee[e?ee.indexOf(e):0]}function Ny(n){for(let t=ee.indexOf(n)+1,e=ee.length;t<e;++t)if(Is[ee[t]].common)return ee[t]}function Vc(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=Sr(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function Fy(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),a=t[t.length-1].value;let o,l;for(o=r;o<=a;o=+s.add(o,1,i))l=e[o],l>=0&&(t[l].major=!0);return t}function jc(n,t,e){const i=[],s={},r=t.length;let a,o;for(a=0;a<r;++a)o=t[a],s[o]=a,i.push({value:o,major:!1});return r===0||!e?i:Fy(n,i,s,e)}class Ni extends Mn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Rl._date(t.adapters.date);s.init(e),hi(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Wc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:r,minDefined:a,maxDefined:o}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!o&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!a||!o)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=kt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=kt(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const r=this.min,a=this.max,o=_f(s,r,a);return this._unit=e.unit||(i.autoSkip?Yc(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Iy(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ny(this._unit),this.initOffsets(s),t.reverse&&o.reverse(),jc(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=Ht(e,0,a),i=Ht(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,a=r.unit||Yc(r.minUnit,e,i,this._getLabelCapacity(e)),o=K(s.ticks.stepSize,1),l=a==="week"?r.isoWeekday:!1,c=Qe(l)||l===!0,u={};let d=e,h,g;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+a);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(h=d,g=0;h<i;h=+t.add(h,o,a),g++)Vc(u,h,p);return(h===i||s.bounds==="ticks"||g===1)&&Vc(u,h,p),Object.keys(u).sort(Hc).map(y=>+y)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,a=e||s[r];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){const r=this.options,a=r.ticks.callback;if(a)return ut(a,[t,e,i],this);const o=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&o[l],d=c&&o[c],h=i[e],g=c&&d&&h&&h.major;return this._adapter.format(t,s||(g?d:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Nt(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),a=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*r+o*a,h:i*a+o*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,jc(this,[t],this._majorUnit),s),a=this._getLabelSize(r),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Wc(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return jo(t.sort(Hc))}}P(Ni,"id","time"),P(Ni,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ns(n,t,e){let i=0,s=n.length-1,r,a,o,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ie(n,"pos",t)),{pos:r,time:o}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ie(n,"time",t)),{time:r,pos:o}=n[i],{time:a,pos:l}=n[s]);const c=a-r;return c?o+(l-o)*(t-r)/c:o}class ca extends Ni{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ns(e,this.min),this._tableRange=Ns(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let a,o,l,c,u;for(a=0,o=t.length;a<o;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=s.length;a<o;++a)u=s[a+1],l=s[a-1],c=s[a],Math.round((u+l)/2)!==c&&r.push({time:c,pos:a/(o-1)});return r}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,r)=>s-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ns(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ns(this._table,i*this._tableRange+this._minPos,!0)}}P(ca,"id","timeseries"),P(ca,"defaults",Ni.defaults);var zy=Object.freeze({__proto__:null,CategoryScale:ra,LinearScale:aa,LogarithmicScale:oa,RadialLinearScale:Ii,TimeScale:Ni,TimeSeriesScale:ca});const By=[Xg,vm,py,zy],Hy=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Wy=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Yy=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Vy=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],$c=(n,t,e)=>{let i=n;return typeof t=="string"||Array.isArray(t)?i=n.toLocaleString(t,e):(t===!0||e!==void 0)&&(i=n.toLocaleString(void 0,e)),i};function ua(n,t){if(!Number.isFinite(n))throw new TypeError(`Expected a finite number, got ${typeof n}: ${n}`);t={bits:!1,binary:!1,space:!0,...t};const e=t.bits?t.binary?Vy:Yy:t.binary?Wy:Hy,i=t.space?" ":"";if(t.signed&&n===0)return` 0${i}${e[0]}`;const s=n<0,r=s?"-":t.signed?"+":"";s&&(n=-n);let a;if(t.minimumFractionDigits!==void 0&&(a={minimumFractionDigits:t.minimumFractionDigits}),t.maximumFractionDigits!==void 0&&(a={maximumFractionDigits:t.maximumFractionDigits,...a}),n<1){const u=$c(n,t.locale,a);return r+u+i+e[0]}const o=Math.min(Math.floor(t.binary?Math.log(n)/Math.log(1024):Math.log10(n)/3),e.length-1);n/=(t.binary?1024:1e3)**o,a||(n=n.toPrecision(3));const l=$c(Number(n),t.locale,a),c=e[o];return r+l+i+c}const qc=6048e5,jy=864e5,Fi=6e4,$n=36e5,$y=1e3,Uc=Symbol.for("constructDateFrom");function Ot(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Uc in n?n[Uc](t):n instanceof Date?new n.constructor(t):new Date(t)}function tt(n,t){return Ot(t||n,n)}function Fs(n,t,e){const i=tt(n,e==null?void 0:e.in);return isNaN(t)?Ot((e==null?void 0:e.in)||n,NaN):(t&&i.setDate(i.getDate()+t),i)}function da(n,t,e){const i=tt(n,e==null?void 0:e.in);if(isNaN(t))return Ot(n,NaN);if(!t)return i;const s=i.getDate(),r=Ot(n,i.getTime());r.setMonth(i.getMonth()+t+1,0);const a=r.getDate();return s>=a?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}function ha(n,t,e){return Ot(n,+tt(n)+t)}function qy(n,t,e){return ha(n,t*$n)}let Uy={};function Dn(){return Uy}function Ce(n,t){var o,l,c,u;const e=Dn(),i=(t==null?void 0:t.weekStartsOn)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,s=tt(n,t==null?void 0:t.in),r=s.getDay(),a=(r<i?7:0)+r-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function qn(n,t){return Ce(n,{...t,weekStartsOn:1})}function Xc(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getFullYear(),s=Ot(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const r=qn(s),a=Ot(e,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const o=qn(a);return e.getTime()>=r.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function zs(n){const t=tt(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function Tn(n,...t){const e=Ot.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function fa(n,t){const e=tt(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function Gc(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=fa(i),a=fa(s),o=+r-zs(r),l=+a-zs(a);return Math.round((o-l)/jy)}function Xy(n,t){const e=Xc(n,t),i=Ot(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),qn(i)}function Gy(n,t,e){const i=tt(n,e==null?void 0:e.in);return i.setTime(i.getTime()+t*Fi),i}function Ky(n,t,e){return da(n,t*3,e)}function Zy(n,t,e){return ha(n,t*1e3)}function Qy(n,t,e){return Fs(n,t*7,e)}function Jy(n,t,e){return da(n,t*12,e)}function zi(n,t){const e=+tt(n)-+tt(t);return e<0?-1:e>0?1:e}function tb(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function ga(n){return!(!tb(n)&&typeof n!="number"||isNaN(+tt(n)))}function eb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=i.getFullYear()-s.getFullYear(),a=i.getMonth()-s.getMonth();return r*12+a}function nb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t);return i.getFullYear()-s.getFullYear()}function Kc(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=Zc(i,s),a=Math.abs(Gc(i,s));i.setDate(i.getDate()-r*a);const o=+(Zc(i,s)===-r),l=r*(a-o);return l===0?0:l}function Zc(n,t){const e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Bi(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function ib(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=(+i-+s)/$n;return Bi(e==null?void 0:e.roundingMethod)(r)}function pa(n,t){return+tt(n)-+tt(t)}function sb(n,t,e){const i=pa(n,t)/Fi;return Bi(e==null?void 0:e.roundingMethod)(i)}function Qc(n,t){const e=tt(n,t==null?void 0:t.in);return e.setHours(23,59,59,999),e}function Jc(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}function rb(n,t){const e=tt(n,t==null?void 0:t.in);return+Qc(e,t)==+Jc(e,t)}function tu(n,t,e){const[i,s,r]=Tn(e==null?void 0:e.in,n,n,t),a=zi(s,r),o=Math.abs(eb(s,r));if(o<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*o);let l=zi(s,r)===-a;rb(i)&&o===1&&zi(i,r)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function ab(n,t,e){const i=tu(n,t,e)/3;return Bi(e==null?void 0:e.roundingMethod)(i)}function ob(n,t,e){const i=pa(n,t)/1e3;return Bi(e==null?void 0:e.roundingMethod)(i)}function lb(n,t,e){const i=Kc(n,t,e)/7;return Bi(e==null?void 0:e.roundingMethod)(i)}function cb(n,t,e){const[i,s]=Tn(e==null?void 0:e.in,n,t),r=zi(i,s),a=Math.abs(nb(i,s));i.setFullYear(1584),s.setFullYear(1584);const o=zi(i,s)===-r,l=r*(a-+o);return l===0?0:l}function ub(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth(),s=i-i%3;return e.setMonth(s,1),e.setHours(0,0,0,0),e}function db(n,t){const e=tt(n,t==null?void 0:t.in);return e.setDate(1),e.setHours(0,0,0,0),e}function hb(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getFullYear();return e.setFullYear(i+1,0,0),e.setHours(23,59,59,999),e}function eu(n,t){const e=tt(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}function fb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMinutes(59,59,999),e}function gb(n,t){var o,l;const e=Dn(),i=e.weekStartsOn??((l=(o=e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??0,s=tt(n,t==null?void 0:t.in),r=s.getDay(),a=(r<i?-7:0)+6-(r-i);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function pb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setSeconds(59,999),e}function mb(n,t){const e=tt(n,t==null?void 0:t.in),i=e.getMonth(),s=i-i%3+3;return e.setMonth(s,0),e.setHours(23,59,59,999),e}function yb(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMilliseconds(999),e}const bb={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},xb=(n,t,e)=>{let i;const s=bb[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function ma(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const _b={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wb={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vb={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kb={date:ma({formats:_b,defaultWidth:"full"}),time:ma({formats:wb,defaultWidth:"full"}),dateTime:ma({formats:vb,defaultWidth:"full"})},Mb={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Sb=(n,t,e,i)=>Mb[n];function Hi(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):a;s=n.formattingValues[o]||n.formattingValues[a]}else{const a=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[o]||n.values[a]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const Db={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Tb={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Cb={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pb={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ob={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Eb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ab={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:Hi({values:Db,defaultWidth:"wide"}),quarter:Hi({values:Tb,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Hi({values:Cb,defaultWidth:"wide"}),day:Hi({values:Pb,defaultWidth:"wide"}),dayPeriod:Hi({values:Ob,defaultWidth:"wide",formattingValues:Eb,defaultFormattingWidth:"wide"})};function Wi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const a=r[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?Lb(o,d=>d.test(a)):Rb(o,d=>d.test(a));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function Rb(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Lb(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Ib(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let a=n.valueCallback?n.valueCallback(r[0]):r[0];a=e.valueCallback?e.valueCallback(a):a;const o=t.slice(s.length);return{value:a,rest:o}}}const Nb=/^(\d+)(th|st|nd|rd)?/i,Fb=/\d+/i,zb={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Bb={any:[/^b/i,/^(a|c)/i]},Hb={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Wb={any:[/1/i,/2/i,/3/i,/4/i]},Yb={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Vb={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},jb={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},$b={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},qb={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ub={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Xb={ordinalNumber:Ib({matchPattern:Nb,parsePattern:Fb,valueCallback:n=>parseInt(n,10)}),era:Wi({matchPatterns:zb,defaultMatchWidth:"wide",parsePatterns:Bb,defaultParseWidth:"any"}),quarter:Wi({matchPatterns:Hb,defaultMatchWidth:"wide",parsePatterns:Wb,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Wi({matchPatterns:Yb,defaultMatchWidth:"wide",parsePatterns:Vb,defaultParseWidth:"any"}),day:Wi({matchPatterns:jb,defaultMatchWidth:"wide",parsePatterns:$b,defaultParseWidth:"any"}),dayPeriod:Wi({matchPatterns:qb,defaultMatchWidth:"any",parsePatterns:Ub,defaultParseWidth:"any"})},nu={code:"en-US",formatDistance:xb,formatLong:kb,formatRelative:Sb,localize:Ab,match:Xb,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gb(n,t){const e=tt(n,t==null?void 0:t.in);return Gc(e,eu(e))+1}function iu(n,t){const e=tt(n,t==null?void 0:t.in),i=+qn(e)-+Xy(e);return Math.round(i/qc)+1}function ya(n,t){var u,d,h,g;const e=tt(n,t==null?void 0:t.in),i=e.getFullYear(),s=Dn(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(h=s.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,a=Ot((t==null?void 0:t.in)||n,0);a.setFullYear(i+1,0,r),a.setHours(0,0,0,0);const o=Ce(a,t),l=Ot((t==null?void 0:t.in)||n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=Ce(l,t);return+e>=+o?i+1:+e>=+c?i:i-1}function Kb(n,t){var o,l,c,u;const e=Dn(),i=(t==null?void 0:t.firstWeekContainsDate)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,s=ya(n,t),r=Ot((t==null?void 0:t.in)||n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),Ce(r,t)}function su(n,t){const e=tt(n,t==null?void 0:t.in),i=+Ce(e,t)-+Kb(e,t);return Math.round(i/qc)+1}function ht(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const an={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ht(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ht(e+1,2)},d(n,t){return ht(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ht(n.getHours()%12||12,t.length)},H(n,t){return ht(n.getHours(),t.length)},m(n,t){return ht(n.getMinutes(),t.length)},s(n,t){return ht(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ht(s,t.length)}},Un={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ru={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return an.y(n,t)},Y:function(n,t,e,i){const s=ya(n,i),r=s>0?s:1-s;if(t==="YY"){const a=r%100;return ht(a,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ht(r,t.length)},R:function(n,t){const e=Xc(n);return ht(e,t.length)},u:function(n,t){const e=n.getFullYear();return ht(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return an.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=su(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(n,t,e){const i=iu(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):an.d(n,t)},D:function(n,t,e){const i=Gb(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ht(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ht(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=Un.noon:i===0?s=Un.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=Un.evening:i>=12?s=Un.afternoon:i>=4?s=Un.morning:s=Un.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return an.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):an.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):an.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):an.s(n,t)},S:function(n,t){return an.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return ou(i);case"XXXX":case"XX":return Cn(i);case"XXXXX":case"XXX":default:return Cn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return ou(i);case"xxxx":case"xx":return Cn(i);case"xxxxx":case"xxx":default:return Cn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+au(i,":");case"OOOO":default:return"GMT"+Cn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+au(i,":");case"zzzz":default:return"GMT"+Cn(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return ht(i,t.length)},T:function(n,t,e){return ht(+n,t.length)}};function au(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ht(r,2)}function ou(n,t){return n%60===0?(n>0?"-":"+")+ht(Math.abs(n)/60,2):Cn(n,t)}function Cn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ht(Math.trunc(i/60),2),r=ht(i%60,2);return e+s+t+r}const lu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},cu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ba={p:cu,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return lu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",lu(i,t)).replace("{{time}}",cu(s,t))}},Zb=/^D+$/,Qb=/^Y+$/,Jb=["D","DD","YY","YYYY"];function uu(n){return Zb.test(n)}function du(n){return Qb.test(n)}function xa(n,t,e){const i=t0(n,t,e);if(console.warn(i),Jb.includes(n))throw new RangeError(i)}function t0(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const e0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,n0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,i0=/^'([^]*?)'?$/,s0=/''/g,r0=/[a-zA-Z]/;function hu(n,t,e){var u,d,h,g,p,y,x,w;const i=Dn(),s=(e==null?void 0:e.locale)??i.locale??nu,r=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((g=(h=i.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,a=(e==null?void 0:e.weekStartsOn)??((y=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((w=(x=i.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,o=tt(n,e==null?void 0:e.in);if(!ga(o))throw new RangeError("Invalid time value");let l=t.match(n0).map(v=>{const M=v[0];if(M==="p"||M==="P"){const C=ba[M];return C(v,s.formatLong)}return v}).join("").match(e0).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:a0(v)};if(ru[M])return{isToken:!0,value:v};if(M.match(r0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(l=s.localize.preprocessor(o,l));const c={firstWeekContainsDate:r,weekStartsOn:a,locale:s};return l.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&du(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&uu(M))&&xa(M,t,String(n));const C=ru[M[0]];return C(o,M,s.localize,c)}).join("")}function a0(n){const t=n.match(i0);return t?t[1].replace(s0,"'"):n}function o0(){return Object.assign({},Dn())}function l0(n,t){const e=tt(n,t==null?void 0:t.in).getDay();return e===0?7:e}function c0(n,t){const e=u0(t)?new t(0):Ot(t,0);return e.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),e.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e}function u0(n){var t;return typeof n=="function"&&((t=n.prototype)==null?void 0:t.constructor)===n}const d0=10;class fu{constructor(){P(this,"subPriority",0)}validate(t,e){return!0}}class h0 extends fu{constructor(t,e,i,s,r){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=s,r&&(this.subPriority=r)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class f0 extends fu{constructor(e,i){super();P(this,"priority",d0);P(this,"subPriority",-1);this.context=e||(s=>Ot(i,s))}set(e,i){return i.timestampIsSet?e:Ot(e,c0(e,this.context))}}class lt{run(t,e,i,s){const r=this.parse(t,e,i,s);return r?{setter:new h0(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(t,e,i){return!0}}class g0 extends lt{constructor(){super(...arguments);P(this,"priority",140);P(this,"incompatibleTokens",["R","u","t","T"])}parse(e,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"});case"GGGGG":return s.era(e,{width:"narrow"});case"GGGG":default:return s.era(e,{width:"wide"})||s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"})}}set(e,i,s){return i.era=s,e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}const Lt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pe={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function It(n,t){return n&&{value:t(n.value),rest:n.rest}}function Tt(n,t){const e=t.match(n);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function Oe(n,t){const e=t.match(n);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const i=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,a=e[5]?parseInt(e[5],10):0;return{value:i*(s*$n+r*Fi+a*$y),rest:t.slice(e[0].length)}}function gu(n){return Tt(Lt.anyDigitsSigned,n)}function Et(n,t){switch(n){case 1:return Tt(Lt.singleDigit,t);case 2:return Tt(Lt.twoDigits,t);case 3:return Tt(Lt.threeDigits,t);case 4:return Tt(Lt.fourDigits,t);default:return Tt(new RegExp("^\\d{1,"+n+"}"),t)}}function Bs(n,t){switch(n){case 1:return Tt(Lt.singleDigitSigned,t);case 2:return Tt(Lt.twoDigitsSigned,t);case 3:return Tt(Lt.threeDigitsSigned,t);case 4:return Tt(Lt.fourDigitsSigned,t);default:return Tt(new RegExp("^-?\\d{1,"+n+"}"),t)}}function _a(n){switch(n){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function pu(n,t){const e=t>0,i=e?t:1-t;let s;if(i<=50)s=n||100;else{const r=i+50,a=Math.trunc(r/100)*100,o=n>=r%100;s=n+a-(o?100:0)}return e?s:1-s}function mu(n){return n%400===0||n%4===0&&n%100!==0}class p0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,i,s){const r=a=>({year:a,isTwoDigitYear:i==="yy"});switch(i){case"y":return It(Et(4,e),r);case"yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s){const r=e.getFullYear();if(s.isTwoDigitYear){const o=pu(s.year,r);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const a=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}}class m0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,i,s){const r=a=>({year:a,isTwoDigitYear:i==="YY"});switch(i){case"Y":return It(Et(4,e),r);case"Yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s,r){const a=ya(e,r);if(s.isTwoDigitYear){const l=pu(s.year,a);return e.setFullYear(l,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}const o=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(o,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}}class y0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,i){return Bs(i==="R"?4:i.length,e)}set(e,i,s){const r=Ot(e,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),qn(r)}}class b0 extends lt{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,i){return Bs(i==="u"?4:i.length,e)}set(e,i,s){return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class x0 extends lt{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"Q":case"QQ":return Et(i.length,e);case"Qo":return s.ordinalNumber(e,{unit:"quarter"});case"QQQ":return s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(e,{width:"wide",context:"formatting"})||s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class _0 extends lt{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"q":case"qq":return Et(i.length,e);case"qo":return s.ordinalNumber(e,{unit:"quarter"});case"qqq":return s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(e,{width:"wide",context:"standalone"})||s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class w0 extends lt{constructor(){super(...arguments);P(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);P(this,"priority",110)}parse(e,i,s){const r=a=>a-1;switch(i){case"M":return It(Tt(Lt.month,e),r);case"MM":return It(Et(2,e),r);case"Mo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"MMM":return s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(e,{width:"wide",context:"formatting"})||s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}class v0 extends lt{constructor(){super(...arguments);P(this,"priority",110);P(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,i,s){const r=a=>a-1;switch(i){case"L":return It(Tt(Lt.month,e),r);case"LL":return It(Et(2,e),r);case"Lo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"LLL":return s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(e,{width:"wide",context:"standalone"})||s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}function k0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=su(i,e)-t;return i.setDate(i.getDate()-s*7),tt(i,e==null?void 0:e.in)}class M0 extends lt{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,i,s){switch(i){case"w":return Tt(Lt.week,e);case"wo":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s,r){return Ce(k0(e,s,r),r)}}function S0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=iu(i,e)-t;return i.setDate(i.getDate()-s*7),i}class D0 extends lt{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,i,s){switch(i){case"I":return Tt(Lt.week,e);case"Io":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s){return qn(S0(e,s))}}const T0=[31,28,31,30,31,30,31,31,30,31,30,31],C0=[31,29,31,30,31,30,31,31,30,31,30,31];class P0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"subPriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"d":return Tt(Lt.date,e);case"do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear(),r=mu(s),a=e.getMonth();return r?i>=1&&i<=C0[a]:i>=1&&i<=T0[a]}set(e,i,s){return e.setDate(s),e.setHours(0,0,0,0),e}}class O0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"subpriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,i,s){switch(i){case"D":case"DD":return Tt(Lt.dayOfYear,e);case"Do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear();return mu(s)?i>=1&&i<=366:i>=1&&i<=365}set(e,i,s){return e.setMonth(0,s),e.setHours(0,0,0,0),e}}function wa(n,t,e){var d,h,g,p;const i=Dn(),s=(e==null?void 0:e.weekStartsOn)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??i.weekStartsOn??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.weekStartsOn)??0,r=tt(n,e==null?void 0:e.in),a=r.getDay(),l=(t%7+7)%7,c=7-s,u=t<0||t>6?t-(a+c)%7:(l+c)%7-(a+c)%7;return Fs(r,u,e)}class E0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}class A0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,i,s,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"e":case"ee":return It(Et(i.length,e),a);case"eo":return It(s.ordinalNumber(e,{unit:"day"}),a);case"eee":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeeee":return s.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}class R0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,i,s,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"c":case"cc":return It(Et(i.length,e),a);case"co":return It(s.ordinalNumber(e,{unit:"day"}),a);case"ccc":return s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"ccccc":return s.day(e,{width:"narrow",context:"standalone"});case"cccccc":return s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(e,{width:"wide",context:"standalone"})||s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wa(e,s,r),e.setHours(0,0,0,0),e}}function L0(n,t,e){const i=tt(n,e==null?void 0:e.in),s=l0(i,e),r=t-s;return Fs(i,r,e)}class I0 extends lt{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,i,s){const r=a=>a===0?7:a;switch(i){case"i":case"ii":return Et(i.length,e);case"io":return s.ordinalNumber(e,{unit:"day"});case"iii":return It(s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return It(s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return It(s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiii":default:return It(s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,i){return i>=1&&i<=7}set(e,i,s){return e=L0(e,s),e.setHours(0,0,0,0),e}}class N0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class F0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class z0 extends lt{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","b","t","T"])}parse(e,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_a(s),0,0,0),e}}class B0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,i,s){switch(i){case"h":return Tt(Lt.hour12h,e);case"ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=12}set(e,i,s){const r=e.getHours()>=12;return r&&s<12?e.setHours(s+12,0,0,0):!r&&s===12?e.setHours(0,0,0,0):e.setHours(s,0,0,0),e}}class H0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,i,s){switch(i){case"H":return Tt(Lt.hour23h,e);case"Ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=23}set(e,i,s){return e.setHours(s,0,0,0),e}}class W0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,i,s){switch(i){case"K":return Tt(Lt.hour11h,e);case"Ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.getHours()>=12&&s<12?e.setHours(s+12,0,0,0):e.setHours(s,0,0,0),e}}class Y0 extends lt{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,i,s){switch(i){case"k":return Tt(Lt.hour24h,e);case"ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=24}set(e,i,s){const r=s<=24?s%24:s;return e.setHours(r,0,0,0),e}}class V0 extends lt{constructor(){super(...arguments);P(this,"priority",60);P(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"m":return Tt(Lt.minute,e);case"mo":return s.ordinalNumber(e,{unit:"minute"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setMinutes(s,0,0),e}}class j0 extends lt{constructor(){super(...arguments);P(this,"priority",50);P(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"s":return Tt(Lt.second,e);case"so":return s.ordinalNumber(e,{unit:"second"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setSeconds(s,0),e}}class $0 extends lt{constructor(){super(...arguments);P(this,"priority",30);P(this,"incompatibleTokens",["t","T"])}parse(e,i){const s=r=>Math.trunc(r*Math.pow(10,-i.length+3));return It(Et(i.length,e),s)}set(e,i,s){return e.setMilliseconds(s),e}}class q0 extends lt{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","x"])}parse(e,i){switch(i){case"X":return Oe(Pe.basicOptionalMinutes,e);case"XX":return Oe(Pe.basic,e);case"XXXX":return Oe(Pe.basicOptionalSeconds,e);case"XXXXX":return Oe(Pe.extendedOptionalSeconds,e);case"XXX":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:Ot(e,e.getTime()-zs(e)-s)}}class U0 extends lt{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","X"])}parse(e,i){switch(i){case"x":return Oe(Pe.basicOptionalMinutes,e);case"xx":return Oe(Pe.basic,e);case"xxxx":return Oe(Pe.basicOptionalSeconds,e);case"xxxxx":return Oe(Pe.extendedOptionalSeconds,e);case"xxx":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:Ot(e,e.getTime()-zs(e)-s)}}class X0 extends lt{constructor(){super(...arguments);P(this,"priority",40);P(this,"incompatibleTokens","*")}parse(e){return gu(e)}set(e,i,s){return[Ot(e,s*1e3),{timestampIsSet:!0}]}}class G0 extends lt{constructor(){super(...arguments);P(this,"priority",20);P(this,"incompatibleTokens","*")}parse(e){return gu(e)}set(e,i,s){return[Ot(e,s),{timestampIsSet:!0}]}}const K0={G:new g0,y:new p0,Y:new m0,R:new y0,u:new b0,Q:new x0,q:new _0,M:new w0,L:new v0,w:new M0,I:new D0,d:new P0,D:new O0,E:new E0,e:new A0,c:new R0,i:new I0,a:new N0,b:new F0,B:new z0,h:new B0,H:new H0,K:new W0,k:new Y0,m:new V0,s:new j0,S:new $0,X:new q0,x:new U0,t:new X0,T:new G0},Z0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Q0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,J0=/^'([^]*?)'?$/,tx=/''/g,ex=/\S/,nx=/[a-zA-Z]/;function ix(n,t,e,i){var x,w,v,M,C,D,E,T;const s=()=>Ot((i==null?void 0:i.in)||e,NaN),r=o0(),a=(i==null?void 0:i.locale)??r.locale??nu,o=(i==null?void 0:i.firstWeekContainsDate)??((w=(x=i==null?void 0:i.locale)==null?void 0:x.options)==null?void 0:w.firstWeekContainsDate)??r.firstWeekContainsDate??((M=(v=r.locale)==null?void 0:v.options)==null?void 0:M.firstWeekContainsDate)??1,l=(i==null?void 0:i.weekStartsOn)??((D=(C=i==null?void 0:i.locale)==null?void 0:C.options)==null?void 0:D.weekStartsOn)??r.weekStartsOn??((T=(E=r.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(!t)return n?s():tt(e,i==null?void 0:i.in);const c={firstWeekContainsDate:o,weekStartsOn:l,locale:a},u=[new f0(i==null?void 0:i.in,e)],d=t.match(Q0).map(b=>{const _=b[0];if(_ in ba){const S=ba[_];return S(b,a.formatLong)}return b}).join("").match(Z0),h=[];for(let b of d){!(i!=null&&i.useAdditionalWeekYearTokens)&&du(b)&&xa(b,t,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&uu(b)&&xa(b,t,n);const _=b[0],S=K0[_];if(S){const{incompatibleTokens:O}=S;if(Array.isArray(O)){const F=h.find(j=>O.includes(j.token)||j.token===_);if(F)throw new RangeError(`The format string mustn't contain \`${F.fullToken}\` and \`${b}\` at the same time`)}else if(S.incompatibleTokens==="*"&&h.length>0)throw new RangeError(`The format string mustn't contain \`${b}\` and any other token at the same time`);h.push({token:_,fullToken:b});const A=S.run(n,b,a.match,c);if(!A)return s();u.push(A.setter),n=A.rest}else{if(_.match(nx))throw new RangeError("Format string contains an unescaped latin alphabet character `"+_+"`");if(b==="''"?b="'":_==="'"&&(b=sx(b)),n.indexOf(b)===0)n=n.slice(b.length);else return s()}}if(n.length>0&&ex.test(n))return s();const g=u.map(b=>b.priority).sort((b,_)=>_-b).filter((b,_,S)=>S.indexOf(b)===_).map(b=>u.filter(_=>_.priority===b).sort((_,S)=>S.subPriority-_.subPriority)).map(b=>b[0]);let p=tt(e,i==null?void 0:i.in);if(isNaN(+p))return s();const y={};for(const b of g){if(!b.validate(p,c))return s();const _=b.set(p,y,c);Array.isArray(_)?(p=_[0],Object.assign(y,_[1])):p=_}return p}function sx(n){return n.match(J0)[1].replace(tx,"'")}function rx(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMinutes(0,0,0),e}function ax(n,t){const e=tt(n,t==null?void 0:t.in);return e.setSeconds(0,0),e}function ox(n,t){const e=tt(n,t==null?void 0:t.in);return e.setMilliseconds(0),e}function lx(n){const t=n/$n;return Math.trunc(t)}function yu(n,t){const e=()=>Ot(t==null?void 0:t.in,NaN),i=(t==null?void 0:t.additionalDigits)??2,s=hx(n);let r;if(s.date){const c=fx(s.date,i);r=gx(c.restDateString,c.year)}if(!r||isNaN(+r))return e();const a=+r;let o=0,l;if(s.time&&(o=px(s.time),isNaN(o)))return e();if(s.timezone){if(l=mx(s.timezone),isNaN(l))return e()}else{const c=new Date(a+o),u=tt(0,t==null?void 0:t.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return tt(a+o+l,t==null?void 0:t.in)}const Hs={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},cx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ux=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,dx=/^([+-])(\d{2})(?::?(\d{2}))?$/;function hx(n){const t={},e=n.split(Hs.dateTimeDelimiter);let i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Hs.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Hs.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){const s=Hs.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function fx(n,t){const e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,r=i[2]?parseInt(i[2]):null;return{year:r===null?s:r*100,restDateString:n.slice((i[1]||i[2]).length)}}function gx(n,t){if(t===null)return new Date(NaN);const e=n.match(cx);if(!e)return new Date(NaN);const i=!!e[4],s=Yi(e[1]),r=Yi(e[2])-1,a=Yi(e[3]),o=Yi(e[4]),l=Yi(e[5])-1;if(i)return wx(t,o,l)?yx(t,o,l):new Date(NaN);{const c=new Date(0);return!xx(t,r,a)||!_x(t,s)?new Date(NaN):(c.setUTCFullYear(t,r,Math.max(s,a)),c)}}function Yi(n){return n?parseInt(n):1}function px(n){const t=n.match(ux);if(!t)return NaN;const e=va(t[1]),i=va(t[2]),s=va(t[3]);return vx(e,i,s)?e*$n+i*Fi+s*1e3:NaN}function va(n){return n&&parseFloat(n.replace(",","."))||0}function mx(n){if(n==="Z")return 0;const t=n.match(dx);if(!t)return 0;const e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return kx(i,s)?e*(i*$n+s*Fi):NaN}function yx(n,t,e){const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const bx=[31,null,31,30,31,30,31,31,30,31,30,31];function bu(n){return n%400===0||n%4===0&&n%100!==0}function xx(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(bx[t]||(bu(n)?29:28))}function _x(n,t){return t>=1&&t<=(bu(n)?366:365)}function wx(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function vx(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function kx(n,t){return t>=0&&t<=59}const ka=(n,t)=>{var s,r;const{tooltip:e}=t;if(e.opacity===0&&!n.locked){n.showTooltip=!1;return}const i=n.chartTooltipSortFn||((a,o)=>o.rawValue-a.rawValue);if(e.body&&!n.locked){const a=e.labelColors,o=((r=(s=t.chart.config)==null?void 0:s.options)==null?void 0:r.indexAxis)==="y"?"x":"y",l=["horizontal_bar","vertical_bar"].includes(n.chartType),c=["gauge","doughnut"].includes(n.chartType);n.tooltipContext=l?e.dataPoints.length>1?e.dataPoints[0].label:"":e.dataPoints[0].parsed.x,n.tooltipSeries=e.dataPoints.map((u,d)=>{const h=c?u.parsed:u.parsed[o];let g;if(n.units==="bytes")g=isNaN(h)?h:ua(h);else{const y=n.translateUnit(n.units,h);g=`${n.units==="usd"?"$":""}${h%1===0?Ws.format(h):Ws.format(Number(h.toFixed(_u)))} ${y}`}const p=l&&u.dataset.label!==u.label?u.dataset.label:c?u.dataset.labels[u.dataIndex]:u.dataset.label;return{backgroundColor:a[d].backgroundColor,borderColor:a[d].borderColor,label:p,value:g,rawValue:h}}).sort(i),n.left=`${e.x}px`,n.top=`${e.y}px`,n.showTooltip=!0}},Mx=n=>n&&n.datasets&&n.datasets.length,Sx=n=>Mx(n)&&n.datasets.some(t=>t.data.length),Dx=n=>Sx(n)&&n.datasets.some(t=>t.data.length>1),Tx=n=>Dx(n)&&n.datasets.some(t=>t.data[0]&&ga(t.data[0].x)),Cx=n=>Tx(n)&&n.datasets.some(t=>t.data[0]&&t.data[0].x.toString().length>=13),Ma=(n,t,e)=>{const s=Math.min(t/1150,1);return n.x<e?n.x+t*.15*(1-s):n.x-t*1.15*(1-s)},Px=(n,t,e)=>n.y<e?n.y+t*.15:n.y-t*.5;function xu(n,t){let e;return(...i)=>{clearTimeout(e),e=window.setTimeout(()=>{n(...i)},t)}}const _u=2,wu=10,vu=12,Ws=new Intl.NumberFormat(((vh=document==null?void 0:document.documentElement)==null?void 0:vh.lang)||"en-US"),Ys=10,ku={"1XXCount|1XX|1[0-9][0-9]":{solid:"#0072E5",light:"#4DA6FF",description:"Informational"},"SuccessfulRequests|2XXCount|2XX|2[0-9][0-9]|SUCCESS":{solid:"#0BB652",light:"#6FCC83",description:"Success"},"3XXCount|3XX|3[0-9][0-9]":{solid:"#FDC53B",light:"#FFD982",description:"Redirection"},"4XXCount|4XX|4[0-9][0-9]":{solid:"#FE9439",light:"#FFBA81",description:"Client Errors"},"5XXCount|5XX|5[0-9][0-9]":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},"errorCount|FailedRequests|FAILURE":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},nonStandard:{solid:"#6f7787",light:"#e7e7ec"},standard:{solid:"#1155cb",light:"#8ab3fa"},p99:{solid:"#1356cb",light:"#1356cb"},p95:{solid:"#1fbecd",light:"#1fbecd"},p50:{solid:"#1df97d",light:"#1df97d"},LatencyP99:{solid:"#1356cb",light:"#1356cb"},LatencyP95:{solid:"#1fbecd",light:"#1fbecd"},LatencyP50:{solid:"#1df97d",light:"#1df97d"}},Be=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Xn=(n,t)=>(t||Be)[n%Be.length],Mu=(n,t)=>{n[0]==="#"&&(n=n.slice(1));let e=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);e=e-t,i=i-t,s=s-t,e>255?e=255:e<0&&(e=0),i>255?i=255:i<0&&(i=0),s>255?s=255:s<0&&(s=0);const r=e.toString(16).length===1?"0"+e.toString(16):e.toString(16),a=i.toString(16).length===1?"0"+i.toString(16):i.toString(16),o=s.toString(16).length===1?"0"+s.toString(16):s.toString(16);return`#${r}${a}${o}`},Su="#6f7787",Du={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},Ox=n=>{var e;const t=Math.floor(parseInt(n,10)/100)*100;return((e=Du[t])==null?void 0:e.background)||"#fafafa"},Ex={SUCCESS:"#6FCC83",FAILURE:"#FF8484"},Ax={"4XX":"#FFBA81","5XX":"#FF8484"},Rx={LatencyP99:"#1356cb",LatencyP95:"#1fbecd",LatencyP50:"#1df97d"},Lx="#dad4c7",Ix=n=>{const t=Object.entries(ku).find(([e])=>new RegExp(e).test(n));return t&&t[1]||ku.standard},Nx={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},Fx=2,zx=0,Sa=new Map,Da=(n,t)=>t==="bytes"?ua(n):t==="count/minute"?n.toFixed(2):Ws.format(n),Tu=n=>{const e=document.createElement("canvas").getContext("2d"),i=xt({});return e.font=i.string,e.measureText(n).width},Bx=()=>{const n="label_height";if(!Sa.has(n)){const t=xt({});Sa.set(n,t.lineHeight)}return Sa.get(n)},Hx=n=>n.datasets.reduce((t,e)=>t+e.data.reduce((i,s)=>isNaN(s)?i:i+s,0),0),Cu=(n,t)=>t.datasets.reduce((e,i,s)=>n.isDatasetVisible(s)?e+i.data.reduce((r,a)=>isNaN(a)?r:r+a,0):e,0),Pu=(n,t)=>t===0?" (0.0%)":` (${(n/t*100).toFixed(1)}%)`,Ta="#e0e4ea",Wx={100:["#c8e2fd","#80bfff","#4da6ff","#1a8cff","#0072e5","#0059b2"],200:["#ceedd2","#9edca6","#89d595","#6fcc83","#44c26b","#0bb652","#0ca84a","#169643","#196e33","#1b572a"],300:["#fff4db","#ffe9b8","#ffe2a1","#ffd982","#ffd062","#fdc53b","#f4bb1e","#e8b00b","#d9a30f","#c89407"],400:["#ffead8","#ffd5b1","#ffc899","#ffba81","#ffae6b","#fe9439","#f6871d","#eb7c0c","#da700c","#cc6100"],500:["#ffd5d5","#ffb6b6","#ff9d9d","#ff8484","#ff6a6a","#ff4545","#fb1f1f","#e90b0b","#d40202","#be0202"]},Vi=(n,t)=>{let e=1;const i=Wx[n],s=new Map;for(const r of t)s.set(r,i[e]),e=e%(i.length-1)+1;return s.set(-1,i[0]),s},Ou=new Map([[100,Vi("100",[100,101,102,103])],[200,Vi("200",[200,201,202,203,204,205,206,207,208,226])],[300,Vi("300",[300,301,302,303,304,305,307,308])],[400,Vi("400",[400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,423,424,425,426,428,429,431,451])],[500,Vi("500",[500,501,502,503,504,505,506,507,508,510,511])]]),Ca=n=>{const t=parseInt(n,10),e=Math.floor(t/100)*100,i=Ou.get(e);return i===void 0?Ta:i.get(t)??i.get(-1)??Ta},Yx=n=>{const t=Ca(n);return{solid:t,light:t}},Vs={...Array.from({length:500},(n,t)=>100+t).reduce((n,t)=>(n[`${t}`]=Ca(`${t}`),n),{}),____OTHER____:"#DAD4C7","1XX":"#4DA6FF","2XX":"#6FCC83","3XX":"#FFD982","4XX":"#FFBA81","5XX":"#FF8484"};function Vx(n){const t={enabled:!1,position:"barChartTooltipPosition",callbacks:{label:s=>({label:s.dataset.label,value:s.label})}};Rs.positioners.barChartTooltipPosition=function(s,r){if(!s.length)return!1;const a=this.chart.canvas.getBoundingClientRect(),o=n.tooltipState.width||this.width,l=a.width/2,c=Ma(r,o,l),u=r.y,d=r.x<l?"left":"center";return{x:c-n.tooltipState.offsetX,y:u-n.tooltipState.offsetY,xAlign:d}},qr.modes.customInteractionMode=function(s,r){const a=en(r,s),o=[];return qr.evaluateInteractionItems(s,s.options.indexAxis||"x",a,(l,c,u)=>{s.options.indexAxis==="y"&&l.inYRange(a.y,!0)&&s.data.datasets[c].data[u]&&o.push({element:l,datasetIndex:c,index:u}),s.options.indexAxis==="x"&&l.inXRange(a.x,!0)&&s.data.datasets[c].data[u]&&o.push({element:l,datasetIndex:c,index:u})}),o};const e=n.numLabels.value>25?wu:vu;return f.computed(()=>{var s,r,a,o,l,c,u,d;return{indexAxis:n.indexAxis,skipNull:!0,scales:{x:{border:{display:!1},stacked:n.stacked.value,grid:{display:!1,drawBorder:!1},ticks:{maxRotation:90,autoSkip:!1,font:e,callback:function(h,g){const p=this;if(p.chart.options.indexAxis===p.axis){h=p.getLabelForValue(g);const y=10;return h&&h.length>y?h.slice(0,y)+"...":h}return p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="y"?!J((s=n.metricAxesTitle)==null?void 0:s.value):!J((r=n.dimensionAxesTitle)==null?void 0:r.value),text:n.indexAxis==="y"?(a=n.metricAxesTitle)==null?void 0:a.value:(o=n.dimensionAxesTitle)==null?void 0:o.value,padding:{top:10},font:{weight:"bold"}}},y:{border:{display:!1},stacked:n.stacked.value,beginAtZero:!0,grid:{display:!1,drawBorder:!1},ticks:{font:e,callback:function(h,g){const p=this;return p.chart.options.indexAxis===p.axis?(h=p.getLabelForValue(g),h&&h.length>Ys?h.slice(0,Ys)+"...":h):p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="x"?!J((l=n.metricAxesTitle)==null?void 0:l.value):!J((c=n.dimensionAxesTitle)==null?void 0:c.value),text:n.indexAxis==="x"?(u=n.metricAxesTitle)==null?void 0:u.value:(d=n.dimensionAxesTitle)==null?void 0:d.value,padding:{bottom:20},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:h=>{ka(n.tooltipState,h)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1}})}ge.register(...By);const jx=(n,t)=>{const e=t.datasets.map(s=>s.label),i=n.datasets.map(s=>s.label);return n.datasets.length===t.datasets.length&&e.every((s,r)=>s===i[r])};function $x(n,t,e,i,s){const r=f.shallowRef(null),a=(o,l)=>{if(t.value)return new ge(t.value,{type:n,data:o,plugins:i,options:l})};return f.onMounted(()=>{r.value=a(e.value,s.value)}),f.onBeforeUnmount(()=>{J(r.value)||r.value.destroy()}),f.watch(e,(o,l)=>{if(jx(l,o)&&!J(r.value)){for(const[c,u]of o.datasets.entries())Object.assign(r.value.data.datasets[c],u);r.value.data.labels=o.labels,r.value.update()}else J(r.value)||r.value.destroy(),r.value=a(o,s.value)}),f.watch(t,()=>{J(r.value)||r.value.destroy(),r.value=a(e.value,s.value)}),f.watch(s,(o,l)=>{(o.indexAxis!==l.indexAxis||JSON.stringify(o.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(o.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(J(r.value)||r.value.destroy(),r.value=a(e.value,o))}),r}var ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Eu={exports:{}};(function(n){(function(){function t(c,u){if(u.separator===!1||c<1e3)return c.toString();var d=typeof u.separator=="string"?u.separator:",",h=[],g=Math.round(c).toString().split("");return g.reverse().forEach(function(p,y){y&&y%3===0&&h.push(d),h.push(p)}),h.reverse().join("")}function e(c,u,d){var h=c/u,g=d.round?"round":"floor";return d.decimal===!1?(c=Math[g](h),c.toString()):(d.precision?c=h:c=h<10?Math[g](h*10)/10:Math[g](h),c=c.toString(),typeof d.decimal=="string"&&(c=c.replace(".",d.decimal)),c)}var i=1e3,s=1e4,r=1e6,a=1e9,o=1e12;function l(c,u){var d;u=u||{};var h=c<0;h&&(c=Math.abs(c)),u.precision&&(c=parseFloat(c.toPrecision(u.precision)));var g=u.min10k?s:i;return c<g||u.precision&&u.precision>Math.log10(c)?d=t(e(c,1,u),u):c<r?d=e(c,i,u)+"k":c<a?d=e(c,r,u)+"m":c<o?d=t(e(c,a,u),u)+"b":d=t(e(c,o,u),u)+"t",h&&(d="-"+d),u.capital&&(d=d.toUpperCase()),u.prefix&&(d=u.prefix+d),u.suffix&&(d=d+u.suffix),d}l.addCommas=t,n.exports=l})()})(Eu);var qx=Eu.exports;const ji=Pa(qx);function Ux(n,t,e){const{i18n:i}=gt.useI18n(),{translateUnit:s}=gt.useTranslatedUnits();return{legendValues:f.computed(()=>n.value.datasets.reduce((a,o)=>{const l=o.total?o.total:o.data.reduce((u,d)=>u+(typeof d=="number"?Number(d)||0:Number(d&&d.y)||0),0);let c;if(e.value==="bytes")c=isNaN(l)?"0":ua(l);else{const u=s(e.value,l);c=i&&i.t("legend.datapointValueDisplay",{value:ji(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}}),unit:u})||`${ji(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}})} ${e.value}`}return{...a,[o.label]:{raw:l,formatted:c}}},{}))}}var Xx=Object.defineProperty,Gx=(n,t,e)=>t in n?Xx(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ee=(n,t,e)=>Gx(n,typeof t!="symbol"?t+"":t,e),Ct=(n=>(n.FIFTEEN_MIN="15m",n.ONE_HOUR="1h",n.SIX_HOUR="6h",n.TWELVE_HOUR="12h",n.ONE_DAY="24h",n.SEVEN_DAY="7d",n.THIRTY_DAY="30d",n.CURRENT_WEEK="current_week",n.CURRENT_MONTH="current_month",n.CURRENT_QUARTER="current_quarter",n.PREVIOUS_WEEK="previous_week",n.PREVIOUS_MONTH="previous_month",n.PREVIOUS_QUARTER="previous_quarter",n))(Ct||{});const Kx=["secondly","minutely","hourly","daily","weekly","trend"],$i=n=>n.filter(t=>t!=="time"),Au=["api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","route","status_code","status_code_grouped","time"],Zx=$i(Au),Qx=[...Au,"application","consumer","iso_code"],Jx=$i(Qx),t_=["control_plane","control_plane_group","gateway_service","consumer","application","route","ai_provider","ai_response_model","ai_request_model","llm_cache_status","llm_embeddings_provider","llm_embeddings_model","time"],e_=$i(t_);$i(["api_product","api_product_version","application","auth_type","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","gateway_service","header_host","header_user_agent","http_method","iso_code","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_uri","upstream_status_code_grouped","websocket"]),$i(["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","request_body_size","response_body_size","response_header_content_length","status_code","upstream_status_code"]),new Set(Zx),new Set(Jx),new Set(e_);const Ru=6048e5,n_=864e5,i_=60,s_=3600,Lu=Symbol.for("constructDateFrom");function pe(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Lu in n?n[Lu](t):n instanceof Date?new n.constructor(t):new Date(t)}function Ut(n,t){return pe(t||n,n)}function Iu(n,t,e){const i=Ut(n,void 0);return isNaN(t)?pe(n,NaN):(i.setDate(i.getDate()+t),i)}function r_(n,t,e){const i=Ut(n,void 0);if(isNaN(t))return pe(n,NaN);const s=i.getDate(),r=pe(n,i.getTime());r.setMonth(i.getMonth()+t+1,0);const a=r.getDate();return s>=a?r:(i.setFullYear(r.getFullYear(),r.getMonth(),s),i)}let a_={};function js(){return a_}function He(n,t){var e,i,s,r;const a=js(),o=(t==null?void 0:t.weekStartsOn)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.weekStartsOn)??a.weekStartsOn??((r=(s=a.locale)==null?void 0:s.options)==null?void 0:r.weekStartsOn)??0,l=Ut(n,t==null?void 0:t.in),c=l.getDay(),u=(c<o?7:0)+c-o;return l.setDate(l.getDate()-u),l.setHours(0,0,0,0),l}function $s(n,t){return He(n,{...t,weekStartsOn:1})}function Nu(n,t){const e=Ut(n,void 0),i=e.getFullYear(),s=pe(e,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const r=$s(s),a=pe(e,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const o=$s(a);return e.getTime()>=r.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function Fu(n){const t=Ut(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function o_(n,...t){const e=pe.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function qs(n,t){const e=Ut(n,void 0);return e.setHours(0,0,0,0),e}function l_(n,t,e){const[i,s]=o_(void 0,n,t),r=qs(i),a=qs(s),o=+r-Fu(r),l=+a-Fu(a);return Math.round((o-l)/n_)}function c_(n,t){const e=Nu(n),i=pe(n,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),$s(i)}function u_(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function d_(n){return!(!u_(n)&&typeof n!="number"||isNaN(+Ut(n)))}function Gn(n,t){const e=Ut(n,void 0);return e.setDate(1),e.setHours(0,0,0,0),e}function h_(n,t){const e=Ut(n,void 0);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const f_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},g_=(n,t,e)=>{let i;const s=f_[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Oa(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const p_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},m_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},y_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},b_={date:Oa({formats:p_,defaultWidth:"full"}),time:Oa({formats:m_,defaultWidth:"full"}),dateTime:Oa({formats:y_,defaultWidth:"full"})},x_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},__=(n,t,e,i)=>x_[n];function qi(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):a;s=n.formattingValues[o]||n.formattingValues[a]}else{const a=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[o]||n.values[a]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const w_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},v_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},k_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},M_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},S_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},D_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},T_=(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},C_={ordinalNumber:T_,era:qi({values:w_,defaultWidth:"wide"}),quarter:qi({values:v_,defaultWidth:"wide",argumentCallback:n=>n-1}),month:qi({values:k_,defaultWidth:"wide"}),day:qi({values:M_,defaultWidth:"wide"}),dayPeriod:qi({values:S_,defaultWidth:"wide",formattingValues:D_,defaultFormattingWidth:"wide"})};function Ui(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const a=r[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?O_(o,d=>d.test(a)):P_(o,d=>d.test(a));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function P_(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function O_(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function E_(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let a=n.valueCallback?n.valueCallback(r[0]):r[0];a=e.valueCallback?e.valueCallback(a):a;const o=t.slice(s.length);return{value:a,rest:o}}}const A_=/^(\d+)(th|st|nd|rd)?/i,R_=/\d+/i,L_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},I_={any:[/^b/i,/^(a|c)/i]},N_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},F_={any:[/1/i,/2/i,/3/i,/4/i]},z_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},B_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},H_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},W_={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Y_={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},V_={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},j_={ordinalNumber:E_({matchPattern:A_,parsePattern:R_,valueCallback:n=>parseInt(n,10)}),era:Ui({matchPatterns:L_,defaultMatchWidth:"wide",parsePatterns:I_,defaultParseWidth:"any"}),quarter:Ui({matchPatterns:N_,defaultMatchWidth:"wide",parsePatterns:F_,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ui({matchPatterns:z_,defaultMatchWidth:"wide",parsePatterns:B_,defaultParseWidth:"any"}),day:Ui({matchPatterns:H_,defaultMatchWidth:"wide",parsePatterns:W_,defaultParseWidth:"any"}),dayPeriod:Ui({matchPatterns:Y_,defaultMatchWidth:"any",parsePatterns:V_,defaultParseWidth:"any"})},$_={code:"en-US",formatDistance:g_,formatLong:b_,formatRelative:__,localize:C_,match:j_,options:{weekStartsOn:0,firstWeekContainsDate:1}};function q_(n,t){const e=Ut(n,void 0);return l_(e,h_(e))+1}function U_(n,t){const e=Ut(n,void 0),i=+$s(e)-+c_(e);return Math.round(i/Ru)+1}function zu(n,t){var e,i,s,r;const a=Ut(n,t==null?void 0:t.in),o=a.getFullYear(),l=js(),c=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??l.firstWeekContainsDate??((r=(s=l.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,u=pe((t==null?void 0:t.in)||n,0);u.setFullYear(o+1,0,c),u.setHours(0,0,0,0);const d=He(u,t),h=pe((t==null?void 0:t.in)||n,0);h.setFullYear(o,0,c),h.setHours(0,0,0,0);const g=He(h,t);return+a>=+d?o+1:+a>=+g?o:o-1}function X_(n,t){var e,i,s,r;const a=js(),o=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??a.firstWeekContainsDate??((r=(s=a.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,l=zu(n,t),c=pe((t==null?void 0:t.in)||n,0);return c.setFullYear(l,0,o),c.setHours(0,0,0,0),He(c,t)}function G_(n,t){const e=Ut(n,t==null?void 0:t.in),i=+He(e,t)-+X_(e,t);return Math.round(i/Ru)+1}function ft(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const on={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ft(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ft(e+1,2)},d(n,t){return ft(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ft(n.getHours()%12||12,t.length)},H(n,t){return ft(n.getHours(),t.length)},m(n,t){return ft(n.getMinutes(),t.length)},s(n,t){return ft(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ft(s,t.length)}},Kn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Bu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return on.y(n,t)},Y:function(n,t,e,i){const s=zu(n,i),r=s>0?s:1-s;if(t==="YY"){const a=r%100;return ft(a,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ft(r,t.length)},R:function(n,t){const e=Nu(n);return ft(e,t.length)},u:function(n,t){const e=n.getFullYear();return ft(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ft(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ft(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return on.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ft(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=G_(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ft(s,t.length)},I:function(n,t,e){const i=U_(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ft(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):on.d(n,t)},D:function(n,t,e){const i=q_(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ft(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ft(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ft(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ft(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const i=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=Kn.noon:i===0?s=Kn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=Kn.evening:i>=12?s=Kn.afternoon:i>=4?s=Kn.morning:s=Kn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return on.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):on.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):on.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):on.s(n,t)},S:function(n,t){return on.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Wu(i);case"XXXX":case"XX":return Pn(i);case"XXXXX":case"XXX":default:return Pn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Wu(i);case"xxxx":case"xx":return Pn(i);case"xxxxx":case"xxx":default:return Pn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Hu(i,":");case"OOOO":default:return"GMT"+Pn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Hu(i,":");case"zzzz":default:return"GMT"+Pn(i,":")}},t:function(n,t,e){const i=Math.trunc(+n/1e3);return ft(i,t.length)},T:function(n,t,e){return ft(+n,t.length)}};function Hu(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ft(r,2)}function Wu(n,t){return n%60===0?(n>0?"-":"+")+ft(Math.abs(n)/60,2):Pn(n,t)}function Pn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ft(Math.trunc(i/60),2),r=ft(i%60,2);return e+s+t+r}const Yu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Vu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},K_=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return Yu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",Yu(i,t)).replace("{{time}}",Vu(s,t))},Z_={p:Vu,P:K_},Q_=/^D+$/,J_=/^Y+$/,tw=["D","DD","YY","YYYY"];function ew(n){return Q_.test(n)}function nw(n){return J_.test(n)}function iw(n,t,e){const i=sw(n,t,e);if(console.warn(i),tw.includes(n))throw new RangeError(i)}function sw(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const rw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ow=/^'([^]*?)'?$/,lw=/''/g,cw=/[a-zA-Z]/;function uw(n,t,e){var i,s,r,a,o,l,c,u;const d=js(),h=(e==null?void 0:e.locale)??d.locale??$_,g=(e==null?void 0:e.firstWeekContainsDate)??((s=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:s.firstWeekContainsDate)??d.firstWeekContainsDate??((a=(r=d.locale)==null?void 0:r.options)==null?void 0:a.firstWeekContainsDate)??1,p=(e==null?void 0:e.weekStartsOn)??((l=(o=e==null?void 0:e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((u=(c=d.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,y=Ut(n,e==null?void 0:e.in);if(!d_(y))throw new RangeError("Invalid time value");let x=t.match(aw).map(v=>{const M=v[0];if(M==="p"||M==="P"){const C=Z_[M];return C(v,h.formatLong)}return v}).join("").match(rw).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:dw(v)};if(Bu[M])return{isToken:!0,value:v};if(M.match(cw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});h.localize.preprocessor&&(x=h.localize.preprocessor(y,x));const w={firstWeekContainsDate:g,weekStartsOn:p,locale:h};return x.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&nw(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&ew(M))&&iw(M,t,String(n));const C=Bu[M[0]];return C(y,M,h.localize,w)}).join("")}function dw(n){const t=n.match(ow);return t?t[1].replace(lw,"'"):n}function hw(n,t){const e=Ut(n,void 0),i=e.getFullYear(),s=e.getMonth(),r=pe(e,0);return r.setFullYear(i,s+1,0),r.setHours(0,0,0,0),r.getDate()}function fw(n){return Math.trunc(n*s_)}function gw(n){const t=n/i_;return Math.trunc(t)}function ju(n,t,e){return r_(n,-t)}function $u(n,t,e){const i=yw(n,e.timeZone,e.locale);return"formatToParts"in i?pw(i,t):mw(i,t)}function pw(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function mw(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function yw(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function bw(n,t){const e=vw(t);return"formatToParts"in e?_w(e,n):ww(e,n)}const xw={year:0,month:1,day:2,hour:3,minute:4,second:5};function _w(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=xw[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function ww(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Ea={};function vw(n){if(!Ea[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";Ea[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Ea[n]}function Aa(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const qu=36e5,kw=6e4,Ra={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Xi(n,t,e){if(!n)return 0;let i=Ra.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=Ra.timezoneHH.exec(n),i)return s=parseInt(i[1],10),Uu(s)?-(s*qu):NaN;if(i=Ra.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Uu(s,a)?(r=Math.abs(s)*qu+a*kw,i[1]==="+"?-r:r):NaN}if(Dw(n)){t=new Date(t||Date.now());const a=e?t:Mw(t),o=La(a,n);return-(e?o:Sw(t,o,n))}return NaN}function Mw(n){return Aa(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function La(n,t){const e=bw(n,t),i=Aa(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function Sw(n,t,e){let i=n.getTime()-t;const s=La(new Date(i),e);if(t===s)return t;i-=s-t;const r=La(new Date(i),e);return s===r?s:Math.max(s,r)}function Uu(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const Xu={};function Dw(n){if(Xu[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Xu[n]=!0,!0}catch{return!1}}const Tw=60*1e3,Cw={X:function(n,t,e){const i=Ia(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return Gu(i);case"XXXX":case"XX":return Zn(i);case"XXXXX":case"XXX":default:return Zn(i,":")}},x:function(n,t,e){const i=Ia(e.timeZone,n);switch(t){case"x":return Gu(i);case"xxxx":case"xx":return Zn(i);case"xxxxx":case"xxx":default:return Zn(i,":")}},O:function(n,t,e){const i=Ia(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+Pw(i,":");case"OOOO":default:return"GMT"+Zn(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return $u("short",n,e);case"zzzz":default:return $u("long",n,e)}}};function Ia(n,t){const e=n?Xi(n,t,!0)/Tw:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function Us(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function Zn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Us(Math.floor(i/60),2),r=Us(Math.floor(i%60),2);return e+s+t+r}function Gu(n,t){return n%60===0?(n>0?"-":"+")+Us(Math.abs(n)/60,2):Zn(n,t)}function Pw(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+Us(r,2)}function Ku(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const Zu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Na=36e5,Qu=6e4,Ow=2,Xt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Zu};function Xs(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?Ow:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=Ew(n),{year:s,restDateString:r}=Aw(i.date,e),a=Rw(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=Lw(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Xi(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=Ku(new Date(o+l)),c=Ku(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function Ew(n){const t={};let e=Xt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Xt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Xt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function Aw(n,t){if(n){const e=Xt.YYY[t],i=Xt.YYYYY[t];let s=Xt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Xt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function Rw(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Xt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,ed(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Xt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return Fw(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Xt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return ed(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Xt.Www.exec(n),r)return s=parseInt(r[1],10)-1,nd(s)?Ju(t,s):new Date(NaN);if(r=Xt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return nd(s,a)?Ju(t,s,a):new Date(NaN)}return null}function Lw(n){let t,e,i=Xt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),Fa(t)?t%24*Na:NaN;if(i=Xt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),Fa(t,e)?t%24*Na+e*Qu:NaN;if(i=Xt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Fa(t,e,s)?t%24*Na+e*Qu+s*1e3:NaN}return null}function Ju(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const Iw=[31,28,31,30,31,30,31,31,30,31,30,31],Nw=[31,29,31,30,31,30,31,31,30,31,30,31];function td(n){return n%400===0||n%4===0&&n%100!==0}function ed(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=td(n);if(i&&e>Nw[t]||!i&&e>Iw[t])return!1}return!0}function Fw(n,t){if(t<1)return!1;const e=td(n);return!(e&&t>366||!e&&t>365)}function nd(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function Fa(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const zw=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Bw(n,t,e={}){t=String(t);const i=t.match(zw);if(i){const s=Xs(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+Cw[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return uw(n,t,e)}function id(n,t,e){n=Xs(n,e);const i=Xi(t,n,!0),s=new Date(n.getTime()-i),r=new Date(0);return r.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),r.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),r}function Hw(n,t,e,i){return i={...i,timeZone:t,originalDate:n},Bw(id(n,t,{timeZone:i.timeZone}),e,i)}function Ww(n,t,e){if(typeof n=="string"&&!n.match(Zu))return Xs(n,{...e,timeZone:t});n=Xs(n,e);const i=Aa(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),s=Xi(t,new Date(i));return new Date(i+s)}function Yw(n,t){return-Xi(n,t)}function za(n,t={}){if(!n)return n;const e=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(n);return Hw(s,e,i)}catch{return console.error("Invalid value passed to formatTime",n),"(invalid date)"}}const Vw={secondly:1e3,minutely:60*1e3,hourly:60*60*1e3,daily:60*60*24*1e3,weekly:60*60*24*7*1e3,trend:0};function Ba(n){return n&&Kx.find(t=>n<=Vw[t])||null}const Qn=(n,t)=>new Date(n.getTime()-Yw(t,n));class we{constructor(t){Ee(this,"timeframeText"),Ee(this,"key"),Ee(this,"display"),Ee(this,"timeframeLength"),Ee(this,"allowedTiers"),Ee(this,"defaultResponseGranularity"),Ee(this,"dataGranularity"),Ee(this,"isRelative"),Ee(this,"_startCustom"),Ee(this,"_endCustom"),this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(){const t=new Set,e=this.maximumTimeframeLength()/3600;return e<=6&&t.add("minutely"),e>=2&&e<=7*24&&t.add("hourly"),e>=2*24&&t.add("daily"),e>=2*24*14&&t.add("weekly"),t}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const e=Ww(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return id(e,t)}}class jw extends we{rawStart(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Qn(e,t)),e}maximumTimeframeLength(){return 60*60*24*7}}class $w extends we{rawStart(t){let e=Gn(this.tzAdjustedDate(t));return t&&(e=Qn(e,t)),e}maximumTimeframeLength(){return 60*60*24*31}}class qw extends we{rawEnd(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Qn(e,t)),e}rawStart(t){const e=this.tzAdjustedDate(t);let i=He(e.setDate(e.getDate()-7),{weekStartsOn:1});return t&&(i=Qn(i,t)),i}}class Uw extends we{rawEnd(t){let e=Gn(this.tzAdjustedDate(t));return t&&(e=Qn(e,t)),e}rawStart(t){let e=Gn(ju(this.tzAdjustedDate(t),1));return t&&(e=Qn(e,t)),e}}Ct.FIFTEEN_MIN,new we({key:Ct.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>60*15,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.ONE_HOUR,new we({key:Ct.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>60*60*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.SIX_HOUR,new we({key:Ct.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>60*60*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.TWELVE_HOUR,new we({key:Ct.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>60*60*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.ONE_DAY,new we({key:Ct.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>60*60*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Ct.SEVEN_DAY,new we({key:Ct.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Ct.THIRTY_DAY,new we({key:Ct.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>60*60*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Ct.CURRENT_WEEK,new jw({key:Ct.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const n=He(new Date,{weekStartsOn:1});return(qs(Iu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.CURRENT_MONTH,new $w({key:Ct.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const n=Gn(new Date);return(qs(Iu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.PREVIOUS_WEEK,new qw({key:Ct.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Ct.PREVIOUS_MONTH,new Uw({key:Ct.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let n=0;const t=Gn(new Date),e=Gn(ju(new Date,1));return t.getTimezoneOffset()!==e.getTimezoneOffset()&&(n=Xw(t,e)),60*60*24*hw(new Date().setMonth(new Date().getMonth()-1))+fw(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function Xw(n,t){return gw(n.getTimezoneOffset()-t.getTimezoneOffset())}function Gw(n){return f.computed(()=>{var s;if(!((s=n.value)!=null&&s.meta))return"";const e=n.value.meta.start_ms,i=n.value.meta.end_ms;return e&&i?`${za(e)} - ${za(i,{includeTZ:!0})}`:""})}function Kw(n){const t={enabled:!1,position:"doughnutChartTooltipPosition",callbacks:{label:i=>({label:i.dataset.label,value:i.label})}};return Rs.positioners.doughnutChartTooltipPosition=function(i,s){if(!i.length)return!1;const r=this.chart.canvas.getBoundingClientRect(),a=n.tooltipState.width||this.width,o=r.width/2,l=Ma(s,a,o),c=s.y,u=s.x<o?"left":"center";return{x:l-n.tooltipState.offsetX,y:c,xAlign:u}},{options:f.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:i=>{ka(n.tooltipState,i)}}}}))}}function Zw(n){const t=f.computed(()=>{var l,c;return{type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:10,autoSkipPadding:100,source:"auto",maxRotation:0},title:{display:!J((l=n.dimensionAxesTitle)==null?void 0:l.value),text:(c=n.dimensionAxesTitle)==null?void 0:c.value,padding:{top:2},font:{weight:"bold"}}}}),e=f.computed(()=>{var l,c;return{title:{display:!J((l=n.metricAxesTitle)==null?void 0:l.value),text:(c=n.metricAxesTitle)==null?void 0:c.value,padding:{bottom:10},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0}}),i={enabled:!1,position:"lineChartTooltipPosition"};Rs.positioners.lineChartTooltipPosition=function(l,c){if(!l.length||n.tooltipState.locked)return!1;const u=this.chart.canvas.getBoundingClientRect(),d=n.tooltipState.width||this.width,h=n.tooltipState.height||this.height,g=u.width/2,p=u.height/2,y=Ma(c,d,g);let x=Px(c,h,p);const w=c.y<p?"top":"bottom",v=c.x<g?"left":"center";return h>u.height&&(x=0),{x:y,y:x,xAlign:v,yAlign:w}};const s=f.computed(()=>{switch(n.granularity.value){case"minutely":return"minute";case"hourly":return"hour";case"daily":return"day";default:return"day"}}),r=f.computed(()=>lx(Number(n.timeRangeMs.value))>=24?"yyyy-MM-dd h:mm":"h:mm"),a=f.computed(()=>["daily","weekly"].includes(n.granularity.value)?"yyyy-MM-dd":"yyyy-MM-dd h:mm");return{options:f.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:{border:{display:!1},...t.value,stacked:n.stacked.value,time:{tooltipFormat:"h:mm:ss a",unit:s.value,displayFormats:{minute:"h:mm:ss a",hour:r.value,day:a.value}}},y:{border:{display:!1},...e.value,stacked:n.stacked.value}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},streaming:!1,tooltip:{...i,external:l=>{ka(n.tooltipState,l)}}},interaction:{mode:"index",intersect:!1}}))}}function Qw(n){const{isMultiMetric:t,hasDimensions:e,metricNames:i,barSegmentLabels:s,pivotRecords:r,rowLabels:a,colorPalette:o}=n,{i18n:l}=gt.useI18n();return t?i.map(u=>({label:l&&l.te(`chartLabels.${u}`)&&l.t(`chartLabels.${u}`)||u,backgroundColor:Xn(i.indexOf(u),Be),data:a.map((d,h)=>e?r[`${d.id},${u}`]||0:r[`${h},${u}`]||null)})):Array.from(s).flatMap((u,d)=>{if(!u)return[];const h={},g=Array.isArray(o)?Xn(d,o):o[u.name]||Xn(d);return h[u.name]=g,{label:l&&l.te(`chartLabels.${u.name}`)&&l.t(`chartLabels.${u.name}`)||u.name,backgroundColor:g,data:a.map(p=>r[`${p.id},${u.id}`]||null)}})}function Jw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:a}=t.value.meta,o=r&&Object.keys(r),l=a&&a.length>1,c=r&&o&&o.length>0;if(!s.length||!a)return{datasets:[],labels:[]};const u=c&&o||a,d=u[0],h=u.length>1?u[1]:u[0],g=Object.fromEntries(l?s.flatMap(T=>a.map((b,_)=>{const S=T.event[d],O=c?`${S},${b}`:`${_},${b}`,A=T.event[b];return[O,A]})):s.map(T=>{const b=c?`${T.event[d]},${T.event[h]}`:`${d},${h}`,_=T.event[a[0]];return[b,_]})),p=Object.keys(g).reduce((T,b)=>{const[_]=b.split(","),S=g[b];return T[_]?T[_]+=S:T[_]=S,T},{}),y=Object.entries(p).sort(([,T],[,b])=>Number(b)-Number(T)).map(([T])=>T),x=r[d],w=r[h],v=c&&x&&Object.entries(x).map(([T,b])=>({id:T,name:b.name}))||a.map(T=>({id:T,name:T})),M=c&&w&&Object.entries(w).map(([T,b])=>({id:T,name:b.name}))||a.map(T=>({id:T,name:T}));if(d!=="status_code"&&d!=="status_code_grouped"&&(v.sort((T,b)=>y.indexOf(T.id)-y.indexOf(b.id)),M.sort((T,b)=>y.indexOf(T.id)-y.indexOf(b.id))),!v||!M)return{labels:[],datasets:[]};const C=Qw({isMultiMetric:l,hasDimensions:c,metricNames:a,dimensionFieldNames:u,barSegmentLabels:M,pivotRecords:g,rowLabels:v,colorPalette:n.colorPalette||Be});return{labels:c?v.map(T=>e&&e.te(`chartLabels.${T.name}`)&&e.t(`chartLabels.${T.name}`)||T.name):a.map(T=>e&&e.te(`chartLabels.${T}`)&&e.t(`chartLabels.${T}`)||T),datasets:C}}}catch(s){return console.error(s),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const t1=(n,t,e=1)=>Array(Math.ceil((t-n)/e)).fill(n).map((i,s)=>i+s*e),e1=n=>{if(typeof n=="string"){const t=+n;if(t)return t;try{return yu(n).getTime()}catch(e){if(e instanceof RangeError)return 0;throw e}}return n},n1=(n,t,e,i,s)=>{const a=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),o=Math.floor((n-i)/e)*e+i,l=Math.floor((a-i)/e)*e+i+e;return t1(o,l,e)};function i1(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:a,start_ms:o,end_ms:l}=t.value.meta;if(!a)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const c=r&&Object.keys(r)||a,u=c&&c[0],d=r[u],h=r&&d&&Object.keys(d).map(D=>({id:D,name:d[D].name}))||a.map(D=>({id:D,name:D})),g=t.value.meta.granularity_ms;if(typeof g!="number"||isNaN(g)||!isFinite(g)||g===0)return console.error("Invalid step value:",g),{datasets:[],labels:[]};if(!s.length)return{datasets:[],labels:[]};const p=e1(o),y=n1(o,l,g,p,s),x=new Set,w=s!=null&&s.length?s.reduce((D,E)=>{const T=new Date(E.timestamp).valueOf(),b=E.event;for(const _ of a)x.add(_),T in D||(D[T]={}),_ in D[T]||(D[T][_]={});for(const _ of a)h.forEach(S=>{b[u]===S.id||_===S.id?(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[_])*1e3)/1e3):c.length||(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[S.id])*1e3)/1e3)});return D},{}):{},v=a.length===1?a.flatMap(D=>h.map(E=>[D,E.name])):h.map(D=>[D.name,D.name]),M={},C=[...v].map(([D,E],T)=>{const b=y.map(A=>A in w&&D in w[A]?{x:A,y:w[A][D][E]||0}:{x:A,y:0});let{colorPalette:_,fill:S}=n;J(_)&&(_=Be);const O=Array.isArray(_)?Xn(T,_):_[E]||Xn(T);return M[E]=O,{rawDimension:E,rawMetric:D,label:e&&e.te(`chartLabels.${E}`)&&e.t(`chartLabels.${E}`)||E,borderColor:O,backgroundColor:O,data:b,total:b.reduce((A,{y:F})=>A+Number(F),0),...Nx,fill:S,borderWidth:S?zx:Fx}});return C.sort((D,E)=>Number(D.total)<Number(E.total)?-1:1),{datasets:C,colorMap:M}}}catch(s){return console.error(s),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const s1=(n,t)=>{f.watch([n,t],(e,i,s)=>{const[r,a]=e;!a||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(a,r),s(()=>{var o;(o=window._AnalyticsChartDataInternal)==null||o.delete(a)}))},{immediate:!0})};function r1(){const{i18n:n}=gt.useI18n();return{translateUnit:(e,i)=>{const s=i===1,r=`chartUnits.${e}`;return e==="usd"?"":n.te(r)?n.t(r,{plural:s?"":"s"}):e}}}const gt={useBarChartOptions:Vx,useChartJSCommon:$x,useChartLegendValues:Ux,useChartSelectedRange:Gw,useExploreResultToDatasets:Jw,useExploreResultToTimeDataset:i1,useDoughnutChartOptions:Kw,useLinechartOptions:Zw,useI18n:Fh,useReportChartDataForSynthetics:s1,useTranslatedUnits:r1};var Pt=(n=>(n.Hidden="hidden",n.Right="right",n.Bottom="bottom",n))(Pt||{}),Jn=(n=>(n.Hidden="hidden",n.SingleMetric="single",n.Full="full",n))(Jn||{});/*!
19
19
  * chartjs-plugin-annotation v3.0.1
20
20
  * https://www.chartjs.org/chartjs-plugin-annotation/index
21
21
  * (c) 2023 chartjs-plugin-annotation Contributors
22
22
  * Released under the MIT License
23
- */const sd={modes:{point(n,t){return Gs(n,t,{intersect:!0})},nearest(n,t,e){return l1(n,t,e)},x(n,t,e){return Gs(n,t,{intersect:e.intersect,axis:"x"})},y(n,t,e){return Gs(n,t,{intersect:e.intersect,axis:"y"})}}};function Ha(n,t,e){return(sd.modes[e.mode]||sd.modes.nearest)(n,t,e)}function a1(n,t,e){return e!=="x"&&e!=="y"?n.inRange(t.x,t.y,"x",!0)||n.inRange(t.x,t.y,"y",!0):n.inRange(t.x,t.y,e,!0)}function o1(n,t,e){return e==="x"?{x:n.x,y:t.y}:e==="y"?{x:t.x,y:n.y}:t}function Gs(n,t,e){return n.visibleElements.filter(i=>e.intersect?i.inRange(t.x,t.y):a1(i,t,e.axis))}function l1(n,t,e){let i=Number.POSITIVE_INFINITY;return Gs(n,t,e).reduce((s,r)=>{const a=r.getCenterPoint(),o=o1(t,a,e.axis),l=Bn(t,o);return l<i?(s=[r],i=l):l===i&&s.push(r),s},[]).sort((s,r)=>s._index-r._index).slice(0,1)}const c1=(n,t)=>t>n||n.length>t.length&&n.slice(0,t.length)===t,On=.001,Ks=(n,t,e)=>Math.min(e,Math.max(t,n));function u1(n,t,e){for(const i of Object.keys(n))n[i]=Ks(n[i],t,e);return n}function d1(n,t,e,i){if(!n||!t||e<=0)return!1;const s=i/2;return Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<=Math.pow(e+s,2)}function rd(n,{x:t,y:e,x2:i,y2:s},r,a){const o=a/2,l=n.x>=t-o-On&&n.x<=i+o+On,c=n.y>=e-o-On&&n.y<=s+o+On;return r==="x"?l:(r==="y"||l)&&c}function ti(n,t){const{centerX:e,centerY:i}=n.getProps(["centerX","centerY"],t);return{x:e,y:i}}function h1(n,t,e,i=!0){const s=e.split(".");let r=0;for(const a of t.split(".")){const o=s[r++];if(parseInt(a,10)<parseInt(o,10))break;if(c1(o,a)){if(i)throw new Error(`${n} v${e} is not supported. v${t} or newer is required.`);return!1}}return!0}const ad=n=>typeof n=="string"&&n.endsWith("%"),od=n=>parseFloat(n)/100,ld=n=>Ks(od(n),0,1),Zs=(n,t)=>({x:n,y:t,x2:n,y2:t,width:0,height:0}),f1={box:n=>Zs(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>Zs(n.centerX,n.centerY),line:n=>Zs(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>Zs(n.centerX,n.centerY)};function Wa(n,t){return t==="start"?0:t==="end"?n:ad(t)?ld(t)*n:n/2}function ln(n,t,e=!0){return typeof t=="number"?t:ad(t)?(e?ld(t):od(t))*n:n}function g1(n,t){const{x:e,width:i}=n,s=t.textAlign;return s==="center"?e+i/2:s==="end"||s==="right"?e+i:e}function Ya(n,t="center"){return it(n)?{x:K(n.x,t),y:K(n.y,t)}:(n=K(n,t),{x:n,y:n})}function cd(n){return n&&(Qt(n.xValue)||Qt(n.yValue))}function Gi(n,t,e){const i=e.init;if(i){if(i===!0)return dd(t,e)}else return;return p1(n,t,e)}function ud(n,t,e){let i=!1;return t.forEach(s=>{Jt(n[s])?(i=!0,e[s]=n[s]):Qt(e[s])&&delete e[s]}),i}function dd(n,t){const e=t.type||"line";return f1[e](n)}function p1(n,t,e){const i=ut(e.init,[{chart:n,properties:t,options:e}]);if(i===!0)return dd(t,e);if(it(i))return i}const Va=new Map,m1=n=>isNaN(n)||n<=0,y1=n=>n.reduce(function(t,e){return t+=e.string,t},"");function Qs(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function ja(n,{x:t,y:e},i){i&&(n.translate(t,e),n.rotate(Nt(i)),n.translate(-t,-e))}function cn(n,t){if(t&&t.borderWidth)return n.lineCap=t.borderCapStyle,n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.lineJoin=t.borderJoinStyle,n.lineWidth=t.borderWidth,n.strokeStyle=t.borderColor,!0}function ei(n,t){n.shadowColor=t.backgroundShadowColor,n.shadowBlur=t.shadowBlur,n.shadowOffsetX=t.shadowOffsetX,n.shadowOffsetY=t.shadowOffsetY}function $a(n,t){const e=t.content;if(Qs(e))return{width:ln(e.width,t.width),height:ln(e.height,t.height)};const i=t.font,s=ot(i)?i.map(l=>xt(l)):[xt(i)],r=t.textStrokeWidth,a=ot(e)?e:[e],o=a.join()+y1(s)+r+(n._measureText?"-spriting":"");return Va.has(o)||Va.set(o,v1(n,a,s,r)),Va.get(o)}function hd(n,t,e){const{x:i,y:s,width:r,height:a}=t;n.save(),ei(n,e);const o=cn(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),Hn(n,{x:i,y:s,w:r,h:a,radius:u1(Je(e.borderRadius),0,Math.min(r,a)/2)}),n.closePath(),n.fill(),o&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function b1(n,t,e){const i=e.content;if(Qs(i)){n.save(),n.globalAlpha=S1(e.opacity,i.style.opacity),n.drawImage(i,t.x,t.y,t.width,t.height),n.restore();return}const s=ot(i)?i:[i],r=e.font,a=ot(r)?r.map(d=>xt(d)):[xt(r)],o=e.color,l=ot(o)?o:[o],c=g1(t,e),u=t.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,x1(n,e)&&k1(n,{x:c,y:u},s,a),M1(n,{x:c,y:u},s,{fonts:a,colors:l}),n.restore()}function x1(n,t){if(t.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=t.textStrokeWidth,n.strokeStyle=t.textStrokeColor,!0}function _1(n,t,e,i){const{radius:s,options:r}=t,a=r.pointStyle,o=r.rotation;let l=(o||0)*Mr;if(Qs(a)){n.save(),n.translate(e,i),n.rotate(l),n.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),n.restore();return}m1(s)||w1(n,{x:e,y:i,radius:s,rotation:o,style:a,rad:l})}function w1(n,{x:t,y:e,radius:i,rotation:s,style:r,rad:a}){let o,l,c,u;switch(n.beginPath(),r){default:n.arc(t,e,i,0,yt),n.closePath();break;case"triangle":n.moveTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=ls,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=ls,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),n.closePath();break;case"rectRounded":u=i*.516,c=i-u,o=Math.cos(a+fe)*c,l=Math.sin(a+fe)*c,n.arc(t-o,e-l,u,a-rt,a-bt),n.arc(t+l,e-o,u,a-bt,a),n.arc(t+o,e+l,u,a,a+bt),n.arc(t-l,e+o,u,a+bt,a+rt),n.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,n.rect(t-c,e-c,2*c,2*c);break}a+=fe;case"rectRot":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+l,e-o),n.lineTo(t+o,e+l),n.lineTo(t-l,e+o),n.closePath();break;case"crossRot":a+=fe;case"cross":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"star":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o),a+=fe,o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"line":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l);break;case"dash":n.moveTo(t,e),n.lineTo(t+Math.cos(a)*i,e+Math.sin(a)*i);break}n.fill()}function v1(n,t,e,i){n.save();const s=t.length;let r=0,a=i;for(let o=0;o<s;o++){const l=e[Math.min(o,e.length-1)];n.font=l.string;const c=t[o];r=Math.max(r,n.measureText(c).width+i),a+=l.lineHeight}return n.restore(),{width:r,height:a}}function k1(n,{x:t,y:e},i,s){n.beginPath();let r=0;i.forEach(function(a,o){const l=s[Math.min(o,s.length-1)],c=l.lineHeight;n.font=l.string,n.strokeText(a,t,e+c/2+r),r+=c}),n.stroke()}function M1(n,{x:t,y:e},i,{fonts:s,colors:r}){let a=0;i.forEach(function(o,l){const c=r[Math.min(l,r.length-1)],u=s[Math.min(l,s.length-1)],d=u.lineHeight;n.beginPath(),n.font=u.string,n.fillStyle=c,n.fillText(o,t,e+d/2+a),a+=d,n.fill()})}function S1(n,t){const e=Qe(n)?n:t;return Qe(e)?Ks(e,0,1):1}const fd={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function ni(n,t,e){return t=typeof t=="number"?t:n.parse(t),kt(t)?n.getPixelForValue(t):e}function En(n,t,e){const i=t[e];if(i||e==="scaleID")return i;const s=e.charAt(0),r=Object.values(n).filter(a=>a.axis&&a.axis===s);return r.length?r[0].id:s}function gd(n,t){if(n){const e=n.options.reverse,i=ni(n,t.min,e?t.end:t.start),s=ni(n,t.max,e?t.start:t.end);return{start:i,end:s}}}function pd(n,t){const{chartArea:e,scales:i}=n,s=i[En(i,t,"xScaleID")],r=i[En(i,t,"yScaleID")];let a=e.width/2,o=e.height/2;return s&&(a=ni(s,t.xValue,s.left+s.width/2)),r&&(o=ni(r,t.yValue,r.top+r.height/2)),{x:a,y:o}}function Ua(n,t){const e=n.scales,i=e[En(e,t,"xScaleID")],s=e[En(e,t,"yScaleID")];if(!i&&!s)return{};let{left:r,right:a}=i||n.chartArea,{top:o,bottom:l}=s||n.chartArea;const c=bd(i,{min:t.xMin,max:t.xMax,start:r,end:a});r=c.start,a=c.end;const u=bd(s,{min:t.yMin,max:t.yMax,start:l,end:o});return o=u.start,l=u.end,{x:r,y:o,x2:a,y2:l,width:a-r,height:l-o,centerX:r+(a-r)/2,centerY:o+(l-o)/2}}function md(n,t){if(!cd(t)){const e=Ua(n,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(e.width,e.height)/2,t.radius=i);const s=i*2,r=e.centerX+t.xAdjust,a=e.centerY+t.yAdjust;return{x:r-i,y:a-i,x2:r+i,y2:a+i,centerX:r,centerY:a,width:s,height:s,radius:i}}return T1(n,t)}function D1(n,t){const{scales:e,chartArea:i}=n,s=e[t.scaleID],r={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?C1(s,r,t):P1(e,r,t),r}function yd(n,t){const e=Ua(n,t);return e.initProperties=Gi(n,e,t),e.elements=[{type:"label",optionScope:"label",properties:A1(n,e,t),initProperties:e.initProperties}],e}function T1(n,t){const e=pd(n,t),i=t.radius*2;return{x:e.x-t.radius+t.xAdjust,y:e.y-t.radius+t.yAdjust,x2:e.x+t.radius+t.xAdjust,y2:e.y+t.radius+t.yAdjust,centerX:e.x+t.xAdjust,centerY:e.y+t.yAdjust,radius:t.radius,width:i,height:i}}function bd(n,t){const e=gd(n,t)||t;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function C1(n,t,e){const i=ni(n,e.value,NaN),s=ni(n,e.endValue,i);n.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function P1(n,t,e){for(const i of Object.keys(fd)){const s=n[En(n,e,i)];if(s){const{min:r,max:a,start:o,end:l,startProp:c,endProp:u}=fd[i],d=gd(s,{min:e[r],max:e[a],start:s[o],end:s[l]});t[c]=d.start,t[u]=d.end}}}function O1({properties:n,options:t},e,i,s){const{x:r,x2:a,width:o}=n;return xd({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:e.width})}function E1({properties:n,options:t},e,i,s){const{y:r,y2:a,height:o}=n;return xd({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:e.height})}function xd(n,t){const{start:e,end:i,borderWidth:s}=n,{position:r,padding:{start:a,end:o},adjust:l}=t,c=i-s-e-a-o-t.size;return e+s/2+l+Wa(c,r)}function A1(n,t,e){const i=e.label;i.backgroundColor="transparent",i.callout.display=!1;const s=Ya(i.position),r=Ft(i.padding),a=$a(n.ctx,i),o=O1({properties:t,options:e},a,s,r),l=E1({properties:t,options:e},a,s,r),c=a.width+r.width,u=a.height+r.height;return{x:o,y:l,x2:o+c,y2:l+u,width:c,height:u,centerX:o+c/2,centerY:l+u/2,rotation:i.rotation}}function An(n,t,e){const i=Math.cos(e),s=Math.sin(e),r=t.x,a=t.y;return{x:r+i*(n.x-r)-s*(n.y-a),y:a+s*(n.x-r)+i*(n.y-a)}}const qa=["enter","leave"],Xa=qa.concat("click");function R1(n,t,e){t.listened=ud(e,Xa,t.listeners),t.moveListened=!1,t._getElements=Ha,qa.forEach(i=>{Jt(e[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Jt(i.click)&&(t.listened=!0),t.moveListened||qa.forEach(s=>{Jt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function L1(n,t,e){if(n.listened)switch(t.type){case"mousemove":case"mouseout":return I1(n,t,e);case"click":return N1(n,t,e)}}function I1(n,t,e){if(!n.moveListened)return;let i;t.type==="mousemove"?i=Ha(n,t,e.interaction):i=[];const s=n.hovered;n.hovered=i;const r={state:n,event:t};let a=_d(r,"leave",s,i);return _d(r,"enter",i,s)||a}function _d({state:n,event:t},e,i,s){let r;for(const a of i)s.indexOf(a)<0&&(r=wd(a.options[e]||n.listeners[e],a,t)||r);return r}function N1(n,t,e){const i=n.listeners,s=Ha(n,t,e.interaction);let r;for(const a of s)r=wd(a.options.click||i.click,a,t)||r;return r}function wd(n,t,e){return ut(n,[t.$context,e])===!0}const Js=["afterDraw","beforeDraw"];function F1(n,t,e){const i=t.visibleElements;t.hooked=ud(e,Js,t.hooks),t.hooked||i.forEach(s=>{t.hooked||Js.forEach(r=>{Jt(s.options[r])&&(t.hooked=!0)})})}function vd(n,t,e){if(n.hooked){const i=t.options[e]||n.hooks[e];return ut(i,[t.$context])}}function z1(n,t,e){const i=V1(n.scales,t,e);let s=kd(t,i,"min","suggestedMin");s=kd(t,i,"max","suggestedMax")||s,s&&Jt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function B1(n,t){for(const e of n)W1(e,t)}function kd(n,t,e,i){if(kt(t[e])&&!H1(n.options,e,i)){const s=n[e]!==t[e];return n[e]=t[e],s}}function H1(n,t,e){return Qt(n[t])||Qt(n[e])}function W1(n,t){for(const e of["scaleID","xScaleID","yScaleID"]){const i=En(t,n,e);i&&!t[i]&&Y1(n,e)&&console.warn(`No scale found with id '${i}' for annotation '${n.id}'`)}}function Y1(n,t){if(t==="scaleID")return!0;const e=t.charAt(0);for(const i of["Min","Max","Value"])if(Qt(n[e+i]))return!0;return!1}function V1(n,t,e){const i=t.axis,s=t.id,r=i+"ScaleID",a={min:K(t.min,Number.NEGATIVE_INFINITY),max:K(t.max,Number.POSITIVE_INFINITY)};for(const o of e)o.scaleID===s?Md(o,t,["value","endValue"],a):En(n,o,r)===s&&Md(o,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Md(n,t,e,i){for(const s of e){const r=n[s];if(Qt(r)){const a=t.parse(r);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class ii extends Yt{inRange(t,e,i,s){const{x:r,y:a}=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation));return rd({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options.borderWidth)}getCenterPoint(t){return ti(this,t)}draw(t){t.save(),ja(t,this.getCenterPoint(),this.options.rotation),hd(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return yd(t,e)}}ii.id="boxAnnotation",ii.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},ii.defaultRoutes={borderColor:"color",backgroundColor:"color"},ii.descriptors={label:{_fallback:!0}};const Sd=["left","bottom","top","right"];class Ki extends Yt{inRange(t,e,i,s){const{x:r,y:a}=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.rotation));return rd({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options.borderWidth)}getCenterPoint(t){return ti(this,t)}draw(t){const e=this.options,i=!Qt(this._visible)||this._visible;!e.display||!e.content||!i||(t.save(),ja(t,this.getCenterPoint(),this.rotation),$1(t,this),hd(t,this,e),b1(t,Q1(this),e),t.restore())}resolveElementProperties(t,e){let i;if(cd(e))i=pd(t,e);else{const{centerX:o,centerY:l}=Ua(t,e);i={x:o,y:l}}const s=Ft(e.padding),r=$a(t.ctx,e),a=j1(i,r,e,s);return{initProperties:Gi(t,a,e),pointX:i.x,pointY:i.y,...a,rotation:e.rotation}}}Ki.id="labelAnnotation",Ki.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Ki.defaultRoutes={borderColor:"color"};function j1(n,t,e,i){const s=t.width+i.width+e.borderWidth,r=t.height+i.height+e.borderWidth,a=Ya(e.position,"center"),o=Dd(n.x,s,e.xAdjust,a.x),l=Dd(n.y,r,e.yAdjust,a.y);return{x:o,y:l,x2:o+s,y2:l+r,width:s,height:r,centerX:o+s/2,centerY:l+r/2}}function Dd(n,t,e=0,i){return n-Wa(t,i)+e}function $1(n,t){const{pointX:e,pointY:i,options:s}=t,r=s.callout,a=r&&r.display&&K1(t,r);if(!a||J1(t,r,a))return;if(n.save(),n.beginPath(),!cn(n,r))return n.restore();const{separatorStart:l,separatorEnd:c}=U1(t,a),{sideStart:u,sideEnd:d}=X1(t,a,l);(r.margin>0||s.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(c.x,c.y)),n.moveTo(u.x,u.y),n.lineTo(d.x,d.y);const h=An({x:e,y:i},t.getCenterPoint(),Nt(-t.rotation));n.lineTo(h.x,h.y),n.stroke(),n.restore()}function U1(n,t){const{x:e,y:i,x2:s,y2:r}=n,a=q1(n,t);let o,l;return t==="left"||t==="right"?(o={x:e+a,y:i},l={x:o.x,y:r}):(o={x:e,y:i+a},l={x:s,y:o.y}),{separatorStart:o,separatorEnd:l}}function q1(n,t){const{width:e,height:i,options:s}=n,r=s.callout.margin+s.borderWidth/2;return t==="right"?e+r:t==="bottom"?i+r:-r}function X1(n,t,e){const{y:i,width:s,height:r,options:a}=n,o=a.callout.start,l=G1(t,a.callout);let c,u;return t==="left"||t==="right"?(c={x:e.x,y:i+ln(r,o)},u={x:c.x+l,y:c.y}):(c={x:e.x+ln(s,o),y:e.y},u={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:u}}function G1(n,t){const e=t.side;return n==="left"||n==="top"?-e:e}function K1(n,t){const e=t.position;return Sd.includes(e)?e:Z1(n,t)}function Z1(n,t){const{x:e,y:i,x2:s,y2:r,width:a,height:o,pointX:l,pointY:c,centerX:u,centerY:d,rotation:h}=n,g={x:u,y:d},p=t.start,y=ln(a,p),x=ln(o,p),w=[e,e+y,e+y,s],v=[i+x,r,i,r],M=[];for(let C=0;C<4;C++){const D=An({x:w[C],y:v[C]},g,Nt(h));M.push({position:Sd[C],distance:Bn(D,{x:l,y:c})})}return M.sort((C,D)=>C.distance-D.distance)[0].position}function Q1({x:n,y:t,width:e,height:i,options:s}){const r=s.borderWidth/2,a=Ft(s.padding);return{x:n+a.left+r,y:t+a.top+r,width:e-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}function J1(n,t,e){const{pointX:i,pointY:s}=n,r=t.margin;let a=i,o=s;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?o+=r:e==="bottom"&&(o-=r),n.inRange(a,o)}const Ga=(n,t,e)=>({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}),Ka=(n,t,e)=>Ga(t,e,Math.abs((n-t.y)/(e.y-t.y))).x,Td=(n,t,e)=>Ga(t,e,Math.abs((n-t.x)/(e.x-t.x))).y,Zi=n=>n*n,tv=(n,t,{x:e,y:i,x2:s,y2:r},a)=>a==="y"?{start:Math.min(i,r),end:Math.max(i,r),value:t}:{start:Math.min(e,s),end:Math.max(e,s),value:n},Cd=(n,t,e,i)=>(1-i)*(1-i)*n+2*(1-i)*i*t+i*i*e,Za=(n,t,e,i)=>({x:Cd(n.x,t.x,e.x,i),y:Cd(n.y,t.y,e.y,i)}),Pd=(n,t,e,i)=>2*(1-i)*(t-n)+2*i*(e-t),Od=(n,t,e,i)=>-Math.atan2(Pd(n.x,t.x,e.x,i),Pd(n.y,t.y,e.y,i))+.5*rt;class Qi extends Yt{inRange(t,e,i,s){const r=this.options.borderWidth/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:e},{path:o,ctx:l}=this;if(o){cn(l,this.options);const{chart:u}=this.$context,d=t*u.currentDevicePixelRatio,h=e*u.currentDevicePixelRatio,g=l.isPointInStroke(o,d,h)||Qa(this,a,s);return l.restore(),g}const c=Zi(r);return sv(this,a,c,s)||Qa(this,a,s)}return ev(this,{mouseX:t,mouseY:e},i,{hBorderWidth:r,useFinalPosition:s})}getCenterPoint(t){return ti(this,t)}draw(t){const{x:e,y:i,x2:s,y2:r,cp:a,options:o}=this;if(t.save(),!cn(t,o))return t.restore();ei(t,o);const l=Math.sqrt(Math.pow(s-e,2)+Math.pow(r-i,2));if(o.curve&&a)return hv(t,this,a,l),t.restore();const{startOpts:c,endOpts:u,startAdjust:d,endAdjust:h}=Id(this),g=Math.atan2(r-i,s-e);t.translate(e,i),t.rotate(g),t.beginPath(),t.moveTo(0+d,0),t.lineTo(l-h,0),t.shadowColor=o.borderShadowColor,t.stroke(),Ja(t,0,d,c),Ja(t,l,-h,u),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){const i=D1(t,e),{x:s,y:r,x2:a,y2:o}=i,l=nv(i,t.chartArea),c=l?iv({x:s,y:r},{x:a,y:o},t.chartArea):{x:s,y:r,x2:a,y2:o,width:Math.abs(a-s),height:Math.abs(o-r)};if(c.centerX=(a+s)/2,c.centerY=(o+r)/2,c.initProperties=Gi(t,c,e),e.curve){const d={x:c.x,y:c.y},h={x:c.x2,y:c.y2};c.cp=dv(c,e,Bn(d,h))}const u=rv(t,c,e.label);return u._visible=l,c.elements=[{type:"label",optionScope:"label",properties:u,initProperties:c.initProperties}],c}}Qi.id="lineAnnotation";const Ed={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};Qi.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Ed),fill:!1,length:12,start:Object.assign({},Ed),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Ki.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Qi.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},Qi.defaultRoutes={borderColor:"color"};function ev(n,{mouseX:t,mouseY:e},i,{hBorderWidth:s,useFinalPosition:r}){const a=tv(t,e,n.getProps(["x","y","x2","y2"],r),i);return a.value>=a.start-s&&a.value<=a.end+s||Qa(n,{mouseX:t,mouseY:e},r,i)}function nv({x:n,y:t,x2:e,y2:i},{top:s,right:r,bottom:a,left:o}){return!(n<o&&e<o||n>r&&e>r||t<s&&i<s||t>a&&i>a)}function Ad({x:n,y:t},e,{top:i,right:s,bottom:r,left:a}){return n<a&&(t=Td(a,{x:n,y:t},e),n=a),n>s&&(t=Td(s,{x:n,y:t},e),n=s),t<i&&(n=Ka(i,{x:n,y:t},e),t=i),t>r&&(n=Ka(r,{x:n,y:t},e),t=r),{x:n,y:t}}function iv(n,t,e){const{x:i,y:s}=Ad(n,t,e),{x:r,y:a}=Ad(t,n,e);return{x:i,y:s,x2:r,y2:a,width:Math.abs(r-i),height:Math.abs(a-s)}}function sv(n,{mouseX:t,mouseY:e},i=On,s){const{x:r,y:a,x2:o,y2:l}=n.getProps(["x","y","x2","y2"],s),c=o-r,u=l-a,d=Zi(c)+Zi(u),h=d===0?-1:((t-r)*c+(e-a)*u)/d;let g,p;return h<0?(g=r,p=a):h>1?(g=o,p=l):(g=r+h*c,p=a+h*u),Zi(t-g)+Zi(e-p)<=i}function Qa(n,{mouseX:t,mouseY:e},i,s){const r=n.label;return r.options.display&&r.inRange(t,e,s,i)}function rv(n,t,e){const i=e.borderWidth,s=Ft(e.padding),r=$a(n.ctx,e),a=r.width+s.width+i,o=r.height+s.height+i;return ov(t,e,{width:a,height:o,padding:s},n.chartArea)}function av(n){const{x:t,y:e,x2:i,y2:s}=n,r=Math.atan2(s-e,i-t);return r>rt/2?r-rt:r<rt/-2?r+rt:r}function ov(n,t,e,i){const{width:s,height:r,padding:a}=e,{xAdjust:o,yAdjust:l}=t,c={x:n.x,y:n.y},u={x:n.x2,y:n.y2},d=t.rotation==="auto"?av(n):Nt(t.rotation),h=lv(s,r,d),g=cv(n,t,{labelSize:h,padding:a},i),p=n.cp?Za(c,n.cp,u,g):Ga(c,u,g),y={size:h.w,min:i.left,max:i.right,padding:a.left},x={size:h.h,min:i.top,max:i.bottom,padding:a.top},w=Ld(p.x,y)+o,v=Ld(p.y,x)+l;return{x:w-s/2,y:v-r/2,x2:w+s/2,y2:v+r/2,centerX:w,centerY:v,pointX:p.x,pointY:p.y,width:s,height:r,rotation:cs(d)}}function lv(n,t,e){const i=Math.cos(e),s=Math.sin(e);return{w:Math.abs(n*i)+Math.abs(t*s),h:Math.abs(n*s)+Math.abs(t*i)}}function cv(n,t,e,i){let s;const r=uv(n,i);return t.position==="start"?s=Rd({w:n.x2-n.x,h:n.y2-n.y},e,t,r):t.position==="end"?s=1-Rd({w:n.x-n.x2,h:n.y-n.y2},e,t,r):s=Wa(1,t.position),s}function Rd(n,t,e,i){const{labelSize:s,padding:r}=t,a=n.w*i.dx,o=n.h*i.dy,l=a>0&&(s.w/2+r.left-i.x)/a,c=o>0&&(s.h/2+r.top-i.y)/o;return Ks(Math.max(l,c),0,.25)}function uv(n,t){const{x:e,x2:i,y:s,y2:r}=n,a=Math.min(s,r)-t.top,o=Math.min(e,i)-t.left,l=t.bottom-Math.max(s,r),c=t.right-Math.max(e,i);return{x:Math.min(o,c),y:Math.min(a,l),dx:o<=c?1:-1,dy:a<=l?1:-1}}function Ld(n,t){const{size:e,min:i,max:s,padding:r}=t,a=e/2;return e>s-i?(s+i)/2:(i>=n-r-a&&(n=i+r+a),s<=n+r+a&&(n=s-r-a),n)}function Id(n){const t=n.options,e=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:e,endOpts:i,startAdjust:Nd(n,e),endAdjust:Nd(n,i)}}function Nd(n,t){if(!t||!t.display)return 0;const{length:e,width:i}=t,s=n.options.borderWidth/2,r={x:e,y:i+s};return Math.abs(Ka(0,r,{x:0,y:s}))}function Ja(n,t,e,i){if(!i||!i.display)return;const{length:s,width:r,fill:a,backgroundColor:o,borderColor:l}=i,c=Math.abs(t-s)+e;n.beginPath(),ei(n,i),cn(n,i),n.moveTo(c,-r),n.lineTo(t+e,0),n.lineTo(c,r),a===!0?(n.fillStyle=o||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=i.borderShadowColor,n.stroke()}function dv(n,t,e){const{x:i,y:s,x2:r,y2:a,centerX:o,centerY:l}=n,c=Math.atan2(a-s,r-i),u=Ya(t.controlPoint,0),d={x:o+ln(e,u.x,!1),y:l+ln(e,u.y,!1)};return An(d,{x:o,y:l},c)}function Fd(n,{x:t,y:e},{angle:i,adjust:s},r){!r||!r.display||(n.save(),n.translate(t,e),n.rotate(i),Ja(n,0,-s,r),n.restore())}function hv(n,t,e,i){const{x:s,y:r,x2:a,y2:o,options:l}=t,{startOpts:c,endOpts:u,startAdjust:d,endAdjust:h}=Id(t),g={x:s,y:r},p={x:a,y:o},y=Od(g,e,p,0),x=Od(g,e,p,1)-rt,w=Za(g,e,p,d/i),v=Za(g,e,p,1-h/i),M=new Path2D;n.beginPath(),M.moveTo(w.x,w.y),M.quadraticCurveTo(e.x,e.y,v.x,v.y),n.shadowColor=l.borderShadowColor,n.stroke(M),t.path=M,t.ctx=n,Fd(n,w,{angle:y,adjust:d},c),Fd(n,v,{angle:x,adjust:h},u)}class Ji extends Yt{inRange(t,e,i,s){const r=this.options.rotation,a=this.options.borderWidth;if(i!=="x"&&i!=="y")return fv({x:t,y:e},this.getProps(["width","height","centerX","centerY"],s),r,a);const{x:o,y:l,x2:c,y2:u}=this.getProps(["x","y","x2","y2"],s),d=a/2,h=i==="y"?{start:l,end:u}:{start:o,end:c},g=An({x:t,y:e},this.getCenterPoint(s),Nt(-r));return g[i]>=h.start-d-On&&g[i]<=h.end+d+On}getCenterPoint(t){return ti(this,t)}draw(t){const{width:e,height:i,centerX:s,centerY:r,options:a}=this;t.save(),ja(t,this.getCenterPoint(),a.rotation),ei(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const o=cn(t,a);t.ellipse(s,r,i/2,e/2,rt/2,0,2*rt),t.fill(),o&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return yd(t,e)}}Ji.id="ellipseAnnotation",Ji.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},ii.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Ji.defaultRoutes={borderColor:"color",backgroundColor:"color"},Ji.descriptors={label:{_fallback:!0}};function fv(n,t,e,i){const{width:s,height:r,centerX:a,centerY:o}=t,l=s/2,c=r/2;if(l<=0||c<=0)return!1;const u=Nt(e||0),d=i/2||0,h=Math.cos(u),g=Math.sin(u),p=Math.pow(h*(n.x-a)+g*(n.y-o),2),y=Math.pow(g*(n.x-a)-h*(n.y-o),2);return p/Math.pow(l+d,2)+y/Math.pow(c+d,2)<=1.0001}class tr extends Yt{inRange(t,e,i,s){const{x:r,y:a,x2:o,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),u=this.options.borderWidth;if(i!=="x"&&i!=="y")return d1({x:t,y:e},this.getCenterPoint(s),c/2,u);const d=u/2,h=i==="y"?{start:a,end:l,value:e}:{start:r,end:o,value:t};return h.value>=h.start-d&&h.value<=h.end+d}getCenterPoint(t){return ti(this,t)}draw(t){const e=this.options,i=e.borderWidth;if(e.radius<.1)return;t.save(),t.fillStyle=e.backgroundColor,ei(t,e);const s=cn(t,e);_1(t,this,this.centerX,this.centerY),s&&!Qs(e.pointStyle)&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore(),e.borderWidth=i}resolveElementProperties(t,e){const i=md(t,e);return i.initProperties=Gi(t,i,e),i}}tr.id="pointAnnotation",tr.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},tr.defaultRoutes={borderColor:"color",backgroundColor:"color"};class er extends Yt{inRange(t,e,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&pv(this.elements,t,e,s);const r=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),o=Math.min(...a),l=Math.max(...a);return r[i]>=o&&r[i]<=l}getCenterPoint(t){return ti(this,t)}draw(t){const{elements:e,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,ei(t,i);const s=cn(t,i);let r=!0;for(const a of e)r?(t.moveTo(a.x,a.y),r=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,e){const i=md(t,e),{sides:s,rotation:r}=e,a=[],o=2*rt/s;let l=r*Mr;for(let c=0;c<s;c++,l+=o){const u=gv(i,e,l);u.initProperties=Gi(t,i,e),a.push(u)}return i.elements=a,i}}er.id="polygonAnnotation",er.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},er.defaultRoutes={borderColor:"color",backgroundColor:"color"};function gv({centerX:n,centerY:t},{radius:e,borderWidth:i},s){const r=i/2,a=Math.sin(s),o=Math.cos(s),l={x:n+a*e,y:t-o*e};return{type:"point",optionScope:"point",properties:{x:l.x,y:l.y,centerX:l.x,centerY:l.y,bX:n+a*(e+r),bY:t-o*(e+r)}}}function pv(n,t,e,i){let s=!1,r=n[n.length-1].getProps(["bX","bY"],i);for(const a of n){const o=a.getProps(["bX","bY"],i);o.bY>e!=r.bY>e&&t<(r.bX-o.bX)*(e-o.bY)/(r.bY-o.bY)+o.bX&&(s=!s),r=o}return s}const un={box:ii,ellipse:Ji,label:Ki,line:Qi,point:tr,polygon:er};Object.keys(un).forEach(n=>{Dt.describe(`elements.${un[n].id}`,{_fallback:"plugins.annotation.common"})});const mv={update:Object.assign},yv=Xa.concat(Js),zd=(n,t)=>it(t)?no(n,t):n,to=n=>n==="color"||n==="font";function eo(n="line"){return un[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function bv(n,t,e,i){const s=_v(n,e.animations,i),r=t.annotations,a=kv(t.elements,r);for(let o=0;o<r.length;o++){const l=r[o],c=Bd(a,o,l.type),u=l.setContext(vv(n,c,l)),d=c.resolveElementProperties(n,u);d.skip=xv(d),"elements"in d&&(wv(c,d.elements,u,s),delete d.elements),Qt(c.x)||Object.assign(c,d),Object.assign(c,d.initProperties),d.options=Hd(u),s.update(c,d)}}function xv(n){return isNaN(n.x)||isNaN(n.y)}function _v(n,t,e){return e==="reset"||e==="none"||e==="resize"?mv:new zr(n,t)}function wv(n,t,e,i){const s=n.elements||(n.elements=[]);s.length=t.length;for(let r=0;r<t.length;r++){const a=t[r],o=a.properties,l=Bd(s,r,a.type,a.initProperties),c=e[a.optionScope].override(a);o.options=Hd(c),i.update(l,o)}}function Bd(n,t,e,i){const s=un[eo(e)];let r=n[t];return(!r||!(r instanceof s))&&(r=n[t]=new s,Object.assign(r,i)),r}function Hd(n){const t=un[eo(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,no(n,t.defaults),no(n,t.defaultRoutes));for(const i of yv)e[i]=n[i];return e}function no(n,t){const e={};for(const i of Object.keys(t)){const s=t[i],r=n[i];to(i)&&ot(r)?e[i]=r.map(a=>zd(a,s)):e[i]=zd(r,s)}return e}function vv(n,t,e){return t.$context||(t.$context=Object.assign(Object.create(n.getContext()),{element:t,id:e.id,type:"annotation"}))}function kv(n,t){const e=t.length,i=n.length;if(i<e){const s=e-i;n.splice(i,0,...new Array(s))}else i>e&&n.splice(e,i-e);return n}var Mv="3.0.1";const dn=new Map,Sv=Xa.concat(Js);var Wd={id:"annotation",version:Mv,beforeRegister(){h1("chart.js","4.0",ge.version)},afterRegister(){ge.register(un)},afterUnregister(){ge.unregister(un)},beforeInit(n){dn.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,t,e){const i=dn.get(n),s=i.annotations=[];let r=e.annotations;it(r)?Object.keys(r).forEach(a=>{const o=r[a];it(o)&&(o.id=a,s.push(o))}):ot(r)&&s.push(...r),B1(s,n.scales)},afterDataLimits(n,t){const e=dn.get(n);z1(n,t.scale,e.annotations.filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(n,t,e){const i=dn.get(n);R1(n,i,e),bv(n,i,e,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),F1(n,i,e)},beforeDatasetsDraw(n,t,e){nr(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,t,e){nr(n,"afterDatasetsDraw",e.clip)},beforeDraw(n,t,e){nr(n,"beforeDraw",e.clip)},afterDraw(n,t,e){nr(n,"afterDraw",e.clip)},beforeEvent(n,t,e){const i=dn.get(n);L1(i,t.event,e)&&(t.changed=!0)},afterDestroy(n){dn.delete(n)},_getState(n){return dn.get(n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:n=>!Sv.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,t)=>`elements.${un[eo(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:to,_fallback:!0},_indexable:to}},additionalOptionScopes:[""]};function nr(n,t,e){const{ctx:i,chartArea:s}=n,r=dn.get(n);e&&bi(i,s);const a=Dv(r.visibleElements,t).sort((o,l)=>o.element.options.z-l.element.options.z);for(const o of a)Tv(i,s,r,o);e&&xi(i)}function Dv(n,t){const e=[];for(const i of n)if(i.options.drawTime===t&&e.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&e.push({element:s});return e}function Tv(n,t,e,i){const s=i.element;i.main?(vd(e,s,"beforeDraw"),s.draw(n,t),vd(e,s,"afterDraw")):s.draw(n,t)}const Cv="#6c7489",Pv="#995c00",Ov="20px",Yd="24px",Ev="40px",Av="48px",Rv={class:"tooltip-title"},Lv={class:"title font-bold"},Iv={key:1,class:"subtitle"},Nv={class:"tooltip"},Fv={key:0},zv={class:"display-label"},Bv={class:"display-value"},Hv=f.defineComponent({__name:"ChartTooltip",props:{showTooltip:{type:Boolean,required:!0,default:!1},left:{type:String,required:!1,default:null},top:{type:String,required:!1,default:null},tooltipTitle:{type:String,required:!1,default:""},context:{type:[String,Number],required:!1,default:""},series:{type:Array,required:!0,default:()=>[]},locked:{type:Boolean,required:!1,default:!1}},emits:["dimensions","top","left"],setup(n,{emit:t}){const e=t,i=n,s=f.ref(null),r=f.ref(!1),a=f.ref({x:0,y:0}),o=f.ref({x:0,y:0}),l=f.ref({left:i.left,top:i.top});f.watch(s,g=>{if(g){const{width:p,height:y}=g.getBoundingClientRect();e("dimensions",{width:p,height:y})}}),f.watch(()=>i.locked,g=>{g?(l.value.left=i.left,l.value.top=i.top):g===!1&&(e("top",l.value.top),e("left",l.value.left))});function c(g){if(s.value){r.value=!0;const p=window.getComputedStyle(s.value),y=p.transform||p.webkitTransform||p.mozTransform,x=new DOMMatrix(y),w=x.m41,v=x.m42;a.value={x:w,y:v},o.value={x:g.clientX,y:g.clientY},window.addEventListener("mousemove",d),window.addEventListener("mouseup",h)}}let u=null;function d(g){g.preventDefault(),g.stopPropagation(),r.value&&(u!==null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{const p=g.clientX-o.value.x,y=g.clientY-o.value.y;l.value.left=`${a.value.x+p}px`,l.value.top=`${a.value.y+y}px`}))}function h(){r.value=!1,u!==null&&window.cancelAnimationFrame(u),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}return(g,p)=>n.showTooltip?(f.openBlock(),f.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:f.normalizeClass(["tooltip-container",{locked:n.locked}]),style:f.normalizeStyle({transform:n.locked?`translate(${l.value.left}, ${l.value.top})`:`translate(${n.left}, ${n.top})`,left:"0",top:"0",pointerEvents:n.locked?"all":"none"}),onMousedown:c},[f.createElementVNode("div",Rv,[f.createElementVNode("span",Lv,f.toDisplayString(n.tooltipTitle),1),n.locked?(f.openBlock(),f.createBlock(f.unref(Do.DragIcon),{key:0,class:"drag-icon",color:f.unref(Cv)},null,8,["color"])):f.createCommentVNode("",!0),n.context?(f.openBlock(),f.createElementBlock("span",Iv,f.toDisplayString(n.context),1)):f.createCommentVNode("",!0)]),f.createElementVNode("ul",Nv,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.series,({backgroundColor:y,borderColor:x,label:w,value:v})=>(f.openBlock(),f.createElementBlock(f.Fragment,{key:w},[n.series.length?(f.openBlock(),f.createElementBlock("li",Fv,[f.createElementVNode("div",{class:"square-marker",style:f.normalizeStyle({background:y,"border-color":x})},null,4),f.createElementVNode("span",zv,f.toDisplayString(w),1),f.createElementVNode("span",Bv,f.toDisplayString(v),1)])):f.createCommentVNode("",!0)],64))),128))])],38)):f.createCommentVNode("",!0)}}),We=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},io=We(Hv,[["__scopeId","data-v-cd0df662"]]),Wv=["onClick"],Yv=["title"],Vv={key:0,class:"sub-label"},so=We(f.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(n){f.useCssVars(M=>({"143d7c82":o.value}));const t=n,e=f.ref(),i=f.ref([]),s=f.inject("showLegendValues",!0),r=f.inject("legendPosition",f.ref(Pt.Right)),a=f.ref([]),o=f.ref(Yd),l=()=>{const M=e.value;if(!M||!i.value||M.children.length===0)return 0;const C=M.children[0].getBoundingClientRect().top;for(const D of i.value)if(D.getBoundingClientRect().top>C)return!0;return!1},c=f.computed(()=>t.items.length>2||r.value===Pt.Right),u=()=>{e.value&&r.value===Pt.Bottom&&(l()?o.value=Av:o.value=Yd)},d=()=>{if(e.value&&r.value===Pt.Bottom){let M=0;i.value.forEach(D=>{const E=Array.from(D.children).reduce((T,b)=>T+b.offsetWidth,0);E>M&&(M=E)});const C=parseInt(Ev,10);e.value.style.gridTemplateColumns=`repeat(auto-fit, ${M+C}px)`}u()},h=()=>{if(t.items.length!==a.value.length)return a.value=t.items,!0;for(let M=0;M<t.items.length;M++)if(t.items[M].text!==a.value[M].text)return a.value=t.items,!0;return!1};f.watch(()=>t.items,()=>{h()&&d()},{immediate:!0,flush:"post"});const g=f.ref(0),p=f.ref(0),y=new ResizeObserver(xu(M=>{const C=M[0],D=C.contentRect.width,E=C.contentRect.height;D!==g.value&&E===p.value&&d(),g.value=D,p.value=E},100));f.watch(()=>r.value,()=>{d()}),f.onMounted(()=>{a.value=t.items,e.value&&y.observe(e.value),window.requestAnimationFrame(()=>{d()})}),f.onBeforeUnmount(()=>{e.value&&y.unobserve(e.value)});const x=(M=0,C)=>{if(t.chartInstance===null)return;const D=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart;w(M,C)?D.hide(M,C):D.show(M,C),D.update()},w=(M=0,C)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const D=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart,E=D.getDatasetMeta(M);return E.dataset||C===void 0?D.isDatasetVisible(M):!(E.data.length&&E.data[C].hidden)},v=M=>({[Pt.Right]:"vertical",[Pt.Bottom]:"horizontal",[Pt.Hidden]:"hidden"})[M];return(M,C)=>f.unref(r)!==f.unref(Pt).Hidden?(f.openBlock(),f.createElementBlock("ul",{key:0,ref_key:"legendContainerRef",ref:e,class:f.normalizeClass(["legend-container",v(f.unref(r))]),"data-testid":"legend"},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.items,({fillStyle:D,strokeStyle:E,text:T,datasetIndex:b,index:_,value:S})=>(f.openBlock(),f.createElementBlock("li",{key:T,ref_for:!0,ref_key:"legendItemsRef",ref:i,onClick:O=>x(b,_)},[f.createElementVNode("div",{class:"square-marker",style:f.normalizeStyle({background:D,"border-color":E})},null,4),f.createElementVNode("div",{class:f.normalizeClass(["label-container",{"strike-through":!w(b,_)}])},[f.createElementVNode("div",{class:f.normalizeClass(["label",{"truncate-label":c.value}]),title:T},f.toDisplayString(T),11,Yv),S&&f.unref(s)?(f.openBlock(),f.createElementBlock("div",Vv,f.toDisplayString(S.formatted),1)):f.createCommentVNode("",!0)],2)],8,Wv))),128))],2)):f.createCommentVNode("",!0)}}),[["__scopeId","data-v-bf35eae8"]]);for(var Vt=[],ro=0;ro<256;++ro)Vt.push((ro+256).toString(16).slice(1));function jv(n,t=0){return(Vt[n[t+0]]+Vt[n[t+1]]+Vt[n[t+2]]+Vt[n[t+3]]+"-"+Vt[n[t+4]]+Vt[n[t+5]]+"-"+Vt[n[t+6]]+Vt[n[t+7]]+"-"+Vt[n[t+8]]+Vt[n[t+9]]+"-"+Vt[n[t+10]]+Vt[n[t+11]]+Vt[n[t+12]]+Vt[n[t+13]]+Vt[n[t+14]]+Vt[n[t+15]]).toLowerCase()}var ir,$v=new Uint8Array(16);function Uv(){if(!ir&&(ir=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ir))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ir($v)}var qv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Vd={randomUUID:qv};function hn(n,t,e){if(Vd.randomUUID&&!t&&!n)return Vd.randomUUID();n=n||{};var i=n.random||(n.rng||Uv)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,jv(i)}const jd=(n,t)=>{const e=n.ctx,i=n.scales.y,s=n.scales.x,r=t[t.length-1].element;e.save(),e.strokeStyle="rgba(100, 100, 100, 1)",e.lineWidth=3,n.options.indexAxis==="x"?e.strokeRect(r.x-r.width/2,r.y,r.width,i.bottom-r.y):e.strokeRect(s.left,r.y-r.height/2,r.x-s.left,r.height),e.restore()},$d={id:"highlightPlugin",clicked:!1,afterDatasetsDraw:function(n){this.clickedElements&&this.clickedElements.length&&jd(n,this.clickedElements)},afterEvent:function(n,{event:t}){var s;if(t.type!=="click"||!t.native)return;this.clicked=!this.clicked;const e=((s=n.options.interaction)==null?void 0:s.mode)||"index",i=n.getElementsAtEventForMode(t.native,e,{intersect:!1},!0);i.length&&this.clicked?(this.clickedElements=i,jd(n,this.clickedElements),this.previousHoverOption=n.options.hover,n.options.hover={mode:null}):(delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1)},beforeDestroy(n){delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1}},Ud=6,Xv="100%",Gv="100%",Kv=20,Zv=20,qd=6,Qv=0,Jv=10,tk=10,ek=1,nk=We(f.defineComponent({__name:"StackedBarChart",props:{chartData:{type:Object,required:!1,default:()=>({labels:[],datasets:[]})},tooltipTitle:{type:String,required:!1,default:""},legendValues:{type:Object,required:!1,default:null},metricUnit:{type:String,required:!1,default:""},orientation:{type:String,required:!1,default:"horizontal",validator:n=>["horizontal","vertical"].includes(n)},annotations:{type:Boolean,required:!1,default:!0},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},stacked:{type:Boolean,required:!1,default:!0},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{i18n:e}=gt.useI18n(),{translateUnit:i}=gt.useTranslatedUnits(),s=f.ref(null),r=({chart:L},B)=>{var Z;const V=L.data,q=(Z=V.labels)==null?void 0:Z.indexOf(B);return V.datasets.reduce((Y,W,et)=>{if(L.isDatasetVisible(et)){const X=W.data[q];return isNaN(X)?Y:Y+X}else return Y},0)},a=(L,B,V,q)=>{const Z=q==="horizontal";B===null&&(B=e.t("entityNoName"));const Y={type:"label",yValue:X=>Z?B:r(X,B),xValue:X=>Z?r(X,B):B},W={...Y,position:Z?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>Z?0:-Math.abs(Bx()),content:X=>Da(r(X,B),V)},et={...Y,content:X=>Pu(r(X,B),Cu(X.chart,L)),position:Z?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:X=>Z?Tu(Da(r(X,B),V)):0,color:Su};return{[`${B}-value`]:W,[`${B}-percent`]:et}},o=f.ref(null),l=f.ref(),c=f.ref(hn()),u=hn(),d=hn(),h=f.ref([]),g=f.ref(f.inject("legendPosition",Pt.Right)),p=f.ref({show:!1,top:"0px",left:"0px",text:"",offset:-50}),y=f.toRef(t,"metricUnit"),x=f.computed(()=>f.toRef(t,"orientation").value==="horizontal"),w=f.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:y,translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,locked:!1,chartType:x.value?"horizontal_bar":"vertical_bar",chartTooltipSortFn:t.chartTooltipSortFn}),v=f.ref(0),M=()=>{var L;return t.annotations&&((L=t.chartData.labels)==null?void 0:L.reduce((B,V)=>Object.assign(B,a(t.chartData,V,y.value,t.orientation)),{}))},C={id:c.value,afterUpdate(L){v.value+=1,h.value=L.options.plugins.legend.labels.generateLabels(L).map(B=>({...B,value:t.legendValues&&t.legendValues[B.text]})).sort(t.chartLegendSortFn)}},D={id:u,afterUpdate(L){L.options.plugins.annotation.annotations=t.annotations?M():{}}},b=[C,{id:"axisHover",afterEvent(L,B){if(p.value.show=!1,B.event.type==="mousemove"){const V=B.event,q=L.options.indexAxis,Z=L.scales,Y=L.scales[q].getLabelForValue(Number(L.scales[q].getValueForPixel(V[q])));if((et=>et==="x"?V.y>Z.x.top:V.x<Z.y.right)(q))if(w.locked||(w.showTooltip=!1),Y.length>Ys){const X=L.canvas.getContext("2d").measureText(Y).width,wt=Math.abs(Math.round(V.x-X*.5)),ct=Math.round(V.x+X*.5);p.value.left=q==="x"?`${(wt>0?wt:ct)-p.value.offset}px`:`${V.x-X*.5-p.value.offset}px`,p.value.top=`${V.y-50}px`,p.value.show=!0,p.value.text=Y}else p.value.show=!1;else p.value.show=!1}}},{id:d,afterUpdate(L){L.options.layout.padding.right=x.value?N.value:0}},$d,...t.annotations?[D]:[]],_=f.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),S=f.ref(0),O=f.ref(0),A=new ResizeObserver(xu(L=>{S.value=L[0].contentRect.width,O.value=L[0].contentRect.height},100)),F=f.computed(()=>{var B,V;const L=(V=(B=t.chartData)==null?void 0:B.labels)==null?void 0:V.length;return o.value&&L&&!x.value?`${Math.max(L*(Kv+qd),S.value)}px`:Xv}),j=f.computed(()=>{var B,V;const L=(V=(B=t.chartData)==null?void 0:B.labels)==null?void 0:V.length;return o.value&&L&&x.value?`${Math.max(L*(Zv+qd),O.value)}px`:Gv});gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey")),f.onMounted(()=>{t.annotations&&ge.register(Wd),s.value&&(S.value=s.value.offsetWidth,O.value=s.value.offsetHeight,A.observe(s.value))}),f.onUnmounted(()=>{s.value&&A.unobserve(s.value)});const G=f.computed(()=>{const L=gt.useBarChartOptions({tooltipState:w,legendID:c.value,stacked:f.toRef(t,"stacked"),metricAxesTitle:f.toRef(t,"metricAxesTitle"),dimensionAxesTitle:f.toRef(t,"dimensionAxesTitle"),indexAxis:x.value?"y":"x",numLabels:_});return{...L.value,plugins:{...L.value.plugins,annotation:{annotations:M(),clip:!1}},layout:{autoPadding:!1,padding:{right:0,top:6*Ud}}}}),$=gt.useChartJSCommon("bar",o,f.toRef(t,"chartData"),b,G),N=f.computed(()=>{v.value;const L=t.chartData.labels,B=t.chartData.datasets,V=L.map((Y,W)=>B.reduce((et,X)=>isNaN(Number(X.data[W]))?et:et+Number(X.data[W]),0)),q=$.value?Cu($.value,t.chartData):Hx(t.chartData);return V.map(Y=>Tu(Da(Y,y.value)+Pu(Y,q))).reduce((Y,W)=>Math.max(Y,W),0)+Ud});f.onBeforeUnmount(()=>{ge.unregister(Wd)});const st={[Pt.Right]:"legend-row",[Pt.Bottom]:"column"},z=f.computed(()=>{if(l.value&&$.value){const L=window.devicePixelRatio,B=$.value,V=B.scales.y.width*L+ek,q=(B.scales.y.height+B.scales.y.top+B.scales.x.height)*L,Z=l.value.getContext("2d");return Z.scale(L,L),Z.canvas.width=V,Z.canvas.height=q,Z.canvas.style.width=`${V/L}px`,Z.canvas.style.height=`${q/L}px`,{scale:L,width:V*L,height:q*L,targetCtx:Z}}return null}),At=L=>{const B=L.target;if(z.value&&$.value&&!x.value){const V=z.value.scale,q=z.value.targetCtx,Z=z.value.width,Y=z.value.height,W=$.value,et=W.canvas;q.fillStyle="white",B.scrollLeft>=Qv&&B.scrollLeft<=Jv?(q.globalCompositeOperation="source-over",q.clearRect(0,0,Z,Y),q.drawImage(et,0,0,Z,Y,0,0,Z,Y),q.globalCompositeOperation="destination-over",q.fillRect(0,0,Z,Y)):(q.globalCompositeOperation="source-over",q.fillRect(0,(W.scales.y.height+W.scales.y.top+tk)*V,Z,W.scales.x.height*V))}w.offsetY=B.scrollTop,w.offsetX=B.scrollLeft,p.value.offset=B.scrollLeft},_t=({width:L,height:B})=>{w.width=L,w.height=B};f.watch(()=>t.orientation,()=>{var L;if(l.value&&z.value){const B=z.value.width,V=z.value.height;((L=l.value)==null?void 0:L.getContext("2d")).clearRect(0,0,B,V)}w.showTooltip=!1,w.locked=!1}),f.watch(()=>t.annotations,L=>{$.value&&(L?$.value.options.plugins.annotation.annotations=M(t.chartData):delete $.value.options.plugins.annotation.annotations)});const H=()=>{w.showTooltip&&(w.locked=!w.locked)};return(L,B)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",st[g.value]])},[f.createElementVNode("canvas",{ref_key:"axis",ref:l,class:"axis"},null,512),f.createElementVNode("div",{ref_key:"chartContainerRef",ref:s,class:"chart-container","on:scroll":At,onClick:B[0]||(B[0]=V=>H())},[f.createElementVNode("div",{class:"chart-body",style:f.normalizeStyle({width:F.value,height:j.value})},[f.createElementVNode("canvas",{ref_key:"canvas",ref:o},null,512)],4)],544),p.value.show?(f.openBlock(),f.createElementBlock("div",{key:0,class:"axis-tooltip",style:f.normalizeStyle({top:p.value.top,left:p.value.left})},f.toDisplayString(p.value.text),5)):f.createCommentVNode("",!0),f.createVNode(io,{context:w.tooltipContext,left:w.left,locked:w.locked,series:w.tooltipSeries,"show-tooltip":w.showTooltip,"tooltip-title":n.tooltipTitle,top:w.top,onDimensions:_t},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top"]),f.createVNode(so,{id:c.value,"chart-instance":f.unref($),items:h.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-3a47e0ef"]]);/*!
23
+ */const sd={modes:{point(n,t){return Gs(n,t,{intersect:!0})},nearest(n,t,e){return l1(n,t,e)},x(n,t,e){return Gs(n,t,{intersect:e.intersect,axis:"x"})},y(n,t,e){return Gs(n,t,{intersect:e.intersect,axis:"y"})}}};function Ha(n,t,e){return(sd.modes[e.mode]||sd.modes.nearest)(n,t,e)}function a1(n,t,e){return e!=="x"&&e!=="y"?n.inRange(t.x,t.y,"x",!0)||n.inRange(t.x,t.y,"y",!0):n.inRange(t.x,t.y,e,!0)}function o1(n,t,e){return e==="x"?{x:n.x,y:t.y}:e==="y"?{x:t.x,y:n.y}:t}function Gs(n,t,e){return n.visibleElements.filter(i=>e.intersect?i.inRange(t.x,t.y):a1(i,t,e.axis))}function l1(n,t,e){let i=Number.POSITIVE_INFINITY;return Gs(n,t,e).reduce((s,r)=>{const a=r.getCenterPoint(),o=o1(t,a,e.axis),l=Bn(t,o);return l<i?(s=[r],i=l):l===i&&s.push(r),s},[]).sort((s,r)=>s._index-r._index).slice(0,1)}const c1=(n,t)=>t>n||n.length>t.length&&n.slice(0,t.length)===t,On=.001,Ks=(n,t,e)=>Math.min(e,Math.max(t,n));function u1(n,t,e){for(const i of Object.keys(n))n[i]=Ks(n[i],t,e);return n}function d1(n,t,e,i){if(!n||!t||e<=0)return!1;const s=i/2;return Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)<=Math.pow(e+s,2)}function rd(n,{x:t,y:e,x2:i,y2:s},r,a){const o=a/2,l=n.x>=t-o-On&&n.x<=i+o+On,c=n.y>=e-o-On&&n.y<=s+o+On;return r==="x"?l:(r==="y"||l)&&c}function ti(n,t){const{centerX:e,centerY:i}=n.getProps(["centerX","centerY"],t);return{x:e,y:i}}function h1(n,t,e,i=!0){const s=e.split(".");let r=0;for(const a of t.split(".")){const o=s[r++];if(parseInt(a,10)<parseInt(o,10))break;if(c1(o,a)){if(i)throw new Error(`${n} v${e} is not supported. v${t} or newer is required.`);return!1}}return!0}const ad=n=>typeof n=="string"&&n.endsWith("%"),od=n=>parseFloat(n)/100,ld=n=>Ks(od(n),0,1),Zs=(n,t)=>({x:n,y:t,x2:n,y2:t,width:0,height:0}),f1={box:n=>Zs(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>Zs(n.centerX,n.centerY),line:n=>Zs(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>Zs(n.centerX,n.centerY)};function Wa(n,t){return t==="start"?0:t==="end"?n:ad(t)?ld(t)*n:n/2}function ln(n,t,e=!0){return typeof t=="number"?t:ad(t)?(e?ld(t):od(t))*n:n}function g1(n,t){const{x:e,width:i}=n,s=t.textAlign;return s==="center"?e+i/2:s==="end"||s==="right"?e+i:e}function Ya(n,t="center"){return it(n)?{x:K(n.x,t),y:K(n.y,t)}:(n=K(n,t),{x:n,y:n})}function cd(n){return n&&(Qt(n.xValue)||Qt(n.yValue))}function Gi(n,t,e){const i=e.init;if(i){if(i===!0)return dd(t,e)}else return;return p1(n,t,e)}function ud(n,t,e){let i=!1;return t.forEach(s=>{Jt(n[s])?(i=!0,e[s]=n[s]):Qt(e[s])&&delete e[s]}),i}function dd(n,t){const e=t.type||"line";return f1[e](n)}function p1(n,t,e){const i=ut(e.init,[{chart:n,properties:t,options:e}]);if(i===!0)return dd(t,e);if(it(i))return i}const Va=new Map,m1=n=>isNaN(n)||n<=0,y1=n=>n.reduce(function(t,e){return t+=e.string,t},"");function Qs(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function ja(n,{x:t,y:e},i){i&&(n.translate(t,e),n.rotate(Nt(i)),n.translate(-t,-e))}function cn(n,t){if(t&&t.borderWidth)return n.lineCap=t.borderCapStyle,n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.lineJoin=t.borderJoinStyle,n.lineWidth=t.borderWidth,n.strokeStyle=t.borderColor,!0}function ei(n,t){n.shadowColor=t.backgroundShadowColor,n.shadowBlur=t.shadowBlur,n.shadowOffsetX=t.shadowOffsetX,n.shadowOffsetY=t.shadowOffsetY}function $a(n,t){const e=t.content;if(Qs(e))return{width:ln(e.width,t.width),height:ln(e.height,t.height)};const i=t.font,s=ot(i)?i.map(l=>xt(l)):[xt(i)],r=t.textStrokeWidth,a=ot(e)?e:[e],o=a.join()+y1(s)+r+(n._measureText?"-spriting":"");return Va.has(o)||Va.set(o,v1(n,a,s,r)),Va.get(o)}function hd(n,t,e){const{x:i,y:s,width:r,height:a}=t;n.save(),ei(n,e);const o=cn(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),Hn(n,{x:i,y:s,w:r,h:a,radius:u1(Je(e.borderRadius),0,Math.min(r,a)/2)}),n.closePath(),n.fill(),o&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function b1(n,t,e){const i=e.content;if(Qs(i)){n.save(),n.globalAlpha=S1(e.opacity,i.style.opacity),n.drawImage(i,t.x,t.y,t.width,t.height),n.restore();return}const s=ot(i)?i:[i],r=e.font,a=ot(r)?r.map(d=>xt(d)):[xt(r)],o=e.color,l=ot(o)?o:[o],c=g1(t,e),u=t.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,x1(n,e)&&k1(n,{x:c,y:u},s,a),M1(n,{x:c,y:u},s,{fonts:a,colors:l}),n.restore()}function x1(n,t){if(t.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=t.textStrokeWidth,n.strokeStyle=t.textStrokeColor,!0}function _1(n,t,e,i){const{radius:s,options:r}=t,a=r.pointStyle,o=r.rotation;let l=(o||0)*Mr;if(Qs(a)){n.save(),n.translate(e,i),n.rotate(l),n.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),n.restore();return}m1(s)||w1(n,{x:e,y:i,radius:s,rotation:o,style:a,rad:l})}function w1(n,{x:t,y:e,radius:i,rotation:s,style:r,rad:a}){let o,l,c,u;switch(n.beginPath(),r){default:n.arc(t,e,i,0,yt),n.closePath();break;case"triangle":n.moveTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=ls,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),a+=ls,n.lineTo(t+Math.sin(a)*i,e-Math.cos(a)*i),n.closePath();break;case"rectRounded":u=i*.516,c=i-u,o=Math.cos(a+fe)*c,l=Math.sin(a+fe)*c,n.arc(t-o,e-l,u,a-rt,a-bt),n.arc(t+l,e-o,u,a-bt,a),n.arc(t+o,e+l,u,a,a+bt),n.arc(t-l,e+o,u,a+bt,a+rt),n.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,n.rect(t-c,e-c,2*c,2*c);break}a+=fe;case"rectRot":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+l,e-o),n.lineTo(t+o,e+l),n.lineTo(t-l,e+o),n.closePath();break;case"crossRot":a+=fe;case"cross":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"star":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o),a+=fe,o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l),n.moveTo(t+l,e-o),n.lineTo(t-l,e+o);break;case"line":o=Math.cos(a)*i,l=Math.sin(a)*i,n.moveTo(t-o,e-l),n.lineTo(t+o,e+l);break;case"dash":n.moveTo(t,e),n.lineTo(t+Math.cos(a)*i,e+Math.sin(a)*i);break}n.fill()}function v1(n,t,e,i){n.save();const s=t.length;let r=0,a=i;for(let o=0;o<s;o++){const l=e[Math.min(o,e.length-1)];n.font=l.string;const c=t[o];r=Math.max(r,n.measureText(c).width+i),a+=l.lineHeight}return n.restore(),{width:r,height:a}}function k1(n,{x:t,y:e},i,s){n.beginPath();let r=0;i.forEach(function(a,o){const l=s[Math.min(o,s.length-1)],c=l.lineHeight;n.font=l.string,n.strokeText(a,t,e+c/2+r),r+=c}),n.stroke()}function M1(n,{x:t,y:e},i,{fonts:s,colors:r}){let a=0;i.forEach(function(o,l){const c=r[Math.min(l,r.length-1)],u=s[Math.min(l,s.length-1)],d=u.lineHeight;n.beginPath(),n.font=u.string,n.fillStyle=c,n.fillText(o,t,e+d/2+a),a+=d,n.fill()})}function S1(n,t){const e=Qe(n)?n:t;return Qe(e)?Ks(e,0,1):1}const fd={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function ni(n,t,e){return t=typeof t=="number"?t:n.parse(t),kt(t)?n.getPixelForValue(t):e}function En(n,t,e){const i=t[e];if(i||e==="scaleID")return i;const s=e.charAt(0),r=Object.values(n).filter(a=>a.axis&&a.axis===s);return r.length?r[0].id:s}function gd(n,t){if(n){const e=n.options.reverse,i=ni(n,t.min,e?t.end:t.start),s=ni(n,t.max,e?t.start:t.end);return{start:i,end:s}}}function pd(n,t){const{chartArea:e,scales:i}=n,s=i[En(i,t,"xScaleID")],r=i[En(i,t,"yScaleID")];let a=e.width/2,o=e.height/2;return s&&(a=ni(s,t.xValue,s.left+s.width/2)),r&&(o=ni(r,t.yValue,r.top+r.height/2)),{x:a,y:o}}function qa(n,t){const e=n.scales,i=e[En(e,t,"xScaleID")],s=e[En(e,t,"yScaleID")];if(!i&&!s)return{};let{left:r,right:a}=i||n.chartArea,{top:o,bottom:l}=s||n.chartArea;const c=bd(i,{min:t.xMin,max:t.xMax,start:r,end:a});r=c.start,a=c.end;const u=bd(s,{min:t.yMin,max:t.yMax,start:l,end:o});return o=u.start,l=u.end,{x:r,y:o,x2:a,y2:l,width:a-r,height:l-o,centerX:r+(a-r)/2,centerY:o+(l-o)/2}}function md(n,t){if(!cd(t)){const e=qa(n,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(e.width,e.height)/2,t.radius=i);const s=i*2,r=e.centerX+t.xAdjust,a=e.centerY+t.yAdjust;return{x:r-i,y:a-i,x2:r+i,y2:a+i,centerX:r,centerY:a,width:s,height:s,radius:i}}return T1(n,t)}function D1(n,t){const{scales:e,chartArea:i}=n,s=e[t.scaleID],r={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?C1(s,r,t):P1(e,r,t),r}function yd(n,t){const e=qa(n,t);return e.initProperties=Gi(n,e,t),e.elements=[{type:"label",optionScope:"label",properties:A1(n,e,t),initProperties:e.initProperties}],e}function T1(n,t){const e=pd(n,t),i=t.radius*2;return{x:e.x-t.radius+t.xAdjust,y:e.y-t.radius+t.yAdjust,x2:e.x+t.radius+t.xAdjust,y2:e.y+t.radius+t.yAdjust,centerX:e.x+t.xAdjust,centerY:e.y+t.yAdjust,radius:t.radius,width:i,height:i}}function bd(n,t){const e=gd(n,t)||t;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function C1(n,t,e){const i=ni(n,e.value,NaN),s=ni(n,e.endValue,i);n.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function P1(n,t,e){for(const i of Object.keys(fd)){const s=n[En(n,e,i)];if(s){const{min:r,max:a,start:o,end:l,startProp:c,endProp:u}=fd[i],d=gd(s,{min:e[r],max:e[a],start:s[o],end:s[l]});t[c]=d.start,t[u]=d.end}}}function O1({properties:n,options:t},e,i,s){const{x:r,x2:a,width:o}=n;return xd({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:e.width})}function E1({properties:n,options:t},e,i,s){const{y:r,y2:a,height:o}=n;return xd({start:r,end:a,size:o,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:e.height})}function xd(n,t){const{start:e,end:i,borderWidth:s}=n,{position:r,padding:{start:a,end:o},adjust:l}=t,c=i-s-e-a-o-t.size;return e+s/2+l+Wa(c,r)}function A1(n,t,e){const i=e.label;i.backgroundColor="transparent",i.callout.display=!1;const s=Ya(i.position),r=Ft(i.padding),a=$a(n.ctx,i),o=O1({properties:t,options:e},a,s,r),l=E1({properties:t,options:e},a,s,r),c=a.width+r.width,u=a.height+r.height;return{x:o,y:l,x2:o+c,y2:l+u,width:c,height:u,centerX:o+c/2,centerY:l+u/2,rotation:i.rotation}}function An(n,t,e){const i=Math.cos(e),s=Math.sin(e),r=t.x,a=t.y;return{x:r+i*(n.x-r)-s*(n.y-a),y:a+s*(n.x-r)+i*(n.y-a)}}const Ua=["enter","leave"],Xa=Ua.concat("click");function R1(n,t,e){t.listened=ud(e,Xa,t.listeners),t.moveListened=!1,t._getElements=Ha,Ua.forEach(i=>{Jt(e[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Jt(i.click)&&(t.listened=!0),t.moveListened||Ua.forEach(s=>{Jt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function L1(n,t,e){if(n.listened)switch(t.type){case"mousemove":case"mouseout":return I1(n,t,e);case"click":return N1(n,t,e)}}function I1(n,t,e){if(!n.moveListened)return;let i;t.type==="mousemove"?i=Ha(n,t,e.interaction):i=[];const s=n.hovered;n.hovered=i;const r={state:n,event:t};let a=_d(r,"leave",s,i);return _d(r,"enter",i,s)||a}function _d({state:n,event:t},e,i,s){let r;for(const a of i)s.indexOf(a)<0&&(r=wd(a.options[e]||n.listeners[e],a,t)||r);return r}function N1(n,t,e){const i=n.listeners,s=Ha(n,t,e.interaction);let r;for(const a of s)r=wd(a.options.click||i.click,a,t)||r;return r}function wd(n,t,e){return ut(n,[t.$context,e])===!0}const Js=["afterDraw","beforeDraw"];function F1(n,t,e){const i=t.visibleElements;t.hooked=ud(e,Js,t.hooks),t.hooked||i.forEach(s=>{t.hooked||Js.forEach(r=>{Jt(s.options[r])&&(t.hooked=!0)})})}function vd(n,t,e){if(n.hooked){const i=t.options[e]||n.hooks[e];return ut(i,[t.$context])}}function z1(n,t,e){const i=V1(n.scales,t,e);let s=kd(t,i,"min","suggestedMin");s=kd(t,i,"max","suggestedMax")||s,s&&Jt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function B1(n,t){for(const e of n)W1(e,t)}function kd(n,t,e,i){if(kt(t[e])&&!H1(n.options,e,i)){const s=n[e]!==t[e];return n[e]=t[e],s}}function H1(n,t,e){return Qt(n[t])||Qt(n[e])}function W1(n,t){for(const e of["scaleID","xScaleID","yScaleID"]){const i=En(t,n,e);i&&!t[i]&&Y1(n,e)&&console.warn(`No scale found with id '${i}' for annotation '${n.id}'`)}}function Y1(n,t){if(t==="scaleID")return!0;const e=t.charAt(0);for(const i of["Min","Max","Value"])if(Qt(n[e+i]))return!0;return!1}function V1(n,t,e){const i=t.axis,s=t.id,r=i+"ScaleID",a={min:K(t.min,Number.NEGATIVE_INFINITY),max:K(t.max,Number.POSITIVE_INFINITY)};for(const o of e)o.scaleID===s?Md(o,t,["value","endValue"],a):En(n,o,r)===s&&Md(o,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Md(n,t,e,i){for(const s of e){const r=n[s];if(Qt(r)){const a=t.parse(r);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class ii extends Yt{inRange(t,e,i,s){const{x:r,y:a}=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation));return rd({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options.borderWidth)}getCenterPoint(t){return ti(this,t)}draw(t){t.save(),ja(t,this.getCenterPoint(),this.options.rotation),hd(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return yd(t,e)}}ii.id="boxAnnotation",ii.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},ii.defaultRoutes={borderColor:"color",backgroundColor:"color"},ii.descriptors={label:{_fallback:!0}};const Sd=["left","bottom","top","right"];class Ki extends Yt{inRange(t,e,i,s){const{x:r,y:a}=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.rotation));return rd({x:r,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options.borderWidth)}getCenterPoint(t){return ti(this,t)}draw(t){const e=this.options,i=!Qt(this._visible)||this._visible;!e.display||!e.content||!i||(t.save(),ja(t,this.getCenterPoint(),this.rotation),$1(t,this),hd(t,this,e),b1(t,Q1(this),e),t.restore())}resolveElementProperties(t,e){let i;if(cd(e))i=pd(t,e);else{const{centerX:o,centerY:l}=qa(t,e);i={x:o,y:l}}const s=Ft(e.padding),r=$a(t.ctx,e),a=j1(i,r,e,s);return{initProperties:Gi(t,a,e),pointX:i.x,pointY:i.y,...a,rotation:e.rotation}}}Ki.id="labelAnnotation",Ki.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Ki.defaultRoutes={borderColor:"color"};function j1(n,t,e,i){const s=t.width+i.width+e.borderWidth,r=t.height+i.height+e.borderWidth,a=Ya(e.position,"center"),o=Dd(n.x,s,e.xAdjust,a.x),l=Dd(n.y,r,e.yAdjust,a.y);return{x:o,y:l,x2:o+s,y2:l+r,width:s,height:r,centerX:o+s/2,centerY:l+r/2}}function Dd(n,t,e=0,i){return n-Wa(t,i)+e}function $1(n,t){const{pointX:e,pointY:i,options:s}=t,r=s.callout,a=r&&r.display&&K1(t,r);if(!a||J1(t,r,a))return;if(n.save(),n.beginPath(),!cn(n,r))return n.restore();const{separatorStart:l,separatorEnd:c}=q1(t,a),{sideStart:u,sideEnd:d}=X1(t,a,l);(r.margin>0||s.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(c.x,c.y)),n.moveTo(u.x,u.y),n.lineTo(d.x,d.y);const h=An({x:e,y:i},t.getCenterPoint(),Nt(-t.rotation));n.lineTo(h.x,h.y),n.stroke(),n.restore()}function q1(n,t){const{x:e,y:i,x2:s,y2:r}=n,a=U1(n,t);let o,l;return t==="left"||t==="right"?(o={x:e+a,y:i},l={x:o.x,y:r}):(o={x:e,y:i+a},l={x:s,y:o.y}),{separatorStart:o,separatorEnd:l}}function U1(n,t){const{width:e,height:i,options:s}=n,r=s.callout.margin+s.borderWidth/2;return t==="right"?e+r:t==="bottom"?i+r:-r}function X1(n,t,e){const{y:i,width:s,height:r,options:a}=n,o=a.callout.start,l=G1(t,a.callout);let c,u;return t==="left"||t==="right"?(c={x:e.x,y:i+ln(r,o)},u={x:c.x+l,y:c.y}):(c={x:e.x+ln(s,o),y:e.y},u={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:u}}function G1(n,t){const e=t.side;return n==="left"||n==="top"?-e:e}function K1(n,t){const e=t.position;return Sd.includes(e)?e:Z1(n,t)}function Z1(n,t){const{x:e,y:i,x2:s,y2:r,width:a,height:o,pointX:l,pointY:c,centerX:u,centerY:d,rotation:h}=n,g={x:u,y:d},p=t.start,y=ln(a,p),x=ln(o,p),w=[e,e+y,e+y,s],v=[i+x,r,i,r],M=[];for(let C=0;C<4;C++){const D=An({x:w[C],y:v[C]},g,Nt(h));M.push({position:Sd[C],distance:Bn(D,{x:l,y:c})})}return M.sort((C,D)=>C.distance-D.distance)[0].position}function Q1({x:n,y:t,width:e,height:i,options:s}){const r=s.borderWidth/2,a=Ft(s.padding);return{x:n+a.left+r,y:t+a.top+r,width:e-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}function J1(n,t,e){const{pointX:i,pointY:s}=n,r=t.margin;let a=i,o=s;return e==="left"?a+=r:e==="right"?a-=r:e==="top"?o+=r:e==="bottom"&&(o-=r),n.inRange(a,o)}const Ga=(n,t,e)=>({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}),Ka=(n,t,e)=>Ga(t,e,Math.abs((n-t.y)/(e.y-t.y))).x,Td=(n,t,e)=>Ga(t,e,Math.abs((n-t.x)/(e.x-t.x))).y,Zi=n=>n*n,tv=(n,t,{x:e,y:i,x2:s,y2:r},a)=>a==="y"?{start:Math.min(i,r),end:Math.max(i,r),value:t}:{start:Math.min(e,s),end:Math.max(e,s),value:n},Cd=(n,t,e,i)=>(1-i)*(1-i)*n+2*(1-i)*i*t+i*i*e,Za=(n,t,e,i)=>({x:Cd(n.x,t.x,e.x,i),y:Cd(n.y,t.y,e.y,i)}),Pd=(n,t,e,i)=>2*(1-i)*(t-n)+2*i*(e-t),Od=(n,t,e,i)=>-Math.atan2(Pd(n.x,t.x,e.x,i),Pd(n.y,t.y,e.y,i))+.5*rt;class Qi extends Yt{inRange(t,e,i,s){const r=this.options.borderWidth/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:e},{path:o,ctx:l}=this;if(o){cn(l,this.options);const{chart:u}=this.$context,d=t*u.currentDevicePixelRatio,h=e*u.currentDevicePixelRatio,g=l.isPointInStroke(o,d,h)||Qa(this,a,s);return l.restore(),g}const c=Zi(r);return sv(this,a,c,s)||Qa(this,a,s)}return ev(this,{mouseX:t,mouseY:e},i,{hBorderWidth:r,useFinalPosition:s})}getCenterPoint(t){return ti(this,t)}draw(t){const{x:e,y:i,x2:s,y2:r,cp:a,options:o}=this;if(t.save(),!cn(t,o))return t.restore();ei(t,o);const l=Math.sqrt(Math.pow(s-e,2)+Math.pow(r-i,2));if(o.curve&&a)return hv(t,this,a,l),t.restore();const{startOpts:c,endOpts:u,startAdjust:d,endAdjust:h}=Id(this),g=Math.atan2(r-i,s-e);t.translate(e,i),t.rotate(g),t.beginPath(),t.moveTo(0+d,0),t.lineTo(l-h,0),t.shadowColor=o.borderShadowColor,t.stroke(),Ja(t,0,d,c),Ja(t,l,-h,u),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){const i=D1(t,e),{x:s,y:r,x2:a,y2:o}=i,l=nv(i,t.chartArea),c=l?iv({x:s,y:r},{x:a,y:o},t.chartArea):{x:s,y:r,x2:a,y2:o,width:Math.abs(a-s),height:Math.abs(o-r)};if(c.centerX=(a+s)/2,c.centerY=(o+r)/2,c.initProperties=Gi(t,c,e),e.curve){const d={x:c.x,y:c.y},h={x:c.x2,y:c.y2};c.cp=dv(c,e,Bn(d,h))}const u=rv(t,c,e.label);return u._visible=l,c.elements=[{type:"label",optionScope:"label",properties:u,initProperties:c.initProperties}],c}}Qi.id="lineAnnotation";const Ed={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};Qi.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Ed),fill:!1,length:12,start:Object.assign({},Ed),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Ki.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Qi.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},Qi.defaultRoutes={borderColor:"color"};function ev(n,{mouseX:t,mouseY:e},i,{hBorderWidth:s,useFinalPosition:r}){const a=tv(t,e,n.getProps(["x","y","x2","y2"],r),i);return a.value>=a.start-s&&a.value<=a.end+s||Qa(n,{mouseX:t,mouseY:e},r,i)}function nv({x:n,y:t,x2:e,y2:i},{top:s,right:r,bottom:a,left:o}){return!(n<o&&e<o||n>r&&e>r||t<s&&i<s||t>a&&i>a)}function Ad({x:n,y:t},e,{top:i,right:s,bottom:r,left:a}){return n<a&&(t=Td(a,{x:n,y:t},e),n=a),n>s&&(t=Td(s,{x:n,y:t},e),n=s),t<i&&(n=Ka(i,{x:n,y:t},e),t=i),t>r&&(n=Ka(r,{x:n,y:t},e),t=r),{x:n,y:t}}function iv(n,t,e){const{x:i,y:s}=Ad(n,t,e),{x:r,y:a}=Ad(t,n,e);return{x:i,y:s,x2:r,y2:a,width:Math.abs(r-i),height:Math.abs(a-s)}}function sv(n,{mouseX:t,mouseY:e},i=On,s){const{x:r,y:a,x2:o,y2:l}=n.getProps(["x","y","x2","y2"],s),c=o-r,u=l-a,d=Zi(c)+Zi(u),h=d===0?-1:((t-r)*c+(e-a)*u)/d;let g,p;return h<0?(g=r,p=a):h>1?(g=o,p=l):(g=r+h*c,p=a+h*u),Zi(t-g)+Zi(e-p)<=i}function Qa(n,{mouseX:t,mouseY:e},i,s){const r=n.label;return r.options.display&&r.inRange(t,e,s,i)}function rv(n,t,e){const i=e.borderWidth,s=Ft(e.padding),r=$a(n.ctx,e),a=r.width+s.width+i,o=r.height+s.height+i;return ov(t,e,{width:a,height:o,padding:s},n.chartArea)}function av(n){const{x:t,y:e,x2:i,y2:s}=n,r=Math.atan2(s-e,i-t);return r>rt/2?r-rt:r<rt/-2?r+rt:r}function ov(n,t,e,i){const{width:s,height:r,padding:a}=e,{xAdjust:o,yAdjust:l}=t,c={x:n.x,y:n.y},u={x:n.x2,y:n.y2},d=t.rotation==="auto"?av(n):Nt(t.rotation),h=lv(s,r,d),g=cv(n,t,{labelSize:h,padding:a},i),p=n.cp?Za(c,n.cp,u,g):Ga(c,u,g),y={size:h.w,min:i.left,max:i.right,padding:a.left},x={size:h.h,min:i.top,max:i.bottom,padding:a.top},w=Ld(p.x,y)+o,v=Ld(p.y,x)+l;return{x:w-s/2,y:v-r/2,x2:w+s/2,y2:v+r/2,centerX:w,centerY:v,pointX:p.x,pointY:p.y,width:s,height:r,rotation:cs(d)}}function lv(n,t,e){const i=Math.cos(e),s=Math.sin(e);return{w:Math.abs(n*i)+Math.abs(t*s),h:Math.abs(n*s)+Math.abs(t*i)}}function cv(n,t,e,i){let s;const r=uv(n,i);return t.position==="start"?s=Rd({w:n.x2-n.x,h:n.y2-n.y},e,t,r):t.position==="end"?s=1-Rd({w:n.x-n.x2,h:n.y-n.y2},e,t,r):s=Wa(1,t.position),s}function Rd(n,t,e,i){const{labelSize:s,padding:r}=t,a=n.w*i.dx,o=n.h*i.dy,l=a>0&&(s.w/2+r.left-i.x)/a,c=o>0&&(s.h/2+r.top-i.y)/o;return Ks(Math.max(l,c),0,.25)}function uv(n,t){const{x:e,x2:i,y:s,y2:r}=n,a=Math.min(s,r)-t.top,o=Math.min(e,i)-t.left,l=t.bottom-Math.max(s,r),c=t.right-Math.max(e,i);return{x:Math.min(o,c),y:Math.min(a,l),dx:o<=c?1:-1,dy:a<=l?1:-1}}function Ld(n,t){const{size:e,min:i,max:s,padding:r}=t,a=e/2;return e>s-i?(s+i)/2:(i>=n-r-a&&(n=i+r+a),s<=n+r+a&&(n=s-r-a),n)}function Id(n){const t=n.options,e=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:e,endOpts:i,startAdjust:Nd(n,e),endAdjust:Nd(n,i)}}function Nd(n,t){if(!t||!t.display)return 0;const{length:e,width:i}=t,s=n.options.borderWidth/2,r={x:e,y:i+s};return Math.abs(Ka(0,r,{x:0,y:s}))}function Ja(n,t,e,i){if(!i||!i.display)return;const{length:s,width:r,fill:a,backgroundColor:o,borderColor:l}=i,c=Math.abs(t-s)+e;n.beginPath(),ei(n,i),cn(n,i),n.moveTo(c,-r),n.lineTo(t+e,0),n.lineTo(c,r),a===!0?(n.fillStyle=o||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=i.borderShadowColor,n.stroke()}function dv(n,t,e){const{x:i,y:s,x2:r,y2:a,centerX:o,centerY:l}=n,c=Math.atan2(a-s,r-i),u=Ya(t.controlPoint,0),d={x:o+ln(e,u.x,!1),y:l+ln(e,u.y,!1)};return An(d,{x:o,y:l},c)}function Fd(n,{x:t,y:e},{angle:i,adjust:s},r){!r||!r.display||(n.save(),n.translate(t,e),n.rotate(i),Ja(n,0,-s,r),n.restore())}function hv(n,t,e,i){const{x:s,y:r,x2:a,y2:o,options:l}=t,{startOpts:c,endOpts:u,startAdjust:d,endAdjust:h}=Id(t),g={x:s,y:r},p={x:a,y:o},y=Od(g,e,p,0),x=Od(g,e,p,1)-rt,w=Za(g,e,p,d/i),v=Za(g,e,p,1-h/i),M=new Path2D;n.beginPath(),M.moveTo(w.x,w.y),M.quadraticCurveTo(e.x,e.y,v.x,v.y),n.shadowColor=l.borderShadowColor,n.stroke(M),t.path=M,t.ctx=n,Fd(n,w,{angle:y,adjust:d},c),Fd(n,v,{angle:x,adjust:h},u)}class Ji extends Yt{inRange(t,e,i,s){const r=this.options.rotation,a=this.options.borderWidth;if(i!=="x"&&i!=="y")return fv({x:t,y:e},this.getProps(["width","height","centerX","centerY"],s),r,a);const{x:o,y:l,x2:c,y2:u}=this.getProps(["x","y","x2","y2"],s),d=a/2,h=i==="y"?{start:l,end:u}:{start:o,end:c},g=An({x:t,y:e},this.getCenterPoint(s),Nt(-r));return g[i]>=h.start-d-On&&g[i]<=h.end+d+On}getCenterPoint(t){return ti(this,t)}draw(t){const{width:e,height:i,centerX:s,centerY:r,options:a}=this;t.save(),ja(t,this.getCenterPoint(),a.rotation),ei(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const o=cn(t,a);t.ellipse(s,r,i/2,e/2,rt/2,0,2*rt),t.fill(),o&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,e){return yd(t,e)}}Ji.id="ellipseAnnotation",Ji.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},ii.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Ji.defaultRoutes={borderColor:"color",backgroundColor:"color"},Ji.descriptors={label:{_fallback:!0}};function fv(n,t,e,i){const{width:s,height:r,centerX:a,centerY:o}=t,l=s/2,c=r/2;if(l<=0||c<=0)return!1;const u=Nt(e||0),d=i/2||0,h=Math.cos(u),g=Math.sin(u),p=Math.pow(h*(n.x-a)+g*(n.y-o),2),y=Math.pow(g*(n.x-a)-h*(n.y-o),2);return p/Math.pow(l+d,2)+y/Math.pow(c+d,2)<=1.0001}class tr extends Yt{inRange(t,e,i,s){const{x:r,y:a,x2:o,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),u=this.options.borderWidth;if(i!=="x"&&i!=="y")return d1({x:t,y:e},this.getCenterPoint(s),c/2,u);const d=u/2,h=i==="y"?{start:a,end:l,value:e}:{start:r,end:o,value:t};return h.value>=h.start-d&&h.value<=h.end+d}getCenterPoint(t){return ti(this,t)}draw(t){const e=this.options,i=e.borderWidth;if(e.radius<.1)return;t.save(),t.fillStyle=e.backgroundColor,ei(t,e);const s=cn(t,e);_1(t,this,this.centerX,this.centerY),s&&!Qs(e.pointStyle)&&(t.shadowColor=e.borderShadowColor,t.stroke()),t.restore(),e.borderWidth=i}resolveElementProperties(t,e){const i=md(t,e);return i.initProperties=Gi(t,i,e),i}}tr.id="pointAnnotation",tr.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},tr.defaultRoutes={borderColor:"color",backgroundColor:"color"};class er extends Yt{inRange(t,e,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&pv(this.elements,t,e,s);const r=An({x:t,y:e},this.getCenterPoint(s),Nt(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),o=Math.min(...a),l=Math.max(...a);return r[i]>=o&&r[i]<=l}getCenterPoint(t){return ti(this,t)}draw(t){const{elements:e,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,ei(t,i);const s=cn(t,i);let r=!0;for(const a of e)r?(t.moveTo(a.x,a.y),r=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,e){const i=md(t,e),{sides:s,rotation:r}=e,a=[],o=2*rt/s;let l=r*Mr;for(let c=0;c<s;c++,l+=o){const u=gv(i,e,l);u.initProperties=Gi(t,i,e),a.push(u)}return i.elements=a,i}}er.id="polygonAnnotation",er.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},er.defaultRoutes={borderColor:"color",backgroundColor:"color"};function gv({centerX:n,centerY:t},{radius:e,borderWidth:i},s){const r=i/2,a=Math.sin(s),o=Math.cos(s),l={x:n+a*e,y:t-o*e};return{type:"point",optionScope:"point",properties:{x:l.x,y:l.y,centerX:l.x,centerY:l.y,bX:n+a*(e+r),bY:t-o*(e+r)}}}function pv(n,t,e,i){let s=!1,r=n[n.length-1].getProps(["bX","bY"],i);for(const a of n){const o=a.getProps(["bX","bY"],i);o.bY>e!=r.bY>e&&t<(r.bX-o.bX)*(e-o.bY)/(r.bY-o.bY)+o.bX&&(s=!s),r=o}return s}const un={box:ii,ellipse:Ji,label:Ki,line:Qi,point:tr,polygon:er};Object.keys(un).forEach(n=>{Dt.describe(`elements.${un[n].id}`,{_fallback:"plugins.annotation.common"})});const mv={update:Object.assign},yv=Xa.concat(Js),zd=(n,t)=>it(t)?no(n,t):n,to=n=>n==="color"||n==="font";function eo(n="line"){return un[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function bv(n,t,e,i){const s=_v(n,e.animations,i),r=t.annotations,a=kv(t.elements,r);for(let o=0;o<r.length;o++){const l=r[o],c=Bd(a,o,l.type),u=l.setContext(vv(n,c,l)),d=c.resolveElementProperties(n,u);d.skip=xv(d),"elements"in d&&(wv(c,d.elements,u,s),delete d.elements),Qt(c.x)||Object.assign(c,d),Object.assign(c,d.initProperties),d.options=Hd(u),s.update(c,d)}}function xv(n){return isNaN(n.x)||isNaN(n.y)}function _v(n,t,e){return e==="reset"||e==="none"||e==="resize"?mv:new zr(n,t)}function wv(n,t,e,i){const s=n.elements||(n.elements=[]);s.length=t.length;for(let r=0;r<t.length;r++){const a=t[r],o=a.properties,l=Bd(s,r,a.type,a.initProperties),c=e[a.optionScope].override(a);o.options=Hd(c),i.update(l,o)}}function Bd(n,t,e,i){const s=un[eo(e)];let r=n[t];return(!r||!(r instanceof s))&&(r=n[t]=new s,Object.assign(r,i)),r}function Hd(n){const t=un[eo(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,no(n,t.defaults),no(n,t.defaultRoutes));for(const i of yv)e[i]=n[i];return e}function no(n,t){const e={};for(const i of Object.keys(t)){const s=t[i],r=n[i];to(i)&&ot(r)?e[i]=r.map(a=>zd(a,s)):e[i]=zd(r,s)}return e}function vv(n,t,e){return t.$context||(t.$context=Object.assign(Object.create(n.getContext()),{element:t,id:e.id,type:"annotation"}))}function kv(n,t){const e=t.length,i=n.length;if(i<e){const s=e-i;n.splice(i,0,...new Array(s))}else i>e&&n.splice(e,i-e);return n}var Mv="3.0.1";const dn=new Map,Sv=Xa.concat(Js);var Wd={id:"annotation",version:Mv,beforeRegister(){h1("chart.js","4.0",ge.version)},afterRegister(){ge.register(un)},afterUnregister(){ge.unregister(un)},beforeInit(n){dn.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,t,e){const i=dn.get(n),s=i.annotations=[];let r=e.annotations;it(r)?Object.keys(r).forEach(a=>{const o=r[a];it(o)&&(o.id=a,s.push(o))}):ot(r)&&s.push(...r),B1(s,n.scales)},afterDataLimits(n,t){const e=dn.get(n);z1(n,t.scale,e.annotations.filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(n,t,e){const i=dn.get(n);R1(n,i,e),bv(n,i,e,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),F1(n,i,e)},beforeDatasetsDraw(n,t,e){nr(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,t,e){nr(n,"afterDatasetsDraw",e.clip)},beforeDraw(n,t,e){nr(n,"beforeDraw",e.clip)},afterDraw(n,t,e){nr(n,"afterDraw",e.clip)},beforeEvent(n,t,e){const i=dn.get(n);L1(i,t.event,e)&&(t.changed=!0)},afterDestroy(n){dn.delete(n)},_getState(n){return dn.get(n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:n=>!Sv.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,t)=>`elements.${un[eo(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:to,_fallback:!0},_indexable:to}},additionalOptionScopes:[""]};function nr(n,t,e){const{ctx:i,chartArea:s}=n,r=dn.get(n);e&&bi(i,s);const a=Dv(r.visibleElements,t).sort((o,l)=>o.element.options.z-l.element.options.z);for(const o of a)Tv(i,s,r,o);e&&xi(i)}function Dv(n,t){const e=[];for(const i of n)if(i.options.drawTime===t&&e.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&e.push({element:s});return e}function Tv(n,t,e,i){const s=i.element;i.main?(vd(e,s,"beforeDraw"),s.draw(n,t),vd(e,s,"afterDraw")):s.draw(n,t)}const Cv="#6c7489",Pv="#995c00",Ov="20px",Yd="24px",Ev="40px",Av="48px",Rv={class:"tooltip-title"},Lv={class:"title font-bold"},Iv={key:1,class:"subtitle"},Nv={class:"tooltip"},Fv={key:0},zv={class:"display-label"},Bv={class:"display-value"},Hv=f.defineComponent({__name:"ChartTooltip",props:{showTooltip:{type:Boolean,required:!0,default:!1},left:{type:String,required:!1,default:null},top:{type:String,required:!1,default:null},tooltipTitle:{type:String,required:!1,default:""},context:{type:[String,Number],required:!1,default:""},series:{type:Array,required:!0,default:()=>[]},locked:{type:Boolean,required:!1,default:!1}},emits:["dimensions","top","left"],setup(n,{emit:t}){const e=t,i=n,s=f.ref(null),r=f.ref(!1),a=f.ref({x:0,y:0}),o=f.ref({x:0,y:0}),l=f.ref({left:i.left,top:i.top});f.watch(s,g=>{if(g){const{width:p,height:y}=g.getBoundingClientRect();e("dimensions",{width:p,height:y})}}),f.watch(()=>i.locked,g=>{g?(l.value.left=i.left,l.value.top=i.top):g===!1&&(e("top",l.value.top),e("left",l.value.left))});function c(g){if(s.value){r.value=!0;const p=window.getComputedStyle(s.value),y=p.transform||p.webkitTransform||p.mozTransform,x=new DOMMatrix(y),w=x.m41,v=x.m42;a.value={x:w,y:v},o.value={x:g.clientX,y:g.clientY},window.addEventListener("mousemove",d),window.addEventListener("mouseup",h)}}let u=null;function d(g){g.preventDefault(),g.stopPropagation(),r.value&&(u!==null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{const p=g.clientX-o.value.x,y=g.clientY-o.value.y;l.value.left=`${a.value.x+p}px`,l.value.top=`${a.value.y+y}px`}))}function h(){r.value=!1,u!==null&&window.cancelAnimationFrame(u),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}return(g,p)=>n.showTooltip?(f.openBlock(),f.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:f.normalizeClass(["tooltip-container",{locked:n.locked}]),style:f.normalizeStyle({transform:n.locked?`translate(${l.value.left}, ${l.value.top})`:`translate(${n.left}, ${n.top})`,left:"0",top:"0",pointerEvents:n.locked?"all":"none"}),onMousedown:c},[f.createElementVNode("div",Rv,[f.createElementVNode("span",Lv,f.toDisplayString(n.tooltipTitle),1),n.locked?(f.openBlock(),f.createBlock(f.unref(Do.DragIcon),{key:0,class:"drag-icon",color:f.unref(Cv)},null,8,["color"])):f.createCommentVNode("",!0),n.context?(f.openBlock(),f.createElementBlock("span",Iv,f.toDisplayString(n.context),1)):f.createCommentVNode("",!0)]),f.createElementVNode("ul",Nv,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.series,({backgroundColor:y,borderColor:x,label:w,value:v})=>(f.openBlock(),f.createElementBlock(f.Fragment,{key:w},[n.series.length?(f.openBlock(),f.createElementBlock("li",Fv,[f.createElementVNode("div",{class:"square-marker",style:f.normalizeStyle({background:y,"border-color":x})},null,4),f.createElementVNode("span",zv,f.toDisplayString(w),1),f.createElementVNode("span",Bv,f.toDisplayString(v),1)])):f.createCommentVNode("",!0)],64))),128))])],38)):f.createCommentVNode("",!0)}}),We=(n,t)=>{const e=n.__vccOpts||n;for(const[i,s]of t)e[i]=s;return e},io=We(Hv,[["__scopeId","data-v-cd0df662"]]),Wv=["onClick"],Yv=["title"],Vv={key:0,class:"sub-label"},so=We(f.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(n){f.useCssVars(M=>({"143d7c82":o.value}));const t=n,e=f.ref(),i=f.ref([]),s=f.inject("showLegendValues",!0),r=f.inject("legendPosition",f.ref(Pt.Right)),a=f.ref([]),o=f.ref(Yd),l=()=>{const M=e.value;if(!M||!i.value||M.children.length===0)return 0;const C=M.children[0].getBoundingClientRect().top;for(const D of i.value)if(D.getBoundingClientRect().top>C)return!0;return!1},c=f.computed(()=>t.items.length>2||r.value===Pt.Right),u=()=>{e.value&&r.value===Pt.Bottom&&(l()?o.value=Av:o.value=Yd)},d=()=>{if(e.value&&r.value===Pt.Bottom){let M=0;i.value.forEach(D=>{const E=Array.from(D.children).reduce((T,b)=>T+b.offsetWidth,0);E>M&&(M=E)});const C=parseInt(Ev,10);e.value.style.gridTemplateColumns=`repeat(auto-fit, ${M+C}px)`}u()},h=()=>{if(t.items.length!==a.value.length)return a.value=t.items,!0;for(let M=0;M<t.items.length;M++)if(t.items[M].text!==a.value[M].text)return a.value=t.items,!0;return!1};f.watch(()=>t.items,()=>{h()&&d()},{immediate:!0,flush:"post"});const g=f.ref(0),p=f.ref(0),y=new ResizeObserver(xu(M=>{const C=M[0],D=C.contentRect.width,E=C.contentRect.height;D!==g.value&&E===p.value&&d(),g.value=D,p.value=E},100));f.watch(()=>r.value,()=>{d()}),f.onMounted(()=>{a.value=t.items,e.value&&y.observe(e.value),window.requestAnimationFrame(()=>{d()})}),f.onBeforeUnmount(()=>{e.value&&y.unobserve(e.value)});const x=(M=0,C)=>{if(t.chartInstance===null)return;const D=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart;w(M,C)?D.hide(M,C):D.show(M,C),D.update()},w=(M=0,C)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const D=t.chartInstance instanceof ge?t.chartInstance:t.chartInstance.chart,E=D.getDatasetMeta(M);return E.dataset||C===void 0?D.isDatasetVisible(M):!(E.data.length&&E.data[C].hidden)},v=M=>({[Pt.Right]:"vertical",[Pt.Bottom]:"horizontal",[Pt.Hidden]:"hidden"})[M];return(M,C)=>f.unref(r)!==f.unref(Pt).Hidden?(f.openBlock(),f.createElementBlock("ul",{key:0,ref_key:"legendContainerRef",ref:e,class:f.normalizeClass(["legend-container",v(f.unref(r))]),"data-testid":"legend"},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.items,({fillStyle:D,strokeStyle:E,text:T,datasetIndex:b,index:_,value:S})=>(f.openBlock(),f.createElementBlock("li",{key:T,ref_for:!0,ref_key:"legendItemsRef",ref:i,onClick:O=>x(b,_)},[f.createElementVNode("div",{class:"square-marker",style:f.normalizeStyle({background:D,"border-color":E})},null,4),f.createElementVNode("div",{class:f.normalizeClass(["label-container",{"strike-through":!w(b,_)}])},[f.createElementVNode("div",{class:f.normalizeClass(["label",{"truncate-label":c.value}]),title:T},f.toDisplayString(T),11,Yv),S&&f.unref(s)?(f.openBlock(),f.createElementBlock("div",Vv,f.toDisplayString(S.formatted),1)):f.createCommentVNode("",!0)],2)],8,Wv))),128))],2)):f.createCommentVNode("",!0)}}),[["__scopeId","data-v-bf35eae8"]]);for(var Vt=[],ro=0;ro<256;++ro)Vt.push((ro+256).toString(16).slice(1));function jv(n,t=0){return(Vt[n[t+0]]+Vt[n[t+1]]+Vt[n[t+2]]+Vt[n[t+3]]+"-"+Vt[n[t+4]]+Vt[n[t+5]]+"-"+Vt[n[t+6]]+Vt[n[t+7]]+"-"+Vt[n[t+8]]+Vt[n[t+9]]+"-"+Vt[n[t+10]]+Vt[n[t+11]]+Vt[n[t+12]]+Vt[n[t+13]]+Vt[n[t+14]]+Vt[n[t+15]]).toLowerCase()}var ir,$v=new Uint8Array(16);function qv(){if(!ir&&(ir=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ir))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ir($v)}var Uv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Vd={randomUUID:Uv};function hn(n,t,e){if(Vd.randomUUID&&!t&&!n)return Vd.randomUUID();n=n||{};var i=n.random||(n.rng||qv)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,jv(i)}const jd=(n,t)=>{const e=n.ctx,i=n.scales.y,s=n.scales.x,r=t[t.length-1].element;e.save(),e.strokeStyle="rgba(100, 100, 100, 1)",e.lineWidth=3,n.options.indexAxis==="x"?e.strokeRect(r.x-r.width/2,r.y,r.width,i.bottom-r.y):e.strokeRect(s.left,r.y-r.height/2,r.x-s.left,r.height),e.restore()},$d={id:"highlightPlugin",clicked:!1,afterDatasetsDraw:function(n){this.clickedElements&&this.clickedElements.length&&jd(n,this.clickedElements)},afterEvent:function(n,{event:t}){var s;if(t.type!=="click"||!t.native)return;this.clicked=!this.clicked;const e=((s=n.options.interaction)==null?void 0:s.mode)||"index",i=n.getElementsAtEventForMode(t.native,e,{intersect:!1},!0);i.length&&this.clicked?(this.clickedElements=i,jd(n,this.clickedElements),this.previousHoverOption=n.options.hover,n.options.hover={mode:null}):(delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1)},beforeDestroy(n){delete this.clickedElements,n.options.hover=this.previousHoverOption||n.options.hover,this.clicked=!1}},qd=6,Xv="100%",Gv="100%",Kv=20,Zv=20,Ud=6,Qv=0,Jv=10,tk=10,ek=1,nk=We(f.defineComponent({__name:"StackedBarChart",props:{chartData:{type:Object,required:!1,default:()=>({labels:[],datasets:[]})},tooltipTitle:{type:String,required:!1,default:""},legendValues:{type:Object,required:!1,default:null},metricUnit:{type:String,required:!1,default:""},orientation:{type:String,required:!1,default:"horizontal",validator:n=>["horizontal","vertical"].includes(n)},annotations:{type:Boolean,required:!1,default:!0},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},stacked:{type:Boolean,required:!1,default:!0},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{i18n:e}=gt.useI18n(),{translateUnit:i}=gt.useTranslatedUnits(),s=f.ref(null),r=({chart:L},B)=>{var Z;const V=L.data,U=(Z=V.labels)==null?void 0:Z.indexOf(B);return V.datasets.reduce((Y,W,et)=>{if(L.isDatasetVisible(et)){const X=W.data[U];return isNaN(X)?Y:Y+X}else return Y},0)},a=(L,B,V,U)=>{const Z=U==="horizontal";B===null&&(B=e.t("entityNoName"));const Y={type:"label",yValue:X=>Z?B:r(X,B),xValue:X=>Z?r(X,B):B},W={...Y,position:Z?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>Z?0:-Math.abs(Bx()),content:X=>Da(r(X,B),V)},et={...Y,content:X=>Pu(r(X,B),Cu(X.chart,L)),position:Z?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:X=>Z?Tu(Da(r(X,B),V)):0,color:Su};return{[`${B}-value`]:W,[`${B}-percent`]:et}},o=f.ref(null),l=f.ref(),c=f.ref(hn()),u=hn(),d=hn(),h=f.ref([]),g=f.ref(f.inject("legendPosition",Pt.Right)),p=f.ref({show:!1,top:"0px",left:"0px",text:"",offset:-50}),y=f.toRef(t,"metricUnit"),x=f.computed(()=>f.toRef(t,"orientation").value==="horizontal"),w=f.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:y,translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,locked:!1,chartType:x.value?"horizontal_bar":"vertical_bar",chartTooltipSortFn:t.chartTooltipSortFn}),v=f.ref(0),M=()=>{var L;return t.annotations&&((L=t.chartData.labels)==null?void 0:L.reduce((B,V)=>Object.assign(B,a(t.chartData,V,y.value,t.orientation)),{}))},C={id:c.value,afterUpdate(L){v.value+=1,h.value=L.options.plugins.legend.labels.generateLabels(L).map(B=>({...B,value:t.legendValues&&t.legendValues[B.text]})).sort(t.chartLegendSortFn)}},D={id:u,afterUpdate(L){L.options.plugins.annotation.annotations=t.annotations?M():{}}},b=[C,{id:"axisHover",afterEvent(L,B){if(p.value.show=!1,B.event.type==="mousemove"){const V=B.event,U=L.options.indexAxis,Z=L.scales,Y=L.scales[U].getLabelForValue(Number(L.scales[U].getValueForPixel(V[U])));if((et=>et==="x"?V.y>Z.x.top:V.x<Z.y.right)(U))if(w.locked||(w.showTooltip=!1),Y.length>Ys){const X=L.canvas.getContext("2d").measureText(Y).width,wt=Math.abs(Math.round(V.x-X*.5)),ct=Math.round(V.x+X*.5);p.value.left=U==="x"?`${(wt>0?wt:ct)-p.value.offset}px`:`${V.x-X*.5-p.value.offset}px`,p.value.top=`${V.y-50}px`,p.value.show=!0,p.value.text=Y}else p.value.show=!1;else p.value.show=!1}}},{id:d,afterUpdate(L){L.options.layout.padding.right=x.value?N.value:0}},$d,...t.annotations?[D]:[]],_=f.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),S=f.ref(0),O=f.ref(0),A=new ResizeObserver(xu(L=>{S.value=L[0].contentRect.width,O.value=L[0].contentRect.height},100)),F=f.computed(()=>{var B,V;const L=(V=(B=t.chartData)==null?void 0:B.labels)==null?void 0:V.length;return o.value&&L&&!x.value?`${Math.max(L*(Kv+Ud),S.value)}px`:Xv}),j=f.computed(()=>{var B,V;const L=(V=(B=t.chartData)==null?void 0:B.labels)==null?void 0:V.length;return o.value&&L&&x.value?`${Math.max(L*(Zv+Ud),O.value)}px`:Gv});gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey")),f.onMounted(()=>{t.annotations&&ge.register(Wd),s.value&&(S.value=s.value.offsetWidth,O.value=s.value.offsetHeight,A.observe(s.value))}),f.onUnmounted(()=>{s.value&&A.unobserve(s.value)});const G=f.computed(()=>{const L=gt.useBarChartOptions({tooltipState:w,legendID:c.value,stacked:f.toRef(t,"stacked"),metricAxesTitle:f.toRef(t,"metricAxesTitle"),dimensionAxesTitle:f.toRef(t,"dimensionAxesTitle"),indexAxis:x.value?"y":"x",numLabels:_});return{...L.value,plugins:{...L.value.plugins,annotation:{annotations:M(),clip:!1}},layout:{autoPadding:!1,padding:{right:0,top:6*qd}}}}),$=gt.useChartJSCommon("bar",o,f.toRef(t,"chartData"),b,G),N=f.computed(()=>{v.value;const L=t.chartData.labels,B=t.chartData.datasets,V=L.map((Y,W)=>B.reduce((et,X)=>isNaN(Number(X.data[W]))?et:et+Number(X.data[W]),0)),U=$.value?Cu($.value,t.chartData):Hx(t.chartData);return V.map(Y=>Tu(Da(Y,y.value)+Pu(Y,U))).reduce((Y,W)=>Math.max(Y,W),0)+qd});f.onBeforeUnmount(()=>{ge.unregister(Wd)});const st={[Pt.Right]:"legend-row",[Pt.Bottom]:"column"},z=f.computed(()=>{if(l.value&&$.value){const L=window.devicePixelRatio,B=$.value,V=B.scales.y.width*L+ek,U=(B.scales.y.height+B.scales.y.top+B.scales.x.height)*L,Z=l.value.getContext("2d");return Z.scale(L,L),Z.canvas.width=V,Z.canvas.height=U,Z.canvas.style.width=`${V/L}px`,Z.canvas.style.height=`${U/L}px`,{scale:L,width:V*L,height:U*L,targetCtx:Z}}return null}),At=L=>{const B=L.target;if(z.value&&$.value&&!x.value){const V=z.value.scale,U=z.value.targetCtx,Z=z.value.width,Y=z.value.height,W=$.value,et=W.canvas;U.fillStyle="white",B.scrollLeft>=Qv&&B.scrollLeft<=Jv?(U.globalCompositeOperation="source-over",U.clearRect(0,0,Z,Y),U.drawImage(et,0,0,Z,Y,0,0,Z,Y),U.globalCompositeOperation="destination-over",U.fillRect(0,0,Z,Y)):(U.globalCompositeOperation="source-over",U.fillRect(0,(W.scales.y.height+W.scales.y.top+tk)*V,Z,W.scales.x.height*V))}w.offsetY=B.scrollTop,w.offsetX=B.scrollLeft,p.value.offset=B.scrollLeft},_t=({width:L,height:B})=>{w.width=L,w.height=B};f.watch(()=>t.orientation,()=>{var L;if(l.value&&z.value){const B=z.value.width,V=z.value.height;((L=l.value)==null?void 0:L.getContext("2d")).clearRect(0,0,B,V)}w.showTooltip=!1,w.locked=!1}),f.watch(()=>t.annotations,L=>{$.value&&(L?$.value.options.plugins.annotation.annotations=M(t.chartData):delete $.value.options.plugins.annotation.annotations)});const H=()=>{w.showTooltip&&(w.locked=!w.locked)};return(L,B)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",st[g.value]])},[f.createElementVNode("canvas",{ref_key:"axis",ref:l,class:"axis"},null,512),f.createElementVNode("div",{ref_key:"chartContainerRef",ref:s,class:"chart-container","on:scroll":At,onClick:B[0]||(B[0]=V=>H())},[f.createElementVNode("div",{class:"chart-body",style:f.normalizeStyle({width:F.value,height:j.value})},[f.createElementVNode("canvas",{ref_key:"canvas",ref:o},null,512)],4)],544),p.value.show?(f.openBlock(),f.createElementBlock("div",{key:0,class:"axis-tooltip",style:f.normalizeStyle({top:p.value.top,left:p.value.left})},f.toDisplayString(p.value.text),5)):f.createCommentVNode("",!0),f.createVNode(io,{context:w.tooltipContext,left:w.left,locked:w.locked,series:w.tooltipSeries,"show-tooltip":w.showTooltip,"tooltip-title":n.tooltipTitle,top:w.top,onDimensions:_t},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top"]),f.createVNode(so,{id:c.value,"chart-instance":f.unref($),items:h.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-3a47e0ef"]]);/*!
24
24
  * chartjs-adapter-date-fns v3.0.0
25
25
  * https://www.chartjs.org
26
26
  * (c) 2022 chartjs-adapter-date-fns Contributors
27
27
  * Released under the MIT license
28
- */const ik={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Rl._date.override({_id:"date-fns",formats:function(){return ik},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=tt(n):e==="string"&&(typeof t=="string"?n=ix(n,t,new Date,this.options):n=yu(n,this.options)),ga(n)?n.getTime():null},format:function(n,t){return hu(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return ha(n,t);case"second":return Zy(n,t);case"minute":return Gy(n,t);case"hour":return Uy(n,t);case"day":return Fs(n,t);case"week":return Qy(n,t);case"month":return da(n,t);case"quarter":return Ky(n,t);case"year":return Jy(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return pa(n,t);case"second":return ob(n,t);case"minute":return sb(n,t);case"hour":return ib(n,t);case"day":return Kc(n,t);case"week":return lb(n,t);case"month":return tu(n,t);case"quarter":return ab(n,t);case"year":return cb(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return ox(n);case"minute":return ax(n);case"hour":return rx(n);case"day":return fa(n);case"week":return Ce(n);case"isoWeek":return Ce(n,{weekStartsOn:+e});case"month":return db(n);case"quarter":return ub(n);case"year":return eu(n);default:return n}},endOf:function(n,t){switch(t){case"second":return yb(n);case"minute":return pb(n);case"hour":return fb(n);case"day":return Qc(n);case"week":return gb(n);case"month":return Jc(n);case"quarter":return mb(n);case"year":return hb(n);default:return n}}});const Xd={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},sk={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Xd,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},rk=f.version[0]==="2"?(n,t)=>Object.assign(n,{attrs:t}):(n,t)=>Object.assign(n,t);function si(n){return f.isProxy(n)?f.toRaw(n):n}function ak(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n;return f.isProxy(t)?new Proxy(n,{}):n}function ok(n,t){const e=n.options;e&&t&&Object.assign(e,t)}function Gd(n,t){n.labels=t}function Kd(n,t,e){const i=[];n.datasets=t.map(s=>{const r=n.datasets.find(a=>a[e]===s[e]);return!r||!s.data||i.includes(r)?{...s}:(i.push(r),Object.assign(r,s),r)})}function lk(n,t){const e={labels:[],datasets:[]};return Gd(e,n.labels),Kd(e,n.datasets,t),e}const ck=f.defineComponent({props:sk,setup(n,t){let{expose:e,slots:i}=t;const s=f.ref(null),r=f.shallowRef(null);e({chart:r});const a=()=>{if(!s.value)return;const{type:c,data:u,options:d,plugins:h,datasetIdKey:g}=n,p=lk(u,g),y=ak(p,u);r.value=new ge(s.value,{type:c,data:y,options:{...d},plugins:h})},o=()=>{const c=f.toRaw(r.value);c&&(n.destroyDelay>0?setTimeout(()=>{c.destroy(),r.value=null},n.destroyDelay):(c.destroy(),r.value=null))},l=c=>{c.update(n.updateMode)};return f.onMounted(a),f.onUnmounted(o),f.watch([()=>n.options,()=>n.data],(c,u)=>{let[d,h]=c,[g,p]=u;const y=f.toRaw(r.value);if(!y)return;let x=!1;if(d){const w=si(d),v=si(g);w&&w!==v&&(ok(y,w),x=!0)}if(h){const w=si(h.labels),v=si(p.labels),M=si(h.datasets),C=si(p.datasets);w!==v&&(Gd(y.config.data,w),x=!0),M&&M!==C&&(Kd(y.config.data,M,n.datasetIdKey),x=!0)}x&&f.nextTick(()=>{l(y)})},{deep:!0}),()=>f.h("canvas",{role:"img",ariaLabel:n.ariaLabel,ariaDescribedby:n.ariaDescribedby,ref:s},[f.h("p",{},[i.default?i.default():""])])}});function ao(n,t){return ge.register(t),f.defineComponent({props:Xd,setup(e,i){let{expose:s}=i;const r=f.shallowRef(null),a=o=>{r.value=o==null?void 0:o.chart};return s({chart:r}),()=>f.h(ck,rk({ref:a},{type:n,...e}))}})}const uk=ao("bar",vi),Zd=ao("doughnut",nn),dk=ao("line",ki),hk={class:"chart-container"},fk=f.defineComponent({__name:"DoughnutChart",props:{chartData:{type:Object,required:!1,default:null},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Pt.Right},legendValues:{type:Object,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:Be}},setup(n){const t=n,{translateUnit:e}=gt.useTranslatedUnits(),i=f.ref(hn()),s=f.ref(hn()),r=f.ref([]),a=f.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:f.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:"doughnut"}),o={id:i.value,afterUpdate(y){r.value=y.options.plugins.legend.labels.generateLabels(y).map(x=>({...x,value:t.legendValues&&t.legendValues[x.text],hidden:!1}))}},l=f.computed(()=>[o]),c=f.computed(()=>[t.chartData.datasets.reduce((x,w)=>(x.labels.push(w.label),x.backgroundColor.push(w.backgroundColor),x.borderColor.push(Mu(w.backgroundColor,50)),x.data.push(w.data.reduce((v,M)=>v+M,0)),x),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),u=f.computed(()=>({...t.chartData,datasets:c.value}));gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const{options:d}=gt.useDoughnutChartOptions({tooltipState:a,legendID:i.value}),h=f.ref(),g=y=>({[Pt.Right]:"legend-row",[Pt.Bottom]:"column",[Pt.Hidden]:"hidden"})[y],p=({width:y,height:x})=>{a.width=y,a.height=x};return(y,x)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",g(n.legendPosition)]),"data-testid":"doughnut-chart-parent"},[f.createElementVNode("div",hk,[f.createVNode(f.unref(Zd),{ref_key:"chartInstance",ref:h,"chart-id":s.value,data:u.value,options:f.unref(d),plugins:l.value},null,8,["chart-id","data","options","plugins"]),f.createVNode(io,{left:a.left,series:a.tooltipSeries,"show-tooltip":a.showTooltip,"tooltip-title":n.tooltipTitle,top:a.top,unit:n.metricUnit,onDimensions:p},null,8,["left","series","show-tooltip","tooltip-title","top","unit"])]),f.createVNode(so,{id:i.value,"chart-instance":h.value,items:r.value,position:n.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),gk=We(fk,[["__scopeId","data-v-a6b65ed5"]]),Qd=(n,t,e,i)=>{n.save(),n.beginPath(),n.moveTo(t,e),n.lineTo(t,i),n.lineWidth=1,n.strokeStyle="#0275d8",n.stroke(),n.restore()},oo={id:"linePlugin",afterDatasetsDraw:function(n){if(n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&!this.clickedSegment){const{x:t}=n.tooltip.dataPoints[0].element,e=n.ctx;Qd(e,t,n.scales.y.top,n.scales.y.bottom)}if(this.clickedSegment){const{x:t}=this.clickedSegment.element,e=n.ctx;Qd(e,t,n.scales.y.top,n.scales.y.bottom)}},beforeDestroy(){delete this.clickedSegment}},pk=We(f.defineComponent({__name:"TimeSeriesChart",props:{chartData:{type:Object,required:!1,default:null},type:{type:String,required:!1,default:"timeseries_line"},fill:{type:Boolean,required:!1,default:!1},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},timeRangeMs:{type:Number,required:!1,default:void 0},granularity:{type:String,required:!0},stacked:{type:Boolean,required:!1,default:!0},legendValues:{type:Object,required:!1,default:null},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{translateUnit:e}=gt.useTranslatedUnits(),i=f.ref(),s=f.ref(hn()),r=f.ref(hn()),a=f.ref([]),o=f.ref(),l=f.ref(f.inject("legendPosition",Pt.Right)),c=f.reactive({showTooltip:!1,tooltipContext:0,tooltipSeries:[],left:"",top:"",units:f.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:t.type,locked:!1,chartTooltipSortFn:t.chartTooltipSortFn}),u={id:s.value,afterUpdate(w){a.value=w.options.plugins.legend.labels.generateLabels(w).map(v=>({...v,value:t.legendValues&&t.legendValues[v.text]})).sort(t.chartLegendSortFn)}},d=f.computed(()=>[u,$d,...t.type==="timeseries_line"?[oo]:[]]),{options:h}=gt.useLinechartOptions({tooltipState:c,timeRangeMs:f.toRef(t,"timeRangeMs"),granularity:f.toRef(t,"granularity"),legendID:s.value,stacked:f.toRef(t,"stacked"),metricAxesTitle:f.toRef(t,"metricAxesTitle"),dimensionAxesTitle:f.toRef(t,"dimensionAxesTitle")});gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const g=w=>za(w,{short:["daily","weekly"].includes(t.granularity)}),p=w=>({[Pt.Right]:"legend-row",[Pt.Bottom]:"column",[Pt.Hidden]:"hidden"})[w],y=({width:w,height:v})=>{c.width=w,c.height=v},x=()=>{var w,v,M;c.locked=!c.locked,i.value&&((v=(w=i.value.chart.tooltip)==null?void 0:w.dataPoints)!=null&&v.length)&&(oo.clickedSegment=c.locked?(M=i.value.chart.tooltip)==null?void 0:M.dataPoints[0]:void 0)};return f.watch(()=>t.type,()=>{c.locked=!1,c.showTooltip=!1,delete oo.clickedSegment}),(w,v)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",p(l.value)]),"data-testid":"line-chart-parent"},[f.createElementVNode("div",{class:"chart-container",onClick:v[0]||(v[0]=M=>x())},[n.type==="timeseries_line"?(f.openBlock(),f.createBlock(f.unref(dk),{key:0,ref_key:"chartInstance",ref:i,"chart-id":r.value,data:n.chartData,"data-testid":"time-series-line-chart",options:f.unref(h),plugins:d.value},null,8,["chart-id","data","options","plugins"])):n.type==="timeseries_bar"?(f.openBlock(),f.createBlock(f.unref(uk),{key:1,ref_key:"chartInstance",ref:i,"chart-id":r.value,data:n.chartData,"data-testid":"time-series-bar-chart",options:f.unref(h),plugins:d.value},null,8,["chart-id","data","options","plugins"])):f.createCommentVNode("",!0)]),f.createVNode(io,{ref_key:"tooltipElement",ref:o,context:g(c.tooltipContext),"data-testid":"tooltip",left:c.left,locked:c.locked,series:c.tooltipSeries,"show-tooltip":c.showTooltip,"tooltip-title":n.tooltipTitle,top:c.top,unit:n.metricUnit,onDimensions:y,onLeft:v[1]||(v[1]=M=>c.left=M),onTop:v[2]||(v[2]=M=>c.top=M)},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top","unit"]),f.createVNode(so,{id:s.value,"chart-instance":i.value,"data-testid":"legend",items:a.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-2e54baa1"]]);var Rn=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Rn||{});const mk=["doughnut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar"],yk=["gauge","top_n"];var sr={exports:{}};sr.exports,function(n,t){var e=200,i="Expected a function",s="__lodash_hash_undefined__",r=1,a=2,o=1/0,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",h="[object Date]",g="[object Error]",p="[object Function]",y="[object GeneratorFunction]",x="[object Map]",w="[object Number]",v="[object Object]",M="[object Promise]",C="[object RegExp]",D="[object Set]",E="[object String]",T="[object Symbol]",b="[object WeakMap]",_="[object ArrayBuffer]",S="[object DataView]",O="[object Float32Array]",A="[object Float64Array]",F="[object Int8Array]",j="[object Int16Array]",G="[object Int32Array]",$="[object Uint8Array]",N="[object Uint8ClampedArray]",st="[object Uint16Array]",z="[object Uint32Array]",At=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_t=/^\w*$/,H=/^\./,L=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,B=/[\\^$.*+?()[\]{}|]/g,V=/\\(\\)?/g,q=/^\[object .+?Constructor\]$/,Z=/^(?:0|[1-9]\d*)$/,Y={};Y[O]=Y[A]=Y[F]=Y[j]=Y[G]=Y[$]=Y[N]=Y[st]=Y[z]=!0,Y[c]=Y[u]=Y[_]=Y[d]=Y[S]=Y[h]=Y[g]=Y[p]=Y[x]=Y[w]=Y[v]=Y[C]=Y[D]=Y[E]=Y[b]=!1;var W=typeof ne=="object"&&ne&&ne.Object===Object&&ne,et=typeof self=="object"&&self&&self.Object===Object&&self,X=W||et||Function("return this")(),wt=t&&!t.nodeType&&t,ct=wt&&!0&&n&&!n.nodeType&&n,Wt=ct&&ct.exports===wt,Mt=Wt&&W.process,mt=function(){try{return Mt&&Mt.binding("util")}catch{}}(),ie=mt&&mt.isTypedArray;function se(m,k){for(var R=-1,I=m?m.length:0;++R<I;)if(k(m[R],R,m))return!0;return!1}function me(m){return function(k){return k==null?void 0:k[m]}}function ve(m,k){for(var R=-1,I=Array(m);++R<m;)I[R]=k(R);return I}function re(m){return function(k){return m(k)}}function vt(m,k){return m==null?void 0:m[k]}function St(m){var k=!1;if(m!=null&&typeof m.toString!="function")try{k=!!(m+"")}catch{}return k}function Ye(m){var k=-1,R=Array(m.size);return m.forEach(function(I,nt){R[++k]=[nt,I]}),R}function pt(m,k){return function(R){return m(k(R))}}function gn(m){var k=-1,R=Array(m.size);return m.forEach(function(I){R[++k]=I}),R}var ke=Array.prototype,Ve=Function.prototype,de=Object.prototype,ye=X["__core-js_shared__"],Me=function(){var m=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return m?"Symbol(src)_1."+m:""}(),Kt=Ve.toString,ae=de.hasOwnProperty,zt=de.toString,ar=RegExp("^"+Kt.call(ae).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ai=X.Symbol,kh=X.Uint8Array,rS=de.propertyIsEnumerable,aS=ke.splice,oS=pt(Object.keys,Object),yo=oi(X,"DataView"),ts=oi(X,"Map"),bo=oi(X,"Promise"),xo=oi(X,"Set"),_o=oi(X,"WeakMap"),es=oi(Object,"create"),lS=In(yo),cS=In(ts),uS=In(bo),dS=In(xo),hS=In(_o),or=ai?ai.prototype:void 0,wo=or?or.valueOf:void 0,Mh=or?or.toString:void 0;function Ln(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function fS(){this.__data__=es?es(null):{}}function gS(m){return this.has(m)&&delete this.__data__[m]}function pS(m){var k=this.__data__;if(es){var R=k[m];return R===s?void 0:R}return ae.call(k,m)?k[m]:void 0}function mS(m){var k=this.__data__;return es?k[m]!==void 0:ae.call(k,m)}function yS(m,k){var R=this.__data__;return R[m]=es&&k===void 0?s:k,this}Ln.prototype.clear=fS,Ln.prototype.delete=gS,Ln.prototype.get=pS,Ln.prototype.has=mS,Ln.prototype.set=yS;function je(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function bS(){this.__data__=[]}function xS(m){var k=this.__data__,R=cr(k,m);if(R<0)return!1;var I=k.length-1;return R==I?k.pop():aS.call(k,R,1),!0}function _S(m){var k=this.__data__,R=cr(k,m);return R<0?void 0:k[R][1]}function wS(m){return cr(this.__data__,m)>-1}function vS(m,k){var R=this.__data__,I=cr(R,m);return I<0?R.push([m,k]):R[I][1]=k,this}je.prototype.clear=bS,je.prototype.delete=xS,je.prototype.get=_S,je.prototype.has=wS,je.prototype.set=vS;function $e(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function kS(){this.__data__={hash:new Ln,map:new(ts||je),string:new Ln}}function MS(m){return ur(this,m).delete(m)}function SS(m){return ur(this,m).get(m)}function DS(m){return ur(this,m).has(m)}function TS(m,k){return ur(this,m).set(m,k),this}$e.prototype.clear=kS,$e.prototype.delete=MS,$e.prototype.get=SS,$e.prototype.has=DS,$e.prototype.set=TS;function lr(m){var k=-1,R=m?m.length:0;for(this.__data__=new $e;++k<R;)this.add(m[k])}function CS(m){return this.__data__.set(m,s),this}function PS(m){return this.__data__.has(m)}lr.prototype.add=lr.prototype.push=CS,lr.prototype.has=PS;function Ue(m){this.__data__=new je(m)}function OS(){this.__data__=new je}function ES(m){return this.__data__.delete(m)}function AS(m){return this.__data__.get(m)}function RS(m){return this.__data__.has(m)}function LS(m,k){var R=this.__data__;if(R instanceof je){var I=R.__data__;if(!ts||I.length<e-1)return I.push([m,k]),this;R=this.__data__=new $e(I)}return R.set(m,k),this}Ue.prototype.clear=OS,Ue.prototype.delete=ES,Ue.prototype.get=AS,Ue.prototype.has=RS,Ue.prototype.set=LS;function IS(m,k){var R=Nn(m)||Ah(m)?ve(m.length,String):[],I=R.length,nt=!!I;for(var U in m)ae.call(m,U)&&!(nt&&(U=="length"||Ch(U,I)))&&R.push(U);return R}function cr(m,k){for(var R=m.length;R--;)if(Eh(m[R][0],k))return R;return-1}var NS=KS();function FS(m,k){return m&&NS(m,k,pr)}function Sh(m,k){k=dr(k,m)?[k]:Dh(k);for(var R=0,I=k.length;m!=null&&R<I;)m=m[hr(k[R++])];return R&&R==I?m:void 0}function zS(m){return zt.call(m)}function BS(m,k){return m!=null&&k in Object(m)}function vo(m,k,R,I,nt){return m===k?!0:m==null||k==null||!fr(m)&&!gr(k)?m!==m&&k!==k:HS(m,k,vo,R,I,nt)}function HS(m,k,R,I,nt,U){var at=Nn(m),Bt=Nn(k),Rt=u,Ut=u;at||(Rt=pn(m),Rt=Rt==c?v:Rt),Bt||(Ut=pn(k),Ut=Ut==c?v:Ut);var oe=Rt==v&&!St(m),le=Ut==v&&!St(k),Zt=Rt==Ut;if(Zt&&!oe)return U||(U=new Ue),at||aD(m)?Th(m,k,R,I,nt,U):ZS(m,k,Rt,R,I,nt,U);if(!(nt&a)){var be=oe&&ae.call(m,"__wrapped__"),xe=le&&ae.call(k,"__wrapped__");if(be||xe){var mn=be?m.value():m,qe=xe?k.value():k;return U||(U=new Ue),R(mn,qe,I,nt,U)}}return Zt?(U||(U=new Ue),QS(m,k,R,I,nt,U)):!1}function WS(m,k,R,I){var nt=R.length,U=nt;if(m==null)return!U;for(m=Object(m);nt--;){var at=R[nt];if(at[2]?at[1]!==m[at[0]]:!(at[0]in m))return!1}for(;++nt<U;){at=R[nt];var Bt=at[0],Rt=m[Bt],Ut=at[1];if(at[2]){if(Rt===void 0&&!(Bt in m))return!1}else{var oe=new Ue,le;if(!(le===void 0?vo(Ut,Rt,I,r|a,oe):le))return!1}}return!0}function YS(m){if(!fr(m)||nD(m))return!1;var k=Lh(m)||St(m)?ar:q;return k.test(In(m))}function VS(m){return gr(m)&&Mo(m.length)&&!!Y[zt.call(m)]}function jS(m){return typeof m=="function"?m:m==null?dD:typeof m=="object"?Nn(m)?qS(m[0],m[1]):US(m):hD(m)}function $S(m){if(!iD(m))return oS(m);var k=[];for(var R in Object(m))ae.call(m,R)&&R!="constructor"&&k.push(R);return k}function US(m){var k=JS(m);return k.length==1&&k[0][2]?Oh(k[0][0],k[0][1]):function(R){return R===m||WS(R,m,k)}}function qS(m,k){return dr(m)&&Ph(k)?Oh(hr(m),k):function(R){var I=lD(R,m);return I===void 0&&I===k?cD(R,m):vo(k,I,void 0,r|a)}}function XS(m){return function(k){return Sh(k,m)}}function GS(m){if(typeof m=="string")return m;if(So(m))return Mh?Mh.call(m):"";var k=m+"";return k=="0"&&1/m==-o?"-0":k}function Dh(m){return Nn(m)?m:sD(m)}function KS(m){return function(k,R,I){for(var nt=-1,U=Object(k),at=I(k),Bt=at.length;Bt--;){var Rt=at[++nt];if(R(U[Rt],Rt,U)===!1)break}return k}}function Th(m,k,R,I,nt,U){var at=nt&a,Bt=m.length,Rt=k.length;if(Bt!=Rt&&!(at&&Rt>Bt))return!1;var Ut=U.get(m);if(Ut&&U.get(k))return Ut==k;var oe=-1,le=!0,Zt=nt&r?new lr:void 0;for(U.set(m,k),U.set(k,m);++oe<Bt;){var be=m[oe],xe=k[oe];if(I)var mn=at?I(xe,be,oe,k,m,U):I(be,xe,oe,m,k,U);if(mn!==void 0){if(mn)continue;le=!1;break}if(Zt){if(!se(k,function(qe,Fn){if(!Zt.has(Fn)&&(be===qe||R(be,qe,I,nt,U)))return Zt.add(Fn)})){le=!1;break}}else if(!(be===xe||R(be,xe,I,nt,U))){le=!1;break}}return U.delete(m),U.delete(k),le}function ZS(m,k,R,I,nt,U,at){switch(R){case S:if(m.byteLength!=k.byteLength||m.byteOffset!=k.byteOffset)return!1;m=m.buffer,k=k.buffer;case _:return!(m.byteLength!=k.byteLength||!I(new kh(m),new kh(k)));case d:case h:case w:return Eh(+m,+k);case g:return m.name==k.name&&m.message==k.message;case C:case E:return m==k+"";case x:var Bt=Ye;case D:var Rt=U&a;if(Bt||(Bt=gn),m.size!=k.size&&!Rt)return!1;var Ut=at.get(m);if(Ut)return Ut==k;U|=r,at.set(m,k);var oe=Th(Bt(m),Bt(k),I,nt,U,at);return at.delete(m),oe;case T:if(wo)return wo.call(m)==wo.call(k)}return!1}function QS(m,k,R,I,nt,U){var at=nt&a,Bt=pr(m),Rt=Bt.length,Ut=pr(k),oe=Ut.length;if(Rt!=oe&&!at)return!1;for(var le=Rt;le--;){var Zt=Bt[le];if(!(at?Zt in k:ae.call(k,Zt)))return!1}var be=U.get(m);if(be&&U.get(k))return be==k;var xe=!0;U.set(m,k),U.set(k,m);for(var mn=at;++le<Rt;){Zt=Bt[le];var qe=m[Zt],Fn=k[Zt];if(I)var Ih=at?I(Fn,qe,Zt,k,m,U):I(qe,Fn,Zt,m,k,U);if(!(Ih===void 0?qe===Fn||R(qe,Fn,I,nt,U):Ih)){xe=!1;break}mn||(mn=Zt=="constructor")}if(xe&&!mn){var mr=m.constructor,yr=k.constructor;mr!=yr&&"constructor"in m&&"constructor"in k&&!(typeof mr=="function"&&mr instanceof mr&&typeof yr=="function"&&yr instanceof yr)&&(xe=!1)}return U.delete(m),U.delete(k),xe}function ur(m,k){var R=m.__data__;return eD(k)?R[typeof k=="string"?"string":"hash"]:R.map}function JS(m){for(var k=pr(m),R=k.length;R--;){var I=k[R],nt=m[I];k[R]=[I,nt,Ph(nt)]}return k}function oi(m,k){var R=vt(m,k);return YS(R)?R:void 0}var pn=zS;(yo&&pn(new yo(new ArrayBuffer(1)))!=S||ts&&pn(new ts)!=x||bo&&pn(bo.resolve())!=M||xo&&pn(new xo)!=D||_o&&pn(new _o)!=b)&&(pn=function(m){var k=zt.call(m),R=k==v?m.constructor:void 0,I=R?In(R):void 0;if(I)switch(I){case lS:return S;case cS:return x;case uS:return M;case dS:return D;case hS:return b}return k});function tD(m,k,R){k=dr(k,m)?[k]:Dh(k);for(var I,nt=-1,at=k.length;++nt<at;){var U=hr(k[nt]);if(!(I=m!=null&&R(m,U)))break;m=m[U]}if(I)return I;var at=m?m.length:0;return!!at&&Mo(at)&&Ch(U,at)&&(Nn(m)||Ah(m))}function Ch(m,k){return k=k??l,!!k&&(typeof m=="number"||Z.test(m))&&m>-1&&m%1==0&&m<k}function dr(m,k){if(Nn(m))return!1;var R=typeof m;return R=="number"||R=="symbol"||R=="boolean"||m==null||So(m)?!0:_t.test(m)||!At.test(m)||k!=null&&m in Object(k)}function eD(m){var k=typeof m;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?m!=="__proto__":m===null}function nD(m){return!!Me&&Me in m}function iD(m){var k=m&&m.constructor,R=typeof k=="function"&&k.prototype||de;return m===R}function Ph(m){return m===m&&!fr(m)}function Oh(m,k){return function(R){return R==null?!1:R[m]===k&&(k!==void 0||m in Object(R))}}var sD=ko(function(m){m=oD(m);var k=[];return H.test(m)&&k.push(""),m.replace(L,function(R,I,nt,U){k.push(nt?U.replace(V,"$1"):I||R)}),k});function hr(m){if(typeof m=="string"||So(m))return m;var k=m+"";return k=="0"&&1/m==-o?"-0":k}function In(m){if(m!=null){try{return Kt.call(m)}catch{}try{return m+""}catch{}}return""}function ko(m,k){if(typeof m!="function"||k&&typeof k!="function")throw new TypeError(i);var R=function(){var I=arguments,nt=k?k.apply(this,I):I[0],U=R.cache;if(U.has(nt))return U.get(nt);var at=m.apply(this,I);return R.cache=U.set(nt,at),at};return R.cache=new(ko.Cache||$e),R}ko.Cache=$e;function Eh(m,k){return m===k||m!==m&&k!==k}function Ah(m){return rD(m)&&ae.call(m,"callee")&&(!rS.call(m,"callee")||zt.call(m)==c)}var Nn=Array.isArray;function Rh(m){return m!=null&&Mo(m.length)&&!Lh(m)}function rD(m){return gr(m)&&Rh(m)}function Lh(m){var k=fr(m)?zt.call(m):"";return k==p||k==y}function Mo(m){return typeof m=="number"&&m>-1&&m%1==0&&m<=l}function fr(m){var k=typeof m;return!!m&&(k=="object"||k=="function")}function gr(m){return!!m&&typeof m=="object"}function So(m){return typeof m=="symbol"||gr(m)&&zt.call(m)==T}var aD=ie?re(ie):VS;function oD(m){return m==null?"":GS(m)}function lD(m,k,R){var I=m==null?void 0:Sh(m,k);return I===void 0?R:I}function cD(m,k){return m!=null&&tD(m,k,BS)}function pr(m){return Rh(m)?IS(m):$S(m)}function uD(m,k){var R={};return k=jS(k),FS(m,function(I,nt,U){R[k(I,nt,U)]=I}),R}function dD(m){return m}function hD(m){return dr(m)?me(hr(m)):XS(m)}n.exports=uD}(sr,sr.exports);var bk=sr.exports;const xk=Pa(bk);var _k=1/0,wk=9007199254740991,vk="[object Arguments]",kk="[object Function]",Mk="[object GeneratorFunction]",Sk="[object Symbol]",Dk=typeof ne=="object"&&ne&&ne.Object===Object&&ne,Tk=typeof self=="object"&&self&&self.Object===Object&&self,Ck=Dk||Tk||Function("return this")();function Pk(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function Ok(n,t){for(var e=-1,i=n?n.length:0,s=Array(i);++e<i;)s[e]=t(n[e],e,n);return s}function Ek(n,t){for(var e=-1,i=t.length,s=n.length;++e<i;)n[s+e]=t[e];return n}var lo=Object.prototype,Ak=lo.hasOwnProperty,co=lo.toString,Jd=Ck.Symbol,Rk=lo.propertyIsEnumerable,th=Jd?Jd.isConcatSpreadable:void 0,eh=Math.max;function Lk(n,t,e,i,s){var r=-1,a=n.length;for(e||(e=zk),s||(s=[]);++r<a;){var o=n[r];e(o)?Ek(s,o):s[s.length]=o}return s}function Ik(n,t){return n=Object(n),Nk(n,t,function(e,i){return i in n})}function Nk(n,t,e){for(var i=-1,s=t.length,r={};++i<s;){var a=t[i],o=n[a];e(o,a)&&(r[a]=o)}return r}function Fk(n,t){return t=eh(t===void 0?n.length-1:t,0),function(){for(var e=arguments,i=-1,s=eh(e.length-t,0),r=Array(s);++i<s;)r[i]=e[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=e[i];return a[t]=r,Pk(n,this,a)}}function zk(n){return Wk(n)||Hk(n)||!!(th&&n&&n[th])}function Bk(n){if(typeof n=="string"||qk(n))return n;var t=n+"";return t=="0"&&1/n==-_k?"-0":t}function Hk(n){return Vk(n)&&Ak.call(n,"callee")&&(!Rk.call(n,"callee")||co.call(n)==vk)}var Wk=Array.isArray;function Yk(n){return n!=null&&$k(n.length)&&!jk(n)}function Vk(n){return nh(n)&&Yk(n)}function jk(n){var t=Uk(n)?co.call(n):"";return t==kk||t==Mk}function $k(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=wk}function Uk(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function nh(n){return!!n&&typeof n=="object"}function qk(n){return typeof n=="symbol"||nh(n)&&co.call(n)==Sk}var Xk=Fk(function(n,t){return n==null?{}:Ik(n,Ok(Lk(t),Bk))}),Gk=Xk;const Kk=Pa(Gk);var ih={exports:{}};(function(n,t){(function(e,i){i()})(ne,function(){function e(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,d){var h=new XMLHttpRequest;h.open("GET",c),h.responseType="blob",h.onload=function(){l(h.response,u,d)},h.onerror=function(){console.error("could not download file")},h.send()}function s(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ne=="object"&&ne.global===ne?ne:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(c,u,d){var h=a.URL||a.webkitURL,g=document.createElement("a");u=u||c.name||"download",g.download=u,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?r(g):s(g.href)?i(c,u,d):r(g,g.target="_blank")):(g.href=h.createObjectURL(c),setTimeout(function(){h.revokeObjectURL(g.href)},4e4),setTimeout(function(){r(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(e(c,d),u);else if(s(c))i(c,u,d);else{var h=document.createElement("a");h.href=c,h.target="_blank",setTimeout(function(){r(h)})}}:function(c,u,d,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,d);var g=c.type==="application/octet-stream",p=/constructor/i.test(a.HTMLElement)||a.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||g&&p||o)&&typeof FileReader<"u"){var x=new FileReader;x.onloadend=function(){var M=x.result;M=y?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=M:location=M,h=null},x.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,v=w.createObjectURL(c);h?h.location=v:location.href=v,h=null,setTimeout(function(){w.revokeObjectURL(v)},4e4)}});a.saveAs=l.saveAs=l,n.exports=l})})(ih);var Zk=ih.exports,sh={exports:{}};/* @license
28
+ */const ik={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Rl._date.override({_id:"date-fns",formats:function(){return ik},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=tt(n):e==="string"&&(typeof t=="string"?n=ix(n,t,new Date,this.options):n=yu(n,this.options)),ga(n)?n.getTime():null},format:function(n,t){return hu(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return ha(n,t);case"second":return Zy(n,t);case"minute":return Gy(n,t);case"hour":return qy(n,t);case"day":return Fs(n,t);case"week":return Qy(n,t);case"month":return da(n,t);case"quarter":return Ky(n,t);case"year":return Jy(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return pa(n,t);case"second":return ob(n,t);case"minute":return sb(n,t);case"hour":return ib(n,t);case"day":return Kc(n,t);case"week":return lb(n,t);case"month":return tu(n,t);case"quarter":return ab(n,t);case"year":return cb(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return ox(n);case"minute":return ax(n);case"hour":return rx(n);case"day":return fa(n);case"week":return Ce(n);case"isoWeek":return Ce(n,{weekStartsOn:+e});case"month":return db(n);case"quarter":return ub(n);case"year":return eu(n);default:return n}},endOf:function(n,t){switch(t){case"second":return yb(n);case"minute":return pb(n);case"hour":return fb(n);case"day":return Qc(n);case"week":return gb(n);case"month":return Jc(n);case"quarter":return mb(n);case"year":return hb(n);default:return n}}});const Xd={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},sk={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Xd,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},rk=f.version[0]==="2"?(n,t)=>Object.assign(n,{attrs:t}):(n,t)=>Object.assign(n,t);function si(n){return f.isProxy(n)?f.toRaw(n):n}function ak(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n;return f.isProxy(t)?new Proxy(n,{}):n}function ok(n,t){const e=n.options;e&&t&&Object.assign(e,t)}function Gd(n,t){n.labels=t}function Kd(n,t,e){const i=[];n.datasets=t.map(s=>{const r=n.datasets.find(a=>a[e]===s[e]);return!r||!s.data||i.includes(r)?{...s}:(i.push(r),Object.assign(r,s),r)})}function lk(n,t){const e={labels:[],datasets:[]};return Gd(e,n.labels),Kd(e,n.datasets,t),e}const ck=f.defineComponent({props:sk,setup(n,t){let{expose:e,slots:i}=t;const s=f.ref(null),r=f.shallowRef(null);e({chart:r});const a=()=>{if(!s.value)return;const{type:c,data:u,options:d,plugins:h,datasetIdKey:g}=n,p=lk(u,g),y=ak(p,u);r.value=new ge(s.value,{type:c,data:y,options:{...d},plugins:h})},o=()=>{const c=f.toRaw(r.value);c&&(n.destroyDelay>0?setTimeout(()=>{c.destroy(),r.value=null},n.destroyDelay):(c.destroy(),r.value=null))},l=c=>{c.update(n.updateMode)};return f.onMounted(a),f.onUnmounted(o),f.watch([()=>n.options,()=>n.data],(c,u)=>{let[d,h]=c,[g,p]=u;const y=f.toRaw(r.value);if(!y)return;let x=!1;if(d){const w=si(d),v=si(g);w&&w!==v&&(ok(y,w),x=!0)}if(h){const w=si(h.labels),v=si(p.labels),M=si(h.datasets),C=si(p.datasets);w!==v&&(Gd(y.config.data,w),x=!0),M&&M!==C&&(Kd(y.config.data,M,n.datasetIdKey),x=!0)}x&&f.nextTick(()=>{l(y)})},{deep:!0}),()=>f.h("canvas",{role:"img",ariaLabel:n.ariaLabel,ariaDescribedby:n.ariaDescribedby,ref:s},[f.h("p",{},[i.default?i.default():""])])}});function ao(n,t){return ge.register(t),f.defineComponent({props:Xd,setup(e,i){let{expose:s}=i;const r=f.shallowRef(null),a=o=>{r.value=o==null?void 0:o.chart};return s({chart:r}),()=>f.h(ck,rk({ref:a},{type:n,...e}))}})}const uk=ao("bar",vi),Zd=ao("doughnut",nn),dk=ao("line",ki),hk={class:"chart-container"},fk=f.defineComponent({__name:"DoughnutChart",props:{chartData:{type:Object,required:!1,default:null},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Pt.Right},legendValues:{type:Object,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:Be}},setup(n){const t=n,{translateUnit:e}=gt.useTranslatedUnits(),i=f.ref(hn()),s=f.ref(hn()),r=f.ref([]),a=f.reactive({showTooltip:!1,tooltipContext:"",tooltipSeries:[],left:"",top:"",units:f.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:"doughnut"}),o={id:i.value,afterUpdate(y){r.value=y.options.plugins.legend.labels.generateLabels(y).map(x=>({...x,value:t.legendValues&&t.legendValues[x.text],hidden:!1}))}},l=f.computed(()=>[o]),c=f.computed(()=>[t.chartData.datasets.reduce((x,w)=>(x.labels.push(w.label),x.backgroundColor.push(w.backgroundColor),x.borderColor.push(Mu(w.backgroundColor,50)),x.data.push(w.data.reduce((v,M)=>v+M,0)),x),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),u=f.computed(()=>({...t.chartData,datasets:c.value}));gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const{options:d}=gt.useDoughnutChartOptions({tooltipState:a,legendID:i.value}),h=f.ref(),g=y=>({[Pt.Right]:"legend-row",[Pt.Bottom]:"column",[Pt.Hidden]:"hidden"})[y],p=({width:y,height:x})=>{a.width=y,a.height=x};return(y,x)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",g(n.legendPosition)]),"data-testid":"doughnut-chart-parent"},[f.createElementVNode("div",hk,[f.createVNode(f.unref(Zd),{ref_key:"chartInstance",ref:h,"chart-id":s.value,data:u.value,options:f.unref(d),plugins:l.value},null,8,["chart-id","data","options","plugins"]),f.createVNode(io,{left:a.left,series:a.tooltipSeries,"show-tooltip":a.showTooltip,"tooltip-title":n.tooltipTitle,top:a.top,unit:n.metricUnit,onDimensions:p},null,8,["left","series","show-tooltip","tooltip-title","top","unit"])]),f.createVNode(so,{id:i.value,"chart-instance":h.value,items:r.value,position:n.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),gk=We(fk,[["__scopeId","data-v-a6b65ed5"]]),Qd=(n,t,e,i)=>{n.save(),n.beginPath(),n.moveTo(t,e),n.lineTo(t,i),n.lineWidth=1,n.strokeStyle="#0275d8",n.stroke(),n.restore()},oo={id:"linePlugin",afterDatasetsDraw:function(n){if(n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&!this.clickedSegment){const{x:t}=n.tooltip.dataPoints[0].element,e=n.ctx;Qd(e,t,n.scales.y.top,n.scales.y.bottom)}if(this.clickedSegment){const{x:t}=this.clickedSegment.element,e=n.ctx;Qd(e,t,n.scales.y.top,n.scales.y.bottom)}},beforeDestroy(){delete this.clickedSegment}},pk=We(f.defineComponent({__name:"TimeSeriesChart",props:{chartData:{type:Object,required:!1,default:null},type:{type:String,required:!1,default:"timeseries_line"},fill:{type:Boolean,required:!1,default:!1},tooltipTitle:{type:String,required:!0},metricUnit:{type:String,required:!1,default:""},timeRangeMs:{type:Number,required:!1,default:void 0},granularity:{type:String,required:!0},stacked:{type:Boolean,required:!1,default:!0},legendValues:{type:Object,required:!1,default:null},metricAxesTitle:{type:String,required:!1,default:null},dimensionAxesTitle:{type:String,required:!1,default:null},syntheticsDataKey:{type:String,required:!1,default:""},chartLegendSortFn:{type:Function,required:!1,default:(n,t)=>n.value&&t.value&&t.value.raw-n.value.raw},chartTooltipSortFn:{type:Function,required:!1,default:(n,t)=>t.rawValue-n.rawValue}},setup(n){const t=n,{translateUnit:e}=gt.useTranslatedUnits(),i=f.ref(),s=f.ref(hn()),r=f.ref(hn()),a=f.ref([]),o=f.ref(),l=f.ref(f.inject("legendPosition",Pt.Right)),c=f.reactive({showTooltip:!1,tooltipContext:0,tooltipSeries:[],left:"",top:"",units:f.toRef(t,"metricUnit"),translateUnit:e,offsetX:0,offsetY:0,width:0,height:0,chartType:t.type,locked:!1,chartTooltipSortFn:t.chartTooltipSortFn}),u={id:s.value,afterUpdate(w){a.value=w.options.plugins.legend.labels.generateLabels(w).map(v=>({...v,value:t.legendValues&&t.legendValues[v.text]})).sort(t.chartLegendSortFn)}},d=f.computed(()=>[u,$d,...t.type==="timeseries_line"?[oo]:[]]),{options:h}=gt.useLinechartOptions({tooltipState:c,timeRangeMs:f.toRef(t,"timeRangeMs"),granularity:f.toRef(t,"granularity"),legendID:s.value,stacked:f.toRef(t,"stacked"),metricAxesTitle:f.toRef(t,"metricAxesTitle"),dimensionAxesTitle:f.toRef(t,"dimensionAxesTitle")});gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const g=w=>za(w,{short:["daily","weekly"].includes(t.granularity)}),p=w=>({[Pt.Right]:"legend-row",[Pt.Bottom]:"column",[Pt.Hidden]:"hidden"})[w],y=({width:w,height:v})=>{c.width=w,c.height=v},x=()=>{var w,v,M;c.locked=!c.locked,i.value&&((v=(w=i.value.chart.tooltip)==null?void 0:w.dataPoints)!=null&&v.length)&&(oo.clickedSegment=c.locked?(M=i.value.chart.tooltip)==null?void 0:M.dataPoints[0]:void 0)};return f.watch(()=>t.type,()=>{c.locked=!1,c.showTooltip=!1,delete oo.clickedSegment}),(w,v)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["chart-parent",p(l.value)]),"data-testid":"line-chart-parent"},[f.createElementVNode("div",{class:"chart-container",onClick:v[0]||(v[0]=M=>x())},[n.type==="timeseries_line"?(f.openBlock(),f.createBlock(f.unref(dk),{key:0,ref_key:"chartInstance",ref:i,"chart-id":r.value,data:n.chartData,"data-testid":"time-series-line-chart",options:f.unref(h),plugins:d.value},null,8,["chart-id","data","options","plugins"])):n.type==="timeseries_bar"?(f.openBlock(),f.createBlock(f.unref(uk),{key:1,ref_key:"chartInstance",ref:i,"chart-id":r.value,data:n.chartData,"data-testid":"time-series-bar-chart",options:f.unref(h),plugins:d.value},null,8,["chart-id","data","options","plugins"])):f.createCommentVNode("",!0)]),f.createVNode(io,{ref_key:"tooltipElement",ref:o,context:g(c.tooltipContext),"data-testid":"tooltip",left:c.left,locked:c.locked,series:c.tooltipSeries,"show-tooltip":c.showTooltip,"tooltip-title":n.tooltipTitle,top:c.top,unit:n.metricUnit,onDimensions:y,onLeft:v[1]||(v[1]=M=>c.left=M),onTop:v[2]||(v[2]=M=>c.top=M)},null,8,["context","left","locked","series","show-tooltip","tooltip-title","top","unit"]),f.createVNode(so,{id:s.value,"chart-instance":i.value,"data-testid":"legend",items:a.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-2e54baa1"]]);var Rn=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Rn||{});const mk=["doughnut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar"],yk=["gauge","top_n"];var sr={exports:{}};sr.exports,function(n,t){var e=200,i="Expected a function",s="__lodash_hash_undefined__",r=1,a=2,o=1/0,l=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object Boolean]",h="[object Date]",g="[object Error]",p="[object Function]",y="[object GeneratorFunction]",x="[object Map]",w="[object Number]",v="[object Object]",M="[object Promise]",C="[object RegExp]",D="[object Set]",E="[object String]",T="[object Symbol]",b="[object WeakMap]",_="[object ArrayBuffer]",S="[object DataView]",O="[object Float32Array]",A="[object Float64Array]",F="[object Int8Array]",j="[object Int16Array]",G="[object Int32Array]",$="[object Uint8Array]",N="[object Uint8ClampedArray]",st="[object Uint16Array]",z="[object Uint32Array]",At=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_t=/^\w*$/,H=/^\./,L=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,B=/[\\^$.*+?()[\]{}|]/g,V=/\\(\\)?/g,U=/^\[object .+?Constructor\]$/,Z=/^(?:0|[1-9]\d*)$/,Y={};Y[O]=Y[A]=Y[F]=Y[j]=Y[G]=Y[$]=Y[N]=Y[st]=Y[z]=!0,Y[c]=Y[u]=Y[_]=Y[d]=Y[S]=Y[h]=Y[g]=Y[p]=Y[x]=Y[w]=Y[v]=Y[C]=Y[D]=Y[E]=Y[b]=!1;var W=typeof ne=="object"&&ne&&ne.Object===Object&&ne,et=typeof self=="object"&&self&&self.Object===Object&&self,X=W||et||Function("return this")(),wt=t&&!t.nodeType&&t,ct=wt&&!0&&n&&!n.nodeType&&n,Wt=ct&&ct.exports===wt,Mt=Wt&&W.process,mt=function(){try{return Mt&&Mt.binding("util")}catch{}}(),ie=mt&&mt.isTypedArray;function se(m,k){for(var R=-1,I=m?m.length:0;++R<I;)if(k(m[R],R,m))return!0;return!1}function me(m){return function(k){return k==null?void 0:k[m]}}function ve(m,k){for(var R=-1,I=Array(m);++R<m;)I[R]=k(R);return I}function re(m){return function(k){return m(k)}}function vt(m,k){return m==null?void 0:m[k]}function St(m){var k=!1;if(m!=null&&typeof m.toString!="function")try{k=!!(m+"")}catch{}return k}function Ye(m){var k=-1,R=Array(m.size);return m.forEach(function(I,nt){R[++k]=[nt,I]}),R}function pt(m,k){return function(R){return m(k(R))}}function gn(m){var k=-1,R=Array(m.size);return m.forEach(function(I){R[++k]=I}),R}var ke=Array.prototype,Ve=Function.prototype,de=Object.prototype,ye=X["__core-js_shared__"],Me=function(){var m=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return m?"Symbol(src)_1."+m:""}(),Kt=Ve.toString,ae=de.hasOwnProperty,zt=de.toString,ar=RegExp("^"+Kt.call(ae).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ai=X.Symbol,kh=X.Uint8Array,rS=de.propertyIsEnumerable,aS=ke.splice,oS=pt(Object.keys,Object),yo=oi(X,"DataView"),ts=oi(X,"Map"),bo=oi(X,"Promise"),xo=oi(X,"Set"),_o=oi(X,"WeakMap"),es=oi(Object,"create"),lS=In(yo),cS=In(ts),uS=In(bo),dS=In(xo),hS=In(_o),or=ai?ai.prototype:void 0,wo=or?or.valueOf:void 0,Mh=or?or.toString:void 0;function Ln(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function fS(){this.__data__=es?es(null):{}}function gS(m){return this.has(m)&&delete this.__data__[m]}function pS(m){var k=this.__data__;if(es){var R=k[m];return R===s?void 0:R}return ae.call(k,m)?k[m]:void 0}function mS(m){var k=this.__data__;return es?k[m]!==void 0:ae.call(k,m)}function yS(m,k){var R=this.__data__;return R[m]=es&&k===void 0?s:k,this}Ln.prototype.clear=fS,Ln.prototype.delete=gS,Ln.prototype.get=pS,Ln.prototype.has=mS,Ln.prototype.set=yS;function je(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function bS(){this.__data__=[]}function xS(m){var k=this.__data__,R=cr(k,m);if(R<0)return!1;var I=k.length-1;return R==I?k.pop():aS.call(k,R,1),!0}function _S(m){var k=this.__data__,R=cr(k,m);return R<0?void 0:k[R][1]}function wS(m){return cr(this.__data__,m)>-1}function vS(m,k){var R=this.__data__,I=cr(R,m);return I<0?R.push([m,k]):R[I][1]=k,this}je.prototype.clear=bS,je.prototype.delete=xS,je.prototype.get=_S,je.prototype.has=wS,je.prototype.set=vS;function $e(m){var k=-1,R=m?m.length:0;for(this.clear();++k<R;){var I=m[k];this.set(I[0],I[1])}}function kS(){this.__data__={hash:new Ln,map:new(ts||je),string:new Ln}}function MS(m){return ur(this,m).delete(m)}function SS(m){return ur(this,m).get(m)}function DS(m){return ur(this,m).has(m)}function TS(m,k){return ur(this,m).set(m,k),this}$e.prototype.clear=kS,$e.prototype.delete=MS,$e.prototype.get=SS,$e.prototype.has=DS,$e.prototype.set=TS;function lr(m){var k=-1,R=m?m.length:0;for(this.__data__=new $e;++k<R;)this.add(m[k])}function CS(m){return this.__data__.set(m,s),this}function PS(m){return this.__data__.has(m)}lr.prototype.add=lr.prototype.push=CS,lr.prototype.has=PS;function qe(m){this.__data__=new je(m)}function OS(){this.__data__=new je}function ES(m){return this.__data__.delete(m)}function AS(m){return this.__data__.get(m)}function RS(m){return this.__data__.has(m)}function LS(m,k){var R=this.__data__;if(R instanceof je){var I=R.__data__;if(!ts||I.length<e-1)return I.push([m,k]),this;R=this.__data__=new $e(I)}return R.set(m,k),this}qe.prototype.clear=OS,qe.prototype.delete=ES,qe.prototype.get=AS,qe.prototype.has=RS,qe.prototype.set=LS;function IS(m,k){var R=Nn(m)||Ah(m)?ve(m.length,String):[],I=R.length,nt=!!I;for(var q in m)ae.call(m,q)&&!(nt&&(q=="length"||Ch(q,I)))&&R.push(q);return R}function cr(m,k){for(var R=m.length;R--;)if(Eh(m[R][0],k))return R;return-1}var NS=KS();function FS(m,k){return m&&NS(m,k,pr)}function Sh(m,k){k=dr(k,m)?[k]:Dh(k);for(var R=0,I=k.length;m!=null&&R<I;)m=m[hr(k[R++])];return R&&R==I?m:void 0}function zS(m){return zt.call(m)}function BS(m,k){return m!=null&&k in Object(m)}function vo(m,k,R,I,nt){return m===k?!0:m==null||k==null||!fr(m)&&!gr(k)?m!==m&&k!==k:HS(m,k,vo,R,I,nt)}function HS(m,k,R,I,nt,q){var at=Nn(m),Bt=Nn(k),Rt=u,qt=u;at||(Rt=pn(m),Rt=Rt==c?v:Rt),Bt||(qt=pn(k),qt=qt==c?v:qt);var oe=Rt==v&&!St(m),le=qt==v&&!St(k),Zt=Rt==qt;if(Zt&&!oe)return q||(q=new qe),at||aD(m)?Th(m,k,R,I,nt,q):ZS(m,k,Rt,R,I,nt,q);if(!(nt&a)){var be=oe&&ae.call(m,"__wrapped__"),xe=le&&ae.call(k,"__wrapped__");if(be||xe){var mn=be?m.value():m,Ue=xe?k.value():k;return q||(q=new qe),R(mn,Ue,I,nt,q)}}return Zt?(q||(q=new qe),QS(m,k,R,I,nt,q)):!1}function WS(m,k,R,I){var nt=R.length,q=nt;if(m==null)return!q;for(m=Object(m);nt--;){var at=R[nt];if(at[2]?at[1]!==m[at[0]]:!(at[0]in m))return!1}for(;++nt<q;){at=R[nt];var Bt=at[0],Rt=m[Bt],qt=at[1];if(at[2]){if(Rt===void 0&&!(Bt in m))return!1}else{var oe=new qe,le;if(!(le===void 0?vo(qt,Rt,I,r|a,oe):le))return!1}}return!0}function YS(m){if(!fr(m)||nD(m))return!1;var k=Lh(m)||St(m)?ar:U;return k.test(In(m))}function VS(m){return gr(m)&&Mo(m.length)&&!!Y[zt.call(m)]}function jS(m){return typeof m=="function"?m:m==null?dD:typeof m=="object"?Nn(m)?US(m[0],m[1]):qS(m):hD(m)}function $S(m){if(!iD(m))return oS(m);var k=[];for(var R in Object(m))ae.call(m,R)&&R!="constructor"&&k.push(R);return k}function qS(m){var k=JS(m);return k.length==1&&k[0][2]?Oh(k[0][0],k[0][1]):function(R){return R===m||WS(R,m,k)}}function US(m,k){return dr(m)&&Ph(k)?Oh(hr(m),k):function(R){var I=lD(R,m);return I===void 0&&I===k?cD(R,m):vo(k,I,void 0,r|a)}}function XS(m){return function(k){return Sh(k,m)}}function GS(m){if(typeof m=="string")return m;if(So(m))return Mh?Mh.call(m):"";var k=m+"";return k=="0"&&1/m==-o?"-0":k}function Dh(m){return Nn(m)?m:sD(m)}function KS(m){return function(k,R,I){for(var nt=-1,q=Object(k),at=I(k),Bt=at.length;Bt--;){var Rt=at[++nt];if(R(q[Rt],Rt,q)===!1)break}return k}}function Th(m,k,R,I,nt,q){var at=nt&a,Bt=m.length,Rt=k.length;if(Bt!=Rt&&!(at&&Rt>Bt))return!1;var qt=q.get(m);if(qt&&q.get(k))return qt==k;var oe=-1,le=!0,Zt=nt&r?new lr:void 0;for(q.set(m,k),q.set(k,m);++oe<Bt;){var be=m[oe],xe=k[oe];if(I)var mn=at?I(xe,be,oe,k,m,q):I(be,xe,oe,m,k,q);if(mn!==void 0){if(mn)continue;le=!1;break}if(Zt){if(!se(k,function(Ue,Fn){if(!Zt.has(Fn)&&(be===Ue||R(be,Ue,I,nt,q)))return Zt.add(Fn)})){le=!1;break}}else if(!(be===xe||R(be,xe,I,nt,q))){le=!1;break}}return q.delete(m),q.delete(k),le}function ZS(m,k,R,I,nt,q,at){switch(R){case S:if(m.byteLength!=k.byteLength||m.byteOffset!=k.byteOffset)return!1;m=m.buffer,k=k.buffer;case _:return!(m.byteLength!=k.byteLength||!I(new kh(m),new kh(k)));case d:case h:case w:return Eh(+m,+k);case g:return m.name==k.name&&m.message==k.message;case C:case E:return m==k+"";case x:var Bt=Ye;case D:var Rt=q&a;if(Bt||(Bt=gn),m.size!=k.size&&!Rt)return!1;var qt=at.get(m);if(qt)return qt==k;q|=r,at.set(m,k);var oe=Th(Bt(m),Bt(k),I,nt,q,at);return at.delete(m),oe;case T:if(wo)return wo.call(m)==wo.call(k)}return!1}function QS(m,k,R,I,nt,q){var at=nt&a,Bt=pr(m),Rt=Bt.length,qt=pr(k),oe=qt.length;if(Rt!=oe&&!at)return!1;for(var le=Rt;le--;){var Zt=Bt[le];if(!(at?Zt in k:ae.call(k,Zt)))return!1}var be=q.get(m);if(be&&q.get(k))return be==k;var xe=!0;q.set(m,k),q.set(k,m);for(var mn=at;++le<Rt;){Zt=Bt[le];var Ue=m[Zt],Fn=k[Zt];if(I)var Ih=at?I(Fn,Ue,Zt,k,m,q):I(Ue,Fn,Zt,m,k,q);if(!(Ih===void 0?Ue===Fn||R(Ue,Fn,I,nt,q):Ih)){xe=!1;break}mn||(mn=Zt=="constructor")}if(xe&&!mn){var mr=m.constructor,yr=k.constructor;mr!=yr&&"constructor"in m&&"constructor"in k&&!(typeof mr=="function"&&mr instanceof mr&&typeof yr=="function"&&yr instanceof yr)&&(xe=!1)}return q.delete(m),q.delete(k),xe}function ur(m,k){var R=m.__data__;return eD(k)?R[typeof k=="string"?"string":"hash"]:R.map}function JS(m){for(var k=pr(m),R=k.length;R--;){var I=k[R],nt=m[I];k[R]=[I,nt,Ph(nt)]}return k}function oi(m,k){var R=vt(m,k);return YS(R)?R:void 0}var pn=zS;(yo&&pn(new yo(new ArrayBuffer(1)))!=S||ts&&pn(new ts)!=x||bo&&pn(bo.resolve())!=M||xo&&pn(new xo)!=D||_o&&pn(new _o)!=b)&&(pn=function(m){var k=zt.call(m),R=k==v?m.constructor:void 0,I=R?In(R):void 0;if(I)switch(I){case lS:return S;case cS:return x;case uS:return M;case dS:return D;case hS:return b}return k});function tD(m,k,R){k=dr(k,m)?[k]:Dh(k);for(var I,nt=-1,at=k.length;++nt<at;){var q=hr(k[nt]);if(!(I=m!=null&&R(m,q)))break;m=m[q]}if(I)return I;var at=m?m.length:0;return!!at&&Mo(at)&&Ch(q,at)&&(Nn(m)||Ah(m))}function Ch(m,k){return k=k??l,!!k&&(typeof m=="number"||Z.test(m))&&m>-1&&m%1==0&&m<k}function dr(m,k){if(Nn(m))return!1;var R=typeof m;return R=="number"||R=="symbol"||R=="boolean"||m==null||So(m)?!0:_t.test(m)||!At.test(m)||k!=null&&m in Object(k)}function eD(m){var k=typeof m;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?m!=="__proto__":m===null}function nD(m){return!!Me&&Me in m}function iD(m){var k=m&&m.constructor,R=typeof k=="function"&&k.prototype||de;return m===R}function Ph(m){return m===m&&!fr(m)}function Oh(m,k){return function(R){return R==null?!1:R[m]===k&&(k!==void 0||m in Object(R))}}var sD=ko(function(m){m=oD(m);var k=[];return H.test(m)&&k.push(""),m.replace(L,function(R,I,nt,q){k.push(nt?q.replace(V,"$1"):I||R)}),k});function hr(m){if(typeof m=="string"||So(m))return m;var k=m+"";return k=="0"&&1/m==-o?"-0":k}function In(m){if(m!=null){try{return Kt.call(m)}catch{}try{return m+""}catch{}}return""}function ko(m,k){if(typeof m!="function"||k&&typeof k!="function")throw new TypeError(i);var R=function(){var I=arguments,nt=k?k.apply(this,I):I[0],q=R.cache;if(q.has(nt))return q.get(nt);var at=m.apply(this,I);return R.cache=q.set(nt,at),at};return R.cache=new(ko.Cache||$e),R}ko.Cache=$e;function Eh(m,k){return m===k||m!==m&&k!==k}function Ah(m){return rD(m)&&ae.call(m,"callee")&&(!rS.call(m,"callee")||zt.call(m)==c)}var Nn=Array.isArray;function Rh(m){return m!=null&&Mo(m.length)&&!Lh(m)}function rD(m){return gr(m)&&Rh(m)}function Lh(m){var k=fr(m)?zt.call(m):"";return k==p||k==y}function Mo(m){return typeof m=="number"&&m>-1&&m%1==0&&m<=l}function fr(m){var k=typeof m;return!!m&&(k=="object"||k=="function")}function gr(m){return!!m&&typeof m=="object"}function So(m){return typeof m=="symbol"||gr(m)&&zt.call(m)==T}var aD=ie?re(ie):VS;function oD(m){return m==null?"":GS(m)}function lD(m,k,R){var I=m==null?void 0:Sh(m,k);return I===void 0?R:I}function cD(m,k){return m!=null&&tD(m,k,BS)}function pr(m){return Rh(m)?IS(m):$S(m)}function uD(m,k){var R={};return k=jS(k),FS(m,function(I,nt,q){R[k(I,nt,q)]=I}),R}function dD(m){return m}function hD(m){return dr(m)?me(hr(m)):XS(m)}n.exports=uD}(sr,sr.exports);var bk=sr.exports;const xk=Pa(bk);var _k=1/0,wk=9007199254740991,vk="[object Arguments]",kk="[object Function]",Mk="[object GeneratorFunction]",Sk="[object Symbol]",Dk=typeof ne=="object"&&ne&&ne.Object===Object&&ne,Tk=typeof self=="object"&&self&&self.Object===Object&&self,Ck=Dk||Tk||Function("return this")();function Pk(n,t,e){switch(e.length){case 0:return n.call(t);case 1:return n.call(t,e[0]);case 2:return n.call(t,e[0],e[1]);case 3:return n.call(t,e[0],e[1],e[2])}return n.apply(t,e)}function Ok(n,t){for(var e=-1,i=n?n.length:0,s=Array(i);++e<i;)s[e]=t(n[e],e,n);return s}function Ek(n,t){for(var e=-1,i=t.length,s=n.length;++e<i;)n[s+e]=t[e];return n}var lo=Object.prototype,Ak=lo.hasOwnProperty,co=lo.toString,Jd=Ck.Symbol,Rk=lo.propertyIsEnumerable,th=Jd?Jd.isConcatSpreadable:void 0,eh=Math.max;function Lk(n,t,e,i,s){var r=-1,a=n.length;for(e||(e=zk),s||(s=[]);++r<a;){var o=n[r];e(o)?Ek(s,o):s[s.length]=o}return s}function Ik(n,t){return n=Object(n),Nk(n,t,function(e,i){return i in n})}function Nk(n,t,e){for(var i=-1,s=t.length,r={};++i<s;){var a=t[i],o=n[a];e(o,a)&&(r[a]=o)}return r}function Fk(n,t){return t=eh(t===void 0?n.length-1:t,0),function(){for(var e=arguments,i=-1,s=eh(e.length-t,0),r=Array(s);++i<s;)r[i]=e[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=e[i];return a[t]=r,Pk(n,this,a)}}function zk(n){return Wk(n)||Hk(n)||!!(th&&n&&n[th])}function Bk(n){if(typeof n=="string"||Uk(n))return n;var t=n+"";return t=="0"&&1/n==-_k?"-0":t}function Hk(n){return Vk(n)&&Ak.call(n,"callee")&&(!Rk.call(n,"callee")||co.call(n)==vk)}var Wk=Array.isArray;function Yk(n){return n!=null&&$k(n.length)&&!jk(n)}function Vk(n){return nh(n)&&Yk(n)}function jk(n){var t=qk(n)?co.call(n):"";return t==kk||t==Mk}function $k(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=wk}function qk(n){var t=typeof n;return!!n&&(t=="object"||t=="function")}function nh(n){return!!n&&typeof n=="object"}function Uk(n){return typeof n=="symbol"||nh(n)&&co.call(n)==Sk}var Xk=Fk(function(n,t){return n==null?{}:Ik(n,Ok(Lk(t),Bk))}),Gk=Xk;const Kk=Pa(Gk);var ih={exports:{}};(function(n,t){(function(e,i){i()})(ne,function(){function e(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,d){var h=new XMLHttpRequest;h.open("GET",c),h.responseType="blob",h.onload=function(){l(h.response,u,d)},h.onerror=function(){console.error("could not download file")},h.send()}function s(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function r(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ne=="object"&&ne.global===ne?ne:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(c,u,d){var h=a.URL||a.webkitURL,g=document.createElement("a");u=u||c.name||"download",g.download=u,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?r(g):s(g.href)?i(c,u,d):r(g,g.target="_blank")):(g.href=h.createObjectURL(c),setTimeout(function(){h.revokeObjectURL(g.href)},4e4),setTimeout(function(){r(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(e(c,d),u);else if(s(c))i(c,u,d);else{var h=document.createElement("a");h.href=c,h.target="_blank",setTimeout(function(){r(h)})}}:function(c,u,d,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,d);var g=c.type==="application/octet-stream",p=/constructor/i.test(a.HTMLElement)||a.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||g&&p||o)&&typeof FileReader<"u"){var x=new FileReader;x.onloadend=function(){var M=x.result;M=y?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=M:location=M,h=null},x.readAsDataURL(c)}else{var w=a.URL||a.webkitURL,v=w.createObjectURL(c);h?h.location=v:location.href=v,h=null,setTimeout(function(){w.revokeObjectURL(v)},4e4)}});a.saveAs=l.saveAs=l,n.exports=l})})(ih);var Zk=ih.exports,sh={exports:{}};/* @license
29
29
  Papa Parse
30
30
  v5.4.1
31
31
  https://github.com/mholt/PapaParse
32
32
  License: MIT
33
33
  */(function(n,t){(function(e,i){n.exports=i()})(ne,function e(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},s=!i.document&&!!i.postMessage,r=i.IS_PAPA_WORKER||!1,a={},o=0,l={parse:function(b,_){var S=(_=_||{}).dynamicTyping||!1;if(T(S)&&(_.dynamicTypingFunction=S,S={}),_.dynamicTyping=S,_.transform=!!T(_.transform)&&_.transform,_.worker&&l.WORKERS_SUPPORTED){var O=function(){if(!l.WORKERS_SUPPORTED)return!1;var F=(G=i.URL||i.webkitURL||null,$=e.toString(),l.BLOB_URL||(l.BLOB_URL=G.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",$,")();"],{type:"text/javascript"})))),j=new i.Worker(F),G,$;return j.onmessage=v,j.id=o++,a[j.id]=j}();return O.userStep=_.step,O.userChunk=_.chunk,O.userComplete=_.complete,O.userError=_.error,_.step=T(_.step),_.chunk=T(_.chunk),_.complete=T(_.complete),_.error=T(_.error),delete _.worker,void O.postMessage({input:b,config:_,workerId:O.id})}var A=null;return l.NODE_STREAM_INPUT,typeof b=="string"?(b=function(F){return F.charCodeAt(0)===65279?F.slice(1):F}(b),A=_.download?new d(_):new g(_)):b.readable===!0&&T(b.read)&&T(b.on)?A=new p(_):(i.File&&b instanceof File||b instanceof Object)&&(A=new h(_)),A.stream(b)},unparse:function(b,_){var S=!1,O=!0,A=",",F=`\r
34
- `,j='"',G=j+j,$=!1,N=null,st=!1;(function(){if(typeof _=="object"){if(typeof _.delimiter!="string"||l.BAD_DELIMITERS.filter(function(H){return _.delimiter.indexOf(H)!==-1}).length||(A=_.delimiter),(typeof _.quotes=="boolean"||typeof _.quotes=="function"||Array.isArray(_.quotes))&&(S=_.quotes),typeof _.skipEmptyLines!="boolean"&&typeof _.skipEmptyLines!="string"||($=_.skipEmptyLines),typeof _.newline=="string"&&(F=_.newline),typeof _.quoteChar=="string"&&(j=_.quoteChar),typeof _.header=="boolean"&&(O=_.header),Array.isArray(_.columns)){if(_.columns.length===0)throw new Error("Option columns is empty");N=_.columns}_.escapeChar!==void 0&&(G=_.escapeChar+j),(typeof _.escapeFormulae=="boolean"||_.escapeFormulae instanceof RegExp)&&(st=_.escapeFormulae instanceof RegExp?_.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var z=new RegExp(x(j),"g");if(typeof b=="string"&&(b=JSON.parse(b)),Array.isArray(b)){if(!b.length||Array.isArray(b[0]))return At(null,b,$);if(typeof b[0]=="object")return At(N||Object.keys(b[0]),b,$)}else if(typeof b=="object")return typeof b.data=="string"&&(b.data=JSON.parse(b.data)),Array.isArray(b.data)&&(b.fields||(b.fields=b.meta&&b.meta.fields||N),b.fields||(b.fields=Array.isArray(b.data[0])?b.fields:typeof b.data[0]=="object"?Object.keys(b.data[0]):[]),Array.isArray(b.data[0])||typeof b.data[0]=="object"||(b.data=[b.data])),At(b.fields||[],b.data||[],$);throw new Error("Unable to serialize unrecognized input");function At(H,L,B){var V="";typeof H=="string"&&(H=JSON.parse(H)),typeof L=="string"&&(L=JSON.parse(L));var q=Array.isArray(H)&&0<H.length,Z=!Array.isArray(L[0]);if(q&&O){for(var Y=0;Y<H.length;Y++)0<Y&&(V+=A),V+=_t(H[Y],Y);0<L.length&&(V+=F)}for(var W=0;W<L.length;W++){var et=q?H.length:L[W].length,X=!1,wt=q?Object.keys(L[W]).length===0:L[W].length===0;if(B&&!q&&(X=B==="greedy"?L[W].join("").trim()==="":L[W].length===1&&L[W][0].length===0),B==="greedy"&&q){for(var ct=[],Wt=0;Wt<et;Wt++){var Mt=Z?H[Wt]:Wt;ct.push(L[W][Mt])}X=ct.join("").trim()===""}if(!X){for(var mt=0;mt<et;mt++){0<mt&&!wt&&(V+=A);var ie=q&&Z?H[mt]:mt;V+=_t(L[W][ie],mt)}W<L.length-1&&(!B||0<et&&!wt)&&(V+=F)}}return V}function _t(H,L){if(H==null)return"";if(H.constructor===Date)return JSON.stringify(H).slice(1,25);var B=!1;st&&typeof H=="string"&&st.test(H)&&(H="'"+H,B=!0);var V=H.toString().replace(z,G);return(B=B||S===!0||typeof S=="function"&&S(H,L)||Array.isArray(S)&&S[L]||function(q,Z){for(var Y=0;Y<Z.length;Y++)if(-1<q.indexOf(Z[Y]))return!0;return!1}(V,l.BAD_DELIMITERS)||-1<V.indexOf(A)||V.charAt(0)===" "||V.charAt(V.length-1)===" ")?j+V+j:V}}};if(l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",`
35
- `,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!s&&!!i.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=w,l.ParserHandle=y,l.NetworkStreamer=d,l.FileStreamer=h,l.StringStreamer=g,l.ReadableStreamStreamer=p,i.jQuery){var c=i.jQuery;c.fn.parse=function(b){var _=b.config||{},S=[];return this.each(function(F){if(!(c(this).prop("tagName").toUpperCase()==="INPUT"&&c(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var j=0;j<this.files.length;j++)S.push({file:this.files[j],inputElem:this,instanceConfig:c.extend({},_)})}),O(),this;function O(){if(S.length!==0){var F,j,G,$,N=S[0];if(T(b.before)){var st=b.before(N.file,N.inputElem);if(typeof st=="object"){if(st.action==="abort")return F="AbortError",j=N.file,G=N.inputElem,$=st.reason,void(T(b.error)&&b.error({name:F},j,G,$));if(st.action==="skip")return void A();typeof st.config=="object"&&(N.instanceConfig=c.extend(N.instanceConfig,st.config))}else if(st==="skip")return void A()}var z=N.instanceConfig.complete;N.instanceConfig.complete=function(At){T(z)&&z(At,N.file,N.inputElem),A()},l.parse(N.file,N.instanceConfig)}else T(b.complete)&&b.complete()}function A(){S.splice(0,1),O()}}}function u(b){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(_){var S=D(_);S.chunkSize=parseInt(S.chunkSize),_.step||_.chunk||(S.chunkSize=null),this._handle=new y(S),(this._handle.streamer=this)._config=S}).call(this,b),this.parseChunk=function(_,S){if(this.isFirstChunk&&T(this._config.beforeFirstChunk)){var O=this._config.beforeFirstChunk(_);O!==void 0&&(_=O)}this.isFirstChunk=!1,this._halted=!1;var A=this._partialLine+_;this._partialLine="";var F=this._handle.parse(A,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var j=F.meta.cursor;this._finished||(this._partialLine=A.substring(j-this._baseIndex),this._baseIndex=j),F&&F.data&&(this._rowCount+=F.data.length);var G=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)i.postMessage({results:F,workerId:l.WORKER_ID,finished:G});else if(T(this._config.chunk)&&!S){if(this._config.chunk(F,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);F=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(F.data),this._completeResults.errors=this._completeResults.errors.concat(F.errors),this._completeResults.meta=F.meta),this._completed||!G||!T(this._config.complete)||F&&F.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),G||F&&F.meta.paused||this._nextChunk(),F}this._halted=!0},this._sendError=function(_){T(this._config.error)?this._config.error(_):r&&this._config.error&&i.postMessage({workerId:l.WORKER_ID,error:_,finished:!1})}}function d(b){var _;(b=b||{}).chunkSize||(b.chunkSize=l.RemoteChunkSize),u.call(this,b),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(S){this._input=S,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(_=new XMLHttpRequest,this._config.withCredentials&&(_.withCredentials=this._config.withCredentials),s||(_.onload=E(this._chunkLoaded,this),_.onerror=E(this._chunkError,this)),_.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var S=this._config.downloadRequestHeaders;for(var O in S)_.setRequestHeader(O,S[O])}if(this._config.chunkSize){var A=this._start+this._config.chunkSize-1;_.setRequestHeader("Range","bytes="+this._start+"-"+A)}try{_.send(this._config.downloadRequestBody)}catch(F){this._chunkError(F.message)}s&&_.status===0&&this._chunkError()}},this._chunkLoaded=function(){_.readyState===4&&(_.status<200||400<=_.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:_.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(S){var O=S.getResponseHeader("Content-Range");return O===null?-1:parseInt(O.substring(O.lastIndexOf("/")+1))}(_),this.parseChunk(_.responseText)))},this._chunkError=function(S){var O=_.statusText||S;this._sendError(new Error(O))}}function h(b){var _,S;(b=b||{}).chunkSize||(b.chunkSize=l.LocalChunkSize),u.call(this,b);var O=typeof FileReader<"u";this.stream=function(A){this._input=A,S=A.slice||A.webkitSlice||A.mozSlice,O?((_=new FileReader).onload=E(this._chunkLoaded,this),_.onerror=E(this._chunkError,this)):_=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var A=this._input;if(this._config.chunkSize){var F=Math.min(this._start+this._config.chunkSize,this._input.size);A=S.call(A,this._start,F)}var j=_.readAsText(A,this._config.encoding);O||this._chunkLoaded({target:{result:j}})},this._chunkLoaded=function(A){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(A.target.result)},this._chunkError=function(){this._sendError(_.error)}}function g(b){var _;u.call(this,b=b||{}),this.stream=function(S){return _=S,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var S,O=this._config.chunkSize;return O?(S=_.substring(0,O),_=_.substring(O)):(S=_,_=""),this._finished=!_,this.parseChunk(S)}}}function p(b){u.call(this,b=b||{});var _=[],S=!0,O=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(A){this._input=A,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){O&&_.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),_.length?this.parseChunk(_.shift()):S=!0},this._streamData=E(function(A){try{_.push(typeof A=="string"?A:A.toString(this._config.encoding)),S&&(S=!1,this._checkIsFinished(),this.parseChunk(_.shift()))}catch(F){this._streamError(F)}},this),this._streamError=E(function(A){this._streamCleanUp(),this._sendError(A)},this),this._streamEnd=E(function(){this._streamCleanUp(),O=!0,this._streamData("")},this),this._streamCleanUp=E(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(b){var _,S,O,A=Math.pow(2,53),F=-A,j=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,G=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,$=this,N=0,st=0,z=!1,At=!1,_t=[],H={data:[],errors:[],meta:{}};if(T(b.step)){var L=b.step;b.step=function(W){if(H=W,q())V();else{if(V(),H.data.length===0)return;N+=W.data.length,b.preview&&N>b.preview?S.abort():(H.data=H.data[0],L(H,$))}}}function B(W){return b.skipEmptyLines==="greedy"?W.join("").trim()==="":W.length===1&&W[0].length===0}function V(){return H&&O&&(Y("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),O=!1),b.skipEmptyLines&&(H.data=H.data.filter(function(W){return!B(W)})),q()&&function(){if(!H)return;function W(X,wt){T(b.transformHeader)&&(X=b.transformHeader(X,wt)),_t.push(X)}if(Array.isArray(H.data[0])){for(var et=0;q()&&et<H.data.length;et++)H.data[et].forEach(W);H.data.splice(0,1)}else H.data.forEach(W)}(),function(){if(!H||!b.header&&!b.dynamicTyping&&!b.transform)return H;function W(X,wt){var ct,Wt=b.header?{}:[];for(ct=0;ct<X.length;ct++){var Mt=ct,mt=X[ct];b.header&&(Mt=ct>=_t.length?"__parsed_extra":_t[ct]),b.transform&&(mt=b.transform(mt,Mt)),mt=Z(Mt,mt),Mt==="__parsed_extra"?(Wt[Mt]=Wt[Mt]||[],Wt[Mt].push(mt)):Wt[Mt]=mt}return b.header&&(ct>_t.length?Y("FieldMismatch","TooManyFields","Too many fields: expected "+_t.length+" fields but parsed "+ct,st+wt):ct<_t.length&&Y("FieldMismatch","TooFewFields","Too few fields: expected "+_t.length+" fields but parsed "+ct,st+wt)),Wt}var et=1;return!H.data.length||Array.isArray(H.data[0])?(H.data=H.data.map(W),et=H.data.length):H.data=W(H.data,0),b.header&&H.meta&&(H.meta.fields=_t),st+=et,H}()}function q(){return b.header&&_t.length===0}function Z(W,et){return X=W,b.dynamicTypingFunction&&b.dynamicTyping[X]===void 0&&(b.dynamicTyping[X]=b.dynamicTypingFunction(X)),(b.dynamicTyping[X]||b.dynamicTyping)===!0?et==="true"||et==="TRUE"||et!=="false"&&et!=="FALSE"&&(function(wt){if(j.test(wt)){var ct=parseFloat(wt);if(F<ct&&ct<A)return!0}return!1}(et)?parseFloat(et):G.test(et)?new Date(et):et===""?null:et):et;var X}function Y(W,et,X,wt){var ct={type:W,code:et,message:X};wt!==void 0&&(ct.row=wt),H.errors.push(ct)}this.parse=function(W,et,X){var wt=b.quoteChar||'"';if(b.newline||(b.newline=function(Mt,mt){Mt=Mt.substring(0,1048576);var ie=new RegExp(x(mt)+"([^]*?)"+x(mt),"gm"),se=(Mt=Mt.replace(ie,"")).split("\r"),me=Mt.split(`
34
+ `,j='"',G=j+j,$=!1,N=null,st=!1;(function(){if(typeof _=="object"){if(typeof _.delimiter!="string"||l.BAD_DELIMITERS.filter(function(H){return _.delimiter.indexOf(H)!==-1}).length||(A=_.delimiter),(typeof _.quotes=="boolean"||typeof _.quotes=="function"||Array.isArray(_.quotes))&&(S=_.quotes),typeof _.skipEmptyLines!="boolean"&&typeof _.skipEmptyLines!="string"||($=_.skipEmptyLines),typeof _.newline=="string"&&(F=_.newline),typeof _.quoteChar=="string"&&(j=_.quoteChar),typeof _.header=="boolean"&&(O=_.header),Array.isArray(_.columns)){if(_.columns.length===0)throw new Error("Option columns is empty");N=_.columns}_.escapeChar!==void 0&&(G=_.escapeChar+j),(typeof _.escapeFormulae=="boolean"||_.escapeFormulae instanceof RegExp)&&(st=_.escapeFormulae instanceof RegExp?_.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var z=new RegExp(x(j),"g");if(typeof b=="string"&&(b=JSON.parse(b)),Array.isArray(b)){if(!b.length||Array.isArray(b[0]))return At(null,b,$);if(typeof b[0]=="object")return At(N||Object.keys(b[0]),b,$)}else if(typeof b=="object")return typeof b.data=="string"&&(b.data=JSON.parse(b.data)),Array.isArray(b.data)&&(b.fields||(b.fields=b.meta&&b.meta.fields||N),b.fields||(b.fields=Array.isArray(b.data[0])?b.fields:typeof b.data[0]=="object"?Object.keys(b.data[0]):[]),Array.isArray(b.data[0])||typeof b.data[0]=="object"||(b.data=[b.data])),At(b.fields||[],b.data||[],$);throw new Error("Unable to serialize unrecognized input");function At(H,L,B){var V="";typeof H=="string"&&(H=JSON.parse(H)),typeof L=="string"&&(L=JSON.parse(L));var U=Array.isArray(H)&&0<H.length,Z=!Array.isArray(L[0]);if(U&&O){for(var Y=0;Y<H.length;Y++)0<Y&&(V+=A),V+=_t(H[Y],Y);0<L.length&&(V+=F)}for(var W=0;W<L.length;W++){var et=U?H.length:L[W].length,X=!1,wt=U?Object.keys(L[W]).length===0:L[W].length===0;if(B&&!U&&(X=B==="greedy"?L[W].join("").trim()==="":L[W].length===1&&L[W][0].length===0),B==="greedy"&&U){for(var ct=[],Wt=0;Wt<et;Wt++){var Mt=Z?H[Wt]:Wt;ct.push(L[W][Mt])}X=ct.join("").trim()===""}if(!X){for(var mt=0;mt<et;mt++){0<mt&&!wt&&(V+=A);var ie=U&&Z?H[mt]:mt;V+=_t(L[W][ie],mt)}W<L.length-1&&(!B||0<et&&!wt)&&(V+=F)}}return V}function _t(H,L){if(H==null)return"";if(H.constructor===Date)return JSON.stringify(H).slice(1,25);var B=!1;st&&typeof H=="string"&&st.test(H)&&(H="'"+H,B=!0);var V=H.toString().replace(z,G);return(B=B||S===!0||typeof S=="function"&&S(H,L)||Array.isArray(S)&&S[L]||function(U,Z){for(var Y=0;Y<Z.length;Y++)if(-1<U.indexOf(Z[Y]))return!0;return!1}(V,l.BAD_DELIMITERS)||-1<V.indexOf(A)||V.charAt(0)===" "||V.charAt(V.length-1)===" ")?j+V+j:V}}};if(l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",`
35
+ `,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!s&&!!i.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=w,l.ParserHandle=y,l.NetworkStreamer=d,l.FileStreamer=h,l.StringStreamer=g,l.ReadableStreamStreamer=p,i.jQuery){var c=i.jQuery;c.fn.parse=function(b){var _=b.config||{},S=[];return this.each(function(F){if(!(c(this).prop("tagName").toUpperCase()==="INPUT"&&c(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var j=0;j<this.files.length;j++)S.push({file:this.files[j],inputElem:this,instanceConfig:c.extend({},_)})}),O(),this;function O(){if(S.length!==0){var F,j,G,$,N=S[0];if(T(b.before)){var st=b.before(N.file,N.inputElem);if(typeof st=="object"){if(st.action==="abort")return F="AbortError",j=N.file,G=N.inputElem,$=st.reason,void(T(b.error)&&b.error({name:F},j,G,$));if(st.action==="skip")return void A();typeof st.config=="object"&&(N.instanceConfig=c.extend(N.instanceConfig,st.config))}else if(st==="skip")return void A()}var z=N.instanceConfig.complete;N.instanceConfig.complete=function(At){T(z)&&z(At,N.file,N.inputElem),A()},l.parse(N.file,N.instanceConfig)}else T(b.complete)&&b.complete()}function A(){S.splice(0,1),O()}}}function u(b){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(_){var S=D(_);S.chunkSize=parseInt(S.chunkSize),_.step||_.chunk||(S.chunkSize=null),this._handle=new y(S),(this._handle.streamer=this)._config=S}).call(this,b),this.parseChunk=function(_,S){if(this.isFirstChunk&&T(this._config.beforeFirstChunk)){var O=this._config.beforeFirstChunk(_);O!==void 0&&(_=O)}this.isFirstChunk=!1,this._halted=!1;var A=this._partialLine+_;this._partialLine="";var F=this._handle.parse(A,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var j=F.meta.cursor;this._finished||(this._partialLine=A.substring(j-this._baseIndex),this._baseIndex=j),F&&F.data&&(this._rowCount+=F.data.length);var G=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)i.postMessage({results:F,workerId:l.WORKER_ID,finished:G});else if(T(this._config.chunk)&&!S){if(this._config.chunk(F,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);F=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(F.data),this._completeResults.errors=this._completeResults.errors.concat(F.errors),this._completeResults.meta=F.meta),this._completed||!G||!T(this._config.complete)||F&&F.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),G||F&&F.meta.paused||this._nextChunk(),F}this._halted=!0},this._sendError=function(_){T(this._config.error)?this._config.error(_):r&&this._config.error&&i.postMessage({workerId:l.WORKER_ID,error:_,finished:!1})}}function d(b){var _;(b=b||{}).chunkSize||(b.chunkSize=l.RemoteChunkSize),u.call(this,b),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(S){this._input=S,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(_=new XMLHttpRequest,this._config.withCredentials&&(_.withCredentials=this._config.withCredentials),s||(_.onload=E(this._chunkLoaded,this),_.onerror=E(this._chunkError,this)),_.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var S=this._config.downloadRequestHeaders;for(var O in S)_.setRequestHeader(O,S[O])}if(this._config.chunkSize){var A=this._start+this._config.chunkSize-1;_.setRequestHeader("Range","bytes="+this._start+"-"+A)}try{_.send(this._config.downloadRequestBody)}catch(F){this._chunkError(F.message)}s&&_.status===0&&this._chunkError()}},this._chunkLoaded=function(){_.readyState===4&&(_.status<200||400<=_.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:_.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(S){var O=S.getResponseHeader("Content-Range");return O===null?-1:parseInt(O.substring(O.lastIndexOf("/")+1))}(_),this.parseChunk(_.responseText)))},this._chunkError=function(S){var O=_.statusText||S;this._sendError(new Error(O))}}function h(b){var _,S;(b=b||{}).chunkSize||(b.chunkSize=l.LocalChunkSize),u.call(this,b);var O=typeof FileReader<"u";this.stream=function(A){this._input=A,S=A.slice||A.webkitSlice||A.mozSlice,O?((_=new FileReader).onload=E(this._chunkLoaded,this),_.onerror=E(this._chunkError,this)):_=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var A=this._input;if(this._config.chunkSize){var F=Math.min(this._start+this._config.chunkSize,this._input.size);A=S.call(A,this._start,F)}var j=_.readAsText(A,this._config.encoding);O||this._chunkLoaded({target:{result:j}})},this._chunkLoaded=function(A){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(A.target.result)},this._chunkError=function(){this._sendError(_.error)}}function g(b){var _;u.call(this,b=b||{}),this.stream=function(S){return _=S,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var S,O=this._config.chunkSize;return O?(S=_.substring(0,O),_=_.substring(O)):(S=_,_=""),this._finished=!_,this.parseChunk(S)}}}function p(b){u.call(this,b=b||{});var _=[],S=!0,O=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(A){this._input=A,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){O&&_.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),_.length?this.parseChunk(_.shift()):S=!0},this._streamData=E(function(A){try{_.push(typeof A=="string"?A:A.toString(this._config.encoding)),S&&(S=!1,this._checkIsFinished(),this.parseChunk(_.shift()))}catch(F){this._streamError(F)}},this),this._streamError=E(function(A){this._streamCleanUp(),this._sendError(A)},this),this._streamEnd=E(function(){this._streamCleanUp(),O=!0,this._streamData("")},this),this._streamCleanUp=E(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(b){var _,S,O,A=Math.pow(2,53),F=-A,j=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,G=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,$=this,N=0,st=0,z=!1,At=!1,_t=[],H={data:[],errors:[],meta:{}};if(T(b.step)){var L=b.step;b.step=function(W){if(H=W,U())V();else{if(V(),H.data.length===0)return;N+=W.data.length,b.preview&&N>b.preview?S.abort():(H.data=H.data[0],L(H,$))}}}function B(W){return b.skipEmptyLines==="greedy"?W.join("").trim()==="":W.length===1&&W[0].length===0}function V(){return H&&O&&(Y("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),O=!1),b.skipEmptyLines&&(H.data=H.data.filter(function(W){return!B(W)})),U()&&function(){if(!H)return;function W(X,wt){T(b.transformHeader)&&(X=b.transformHeader(X,wt)),_t.push(X)}if(Array.isArray(H.data[0])){for(var et=0;U()&&et<H.data.length;et++)H.data[et].forEach(W);H.data.splice(0,1)}else H.data.forEach(W)}(),function(){if(!H||!b.header&&!b.dynamicTyping&&!b.transform)return H;function W(X,wt){var ct,Wt=b.header?{}:[];for(ct=0;ct<X.length;ct++){var Mt=ct,mt=X[ct];b.header&&(Mt=ct>=_t.length?"__parsed_extra":_t[ct]),b.transform&&(mt=b.transform(mt,Mt)),mt=Z(Mt,mt),Mt==="__parsed_extra"?(Wt[Mt]=Wt[Mt]||[],Wt[Mt].push(mt)):Wt[Mt]=mt}return b.header&&(ct>_t.length?Y("FieldMismatch","TooManyFields","Too many fields: expected "+_t.length+" fields but parsed "+ct,st+wt):ct<_t.length&&Y("FieldMismatch","TooFewFields","Too few fields: expected "+_t.length+" fields but parsed "+ct,st+wt)),Wt}var et=1;return!H.data.length||Array.isArray(H.data[0])?(H.data=H.data.map(W),et=H.data.length):H.data=W(H.data,0),b.header&&H.meta&&(H.meta.fields=_t),st+=et,H}()}function U(){return b.header&&_t.length===0}function Z(W,et){return X=W,b.dynamicTypingFunction&&b.dynamicTyping[X]===void 0&&(b.dynamicTyping[X]=b.dynamicTypingFunction(X)),(b.dynamicTyping[X]||b.dynamicTyping)===!0?et==="true"||et==="TRUE"||et!=="false"&&et!=="FALSE"&&(function(wt){if(j.test(wt)){var ct=parseFloat(wt);if(F<ct&&ct<A)return!0}return!1}(et)?parseFloat(et):G.test(et)?new Date(et):et===""?null:et):et;var X}function Y(W,et,X,wt){var ct={type:W,code:et,message:X};wt!==void 0&&(ct.row=wt),H.errors.push(ct)}this.parse=function(W,et,X){var wt=b.quoteChar||'"';if(b.newline||(b.newline=function(Mt,mt){Mt=Mt.substring(0,1048576);var ie=new RegExp(x(mt)+"([^]*?)"+x(mt),"gm"),se=(Mt=Mt.replace(ie,"")).split("\r"),me=Mt.split(`
36
36
  `),ve=1<me.length&&me[0].length<se[0].length;if(se.length===1||ve)return`
37
37
  `;for(var re=0,vt=0;vt<se.length;vt++)se[vt][0]===`
38
38
  `&&re++;return re>=se.length/2?`\r
39
39
  `:"\r"}(W,wt)),O=!1,b.delimiter)T(b.delimiter)&&(b.delimiter=b.delimiter(W),H.meta.delimiter=b.delimiter);else{var ct=function(Mt,mt,ie,se,me){var ve,re,vt,St;me=me||[","," ","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var Ye=0;Ye<me.length;Ye++){var pt=me[Ye],gn=0,ke=0,Ve=0;vt=void 0;for(var de=new w({comments:se,delimiter:pt,newline:mt,preview:10}).parse(Mt),ye=0;ye<de.data.length;ye++)if(ie&&B(de.data[ye]))Ve++;else{var Me=de.data[ye].length;ke+=Me,vt!==void 0?0<Me&&(gn+=Math.abs(Me-vt),vt=Me):vt=Me}0<de.data.length&&(ke/=de.data.length-Ve),(re===void 0||gn<=re)&&(St===void 0||St<ke)&&1.99<ke&&(re=gn,ve=pt,St=ke)}return{successful:!!(b.delimiter=ve),bestDelimiter:ve}}(W,b.newline,b.skipEmptyLines,b.comments,b.delimitersToGuess);ct.successful?b.delimiter=ct.bestDelimiter:(O=!0,b.delimiter=l.DefaultDelimiter),H.meta.delimiter=b.delimiter}var Wt=D(b);return b.preview&&b.header&&Wt.preview++,_=W,S=new w(Wt),H=S.parse(_,et,X),V(),z?{meta:{paused:!0}}:H||{meta:{paused:!1}}},this.paused=function(){return z},this.pause=function(){z=!0,S.abort(),_=T(b.chunk)?"":_.substring(S.getCharIndex())},this.resume=function(){$.streamer._halted?(z=!1,$.streamer.parseChunk(_,!0)):setTimeout($.resume,3)},this.aborted=function(){return At},this.abort=function(){At=!0,S.abort(),H.meta.aborted=!0,T(b.complete)&&b.complete(H),_=""}}function x(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(b){var _,S=(b=b||{}).delimiter,O=b.newline,A=b.comments,F=b.step,j=b.preview,G=b.fastMode,$=_=b.quoteChar===void 0||b.quoteChar===null?'"':b.quoteChar;if(b.escapeChar!==void 0&&($=b.escapeChar),(typeof S!="string"||-1<l.BAD_DELIMITERS.indexOf(S))&&(S=","),A===S)throw new Error("Comment character same as delimiter");A===!0?A="#":(typeof A!="string"||-1<l.BAD_DELIMITERS.indexOf(A))&&(A=!1),O!==`
40
40
  `&&O!=="\r"&&O!==`\r
41
41
  `&&(O=`
42
- `);var N=0,st=!1;this.parse=function(z,At,_t){if(typeof z!="string")throw new Error("Input must be a string");var H=z.length,L=S.length,B=O.length,V=A.length,q=T(F),Z=[],Y=[],W=[],et=N=0;if(!z)return Kt();if(b.header&&!At){var X=z.split(O)[0].split(S),wt=[],ct={},Wt=!1;for(var Mt in X){var mt=X[Mt];T(b.transformHeader)&&(mt=b.transformHeader(mt,Mt));var ie=mt,se=ct[mt]||0;for(0<se&&(Wt=!0,ie=mt+"_"+se),ct[mt]=se+1;wt.includes(ie);)ie=ie+"_"+se;wt.push(ie)}if(Wt){var me=z.split(O);me[0]=wt.join(S),z=me.join(O)}}if(G||G!==!1&&z.indexOf(_)===-1){for(var ve=z.split(O),re=0;re<ve.length;re++){if(W=ve[re],N+=W.length,re!==ve.length-1)N+=O.length;else if(_t)return Kt();if(!A||W.substring(0,V)!==A){if(q){if(Z=[],Ve(W.split(S)),ae(),st)return Kt()}else Ve(W.split(S));if(j&&j<=re)return Z=Z.slice(0,j),Kt(!0)}}return Kt()}for(var vt=z.indexOf(S,N),St=z.indexOf(O,N),Ye=new RegExp(x($)+x(_),"g"),pt=z.indexOf(_,N);;)if(z[N]!==_)if(A&&W.length===0&&z.substring(N,N+V)===A){if(St===-1)return Kt();N=St+B,St=z.indexOf(O,N),vt=z.indexOf(S,N)}else if(vt!==-1&&(vt<St||St===-1))W.push(z.substring(N,vt)),N=vt+L,vt=z.indexOf(S,N);else{if(St===-1)break;if(W.push(z.substring(N,St)),Me(St+B),q&&(ae(),st))return Kt();if(j&&Z.length>=j)return Kt(!0)}else for(pt=N,N++;;){if((pt=z.indexOf(_,pt+1))===-1)return _t||Y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Z.length,index:N}),ye();if(pt===H-1)return ye(z.substring(N,pt).replace(Ye,_));if(_!==$||z[pt+1]!==$){if(_===$||pt===0||z[pt-1]!==$){vt!==-1&&vt<pt+1&&(vt=z.indexOf(S,pt+1)),St!==-1&&St<pt+1&&(St=z.indexOf(O,pt+1));var gn=de(St===-1?vt:Math.min(vt,St));if(z.substr(pt+1+gn,L)===S){W.push(z.substring(N,pt).replace(Ye,_)),z[N=pt+1+gn+L]!==_&&(pt=z.indexOf(_,N)),vt=z.indexOf(S,N),St=z.indexOf(O,N);break}var ke=de(St);if(z.substring(pt+1+ke,pt+1+ke+B)===O){if(W.push(z.substring(N,pt).replace(Ye,_)),Me(pt+1+ke+B),vt=z.indexOf(S,N),pt=z.indexOf(_,N),q&&(ae(),st))return Kt();if(j&&Z.length>=j)return Kt(!0);break}Y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Z.length,index:N}),pt++}}else pt++}return ye();function Ve(zt){Z.push(zt),et=N}function de(zt){var ar=0;if(zt!==-1){var ai=z.substring(pt+1,zt);ai&&ai.trim()===""&&(ar=ai.length)}return ar}function ye(zt){return _t||(zt===void 0&&(zt=z.substring(N)),W.push(zt),N=H,Ve(W),q&&ae()),Kt()}function Me(zt){N=zt,Ve(W),W=[],St=z.indexOf(O,N)}function Kt(zt){return{data:Z,errors:Y,meta:{delimiter:S,linebreak:O,aborted:st,truncated:!!zt,cursor:et+(At||0)}}}function ae(){F(Kt()),Z=[],Y=[]}},this.abort=function(){st=!0},this.getCharIndex=function(){return N}}function v(b){var _=b.data,S=a[_.workerId],O=!1;if(_.error)S.userError(_.error,_.file);else if(_.results&&_.results.data){var A={abort:function(){O=!0,M(_.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:C,resume:C};if(T(S.userStep)){for(var F=0;F<_.results.data.length&&(S.userStep({data:_.results.data[F],errors:_.results.errors,meta:_.results.meta},A),!O);F++);delete _.results}else T(S.userChunk)&&(S.userChunk(_.results,A,_.file),delete _.results)}_.finished&&!O&&M(_.workerId,_.results)}function M(b,_){var S=a[b];T(S.userComplete)&&S.userComplete(_),S.terminate(),delete a[b]}function C(){throw new Error("Not implemented.")}function D(b){if(typeof b!="object"||b===null)return b;var _=Array.isArray(b)?[]:{};for(var S in b)_[S]=D(b[S]);return _}function E(b,_){return function(){b.apply(_,arguments)}}function T(b){return typeof b=="function"}return r&&(i.onmessage=function(b){var _=b.data;if(l.WORKER_ID===void 0&&_&&(l.WORKER_ID=_.workerId),typeof _.input=="string")i.postMessage({workerId:l.WORKER_ID,results:l.parse(_.input,_.config),finished:!0});else if(i.File&&_.input instanceof File||_.input instanceof Object){var S=l.parse(_.input,_.config);S&&i.postMessage({workerId:l.WORKER_ID,results:S,finished:!0})}}),(d.prototype=Object.create(u.prototype)).constructor=d,(h.prototype=Object.create(u.prototype)).constructor=h,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(u.prototype)).constructor=p,l})})(sh);var Qk=sh.exports;const Jk=["id"],tM=f.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:t}){const e=t,i=n,s=f.computed(()=>`export_${new Date().getTime()}`),r=f.computed(()=>{const u=l();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Rn.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return typeof u===Rn.Object?d=>xk(d,(h,g)=>u[g]||g):d=>d},o=()=>{const u=i.fields;if(typeof i.fields!==Rn.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?d=>Kk(d,u):d=>d},l=()=>{if(typeof i.fields===Rn.Undefined&&typeof i.labels===Rn.Undefined)return i.data;const u=a(),d=o();return i.data.map(h=>u(d(h)))},c=()=>{if(!(r!=null&&r.value)){console.warn("No data to export");return}e("export-started",r.value);let u=Qk.unparse(r.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
43
- `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),e("export-finished",i.filename),!i.testing){const d=new Blob([u],{type:"text/csv;charset="+i.encoding});Zk.saveAs(d,i.filename)}};return(u,d)=>(f.openBlock(),f.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[f.renderSlot(u.$slots,"default",{},()=>[f.createTextVNode("Download "+f.toDisplayString(n.filename),1)])],8,Jk))}}),eM=f.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const t=n,e=f.computed(()=>Object.keys(t.headers));return(i,s)=>(f.openBlock(),f.createElementBlock("div",null,[f.createVNode(tM,{data:i.rows,fields:e.value,filename:i.filename,labels:i.headers},{default:f.withCtx(()=>[f.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}});function rh(n,t,e){const i=sM(n,e.timeZone,e.locale);return"formatToParts"in i?nM(i,t):iM(i,t)}function nM(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function iM(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function sM(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function rM(n,t){const e=cM(t);return"formatToParts"in e?oM(e,n):lM(e,n)}const aM={year:0,month:1,day:2,hour:3,minute:4,second:5};function oM(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=aM[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function lM(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const uo={};function cM(n){if(!uo[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";uo[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return uo[n]}function ah(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const oh=36e5,uM=6e4,ho={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function lh(n,t,e){if(!n)return 0;let i=ho.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=ho.timezoneHH.exec(n),i)return s=parseInt(i[1],10),ch(s)?-(s*oh):NaN;if(i=ho.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return ch(s,a)?(r=Math.abs(s)*oh+a*uM,i[1]==="+"?-r:r):NaN}if(fM(n)){t=new Date(t||Date.now());const a=e?t:dM(t),o=fo(a,n);return-(e?o:hM(t,o,n))}return NaN}function dM(n){return ah(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function fo(n,t){const e=rM(n,t),i=ah(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function hM(n,t,e){let s=n.getTime()-t;const r=fo(new Date(s),e);if(t===r)return t;s-=r-t;const a=fo(new Date(s),e);return r===a?r:Math.max(r,a)}function ch(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const uh={};function fM(n){if(uh[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),uh[n]=!0,!0}catch{return!1}}const gM=60*1e3,pM={X:function(n,t,e){const i=go(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return dh(i);case"XXXX":case"XX":return ri(i);case"XXXXX":case"XXX":default:return ri(i,":")}},x:function(n,t,e){const i=go(e.timeZone,n);switch(t){case"x":return dh(i);case"xxxx":case"xx":return ri(i);case"xxxxx":case"xxx":default:return ri(i,":")}},O:function(n,t,e){const i=go(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+mM(i,":");case"OOOO":default:return"GMT"+ri(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return rh("short",n,e);case"zzzz":default:return rh("long",n,e)}}};function go(n,t){const e=n?lh(n,t,!0)/gM:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function rr(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function ri(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=rr(Math.floor(i/60),2),r=rr(Math.floor(i%60),2);return e+s+t+r}function dh(n,t){return n%60===0?(n>0?"-":"+")+rr(Math.abs(n)/60,2):ri(n,t)}function mM(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+rr(r,2)}function hh(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const yM=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,po=36e5,fh=6e4,bM=2,Gt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:yM};function xM(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?bM:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=_M(n),{year:s,restDateString:r}=wM(i.date,e),a=vM(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=kM(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=lh(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=hh(new Date(o+l)),c=hh(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function _M(n){const t={};let e=Gt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Gt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Gt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function wM(n,t){if(n){const e=Gt.YYY[t],i=Gt.YYYYY[t];let s=Gt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Gt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function vM(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Gt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,mh(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Gt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return DM(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Gt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return mh(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Gt.Www.exec(n),r)return s=parseInt(r[1],10)-1,yh(s)?gh(t,s):new Date(NaN);if(r=Gt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return yh(s,a)?gh(t,s,a):new Date(NaN)}return null}function kM(n){let t,e,i=Gt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),mo(t)?t%24*po:NaN;if(i=Gt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),mo(t,e)?t%24*po+e*fh:NaN;if(i=Gt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return mo(t,e,s)?t%24*po+e*fh+s*1e3:NaN}return null}function gh(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const MM=[31,28,31,30,31,30,31,31,30,31,30,31],SM=[31,29,31,30,31,30,31,31,30,31,30,31];function ph(n){return n%400===0||n%4===0&&n%100!==0}function mh(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=ph(n);if(i&&e>SM[t]||!i&&e>MM[t])return!1}return!0}function DM(n,t){if(t<1)return!1;const e=ph(n);return!(e&&t>366||!e&&t>365)}function yh(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function mo(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const TM=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function bh(n,t,e={}){t=String(t);const i=t.match(TM);if(i){const s=xM(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+pM[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return hu(n,t,e)}const CM={class:"kong-ui-public-csv-export-modal"},PM={key:0,class:"selected-range"},OM={key:1,class:"text-muted",tag:"span"},xh=3,_h=f.defineComponent({__name:"CsvExportModal",props:{filename:{},modalDescription:{default:void 0},chartData:{}},emits:["toggleModal"],setup(n,{emit:t}){const{i18n:e}=gt.useI18n(),i=n,s=t,r=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=f.ref(!0),o=f.computed(()=>{var y,x;return!!((x=(y=i.chartData)==null?void 0:y.data)!=null&&x.length)}),l=f.ref(1),c=f.computed(()=>g.value.rows.length),u=gt.useChartSelectedRange(f.toRef(i,"chartData")),d=f.computed(()=>e.t("csvExport.previewRows",{rowsMax:Math.min(xh,c.value),rowsTotal:c.value,plural:c.value===1?"":"s"})),h=()=>{s("toggleModal",!1)},g=f.computed(()=>{var D,E,T;if(!o.value||!((D=i.chartData)!=null&&D.meta.metric_names))return{headers:[],rows:[],csvHeaders:{}};const y=i.chartData.data.some(b=>b.timestamp!==i.chartData.data[0].timestamp),x=i.chartData.data.map(b=>{const _=new Date(b.timestamp);return{...Object.keys(b.event).reduce((O,A)=>{if(A in i.chartData.meta.display){const F=b.event[A],j=i.chartData.meta.display[A];O[A]=F&&j&&j[F].name||b.event[A]}else O[A]=b.event[A];return O},{}),...y?{timestamp:bh(_,"yyyy-MM-dd HH:mm:ss"),tzOffset:bh(_,"XXX")}:{}}});let w=[];y&&(w=[{label:e.t("csvExport.Timestamp"),key:"timestamp"},{label:e.t("csvExport.UtcOffset"),key:"tzOffset"}]);const v="display"in i.chartData.meta&&((E=i.chartData.meta)!=null&&E.display)?(T=i.chartData.meta)==null?void 0:T.display:{},M=[...w,...Object.keys(v).map(b=>({label:e.t(`chartLabels.${b}`),key:b})),...i.chartData.meta.metric_names.map(b=>({label:e.t(`chartLabels.${b}`),key:b}))],C=M.reduce((b,_)=>(b[_.key]=_.label,b),{});return{headers:M,csvHeaders:C,rows:x}}),p=()=>{const{rows:y}=g.value;return a.value=!1,{total:Number(y.length)||0,data:y.slice(0,xh)}};return f.watch(g,()=>{l.value++}),(y,x)=>{const w=f.resolveComponent("KEmptyState"),v=f.resolveComponent("KTable"),M=f.resolveComponent("KButton"),C=f.resolveComponent("KModal");return f.openBlock(),f.createElementBlock("div",CM,[f.createVNode(C,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:f.unref(e).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:f.withKeys(h,["esc"])},{default:f.withCtx(()=>{var D;return[f.createElementVNode("div",null,[o.value?(f.openBlock(),f.createElementBlock("div",PM,[f.createElementVNode("p",null,f.toDisplayString(y.modalDescription?y.modalDescription:f.unref(e).t("csvExport.exportDescription")),1),f.createElementVNode("p",null,f.toDisplayString(f.unref(e).t("csvExport.exportTimeRange"))+": "+f.toDisplayString(f.unref(u)),1)])):f.createCommentVNode("",!0),f.createVNode(v,{class:"vitals-table","disable-pagination":"",fetcher:p,"fetcher-cache-key":String(l.value),headers:((D=g.value)==null?void 0:D.headers)||[],"row-hover":!1,sortable:!1},{"empty-state":f.withCtx(()=>[f.createVNode(w,{"action-button-visible":!1},{title:f.withCtx(()=>[f.createElementVNode("h5",null,f.toDisplayString(f.unref(e).t("csvExport.noDataRange")),1)]),default:f.withCtx(()=>[f.createElementVNode("p",null,f.toDisplayString(f.unref(e).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"]),!a.value&&o.value?(f.openBlock(),f.createElementBlock("div",OM,f.toDisplayString(d.value),1)):f.createCommentVNode("",!0)])]}),"footer-actions":f.withCtx(()=>[f.createVNode(M,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("csvExport.cancelButton")),1)]),_:1}),f.createVNode(eM,{class:"vitals-report-export-button",filename:r,headers:g.value.csvHeaders,rows:g.value.rows},{default:f.withCtx(()=>[f.createVNode(M,{appearance:"primary","data-testid":"csv-download-button",disabled:a.value||!o.value},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}}),wh=f.defineComponent({__name:"CsvExportButton",props:{data:{type:Object,required:!0},text:{type:String,required:!1,default:void 0},buttonAppearance:{type:String,required:!1,default:()=>"tertiary"},filenamePrefix:{type:String,required:!1,default:void 0}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>t.filenamePrefix||e.t("csvExport.defaultFilename")),s=f.ref(!1),r=o=>{s.value=o},a=()=>{r(!0)};return(o,l)=>{const c=f.resolveComponent("KButton");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createVNode(c,{appearance:n.buttonAppearance,class:"chart-export-button-display","data-testid":"csv-export-button",onClick:f.withModifiers(a,["prevent"])},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(n.text||f.unref(e).t("csvExport.exportButton")),1)]),_:1},8,["appearance"]),s.value?(f.openBlock(),f.createBlock(_h,{key:0,"chart-data":n.data,filename:i.value,onToggleModal:r},null,8,["chart-data","filename"])):f.createCommentVNode("",!0)],64)}}}),EM={class:"analytics-chart-shell"},AM={key:0,class:"chart-header"},RM={key:0,class:"chart-title"},LM={class:"chart-header-icons-wrapper"},IM={key:1,class:"chart-export-button"},NM={key:2,class:"analytics-chart-parent"},FM=f.defineComponent({__name:"AnalyticsChart",props:{allowCsvExport:{type:Boolean,required:!1,default:!1},chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},tooltipTitle:{type:String,required:!1,default:""},emptyStateTitle:{type:String,required:!1,default:""},emptyStateDescription:{type:String,required:!1,default:""},chartTitle:{type:String,required:!1,default:""},filenamePrefix:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Pt.Right},syntheticsDataKey:{type:String,required:!1,default:""},showLegendValues:{type:Boolean,required:!1,default:!0},showAnnotations:{type:Boolean,required:!1,default:!0}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.toRef(t,"chartData"),s=f.computed(()=>g.value?gt.useExploreResultToTimeDataset({fill:t.chartOptions.stacked,colorPalette:t.chartOptions.chartDatasetColors||Vs},f.toRef(t,"chartData")).value:gt.useExploreResultToDatasets({fill:t.chartOptions.stacked,colorPalette:t.chartOptions.chartDatasetColors||Vs},f.toRef(t,"chartData")).value),r=f.computed(()=>{var S;return(S=t.chartData)!=null&&S.meta?"start_ms"in t.chartData.meta?t.chartData.meta.end_ms-t.chartData.meta.start_ms:void 0:0}),a=f.computed(()=>{var S;return(S=t.chartData.meta)!=null&&S.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),o=f.computed(()=>t.showLegendValues&&t.legendPosition!==Pt.Bottom),{legendValues:l}=gt.useChartLegendValues(s,t.chartOptions.type,a),c=f.computed(()=>{var S,O,A;return((A=(O=(S=t.chartData)==null?void 0:S.meta)==null?void 0:O.limit)==null?void 0:A.toString())||null}),u=f.computed(()=>{var S,O;return((O=(S=t.chartData)==null?void 0:S.meta)==null?void 0:O.truncated)||!1}),d=e.t("limitedResultsShown",{maxReturned:c.value}),h=f.computed(()=>["vertical_bar","horizontal_bar"].includes(t.chartOptions.type)),g=f.computed(()=>["timeseries_bar","timeseries_line"].some(S=>S===t.chartOptions.type)),p=f.computed(()=>t.chartOptions.type==="doughnut"),y=f.computed(()=>t.chartOptions.type.includes("vertical")?"vertical":"horizontal"),x=f.computed(()=>{var A,F,j;if(!((A=t.chartData)!=null&&A.meta.metric_names)||!((F=t.chartData)!=null&&F.meta.metric_units))return;const S=t.chartData.meta.metric_names[0],O=t.chartData.meta.metric_units[S];if(t.chartData.meta.metric_names.length>1){if(S.includes("latency"))return e.t("metricAxisTitles.latency_in",{unit:e.t(`chartUnits.${O}`,{plural:"s"})});if(S.includes("size"))return e.t("metricAxisTitles.size_in",{unit:e.t(`chartUnits.${O}`,{plural:"s"})})}return((j=t.chartOptions)==null?void 0:j.metricAxesTitle)||e.te(`metricAxisTitles.${S}`)&&e.te(`chartUnits.${O}`)&&e.t(`metricAxisTitles.${S}`,{unit:e.t(`chartUnits.${O}`,{plural:"s"})})||void 0}),w=f.computed(()=>{const S=g.value?"Time":Object.keys(t.chartData.meta.display||t.chartData.meta.metric_names)[0];return t.chartOptions.dimensionAxesTitle||e.te(`chartLabels.${S}`)&&e.t(`chartLabels.${S}`)||void 0}),v=f.computed(()=>{const S=Ba(Number(t.chartData.meta.granularity_ms));return e.t(`granularityAxisTitles.${S}`)}),M=f.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),C=f.computed(()=>t.emptyStateDescription||e.t("noDataAvailableDescription")),D=f.computed(()=>g.value?Cx(s.value):t.chartData&&t.chartData.meta&&t.chartData.data.length),E=f.computed(()=>D.value&&u.value&&c.value||t.chartTitle||t.allowCsvExport&&D.value),T=f.computed(()=>t.chartData.meta.granularity_ms?Ba(t.chartData.meta.granularity_ms)||"hourly":Ba(new Date(t.chartData.data[1].timestamp).getTime()-new Date(t.chartData.data[0].timestamp).getTime())||"hourly"),b=f.computed(()=>t.chartOptions.chartLegendSortFn?t.chartOptions.chartLegendSortFn:(S,O)=>S.text===e.t("chartLabels.____OTHER____")?1:O.text===e.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(S.text,10))&&!isNaN(parseInt(O.text,10))?S.text<O.text?-1:1:S.value&&O.value?O.value.raw-S.value.raw:0),_=f.computed(()=>t.chartOptions.chartTooltipSortFn?t.chartOptions.chartTooltipSortFn:(S,O)=>S.label===e.t("chartLabels.____OTHER____")?1:O.label===e.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(S.label,10))&&!isNaN(parseInt(O.label,10))?S.label<O.label?-1:1:S.value&&O.value?O.rawValue-S.rawValue:0);return f.provide("showLegendValues",o),f.provide("legendPosition",f.toRef(t,"legendPosition")),(S,O)=>{const A=f.resolveComponent("KTooltip"),F=f.resolveComponent("KEmptyState");return f.openBlock(),f.createElementBlock("div",EM,[E.value?(f.openBlock(),f.createElementBlock("div",AM,[n.chartTitle?(f.openBlock(),f.createElementBlock("div",RM,f.toDisplayString(n.chartTitle),1)):f.createCommentVNode("",!0),f.createElementVNode("div",LM,[D.value&&u.value&&c.value?(f.openBlock(),f.createBlock(A,{key:0,class:"tooltip","max-width":"500",placement:"right"},{content:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(d)),1)]),default:f.withCtx(()=>[f.createVNode(f.unref(Do.WarningIcon),{color:`var(--kui-color-text-warning, ${f.unref(Pv)})`,decorative:"",size:f.unref(Ov)},null,8,["color","size"])]),_:1})):f.createCommentVNode("",!0)]),n.allowCsvExport&&D.value?(f.openBlock(),f.createElementBlock("div",IM,[f.createVNode(wh,{data:i.value,"filename-prefix":n.filenamePrefix},null,8,["data","filename-prefix"])])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0),D.value?(f.openBlock(),f.createElementBlock("div",NM,[g.value?(f.openBlock(),f.createBlock(pk,{key:0,"chart-data":s.value,"chart-legend-sort-fn":b.value,"chart-tooltip-sort-fn":_.value,"dimension-axes-title":v.value,fill:n.chartOptions.stacked,granularity:T.value,"legend-values":f.unref(l),"metric-axes-title":x.value,"metric-unit":a.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"time-range-ms":r.value,"tooltip-title":n.tooltipTitle,type:n.chartOptions.type},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","legend-values","metric-axes-title","metric-unit","stacked","synthetics-data-key","time-range-ms","tooltip-title","type"])):h.value?(f.openBlock(),f.createBlock(nk,{key:1,annotations:n.showAnnotations,"chart-data":s.value,"chart-legend-sort-fn":b.value,"chart-tooltip-sort-fn":_.value,"data-testid":"bar-chart-container","dimension-axes-title":w.value,"legend-values":f.unref(l),"metric-axes-title":x.value,"metric-unit":a.value,orientation:y.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-title"])):p.value?(f.openBlock(),f.createBlock(gk,{key:2,"chart-data":s.value,"dataset-colors":n.chartOptions.chartDatasetColors||f.unref(Vs),"legend-position":n.legendPosition,"legend-values":f.unref(l),"metric-unit":a.value,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-unit","synthetics-data-key","tooltip-title"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(F,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(M.value),1)]),default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(C.value),1)]),_:1}))])}}}),zM=We(FM,[["__scopeId","data-v-470fa6ac"]]),BM={class:"chart-parent","data-testid":"doughnut-chart-parent"},HM={class:"chart-totals-flex"},WM={key:1,class:"metric-small","data-testid":"doughnut-chart-total"},YM=f.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:Jn.Hidden},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:Be},height:{type:String,required:!1,default:"400px",validator:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.ref(hn()),s=f.computed(()=>[t.chartData.datasets.reduce((p,y)=>(p.labels.push(y.label),p.borderColor.push(y.backgroundColor),p.backgroundColor.push(y.backgroundColor),p.data.push(y.data.reduce((x,w)=>x+w,0)),p),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),r=f.computed(()=>({...t.chartData,datasets:s.value}));gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},o=f.ref(),l=f.computed(()=>{var g;return ji((g=s==null?void 0:s.value[0])==null?void 0:g.data[t.numerator],{capital:!0})}),c=f.computed(()=>{var g,p;return ji(((g=s==null?void 0:s.value[0])==null?void 0:g.data[0])+((p=s==null?void 0:s.value[0])==null?void 0:p.data[1]),{capital:!0})}),u=f.computed(()=>{var g;return`color: ${(g=s==null?void 0:s.value[0])==null?void 0:g.backgroundColor[t.numerator]}`}),d=f.computed(()=>[Jn.Full,Jn.SingleMetric].includes(t.metricDisplay)),h=f.computed(()=>t.metricDisplay===Jn.Full);return(g,p)=>(f.openBlock(),f.createElementBlock("div",BM,[f.createElementVNode("div",HM,[d.value?(f.openBlock(),f.createElementBlock("div",{key:0,class:"metric-large","data-testid":"doughnut-chart-metric",style:f.normalizeStyle(u.value)},f.toDisplayString(l.value),5)):f.createCommentVNode("",!0),h.value?(f.openBlock(),f.createElementBlock("div",WM,f.toDisplayString(f.unref(e).t("total"))+": "+f.toDisplayString(c.value),1)):f.createCommentVNode("",!0)]),f.createElementVNode("div",{class:"chart-container",style:f.normalizeStyle({height:n.height,width:n.width})},[f.createVNode(f.unref(Zd),{ref_key:"chartInstance",ref:o,"chart-id":i.value,data:r.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),VM=We(YM,[["__scopeId","data-v-18bc031c"]]),jM={class:"simple-chart-shell"},$M={key:1,class:"analytics-chart-parent"},UM=We(f.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>{var c;const l=gt.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||Be},f.toRef(t,"chartData")).value;return(c=t.chartOptions)!=null&&c.reverseDataset&&(l==null||l.datasets.reverse()),l}),s=f.computed(()=>{var l;return(l=t.chartData.meta)!=null&&l.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),r=f.computed(()=>t.chartOptions.type==="gauge"),a=f.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),o=f.computed(()=>t.chartData&&t.chartData.meta&&t.chartData.data.length);return(l,c)=>{const u=f.resolveComponent("KEmptyState");return f.openBlock(),f.createElementBlock("div",jM,[o.value?(f.openBlock(),f.createElementBlock("div",$M,[r.value?(f.openBlock(),f.createBlock(VM,{key:0,"chart-data":i.value,"dataset-colors":n.chartOptions.chartDatasetColors,"is-simple":"","metric-display":n.chartOptions.metricDisplay,"metric-unit":s.value,numerator:n.chartOptions.numerator,"synthetics-data-key":n.syntheticsDataKey,width:n.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(u,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(a.value),1)]),_:1}))])}}}),[["__scopeId","data-v-0ee40a4b"]]),qM={class:"top-n-card-title","data-testid":"top-n-card-title"},XM={class:"top-n-card-description","data-testid":"top-n-card-description"},GM={key:3,class:"top-n-table","data-testid":"top-n-table"},KM={class:"table-headings"},ZM={class:"table-row"},QM={class:"column-1"},JM={class:"column-2"},tS={class:"table-body","data-testid":"top-n-data"},eS=["data-testid"],nS={class:"column-1"},iS={class:"column-2"},sS=We(f.defineComponent({__name:"TopNTable",props:{title:{type:String,required:!0},description:{type:String,default:""},data:{type:Object,required:!0},emptyStateTitle:{type:String,default:""},isLoading:{type:Boolean,default:!1},titleTag:{type:String,default:"h2"}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>t.data.data),s=f.computed(()=>{var p;return!!((p=i.value)!=null&&p.length)}),r=f.computed(()=>{var p,y;return(p=t.data.meta)!=null&&p.display&&((y=Object.keys(t.data.meta.display))==null?void 0:y[0])||""}),a=f.computed(()=>r.value?t.data.meta.display[r.value]:{}),o=f.computed(()=>{var p,y;return(y=(p=t.data.meta)==null?void 0:p.metric_names)!=null&&y.length?t.data.meta.metric_names[0]:""}),l=f.computed(()=>o.value?e.t(`chartLabels.${o.value}`)||o.value:""),c=f.computed(()=>{if(!s.value)return"";if(t.data.meta){if(a.value&&!Object.keys(a.value).length)return e.t("topNTable.errors.display");if(!o.value)return e.t("topNTable.errors.metricNames")}else return e.t("topNTable.errors.meta");return""}),u=p=>{const y=p.event;return String(y[r.value])},d=p=>{const y=u(p),x=a.value&&a.value[y];return x?x.name:"-"},h=p=>{const y=u(p),x=a.value&&a.value[y];return x?!!x.deleted:!1},g=p=>{if(!o.value)return"–";const x=p.event[o.value];return x?ji(x,{capital:!0,round:!0}):"–"};return(p,y)=>{const x=f.resolveComponent("KEmptyState"),w=f.resolveComponent("KSkeleton"),v=f.resolveComponent("KCard");return f.openBlock(),f.createBlock(v,{class:"kong-ui-public-top-n-table","title-tag":n.titleTag},f.createSlots({default:f.withCtx(()=>[c.value?(f.openBlock(),f.createBlock(x,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("topNTable.defaultErrorStateTitle")),1)]),default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(c.value),1)]),_:1})):n.isLoading?(f.openBlock(),f.createBlock(w,{key:1,"table-columns":2,type:"table"})):s.value?(f.openBlock(),f.createElementBlock("div",GM,[f.createElementVNode("div",KM,[f.createElementVNode("div",ZM,[f.createElementVNode("div",QM,f.toDisplayString(f.unref(e).t("topNTable.nameLabel")),1),f.createElementVNode("div",JM,f.toDisplayString(l.value),1)])]),f.createElementVNode("div",tS,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value,(M,C)=>(f.openBlock(),f.createElementBlock("div",{key:`entry-${C}`,class:"table-row","data-testid":`row-${u(M)}`},[f.createElementVNode("div",nS,[f.renderSlot(p.$slots,"name",{record:{id:u(M),name:d(M),deleted:h(M),dimension:r.value}},()=>[f.createTextVNode(f.toDisplayString(d(M)),1)],!0)]),f.createElementVNode("div",iS,"   "+f.toDisplayString(g(M)),1)],8,eS))),128))])])):(f.openBlock(),f.createBlock(x,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(n.emptyStateTitle||f.unref(e).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[n.title?{name:"title",fn:f.withCtx(()=>[f.createElementVNode("span",qM,f.toDisplayString(n.title),1)]),key:"0"}:void 0,n.description?{name:"actions",fn:f.withCtx(()=>[f.createElementVNode("div",XM,f.toDisplayString(n.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-50809fdb"]]);Q.AnalyticsChart=zM,Q.ChartLegendPosition=Pt,Q.ChartMetricDisplay=Jn,Q.CsvExportButton=wh,Q.CsvExportModal=_h,Q.DECIMAL_DISPLAY=_u,Q.FONT_SIZE_REGULAR=vu,Q.FONT_SIZE_SMALL=wu,Q.MAX_LABEL_LENGTH=Ys,Q.OTHERS_COLOR=Lx,Q.SimpleChart=UM,Q.TopNTable=sS,Q.ValidType=Rn,Q.accessibleGrey=Su,Q.apiRequestStatusCodeColors=Du,Q.chartTypes=mk,Q.codesInSpec=Ou,Q.darkenColor=Mu,Q.datavisPalette=Be,Q.defaultStatusCodeColors=Vs,Q.errorRateColors=Ax,Q.latencyColors=Rx,Q.lightGrey=Ta,Q.lookupColor=Ix,Q.lookupDatavisColor=Xn,Q.lookupStatusCodeCategoryColor=Yx,Q.lookupStatusCodeColor=Ca,Q.numberFormatter=Ws,Q.simpleChartTypes=yk,Q.statusCodeBadgeBackgroundColor=Ox,Q.trafficColors=Ex,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
42
+ `);var N=0,st=!1;this.parse=function(z,At,_t){if(typeof z!="string")throw new Error("Input must be a string");var H=z.length,L=S.length,B=O.length,V=A.length,U=T(F),Z=[],Y=[],W=[],et=N=0;if(!z)return Kt();if(b.header&&!At){var X=z.split(O)[0].split(S),wt=[],ct={},Wt=!1;for(var Mt in X){var mt=X[Mt];T(b.transformHeader)&&(mt=b.transformHeader(mt,Mt));var ie=mt,se=ct[mt]||0;for(0<se&&(Wt=!0,ie=mt+"_"+se),ct[mt]=se+1;wt.includes(ie);)ie=ie+"_"+se;wt.push(ie)}if(Wt){var me=z.split(O);me[0]=wt.join(S),z=me.join(O)}}if(G||G!==!1&&z.indexOf(_)===-1){for(var ve=z.split(O),re=0;re<ve.length;re++){if(W=ve[re],N+=W.length,re!==ve.length-1)N+=O.length;else if(_t)return Kt();if(!A||W.substring(0,V)!==A){if(U){if(Z=[],Ve(W.split(S)),ae(),st)return Kt()}else Ve(W.split(S));if(j&&j<=re)return Z=Z.slice(0,j),Kt(!0)}}return Kt()}for(var vt=z.indexOf(S,N),St=z.indexOf(O,N),Ye=new RegExp(x($)+x(_),"g"),pt=z.indexOf(_,N);;)if(z[N]!==_)if(A&&W.length===0&&z.substring(N,N+V)===A){if(St===-1)return Kt();N=St+B,St=z.indexOf(O,N),vt=z.indexOf(S,N)}else if(vt!==-1&&(vt<St||St===-1))W.push(z.substring(N,vt)),N=vt+L,vt=z.indexOf(S,N);else{if(St===-1)break;if(W.push(z.substring(N,St)),Me(St+B),U&&(ae(),st))return Kt();if(j&&Z.length>=j)return Kt(!0)}else for(pt=N,N++;;){if((pt=z.indexOf(_,pt+1))===-1)return _t||Y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Z.length,index:N}),ye();if(pt===H-1)return ye(z.substring(N,pt).replace(Ye,_));if(_!==$||z[pt+1]!==$){if(_===$||pt===0||z[pt-1]!==$){vt!==-1&&vt<pt+1&&(vt=z.indexOf(S,pt+1)),St!==-1&&St<pt+1&&(St=z.indexOf(O,pt+1));var gn=de(St===-1?vt:Math.min(vt,St));if(z.substr(pt+1+gn,L)===S){W.push(z.substring(N,pt).replace(Ye,_)),z[N=pt+1+gn+L]!==_&&(pt=z.indexOf(_,N)),vt=z.indexOf(S,N),St=z.indexOf(O,N);break}var ke=de(St);if(z.substring(pt+1+ke,pt+1+ke+B)===O){if(W.push(z.substring(N,pt).replace(Ye,_)),Me(pt+1+ke+B),vt=z.indexOf(S,N),pt=z.indexOf(_,N),U&&(ae(),st))return Kt();if(j&&Z.length>=j)return Kt(!0);break}Y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Z.length,index:N}),pt++}}else pt++}return ye();function Ve(zt){Z.push(zt),et=N}function de(zt){var ar=0;if(zt!==-1){var ai=z.substring(pt+1,zt);ai&&ai.trim()===""&&(ar=ai.length)}return ar}function ye(zt){return _t||(zt===void 0&&(zt=z.substring(N)),W.push(zt),N=H,Ve(W),U&&ae()),Kt()}function Me(zt){N=zt,Ve(W),W=[],St=z.indexOf(O,N)}function Kt(zt){return{data:Z,errors:Y,meta:{delimiter:S,linebreak:O,aborted:st,truncated:!!zt,cursor:et+(At||0)}}}function ae(){F(Kt()),Z=[],Y=[]}},this.abort=function(){st=!0},this.getCharIndex=function(){return N}}function v(b){var _=b.data,S=a[_.workerId],O=!1;if(_.error)S.userError(_.error,_.file);else if(_.results&&_.results.data){var A={abort:function(){O=!0,M(_.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:C,resume:C};if(T(S.userStep)){for(var F=0;F<_.results.data.length&&(S.userStep({data:_.results.data[F],errors:_.results.errors,meta:_.results.meta},A),!O);F++);delete _.results}else T(S.userChunk)&&(S.userChunk(_.results,A,_.file),delete _.results)}_.finished&&!O&&M(_.workerId,_.results)}function M(b,_){var S=a[b];T(S.userComplete)&&S.userComplete(_),S.terminate(),delete a[b]}function C(){throw new Error("Not implemented.")}function D(b){if(typeof b!="object"||b===null)return b;var _=Array.isArray(b)?[]:{};for(var S in b)_[S]=D(b[S]);return _}function E(b,_){return function(){b.apply(_,arguments)}}function T(b){return typeof b=="function"}return r&&(i.onmessage=function(b){var _=b.data;if(l.WORKER_ID===void 0&&_&&(l.WORKER_ID=_.workerId),typeof _.input=="string")i.postMessage({workerId:l.WORKER_ID,results:l.parse(_.input,_.config),finished:!0});else if(i.File&&_.input instanceof File||_.input instanceof Object){var S=l.parse(_.input,_.config);S&&i.postMessage({workerId:l.WORKER_ID,results:S,finished:!0})}}),(d.prototype=Object.create(u.prototype)).constructor=d,(h.prototype=Object.create(u.prototype)).constructor=h,(g.prototype=Object.create(g.prototype)).constructor=g,(p.prototype=Object.create(u.prototype)).constructor=p,l})})(sh);var Qk=sh.exports;const Jk=["id"],tM=f.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:t}){const e=t,i=n,s=f.computed(()=>`export_${new Date().getTime()}`),r=f.computed(()=>{const u=l();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Rn.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return typeof u===Rn.Object?d=>xk(d,(h,g)=>u[g]||g):d=>d},o=()=>{const u=i.fields;if(typeof i.fields!==Rn.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?d=>Kk(d,u):d=>d},l=()=>{if(typeof i.fields===Rn.Undefined&&typeof i.labels===Rn.Undefined)return i.data;const u=a(),d=o();return i.data.map(h=>u(d(h)))},c=()=>{if(!(r!=null&&r.value)){console.warn("No data to export");return}e("export-started",r.value);let u=Qk.unparse(r.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
43
+ `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),e("export-finished",i.filename),!i.testing){const d=new Blob([u],{type:"text/csv;charset="+i.encoding});Zk.saveAs(d,i.filename)}};return(u,d)=>(f.openBlock(),f.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[f.renderSlot(u.$slots,"default",{},()=>[f.createTextVNode("Download "+f.toDisplayString(n.filename),1)])],8,Jk))}}),eM=f.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const t=n,e=f.computed(()=>Object.keys(t.headers));return(i,s)=>(f.openBlock(),f.createElementBlock("div",null,[f.createVNode(tM,{data:i.rows,fields:e.value,filename:i.filename,labels:i.headers},{default:f.withCtx(()=>[f.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}});function rh(n,t,e){const i=sM(n,e.timeZone,e.locale);return"formatToParts"in i?nM(i,t):iM(i,t)}function nM(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function iM(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function sM(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function rM(n,t){const e=cM(t);return"formatToParts"in e?oM(e,n):lM(e,n)}const aM={year:0,month:1,day:2,hour:3,minute:4,second:5};function oM(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=aM[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function lM(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const uo={};function cM(n){if(!uo[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";uo[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return uo[n]}function ah(n,t,e,i,s,r,a){const o=new Date(0);return o.setUTCFullYear(n,t,e),o.setUTCHours(i,s,r,a),o}const oh=36e5,uM=6e4,ho={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function lh(n,t,e){if(!n)return 0;let i=ho.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=ho.timezoneHH.exec(n),i)return s=parseInt(i[1],10),ch(s)?-(s*oh):NaN;if(i=ho.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return ch(s,a)?(r=Math.abs(s)*oh+a*uM,i[1]==="+"?-r:r):NaN}if(fM(n)){t=new Date(t||Date.now());const a=e?t:dM(t),o=fo(a,n);return-(e?o:hM(t,o,n))}return NaN}function dM(n){return ah(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function fo(n,t){const e=rM(n,t),i=ah(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function hM(n,t,e){let s=n.getTime()-t;const r=fo(new Date(s),e);if(t===r)return t;s-=r-t;const a=fo(new Date(s),e);return r===a?r:Math.max(r,a)}function ch(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const uh={};function fM(n){if(uh[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),uh[n]=!0,!0}catch{return!1}}const gM=60*1e3,pM={X:function(n,t,e){const i=go(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return dh(i);case"XXXX":case"XX":return ri(i);case"XXXXX":case"XXX":default:return ri(i,":")}},x:function(n,t,e){const i=go(e.timeZone,n);switch(t){case"x":return dh(i);case"xxxx":case"xx":return ri(i);case"xxxxx":case"xxx":default:return ri(i,":")}},O:function(n,t,e){const i=go(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+mM(i,":");case"OOOO":default:return"GMT"+ri(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return rh("short",n,e);case"zzzz":default:return rh("long",n,e)}}};function go(n,t){const e=n?lh(n,t,!0)/gM:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function rr(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function ri(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=rr(Math.floor(i/60),2),r=rr(Math.floor(i%60),2);return e+s+t+r}function dh(n,t){return n%60===0?(n>0?"-":"+")+rr(Math.abs(n)/60,2):ri(n,t)}function mM(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+rr(r,2)}function hh(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const yM=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,po=36e5,fh=6e4,bM=2,Gt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:yM};function xM(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?bM:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=_M(n),{year:s,restDateString:r}=wM(i.date,e),a=vM(r,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const o=a.getTime();let l=0,c;if(i.time&&(l=kM(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=lh(i.timeZone||t.timeZone,new Date(o+l)),isNaN(c))return new Date(NaN)}else c=hh(new Date(o+l)),c=hh(new Date(o+l+c));return new Date(o+l+c)}else return new Date(NaN)}function _M(n){const t={};let e=Gt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Gt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Gt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function wM(n,t){if(n){const e=Gt.YYY[t],i=Gt.YYYYY[t];let s=Gt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Gt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function vM(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Gt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,mh(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Gt.DDD.exec(n),r){e=new Date(0);const a=parseInt(r[1],10);return DM(t,a)?(e.setUTCFullYear(t,0,a),e):new Date(NaN)}if(r=Gt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const a=parseInt(r[2],10);return mh(t,i,a)?(e.setUTCFullYear(t,i,a),e):new Date(NaN)}if(r=Gt.Www.exec(n),r)return s=parseInt(r[1],10)-1,yh(s)?gh(t,s):new Date(NaN);if(r=Gt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const a=parseInt(r[2],10)-1;return yh(s,a)?gh(t,s,a):new Date(NaN)}return null}function kM(n){let t,e,i=Gt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),mo(t)?t%24*po:NaN;if(i=Gt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),mo(t,e)?t%24*po+e*fh:NaN;if(i=Gt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return mo(t,e,s)?t%24*po+e*fh+s*1e3:NaN}return null}function gh(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const MM=[31,28,31,30,31,30,31,31,30,31,30,31],SM=[31,29,31,30,31,30,31,31,30,31,30,31];function ph(n){return n%400===0||n%4===0&&n%100!==0}function mh(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=ph(n);if(i&&e>SM[t]||!i&&e>MM[t])return!1}return!0}function DM(n,t){if(t<1)return!1;const e=ph(n);return!(e&&t>366||!e&&t>365)}function yh(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function mo(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const TM=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function bh(n,t,e={}){t=String(t);const i=t.match(TM);if(i){const s=xM(e.originalDate||n,e);t=i.reduce(function(r,a){if(a[0]==="'")return r;const o=r.indexOf(a),l=r[o-1]==="'",c=r.replace(a,"'"+pM[a[0]](s,a,e)+"'");return l?c.substring(0,o-1)+c.substring(o+1):c},t)}return hu(n,t,e)}const CM={class:"kong-ui-public-csv-export-modal"},PM={key:0,class:"selected-range"},OM={key:1,class:"text-muted",tag:"span"},xh=3,_h=f.defineComponent({__name:"CsvExportModal",props:{filename:{},modalDescription:{default:void 0},chartData:{}},emits:["toggleModal"],setup(n,{emit:t}){const{i18n:e}=gt.useI18n(),i=n,s=t,r=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=f.ref(!0),o=f.computed(()=>{var y,x;return!!((x=(y=i.chartData)==null?void 0:y.data)!=null&&x.length)}),l=f.ref(1),c=f.computed(()=>g.value.rows.length),u=gt.useChartSelectedRange(f.toRef(i,"chartData")),d=f.computed(()=>e.t("csvExport.previewRows",{rowsMax:Math.min(xh,c.value),rowsTotal:c.value,plural:c.value===1?"":"s"})),h=()=>{s("toggleModal",!1)},g=f.computed(()=>{var D,E,T;if(!o.value||!((D=i.chartData)!=null&&D.meta.metric_names))return{headers:[],rows:[],csvHeaders:{}};const y=i.chartData.data.some(b=>b.timestamp!==i.chartData.data[0].timestamp),x=i.chartData.data.map(b=>{const _=new Date(b.timestamp);return{...Object.keys(b.event).reduce((O,A)=>{if(A in i.chartData.meta.display){const F=b.event[A],j=i.chartData.meta.display[A];O[A]=F&&j&&j[F].name||b.event[A]}else O[A]=b.event[A];return O},{}),...y?{timestamp:bh(_,"yyyy-MM-dd HH:mm:ss"),tzOffset:bh(_,"XXX")}:{}}});let w=[];y&&(w=[{label:e.t("csvExport.Timestamp"),key:"timestamp"},{label:e.t("csvExport.UtcOffset"),key:"tzOffset"}]);const v="display"in i.chartData.meta&&((E=i.chartData.meta)!=null&&E.display)?(T=i.chartData.meta)==null?void 0:T.display:{},M=[...w,...Object.keys(v).map(b=>({label:e.t(`chartLabels.${b}`),key:b})),...i.chartData.meta.metric_names.map(b=>({label:e.t(`chartLabels.${b}`),key:b}))],C=M.reduce((b,_)=>(b[_.key]=_.label,b),{});return{headers:M,csvHeaders:C,rows:x}}),p=()=>{const{rows:y}=g.value;return a.value=!1,{total:Number(y.length)||0,data:y.slice(0,xh)}};return f.watch(g,()=>{l.value++}),(y,x)=>{const w=f.resolveComponent("KEmptyState"),v=f.resolveComponent("KTable"),M=f.resolveComponent("KButton"),C=f.resolveComponent("KModal");return f.openBlock(),f.createElementBlock("div",CM,[f.createVNode(C,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:f.unref(e).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:f.withKeys(h,["esc"])},{default:f.withCtx(()=>{var D;return[f.createElementVNode("div",null,[o.value?(f.openBlock(),f.createElementBlock("div",PM,[f.createElementVNode("p",null,f.toDisplayString(y.modalDescription?y.modalDescription:f.unref(e).t("csvExport.exportDescription")),1),f.createElementVNode("p",null,f.toDisplayString(f.unref(e).t("csvExport.exportTimeRange"))+": "+f.toDisplayString(f.unref(u)),1)])):f.createCommentVNode("",!0),f.createVNode(v,{class:"vitals-table","disable-pagination":"",fetcher:p,"fetcher-cache-key":String(l.value),headers:((D=g.value)==null?void 0:D.headers)||[],"row-hover":!1,sortable:!1},{"empty-state":f.withCtx(()=>[f.createVNode(w,{"action-button-visible":!1},{title:f.withCtx(()=>[f.createElementVNode("h5",null,f.toDisplayString(f.unref(e).t("csvExport.noDataRange")),1)]),default:f.withCtx(()=>[f.createElementVNode("p",null,f.toDisplayString(f.unref(e).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"]),!a.value&&o.value?(f.openBlock(),f.createElementBlock("div",OM,f.toDisplayString(d.value),1)):f.createCommentVNode("",!0)])]}),"footer-actions":f.withCtx(()=>[f.createVNode(M,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("csvExport.cancelButton")),1)]),_:1}),f.createVNode(eM,{class:"vitals-report-export-button",filename:r,headers:g.value.csvHeaders,rows:g.value.rows},{default:f.withCtx(()=>[f.createVNode(M,{appearance:"primary","data-testid":"csv-download-button",disabled:a.value||!o.value},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}}),wh=f.defineComponent({__name:"CsvExportButton",props:{data:{type:Object,required:!0},text:{type:String,required:!1,default:void 0},buttonAppearance:{type:String,required:!1,default:()=>"tertiary"},filenamePrefix:{type:String,required:!1,default:void 0}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>t.filenamePrefix||e.t("csvExport.defaultFilename")),s=f.ref(!1),r=o=>{s.value=o},a=()=>{r(!0)};return(o,l)=>{const c=f.resolveComponent("KButton");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createVNode(c,{appearance:n.buttonAppearance,class:"chart-export-button-display","data-testid":"csv-export-button",onClick:f.withModifiers(a,["prevent"])},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(n.text||f.unref(e).t("csvExport.exportButton")),1)]),_:1},8,["appearance"]),s.value?(f.openBlock(),f.createBlock(_h,{key:0,"chart-data":n.data,filename:i.value,onToggleModal:r},null,8,["chart-data","filename"])):f.createCommentVNode("",!0)],64)}}}),EM={class:"analytics-chart-shell"},AM={key:0,class:"chart-header"},RM={key:0,class:"chart-title"},LM={class:"chart-header-icons-wrapper"},IM={key:1,class:"chart-export-button"},NM={key:2,class:"analytics-chart-parent"},FM=f.defineComponent({__name:"AnalyticsChart",props:{allowCsvExport:{type:Boolean,required:!1,default:!1},chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},tooltipTitle:{type:String,required:!1,default:""},emptyStateTitle:{type:String,required:!1,default:""},emptyStateDescription:{type:String,required:!1,default:""},chartTitle:{type:String,required:!1,default:""},filenamePrefix:{type:String,required:!1,default:""},legendPosition:{type:String,required:!1,default:Pt.Right},syntheticsDataKey:{type:String,required:!1,default:""},showLegendValues:{type:Boolean,required:!1,default:!0},showAnnotations:{type:Boolean,required:!1,default:!0}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.toRef(t,"chartData"),s=f.computed(()=>g.value?gt.useExploreResultToTimeDataset({fill:t.chartOptions.stacked,colorPalette:t.chartOptions.chartDatasetColors||Vs},f.toRef(t,"chartData")).value:gt.useExploreResultToDatasets({fill:t.chartOptions.stacked,colorPalette:t.chartOptions.chartDatasetColors||Vs},f.toRef(t,"chartData")).value),r=f.computed(()=>{var S;return(S=t.chartData)!=null&&S.meta?"start_ms"in t.chartData.meta?t.chartData.meta.end_ms-t.chartData.meta.start_ms:void 0:0}),a=f.computed(()=>{var S;return(S=t.chartData.meta)!=null&&S.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),o=f.computed(()=>t.showLegendValues&&t.legendPosition!==Pt.Bottom),{legendValues:l}=gt.useChartLegendValues(s,t.chartOptions.type,a),c=f.computed(()=>{var S,O,A;return((A=(O=(S=t.chartData)==null?void 0:S.meta)==null?void 0:O.limit)==null?void 0:A.toString())||null}),u=f.computed(()=>{var S,O;return((O=(S=t.chartData)==null?void 0:S.meta)==null?void 0:O.truncated)||!1}),d=e.t("limitedResultsShown",{maxReturned:c.value}),h=f.computed(()=>["vertical_bar","horizontal_bar"].includes(t.chartOptions.type)),g=f.computed(()=>["timeseries_bar","timeseries_line"].some(S=>S===t.chartOptions.type)),p=f.computed(()=>t.chartOptions.type==="doughnut"),y=f.computed(()=>t.chartOptions.type.includes("vertical")?"vertical":"horizontal"),x=f.computed(()=>{var A,F,j;if(!((A=t.chartData)!=null&&A.meta.metric_names)||!((F=t.chartData)!=null&&F.meta.metric_units))return;const S=t.chartData.meta.metric_names[0],O=t.chartData.meta.metric_units[S];if(t.chartData.meta.metric_names.length>1){if(S.includes("latency"))return e.t("metricAxisTitles.latency_in",{unit:e.t(`chartUnits.${O}`,{plural:"s"})});if(S.includes("size"))return e.t("metricAxisTitles.size_in",{unit:e.t(`chartUnits.${O}`,{plural:"s"})})}return((j=t.chartOptions)==null?void 0:j.metricAxesTitle)||e.te(`metricAxisTitles.${S}`)&&e.te(`chartUnits.${O}`)&&e.t(`metricAxisTitles.${S}`,{unit:e.t(`chartUnits.${O}`,{plural:"s"})})||void 0}),w=f.computed(()=>{const S=g.value?"Time":Object.keys(t.chartData.meta.display||t.chartData.meta.metric_names)[0];return t.chartOptions.dimensionAxesTitle||e.te(`chartLabels.${S}`)&&e.t(`chartLabels.${S}`)||void 0}),v=f.computed(()=>{const S=Ba(Number(t.chartData.meta.granularity_ms));return e.t(`granularityAxisTitles.${S}`)}),M=f.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),C=f.computed(()=>t.emptyStateDescription||e.t("noDataAvailableDescription")),D=f.computed(()=>g.value?Cx(s.value):t.chartData&&t.chartData.meta&&t.chartData.data.length),E=f.computed(()=>D.value&&u.value&&c.value||t.chartTitle||t.allowCsvExport&&D.value),T=f.computed(()=>t.chartData.meta.granularity_ms?Ba(t.chartData.meta.granularity_ms)||"hourly":Ba(new Date(t.chartData.data[1].timestamp).getTime()-new Date(t.chartData.data[0].timestamp).getTime())||"hourly"),b=f.computed(()=>t.chartOptions.chartLegendSortFn?t.chartOptions.chartLegendSortFn:(S,O)=>S.text===e.t("chartLabels.____OTHER____")?1:O.text===e.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(S.text,10))&&!isNaN(parseInt(O.text,10))?S.text<O.text?-1:1:S.value&&O.value?O.value.raw-S.value.raw:0),_=f.computed(()=>t.chartOptions.chartTooltipSortFn?t.chartOptions.chartTooltipSortFn:(S,O)=>S.label===e.t("chartLabels.____OTHER____")?1:O.label===e.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(S.label,10))&&!isNaN(parseInt(O.label,10))?S.label<O.label?-1:1:S.value&&O.value?O.rawValue-S.rawValue:0);return f.provide("showLegendValues",o),f.provide("legendPosition",f.toRef(t,"legendPosition")),(S,O)=>{const A=f.resolveComponent("KTooltip"),F=f.resolveComponent("KEmptyState");return f.openBlock(),f.createElementBlock("div",EM,[E.value?(f.openBlock(),f.createElementBlock("div",AM,[n.chartTitle?(f.openBlock(),f.createElementBlock("div",RM,f.toDisplayString(n.chartTitle),1)):f.createCommentVNode("",!0),f.createElementVNode("div",LM,[D.value&&u.value&&c.value?(f.openBlock(),f.createBlock(A,{key:0,class:"tooltip","max-width":"500",placement:"right"},{content:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(d)),1)]),default:f.withCtx(()=>[f.createVNode(f.unref(Do.WarningIcon),{color:`var(--kui-color-text-warning, ${f.unref(Pv)})`,decorative:"",size:f.unref(Ov)},null,8,["color","size"])]),_:1})):f.createCommentVNode("",!0)]),n.allowCsvExport&&D.value?(f.openBlock(),f.createElementBlock("div",IM,[f.createVNode(wh,{data:i.value,"filename-prefix":n.filenamePrefix},null,8,["data","filename-prefix"])])):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0),D.value?(f.openBlock(),f.createElementBlock("div",NM,[g.value?(f.openBlock(),f.createBlock(pk,{key:0,"chart-data":s.value,"chart-legend-sort-fn":b.value,"chart-tooltip-sort-fn":_.value,"dimension-axes-title":v.value,fill:n.chartOptions.stacked,granularity:T.value,"legend-values":f.unref(l),"metric-axes-title":x.value,"metric-unit":a.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"time-range-ms":r.value,"tooltip-title":n.tooltipTitle,type:n.chartOptions.type},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","fill","granularity","legend-values","metric-axes-title","metric-unit","stacked","synthetics-data-key","time-range-ms","tooltip-title","type"])):h.value?(f.openBlock(),f.createBlock(nk,{key:1,annotations:n.showAnnotations,"chart-data":s.value,"chart-legend-sort-fn":b.value,"chart-tooltip-sort-fn":_.value,"data-testid":"bar-chart-container","dimension-axes-title":w.value,"legend-values":f.unref(l),"metric-axes-title":x.value,"metric-unit":a.value,orientation:y.value,stacked:n.chartOptions.stacked,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-title"])):p.value?(f.openBlock(),f.createBlock(gk,{key:2,"chart-data":s.value,"dataset-colors":n.chartOptions.chartDatasetColors||f.unref(Vs),"legend-position":n.legendPosition,"legend-values":f.unref(l),"metric-unit":a.value,"synthetics-data-key":n.syntheticsDataKey,"tooltip-title":n.tooltipTitle},null,8,["chart-data","dataset-colors","legend-position","legend-values","metric-unit","synthetics-data-key","tooltip-title"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(F,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(M.value),1)]),default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(C.value),1)]),_:1}))])}}}),zM=We(FM,[["__scopeId","data-v-470fa6ac"]]),BM={class:"chart-parent","data-testid":"doughnut-chart-parent"},HM={class:"chart-totals-flex"},WM={key:1,class:"metric-small","data-testid":"doughnut-chart-total"},YM=f.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:Jn.Hidden},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:Be},height:{type:String,required:!1,default:"400px",validator:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.ref(hn()),s=f.computed(()=>[t.chartData.datasets.reduce((p,y)=>(p.labels.push(y.label),p.borderColor.push(y.backgroundColor),p.backgroundColor.push(y.backgroundColor),p.data.push(y.data.reduce((x,w)=>x+w,0)),p),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),r=f.computed(()=>({...t.chartData,datasets:s.value}));gt.useReportChartDataForSynthetics(f.toRef(t,"chartData"),f.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},o=f.ref(),l=f.computed(()=>{var g;return ji((g=s==null?void 0:s.value[0])==null?void 0:g.data[t.numerator],{capital:!0})}),c=f.computed(()=>{var g,p;return ji(((g=s==null?void 0:s.value[0])==null?void 0:g.data[0])+((p=s==null?void 0:s.value[0])==null?void 0:p.data[1]),{capital:!0})}),u=f.computed(()=>{var g;return`color: ${(g=s==null?void 0:s.value[0])==null?void 0:g.backgroundColor[t.numerator]}`}),d=f.computed(()=>[Jn.Full,Jn.SingleMetric].includes(t.metricDisplay)),h=f.computed(()=>t.metricDisplay===Jn.Full);return(g,p)=>(f.openBlock(),f.createElementBlock("div",BM,[f.createElementVNode("div",HM,[d.value?(f.openBlock(),f.createElementBlock("div",{key:0,class:"metric-large","data-testid":"doughnut-chart-metric",style:f.normalizeStyle(u.value)},f.toDisplayString(l.value),5)):f.createCommentVNode("",!0),h.value?(f.openBlock(),f.createElementBlock("div",WM,f.toDisplayString(f.unref(e).t("total"))+": "+f.toDisplayString(c.value),1)):f.createCommentVNode("",!0)]),f.createElementVNode("div",{class:"chart-container",style:f.normalizeStyle({height:n.height,width:n.width})},[f.createVNode(f.unref(Zd),{ref_key:"chartInstance",ref:o,"chart-id":i.value,data:r.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),VM=We(YM,[["__scopeId","data-v-18bc031c"]]),jM={class:"simple-chart-shell"},$M={key:1,class:"analytics-chart-parent"},qM=We(f.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:n=>/(\d *)(px|%)/.test(n)},width:{type:String,required:!1,default:"100%",validator:n=>/(\d *)(px|%)/.test(n)}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>{var c;const l=gt.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors||Be},f.toRef(t,"chartData")).value;return(c=t.chartOptions)!=null&&c.reverseDataset&&(l==null||l.datasets.reverse()),l}),s=f.computed(()=>{var l;return(l=t.chartData.meta)!=null&&l.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""}),r=f.computed(()=>t.chartOptions.type==="gauge"),a=f.computed(()=>t.emptyStateTitle||e.t("noDataAvailableTitle")),o=f.computed(()=>t.chartData&&t.chartData.meta&&t.chartData.data.length);return(l,c)=>{const u=f.resolveComponent("KEmptyState");return f.openBlock(),f.createElementBlock("div",jM,[o.value?(f.openBlock(),f.createElementBlock("div",$M,[r.value?(f.openBlock(),f.createBlock(VM,{key:0,"chart-data":i.value,"dataset-colors":n.chartOptions.chartDatasetColors,"is-simple":"","metric-display":n.chartOptions.metricDisplay,"metric-unit":s.value,numerator:n.chartOptions.numerator,"synthetics-data-key":n.syntheticsDataKey,width:n.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createBlock(u,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(a.value),1)]),_:1}))])}}}),[["__scopeId","data-v-0ee40a4b"]]),UM={class:"top-n-card-title","data-testid":"top-n-card-title"},XM={class:"top-n-card-description","data-testid":"top-n-card-description"},GM={key:3,class:"top-n-table","data-testid":"top-n-table"},KM={class:"table-headings"},ZM={class:"table-row"},QM={class:"column-1"},JM={class:"column-2"},tS={class:"table-body","data-testid":"top-n-data"},eS=["data-testid"],nS={class:"column-1"},iS={class:"column-2"},sS=We(f.defineComponent({__name:"TopNTable",props:{title:{type:String,required:!0},description:{type:String,default:""},data:{type:Object,required:!0},emptyStateTitle:{type:String,default:""},isLoading:{type:Boolean,default:!1},titleTag:{type:String,default:"h2"}},setup(n){const t=n,{i18n:e}=gt.useI18n(),i=f.computed(()=>t.data.data),s=f.computed(()=>{var p;return!!((p=i.value)!=null&&p.length)}),r=f.computed(()=>{var p,y;return(p=t.data.meta)!=null&&p.display&&((y=Object.keys(t.data.meta.display))==null?void 0:y[0])||""}),a=f.computed(()=>r.value?t.data.meta.display[r.value]:{}),o=f.computed(()=>{var p,y;return(y=(p=t.data.meta)==null?void 0:p.metric_names)!=null&&y.length?t.data.meta.metric_names[0]:""}),l=f.computed(()=>o.value?e.t(`chartLabels.${o.value}`)||o.value:""),c=f.computed(()=>{if(!s.value)return"";if(t.data.meta){if(a.value&&!Object.keys(a.value).length)return e.t("topNTable.errors.display");if(!o.value)return e.t("topNTable.errors.metricNames")}else return e.t("topNTable.errors.meta");return""}),u=p=>{const y=p.event;return String(y[r.value])},d=p=>{const y=u(p),x=a.value&&a.value[y];return x?x.name:"-"},h=p=>{const y=u(p),x=a.value&&a.value[y];return x?!!x.deleted:!1},g=p=>{if(!o.value)return"–";const x=p.event[o.value];return x?ji(x,{capital:!0,round:!0}):"–"};return(p,y)=>{const x=f.resolveComponent("KEmptyState"),w=f.resolveComponent("KSkeleton"),v=f.resolveComponent("KCard");return f.openBlock(),f.createBlock(v,{class:"kong-ui-public-top-n-table","title-tag":n.titleTag},f.createSlots({default:f.withCtx(()=>[c.value?(f.openBlock(),f.createBlock(x,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(f.unref(e).t("topNTable.defaultErrorStateTitle")),1)]),default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(c.value),1)]),_:1})):n.isLoading?(f.openBlock(),f.createBlock(w,{key:1,"table-columns":2,type:"table"})):s.value?(f.openBlock(),f.createElementBlock("div",GM,[f.createElementVNode("div",KM,[f.createElementVNode("div",ZM,[f.createElementVNode("div",QM,f.toDisplayString(f.unref(e).t("topNTable.nameLabel")),1),f.createElementVNode("div",JM,f.toDisplayString(l.value),1)])]),f.createElementVNode("div",tS,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(i.value,(M,C)=>(f.openBlock(),f.createElementBlock("div",{key:`entry-${C}`,class:"table-row","data-testid":`row-${u(M)}`},[f.createElementVNode("div",nS,[f.renderSlot(p.$slots,"name",{record:{id:u(M),name:d(M),deleted:h(M),dimension:r.value}},()=>[f.createTextVNode(f.toDisplayString(d(M)),1)],!0)]),f.createElementVNode("div",iS,"   "+f.toDisplayString(g(M)),1)],8,eS))),128))])])):(f.openBlock(),f.createBlock(x,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(n.emptyStateTitle||f.unref(e).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[n.title?{name:"title",fn:f.withCtx(()=>[f.createElementVNode("span",UM,f.toDisplayString(n.title),1)]),key:"0"}:void 0,n.description?{name:"actions",fn:f.withCtx(()=>[f.createElementVNode("div",XM,f.toDisplayString(n.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-50809fdb"]]);Q.AnalyticsChart=zM,Q.ChartLegendPosition=Pt,Q.ChartMetricDisplay=Jn,Q.CsvExportButton=wh,Q.CsvExportModal=_h,Q.DECIMAL_DISPLAY=_u,Q.FONT_SIZE_REGULAR=vu,Q.FONT_SIZE_SMALL=wu,Q.MAX_LABEL_LENGTH=Ys,Q.OTHERS_COLOR=Lx,Q.SimpleChart=qM,Q.TopNTable=sS,Q.ValidType=Rn,Q.accessibleGrey=Su,Q.apiRequestStatusCodeColors=Du,Q.chartTypes=mk,Q.codesInSpec=Ou,Q.darkenColor=Mu,Q.datavisPalette=Be,Q.defaultStatusCodeColors=Vs,Q.errorRateColors=Ax,Q.latencyColors=Rx,Q.lightGrey=Ta,Q.lookupColor=Ix,Q.lookupDatavisColor=Xn,Q.lookupStatusCodeCategoryColor=Yx,Q.lookupStatusCodeColor=Ca,Q.numberFormatter=Ws,Q.simpleChartTypes=yk,Q.statusCodeBadgeBackgroundColor=Ox,Q.trafficColors=Ex,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});