@luckydraw/cumulus 1.0.31 → 1.0.33

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
- "use strict";var Blex=(()=>{var Kc=Object.create;var fn=Object.defineProperty;var Qc=Object.getOwnPropertyDescriptor;var Jc=Object.getOwnPropertyNames;var Zc=Object.getPrototypeOf,td=Object.prototype.hasOwnProperty;var ed=(n,t,e)=>t in n?fn(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var nd=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var St=(n,t)=>()=>(n&&(t=n(n=0)),t);var Jt=(n,t)=>{for(var e in t)fn(n,e,{get:t[e],enumerable:!0})},ra=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jc(t))!td.call(n,s)&&s!==e&&fn(n,s,{get:()=>t[s],enumerable:!(i=Qc(t,s))||i.enumerable});return n};var id=(n,t,e)=>(e=n!=null?Kc(Zc(n)):{},ra(t||!n||!n.__esModule?fn(e,"default",{value:n,enumerable:!0}):e,n)),sd=n=>ra(fn({},"__esModule",{value:!0}),n);var E=(n,t,e)=>ed(n,typeof t!="symbol"?t+"":t,e);var I,G=St(()=>{"use strict";I=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:i}of this.trackedListeners)t.removeEventListener(e,i);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,i){t.addEventListener(e,i),this.trackedListeners.push({target:t,type:e,listener:i})}setTimeout(t,e){let i=window.setTimeout(t,e);return this.trackedTimers.push(i),i}setInterval(t,e){let i=window.setInterval(t,e);return this.trackedTimers.push(i),i}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 Ua={};Jt(Ua,{MermaidRenderer:()=>ai,createMermaidRenderer:()=>Rd});function Rd(){return new ai}var ai,Ya=St(()=>{"use strict";G();ai=class extends I{constructor(){super(...arguments);this.showSource=!1;this._renderPromise=Promise.resolve()}render(e,i){this.container=i,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 i=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 m=document.createElement("div");m.className="blex-mermaid__title",m.textContent=o,a.appendChild(m)}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 m=r.innerHTML,p=new Blob([m],{type:"image/svg+xml"}),g=URL.createObjectURL(p),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 m=r.innerHTML,p=new Blob([m],{type:"image/svg+xml"}),g=URL.createObjectURL(p),x=new Image;x.onload=()=>{let _=document.createElement("canvas");_.width=x.naturalWidth||x.width||800,_.height=x.naturalHeight||x.height||600;let w=_.getContext("2d");w&&(w.drawImage(x,0,0),_.toBlob(y=>{if(y){let v=URL.createObjectURL(y),k=document.createElement("a");k.href=v,k.download=`${e.id}.png`,k.click(),URL.revokeObjectURL(v)}},"image/png")),URL.revokeObjectURL(g)},x.src=g}),d.appendChild(f),a.appendChild(d),i.appendChild(a);try{let m=await import("mermaid"),p=m.default??m;p.initialize({startOnLoad:!1,theme:"default"});let{svg:g}=await p.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"),i.setAttribute("data-blex-ready","true")}}});function wn(n){return n+.5|0}function yn(n){return ae(wn(n*2.55),0,255)}function re(n){return ae(wn(n*255),0,255)}function Zt(n){return ae(wn(n/2.55)/100,0,1)}function qa(n){return ae(wn(n*100),0,100)}function Fd(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Tt[n[1]]*17,g:255&Tt[n[2]]*17,b:255&Tt[n[3]]*17,a:t===5?Tt[n[4]]*17:255}:(t===7||t===9)&&(e={r:Tt[n[1]]<<4|Tt[n[2]],g:Tt[n[3]]<<4|Tt[n[4]],b:Tt[n[5]]<<4|Tt[n[6]],a:t===9?Tt[n[7]]<<4|Tt[n[8]]:255})),e}function Hd(n){var t=zd(n)?Nd:Bd;return n?"#"+t(n.r)+t(n.g)+t(n.b)+$d(n.a,t):void 0}function Qa(n,t,e){let i=t*Math.min(e,1-e),s=(o,a=(o+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function jd(n,t,e){let i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Wd(n,t,e){let i=Qa(n,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Ud(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function Ns(n){let e=n.r/255,i=n.g/255,s=n.b/255,o=Math.max(e,i,s),a=Math.min(e,i,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=Ud(e,i,s,d,o),l=l*60+.5),[l|0,c||0,r]}function Bs(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(re)}function zs(n,t,e){return Bs(Qa,n,t,e)}function Yd(n,t,e){return Bs(Wd,n,t,e)}function qd(n,t,e){return Bs(jd,n,t,e)}function Ja(n){return(n%360+360)%360}function Gd(n){let t=Vd.exec(n),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?yn(+t[5]):re(+t[5]));let s=Ja(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Yd(s,o,a):t[1]==="hsv"?i=qd(s,o,a):i=zs(s,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function Xd(n,t){var e=Ns(n);e[0]=Ja(e[0]+t),e=zs(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Kd(n){if(!n)return;let t=Ns(n),e=t[0],i=qa(t[1]),s=qa(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Zt(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}function Qd(){let n={},t=Object.keys(Xa),e=Object.keys(Ga),i,s,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],s=0;s<e.length;s++)o=e[s],r=r.replace(o,Ga[o]);o=parseInt(Xa[a],16),n[r]=[o>>16&255,o>>8&255,o&255]}return n}function Jd(n){li||(li=Qd(),li.transparent=[0,0,0,0]);let t=li[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function th(n){let t=Zd.exec(n),e=255,i,s,o;if(t){if(t[7]!==i){let a=+t[7];e=t[8]?yn(a):ae(a*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?yn(i):ae(i,0,255)),s=255&(t[4]?yn(s):ae(s,0,255)),o=255&(t[6]?yn(o):ae(o,0,255)),{r:i,g:s,b:o,a:e}}}function eh(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Zt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}function nh(n,t,e){let i=We(Zt(n.r)),s=We(Zt(n.g)),o=We(Zt(n.b));return{r:re(Os(i+e*(We(Zt(t.r))-i))),g:re(Os(s+e*(We(Zt(t.g))-s))),b:re(Os(o+e*(We(Zt(t.b))-o))),a:n.a+e*(t.a-n.a)}}function ci(n,t,e){if(n){let i=Ns(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=zs(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Za(n,t){return n&&Object.assign(t||{},n)}function Ka(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=re(n[3]))):(t=Za(n,{r:0,g:0,b:0,a:1}),t.a=re(t.a)),t}function ih(n){return n.charAt(0)==="r"?th(n):Gd(n)}var ae,Tt,Rs,Nd,Bd,ri,zd,$d,Vd,Ga,Xa,li,Zd,Os,We,vn,tr=St(()=>{"use strict";ae=(n,t,e)=>Math.max(Math.min(n,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},Rs=[..."0123456789ABCDEF"],Nd=n=>Rs[n&15],Bd=n=>Rs[(n&240)>>4]+Rs[n&15],ri=n=>(n&240)>>4===(n&15),zd=n=>ri(n.r)&&ri(n.g)&&ri(n.b)&&ri(n.a);$d=(n,t)=>n<255?t(n):"";Vd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;Ga={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"},Xa={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"};Zd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;Os=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,We=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);vn=class n{constructor(t){if(t instanceof n)return t;let e=typeof t,i;e==="object"?i=Ka(t):e==="string"&&(i=Fd(t)||Jd(t)||ih(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Za(this._rgb);return t&&(t.a=Zt(t.a)),t}set rgb(t){this._rgb=Ka(t)}rgbString(){return this._valid?eh(this._rgb):void 0}hexString(){return this._valid?Hd(this._rgb):void 0}hslString(){return this._valid?Kd(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,s=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=i.a-s.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=nh(this._rgb,t._rgb,e)),this}clone(){return new n(this.rgb)}alpha(t){return this._rgb.a=re(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=wn(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 ci(this._rgb,2,t),this}darken(t){return ci(this._rgb,2,-t),this}saturate(t){return ci(this._rgb,1,t),this}desaturate(t){return ci(this._rgb,1,-t),this}rotate(t){return Xd(this._rgb,t),this}}});function Ht(){}function B(n){return n==null}function U(n){if(Array.isArray&&Array.isArray(n))return!0;let t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function z(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function Z(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function yt(n,t){return Z(n)?n:t}function P(n,t){return typeof n>"u"?t:n}function j(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function H(n,t,e,i){let s,o,a;if(U(n))if(o=n.length,i)for(s=o-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;s<o;s++)t.call(e,n[s],s);else if(z(n))for(a=Object.keys(n),o=a.length,s=0;s<o;s++)t.call(e,n[a[s]],a[s])}function En(n,t){let e,i,s,o;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function fi(n){if(U(n))return n.map(fi);if(z(n)){let t=Object.create(null),e=Object.keys(n),i=e.length,s=0;for(;s<i;++s)t[e[s]]=fi(n[e[s]]);return t}return n}function fr(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function sh(n,t,e,i){if(!fr(n))return;let s=t[n],o=e[n];z(s)&&z(o)?Ye(s,o,i):t[n]=fi(o)}function Ye(n,t,e){let i=U(t)?t:[t],s=i.length;if(!z(n))return n;e=e||{};let o=e.merger||sh,a;for(let r=0;r<s;++r){if(a=i[r],!z(a))continue;let l=Object.keys(a);for(let c=0,d=l.length;c<d;++c)o(l[c],n,a,e)}return n}function Ge(n,t){return Ye(n,t,{merger:oh})}function oh(n,t,e){if(!fr(n))return;let i=t[n],s=e[n];z(i)&&z(s)?Ge(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=fi(s))}function ah(n){let t=n.split("."),e=[],i="";for(let s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function rh(n){let t=ah(n);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function ne(n,t){return(er[t]||(er[t]=rh(t)))(n)}function bi(n){return n.charAt(0).toUpperCase()+n.slice(1)}function pr(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}function Ke(n,t,e){return Math.abs(n-t)<e}function Ws(n){let t=Math.round(n);n=Ke(n,t,n/1e3)?t:n;let e=Math.pow(10,Math.floor(ee(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function mr(n){let t=[],e=Math.sqrt(n),i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function dh(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Se(n){return!dh(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function gr(n,t){let e=Math.round(n);return e-t<=n&&e+t>=n}function Us(n,t,e){let i,s,o;for(i=0,s=n.length;i<s;i++)o=n[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Dt(n){return n*(F/180)}function xi(n){return n*(180/F)}function Ys(n){if(!Z(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function qs(n,t){let e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i),o=Math.atan2(i,e);return o<-.5*F&&(o+=Y),{angle:o,distance:s}}function mi(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function hh(n,t){return(n-t+lh)%Y-F}function dt(n){return(n%Y+Y)%Y}function Qe(n,t,e,i){let s=dt(n),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||i&&o===a||r>l&&c<d}function at(n,t,e){return Math.max(t,Math.min(e,n))}function br(n){return at(n,-32768,32767)}function Vt(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function _i(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}function _r(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}function vr(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),yr.forEach(e=>{let i="_onData"+bi(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){let a=s.apply(this,o);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function Gs(n,t){let e=n._chartjs;if(!e)return;let i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(yr.forEach(o=>{delete n[o]}),delete n._chartjs)}function Xs(n){let t=new Set(n);return t.size===n.length?n:Array.from(t)}function Qs(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Ks.call(window,()=>{i=!1,n.apply(t,e)}))}}function wr(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}function Js(n,t,e){let i=t.length,s=0,o=i;if(n._sorted){let{iScale:a,vScale:r,_parsed:l}=n,c=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null,d=a.axis,{min:h,max:u,minDefined:f,maxDefined:m}=a.getUserBounds();if(f){if(s=Math.min(Ft(l,d,h).lo,e?i:Ft(t,d,a.getPixelForValue(h)).lo),c){let p=l.slice(0,s+1).reverse().findIndex(g=>!B(g[r.axis]));s-=Math.max(0,p)}s=at(s,0,i-1)}if(m){let p=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(p-1).findIndex(x=>!B(x[r.axis]));p+=Math.max(0,g)}o=at(p,s,i)-s}else o=i-s}return{start:s,count:o}}function Zs(n){let{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}function to(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function eo(n){return to(n)?n:new vn(n)}function Fs(n){return to(n)?n:new vn(n).saturate(.5).darken(.1).hexString()}function ph(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:fh},numbers:{type:"number",properties:uh}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function mh(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function gh(n,t){t=t||{};let e=n+JSON.stringify(t),i=or.get(e);return i||(i=new Intl.NumberFormat(n,t),or.set(e,i)),i}function Je(n,t,e){return gh(t,e).format(n)}function bh(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}function xh(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ze.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function Cn(n,t){if(!t)return n;let e=t.split(".");for(let i=0,s=e.length;i<s;++i){let o=e[i];n=n[o]||(n[o]=Object.create(null))}return n}function $s(n,t,e){return typeof t=="string"?Ye(Cn(n,t),e):Ye(Cn(n,""),t)}function _h(n){return!n||B(n.size)||B(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function kn(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function Er(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.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=kn(n,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=kn(n,s,o,a,u));n.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 he(n,t,e){let i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function no(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function wi(n,t,e,i){io(n,t,e,i,null)}function io(n,t,e,i,s){let o,a,r,l,c,d,h,u,f=t.pointStyle,m=t.rotation,p=t.radius,g=(m||0)*ch;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(g),n.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),n.restore();return}if(!(isNaN(p)||p<=0)){switch(n.beginPath(),f){default:s?n.ellipse(e,i,s/2,p,0,0,Y):n.arc(e,i,p,0,Y),n.closePath();break;case"triangle":d=s?s/2:p,n.moveTo(e+Math.sin(g)*d,i-Math.cos(g)*p),g+=nr,n.lineTo(e+Math.sin(g)*d,i-Math.cos(g)*p),g+=nr,n.lineTo(e+Math.sin(g)*d,i-Math.cos(g)*p),n.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(g+ke)*l,h=Math.cos(g+ke)*(s?s/2-c:l),r=Math.sin(g+ke)*l,u=Math.sin(g+ke)*(s?s/2-c:l),n.arc(e-h,i-r,c,g-F,g-tt),n.arc(e+u,i-a,c,g-tt,g),n.arc(e+h,i+r,c,g,g+tt),n.arc(e-u,i+a,c,g+tt,g+F),n.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,n.rect(e-d,i-l,2*d,2*l);break}g+=ke;case"rectRot":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+u,i-a),n.lineTo(e+h,i+r),n.lineTo(e-u,i+a),n.closePath();break;case"crossRot":g+=ke;case"cross":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a);break;case"star":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a),g+=ke,h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a);break;case"line":a=s?s/2:Math.cos(g)*p,r=Math.sin(g)*p,n.moveTo(e-a,i-r),n.lineTo(e+a,i+r);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(g)*(s?s/2:p),i+Math.sin(g)*p);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function $t(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function Mn(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function Sn(n){n.restore()}function Mr(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){let o=(t.x+e.x)/2;n.lineTo(o,t.y),n.lineTo(o,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function Sr(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function yh(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),B(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function vh(n,t,e,i,s){if(s.strikethrough||s.underline){let o=n.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,d),n.lineTo(r,d),n.stroke()}}function wh(n,t){let e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function ue(n,t,e,i,s,o={}){let a=U(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(n.save(),n.font=s.string,yh(n,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&wh(n,o.backdrop),r&&(o.strokeColor&&(n.strokeStyle=o.strokeColor),B(o.strokeWidth)||(n.lineWidth=o.strokeWidth),n.strokeText(c,e,i,o.maxWidth)),n.fillText(c,e,i,o.maxWidth),vh(n,e,i,c,o),i+=Number(s.lineHeight);n.restore()}function tn(n,t){let{x:e,y:i,w:s,h:o,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*F,F,!0),n.lineTo(e,i+o-a.bottomLeft),n.arc(e+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,F,tt,!0),n.lineTo(e+s-a.bottomRight,i+o),n.arc(e+s-a.bottomRight,i+o-a.bottomRight,a.bottomRight,tt,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-tt,!0),n.lineTo(e+a.topLeft,i)}function Eh(n,t){let e=(""+n).match(Ch);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}function Ci(n,t){let e={},i=z(t),s=i?Object.keys(t):t,o=z(n)?i?a=>P(n[a],n[t[a]]):a=>n[a]:()=>n;for(let a of s)e[a]=Mh(o(a));return e}function so(n){return Ci(n,{top:"y",right:"x",bottom:"y",left:"x"})}function fe(n){return Ci(n,["topLeft","topRight","bottomLeft","bottomRight"])}function ut(n){let t=so(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function st(n,t){n=n||{},t=t||q.font;let e=P(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=P(n.style,t.style);i&&!(""+i).match(kh)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let s={family:P(n.family,t.family),lineHeight:Eh(P(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:P(n.weight,t.weight),string:""};return s.string=_h(s),s}function en(n,t,e,i){let s=!0,o,a,r;for(o=0,a=n.length;o<a;++o)if(r=n[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 i&&!s&&(i.cacheable=!1),r}function Ar(n,t,e){let{min:i,max:s}=n,o=Vs(t,(s-i)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(s,o)}}function ie(n,t){return Object.assign(Object.create(n),t)}function ki(n,t=[""],e,i,s=()=>n[0]){let o=e||n;typeof i>"u"&&(i=Lr("_fallback",n));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:r=>ki([r,...n],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete n[0][l],!0},get(r,l){return Tr(r,l,()=>Oh(l,t,n,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(r,l){return rr(r).includes(l)},ownKeys(r){return rr(r)},set(r,l,c){let d=r._storage||(r._storage=s());return r[l]=d[l]=c,delete r._keys,!0}})}function Me(n,t,e,i){let s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:oo(n,i),setContext:o=>Me(n,o,e,i),override:o=>Me(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete n[a],!0},get(o,a,r){return Tr(o,a,()=>Ah(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(o,a,r){return n[a]=r,delete o[a],!0}})}function oo(n,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:te(e)?e:()=>e,isIndexable:te(i)?i:()=>i}}function Tr(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];let i=e();return n[t]=i,i}function Ah(n,t,e){let{_proxy:i,_context:s,_subProxy:o,_descriptors:a}=n,r=i[t];return te(r)&&a.isScriptable(t)&&(r=Th(t,r,n,e)),U(r)&&r.length&&(r=Dh(t,r,n,a.isIndexable)),ao(t,r)&&(r=Me(r,s,o&&o[t],a)),r}function Th(n,t,e,i){let{_proxy:s,_context:o,_subProxy:a,_stack:r}=e;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);r.add(n);let l=t(o,a||i);return r.delete(n),ao(n,l)&&(l=ro(s._scopes,s,n,l)),l}function Dh(n,t,e,i){let{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(z(t[0])){let l=t,c=s._scopes.filter(d=>d!==l);t=[];for(let d of l){let h=ro(c,s,n,d);t.push(Me(h,o,a&&a[n],r))}}return t}function Dr(n,t,e){return te(n)?n(t,e):n}function Ih(n,t,e,i,s){for(let o of t){let a=Lh(e,o);if(a){n.add(a);let r=Dr(a._fallback,e,s);if(typeof r<"u"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function ro(n,t,e,i){let s=t._rootScopes,o=Dr(t._fallback,e,i),a=[...n,...s],r=new Set;r.add(i);let l=ar(r,a,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=ar(r,a,o,l,i),l===null)?!1:ki(Array.from(r),[""],s,o,()=>Ph(t,e,i))}function ar(n,t,e,i,s){for(;e;)e=Ih(n,t,e,i,s);return e}function Ph(n,t,e){let i=n._getTarget();t in i||(i[t]={});let s=i[t];return U(s)&&z(e)?e:s||{}}function Oh(n,t,e,i){let s;for(let o of t)if(s=Lr(Sh(o,n),e),typeof s<"u")return ao(n,s)?ro(e,i,n,s):s}function Lr(n,t){for(let e of t){if(!e)continue;let i=e[n];if(typeof i<"u")return i}}function rr(n){let t=n._keys;return t||(t=n._keys=Rh(n._scopes)),t}function Rh(n){let t=new Set;for(let e of n)for(let i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function lo(n,t,e,i){let{iScale:s}=n,{key:o="r"}=this._parsing,a=new Array(i),r,l,c,d;for(r=0,l=i;r<l;++r)c=r+e,d=t[c],a[r]={r:s.parse(ne(d,o),c)};return a}function Bh(n,t,e,i){let s=n.skip?t:n,o=t,a=e.skip?t:e,r=mi(o,s),l=mi(a,o),c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let h=i*c,u=i*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 zh(n,t,e){let i=n.length,s,o,a,r,l,c=qe(n,0);for(let d=0;d<i-1;++d)if(l=c,c=qe(n,d+1),!(!l||!c)){if(Ke(t[d],0,Nh)){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 Fh(n,t,e="x"){let i=Ir(e),s=n.length,o,a,r,l=qe(n,0);for(let c=0;c<s;++c){if(a=r,r=l,l=qe(n,c+1),!r)continue;let d=r[e],h=r[i];a&&(o=(d-a[e])/3,r[`cp1${e}`]=d-o,r[`cp1${i}`]=h-o*t[c]),l&&(o=(l[e]-d)/3,r[`cp2${e}`]=d+o,r[`cp2${i}`]=h+o*t[c])}}function $h(n,t="x"){let e=Ir(t),i=n.length,s=Array(i).fill(0),o=Array(i),a,r,l,c=qe(n,0);for(a=0;a<i;++a)if(r=l,l=c,c=qe(n,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?Lt(s[a-1])!==Lt(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}zh(n,s,o),Fh(n,o,t)}function hi(n,t,e){return Math.max(Math.min(n,e),t)}function Hh(n,t){let e,i,s,o,a,r=$t(n[0],t);for(e=0,i=n.length;e<i;++e)a=o,o=r,r=e<i-1&&$t(n[e+1],t),o&&(s=n[e],a&&(s.cp1x=hi(s.cp1x,t.left,t.right),s.cp1y=hi(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=hi(s.cp2x,t.left,t.right),s.cp2y=hi(s.cp2y,t.top,t.bottom)))}function Pr(n,t,e,i,s){let o,a,r,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")$h(n,s);else{let c=i?n[n.length-1]:n[0];for(o=0,a=n.length;o<a;++o)r=n[o],l=Bh(c,r,n[Math.min(o+1,a-(i?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&&Hh(n,e)}function Ei(){return typeof window<"u"&&typeof document<"u"}function Mi(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function gi(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}function Vh(n,t){return Si(n).getPropertyValue(t)}function Ee(n,t,e){let i={};e=e?"-"+e:"";for(let s=0;s<4;s++){let o=jh[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function Uh(n,t){let e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i,a=!1,r,l;if(Wh(s,o,n.target))r=s,l=o;else{let c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function pe(n,t){if("native"in n)return n;let{canvas:e,currentDevicePixelRatio:i}=t,s=Si(e),o=s.boxSizing==="border-box",a=Ee(s,"padding"),r=Ee(s,"border","width"),{x:l,y:c,box:d}=Uh(n,e),h=a.left+(d&&r.left),u=a.top+(d&&r.top),{width:f,height:m}=t;return o&&(f-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-h)/f*e.width/i),y:Math.round((c-u)/m*e.height/i)}}function Yh(n,t,e){let i,s;if(t===void 0||e===void 0){let o=n&&Mi(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{let a=o.getBoundingClientRect(),r=Si(o),l=Ee(r,"border","width"),c=Ee(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=gi(r.maxWidth,o,"clientWidth"),s=gi(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||pi,maxHeight:s||pi}}function Or(n,t,e,i){let s=Si(n),o=Ee(s,"margin"),a=gi(s.maxWidth,n,"clientWidth")||pi,r=gi(s.maxHeight,n,"clientHeight")||pi,l=Yh(n,t,e),{width:c,height:d}=l;if(s.boxSizing==="content-box"){let u=Ee(s,"border","width"),f=Ee(s,"padding");c-=f.width+u.width,d-=f.height+u.height}return c=Math.max(0,c-o.width),d=Math.max(0,i?c/i:d-o.height),c=ce(Math.min(c,a,l.maxWidth)),d=ce(Math.min(d,r,l.maxHeight)),c&&!d&&(d=ce(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=ce(Math.floor(d*i))),{width:c,height:d}}function co(n,t,e){let i=t||1,s=ce(n.height*i),o=ce(n.width*i);n.height=ce(n.height),n.width=ce(n.width);let a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==o?(n.currentDevicePixelRatio=i,a.height=s,a.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}function ho(n,t){let e=Vh(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function le(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Nr(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function Br(n,t,e,i){let s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},a=le(n,s,e),r=le(s,o,e),l=le(o,t,e),c=le(a,r,e),d=le(r,l,e);return le(c,d,e)}function Ae(n,t,e){return n?qh(t,e):Gh()}function uo(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function fo(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function zr(n){return n==="angle"?{between:Qe,compare:hh,normalize:dt}:{between:Vt,compare:(t,e)=>t-e,normalize:t=>t}}function lr({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function Xh(n,t,e){let{property:i,start:s,end:o}=e,{between:a,normalize:r}=zr(i),l=t.length,{start:c,end:d,loop:h}=n,u,f;if(h){for(c+=l,d+=l,u=0,f=l;u<f&&a(r(t[c%l][i]),s,o);++u)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:n.style}}function po(n,t,e){if(!e)return[n];let{property:i,start:s,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=zr(i),{start:d,end:h,loop:u,style:f}=Xh(n,t,e),m=[],p=!1,g=null,x,_,w,y=()=>l(s,w,x)&&r(s,w)!==0,v=()=>r(o,x)===0||l(o,w,x),k=()=>p||y(),M=()=>!p||v();for(let S=d,L=d;S<=h;++S)_=t[S%a],!_.skip&&(x=c(_[i]),x!==w&&(p=l(x,s,o),g===null&&k()&&(g=r(x,s)===0?S:L),g!==null&&M()&&(m.push(lr({start:g,end:S,loop:u,count:a,style:f})),g=null),L=S,w=x));return g!==null&&m.push(lr({start:g,end:h,loop:u,count:a,style:f})),m}function mo(n,t){let e=[],i=n.segments;for(let s=0;s<i.length;s++){let o=po(i[s],n.points,t);o.length&&e.push(...o)}return e}function Kh(n,t,e,i){let s=0,o=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Qh(n,t,e,i){let s=n.length,o=[],a=t,r=n[t],l;for(l=t+1;l<=e;++l){let c=n[l%s];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),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:i}),o}function Fr(n,t){let e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];let o=!!n._loop,{start:a,end:r}=Kh(e,s,o,i);if(i===!0)return cr(n,[{start:a,end:r,loop:o}],e,t);let l=r<a?r+s:r,c=!!n._fullLoop&&a===0&&r===s-1;return cr(n,Qh(e,a,l,c),e,t)}function cr(n,t,e,i){return!i||!i.setContext||!e?t:Jh(n,t,e,i)}function Jh(n,t,e,i){let s=n._chart.getContext(),o=dr(n.options),{_datasetIndex:a,options:{spanGaps:r}}=n,l=e.length,c=[],d=o,h=t[0].start,u=h;function f(m,p,g,x){let _=r?-1:1;if(m!==p){for(m+=l;e[m%l].skip;)m-=_;for(;e[p%l].skip;)p+=_;m%l!==p%l&&(c.push({start:m%l,end:p%l,loop:g,style:x}),d=x,h=p%l)}}for(let m of t){h=r?h:m.start;let p=e[h%l],g;for(u=h+1;u<=m.end;u++){let x=e[u%l];g=dr(i.setContext(ie(s,{type:"segment",p0:p,p1:x,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Zh(g,d)&&f(h,u-1,m.loop,d),p=x,d=g}h<u-1&&f(h,u-1,m.loop,d)}return c}function dr(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function Zh(n,t){if(!t)return!1;let e=[],i=function(s,o){return to(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(n,i)!==JSON.stringify(t,i)}function ui(n,t,e){return n.options.clip?n[e]:t[e]}function tu(n,t){let{xScale:e,yScale:i}=n;return e&&i?{left:ui(e,t,"left"),right:ui(e,t,"right"),top:ui(i,t,"top"),bottom:ui(i,t,"bottom")}:t}function go(n,t){let e=t._clip;if(e.disabled)return!1;let i=tu(t,n.chartArea);return{left:e.left===!1?0:i.left-(e.left===!0?0:e.left),right:e.right===!1?n.width:i.right+(e.right===!0?0:e.right),top:e.top===!1?0:i.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?n.height:i.bottom+(e.bottom===!0?0:e.bottom)}}var hr,ur,Vs,er,Xe,te,js,F,Y,lh,pi,ch,tt,ke,nr,ee,Lt,Ft,xr,yr,Ks,yi,ht,Cr,di,ir,sr,Ue,uh,fh,or,kr,Ze,de,vi,Hs,q,Ch,kh,Mh,Sh,ao,Lh,Nh,qe,Ir,Si,jh,Wh,ce,Rr,qh,Gh,$r=St(()=>{"use strict";tr();hr=(()=>{let n=0;return()=>n++})();ur=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Vs=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;er={"":n=>n,x:n=>n.x,y:n=>n.y};Xe=n=>typeof n<"u",te=n=>typeof n=="function",js=(n,t)=>{if(n.size!==t.size)return!1;for(let e of n)if(!t.has(e))return!1;return!0};F=Math.PI,Y=2*F,lh=Y+F,pi=Number.POSITIVE_INFINITY,ch=F/180,tt=F/2,ke=F/4,nr=F*2/3,ee=Math.log10,Lt=Math.sign;Ft=(n,t,e,i)=>_i(n,e,i?s=>{let o=n[s][t];return o<e||o===e&&n[s+1][t]===e}:s=>n[s][t]<e),xr=(n,t,e)=>_i(n,e,i=>n[i][t]>=e);yr=["push","pop","shift","splice","unshift"];Ks=(function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame})();yi=n=>n==="start"?"left":n==="end"?"right":"center",ht=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Cr=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;di=n=>n===0||n===1,ir=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*Y/e)),sr=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*Y/e)+1,Ue={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*tt)+1,easeOutSine:n=>Math.sin(n*tt),easeInOutSine:n=>-.5*(Math.cos(F*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>di(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>di(n)?n:ir(n,.075,.3),easeOutElastic:n=>di(n)?n:sr(n,.075,.3),easeInOutElastic(n){return di(n)?n:n<.5?.5*ir(n*2,.1125,.45):.5+.5*sr(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Ue.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Ue.easeInBounce(n*2)*.5:Ue.easeOutBounce(n*2-1)*.5+.5};uh=["x","y","borderWidth","radius","tension"],fh=["color","borderColor","backgroundColor"];or=new Map;kr={values(n){return U(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";let i=this.chart.options.locale,s,o=n;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=bh(n,e)}let a=ee(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),Je(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";let i=e[t].significand||n/Math.pow(10,Math.floor(ee(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?kr.numeric.call(this,n,t,e):""}};Ze={formatters:kr};de=Object.create(null),vi=Object.create(null);Hs=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=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Fs(s.backgroundColor),this.hoverBorderColor=(i,s)=>Fs(s.borderColor),this.hoverColor=(i,s)=>Fs(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 $s(this,t,e)}get(t){return Cn(this,t)}describe(t,e){return $s(vi,t,e)}override(t,e){return $s(de,t,e)}route(t,e,i,s){let o=Cn(this,t),a=Cn(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[s];return z(l)?Object.assign({},c,l):P(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},q=new Hs({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ph,mh,xh]);Ch=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,kh=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;Mh=n=>+n||0;Sh=(n,t)=>n?n+bi(t):t,ao=(n,t)=>z(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);Lh=(n,t)=>n===!0?t:typeof n=="string"?ne(t,n):void 0;Nh=Number.EPSILON||1e-14,qe=(n,t)=>t<n.length&&!n[t].skip&&n[t],Ir=n=>n==="x"?"y":"x";Si=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);jh=["top","right","bottom","left"];Wh=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);ce=n=>Math.round(n*10)/10;Rr=(function(){let n=!1;try{let t={get passive(){return n=!0,!1}};Ei()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n})();qh=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Gh=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}}});var yc={};Jt(yc,{Animation:()=>Ni,Animations:()=>Nn,ArcElement:()=>me,BarController:()=>Le,BarElement:()=>Be,BasePlatform:()=>Bn,BasicPlatform:()=>Bi,BubbleController:()=>Ie,CategoryScale:()=>an,Chart:()=>Ut,Colors:()=>ac,DatasetController:()=>wt,Decimation:()=>lc,DomPlatform:()=>Fi,DoughnutController:()=>Yt,Element:()=>kt,Filler:()=>dc,Interaction:()=>Wl,Legend:()=>uc,LineController:()=>Pe,LineElement:()=>Pt,LinearScale:()=>rn,LogarithmicScale:()=>ln,PieController:()=>sn,PointElement:()=>Ne,PolarAreaController:()=>be,RadarController:()=>Oe,RadialLinearScale:()=>ge,Scale:()=>ye,ScatterController:()=>Re,SubTitle:()=>pc,Ticks:()=>Ze,TimeScale:()=>_e,TimeSeriesScale:()=>cn,Title:()=>fc,Tooltip:()=>gc,_adapters:()=>jl,_detectPlatform:()=>Xl,animator:()=>Wt,controllers:()=>Vl,defaults:()=>q,elements:()=>ic,layouts:()=>ft,plugins:()=>bc,registerables:()=>em,registry:()=>It,scales:()=>_c});function nu(n,t){let e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function iu(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Vr(n,t){let e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function su(n,t,e){if(e===!1)return!1;let i=Vr(n,e),s=Vr(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function ou(n){let t,e,i,s;return z(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function $l(n,t){let e=[],i=n._getSortedDatasetMetas(t),s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function jr(n,t,e,i={}){let s=n.keys,o=i.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,i.all)continue;break}c=n.values[l],Z(c)&&(o||t===0||Lt(t)===Lt(c))&&(t+=c)}return!d&&!i.all?0:t}function au(n,t){let{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(n),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]:n[d]};return r}function bo(n,t){let e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function ru(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function lu(n){let{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function cu(n,t,e){let i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Wr(n,t,e,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function Ur(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,d=ru(o,a,i),h=t.length,u;for(let f=0;f<h;++f){let m=t[f],{[l]:p,[c]:g}=m,x=m._stacks||(m._stacks={});u=x[c]=cu(s,d,p),u[r]=g,u._top=Wr(u,a,!0,i.type),u._bottom=Wr(u,a,!1,i.type);let _=u._visualValues||(u._visualValues={});_[r]=g}}function xo(n,t){let e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function du(n,t){return ie(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function hu(n,t,e){return ie(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function An(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}function fu(n,t){if(!n._cache.$bar){let e=n.getMatchingVisibleMetas(t),i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Xs(i.sort((s,o)=>s-o))}return n._cache.$bar}function pu(n){let t=n.iScale,e=fu(t,n.type),i=t._length,s,o,a,r,l=()=>{a===32767||a===-32768||(Xe(r)&&(i=Math.min(i,Math.abs(a-r)||i)),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 i}function mu(n,t,e,i){let s=e.barThickness,o,a;return B(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[n]-o/2}}function gu(n,t,e,i){let s=t.pixels,o=s[n],a=n>0?s[n-1]:null,r=n<s.length-1?s[n+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/i,ratio:e.barPercentage,start:c}}function bu(n,t,e,i){let s=e.parse(n[0],i),o=e.parse(n[1],i),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 Hl(n,t,e,i){return U(n)?bu(n,t,e,i):t[e.axis]=e.parse(n,i),t}function qr(n,t,e,i){let s=n.iScale,o=n.vScale,a=s.getLabels(),r=s===o,l=[],c,d,h,u;for(c=e,d=e+i;c<d;++c)u=t[c],h={},h[s.axis]=r||s.parse(a[c],c),l.push(Hl(u,h,o,c));return l}function yo(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function xu(n,t,e){return n!==0?Lt(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function _u(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function yu(n,t,e,i){let s=t.borderSkipped,o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:c,bottom:d}=_u(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=d:(o[Gr(d,a,r,l)]=!0,s=c)),o[Gr(s,a,r,l)]=!0,n.borderSkipped=o}function Gr(n,t,e,i){return i?(n=vu(n,t,e),n=Xr(n,e,t)):n=Xr(n,t,e),n}function vu(n,t,e){return n===t?e:n===e?t:n}function Xr(n,t,e){return n==="start"?t:n==="end"?e:n}function wu(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}function Cu(n,t,e){let i=1,s=1,o=0,a=0;if(t<Y){let r=n,l=r+t,c=Math.cos(r),d=Math.sin(r),h=Math.cos(l),u=Math.sin(l),f=(w,y,v)=>Qe(w,r,l,!0)?1:Math.max(y,y*e,v,v*e),m=(w,y,v)=>Qe(w,r,l,!0)?-1:Math.min(y,y*e,v,v*e),p=f(0,c,h),g=f(tt,d,u),x=m(F,c,h),_=m(F+tt,d,u);i=(p-x)/2,s=(g-_)/2,o=-(p+x)/2,a=-(g+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}function Te(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function ku(n,t,e,i){let{controller:s,data:o,_sorted:a}=n,r=s._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?xr:Ft;if(i){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}=n,f=u.slice(0,d.lo+1).reverse().findIndex(p=>!B(p[h.axis]));d.lo-=Math.max(0,f);let m=u.slice(d.hi).findIndex(p=>!B(p[h.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function Hn(n,t,e,i,s){let o=n.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}=ku(o[r],t,a,s);for(let f=h;f<=u;++f){let m=d[f];m.skip||i(m,c,f)}}}function Eu(n){let t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){let o=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function vo(n,t,e,i,s){let o=[];return!s&&!n.isPointInArea(t)||Hn(n,e,t,function(r,l,c){!s&&!$t(r,n.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Mu(n,t,e,i){let s=[];function o(a,r,l){let{startAngle:c,endAngle:d}=a.getProps(["startAngle","endAngle"],i),{angle:h}=qs(a,{x:t.x,y:t.y});Qe(h,c,d)&&s.push({element:a,datasetIndex:r,index:l})}return Hn(n,e,t,o),s}function Su(n,t,e,i,s,o){let a=[],r=Eu(e),l=Number.POSITIVE_INFINITY;function c(d,h,u){let f=d.inRange(t.x,t.y,s);if(i&&!f)return;let m=d.getCenterPoint(s);if(!(!!o||n.isPointInArea(m))&&!f)return;let g=r(t,m);g<l?(a=[{element:d,datasetIndex:h,index:u}],l=g):g===l&&a.push({element:d,datasetIndex:h,index:u})}return Hn(n,e,t,c),a}function wo(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?Mu(n,t,e,s):Su(n,t,e,i,s,o)}function Kr(n,t,e,i,s){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return Hn(n,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))}),i&&!r?[]:o}function Tn(n,t){return n.filter(e=>e.pos===t)}function Qr(n,t){return n.filter(e=>Ul.indexOf(e.pos)===-1&&e.box.axis===t)}function Dn(n,t){return n.sort((e,i)=>{let s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Au(n){let t=[],e,i,s,o,a,r;for(e=0,i=(n||[]).length;e<i;++e)s=n[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 Tu(n){let t={};for(let e of n){let{stack:i,pos:s,stackWeight:o}=e;if(!i||!Ul.includes(s))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Du(n,t){let e=Tu(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,o,a,r;for(o=0,a=n.length;o<a;++o){r=n[o];let{fullSize:l}=r.box,c=e[r.stack],d=c&&r.stackWeight/c.weight;r.horizontal?(r.width=d?d*i:l&&t.availableWidth,r.height=s):(r.width=i,r.height=d?d*s:l&&t.availableHeight)}return e}function Lu(n){let t=Au(n),e=Dn(t.filter(c=>c.box.fullSize),!0),i=Dn(Tn(t,"left"),!0),s=Dn(Tn(t,"right")),o=Dn(Tn(t,"top"),!0),a=Dn(Tn(t,"bottom")),r=Qr(t,"x"),l=Qr(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Tn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Jr(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Yl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function Iu(n,t,e,i){let{pos:s,box:o}=e,a=n.maxPadding;if(!z(s)){e.size&&(n[s]-=e.size);let h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&Yl(a,o.getPadding());let r=Math.max(0,t.outerWidth-Jr(a,n,"left","right")),l=Math.max(0,t.outerHeight-Jr(a,n,"top","bottom")),c=r!==n.w,d=l!==n.h;return n.w=r,n.h=l,e.horizontal?{same:c,other:d}:{same:d,other:c}}function Pu(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function Ou(n,t){let e=t.maxPadding;function i(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 i(n?["left","right"]:["top","bottom"])}function Pn(n,t,e,i){let s=[],o,a,r,l,c,d;for(o=0,a=n.length,c=0;o<a;++o){r=n[o],l=r.box,l.update(r.width||t.w,r.height||t.h,Ou(r.horizontal,t));let{same:h,other:u}=Iu(t,e,r,i);c|=h&&s.length,d=d||u,l.fullSize||s.push(r)}return c&&Pn(s,t,e,i)||d}function Ai(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Zr(n,t,e,i){let s=e.padding,{x:o,y:a}=t;for(let r of n){let l=r.box,c=i[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;Xe(c.start)&&(a=c.start),l.fullSize?Ai(l,s.left,a,e.outerWidth-s.right-s.left,u):Ai(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;Xe(c.start)&&(o=c.start),l.fullSize?Ai(l,o,s.top,u,e.outerHeight-s.bottom-s.top):Ai(l,o,t.top+c.placed,u,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=a}function Nu(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Oi]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",tl(s)){let o=ho(n,"width");o!==void 0&&(n.width=o)}if(tl(i))if(n.style.height==="")n.height=n.width/(t||2);else{let o=ho(n,"height");o!==void 0&&(n.height=o)}return n}function Bu(n,t,e){n&&n.addEventListener(t,e,ql)}function zu(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,ql)}function Fu(n,t){let e=Ru[n.type]||n.type,{x:i,y:s}=pe(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function zi(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function $u(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||zi(r.addedNodes,i),a=a&&!zi(r.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Hu(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||zi(r.removedNodes,i),a=a&&!zi(r.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Gl(){let n=window.devicePixelRatio;n!==el&&(el=n,zn.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function Vu(n,t){zn.size||window.addEventListener("resize",Gl),zn.set(n,t)}function ju(n){zn.delete(n),zn.size||window.removeEventListener("resize",Gl)}function Wu(n,t,e){let i=n.canvas,s=i&&Mi(i);if(!s)return;let o=Qs((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),Vu(n,o),a}function Co(n,t,e){e&&e.disconnect(),t==="resize"&&ju(n)}function Uu(n,t,e){let i=n.canvas,s=Qs(o=>{n.ctx!==null&&e(Fu(o,n))},n);return Bu(i,t,s),s}function Xl(n){return!Ei()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?Bi:Fi}function Yu(n,t){let e=n.options.ticks,i=qu(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Xu(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return Ku(t,c,o,a/s),c;let d=Gu(o,t,s);if(a>0){let h,u,f=a>1?Math.round((l-r)/(a-1)):null;for(Ti(t,c,d,B(f)?0:r-f,r),h=0,u=a-1;h<u;h++)Ti(t,c,d,o[h],o[h+1]);return Ti(t,c,d,l,B(f)?t.length:l+f),c}return Ti(t,c,d),c}function qu(n){let t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function Gu(n,t,e){let i=Qu(n),s=t.length/e;if(!i)return Math.max(s,1);let o=mr(i);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 Xu(n){let t=[],e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Ku(n,t,e,i){let s=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===o&&(t.push(n[a]),s++,o=e[s*i])}function Ti(n,t,e,i,s){let o=P(i,0),a=Math.min(P(s,n.length),n.length),r=0,l,c,d;for(e=Math.ceil(e),s&&(l=s-i,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(n[c]),r++,d=Math.round(o+r*e))}function Qu(n){let t=n.length,e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}function sl(n,t){let e=[],i=n.length/t,s=n.length,o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function Zu(n,t,e){let i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,a=n._endPixel,r=1e-6,l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-o,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function tf(n,t){H(n,e=>{let i=e.gc,s=i.length/2,o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function Ln(n){return n.drawTicks?n.tickLength:0}function ol(n,t){if(!n.display)return 0;let e=st(n.font,t),i=ut(n.padding);return(U(n.text)?n.text.length:1)*e.lineHeight+i.height}function ef(n,t){return ie(n,{scale:t,type:"scale"})}function nf(n,t,e){return ie(n,{tick:e,index:t,type:"tick"})}function sf(n,t,e){let i=yi(n);return(e&&t!=="right"||!e&&t==="right")&&(i=Ju(i)),i}function of(n,t,e,i){let{top:s,left:o,bottom:a,right:r,chart:l}=n,{chartArea:c,scales:d}=l,h=0,u,f,m,p=a-s,g=r-o;if(n.isHorizontal()){if(f=ht(i,o,r),z(e)){let x=Object.keys(e)[0],_=e[x];m=d[x].getPixelForValue(_)+p-t}else e==="center"?m=(c.bottom+c.top)/2+p-t:m=nl(n,e,t);u=r-o}else{if(z(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=nl(n,e,t);m=ht(i,a,s),h=e==="left"?-tt:tt}return{titleX:f,titleY:m,maxWidth:u,rotation:h}}function af(n,t,e){let i=Ye(Object.create(null),[e?q.get(e):{},q.get(t),n.defaults]);q.set(t,i),n.defaultRoutes&&rf(t,n.defaultRoutes),n.descriptors&&q.describe(t,n.descriptors)}function rf(n,t){Object.keys(t).forEach(e=>{let i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");q.route(o,s,l,r)})}function lf(n){return"id"in n&&"defaults"in n}function cf(n){let t={},e=[],i=Object.keys(It.plugins.items);for(let o=0;o<i.length;o++)e.push(It.getPlugin(i[o]));let s=n.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 df(n,t){return!t&&n===!1?null:n===!0?{}:n}function hf(n,{plugins:t,localIds:e},i,s){let o=[],a=n.getContext();for(let r of t){let l=r.id,c=df(i[l],s);c!==null&&o.push({plugin:r,options:uf(n.config,{plugin:r,local:e[l]},c,a)})}return o}function uf(n,{plugin:t,local:e},i,s){let o=n.pluginScopeKeys(t),a=n.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Io(n,t){let e=q.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function ff(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function pf(n,t){return n===t?"_index_":"_value_"}function al(n){if(n==="x"||n==="y"||n==="r")return n}function mf(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Po(n,...t){if(al(n))return n;for(let e of t){let i=e.axis||mf(e.position)||n.length>1&&al(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function rl(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function gf(n,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return rl(n,"x",e[0])||rl(n,"y",e[0])}return{}}function bf(n,t){let e=de[n.type]||{scales:{}},i=t.scales||{},s=Io(n.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!z(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=Po(a,r,gf(a,n),q.scales[r.type]),c=pf(l,s),d=e.scales||{};o[a]=Ge(Object.create(null),[{axis:l},r,d[l],d[c]])}),n.data.datasets.forEach(a=>{let r=a.type||n.type,l=a.indexAxis||Io(r,t),d=(de[r]||{}).scales||{};Object.keys(d).forEach(h=>{let u=ff(h,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Ge(o[f],[{axis:u},i[f],d[h]])})}),Object.keys(o).forEach(a=>{let r=o[a];Ge(r,[q.scales[r.type],q.scale])}),o}function Kl(n){let t=n.options||(n.options={});t.plugins=P(t.plugins,{}),t.scales=bf(n,t)}function Ql(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function xf(n){return n=n||{},n.data=Ql(n.data),Kl(n),n}function Di(n,t){let e=ll.get(n);return e||(e=t(),ll.set(n,e),Jl.add(e)),e}function cl(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),o=i.get(s);return o||(o={resolver:ki(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}function yf(n,t){let{isScriptable:e,isIndexable:i}=oo(n);for(let s of t){let o=e(s),a=i(s),r=(a||o)&&n[s];if(o&&(te(r)||_f(r))||a&&U(r))return!0}return!1}function dl(n,t){return n==="top"||n==="bottom"||wf.indexOf(n)===-1&&t==="x"}function hl(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function ul(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),j(e&&e.onComplete,[n],t)}function Cf(n){let t=n.chart,e=t.options.animation;j(e&&e.onProgress,[n],t)}function Zl(n){return Ei()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}function kf(n,t,e){let i=Object.keys(n);for(let s of i){let o=+s;if(o>=t){let a=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=a)}}}function Ef(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function pl(){return H(Ut.instances,n=>n._plugins.invalidate())}function Mf(n,t,e){let{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/a,dt(i-e));if(n.beginPath(),n.arc(s,o,a-c/2,i+h/2,e-h/2),r>0){let u=Math.min(c/r,dt(i-e));n.arc(s,o,r+c/2,e-u/2,i+u/2,!0)}else{let u=Math.min(c/2,a*dt(i-e));if(d==="round")n.arc(s,o,u,e-F/2,i+F/2,!0);else if(d==="bevel"){let f=2*u*u,m=-f*Math.cos(e+F/2)+s,p=-f*Math.sin(e+F/2)+o,g=f*Math.cos(i+F/2)+s,x=f*Math.sin(i+F/2)+o;n.lineTo(m,p),n.lineTo(g,x)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function Sf(n,t,e){let{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=s/r;n.beginPath(),n.arc(o,a,r,i-c,e+c),l>s?(c=s/l,n.arc(o,a,l,e+c,i-c,!0)):n.arc(o,a,s,e+tt,i-tt),n.closePath(),n.clip()}function Af(n){return Ci(n,["outerStart","outerEnd","innerStart","innerEnd"])}function Tf(n,t,e,i){let s=Af(n.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let c=(e-Math.min(o,l))*i/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 nn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function $i(n,t,e,i,s,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:d}=t,h=Math.max(t.outerRadius+i+e-c,0),u=d>0?d+i+e+c:0,f=0,m=s-l;if(i){let $=d>0?d-i:0,W=h>0?h-i:0,K=($+W)/2,xt=K!==0?m*K/(K+i):m;f=(m-xt)/2}let p=Math.max(.001,m*h-e/F)/h,g=(m-p)/2,x=l+g+f,_=s-g-f,{outerStart:w,outerEnd:y,innerStart:v,innerEnd:k}=Tf(t,u,h,_-x),M=h-w,S=h-y,L=x+w/M,O=_-y/S,T=u+v,R=u+k,et=x+v/T,lt=_-k/R;if(n.beginPath(),o){let $=(L+O)/2;if(n.arc(a,r,h,L,$),n.arc(a,r,h,$,O),y>0){let rt=nn(S,O,a,r);n.arc(rt.x,rt.y,y,O,_+tt)}let W=nn(R,_,a,r);if(n.lineTo(W.x,W.y),k>0){let rt=nn(R,lt,a,r);n.arc(rt.x,rt.y,k,_+tt,lt+Math.PI)}let K=(_-k/u+(x+v/u))/2;if(n.arc(a,r,u,_-k/u,K,!0),n.arc(a,r,u,K,x+v/u,!0),v>0){let rt=nn(T,et,a,r);n.arc(rt.x,rt.y,v,et+Math.PI,x-tt)}let xt=nn(M,x,a,r);if(n.lineTo(xt.x,xt.y),w>0){let rt=nn(M,L,a,r);n.arc(rt.x,rt.y,w,x-tt,L)}}else{n.moveTo(a,r);let $=Math.cos(L)*h+a,W=Math.sin(L)*h+r;n.lineTo($,W);let K=Math.cos(O)*h+a,xt=Math.sin(O)*h+r;n.lineTo(K,xt)}n.closePath()}function Df(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){$i(n,t,e,i,l,s);for(let c=0;c<o;++c)n.fill();isNaN(r)||(l=a+(r%Y||Y))}return $i(n,t,e,i,l,s),n.fill(),l}function Lf(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:d,borderDash:h,borderDashOffset:u,borderRadius:f}=l,m=l.borderAlign==="inner";if(!c)return;n.setLineDash(h||[]),n.lineDashOffset=u,m?(n.lineWidth=c*2,n.lineJoin=d||"round"):(n.lineWidth=c,n.lineJoin=d||"bevel");let p=t.endAngle;if(o){$i(n,t,e,i,p,s);for(let g=0;g<o;++g)n.stroke();isNaN(r)||(p=a+(r%Y||Y))}m&&Sf(n,t,p),l.selfJoin&&p-a>=F&&f===0&&d!=="miter"&&Mf(n,t,p),o||($i(n,t,e,i,p,s),n.stroke())}function tc(n,t,e=t){n.lineCap=P(e.borderCapStyle,t.borderCapStyle),n.setLineDash(P(e.borderDash,t.borderDash)),n.lineDashOffset=P(e.borderDashOffset,t.borderDashOffset),n.lineJoin=P(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=P(e.borderWidth,t.borderWidth),n.strokeStyle=P(e.borderColor,t.borderColor)}function If(n,t,e){n.lineTo(e.x,e.y)}function Pf(n){return n.stepped?Mr:n.tension||n.cubicInterpolationMode==="monotone"?Sr:If}function ec(n,t,e={}){let i=n.length,{start:s=0,end:o=i-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:i,start:l,loop:t.loop,ilen:c<l&&!d?i+c-l:c-l}}function Of(n,t,e,i){let{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=ec(s,e,i),d=Pf(o),{move:h=!0,reverse:u}=i||{},f,m,p;for(f=0;f<=c;++f)m=s[(r+(u?c-f:f))%a],!m.skip&&(h?(n.moveTo(m.x,m.y),h=!1):d(n,p,m,u,o.stepped),p=m);return l&&(m=s[(r+(u?c:0))%a],d(n,p,m,u,o.stepped)),!!l}function Rf(n,t,e,i){let s=t.points,{count:o,start:a,ilen:r}=ec(s,e,i),{move:l=!0,reverse:c}=i||{},d=0,h=0,u,f,m,p,g,x,_=y=>(a+(c?r-y:y))%o,w=()=>{p!==g&&(n.lineTo(d,g),n.lineTo(d,p),n.lineTo(d,x))};for(l&&(f=s[_(0)],n.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[_(u)],f.skip)continue;let y=f.x,v=f.y,k=y|0;k===m?(v<p?p=v:v>g&&(g=v),d=(h*d+y)/++h):(w(),n.lineTo(y,v),m=k,h=0,p=g=v),x=v}w()}function Ro(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Rf:Of}function Nf(n){return n.stepped?Nr:n.tension||n.cubicInterpolationMode==="monotone"?Br:le}function Bf(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),tc(n,t.options),n.stroke(s)}function zf(n,t,e,i){let{segments:s,options:o}=t,a=Ro(t);for(let r of s)tc(n,o,r.style),n.beginPath(),a(n,t,r,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}function $f(n,t,e,i){Ff&&!t.options.segment?Bf(n,t,e,i):zf(n,t,e,i)}function ml(n,t,e,i){let s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}function nc(n,t){let{x:e,y:i,base:s,width:o,height:a}=n.getProps(["x","y","base","width","height"],t),r,l,c,d,h;return n.horizontal?(h=a/2,r=Math.min(e,s),l=Math.max(e,s),c=i-h,d=i+h):(h=o/2,r=e-h,l=e+h,c=Math.min(i,s),d=Math.max(i,s)),{left:r,top:c,right:l,bottom:d}}function xe(n,t,e,i){return n?0:at(t,e,i)}function Hf(n,t,e){let i=n.options.borderWidth,s=n.borderSkipped,o=so(i);return{t:xe(s.top,o.top,0,e),r:xe(s.right,o.right,0,t),b:xe(s.bottom,o.bottom,0,e),l:xe(s.left,o.left,0,t)}}function Vf(n,t,e){let{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=fe(s),a=Math.min(t,e),r=n.borderSkipped,l=i||z(s);return{topLeft:xe(!l||r.top||r.left,o.topLeft,0,a),topRight:xe(!l||r.top||r.right,o.topRight,0,a),bottomLeft:xe(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:xe(!l||r.bottom||r.right,o.bottomRight,0,a)}}function jf(n){let t=nc(n),e=t.right-t.left,i=t.bottom-t.top,s=Hf(n,e/2,i/2),o=Vf(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,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 ko(n,t,e,i){let s=t===null,o=e===null,r=n&&!(s&&o)&&nc(n,i);return r&&(s||Vt(t,r.left,r.right))&&(o||Vt(e,r.top,r.bottom))}function Wf(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function Uf(n,t){n.rect(t.x,t.y,t.w,t.h)}function Eo(n,t,e={}){let i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+a,radius:n.radius}}function sc(n){return No[n%No.length]}function oc(n){return gl[n%gl.length]}function Yf(n,t){return n.borderColor=sc(t),n.backgroundColor=oc(t),++t}function qf(n,t){return n.backgroundColor=n.data.map(()=>sc(t++)),t}function Gf(n,t){return n.backgroundColor=n.data.map(()=>oc(t++)),t}function Xf(n){let t=0;return(e,i)=>{let s=n.getDatasetMeta(i).controller;s instanceof Yt?t=qf(e,t):s instanceof be?t=Gf(e,t):s&&(t=Yf(e,t))}}function bl(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Kf(n){return n&&(n.borderColor||n.backgroundColor)}function Qf(){return q.borderColor!=="rgba(0,0,0,0.1)"||q.backgroundColor!=="rgba(0,0,0,0.1)"}function Jf(n,t,e,i,s){let o=s.samples||i;if(o>=e)return n.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,d=t,h,u,f,m,p;for(a[l++]=n[d],h=0;h<o-2;h++){let g=0,x=0,_,w=Math.floor((h+1)*r)+1+t,y=Math.min(Math.floor((h+2)*r)+1,e)+t,v=y-w;for(_=w;_<y;_++)g+=n[_].x,x+=n[_].y;g/=v,x/=v;let k=Math.floor(h*r)+1+t,M=Math.min(Math.floor((h+1)*r)+1,e)+t,{x:S,y:L}=n[d];for(f=m=-1,_=k;_<M;_++)m=.5*Math.abs((S-g)*(n[_].y-L)-(S-n[_].x)*(x-L)),m>f&&(f=m,u=n[_],p=_);a[l++]=u,d=p}return a[l++]=n[c],a}function Zf(n,t,e,i){let s=0,o=0,a,r,l,c,d,h,u,f,m,p,g=[],x=t+e-1,_=n[t].x,y=n[x].x-_;for(a=t;a<t+e;++a){r=n[a],l=(r.x-_)/y*i,c=r.y;let v=l|0;if(v===d)c<m?(m=c,h=a):c>p&&(p=c,u=a),s=(o*s+r.x)/++o;else{let k=a-1;if(!B(h)&&!B(u)){let M=Math.min(h,u),S=Math.max(h,u);M!==f&&M!==k&&g.push({...n[M],x:s}),S!==f&&S!==k&&g.push({...n[S],x:s})}a>0&&k!==f&&g.push(n[k]),g.push(r),d=v,o=0,m=p=c,h=u=f=a}}return g}function rc(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function xl(n){n.data.datasets.forEach(t=>{rc(t)})}function tp(n,t){let e=t.length,i=0,s,{iScale:o}=n,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=at(Ft(t,o.axis,a).lo,0,e-1)),c?s=at(Ft(t,o.axis,r).hi+1,i,e)-i:s=e-i,{start:i,count:s}}function ep(n,t,e){let i=n.segments,s=n.points,o=t.points,a=[];for(let r of i){let{start:l,end:c}=r;c=ji(l,c,s);let d=Bo(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=mo(t,d);for(let u of h){let f=Bo(e,o[u.start],o[u.end],u.loop),m=po(r,s,f);for(let p of m)a.push({source:p,target:u,start:{[e]:_l(d,f,"start",Math.max)},end:{[e]:_l(d,f,"end",Math.min)}})}}return a}function Bo(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=dt(s),o=dt(o)),{property:n,start:s,end:o}}function np(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=ji(a,r,s);let l=s[a],c=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ji(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function _l(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function cc(n,t){let e=[],i=!1;return U(n)?(i=!0,e=n):e=np(n,t),e.length?new Pt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function yl(n){return n&&n.fill!==!1}function ip(n,t,e){let s=n[t].fill,o=[t],a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!Z(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function sp(n,t,e){let i=lp(n);if(z(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Z(s)&&Math.floor(s)===s?op(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function op(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function ap(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:z(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function rp(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:z(n)?i=n.value:i=t.getBaseValue(),i}function lp(n){let t=n.options,e=t.fill,i=P(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function cp(n){let{scale:t,index:e,line:i}=n,s=[],o=i.segments,a=i.points,r=dp(t,e);r.push(cc({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){let c=o[l];for(let d=c.start;d<=c.end;d++)hp(s,a[d],r)}return new Pt({points:s,options:{}})}function dp(n,t){let e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){let o=i[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function hp(n,t,e){let i=[];for(let s=0;s<e.length;s++){let o=e[s],{first:a,last:r,point:l}=up(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(n.push(l),!r)break}}n.push(...i)}function up(n,t,e){let i=n.interpolate(t,e);if(!i)return{};let s=i[e],o=n.segments,a=n.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(Vt(s,h,u)){r=s===h,l=s===u;break}}return{first:r,last:l,point:i}}function fp(n){let{chart:t,fill:e,line:i}=n;if(Z(e))return pp(t,e);if(e==="stack")return cp(n);if(e==="shape")return!0;let s=mp(n);return s instanceof Hi?s:cc(s,i)}function pp(n,t){let e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function mp(n){return(n.scale||{}).getPointPositionForValue?bp(n):gp(n)}function gp(n){let{scale:t={},fill:e}=n,i=ap(e,t);if(Z(i)){let s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function bp(n){let{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,a=rp(e,t,o),r=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,o);return new Hi({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 Mo(n,t,e){let i=fp(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||{},m=s.getDatasetMeta(o),p=go(s,m);i&&a.points.length&&(Mn(n,e),xp(n,{line:a,target:i,above:u,below:f,area:e,scale:r,axis:l,clip:p}),Sn(n))}function xp(n,t){let{line:e,target:i,above:s,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;n.save();let d=o;o!==s&&(c==="x"?(vl(n,i,a.top),So(n,{line:e,target:i,color:s,scale:r,property:c,clip:l}),n.restore(),n.save(),vl(n,i,a.bottom)):c==="y"&&(wl(n,i,a.left),So(n,{line:e,target:i,color:o,scale:r,property:c,clip:l}),n.restore(),n.save(),wl(n,i,a.right),d=s)),So(n,{line:e,target:i,color:d,scale:r,property:c,clip:l}),n.restore()}function vl(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:c}=r,d=s[l],h=s[ji(l,c,s)];o?(n.moveTo(d.x,d.y),o=!1):(n.lineTo(d.x,e),n.lineTo(d.x,d.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(h.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function wl(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:c}=r,d=s[l],h=s[ji(l,c,s)];o?(n.moveTo(d.x,d.y),o=!1):(n.lineTo(e,d.y),n.lineTo(d.x,d.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(e,h.y)}n.lineTo(e,t.first().y),n.closePath(),n.clip()}function So(n,t){let{line:e,target:i,property:s,color:o,scale:a,clip:r}=t,l=ep(e,i,s);for(let{source:c,target:d,start:h,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,m=i!==!0;n.save(),n.fillStyle=f,_p(n,a,r,m&&Bo(s,h,u)),n.beginPath();let p=!!e.pathSegment(n,c),g;if(m){p?n.closePath():Cl(n,i,u,s);let x=!!i.pathSegment(n,d,{move:p,reverse:!0});g=p&&x,g||Cl(n,i,h,s)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function _p(n,t,e,i){let s=t.chart.chartArea,{property:o,start:a,end:r}=i||{};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),n.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)),n.rect(l,c,d-l,h-c),n.clip()}}function Cl(n,t,e,i){let s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}function vp(n,t,e,i,s){let o=wp(i,n,t,e),a=Cp(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function wp(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(s).width}function Cp(n,t,e){let i=n;return typeof t.text!="string"&&(i=hc(t,e)),i}function hc(n,t){let e=n.text?n.text.length:0;return t*e}function kp(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}function Ep(n,t){let e=new Fn({ctx:n.ctx,options:t,chart:n});ft.configure(n,e,t),ft.addBox(n,e),n.titleBlock=e}function jt(n,t){return t&&(U(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function se(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
1
+ "use strict";var Blex=(()=>{var Kc=Object.create;var fn=Object.defineProperty;var Qc=Object.getOwnPropertyDescriptor;var Jc=Object.getOwnPropertyNames;var Zc=Object.getPrototypeOf,td=Object.prototype.hasOwnProperty;var ed=(n,t,e)=>t in n?fn(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var nd=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Mt=(n,t)=>()=>(n&&(t=n(n=0)),t);var Jt=(n,t)=>{for(var e in t)fn(n,e,{get:t[e],enumerable:!0})},ra=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jc(t))!td.call(n,s)&&s!==e&&fn(n,s,{get:()=>t[s],enumerable:!(i=Qc(t,s))||i.enumerable});return n};var id=(n,t,e)=>(e=n!=null?Kc(Zc(n)):{},ra(t||!n||!n.__esModule?fn(e,"default",{value:n,enumerable:!0}):e,n)),sd=n=>ra(fn({},"__esModule",{value:!0}),n);var E=(n,t,e)=>ed(n,typeof t!="symbol"?t+"":t,e);var I,G=Mt(()=>{"use strict";I=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:i}of this.trackedListeners)t.removeEventListener(e,i);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,i){t.addEventListener(e,i),this.trackedListeners.push({target:t,type:e,listener:i})}setTimeout(t,e){let i=window.setTimeout(t,e);return this.trackedTimers.push(i),i}setInterval(t,e){let i=window.setInterval(t,e);return this.trackedTimers.push(i),i}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 Ua={};Jt(Ua,{MermaidRenderer:()=>ai,createMermaidRenderer:()=>Rd});function Rd(){return new ai}var ai,Ya=Mt(()=>{"use strict";G();ai=class extends I{constructor(){super(...arguments);this.showSource=!1;this._renderPromise=Promise.resolve()}render(e,i){this.container=i,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 i=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 m=document.createElement("div");m.className="blex-mermaid__title",m.textContent=o,a.appendChild(m)}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 m=r.innerHTML,p=new Blob([m],{type:"image/svg+xml"}),g=URL.createObjectURL(p),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 m=r.innerHTML,p=new Blob([m],{type:"image/svg+xml"}),g=URL.createObjectURL(p),x=new Image;x.onload=()=>{let _=document.createElement("canvas");_.width=x.naturalWidth||x.width||800,_.height=x.naturalHeight||x.height||600;let w=_.getContext("2d");w&&(w.drawImage(x,0,0),_.toBlob(y=>{if(y){let v=URL.createObjectURL(y),k=document.createElement("a");k.href=v,k.download=`${e.id}.png`,k.click(),URL.revokeObjectURL(v)}},"image/png")),URL.revokeObjectURL(g)},x.src=g}),d.appendChild(f),a.appendChild(d),i.appendChild(a);try{let m=await import("mermaid"),p=m.default??m;p.initialize({startOnLoad:!1,theme:"default",flowchart:{htmlLabels:!0,wrappingWidth:600},themeVariables:{fontFamily:'system-ui, -apple-system, "Segoe UI", sans-serif',fontSize:"14px"}});let{svg:g}=await p.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"),i.setAttribute("data-blex-ready","true")}}});function wn(n){return n+.5|0}function yn(n){return ae(wn(n*2.55),0,255)}function re(n){return ae(wn(n*255),0,255)}function Zt(n){return ae(wn(n/2.55)/100,0,1)}function qa(n){return ae(wn(n*100),0,100)}function Fd(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Tt[n[1]]*17,g:255&Tt[n[2]]*17,b:255&Tt[n[3]]*17,a:t===5?Tt[n[4]]*17:255}:(t===7||t===9)&&(e={r:Tt[n[1]]<<4|Tt[n[2]],g:Tt[n[3]]<<4|Tt[n[4]],b:Tt[n[5]]<<4|Tt[n[6]],a:t===9?Tt[n[7]]<<4|Tt[n[8]]:255})),e}function Hd(n){var t=zd(n)?Nd:Bd;return n?"#"+t(n.r)+t(n.g)+t(n.b)+$d(n.a,t):void 0}function Qa(n,t,e){let i=t*Math.min(e,1-e),s=(o,a=(o+n/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function Wd(n,t,e){let i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function jd(n,t,e){let i=Qa(n,1,.5),s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Ud(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function Ns(n){let e=n.r/255,i=n.g/255,s=n.b/255,o=Math.max(e,i,s),a=Math.min(e,i,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=Ud(e,i,s,d,o),l=l*60+.5),[l|0,c||0,r]}function Bs(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(re)}function zs(n,t,e){return Bs(Qa,n,t,e)}function Yd(n,t,e){return Bs(jd,n,t,e)}function qd(n,t,e){return Bs(Wd,n,t,e)}function Ja(n){return(n%360+360)%360}function Gd(n){let t=Vd.exec(n),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?yn(+t[5]):re(+t[5]));let s=Ja(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Yd(s,o,a):t[1]==="hsv"?i=qd(s,o,a):i=zs(s,o,a),{r:i[0],g:i[1],b:i[2],a:e}}function Xd(n,t){var e=Ns(n);e[0]=Ja(e[0]+t),e=zs(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Kd(n){if(!n)return;let t=Ns(n),e=t[0],i=qa(t[1]),s=qa(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Zt(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}function Qd(){let n={},t=Object.keys(Xa),e=Object.keys(Ga),i,s,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],s=0;s<e.length;s++)o=e[s],r=r.replace(o,Ga[o]);o=parseInt(Xa[a],16),n[r]=[o>>16&255,o>>8&255,o&255]}return n}function Jd(n){li||(li=Qd(),li.transparent=[0,0,0,0]);let t=li[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function th(n){let t=Zd.exec(n),e=255,i,s,o;if(t){if(t[7]!==i){let a=+t[7];e=t[8]?yn(a):ae(a*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?yn(i):ae(i,0,255)),s=255&(t[4]?yn(s):ae(s,0,255)),o=255&(t[6]?yn(o):ae(o,0,255)),{r:i,g:s,b:o,a:e}}}function eh(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Zt(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}function nh(n,t,e){let i=je(Zt(n.r)),s=je(Zt(n.g)),o=je(Zt(n.b));return{r:re(Os(i+e*(je(Zt(t.r))-i))),g:re(Os(s+e*(je(Zt(t.g))-s))),b:re(Os(o+e*(je(Zt(t.b))-o))),a:n.a+e*(t.a-n.a)}}function ci(n,t,e){if(n){let i=Ns(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=zs(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Za(n,t){return n&&Object.assign(t||{},n)}function Ka(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=re(n[3]))):(t=Za(n,{r:0,g:0,b:0,a:1}),t.a=re(t.a)),t}function ih(n){return n.charAt(0)==="r"?th(n):Gd(n)}var ae,Tt,Rs,Nd,Bd,ri,zd,$d,Vd,Ga,Xa,li,Zd,Os,je,vn,tr=Mt(()=>{"use strict";ae=(n,t,e)=>Math.max(Math.min(n,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},Rs=[..."0123456789ABCDEF"],Nd=n=>Rs[n&15],Bd=n=>Rs[(n&240)>>4]+Rs[n&15],ri=n=>(n&240)>>4===(n&15),zd=n=>ri(n.r)&&ri(n.g)&&ri(n.b)&&ri(n.a);$d=(n,t)=>n<255?t(n):"";Vd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;Ga={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"},Xa={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"};Zd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;Os=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,je=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);vn=class n{constructor(t){if(t instanceof n)return t;let e=typeof t,i;e==="object"?i=Ka(t):e==="string"&&(i=Fd(t)||Jd(t)||ih(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Za(this._rgb);return t&&(t.a=Zt(t.a)),t}set rgb(t){this._rgb=Ka(t)}rgbString(){return this._valid?eh(this._rgb):void 0}hexString(){return this._valid?Hd(this._rgb):void 0}hslString(){return this._valid?Kd(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,s=t.rgb,o,a=e===o?.5:e,r=2*a-1,l=i.a-s.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=nh(this._rgb,t._rgb,e)),this}clone(){return new n(this.rgb)}alpha(t){return this._rgb.a=re(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=wn(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 ci(this._rgb,2,t),this}darken(t){return ci(this._rgb,2,-t),this}saturate(t){return ci(this._rgb,1,t),this}desaturate(t){return ci(this._rgb,1,-t),this}rotate(t){return Xd(this._rgb,t),this}}});function Ht(){}function B(n){return n==null}function U(n){if(Array.isArray&&Array.isArray(n))return!0;let t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function z(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function Z(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function yt(n,t){return Z(n)?n:t}function P(n,t){return typeof n>"u"?t:n}function W(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function H(n,t,e,i){let s,o,a;if(U(n))if(o=n.length,i)for(s=o-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;s<o;s++)t.call(e,n[s],s);else if(z(n))for(a=Object.keys(n),o=a.length,s=0;s<o;s++)t.call(e,n[a[s]],a[s])}function En(n,t){let e,i,s,o;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],o=t[e],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function fi(n){if(U(n))return n.map(fi);if(z(n)){let t=Object.create(null),e=Object.keys(n),i=e.length,s=0;for(;s<i;++s)t[e[s]]=fi(n[e[s]]);return t}return n}function fr(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function sh(n,t,e,i){if(!fr(n))return;let s=t[n],o=e[n];z(s)&&z(o)?Ye(s,o,i):t[n]=fi(o)}function Ye(n,t,e){let i=U(t)?t:[t],s=i.length;if(!z(n))return n;e=e||{};let o=e.merger||sh,a;for(let r=0;r<s;++r){if(a=i[r],!z(a))continue;let l=Object.keys(a);for(let c=0,d=l.length;c<d;++c)o(l[c],n,a,e)}return n}function Ge(n,t){return Ye(n,t,{merger:oh})}function oh(n,t,e){if(!fr(n))return;let i=t[n],s=e[n];z(i)&&z(s)?Ge(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=fi(s))}function ah(n){let t=n.split("."),e=[],i="";for(let s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function rh(n){let t=ah(n);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function ne(n,t){return(er[t]||(er[t]=rh(t)))(n)}function bi(n){return n.charAt(0).toUpperCase()+n.slice(1)}function pr(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}function Ke(n,t,e){return Math.abs(n-t)<e}function js(n){let t=Math.round(n);n=Ke(n,t,n/1e3)?t:n;let e=Math.pow(10,Math.floor(ee(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function mr(n){let t=[],e=Math.sqrt(n),i;for(i=1;i<e;i++)n%i===0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,o)=>s-o).pop(),t}function dh(n){return typeof n=="symbol"||typeof n=="object"&&n!==null&&!(Symbol.toPrimitive in n||"toString"in n||"valueOf"in n)}function Me(n){return!dh(n)&&!isNaN(parseFloat(n))&&isFinite(n)}function gr(n,t){let e=Math.round(n);return e-t<=n&&e+t>=n}function Us(n,t,e){let i,s,o;for(i=0,s=n.length;i<s;i++)o=n[i][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Dt(n){return n*(F/180)}function xi(n){return n*(180/F)}function Ys(n){if(!Z(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function qs(n,t){let e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i),o=Math.atan2(i,e);return o<-.5*F&&(o+=Y),{angle:o,distance:s}}function mi(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function hh(n,t){return(n-t+lh)%Y-F}function dt(n){return(n%Y+Y)%Y}function Qe(n,t,e,i){let s=dt(n),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||i&&o===a||r>l&&c<d}function at(n,t,e){return Math.max(t,Math.min(e,n))}function br(n){return at(n,-32768,32767)}function Vt(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function _i(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}function _r(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}function vr(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),yr.forEach(e=>{let i="_onData"+bi(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){let a=s.apply(this,o);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function Gs(n,t){let e=n._chartjs;if(!e)return;let i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(yr.forEach(o=>{delete n[o]}),delete n._chartjs)}function Xs(n){let t=new Set(n);return t.size===n.length?n:Array.from(t)}function Qs(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Ks.call(window,()=>{i=!1,n.apply(t,e)}))}}function wr(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}function Js(n,t,e){let i=t.length,s=0,o=i;if(n._sorted){let{iScale:a,vScale:r,_parsed:l}=n,c=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null,d=a.axis,{min:h,max:u,minDefined:f,maxDefined:m}=a.getUserBounds();if(f){if(s=Math.min(Ft(l,d,h).lo,e?i:Ft(t,d,a.getPixelForValue(h)).lo),c){let p=l.slice(0,s+1).reverse().findIndex(g=>!B(g[r.axis]));s-=Math.max(0,p)}s=at(s,0,i-1)}if(m){let p=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(p-1).findIndex(x=>!B(x[r.axis]));p+=Math.max(0,g)}o=at(p,s,i)-s}else o=i-s}return{start:s,count:o}}function Zs(n){let{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}function to(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function eo(n){return to(n)?n:new vn(n)}function Fs(n){return to(n)?n:new vn(n).saturate(.5).darken(.1).hexString()}function ph(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:fh},numbers:{type:"number",properties:uh}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function mh(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function gh(n,t){t=t||{};let e=n+JSON.stringify(t),i=or.get(e);return i||(i=new Intl.NumberFormat(n,t),or.set(e,i)),i}function Je(n,t,e){return gh(t,e).format(n)}function bh(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}function xh(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ze.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function Cn(n,t){if(!t)return n;let e=t.split(".");for(let i=0,s=e.length;i<s;++i){let o=e[i];n=n[o]||(n[o]=Object.create(null))}return n}function $s(n,t,e){return typeof t=="string"?Ye(Cn(n,t),e):Ye(Cn(n,""),t)}function _h(n){return!n||B(n.size)||B(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function kn(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function Er(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.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=kn(n,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=kn(n,s,o,a,u));n.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 he(n,t,e){let i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function no(n,t){!t&&!n||(t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore())}function wi(n,t,e,i){io(n,t,e,i,null)}function io(n,t,e,i,s){let o,a,r,l,c,d,h,u,f=t.pointStyle,m=t.rotation,p=t.radius,g=(m||0)*ch;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(g),n.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),n.restore();return}if(!(isNaN(p)||p<=0)){switch(n.beginPath(),f){default:s?n.ellipse(e,i,s/2,p,0,0,Y):n.arc(e,i,p,0,Y),n.closePath();break;case"triangle":d=s?s/2:p,n.moveTo(e+Math.sin(g)*d,i-Math.cos(g)*p),g+=nr,n.lineTo(e+Math.sin(g)*d,i-Math.cos(g)*p),g+=nr,n.lineTo(e+Math.sin(g)*d,i-Math.cos(g)*p),n.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(g+ke)*l,h=Math.cos(g+ke)*(s?s/2-c:l),r=Math.sin(g+ke)*l,u=Math.sin(g+ke)*(s?s/2-c:l),n.arc(e-h,i-r,c,g-F,g-tt),n.arc(e+u,i-a,c,g-tt,g),n.arc(e+h,i+r,c,g,g+tt),n.arc(e-u,i+a,c,g+tt,g+F),n.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,n.rect(e-d,i-l,2*d,2*l);break}g+=ke;case"rectRot":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+u,i-a),n.lineTo(e+h,i+r),n.lineTo(e-u,i+a),n.closePath();break;case"crossRot":g+=ke;case"cross":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a);break;case"star":h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a),g+=ke,h=Math.cos(g)*(s?s/2:p),a=Math.cos(g)*p,r=Math.sin(g)*p,u=Math.sin(g)*(s?s/2:p),n.moveTo(e-h,i-r),n.lineTo(e+h,i+r),n.moveTo(e+u,i-a),n.lineTo(e-u,i+a);break;case"line":a=s?s/2:Math.cos(g)*p,r=Math.sin(g)*p,n.moveTo(e-a,i-r),n.lineTo(e+a,i+r);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(g)*(s?s/2:p),i+Math.sin(g)*p);break;case!1:n.closePath();break}n.fill(),t.borderWidth>0&&n.stroke()}}function $t(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function Sn(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function Mn(n){n.restore()}function Sr(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){let o=(t.x+e.x)/2;n.lineTo(o,t.y),n.lineTo(o,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function Mr(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function yh(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),B(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function vh(n,t,e,i,s){if(s.strikethrough||s.underline){let o=n.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,d),n.lineTo(r,d),n.stroke()}}function wh(n,t){let e=n.fillStyle;n.fillStyle=t.color,n.fillRect(t.left,t.top,t.width,t.height),n.fillStyle=e}function ue(n,t,e,i,s,o={}){let a=U(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(n.save(),n.font=s.string,yh(n,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&wh(n,o.backdrop),r&&(o.strokeColor&&(n.strokeStyle=o.strokeColor),B(o.strokeWidth)||(n.lineWidth=o.strokeWidth),n.strokeText(c,e,i,o.maxWidth)),n.fillText(c,e,i,o.maxWidth),vh(n,e,i,c,o),i+=Number(s.lineHeight);n.restore()}function tn(n,t){let{x:e,y:i,w:s,h:o,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,1.5*F,F,!0),n.lineTo(e,i+o-a.bottomLeft),n.arc(e+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,F,tt,!0),n.lineTo(e+s-a.bottomRight,i+o),n.arc(e+s-a.bottomRight,i+o-a.bottomRight,a.bottomRight,tt,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-tt,!0),n.lineTo(e+a.topLeft,i)}function Eh(n,t){let e=(""+n).match(Ch);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}function Ci(n,t){let e={},i=z(t),s=i?Object.keys(t):t,o=z(n)?i?a=>P(n[a],n[t[a]]):a=>n[a]:()=>n;for(let a of s)e[a]=Sh(o(a));return e}function so(n){return Ci(n,{top:"y",right:"x",bottom:"y",left:"x"})}function fe(n){return Ci(n,["topLeft","topRight","bottomLeft","bottomRight"])}function ut(n){let t=so(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function st(n,t){n=n||{},t=t||q.font;let e=P(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=P(n.style,t.style);i&&!(""+i).match(kh)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let s={family:P(n.family,t.family),lineHeight:Eh(P(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:P(n.weight,t.weight),string:""};return s.string=_h(s),s}function en(n,t,e,i){let s=!0,o,a,r;for(o=0,a=n.length;o<a;++o)if(r=n[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 i&&!s&&(i.cacheable=!1),r}function Ar(n,t,e){let{min:i,max:s}=n,o=Vs(t,(s-i)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(s,o)}}function ie(n,t){return Object.assign(Object.create(n),t)}function ki(n,t=[""],e,i,s=()=>n[0]){let o=e||n;typeof i>"u"&&(i=Lr("_fallback",n));let a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:r=>ki([r,...n],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete n[0][l],!0},get(r,l){return Tr(r,l,()=>Oh(l,t,n,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(r,l){return rr(r).includes(l)},ownKeys(r){return rr(r)},set(r,l,c){let d=r._storage||(r._storage=s());return r[l]=d[l]=c,delete r._keys,!0}})}function Se(n,t,e,i){let s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:oo(n,i),setContext:o=>Se(n,o,e,i),override:o=>Se(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete n[a],!0},get(o,a,r){return Tr(o,a,()=>Ah(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(n,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,a)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,a){return Reflect.has(n,a)},ownKeys(){return Reflect.ownKeys(n)},set(o,a,r){return n[a]=r,delete o[a],!0}})}function oo(n,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:te(e)?e:()=>e,isIndexable:te(i)?i:()=>i}}function Tr(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t)||t==="constructor")return n[t];let i=e();return n[t]=i,i}function Ah(n,t,e){let{_proxy:i,_context:s,_subProxy:o,_descriptors:a}=n,r=i[t];return te(r)&&a.isScriptable(t)&&(r=Th(t,r,n,e)),U(r)&&r.length&&(r=Dh(t,r,n,a.isIndexable)),ao(t,r)&&(r=Se(r,s,o&&o[t],a)),r}function Th(n,t,e,i){let{_proxy:s,_context:o,_subProxy:a,_stack:r}=e;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);r.add(n);let l=t(o,a||i);return r.delete(n),ao(n,l)&&(l=ro(s._scopes,s,n,l)),l}function Dh(n,t,e,i){let{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(z(t[0])){let l=t,c=s._scopes.filter(d=>d!==l);t=[];for(let d of l){let h=ro(c,s,n,d);t.push(Se(h,o,a&&a[n],r))}}return t}function Dr(n,t,e){return te(n)?n(t,e):n}function Ih(n,t,e,i,s){for(let o of t){let a=Lh(e,o);if(a){n.add(a);let r=Dr(a._fallback,e,s);if(typeof r<"u"&&r!==e&&r!==i)return r}else if(a===!1&&typeof i<"u"&&e!==i)return null}return!1}function ro(n,t,e,i){let s=t._rootScopes,o=Dr(t._fallback,e,i),a=[...n,...s],r=new Set;r.add(i);let l=ar(r,a,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=ar(r,a,o,l,i),l===null)?!1:ki(Array.from(r),[""],s,o,()=>Ph(t,e,i))}function ar(n,t,e,i,s){for(;e;)e=Ih(n,t,e,i,s);return e}function Ph(n,t,e){let i=n._getTarget();t in i||(i[t]={});let s=i[t];return U(s)&&z(e)?e:s||{}}function Oh(n,t,e,i){let s;for(let o of t)if(s=Lr(Mh(o,n),e),typeof s<"u")return ao(n,s)?ro(e,i,n,s):s}function Lr(n,t){for(let e of t){if(!e)continue;let i=e[n];if(typeof i<"u")return i}}function rr(n){let t=n._keys;return t||(t=n._keys=Rh(n._scopes)),t}function Rh(n){let t=new Set;for(let e of n)for(let i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function lo(n,t,e,i){let{iScale:s}=n,{key:o="r"}=this._parsing,a=new Array(i),r,l,c,d;for(r=0,l=i;r<l;++r)c=r+e,d=t[c],a[r]={r:s.parse(ne(d,o),c)};return a}function Bh(n,t,e,i){let s=n.skip?t:n,o=t,a=e.skip?t:e,r=mi(o,s),l=mi(a,o),c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let h=i*c,u=i*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 zh(n,t,e){let i=n.length,s,o,a,r,l,c=qe(n,0);for(let d=0;d<i-1;++d)if(l=c,c=qe(n,d+1),!(!l||!c)){if(Ke(t[d],0,Nh)){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 Fh(n,t,e="x"){let i=Ir(e),s=n.length,o,a,r,l=qe(n,0);for(let c=0;c<s;++c){if(a=r,r=l,l=qe(n,c+1),!r)continue;let d=r[e],h=r[i];a&&(o=(d-a[e])/3,r[`cp1${e}`]=d-o,r[`cp1${i}`]=h-o*t[c]),l&&(o=(l[e]-d)/3,r[`cp2${e}`]=d+o,r[`cp2${i}`]=h+o*t[c])}}function $h(n,t="x"){let e=Ir(t),i=n.length,s=Array(i).fill(0),o=Array(i),a,r,l,c=qe(n,0);for(a=0;a<i;++a)if(r=l,l=c,c=qe(n,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?Lt(s[a-1])!==Lt(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}zh(n,s,o),Fh(n,o,t)}function hi(n,t,e){return Math.max(Math.min(n,e),t)}function Hh(n,t){let e,i,s,o,a,r=$t(n[0],t);for(e=0,i=n.length;e<i;++e)a=o,o=r,r=e<i-1&&$t(n[e+1],t),o&&(s=n[e],a&&(s.cp1x=hi(s.cp1x,t.left,t.right),s.cp1y=hi(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=hi(s.cp2x,t.left,t.right),s.cp2y=hi(s.cp2y,t.top,t.bottom)))}function Pr(n,t,e,i,s){let o,a,r,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")$h(n,s);else{let c=i?n[n.length-1]:n[0];for(o=0,a=n.length;o<a;++o)r=n[o],l=Bh(c,r,n[Math.min(o+1,a-(i?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&&Hh(n,e)}function Ei(){return typeof window<"u"&&typeof document<"u"}function Si(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function gi(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}function Vh(n,t){return Mi(n).getPropertyValue(t)}function Ee(n,t,e){let i={};e=e?"-"+e:"";for(let s=0;s<4;s++){let o=Wh[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function Uh(n,t){let e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i,a=!1,r,l;if(jh(s,o,n.target))r=s,l=o;else{let c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function pe(n,t){if("native"in n)return n;let{canvas:e,currentDevicePixelRatio:i}=t,s=Mi(e),o=s.boxSizing==="border-box",a=Ee(s,"padding"),r=Ee(s,"border","width"),{x:l,y:c,box:d}=Uh(n,e),h=a.left+(d&&r.left),u=a.top+(d&&r.top),{width:f,height:m}=t;return o&&(f-=a.width+r.width,m-=a.height+r.height),{x:Math.round((l-h)/f*e.width/i),y:Math.round((c-u)/m*e.height/i)}}function Yh(n,t,e){let i,s;if(t===void 0||e===void 0){let o=n&&Si(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{let a=o.getBoundingClientRect(),r=Mi(o),l=Ee(r,"border","width"),c=Ee(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=gi(r.maxWidth,o,"clientWidth"),s=gi(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||pi,maxHeight:s||pi}}function Or(n,t,e,i){let s=Mi(n),o=Ee(s,"margin"),a=gi(s.maxWidth,n,"clientWidth")||pi,r=gi(s.maxHeight,n,"clientHeight")||pi,l=Yh(n,t,e),{width:c,height:d}=l;if(s.boxSizing==="content-box"){let u=Ee(s,"border","width"),f=Ee(s,"padding");c-=f.width+u.width,d-=f.height+u.height}return c=Math.max(0,c-o.width),d=Math.max(0,i?c/i:d-o.height),c=ce(Math.min(c,a,l.maxWidth)),d=ce(Math.min(d,r,l.maxHeight)),c&&!d&&(d=ce(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=ce(Math.floor(d*i))),{width:c,height:d}}function co(n,t,e){let i=t||1,s=ce(n.height*i),o=ce(n.width*i);n.height=ce(n.height),n.width=ce(n.width);let a=n.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${n.height}px`,a.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||a.height!==s||a.width!==o?(n.currentDevicePixelRatio=i,a.height=s,a.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}function ho(n,t){let e=Vh(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function le(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Nr(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function Br(n,t,e,i){let s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},a=le(n,s,e),r=le(s,o,e),l=le(o,t,e),c=le(a,r,e),d=le(r,l,e);return le(c,d,e)}function Ae(n,t,e){return n?qh(t,e):Gh()}function uo(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function fo(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function zr(n){return n==="angle"?{between:Qe,compare:hh,normalize:dt}:{between:Vt,compare:(t,e)=>t-e,normalize:t=>t}}function lr({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function Xh(n,t,e){let{property:i,start:s,end:o}=e,{between:a,normalize:r}=zr(i),l=t.length,{start:c,end:d,loop:h}=n,u,f;if(h){for(c+=l,d+=l,u=0,f=l;u<f&&a(r(t[c%l][i]),s,o);++u)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:n.style}}function po(n,t,e){if(!e)return[n];let{property:i,start:s,end:o}=e,a=t.length,{compare:r,between:l,normalize:c}=zr(i),{start:d,end:h,loop:u,style:f}=Xh(n,t,e),m=[],p=!1,g=null,x,_,w,y=()=>l(s,w,x)&&r(s,w)!==0,v=()=>r(o,x)===0||l(o,w,x),k=()=>p||y(),S=()=>!p||v();for(let M=d,L=d;M<=h;++M)_=t[M%a],!_.skip&&(x=c(_[i]),x!==w&&(p=l(x,s,o),g===null&&k()&&(g=r(x,s)===0?M:L),g!==null&&S()&&(m.push(lr({start:g,end:M,loop:u,count:a,style:f})),g=null),L=M,w=x));return g!==null&&m.push(lr({start:g,end:h,loop:u,count:a,style:f})),m}function mo(n,t){let e=[],i=n.segments;for(let s=0;s<i.length;s++){let o=po(i[s],n.points,t);o.length&&e.push(...o)}return e}function Kh(n,t,e,i){let s=0,o=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(o+=s);o>s&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Qh(n,t,e,i){let s=n.length,o=[],a=t,r=n[t],l;for(l=t+1;l<=e;++l){let c=n[l%s];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),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:i}),o}function Fr(n,t){let e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];let o=!!n._loop,{start:a,end:r}=Kh(e,s,o,i);if(i===!0)return cr(n,[{start:a,end:r,loop:o}],e,t);let l=r<a?r+s:r,c=!!n._fullLoop&&a===0&&r===s-1;return cr(n,Qh(e,a,l,c),e,t)}function cr(n,t,e,i){return!i||!i.setContext||!e?t:Jh(n,t,e,i)}function Jh(n,t,e,i){let s=n._chart.getContext(),o=dr(n.options),{_datasetIndex:a,options:{spanGaps:r}}=n,l=e.length,c=[],d=o,h=t[0].start,u=h;function f(m,p,g,x){let _=r?-1:1;if(m!==p){for(m+=l;e[m%l].skip;)m-=_;for(;e[p%l].skip;)p+=_;m%l!==p%l&&(c.push({start:m%l,end:p%l,loop:g,style:x}),d=x,h=p%l)}}for(let m of t){h=r?h:m.start;let p=e[h%l],g;for(u=h+1;u<=m.end;u++){let x=e[u%l];g=dr(i.setContext(ie(s,{type:"segment",p0:p,p1:x,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Zh(g,d)&&f(h,u-1,m.loop,d),p=x,d=g}h<u-1&&f(h,u-1,m.loop,d)}return c}function dr(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function Zh(n,t){if(!t)return!1;let e=[],i=function(s,o){return to(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(n,i)!==JSON.stringify(t,i)}function ui(n,t,e){return n.options.clip?n[e]:t[e]}function tu(n,t){let{xScale:e,yScale:i}=n;return e&&i?{left:ui(e,t,"left"),right:ui(e,t,"right"),top:ui(i,t,"top"),bottom:ui(i,t,"bottom")}:t}function go(n,t){let e=t._clip;if(e.disabled)return!1;let i=tu(t,n.chartArea);return{left:e.left===!1?0:i.left-(e.left===!0?0:e.left),right:e.right===!1?n.width:i.right+(e.right===!0?0:e.right),top:e.top===!1?0:i.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?n.height:i.bottom+(e.bottom===!0?0:e.bottom)}}var hr,ur,Vs,er,Xe,te,Ws,F,Y,lh,pi,ch,tt,ke,nr,ee,Lt,Ft,xr,yr,Ks,yi,ht,Cr,di,ir,sr,Ue,uh,fh,or,kr,Ze,de,vi,Hs,q,Ch,kh,Sh,Mh,ao,Lh,Nh,qe,Ir,Mi,Wh,jh,ce,Rr,qh,Gh,$r=Mt(()=>{"use strict";tr();hr=(()=>{let n=0;return()=>n++})();ur=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Vs=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;er={"":n=>n,x:n=>n.x,y:n=>n.y};Xe=n=>typeof n<"u",te=n=>typeof n=="function",Ws=(n,t)=>{if(n.size!==t.size)return!1;for(let e of n)if(!t.has(e))return!1;return!0};F=Math.PI,Y=2*F,lh=Y+F,pi=Number.POSITIVE_INFINITY,ch=F/180,tt=F/2,ke=F/4,nr=F*2/3,ee=Math.log10,Lt=Math.sign;Ft=(n,t,e,i)=>_i(n,e,i?s=>{let o=n[s][t];return o<e||o===e&&n[s+1][t]===e}:s=>n[s][t]<e),xr=(n,t,e)=>_i(n,e,i=>n[i][t]>=e);yr=["push","pop","shift","splice","unshift"];Ks=(function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame})();yi=n=>n==="start"?"left":n==="end"?"right":"center",ht=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Cr=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;di=n=>n===0||n===1,ir=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*Y/e)),sr=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*Y/e)+1,Ue={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*tt)+1,easeOutSine:n=>Math.sin(n*tt),easeInOutSine:n=>-.5*(Math.cos(F*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>di(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>di(n)?n:ir(n,.075,.3),easeOutElastic:n=>di(n)?n:sr(n,.075,.3),easeInOutElastic(n){return di(n)?n:n<.5?.5*ir(n*2,.1125,.45):.5+.5*sr(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-Ue.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?Ue.easeInBounce(n*2)*.5:Ue.easeOutBounce(n*2-1)*.5+.5};uh=["x","y","borderWidth","radius","tension"],fh=["color","borderColor","backgroundColor"];or=new Map;kr={values(n){return U(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";let i=this.chart.options.locale,s,o=n;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=bh(n,e)}let a=ee(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),Je(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";let i=e[t].significand||n/Math.pow(10,Math.floor(ee(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?kr.numeric.call(this,n,t,e):""}};Ze={formatters:kr};de=Object.create(null),vi=Object.create(null);Hs=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=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Fs(s.backgroundColor),this.hoverBorderColor=(i,s)=>Fs(s.borderColor),this.hoverColor=(i,s)=>Fs(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 $s(this,t,e)}get(t){return Cn(this,t)}describe(t,e){return $s(vi,t,e)}override(t,e){return $s(de,t,e)}route(t,e,i,s){let o=Cn(this,t),a=Cn(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[r],c=a[s];return z(l)?Object.assign({},c,l):P(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}},q=new Hs({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ph,mh,xh]);Ch=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,kh=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;Sh=n=>+n||0;Mh=(n,t)=>n?n+bi(t):t,ao=(n,t)=>z(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);Lh=(n,t)=>n===!0?t:typeof n=="string"?ne(t,n):void 0;Nh=Number.EPSILON||1e-14,qe=(n,t)=>t<n.length&&!n[t].skip&&n[t],Ir=n=>n==="x"?"y":"x";Mi=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);Wh=["top","right","bottom","left"];jh=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);ce=n=>Math.round(n*10)/10;Rr=(function(){let n=!1;try{let t={get passive(){return n=!0,!1}};Ei()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n})();qh=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},Gh=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}}});var yc={};Jt(yc,{Animation:()=>Ni,Animations:()=>Nn,ArcElement:()=>me,BarController:()=>Le,BarElement:()=>Be,BasePlatform:()=>Bn,BasicPlatform:()=>Bi,BubbleController:()=>Ie,CategoryScale:()=>an,Chart:()=>Ut,Colors:()=>ac,DatasetController:()=>wt,Decimation:()=>lc,DomPlatform:()=>Fi,DoughnutController:()=>Yt,Element:()=>kt,Filler:()=>dc,Interaction:()=>jl,Legend:()=>uc,LineController:()=>Pe,LineElement:()=>Pt,LinearScale:()=>rn,LogarithmicScale:()=>ln,PieController:()=>sn,PointElement:()=>Ne,PolarAreaController:()=>be,RadarController:()=>Oe,RadialLinearScale:()=>ge,Scale:()=>ye,ScatterController:()=>Re,SubTitle:()=>pc,Ticks:()=>Ze,TimeScale:()=>_e,TimeSeriesScale:()=>cn,Title:()=>fc,Tooltip:()=>gc,_adapters:()=>Wl,_detectPlatform:()=>Xl,animator:()=>jt,controllers:()=>Vl,defaults:()=>q,elements:()=>ic,layouts:()=>ft,plugins:()=>bc,registerables:()=>em,registry:()=>It,scales:()=>_c});function nu(n,t){let e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let o=n[i[s]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function iu(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function Vr(n,t){let e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function su(n,t,e){if(e===!1)return!1;let i=Vr(n,e),s=Vr(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function ou(n){let t,e,i,s;return z(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function $l(n,t){let e=[],i=n._getSortedDatasetMetas(t),s,o;for(s=0,o=i.length;s<o;++s)e.push(i[s].index);return e}function Wr(n,t,e,i={}){let s=n.keys,o=i.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,i.all)continue;break}c=n.values[l],Z(c)&&(o||t===0||Lt(t)===Lt(c))&&(t+=c)}return!d&&!i.all?0:t}function au(n,t){let{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(n),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]:n[d]};return r}function bo(n,t){let e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function ru(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function lu(n){let{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function cu(n,t,e){let i=n[t]||(n[t]={});return i[e]||(i[e]={})}function jr(n,t,e,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let o=n[s.index];if(e&&o>0||!e&&o<0)return s.index}return null}function Ur(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,d=ru(o,a,i),h=t.length,u;for(let f=0;f<h;++f){let m=t[f],{[l]:p,[c]:g}=m,x=m._stacks||(m._stacks={});u=x[c]=cu(s,d,p),u[r]=g,u._top=jr(u,a,!0,i.type),u._bottom=jr(u,a,!1,i.type);let _=u._visualValues||(u._visualValues={});_[r]=g}}function xo(n,t){let e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function du(n,t){return ie(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function hu(n,t,e){return ie(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function An(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}function fu(n,t){if(!n._cache.$bar){let e=n.getMatchingVisibleMetas(t),i=[];for(let s=0,o=e.length;s<o;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Xs(i.sort((s,o)=>s-o))}return n._cache.$bar}function pu(n){let t=n.iScale,e=fu(t,n.type),i=t._length,s,o,a,r,l=()=>{a===32767||a===-32768||(Xe(r)&&(i=Math.min(i,Math.abs(a-r)||i)),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 i}function mu(n,t,e,i){let s=e.barThickness,o,a;return B(s)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[n]-o/2}}function gu(n,t,e,i){let s=t.pixels,o=s[n],a=n>0?s[n-1]:null,r=n<s.length-1?s[n+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/i,ratio:e.barPercentage,start:c}}function bu(n,t,e,i){let s=e.parse(n[0],i),o=e.parse(n[1],i),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 Hl(n,t,e,i){return U(n)?bu(n,t,e,i):t[e.axis]=e.parse(n,i),t}function qr(n,t,e,i){let s=n.iScale,o=n.vScale,a=s.getLabels(),r=s===o,l=[],c,d,h,u;for(c=e,d=e+i;c<d;++c)u=t[c],h={},h[s.axis]=r||s.parse(a[c],c),l.push(Hl(u,h,o,c));return l}function yo(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function xu(n,t,e){return n!==0?Lt(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function _u(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:e,end:i,reverse:t,top:s,bottom:o}}function yu(n,t,e,i){let s=t.borderSkipped,o={};if(!s){n.borderSkipped=o;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:r,reverse:l,top:c,bottom:d}=_u(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=d:(o[Gr(d,a,r,l)]=!0,s=c)),o[Gr(s,a,r,l)]=!0,n.borderSkipped=o}function Gr(n,t,e,i){return i?(n=vu(n,t,e),n=Xr(n,e,t)):n=Xr(n,t,e),n}function vu(n,t,e){return n===t?e:n===e?t:n}function Xr(n,t,e){return n==="start"?t:n==="end"?e:n}function wu(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}function Cu(n,t,e){let i=1,s=1,o=0,a=0;if(t<Y){let r=n,l=r+t,c=Math.cos(r),d=Math.sin(r),h=Math.cos(l),u=Math.sin(l),f=(w,y,v)=>Qe(w,r,l,!0)?1:Math.max(y,y*e,v,v*e),m=(w,y,v)=>Qe(w,r,l,!0)?-1:Math.min(y,y*e,v,v*e),p=f(0,c,h),g=f(tt,d,u),x=m(F,c,h),_=m(F+tt,d,u);i=(p-x)/2,s=(g-_)/2,o=-(p+x)/2,a=-(g+_)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}function Te(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function ku(n,t,e,i){let{controller:s,data:o,_sorted:a}=n,r=s._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let c=r._reversePixels?xr:Ft;if(i){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}=n,f=u.slice(0,d.lo+1).reverse().findIndex(p=>!B(p[h.axis]));d.lo-=Math.max(0,f);let m=u.slice(d.hi).findIndex(p=>!B(p[h.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function Hn(n,t,e,i,s){let o=n.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}=ku(o[r],t,a,s);for(let f=h;f<=u;++f){let m=d[f];m.skip||i(m,c,f)}}}function Eu(n){let t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){let o=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function vo(n,t,e,i,s){let o=[];return!s&&!n.isPointInArea(t)||Hn(n,e,t,function(r,l,c){!s&&!$t(r,n.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Su(n,t,e,i){let s=[];function o(a,r,l){let{startAngle:c,endAngle:d}=a.getProps(["startAngle","endAngle"],i),{angle:h}=qs(a,{x:t.x,y:t.y});Qe(h,c,d)&&s.push({element:a,datasetIndex:r,index:l})}return Hn(n,e,t,o),s}function Mu(n,t,e,i,s,o){let a=[],r=Eu(e),l=Number.POSITIVE_INFINITY;function c(d,h,u){let f=d.inRange(t.x,t.y,s);if(i&&!f)return;let m=d.getCenterPoint(s);if(!(!!o||n.isPointInArea(m))&&!f)return;let g=r(t,m);g<l?(a=[{element:d,datasetIndex:h,index:u}],l=g):g===l&&a.push({element:d,datasetIndex:h,index:u})}return Hn(n,e,t,c),a}function wo(n,t,e,i,s,o){return!o&&!n.isPointInArea(t)?[]:e==="r"&&!i?Su(n,t,e,s):Mu(n,t,e,i,s,o)}function Kr(n,t,e,i,s){let o=[],a=e==="x"?"inXRange":"inYRange",r=!1;return Hn(n,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))}),i&&!r?[]:o}function Tn(n,t){return n.filter(e=>e.pos===t)}function Qr(n,t){return n.filter(e=>Ul.indexOf(e.pos)===-1&&e.box.axis===t)}function Dn(n,t){return n.sort((e,i)=>{let s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Au(n){let t=[],e,i,s,o,a,r;for(e=0,i=(n||[]).length;e<i;++e)s=n[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 Tu(n){let t={};for(let e of n){let{stack:i,pos:s,stackWeight:o}=e;if(!i||!Ul.includes(s))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Du(n,t){let e=Tu(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,o,a,r;for(o=0,a=n.length;o<a;++o){r=n[o];let{fullSize:l}=r.box,c=e[r.stack],d=c&&r.stackWeight/c.weight;r.horizontal?(r.width=d?d*i:l&&t.availableWidth,r.height=s):(r.width=i,r.height=d?d*s:l&&t.availableHeight)}return e}function Lu(n){let t=Au(n),e=Dn(t.filter(c=>c.box.fullSize),!0),i=Dn(Tn(t,"left"),!0),s=Dn(Tn(t,"right")),o=Dn(Tn(t,"top"),!0),a=Dn(Tn(t,"bottom")),r=Qr(t,"x"),l=Qr(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Tn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Jr(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Yl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function Iu(n,t,e,i){let{pos:s,box:o}=e,a=n.maxPadding;if(!z(s)){e.size&&(n[s]-=e.size);let h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&Yl(a,o.getPadding());let r=Math.max(0,t.outerWidth-Jr(a,n,"left","right")),l=Math.max(0,t.outerHeight-Jr(a,n,"top","bottom")),c=r!==n.w,d=l!==n.h;return n.w=r,n.h=l,e.horizontal?{same:c,other:d}:{same:d,other:c}}function Pu(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function Ou(n,t){let e=t.maxPadding;function i(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 i(n?["left","right"]:["top","bottom"])}function Pn(n,t,e,i){let s=[],o,a,r,l,c,d;for(o=0,a=n.length,c=0;o<a;++o){r=n[o],l=r.box,l.update(r.width||t.w,r.height||t.h,Ou(r.horizontal,t));let{same:h,other:u}=Iu(t,e,r,i);c|=h&&s.length,d=d||u,l.fullSize||s.push(r)}return c&&Pn(s,t,e,i)||d}function Ai(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Zr(n,t,e,i){let s=e.padding,{x:o,y:a}=t;for(let r of n){let l=r.box,c=i[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;Xe(c.start)&&(a=c.start),l.fullSize?Ai(l,s.left,a,e.outerWidth-s.right-s.left,u):Ai(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;Xe(c.start)&&(o=c.start),l.fullSize?Ai(l,o,s.top,u,e.outerHeight-s.bottom-s.top):Ai(l,o,t.top+c.placed,u,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=a}function Nu(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Oi]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",tl(s)){let o=ho(n,"width");o!==void 0&&(n.width=o)}if(tl(i))if(n.style.height==="")n.height=n.width/(t||2);else{let o=ho(n,"height");o!==void 0&&(n.height=o)}return n}function Bu(n,t,e){n&&n.addEventListener(t,e,ql)}function zu(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,ql)}function Fu(n,t){let e=Ru[n.type]||n.type,{x:i,y:s}=pe(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function zi(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function $u(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||zi(r.addedNodes,i),a=a&&!zi(r.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Hu(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||zi(r.removedNodes,i),a=a&&!zi(r.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function Gl(){let n=window.devicePixelRatio;n!==el&&(el=n,zn.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function Vu(n,t){zn.size||window.addEventListener("resize",Gl),zn.set(n,t)}function Wu(n){zn.delete(n),zn.size||window.removeEventListener("resize",Gl)}function ju(n,t,e){let i=n.canvas,s=i&&Si(i);if(!s)return;let o=Qs((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),Vu(n,o),a}function Co(n,t,e){e&&e.disconnect(),t==="resize"&&Wu(n)}function Uu(n,t,e){let i=n.canvas,s=Qs(o=>{n.ctx!==null&&e(Fu(o,n))},n);return Bu(i,t,s),s}function Xl(n){return!Ei()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?Bi:Fi}function Yu(n,t){let e=n.options.ticks,i=qu(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Xu(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return Ku(t,c,o,a/s),c;let d=Gu(o,t,s);if(a>0){let h,u,f=a>1?Math.round((l-r)/(a-1)):null;for(Ti(t,c,d,B(f)?0:r-f,r),h=0,u=a-1;h<u;h++)Ti(t,c,d,o[h],o[h+1]);return Ti(t,c,d,l,B(f)?t.length:l+f),c}return Ti(t,c,d),c}function qu(n){let t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function Gu(n,t,e){let i=Qu(n),s=t.length/e;if(!i)return Math.max(s,1);let o=mr(i);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 Xu(n){let t=[],e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Ku(n,t,e,i){let s=0,o=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===o&&(t.push(n[a]),s++,o=e[s*i])}function Ti(n,t,e,i,s){let o=P(i,0),a=Math.min(P(s,n.length),n.length),r=0,l,c,d;for(e=Math.ceil(e),s&&(l=s-i,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(n[c]),r++,d=Math.round(o+r*e))}function Qu(n){let t=n.length,e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}function sl(n,t){let e=[],i=n.length/t,s=n.length,o=0;for(;o<s;o+=i)e.push(n[Math.floor(o)]);return e}function Zu(n,t,e){let i=n.ticks.length,s=Math.min(t,i-1),o=n._startPixel,a=n._endPixel,r=1e-6,l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-o,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function tf(n,t){H(n,e=>{let i=e.gc,s=i.length/2,o;if(s>t){for(o=0;o<s;++o)delete e.data[i[o]];i.splice(0,s)}})}function Ln(n){return n.drawTicks?n.tickLength:0}function ol(n,t){if(!n.display)return 0;let e=st(n.font,t),i=ut(n.padding);return(U(n.text)?n.text.length:1)*e.lineHeight+i.height}function ef(n,t){return ie(n,{scale:t,type:"scale"})}function nf(n,t,e){return ie(n,{tick:e,index:t,type:"tick"})}function sf(n,t,e){let i=yi(n);return(e&&t!=="right"||!e&&t==="right")&&(i=Ju(i)),i}function of(n,t,e,i){let{top:s,left:o,bottom:a,right:r,chart:l}=n,{chartArea:c,scales:d}=l,h=0,u,f,m,p=a-s,g=r-o;if(n.isHorizontal()){if(f=ht(i,o,r),z(e)){let x=Object.keys(e)[0],_=e[x];m=d[x].getPixelForValue(_)+p-t}else e==="center"?m=(c.bottom+c.top)/2+p-t:m=nl(n,e,t);u=r-o}else{if(z(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=nl(n,e,t);m=ht(i,a,s),h=e==="left"?-tt:tt}return{titleX:f,titleY:m,maxWidth:u,rotation:h}}function af(n,t,e){let i=Ye(Object.create(null),[e?q.get(e):{},q.get(t),n.defaults]);q.set(t,i),n.defaultRoutes&&rf(t,n.defaultRoutes),n.descriptors&&q.describe(t,n.descriptors)}function rf(n,t){Object.keys(t).forEach(e=>{let i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");q.route(o,s,l,r)})}function lf(n){return"id"in n&&"defaults"in n}function cf(n){let t={},e=[],i=Object.keys(It.plugins.items);for(let o=0;o<i.length;o++)e.push(It.getPlugin(i[o]));let s=n.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 df(n,t){return!t&&n===!1?null:n===!0?{}:n}function hf(n,{plugins:t,localIds:e},i,s){let o=[],a=n.getContext();for(let r of t){let l=r.id,c=df(i[l],s);c!==null&&o.push({plugin:r,options:uf(n.config,{plugin:r,local:e[l]},c,a)})}return o}function uf(n,{plugin:t,local:e},i,s){let o=n.pluginScopeKeys(t),a=n.getOptionScopes(i,o);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Io(n,t){let e=q.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function ff(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function pf(n,t){return n===t?"_index_":"_value_"}function al(n){if(n==="x"||n==="y"||n==="r")return n}function mf(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Po(n,...t){if(al(n))return n;for(let e of t){let i=e.axis||mf(e.position)||n.length>1&&al(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function rl(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function gf(n,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return rl(n,"x",e[0])||rl(n,"y",e[0])}return{}}function bf(n,t){let e=de[n.type]||{scales:{}},i=t.scales||{},s=Io(n.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!z(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=Po(a,r,gf(a,n),q.scales[r.type]),c=pf(l,s),d=e.scales||{};o[a]=Ge(Object.create(null),[{axis:l},r,d[l],d[c]])}),n.data.datasets.forEach(a=>{let r=a.type||n.type,l=a.indexAxis||Io(r,t),d=(de[r]||{}).scales||{};Object.keys(d).forEach(h=>{let u=ff(h,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),Ge(o[f],[{axis:u},i[f],d[h]])})}),Object.keys(o).forEach(a=>{let r=o[a];Ge(r,[q.scales[r.type],q.scale])}),o}function Kl(n){let t=n.options||(n.options={});t.plugins=P(t.plugins,{}),t.scales=bf(n,t)}function Ql(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function xf(n){return n=n||{},n.data=Ql(n.data),Kl(n),n}function Di(n,t){let e=ll.get(n);return e||(e=t(),ll.set(n,e),Jl.add(e)),e}function cl(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),o=i.get(s);return o||(o={resolver:ki(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}function yf(n,t){let{isScriptable:e,isIndexable:i}=oo(n);for(let s of t){let o=e(s),a=i(s),r=(a||o)&&n[s];if(o&&(te(r)||_f(r))||a&&U(r))return!0}return!1}function dl(n,t){return n==="top"||n==="bottom"||wf.indexOf(n)===-1&&t==="x"}function hl(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function ul(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),W(e&&e.onComplete,[n],t)}function Cf(n){let t=n.chart,e=t.options.animation;W(e&&e.onProgress,[n],t)}function Zl(n){return Ei()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}function kf(n,t,e){let i=Object.keys(n);for(let s of i){let o=+s;if(o>=t){let a=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=a)}}}function Ef(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function pl(){return H(Ut.instances,n=>n._plugins.invalidate())}function Sf(n,t,e){let{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/a,dt(i-e));if(n.beginPath(),n.arc(s,o,a-c/2,i+h/2,e-h/2),r>0){let u=Math.min(c/r,dt(i-e));n.arc(s,o,r+c/2,e-u/2,i+u/2,!0)}else{let u=Math.min(c/2,a*dt(i-e));if(d==="round")n.arc(s,o,u,e-F/2,i+F/2,!0);else if(d==="bevel"){let f=2*u*u,m=-f*Math.cos(e+F/2)+s,p=-f*Math.sin(e+F/2)+o,g=f*Math.cos(i+F/2)+s,x=f*Math.sin(i+F/2)+o;n.lineTo(m,p),n.lineTo(g,x)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function Mf(n,t,e){let{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t,c=s/r;n.beginPath(),n.arc(o,a,r,i-c,e+c),l>s?(c=s/l,n.arc(o,a,l,e+c,i-c,!0)):n.arc(o,a,s,e+tt,i-tt),n.closePath(),n.clip()}function Af(n){return Ci(n,["outerStart","outerEnd","innerStart","innerEnd"])}function Tf(n,t,e,i){let s=Af(n.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let c=(e-Math.min(o,l))*i/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 nn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function $i(n,t,e,i,s,o){let{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:d}=t,h=Math.max(t.outerRadius+i+e-c,0),u=d>0?d+i+e+c:0,f=0,m=s-l;if(i){let $=d>0?d-i:0,j=h>0?h-i:0,K=($+j)/2,xt=K!==0?m*K/(K+i):m;f=(m-xt)/2}let p=Math.max(.001,m*h-e/F)/h,g=(m-p)/2,x=l+g+f,_=s-g-f,{outerStart:w,outerEnd:y,innerStart:v,innerEnd:k}=Tf(t,u,h,_-x),S=h-w,M=h-y,L=x+w/S,O=_-y/M,T=u+v,R=u+k,et=x+v/T,lt=_-k/R;if(n.beginPath(),o){let $=(L+O)/2;if(n.arc(a,r,h,L,$),n.arc(a,r,h,$,O),y>0){let rt=nn(M,O,a,r);n.arc(rt.x,rt.y,y,O,_+tt)}let j=nn(R,_,a,r);if(n.lineTo(j.x,j.y),k>0){let rt=nn(R,lt,a,r);n.arc(rt.x,rt.y,k,_+tt,lt+Math.PI)}let K=(_-k/u+(x+v/u))/2;if(n.arc(a,r,u,_-k/u,K,!0),n.arc(a,r,u,K,x+v/u,!0),v>0){let rt=nn(T,et,a,r);n.arc(rt.x,rt.y,v,et+Math.PI,x-tt)}let xt=nn(S,x,a,r);if(n.lineTo(xt.x,xt.y),w>0){let rt=nn(S,L,a,r);n.arc(rt.x,rt.y,w,x-tt,L)}}else{n.moveTo(a,r);let $=Math.cos(L)*h+a,j=Math.sin(L)*h+r;n.lineTo($,j);let K=Math.cos(O)*h+a,xt=Math.sin(O)*h+r;n.lineTo(K,xt)}n.closePath()}function Df(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){$i(n,t,e,i,l,s);for(let c=0;c<o;++c)n.fill();isNaN(r)||(l=a+(r%Y||Y))}return $i(n,t,e,i,l,s),n.fill(),l}function Lf(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:d,borderDash:h,borderDashOffset:u,borderRadius:f}=l,m=l.borderAlign==="inner";if(!c)return;n.setLineDash(h||[]),n.lineDashOffset=u,m?(n.lineWidth=c*2,n.lineJoin=d||"round"):(n.lineWidth=c,n.lineJoin=d||"bevel");let p=t.endAngle;if(o){$i(n,t,e,i,p,s);for(let g=0;g<o;++g)n.stroke();isNaN(r)||(p=a+(r%Y||Y))}m&&Mf(n,t,p),l.selfJoin&&p-a>=F&&f===0&&d!=="miter"&&Sf(n,t,p),o||($i(n,t,e,i,p,s),n.stroke())}function tc(n,t,e=t){n.lineCap=P(e.borderCapStyle,t.borderCapStyle),n.setLineDash(P(e.borderDash,t.borderDash)),n.lineDashOffset=P(e.borderDashOffset,t.borderDashOffset),n.lineJoin=P(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=P(e.borderWidth,t.borderWidth),n.strokeStyle=P(e.borderColor,t.borderColor)}function If(n,t,e){n.lineTo(e.x,e.y)}function Pf(n){return n.stepped?Sr:n.tension||n.cubicInterpolationMode==="monotone"?Mr:If}function ec(n,t,e={}){let i=n.length,{start:s=0,end:o=i-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:i,start:l,loop:t.loop,ilen:c<l&&!d?i+c-l:c-l}}function Of(n,t,e,i){let{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=ec(s,e,i),d=Pf(o),{move:h=!0,reverse:u}=i||{},f,m,p;for(f=0;f<=c;++f)m=s[(r+(u?c-f:f))%a],!m.skip&&(h?(n.moveTo(m.x,m.y),h=!1):d(n,p,m,u,o.stepped),p=m);return l&&(m=s[(r+(u?c:0))%a],d(n,p,m,u,o.stepped)),!!l}function Rf(n,t,e,i){let s=t.points,{count:o,start:a,ilen:r}=ec(s,e,i),{move:l=!0,reverse:c}=i||{},d=0,h=0,u,f,m,p,g,x,_=y=>(a+(c?r-y:y))%o,w=()=>{p!==g&&(n.lineTo(d,g),n.lineTo(d,p),n.lineTo(d,x))};for(l&&(f=s[_(0)],n.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[_(u)],f.skip)continue;let y=f.x,v=f.y,k=y|0;k===m?(v<p?p=v:v>g&&(g=v),d=(h*d+y)/++h):(w(),n.lineTo(y,v),m=k,h=0,p=g=v),x=v}w()}function Ro(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Rf:Of}function Nf(n){return n.stepped?Nr:n.tension||n.cubicInterpolationMode==="monotone"?Br:le}function Bf(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),tc(n,t.options),n.stroke(s)}function zf(n,t,e,i){let{segments:s,options:o}=t,a=Ro(t);for(let r of s)tc(n,o,r.style),n.beginPath(),a(n,t,r,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}function $f(n,t,e,i){Ff&&!t.options.segment?Bf(n,t,e,i):zf(n,t,e,i)}function ml(n,t,e,i){let s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)<s.radius+s.hitRadius}function nc(n,t){let{x:e,y:i,base:s,width:o,height:a}=n.getProps(["x","y","base","width","height"],t),r,l,c,d,h;return n.horizontal?(h=a/2,r=Math.min(e,s),l=Math.max(e,s),c=i-h,d=i+h):(h=o/2,r=e-h,l=e+h,c=Math.min(i,s),d=Math.max(i,s)),{left:r,top:c,right:l,bottom:d}}function xe(n,t,e,i){return n?0:at(t,e,i)}function Hf(n,t,e){let i=n.options.borderWidth,s=n.borderSkipped,o=so(i);return{t:xe(s.top,o.top,0,e),r:xe(s.right,o.right,0,t),b:xe(s.bottom,o.bottom,0,e),l:xe(s.left,o.left,0,t)}}function Vf(n,t,e){let{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,o=fe(s),a=Math.min(t,e),r=n.borderSkipped,l=i||z(s);return{topLeft:xe(!l||r.top||r.left,o.topLeft,0,a),topRight:xe(!l||r.top||r.right,o.topRight,0,a),bottomLeft:xe(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:xe(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Wf(n){let t=nc(n),e=t.right-t.left,i=t.bottom-t.top,s=Hf(n,e/2,i/2),o=Vf(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,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 ko(n,t,e,i){let s=t===null,o=e===null,r=n&&!(s&&o)&&nc(n,i);return r&&(s||Vt(t,r.left,r.right))&&(o||Vt(e,r.top,r.bottom))}function jf(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function Uf(n,t){n.rect(t.x,t.y,t.w,t.h)}function Eo(n,t,e={}){let i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,o=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+o,h:n.h+a,radius:n.radius}}function sc(n){return No[n%No.length]}function oc(n){return gl[n%gl.length]}function Yf(n,t){return n.borderColor=sc(t),n.backgroundColor=oc(t),++t}function qf(n,t){return n.backgroundColor=n.data.map(()=>sc(t++)),t}function Gf(n,t){return n.backgroundColor=n.data.map(()=>oc(t++)),t}function Xf(n){let t=0;return(e,i)=>{let s=n.getDatasetMeta(i).controller;s instanceof Yt?t=qf(e,t):s instanceof be?t=Gf(e,t):s&&(t=Yf(e,t))}}function bl(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Kf(n){return n&&(n.borderColor||n.backgroundColor)}function Qf(){return q.borderColor!=="rgba(0,0,0,0.1)"||q.backgroundColor!=="rgba(0,0,0,0.1)"}function Jf(n,t,e,i,s){let o=s.samples||i;if(o>=e)return n.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,c=t+e-1,d=t,h,u,f,m,p;for(a[l++]=n[d],h=0;h<o-2;h++){let g=0,x=0,_,w=Math.floor((h+1)*r)+1+t,y=Math.min(Math.floor((h+2)*r)+1,e)+t,v=y-w;for(_=w;_<y;_++)g+=n[_].x,x+=n[_].y;g/=v,x/=v;let k=Math.floor(h*r)+1+t,S=Math.min(Math.floor((h+1)*r)+1,e)+t,{x:M,y:L}=n[d];for(f=m=-1,_=k;_<S;_++)m=.5*Math.abs((M-g)*(n[_].y-L)-(M-n[_].x)*(x-L)),m>f&&(f=m,u=n[_],p=_);a[l++]=u,d=p}return a[l++]=n[c],a}function Zf(n,t,e,i){let s=0,o=0,a,r,l,c,d,h,u,f,m,p,g=[],x=t+e-1,_=n[t].x,y=n[x].x-_;for(a=t;a<t+e;++a){r=n[a],l=(r.x-_)/y*i,c=r.y;let v=l|0;if(v===d)c<m?(m=c,h=a):c>p&&(p=c,u=a),s=(o*s+r.x)/++o;else{let k=a-1;if(!B(h)&&!B(u)){let S=Math.min(h,u),M=Math.max(h,u);S!==f&&S!==k&&g.push({...n[S],x:s}),M!==f&&M!==k&&g.push({...n[M],x:s})}a>0&&k!==f&&g.push(n[k]),g.push(r),d=v,o=0,m=p=c,h=u=f=a}}return g}function rc(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function xl(n){n.data.datasets.forEach(t=>{rc(t)})}function tp(n,t){let e=t.length,i=0,s,{iScale:o}=n,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=at(Ft(t,o.axis,a).lo,0,e-1)),c?s=at(Ft(t,o.axis,r).hi+1,i,e)-i:s=e-i,{start:i,count:s}}function ep(n,t,e){let i=n.segments,s=n.points,o=t.points,a=[];for(let r of i){let{start:l,end:c}=r;c=Wi(l,c,s);let d=Bo(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=mo(t,d);for(let u of h){let f=Bo(e,o[u.start],o[u.end],u.loop),m=po(r,s,f);for(let p of m)a.push({source:p,target:u,start:{[e]:_l(d,f,"start",Math.max)},end:{[e]:_l(d,f,"end",Math.min)}})}}return a}function Bo(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=dt(s),o=dt(o)),{property:n,start:s,end:o}}function np(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Wi(a,r,s);let l=s[a],c=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Wi(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function _l(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function cc(n,t){let e=[],i=!1;return U(n)?(i=!0,e=n):e=np(n,t),e.length?new Pt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function yl(n){return n&&n.fill!==!1}function ip(n,t,e){let s=n[t].fill,o=[t],a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!Z(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function sp(n,t,e){let i=lp(n);if(z(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Z(s)&&Math.floor(s)===s?op(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function op(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function ap(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:z(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function rp(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:z(n)?i=n.value:i=t.getBaseValue(),i}function lp(n){let t=n.options,e=t.fill,i=P(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function cp(n){let{scale:t,index:e,line:i}=n,s=[],o=i.segments,a=i.points,r=dp(t,e);r.push(cc({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){let c=o[l];for(let d=c.start;d<=c.end;d++)hp(s,a[d],r)}return new Pt({points:s,options:{}})}function dp(n,t){let e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){let o=i[s];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function hp(n,t,e){let i=[];for(let s=0;s<e.length;s++){let o=e[s],{first:a,last:r,point:l}=up(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(n.push(l),!r)break}}n.push(...i)}function up(n,t,e){let i=n.interpolate(t,e);if(!i)return{};let s=i[e],o=n.segments,a=n.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(Vt(s,h,u)){r=s===h,l=s===u;break}}return{first:r,last:l,point:i}}function fp(n){let{chart:t,fill:e,line:i}=n;if(Z(e))return pp(t,e);if(e==="stack")return cp(n);if(e==="shape")return!0;let s=mp(n);return s instanceof Hi?s:cc(s,i)}function pp(n,t){let e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function mp(n){return(n.scale||{}).getPointPositionForValue?bp(n):gp(n)}function gp(n){let{scale:t={},fill:e}=n,i=ap(e,t);if(Z(i)){let s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function bp(n){let{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,a=rp(e,t,o),r=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,o);return new Hi({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 So(n,t,e){let i=fp(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||{},m=s.getDatasetMeta(o),p=go(s,m);i&&a.points.length&&(Sn(n,e),xp(n,{line:a,target:i,above:u,below:f,area:e,scale:r,axis:l,clip:p}),Mn(n))}function xp(n,t){let{line:e,target:i,above:s,below:o,area:a,scale:r,clip:l}=t,c=e._loop?"angle":t.axis;n.save();let d=o;o!==s&&(c==="x"?(vl(n,i,a.top),Mo(n,{line:e,target:i,color:s,scale:r,property:c,clip:l}),n.restore(),n.save(),vl(n,i,a.bottom)):c==="y"&&(wl(n,i,a.left),Mo(n,{line:e,target:i,color:o,scale:r,property:c,clip:l}),n.restore(),n.save(),wl(n,i,a.right),d=s)),Mo(n,{line:e,target:i,color:d,scale:r,property:c,clip:l}),n.restore()}function vl(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:c}=r,d=s[l],h=s[Wi(l,c,s)];o?(n.moveTo(d.x,d.y),o=!1):(n.lineTo(d.x,e),n.lineTo(d.x,d.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(h.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function wl(n,t,e){let{segments:i,points:s}=t,o=!0,a=!1;n.beginPath();for(let r of i){let{start:l,end:c}=r,d=s[l],h=s[Wi(l,c,s)];o?(n.moveTo(d.x,d.y),o=!1):(n.lineTo(e,d.y),n.lineTo(d.x,d.y)),a=!!t.pathSegment(n,r,{move:a}),a?n.closePath():n.lineTo(e,h.y)}n.lineTo(e,t.first().y),n.closePath(),n.clip()}function Mo(n,t){let{line:e,target:i,property:s,color:o,scale:a,clip:r}=t,l=ep(e,i,s);for(let{source:c,target:d,start:h,end:u}of l){let{style:{backgroundColor:f=o}={}}=c,m=i!==!0;n.save(),n.fillStyle=f,_p(n,a,r,m&&Bo(s,h,u)),n.beginPath();let p=!!e.pathSegment(n,c),g;if(m){p?n.closePath():Cl(n,i,u,s);let x=!!i.pathSegment(n,d,{move:p,reverse:!0});g=p&&x,g||Cl(n,i,h,s)}n.closePath(),n.fill(g?"evenodd":"nonzero"),n.restore()}}function _p(n,t,e,i){let s=t.chart.chartArea,{property:o,start:a,end:r}=i||{};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),n.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)),n.rect(l,c,d-l,h-c),n.clip()}}function Cl(n,t,e,i){let s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}function vp(n,t,e,i,s){let o=wp(i,n,t,e),a=Cp(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function wp(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+i.measureText(s).width}function Cp(n,t,e){let i=n;return typeof t.text!="string"&&(i=hc(t,e)),i}function hc(n,t){let e=n.text?n.text.length:0;return t*e}function kp(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}function Ep(n,t){let e=new Fn({ctx:n.ctx,options:t,chart:n});ft.configure(n,e,t),ft.addBox(n,e),n.titleBlock=e}function Wt(n,t){return t&&(U(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function se(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
2
2
  `)>-1?n.split(`
3
- `):n}function Mp(n,t){let{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:n,label:a,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function El(n,t){let e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:a,boxHeight:r}=t,l=st(t.bodyFont),c=st(t.titleFont),d=st(t.footerFont),h=o.length,u=s.length,f=i.length,m=ut(t.padding),p=m.height,g=0,x=i.reduce((y,v)=>y+v.before.length+v.lines.length+v.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*y+(x-f)*l.lineHeight+(x-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let _=0,w=function(y){g=Math.max(g,e.measureText(y).width+_)};return e.save(),e.font=c.string,H(n.title,w),e.font=l.string,H(n.beforeBody.concat(n.afterBody),w),_=t.displayColors?a+2+t.boxPadding:0,H(i,y=>{H(y.before,w),H(y.lines,w),H(y.after,w)}),_=0,e.font=d.string,H(n.footer,w),e.restore(),g+=m.width,{width:g,height:p}}function Sp(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Ap(n,t,e,i){let{x:s,width:o}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+o+a>t.width||n==="right"&&s-o-a<0)return!0}function Tp(n,t,e,i){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=n,c="center";return i==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),Ap(c,n,t,e)&&(c="center"),c}function Ml(n,t,e){let i=e.yAlign||t.yAlign||Sp(n,e);return{xAlign:e.xAlign||t.xAlign||Tp(n,t,e,i),yAlign:i}}function Dp(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Lp(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Sl(n,t,e,i){let{caretSize:s,caretPadding:o,cornerRadius:a}=n,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=fe(a),m=Dp(t,r),p=Lp(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(d,u)+s:r==="right"&&(m+=Math.max(h,f)+s),{x:at(m,0,i.width-t.width),y:at(p,0,i.height-t.height)}}function Ii(n,t,e){let i=ut(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Al(n){return jt([],se(n))}function Ip(n,t,e){return ie(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Tl(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}function vt(n,t,e,i){let s=n[t].call(e,i);return typeof s>"u"?mc[t].call(e,i):s}function Op(n,t,e,i){let s=n.indexOf(t);if(s===-1)return Pp(n,t,e,i);let o=n.lastIndexOf(t);return s!==o?e:s}function Dl(n){let t=this.getLabels();return n>=0&&n<t.length?t[n]:n}function Np(n,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=n,f=o||1,m=d-1,{min:p,max:g}=t,x=!B(a),_=!B(r),w=!B(c),y=(g-p)/(h+1),v=Ws((g-p)/m/f)*f,k,M,S,L;if(v<1e-14&&!x&&!_)return[{value:p},{value:g}];L=Math.ceil(g/v)-Math.floor(p/v),L>m&&(v=Ws(L*v/m/f)*f),B(l)||(k=Math.pow(10,l),v=Math.ceil(v*k)/k),s==="ticks"?(M=Math.floor(p/v)*v,S=Math.ceil(g/v)*v):(M=p,S=g),x&&_&&o&&gr((r-a)/o,v/1e3)?(L=Math.round(Math.min((r-a)/v,d)),v=(r-a)/L,M=a,S=r):w?(M=x?a:M,S=_?r:S,L=c-1,v=(S-M)/L):(L=(S-M)/v,Ke(L,Math.round(L),v/1e3)?L=Math.round(L):L=Math.ceil(L));let O=Math.max(Ys(v),Ys(M));k=Math.pow(10,B(l)?O:l),M=Math.round(M*k)/k,S=Math.round(S*k)/k;let T=0;for(x&&(u&&M!==a?(e.push({value:a}),M<a&&T++,Ke(Math.round((M+T*v)*k)/k,a,Ll(a,y,n))&&T++):M<a&&T++);T<L;++T){let R=Math.round((M+T*v)*k)/k;if(_&&R>r)break;e.push({value:R})}return _&&u&&S!==r?e.length&&Ke(e[e.length-1].value,r,Ll(r,y,n))?e[e.length-1].value=r:e.push({value:r}):(!_||S===r)&&e.push({value:S}),e}function Ll(n,t,{horizontal:e,minRotation:i}){let s=Dt(i),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/o,a)}function Il(n){return n/Math.pow(10,$n(n))===1}function Pl(n,t,e){let i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Bp(n,t){let e=t-n,i=$n(e);for(;Pl(n,t,i)>10;)i++;for(;Pl(n,t,i)<10;)i--;return Math.min(i,$n(n))}function zp(n,{min:t,max:e}){t=yt(n.min,t);let i=[],s=$n(t),o=Bp(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(n.min,Math.round((l+d+h*Math.pow(10,o))*a)/a);for(;u<e;)i.push({value:u,major:Il(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(n.max,u);return i.push({value:f,major:Il(f),significand:h}),i}function zo(n){let t=n.ticks;if(t.display&&n.display){let e=ut(t.backdropPadding);return P(t.font&&t.font.size,q.font.size)+e.height}return 0}function Fp(n,t,e){return e=U(e)?e:[e],{w:Er(n,t.string,e),h:e.length*t.lineHeight}}function Ol(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function $p(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,a=n.options.pointLabels,r=a.centerPointLabels?F/o:0;for(let l=0;l<o;l++){let c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;let d=n.getPointPosition(l,n.drawingArea+s[l],r),h=st(c.font),u=Fp(n.ctx,h,n._pointLabels[l]);i[l]=u;let f=dt(n.getIndexAngle(l)+r),m=Math.round(xi(f)),p=Ol(m,d.x,u.w,0,180),g=Ol(m,d.y,u.h,90,270);Hp(e,t,f,p,g)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=Wp(n,i,s)}function Hp(n,t,e,i,s){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,n.l=Math.min(n.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Vp(n,t,e){let i=n.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=n.getPointPosition(t,i+s+a,o),c=Math.round(xi(dt(l.angle+tt))),d=qp(l.y,r.h,c),h=Up(c),u=Yp(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 jp(n,t){if(!t)return!0;let{left:e,top:i,right:s,bottom:o}=n;return!($t({x:e,y:i},t)||$t({x:e,y:o},t)||$t({x:s,y:i},t)||$t({x:s,y:o},t))}function Wp(n,t,e){let i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:zo(o)/2,additionalAngle:a?F/s:0},c;for(let d=0;d<s;d++){l.padding=e[d],l.size=t[d];let h=Vp(n,d,l);i.push(h),r==="auto"&&(h.visible=jp(h,c),h.visible&&(c=h))}return i}function Up(n){return n===0||n===180?"center":n<180?"left":"right"}function Yp(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function qp(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Gp(n,t,e){let{left:i,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!B(r)){let l=fe(t.borderRadius),c=ut(t.backdropPadding);n.fillStyle=r;let d=i-c.left,h=s-c.top,u=o-i+c.width,f=a-s+c.height;Object.values(l).some(m=>m!==0)?(n.beginPath(),tn(n,{x:d,y:h,w:u,h:f,radius:l}),n.fill()):n.fillRect(d,h,u,f)}}function Xp(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let o=n._pointLabelItems[s];if(!o.visible)continue;let a=i.setContext(n.getPointLabelContext(s));Gp(e,a,o);let r=st(a.font),{x:l,y:c,textAlign:d}=o;ue(e,n._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function xc(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,Y);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=n.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Kp(n,t,e,i,s){let o=n.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),xc(n,e,a,i),o.closePath(),o.stroke(),o.restore())}function Qp(n,t,e){return ie(n,{label:e,index:t,type:"pointLabel"})}function Rl(n,t){return n-t}function Nl(n,t){if(B(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),Z(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Se(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Bl(n,t,e,i){let s=Ct.length;for(let o=Ct.indexOf(n);o<s-1;++o){let a=Wi[Ct[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=i)return Ct[o]}return Ct[s-1]}function Jp(n,t,e,i,s){for(let o=Ct.length-1;o>=Ct.indexOf(e);o--){let a=Ct[o];if(Wi[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return Ct[e?Ct.indexOf(e):0]}function Zp(n){for(let t=Ct.indexOf(n)+1,e=Ct.length;t<e;++t)if(Wi[Ct[t]].common)return Ct[t]}function zl(n,t,e){if(!e)n[t]=!0;else if(e.length){let{lo:i,hi:s}=_i(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function tm(n,t,e,i){let s=n._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Fl(n,t,e){let i=[],s={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,i.push({value:r,major:!1});return o===0||!e?i:tm(n,i,s,e)}function Pi(n,t,e){let i=0,s=n.length-1,o,a,r,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ft(n,"pos",t)),{pos:o,time:r}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ft(n,"time",t)),{time:o,pos:r}=n[i],{time:a,pos:l}=n[s]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var Ao,Wt,Hr,eu,Ni,Nn,_o,Yr,uu,wt,Le,Ie,Yt,Pe,be,sn,Oe,Re,Vl,To,jl,Wl,Ul,ft,Bn,Bi,Oi,Ru,tl,ql,zn,el,Fi,kt,Ju,nl,il,ye,on,Do,It,Lo,ll,Jl,In,Oo,_f,vf,wf,Ri,fl,Ut,me,Ff,Pt,Ne,Be,ic,No,gl,ac,lc,Hi,dc,kl,yp,Vi,uc,Fn,fc,Li,pc,On,mc,Rn,gc,bc,Pp,Rp,an,dn,rn,$n,De,ln,ge,Wi,Ct,_e,cn,_c,em,vc=St(()=>{"use strict";$r();Ao=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Ks.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;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 i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},Wt=new Ao,Hr="transparent",eu={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=eo(n||Hr),s=i.valid&&eo(t||Hr);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},Ni=class{constructor(t,e,i,s){let o=e[i];s=en([t.to,s,o,t.from]);let a=en([t.from,o,s]);this._active=!0,this._fn=t.fn||eu[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=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=en([t.to,e,s,t.from]),this._from=en([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<i),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},Nn=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!z(t))return;let e=Object.keys(q.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!z(o))return;let a={};for(let r of e)a[r]=o[r];(U(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,s=iu(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&nu(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=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=i.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 Ni(u,t,c,d),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return Wt.add(this._chart,i),!0}};_o=n=>n==="reset"||n==="none",Yr=(n,t)=>t?n:Object.assign({},n),uu=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:$l(e,!0),values:null},wt=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=bo(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&&An(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,u,f,m)=>h==="x"?u:h==="r"?m:f,o=e.xAxisID=P(i.xAxisID,xo(t,"x")),a=e.yAxisID=P(i.yAxisID,xo(t,"y")),r=e.rAxisID=P(i.rAxisID,xo(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&&Gs(this._data,this),t._stacked&&An(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(z(e)){let s=this._cachedMeta;this._data=au(e,s)}else if(i!==e){if(i){Gs(i,this);let s=this._cachedMeta;An(s),s._parsed=[]}e&&Object.isExtensible(e)&&vr(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,i=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=bo(e.vScale,e),e.stack!==i.stack&&(s=!0,An(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(Ur(this,e._parsed),e._stacked=bo(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],d,h,u;if(this._parsing===!1)i._parsed=s,i._sorted=!0,u=s;else{U(s[t])?u=this.parseArrayData(i,s,t,e):z(s[t])?u=this.parseObjectData(i,s,t,e):u=this.parsePrimitiveData(i,s,t,e);let f=()=>h[r]===null||c&&h[r]<c[r];for(d=0;d<e;++d)i._parsed[d+t]=h=u[d],l&&(f()&&(l=!1),c=h);i._sorted=l}a&&Ur(this,u)}parsePrimitiveData(t,e,i,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,m;for(u=0,f=s;u<f;++u)m=u+i,h[u]={[r]:d||o.parse(c[m],m),[l]:a.parse(e[m],m)};return h}parseArrayData(t,e,i,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+i,h=e[d],r[l]={x:o.parse(h[0],d),y:a.parse(h[1],d)};return r}parseObjectData(t,e,i,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+i,f=e[u],c[d]={x:o.parse(ne(f,r),u),y:a.parse(ne(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:$l(s,!0),values:e._stacks[t.axis]._visualValues};return jr(r,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let o=i[e.axis],a=o===null?NaN:o,r=s&&i._stacks[e.axis];s&&r&&(s.values=r,a=jr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,r=this._getOtherScale(t),l=uu(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=lu(r),u,f;function m(){f=s[u];let p=f[r.axis];return!Z(f[t.axis])||d>p||h<p}for(u=0;u<a&&!(!m()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],Z(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=ou(P(this.options.clip,su(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop,d;for(i.dataset&&i.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 i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=hu(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=du(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,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",i){let s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Xe(i);if(r)return Yr(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(q.elements[t]),m=()=>this.getContext(i,s,e),p=c.resolveNamedOptions(u,f,m,h);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(Yr(p,l))),p}_resolveAnimations(t,e,i){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,i,e))}let c=new Nn(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||_o(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,s){_o(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!_o(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let s=i.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,i=!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),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&An(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};E(wt,"defaults",{}),E(wt,"datasetElementType",null),E(wt,"dataElementType",null);Le=class extends wt{parsePrimitiveData(t,e,i,s){return qr(t,e,i,s)}parseArrayData(t,e,i,s){return qr(t,e,i,s)}parseObjectData(t,e,i,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,m,p;for(u=i,f=i+s;u<f;++u)p=e[u],m={},m[o.axis]=o.parse(ne(p,c),u),h.push(Hl(ne(p,d),m,a,u));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let o=i._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:i,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=yo(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.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,i,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+i;f++){let m=this.getParsed(f),p=o||B(m[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,d),x=(m._stacks||{})[r.axis],_={horizontal:c,base:p.base,enableBorderRadius:!x||yo(m._custom)||a===x._top||a===x._bottom,x:c?p.head:g.center,y:c?g.center:p.head,height:c?g.size:Math.abs(p.size),width:c?Math.abs(p.size):g.size};u&&(_.options=h||this.resolveDataElementOptions(f,t[f].active?"active":s));let w=_.options||t[f].options;yu(_,w,x,a),wu(_,w,d.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=d=>{let h=d._parsed.find(f=>f[i.axis]===l),u=h&&h[d.vScale.axis];if(B(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(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[P(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));let r=t.barThickness;return{min:r||pu(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,d=yo(c),h=l[e.axis],u=0,f=i?this.applyStack(e,l,i):h,m,p;f!==h&&(u=f-h,f=h),d&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&Lt(h)!==Lt(c.barEnd)&&(u=0),u+=h);let g=!B(o)&&!d?o:u,x=e.getPixelForValue(g);if(this.chart.getDataVisibility(t)?m=e.getPixelForValue(u+f):m=x,p=m-x,Math.abs(p)<a){p=xu(p,e,r)*a,h===r&&(x-=p/2);let _=e.getPixelForDecimal(0),w=e.getPixelForDecimal(1),y=Math.min(_,w),v=Math.max(_,w);x=Math.max(Math.min(x,v),y),m=x+p,i&&!d&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(m)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){let _=Lt(p)*e.getLineWidthForValue(r)/2;x+=_,p-=_}return{size:p,base:x,head:m,center:m+p/2}}_calculateBarIndexPixels(t,e){let i=e.scale,s=this.options,o=s.skipNull,a=P(s.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let d=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?gu(t,e,s,d*c):mu(t,e,s,d*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(P(u,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=h.start+h.chunk*m+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.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,i=t.data,s=i.length,o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}};E(Le,"id","bar"),E(Le,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),E(Le,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});Ie=class extends wt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let o=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,e,i,s){let o=super.parseArrayData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=P(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,e,i,s){let o=super.parseObjectData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=P(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=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:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,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+i;u++){let f=t[u],m=!o&&this.getParsed(u),p={},g=p[d]=o?a.getPixelForDecimal(.5):a.getPixelForValue(m[d]),x=p[h]=o?r.getBasePixel():r.getPixelForValue(m[h]);p.skip=isNaN(g)||isNaN(x),c&&(p.options=l||this.resolveDataElementOptions(u,f.active?"active":s),o&&(p.options.radius=0)),this.updateElement(f,u,p,s)}}resolveDataElementOptions(t,e){let i=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+=P(i&&i._custom,o),s}};E(Ie,"id","bubble"),E(Ie,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),E(Ie,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});Yt=class extends wt{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 i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(z(i[t])){let{key:l="value"}=this._parsing;o=c=>+ne(i[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return Dt(this.options.rotation-90)}_getCircumference(){return Dt(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let s=this.chart.getDatasetMeta(i).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:i}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(ur(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:m,offsetY:p}=Cu(h,d,l),g=(i.width-a)/u,x=(i.height-a)/f,_=Math.max(Math.min(g,x)/2,0),w=Vs(this.options.radius,_),y=Math.max(w*l,0),v=(w-y)/this._getVisibleDatasetWeightTotal();this.offsetX=m*w,this.offsetY=p*w,s.total=this.calculateTotal(),this.outerRadius=w-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 i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/Y)}updateElements(t,e,i,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,m=u?0:this.outerRadius,{sharedOptions:p,includeOptions:g}=this._getSharedOptions(e,s),x=this._getRotation(),_;for(_=0;_<e;++_)x+=this._circumference(_,o);for(_=e;_<e+i;++_){let w=this._circumference(_,o),y=t[_],v={x:d+this.offsetX,y:h+this.offsetY,startAngle:x,endAngle:x+w,circumference:w,outerRadius:m,innerRadius:f};g&&(v.options=p||this.resolveDataElementOptions(_,y.active?"active":s)),x+=w,this.updateElement(y,_,v,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=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&&(i+=Math.abs(o))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Je(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.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 i=0,s=t.length;i<s;++i){let o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(P(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};E(Yt,"id","doughnut"),E(Yt,"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"}),E(Yt,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),E(Yt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,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:i,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});Pe=class extends wt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Js(e,s,a);this._drawStart=r,this._drawCount=l,Zs(e)&&(r=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,i,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:m,segment:p}=this.options,g=Se(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",_=e+i,w=t.length,y=e>0&&this.getParsed(e-1);for(let v=0;v<w;++v){let k=t[v],M=x?k:{};if(v<e||v>=_){M.skip=!0;continue}let S=this.getParsed(v),L=B(S[f]),O=M[u]=a.getPixelForValue(S[u],v),T=M[f]=o||L?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,S,l):S[f],v);M.skip=isNaN(O)||isNaN(T)||L,M.stop=v>0&&Math.abs(S[u]-y[u])>g,p&&(M.parsed=S,M.raw=c.data[v]),h&&(M.options=d||this.resolveDataElementOptions(v,k.active?"active":s)),x||this.updateElement(k,v,M,s),y=S}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};E(Pe,"id","line"),E(Pe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),E(Pe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});be=class extends wt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Je(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return lo.bind(this)(t,e,i,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((i,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,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,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*F,f=u,m,p=360/this.countVisibleElements();for(m=0;m<e;++m)f+=this._computeAngle(m,s,p);for(m=e;m<e+i;m++){let g=t[m],x=f,_=f+this._computeAngle(m,s,p),w=a.getDataVisibility(m)?c.getDistanceFromCenterForValue(this.getParsed(m).r):0;f=_,o&&(l.animateScale&&(w=0),l.animateRotate&&(x=_=u));let y={x:d,y:h,innerRadius:0,outerRadius:w,startAngle:x,endAngle:_,options:this.resolveDataElementOptions(m,g.active?"active":s)};this.updateElement(g,m,y,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Dt(this.resolveDataElementOptions(t,e).angle||i):0}};E(be,"id","polarArea"),E(be,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),E(be,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,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:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});sn=class extends Yt{};E(sn,"id","pie"),E(sn,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Oe=class extends wt{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return lo.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.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(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+i;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)}}};E(Oe,"id","radar"),E(Oe,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),E(Oe,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});Re=class extends wt{getLabelAndValue(t){let e=this._cachedMeta,i=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:i[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled,{start:o,count:a}=Js(e,i,s);if(this._drawStart=o,this._drawCount=a,Zs(e)&&(o=0,a=i.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=i;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(i,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,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,m=r.axis,{spanGaps:p,segment:g}=this.options,x=Se(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",w=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){let v=t[y],k=this.getParsed(y),M=_?v:{},S=B(k[m]),L=M[f]=a.getPixelForValue(k[f],y),O=M[m]=o||S?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,k,l):k[m],y);M.skip=isNaN(L)||isNaN(O)||S,M.stop=y>0&&Math.abs(k[f]-w[f])>x,g&&(M.parsed=k,M.raw=c.data[y]),u&&(M.options=h||this.resolveDataElementOptions(y,v.active?"active":s)),_||this.updateElement(v,y,M,s),w=k}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 i=t.dataset,s=i.options&&i.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}};E(Re,"id","scatter"),E(Re,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),E(Re,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});Vl=Object.freeze({__proto__:null,BarController:Le,BubbleController:Ie,DoughnutController:Yt,LineController:Pe,PieController:sn,PolarAreaController:be,RadarController:Oe,ScatterController:Re});To=class n{constructor(t){E(this,"options");this.options=t||{}}static override(t){Object.assign(n.prototype,t)}init(){}formats(){return Te()}parse(){return Te()}format(){return Te()}add(){return Te()}diff(){return Te()}startOf(){return Te()}endOf(){return Te()}},jl={_date:To};Wl={evaluateInteractionItems:Hn,modes:{index(n,t,e,i){let s=pe(t,n),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?vo(n,s,o,i,a):wo(n,s,o,!1,i,a),l=[];return r.length?(n.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(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?vo(n,s,o,i,a):wo(n,s,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=n.getDatasetMeta(l).data;r=[];for(let d=0;d<c.length;++d)r.push({element:c[d],datasetIndex:l,index:d})}return r},point(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return vo(n,s,o,i,a)},nearest(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return wo(n,s,o,e.intersect,i,a)},x(n,t,e,i){let s=pe(t,n);return Kr(n,s,"x",e.intersect,i)},y(n,t,e,i){let s=pe(t,n);return Kr(n,s,"y",e.intersect,i)}}},Ul=["left","top","right","bottom"];ft={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){let e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;let s=ut(n.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=Lu(n.boxes),l=r.vertical,c=r.horizontal;H(n.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let d=l.reduce((p,g)=>g.box.options&&g.box.options.display===!1?p:p+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);Yl(u,ut(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),m=Du(l.concat(c),h);Pn(r.fullSize,f,h,m),Pn(l,f,h,m),Pn(c,f,h,m)&&Pn(l,f,h,m),Pu(f),Zr(r.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,Zr(r.rightAndBottom,f,h,m),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},H(r.chartArea,p=>{let g=p.box;Object.assign(g,n.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Bn=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},Bi=class extends Bn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Oi="$chartjs",Ru={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},tl=n=>n===null||n==="";ql=Rr?{passive:!0}:!1;zn=new Map,el=0;Fi=class extends Bn{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Nu(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Oi])return!1;let i=e[Oi].initial;["height","width"].forEach(o=>{let a=i[o];B(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Oi],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:$u,detach:Hu,resize:Wu}[e]||Uu;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Co,detach:Co,resize:Co}[e]||zu)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Or(t,e,i,s)}isAttached(t){let e=t&&Mi(t);return!!(e&&e.isConnected)}};kt=class{constructor(){E(this,"x");E(this,"y");E(this,"active",!1);E(this,"options");E(this,"$animations")}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Se(this.x)&&Se(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};E(kt,"defaults",{}),E(kt,"defaultRoutes");Ju=n=>n==="left"?"right":n==="right"?"left":n,nl=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,il=(n,t)=>Math.min(t||n,n);ye=class n extends kt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=yt(t,Number.POSITIVE_INFINITY),e=yt(e,Number.NEGATIVE_INFINITY),i=yt(i,Number.POSITIVE_INFINITY),s=yt(s,Number.NEGATIVE_INFINITY),{min:yt(t,i),max:yt(e,s),minDefined:Z(t),maxDefined:Z(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:i};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||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:yt(e,yt(i,e)),max:yt(i,yt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){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(){j(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Ar(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?sl(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Yu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){j(this.options.afterUpdate,[this])}beforeSetDimensions(){j(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(){j(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),j(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){j(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=j(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){j(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){j(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=il(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||i<=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/i:f/(i-1),h+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-Ln(t.grid)-e.padding-ol(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),a=xi(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(){j(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){j(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=ol(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Ln(o)+l):(t.height=this.maxHeight,t.width=Ln(o)+l),i.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=i.padding*2,m=Dt(this.labelRotation),p=Math.cos(m),g=Math.sin(m);if(r){let x=i.mirror?0:g*h.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{let x=i.mirror?0:p*h.width+g*u.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(c,d,g,p)}}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,i,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=i*e.height):(u=i*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(){j(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,i;for(e=0,i=t.length;e<i;e++)B(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=sl(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/il(e,i)),c=0,d=0,h,u,f,m,p,g,x,_,w,y,v;for(h=0;h<e;h+=l){if(m=t[h].label,p=this._resolveTickFontOptions(h),s.font=g=p.string,x=o[g]=o[g]||{data:{},gc:[]},_=p.lineHeight,w=y=0,!B(m)&&!U(m))w=kn(s,x.data,x.gc,w,m),y=_;else if(U(m))for(u=0,f=m.length;u<f;++u)v=m[u],!B(v)&&!U(v)&&(w=kn(s,x.data,x.gc,w,v),y+=_);a.push(w),r.push(y),c=Math.max(w,c),d=Math.max(y,d)}tf(o,e);let k=a.indexOf(c),M=r.indexOf(d),S=L=>({width:a[L]||0,height:r[L]||0});return{first:S(0),last:S(e-1),widest:S(k),highest:S(M),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 br(this._alignToPixels?he(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 i=e[t];return i.$context||(i.$context=nf(this.getContext(),t,i))}return this.$context||(this.$context=ef(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=Dt(this.labelRotation),i=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*i>r*s?r/i:l/s:l*s<r*i?l/i:r/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=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=Ln(o),f=[],m=r.setContext(this.getContext()),p=m.display?m.width:0,g=p/2,x=function(W){return he(i,W,p)},_,w,y,v,k,M,S,L,O,T,R,et;if(a==="top")_=x(this.bottom),M=this.bottom-u,L=_-g,T=x(t.top)+g,et=t.bottom;else if(a==="bottom")_=x(this.top),T=t.top,et=x(t.bottom)-g,M=_+g,L=this.top+u;else if(a==="left")_=x(this.right),k=this.right-u,S=_-g,O=x(t.left)+g,R=t.right;else if(a==="right")_=x(this.left),O=t.left,R=x(t.right)-g,k=_+g,S=this.left+u;else if(e==="x"){if(a==="center")_=x((t.top+t.bottom)/2+.5);else if(z(a)){let W=Object.keys(a)[0],K=a[W];_=x(this.chart.scales[W].getPixelForValue(K))}T=t.top,et=t.bottom,M=_+g,L=M+u}else if(e==="y"){if(a==="center")_=x((t.left+t.right)/2);else if(z(a)){let W=Object.keys(a)[0],K=a[W];_=x(this.chart.scales[W].getPixelForValue(K))}k=_-g,S=k-u,O=t.left,R=t.right}let lt=P(s.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/lt));for(w=0;w<h;w+=$){let W=this.getContext(w),K=o.setContext(W),xt=r.setContext(W),rt=K.lineWidth,qt=K.color,Q=xt.dash||[],Gt=xt.dashOffset,J=K.tickWidth,Ot=K.tickColor,V=K.tickBorderDash||[],Et=K.tickBorderDashOffset;y=Zu(this,w,l),y!==void 0&&(v=he(i,y,rt),c?k=S=O=R=v:M=L=T=et=v,f.push({tx1:k,ty1:M,tx2:S,ty2:L,x1:O,y1:T,x2:R,y2:et,width:rt,color:qt,borderDash:Q,borderDashOffset:Gt,tickWidth:J,tickColor:Ot,tickBorderDash:V,tickBorderDashOffset:Et}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){let e=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=Ln(i.grid),f=u+d,m=h?-d:f,p=-Dt(this.labelRotation),g=[],x,_,w,y,v,k,M,S,L,O,T,R,et="middle";if(s==="top")k=this.bottom-m,M=this._getXAxisLabelAlignment();else if(s==="bottom")k=this.top+m,M=this._getXAxisLabelAlignment();else if(s==="left"){let $=this._getYAxisLabelAlignment(u);M=$.textAlign,v=$.x}else if(s==="right"){let $=this._getYAxisLabelAlignment(u);M=$.textAlign,v=$.x}else if(e==="x"){if(s==="center")k=(t.top+t.bottom)/2+f;else if(z(s)){let $=Object.keys(s)[0],W=s[$];k=this.chart.scales[$].getPixelForValue(W)+f}M=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(z(s)){let $=Object.keys(s)[0],W=s[$];v=this.chart.scales[$].getPixelForValue(W)}M=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){w=r[x],y=w.label;let $=o.setContext(this.getContext(x));S=this.getPixelForTick(x)+o.labelOffset,L=this._resolveTickFontOptions(x),O=L.lineHeight,T=U(y)?y.length:1;let W=T/2,K=$.color,xt=$.textStrokeColor,rt=$.textStrokeWidth,qt=M;a?(v=S,M==="inner"&&(x===_-1?qt=this.options.reverse?"left":"right":x===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||p!==0?R=-T*O+O/2:c==="center"?R=-lt.highest.height/2-W*O+O:R=-lt.highest.height+O/2:c==="near"||p!==0?R=O/2:c==="center"?R=lt.highest.height/2-W*O:R=lt.highest.height-T*O,h&&(R*=-1),p!==0&&!$.showLabelBackdrop&&(v+=O/2*Math.sin(p))):(k=S,R=(1-T)*O/2);let Q;if($.showLabelBackdrop){let Gt=ut($.backdropPadding),J=lt.heights[x],Ot=lt.widths[x],V=R-Gt.top,Et=0-Gt.left;switch(et){case"middle":V-=J/2;break;case"bottom":V-=J;break}switch(M){case"center":Et-=Ot/2;break;case"right":Et-=Ot;break;case"inner":x===_-1?Et-=Ot:x>0&&(Et-=Ot/2);break}Q={left:Et,top:V,width:Ot+Gt.width,height:J+Gt.height,color:$.backdropColor}}g.push({label:y,font:L,textOffset:R,options:{rotation:p,color:K,strokeColor:xt,strokeWidth:rt,textAlign:qt,textBaseline:et,translation:[v,k],backdrop:Q}})}return g}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Dt(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:i,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,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?s?(d=this.left+o,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,i==="near"?c="left":i==="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:i,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,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,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.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:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.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=he(t,this.left,a)-a/2,d=he(t,this.right,r)+r/2,h=u=l):(h=he(t,this.top,a)-a/2,u=he(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 i=this.ctx,s=this._computeLabelArea();s&&Mn(i,s);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,d=a.textOffset;ue(i,c,0,d,l,r)}s&&Sn(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;let o=st(i.font),a=ut(i.padding),r=i.align,l=o.lineHeight/2;e==="bottom"||e==="center"||z(e)?(l+=a.bottom,U(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=of(this,l,e,r);ue(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:u,textAlign:sf(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,i=P(t.grid&&t.grid.z,-1),s=P(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==n.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,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(),i=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[i]===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}},on=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;lf(e)&&(i=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,af(t,a,i),this.override&&q.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in q[s]&&(delete q[s][i],this.override&&delete de[i])}};Do=class{constructor(){this.controllers=new on(wt,"datasets",!0),this.elements=new on(kt,"elements"),this.plugins=new on(Object,"plugins"),this.scales=new on(ye,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):H(s,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let s=bi(t);j(i["before"+s],[],i),e[t](i),j(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},It=new Do,Lo=class{constructor(){this._init=void 0}notify(t,e,i,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,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,s){s=s||{};for(let o of t){let a=o.plugin,r=a[i],l=[e,s,o.options];if(j(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){B(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 i=t&&t.config,s=P(i.options&&i.options.plugins,{}),o=cf(i);return s===!1&&!e?[]:hf(t,o,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};ll=new Map,Jl=new Set;In=(n,t,e)=>{let i=ne(t,e);i!==void 0&&n.add(i)},Oo=class{constructor(t){this._config=xf(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ql(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Kl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Di(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Di(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Di(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return Di(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(h=>In(l,t,h))),d.forEach(h=>In(l,s,h)),d.forEach(h=>In(l,de[o]||{},h)),d.forEach(h=>In(l,q,h)),d.forEach(h=>In(l,vi,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jl.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,de[e]||{},q.datasets[e]||{},{type:e},q,vi]}resolveNamedOptions(t,e,i,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=cl(this._resolverCache,t,s),l=a;if(yf(a,e)){o.$shared=!1,i=te(i)?i():i;let c=this.createResolver(t,i,r);l=Me(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],s){let{resolver:o}=cl(this._resolverCache,t,i);return z(e)?Me(o,e,void 0,s):o}};_f=n=>z(n)&&Object.getOwnPropertyNames(n).some(t=>te(n[t]));vf="4.5.1",wf=["top","bottom","left","right","chartArea"];Ri={},fl=n=>{let t=Zl(n);return Object.values(Ri).filter(e=>e.canvas===t).pop()};Ut=class{static register(...t){It.add(...t),pl()}static unregister(...t){It.remove(...t),pl()}constructor(t,e){let i=this.config=new Oo(e),s=Zl(t),o=fl(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=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Xl(s)),this.platform.updateConfig(i);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=hr(),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 Lo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=wr(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Ri[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Wt.listen(this,"complete",ul),Wt.listen(this,"progress",Cf),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return B(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return It}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():co(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return no(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 i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,co(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),j(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};H(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Po(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),H(o,a=>{let r=a.options,l=r.id,c=Po(l,r),d=P(r.type,a.dtype);(r.position===void 0||dl(r.position,c)!==dl(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===d)h=i[l];else{let u=It.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(r,t)}),H(s,(a,r)=>{a||delete i[r]}),H(i,a=>{ft.configure(this,a,a.options),ft.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(hl("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){let o=e[i],a=this.getDatasetMeta(i),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||Io(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=It.getController(r),{datasetElementType:c,dataElementType:d}=q.datasets[r];Object.assign(l,{dataElementType:It.getElement(d),datasetElementType:c&&It.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){H(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 i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;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=i.layout.autoPadding?a:0,this._updateLayout(a),s||H(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(hl("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){H(this.scales,t=>{ft.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!js(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of e){let a=i==="_removeElements"?-o:o;kf(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!js(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ft.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],H(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,te(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Wt.has(this)?this.attached&&!Wt.running(this)&&Wt.start(this):(this.draw(),ul({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let 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,i=[],s,o;for(s=0,o=e.length;s<o;++s){let a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;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,i={meta:t,index:t.index,cancelable:!0},s=go(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&Mn(e,s),t.controller.draw(),s&&Sn(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return $t(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let o=Wl.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.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},i.push(s)),s}getContext(){return this.$context||(this.$context=ie(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Xe(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),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(),no(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ri[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,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};H(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){H(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},H(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s=i?"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||[],i=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}});!En(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){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=i?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 i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,i,a),l=pr(t),c=Ef(t,this._lastEvent,i,l);i&&(this._lastEvent=null,j(o.onHover,[t,r,this],this),l&&j(o.onClick,[t,r,this],this));let d=!En(r,s);return(d||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,d}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};E(Ut,"defaults",q),E(Ut,"instances",Ri),E(Ut,"overrides",de),E(Ut,"registry",It),E(Ut,"version",vf),E(Ut,"getChart",fl);me=class extends kt{constructor(e){super();E(this,"circumference");E(this,"endAngle");E(this,"fullCircles");E(this,"innerRadius");E(this,"outerRadius");E(this,"pixelMargin");E(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){let o=this.getProps(["x","y"],s),{angle:a,distance:r}=qs(o,{x:e,y:i}),{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,m=P(u,c-l),p=Qe(a,l,c)&&l!==c,g=m>=Y||p,x=Vt(r,d+f,h+f);return g&&x}getCenterPoint(e){let{x:i,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:i+Math.cos(h)*u,y:s+Math.sin(h)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:s}=this,o=(i.offset||0)/4,a=(i.spacing||0)/2,r=i.circular;if(this.pixelMargin=i.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(F,s||0)),d=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,Df(e,this,d,a,r),Lf(e,this,d,a,r),e.restore()}};E(me,"id","arc"),E(me,"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}),E(me,"defaultRoutes",{backgroundColor:"backgroundColor"}),E(me,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Ff=typeof Path2D=="function";Pt=class extends kt{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 i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;Pr(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fr(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,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],o=this.points,a=mo(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Nf(i),c,d;for(c=0,d=a.length;c<d;++c){let{start:h,end:u}=a[c],f=o[h],m=o[u];if(f===m){r.push(f);continue}let p=Math.abs((s-f[e])/(m[e]-f[e])),g=l(f,m,p,i.stepped);g[e]=t[e],r.push(g)}return r.length===1?r[0]:r}pathSegment(t,e,i){return Ro(this)(t,this,e,i)}path(t,e,i){let s=this.segments,o=Ro(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let r of s)a&=o(t,this,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),$f(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};E(Pt,"id","line"),E(Pt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),E(Pt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),E(Pt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});Ne=class extends kt{constructor(e){super();E(this,"parsed");E(this,"skip");E(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(i-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,i){return ml(this,e,"x",i)}inYRange(e,i){return ml(this,e,"y",i)}getCenterPoint(e){let{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);let s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){let s=this.options;this.skip||s.radius<.1||!$t(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,wi(e,s,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};E(Ne,"id","point"),E(Ne,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),E(Ne,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Be=class extends kt{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:i,backgroundColor:s}}=this,{inner:o,outer:a}=jf(this),r=Wf(a.radius)?tn:Uf;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Eo(a,e,o)),t.clip(),r(t,Eo(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Eo(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return ko(this,t,e,i)}inXRange(t,e){return ko(this,t,null,e)}inYRange(t,e){return ko(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};E(Be,"id","bar"),E(Be,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),E(Be,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});ic=Object.freeze({__proto__:null,ArcElement:me,BarElement:Be,LineElement:Pt,PointElement:Ne}),No=["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)"],gl=No.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));ac={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;let{data:{datasets:i},options:s}=n.config,{elements:o}=s,a=bl(i)||Kf(s)||o&&bl(o)||Qf();if(!e.forceOverride&&a)return;let r=Xf(n);i.forEach(r)}};lc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){xl(n);return}let i=n.width;n.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=n.getDatasetMeta(o),c=a||s.data;if(en([r,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=n.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||n.options.parsing)return;let{start:h,count:u}=tp(l,c),f=e.threshold||4*i;if(u<=f){rc(s);return}B(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let m;switch(e.algorithm){case"lttb":m=Jf(c,h,u,i,e);break;case"min-max":m=Zf(c,h,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=m})},destroy(n){xl(n)}};Hi=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){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),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}};dc={id:"filler",afterDatasetsUpdate(n,t,e){let i=(n.data.datasets||[]).length,s=[],o,a,r,l;for(a=0;a<i;++a)o=n.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Pt&&(l={visible:n.isDatasetVisible(a),index:a,fill:sp(r,a,i),chart:n,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=ip(s,a,e.propagate))},beforeDraw(n,t,e){let i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),o=n.chartArea;for(let a=s.length-1;a>=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&Mo(n.ctx,r,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){let o=i[s].$filler;yl(o)&&Mo(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!yl(i)||e.drawTime!=="beforeDatasetDraw"||Mo(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},kl=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},yp=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,Vi=class extends kt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=j(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,s=st(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=kl(i,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,i,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((m,p)=>{let g=i+e/2+o.measureText(m.text).width;(p===0||c[c.length-1]+g+2*r>a)&&(h+=d,c[c.length-(p>0?0:1)]=0,f+=d,u++),l[p]={left:0,top:f,row:u,width:g,height:s},c[c.length-1]+=g+r}),h}_fitCols(t,e,i,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,m=0,p=0;return this.legendItems.forEach((g,x)=>{let{itemWidth:_,itemHeight:w}=vp(i,e,o,g,s);x>0&&f+w+2*r>d&&(h+=u+r,c.push({width:u,height:f}),m+=u+r,p++,u=f=0),l[x]={left:m,top:f,col:p,width:_,height:w},u=Math.max(u,_),f+=w+r}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=Ae(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ht(i,this.left+s,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=ht(i,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(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=ht(i,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;Mn(t,this),this._draw(),Sn(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=q.color,l=Ae(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:m,boxHeight:p,itemHeight:g}=kl(a,h),x=function(k,M,S){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();let L=P(S.lineWidth,1);if(s.fillStyle=P(S.fillStyle,r),s.lineCap=P(S.lineCap,"butt"),s.lineDashOffset=P(S.lineDashOffset,0),s.lineJoin=P(S.lineJoin,"miter"),s.lineWidth=L,s.strokeStyle=P(S.strokeStyle,r),s.setLineDash(P(S.lineDash,[])),a.usePointStyle){let O={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:L},T=l.xPlus(k,m/2),R=M+u;io(s,O,T,R,a.pointStyleWidth&&m)}else{let O=M+Math.max((h-p)/2,0),T=l.leftForLtr(k,m),R=fe(S.borderRadius);s.beginPath(),Object.values(R).some(et=>et!==0)?tn(s,{x:T,y:O,w:m,h:p,radius:R}):s.rect(T,O,m,p),s.fill(),L!==0&&s.stroke()}s.restore()},_=function(k,M,S){ue(s,S.text,k,M+g/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},w=this.isHorizontal(),y=this._computeTitleHeight();w?f={x:ht(o,this.left+d,this.right-i[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},uo(this.ctx,t.textDirection);let v=g+d;this.legendItems.forEach((k,M)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;let S=s.measureText(k.text).width,L=l.textAlign(k.textAlign||(k.textAlign=a.textAlign)),O=m+u+S,T=f.x,R=f.y;l.setWidth(this.width),w?M>0&&T+O+d>this.right&&(R=f.y+=v,f.line++,T=f.x=ht(o,this.left+d,this.right-i[f.line])):M>0&&R+v>this.bottom&&(T=f.x=T+e[f.line].width+d,f.line++,R=f.y=ht(o,this.top+y+d,this.bottom-e[f.line].height));let et=l.x(T);if(x(et,R,k),T=Cr(L,T+m+u,w?T+O:this.right,t.rtl),_(l.x(T),R,k),w)f.x+=O+d;else if(typeof k.text!="string"){let lt=c.lineHeight;f.y+=hc(k,lt)+d}else f.y+=v}),fo(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=st(e.font),s=ut(e.padding);if(!e.display)return;let o=Ae(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.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 m=this.columnSizes.reduce((p,g)=>Math.max(p,g.height),0);d=c+ht(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}let f=ht(r,h,h+u);a.textAlign=o.textAlign(yi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,ue(a,e.text,f,d,i)}_computeTitleHeight(){let t=this.options.title,e=st(t.font),i=ut(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(Vt(t,this.left,this.right)&&Vt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Vt(t,s.left,s.left+s.width)&&Vt(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!kp(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=yp(s,i);s&&!o&&j(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&j(e.onHover,[t,i,this],this)}else i&&j(e.onClick,[t,i,this],this)}};uc={id:"legend",_element:Vi,start(n,t,e){let i=n.legend=new Vi({ctx:n.ctx,options:e,chart:n});ft.configure(n,i,e),ft.addBox(n,i)},stop(n){ft.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;ft.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=n.legend.options;return n._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:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}},Fn=class extends kt{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 i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=U(i.text)?i.text.length:1;this._padding=ut(i.padding);let o=s*st(i.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:i,bottom:s,right:o,options:a}=this,r=a.align,l=0,c,d,h;return this.isHorizontal()?(d=ht(r,i,o),h=e+t,c=o-i):(a.position==="left"?(d=i+t,h=ht(r,s,e),l=F*-.5):(d=o-t,h=ht(r,e,s),l=F*.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 i=st(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);ue(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:yi(e.align),textBaseline:"middle",translation:[a,r]})}};fc={id:"title",_element:Fn,start(n,t,e){Ep(n,e)},stop(n){let t=n.titleBlock;ft.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;ft.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Li=new WeakMap,pc={id:"subtitle",start(n,t,e){let i=new Fn({ctx:n.ctx,options:e,chart:n});ft.configure(n,i,e),ft.addBox(n,i),Li.set(n,i)},stop(n){ft.removeBox(n,Li.get(n)),Li.delete(n)},beforeUpdate(n,t,e){let i=Li.get(n);ft.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},On={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){let r=n[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=n.length;o<a;++o){let l=n[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=mi(t,c);d<s&&(s=d,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};mc={beforeTitle:Ht,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Ht,beforeBody:Ht,beforeLabel:Ht,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");let e=n.formattedValue;return B(e)||(t+=e),t},labelColor(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ht,afterBody:Ht,beforeFooter:Ht,footer:Ht,afterFooter:Ht};Rn=class extends kt{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,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new Nn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Ip(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=vt(i,"beforeTitle",this,t),o=vt(i,"title",this,t),a=vt(i,"afterTitle",this,t),r=[];return r=jt(r,se(s)),r=jt(r,se(o)),r=jt(r,se(a)),r}getBeforeBody(t,e){return Al(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,s=[];return H(t,o=>{let a={before:[],lines:[],after:[]},r=Tl(i,o);jt(a.before,se(vt(r,"beforeLabel",this,o))),jt(a.lines,vt(r,"label",this,o)),jt(a.after,se(vt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return Al(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,s=vt(i,"beforeFooter",this,t),o=vt(i,"footer",this,t),a=vt(i,"afterFooter",this,t),r=[];return r=jt(r,se(s)),r=jt(r,se(o)),r=jt(r,se(a)),r}_createItems(t){let e=this._active,i=this.chart.data,s=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(Mp(this.chart,e[l]));return t.filter&&(r=r.filter((d,h,u)=>t.filter(d,h,u,i))),t.itemSort&&(r=r.sort((d,h)=>t.itemSort(d,h,i))),H(r,d=>{let h=Tl(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 i=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=On[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=El(this,i),c=Object.assign({},r,l),d=Ml(this.chart,i,c),h=Sl(i,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&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=fe(r),{x:u,y:f}=t,{width:m,height:p}=e,g,x,_,w,y,v;return o==="center"?(y=f+p/2,s==="left"?(g=u,x=g-a,w=y+a,v=y-a):(g=u+m,x=g+a,w=y-a,v=y+a),_=g):(s==="left"?x=u+Math.max(l,d)+a:s==="right"?x=u+m-Math.max(c,h)-a:x=this.caretX,o==="top"?(w=f,y=w-a,g=x-a,_=x+a):(w=f+p,y=w+a,g=x+a,_=x-a),v=w),{x1:g,x2:x,x3:_,y1:w,y2:y,y3:v}}drawTitle(t,e,i){let s=this.title,o=s.length,a,r,l;if(o){let c=Ae(i.rtl,this.x,this.width);for(t.x=Ii(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=st(i.titleFont),r=i.titleSpacing,e.fillStyle=i.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+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,s,o){let a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,d=st(o.bodyFont),h=Ii(this,"left",o),u=s.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,m=e.y+f;if(o.usePointStyle){let p={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=s.leftForLtr(u,c)+c/2,x=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,wi(t,p,g,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,wi(t,p,g,x)}else{t.lineWidth=z(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 p=s.leftForLtr(u,c),g=s.leftForLtr(s.xPlus(u,1),c-2),x=fe(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,tn(t,{x:p,y:m,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),tn(t,{x:g,y:m+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(g,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=i,h=st(i.bodyFont),u=h.lineHeight,f=0,m=Ae(i.rtl,this.x,this.width),p=function(S){e.fillText(S,m.x(t.x+f),t.y+u/2),t.y+=u+o},g=m.textAlign(a),x,_,w,y,v,k,M;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=Ii(this,g,i),e.fillStyle=i.bodyColor,H(this.beforeBody,p),f=r&&g!=="right"?a==="center"?c/2+d:c+2+d:0,y=0,k=s.length;y<k;++y){for(x=s[y],_=this.labelTextColors[y],e.fillStyle=_,H(x.before,p),w=x.lines,r&&w.length&&(this._drawColorBox(e,t,y,m,i),u=Math.max(h.lineHeight,l)),v=0,M=w.length;v<M;++v)p(w[v]),u=h.lineHeight;H(x.after,p)}f=0,u=h.lineHeight,H(this.afterBody,p),t.y-=o}drawFooter(t,e,i){let s=this.footer,o=s.length,a,r;if(o){let l=Ae(i.rtl,this.x,this.width);for(t.x=Ii(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=st(i.footerFont),e.fillStyle=i.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+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:d}=i,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:m}=fe(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,i,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(r+c,l+d-m),e.quadraticCurveTo(r+c,l+d,r+c-m,l+d),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(r+f,l+d),e.quadraticCurveTo(r,l+d,r,l+d-f),a==="center"&&o==="left"&&this.drawCaret(t,e,i,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,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let a=On[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=El(this,t),l=Object.assign({},a,this._size),c=Ml(e,t,l),d=Sl(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()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;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=i,this.drawBackground(o,t,s,e),uo(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),fo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=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=!En(i,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!En(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,i,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,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:s,options:o}=this,a=On[o.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}};E(Rn,"positioners",On);gc={id:"tooltip",_element:Rn,positioners:On,afterInit(n,t,e){e&&(n.tooltip=new Rn({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:mc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},bc=Object.freeze({__proto__:null,Colors:ac,Decimation:lc,Filler:dc,Legend:uc,SubTitle:pc,Title:fc,Tooltip:gc}),Pp=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Rp=(n,t)=>n===null?null:at(Math.round(n),0,t);an=class extends ye{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(B(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Op(i,t,P(e,t),this._addedLabels),Rp(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=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-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Dl.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}};E(an,"id","category"),E(an,"defaults",{ticks:{callback:Dl}});dn=class extends ye{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 B(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=i?o:l;if(t){let l=Lt(s),c=Lt(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:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Np(s,o);return t.bounds==="ticks"&&Us(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,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Je(t,this.chart.options.locale,this.options.ticks.format)}},rn=class extends dn{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Z(t)?t:0,this.max=Z(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=Dt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.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}};E(rn,"id","linear"),E(rn,"defaults",{ticks:{callback:Ze.formatters.numeric}});$n=n=>Math.floor(ee(n)),De=(n,t)=>Math.pow(10,$n(n)+t);ln=class extends ye{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=dn.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return Z(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Z(t)?Math.max(0,t):null,this.max=Z(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Z(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(),i=this.min,s=this.max,o=r=>i=t?i:r,a=r=>s=e?s:r;i===s&&(i<=0?(o(1),a(10)):(o(De(i,-1)),a(De(s,1)))),i<=0&&o(De(s,-1)),s<=0&&a(De(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=zp(e,this);return t.bounds==="ticks"&&Us(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Je(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=ee(t),this._valueRange=ee(this.max)-ee(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ee(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};E(ln,"id","logarithmic"),E(ln,"defaults",{ticks:{callback:Ze.formatters.logarithmic,major:{enabled:!0}}});ge=class extends dn{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(zo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=Z(t)&&!isNaN(t)?t:0,this.max=Z(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/zo(this.options))}generateTickLabels(t){dn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let s=j(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?$p(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=Y/(this._pointLabels.length||1),i=this.options.startAngle||0;return dt(t*e+Dt(i))}getDistanceFromCenterForValue(t){if(B(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(B(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 i=e[t];return Qp(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let s=this.getIndexAngle(t)-tt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),xc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:s,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&Xp(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),m=o.setContext(u);Kp(this,f,l,a,m)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let d=i.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,i=e.ticks;if(!i.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=i.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)}ue(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};E(ge,"id","radialLinear"),E(ge,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ze.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),E(ge,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),E(ge,"descriptors",{angleLines:{_fallback:"grid"}});Wi={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}},Ct=Object.keys(Wi);_e=class extends ye{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 i=t.time||(t.time={}),s=this._adapter=new jl._date(t.adapters.date);s.init(e),Ge(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Nl(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=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=Z(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=Z(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let o=this.min,a=this.max,r=_r(s,o,a);return this._unit=e.unit||(i.autoSkip?Bl(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Jp(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Zp(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),Fl(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=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?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=at(e,0,a),i=at(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||Bl(o.minUnit,e,i,this._getLabelCapacity(e)),r=P(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Se(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(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let m=s.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u<i;u=+t.add(u,r,a),f++)zl(d,u,m);return(u===i||s.bounds==="ticks"||f===1)&&zl(d,u,m),Object.keys(d).sort(Rl).map(p=>+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.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,i,s){let o=this.options,a=o.ticks.callback;if(a)return j(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],h=c&&r[c],u=i[e],f=c&&h&&u&&u.major;return this._adapter.format(t,s||(f?h:d))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=Dt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,Fl(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,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Nl(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xs(t.sort(Rl))}};E(_e,"id","time"),E(_e,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});cn=class extends _e{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=Pi(e,this.min),this._tableRange=Pi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],o=[],a,r,l,c,d;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,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,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Pi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Pi(this._table,i*this._tableRange+this._minPos,!0)}};E(cn,"id","timeseries"),E(cn,"defaults",_e.defaults);_c=Object.freeze({__proto__:null,CategoryScale:an,LinearScale:rn,LogarithmicScale:ln,RadialLinearScale:ge,TimeScale:_e,TimeSeriesScale:cn}),em=[Vl,ic,bc,_c]});async function nm(){return Ui||(Ui=await Promise.resolve().then(()=>(vc(),yc)),Ui)}async function wc(n,t){let e=await nm(),{Chart:i,BarController:s,LineController:o,PieController:a,DoughnutController:r,CategoryScale:l,LinearScale:c,BarElement:d,LineElement:h,PointElement:u,ArcElement:f,Title:m,Legend:p,Tooltip:g}=e;i.register(s,o,a,r,l,c,d,h,u,f,m,p,g);let x=document.createElement("canvas");x.setAttribute("data-testid","blex-chart-canvas"),n.appendChild(x);let _=new i(x,{type:t.type,data:{labels:t.data.labels,datasets:t.data.datasets.map(w=>({label:w.label,data:w.values,backgroundColor:w.color,borderColor:w.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 n.setAttribute("data-blex-ready","true"),{update(w){w.data&&(_.data.labels=w.data.labels??_.data.labels,w.data.datasets&&(_.data.datasets=w.data.datasets.map(y=>({label:y.label,data:y.values,backgroundColor:y.color,borderColor:y.color})))),w.options?.title&&(_.options.plugins.title={display:!0,text:w.options.title}),_.update()},destroy(){_.destroy(),x.remove()}}}var Ui,Cc=St(()=>{"use strict";Ui=null});var kc={};Jt(kc,{ChartRenderer:()=>Yi,createChartRenderer:()=>im});function im(){return new Yi}var Yi,Ec=St(()=>{"use strict";G();Cc();Yi=class extends I{constructor(){super(...arguments);this.chartInstance=null}render(e,i){this.container=i;let s=document.createElement("div");s.className="blex-chart",s.setAttribute("data-testid",`blex-chart-${e.id}`),i.appendChild(s),wc(s,e.data).then(o=>{this.chartInstance=o,i.setAttribute("data-blex-ready","true")})}update(e){this.chartInstance&&this.chartInstance.update(e.data)}destroy(){this.chartInstance?.destroy(),this.chartInstance=null,super.destroy()}}});var Mc={};Jt(Mc,{KanbanRenderer:()=>qi,createKanbanRenderer:()=>sm});function sm(){return new qi}var qi,Sc=St(()=>{"use strict";G();qi=class extends I{constructor(){super(...arguments);this.draggedItemId=null;this.draggedFromColumn=null;this.draggedItemTitle=null;this.currentBlock=null;this.localColumns=[];this.originalColumns=[]}render(e,i){this.container=i,this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this.originalColumns=JSON.parse(JSON.stringify(e.data.columns)),this._build(e),i.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:i,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===i);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 i=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)}i.appendChild(a)}_buildColumn(e,i,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,i);o.appendChild(l)}return i&&(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 m=this.localColumns.find(g=>g.id===h),p=this.localColumns.find(g=>g.id===f);if(m&&p){let g=m.items.findIndex(x=>x.id===d);if(g!==-1){let[x]=m.items.splice(g,1);p.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}${s.data.title?` (${s.data.title})`:""}`,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 i=this.localColumns[e],s=this.originalColumns[e];if(i.id!==s.id||i.items.length!==s.items.length)return!1;for(let o=0;o<i.items.length;o++)if(i.items[o].id!==s.items[o].id)return!1}return!0}_buildItem(e,i,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=i,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 Ic={};Jt(Ic,{CalendarRenderer:()=>Gi,createCalendarRenderer:()=>om});function Tc(n){let t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0");return`${t}-${e}-${i}`}function Dc(n){let t=new Date(n);return t.setDate(t.getDate()-t.getDay()),t}function Lc(n){let t=new Date(n);if(isNaN(t.getTime()))return n;let e=t.getHours(),i=t.getMinutes(),s=e>=12?"PM":"AM",o=e%12||12;return i===0?`${o} ${s}`:`${o}:${String(i).padStart(2,"0")} ${s}`}function $o(n){let t=new Date(n);return isNaN(t.getTime())?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`}function om(){return new Gi}var Ac,Fo,Gi,Pc=St(()=>{"use strict";G();Ac=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Fo=["January","February","March","April","May","June","July","August","September","October","November","December"];Gi=class extends I{constructor(){super(...arguments);this.currentBlock=null;this.viewDate=new Date;this.currentView="month";this.activeDetailEl=null}render(e,i){this.container=i,this.currentBlock=e,this.currentView=e.data.view??"month",this.viewDate=e.data.initialDate?new Date(e.data.initialDate):new Date,this.buildCalendar(e),i.setAttribute("data-blex-ready","true")}revertInteraction(e){}dismissDetail(){this.activeDetailEl&&(this.activeDetailEl.remove(),this.activeDetailEl=null)}showDetailPanel(e,i,s){this.dismissDetail();let o=document.createElement("div");o.className="blex-calendar__detail",o.setAttribute("data-testid",`blex-calendar-detail-${e.id}`);let a=document.createElement("div");a.className="blex-calendar__detail-color",a.style.backgroundColor=e.color??"var(--blex-accent)",o.appendChild(a);let r=document.createElement("div");r.className="blex-calendar__detail-content";let l=document.createElement("div");l.className="blex-calendar__detail-title",l.textContent=e.title,r.appendChild(l);let c=document.createElement("div");c.className="blex-calendar__detail-time";let d=$o(e.start),h=Lc(e.start),u=Lc(e.end),f=e.start.slice(0,10)===e.end.slice(0,10);c.textContent=f?`${d}, ${h} \u2013 ${u}`:`${$o(e.start)} ${h} \u2013 ${$o(e.end)} ${u}`,r.appendChild(c),o.appendChild(r);let m=document.createElement("button");m.className="blex-calendar__detail-dismiss",m.setAttribute("data-testid",`blex-calendar-detail-dismiss-${s.id}`),m.textContent="Dismiss",this.addListener(m,"click",(g=>{g.stopPropagation(),this.dismissDetail()})),o.appendChild(m);let p=this.container?.querySelector(".blex-calendar");p?p.appendChild(o):this.container?.appendChild(o),this.activeDetailEl=o}update(e){this.container&&(this.activeDetailEl=null,this.currentBlock=e,e.data.view&&(this.currentView=e.data.view),this.container.innerHTML="",this.buildCalendar(e))}buildCalendar(e){let i=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),i.appendChild(s)}buildViewToggle(e){let i=document.createElement("div");i.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)})),i.appendChild(a)}return i}buildNav(e){let i=document.createElement("div");i.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)})),i.appendChild(s),i.appendChild(o),i.appendChild(a),i}getHeaderTitle(){if(this.currentView==="month")return`${Fo[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;if(this.currentView==="week"){let e=Dc(this.viewDate),i=new Date(e);return i.setDate(i.getDate()+6),`${Fo[e.getMonth()]} ${e.getDate()} \u2013 ${i.getDate()}, ${e.getFullYear()}`}else return`${Fo[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,i){let s=this.viewDate.getFullYear(),o=this.viewDate.getMonth();for(let l of Ac){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 m=this.getEventsForDate(i.data.events,h);for(let p of m)u.appendChild(this.buildEventEl(p,i));this.addListener(u,"click",(p=>{if(p.target.closest(".blex-calendar__event"))return;let g=`${h}T00:00`,x=`${h}T23:59`;this.emit({blockId:i.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,i){let s=Dc(this.viewDate);for(let o=0;o<7;o++){let a=new Date(s);a.setDate(s.getDate()+o);let r=Tc(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=`${Ac[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`,m=`${r}T${u}:59`,p=document.createElement("div");p.className="blex-calendar__slot",p.setAttribute("data-start",f),p.setAttribute("data-end",m),p.textContent=`${u}:00`,this.addListener(p,"click",(()=>{this.emit({blockId:i.id,type:"slot-click",payload:{start:f,end:m},serialized:`Selected time slot: ${f} - ${m}`,summary:`Selected slot: ${f}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),l.appendChild(p)}let d=this.getEventsForDate(i.data.events,r);for(let h of d)l.appendChild(this.buildEventEl(h,i));e.appendChild(l)}}buildDayGrid(e,i){let s=Tc(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:i.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(i.data.events,s);for(let r of a)o.appendChild(this.buildEventEl(r,i));e.appendChild(o)}buildEventEl(e,i){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.showDetailPanel(e,s,i),this.emit({blockId:i.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,i){return e.filter(s=>{let o=s.start.slice(0,10),a=s.end.slice(0,10);return i>=o&&i<=a})}}});var Oc={};Jt(Oc,{GalleryRenderer:()=>Xi,createGalleryRenderer:()=>am});function am(){return new Xi}var Xi,Rc=St(()=>{"use strict";G();Xi=class extends I{constructor(){super(...arguments);this.currentIndex=0}revertInteraction(e){}render(e,i){this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentIndex=0,this.container.innerHTML="",this._build(e))}_build(e){let i=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),i.appendChild(r)}_buildGrid(e,i,s,o){if(e.style.setProperty("--blex-gallery-columns",String(o)),s.forEach((a,r)=>{let l=this._createItem(i,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,i,s){s.forEach((l,c)=>{let d=this._createItem(i,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-${i.id}`);let r=document.createElement("button");r.className="blex-gallery__nav-btn",r.textContent="Next",r.setAttribute("data-testid",`blex-gallery-next-${i.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,i,s){let o=Math.max(0,Math.min(i.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,i,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=i.alt??"",a.loading="lazy",a.src=i.url,this.addListener(a,"click",()=>{this.emit({blockId:e.id,type:"select",payload:{imageIndex:s,url:i.url},serialized:`Selected image ${s+1}${e.data.title?` from "${e.data.title}"`:""}: ${i.caption??i.url}`,summary:`Selected image ${s+1}${i.caption?`: ${i.caption}`:""}`,icon:"\u{1F5BC}",immediate:!1,revertable:!0})}),o.appendChild(a),i.caption){let r=document.createElement("figcaption");r.className="blex-gallery__caption",r.textContent=i.caption,o.appendChild(r)}return o}}});var Bc={};Jt(Bc,{EmbedRenderer:()=>Qi,createEmbedRenderer:()=>dm});function lm(n){try{return new URL(n).origin}catch{return""}}function Ki(n){try{return new URL(n).hostname}catch{return n}}function cm(n){if(typeof n!="object"||n===null)return!1;let t=n;return t.type==="blex-interaction"&&typeof t.action=="string"&&typeof t.serialized=="string"&&typeof t.summary=="string"}function dm(){return new Qi}var Nc,rm,Qi,zc=St(()=>{"use strict";G();Nc=400,rm=["allow-scripts","allow-same-origin","allow-forms","allow-popups"];Qi=class extends I{constructor(){super(...arguments);this.messageHandler=null;this.expectedOrigin="";this.wrapper=null;this.currentBlock=null}render(e,i){this.container=i,this._buildFrozen(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this._cleanup(),this.container.innerHTML="",this._buildFrozen(e))}destroy(){this._cleanup(),super.destroy()}_cleanup(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null)}_buildTitleBar(e){let{url:i,title:s}=e.data,o=document.createElement("div");o.className="blex-embed__title-bar",o.setAttribute("data-testid",`blex-embed-title-bar-${e.id}`);let a=document.createElement("span");a.className="blex-embed__title",a.textContent=s??Ki(i),o.appendChild(a);let r=document.createElement("span");r.className="blex-embed__domain",r.textContent=Ki(i),o.appendChild(r);let l=document.createElement("a");return l.className="blex-embed__open-btn",l.href=i,l.target="_blank",l.rel="noopener noreferrer",l.textContent="\u2197",l.title="Open in new tab",l.setAttribute("data-testid",`blex-embed-open-${e.id}`),o.appendChild(l),o}_buildFrozen(e){let i=this.container,{url:s,height:o=Nc}=e.data;this.currentBlock=e,this.expectedOrigin=lm(s);let a=document.createElement("div");a.className="blex-embed blex-embed--frozen",a.setAttribute("data-testid",`blex-embed-${e.id}`),a.setAttribute("data-loading","false"),a.setAttribute("data-frozen","true"),this.wrapper=a,a.appendChild(this._buildTitleBar(e));let r=document.createElement("div");r.className="blex-embed__overlay",r.setAttribute("data-testid",`blex-embed-overlay-${e.id}`),r.style.height=`${o}px`;let l=document.createElement("button");l.className="blex-embed__play-btn",l.setAttribute("data-testid",`blex-embed-play-${e.id}`),l.title="Load embedded content";let c=document.createElement("span");c.className="blex-embed__play-icon",c.textContent="\u25B6",l.appendChild(c);let d=document.createElement("span");d.className="blex-embed__play-label",d.textContent=Ki(s),l.appendChild(d),this.addListener(l,"click",()=>{this._activate()}),r.appendChild(l),a.appendChild(r),i.appendChild(a)}_activate(){if(!this.wrapper||!this.currentBlock)return;let e=this.currentBlock,{url:i,title:s,height:o=Nc,sandbox:a=rm}=e.data;this.wrapper.classList.remove("blex-embed--frozen"),this.wrapper.classList.add("blex-embed--loading"),this.wrapper.setAttribute("data-loading","true"),this.wrapper.setAttribute("data-frozen","false");let r=this.wrapper.querySelector(".blex-embed__overlay");r&&r.remove();let l=document.createElement("iframe");l.className="blex-embed__iframe",l.setAttribute("data-testid",`blex-embed-iframe-${e.id}`),l.src=i,l.setAttribute("sandbox",a.join(" ")),l.style.height=`${o}px`,l.title=s??Ki(i),this.addListener(l,"load",()=>{this.wrapper.classList.remove("blex-embed--loading"),this.wrapper.setAttribute("data-loading","false")}),this.wrapper.appendChild(l),this.messageHandler=c=>{this.expectedOrigin&&c.origin!==this.expectedOrigin||!l.contentWindow||c.source!==l.contentWindow||cm(c.data)&&this.emit({blockId:e.id,type:c.data.action,payload:c.data.payload,serialized:c.data.serialized,summary:c.data.summary,icon:"\u{1F517}",immediate:!1,revertable:!1})},window.addEventListener("message",this.messageHandler)}}});var Fc={};Jt(Fc,{BranchRenderer:()=>Ji,createBranchRenderer:()=>hm});function hm(){return new Ji}var Ji,$c=St(()=>{"use strict";G();Ji=class extends I{constructor(){super(...arguments);this.nodeMap=new Map;this.edgeMap=new Map;this.path=[];this.visited=new Set;this.currentNodeId=""}render(e,i){this.container=i,this.init(e),this.build()}update(e){this.container&&(this.container.innerHTML="",this.path=[],this.visited.clear(),this.init(e),this.build())}init(e){this.data=e.data,this.blockId=e.id,this.nodeMap.clear(),this.edgeMap.clear();for(let i of this.data.nodes)this.nodeMap.set(i.id,i);for(let i of this.data.edges){let s=this.edgeMap.get(i.from)??[];s.push(i),this.edgeMap.set(i.from,s)}this.path.length===0&&(this.currentNodeId=this.data.start,this.path=[{nodeId:this.data.start}],this.visited.clear(),this.visited.add(this.data.start))}build(){let e=this.container,i=document.createElement("div");i.className="blex-branch",i.setAttribute("data-testid",`blex-branch-${this.blockId}`);let s=document.createElement("div");if(s.className="blex-branch__header-bar",this.data.title){let a=document.createElement("span");a.className="blex-branch__title",a.setAttribute("data-testid",`blex-branch-title-${this.blockId}`),a.textContent=this.data.title,s.appendChild(a);let r=document.createElement("span");r.className="blex-branch__header-sep",r.textContent="/",s.appendChild(r)}s.appendChild(this.buildBreadcrumbs()),i.appendChild(s);let o=document.createElement("div");o.className="blex-branch__main",o.appendChild(this.buildNodeCard()),o.appendChild(this.buildMinimap()),i.appendChild(o),e.appendChild(i),e.setAttribute("data-blex-ready","true")}buildBreadcrumbs(){let e=document.createElement("nav");return e.className="blex-branch__breadcrumbs",e.setAttribute("data-testid",`blex-branch-breadcrumbs-${this.blockId}`),this.path.forEach((i,s)=>{if(s>0){let l=document.createElement("span");l.className="blex-branch__breadcrumb-arrow",l.textContent=" \u2192 ",e.appendChild(l)}let o=i.nodeId===this.currentNodeId,a=document.createElement(o?"span":"a");a.className="blex-branch__breadcrumb",o&&a.classList.add("blex-branch__breadcrumb--active");let r=this.nodeMap.get(i.nodeId);a.textContent=r?.label??i.nodeId,a.setAttribute("data-testid",`blex-branch-crumb-${i.nodeId}`),o||(a.href="#",this.addListener(a,"click",l=>{l.preventDefault(),this.jumpTo(i.nodeId)})),e.appendChild(a)}),e}buildNodeCard(){let e=this.nodeMap.get(this.currentNodeId);if(!e){let r=document.createElement("div");return r.textContent=`Unknown node: ${this.currentNodeId}`,r}let i=document.createElement("div");if(i.className="blex-branch__card",i.setAttribute("data-testid",`blex-branch-card-${e.id}`),this.path.length>1){let r=this.path[this.path.length-1],l=document.createElement("div");l.className="blex-branch__step-badge",l.setAttribute("data-testid",`blex-branch-step-badge-${this.blockId}`);let c=`Step ${this.path.length}`;r.edgeLabel&&(c+=` \xB7 via '${r.edgeLabel}'`),l.textContent=c,i.appendChild(l)}let s=document.createElement("div");if(s.className="blex-branch__card-header",e.icon){let r=document.createElement("span");r.className="blex-branch__card-icon",r.textContent=e.icon,s.appendChild(r)}let o=document.createElement("div");if(o.className="blex-branch__card-label",o.textContent=e.label,s.appendChild(o),i.appendChild(s),e.body){let r=document.createElement("div");r.className="blex-branch__card-body",r.innerHTML=this.renderMarkdown(e.body),i.appendChild(r)}if(e.terminal){let r=document.createElement("div");r.className="blex-branch__terminal",r.setAttribute("data-testid",`blex-branch-terminal-${e.id}`),r.textContent="End of path",i.appendChild(r),this.emitPathCompletion()}let a=this.edgeMap.get(e.id)??[];if(a.length>0){let r=document.createElement("div");r.className="blex-branch__actions";for(let l of a){let c=document.createElement("button");c.className="blex-branch__edge-btn",c.setAttribute("data-testid",`blex-branch-edge-${l.from}-${l.to}`),c.textContent=l.label,l.color&&(c.style.borderColor=l.color,c.style.color=l.color),this.addListener(c,"click",()=>this.navigate(l)),r.appendChild(c)}i.appendChild(r)}return i}buildMinimap(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","blex-branch__minimap"),e.setAttribute("data-testid",`blex-branch-minimap-${this.blockId}`);let i=this.data.nodes,s=this.data.edges;if(i.length===0)return e;let o=this.layoutNodes(),a=8,r=16,l=0,c=0;for(let u of o.values())u.x>l&&(l=u.x),u.y>c&&(c=u.y);let d=l+r*2,h=c+r*2;e.setAttribute("viewBox",`0 0 ${d} ${h}`),e.setAttribute("width",`${Math.min(d,200)}`),e.setAttribute("height",`${Math.min(h,160)}`);for(let u of s){let f=o.get(u.from),m=o.get(u.to);if(!f||!m)continue;let p=document.createElementNS("http://www.w3.org/2000/svg","line");p.setAttribute("x1",String(f.x+r)),p.setAttribute("y1",String(f.y+r)),p.setAttribute("x2",String(m.x+r)),p.setAttribute("y2",String(m.y+r)),p.setAttribute("class","blex-branch__minimap-edge"),e.appendChild(p)}for(let u of i){let f=o.get(u.id);if(!f)continue;let m=document.createElementNS("http://www.w3.org/2000/svg","circle");m.setAttribute("cx",String(f.x+r)),m.setAttribute("cy",String(f.y+r)),m.setAttribute("r",String(a)),m.setAttribute("data-testid",`blex-branch-minimap-node-${u.id}`);let p="blex-branch__minimap-node";u.id===this.currentNodeId?p+=" blex-branch__minimap-node--current":this.visited.has(u.id)&&(p+=" blex-branch__minimap-node--visited"),m.setAttribute("class",p),m.style.cursor="pointer",this.addListener(m,"click",()=>this.jumpTo(u.id)),e.appendChild(m)}return e}layoutNodes(){let e=new Map,i=new Set,s=[],o=new Map;for(s.push({id:this.data.start,depth:0,index:0}),i.add(this.data.start);s.length>0;){let{id:r,depth:l}=s.shift(),c=o.get(l)??0;o.set(l,c+1),e.set(r,{x:c*50,y:l*40});let d=this.edgeMap.get(r)??[];for(let h of d)i.has(h.to)||(i.add(h.to),s.push({id:h.to,depth:l+1,index:0}))}let a=0;for(let r of this.data.nodes)if(!e.has(r.id)){let l=Math.max(0,...Array.from(o.keys()));e.set(r.id,{x:a*50,y:(l+1)*40}),a++}return e}navigate(e){this.currentNodeId=e.to,this.visited.add(e.to);let i=this.path.findIndex(s=>s.nodeId===e.from);i>=0&&(this.path=this.path.slice(0,i+1)),this.path.push({nodeId:e.to,edgeLabel:e.label}),this.rebuild()}jumpTo(e){let i=this.path.findIndex(s=>s.nodeId===e);i>=0?this.path=this.path.slice(0,i+1):this.path.push({nodeId:e,edgeLabel:void 0}),this.currentNodeId=e,this.visited.add(e),this.rebuild()}rebuild(){this.container&&(this.container.innerHTML="",this.build())}emitPathCompletion(){let e=this.path.map(o=>this.nodeMap.get(o.nodeId)?.label??o.nodeId),i=`Completed path: ${e.join(" \u2192 ")} (${this.path.length} steps)`,s=`Completed: ${e[0]} \u2192 ${e[e.length-1]}`;this.emit({blockId:this.blockId,type:"path-complete",payload:{path:this.path.map(o=>({nodeId:o.nodeId,edgeLabel:o.edgeLabel})),steps:this.path.length},serialized:i,summary:s,icon:"\u{1F33F}",immediate:!1,revertable:!1})}renderMarkdown(e){let i=[],s=e.replace(/```(\w*)\n([\s\S]*?)```/g,(a,r,l)=>{let c=i.length;return i.push(`<pre><code>${this.escapeHtml(l)}</code></pre>`),`\0CODEBLOCK_${c}\0`}),o=[];return s=s.replace(/`([^`]+)`/g,(a,r)=>{let l=o.length;return o.push(`<code>${this.escapeHtml(r)}</code>`),`\0INLINE_${l}\0`}),s=this.escapeHtml(s),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*(.+?)\*/g,"<em>$1</em>"),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),s=s.replace(/^- (.+)$/gm,"<li>$1</li>"),s=s.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),s=s.replace(/\n/g,"<br>"),s=s.replace(/\x00CODEBLOCK_(\d+)\x00/g,(a,r)=>i[parseInt(r)]),s=s.replace(/\x00INLINE_(\d+)\x00/g,(a,r)=>o[parseInt(r)]),s}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}});var um={};Jt(um,{BaseRenderer:()=>I,getPluginInfo:()=>ba,getRegisteredTypes:()=>ha,hasBlockType:()=>Jn,registerBlockType:()=>it,registerLazyBlockType:()=>Bt,registerPlugin:()=>ma,renderBlock:()=>ti,renderPlaceholder:()=>ua,unregisterBlockType:()=>Qn,unregisterPlugin:()=>ga});G();var Ce=new Map,Kn=new Set;function it(n,t){Ce.set(n,{factory:t})}function la(n){Kn.add(n)}function ca(n){return Kn.has(n)}function Qn(n,t){if(!Ce.has(n))return!1;if(Kn.has(n)&&!t?.force)throw new Error(`Cannot unregister built-in block type "${n}" without force: true`);return Ce.delete(n),Kn.delete(n),!0}function Bt(n,t){Ce.set(n,{loader:t})}async function da(n){let t=Ce.get(n);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 Jn(n){return Ce.has(n)}function ha(){return Array.from(Ce.keys())}function ua(n,t){let e=document.createElement("div");e.className="blex-placeholder",e.setAttribute("data-testid",`blex-placeholder-${n}`),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true");let i=document.createElement("span");i.className="blex-placeholder__label",i.textContent=n;let s=document.createElement("div");return s.className="blex-placeholder__pulse",e.appendChild(i),e.appendChild(s),t.appendChild(e),e}G();var Zn=class extends I{render(t,e){this.container=e;let i=document.createElement("details");i.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}`),i.appendChild(s);let o=document.createElement("pre"),a=document.createElement("code");a.textContent=JSON.stringify(t.data,null,2),o.appendChild(a),i.appendChild(o),e.appendChild(i),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 fa="blex-theme-defaults",od=`
3
+ `):n}function Sp(n,t){let{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:n,label:a,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function El(n,t){let e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:a,boxHeight:r}=t,l=st(t.bodyFont),c=st(t.titleFont),d=st(t.footerFont),h=o.length,u=s.length,f=i.length,m=ut(t.padding),p=m.height,g=0,x=i.reduce((y,v)=>y+v.before.length+v.lines.length+v.after.length,0);if(x+=n.beforeBody.length+n.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*y+(x-f)*l.lineHeight+(x-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let _=0,w=function(y){g=Math.max(g,e.measureText(y).width+_)};return e.save(),e.font=c.string,H(n.title,w),e.font=l.string,H(n.beforeBody.concat(n.afterBody),w),_=t.displayColors?a+2+t.boxPadding:0,H(i,y=>{H(y.before,w),H(y.lines,w),H(y.after,w)}),_=0,e.font=d.string,H(n.footer,w),e.restore(),g+=m.width,{width:g,height:p}}function Mp(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function Ap(n,t,e,i){let{x:s,width:o}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+o+a>t.width||n==="right"&&s-o-a<0)return!0}function Tp(n,t,e,i){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=n,c="center";return i==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),Ap(c,n,t,e)&&(c="center"),c}function Sl(n,t,e){let i=e.yAlign||t.yAlign||Mp(n,e);return{xAlign:e.xAlign||t.xAlign||Tp(n,t,e,i),yAlign:i}}function Dp(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Lp(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Ml(n,t,e,i){let{caretSize:s,caretPadding:o,cornerRadius:a}=n,{xAlign:r,yAlign:l}=e,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=fe(a),m=Dp(t,r),p=Lp(t,l,c);return l==="center"?r==="left"?m+=c:r==="right"&&(m-=c):r==="left"?m-=Math.max(d,u)+s:r==="right"&&(m+=Math.max(h,f)+s),{x:at(m,0,i.width-t.width),y:at(p,0,i.height-t.height)}}function Ii(n,t,e){let i=ut(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Al(n){return Wt([],se(n))}function Ip(n,t,e){return ie(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Tl(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}function vt(n,t,e,i){let s=n[t].call(e,i);return typeof s>"u"?mc[t].call(e,i):s}function Op(n,t,e,i){let s=n.indexOf(t);if(s===-1)return Pp(n,t,e,i);let o=n.lastIndexOf(t);return s!==o?e:s}function Dl(n){let t=this.getLabels();return n>=0&&n<t.length?t[n]:n}function Np(n,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=n,f=o||1,m=d-1,{min:p,max:g}=t,x=!B(a),_=!B(r),w=!B(c),y=(g-p)/(h+1),v=js((g-p)/m/f)*f,k,S,M,L;if(v<1e-14&&!x&&!_)return[{value:p},{value:g}];L=Math.ceil(g/v)-Math.floor(p/v),L>m&&(v=js(L*v/m/f)*f),B(l)||(k=Math.pow(10,l),v=Math.ceil(v*k)/k),s==="ticks"?(S=Math.floor(p/v)*v,M=Math.ceil(g/v)*v):(S=p,M=g),x&&_&&o&&gr((r-a)/o,v/1e3)?(L=Math.round(Math.min((r-a)/v,d)),v=(r-a)/L,S=a,M=r):w?(S=x?a:S,M=_?r:M,L=c-1,v=(M-S)/L):(L=(M-S)/v,Ke(L,Math.round(L),v/1e3)?L=Math.round(L):L=Math.ceil(L));let O=Math.max(Ys(v),Ys(S));k=Math.pow(10,B(l)?O:l),S=Math.round(S*k)/k,M=Math.round(M*k)/k;let T=0;for(x&&(u&&S!==a?(e.push({value:a}),S<a&&T++,Ke(Math.round((S+T*v)*k)/k,a,Ll(a,y,n))&&T++):S<a&&T++);T<L;++T){let R=Math.round((S+T*v)*k)/k;if(_&&R>r)break;e.push({value:R})}return _&&u&&M!==r?e.length&&Ke(e[e.length-1].value,r,Ll(r,y,n))?e[e.length-1].value=r:e.push({value:r}):(!_||M===r)&&e.push({value:M}),e}function Ll(n,t,{horizontal:e,minRotation:i}){let s=Dt(i),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/o,a)}function Il(n){return n/Math.pow(10,$n(n))===1}function Pl(n,t,e){let i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Bp(n,t){let e=t-n,i=$n(e);for(;Pl(n,t,i)>10;)i++;for(;Pl(n,t,i)<10;)i--;return Math.min(i,$n(n))}function zp(n,{min:t,max:e}){t=yt(n.min,t);let i=[],s=$n(t),o=Bp(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(n.min,Math.round((l+d+h*Math.pow(10,o))*a)/a);for(;u<e;)i.push({value:u,major:Il(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(n.max,u);return i.push({value:f,major:Il(f),significand:h}),i}function zo(n){let t=n.ticks;if(t.display&&n.display){let e=ut(t.backdropPadding);return P(t.font&&t.font.size,q.font.size)+e.height}return 0}function Fp(n,t,e){return e=U(e)?e:[e],{w:Er(n,t.string,e),h:e.length*t.lineHeight}}function Ol(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function $p(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,a=n.options.pointLabels,r=a.centerPointLabels?F/o:0;for(let l=0;l<o;l++){let c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;let d=n.getPointPosition(l,n.drawingArea+s[l],r),h=st(c.font),u=Fp(n.ctx,h,n._pointLabels[l]);i[l]=u;let f=dt(n.getIndexAngle(l)+r),m=Math.round(xi(f)),p=Ol(m,d.x,u.w,0,180),g=Ol(m,d.y,u.h,90,270);Hp(e,t,f,p,g)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=jp(n,i,s)}function Hp(n,t,e,i,s){let o=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,n.l=Math.min(n.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Vp(n,t,e){let i=n.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=n.getPointPosition(t,i+s+a,o),c=Math.round(xi(dt(l.angle+tt))),d=qp(l.y,r.h,c),h=Up(c),u=Yp(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 Wp(n,t){if(!t)return!0;let{left:e,top:i,right:s,bottom:o}=n;return!($t({x:e,y:i},t)||$t({x:e,y:o},t)||$t({x:s,y:i},t)||$t({x:s,y:o},t))}function jp(n,t,e){let i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:zo(o)/2,additionalAngle:a?F/s:0},c;for(let d=0;d<s;d++){l.padding=e[d],l.size=t[d];let h=Vp(n,d,l);i.push(h),r==="auto"&&(h.visible=Wp(h,c),h.visible&&(c=h))}return i}function Up(n){return n===0||n===180?"center":n<180?"left":"right"}function Yp(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function qp(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Gp(n,t,e){let{left:i,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!B(r)){let l=fe(t.borderRadius),c=ut(t.backdropPadding);n.fillStyle=r;let d=i-c.left,h=s-c.top,u=o-i+c.width,f=a-s+c.height;Object.values(l).some(m=>m!==0)?(n.beginPath(),tn(n,{x:d,y:h,w:u,h:f,radius:l}),n.fill()):n.fillRect(d,h,u,f)}}function Xp(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let o=n._pointLabelItems[s];if(!o.visible)continue;let a=i.setContext(n.getPointLabelContext(s));Gp(e,a,o);let r=st(a.font),{x:l,y:c,textAlign:d}=o;ue(e,n._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function xc(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,Y);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=n.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function Kp(n,t,e,i,s){let o=n.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||e<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),xc(n,e,a,i),o.closePath(),o.stroke(),o.restore())}function Qp(n,t,e){return ie(n,{label:e,index:t,type:"pointLabel"})}function Rl(n,t){return n-t}function Nl(n,t){if(B(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),Z(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Me(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function Bl(n,t,e,i){let s=Ct.length;for(let o=Ct.indexOf(n);o<s-1;++o){let a=ji[Ct[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=i)return Ct[o]}return Ct[s-1]}function Jp(n,t,e,i,s){for(let o=Ct.length-1;o>=Ct.indexOf(e);o--){let a=Ct[o];if(ji[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return Ct[e?Ct.indexOf(e):0]}function Zp(n){for(let t=Ct.indexOf(n)+1,e=Ct.length;t<e;++t)if(ji[Ct[t]].common)return Ct[t]}function zl(n,t,e){if(!e)n[t]=!0;else if(e.length){let{lo:i,hi:s}=_i(e,t),o=e[i]>=t?e[i]:e[s];n[o]=!0}}function tm(n,t,e,i){let s=n._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Fl(n,t,e){let i=[],s={},o=t.length,a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,i.push({value:r,major:!1});return o===0||!e?i:tm(n,i,s,e)}function Pi(n,t,e){let i=0,s=n.length-1,o,a,r,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ft(n,"pos",t)),{pos:o,time:r}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ft(n,"time",t)),{time:o,pos:r}=n[i],{time:a,pos:l}=n[s]);let c=a-o;return c?r+(l-r)*(t-o)/c:r}var Ao,jt,Hr,eu,Ni,Nn,_o,Yr,uu,wt,Le,Ie,Yt,Pe,be,sn,Oe,Re,Vl,To,Wl,jl,Ul,ft,Bn,Bi,Oi,Ru,tl,ql,zn,el,Fi,kt,Ju,nl,il,ye,on,Do,It,Lo,ll,Jl,In,Oo,_f,vf,wf,Ri,fl,Ut,me,Ff,Pt,Ne,Be,ic,No,gl,ac,lc,Hi,dc,kl,yp,Vi,uc,Fn,fc,Li,pc,On,mc,Rn,gc,bc,Pp,Rp,an,dn,rn,$n,De,ln,ge,ji,Ct,_e,cn,_c,em,vc=Mt(()=>{"use strict";$r();Ao=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Ks.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;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 i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},jt=new Ao,Hr="transparent",eu={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=eo(n||Hr),s=i.valid&&eo(t||Hr);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},Ni=class{constructor(t,e,i,s){let o=e[i];s=en([t.to,s,o,t.from]);let a=en([t.from,o,s]);this._active=!0,this._fn=t.fn||eu[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=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=en([t.to,e,s,t.from]),this._from=en([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e<i),!this._active){this._target[s]=r,this._notify(!0);return}if(e<0){this._target[s]=o;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},Nn=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!z(t))return;let e=Object.keys(q.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let o=t[s];if(!z(o))return;let a={};for(let r of e)a[r]=o[r];(U(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,s=iu(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&nu(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=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=i.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 Ni(u,t,c,d),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return jt.add(this._chart,i),!0}};_o=n=>n==="reset"||n==="none",Yr=(n,t)=>t?n:Object.assign({},n),uu=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:$l(e,!0),values:null},wt=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=bo(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&&An(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,u,f,m)=>h==="x"?u:h==="r"?m:f,o=e.xAxisID=P(i.xAxisID,xo(t,"x")),a=e.yAxisID=P(i.yAxisID,xo(t,"y")),r=e.rAxisID=P(i.rAxisID,xo(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&&Gs(this._data,this),t._stacked&&An(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(z(e)){let s=this._cachedMeta;this._data=au(e,s)}else if(i!==e){if(i){Gs(i,this);let s=this._cachedMeta;An(s),s._parsed=[]}e&&Object.isExtensible(e)&&vr(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,i=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=bo(e.vScale,e),e.stack!==i.stack&&(s=!0,An(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(Ur(this,e._parsed),e._stacked=bo(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],d,h,u;if(this._parsing===!1)i._parsed=s,i._sorted=!0,u=s;else{U(s[t])?u=this.parseArrayData(i,s,t,e):z(s[t])?u=this.parseObjectData(i,s,t,e):u=this.parsePrimitiveData(i,s,t,e);let f=()=>h[r]===null||c&&h[r]<c[r];for(d=0;d<e;++d)i._parsed[d+t]=h=u[d],l&&(f()&&(l=!1),c=h);i._sorted=l}a&&Ur(this,u)}parsePrimitiveData(t,e,i,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,m;for(u=0,f=s;u<f;++u)m=u+i,h[u]={[r]:d||o.parse(c[m],m),[l]:a.parse(e[m],m)};return h}parseArrayData(t,e,i,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+i,h=e[d],r[l]={x:o.parse(h[0],d),y:a.parse(h[1],d)};return r}parseObjectData(t,e,i,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+i,f=e[u],c[d]={x:o.parse(ne(f,r),u),y:a.parse(ne(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,o=this._cachedMeta,a=e[t.axis],r={keys:$l(s,!0),values:e._stacks[t.axis]._visualValues};return Wr(r,a,o.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let o=i[e.axis],a=o===null?NaN:o,r=s&&i._stacks[e.axis];s&&r&&(s.values=r,a=Wr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,r=this._getOtherScale(t),l=uu(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=lu(r),u,f;function m(){f=s[u];let p=f[r.axis];return!Z(f[t.axis])||d>p||h<p}for(u=0;u<a&&!(!m()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!m()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,o,a;for(s=0,o=e.length;s<o;++s)a=e[s][t.axis],Z(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=ou(P(this.options.clip,su(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],o=e.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop,d;for(i.dataset&&i.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 i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let s=this.getDataset(),o;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];o=a.$context||(a.$context=hu(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=du(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,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",i){let s=e==="active",o=this._cachedDataOpts,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&Xe(i);if(r)return Yr(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(q.elements[t]),m=()=>this.getContext(i,s,e),p=c.resolveNamedOptions(u,f,m,h);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(Yr(p,l))),p}_resolveAnimations(t,e,i){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,i,e))}let c=new Nn(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||_o(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,s){_o(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!_o(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];let s=i.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,i=!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),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&An(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};E(wt,"defaults",{}),E(wt,"datasetElementType",null),E(wt,"dataElementType",null);Le=class extends wt{parsePrimitiveData(t,e,i,s){return qr(t,e,i,s)}parseArrayData(t,e,i,s){return qr(t,e,i,s)}parseObjectData(t,e,i,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,m,p;for(u=i,f=i+s;u<f;++u)p=e[u],m={},m[o.axis]=o.parse(ne(p,c),u),h.push(Hl(ne(p,d),m,a,u));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let o=i._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:i,vScale:s}=e,o=this.getParsed(t),a=o._custom,r=yo(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.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,i,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+i;f++){let m=this.getParsed(f),p=o||B(m[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,d),x=(m._stacks||{})[r.axis],_={horizontal:c,base:p.base,enableBorderRadius:!x||yo(m._custom)||a===x._top||a===x._bottom,x:c?p.head:g.center,y:c?g.center:p.head,height:c?g.size:Math.abs(p.size),width:c?Math.abs(p.size):g.size};u&&(_.options=h||this.resolveDataElementOptions(f,t[f].active?"active":s));let w=_.options||t[f].options;yu(_,w,x,a),wu(_,w,d.ratio),this.updateElement(t[f],f,_,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],c=d=>{let h=d._parsed.find(f=>f[i.axis]===l),u=h&&h[d.vScale.axis];if(B(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(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[P(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));let r=t.barThickness;return{min:r||pu(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,d=yo(c),h=l[e.axis],u=0,f=i?this.applyStack(e,l,i):h,m,p;f!==h&&(u=f-h,f=h),d&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&Lt(h)!==Lt(c.barEnd)&&(u=0),u+=h);let g=!B(o)&&!d?o:u,x=e.getPixelForValue(g);if(this.chart.getDataVisibility(t)?m=e.getPixelForValue(u+f):m=x,p=m-x,Math.abs(p)<a){p=xu(p,e,r)*a,h===r&&(x-=p/2);let _=e.getPixelForDecimal(0),w=e.getPixelForDecimal(1),y=Math.min(_,w),v=Math.max(_,w);x=Math.max(Math.min(x,v),y),m=x+p,i&&!d&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(m)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){let _=Lt(p)*e.getLineWidthForValue(r)/2;x+=_,p-=_}return{size:p,base:x,head:m,center:m+p/2}}_calculateBarIndexPixels(t,e){let i=e.scale,s=this.options,o=s.skipNull,a=P(s.maxBarThickness,1/0),r,l,c=this._getAxisCount();if(e.grouped){let d=o?this._getStackCount(t):e.stackCount,h=s.barThickness==="flex"?gu(t,e,s,d*c):mu(t,e,s,d*c),u=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(P(u,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=h.start+h.chunk*m+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.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,i=t.data,s=i.length,o=0;for(;o<s;++o)this.getParsed(o)[e.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}};E(Le,"id","bar"),E(Le,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),E(Le,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});Ie=class extends wt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let o=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,e,i,s){let o=super.parseArrayData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=P(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,e,i,s){let o=super.parseObjectData(t,e,i,s);for(let a=0;a<o.length;a++){let r=e[i+a];o[a]._custom=P(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=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:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,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+i;u++){let f=t[u],m=!o&&this.getParsed(u),p={},g=p[d]=o?a.getPixelForDecimal(.5):a.getPixelForValue(m[d]),x=p[h]=o?r.getBasePixel():r.getPixelForValue(m[h]);p.skip=isNaN(g)||isNaN(x),c&&(p.options=l||this.resolveDataElementOptions(u,f.active?"active":s),o&&(p.options.radius=0)),this.updateElement(f,u,p,s)}}resolveDataElementOptions(t,e){let i=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+=P(i&&i._custom,o),s}};E(Ie,"id","bubble"),E(Ie,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),E(Ie,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});Yt=class extends wt{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 i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(z(i[t])){let{key:l="value"}=this._parsing;o=c=>+ne(i[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return Dt(this.options.rotation-90)}_getCircumference(){return Dt(this.options.circumference)}_getRotationExtents(){let t=Y,e=-Y;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let s=this.chart.getDatasetMeta(i).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:i}=e,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(ur(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:m,offsetY:p}=Cu(h,d,l),g=(i.width-a)/u,x=(i.height-a)/f,_=Math.max(Math.min(g,x)/2,0),w=Vs(this.options.radius,_),y=Math.max(w*l,0),v=(w-y)/this._getVisibleDatasetWeightTotal();this.offsetX=m*w,this.offsetY=p*w,s.total=this.calculateTotal(),this.outerRadius=w-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 i=this.options,s=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/Y)}updateElements(t,e,i,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,m=u?0:this.outerRadius,{sharedOptions:p,includeOptions:g}=this._getSharedOptions(e,s),x=this._getRotation(),_;for(_=0;_<e;++_)x+=this._circumference(_,o);for(_=e;_<e+i;++_){let w=this._circumference(_,o),y=t[_],v={x:d+this.offsetX,y:h+this.offsetY,startAngle:x,endAngle:x+w,circumference:w,outerRadius:m,innerRadius:f};g&&(v.options=p||this.resolveDataElementOptions(_,y.active?"active":s)),x+=w,this.updateElement(y,_,v,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=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&&(i+=Math.abs(o))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Y*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Je(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.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 i=0,s=t.length;i<s;++i){let o=this.resolveDataElementOptions(i);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(P(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};E(Yt,"id","doughnut"),E(Yt,"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"}),E(Yt,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),E(Yt,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,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:i,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});Pe=class extends wt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,a=this.chart._animationsDisabled,{start:r,count:l}=Js(e,s,a);this._drawStart=r,this._drawCount=l,Zs(e)&&(r=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,e,i,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:m,segment:p}=this.options,g=Me(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none",_=e+i,w=t.length,y=e>0&&this.getParsed(e-1);for(let v=0;v<w;++v){let k=t[v],S=x?k:{};if(v<e||v>=_){S.skip=!0;continue}let M=this.getParsed(v),L=B(M[f]),O=S[u]=a.getPixelForValue(M[u],v),T=S[f]=o||L?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,M,l):M[f],v);S.skip=isNaN(O)||isNaN(T)||L,S.stop=v>0&&Math.abs(M[u]-y[u])>g,p&&(S.parsed=M,S.raw=c.data[v]),h&&(S.options=d||this.resolveDataElementOptions(v,k.active?"active":s)),x||this.updateElement(k,v,S,s),y=M}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};E(Pe,"id","line"),E(Pe,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),E(Pe,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});be=class extends wt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=Je(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return lo.bind(this)(t,e,i,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((i,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,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,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*F,f=u,m,p=360/this.countVisibleElements();for(m=0;m<e;++m)f+=this._computeAngle(m,s,p);for(m=e;m<e+i;m++){let g=t[m],x=f,_=f+this._computeAngle(m,s,p),w=a.getDataVisibility(m)?c.getDistanceFromCenterForValue(this.getParsed(m).r):0;f=_,o&&(l.animateScale&&(w=0),l.animateRotate&&(x=_=u));let y={x:d,y:h,innerRadius:0,outerRadius:w,startAngle:x,endAngle:_,options:this.resolveDataElementOptions(m,g.active?"active":s)};this.updateElement(g,m,y,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Dt(this.resolveDataElementOptions(t,e).angle||i):0}};E(be,"id","polarArea"),E(be,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),E(be,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,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:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});sn=class extends Yt{};E(sn,"id","pie"),E(sn,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Oe=class extends wt{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return lo.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.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(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r<e+i;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)}}};E(Oe,"id","radar"),E(Oe,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),E(Oe,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});Re=class extends wt{getLabelAndValue(t){let e=this._cachedMeta,i=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:i[t]||"",value:"("+r+", "+l+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled,{start:o,count:a}=Js(e,i,s);if(this._drawStart=o,this._drawCount=a,Zs(e)&&(o=0,a=i.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=i;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(i,o,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,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,m=r.axis,{spanGaps:p,segment:g}=this.options,x=Me(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",w=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){let v=t[y],k=this.getParsed(y),S=_?v:{},M=B(k[m]),L=S[f]=a.getPixelForValue(k[f],y),O=S[m]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,k,l):k[m],y);S.skip=isNaN(L)||isNaN(O)||M,S.stop=y>0&&Math.abs(k[f]-w[f])>x,g&&(S.parsed=k,S.raw=c.data[y]),u&&(S.options=h||this.resolveDataElementOptions(y,v.active?"active":s)),_||this.updateElement(v,y,S,s),w=k}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 i=t.dataset,s=i.options&&i.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}};E(Re,"id","scatter"),E(Re,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),E(Re,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});Vl=Object.freeze({__proto__:null,BarController:Le,BubbleController:Ie,DoughnutController:Yt,LineController:Pe,PieController:sn,PolarAreaController:be,RadarController:Oe,ScatterController:Re});To=class n{constructor(t){E(this,"options");this.options=t||{}}static override(t){Object.assign(n.prototype,t)}init(){}formats(){return Te()}parse(){return Te()}format(){return Te()}add(){return Te()}diff(){return Te()}startOf(){return Te()}endOf(){return Te()}},Wl={_date:To};jl={evaluateInteractionItems:Hn,modes:{index(n,t,e,i){let s=pe(t,n),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?vo(n,s,o,i,a):wo(n,s,o,!1,i,a),l=[];return r.length?(n.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(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?vo(n,s,o,i,a):wo(n,s,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,c=n.getDatasetMeta(l).data;r=[];for(let d=0;d<c.length;++d)r.push({element:c[d],datasetIndex:l,index:d})}return r},point(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return vo(n,s,o,i,a)},nearest(n,t,e,i){let s=pe(t,n),o=e.axis||"xy",a=e.includeInvisible||!1;return wo(n,s,o,e.intersect,i,a)},x(n,t,e,i){let s=pe(t,n);return Kr(n,s,"x",e.intersect,i)},y(n,t,e,i){let s=pe(t,n);return Kr(n,s,"y",e.intersect,i)}}},Ul=["left","top","right","bottom"];ft={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){let e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;let s=ut(n.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(e-s.height,0),r=Lu(n.boxes),l=r.vertical,c=r.horizontal;H(n.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});let d=l.reduce((p,g)=>g.box.options&&g.box.options.display===!1?p:p+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);Yl(u,ut(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),m=Du(l.concat(c),h);Pn(r.fullSize,f,h,m),Pn(l,f,h,m),Pn(c,f,h,m)&&Pn(l,f,h,m),Pu(f),Zr(r.leftAndTop,f,h,m),f.x+=f.w,f.y+=f.h,Zr(r.rightAndBottom,f,h,m),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},H(r.chartArea,p=>{let g=p.box;Object.assign(g,n.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Bn=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},Bi=class extends Bn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Oi="$chartjs",Ru={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},tl=n=>n===null||n==="";ql=Rr?{passive:!0}:!1;zn=new Map,el=0;Fi=class extends Bn{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Nu(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Oi])return!1;let i=e[Oi].initial;["height","width"].forEach(o=>{let a=i[o];B(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[Oi],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:$u,detach:Hu,resize:ju}[e]||Uu;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Co,detach:Co,resize:Co}[e]||zu)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Or(t,e,i,s)}isAttached(t){let e=t&&Si(t);return!!(e&&e.isConnected)}};kt=class{constructor(){E(this,"x");E(this,"y");E(this,"active",!1);E(this,"options");E(this,"$animations")}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Me(this.x)&&Me(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};E(kt,"defaults",{}),E(kt,"defaultRoutes");Ju=n=>n==="left"?"right":n==="right"?"left":n,nl=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,il=(n,t)=>Math.min(t||n,n);ye=class n extends kt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=yt(t,Number.POSITIVE_INFINITY),e=yt(e,Number.NEGATIVE_INFINITY),i=yt(i,Number.POSITIVE_INFINITY),s=yt(s,Number.NEGATIVE_INFINITY),{min:yt(t,i),max:yt(e,s),minDefined:Z(t),maxDefined:Z(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:e,max:i};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||(i=Math.max(i,a.max));return e=o&&e>i?i:e,i=s&&e>i?e:i,{min:yt(e,yt(i,e)),max:yt(i,yt(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){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,i){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Ar(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r<this.ticks.length;this._convertTicksToLabels(l?sl(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Yu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){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,i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=W(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){W(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){W(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=il(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||i<=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/i:f/(i-1),h+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-Ln(t.grid)-e.padding-ol(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),a=xi(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:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=ol(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Ln(o)+l):(t.height=this.maxHeight,t.width=Ln(o)+l),i.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=i.padding*2,m=Dt(this.labelRotation),p=Math.cos(m),g=Math.sin(m);if(r){let x=i.mirror?0:g*h.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{let x=i.mirror?0:p*h.width+g*u.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(c,d,g,p)}}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,i,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=i*e.height):(u=i*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,i;for(e=0,i=t.length;e<i;e++)B(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=sl(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(e/il(e,i)),c=0,d=0,h,u,f,m,p,g,x,_,w,y,v;for(h=0;h<e;h+=l){if(m=t[h].label,p=this._resolveTickFontOptions(h),s.font=g=p.string,x=o[g]=o[g]||{data:{},gc:[]},_=p.lineHeight,w=y=0,!B(m)&&!U(m))w=kn(s,x.data,x.gc,w,m),y=_;else if(U(m))for(u=0,f=m.length;u<f;++u)v=m[u],!B(v)&&!U(v)&&(w=kn(s,x.data,x.gc,w,v),y+=_);a.push(w),r.push(y),c=Math.max(w,c),d=Math.max(y,d)}tf(o,e);let k=a.indexOf(c),S=r.indexOf(d),M=L=>({width:a[L]||0,height:r[L]||0});return{first:M(0),last:M(e-1),widest:M(k),highest:M(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 br(this._alignToPixels?he(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 i=e[t];return i.$context||(i.$context=nf(this.getContext(),t,i))}return this.$context||(this.$context=ef(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=Dt(this.labelRotation),i=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*i>r*s?r/i:l/s:l*s<r*i?l/i:r/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=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=Ln(o),f=[],m=r.setContext(this.getContext()),p=m.display?m.width:0,g=p/2,x=function(j){return he(i,j,p)},_,w,y,v,k,S,M,L,O,T,R,et;if(a==="top")_=x(this.bottom),S=this.bottom-u,L=_-g,T=x(t.top)+g,et=t.bottom;else if(a==="bottom")_=x(this.top),T=t.top,et=x(t.bottom)-g,S=_+g,L=this.top+u;else if(a==="left")_=x(this.right),k=this.right-u,M=_-g,O=x(t.left)+g,R=t.right;else if(a==="right")_=x(this.left),O=t.left,R=x(t.right)-g,k=_+g,M=this.left+u;else if(e==="x"){if(a==="center")_=x((t.top+t.bottom)/2+.5);else if(z(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}T=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(z(a)){let j=Object.keys(a)[0],K=a[j];_=x(this.chart.scales[j].getPixelForValue(K))}k=_-g,M=k-u,O=t.left,R=t.right}let lt=P(s.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/lt));for(w=0;w<h;w+=$){let j=this.getContext(w),K=o.setContext(j),xt=r.setContext(j),rt=K.lineWidth,qt=K.color,Q=xt.dash||[],Gt=xt.dashOffset,J=K.tickWidth,Ot=K.tickColor,V=K.tickBorderDash||[],Et=K.tickBorderDashOffset;y=Zu(this,w,l),y!==void 0&&(v=he(i,y,rt),c?k=M=O=R=v:S=L=T=et=v,f.push({tx1:k,ty1:S,tx2:M,ty2:L,x1:O,y1:T,x2:R,y2:et,width:rt,color:qt,borderDash:Q,borderDashOffset:Gt,tickWidth:J,tickColor:Ot,tickBorderDash:V,tickBorderDashOffset:Et}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){let e=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=Ln(i.grid),f=u+d,m=h?-d:f,p=-Dt(this.labelRotation),g=[],x,_,w,y,v,k,S,M,L,O,T,R,et="middle";if(s==="top")k=this.bottom-m,S=this._getXAxisLabelAlignment();else if(s==="bottom")k=this.top+m,S=this._getXAxisLabelAlignment();else if(s==="left"){let $=this._getYAxisLabelAlignment(u);S=$.textAlign,v=$.x}else if(s==="right"){let $=this._getYAxisLabelAlignment(u);S=$.textAlign,v=$.x}else if(e==="x"){if(s==="center")k=(t.top+t.bottom)/2+f;else if(z(s)){let $=Object.keys(s)[0],j=s[$];k=this.chart.scales[$].getPixelForValue(j)+f}S=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")v=(t.left+t.right)/2-f;else if(z(s)){let $=Object.keys(s)[0],j=s[$];v=this.chart.scales[$].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){w=r[x],y=w.label;let $=o.setContext(this.getContext(x));M=this.getPixelForTick(x)+o.labelOffset,L=this._resolveTickFontOptions(x),O=L.lineHeight,T=U(y)?y.length:1;let j=T/2,K=$.color,xt=$.textStrokeColor,rt=$.textStrokeWidth,qt=S;a?(v=M,S==="inner"&&(x===_-1?qt=this.options.reverse?"left":"right":x===0?qt=this.options.reverse?"right":"left":qt="center"),s==="top"?c==="near"||p!==0?R=-T*O+O/2:c==="center"?R=-lt.highest.height/2-j*O+O:R=-lt.highest.height+O/2:c==="near"||p!==0?R=O/2:c==="center"?R=lt.highest.height/2-j*O:R=lt.highest.height-T*O,h&&(R*=-1),p!==0&&!$.showLabelBackdrop&&(v+=O/2*Math.sin(p))):(k=M,R=(1-T)*O/2);let Q;if($.showLabelBackdrop){let Gt=ut($.backdropPadding),J=lt.heights[x],Ot=lt.widths[x],V=R-Gt.top,Et=0-Gt.left;switch(et){case"middle":V-=J/2;break;case"bottom":V-=J;break}switch(S){case"center":Et-=Ot/2;break;case"right":Et-=Ot;break;case"inner":x===_-1?Et-=Ot:x>0&&(Et-=Ot/2);break}Q={left:Et,top:V,width:Ot+Gt.width,height:J+Gt.height,color:$.backdropColor}}g.push({label:y,font:L,textOffset:R,options:{rotation:p,color:K,strokeColor:xt,strokeWidth:rt,textAlign:qt,textBaseline:et,translation:[v,k],backdrop:Q}})}return g}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Dt(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:i,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,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?s?(d=this.left+o,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,i==="near"?c="left":i==="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:i,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,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,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.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:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.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=he(t,this.left,a)-a/2,d=he(t,this.right,r)+r/2,h=u=l):(h=he(t,this.top,a)-a/2,u=he(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 i=this.ctx,s=this._computeLabelArea();s&&Sn(i,s);let o=this.getLabelItems(t);for(let a of o){let r=a.options,l=a.font,c=a.label,d=a.textOffset;ue(i,c,0,d,l,r)}s&&Mn(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;let o=st(i.font),a=ut(i.padding),r=i.align,l=o.lineHeight/2;e==="bottom"||e==="center"||z(e)?(l+=a.bottom,U(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=of(this,l,e,r);ue(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:u,textAlign:sf(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,i=P(t.grid&&t.grid.z,-1),s=P(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==n.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:i,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(),i=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o<a;++o){let r=e[o];r[i]===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}},on=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;lf(e)&&(i=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,af(t,a,i),this.override&&q.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in q[s]&&(delete q[s][i],this.override&&delete de[i])}};Do=class{constructor(){this.controllers=new on(wt,"datasets",!0),this.elements=new on(kt,"elements"),this.plugins=new on(Object,"plugins"),this.scales=new on(ye,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):H(s,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let s=bi(t);W(i["before"+s],[],i),e[t](i),W(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},It=new Do,Lo=class{constructor(){this._init=void 0}notify(t,e,i,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,i);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,e,i,s){s=s||{};for(let o of t){let a=o.plugin,r=a[i],l=[e,s,o.options];if(W(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){B(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 i=t&&t.config,s=P(i.options&&i.options.plugins,{}),o=cf(i);return s===!1&&!e?[]:hf(t,o,s,e)}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};ll=new Map,Jl=new Set;In=(n,t,e)=>{let i=ne(t,e);i!==void 0&&n.add(i)},Oo=class{constructor(t){this._config=xf(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ql(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Kl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Di(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Di(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Di(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return Di(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(h=>In(l,t,h))),d.forEach(h=>In(l,s,h)),d.forEach(h=>In(l,de[o]||{},h)),d.forEach(h=>In(l,q,h)),d.forEach(h=>In(l,vi,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jl.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,de[e]||{},q.datasets[e]||{},{type:e},q,vi]}resolveNamedOptions(t,e,i,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=cl(this._resolverCache,t,s),l=a;if(yf(a,e)){o.$shared=!1,i=te(i)?i():i;let c=this.createResolver(t,i,r);l=Se(a,i,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],s){let{resolver:o}=cl(this._resolverCache,t,i);return z(e)?Se(o,e,void 0,s):o}};_f=n=>z(n)&&Object.getOwnPropertyNames(n).some(t=>te(n[t]));vf="4.5.1",wf=["top","bottom","left","right","chartArea"];Ri={},fl=n=>{let t=Zl(n);return Object.values(Ri).filter(e=>e.canvas===t).pop()};Ut=class{static register(...t){It.add(...t),pl()}static unregister(...t){It.remove(...t),pl()}constructor(t,e){let i=this.config=new Oo(e),s=Zl(t),o=fl(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=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Xl(s)),this.platform.updateConfig(i);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=hr(),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 Lo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=wr(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Ri[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",ul),jt.listen(this,"progress",Cf),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return B(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return It}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():co(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return no(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,e){jt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,co(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),W(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};H(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Po(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),H(o,a=>{let r=a.options,l=r.id,c=Po(l,r),d=P(r.type,a.dtype);(r.position===void 0||dl(r.position,c)!==dl(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===d)h=i[l];else{let u=It.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(r,t)}),H(s,(a,r)=>{a||delete i[r]}),H(i,a=>{ft.configure(this,a,a.options),ft.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(hl("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){let o=e[i],a=this.getDatasetMeta(i),r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||Io(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=It.getController(r),{datasetElementType:c,dataElementType:d}=q.datasets[r];Object.assign(l,{dataElementType:It.getElement(d),datasetElementType:c&&It.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){H(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 i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;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=i.layout.autoPadding?a:0,this._updateLayout(a),s||H(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(hl("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){H(this.scales,t=>{ft.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Ws(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of e){let a=i==="_removeElements"?-o:o;kf(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<e;o++)if(!Ws(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ft.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],H(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,te(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(jt.has(this)?this.attached&&!jt.running(this)&&jt.start(this):(this.draw(),ul({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let 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,i=[],s,o;for(s=0,o=e.length;s<o;++s){let a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;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,i={meta:t,index:t.index,cancelable:!0},s=go(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&Sn(e,s),t.controller.draw(),s&&Mn(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return $t(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let o=jl.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.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},i.push(s)),s}getContext(){return this.$context||(this.$context=ie(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Xe(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),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(),jt.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(),no(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ri[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,i=(o,a)=>{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};H(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){H(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},H(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s=i?"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||[],i=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}});!En(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){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=i?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 i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,i,a),l=pr(t),c=Ef(t,this._lastEvent,i,l);i&&(this._lastEvent=null,W(o.onHover,[t,r,this],this),l&&W(o.onClick,[t,r,this],this));let d=!En(r,s);return(d||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=c,d}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};E(Ut,"defaults",q),E(Ut,"instances",Ri),E(Ut,"overrides",de),E(Ut,"registry",It),E(Ut,"version",vf),E(Ut,"getChart",fl);me=class extends kt{constructor(e){super();E(this,"circumference");E(this,"endAngle");E(this,"fullCircles");E(this,"innerRadius");E(this,"outerRadius");E(this,"pixelMargin");E(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){let o=this.getProps(["x","y"],s),{angle:a,distance:r}=qs(o,{x:e,y:i}),{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,m=P(u,c-l),p=Qe(a,l,c)&&l!==c,g=m>=Y||p,x=Vt(r,d+f,h+f);return g&&x}getCenterPoint(e){let{x:i,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:i+Math.cos(h)*u,y:s+Math.sin(h)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:s}=this,o=(i.offset||0)/4,a=(i.spacing||0)/2,r=i.circular;if(this.pixelMargin=i.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(F,s||0)),d=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,Df(e,this,d,a,r),Lf(e,this,d,a,r),e.restore()}};E(me,"id","arc"),E(me,"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}),E(me,"defaultRoutes",{backgroundColor:"backgroundColor"}),E(me,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});Ff=typeof Path2D=="function";Pt=class extends kt{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 i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;Pr(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fr(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,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],o=this.points,a=mo(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Nf(i),c,d;for(c=0,d=a.length;c<d;++c){let{start:h,end:u}=a[c],f=o[h],m=o[u];if(f===m){r.push(f);continue}let p=Math.abs((s-f[e])/(m[e]-f[e])),g=l(f,m,p,i.stepped);g[e]=t[e],r.push(g)}return r.length===1?r[0]:r}pathSegment(t,e,i){return Ro(this)(t,this,e,i)}path(t,e,i){let s=this.segments,o=Ro(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let r of s)a&=o(t,this,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),$f(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};E(Pt,"id","line"),E(Pt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),E(Pt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),E(Pt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});Ne=class extends kt{constructor(e){super();E(this,"parsed");E(this,"skip");E(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){let o=this.options,{x:a,y:r}=this.getProps(["x","y"],s);return Math.pow(e-a,2)+Math.pow(i-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,i){return ml(this,e,"x",i)}inYRange(e,i){return ml(this,e,"y",i)}getCenterPoint(e){let{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);let s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){let s=this.options;this.skip||s.radius<.1||!$t(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,wi(e,s,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}};E(Ne,"id","point"),E(Ne,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),E(Ne,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});Be=class extends kt{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:i,backgroundColor:s}}=this,{inner:o,outer:a}=Wf(this),r=jf(a.radius)?tn:Uf;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Eo(a,e,o)),t.clip(),r(t,Eo(o,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Eo(o,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return ko(this,t,e,i)}inXRange(t,e){return ko(this,t,null,e)}inYRange(t,e){return ko(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+s)/2:e,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};E(Be,"id","bar"),E(Be,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),E(Be,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});ic=Object.freeze({__proto__:null,ArcElement:me,BarElement:Be,LineElement:Pt,PointElement:Ne}),No=["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)"],gl=No.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));ac={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;let{data:{datasets:i},options:s}=n.config,{elements:o}=s,a=bl(i)||Kf(s)||o&&bl(o)||Qf();if(!e.forceOverride&&a)return;let r=Xf(n);i.forEach(r)}};lc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){xl(n);return}let i=n.width;n.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=n.getDatasetMeta(o),c=a||s.data;if(en([r,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=n.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||n.options.parsing)return;let{start:h,count:u}=tp(l,c),f=e.threshold||4*i;if(u<=f){rc(s);return}B(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let m;switch(e.algorithm){case"lttb":m=Jf(c,h,u,i,e);break;case"min-max":m=Zf(c,h,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=m})},destroy(n){xl(n)}};Hi=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){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),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,o=t.angle;return{x:e+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}};dc={id:"filler",afterDatasetsUpdate(n,t,e){let i=(n.data.datasets||[]).length,s=[],o,a,r,l;for(a=0;a<i;++a)o=n.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Pt&&(l={visible:n.isDatasetVisible(a),index:a,fill:sp(r,a,i),chart:n,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=ip(s,a,e.propagate))},beforeDraw(n,t,e){let i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),o=n.chartArea;for(let a=s.length-1;a>=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&So(n.ctx,r,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){let o=i[s].$filler;yl(o)&&So(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!yl(i)||e.drawTime!=="beforeDatasetDraw"||So(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},kl=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},yp=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,Vi=class extends kt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=W(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,s=st(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=kl(i,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,i,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((m,p)=>{let g=i+e/2+o.measureText(m.text).width;(p===0||c[c.length-1]+g+2*r>a)&&(h+=d,c[c.length-(p>0?0:1)]=0,f+=d,u++),l[p]={left:0,top:f,row:u,width:g,height:s},c[c.length-1]+=g+r}),h}_fitCols(t,e,i,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,m=0,p=0;return this.legendItems.forEach((g,x)=>{let{itemWidth:_,itemHeight:w}=vp(i,e,o,g,s);x>0&&f+w+2*r>d&&(h+=u+r,c.push({width:u,height:f}),m+=u+r,p++,u=f=0),l[x]={left:m,top:f,col:p,width:_,height:w},u=Math.max(u,_),f+=w+r}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=Ae(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=ht(i,this.left+s,this.right-this.lineWidths[r]);for(let c of e)r!==c.row&&(r=c.row,l=ht(i,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(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let c of e)c.col!==r&&(r=c.col,l=ht(i,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;Sn(t,this),this._draw(),Mn(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=q.color,l=Ae(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:m,boxHeight:p,itemHeight:g}=kl(a,h),x=function(k,S,M){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();let L=P(M.lineWidth,1);if(s.fillStyle=P(M.fillStyle,r),s.lineCap=P(M.lineCap,"butt"),s.lineDashOffset=P(M.lineDashOffset,0),s.lineJoin=P(M.lineJoin,"miter"),s.lineWidth=L,s.strokeStyle=P(M.strokeStyle,r),s.setLineDash(P(M.lineDash,[])),a.usePointStyle){let O={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:L},T=l.xPlus(k,m/2),R=S+u;io(s,O,T,R,a.pointStyleWidth&&m)}else{let O=S+Math.max((h-p)/2,0),T=l.leftForLtr(k,m),R=fe(M.borderRadius);s.beginPath(),Object.values(R).some(et=>et!==0)?tn(s,{x:T,y:O,w:m,h:p,radius:R}):s.rect(T,O,m,p),s.fill(),L!==0&&s.stroke()}s.restore()},_=function(k,S,M){ue(s,M.text,k,S+g/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},w=this.isHorizontal(),y=this._computeTitleHeight();w?f={x:ht(o,this.left+d,this.right-i[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},uo(this.ctx,t.textDirection);let v=g+d;this.legendItems.forEach((k,S)=>{s.strokeStyle=k.fontColor,s.fillStyle=k.fontColor;let M=s.measureText(k.text).width,L=l.textAlign(k.textAlign||(k.textAlign=a.textAlign)),O=m+u+M,T=f.x,R=f.y;l.setWidth(this.width),w?S>0&&T+O+d>this.right&&(R=f.y+=v,f.line++,T=f.x=ht(o,this.left+d,this.right-i[f.line])):S>0&&R+v>this.bottom&&(T=f.x=T+e[f.line].width+d,f.line++,R=f.y=ht(o,this.top+y+d,this.bottom-e[f.line].height));let et=l.x(T);if(x(et,R,k),T=Cr(L,T+m+u,w?T+O:this.right,t.rtl),_(l.x(T),R,k),w)f.x+=O+d;else if(typeof k.text!="string"){let lt=c.lineHeight;f.y+=hc(k,lt)+d}else f.y+=v}),fo(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=st(e.font),s=ut(e.padding);if(!e.display)return;let o=Ae(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.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 m=this.columnSizes.reduce((p,g)=>Math.max(p,g.height),0);d=c+ht(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}let f=ht(r,h,h+u);a.textAlign=o.textAlign(yi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,ue(a,e.text,f,d,i)}_computeTitleHeight(){let t=this.options.title,e=st(t.font),i=ut(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(Vt(t,this.left,this.right)&&Vt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Vt(t,s.left,s.left+s.width)&&Vt(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!kp(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,o=yp(s,i);s&&!o&&W(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&W(e.onHover,[t,i,this],this)}else i&&W(e.onClick,[t,i,this],this)}};uc={id:"legend",_element:Vi,start(n,t,e){let i=n.legend=new Vi({ctx:n.ctx,options:e,chart:n});ft.configure(n,i,e),ft.addBox(n,i)},stop(n){ft.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;ft.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=n.legend.options;return n._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:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}},Fn=class extends kt{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 i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=U(i.text)?i.text.length:1;this._padding=ut(i.padding);let o=s*st(i.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:i,bottom:s,right:o,options:a}=this,r=a.align,l=0,c,d,h;return this.isHorizontal()?(d=ht(r,i,o),h=e+t,c=o-i):(a.position==="left"?(d=i+t,h=ht(r,s,e),l=F*-.5):(d=o-t,h=ht(r,e,s),l=F*.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 i=st(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);ue(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:yi(e.align),textBaseline:"middle",translation:[a,r]})}};fc={id:"title",_element:Fn,start(n,t,e){Ep(n,e)},stop(n){let t=n.titleBlock;ft.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;ft.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Li=new WeakMap,pc={id:"subtitle",start(n,t,e){let i=new Fn({ctx:n.ctx,options:e,chart:n});ft.configure(n,i,e),ft.addBox(n,i),Li.set(n,i)},stop(n){ft.removeBox(n,Li.get(n)),Li.delete(n)},beforeUpdate(n,t,e){let i=Li.get(n);ft.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},On={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;t<e;++t){let r=n[t].element;if(r&&r.hasValue()){let l=r.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=n.length;o<a;++o){let l=n[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=mi(t,c);d<s&&(s=d,r=l)}}if(r){let l=r.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};mc={beforeTitle:Ht,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Ht,beforeBody:Ht,beforeLabel:Ht,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");let e=n.formattedValue;return B(e)||(t+=e),t},labelColor(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ht,afterBody:Ht,beforeFooter:Ht,footer:Ht,afterFooter:Ht};Rn=class extends kt{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,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new Nn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Ip(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=vt(i,"beforeTitle",this,t),o=vt(i,"title",this,t),a=vt(i,"afterTitle",this,t),r=[];return r=Wt(r,se(s)),r=Wt(r,se(o)),r=Wt(r,se(a)),r}getBeforeBody(t,e){return Al(vt(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,s=[];return H(t,o=>{let a={before:[],lines:[],after:[]},r=Tl(i,o);Wt(a.before,se(vt(r,"beforeLabel",this,o))),Wt(a.lines,vt(r,"label",this,o)),Wt(a.after,se(vt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return Al(vt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,s=vt(i,"beforeFooter",this,t),o=vt(i,"footer",this,t),a=vt(i,"afterFooter",this,t),r=[];return r=Wt(r,se(s)),r=Wt(r,se(o)),r=Wt(r,se(a)),r}_createItems(t){let e=this._active,i=this.chart.data,s=[],o=[],a=[],r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(Sp(this.chart,e[l]));return t.filter&&(r=r.filter((d,h,u)=>t.filter(d,h,u,i))),t.itemSort&&(r=r.sort((d,h)=>t.itemSort(d,h,i))),H(r,d=>{let h=Tl(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 i=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=On[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=El(this,i),c=Object.assign({},r,l),d=Sl(this.chart,i,c),h=Ml(i,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&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=fe(r),{x:u,y:f}=t,{width:m,height:p}=e,g,x,_,w,y,v;return o==="center"?(y=f+p/2,s==="left"?(g=u,x=g-a,w=y+a,v=y-a):(g=u+m,x=g+a,w=y-a,v=y+a),_=g):(s==="left"?x=u+Math.max(l,d)+a:s==="right"?x=u+m-Math.max(c,h)-a:x=this.caretX,o==="top"?(w=f,y=w-a,g=x-a,_=x+a):(w=f+p,y=w+a,g=x+a,_=x-a),v=w),{x1:g,x2:x,x3:_,y1:w,y2:y,y3:v}}drawTitle(t,e,i){let s=this.title,o=s.length,a,r,l;if(o){let c=Ae(i.rtl,this.x,this.width);for(t.x=Ii(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=st(i.titleFont),r=i.titleSpacing,e.fillStyle=i.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+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,s,o){let a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,d=st(o.bodyFont),h=Ii(this,"left",o),u=s.x(h),f=l<d.lineHeight?(d.lineHeight-l)/2:0,m=e.y+f;if(o.usePointStyle){let p={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=s.leftForLtr(u,c)+c/2,x=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,wi(t,p,g,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,wi(t,p,g,x)}else{t.lineWidth=z(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 p=s.leftForLtr(u,c),g=s.leftForLtr(s.xPlus(u,1),c-2),x=fe(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,tn(t,{x:p,y:m,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),tn(t,{x:g,y:m+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(g,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=i,h=st(i.bodyFont),u=h.lineHeight,f=0,m=Ae(i.rtl,this.x,this.width),p=function(M){e.fillText(M,m.x(t.x+f),t.y+u/2),t.y+=u+o},g=m.textAlign(a),x,_,w,y,v,k,S;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=Ii(this,g,i),e.fillStyle=i.bodyColor,H(this.beforeBody,p),f=r&&g!=="right"?a==="center"?c/2+d:c+2+d:0,y=0,k=s.length;y<k;++y){for(x=s[y],_=this.labelTextColors[y],e.fillStyle=_,H(x.before,p),w=x.lines,r&&w.length&&(this._drawColorBox(e,t,y,m,i),u=Math.max(h.lineHeight,l)),v=0,S=w.length;v<S;++v)p(w[v]),u=h.lineHeight;H(x.after,p)}f=0,u=h.lineHeight,H(this.afterBody,p),t.y-=o}drawFooter(t,e,i){let s=this.footer,o=s.length,a,r;if(o){let l=Ae(i.rtl,this.x,this.width);for(t.x=Ii(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=st(i.footerFont),e.fillStyle=i.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+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:d}=i,{topLeft:h,topRight:u,bottomLeft:f,bottomRight:m}=fe(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,i,s),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,i,s),e.lineTo(r+c,l+d-m),e.quadraticCurveTo(r+c,l+d,r+c-m,l+d),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(r+f,l+d),e.quadraticCurveTo(r,l+d,r,l+d-f),a==="center"&&o==="left"&&this.drawCaret(t,e,i,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,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let a=On[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=El(this,t),l=Object.assign({},a,this._size),c=Sl(e,t,l),d=Ml(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()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;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=i,this.drawBackground(o,t,s,e),uo(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),fo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=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=!En(i,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!En(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,i,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,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:s,options:o}=this,a=On[o.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}};E(Rn,"positioners",On);gc={id:"tooltip",_element:Rn,positioners:On,afterInit(n,t,e){e&&(n.tooltip=new Rn({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:mc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},bc=Object.freeze({__proto__:null,Colors:ac,Decimation:lc,Filler:dc,Legend:uc,SubTitle:pc,Title:fc,Tooltip:gc}),Pp=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);Rp=(n,t)=>n===null?null:at(Math.round(n),0,t);an=class extends ye{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:s,label:o}of e)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(B(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:Op(i,t,P(e,t),this._addedLabels),Rp(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=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-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){return Dl.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}};E(an,"id","category"),E(an,"defaults",{ticks:{callback:Dl}});dn=class extends ye{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 B(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=i?o:l;if(t){let l=Lt(s),c=Lt(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:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=Np(s,o);return t.bounds==="ticks"&&Us(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,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Je(t,this.chart.options.locale,this.options.ticks.format)}},rn=class extends dn{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Z(t)?t:0,this.max=Z(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=Dt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.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}};E(rn,"id","linear"),E(rn,"defaults",{ticks:{callback:Ze.formatters.numeric}});$n=n=>Math.floor(ee(n)),De=(n,t)=>Math.pow(10,$n(n)+t);ln=class extends ye{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=dn.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return Z(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=Z(t)?Math.max(0,t):null,this.max=Z(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Z(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(),i=this.min,s=this.max,o=r=>i=t?i:r,a=r=>s=e?s:r;i===s&&(i<=0?(o(1),a(10)):(o(De(i,-1)),a(De(s,1)))),i<=0&&o(De(s,-1)),s<=0&&a(De(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=zp(e,this);return t.bounds==="ticks"&&Us(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":Je(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=ee(t),this._valueRange=ee(this.max)-ee(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ee(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};E(ln,"id","logarithmic"),E(ln,"defaults",{ticks:{callback:Ze.formatters.logarithmic,major:{enabled:!0}}});ge=class extends dn{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(zo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=Z(t)&&!isNaN(t)?t:0,this.max=Z(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/zo(this.options))}generateTickLabels(t){dn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let s=W(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?$p(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=Y/(this._pointLabels.length||1),i=this.options.startAngle||0;return dt(t*e+Dt(i))}getDistanceFromCenterForValue(t){if(B(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(B(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 i=e[t];return Qp(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let s=this.getIndexAngle(t)-tt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:o}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),xc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:s,border:o}=e,a=this._pointLabels.length,r,l,c;if(e.pointLabels.display&&Xp(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),m=o.setContext(u);Kp(this,f,l,a,m)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let d=i.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,i=e.ticks;if(!i.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=i.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)}ue(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};E(ge,"id","radialLinear"),E(ge,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ze.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),E(ge,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),E(ge,"descriptors",{angleLines:{_fallback:"grid"}});ji={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}},Ct=Object.keys(ji);_e=class extends ye{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 i=t.time||(t.time={}),s=this._adapter=new Wl._date(t.adapters.date);s.init(e),Ge(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Nl(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=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=Z(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),o=Z(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let o=this.min,a=this.max,r=_r(s,o,a);return this._unit=e.unit||(i.autoSkip?Bl(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Jp(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Zp(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),Fl(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=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?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=at(e,0,a),i=at(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||Bl(o.minUnit,e,i,this._getLabelCapacity(e)),r=P(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Me(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(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let m=s.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u<i;u=+t.add(u,r,a),f++)zl(d,u,m);return(u===i||s.bounds==="ticks"||f===1)&&zl(d,u,m),Object.keys(d).sort(Rl).map(p=>+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.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,i,s){let o=this.options,a=o.ticks.callback;if(a)return W(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],h=c&&r[c],u=i[e],f=c&&h&&u&&u.major;return this._adapter.format(t,s||(f?h:d))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=Dt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,Fl(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,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Nl(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xs(t.sort(Rl))}};E(_e,"id","time"),E(_e,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});cn=class extends _e{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=Pi(e,this.min),this._tableRange=Pi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],o=[],a,r,l,c,d;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,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,i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Pi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Pi(this._table,i*this._tableRange+this._minPos,!0)}};E(cn,"id","timeseries"),E(cn,"defaults",_e.defaults);_c=Object.freeze({__proto__:null,CategoryScale:an,LinearScale:rn,LogarithmicScale:ln,RadialLinearScale:ge,TimeScale:_e,TimeSeriesScale:cn}),em=[Vl,ic,bc,_c]});async function nm(){return Ui||(Ui=await Promise.resolve().then(()=>(vc(),yc)),Ui)}async function wc(n,t){let e=await nm(),{Chart:i,BarController:s,LineController:o,PieController:a,DoughnutController:r,CategoryScale:l,LinearScale:c,BarElement:d,LineElement:h,PointElement:u,ArcElement:f,Title:m,Legend:p,Tooltip:g}=e;i.register(s,o,a,r,l,c,d,h,u,f,m,p,g);let x=document.createElement("canvas");x.setAttribute("data-testid","blex-chart-canvas"),n.appendChild(x);let _=new i(x,{type:t.type,data:{labels:t.data.labels,datasets:t.data.datasets.map(w=>({label:w.label,data:w.values,backgroundColor:w.color,borderColor:w.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 n.setAttribute("data-blex-ready","true"),{update(w){w.data&&(_.data.labels=w.data.labels??_.data.labels,w.data.datasets&&(_.data.datasets=w.data.datasets.map(y=>({label:y.label,data:y.values,backgroundColor:y.color,borderColor:y.color})))),w.options?.title&&(_.options.plugins.title={display:!0,text:w.options.title}),_.update()},destroy(){_.destroy(),x.remove()}}}var Ui,Cc=Mt(()=>{"use strict";Ui=null});var kc={};Jt(kc,{ChartRenderer:()=>Yi,createChartRenderer:()=>im});function im(){return new Yi}var Yi,Ec=Mt(()=>{"use strict";G();Cc();Yi=class extends I{constructor(){super(...arguments);this.chartInstance=null}render(e,i){this.container=i;let s=document.createElement("div");s.className="blex-chart",s.setAttribute("data-testid",`blex-chart-${e.id}`),i.appendChild(s),wc(s,e.data).then(o=>{this.chartInstance=o,i.setAttribute("data-blex-ready","true")})}update(e){this.chartInstance&&this.chartInstance.update(e.data)}destroy(){this.chartInstance?.destroy(),this.chartInstance=null,super.destroy()}}});var Sc={};Jt(Sc,{KanbanRenderer:()=>qi,createKanbanRenderer:()=>sm});function sm(){return new qi}var qi,Mc=Mt(()=>{"use strict";G();qi=class extends I{constructor(){super(...arguments);this.draggedItemId=null;this.draggedFromColumn=null;this.draggedItemTitle=null;this.currentBlock=null;this.localColumns=[];this.originalColumns=[]}render(e,i){this.container=i,this.currentBlock=e,this.localColumns=JSON.parse(JSON.stringify(e.data.columns)),this.originalColumns=JSON.parse(JSON.stringify(e.data.columns)),this._build(e),i.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:i,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===i);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 i=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)}i.appendChild(a)}_buildColumn(e,i,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,i);o.appendChild(l)}return i&&(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 m=this.localColumns.find(g=>g.id===h),p=this.localColumns.find(g=>g.id===f);if(m&&p){let g=m.items.findIndex(x=>x.id===d);if(g!==-1){let[x]=m.items.splice(g,1);p.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}${s.data.title?` (${s.data.title})`:""}`,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 i=this.localColumns[e],s=this.originalColumns[e];if(i.id!==s.id||i.items.length!==s.items.length)return!1;for(let o=0;o<i.items.length;o++)if(i.items[o].id!==s.items[o].id)return!1}return!0}_buildItem(e,i,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=i,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 Ic={};Jt(Ic,{CalendarRenderer:()=>Gi,createCalendarRenderer:()=>om});function Tc(n){let t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0");return`${t}-${e}-${i}`}function Dc(n){let t=new Date(n);return t.setDate(t.getDate()-t.getDay()),t}function Lc(n){let t=new Date(n);if(isNaN(t.getTime()))return n;let e=t.getHours(),i=t.getMinutes(),s=e>=12?"PM":"AM",o=e%12||12;return i===0?`${o} ${s}`:`${o}:${String(i).padStart(2,"0")} ${s}`}function $o(n){let t=new Date(n);return isNaN(t.getTime())?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`}function om(){return new Gi}var Ac,Fo,Gi,Pc=Mt(()=>{"use strict";G();Ac=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Fo=["January","February","March","April","May","June","July","August","September","October","November","December"];Gi=class extends I{constructor(){super(...arguments);this.currentBlock=null;this.viewDate=new Date;this.currentView="month";this.activeDetailEl=null}render(e,i){this.container=i,this.currentBlock=e,this.currentView=e.data.view??"month",this.viewDate=e.data.initialDate?new Date(e.data.initialDate):new Date,this.buildCalendar(e),i.setAttribute("data-blex-ready","true")}revertInteraction(e){}dismissDetail(){this.activeDetailEl&&(this.activeDetailEl.remove(),this.activeDetailEl=null)}showDetailPanel(e,i,s){this.dismissDetail();let o=document.createElement("div");o.className="blex-calendar__detail",o.setAttribute("data-testid",`blex-calendar-detail-${e.id}`);let a=document.createElement("div");a.className="blex-calendar__detail-color",a.style.backgroundColor=e.color??"var(--blex-accent)",o.appendChild(a);let r=document.createElement("div");r.className="blex-calendar__detail-content";let l=document.createElement("div");l.className="blex-calendar__detail-title",l.textContent=e.title,r.appendChild(l);let c=document.createElement("div");c.className="blex-calendar__detail-time";let d=$o(e.start),h=Lc(e.start),u=Lc(e.end),f=e.start.slice(0,10)===e.end.slice(0,10);c.textContent=f?`${d}, ${h} \u2013 ${u}`:`${$o(e.start)} ${h} \u2013 ${$o(e.end)} ${u}`,r.appendChild(c),o.appendChild(r);let m=document.createElement("button");m.className="blex-calendar__detail-dismiss",m.setAttribute("data-testid",`blex-calendar-detail-dismiss-${s.id}`),m.textContent="Dismiss",this.addListener(m,"click",(g=>{g.stopPropagation(),this.dismissDetail()})),o.appendChild(m);let p=this.container?.querySelector(".blex-calendar");p?p.appendChild(o):this.container?.appendChild(o),this.activeDetailEl=o}update(e){this.container&&(this.activeDetailEl=null,this.currentBlock=e,e.data.view&&(this.currentView=e.data.view),this.container.innerHTML="",this.buildCalendar(e))}buildCalendar(e){let i=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),i.appendChild(s)}buildViewToggle(e){let i=document.createElement("div");i.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)})),i.appendChild(a)}return i}buildNav(e){let i=document.createElement("div");i.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)})),i.appendChild(s),i.appendChild(o),i.appendChild(a),i}getHeaderTitle(){if(this.currentView==="month")return`${Fo[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;if(this.currentView==="week"){let e=Dc(this.viewDate),i=new Date(e);return i.setDate(i.getDate()+6),`${Fo[e.getMonth()]} ${e.getDate()} \u2013 ${i.getDate()}, ${e.getFullYear()}`}else return`${Fo[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,i){let s=this.viewDate.getFullYear(),o=this.viewDate.getMonth();for(let l of Ac){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 m=this.getEventsForDate(i.data.events,h);for(let p of m)u.appendChild(this.buildEventEl(p,i));this.addListener(u,"click",(p=>{if(p.target.closest(".blex-calendar__event"))return;let g=`${h}T00:00`,x=`${h}T23:59`;this.emit({blockId:i.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,i){let s=Dc(this.viewDate);for(let o=0;o<7;o++){let a=new Date(s);a.setDate(s.getDate()+o);let r=Tc(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=`${Ac[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`,m=`${r}T${u}:59`,p=document.createElement("div");p.className="blex-calendar__slot",p.setAttribute("data-start",f),p.setAttribute("data-end",m),p.textContent=`${u}:00`,this.addListener(p,"click",(()=>{this.emit({blockId:i.id,type:"slot-click",payload:{start:f,end:m},serialized:`Selected time slot: ${f} - ${m}`,summary:`Selected slot: ${f}`,icon:"\u{1F4C5}",immediate:!1,revertable:!0})})),l.appendChild(p)}let d=this.getEventsForDate(i.data.events,r);for(let h of d)l.appendChild(this.buildEventEl(h,i));e.appendChild(l)}}buildDayGrid(e,i){let s=Tc(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:i.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(i.data.events,s);for(let r of a)o.appendChild(this.buildEventEl(r,i));e.appendChild(o)}buildEventEl(e,i){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.showDetailPanel(e,s,i),this.emit({blockId:i.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,i){return e.filter(s=>{let o=s.start.slice(0,10),a=s.end.slice(0,10);return i>=o&&i<=a})}}});var Oc={};Jt(Oc,{GalleryRenderer:()=>Xi,createGalleryRenderer:()=>am});function am(){return new Xi}var Xi,Rc=Mt(()=>{"use strict";G();Xi=class extends I{constructor(){super(...arguments);this.currentIndex=0}revertInteraction(e){}render(e,i){this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.currentIndex=0,this.container.innerHTML="",this._build(e))}_build(e){let i=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),i.appendChild(r)}_buildGrid(e,i,s,o){if(e.style.setProperty("--blex-gallery-columns",String(o)),s.forEach((a,r)=>{let l=this._createItem(i,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,i,s){s.forEach((l,c)=>{let d=this._createItem(i,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-${i.id}`);let r=document.createElement("button");r.className="blex-gallery__nav-btn",r.textContent="Next",r.setAttribute("data-testid",`blex-gallery-next-${i.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,i,s){let o=Math.max(0,Math.min(i.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,i,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=i.alt??"",a.loading="lazy",a.src=i.url,this.addListener(a,"click",()=>{this.emit({blockId:e.id,type:"select",payload:{imageIndex:s,url:i.url},serialized:`Selected image ${s+1}${e.data.title?` from "${e.data.title}"`:""}: ${i.caption??i.url}`,summary:`Selected image ${s+1}${i.caption?`: ${i.caption}`:""}`,icon:"\u{1F5BC}",immediate:!1,revertable:!0})}),o.appendChild(a),i.caption){let r=document.createElement("figcaption");r.className="blex-gallery__caption",r.textContent=i.caption,o.appendChild(r)}return o}}});var Bc={};Jt(Bc,{EmbedRenderer:()=>Qi,createEmbedRenderer:()=>dm});function lm(n){try{return new URL(n).origin}catch{return""}}function Ki(n){try{return new URL(n).hostname}catch{return n}}function cm(n){if(typeof n!="object"||n===null)return!1;let t=n;return t.type==="blex-interaction"&&typeof t.action=="string"&&typeof t.serialized=="string"&&typeof t.summary=="string"}function dm(){return new Qi}var Nc,rm,Qi,zc=Mt(()=>{"use strict";G();Nc=400,rm=["allow-scripts","allow-same-origin","allow-forms","allow-popups"];Qi=class extends I{constructor(){super(...arguments);this.messageHandler=null;this.expectedOrigin="";this.wrapper=null;this.currentBlock=null}render(e,i){this.container=i,this._buildFrozen(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this._cleanup(),this.container.innerHTML="",this._buildFrozen(e))}destroy(){this._cleanup(),super.destroy()}_cleanup(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null)}_buildTitleBar(e){let{url:i,title:s}=e.data,o=document.createElement("div");o.className="blex-embed__title-bar",o.setAttribute("data-testid",`blex-embed-title-bar-${e.id}`);let a=document.createElement("span");a.className="blex-embed__title",a.textContent=s??Ki(i),o.appendChild(a);let r=document.createElement("span");r.className="blex-embed__domain",r.textContent=Ki(i),o.appendChild(r);let l=document.createElement("a");return l.className="blex-embed__open-btn",l.href=i,l.target="_blank",l.rel="noopener noreferrer",l.textContent="\u2197",l.title="Open in new tab",l.setAttribute("data-testid",`blex-embed-open-${e.id}`),o.appendChild(l),o}_buildFrozen(e){let i=this.container,{url:s,height:o=Nc}=e.data;this.currentBlock=e,this.expectedOrigin=lm(s);let a=document.createElement("div");a.className="blex-embed blex-embed--frozen",a.setAttribute("data-testid",`blex-embed-${e.id}`),a.setAttribute("data-loading","false"),a.setAttribute("data-frozen","true"),this.wrapper=a,a.appendChild(this._buildTitleBar(e));let r=document.createElement("div");r.className="blex-embed__overlay",r.setAttribute("data-testid",`blex-embed-overlay-${e.id}`),r.style.height=`${o}px`;let l=document.createElement("button");l.className="blex-embed__play-btn",l.setAttribute("data-testid",`blex-embed-play-${e.id}`),l.title="Load embedded content";let c=document.createElement("span");c.className="blex-embed__play-icon",c.textContent="\u25B6",l.appendChild(c);let d=document.createElement("span");d.className="blex-embed__play-label",d.textContent=Ki(s),l.appendChild(d),this.addListener(l,"click",()=>{this._activate()}),r.appendChild(l),a.appendChild(r),i.appendChild(a)}_activate(){if(!this.wrapper||!this.currentBlock)return;let e=this.currentBlock,{url:i,title:s,height:o=Nc,sandbox:a=rm}=e.data;this.wrapper.classList.remove("blex-embed--frozen"),this.wrapper.classList.add("blex-embed--loading"),this.wrapper.setAttribute("data-loading","true"),this.wrapper.setAttribute("data-frozen","false");let r=this.wrapper.querySelector(".blex-embed__overlay");r&&r.remove();let l=document.createElement("iframe");l.className="blex-embed__iframe",l.setAttribute("data-testid",`blex-embed-iframe-${e.id}`),l.src=i,l.setAttribute("sandbox",a.join(" ")),l.style.height=`${o}px`,l.title=s??Ki(i),this.addListener(l,"load",()=>{this.wrapper.classList.remove("blex-embed--loading"),this.wrapper.setAttribute("data-loading","false")}),this.wrapper.appendChild(l),this.messageHandler=c=>{this.expectedOrigin&&c.origin!==this.expectedOrigin||!l.contentWindow||c.source!==l.contentWindow||cm(c.data)&&this.emit({blockId:e.id,type:c.data.action,payload:c.data.payload,serialized:c.data.serialized,summary:c.data.summary,icon:"\u{1F517}",immediate:!1,revertable:!1})},window.addEventListener("message",this.messageHandler)}}});var Fc={};Jt(Fc,{BranchRenderer:()=>Ji,createBranchRenderer:()=>hm});function hm(){return new Ji}var Ji,$c=Mt(()=>{"use strict";G();Ji=class extends I{constructor(){super(...arguments);this.nodeMap=new Map;this.edgeMap=new Map;this.path=[];this.visited=new Set;this.currentNodeId=""}render(e,i){this.container=i,this.init(e),this.build()}update(e){this.container&&(this.container.innerHTML="",this.path=[],this.visited.clear(),this.init(e),this.build())}init(e){this.data=e.data,this.blockId=e.id,this.nodeMap.clear(),this.edgeMap.clear();for(let i of this.data.nodes)this.nodeMap.set(i.id,i);for(let i of this.data.edges){let s=this.edgeMap.get(i.from)??[];s.push(i),this.edgeMap.set(i.from,s)}this.path.length===0&&(this.currentNodeId=this.data.start,this.path=[{nodeId:this.data.start}],this.visited.clear(),this.visited.add(this.data.start))}build(){let e=this.container,i=document.createElement("div");i.className="blex-branch",i.setAttribute("data-testid",`blex-branch-${this.blockId}`);let s=document.createElement("div");if(s.className="blex-branch__header-bar",this.data.title){let a=document.createElement("span");a.className="blex-branch__title",a.setAttribute("data-testid",`blex-branch-title-${this.blockId}`),a.textContent=this.data.title,s.appendChild(a);let r=document.createElement("span");r.className="blex-branch__header-sep",r.textContent="/",s.appendChild(r)}s.appendChild(this.buildBreadcrumbs()),i.appendChild(s);let o=document.createElement("div");o.className="blex-branch__main",o.appendChild(this.buildNodeCard()),o.appendChild(this.buildMinimap()),i.appendChild(o),e.appendChild(i),e.setAttribute("data-blex-ready","true")}buildBreadcrumbs(){let e=document.createElement("nav");return e.className="blex-branch__breadcrumbs",e.setAttribute("data-testid",`blex-branch-breadcrumbs-${this.blockId}`),this.path.forEach((i,s)=>{if(s>0){let l=document.createElement("span");l.className="blex-branch__breadcrumb-arrow",l.textContent=" \u2192 ",e.appendChild(l)}let o=i.nodeId===this.currentNodeId,a=document.createElement(o?"span":"a");a.className="blex-branch__breadcrumb",o&&a.classList.add("blex-branch__breadcrumb--active");let r=this.nodeMap.get(i.nodeId);a.textContent=r?.label??i.nodeId,a.setAttribute("data-testid",`blex-branch-crumb-${i.nodeId}`),o||(a.href="#",this.addListener(a,"click",l=>{l.preventDefault(),this.jumpTo(i.nodeId)})),e.appendChild(a)}),e}buildNodeCard(){let e=this.nodeMap.get(this.currentNodeId);if(!e){let r=document.createElement("div");return r.textContent=`Unknown node: ${this.currentNodeId}`,r}let i=document.createElement("div");if(i.className="blex-branch__card",i.setAttribute("data-testid",`blex-branch-card-${e.id}`),this.path.length>1){let r=this.path[this.path.length-1],l=document.createElement("div");l.className="blex-branch__step-badge",l.setAttribute("data-testid",`blex-branch-step-badge-${this.blockId}`);let c=`Step ${this.path.length}`;r.edgeLabel&&(c+=` \xB7 via '${r.edgeLabel}'`),l.textContent=c,i.appendChild(l)}let s=document.createElement("div");if(s.className="blex-branch__card-header",e.icon){let r=document.createElement("span");r.className="blex-branch__card-icon",r.textContent=e.icon,s.appendChild(r)}let o=document.createElement("div");if(o.className="blex-branch__card-label",o.textContent=e.label,s.appendChild(o),i.appendChild(s),e.body){let r=document.createElement("div");r.className="blex-branch__card-body",r.innerHTML=this.renderMarkdown(e.body),i.appendChild(r)}if(e.terminal){let r=document.createElement("div");r.className="blex-branch__terminal",r.setAttribute("data-testid",`blex-branch-terminal-${e.id}`),r.textContent="End of path",i.appendChild(r),this.emitPathCompletion()}let a=this.edgeMap.get(e.id)??[];if(a.length>0){let r=document.createElement("div");r.className="blex-branch__actions";for(let l of a){let c=document.createElement("button");c.className="blex-branch__edge-btn",c.setAttribute("data-testid",`blex-branch-edge-${l.from}-${l.to}`),c.textContent=l.label,l.color&&(c.style.borderColor=l.color,c.style.color=l.color),this.addListener(c,"click",()=>this.navigate(l)),r.appendChild(c)}i.appendChild(r)}return i}buildMinimap(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","blex-branch__minimap"),e.setAttribute("data-testid",`blex-branch-minimap-${this.blockId}`);let i=this.data.nodes,s=this.data.edges;if(i.length===0)return e;let o=this.layoutNodes(),a=8,r=16,l=0,c=0;for(let u of o.values())u.x>l&&(l=u.x),u.y>c&&(c=u.y);let d=l+r*2,h=c+r*2;e.setAttribute("viewBox",`0 0 ${d} ${h}`),e.setAttribute("width",`${Math.min(d,200)}`),e.setAttribute("height",`${Math.min(h,160)}`);for(let u of s){let f=o.get(u.from),m=o.get(u.to);if(!f||!m)continue;let p=document.createElementNS("http://www.w3.org/2000/svg","line");p.setAttribute("x1",String(f.x+r)),p.setAttribute("y1",String(f.y+r)),p.setAttribute("x2",String(m.x+r)),p.setAttribute("y2",String(m.y+r)),p.setAttribute("class","blex-branch__minimap-edge"),e.appendChild(p)}for(let u of i){let f=o.get(u.id);if(!f)continue;let m=document.createElementNS("http://www.w3.org/2000/svg","circle");m.setAttribute("cx",String(f.x+r)),m.setAttribute("cy",String(f.y+r)),m.setAttribute("r",String(a)),m.setAttribute("data-testid",`blex-branch-minimap-node-${u.id}`);let p="blex-branch__minimap-node";u.id===this.currentNodeId?p+=" blex-branch__minimap-node--current":this.visited.has(u.id)&&(p+=" blex-branch__minimap-node--visited"),m.setAttribute("class",p),m.style.cursor="pointer",this.addListener(m,"click",()=>this.jumpTo(u.id)),e.appendChild(m)}return e}layoutNodes(){let e=new Map,i=new Set,s=[],o=new Map;for(s.push({id:this.data.start,depth:0,index:0}),i.add(this.data.start);s.length>0;){let{id:r,depth:l}=s.shift(),c=o.get(l)??0;o.set(l,c+1),e.set(r,{x:c*50,y:l*40});let d=this.edgeMap.get(r)??[];for(let h of d)i.has(h.to)||(i.add(h.to),s.push({id:h.to,depth:l+1,index:0}))}let a=0;for(let r of this.data.nodes)if(!e.has(r.id)){let l=Math.max(0,...Array.from(o.keys()));e.set(r.id,{x:a*50,y:(l+1)*40}),a++}return e}navigate(e){this.currentNodeId=e.to,this.visited.add(e.to);let i=this.path.findIndex(s=>s.nodeId===e.from);i>=0&&(this.path=this.path.slice(0,i+1)),this.path.push({nodeId:e.to,edgeLabel:e.label}),this.rebuild()}jumpTo(e){let i=this.path.findIndex(s=>s.nodeId===e);i>=0?this.path=this.path.slice(0,i+1):this.path.push({nodeId:e,edgeLabel:void 0}),this.currentNodeId=e,this.visited.add(e),this.rebuild()}rebuild(){this.container&&(this.container.innerHTML="",this.build())}emitPathCompletion(){let e=this.path.map(o=>this.nodeMap.get(o.nodeId)?.label??o.nodeId),i=`Completed path: ${e.join(" \u2192 ")} (${this.path.length} steps)`,s=`Completed: ${e[0]} \u2192 ${e[e.length-1]}`;this.emit({blockId:this.blockId,type:"path-complete",payload:{path:this.path.map(o=>({nodeId:o.nodeId,edgeLabel:o.edgeLabel})),steps:this.path.length},serialized:i,summary:s,icon:"\u{1F33F}",immediate:!1,revertable:!1})}renderMarkdown(e){let i=[],s=e.replace(/```(\w*)\n([\s\S]*?)```/g,(a,r,l)=>{let c=i.length;return i.push(`<pre><code>${this.escapeHtml(l)}</code></pre>`),`\0CODEBLOCK_${c}\0`}),o=[];return s=s.replace(/`([^`]+)`/g,(a,r)=>{let l=o.length;return o.push(`<code>${this.escapeHtml(r)}</code>`),`\0INLINE_${l}\0`}),s=this.escapeHtml(s),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*(.+?)\*/g,"<em>$1</em>"),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),s=s.replace(/^- (.+)$/gm,"<li>$1</li>"),s=s.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),s=s.replace(/\n/g,"<br>"),s=s.replace(/\x00CODEBLOCK_(\d+)\x00/g,(a,r)=>i[parseInt(r)]),s=s.replace(/\x00INLINE_(\d+)\x00/g,(a,r)=>o[parseInt(r)]),s}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}});var um={};Jt(um,{BaseRenderer:()=>I,getPluginInfo:()=>ba,getRegisteredTypes:()=>ha,hasBlockType:()=>Jn,registerBlockType:()=>it,registerLazyBlockType:()=>Bt,registerPlugin:()=>ma,renderBlock:()=>ti,renderPlaceholder:()=>ua,unregisterBlockType:()=>Qn,unregisterPlugin:()=>ga});G();var Ce=new Map,Kn=new Set;function it(n,t){Ce.set(n,{factory:t})}function la(n){Kn.add(n)}function ca(n){return Kn.has(n)}function Qn(n,t){if(!Ce.has(n))return!1;if(Kn.has(n)&&!t?.force)throw new Error(`Cannot unregister built-in block type "${n}" without force: true`);return Ce.delete(n),Kn.delete(n),!0}function Bt(n,t){Ce.set(n,{loader:t})}async function da(n){let t=Ce.get(n);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 Jn(n){return Ce.has(n)}function ha(){return Array.from(Ce.keys())}function ua(n,t){let e=document.createElement("div");e.className="blex-placeholder",e.setAttribute("data-testid",`blex-placeholder-${n}`),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true");let i=document.createElement("span");i.className="blex-placeholder__label",i.textContent=n;let s=document.createElement("div");return s.className="blex-placeholder__pulse",e.appendChild(i),e.appendChild(s),t.appendChild(e),e}G();var Zn=class extends I{render(t,e){this.container=e;let i=document.createElement("details");i.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}`),i.appendChild(s);let o=document.createElement("pre"),a=document.createElement("code");a.textContent=JSON.stringify(t.data,null,2),o.appendChild(a),i.appendChild(o),e.appendChild(i),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 fa="blex-theme-defaults",od=`
4
4
  :root {
5
5
  --blex-bg: #ffffff;
6
6
  --blex-text: #1a1a1a;
@@ -223,7 +223,13 @@
223
223
  .blex-mermaid--loading .blex-mermaid__diagram { min-height: 100px; display: flex; align-items: center; justify-content: center; }
224
224
  .blex-mermaid__title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
225
225
  .blex-mermaid__diagram { overflow-x: auto; }
226
- .blex-mermaid__diagram svg { max-width: 100%; height: auto; }
226
+ /* Let the SVG render at mermaid's intrinsic size. We do NOT set max-width: 100%
227
+ here because CSS-scaling the SVG down distorts the relationship between node
228
+ boxes (sized by mermaid's text measurement) and the text inside them \u2014 the
229
+ classic "text overflows the box" bug. The container has overflow-x: auto, so
230
+ wide diagrams scroll horizontally instead of being scaled. The font config
231
+ in mermaid.initialize() ensures measurement matches render. */
232
+ .blex-mermaid__diagram svg { height: auto; }
227
233
  .blex-mermaid__diagram--error { color: var(--blex-error); font-size: 13px; }
228
234
  .blex-mermaid__source {
229
235
  margin-top: 8px; padding: 10px; border-radius: 4px;
@@ -698,19 +704,19 @@ Write-in: ${a.writeInValue}`);let d=r.length>0?`Voted: ${r.join(", ")}${a.writeI
698
704
  Write-in: ${h.writeInValue}`),a.push(m)});let l=`Survey: ${o.filter(c=>c.selected.length>0||c.writeIn).length}/${i.length} answered`;this.answered=!0,this.container.innerHTML="",this._build(e),this.emit({blockId:e.id,type:"submit",payload:{answers:o},serialized:a.join(`
699
705
  `),summary:l,icon:"\u{1F5F3}",immediate:!1,value:{answers:o.map(c=>({selected:c.selected,...c.writeIn?{writeIn:c.writeIn}:{}}))}})}else{let o=i[0],a=this.questionStates[0],r=Array.from(a.selected).sort((u,f)=>u-f).map(u=>o.options[u]),l={selected:r},c=`Poll response: ${o.question}
700
706
  Selected: ${r.join(", ")}`;a.writeInValue&&(l.writeIn=a.writeInValue,c+=`
701
- Write-in: ${a.writeInValue}`);let d=r.length>0?`Voted: ${r.join(", ")}${a.writeInValue?` + "${a.writeInValue}"`:""}`:`Write-in: ${a.writeInValue}`,h={selected:o.multiSelect?r:r[0]??""};a.writeInValue&&(h.writeIn=a.writeInValue),this.answered=!0,this.container.innerHTML="",this._build(e),this.emit({blockId:e.id,type:"submit",payload:l,serialized:c,summary:d,icon:"\u{1F5F3}",immediate:!1,value:h})}}};function _a(){return new us}G();var fs=class extends I{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:i}=t.data,s=document.createElement("div");s.className="blex-status",s.setAttribute("data-testid",`blex-status-${t.id}`);for(let o=0;o<i.length;o++){let a=i[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 ya(){return new fs}G();var ud={up:"\u2191",down:"\u2193",flat:"\u2192"},ps=class extends I{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:i,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=i,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?ud[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 va(){return new ps}var{entries:Da,setPrototypeOf:wa,isFrozen:fd,getPrototypeOf:pd,getOwnPropertyDescriptor:md}=Object,{freeze:gt,seal:At,create:ii}=Object,{apply:vs,construct:ws}=typeof Reflect<"u"&&Reflect;gt||(gt=function(t){return t});At||(At=function(t){return t});vs||(vs=function(t,e){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(e,s)});ws||(ws=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return new t(...i)});var ei=bt(Array.prototype.forEach),gd=bt(Array.prototype.lastIndexOf),Ca=bt(Array.prototype.pop),mn=bt(Array.prototype.push),bd=bt(Array.prototype.splice),si=bt(String.prototype.toLowerCase),ms=bt(String.prototype.toString),gs=bt(String.prototype.match),gn=bt(String.prototype.replace),xd=bt(String.prototype.indexOf),_d=bt(String.prototype.trim),Mt=bt(Object.prototype.hasOwnProperty),mt=bt(RegExp.prototype.test),bn=yd(TypeError);function bt(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return vs(n,t,i)}}function yd(n){return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return ws(n,e)}}function N(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:si;wa&&wa(n,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){let o=e(s);o!==s&&(fd(t)||(t[i]=o),s=o)}n[s]=!0}return n}function vd(n){for(let t=0;t<n.length;t++)Mt(n,t)||(n[t]=null);return n}function zt(n){let t=ii(null);for(let[e,i]of Da(n))Mt(n,e)&&(Array.isArray(i)?t[e]=vd(i):i&&typeof i=="object"&&i.constructor===Object?t[e]=zt(i):t[e]=i);return t}function xn(n,t){for(;n!==null;){let i=md(n,t);if(i){if(i.get)return bt(i.get);if(typeof i.value=="function")return bt(i.value)}n=pd(n)}function e(){return null}return e}var ka=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"]),bs=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"]),xs=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"]),wd=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"]),_s=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"]),Cd=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ea=gt(["#text"]),Ma=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"]),ys=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"]),Sa=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"]),ni=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kd=At(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ed=At(/<%[\w\W]*|[\w\W]*%>/gm),Md=At(/\$\{[\w\W]*/gm),Sd=At(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ad=At(/^aria-[\-\w]+$/),La=At(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Td=At(/^(?:\w+script|data):/i),Dd=At(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ia=At(/^html$/i),Ld=At(/^[a-z][.\w]*(-[.\w]+)+$/i),Aa=Object.freeze({__proto__:null,ARIA_ATTR:Ad,ATTR_WHITESPACE:Dd,CUSTOM_ELEMENT:Ld,DATA_ATTR:Sd,DOCTYPE_NAME:Ia,ERB_EXPR:Ed,IS_ALLOWED_URI:La,IS_SCRIPT_OR_DATA:Td,MUSTACHE_EXPR:kd,TMPLIT_EXPR:Md}),_n={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Id=function(){return typeof window>"u"?null:window},Pd=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null,s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(i=e.getAttribute(s));let o="dompurify"+(i?"#"+i:"");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}},Ta=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Pa(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Id(),t=D=>Pa(D);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==_n.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n,i=e,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:l,NodeFilter:c,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:u,trustedTypes:f}=n,m=l.prototype,p=xn(m,"cloneNode"),g=xn(m,"remove"),x=xn(m,"nextSibling"),_=xn(m,"childNodes"),w=xn(m,"parentNode");if(typeof a=="function"){let D=e.createElement("template");D.content&&D.content.ownerDocument&&(e=D.content.ownerDocument)}let y,v="",{implementation:k,createNodeIterator:M,createDocumentFragment:S,getElementsByTagName:L}=e,{importNode:O}=i,T=Ta();t.isSupported=typeof Da=="function"&&typeof w=="function"&&k&&k.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:R,ERB_EXPR:et,TMPLIT_EXPR:lt,DATA_ATTR:$,ARIA_ATTR:W,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:xt,CUSTOM_ELEMENT:rt}=Aa,{IS_ALLOWED_URI:qt}=Aa,Q=null,Gt=N({},[...ka,...bs,...xs,..._s,...Ea]),J=null,Ot=N({},[...Ma,...ys,...Sa,...ni]),V=Object.seal(ii(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}})),Et=null,Vn=null,oe=Object.seal(ii(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ho=!0,Zi=!0,Vo=!1,jo=!0,ze=!1,jn=!0,ve=!1,ts=!1,es=!1,Fe=!1,Wn=!1,Un=!1,Wo=!0,Uo=!1,Vc="user-content-",ns=!0,hn=!1,$e={},Rt=null,is=N({},["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"]),Yo=null,qo=N({},["audio","video","img","source","image","track"]),ss=null,Go=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yn="http://www.w3.org/1998/Math/MathML",qn="http://www.w3.org/2000/svg",Xt="http://www.w3.org/1999/xhtml",He=Xt,os=!1,as=null,jc=N({},[Yn,qn,Xt],ms),Gn=N({},["mi","mo","mn","ms","mtext"]),Xn=N({},["annotation-xml"]),Wc=N({},["title","style","font","a","script"]),un=null,Uc=["application/xhtml+xml","text/html"],Yc="text/html",ot=null,Ve=null,qc=e.createElement("form"),Xo=function(b){return b instanceof RegExp||b instanceof Function},rs=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ve&&Ve===b)){if((!b||typeof b!="object")&&(b={}),b=zt(b),un=Uc.indexOf(b.PARSER_MEDIA_TYPE)===-1?Yc:b.PARSER_MEDIA_TYPE,ot=un==="application/xhtml+xml"?ms:si,Q=Mt(b,"ALLOWED_TAGS")?N({},b.ALLOWED_TAGS,ot):Gt,J=Mt(b,"ALLOWED_ATTR")?N({},b.ALLOWED_ATTR,ot):Ot,as=Mt(b,"ALLOWED_NAMESPACES")?N({},b.ALLOWED_NAMESPACES,ms):jc,ss=Mt(b,"ADD_URI_SAFE_ATTR")?N(zt(Go),b.ADD_URI_SAFE_ATTR,ot):Go,Yo=Mt(b,"ADD_DATA_URI_TAGS")?N(zt(qo),b.ADD_DATA_URI_TAGS,ot):qo,Rt=Mt(b,"FORBID_CONTENTS")?N({},b.FORBID_CONTENTS,ot):is,Et=Mt(b,"FORBID_TAGS")?N({},b.FORBID_TAGS,ot):zt({}),Vn=Mt(b,"FORBID_ATTR")?N({},b.FORBID_ATTR,ot):zt({}),$e=Mt(b,"USE_PROFILES")?b.USE_PROFILES:!1,Ho=b.ALLOW_ARIA_ATTR!==!1,Zi=b.ALLOW_DATA_ATTR!==!1,Vo=b.ALLOW_UNKNOWN_PROTOCOLS||!1,jo=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=b.SAFE_FOR_TEMPLATES||!1,jn=b.SAFE_FOR_XML!==!1,ve=b.WHOLE_DOCUMENT||!1,Fe=b.RETURN_DOM||!1,Wn=b.RETURN_DOM_FRAGMENT||!1,Un=b.RETURN_TRUSTED_TYPE||!1,es=b.FORCE_BODY||!1,Wo=b.SANITIZE_DOM!==!1,Uo=b.SANITIZE_NAMED_PROPS||!1,ns=b.KEEP_CONTENT!==!1,hn=b.IN_PLACE||!1,qt=b.ALLOWED_URI_REGEXP||La,He=b.NAMESPACE||Xt,Gn=b.MATHML_TEXT_INTEGRATION_POINTS||Gn,Xn=b.HTML_INTEGRATION_POINTS||Xn,V=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Xo(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Xo(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),ze&&(Zi=!1),Wn&&(Fe=!0),$e&&(Q=N({},Ea),J=ii(null),$e.html===!0&&(N(Q,ka),N(J,Ma)),$e.svg===!0&&(N(Q,bs),N(J,ys),N(J,ni)),$e.svgFilters===!0&&(N(Q,xs),N(J,ys),N(J,ni)),$e.mathMl===!0&&(N(Q,_s),N(J,Sa),N(J,ni))),Mt(b,"ADD_TAGS")||(oe.tagCheck=null),Mt(b,"ADD_ATTR")||(oe.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?oe.tagCheck=b.ADD_TAGS:(Q===Gt&&(Q=zt(Q)),N(Q,b.ADD_TAGS,ot))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?oe.attributeCheck=b.ADD_ATTR:(J===Ot&&(J=zt(J)),N(J,b.ADD_ATTR,ot))),b.ADD_URI_SAFE_ATTR&&N(ss,b.ADD_URI_SAFE_ATTR,ot),b.FORBID_CONTENTS&&(Rt===is&&(Rt=zt(Rt)),N(Rt,b.FORBID_CONTENTS,ot)),b.ADD_FORBID_CONTENTS&&(Rt===is&&(Rt=zt(Rt)),N(Rt,b.ADD_FORBID_CONTENTS,ot)),ns&&(Q["#text"]=!0),ve&&N(Q,["html","head","body"]),Q.table&&(N(Q,["tbody"]),delete Et.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=b.TRUSTED_TYPES_POLICY,v=y.createHTML("")}else y===void 0&&(y=Pd(f,s)),y!==null&&typeof v=="string"&&(v=y.createHTML(""));gt&&gt(b),Ve=b}},Ko=N({},[...bs,...xs,...wd]),Qo=N({},[..._s,...Cd]),Gc=function(b){let C=w(b);(!C||!C.tagName)&&(C={namespaceURI:He,tagName:"template"});let A=si(b.tagName),X=si(C.tagName);return as[b.namespaceURI]?b.namespaceURI===qn?C.namespaceURI===Xt?A==="svg":C.namespaceURI===Yn?A==="svg"&&(X==="annotation-xml"||Gn[X]):!!Ko[A]:b.namespaceURI===Yn?C.namespaceURI===Xt?A==="math":C.namespaceURI===qn?A==="math"&&Xn[X]:!!Qo[A]:b.namespaceURI===Xt?C.namespaceURI===qn&&!Xn[X]||C.namespaceURI===Yn&&!Gn[X]?!1:!Qo[A]&&(Wc[A]||!Ko[A]):!!(un==="application/xhtml+xml"&&as[b.namespaceURI]):!1},Nt=function(b){mn(t.removed,{element:b});try{w(b).removeChild(b)}catch{g(b)}},we=function(b,C){try{mn(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{mn(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(Fe||Wn)try{Nt(C)}catch{}else try{C.setAttribute(b,"")}catch{}},Jo=function(b){let C=null,A=null;if(es)b="<remove></remove>"+b;else{let nt=gs(b,/^[\r\n\t ]+/);A=nt&&nt[0]}un==="application/xhtml+xml"&&He===Xt&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");let X=y?y.createHTML(b):b;if(He===Xt)try{C=new u().parseFromString(X,un)}catch{}if(!C||!C.documentElement){C=k.createDocument(He,"template",null);try{C.documentElement.innerHTML=os?v:X}catch{}}let pt=C.body||C.documentElement;return b&&A&&pt.insertBefore(e.createTextNode(A),pt.childNodes[0]||null),He===Xt?L.call(C,ve?"html":"body")[0]:ve?C.documentElement:pt},Zo=function(b){return M.call(b.ownerDocument||b,b,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ls=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")},ta=function(b){return typeof r=="function"&&b instanceof r};function Kt(D,b,C){ei(D,A=>{A.call(t,b,C,Ve)})}let ea=function(b){let C=null;if(Kt(T.beforeSanitizeElements,b,null),ls(b))return Nt(b),!0;let A=ot(b.nodeName);if(Kt(T.uponSanitizeElement,b,{tagName:A,allowedTags:Q}),jn&&b.hasChildNodes()&&!ta(b.firstElementChild)&&mt(/<[/\w!]/g,b.innerHTML)&&mt(/<[/\w!]/g,b.textContent)||b.nodeType===_n.progressingInstruction||jn&&b.nodeType===_n.comment&&mt(/<[/\w]/g,b.data))return Nt(b),!0;if(!(oe.tagCheck instanceof Function&&oe.tagCheck(A))&&(!Q[A]||Et[A])){if(!Et[A]&&ia(A)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,A)||V.tagNameCheck instanceof Function&&V.tagNameCheck(A)))return!1;if(ns&&!Rt[A]){let X=w(b)||b.parentNode,pt=_(b)||b.childNodes;if(pt&&X){let nt=pt.length;for(let _t=nt-1;_t>=0;--_t){let Qt=p(pt[_t],!0);Qt.__removalCount=(b.__removalCount||0)+1,X.insertBefore(Qt,x(b))}}}return Nt(b),!0}return b instanceof l&&!Gc(b)||(A==="noscript"||A==="noembed"||A==="noframes")&&mt(/<\/no(script|embed|frames)/i,b.innerHTML)?(Nt(b),!0):(ze&&b.nodeType===_n.text&&(C=b.textContent,ei([R,et,lt],X=>{C=gn(C,X," ")}),b.textContent!==C&&(mn(t.removed,{element:b.cloneNode()}),b.textContent=C)),Kt(T.afterSanitizeElements,b,null),!1)},na=function(b,C,A){if(Vn[C]||Wo&&(C==="id"||C==="name")&&(A in e||A in qc))return!1;if(!(Zi&&!Vn[C]&&mt($,C))){if(!(Ho&&mt(W,C))){if(!(oe.attributeCheck instanceof Function&&oe.attributeCheck(C,b))){if(!J[C]||Vn[C]){if(!(ia(b)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,b)||V.tagNameCheck instanceof Function&&V.tagNameCheck(b))&&(V.attributeNameCheck instanceof RegExp&&mt(V.attributeNameCheck,C)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(C,b))||C==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,A)||V.tagNameCheck instanceof Function&&V.tagNameCheck(A))))return!1}else if(!ss[C]){if(!mt(qt,gn(A,xt,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&xd(A,"data:")===0&&Yo[b])){if(!(Vo&&!mt(K,gn(A,xt,"")))){if(A)return!1}}}}}}}return!0},ia=function(b){return b!=="annotation-xml"&&gs(b,rt)},sa=function(b){Kt(T.beforeSanitizeAttributes,b,null);let{attributes:C}=b;if(!C||ls(b))return;let A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0},X=C.length;for(;X--;){let pt=C[X],{name:nt,namespaceURI:_t,value:Qt}=pt,je=ot(nt),cs=Qt,ct=nt==="value"?cs:_d(cs);if(A.attrName=je,A.attrValue=ct,A.keepAttr=!0,A.forceKeepAttr=void 0,Kt(T.uponSanitizeAttribute,b,A),ct=A.attrValue,Uo&&(je==="id"||je==="name")&&(we(nt,b),ct=Vc+ct),jn&&mt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ct)){we(nt,b);continue}if(je==="attributename"&&gs(ct,"href")){we(nt,b);continue}if(A.forceKeepAttr)continue;if(!A.keepAttr){we(nt,b);continue}if(!jo&&mt(/\/>/i,ct)){we(nt,b);continue}ze&&ei([R,et,lt],aa=>{ct=gn(ct,aa," ")});let oa=ot(b.nodeName);if(!na(oa,je,ct)){we(nt,b);continue}if(y&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!_t)switch(f.getAttributeType(oa,je)){case"TrustedHTML":{ct=y.createHTML(ct);break}case"TrustedScriptURL":{ct=y.createScriptURL(ct);break}}if(ct!==cs)try{_t?b.setAttributeNS(_t,nt,ct):b.setAttribute(nt,ct),ls(b)?Nt(b):Ca(t.removed)}catch{we(nt,b)}}Kt(T.afterSanitizeAttributes,b,null)},Xc=function D(b){let C=null,A=Zo(b);for(Kt(T.beforeSanitizeShadowDOM,b,null);C=A.nextNode();)Kt(T.uponSanitizeShadowNode,C,null),ea(C),sa(C),C.content instanceof o&&D(C.content);Kt(T.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(D){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,A=null,X=null,pt=null;if(os=!D,os&&(D="<!-->"),typeof D!="string"&&!ta(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw bn("dirty is not a string, aborting")}else throw bn("toString is not a function");if(!t.isSupported)return D;if(ts||rs(b),t.removed=[],typeof D=="string"&&(hn=!1),hn){if(D.nodeName){let Qt=ot(D.nodeName);if(!Q[Qt]||Et[Qt])throw bn("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof r)C=Jo("<!---->"),A=C.ownerDocument.importNode(D,!0),A.nodeType===_n.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?C=A:C.appendChild(A);else{if(!Fe&&!ze&&!ve&&D.indexOf("<")===-1)return y&&Un?y.createHTML(D):D;if(C=Jo(D),!C)return Fe?null:Un?v:""}C&&es&&Nt(C.firstChild);let nt=Zo(hn?D:C);for(;X=nt.nextNode();)ea(X),sa(X),X.content instanceof o&&Xc(X.content);if(hn)return D;if(Fe){if(Wn)for(pt=S.call(C.ownerDocument);C.firstChild;)pt.appendChild(C.firstChild);else pt=C;return(J.shadowroot||J.shadowrootmode)&&(pt=O.call(i,pt,!0)),pt}let _t=ve?C.outerHTML:C.innerHTML;return ve&&Q["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&mt(Ia,C.ownerDocument.doctype.name)&&(_t="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
707
+ Write-in: ${a.writeInValue}`);let d=r.length>0?`Voted: ${r.join(", ")}${a.writeInValue?` + "${a.writeInValue}"`:""}`:`Write-in: ${a.writeInValue}`,h={selected:o.multiSelect?r:r[0]??""};a.writeInValue&&(h.writeIn=a.writeInValue),this.answered=!0,this.container.innerHTML="",this._build(e),this.emit({blockId:e.id,type:"submit",payload:l,serialized:c,summary:d,icon:"\u{1F5F3}",immediate:!1,value:h})}}};function _a(){return new us}G();var fs=class extends I{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:i}=t.data,s=document.createElement("div");s.className="blex-status",s.setAttribute("data-testid",`blex-status-${t.id}`);for(let o=0;o<i.length;o++){let a=i[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 ya(){return new fs}G();var ud={up:"\u2191",down:"\u2193",flat:"\u2192"},ps=class extends I{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:i,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=i,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?ud[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 va(){return new ps}var{entries:Da,setPrototypeOf:wa,isFrozen:fd,getPrototypeOf:pd,getOwnPropertyDescriptor:md}=Object,{freeze:gt,seal:At,create:ii}=Object,{apply:vs,construct:ws}=typeof Reflect<"u"&&Reflect;gt||(gt=function(t){return t});At||(At=function(t){return t});vs||(vs=function(t,e){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(e,s)});ws||(ws=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return new t(...i)});var ei=bt(Array.prototype.forEach),gd=bt(Array.prototype.lastIndexOf),Ca=bt(Array.prototype.pop),mn=bt(Array.prototype.push),bd=bt(Array.prototype.splice),si=bt(String.prototype.toLowerCase),ms=bt(String.prototype.toString),gs=bt(String.prototype.match),gn=bt(String.prototype.replace),xd=bt(String.prototype.indexOf),_d=bt(String.prototype.trim),St=bt(Object.prototype.hasOwnProperty),mt=bt(RegExp.prototype.test),bn=yd(TypeError);function bt(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return vs(n,t,i)}}function yd(n){return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return ws(n,e)}}function N(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:si;wa&&wa(n,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){let o=e(s);o!==s&&(fd(t)||(t[i]=o),s=o)}n[s]=!0}return n}function vd(n){for(let t=0;t<n.length;t++)St(n,t)||(n[t]=null);return n}function zt(n){let t=ii(null);for(let[e,i]of Da(n))St(n,e)&&(Array.isArray(i)?t[e]=vd(i):i&&typeof i=="object"&&i.constructor===Object?t[e]=zt(i):t[e]=i);return t}function xn(n,t){for(;n!==null;){let i=md(n,t);if(i){if(i.get)return bt(i.get);if(typeof i.value=="function")return bt(i.value)}n=pd(n)}function e(){return null}return e}var ka=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"]),bs=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"]),xs=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"]),wd=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"]),_s=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"]),Cd=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ea=gt(["#text"]),Sa=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"]),ys=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"]),Ma=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"]),ni=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kd=At(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ed=At(/<%[\w\W]*|[\w\W]*%>/gm),Sd=At(/\$\{[\w\W]*/gm),Md=At(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ad=At(/^aria-[\-\w]+$/),La=At(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Td=At(/^(?:\w+script|data):/i),Dd=At(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ia=At(/^html$/i),Ld=At(/^[a-z][.\w]*(-[.\w]+)+$/i),Aa=Object.freeze({__proto__:null,ARIA_ATTR:Ad,ATTR_WHITESPACE:Dd,CUSTOM_ELEMENT:Ld,DATA_ATTR:Md,DOCTYPE_NAME:Ia,ERB_EXPR:Ed,IS_ALLOWED_URI:La,IS_SCRIPT_OR_DATA:Td,MUSTACHE_EXPR:kd,TMPLIT_EXPR:Sd}),_n={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Id=function(){return typeof window>"u"?null:window},Pd=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null,s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(i=e.getAttribute(s));let o="dompurify"+(i?"#"+i:"");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}},Ta=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Pa(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Id(),t=D=>Pa(D);if(t.version="3.3.3",t.removed=[],!n||!n.document||n.document.nodeType!==_n.document||!n.Element)return t.isSupported=!1,t;let{document:e}=n,i=e,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:l,NodeFilter:c,NamedNodeMap:d=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:u,trustedTypes:f}=n,m=l.prototype,p=xn(m,"cloneNode"),g=xn(m,"remove"),x=xn(m,"nextSibling"),_=xn(m,"childNodes"),w=xn(m,"parentNode");if(typeof a=="function"){let D=e.createElement("template");D.content&&D.content.ownerDocument&&(e=D.content.ownerDocument)}let y,v="",{implementation:k,createNodeIterator:S,createDocumentFragment:M,getElementsByTagName:L}=e,{importNode:O}=i,T=Ta();t.isSupported=typeof Da=="function"&&typeof w=="function"&&k&&k.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:R,ERB_EXPR:et,TMPLIT_EXPR:lt,DATA_ATTR:$,ARIA_ATTR:j,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:xt,CUSTOM_ELEMENT:rt}=Aa,{IS_ALLOWED_URI:qt}=Aa,Q=null,Gt=N({},[...ka,...bs,...xs,..._s,...Ea]),J=null,Ot=N({},[...Sa,...ys,...Ma,...ni]),V=Object.seal(ii(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}})),Et=null,Vn=null,oe=Object.seal(ii(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ho=!0,Zi=!0,Vo=!1,Wo=!0,ze=!1,Wn=!0,ve=!1,ts=!1,es=!1,Fe=!1,jn=!1,Un=!1,jo=!0,Uo=!1,Vc="user-content-",ns=!0,hn=!1,$e={},Rt=null,is=N({},["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"]),Yo=null,qo=N({},["audio","video","img","source","image","track"]),ss=null,Go=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yn="http://www.w3.org/1998/Math/MathML",qn="http://www.w3.org/2000/svg",Xt="http://www.w3.org/1999/xhtml",He=Xt,os=!1,as=null,Wc=N({},[Yn,qn,Xt],ms),Gn=N({},["mi","mo","mn","ms","mtext"]),Xn=N({},["annotation-xml"]),jc=N({},["title","style","font","a","script"]),un=null,Uc=["application/xhtml+xml","text/html"],Yc="text/html",ot=null,Ve=null,qc=e.createElement("form"),Xo=function(b){return b instanceof RegExp||b instanceof Function},rs=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ve&&Ve===b)){if((!b||typeof b!="object")&&(b={}),b=zt(b),un=Uc.indexOf(b.PARSER_MEDIA_TYPE)===-1?Yc:b.PARSER_MEDIA_TYPE,ot=un==="application/xhtml+xml"?ms:si,Q=St(b,"ALLOWED_TAGS")?N({},b.ALLOWED_TAGS,ot):Gt,J=St(b,"ALLOWED_ATTR")?N({},b.ALLOWED_ATTR,ot):Ot,as=St(b,"ALLOWED_NAMESPACES")?N({},b.ALLOWED_NAMESPACES,ms):Wc,ss=St(b,"ADD_URI_SAFE_ATTR")?N(zt(Go),b.ADD_URI_SAFE_ATTR,ot):Go,Yo=St(b,"ADD_DATA_URI_TAGS")?N(zt(qo),b.ADD_DATA_URI_TAGS,ot):qo,Rt=St(b,"FORBID_CONTENTS")?N({},b.FORBID_CONTENTS,ot):is,Et=St(b,"FORBID_TAGS")?N({},b.FORBID_TAGS,ot):zt({}),Vn=St(b,"FORBID_ATTR")?N({},b.FORBID_ATTR,ot):zt({}),$e=St(b,"USE_PROFILES")?b.USE_PROFILES:!1,Ho=b.ALLOW_ARIA_ATTR!==!1,Zi=b.ALLOW_DATA_ATTR!==!1,Vo=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Wo=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=b.SAFE_FOR_TEMPLATES||!1,Wn=b.SAFE_FOR_XML!==!1,ve=b.WHOLE_DOCUMENT||!1,Fe=b.RETURN_DOM||!1,jn=b.RETURN_DOM_FRAGMENT||!1,Un=b.RETURN_TRUSTED_TYPE||!1,es=b.FORCE_BODY||!1,jo=b.SANITIZE_DOM!==!1,Uo=b.SANITIZE_NAMED_PROPS||!1,ns=b.KEEP_CONTENT!==!1,hn=b.IN_PLACE||!1,qt=b.ALLOWED_URI_REGEXP||La,He=b.NAMESPACE||Xt,Gn=b.MATHML_TEXT_INTEGRATION_POINTS||Gn,Xn=b.HTML_INTEGRATION_POINTS||Xn,V=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Xo(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Xo(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),ze&&(Zi=!1),jn&&(Fe=!0),$e&&(Q=N({},Ea),J=ii(null),$e.html===!0&&(N(Q,ka),N(J,Sa)),$e.svg===!0&&(N(Q,bs),N(J,ys),N(J,ni)),$e.svgFilters===!0&&(N(Q,xs),N(J,ys),N(J,ni)),$e.mathMl===!0&&(N(Q,_s),N(J,Ma),N(J,ni))),St(b,"ADD_TAGS")||(oe.tagCheck=null),St(b,"ADD_ATTR")||(oe.attributeCheck=null),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?oe.tagCheck=b.ADD_TAGS:(Q===Gt&&(Q=zt(Q)),N(Q,b.ADD_TAGS,ot))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?oe.attributeCheck=b.ADD_ATTR:(J===Ot&&(J=zt(J)),N(J,b.ADD_ATTR,ot))),b.ADD_URI_SAFE_ATTR&&N(ss,b.ADD_URI_SAFE_ATTR,ot),b.FORBID_CONTENTS&&(Rt===is&&(Rt=zt(Rt)),N(Rt,b.FORBID_CONTENTS,ot)),b.ADD_FORBID_CONTENTS&&(Rt===is&&(Rt=zt(Rt)),N(Rt,b.ADD_FORBID_CONTENTS,ot)),ns&&(Q["#text"]=!0),ve&&N(Q,["html","head","body"]),Q.table&&(N(Q,["tbody"]),delete Et.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=b.TRUSTED_TYPES_POLICY,v=y.createHTML("")}else y===void 0&&(y=Pd(f,s)),y!==null&&typeof v=="string"&&(v=y.createHTML(""));gt&&gt(b),Ve=b}},Ko=N({},[...bs,...xs,...wd]),Qo=N({},[..._s,...Cd]),Gc=function(b){let C=w(b);(!C||!C.tagName)&&(C={namespaceURI:He,tagName:"template"});let A=si(b.tagName),X=si(C.tagName);return as[b.namespaceURI]?b.namespaceURI===qn?C.namespaceURI===Xt?A==="svg":C.namespaceURI===Yn?A==="svg"&&(X==="annotation-xml"||Gn[X]):!!Ko[A]:b.namespaceURI===Yn?C.namespaceURI===Xt?A==="math":C.namespaceURI===qn?A==="math"&&Xn[X]:!!Qo[A]:b.namespaceURI===Xt?C.namespaceURI===qn&&!Xn[X]||C.namespaceURI===Yn&&!Gn[X]?!1:!Qo[A]&&(jc[A]||!Ko[A]):!!(un==="application/xhtml+xml"&&as[b.namespaceURI]):!1},Nt=function(b){mn(t.removed,{element:b});try{w(b).removeChild(b)}catch{g(b)}},we=function(b,C){try{mn(t.removed,{attribute:C.getAttributeNode(b),from:C})}catch{mn(t.removed,{attribute:null,from:C})}if(C.removeAttribute(b),b==="is")if(Fe||jn)try{Nt(C)}catch{}else try{C.setAttribute(b,"")}catch{}},Jo=function(b){let C=null,A=null;if(es)b="<remove></remove>"+b;else{let nt=gs(b,/^[\r\n\t ]+/);A=nt&&nt[0]}un==="application/xhtml+xml"&&He===Xt&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");let X=y?y.createHTML(b):b;if(He===Xt)try{C=new u().parseFromString(X,un)}catch{}if(!C||!C.documentElement){C=k.createDocument(He,"template",null);try{C.documentElement.innerHTML=os?v:X}catch{}}let pt=C.body||C.documentElement;return b&&A&&pt.insertBefore(e.createTextNode(A),pt.childNodes[0]||null),He===Xt?L.call(C,ve?"html":"body")[0]:ve?C.documentElement:pt},Zo=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)},ls=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")},ta=function(b){return typeof r=="function"&&b instanceof r};function Kt(D,b,C){ei(D,A=>{A.call(t,b,C,Ve)})}let ea=function(b){let C=null;if(Kt(T.beforeSanitizeElements,b,null),ls(b))return Nt(b),!0;let A=ot(b.nodeName);if(Kt(T.uponSanitizeElement,b,{tagName:A,allowedTags:Q}),Wn&&b.hasChildNodes()&&!ta(b.firstElementChild)&&mt(/<[/\w!]/g,b.innerHTML)&&mt(/<[/\w!]/g,b.textContent)||b.nodeType===_n.progressingInstruction||Wn&&b.nodeType===_n.comment&&mt(/<[/\w]/g,b.data))return Nt(b),!0;if(!(oe.tagCheck instanceof Function&&oe.tagCheck(A))&&(!Q[A]||Et[A])){if(!Et[A]&&ia(A)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,A)||V.tagNameCheck instanceof Function&&V.tagNameCheck(A)))return!1;if(ns&&!Rt[A]){let X=w(b)||b.parentNode,pt=_(b)||b.childNodes;if(pt&&X){let nt=pt.length;for(let _t=nt-1;_t>=0;--_t){let Qt=p(pt[_t],!0);Qt.__removalCount=(b.__removalCount||0)+1,X.insertBefore(Qt,x(b))}}}return Nt(b),!0}return b instanceof l&&!Gc(b)||(A==="noscript"||A==="noembed"||A==="noframes")&&mt(/<\/no(script|embed|frames)/i,b.innerHTML)?(Nt(b),!0):(ze&&b.nodeType===_n.text&&(C=b.textContent,ei([R,et,lt],X=>{C=gn(C,X," ")}),b.textContent!==C&&(mn(t.removed,{element:b.cloneNode()}),b.textContent=C)),Kt(T.afterSanitizeElements,b,null),!1)},na=function(b,C,A){if(Vn[C]||jo&&(C==="id"||C==="name")&&(A in e||A in qc))return!1;if(!(Zi&&!Vn[C]&&mt($,C))){if(!(Ho&&mt(j,C))){if(!(oe.attributeCheck instanceof Function&&oe.attributeCheck(C,b))){if(!J[C]||Vn[C]){if(!(ia(b)&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,b)||V.tagNameCheck instanceof Function&&V.tagNameCheck(b))&&(V.attributeNameCheck instanceof RegExp&&mt(V.attributeNameCheck,C)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(C,b))||C==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&mt(V.tagNameCheck,A)||V.tagNameCheck instanceof Function&&V.tagNameCheck(A))))return!1}else if(!ss[C]){if(!mt(qt,gn(A,xt,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&b!=="script"&&xd(A,"data:")===0&&Yo[b])){if(!(Vo&&!mt(K,gn(A,xt,"")))){if(A)return!1}}}}}}}return!0},ia=function(b){return b!=="annotation-xml"&&gs(b,rt)},sa=function(b){Kt(T.beforeSanitizeAttributes,b,null);let{attributes:C}=b;if(!C||ls(b))return;let A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0},X=C.length;for(;X--;){let pt=C[X],{name:nt,namespaceURI:_t,value:Qt}=pt,We=ot(nt),cs=Qt,ct=nt==="value"?cs:_d(cs);if(A.attrName=We,A.attrValue=ct,A.keepAttr=!0,A.forceKeepAttr=void 0,Kt(T.uponSanitizeAttribute,b,A),ct=A.attrValue,Uo&&(We==="id"||We==="name")&&(we(nt,b),ct=Vc+ct),Wn&&mt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ct)){we(nt,b);continue}if(We==="attributename"&&gs(ct,"href")){we(nt,b);continue}if(A.forceKeepAttr)continue;if(!A.keepAttr){we(nt,b);continue}if(!Wo&&mt(/\/>/i,ct)){we(nt,b);continue}ze&&ei([R,et,lt],aa=>{ct=gn(ct,aa," ")});let oa=ot(b.nodeName);if(!na(oa,We,ct)){we(nt,b);continue}if(y&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!_t)switch(f.getAttributeType(oa,We)){case"TrustedHTML":{ct=y.createHTML(ct);break}case"TrustedScriptURL":{ct=y.createScriptURL(ct);break}}if(ct!==cs)try{_t?b.setAttributeNS(_t,nt,ct):b.setAttribute(nt,ct),ls(b)?Nt(b):Ca(t.removed)}catch{we(nt,b)}}Kt(T.afterSanitizeAttributes,b,null)},Xc=function D(b){let C=null,A=Zo(b);for(Kt(T.beforeSanitizeShadowDOM,b,null);C=A.nextNode();)Kt(T.uponSanitizeShadowNode,C,null),ea(C),sa(C),C.content instanceof o&&D(C.content);Kt(T.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(D){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,A=null,X=null,pt=null;if(os=!D,os&&(D="<!-->"),typeof D!="string"&&!ta(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw bn("dirty is not a string, aborting")}else throw bn("toString is not a function");if(!t.isSupported)return D;if(ts||rs(b),t.removed=[],typeof D=="string"&&(hn=!1),hn){if(D.nodeName){let Qt=ot(D.nodeName);if(!Q[Qt]||Et[Qt])throw bn("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof r)C=Jo("<!---->"),A=C.ownerDocument.importNode(D,!0),A.nodeType===_n.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?C=A:C.appendChild(A);else{if(!Fe&&!ze&&!ve&&D.indexOf("<")===-1)return y&&Un?y.createHTML(D):D;if(C=Jo(D),!C)return Fe?null:Un?v:""}C&&es&&Nt(C.firstChild);let nt=Zo(hn?D:C);for(;X=nt.nextNode();)ea(X),sa(X),X.content instanceof o&&Xc(X.content);if(hn)return D;if(Fe){if(jn)for(pt=M.call(C.ownerDocument);C.firstChild;)pt.appendChild(C.firstChild);else pt=C;return(J.shadowroot||J.shadowrootmode)&&(pt=O.call(i,pt,!0)),pt}let _t=ve?C.outerHTML:C.innerHTML;return ve&&Q["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&mt(Ia,C.ownerDocument.doctype.name)&&(_t="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
702
708
  `+_t),ze&&ei([R,et,lt],Qt=>{_t=gn(_t,Qt," ")}),y&&Un?y.createHTML(_t):_t},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};rs(D),ts=!0},t.clearConfig=function(){Ve=null,ts=!1},t.isValidAttribute=function(D,b,C){Ve||rs({});let A=ot(D),X=ot(b);return na(A,X,C)},t.addHook=function(D,b){typeof b=="function"&&mn(T[D],b)},t.removeHook=function(D,b){if(b!==void 0){let C=gd(T[D],b);return C===-1?void 0:bd(T[D],C,1)[0]}return Ca(T[D])},t.removeHooks=function(D){T[D]=[]},t.removeAllHooks=function(){T=Ta()},t}var oi=Pa();G();var Cs=class extends I{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:i,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=i,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(i,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=oi.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(i,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=i,f.download=s??"image",f.click()}),d.appendChild(u),l.appendChild(d),e.appendChild(l)}_openOverlay(t,e){let i=document.createElement("div");i.className="blex-image__overlay";let s=document.createElement("img");s.src=t,s.alt=e??"",i.appendChild(s);let o=()=>{i.remove(),document.removeEventListener("keydown",a)},a=r=>{r.key==="Escape"&&o()};this.addListener(i,"click",o),document.addEventListener("keydown",a),document.body.appendChild(i)}};function Oa(){return new Cs}G();var ks=class extends I{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:i,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=oi.sanitize(i,{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([i],{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(i),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 Ra(){return new ks}G();var Es=class extends I{constructor(){super(...arguments);this.selectedRows=new Set;this.sortColumn=null;this.sortDirection="asc";this.currentBlock=null}render(e,i){this.container=i,this.currentBlock=e,this._build(e),i.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 i=e.map((a,r)=>({row:a,originalIndex:r}));if(!this.sortColumn)return i;let s=this.sortColumn,o=this.sortDirection;return i.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 i=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 m=document.createElement("th");m.className="blex-table__header-cell",m.setAttribute("data-testid",`blex-table-header-${f}`),m.textContent=f,this.sortColumn===f&&m.classList.add(this.sortDirection==="asc"?"blex-table__header-cell--sorted-asc":"blex-table__header-cell--sorted-desc"),a&&this.addListener(m,"click",()=>{this.sortColumn===f?this.sortDirection=this.sortDirection==="asc"?"desc":"asc":(this.sortColumn=f,this.sortDirection="asc"),i.innerHTML="",this._build(this.currentBlock)}),d.appendChild(m)}c.appendChild(d),l.appendChild(c);let h=document.createElement("tbody"),u=this._getSortedRows(o);for(let{row:f,originalIndex:m}of u){let p=document.createElement("tr");p.className="blex-table__row",p.setAttribute("data-testid",`blex-table-row-${m}`),this.selectedRows.has(m)&&p.classList.add("blex-table__row--selected"),this.addListener(p,"click",()=>{this.selectedRows.has(m)?(this.selectedRows.delete(m),p.classList.remove("blex-table__row--selected")):(this.selectedRows.add(m),p.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-${m}-${g}`),x.textContent=String(f[g]??""),p.appendChild(x)}h.appendChild(p)}l.appendChild(h),r.appendChild(l),i.appendChild(r)}_emitSelection(e){if(this.selectedRows.size===0)return;let{columns:i,rows:s}=e.data,o=Array.from(this.selectedRows).sort((f,m)=>f-m),a=o.map(f=>s[f]),r=`| ${i.join(" | ")} |`,l=`| ${i.map(()=>"---").join(" | ")} |`,c=a.map(f=>`| ${i.map(m=>String(f[m]??"")).join(" | ")} |`),h=[e.data.title?`Selected from "${e.data.title}":`:"Selected from table:",r,l,...c].join(`
703
- `),u=o.length;this.emit({blockId:e.id,type:"select",payload:{selectedRows:o,columns:i},serialized:h,summary:`Selected ${u} row${u!==1?"s":""}`,icon:"\u2610",immediate:!1,revertable:!0})}};function Na(){return new Es}G();var Ms=class extends I{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,i){this.currentBlock=e,this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){if(!this.container)return;this.currentBlock=e;let i=e.data.code.split(`
709
+ `),u=o.length;this.emit({blockId:e.id,type:"select",payload:{selectedRows:o,columns:i},serialized:h,summary:`Selected ${u} row${u!==1?"s":""}`,icon:"\u2610",immediate:!1,revertable:!0})}};function Na(){return new Es}G();var Ss=class extends I{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,i){this.currentBlock=e,this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){if(!this.container)return;this.currentBlock=e;let i=e.data.code.split(`
704
710
  `);for(let s of Array.from(this.selectedLines))s>i.length&&this.selectedLines.delete(s);this.container.innerHTML="",this._build(e)}_build(e){let i=this.container,{code:s,language:o,highlightLines:a=[]}=e.data,r=e.data.lineNumbers!==!1,l=s.split(`
705
711
  `),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,m)=>{let p=m+1;if(r&&h){let x=document.createElement("span");x.className="blex-code__line-number",x.textContent=String(p),this.addListener(x,"click",_=>{if(_.shiftKey&&this.lastClickedLine!==null){let y=Math.min(this.lastClickedLine,p),v=Math.max(this.lastClickedLine,p);for(let k=y;k<=v;k++)this.selectedLines.add(k)}else this.selectedLines.has(p)?this.selectedLines.delete(p):this.selectedLines.add(p),this.lastClickedLine=p;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-${p}`),g.textContent=f,a.includes(p)&&g.classList.add("blex-code__line--highlighted"),this.selectedLines.has(p)&&g.classList.add("blex-code__line--selected"),u.appendChild(g)}),c.appendChild(u),i.appendChild(c)}_updateSelectionClasses(e,i){for(let s=1;s<=i;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,i){if(this.selectedLines.size===0)return;let{language:s}=e.data,o=Array.from(this.selectedLines).sort((u,f)=>u-f),a=o.map(u=>i[u-1]).join(`
706
712
  `),r=s??"",l=o.length===1?`line ${o[0]}`:`lines ${o[0]}-${o[o.length-1]}`,c=e.data.filename,h=`${c?`Selected from ${c} (${l}):
707
713
  `:""}\`\`\`${r}
708
714
  ${a}
709
- \`\`\``;this.emit({blockId:e.id,type:"select",payload:{lines:o,...s!==void 0&&{language:s}},serialized:h,summary:`Selected ${l}`,icon:"< >",immediate:!1,revertable:!0})}};function Ba(){return new Ms}G();var Ss=class extends I{constructor(){super(...arguments);this.viewMode="unified";this.selectedHunks=new Set}render(e,i){this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this._build(e))}_build(e){let i=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,m)=>{let p=document.createElement("div");p.className="blex-diff__hunk",this.selectedHunks.has(m)&&p.classList.add("blex-diff__hunk--selected");let g=document.createElement("div");g.className="blex-diff__hunk-header",g.setAttribute("data-testid",`blex-diff-hunk-${m}`),g.textContent=f.header,this.addListener(g,"click",()=>{this.selectedHunks.has(m)?(this.selectedHunks.delete(m),p.classList.remove("blex-diff__hunk--selected")):(this.selectedHunks.add(m),p.classList.add("blex-diff__hunk--selected"))}),p.appendChild(g);for(let x of f.lines){let _=document.createElement("div");_.className=`blex-diff__line blex-diff__line--${x.type}`,_.textContent=x.content,p.appendChild(_)}l.appendChild(p)}),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),i.appendChild(a)}};function za(){return new Ss}G();var As=class extends I{constructor(){super(...arguments);this.expandedPaths=new Set;this.selectedPaths=new Set;this.currentBlock=null}render(e,i){if(this.currentBlock=e,this.container=i,e.data.expanded)for(let s of e.data.expanded)this.expandedPaths.add(s);this.buildTree(e),i.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 i=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),i.appendChild(s)}buildNode(e,i,s){let o=i?`${i}/${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 i=Array.from(this.selectedPaths).sort(),s=i.length,o=i[i.length-1]??"",a=o.split("/").pop()??o;this.emit({blockId:e.id,type:"select",payload:{paths:i},serialized:`Selected from ${e.data.root.name??"file tree"}:
715
+ \`\`\``;this.emit({blockId:e.id,type:"select",payload:{lines:o,...s!==void 0&&{language:s}},serialized:h,summary:`Selected ${l}`,icon:"< >",immediate:!1,revertable:!0})}};function Ba(){return new Ss}G();var Ms=class extends I{constructor(){super(...arguments);this.viewMode="unified";this.selectedHunks=new Set}render(e,i){this.container=i,this._build(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this._build(e))}_build(e){let i=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,m)=>{let p=document.createElement("div");p.className="blex-diff__hunk",this.selectedHunks.has(m)&&p.classList.add("blex-diff__hunk--selected");let g=document.createElement("div");g.className="blex-diff__hunk-header",g.setAttribute("data-testid",`blex-diff-hunk-${m}`),g.textContent=f.header,this.addListener(g,"click",()=>{this.selectedHunks.has(m)?(this.selectedHunks.delete(m),p.classList.remove("blex-diff__hunk--selected")):(this.selectedHunks.add(m),p.classList.add("blex-diff__hunk--selected"))}),p.appendChild(g);for(let x of f.lines){let _=document.createElement("div");_.className=`blex-diff__line blex-diff__line--${x.type}`,_.textContent=x.content,p.appendChild(_)}l.appendChild(p)}),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),i.appendChild(a)}};function za(){return new Ms}G();var As=class extends I{constructor(){super(...arguments);this.expandedPaths=new Set;this.selectedPaths=new Set;this.currentBlock=null}render(e,i){if(this.currentBlock=e,this.container=i,e.data.expanded)for(let s of e.data.expanded)this.expandedPaths.add(s);this.buildTree(e),i.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 i=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),i.appendChild(s)}buildNode(e,i,s){let o=i?`${i}/${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 i=Array.from(this.selectedPaths).sort(),s=i.length,o=i[i.length-1]??"",a=o.split("/").pop()??o;this.emit({blockId:e.id,type:"select",payload:{paths:i},serialized:`Selected from ${e.data.root.name??"file tree"}:
710
716
  ${i.join(`
711
717
  `)}`,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 Fa(){return new As}G();var Ts=class extends I{constructor(){super(...arguments);this.values={};this.errors={}}render(e,i){this.container=i;for(let s of e.data.fields)s.defaultValue!==void 0&&(this.values[s.name]=s.defaultValue);this.buildForm(e),i.setAttribute("data-blex-ready","true")}update(e){this.container&&(this.container.innerHTML="",this.buildForm(e))}buildForm(e){let i=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(`
712
718
  `),h=Object.keys(this.values).length;this.emit({blockId:e.id,type:"submit",payload:{...this.values},serialized:`Form submission${s?` (${s})`:""}:
713
- ${d}`,summary:`Submitted${s?`: ${s}`:` form (${h} fields)`}`,icon:"\u{1F4CB}",immediate:!0})}else this.container.innerHTML="",this.buildForm(e)}),s){let c=document.createElement("div");c.className="blex-form__title",c.textContent=s,r.appendChild(c)}for(let c of o){let d=document.createElement("div");d.className="blex-form__field";let h=document.createElement("label");h.className="blex-form__label",h.textContent=c.label+(c.required?" *":""),d.appendChild(h);let u=this.createInput(c);if(d.appendChild(u),this.errors[c.name]){let f=document.createElement("span");f.className="blex-form__error",f.textContent=this.errors[c.name],d.appendChild(f)}r.appendChild(d)}let l=document.createElement("button");l.type="submit",l.className="blex-form__submit",l.textContent=a??"Submit",l.setAttribute("data-testid",`blex-form-submit-${e.id}`),r.appendChild(l),i.appendChild(r)}createInput(e){let i=`blex-form-field-${e.name}`;if(e.type==="textarea"){let o=document.createElement("textarea");return o.className="blex-form__input",o.name=e.name,o.placeholder=e.placeholder??"",o.required=e.required??!1,o.value=String(this.values[e.name]??""),o.setAttribute("data-testid",i),this.addListener(o,"input",()=>{this.values[e.name]=o.value}),o}if(e.type==="select"){let o=document.createElement("select");o.className="blex-form__input",o.name=e.name,o.required=e.required??!1,o.setAttribute("data-testid",i);let a=document.createElement("option");a.value="",a.textContent=e.placeholder??"Select...",o.appendChild(a);for(let r of e.options??[]){let l=document.createElement("option");l.value=r,l.textContent=r,this.values[e.name]===r&&(l.selected=!0),o.appendChild(l)}return this.addListener(o,"change",()=>{this.values[e.name]=o.value}),o}if(e.type==="checkbox"){let o=document.createElement("input");return o.type="checkbox",o.className="blex-form__checkbox",o.name=e.name,o.checked=!!this.values[e.name],o.setAttribute("data-testid",i),this.addListener(o,"change",()=>{this.values[e.name]=o.checked}),o}let s=document.createElement("input");return s.type=e.type,s.className="blex-form__input",s.name=e.name,s.placeholder=e.placeholder??"",s.required=e.required??!1,s.value=String(this.values[e.name]??""),s.setAttribute("data-testid",i),this.addListener(s,"input",()=>{this.values[e.name]=e.type==="number"?Number(s.value):s.value}),s}validate(e){this.errors={};let i=!0;for(let s of e)if(s.required){let o=this.values[s.name];(o===void 0||o===""||o===null)&&(this.errors[s.name]=`${s.label} is required`,i=!1)}return i}};function $a(){return new Ts}G();var Ds=class extends I{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,{title:i,steps:s}=t.data,o=document.createElement("div");if(o.className="blex-progress",o.setAttribute("data-testid",`blex-progress-${t.id}`),i){let r=document.createElement("div");r.className="blex-progress__title",r.textContent=i,o.appendChild(r)}let a=document.createElement("div");a.className="blex-progress__steps",s.forEach((r,l)=>{let c=document.createElement("div");c.className=`blex-progress__step blex-progress__step--${r.status}`,c.setAttribute("data-testid",`blex-progress-step-${l}`);let d=document.createElement("span");d.className="blex-progress__indicator",r.status==="completed"?d.textContent="\u2713":r.status==="active"?d.textContent="\u25CF":d.textContent="\u25CB",c.appendChild(d);let h=document.createElement("div");h.className="blex-progress__content";let u=document.createElement("span");if(u.className="blex-progress__label",u.textContent=r.label,h.appendChild(u),r.description){let f=document.createElement("span");f.className="blex-progress__description",f.textContent=r.description,h.appendChild(f)}c.appendChild(h),a.appendChild(c)}),o.appendChild(a),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function Ha(){return new Ds}G();var Od={30:"color: #1a1a1a",31:"color: #ef4444",32:"color: #22c55e",33:"color: #f59e0b",34:"color: #3b82f6",35:"color: #a855f7",36:"color: #06b6d4",37:"color: #e5e5e5",1:"font-weight: bold",0:""},Ls=class extends I{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,{command:i,output:s,exitCode:o,collapsed:a}=t.data,r=document.createElement("div");if(r.className="blex-terminal",r.setAttribute("data-testid",`blex-terminal-${t.id}`),o!==void 0&&r.setAttribute("data-exit-code",String(o)),i){let d=document.createElement("div");d.className="blex-terminal__command",d.setAttribute("data-testid",`blex-terminal-command-${t.id}`);let h=document.createElement("span");h.className="blex-terminal__prompt",h.textContent="$ ",d.appendChild(h);let u=document.createElement("span");u.textContent=i,d.appendChild(u),r.appendChild(d)}let l=document.createElement("pre");if(l.className="blex-terminal__output",l.setAttribute("data-testid",`blex-terminal-output-${t.id}`),l.innerHTML=this.parseAnsi(s),a){l.style.display="none";let d=document.createElement("button");d.className="blex-terminal__toggle",d.textContent="Show output",d.setAttribute("data-testid",`blex-terminal-toggle-${t.id}`),this.addListener(d,"click",()=>{let h=l.style.display==="none";l.style.display=h?"block":"none",d.textContent=h?"Hide output":"Show output"}),r.appendChild(d)}if(r.appendChild(l),o!==void 0){let d=document.createElement("span");d.className=`blex-terminal__exit-code blex-terminal__exit-code--${o===0?"success":"error"}`,d.textContent=`exit ${o}`,d.setAttribute("data-testid",`blex-terminal-exit-${t.id}`),r.appendChild(d)}let c=document.createElement("button");c.className="blex-terminal__copy",c.textContent="Copy",c.setAttribute("data-testid",`blex-terminal-copy-${t.id}`),this.addListener(c,"click",()=>{navigator.clipboard?.writeText(s),this.emit({blockId:t.id,type:"click",payload:{action:"copy"},serialized:`Copied terminal output${i?` from: ${i}`:""}`,summary:`Copied output${i?`: ${i}`:""}`,icon:"\u{1F4CB}",immediate:!0})}),r.appendChild(c),e.appendChild(r),e.setAttribute("data-blex-ready","true")}parseAnsi(t){return t.replace(/\x1b\[([0-9;]*)m/g,(e,i)=>{if(i==="0"||i==="")return"</span>";let s=i.split(";").map(o=>Od[o]||"").filter(Boolean).join("; ");return s?`<span style="${s}">`:""})}};function Va(){return new Ls}G();var Is=class extends I{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,{events:i,title:s}=t.data,o=document.createElement("div");if(o.className="blex-timeline",o.setAttribute("data-testid",`blex-timeline-${t.id}`),s){let r=document.createElement("div");r.className="blex-timeline__title",r.textContent=s,o.appendChild(r)}let a=document.createElement("div");a.className="blex-timeline__list",i.forEach((r,l)=>{let c=document.createElement("div");c.className="blex-timeline__item",c.setAttribute("data-testid",`blex-timeline-item-${l}`);let d=document.createElement("span");d.className="blex-timeline__dot",r.color&&(d.style.backgroundColor=r.color),r.icon&&(d.textContent=r.icon),c.appendChild(d);let h=document.createElement("div");h.className="blex-timeline__content";let u=document.createElement("time");u.className="blex-timeline__time",u.textContent=r.timestamp,h.appendChild(u);let f=document.createElement("div");if(f.className="blex-timeline__event-title",f.textContent=r.title,h.appendChild(f),r.description){let m=document.createElement("div");m.className="blex-timeline__description",m.textContent=r.description,h.appendChild(m)}c.appendChild(h),a.appendChild(c)}),o.appendChild(a),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function ja(){return new Is}G();var Ps=class extends I{constructor(){super(...arguments);this.childHandles=[]}render(e,i){this.container=i,this.buildLayout(e)}update(e){if(this.container){for(let i of this.childHandles)i.destroy();this.childHandles=[],this.container.innerHTML="",this.buildLayout(e)}}async buildLayout(e){let i=this.container,{type:s,columns:o,gap:a,children:r}=e.data,l=document.createElement("div");l.className="blex-layout",l.setAttribute("data-testid",`blex-layout-${e.id}`),s==="grid"?(l.style.display="grid",l.style.gridTemplateColumns=`repeat(${o??2}, 1fr)`):l.style.display="flex",a&&(l.style.gap=a),i.appendChild(l);for(let c of r){let d=document.createElement("div");d.className="blex-layout__child",l.appendChild(d);let h=await ti(c,d);this.childHandles.push(h)}i.setAttribute("data-blex-ready","true")}destroy(){for(let e of this.childHandles)e.destroy();this.childHandles=[],super.destroy()}};function Wa(){return new Ps}function Hc(){it("confirm",xa),it("poll",_a),it("status",ya),it("metric",va),it("image",Oa),it("svg",Ra),it("table",Na),it("code",Ba),it("diff",za),it("file-tree",Fa),it("form",$a),it("progress",Ha),it("terminal",Va),it("timeline",ja),it("layout",Wa),Bt("mermaid",async()=>{let{createMermaidRenderer:t}=await Promise.resolve().then(()=>(Ya(),Ua));return t}),Bt("chart",async()=>{let{createChartRenderer:t}=await Promise.resolve().then(()=>(Ec(),kc));return t}),Bt("kanban",async()=>{let{createKanbanRenderer:t}=await Promise.resolve().then(()=>(Sc(),Mc));return t}),Bt("calendar",async()=>{let{createCalendarRenderer:t}=await Promise.resolve().then(()=>(Pc(),Ic));return t}),Bt("gallery",async()=>{let{createGalleryRenderer:t}=await Promise.resolve().then(()=>(Rc(),Oc));return t}),Bt("embed",async()=>{let{createEmbedRenderer:t}=await Promise.resolve().then(()=>(zc(),Bc));return t}),Bt("branch",async()=>{let{createBranchRenderer:t}=await Promise.resolve().then(()=>($c(),Fc));return t});let n=["confirm","poll","status","metric","image","svg","table","code","diff","file-tree","form","progress","terminal","timeline","layout","mermaid","chart","kanban","calendar","gallery","embed","branch"];for(let t of n)la(t)}Hc();return sd(um);})();
719
+ ${d}`,summary:`Submitted${s?`: ${s}`:` form (${h} fields)`}`,icon:"\u{1F4CB}",immediate:!0})}else this.container.innerHTML="",this.buildForm(e)}),s){let c=document.createElement("div");c.className="blex-form__title",c.textContent=s,r.appendChild(c)}for(let c of o){let d=document.createElement("div");d.className="blex-form__field";let h=document.createElement("label");h.className="blex-form__label",h.textContent=c.label+(c.required?" *":""),d.appendChild(h);let u=this.createInput(c);if(d.appendChild(u),this.errors[c.name]){let f=document.createElement("span");f.className="blex-form__error",f.textContent=this.errors[c.name],d.appendChild(f)}r.appendChild(d)}let l=document.createElement("button");l.type="submit",l.className="blex-form__submit",l.textContent=a??"Submit",l.setAttribute("data-testid",`blex-form-submit-${e.id}`),r.appendChild(l),i.appendChild(r)}createInput(e){let i=`blex-form-field-${e.name}`;if(e.type==="textarea"){let o=document.createElement("textarea");return o.className="blex-form__input",o.name=e.name,o.placeholder=e.placeholder??"",o.required=e.required??!1,o.value=String(this.values[e.name]??""),o.setAttribute("data-testid",i),this.addListener(o,"input",()=>{this.values[e.name]=o.value}),o}if(e.type==="select"){let o=document.createElement("select");o.className="blex-form__input",o.name=e.name,o.required=e.required??!1,o.setAttribute("data-testid",i);let a=document.createElement("option");a.value="",a.textContent=e.placeholder??"Select...",o.appendChild(a);for(let r of e.options??[]){let l=document.createElement("option");l.value=r,l.textContent=r,this.values[e.name]===r&&(l.selected=!0),o.appendChild(l)}return this.addListener(o,"change",()=>{this.values[e.name]=o.value}),o}if(e.type==="checkbox"){let o=document.createElement("input");return o.type="checkbox",o.className="blex-form__checkbox",o.name=e.name,o.checked=!!this.values[e.name],o.setAttribute("data-testid",i),this.addListener(o,"change",()=>{this.values[e.name]=o.checked}),o}let s=document.createElement("input");return s.type=e.type,s.className="blex-form__input",s.name=e.name,s.placeholder=e.placeholder??"",s.required=e.required??!1,s.value=String(this.values[e.name]??""),s.setAttribute("data-testid",i),this.addListener(s,"input",()=>{this.values[e.name]=e.type==="number"?Number(s.value):s.value}),s}validate(e){this.errors={};let i=!0;for(let s of e)if(s.required){let o=this.values[s.name];(o===void 0||o===""||o===null)&&(this.errors[s.name]=`${s.label} is required`,i=!1)}return i}};function $a(){return new Ts}G();var Ds=class extends I{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,{title:i,steps:s}=t.data,o=document.createElement("div");if(o.className="blex-progress",o.setAttribute("data-testid",`blex-progress-${t.id}`),i){let r=document.createElement("div");r.className="blex-progress__title",r.textContent=i,o.appendChild(r)}let a=document.createElement("div");a.className="blex-progress__steps",s.forEach((r,l)=>{let c=document.createElement("div");c.className=`blex-progress__step blex-progress__step--${r.status}`,c.setAttribute("data-testid",`blex-progress-step-${l}`);let d=document.createElement("span");d.className="blex-progress__indicator",r.status==="completed"?d.textContent="\u2713":r.status==="active"?d.textContent="\u25CF":d.textContent="\u25CB",c.appendChild(d);let h=document.createElement("div");h.className="blex-progress__content";let u=document.createElement("span");if(u.className="blex-progress__label",u.textContent=r.label,h.appendChild(u),r.description){let f=document.createElement("span");f.className="blex-progress__description",f.textContent=r.description,h.appendChild(f)}c.appendChild(h),a.appendChild(c)}),o.appendChild(a),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function Ha(){return new Ds}G();var Od={30:"color: #1a1a1a",31:"color: #ef4444",32:"color: #22c55e",33:"color: #f59e0b",34:"color: #3b82f6",35:"color: #a855f7",36:"color: #06b6d4",37:"color: #e5e5e5",1:"font-weight: bold",0:""},Ls=class extends I{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,{command:i,output:s,exitCode:o,collapsed:a}=t.data,r=document.createElement("div");if(r.className="blex-terminal",r.setAttribute("data-testid",`blex-terminal-${t.id}`),o!==void 0&&r.setAttribute("data-exit-code",String(o)),i){let d=document.createElement("div");d.className="blex-terminal__command",d.setAttribute("data-testid",`blex-terminal-command-${t.id}`);let h=document.createElement("span");h.className="blex-terminal__prompt",h.textContent="$ ",d.appendChild(h);let u=document.createElement("span");u.textContent=i,d.appendChild(u),r.appendChild(d)}let l=document.createElement("pre");if(l.className="blex-terminal__output",l.setAttribute("data-testid",`blex-terminal-output-${t.id}`),l.innerHTML=this.parseAnsi(s),a){l.style.display="none";let d=document.createElement("button");d.className="blex-terminal__toggle",d.textContent="Show output",d.setAttribute("data-testid",`blex-terminal-toggle-${t.id}`),this.addListener(d,"click",()=>{let h=l.style.display==="none";l.style.display=h?"block":"none",d.textContent=h?"Hide output":"Show output"}),r.appendChild(d)}if(r.appendChild(l),o!==void 0){let d=document.createElement("span");d.className=`blex-terminal__exit-code blex-terminal__exit-code--${o===0?"success":"error"}`,d.textContent=`exit ${o}`,d.setAttribute("data-testid",`blex-terminal-exit-${t.id}`),r.appendChild(d)}let c=document.createElement("button");c.className="blex-terminal__copy",c.textContent="Copy",c.setAttribute("data-testid",`blex-terminal-copy-${t.id}`),this.addListener(c,"click",()=>{navigator.clipboard?.writeText(s),this.emit({blockId:t.id,type:"click",payload:{action:"copy"},serialized:`Copied terminal output${i?` from: ${i}`:""}`,summary:`Copied output${i?`: ${i}`:""}`,icon:"\u{1F4CB}",immediate:!0})}),r.appendChild(c),e.appendChild(r),e.setAttribute("data-blex-ready","true")}parseAnsi(t){return t.replace(/\x1b\[([0-9;]*)m/g,(e,i)=>{if(i==="0"||i==="")return"</span>";let s=i.split(";").map(o=>Od[o]||"").filter(Boolean).join("; ");return s?`<span style="${s}">`:""})}};function Va(){return new Ls}G();var Is=class extends I{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,{events:i,title:s}=t.data,o=document.createElement("div");if(o.className="blex-timeline",o.setAttribute("data-testid",`blex-timeline-${t.id}`),s){let r=document.createElement("div");r.className="blex-timeline__title",r.textContent=s,o.appendChild(r)}let a=document.createElement("div");a.className="blex-timeline__list",i.forEach((r,l)=>{let c=document.createElement("div");c.className="blex-timeline__item",c.setAttribute("data-testid",`blex-timeline-item-${l}`);let d=document.createElement("span");d.className="blex-timeline__dot",r.color&&(d.style.backgroundColor=r.color),r.icon&&(d.textContent=r.icon),c.appendChild(d);let h=document.createElement("div");h.className="blex-timeline__content";let u=document.createElement("time");u.className="blex-timeline__time",u.textContent=r.timestamp,h.appendChild(u);let f=document.createElement("div");if(f.className="blex-timeline__event-title",f.textContent=r.title,h.appendChild(f),r.description){let m=document.createElement("div");m.className="blex-timeline__description",m.textContent=r.description,h.appendChild(m)}c.appendChild(h),a.appendChild(c)}),o.appendChild(a),e.appendChild(o),e.setAttribute("data-blex-ready","true")}};function Wa(){return new Is}G();var Ps=class extends I{constructor(){super(...arguments);this.childHandles=[]}render(e,i){this.container=i,this.buildLayout(e)}update(e){if(this.container){for(let i of this.childHandles)i.destroy();this.childHandles=[],this.container.innerHTML="",this.buildLayout(e)}}async buildLayout(e){let i=this.container,{type:s,columns:o,gap:a,children:r}=e.data,l=document.createElement("div");l.className="blex-layout",l.setAttribute("data-testid",`blex-layout-${e.id}`),s==="grid"?(l.style.display="grid",l.style.gridTemplateColumns=`repeat(${o??2}, 1fr)`):l.style.display="flex",a&&(l.style.gap=a),i.appendChild(l);for(let c of r){let d=document.createElement("div");d.className="blex-layout__child",l.appendChild(d);let h=await ti(c,d);this.childHandles.push(h)}i.setAttribute("data-blex-ready","true")}destroy(){for(let e of this.childHandles)e.destroy();this.childHandles=[],super.destroy()}};function ja(){return new Ps}function Hc(){it("confirm",xa),it("poll",_a),it("status",ya),it("metric",va),it("image",Oa),it("svg",Ra),it("table",Na),it("code",Ba),it("diff",za),it("file-tree",Fa),it("form",$a),it("progress",Ha),it("terminal",Va),it("timeline",Wa),it("layout",ja),Bt("mermaid",async()=>{let{createMermaidRenderer:t}=await Promise.resolve().then(()=>(Ya(),Ua));return t}),Bt("chart",async()=>{let{createChartRenderer:t}=await Promise.resolve().then(()=>(Ec(),kc));return t}),Bt("kanban",async()=>{let{createKanbanRenderer:t}=await Promise.resolve().then(()=>(Mc(),Sc));return t}),Bt("calendar",async()=>{let{createCalendarRenderer:t}=await Promise.resolve().then(()=>(Pc(),Ic));return t}),Bt("gallery",async()=>{let{createGalleryRenderer:t}=await Promise.resolve().then(()=>(Rc(),Oc));return t}),Bt("embed",async()=>{let{createEmbedRenderer:t}=await Promise.resolve().then(()=>(zc(),Bc));return t}),Bt("branch",async()=>{let{createBranchRenderer:t}=await Promise.resolve().then(()=>($c(),Fc));return t});let n=["confirm","poll","status","metric","image","svg","table","code","diff","file-tree","form","progress","terminal","timeline","layout","mermaid","chart","kanban","calendar","gallery","embed","branch"];for(let t of n)la(t)}Hc();return sd(um);})();
714
720
  /*! Bundled license information:
715
721
 
716
722
  @kurkle/color/dist/color.esm.js: