From f2a632c3ea458edb53c4aa4f6f6ef6a590a6f499 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2026 18:41:03 +0000 Subject: [PATCH] Update chart.js to version 4.6.1 --- config/importmap.rb | 4 ++-- vendor/javascript/@kurkle--color.js | 8 +------- vendor/javascript/chart.js.js | 11 +++++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 vendor/javascript/chart.js.js diff --git a/config/importmap.rb b/config/importmap.rb index f51a08638..8bef69e1a 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -42,7 +42,7 @@ # Elevation chart # from https://esm.sh/chart.js@4.5.0/es2022/chart.bundle.mjs -pin "chart.js", to: "chart-js.js", preload: false # @4.5.1 +pin "chart.js", to: "chart-js.js", preload: false # @4.6.1 # render markdown pin "marked", preload: "map" # @18.1.1 @@ -74,7 +74,7 @@ pin "sortablejs", preload: false # @1.15.7 # Extract coords from uploaded images pin "exif-reader", preload: false # @2.3.0 -pin "@kurkle/color", to: "@kurkle--color.js", preload: false # @0.6.4 +pin "@kurkle/color", to: "@kurkle--color.js", preload: false # @0.3.4 # https://turfjs.org/ # Turf libs needed by mapbox-gl-draw diff --git a/vendor/javascript/@kurkle--color.js b/vendor/javascript/@kurkle--color.js index 43c066978..c10b4da78 100644 --- a/vendor/javascript/@kurkle--color.js +++ b/vendor/javascript/@kurkle--color.js @@ -1,8 +1,2 @@ -/*! -* @kurkle/color v0.6.4 -* https://github.com/kurkle/color#readme -* (c) 2026 Jukka Kurkela -* Released under the MIT License -*/ -function e(e){return e+.5|0}var t=(e,t,n)=>Math.max(Math.min(e,n),t);function n(n){return t(e(n*2.55),0,255)}function r(n){return t(e(n/2.55),0,100)}function i(n){return t(e(n*255),0,255)}function a(n){return t(e(n/2.55)/100,0,1)}function o(n){return t(e(n*100),0,100)}function s(e,t){if(e===void 0)return 255;let r=e===`none`?0:+e;return t?n(r):i(r)}var c={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,a:10,B:11,b:11,C:12,c:12,D:13,d:13,E:14,e:14,F:15,f:15},l=[...`0123456789ABCDEF`],u=e=>l[e&15],d=e=>l[(e&240)>>4]+l[e&15],f=e=>(e&240)>>4==(e&15),p=e=>f(e.r)&&f(e.g)&&f(e.b)&&f(e.a);function m(e){if(e[0]!==`#`)return;let t=e.length;if(t===4||t===5)return{a:t===5?c[e[4]]<<4|c[e[4]]:255,b:c[e[3]]<<4|c[e[3]],g:c[e[2]]<<4|c[e[2]],r:c[e[1]]<<4|c[e[1]]};if(t===7||t===9)return{a:t===9?c[e[7]]<<4|c[e[8]]:255,b:c[e[5]]<<4|c[e[6]],g:c[e[3]]<<4|c[e[4]],r:c[e[1]]<<4|c[e[2]]}}var h=(e,t)=>e<255?t(e):``;function g(e){let t=e&&p(e)?u:d;return e?`#${t(e.r)}${t(e.g)}${t(e.b)}${h(e.a,t)}`:void 0}var _=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function v(e,t,n){let r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[i(0),i(8),i(4)]}function y(e,t,n){let r=(r,i=(r+e/60)%6)=>n-n*t*Math.max(Math.min(i,4-i,1),0);return[r(5),r(3),r(1)]}function b(e,t,n){let r=v(e,1,.5),i;for(t+n>1&&(i=1/(t+n),t*=i,n*=i),i=0;i<3;i++)r[i]*=1-t-n,r[i]+=t;return r}function x(e,t,n,r,i){return e===i?(t-n)/r+(t.5?u/(2-a-o):u/(a+o),c=x(n,r,i,u,a),c=c*60+.5),[c|0,l||0,s]}function C(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(i)}function w(e,t,n){return C(v,e,t,n)}function T(e,t,n){return C(b,e,t,n)}function E(e,t,n){return C(y,e,t,n)}function D(e){return(e%360+360)%360}function O(e){let t=_.exec(e),n;if(!t)return;let r=s(t[5],t[6]),i=D(+t[2]),a=t[3]/100,o=t[4]/100;return n=t[1]===`hwb`?T(i,a,o):t[1]===`hsv`?E(i,a,o):w(i,a,o),{a:r,b:n[2],g:n[1],r:n[0]}}function k(e,t){let n=S(e),r=v(D(n[0]+t),n[1],n[2]);e.r=i(r[0]),e.g=i(r[1]),e.b=i(r[2])}function A(e){if(!e)return;let t=S(e),n=t[0],r=o(t[1]),i=o(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${i}%, ${a(e.a)})`:`hsl(${n}, ${r}%, ${i}%)`}var j=`alicebluef0f8ff antiquewhitefaebd7 aqua00ffff aquamarine7fffd4 azuref0ffff beigef5f5dc bisqueffe4c4 black000000 blanchedalmondffebcd blue0000ff blueviolet8a2be2 browna52a2a burlywooddeb887 cadetblue5f9ea0 chartreuse7fff00 chocolated2691e coralff7f50 cornflowerblue6495ed cornsilkfff8dc crimsondc143c cyan00ffff darkblue00008b darkcyan008b8b darkgoldenrodb8860b darkgraya9a9a9 darkgreen006400 darkgreya9a9a9 darkkhakibdb76b darkmagenta8b008b darkolivegreen556b2f darkorangeff8c00 darkorchid9932cc darkred8b0000 darksalmone9967a darkseagreen8fbc8f darkslateblue483d8b darkslategray2f4f4f darkslategrey2f4f4f darkturquoise00ced1 darkviolet9400d3 deeppinkff1493 deepskyblue00bfff dimgray696969 dimgrey696969 dodgerblue1e90ff firebrickb22222 floralwhitefffaf0 forestgreen228b22 fuchsiaff00ff gainsborodcdcdc ghostwhitef8f8ff goldffd700 goldenroddaa520 gray808080 green008000 greenyellowadff2f grey808080 honeydewf0fff0 hotpinkff69b4 indianredcd5c5c indigo4b0082 ivoryfffff0 khakif0e68c lavendere6e6fa lavenderblushfff0f5 lawngreen7cfc00 lemonchiffonfffacd lightblueadd8e6 lightcoralf08080 lightcyane0ffff lightgoldenrodyellowfafad2 lightgrayd3d3d3 lightgreen90ee90 lightgreyd3d3d3 lightpinkffb6c1 lightsalmonffa07a lightseagreen20b2aa lightskyblue87cefa lightslategray778899 lightslategrey778899 lightsteelblueb0c4de lightyellowffffe0 lime00ff00 limegreen32cd32 linenfaf0e6 magentaff00ff maroon800000 mediumaquamarine66cdaa mediumblue0000cd mediumorchidba55d3 mediumpurple9370db mediumseagreen3cb371 mediumslateblue7b68ee mediumspringgreen00fa9a mediumturquoise48d1cc mediumvioletredc71585 midnightblue191970 mintcreamf5fffa mistyroseffe4e1 moccasinffe4b5 navajowhiteffdead navy000080 oldlacefdf5e6 olive808000 olivedrab6b8e23 orangeffa500 orangeredff4500 orchidda70d6 palegoldenrodeee8aa palegreen98fb98 paleturquoiseafeeee palevioletreddb7093 papayawhipffefd5 peachpuffffdab9 perucd853f pinkffc0cb plumdda0dd powderblueb0e0e6 purple800080 rebeccapurple663399 redff0000 rosybrownbc8f8f royalblue4169e1 saddlebrown8b4513 salmonfa8072 sandybrownf4a460 seagreen2e8b57 seashellfff5ee siennaa0522d silverc0c0c0 skyblue87ceeb slateblue6a5acd slategray708090 slategrey708090 snowfffafa springgreen00ff7f steelblue4682b4 tand2b48c teal008080 thistled8bfd8 tomatoff6347 turquoise40e0d0 violetee82ee wheatf5deb3 whiteffffff whitesmokef5f5f5 yellowffff00 yellowgreen9acd32`;function ee(){let e={};for(let t of j.split(` `)){let n=parseInt(t.slice(-6),16);e[t.slice(0,-6)]=[n>>16&255,n>>8&255,n&255]}return e}var M;function N(e){M||(M=ee(),M.transparent=[0,0,0,0]);let t=M[e.toLowerCase()];return t&&{a:t.length===4?t[3]:255,b:t[2],g:t[1],r:t[0]}}function P(e){return e<=.0031308?e*12.92:e**(1/2.4)*1.055-.055}function F(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function I(e,t,n){let r=F(a(e.r)),o=F(a(e.g)),s=F(a(e.b));return{a:e.a+n*(t.a-e.a),b:i(P(s+n*(F(a(t.b))-s))),g:i(P(o+n*(F(a(t.g))-o))),r:i(P(r+n*(F(a(t.r))-r)))}}var L=/^oklch\(\s*([-+.e\d]+|none)(%)?[\s,]+([-+.e\d]+|none)(%)?[\s,]+([-+.e\d]+|none)(deg|rad|grad|turn)?(?:[\s,/]+([-+.e\d]+|none)(%)?)?\s*\)$/,R={deg:1,grad:.9,rad:180/Math.PI,turn:360};function z(e,t,n){let r=F(e/255),i=F(t/255),a=F(n/255),o=Math.cbrt(.4122214708*r+.5363325363*i+.0514459929*a),s=Math.cbrt(.2119034982*r+.6806995451*i+.1073969566*a),c=Math.cbrt(.0883024619*r+.2817188376*i+.6299787005*a);return[.2104542553*o+.793617785*s-.0040720468*c,1.9779984951*o-2.428592205*s+.4505937099*c,.0259040371*o+.7827717662*s-.808675766*c]}function B(e,t,n){let r=e+.3963377774*t+.2158037573*n,i=e-.1055613458*t-.0638541728*n,a=e-.0894841775*t-1.291485548*n,o=r*r*r,s=i*i*i,c=a*a*a;return[P(4.0767416621*o-3.3077115913*s+.2309699292*c),P(-1.2684380046*o+2.6097574011*s-.3413193965*c),P(-.0041960863*o-.7034186147*s+1.707614701*c)]}function V(e){let[t,n,r]=z(e.r,e.g,e.b),i=Math.hypot(n,r),a=0;return i>=1e-4&&(a=Math.atan2(r,n)*180/Math.PI,a<0&&(a+=360)),[t,i,a]}function H(e,t,n){let r,a,o;Array.isArray(e)?(r=e[0],a=e[1],o=e[2]):(r=e,a=t,o=n);let s=o*Math.PI/180,c=B(r,a*Math.cos(s),a*Math.sin(s));return c[0]=i(c[0]),c[1]=i(c[1]),c[2]=i(c[2]),c}function U(e){return e===`none`?0:+e}function W(e){let n=L.exec(e);if(!n)return;let r=U(n[1]),i=t(n[2]?r/100:r,0,1),a=U(n[3]),o=Math.max(n[4]?a/100*.4:a,0),c=U(n[5])*(n[6]?R[n[6]]:1),l=s(n[7],!!n[8]),u=H(i,o,c);return{a:l,b:u[2],g:u[1],r:u[0]}}function G(e){if(!e)return;let[t,n,r]=V(e),i=Math.round(t*1e4)/1e4,o=Math.round(n*1e4)/1e4,s=Math.round(r*100)/100;return e.a<255?`oklch(${i} ${o} ${s} / ${a(e.a)})`:`oklch(${i} ${o} ${s})`}var K=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function q(e){let r=K.exec(e),i=255,a,o,s;if(r){if(r[7]!==void 0){let e=+r[7];i=r[8]?n(e):t(e*255,0,255)}return a=+r[1],o=+r[3],s=+r[5],a=255&(r[2]?n(a):t(a,0,255)),o=255&(r[4]?n(o):t(o,0,255)),s=255&(r[6]?n(s):t(s,0,255)),{a:i,b:s,g:o,r:a}}}function J(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${a(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var Y=/\/\*[\s\S]*?\*\//g;function X(e,t,n){if(e){let r=S(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,t===0?360:1));let a=v(r[0],r[1],r[2]);e.r=i(a[0]),e.g=i(a[1]),e.b=i(a[2])}}function Z(e,t){return e&&Object.assign(t||{},e)}function Q(e){let t={a:255,b:0,g:0,r:0};return Array.isArray(e)?e.length>=3&&(t={a:255,b:e[2],g:e[1],r:e[0]},e.length>3&&(t.a=i(e[3]))):(t=Z(e,{a:1,b:0,g:0,r:0}),t.a=i(t.a)),t}function te(e){let t=(e.indexOf(`/*`)===-1?e:e.replace(Y,``)).trim(),n=t.charAt(0);return n===`r`?q(t):n===`o`?W(t):O(t)}var $=class _Color{constructor(e){if(e instanceof _Color)return e;let t=typeof e,n;t===`object`?n=Q(e):t===`string`&&(n=m(e)||N(e)||te(e)),this.h=n,this.i=!!n}get valid(){return this.i}get rgb(){let e=Z(this.h);return e&&(e.a=a(e.a)),e}set rgb(e){this.h=Q(e)}rgbString(){return this.i?J(this.h):void 0}hexString(){return this.i?g(this.h):void 0}hslString(){return this.i?A(this.h):void 0}oklchString(){return this.i?G(this.h):void 0}mix(e,t=.5){if(e){let n=this.h,r=e.h,o=a(n.a),s=a(r.a),c=2*t-1,l=o-s,u=((c*l===-1?c:(c+l)/(1+c*l))+1)/2,d=1-u;n.r=255&u*n.r+d*r.r+.5,n.g=255&u*n.g+d*r.g+.5,n.b=255&u*n.b+d*r.b+.5,n.a=i(t*o+(1-t)*s)}return this}interpolate(e,t){return e&&(this.h=I(this.h,e.h,t)),this}clone(){return new _Color(this.rgb)}alpha(e){return this.h.a=i(e),this}clearer(e){let t=this.h;return t.a*=1-e,this}greyscale(){let t=this.h;return t.r=t.g=t.b=e(t.r*.3+t.g*.59+t.b*.11),this}opaquer(e){let t=this.h;return t.a*=1+e,this}negate(){let e=this.h;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return X(this.h,2,e),this}darken(e){return X(this.h,2,-e),this}saturate(e){return X(this.h,1,e),this}desaturate(e){return X(this.h,1,-e),this}rotate(e){return k(this.h,e),this}};function ne(e){return new $(e)}export{$ as Color,a as b2n,r as b2p,ne as default,m as hexParse,g as hexString,w as hsl2rgb,v as hsl2rgbn,A as hslString,E as hsv2rgb,O as hueParse,T as hwb2rgb,I as interpolate,t as lim,P as linear2srgb,i as n2b,o as n2p,N as nameParse,H as oklch2rgb,W as oklchParse,G as oklchString,n as p2b,s as parseAlpha,S as rgb2hsl,V as rgb2oklch,q as rgbParse,J as rgbString,k as rotate,e as round,F as srgb2linear}; +function round(n){return n+.5|0}const lim=(n,e,t)=>Math.max(Math.min(n,t),e);function p2b(n){return lim(round(n*2.55),0,255)}function b2p(n){return lim(round(n/2.55),0,100)}function n2b(n){return lim(round(n*255),0,255)}function b2n(n){return lim(round(n/2.55)/100,0,1)}function n2p(n){return lim(round(n*100),0,100)}const n={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};const e=[..."0123456789ABCDEF"];const h1=n=>e[n&15];const h2=n=>e[(n&240)>>4]+e[n&15];const eq=n=>(n&240)>>4===(n&15);const isShort=n=>eq(n.r)&&eq(n.g)&&eq(n.b)&&eq(n.a);function hexParse(e){var t=e.length;var r;e[0]==="#"&&(t===4||t===5?r={r:255&n[e[1]]*17,g:255&n[e[2]]*17,b:255&n[e[3]]*17,a:t===5?n[e[4]]*17:255}:t!==7&&t!==9||(r={r:n[e[1]]<<4|n[e[2]],g:n[e[3]]<<4|n[e[4]],b:n[e[5]]<<4|n[e[6]],a:t===9?n[e[7]]<<4|n[e[8]]:255}));return r}const alpha=(n,e)=>n<255?e(n):"";function hexString(n){var e=isShort(n)?h1:h2;return n?"#"+e(n.r)+e(n.g)+e(n.b)+alpha(n.a,e):void 0}const t=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function hsl2rgbn(n,e,t){const r=e*Math.min(t,1-t);const f=(e,a=(e+n/30)%12)=>t-r*Math.max(Math.min(a-3,9-a,1),-1);return[f(0),f(8),f(4)]}function hsv2rgbn(n,e,t){const f=(r,a=(r+n/60)%6)=>t-t*e*Math.max(Math.min(a,4-a,1),0);return[f(5),f(3),f(1)]}function hwb2rgbn(n,e,t){const r=hsl2rgbn(n,1,.5);let a;if(e+t>1){a=1/(e+t);e*=a;t*=a}for(a=0;a<3;a++){r[a]*=1-e-t;r[a]+=e}return r}function hueValue(n,e,t,r,a){return n===a?(e-t)/r+(e.5?g/(2-s-b):g/(s+b);o=hueValue(t,r,a,g,s);o=o*60+.5}return[o|0,i||0,c]}function calln(n,e,t,r){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,r)).map(n2b)}function hsl2rgb(n,e,t){return calln(hsl2rgbn,n,e,t)}function hwb2rgb(n,e,t){return calln(hwb2rgbn,n,e,t)}function hsv2rgb(n,e,t){return calln(hsv2rgbn,n,e,t)}function hue(n){return(n%360+360)%360}function hueParse(n){const e=t.exec(n);let r=255;let a;if(!e)return;e[5]!==a&&(r=e[6]?p2b(+e[5]):n2b(+e[5]));const s=hue(+e[2]);const b=+e[3]/100;const c=+e[4]/100;a=e[1]==="hwb"?hwb2rgb(s,b,c):e[1]==="hsv"?hsv2rgb(s,b,c):hsl2rgb(s,b,c);return{r:a[0],g:a[1],b:a[2],a:r}}function rotate(n,e){var t=rgb2hsl(n);t[0]=hue(t[0]+e);t=hsl2rgb(t);n.r=t[0];n.g=t[1];n.b=t[2]}function hslString(n){if(!n)return;const e=rgb2hsl(n);const t=e[0];const r=n2p(e[1]);const a=n2p(e[2]);return n.a<255?`hsla(${t}, ${r}%, ${a}%, ${b2n(n.a)})`:`hsl(${t}, ${r}%, ${a}%)`}const r={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"};const a={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 unpack(){const n={};const e=Object.keys(a);const t=Object.keys(r);let s,b,c,o,i;for(s=0;s>16&255,c>>8&255,c&255]}return n}let s;function nameParse(n){if(!s){s=unpack();s.transparent=[0,0,0,0]}const e=s[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const b=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(n){const e=b.exec(n);let t=255;let r,a,s;if(e){if(e[7]!==r){const n=+e[7];t=e[8]?p2b(n):lim(n*255,0,255)}r=+e[1];a=+e[3];s=+e[5];r=255&(e[2]?p2b(r):lim(r,0,255));a=255&(e[4]?p2b(a):lim(a,0,255));s=255&(e[6]?p2b(s):lim(s,0,255));return{r:r,g:a,b:s,a:t}}}function rgbString(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${b2n(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const to=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055;const from=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function interpolate(n,e,t){const r=from(b2n(n.r));const a=from(b2n(n.g));const s=from(b2n(n.b));return{r:n2b(to(r+t*(from(b2n(e.r))-r))),g:n2b(to(a+t*(from(b2n(e.g))-a))),b:n2b(to(s+t*(from(b2n(e.b))-s))),a:n.a+t*(e.a-n.a)}}function modHSL(n,e,t){if(n){let r=rgb2hsl(n);r[e]=Math.max(0,Math.min(r[e]+r[e]*t,e===0?360:1));r=hsl2rgb(r);n.r=r[0];n.g=r[1];n.b=r[2]}}function clone(n,e){return n?Object.assign(e||{},n):n}function fromObject(n){var e={r:0,g:0,b:0,a:255};if(Array.isArray(n)){if(n.length>=3){e={r:n[0],g:n[1],b:n[2],a:255};n.length>3&&(e.a=n2b(n[3]))}}else{e=clone(n,{r:0,g:0,b:0,a:1});e.a=n2b(e.a)}return e}function functionParse(n){return n.charAt(0)==="r"?rgbParse(n):hueParse(n)}class Color{constructor(n){if(n instanceof Color)return n;const e=typeof n;let t;e==="object"?t=fromObject(n):e==="string"&&(t=hexParse(n)||nameParse(n)||functionParse(n));this._rgb=t;this._valid=!!t}get valid(){return this._valid}get rgb(){var n=clone(this._rgb);n&&(n.a=b2n(n.a));return n}set rgb(n){this._rgb=fromObject(n)}rgbString(){return this._valid?rgbString(this._rgb):void 0}hexString(){return this._valid?hexString(this._rgb):void 0}hslString(){return this._valid?hslString(this._rgb):void 0}mix(n,e){if(n){const t=this.rgb;const r=n.rgb;let a;const s=e===a?.5:e;const b=2*s-1;const c=t.a-r.a;const o=((b*c===-1?b:(b+c)/(1+b*c))+1)/2;a=1-o;t.r=255&o*t.r+a*r.r+.5;t.g=255&o*t.g+a*r.g+.5;t.b=255&o*t.b+a*r.b+.5;t.a=s*t.a+(1-s)*r.a;this.rgb=t}return this}interpolate(n,e){n&&(this._rgb=interpolate(this._rgb,n._rgb,e));return this}clone(){return new Color(this.rgb)}alpha(n){this._rgb.a=n2b(n);return this}clearer(n){const e=this._rgb;e.a*=1-n;return this}greyscale(){const n=this._rgb;const e=round(n.r*.3+n.g*.59+n.b*.11);n.r=n.g=n.b=e;return this}opaquer(n){const e=this._rgb;e.a*=1+n;return this}negate(){const n=this._rgb;n.r=255-n.r;n.g=255-n.g;n.b=255-n.b;return this}lighten(n){modHSL(this._rgb,2,n);return this}darken(n){modHSL(this._rgb,2,-n);return this}saturate(n){modHSL(this._rgb,1,n);return this}desaturate(n){modHSL(this._rgb,1,-n);return this}rotate(n){rotate(this._rgb,n);return this}}function index_esm(n){return new Color(n)}export{Color,b2n,b2p,index_esm as default,hexParse,hexString,hsl2rgb,hslString,hsv2rgb,hueParse,hwb2rgb,lim,n2b,n2p,nameParse,p2b,rgb2hsl,rgbParse,rgbString,rotate,round}; diff --git a/vendor/javascript/chart.js.js b/vendor/javascript/chart.js.js new file mode 100644 index 000000000..7b23f78d6 --- /dev/null +++ b/vendor/javascript/chart.js.js @@ -0,0 +1,11 @@ +import{r as e,c as t,a as n,e as r,i,d as a,b as o,f as s,s as c,g as l,v as u,u as d,l as f,h as p,j as m,_ as h,k as g,m as _,n as v,H as y,P as b,t as x,o as S,p as C,q as w,w as T,x as E,y as D,z as O,A as k,B as A,C as j,D as M,E as N,F as P,G as F,I as ee,J as te,K as ne,L as re,M as ie,N as ae,O as oe,Q as I,R as se,S as L,U as R,V as z,W as ce,X as B,Y as le,Z as ue,$ as de,a0 as fe,a1 as pe,a2 as me,a3 as he,a4 as ge,a5 as _e,a6 as ve,a7 as ye,a8 as be,a9 as xe,aa as Se,ab as Ce,ac as we,ad as Te,ae as Ee,af as De,ag as Oe,ah as ke,ai as Ae,aj as je,ak as Me,al as V,am as Ne,an as H,ao as Pe,ap as Fe,aq as Ie,ar as Le,as as Re,at as ze,au as Be,av as Ve,aw as He,ax as Ue,ay as U,az as We,aA as Ge,aB as Ke,aC as qe,aD as Je,aE as Ye,aF as Xe,aG as Ze,aH as W,aI as Qe,aJ as $e,aK as et,aL as tt,aM as nt,T as rt,aN as it,aO as at,aP as ot,aQ as st}from"../_/BDnc5-Gm.js";import"@kurkle/color"; +/*! +* Chart.js v4.6.1 +* https://www.chartjs.org +* (c) 2026 Chart.js Contributors +* Released under the MIT License +*/ +class Animator{constructor(){this._request=null,this._charts=/* @__PURE__ */ new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){let i=t.listeners[r],a=t.duration;i.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(n-t.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=e.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 i=n.items,a=i.length-1,o=!1,s;for(;a>=0;--a)s=i[a],s._active?(s._total>n.duration&&(n.duration=s._total),s.tick(e),o=!0):(i[a]=i[i.length-1],i.pop());o&&(r.draw(),this._notify(r,n,e,`progress`)),i.length||(n.running=!1,this._notify(r,n,e,`complete`),n.initial=!1),t+=i.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((e,t)=>Math.max(e,t._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)}}var G=/* @__PURE__ */ new Animator;const ct=`transparent`,lt={boolean(e,t,n){return n>.5?t:e},color(e,n,r){let i=t(e||ct),a=i.valid&&t(n||ct);return a&&a.valid?a.mix(i,r).hexString():n},number(e,t,n){return e+(t-e)*n}};class Animation{constructor(e,t,i,a){let o=t[i];a=n([e.to,a,o,e.from]);let s=n([e.from,o,a]);this._active=!0,this._fn=e.fn||lt[e.type||typeof s],this._easing=r[e.easing]||r.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=i,this._from=s,this._to=a,this._promises=void 0}active(){return this._active}update(e,t,r){if(this._active){this._notify(!1);let i=this._target[this._prop],a=r-this._start,o=this._duration-a;this._start=r,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=a,this._loop=!!e.loop,this._to=n([e.to,t,i,e.from]),this._from=n([e.from,i,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,i=this._from,a=this._loop,o=this._to,s;if(this._active=i!==o&&(a||t1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(i,o,s)}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 e=0;e{let a=e[r];if(!i(a))return;let s={};for(let e of t)s[e]=a[e];(o(a.properties)&&a.properties||[r]).forEach(e=>{(e===r||!n.has(e))&&n.set(e,s)})})}_animateOptions(e,t){let n=t.options,r=dt(e,n);if(!r)return[];let i=this._createAnimations(r,n);return n.$shared&&ut(e.options.$animations,n).then(()=>{e.options=n},()=>{}),i}_createAnimations(e,t){let n=this._properties,r=[],i=e.$animations||(e.$animations={}),a=Object.keys(t),o=Date.now(),s;for(s=a.length-1;s>=0;--s){let c=a[s];if(c.charAt(0)===`$`)continue;if(c===`options`){r.push(...this._animateOptions(e,t));continue}let l=t[c],u=i[c],d=n.get(c);if(u)if(d&&u.active()){u.update(d,l,o);continue}else u.cancel();if(!d||!d.duration){e[c]=l;continue}i[c]=u=new Animation(d,e,c,l),r.push(u)}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 G.add(this._chart,n),!0}}function ut(e,t){let n=[],r=Object.keys(t);for(let t=0;t0||!n&&t<0)return i.index}return null}function Ct(e,t){let{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:a,vScale:o,index:s}=r,c=a.axis,l=o.axis,u=yt(a,o,r),d=t.length,f;for(let e=0;en[e].axis===t).shift()}function Tt(e,t){return l(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:`default`,type:`dataset`})}function Et(e,t,n){return l(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:`default`,type:`data`})}function Dt(e,t){let n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(let e of t){let t=e._stacks;!t||t[r]===void 0||t[r][n]===void 0||(delete t[r][n],t[r]._visualValues!==void 0&&t[r]._visualValues[n]!==void 0&&delete t[r]._visualValues[n])}}}const Ot=e=>e===`reset`||e===`none`,kt=(e,t)=>t?e:Object.assign({},e),At=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:ht(n,!0),values:null};class DatasetController{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=vt(e.vScale,e),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(e){this.index!==e&&Dt(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>e===`x`?t:e===`r`?r:n,i=t.xAxisID=u(n.xAxisID,wt(e,`x`)),a=t.yAxisID=u(n.yAxisID,wt(e,`y`)),o=t.rAxisID=u(n.rAxisID,wt(e,`r`)),s=t.indexAxis,c=t.iAxisID=r(s,i,a,o),l=t.vAxisID=r(s,a,i,o);t.xScale=this.getScaleForId(i),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(l)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update(`reset`)}_destroy(){let e=this._cachedMeta;this._data&&d(this._data,this),e._stacked&&Dt(e)}_dataCheck(){let e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(i(t)){let e=this._cachedMeta;this._data=_t(t,e)}else if(n!==t){if(n){d(n,this);let e=this._cachedMeta;Dt(e),e._parsed=[]}t&&Object.isExtensible(t)&&f(t,this),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,n=this.getDataset(),r=!1;this._dataCheck();let i=t._stacked;t._stacked=vt(t.vScale,t),t.stack!==n.stack&&(r=!0,Dt(t),t.stack=n.stack),this._resyncElements(e),(r||i!==t._stacked)&&(Ct(this,t._parsed),t._stacked=vt(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let{_cachedMeta:n,_data:r}=this,{iScale:a,_stacked:s}=n,c=a.axis,l=e===0&&t===r.length?!0:n._sorted,u=e>0&&n._parsed[e-1],d,f,p;if(this._parsing===!1)n._parsed=r,n._sorted=!0,p=r;else{p=o(r[e])?this.parseArrayData(n,r,e,t):i(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);let a=()=>f[c]===null||u&&f[c]t||d=0;--f)if(!m()){this.updateRangeFromParsed(l,e,p,c);break}}return l}getAllParsedValues(e){let t=this._cachedMeta._parsed,n=[],r,i,a;for(r=0,i=t.length;r=0&&ethis.getContext(n,r,t),g=l.resolveNamedOptions(f,p,h,d);return g.$shared&&(g.$shared=c,i[o]=Object.freeze(kt(g,c))),g}_resolveAnimations(e,t,n){let r=this.chart,i=this._cachedDataOpts,a=`animation-${t}`,o=i[a];if(o)return o;let s;if(r.options.animation!==!1){let r=this.chart.config,i=r.datasetAnimationScopeKeys(this._type,t),a=r.getOptionScopes(this.getDataset(),i);s=r.createResolver(a,this.getContext(e,n,t))}let c=new Animations(r,s&&s.animations);return s&&s._cacheable&&(i[a]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||Ot(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,i=this.getSharedOptions(n),a=this.includeOptions(t,i)||i!==r;return this.updateSharedOptions(i,t,n),{sharedOptions:i,includeOptions:a}}updateElement(e,t,n,r){Ot(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!Ot(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;let i=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,t,n){this._setStyle(e,n,`active`,!1)}setHoverStyle(e,t,n){this._setStyle(e,n,`active`,!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,`active`,!0)}_resyncElements(e){let t=this._data,n=this._cachedMeta.data;for(let[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];let r=n.length,i=t.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,e):i{for(e.length+=t,o=e.length-1;o>=a;o--)e[o]=e[o-t]};for(s(i),o=e;oe-t))}return e._cache.$bar}function Mt(e){let t=e.iScale,n=jt(t,e.type),r=t._length,i,a,o,s,c=()=>{o===32767||o===-32768||(m(s)&&(r=Math.min(r,Math.abs(o-s)||r)),s=o)};for(i=0,a=n.length;i0?i[e-1]:null,s=eMath.abs(s)&&(c=s,l=o),t[n.axis]=l,t._custom={barStart:c,barEnd:l,start:i,end:a,min:o,max:s}}function It(e,t,n,r){return o(e)?Ft(e,t,n,r):t[n.axis]=n.parse(e,r),t}function Lt(e,t,n,r){let i=e.iScale,a=e.vScale,o=i.getLabels(),s=i===a,c=[],l,u,d,f;for(l=n,u=n+r;l=n?1:-1):c(e)}function Bt(e){let t,n,r,i,a;return e.horizontal?(t=e.base>e.x,n=`left`,r=`right`):(t=e.basee.controller.options.grouped),i=n.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),s=o&&o[n.axis],c=e=>{let t=e._parsed.find(e=>e[n.axis]===s),r=t&&t[e.vScale.axis];if(g(r)||isNaN(r))return!0};for(let n of r)if(!(t!==void 0&&c(n))&&((i===!1||a.indexOf(n.stack)===-1||i===void 0&&n.stack===void 0)&&a.push(n.stack),n.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(n=>e[n].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)e[u(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,n){let r=this._getStacks(e,n),i=t===void 0?-1:r.indexOf(t);return i===-1?r.length-1:i}_getRuler(){let e=this.options,t=this._cachedMeta,n=t.iScale,r=[],i,a;for(i=0,a=t.data.length;i=0;--n)t=Math.max(t,e[n].size(this.resolveDataElementOptions(n))/2);return t>0&&t}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart.data.labels||[],{xScale:r,yScale:i}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),s=i.getLabelForValue(a.y),c=a._custom;return{label:n[e]||``,value:`(`+o+`, `+s+(c?`, `+c:``)+`)`}}update(e){let t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,n,r){let i=r===`reset`,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:s,includeOptions:c}=this._getSharedOptions(t,r),l=a.axis,u=o.axis;for(let d=t;dv(e,s,c,!0)?1:Math.max(t,t*n,r,r*n),m=(e,t,r)=>v(e,s,c,!0)?-1:Math.min(t,t*n,r,r*n),h=p(0,l,d),g=p(y,u,f),_=m(b,l,d),x=m(b+y,u,f);r=(h-_)/2,i=(g-x)/2,a=-(h+_)/2,o=-(g+x)/2}return{ratioX:r,ratioY:i,offsetX:a,offsetY:o}}class DoughnutController extends DatasetController{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,spacingMode:`angular`,indexAxis:`r`};static descriptors={_scriptable:e=>e!==`spacing`&&e!==`spacingMode`,_indexable:e=>e!==`spacing`&&e!==`spacingMode`&&!e.startsWith(`borderDash`)&&!e.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data,{labels:{pointStyle:n,textAlign:r,color:i,useBorderRadius:a,borderRadius:o}}=e.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((t,s)=>{let c=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:c.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(s),lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:c.borderWidth,strokeStyle:c.borderColor,textAlign:r,pointStyle:n,borderRadius:a&&(o||c.borderRadius),index:s}}):[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let n=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=n;else{let a=e=>+n[e];if(i(n[e])){let{key:e=`value`}=this._parsing;a=t=>+p(n[t],e)}let o,s;for(o=e,s=e+t;o0&&!isNaN(e)?Math.abs(e)/t*_:0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=w(t._parsed[e],n.options.locale);return{label:r[e]||``,value:i}}getMaxBorderWidth(e){let t=0,n=this.chart,r,i,a,o,s;if(!e){for(r=0,i=n.data.datasets.length;r0&&this.getParsed(t-1);for(let n=0;n=v){y.skip=!0;continue}let x=this.getParsed(n),S=g(x[f]),C=y[d]=a.getPixelForValue(x[d],n),w=y[f]=i||S?o.getBasePixel():o.getPixelForValue(s?this.applyStack(o,x,s):x[f],n);y.skip=isNaN(C)||isNaN(w)||S,y.stop=n>0&&Math.abs(x[d]-b[d])>h,m&&(y.parsed=x,y.raw=c.data[n]),u&&(y.options=l||this.resolveDataElementOptions(n,p.active?`active`:r)),_||this.updateElement(p,n,y,r),b=x}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,n=t.options&&t.options.borderWidth||0,r=e.data||[];if(!r.length)return n;let i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(n,i,a)/2}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}class PolarAreaController extends DatasetController{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,spacing:0,spacingMode:`proportional`};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:n,color:r}}=e.legend.options;return t.labels.map((t,i)=>{let a=e.getDatasetMeta(0).controller.getStyle(i);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!e.getDataVisibility(i),index:i}})}return[]}},onClick(e,t,n){n.chart.toggleDataVisibility(t.index),n.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,n=this.chart,r=n.data.labels||[],i=w(t._parsed[e].r,n.options.locale);return{label:r[e]||``,value:i}}parseObjectData(e,t,n,r){return O.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,n)=>{let r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(rt.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,n=e.options,r=Math.min(t.right-t.left,t.bottom-t.top),i=Math.max(r/2,0),a=(i-Math.max(n.cutoutPercentage?i/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,n,r){let i=r===`reset`,a=this.chart,o=a.options.animation,s=this._cachedMeta.rScale,c=s.xCenter,l=s.yCenter,u=s.getIndexAngle(0)-.5*b,d=u,f,p=360/this.countVisibleElements();for(f=0;f{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,n){return this.chart.getDataVisibility(e)?x(this.resolveDataElementOptions(e,t).angle||n):0}}class PieController extends DoughnutController{static id=`pie`;static defaults={cutout:0,rotation:0,circumference:360,radius:`100%`}}class RadarController extends DatasetController{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(e){let t=this._cachedMeta.vScale,n=this.getParsed(e);return{label:t.getLabels()[e],value:``+t.getLabelForValue(n[t.axis])}}parseObjectData(e,t,n,r){return O.bind(this)(e,t,n,r)}update(e){let t=this._cachedMeta,n=t.dataset,r=t.data||[],i=t.iScale.getLabels();if(n.points=r,e!==`resize`){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);let a={_loop:!0,_fullLoop:i.length===r.length,options:t};this.updateElement(n,void 0,a,e)}this.updateElements(r,0,r.length,e)}updateElements(e,t,n,r){let i=this._cachedMeta.rScale,a=r===`reset`;for(let o=t;o0&&this.getParsed(t-1);for(let l=t;l0&&Math.abs(n[f]-y[f])>_,h&&(m.parsed=n,m.raw=c.data[l]),d&&(m.options=u||this.resolveDataElementOptions(l,t.active?`active`:r)),v||this.updateElement(t,l,m,r),y=n}this.updateSharedOptions(u,r,l)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}let n=e.dataset,r=n.options&&n.options.borderWidth||0;if(!t.length)return r;let i=t[0].size(this.resolveDataElementOptions(0)),a=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(r,i,a)/2}}var qt=/* @__PURE__ */ Object.freeze({__proto__:null,BarController,BubbleController,DoughnutController,LineController,PieController,PolarAreaController,RadarController,ScatterController});function Jt(){throw Error(`This method is not implemented: Check that a complete date adapter is provided.`)}class DateAdapterBase{static override(e){Object.assign(DateAdapterBase.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return Jt()}parse(){return Jt()}format(){return Jt()}add(){return Jt()}diff(){return Jt()}startOf(){return Jt()}endOf(){return Jt()}}var Yt={_date:DateAdapterBase};function Xt(e,t,n,r){let{controller:i,data:a,_sorted:o}=e,s=i._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!==`r`&&o&&a.length){let o=s._reversePixels?k:A;if(!r){let r=o(a,t,n);if(c){let{vScale:t}=i._cachedMeta,{_parsed:n}=e,a=n.slice(0,r.lo+1).reverse().findIndex(e=>!g(e[t.axis]));r.lo-=Math.max(0,a);let o=n.slice(r.hi).findIndex(e=>!g(e[t.axis]));r.hi+=Math.max(0,o)}return r}else if(i._sharedOptions){let e=a[0],r=typeof e.getRange==`function`&&e.getRange(t);if(r){let e=o(a,t,n-r),i=o(a,t,n+r);return{lo:e.lo,hi:i.hi}}}}return{lo:0,hi:a.length-1}}function Zt(e,t,n,r,i){let a=e.getSortedVisibleDatasetMetas(),o=n[t];for(let e=0,n=a.length;e{e[o]&&e[o](t[n],i)&&(a.push({element:e,datasetIndex:r,index:c}),s=s||e.inRange(t.x,t.y,i))}),r&&!s?[]:a}var an={evaluateInteractionItems:Zt,modes:{index(e,t,n,r){let i=N(t,e),a=n.axis||`x`,o=n.includeInvisible||!1,s=n.intersect?$t(e,i,a,r,o):nn(e,i,a,!1,r,o),c=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=s[0].index,n=e.data[t];n&&!n.skip&&c.push({element:n,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,n,r){let i=N(t,e),a=n.axis||`xy`,o=n.includeInvisible||!1,s=n.intersect?$t(e,i,a,r,o):nn(e,i,a,!1,r,o);if(s.length>0){let t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;ee.pos===t)}function cn(e,t){return e.filter(e=>on.indexOf(e.pos)===-1&&e.box.axis===t)}function ln(e,t){return e.sort((e,n)=>{let r=t?n:e,i=t?e:n;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function un(e){let t=[],n,r,i,a,o,s;for(n=0,r=(e||[]).length;ne.box.fullSize),!0),r=ln(sn(t,`left`),!0),i=ln(sn(t,`right`)),a=ln(sn(t,`top`),!0),o=ln(sn(t,`bottom`)),s=cn(t,`x`),c=cn(t,`y`);return{fullSize:n,leftAndTop:r.concat(a),rightAndBottom:i.concat(c).concat(o).concat(s),chartArea:sn(t,`chartArea`),vertical:r.concat(i).concat(c),horizontal:a.concat(o).concat(s)}}function mn(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function hn(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function gn(e,t,n,r){let{pos:a,box:o}=n,s=e.maxPadding;if(!i(a)){n.size&&(e[a]-=n.size);let t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?o.height:o.width),n.size=t.size/t.count,e[a]+=n.size}o.getPadding&&hn(s,o.getPadding());let c=Math.max(0,t.outerWidth-mn(s,e,`left`,`right`)),l=Math.max(0,t.outerHeight-mn(s,e,`top`,`bottom`)),u=c!==e.w,d=l!==e.h;return e.w=c,e.h=l,n.horizontal?{same:u,other:d}:{same:d,other:u}}function _n(e){let t=e.maxPadding;function n(n){let r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n(`top`),e.x+=n(`left`),n(`right`),n(`bottom`)}function vn(e,t){let n=t.maxPadding;function r(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],n[e])}),r}return r(e?[`left`,`right`]:[`top`,`bottom`])}function yn(e,t,n,r){let i=[],a,o,s,c,l,u;for(a=0,o=e.length,l=0;a{typeof e.beforeLayout==`function`&&e.beforeLayout()});let u=c.reduce((e,t)=>t.box.options&&t.box.options.display===!1?e:e+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:a,availableHeight:o,vBoxMaxWidth:a/2/u,hBoxMaxHeight:o/2}),f=Object.assign({},i);hn(f,P(r));let p=Object.assign({maxPadding:f,w:a,h:o,x:i.left,y:i.top},i),m=fn(c.concat(l),d);yn(s.fullSize,p,d,m),yn(c,p,d,m),yn(l,p,d,m)&&yn(c,p,d,m),_n(p),xn(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,xn(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},F(s.chartArea,t=>{let n=t.box;Object.assign(n,e.chartArea),n.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class BasePlatform{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){}}class BasicPlatform extends BasePlatform{acquireContext(e){return e&&e.getContext&&e.getContext(`2d`)||null}updateConfig(e){e.options.animation=!1}}const Sn=`$chartjs`,Cn={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`},wn=e=>e===null||e===``;function Tn(e,t){let n=e.style,r=e.getAttribute(`height`),i=e.getAttribute(`width`);if(e[Sn]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||`block`,n.boxSizing=n.boxSizing||`border-box`,wn(i)){let t=ee(e,`width`);t!==void 0&&(e.width=t)}if(wn(r))if(e.style.height===``)e.height=e.width/(t||2);else{let t=ee(e,`height`);t!==void 0&&(e.height=t)}return e}const En=te?{passive:!0}:!1;function Dn(e,t,n){e&&e.addEventListener(t,n,En)}function On(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,En)}function kn(e,t){let n=Cn[e.type]||e.type,{x:r,y:i}=N(e,t);return{type:n,chart:t,native:e,x:r===void 0?null:r,y:i===void 0?null:i}}function An(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function jn(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||An(n.addedNodes,r),t=t&&!An(n.removedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function Mn(e,t,n){let r=e.canvas,i=new MutationObserver(e=>{let t=!1;for(let n of e)t=t||An(n.removedNodes,r),t=t&&!An(n.addedNodes,r);t&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const Nn=/* @__PURE__ */ new Map;let Pn=0;function Fn(){let e=window.devicePixelRatio;e!==Pn&&(Pn=e,Nn.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function In(e,t){Nn.size||window.addEventListener(`resize`,Fn),Nn.set(e,t)}function Ln(e){Nn.delete(e),Nn.size||window.removeEventListener(`resize`,Fn)}function Rn(e,t,n){let r=e.canvas,i=r&&ne(r);if(!i)return;let a=re((e,t)=>{let r=i.clientWidth;n(e,t),r{let t=e[0],n=t.contentRect.width,r=t.contentRect.height;n===0&&r===0||a(n,r)});return o.observe(i),In(e,a),o}function zn(e,t,n){n&&n.disconnect(),t===`resize`&&Ln(e)}function Bn(e,t,n){let r=e.canvas,i=re(t=>{e.ctx!==null&&n(kn(t,e))},e);return Dn(r,t,i),i}class DomPlatform extends BasePlatform{acquireContext(e,t){let n=e&&e.getContext&&e.getContext(`2d`);return n&&n.canvas===e?(Tn(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[Sn])return!1;let n=t[Sn].initial;[`height`,`width`].forEach(e=>{let r=n[e];g(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=n.style||{};return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[Sn],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let r=e.$proxies||(e.$proxies={});r[t]=({attach:jn,detach:Mn,resize:Rn}[t]||Bn)(e,t,n)}removeEventListener(e,t){let n=e.$proxies||(e.$proxies={}),r=n[t];r&&(({attach:zn,detach:zn,resize:zn}[t]||On)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return ie(e,t,n,r)}isAttached(e){let t=e&&ne(e);return!!(t&&t.isConnected)}}function Vn(e){return!ae()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?BasicPlatform:DomPlatform}class Element{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 D(this.x)&&D(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let r={};return e.forEach(e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]}),r}}function Hn(e,t){let n=e.options.ticks,r=Un(e),i=Math.min(n.maxTicksLimit||r,r),a=n.major.enabled?Gn(t):[],o=a.length,s=a[0],c=a[o-1],l=[];if(o>i)return Kn(t,l,a,o/i),l;let u=Wn(a,t,i);if(o>0){let e,n,r=o>1?Math.round((c-s)/(o-1)):null;for(qn(t,l,u,g(r)?0:s-r,s),e=0,n=o-1;ei)return t}return Math.max(i,1)}function Gn(e){let t=[],n,r;for(n=0,r=e.length;ne===`left`?`right`:e===`right`?`left`:e,Xn=(e,t,n)=>t===`top`||t===`left`?e[t]+n:e[t]-n,Zn=(e,t)=>Math.min(t||e,e);function Qn(e,t){let n=[],r=e.length/t,i=e.length,a=0;for(;ao+s)))return c}function er(e,t){F(e,e=>{let n=e.gc,r=n.length/2,i;if(r>t){for(i=0;in?n:t,n=r&&t>n?t:n,{min:R(t,R(n,t)),max:R(n,R(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(){z(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:r,grace:i,ticks:a}=this.options,o=a.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=ce(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let s=o=i||n<=1||!this.isHorizontal()){this.labelRotation=r;return}let l=this._getLabelSizes(),u=l.widest.width,d=l.highest.height,f=B(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/n:f/(n-1),u+6>o&&(o=f/(n-(e.offset?.5:1)),s=this.maxHeight-tr(e.grid)-t.padding-nr(e.title,this.chart.options.font),c=Math.sqrt(u*u+d*d),a=le(Math.min(Math.asin(B((l.highest.height+6)/o,-1,1)),Math.asin(B(s/c,-1,1))-Math.asin(B(d/c,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:i}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=nr(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=tr(i)+a):(e.height=this.maxHeight,e.width=tr(i)+a),n.display&&this.ticks.length){let{first:t,last:r,widest:i,highest:a}=this._getLabelSizes(),s=n.padding*2,c=x(this.labelRotation),l=Math.cos(c),u=Math.sin(c);if(o){let t=n.mirror?0:u*i.width+l*a.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{let t=n.mirror?0:l*i.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,l)}}this._handleMargins(),o?(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:i,padding:a},position:o}=this.options,s=this.labelRotation!==0,c=o!==`top`&&this.axis===`x`;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1),u=0,d=0;s?c?(u=r*e.width,d=n*t.height):(u=n*e.height,d=r*t.width):i===`start`?d=t.width:i===`end`?u=e.width:i!==`inner`&&(u=e.width/2,d=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-l+a)*this.width/(this.width-l),0)}else{let n=t.height/2,r=e.height/2;i===`start`?(n=0,r=e.height):i===`end`&&(n=t.height,r=0),this.paddingTop=n+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){z(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({width:a[e]||0,height:s[e]||0});return{first:T(0),last:T(t-1),widest:T(C),highest:T(w),widths:a,heights:s}}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 de(this._alignToPixels?fe(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&&eo*r?o/n:s/r:s*r0:!!e}_computeGridLineItems(e){let t=this.axis,n=this.chart,r=this.options,{grid:a,position:o,border:s}=r,c=a.offset,l=this.isHorizontal(),d=this.ticks.length+ +!!c,f=tr(a),p=[],m=s.setContext(this.getContext()),h=m.display?m.width:0,g=h/2,_=function(e){return fe(n,e,h)},v,y,b,x,S,C,w,T,E,D,O,k;if(o===`top`)v=_(this.bottom),C=this.bottom-f,T=v-g,D=_(e.top)+g,k=e.bottom;else if(o===`bottom`)v=_(this.top),D=e.top,k=_(e.bottom)-g,C=v+g,T=this.top+f;else if(o===`left`)v=_(this.right),S=this.right-f,w=v-g,E=_(e.left)+g,O=e.right;else if(o===`right`)v=_(this.left),E=e.left,O=_(e.right)-g,S=v+g,w=this.left+f;else if(t===`x`){if(o===`center`)v=_((e.top+e.bottom)/2+.5);else if(i(o)){let e=Object.keys(o)[0],t=o[e];v=_(this.chart.scales[e].getPixelForValue(t))}D=e.top,k=e.bottom,C=v+g,T=C+f}else if(t===`y`){if(o===`center`)v=_((e.left+e.right)/2);else if(i(o)){let e=Object.keys(o)[0],t=o[e];v=_(this.chart.scales[e].getPixelForValue(t))}S=v-g,w=S-f,E=e.left,O=e.right}let A=u(r.ticks.maxTicksLimit,d),j=Math.max(1,Math.ceil(d/A));for(y=0;y0&&(a-=r/2);break}p={left:a,top:i,width:r+t.width,height:n+t.height,color:e.backdropColor}}_.push({label:S,font:D,textOffset:A,options:{rotation:g,color:n,strokeColor:i,strokeWidth:l,textAlign:d,textBaseline:j,translation:[C,w],backdrop:p}})}return _}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-x(this.labelRotation))return e===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),o=e+i,s=a.widest.width,c,l;return t===`left`?r?(l=this.right+i,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l+=s)):(l=this.right-o,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l=this.left)):t===`right`?r?(l=this.left+i,n===`near`?c=`right`:n===`center`?(c=`center`,l-=s/2):(c=`left`,l-=s)):(l=this.left+o,n===`near`?c=`left`:n===`center`?(c=`center`,l+=s/2):(c=`right`,l=this.right)):c=`right`,{textAlign:c,x:l}}_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:i,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,i,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(t=>t.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),i,a,o=(e,t,r)=>{!r.width||!r.color||(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(i=0,a=r.length;i{this.draw(e)}}]:[{z:n,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+`AxisID`,r=[],i,a;for(i=0,a=t.length;i{let r=n.split(`.`),i=r.pop(),o=[e].concat(r).join(`.`),s=t[n].split(`.`),c=s.pop(),l=s.join(`.`);a.route(o,i,l,c)})}function lr(e){return`id`in e&&`defaults`in e}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,`datasets`,!0),this.elements=new TypedRegistry(Element,`elements`),this.plugins=new TypedRegistry(Object,`plugins`),this.scales=new TypedRegistry(Scale,`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(t=>{let r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):F(t,t=>{let r=n||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,n){let r=ve(e);z(n[`before`+r],[],n),t[e](n),z(n[`after`+r],[],n)}_getRegistryForType(e){for(let t=0;te.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,n),e,`stop`),this._notify(r(n,t),e,`start`)}}function ur(e){let t={},n=[],r=Object.keys(q.plugins.items);for(let e=0;e1&&_r(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function br(e,t,n){if(n[t+`AxisID`]===e)return{axis:t}}function xr(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(n.length)return br(e,`x`,n[0])||br(e,`y`,n[0])}return{}}function Sr(e,t){let n=ge[e.type]||{scales:{}},r=t.scales||{},o=mr(e.type,t),s=Object.create(null);return Object.keys(r).forEach(t=>{let c=r[t];if(!i(c))return console.error(`Invalid scale configuration for scale: ${t}`);if(c._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);let l=yr(t,c,xr(t,e),a.scales[c.type]),u=gr(l,o),d=n.scales||{};s[t]=ye(Object.create(null),[{axis:l},c,d[l],d[u]])}),e.data.datasets.forEach(n=>{let i=n.type||e.type,a=n.indexAxis||mr(i,t),o=(ge[i]||{}).scales||{};Object.keys(o).forEach(e=>{let t=hr(e,a),i=n[t+`AxisID`]||t;s[i]=s[i]||Object.create(null),ye(s[i],[{axis:t},r[i],o[e]])})}),Object.keys(s).forEach(e=>{let t=s[e];ye(t,[a.scales[t.type],a.scale])}),s}function Cr(e){let t=e.options||(e.options={});t.plugins=u(t.plugins,{}),t.scales=Sr(e,t)}function wr(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Tr(e){return e=e||{},e.data=wr(e.data),Cr(e),e}const Er=/* @__PURE__ */ new Map,Dr=/* @__PURE__ */ new Set;function Or(e,t){let n=Er.get(e);return n||(n=t(),Er.set(e,n),Dr.add(n)),n}const kr=(e,t,n)=>{let r=p(t,n);r!==void 0&&e.add(r)};class Config{constructor(e){this._config=Tr(e),this._scopeCache=/* @__PURE__ */ new Map,this._resolverCache=/* @__PURE__ */ 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=wr(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(),Cr(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Or(e,()=>[[`datasets.${e}`,``]])}datasetAnimationScopeKeys(e,t){return Or(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,``]])}datasetElementScopeKeys(e,t){return Or(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,``]])}pluginScopeKeys(e){let t=e.id,n=this.type;return Or(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,r=n.get(e);return(!r||t)&&(r=/* @__PURE__ */ new Map,n.set(e,r)),r}getOptionScopes(e,t,n){let{options:r,type:i}=this,o=this._cachedScopes(e,n),s=o.get(t);if(s)return s;let c=/* @__PURE__ */ new Set;t.forEach(t=>{e&&(c.add(e),t.forEach(t=>kr(c,e,t))),t.forEach(e=>kr(c,r,e)),t.forEach(e=>kr(c,ge[i]||{},e)),t.forEach(e=>kr(c,a,e)),t.forEach(e=>kr(c,be,e))});let l=Array.from(c);return l.length===0&&l.push(Object.create(null)),Dr.has(t)&&o.set(t,l),l}chartOptionScopes(){let{options:e,type:t}=this;return[e,ge[t]||{},a.datasets[t]||{},{type:t},a,be]}resolveNamedOptions(e,t,n,r=[``]){let i={$shared:!0},{resolver:a,subPrefixes:o}=Ar(this._resolverCache,e,r),s=a;if(Mr(a,t)){i.$shared=!1,n=xe(n)?n():n;let t=this.createResolver(e,n,o);s=Se(a,n,t)}for(let e of t)i[e]=s[e];return i}createResolver(e,t,n=[``],r){let{resolver:a}=Ar(this._resolverCache,e,n);return i(t)?Se(a,t,void 0,r):a}}function Ar(e,t,n){let r=e.get(t);r||(r=/* @__PURE__ */ new Map,e.set(t,r));let i=n.join(),a=r.get(i);return a||(a={resolver:Ce(t,n),subPrefixes:n.filter(e=>!e.toLowerCase().includes(`hover`))},r.set(i,a)),a}const jr=e=>i(e)&&Object.getOwnPropertyNames(e).some(t=>xe(e[t]));function Mr(e,t){let{isScriptable:n,isIndexable:r}=we(e);for(let i of t){let t=n(i),a=r(i),s=(a||t)&&e[i];if(t&&(xe(s)||jr(s))||a&&o(s))return!0}return!1}var Nr=`4.6.1`;const Pr=[`top`,`bottom`,`left`,`right`,`chartArea`];function Fr(e,t){return e===`top`||e===`bottom`||Pr.indexOf(e)===-1&&t===`x`}function Ir(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Lr(e){let t=e.chart,n=t.options.animation;t.notifyPlugins(`afterRender`),z(n&&n.onComplete,[e],t)}function Rr(e){let t=e.chart,n=t.options.animation;z(n&&n.onProgress,[e],t)}function zr(e){return ae()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Br={},Vr=e=>{let t=zr(e);return Object.values(Br).filter(e=>e.canvas===t).pop()};function Hr(e,t,n){let r=Object.keys(e);for(let i of r){let r=+i;if(r>=t){let a=e[i];delete e[i],(n>0||r>t)&&(e[r+n]=a)}}}function Ur(e,t,n,r){return!n||e.type===`mouseout`?null:r?t:e}class Chart{static defaults=a;static instances=Br;static overrides=ge;static registry=q;static version=Nr;static getChart=Vr;static register(...e){q.add(...e),Wr()}static unregister(...e){q.remove(...e),Wr()}constructor(e,t){let n=this.config=new Config(t),r=zr(e),i=Vr(r);if(i)throw Error(`Canvas is already in use. Chart with ID '`+i.id+`' must be destroyed before the canvas with ID '`+i.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(Vn(r))),this.platform.updateConfig(n);let o=this.platform.acquireContext(r,a.aspectRatio),s=o&&o.canvas,c=s&&s.height,l=s&&s.width;if(this.id=Te(),this.ctx=o,this.canvas=s,this.width=l,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ee(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],Br[this.id]=this,!o||!s){console.error(`Failed to create chart: can't acquire context from the given item`);return}G.listen(this,`complete`,Lr),G.listen(this,`progress`,Rr),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:i}=this;return g(e)?t&&i?i:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return q}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():De(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return Oe(this.canvas,this.ctx),this}stop(){return G.stop(this),this}resize(e,t){G.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let n=this.options,r=this.canvas,i=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,i),o=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,De(this,o,!0)&&(this.notifyPlugins(`resize`,{size:a}),z(n.onResize,[this,a],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){F(this.options.scales||{},(e,t)=>{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce((e,t)=>(e[t]=!1,e),{}),i=[];t&&(i=i.concat(Object.keys(t).map(e=>{let n=t[e],r=yr(e,n),i=r===`r`,a=r===`x`;return{options:n,dposition:i?`chartArea`:a?`bottom`:`left`,dtype:i?`radialLinear`:a?`category`:`linear`}}))),F(i,t=>{let i=t.options,a=i.id,o=yr(a,i),s=u(i.type,t.dtype);(i.position===void 0||Fr(i.position,o)!==Fr(t.dposition))&&(i.position=t.dposition),r[a]=!0;let c=null;a in n&&n[a].type===s?c=n[a]:(c=new(q.getScale(s))({id:a,type:s,ctx:this.ctx,chart:this}),n[c.id]=c),c.init(i,e)}),F(r,(e,t)=>{e||delete n[t]}),F(n,e=>{K.configure(this,e,e.options),K.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort((e,t)=>e.index-t.index),n>t){for(let e=t;et.length&&delete this._stacks,e.forEach((e,n)=>{t.filter(t=>t===e._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let e=[],t=this.data.datasets,n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(e){let t=this.config;t.update();let n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:e,cancelable:!0})===!1)return;let i=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let e=0,t=this.data.datasets.length;e{e.reset()}),this._updateDatasets(e),this.notifyPlugins(`afterUpdate`,{mode:e}),this._layers.sort(Ir(`z`,`_idx`));let{_active:o,_lastEvent:s}=this;s?this._eventHandler(s,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){F(this.scales,e=>{K.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;(!ke(new Set(Object.keys(this._listeners)),new Set(e.events))||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(let{method:n,start:r,count:i}of t)Hr(e,r,n===`_removeElements`?-i:i)}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,n=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+`,`+e.splice(1).join(`,`))),r=n(0);for(let e=1;ee.split(`,`)).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;K.update(this,this.width,this.height,e);let t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],F(this.boxes,e=>{n&&e.position===`chartArea`||(e.configure&&e.configure(),this._layers.push(...e._layers()))},this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins(`afterLayout`)}_updateDatasets(e){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:e,cancelable:!0})!==!1){for(let e=0,t=this.data.datasets.length;e=0;--t)this._drawDataset(e[t]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(e){let t=this.ctx,n={meta:e,index:e.index,cancelable:!0},r=Ae(this,e);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(r&&pe(t,r),e.controller.draw(),r&&he(t),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(e){return j(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){let i=an.modes[t];return typeof i==`function`?i(this,e,n,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],n=this._metasets,r=n.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||(this.$context=l(null,{chart:this,type:`chart`}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let n=this.getDatasetMeta(e);return typeof n.hidden==`boolean`?!n.hidden:!t.hidden}setDatasetVisibility(e,t){let n=this.getDatasetMeta(e);n.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){let r=n?`show`:`hide`,i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,r);m(t)?(i.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),a.update(i,{visible:n}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),G.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};F(this.options.events,e=>n(e,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},i=(e,t)=>{this.canvas&&this.resize(e,t)},a,o=()=>{r(`attach`,o),this.attached=!0,this.resize(),n(`resize`,i),n(`detach`,a)};a=()=>{this.attached=!1,r(`resize`,i),this._stop(),this._resize(0,0),n(`attach`,o)},t.isAttached(this.canvas)?o():a()}unbindEvents(){F(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},F(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){let r=n?`set`:`remove`,i,a,o,s;for(t===`dataset`&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller[`_`+r+`DatasetHoverStyle`]()),o=0,s=e.length;o{let n=this.getDatasetMeta(e);if(!n)throw Error(`No dataset found at index `+e);return{datasetIndex:e,element:n.data[t],index:t}});!je(n,t)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,n){let r=this.options.hover,i=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=i(t,e),o=n?e:i(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins(`beforeEvent`,n,r)===!1)return;let i=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,r),(i||n.changed)&&this.render(),this}_handleEvent(e,t,n){let{_active:r=[],options:i}=this,a=t,o=this._getActiveElements(e,r,n,a),s=Me(e),c=Ur(e,this._lastEvent,n,s);n&&(this._lastEvent=null,z(i.onHover,[e,o,this],this),s&&z(i.onClick,[e,o,this],this));let l=!je(o,r);return(l||t)&&(this._active=o,this._updateHoverStyles(o,r,t)),this._lastEvent=c,l}_getActiveElements(e,t,n,r){if(e.type===`mouseout`)return[];if(!n)return t;let i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}}function Wr(){return F(Chart.instances,e=>e._plugins.invalidate())}function Gr(e,t,n){let{startAngle:r,x:i,y:a,outerRadius:o,innerRadius:s,options:c}=t,{borderWidth:l,borderJoinStyle:u}=c,d=Math.min(l/o,V(r-n));if(e.beginPath(),e.arc(i,a,o-l/2,r+d/2,n-d/2),s>0){let t=Math.min(l/s,V(r-n));e.arc(i,a,s+l/2,n-t/2,r+t/2,!0)}else{let t=Math.min(l/2,o*V(r-n));if(u===`round`)e.arc(i,a,t,n-b/2,r+b/2,!0);else if(u===`bevel`){let o=2*t*t,s=-o*Math.cos(n+b/2)+i,c=-o*Math.sin(n+b/2)+a,l=o*Math.cos(r+b/2)+i,u=o*Math.sin(r+b/2)+a;e.lineTo(s,c),e.lineTo(l,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function Kr(e,t,n){let{startAngle:r,pixelMargin:i,x:a,y:o,outerRadius:s,innerRadius:c}=t,l=i/s;e.beginPath(),e.arc(a,o,s,r-l,n+l),c>i?(l=i/c,e.arc(a,o,c,n+l,r-l,!0)):e.arc(a,o,i,n+y,r-y),e.closePath(),e.clip()}function qr(e){return Ne(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function Jr(e,t,n,r){let i=qr(e.options.borderRadius),a=(n-t)/2,o=Math.min(a,r*t/2),s=e=>{let t=(n-Math.min(a,e))*r/2;return B(e,0,Math.min(a,t))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:B(i.innerStart,0,o),innerEnd:B(i.innerEnd,0,o)}}function Yr(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Xr(e,t,n,r){let{x:i,y:a,startAngle:o,pixelMargin:s,innerRadius:c}=t,l=Math.max(t.outerRadius+r+n-s,0),u=c>0?c+r+n+s:0;e.beginPath(),e.arc(i,a,l,o,o+_),u>0&&(e.moveTo(i+Math.cos(o)*u,a+Math.sin(o)*u),e.arc(i,a,u,o+_,o,!0)),e.closePath()}function Zr(e,t,n,r,i,a){let{x:o,y:s,startAngle:c,pixelMargin:l,innerRadius:u}=t,{spacingMode:d=`angular`}=t.options,f=i-c;if(a&&t.options.selfJoin&&Math.abs(f)>=_-1e-4){Xr(e,t,n,r);return}let p=Math.max(t.outerRadius+r+n-l,0),m=u>0?u+r+n+l:0,h=0,g=0,v=p>0?Math.max(.001,f*p-n/b)/p:.001,x=(f-v)/2;if(r){let e=((u>0?u-r:0)+(p>0?p-r:0))/2,t=(f-(e===0?f:f*e/(e+r)))/2,n=e>0?Math.asin(Math.min(1,r/e)):0,i=Math.max(0,v/2-.001),a=Math.sin(i);if(d===`parallel`){if(m===0&&a>0){let e=r/a,t=Math.max(0,p-.001);m=Math.min(e,t)}let e=Math.min(p>0?p*a:1/0,m>0?m*a:1/0),t=Math.min(r,e);h=p>0?Math.asin(Math.min(1,t/p)):Math.min(i,n),g=m>0?Math.asin(Math.min(1,t/m)):h}else d===`proportional`?(h=Math.min(i,t),g=Math.min(i,t)):(h=Math.min(i,n),g=Math.min(i,n))}let S=c+x+h,C=i-x-h,w=c+x+g,T=i-x-g,E=Math.min(C-S,T-w),{outerStart:D,outerEnd:O,innerStart:k,innerEnd:A}=Jr(t,m,p,E),j=p-D,M=p-O,N=S+D/j,P=C-O/M,F=m+k,ee=m+A,te=w+k/F,ne=T-A/ee;if(e.beginPath(),a){let t=(N+P)/2;if(e.arc(o,s,p,N,t),e.arc(o,s,p,t,P),O>0){let t=Yr(M,P,o,s);e.arc(t.x,t.y,O,P,C+y)}let n=Yr(ee,T,o,s);if(e.lineTo(n.x,n.y),A>0){let t=Yr(ee,ne,o,s);e.arc(t.x,t.y,A,T+y,ne+Math.PI)}let r=(T-A/m+(w+k/m))/2;if(e.arc(o,s,m,T-A/m,r,!0),e.arc(o,s,m,r,w+k/m,!0),k>0){let t=Yr(F,te,o,s);e.arc(t.x,t.y,k,te+Math.PI,w-y)}let i=Yr(j,S,o,s);if(e.lineTo(i.x,i.y),D>0){let t=Yr(j,N,o,s);e.arc(t.x,t.y,D,S-y,N)}}else{e.moveTo(o,s);let t=Math.cos(N)*p+o,n=Math.sin(N)*p+s;e.lineTo(t,n);let r=Math.cos(P)*p+o,i=Math.sin(P)*p+s;e.lineTo(r,i)}e.closePath()}function Qr(e,t,n,r,i){let{fullCircles:a,startAngle:o,circumference:s}=t,c=t.endAngle;if(a){Zr(e,t,n,r,c,i);for(let t=0;t=_-1e-4;if(a){Zr(e,t,n,r,h,i);for(let t=0;t0)&&c.selfJoin&&h-o>=b&&p===0&&u!==`miter`&&Gr(e,t,h),a||(Zr(e,t,n,r,h,i),e.stroke())}class ArcElement extends Element{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,spacingMode:`angular`,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:e=>e!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;circular;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,this.circular=!1,e&&Object.assign(this,e)}inRange(e,t,n){let{angle:r,distance:i}=M(this.getProps([`x`,`y`],n),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:s,outerRadius:c,circumference:l}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],n),d=(this.options.spacing+this.options.borderWidth)/2,f=u(l,o-a),p=v(r,a,o)&&a!==o,m=f>=_||p,h=H(i,s+d,c+d);return m&&h}getCenterPoint(e){let{x:t,y:n,startAngle:r,endAngle:i,innerRadius:a,outerRadius:o}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],e),{offset:s,spacing:c}=this.options,l=(r+i)/2,u=(a+o+c+s)/2;return{x:t+Math.cos(l)*u,y:n+Math.sin(l)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,r=(t.offset||0)/4,i=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=n>_?Math.floor(n/_):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let s=r*(1-Math.sin(Math.min(b,n||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,Qr(e,this,s,i,a),$r(e,this,s,i,a),e.restore()}}function ei(e,t,n=t){e.lineCap=u(n.borderCapStyle,t.borderCapStyle),e.setLineDash(u(n.borderDash,t.borderDash)),e.lineDashOffset=u(n.borderDashOffset,t.borderDashOffset),e.lineJoin=u(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=u(n.borderWidth,t.borderWidth),e.strokeStyle=u(n.borderColor,t.borderColor)}function ti(e,t,n){e.lineTo(n.x,n.y)}function ni(e){return e.stepped?Pe:e.tension||e.cubicInterpolationMode===`monotone`?Fe:ti}function ri(e,t,n={}){let r=e.length,{start:i=0,end:a=r-1}=n,{start:o,end:s}=t,c=Math.max(i,o),l=Math.min(a,s),u=is&&a>s;return{count:r,start:c,loop:t.loop,ilen:l(o+(l?s-e:e))%a,y=()=>{h!==g&&(e.lineTo(u,g),e.lineTo(u,h),e.lineTo(u,_))};for(c&&(p=i[v(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[v(f)],p.skip)continue;let t=p.x,n=p.y,r=t|0;r===m?(ng&&(g=n),u=(d*u+t)/++d):(y(),e.lineTo(t,n),m=r,d=0,h=g=n),_=n}y()}function oi(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!==`monotone`&&!t.stepped&&!n?ai:ii}function si(e){return e.stepped?Ie:e.tension||e.cubicInterpolationMode===`monotone`?Le:Re}function ci(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),ei(e,t.options),e.stroke(i)}function li(e,t,n,r){let{segments:i,options:a}=t,o=oi(t);for(let s of i)ei(e,a,s.style),e.beginPath(),o(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const ui=typeof Path2D==`function`;function di(e,t,n,r){ui&&!t.options.segment?ci(e,t,n,r):li(e,t,n,r)}class LineElement extends Element{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:e=>e!==`borderDash`&&e!==`fill`};constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,t){let n=this.options;if((n.tension||n.cubicInterpolationMode===`monotone`)&&!n.stepped&&!this._pointsUpdated){let r=n.spanGaps?this._loop:this._fullLoop;ze(this._points,n,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Be(this,this.options.segment))}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,n=e.length;return n&&t[e[n-1].end]}interpolate(e,t){let n=this.options,r=e[t],i=this.points,a=Ve(this,{property:t,start:r,end:r});if(!a.length)return;let o=[],s=si(n),c,l;for(c=0,l=a.length;ce.replace(`rgb(`,`rgba(`).replace(`)`,`, 0.5)`));function wi(e){return Si[e%Si.length]}function Ti(e){return Ci[e%Ci.length]}function Ei(e,t){return e.borderColor=wi(t),e.backgroundColor=Ti(t),++t}function Di(e,t){return e.backgroundColor=e.data.map(()=>wi(t++)),t}function Oi(e,t){return e.backgroundColor=e.data.map(()=>Ti(t++)),t}function ki(e){let t=0;return(n,r)=>{let i=e.getDatasetMeta(r).controller;i instanceof DoughnutController?t=Di(n,t):i instanceof PolarAreaController?t=Oi(n,t):i&&(t=Ei(n,t))}}function Ai(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function ji(e){return e&&(e.borderColor||e.backgroundColor)}function Mi(){return a.borderColor!==`rgba(0,0,0,0.1)`||a.backgroundColor!==`rgba(0,0,0,0.1)`}var Ni={id:`colors`,defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;let{data:{datasets:r},options:i}=e.config,{elements:a}=i,o=Ai(r)||ji(i)||a&&Ai(a)||Mi();if(!n.forceOverride&&o)return;let s=ki(e);r.forEach(s)}};function Pi(e,t,n,r,i){let a=i.samples||r;if(a>=n)return e.slice(t,t+n);let o=[],s=(n-2)/(a-2),c=0,l=t+n-1,u=t,d,f,p,m,h;for(o[c++]=e[u],d=0;dp&&(p=m,f=e[a],h=a);o[c++]=f,u=h}return o[c++]=e[l],o}function Fi(e,t,n,r){let i=0,a=0,o,s,c,l,u,d,f,p,m,h,_=[],v=t+n-1,y=e[t].x,b=e[v].x-y;for(o=t;oh&&(h=l,f=o),i=(a*i+s.x)/++a;else{let n=o-1;if(!g(d)&&!g(f)){let t=Math.min(d,f),r=Math.max(d,f);t!==p&&t!==n&&_.push({...e[t],x:i}),r!==p&&r!==n&&_.push({...e[r],x:i})}o>0&&n!==p&&_.push(e[n]),_.push(s),u=t,a=0,m=h=l,d=f=p=o}}return _}function Ii(e){if(e._decimated){let t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Li(e){e.data.datasets.forEach(e=>{Ii(e)})}function Ri(e,t){let n=t.length,r=0,i,{iScale:a}=e,{min:o,max:s,minDefined:c,maxDefined:l}=a.getUserBounds();return c&&(r=B(A(t,a.axis,o).lo,0,n-1)),i=l?B(A(t,a.axis,s).hi+1,r,n)-r:n-r,{start:r,count:i}}var zi={id:`decimation`,defaults:{algorithm:`min-max`,enabled:!1},beforeElementsUpdate:(e,t,r)=>{if(!r.enabled){Li(e);return}let i=e.width;e.data.datasets.forEach((t,a)=>{let{_data:o,indexAxis:s}=t,c=e.getDatasetMeta(a),l=o||t.data;if(n([s,e.options.indexAxis])===`y`||!c.controller.supportsDecimation)return;let u=e.scales[c.xAxisID];if(u.type!==`linear`&&u.type!==`time`||e.options.parsing)return;let{start:d,count:f}=Ri(c,l);if(f<=(r.threshold||4*i)){Ii(t);return}g(o)&&(t._data=l,delete t.data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(e){this._data=e}}));let p;switch(r.algorithm){case`lttb`:p=Pi(l,d,f,i,r);break;case`min-max`:p=Fi(l,d,f,i);break;default:throw Error(`Unsupported decimation algorithm '${r.algorithm}'`)}t._decimated=p})},destroy(e){Li(e)}};function Bi(e,t,n){let r=e.segments,i=e.points,a=t.points,o=[];for(let e of r){let{start:r,end:s}=e;s=Ui(r,s,i);let c=Vi(n,i[r],i[s],e.loop);if(!t.segments){o.push({source:e,target:c,start:i[r],end:i[s]});continue}let l=Ve(t,c);for(let t of l){let r=Vi(n,a[t.start],a[t.end],t.loop),s=Ge(e,i,r);for(let e of s)o.push({source:e,target:t,start:{[n]:Wi(c,r,`start`,Math.max)},end:{[n]:Wi(c,r,`end`,Math.min)}})}}return o}function Vi(e,t,n,r){if(r)return;let i=t[e],a=n[e];return e===`angle`&&(i=V(i),a=V(a)),{property:e,start:i,end:a}}function Hi(e,t){let{x:n=null,y:r=null}=e||{},i=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=Ui(e,t,i);let o=i[e],s=i[t];r===null?n!==null&&(a.push({x:n,y:o.y}),a.push({x:n,y:s.y})):(a.push({x:o.x,y:r}),a.push({x:s.x,y:r}))}),a}function Ui(e,t,n){for(;t>e;t--){let e=n[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function Wi(e,t,n,r){return e&&t?r(e[n],t[n]):e?e[n]:t?t[n]:0}function Gi(e,t){let n=[],r=!1;return o(e)?(r=!0,n=e):n=Hi(e,t),n.length?new LineElement({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function Ki(e){return e&&e.fill!==!1}function qi(e,t,n){let r=e[t].fill,i=[t],a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!s(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function Ji(e,t,n){let r=Qi(e);if(i(r))return isNaN(r.value)?!1:r;let a=parseFloat(r);return s(a)&&Math.floor(a)===a?Yi(r[0],t,a,n):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(r)>=0&&r}function Yi(e,t,n,r){return(e===`-`||e===`+`)&&(n=t+n),n===t||n<0||n>=r?!1:n}function Xi(e,t){let n=null;return e===`start`?n=t.bottom:e===`end`?n=t.top:i(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Zi(e,t,n){let r;return r=e===`start`?n:e===`end`?t.options.reverse?t.min:t.max:i(e)?e.value:t.getBaseValue(),r}function Qi(e){let t=e.options,n=t.fill,r=u(n&&n.target,n);return r===void 0&&(r=!!t.backgroundColor),r===!1||r===null?!1:r===!0?`origin`:r}function $i(e){let{scale:t,index:n,line:r}=e,i=[],a=r.segments,o=r.points,s=ea(t,n);s.push(Gi({x:null,y:t.bottom},r));for(let e=0;e=0;--t){let n=i[t].$filler;n&&(n.line.updateControlPoints(a,n.axis),r&&n.fill&&ca(e.ctx,n,a))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!==`beforeDatasetsDraw`)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let n=r[t].$filler;Ki(n)&&ca(e.ctx,n,e.chartArea)}},beforeDatasetDraw(e,t,n){let r=t.meta.$filler;!Ki(r)||n.drawTime!==`beforeDatasetDraw`||ca(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}};const _a=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},va=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Legend extends Element{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=z(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,n)=>e.sort(t,n,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=I(n.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:s}=_a(n,i),c,l;t.font=r.string,this.isHorizontal()?(c=this.maxWidth,l=this._fitRows(a,i,o,s)+10):(l=this.maxHeight,c=this._fitCols(a,r,o,s)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(l,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){let{ctx:i,maxWidth:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.lineWidths=[0],l=r+o,u=e;i.textAlign=`left`,i.textBaseline=`middle`;let d=-1,f=-l;return this.legendItems.forEach((e,p)=>{let m=n+t/2+i.measureText(e.text).width;(p===0||c[c.length-1]+m+2*o>a)&&(u+=l,c[c.length-(p>0?0:1)]=0,f+=l,d++),s[p]={left:0,top:f,row:d,width:m,height:r},c[c.length-1]+=m+o}),u}_fitCols(e,t,n,r){let{ctx:i,maxHeight:a,options:{labels:{padding:o}}}=this,s=this.legendHitBoxes=[],c=this.columnSizes=[],l=a-e,u=o,d=0,f=0,p=0,m=0;return this.legendItems.forEach((e,a)=>{let{itemWidth:h,itemHeight:g}=ya(n,t,i,e,r);a>0&&f+g+2*o>l&&(u+=d+o,c.push({width:d,height:f}),p+=d+o,m++,d=f=0),s[a]={left:p,top:f,col:m,width:h,height:g},d=Math.max(d,h),f+=g+o}),u+=d,c.push({width:d,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:i}}=this,a=Ke(i,this.left,this.width);if(this.isHorizontal()){let i=0,o=L(n,this.left+r,this.right-this.lineWidths[i]);for(let s of t)i!==s.row&&(i=s.row,o=L(n,this.left+r,this.right-this.lineWidths[i])),s.top+=this.top+e+r,s.left=a.leftForLtr(a.x(o),s.width),o+=s.width+r}else{let i=0,o=L(n,this.top+e+r,this.bottom-this.columnSizes[i].height);for(let s of t)s.col!==i&&(i=s.col,o=L(n,this.top+e+r,this.bottom-this.columnSizes[i].height)),s.top=o,s.left+=this.left+r,s.left=a.leftForLtr(a.x(s.left),s.width),o+=s.height+r}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let e=this.ctx;pe(e,this),this._draw(),he(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:i,labels:o}=e,s=a.color,c=Ke(e.rtl,this.left,this.width),l=I(o.font),{padding:d}=o,f=l.size,p=f/2,m;this.drawTitle(),r.textAlign=c.textAlign(`left`),r.textBaseline=`middle`,r.lineWidth=.5,r.font=l.string;let{boxWidth:h,boxHeight:g,itemHeight:_}=_a(o,f),v=function(e,t,n){if(isNaN(h)||h<=0||isNaN(g)||g<0)return;r.save();let i=u(n.lineWidth,1);if(r.fillStyle=u(n.fillStyle,s),r.lineCap=u(n.lineCap,`butt`),r.lineDashOffset=u(n.lineDashOffset,0),r.lineJoin=u(n.lineJoin,`miter`),r.lineWidth=i,r.strokeStyle=u(n.strokeStyle,s),r.setLineDash(u(n.lineDash,[])),o.usePointStyle)qe(r,{radius:g*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:i},c.xPlus(e,h/2),t+p,o.pointStyleWidth&&h);else{let a=t+Math.max((f-g)/2,0),o=c.leftForLtr(e,h),s=U(n.borderRadius);r.beginPath(),Object.values(s).some(e=>e!==0)?We(r,{x:o,y:a,w:h,h:g,radius:s}):r.rect(o,a,h,g),r.fill(),i!==0&&r.stroke()}r.restore()},y=function(e,t,n){me(r,n.text,e,t+_/2,l,{strikethrough:n.hidden,textAlign:c.textAlign(n.textAlign)})},b=this.isHorizontal(),x=this._computeTitleHeight();m=b?{x:L(i,this.left+d,this.right-n[0]),y:this.top+d+x,line:0}:{x:this.left+d,y:L(i,this.top+x+d,this.bottom-t[0].height),line:0},Je(this.ctx,e.textDirection);let S=_+d;this.legendItems.forEach((a,s)=>{r.strokeStyle=a.fontColor,r.fillStyle=a.fontColor;let u=r.measureText(a.text).width,f=c.textAlign(a.textAlign||(a.textAlign=o.textAlign)),g=h+p+u,_=m.x,C=m.y;if(c.setWidth(this.width),b?s>0&&_+g+d>this.right&&(C=m.y+=S,m.line++,_=m.x=L(i,this.left+d,this.right-n[m.line])):s>0&&C+S>this.bottom&&(_=m.x=_+t[m.line].width+d,m.line++,C=m.y=L(i,this.top+x+d,this.bottom-t[m.line].height)),v(c.x(_),C,a),_=Ye(f,_+h+p,b?_+g:this.right,e.rtl),y(c.x(_),C,a),b)m.x+=g+d;else if(typeof a.text!=`string`){let e=l.lineHeight;m.y+=Sa(a,e)+d}else m.y+=S}),Xe(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=I(t.font),r=P(t.padding);if(!t.display)return;let i=Ke(e.rtl,this.left,this.width),a=this.ctx,o=t.position,s=n.size/2,c=r.top+s,l,u=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+c,u=L(e.align,u,this.right-d);else{let t=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);l=c+L(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}let f=L(o,u,u+d);a.textAlign=i.textAlign(se(o)),a.textBaseline=`middle`,a.strokeStyle=t.color,a.fillStyle=t.color,a.font=n.string,me(a,t.text,f,l,n)}_computeTitleHeight(){let e=this.options.title,t=I(e.font),n=P(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,i;if(H(e,this.left,this.right)&&H(t,this.top,this.bottom)){for(i=this.legendHitBoxes,n=0;ne.length>t.length?e:t)),t+n.size/2+r.measureText(i).width}function xa(e,t,n){let r=e;return typeof t.text!=`string`&&(r=Sa(t,n)),r}function Sa(e,t){return t*(e.text?e.text.length:0)}function Ca(e,t){return!!((e===`mousemove`||e===`mouseout`)&&(t.onHover||t.onLeave)||t.onClick&&(e===`click`||e===`mouseup`))}var wa={id:`legend`,_element:Legend,start(e,t,n){let r=e.legend=new Legend({ctx:e.ctx,options:n,chart:e});K.configure(e,r,n),K.addBox(e,r)},stop(e){K.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){let r=e.legend;K.configure(e,r,n),r.options=n},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){let r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:a,useBorderRadius:o,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(n?0:void 0),l=P(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(s||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}};class Title extends Element{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=o(n.text)?n.text.length:1;this._padding=P(n.padding);let i=r*I(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){let e=this.options.position;return e===`top`||e===`bottom`}_drawArgs(e){let{top:t,left:n,bottom:r,right:i,options:a}=this,o=a.align,s=0,c,l,u;return this.isHorizontal()?(l=L(o,n,i),u=t+e,c=i-n):(a.position===`left`?(l=n+e,u=L(o,r,t),s=b*-.5):(l=i-e,u=L(o,t,r),s=b*.5),c=r-t),{titleX:l,titleY:u,maxWidth:c,rotation:s}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=I(t.font),r=n.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:o,rotation:s}=this._drawArgs(r);me(e,t.text,0,0,n,{color:t.color,maxWidth:o,rotation:s,textAlign:se(t.align),textBaseline:`middle`,translation:[i,a]})}}function Ta(e,t){let n=new Title({ctx:e.ctx,options:t,chart:e});K.configure(e,n,t),K.addBox(e,n),e.titleBlock=n}var Ea={id:`title`,_element:Title,start(e,t,n){Ta(e,n)},stop(e){let t=e.titleBlock;K.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){let r=e.titleBlock;K.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}};const Da=/* @__PURE__ */ new WeakMap;var Oa={id:`subtitle`,start(e,t,n){let r=new Title({ctx:e.ctx,options:n,chart:e});K.configure(e,r,n),K.addBox(e,r),Da.set(e,r)},stop(e){K.removeBox(e,Da.get(e)),Da.delete(e)},beforeUpdate(e,t,n){let r=Da.get(e);K.configure(e,r,n),r.options=n},defaults:{align:`center`,display:!1,font:{weight:`normal`},fullSize:!0,padding:0,position:`top`,text:``,weight:1500},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}};const ka={average(e){if(!e.length)return!1;let t,n,r=/* @__PURE__ */ new Set,i=0,a=0;for(t=0,n=e.length;te+t)/r.size,y:i/a}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=1/0,a,o,s;for(a=0,o=e.length;a-1?e.split(` +`):e}function Aa(e,t){let{element:n,datasetIndex:r,index:i}=t,a=e.getDatasetMeta(r).controller,{label:o,value:s}=a.getLabelAndValue(i);return{chart:e,label:o,parsed:a.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:a.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function ja(e,t){let n=e.chart.ctx,{body:r,footer:i,title:a}=e,{boxWidth:o,boxHeight:s}=t,c=I(t.bodyFont),l=I(t.titleFont),u=I(t.footerFont),d=a.length,f=i.length,p=r.length,m=P(t.padding),h=m.height,g=0,_=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,d&&(h+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){let e=t.displayColors?Math.max(s,c.lineHeight):c.lineHeight;h+=p*e+(_-p)*c.lineHeight+(_-1)*t.bodySpacing}f&&(h+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0,y=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=l.string,F(e.title,y),n.font=c.string,F(e.beforeBody.concat(e.afterBody),y),v=t.displayColors?o+2+t.boxPadding:0,F(r,e=>{F(e.before,y),F(e.lines,y),F(e.after,y)}),v=0,n.font=u.string,F(e.footer,y),n.restore(),g+=m.width,{width:g,height:h}}function Ma(e,t){let{y:n,height:r}=t;return ne.height-r/2?`bottom`:`center`}function Na(e,t,n,r){let{x:i,width:a}=r,o=n.caretSize+n.caretPadding;if(e===`left`&&i+a+o>t.width||e===`right`&&i-a-o<0)return!0}function Pa(e,t,n,r){let{x:i,width:a}=n,{width:o,chartArea:{left:s,right:c}}=e,l=`center`;return r===`center`?l=i<=(s+c)/2?`left`:`right`:i<=a/2?l=`left`:i>=o-a/2&&(l=`right`),Na(l,e,t,n)&&(l=`center`),l}function Fa(e,t,n){let r=n.yAlign||t.yAlign||Ma(e,n);return{xAlign:n.xAlign||t.xAlign||Pa(e,t,n,r),yAlign:r}}function Ia(e,t){let{x:n,width:r}=e;return t===`right`?n-=r:t===`center`&&(n-=r/2),n}function La(e,t,n){let{y:r,height:i}=e;return t===`top`?r+=n:t===`bottom`?r-=i+n:r-=i/2,r}function Ra(e,t,n,r){let{caretSize:i,caretPadding:a,cornerRadius:o}=e,{xAlign:s,yAlign:c}=n,l=i+a,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=U(o),m=Ia(t,s),h=La(t,c,l);return c===`center`?s===`left`?m+=l:s===`right`&&(m-=l):s===`left`?m-=Math.max(u,f)+i:s===`right`&&(m+=Math.max(d,p)+i),{x:B(m,0,r.width-t.width),y:B(h,0,r.height-t.height)}}function za(e,t,n){let r=P(n.padding);return t===`center`?e.x+e.width/2:t===`right`?e.x+e.width-r.right:e.x+r.left}function Ba(e){return Y([],X(e))}function Va(e,t,n){return l(e,{tooltip:t,tooltipItems:n,type:`tooltip`})}function Ha(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Ua={beforeTitle:W,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode===`dataset`)return t.dataset.label||``;if(t.label)return t.label;if(r>0&&t.dataIndex{let t={before:[],lines:[],after:[]},i=Ha(n,e);Y(t.before,X(Z(i,`beforeLabel`,this,e))),Y(t.lines,Z(i,`label`,this,e)),Y(t.after,X(Z(i,`afterLabel`,this,e))),r.push(t)}),r}getAfterBody(e,t){return Ba(Z(t.callbacks,`afterBody`,this,e))}getFooter(e,t){let{callbacks:n}=t,r=Z(n,`beforeFooter`,this,e),i=Z(n,`footer`,this,e),a=Z(n,`afterFooter`,this,e),o=[];return o=Y(o,X(r)),o=Y(o,X(i)),o=Y(o,X(a)),o}_createItems(e){let t=this._active,n=this.chart.data,r=[],i=[],a=[],o=[],s,c;for(s=0,c=t.length;se.filter(t,r,i,n))),e.itemSort&&(o=o.sort((t,r)=>e.itemSort(t,r,n))),F(o,t=>{let n=Ha(e.callbacks,t);r.push(Z(n,`labelColor`,this,t)),i.push(Z(n,`labelPointStyle`,this,t)),a.push(Z(n,`labelTextColor`,this,t))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=o,o}update(e,t){let n=this.options.setContext(this.getContext()),r=this._active,i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{let e=ka[n.position].call(this,r,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let t=this._size=ja(this,n),o=Object.assign({},e,t),s=Fa(this.chart,n,o),c=Ra(n,o,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){let i=this.getCaretPosition(e,n,r);t.lineTo(i.x1,i.y1),t.lineTo(i.x2,i.y2),t.lineTo(i.x3,i.y3)}getCaretPosition(e,t,n){let{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:o}=n,{topLeft:s,topRight:c,bottomLeft:l,bottomRight:u}=U(o),{x:d,y:f}=e,{width:p,height:m}=t,h,g,_,v,y,b;return i===`center`?(y=f+m/2,r===`left`?(h=d,g=h-a,v=y+a,b=y-a):(h=d+p,g=h+a,v=y-a,b=y+a),_=h):(g=r===`left`?d+Math.max(s,l)+a:r===`right`?d+p-Math.max(c,u)-a:this.caretX,i===`top`?(v=f,y=v-a,h=g-a,_=g+a):(v=f+m,y=v+a,h=g+a,_=g-a),b=v),{x1:h,x2:g,x3:_,y1:v,y2:y,y3:b}}drawTitle(e,t,n){let r=this.title,i=r.length,a,o,s;if(i){let c=Ke(n.rtl,this.x,this.width);for(e.x=za(this,n.titleAlign,n),t.textAlign=c.textAlign(n.titleAlign),t.textBaseline=`middle`,a=I(n.titleFont),o=n.titleSpacing,t.fillStyle=n.titleColor,t.font=a.string,s=0;se!==0)?(e.beginPath(),e.fillStyle=a.multiKeyBackground,We(e,{x:t,y:m,w:l,h:c,radius:s}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),We(e,{x:n,y:m+1,w:l-2,h:c-2,radius:s}),e.fill()):(e.fillStyle=a.multiKeyBackground,e.fillRect(t,m,l,c),e.strokeRect(t,m,l,c),e.fillStyle=o.backgroundColor,e.fillRect(n,m+1,l-2,c-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){let{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:o,boxHeight:s,boxWidth:c,boxPadding:l}=n,u=I(n.bodyFont),d=u.lineHeight,f=0,p=Ke(n.rtl,this.x,this.width),m=function(n){t.fillText(n,p.x(e.x+f),e.y+d/2),e.y+=d+i},h=p.textAlign(a),g,_,v,y,b,x,S;for(t.textAlign=a,t.textBaseline=`middle`,t.font=u.string,e.x=za(this,h,n),t.fillStyle=n.bodyColor,F(this.beforeBody,m),f=o&&h!==`right`?a===`center`?c/2+l:c+2+l:0,y=0,x=r.length;y0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,n=this.$animations,r=n&&n.x,i=n&&n.y;if(r||i){let n=ka[e.position].call(this,this._active,this._eventPosition);if(!n)return;let a=this._size=ja(this,e),o=Object.assign({},n,this._size),s=Fa(t,e,o),c=Ra(e,o,s,t);(r._to!==c.x||i._to!==c.y)&&(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=a.width,this.height=a.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},i={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=P(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&o&&(e.save(),e.globalAlpha=n,this.drawBackground(i,e,r,t),Je(e,t.textDirection),i.y+=a.top,this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),Xe(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let n=this._active,r=e.map(({datasetIndex:e,index:t})=>{let n=this.chart.getDatasetMeta(e);if(!n)throw Error(`Cannot find a dataset at index `+e);return{datasetIndex:e,element:n.data[t],index:t}}),i=!je(n,r),a=this._positionChanged(r,t);(i||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,i=this._active||[],a=this._getActiveElements(e,i,t,n),o=this._positionChanged(a,e),s=t||!je(a,i)||o;return s&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){let i=this.options;if(e.type===`mouseout`)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)!==void 0);let a=this.chart.getElementsAtEventForMode(e,i.mode,i,n);return i.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:n,caretY:r,options:i}=this,a=ka[i.position].call(this,e,t);return a!==!1&&(n!==a.x||r!==a.y)}}var Wa={id:`tooltip`,_element:Tooltip,positioners:ka,afterInit(e,t,n){n&&(e.tooltip=new Tooltip({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let n={tooltip:t};if(e.notifyPlugins(`beforeTooltipDraw`,{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,n)}},afterEvent(e,t){if(e.tooltip){let n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:Ua},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]},Ga=/* @__PURE__ */ Object.freeze({__proto__:null,Colors:Ni,Decimation:zi,Filler:ga,Legend:wa,SubTitle:Oa,Title:Ea,Tooltip:Wa});const Ka=(e,t,n,r)=>(typeof t==`string`?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function qa(e,t,n,r){let i=e.indexOf(t);return i===-1?Ka(e,t,n,r):i===e.lastIndexOf(t)?i:n}const Ja=(e,t)=>e===null?null:B(Math.round(e),0,t);function Ya(e){let t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function Xa(e,t){let n=[],r=1e-14,{bounds:i,step:a,min:o,max:s,precision:c,count:l,maxTicks:u,maxDigits:d,includeBounds:f}=e,p=a||1,m=u-1,{min:h,max:_}=t,v=!g(o),y=!g(s),b=!g(l),x=(_-h)/(d+1),S=Qe((_-h)/m/p)*p,C,w,T,E;if(S<1e-14&&!v&&!y)return[{value:h},{value:_}];E=Math.ceil(_/S)-Math.floor(h/S),E>m&&(S=Qe(E*S/m/p)*p),g(c)||(C=10**c,S=Math.ceil(S*C)/C),i===`ticks`?(w=Math.floor(h/S)*S,T=Math.ceil(_/S)*S):(w=h,T=_),v&&y&&a&&$e((s-o)/a,S/1e3)?(E=Math.round(Math.min((s-o)/S,u)),S=(s-o)/E,w=o,T=s):b?(w=v?o:w,T=y?s:T,E=l-1,S=(T-w)/E):(E=(T-w)/S,E=et(E,Math.round(E),S/1e3)?Math.round(E):Math.ceil(E));let D=Math.max(tt(S),tt(w));C=10**(g(c)?D:c),w=Math.round(w*C)/C,T=Math.round(T*C)/C;let O=0;for(v&&(f&&w!==o?(n.push({value:o}),ws)break;n.push({value:e})}return y&&f&&T!==s?n.length&&et(n[n.length-1].value,s,Za(s,x,e))?n[n.length-1].value=s:n.push({value:s}):(!y||T===s)&&n.push({value:T}),n}function Za(e,t,{horizontal:n,minRotation:r}){let i=x(r),a=(n?Math.sin(i):Math.cos(i))||.001,o=.75*t*(``+e).length;return Math.min(t/a,o)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return g(e)||(typeof e==`number`||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:r,max:i}=this,a=e=>r=t?r:e,o=e=>i=n?i:e;if(e){let e=c(r),t=c(i);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===i){let t=i===0?1:Math.abs(i*.05);o(i+t),e||a(r-t)}this.min=r,this.max=i}getTickLimit(){let{maxTicksLimit:e,stepSize:t}=this.options.ticks,n;return t?(n=Math.ceil(this.max/t)-Math.floor(this.min/t)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${t} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let r=Xa({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return e.bounds===`ticks`&&nt(r,this,`value`),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return w(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{static id=`linear`;static defaults={ticks:{callback:rt.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=s(e)?e:0,this.max=s(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=x(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}const Qa=e=>Math.floor(it(e)),Q=(e,t)=>10**(Qa(e)+t);function $a(e){return e/10**Qa(e)==1}function eo(e,t,n){let r=10**n,i=Math.floor(e/r);return Math.ceil(t/r)-i}function to(e,t){let n=Qa(t-e);for(;eo(e,t,n)>10;)n++;for(;eo(e,t,n)<10;)n--;return Math.min(n,Qa(e))}function no(e,{min:t,max:n}){t=R(e.min,t);let r=[],i=Qa(t),a=to(t,n),o=a<0?10**Math.abs(a):1,s=10**a,c=i>a?10**i:0,l=Math.round((t-c)*o)/o,u=Math.floor((t-c)/s/10)*s*10,d=Math.floor((l-u)/10**a),f=R(e.min,Math.round((c+u+d*10**a)*o)/o);for(;f=10?d=d<15?15:20:d++,d>=20&&(a++,d=2,o=a>=0?1:o),f=Math.round((c+u+d*10**a)*o)/o;let p=R(e.max,f);return r.push({value:p,major:$a(p),significand:d}),r}class LogarithmicScale extends Scale{static id=`logarithmic`;static defaults={ticks:{callback:rt.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=LinearScaleBase.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return s(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=s(e)?Math.max(0,e):null,this.max=s(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!s(this._userMin)&&(this.min=e===Q(this.min,0)?Q(this.min,-1):Q(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,r=this.max,i=t=>n=e?n:t,a=e=>r=t?r:e;n===r&&(n<=0?(i(1),a(10)):(i(Q(n,-1)),a(Q(r,1)))),n<=0&&i(Q(r,-1)),r<=0&&a(Q(n,1)),this.min=n,this.max=r}buildTicks(){let e=this.options,t=no({min:this._userMin,max:this._userMax},this);return e.bounds===`ticks`&&nt(t,this,`value`),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return e===void 0?`0`:w(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=it(e),this._valueRange=it(this.max)-it(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(it(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return 10**(this._startValue+t*this._valueRange)}}function ro(e){let t=e.ticks;if(t.display&&e.display){let e=P(t.backdropPadding);return u(t.font&&t.font.size,a.font.size)+e.height}return 0}function io(e,t,n){return n=o(n)?n:[n],{w:at(e,t.string,n),h:n.length*t.lineHeight}}function ao(e,t,n,r,i){return e===r||e===i?{start:t-n/2,end:t+n/2}:ei?{start:t-n,end:t}:{start:t,end:t+n}}function oo(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),r=[],i=[],a=e._pointLabels.length,o=e.options.pointLabels,s=o.centerPointLabels?b/a:0;for(let c=0;ct.r&&(s=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+s)),i.startt.b&&(c=(i.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}function co(e,t,n){let r=e.drawingArea,{extra:i,additionalAngle:a,padding:o,size:s}=n,c=e.getPointPosition(t,r+i+o,a),l=Math.round(le(V(c.angle+y))),u=mo(c.y,s.h,l),d=fo(l),f=po(c.x,s.w,d);return{visible:!0,x:c.x,y:u,textAlign:d,left:f,top:u,right:f+s.w,bottom:u+s.h}}function lo(e,t){if(!t)return!0;let{left:n,top:r,right:i,bottom:a}=e;return!(j({x:n,y:r},t)||j({x:n,y:a},t)||j({x:i,y:r},t)||j({x:i,y:a},t))}function uo(e,t,n){let r=[],i=e._pointLabels.length,a=e.options,{centerPointLabels:o,display:s}=a.pointLabels,c={extra:ro(a)/2,additionalAngle:o?b/i:0},l;for(let a=0;a270||n<90)&&(e-=t),e}function ho(e,t,n){let{left:r,top:i,right:a,bottom:o}=n,{backdropColor:s}=t;if(!g(s)){let n=U(t.borderRadius),c=P(t.backdropPadding);e.fillStyle=s;let l=r-c.left,u=i-c.top,d=a-r+c.width,f=o-i+c.height;Object.values(n).some(e=>e!==0)?(e.beginPath(),We(e,{x:l,y:u,w:d,h:f,radius:n}),e.fill()):e.fillRect(l,u,d,f)}}function go(e,t){let{ctx:n,options:{pointLabels:r}}=e;for(let i=t-1;i>=0;i--){let t=e._pointLabelItems[i];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(i));ho(n,a,t);let o=I(a.font),{x:s,y:c,textAlign:l}=t;me(n,e._pointLabels[i],s,c+o.lineHeight/2,o,{color:a.color,textAlign:l,textBaseline:`middle`})}}function _o(e,t,n,r){let{ctx:i}=e;if(n)i.arc(e.xCenter,e.yCenter,t,0,_);else{let n=e.getPointPosition(0,t);i.moveTo(n.x,n.y);for(let a=1;a{let n=z(this.options.pointLabels.callback,[e,t],this);return n||n===0?n:``}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?oo(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,r))}getIndexAngle(e){let t=_/(this._pointLabels.length||1),n=this.options.startAngle||0;return V(e*t+x(n))}getDistanceFromCenterForValue(e){if(g(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(g(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e{if(t!==0||t===0&&this.min<0){s=this.getDistanceFromCenterForValue(e.value);let n=this.getContext(t),o=r.setContext(n),c=i.setContext(n);vo(this,o,s,a,c)}}),n.display){for(e.save(),o=a-1;o>=0;o--){let r=n.setContext(this.getPointLabelContext(o)),{color:i,lineWidth:a}=r;!a||!i||(e.lineWidth=a,e.strokeStyle=i,e.setLineDash(r.borderDash),e.lineDashOffset=r.borderDashOffset,s=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(o,s),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let r=this.getIndexAngle(0),i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign=`center`,e.textBaseline=`middle`,this.ticks.forEach((r,o)=>{if(o===0&&this.min>=0&&!t.reverse)return;let s=n.setContext(this.getContext(o)),c=I(s.font);if(i=this.getDistanceFromCenterForValue(this.ticks[o].value),s.showLabelBackdrop){e.font=c.string,a=e.measureText(r.label).width,e.fillStyle=s.backdropColor;let t=P(s.backdropPadding);e.fillRect(-a/2-t.left,-i-c.size/2-t.top,a+t.width,c.size+t.height)}me(e,r.label,0,-i,c,{color:s.color,strokeColor:s.textStrokeColor,strokeWidth:s.textStrokeWidth})}),e.restore()}drawTitle(){}}const bo={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},$=/* @__PURE__ */ Object.keys(bo);function xo(e,t){return e-t}function So(e,t){if(g(t))return null;let n=e._adapter,{parser:r,round:i,isoWeekday:a}=e._parseOpts,o=t;return typeof r==`function`&&(o=r(o)),s(o)||(o=typeof r==`string`?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i===`week`&&(D(a)||a===!0)?n.startOf(o,`isoWeek`,a):n.startOf(o,i)),+o)}function Co(e,t,n,r){let i=$.length;for(let a=$.indexOf(e);a=$.indexOf(n);a--){let n=$[a];if(bo[n].common&&e._adapter.diff(i,r,n)>=t-1)return n}return $[n?$.indexOf(n):0]}function To(e){for(let t=$.indexOf(e)+1,n=$.length;t=t?n[r]:n[i];e[a]=!0}}function Do(e,t,n,r){let i=e._adapter,a=+i.startOf(t[0].value,r),o=t[t.length-1].value,s,c;for(s=a;s<=o;s=+i.add(s,1,r))c=n[s],c>=0&&(t[c].major=!0);return t}function Oo(e,t,n){let r=[],i={},a=t.length,o,s;for(o=0;o+e.value))}initOffsets(e=[]){let t=0,n=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),t=e.length===1?1-r:(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),n=e.length===1?i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;t=B(t,0,a),n=B(n,0,a),this._offsets={start:t,end:n,factor:1/(t+1+n)}}_generate(){let e=this._adapter,t=this.min,n=this.max,r=this.options,i=r.time,a=i.unit||Co(i.minUnit,t,n,this._getLabelCapacity(t)),o=u(r.ticks.stepSize,1),s=a===`week`?i.isoWeekday:!1,c=D(s)||s===!0,l={},d=t,f,p;if(c&&(d=+e.startOf(d,`isoWeek`,s)),d=+e.startOf(d,c?`day`:a),e.diff(n,t,a)>1e5*o)throw Error(t+` and `+n+` are too far apart with stepSize of `+o+` `+a);let m=r.ticks.source===`data`&&this.getDataTimestamps();for(f=d,p=0;f+e)}getLabelForValue(e){let t=this._adapter,n=this.options.time;return n.tooltipFormat?t.format(e,n.tooltipFormat):t.format(e,n.displayFormats.datetime)}format(e,t){let n=this.options.time.displayFormats,r=this._unit,i=t||n[r];return this._adapter.format(e,i)}_tickFormatFunction(e,t,n,r){let i=this.options,a=i.ticks.callback;if(a)return z(a,[e,t,n],this);let o=i.time.displayFormats,s=this._unit,c=this._majorUnit,l=s&&o[s],u=c&&o[c],d=n[t],f=c&&u&&d&&d.major;return this._adapter.format(e,r||(f?u:l))}generateTickLabels(e){let t,n,r;for(t=0,n=e.length;t0?o:1}getDataTimestamps(){let e=this._cache.data||[],t,n;if(e.length)return e;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(t=0,n=r.length;t=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=A(e,`pos`,t)),{pos:a,time:s}=e[r],{pos:o,time:c}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=A(e,`time`,t)),{time:a,pos:s}=e[r],{time:o,pos:c}=e[i]);let l=o-a;return l?s+(c-s)*(t-a)/l:s}class TimeSeriesScale extends TimeScale{static id=`timeseries`;static defaults=TimeScale.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=ko(t,this.min),this._tableRange=ko(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,r=[],i=[],a,o,s,c,l;for(a=0,o=e.length;a=t&&c<=n&&r.push(c);if(r.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(a=0,o=r.length;ae-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return e=t.length&&n.length?this.normalize(t.concat(n)):t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(ko(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return ko(this._table,n*this._tableRange+this._minPos,!0)}}var Ao=/* @__PURE__ */ Object.freeze({__proto__:null,CategoryScale,LinearScale,LogarithmicScale,RadialLinearScale,TimeScale,TimeSeriesScale});const jo=[qt,xi,Ga,Ao];export{Animation,Animations,ArcElement,BarController,BarElement,BasePlatform,BasicPlatform,BubbleController,CategoryScale,Chart,Ni as Colors,DatasetController,zi as Decimation,DomPlatform,DoughnutController,Element,ga as Filler,an as Interaction,wa as Legend,LineController,LineElement,LinearScale,LogarithmicScale,PieController,PointElement,PolarAreaController,RadarController,RadialLinearScale,Scale,ScatterController,Oa as SubTitle,rt as Ticks,TimeScale,TimeSeriesScale,Ea as Title,Wa as Tooltip,Yt as _adapters,Vn as _detectPlatform,G as animator,qt as controllers,a as defaults,xi as elements,K as layouts,Ga as plugins,jo as registerables,q as registry,Ao as scales}; +