@mxtommy/kip 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/package.json +1 -1
- package/public/assets/help-docs/menu.json +1 -0
- package/public/assets/help-docs/putcontrols.md +60 -0
- package/public/{chunk-G7AGGO3N.js → chunk-2Y6OT6VQ.js} +1 -1
- package/public/{chunk-A2OM6FWE.js → chunk-55WFSEKP.js} +1 -1
- package/public/{chunk-7WCRIBH3.js → chunk-E2USGHSP.js} +1 -1
- package/public/{chunk-IIVUAHLC.js → chunk-GV2JTAMW.js} +1 -1
- package/public/{chunk-B3M2VHRA.js → chunk-JKSAHAZC.js} +1 -1
- package/public/{chunk-66LZQV4J.js → chunk-RNQY2ZHR.js} +1 -1
- package/public/{chunk-62KBSBLZ.js → chunk-WR74IMVF.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-44TXCUJL.js → main-OWSKDRJZ.js} +2 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
{ "title": "Dashboards and Layout", "file": "dashboards.md" },
|
|
4
4
|
{ "title": "Datasets and Data Charts", "file": "datasets.md" },
|
|
5
5
|
{ "title": "Zones, Notifications and Highlights", "file": "zones.md" },
|
|
6
|
+
{ "title": "Updating Signal K data", "file": "putcontrols.md" },
|
|
6
7
|
{ "title": "Configuration Management", "file": "configuration.md" },
|
|
7
8
|
{ "title": "Data Inspector", "file": "datainspector.md" },
|
|
8
9
|
{ "title": "Gafana Integration", "file": "grafana.md" },
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Updating Signal K Data with PUT Commands
|
|
2
|
+
|
|
3
|
+
Signal K allows users to update data paths and trigger device reactions. This can include turning a light on or off, dimming it, activating a bilge pump, or other similar actions. This guide explains how to use the Switch Panel or Slider widgets to achieve this, how to verify if a path supports data reception (known as PUT-enabled in Signal K terms), and what is required to enable PUT functionality.
|
|
4
|
+
|
|
5
|
+
## What is Required to Trigger Device Reactions
|
|
6
|
+
By default, sending data to a Signal K path only updates the value and broadcasts it to the network. No actions are taken unless a plugin or handler is configured to respond to the updated value. For example:
|
|
7
|
+
- Sending a PUT command to `self.steering.autopilot.state` will update the state value, but the autopilot will not engage unless a plugin or handler is set up to process the command and communicate with the hardware.
|
|
8
|
+
|
|
9
|
+
To enable actions, you have several options:
|
|
10
|
+
1. **Install a Plugin**:
|
|
11
|
+
- The simplest option is to look in Signal K's app store. There are many plugins already available in the Signal K ecosystem. Search for the plugin you need, install it, and configure it.
|
|
12
|
+
|
|
13
|
+
2. **Use Node-RED's Signal K PUT Handler**:
|
|
14
|
+
- Node-RED is a visual and easy-to-learn automation platform installed with Signal K. The Signal K team has created Signal K-specific Node-RED nodes, allowing you to easily automate your vessel. You can find Node-RED in the Webapps section of the Signal K server.
|
|
15
|
+
|
|
16
|
+
3. **Build Your Own Plugin**:
|
|
17
|
+
- If no existing plugin meets your needs, you can create a custom Signal K plugin to handle PUT commands for your specific requirements.
|
|
18
|
+
|
|
19
|
+
## Checking for PUT Support
|
|
20
|
+
To verify if a path supports PUT:
|
|
21
|
+
1. Open KIP's **Data Inspector** located in the right sidebar.
|
|
22
|
+
2. Search for the desired path (e.g., `self.electrical.switches.bank.0.1.state` or just `self.electrical` to list many).
|
|
23
|
+
3. Look for a green check indicator in the **PUT Support** column. If PUT is not enabled/supported, the path will not be listed in the path selection options of widgets designed to send data.
|
|
24
|
+
|
|
25
|
+
## Types of Path Data That Are Supported
|
|
26
|
+
KIP currently supports the following types of paths for widgets:
|
|
27
|
+
1. **Boolean Paths**:
|
|
28
|
+
- Supported by the Switch Panel widget.
|
|
29
|
+
- These paths toggle between `true` and `false` values (e.g., turning a device on/off).
|
|
30
|
+
|
|
31
|
+
2. **Numerical Data Ranges**:
|
|
32
|
+
- Supported by the Slider widget.
|
|
33
|
+
- These paths allow for a range of numeric values (e.g., dimming a light or adjusting volume).
|
|
34
|
+
|
|
35
|
+
For backward compatibility, boolean paths can also support numerical data types with `1/0` values. However, this legacy mode is discouraged. If needed, you can enable this mode by selecting the "Use Numeric" checkbox below the control.
|
|
36
|
+
|
|
37
|
+
## Using the Switch Panel or Slider Widgets
|
|
38
|
+
1. **Open the Widget Configuration**:
|
|
39
|
+
- Add a Switch Panel or Slider widget to your dashboard.
|
|
40
|
+
- Double-tap the widget to access its configuration options.
|
|
41
|
+
- Configure the widget to use the desired Signal K data path from the list of PUT-enabled paths.
|
|
42
|
+
|
|
43
|
+
2. **Verify the Path**:
|
|
44
|
+
- Use the **Data Inspector** to search for the data path you want to update.
|
|
45
|
+
- Check if the path has **PUT Support** enabled. Paths with PUT support allow you to send updates to Signal K.
|
|
46
|
+
|
|
47
|
+
3. **Send Updates**:
|
|
48
|
+
- Once configured, use the widget to send updates to the selected path. For example:
|
|
49
|
+
- A Switch Panel can toggle a boolean value (e.g., turning a device on/off).
|
|
50
|
+
- A Slider can adjust a numeric value (e.g., setting a dim percentage or audio system volume level).
|
|
51
|
+
- Use the **Data Inspector** to search for the data path and see the updated path value.
|
|
52
|
+
* If you find you have issues or need to troubleshoot further, using the Signal K Data Browser to validate path configuration, metadata, value or consult the server logs is also a best practice.
|
|
53
|
+
|
|
54
|
+
## Summary
|
|
55
|
+
To update Signal K data with PUT commands:
|
|
56
|
+
1. Verify PUT support for the path using the Data Inspector.
|
|
57
|
+
2. Enable PUT support by installing a plugin, building one, or using Node-RED with the Signal K PUT Handler.
|
|
58
|
+
3. Use the Switch Panel or Slider widgets to send updates.
|
|
59
|
+
|
|
60
|
+
With these steps, you can effectively update Signal K data and trigger actions on your vessel's systems.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as c,k as s,r as p}from"./chunk-AHFD2AA5.js";import{Va as i,cd as a,m as n,o as m,oa as g,ua as l}from"./chunk-JIJMSRKJ.js";var u="3.1.
|
|
1
|
+
import{g as c,k as s,r as p}from"./chunk-AHFD2AA5.js";import{Va as i,cd as a,m as n,o as m,oa as g,ua as l}from"./chunk-JIJMSRKJ.js";var u="3.1.4";var D=(()=>{class o{MODE_PATH="self.environment.mode";configurableThemeColors=[{label:"Contrast",value:"contrast"},{label:"Blue",value:"blue"},{label:"Green",value:"green"},{label:"Orange",value:"orange"},{label:"Yellow",value:"yellow"},{label:"Pink",value:"pink"},{label:"Purple",value:"purple"},{label:"Grey",value:"grey"}];snackbarAppNotifications=new n;cssThemeColorRoles$=new m(null);_cssThemeColorRoles=null;_settings=l(c);_data=l(p);isNightMode=i(!1);_useAutoNightMode=s(this._settings.getAutoNightModeAsO(),{requireSync:!0});_theme=s(this._settings.getThemeNameAsO(),{requireSync:!0});_redNightMode=s(this._settings.getRedNightModeAsO(),{requireSync:!0});_environmentMode=s(this._data.subscribePath(this.MODE_PATH,"default"));appVersion=i(u);browserVersion=i("Unknown");osVersion=i("Unknown");constructor(){a(()=>{this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")}),a(()=>{let t=this._environmentMode().data.value;this._useAutoNightMode()&&(this.isNightMode.set(t==="night"),this.toggleDayNightMode())}),a(()=>{this._redNightMode()?this.toggleDayNightMode():this.toggleDayNightMode()}),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue(),this.browserVersion.set(this.getBrowserVersion()),this.osVersion.set(this.getOSVersion()),console.log("*********** KIP Version Information ***********"),console.log(`** App Version: ${this.appVersion()}`),console.log(`** Browser Version: ${this.browserVersion()}`),console.log(`** OS Version: ${this.osVersion()}`),console.log("***********************************************")}sendSnackbarNotification(t,e=1e4,r=!1){this.snackbarAppNotifications.next({message:t,duration:e,silent:r})}getSnackbarAppNotifications(){return this.snackbarAppNotifications.asObservable()}readThemeCssRoleVariables(){let t=document.body,e=getComputedStyle(t),r={background:e.getPropertyValue("--mat-sys-background").trim(),cardColor:e.getPropertyValue("--kip-widget-card-background-color").trim(),blue:e.getPropertyValue("--kip-blue-color").trim(),blueDim:e.getPropertyValue("--kip-blue-dim-color").trim(),blueDimmer:e.getPropertyValue("--kip-blue-dimmer-color").trim(),green:e.getPropertyValue("--kip-green-color").trim(),greenDim:e.getPropertyValue("--kip-green-dim-color").trim(),greenDimmer:e.getPropertyValue("--kip-green-dimmer-color").trim(),grey:e.getPropertyValue("--kip-grey-color").trim(),greyDim:e.getPropertyValue("--kip-grey-dim-color").trim(),greyDimmer:e.getPropertyValue("--kip-grey-dimmer-color").trim(),orange:e.getPropertyValue("--kip-orange-color").trim(),orangeDim:e.getPropertyValue("--kip-orange-dim-color").trim(),orangeDimmer:e.getPropertyValue("--kip-orange-dimmer-color").trim(),pink:e.getPropertyValue("--kip-pink-color").trim(),pinkDim:e.getPropertyValue("--kip-pink-dim-color").trim(),pinkDimmer:e.getPropertyValue("--kip-pink-dimmer-color").trim(),purple:e.getPropertyValue("--kip-purple-color").trim(),purpleDim:e.getPropertyValue("--kip-purple-dim-color").trim(),purpleDimmer:e.getPropertyValue("--kip-purple-dimmer-color").trim(),contrast:e.getPropertyValue("--kip-contrast-color").trim(),contrastDim:e.getPropertyValue("--kip-contrast-dim-color").trim(),contrastDimmer:e.getPropertyValue("--kip-contrast-dimmer-color").trim(),yellow:e.getPropertyValue("--kip-yellow-color").trim(),yellowDim:e.getPropertyValue("--kip-yellow-dim-color").trim(),yellowDimmer:e.getPropertyValue("--kip-yellow-dimmer-color").trim(),port:e.getPropertyValue("--kip-port-color").trim(),starboard:e.getPropertyValue("--kip-starboard-color").trim(),zoneNominal:e.getPropertyValue("--kip-zone-nominal-color").trim(),zoneAlert:e.getPropertyValue("--kip-zone-alert-color").trim(),zoneWarn:e.getPropertyValue("--kip-zone-warn-color").trim(),zoneAlarm:e.getPropertyValue("--kip-zone-alarm-color").trim(),zoneEmergency:e.getPropertyValue("--kip-zone-emergency-color").trim()};this.cssThemeColorRoles$.next(r)}get cssThemeColors(){return this._cssThemeColorRoles}setBrightness(t,e=!1){let r=document.body;r.style.setProperty("--kip-nightModeBrightness",`${t}`);let h=e?" sepia(0.5) hue-rotate(-30deg)":"";r.style.setProperty("--kip-nightModeFilters",h)}toggleDayNightMode(){this.isNightMode()?this._redNightMode()?(document.body.classList.toggle("night-theme",!0),this.setBrightness(1,!1)):(this.setBrightness(this._settings.getNightModeBrightness(),!0),document.body.classList.remove("night-theme"),this._theme()==="light-theme"?document.body.classList.toggle("light-theme",this._theme()==="light-theme"):document.body.classList.remove("light-theme")):(document.body.classList.remove("night-theme"),this._theme()==="light-theme"&&document.body.classList.toggle("light-theme",this._theme()==="light-theme"),this.setBrightness(1,!1)),this.readThemeCssRoleVariables(),this._cssThemeColorRoles=this.cssThemeColorRoles$.getValue()}getBrowserVersion(){let t=navigator.userAgent,e="Unknown";return t.includes("Edg")?e=`Edge ${t.match(/Edg\/(\d+)/)?.[1]}`:t.includes("Chrome")&&!t.includes("Edg")&&!t.includes("Chromium")?e=`Chrome ${t.match(/Chrome\/(\d+)/)?.[1]}`:t.includes("Chromium")?e=`Chromium ${t.match(/Chromium\/(\d+)/)?.[1]}`:t.includes("Firefox")?e=`Firefox ${t.match(/Firefox\/(\d+)/)?.[1]}`:t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")?e=`Safari ${t.match(/Version\/(\d+)/)?.[1]}`:(t.includes("Opera")||t.includes("OPR"))&&(e=`Opera ${t.match(/(Opera|OPR)\/(\d+)/)?.[2]}`),e}getOSVersion(){let t=navigator.platform,e=navigator.userAgent;return t.startsWith("Mac")?"macOS":t.startsWith("Win")?"Windows":/Linux/.test(t)?e.includes("ARM")||e.includes("aarch64")||e.includes("Raspberry")||t.includes("armv7l")||t.includes("armv8l")?"Raspberry Pi":"Linux":"Unknown OS"}static \u0275fac=function(e){return new(e||o)};static \u0275prov=g({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();export{D as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-LTMJXHF3.js";import{g as l}from"./chunk-FCC7GNHD.js";import"./chunk-SGYCFQGT.js";import{a as g}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-LTMJXHF3.js";import{g as l}from"./chunk-FCC7GNHD.js";import"./chunk-SGYCFQGT.js";import{a as g}from"./chunk-2Y6OT6VQ.js";import"./chunk-RCSPPHLA.js";import{g as a,n as r}from"./chunk-AHFD2AA5.js";import{Hb as s,ua as t}from"./chunk-JIJMSRKJ.js";var v=(()=>{class o{dialog=t(l);auth=t(r);appService=t(g);appSettingsService=t(a);connectionConfig=null;ngOnInit(){this.connectionConfig=this.appSettingsService.getConnectionConfig(),this.openUserCredentialModal("Sign in failed: Incorrect user/password. Enter valide credentials or access the Confifuration/Settings menu, validate the server URL or/and disable the user Sign in option")}openUserCredentialModal(e){this.dialog.open(c,{disableClose:!0,data:{user:this.connectionConfig.loginName,password:this.connectionConfig.loginPassword,error:e}}).afterClosed().subscribe(i=>{i===void 0||!i||(this.connectionConfig.loginName=i.user,this.connectionConfig.loginPassword=i.password,this.appSettingsService.setConnectionConfig(this.connectionConfig),this.serverLogin())})}serverLogin(e){this.auth.login({usr:this.connectionConfig.loginName,pwd:this.connectionConfig.loginPassword,newUrl:e}).then(n=>{this.appSettingsService.reloadApp()}).catch(n=>{n.status==401?(this.openUserCredentialModal("Sign in failed: Invalide user/password. Enter valide credentials"),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==404?(this.appService.sendSnackbarNotification("Sign in failed: Login API not found at URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: "+n.error.message)):n.status==0?(this.appService.sendSnackbarNotification("Sign in failed: Cannot reach server at Signal K URL. See connection detail status in Configuration/Settings",5e3,!1),console.log("[Setting-SignalK Component] Sign in failed: Cannot reach server at Signal K URL:"+n.message)):(this.appService.sendSnackbarNotification("Unknown authentication failure: "+JSON.stringify(n),5e3,!1),console.log("[Setting-SignalK Component] Unknown login error response: "+JSON.stringify(n)))})}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=s({type:o,selectors:[["app-widget-login"]],decls:0,vars:0,template:function(n,i){},encapsulation:2})}return o})();export{v as WidgetLoginComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Us}from"./chunk-
|
|
1
|
+
import{a as Us}from"./chunk-2Y6OT6VQ.js";import{a as Li,g as Ys,n as Bs,o as qs}from"./chunk-AHFD2AA5.js";import{a as Ai,b as Ii,m as zs,oa as Hs,ua as Je}from"./chunk-JIJMSRKJ.js";var ir={200:"The request was successfully.",202:"Request accepted and pending completion.",400:"Something is wrong with the client's request.",401:"Login failed. Your User ID or Password is incorrect.",403:"DENIED: Authorization with R/W or Admin permission level is required to send commands. Configure Sign In credential.",405:"The server does not support the request.",500:"The request failed.",502:"Something went wrong carrying out the request on the server.",504:"Timeout on the server side trying to carry out the request."},qp=(()=>{class i{signalKDeltaService=Je(qs);appSettingsService=Je(Ys);appService=Je(Us);auth=Je(Bs);requestStatus$=new zs;requests=[];constructor(){let t=this.signalKDeltaService.subscribeRequestUpdates().subscribe(n=>{this.updateRequest(n)})}requestDeviceAccessToken(){let t=Li.create(),n={requestId:t,accessRequest:{clientId:this.appSettingsService.KipUUID,description:"KIP Instrument MDF",permissions:"admin"}};console.log("[Request Service] Requesting Device Authorization Token"),this.signalKDeltaService.publishDelta(n);let r={requestId:t,state:null,statusCode:null};return this.requests.push(r),t}requestUserLogin(t,n){let r=Li.create(),s={requestId:r,login:{username:t,password:n}};console.log("[Request Service] Requesting User Login"),this.signalKDeltaService.publishDelta(s);let o={requestId:r,state:null,statusCode:null};return this.requests.push(o),r}putRequest(t,n,r){let s=Li.create(),o=t.replace(/^(self\.)/,""),l={context:"vessels.self",requestId:s,put:{path:o,value:n}};this.signalKDeltaService.publishDelta(l);let c={requestId:s,state:null,statusCode:null,widgetUUID:r};return this.requests.push(c),s}updateRequest(t){let n=this.requests.findIndex(r=>r.requestId==t.requestId);if(n>-1){this.requests[n].state=t.state,this.requests[n].statusCode=t.statusCode,this.requests[n].message=t.message;let r=ir[t.statusCode];if(typeof r<"u"&&(this.requests[n].statusCode==200||this.requests[n].statusCode==202||this.requests[n].statusCode==400||this.requests[n].statusCode==401||this.requests[n].statusCode==403||this.requests[n].statusCode==405)){if(this.requests[n].statusCodeDescription=r,this.requests[n].statusCode==202){console.log("[Request Service] Async 202 response received");return}this.requests[n].statusCode==400&&(this.appService.sendSnackbarNotification(this.requests[n].message),console.log("[Request Service] "+this.requests[n].message)),this.requests[n].statusCode==403&&console.warn("[Request Service] Status Code: "+this.requests[n].statusCode+" - "+this.requests[n].statusCodeDescription),this.requests[n].statusCode==405&&console.error("[Request Service] Status Code: "+this.requests[n].statusCode+" - "+this.requests[n].message),t.accessRequest!==void 0&&t.accessRequest.token!==void 0?(this.appService.sendSnackbarNotification(t.accessRequest.permission+": Device Access Token received from server."),console.log(`[Request Service] ${t.accessRequest.permission}: Device Access Token received`),this.auth.setDeviceAccessToken(t.accessRequest.token)):t.login!==void 0&&t.login.token}else this.appService.sendSnackbarNotification("ERROR: Unknown Request Status Code received: "+this.requests[n].statusCode+" - "+ir[this.requests[n].statusCode]+" - "+this.requests[n].message),console.error("[Request Service] Unknown Request Status Code received: "+this.requests[n].statusCode+" - "+ir[this.requests[n].statusCode]+" - "+this.requests[n].message);try{this.requestStatus$.next(this.requests[n]),this.requests.splice(n,1)}catch(s){this.requestStatus$.error(s),console.error("[Request Service] "+s),this.requests=[]}}else this.appService.sendSnackbarNotification(`ERROR: A request message that contains an unknown Request ID was received. Request Delta:
|
|
2
2
|
`+JSON.stringify(t)),console.error(`[Request Service] A Request message that contains an unknown Request ID was received. from delta:
|
|
3
3
|
`+JSON.stringify(t))}subscribeRequest(){return this.requestStatus$.asObservable()}static \u0275fac=function(n){return new(n||i)};static \u0275prov=Hs({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function ii(i){return i+.5|0}var te=(i,e,t)=>Math.max(Math.min(i,t),e);function ti(i){return te(ii(i*2.55),0,255)}function ee(i){return te(ii(i*255),0,255)}function Bt(i){return te(ii(i/2.55)/100,0,1)}function Vs(i){return te(ii(i*100),0,100)}var Dt={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},rr=[..."0123456789ABCDEF"],oc=i=>rr[i&15],ac=i=>rr[(i&240)>>4]+rr[i&15],Ri=i=>(i&240)>>4===(i&15),lc=i=>Ri(i.r)&&Ri(i.g)&&Ri(i.b)&&Ri(i.a);function cc(i){var e=i.length,t;return i[0]==="#"&&(e===4||e===5?t={r:255&Dt[i[1]]*17,g:255&Dt[i[2]]*17,b:255&Dt[i[3]]*17,a:e===5?Dt[i[4]]*17:255}:(e===7||e===9)&&(t={r:Dt[i[1]]<<4|Dt[i[2]],g:Dt[i[3]]<<4|Dt[i[4]],b:Dt[i[5]]<<4|Dt[i[6]],a:e===9?Dt[i[7]]<<4|Dt[i[8]]:255})),t}var uc=(i,e)=>i<255?e(i):"";function fc(i){var e=lc(i)?oc:ac;return i?"#"+e(i.r)+e(i.g)+e(i.b)+uc(i.a,e):void 0}var dc=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Qs(i,e,t){let n=e*Math.min(t,1-t),r=(s,o=(s+i/30)%12)=>t-n*Math.max(Math.min(o-3,9-o,1),-1);return[r(0),r(8),r(4)]}function hc(i,e,t){let n=(r,s=(r+i/60)%6)=>t-t*e*Math.max(Math.min(s,4-s,1),0);return[n(5),n(3),n(1)]}function mc(i,e,t){let n=Qs(i,1,.5),r;for(e+t>1&&(r=1/(e+t),e*=r,t*=r),r=0;r<3;r++)n[r]*=1-e-t,n[r]+=e;return n}function pc(i,e,t,n,r){return i===r?(e-t)/n+(e<t?6:0):e===r?(t-i)/n+2:(i-e)/n+4}function sr(i){let t=i.r/255,n=i.g/255,r=i.b/255,s=Math.max(t,n,r),o=Math.min(t,n,r),a=(s+o)/2,l,c,u;return s!==o&&(u=s-o,c=a>.5?u/(2-s-o):u/(s+o),l=pc(t,n,r,u,s),l=l*60+.5),[l|0,c||0,a]}function or(i,e,t,n){return(Array.isArray(e)?i(e[0],e[1],e[2]):i(e,t,n)).map(ee)}function ar(i,e,t){return or(Qs,i,e,t)}function gc(i,e,t){return or(mc,i,e,t)}function bc(i,e,t){return or(hc,i,e,t)}function Gs(i){return(i%360+360)%360}function xc(i){let e=dc.exec(i),t=255,n;if(!e)return;e[5]!==n&&(t=e[6]?ti(+e[5]):ee(+e[5]));let r=Gs(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?n=gc(r,s,o):e[1]==="hsv"?n=bc(r,s,o):n=ar(r,s,o),{r:n[0],g:n[1],b:n[2],a:t}}function vc(i,e){var t=sr(i);t[0]=Gs(t[0]+e),t=ar(t),i.r=t[0],i.g=t[1],i.b=t[2]}function yc(i){if(!i)return;let e=sr(i),t=e[0],n=Vs(e[1]),r=Vs(e[2]);return i.a<255?`hsla(${t}, ${n}%, ${r}%, ${Bt(i.a)})`:`hsl(${t}, ${n}%, ${r}%)`}var js={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"},$s={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 _c(){let i={},e=Object.keys($s),t=Object.keys(js),n,r,s,o,a;for(n=0;n<e.length;n++){for(o=a=e[n],r=0;r<t.length;r++)s=t[r],a=a.replace(s,js[s]);s=parseInt($s[o],16),i[a]=[s>>16&255,s>>8&255,s&255]}return i}var Ei;function wc(i){Ei||(Ei=_c(),Ei.transparent=[0,0,0,0]);let e=Ei[i.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}var Mc=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function kc(i){let e=Mc.exec(i),t=255,n,r,s;if(e){if(e[7]!==n){let o=+e[7];t=e[8]?ti(o):te(o*255,0,255)}return n=+e[1],r=+e[3],s=+e[5],n=255&(e[2]?ti(n):te(n,0,255)),r=255&(e[4]?ti(r):te(r,0,255)),s=255&(e[6]?ti(s):te(s,0,255)),{r:n,g:r,b:s,a:t}}}function Dc(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${Bt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}var nr=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Se=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Tc(i,e,t){let n=Se(Bt(i.r)),r=Se(Bt(i.g)),s=Se(Bt(i.b));return{r:ee(nr(n+t*(Se(Bt(e.r))-n))),g:ee(nr(r+t*(Se(Bt(e.g))-r))),b:ee(nr(s+t*(Se(Bt(e.b))-s))),a:i.a+t*(e.a-i.a)}}function Fi(i,e,t){if(i){let n=sr(i);n[e]=Math.max(0,Math.min(n[e]+n[e]*t,e===0?360:1)),n=ar(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function Ks(i,e){return i&&Object.assign(e||{},i)}function Xs(i){var e={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(e={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(e.a=ee(i[3]))):(e=Ks(i,{r:0,g:0,b:0,a:1}),e.a=ee(e.a)),e}function Cc(i){return i.charAt(0)==="r"?kc(i):xc(i)}var ei=class i{constructor(e){if(e instanceof i)return e;let t=typeof e,n;t==="object"?n=Xs(e):t==="string"&&(n=cc(e)||wc(e)||Cc(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=Ks(this._rgb);return e&&(e.a=Bt(e.a)),e}set rgb(e){this._rgb=Xs(e)}rgbString(){return this._valid?Dc(this._rgb):void 0}hexString(){return this._valid?fc(this._rgb):void 0}hslString(){return this._valid?yc(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,r=e.rgb,s,o=t===s?.5:t,a=2*o-1,l=n.a-r.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;s=1-c,n.r=255&c*n.r+s*r.r+.5,n.g=255&c*n.g+s*r.g+.5,n.b=255&c*n.b+s*r.b+.5,n.a=o*n.a+(1-o)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=Tc(this._rgb,e._rgb,t)),this}clone(){return new i(this.rgb)}alpha(e){return this._rgb.a=ee(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb,t=ii(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Fi(this._rgb,2,e),this}darken(e){return Fi(this._rgb,2,-e),this}saturate(e){return Fi(this._rgb,1,e),this}desaturate(e){return Fi(this._rgb,1,-e),this}rotate(e){return vc(this._rgb,e),this}};function Ft(){}var lo=(()=>{let i=0;return()=>i++})();function q(i){return i==null}function J(i){if(Array.isArray&&Array.isArray(i))return!0;let e=Object.prototype.toString.call(i);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function U(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function rt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function bt(i,e){return rt(i)?i:e}function z(i,e){return typeof i>"u"?e:i}var co=(i,e)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/e,fr=(i,e)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*e:+i;function K(i,e,t){if(i&&typeof i.call=="function")return i.apply(t,e)}function X(i,e,t,n){let r,s,o;if(J(i))if(s=i.length,n)for(r=s-1;r>=0;r--)e.call(t,i[r],r);else for(r=0;r<s;r++)e.call(t,i[r],r);else if(U(i))for(o=Object.keys(i),s=o.length,r=0;r<s;r++)e.call(t,i[o[r]],o[r])}function si(i,e){let t,n,r,s;if(!i||!e||i.length!==e.length)return!1;for(t=0,n=i.length;t<n;++t)if(r=i[t],s=e[t],r.datasetIndex!==s.datasetIndex||r.index!==s.index)return!1;return!0}function Yi(i){if(J(i))return i.map(Yi);if(U(i)){let e=Object.create(null),t=Object.keys(i),n=t.length,r=0;for(;r<n;++r)e[t[r]]=Yi(i[t[r]]);return e}return i}function uo(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Pc(i,e,t,n){if(!uo(i))return;let r=e[i],s=t[i];U(r)&&U(s)?Ae(r,s,n):e[i]=Yi(s)}function Ae(i,e,t){let n=J(e)?e:[e],r=n.length;if(!U(i))return i;t=t||{};let s=t.merger||Pc,o;for(let a=0;a<r;++a){if(o=n[a],!U(o))continue;let l=Object.keys(o);for(let c=0,u=l.length;c<u;++c)s(l[c],i,o,t)}return i}function Le(i,e){return Ae(i,e,{merger:Sc})}function Sc(i,e,t){if(!uo(i))return;let n=e[i],r=t[i];U(n)&&U(r)?Le(n,r):Object.prototype.hasOwnProperty.call(e,i)||(e[i]=Yi(r))}var Zs={"":i=>i,x:i=>i.x,y:i=>i.y};function Oc(i){let e=i.split("."),t=[],n="";for(let r of e)n+=r,n.endsWith("\\")?n=n.slice(0,-1)+".":(t.push(n),n="");return t}function Ac(i){let e=Oc(i);return t=>{for(let n of e){if(n==="")break;t=t&&t[n]}return t}}function Vt(i,e){return(Zs[e]||(Zs[e]=Ac(e)))(i)}function Vi(i){return i.charAt(0).toUpperCase()+i.slice(1)}var Re=i=>typeof i<"u",qt=i=>typeof i=="function",dr=(i,e)=>{if(i.size!==e.size)return!1;for(let t of i)if(!e.has(t))return!1;return!0};function fo(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}var tt=Math.PI,et=2*tt,Ic=et+tt,Bi=Number.POSITIVE_INFINITY,Lc=tt/180,st=tt/2,he=tt/4,Js=tt*2/3,Ut=Math.log10,At=Math.sign;function Ee(i,e,t){return Math.abs(i-e)<t}function hr(i){let e=Math.round(i);i=Ee(i,e,i/1e3)?e:i;let t=Math.pow(10,Math.floor(Ut(i))),n=i/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function ho(i){let e=[],t=Math.sqrt(i),n;for(n=1;n<t;n++)i%n===0&&(e.push(n),e.push(i/n));return t===(t|0)&&e.push(t),e.sort((r,s)=>r-s).pop(),e}function Rc(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function ge(i){return!Rc(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function mo(i,e){let t=Math.round(i);return t-e<=i&&t+e>=i}function mr(i,e,t){let n,r,s;for(n=0,r=i.length;n<r;n++)s=i[n][t],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Tt(i){return i*(tt/180)}function ji(i){return i*(180/tt)}function pr(i){if(!rt(i))return;let e=1,t=0;for(;Math.round(i*e)/e!==i;)e*=10,t++;return t}function gr(i,e){let t=e.x-i.x,n=e.y-i.y,r=Math.sqrt(t*t+n*n),s=Math.atan2(n,t);return s<-.5*tt&&(s+=et),{angle:s,distance:r}}function qi(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function Ec(i,e){return(i-e+Ic)%et-tt}function gt(i){return(i%et+et)%et}function Fe(i,e,t,n){let r=gt(i),s=gt(e),o=gt(t),a=gt(s-r),l=gt(o-r),c=gt(r-s),u=gt(r-o);return r===s||r===o||n&&s===o||a>l&&c<u}function lt(i,e,t){return Math.max(e,Math.min(t,i))}function po(i){return lt(i,-32768,32767)}function Wt(i,e,t,n=1e-6){return i>=Math.min(e,t)-n&&i<=Math.max(e,t)+n}function $i(i,e,t){t=t||(o=>i[o]<e);let n=i.length-1,r=0,s;for(;n-r>1;)s=r+n>>1,t(s)?r=s:n=s;return{lo:r,hi:n}}var Rt=(i,e,t,n)=>$i(i,t,n?r=>{let s=i[r][e];return s<t||s===t&&i[r+1][e]===t}:r=>i[r][e]<t),go=(i,e,t)=>$i(i,t,n=>i[n][e]>=t);function bo(i,e,t){let n=0,r=i.length;for(;n<r&&i[n]<e;)n++;for(;r>n&&i[r-1]>t;)r--;return n>0||r<i.length?i.slice(n,r):i}var xo=["push","pop","shift","splice","unshift"];function vo(i,e){if(i._chartjs){i._chartjs.listeners.push(e);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),xo.forEach(t=>{let n="_onData"+Vi(t),r=i[t];Object.defineProperty(i,t,{configurable:!0,enumerable:!1,value(...s){let o=r.apply(this,s);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...s)}),o}})})}function br(i,e){let t=i._chartjs;if(!t)return;let n=t.listeners,r=n.indexOf(e);r!==-1&&n.splice(r,1),!(n.length>0)&&(xo.forEach(s=>{delete i[s]}),delete i._chartjs)}function xr(i){let e=new Set(i);return e.size===i.length?i:Array.from(e)}var vr=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function yr(i,e){let t=[],n=!1;return function(...r){t=r,n||(n=!0,vr.call(window,()=>{n=!1,i.apply(e,t)}))}}function yo(i,e){let t;return function(...n){return e?(clearTimeout(t),t=setTimeout(i,e,n)):i.apply(this,n),e}}var Xi=i=>i==="start"?"left":i==="end"?"right":"center",ft=(i,e,t)=>i==="start"?e:i==="end"?t:(e+t)/2,_o=(i,e,t,n)=>i===(n?"left":"right")?t:i==="center"?(e+t)/2:e;function _r(i,e,t){let n=e.length,r=0,s=n;if(i._sorted){let{iScale:o,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,u=o.axis,{min:f,max:d,minDefined:h,maxDefined:m}=o.getUserBounds();if(h){if(r=Math.min(Rt(l,u,f).lo,t?n:Rt(e,u,o.getPixelForValue(f)).lo),c){let p=l.slice(0,r+1).reverse().findIndex(g=>!q(g[a.axis]));r-=Math.max(0,p)}r=lt(r,0,n-1)}if(m){let p=Math.max(Rt(l,o.axis,d,!0).hi+1,t?0:Rt(e,u,o.getPixelForValue(d),!0).hi+1);if(c){let g=l.slice(p-1).findIndex(b=>!q(b[a.axis]));p+=Math.max(0,g)}s=lt(p,r,n)-r}else s=n-r}return{start:r,count:s}}function wr(i){let{xScale:e,yScale:t,_scaleRanges:n}=i,r={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!n)return i._scaleRanges=r,!0;let s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==t.min||n.ymax!==t.max;return Object.assign(n,r),s}var Wi=i=>i===0||i===1,to=(i,e,t)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-e)*et/t)),eo=(i,e,t)=>Math.pow(2,-10*i)*Math.sin((i-e)*et/t)+1,Oe={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*st)+1,easeOutSine:i=>Math.sin(i*st),easeInOutSine:i=>-.5*(Math.cos(tt*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Wi(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Wi(i)?i:to(i,.075,.3),easeOutElastic:i=>Wi(i)?i:eo(i,.075,.3),easeInOutElastic(i){return Wi(i)?i:i<.5?.5*to(i*2,.1125,.45):.5+.5*eo(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let e=1.70158;return(i/=.5)<1?.5*(i*i*(((e*=1.525)+1)*i-e)):.5*((i-=2)*i*(((e*=1.525)+1)*i+e)+2)},easeInBounce:i=>1-Oe.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?Oe.easeInBounce(i*2)*.5:Oe.easeOutBounce(i*2-1)*.5+.5};function Mr(i){if(i&&typeof i=="object"){let e=i.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function kr(i){return Mr(i)?i:new ei(i)}function lr(i){return Mr(i)?i:new ei(i).saturate(.5).darken(.1).hexString()}var Fc=["x","y","borderWidth","radius","tension"],Wc=["color","borderColor","backgroundColor"];function Nc(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),i.set("animations",{colors:{type:"color",properties:Wc},numbers:{type:"number",properties:Fc}}),i.describe("animations",{_fallback:"animation"}),i.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:e=>e|0}}}})}function zc(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var io=new Map;function Hc(i,e){e=e||{};let t=i+JSON.stringify(e),n=io.get(t);return n||(n=new Intl.NumberFormat(i,e),io.set(t,n)),n}function We(i,e,t){return Hc(e,t).format(i)}var wo={values(i){return J(i)?i:""+i},numeric(i,e,t){if(i===0)return"0";let n=this.chart.options.locale,r,s=i;if(t.length>1){let c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(r="scientific"),s=Yc(i,t)}let o=Ut(Math.abs(s)),a=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),We(i,n,l)},logarithmic(i,e,t){if(i===0)return"0";let n=t[e].significand||i/Math.pow(10,Math.floor(Ut(i)));return[1,2,3,5,10,15].includes(n)||e>.8*t.length?wo.numeric.call(this,i,e,t):""}};function Yc(i,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&i!==Math.floor(i)&&(t=i-Math.floor(i)),t}var oi={formatters:wo};function Bc(i){i.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:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.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:oi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}var ne=Object.create(null),Qi=Object.create(null);function ni(i,e){if(!e)return i;let t=e.split(".");for(let n=0,r=t.length;n<r;++n){let s=t[n];i=i[s]||(i[s]=Object.create(null))}return i}function cr(i,e,t){return typeof e=="string"?Ae(ni(i,e),t):Ae(ni(i,""),e)}var ur=class{constructor(e,t){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=n=>n.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=(n,r)=>lr(r.backgroundColor),this.hoverBorderColor=(n,r)=>lr(r.borderColor),this.hoverColor=(n,r)=>lr(r.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(e),this.apply(t)}set(e,t){return cr(this,e,t)}get(e){return ni(this,e)}describe(e,t){return cr(Qi,e,t)}override(e,t){return cr(ne,e,t)}route(e,t,n,r){let s=ni(this,e),o=ni(this,n),a="_"+t;Object.defineProperties(s,{[a]:{value:s[t],writable:!0},[t]:{enumerable:!0,get(){let l=this[a],c=o[r];return U(l)?Object.assign({},c,l):z(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(t=>t(this))}},it=new ur({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Nc,zc,Bc]);function qc(i){return!i||q(i.size)||q(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function ri(i,e,t,n,r){let s=e[r];return s||(s=e[r]=i.measureText(r).width,t.push(r)),s>n&&(n=s),n}function Mo(i,e,t,n){n=n||{};let r=n.data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(r=n.data={},s=n.garbageCollect=[],n.font=e),i.save(),i.font=e;let o=0,a=t.length,l,c,u,f,d;for(l=0;l<a;l++)if(f=t[l],f!=null&&!J(f))o=ri(i,r,s,o,f);else if(J(f))for(c=0,u=f.length;c<u;c++)d=f[c],d!=null&&!J(d)&&(o=ri(i,r,s,o,d));i.restore();let h=s.length/2;if(h>t.length){for(l=0;l<h;l++)delete r[s[l]];s.splice(0,h)}return o}function re(i,e,t){let n=i.currentDevicePixelRatio,r=t!==0?Math.max(t/2,.5):0;return Math.round((e-r)*n)/n+r}function Dr(i,e){!e&&!i||(e=e||i.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,i.width,i.height),e.restore())}function Gi(i,e,t,n){Tr(i,e,t,n,null)}function Tr(i,e,t,n,r){let s,o,a,l,c,u,f,d,h=e.pointStyle,m=e.rotation,p=e.radius,g=(m||0)*Lc;if(h&&typeof h=="object"&&(s=h.toString(),s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]")){i.save(),i.translate(t,n),i.rotate(g),i.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),i.restore();return}if(!(isNaN(p)||p<=0)){switch(i.beginPath(),h){default:r?i.ellipse(t,n,r/2,p,0,0,et):i.arc(t,n,p,0,et),i.closePath();break;case"triangle":u=r?r/2:p,i.moveTo(t+Math.sin(g)*u,n-Math.cos(g)*p),g+=Js,i.lineTo(t+Math.sin(g)*u,n-Math.cos(g)*p),g+=Js,i.lineTo(t+Math.sin(g)*u,n-Math.cos(g)*p),i.closePath();break;case"rectRounded":c=p*.516,l=p-c,o=Math.cos(g+he)*l,f=Math.cos(g+he)*(r?r/2-c:l),a=Math.sin(g+he)*l,d=Math.sin(g+he)*(r?r/2-c:l),i.arc(t-f,n-a,c,g-tt,g-st),i.arc(t+d,n-o,c,g-st,g),i.arc(t+f,n+a,c,g,g+st),i.arc(t-d,n+o,c,g+st,g+tt),i.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,u=r?r/2:l,i.rect(t-u,n-l,2*u,2*l);break}g+=he;case"rectRot":f=Math.cos(g)*(r?r/2:p),o=Math.cos(g)*p,a=Math.sin(g)*p,d=Math.sin(g)*(r?r/2:p),i.moveTo(t-f,n-a),i.lineTo(t+d,n-o),i.lineTo(t+f,n+a),i.lineTo(t-d,n+o),i.closePath();break;case"crossRot":g+=he;case"cross":f=Math.cos(g)*(r?r/2:p),o=Math.cos(g)*p,a=Math.sin(g)*p,d=Math.sin(g)*(r?r/2:p),i.moveTo(t-f,n-a),i.lineTo(t+f,n+a),i.moveTo(t+d,n-o),i.lineTo(t-d,n+o);break;case"star":f=Math.cos(g)*(r?r/2:p),o=Math.cos(g)*p,a=Math.sin(g)*p,d=Math.sin(g)*(r?r/2:p),i.moveTo(t-f,n-a),i.lineTo(t+f,n+a),i.moveTo(t+d,n-o),i.lineTo(t-d,n+o),g+=he,f=Math.cos(g)*(r?r/2:p),o=Math.cos(g)*p,a=Math.sin(g)*p,d=Math.sin(g)*(r?r/2:p),i.moveTo(t-f,n-a),i.lineTo(t+f,n+a),i.moveTo(t+d,n-o),i.lineTo(t-d,n+o);break;case"line":o=r?r/2:Math.cos(g)*p,a=Math.sin(g)*p,i.moveTo(t-o,n-a),i.lineTo(t+o,n+a);break;case"dash":i.moveTo(t,n),i.lineTo(t+Math.cos(g)*(r?r/2:p),n+Math.sin(g)*p);break;case!1:i.closePath();break}i.fill(),e.borderWidth>0&&i.stroke()}}function Et(i,e,t){return t=t||.5,!e||i&&i.x>e.left-t&&i.x<e.right+t&&i.y>e.top-t&&i.y<e.bottom+t}function ai(i,e){i.save(),i.beginPath(),i.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),i.clip()}function li(i){i.restore()}function ko(i,e,t,n,r){if(!e)return i.lineTo(t.x,t.y);if(r==="middle"){let s=(e.x+t.x)/2;i.lineTo(s,e.y),i.lineTo(s,t.y)}else r==="after"!=!!n?i.lineTo(e.x,t.y):i.lineTo(t.x,e.y);i.lineTo(t.x,t.y)}function Do(i,e,t,n){if(!e)return i.lineTo(t.x,t.y);i.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?t.cp2x:t.cp1x,n?t.cp2y:t.cp1y,t.x,t.y)}function Uc(i,e){e.translation&&i.translate(e.translation[0],e.translation[1]),q(e.rotation)||i.rotate(e.rotation),e.color&&(i.fillStyle=e.color),e.textAlign&&(i.textAlign=e.textAlign),e.textBaseline&&(i.textBaseline=e.textBaseline)}function Vc(i,e,t,n,r){if(r.strikethrough||r.underline){let s=i.measureText(n),o=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=t-s.actualBoundingBoxAscent,c=t+s.actualBoundingBoxDescent,u=r.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=r.decorationWidth||2,i.moveTo(o,u),i.lineTo(a,u),i.stroke()}}function jc(i,e){let t=i.fillStyle;i.fillStyle=e.color,i.fillRect(e.left,e.top,e.width,e.height),i.fillStyle=t}function se(i,e,t,n,r,s={}){let o=J(e)?e:[e],a=s.strokeWidth>0&&s.strokeColor!=="",l,c;for(i.save(),i.font=r.string,Uc(i,s),l=0;l<o.length;++l)c=o[l],s.backdrop&&jc(i,s.backdrop),a&&(s.strokeColor&&(i.strokeStyle=s.strokeColor),q(s.strokeWidth)||(i.lineWidth=s.strokeWidth),i.strokeText(c,t,n,s.maxWidth)),i.fillText(c,t,n,s.maxWidth),Vc(i,t,n,c,s),n+=Number(r.lineHeight);i.restore()}function Ne(i,e){let{x:t,y:n,w:r,h:s,radius:o}=e;i.arc(t+o.topLeft,n+o.topLeft,o.topLeft,1.5*tt,tt,!0),i.lineTo(t,n+s-o.bottomLeft),i.arc(t+o.bottomLeft,n+s-o.bottomLeft,o.bottomLeft,tt,st,!0),i.lineTo(t+r-o.bottomRight,n+s),i.arc(t+r-o.bottomRight,n+s-o.bottomRight,o.bottomRight,st,0,!0),i.lineTo(t+r,n+o.topRight),i.arc(t+r-o.topRight,n+o.topRight,o.topRight,0,-st,!0),i.lineTo(t+o.topLeft,n)}var $c=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Xc=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Qc(i,e){let t=(""+i).match($c);if(!t||t[1]==="normal")return e*1.2;switch(i=+t[2],t[3]){case"px":return i;case"%":i/=100;break}return e*i}var Gc=i=>+i||0;function Ki(i,e){let t={},n=U(e),r=n?Object.keys(e):e,s=U(i)?n?o=>z(i[o],i[e[o]]):o=>i[o]:()=>i;for(let o of r)t[o]=Gc(s(o));return t}function Cr(i){return Ki(i,{top:"y",right:"x",bottom:"y",left:"x"})}function oe(i){return Ki(i,["topLeft","topRight","bottomLeft","bottomRight"])}function dt(i){let e=Cr(i);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ot(i,e){i=i||{},e=e||it.font;let t=z(i.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let n=z(i.style,e.style);n&&!(""+n).match(Xc)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let r={family:z(i.family,e.family),lineHeight:Qc(z(i.lineHeight,e.lineHeight),t),size:t,style:n,weight:z(i.weight,e.weight),string:""};return r.string=qc(r),r}function ze(i,e,t,n){let r=!0,s,o,a;for(s=0,o=i.length;s<o;++s)if(a=i[s],a!==void 0&&(e!==void 0&&typeof a=="function"&&(a=a(e),r=!1),t!==void 0&&J(a)&&(a=a[t%a.length],r=!1),a!==void 0))return n&&!r&&(n.cacheable=!1),a}function To(i,e,t){let{min:n,max:r}=i,s=fr(e,(r-n)/2),o=(a,l)=>t&&a===0?0:a+l;return{min:o(n,-Math.abs(s)),max:o(r,s)}}function jt(i,e){return Object.assign(Object.create(i),e)}function Zi(i,e=[""],t,n,r=()=>i[0]){let s=t||i;typeof n>"u"&&(n=So("_fallback",i));let o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:s,_fallback:n,_getTarget:r,override:a=>Zi([a,...i],e,s,n)};return new Proxy(o,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Co(a,l,()=>ru(l,e,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return ro(a).includes(l)},ownKeys(a){return ro(a)},set(a,l,c){let u=a._storage||(a._storage=r());return a[l]=u[l]=c,delete a._keys,!0}})}function pe(i,e,t,n){let r={_cacheable:!1,_proxy:i,_context:e,_subProxy:t,_stack:new Set,_descriptors:Pr(i,n),setContext:s=>pe(i,s,t,n),override:s=>pe(i.override(s),e,t,n)};return new Proxy(r,{deleteProperty(s,o){return delete s[o],delete i[o],!0},get(s,o,a){return Co(s,o,()=>Zc(s,o,a))},getOwnPropertyDescriptor(s,o){return s._descriptors.allKeys?Reflect.has(i,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,o)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(s,o){return Reflect.has(i,o)},ownKeys(){return Reflect.ownKeys(i)},set(s,o,a){return i[o]=a,delete s[o],!0}})}function Pr(i,e={scriptable:!0,indexable:!0}){let{_scriptable:t=e.scriptable,_indexable:n=e.indexable,_allKeys:r=e.allKeys}=i;return{allKeys:r,scriptable:t,indexable:n,isScriptable:qt(t)?t:()=>t,isIndexable:qt(n)?n:()=>n}}var Kc=(i,e)=>i?i+Vi(e):e,Sr=(i,e)=>U(e)&&i!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Co(i,e,t){if(Object.prototype.hasOwnProperty.call(i,e)||e==="constructor")return i[e];let n=t();return i[e]=n,n}function Zc(i,e,t){let{_proxy:n,_context:r,_subProxy:s,_descriptors:o}=i,a=n[e];return qt(a)&&o.isScriptable(e)&&(a=Jc(e,a,i,t)),J(a)&&a.length&&(a=tu(e,a,i,o.isIndexable)),Sr(e,a)&&(a=pe(a,r,s&&s[e],o)),a}function Jc(i,e,t,n){let{_proxy:r,_context:s,_subProxy:o,_stack:a}=t;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=e(s,o||n);return a.delete(i),Sr(i,l)&&(l=Or(r._scopes,r,i,l)),l}function tu(i,e,t,n){let{_proxy:r,_context:s,_subProxy:o,_descriptors:a}=t;if(typeof s.index<"u"&&n(i))return e[s.index%e.length];if(U(e[0])){let l=e,c=r._scopes.filter(u=>u!==l);e=[];for(let u of l){let f=Or(c,r,i,u);e.push(pe(f,s,o&&o[i],a))}}return e}function Po(i,e,t){return qt(i)?i(e,t):i}var eu=(i,e)=>i===!0?e:typeof i=="string"?Vt(e,i):void 0;function iu(i,e,t,n,r){for(let s of e){let o=eu(t,s);if(o){i.add(o);let a=Po(o._fallback,t,r);if(typeof a<"u"&&a!==t&&a!==n)return a}else if(o===!1&&typeof n<"u"&&t!==n)return null}return!1}function Or(i,e,t,n){let r=e._rootScopes,s=Po(e._fallback,t,n),o=[...i,...r],a=new Set;a.add(n);let l=no(a,o,t,s||t,n);return l===null||typeof s<"u"&&s!==t&&(l=no(a,o,s,l,n),l===null)?!1:Zi(Array.from(a),[""],r,s,()=>nu(e,t,n))}function no(i,e,t,n,r){for(;t;)t=iu(i,e,t,n,r);return t}function nu(i,e,t){let n=i._getTarget();e in n||(n[e]={});let r=n[e];return J(r)&&U(t)?t:r||{}}function ru(i,e,t,n){let r;for(let s of e)if(r=So(Kc(s,i),t),typeof r<"u")return Sr(i,r)?Or(t,n,i,r):r}function So(i,e){for(let t of e){if(!t)continue;let n=t[i];if(typeof n<"u")return n}}function ro(i){let e=i._keys;return e||(e=i._keys=su(i._scopes)),e}function su(i){let e=new Set;for(let t of i)for(let n of Object.keys(t).filter(r=>!r.startsWith("_")))e.add(n);return Array.from(e)}function Ar(i,e,t,n){let{iScale:r}=i,{key:s="r"}=this._parsing,o=new Array(n),a,l,c,u;for(a=0,l=n;a<l;++a)c=a+t,u=e[c],o[a]={r:r.parse(Vt(u,s),c)};return o}var ou=Number.EPSILON||1e-14,Ie=(i,e)=>e<i.length&&!i[e].skip&&i[e],Oo=i=>i==="x"?"y":"x";function au(i,e,t,n){let r=i.skip?e:i,s=e,o=t.skip?e:t,a=qi(s,r),l=qi(o,s),c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;let f=n*c,d=n*u;return{previous:{x:s.x-f*(o.x-r.x),y:s.y-f*(o.y-r.y)},next:{x:s.x+d*(o.x-r.x),y:s.y+d*(o.y-r.y)}}}function lu(i,e,t){let n=i.length,r,s,o,a,l,c=Ie(i,0);for(let u=0;u<n-1;++u)if(l=c,c=Ie(i,u+1),!(!l||!c)){if(Ee(e[u],0,ou)){t[u]=t[u+1]=0;continue}r=t[u]/e[u],s=t[u+1]/e[u],a=Math.pow(r,2)+Math.pow(s,2),!(a<=9)&&(o=3/Math.sqrt(a),t[u]=r*o*e[u],t[u+1]=s*o*e[u])}}function cu(i,e,t="x"){let n=Oo(t),r=i.length,s,o,a,l=Ie(i,0);for(let c=0;c<r;++c){if(o=a,a=l,l=Ie(i,c+1),!a)continue;let u=a[t],f=a[n];o&&(s=(u-o[t])/3,a[`cp1${t}`]=u-s,a[`cp1${n}`]=f-s*e[c]),l&&(s=(l[t]-u)/3,a[`cp2${t}`]=u+s,a[`cp2${n}`]=f+s*e[c])}}function uu(i,e="x"){let t=Oo(e),n=i.length,r=Array(n).fill(0),s=Array(n),o,a,l,c=Ie(i,0);for(o=0;o<n;++o)if(a=l,l=c,c=Ie(i,o+1),!!l){if(c){let u=c[e]-l[e];r[o]=u!==0?(c[t]-l[t])/u:0}s[o]=a?c?At(r[o-1])!==At(r[o])?0:(r[o-1]+r[o])/2:r[o-1]:r[o]}lu(i,r,s),cu(i,s,e)}function Ni(i,e,t){return Math.max(Math.min(i,t),e)}function fu(i,e){let t,n,r,s,o,a=Et(i[0],e);for(t=0,n=i.length;t<n;++t)o=s,s=a,a=t<n-1&&Et(i[t+1],e),s&&(r=i[t],o&&(r.cp1x=Ni(r.cp1x,e.left,e.right),r.cp1y=Ni(r.cp1y,e.top,e.bottom)),a&&(r.cp2x=Ni(r.cp2x,e.left,e.right),r.cp2y=Ni(r.cp2y,e.top,e.bottom)))}function Ao(i,e,t,n,r){let s,o,a,l;if(e.spanGaps&&(i=i.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")uu(i,r);else{let c=n?i[i.length-1]:i[0];for(s=0,o=i.length;s<o;++s)a=i[s],l=au(c,a,i[Math.min(s+1,o-(n?0:1))%o],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}e.capBezierPoints&&fu(i,t)}function Ji(){return typeof window<"u"&&typeof document<"u"}function tn(i){let e=i.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Ui(i,e,t){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*e.parentNode[t])):n=i,n}var en=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function du(i,e){return en(i).getPropertyValue(e)}var hu=["top","right","bottom","left"];function me(i,e,t){let n={};t=t?"-"+t:"";for(let r=0;r<4;r++){let s=hu[r];n[s]=parseFloat(i[e+"-"+s+t])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}var mu=(i,e,t)=>(i>0||e>0)&&(!t||!t.shadowRoot);function pu(i,e){let t=i.touches,n=t&&t.length?t[0]:i,{offsetX:r,offsetY:s}=n,o=!1,a,l;if(mu(r,s,i.target))a=r,l=s;else{let c=e.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,o=!0}return{x:a,y:l,box:o}}function ae(i,e){if("native"in i)return i;let{canvas:t,currentDevicePixelRatio:n}=e,r=en(t),s=r.boxSizing==="border-box",o=me(r,"padding"),a=me(r,"border","width"),{x:l,y:c,box:u}=pu(i,t),f=o.left+(u&&a.left),d=o.top+(u&&a.top),{width:h,height:m}=e;return s&&(h-=o.width+a.width,m-=o.height+a.height),{x:Math.round((l-f)/h*t.width/n),y:Math.round((c-d)/m*t.height/n)}}function gu(i,e,t){let n,r;if(e===void 0||t===void 0){let s=i&&tn(i);if(!s)e=i.clientWidth,t=i.clientHeight;else{let o=s.getBoundingClientRect(),a=en(s),l=me(a,"border","width"),c=me(a,"padding");e=o.width-c.width-l.width,t=o.height-c.height-l.height,n=Ui(a.maxWidth,s,"clientWidth"),r=Ui(a.maxHeight,s,"clientHeight")}}return{width:e,height:t,maxWidth:n||Bi,maxHeight:r||Bi}}var zi=i=>Math.round(i*10)/10;function Io(i,e,t,n){let r=en(i),s=me(r,"margin"),o=Ui(r.maxWidth,i,"clientWidth")||Bi,a=Ui(r.maxHeight,i,"clientHeight")||Bi,l=gu(i,e,t),{width:c,height:u}=l;if(r.boxSizing==="content-box"){let d=me(r,"border","width"),h=me(r,"padding");c-=h.width+d.width,u-=h.height+d.height}return c=Math.max(0,c-s.width),u=Math.max(0,n?c/n:u-s.height),c=zi(Math.min(c,o,l.maxWidth)),u=zi(Math.min(u,a,l.maxHeight)),c&&!u&&(u=zi(c/2)),(e!==void 0||t!==void 0)&&n&&l.height&&u>l.height&&(u=l.height,c=zi(Math.floor(u*n))),{width:c,height:u}}function Ir(i,e,t){let n=e||1,r=Math.floor(i.height*n),s=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);let o=i.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${i.height}px`,o.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||o.height!==r||o.width!==s?(i.currentDevicePixelRatio=n,o.height=r,o.width=s,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}var Lo=function(){let i=!1;try{let e={get passive(){return i=!0,!1}};Ji()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return i}();function Lr(i,e){let t=du(i,e),n=t&&t.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function ie(i,e,t,n){return{x:i.x+t*(e.x-i.x),y:i.y+t*(e.y-i.y)}}function Ro(i,e,t,n){return{x:i.x+t*(e.x-i.x),y:n==="middle"?t<.5?i.y:e.y:n==="after"?t<1?i.y:e.y:t>0?e.y:i.y}}function Eo(i,e,t,n){let r={x:i.cp2x,y:i.cp2y},s={x:e.cp1x,y:e.cp1y},o=ie(i,r,t),a=ie(r,s,t),l=ie(s,e,t),c=ie(o,a,t),u=ie(a,l,t);return ie(c,u,t)}var bu=function(i,e){return{x(t){return i+i+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,n){return t-n},leftForLtr(t,n){return t-n}}},xu=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,e){return i+e},leftForLtr(i,e){return i}}};function be(i,e,t){return i?bu(e,t):xu()}function Rr(i,e){let t,n;(e==="ltr"||e==="rtl")&&(t=i.canvas.style,n=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),i.prevTextDirection=n)}function Er(i,e){e!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",e[0],e[1]))}function Fo(i){return i==="angle"?{between:Fe,compare:Ec,normalize:gt}:{between:Wt,compare:(e,t)=>e-t,normalize:e=>e}}function so({start:i,end:e,count:t,loop:n,style:r}){return{start:i%t,end:e%t,loop:n&&(e-i+1)%t===0,style:r}}function vu(i,e,t){let{property:n,start:r,end:s}=t,{between:o,normalize:a}=Fo(n),l=e.length,{start:c,end:u,loop:f}=i,d,h;if(f){for(c+=l,u+=l,d=0,h=l;d<h&&o(a(e[c%l][n]),r,s);++d)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:i.style}}function Fr(i,e,t){if(!t)return[i];let{property:n,start:r,end:s}=t,o=e.length,{compare:a,between:l,normalize:c}=Fo(n),{start:u,end:f,loop:d,style:h}=vu(i,e,t),m=[],p=!1,g=null,b,x,w,k=()=>l(r,w,b)&&a(r,w)!==0,v=()=>a(s,b)===0||l(s,w,b),_=()=>p||k(),P=()=>!p||v();for(let C=u,S=u;C<=f;++C)x=e[C%o],!x.skip&&(b=c(x[n]),b!==w&&(p=l(b,r,s),g===null&&_()&&(g=a(b,r)===0?C:S),g!==null&&P()&&(m.push(so({start:g,end:C,loop:d,count:o,style:h})),g=null),S=C,w=b));return g!==null&&m.push(so({start:g,end:f,loop:d,count:o,style:h})),m}function Wr(i,e){let t=[],n=i.segments;for(let r=0;r<n.length;r++){let s=Fr(n[r],i.points,e);s.length&&t.push(...s)}return t}function yu(i,e,t,n){let r=0,s=e-1;if(t&&!n)for(;r<e&&!i[r].skip;)r++;for(;r<e&&i[r].skip;)r++;for(r%=e,t&&(s+=r);s>r&&i[s%e].skip;)s--;return s%=e,{start:r,end:s}}function _u(i,e,t,n){let r=i.length,s=[],o=e,a=i[e],l;for(l=e+1;l<=t;++l){let c=i[l%r];c.skip||c.stop?a.skip||(n=!1,s.push({start:e%r,end:(l-1)%r,loop:n}),e=o=c.stop?l:null):(o=l,a.skip&&(e=l)),a=c}return o!==null&&s.push({start:e%r,end:o%r,loop:n}),s}function Wo(i,e){let t=i.points,n=i.options.spanGaps,r=t.length;if(!r)return[];let s=!!i._loop,{start:o,end:a}=yu(t,r,s,n);if(n===!0)return oo(i,[{start:o,end:a,loop:s}],t,e);let l=a<o?a+r:a,c=!!i._fullLoop&&o===0&&a===r-1;return oo(i,_u(t,o,l,c),t,e)}function oo(i,e,t,n){return!n||!n.setContext||!t?e:wu(i,e,t,n)}function wu(i,e,t,n){let r=i._chart.getContext(),s=ao(i.options),{_datasetIndex:o,options:{spanGaps:a}}=i,l=t.length,c=[],u=s,f=e[0].start,d=f;function h(m,p,g,b){let x=a?-1:1;if(m!==p){for(m+=l;t[m%l].skip;)m-=x;for(;t[p%l].skip;)p+=x;m%l!==p%l&&(c.push({start:m%l,end:p%l,loop:g,style:b}),u=b,f=p%l)}}for(let m of e){f=a?f:m.start;let p=t[f%l],g;for(d=f+1;d<=m.end;d++){let b=t[d%l];g=ao(n.setContext(jt(r,{type:"segment",p0:p,p1:b,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:o}))),Mu(g,u)&&h(f,d-1,m.loop,u),p=b,u=g}f<d-1&&h(f,d-1,m.loop,u)}return c}function ao(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function Mu(i,e){if(!e)return!1;let t=[],n=function(r,s){return Mr(s)?(t.includes(s)||t.push(s),t.indexOf(s)):s};return JSON.stringify(i,n)!==JSON.stringify(e,n)}function Hi(i,e,t){return i.options.clip?i[t]:e[t]}function ku(i,e){let{xScale:t,yScale:n}=i;return t&&n?{left:Hi(t,e,"left"),right:Hi(t,e,"right"),top:Hi(n,e,"top"),bottom:Hi(n,e,"bottom")}:e}function Nr(i,e){let t=e._clip;if(t.disabled)return!1;let n=ku(e,i.chartArea);return{left:t.left===!1?0:n.left-(t.left===!0?0:t.left),right:t.right===!1?i.width:n.right+(t.right===!0?0:t.right),top:t.top===!1?0:n.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?i.height:n.bottom+(t.bottom===!0?0:t.bottom)}}var Qr=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let s=t.listeners[r],o=t.duration;s.forEach(a=>a({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(n-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=vr.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,r)=>{if(!n.running||!n.items.length)return;let s=n.items,o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(e),a=!0):(s[o]=s[s.length-1],s.pop());a&&(r.draw(),this._notify(r,n,e,"progress")),s.length||(n.running=!1,this._notify(r,n,e,"complete"),n.initial=!1),t+=s.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((n,r)=>Math.max(n,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}},$t=new Qr,No="transparent",Du={boolean(i,e,t){return t>.5?e:i},color(i,e,t){let n=kr(i||No),r=n.valid&&kr(e||No);return r&&r.valid?r.mix(n,t).hexString():e},number(i,e,t){return i+(e-i)*t}},Gr=class{constructor(e,t,n,r){let s=t[n];r=ze([e.to,r,s,e.from]);let o=ze([e.from,s,r]);this._active=!0,this._fn=e.fn||Du[e.type||typeof o],this._easing=Oe[e.easing]||Oe.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let r=this._target[this._prop],s=n-this._start,o=this._duration-s;this._start=n,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=ze([e.to,t,r,e.from]),this._from=ze([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,r=this._prop,s=this._from,o=this._loop,a=this._to,l;if(this._active=s!==a&&(o||t<n),!this._active){this._target[r]=a,this._notify(!0);return}if(t<0){this._target[r]=s;return}l=t/n%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(s,a,l)}wait(){let e=this._promises||(this._promises=[]);return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?"res":"rej",n=this._promises||[];for(let r=0;r<n.length;r++)n[r][t]()}},fn=class{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!U(e))return;let t=Object.keys(it.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let s=e[r];if(!U(s))return;let o={};for(let a of t)o[a]=s[a];(J(s.properties)&&s.properties||[r]).forEach(a=>{(a===r||!n.has(a))&&n.set(a,o)})})}_animateOptions(e,t){let n=t.options,r=Cu(e,n);if(!r)return[];let s=this._createAnimations(r,n);return n.$shared&&Tu(e.options.$animations,n).then(()=>{e.options=n},()=>{}),s}_createAnimations(e,t){let n=this._properties,r=[],s=e.$animations||(e.$animations={}),o=Object.keys(t),a=Date.now(),l;for(l=o.length-1;l>=0;--l){let c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){r.push(...this._animateOptions(e,t));continue}let u=t[c],f=s[c],d=n.get(c);if(f)if(d&&f.active()){f.update(d,u,a);continue}else f.cancel();if(!d||!d.duration){e[c]=u;continue}s[c]=f=new Gr(d,e,c,u),r.push(f)}return r}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return $t.add(this._chart,n),!0}};function Tu(i,e){let t=[],n=Object.keys(e);for(let r=0;r<n.length;r++){let s=i[n[r]];s&&s.active()&&t.push(s.wait())}return Promise.all(t)}function Cu(i,e){if(!e)return;let t=i.options;if(!t){i.options=e;return}return t.$shared&&(i.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function zo(i,e){let t=i&&i.options||{},n=t.reverse,r=t.min===void 0?e:0,s=t.max===void 0?e:0;return{start:n?s:r,end:n?r:s}}function Pu(i,e,t){if(t===!1)return!1;let n=zo(i,t),r=zo(e,t);return{top:r.end,right:n.end,bottom:r.start,left:n.start}}function Su(i){let e,t,n,r;return U(i)?(e=i.top,t=i.right,n=i.bottom,r=i.left):e=t=n=r=i,{top:e,right:t,bottom:n,left:r,disabled:i===!1}}function Na(i,e){let t=[],n=i._getSortedDatasetMetas(e),r,s;for(r=0,s=n.length;r<s;++r)t.push(n[r].index);return t}function Ho(i,e,t,n={}){let r=i.keys,s=n.mode==="single",o,a,l,c;if(e===null)return;let u=!1;for(o=0,a=r.length;o<a;++o){if(l=+r[o],l===t){if(u=!0,n.all)continue;break}c=i.values[l],rt(c)&&(s||e===0||At(e)===At(c))&&(e+=c)}return!u&&!n.all?0:e}function Ou(i,e){let{iScale:t,vScale:n}=e,r=t.axis==="x"?"x":"y",s=n.axis==="x"?"x":"y",o=Object.keys(i),a=new Array(o.length),l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[r]:u,[s]:i[u]};return a}function zr(i,e){let t=i&&i.options.stacked;return t||t===void 0&&e.stack!==void 0}function Au(i,e,t){return`${i.id}.${e.id}.${t.stack||t.type}`}function Iu(i){let{min:e,max:t,minDefined:n,maxDefined:r}=i.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:r?t:Number.POSITIVE_INFINITY}}function Lu(i,e,t){let n=i[e]||(i[e]={});return n[t]||(n[t]={})}function Yo(i,e,t,n){for(let r of e.getMatchingVisibleMetas(n).reverse()){let s=i[r.index];if(t&&s>0||!t&&s<0)return r.index}return null}function Bo(i,e){let{chart:t,_cachedMeta:n}=i,r=t._stacks||(t._stacks={}),{iScale:s,vScale:o,index:a}=n,l=s.axis,c=o.axis,u=Au(s,o,n),f=e.length,d;for(let h=0;h<f;++h){let m=e[h],{[l]:p,[c]:g}=m,b=m._stacks||(m._stacks={});d=b[c]=Lu(r,u,p),d[a]=g,d._top=Yo(d,o,!0,n.type),d._bottom=Yo(d,o,!1,n.type);let x=d._visualValues||(d._visualValues={});x[a]=g}}function Hr(i,e){let t=i.scales;return Object.keys(t).filter(n=>t[n].axis===e).shift()}function Ru(i,e){return jt(i,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Eu(i,e,t){return jt(i,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function ci(i,e){let t=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){e=e||i._parsed;for(let r of e){let s=r._stacks;if(!s||s[n]===void 0||s[n][t]===void 0)return;delete s[n][t],s[n]._visualValues!==void 0&&s[n]._visualValues[t]!==void 0&&delete s[n]._visualValues[t]}}}var Yr=i=>i==="reset"||i==="none",qo=(i,e)=>e?i:Object.assign({},i),Fu=(i,e,t)=>i&&!e.hidden&&e._stacked&&{keys:Na(t,!0),values:null},ce=(()=>{class i{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,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(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=zr(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&&ci(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(d,h,m,p)=>d==="x"?h:d==="r"?p:m,o=n.xAxisID=z(r.xAxisID,Hr(t,"x")),a=n.yAxisID=z(r.yAxisID,Hr(t,"y")),l=n.rAxisID=z(r.rAxisID,Hr(t,"r")),c=n.indexAxis,u=n.iAxisID=s(c,o,a,l),f=n.vAxisID=s(c,a,o,l);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(l),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(f)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&br(this._data,this),t._stacked&&ci(t)}_dataCheck(){let t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(U(n)){let s=this._cachedMeta;this._data=Ou(n,s)}else if(r!==n){if(r){br(r,this);let s=this._cachedMeta;ci(s),s._parsed=[]}n&&Object.isExtensible(n)&&vo(n,this),this._syncList=[],this._data=n}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let n=this._cachedMeta,r=this.getDataset(),s=!1;this._dataCheck();let o=n._stacked;n._stacked=zr(n.vScale,n),n.stack!==r.stack&&(s=!0,ci(n),n.stack=r.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Bo(this,n._parsed),n._stacked=zr(n.vScale,n))}configure(){let t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){let{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:a}=r,l=o.axis,c=t===0&&n===s.length?!0:r._sorted,u=t>0&&r._parsed[t-1],f,d,h;if(this._parsing===!1)r._parsed=s,r._sorted=!0,h=s;else{J(s[t])?h=this.parseArrayData(r,s,t,n):U(s[t])?h=this.parseObjectData(r,s,t,n):h=this.parsePrimitiveData(r,s,t,n);let m=()=>d[l]===null||u&&d[l]<u[l];for(f=0;f<n;++f)r._parsed[f+t]=d=h[f],c&&(m()&&(c=!1),u=d);r._sorted=c}a&&Bo(this,h)}parsePrimitiveData(t,n,r,s){let{iScale:o,vScale:a}=t,l=o.axis,c=a.axis,u=o.getLabels(),f=o===a,d=new Array(s),h,m,p;for(h=0,m=s;h<m;++h)p=h+r,d[h]={[l]:f||o.parse(u[p],p),[c]:a.parse(n[p],p)};return d}parseArrayData(t,n,r,s){let{xScale:o,yScale:a}=t,l=new Array(s),c,u,f,d;for(c=0,u=s;c<u;++c)f=c+r,d=n[f],l[c]={x:o.parse(d[0],f),y:a.parse(d[1],f)};return l}parseObjectData(t,n,r,s){let{xScale:o,yScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,u=new Array(s),f,d,h,m;for(f=0,d=s;f<d;++f)h=f+r,m=n[h],u[f]={x:o.parse(Vt(m,l),h),y:a.parse(Vt(m,c),h)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){let s=this.chart,o=this._cachedMeta,a=n[t.axis],l={keys:Na(s,!0),values:n._stacks[t.axis]._visualValues};return Ho(l,a,o.index,{mode:r})}updateRangeFromParsed(t,n,r,s){let o=r[n.axis],a=o===null?NaN:o,l=s&&r._stacks[n.axis];s&&l&&(s.values=l,a=Ho(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){let r=this._cachedMeta,s=r._parsed,o=r._sorted&&t===r.iScale,a=s.length,l=this._getOtherScale(t),c=Fu(n,r,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:f,max:d}=Iu(l),h,m;function p(){m=s[h];let g=m[l.axis];return!rt(m[t.axis])||f>g||d<g}for(h=0;h<a&&!(!p()&&(this.updateRangeFromParsed(u,t,m,c),o));++h);if(o){for(h=a-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(u,t,m,c);break}}return u}getAllParsedValues(t){let n=this._cachedMeta._parsed,r=[],s,o,a;for(s=0,o=n.length;s<o;++s)a=n[s][t.axis],rt(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(t){let n=this._cachedMeta,r=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let n=this._cachedMeta;this.update(t||"default"),n._clip=Su(z(this.options.clip,Pu(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,n=this.chart,r=this._cachedMeta,s=r.data||[],o=n.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||s.length-l,u=this.options.drawActiveElementsOnTop,f;for(r.dataset&&r.dataset.draw(t,o,l,c),f=l;f<l+c;++f){let d=s[f];d.hidden||(d.active&&u?a.push(d):d.draw(t,o))}for(f=0;f<a.length;++f)a[f].draw(t,o)}getStyle(t,n){let r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=Eu(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Ru(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){let s=n==="active",o=this._cachedDataOpts,a=t+"-"+n,l=o[a],c=this.enableOptionSharing&&Re(r);if(l)return qo(l,c);let u=this.chart.config,f=u.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],h=u.getOptionScopes(this.getDataset(),f),m=Object.keys(it.elements[t]),p=()=>this.getContext(r,s,n),g=u.resolveNamedOptions(h,m,p,d);return g.$shared&&(g.$shared=c,o[a]=Object.freeze(qo(g,c))),g}_resolveAnimations(t,n,r){let s=this.chart,o=this._cachedDataOpts,a=`animation-${n}`,l=o[a];if(l)return l;let c;if(s.options.animation!==!1){let f=this.chart.config,d=f.datasetAnimationScopeKeys(this._type,n),h=f.getOptionScopes(this.getDataset(),d);c=f.createResolver(h,this.getContext(t,r,n))}let u=new fn(s,c&&c.animations);return c&&c._cacheable&&(o[a]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Yr(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){let r=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(r),a=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:a}}updateElement(t,n,r,s){Yr(s)?Object.assign(t,r):this._resolveAnimations(n,s).update(t,r)}updateSharedOptions(t,n,r){t&&!Yr(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,s){t.active=s;let o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let n=this._data,r=this._cachedMeta.data;for(let[l,c,u]of this._syncList)this[l](c,u);this._syncList=[];let s=r.length,o=n.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,r=!0){let s=this._cachedMeta,o=s.data,a=t+n,l,c=u=>{for(u.length+=n,l=u.length-1;l>=a;l--)u[l]=u[l-n]};for(c(o),l=t;l<a;++l)o[l]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,n),r&&this.updateElements(o,t,n,"reset")}updateElements(t,n,r,s){}_removeElements(t,n){let r=this._cachedMeta;if(this._parsing){let s=r._parsed.splice(t,n);r._stacked&&ci(r,s)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[n,r,s]=t;this[n](r,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let 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,n){n&&this._sync(["_removeElements",t,n]);let r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}return i})();function Wu(i,e){if(!i._cache.$bar){let t=i.getMatchingVisibleMetas(e),n=[];for(let r=0,s=t.length;r<s;r++)n=n.concat(t[r].controller.getAllParsedValues(i));i._cache.$bar=xr(n.sort((r,s)=>r-s))}return i._cache.$bar}function Nu(i){let e=i.iScale,t=Wu(e,i.type),n=e._length,r,s,o,a,l=()=>{o===32767||o===-32768||(Re(a)&&(n=Math.min(n,Math.abs(o-a)||n)),a=o)};for(r=0,s=t.length;r<s;++r)o=e.getPixelForValue(t[r]),l();for(a=void 0,r=0,s=e.ticks.length;r<s;++r)o=e.getPixelForTick(r),l();return n}function zu(i,e,t,n){let r=t.barThickness,s,o;return q(r)?(s=e.min*t.categoryPercentage,o=t.barPercentage):(s=r*n,o=1),{chunk:s/n,ratio:o,start:e.pixels[i]-s/2}}function Hu(i,e,t,n){let r=e.pixels,s=r[i],o=i>0?r[i-1]:null,a=i<r.length-1?r[i+1]:null,l=t.categoryPercentage;o===null&&(o=s-(a===null?e.end-e.start:a-s)),a===null&&(a=s+s-o);let c=s-(s-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/n,ratio:t.barPercentage,start:c}}function Yu(i,e,t,n){let r=t.parse(i[0],n),s=t.parse(i[1],n),o=Math.min(r,s),a=Math.max(r,s),l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),e[t.axis]=c,e._custom={barStart:l,barEnd:c,start:r,end:s,min:o,max:a}}function za(i,e,t,n){return J(i)?Yu(i,e,t,n):e[t.axis]=t.parse(i,n),e}function Uo(i,e,t,n){let r=i.iScale,s=i.vScale,o=r.getLabels(),a=r===s,l=[],c,u,f,d;for(c=t,u=t+n;c<u;++c)d=e[c],f={},f[r.axis]=a||r.parse(o[c],c),l.push(za(d,f,s,c));return l}function Br(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function Bu(i,e,t){return i!==0?At(i):(e.isHorizontal()?1:-1)*(e.min>=t?1:-1)}function qu(i){let e,t,n,r,s;return i.horizontal?(e=i.base>i.x,t="left",n="right"):(e=i.base<i.y,t="bottom",n="top"),e?(r="end",s="start"):(r="start",s="end"),{start:t,end:n,reverse:e,top:r,bottom:s}}function Uu(i,e,t,n){let r=e.borderSkipped,s={};if(!r){i.borderSkipped=s;return}if(r===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:o,end:a,reverse:l,top:c,bottom:u}=qu(i);r==="middle"&&t&&(i.enableBorderRadius=!0,(t._top||0)===n?r=c:(t._bottom||0)===n?r=u:(s[Vo(u,o,a,l)]=!0,r=c)),s[Vo(r,o,a,l)]=!0,i.borderSkipped=s}function Vo(i,e,t,n){return n?(i=Vu(i,e,t),i=jo(i,t,e)):i=jo(i,e,t),i}function Vu(i,e,t){return i===e?t:i===t?e:i}function jo(i,e,t){return i==="start"?e:i==="end"?t:i}function ju(i,{inflateAmount:e},t){i.inflateAmount=e==="auto"?t===1?.33:0:e}var $u=(()=>{class i extends ce{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,r,s){return Uo(t,n,r,s)}parseArrayData(t,n,r,s){return Uo(t,n,r,s)}parseObjectData(t,n,r,s){let{iScale:o,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,u=o.axis==="x"?l:c,f=a.axis==="x"?l:c,d=[],h,m,p,g;for(h=r,m=r+s;h<m;++h)g=n[h],p={},p[o.axis]=o.parse(Vt(g,u),h),d.push(za(Vt(g,f),p,a,h));return d}updateRangeFromParsed(t,n,r,s){super.updateRangeFromParsed(t,n,r,s);let o=r._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let n=this._cachedMeta,{iScale:r,vScale:s}=n,o=this.getParsed(t),a=o._custom,l=Br(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,s){let o=s==="reset",{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),u=l.isHorizontal(),f=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,s);for(let m=n;m<n+r;m++){let p=this.getParsed(m),g=o||q(p[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(m),b=this._calculateBarIndexPixels(m,f),x=(p._stacks||{})[l.axis],w={horizontal:u,base:g.base,enableBorderRadius:!x||Br(p._custom)||a===x._top||a===x._bottom,x:u?g.head:b.center,y:u?b.center:g.head,height:u?b.size:Math.abs(g.size),width:u?Math.abs(g.size):b.size};h&&(w.options=d||this.resolveDataElementOptions(m,t[m].active?"active":s));let k=w.options||t[m].options;Uu(w,k,x,a),ju(w,k,f.ratio),this.updateElement(t[m],m,w,s)}}_getStacks(t,n){let{iScale:r}=this._cachedMeta,s=r.getMatchingVisibleMetas(this._type).filter(f=>f.controller.options.grouped),o=r.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(n),c=l&&l[r.axis],u=f=>{let d=f._parsed.find(m=>m[r.axis]===c),h=d&&d[f.vScale.axis];if(q(h)||isNaN(h))return!0};for(let f of s)if(!(n!==void 0&&u(f))&&((o===!1||a.indexOf(f.stack)===-1||o===void 0&&f.stack===void 0)&&a.push(f.stack),f.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,n,r){let s=this._getStacks(t,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,n=this._cachedMeta,r=n.iScale,s=[],o,a;for(o=0,a=n.data.length;o<a;++o)s.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));let l=t.barThickness;return{min:l||Nu(n),pixels:s,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:n,_stacked:r,index:s},options:{base:o,minBarLength:a}}=this,l=o||0,c=this.getParsed(t),u=c._custom,f=Br(u),d=c[n.axis],h=0,m=r?this.applyStack(n,c,r):d,p,g;m!==d&&(h=m-d,m=d),f&&(d=u.barStart,m=u.barEnd-u.barStart,d!==0&&At(d)!==At(u.barEnd)&&(h=0),h+=d);let b=!q(o)&&!f?o:h,x=n.getPixelForValue(b);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(h+m):p=x,g=p-x,Math.abs(g)<a){g=Bu(g,n,l)*a,d===l&&(x-=g/2);let w=n.getPixelForDecimal(0),k=n.getPixelForDecimal(1),v=Math.min(w,k),_=Math.max(w,k);x=Math.max(Math.min(x,_),v),p=x+g,r&&!f&&(c._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(x))}if(x===n.getPixelForValue(l)){let w=At(g)*n.getLineWidthForValue(l)/2;x+=w,g-=w}return{size:g,base:x,head:p,center:p+g/2}}_calculateBarIndexPixels(t,n){let r=n.scale,s=this.options,o=s.skipNull,a=z(s.maxBarThickness,1/0),l,c;if(n.grouped){let u=o?this._getStackCount(t):n.stackCount,f=s.barThickness==="flex"?Hu(t,n,s,u):zu(t,n,s,u),d=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);l=f.start+f.chunk*d+f.chunk/2,c=Math.min(a,f.chunk*f.ratio)}else l=r.getPixelForValue(this.getParsed(t)[r.axis],t),c=Math.min(a,n.min*n.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){let t=this._cachedMeta,n=t.vScale,r=t.data,s=r.length,o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}return i})(),Xu=(()=>{class i extends ce{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,r,s){let o=super.parsePrimitiveData(t,n,r,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+r).radius;return o}parseArrayData(t,n,r,s){let o=super.parseArrayData(t,n,r,s);for(let a=0;a<o.length;a++){let l=n[r+a];o[a]._custom=z(l[2],this.resolveDataElementOptions(a+r).radius)}return o}parseObjectData(t,n,r,s){let o=super.parseObjectData(t,n,r,s);for(let a=0;a<o.length;a++){let l=n[r+a];o[a]._custom=z(l&&l.r&&+l.r,this.resolveDataElementOptions(a+r).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,n=0;for(let r=t.length-1;r>=0;--r)n=Math.max(n,t[r].size(this.resolveDataElementOptions(r))/2);return n>0&&n}getLabelAndValue(t){let n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),l=s.getLabelForValue(a.x),c=o.getLabelForValue(a.y),u=a._custom;return{label:r[t]||"",value:"("+l+", "+c+(u?", "+u:"")+")"}}update(t){let n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,r,s){let o=s==="reset",{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:u}=this._getSharedOptions(n,s),f=a.axis,d=l.axis;for(let h=n;h<n+r;h++){let m=t[h],p=!o&&this.getParsed(h),g={},b=g[f]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[f]),x=g[d]=o?l.getBasePixel():l.getPixelForValue(p[d]);g.skip=isNaN(b)||isNaN(x),u&&(g.options=c||this.resolveDataElementOptions(h,m.active?"active":s),o&&(g.options.radius=0)),this.updateElement(m,h,g,s)}}resolveDataElementOptions(t,n){let r=this.getParsed(t),s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=z(r&&r._custom,o),s}}return i})();function Qu(i,e,t){let n=1,r=1,s=0,o=0;if(e<et){let a=i,l=a+e,c=Math.cos(a),u=Math.sin(a),f=Math.cos(l),d=Math.sin(l),h=(w,k,v)=>Fe(w,a,l,!0)?1:Math.max(k,k*t,v,v*t),m=(w,k,v)=>Fe(w,a,l,!0)?-1:Math.min(k,k*t,v,v*t),p=h(0,c,f),g=h(st,u,d),b=m(tt,c,f),x=m(tt+st,u,d);n=(p-b)/2,r=(g-x)/2,s=-(p+b)/2,o=-(g+x)/2}return{ratioX:n,ratioY:r,offsetX:s,offsetY:o}}var gs=(()=>{class i extends ce{static id="doughnut";static 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"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let n=t.data;if(n.labels.length&&n.datasets.length){let{labels:{pointStyle:r,color:s}}=t.legend.options;return n.labels.map((o,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){let r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=c=>+r[c];if(U(r[t])){let{key:c="value"}=this._parsing;o=u=>+Vt(r[u],c)}let a,l;for(a=t,l=t+n;a<l;++a)s._parsed[a]=o(a)}}_getRotation(){return Tt(this.options.rotation-90)}_getCircumference(){return Tt(this.options.circumference)}_getRotationExtents(){let t=et,n=-et;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){let s=this.chart.getDatasetMeta(r).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+a)}return{rotation:t,circumference:n-t}}update(t){let n=this.chart,{chartArea:r}=n,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,l=Math.max((Math.min(r.width,r.height)-a)/2,0),c=Math.min(co(this.options.cutout,l),1),u=this._getRingWeight(this.index),{circumference:f,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:m,offsetX:p,offsetY:g}=Qu(d,f,c),b=(r.width-a)/h,x=(r.height-a)/m,w=Math.max(Math.min(b,x)/2,0),k=fr(this.options.radius,w),v=Math.max(k*c,0),_=(k-v)/this._getVisibleDatasetWeightTotal();this.offsetX=p*k,this.offsetY=g*k,s.total=this.calculateTotal(),this.outerRadius=k-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*u,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){let r=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/et)}updateElements(t,n,r,s){let o=s==="reset",a=this.chart,l=a.chartArea,u=a.options.animation,f=(l.left+l.right)/2,d=(l.top+l.bottom)/2,h=o&&u.animateScale,m=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:b}=this._getSharedOptions(n,s),x=this._getRotation(),w;for(w=0;w<n;++w)x+=this._circumference(w,o);for(w=n;w<n+r;++w){let k=this._circumference(w,o),v=t[w],_={x:f+this.offsetX,y:d+this.offsetY,startAngle:x,endAngle:x+k,circumference:k,outerRadius:p,innerRadius:m};b&&(_.options=g||this.resolveDataElementOptions(w,v.active?"active":s)),x+=k,this.updateElement(v,w,_,s)}}calculateTotal(){let t=this._cachedMeta,n=t.data,r=0,s;for(s=0;s<n.length;s++){let o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(t){let n=this._cachedMeta.total;return n>0&&!isNaN(t)?et*(Math.abs(t)/n):0}getLabelAndValue(t){let n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=We(n._parsed[t],r.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0,r=this.chart,s,o,a,l,c;if(!t){for(s=0,o=r.data.datasets.length;s<o;++s)if(r.isDatasetVisible(s)){a=r.getDatasetMeta(s),t=a.data,l=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)c=l.resolveDataElementOptions(s),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,s=t.length;r<s;++r){let o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(z(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}return i})(),Gu=(()=>{class i extends ce{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let n=this._cachedMeta,{dataset:r,data:s=[],_dataset:o}=n,a=this.chart._animationsDisabled,{start:l,count:c}=_r(n,s,a);this._drawStart=l,this._drawCount=c,wr(n)&&(l=0,c=s.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=s;let u=this.resolveDatasetElementOptions(t);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(r,void 0,{animated:!a,options:u},t),this.updateElements(s,l,c,t)}updateElements(t,n,r,s){let o=s==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:u}=this._cachedMeta,{sharedOptions:f,includeOptions:d}=this._getSharedOptions(n,s),h=a.axis,m=l.axis,{spanGaps:p,segment:g}=this.options,b=ge(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",w=n+r,k=t.length,v=n>0&&this.getParsed(n-1);for(let _=0;_<k;++_){let P=t[_],C=x?P:{};if(_<n||_>=w){C.skip=!0;continue}let S=this.getParsed(_),E=q(S[m]),W=C[h]=a.getPixelForValue(S[h],_),H=C[m]=o||E?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,S,c):S[m],_);C.skip=isNaN(W)||isNaN(H)||E,C.stop=_>0&&Math.abs(S[h]-v[h])>b,g&&(C.parsed=S,C.raw=u.data[_]),d&&(C.options=f||this.resolveDataElementOptions(_,P.active?"active":s)),x||this.updateElement(P,_,C,s),v=S}}getMaxOverflow(){let t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return r;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(r,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}return i})(),Ha=(()=>{class i extends ce{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let n=t.data;if(n.labels.length&&n.datasets.length){let{labels:{pointStyle:r,color:s}}=t.legend.options;return n.labels.map((o,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:s,lineWidth:c.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=We(n._parsed[t].r,r.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,r,s){return Ar.bind(this)(t,n,r,s)}update(t){let n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){let t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((r,s)=>{let o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){let t=this.chart,n=t.chartArea,r=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),a=Math.max(r.cutoutPercentage?o/100*r.cutoutPercentage:1,0),l=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,n,r,s){let o=s==="reset",a=this.chart,c=a.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,d=u.yCenter,h=u.getIndexAngle(0)-.5*tt,m=h,p,g=360/this.countVisibleElements();for(p=0;p<n;++p)m+=this._computeAngle(p,s,g);for(p=n;p<n+r;p++){let b=t[p],x=m,w=m+this._computeAngle(p,s,g),k=a.getDataVisibility(p)?u.getDistanceFromCenterForValue(this.getParsed(p).r):0;m=w,o&&(c.animateScale&&(k=0),c.animateRotate&&(x=w=h));let v={x:f,y:d,innerRadius:0,outerRadius:k,startAngle:x,endAngle:w,options:this.resolveDataElementOptions(p,b.active?"active":s)};this.updateElement(b,p,v,s)}}countVisibleElements(){let t=this._cachedMeta,n=0;return t.data.forEach((r,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,r){return this.chart.getDataVisibility(t)?Tt(this.resolveDataElementOptions(t,n).angle||r):0}}return i})(),Ku=(()=>{class i extends gs{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}return i})(),Zu=(()=>{class i extends ce{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let n=this._cachedMeta.vScale,r=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(t,n,r,s){return Ar.bind(this)(t,n,r,s)}update(t){let n=this._cachedMeta,r=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(r.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let l={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(r,void 0,l,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,r,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let l=n;l<n+r;l++){let c=t[l],u=this.resolveDataElementOptions(l,c.active?"active":s),f=o.getPointPositionForValue(l,this.getParsed(l).r),d=a?o.xCenter:f.x,h=a?o.yCenter:f.y,m={x:d,y:h,angle:f.angle,skip:isNaN(d)||isNaN(h),options:u};this.updateElement(c,l,m,s)}}}return i})(),Ju=(()=>{class i extends ce{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),l=s.getLabelForValue(a.x),c=o.getLabelForValue(a.y);return{label:r[t]||"",value:"("+l+", "+c+")"}}update(t){let n=this._cachedMeta,{data:r=[]}=n,s=this.chart._animationsDisabled,{start:o,count:a}=_r(n,r,s);if(this._drawStart=o,this._drawCount=a,wr(n)&&(o=0,a=r.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=n;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=r;let u=this.resolveDatasetElementOptions(t);u.segment=this.options.segment,this.updateElement(l,void 0,{animated:!s,options:u},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(r,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,r,s){let o=s==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:u}=this._cachedMeta,f=this.resolveDataElementOptions(n,s),d=this.getSharedOptions(f),h=this.includeOptions(s,d),m=a.axis,p=l.axis,{spanGaps:g,segment:b}=this.options,x=ge(g)?g:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n>0&&this.getParsed(n-1);for(let v=n;v<n+r;++v){let _=t[v],P=this.getParsed(v),C=w?_:{},S=q(P[p]),E=C[m]=a.getPixelForValue(P[m],v),W=C[p]=o||S?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,P,c):P[p],v);C.skip=isNaN(E)||isNaN(W)||S,C.stop=v>0&&Math.abs(P[m]-k[m])>x,b&&(C.parsed=P,C.raw=u.data[v]),h&&(C.options=d||this.resolveDataElementOptions(v,_.active?"active":s)),w||this.updateElement(_,v,C,s),k=P}this.updateSharedOptions(d,s,f)}getMaxOverflow(){let t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let l=0;for(let c=n.length-1;c>=0;--c)l=Math.max(l,n[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let r=t.dataset,s=r.options&&r.options.borderWidth||0;if(!n.length)return s;let o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}}return i})(),tf=Object.freeze({__proto__:null,BarController:$u,BubbleController:Xu,DoughnutController:gs,LineController:Gu,PieController:Ku,PolarAreaController:Ha,RadarController:Zu,ScatterController:Ju});function xe(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Kr=class i{static override(e){Object.assign(i.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return xe()}parse(){return xe()}format(){return xe()}add(){return xe()}diff(){return xe()}startOf(){return xe()}endOf(){return xe()}},bs={_date:Kr};function ef(i,e,t,n){let{controller:r,data:s,_sorted:o}=i,a=r._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&o&&s.length){let c=a._reversePixels?go:Rt;if(n){if(r._sharedOptions){let u=s[0],f=typeof u.getRange=="function"&&u.getRange(e);if(f){let d=c(s,e,t-f),h=c(s,e,t+f);return{lo:d.lo,hi:h.hi}}}}else{let u=c(s,e,t);if(l){let{vScale:f}=r._cachedMeta,{_parsed:d}=i,h=d.slice(0,u.lo+1).reverse().findIndex(p=>!q(p[f.axis]));u.lo-=Math.max(0,h);let m=d.slice(u.hi).findIndex(p=>!q(p[f.axis]));u.hi+=Math.max(0,m)}return u}}return{lo:0,hi:s.length-1}}function vi(i,e,t,n,r){let s=i.getSortedVisibleDatasetMetas(),o=t[e];for(let a=0,l=s.length;a<l;++a){let{index:c,data:u}=s[a],{lo:f,hi:d}=ef(s[a],e,o,r);for(let h=f;h<=d;++h){let m=u[h];m.skip||n(m,c,h)}}}function nf(i){let e=i.indexOf("x")!==-1,t=i.indexOf("y")!==-1;return function(n,r){let s=e?Math.abs(n.x-r.x):0,o=t?Math.abs(n.y-r.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(o,2))}}function qr(i,e,t,n,r){let s=[];return!r&&!i.isPointInArea(e)||vi(i,t,e,function(a,l,c){!r&&!Et(a,i.chartArea,0)||a.inRange(e.x,e.y,n)&&s.push({element:a,datasetIndex:l,index:c})},!0),s}function rf(i,e,t,n){let r=[];function s(o,a,l){let{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],n),{angle:f}=gr(o,{x:e.x,y:e.y});Fe(f,c,u)&&r.push({element:o,datasetIndex:a,index:l})}return vi(i,t,e,s),r}function sf(i,e,t,n,r,s){let o=[],a=nf(t),l=Number.POSITIVE_INFINITY;function c(u,f,d){let h=u.inRange(e.x,e.y,r);if(n&&!h)return;let m=u.getCenterPoint(r);if(!(!!s||i.isPointInArea(m))&&!h)return;let g=a(e,m);g<l?(o=[{element:u,datasetIndex:f,index:d}],l=g):g===l&&o.push({element:u,datasetIndex:f,index:d})}return vi(i,t,e,c),o}function Ur(i,e,t,n,r,s){return!s&&!i.isPointInArea(e)?[]:t==="r"&&!n?rf(i,e,t,r):sf(i,e,t,n,r,s)}function $o(i,e,t,n,r){let s=[],o=t==="x"?"inXRange":"inYRange",a=!1;return vi(i,t,e,(l,c,u)=>{l[o]&&l[o](e[t],r)&&(s.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(e.x,e.y,r))}),n&&!a?[]:s}var of={evaluateInteractionItems:vi,modes:{index(i,e,t,n){let r=ae(e,i),s=t.axis||"x",o=t.includeInvisible||!1,a=t.intersect?qr(i,r,s,n,o):Ur(i,r,s,!1,n,o),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{let u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(i,e,t,n){let r=ae(e,i),s=t.axis||"xy",o=t.includeInvisible||!1,a=t.intersect?qr(i,r,s,n,o):Ur(i,r,s,!1,n,o);if(a.length>0){let l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(i,e,t,n){let r=ae(e,i),s=t.axis||"xy",o=t.includeInvisible||!1;return qr(i,r,s,n,o)},nearest(i,e,t,n){let r=ae(e,i),s=t.axis||"xy",o=t.includeInvisible||!1;return Ur(i,r,s,t.intersect,n,o)},x(i,e,t,n){let r=ae(e,i);return $o(i,r,"x",t.intersect,n)},y(i,e,t,n){let r=ae(e,i);return $o(i,r,"y",t.intersect,n)}}},Ya=["left","top","right","bottom"];function ui(i,e){return i.filter(t=>t.pos===e)}function Xo(i,e){return i.filter(t=>Ya.indexOf(t.pos)===-1&&t.box.axis===e)}function fi(i,e){return i.sort((t,n)=>{let r=e?n:t,s=e?t:n;return r.weight===s.weight?r.index-s.index:r.weight-s.weight})}function af(i){let e=[],t,n,r,s,o,a;for(t=0,n=(i||[]).length;t<n;++t)r=i[t],{position:s,options:{stack:o,stackWeight:a=1}}=r,e.push({index:t,box:r,pos:s,horizontal:r.isHorizontal(),weight:r.weight,stack:o&&s+o,stackWeight:a});return e}function lf(i){let e={};for(let t of i){let{stack:n,pos:r,stackWeight:s}=t;if(!n||!Ya.includes(r))continue;let o=e[n]||(e[n]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=s}return e}function cf(i,e){let t=lf(i),{vBoxMaxWidth:n,hBoxMaxHeight:r}=e,s,o,a;for(s=0,o=i.length;s<o;++s){a=i[s];let{fullSize:l}=a.box,c=t[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*n:l&&e.availableWidth,a.height=r):(a.width=n,a.height=u?u*r:l&&e.availableHeight)}return t}function uf(i){let e=af(i),t=fi(e.filter(c=>c.box.fullSize),!0),n=fi(ui(e,"left"),!0),r=fi(ui(e,"right")),s=fi(ui(e,"top"),!0),o=fi(ui(e,"bottom")),a=Xo(e,"x"),l=Xo(e,"y");return{fullSize:t,leftAndTop:n.concat(s),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:ui(e,"chartArea"),vertical:n.concat(r).concat(l),horizontal:s.concat(o).concat(a)}}function Qo(i,e,t,n){return Math.max(i[t],e[t])+Math.max(i[n],e[n])}function Ba(i,e){i.top=Math.max(i.top,e.top),i.left=Math.max(i.left,e.left),i.bottom=Math.max(i.bottom,e.bottom),i.right=Math.max(i.right,e.right)}function ff(i,e,t,n){let{pos:r,box:s}=t,o=i.maxPadding;if(!U(r)){t.size&&(i[r]-=t.size);let f=n[t.stack]||{size:0,count:1};f.size=Math.max(f.size,t.horizontal?s.height:s.width),t.size=f.size/f.count,i[r]+=t.size}s.getPadding&&Ba(o,s.getPadding());let a=Math.max(0,e.outerWidth-Qo(o,i,"left","right")),l=Math.max(0,e.outerHeight-Qo(o,i,"top","bottom")),c=a!==i.w,u=l!==i.h;return i.w=a,i.h=l,t.horizontal?{same:c,other:u}:{same:u,other:c}}function df(i){let e=i.maxPadding;function t(n){let r=Math.max(e[n]-i[n],0);return i[n]+=r,r}i.y+=t("top"),i.x+=t("left"),t("right"),t("bottom")}function hf(i,e){let t=e.maxPadding;function n(r){let s={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{s[o]=Math.max(e[o],t[o])}),s}return n(i?["left","right"]:["top","bottom"])}function mi(i,e,t,n){let r=[],s,o,a,l,c,u;for(s=0,o=i.length,c=0;s<o;++s){a=i[s],l=a.box,l.update(a.width||e.w,a.height||e.h,hf(a.horizontal,e));let{same:f,other:d}=ff(e,t,a,n);c|=f&&r.length,u=u||d,l.fullSize||r.push(a)}return c&&mi(r,e,t,n)||u}function nn(i,e,t,n,r){i.top=t,i.left=e,i.right=e+n,i.bottom=t+r,i.width=n,i.height=r}function Go(i,e,t,n){let r=t.padding,{x:s,y:o}=e;for(let a of i){let l=a.box,c=n[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){let f=e.w*u,d=c.size||l.height;Re(c.start)&&(o=c.start),l.fullSize?nn(l,r.left,o,t.outerWidth-r.right-r.left,d):nn(l,e.left+c.placed,o,f,d),c.start=o,c.placed+=f,o=l.bottom}else{let f=e.h*u,d=c.size||l.width;Re(c.start)&&(s=c.start),l.fullSize?nn(l,s,r.top,d,t.outerHeight-r.bottom-r.top):nn(l,s,e.top+c.placed,d,f),c.start=s,c.placed+=f,s=l.right}}e.x=s,e.y=o}var ht={addBox(i,e){i.boxes||(i.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},i.boxes.push(e)},removeBox(i,e){let t=i.boxes?i.boxes.indexOf(e):-1;t!==-1&&i.boxes.splice(t,1)},configure(i,e,t){e.fullSize=t.fullSize,e.position=t.position,e.weight=t.weight},update(i,e,t,n){if(!i)return;let r=dt(i.options.layout.padding),s=Math.max(e-r.width,0),o=Math.max(t-r.height,0),a=uf(i.boxes),l=a.vertical,c=a.horizontal;X(i.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let u=l.reduce((p,g)=>g.box.options&&g.box.options.display===!1?p:p+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:t,padding:r,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/u,hBoxMaxHeight:o/2}),d=Object.assign({},r);Ba(d,dt(n));let h=Object.assign({maxPadding:d,w:s,h:o,x:r.left,y:r.top},r),m=cf(l.concat(c),f);mi(a.fullSize,h,f,m),mi(l,h,f,m),mi(c,h,f,m)&&mi(l,h,f,m),df(h),Go(a.leftAndTop,h,f,m),h.x+=h.w,h.y+=h.h,Go(a.rightAndBottom,h,f,m),i.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},X(a.chartArea,p=>{let g=p.box;Object.assign(g,i.chartArea),g.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}},dn=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}},Zr=class extends dn{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}},cn="$chartjs",mf={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ko=i=>i===null||i==="";function pf(i,e){let t=i.style,n=i.getAttribute("height"),r=i.getAttribute("width");if(i[cn]={initial:{height:n,width:r,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Ko(r)){let s=Lr(i,"width");s!==void 0&&(i.width=s)}if(Ko(n))if(i.style.height==="")i.height=i.width/(e||2);else{let s=Lr(i,"height");s!==void 0&&(i.height=s)}return i}var qa=Lo?{passive:!0}:!1;function gf(i,e,t){i&&i.addEventListener(e,t,qa)}function bf(i,e,t){i&&i.canvas&&i.canvas.removeEventListener(e,t,qa)}function xf(i,e){let t=mf[i.type]||i.type,{x:n,y:r}=ae(i,e);return{type:t,chart:e,native:i,x:n!==void 0?n:null,y:r!==void 0?r:null}}function hn(i,e){for(let t of i)if(t===e||t.contains(e))return!0}function vf(i,e,t){let n=i.canvas,r=new MutationObserver(s=>{let o=!1;for(let a of s)o=o||hn(a.addedNodes,n),o=o&&!hn(a.removedNodes,n);o&&t()});return r.observe(document,{childList:!0,subtree:!0}),r}function yf(i,e,t){let n=i.canvas,r=new MutationObserver(s=>{let o=!1;for(let a of s)o=o||hn(a.removedNodes,n),o=o&&!hn(a.addedNodes,n);o&&t()});return r.observe(document,{childList:!0,subtree:!0}),r}var gi=new Map,Zo=0;function Ua(){let i=window.devicePixelRatio;i!==Zo&&(Zo=i,gi.forEach((e,t)=>{t.currentDevicePixelRatio!==i&&e()}))}function _f(i,e){gi.size||window.addEventListener("resize",Ua),gi.set(i,e)}function wf(i){gi.delete(i),gi.size||window.removeEventListener("resize",Ua)}function Mf(i,e,t){let n=i.canvas,r=n&&tn(n);if(!r)return;let s=yr((a,l)=>{let c=r.clientWidth;t(a,l),c<r.clientWidth&&t()},window),o=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||s(c,u)});return o.observe(r),_f(i,s),o}function Vr(i,e,t){t&&t.disconnect(),e==="resize"&&wf(i)}function kf(i,e,t){let n=i.canvas,r=yr(s=>{i.ctx!==null&&t(xf(s,i))},i);return gf(n,e,r),r}var Jr=class extends dn{acquireContext(e,t){let n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(pf(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[cn])return!1;let n=t[cn].initial;["height","width"].forEach(s=>{let o=n[s];q(o)?t.removeAttribute(s):t.setAttribute(s,o)});let r=n.style||{};return Object.keys(r).forEach(s=>{t.style[s]=r[s]}),t.width=t.width,delete t[cn],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||(e.$proxies={}),o={attach:vf,detach:yf,resize:Mf}[t]||kf;r[t]=o(e,t,n)}removeEventListener(e,t){let n=e.$proxies||(e.$proxies={}),r=n[t];if(!r)return;({attach:Vr,detach:Vr,resize:Vr}[t]||bf)(e,t,r),n[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return Io(e,t,n,r)}isAttached(e){let t=e&&tn(e);return!!(t&&t.isConnected)}};function Df(i){return!Ji()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Zr:Jr}var It=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return ge(this.x)&&ge(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(s=>{r[s]=n[s]&&n[s].active()?n[s]._to:this[s]}),r}};function Tf(i,e){let t=i.options.ticks,n=Cf(i),r=Math.min(t.maxTicksLimit||n,n),s=t.major.enabled?Sf(e):[],o=s.length,a=s[0],l=s[o-1],c=[];if(o>r)return Of(e,c,s,o/r),c;let u=Pf(s,e,r);if(o>0){let f,d,h=o>1?Math.round((l-a)/(o-1)):null;for(rn(e,c,u,q(h)?0:a-h,a),f=0,d=o-1;f<d;f++)rn(e,c,u,s[f],s[f+1]);return rn(e,c,u,l,q(h)?e.length:l+h),c}return rn(e,c,u),c}function Cf(i){let e=i.options.offset,t=i._tickSize(),n=i._length/t+(e?0:1),r=i._maxLength/t;return Math.floor(Math.min(n,r))}function Pf(i,e,t){let n=Af(i),r=e.length/t;if(!n)return Math.max(r,1);let s=ho(n);for(let o=0,a=s.length-1;o<a;o++){let l=s[o];if(l>r)return l}return Math.max(r,1)}function Sf(i){let e=[],t,n;for(t=0,n=i.length;t<n;t++)i[t].major&&e.push(t);return e}function Of(i,e,t,n){let r=0,s=t[0],o;for(n=Math.ceil(n),o=0;o<i.length;o++)o===s&&(e.push(i[o]),r++,s=t[r*n])}function rn(i,e,t,n,r){let s=z(n,0),o=Math.min(z(r,i.length),i.length),a=0,l,c,u;for(t=Math.ceil(t),r&&(l=r-n,t=l/Math.floor(l/t)),u=s;u<0;)a++,u=Math.round(s+a*t);for(c=Math.max(s,0);c<o;c++)c===u&&(e.push(i[c]),a++,u=Math.round(s+a*t))}function Af(i){let e=i.length,t,n;if(e<2)return!1;for(n=i[0],t=1;t<e;++t)if(i[t]-i[t-1]!==n)return!1;return n}var If=i=>i==="left"?"right":i==="right"?"left":i,Jo=(i,e,t)=>e==="top"||e==="left"?i[e]+t:i[e]-t,ta=(i,e)=>Math.min(e||i,i);function ea(i,e){let t=[],n=i.length/e,r=i.length,s=0;for(;s<r;s+=n)t.push(i[Math.floor(s)]);return t}function Lf(i,e,t){let n=i.ticks.length,r=Math.min(e,n-1),s=i._startPixel,o=i._endPixel,a=1e-6,l=i.getPixelForTick(r),c;if(!(t&&(n===1?c=Math.max(l-s,o-l):e===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(r-1))/2,l+=r<e?c:-c,l<s-a||l>o+a)))return l}function Rf(i,e){X(i,t=>{let n=t.gc,r=n.length/2,s;if(r>e){for(s=0;s<r;++s)delete t.data[n[s]];n.splice(0,r)}})}function di(i){return i.drawTicks?i.tickLength:0}function ia(i,e){if(!i.display)return 0;let t=ot(i.font,e),n=dt(i.padding);return(J(i.text)?i.text.length:1)*t.lineHeight+n.height}function Ef(i,e){return jt(i,{scale:e,type:"scale"})}function Ff(i,e,t){return jt(i,{tick:t,index:e,type:"tick"})}function Wf(i,e,t){let n=Xi(i);return(t&&e!=="right"||!t&&e==="right")&&(n=If(n)),n}function Nf(i,e,t,n){let{top:r,left:s,bottom:o,right:a,chart:l}=i,{chartArea:c,scales:u}=l,f=0,d,h,m,p=o-r,g=a-s;if(i.isHorizontal()){if(h=ft(n,s,a),U(t)){let b=Object.keys(t)[0],x=t[b];m=u[b].getPixelForValue(x)+p-e}else t==="center"?m=(c.bottom+c.top)/2+p-e:m=Jo(i,t,e);d=a-s}else{if(U(t)){let b=Object.keys(t)[0],x=t[b];h=u[b].getPixelForValue(x)-g+e}else t==="center"?h=(c.left+c.right)/2-g+e:h=Jo(i,t,e);m=ft(n,o,r),f=t==="left"?-st:st}return{titleX:h,titleY:m,maxWidth:d,rotation:f}}var ye=class i extends It{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=bt(e,Number.POSITIVE_INFINITY),t=bt(t,Number.NEGATIVE_INFINITY),n=bt(n,Number.POSITIVE_INFINITY),r=bt(r,Number.NEGATIVE_INFINITY),{min:bt(e,n),max:bt(t,r),minDefined:rt(e),maxDefined:rt(t)}}getMinMax(e){let{min:t,max:n,minDefined:r,maxDefined:s}=this.getUserBounds(),o;if(r&&s)return{min:t,max:n};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,e),r||(t=Math.min(t,o.min)),s||(n=Math.max(n,o.max));return t=s&&t>n?n:t,n=r&&t>n?t:n,{min:bt(t,bt(n,t)),max:bt(n,bt(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){K(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=To(this,s,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?ea(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=Tf(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){K(this.options.afterUpdate,[this])}beforeSetDimensions(){K(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(){K(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),K(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){K(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t=this.options.ticks,n,r,s;for(n=0,r=e.length;n<r;n++)s=e[n],s.label=K(t.callback,[s.value,n,e],this)}afterTickToLabelConversion(){K(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){K(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=ta(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,s=t.maxRotation,o=r,a,l,c;if(!this._isVisible()||!t.display||r>=s||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let u=this._getLabelSizes(),f=u.widest.width,d=u.highest.height,h=lt(this.chart.width-f,0,this.maxWidth);a=e.offset?this.maxWidth/n:h/(n-1),f+6>a&&(a=h/(n-(e.offset?.5:1)),l=this.maxHeight-di(e.grid)-t.padding-ia(e.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),o=ji(Math.min(Math.asin(lt((u.highest.height+6)/a,-1,1)),Math.asin(lt(l/c,-1,1))-Math.asin(lt(d/c,-1,1)))),o=Math.max(r,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){K(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){K(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){let l=ia(r,t.options.font);if(a?(e.width=this.maxWidth,e.height=di(s)+l):(e.height=this.maxHeight,e.width=di(s)+l),n.display&&this.ticks.length){let{first:c,last:u,widest:f,highest:d}=this._getLabelSizes(),h=n.padding*2,m=Tt(this.labelRotation),p=Math.cos(m),g=Math.sin(m);if(a){let b=n.mirror?0:g*f.width+p*d.height;e.height=Math.min(this.maxHeight,e.height+b+h)}else{let b=n.mirror?0:p*f.width+g*d.height;e.width=Math.min(this.maxWidth,e.width+b+h)}this._calculatePadding(c,u,g,p)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){let{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1),d=0,h=0;l?c?(d=r*e.width,h=n*t.height):(d=n*e.height,h=r*t.width):s==="start"?h=t.width:s==="end"?d=e.width:s!=="inner"&&(d=e.width/2,h=t.width/2),this.paddingLeft=Math.max((d-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((h-f+o)*this.width/(this.width-f),0)}else{let u=t.height/2,f=e.height/2;s==="start"?(u=0,f=e.height):s==="end"&&(u=t.height,f=0),this.paddingTop=u+o,this.paddingBottom=f+o}}_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(){K(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)q(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=ea(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:r,_longestTextCache:s}=this,o=[],a=[],l=Math.floor(t/ta(t,n)),c=0,u=0,f,d,h,m,p,g,b,x,w,k,v;for(f=0;f<t;f+=l){if(m=e[f].label,p=this._resolveTickFontOptions(f),r.font=g=p.string,b=s[g]=s[g]||{data:{},gc:[]},x=p.lineHeight,w=k=0,!q(m)&&!J(m))w=ri(r,b.data,b.gc,w,m),k=x;else if(J(m))for(d=0,h=m.length;d<h;++d)v=m[d],!q(v)&&!J(v)&&(w=ri(r,b.data,b.gc,w,v),k+=x);o.push(w),a.push(k),c=Math.max(w,c),u=Math.max(k,u)}Rf(s,t);let _=o.indexOf(c),P=a.indexOf(u),C=S=>({width:o[S]||0,height:a[S]||0});return{first:C(0),last:C(t-1),widest:C(_),highest:C(P),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return po(this._alignToPixels?re(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||(n.$context=Ff(this.getContext(),e,n))}return this.$context||(this.$context=Ef(this.chart.getContext(),this))}_tickSize(){let e=this.options.ticks,t=Tt(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),s=this._getLabelSizes(),o=e.autoSkipPadding||0,a=s?s.widest.width+o:0,l=s?s.highest.height+o:0;return this.isHorizontal()?l*n>a*r?a/n:l/r:l*r<a*n?l/n:a/r}_isVisible(){let e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:s,position:o,border:a}=r,l=s.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),d=di(s),h=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,g=p/2,b=function(B){return re(n,B,p)},x,w,k,v,_,P,C,S,E,W,H,nt;if(o==="top")x=b(this.bottom),P=this.bottom-d,S=x-g,W=b(e.top)+g,nt=e.bottom;else if(o==="bottom")x=b(this.top),W=e.top,nt=b(e.bottom)-g,P=x+g,S=this.top+d;else if(o==="left")x=b(this.right),_=this.right-d,C=x-g,E=b(e.left)+g,H=e.right;else if(o==="right")x=b(this.left),E=e.left,H=b(e.right)-g,_=x+g,C=this.left+d;else if(t==="x"){if(o==="center")x=b((e.top+e.bottom)/2+.5);else if(U(o)){let B=Object.keys(o)[0],Q=o[B];x=b(this.chart.scales[B].getPixelForValue(Q))}W=e.top,nt=e.bottom,P=x+g,S=P+d}else if(t==="y"){if(o==="center")x=b((e.left+e.right)/2);else if(U(o)){let B=Object.keys(o)[0],Q=o[B];x=b(this.chart.scales[B].getPixelForValue(Q))}_=x-g,C=_-d,E=e.left,H=e.right}let ut=z(r.ticks.maxTicksLimit,f),N=Math.max(1,Math.ceil(f/ut));for(w=0;w<f;w+=N){let B=this.getContext(w),Q=s.setContext(B),yt=a.setContext(B),at=Q.lineWidth,Gt=Q.color,Kt=yt.dash||[],wt=yt.dashOffset,Zt=Q.tickWidth,Mt=Q.tickColor,Jt=Q.tickBorderDash||[],Lt=Q.tickBorderDashOffset;k=Lf(this,w,l),k!==void 0&&(v=re(n,k,at),c?_=C=E=H=v:P=S=W=nt=v,h.push({tx1:_,ty1:P,tx2:C,ty2:S,x1:E,y1:W,x2:H,y2:nt,width:at,color:Gt,borderDash:Kt,borderDashOffset:wt,tickWidth:Zt,tickColor:Mt,tickBorderDash:Jt,tickBorderDashOffset:Lt}))}return this._ticksLength=f,this._borderValue=x,h}_computeLabelItems(e){let t=this.axis,n=this.options,{position:r,ticks:s}=n,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=s,d=di(n.grid),h=d+u,m=f?-u:h,p=-Tt(this.labelRotation),g=[],b,x,w,k,v,_,P,C,S,E,W,H,nt="middle";if(r==="top")_=this.bottom-m,P=this._getXAxisLabelAlignment();else if(r==="bottom")_=this.top+m,P=this._getXAxisLabelAlignment();else if(r==="left"){let N=this._getYAxisLabelAlignment(d);P=N.textAlign,v=N.x}else if(r==="right"){let N=this._getYAxisLabelAlignment(d);P=N.textAlign,v=N.x}else if(t==="x"){if(r==="center")_=(e.top+e.bottom)/2+h;else if(U(r)){let N=Object.keys(r)[0],B=r[N];_=this.chart.scales[N].getPixelForValue(B)+h}P=this._getXAxisLabelAlignment()}else if(t==="y"){if(r==="center")v=(e.left+e.right)/2-h;else if(U(r)){let N=Object.keys(r)[0],B=r[N];v=this.chart.scales[N].getPixelForValue(B)}P=this._getYAxisLabelAlignment(d).textAlign}t==="y"&&(l==="start"?nt="top":l==="end"&&(nt="bottom"));let ut=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){w=a[b],k=w.label;let N=s.setContext(this.getContext(b));C=this.getPixelForTick(b)+s.labelOffset,S=this._resolveTickFontOptions(b),E=S.lineHeight,W=J(k)?k.length:1;let B=W/2,Q=N.color,yt=N.textStrokeColor,at=N.textStrokeWidth,Gt=P;o?(v=C,P==="inner"&&(b===x-1?Gt=this.options.reverse?"left":"right":b===0?Gt=this.options.reverse?"right":"left":Gt="center"),r==="top"?c==="near"||p!==0?H=-W*E+E/2:c==="center"?H=-ut.highest.height/2-B*E+E:H=-ut.highest.height+E/2:c==="near"||p!==0?H=E/2:c==="center"?H=ut.highest.height/2-B*E:H=ut.highest.height-W*E,f&&(H*=-1),p!==0&&!N.showLabelBackdrop&&(v+=E/2*Math.sin(p))):(_=C,H=(1-W)*E/2);let Kt;if(N.showLabelBackdrop){let wt=dt(N.backdropPadding),Zt=ut.heights[b],Mt=ut.widths[b],Jt=H-wt.top,Lt=0-wt.left;switch(nt){case"middle":Jt-=Zt/2;break;case"bottom":Jt-=Zt;break}switch(P){case"center":Lt-=Mt/2;break;case"right":Lt-=Mt;break;case"inner":b===x-1?Lt-=Mt:b>0&&(Lt-=Mt/2);break}Kt={left:Lt,top:Jt,width:Mt+wt.width,height:Zt+wt.height,color:N.backdropColor}}g.push({label:k,font:S,textOffset:H,options:{rotation:p,color:Q,strokeColor:yt,strokeWidth:at,textAlign:Gt,textBaseline:nt,translation:[v,_],backdrop:Kt}})}return g}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-Tt(this.labelRotation))return e==="top"?"left":"right";let r="center";return t.align==="start"?r="left":t.align==="end"?r="right":t.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:s}}=this.options,o=this._getLabelSizes(),a=e+s,l=o.widest.width,c,u;return t==="left"?r?(u=this.right+s,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u=this.left)):t==="right"?r?(u=this.left+s,n==="near"?c="right":n==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,n==="near"?c="left":n==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:r,width:s,height:o}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,s,o),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let r=this.ticks.findIndex(s=>s.value===e);return r>=0?t.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),s,o,a=(l,c,u)=>{!u.width||!u.color||(n.save(),n.lineWidth=u.width,n.strokeStyle=u.color,n.setLineDash(u.borderDash||[]),n.lineDashOffset=u.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(t.display)for(s=0,o=r.length;s<o;++s){let l=r[s];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({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(){let{chart:e,ctx:t,options:{border:n,grid:r}}=this,s=n.setContext(this.getContext()),o=n.display?s.width:0;if(!o)return;let a=r.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,u,f,d;this.isHorizontal()?(c=re(e,this.left,o)-o/2,u=re(e,this.right,a)+a/2,f=d=l):(f=re(e,this.top,o)-o/2,d=re(e,this.bottom,a)+a/2,c=u=l),t.save(),t.lineWidth=s.width,t.strokeStyle=s.color,t.beginPath(),t.moveTo(c,f),t.lineTo(u,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let n=this.ctx,r=this._computeLabelArea();r&&ai(n,r);let s=this.getLabelItems(e);for(let o of s){let a=o.options,l=o.font,c=o.label,u=o.textOffset;se(n,c,0,u,l,a)}r&&li(n)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;let s=ot(n.font),o=dt(n.padding),a=n.align,l=s.lineHeight/2;t==="bottom"||t==="center"||U(t)?(l+=o.bottom,J(n.text)&&(l+=s.lineHeight*(n.text.length-1))):l+=o.top;let{titleX:c,titleY:u,maxWidth:f,rotation:d}=Nf(this,l,t,a);se(e,n.text,0,0,s,{color:n.color,maxWidth:f,rotation:d,textAlign:Wf(a,t,r),textBaseline:"middle",translation:[c,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let e=this.options,t=e.ticks&&e.ticks.z||0,n=z(e.grid&&e.grid.z,-1),r=z(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==i.prototype.draw?[{z:t,draw:s=>{this.draw(s)}}]:[{z:n,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:t,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",r=[],s,o;for(s=0,o=t.length;s<o;++s){let a=t[s];a[n]===this.id&&(!e||a.type===e)&&r.push(a)}return r}_resolveTickFontOptions(e){let t=this.options.ticks.setContext(this.getContext(e));return ot(t.font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},Ye=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;Yf(t)&&(n=this.register(t));let r=this.items,s=e.id,o=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+e);return s in r||(r[s]=e,zf(e,o,n),this.override&&it.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in it[r]&&(delete it[r][n],this.override&&delete ne[n])}};function zf(i,e,t){let n=Ae(Object.create(null),[t?it.get(t):{},it.get(e),i.defaults]);it.set(e,n),i.defaultRoutes&&Hf(e,i.defaultRoutes),i.descriptors&&it.describe(e,i.descriptors)}function Hf(i,e){Object.keys(e).forEach(t=>{let n=t.split("."),r=n.pop(),s=[i].concat(n).join("."),o=e[t].split("."),a=o.pop(),l=o.join(".");it.route(s,r,l,a)})}function Yf(i){return"id"in i&&"defaults"in i}var ts=class{constructor(){this.controllers=new Ye(ce,"datasets",!0),this.elements=new Ye(It,"elements"),this.plugins=new Ye(Object,"plugins"),this.scales=new Ye(ye,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach(r=>{let s=n||this._getRegistryForType(r);n||s.isForType(r)||s===this.plugins&&r.id?this._exec(e,s,r):X(r,o=>{let a=n||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,t,n){let r=Vi(e);K(n["before"+r],[],n),t[e](n),K(n["after"+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let r=t.get(e);if(r===void 0)throw new Error('"'+e+'" is not a registered '+n+".");return r}},zt=new ts,es=class{constructor(){this._init=[]}notify(e,t,n,r){t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));let s=r?this._descriptors(e).filter(r):this._descriptors(e),o=this._notify(s,e,t,n);return t==="afterDestroy"&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall")),o}_notify(e,t,n,r){r=r||{};for(let s of e){let o=s.plugin,a=o[n],l=[t,r,s.options];if(K(a,l,o)===!1&&r.cancelable)return!1}return!0}invalidate(){q(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,r=z(n.options&&n.options.plugins,{}),s=Bf(n);return r===!1&&!t?[]:Uf(e,s,r,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,r=(s,o)=>s.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(r(t,n),e,"stop"),this._notify(r(n,t),e,"start")}};function Bf(i){let e={},t=[],n=Object.keys(zt.plugins.items);for(let s=0;s<n.length;s++)t.push(zt.getPlugin(n[s]));let r=i.plugins||[];for(let s=0;s<r.length;s++){let o=r[s];t.indexOf(o)===-1&&(t.push(o),e[o.id]=!0)}return{plugins:t,localIds:e}}function qf(i,e){return!e&&i===!1?null:i===!0?{}:i}function Uf(i,{plugins:e,localIds:t},n,r){let s=[],o=i.getContext();for(let a of e){let l=a.id,c=qf(n[l],r);c!==null&&s.push({plugin:a,options:Vf(i.config,{plugin:a,local:t[l]},c,o)})}return s}function Vf(i,{plugin:e,local:t},n,r){let s=i.pluginScopeKeys(e),o=i.getOptionScopes(n,s);return t&&e.defaults&&o.push(e.defaults),i.createResolver(o,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function is(i,e){let t=it.datasets[i]||{};return((e.datasets||{})[i]||{}).indexAxis||e.indexAxis||t.indexAxis||"x"}function jf(i,e){let t=i;return i==="_index_"?t=e:i==="_value_"&&(t=e==="x"?"y":"x"),t}function $f(i,e){return i===e?"_index_":"_value_"}function na(i){if(i==="x"||i==="y"||i==="r")return i}function Xf(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function ns(i,...e){if(na(i))return i;for(let t of e){let n=t.axis||Xf(t.position)||i.length>1&&na(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function ra(i,e,t){if(t[e+"AxisID"]===i)return{axis:e}}function Qf(i,e){if(e.data&&e.data.datasets){let t=e.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(t.length)return ra(i,"x",t[0])||ra(i,"y",t[0])}return{}}function Gf(i,e){let t=ne[i.type]||{scales:{}},n=e.scales||{},r=is(i.type,e),s=Object.create(null);return Object.keys(n).forEach(o=>{let a=n[o];if(!U(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);let l=ns(o,a,Qf(o,i),it.scales[a.type]),c=$f(l,r),u=t.scales||{};s[o]=Le(Object.create(null),[{axis:l},a,u[l],u[c]])}),i.data.datasets.forEach(o=>{let a=o.type||i.type,l=o.indexAxis||is(a,e),u=(ne[a]||{}).scales||{};Object.keys(u).forEach(f=>{let d=jf(f,l),h=o[d+"AxisID"]||d;s[h]=s[h]||Object.create(null),Le(s[h],[{axis:d},n[h],u[f]])})}),Object.keys(s).forEach(o=>{let a=s[o];Le(a,[it.scales[a.type],it.scale])}),s}function Va(i){let e=i.options||(i.options={});e.plugins=z(e.plugins,{}),e.scales=Gf(i,e)}function ja(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Kf(i){return i=i||{},i.data=ja(i.data),Va(i),i}var sa=new Map,$a=new Set;function sn(i,e){let t=sa.get(i);return t||(t=e(),sa.set(i,t),$a.add(t)),t}var hi=(i,e,t)=>{let n=Vt(e,t);n!==void 0&&i.add(n)},rs=class{constructor(e){this._config=Kf(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=ja(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),Va(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return sn(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return sn(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return sn(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){let t=e.id,n=this.type;return sn(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:s}=this,o=this._cachedScopes(e,n),a=o.get(t);if(a)return a;let l=new Set;t.forEach(u=>{e&&(l.add(e),u.forEach(f=>hi(l,e,f))),u.forEach(f=>hi(l,r,f)),u.forEach(f=>hi(l,ne[s]||{},f)),u.forEach(f=>hi(l,it,f)),u.forEach(f=>hi(l,Qi,f))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),$a.has(t)&&o.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,ne[t]||{},it.datasets[t]||{},{type:t},it,Qi]}resolveNamedOptions(e,t,n,r=[""]){let s={$shared:!0},{resolver:o,subPrefixes:a}=oa(this._resolverCache,e,r),l=o;if(Jf(o,t)){s.$shared=!1,n=qt(n)?n():n;let c=this.createResolver(e,n,a);l=pe(o,n,c)}for(let c of t)s[c]=l[c];return s}createResolver(e,t,n=[""],r){let{resolver:s}=oa(this._resolverCache,e,n);return U(t)?pe(s,t,void 0,r):s}};function oa(i,e,t){let n=i.get(e);n||(n=new Map,i.set(e,n));let r=t.join(),s=n.get(r);return s||(s={resolver:Zi(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},n.set(r,s)),s}var Zf=i=>U(i)&&Object.getOwnPropertyNames(i).some(e=>qt(i[e]));function Jf(i,e){let{isScriptable:t,isIndexable:n}=Pr(i);for(let r of e){let s=t(r),o=n(r),a=(o||s)&&i[r];if(s&&(qt(a)||Zf(a))||o&&J(a))return!0}return!1}var td="4.4.9",ed=["top","bottom","left","right","chartArea"];function aa(i,e){return i==="top"||i==="bottom"||ed.indexOf(i)===-1&&e==="x"}function la(i,e){return function(t,n){return t[i]===n[i]?t[e]-n[e]:t[i]-n[i]}}function ca(i){let e=i.chart,t=e.options.animation;e.notifyPlugins("afterRender"),K(t&&t.onComplete,[i],e)}function id(i){let e=i.chart,t=e.options.animation;K(t&&t.onProgress,[i],e)}function Xa(i){return Ji()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}var un={},ua=i=>{let e=Xa(i);return Object.values(un).filter(t=>t.canvas===e).pop()};function nd(i,e,t){let n=Object.keys(i);for(let r of n){let s=+r;if(s>=e){let o=i[r];delete i[r],(t>0||s>e)&&(i[s+t]=o)}}}function rd(i,e,t,n){return!t||i.type==="mouseout"?null:n?e:i}var sd=(()=>{class i{static defaults=it;static instances=un;static overrides=ne;static registry=zt;static version=td;static getChart=ua;static register(...t){zt.add(...t),fa()}static unregister(...t){zt.remove(...t),fa()}constructor(t,n){let r=this.config=new rs(n),s=Xa(t),o=ua(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||Df(s)),this.platform.updateConfig(r);let l=this.platform.acquireContext(s,a.aspectRatio),c=l&&l.canvas,u=c&&c.height,f=c&&c.width;if(this.id=lo(),this.ctx=l,this.canvas=c,this.width=f,this.height=u,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 es,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=yo(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],un[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}$t.listen(this,"complete",ca),$t.listen(this,"progress",id),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return q(t)?n&&o?o:s?r/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 zt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ir(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Dr(this.canvas,this.ctx),this}stop(){return $t.stop(this),this}resize(t,n){$t.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){let r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,n,o),l=r.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Ir(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),K(r.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let n=this.options.scales||{};X(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){let t=this.options,n=t.scales,r=this.scales,s=Object.keys(r).reduce((a,l)=>(a[l]=!1,a),{}),o=[];n&&(o=o.concat(Object.keys(n).map(a=>{let l=n[a],c=ns(a,l),u=c==="r",f=c==="x";return{options:l,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),X(o,a=>{let l=a.options,c=l.id,u=ns(c,l),f=z(l.type,a.dtype);(l.position===void 0||aa(l.position,u)!==aa(a.dposition))&&(l.position=a.dposition),s[c]=!0;let d=null;if(c in r&&r[c].type===f)d=r[c];else{let h=zt.getScale(f);d=new h({id:c,type:f,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(l,t)}),X(s,(a,l)=>{a||delete r[l]}),X(r,a=>{ht.configure(this,a,a.options),ht.addBox(this,a)})}_updateMetasets(){let t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((s,o)=>s.index-o.index),r>n){for(let s=n;s<r;++s)this._destroyDatasetMeta(s);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(la("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],n=this.data.datasets,r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r<s;r++){let o=n[r],a=this.getDatasetMeta(r),l=o.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(r),a=this.getDatasetMeta(r)),a.type=l,a.indexAxis=o.indexAxis||is(l,this.options),a.order=o.order||0,a.index=r,a.label=""+o.label,a.visible=this.isDatasetVisible(r),a.controller)a.controller.updateIndex(r),a.controller.linkScales();else{let c=zt.getController(l),{datasetElementType:u,dataElementType:f}=it.datasets[l];Object.assign(c,{dataElementType:zt.getElement(f),datasetElementType:u&&zt.getElement(u)}),a.controller=new c(this,r),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){X(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let n=this.config;n.update();let r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let u=0,f=this.data.datasets.length;u<f;u++){let{controller:d}=this.getDatasetMeta(u),h=!s&&o.indexOf(d)===-1;d.buildOrUpdateElements(h),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=r.layout.autoPadding?a:0,this._updateLayout(a),s||X(o,u=>{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(la("z","_idx"));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){X(this.scales,t=>{ht.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!dr(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(let{method:r,start:s,count:o}of n){let a=r==="_removeElements"?-o:o;nd(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let n=this.data.datasets.length,r=o=>new Set(t.filter(a=>a[0]===o).map((a,l)=>l+","+a.splice(1).join(","))),s=r(0);for(let o=1;o<n;o++)if(!dr(s,r(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ht.update(this,this.width,this.height,t);let n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],X(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,qt(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){let r=this.getDatasetMeta(t),s={meta:r,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(r.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&($t.has(this)?this.attached&&!$t.running(this)&&$t.start(this):(this.draw(),ca({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:r,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let n=this._sortedMetasets,r=[],s,o;for(s=0,o=n.length;s<o;++s){let a=n[s];(!t||a.visible)&&r.push(a)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let n=this.ctx,r={meta:t,index:t.index,cancelable:!0},s=Nr(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&ai(n,s),t.controller.draw(),s&&li(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Et(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,s){let o=of.modes[n];return typeof o=="function"?o(this,t,r,s):[]}getDatasetMeta(t){let n=this.data.datasets[t],r=this._metasets,s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=jt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let n=this.data.datasets[t];if(!n)return!1;let r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){let r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){let s=r?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Re(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),a.update(o,{visible:r}),this.update(l=>l.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){let n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),$t.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Dr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete un[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,n=this.platform,r=(o,a)=>{n.addEventListener(this,o,a),t[o]=a},s=(o,a,l)=>{o.offsetX=a,o.offsetY=l,this._eventHandler(o)};X(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,n=this.platform,r=(c,u)=>{n.addEventListener(this,c,u),t[c]=u},s=(c,u)=>{t[c]&&(n.removeEventListener(this,c,u),delete t[c])},o=(c,u)=>{this.canvas&&this.resize(c,u)},a,l=()=>{s("attach",l),this.attached=!0,this.resize(),r("resize",o),r("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",l)},n.isAttached(this.canvas)?l():a()}unbindEvents(){X(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},X(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){let s=r?"set":"remove",o,a,l,c;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){a=t[l];let u=a&&this.getDatasetMeta(a.datasetIndex).controller;u&&u[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let n=this._active||[],r=t.map(({datasetIndex:o,index:a})=>{let l=this.getDatasetMeta(o);if(!l)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:l.data[a],index:a}});!si(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){let s=this.options.hover,o=(c,u)=>c.filter(f=>!u.some(d=>f.datasetIndex===d.datasetIndex&&f.index===d.index)),a=o(n,t),l=r?t:o(t,n);a.length&&this.updateHoverStyle(a,s.mode,!1),l.length&&s.mode&&this.updateHoverStyle(l,s.mode,!0)}_eventHandler(t,n){let r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;let o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){let{_active:s=[],options:o}=this,a=n,l=this._getActiveElements(t,s,r,a),c=fo(t),u=rd(t,this._lastEvent,r,c);r&&(this._lastEvent=null,K(o.onHover,[t,l,this],this),c&&K(o.onClick,[t,l,this],this));let f=!si(l,s);return(f||n)&&(this._active=l,this._updateHoverStyles(l,s,n)),this._lastEvent=u,f}_getActiveElements(t,n,r,s){if(t.type==="mouseout")return[];if(!r)return n;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}return i})();function fa(){return X(sd.instances,i=>i._plugins.invalidate())}function od(i,e,t){let{startAngle:n,pixelMargin:r,x:s,y:o,outerRadius:a,innerRadius:l}=e,c=r/a;i.beginPath(),i.arc(s,o,a,n-c,t+c),l>r?(c=r/l,i.arc(s,o,l,t+c,n-c,!0)):i.arc(s,o,r,t+st,n-st),i.closePath(),i.clip()}function ad(i){return Ki(i,["outerStart","outerEnd","innerStart","innerEnd"])}function ld(i,e,t,n){let r=ad(i.options.borderRadius),s=(t-e)/2,o=Math.min(s,n*e/2),a=l=>{let c=(t-Math.min(s,l))*n/2;return lt(l,0,Math.min(s,c))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:lt(r.innerStart,0,o),innerEnd:lt(r.innerEnd,0,o)}}function He(i,e,t,n){return{x:t+i*Math.cos(e),y:n+i*Math.sin(e)}}function mn(i,e,t,n,r,s){let{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=e,f=Math.max(e.outerRadius+n+t-c,0),d=u>0?u+n+t+c:0,h=0,m=r-l;if(n){let N=u>0?u-n:0,B=f>0?f-n:0,Q=(N+B)/2,yt=Q!==0?m*Q/(Q+n):m;h=(m-yt)/2}let p=Math.max(.001,m*f-t/tt)/f,g=(m-p)/2,b=l+g+h,x=r-g-h,{outerStart:w,outerEnd:k,innerStart:v,innerEnd:_}=ld(e,d,f,x-b),P=f-w,C=f-k,S=b+w/P,E=x-k/C,W=d+v,H=d+_,nt=b+v/W,ut=x-_/H;if(i.beginPath(),s){let N=(S+E)/2;if(i.arc(o,a,f,S,N),i.arc(o,a,f,N,E),k>0){let at=He(C,E,o,a);i.arc(at.x,at.y,k,E,x+st)}let B=He(H,x,o,a);if(i.lineTo(B.x,B.y),_>0){let at=He(H,ut,o,a);i.arc(at.x,at.y,_,x+st,ut+Math.PI)}let Q=(x-_/d+(b+v/d))/2;if(i.arc(o,a,d,x-_/d,Q,!0),i.arc(o,a,d,Q,b+v/d,!0),v>0){let at=He(W,nt,o,a);i.arc(at.x,at.y,v,nt+Math.PI,b-st)}let yt=He(P,b,o,a);if(i.lineTo(yt.x,yt.y),w>0){let at=He(P,S,o,a);i.arc(at.x,at.y,w,b-st,S)}}else{i.moveTo(o,a);let N=Math.cos(S)*f+o,B=Math.sin(S)*f+a;i.lineTo(N,B);let Q=Math.cos(E)*f+o,yt=Math.sin(E)*f+a;i.lineTo(Q,yt)}i.closePath()}function cd(i,e,t,n,r){let{fullCircles:s,startAngle:o,circumference:a}=e,l=e.endAngle;if(s){mn(i,e,t,n,l,r);for(let c=0;c<s;++c)i.fill();isNaN(a)||(l=o+(a%et||et))}return mn(i,e,t,n,l,r),i.fill(),l}function ud(i,e,t,n,r){let{fullCircles:s,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:u,borderDash:f,borderDashOffset:d}=l,h=l.borderAlign==="inner";if(!c)return;i.setLineDash(f||[]),i.lineDashOffset=d,h?(i.lineWidth=c*2,i.lineJoin=u||"round"):(i.lineWidth=c,i.lineJoin=u||"bevel");let m=e.endAngle;if(s){mn(i,e,t,n,m,r);for(let p=0;p<s;++p)i.stroke();isNaN(a)||(m=o+(a%et||et))}h&&od(i,e,m),s||(mn(i,e,t,n,m,r),i.stroke())}var ss=class extends It{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),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,t,n){let r=this.getProps(["x","y"],n),{angle:s,distance:o}=gr(r,{x:e,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),d=(this.options.spacing+this.options.borderWidth)/2,h=z(f,l-a),m=Fe(s,a,l)&&a!==l,p=h>=et||m,g=Wt(o,c+d,u+d);return p&&g}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:s,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:c}=this.options,u=(r+s)/2,f=(o+a+c+l)/2;return{x:t+Math.cos(u)*f,y:n+Math.sin(u)*f}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,s=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=n>et?Math.floor(n/et):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*r,Math.sin(a)*r);let l=1-Math.sin(Math.min(tt,n||0)),c=r*l;e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,cd(e,this,c,s,o),ud(e,this,c,s,o),e.restore()}};function Qa(i,e,t=e){i.lineCap=z(t.borderCapStyle,e.borderCapStyle),i.setLineDash(z(t.borderDash,e.borderDash)),i.lineDashOffset=z(t.borderDashOffset,e.borderDashOffset),i.lineJoin=z(t.borderJoinStyle,e.borderJoinStyle),i.lineWidth=z(t.borderWidth,e.borderWidth),i.strokeStyle=z(t.borderColor,e.borderColor)}function fd(i,e,t){i.lineTo(t.x,t.y)}function dd(i){return i.stepped?ko:i.tension||i.cubicInterpolationMode==="monotone"?Do:fd}function Ga(i,e,t={}){let n=i.length,{start:r=0,end:s=n-1}=t,{start:o,end:a}=e,l=Math.max(r,o),c=Math.min(s,a),u=r<o&&s<o||r>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!u?n+c-l:c-l}}function hd(i,e,t,n){let{points:r,options:s}=e,{count:o,start:a,loop:l,ilen:c}=Ga(r,t,n),u=dd(s),{move:f=!0,reverse:d}=n||{},h,m,p;for(h=0;h<=c;++h)m=r[(a+(d?c-h:h))%o],!m.skip&&(f?(i.moveTo(m.x,m.y),f=!1):u(i,p,m,d,s.stepped),p=m);return l&&(m=r[(a+(d?c:0))%o],u(i,p,m,d,s.stepped)),!!l}function md(i,e,t,n){let r=e.points,{count:s,start:o,ilen:a}=Ga(r,t,n),{move:l=!0,reverse:c}=n||{},u=0,f=0,d,h,m,p,g,b,x=k=>(o+(c?a-k:k))%s,w=()=>{p!==g&&(i.lineTo(u,g),i.lineTo(u,p),i.lineTo(u,b))};for(l&&(h=r[x(0)],i.moveTo(h.x,h.y)),d=0;d<=a;++d){if(h=r[x(d)],h.skip)continue;let k=h.x,v=h.y,_=k|0;_===m?(v<p?p=v:v>g&&(g=v),u=(f*u+k)/++f):(w(),i.lineTo(k,v),m=_,f=0,p=g=v),b=v}w()}function os(i){let e=i.options,t=e.borderDash&&e.borderDash.length;return!i._decimated&&!i._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?md:hd}function pd(i){return i.stepped?Ro:i.tension||i.cubicInterpolationMode==="monotone"?Eo:ie}function gd(i,e,t,n){let r=e._path;r||(r=e._path=new Path2D,e.path(r,t,n)&&r.closePath()),Qa(i,e.options),i.stroke(r)}function bd(i,e,t,n){let{segments:r,options:s}=e,o=os(e);for(let a of r)Qa(i,s,a.style),i.beginPath(),o(i,e,a,{start:t,end:t+n-1})&&i.closePath(),i.stroke()}var xd=typeof Path2D=="function";function vd(i,e,t,n){xd&&!e.options.segment?gd(i,e,t,n):bd(i,e,t,n)}var bn=(()=>{class i extends It{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};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,n){let r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){let s=r.spanGaps?this._loop:this._fullLoop;Ao(this._points,r,t,s,n),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=Wo(this,this.options.segment))}first(){let t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){let t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){let r=this.options,s=t[n],o=this.points,a=Wr(this,{property:n,start:s,end:s});if(!a.length)return;let l=[],c=pd(r),u,f;for(u=0,f=a.length;u<f;++u){let{start:d,end:h}=a[u],m=o[d],p=o[h];if(m===p){l.push(m);continue}let g=Math.abs((s-m[n])/(p[n]-m[n])),b=c(m,p,g,r.stepped);b[n]=t[n],l.push(b)}return l.length===1?l[0]:l}pathSegment(t,n,r){return os(this)(t,this,n,r)}path(t,n,r){let s=this.segments,o=os(this),a=this._loop;n=n||0,r=r||this.points.length-n;for(let l of s)a&=o(t,this,l,{start:n,end:n+r-1});return!!a}draw(t,n,r,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),vd(t,this,r,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}return i})();function da(i,e,t,n){let r=i.options,{[t]:s}=i.getProps([t],n);return Math.abs(e-s)<r.radius+r.hitRadius}var yd=(()=>{class i extends It{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,r){let s=this.options,{x:o,y:a}=this.getProps(["x","y"],r);return Math.pow(t-o,2)+Math.pow(n-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return da(this,t,"x",n)}inYRange(t,n){return da(this,t,"y",n)}getCenterPoint(t){let{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);let r=n&&t.borderWidth||0;return(n+r)*2}draw(t,n){let r=this.options;this.skip||r.radius<.1||!Et(this,n,this.size(r)/2)||(t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.fillStyle=r.backgroundColor,Gi(t,r,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}return i})();function Ka(i,e){let{x:t,y:n,base:r,width:s,height:o}=i.getProps(["x","y","base","width","height"],e),a,l,c,u,f;return i.horizontal?(f=o/2,a=Math.min(t,r),l=Math.max(t,r),c=n-f,u=n+f):(f=s/2,a=t-f,l=t+f,c=Math.min(n,r),u=Math.max(n,r)),{left:a,top:c,right:l,bottom:u}}function le(i,e,t,n){return i?0:lt(e,t,n)}function _d(i,e,t){let n=i.options.borderWidth,r=i.borderSkipped,s=Cr(n);return{t:le(r.top,s.top,0,t),r:le(r.right,s.right,0,e),b:le(r.bottom,s.bottom,0,t),l:le(r.left,s.left,0,e)}}function wd(i,e,t){let{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),r=i.options.borderRadius,s=oe(r),o=Math.min(e,t),a=i.borderSkipped,l=n||U(r);return{topLeft:le(!l||a.top||a.left,s.topLeft,0,o),topRight:le(!l||a.top||a.right,s.topRight,0,o),bottomLeft:le(!l||a.bottom||a.left,s.bottomLeft,0,o),bottomRight:le(!l||a.bottom||a.right,s.bottomRight,0,o)}}function Md(i){let e=Ka(i),t=e.right-e.left,n=e.bottom-e.top,r=_d(i,t/2,n/2),s=wd(i,t/2,n/2);return{outer:{x:e.left,y:e.top,w:t,h:n,radius:s},inner:{x:e.left+r.l,y:e.top+r.t,w:t-r.l-r.r,h:n-r.t-r.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,s.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(r.b,r.r))}}}}function jr(i,e,t,n){let r=e===null,s=t===null,a=i&&!(r&&s)&&Ka(i,n);return a&&(r||Wt(e,a.left,a.right))&&(s||Wt(t,a.top,a.bottom))}function kd(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Dd(i,e){i.rect(e.x,e.y,e.w,e.h)}function $r(i,e,t={}){let n=i.x!==t.x?-e:0,r=i.y!==t.y?-e:0,s=(i.x+i.w!==t.x+t.w?e:0)-n,o=(i.y+i.h!==t.y+t.h?e:0)-r;return{x:i.x+n,y:i.y+r,w:i.w+s,h:i.h+o,radius:i.radius}}var as=class extends It{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){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,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:s,outer:o}=Md(this),a=kd(o.radius)?Ne:Dd;e.save(),(o.w!==s.w||o.h!==s.h)&&(e.beginPath(),a(e,$r(o,t,s)),e.clip(),a(e,$r(s,-t,o)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,$r(s,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return jr(this,e,t,n)}inXRange(e,t){return jr(this,e,null,t)}inYRange(e,t){return jr(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:r,horizontal:s}=this.getProps(["x","y","base","horizontal"],e);return{x:s?(t+r)/2:t,y:s?n:(n+r)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}},Td=Object.freeze({__proto__:null,ArcElement:ss,BarElement:as,LineElement:bn,PointElement:yd}),ls=["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)"],ha=ls.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));function Za(i){return ls[i%ls.length]}function Ja(i){return ha[i%ha.length]}function Cd(i,e){return i.borderColor=Za(e),i.backgroundColor=Ja(e),++e}function Pd(i,e){return i.backgroundColor=i.data.map(()=>Za(e++)),e}function Sd(i,e){return i.backgroundColor=i.data.map(()=>Ja(e++)),e}function Od(i){let e=0;return(t,n)=>{let r=i.getDatasetMeta(n).controller;r instanceof gs?e=Pd(t,e):r instanceof Ha?e=Sd(t,e):r&&(e=Cd(t,e))}}function ma(i){let e;for(e in i)if(i[e].borderColor||i[e].backgroundColor)return!0;return!1}function Ad(i){return i&&(i.borderColor||i.backgroundColor)}function Id(){return it.borderColor!=="rgba(0,0,0,0.1)"||it.backgroundColor!=="rgba(0,0,0,0.1)"}var Ld={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,e,t){if(!t.enabled)return;let{data:{datasets:n},options:r}=i.config,{elements:s}=r,o=ma(n)||Ad(r)||s&&ma(s)||Id();if(!t.forceOverride&&o)return;let a=Od(i);n.forEach(a)}};function Rd(i,e,t,n,r){let s=r.samples||n;if(s>=t)return i.slice(e,e+t);let o=[],a=(t-2)/(s-2),l=0,c=e+t-1,u=e,f,d,h,m,p;for(o[l++]=i[u],f=0;f<s-2;f++){let g=0,b=0,x,w=Math.floor((f+1)*a)+1+e,k=Math.min(Math.floor((f+2)*a)+1,t)+e,v=k-w;for(x=w;x<k;x++)g+=i[x].x,b+=i[x].y;g/=v,b/=v;let _=Math.floor(f*a)+1+e,P=Math.min(Math.floor((f+1)*a)+1,t)+e,{x:C,y:S}=i[u];for(h=m=-1,x=_;x<P;x++)m=.5*Math.abs((C-g)*(i[x].y-S)-(C-i[x].x)*(b-S)),m>h&&(h=m,d=i[x],p=x);o[l++]=d,u=p}return o[l++]=i[c],o}function Ed(i,e,t,n){let r=0,s=0,o,a,l,c,u,f,d,h,m,p,g=[],b=e+t-1,x=i[e].x,k=i[b].x-x;for(o=e;o<e+t;++o){a=i[o],l=(a.x-x)/k*n,c=a.y;let v=l|0;if(v===u)c<m?(m=c,f=o):c>p&&(p=c,d=o),r=(s*r+a.x)/++s;else{let _=o-1;if(!q(f)&&!q(d)){let P=Math.min(f,d),C=Math.max(f,d);P!==h&&P!==_&&g.push(Ii(Ai({},i[P]),{x:r})),C!==h&&C!==_&&g.push(Ii(Ai({},i[C]),{x:r}))}o>0&&_!==h&&g.push(i[_]),g.push(a),u=v,s=0,m=p=c,f=d=h=o}}return g}function tl(i){if(i._decimated){let e=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function pa(i){i.data.datasets.forEach(e=>{tl(e)})}function Fd(i,e){let t=e.length,n=0,r,{iScale:s}=i,{min:o,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(n=lt(Rt(e,s.axis,o).lo,0,t-1)),c?r=lt(Rt(e,s.axis,a).hi+1,n,t)-n:r=t-n,{start:n,count:r}}var Wd={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,e,t)=>{if(!t.enabled){pa(i);return}let n=i.width;i.data.datasets.forEach((r,s)=>{let{_data:o,indexAxis:a}=r,l=i.getDatasetMeta(s),c=o||r.data;if(ze([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let u=i.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||i.options.parsing)return;let{start:f,count:d}=Fd(l,c),h=t.threshold||4*n;if(d<=h){tl(r);return}q(o)&&(r._data=c,delete r.data,Object.defineProperty(r,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let m;switch(t.algorithm){case"lttb":m=Rd(c,f,d,n,t);break;case"min-max":m=Ed(c,f,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}r._decimated=m})},destroy(i){pa(i)}};function Nd(i,e,t){let n=i.segments,r=i.points,s=e.points,o=[];for(let a of n){let{start:l,end:c}=a;c=xs(l,c,r);let u=cs(t,r[l],r[c],a.loop);if(!e.segments){o.push({source:a,target:u,start:r[l],end:r[c]});continue}let f=Wr(e,u);for(let d of f){let h=cs(t,s[d.start],s[d.end],d.loop),m=Fr(a,r,h);for(let p of m)o.push({source:p,target:d,start:{[t]:ga(u,h,"start",Math.max)},end:{[t]:ga(u,h,"end",Math.min)}})}}return o}function cs(i,e,t,n){if(n)return;let r=e[i],s=t[i];return i==="angle"&&(r=gt(r),s=gt(s)),{property:i,start:r,end:s}}function zd(i,e){let{x:t=null,y:n=null}=i||{},r=e.points,s=[];return e.segments.forEach(({start:o,end:a})=>{a=xs(o,a,r);let l=r[o],c=r[a];n!==null?(s.push({x:l.x,y:n}),s.push({x:c.x,y:n})):t!==null&&(s.push({x:t,y:l.y}),s.push({x:t,y:c.y}))}),s}function xs(i,e,t){for(;e>i;e--){let n=t[e];if(!isNaN(n.x)&&!isNaN(n.y))break}return e}function ga(i,e,t,n){return i&&e?n(i[t],e[t]):i?i[t]:e?e[t]:0}function el(i,e){let t=[],n=!1;return J(i)?(n=!0,t=i):t=zd(i,e),t.length?new bn({points:t,options:{tension:0},_loop:n,_fullLoop:n}):null}function ba(i){return i&&i.fill!==!1}function Hd(i,e,t){let r=i[e].fill,s=[e],o;if(!t)return r;for(;r!==!1&&s.indexOf(r)===-1;){if(!rt(r))return r;if(o=i[r],!o)return!1;if(o.visible)return r;s.push(r),r=o.fill}return!1}function Yd(i,e,t){let n=Vd(i);if(U(n))return isNaN(n.value)?!1:n;let r=parseFloat(n);return rt(r)&&Math.floor(r)===r?Bd(n[0],e,r,t):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Bd(i,e,t,n){return(i==="-"||i==="+")&&(t=e+t),t===e||t<0||t>=n?!1:t}function qd(i,e){let t=null;return i==="start"?t=e.bottom:i==="end"?t=e.top:U(i)?t=e.getPixelForValue(i.value):e.getBasePixel&&(t=e.getBasePixel()),t}function Ud(i,e,t){let n;return i==="start"?n=t:i==="end"?n=e.options.reverse?e.min:e.max:U(i)?n=i.value:n=e.getBaseValue(),n}function Vd(i){let e=i.options,t=e.fill,n=z(t&&t.target,t);return n===void 0&&(n=!!e.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function jd(i){let{scale:e,index:t,line:n}=i,r=[],s=n.segments,o=n.points,a=$d(e,t);a.push(el({x:null,y:e.bottom},n));for(let l=0;l<s.length;l++){let c=s[l];for(let u=c.start;u<=c.end;u++)Xd(r,o[u],a)}return new bn({points:r,options:{}})}function $d(i,e){let t=[],n=i.getMatchingVisibleMetas("line");for(let r=0;r<n.length;r++){let s=n[r];if(s.index===e)break;s.hidden||t.unshift(s.dataset)}return t}function Xd(i,e,t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],{first:o,last:a,point:l}=Qd(s,e,"x");if(!(!l||o&&a)){if(o)n.unshift(l);else if(i.push(l),!a)break}}i.push(...n)}function Qd(i,e,t){let n=i.interpolate(e,t);if(!n)return{};let r=n[t],s=i.segments,o=i.points,a=!1,l=!1;for(let c=0;c<s.length;c++){let u=s[c],f=o[u.start][t],d=o[u.end][t];if(Wt(r,f,d)){a=r===f,l=r===d;break}}return{first:a,last:l,point:n}}var pn=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,n){let{x:r,y:s,radius:o}=this;return t=t||{start:0,end:et},e.arc(r,s,o,t.end,t.start,!0),!n.bounds}interpolate(e){let{x:t,y:n,radius:r}=this,s=e.angle;return{x:t+Math.cos(s)*r,y:n+Math.sin(s)*r,angle:s}}};function Gd(i){let{chart:e,fill:t,line:n}=i;if(rt(t))return Kd(e,t);if(t==="stack")return jd(i);if(t==="shape")return!0;let r=Zd(i);return r instanceof pn?r:el(r,n)}function Kd(i,e){let t=i.getDatasetMeta(e);return t&&i.isDatasetVisible(e)?t.dataset:null}function Zd(i){return(i.scale||{}).getPointPositionForValue?th(i):Jd(i)}function Jd(i){let{scale:e={},fill:t}=i,n=qd(t,e);if(rt(n)){let r=e.isHorizontal();return{x:r?n:null,y:r?null:n}}return null}function th(i){let{scale:e,fill:t}=i,n=e.options,r=e.getLabels().length,s=n.reverse?e.max:e.min,o=Ud(t,e,s),a=[];if(n.grid.circular){let l=e.getPointPositionForValue(0,s);return new pn({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(o)})}for(let l=0;l<r;++l)a.push(e.getPointPositionForValue(l,o));return a}function Xr(i,e,t){let n=Gd(e),{chart:r,index:s,line:o,scale:a,axis:l}=e,c=o.options,u=c.fill,f=c.backgroundColor,{above:d=f,below:h=f}=u||{},m=r.getDatasetMeta(s),p=Nr(r,m);n&&o.points.length&&(ai(i,t),eh(i,{line:o,target:n,above:d,below:h,area:t,scale:a,axis:l,clip:p}),li(i))}function eh(i,e){let{line:t,target:n,above:r,below:s,area:o,scale:a,clip:l}=e,c=t._loop?"angle":e.axis;i.save(),c==="x"&&s!==r&&(xa(i,n,o.top),va(i,{line:t,target:n,color:r,scale:a,property:c,clip:l}),i.restore(),i.save(),xa(i,n,o.bottom)),va(i,{line:t,target:n,color:s,scale:a,property:c,clip:l}),i.restore()}function xa(i,e,t){let{segments:n,points:r}=e,s=!0,o=!1;i.beginPath();for(let a of n){let{start:l,end:c}=a,u=r[l],f=r[xs(l,c,r)];s?(i.moveTo(u.x,u.y),s=!1):(i.lineTo(u.x,t),i.lineTo(u.x,u.y)),o=!!e.pathSegment(i,a,{move:o}),o?i.closePath():i.lineTo(f.x,t)}i.lineTo(e.first().x,t),i.closePath(),i.clip()}function va(i,e){let{line:t,target:n,property:r,color:s,scale:o,clip:a}=e,l=Nd(t,n,r);for(let{source:c,target:u,start:f,end:d}of l){let{style:{backgroundColor:h=s}={}}=c,m=n!==!0;i.save(),i.fillStyle=h,ih(i,o,a,m&&cs(r,f,d)),i.beginPath();let p=!!t.pathSegment(i,c),g;if(m){p?i.closePath():ya(i,n,d,r);let b=!!n.pathSegment(i,u,{move:p,reverse:!0});g=p&&b,g||ya(i,n,f,r)}i.closePath(),i.fill(g?"evenodd":"nonzero"),i.restore()}}function ih(i,e,t,n){let r=e.chart.chartArea,{property:s,start:o,end:a}=n||{};if(s==="x"||s==="y"){let l,c,u,f;s==="x"?(l=o,c=r.top,u=a,f=r.bottom):(l=r.left,c=o,u=r.right,f=a),i.beginPath(),t&&(l=Math.max(l,t.left),u=Math.min(u,t.right),c=Math.max(c,t.top),f=Math.min(f,t.bottom)),i.rect(l,c,u-l,f-c),i.clip()}}function ya(i,e,t,n){let r=e.interpolate(t,n);r&&i.lineTo(r.x,r.y)}var nh={id:"filler",afterDatasetsUpdate(i,e,t){let n=(i.data.datasets||[]).length,r=[],s,o,a,l;for(o=0;o<n;++o)s=i.getDatasetMeta(o),a=s.dataset,l=null,a&&a.options&&a instanceof bn&&(l={visible:i.isDatasetVisible(o),index:o,fill:Yd(a,o,n),chart:i,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,r.push(l);for(o=0;o<n;++o)l=r[o],!(!l||l.fill===!1)&&(l.fill=Hd(r,o,t.propagate))},beforeDraw(i,e,t){let n=t.drawTime==="beforeDraw",r=i.getSortedVisibleDatasetMetas(),s=i.chartArea;for(let o=r.length-1;o>=0;--o){let a=r[o].$filler;a&&(a.line.updateControlPoints(s,a.axis),n&&a.fill&&Xr(i.ctx,a,s))}},beforeDatasetsDraw(i,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;let n=i.getSortedVisibleDatasetMetas();for(let r=n.length-1;r>=0;--r){let s=n[r].$filler;ba(s)&&Xr(i.ctx,s,i.chartArea)}},beforeDatasetDraw(i,e,t){let n=e.meta.$filler;!ba(n)||t.drawTime!=="beforeDatasetDraw"||Xr(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},_a=(i,e)=>{let{boxHeight:t=e,boxWidth:n=e}=i;return i.usePointStyle&&(t=Math.min(t,e),n=i.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:t,itemHeight:Math.max(e,t)}},rh=(i,e)=>i!==null&&e!==null&&i.datasetIndex===e.datasetIndex&&i.index===e.index,gn=class extends It{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,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(){let e=this.options.labels||{},t=K(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(n=>e.filter(n,this.chart.data))),e.sort&&(t=t.sort((n,r)=>e.sort(n,r,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,r=ot(n.font),s=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=_a(n,s),c,u;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,s,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,r,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:s,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=r+a,f=e;s.textAlign="left",s.textBaseline="middle";let d=-1,h=-u;return this.legendItems.forEach((m,p)=>{let g=n+t/2+s.measureText(m.text).width;(p===0||c[c.length-1]+g+2*a>o)&&(f+=u,c[c.length-(p>0?0:1)]=0,h+=u,d++),l[p]={left:0,top:h,row:d,width:g,height:r},c[c.length-1]+=g+a}),f}_fitCols(e,t,n,r){let{ctx:s,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-e,f=a,d=0,h=0,m=0,p=0;return this.legendItems.forEach((g,b)=>{let{itemWidth:x,itemHeight:w}=sh(n,t,s,g,r);b>0&&h+w+2*a>u&&(f+=d+a,c.push({width:d,height:h}),m+=d+a,p++,d=h=0),l[b]={left:m,top:h,col:p,width:x,height:w},d=Math.max(d,x),h+=w+a}),f+=d,c.push({width:d,height:h}),f}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:s}}=this,o=be(s,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(n,this.left+r,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,l=ft(n,this.left+r,this.right-this.lineWidths[a])),c.top+=this.top+e+r,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+r}else{let a=0,l=ft(n,this.top+e+r,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,l=ft(n,this.top+e+r,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+r,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let e=this.ctx;ai(e,this),this._draw(),li(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:s,labels:o}=e,a=it.color,l=be(e.rtl,this.left,this.width),c=ot(o.font),{padding:u}=o,f=c.size,d=f/2,h;this.drawTitle(),r.textAlign=l.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=c.string;let{boxWidth:m,boxHeight:p,itemHeight:g}=_a(o,f),b=function(_,P,C){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;r.save();let S=z(C.lineWidth,1);if(r.fillStyle=z(C.fillStyle,a),r.lineCap=z(C.lineCap,"butt"),r.lineDashOffset=z(C.lineDashOffset,0),r.lineJoin=z(C.lineJoin,"miter"),r.lineWidth=S,r.strokeStyle=z(C.strokeStyle,a),r.setLineDash(z(C.lineDash,[])),o.usePointStyle){let E={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:S},W=l.xPlus(_,m/2),H=P+d;Tr(r,E,W,H,o.pointStyleWidth&&m)}else{let E=P+Math.max((f-p)/2,0),W=l.leftForLtr(_,m),H=oe(C.borderRadius);r.beginPath(),Object.values(H).some(nt=>nt!==0)?Ne(r,{x:W,y:E,w:m,h:p,radius:H}):r.rect(W,E,m,p),r.fill(),S!==0&&r.stroke()}r.restore()},x=function(_,P,C){se(r,C.text,_,P+g/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},w=this.isHorizontal(),k=this._computeTitleHeight();w?h={x:ft(s,this.left+u,this.right-n[0]),y:this.top+u+k,line:0}:h={x:this.left+u,y:ft(s,this.top+k+u,this.bottom-t[0].height),line:0},Rr(this.ctx,e.textDirection);let v=g+u;this.legendItems.forEach((_,P)=>{r.strokeStyle=_.fontColor,r.fillStyle=_.fontColor;let C=r.measureText(_.text).width,S=l.textAlign(_.textAlign||(_.textAlign=o.textAlign)),E=m+d+C,W=h.x,H=h.y;l.setWidth(this.width),w?P>0&&W+E+u>this.right&&(H=h.y+=v,h.line++,W=h.x=ft(s,this.left+u,this.right-n[h.line])):P>0&&H+v>this.bottom&&(W=h.x=W+t[h.line].width+u,h.line++,H=h.y=ft(s,this.top+k+u,this.bottom-t[h.line].height));let nt=l.x(W);if(b(nt,H,_),W=_o(S,W+m+d,w?W+E:this.right,e.rtl),x(l.x(W),H,_),w)h.x+=E+u;else if(typeof _.text!="string"){let ut=c.lineHeight;h.y+=il(_,ut)+u}else h.y+=v}),Er(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=ot(t.font),r=dt(t.padding);if(!t.display)return;let s=be(e.rtl,this.left,this.width),o=this.ctx,a=t.position,l=n.size/2,c=r.top+l,u,f=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,f=ft(e.align,f,this.right-d);else{let m=this.columnSizes.reduce((p,g)=>Math.max(p,g.height),0);u=c+ft(e.align,this.top,this.bottom-m-e.labels.padding-this._computeTitleHeight())}let h=ft(a,f,f+d);o.textAlign=s.textAlign(Xi(a)),o.textBaseline="middle",o.strokeStyle=t.color,o.fillStyle=t.color,o.font=n.string,se(o,t.text,h,u,n)}_computeTitleHeight(){let e=this.options.title,t=ot(e.font),n=dt(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,s;if(Wt(e,this.left,this.right)&&Wt(t,this.top,this.bottom)){for(s=this.legendHitBoxes,n=0;n<s.length;++n)if(r=s[n],Wt(e,r.left,r.left+r.width)&&Wt(t,r.top,r.top+r.height))return this.legendItems[n]}return null}handleEvent(e){let t=this.options;if(!lh(e.type,t))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){let r=this._hoveredItem,s=rh(r,n);r&&!s&&K(t.onLeave,[e,r,this],this),this._hoveredItem=n,n&&!s&&K(t.onHover,[e,n,this],this)}else n&&K(t.onClick,[e,n,this],this)}};function sh(i,e,t,n,r){let s=oh(n,i,e,t),o=ah(r,n,e.lineHeight);return{itemWidth:s,itemHeight:o}}function oh(i,e,t,n){let r=i.text;return r&&typeof r!="string"&&(r=r.reduce((s,o)=>s.length>o.length?s:o)),e+t.size/2+n.measureText(r).width}function ah(i,e,t){let n=i;return typeof e.text!="string"&&(n=il(e,t)),n}function il(i,e){let t=i.text?i.text.length:0;return e*t}function lh(i,e){return!!((i==="mousemove"||i==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(i==="click"||i==="mouseup"))}var ch={id:"legend",_element:gn,start(i,e,t){let n=i.legend=new gn({ctx:i.ctx,options:t,chart:i});ht.configure(i,n,t),ht.addBox(i,n)},stop(i){ht.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,e,t){let n=i.legend;ht.configure(i,n,t),n.options=t},afterUpdate(i){let e=i.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(i,e){e.replay||i.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,e,t){let n=e.datasetIndex,r=t.chart;r.isDatasetVisible(n)?(r.hide(n),e.hidden=!0):(r.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){let e=i.data.datasets,{labels:{usePointStyle:t,pointStyle:n,textAlign:r,color:s,useBorderRadius:o,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),u=dt(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:s,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:n||c.pointStyle,rotation:c.rotation,textAlign:r||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}},bi=class extends It{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=J(n.text)?n.text.length:1;this._padding=dt(n.padding);let s=r*ot(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){let e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){let{top:t,left:n,bottom:r,right:s,options:o}=this,a=o.align,l=0,c,u,f;return this.isHorizontal()?(u=ft(a,n,s),f=t+e,c=s-n):(o.position==="left"?(u=n+e,f=ft(a,r,t),l=tt*-.5):(u=s-e,f=ft(a,t,r),l=tt*.5),c=r-t),{titleX:u,titleY:f,maxWidth:c,rotation:l}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=ot(t.font),s=n.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(s);se(e,t.text,0,0,n,{color:t.color,maxWidth:l,rotation:c,textAlign:Xi(t.align),textBaseline:"middle",translation:[o,a]})}};function uh(i,e){let t=new bi({ctx:i.ctx,options:e,chart:i});ht.configure(i,t,e),ht.addBox(i,t),i.titleBlock=t}var fh={id:"title",_element:bi,start(i,e,t){uh(i,t)},stop(i){let e=i.titleBlock;ht.removeBox(i,e),delete i.titleBlock},beforeUpdate(i,e,t){let n=i.titleBlock;ht.configure(i,n,t),n.options=t},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}},on=new WeakMap,dh={id:"subtitle",start(i,e,t){let n=new bi({ctx:i.ctx,options:t,chart:i});ht.configure(i,n,t),ht.addBox(i,n),on.set(i,n)},stop(i){ht.removeBox(i,on.get(i)),on.delete(i)},beforeUpdate(i,e,t){let n=on.get(i);ht.configure(i,n,t),n.options=t},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}},pi={average(i){if(!i.length)return!1;let e,t,n=new Set,r=0,s=0;for(e=0,t=i.length;e<t;++e){let a=i[e].element;if(a&&a.hasValue()){let l=a.tooltipPosition();n.add(l.x),r+=l.y,++s}}return s===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:r/s}},nearest(i,e){if(!i.length)return!1;let t=e.x,n=e.y,r=Number.POSITIVE_INFINITY,s,o,a;for(s=0,o=i.length;s<o;++s){let l=i[s].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),u=qi(e,c);u<r&&(r=u,a=l)}}if(a){let l=a.tooltipPosition();t=l.x,n=l.y}return{x:t,y:n}}};function Nt(i,e){return e&&(J(e)?Array.prototype.push.apply(i,e):i.push(e)),i}function Xt(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
4
4
|
`)>-1?i.split(`
|