{{ message }}
Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
23 lines (21 loc) · 199 KB
/
Copy pathapp.js
File metadata and controls
23 lines (21 loc) · 199 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var ac=Object.defineProperty;var cc=(e,t)=>{for(var n in t)ac(e,n,{get:t[n],enumerable:!0})};function ke(e){return e+.5|0}var Dt=(e,t,n)=>Math.max(Math.min(e,n),t);function ve(e){return Dt(ke(e*2.55),0,255)}function Ot(e){return Dt(ke(e*255),0,255)}function bt(e){return Dt(ke(e/2.55)/100,0,1)}function ys(e){return Dt(ke(e*100),0,100)}var ct={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},Qn=[..."0123456789ABCDEF"],lc=e=>Qn[e&15],uc=e=>Qn[(e&240)>>4]+Qn[e&15],Xe=e=>(e&240)>>4===(e&15),hc=e=>Xe(e.r)&&Xe(e.g)&&Xe(e.b)&&Xe(e.a);function dc(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&ct[e[1]]*17,g:255&ct[e[2]]*17,b:255&ct[e[3]]*17,a:t===5?ct[e[4]]*17:255}:(t===7||t===9)&&(n={r:ct[e[1]]<<4|ct[e[2]],g:ct[e[3]]<<4|ct[e[4]],b:ct[e[5]]<<4|ct[e[6]],a:t===9?ct[e[7]]<<4|ct[e[8]]:255})),n}var fc=(e,t)=>e<255?t(e):"";function pc(e){var t=hc(e)?lc:uc;return e?"#"+t(e.r)+t(e.g)+t(e.b)+fc(e.a,t):void 0}var gc=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function zs(e,t,n){let i=t*Math.min(n,1-n),s=(o,r=(o+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function mc(e,t,n){let i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function bc(e,t,n){let i=zs(e,1,.5),s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function _c(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function ti(e){let n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),r=Math.min(n,i,s),a=(o+r)/2,c,l,u;return o!==r&&(u=o-r,l=a>.5?u/(2-o-r):u/(o+r),c=_c(n,i,s,u,o),c=c*60+.5),[c|0,l||0,a]}function ei(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(Ot)}function ni(e,t,n){return ei(zs,e,t,n)}function xc(e,t,n){return ei(bc,e,t,n)}function yc(e,t,n){return ei(mc,e,t,n)}function Ss(e){return(e%360+360)%360}function vc(e){let t=gc.exec(e),n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?ve(+t[5]):Ot(+t[5]));let s=Ss(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=xc(s,o,r):t[1]==="hsv"?i=yc(s,o,r):i=ni(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function wc(e,t){var n=ti(e);n[0]=Ss(n[0]+t),n=ni(n),e.r=n[0],e.g=n[1],e.b=n[2]}function kc(e){if(!e)return;let t=ti(e),n=t[0],i=ys(t[1]),s=ys(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${s}%, ${bt(e.a)})`:`hsl(${n}, ${i}%, ${s}%)`}var vs={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"},ws={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 zc(){let e={},t=Object.keys(ws),n=Object.keys(vs),i,s,o,r,a;for(i=0;i<t.length;i++){for(r=a=t[i],s=0;s<n.length;s++)o=n[s],a=a.replace(o,vs[o]);o=parseInt(ws[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}var Ge;function Sc(e){Ge||(Ge=zc(),Ge.transparent=[0,0,0,0]);let t=Ge[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var Mc=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Pc(e){let t=Mc.exec(e),n=255,i,s,o;if(t){if(t[7]!==i){let r=+t[7];n=t[8]?ve(r):Dt(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?ve(i):Dt(i,0,255)),s=255&(t[4]?ve(s):Dt(s,0,255)),o=255&(t[6]?ve(o):Dt(o,0,255)),{r:i,g:s,b:o,a:n}}}function $c(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${bt(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var Jn=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,re=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Ac(e,t,n){let i=re(bt(e.r)),s=re(bt(e.g)),o=re(bt(e.b));return{r:Ot(Jn(i+n*(re(bt(t.r))-i))),g:Ot(Jn(s+n*(re(bt(t.g))-s))),b:Ot(Jn(o+n*(re(bt(t.b))-o))),a:e.a+n*(t.a-e.a)}}function qe(e,t,n){if(e){let i=ti(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=ni(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Ms(e,t){return e&&Object.assign(t||{},e)}function ks(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ot(e[3]))):(t=Ms(e,{r:0,g:0,b:0,a:1}),t.a=Ot(t.a)),t}function Cc(e){return e.charAt(0)==="r"?Pc(e):vc(e)}var we=class e{constructor(t){if(t instanceof e)return t;let n=typeof t,i;n==="object"?i=ks(t):n==="string"&&(i=dc(t)||Sc(t)||Cc(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ms(this._rgb);return t&&(t.a=bt(t.a)),t}set rgb(t){this._rgb=ks(t)}rgbString(){return this._valid?$c(this._rgb):void 0}hexString(){return this._valid?pc(this._rgb):void 0}hslString(){return this._valid?kc(this._rgb):void 0}mix(t,n){if(t){let i=this.rgb,s=t.rgb,o,r=n===o?.5:n,a=2*r-1,c=i.a-s.a,l=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,i.r=255&l*i.r+o*s.r+.5,i.g=255&l*i.g+o*s.g+.5,i.b=255&l*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=Ac(this._rgb,t._rgb,n)),this}clone(){return new e(this.rgb)}alpha(t){return this._rgb.a=Ot(t),this}clearer(t){let n=this._rgb;return n.a*=1-t,this}greyscale(){let t=this._rgb,n=ke(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){let n=this._rgb;return n.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return qe(this._rgb,2,t),this}darken(t){return qe(this._rgb,2,-t),this}saturate(t){return qe(this._rgb,1,t),this}desaturate(t){return qe(this._rgb,1,-t),this}rotate(t){return wc(this._rgb,t),this}};function pt(){}var Is=(()=>{let e=0;return()=>e++})();function L(e){return e==null}function N(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function R(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Y(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Q(e,t){return Y(e)?e:t}function Z(e,t){return typeof e>"u"?t:e}var Zs=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function B(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function I(e,t,n,i){let s,o,r;if(N(e))if(o=e.length,i)for(s=o-1;s>=0;s--)t.call(n,e[s],s);else for(s=0;s<o;s++)t.call(n,e[s],s);else if(R(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function Me(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function en(e){if(N(e))return e.map(en);if(R(e)){let t=Object.create(null),n=Object.keys(e),i=n.length,s=0;for(;s<i;++s)t[n[s]]=en(e[n[s]]);return t}return e}function Fs(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Dc(e,t,n,i){if(!Fs(e))return;let s=t[e],o=n[e];R(s)&&R(o)?ce(s,o,i):t[e]=en(o)}function ce(e,t,n){let i=N(t)?t:[t],s=i.length;if(!R(e))return e;n=n||{};let o=n.merger||Dc,r;for(let a=0;a<s;++a){if(r=i[a],!R(r))continue;let c=Object.keys(r);for(let l=0,u=c.length;l<u;++l)o(c[l],e,r,n)}return e}function ue(e,t){return ce(e,t,{merger:Oc})}function Oc(e,t,n){if(!Fs(e))return;let i=t[e],s=n[e];R(i)&&R(s)?ue(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=en(s))}var Ps={"":e=>e,x:e=>e.x,y:e=>e.y};function Ec(e){let t=e.split("."),n=[],i="";for(let s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function Tc(e){let t=Ec(e);return n=>{for(let i of t){if(i==="")break;n=n&&n[i]}return n}}function Pe(e,t){return(Ps[t]||(Ps[t]=Tc(t)))(e)}function rn(e){return e.charAt(0).toUpperCase()+e.slice(1)}var $e=e=>typeof e<"u",_t=e=>typeof e=="function",ri=(e,t)=>{if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0};function Ns(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}var U=Math.PI,st=2*U,Rc=st+U,nn=Number.POSITIVE_INFINITY,Lc=U/180,J=U/2,Vt=U/4,$s=U*2/3,xt=Math.log10,Ht=Math.sign;function he(e,t,n){return Math.abs(e-t)<n}function ai(e){let t=Math.round(e);e=he(e,t,e/1e3)?t:e;let n=Math.pow(10,Math.floor(xt(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function Bs(e){let t=[],n=Math.sqrt(e),i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function Ic(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function de(e){return!Ic(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function js(e,t){let n=Math.round(e);return n-t<=e&&n+t>=e}function ci(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function yt(e){return e*(U/180)}function an(e){return e*(180/U)}function li(e){if(!Y(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Vs(e,t){let n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i),o=Math.atan2(i,n);return o<-.5*U&&(o+=st),{angle:o,distance:s}}function sn(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Zc(e,t){return(e-t+Rc)%st-U}function lt(e){return(e%st+st)%st}function ui(e,t,n,i){let s=lt(e),o=lt(t),r=lt(n),a=lt(o-s),c=lt(r-s),l=lt(s-o),u=lt(s-r);return s===o||s===r||i&&o===r||a>c&&l<u}function ot(e,t,n){return Math.max(t,Math.min(n,e))}function Ws(e){return ot(e,-32768,32767)}function Hs(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function cn(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}var Tt=(e,t,n,i)=>cn(e,n,i?s=>{let o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),Us=(e,t,n)=>cn(e,n,i=>e[i][t]>=n);function Ys(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}var Ks=["push","pop","shift","splice","unshift"];function Xs(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Ks.forEach(n=>{let i="_onData"+rn(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){let r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function hi(e,t){let n=e._chartjs;if(!n)return;let i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Ks.forEach(o=>{delete e[o]}),delete e._chartjs)}function Gs(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}var di=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function fi(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,di.call(window,()=>{i=!1,e.apply(t,n)}))}}function qs(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}var Js=e=>e==="start"?"left":e==="end"?"right":"center",pi=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2;function Qs(e,t,n){let i=t.length,s=0,o=i;if(e._sorted){let{iScale:r,vScale:a,_parsed:c}=e,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:h,max:d,minDefined:f,maxDefined:g}=r.getUserBounds();if(f){if(s=Math.min(Tt(c,u,h).lo,n?i:Tt(t,u,r.getPixelForValue(h)).lo),l){let p=c.slice(0,s+1).reverse().findIndex(m=>!L(m[a.axis]));s-=Math.max(0,p)}s=ot(s,0,i-1)}if(g){let p=Math.max(Tt(c,r.axis,d,!0).hi+1,n?0:Tt(t,u,r.getPixelForValue(d),!0).hi+1);if(l){let m=c.slice(p-1).findIndex(x=>!L(x[a.axis]));p+=Math.max(0,m)}o=ot(p,s,i)-s}else o=i-s}return{start:s,count:o}}function to(e){let{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}var Je=e=>e===0||e===1,As=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*st/n)),Cs=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*st/n)+1,ae={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*J)+1,easeOutSine:e=>Math.sin(e*J),easeInOutSine:e=>-.5*(Math.cos(U*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Je(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Je(e)?e:As(e,.075,.3),easeOutElastic:e=>Je(e)?e:Cs(e,.075,.3),easeInOutElastic(e){return Je(e)?e:e<.5?.5*As(e*2,.1125,.45):.5+.5*Cs(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-ae.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?ae.easeInBounce(e*2)*.5:ae.easeOutBounce(e*2-1)*.5+.5};function gi(e){if(e&&typeof e=="object"){let t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function mi(e){return gi(e)?e:new we(e)}function ii(e){return gi(e)?e:new we(e).saturate(.5).darken(.1).hexString()}var Fc=["x","y","borderWidth","radius","tension"],Nc=["color","borderColor","backgroundColor"];function Bc(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Nc},numbers:{type:"number",properties:Fc}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function jc(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Ds=new Map;function Vc(e,t){t=t||{};let n=e+JSON.stringify(t),i=Ds.get(n);return i||(i=new Intl.NumberFormat(e,t),Ds.set(n,i)),i}function ln(e,t,n){return Vc(t,n).format(e)}var eo={values(e){return N(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";let i=this.chart.options.locale,s,o=e;if(n.length>1){let l=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(l<1e-4||l>1e15)&&(s="scientific"),o=Wc(e,n)}let r=xt(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),ln(e,i,c)},logarithmic(e,t,n){if(e===0)return"0";let i=n[t].significand||e/Math.pow(10,Math.floor(xt(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?eo.numeric.call(this,e,t,n):""}};function Wc(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Ae={formatters:eo};function Hc(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}var Lt=Object.create(null),un=Object.create(null);function ze(e,t){if(!t)return e;let n=t.split(".");for(let i=0,s=n.length;i<s;++i){let o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function si(e,t,n){return typeof t=="string"?ce(ze(e,t),n):ce(ze(e,""),t)}var oi=class{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>ii(s.backgroundColor),this.hoverBorderColor=(i,s)=>ii(s.borderColor),this.hoverColor=(i,s)=>ii(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return si(this,t,n)}get(t){return ze(this,t)}describe(t,n){return si(un,t,n)}override(t,n){return si(Lt,t,n)}route(t,n,i,s){let o=ze(this,t),r=ze(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){let c=this[a],l=r[s];return R(c)?Object.assign({},l,c):Z(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(n=>n(this))}},j=new oi({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Bc,jc,Hc]);function Uc(e){return!e||L(e.size)||L(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function Se(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function no(e,t,n,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let r=0,a=n.length,c,l,u,h,d;for(c=0;c<a;c++)if(h=n[c],h!=null&&!N(h))r=Se(e,s,o,r,h);else if(N(h))for(l=0,u=h.length;l<u;l++)d=h[l],d!=null&&!N(d)&&(r=Se(e,s,o,r,d));e.restore();let f=o.length/2;if(f>n.length){for(c=0;c<f;c++)delete s[o[c]];o.splice(0,f)}return r}function It(e,t,n){let i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function bi(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function hn(e,t,n,i){io(e,t,n,i,null)}function io(e,t,n,i,s){let o,r,a,c,l,u,h,d,f=t.pointStyle,g=t.rotation,p=t.radius,m=(g||0)*Lc;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(m),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),f){default:s?e.ellipse(n,i,s/2,p,0,0,st):e.arc(n,i,p,0,st),e.closePath();break;case"triangle":u=s?s/2:p,e.moveTo(n+Math.sin(m)*u,i-Math.cos(m)*p),m+=$s,e.lineTo(n+Math.sin(m)*u,i-Math.cos(m)*p),m+=$s,e.lineTo(n+Math.sin(m)*u,i-Math.cos(m)*p),e.closePath();break;case"rectRounded":l=p*.516,c=p-l,r=Math.cos(m+Vt)*c,h=Math.cos(m+Vt)*(s?s/2-l:c),a=Math.sin(m+Vt)*c,d=Math.sin(m+Vt)*(s?s/2-l:c),e.arc(n-h,i-a,l,m-U,m-J),e.arc(n+d,i-r,l,m-J,m),e.arc(n+h,i+a,l,m,m+J),e.arc(n-d,i+r,l,m+J,m+U),e.closePath();break;case"rect":if(!g){c=Math.SQRT1_2*p,u=s?s/2:c,e.rect(n-u,i-c,2*u,2*c);break}m+=Vt;case"rectRot":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(s?s/2:p),e.moveTo(n-h,i-a),e.lineTo(n+d,i-r),e.lineTo(n+h,i+a),e.lineTo(n-d,i+r),e.closePath();break;case"crossRot":m+=Vt;case"cross":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(s?s/2:p),e.moveTo(n-h,i-a),e.lineTo(n+h,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"star":h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(s?s/2:p),e.moveTo(n-h,i-a),e.lineTo(n+h,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r),m+=Vt,h=Math.cos(m)*(s?s/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,d=Math.sin(m)*(s?s/2:p),e.moveTo(n-h,i-a),e.lineTo(n+h,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"line":r=s?s/2:Math.cos(m)*p,a=Math.sin(m)*p,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(m)*(s?s/2:p),i+Math.sin(m)*p);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function ft(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function _i(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function xi(e){e.restore()}function so(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){let o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function oo(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Yc(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),L(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Kc(e,t,n,i,s){if(s.strikethrough||s.underline){let o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,c=n-o.actualBoundingBoxAscent,l=n+o.actualBoundingBoxDescent,u=s.strikethrough?(c+l)/2:l;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function Xc(e,t){let n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Ce(e,t,n,i,s,o={}){let r=N(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="",c,l;for(e.save(),e.font=s.string,Yc(e,o),c=0;c<r.length;++c)l=r[c],o.backdrop&&Xc(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),L(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(l,n,i,o.maxWidth)),e.fillText(l,n,i,o.maxWidth),Kc(e,n,i,l,o),i+=Number(s.lineHeight);e.restore()}function dn(e,t){let{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*U,U,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,U,J,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,J,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-J,!0),e.lineTo(n+r.topLeft,i)}var Gc=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,qc=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Jc(e,t){let n=(""+e).match(Gc);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}var Qc=e=>+e||0;function yi(e,t){let n={},i=R(t),s=i?Object.keys(t):t,o=R(e)?i?r=>Z(e[r],e[t[r]]):r=>e[r]:()=>e;for(let r of s)n[r]=Qc(o(r));return n}function ro(e){return yi(e,{top:"y",right:"x",bottom:"y",left:"x"})}function fe(e){return yi(e,["topLeft","topRight","bottomLeft","bottomRight"])}function rt(e){let t=ro(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function tt(e,t){e=e||{},t=t||j.font;let n=Z(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=Z(e.style,t.style);i&&!(""+i).match(qc)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let s={family:Z(e.family,t.family),lineHeight:Jc(Z(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:Z(e.weight,t.weight),string:""};return s.string=Uc(s),s}function De(e,t,n,i){let s=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),s=!1),n!==void 0&&N(a)&&(a=a[n%a.length],s=!1),a!==void 0))return i&&!s&&(i.cacheable=!1),a}function ao(e,t,n){let{min:i,max:s}=e,o=Zs(t,(s-i)/2),r=(a,c)=>n&&a===0?0:a+c;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function vt(e,t){return Object.assign(Object.create(e),t)}function fn(e,t=[""],n,i,s=()=>e[0]){let o=n||e;typeof i>"u"&&(i=uo("_fallback",e));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>fn([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete e[0][c],!0},get(a,c){return co(a,c,()=>al(c,t,e,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,c){return Es(a).includes(c)},ownKeys(a){return Es(a)},set(a,c,l){let u=a._storage||(a._storage=s());return a[c]=u[c]=l,delete a._keys,!0}})}function Ut(e,t,n,i){let s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:vi(e,i),setContext:o=>Ut(e,o,n,i),override:o=>Ut(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return co(o,r,()=>el(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function vi(e,t={scriptable:!0,indexable:!0}){let{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:_t(n)?n:()=>n,isIndexable:_t(i)?i:()=>i}}var tl=(e,t)=>e?e+rn(t):t,wi=(e,t)=>R(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function co(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];let i=n();return e[t]=i,i}function el(e,t,n){let{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e,a=i[t];return _t(a)&&r.isScriptable(t)&&(a=nl(t,a,e,n)),N(a)&&a.length&&(a=il(t,a,e,r.isIndexable)),wi(t,a)&&(a=Ut(a,s,o&&o[t],r)),a}function nl(e,t,n,i){let{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let c=t(o,r||i);return a.delete(e),wi(e,c)&&(c=ki(s._scopes,s,e,c)),c}function il(e,t,n,i){let{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(R(t[0])){let c=t,l=s._scopes.filter(u=>u!==c);t=[];for(let u of c){let h=ki(l,s,e,u);t.push(Ut(h,o,r&&r[e],a))}}return t}function lo(e,t,n){return _t(e)?e(t,n):e}var sl=(e,t)=>e===!0?t:typeof e=="string"?Pe(t,e):void 0;function ol(e,t,n,i,s){for(let o of t){let r=sl(n,o);if(r){e.add(r);let a=lo(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function ki(e,t,n,i){let s=t._rootScopes,o=lo(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let c=Os(a,r,n,o||n,i);return c===null||typeof o<"u"&&o!==n&&(c=Os(a,r,o,c,i),c===null)?!1:fn(Array.from(a),[""],s,o,()=>rl(t,n,i))}function Os(e,t,n,i,s){for(;n;)n=ol(e,t,n,i,s);return n}function rl(e,t,n){let i=e._getTarget();t in i||(i[t]={});let s=i[t];return N(s)&&R(n)?n:s||{}}function al(e,t,n,i){let s;for(let o of t)if(s=uo(tl(o,e),n),typeof s<"u")return wi(e,s)?ki(n,i,e,s):s}function uo(e,t){for(let n of t){if(!n)continue;let i=n[e];if(typeof i<"u")return i}}function Es(e){let t=e._keys;return t||(t=e._keys=cl(e._scopes)),t}function cl(e){let t=new Set;for(let n of e)for(let i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}var ll=Number.EPSILON||1e-14,le=(e,t)=>t<e.length&&!e[t].skip&&e[t],ho=e=>e==="x"?"y":"x";function ul(e,t,n,i){let s=e.skip?t:e,o=t,r=n.skip?t:n,a=sn(o,s),c=sn(r,o),l=a/(a+c),u=c/(a+c);l=isNaN(l)?0:l,u=isNaN(u)?0:u;let h=i*l,d=i*u;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function hl(e,t,n){let i=e.length,s,o,r,a,c,l=le(e,0);for(let u=0;u<i-1;++u)if(c=l,l=le(e,u+1),!(!c||!l)){if(he(t[u],0,ll)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function dl(e,t,n="x"){let i=ho(n),s=e.length,o,r,a,c=le(e,0);for(let l=0;l<s;++l){if(r=a,a=c,c=le(e,l+1),!a)continue;let u=a[n],h=a[i];r&&(o=(u-r[n])/3,a[`cp1${n}`]=u-o,a[`cp1${i}`]=h-o*t[l]),c&&(o=(c[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${i}`]=h+o*t[l])}}function fl(e,t="x"){let n=ho(t),i=e.length,s=Array(i).fill(0),o=Array(i),r,a,c,l=le(e,0);for(r=0;r<i;++r)if(a=c,c=l,l=le(e,r+1),!!c){if(l){let u=l[t]-c[t];s[r]=u!==0?(l[n]-c[n])/u:0}o[r]=a?l?Ht(s[r-1])!==Ht(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}hl(e,s,o),dl(e,o,t)}function Qe(e,t,n){return Math.max(Math.min(e,n),t)}function pl(e,t){let n,i,s,o,r,a=ft(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&ft(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=Qe(s.cp1x,t.left,t.right),s.cp1y=Qe(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=Qe(s.cp2x,t.left,t.right),s.cp2y=Qe(s.cp2y,t.top,t.bottom)))}function fo(e,t,n,i,s){let o,r,a,c;if(t.spanGaps&&(e=e.filter(l=>!l.skip)),t.cubicInterpolationMode==="monotone")fl(e,s);else{let l=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],c=ul(l,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=c.previous.x,a.cp1y=c.previous.y,a.cp2x=c.next.x,a.cp2y=c.next.y,l=a}t.capBezierPoints&&pl(e,n)}function pn(){return typeof window<"u"&&typeof document<"u"}function gn(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function on(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}var mn=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function gl(e,t){return mn(e).getPropertyValue(t)}var ml=["top","right","bottom","left"];function Wt(e,t,n){let i={};n=n?"-"+n:"";for(let s=0;s<4;s++){let o=ml[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var bl=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function _l(e,t){let n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i,r=!1,a,c;if(bl(s,o,e.target))a=s,c=o;else{let l=t.getBoundingClientRect();a=i.clientX-l.left,c=i.clientY-l.top,r=!0}return{x:a,y:c,box:r}}function Zt(e,t){if("native"in e)return e;let{canvas:n,currentDevicePixelRatio:i}=t,s=mn(n),o=s.boxSizing==="border-box",r=Wt(s,"padding"),a=Wt(s,"border","width"),{x:c,y:l,box:u}=_l(e,n),h=r.left+(u&&a.left),d=r.top+(u&&a.top),{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((c-h)/f*n.width/i),y:Math.round((l-d)/g*n.height/i)}}function xl(e,t,n){let i,s;if(t===void 0||n===void 0){let o=e&&gn(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{let r=o.getBoundingClientRect(),a=mn(o),c=Wt(a,"border","width"),l=Wt(a,"padding");t=r.width-l.width-c.width,n=r.height-l.height-c.height,i=on(a.maxWidth,o,"clientWidth"),s=on(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||nn,maxHeight:s||nn}}var Rt=e=>Math.round(e*10)/10;function po(e,t,n,i){let s=mn(e),o=Wt(s,"margin"),r=on(s.maxWidth,e,"clientWidth")||nn,a=on(s.maxHeight,e,"clientHeight")||nn,c=xl(e,t,n),{width:l,height:u}=c;if(s.boxSizing==="content-box"){let d=Wt(s,"border","width"),f=Wt(s,"padding");l-=f.width+d.width,u-=f.height+d.height}return l=Math.max(0,l-o.width),u=Math.max(0,i?l/i:u-o.height),l=Rt(Math.min(l,r,c.maxWidth)),u=Rt(Math.min(u,a,c.maxHeight)),l&&!u&&(u=Rt(l/2)),(t!==void 0||n!==void 0)&&i&&c.height&&u>c.height&&(u=c.height,l=Rt(Math.floor(u*i))),{width:l,height:u}}function zi(e,t,n){let i=t||1,s=Rt(e.height*i),o=Rt(e.width*i);e.height=Rt(e.height),e.width=Rt(e.width);let r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}var go=(function(){let e=!1;try{let t={get passive(){return e=!0,!1}};pn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Si(e,t){let n=gl(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Et(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function mo(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function bo(e,t,n,i){let s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Et(e,s,n),a=Et(s,o,n),c=Et(o,t,n),l=Et(r,a,n),u=Et(a,c,n);return Et(l,u,n)}var yl=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},vl=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function bn(e,t,n){return e?yl(t,n):vl()}function _o(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function xo(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function yo(e){return e==="angle"?{between:ui,compare:Zc,normalize:lt}:{between:Hs,compare:(t,n)=>t-n,normalize:t=>t}}function Ts({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function wl(e,t,n){let{property:i,start:s,end:o}=n,{between:r,normalize:a}=yo(i),c=t.length,{start:l,end:u,loop:h}=e,d,f;if(h){for(l+=c,u+=c,d=0,f=c;d<f&&r(a(t[l%c][i]),s,o);++d)l--,u--;l%=c,u%=c}return u<l&&(u+=c),{start:l,end:u,loop:h,style:e.style}}function vo(e,t,n){if(!n)return[e];let{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:c,normalize:l}=yo(i),{start:u,end:h,loop:d,style:f}=wl(e,t,n),g=[],p=!1,m=null,x,w,_,y=()=>c(s,_,x)&&a(s,_)!==0,b=()=>a(o,x)===0||c(o,_,x),z=()=>p||y(),k=()=>!p||b();for(let M=u,P=u;M<=h;++M)w=t[M%r],!w.skip&&(x=l(w[i]),x!==_&&(p=c(x,s,o),m===null&&z()&&(m=a(x,s)===0?M:P),m!==null&&k()&&(g.push(Ts({start:m,end:M,loop:d,count:r,style:f})),m=null),P=M,_=x));return m!==null&&g.push(Ts({start:m,end:h,loop:d,count:r,style:f})),g}function wo(e,t){let n=[],i=e.segments;for(let s=0;s<i.length;s++){let o=vo(i[s],e.points,t);o.length&&n.push(...o)}return n}function kl(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function zl(e,t,n,i){let s=e.length,o=[],r=t,a=e[t],c;for(c=t+1;c<=n;++c){let l=e[c%s];l.skip||l.stop?a.skip||(i=!1,o.push({start:t%s,end:(c-1)%s,loop:i}),t=r=l.stop?c:null):(r=c,a.skip&&(t=c)),a=l}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function ko(e,t){let n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];let o=!!e._loop,{start:r,end:a}=kl(n,s,o,i);if(i===!0)return Rs(e,[{start:r,end:a,loop:o}],n,t);let c=a<r?a+s:a,l=!!e._fullLoop&&r===0&&a===s-1;return Rs(e,zl(n,r,c,l),n,t)}function Rs(e,t,n,i){return!i||!i.setContext||!n?t:Sl(e,t,n,i)}function Sl(e,t,n,i){let s=e._chart.getContext(),o=Ls(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,c=n.length,l=[],u=o,h=t[0].start,d=h;function f(g,p,m,x){let w=a?-1:1;if(g!==p){for(g+=c;n[g%c].skip;)g-=w;for(;n[p%c].skip;)p+=w;g%c!==p%c&&(l.push({start:g%c,end:p%c,loop:m,style:x}),u=x,h=p%c)}}for(let g of t){h=a?h:g.start;let p=n[h%c],m;for(d=h+1;d<=g.end;d++){let x=n[d%c];m=Ls(i.setContext(vt(s,{type:"segment",p0:p,p1:x,p0DataIndex:(d-1)%c,p1DataIndex:d%c,datasetIndex:r}))),Ml(m,u)&&f(h,d-1,g.loop,u),p=x,u=m}h<d-1&&f(h,d-1,g.loop,u)}return l}function Ls(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Ml(e,t){if(!t)return!1;let n=[],i=function(s,o){return gi(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function tn(e,t,n){return e.options.clip?e[n]:t[n]}function Pl(e,t){let{xScale:n,yScale:i}=e;return n&&i?{left:tn(n,t,"left"),right:tn(n,t,"right"),top:tn(i,t,"top"),bottom:tn(i,t,"bottom")}:t}function zo(e,t){let n=t._clip;if(n.disabled)return!1;let i=Pl(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}var Oi=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){let o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=di.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){let n=this._charts,i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){let n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){let n=this._charts.get(t);if(!n||!n.items.length)return;let i=n.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},wt=new Oi,So="transparent",$l={boolean(e,t,n){return n>.5?t:e},color(e,t,n){let i=mi(e||So),s=i.valid&&mi(t||So);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}},Ei=class{constructor(t,n,i,s){let o=n[i];s=De([t.to,s,o,t.from]);let r=De([t.from,o,s]);this._active=!0,this._fn=t.fn||$l[t.type||typeof r],this._easing=ae[t.easing]||ae.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=De([t.to,n,s,t.from]),this._from=De([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to,c;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}c=n/i%2,c=r&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(o,a,c)}wait(){let t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){let n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}},Mn=class{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!R(t))return;let n=Object.keys(j.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!R(o))return;let r={};for(let a of n)r[a]=o[a];(N(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){let i=n.options,s=Cl(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&Al(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){let i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now(),c;for(c=r.length-1;c>=0;--c){let l=r[c];if(l.charAt(0)==="$")continue;if(l==="options"){s.push(...this._animateOptions(t,n));continue}let u=n[l],h=o[l],d=i.get(l);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[l]=u;continue}o[l]=h=new Ei(d,t,l,u),s.push(h)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}let i=this._createAnimations(t,n);if(i.length)return wt.add(this._chart,i),!0}};function Al(e,t){let n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Cl(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Mo(e,t){let n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Dl(e,t,n){if(n===!1)return!1;let i=Mo(e,n),s=Mo(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Ol(e){let t,n,i,s;return R(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function pr(e,t){let n=[],i=e._getSortedDatasetMetas(t),s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function Po(e,t,n,i={}){let s=e.keys,o=i.mode==="single",r,a,c,l;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(c=+s[r],c===n){if(u=!0,i.all)continue;break}l=e.values[c],Y(l)&&(o||t===0||Ht(t)===Ht(l))&&(t+=l)}return!u&&!i.all?0:t}function El(e,t){let{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length),c,l,u;for(c=0,l=r.length;c<l;++c)u=r[c],a[c]={[s]:u,[o]:e[u]};return a}function Mi(e,t){let n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Tl(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Rl(e){let{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function Ll(e,t,n){let i=e[t]||(e[t]={});return i[n]||(i[n]={})}function $o(e,t,n,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Ao(e,t){let{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,c=o.axis,l=r.axis,u=Tl(o,r,i),h=t.length,d;for(let f=0;f<h;++f){let g=t[f],{[c]:p,[l]:m}=g,x=g._stacks||(g._stacks={});d=x[l]=Ll(s,u,p),d[a]=m,d._top=$o(d,r,!0,i.type),d._bottom=$o(d,r,!1,i.type);let w=d._visualValues||(d._visualValues={});w[a]=m}}function Pi(e,t){let n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Il(e,t){return vt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Zl(e,t,n){return vt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Oe(e,t){let n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}var $i=e=>e==="reset"||e==="none",Co=(e,t)=>t?e:Object.assign({},e),Fl=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:pr(n,!0),values:null},Pn=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Mi(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Oe(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(h,d,f,g)=>h==="x"?d:h==="r"?g:f,o=n.xAxisID=Z(i.xAxisID,Pi(t,"x")),r=n.yAxisID=Z(i.yAxisID,Pi(t,"y")),a=n.rAxisID=Z(i.rAxisID,Pi(t,"r")),c=n.indexAxis,l=n.iAxisID=s(c,o,r,a),u=n.vAxisID=s(c,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(l),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&hi(this._data,this),t._stacked&&Oe(t)}_dataCheck(){let t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(R(n)){let s=this._cachedMeta;this._data=El(n,s)}else if(i!==n){if(i){hi(i,this);let s=this._cachedMeta;Oe(s),s._parsed=[]}n&&Object.isExtensible(n)&&Xs(n,this),this._syncList=[],this._data=n}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let n=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let o=n._stacked;n._stacked=Mi(n.vScale,n),n.stack!==i.stack&&(s=!0,Oe(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Ao(this,n._parsed),n._stacked=Mi(n.vScale,n))}configure(){let t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis,c=t===0&&n===s.length?!0:i._sorted,l=t>0&&i._parsed[t-1],u,h,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{N(s[t])?d=this.parseArrayData(i,s,t,n):R(s[t])?d=this.parseObjectData(i,s,t,n):d=this.parsePrimitiveData(i,s,t,n);let f=()=>h[a]===null||l&&h[a]<l[a];for(u=0;u<n;++u)i._parsed[u+t]=h=d[u],c&&(f()&&(c=!1),l=h);i._sorted=c}r&&Ao(this,d)}parsePrimitiveData(t,n,i,s){let{iScale:o,vScale:r}=t,a=o.axis,c=r.axis,l=o.getLabels(),u=o===r,h=new Array(s),d,f,g;for(d=0,f=s;d<f;++d)g=d+i,h[d]={[a]:u||o.parse(l[g],g),[c]:r.parse(n[g],g)};return h}parseArrayData(t,n,i,s){let{xScale:o,yScale:r}=t,a=new Array(s),c,l,u,h;for(c=0,l=s;c<l;++c)u=c+i,h=n[u],a[c]={x:o.parse(h[0],u),y:r.parse(h[1],u)};return a}parseObjectData(t,n,i,s){let{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,l=new Array(s),u,h,d,f;for(u=0,h=s;u<h;++u)d=u+i,f=n[d],l[u]={x:o.parse(Pe(f,a),d),y:r.parse(Pe(f,c),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){let s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:pr(s,!0),values:n._stacks[t.axis]._visualValues};return Po(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){let o=i[n.axis],r=o===null?NaN:o,a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=Po(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){let i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),c=Fl(n,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=Rl(a),d,f;function g(){f=s[d];let p=f[a.axis];return!Y(f[t.axis])||u>p||h<p}for(d=0;d<r&&!(!g()&&(this.updateRangeFromParsed(l,t,f,c),o));++d);if(o){for(d=r-1;d>=0;--d)if(!g()){this.updateRangeFromParsed(l,t,f,c);break}}return l}getAllParsedValues(t){let n=this._cachedMeta._parsed,i=[],s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],Y(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let n=this._cachedMeta;this.update(t||"default"),n._clip=Ol(Z(this.options.clip,Dl(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,c=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop,u;for(i.dataset&&i.dataset.draw(t,o,a,c),u=a;u<a+c;++u){let h=s[u];h.hidden||(h.active&&l?r.push(h):h.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){let i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let r=this._cachedMeta.data[t];o=r.$context||(r.$context=Zl(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Il(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){let s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],c=this.enableOptionSharing&&$e(i);if(a)return Co(a,c);let l=this.chart.config,u=l.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),u),f=Object.keys(j.elements[t]),g=()=>this.getContext(i,s,n),p=l.resolveNamedOptions(d,f,g,h);return p.$shared&&(p.$shared=c,o[r]=Object.freeze(Co(p,c))),p}_resolveAnimations(t,n,i){let s=this.chart,o=this._cachedDataOpts,r=`animation-${n}`,a=o[r];if(a)return a;let c;if(s.options.animation!==!1){let u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),d=u.getOptionScopes(this.getDataset(),h);c=u.createResolver(d,this.getContext(t,i,n))}let l=new Mn(s,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||$i(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){let i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){$i(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!$i(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;let o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let n=this._data,i=this._cachedMeta.data;for(let[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];let s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){let s=this._cachedMeta,o=s.data,r=t+n,a,c=l=>{for(l.length+=n,a=l.length-1;a>=r;a--)l[a]=l[a-n]};for(c(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,n);i._stacked&&Oe(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};var $n=class extends Pn{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled,{start:a,count:c}=Qs(n,s,r);this._drawStart=a,this._drawCount=c,to(n)&&(a=0,c=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;let l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:l},t),this.updateElements(s,a,c,t)}updateElements(t,n,i,s){let o=s==="reset",{iScale:r,vScale:a,_stacked:c,_dataset:l}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=de(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",w=n+i,_=t.length,y=n>0&&this.getParsed(n-1);for(let b=0;b<_;++b){let z=t[b],k=x?z:{};if(b<n||b>=w){k.skip=!0;continue}let M=this.getParsed(b),P=L(M[f]),T=k[d]=r.getPixelForValue(M[d],b),v=k[f]=o||P?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,M,c):M[f],b);k.skip=isNaN(T)||isNaN(v)||P,k.stop=b>0&&Math.abs(M[d]-y[d])>m,p&&(k.parsed=M,k.raw=l.data[b]),h&&(k.options=u||this.resolveDataElementOptions(b,z.active?"active":s)),x||this.updateElement(z,b,k,s),y=M}}getMaxOverflow(){let t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};function Yt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Ti=class e{static override(t){Object.assign(e.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Yt()}parse(){return Yt()}format(){return Yt()}add(){return Yt()}diff(){return Yt()}startOf(){return Yt()}endOf(){return Yt()}},Nl={_date:Ti};function Bl(e,t,n,i){let{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){let l=a._reversePixels?Us:Tt;if(i){if(s._sharedOptions){let u=o[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){let d=l(o,t,n-h),f=l(o,t,n+h);return{lo:d.lo,hi:f.hi}}}}else{let u=l(o,t,n);if(c){let{vScale:h}=s._cachedMeta,{_parsed:d}=e,f=d.slice(0,u.lo+1).reverse().findIndex(p=>!L(p[h.axis]));u.lo-=Math.max(0,f);let g=d.slice(u.hi).findIndex(p=>!L(p[h.axis]));u.hi+=Math.max(0,g)}return u}}return{lo:0,hi:o.length-1}}function Be(e,t,n,i,s){let o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,c=o.length;a<c;++a){let{index:l,data:u}=o[a],{lo:h,hi:d}=Bl(o[a],t,r,s);for(let f=h;f<=d;++f){let g=u[f];g.skip||i(g,l,f)}}}function jl(e){let t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){let o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Ai(e,t,n,i,s){let o=[];return!s&&!e.isPointInArea(t)||Be(e,n,t,function(a,c,l){!s&&!ft(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:c,index:l})},!0),o}function Vl(e,t,n,i){let s=[];function o(r,a,c){let{startAngle:l,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:h}=Vs(r,{x:t.x,y:t.y});ui(h,l,u)&&s.push({element:r,datasetIndex:a,index:c})}return Be(e,n,t,o),s}function Wl(e,t,n,i,s,o){let r=[],a=jl(n),c=Number.POSITIVE_INFINITY;function l(u,h,d){let f=u.inRange(t.x,t.y,s);if(i&&!f)return;let g=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(g))&&!f)return;let m=a(t,g);m<c?(r=[{element:u,datasetIndex:h,index:d}],c=m):m===c&&r.push({element:u,datasetIndex:h,index:d})}return Be(e,n,t,l),r}function Ci(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Vl(e,t,n,s):Wl(e,t,n,i,s,o)}function Do(e,t,n,i,s){let o=[],r=n==="x"?"inXRange":"inYRange",a=!1;return Be(e,n,t,(c,l,u)=>{c[r]&&c[r](t[n],s)&&(o.push({element:c,datasetIndex:l,index:u}),a=a||c.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Hl={evaluateInteractionItems:Be,modes:{index(e,t,n,i){let s=Zt(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?Ai(e,s,o,i,r):Ci(e,s,o,!1,i,r),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(l=>{let u=a[0].index,h=l.data[u];h&&!h.skip&&c.push({element:h,datasetIndex:l.index,index:u})}),c):[]},dataset(e,t,n,i){let s=Zt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1,a=n.intersect?Ai(e,s,o,i,r):Ci(e,s,o,!1,i,r);if(a.length>0){let c=a[0].datasetIndex,l=e.getDatasetMeta(c).data;a=[];for(let u=0;u<l.length;++u)a.push({element:l[u],datasetIndex:c,index:u})}return a},point(e,t,n,i){let s=Zt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return Ai(e,s,o,i,r)},nearest(e,t,n,i){let s=Zt(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return Ci(e,s,o,n.intersect,i,r)},x(e,t,n,i){let s=Zt(t,e);return Do(e,s,"x",n.intersect,i)},y(e,t,n,i){let s=Zt(t,e);return Do(e,s,"y",n.intersect,i)}}},gr=["left","top","right","bottom"];function Ee(e,t){return e.filter(n=>n.pos===t)}function Oo(e,t){return e.filter(n=>gr.indexOf(n.pos)===-1&&n.box.axis===t)}function Te(e,t){return e.sort((n,i)=>{let s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Ul(e){let t=[],n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function Yl(e){let t={};for(let n of e){let{stack:i,pos:s,stackWeight:o}=n;if(!i||!gr.includes(s))continue;let r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Kl(e,t){let n=Yl(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];let{fullSize:c}=a.box,l=n[a.stack],u=l&&a.stackWeight/l.weight;a.horizontal?(a.width=u?u*i:c&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:c&&t.availableHeight)}return n}function Xl(e){let t=Ul(e),n=Te(t.filter(l=>l.box.fullSize),!0),i=Te(Ee(t,"left"),!0),s=Te(Ee(t,"right")),o=Te(Ee(t,"top"),!0),r=Te(Ee(t,"bottom")),a=Oo(t,"x"),c=Oo(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(c).concat(r).concat(a),chartArea:Ee(t,"chartArea"),vertical:i.concat(s).concat(c),horizontal:o.concat(r).concat(a)}}function Eo(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function mr(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 Gl(e,t,n,i){let{pos:s,box:o}=n,r=e.maxPadding;if(!R(s)){n.size&&(e[s]-=n.size);let h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[s]+=n.size}o.getPadding&&mr(r,o.getPadding());let a=Math.max(0,t.outerWidth-Eo(r,e,"left","right")),c=Math.max(0,t.outerHeight-Eo(r,e,"top","bottom")),l=a!==e.w,u=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:l,other:u}:{same:u,other:l}}function ql(e){let t=e.maxPadding;function n(i){let s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Jl(e,t){let n=t.maxPadding;function i(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function Ie(e,t,n,i){let s=[],o,r,a,c,l,u;for(o=0,r=e.length,l=0;o<r;++o){a=e[o],c=a.box,c.update(a.width||t.w,a.height||t.h,Jl(a.horizontal,t));let{same:h,other:d}=Gl(t,n,a,i);l|=h&&s.length,u=u||d,c.fullSize||s.push(a)}return l&&Ie(s,t,n,i)||u}function _n(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function To(e,t,n,i){let s=n.padding,{x:o,y:r}=t;for(let a of e){let c=a.box,l=i[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/l.weight||1;if(a.horizontal){let h=t.w*u,d=l.size||c.height;$e(l.start)&&(r=l.start),c.fullSize?_n(c,s.left,r,n.outerWidth-s.right-s.left,d):_n(c,t.left+l.placed,r,h,d),l.start=r,l.placed+=h,r=c.bottom}else{let h=t.h*u,d=l.size||c.width;$e(l.start)&&(o=l.start),c.fullSize?_n(c,o,s.top,d,n.outerHeight-s.bottom-s.top):_n(c,o,t.top+l.placed,d,h),l.start=o,l.placed+=h,o=c.right}}t.x=o,t.y=r}var xn={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){let n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;let s=rt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Xl(e.boxes),c=a.vertical,l=a.horizontal;I(e.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let u=c.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},s);mr(d,rt(i));let f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=Kl(c.concat(l),h);Ie(a.fullSize,f,h,g),Ie(c,f,h,g),Ie(l,f,h,g)&&Ie(c,f,h,g),ql(f),To(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,To(a.rightAndBottom,f,h,g),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},I(a.chartArea,p=>{let m=p.box;Object.assign(m,e.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},An=class{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}},Ri=class extends An{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},zn="$chartjs",Ql={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ro=e=>e===null||e==="";function tu(e,t){let n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[zn]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Ro(s)){let o=Si(e,"width");o!==void 0&&(e.width=o)}if(Ro(i))if(e.style.height==="")e.height=e.width/(t||2);else{let o=Si(e,"height");o!==void 0&&(e.height=o)}return e}var br=go?{passive:!0}:!1;function eu(e,t,n){e&&e.addEventListener(t,n,br)}function nu(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,br)}function iu(e,t){let n=Ql[e.type]||e.type,{x:i,y:s}=Zt(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Cn(e,t){for(let n of e)if(n===t||n.contains(t))return!0}function su(e,t,n){let i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Cn(a.addedNodes,i),r=r&&!Cn(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function ou(e,t,n){let i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Cn(a.removedNodes,i),r=r&&!Cn(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}var Fe=new Map,Lo=0;function _r(){let e=window.devicePixelRatio;e!==Lo&&(Lo=e,Fe.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function ru(e,t){Fe.size||window.addEventListener("resize",_r),Fe.set(e,t)}function au(e){Fe.delete(e),Fe.size||window.removeEventListener("resize",_r)}function cu(e,t,n){let i=e.canvas,s=i&&gn(i);if(!s)return;let o=fi((a,c)=>{let l=s.clientWidth;n(a,c),l<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{let c=a[0],l=c.contentRect.width,u=c.contentRect.height;l===0&&u===0||o(l,u)});return r.observe(s),ru(e,o),r}function Di(e,t,n){n&&n.disconnect(),t==="resize"&&au(e)}function lu(e,t,n){let i=e.canvas,s=fi(o=>{e.ctx!==null&&n(iu(o,e))},e);return eu(i,t,s),s}var Li=class extends An{acquireContext(t,n){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(tu(t,n),i):null}releaseContext(t){let n=t.canvas;if(!n[zn])return!1;let i=n[zn].initial;["height","width"].forEach(o=>{let r=i[o];L(r)?n.removeAttribute(o):n.setAttribute(o,r)});let s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[zn],!0}addEventListener(t,n,i){this.removeEventListener(t,n);let s=t.$proxies||(t.$proxies={}),r={attach:su,detach:ou,resize:cu}[n]||lu;s[n]=r(t,n,i)}removeEventListener(t,n){let i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:Di,detach:Di,resize:Di}[n]||nu)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return po(t,n,i,s)}isAttached(t){let n=t&&gn(t);return!!(n&&n.isConnected)}};function uu(e){return!pn()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Ri:Li}var Xt=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return de(this.x)&&de(this.y)}getProps(t,n){let i=this.$animations;if(!n||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};function hu(e,t){let n=e.options.ticks,i=du(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?pu(t):[],r=o.length,a=o[0],c=o[r-1],l=[];if(r>s)return gu(t,l,o,r/s),l;let u=fu(o,t,s);if(r>0){let h,d,f=r>1?Math.round((c-a)/(r-1)):null;for(yn(t,l,u,L(f)?0:a-f,a),h=0,d=r-1;h<d;h++)yn(t,l,u,o[h],o[h+1]);return yn(t,l,u,c,L(f)?t.length:c+f),l}return yn(t,l,u),l}function du(e){let t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function fu(e,t,n){let i=mu(e),s=t.length/n;if(!i)return Math.max(s,1);let o=Bs(i);for(let r=0,a=o.length-1;r<a;r++){let c=o[r];if(c>s)return c}return Math.max(s,1)}function pu(e){let t=[],n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function gu(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function yn(e,t,n,i,s){let o=Z(i,0),r=Math.min(Z(s,e.length),e.length),a=0,c,l,u;for(n=Math.ceil(n),s&&(c=s-i,n=c/Math.floor(c/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(l=Math.max(o,0);l<r;l++)l===u&&(t.push(e[l]),a++,u=Math.round(o+a*n))}function mu(e){let t=e.length,n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}var bu=e=>e==="left"?"right":e==="right"?"left":e,Io=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Zo=(e,t)=>Math.min(t||e,e);function Fo(e,t){let n=[],i=e.length/t,s=e.length,o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function _u(e,t,n){let i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6,c=e.getPixelForTick(s),l;if(!(n&&(i===1?l=Math.max(c-o,r-c):t===0?l=(e.getPixelForTick(1)-c)/2:l=(c-e.getPixelForTick(s-1))/2,c+=s<t?l:-l,c<o-a||c>r+a)))return c}function xu(e,t){I(e,n=>{let i=n.gc,s=i.length/2,o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function Re(e){return e.drawTicks?e.tickLength:0}function No(e,t){if(!e.display)return 0;let n=tt(e.font,t),i=rt(e.padding);return(N(e.text)?e.text.length:1)*n.lineHeight+i.height}function yu(e,t){return vt(e,{scale:t,type:"scale"})}function vu(e,t,n){return vt(e,{tick:n,index:t,type:"tick"})}function wu(e,t,n){let i=Js(e);return(n&&t!=="right"||!n&&t==="right")&&(i=bu(i)),i}function ku(e,t,n,i){let{top:s,left:o,bottom:r,right:a,chart:c}=e,{chartArea:l,scales:u}=c,h=0,d,f,g,p=r-s,m=a-o;if(e.isHorizontal()){if(f=pi(i,o,a),R(n)){let x=Object.keys(n)[0],w=n[x];g=u[x].getPixelForValue(w)+p-t}else n==="center"?g=(l.bottom+l.top)/2+p-t:g=Io(e,n,t);d=a-o}else{if(R(n)){let x=Object.keys(n)[0],w=n[x];f=u[x].getPixelForValue(w)-m+t}else n==="center"?f=(l.left+l.right)/2-m+t:f=Io(e,n,t);g=pi(i,r,s),h=n==="left"?-J:J}return{titleX:f,titleY:g,maxWidth:d,rotation:h}}var Gt=class e extends Xt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Q(t,Number.POSITIVE_INFINITY),n=Q(n,Number.NEGATIVE_INFINITY),i=Q(i,Number.POSITIVE_INFINITY),s=Q(s,Number.NEGATIVE_INFINITY),{min:Q(t,i),max:Q(n,s),minDefined:Y(t),maxDefined:Y(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};let a=this.getMatchingVisibleMetas();for(let c=0,l=a.length;c<l;++c)r=a[c].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Q(n,Q(i,n)),max:Q(i,Q(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){B(this.options.beforeUpdate,[this])}update(t,n,i){let{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ao(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let c=a<this.ticks.length;this._convertTicksToLabels(c?Fo(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=hu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){B(this.options.afterUpdate,[this])}beforeSetDimensions(){B(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){B(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),B(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){B(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let n=this.options.ticks,i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=B(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){B(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){B(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,n=t.ticks,i=Zo(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation,r=s,a,c,l;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,f=ot(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),h+6>a&&(a=f/(i-(t.offset?.5:1)),c=this.maxHeight-Re(t.grid)-n.padding-No(t.title,this.chart.options.font),l=Math.sqrt(h*h+d*d),r=an(Math.min(Math.asin(ot((u.highest.height+6)/a,-1,1)),Math.asin(ot(c/l,-1,1))-Math.asin(ot(d/l,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){B(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){B(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let c=No(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=Re(o)+c):(t.height=this.maxHeight,t.width=Re(o)+c),i.display&&this.ticks.length){let{first:l,last:u,widest:h,highest:d}=this._getLabelSizes(),f=i.padding*2,g=yt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){let x=i.mirror?0:m*h.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{let x=i.mirror?0:p*h.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(l,u,m,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){let{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,f=0;c?l?(d=s*t.width,f=i*n.height):(d=i*t.height,f=s*n.width):o==="start"?f=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=n.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=n.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+r}}_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(){B(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)L(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let n=this.options.ticks.sampleSize,i=this.ticks;n<i.length&&(i=Fo(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){let{ctx:s,_longestTextCache:o}=this,r=[],a=[],c=Math.floor(n/Zo(n,i)),l=0,u=0,h,d,f,g,p,m,x,w,_,y,b;for(h=0;h<n;h+=c){if(g=t[h].label,p=this._resolveTickFontOptions(h),s.font=m=p.string,x=o[m]=o[m]||{data:{},gc:[]},w=p.lineHeight,_=y=0,!L(g)&&!N(g))_=Se(s,x.data,x.gc,_,g),y=w;else if(N(g))for(d=0,f=g.length;d<f;++d)b=g[d],!L(b)&&!N(b)&&(_=Se(s,x.data,x.gc,_,b),y+=w);r.push(_),a.push(y),l=Math.max(_,l),u=Math.max(y,u)}xu(o,n);let z=r.indexOf(l),k=a.indexOf(u),M=P=>({width:r[P]||0,height:a[P]||0});return{first:M(0),last:M(n-1),widest:M(z),highest:M(k),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){let n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let n=this._startPixel+t*this._length;return Ws(this._alignToPixels?It(this.chart,n,0):n)}getDecimalForPixel(t){let n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){let n=this.ticks||[];if(t>=0&&t<n.length){let i=n[t];return i.$context||(i.$context=vu(this.getContext(),t,i))}return this.$context||(this.$context=yu(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,n=yt(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,c=o?o.highest.height+r:0;return this.isHorizontal()?c*i>a*s?a/i:c/s:c*s<a*i?c/i:a/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,c=o.offset,l=this.isHorizontal(),h=this.ticks.length+(c?1:0),d=Re(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(O){return It(i,O,p)},w,_,y,b,z,k,M,P,T,v,S,D;if(r==="top")w=x(this.bottom),k=this.bottom-d,P=w-m,v=x(t.top)+m,D=t.bottom;else if(r==="bottom")w=x(this.top),v=t.top,D=x(t.bottom)-m,k=w+m,P=this.top+d;else if(r==="left")w=x(this.right),z=this.right-d,M=w-m,T=x(t.left)+m,S=t.right;else if(r==="right")w=x(this.left),T=t.left,S=x(t.right)-m,z=w+m,M=this.left+d;else if(n==="x"){if(r==="center")w=x((t.top+t.bottom)/2+.5);else if(R(r)){let O=Object.keys(r)[0],V=r[O];w=x(this.chart.scales[O].getPixelForValue(V))}v=t.top,D=t.bottom,k=w+m,P=k+d}else if(n==="y"){if(r==="center")w=x((t.left+t.right)/2);else if(R(r)){let O=Object.keys(r)[0],V=r[O];w=x(this.chart.scales[O].getPixelForValue(V))}z=w-m,M=z-d,T=t.left,S=t.right}let C=Z(s.ticks.maxTicksLimit,h),A=Math.max(1,Math.ceil(h/C));for(_=0;_<h;_+=A){let O=this.getContext(_),V=o.setContext(O),ht=a.setContext(O),F=V.lineWidth,K=V.color,At=ht.dash||[],dt=ht.dashOffset,Ct=V.tickWidth,Bt=V.tickColor,ye=V.tickBorderDash||[],jt=V.tickBorderDashOffset;y=_u(this,_,c),y!==void 0&&(b=It(i,y,F),l?z=M=T=S=b:k=P=v=D=b,f.push({tx1:z,ty1:k,tx2:M,ty2:P,x1:T,y1:v,x2:S,y2:D,width:F,color:K,borderDash:At,borderDashOffset:dt,tickWidth:Ct,tickColor:Bt,tickBorderDash:ye,tickBorderDashOffset:jt}))}return this._ticksLength=h,this._borderValue=w,f}_computeLabelItems(t){let n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:l,padding:u,mirror:h}=o,d=Re(i.grid),f=d+u,g=h?-u:f,p=-yt(this.labelRotation),m=[],x,w,_,y,b,z,k,M,P,T,v,S,D="middle";if(s==="top")z=this.bottom-g,k=this._getXAxisLabelAlignment();else if(s==="bottom")z=this.top+g,k=this._getXAxisLabelAlignment();else if(s==="left"){let A=this._getYAxisLabelAlignment(d);k=A.textAlign,b=A.x}else if(s==="right"){let A=this._getYAxisLabelAlignment(d);k=A.textAlign,b=A.x}else if(n==="x"){if(s==="center")z=(t.top+t.bottom)/2+f;else if(R(s)){let A=Object.keys(s)[0],O=s[A];z=this.chart.scales[A].getPixelForValue(O)+f}k=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")b=(t.left+t.right)/2-f;else if(R(s)){let A=Object.keys(s)[0],O=s[A];b=this.chart.scales[A].getPixelForValue(O)}k=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(c==="start"?D="top":c==="end"&&(D="bottom"));let C=this._getLabelSizes();for(x=0,w=a.length;x<w;++x){_=a[x],y=_.label;let A=o.setContext(this.getContext(x));M=this.getPixelForTick(x)+o.labelOffset,P=this._resolveTickFontOptions(x),T=P.lineHeight,v=N(y)?y.length:1;let O=v/2,V=A.color,ht=A.textStrokeColor,F=A.textStrokeWidth,K=k;r?(b=M,k==="inner"&&(x===w-1?K=this.options.reverse?"left":"right":x===0?K=this.options.reverse?"right":"left":K="center"),s==="top"?l==="near"||p!==0?S=-v*T+T/2:l==="center"?S=-C.highest.height/2-O*T+T:S=-C.highest.height+T/2:l==="near"||p!==0?S=T/2:l==="center"?S=C.highest.height/2-O*T:S=C.highest.height-v*T,h&&(S*=-1),p!==0&&!A.showLabelBackdrop&&(b+=T/2*Math.sin(p))):(z=M,S=(1-v)*T/2);let At;if(A.showLabelBackdrop){let dt=rt(A.backdropPadding),Ct=C.heights[x],Bt=C.widths[x],ye=S-dt.top,jt=0-dt.left;switch(D){case"middle":ye-=Ct/2;break;case"bottom":ye-=Ct;break}switch(k){case"center":jt-=Bt/2;break;case"right":jt-=Bt;break;case"inner":x===w-1?jt-=Bt:x>0&&(jt-=Bt/2);break}At={left:jt,top:ye,width:Bt+dt.width,height:Ct+dt.height,color:A.backdropColor}}m.push({label:y,font:P,textOffset:S,options:{rotation:p,color:V,strokeColor:ht,strokeWidth:F,textAlign:K,textBaseline:D,translation:[b,z],backdrop:At}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:n}=this.options;if(-yt(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width,l,u;return n==="left"?s?(u=this.right+o,i==="near"?l="left":i==="center"?(l="center",u+=c/2):(l="right",u+=c)):(u=this.right-a,i==="near"?l="right":i==="center"?(l="center",u-=c/2):(l="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?l="right":i==="center"?(l="center",u-=c/2):(l="left",u-=c)):(u=this.left+a,i==="near"?l="left":i==="center"?(l="center",u+=c/2):(l="right",u=this.right)):l="right",{textAlign:l,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){let n=this.options.grid;if(!this._isVisible()||!n.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(c,l,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(l.x,l.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){let c=s[o];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;let a=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue,l,u,h,d;this.isHorizontal()?(l=It(t,this.left,r)-r/2,u=It(t,this.right,a)+a/2,h=d=c):(h=It(t,this.top,r)-r/2,d=It(t,this.bottom,a)+a/2,l=u=c),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(l,h),n.lineTo(u,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,s=this._computeLabelArea();s&&_i(i,s);let o=this.getLabelItems(t);for(let r of o){let a=r.options,c=r.font,l=r.label,u=r.textOffset;Ce(i,l,0,u,c,a)}s&&xi(i)}drawTitle(){let{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;let o=tt(i.font),r=rt(i.padding),a=i.align,c=o.lineHeight/2;n==="bottom"||n==="center"||R(n)?(c+=r.bottom,N(i.text)&&(c+=o.lineHeight*(i.text.length-1))):c+=r.top;let{titleX:l,titleY:u,maxWidth:h,rotation:d}=ku(this,c,n,a);Ce(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:wu(a,n,s),textBaseline:"middle",translation:[l,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,n=t.ticks&&t.ticks.z||0,i=Z(t.grid&&t.grid.z,-1),s=Z(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],o,r;for(o=0,r=n.length;o<r;++o){let a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){let n=this.options.ticks.setContext(this.getContext(t));return tt(n.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},pe=class{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let n=Object.getPrototypeOf(t),i;Mu(n)&&(i=this.register(n));let s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,zu(t,r,i),this.override&&j.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){let n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in j[s]&&(delete j[s][i],this.override&&delete Lt[i])}};function zu(e,t,n){let i=ce(Object.create(null),[n?j.get(n):{},j.get(t),e.defaults]);j.set(t,i),e.defaultRoutes&&Su(t,e.defaultRoutes),e.descriptors&&j.describe(t,e.descriptors)}function Su(e,t){Object.keys(t).forEach(n=>{let i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),c=r.join(".");j.route(o,s,c,a)})}function Mu(e){return"id"in e&&"defaults"in e}var Ii=class{constructor(){this.controllers=new pe(Pn,"datasets",!0),this.elements=new pe(Xt,"elements"),this.plugins=new pe(Object,"plugins"),this.scales=new pe(Gt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):I(s,r=>{let a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){let s=rn(t);B(i["before"+s],[],i),n[t](i),B(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){let i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){let s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},mt=new Ii,Zi=class{constructor(){this._init=void 0}notify(t,n,i,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;let o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,n,i,s){s=s||{};for(let o of t){let r=o.plugin,a=r[i],c=[n,s,o.options];if(B(a,c,r)===!1&&s.cancelable)return!1}return!0}invalidate(){L(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){let i=t&&t.config,s=Z(i.options&&i.options.plugins,{}),o=Pu(i);return s===!1&&!n?[]:Au(t,o,s,n)}_notifyStateChanges(t){let n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}};function Pu(e){let t={},n=[],i=Object.keys(mt.plugins.items);for(let o=0;o<i.length;o++)n.push(mt.getPlugin(i[o]));let s=e.plugins||[];for(let o=0;o<s.length;o++){let r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function $u(e,t){return!t&&e===!1?null:e===!0?{}:e}function Au(e,{plugins:t,localIds:n},i,s){let o=[],r=e.getContext();for(let a of t){let c=a.id,l=$u(i[c],s);l!==null&&o.push({plugin:a,options:Cu(e.config,{plugin:a,local:n[c]},l,r)})}return o}function Cu(e,{plugin:t,local:n},i,s){let o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Fi(e,t){let n=j.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Du(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Ou(e,t){return e===t?"_index_":"_value_"}function Bo(e){if(e==="x"||e==="y"||e==="r")return e}function Eu(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ni(e,...t){if(Bo(e))return e;for(let n of t){let i=n.axis||Eu(n.position)||e.length>1&&Bo(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function jo(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Tu(e,t){if(t.data&&t.data.datasets){let n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return jo(e,"x",n[0])||jo(e,"y",n[0])}return{}}function Ru(e,t){let n=Lt[e.type]||{scales:{}},i=t.scales||{},s=Fi(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{let a=i[r];if(!R(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let c=Ni(r,a,Tu(r,e),j.scales[a.type]),l=Ou(c,s),u=n.scales||{};o[r]=ue(Object.create(null),[{axis:c},a,u[c],u[l]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,c=r.indexAxis||Fi(a,t),u=(Lt[a]||{}).scales||{};Object.keys(u).forEach(h=>{let d=Du(h,c),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),ue(o[f],[{axis:d},i[f],u[h]])})}),Object.keys(o).forEach(r=>{let a=o[r];ue(a,[j.scales[a.type],j.scale])}),o}function xr(e){let t=e.options||(e.options={});t.plugins=Z(t.plugins,{}),t.scales=Ru(e,t)}function yr(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Lu(e){return e=e||{},e.data=yr(e.data),xr(e),e}var Vo=new Map,vr=new Set;function vn(e,t){let n=Vo.get(e);return n||(n=t(),Vo.set(e,n),vr.add(n)),n}var Le=(e,t,n)=>{let i=Pe(t,n);i!==void 0&&e.add(i)},Bi=class{constructor(t){this._config=Lu(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=yr(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),xr(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return vn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return vn(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return vn(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){let n=t.id,i=this.type;return vn(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){let i=this._scopeCache,s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){let{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;let c=new Set;n.forEach(u=>{t&&(c.add(t),u.forEach(h=>Le(c,t,h))),u.forEach(h=>Le(c,s,h)),u.forEach(h=>Le(c,Lt[o]||{},h)),u.forEach(h=>Le(c,j,h)),u.forEach(h=>Le(c,un,h))});let l=Array.from(c);return l.length===0&&l.push(Object.create(null)),vr.has(n)&&r.set(n,l),l}chartOptionScopes(){let{options:t,type:n}=this;return[t,Lt[n]||{},j.datasets[n]||{},{type:n},j,un]}resolveNamedOptions(t,n,i,s=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=Wo(this._resolverCache,t,s),c=r;if(Zu(r,n)){o.$shared=!1,i=_t(i)?i():i;let l=this.createResolver(t,i,a);c=Ut(r,i,l)}for(let l of n)o[l]=c[l];return o}createResolver(t,n,i=[""],s){let{resolver:o}=Wo(this._resolverCache,t,i);return R(n)?Ut(o,n,void 0,s):o}};function Wo(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let s=n.join(),o=i.get(s);return o||(o={resolver:fn(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}var Iu=e=>R(e)&&Object.getOwnPropertyNames(e).some(t=>_t(e[t]));function Zu(e,t){let{isScriptable:n,isIndexable:i}=vi(e);for(let s of t){let o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(_t(a)||Iu(a))||r&&N(a))return!0}return!1}var Fu="4.5.1",Nu=["top","bottom","left","right","chartArea"];function Ho(e,t){return e==="top"||e==="bottom"||Nu.indexOf(e)===-1&&t==="x"}function Uo(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Yo(e){let t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),B(n&&n.onComplete,[e],t)}function Bu(e){let t=e.chart,n=t.options.animation;B(n&&n.onProgress,[e],t)}function wr(e){return pn()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var Sn={},Ko=e=>{let t=wr(e);return Object.values(Sn).filter(n=>n.canvas===t).pop()};function ju(e,t,n){let i=Object.keys(e);for(let s of i){let o=+s;if(o>=t){let r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function Vu(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}var ge=class{static defaults=j;static instances=Sn;static overrides=Lt;static registry=mt;static version=Fu;static getChart=Ko;static register(...t){mt.add(...t),Xo()}static unregister(...t){mt.remove(...t),Xo()}constructor(t,n){let i=this.config=new Bi(n),s=wr(t),o=Ko(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||uu(s)),this.platform.updateConfig(i);let a=this.platform.acquireContext(s,r.aspectRatio),c=a&&a.canvas,l=c&&c.height,u=c&&c.width;if(this.id=Is(),this.ctx=a,this.canvas=c,this.width=u,this.height=l,this._options=r,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 Zi,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=qs(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],Sn[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}wt.listen(this,"complete",Yo),wt.listen(this,"progress",Bu),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return L(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return mt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():zi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return bi(this.canvas,this.ctx),this}stop(){return wt.stop(this),this}resize(t,n){wt.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){let i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,zi(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),B(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let n=this.options.scales||{};I(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{}),o=[];n&&(o=o.concat(Object.keys(n).map(r=>{let a=n[r],c=Ni(r,a),l=c==="r",u=c==="x";return{options:a,dposition:l?"chartArea":u?"bottom":"left",dtype:l?"radialLinear":u?"category":"linear"}}))),I(o,r=>{let a=r.options,c=a.id,l=Ni(c,a),u=Z(a.type,r.dtype);(a.position===void 0||Ho(a.position,l)!==Ho(r.dposition))&&(a.position=r.dposition),s[c]=!0;let h=null;if(c in i&&i[c].type===u)h=i[c];else{let d=mt.getScale(u);h=new d({id:c,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,t)}),I(s,(r,a)=>{r||delete i[a]}),I(i,r=>{xn.configure(this,r,r.options),xn.addBox(this,r)})}_updateMetasets(){let t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(Uo("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],n=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){let o=n[i],r=this.getDatasetMeta(i),a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||Fi(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{let c=mt.getController(a),{datasetElementType:l,dataElementType:u}=j.datasets[a];Object.assign(c,{dataElementType:mt.getElement(u),datasetElementType:l&&mt.getElement(l)}),r.controller=new c(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){I(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let n=this.config;n.update();let i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,u=this.data.datasets.length;l<u;l++){let{controller:h}=this.getDatasetMeta(l),d=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(d),r=Math.max(+h.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||I(o,l=>{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Uo("z","_idx"));let{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){I(this.scales,t=>{xn.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!ri(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of n){let r=i==="_removeElements"?-o:o;ju(t,s,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!ri(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;xn.update(this,this.width,this.height,t);let n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],I(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,_t(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(wt.has(this)?this.attached&&!wt.running(this)&&wt.start(this):(this.draw(),Yo({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let n=this._sortedMetasets,i=[],s,o;for(s=0,o=n.length;s<o;++s){let r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=zo(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&_i(n,s),t.controller.draw(),s&&xi(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return ft(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){let o=Hl.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let n=this.data.datasets[t],i=this._metasets,s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=vt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let n=this.data.datasets[t];if(!n)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){let i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);$e(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){let n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),wt.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),bi(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Sn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};I(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,n=this.platform,i=(c,l)=>{n.addEventListener(this,c,l),t[c]=l},s=(c,l)=>{t[c]&&(n.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)},r,a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){I(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},I(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){let s=i?"set":"remove",o,r,a,c;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){r=t[a];let l=r&&this.getDatasetMeta(r.datasetIndex).controller;l&&l[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Me(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){let s=this.options.hover,o=(c,l)=>c.filter(u=>!l.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){let i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){let{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),c=Ns(t),l=Vu(t,this._lastEvent,i,c);i&&(this._lastEvent=null,B(o.onHover,[t,a,this],this),c&&B(o.onClick,[t,a,this],this));let u=!Me(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=l,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function Xo(){return I(ge.instances,e=>e._plugins.invalidate())}function kr(e,t,n=t){e.lineCap=Z(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Z(n.borderDash,t.borderDash)),e.lineDashOffset=Z(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Z(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Z(n.borderWidth,t.borderWidth),e.strokeStyle=Z(n.borderColor,t.borderColor)}function Wu(e,t,n){e.lineTo(n.x,n.y)}function Hu(e){return e.stepped?so:e.tension||e.cubicInterpolationMode==="monotone"?oo:Wu}function zr(e,t,n={}){let i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,c=Math.max(s,r),l=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:c,loop:t.loop,ilen:l<c&&!u?i+l-c:l-c}}function Uu(e,t,n,i){let{points:s,options:o}=t,{count:r,start:a,loop:c,ilen:l}=zr(s,n,i),u=Hu(o),{move:h=!0,reverse:d}=i||{},f,g,p;for(f=0;f<=l;++f)g=s[(a+(d?l-f:f))%r],!g.skip&&(h?(e.moveTo(g.x,g.y),h=!1):u(e,p,g,d,o.stepped),p=g);return c&&(g=s[(a+(d?l:0))%r],u(e,p,g,d,o.stepped)),!!c}function Yu(e,t,n,i){let s=t.points,{count:o,start:r,ilen:a}=zr(s,n,i),{move:c=!0,reverse:l}=i||{},u=0,h=0,d,f,g,p,m,x,w=y=>(r+(l?a-y:y))%o,_=()=>{p!==m&&(e.lineTo(u,m),e.lineTo(u,p),e.lineTo(u,x))};for(c&&(f=s[w(0)],e.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[w(d)],f.skip)continue;let y=f.x,b=f.y,z=y|0;z===g?(b<p?p=b:b>m&&(m=b),u=(h*u+y)/++h):(_(),e.lineTo(y,b),g=z,h=0,p=m=b),x=b}_()}function ji(e){let t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Yu:Uu}function Ku(e){return e.stepped?mo:e.tension||e.cubicInterpolationMode==="monotone"?bo:Et}function Xu(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),kr(e,t.options),e.stroke(s)}function Gu(e,t,n,i){let{segments:s,options:o}=t,r=ji(t);for(let a of s)kr(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}var qu=typeof Path2D=="function";function Ju(e,t,n,i){qu&&!t.options.segment?Xu(e,t,n,i):Gu(e,t,n,i)}var Dn=class extends Xt{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;fo(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ko(this,this.options.segment))}first(){let t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){let t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){let i=this.options,s=t[n],o=this.points,r=wo(this,{property:n,start:s,end:s});if(!r.length)return;let a=[],c=Ku(i),l,u;for(l=0,u=r.length;l<u;++l){let{start:h,end:d}=r[l],f=o[h],g=o[d];if(f===g){a.push(f);continue}let p=Math.abs((s-f[n])/(g[n]-f[n])),m=c(f,g,p,i.stepped);m[n]=t[n],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,n,i){return ji(this)(t,this,n,i)}path(t,n,i){let s=this.segments,o=ji(this),r=this._loop;n=n||0,i=i||this.points.length-n;for(let a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Ju(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function Go(e,t,n,i){let s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}var On=class extends Xt{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){let s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Go(this,t,"x",n)}inYRange(t,n){return Go(this,t,"y",n)}getCenterPoint(t){let{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);let i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){let i=this.options;this.skip||i.radius<.1||!ft(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,hn(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};var Ze={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){let a=e[t].element;if(a&&a.hasValue()){let c=a.tooltipPosition();i.add(c.x),s+=c.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,c)=>a+c)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){let c=e[o].element;if(c&&c.hasValue()){let l=c.getCenterPoint(),u=sn(t,l);u<s&&(s=u,a=c)}}if(a){let c=a.tooltipPosition();n=c.x,i=c.y}return{x:n,y:i}}};function gt(e,t){return t&&(N(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function kt(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
`)>-1?e.split(`
`):e}function Qu(e,t){let{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function qo(e,t){let n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,c=tt(t.bodyFont),l=tt(t.titleFont),u=tt(t.footerFont),h=o.length,d=s.length,f=i.length,g=rt(t.padding),p=g.height,m=0,x=i.reduce((y,b)=>y+b.before.length+b.lines.length+b.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,h&&(p+=h*l.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){let y=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;p+=f*y+(x-f)*c.lineHeight+(x-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let w=0,_=function(y){m=Math.max(m,n.measureText(y).width+w)};return n.save(),n.font=l.string,I(e.title,_),n.font=c.string,I(e.beforeBody.concat(e.afterBody),_),w=t.displayColors?r+2+t.boxPadding:0,I(i,y=>{I(y.before,_),I(y.lines,_),I(y.after,_)}),w=0,n.font=u.string,I(e.footer,_),n.restore(),m+=g.width,{width:m,height:p}}function th(e,t){let{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function eh(e,t,n,i){let{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function nh(e,t,n,i){let{x:s,width:o}=n,{width:r,chartArea:{left:a,right:c}}=e,l="center";return i==="center"?l=s<=(a+c)/2?"left":"right":s<=o/2?l="left":s>=r-o/2&&(l="right"),eh(l,e,t,n)&&(l="center"),l}function Jo(e,t,n){let i=n.yAlign||t.yAlign||th(e,n);return{xAlign:n.xAlign||t.xAlign||nh(e,t,n,i),yAlign:i}}function ih(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function sh(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function Qo(e,t,n,i){let{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:c}=n,l=s+o,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:f}=fe(r),g=ih(t,a),p=sh(t,c,l);return c==="center"?a==="left"?g+=l:a==="right"&&(g-=l):a==="left"?g-=Math.max(u,d)+s:a==="right"&&(g+=Math.max(h,f)+s),{x:ot(g,0,i.width-t.width),y:ot(p,0,i.height-t.height)}}function wn(e,t,n){let i=rt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function tr(e){return gt([],kt(e))}function oh(e,t,n){return vt(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function er(e,t){let n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}var Sr={beforeTitle:pt,title(e){if(e.length>0){let t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:pt,beforeBody:pt,beforeLabel:pt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");let n=e.formattedValue;return L(n)||(t+=n),t},labelColor(e){let n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:pt,afterBody:pt,beforeFooter:pt,footer:pt,afterFooter:pt};function et(e,t,n,i){let s=e[t].call(n,i);return typeof s>"u"?Sr[t].call(n,i):s}var En=class extends Xt{static positioners=Ze;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Mn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=oh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){let{callbacks:i}=n,s=et(i,"beforeTitle",this,t),o=et(i,"title",this,t),r=et(i,"afterTitle",this,t),a=[];return a=gt(a,kt(s)),a=gt(a,kt(o)),a=gt(a,kt(r)),a}getBeforeBody(t,n){return tr(et(n.callbacks,"beforeBody",this,t))}getBody(t,n){let{callbacks:i}=n,s=[];return I(t,o=>{let r={before:[],lines:[],after:[]},a=er(i,o);gt(r.before,kt(et(a,"beforeLabel",this,o))),gt(r.lines,et(a,"label",this,o)),gt(r.after,kt(et(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return tr(et(n.callbacks,"afterBody",this,t))}getFooter(t,n){let{callbacks:i}=n,s=et(i,"beforeFooter",this,t),o=et(i,"footer",this,t),r=et(i,"afterFooter",this,t),a=[];return a=gt(a,kt(s)),a=gt(a,kt(o)),a=gt(a,kt(r)),a}_createItems(t){let n=this._active,i=this.chart.data,s=[],o=[],r=[],a=[],c,l;for(c=0,l=n.length;c<l;++c)a.push(Qu(this.chart,n[c]));return t.filter&&(a=a.filter((u,h,d)=>t.filter(u,h,d,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),I(a,u=>{let h=er(t.callbacks,u);s.push(et(h,"labelColor",this,u)),o.push(et(h,"labelPointStyle",this,u)),r.push(et(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){let i=this.options.setContext(this.getContext()),s=this._active,o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let a=Ze[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);let c=this._size=qo(this,i),l=Object.assign({},a,c),u=Jo(this.chart,i,l),h=Qo(i,l,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){let o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){let{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:c,topRight:l,bottomLeft:u,bottomRight:h}=fe(a),{x:d,y:f}=t,{width:g,height:p}=n,m,x,w,_,y,b;return o==="center"?(y=f+p/2,s==="left"?(m=d,x=m-r,_=y+r,b=y-r):(m=d+g,x=m+r,_=y-r,b=y+r),w=m):(s==="left"?x=d+Math.max(c,u)+r:s==="right"?x=d+g-Math.max(l,h)-r:x=this.caretX,o==="top"?(_=f,y=_-r,m=x-r,w=x+r):(_=f+p,y=_+r,m=x+r,w=x-r),b=_),{x1:m,x2:x,x3:w,y1:_,y2:y,y3:b}}drawTitle(t,n,i){let s=this.title,o=s.length,r,a,c;if(o){let l=bn(i.rtl,this.x,this.width);for(t.x=wn(this,i.titleAlign,i),n.textAlign=l.textAlign(i.titleAlign),n.textBaseline="middle",r=tt(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,c=0;c<o;++c)n.fillText(s[c],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,c+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){let r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:c,boxWidth:l}=o,u=tt(o.bodyFont),h=wn(this,"left",o),d=s.x(h),f=c<u.lineHeight?(u.lineHeight-c)/2:0,g=n.y+f;if(o.usePointStyle){let p={radius:Math.min(l,c)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=s.leftForLtr(d,l)+l/2,x=g+c/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,hn(t,p,m,x),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,hn(t,p,m,x)}else{t.lineWidth=R(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let p=s.leftForLtr(d,l),m=s.leftForLtr(s.xPlus(d,1),l-2),x=fe(r.borderRadius);Object.values(x).some(w=>w!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,dn(t,{x:p,y:g,w:l,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),dn(t,{x:m,y:g+1,w:l-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,l,c),t.strokeRect(p,g,l,c),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,l-2,c-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){let{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:c,boxWidth:l,boxPadding:u}=i,h=tt(i.bodyFont),d=h.lineHeight,f=0,g=bn(i.rtl,this.x,this.width),p=function(M){n.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r),x,w,_,y,b,z,k;for(n.textAlign=r,n.textBaseline="middle",n.font=h.string,t.x=wn(this,m,i),n.fillStyle=i.bodyColor,I(this.beforeBody,p),f=a&&m!=="right"?r==="center"?l/2+u:l+2+u:0,y=0,z=s.length;y<z;++y){for(x=s[y],w=this.labelTextColors[y],n.fillStyle=w,I(x.before,p),_=x.lines,a&&_.length&&(this._drawColorBox(n,t,y,g,i),d=Math.max(h.lineHeight,c)),b=0,k=_.length;b<k;++b)p(_[b]),d=h.lineHeight;I(x.after,p)}f=0,d=h.lineHeight,I(this.afterBody,p),t.y-=o}drawFooter(t,n,i){let s=this.footer,o=s.length,r,a;if(o){let c=bn(i.rtl,this.x,this.width);for(t.x=wn(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=c.textAlign(i.footerAlign),n.textBaseline="middle",r=tt(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){let{xAlign:o,yAlign:r}=this,{x:a,y:c}=t,{width:l,height:u}=i,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:g}=fe(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+h,c),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+l-d,c),n.quadraticCurveTo(a+l,c,a+l,c+d),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+l,c+u-g),n.quadraticCurveTo(a+l,c+u,a+l-g,c+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+f,c+u),n.quadraticCurveTo(a,c+u,a,c+u-f),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,c+h),n.quadraticCurveTo(a,c,a+h,c),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){let n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let r=Ze[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=qo(this,t),c=Object.assign({},r,this._size),l=Jo(n,t,c),u=Qo(t,c,l,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){let n=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(n);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let r=rt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),_o(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),xo(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){let i=this._active,s=t.map(({datasetIndex:a,index:c})=>{let l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[c],index:c}}),o=!Me(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),c=n||!Me(r,o)||a;return c&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,i,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){let{caretX:i,caretY:s,options:o}=this,r=Ze[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}},Mr={id:"tooltip",_element:En,positioners:Ze,afterInit(e,t,n){n&&(e.tooltip=new En({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:Sr},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"]};var rh=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function ah(e,t,n,i){let s=e.indexOf(t);if(s===-1)return rh(e,t,n,i);let o=e.lastIndexOf(t);return s!==o?n:s}var ch=(e,t)=>e===null?null:ot(Math.round(e),0,t);function nr(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}var Tn=class extends Gt{static id="category";static defaults={ticks:{callback:nr}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let n=this._addedLabels;if(n.length){let i=this.getLabels();for(let{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(L(t))return null;let i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:ah(i,t,Z(n,t),this._addedLabels),ch(n,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,n=this.max,i=this.options.offset,s=[],o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return nr.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function lh(e,t){let n=[],{bounds:s,step:o,min:r,max:a,precision:c,count:l,maxTicks:u,maxDigits:h,includeBounds:d}=e,f=o||1,g=u-1,{min:p,max:m}=t,x=!L(r),w=!L(a),_=!L(l),y=(m-p)/(h+1),b=ai((m-p)/g/f)*f,z,k,M,P;if(b<1e-14&&!x&&!w)return[{value:p},{value:m}];P=Math.ceil(m/b)-Math.floor(p/b),P>g&&(b=ai(P*b/g/f)*f),L(c)||(z=Math.pow(10,c),b=Math.ceil(b*z)/z),s==="ticks"?(k=Math.floor(p/b)*b,M=Math.ceil(m/b)*b):(k=p,M=m),x&&w&&o&&js((a-r)/o,b/1e3)?(P=Math.round(Math.min((a-r)/b,u)),b=(a-r)/P,k=r,M=a):_?(k=x?r:k,M=w?a:M,P=l-1,b=(M-k)/P):(P=(M-k)/b,he(P,Math.round(P),b/1e3)?P=Math.round(P):P=Math.ceil(P));let T=Math.max(li(b),li(k));z=Math.pow(10,L(c)?T:c),k=Math.round(k*z)/z,M=Math.round(M*z)/z;let v=0;for(x&&(d&&k!==r?(n.push({value:r}),k<r&&v++,he(Math.round((k+v*b)*z)/z,r,ir(r,y,e))&&v++):k<r&&v++);v<P;++v){let S=Math.round((k+v*b)*z)/z;if(w&&S>a)break;n.push({value:S})}return w&&d&&M!==a?n.length&&he(n[n.length-1].value,a,ir(a,y,e))?n[n.length-1].value=a:n.push({value:a}):(!w||M===a)&&n.push({value:M}),n}function ir(e,t,{horizontal:n,minRotation:i}){let s=yt(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}var me=class extends Gt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return L(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,r=c=>s=n?s:c,a=c=>o=i?o:c;if(t){let c=Ht(s),l=Ht(o);c<0&&l<0?a(0):c>0&&l>0&&r(0)}if(s===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(s-c)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,n=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=lh(s,o);return t.bounds==="ticks"&&ci(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return ln(t,this.chart.options.locale,this.options.ticks.format)}},Rn=class extends me{static id="linear";static defaults={ticks:{callback:Ae.formatters.numeric}};determineDataLimits(){let{min:t,max:n}=this.getMinMax(!0);this.min=Y(t)?t:0,this.max=Y(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),n=t?this.width:this.height,i=yt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},Ne=e=>Math.floor(xt(e)),Kt=(e,t)=>Math.pow(10,Ne(e)+t);function sr(e){return e/Math.pow(10,Ne(e))===1}function or(e,t,n){let i=Math.pow(10,n),s=Math.floor(e/i);return Math.ceil(t/i)-s}function uh(e,t){let n=t-e,i=Ne(n);for(;or(e,t,i)>10;)i++;for(;or(e,t,i)<10;)i--;return Math.min(i,Ne(e))}function hh(e,{min:t,max:n}){t=Q(e.min,t);let i=[],s=Ne(t),o=uh(t,n),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),c=s>o?Math.pow(10,s):0,l=Math.round((t-c)*r)/r,u=Math.floor((t-c)/a/10)*a*10,h=Math.floor((l-u)/Math.pow(10,o)),d=Q(e.min,Math.round((c+u+h*Math.pow(10,o))*r)/r);for(;d<n;)i.push({value:d,major:sr(d),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),d=Math.round((c+u+h*Math.pow(10,o))*r)/r;let f=Q(e.max,d);return i.push({value:f,major:sr(f),significand:h}),i}var Ln=class extends Gt{static id="logarithmic";static defaults={ticks:{callback:Ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){let i=me.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return Y(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:n}=this.getMinMax(!0);this.min=Y(t)?Math.max(0,t):null,this.max=Y(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Y(this._userMin)&&(this.min=t===Kt(this.min,0)?Kt(this.min,-1):Kt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:n}=this.getUserBounds(),i=this.min,s=this.max,o=a=>i=t?i:a,r=a=>s=n?s:a;i===s&&(i<=0?(o(1),r(10)):(o(Kt(i,-1)),r(Kt(s,1)))),i<=0&&o(Kt(s,-1)),s<=0&&r(Kt(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,n={min:this._userMin,max:this._userMax},i=hh(n,this);return t.bounds==="ticks"&&ci(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ln(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=xt(t),this._valueRange=xt(this.max)-xt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(xt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}};function Vi(e){let t=e.ticks;if(t.display&&e.display){let n=rt(t.backdropPadding);return Z(t.font&&t.font.size,j.font.size)+n.height}return 0}function dh(e,t,n){return n=N(n)?n:[n],{w:no(e,t.string,n),h:n.length*t.lineHeight}}function rr(e,t,n,i,s){return e===i||e===s?{start:t-n/2,end:t+n/2}:e<i||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function fh(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),i=[],s=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?U/o:0;for(let c=0;c<o;c++){let l=r.setContext(e.getPointLabelContext(c));s[c]=l.padding;let u=e.getPointPosition(c,e.drawingArea+s[c],a),h=tt(l.font),d=dh(e.ctx,h,e._pointLabels[c]);i[c]=d;let f=lt(e.getIndexAngle(c)+a),g=Math.round(an(f)),p=rr(g,u.x,d.w,0,180),m=rr(g,u.y,d.h,90,270);ph(n,t,f,p,m)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=bh(e,i,s)}function ph(e,t,n,i,s){let o=Math.abs(Math.sin(n)),r=Math.abs(Math.cos(n)),a=0,c=0;i.start<t.l?(a=(t.l-i.start)/o,e.l=Math.min(e.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),s.start<t.t?(c=(t.t-s.start)/r,e.t=Math.min(e.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/r,e.b=Math.max(e.b,t.b+c))}function gh(e,t,n){let i=e.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=n,c=e.getPointPosition(t,i+s+r,o),l=Math.round(an(lt(c.angle+J))),u=yh(c.y,a.h,l),h=_h(l),d=xh(c.x,a.w,h);return{visible:!0,x:c.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function mh(e,t){if(!t)return!0;let{left:n,top:i,right:s,bottom:o}=e;return!(ft({x:n,y:i},t)||ft({x:n,y:o},t)||ft({x:s,y:i},t)||ft({x:s,y:o},t))}function bh(e,t,n){let i=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,c={extra:Vi(o)/2,additionalAngle:r?U/s:0},l;for(let u=0;u<s;u++){c.padding=n[u],c.size=t[u];let h=gh(e,u,c);i.push(h),a==="auto"&&(h.visible=mh(h,l),h.visible&&(l=h))}return i}function _h(e){return e===0||e===180?"center":e<180?"left":"right"}function xh(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function yh(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function vh(e,t,n){let{left:i,top:s,right:o,bottom:r}=n,{backdropColor:a}=t;if(!L(a)){let c=fe(t.borderRadius),l=rt(t.backdropPadding);e.fillStyle=a;let u=i-l.left,h=s-l.top,d=o-i+l.width,f=r-s+l.height;Object.values(c).some(g=>g!==0)?(e.beginPath(),dn(e,{x:u,y:h,w:d,h:f,radius:c}),e.fill()):e.fillRect(u,h,d,f)}}function wh(e,t){let{ctx:n,options:{pointLabels:i}}=e;for(let s=t-1;s>=0;s--){let o=e._pointLabelItems[s];if(!o.visible)continue;let r=i.setContext(e.getPointLabelContext(s));vh(n,r,o);let a=tt(r.font),{x:c,y:l,textAlign:u}=o;Ce(n,e._pointLabels[s],c,l+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function Pr(e,t,n,i){let{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,st);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r<i;r++)o=e.getPointPosition(r,t),s.lineTo(o.x,o.y)}}function kh(e,t,n,i,s){let o=e.ctx,r=t.circular,{color:a,lineWidth:c}=t;!r&&!i||!a||!c||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=c,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),Pr(e,n,r,i),o.closePath(),o.stroke(),o.restore())}function zh(e,t,n){return vt(e,{label:n,index:t,type:"pointLabel"})}var ar=class extends me{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ae.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=rt(Vi(this.options)/2),n=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(n,i)/2)}determineDataLimits(){let{min:t,max:n}=this.getMinMax(!1);this.min=Y(t)&&!isNaN(t)?t:0,this.max=Y(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Vi(this.options))}generateTickLabels(t){me.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,i)=>{let s=B(this.options.pointLabels.callback,[n,i],this);return s||s===0?s:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?fh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,s))}getIndexAngle(t){let n=st/(this._pointLabels.length||1),i=this.options.startAngle||0;return lt(t*n+yt(i))}getDistanceFromCenterForValue(t){if(L(t))return NaN;let n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(L(t))return NaN;let n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){let n=this._pointLabels||[];if(t>=0&&t<n.length){let i=n[t];return zh(this.getContext(),t,i)}}getPointPosition(t,n,i=0){let s=this.getIndexAngle(t)-J+i;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:n,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:i,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:n}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),Pr(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,n=this.options,{angleLines:i,grid:s,border:o}=n,r=this._pointLabels.length,a,c,l;if(n.pointLabels.display&&wh(this,r),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);let d=this.getContext(h),f=s.setContext(d),g=o.setContext(d);kh(this,f,c,r,g)}}),i.display){for(t.save(),a=r-1;a>=0;a--){let u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),l=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;let s=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;let l=i.setContext(this.getContext(c)),u=tt(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[c].value),l.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=l.backdropColor;let h=rt(l.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}Ce(t,a.label,0,-o,u,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}},Zn={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}},nt=Object.keys(Zn);function cr(e,t){return e-t}function lr(e,t){if(L(t))return null;let n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts,r=t;return typeof i=="function"&&(r=i(r)),Y(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(de(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function ur(e,t,n,i){let s=nt.length;for(let o=nt.indexOf(e);o<s-1;++o){let r=Zn[nt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return nt[o]}return nt[s-1]}function Sh(e,t,n,i,s){for(let o=nt.length-1;o>=nt.indexOf(n);o--){let r=nt[o];if(Zn[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return nt[n?nt.indexOf(n):0]}function Mh(e){for(let t=nt.indexOf(e)+1,n=nt.length;t<n;++t)if(Zn[nt[t]].common)return nt[t]}function hr(e,t,n){if(!n)e[t]=!0;else if(n.length){let{lo:i,hi:s}=cn(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function Ph(e,t,n,i){let s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value,a,c;for(a=o;a<=r;a=+s.add(a,1,i))c=n[a],c>=0&&(t[c].major=!0);return t}function dr(e,t,n){let i=[],s={},o=t.length,r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:Ph(e,i,s,n)}var In=class extends Gt{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){let i=t.time||(t.time={}),s=this._adapter=new Nl._date(t.adapters.date);s.init(n),ue(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:lr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,n=this._adapter,i=t.time.unit||"day",{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function c(l){!r&&!isNaN(l.min)&&(s=Math.min(s,l.min)),!a&&!isNaN(l.max)&&(o=Math.max(o,l.max))}(!r||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=Y(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=Y(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){let t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let o=this.min,r=this.max,a=Ys(s,o,r);return this._unit=n.unit||(i.autoSkip?ur(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Sh(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Mh(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),dr(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;n=ot(n,0,r),i=ot(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){let t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ur(o.minUnit,n,i,this._getLabelCapacity(n)),a=Z(s.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,l=de(c)||c===!0,u={},h=n,d,f;if(l&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,l?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);let g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d<i;d=+t.add(d,a,r),f++)hr(u,d,g);return(d===i||s.bounds==="ticks"||f===1)&&hr(u,d,g),Object.keys(u).sort(cr).map(p=>+p)}getLabelForValue(t){let n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){let s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){let o=this.options,r=o.ticks.callback;if(r)return B(r,[t,n,i],this);let a=o.time.displayFormats,c=this._unit,l=this._majorUnit,u=c&&a[c],h=l&&a[l],d=i[n],f=l&&h&&d&&d.major;return this._adapter.format(t,s||(f?h:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){let n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let n=this.options.ticks,i=this.ctx.measureText(t).width,s=yt(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){let n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,dr(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],n,i;if(t.length)return t;let s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(lr(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Gs(t.sort(cr))}};function kn(e,t,n){let i=0,s=e.length-1,o,r,a,c;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Tt(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:c}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Tt(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:c}=e[s]);let l=r-o;return l?a+(c-a)*(t-o)/l:a}var fr=class extends In{static id="timeseries";static defaults=In.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=kn(n,this.min),this._tableRange=kn(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:n,max:i}=this,s=[],o=[],r,a,c,l,u;for(r=0,a=t.length;r<a;++r)l=t[r],l>=n&&l<=i&&s.push(l);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],c=s[r-1],l=s[r],Math.round((u+c)/2)!==l&&o.push({time:l,pos:r/(a-1)});return o}_generate(){let t=this.min,n=this.max,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(kn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return kn(this._table,i*this._tableRange+this._minPos,!0)}};function Ui(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}function $r(e,t){return typeof t=="bigint"?t.toString():t}var Hi=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Yi(e){return new Hi(e)}function Ar(e){return e==null}function Fn(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ki(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}var Xi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Dr=new Set(["string","number","symbol"]);function Ve(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nn(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function W(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Or(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Er={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Tr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Bn(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function je(e){return typeof e=="string"?e:e?.message}function qi(e,t,n){var i;for(let s=t;s<e.length;s++)(i=e[s]).schema??(i.schema=n)}function Jt(e,t,n){var i;let s=e.inst?._zod?.traits;s?.has("$ZodType")&&(s.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,r=e.message?e.message:je(e.inst?._zod.def?.error?.(e))??je(o?.(e))??je(t?.error?.(e))??je(n.customError?.(e))??je(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=e.input),a}var $h=/[\uD800-\uDBFF]/;function Rr(e){let t=e.length;if(!$h.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function Lr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ir(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):Ah(e,n,i.value)}}function qt(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function Ji(e,t,n){return qt(e,t,n,!1)}function Ah(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qt(this,t,n.bind(this))},set(i){qt(this,t,i)}})}function Ch(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Wi,Ft=!1,Dh={configurable:!0,get(){Ft=!0}};function G(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&Wi!==e._zod){Wi=void 0;return}Wi=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,Dh);let s=Ft;Ft=!1;try{let o=n(this);return Ft?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Ft=Ft||s,o}catch(o){throw delete this[t],Ft=Ft||s,o}},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s})}})}function Zr(e,t,n,i){let s=Ch(e,t);s&&Object.defineProperty(s,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Fr;var Qi={value:void 0,enumerable:!1},Nr="captureStackTrace"in Error?Error:null;function Oh(e){let t=Nr;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Nr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function $(e,t,n,i){let s={};function o(d){this.def=d,this.constr=h,this.traits=new Set}o.prototype=s;let r=n,a=r&&new WeakSet;function c(d,f){if(d._zod){if(d._zod.traits.has(e))return}else{Qi.value=new o(f);try{Object.defineProperty(d,"_zod",Qi)}finally{Qi.value=void 0}}if(d._zod.traits.add(e),t(d,f),a){let p=Object.getPrototypeOf(d),m=d._zod.constr.prototype,x=p;for(;x&&x!==m;)x=Object.getPrototypeOf(x);let w=x??p;a.has(w)||(a.add(w),Ir(w,r))}let g=h.prototype;for(let p in g)Object.prototype.hasOwnProperty.call(g,p)&&(p in d||(d[p]=g[p].bind(d)))}let l=i?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function h(d){let f=i?.Parent?Oh(u):this;c(f,d);let g=f._zod.deferred;if(g){for(let m of g)m();f._zod.deferred=void 0}let p=globalThis.__zod_globalConfig?.postProcessor;return p&&p(f),f}return Object.defineProperty(h,"init",{value:c}),Object.defineProperty(h,Symbol.hasInstance,{value:d=>i?.Parent&&d instanceof i.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}var St=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(Fr=globalThis).__zod_globalConfig??(Fr.__zod_globalConfig={});var We=globalThis.__zod_globalConfig;function te(e){return e&&Object.assign(We,e),We}function Eh(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,$r,2)),e.message}function Th(e){this._zod.message=e}var Rh={get:Eh,set:Th,enumerable:!0,configurable:!0},es={value:void 0,enumerable:!1},Br=new WeakSet([Object.prototype,Error.prototype]),jr=(e,t)=>{e.name="$ZodError",es.value=t,Object.defineProperty(e,"issues",es),es.value=void 0,Object.defineProperty(e,"message",Rh);let n=Object.getPrototypeOf(e);Br.has(n)||(Br.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},Nd=$("$ZodError",jr),He=$("$ZodError",jr,void 0,{Parent:Error});var Ih=e=>{let t=(n,i,s,o)=>{let r=s?{...s,async:!1}:{async:!1},a=n._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new St;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>Jt(l,r,te())));throw Xi(c,o?.callee??t),c}return a.value};return t},ns=Ih(He),Zh=e=>{let t=async(n,i,s,o)=>{let r=s?{...s,async:!0}:{async:!0},a=n._zod.run({value:i,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>Jt(l,r,te())));throw Xi(c,o?.callee??t),c}return a.value};return t},is=Zh(He),Fh=e=>(t,n,i)=>{let s=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new St;return o.issues.length?Vr(e,o.issues,s):{success:!0,data:o.value}},ss=Fh(He);function Vr(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(s=>Jt(s,n,te()))),t=void 0,n=void 0),i},set error(s){i=s,t=void 0,n=void 0}}}var Nh=e=>async(t,n,i)=>{let s=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?Vr(e,o.issues,s):{success:!0,data:o.value}},os=Nh(He);var Wr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Hr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Bh(e){return new RegExp(`^${e}$`)}var Ur=Bh(Hr);function rs(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yr(e){return new RegExp(`^${rs(e)}$`)}function Kr(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${rs({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${rs({precision:e.precision})}`:n;return new RegExp(`^${Hr}T(?:${i})$`)}var Xr=/^[\s\S]{0,}$/;var Gr=/^-?\d+(?:\.\d+)?$/,qr=/^(?:true|false)$/i,Jr=/^null$/i;var ee=$("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var jh=e=>{let t=e.value;return!Ar(t)&&t.length!==void 0},ta={number:"number",bigint:"bigint",object:"date"};var ea=$("$ZodCheckGreaterThan",(e,t)=>{ee.init(e,t);let n=ta[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:ta[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});var na=$("$ZodCheckNumberFormat",(e,t)=>{ee.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[s,o]=Er[t.format];e._zod.check=r=>{let a=r.value;if(n){if(!Number.isInteger(a)){r.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?r.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):r.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}a<s&&r.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),a>o&&r.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});var ia=$("$ZodCheckMinLength",(e,t)=>{var n;ee.init(e,t),(n=e._zod.def).when??(n.when=jh),e._zod.check=i=>{let s=i.value,o=s.length;if((typeof s=="string"&&o>=t.minimum&&o<t.minimum*2?Rr(s):o)>=t.minimum)return;let a=Lr(s);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var as=$("$ZodCheckStringFormat",(e,t)=>{var n,i;ee.init(e,t),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),sa=$("$ZodCheckRegex",(e,t)=>{as.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var ra={major:4,minor:6,patch:5};var it=$("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ra;let i=e._zod.def.checks,s=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(let o of s)for(let r of o._zod.onattach)r(e);if(s.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,l)=>{if(a.memo)return a;let u=zt(a),h;for(let d of c){if(d._zod.def.when){if(Tr(a)||!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new St;if(h||g instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await g,a.issues.length!==f&&(qi(a.issues,f,e),u||(u=zt(a,f)))});else{if(a.issues.length===f)continue;qi(a.issues,f,e),u||(u=zt(a,f))}}return h?h.then(()=>a):a},r=(a,c,l)=>{if(zt(a))return a.aborted=!0,a;let u=o(c,s,l);if(u instanceof Promise){if(l.async===!1)throw new St;return u.then(h=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(h=>r(h,a,c)):r(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new St;return l.then(u=>o(u,s,c))}return o(l,s,c)}}},{get"~standard"(){return Ji(this,"~standard",Hh(this))},set"~standard"(e){qt(this,"~standard",e)}}),ua=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Jt(n,t,te()))}:{value:e.value};async function Wh(e,t){let n={async:!0};return ua(await e._zod.run({value:t,issues:[]},n),n)}function Hh(e){return{validate:t=>{let n={async:!1};try{let i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return ua(i,n)}catch{}return Wh(e,t)},vendor:"zod",version:1}}var cs=$("$ZodString",(e,t)=>{it.init(e,t),e._zod.pattern=t.pattern??Xr,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),be=$("$ZodStringFormat",(e,t)=>{as.init(e,t),cs.init(e,t)});var ha=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Kr(t)),be.init(e,t)}),da=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ur),be.init(e,t)}),fa=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yr(t)),be.init(e,t)}),pa=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Wr),be.init(e,t)});var ls=$("$ZodNumber",(e,t)=>{it.init(e,t),e._zod.pattern=Gr,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;let o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:String(s):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),ga=$("$ZodNumberFormat",(e,t)=>{na.init(e,t),ls.init(e,t)}),ma=$("$ZodBoolean",(e,t)=>{it.init(e,t),e._zod.pattern=qr,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}});var ba=$("$ZodNull",(e,t)=>{it.init(e,t),e._zod.pattern=Jr,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}});var _a=$("$ZodNever",(e,t)=>{it.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function aa(e,t,n){e.issues.length&&t.issues.push(...Bn(n,e.issues)),t.value[n]=e.value}var xa=$("$ZodArray",(e,t)=>{it.init(e,t);let n=We.memoizer;n?.attach(e),e._zod.parse=(i,s)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),i;i.value=n?n.alloc(e,i,Array(o.length),s):Array(o.length);let r=[],a=s?.abortEarly;for(let c=0;c<o.length;c++){let l=o[c],u=t.element._zod.run({value:l,issues:[]},s);if(u instanceof Promise)r.push(u.then(h=>aa(h,i,c)));else if(aa(u,i,c),a&&u.issues.length!==0&&zt(u))break}return r.length?Promise.all(r).then(()=>i):i}});function jn(e,t,n,i,s,o){let r=n in i,a=o==="optional";if(!(!r&&a&&s==="optional")){if(e.issues.length){if(s!==void 0&&a&&!r)return;t.issues.push(...Bn(n,e.issues))}if(!r&&s===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(r||s==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}var Uh=[];function Yh(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:Uh,s=i.length?[...t,...i]:t;for(let r of s)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(r)}": expected a Zod schema`);let o=Or(e.shape);return{...e,allKeys:s,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Kh(e,t,n,i,s,o,r){let a=[],c=s.keySet,l=s.catchall._zod,u=l.def.type,h=l.optin,d=l.optout,f=0;for(let g in t){if(r&&n.issues.length!==f){if(zt(n,f))break;f=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){u==="never"&&a.push(g);continue}if(u==="never"){a.push(g);continue}let p=l.run({value:t[g],issues:[]},i);p instanceof Promise?e.push(p.then(m=>jn(m,n,g,t,h,d))):jn(p,n,g,t,h,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var ya=$("$ZodObject",(e,t)=>{it.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){let l=()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(t,"shape",{get:l})}let s=Yi(()=>Yh(t));G(e,"propValues",l=>{let u=l.def.shape,h={};for(let d in u){let f=u[d]._zod;if(f.values){Object.prototype.hasOwnProperty.call(h,d)||Ki(h,d,new Set);for(let g of f.values)h[d].add(g);f.optin!==void 0&&h[d].add(void 0)}}return h});let o=Gi,r=t.catchall,a,c=We.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=s.value);let h=l.value;if(!o(h))return l.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let d=[],f=a.shape,g=u?.abortEarly,p=l.issues.length;for(let m of a.allKeys){if(g&&l.issues.length!==p){if(zt(l,p))break;p=l.issues.length}if(m==="__proto__")continue;let x=f[m],w=x._zod.optin,_=x._zod.optout,y=x._zod.run({value:h[m],issues:[]},u);y instanceof Promise?d.push(y.then(b=>jn(b,l,m,h,w,_))):jn(y,l,m,h,w,_)}return r?Kh(d,h,l,u,s.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}});function ca(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let s=e.filter(o=>!zt(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(r=>Jt(r,i,te())))}),t)}var va=$("$ZodUnion",(e,t)=>{it.init(e,t),G(e,"optin",i=>i.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),G(e,"optout",i=>i.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),G(e,"values",i=>{if(i.def.options.every(s=>s._zod.values))return new Set(i.def.options.flatMap(s=>Array.from(s._zod.values)))}),G(e,"pattern",i=>{if(i.def.options.every(s=>s._zod.pattern)){let s=i.def.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Fn(o.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,s)=>{if(n)return n(i,s);let o=!1,r=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},s);if(c instanceof Promise)r.push(c),o=!0;else{if(c.issues.length===0)return c;r.push(c)}}return o?Promise.all(r).then(a=>ca(a,i,e,s)):ca(r,i,e,s)}});function Xh(e){let t=new Map;for(let n of e.options){let i=n._zod.propValues?.[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let s of i)if(t.has(s)){if(s!==void 0)throw new Error(`Duplicate discriminator value "${String(s)}"`);t.set(s,null)}else t.set(s,n)}return t}var wa=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,va.init(e,t);let n=e._zod.parse;G(e,"propValues",s=>{let o={},r=0;for(let a of s.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${s.def.options.indexOf(a)}"`);c[s.def.discriminator]?.has(void 0)&&r++;for(let[l,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(o,l)||Ki(o,l,new Set);for(let h of u)o[l].add(h)}}return!s.def.unionFallback&&r>1&&o[s.def.discriminator]?.delete(void 0),o}),t.options.forEach((s,o)=>{let r=Cr(s._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw new Error(`Invalid discriminated union option at index "${o}"`)});let i=Yi(()=>Xh(t));e._zod.parse=(s,o)=>{let r=s.value;if(!Gi(r))return s.issues.push({code:"invalid_type",expected:"object",input:r,inst:e}),s;let a=r?.[t.discriminator],c=i.value.get(a);return c&&(a!==void 0||o.direction!=="backward")?c._zod.run(s,o):t.unionFallback||o.direction==="backward"?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()).filter(l=>i.value.get(l)!==null),input:r,path:[t.discriminator],inst:e}),s)}});var ka=$("$ZodEnum",(e,t)=>{it.init(e,t);let n=Ui(t.entries),i=new Set(n);e._zod.values=i,G(e,"pattern",s=>{let o=Ui(s.def.entries).filter(r=>Dr.has(typeof r));return new RegExp(o.length?`^(${o.map(r=>Ve(r.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,o)=>{let r=s.value;return i.has(r)||s.issues.push({code:"invalid_value",values:n,input:r,inst:e}),s}}),za=$("$ZodLiteral",(e,t)=>{it.init(e,t);let n=new Set(t.values);e._zod.values=n,G(e,"pattern",i=>{let s=i.def.values;return new RegExp(s.length?`^(${s.map(o=>typeof o=="string"?Ve(o):o?Ve(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,s)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}});function la(e,t){return e.value=t.issues.length?void 0:t.value,e}var Sa=$("$ZodOptional",(e,t)=>{it.init(e,t),G(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",G(e,"values",n=>{let i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),G(e,"pattern",n=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Fn(i.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let s=t.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(o=>la(n,o)):la(n,s)}return t.innerType._zod.run(n,i)}});var Ma=$("$ZodNullable",(e,t)=>{it.init(e,t),G(e,"optin",n=>n.def.innerType._zod.optin),G(e,"optout",n=>n.def.innerType._zod.optout),G(e,"pattern",n=>{let i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Fn(i.source)}|null)$`):void 0}),G(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)});function Pa(e){return e.checks&&(e.checks=[...e.checks]),e}function $a(e,t){return new e(Pa({type:"string",...W(t)}))}function Aa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...W(t)})}function Ca(e,t){return new e({type:"string",format:"date",check:"string_format",...W(t)})}function Da(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...W(t)})}function Oa(e,t){return new e({type:"string",format:"duration",check:"string_format",...W(t)})}function Ea(e,t){return new e(Pa({type:"number",checks:[],...W(t)}))}function Ta(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...W(t)})}function Ra(e,t){return new e({type:"boolean",...W(t)})}function La(e,t){return new e({type:"null",...W(t)})}function Ia(e,t){return new e({type:"never",...W(t)})}function us(e,t){return new ea({check:"greater_than",...W(t),value:e,inclusive:!0})}function Ue(e){return us(0,e)}function hs(e,t){return new ia({check:"min_length",...W(t),minimum:e})}function ne(e,t){return new sa({check:"string_format",format:"regex",...W(t),pattern:e})}var ut=$("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");it.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){qt(this,"with",e)},parse(e,t){return ns(this,e,t,{callee:this.parse})},parseAsync(e,t){return is(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return ss(this,e,t)},safeParseAsync(e,t){return os(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0})},clone(e,t){return Nn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Fa=$("ZodMiniString",(e,t)=>{cs.init(e,t),ut.init(e,t)});function E(e){return $a(Fa,e)}var Ye=$("ZodMiniStringFormat",(e,t)=>{be.init(e,t),Fa.init(e,t)});var Na=$("ZodMiniNumber",(e,t)=>{ls.init(e,t),ut.init(e,t)});function Vn(e){return Ea(Na,e)}var Jh=$("ZodMiniNumberFormat",(e,t)=>{ga.init(e,t),Na.init(e,t)});function Wn(e){return Ta(Jh,e)}var Qh=$("ZodMiniBoolean",(e,t)=>{ma.init(e,t),ut.init(e,t)});function Ba(e){return Ra(Qh,e)}var td=$("ZodMiniNull",(e,t)=>{ba.init(e,t),ut.init(e,t)});function ds(e){return La(td,e)}var ed=$("ZodMiniNever",(e,t)=>{_a.init(e,t),ut.init(e,t)});function nd(e){return Ia(ed,e)}var id=$("ZodMiniArray",(e,t)=>{xa.init(e,t),ut.init(e,t)});function H(e,t){return new id({type:"array",element:e,...W(t)})}var sd=$("ZodMiniObject",(e,t)=>{ya.init(e,t),ut.init(e,t),Zr(e,"shape",n=>n._zod.def.shape,!1)});function q(e,t){return new sd({type:"object",shape:e,catchall:nd(),...W(t)})}var od=$("ZodMiniDiscriminatedUnion",(e,t)=>{wa.init(e,t),ut.init(e,t)});function ja(e,t,n){return new od({type:"union",options:t,discriminator:e,...W(n)})}var rd=$("ZodMiniEnum",(e,t)=>{ka.init(e,t),ut.init(e,t),e.options=[...e._zod.values]});function Mt(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new rd({type:"enum",entries:n,...W(t)})}var ad=$("ZodMiniLiteral",(e,t)=>{za.init(e,t),ut.init(e,t)});function ie(e,t){return new ad({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}var cd=$("ZodMiniOptional",(e,t)=>{Sa.init(e,t),ut.init(e,t)});function Hn(e){return new cd({type:"optional",innerType:e})}var ld=$("ZodMiniNullable",(e,t)=>{Ma.init(e,t),ut.init(e,t)});function X(e){return new ld({type:"nullable",innerType:e})}var se={};cc(se,{ZodMiniISODate:()=>Wa,ZodMiniISODateTime:()=>Va,ZodMiniISODuration:()=>Ua,ZodMiniISOTime:()=>Ha,date:()=>fd,datetime:()=>dd,duration:()=>gd,time:()=>pd});var Va=$("ZodMiniISODateTime",(e,t)=>{ha.init(e,t),Ye.init(e,t)});function dd(e){return Aa(Va,e)}var Wa=$("ZodMiniISODate",(e,t)=>{da.init(e,t),Ye.init(e,t)});function fd(e){return Ca(Wa,e)}var Ha=$("ZodMiniISOTime",(e,t)=>{fa.init(e,t),Ye.init(e,t)});function pd(e){return Da(Ha,e)}var Ua=$("ZodMiniISODuration",(e,t)=>{pa.init(e,t),Ye.init(e,t)});function gd(e){return Oa(Ua,e)}var at=Vn().check(Wn(),Ue()),bd=E().check(ne(/^[a-f0-9]{40}$/)),fs=E().check(ne(/^[a-f0-9]{64}$/)),_d=Mt(["uno","esp32s3","esp32dev","teensy41"]),gs=Mt(["blink","spi","features"]),Ya={sketch:gs,board:_d,version:E().check(hs(1)),sha:bd,measured_at:se.datetime({offset:!0})},xd=q({...Ya,status:ie("ok"),flash:at,ram:at,image_flash:at,attributed_ram:at,protocol:fs,source_digest:fs,bloat_report:E().check(ne(/^data\/reports\/(uno|esp32s3|esp32dev|teensy41)\/[a-f0-9]{40}-[a-f0-9]{12}\.json$/)),fbuild:E(),serial_symbols:H(E()),toolchain:X(E()),defines:X(H(E())),flags:X(H(E())),config:E(),elf_digest:fs}),yd=q({...Ya,status:ie("error"),flash:ds(),ram:ds(),error:E()}),vd=ja("status",[xd,yd]),Ka=q({schema:ie(2),results:H(vd),updated_at:se.datetime({offset:!0}),versions:H(E()),fbuild:E()}),wd=q({archive:X(E()),object:X(E())}),kd=q({mangled:E(),demangled:E(),address:at,size:at,sym_type:E(),region:Mt(["flash","ram"]),archive:X(E()),object:X(E()),output_section:X(E()),source:E(),referenced_by:H(wd),references_to:H(E()),called_by:H(E())}),Un=q({name:E(),address:at,source:E()}),ps=q({status:Mt(["analyzed","unavailable","error"]),tool:X(E()),reason:X(E())}),zd=q({schema:ie(1),disassembly:ps,static_data:ps,object_references:ps,edges:H(q({source:Un,target:Un,kind:Mt(["disassembly","static_data","fragment_owner"]),offset:X(at)})),roots:H(q({symbol:Un,kind:E()})),unexplained:H(Un),unresolved:H(q({name:E(),address:at})),limitations:H(E())}),Xa=q({reference_analysis:Hn(zd),elf_path:E(),map_path:X(E()),total_flash:at,total_ram:at,image_flash:at,symbols:H(kd),sections:H(q({archive:X(E()),object:X(E()),output_section:E(),bytes:at}))});var Ga=(e,t)=>e.getDatasetMeta(t).data;var ms=e=>e.scales.y.ticks.filter(t=>t.label!=null).map(t=>({value:t.value,y:e.scales.y.getPixelForValue(t.value),opacity:1})),qa={id:"scaleTransition",afterUpdate(e){let n=e.scales.y;if(!n.$transitionDraw){for(let i of["drawGrid","drawLabels","drawBorder","drawTitle"])n[i]=()=>{};n.$transitionDraw=!0}},beforeDatasetsDraw(e){let t=e,n=t.$scaleTransition?.ticks||ms(t),{ctx:i,chartArea:s}=t;i.save(),i.font="12px sans-serif",i.textAlign="right",i.textBaseline="middle";for(let o of n)o.opacity<=0||(i.globalAlpha=o.opacity,i.strokeStyle="#263143",i.beginPath(),i.moveTo(s.left,o.y),i.lineTo(s.right,o.y),i.stroke(),i.fillStyle="#8594aa",i.fillText(Math.round(o.value).toLocaleString("en-US"),s.left-10,o.y));i.restore()},resize(e){let t=e;cancelAnimationFrame(t.$scaleFrame??0),t.$scaleTransition=null},beforeDestroy(e){cancelAnimationFrame(e.$scaleFrame??0)}};function Ja(e,t,n){let i=n==="logarithmic";cancelAnimationFrame(e.$scaleFrame??0);let s=e.$scaleTransition?.ticks||ms(e),o=e.scales.y,r=e.$scaleTransition?.positionForValue||(b=>o.getPixelForValue(b)),a=e.data.datasets.map((b,z)=>Ga(e,z).map(k=>({x:k.x,y:k.y})));e.$scaleTransition={ticks:s},e.options.animation=!1,e.options.scales.y.type=n,e.options.scales.y.beginAtZero=n==="linear";for(let b of e.data.datasets)b.data=b.rows.map(z=>z&&Number.isFinite(z[t])&&(!i||z[t]>0)?z[t]:null);let c=e.render;e.render=()=>{};try{e.update("none")}finally{e.render=c}let l=ms(e),u=e.scales.y,h=b=>u.getPixelForValue(b),d=e.data.datasets.map((b,z)=>e.getDatasetMeta(z).data.map(k=>({x:k.x,y:k.y}))),f=new Map(s.map(b=>[b.value,b])),g=new Map(l.map(b=>[b.value,b])),p=[...new Set([...f.keys(),...g.keys()])],m=b=>Number.isFinite(b)?Math.max(e.chartArea.top,Math.min(e.chartArea.bottom,b)):e.chartArea.bottom,x=p.map(b=>({value:b,fromY:f.get(b)?.y??m(r(b)),toY:g.get(b)?.y??m(h(b)),fromOpacity:f.get(b)?.opacity??(f.has(b)?1:0),toOpacity:g.has(b)?1:0})),w=performance.now(),_=(b,z,k)=>b+(z-b)*k,y=b=>{let z=Math.min(1,(b-w)/1e3),k=z<.5?4*z**3:1-(-2*z+2)**3/2;e.$scaleTransition.positionForValue=M=>_(m(r(M)),m(h(M)),k),e.$scaleTransition.ticks=x.map(M=>({value:M.value,y:_(M.fromY,M.toY,k),opacity:_(M.fromOpacity,M.toOpacity,k)})),e.data.datasets.forEach((M,P)=>{let T=e.getDatasetMeta(P);T.dataset._path=void 0,T.data.forEach((v,S)=>{let D=a[P][S],C=d[P][S];v.x=_(D.x,C.x,k),v.y=_(D.y,C.y,k)})}),z===1&&(e.$scaleTransition=null),e.draw(),z<1&&(e.$scaleFrame=requestAnimationFrame(y))};y(w)}function Pt(e){let t=document.getElementById(e);if(!t)throw new Error("Missing element "+e);return t}var oe=[{id:"uno",name:"Uno AVR",color:"#71dbb5"},{id:"esp32s3",name:"ESP32-S3",color:"#7aa9ff"},{id:"esp32dev",name:"ESP32 Dev",color:"#e9aa70"},{id:"teensy41",name:"Teensy 4.1",color:"#c79af5"}];var Nt=e=>`${e.toLocaleString("en-US")} B`,Yn=e=>{let t=new Date(e||"");return!e||Number.isNaN(t.getTime())?"Date unavailable":t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},Kn=e=>e&&!Number.isNaN(new Date(e).getTime())?new Date(e).toLocaleString(void 0,{timeZoneName:"short"}):"Date unavailable";var Xn=Vn().check(Wn(),Ue()),Qa=q({schema:ie(1),report:E(),elf_digest:E().check(ne(/^[a-f0-9]{64}$/)),fbuild:E(),elf_verified:Hn(Ba()),analyzed_at:se.datetime({offset:!0}),entry_address:X(Xn),disassembly:Mt(["analyzed","unavailable","error"]),cross_reference_table:Mt(["present","absent","unknown"]),incoming_edges:Xn,outgoing_edges:Xn,object_references:Xn,unexplained_symbols:H(E()),unresolved_names:H(E()),warnings:H(E())});function tc(e){return e.replace(/\.json$/,"-references.json")}function ec(e){let t=new Map;for(let n of e.symbols)for(let i of new Set([n.mangled,n.demangled])){let s=t.get(i)??[];s.push(n),t.set(i,s)}return t}function nc(e,t){return e.report===t.bloat_report&&e.elf_digest===t.elf_digest&&e.fbuild===t.fbuild}function ic(e,t){return e.mangled===t.name&&e.address===t.address&&e.source===t.source}function _e(e){return JSON.stringify([e.name,e.address,e.source])}function bs(e){return _e({name:e.mangled,address:e.address,source:e.source})}var xe=class{symbols=new Map;incoming=new Map;roots=new Map;report;audit;constructor(t,n){this.report=t,this.audit=t.reference_analysis&&n?.elf_verified!==!0?null:n;for(let i of t.symbols){let s=bs(i),o=this.symbols.get(s)??[];o.push(i),this.symbols.set(s,o)}if(this.audit){for(let i of t.reference_analysis?.edges??[]){let s=_e(i.target),o=this.incoming.get(s)??[];o.push(i),this.incoming.set(s,o)}for(let i of t.reference_analysis?.roots??[]){let s=_e(i.symbol),o=this.roots.get(s)??[];o.push(i),this.roots.set(s,o)}}}state(t){return this.report.reference_analysis&&!this.audit?"Reference analysis unverified":Md(t,this.audit,this.report.reference_analysis,this)}};function Sd(e,t){return t.edges.filter(n=>ic(e,n.target))}function _s(e){return e.disassembly.status==="analyzed"&&e.static_data.status==="analyzed"}function Md(e,t,n,i){if(n){let s=i?i.roots.get(bs(e))??[]:n.roots.filter(o=>ic(e,o.symbol));return s.length?`Confirmed retention root \xB7 ${s.map(o=>o.kind).join(", ")}`:(i?i.incoming.get(bs(e))??[]:Sd(e,n)).length?"Incoming symbol references recorded":e.referenced_by.length?"Object-file references recorded":_s(n)?"No incoming references recorded \xB7 retention unexplained":"Symbol reference analysis unavailable or incomplete"}return e.called_by.length?"Incoming symbol references recorded":e.referenced_by.length?"Object-file references recorded":t?.entry_address===e.address?"ELF entry point \xB7 retention root":!t||t.disassembly!=="analyzed"?"Symbol reference analysis unavailable":"No incoming references recorded \xB7 retention unexplained"}function sc(e,t,n,i=new xe(t,n)){let s=ec(t),o=document.createElement("div");o.id="symbol-reference-popup",o.className="reference-popup",o.setAttribute("role","dialog"),o.setAttribute("aria-label","Direct references to symbol"),o.hidden=!0,e.append(o);let r=null,a=!1,c,l=()=>{c&&clearTimeout(c),c=void 0},u=()=>{l(),o.hidden=!0,r?.setAttribute("aria-expanded","false"),r=null},h=()=>{l(),c=setTimeout(()=>{!o.matches(":hover")&&!o.contains(document.activeElement)&&document.activeElement!==r&&u()},180)};o.addEventListener("pointerenter",l),o.addEventListener("pointerleave",h),o.addEventListener("focusout",h);let d=g=>{if(!o.hidden){g.preventDefault();let p=r;u(),a=!0,p?.focus(),a=!1}};e.addEventListener("cancel",d),e.addEventListener("close",u),e.addEventListener("scroll",u);let f=(g,p)=>{if(l(),r===g&&!o.hidden)return;r?.setAttribute("aria-expanded","false"),r=g,g.setAttribute("aria-expanded","true"),o.replaceChildren();let m=document.createElement("button");m.className="reference-close",m.textContent="\xD7",m.setAttribute("aria-label","Close symbol references"),m.addEventListener("click",()=>{u(),a=!0,g.focus(),a=!1});let x=document.createElement("h4");x.textContent=p.demangled;let w=document.createElement("p");w.className="reference-state",w.textContent=i.state(p),o.append(m,x,w);let _=(C,A,O)=>{let V=document.createElement("h5");if(V.textContent=`${C} \xB7 ${A.length}`,o.append(V),!A.length){let dt=document.createElement("p");dt.textContent=O,o.append(dt);return}let ht=document.createElement("ul");o.append(ht);let F=0,K=document.createElement("button");K.className="reference-more";let At=()=>{for(let dt of A.slice(F,F+50)){let Ct=document.createElement("li");Ct.textContent=dt,ht.append(Ct)}F=Math.min(F+50,A.length),K.textContent=`Show ${Math.min(50,A.length-F)} more references`,K.hidden=F===A.length};K.addEventListener("click",At),At(),o.append(K)},y=i.audit?t.reference_analysis:void 0;if(y){let C=i.incoming.get(_e({name:p.mangled,address:p.address,source:p.source}))??[];for(let[O,V,ht]of[["disassembly","Disassembly references","No disassembly references recorded."],["static_data","Static pointer owners","No static pointer owners recorded."],["fragment_owner","Fragment owners","No fragment owners recorded."]])_(V,C.filter(F=>F.kind===O).map(F=>{let K=i.symbols.get(_e(F.source))?.[0];return`${K?.demangled??F.source.name}${F.offset===null?"":` + 0x${F.offset.toString(16)}`} \xB7 ${F.source.source} @ 0x${F.source.address.toString(16)}${K?` \xB7 ${K.size.toLocaleString()} B \xB7 ${K.region}`:" (not resolved in this report)"}`}),ht);let A=document.createElement("p");A.className="reference-caveat",A.textContent=[`Disassembly: ${y.disassembly.status}; static data: ${y.static_data.status}; object references: ${y.object_references.status}.`,...[y.disassembly,y.static_data,y.object_references].flatMap(O=>O.reason?[O.reason]:[])].join(" "),o.append(A)}else t.reference_analysis||_("Incoming symbols",[...new Set(p.called_by)].map(C=>{let A=s.get(C);return A?.length?A.map(O=>`${O.demangled} \xB7 ${O.size.toLocaleString()} B \xB7 ${O.region} \xB7 ${O.source} @ 0x${O.address.toString(16)}`).join(" / "):`${C} (not resolved in this report)`}),"No symbol-level incoming references recorded.");(y||!t.reference_analysis)&&_("Referencing object files",[...new Set(p.referenced_by.map(C=>`${C.archive?C.archive+" / ":""}${C.object??"Unknown object"}`))],"No object-file references recorded.");let b=document.createElement("p");b.className="reference-caveat",b.textContent=y?["Level 1 only. Static pointer owners are stored pointers, not proven runtime callers. An empty list does not prove the symbol is unused.",...y.limitations].join(" "):t.reference_analysis?"Reference analysis unverified: audit missing or provenance mismatch. Reference relationships and roots are withheld.":"Level 1 only. Indirect calls, KEEP sections and other linker roots may be missing. An empty list does not prove the symbol is unused.",o.append(b),o.hidden=!1;let z=g.getBoundingClientRect(),k=Math.min(520,window.innerWidth-32);o.style.width=`${k}px`,o.style.left=`${Math.max(16,Math.min(z.left,window.innerWidth-k-16))}px`,o.style.maxHeight="";let M=o.getBoundingClientRect().height,P=Math.max(0,window.innerHeight-z.bottom-22),T=Math.max(0,z.top-22),v=M<=P||P>=T,S=v?P:T;o.style.maxHeight=`${Math.min(M,S)}px`;let D=o.getBoundingClientRect().height;o.style.top=`${v?z.bottom+6:z.top-D-6}px`};return{dispose:()=>{u(),o.remove(),e.removeEventListener("cancel",d),e.removeEventListener("close",u),e.removeEventListener("scroll",u)},button:g=>{let p=document.createElement("button");return p.className="symbol-reference",p.textContent=g.demangled,p.dataset.referenceState=i.state(g),p.setAttribute("aria-label",`Who references ${g.demangled}?`),p.setAttribute("aria-haspopup","dialog"),p.setAttribute("aria-controls",o.id),p.setAttribute("aria-expanded","false"),p.addEventListener("pointerenter",()=>f(p,g)),p.addEventListener("pointerleave",h),p.addEventListener("focus",()=>{a||f(p,g)}),p.addEventListener("blur",h),p.addEventListener("click",()=>f(p,g)),p}}}var $t=Pt("bloat-modal"),Gn=0,Ke=null,qn=new Map;Pt("close-modal").addEventListener("click",()=>$t.close());$t.addEventListener("click",e=>{e.target===$t&&$t.close()});async function xs(e,t){if(!e)return;let n=++Gn;Ke?.dispose(),Ke=null;let i=oe.find(a=>a.id===e.board),s=Pt("bloat-title"),o={blink:"Blink",spi:"APA102",features:"Features"}[e.sketch];if(s.textContent=`${o} \xB7 ${i?.name} \xB7 ${e.version} \xB7 ${t==="flash"?"Flash":"RAM"} bloat`,e.version==="master"){let a=document.createElement("span");a.className="measurement-date",a.textContent=Yn(e.measured_at),s.append(a)}Pt("bloat-meta").textContent=`SHA ${e.sha.slice(0,10)} \xB7 fbuild ${e.fbuild} \xB7 ${t==="flash"?"flash":"static RAM"} ${Nt(e[t])} \xB7 measured ${Kn(e.measured_at)}`;let r=Pt("bloat-report");r.textContent="Loading symbol report\u2026",$t.open||$t.showModal();try{qn.has(e.bloat_report)||qn.set(e.bloat_report,fetch(e.bloat_report).then(async p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return Xa.parse(await p.json())}).catch(p=>{throw qn.delete(e.bloat_report),p}));let a=await qn.get(e.bloat_report);if(n!==Gn)return;let c=null,l="";try{let p=await fetch(tc(e.bloat_report));if(!p.ok)throw new Error(`HTTP ${p.status}`);let m=Qa.parse(await p.json());if(!nc(m,e))throw new Error("Reference audit provenance mismatch");if(a.reference_analysis&&m.elf_verified!==!0)throw new Error("Reference audit ELF verification failed");c=m}catch(p){l=(p instanceof Error?p.message:String(p)).slice(0,200)}if(n!==Gn)return;let u=new xe(a,c);Ke=sc($t,a,c,u),r.replaceChildren();let h=document.createElement("p");h.textContent=t==="flash"?`Allocated image: ${Nt(a.image_flash)} \xB7 attributed flash: ${Nt(a.total_flash)}. Attributed totals may overlap and differ from board totals.`:`Attributed RAM: ${Nt(a.total_ram)}. Static RAM excludes runtime heap and stack; attributed totals may differ from board totals.`,r.append(h);let d=document.createElement("a");d.href=e.bloat_report,d.textContent="Download full fbuild bloat JSON \u2197",r.append(d);let f=document.createElement("p");f.className="note";let g=a.symbols.filter(p=>p.region===t&&p.size>0&&u.state(p).includes("retention unexplained")).length;f.textContent=`Hover, focus or click a symbol for direct incoming references.${(a.reference_analysis?c&&_s(a.reference_analysis):c?.disassembly==="analyzed")?` ${g.toLocaleString()} ${t==="flash"?"Flash":"RAM"} rows have unexplained retention.`:` Reference analysis unavailable: ${l||(a.reference_analysis?[a.reference_analysis.disassembly,a.reference_analysis.static_data].filter(p=>p.status!=="analyzed").map(p=>`${p.status}: ${p.reason??"no reason provided"}`).join("; "):l||c?.warnings.join("; ")||"no disassembly provenance")}`}`,r.append(f);{let p=t==="flash"?"Flash":"RAM",m=a.symbols.filter(v=>v.size>0&&v.region===t).sort((v,S)=>S.size-v.size),x=document.createElement("section");x.className="bloat-section";let w=document.createElement("h3");w.textContent=`${p} \xB7 ${m.length.toLocaleString("en-US")} symbols`,x.append(w);let _=document.createElement("p");_.className="note",_.textContent=m.length?"Largest symbols first. Showing the top 10.":"No attributed symbols in this region.",x.append(_);let y=document.createElement("table");y.id=`bloat-${t}-symbols`;let b=document.createElement("caption");b.className="sr-only",b.textContent=`${p} symbols sorted by size`,y.append(b);let z=document.createElement("thead"),k=document.createElement("tr");["Region","Bytes","Symbol","Object"].forEach(v=>{let S=document.createElement("th");S.textContent=v,k.append(S)}),z.append(k),y.append(z);let M=document.createElement("tbody"),P=0,T=v=>{let S=document.createDocumentFragment(),D=P,C=Math.min(m.length,D+v);_.textContent=m.length?`Largest symbols first \xB7 Showing ${C.toLocaleString()} of ${m.length.toLocaleString()}`:"No attributed symbols in this region.",m.slice(D,C).forEach(A=>{let O=document.createElement("tr");[A.region,A.size.toLocaleString("en-US"),A.demangled,A.object||"\u2014"].forEach((V,ht)=>{let F=document.createElement("td");ht===2&&Ke?F.append(Ke.button(A)):F.textContent=V,O.append(F)}),S.append(O)}),M.append(S),P=C};if(T(10),y.append(M),m.length&&x.append(y),m.length>P){let v=document.createElement("div");v.className="bloat-pagination";let S=document.createElement("button");S.setAttribute("aria-controls",y.id);let D=()=>{let C=m.length-P;S.textContent=C?`Load ${Math.min(50,C)} more`:"All symbols loaded",S.disabled=C===0};S.addEventListener("click",()=>{let C=$t.scrollTop;T(50),D(),$t.scrollTop=C}),_.setAttribute("role","status"),_.setAttribute("aria-live","polite"),v.append(S),x.append(v),D()}r.append(x)}}catch(a){n===Gn&&(r.textContent=`Report unavailable: ${a instanceof Error?a.message:String(a)}`)}}function oc(e,t){return!Number.isFinite(t)||t<0||t>1?e:e==="linear"&&t>=.93?"logarithmic":e==="logarithmic"&&t<=.07?"linear":e}ge.register($n,Dn,On,Rn,Ln,Tn,Mr);var rc=new Map,Pd={};function $d(e,t,n){let i=_=>{let y=e.querySelector(`[data-id="${_}"]`);if(!y)throw new Error(`Missing ${t} ${_}`);return y},s=Array.from({length:7},(_,y)=>`3.10.${y}`).concat("master"),o=new Set(oe.map(_=>_.id)),r=n.results.filter(_=>_.sketch===t),a=n.versions.length?n.versions:s,c={};rc.set(t,c);let l={flash:"linear",ram:"linear"};function u(_){let y=e.querySelector(`input[name="${t}-${_}-scale"]:checked`)?.value;if(y==="linear"||y==="logarithmic"||y==="auto")return y;throw new Error("Missing scale selection for "+_)}function h(_){c[_]?.destroy();let y=i(_);y.replaceChildren();let b=document.createElement("canvas");b.id=`${t}-${_}-canvas`,b.setAttribute("role","img"),b.setAttribute("aria-label",`${_==="flash"?"Flash consumption":"RAM usage"} line chart; click a point for its symbol report, or use arrow keys and Enter`),y.append(b);let z=u(_),k=z==="auto"?l[_]:z;l[_]=k;let M=k==="logarithmic",P=oe.filter(v=>o.has(v.id)).map(v=>{let S=a.map(D=>r.find(C=>C.board===v.id&&C.version===D&&C.status==="ok"));return{label:v.name,borderColor:v.color,backgroundColor:v.color,pointRadius:5,pointHoverRadius:8,pointHitRadius:12,borderWidth:2.5,spanGaps:!1,rows:S,data:S.map(D=>D&&Number.isFinite(D[_])&&(!M||D[_]>0)?D[_]:null)}});c[_]=new ge(b,{plugins:[qa],type:"line",data:{labels:a.map(v=>v==="master"?["master",...new Set(r.filter(S=>S.version==="master"&&o.has(S.board)).map(S=>Yn(S.measured_at)))]:v),datasets:P},options:{responsive:!0,maintainAspectRatio:!1,animation:!1,interaction:{mode:"nearest",intersect:!0},onHover:(v,S)=>{b.style.cursor=S.length?"pointer":"default"},onClick:(v,S,D)=>{if(S.length){let C=S[0];xs(D.data.datasets[C.datasetIndex].rows[C.index],_)}},plugins:{legend:{display:!1},tooltip:{backgroundColor:"#0c111c",padding:12,callbacks:{label:v=>`${v.dataset.label}: ${Nt(v.parsed.y??0)}`,afterLabel:v=>{let S=v.dataset.rows[v.dataIndex];return[`Measured ${Kn(S.measured_at)}`,`SHA ${S.sha.slice(0,10)} \xB7 click for bloat`]}}}},scales:{x:{grid:{display:!1},ticks:{color:"#8594aa"}},y:{afterDataLimits:v=>{v.type==="logarithmic"&&(v.min=10**Math.floor(Math.log10(v.min)),v.max=10**Math.ceil(Math.log10(v.max)),v.max<=v.min&&(v.max=v.min*10))},afterBuildTicks:v=>{if(v.type==="logarithmic"){let S=Math.log10(v.min),D=Math.log10(v.max);v.ticks=Array.from({length:7},(C,A)=>({value:10**(S+(D-S)*A/6)}))}},afterFit:v=>{v.width=84},type:k,beginAtZero:k==="linear",grid:{color:"#263143"},ticks:{autoSkip:!1,maxTicksLimit:8,color:"#8594aa",callback:v=>Number(v).toLocaleString("en-US")}}}}}),f(_),b.tabIndex=0;let T=0;b.addEventListener("keydown",v=>{let S=P.flatMap(D=>D.rows.filter(C=>!!C));if(S.length)if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp"].includes(v.key)){v.preventDefault(),T=(T+(v.key==="ArrowRight"||v.key==="ArrowDown"?1:-1)+S.length)%S.length;let D=S[T],C=P.findIndex(V=>V.rows.includes(D)),A=P[C].rows.indexOf(D),O=c[_];O.setActiveElements([{datasetIndex:C,index:A}]),O.draw(),b.setAttribute("aria-label",`${t} ${_}: ${D.board} ${D.version}, ${Nt(D[_])}. Enter opens symbol report. Arrow keys select points.`)}else(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),xs(S[T],_))}),b.addEventListener("pointermove",v=>{if(u(_)!=="auto")return;let S=c[_];if(!S)return;let D=b.getBoundingClientRect(),C=(v.clientX-D.left)*S.width/D.width,A=(v.clientY-D.top)*S.height/D.height,O=S.chartArea;C<O.left||C>O.right||A<O.top||A>O.bottom||g(_,oc(l[_],(A-O.top)/(O.bottom-O.top)))})}function d(){h("flash"),h("ram")}oe.forEach(_=>{let y=document.createElement("label"),b=document.createElement("input");b.type="checkbox",b.checked=!0,b.addEventListener("change",()=>{b.checked?o.add(_.id):o.delete(_.id),d()});let z=document.createElement("span");z.className="platform-key",z.style.setProperty("--color",_.color),y.append(b,z,document.createTextNode(_.name)),i("platforms").append(y)});function f(_){let y=u(_);i(`${_}-scale`).style.setProperty("--selected-index",String(["auto","linear","logarithmic"].indexOf(y))),i(`${_}-scale-status`).textContent=`${y==="auto"?"Auto \xB7 ":"Pinned \xB7 "}${l[_]==="linear"?"Linear":"Logarithmic"}`,i(`${_}-scale-status`).dataset.mode=y}function g(_,y){if(l[_]===y)return;l[_]=y,f(_);let b=c[_];b&&Ja(b,_,y)}for(let _ of["flash","ram"])i(`${_}-scale`).addEventListener("change",()=>{let y=u(_);y!=="auto"&&g(_,y),f(_)});let p=document.createElement("p");p.className="note sketch-summary";let m=a.length*oe.length,x=r.filter(_=>_.status==="ok").length,w=r.filter(_=>_.status==="error");p.textContent=`${x}/${m} measured \xB7 Hover for bytes; click for symbol bloat. Arrow keys and Enter work on focused charts.${w.length?` ${w.length} builds failed; gaps shown.`:x<m?" Remaining points awaiting collection.":""}`,w.length&&(p.title=w.map(_=>`${_.board} ${_.version}: ${_.error}`).join(`
`)),e.append(p),d()}try{let e=await fetch("data/latest.json",{cache:"no-store"});if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=Ka.parse(await e.json());Pt("updated").textContent=`Updated ${new Date(t.updated_at).toLocaleString()} \xB7 Recomputed daily`;for(let n of document.querySelectorAll("[data-sketch]")){let i=gs.parse(n.dataset.sketch);$d(n,i,t)}Pd=rc.get("blink")??{}}catch(e){Pt("updated").textContent=`Results unavailable: ${e instanceof Error?e.message:String(e)}`}export{Pd as charts,rc as sectionCharts};
/*! Bundled license information:
@kurkle/color/dist/color.esm.js:
(*!
* @kurkle/color v0.3.4
* https://github.com/kurkle/color#readme
* (c) 2024 Jukka Kurkela
* Released under the MIT License
*)
chart.js/dist/chunks/helpers.dataset.js:
chart.js/dist/chart.js:
(*!
* Chart.js v4.5.1
* https://www.chartjs.org
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*)
*/
You can’t perform that action at this time.
