@luckydraw/blex 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use strict";var Blex=(()=>{var Hc=Object.create;var ui=Object.defineProperty;var $c=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Wc=Object.getPrototypeOf,jc=Object.prototype.hasOwnProperty;var Uc=(i,t,e)=>t in i?ui(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Yc=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Bt=(i,t)=>()=>(i&&(t=i(i=0)),t);var Ce=(i,t)=>{for(var e in t)ui(i,e,{get:t[e],enumerable:!0})},na=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Vc(t))!jc.call(i,s)&&s!==e&&ui(i,s,{get:()=>t[s],enumerable:!(n=$c(t,s))||n.enumerable});return i};var Gc=(i,t,e)=>(e=i!=null?Hc(Wc(i)):{},na(t||!i||!i.__esModule?ui(e,"default",{value:i,enumerable:!0}):e,i)),Xc=i=>na(ui({},"__esModule",{value:!0}),i);var M=(i,t,e)=>Uc(i,typeof t!="symbol"?t+"":t,e);var P,Z=Bt(()=>{"use strict";P=class{constructor(){this.container=null;this.interactionCallback=null;this.trackedListeners=[];this.trackedTimers=[];this.trackedRAFs=[];this.trackedObservers=[];this.destroyed=!1}onInteraction(t){this.interactionCallback=t}destroy(){if(!this.destroyed){this.destroyed=!0;for(let{target:t,type:e,listener:n}of this.trackedListeners)t.removeEventListener(e,n);this.trackedListeners=[];for(let t of this.trackedTimers)clearTimeout(t),clearInterval(t);this.trackedTimers=[];for(let t of this.trackedRAFs)cancelAnimationFrame(t);this.trackedRAFs=[];for(let t of this.trackedObservers)t.disconnect();this.trackedObservers=[],this.container&&(this.container.innerHTML="",this.container=null),this.interactionCallback=null}}addListener(t,e,n){t.addEventListener(e,n),this.trackedListeners.push({target:t,type:e,listener:n})}setTimeout(t,e){let n=window.setTimeout(t,e);return this.trackedTimers.push(n),n}setInterval(t,e){let n=window.setInterval(t,e);return this.trackedTimers.push(n),n}requestAnimationFrame(t){let e=window.requestAnimationFrame(t);return this.trackedRAFs.push(e),e}trackObserver(t){this.trackedObservers.push(t)}emit(t){this.interactionCallback?.(t)}get isDestroyed(){return this.destroyed}}});var $a={};Ce($a,{MermaidRenderer:()=>an,createMermaidRenderer:()=>Md});function Md(){return new an}var an,Va=Bt(()=>{"use strict";Z();an=class extends P{constructor(){super(...arguments);this.showSource=!1;this._renderPromise=Promise.resolve()}render(e,n){this.container=n,this._renderPromise=this.renderDiagram(e)}update(e){this.container&&(this.container.innerHTML="",this.container.removeAttribute("data-blex-ready"),this._renderPromise=this.renderDiagram(e))}async renderDiagram(e){let n=this.container,{source:s,title:o}=e.data,a=document.createElement("div");if(a.className="blex-mermaid blex-mermaid--loading",a.setAttribute("data-testid",`blex-mermaid-${e.id}`),a.setAttribute("data-loading","true"),o){let p=document.createElement("div");p.className="blex-mermaid__title",p.textContent=o,a.appendChild(p)}let r=document.createElement("div");r.className="blex-mermaid__diagram",r.setAttribute("data-testid",`blex-mermaid-diagram-${e.id}`),a.appendChild(r);let l=document.createElement("pre");l.className="blex-mermaid__source",l.style.display=this.showSource?"block":"none";let c=document.createElement("code");c.textContent=s,l.appendChild(c),a.appendChild(l);let d=document.createElement("div");d.className="blex-mermaid__actions";let h=document.createElement("button");h.className="blex-mermaid__btn",h.textContent=this.showSource?"Hide source":"Show source",h.setAttribute("data-testid",`blex-mermaid-toggle-${e.id}`),this.addListener(h,"click",()=>{this.showSource=!this.showSource,l.style.display=this.showSource?"block":"none",h.textContent=this.showSource?"Hide source":"Show source"}),d.appendChild(h);let u=document.createElement("button");u.className="blex-mermaid__btn",u.textContent="Export SVG",u.setAttribute("data-testid",`blex-mermaid-export-svg-${e.id}`),this.addListener(u,"click",()=>{let p=r.innerHTML,m=new Blob([p],{type:"image/svg+xml"}),g=URL.createObjectURL(m),x=document.createElement("a");x.href=g,x.download=`${e.id}.svg`,x.click(),URL.revokeObjectURL(g)}),d.appendChild(u);let f=document.createElement("button");f.className="blex-mermaid__btn",f.textContent="Export PNG",f.setAttribute("data-testid",`blex-mermaid-export-png-${e.id}`),this.addListener(f,"click",()=>{let p=r.innerHTML,m=new Blob([p],{type:"image/svg+xml"}),g=URL.createObjectURL(m),x=new Image;x.onload=()=>{let _=document.createElement("canvas");_.width=x.naturalWidth||x.width||800,_.height=x.naturalHeight||x.height||600;let C=_.getContext("2d");C&&(C.drawImage(x,0,0),_.toBlob(y=>{if(y){let v=URL.createObjectURL(y),w=document.createElement("a");w.href=v,w.download=`${e.id}.png`,w.click(),URL.revokeObjectURL(v)}},"image/png")),URL.revokeObjectURL(g)},x.src=g}),d.appendChild(f),a.appendChild(d),n.appendChild(a);try{let p=await import("mermaid"),m=p.default??p;m.initialize({startOnLoad:!1,theme:"default"});let{svg:g}=await m.render(`blex-mermaid-${e.id}`,s);r.innerHTML=g}catch{r.textContent="Mermaid render error",r.classList.add("blex-mermaid__diagram--error")}a.classList.remove("blex-mermaid--loading"),a.removeAttribute("data-loading"),n.setAttribute("data-blex-ready","true")}}});function vi(i){return i+.5|0}function _i(i){return oe(vi(i*2.55),0,255)}function ae(i){return oe(vi(i*255),0,255)}function Jt(i){return oe(vi(i/2.55)/100,0,1)}function Wa(i){return oe(vi(i*100),0,100)}function Ad(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&Tt[i[1]]*17,g:255&Tt[i[2]]*17,b:255&Tt[i[3]]*17,a:t===5?Tt[i[4]]*17:255}:(t===7||t===9)&&(e={r:Tt[i[1]]<<4|Tt[i[2]],g:Tt[i[3]]<<4|Tt[i[4]],b:Tt[i[5]]<<4|Tt[i[6]],a:t===9?Tt[i[7]]<<4|Tt[i[8]]:255})),e}function Ld(i){var t=Td(i)?Sd:Ed;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Dd(i.a,t):void 0}function Ga(i,t,e){let n=t*Math.min(e,1-e),s=(o,a=(o+i/30)%12)=>e-n*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function Od(i,t,e){let n=(s,o=(s+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Rd(i,t,e){let n=Ga(i,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)n[s]*=1-t-e,n[s]+=t;return n}function Id(i,t,e,n,s){return i===s?(t-e)/n+(t<e?6:0):t===s?(e-i)/n+2:(i-t)/n+4}function Os(i){let e=i.r/255,n=i.g/255,s=i.b/255,o=Math.max(e,n,s),a=Math.min(e,n,s),r=(o+a)/2,l,c,d;return o!==a&&(d=o-a,c=r>.5?d/(2-o-a):d/(o+a),l=Id(e,n,s,d,o),l=l*60+.5),[l|0,c||0,r]}function Rs(i,t,e,n){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,n)).map(ae)}function Is(i,t,e){return Rs(Ga,i,t,e)}function Bd(i,t,e){return Rs(Rd,i,t,e)}function Nd(i,t,e){return Rs(Od,i,t,e)}function Xa(i){return(i%360+360)%360}function Fd(i){let t=Pd.exec(i),e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?_i(+t[5]):ae(+t[5]));let s=Xa(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?n=Bd(s,o,a):t[1]==="hsv"?n=Nd(s,o,a):n=Is(s,o,a),{r:n[0],g:n[1],b:n[2],a:e}}function zd(i,t){var e=Os(i);e[0]=Xa(e[0]+t),e=Is(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Hd(i){if(!i)return;let t=Os(i),e=t[0],n=Wa(t[1]),s=Wa(t[2]);return i.a<255?`hsla(${e}, ${n}%, ${s}%, ${Jt(i.a)})`:`hsl(${e}, ${n}%, ${s}%)`}function $d(){let i={},t=Object.keys(Ua),e=Object.keys(ja),n,s,o,a,r;for(n=0;n<t.length;n++){for(a=r=t[n],s=0;s<e.length;s++)o=e[s],r=r.replace(o,ja[o]);o=parseInt(Ua[a],16),i[r]=[o>>16&255,o>>8&255,o&255]}return i}function Vd(i){ln||(ln=$d(),ln.transparent=[0,0,0,0]);let t=ln[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function jd(i){let t=Wd.exec(i),e=255,n,s,o;if(t){if(t[7]!==n){let a=+t[7];e=t[8]?_i(a):oe(a*255,0,255)}return n=+t[1],s=+t[3],o=+t[5],n=255&(t[2]?_i(n):oe(n,0,255)),s=255&(t[4]?_i(s):oe(s,0,255)),o=255&(t[6]?_i(o):oe(o,0,255)),{r:n,g:s,b:o,a:e}}}function Ud(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${Jt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}function Yd(i,t,e){let n=je(Jt(i.r)),s=je(Jt(i.g)),o=je(Jt(i.b));return{r:ae(Ls(n+e*(je(Jt(t.r))-n))),g:ae(Ls(s+e*(je(Jt(t.g))-s))),b:ae(Ls(o+e*(je(Jt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function cn(i,t,e){if(i){let n=Os(i);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=Is(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function Ka(i,t){return i&&Object.assign(t||{},i)}function Ya(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=ae(i[3]))):(t=Ka(i,{r:0,g:0,b:0,a:1}),t.a=ae(t.a)),t}function Gd(i){return i.charAt(0)==="r"?jd(i):Fd(i)}var oe,Tt,Ps,Sd,Ed,rn,Td,Dd,Pd,ja,Ua,ln,Wd,Ls,je,yi,qa=Bt(()=>{"use strict";oe=(i,t,e)=>Math.max(Math.min(i,e),t);Tt={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},Ps=[..."0123456789ABCDEF"],Sd=i=>Ps[i&15],Ed=i=>Ps[(i&240)>>4]+Ps[i&15],rn=i=>(i&240)>>4===(i&15),Td=i=>rn(i.r)&&rn(i.g)&&rn(i.b)&&rn(i.a);Dd=(i,t)=>i<255?t(i):"";Pd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;ja={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"},Ua={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"};Wd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;Ls=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,je=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);yi=class i{constructor(t){if(t instanceof i)return t;let e=typeof t,n;e==="object"?n=Ya(t):e==="string"&&(n=Ad(t)||Vd(t)||Gd(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=Ka(this._rgb);return t&&(t.a=Jt(t.a)),t}set rgb(t){this._rgb=Ya(t)}rgbString(){return this._valid?Ud(this._rgb):void 0}hexString(){return this._valid?Ld(this._rgb):void 0}hslString(){return this._valid?Hd(this._rgb):void 0}mix(t,e){if(t){let n=this.rgb,s=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=n.a-s.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=a*n.a+(1-a)*s.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=Yd(this._rgb,t._rgb,e)),this}clone(){return new i(this.rgb)}alpha(t){return this._rgb.a=ae(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=vi(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.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 cn(this._rgb,2,t),this}darken(t){return cn(this._rgb,2,-t),this}saturate(t){return cn(this._rgb,1,t),this}desaturate(t){return cn(this._rgb,1,-t),this}rotate(t){return zd(this._rgb,t),this}}});function Ht(){}function N(i){return i==null}function U(i){if(Array.isArray&&Array.isArray(i))return!0;let t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function F(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function Q(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function yt(i,t){return Q(i)?i:t}function O(i,t){return typeof i>"u"?t:i}function W(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function $(i,t,e,n){let s,o,a;if(U(i))if(o=i.length,n)for(s=o-1;s>=0;s--)t.call(e,i[s],s);else for(s=0;s<o;s++)t.call(e,i[s],s);else if(F(i))for(a=Object.keys(i),o=a.length,s=0;s<o;s++)t.call(e,i[a[s]],a[s])}function wi(i,t){let e,n,s,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,n=i.length;e<n;++e)if(s=i[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function fn(i){if(U(i))return i.map(fn);if(F(i)){let t=Object.create(null),e=Object.keys(i),n=e.length,s=0;for(;s<n;++s)t[e[s]]=fn(i[e[s]]);return t}return i}function cr(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Xd(i,t,e,n){if(!cr(i))return;let s=t[i],o=e[i];F(s)&&F(o)?Ye(s,o,n):t[i]=fn(o)}function Ye(i,t,e){let n=U(t)?t:[t],s=n.length;if(!F(i))return i;e=e||{};let o=e.merger||Xd,a;for(let r=0;r<s;++r){if(a=n[r],!F(a))continue;let l=Object.keys(a);for(let c=0,d=l.length;c<d;++c)o(l[c],i,a,e)}return i}function Xe(i,t){return Ye(i,t,{merger:Kd})}function Kd(i,t,e){if(!cr(i))return;let n=t[i],s=e[i];F(n)&&F(s)?Xe(n,s):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=fn(s))}function qd(i){let t=i.split("."),e=[],n="";for(let s of t)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(e.push(n),n="");return e}function Jd(i){let t=qd(i);return e=>{for(let n of t){if(n==="")break;e=e&&e[n]}return e}}function te(i,t){return(Ja[t]||(Ja[t]=Jd(t)))(i)}function bn(i){return i.charAt(0).toUpperCase()+i.slice(1)}function dr(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}function qe(i,t,e){return Math.abs(i-t)<e}function $s(i){let t=Math.round(i);i=qe(i,t,i/1e3)?t:i;let e=Math.pow(10,Math.floor(Qt(i))),n=i/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function hr(i){let t=[],e=Math.sqrt(i),n;for(n=1;n<e;n++)i%n===0&&(t.push(n),t.push(i/n));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function th(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function Ee(i){return!th(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function ur(i,t){let e=Math.round(i);return e-t<=i&&e+t>=i}function Vs(i,t,e){let n,s,o;for(n=0,s=i.length;n<s;n++)o=i[n][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function At(i){return i*(z/180)}function xn(i){return i*(180/z)}function Ws(i){if(!Q(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function js(i,t){let e=t.x-i.x,n=t.y-i.y,s=Math.sqrt(e*e+n*n),o=Math.atan2(n,e);return o<-.5*z&&(o+=Y),{angle:o,distance:s}}function mn(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function eh(i,t){return(i-t+Zd)%Y-z}function dt(i){return(i%Y+Y)%Y}function Je(i,t,e,n){let s=dt(i),o=dt(t),a=dt(e),r=dt(o-s),l=dt(a-s),c=dt(s-o),d=dt(s-a);return s===o||s===a||n&&o===a||r>l&&c<d}function at(i,t,e){return Math.max(t,Math.min(e,i))}function fr(i){return at(i,-32768,32767)}function $t(i,t,e,n=1e-6){return i>=Math.min(t,e)-n&&i<=Math.max(t,e)+n}function _n(i,t,e){e=e||(a=>i[a]<t);let n=i.length-1,s=0,o;for(;n-s>1;)o=s+n>>1,e(o)?s=o:n=o;return{lo:s,hi:n}}function mr(i,t,e){let n=0,s=i.length;for(;n<s&&i[n]<t;)n++;for(;s>n&&i[s-1]>e;)s--;return n>0||s<i.length?i.slice(n,s):i}function br(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),gr.forEach(e=>{let n="_onData"+bn(e),s=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){let a=s.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[n]=="function"&&r[n](...o)}),a}})})}function Us(i,t){let e=i._chartjs;if(!e)return;let n=e.listeners,s=n.indexOf(t);s!==-1&&n.splice(s,1),!(n.length>0)&&(gr.forEach(o=>{delete i[o]}),delete i._chartjs)}function Ys(i){let t=new Set(i);return t.size===i.length?i:Array.from(t)}function Xs(i,t){let e=[],n=!1;return function(...s){e=s,n||(n=!0,Gs.call(window,()=>{n=!1,i.apply(t,e)}))}}function xr(i,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(i,t,n)):i.apply(this,n),t}}function Ks(i,t,e){let n=t.length,s=0,o=n;if(i._sorted){let{iScale:a,vScale:r,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,d=a.axis,{min:h,max:u,minDefined:f,maxDefined:p}=a.getUserBounds();if(f){if(s=Math.min(Ft(l,d,h).lo,e?n:Ft(t,d,a.getPixelForValue(h)).lo),c){let m=l.slice(0,s+1).reverse().findIndex(g=>!N(g[r.axis]));s-=Math.max(0,m)}s=at(s,0,n-1)}if(p){let m=Math.max(Ft(l,a.axis,u,!0).hi+1,e?0:Ft(t,d,a.getPixelForValue(u),!0).hi+1);if(c){let g=l.slice(m-1).findIndex(x=>!N(x[r.axis]));m+=Math.max(0,g)}o=at(m,s,n)-s}else o=n-s}return{start:s,count:o}}function qs(i){let{xScale:t,yScale:e,_scaleRanges:n}=i,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return i._scaleRanges=s,!0;let o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,s),o}function Js(i){if(i&&typeof i=="object"){let t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Zs(i){return Js(i)?i:new yi(i)}function Bs(i){return Js(i)?i:new yi(i).saturate(.5).darken(.1).hexString()}function sh(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:nh},numbers:{type:"number",properties:ih}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function oh(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function ah(i,t){t=t||{};let e=i+JSON.stringify(t),n=er.get(e);return n||(n=new Intl.NumberFormat(i,t),er.set(e,n)),n}function Ze(i,t,e){return ah(t,e).format(i)}function rh(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}function lh(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Qe.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function Ci(i,t){if(!t)return i;let e=t.split(".");for(let n=0,s=e.length;n<s;++n){let o=e[n];i=i[o]||(i[o]=Object.create(null))}return i}function Ns(i,t,e){return typeof t=="string"?Ye(Ci(i,t),e):Ye(Ci(i,""),t)}function ch(i){return!i||N(i.size)||N(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function ki(i,t,e,n,s){let o=t[s];return o||(o=t[s]=i.measureText(s).width,e.push(s)),o>n&&(n=o),n}function vr(i,t,e,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(s=n.data={},o=n.garbageCollect=[],n.font=t),i.save(),i.font=t;let a=0,r=e.length,l,c,d,h,u;for(l=0;l<r;l++)if(h=e[l],h!=null&&!U(h))a=ki(i,s,o,a,h);else if(U(h))for(c=0,d=h.length;c<d;c++)u=h[c],u!=null&&!U(u)&&(a=ki(i,s,o,a,u));i.restore();let f=o.length/2;if(f>e.length){for(l=0;l<f;l++)delete s[o[l]];o.splice(0,f)}return a}function de(i,t,e){let n=i.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*n)/n+s}function Qs(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Cn(i,t,e,n){to(i,t,e,n,null)}function to(i,t,e,n,s){let o,a,r,l,c,d,h,u,f=t.pointStyle,p=t.rotation,m=t.radius,g=(p||0)*Qd;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,n),i.rotate(g),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(m)||m<=0)){switch(i.beginPath(),f){default:s?i.ellipse(e,n,s/2,m,0,0,Y):i.arc(e,n,m,0,Y),i.closePath();break;case"triangle":d=s?s/2:m,i.moveTo(e+Math.sin(g)*d,n-Math.cos(g)*m),g+=Za,i.lineTo(e+Math.sin(g)*d,n-Math.cos(g)*m),g+=Za,i.lineTo(e+Math.sin(g)*d,n-Math.cos(g)*m),i.closePath();break;case"rectRounded":c=m*.516,l=m-c,a=Math.cos(g+we)*l,h=Math.cos(g+we)*(s?s/2-c:l),r=Math.sin(g+we)*l,u=Math.sin(g+we)*(s?s/2-c:l),i.arc(e-h,n-r,c,g-z,g-tt),i.arc(e+u,n-a,c,g-tt,g),i.arc(e+h,n+r,c,g,g+tt),i.arc(e-u,n+a,c,g+tt,g+z),i.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,d=s?s/2:l,i.rect(e-d,n-l,2*d,2*l);break}g+=we;case"rectRot":h=Math.cos(g)*(s?s/2:m),a=Math.cos(g)*m,r=Math.sin(g)*m,u=Math.sin(g)*(s?s/2:m),i.moveTo(e-h,n-r),i.lineTo(e+u,n-a),i.lineTo(e+h,n+r),i.lineTo(e-u,n+a),i.closePath();break;case"crossRot":g+=we;case"cross":h=Math.cos(g)*(s?s/2:m),a=Math.cos(g)*m,r=Math.sin(g)*m,u=Math.sin(g)*(s?s/2:m),i.moveTo(e-h,n-r),i.lineTo(e+h,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"star":h=Math.cos(g)*(s?s/2:m),a=Math.cos(g)*m,r=Math.sin(g)*m,u=Math.sin(g)*(s?s/2:m),i.moveTo(e-h,n-r),i.lineTo(e+h,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a),g+=we,h=Math.cos(g)*(s?s/2:m),a=Math.cos(g)*m,r=Math.sin(g)*m,u=Math.sin(g)*(s?s/2:m),i.moveTo(e-h,n-r),i.lineTo(e+h,n+r),i.moveTo(e+u,n-a),i.lineTo(e-u,n+a);break;case"line":a=s?s/2:Math.cos(g)*m,r=Math.sin(g)*m,i.moveTo(e-a,n-r),i.lineTo(e+a,n+r);break;case"dash":i.moveTo(e,n),i.lineTo(e+Math.cos(g)*(s?s/2:m),n+Math.sin(g)*m);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function zt(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Mi(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Si(i){i.restore()}function Cr(i,t,e,n,s){if(!t)return i.lineTo(e.x,e.y);if(s==="middle"){let o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else s==="after"!=!!n?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function kr(i,t,e,n){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(n?t.cp1x:t.cp2x,n?t.cp1y:t.cp2y,n?e.cp2x:e.cp1x,n?e.cp2y:e.cp1y,e.x,e.y)}function dh(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),N(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function hh(i,t,e,n,s){if(s.strikethrough||s.underline){let o=i.measureText(n),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=s.decorationWidth||2,i.moveTo(a,d),i.lineTo(r,d),i.stroke()}}function uh(i,t){let e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function he(i,t,e,n,s,o={}){let a=U(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(i.save(),i.font=s.string,dh(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&uh(i,o.backdrop),r&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),N(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,n,o.maxWidth)),i.fillText(c,e,n,o.maxWidth),hh(i,e,n,c,o),n+=Number(s.lineHeight);i.restore()}function ti(i,t){let{x:e,y:n,w:s,h:o,radius:a}=t;i.arc(e+a.topLeft,n+a.topLeft,a.topLeft,1.5*z,z,!0),i.lineTo(e,n+o-a.bottomLeft),i.arc(e+a.bottomLeft,n+o-a.bottomLeft,a.bottomLeft,z,tt,!0),i.lineTo(e+s-a.bottomRight,n+o),i.arc(e+s-a.bottomRight,n+o-a.bottomRight,a.bottomRight,tt,0,!0),i.lineTo(e+s,n+a.topRight),i.arc(e+s-a.topRight,n+a.topRight,a.topRight,0,-tt,!0),i.lineTo(e+a.topLeft,n)}function mh(i,t){let e=(""+i).match(fh);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}function kn(i,t){let e={},n=F(t),s=n?Object.keys(t):t,o=F(i)?n?a=>O(i[a],i[t[a]]):a=>i[a]:()=>i;for(let a of s)e[a]=gh(o(a));return e}function eo(i){return kn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function ue(i){return kn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ut(i){let t=eo(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function st(i,t){i=i||{},t=t||G.font;let e=O(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=O(i.style,t.style);n&&!(""+n).match(ph)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let s={family:O(i.family,t.family),lineHeight:mh(O(i.lineHeight,t.lineHeight),e),size:e,style:n,weight:O(i.weight,t.weight),string:""};return s.string=ch(s),s}function ei(i,t,e,n){let s=!0,o,a,r;for(o=0,a=i.length;o<a;++o)if(r=i[o],r!==void 0&&(t!==void 0&&typeof r=="function"&&(r=r(t),s=!1),e!==void 0&&U(r)&&(r=r[e%r.length],s=!1),r!==void 0))return n&&!s&&(n.cacheable=!1),r}function wr(i,t,e){let{min:n,max:s}=i,o=zs(t,(s-n)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(n,-Math.abs(o)),max:a(s,o)}}function ee(i,t){return Object.assign(Object.create(i),t)}function wn(i,t=[""],e,n,s=()=>i[0]){let o=e||i;typeof n>"u"&&(n=Er("_fallback",i));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:r=>wn([r,...i],t,o,n)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return Mr(r,l,()=>wh(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return nr(r).includes(l)},ownKeys(r){return nr(r)},set(r,l,c){let d=r._storage||(r._storage=s());return r[l]=d[l]=c,delete r._keys,!0}})}function Se(i,t,e,n){let s={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:io(i,n),setContext:o=>Se(i,o,e,n),override:o=>Se(i.override(o),t,e,n)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return Mr(o,a,()=>xh(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function io(i,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:s=t.allKeys}=i;return{allKeys:s,scriptable:e,indexable:n,isScriptable:Zt(e)?e:()=>e,isIndexable:Zt(n)?n:()=>n}}function Mr(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];let n=e();return i[t]=n,n}function xh(i,t,e){let{_proxy:n,_context:s,_subProxy:o,_descriptors:a}=i,r=n[t];return Zt(r)&&a.isScriptable(t)&&(r=_h(t,r,i,e)),U(r)&&r.length&&(r=yh(t,r,i,a.isIndexable)),no(t,r)&&(r=Se(r,s,o&&o[t],a)),r}function _h(i,t,e,n){let{_proxy:s,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||n);return r.delete(i),no(i,l)&&(l=so(s._scopes,s,i,l)),l}function yh(i,t,e,n){let{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&n(i))return t[o.index%t.length];if(F(t[0])){let l=t,c=s._scopes.filter(d=>d!==l);t=[];for(let d of l){let h=so(c,s,i,d);t.push(Se(h,o,a&&a[i],r))}}return t}function Sr(i,t,e){return Zt(i)?i(t,e):i}function Ch(i,t,e,n,s){for(let o of t){let a=vh(e,o);if(a){i.add(a);let r=Sr(a._fallback,e,s);if(typeof r<"u"&&r!==e&&r!==n)return r}else if(a===!1&&typeof n<"u"&&e!==n)return null}return!1}function so(i,t,e,n){let s=t._rootScopes,o=Sr(t._fallback,e,n),a=[...i,...s],r=new Set;r.add(n);let l=ir(r,a,e,o||e,n);return l===null||typeof o<"u"&&o!==e&&(l=ir(r,a,o,l,n),l===null)?!1:wn(Array.from(r),[""],s,o,()=>kh(t,e,n))}function ir(i,t,e,n,s){for(;e;)e=Ch(i,t,e,n,s);return e}function kh(i,t,e){let n=i._getTarget();t in n||(n[t]={});let s=n[t];return U(s)&&F(e)?e:s||{}}function wh(i,t,e,n){let s;for(let o of t)if(s=Er(bh(o,i),e),typeof s<"u")return no(i,s)?so(e,n,i,s):s}function Er(i,t){for(let e of t){if(!e)continue;let n=e[i];if(typeof n<"u")return n}}function nr(i){let t=i._keys;return t||(t=i._keys=Mh(i._scopes)),t}function Mh(i){let t=new Set;for(let e of i)for(let n of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(n);return Array.from(t)}function oo(i,t,e,n){let{iScale:s}=i,{key:o="r"}=this._parsing,a=new Array(n),r,l,c,d;for(r=0,l=n;r<l;++r)c=r+e,d=t[c],a[r]={r:s.parse(te(d,o),c)};return a}function Eh(i,t,e,n){let s=i.skip?t:i,o=t,a=e.skip?t:e,r=mn(o,s),l=mn(a,o),c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let h=n*c,u=n*d;return{previous:{x:o.x-h*(a.x-s.x),y:o.y-h*(a.y-s.y)},next:{x:o.x+u*(a.x-s.x),y:o.y+u*(a.y-s.y)}}}function Th(i,t,e){let n=i.length,s,o,a,r,l,c=Ge(i,0);for(let d=0;d<n-1;++d)if(l=c,c=Ge(i,d+1),!(!l||!c)){if(qe(t[d],0,Sh)){e[d]=e[d+1]=0;continue}s=e[d]/t[d],o=e[d+1]/t[d],r=Math.pow(s,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),e[d]=s*a*t[d],e[d+1]=o*a*t[d])}}function Ah(i,t,e="x"){let n=Tr(e),s=i.length,o,a,r,l=Ge(i,0);for(let c=0;c<s;++c){if(a=r,r=l,l=Ge(i,c+1),!r)continue;let d=r[e],h=r[n];a&&(o=(d-a[e])/3,r[`cp1${e}`]=d-o,r[`cp1${n}`]=h-o*t[c]),l&&(o=(l[e]-d)/3,r[`cp2${e}`]=d+o,r[`cp2${n}`]=h+o*t[c])}}function Dh(i,t="x"){let e=Tr(t),n=i.length,s=Array(n).fill(0),o=Array(n),a,r,l,c=Ge(i,0);for(a=0;a<n;++a)if(r=l,l=c,c=Ge(i,a+1),!!l){if(c){let d=c[t]-l[t];s[a]=d!==0?(c[e]-l[e])/d:0}o[a]=r?c?Dt(s[a-1])!==Dt(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}Th(i,s,o),Ah(i,o,t)}function hn(i,t,e){return Math.max(Math.min(i,e),t)}function Lh(i,t){let e,n,s,o,a,r=zt(i[0],t);for(e=0,n=i.length;e<n;++e)a=o,o=r,r=e<n-1&&zt(i[e+1],t),o&&(s=i[e],a&&(s.cp1x=hn(s.cp1x,t.left,t.right),s.cp1y=hn(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=hn(s.cp2x,t.left,t.right),s.cp2y=hn(s.cp2y,t.top,t.bottom)))}function Ar(i,t,e,n,s){let o,a,r,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Dh(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,a=i.length;o<a;++o)r=i[o],l=Eh(c,r,i[Math.min(o+1,a-(n?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&Lh(i,e)}function Mn(){return typeof window<"u"&&typeof document<"u"}function Sn(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function gn(i,t,e){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*t.parentNode[e])):n=i,n}function Ph(i,t){return En(i).getPropertyValue(t)}function Me(i,t,e){let n={};e=e?"-"+e:"";for(let s=0;s<4;s++){let o=Oh[s];n[o]=parseFloat(i[t+"-"+o+e])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function Ih(i,t){let e=i.touches,n=e&&e.length?e[0]:i,{offsetX:s,offsetY:o}=n,a=!1,r,l;if(Rh(s,o,i.target))r=s,l=o;else{let c=t.getBoundingClientRect();r=n.clientX-c.left,l=n.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function fe(i,t){if("native"in i)return i;let{canvas:e,currentDevicePixelRatio:n}=t,s=En(e),o=s.boxSizing==="border-box",a=Me(s,"padding"),r=Me(s,"border","width"),{x:l,y:c,box:d}=Ih(i,e),h=a.left+(d&&r.left),u=a.top+(d&&r.top),{width:f,height:p}=t;return o&&(f-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-h)/f*e.width/n),y:Math.round((c-u)/p*e.height/n)}}function Bh(i,t,e){let n,s;if(t===void 0||e===void 0){let o=i&&Sn(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{let a=o.getBoundingClientRect(),r=En(o),l=Me(r,"border","width"),c=Me(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,n=gn(r.maxWidth,o,"clientWidth"),s=gn(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:n||pn,maxHeight:s||pn}}function Dr(i,t,e,n){let s=En(i),o=Me(s,"margin"),a=gn(s.maxWidth,i,"clientWidth")||pn,r=gn(s.maxHeight,i,"clientHeight")||pn,l=Bh(i,t,e),{width:c,height:d}=l;if(s.boxSizing==="content-box"){let u=Me(s,"border","width"),f=Me(s,"padding");c-=f.width+u.width,d-=f.height+u.height}return c=Math.max(0,c-o.width),d=Math.max(0,n?c/n:d-o.height),c=le(Math.min(c,a,l.maxWidth)),d=le(Math.min(d,r,l.maxHeight)),c&&!d&&(d=le(c/2)),(t!==void 0||e!==void 0)&&n&&l.height&&d>l.height&&(d=l.height,c=le(Math.floor(d*n))),{width:c,height:d}}function ao(i,t,e){let n=t||1,s=le(i.height*n),o=le(i.width*n);i.height=le(i.height),i.width=le(i.width);let a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||a.height!==s||a.width!==o?(i.currentDevicePixelRatio=n,a.height=s,a.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}function ro(i,t){let e=Ph(i,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function re(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function Pr(i,t,e,n){return{x:i.x+e*(t.x-i.x),y:n==="middle"?e<.5?i.y:t.y:n==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function Or(i,t,e,n){let s={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},a=re(i,s,e),r=re(s,o,e),l=re(o,t,e),c=re(a,r,e),d=re(r,l,e);return re(c,d,e)}function Te(i,t,e){return i?Nh(t,e):Fh()}function lo(i,t){let e,n;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=n)}function co(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Rr(i){return i==="angle"?{between:Je,compare:eh,normalize:dt}:{between:$t,compare:(t,e)=>t-e,normalize:t=>t}}function sr({start:i,end:t,count:e,loop:n,style:s}){return{start:i%e,end:t%e,loop:n&&(t-i+1)%e===0,style:s}}function zh(i,t,e){let{property:n,start:s,end:o}=e,{between:a,normalize:r}=Rr(n),l=t.length,{start:c,end:d,loop:h}=i,u,f;if(h){for(c+=l,d+=l,u=0,f=l;u<f&&a(r(t[c%l][n]),s,o);++u)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:i.style}}function ho(i,t,e){if(!e)return[i];let{property:n,start:s,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=Rr(n),{start:d,end:h,loop:u,style:f}=zh(i,t,e),p=[],m=!1,g=null,x,_,C,y=()=>l(s,C,x)&&r(s,C)!==0,v=()=>r(o,x)===0||l(o,C,x),w=()=>m||y(),S=()=>!m||v();for(let E=d,L=d;E<=h;++E)_=t[E%a],!_.skip&&(x=c(_[n]),x!==C&&(m=l(x,s,o),g===null&&w()&&(g=r(x,s)===0?E:L),g!==null&&S()&&(p.push(sr({start:g,end:E,loop:u,count:a,style:f})),g=null),L=E,C=x));return g!==null&&p.push(sr({start:g,end:h,loop:u,count:a,style:f})),p}function uo(i,t){let e=[],n=i.segments;for(let s=0;s<n.length;s++){let o=ho(n[s],i.points,t);o.length&&e.push(...o)}return e}function Hh(i,t,e,n){let s=0,o=t-1;if(e&&!n)for(;s<t&&!i[s].skip;)s++;for(;s<t&&i[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&i[o%t].skip;)o--;return o%=t,{start:s,end:o}}function $h(i,t,e,n){let s=i.length,o=[],a=t,r=i[t],l;for(l=t+1;l<=e;++l){let c=i[l%s];c.skip||c.stop?r.skip||(n=!1,o.push({start:t%s,end:(l-1)%s,loop:n}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%s,end:a%s,loop:n}),o}function Ir(i,t){let e=i.points,n=i.options.spanGaps,s=e.length;if(!s)return[];let o=!!i._loop,{start:a,end:r}=Hh(e,s,o,n);if(n===!0)return or(i,[{start:a,end:r,loop:o}],e,t);let l=r<a?r+s:r,c=!!i._fullLoop&&a===0&&r===s-1;return or(i,$h(e,a,l,c),e,t)}function or(i,t,e,n){return!n||!n.setContext||!e?t:Vh(i,t,e,n)}function Vh(i,t,e,n){let s=i._chart.getContext(),o=ar(i.options),{_datasetIndex:a,options:{spanGaps:r}}=i,l=e.length,c=[],d=o,h=t[0].start,u=h;function f(p,m,g,x){let _=r?-1:1;if(p!==m){for(p+=l;e[p%l].skip;)p-=_;for(;e[m%l].skip;)m+=_;p%l!==m%l&&(c.push({start:p%l,end:m%l,loop:g,style:x}),d=x,h=m%l)}}for(let p of t){h=r?h:p.start;let m=e[h%l],g;for(u=h+1;u<=p.end;u++){let x=e[u%l];g=ar(n.setContext(ee(s,{type:"segment",p0:m,p1:x,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Wh(g,d)&&f(h,u-1,p.loop,d),m=x,d=g}h<u-1&&f(h,u-1,p.loop,d)}return c}function ar(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function Wh(i,t){if(!t)return!1;let e=[],n=function(s,o){return Js(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,n)!==JSON.stringify(t,n)}function un(i,t,e){return i.options.clip?i[e]:t[e]}function jh(i,t){let{xScale:e,yScale:n}=i;return e&&n?{left:un(e,t,"left"),right:un(e,t,"right"),top:un(n,t,"top"),bottom:un(n,t,"bottom")}:t}function fo(i,t){let e=t._clip;if(e.disabled)return!1;let n=jh(t,i.chartArea);return{left:e.left===!1?0:n.left-(e.left===!0?0:e.left),right:e.right===!1?i.width:n.right+(e.right===!0?0:e.right),top:e.top===!1?0:n.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?i.height:n.bottom+(e.bottom===!0?0:e.bottom)}}var rr,lr,zs,Ja,Ke,Zt,Hs,z,Y,Zd,pn,Qd,tt,we,Za,Qt,Dt,Ft,pr,gr,Gs,yn,ht,_r,dn,Qa,tr,Ue,ih,nh,er,yr,Qe,ce,vn,Fs,G,fh,ph,gh,bh,no,vh,Sh,Ge,Tr,En,Oh,Rh,le,Lr,Nh,Fh,Br=Bt(()=>{"use strict";qa();rr=(()=>{let i=0;return()=>i++})();lr=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,zs=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;Ja={"":i=>i,x:i=>i.x,y:i=>i.y};Ke=i=>typeof i<"u",Zt=i=>typeof i=="function",Hs=(i,t)=>{if(i.size!==t.size)return!1;for(let e of i)if(!t.has(e))return!1;return!0};z=Math.PI,Y=2*z,Zd=Y+z,pn=Number.POSITIVE_INFINITY,Qd=z/180,tt=z/2,we=z/4,Za=z*2/3,Qt=Math.log10,Dt=Math.sign;Ft=(i,t,e,n)=>_n(i,e,n?s=>{let o=i[s][t];return o<e||o===e&&i[s+1][t]===e}:s=>i[s][t]<e),pr=(i,t,e)=>_n(i,e,n=>i[n][t]>=e);gr=["push","pop","shift","splice","unshift"];Gs=(function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame})();yn=i=>i==="start"?"left":i==="end"?"right":"center",ht=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,_r=(i,t,e,n)=>i===(n?"left":"right")?e:i==="center"?(t+e)/2:t;dn=i=>i===0||i===1,Qa=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Y/e)),tr=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Y/e)+1,Ue={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*tt)+1,easeOutSine:i=>Math.sin(i*tt),easeInOutSine:i=>-.5*(Math.cos(z*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>dn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>dn(i)?i:Qa(i,.075,.3),easeOutElastic:i=>dn(i)?i:tr(i,.075,.3),easeInOutElastic(i){return dn(i)?i:i<.5?.5*Qa(i*2,.1125,.45):.5+.5*tr(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-Ue.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?Ue.easeInBounce(i*2)*.5:Ue.easeOutBounce(i*2-1)*.5+.5};ih=["x","y","borderWidth","radius","tension"],nh=["color","borderColor","backgroundColor"];er=new Map;yr={values(i){return U(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";let n=this.chart.options.locale,s,o=i;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=rh(i,e)}let a=Qt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ze(i,n,l)},logarithmic(i,t,e){if(i===0)return"0";let n=e[t].significand||i/Math.pow(10,Math.floor(Qt(i)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?yr.numeric.call(this,i,t,e):""}};Qe={formatters:yr};ce=Object.create(null),vn=Object.create(null);Fs=class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>Bs(s.backgroundColor),this.hoverBorderColor=(n,s)=>Bs(s.borderColor),this.hoverColor=(n,s)=>Bs(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ns(this,t,e)}get(t){return Ci(this,t)}describe(t,e){return Ns(vn,t,e)}override(t,e){return Ns(ce,t,e)}route(t,e,n,s){let o=Ci(this,t),a=Ci(this,n),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[s];return F(l)?Object.assign({},c,l):O(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},G=new Fs({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[sh,oh,lh]);fh=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,ph=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;gh=i=>+i||0;bh=(i,t)=>i?i+bn(t):t,no=(i,t)=>F(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);vh=(i,t)=>i===!0?t:typeof i=="string"?te(t,i):void 0;Sh=Number.EPSILON||1e-14,Ge=(i,t)=>t<i.length&&!i[t].skip&&i[t],Tr=i=>i==="x"?"y":"x";En=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);Oh=["top","right","bottom","left"];Rh=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);le=i=>Math.round(i*10)/10;Lr=(function(){let i=!1;try{let t={get passive(){return i=!0,!1}};Mn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i})();Nh=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},Fh=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}}});var gc={};Ce(gc,{Animation:()=>Bn,Animations:()=>Ii,ArcElement:()=>pe,BarController:()=>Le,BarElement:()=>Ne,BasePlatform:()=>Bi,BasicPlatform:()=>Nn,BubbleController:()=>Pe,CategoryScale:()=>oi,Chart:()=>jt,Colors:()=>ic,DatasetController:()=>Ct,Decimation:()=>sc,DomPlatform:()=>zn,DoughnutController:()=>Ut,Element:()=>wt,Filler:()=>ac,Interaction:()=>Hl,Legend:()=>lc,LineController:()=>Oe,LineElement:()=>Pt,LinearScale:()=>ai,LogarithmicScale:()=>ri,PieController:()=>ni,PointElement:()=>Be,PolarAreaController:()=>ge,RadarController:()=>Re,RadialLinearScale:()=>me,Scale:()=>_e,ScatterController:()=>Ie,SubTitle:()=>dc,Ticks:()=>Qe,TimeScale:()=>xe,TimeSeriesScale:()=>li,Title:()=>cc,Tooltip:()=>uc,_adapters:()=>zl,_detectPlatform:()=>Ul,animator:()=>Wt,controllers:()=>Fl,defaults:()=>G,elements:()=>Ql,layouts:()=>ft,plugins:()=>fc,registerables:()=>Up,registry:()=>Lt,scales:()=>mc});function Yh(i,t){let e=[],n=Object.keys(t);for(let s=0;s<n.length;s++){let o=i[n[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function Gh(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Fr(i,t){let e=i&&i.options||{},n=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:n?o:s,end:n?s:o}}function Xh(i,t,e){if(e===!1)return!1;let n=Fr(i,e),s=Fr(t,e);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function Kh(i){let t,e,n,s;return F(i)?(t=i.top,e=i.right,n=i.bottom,s=i.left):t=e=n=s=i,{top:t,right:e,bottom:n,left:s,disabled:i===!1}}function Bl(i,t){let e=[],n=i._getSortedDatasetMetas(t),s,o;for(s=0,o=n.length;s<o;++s)e.push(n[s].index);return e}function zr(i,t,e,n={}){let s=i.keys,o=n.mode==="single",a,r,l,c;if(t===null)return;let d=!1;for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===e){if(d=!0,n.all)continue;break}c=i.values[l],Q(c)&&(o||t===0||Dt(t)===Dt(c))&&(t+=c)}return!d&&!n.all?0:t}function qh(i,t){let{iScale:e,vScale:n}=t,s=e.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",a=Object.keys(i),r=new Array(a.length),l,c,d;for(l=0,c=a.length;l<c;++l)d=a[l],r[l]={[s]:d,[o]:i[d]};return r}function po(i,t){let e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Jh(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Zh(i){let{min:t,max:e,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Qh(i,t,e){let n=i[t]||(i[t]={});return n[e]||(n[e]={})}function Hr(i,t,e,n){for(let s of t.getMatchingVisibleMetas(n).reverse()){let o=i[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function $r(i,t){let{chart:e,_cachedMeta:n}=i,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=n,l=o.axis,c=a.axis,d=Jh(o,a,n),h=t.length,u;for(let f=0;f<h;++f){let p=t[f],{[l]:m,[c]:g}=p,x=p._stacks||(p._stacks={});u=x[c]=Qh(s,d,m),u[r]=g,u._top=Hr(u,a,!0,n.type),u._bottom=Hr(u,a,!1,n.type);let _=u._visualValues||(u._visualValues={});_[r]=g}}function mo(i,t){let e=i.scales;return Object.keys(e).filter(n=>e[n].axis===t).shift()}function tu(i,t){return ee(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function eu(i,t,e){return ee(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ei(i,t){let e=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){t=t||i._parsed;for(let s of t){let o=s._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}function nu(i,t){if(!i._cache.$bar){let e=i.getMatchingVisibleMetas(t),n=[];for(let s=0,o=e.length;s<o;s++)n=n.concat(e[s].controller.getAllParsedValues(i));i._cache.$bar=Ys(n.sort((s,o)=>s-o))}return i._cache.$bar}function su(i){let t=i.iScale,e=nu(t,i.type),n=t._length,s,o,a,r,l=()=>{a===32767||a===-32768||(Ke(r)&&(n=Math.min(n,Math.abs(a-r)||n)),r=a)};for(s=0,o=e.length;s<o;++s)a=t.getPixelForValue(e[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return n}function ou(i,t,e,n){let s=e.barThickness,o,a;return N(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*n,a=1),{chunk:o/n,ratio:a,start:t.pixels[i]-o/2}}function au(i,t,e,n){let s=t.pixels,o=s[i],a=i>0?s[i-1]:null,r=i<s.length-1?s[i+1]:null,l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);let c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:e.barPercentage,start:c}}function ru(i,t,e,n){let s=e.parse(i[0],n),o=e.parse(i[1],n),a=Math.min(s,o),r=Math.max(s,o),l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:a,max:r}}function Nl(i,t,e,n){return U(i)?ru(i,t,e,n):t[e.axis]=e.parse(i,n),t}function Wr(i,t,e,n){let s=i.iScale,o=i.vScale,a=s.getLabels(),r=s===o,l=[],c,d,h,u;for(c=e,d=e+n;c<d;++c)u=t[c],h={},h[s.axis]=r||s.parse(a[c],c),l.push(Nl(u,h,o,c));return l}function bo(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function lu(i,t,e){return i!==0?Dt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function cu(i){let t,e,n,s,o;return i.horizontal?(t=i.base>i.x,e="left",n="right"):(t=i.base<i.y,e="bottom",n="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:n,reverse:t,top:s,bottom:o}}function du(i,t,e,n){let s=t.borderSkipped,o={};if(!s){i.borderSkipped=o;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:c,bottom:d}=cu(i);s==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===n?s=c:(e._bottom||0)===n?s=d:(o[jr(d,a,r,l)]=!0,s=c)),o[jr(s,a,r,l)]=!0,i.borderSkipped=o}function jr(i,t,e,n){return n?(i=hu(i,t,e),i=Ur(i,e,t)):i=Ur(i,t,e),i}function hu(i,t,e){return i===t?e:i===e?t:i}function Ur(i,t,e){return i==="start"?t:i==="end"?e:i}function uu(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}function fu(i,t,e){let n=1,s=1,o=0,a=0;if(t<Y){let r=i,l=r+t,c=Math.cos(r),d=Math.sin(r),h=Math.cos(l),u=Math.sin(l),f=(C,y,v)=>Je(C,r,l,!0)?1:Math.max(y,y*e,v,v*e),p=(C,y,v)=>Je(C,r,l,!0)?-1:Math.min(y,y*e,v,v*e),m=f(0,c,h),g=f(tt,d,u),x=p(z,c,h),_=p(z+tt,d,u);n=(m-x)/2,s=(g-_)/2,o=-(m+x)/2,a=-(g+_)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:a}}function Ae(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function pu(i,t,e,n){let{controller:s,data:o,_sorted:a}=i,r=s._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?pr:Ft;if(n){if(s._sharedOptions){let d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){let u=c(o,t,e-h),f=c(o,t,e+h);return{lo:u.lo,hi:f.hi}}}}else{let d=c(o,t,e);if(l){let{vScale:h}=s._cachedMeta,{_parsed:u}=i,f=u.slice(0,d.lo+1).reverse().findIndex(m=>!N(m[h.axis]));d.lo-=Math.max(0,f);let p=u.slice(d.hi).findIndex(m=>!N(m[h.axis]));d.hi+=Math.max(0,p)}return d}}return{lo:0,hi:o.length-1}}function Hi(i,t,e,n,s){let o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){let{index:c,data:d}=o[r],{lo:h,hi:u}=pu(o[r],t,a,s);for(let f=h;f<=u;++f){let p=d[f];p.skip||n(p,c,f)}}}function mu(i){let t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(n,s){let o=t?Math.abs(n.x-s.x):0,a=e?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function xo(i,t,e,n,s){let o=[];return!s&&!i.isPointInArea(t)||Hi(i,e,t,function(r,l,c){!s&&!zt(r,i.chartArea,0)||r.inRange(t.x,t.y,n)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function gu(i,t,e,n){let s=[];function o(a,r,l){let{startAngle:c,endAngle:d}=a.getProps(["startAngle","endAngle"],n),{angle:h}=js(a,{x:t.x,y:t.y});Je(h,c,d)&&s.push({element:a,datasetIndex:r,index:l})}return Hi(i,e,t,o),s}function bu(i,t,e,n,s,o){let a=[],r=mu(e),l=Number.POSITIVE_INFINITY;function c(d,h,u){let f=d.inRange(t.x,t.y,s);if(n&&!f)return;let p=d.getCenterPoint(s);if(!(!!o||i.isPointInArea(p))&&!f)return;let g=r(t,p);g<l?(a=[{element:d,datasetIndex:h,index:u}],l=g):g===l&&a.push({element:d,datasetIndex:h,index:u})}return Hi(i,e,t,c),a}function _o(i,t,e,n,s,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!n?gu(i,t,e,s):bu(i,t,e,n,s,o)}function Yr(i,t,e,n,s){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return Hi(i,e,t,(l,c,d)=>{l[a]&&l[a](t[e],s)&&(o.push({element:l,datasetIndex:c,index:d}),r=r||l.inRange(t.x,t.y,s))}),n&&!r?[]:o}function Ti(i,t){return i.filter(e=>e.pos===t)}function Gr(i,t){return i.filter(e=>$l.indexOf(e.pos)===-1&&e.box.axis===t)}function Ai(i,t){return i.sort((e,n)=>{let s=t?n:e,o=t?e:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function xu(i){let t=[],e,n,s,o,a,r;for(e=0,n=(i||[]).length;e<n;++e)s=i[e],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:e,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function _u(i){let t={};for(let e of i){let{stack:n,pos:s,stackWeight:o}=e;if(!n||!$l.includes(s))continue;let a=t[n]||(t[n]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function yu(i,t){let e=_u(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=t,o,a,r;for(o=0,a=i.length;o<a;++o){r=i[o];let{fullSize:l}=r.box,c=e[r.stack],d=c&&r.stackWeight/c.weight;r.horizontal?(r.width=d?d*n:l&&t.availableWidth,r.height=s):(r.width=n,r.height=d?d*s:l&&t.availableHeight)}return e}function vu(i){let t=xu(i),e=Ai(t.filter(c=>c.box.fullSize),!0),n=Ai(Ti(t,"left"),!0),s=Ai(Ti(t,"right")),o=Ai(Ti(t,"top"),!0),a=Ai(Ti(t,"bottom")),r=Gr(t,"x"),l=Gr(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Ti(t,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Xr(i,t,e,n){return Math.max(i[e],t[e])+Math.max(i[n],t[n])}function Vl(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Cu(i,t,e,n){let{pos:s,box:o}=e,a=i.maxPadding;if(!F(s)){e.size&&(i[s]-=e.size);let h=n[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,i[s]+=e.size}o.getPadding&&Vl(a,o.getPadding());let r=Math.max(0,t.outerWidth-Xr(a,i,"left","right")),l=Math.max(0,t.outerHeight-Xr(a,i,"top","bottom")),c=r!==i.w,d=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:d}:{same:d,other:c}}function ku(i){let t=i.maxPadding;function e(n){let s=Math.max(t[n]-i[n],0);return i[n]+=s,s}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function wu(i,t){let e=t.maxPadding;function n(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return n(i?["left","right"]:["top","bottom"])}function Pi(i,t,e,n){let s=[],o,a,r,l,c,d;for(o=0,a=i.length,c=0;o<a;++o){r=i[o],l=r.box,l.update(r.width||t.w,r.height||t.h,wu(r.horizontal,t));let{same:h,other:u}=Cu(t,e,r,n);c|=h&&s.length,d=d||u,l.fullSize||s.push(r)}return c&&Pi(s,t,e,n)||d}function Tn(i,t,e,n,s){i.top=e,i.left=t,i.right=t+n,i.bottom=e+s,i.width=n,i.height=s}function Kr(i,t,e,n){let s=e.padding,{x:o,y:a}=t;for(let r of i){let l=r.box,c=n[r.stack]||{count:1,placed:0,weight:1},d=r.stackWeight/c.weight||1;if(r.horizontal){let h=t.w*d,u=c.size||l.height;Ke(c.start)&&(a=c.start),l.fullSize?Tn(l,s.left,a,e.outerWidth-s.right-s.left,u):Tn(l,t.left+c.placed,a,h,u),c.start=a,c.placed+=h,a=l.bottom}else{let h=t.h*d,u=c.size||l.width;Ke(c.start)&&(o=c.start),l.fullSize?Tn(l,o,s.top,u,e.outerHeight-s.bottom-s.top):Tn(l,o,t.top+c.placed,u,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=a}function Su(i,t){let e=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[Rn]={initial:{height:n,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",qr(s)){let o=ro(i,"width");o!==void 0&&(i.width=o)}if(qr(n))if(i.style.height==="")i.height=i.width/(t||2);else{let o=ro(i,"height");o!==void 0&&(i.height=o)}return i}function Eu(i,t,e){i&&i.addEventListener(t,e,Wl)}function Tu(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Wl)}function Au(i,t){let e=Mu[i.type]||i.type,{x:n,y:s}=fe(i,t);return{type:e,chart:t,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Fn(i,t){for(let e of i)if(e===t||e.contains(t))return!0}function Du(i,t,e){let n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||Fn(r.addedNodes,n),a=a&&!Fn(r.removedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Lu(i,t,e){let n=i.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||Fn(r.removedNodes,n),a=a&&!Fn(r.addedNodes,n);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function jl(){let i=window.devicePixelRatio;i!==Jr&&(Jr=i,Ni.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Pu(i,t){Ni.size||window.addEventListener("resize",jl),Ni.set(i,t)}function Ou(i){Ni.delete(i),Ni.size||window.removeEventListener("resize",jl)}function Ru(i,t,e){let n=i.canvas,s=n&&Sn(n);if(!s)return;let o=Xs((r,l)=>{let c=s.clientWidth;e(r,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(r=>{let l=r[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return a.observe(s),Pu(i,o),a}function yo(i,t,e){e&&e.disconnect(),t==="resize"&&Ou(i)}function Iu(i,t,e){let n=i.canvas,s=Xs(o=>{i.ctx!==null&&e(Au(o,i))},i);return Eu(n,t,s),s}function Ul(i){return!Mn()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Nn:zn}function Bu(i,t){let e=i.options.ticks,n=Nu(i),s=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?zu(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return Hu(t,c,o,a/s),c;let d=Fu(o,t,s);if(a>0){let h,u,f=a>1?Math.round((l-r)/(a-1)):null;for(An(t,c,d,N(f)?0:r-f,r),h=0,u=a-1;h<u;h++)An(t,c,d,o[h],o[h+1]);return An(t,c,d,l,N(f)?t.length:l+f),c}return An(t,c,d),c}function Nu(i){let t=i.options.offset,e=i._tickSize(),n=i._length/e+(t?0:1),s=i._maxLength/e;return Math.floor(Math.min(n,s))}function Fu(i,t,e){let n=$u(i),s=t.length/e;if(!n)return Math.max(s,1);let o=hr(n);for(let a=0,r=o.length-1;a<r;a++){let l=o[a];if(l>s)return l}return Math.max(s,1)}function zu(i){let t=[],e,n;for(e=0,n=i.length;e<n;e++)i[e].major&&t.push(e);return t}function Hu(i,t,e,n){let s=0,o=e[0],a;for(n=Math.ceil(n),a=0;a<i.length;a++)a===o&&(t.push(i[a]),s++,o=e[s*n])}function An(i,t,e,n,s){let o=O(n,0),a=Math.min(O(s,i.length),i.length),r=0,l,c,d;for(e=Math.ceil(e),s&&(l=s-n,e=l/Math.floor(l/e)),d=o;d<0;)r++,d=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===d&&(t.push(i[c]),r++,d=Math.round(o+r*e))}function $u(i){let t=i.length,e,n;if(t<2)return!1;for(n=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==n)return!1;return n}function tl(i,t){let e=[],n=i.length/t,s=i.length,o=0;for(;o<s;o+=n)e.push(i[Math.floor(o)]);return e}function Wu(i,t,e){let n=i.ticks.length,s=Math.min(t,n-1),o=i._startPixel,a=i._endPixel,r=1e-6,l=i.getPixelForTick(s),c;if(!(e&&(n===1?c=Math.max(l-o,a-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function ju(i,t){$(i,e=>{let n=e.gc,s=n.length/2,o;if(s>t){for(o=0;o<s;++o)delete e.data[n[o]];n.splice(0,s)}})}function Di(i){return i.drawTicks?i.tickLength:0}function el(i,t){if(!i.display)return 0;let e=st(i.font,t),n=ut(i.padding);return(U(i.text)?i.text.length:1)*e.lineHeight+n.height}function Uu(i,t){return ee(i,{scale:t,type:"scale"})}function Yu(i,t,e){return ee(i,{tick:e,index:t,type:"tick"})}function Gu(i,t,e){let n=yn(i);return(e&&t!=="right"||!e&&t==="right")&&(n=Vu(n)),n}function Xu(i,t,e,n){let{top:s,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:d}=l,h=0,u,f,p,m=a-s,g=r-o;if(i.isHorizontal()){if(f=ht(n,o,r),F(e)){let x=Object.keys(e)[0],_=e[x];p=d[x].getPixelForValue(_)+m-t}else e==="center"?p=(c.bottom+c.top)/2+m-t:p=Zr(i,e,t);u=r-o}else{if(F(e)){let x=Object.keys(e)[0],_=e[x];f=d[x].getPixelForValue(_)-g+t}else e==="center"?f=(c.left+c.right)/2-g+t:f=Zr(i,e,t);p=ht(n,a,s),h=e==="left"?-tt:tt}return{titleX:f,titleY:p,maxWidth:u,rotation:h}}function Ku(i,t,e){let n=Ye(Object.create(null),[e?G.get(e):{},G.get(t),i.defaults]);G.set(t,n),i.defaultRoutes&&qu(t,i.defaultRoutes),i.descriptors&&G.describe(t,i.descriptors)}function qu(i,t){Object.keys(t).forEach(e=>{let n=e.split("."),s=n.pop(),o=[i].concat(n).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");G.route(o,s,l,r)})}function Ju(i){return"id"in i&&"defaults"in i}function Zu(i){let t={},e=[],n=Object.keys(Lt.plugins.items);for(let o=0;o<n.length;o++)e.push(Lt.getPlugin(n[o]));let s=i.plugins||[];for(let o=0;o<s.length;o++){let a=s[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Qu(i,t){return!t&&i===!1?null:i===!0?{}:i}function tf(i,{plugins:t,localIds:e},n,s){let o=[],a=i.getContext();for(let r of t){let l=r.id,c=Qu(n[l],s);c!==null&&o.push({plugin:r,options:ef(i.config,{plugin:r,local:e[l]},c,a)})}return o}function ef(i,{plugin:t,local:e},n,s){let o=i.pluginScopeKeys(t),a=i.getOptionScopes(n,o);return e&&t.defaults&&a.push(t.defaults),i.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ao(i,t){let e=G.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function nf(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function sf(i,t){return i===t?"_index_":"_value_"}function il(i){if(i==="x"||i==="y"||i==="r")return i}function of(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Do(i,...t){if(il(i))return i;for(let e of t){let n=e.axis||of(e.position)||i.length>1&&il(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function nl(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function af(i,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(e.length)return nl(i,"x",e[0])||nl(i,"y",e[0])}return{}}function rf(i,t){let e=ce[i.type]||{scales:{}},n=t.scales||{},s=Ao(i.type,t),o=Object.create(null);return Object.keys(n).forEach(a=>{let r=n[a];if(!F(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=Do(a,r,af(a,i),G.scales[r.type]),c=sf(l,s),d=e.scales||{};o[a]=Xe(Object.create(null),[{axis:l},r,d[l],d[c]])}),i.data.datasets.forEach(a=>{let r=a.type||i.type,l=a.indexAxis||Ao(r,t),d=(ce[r]||{}).scales||{};Object.keys(d).forEach(h=>{let u=nf(h,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Xe(o[f],[{axis:u},n[f],d[h]])})}),Object.keys(o).forEach(a=>{let r=o[a];Xe(r,[G.scales[r.type],G.scale])}),o}function Yl(i){let t=i.options||(i.options={});t.plugins=O(t.plugins,{}),t.scales=rf(i,t)}function Gl(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function lf(i){return i=i||{},i.data=Gl(i.data),Yl(i),i}function Dn(i,t){let e=sl.get(i);return e||(e=t(),sl.set(i,e),Xl.add(e)),e}function ol(i,t,e){let n=i.get(t);n||(n=new Map,i.set(t,n));let s=e.join(),o=n.get(s);return o||(o={resolver:wn(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},n.set(s,o)),o}function df(i,t){let{isScriptable:e,isIndexable:n}=io(i);for(let s of t){let o=e(s),a=n(s),r=(a||o)&&i[s];if(o&&(Zt(r)||cf(r))||a&&U(r))return!0}return!1}function al(i,t){return i==="top"||i==="bottom"||uf.indexOf(i)===-1&&t==="x"}function rl(i,t){return function(e,n){return e[i]===n[i]?e[t]-n[t]:e[i]-n[i]}}function ll(i){let t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),W(e&&e.onComplete,[i],t)}function ff(i){let t=i.chart,e=t.options.animation;W(e&&e.onProgress,[i],t)}function Kl(i){return Mn()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}function pf(i,t,e){let n=Object.keys(i);for(let s of n){let o=+s;if(o>=t){let a=i[s];delete i[s],(e>0||o>t)&&(i[o+e]=a)}}}function mf(i,t,e,n){return!e||i.type==="mouseout"?null:n?t:i}function dl(){return $(jt.instances,i=>i._plugins.invalidate())}function gf(i,t,e){let{startAngle:n,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/a,dt(n-e));if(i.beginPath(),i.arc(s,o,a-c/2,n+h/2,e-h/2),r>0){let u=Math.min(c/r,dt(n-e));i.arc(s,o,r+c/2,e-u/2,n+u/2,!0)}else{let u=Math.min(c/2,a*dt(n-e));if(d==="round")i.arc(s,o,u,e-z/2,n+z/2,!0);else if(d==="bevel"){let f=2*u*u,p=-f*Math.cos(e+z/2)+s,m=-f*Math.sin(e+z/2)+o,g=f*Math.cos(n+z/2)+s,x=f*Math.sin(n+z/2)+o;i.lineTo(p,m),i.lineTo(g,x)}}i.closePath(),i.moveTo(0,0),i.rect(0,0,i.canvas.width,i.canvas.height),i.clip("evenodd")}function bf(i,t,e){let{startAngle:n,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=s/r;i.beginPath(),i.arc(o,a,r,n-c,e+c),l>s?(c=s/l,i.arc(o,a,l,e+c,n-c,!0)):i.arc(o,a,s,e+tt,n-tt),i.closePath(),i.clip()}function xf(i){return kn(i,["outerStart","outerEnd","innerStart","innerEnd"])}function _f(i,t,e,n){let s=xf(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,n*t/2),r=l=>{let c=(e-Math.min(o,l))*n/2;return at(l,0,Math.min(o,c))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:at(s.innerStart,0,a),innerEnd:at(s.innerEnd,0,a)}}function ii(i,t,e,n){return{x:e+i*Math.cos(t),y:n+i*Math.sin(t)}}function Hn(i,t,e,n,s,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:d}=t,h=Math.max(t.outerRadius+n+e-c,0),u=d>0?d+n+e+c:0,f=0,p=s-l;if(n){let H=d>0?d-n:0,j=h>0?h-n:0,K=(H+j)/2,xt=K!==0?p*K/(K+n):p;f=(p-xt)/2}let m=Math.max(.001,p*h-e/z)/h,g=(p-m)/2,x=l+g+f,_=s-g-f,{outerStart:C,outerEnd:y,innerStart:v,innerEnd:w}=_f(t,u,h,_-x),S=h-C,E=h-y,L=x+C/S,R=_-y/E,A=u+v,I=u+w,et=x+v/A,lt=_-w/I;if(i.beginPath(),o){let H=(L+R)/2;if(i.arc(a,r,h,L,H),i.arc(a,r,h,H,R),y>0){let rt=ii(E,R,a,r);i.arc(rt.x,rt.y,y,R,_+tt)}let j=ii(I,_,a,r);if(i.lineTo(j.x,j.y),w>0){let rt=ii(I,lt,a,r);i.arc(rt.x,rt.y,w,_+tt,lt+Math.PI)}let K=(_-w/u+(x+v/u))/2;if(i.arc(a,r,u,_-w/u,K,!0),i.arc(a,r,u,K,x+v/u,!0),v>0){let rt=ii(A,et,a,r);i.arc(rt.x,rt.y,v,et+Math.PI,x-tt)}let xt=ii(S,x,a,r);if(i.lineTo(xt.x,xt.y),C>0){let rt=ii(S,L,a,r);i.arc(rt.x,rt.y,C,x-tt,L)}}else{i.moveTo(a,r);let H=Math.cos(L)*h+a,j=Math.sin(L)*h+r;i.lineTo(H,j);let K=Math.cos(R)*h+a,xt=Math.sin(R)*h+r;i.lineTo(K,xt)}i.closePath()}function yf(i,t,e,n,s){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){Hn(i,t,e,n,l,s);for(let c=0;c<o;++c)i.fill();isNaN(r)||(l=a+(r%Y||Y))}return Hn(i,t,e,n,l,s),i.fill(),l}function vf(i,t,e,n,s){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:d,borderDash:h,borderDashOffset:u,borderRadius:f}=l,p=l.borderAlign==="inner";if(!c)return;i.setLineDash(h||[]),i.lineDashOffset=u,p?(i.lineWidth=c*2,i.lineJoin=d||"round"):(i.lineWidth=c,i.lineJoin=d||"bevel");let m=t.endAngle;if(o){Hn(i,t,e,n,m,s);for(let g=0;g<o;++g)i.stroke();isNaN(r)||(m=a+(r%Y||Y))}p&&bf(i,t,m),l.selfJoin&&m-a>=z&&f===0&&d!=="miter"&&gf(i,t,m),o||(Hn(i,t,e,n,m,s),i.stroke())}function ql(i,t,e=t){i.lineCap=O(e.borderCapStyle,t.borderCapStyle),i.setLineDash(O(e.borderDash,t.borderDash)),i.lineDashOffset=O(e.borderDashOffset,t.borderDashOffset),i.lineJoin=O(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=O(e.borderWidth,t.borderWidth),i.strokeStyle=O(e.borderColor,t.borderColor)}function Cf(i,t,e){i.lineTo(e.x,e.y)}function kf(i){return i.stepped?Cr:i.tension||i.cubicInterpolationMode==="monotone"?kr:Cf}function Jl(i,t,e={}){let n=i.length,{start:s=0,end:o=n-1}=e,{start:a,end:r}=t,l=Math.max(s,a),c=Math.min(o,r),d=s<a&&o<a||s>r&&o>r;return{count:n,start:l,loop:t.loop,ilen:c<l&&!d?n+c-l:c-l}}function wf(i,t,e,n){let{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Jl(s,e,n),d=kf(o),{move:h=!0,reverse:u}=n||{},f,p,m;for(f=0;f<=c;++f)p=s[(r+(u?c-f:f))%a],!p.skip&&(h?(i.moveTo(p.x,p.y),h=!1):d(i,m,p,u,o.stepped),m=p);return l&&(p=s[(r+(u?c:0))%a],d(i,m,p,u,o.stepped)),!!l}function Mf(i,t,e,n){let s=t.points,{count:o,start:a,ilen:r}=Jl(s,e,n),{move:l=!0,reverse:c}=n||{},d=0,h=0,u,f,p,m,g,x,_=y=>(a+(c?r-y:y))%o,C=()=>{m!==g&&(i.lineTo(d,g),i.lineTo(d,m),i.lineTo(d,x))};for(l&&(f=s[_(0)],i.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[_(u)],f.skip)continue;let y=f.x,v=f.y,w=y|0;w===p?(v<m?m=v:v>g&&(g=v),d=(h*d+y)/++h):(C(),i.lineTo(y,v),p=w,h=0,m=g=v),x=v}C()}function Po(i){let t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Mf:wf}function Sf(i){return i.stepped?Pr:i.tension||i.cubicInterpolationMode==="monotone"?Or:re}function Ef(i,t,e,n){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,n)&&s.closePath()),ql(i,t.options),i.stroke(s)}function Tf(i,t,e,n){let{segments:s,options:o}=t,a=Po(t);for(let r of s)ql(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+n-1})&&i.closePath(),i.stroke()}function Df(i,t,e,n){Af&&!t.options.segment?Ef(i,t,e,n):Tf(i,t,e,n)}function hl(i,t,e,n){let s=i.options,{[e]:o}=i.getProps([e],n);return Math.abs(t-o)<s.radius+s.hitRadius}function Zl(i,t){let{x:e,y:n,base:s,width:o,height:a}=i.getProps(["x","y","base","width","height"],t),r,l,c,d,h;return i.horizontal?(h=a/2,r=Math.min(e,s),l=Math.max(e,s),c=n-h,d=n+h):(h=o/2,r=e-h,l=e+h,c=Math.min(n,s),d=Math.max(n,s)),{left:r,top:c,right:l,bottom:d}}function be(i,t,e,n){return i?0:at(t,e,n)}function Lf(i,t,e){let n=i.options.borderWidth,s=i.borderSkipped,o=eo(n);return{t:be(s.top,o.top,0,e),r:be(s.right,o.right,0,t),b:be(s.bottom,o.bottom,0,e),l:be(s.left,o.left,0,t)}}function Pf(i,t,e){let{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,o=ue(s),a=Math.min(t,e),r=i.borderSkipped,l=n||F(s);return{topLeft:be(!l||r.top||r.left,o.topLeft,0,a),topRight:be(!l||r.top||r.right,o.topRight,0,a),bottomLeft:be(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:be(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Of(i){let t=Zl(i),e=t.right-t.left,n=t.bottom-t.top,s=Lf(i,e/2,n/2),o=Pf(i,e/2,n/2);return{outer:{x:t.left,y:t.top,w:e,h:n,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function vo(i,t,e,n){let s=t===null,o=e===null,r=i&&!(s&&o)&&Zl(i,n);return r&&(s||$t(t,r.left,r.right))&&(o||$t(e,r.top,r.bottom))}function Rf(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function If(i,t){i.rect(t.x,t.y,t.w,t.h)}function Co(i,t,e={}){let n=i.x!==e.x?-t:0,s=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-n,a=(i.y+i.h!==e.y+e.h?t:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+o,h:i.h+a,radius:i.radius}}function tc(i){return Oo[i%Oo.length]}function ec(i){return ul[i%ul.length]}function Bf(i,t){return i.borderColor=tc(t),i.backgroundColor=ec(t),++t}function Nf(i,t){return i.backgroundColor=i.data.map(()=>tc(t++)),t}function Ff(i,t){return i.backgroundColor=i.data.map(()=>ec(t++)),t}function zf(i){let t=0;return(e,n)=>{let s=i.getDatasetMeta(n).controller;s instanceof Ut?t=Nf(e,t):s instanceof ge?t=Ff(e,t):s&&(t=Bf(e,t))}}function fl(i){let t;for(t in i)if(i[t].borderColor||i[t].backgroundColor)return!0;return!1}function Hf(i){return i&&(i.borderColor||i.backgroundColor)}function $f(){return G.borderColor!=="rgba(0,0,0,0.1)"||G.backgroundColor!=="rgba(0,0,0,0.1)"}function Vf(i,t,e,n,s){let o=s.samples||n;if(o>=e)return i.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,d=t,h,u,f,p,m;for(a[l++]=i[d],h=0;h<o-2;h++){let g=0,x=0,_,C=Math.floor((h+1)*r)+1+t,y=Math.min(Math.floor((h+2)*r)+1,e)+t,v=y-C;for(_=C;_<y;_++)g+=i[_].x,x+=i[_].y;g/=v,x/=v;let w=Math.floor(h*r)+1+t,S=Math.min(Math.floor((h+1)*r)+1,e)+t,{x:E,y:L}=i[d];for(f=p=-1,_=w;_<S;_++)p=.5*Math.abs((E-g)*(i[_].y-L)-(E-i[_].x)*(x-L)),p>f&&(f=p,u=i[_],m=_);a[l++]=u,d=m}return a[l++]=i[c],a}function Wf(i,t,e,n){let s=0,o=0,a,r,l,c,d,h,u,f,p,m,g=[],x=t+e-1,_=i[t].x,y=i[x].x-_;for(a=t;a<t+e;++a){r=i[a],l=(r.x-_)/y*n,c=r.y;let v=l|0;if(v===d)c<p?(p=c,h=a):c>m&&(m=c,u=a),s=(o*s+r.x)/++o;else{let w=a-1;if(!N(h)&&!N(u)){let S=Math.min(h,u),E=Math.max(h,u);S!==f&&S!==w&&g.push({...i[S],x:s}),E!==f&&E!==w&&g.push({...i[E],x:s})}a>0&&w!==f&&g.push(i[w]),g.push(r),d=v,o=0,p=m=c,h=u=f=a}}return g}function nc(i){if(i._decimated){let t=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function pl(i){i.data.datasets.forEach(t=>{nc(t)})}function jf(i,t){let e=t.length,n=0,s,{iScale:o}=i,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=at(Ft(t,o.axis,a).lo,0,e-1)),c?s=at(Ft(t,o.axis,r).hi+1,n,e)-n:s=e-n,{start:n,count:s}}function Uf(i,t,e){let n=i.segments,s=i.points,o=t.points,a=[];for(let r of n){let{start:l,end:c}=r;c=Wn(l,c,s);let d=Ro(e,s[l],s[c],r.loop);if(!t.segments){a.push({source:r,target:d,start:s[l],end:s[c]});continue}let h=uo(t,d);for(let u of h){let f=Ro(e,o[u.start],o[u.end],u.loop),p=ho(r,s,f);for(let m of p)a.push({source:m,target:u,start:{[e]:ml(d,f,"start",Math.max)},end:{[e]:ml(d,f,"end",Math.min)}})}}return a}function Ro(i,t,e,n){if(n)return;let s=t[i],o=e[i];return i==="angle"&&(s=dt(s),o=dt(o)),{property:i,start:s,end:o}}function Yf(i,t){let{x:e=null,y:n=null}=i||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Wn(a,r,s);let l=s[a],c=s[r];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Wn(i,t,e){for(;t>i;t--){let n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function ml(i,t,e,n){return i&&t?n(i[e],t[e]):i?i[e]:t?t[e]:0}function oc(i,t){let e=[],n=!1;return U(i)?(n=!0,e=i):e=Yf(i,t),e.length?new Pt({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function gl(i){return i&&i.fill!==!1}function Gf(i,t,e){let s=i[t].fill,o=[t],a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!Q(s))return s;if(a=i[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function Xf(i,t,e){let n=Zf(i);if(F(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return Q(s)&&Math.floor(s)===s?Kf(n[0],t,s,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function Kf(i,t,e,n){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function qf(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:F(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Jf(i,t,e){let n;return i==="start"?n=e:i==="end"?n=t.options.reverse?t.min:t.max:F(i)?n=i.value:n=t.getBaseValue(),n}function Zf(i){let t=i.options,e=t.fill,n=O(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Qf(i){let{scale:t,index:e,line:n}=i,s=[],o=n.segments,a=n.points,r=tp(t,e);r.push(oc({x:null,y:t.bottom},n));for(let l=0;l<o.length;l++){let c=o[l];for(let d=c.start;d<=c.end;d++)ep(s,a[d],r)}return new Pt({points:s,options:{}})}function tp(i,t){let e=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){let o=n[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function ep(i,t,e){let n=[];for(let s=0;s<e.length;s++){let o=e[s],{first:a,last:r,point:l}=ip(o,t,"x");if(!(!l||a&&r)){if(a)n.unshift(l);else if(i.push(l),!r)break}}i.push(...n)}function ip(i,t,e){let n=i.interpolate(t,e);if(!n)return{};let s=n[e],o=i.segments,a=i.points,r=!1,l=!1;for(let c=0;c<o.length;c++){let d=o[c],h=a[d.start][e],u=a[d.end][e];if($t(s,h,u)){r=s===h,l=s===u;break}}return{first:r,last:l,point:n}}function np(i){let{chart:t,fill:e,line:n}=i;if(Q(e))return sp(t,e);if(e==="stack")return Qf(i);if(e==="shape")return!0;let s=op(i);return s instanceof $n?s:oc(s,n)}function sp(i,t){let e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function op(i){return(i.scale||{}).getPointPositionForValue?rp(i):ap(i)}function ap(i){let{scale:t={},fill:e}=i,n=qf(e,t);if(Q(n)){let s=t.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function rp(i){let{scale:t,fill:e}=i,n=t.options,s=t.getLabels().length,o=n.reverse?t.max:t.min,a=Jf(e,t,o),r=[];if(n.grid.circular){let l=t.getPointPositionForValue(0,o);return new $n({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function ko(i,t,e){let n=np(t),{chart:s,index:o,line:a,scale:r,axis:l}=t,c=a.options,d=c.fill,h=c.backgroundColor,{above:u=h,below:f=h}=d||{},p=s.getDatasetMeta(o),m=fo(s,p);n&&a.points.length&&(Mi(i,e),lp(i,{line:a,target:n,above:u,below:f,area:e,scale:r,axis:l,clip:m}),Si(i))}function lp(i,t){let{line:e,target:n,above:s,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;i.save();let d=o;o!==s&&(c==="x"?(bl(i,n,a.top),wo(i,{line:e,target:n,color:s,scale:r,property:c,clip:l}),i.restore(),i.save(),bl(i,n,a.bottom)):c==="y"&&(xl(i,n,a.left),wo(i,{line:e,target:n,color:o,scale:r,property:c,clip:l}),i.restore(),i.save(),xl(i,n,a.right),d=s)),wo(i,{line:e,target:n,color:d,scale:r,property:c,clip:l}),i.restore()}function bl(i,t,e){let{segments:n,points:s}=t,o=!0,a=!1;i.beginPath();for(let r of n){let{start:l,end:c}=r,d=s[l],h=s[Wn(l,c,s)];o?(i.moveTo(d.x,d.y),o=!1):(i.lineTo(d.x,e),i.lineTo(d.x,d.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(h.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function xl(i,t,e){let{segments:n,points:s}=t,o=!0,a=!1;i.beginPath();for(let r of n){let{start:l,end:c}=r,d=s[l],h=s[Wn(l,c,s)];o?(i.moveTo(d.x,d.y),o=!1):(i.lineTo(e,d.y),i.lineTo(d.x,d.y)),a=!!t.pathSegment(i,r,{move:a}),a?i.closePath():i.lineTo(e,h.y)}i.lineTo(e,t.first().y),i.closePath(),i.clip()}function wo(i,t){let{line:e,target:n,property:s,color:o,scale:a,clip:r}=t,l=Uf(e,n,s);for(let{source:c,target:d,start:h,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,p=n!==!0;i.save(),i.fillStyle=f,cp(i,a,r,p&&Ro(s,h,u)),i.beginPath();let m=!!e.pathSegment(i,c),g;if(p){m?i.closePath():_l(i,n,u,s);let x=!!n.pathSegment(i,d,{move:m,reverse:!0});g=m&&x,g||_l(i,n,h,s)}i.closePath(),i.fill(g?"evenodd":"nonzero"),i.restore()}}function cp(i,t,e,n){let s=t.chart.chartArea,{property:o,start:a,end:r}=n||{};if(o==="x"||o==="y"){let l,c,d,h;o==="x"?(l=a,c=s.top,d=r,h=s.bottom):(l=s.left,c=a,d=s.right,h=r),i.beginPath(),e&&(l=Math.max(l,e.left),d=Math.min(d,e.right),c=Math.max(c,e.top),h=Math.min(h,e.bottom)),i.rect(l,c,d-l,h-c),i.clip()}}function _l(i,t,e,n){let s=t.interpolate(e,n);s&&i.lineTo(s.x,s.y)}function hp(i,t,e,n,s){let o=up(n,i,t,e),a=fp(s,n,t.lineHeight);return{itemWidth:o,itemHeight:a}}function up(i,t,e,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+n.measureText(s).width}function fp(i,t,e){let n=i;return typeof t.text!="string"&&(n=rc(t,e)),n}function rc(i,t){let e=i.text?i.text.length:0;return t*e}function pp(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}function mp(i,t){let e=new Fi({ctx:i.ctx,options:t,chart:i});ft.configure(i,e,t),ft.addBox(i,e),i.titleBlock=e}function Vt(i,t){return t&&(U(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function ie(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
2
2
  `)>-1?i.split(`
3
- `):i}function gp(i,t){let{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:i,label:a,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function vl(i,t){let e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=st(t.bodyFont),c=st(t.titleFont),d=st(t.footerFont),h=o.length,u=s.length,f=n.length,p=ut(t.padding),m=p.height,g=0,x=n.reduce((y,v)=>y+v.before.length+v.lines.length+v.after.length,0);if(x+=i.beforeBody.length+i.afterBody.length,h&&(m+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;m+=f*y+(x-f)*l.lineHeight+(x-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let _=0,C=function(y){g=Math.max(g,e.measureText(y).width+_)};return e.save(),e.font=c.string,$(i.title,C),e.font=l.string,$(i.beforeBody.concat(i.afterBody),C),_=t.displayColors?a+2+t.boxPadding:0,$(n,y=>{$(y.before,C),$(y.lines,C),$(y.after,C)}),_=0,e.font=d.string,$(i.footer,C),e.restore(),g+=p.width,{width:g,height:m}}function bp(i,t){let{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function xp(i,t,e,n){let{x:s,width:o}=n,a=e.caretSize+e.caretPadding;if(i==="left"&&s+o+a>t.width||i==="right"&&s-o-a<0)return!0}function _p(i,t,e,n){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i,c="center";return n==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),xp(c,i,t,e)&&(c="center"),c}function Cl(i,t,e){let n=e.yAlign||t.yAlign||bp(i,e);return{xAlign:e.xAlign||t.xAlign||_p(i,t,e,n),yAlign:n}}function yp(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function vp(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function kl(i,t,e,n){let{caretSize:s,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=ue(a),p=yp(t,r),m=vp(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(d,u)+s:r==="right"&&(p+=Math.max(h,f)+s),{x:at(p,0,n.width-t.width),y:at(m,0,n.height-t.height)}}function Pn(i,t,e){let n=ut(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function wl(i){return Vt([],ie(i))}function Cp(i,t,e){return ee(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ml(i,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}function vt(i,t,e,n){let s=i[t].call(e,n);return typeof s>"u"?hc[t].call(e,n):s}function wp(i,t,e,n){let s=i.indexOf(t);if(s===-1)return kp(i,t,e,n);let o=i.lastIndexOf(t);return s!==o?e:s}function Sl(i){let t=this.getLabels();return i>=0&&i<t.length?t[i]:i}function Sp(i,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=i,f=o||1,p=d-1,{min:m,max:g}=t,x=!N(a),_=!N(r),C=!N(c),y=(g-m)/(h+1),v=$s((g-m)/p/f)*f,w,S,E,L;if(v<1e-14&&!x&&!_)return[{value:m},{value:g}];L=Math.ceil(g/v)-Math.floor(m/v),L>p&&(v=$s(L*v/p/f)*f),N(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),s==="ticks"?(S=Math.floor(m/v)*v,E=Math.ceil(g/v)*v):(S=m,E=g),x&&_&&o&&ur((r-a)/o,v/1e3)?(L=Math.round(Math.min((r-a)/v,d)),v=(r-a)/L,S=a,E=r):C?(S=x?a:S,E=_?r:E,L=c-1,v=(E-S)/L):(L=(E-S)/v,qe(L,Math.round(L),v/1e3)?L=Math.round(L):L=Math.ceil(L));let R=Math.max(Ws(v),Ws(S));w=Math.pow(10,N(l)?R:l),S=Math.round(S*w)/w,E=Math.round(E*w)/w;let A=0;for(x&&(u&&S!==a?(e.push({value:a}),S<a&&A++,qe(Math.round((S+A*v)*w)/w,a,El(a,y,i))&&A++):S<a&&A++);A<L;++A){let I=Math.round((S+A*v)*w)/w;if(_&&I>r)break;e.push({value:I})}return _&&u&&E!==r?e.length&&qe(e[e.length-1].value,r,El(r,y,i))?e[e.length-1].value=r:e.push({value:r}):(!_||E===r)&&e.push({value:E}),e}function El(i,t,{horizontal:e,minRotation:n}){let s=At(n),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}function Tl(i){return i/Math.pow(10,zi(i))===1}function Al(i,t,e){let n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Ep(i,t){let e=t-i,n=zi(e);for(;Al(i,t,n)>10;)n++;for(;Al(i,t,n)<10;)n--;return Math.min(n,zi(i))}function Tp(i,{min:t,max:e}){t=yt(i.min,t);let n=[],s=zi(t),o=Ep(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,d=Math.floor((t-l)/r/10)*r*10,h=Math.floor((c-d)/Math.pow(10,o)),u=yt(i.min,Math.round((l+d+h*Math.pow(10,o))*a)/a);for(;u<e;)n.push({value:u,major:Tl(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,a=o>=0?1:a),u=Math.round((l+d+h*Math.pow(10,o))*a)/a;let f=yt(i.max,u);return n.push({value:f,major:Tl(f),significand:h}),n}function Io(i){let t=i.ticks;if(t.display&&i.display){let e=ut(t.backdropPadding);return O(t.font&&t.font.size,G.font.size)+e.height}return 0}function Ap(i,t,e){return e=U(e)?e:[e],{w:vr(i,t.string,e),h:e.length*t.lineHeight}}function Dl(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function Dp(i){let t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?z/o:0;for(let l=0;l<o;l++){let c=a.setContext(i.getPointLabelContext(l));s[l]=c.padding;let d=i.getPointPosition(l,i.drawingArea+s[l],r),h=st(c.font),u=Ap(i.ctx,h,i._pointLabels[l]);n[l]=u;let f=dt(i.getIndexAngle(l)+r),p=Math.round(xn(f)),m=Dl(p,d.x,u.w,0,180),g=Dl(p,d.y,u.h,90,270);Lp(e,t,f,m,g)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=Rp(i,n,s)}function Lp(i,t,e,n,s){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;n.start<t.l?(r=(t.l-n.start)/o,i.l=Math.min(i.l,t.l-r)):n.end>t.r&&(r=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function Pp(i,t,e){let n=i.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,n+s+a,o),c=Math.round(xn(dt(l.angle+tt))),d=Np(l.y,r.h,c),h=Ip(c),u=Bp(l.x,r.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:u,top:d,right:u+r.w,bottom:d+r.h}}function Op(i,t){if(!t)return!0;let{left:e,top:n,right:s,bottom:o}=i;return!(zt({x:e,y:n},t)||zt({x:e,y:o},t)||zt({x:s,y:n},t)||zt({x:s,y:o},t))}function Rp(i,t,e){let n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Io(o)/2,additionalAngle:a?z/s:0},c;for(let d=0;d<s;d++){l.padding=e[d],l.size=t[d];let h=Pp(i,d,l);n.push(h),r==="auto"&&(h.visible=Op(h,c),h.visible&&(c=h))}return n}function Ip(i){return i===0||i===180?"center":i<180?"left":"right"}function Bp(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Np(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Fp(i,t,e){let{left:n,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!N(r)){let l=ue(t.borderRadius),c=ut(t.backdropPadding);i.fillStyle=r;let d=n-c.left,h=s-c.top,u=o-n+c.width,f=a-s+c.height;Object.values(l).some(p=>p!==0)?(i.beginPath(),ti(i,{x:d,y:h,w:u,h:f,radius:l}),i.fill()):i.fillRect(d,h,u,f)}}function zp(i,t){let{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){let o=i._pointLabelItems[s];if(!o.visible)continue;let a=n.setContext(i.getPointLabelContext(s));Fp(e,a,o);let r=st(a.font),{x:l,y:c,textAlign:d}=o;he(e,i._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function pc(i,t,e,n){let{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,Y);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<n;a++)o=i.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Hp(i,t,e,n,s){let o=i.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!n||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),pc(i,e,a,n),o.closePath(),o.stroke(),o.restore())}function $p(i,t,e){return ee(i,{label:e,index:t,type:"pointLabel"})}function Ll(i,t){return i-t}function Pl(i,t){if(N(t))return null;let e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts,a=t;return typeof n=="function"&&(a=n(a)),Q(a)||(a=typeof n=="string"?e.parse(a,n):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Ee(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Ol(i,t,e,n){let s=kt.length;for(let o=kt.indexOf(i);o<s-1;++o){let a=jn[kt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=n)return kt[o]}return kt[s-1]}function Vp(i,t,e,n,s){for(let o=kt.length-1;o>=kt.indexOf(e);o--){let a=kt[o];if(jn[a].common&&i._adapter.diff(s,n,a)>=t-1)return a}return kt[e?kt.indexOf(e):0]}function Wp(i){for(let t=kt.indexOf(i)+1,e=kt.length;t<e;++t)if(jn[kt[t]].common)return kt[t]}function Rl(i,t,e){if(!e)i[t]=!0;else if(e.length){let{lo:n,hi:s}=_n(e,t),o=e[n]>=t?e[n]:e[s];i[o]=!0}}function jp(i,t,e,n){let s=i._adapter,o=+s.startOf(t[0].value,n),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,n))l=e[r],l>=0&&(t[l].major=!0);return t}function Il(i,t,e){let n=[],s={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,n.push({value:r,major:!1});return o===0||!e?n:jp(i,n,s,e)}function On(i,t,e){let n=0,s=i.length-1,o,a,r,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Ft(i,"pos",t)),{pos:o,time:r}=i[n],{pos:a,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Ft(i,"time",t)),{time:o,pos:r}=i[n],{time:a,pos:l}=i[s]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var Mo,Wt,Nr,Uh,Bn,Ii,go,Vr,iu,Ct,Le,Pe,Ut,Oe,ge,ni,Re,Ie,Fl,So,zl,Hl,$l,ft,Bi,Nn,Rn,Mu,qr,Wl,Ni,Jr,zn,wt,Vu,Zr,Qr,_e,si,Eo,Lt,To,sl,Xl,Li,Lo,cf,hf,uf,In,cl,jt,pe,Af,Pt,Be,Ne,Ql,Oo,ul,ic,sc,$n,ac,yl,dp,Vn,lc,Fi,cc,Ln,dc,Oi,hc,Ri,uc,fc,kp,Mp,oi,ci,ai,zi,De,ri,me,jn,kt,xe,li,mc,Up,bc=Bt(()=>{"use strict";Br();Mo=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(n-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Gs.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;let o=n.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let n=e.items,s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Wt=new Mo,Nr="transparent",Uh={boolean(i,t,e){return e>.5?t:i},color(i,t,e){let n=Zs(i||Nr),s=n.valid&&Zs(t||Nr);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}},Bn=class{constructor(t,e,n,s){let o=e[n];s=ei([t.to,s,o,t.from]);let a=ei([t.from,o,s]);this._active=!0,this._fn=t.fn||Uh[t.type||typeof a],this._easing=Ue[t.easing]||Ue.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);let s=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ei([t.to,e,s,t.from]),this._from=ei([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,n=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<n),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){let e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}},Ii=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!F(t))return;let e=Object.keys(G.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!F(o))return;let a={};for(let r of e)a[r]=o[r];(U(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!n.has(r))&&n.set(r,a)})})}_animateOptions(t,e){let n=e.options,s=Gh(t,n);if(!s)return[];let o=this._createAnimations(s,n);return n.$shared&&Yh(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){let n=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}let d=e[c],h=o[c],u=n.get(c);if(h)if(u&&h.active()){h.update(u,d,r);continue}else h.cancel();if(!u||!u.duration){t[c]=d;continue}o[c]=h=new Bn(u,t,c,d),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let n=this._createAnimations(t,e);if(n.length)return Wt.add(this._chart,n),!0}};go=i=>i==="reset"||i==="none",Vr=(i,t)=>t?i:Object.assign({},i),iu=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Bl(e,!0),values:null},Ct=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=po(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&&Ei(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(h,u,f,p)=>h==="x"?u:h==="r"?p:f,o=e.xAxisID=O(n.xAxisID,mo(t,"x")),a=e.yAxisID=O(n.yAxisID,mo(t,"y")),r=e.rAxisID=O(n.rAxisID,mo(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,a,r),d=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(d)}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 e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Us(this._data,this),t._stacked&&Ei(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(F(e)){let s=this._cachedMeta;this._data=qh(e,s)}else if(n!==e){if(n){Us(n,this);let s=this._cachedMeta;Ei(s),s._parsed=[]}e&&Object.isExtensible(e)&&br(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,n=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=po(e.vScale,e),e.stack!==n.stack&&(s=!0,Ei(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&($r(this,e._parsed),e._stacked=po(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:a}=n,r=o.axis,l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],d,h,u;if(this._parsing===!1)n._parsed=s,n._sorted=!0,u=s;else{U(s[t])?u=this.parseArrayData(n,s,t,e):F(s[t])?u=this.parseObjectData(n,s,t,e):u=this.parsePrimitiveData(n,s,t,e);let f=()=>h[r]===null||c&&h[r]<c[r];for(d=0;d<e;++d)n._parsed[d+t]=h=u[d],l&&(f()&&(l=!1),c=h);n._sorted=l}a&&$r(this,u)}parsePrimitiveData(t,e,n,s){let{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),d=o===a,h=new Array(s),u,f,p;for(u=0,f=s;u<f;++u)p=u+n,h[u]={[r]:d||o.parse(c[p],p),[l]:a.parse(e[p],p)};return h}parseArrayData(t,e,n,s){let{xScale:o,yScale:a}=t,r=new Array(s),l,c,d,h;for(l=0,c=s;l<c;++l)d=l+n,h=e[d],r[l]={x:o.parse(h[0],d),y:a.parse(h[1],d)};return r}parseObjectData(t,e,n,s){let{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),d,h,u,f;for(d=0,h=s;d<h;++d)u=d+n,f=e[u],c[d]={x:o.parse(te(f,r),u),y:a.parse(te(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){let s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:Bl(s,!0),values:e._stacks[t.axis]._visualValues};return zr(r,a,o.index,{mode:n})}updateRangeFromParsed(t,e,n,s){let o=n[e.axis],a=o===null?NaN:o,r=s&&n._stacks[e.axis];s&&r&&(s.values=r,a=zr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,a=s.length,r=this._getOtherScale(t),l=iu(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=Zh(r),u,f;function p(){f=s[u];let m=f[r.axis];return!Q(f[t.axis])||d>m||h<m}for(u=0;u<a&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,n=[],s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],Q(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,n=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=Kh(O(this.options.clip,Xh(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,o,r,l),d=r;d<r+l;++d){let h=s[d];h.hidden||(h.active&&c?a.push(h):h.draw(t,o))}for(d=0;d<a.length;++d)a[d].draw(t,o)}getStyle(t,e){let n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=eu(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=tu(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){let s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Ke(n);if(r)return Vr(r,l);let c=this.chart.config,d=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),d),f=Object.keys(G.elements[t]),p=()=>this.getContext(n,s,e),m=c.resolveNamedOptions(u,f,p,h);return m.$shared&&(m.$shared=l,o[a]=Object.freeze(Vr(m,l))),m}_resolveAnimations(t,e,n){let s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){let d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,e),u=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(u,this.getContext(t,n,e))}let c=new Ii(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||go(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:a}}updateElement(t,e,n,s){go(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!go(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"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 e=this._data,n=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let s=n.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,n=!0){let s=this._cachedMeta,o=s.data,a=t+e,r,l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(o,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){let n=this._cachedMeta;if(this._parsing){let s=n._parsed.splice(t,e);n._stacked&&Ei(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,n,s]=t;this[e](n,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,e){e&&this._sync(["_removeElements",t,e]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};M(Ct,"defaults",{}),M(Ct,"datasetElementType",null),M(Ct,"dataElementType",null);Le=class extends Ct{parsePrimitiveData(t,e,n,s){return Wr(t,e,n,s)}parseArrayData(t,e,n,s){return Wr(t,e,n,s)}parseObjectData(t,e,n,s){let{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,d=a.axis==="x"?r:l,h=[],u,f,p,m;for(u=n,f=n+s;u<f;++u)m=e[u],p={},p[o.axis]=o.parse(te(m,c),u),h.push(Nl(te(m,d),p,a,u));return h}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);let o=n._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:n,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=bo(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){let o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),d=this._getRuler(),{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s);for(let f=e;f<e+n;f++){let p=this.getParsed(f),m=o||N(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,d),x=(p._stacks||{})[r.axis],_={horizontal:c,base:m.base,enableBorderRadius:!x||bo(p._custom)||a===x._top||a===x._bottom,x:c?m.head:g.center,y:c?g.center:m.head,height:c?g.size:Math.abs(m.size),width:c?Math.abs(m.size):g.size};u&&(_.options=h||this.resolveDataElementOptions(f,t[f].active?"active":s));let C=_.options||t[f].options;du(_,C,x,a),uu(_,C,d.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,e){let{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=n.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[n.axis],c=d=>{let h=d._parsed.find(f=>f[n.axis]===l),u=h&&h[d.vScale.axis];if(N(u)||isNaN(u))return!0};for(let d of s)if(!(e!==void 0&&c(d))&&((o===!1||a.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[O(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,n){let s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,n=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o<a;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));let r=t.barThickness;return{min:r||su(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,d=bo(c),h=l[e.axis],u=0,f=n?this.applyStack(e,l,n):h,p,m;f!==h&&(u=f-h,f=h),d&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&Dt(h)!==Dt(c.barEnd)&&(u=0),u+=h);let g=!N(o)&&!d?o:u,x=e.getPixelForValue(g);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(u+f):p=x,m=p-x,Math.abs(m)<a){m=lu(m,e,r)*a,h===r&&(x-=m/2);let _=e.getPixelForDecimal(0),C=e.getPixelForDecimal(1),y=Math.min(_,C),v=Math.max(_,C);x=Math.max(Math.min(x,v),y),p=x+m,n&&!d&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){let _=Dt(m)*e.getLineWidthForValue(r)/2;x+=_,m-=_}return{size:m,base:x,head:p,center:p+m/2}}_calculateBarIndexPixels(t,e){let n=e.scale,s=this.options,o=s.skipNull,a=O(s.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let d=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?au(t,e,s,d*c):ou(t,e,s,d*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(O(u,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=h.start+h.chunk*p+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length,o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!n[o].hidden&&n[o].draw(this._ctx)}};M(Le,"id","bar"),M(Le,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),M(Le,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});Pe=class extends Ct{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,n,s){let o=super.parsePrimitiveData(t,e,n,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+n).radius;return o}parseArrayData(t,e,n,s){let o=super.parseArrayData(t,e,n,s);for(let a=0;a<o.length;a++){let r=e[n+a];o[a]._custom=O(r[2],this.resolveDataElementOptions(a+n).radius)}return o}parseObjectData(t,e,n,s){let o=super.parseObjectData(t,e,n,s);for(let a=0;a<o.length;a++){let r=e[n+a];o[a]._custom=O(r&&r.r&&+r.r,this.resolveDataElementOptions(a+n).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:n[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),d=a.axis,h=r.axis;for(let u=e;u<e+n;u++){let f=t[u],p=!o&&this.getParsed(u),m={},g=m[d]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[d]),x=m[h]=o?r.getBasePixel():r.getPixelForValue(p[h]);m.skip=isNaN(g)||isNaN(x),c&&(m.options=l||this.resolveDataElementOptions(u,f.active?"active":s),o&&(m.options.radius=0)),this.updateElement(f,u,m,s)}}resolveDataElementOptions(t,e){let n=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=O(n&&n._custom,o),s}};M(Pe,"id","bubble"),M(Pe,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),M(Pe,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});Ut=class extends Ct{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(F(n[t])){let{key:l="value"}=this._parsing;o=c=>+te(n[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return At(this.options.rotation-90)}_getCircumference(){return At(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let s=this.chart.getDatasetMeta(n).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:n}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(lr(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:p,offsetY:m}=fu(h,d,l),g=(n.width-a)/u,x=(n.height-a)/f,_=Math.max(Math.min(g,x)/2,0),C=zs(this.options.radius,_),y=Math.max(C*l,0),v=(C-y)/this._getVisibleDatasetWeightTotal();this.offsetX=p*C,this.offsetY=m*C,s.total=this.calculateTotal(),this.outerRadius=C-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){let n=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/Y)}updateElements(t,e,n,s){let o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,d=(r.left+r.right)/2,h=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:m,includeOptions:g}=this._getSharedOptions(e,s),x=this._getRotation(),_;for(_=0;_<e;++_)x+=this._circumference(_,o);for(_=e;_<e+n;++_){let C=this._circumference(_,o),y=t[_],v={x:d+this.offsetX,y:h+this.offsetY,startAngle:x,endAngle:x+C,circumference:C,outerRadius:p,innerRadius:f};g&&(v.options=m||this.resolveDataElementOptions(_,y.active?"active":s)),x+=C,this.updateElement(y,_,v,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,n=0,s;for(s=0;s<e.length;s++){let o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ze(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,n=this.chart,s,o,a,r,l;if(!t){for(s=0,o=n.data.datasets.length;s<o;++s)if(n.isDatasetVisible(s)){a=n.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){let o=this.resolveDataElementOptions(n);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(O(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};M(Ut,"id","doughnut"),M(Ut,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),M(Ut,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),M(Ut,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:n,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});Oe=class extends Ct{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Ks(e,s,a);this._drawStart=r,this._drawCount=l,qs(e)&&(r=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,s),u=a.axis,f=r.axis,{spanGaps:p,segment:m}=this.options,g=Ee(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",_=e+n,C=t.length,y=e>0&&this.getParsed(e-1);for(let v=0;v<C;++v){let w=t[v],S=x?w:{};if(v<e||v>=_){S.skip=!0;continue}let E=this.getParsed(v),L=N(E[f]),R=S[u]=a.getPixelForValue(E[u],v),A=S[f]=o||L?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,E,l):E[f],v);S.skip=isNaN(R)||isNaN(A)||L,S.stop=v>0&&Math.abs(E[u]-y[u])>g,m&&(S.parsed=E,S.raw=c.data[v]),h&&(S.options=d||this.resolveDataElementOptions(v,w.active?"active":s)),x||this.updateElement(w,v,S,s),y=E}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};M(Oe,"id","line"),M(Oe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),M(Oe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});ge=class extends Ct{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ze(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return oo.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{let o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,n,s){let o=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,h=c.yCenter,u=c.getIndexAngle(0)-.5*z,f=u,p,m=360/this.countVisibleElements();for(p=0;p<e;++p)f+=this._computeAngle(p,s,m);for(p=e;p<e+n;p++){let g=t[p],x=f,_=f+this._computeAngle(p,s,m),C=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=_,o&&(l.animateScale&&(C=0),l.animateRotate&&(x=_=u));let y={x:d,y:h,innerRadius:0,outerRadius:C,startAngle:x,endAngle:_,options:this.resolveDataElementOptions(p,g.active?"active":s)};this.updateElement(g,p,y,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((n,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?At(this.resolveDataElementOptions(t,e).angle||n):0}};M(ge,"id","polarArea"),M(ge,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),M(ge,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});ni=class extends Ut{};M(ni,"id","pie"),M(ni,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Re=class extends Ct{getLabelAndValue(t){let e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return oo.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(n,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+n;r++){let l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),d=o.getPointPositionForValue(r,this.getParsed(r).r),h=a?o.xCenter:d.x,u=a?o.yCenter:d.y,f={x:h,y:u,angle:d.angle,skip:isNaN(h)||isNaN(u),options:c};this.updateElement(l,r,f,s)}}};M(Re,"id","radar"),M(Re,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),M(Re,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});Ie=class extends Ct{getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:n[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:n=[]}=e,s=this.chart._animationsDisabled,{start:o,count:a}=Ks(e,n,s);if(this._drawStart=o,this._drawCount=a,qs(e)&&(o=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=n;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(n,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,d=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(d),u=this.includeOptions(s,h),f=a.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,x=Ee(m)?m:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",C=e>0&&this.getParsed(e-1);for(let y=e;y<e+n;++y){let v=t[y],w=this.getParsed(y),S=_?v:{},E=N(w[p]),L=S[f]=a.getPixelForValue(w[f],y),R=S[p]=o||E?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[p],y);S.skip=isNaN(L)||isNaN(R)||E,S.stop=y>0&&Math.abs(w[f]-C[f])>x,g&&(S.parsed=w,S.raw=c.data[y]),u&&(S.options=h||this.resolveDataElementOptions(y,v.active?"active":s)),_||this.updateElement(v,y,S,s),C=w}this.updateSharedOptions(h,s,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,a)/2}};M(Ie,"id","scatter"),M(Ie,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),M(Ie,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});Fl=Object.freeze({__proto__:null,BarController:Le,BubbleController:Pe,DoughnutController:Ut,LineController:Oe,PieController:ni,PolarAreaController:ge,RadarController:Re,ScatterController:Ie});So=class i{constructor(t){M(this,"options");this.options=t||{}}static override(t){Object.assign(i.prototype,t)}init(){}formats(){return Ae()}parse(){return Ae()}format(){return Ae()}add(){return Ae()}diff(){return Ae()}startOf(){return Ae()}endOf(){return Ae()}},zl={_date:So};Hl={evaluateInteractionItems:Hi,modes:{index(i,t,e,n){let s=fe(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?xo(i,s,o,n,a):_o(i,s,o,!1,n,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{let d=r[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?xo(i,s,o,n,a):_o(i,s,o,!1,n,a);if(r.length>0){let l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let d=0;d<c.length;++d)r.push({element:c[d],datasetIndex:l,index:d})}return r},point(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return xo(i,s,o,n,a)},nearest(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return _o(i,s,o,e.intersect,n,a)},x(i,t,e,n){let s=fe(t,i);return Yr(i,s,"x",e.intersect,n)},y(i,t,e,n){let s=fe(t,i);return Yr(i,s,"y",e.intersect,n)}}},$l=["left","top","right","bottom"];ft={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){let e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;let s=ut(i.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=vu(i.boxes),l=r.vertical,c=r.horizontal;$(i.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});let d=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/d,hBoxMaxHeight:a/2}),u=Object.assign({},s);Vl(u,ut(n));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),p=yu(l.concat(c),h);Pi(r.fullSize,f,h,p),Pi(l,f,h,p),Pi(c,f,h,p)&&Pi(l,f,h,p),ku(f),Kr(r.leftAndTop,f,h,p),f.x+=f.w,f.y+=f.h,Kr(r.rightAndBottom,f,h,p),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(r.chartArea,m=>{let g=m.box;Object.assign(g,i.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Bi=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},Nn=class extends Bi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Rn="$chartjs",Mu={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qr=i=>i===null||i==="";Wl=Lr?{passive:!0}:!1;Ni=new Map,Jr=0;zn=class extends Bi{acquireContext(t,e){let n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Su(t,e),n):null}releaseContext(t){let e=t.canvas;if(!e[Rn])return!1;let n=e[Rn].initial;["height","width"].forEach(o=>{let a=n[o];N(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Rn],!0}addEventListener(t,e,n){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:Du,detach:Lu,resize:Ru}[e]||Iu;s[e]=a(t,e,n)}removeEventListener(t,e){let n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:yo,detach:yo,resize:yo}[e]||Tu)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return Dr(t,e,n,s)}isAttached(t){let e=t&&Sn(t);return!!(e&&e.isConnected)}};wt=class{constructor(){M(this,"x");M(this,"y");M(this,"active",!1);M(this,"options");M(this,"$animations")}tooltipPosition(t){let{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return Ee(this.x)&&Ee(this.y)}getProps(t,e){let n=this.$animations;if(!e||!n)return this;let s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}};M(wt,"defaults",{}),M(wt,"defaultRoutes");Vu=i=>i==="left"?"right":i==="right"?"left":i,Zr=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Qr=(i,t)=>Math.min(t||i,i);_e=class i extends wt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=yt(t,Number.POSITIVE_INFINITY),e=yt(e,Number.NEGATIVE_INFINITY),n=yt(n,Number.POSITIVE_INFINITY),s=yt(s,Number.NEGATIVE_INFINITY),{min:yt(t,n),max:yt(e,s),minDefined:Q(t),maxDefined:Q(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:n};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(n=Math.max(n,a.max));return e=o&&e>n?n:e,n=s&&e>n?e:n,{min:yt(e,yt(n,e)),max:yt(n,yt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let 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(){W(this.options.beforeUpdate,[this])}update(t,e,n){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=wr(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?tl(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Bu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){W(this.options.afterUpdate,[this])}beforeSetDimensions(){W(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(){W(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),W(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){W(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=W(e.callback,[o.value,n,t],this)}afterTickToLabelConversion(){W(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){W(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,n=Qr(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation,a=s,r,l,c;if(!this._isVisible()||!e.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}let d=this._getLabelSizes(),h=d.widest.width,u=d.highest.height,f=at(this.chart.width-h,0,this.maxWidth);r=t.offset?this.maxWidth/n:f/(n-1),h+6>r&&(r=f/(n-(t.offset?.5:1)),l=this.maxHeight-Di(t.grid)-e.padding-el(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),a=xn(Math.min(Math.asin(at((d.highest.height+6)/r,-1,1)),Math.asin(at(l/c,-1,1))-Math.asin(at(u/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){W(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){W(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=el(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Di(o)+l):(t.height=this.maxHeight,t.width=Di(o)+l),n.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=n.padding*2,p=At(this.labelRotation),m=Math.cos(p),g=Math.sin(p);if(r){let x=n.mirror?0:g*h.width+m*u.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{let x=n.mirror?0:m*h.width+g*u.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(c,d,g,m)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=s*t.width,f=n*e.height):(u=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-d+a)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+a)*this.width/(this.width-h),0)}else{let d=e.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=e.height,h=0),this.paddingTop=d+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){W(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)N(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,n=this.ticks;e<n.length&&(n=tl(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){let{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Qr(e,n)),c=0,d=0,h,u,f,p,m,g,x,_,C,y,v;for(h=0;h<e;h+=l){if(p=t[h].label,m=this._resolveTickFontOptions(h),s.font=g=m.string,x=o[g]=o[g]||{data:{},gc:[]},_=m.lineHeight,C=y=0,!N(p)&&!U(p))C=ki(s,x.data,x.gc,C,p),y=_;else if(U(p))for(u=0,f=p.length;u<f;++u)v=p[u],!N(v)&&!U(v)&&(C=ki(s,x.data,x.gc,C,v),y+=_);a.push(C),r.push(y),c=Math.max(C,c),d=Math.max(y,d)}ju(o,e);let w=a.indexOf(c),S=r.indexOf(d),E=L=>({width:a[L]||0,height:r[L]||0});return{first:E(0),last:E(e-1),widest:E(w),highest:E(S),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return fr(this._alignToPixels?de(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let n=e[t];return n.$context||(n.$context=Yu(this.getContext(),t,n))}return this.$context||(this.$context=Uu(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=At(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*s?r/n:l/s:l*s<r*n?l/n:r/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,n=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),u=Di(o),f=[],p=r.setContext(this.getContext()),m=p.display?p.width:0,g=m/2,x=function(j){return de(n,j,m)},_,C,y,v,w,S,E,L,R,A,I,et;if(a==="top")_=x(this.bottom),S=this.bottom-u,L=_-g,A=x(t.top)+g,et=t.bottom;else if(a==="bottom")_=x(this.top),A=t.top,et=x(t.bottom)-g,S=_+g,L=this.top+u;else if(a==="left")_=x(this.right),w=this.right-u,E=_-g,R=x(t.left)+g,I=t.right;else if(a==="right")_=x(this.left),R=t.left,I=x(t.right)-g,w=_+g,E=this.left+u;else if(e==="x"){if(a==="center")_=x((t.top+t.bottom)/2+.5);else if(F(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}A=t.top,et=t.bottom,S=_+g,L=S+u}else if(e==="y"){if(a==="center")_=x((t.left+t.right)/2);else if(F(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}w=_-g,E=w-u,R=t.left,I=t.right}let lt=O(s.ticks.maxTicksLimit,h),H=Math.max(1,Math.ceil(h/lt));for(C=0;C<h;C+=H){let j=this.getContext(C),K=o.setContext(j),xt=r.setContext(j),rt=K.lineWidth,Yt=K.color,q=xt.dash||[],Gt=xt.dashOffset,J=K.tickWidth,Ot=K.tickColor,V=K.tickBorderDash||[],Mt=K.tickBorderDashOffset;y=Wu(this,C,l),y!==void 0&&(v=de(n,y,rt),c?w=E=R=I=v:S=L=A=et=v,f.push({tx1:w,ty1:S,tx2:E,ty2:L,x1:R,y1:A,x2:I,y2:et,width:rt,color:Yt,borderDash:q,borderDashOffset:Gt,tickWidth:J,tickColor:Ot,tickBorderDash:V,tickBorderDashOffset:Mt}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){let e=this.axis,n=this.options,{position:s,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=Di(n.grid),f=u+d,p=h?-d:f,m=-At(this.labelRotation),g=[],x,_,C,y,v,w,S,E,L,R,A,I,et="middle";if(s==="top")w=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){let H=this._getYAxisLabelAlignment(u);S=H.textAlign,v=H.x}else if(s==="right"){let H=this._getYAxisLabelAlignment(u);S=H.textAlign,v=H.x}else if(e==="x"){if(s==="center")w=(t.top+t.bottom)/2+f;else if(F(s)){let H=Object.keys(s)[0],j=s[H];w=this.chart.scales[H].getPixelForValue(j)+f}S=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(F(s)){let H=Object.keys(s)[0],j=s[H];v=this.chart.scales[H].getPixelForValue(j)}S=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?et="top":l==="end"&&(et="bottom"));let lt=this._getLabelSizes();for(x=0,_=r.length;x<_;++x){C=r[x],y=C.label;let H=o.setContext(this.getContext(x));E=this.getPixelForTick(x)+o.labelOffset,L=this._resolveTickFontOptions(x),R=L.lineHeight,A=U(y)?y.length:1;let j=A/2,K=H.color,xt=H.textStrokeColor,rt=H.textStrokeWidth,Yt=S;a?(v=E,S==="inner"&&(x===_-1?Yt=this.options.reverse?"left":"right":x===0?Yt=this.options.reverse?"right":"left":Yt="center"),s==="top"?c==="near"||m!==0?I=-A*R+R/2:c==="center"?I=-lt.highest.height/2-j*R+R:I=-lt.highest.height+R/2:c==="near"||m!==0?I=R/2:c==="center"?I=lt.highest.height/2-j*R:I=lt.highest.height-A*R,h&&(I*=-1),m!==0&&!H.showLabelBackdrop&&(v+=R/2*Math.sin(m))):(w=E,I=(1-A)*R/2);let q;if(H.showLabelBackdrop){let Gt=ut(H.backdropPadding),J=lt.heights[x],Ot=lt.widths[x],V=I-Gt.top,Mt=0-Gt.left;switch(et){case"middle":V-=J/2;break;case"bottom":V-=J;break}switch(S){case"center":Mt-=Ot/2;break;case"right":Mt-=Ot;break;case"inner":x===_-1?Mt-=Ot:x>0&&(Mt-=Ot/2);break}q={left:Mt,top:V,width:Ot+Gt.width,height:J+Gt.height,color:H.backdropColor}}g.push({label:y,font:L,textOffset:I,options:{rotation:m,color:K,strokeColor:xt,strokeWidth:rt,textAlign:Yt,textBaseline:et,translation:[v,w],backdrop:q}})}return g}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-At(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,d;return e==="left"?s?(d=this.right+o,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?s?(d=this.left+o,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,d)=>{!d.width||!d.color||(n.save(),n.lineWidth=d.width,n.strokeStyle=d.color,n.setLineDash(d.borderDash||[]),n.lineDashOffset=d.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){let l=s[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;let r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,d,h,u;this.isHorizontal()?(c=de(t,this.left,a)-a/2,d=de(t,this.right,r)+r/2,h=u=l):(h=de(t,this.top,a)-a/2,u=de(t,this.bottom,r)+r/2,c=d=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,h),e.lineTo(d,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let n=this.ctx,s=this._computeLabelArea();s&&Mi(n,s);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,d=a.textOffset;he(n,c,0,d,l,r)}s&&Si(n)}drawTitle(){let{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;let o=st(n.font),a=ut(n.padding),r=n.align,l=o.lineHeight/2;e==="bottom"||e==="center"||F(e)?(l+=a.bottom,U(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=Xu(this,l,e,r);he(t,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:u,textAlign:Gu(r,e,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,n=O(t.grid&&t.grid.z,-1),s=O(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==i.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[n]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return st(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},si=class{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),n;Ju(e)&&(n=this.register(e));let s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Ku(t,a,n),this.override&&G.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in G[s]&&(delete G[s][n],this.override&&delete ce[n])}};Eo=class{constructor(){this.controllers=new si(Ct,"datasets",!0),this.elements=new si(wt,"elements"),this.plugins=new si(Object,"plugins"),this.scales=new si(_e,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{let o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):$(s,a=>{let r=n||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,n){let s=bn(t);W(n["before"+s],[],n),e[t](n),W(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}},Lt=new Eo,To=class{constructor(){this._init=void 0}notify(t,e,n,s){if(e==="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),a=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,n,s){s=s||{};for(let o of t){let a=o.plugin,r=a[n],l=[e,s,o.options];if(W(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){N(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let n=t&&t.config,s=O(n.options&&n.options.plugins,{}),o=Zu(n);return s===!1&&!e?[]:tf(t,o,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],n=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};sl=new Map,Xl=new Set;Li=(i,t,e)=>{let n=te(t,e);n!==void 0&&i.add(n)},Lo=class{constructor(t){this._config=lf(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=Gl(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(),Yl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Dn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Dn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Dn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,n=this.type;return Dn(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let n=this._scopeCache,s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){let{options:s,type:o}=this,a=this._cachedScopes(t,n),r=a.get(e);if(r)return r;let l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(h=>Li(l,t,h))),d.forEach(h=>Li(l,s,h)),d.forEach(h=>Li(l,ce[o]||{},h)),d.forEach(h=>Li(l,G,h)),d.forEach(h=>Li(l,vn,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xl.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,ce[e]||{},G.datasets[e]||{},{type:e},G,vn]}resolveNamedOptions(t,e,n,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=ol(this._resolverCache,t,s),l=a;if(df(a,e)){o.$shared=!1,n=Zt(n)?n():n;let c=this.createResolver(t,n,r);l=Se(a,n,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){let{resolver:o}=ol(this._resolverCache,t,n);return F(e)?Se(o,e,void 0,s):o}};cf=i=>F(i)&&Object.getOwnPropertyNames(i).some(t=>Zt(i[t]));hf="4.5.1",uf=["top","bottom","left","right","chartArea"];In={},cl=i=>{let t=Kl(i);return Object.values(In).filter(e=>e.canvas===t).pop()};jt=class{static register(...t){Lt.add(...t),dl()}static unregister(...t){Lt.remove(...t),dl()}constructor(t,e){let n=this.config=new Lo(e),s=Kl(t),o=cl(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Ul(s)),this.platform.updateConfig(n);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=rr(),this.ctx=r,this.canvas=l,this.width=d,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new To,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xr(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],In[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Wt.listen(this,"complete",ll),Wt.listen(this,"progress",ff),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return N(t)?e&&o?o:s?n/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 Lt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ao(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Qs(this.canvas,this.ctx),this}stop(){return Wt.stop(this),this}resize(t,e){Wt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,ao(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),W(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};$(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Do(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),$(o,a=>{let r=a.options,l=r.id,c=Do(l,r),d=O(r.type,a.dtype);(r.position===void 0||al(r.position,c)!==al(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in n&&n[l].type===d)h=n[l];else{let u=Lt.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(r,t)}),$(s,(a,r)=>{a||delete n[r]}),$(n,a=>{ft.configure(this,a,a.options),ft.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(rl("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){let o=e[n],a=this.getDatasetMeta(n),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||Ao(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{let l=Lt.getController(r),{datasetElementType:c,dataElementType:d}=G.datasets[r];Object.assign(l,{dataElementType:Lt.getElement(d),datasetElementType:c&&Lt.getElement(c)}),a.controller=new l(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){$(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,d=this.data.datasets.length;c<d;c++){let{controller:h}=this.getDatasetMeta(c),u=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(u),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),s||$(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(rl("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){$(this.scales,t=>{ft.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Hs(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:n,start:s,count:o}of e){let a=n==="_removeElements"?-o:o;pf(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,n=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=n(0);for(let o=1;o<e;o++)if(!Hs(s,n(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;ft.update(this,this.width,this.height,t);let e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],$(this.boxes,s=>{n&&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 e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,Zt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),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(),ll({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,n=[],s,o;for(s=0,o=e.length;s<o;++s){let a=e[s];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,n={meta:t,index:t.index,cancelable:!0},s=fo(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(s&&Mi(e,s),t.controller.draw(),s&&Si(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return zt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){let o=Hl.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],n=this._metasets,s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=ee(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){let n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){let s=n?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Ke(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Wt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Qs(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete In[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,e=this.platform,n=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};$(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){$(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},$(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){let s=n?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],n=t.map(({datasetIndex:o,index:a})=>{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!wi(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){let s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),a=o(e,t),r=n?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;let o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,n,a),l=dr(t),c=mf(t,this._lastEvent,n,l);n&&(this._lastEvent=null,W(o.onHover,[t,r,this],this),l&&W(o.onClick,[t,r,this],this));let d=!wi(r,s);return(d||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,d}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};M(jt,"defaults",G),M(jt,"instances",In),M(jt,"overrides",ce),M(jt,"registry",Lt),M(jt,"version",hf),M(jt,"getChart",cl);pe=class extends wt{constructor(e){super();M(this,"circumference");M(this,"endAngle");M(this,"fullCircles");M(this,"innerRadius");M(this,"outerRadius");M(this,"pixelMargin");M(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,s){let o=this.getProps(["x","y"],s),{angle:a,distance:r}=js(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,p=O(u,c-l),m=Je(a,l,c)&&l!==c,g=p>=Y||m,x=$t(r,d+f,h+f);return g&&x}getCenterPoint(e){let{x:n,y:s,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:d}=this.options,h=(o+a)/2,u=(r+l+d+c)/2;return{x:n+Math.cos(h)*u,y:s+Math.sin(h)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:n,circumference:s}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>Y?Math.floor(s/Y):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);let c=1-Math.sin(Math.min(z,s||0)),d=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,yf(e,this,d,a,r),vf(e,this,d,a,r),e.restore()}};M(pe,"id","arc"),M(pe,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),M(pe,"defaultRoutes",{backgroundColor:"backgroundColor"}),M(pe,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Af=typeof Path2D=="function";Pt=class extends wt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let s=n.spanGaps?this._loop:this._fullLoop;Ar(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ir(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){let n=this.options,s=t[e],o=this.points,a=uo(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Sf(n),c,d;for(c=0,d=a.length;c<d;++c){let{start:h,end:u}=a[c],f=o[h],p=o[u];if(f===p){r.push(f);continue}let m=Math.abs((s-f[e])/(p[e]-f[e])),g=l(f,p,m,n.stepped);g[e]=t[e],r.push(g)}return r.length===1?r[0]:r}pathSegment(t,e,n){return Po(this)(t,this,e,n)}path(t,e,n){let s=this.segments,o=Po(this),a=this._loop;e=e||0,n=n||this.points.length-e;for(let r of s)a&=o(t,this,r,{start:e,end:e+n-1});return!!a}draw(t,e,n,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Df(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};M(Pt,"id","line"),M(Pt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),M(Pt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),M(Pt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});Be=class extends wt{constructor(e){super();M(this,"parsed");M(this,"skip");M(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,s){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,n){return hl(this,e,"x",n)}inYRange(e,n){return hl(this,e,"y",n)}getCenterPoint(e){let{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}size(e){e=e||this.options||{};let n=e.radius||0;n=Math.max(n,n&&e.hoverRadius||0);let s=n&&e.borderWidth||0;return(n+s)*2}draw(e,n){let s=this.options;this.skip||s.radius<.1||!zt(this,n,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Cn(e,s,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};M(Be,"id","point"),M(Be,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),M(Be,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Ne=class extends wt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:a}=Of(this),r=Rf(a.radius)?ti:If;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Co(a,e,o)),t.clip(),r(t,Co(o,-e,a)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),r(t,Co(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return vo(this,t,e,n)}inXRange(t,e){return vo(this,t,null,e)}inYRange(t,e){return vo(this,null,t,e)}getCenterPoint(t){let{x:e,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};M(Ne,"id","bar"),M(Ne,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),M(Ne,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Ql=Object.freeze({__proto__:null,ArcElement:pe,BarElement:Ne,LineElement:Pt,PointElement:Be}),Oo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],ul=Oo.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));ic={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;let{data:{datasets:n},options:s}=i.config,{elements:o}=s,a=fl(n)||Hf(s)||o&&fl(o)||$f();if(!e.forceOverride&&a)return;let r=zf(i);n.forEach(r)}};sc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){pl(i);return}let n=i.width;i.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=i.getDatasetMeta(o),c=a||s.data;if(ei([r,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=i.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||i.options.parsing)return;let{start:h,count:u}=jf(l,c),f=e.threshold||4*n;if(u<=f){nc(s);return}N(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(e.algorithm){case"lttb":p=Vf(c,h,u,n,e);break;case"min-max":p=Wf(c,h,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(i){pl(i)}};$n=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){let{x:s,y:o,radius:a}=this;return e=e||{start:0,end:Y},t.arc(s,o,a,e.end,e.start,!0),!n.bounds}interpolate(t){let{x:e,y:n,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}};ac={id:"filler",afterDatasetsUpdate(i,t,e){let n=(i.data.datasets||[]).length,s=[],o,a,r,l;for(a=0;a<n;++a)o=i.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Pt&&(l={visible:i.isDatasetVisible(a),index:a,fill:Xf(r,a,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<n;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=Gf(s,a,e.propagate))},beforeDraw(i,t,e){let n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let a=s.length-1;a>=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),n&&r.fill&&ko(i.ctx,r,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){let o=n[s].$filler;gl(o)&&ko(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){let n=t.meta.$filler;!gl(n)||e.drawTime!=="beforeDatasetDraw"||ko(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},yl=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},dp=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index,Vn=class extends wt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=W(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let n=t.labels,s=st(n.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=yl(n,o),c,d;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(a,o,r,l)+10):(d=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+r,h=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-d;return this.legendItems.forEach((p,m)=>{let g=n+e/2+o.measureText(p.text).width;(m===0||c[c.length-1]+g+2*r>a)&&(h+=d,c[c.length-(m>0?0:1)]=0,f+=d,u++),l[m]={left:0,top:f,row:u,width:g,height:s},c[c.length-1]+=g+r}),h}_fitCols(t,e,n,s){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=a-t,h=r,u=0,f=0,p=0,m=0;return this.legendItems.forEach((g,x)=>{let{itemWidth:_,itemHeight:C}=hp(n,e,o,g,s);x>0&&f+C+2*r>d&&(h+=u+r,c.push({width:u,height:f}),p+=u+r,m++,u=f=0),l[x]={left:p,top:f,col:m,width:_,height:C},u=Math.max(u,_),f+=C+r}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,a=Te(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ht(n,this.left+s,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=ht(n,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=ht(n,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=ht(n,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Mi(t,this),this._draw(),Si(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:a}=t,r=G.color,l=Te(t.rtl,this.left,this.width),c=st(a.font),{padding:d}=a,h=c.size,u=h/2,f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:g}=yl(a,h),x=function(w,S,E){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();let L=O(E.lineWidth,1);if(s.fillStyle=O(E.fillStyle,r),s.lineCap=O(E.lineCap,"butt"),s.lineDashOffset=O(E.lineDashOffset,0),s.lineJoin=O(E.lineJoin,"miter"),s.lineWidth=L,s.strokeStyle=O(E.strokeStyle,r),s.setLineDash(O(E.lineDash,[])),a.usePointStyle){let R={radius:m*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:L},A=l.xPlus(w,p/2),I=S+u;to(s,R,A,I,a.pointStyleWidth&&p)}else{let R=S+Math.max((h-m)/2,0),A=l.leftForLtr(w,p),I=ue(E.borderRadius);s.beginPath(),Object.values(I).some(et=>et!==0)?ti(s,{x:A,y:R,w:p,h:m,radius:I}):s.rect(A,R,p,m),s.fill(),L!==0&&s.stroke()}s.restore()},_=function(w,S,E){he(s,E.text,w,S+g/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),y=this._computeTitleHeight();C?f={x:ht(o,this.left+d,this.right-n[0]),y:this.top+d+y,line:0}:f={x:this.left+d,y:ht(o,this.top+y+d,this.bottom-e[0].height),line:0},lo(this.ctx,t.textDirection);let v=g+d;this.legendItems.forEach((w,S)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;let E=s.measureText(w.text).width,L=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),R=p+u+E,A=f.x,I=f.y;l.setWidth(this.width),C?S>0&&A+R+d>this.right&&(I=f.y+=v,f.line++,A=f.x=ht(o,this.left+d,this.right-n[f.line])):S>0&&I+v>this.bottom&&(A=f.x=A+e[f.line].width+d,f.line++,I=f.y=ht(o,this.top+y+d,this.bottom-e[f.line].height));let et=l.x(A);if(x(et,I,w),A=_r(L,A+p+u,C?A+R:this.right,t.rtl),_(l.x(A),I,w),C)f.x+=R+d;else if(typeof w.text!="string"){let lt=c.lineHeight;f.y+=rc(w,lt)+d}else f.y+=v}),co(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,n=st(e.font),s=ut(e.padding);if(!e.display)return;let o=Te(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=n.size/2,c=s.top+l,d,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),d=this.top+c,h=ht(t.align,h,this.right-u);else{let p=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);d=c+ht(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}let f=ht(r,h,h+u);a.textAlign=o.textAlign(yn(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=n.string,he(a,e.text,f,d,n)}_computeTitleHeight(){let t=this.options.title,e=st(t.font),n=ut(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if($t(t,this.left,this.right)&&$t(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],$t(t,s.left,s.left+s.width)&&$t(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){let e=this.options;if(!pp(t.type,e))return;let n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=dp(s,n);s&&!o&&W(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&W(e.onHover,[t,n,this],this)}else n&&W(e.onClick,[t,n,this],this)}};lc={id:"legend",_element:Vn,start(i,t,e){let n=i.legend=new Vn({ctx:i.ctx,options:e,chart:i});ft.configure(i,n,e),ft.addBox(i,n)},stop(i){ft.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){let n=i.legend;ft.configure(i,n,e),n.options=e},afterUpdate(i){let t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){let n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){let t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),d=ut(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}},Fi=class extends wt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=U(n.text)?n.text.length:1;this._padding=ut(n.padding);let o=s*st(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:n,bottom:s,right:o,options:a}=this,r=a.align,l=0,c,d,h;return this.isHorizontal()?(d=ht(r,n,o),h=e+t,c=o-n):(a.position==="left"?(d=n+t,h=ht(r,s,e),l=z*-.5):(d=o-t,h=ht(r,e,s),l=z*.5),c=s-e),{titleX:d,titleY:h,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let n=st(e.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);he(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:yn(e.align),textBaseline:"middle",translation:[a,r]})}};cc={id:"title",_element:Fi,start(i,t,e){mp(i,e)},stop(i){let t=i.titleBlock;ft.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){let n=i.titleBlock;ft.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Ln=new WeakMap,dc={id:"subtitle",start(i,t,e){let n=new Fi({ctx:i.ctx,options:e,chart:i});ft.configure(i,n,e),ft.addBox(i,n),Ln.set(i,n)},stop(i){ft.removeBox(i,Ln.get(i)),Ln.delete(i)},beforeUpdate(i,t,e){let n=Ln.get(i);ft.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Oi={average(i){if(!i.length)return!1;let t,e,n=new Set,s=0,o=0;for(t=0,e=i.length;t<e;++t){let r=i[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();n.add(l.x),s+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((r,l)=>r+l)/n.size,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o<a;++o){let l=i[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=mn(t,c);d<s&&(s=d,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};hc={beforeTitle:Ht,title(i){if(i.length>0){let t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:Ht,beforeBody:Ht,beforeLabel:Ht,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");let e=i.formattedValue;return N(e)||(t+=e),t},labelColor(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ht,afterBody:Ht,beforeFooter:Ht,footer:Ht,afterFooter:Ht};Ri=class extends wt{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 e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Ii(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Cp(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:n}=e,s=vt(n,"beforeTitle",this,t),o=vt(n,"title",this,t),a=vt(n,"afterTitle",this,t),r=[];return r=Vt(r,ie(s)),r=Vt(r,ie(o)),r=Vt(r,ie(a)),r}getBeforeBody(t,e){return wl(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:n}=e,s=[];return $(t,o=>{let a={before:[],lines:[],after:[]},r=Ml(n,o);Vt(a.before,ie(vt(r,"beforeLabel",this,o))),Vt(a.lines,vt(r,"label",this,o)),Vt(a.after,ie(vt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return wl(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:n}=e,s=vt(n,"beforeFooter",this,t),o=vt(n,"footer",this,t),a=vt(n,"afterFooter",this,t),r=[];return r=Vt(r,ie(s)),r=Vt(r,ie(o)),r=Vt(r,ie(a)),r}_createItems(t){let e=this._active,n=this.chart.data,s=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(gp(this.chart,e[l]));return t.filter&&(r=r.filter((d,h,u)=>t.filter(d,h,u,n))),t.itemSort&&(r=r.sort((d,h)=>t.itemSort(d,h,n))),$(r,d=>{let h=Ml(t.callbacks,d);s.push(vt(h,"labelColor",this,d)),o.push(vt(h,"labelPointStyle",this,d)),a.push(vt(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let n=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=Oi[n.position].call(this,s,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let l=this._size=vl(this,n),c=Object.assign({},r,l),d=Cl(this.chart,n,c),h=kl(n,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){let o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=ue(r),{x:u,y:f}=t,{width:p,height:m}=e,g,x,_,C,y,v;return o==="center"?(y=f+m/2,s==="left"?(g=u,x=g-a,C=y+a,v=y-a):(g=u+p,x=g+a,C=y-a,v=y+a),_=g):(s==="left"?x=u+Math.max(l,d)+a:s==="right"?x=u+p-Math.max(c,h)-a:x=this.caretX,o==="top"?(C=f,y=C-a,g=x-a,_=x+a):(C=f+m,y=C+a,g=x+a,_=x-a),v=C),{x1:g,x2:x,x3:_,y1:C,y2:y,y3:v}}drawTitle(t,e,n){let s=this.title,o=s.length,a,r,l;if(o){let c=Te(n.rtl,this.x,this.width);for(t.x=Pn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",a=st(n.titleFont),r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,n,s,o){let a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,d=st(o.bodyFont),h=Pn(this,"left",o),u=s.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,p=e.y+f;if(o.usePointStyle){let m={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=s.leftForLtr(u,c)+c/2,x=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Cn(t,m,g,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Cn(t,m,g,x)}else{t.lineWidth=F(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let m=s.leftForLtr(u,c),g=s.leftForLtr(s.xPlus(u,1),c-2),x=ue(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ti(t,{x:m,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ti(t,{x:g,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(g,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=n,h=st(n.bodyFont),u=h.lineHeight,f=0,p=Te(n.rtl,this.x,this.width),m=function(E){e.fillText(E,p.x(t.x+f),t.y+u/2),t.y+=u+o},g=p.textAlign(a),x,_,C,y,v,w,S;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=Pn(this,g,n),e.fillStyle=n.bodyColor,$(this.beforeBody,m),f=r&&g!=="right"?a==="center"?c/2+d:c+2+d:0,y=0,w=s.length;y<w;++y){for(x=s[y],_=this.labelTextColors[y],e.fillStyle=_,$(x.before,m),C=x.lines,r&&C.length&&(this._drawColorBox(e,t,y,p,n),u=Math.max(h.lineHeight,l)),v=0,S=C.length;v<S;++v)m(C[v]),u=h.lineHeight;$(x.after,m)}f=0,u=h.lineHeight,$(this.afterBody,m),t.y-=o}drawFooter(t,e,n){let s=this.footer,o=s.length,a,r;if(o){let l=Te(n.rtl,this.x,this.width);for(t.x=Pn(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",a=st(n.footerFont),e.fillStyle=n.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:d}=n,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:p}=ue(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(r+h,l),a==="top"&&this.drawCaret(t,e,n,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,n,s),e.lineTo(r+c,l+d-p),e.quadraticCurveTo(r+c,l+d,r+c-p,l+d),a==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(r+f,l+d),e.quadraticCurveTo(r,l+d,r,l+d-f),a==="center"&&o==="left"&&this.drawCaret(t,e,n,s),e.lineTo(r,l+h),e.quadraticCurveTo(r,l,r+h,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){let a=Oi[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=vl(this,t),l=Object.assign({},a,this._size),c=Cl(e,t,l),d=kl(t,l,c,e);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=ut(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),lo(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),co(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let n=this._active,s=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!wi(n,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,n),r=this._positionChanged(a,t),l=e||!wi(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:n,caretY:s,options:o}=this,a=Oi[o.position].call(this,t,e);return a!==!1&&(n!==a.x||s!==a.y)}};M(Ri,"positioners",Oi);uc={id:"tooltip",_element:Ri,positioners:Oi,afterInit(i,t,e){e&&(i.tooltip=new Ri({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){let t=i.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){let e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,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:hc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},fc=Object.freeze({__proto__:null,Colors:ic,Decimation:sc,Filler:ac,Legend:lc,SubTitle:dc,Title:cc,Tooltip:uc}),kp=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Mp=(i,t)=>i===null?null:at(Math.round(i),0,t);oi=class extends _e{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let n=this.getLabels();for(let{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(N(t))return null;let n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:wp(n,t,O(e,t),this._addedLabels),Mp(e,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){let t=this.min,e=this.max,n=this.options.offset,s=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Sl.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 e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};M(oi,"id","category"),M(oi,"defaults",{ticks:{callback:Sl}});ci=class extends _e{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return N(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=n?o:l;if(t){let l=Dt(s),c=Dt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,n=this.getTickLimit();n=Math.max(2,n);let s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Sp(s,o);return t.bounds==="ticks"&&Vs(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){let s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Ze(t,this.chart.options.locale,this.options.ticks.format)}},ai=class extends ci{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?t:0,this.max=Q(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,n=At(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/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}};M(ai,"id","linear"),M(ai,"defaults",{ticks:{callback:Qe.formatters.numeric}});zi=i=>Math.floor(Qt(i)),De=(i,t)=>Math.pow(10,zi(i)+t);ri=class extends _e{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let n=ci.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return Q(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?Math.max(0,t):null,this.max=Q(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Q(this._userMin)&&(this.min=t===De(this.min,0)?De(this.min,-1):De(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),n=this.min,s=this.max,o=r=>n=t?n:r,a=r=>s=e?s:r;n===s&&(n<=0?(o(1),a(10)):(o(De(n,-1)),a(De(s,1)))),n<=0&&o(De(s,-1)),s<=0&&a(De(n,1)),this.min=n,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},n=Tp(e,this);return t.bounds==="ticks"&&Vs(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Ze(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Qt(t),this._valueRange=Qt(this.max)-Qt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Qt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};M(ri,"id","logarithmic"),M(ri,"defaults",{ticks:{callback:Qe.formatters.logarithmic,major:{enabled:!0}}});me=class extends ci{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=ut(Io(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=Q(t)&&!isNaN(t)?t:0,this.max=Q(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Io(this.options))}generateTickLabels(t){ci.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{let s=W(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){let t=this.options;t.display&&t.pointLabels.display?Dp(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){let e=Y/(this._pointLabels.length||1),n=this.options.startAngle||0;return dt(t*e+At(n))}getDistanceFromCenterForValue(t){if(N(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(N(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let n=e[t];return $p(this.getContext(),t,n)}}getPointPosition(t,e,n=0){let s=this.getIndexAngle(t)-tt+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let n=this.ctx;n.save(),n.beginPath(),pc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:n,grid:s,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&zp(this,a),s.display&&this.ticks.forEach((d,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);let u=this.getContext(h),f=s.setContext(u),p=o.setContext(u);Hp(this,f,l,a,p)}}),n.display){for(t.save(),r=a-1;r>=0;r--){let d=n.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:u}=d;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;let s=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=n.setContext(this.getContext(l)),d=st(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let h=ut(c.backdropPadding);t.fillRect(-a/2-h.left,-o-d.size/2-h.top,a+h.width,d.size+h.height)}he(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};M(me,"id","radialLinear"),M(me,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Qe.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),M(me,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),M(me,"descriptors",{angleLines:{_fallback:"grid"}});jn={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}},kt=Object.keys(jn);xe=class extends _e{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let n=t.time||(t.time={}),s=this._adapter=new zl._date(t.adapters.date);s.init(e),Xe(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Pl(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,n=t.time.unit||"day",{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Q(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),o=Q(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){let t=this.options,e=t.time,n=t.ticks,s=n.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,a=this.max,r=mr(s,o,a);return this._unit=e.unit||(n.autoSkip?Ol(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Vp(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Wp(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),Il(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=at(e,0,a),n=at(n,0,a),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){let t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,a=o.unit||Ol(o.minUnit,e,n,this._getLabelCapacity(e)),r=O(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Ee(l)||l===!0,d={},h=e,u,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":a),t.diff(n,e,a)>1e5*r)throw new Error(e+" and "+n+" are too far apart with stepSize of "+r+" "+a);let p=s.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u<n;u=+t.add(u,r,a),f++)Rl(d,u,p);return(u===n||s.bounds==="ticks"||f===1)&&Rl(d,u,p),Object.keys(d).sort(Ll).map(m=>+m)}getLabelForValue(t){let e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,n,s){let o=this.options,a=o.ticks.callback;if(a)return W(a,[t,e,n],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],h=c&&r[c],u=n[e],f=c&&h&&u&&u.major;return this._adapter.format(t,s||(f?h:d))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,n=this.ctx.measureText(t).width,s=At(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(t){let e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,o=this._tickFormatFunction(t,0,Il(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,n;if(t.length)return t;let s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(Pl(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Ys(t.sort(Ll))}};M(xe,"id","time"),M(xe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});li=class extends xe{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=On(e,this.min),this._tableRange=On(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:n}=this,s=[],o=[],a,r,l,c,d;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(a=0,r=s.length;a<r;++a)d=s[a+1],l=s[a-1],c=s[a],Math.round((d+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let t=this.min,e=this.max,n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(On(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return On(this._table,n*this._tableRange+this._minPos,!0)}};M(li,"id","timeseries"),M(li,"defaults",xe.defaults);mc=Object.freeze({__proto__:null,CategoryScale:oi,LinearScale:ai,LogarithmicScale:ri,RadialLinearScale:me,TimeScale:xe,TimeSeriesScale:li}),Up=[Fl,Ql,fc,mc]});async function Yp(){return Un||(Un=await Promise.resolve().then(()=>(bc(),gc)),Un)}async function xc(i,t){let e=await Yp(),{Chart:n,BarController:s,LineController:o,PieController:a,DoughnutController:r,CategoryScale:l,LinearScale:c,BarElement:d,LineElement:h,PointElement:u,ArcElement:f,Title:p,Legend:m,Tooltip:g}=e;n.register(s,o,a,r,l,c,d,h,u,f,p,m,g);let x=document.createElement("canvas");x.setAttribute("data-testid","blex-chart-canvas"),i.appendChild(x);let _=new n(x,{type:t.type,data:{labels:t.data.labels,datasets:t.data.datasets.map(C=>({label:C.label,data:C.values,backgroundColor:C.color,borderColor:C.color}))},options:{responsive:t.options?.responsive??!0,plugins:{title:t.options?.title?{display:!0,text:t.options.title}:{display:!1},legend:{display:t.options?.legend??!0}}}});return i.setAttribute("data-blex-ready","true"),{update(C){C.data&&(_.data.labels=C.data.labels??_.data.labels,C.data.datasets&&(_.data.datasets=C.data.datasets.map(y=>({label:y.label,data:y.values,backgroundColor:y.color,borderColor:y.color})))),C.options?.title&&(_.options.plugins.title={display:!0,text:C.options.title}),_.update()},destroy(){_.destroy(),x.remove()}}}var Un,_c=Bt(()=>{"use strict";Un=null});var yc={};Ce(yc,{ChartRenderer:()=>Yn,createChartRenderer:()=>Gp});function Gp(){return new Yn}var Yn,vc=Bt(()=>{"use strict";Z();_c();Yn=class extends P{constructor(){super(...arguments);this.chartInstance=null}render(e,n){this.container=n;let s=document.createElement("div");s.className="blex-chart",s.setAttribute("data-testid",`blex-chart-${e.id}`),n.appendChild(s),xc(s,e.data).then(o=>{this.chartInstance=o,n.setAttribute("data-blex-ready","true")})}update(e){this.chartInstance&&this.chartInstance.update(e.data)}destroy(){this.chartInstance?.destroy(),this.chartInstance=null,super.destroy()}}});var Cc={};Ce(Cc,{KanbanRenderer:()=>Gn,createKanbanRenderer:()=>Xp});function Xp(){return new Gn}var Gn,kc=Bt(()=>{"use strict";Z();Gn=class extends P{constructor(){super(...arguments);this.draggedItemId=null;this.draggedFromColumn=null;this.draggedItemTitle=null;this.currentBlock=null;this.localColumns=[]}render(e,n){this.container=n,this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this.container.innerHTML="",this._build(e))}revertInteraction(e){if(!this.container||!this.currentBlock||e.type!=="move")return;let{itemId:n,fromColumn:s,toColumn:o}=e.payload,a=this.localColumns.find(h=>h.id===o),r=this.localColumns.find(h=>h.id===s);if(!a||!r)return;let l=a.items.findIndex(h=>h.id===n);if(l===-1)return;let[c]=a.items.splice(l,1);r.items.push(c),this.container.innerHTML="";let d={...this.currentBlock,data:{...this.currentBlock.data,columns:this.localColumns}};this._build(d)}_build(e){let n=this.container,{draggable:s=!0}=e.data,o=this.localColumns,a=document.createElement("div");a.className="blex-kanban",a.setAttribute("data-testid",`blex-kanban-${e.id}`);for(let r of o){let l=this._buildColumn(r,s,e);a.appendChild(l)}n.appendChild(a)}_buildColumn(e,n,s){let o=document.createElement("div");o.className="blex-kanban__column",o.setAttribute("data-testid",`blex-kanban-col-${e.id}`);let a=document.createElement("div");a.className="blex-kanban__column-title",a.textContent=e.title,o.appendChild(a);for(let r of e.items){let l=this._buildItem(r,e.id,n);o.appendChild(l)}return n&&(this.addListener(o,"dragover",r=>{r.preventDefault()}),this.addListener(o,"drop",r=>{if(r.preventDefault(),this.draggedItemId===null||this.draggedFromColumn===null||this.draggedItemTitle===null)return;let c=Array.from(o.querySelectorAll(".blex-kanban__item")).filter(g=>!g.classList.contains("blex-kanban__item--dragging")).length,d=this.draggedItemId,h=this.draggedFromColumn,u=this.draggedItemTitle,f=e.id;this.draggedItemId=null,this.draggedFromColumn=null,this.draggedItemTitle=null;let p=this.localColumns.find(g=>g.id===h),m=this.localColumns.find(g=>g.id===f);if(p&&m){let g=p.items.findIndex(x=>x.id===d);if(g!==-1){let[x]=p.items.splice(g,1);m.items.splice(c,0,x)}}if(this.container&&this.currentBlock){this.container.innerHTML="";let g={...this.currentBlock,data:{...this.currentBlock.data,columns:this.localColumns}};this._build(g)}this.emit({blockId:s.id,type:"move",payload:{itemId:d,fromColumn:h,toColumn:f,position:c},serialized:`Moved "${u}" from ${h} to ${f}`,summary:`Moved "${u}" \u2192 ${f}`,icon:"\u229E",immediate:!1,revertable:!0})})),o}_buildItem(e,n,s){let o=document.createElement("div");o.className="blex-kanban__item",o.setAttribute("data-testid",`blex-kanban-item-${e.id}`),s&&(o.setAttribute("draggable","true"),this.addListener(o,"dragstart",()=>{this.draggedItemId=e.id,this.draggedFromColumn=n,this.draggedItemTitle=e.title,o.classList.add("blex-kanban__item--dragging")}),this.addListener(o,"dragend",()=>{o.classList.remove("blex-kanban__item--dragging")}));let a=document.createElement("div");if(a.className="blex-kanban__item-title",a.textContent=e.title,o.appendChild(a),e.subtitle){let r=document.createElement("div");r.className="blex-kanban__item-subtitle",r.textContent=e.subtitle,o.appendChild(r)}if(e.tags&&e.tags.length>0){let r=document.createElement("div");r.className="blex-kanban__item-tags";for(let l of e.tags){let c=document.createElement("span");c.textContent=l,r.appendChild(c)}o.appendChild(r)}return o}}});var Ec={};Ce(Ec,{CalendarRenderer:()=>Xn,createCalendarRenderer:()=>Kp});function Mc(i){let t=i.getFullYear(),e=String(i.getMonth()+1).padStart(2,"0"),n=String(i.getDate()).padStart(2,"0");return`${t}-${e}-${n}`}function Sc(i){let t=new Date(i);return t.setDate(t.getDate()-t.getDay()),t}function Kp(){return new Xn}var wc,Bo,Xn,Tc=Bt(()=>{"use strict";Z();wc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Bo=["January","February","March","April","May","June","July","August","September","October","November","December"];Xn=class extends P{constructor(){super(...arguments);this.currentBlock=null;this.viewDate=new Date;this.currentView="month"}render(e,n){this.container=n,this.currentBlock=e,this.currentView=e.data.view??"month",this.viewDate=e.data.initialDate?new Date(e.data.initialDate):new Date,this.buildCalendar(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){}update(e){this.container&&(this.currentBlock=e,e.data.view&&(this.currentView=e.data.view),this.container.innerHTML="",this.buildCalendar(e))}buildCalendar(e){let n=this.container,s=document.createElement("div");s.className="blex-calendar",s.setAttribute("data-testid",`blex-calendar-${e.id}`),s.appendChild(this.buildViewToggle(e)),s.appendChild(this.buildNav(e));let o=document.createElement("div");o.className="blex-calendar__grid",this.currentView==="month"?this.buildMonthGrid(o,e):this.currentView==="week"?this.buildWeekGrid(o,e):this.buildDayGrid(o,e),s.appendChild(o),n.appendChild(s)}buildViewToggle(e){let n=document.createElement("div");n.className="blex-calendar__view-toggle";let s=["month","week","day"];for(let o of s){let a=document.createElement("button");a.className="blex-calendar__view-btn",a.setAttribute("data-testid",`blex-calendar-view-${o}`),a.textContent=o.charAt(0).toUpperCase()+o.slice(1),o===this.currentView&&a.setAttribute("aria-pressed","true"),this.addListener(a,"click",(()=>{this.currentView=o,this.container.innerHTML="",this.buildCalendar(e)})),n.appendChild(a)}return n}buildNav(e){let n=document.createElement("div");n.className="blex-calendar__nav";let s=document.createElement("button");s.className="blex-calendar__nav-btn",s.setAttribute("data-testid",`blex-calendar-prev-${e.id}`),s.textContent="\u2039",this.addListener(s,"click",(()=>{this.navigate(-1)}));let o=document.createElement("span");o.className="blex-calendar__title",o.textContent=this.getHeaderTitle();let a=document.createElement("button");return a.className="blex-calendar__nav-btn",a.setAttribute("data-testid",`blex-calendar-next-${e.id}`),a.textContent="\u203A",this.addListener(a,"click",(()=>{this.navigate(1)})),n.appendChild(s),n.appendChild(o),n.appendChild(a),n}getHeaderTitle(){if(this.currentView==="month")return`${Bo[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;if(this.currentView==="week"){let e=Sc(this.viewDate),n=new Date(e);return n.setDate(n.getDate()+6),`${Bo[e.getMonth()]} ${e.getDate()} \u2013 ${n.getDate()}, ${e.getFullYear()}`}else return`${Bo[this.viewDate.getMonth()]} ${this.viewDate.getDate()}, ${this.viewDate.getFullYear()}`}navigate(e){this.currentView==="month"?this.viewDate.setMonth(this.viewDate.getMonth()+e):this.currentView==="week"?this.viewDate.setDate(this.viewDate.getDate()+e*7):this.viewDate.setDate(this.viewDate.getDate()+e),this.container.innerHTML="",this.buildCalendar(this.currentBlock)}buildMonthGrid(e,n){let s=this.viewDate.getFullYear(),o=this.viewDate.getMonth();for(let l of wc){let c=document.createElement("div");c.className="blex-calendar__day-header",c.textContent=l,e.appendChild(c)}let a=new Date(s,o,1).getDay(),r=new Date(s,o+1,0).getDate();for(let l=0;l<a;l++){let c=document.createElement("div");c.className="blex-calendar__day blex-calendar__day--filler",e.appendChild(c)}for(let l=1;l<=r;l++){let c=String(o+1).padStart(2,"0"),d=String(l).padStart(2,"0"),h=`${s}-${c}-${d}`,u=document.createElement("div");u.className="blex-calendar__day",u.setAttribute("data-testid",`blex-calendar-day-${h}`),u.setAttribute("data-date",h);let f=document.createElement("span");f.className="blex-calendar__day-number",f.textContent=String(l),u.appendChild(f);let p=this.getEventsForDate(n.data.events,h);for(let m of p)u.appendChild(this.buildEventEl(m,n));this.addListener(u,"click",(m=>{if(m.target.closest(".blex-calendar__event"))return;let g=`${h}T00:00`,x=`${h}T23:59`;this.emit({blockId:n.id,type:"slot-click",payload:{start:g,end:x},serialized:`Selected time slot: ${g} - ${x}`,summary:`Selected slot: ${g}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),e.appendChild(u)}}buildWeekGrid(e,n){let s=Sc(this.viewDate);for(let o=0;o<7;o++){let a=new Date(s);a.setDate(s.getDate()+o);let r=Mc(a),l=document.createElement("div");l.className="blex-calendar__day",l.setAttribute("data-testid",`blex-calendar-day-${r}`),l.setAttribute("data-date",r);let c=document.createElement("div");c.className="blex-calendar__day-header",c.textContent=`${wc[a.getDay()]} ${a.getDate()}`,l.appendChild(c);for(let h=0;h<24;h++){let u=String(h).padStart(2,"0"),f=`${r}T${u}:00`,p=`${r}T${u}:59`,m=document.createElement("div");m.className="blex-calendar__slot",m.setAttribute("data-start",f),m.setAttribute("data-end",p),m.textContent=`${u}:00`,this.addListener(m,"click",(()=>{this.emit({blockId:n.id,type:"slot-click",payload:{start:f,end:p},serialized:`Selected time slot: ${f} - ${p}`,summary:`Selected slot: ${f}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),l.appendChild(m)}let d=this.getEventsForDate(n.data.events,r);for(let h of d)l.appendChild(this.buildEventEl(h,n));e.appendChild(l)}}buildDayGrid(e,n){let s=Mc(this.viewDate),o=document.createElement("div");o.className="blex-calendar__day",o.setAttribute("data-testid",`blex-calendar-day-${s}`),o.setAttribute("data-date",s);for(let r=0;r<24;r++){let l=String(r).padStart(2,"0"),c=`${s}T${l}:00`,d=`${s}T${l}:59`,h=document.createElement("div");h.className="blex-calendar__slot",h.setAttribute("data-start",c),h.setAttribute("data-end",d),h.textContent=`${l}:00`,this.addListener(h,"click",(()=>{this.emit({blockId:n.id,type:"slot-click",payload:{start:c,end:d},serialized:`Selected time slot: ${c} - ${d}`,summary:`Selected slot: ${c}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),o.appendChild(h)}let a=this.getEventsForDate(n.data.events,s);for(let r of a)o.appendChild(this.buildEventEl(r,n));e.appendChild(o)}buildEventEl(e,n){let s=document.createElement("div");return s.className="blex-calendar__event",s.setAttribute("data-testid",`blex-calendar-event-${e.id}`),s.setAttribute("data-event-id",e.id),s.textContent=e.title,e.color&&(s.style.backgroundColor=e.color),this.addListener(s,"click",(o=>{o.stopPropagation(),this.emit({blockId:n.id,type:"select",payload:{eventId:e.id},serialized:`Selected event: ${e.title}`,summary:`Viewed "${e.title}"`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),s}getEventsForDate(e,n){return e.filter(s=>{let o=s.start.slice(0,10),a=s.end.slice(0,10);return n>=o&&n<=a})}}});var Ac={};Ce(Ac,{GalleryRenderer:()=>Kn,createGalleryRenderer:()=>qp});function qp(){return new Kn}var Kn,Dc=Bt(()=>{"use strict";Z();Kn=class extends P{constructor(){super(...arguments);this.currentIndex=0}revertInteraction(e){}render(e,n){this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentIndex=0,this.container.innerHTML="",this._build(e))}_build(e){let n=this.container,{images:s,layout:o="grid",columns:a=3}=e.data,r=document.createElement("div");r.className=`blex-gallery blex-gallery--${o}`,r.setAttribute("data-testid",`blex-gallery-${e.id}`),o==="carousel"?this._buildCarousel(r,e,s):this._buildGrid(r,e,s,a),n.appendChild(r)}_buildGrid(e,n,s,o){if(e.style.setProperty("--blex-gallery-columns",String(o)),s.forEach((a,r)=>{let l=this._createItem(n,a,r);e.appendChild(l)}),typeof IntersectionObserver<"u"){let a=new IntersectionObserver(r=>{for(let l of r)if(l.isIntersecting){let c=l.target,d=c.getAttribute("data-lazy-src");d&&(c.src=d,c.removeAttribute("data-lazy-src"),a.unobserve(c))}});this.trackObserver(a),e.querySelectorAll(".blex-gallery__img").forEach(r=>{a.observe(r)})}}_buildCarousel(e,n,s){s.forEach((l,c)=>{let d=this._createItem(n,l,c);c!==this.currentIndex&&(d.style.display="none"),e.appendChild(d)});let o=document.createElement("div");o.className="blex-gallery__nav";let a=document.createElement("button");a.className="blex-gallery__nav-btn",a.textContent="Previous",a.setAttribute("data-testid",`blex-gallery-prev-${n.id}`);let r=document.createElement("button");r.className="blex-gallery__nav-btn",r.textContent="Next",r.setAttribute("data-testid",`blex-gallery-next-${n.id}`),this.addListener(a,"click",()=>{this._showCarouselItem(e,s,this.currentIndex-1)}),this.addListener(r,"click",()=>{this._showCarouselItem(e,s,this.currentIndex+1)}),o.appendChild(a),o.appendChild(r),e.appendChild(o)}_showCarouselItem(e,n,s){let o=Math.max(0,Math.min(n.length-1,s));if(o===this.currentIndex)return;let a=e.querySelectorAll(".blex-gallery__item"),r=a[this.currentIndex],l=a[o];r&&(r.style.display="none"),l&&(l.style.display=""),this.currentIndex=o}_createItem(e,n,s){let o=document.createElement("figure");o.className="blex-gallery__item",o.setAttribute("data-testid",`blex-gallery-item-${s}`);let a=document.createElement("img");if(a.className="blex-gallery__img",a.alt=n.alt??"",a.loading="lazy",a.src=n.url,this.addListener(a,"click",()=>{this.emit({blockId:e.id,type:"select",payload:{imageIndex:s,url:n.url},serialized:`Selected image ${s+1}: ${n.caption??n.url}`,summary:`Selected image ${s+1}${n.caption?`: ${n.caption}`:""}`,icon:"\u{1F5BC}",immediate:!1,revertable:!0})}),o.appendChild(a),n.caption){let r=document.createElement("figcaption");r.className="blex-gallery__caption",r.textContent=n.caption,o.appendChild(r)}return o}}});var Jp={};Ce(Jp,{BaseRenderer:()=>P,getPluginInfo:()=>fa,getRegisteredTypes:()=>ra,hasBlockType:()=>Ji,registerBlockType:()=>nt,registerLazyBlockType:()=>se,registerPlugin:()=>ha,renderBlock:()=>Qi,renderPlaceholder:()=>la,unregisterBlockType:()=>qi,unregisterPlugin:()=>ua});Z();var ke=new Map,Ki=new Set;function nt(i,t){ke.set(i,{factory:t})}function sa(i){Ki.add(i)}function oa(i){return Ki.has(i)}function qi(i,t){if(!ke.has(i))return!1;if(Ki.has(i)&&!t?.force)throw new Error(`Cannot unregister built-in block type "${i}" without force: true`);return ke.delete(i),Ki.delete(i),!0}function se(i,t){ke.set(i,{loader:t})}async function aa(i){let t=ke.get(i);if(!t)return null;if(t.factory)return t.factory();if(t.loader){let e=await t.loader();return t.factory=e,t.loader=void 0,e()}return null}function Ji(i){return ke.has(i)}function ra(){return Array.from(ke.keys())}function la(i,t){let e=document.createElement("div");e.className="blex-placeholder",e.setAttribute("data-testid",`blex-placeholder-${i}`),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true");let n=document.createElement("span");n.className="blex-placeholder__label",n.textContent=i;let s=document.createElement("div");return s.className="blex-placeholder__pulse",e.appendChild(n),e.appendChild(s),t.appendChild(e),e}Z();var Zi=class extends P{render(t,e){this.container=e;let n=document.createElement("details");n.setAttribute("data-testid",`blex-fallback-${t.id}`);let s=document.createElement("summary");s.textContent=`Unknown block type: ${t.type}`,s.setAttribute("data-testid",`blex-fallback-summary-${t.id}`),n.appendChild(s);let o=document.createElement("pre"),a=document.createElement("code");a.textContent=JSON.stringify(t.data,null,2),o.appendChild(a),n.appendChild(o),e.appendChild(n),e.setAttribute("data-blex-ready","true")}update(t){if(!this.container)return;let e=this.container.querySelector("code");e&&(e.textContent=JSON.stringify(t.data,null,2))}};var ca="blex-theme-defaults",Kc=`
3
+ `):i}function gp(i,t){let{element:e,datasetIndex:n,index:s}=t,o=i.getDatasetMeta(n).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:i,label:a,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:e}}function vl(i,t){let e=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=st(t.bodyFont),c=st(t.titleFont),d=st(t.footerFont),h=o.length,u=s.length,f=n.length,p=ut(t.padding),m=p.height,g=0,x=n.reduce((y,v)=>y+v.before.length+v.lines.length+v.after.length,0);if(x+=i.beforeBody.length+i.afterBody.length,h&&(m+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;m+=f*y+(x-f)*l.lineHeight+(x-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let _=0,C=function(y){g=Math.max(g,e.measureText(y).width+_)};return e.save(),e.font=c.string,$(i.title,C),e.font=l.string,$(i.beforeBody.concat(i.afterBody),C),_=t.displayColors?a+2+t.boxPadding:0,$(n,y=>{$(y.before,C),$(y.lines,C),$(y.after,C)}),_=0,e.font=d.string,$(i.footer,C),e.restore(),g+=p.width,{width:g,height:m}}function bp(i,t){let{y:e,height:n}=t;return e<n/2?"top":e>i.height-n/2?"bottom":"center"}function xp(i,t,e,n){let{x:s,width:o}=n,a=e.caretSize+e.caretPadding;if(i==="left"&&s+o+a>t.width||i==="right"&&s-o-a<0)return!0}function _p(i,t,e,n){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i,c="center";return n==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),xp(c,i,t,e)&&(c="center"),c}function Cl(i,t,e){let n=e.yAlign||t.yAlign||bp(i,e);return{xAlign:e.xAlign||t.xAlign||_p(i,t,e,n),yAlign:n}}function yp(i,t){let{x:e,width:n}=i;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function vp(i,t,e){let{y:n,height:s}=i;return t==="top"?n+=e:t==="bottom"?n-=s+e:n-=s/2,n}function kl(i,t,e,n){let{caretSize:s,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=ue(a),p=yp(t,r),m=vp(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(d,u)+s:r==="right"&&(p+=Math.max(h,f)+s),{x:at(p,0,n.width-t.width),y:at(m,0,n.height-t.height)}}function Pn(i,t,e){let n=ut(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-n.right:i.x+n.left}function wl(i){return Vt([],ie(i))}function Cp(i,t,e){return ee(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ml(i,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}function vt(i,t,e,n){let s=i[t].call(e,n);return typeof s>"u"?hc[t].call(e,n):s}function wp(i,t,e,n){let s=i.indexOf(t);if(s===-1)return kp(i,t,e,n);let o=i.lastIndexOf(t);return s!==o?e:s}function Sl(i){let t=this.getLabels();return i>=0&&i<t.length?t[i]:i}function Sp(i,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=i,f=o||1,p=d-1,{min:m,max:g}=t,x=!N(a),_=!N(r),C=!N(c),y=(g-m)/(h+1),v=$s((g-m)/p/f)*f,w,S,E,L;if(v<1e-14&&!x&&!_)return[{value:m},{value:g}];L=Math.ceil(g/v)-Math.floor(m/v),L>p&&(v=$s(L*v/p/f)*f),N(l)||(w=Math.pow(10,l),v=Math.ceil(v*w)/w),s==="ticks"?(S=Math.floor(m/v)*v,E=Math.ceil(g/v)*v):(S=m,E=g),x&&_&&o&&ur((r-a)/o,v/1e3)?(L=Math.round(Math.min((r-a)/v,d)),v=(r-a)/L,S=a,E=r):C?(S=x?a:S,E=_?r:E,L=c-1,v=(E-S)/L):(L=(E-S)/v,qe(L,Math.round(L),v/1e3)?L=Math.round(L):L=Math.ceil(L));let R=Math.max(Ws(v),Ws(S));w=Math.pow(10,N(l)?R:l),S=Math.round(S*w)/w,E=Math.round(E*w)/w;let A=0;for(x&&(u&&S!==a?(e.push({value:a}),S<a&&A++,qe(Math.round((S+A*v)*w)/w,a,El(a,y,i))&&A++):S<a&&A++);A<L;++A){let I=Math.round((S+A*v)*w)/w;if(_&&I>r)break;e.push({value:I})}return _&&u&&E!==r?e.length&&qe(e[e.length-1].value,r,El(r,y,i))?e[e.length-1].value=r:e.push({value:r}):(!_||E===r)&&e.push({value:E}),e}function El(i,t,{horizontal:e,minRotation:n}){let s=At(n),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}function Tl(i){return i/Math.pow(10,zi(i))===1}function Al(i,t,e){let n=Math.pow(10,e),s=Math.floor(i/n);return Math.ceil(t/n)-s}function Ep(i,t){let e=t-i,n=zi(e);for(;Al(i,t,n)>10;)n++;for(;Al(i,t,n)<10;)n--;return Math.min(n,zi(i))}function Tp(i,{min:t,max:e}){t=yt(i.min,t);let n=[],s=zi(t),o=Ep(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,d=Math.floor((t-l)/r/10)*r*10,h=Math.floor((c-d)/Math.pow(10,o)),u=yt(i.min,Math.round((l+d+h*Math.pow(10,o))*a)/a);for(;u<e;)n.push({value:u,major:Tl(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,a=o>=0?1:a),u=Math.round((l+d+h*Math.pow(10,o))*a)/a;let f=yt(i.max,u);return n.push({value:f,major:Tl(f),significand:h}),n}function Io(i){let t=i.ticks;if(t.display&&i.display){let e=ut(t.backdropPadding);return O(t.font&&t.font.size,G.font.size)+e.height}return 0}function Ap(i,t,e){return e=U(e)?e:[e],{w:vr(i,t.string,e),h:e.length*t.lineHeight}}function Dl(i,t,e,n,s){return i===n||i===s?{start:t-e/2,end:t+e/2}:i<n||i>s?{start:t-e,end:t}:{start:t,end:t+e}}function Dp(i){let t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),n=[],s=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?z/o:0;for(let l=0;l<o;l++){let c=a.setContext(i.getPointLabelContext(l));s[l]=c.padding;let d=i.getPointPosition(l,i.drawingArea+s[l],r),h=st(c.font),u=Ap(i.ctx,h,i._pointLabels[l]);n[l]=u;let f=dt(i.getIndexAngle(l)+r),p=Math.round(xn(f)),m=Dl(p,d.x,u.w,0,180),g=Dl(p,d.y,u.h,90,270);Lp(e,t,f,m,g)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=Rp(i,n,s)}function Lp(i,t,e,n,s){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;n.start<t.l?(r=(t.l-n.start)/o,i.l=Math.min(i.l,t.l-r)):n.end>t.r&&(r=(n.end-t.r)/o,i.r=Math.max(i.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,i.t=Math.min(i.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,i.b=Math.max(i.b,t.b+l))}function Pp(i,t,e){let n=i.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=i.getPointPosition(t,n+s+a,o),c=Math.round(xn(dt(l.angle+tt))),d=Np(l.y,r.h,c),h=Ip(c),u=Bp(l.x,r.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:u,top:d,right:u+r.w,bottom:d+r.h}}function Op(i,t){if(!t)return!0;let{left:e,top:n,right:s,bottom:o}=i;return!(zt({x:e,y:n},t)||zt({x:e,y:o},t)||zt({x:s,y:n},t)||zt({x:s,y:o},t))}function Rp(i,t,e){let n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Io(o)/2,additionalAngle:a?z/s:0},c;for(let d=0;d<s;d++){l.padding=e[d],l.size=t[d];let h=Pp(i,d,l);n.push(h),r==="auto"&&(h.visible=Op(h,c),h.visible&&(c=h))}return n}function Ip(i){return i===0||i===180?"center":i<180?"left":"right"}function Bp(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Np(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Fp(i,t,e){let{left:n,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!N(r)){let l=ue(t.borderRadius),c=ut(t.backdropPadding);i.fillStyle=r;let d=n-c.left,h=s-c.top,u=o-n+c.width,f=a-s+c.height;Object.values(l).some(p=>p!==0)?(i.beginPath(),ti(i,{x:d,y:h,w:u,h:f,radius:l}),i.fill()):i.fillRect(d,h,u,f)}}function zp(i,t){let{ctx:e,options:{pointLabels:n}}=i;for(let s=t-1;s>=0;s--){let o=i._pointLabelItems[s];if(!o.visible)continue;let a=n.setContext(i.getPointLabelContext(s));Fp(e,a,o);let r=st(a.font),{x:l,y:c,textAlign:d}=o;he(e,i._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function pc(i,t,e,n){let{ctx:s}=i;if(e)s.arc(i.xCenter,i.yCenter,t,0,Y);else{let o=i.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<n;a++)o=i.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Hp(i,t,e,n,s){let o=i.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!n||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),pc(i,e,a,n),o.closePath(),o.stroke(),o.restore())}function $p(i,t,e){return ee(i,{label:e,index:t,type:"pointLabel"})}function Ll(i,t){return i-t}function Pl(i,t){if(N(t))return null;let e=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts,a=t;return typeof n=="function"&&(a=n(a)),Q(a)||(a=typeof n=="string"?e.parse(a,n):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Ee(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Ol(i,t,e,n){let s=kt.length;for(let o=kt.indexOf(i);o<s-1;++o){let a=jn[kt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=n)return kt[o]}return kt[s-1]}function Vp(i,t,e,n,s){for(let o=kt.length-1;o>=kt.indexOf(e);o--){let a=kt[o];if(jn[a].common&&i._adapter.diff(s,n,a)>=t-1)return a}return kt[e?kt.indexOf(e):0]}function Wp(i){for(let t=kt.indexOf(i)+1,e=kt.length;t<e;++t)if(jn[kt[t]].common)return kt[t]}function Rl(i,t,e){if(!e)i[t]=!0;else if(e.length){let{lo:n,hi:s}=_n(e,t),o=e[n]>=t?e[n]:e[s];i[o]=!0}}function jp(i,t,e,n){let s=i._adapter,o=+s.startOf(t[0].value,n),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,n))l=e[r],l>=0&&(t[l].major=!0);return t}function Il(i,t,e){let n=[],s={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,n.push({value:r,major:!1});return o===0||!e?n:jp(i,n,s,e)}function On(i,t,e){let n=0,s=i.length-1,o,a,r,l;e?(t>=i[n].pos&&t<=i[s].pos&&({lo:n,hi:s}=Ft(i,"pos",t)),{pos:o,time:r}=i[n],{pos:a,time:l}=i[s]):(t>=i[n].time&&t<=i[s].time&&({lo:n,hi:s}=Ft(i,"time",t)),{time:o,pos:r}=i[n],{time:a,pos:l}=i[s]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var Mo,Wt,Nr,Uh,Bn,Ii,go,Vr,iu,Ct,Le,Pe,Ut,Oe,ge,ni,Re,Ie,Fl,So,zl,Hl,$l,ft,Bi,Nn,Rn,Mu,qr,Wl,Ni,Jr,zn,wt,Vu,Zr,Qr,_e,si,Eo,Lt,To,sl,Xl,Li,Lo,cf,hf,uf,In,cl,jt,pe,Af,Pt,Be,Ne,Ql,Oo,ul,ic,sc,$n,ac,yl,dp,Vn,lc,Fi,cc,Ln,dc,Oi,hc,Ri,uc,fc,kp,Mp,oi,ci,ai,zi,De,ri,me,jn,kt,xe,li,mc,Up,bc=Bt(()=>{"use strict";Br();Mo=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(n-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Gs.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;let o=n.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,n,t,"progress")),o.length||(n.running=!1,this._notify(s,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let n=e.items,s=n.length-1;for(;s>=0;--s)n[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Wt=new Mo,Nr="transparent",Uh={boolean(i,t,e){return e>.5?t:i},color(i,t,e){let n=Zs(i||Nr),s=n.valid&&Zs(t||Nr);return s&&s.valid?s.mix(n,e).hexString():t},number(i,t,e){return i+(t-i)*e}},Bn=class{constructor(t,e,n,s){let o=e[n];s=ei([t.to,s,o,t.from]);let a=ei([t.from,o,s]);this._active=!0,this._fn=t.fn||Uh[t.type||typeof a],this._easing=Ue[t.easing]||Ue.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);let s=this._target[this._prop],o=n-this._start,a=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ei([t.to,e,s,t.from]),this._from=ei([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,n=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<n),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/n%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){let e=t?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][e]()}},Ii=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!F(t))return;let e=Object.keys(G.animation),n=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!F(o))return;let a={};for(let r of e)a[r]=o[r];(U(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!n.has(r))&&n.set(r,a)})})}_animateOptions(t,e){let n=e.options,s=Gh(t,n);if(!s)return[];let o=this._createAnimations(s,n);return n.$shared&&Yh(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){let n=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}let d=e[c],h=o[c],u=n.get(c);if(h)if(u&&h.active()){h.update(u,d,r);continue}else h.cancel();if(!u||!u.duration){t[c]=d;continue}o[c]=h=new Bn(u,t,c,d),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let n=this._createAnimations(t,e);if(n.length)return Wt.add(this._chart,n),!0}};go=i=>i==="reset"||i==="none",Vr=(i,t)=>t?i:Object.assign({},i),iu=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Bl(e,!0),values:null},Ct=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=po(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&&Ei(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,n=this.getDataset(),s=(h,u,f,p)=>h==="x"?u:h==="r"?p:f,o=e.xAxisID=O(n.xAxisID,mo(t,"x")),a=e.yAxisID=O(n.yAxisID,mo(t,"y")),r=e.rAxisID=O(n.rAxisID,mo(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,a,r),d=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(d)}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 e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Us(this._data,this),t._stacked&&Ei(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(F(e)){let s=this._cachedMeta;this._data=qh(e,s)}else if(n!==e){if(n){Us(n,this);let s=this._cachedMeta;Ei(s),s._parsed=[]}e&&Object.isExtensible(e)&&br(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,n=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=po(e.vScale,e),e.stack!==n.stack&&(s=!0,Ei(e),e.stack=n.stack),this._resyncElements(t),(s||o!==e._stacked)&&($r(this,e._parsed),e._stacked=po(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:n,_data:s}=this,{iScale:o,_stacked:a}=n,r=o.axis,l=t===0&&e===s.length?!0:n._sorted,c=t>0&&n._parsed[t-1],d,h,u;if(this._parsing===!1)n._parsed=s,n._sorted=!0,u=s;else{U(s[t])?u=this.parseArrayData(n,s,t,e):F(s[t])?u=this.parseObjectData(n,s,t,e):u=this.parsePrimitiveData(n,s,t,e);let f=()=>h[r]===null||c&&h[r]<c[r];for(d=0;d<e;++d)n._parsed[d+t]=h=u[d],l&&(f()&&(l=!1),c=h);n._sorted=l}a&&$r(this,u)}parsePrimitiveData(t,e,n,s){let{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),d=o===a,h=new Array(s),u,f,p;for(u=0,f=s;u<f;++u)p=u+n,h[u]={[r]:d||o.parse(c[p],p),[l]:a.parse(e[p],p)};return h}parseArrayData(t,e,n,s){let{xScale:o,yScale:a}=t,r=new Array(s),l,c,d,h;for(l=0,c=s;l<c;++l)d=l+n,h=e[d],r[l]={x:o.parse(h[0],d),y:a.parse(h[1],d)};return r}parseObjectData(t,e,n,s){let{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),d,h,u,f;for(d=0,h=s;d<h;++d)u=d+n,f=e[u],c[d]={x:o.parse(te(f,r),u),y:a.parse(te(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){let s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:Bl(s,!0),values:e._stacks[t.axis]._visualValues};return zr(r,a,o.index,{mode:n})}updateRangeFromParsed(t,e,n,s){let o=n[e.axis],a=o===null?NaN:o,r=s&&n._stacks[e.axis];s&&r&&(s.values=r,a=zr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let n=this._cachedMeta,s=n._parsed,o=n._sorted&&t===n.iScale,a=s.length,r=this._getOtherScale(t),l=iu(e,n,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=Zh(r),u,f;function p(){f=s[u];let m=f[r.axis];return!Q(f[t.axis])||d>m||h<m}for(u=0;u<a&&!(!p()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,n=[],s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],Q(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,n=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=Kh(O(this.options.clip,Xh(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,n=this._cachedMeta,s=n.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,o,r,l),d=r;d<r+l;++d){let h=s[d];h.hidden||(h.active&&c?a.push(h):h.draw(t,o))}for(d=0;d<a.length;++d)a[d].draw(t,o)}getStyle(t,e){let n=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=eu(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=tu(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=n,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){let s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Ke(n);if(r)return Vr(r,l);let c=this.chart.config,d=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),d),f=Object.keys(G.elements[t]),p=()=>this.getContext(n,s,e),m=c.resolveNamedOptions(u,f,p,h);return m.$shared&&(m.$shared=l,o[a]=Object.freeze(Vr(m,l))),m}_resolveAnimations(t,e,n){let s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){let d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,e),u=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(u,this.getContext(t,n,e))}let c=new Ii(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||go(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let n=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(n),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:a}}updateElement(t,e,n,s){go(s)?Object.assign(t,n):this._resolveAnimations(e,s).update(t,n)}updateSharedOptions(t,e,n){t&&!go(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,n,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"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 e=this._data,n=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let s=n.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,e,n=!0){let s=this._cachedMeta,o=s.data,a=t+e,r,l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),n&&this.updateElements(o,t,e,"reset")}updateElements(t,e,n,s){}_removeElements(t,e){let n=this._cachedMeta;if(this._parsing){let s=n._parsed.splice(t,e);n._stacked&&Ei(n,s)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,n,s]=t;this[e](n,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,e){e&&this._sync(["_removeElements",t,e]);let n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};M(Ct,"defaults",{}),M(Ct,"datasetElementType",null),M(Ct,"dataElementType",null);Le=class extends Ct{parsePrimitiveData(t,e,n,s){return Wr(t,e,n,s)}parseArrayData(t,e,n,s){return Wr(t,e,n,s)}parseObjectData(t,e,n,s){let{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,d=a.axis==="x"?r:l,h=[],u,f,p,m;for(u=n,f=n+s;u<f;++u)m=e[u],p={},p[o.axis]=o.parse(te(m,c),u),h.push(Nl(te(m,d),p,a,u));return h}updateRangeFromParsed(t,e,n,s){super.updateRangeFromParsed(t,e,n,s);let o=n._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:n,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=bo(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,s){let o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),d=this._getRuler(),{sharedOptions:h,includeOptions:u}=this._getSharedOptions(e,s);for(let f=e;f<e+n;f++){let p=this.getParsed(f),m=o||N(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,d),x=(p._stacks||{})[r.axis],_={horizontal:c,base:m.base,enableBorderRadius:!x||bo(p._custom)||a===x._top||a===x._bottom,x:c?m.head:g.center,y:c?g.center:m.head,height:c?g.size:Math.abs(m.size),width:c?Math.abs(m.size):g.size};u&&(_.options=h||this.resolveDataElementOptions(f,t[f].active?"active":s));let C=_.options||t[f].options;du(_,C,x,a),uu(_,C,d.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,e){let{iScale:n}=this._cachedMeta,s=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=n.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[n.axis],c=d=>{let h=d._parsed.find(f=>f[n.axis]===l),u=h&&h[d.vScale.axis];if(N(u)||isNaN(u))return!0};for(let d of s)if(!(e!==void 0&&c(d))&&((o===!1||a.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[O(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,n){let s=this._getStacks(t,n),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,n=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o<a;++o)s.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));let r=t.barThickness;return{min:r||su(e),pixels:s,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:n,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,d=bo(c),h=l[e.axis],u=0,f=n?this.applyStack(e,l,n):h,p,m;f!==h&&(u=f-h,f=h),d&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&Dt(h)!==Dt(c.barEnd)&&(u=0),u+=h);let g=!N(o)&&!d?o:u,x=e.getPixelForValue(g);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(u+f):p=x,m=p-x,Math.abs(m)<a){m=lu(m,e,r)*a,h===r&&(x-=m/2);let _=e.getPixelForDecimal(0),C=e.getPixelForDecimal(1),y=Math.min(_,C),v=Math.max(_,C);x=Math.max(Math.min(x,v),y),p=x+m,n&&!d&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){let _=Dt(m)*e.getLineWidthForValue(r)/2;x+=_,m-=_}return{size:m,base:x,head:p,center:p+m/2}}_calculateBarIndexPixels(t,e){let n=e.scale,s=this.options,o=s.skipNull,a=O(s.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let d=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?au(t,e,s,d*c):ou(t,e,s,d*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(O(u,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=h.start+h.chunk*p+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=n.getPixelForValue(this.getParsed(t)[n.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,n=t.data,s=n.length,o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!n[o].hidden&&n[o].draw(this._ctx)}};M(Le,"id","bar"),M(Le,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),M(Le,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});Pe=class extends Ct{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,n,s){let o=super.parsePrimitiveData(t,e,n,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+n).radius;return o}parseArrayData(t,e,n,s){let o=super.parseArrayData(t,e,n,s);for(let a=0;a<o.length;a++){let r=e[n+a];o[a]._custom=O(r[2],this.resolveDataElementOptions(a+n).radius)}return o}parseObjectData(t,e,n,s){let o=super.parseObjectData(t,e,n,s);for(let a=0;a<o.length;a++){let r=e[n+a];o[a]._custom=O(r&&r.r&&+r.r,this.resolveDataElementOptions(a+n).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:n[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),d=a.axis,h=r.axis;for(let u=e;u<e+n;u++){let f=t[u],p=!o&&this.getParsed(u),m={},g=m[d]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[d]),x=m[h]=o?r.getBasePixel():r.getPixelForValue(p[h]);m.skip=isNaN(g)||isNaN(x),c&&(m.options=l||this.resolveDataElementOptions(u,f.active?"active":s),o&&(m.options.radius=0)),this.updateElement(f,u,m,s)}}resolveDataElementOptions(t,e){let n=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let o=s.radius;return e!=="active"&&(s.radius=0),s.radius+=O(n&&n._custom,o),s}};M(Pe,"id","bubble"),M(Pe,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),M(Pe,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});Ut=class extends Ct{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let n=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=n;else{let o=l=>+n[l];if(F(n[t])){let{key:l="value"}=this._parsing;o=c=>+te(n[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return At(this.options.rotation-90)}_getCircumference(){return At(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){let s=this.chart.getDatasetMeta(n).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:n}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(lr(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:p,offsetY:m}=fu(h,d,l),g=(n.width-a)/u,x=(n.height-a)/f,_=Math.max(Math.min(g,x)/2,0),C=zs(this.options.radius,_),y=Math.max(C*l,0),v=(C-y)/this._getVisibleDatasetWeightTotal();this.offsetX=p*C,this.offsetY=m*C,s.total=this.calculateTotal(),this.outerRadius=C-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){let n=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/Y)}updateElements(t,e,n,s){let o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,d=(r.left+r.right)/2,h=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,p=u?0:this.outerRadius,{sharedOptions:m,includeOptions:g}=this._getSharedOptions(e,s),x=this._getRotation(),_;for(_=0;_<e;++_)x+=this._circumference(_,o);for(_=e;_<e+n;++_){let C=this._circumference(_,o),y=t[_],v={x:d+this.offsetX,y:h+this.offsetY,startAngle:x,endAngle:x+C,circumference:C,outerRadius:p,innerRadius:f};g&&(v.options=m||this.resolveDataElementOptions(_,y.active?"active":s)),x+=C,this.updateElement(y,_,v,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,n=0,s;for(s=0;s<e.length;s++){let o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(n+=Math.abs(o))}return n}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ze(e._parsed[t],n.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,n=this.chart,s,o,a,r,l;if(!t){for(s=0,o=n.data.datasets.length;s<o;++s)if(n.isDatasetVisible(s)){a=n.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,s=t.length;n<s;++n){let o=this.resolveDataElementOptions(n);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max(O(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};M(Ut,"id","doughnut"),M(Ut,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),M(Ut,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),M(Ut,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:n,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});Oe=class extends Ct{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:n,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Ks(e,s,a);this._drawStart=r,this._drawCount=l,qs(e)&&(r=0,l=s.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,s),u=a.axis,f=r.axis,{spanGaps:p,segment:m}=this.options,g=Ee(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",_=e+n,C=t.length,y=e>0&&this.getParsed(e-1);for(let v=0;v<C;++v){let w=t[v],S=x?w:{};if(v<e||v>=_){S.skip=!0;continue}let E=this.getParsed(v),L=N(E[f]),R=S[u]=a.getPixelForValue(E[u],v),A=S[f]=o||L?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,E,l):E[f],v);S.skip=isNaN(R)||isNaN(A)||L,S.stop=v>0&&Math.abs(E[u]-y[u])>g,m&&(S.parsed=E,S.raw=c.data[v]),h&&(S.options=d||this.resolveDataElementOptions(v,w.active?"active":s)),x||this.updateElement(w,v,S,s),y=E}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return n;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(n,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};M(Oe,"id","line"),M(Oe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),M(Oe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});ge=class extends Ct{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,s=n.data.labels||[],o=Ze(e._parsed[t].r,n.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,n,s){return oo.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,s)=>{let o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,n=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,n,s){let o=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,h=c.yCenter,u=c.getIndexAngle(0)-.5*z,f=u,p,m=360/this.countVisibleElements();for(p=0;p<e;++p)f+=this._computeAngle(p,s,m);for(p=e;p<e+n;p++){let g=t[p],x=f,_=f+this._computeAngle(p,s,m),C=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;f=_,o&&(l.animateScale&&(C=0),l.animateRotate&&(x=_=u));let y={x:d,y:h,innerRadius:0,outerRadius:C,startAngle:x,endAngle:_,options:this.resolveDataElementOptions(p,g.active?"active":s)};this.updateElement(g,p,y,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((n,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?At(this.resolveDataElementOptions(t,e).angle||n):0}};M(ge,"id","polarArea"),M(ge,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),M(ge,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:n,color:s}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});ni=class extends Ut{};M(ni,"id","pie"),M(ni,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Re=class extends Ct{getLabelAndValue(t){let e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,s){return oo.bind(this)(t,e,n,s)}update(t){let e=this._cachedMeta,n=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(n.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(n,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,n,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+n;r++){let l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),d=o.getPointPositionForValue(r,this.getParsed(r).r),h=a?o.xCenter:d.x,u=a?o.yCenter:d.y,f={x:h,y:u,angle:d.angle,skip:isNaN(h)||isNaN(u),options:c};this.updateElement(l,r,f,s)}}};M(Re,"id","radar"),M(Re,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),M(Re,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});Ie=class extends Ct{getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:n[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:n=[]}=e,s=this.chart._animationsDisabled,{start:o,count:a}=Ks(e,n,s);if(this._drawStart=o,this._drawCount=a,qs(e)&&(o=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:r,_dataset:l}=e;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=n;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(n,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,n,s){let o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,d=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(d),u=this.includeOptions(s,h),f=a.axis,p=r.axis,{spanGaps:m,segment:g}=this.options,x=Ee(m)?m:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",C=e>0&&this.getParsed(e-1);for(let y=e;y<e+n;++y){let v=t[y],w=this.getParsed(y),S=_?v:{},E=N(w[p]),L=S[f]=a.getPixelForValue(w[f],y),R=S[p]=o||E?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,w,l):w[p],y);S.skip=isNaN(L)||isNaN(R)||E,S.stop=y>0&&Math.abs(w[f]-C[f])>x,g&&(S.parsed=w,S.raw=c.data[y]),u&&(S.options=h||this.resolveDataElementOptions(y,v.active?"active":s)),_||this.updateElement(v,y,S,s),C=w}this.updateSharedOptions(h,s,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let n=t.dataset,s=n.options&&n.options.borderWidth||0;if(!e.length)return s;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,a)/2}};M(Ie,"id","scatter"),M(Ie,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),M(Ie,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});Fl=Object.freeze({__proto__:null,BarController:Le,BubbleController:Pe,DoughnutController:Ut,LineController:Oe,PieController:ni,PolarAreaController:ge,RadarController:Re,ScatterController:Ie});So=class i{constructor(t){M(this,"options");this.options=t||{}}static override(t){Object.assign(i.prototype,t)}init(){}formats(){return Ae()}parse(){return Ae()}format(){return Ae()}add(){return Ae()}diff(){return Ae()}startOf(){return Ae()}endOf(){return Ae()}},zl={_date:So};Hl={evaluateInteractionItems:Hi,modes:{index(i,t,e,n){let s=fe(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?xo(i,s,o,n,a):_o(i,s,o,!1,n,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{let d=r[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?xo(i,s,o,n,a):_o(i,s,o,!1,n,a);if(r.length>0){let l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let d=0;d<c.length;++d)r.push({element:c[d],datasetIndex:l,index:d})}return r},point(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return xo(i,s,o,n,a)},nearest(i,t,e,n){let s=fe(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return _o(i,s,o,e.intersect,n,a)},x(i,t,e,n){let s=fe(t,i);return Yr(i,s,"x",e.intersect,n)},y(i,t,e,n){let s=fe(t,i);return Yr(i,s,"y",e.intersect,n)}}},$l=["left","top","right","bottom"];ft={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){let e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,n){if(!i)return;let s=ut(i.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=vu(i.boxes),l=r.vertical,c=r.horizontal;$(i.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});let d=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/d,hBoxMaxHeight:a/2}),u=Object.assign({},s);Vl(u,ut(n));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),p=yu(l.concat(c),h);Pi(r.fullSize,f,h,p),Pi(l,f,h,p),Pi(c,f,h,p)&&Pi(l,f,h,p),ku(f),Kr(r.leftAndTop,f,h,p),f.x+=f.w,f.y+=f.h,Kr(r.rightAndBottom,f,h,p),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(r.chartArea,m=>{let g=m.box;Object.assign(g,i.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Bi=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,s){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):n)}}isAttached(t){return!0}updateConfig(t){}},Nn=class extends Bi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Rn="$chartjs",Mu={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},qr=i=>i===null||i==="";Wl=Lr?{passive:!0}:!1;Ni=new Map,Jr=0;zn=class extends Bi{acquireContext(t,e){let n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(Su(t,e),n):null}releaseContext(t){let e=t.canvas;if(!e[Rn])return!1;let n=e[Rn].initial;["height","width"].forEach(o=>{let a=n[o];N(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=n.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Rn],!0}addEventListener(t,e,n){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:Du,detach:Lu,resize:Ru}[e]||Iu;s[e]=a(t,e,n)}removeEventListener(t,e){let n=t.$proxies||(t.$proxies={}),s=n[e];if(!s)return;({attach:yo,detach:yo,resize:yo}[e]||Tu)(t,e,s),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,s){return Dr(t,e,n,s)}isAttached(t){let e=t&&Sn(t);return!!(e&&e.isConnected)}};wt=class{constructor(){M(this,"x");M(this,"y");M(this,"active",!1);M(this,"options");M(this,"$animations")}tooltipPosition(t){let{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return Ee(this.x)&&Ee(this.y)}getProps(t,e){let n=this.$animations;if(!e||!n)return this;let s={};return t.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}};M(wt,"defaults",{}),M(wt,"defaultRoutes");Vu=i=>i==="left"?"right":i==="right"?"left":i,Zr=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Qr=(i,t)=>Math.min(t||i,i);_e=class i extends wt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:s}=this;return t=yt(t,Number.POSITIVE_INFINITY),e=yt(e,Number.NEGATIVE_INFINITY),n=yt(n,Number.POSITIVE_INFINITY),s=yt(s,Number.NEGATIVE_INFINITY),{min:yt(t,n),max:yt(e,s),minDefined:Q(t),maxDefined:Q(e)}}getMinMax(t){let{min:e,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:n};let r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),o||(n=Math.max(n,a.max));return e=o&&e>n?n:e,n=s&&e>n?e:n,{min:yt(e,yt(n,e)),max:yt(n,yt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let 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(){W(this.options.beforeUpdate,[this])}update(t,e,n){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=wr(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?tl(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Bu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,n;this.isHorizontal()?(e=this.left,n=this.right):(e=this.top,n=this.bottom,t=!t),this._startPixel=e,this._endPixel=n,this._reversePixels=t,this._length=n-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){W(this.options.afterUpdate,[this])}beforeSetDimensions(){W(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(){W(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),W(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){W(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,n,s,o;for(n=0,s=t.length;n<s;n++)o=t[n],o.label=W(e.callback,[o.value,n,t],this)}afterTickToLabelConversion(){W(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){W(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,n=Qr(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,o=e.maxRotation,a=s,r,l,c;if(!this._isVisible()||!e.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}let d=this._getLabelSizes(),h=d.widest.width,u=d.highest.height,f=at(this.chart.width-h,0,this.maxWidth);r=t.offset?this.maxWidth/n:f/(n-1),h+6>r&&(r=f/(n-(t.offset?.5:1)),l=this.maxHeight-Di(t.grid)-e.padding-el(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),a=xn(Math.min(Math.asin(at((d.highest.height+6)/r,-1,1)),Math.asin(at(l/c,-1,1))-Math.asin(at(u/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){W(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){W(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:n,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=el(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Di(o)+l):(t.height=this.maxHeight,t.width=Di(o)+l),n.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=n.padding*2,p=At(this.labelRotation),m=Math.cos(p),g=Math.sin(p);if(r){let x=n.mirror?0:g*h.width+m*u.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{let x=n.mirror?0:m*h.width+g*u.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(c,d,g,m)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,s){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=s*t.width,f=n*e.height):(u=n*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-d+a)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+a)*this.width/(this.width-h),0)}else{let d=e.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=e.height,h=0),this.paddingTop=d+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){W(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e<n;e++)N(t[e].label)&&(t.splice(e,1),n--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,n=this.ticks;e<n.length&&(n=tl(n,e)),this._labelSizes=t=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,n){let{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/Qr(e,n)),c=0,d=0,h,u,f,p,m,g,x,_,C,y,v;for(h=0;h<e;h+=l){if(p=t[h].label,m=this._resolveTickFontOptions(h),s.font=g=m.string,x=o[g]=o[g]||{data:{},gc:[]},_=m.lineHeight,C=y=0,!N(p)&&!U(p))C=ki(s,x.data,x.gc,C,p),y=_;else if(U(p))for(u=0,f=p.length;u<f;++u)v=p[u],!N(v)&&!U(v)&&(C=ki(s,x.data,x.gc,C,v),y+=_);a.push(C),r.push(y),c=Math.max(C,c),d=Math.max(y,d)}ju(o,e);let w=a.indexOf(c),S=r.indexOf(d),E=L=>({width:a[L]||0,height:r[L]||0});return{first:E(0),last:E(e-1),widest:E(w),highest:E(S),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return fr(this._alignToPixels?de(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let n=e[t];return n.$context||(n.$context=Yu(this.getContext(),t,n))}return this.$context||(this.$context=Uu(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=At(this.labelRotation),n=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*n>r*s?r/n:l/s:l*s<r*n?l/n:r/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,n=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),u=Di(o),f=[],p=r.setContext(this.getContext()),m=p.display?p.width:0,g=m/2,x=function(j){return de(n,j,m)},_,C,y,v,w,S,E,L,R,A,I,et;if(a==="top")_=x(this.bottom),S=this.bottom-u,L=_-g,A=x(t.top)+g,et=t.bottom;else if(a==="bottom")_=x(this.top),A=t.top,et=x(t.bottom)-g,S=_+g,L=this.top+u;else if(a==="left")_=x(this.right),w=this.right-u,E=_-g,R=x(t.left)+g,I=t.right;else if(a==="right")_=x(this.left),R=t.left,I=x(t.right)-g,w=_+g,E=this.left+u;else if(e==="x"){if(a==="center")_=x((t.top+t.bottom)/2+.5);else if(F(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}A=t.top,et=t.bottom,S=_+g,L=S+u}else if(e==="y"){if(a==="center")_=x((t.left+t.right)/2);else if(F(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}w=_-g,E=w-u,R=t.left,I=t.right}let lt=O(s.ticks.maxTicksLimit,h),H=Math.max(1,Math.ceil(h/lt));for(C=0;C<h;C+=H){let j=this.getContext(C),K=o.setContext(j),xt=r.setContext(j),rt=K.lineWidth,Yt=K.color,q=xt.dash||[],Gt=xt.dashOffset,J=K.tickWidth,Ot=K.tickColor,V=K.tickBorderDash||[],Mt=K.tickBorderDashOffset;y=Wu(this,C,l),y!==void 0&&(v=de(n,y,rt),c?w=E=R=I=v:S=L=A=et=v,f.push({tx1:w,ty1:S,tx2:E,ty2:L,x1:R,y1:A,x2:I,y2:et,width:rt,color:Yt,borderDash:q,borderDashOffset:Gt,tickWidth:J,tickColor:Ot,tickBorderDash:V,tickBorderDashOffset:Mt}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){let e=this.axis,n=this.options,{position:s,ticks:o}=n,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=Di(n.grid),f=u+d,p=h?-d:f,m=-At(this.labelRotation),g=[],x,_,C,y,v,w,S,E,L,R,A,I,et="middle";if(s==="top")w=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")w=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){let H=this._getYAxisLabelAlignment(u);S=H.textAlign,v=H.x}else if(s==="right"){let H=this._getYAxisLabelAlignment(u);S=H.textAlign,v=H.x}else if(e==="x"){if(s==="center")w=(t.top+t.bottom)/2+f;else if(F(s)){let H=Object.keys(s)[0],j=s[H];w=this.chart.scales[H].getPixelForValue(j)+f}S=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(F(s)){let H=Object.keys(s)[0],j=s[H];v=this.chart.scales[H].getPixelForValue(j)}S=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?et="top":l==="end"&&(et="bottom"));let lt=this._getLabelSizes();for(x=0,_=r.length;x<_;++x){C=r[x],y=C.label;let H=o.setContext(this.getContext(x));E=this.getPixelForTick(x)+o.labelOffset,L=this._resolveTickFontOptions(x),R=L.lineHeight,A=U(y)?y.length:1;let j=A/2,K=H.color,xt=H.textStrokeColor,rt=H.textStrokeWidth,Yt=S;a?(v=E,S==="inner"&&(x===_-1?Yt=this.options.reverse?"left":"right":x===0?Yt=this.options.reverse?"right":"left":Yt="center"),s==="top"?c==="near"||m!==0?I=-A*R+R/2:c==="center"?I=-lt.highest.height/2-j*R+R:I=-lt.highest.height+R/2:c==="near"||m!==0?I=R/2:c==="center"?I=lt.highest.height/2-j*R:I=lt.highest.height-A*R,h&&(I*=-1),m!==0&&!H.showLabelBackdrop&&(v+=R/2*Math.sin(m))):(w=E,I=(1-A)*R/2);let q;if(H.showLabelBackdrop){let Gt=ut(H.backdropPadding),J=lt.heights[x],Ot=lt.widths[x],V=I-Gt.top,Mt=0-Gt.left;switch(et){case"middle":V-=J/2;break;case"bottom":V-=J;break}switch(S){case"center":Mt-=Ot/2;break;case"right":Mt-=Ot;break;case"inner":x===_-1?Mt-=Ot:x>0&&(Mt-=Ot/2);break}q={left:Mt,top:V,width:Ot+Gt.width,height:J+Gt.height,color:H.backdropColor}}g.push({label:y,font:L,textOffset:I,options:{rotation:m,color:K,strokeColor:xt,strokeWidth:rt,textAlign:Yt,textBaseline:et,translation:[v,w],backdrop:q}})}return g}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-At(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,c,d;return e==="left"?s?(d=this.right+o,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?s?(d=this.left+o,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:n,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,s,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,d)=>{!d.width||!d.color||(n.save(),n.lineWidth=d.width,n.strokeStyle=d.color,n.setLineDash(d.borderDash||[]),n.lineDashOffset=d.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,a=s.length;o<a;++o){let l=s[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),a=n.display?o.width:0;if(!a)return;let r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,d,h,u;this.isHorizontal()?(c=de(t,this.left,a)-a/2,d=de(t,this.right,r)+r/2,h=u=l):(h=de(t,this.top,a)-a/2,u=de(t,this.bottom,r)+r/2,c=d=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,h),e.lineTo(d,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let n=this.ctx,s=this._computeLabelArea();s&&Mi(n,s);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,d=a.textOffset;he(n,c,0,d,l,r)}s&&Si(n)}drawTitle(){let{ctx:t,options:{position:e,title:n,reverse:s}}=this;if(!n.display)return;let o=st(n.font),a=ut(n.padding),r=n.align,l=o.lineHeight/2;e==="bottom"||e==="center"||F(e)?(l+=a.bottom,U(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=a.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=Xu(this,l,e,r);he(t,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:u,textAlign:Gu(r,e,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,n=O(t.grid&&t.grid.z,-1),s=O(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==i.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[n]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return st(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},si=class{constructor(t,e,n){this.type=t,this.scope=e,this.override=n,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),n;Ju(e)&&(n=this.register(e));let s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Ku(t,a,n),this.override&&G.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,n=t.id,s=this.scope;n in e&&delete e[n],s&&n in G[s]&&(delete G[s][n],this.override&&delete ce[n])}};Eo=class{constructor(){this.controllers=new si(Ct,"datasets",!0),this.elements=new si(wt,"elements"),this.plugins=new si(Object,"plugins"),this.scales=new si(_e,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,n){[...e].forEach(s=>{let o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):$(s,a=>{let r=n||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,n){let s=bn(t);W(n["before"+s],[],n),e[t](n),W(n["after"+s],[],n)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let n=this._typedRegistries[e];if(n.isForType(t))return n}return this.plugins}_get(t,e,n){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+n+".");return s}},Lt=new Eo,To=class{constructor(){this._init=void 0}notify(t,e,n,s){if(e==="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),a=this._notify(o,t,e,n);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,n,s){s=s||{};for(let o of t){let a=o.plugin,r=a[n],l=[e,s,o.options];if(W(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){N(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let n=t&&t.config,s=O(n.options&&n.options.plugins,{}),o=Zu(n);return s===!1&&!e?[]:tf(t,o,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],n=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,n),t,"stop"),this._notify(s(n,e),t,"start")}};sl=new Map,Xl=new Set;Li=(i,t,e)=>{let n=te(t,e);n!==void 0&&i.add(n)},Lo=class{constructor(t){this._config=lf(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=Gl(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(),Yl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Dn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Dn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Dn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,n=this.type;return Dn(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let n=this._scopeCache,s=n.get(t);return(!s||e)&&(s=new Map,n.set(t,s)),s}getOptionScopes(t,e,n){let{options:s,type:o}=this,a=this._cachedScopes(t,n),r=a.get(e);if(r)return r;let l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(h=>Li(l,t,h))),d.forEach(h=>Li(l,s,h)),d.forEach(h=>Li(l,ce[o]||{},h)),d.forEach(h=>Li(l,G,h)),d.forEach(h=>Li(l,vn,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Xl.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,ce[e]||{},G.datasets[e]||{},{type:e},G,vn]}resolveNamedOptions(t,e,n,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=ol(this._resolverCache,t,s),l=a;if(df(a,e)){o.$shared=!1,n=Zt(n)?n():n;let c=this.createResolver(t,n,r);l=Se(a,n,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],s){let{resolver:o}=ol(this._resolverCache,t,n);return F(e)?Se(o,e,void 0,s):o}};cf=i=>F(i)&&Object.getOwnPropertyNames(i).some(t=>Zt(i[t]));hf="4.5.1",uf=["top","bottom","left","right","chartArea"];In={},cl=i=>{let t=Kl(i);return Object.values(In).filter(e=>e.canvas===t).pop()};jt=class{static register(...t){Lt.add(...t),dl()}static unregister(...t){Lt.remove(...t),dl()}constructor(t,e){let n=this.config=new Lo(e),s=Kl(t),o=cl(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Ul(s)),this.platform.updateConfig(n);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=rr(),this.ctx=r,this.canvas=l,this.width=d,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new To,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xr(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],In[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Wt.listen(this,"complete",ll),Wt.listen(this,"progress",ff),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:s,_aspectRatio:o}=this;return N(t)?e&&o?o:s?n/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 Lt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ao(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Qs(this.canvas,this.ctx),this}stop(){return Wt.stop(this),this}resize(t,e){Wt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let n=this.options,s=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,ao(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),W(n.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};$(e,(n,s)=>{n.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,n=this.scales,s=Object.keys(n).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Do(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),$(o,a=>{let r=a.options,l=r.id,c=Do(l,r),d=O(r.type,a.dtype);(r.position===void 0||al(r.position,c)!==al(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in n&&n[l].type===d)h=n[l];else{let u=Lt.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(r,t)}),$(s,(a,r)=>{a||delete n[r]}),$(n,a=>{ft.configure(this,a,a.options),ft.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((s,o)=>s.index-o.index),n>e){for(let s=e;s<n;++s)this._destroyDatasetMeta(s);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(rl("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,s)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,n,s;for(this._removeUnreferencedMetasets(),n=0,s=e.length;n<s;n++){let o=e[n],a=this.getDatasetMeta(n),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=r,a.indexAxis=o.indexAxis||Ao(r,this.options),a.order=o.order||0,a.index=n,a.label=""+o.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{let l=Lt.getController(r),{datasetElementType:c,dataElementType:d}=G.datasets[r];Object.assign(l,{dataElementType:Lt.getElement(d),datasetElementType:c&&Lt.getElement(c)}),a.controller=new l(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){$(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,d=this.data.datasets.length;c<d;c++){let{controller:h}=this.getDatasetMeta(c),u=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(u),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),s||$(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(rl("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){$(this.scales,t=>{ft.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!Hs(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:n,start:s,count:o}of e){let a=n==="_removeElements"?-o:o;pf(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,n=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=n(0);for(let o=1;o<e;o++)if(!Hs(s,n(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;ft.update(this,this.width,this.height,t);let e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],$(this.boxes,s=>{n&&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 e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,Zt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let n=this.getDatasetMeta(t),s={meta:n,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(n.controller._update(e),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(),ll({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,n=[],s,o;for(s=0,o=e.length;s<o;++s){let a=e[s];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,n={meta:t,index:t.index,cancelable:!0},s=fo(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(s&&Mi(e,s),t.controller.draw(),s&&Si(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return zt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,s){let o=Hl.modes[e];return typeof o=="function"?o(this,t,n,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],n=this._metasets,s=n.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(s)),s}getContext(){return this.$context||(this.$context=ee(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){let n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){let s=n?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Ke(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(o,{visible:n}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Wt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Qs(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete In[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,e=this.platform,n=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};$(this.options.events,o=>n(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),n("resize",o),n("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),n("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){$(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},$(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){let s=n?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],n=t.map(({datasetIndex:o,index:a})=>{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!wi(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){let s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),a=o(e,t),r=n?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,s)===!1)return;let o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,s),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,n,a),l=dr(t),c=mf(t,this._lastEvent,n,l);n&&(this._lastEvent=null,W(o.onHover,[t,r,this],this),l&&W(o.onClick,[t,r,this],this));let d=!wi(r,s);return(d||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,d}_getActiveElements(t,e,n,s){if(t.type==="mouseout")return[];if(!n)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};M(jt,"defaults",G),M(jt,"instances",In),M(jt,"overrides",ce),M(jt,"registry",Lt),M(jt,"version",hf),M(jt,"getChart",cl);pe=class extends wt{constructor(e){super();M(this,"circumference");M(this,"endAngle");M(this,"fullCircles");M(this,"innerRadius");M(this,"outerRadius");M(this,"pixelMargin");M(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,s){let o=this.getProps(["x","y"],s),{angle:a,distance:r}=js(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),f=(this.options.spacing+this.options.borderWidth)/2,p=O(u,c-l),m=Je(a,l,c)&&l!==c,g=p>=Y||m,x=$t(r,d+f,h+f);return g&&x}getCenterPoint(e){let{x:n,y:s,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:d}=this.options,h=(o+a)/2,u=(r+l+d+c)/2;return{x:n+Math.cos(h)*u,y:s+Math.sin(h)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:n,circumference:s}=this,o=(n.offset||0)/4,a=(n.spacing||0)/2,r=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=s>Y?Math.floor(s/Y):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);let c=1-Math.sin(Math.min(z,s||0)),d=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,yf(e,this,d,a,r),vf(e,this,d,a,r),e.restore()}};M(pe,"id","arc"),M(pe,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),M(pe,"defaultRoutes",{backgroundColor:"backgroundColor"}),M(pe,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Af=typeof Path2D=="function";Pt=class extends wt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let s=n.spanGaps?this._loop:this._fullLoop;Ar(this._points,n,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ir(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){let n=this.options,s=t[e],o=this.points,a=uo(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Sf(n),c,d;for(c=0,d=a.length;c<d;++c){let{start:h,end:u}=a[c],f=o[h],p=o[u];if(f===p){r.push(f);continue}let m=Math.abs((s-f[e])/(p[e]-f[e])),g=l(f,p,m,n.stepped);g[e]=t[e],r.push(g)}return r.length===1?r[0]:r}pathSegment(t,e,n){return Po(this)(t,this,e,n)}path(t,e,n){let s=this.segments,o=Po(this),a=this._loop;e=e||0,n=n||this.points.length-e;for(let r of s)a&=o(t,this,r,{start:e,end:e+n-1});return!!a}draw(t,e,n,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Df(t,this,n,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};M(Pt,"id","line"),M(Pt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),M(Pt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),M(Pt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});Be=class extends wt{constructor(e){super();M(this,"parsed");M(this,"skip");M(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,s){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(n-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,n){return hl(this,e,"x",n)}inYRange(e,n){return hl(this,e,"y",n)}getCenterPoint(e){let{x:n,y:s}=this.getProps(["x","y"],e);return{x:n,y:s}}size(e){e=e||this.options||{};let n=e.radius||0;n=Math.max(n,n&&e.hoverRadius||0);let s=n&&e.borderWidth||0;return(n+s)*2}draw(e,n){let s=this.options;this.skip||s.radius<.1||!zt(this,n,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Cn(e,s,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};M(Be,"id","point"),M(Be,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),M(Be,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Ne=class extends wt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:a}=Of(this),r=Rf(a.radius)?ti:If;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Co(a,e,o)),t.clip(),r(t,Co(o,-e,a)),t.fillStyle=n,t.fill("evenodd")),t.beginPath(),r(t,Co(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,n){return vo(this,t,e,n)}inXRange(t,e){return vo(this,t,null,e)}inYRange(t,e){return vo(this,null,t,e)}getCenterPoint(t){let{x:e,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?n:(n+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};M(Ne,"id","bar"),M(Ne,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),M(Ne,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Ql=Object.freeze({__proto__:null,ArcElement:pe,BarElement:Ne,LineElement:Pt,PointElement:Be}),Oo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],ul=Oo.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));ic={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,t,e){if(!e.enabled)return;let{data:{datasets:n},options:s}=i.config,{elements:o}=s,a=fl(n)||Hf(s)||o&&fl(o)||$f();if(!e.forceOverride&&a)return;let r=zf(i);n.forEach(r)}};sc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,e)=>{if(!e.enabled){pl(i);return}let n=i.width;i.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=i.getDatasetMeta(o),c=a||s.data;if(ei([r,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=i.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||i.options.parsing)return;let{start:h,count:u}=jf(l,c),f=e.threshold||4*n;if(u<=f){nc(s);return}N(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let p;switch(e.algorithm){case"lttb":p=Vf(c,h,u,n,e);break;case"min-max":p=Wf(c,h,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(i){pl(i)}};$n=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){let{x:s,y:o,radius:a}=this;return e=e||{start:0,end:Y},t.arc(s,o,a,e.end,e.start,!0),!n.bounds}interpolate(t){let{x:e,y:n,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}};ac={id:"filler",afterDatasetsUpdate(i,t,e){let n=(i.data.datasets||[]).length,s=[],o,a,r,l;for(a=0;a<n;++a)o=i.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Pt&&(l={visible:i.isDatasetVisible(a),index:a,fill:Xf(r,a,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<n;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=Gf(s,a,e.propagate))},beforeDraw(i,t,e){let n=e.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let a=s.length-1;a>=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),n&&r.fill&&ko(i.ctx,r,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){let o=n[s].$filler;gl(o)&&ko(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){let n=t.meta.$filler;!gl(n)||e.drawTime!=="beforeDatasetDraw"||ko(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},yl=(i,t)=>{let{boxHeight:e=t,boxWidth:n=t}=i;return i.usePointStyle&&(e=Math.min(e,t),n=i.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},dp=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index,Vn=class extends wt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=W(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,s)=>t.sort(n,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let n=t.labels,s=st(n.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=yl(n,o),c,d;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(a,o,r,l)+10):(d=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,s){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+r,h=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-d;return this.legendItems.forEach((p,m)=>{let g=n+e/2+o.measureText(p.text).width;(m===0||c[c.length-1]+g+2*r>a)&&(h+=d,c[c.length-(m>0?0:1)]=0,f+=d,u++),l[m]={left:0,top:f,row:u,width:g,height:s},c[c.length-1]+=g+r}),h}_fitCols(t,e,n,s){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=a-t,h=r,u=0,f=0,p=0,m=0;return this.legendItems.forEach((g,x)=>{let{itemWidth:_,itemHeight:C}=hp(n,e,o,g,s);x>0&&f+C+2*r>d&&(h+=u+r,c.push({width:u,height:f}),p+=u+r,m++,u=f=0),l[x]={left:p,top:f,col:m,width:_,height:C},u=Math.max(u,_),f+=C+r}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:s},rtl:o}}=this,a=Te(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ht(n,this.left+s,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=ht(n,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=ht(n,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=ht(n,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Mi(t,this),this._draw(),Si(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:n,ctx:s}=this,{align:o,labels:a}=t,r=G.color,l=Te(t.rtl,this.left,this.width),c=st(a.font),{padding:d}=a,h=c.size,u=h/2,f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:p,boxHeight:m,itemHeight:g}=yl(a,h),x=function(w,S,E){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();let L=O(E.lineWidth,1);if(s.fillStyle=O(E.fillStyle,r),s.lineCap=O(E.lineCap,"butt"),s.lineDashOffset=O(E.lineDashOffset,0),s.lineJoin=O(E.lineJoin,"miter"),s.lineWidth=L,s.strokeStyle=O(E.strokeStyle,r),s.setLineDash(O(E.lineDash,[])),a.usePointStyle){let R={radius:m*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:L},A=l.xPlus(w,p/2),I=S+u;to(s,R,A,I,a.pointStyleWidth&&p)}else{let R=S+Math.max((h-m)/2,0),A=l.leftForLtr(w,p),I=ue(E.borderRadius);s.beginPath(),Object.values(I).some(et=>et!==0)?ti(s,{x:A,y:R,w:p,h:m,radius:I}):s.rect(A,R,p,m),s.fill(),L!==0&&s.stroke()}s.restore()},_=function(w,S,E){he(s,E.text,w,S+g/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),y=this._computeTitleHeight();C?f={x:ht(o,this.left+d,this.right-n[0]),y:this.top+d+y,line:0}:f={x:this.left+d,y:ht(o,this.top+y+d,this.bottom-e[0].height),line:0},lo(this.ctx,t.textDirection);let v=g+d;this.legendItems.forEach((w,S)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;let E=s.measureText(w.text).width,L=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),R=p+u+E,A=f.x,I=f.y;l.setWidth(this.width),C?S>0&&A+R+d>this.right&&(I=f.y+=v,f.line++,A=f.x=ht(o,this.left+d,this.right-n[f.line])):S>0&&I+v>this.bottom&&(A=f.x=A+e[f.line].width+d,f.line++,I=f.y=ht(o,this.top+y+d,this.bottom-e[f.line].height));let et=l.x(A);if(x(et,I,w),A=_r(L,A+p+u,C?A+R:this.right,t.rtl),_(l.x(A),I,w),C)f.x+=R+d;else if(typeof w.text!="string"){let lt=c.lineHeight;f.y+=rc(w,lt)+d}else f.y+=v}),co(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,n=st(e.font),s=ut(e.padding);if(!e.display)return;let o=Te(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=n.size/2,c=s.top+l,d,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),d=this.top+c,h=ht(t.align,h,this.right-u);else{let p=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);d=c+ht(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}let f=ht(r,h,h+u);a.textAlign=o.textAlign(yn(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=n.string,he(a,e.text,f,d,n)}_computeTitleHeight(){let t=this.options.title,e=st(t.font),n=ut(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,s,o;if($t(t,this.left,this.right)&&$t(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],$t(t,s.left,s.left+s.width)&&$t(e,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(t){let e=this.options;if(!pp(t.type,e))return;let n=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=dp(s,n);s&&!o&&W(e.onLeave,[t,s,this],this),this._hoveredItem=n,n&&!o&&W(e.onHover,[t,n,this],this)}else n&&W(e.onClick,[t,n,this],this)}};lc={id:"legend",_element:Vn,start(i,t,e){let n=i.legend=new Vn({ctx:i.ctx,options:e,chart:i});ft.configure(i,n,e),ft.addBox(i,n)},stop(i){ft.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){let n=i.legend;ft.configure(i,n,e),n.options=e},afterUpdate(i){let t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){let n=t.datasetIndex,s=e.chart;s.isDatasetVisible(n)?(s.hide(n),t.hidden=!0):(s.show(n),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){let t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),d=ut(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}},Fi=class extends wt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=U(n.text)?n.text.length:1;this._padding=ut(n.padding);let o=s*st(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:n,bottom:s,right:o,options:a}=this,r=a.align,l=0,c,d,h;return this.isHorizontal()?(d=ht(r,n,o),h=e+t,c=o-n):(a.position==="left"?(d=n+t,h=ht(r,s,e),l=z*-.5):(d=o-t,h=ht(r,e,s),l=z*.5),c=s-e),{titleX:d,titleY:h,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let n=st(e.font),o=n.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);he(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:yn(e.align),textBaseline:"middle",translation:[a,r]})}};cc={id:"title",_element:Fi,start(i,t,e){mp(i,e)},stop(i){let t=i.titleBlock;ft.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){let n=i.titleBlock;ft.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Ln=new WeakMap,dc={id:"subtitle",start(i,t,e){let n=new Fi({ctx:i.ctx,options:e,chart:i});ft.configure(i,n,e),ft.addBox(i,n),Ln.set(i,n)},stop(i){ft.removeBox(i,Ln.get(i)),Ln.delete(i)},beforeUpdate(i,t,e){let n=Ln.get(i);ft.configure(i,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Oi={average(i){if(!i.length)return!1;let t,e,n=new Set,s=0,o=0;for(t=0,e=i.length;t<e;++t){let r=i[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();n.add(l.x),s+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((r,l)=>r+l)/n.size,y:s/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,n=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=i.length;o<a;++o){let l=i[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=mn(t,c);d<s&&(s=d,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,n=l.y}return{x:e,y:n}}};hc={beforeTitle:Ht,title(i){if(i.length>0){let t=i[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex<n)return e[t.dataIndex]}return""},afterTitle:Ht,beforeBody:Ht,beforeLabel:Ht,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");let e=i.formattedValue;return N(e)||(t+=e),t},labelColor(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){let e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ht,afterBody:Ht,beforeFooter:Ht,footer:Ht,afterFooter:Ht};Ri=class extends wt{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 e=this.chart,n=this.options.setContext(this.getContext()),s=n.enabled&&e.options.animation&&n.animations,o=new Ii(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Cp(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:n}=e,s=vt(n,"beforeTitle",this,t),o=vt(n,"title",this,t),a=vt(n,"afterTitle",this,t),r=[];return r=Vt(r,ie(s)),r=Vt(r,ie(o)),r=Vt(r,ie(a)),r}getBeforeBody(t,e){return wl(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:n}=e,s=[];return $(t,o=>{let a={before:[],lines:[],after:[]},r=Ml(n,o);Vt(a.before,ie(vt(r,"beforeLabel",this,o))),Vt(a.lines,vt(r,"label",this,o)),Vt(a.after,ie(vt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return wl(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:n}=e,s=vt(n,"beforeFooter",this,t),o=vt(n,"footer",this,t),a=vt(n,"afterFooter",this,t),r=[];return r=Vt(r,ie(s)),r=Vt(r,ie(o)),r=Vt(r,ie(a)),r}_createItems(t){let e=this._active,n=this.chart.data,s=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(gp(this.chart,e[l]));return t.filter&&(r=r.filter((d,h,u)=>t.filter(d,h,u,n))),t.itemSort&&(r=r.sort((d,h)=>t.itemSort(d,h,n))),$(r,d=>{let h=Ml(t.callbacks,d);s.push(vt(h,"labelColor",this,d)),o.push(vt(h,"labelPointStyle",this,d)),a.push(vt(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let n=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=Oi[n.position].call(this,s,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let l=this._size=vl(this,n),c=Object.assign({},r,l),d=Cl(this.chart,n,c),h=kl(n,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,s){let o=this.getCaretPosition(t,n,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=n,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=ue(r),{x:u,y:f}=t,{width:p,height:m}=e,g,x,_,C,y,v;return o==="center"?(y=f+m/2,s==="left"?(g=u,x=g-a,C=y+a,v=y-a):(g=u+p,x=g+a,C=y-a,v=y+a),_=g):(s==="left"?x=u+Math.max(l,d)+a:s==="right"?x=u+p-Math.max(c,h)-a:x=this.caretX,o==="top"?(C=f,y=C-a,g=x-a,_=x+a):(C=f+m,y=C+a,g=x+a,_=x-a),v=C),{x1:g,x2:x,x3:_,y1:C,y2:y,y3:v}}drawTitle(t,e,n){let s=this.title,o=s.length,a,r,l;if(o){let c=Te(n.rtl,this.x,this.width);for(t.x=Pn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",a=st(n.titleFont),r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,n,s,o){let a=this.labelColors[n],r=this.labelPointStyles[n],{boxHeight:l,boxWidth:c}=o,d=st(o.bodyFont),h=Pn(this,"left",o),u=s.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,p=e.y+f;if(o.usePointStyle){let m={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=s.leftForLtr(u,c)+c/2,x=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Cn(t,m,g,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Cn(t,m,g,x)}else{t.lineWidth=F(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let m=s.leftForLtr(u,c),g=s.leftForLtr(s.xPlus(u,1),c-2),x=ue(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ti(t,{x:m,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ti(t,{x:g,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(m,p,c,l),t.strokeRect(m,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(g,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=n,h=st(n.bodyFont),u=h.lineHeight,f=0,p=Te(n.rtl,this.x,this.width),m=function(E){e.fillText(E,p.x(t.x+f),t.y+u/2),t.y+=u+o},g=p.textAlign(a),x,_,C,y,v,w,S;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=Pn(this,g,n),e.fillStyle=n.bodyColor,$(this.beforeBody,m),f=r&&g!=="right"?a==="center"?c/2+d:c+2+d:0,y=0,w=s.length;y<w;++y){for(x=s[y],_=this.labelTextColors[y],e.fillStyle=_,$(x.before,m),C=x.lines,r&&C.length&&(this._drawColorBox(e,t,y,p,n),u=Math.max(h.lineHeight,l)),v=0,S=C.length;v<S;++v)m(C[v]),u=h.lineHeight;$(x.after,m)}f=0,u=h.lineHeight,$(this.afterBody,m),t.y-=o}drawFooter(t,e,n){let s=this.footer,o=s.length,a,r;if(o){let l=Te(n.rtl,this.x,this.width);for(t.x=Pn(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",a=st(n.footerFont),e.fillStyle=n.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,e,n,s){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:d}=n,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:p}=ue(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(r+h,l),a==="top"&&this.drawCaret(t,e,n,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,n,s),e.lineTo(r+c,l+d-p),e.quadraticCurveTo(r+c,l+d,r+c-p,l+d),a==="bottom"&&this.drawCaret(t,e,n,s),e.lineTo(r+f,l+d),e.quadraticCurveTo(r,l+d,r,l+d-f),a==="center"&&o==="left"&&this.drawCaret(t,e,n,s),e.lineTo(r,l+h),e.quadraticCurveTo(r,l,r+h,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,n=this.$animations,s=n&&n.x,o=n&&n.y;if(s||o){let a=Oi[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=vl(this,t),l=Object.assign({},a,this._size),c=Cl(e,t,l),d=kl(t,l,c,e);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=ut(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,s,e),lo(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),co(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let n=this._active,s=t.map(({datasetIndex:r,index:l})=>{let c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!wi(n,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,n),r=this._positionChanged(a,t),l=e||!wi(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:n,caretY:s,options:o}=this,a=Oi[o.position].call(this,t,e);return a!==!1&&(n!==a.x||s!==a.y)}};M(Ri,"positioners",Oi);uc={id:"tooltip",_element:Ri,positioners:Oi,afterInit(i,t,e){e&&(i.tooltip=new Ri({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){let t=i.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){let e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,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:hc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},fc=Object.freeze({__proto__:null,Colors:ic,Decimation:sc,Filler:ac,Legend:lc,SubTitle:dc,Title:cc,Tooltip:uc}),kp=(i,t,e,n)=>(typeof t=="string"?(e=i.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Mp=(i,t)=>i===null?null:at(Math.round(i),0,t);oi=class extends _e{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let n=this.getLabels();for(let{index:s,label:o}of e)n[s]===o&&n.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(N(t))return null;let n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:wp(n,t,O(e,t),this._addedLabels),Mp(e,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:n,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(s=this.getLabels().length-1)),this.min=n,this.max=s}buildTicks(){let t=this.min,e=this.max,n=this.options.offset,s=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Sl.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 e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};M(oi,"id","category"),M(oi,"defaults",{ticks:{callback:Sl}});ci=class extends _e{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return N(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=n?o:l;if(t){let l=Dt(s),c=Dt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:n}=t,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,n=this.getTickLimit();n=Math.max(2,n);let s={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Sp(s,o);return t.bounds==="ticks"&&Vs(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){let s=(n-e)/Math.max(t.length-1,1)/2;e-=s,n+=s}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return Ze(t,this.chart.options.locale,this.options.ticks.format)}},ai=class extends ci{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?t:0,this.max=Q(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,n=At(this.options.ticks.minRotation),s=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/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}};M(ai,"id","linear"),M(ai,"defaults",{ticks:{callback:Qe.formatters.numeric}});zi=i=>Math.floor(Qt(i)),De=(i,t)=>Math.pow(10,zi(i)+t);ri=class extends _e{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let n=ci.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return Q(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Q(t)?Math.max(0,t):null,this.max=Q(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Q(this._userMin)&&(this.min=t===De(this.min,0)?De(this.min,-1):De(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),n=this.min,s=this.max,o=r=>n=t?n:r,a=r=>s=e?s:r;n===s&&(n<=0?(o(1),a(10)):(o(De(n,-1)),a(De(s,1)))),n<=0&&o(De(s,-1)),s<=0&&a(De(n,1)),this.min=n,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},n=Tp(e,this);return t.bounds==="ticks"&&Vs(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":Ze(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Qt(t),this._valueRange=Qt(this.max)-Qt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Qt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};M(ri,"id","logarithmic"),M(ri,"defaults",{ticks:{callback:Qe.formatters.logarithmic,major:{enabled:!0}}});me=class extends ci{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=ut(Io(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=Q(t)&&!isNaN(t)?t:0,this.max=Q(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Io(this.options))}generateTickLabels(t){ci.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{let s=W(this.options.pointLabels.callback,[e,n],this);return s||s===0?s:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){let t=this.options;t.display&&t.pointLabels.display?Dp(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,s))}getIndexAngle(t){let e=Y/(this._pointLabels.length||1),n=this.options.startAngle||0;return dt(t*e+At(n))}getDistanceFromCenterForValue(t){if(N(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(N(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let n=e[t];return $p(this.getContext(),t,n)}}getPointPosition(t,e,n=0){let s=this.getIndexAngle(t)-tt+n;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:n,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:n,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let n=this.ctx;n.save(),n.beginPath(),pc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),n.closePath(),n.fillStyle=t,n.fill(),n.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:n,grid:s,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&zp(this,a),s.display&&this.ticks.forEach((d,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);let u=this.getContext(h),f=s.setContext(u),p=o.setContext(u);Hp(this,f,l,a,p)}}),n.display){for(t.save(),r=a-1;r>=0;r--){let d=n.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:u}=d;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;let s=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=n.setContext(this.getContext(l)),d=st(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;let h=ut(c.backdropPadding);t.fillRect(-a/2-h.left,-o-d.size/2-h.top,a+h.width,d.size+h.height)}he(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};M(me,"id","radialLinear"),M(me,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Qe.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),M(me,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),M(me,"descriptors",{angleLines:{_fallback:"grid"}});jn={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}},kt=Object.keys(jn);xe=class extends _e{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let n=t.time||(t.time={}),s=this._adapter=new zl._date(t.adapters.date);s.init(e),Xe(n.displayFormats,s.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Pl(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,n=t.time.unit||"day",{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Q(s)&&!isNaN(s)?s:+e.startOf(Date.now(),n),o=Q(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){let t=this.options,e=t.time,n=t.ticks,s=n.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,a=this.max,r=mr(s,o,a);return this._unit=e.unit||(n.autoSkip?Ol(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Vp(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Wp(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),Il(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=at(e,0,a),n=at(n,0,a),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){let t=this._adapter,e=this.min,n=this.max,s=this.options,o=s.time,a=o.unit||Ol(o.minUnit,e,n,this._getLabelCapacity(e)),r=O(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Ee(l)||l===!0,d={},h=e,u,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":a),t.diff(n,e,a)>1e5*r)throw new Error(e+" and "+n+" are too far apart with stepSize of "+r+" "+a);let p=s.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u<n;u=+t.add(u,r,a),f++)Rl(d,u,p);return(u===n||s.bounds==="ticks"||f===1)&&Rl(d,u,p),Object.keys(d).sort(Ll).map(m=>+m)}getLabelForValue(t){let e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,n,s){let o=this.options,a=o.ticks.callback;if(a)return W(a,[t,e,n],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],h=c&&r[c],u=n[e],f=c&&h&&u&&u.major;return this._adapter.format(t,s||(f?h:d))}generateTickLabels(t){let e,n,s;for(e=0,n=t.length;e<n;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,n=this.ctx.measureText(t).width,s=At(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:n*o+r*a,h:n*a+r*o}}_getLabelCapacity(t){let e=this.options.time,n=e.displayFormats,s=n[e.unit]||n.millisecond,o=this._tickFormatFunction(t,0,Il(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,n=s.length;e<n;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,n;if(t.length)return t;let s=this.getLabels();for(e=0,n=s.length;e<n;++e)t.push(Pl(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Ys(t.sort(Ll))}};M(xe,"id","time"),M(xe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});li=class extends xe{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=On(e,this.min),this._tableRange=On(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:n}=this,s=[],o=[],a,r,l,c,d;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=n&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(a=0,r=s.length;a<r;++a)d=s[a+1],l=s[a-1],c=s[a],Math.round((d+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){let t=this.min,e=this.max,n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(e)||n.length===1)&&n.push(e),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(On(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return On(this._table,n*this._tableRange+this._minPos,!0)}};M(li,"id","timeseries"),M(li,"defaults",xe.defaults);mc=Object.freeze({__proto__:null,CategoryScale:oi,LinearScale:ai,LogarithmicScale:ri,RadialLinearScale:me,TimeScale:xe,TimeSeriesScale:li}),Up=[Fl,Ql,fc,mc]});async function Yp(){return Un||(Un=await Promise.resolve().then(()=>(bc(),gc)),Un)}async function xc(i,t){let e=await Yp(),{Chart:n,BarController:s,LineController:o,PieController:a,DoughnutController:r,CategoryScale:l,LinearScale:c,BarElement:d,LineElement:h,PointElement:u,ArcElement:f,Title:p,Legend:m,Tooltip:g}=e;n.register(s,o,a,r,l,c,d,h,u,f,p,m,g);let x=document.createElement("canvas");x.setAttribute("data-testid","blex-chart-canvas"),i.appendChild(x);let _=new n(x,{type:t.type,data:{labels:t.data.labels,datasets:t.data.datasets.map(C=>({label:C.label,data:C.values,backgroundColor:C.color,borderColor:C.color}))},options:{responsive:t.options?.responsive??!0,plugins:{title:t.options?.title?{display:!0,text:t.options.title}:{display:!1},legend:{display:t.options?.legend??!0}}}});return i.setAttribute("data-blex-ready","true"),{update(C){C.data&&(_.data.labels=C.data.labels??_.data.labels,C.data.datasets&&(_.data.datasets=C.data.datasets.map(y=>({label:y.label,data:y.values,backgroundColor:y.color,borderColor:y.color})))),C.options?.title&&(_.options.plugins.title={display:!0,text:C.options.title}),_.update()},destroy(){_.destroy(),x.remove()}}}var Un,_c=Bt(()=>{"use strict";Un=null});var yc={};Ce(yc,{ChartRenderer:()=>Yn,createChartRenderer:()=>Gp});function Gp(){return new Yn}var Yn,vc=Bt(()=>{"use strict";Z();_c();Yn=class extends P{constructor(){super(...arguments);this.chartInstance=null}render(e,n){this.container=n;let s=document.createElement("div");s.className="blex-chart",s.setAttribute("data-testid",`blex-chart-${e.id}`),n.appendChild(s),xc(s,e.data).then(o=>{this.chartInstance=o,n.setAttribute("data-blex-ready","true")})}update(e){this.chartInstance&&this.chartInstance.update(e.data)}destroy(){this.chartInstance?.destroy(),this.chartInstance=null,super.destroy()}}});var Cc={};Ce(Cc,{KanbanRenderer:()=>Gn,createKanbanRenderer:()=>Xp});function Xp(){return new Gn}var Gn,kc=Bt(()=>{"use strict";Z();Gn=class extends P{constructor(){super(...arguments);this.draggedItemId=null;this.draggedFromColumn=null;this.draggedItemTitle=null;this.currentBlock=null;this.localColumns=[];this.originalColumns=[]}render(e,n){this.container=n,this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this.originalColumns=JSON.parse(JSON.stringify(e.data.columns)),this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this.originalColumns=JSON.parse(JSON.stringify(e.data.columns)),this.container.innerHTML="",this._build(e))}revertInteraction(e){if(!this.container||!this.currentBlock||e.type!=="move")return;let{itemId:n,fromColumn:s,toColumn:o}=e.payload,a=this.localColumns.find(h=>h.id===o),r=this.localColumns.find(h=>h.id===s);if(!a||!r)return;let l=a.items.findIndex(h=>h.id===n);if(l===-1)return;let[c]=a.items.splice(l,1);r.items.push(c),this.container.innerHTML="";let d={...this.currentBlock,data:{...this.currentBlock.data,columns:this.localColumns}};this._build(d)}_build(e){let n=this.container,{draggable:s=!0}=e.data,o=this.localColumns,a=document.createElement("div");a.className="blex-kanban",a.setAttribute("data-testid",`blex-kanban-${e.id}`);for(let r of o){let l=this._buildColumn(r,s,e);a.appendChild(l)}n.appendChild(a)}_buildColumn(e,n,s){let o=document.createElement("div");o.className="blex-kanban__column",o.setAttribute("data-testid",`blex-kanban-col-${e.id}`);let a=document.createElement("div");a.className="blex-kanban__column-title",a.textContent=e.title,o.appendChild(a);for(let r of e.items){let l=this._buildItem(r,e.id,n);o.appendChild(l)}return n&&(this.addListener(o,"dragover",r=>{r.preventDefault()}),this.addListener(o,"drop",r=>{if(r.preventDefault(),this.draggedItemId===null||this.draggedFromColumn===null||this.draggedItemTitle===null)return;let c=Array.from(o.querySelectorAll(".blex-kanban__item")).filter(g=>!g.classList.contains("blex-kanban__item--dragging")).length,d=this.draggedItemId,h=this.draggedFromColumn,u=this.draggedItemTitle,f=e.id;this.draggedItemId=null,this.draggedFromColumn=null,this.draggedItemTitle=null;let p=this.localColumns.find(g=>g.id===h),m=this.localColumns.find(g=>g.id===f);if(p&&m){let g=p.items.findIndex(x=>x.id===d);if(g!==-1){let[x]=p.items.splice(g,1);m.items.splice(c,0,x)}}if(this.container&&this.currentBlock){this.container.innerHTML="";let g={...this.currentBlock,data:{...this.currentBlock.data,columns:this.localColumns}};this._build(g)}this._columnsMatchOriginal()||this.emit({blockId:s.id,type:"move",payload:{itemId:d,fromColumn:h,toColumn:f,position:c},serialized:`Moved "${u}" from ${h} to ${f}`,summary:`Moved "${u}" \u2192 ${f}`,icon:"\u229E",immediate:!1,revertable:!0})})),o}_columnsMatchOriginal(){if(this.localColumns.length!==this.originalColumns.length)return!1;for(let e=0;e<this.localColumns.length;e++){let n=this.localColumns[e],s=this.originalColumns[e];if(n.id!==s.id||n.items.length!==s.items.length)return!1;for(let o=0;o<n.items.length;o++)if(n.items[o].id!==s.items[o].id)return!1}return!0}_buildItem(e,n,s){let o=document.createElement("div");o.className="blex-kanban__item",o.setAttribute("data-testid",`blex-kanban-item-${e.id}`),s&&(o.setAttribute("draggable","true"),this.addListener(o,"dragstart",()=>{this.draggedItemId=e.id,this.draggedFromColumn=n,this.draggedItemTitle=e.title,o.classList.add("blex-kanban__item--dragging")}),this.addListener(o,"dragend",()=>{o.classList.remove("blex-kanban__item--dragging")}));let a=document.createElement("div");if(a.className="blex-kanban__item-title",a.textContent=e.title,o.appendChild(a),e.subtitle){let r=document.createElement("div");r.className="blex-kanban__item-subtitle",r.textContent=e.subtitle,o.appendChild(r)}if(e.tags&&e.tags.length>0){let r=document.createElement("div");r.className="blex-kanban__item-tags";for(let l of e.tags){let c=document.createElement("span");c.textContent=l,r.appendChild(c)}o.appendChild(r)}return o}}});var Ec={};Ce(Ec,{CalendarRenderer:()=>Xn,createCalendarRenderer:()=>Kp});function Mc(i){let t=i.getFullYear(),e=String(i.getMonth()+1).padStart(2,"0"),n=String(i.getDate()).padStart(2,"0");return`${t}-${e}-${n}`}function Sc(i){let t=new Date(i);return t.setDate(t.getDate()-t.getDay()),t}function Kp(){return new Xn}var wc,Bo,Xn,Tc=Bt(()=>{"use strict";Z();wc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Bo=["January","February","March","April","May","June","July","August","September","October","November","December"];Xn=class extends P{constructor(){super(...arguments);this.currentBlock=null;this.viewDate=new Date;this.currentView="month"}render(e,n){this.container=n,this.currentBlock=e,this.currentView=e.data.view??"month",this.viewDate=e.data.initialDate?new Date(e.data.initialDate):new Date,this.buildCalendar(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){}update(e){this.container&&(this.currentBlock=e,e.data.view&&(this.currentView=e.data.view),this.container.innerHTML="",this.buildCalendar(e))}buildCalendar(e){let n=this.container,s=document.createElement("div");s.className="blex-calendar",s.setAttribute("data-testid",`blex-calendar-${e.id}`),s.appendChild(this.buildViewToggle(e)),s.appendChild(this.buildNav(e));let o=document.createElement("div");o.className="blex-calendar__grid",this.currentView==="month"?this.buildMonthGrid(o,e):this.currentView==="week"?this.buildWeekGrid(o,e):this.buildDayGrid(o,e),s.appendChild(o),n.appendChild(s)}buildViewToggle(e){let n=document.createElement("div");n.className="blex-calendar__view-toggle";let s=["month","week","day"];for(let o of s){let a=document.createElement("button");a.className="blex-calendar__view-btn",a.setAttribute("data-testid",`blex-calendar-view-${o}`),a.textContent=o.charAt(0).toUpperCase()+o.slice(1),o===this.currentView&&a.setAttribute("aria-pressed","true"),this.addListener(a,"click",(()=>{this.currentView=o,this.container.innerHTML="",this.buildCalendar(e)})),n.appendChild(a)}return n}buildNav(e){let n=document.createElement("div");n.className="blex-calendar__nav";let s=document.createElement("button");s.className="blex-calendar__nav-btn",s.setAttribute("data-testid",`blex-calendar-prev-${e.id}`),s.textContent="\u2039",this.addListener(s,"click",(()=>{this.navigate(-1)}));let o=document.createElement("span");o.className="blex-calendar__title",o.textContent=this.getHeaderTitle();let a=document.createElement("button");return a.className="blex-calendar__nav-btn",a.setAttribute("data-testid",`blex-calendar-next-${e.id}`),a.textContent="\u203A",this.addListener(a,"click",(()=>{this.navigate(1)})),n.appendChild(s),n.appendChild(o),n.appendChild(a),n}getHeaderTitle(){if(this.currentView==="month")return`${Bo[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;if(this.currentView==="week"){let e=Sc(this.viewDate),n=new Date(e);return n.setDate(n.getDate()+6),`${Bo[e.getMonth()]} ${e.getDate()} \u2013 ${n.getDate()}, ${e.getFullYear()}`}else return`${Bo[this.viewDate.getMonth()]} ${this.viewDate.getDate()}, ${this.viewDate.getFullYear()}`}navigate(e){this.currentView==="month"?this.viewDate.setMonth(this.viewDate.getMonth()+e):this.currentView==="week"?this.viewDate.setDate(this.viewDate.getDate()+e*7):this.viewDate.setDate(this.viewDate.getDate()+e),this.container.innerHTML="",this.buildCalendar(this.currentBlock)}buildMonthGrid(e,n){let s=this.viewDate.getFullYear(),o=this.viewDate.getMonth();for(let l of wc){let c=document.createElement("div");c.className="blex-calendar__day-header",c.textContent=l,e.appendChild(c)}let a=new Date(s,o,1).getDay(),r=new Date(s,o+1,0).getDate();for(let l=0;l<a;l++){let c=document.createElement("div");c.className="blex-calendar__day blex-calendar__day--filler",e.appendChild(c)}for(let l=1;l<=r;l++){let c=String(o+1).padStart(2,"0"),d=String(l).padStart(2,"0"),h=`${s}-${c}-${d}`,u=document.createElement("div");u.className="blex-calendar__day",u.setAttribute("data-testid",`blex-calendar-day-${h}`),u.setAttribute("data-date",h);let f=document.createElement("span");f.className="blex-calendar__day-number",f.textContent=String(l),u.appendChild(f);let p=this.getEventsForDate(n.data.events,h);for(let m of p)u.appendChild(this.buildEventEl(m,n));this.addListener(u,"click",(m=>{if(m.target.closest(".blex-calendar__event"))return;let g=`${h}T00:00`,x=`${h}T23:59`;this.emit({blockId:n.id,type:"slot-click",payload:{start:g,end:x},serialized:`Selected time slot: ${g} - ${x}`,summary:`Selected slot: ${g}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),e.appendChild(u)}}buildWeekGrid(e,n){let s=Sc(this.viewDate);for(let o=0;o<7;o++){let a=new Date(s);a.setDate(s.getDate()+o);let r=Mc(a),l=document.createElement("div");l.className="blex-calendar__day",l.setAttribute("data-testid",`blex-calendar-day-${r}`),l.setAttribute("data-date",r);let c=document.createElement("div");c.className="blex-calendar__day-header",c.textContent=`${wc[a.getDay()]} ${a.getDate()}`,l.appendChild(c);for(let h=0;h<24;h++){let u=String(h).padStart(2,"0"),f=`${r}T${u}:00`,p=`${r}T${u}:59`,m=document.createElement("div");m.className="blex-calendar__slot",m.setAttribute("data-start",f),m.setAttribute("data-end",p),m.textContent=`${u}:00`,this.addListener(m,"click",(()=>{this.emit({blockId:n.id,type:"slot-click",payload:{start:f,end:p},serialized:`Selected time slot: ${f} - ${p}`,summary:`Selected slot: ${f}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),l.appendChild(m)}let d=this.getEventsForDate(n.data.events,r);for(let h of d)l.appendChild(this.buildEventEl(h,n));e.appendChild(l)}}buildDayGrid(e,n){let s=Mc(this.viewDate),o=document.createElement("div");o.className="blex-calendar__day",o.setAttribute("data-testid",`blex-calendar-day-${s}`),o.setAttribute("data-date",s);for(let r=0;r<24;r++){let l=String(r).padStart(2,"0"),c=`${s}T${l}:00`,d=`${s}T${l}:59`,h=document.createElement("div");h.className="blex-calendar__slot",h.setAttribute("data-start",c),h.setAttribute("data-end",d),h.textContent=`${l}:00`,this.addListener(h,"click",(()=>{this.emit({blockId:n.id,type:"slot-click",payload:{start:c,end:d},serialized:`Selected time slot: ${c} - ${d}`,summary:`Selected slot: ${c}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),o.appendChild(h)}let a=this.getEventsForDate(n.data.events,s);for(let r of a)o.appendChild(this.buildEventEl(r,n));e.appendChild(o)}buildEventEl(e,n){let s=document.createElement("div");return s.className="blex-calendar__event",s.setAttribute("data-testid",`blex-calendar-event-${e.id}`),s.setAttribute("data-event-id",e.id),s.textContent=e.title,e.color&&(s.style.backgroundColor=e.color),this.addListener(s,"click",(o=>{o.stopPropagation(),this.emit({blockId:n.id,type:"select",payload:{eventId:e.id},serialized:`Selected event: ${e.title}`,summary:`Viewed "${e.title}"`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),s}getEventsForDate(e,n){return e.filter(s=>{let o=s.start.slice(0,10),a=s.end.slice(0,10);return n>=o&&n<=a})}}});var Ac={};Ce(Ac,{GalleryRenderer:()=>Kn,createGalleryRenderer:()=>qp});function qp(){return new Kn}var Kn,Dc=Bt(()=>{"use strict";Z();Kn=class extends P{constructor(){super(...arguments);this.currentIndex=0}revertInteraction(e){}render(e,n){this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentIndex=0,this.container.innerHTML="",this._build(e))}_build(e){let n=this.container,{images:s,layout:o="grid",columns:a=3}=e.data,r=document.createElement("div");r.className=`blex-gallery blex-gallery--${o}`,r.setAttribute("data-testid",`blex-gallery-${e.id}`),o==="carousel"?this._buildCarousel(r,e,s):this._buildGrid(r,e,s,a),n.appendChild(r)}_buildGrid(e,n,s,o){if(e.style.setProperty("--blex-gallery-columns",String(o)),s.forEach((a,r)=>{let l=this._createItem(n,a,r);e.appendChild(l)}),typeof IntersectionObserver<"u"){let a=new IntersectionObserver(r=>{for(let l of r)if(l.isIntersecting){let c=l.target,d=c.getAttribute("data-lazy-src");d&&(c.src=d,c.removeAttribute("data-lazy-src"),a.unobserve(c))}});this.trackObserver(a),e.querySelectorAll(".blex-gallery__img").forEach(r=>{a.observe(r)})}}_buildCarousel(e,n,s){s.forEach((l,c)=>{let d=this._createItem(n,l,c);c!==this.currentIndex&&(d.style.display="none"),e.appendChild(d)});let o=document.createElement("div");o.className="blex-gallery__nav";let a=document.createElement("button");a.className="blex-gallery__nav-btn",a.textContent="Previous",a.setAttribute("data-testid",`blex-gallery-prev-${n.id}`);let r=document.createElement("button");r.className="blex-gallery__nav-btn",r.textContent="Next",r.setAttribute("data-testid",`blex-gallery-next-${n.id}`),this.addListener(a,"click",()=>{this._showCarouselItem(e,s,this.currentIndex-1)}),this.addListener(r,"click",()=>{this._showCarouselItem(e,s,this.currentIndex+1)}),o.appendChild(a),o.appendChild(r),e.appendChild(o)}_showCarouselItem(e,n,s){let o=Math.max(0,Math.min(n.length-1,s));if(o===this.currentIndex)return;let a=e.querySelectorAll(".blex-gallery__item"),r=a[this.currentIndex],l=a[o];r&&(r.style.display="none"),l&&(l.style.display=""),this.currentIndex=o}_createItem(e,n,s){let o=document.createElement("figure");o.className="blex-gallery__item",o.setAttribute("data-testid",`blex-gallery-item-${s}`);let a=document.createElement("img");if(a.className="blex-gallery__img",a.alt=n.alt??"",a.loading="lazy",a.src=n.url,this.addListener(a,"click",()=>{this.emit({blockId:e.id,type:"select",payload:{imageIndex:s,url:n.url},serialized:`Selected image ${s+1}: ${n.caption??n.url}`,summary:`Selected image ${s+1}${n.caption?`: ${n.caption}`:""}`,icon:"\u{1F5BC}",immediate:!1,revertable:!0})}),o.appendChild(a),n.caption){let r=document.createElement("figcaption");r.className="blex-gallery__caption",r.textContent=n.caption,o.appendChild(r)}return o}}});var Jp={};Ce(Jp,{BaseRenderer:()=>P,getPluginInfo:()=>fa,getRegisteredTypes:()=>ra,hasBlockType:()=>Ji,registerBlockType:()=>nt,registerLazyBlockType:()=>se,registerPlugin:()=>ha,renderBlock:()=>Qi,renderPlaceholder:()=>la,unregisterBlockType:()=>qi,unregisterPlugin:()=>ua});Z();var ke=new Map,Ki=new Set;function nt(i,t){ke.set(i,{factory:t})}function sa(i){Ki.add(i)}function oa(i){return Ki.has(i)}function qi(i,t){if(!ke.has(i))return!1;if(Ki.has(i)&&!t?.force)throw new Error(`Cannot unregister built-in block type "${i}" without force: true`);return ke.delete(i),Ki.delete(i),!0}function se(i,t){ke.set(i,{loader:t})}async function aa(i){let t=ke.get(i);if(!t)return null;if(t.factory)return t.factory();if(t.loader){let e=await t.loader();return t.factory=e,t.loader=void 0,e()}return null}function Ji(i){return ke.has(i)}function ra(){return Array.from(ke.keys())}function la(i,t){let e=document.createElement("div");e.className="blex-placeholder",e.setAttribute("data-testid",`blex-placeholder-${i}`),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true");let n=document.createElement("span");n.className="blex-placeholder__label",n.textContent=i;let s=document.createElement("div");return s.className="blex-placeholder__pulse",e.appendChild(n),e.appendChild(s),t.appendChild(e),e}Z();var Zi=class extends P{render(t,e){this.container=e;let n=document.createElement("details");n.setAttribute("data-testid",`blex-fallback-${t.id}`);let s=document.createElement("summary");s.textContent=`Unknown block type: ${t.type}`,s.setAttribute("data-testid",`blex-fallback-summary-${t.id}`),n.appendChild(s);let o=document.createElement("pre"),a=document.createElement("code");a.textContent=JSON.stringify(t.data,null,2),o.appendChild(a),n.appendChild(o),e.appendChild(n),e.setAttribute("data-blex-ready","true")}update(t){if(!this.container)return;let e=this.container.querySelector("code");e&&(e.textContent=JSON.stringify(t.data,null,2))}};var ca="blex-theme-defaults",Kc=`
4
4
  :root {
5
5
  --blex-bg: #ffffff;
6
6
  --blex-text: #1a1a1a;
@@ -449,13 +449,13 @@
449
449
  `,rs=!1;function da(){if(rs||typeof document>"u")return;if(document.getElementById(ca)){rs=!0;return}let i=document.createElement("style");i.id=ca,i.textContent=Kc,document.head.appendChild(i),rs=!0}async function Qi(i,t,e){da(),t.innerHTML="",t.setAttribute("data-blex-type",i.type),t.setAttribute("data-blex-id",i.id);let n=await aa(i.type);return n||(n=new Zi),n.render(i,t),t.setAttribute("data-blex-ready","true"),e?.onReady&&e.onReady(),{update(o){n?.update&&n.update(o)},onInteraction(o){n?.onInteraction&&n.onInteraction(o)},revertInteraction(o){n?.revertInteraction&&n.revertInteraction(o)},destroy(){n?.destroy(),n=null,t.removeAttribute("data-blex-type"),t.removeAttribute("data-blex-id"),t.removeAttribute("data-blex-ready")}}}var qc=/^[a-z][a-z0-9-]{0,63}$/,Jc=/^[a-z][a-z0-9-]{0,63}$/,Zc=new Set(["blex","built-in","core","internal"]);function Qc(i){if(!qc.test(i))throw new Error(`Invalid plugin namespace "${i}": must be lowercase alphanumeric + hyphens, 1-64 chars, starting with a letter`);if(Zc.has(i))throw new Error(`Reserved namespace "${i}": cannot use blex, built-in, core, or internal`)}function td(i){if(!Jc.test(i))throw new Error(`Invalid block name "${i}": must be lowercase alphanumeric + hyphens, 1-64 chars, starting with a letter`)}var fi=new Map;function ha(i,t){Qc(i.namespace);let e=Object.keys(i.blocks);if(e.length===0)throw new Error("Plugin must define at least one block");let n=[];for(let s of e){td(s);let o=`${i.namespace}/${s}`;if(n.push(o),Ji(o)&&!t?.force)throw oa(o)?new Error(`Cannot override built-in block type "${o}" without force: true`):new Error(`Block type "${o}" is already registered. Use force: true to override`)}for(let s=0;s<e.length;s++)nt(n[s],i.blocks[e[s]]);fi.set(i.namespace,{namespace:i.namespace,name:i.name,version:i.version,description:i.description,blockTypes:n})}function ua(i){let t=fi.get(i);if(t){for(let e of t.blockTypes)qi(e);fi.delete(i)}}function fa(i){if(i){let t=fi.get(i);return t?[t]:[]}return Array.from(fi.values())}Z();var ed=["Yes","No","Cancel"],ls=class extends P{render(t,e){this.container=e,this._build(t),e.setAttribute("data-blex-ready","true")}update(t){this.container&&(this.container.innerHTML="",this._build(t))}_build(t){let e=this.container,n=t.data,s=n.buttons??ed,o=document.createElement("div");o.className="blex-confirm",o.setAttribute("data-testid",`blex-confirm-${t.id}`);let a=document.createElement("p");a.className="blex-confirm__message",a.setAttribute("data-testid",`blex-confirm-message-${t.id}`),a.textContent=n.message,o.appendChild(a);let r=document.createElement("div");r.className="blex-confirm__buttons";for(let l of s){let c=document.createElement("button");c.className="blex-confirm__button",c.textContent=l,c.setAttribute("data-testid",`blex-confirm-btn-${l.toLowerCase()}`),this.addListener(c,"click",()=>{this.emit({blockId:t.id,type:"click",payload:{button:l},serialized:`User confirmed: ${n.message} \u2192 ${l}`,summary:`Confirmed: ${l}`,icon:"\u2713",immediate:!0})}),r.appendChild(c)}o.appendChild(r),e.appendChild(o)}};function pa(){return new ls}Z();var cs=class extends P{constructor(){super(...arguments);this.selected=new Set;this.writeInValue=""}render(e,n){this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){if(!this.container)return;let n=e.data.options.length;for(let s of Array.from(this.selected))s>=n&&this.selected.delete(s);this.container.innerHTML="",this._build(e)}_build(e){let n=this.container,{question:s,options:o,multiSelect:a,writeIn:r}=e.data,l=document.createElement("div");l.className="blex-poll",l.setAttribute("data-testid",`blex-poll-${e.id}`);let c=document.createElement("p");c.className="blex-poll__question",c.textContent=s,l.appendChild(c);let d=document.createElement("div");if(d.className="blex-poll__options",o.forEach((u,f)=>{let p=document.createElement("button");p.className="blex-poll__option",this.selected.has(f)&&p.classList.add("blex-poll__option--selected"),p.setAttribute("data-testid",`blex-poll-option-${f}`),p.textContent=u,this.addListener(p,"click",()=>{a?this.selected.has(f)?(this.selected.delete(f),p.classList.remove("blex-poll__option--selected")):(this.selected.add(f),p.classList.add("blex-poll__option--selected")):(d.querySelectorAll(".blex-poll__option").forEach(g=>g.classList.remove("blex-poll__option--selected")),this.selected.clear(),this.selected.add(f),p.classList.add("blex-poll__option--selected"))}),d.appendChild(p)}),l.appendChild(d),r){let u=document.createElement("input");u.type="text",u.className="blex-poll__writein",u.placeholder="Other...",u.setAttribute("data-testid",`blex-poll-writein-${e.id}`),u.value=this.writeInValue,this.addListener(u,"input",()=>{this.writeInValue=u.value}),l.appendChild(u)}let h=document.createElement("button");h.className="blex-poll__submit",h.textContent="Submit",h.setAttribute("data-testid",`blex-poll-submit-${e.id}`),this.addListener(h,"click",()=>{let u=Array.from(this.selected).sort((g,x)=>g-x).map(g=>o[g]),f={selected:u},p=`Poll response: ${s}
450
450
  Selected: ${u.join(", ")}`;this.writeInValue&&(f.writeIn=this.writeInValue,p+=`
451
451
  Write-in: ${this.writeInValue}`);let m=u.length>0?`Voted: ${u.join(", ")}${this.writeInValue?` + "${this.writeInValue}"`:""}`:`Write-in: ${this.writeInValue}`;this.emit({blockId:e.id,type:"submit",payload:f,serialized:p,summary:m,icon:"\u{1F5F3}",immediate:!0})}),l.appendChild(h),n.appendChild(l)}};function ma(){return new cs}Z();var ds=class extends P{render(t,e){this.container=e,this.renderContent(t)}update(t){this.container&&(this.container.innerHTML="",this.renderContent(t))}renderContent(t){let e=this.container,{entries:n}=t.data,s=document.createElement("div");s.className="blex-status",s.setAttribute("data-testid",`blex-status-${t.id}`);for(let o=0;o<n.length;o++){let a=n[o],r=document.createElement("div");r.className="blex-status__entry",r.setAttribute("data-testid",`blex-status-entry-${o}`);let l=document.createElement("span");l.className="blex-status__key",l.textContent=a.key,r.appendChild(l);let c=document.createElement("span");if(c.className="blex-status__value",c.textContent=a.value,r.appendChild(c),a.status){let d=document.createElement("span");d.className=`blex-status__indicator blex-status__indicator--${a.status}`,r.appendChild(d)}s.appendChild(r)}e.appendChild(s),e.setAttribute("data-blex-ready","true")}};function ga(){return new ds}Z();var id={up:"\u2191",down:"\u2193",flat:"\u2192"},hs=class extends P{render(t,e){this.container=e,this.renderContent(t)}update(t){this.container&&(this.container.innerHTML="",this.renderContent(t))}renderContent(t){let e=this.container,{value:n,label:s,trend:o,trendDirection:a}=t.data,r=document.createElement("div");r.className="blex-metric",r.setAttribute("data-testid",`blex-metric-${t.id}`);let l=document.createElement("div");l.className="blex-metric__value",l.setAttribute("data-testid",`blex-metric-value-${t.id}`),l.textContent=n,r.appendChild(l);let c=document.createElement("div");if(c.className="blex-metric__label",c.setAttribute("data-testid",`blex-metric-label-${t.id}`),c.textContent=s,r.appendChild(c),o!==void 0){let d=document.createElement("div"),h=a?id[a]:"",u=a?` blex-metric__trend--${a}`:"";d.className=`blex-metric__trend${u}`,d.setAttribute("data-testid",`blex-metric-trend-${t.id}`),d.textContent=h?`${h} ${o}`:o,r.appendChild(d)}e.appendChild(r),e.setAttribute("data-blex-ready","true")}};function ba(){return new hs}var{entries:Sa,setPrototypeOf:xa,isFrozen:nd,getPrototypeOf:sd,getOwnPropertyDescriptor:od}=Object,{freeze:gt,seal:Et,create:nn}=Object,{apply:xs,construct:_s}=typeof Reflect<"u"&&Reflect;gt||(gt=function(t){return t});Et||(Et=function(t){return t});xs||(xs=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),o=2;o<n;o++)s[o-2]=arguments[o];return t.apply(e,s)});_s||(_s=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});var tn=bt(Array.prototype.forEach),ad=bt(Array.prototype.lastIndexOf),_a=bt(Array.prototype.pop),pi=bt(Array.prototype.push),rd=bt(Array.prototype.splice),sn=bt(String.prototype.toLowerCase),us=bt(String.prototype.toString),fs=bt(String.prototype.match),mi=bt(String.prototype.replace),ld=bt(String.prototype.indexOf),cd=bt(String.prototype.trim),St=bt(Object.prototype.hasOwnProperty),mt=bt(RegExp.prototype.test),gi=dd(TypeError);function bt(i){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return xs(i,t,n)}}function dd(i){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return _s(i,e)}}function B(i,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sn;xa&&xa(i,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){let o=e(s);o!==s&&(nd(t)||(t[n]=o),s=o)}i[s]=!0}return i}function hd(i){for(let t=0;t<i.length;t++)St(i,t)||(i[t]=null);return i}function Nt(i){let t=nn(null);for(let[e,n]of Sa(i))St(i,e)&&(Array.isArray(n)?t[e]=hd(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=Nt(n):t[e]=n);return t}function bi(i,t){for(;i!==null;){let n=od(i,t);if(n){if(n.get)return bt(n.get);if(typeof n.value=="function")return bt(n.value)}i=sd(i)}function e(){return null}return e}var ya=gt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ps=gt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ms=gt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ud=gt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),gs=gt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),fd=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),va=gt(["#text"]),Ca=gt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),bs=gt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ka=gt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),en=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pd=Et(/\{\{[\w\W]*|[\w\W]*\}\}/gm),md=Et(/<%[\w\W]*|[\w\W]*%>/gm),gd=Et(/\$\{[\w\W]*/gm),bd=Et(/^data-[\-\w.\u00B7-\uFFFF]+$/),xd=Et(/^aria-[\-\w]+$/),Ea=Et(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_d=Et(/^(?:\w+script|data):/i),yd=Et(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ta=Et(/^html$/i),vd=Et(/^[a-z][.\w]*(-[.\w]+)+$/i),wa=Object.freeze({__proto__:null,ARIA_ATTR:xd,ATTR_WHITESPACE:yd,CUSTOM_ELEMENT:vd,DATA_ATTR:bd,DOCTYPE_NAME:Ta,ERB_EXPR:md,IS_ALLOWED_URI:Ea,IS_SCRIPT_OR_DATA:_d,MUSTACHE_EXPR:pd,TMPLIT_EXPR:gd}),xi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cd=function(){return typeof window>"u"?null:window},kd=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));let o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Ma=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Aa(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cd(),t=D=>Aa(D);if(t.version="3.3.3",t.removed=[],!i||!i.document||i.document.nodeType!==xi.document||!i.Element)return t.isSupported=!1,t;let{document:e}=i,n=e,s=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:l,NodeFilter:c,NamedNodeMap:d=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:h,DOMParser:u,trustedTypes:f}=i,p=l.prototype,m=bi(p,"cloneNode"),g=bi(p,"remove"),x=bi(p,"nextSibling"),_=bi(p,"childNodes"),C=bi(p,"parentNode");if(typeof a=="function"){let D=e.createElement("template");D.content&&D.content.ownerDocument&&(e=D.content.ownerDocument)}let y,v="",{implementation:w,createNodeIterator:S,createDocumentFragment:E,getElementsByTagName:L}=e,{importNode:R}=n,A=Ma();t.isSupported=typeof Sa=="function"&&typeof C=="function"&&w&&w.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:I,ERB_EXPR:et,TMPLIT_EXPR:lt,DATA_ATTR:H,ARIA_ATTR:j,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:xt,CUSTOM_ELEMENT:rt}=wa,{IS_ALLOWED_URI:Yt}=wa,q=null,Gt=B({},[...ya,...ps,...ms,...gs,...va]),J=null,Ot=B({},[...Ca,...bs,...ka,...en]),V=Object.seal(nn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Mt=null,$i=null,ne=Object.seal(nn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),No=!0,qn=!0,Fo=!1,zo=!0,Fe=!1,Vi=!0,ye=!1,Jn=!1,Zn=!1,ze=!1,Wi=!1,ji=!1,Ho=!0,$o=!1,Pc="user-content-",Qn=!0,di=!1,He={},Rt=null,ts=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Vo=null,Wo=B({},["audio","video","img","source","image","track"]),es=null,jo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ui="http://www.w3.org/1998/Math/MathML",Yi="http://www.w3.org/2000/svg",Xt="http://www.w3.org/1999/xhtml",$e=Xt,is=!1,ns=null,Oc=B({},[Ui,Yi,Xt],us),Gi=B({},["mi","mo","mn","ms","mtext"]),Xi=B({},["annotation-xml"]),Rc=B({},["title","style","font","a","script"]),hi=null,Ic=["application/xhtml+xml","text/html"],Bc="text/html",ot=null,Ve=null,Nc=e.createElement("form"),Uo=function(b){return b instanceof RegExp||b instanceof Function},ss=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ve&&Ve===b)){if((!b||typeof b!="object")&&(b={}),b=Nt(b),hi=Ic.indexOf(b.PARSER_MEDIA_TYPE)===-1?Bc:b.PARSER_MEDIA_TYPE,ot=hi==="application/xhtml+xml"?us:sn,q=St(b,"ALLOWED_TAGS")?B({},b.ALLOWED_TAGS,ot):Gt,J=St(b,"ALLOWED_ATTR")?B({},b.ALLOWED_ATTR,ot):Ot,ns=St(b,"ALLOWED_NAMESPACES")?B({},b.ALLOWED_NAMESPACES,us):Oc,es=St(b,"ADD_URI_SAFE_ATTR")?B(Nt(jo),b.ADD_URI_SAFE_ATTR,ot):jo,Vo=St(b,"ADD_DATA_URI_TAGS")?B(Nt(Wo),b.ADD_DATA_URI_TAGS,ot):Wo,Rt=St(b,"FORBID_CONTENTS")?B({},b.FORBID_CONTENTS,ot):ts,Mt=St(b,"FORBID_TAGS")?B({},b.FORBID_TAGS,ot):Nt({}),$i=St(b,"FORBID_ATTR")?B({},b.FORBID_ATTR,ot):Nt({}),He=St(b,"USE_PROFILES")?b.USE_PROFILES:!1,No=b.ALLOW_ARIA_ATTR!==!1,qn=b.ALLOW_DATA_ATTR!==!1,Fo=b.ALLOW_UNKNOWN_PROTOCOLS||!1,zo=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Fe=b.SAFE_FOR_TEMPLATES||!1,Vi=b.SAFE_FOR_XML!==!1,ye=b.WHOLE_DOCUMENT||!1,ze=b.RETURN_DOM||!1,Wi=b.RETURN_DOM_FRAGMENT||!1,ji=b.RETURN_TRUSTED_TYPE||!1,Zn=b.FORCE_BODY||!1,Ho=b.SANITIZE_DOM!==!1,$o=b.SANITIZE_NAMED_PROPS||!1,Qn=b.KEEP_CONTENT!==!1,di=b.IN_PLACE||!1,Yt=b.ALLOWED_URI_REGEXP||Ea,$e=b.NAMESPACE||Xt,Gi=b.MATHML_TEXT_INTEGRATION_POINTS||Gi,Xi=b.HTML_INTEGRATION_POINTS||Xi,V=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Uo(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Uo(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Fe&&(qn=!1),Wi&&(ze=!0),He&&(q=B({},va),J=nn(null),He.html===!0&&(B(q,ya),B(J,Ca)),He.svg===!0&&(B(q,ps),B(J,bs),B(J,en)),He.svgFilters===!0&&(B(q,ms),B(J,bs),B(J,en)),He.mathMl===!0&&(B(q,gs),B(J,ka),B(J,en))),St(b,"ADD_TAGS")||(ne.tagCheck=null),St(b,"ADD_ATTR")||(ne.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?ne.tagCheck=b.ADD_TAGS:(q===Gt&&(q=Nt(q)),B(q,b.ADD_TAGS,ot))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?ne.attributeCheck=b.ADD_ATTR:(J===Ot&&(J=Nt(J)),B(J,b.ADD_ATTR,ot))),b.ADD_URI_SAFE_ATTR&&B(es,b.ADD_URI_SAFE_ATTR,ot),b.FORBID_CONTENTS&&(Rt===ts&&(Rt=Nt(Rt)),B(Rt,b.FORBID_CONTENTS,ot)),b.ADD_FORBID_CONTENTS&&(Rt===ts&&(Rt=Nt(Rt)),B(Rt,b.ADD_FORBID_CONTENTS,ot)),Qn&&(q["#text"]=!0),ye&&B(q,["html","head","body"]),q.table&&(B(q,["tbody"]),delete Mt.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw gi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=b.TRUSTED_TYPES_POLICY,v=y.createHTML("")}else y===void 0&&(y=kd(f,s)),y!==null&&typeof v=="string"&&(v=y.createHTML(""));gt&&gt(b),Ve=b}},Yo=B({},[...ps,...ms,...ud]),Go=B({},[...gs,...fd]),Fc=function(b){let k=C(b);(!k||!k.tagName)&&(k={namespaceURI:$e,tagName:"template"});let T=sn(b.tagName),X=sn(k.tagName);return ns[b.namespaceURI]?b.namespaceURI===Yi?k.namespaceURI===Xt?T==="svg":k.namespaceURI===Ui?T==="svg"&&(X==="annotation-xml"||Gi[X]):!!Yo[T]:b.namespaceURI===Ui?k.namespaceURI===Xt?T==="math":k.namespaceURI===Yi?T==="math"&&Xi[X]:!!Go[T]:b.namespaceURI===Xt?k.namespaceURI===Yi&&!Xi[X]||k.namespaceURI===Ui&&!Gi[X]?!1:!Go[T]&&(Rc[T]||!Yo[T]):!!(hi==="application/xhtml+xml"&&ns[b.namespaceURI]):!1},It=function(b){pi(t.removed,{element:b});try{C(b).removeChild(b)}catch{g(b)}},ve=function(b,k){try{pi(t.removed,{attribute:k.getAttributeNode(b),from:k})}catch{pi(t.removed,{attribute:null,from:k})}if(k.removeAttribute(b),b==="is")if(ze||Wi)try{It(k)}catch{}else try{k.setAttribute(b,"")}catch{}},Xo=function(b){let k=null,T=null;if(Zn)b="<remove></remove>"+b;else{let it=fs(b,/^[\r\n\t ]+/);T=it&&it[0]}hi==="application/xhtml+xml"&&$e===Xt&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");let X=y?y.createHTML(b):b;if($e===Xt)try{k=new u().parseFromString(X,hi)}catch{}if(!k||!k.documentElement){k=w.createDocument($e,"template",null);try{k.documentElement.innerHTML=is?v:X}catch{}}let pt=k.body||k.documentElement;return b&&T&&pt.insertBefore(e.createTextNode(T),pt.childNodes[0]||null),$e===Xt?L.call(k,ye?"html":"body")[0]:ye?k.documentElement:pt},Ko=function(b){return S.call(b.ownerDocument||b,b,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},os=function(b){return b instanceof h&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof d)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},qo=function(b){return typeof r=="function"&&b instanceof r};function Kt(D,b,k){tn(D,T=>{T.call(t,b,k,Ve)})}let Jo=function(b){let k=null;if(Kt(A.beforeSanitizeElements,b,null),os(b))return It(b),!0;let T=ot(b.nodeName);if(Kt(A.uponSanitizeElement,b,{tagName:T,allowedTags:q}),Vi&&b.hasChildNodes()&&!qo(b.firstElementChild)&&mt(/<[/\w!]/g,b.innerHTML)&&mt(/<[/\w!]/g,b.textContent)||b.nodeType===xi.progressingInstruction||Vi&&b.nodeType===xi.comment&&mt(/<[/\w]/g,b.data))return It(b),!0;if(!(ne.tagCheck instanceof Function&&ne.tagCheck(T))&&(!q[T]||Mt[T])){if(!Mt[T]&&Qo(T)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,T)||V.tagNameCheck instanceof Function&&V.tagNameCheck(T)))return!1;if(Qn&&!Rt[T]){let X=C(b)||b.parentNode,pt=_(b)||b.childNodes;if(pt&&X){let it=pt.length;for(let _t=it-1;_t>=0;--_t){let qt=m(pt[_t],!0);qt.__removalCount=(b.__removalCount||0)+1,X.insertBefore(qt,x(b))}}}return It(b),!0}return b instanceof l&&!Fc(b)||(T==="noscript"||T==="noembed"||T==="noframes")&&mt(/<\/no(script|embed|frames)/i,b.innerHTML)?(It(b),!0):(Fe&&b.nodeType===xi.text&&(k=b.textContent,tn([I,et,lt],X=>{k=mi(k,X," ")}),b.textContent!==k&&(pi(t.removed,{element:b.cloneNode()}),b.textContent=k)),Kt(A.afterSanitizeElements,b,null),!1)},Zo=function(b,k,T){if($i[k]||Ho&&(k==="id"||k==="name")&&(T in e||T in Nc))return!1;if(!(qn&&!$i[k]&&mt(H,k))){if(!(No&&mt(j,k))){if(!(ne.attributeCheck instanceof Function&&ne.attributeCheck(k,b))){if(!J[k]||$i[k]){if(!(Qo(b)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,b)||V.tagNameCheck instanceof Function&&V.tagNameCheck(b))&&(V.attributeNameCheck instanceof RegExp&&mt(V.attributeNameCheck,k)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(k,b))||k==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,T)||V.tagNameCheck instanceof Function&&V.tagNameCheck(T))))return!1}else if(!es[k]){if(!mt(Yt,mi(T,xt,""))){if(!((k==="src"||k==="xlink:href"||k==="href")&&b!=="script"&&ld(T,"data:")===0&&Vo[b])){if(!(Fo&&!mt(K,mi(T,xt,"")))){if(T)return!1}}}}}}}return!0},Qo=function(b){return b!=="annotation-xml"&&fs(b,rt)},ta=function(b){Kt(A.beforeSanitizeAttributes,b,null);let{attributes:k}=b;if(!k||os(b))return;let T={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0},X=k.length;for(;X--;){let pt=k[X],{name:it,namespaceURI:_t,value:qt}=pt,We=ot(it),as=qt,ct=it==="value"?as:cd(as);if(T.attrName=We,T.attrValue=ct,T.keepAttr=!0,T.forceKeepAttr=void 0,Kt(A.uponSanitizeAttribute,b,T),ct=T.attrValue,$o&&(We==="id"||We==="name")&&(ve(it,b),ct=Pc+ct),Vi&&mt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ct)){ve(it,b);continue}if(We==="attributename"&&fs(ct,"href")){ve(it,b);continue}if(T.forceKeepAttr)continue;if(!T.keepAttr){ve(it,b);continue}if(!zo&&mt(/\/>/i,ct)){ve(it,b);continue}Fe&&tn([I,et,lt],ia=>{ct=mi(ct,ia," ")});let ea=ot(b.nodeName);if(!Zo(ea,We,ct)){ve(it,b);continue}if(y&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!_t)switch(f.getAttributeType(ea,We)){case"TrustedHTML":{ct=y.createHTML(ct);break}case"TrustedScriptURL":{ct=y.createScriptURL(ct);break}}if(ct!==as)try{_t?b.setAttributeNS(_t,it,ct):b.setAttribute(it,ct),os(b)?It(b):_a(t.removed)}catch{ve(it,b)}}Kt(A.afterSanitizeAttributes,b,null)},zc=function D(b){let k=null,T=Ko(b);for(Kt(A.beforeSanitizeShadowDOM,b,null);k=T.nextNode();)Kt(A.uponSanitizeShadowNode,k,null),Jo(k),ta(k),k.content instanceof o&&D(k.content);Kt(A.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(D){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=null,T=null,X=null,pt=null;if(is=!D,is&&(D="<!-->"),typeof D!="string"&&!qo(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw gi("dirty is not a string, aborting")}else throw gi("toString is not a function");if(!t.isSupported)return D;if(Jn||ss(b),t.removed=[],typeof D=="string"&&(di=!1),di){if(D.nodeName){let qt=ot(D.nodeName);if(!q[qt]||Mt[qt])throw gi("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof r)k=Xo("<!---->"),T=k.ownerDocument.importNode(D,!0),T.nodeType===xi.element&&T.nodeName==="BODY"||T.nodeName==="HTML"?k=T:k.appendChild(T);else{if(!ze&&!Fe&&!ye&&D.indexOf("<")===-1)return y&&ji?y.createHTML(D):D;if(k=Xo(D),!k)return ze?null:ji?v:""}k&&Zn&&It(k.firstChild);let it=Ko(di?D:k);for(;X=it.nextNode();)Jo(X),ta(X),X.content instanceof o&&zc(X.content);if(di)return D;if(ze){if(Wi)for(pt=E.call(k.ownerDocument);k.firstChild;)pt.appendChild(k.firstChild);else pt=k;return(J.shadowroot||J.shadowrootmode)&&(pt=R.call(n,pt,!0)),pt}let _t=ye?k.outerHTML:k.innerHTML;return ye&&q["!doctype"]&&k.ownerDocument&&k.ownerDocument.doctype&&k.ownerDocument.doctype.name&&mt(Ta,k.ownerDocument.doctype.name)&&(_t="<!DOCTYPE "+k.ownerDocument.doctype.name+`>
452
- `+_t),Fe&&tn([I,et,lt],qt=>{_t=mi(_t,qt," ")}),y&&ji?y.createHTML(_t):_t},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ss(D),Jn=!0},t.clearConfig=function(){Ve=null,Jn=!1},t.isValidAttribute=function(D,b,k){Ve||ss({});let T=ot(D),X=ot(b);return Zo(T,X,k)},t.addHook=function(D,b){typeof b=="function"&&pi(A[D],b)},t.removeHook=function(D,b){if(b!==void 0){let k=ad(A[D],b);return k===-1?void 0:rd(A[D],k,1)[0]}return _a(A[D])},t.removeHooks=function(D){A[D]=[]},t.removeAllHooks=function(){A=Ma()},t}var on=Aa();Z();var ys=class extends P{render(t,e){this.container=e,this._build(t),e.setAttribute("data-blex-ready","true")}update(t){this.container&&(this.container.innerHTML="",this._build(t))}_build(t){let e=this.container,{src:n,alt:s,caption:o,width:a,height:r}=t.data,l=document.createElement("figure");l.className="blex-image",l.setAttribute("data-testid",`blex-image-${t.id}`);let c=document.createElement("img");if(c.src=n,c.alt=s??"",c.className="blex-image__img",c.setAttribute("data-testid",`blex-image-img-${t.id}`),a!==void 0&&(c.width=a),r!==void 0&&(c.height=r),this.addListener(c,"click",()=>this._openOverlay(n,s)),l.appendChild(c),o){let f=document.createElement("figcaption");f.className="blex-image__caption",f.setAttribute("data-testid",`blex-image-caption-${t.id}`),f.innerHTML=on.sanitize(o),l.appendChild(f)}let d=document.createElement("div");d.className="blex-image__actions";let h=document.createElement("button");h.className="blex-image__btn",h.textContent="Zoom",h.setAttribute("data-testid",`blex-image-zoom-${t.id}`),this.addListener(h,"click",()=>this._openOverlay(n,s)),d.appendChild(h);let u=document.createElement("button");u.className="blex-image__btn",u.textContent="Download",u.setAttribute("data-testid",`blex-image-download-${t.id}`),this.addListener(u,"click",()=>{let f=document.createElement("a");f.href=n,f.download=s??"image",f.click()}),d.appendChild(u),l.appendChild(d),e.appendChild(l)}_openOverlay(t,e){let n=document.createElement("div");n.className="blex-image__overlay";let s=document.createElement("img");s.src=t,s.alt=e??"",n.appendChild(s);let o=()=>{n.remove(),document.removeEventListener("keydown",a)},a=r=>{r.key==="Escape"&&o()};this.addListener(n,"click",o),document.addEventListener("keydown",a),document.body.appendChild(n)}};function Da(){return new ys}Z();var vs=class extends P{render(t,e){this.container=e,this.renderContent(t)}update(t){this.container&&(this.container.innerHTML="",this.renderContent(t))}renderContent(t){let e=this.container,{svg:n,title:s}=t.data,o=document.createElement("div");if(o.className="blex-svg",o.setAttribute("data-testid",`blex-svg-${t.id}`),s){let d=document.createElement("div");d.className="blex-svg__title",d.textContent=s,o.appendChild(d)}let a=document.createElement("div");a.className="blex-svg__content",a.setAttribute("data-testid",`blex-svg-content-${t.id}`),a.innerHTML=on.sanitize(n,{USE_PROFILES:{svg:!0}}),o.appendChild(a);let r=document.createElement("div");r.className="blex-svg__actions";let l=document.createElement("button");l.className="blex-svg__btn",l.textContent="Download SVG",l.setAttribute("data-testid",`blex-svg-download-${t.id}`),this.addListener(l,"click",()=>{let d=new Blob([n],{type:"image/svg+xml"}),h=URL.createObjectURL(d),u=document.createElement("a");u.href=h,u.download=`${s??"image"}.svg`,u.click(),URL.revokeObjectURL(h),this.emit({blockId:t.id,type:"click",payload:{action:"download"},serialized:`Downloaded SVG${s?`: ${s}`:""}`,summary:`Downloaded SVG${s?`: ${s}`:""}`,icon:"\u2B07",immediate:!0})}),r.appendChild(l);let c=document.createElement("button");c.className="blex-svg__btn",c.textContent="Copy SVG",c.setAttribute("data-testid",`blex-svg-copy-${t.id}`),this.addListener(c,"click",()=>{navigator.clipboard?.writeText(n),this.emit({blockId:t.id,type:"click",payload:{action:"copy"},serialized:`Copied SVG${s?`: ${s}`:""}`,summary:`Copied SVG${s?`: ${s}`:""}`,icon:"\u{1F4CB}",immediate:!0})}),r.appendChild(c),o.appendChild(r),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function La(){return new vs}Z();var Cs=class extends P{constructor(){super(...arguments);this.selectedRows=new Set;this.sortColumn=null;this.sortDirection="asc";this.currentBlock=null}render(e,n){this.container=n,this.currentBlock=e,this._build(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){!this.container||!this.currentBlock||e.type==="select"&&(this.selectedRows.clear(),this.container.innerHTML="",this._build(this.currentBlock))}update(e){this.container&&(this.currentBlock=e,this.selectedRows.clear(),this.sortColumn=null,this.sortDirection="asc",this.container.innerHTML="",this._build(e))}_getSortedRows(e){let n=e.map((a,r)=>({row:a,originalIndex:r}));if(!this.sortColumn)return n;let s=this.sortColumn,o=this.sortDirection;return n.slice().sort((a,r)=>{let l=a.row[s]??"",c=r.row[s]??"",d;return typeof l=="number"&&typeof c=="number"?d=l-c:d=String(l).localeCompare(String(c)),o==="asc"?d:-d})}_build(e){let n=this.container,{columns:s,rows:o,sortable:a}=e.data,r=document.createElement("div");r.className="blex-table",r.setAttribute("data-testid",`blex-table-${e.id}`);let l=document.createElement("table"),c=document.createElement("thead"),d=document.createElement("tr");d.className="blex-table__header";for(let f of s){let p=document.createElement("th");p.className="blex-table__header-cell",p.setAttribute("data-testid",`blex-table-header-${f}`),p.textContent=f,this.sortColumn===f&&p.classList.add(this.sortDirection==="asc"?"blex-table__header-cell--sorted-asc":"blex-table__header-cell--sorted-desc"),a&&this.addListener(p,"click",()=>{this.sortColumn===f?this.sortDirection=this.sortDirection==="asc"?"desc":"asc":(this.sortColumn=f,this.sortDirection="asc"),n.innerHTML="",this._build(this.currentBlock)}),d.appendChild(p)}c.appendChild(d),l.appendChild(c);let h=document.createElement("tbody"),u=this._getSortedRows(o);for(let{row:f,originalIndex:p}of u){let m=document.createElement("tr");m.className="blex-table__row",m.setAttribute("data-testid",`blex-table-row-${p}`),this.selectedRows.has(p)&&m.classList.add("blex-table__row--selected"),this.addListener(m,"click",()=>{this.selectedRows.has(p)?(this.selectedRows.delete(p),m.classList.remove("blex-table__row--selected")):(this.selectedRows.add(p),m.classList.add("blex-table__row--selected")),this._emitSelection(e)});for(let g of s){let x=document.createElement("td");x.className="blex-table__cell",x.setAttribute("data-testid",`blex-table-cell-${p}-${g}`),x.textContent=String(f[g]??""),m.appendChild(x)}h.appendChild(m)}l.appendChild(h),r.appendChild(l),n.appendChild(r)}_emitSelection(e){let{columns:n,rows:s}=e.data,o=Array.from(this.selectedRows).sort((u,f)=>u-f),a=o.map(u=>s[u]),r=`| ${n.join(" | ")} |`,l=`| ${n.map(()=>"---").join(" | ")} |`,c=a.map(u=>`| ${n.map(f=>String(u[f]??"")).join(" | ")} |`),d=["Selected from table:",r,l,...c].join(`
452
+ `+_t),Fe&&tn([I,et,lt],qt=>{_t=mi(_t,qt," ")}),y&&ji?y.createHTML(_t):_t},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ss(D),Jn=!0},t.clearConfig=function(){Ve=null,Jn=!1},t.isValidAttribute=function(D,b,k){Ve||ss({});let T=ot(D),X=ot(b);return Zo(T,X,k)},t.addHook=function(D,b){typeof b=="function"&&pi(A[D],b)},t.removeHook=function(D,b){if(b!==void 0){let k=ad(A[D],b);return k===-1?void 0:rd(A[D],k,1)[0]}return _a(A[D])},t.removeHooks=function(D){A[D]=[]},t.removeAllHooks=function(){A=Ma()},t}var on=Aa();Z();var ys=class extends P{render(t,e){this.container=e,this._build(t),e.setAttribute("data-blex-ready","true")}update(t){this.container&&(this.container.innerHTML="",this._build(t))}_build(t){let e=this.container,{src:n,alt:s,caption:o,width:a,height:r}=t.data,l=document.createElement("figure");l.className="blex-image",l.setAttribute("data-testid",`blex-image-${t.id}`);let c=document.createElement("img");if(c.src=n,c.alt=s??"",c.className="blex-image__img",c.setAttribute("data-testid",`blex-image-img-${t.id}`),a!==void 0&&(c.width=a),r!==void 0&&(c.height=r),this.addListener(c,"click",()=>this._openOverlay(n,s)),l.appendChild(c),o){let f=document.createElement("figcaption");f.className="blex-image__caption",f.setAttribute("data-testid",`blex-image-caption-${t.id}`),f.innerHTML=on.sanitize(o),l.appendChild(f)}let d=document.createElement("div");d.className="blex-image__actions";let h=document.createElement("button");h.className="blex-image__btn",h.textContent="Zoom",h.setAttribute("data-testid",`blex-image-zoom-${t.id}`),this.addListener(h,"click",()=>this._openOverlay(n,s)),d.appendChild(h);let u=document.createElement("button");u.className="blex-image__btn",u.textContent="Download",u.setAttribute("data-testid",`blex-image-download-${t.id}`),this.addListener(u,"click",()=>{let f=document.createElement("a");f.href=n,f.download=s??"image",f.click()}),d.appendChild(u),l.appendChild(d),e.appendChild(l)}_openOverlay(t,e){let n=document.createElement("div");n.className="blex-image__overlay";let s=document.createElement("img");s.src=t,s.alt=e??"",n.appendChild(s);let o=()=>{n.remove(),document.removeEventListener("keydown",a)},a=r=>{r.key==="Escape"&&o()};this.addListener(n,"click",o),document.addEventListener("keydown",a),document.body.appendChild(n)}};function Da(){return new ys}Z();var vs=class extends P{render(t,e){this.container=e,this.renderContent(t)}update(t){this.container&&(this.container.innerHTML="",this.renderContent(t))}renderContent(t){let e=this.container,{svg:n,title:s}=t.data,o=document.createElement("div");if(o.className="blex-svg",o.setAttribute("data-testid",`blex-svg-${t.id}`),s){let d=document.createElement("div");d.className="blex-svg__title",d.textContent=s,o.appendChild(d)}let a=document.createElement("div");a.className="blex-svg__content",a.setAttribute("data-testid",`blex-svg-content-${t.id}`),a.innerHTML=on.sanitize(n,{USE_PROFILES:{svg:!0}}),o.appendChild(a);let r=document.createElement("div");r.className="blex-svg__actions";let l=document.createElement("button");l.className="blex-svg__btn",l.textContent="Download SVG",l.setAttribute("data-testid",`blex-svg-download-${t.id}`),this.addListener(l,"click",()=>{let d=new Blob([n],{type:"image/svg+xml"}),h=URL.createObjectURL(d),u=document.createElement("a");u.href=h,u.download=`${s??"image"}.svg`,u.click(),URL.revokeObjectURL(h),this.emit({blockId:t.id,type:"click",payload:{action:"download"},serialized:`Downloaded SVG${s?`: ${s}`:""}`,summary:`Downloaded SVG${s?`: ${s}`:""}`,icon:"\u2B07",immediate:!0})}),r.appendChild(l);let c=document.createElement("button");c.className="blex-svg__btn",c.textContent="Copy SVG",c.setAttribute("data-testid",`blex-svg-copy-${t.id}`),this.addListener(c,"click",()=>{navigator.clipboard?.writeText(n),this.emit({blockId:t.id,type:"click",payload:{action:"copy"},serialized:`Copied SVG${s?`: ${s}`:""}`,summary:`Copied SVG${s?`: ${s}`:""}`,icon:"\u{1F4CB}",immediate:!0})}),r.appendChild(c),o.appendChild(r),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function La(){return new vs}Z();var Cs=class extends P{constructor(){super(...arguments);this.selectedRows=new Set;this.sortColumn=null;this.sortDirection="asc";this.currentBlock=null}render(e,n){this.container=n,this.currentBlock=e,this._build(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){!this.container||!this.currentBlock||e.type==="select"&&(this.selectedRows.clear(),this.container.innerHTML="",this._build(this.currentBlock))}update(e){this.container&&(this.currentBlock=e,this.selectedRows.clear(),this.sortColumn=null,this.sortDirection="asc",this.container.innerHTML="",this._build(e))}_getSortedRows(e){let n=e.map((a,r)=>({row:a,originalIndex:r}));if(!this.sortColumn)return n;let s=this.sortColumn,o=this.sortDirection;return n.slice().sort((a,r)=>{let l=a.row[s]??"",c=r.row[s]??"",d;return typeof l=="number"&&typeof c=="number"?d=l-c:d=String(l).localeCompare(String(c)),o==="asc"?d:-d})}_build(e){let n=this.container,{columns:s,rows:o,sortable:a}=e.data,r=document.createElement("div");r.className="blex-table",r.setAttribute("data-testid",`blex-table-${e.id}`);let l=document.createElement("table"),c=document.createElement("thead"),d=document.createElement("tr");d.className="blex-table__header";for(let f of s){let p=document.createElement("th");p.className="blex-table__header-cell",p.setAttribute("data-testid",`blex-table-header-${f}`),p.textContent=f,this.sortColumn===f&&p.classList.add(this.sortDirection==="asc"?"blex-table__header-cell--sorted-asc":"blex-table__header-cell--sorted-desc"),a&&this.addListener(p,"click",()=>{this.sortColumn===f?this.sortDirection=this.sortDirection==="asc"?"desc":"asc":(this.sortColumn=f,this.sortDirection="asc"),n.innerHTML="",this._build(this.currentBlock)}),d.appendChild(p)}c.appendChild(d),l.appendChild(c);let h=document.createElement("tbody"),u=this._getSortedRows(o);for(let{row:f,originalIndex:p}of u){let m=document.createElement("tr");m.className="blex-table__row",m.setAttribute("data-testid",`blex-table-row-${p}`),this.selectedRows.has(p)&&m.classList.add("blex-table__row--selected"),this.addListener(m,"click",()=>{this.selectedRows.has(p)?(this.selectedRows.delete(p),m.classList.remove("blex-table__row--selected")):(this.selectedRows.add(p),m.classList.add("blex-table__row--selected")),this._emitSelection(e)});for(let g of s){let x=document.createElement("td");x.className="blex-table__cell",x.setAttribute("data-testid",`blex-table-cell-${p}-${g}`),x.textContent=String(f[g]??""),m.appendChild(x)}h.appendChild(m)}l.appendChild(h),r.appendChild(l),n.appendChild(r)}_emitSelection(e){if(this.selectedRows.size===0)return;let{columns:n,rows:s}=e.data,o=Array.from(this.selectedRows).sort((u,f)=>u-f),a=o.map(u=>s[u]),r=`| ${n.join(" | ")} |`,l=`| ${n.map(()=>"---").join(" | ")} |`,c=a.map(u=>`| ${n.map(f=>String(u[f]??"")).join(" | ")} |`),d=["Selected from table:",r,l,...c].join(`
453
453
  `),h=o.length;this.emit({blockId:e.id,type:"select",payload:{selectedRows:o,columns:n},serialized:d,summary:`Selected ${h} row${h!==1?"s":""}`,icon:"\u2610",immediate:!1,revertable:!0})}};function Pa(){return new Cs}Z();var ks=class extends P{constructor(){super(...arguments);this.selectedLines=new Set;this.lastClickedLine=null;this.currentBlock=null}revertInteraction(e){!this.container||!this.currentBlock||e.type==="select"&&(this.selectedLines.clear(),this.lastClickedLine=null,this.container.innerHTML="",this._build(this.currentBlock))}render(e,n){this.currentBlock=e,this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){if(!this.container)return;this.currentBlock=e;let n=e.data.code.split(`
454
454
  `);for(let s of Array.from(this.selectedLines))s>n.length&&this.selectedLines.delete(s);this.container.innerHTML="",this._build(e)}_build(e){let n=this.container,{code:s,language:o,highlightLines:a=[]}=e.data,r=e.data.lineNumbers!==!1,l=s.split(`
455
- `),c=document.createElement("pre");c.className="blex-code",o&&c.setAttribute("data-language",o),c.setAttribute("data-testid",`blex-code-${e.id}`);let d=document.createElement("button");d.className="blex-code__copy",d.setAttribute("data-testid",`blex-code-copy-${e.id}`),d.textContent="Copy",this.addListener(d,"click",()=>{navigator.clipboard.writeText(s)}),c.appendChild(d);let h=null;r&&(h=document.createElement("div"),h.className="blex-code__gutter",c.appendChild(h));let u=document.createElement("code");u.className="blex-code__content",o&&(u.className+=` language-${o}`),l.forEach((f,p)=>{let m=p+1;if(r&&h){let x=document.createElement("span");x.className="blex-code__line-number",x.textContent=String(m),this.addListener(x,"click",_=>{if(_.shiftKey&&this.lastClickedLine!==null){let y=Math.min(this.lastClickedLine,m),v=Math.max(this.lastClickedLine,m);for(let w=y;w<=v;w++)this.selectedLines.add(w)}else this.selectedLines.has(m)?this.selectedLines.delete(m):this.selectedLines.add(m),this.lastClickedLine=m;this._updateSelectionClasses(u,l.length),this._emitSelection(e,l)}),h.appendChild(x)}let g=document.createElement("div");g.className="blex-code__line",g.setAttribute("data-testid",`blex-code-line-${m}`),g.textContent=f,a.includes(m)&&g.classList.add("blex-code__line--highlighted"),this.selectedLines.has(m)&&g.classList.add("blex-code__line--selected"),u.appendChild(g)}),c.appendChild(u),n.appendChild(c)}_updateSelectionClasses(e,n){for(let s=1;s<=n;s++){let o=e.querySelector(`[data-testid="blex-code-line-${s}"]`);o&&(this.selectedLines.has(s)?o.classList.add("blex-code__line--selected"):o.classList.remove("blex-code__line--selected"))}}_emitSelection(e,n){let{language:s}=e.data,o=Array.from(this.selectedLines).sort((d,h)=>d-h),a=o.map(d=>n[d-1]).join(`
455
+ `),c=document.createElement("pre");c.className="blex-code",o&&c.setAttribute("data-language",o),c.setAttribute("data-testid",`blex-code-${e.id}`);let d=document.createElement("button");d.className="blex-code__copy",d.setAttribute("data-testid",`blex-code-copy-${e.id}`),d.textContent="Copy",this.addListener(d,"click",()=>{navigator.clipboard.writeText(s)}),c.appendChild(d);let h=null;r&&(h=document.createElement("div"),h.className="blex-code__gutter",c.appendChild(h));let u=document.createElement("code");u.className="blex-code__content",o&&(u.className+=` language-${o}`),l.forEach((f,p)=>{let m=p+1;if(r&&h){let x=document.createElement("span");x.className="blex-code__line-number",x.textContent=String(m),this.addListener(x,"click",_=>{if(_.shiftKey&&this.lastClickedLine!==null){let y=Math.min(this.lastClickedLine,m),v=Math.max(this.lastClickedLine,m);for(let w=y;w<=v;w++)this.selectedLines.add(w)}else this.selectedLines.has(m)?this.selectedLines.delete(m):this.selectedLines.add(m),this.lastClickedLine=m;this._updateSelectionClasses(u,l.length),this._emitSelection(e,l)}),h.appendChild(x)}let g=document.createElement("div");g.className="blex-code__line",g.setAttribute("data-testid",`blex-code-line-${m}`),g.textContent=f,a.includes(m)&&g.classList.add("blex-code__line--highlighted"),this.selectedLines.has(m)&&g.classList.add("blex-code__line--selected"),u.appendChild(g)}),c.appendChild(u),n.appendChild(c)}_updateSelectionClasses(e,n){for(let s=1;s<=n;s++){let o=e.querySelector(`[data-testid="blex-code-line-${s}"]`);o&&(this.selectedLines.has(s)?o.classList.add("blex-code__line--selected"):o.classList.remove("blex-code__line--selected"))}}_emitSelection(e,n){if(this.selectedLines.size===0)return;let{language:s}=e.data,o=Array.from(this.selectedLines).sort((d,h)=>d-h),a=o.map(d=>n[d-1]).join(`
456
456
  `),l=`\`\`\`${s??""}
457
457
  ${a}
458
- \`\`\``,c=o.length===1?`line ${o[0]}`:`lines ${o[0]}-${o[o.length-1]}`;this.emit({blockId:e.id,type:"select",payload:{lines:o,...s!==void 0&&{language:s}},serialized:l,summary:`Selected ${c}`,icon:"< >",immediate:!1,revertable:!0})}};function Oa(){return new ks}Z();var ws=class extends P{constructor(){super(...arguments);this.viewMode="unified";this.selectedHunks=new Set}render(e,n){this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this._build(e))}_build(e){let n=this.container,{hunks:s,filename:o}=e.data,a=document.createElement("div");a.className=`blex-diff blex-diff--${this.viewMode}`,a.setAttribute("data-testid",`blex-diff-${e.id}`);let r=document.createElement("div");r.className="blex-diff__header",o&&(r.textContent=o),a.appendChild(r);let l=document.createElement("div");l.className="blex-diff__hunks",s.forEach((f,p)=>{let m=document.createElement("div");m.className="blex-diff__hunk",this.selectedHunks.has(p)&&m.classList.add("blex-diff__hunk--selected");let g=document.createElement("div");g.className="blex-diff__hunk-header",g.setAttribute("data-testid",`blex-diff-hunk-${p}`),g.textContent=f.header,this.addListener(g,"click",()=>{this.selectedHunks.has(p)?(this.selectedHunks.delete(p),m.classList.remove("blex-diff__hunk--selected")):(this.selectedHunks.add(p),m.classList.add("blex-diff__hunk--selected"))}),m.appendChild(g);for(let x of f.lines){let _=document.createElement("div");_.className=`blex-diff__line blex-diff__line--${x.type}`,_.textContent=x.content,m.appendChild(_)}l.appendChild(m)}),a.appendChild(l);let c=document.createElement("div");c.className="blex-diff__actions";let d=document.createElement("button");d.className="blex-diff__toggle",d.setAttribute("data-testid",`blex-diff-toggle-${e.id}`),d.textContent=this.viewMode==="unified"?"Side by side":"Unified",this.addListener(d,"click",()=>{this.viewMode=this.viewMode==="unified"?"side-by-side":"unified",a.className=`blex-diff blex-diff--${this.viewMode}`,d.textContent=this.viewMode==="unified"?"Side by side":"Unified"}),c.appendChild(d);let h=document.createElement("button");h.className="blex-diff__apply",h.setAttribute("data-testid",`blex-diff-apply-${e.id}`),h.textContent="Apply",this.addListener(h,"click",()=>{this.emit({blockId:e.id,type:"apply",payload:{hunks:s},serialized:`Applied diff to ${o??"file"}`,summary:`Applied diff${o?`: ${o}`:""}`,icon:"\u2705",immediate:!0})}),c.appendChild(h);let u=document.createElement("button");u.className="blex-diff__reject",u.setAttribute("data-testid",`blex-diff-reject-${e.id}`),u.textContent="Reject",this.addListener(u,"click",()=>{this.emit({blockId:e.id,type:"reject",payload:{hunks:s},serialized:`Rejected diff to ${o??"file"}`,summary:`Rejected diff${o?`: ${o}`:""}`,icon:"\u274C",immediate:!0})}),c.appendChild(u),a.appendChild(c),n.appendChild(a)}};function Ra(){return new ws}Z();var Ms=class extends P{constructor(){super(...arguments);this.expandedPaths=new Set;this.selectedPaths=new Set;this.currentBlock=null}render(e,n){if(this.currentBlock=e,this.container=n,e.data.expanded)for(let s of e.data.expanded)this.expandedPaths.add(s);this.buildTree(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){!this.container||!this.currentBlock||e.type==="select"&&(this.selectedPaths.clear(),this.container.innerHTML="",this.buildTree(this.currentBlock))}update(e){this.container&&(this.currentBlock=e,this.container.innerHTML="",this.buildTree(e))}buildTree(e){let n=this.container,s=document.createElement("div");s.className="blex-file-tree",s.setAttribute("data-testid",`blex-file-tree-${e.id}`);let o=this.buildNode(e.data.root,"",e);s.appendChild(o),n.appendChild(s)}buildNode(e,n,s){let o=n?`${n}/${e.name}`:e.name,a=document.createElement("div");a.className=`blex-file-tree__node blex-file-tree__node--${e.type}`,a.setAttribute("data-testid",`blex-file-tree-node-${o.replace(/\//g,"-")}`),this.selectedPaths.has(o)&&a.classList.add("blex-file-tree__node--selected");let r=document.createElement("span");if(r.className="blex-file-tree__label",r.textContent=e.name,e.type==="directory"){let l=this.expandedPaths.has(o),c=document.createElement("span");if(c.className="blex-file-tree__toggle",c.textContent=l?"\u25BC":"\u25B6",this.addListener(c,"click",d=>{d.stopPropagation(),this.expandedPaths.has(o)?this.expandedPaths.delete(o):this.expandedPaths.add(o),this.container.innerHTML="",this.buildTree(s)}),a.appendChild(c),a.appendChild(r),l&&e.children){let d=document.createElement("div");d.className="blex-file-tree__children";for(let h of e.children)d.appendChild(this.buildNode(h,o,s));a.appendChild(d)}}else if(a.appendChild(r),e.size!==void 0){let l=document.createElement("span");l.className="blex-file-tree__size",l.textContent=this.formatSize(e.size),a.appendChild(l)}return this.addListener(r,"click",()=>{this.selectedPaths.has(o)?(this.selectedPaths.delete(o),a.classList.remove("blex-file-tree__node--selected")):(this.selectedPaths.add(o),a.classList.add("blex-file-tree__node--selected")),this.emitSelection(s)}),a}emitSelection(e){let n=Array.from(this.selectedPaths).sort(),s=n.length,o=n[n.length-1]??"",a=o.split("/").pop()??o;this.emit({blockId:e.id,type:"select",payload:{paths:n},serialized:`Selected files:
458
+ \`\`\``,c=o.length===1?`line ${o[0]}`:`lines ${o[0]}-${o[o.length-1]}`;this.emit({blockId:e.id,type:"select",payload:{lines:o,...s!==void 0&&{language:s}},serialized:l,summary:`Selected ${c}`,icon:"< >",immediate:!1,revertable:!0})}};function Oa(){return new ks}Z();var ws=class extends P{constructor(){super(...arguments);this.viewMode="unified";this.selectedHunks=new Set}render(e,n){this.container=n,this._build(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this._build(e))}_build(e){let n=this.container,{hunks:s,filename:o}=e.data,a=document.createElement("div");a.className=`blex-diff blex-diff--${this.viewMode}`,a.setAttribute("data-testid",`blex-diff-${e.id}`);let r=document.createElement("div");r.className="blex-diff__header",o&&(r.textContent=o),a.appendChild(r);let l=document.createElement("div");l.className="blex-diff__hunks",s.forEach((f,p)=>{let m=document.createElement("div");m.className="blex-diff__hunk",this.selectedHunks.has(p)&&m.classList.add("blex-diff__hunk--selected");let g=document.createElement("div");g.className="blex-diff__hunk-header",g.setAttribute("data-testid",`blex-diff-hunk-${p}`),g.textContent=f.header,this.addListener(g,"click",()=>{this.selectedHunks.has(p)?(this.selectedHunks.delete(p),m.classList.remove("blex-diff__hunk--selected")):(this.selectedHunks.add(p),m.classList.add("blex-diff__hunk--selected"))}),m.appendChild(g);for(let x of f.lines){let _=document.createElement("div");_.className=`blex-diff__line blex-diff__line--${x.type}`,_.textContent=x.content,m.appendChild(_)}l.appendChild(m)}),a.appendChild(l);let c=document.createElement("div");c.className="blex-diff__actions";let d=document.createElement("button");d.className="blex-diff__toggle",d.setAttribute("data-testid",`blex-diff-toggle-${e.id}`),d.textContent=this.viewMode==="unified"?"Side by side":"Unified",this.addListener(d,"click",()=>{this.viewMode=this.viewMode==="unified"?"side-by-side":"unified",a.className=`blex-diff blex-diff--${this.viewMode}`,d.textContent=this.viewMode==="unified"?"Side by side":"Unified"}),c.appendChild(d);let h=document.createElement("button");h.className="blex-diff__apply",h.setAttribute("data-testid",`blex-diff-apply-${e.id}`),h.textContent="Apply",this.addListener(h,"click",()=>{this.emit({blockId:e.id,type:"apply",payload:{hunks:s},serialized:`Applied diff to ${o??"file"}`,summary:`Applied diff${o?`: ${o}`:""}`,icon:"\u2705",immediate:!0})}),c.appendChild(h);let u=document.createElement("button");u.className="blex-diff__reject",u.setAttribute("data-testid",`blex-diff-reject-${e.id}`),u.textContent="Reject",this.addListener(u,"click",()=>{this.emit({blockId:e.id,type:"reject",payload:{hunks:s},serialized:`Rejected diff to ${o??"file"}`,summary:`Rejected diff${o?`: ${o}`:""}`,icon:"\u274C",immediate:!0})}),c.appendChild(u),a.appendChild(c),n.appendChild(a)}};function Ra(){return new ws}Z();var Ms=class extends P{constructor(){super(...arguments);this.expandedPaths=new Set;this.selectedPaths=new Set;this.currentBlock=null}render(e,n){if(this.currentBlock=e,this.container=n,e.data.expanded)for(let s of e.data.expanded)this.expandedPaths.add(s);this.buildTree(e),n.setAttribute("data-blex-ready","true")}revertInteraction(e){!this.container||!this.currentBlock||e.type==="select"&&(this.selectedPaths.clear(),this.container.innerHTML="",this.buildTree(this.currentBlock))}update(e){this.container&&(this.currentBlock=e,this.container.innerHTML="",this.buildTree(e))}buildTree(e){let n=this.container,s=document.createElement("div");s.className="blex-file-tree",s.setAttribute("data-testid",`blex-file-tree-${e.id}`);let o=this.buildNode(e.data.root,"",e);s.appendChild(o),n.appendChild(s)}buildNode(e,n,s){let o=n?`${n}/${e.name}`:e.name,a=document.createElement("div");a.className=`blex-file-tree__node blex-file-tree__node--${e.type}`,a.setAttribute("data-testid",`blex-file-tree-node-${o.replace(/\//g,"-")}`),this.selectedPaths.has(o)&&a.classList.add("blex-file-tree__node--selected");let r=document.createElement("span");if(r.className="blex-file-tree__label",r.textContent=e.name,e.type==="directory"){let l=this.expandedPaths.has(o),c=document.createElement("span");if(c.className="blex-file-tree__toggle",c.textContent=l?"\u25BC":"\u25B6",this.addListener(c,"click",d=>{d.stopPropagation(),this.expandedPaths.has(o)?this.expandedPaths.delete(o):this.expandedPaths.add(o),this.container.innerHTML="",this.buildTree(s)}),a.appendChild(c),a.appendChild(r),l&&e.children){let d=document.createElement("div");d.className="blex-file-tree__children";for(let h of e.children)d.appendChild(this.buildNode(h,o,s));a.appendChild(d)}}else if(a.appendChild(r),e.size!==void 0){let l=document.createElement("span");l.className="blex-file-tree__size",l.textContent=this.formatSize(e.size),a.appendChild(l)}return this.addListener(r,"click",()=>{this.selectedPaths.has(o)?(this.selectedPaths.delete(o),a.classList.remove("blex-file-tree__node--selected")):(this.selectedPaths.add(o),a.classList.add("blex-file-tree__node--selected")),this.emitSelection(s)}),a}emitSelection(e){if(this.selectedPaths.size===0)return;let n=Array.from(this.selectedPaths).sort(),s=n.length,o=n[n.length-1]??"",a=o.split("/").pop()??o;this.emit({blockId:e.id,type:"select",payload:{paths:n},serialized:`Selected files:
459
459
  ${n.join(`
460
460
  `)}`,summary:s===1?`Selected ${a}`:`Selected ${s} files`,icon:"\u{1F4C1}",immediate:!1,revertable:!0})}formatSize(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}};function Ia(){return new Ms}Z();var Ss=class extends P{constructor(){super(...arguments);this.values={};this.errors={}}render(e,n){this.container=n;for(let s of e.data.fields)s.defaultValue!==void 0&&(this.values[s.name]=s.defaultValue);this.buildForm(e),n.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this.buildForm(e))}buildForm(e){let n=this.container,{title:s,fields:o,submitLabel:a}=e.data,r=document.createElement("form");if(r.className="blex-form",r.setAttribute("data-testid",`blex-form-${e.id}`),this.addListener(r,"submit",c=>{if(c.preventDefault(),this.validate(o)){let d=Object.entries(this.values).map(([u,f])=>`${u}: ${f}`).join(`
461
461
  `),h=Object.keys(this.values).length;this.emit({blockId:e.id,type:"submit",payload:{...this.values},serialized:`Form submission${s?` (${s})`:""}: