-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (23 loc) · 289 KB
/
Copy pathindex.js
File metadata and controls
23 lines (23 loc) · 289 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var Mm=Object.defineProperty;var Dm=($t,rt,Zt)=>rt in $t?Mm($t,rt,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):$t[rt]=Zt;var P=($t,rt,Zt)=>Dm($t,typeof rt!="symbol"?rt+"":rt,Zt);(function(){"use strict";const $t=window.Vue;function rt(){return window.panel}function Zt(){return rt().api}function Ma(){return rt().app}function Ii(){return Ma().$library}const{computed:Pm,customRef:Tm,defineAsyncComponent:Sm,defineComponent:Cm,effectScope:Om,getCurrentInstance:Lm,getCurrentScope:Am,h:Rm,inject:Fm,isProxy:Em,isReactive:Im,isReadonly:$m,isRef:zm,isShallow:Bm,markRaw:Nm,nextTick:Wm,onActivated:Hm,onBeforeMount:Vm,onBeforeUnmount:Ym,onBeforeUpdate:jm,onDeactivated:qm,onErrorCaptured:Um,onMounted:Xm,onRenderTracked:Gm,onRenderTriggered:Qm,onScopeDispose:Km,onServerPrefetch:Zm,onUnmounted:Jm,onUpdated:tp,provide:ep,proxyRefs:sp,reactive:ip,readonly:np,ref:rp,shallowReactive:ap,shallowReadonly:op,shallowRef:lp,toRaw:cp,toRef:hp,toRefs:dp,triggerRef:up,unref:fp,useAttrs:gp,useCssModule:mp,useCssVars:pp,useListeners:bp,useSlots:_p,watch:yp,watchEffect:xp,watchPostEffect:wp,watchSyncEffect:vp}=$t,Da={props:{initialTab:{type:String,default:"pagevisits"},tabs:{type:Array,default:()=>[]}},data(){return{tab:""}},computed:{tabsWithLinks(){return this.tabs.map(s=>({...s,click:()=>this.selectTab(s.name)}))}},watch:{initialTab(s){s&&this.selectTab(s)}},mounted(){this.selectTab()},methods:{getStoredTab(){try{return localStorage.getItem("ss-tabs-menu")}catch{return null}},storeTab(s){try{localStorage.setItem("ss-tabs-menu",s)}catch{}},selectTab(s){const t=this.tabs.map(i=>i.name),e=s||this.getStoredTab()||this.initialTab||t[0];this.tab=t.includes(e)?e:t[0],this.updateBreadcrumb(),this.storeTab(this.tab)},updateBreadcrumb(){var e;const s=rt(),t=((e=this.tabs.find(i=>i.name===this.tab))==null?void 0:e.label)||this.tab;s.view.breadcrumb[0].label=t}}};function et(s,t,e,i,n,r,a,o){var l=typeof s=="function"?s.options:s;return t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),{exports:s,options:l}}const Pa={mixins:[Da],props:{timePeriod:{type:String,default:"Monthly"},timeFormat:{type:String,default:"MMM YYYY"},timeframes:{type:Array,default:[]},initialViewPeriods:{type:Number,default:-1},dismissDisclaimer:{type:Boolean,default:!1}},data(){return{}},computed:{dateFrom(){var s;return(s=this.$refs.timespan)==null?void 0:s.dateFrom},dateTo(){var s;return(s=this.$refs.timespan)==null?void 0:s.dateTo}}};var Ta=function(){var t=this,e=t._self._c;return e("k-panel-inside",{staticClass:"k-simplestats-view"},[e("k-simplestats-disclaimer",{attrs:{visible:!t.dismissDisclaimer}}),e("k-header",{staticClass:"k-simplestats-view-header",scopedSlots:t._u([{key:"buttons",fn:function(){return[e("k-simplestats-timespan",{ref:"timespan",attrs:{dateChoices:t.timeframes,"time-period":t.timePeriod,"time-format":t.timeFormat,"initial-view-periods":t.initialViewPeriods}})]},proxy:!0}])},[t._v(" "+t._s(t.$t("simplestats.view"))+" ")]),e("k-tabs",{attrs:{tab:t.tab,tabs:t.tabsWithLinks}}),t.tab==="pagevisits"?e("k-simplestats-visits-view",{attrs:{dateFrom:t.dateFrom,dateTo:t.dateTo,path:"pagestats"}}):t.tab==="visitordevices"?e("k-simplestats-devices-view",{attrs:{dateFrom:t.dateFrom,dateTo:t.dateTo,path:"devicestats"}}):t.tab==="referers"?e("k-simplestats-referrers-view",{attrs:{dateFrom:t.dateFrom,dateTo:t.dateTo,path:"refererstats"}}):t.tab==="information"?e("k-simplestats-info-view"):e("k-empty",{attrs:{layout:"cards",text:t.$t("simplestats.view.error")}}),e("div",{attrs:{id:"chart-default-color-getter"}})],1)},Sa=[],Ca=et(Pa,Ta,Sa);const Oa=Ca.exports,ce={props:{path:{type:String,required:!0},dateFrom:String,dateTo:String},data(){return{isLoading:!0,isProcessing:!1,error:""}},mounted(){this.load()},watch:{dateFrom:"reload",dateTo:"reload"},methods:{reload(){this.load(!0)},dateQueryString(s="?"){return!this.dateFrom||!this.dateTo?"":`${s}dateFrom=${this.dateFrom}&dateTo=${this.dateTo}`},async load(s=!1){s||(this.isLoading=!0),this.isProcessing=!0,this.error="";try{const e=await Zt().get(`simplestats/${this.path}${this.dateQueryString()}`);this.loadData(e)}catch(t){this.handleError(t)}finally{this.isLoading=!1,this.isProcessing=!1}},handleError(s){var i;const t=(s==null?void 0:s.message)||"Unknown error";if(this.error=t,(i=this.$store)!=null&&i.dispatch){this.$store.dispatch("notification/error",t);return}rt().error(t,!0)}}},La={mixins:[ce],props:{currentItem:{default:-1,type:Number}},data(){return{charts:{visitsOverTime:{data:[],labels:[]},pageVisitsOverTime:{data:[],labels:[]},languagesOverTime:{data:[],labels:[]},globalLanguages:{data:[],labels:[]}},table:{rows:[],columns:{}},languagesAreEnabled:!1}},computed:{sortedPageVisitsOverTime(){return[...this.charts.pageVisitsOverTime.data].sort((s,t)=>s.ss_uid<t.ss_uid?-1:s.ss_uid>t.ss_uid?1:0)}},methods:{loadData(s){Object.entries({visitsOverTime:["visitsovertimedata","chartperiodlabels"],pageVisitsOverTime:["pagevisitsovertimedata","chartperiodlabels"],languagesOverTime:["languagesovertimedata","chartperiodlabels"],globalLanguages:["globallanguagesdata","chartlanguageslabels"]}).forEach(([e,[i,n]])=>{this.charts[e].data=s[i]||[],this.charts[e].labels=s[n]||[]}),this.table.rows=s.pagestatsdata||[],this.table.columns=s.pagestatslabels||{},this.languagesAreEnabled=!!s.languagesAreEnabled},openDrawer(s){var n;const t=rt(),e=this.table.rows[s]??null;this.table.rows[s+1],this.table.rows[s-1];const i={title:this.$t("simplestats.visits.pagestats")+": "+((n=e.title)==null?void 0:n.text)+" ("+e.uid+")",size:"huge",uid:e.uid,dateFrom:this.$props.dateFrom,dateTo:this.$props.dateTo,next:this.onNext,prev:this.onPrev};e&&(t.drawer.isOpen&&t.drawer.history.clear(),t.drawer.open({component:"k-simplestats-pagestats-drawer",props:i}),this.currentItem=s)},onRowClick(s){var t;(t=s==null?void 0:s.row)!=null&&t.uid&&this.openDrawer(s.rowIndex)},onNext(){this.openDrawer(this.currentItem+1)},onPrev(){this.openDrawer(this.currentItem-1)}}};var Aa=function(){var t=this,e=t._self._c;return e("k-grid",{staticStyle:{"column-gap":"var(--spacing-8)"},attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Bar",height:"150",download:"Site_Visits.png",label:t.$t("simplestats.visits.visitsovertime"),"chart-data":t.charts.visitsOverTime.data,"chart-labels":t.charts.visitsOverTime.labels,"x-title":t.$t("simplestats.chart.time"),"y-title":t.$t("simplestats.chart.visits"),"x-time-axis":!0,"y-visits-axis":!0}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Line",height:"450",download:"Site_PageVisits.png",label:t.$t("simplestats.visits.pagevisitsovertime"),"chart-data":t.sortedPageVisitsOverTime,"chart-labels":t.charts.pageVisitsOverTime.labels,"x-title":t.$t("simplestats.chart.time"),"y-title":t.$t("simplestats.chart.visits"),stacked:!0,"auto-colorize":!0,"x-time-axis":!0,"y-visits-axis":!0}})],1),t.languagesAreEnabled?e("k-column",{attrs:{width:"2/3"}},[e("k-simplestats-chart",{attrs:{type:"Line",height:"250",download:"Site_LanguagesOverTime.png",label:t.$t("simplestats.visits.languagesovertime"),"chart-data":t.charts.languagesOverTime.data,"chart-labels":t.charts.languagesOverTime.labels,"x-title":t.$t("simplestats.chart.time"),"y-title":t.$t("simplestats.chart.visits"),stacked:!0,"auto-colorize":!0,"x-time-axis":!0,"y-visits-axis":!0}})],1):t._e(),t.languagesAreEnabled?e("k-column",{attrs:{width:"1/3"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"242",download:"Site_LanguagePopularity.png",label:t.$t("simplestats.visits.globallanguages"),"chart-data":t.charts.globalLanguages.data,"chart-labels":t.charts.globalLanguages.labels,"auto-colorize":!0}})],1):t._e(),e("k-column",[e("k-simplestats-filter-table",{attrs:{label:t.$t("simplestats.visits.visitedpages"),rows:t.table.rows,columns:t.table.columns},on:{row:t.onRowClick}})],1)],1)},Ra=[],Fa=et(La,Aa,Ra);const Ea=Fa.exports,Ia={mixins:[ce],data(){return{charts:{devices:{data:[],labels:[]},browsers:{data:[],labels:[]},systems:{data:[],labels:[]},devicesOverTime:{data:[],labels:[]}}}},methods:{loadData(s){Object.entries({devices:["devicesdata","deviceslabels"],browsers:["enginesdata","engineslabels"],systems:["systemsdata","systemslabels"],devicesOverTime:["devicesovertime","chartperiodlabels"]}).forEach(([e,[i,n]])=>{this.charts[e].data=s[i]||[],this.charts[e].labels=s[n]||[]})}}};var $a=function(){var t=this,e=t._self._c;return e("k-grid",{staticStyle:{"column-gap":"var(--spacing-8)"},attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/3"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"200",download:"Site_Devices.png",label:t.$t("simplestats.devices.visitordevices"),"chart-data":t.charts.devices.data,"chart-labels":t.charts.devices.labels,"auto-colorize":!0}})],1),e("k-column",{attrs:{width:"1/3"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"200",download:"Site_BrowserEngines.png",label:t.$t("simplestats.devices.browserengines"),"chart-data":t.charts.browsers.data,"chart-labels":t.charts.browsers.labels,"auto-colorize":!0}})],1),e("k-column",{attrs:{width:"1/3"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"200",download:"Site_OperatingSystems.png",label:t.$t("simplestats.devices.oses"),"chart-data":t.charts.systems.data,"chart-labels":t.charts.systems.labels,"auto-colorize":!0}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Line",height:"300",download:"Site_DevicesEvolution.png",label:t.$t("simplestats.devices.devicehistory"),"chart-data":t.charts.devicesOverTime.data,"chart-labels":t.charts.devicesOverTime.labels,"x-title":t.$t("simplestats.chart.time"),"y-title":t.$t("simplestats.chart.devicehistory"),stacked:!0,"auto-colorize":!0,"x-time-axis":!0,"y-visits-axis":!0}})],1)],1)},za=[],Ba=et(Ia,$a,za);const Na=Ba.exports,Wa={mixins:[ce],data(){return{charts:{byDomain:{data:[],labels:[]},byMedium:{data:[],labels:[]},byMediumOverTime:{data:[],labels:[]}},table:{rows:[],columns:{}}}},methods:{loadData(s){Object.entries({byDomain:["referersbydomaindata","referersbydomainlabels"],byMedium:["referersbymediumdata","referersbymediumlabels"],byMediumOverTime:["referersbymediumovertimedata","chartperiodlabels"]}).forEach(([e,[i,n]])=>{this.charts[e].data=s[i]||[],this.charts[e].labels=s[n]||[]}),this.table.rows=s.refererstabledata||[],this.table.columns=s.refererstablelabels||{}}}};var Ha=function(){var t=this,e=t._self._c;return e("k-grid",{staticStyle:{"column-gap":"var(--spacing-8)"},attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/2"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"200",download:"Site_ReferrersByMedium.png",label:t.$t("simplestats.referers.referersbymedium"),"chart-data":t.charts.byMedium.data,"chart-labels":t.charts.byMedium.labels,"auto-colorize":!0}})],1),e("k-column",{attrs:{width:"1/2"}},[e("k-simplestats-chart",{attrs:{type:"Pie",height:"200",download:"Site_ReferrersByDomain.png",label:t.$t("simplestats.referers.referersbydomain"),"chart-data":t.charts.byDomain.data,"chart-labels":t.charts.byDomain.labels,"auto-colorize":!0}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Line",height:"300",download:"Site_ReferersEvolution.png",label:t.$t("simplestats.referers.referersovertime"),"chart-data":t.charts.byMediumOverTime.data,"chart-labels":t.charts.byMediumOverTime.labels,"y-title":t.$t("simplestats.chart.hitspermedium"),stacked:!0,"auto-colorize":!0,"x-time-axis":!0,"y-visits-axis":!0}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-filter-table",{attrs:{label:t.$t("simplestats.referers.allreferers"),rows:t.table.rows,columns:t.table.columns}})],1)],1)},Va=[],Ya=et(Wa,Ha,Va);const ja=Ya.exports,qa={};var Ua=function(){var t=this,e=t._self._c;return e("k-grid",{attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/2"}},[e("k-simplestats-info-config",{attrs:{path:"configinfo"}})],1),e("k-column",{attrs:{width:"1/2"}},[e("k-simplestats-info-database")],1),e("k-column",{attrs:{width:"1/1"}},[e("k-line-field"),e("br"),e("k-simplestats-info-testers")],1),e("k-column",{attrs:{width:"1/1"}},[e("k-line-field"),e("br"),e("k-simplestats-info-visitors",{attrs:{path:"visitors"}})],1)],1)},Xa=[],Ga=et(qa,Ua,Xa);const Qa=Ga.exports,Ka={mixins:[ce],data(){return{isLoading:!0,tracking:{period:"",since:"",unique:"",salted:!1,referers:!1,devices:!1,visits:!1,languages:!1,ignoredRoles:[],ignoredPages:[],ignoredTemplates:[]},logging:{file:"",tracking:!1,warnings:!1,verbose:!1}}},computed:{trackingRows(){return[{label:"simplestats.info.config.tracking.period",value:this.tracking.period},{label:"simplestats.info.config.tracking.unique",value:this.uniqueFormatted},{label:"simplestats.info.config.tracking.salted",preview:"k-toggle-field-preview",value:this.tracking.salted},{label:"simplestats.info.config.tracking.features",preview:"k-tags-field-preview",value:this.trackingFeatures},{label:"simplestats.info.config.tracking.ignore.roles",preview:"k-tags-field-preview",value:this.tracking.ignoredRoles},{label:"simplestats.info.config.tracking.ignore.pages",preview:"k-tags-field-preview",value:this.tracking.ignoredPages},{label:"simplestats.info.config.tracking.ignore.templates",preview:"k-tags-field-preview",value:this.tracking.ignoredTemplates}]},loggingRows(){return[{label:"simplestats.info.config.logging.file",preview:"k-files-field-preview",value:this.logging.file},{label:"simplestats.info.config.logging.levels",preview:"k-tags-field-preview",value:this.loggingLevels}]},trackingFeatures(){return[["referers","simplestats.info.config.tracking.feature.referers"],["devices","simplestats.info.config.tracking.feature.devices"],["visits","simplestats.info.config.tracking.feature.visits"],["languages","simplestats.info.config.tracking.feature.languages"]].filter(([s])=>this.tracking[s]).map(([s,t])=>this.$t(t))},loggingLevels(){return[["tracking","simplestats.info.config.logging.level.tracking"],["warnings","simplestats.info.config.logging.level.warnings"],["verbose","simplestats.info.config.logging.level.verbose"]].filter(([s])=>this.logging[s]).map(([s,t])=>this.$t(t))},uniqueFormatted(){const s=this.tracking.unique,t=Math.floor(s%3600/60),e=Math.floor(s/3600);return[e&&`${e}h`,t&&`${t}m`].filter(Boolean).join(" ")||"-"}},methods:{loadData(s){Object.assign(this.tracking,{period:s.period,since:s.since,unique:s.unique,salted:s.salted,referers:s.features.referers,devices:s.features.devices,visits:s.features.visits,languages:s.features.languages,ignoredRoles:s.ignored.roles,ignoredPages:s.ignored.pages,ignoredTemplates:s.ignored.templates}),Object.assign(this.logging,{file:s.logFile,tracking:s.logLevels.tracking,warnings:s.logLevels.warnings,verbose:s.logLevels.verbose})}}};var Za=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-fieldset"},[e("k-grid",{attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/1"}},[e("k-headline-field",{attrs:{label:t.$t("simplestats.info.config.headline")}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-info-table",{attrs:{label:t.$t("simplestats.info.config.tracking.label"),rows:t.trackingRows}}),!t.isLoading&&!t.tracking.salted?[e("br"),e("k-box",{attrs:{theme:"negative",text:t.$t("simplestats.info.config.tracking.unsalted.note")}})]:t._e()],2),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-info-table",{attrs:{label:t.$t("simplestats.info.config.logging.label"),rows:t.loggingRows}})],1)],1)],1)},Ja=[],to=et(Ka,Za,Ja);const eo=to.exports,so={data(){return{database:{history:[],historyLabels:{},version:"undefined",softwareVersion:"unknown",location:"",size:"",spanFrom:"",spanTo:"",timeframes:-1},requirements:{passed:!0,message:"unknown"},upgrade:{required:!1,consent:!1,isUpgrading:!1,resultMessage:null,resultTheme:""}}},created(){this.loadDbInfo(),this.loadRequirements()},computed:{dbInfoRows(){return[{label:"simplestats.info.database.info.file",preview:"k-files-field-preview",value:this.database.location},{label:"simplestats.info.database.info.size",value:this.database.size,format:this.niceSize},{label:"simplestats.info.database.info.version.db",value:this.database.version},{label:"simplestats.info.database.info.version.sw",value:this.database.softwareVersion},{label:"simplestats.info.database.info.span.from",preview:"k-date-field-preview",value:this.database.spanFrom},{label:"simplestats.info.database.info.span.to",preview:"k-date-field-preview",value:this.database.spanTo},{label:"simplestats.info.database.info.span.periods",value:this.database.timeframes}]},dbHistory(){return Object.fromEntries(Object.entries(this.database.historyLabels).map(([s,t])=>[s,{...t,mobile:!0}]))}},methods:{async loadDbInfo(){const s=await this.$api.get("simplestats/database/info");Object.assign(this.database,{history:s.dbHistory,historyLabels:s.dbHistoryLabels,version:s.dbVersion,softwareVersion:s.softwareDbVersion,location:s.databaseLocation,size:s.databaseSize,spanFrom:s.databaseSpanFrom,spanTo:s.databaseSpanTo,timeframes:s.databaseTimeframes}),this.upgrade.required=s.upgradeRequired},async loadRequirements(){const s=await this.$api.get("simplestats/database/requirements");this.requirements.message=s.dbRequirements,this.requirements.passed=s.dbRequirementsPassed},async requestUpgrade(){this.upgrade.isUpgrading=!0;try{const s=await this.$api.get("simplestats/database/upgrade");this.upgrade.resultTheme=s.status?"positive":"negative",this.upgrade.resultMessage=s.message}finally{this.upgrade.isUpgrading=!1}},niceSize(s){if(s=Number(s),!Number.isFinite(s))return"?? B";const t=["B","kB","MB","GB","TB","PB"],e=s<0?"-":"";if(e&&(s=Math.abs(s)),s<1e3)return`${e}${s} B`;const i=Math.min(Math.floor(Math.log(s)/Math.log(1e3)),t.length-1),n=(s/Math.pow(1e3,i)).toFixed(2);return`${e}${n} ${t[i]}`}}};var io=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-fieldset"},[e("k-grid",{attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/1"}},[e("k-headline-field",{attrs:{label:t.$t("simplestats.info.database.headline")}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-info-table",{attrs:{label:t.$t("simplestats.info.database.info.label"),rows:t.dbInfoRows}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-table",{attrs:{label:t.$t("simplestats.info.database.history.label"),index:!1,rows:t.database.history,columns:t.dbHistory}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-section",{attrs:{label:t.$t("simplestats.info.database.rqmts.label")}},[t.requirements.passed?e("k-box",{attrs:{theme:"text",text:t.$t("simplestats.info.database.rqmts.note.positive")}}):e("k-box",{attrs:{theme:"negative"}},[e("k-text",[e("p",[t._v(t._s(t.$t("simplestats.info.database.rqmts.note.negative")))]),e("k-code",[t._v(t._s(t.requirements.message))])],1)],1)],1)],1),e("k-column",{attrs:{width:"1/1"}},[e("k-section",{attrs:{label:t.$t("simplestats.info.database.upgrade.label")}},[t.upgrade.required?[t.upgrade.resultMessage?e("k-box",{attrs:{html:!0,theme:t.upgrade.resultTheme,text:t.upgrade.resultMessage}}):[e("k-box",{attrs:{html:!0,theme:"negative",text:t.$t("simplestats.info.database.upgrade.note.negative")}}),e("br"),e("k-bar",[e("k-checkbox-input",{attrs:{label:t.$t("simplestats.info.database.upgrade.consent")},model:{value:t.upgrade.consent,callback:function(i){t.$set(t.upgrade,"consent",i)},expression:"upgrade.consent"}}),e("k-button",{attrs:{variant:"filled",disabled:!t.upgrade.consent,icon:t.upgrade.isUpgrading?"loader":null,text:t.$t("simplestats.info.database.upgrade.button")},on:{click:t.requestUpgrade}})],1)]]:e("k-box",{attrs:{theme:"text",text:t.$t("simplestats.info.database.upgrade.note.positive")}})],2)],1)],1)],1)},no=[],ro=et(so,io,no);const ao=ro.exports,oo={data(){const s=new Date,t=new Date,e=new Date,i=new Date;return t.setDate(s.getDate()-30),e.setDate(s.getDate()-365),i.setDate(s.getDate()+365*5),{currentDevice:null,currentUserAgent:"",customUserAgent:"",customDevice:null,refererUrl:"",refererResponse:null,isGenerating:!1,generatorMode:"randommulti",generatorFrom:t.toISOString(),generatorTo:s.toISOString(),generatorConsent:!1,generatorResponse:null,isTesting:!1,tfutilityFrom:e.toISOString(),tfutilityTo:i.toISOString(),tfutilityResponse:null}},created(){this.getCurrentUserAgent()},computed:{hasValidReferer(){return this.refererResponse&&!this.refererResponse.error},refererInfo(){const s=["host","source","medium","url"],t=this.refererResponse||{};return s.map(e=>({field:e,label:`simplestats.info.testers.referer.field.${e}`,value:t[e]||"-"}))},generatorModes(){return[{value:"all",text:this.$t("simplestats.info.testers.generator.mode.all")},{value:"randomsingle",text:this.$t("simplestats.info.testers.generator.mode.randomsingle")},{value:"randommulti",text:this.$t("simplestats.info.testers.generator.mode.randommulti")}]}},watch:{customUserAgent(){this.customDevice=null},refererUrl(){this.refererResponse=null}},methods:{formatDevice(s){return`${s==null?void 0:s.device} - ${s==null?void 0:s.system} - ${s==null?void 0:s.engine}`},async getCurrentUserAgent(){const s=await this.$api.get("simplestats/testers/user-agent");this.currentUserAgent=s.userAgent,this.currentDevice=s.deviceInfo},async testUserAgent(){const s=await this.$api.get("simplestats/testers/user-agent?ua="+encodeURIComponent(this.customUserAgent));this.customDevice=s.deviceInfo},async testReferer(){this.refererResponse=await this.$api.get("simplestats/testers/referer?url="+encodeURIComponent(this.refererUrl))},async generateStats(){if(!this.generatorConsent||this.isGenerating)return;this.isGenerating=!0;const s=Math.floor(new Date(this.generatorFrom).getTime()/1e3),t=Math.floor(new Date(this.generatorTo).getTime()/1e3);try{this.generatorResponse=await this.$api.get(`simplestats/testers/generatestats?from=${s}&to=${t}&mode=${this.generatorMode}`)}finally{this.isGenerating=!1}},async testTimeframeUtility(){if(this.isTesting)return;this.isTesting=!0;const s=Math.floor(new Date(this.tfutilityFrom).getTime()/1e3),t=Math.floor(new Date(this.tfutilityTo).getTime()/1e3);try{this.tfutilityResponse=await this.$api.get(`simplestats/testers/timeframeutility?from=${s}&to=${t}`)}finally{this.isTesting=!1}}}};var lo=function(){var i,n,r,a,o,l,c,h,d;var t=this,e=t._self._c;return e("div",{staticClass:"k-fieldset k-simplestats-info-testers"},[e("k-grid",{attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/1"}},[e("k-headline-field",{attrs:{label:t.$t("simplestats.info.testers.headline")}})],1),e("k-column",{attrs:{width:"1/2"}},[e("k-section",{attrs:{label:t.$t("simplestats.info.testers.device.label")}},[e("div",{staticClass:"k-table"},[e("table",[e("tbody",[e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.device.current.useragent")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true",colspan:"2"}},[e("k-text-field-preview",{attrs:{value:t.currentUserAgent}})],1)]),e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.device.current.detected")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true",colspan:"2"}},[e("k-text-field-preview",{attrs:{value:this.formatDevice(this.currentDevice)}})],1)]),e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.device.custom.useragent")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-text-input",{staticClass:"k-text-field-preview",model:{value:t.customUserAgent,callback:function(u){t.customUserAgent=u},expression:"customUserAgent"}})],1),e("td",{staticClass:"k-table-button",attrs:{"data-mobile":"true"}},[e("k-button",{attrs:{size:"sm",variant:"filled",disabled:!t.customUserAgent,text:t.$t("simplestats.info.testers.button")},on:{click:t.testUserAgent}})],1)]),t.customDevice?e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.device.custom.detected")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true",colspan:"2"}},[e("k-text-field-preview",{attrs:{value:this.formatDevice(this.customDevice)}})],1)]):t._e()])])]),t.customDevice?[e("br"),e("k-box",{attrs:{theme:"info",text:t.$t("simplestats.info.testers.device.note")}})]:t._e()],2),e("k-section",{attrs:{label:t.$t("simplestats.info.testers.referer.label")}},[e("div",{staticClass:"k-table"},[e("table",[e("tbody",[e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.referer.field")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-url-input",{staticClass:"k-text-field-preview",model:{value:t.refererUrl,callback:function(u){t.refererUrl=u},expression:"refererUrl"}})],1),e("td",{staticClass:"k-table-button",attrs:{"data-mobile":"true"}},[e("k-button",{attrs:{size:"sm",variant:"filled",disabled:!t.refererUrl,text:t.$t("simplestats.info.testers.button")},on:{click:t.testReferer}})],1)]),t._l(t.refererInfo,function(u){return t.hasValidReferer?e("tr",{key:u.key},[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t(u.label)))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true",colspan:"2"}},[e("k-text-field-preview",{attrs:{value:u.value}})],1)]):t._e()})],2)])]),(i=t.refererResponse)!=null&&i.error?[e("br"),e("k-box",{attrs:{theme:"negative",text:t.refererResponse.error}})]:t._e()],2)],1),e("k-column",{attrs:{width:"1/2"}},[e("k-section",{attrs:{label:t.$t("simplestats.info.testers.generator.label")}},[e("div",{staticClass:"k-table"},[e("table",[e("tbody",[e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.generator.mode")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-select-input",{attrs:{options:t.generatorModes},model:{value:t.generatorMode,callback:function(u){t.generatorMode=u},expression:"generatorMode"}})],1)]),e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.generator.date.from")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-date-input",{model:{value:t.generatorFrom,callback:function(u){t.generatorFrom=u},expression:"generatorFrom"}})],1)]),e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.generator.date.to")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-date-input",{model:{value:t.generatorTo,callback:function(u){t.generatorTo=u},expression:"generatorTo"}})],1)])])])]),e("br"),e("k-bar",[e("k-choice-input",{attrs:{label:t.$t("simplestats.info.testers.generator.consent")},model:{value:t.generatorConsent,callback:function(u){t.generatorConsent=u},expression:"generatorConsent"}}),e("k-button",{attrs:{variant:"filled",disabled:!t.generatorConsent,icon:t.isGenerating?"loader":null,text:t.$t("simplestats.info.testers.generator.button")},on:{click:t.generateStats}})],1),(n=t.generatorResponse)!=null&&n.error||(r=t.generatorResponse)!=null&&r.data?[e("br"),(a=t.generatorResponse)!=null&&a.error?e("k-box",{attrs:{theme:"negative",text:t.generatorResponse.error}}):t._e(),(o=t.generatorResponse)!=null&&o.data?e("k-code",{attrs:{language:"json"}},[t._v(t._s(t.generatorResponse.data))]):t._e()]:t._e()],2),e("k-section",{attrs:{label:t.$t("simplestats.info.testers.tfutility.label")}},[e("div",{staticClass:"k-table"},[e("table",[e("tbody",[e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.generator.date.from")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-date-input",{model:{value:t.tfutilityFrom,callback:function(u){t.tfutilityFrom=u},expression:"tfutilityFrom"}})],1)]),e("tr",[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t("simplestats.info.testers.generator.date.to")))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e("k-date-input",{model:{value:t.tfutilityTo,callback:function(u){t.tfutilityTo=u},expression:"tfutilityTo"}})],1)])])])]),e("br"),e("k-bar",[e("k-button",{attrs:{variant:"filled",icon:t.isTesting?"loader":null,text:t.$t("simplestats.info.testers.tfutility.button")},on:{click:t.testTimeframeUtility}})],1),(l=t.tfutilityResponse)!=null&&l.error||(c=t.tfutilityResponse)!=null&&c.data?[e("br"),(h=t.tfutilityResponse)!=null&&h.error?e("k-box",{attrs:{theme:"negative",text:t.tfutilityResponse.error}}):t._e(),(d=t.tfutilityResponse)!=null&&d.data?e("k-code",{attrs:{language:"json"}},[t._v(t._s(t.tfutilityResponse.data))]):t._e()]:t._e()],2)],1)],1)],1)},co=[],ho=et(oo,lo,co);const uo=ho.exports,fo={mixins:[ce],data(){return{isLoading:!0,rows:[],columns:{}}},methods:{loadData(s){this.columns=s.columns,this.rows=s.rows}}};var go=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-fieldset"},[e("k-grid",{attrs:{variant:"columns"}},[e("k-column",{attrs:{width:"1/1"}},[e("k-headline-field",{attrs:{label:t.$t("simplestats.info.visitors.headline")}})],1),e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-filter-table",{attrs:{label:t.$t("simplestats.info.visitors.label"),rows:t.rows,columns:t.columns}}),e("br"),e("k-box",{attrs:{theme:"info",text:t.$t("simplestats.info.visitors.note")}})],1)],1)],1)},mo=[],po=et(fo,go,mo);const bo=po.exports,_o={data(){return{showTotals:!0,showTimeline:!1,showLanguages:!1,size:"medium",statsdata:null,languagesOverTime:[],chartPeriodLabels:[],chartLanguagesLabels:[],languageTotalHits:[],trackedSince:"[unknown]",lastVisited:"[unknown]",totalHits:0,averageHits:0,timespanUnitName:"[unknown]",trackingPeriods:0,uid:null}},computed:{normalizedSize(){return["small","compact"].includes(this.size)?"small":["large","huge"].includes(this.size)?"large":this.size==="tiny"?"tiny":"medium"},languagesAreEnabled(){return this.chartLanguagesLabels.length>1}},created(){this.load().then(s=>{if(!s||!s.statsdata){this.$panel.error({message:"Loading error : wrong data received",details:"While data was received, it was sent in an incorrect format."});return}const t=s.statsdata;Object.assign(this,{label:s.label??s.headline,showFullInfo:s.showFullInfo,showTotals:s.showTotals,showTimeline:s.showTimeline,showLanguages:s.showLanguages,size:s.size,uid:s.uid,statsdata:t,languagesOverTime:t.languagesOverTime,chartPeriodLabels:t.chartperiodlabels,chartLanguagesLabels:t.chartlanguageslabels,languageTotalHits:t.languageTotalHits,trackedSince:t.firstVisited,lastVisited:t.lastVisited,averageHits:t.averageHits,totalHits:t.totalHits,timespanUnitName:t.timespanUnitName,trackingPeriods:t.trackingPeriods})})},methods:{chartHeight(s){const t={timeline:{tiny:120,small:240,medium:260,large:280},languages:{tiny:80,small:185,medium:205,large:225}};return t[s][this.normalizedSize]??t[s].medium},niceDownloadName(s){var t;if((t=this.uid)!=null&&t.length){let e=String(this.uid);return e.replace("/","_"),"Page_"+e+"_"+s+".png"}return"Site_"+s+".png"}}};var yo=function(){var t=this,e=t._self._c;return e("k-section",{attrs:{label:t.label}},[e("k-grid",{attrs:{variant:"columns"}},[t.isLoading?e("k-column",{attrs:{width:"1/1"}},[e("k-empty",[e("k-icon",{attrs:{type:"loader"}}),e("span",[t._v("Fetching data...")])],1)],1):t._e(),t.showTotals&&!t.isLoading?e("k-column",{attrs:{width:"1/1"}},[e("div",{staticClass:"k-stats"},[e("k-stat",{attrs:{label:t.$t("simplestats.visits.visitsovertime"),value:t.totalHits,info:Math.round(t.averageHits)+" "+t.$t("simplestats.visits.per")+" "+t.timespanUnitName,icon:"users",link:"simplestats"}}),t.showFullInfo?e("k-stat",{attrs:{label:"Samples",value:t.trackingPeriods,info:t.$t("simplestats.visits.since")+" "+t.trackedSince,icon:"chart",link:"simplestats"}}):t._e()],1)]):t._e(),t.showTimeline&&!t.isLoading?e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Line",download:t.niceDownloadName("PageVisitsOverTime"),label:t.$t("simplestats.visits.visitsovertime"),"chart-data":t.languagesOverTime,"chart-labels":t.chartPeriodLabels,stacked:t.languagesAreEnabled,"auto-colorize":!0,"x-time-axis":!0,"y-visits-axis":!0,height:t.chartHeight("timeline")}})],1):t._e(),t.languagesAreEnabled&&t.showLanguages&&!t.isLoading?e("k-column",{attrs:{width:"1/1"}},[e("k-simplestats-chart",{attrs:{type:"Pie","chart-data":t.languageTotalHits,"chart-labels":t.chartLanguagesLabels,"chart-options":t.chartOptions,"auto-colorize":!0,fill:!0,"show-legend":t.languagesAreEnabled,height:t.chartHeight("languages"),download:t.niceDownloadName("GlobalLanguageVisits"),label:t.$t("simplestats.visits.globallanguages")}})],1):t._e()],1)],1)},xo=[],wo=et(_o,yo,xo);const We=wo.exports;We.render;var vo=et({extends:We,mixins:["k-pages-section","k-drawer"],emits:["close","next","prev","submit"],props:{uid:{type:String,required:!0},next:{type:Object},prev:{type:Object}},render(s){const t=()=>{this.$emit("close")},e=()=>[We.render.call(this,s)],i={attrs:{...this.$attrs,...this.$props,options:[this.$props.prev?{title:"Previous",icon:"angle-left",click:()=>{this.$emit("prev"),this.$props.prev instanceof Function&&this.$props.prev()}}:{},this.$props.next?{title:"Next",icon:"angle-right",click:()=>{this.$emit("next"),this.$props.next instanceof Function&&this.$props.next()}}:{}]},on:{submit:t},scopedSlots:{default:e}};return s("k-drawer",i)},methods:{async load(s){this.isProcessing=!0,s||(this.isLoading=!0);try{return await this.$api.get("simplestats/onepagestats/"+this.uid+(this.$attrs.dateFrom?"?dateFrom="+this.$attrs.dateFrom+"&dateTo="+this.$attrs.dateTo:""))}catch(t){this.error=t.message}finally{this.isProcessing=!1,this.isLoading=!1}return null}}},null,null);const ko=vo.exports;/*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/function kt(){}const Mo=(function(){let s=0;return function(){return s++}})();function I(s){return s===null||typeof s>"u"}function W(s){if(Array.isArray&&Array.isArray(s))return!0;const t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function A(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}const X=s=>(typeof s=="number"||s instanceof Number)&&isFinite(+s);function lt(s,t){return X(s)?s:t}function O(s,t){return typeof s>"u"?t:s}const Do=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:s/t,$i=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function N(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function $(s,t,e,i){let n,r,a;if(W(s))for(r=s.length,n=0;n<r;n++)t.call(e,s[n],n);else if(A(s))for(a=Object.keys(s),r=a.length,n=0;n<r;n++)t.call(e,s[a[n]],a[n])}function He(s,t){let e,i,n,r;if(!s||!t||s.length!==t.length)return!1;for(e=0,i=s.length;e<i;++e)if(n=s[e],r=t[e],n.datasetIndex!==r.datasetIndex||n.index!==r.index)return!1;return!0}function Ve(s){if(W(s))return s.map(Ve);if(A(s)){const t=Object.create(null),e=Object.keys(s),i=e.length;let n=0;for(;n<i;++n)t[e[n]]=Ve(s[e[n]]);return t}return s}function zi(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function Po(s,t,e,i){if(!zi(s))return;const n=t[s],r=e[s];A(n)&&A(r)?he(n,r,i):t[s]=Ve(r)}function he(s,t,e){const i=W(t)?t:[t],n=i.length;if(!A(s))return s;e=e||{};const r=e.merger||Po;for(let a=0;a<n;++a){if(t=i[a],!A(t))continue;const o=Object.keys(t);for(let l=0,c=o.length;l<c;++l)r(o[l],s,t,e)}return s}function de(s,t){return he(s,t,{merger:To})}function To(s,t,e){if(!zi(s))return;const i=t[s],n=e[s];A(i)&&A(n)?de(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=Ve(n))}const Bi={"":s=>s,x:s=>s.x,y:s=>s.y};function St(s,t){return(Bi[t]||(Bi[t]=So(t)))(s)}function So(s){const t=Co(s);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function Co(s){const t=s.split("."),e=[];let i="";for(const n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Os(s){return s.charAt(0).toUpperCase()+s.slice(1)}const ct=s=>typeof s<"u",Ct=s=>typeof s=="function",Ni=(s,t)=>{if(s.size!==t.size)return!1;for(const e of s)if(!t.has(e))return!1;return!0};function Oo(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const H=Math.PI,B=2*H,Lo=B+H,Ye=Number.POSITIVE_INFINITY,Ao=H/180,j=H/2,ue=H/4,Wi=H*2/3,ht=Math.log10,bt=Math.sign;function Hi(s){const t=Math.round(s);s=fe(s,t,s/1e3)?t:s;const e=Math.pow(10,Math.floor(ht(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Ro(s){const t=[],e=Math.sqrt(s);let i;for(i=1;i<e;i++)s%i===0&&(t.push(i),t.push(s/i));return e===(e|0)&&t.push(e),t.sort((n,r)=>n-r).pop(),t}function Jt(s){return!isNaN(parseFloat(s))&&isFinite(s)}function fe(s,t,e){return Math.abs(s-t)<e}function Fo(s,t){const e=Math.round(s);return e-t<=s&&e+t>=s}function Vi(s,t,e){let i,n,r;for(i=0,n=s.length;i<n;i++)r=s[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function ft(s){return s*(H/180)}function Ls(s){return s*(180/H)}function Yi(s){if(!X(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function ji(s,t){const e=t.x-s.x,i=t.y-s.y,n=Math.sqrt(e*e+i*i);let r=Math.atan2(i,e);return r<-.5*H&&(r+=B),{angle:r,distance:n}}function As(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function Eo(s,t){return(s-t+Lo)%B-H}function ot(s){return(s%B+B)%B}function ge(s,t,e,i){const n=ot(s),r=ot(t),a=ot(e),o=ot(r-n),l=ot(a-n),c=ot(n-r),h=ot(n-a);return n===r||n===a||i&&r===a||o>l&&c<h}function st(s,t,e){return Math.max(t,Math.min(e,s))}function Io(s){return st(s,-32768,32767)}function Mt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function Rs(s,t,e){e=e||(a=>s[a]<t);let i=s.length-1,n=0,r;for(;i-n>1;)r=n+i>>1,e(r)?n=r:i=r;return{lo:n,hi:i}}const zt=(s,t,e,i)=>Rs(s,e,i?n=>s[n][t]<=e:n=>s[n][t]<e),$o=(s,t,e)=>Rs(s,e,i=>s[i][t]>=e);function zo(s,t,e){let i=0,n=s.length;for(;i<n&&s[i]<t;)i++;for(;n>i&&s[n-1]>e;)n--;return i>0||n<s.length?s.slice(i,n):s}const qi=["push","pop","shift","splice","unshift"];function Bo(s,t){if(s._chartjs){s._chartjs.listeners.push(t);return}Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),qi.forEach(e=>{const i="_onData"+Os(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...r){const a=n.apply(this,r);return s._chartjs.listeners.forEach(o=>{typeof o[i]=="function"&&o[i](...r)}),a}})})}function Ui(s,t){const e=s._chartjs;if(!e)return;const i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(qi.forEach(r=>{delete s[r]}),delete s._chartjs)}function Xi(s){const t=new Set;let e,i;for(e=0,i=s.length;e<i;++e)t.add(s[e]);return t.size===i?s:Array.from(t)}const Gi=(function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame})();function Qi(s,t,e){const i=e||(a=>Array.prototype.slice.call(a));let n=!1,r=[];return function(...a){r=i(a),n||(n=!0,Gi.call(window,()=>{n=!1,s.apply(t,r)}))}}function No(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}const Fs=s=>s==="start"?"left":s==="end"?"right":"center",it=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Wo=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;function Ki(s,t,e){const i=t.length;let n=0,r=i;if(s._sorted){const{iScale:a,_parsed:o}=s,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=st(Math.min(zt(o,a.axis,c).lo,e?i:zt(t,l,a.getPixelForValue(c)).lo),0,i-1)),u?r=st(Math.max(zt(o,a.axis,h,!0).hi+1,e?0:zt(t,l,a.getPixelForValue(h),!0).hi+1),n,i)-n:r=i-n}return{start:n,count:r}}function Zi(s){const{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;const r=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),r}const je=s=>s===0||s===1,Ji=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*B/e)),tn=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*B/e)+1,me={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*j)+1,easeOutSine:s=>Math.sin(s*j),easeInOutSine:s=>-.5*(Math.cos(H*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>je(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>je(s)?s:Ji(s,.075,.3),easeOutElastic:s=>je(s)?s:tn(s,.075,.3),easeInOutElastic(s){return je(s)?s:s<.5?.5*Ji(s*2,.1125,.45):.5+.5*tn(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-me.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?me.easeInBounce(s*2)*.5:me.easeOutBounce(s*2-1)*.5+.5};/*!
* @kurkle/color v0.2.1
* https://github.com/kurkle/color#readme
* (c) 2022 Jukka Kurkela
* Released under the MIT License
*/function pe(s){return s+.5|0}const Ot=(s,t,e)=>Math.max(Math.min(s,e),t);function be(s){return Ot(pe(s*2.55),0,255)}function Lt(s){return Ot(pe(s*255),0,255)}function Dt(s){return Ot(pe(s/2.55)/100,0,1)}function en(s){return Ot(pe(s*100),0,100)}const dt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Es=[..."0123456789ABCDEF"],Ho=s=>Es[s&15],Vo=s=>Es[(s&240)>>4]+Es[s&15],qe=s=>(s&240)>>4===(s&15),Yo=s=>qe(s.r)&&qe(s.g)&&qe(s.b)&&qe(s.a);function jo(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&dt[s[1]]*17,g:255&dt[s[2]]*17,b:255&dt[s[3]]*17,a:t===5?dt[s[4]]*17:255}:(t===7||t===9)&&(e={r:dt[s[1]]<<4|dt[s[2]],g:dt[s[3]]<<4|dt[s[4]],b:dt[s[5]]<<4|dt[s[6]],a:t===9?dt[s[7]]<<4|dt[s[8]]:255})),e}const qo=(s,t)=>s<255?t(s):"";function Uo(s){var t=Yo(s)?Ho:Vo;return s?"#"+t(s.r)+t(s.g)+t(s.b)+qo(s.a,t):void 0}const Xo=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function sn(s,t,e){const i=t*Math.min(e,1-e),n=(r,a=(r+s/30)%12)=>e-i*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function Go(s,t,e){const i=(n,r=(n+s/60)%6)=>e-e*t*Math.max(Math.min(r,4-r,1),0);return[i(5),i(3),i(1)]}function Qo(s,t,e){const i=sn(s,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function Ko(s,t,e,i,n){return s===n?(t-e)/i+(t<e?6:0):t===n?(e-s)/i+2:(s-t)/i+4}function Is(s){const e=s.r/255,i=s.g/255,n=s.b/255,r=Math.max(e,i,n),a=Math.min(e,i,n),o=(r+a)/2;let l,c,h;return r!==a&&(h=r-a,c=o>.5?h/(2-r-a):h/(r+a),l=Ko(e,i,n,h,r),l=l*60+.5),[l|0,c||0,o]}function $s(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(Lt)}function zs(s,t,e){return $s(sn,s,t,e)}function Zo(s,t,e){return $s(Qo,s,t,e)}function Jo(s,t,e){return $s(Go,s,t,e)}function nn(s){return(s%360+360)%360}function tl(s){const t=Xo.exec(s);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?be(+t[5]):Lt(+t[5]));const n=nn(+t[2]),r=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=Zo(n,r,a):t[1]==="hsv"?i=Jo(n,r,a):i=zs(n,r,a),{r:i[0],g:i[1],b:i[2],a:e}}function el(s,t){var e=Is(s);e[0]=nn(e[0]+t),e=zs(e),s.r=e[0],s.g=e[1],s.b=e[2]}function sl(s){if(!s)return;const t=Is(s),e=t[0],i=en(t[1]),n=en(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Dt(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}const rn={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"},an={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function il(){const s={},t=Object.keys(an),e=Object.keys(rn);let i,n,r,a,o;for(i=0;i<t.length;i++){for(a=o=t[i],n=0;n<e.length;n++)r=e[n],o=o.replace(r,rn[r]);r=parseInt(an[a],16),s[o]=[r>>16&255,r>>8&255,r&255]}return s}let Ue;function nl(s){Ue||(Ue=il(),Ue.transparent=[0,0,0,0]);const t=Ue[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const rl=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function al(s){const t=rl.exec(s);let e=255,i,n,r;if(t){if(t[7]!==i){const a=+t[7];e=t[8]?be(a):Ot(a*255,0,255)}return i=+t[1],n=+t[3],r=+t[5],i=255&(t[2]?be(i):Ot(i,0,255)),n=255&(t[4]?be(n):Ot(n,0,255)),r=255&(t[6]?be(r):Ot(r,0,255)),{r:i,g:n,b:r,a:e}}}function ol(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${Dt(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}const Bs=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,te=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function ll(s,t,e){const i=te(Dt(s.r)),n=te(Dt(s.g)),r=te(Dt(s.b));return{r:Lt(Bs(i+e*(te(Dt(t.r))-i))),g:Lt(Bs(n+e*(te(Dt(t.g))-n))),b:Lt(Bs(r+e*(te(Dt(t.b))-r))),a:s.a+e*(t.a-s.a)}}function Xe(s,t,e){if(s){let i=Is(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=zs(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function on(s,t){return s&&Object.assign(t||{},s)}function ln(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=Lt(s[3]))):(t=on(s,{r:0,g:0,b:0,a:1}),t.a=Lt(t.a)),t}function cl(s){return s.charAt(0)==="r"?al(s):tl(s)}class Ge{constructor(t){if(t instanceof Ge)return t;const e=typeof t;let i;e==="object"?i=ln(t):e==="string"&&(i=jo(t)||nl(t)||cl(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=on(this._rgb);return t&&(t.a=Dt(t.a)),t}set rgb(t){this._rgb=ln(t)}rgbString(){return this._valid?ol(this._rgb):void 0}hexString(){return this._valid?Uo(this._rgb):void 0}hslString(){return this._valid?sl(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let r;const a=e===r?.5:e,o=2*a-1,l=i.a-n.a,c=((o*l===-1?o:(o+l)/(1+o*l))+1)/2;r=1-c,i.r=255&c*i.r+r*n.r+.5,i.g=255&c*i.g+r*n.g+.5,i.b=255&c*i.b+r*n.b+.5,i.a=a*i.a+(1-a)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=ll(this._rgb,t._rgb,e)),this}clone(){return new Ge(this.rgb)}alpha(t){return this._rgb.a=Lt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=pe(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xe(this._rgb,2,t),this}darken(t){return Xe(this._rgb,2,-t),this}saturate(t){return Xe(this._rgb,1,t),this}desaturate(t){return Xe(this._rgb,1,-t),this}rotate(t){return el(this._rgb,t),this}}function cn(s){return new Ge(s)}function hn(s){if(s&&typeof s=="object"){const t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function dn(s){return hn(s)?s:cn(s)}function Ns(s){return hn(s)?s:cn(s).saturate(.5).darken(.1).hexString()}const Bt=Object.create(null),Ws=Object.create(null);function _e(s,t){if(!t)return s;const e=t.split(".");for(let i=0,n=e.length;i<n;++i){const r=e[i];s=s[r]||(s[r]=Object.create(null))}return s}function Hs(s,t,e){return typeof t=="string"?he(_e(s,t),e):he(_e(s,""),t)}class hl{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=e=>e.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=(e,i)=>Ns(i.backgroundColor),this.hoverBorderColor=(e,i)=>Ns(i.borderColor),this.hoverColor=(e,i)=>Ns(i.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)}set(t,e){return Hs(this,t,e)}get(t){return _e(this,t)}describe(t,e){return Hs(Ws,t,e)}override(t,e){return Hs(Bt,t,e)}route(t,e,i,n){const r=_e(this,t),a=_e(this,i),o="_"+e;Object.defineProperties(r,{[o]:{value:r[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[o],c=a[n];return A(l)?Object.assign({},c,l):O(l,c)},set(l){this[o]=l}}})}}var R=new hl({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function dl(s){return!s||I(s.size)||I(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function Qe(s,t,e,i,n){let r=t[n];return r||(r=t[n]=s.measureText(n).width,e.push(n)),r>i&&(i=r),i}function ul(s,t,e,i){i=i||{};let n=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},r=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let a=0;const o=e.length;let l,c,h,d,u;for(l=0;l<o;l++)if(d=e[l],d!=null&&W(d)!==!0)a=Qe(s,n,r,a,d);else if(W(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!W(u)&&(a=Qe(s,n,r,a,u));s.restore();const f=r.length/2;if(f>e.length){for(l=0;l<f;l++)delete n[r[l]];r.splice(0,f)}return a}function Nt(s,t,e){const i=s.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*i)/i+n}function un(s,t){t=t||s.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,s.width,s.height),t.restore()}function Vs(s,t,e,i){fn(s,t,e,i,null)}function fn(s,t,e,i,n){let r,a,o,l,c,h;const d=t.pointStyle,u=t.rotation,f=t.radius;let g=(u||0)*Ao;if(d&&typeof d=="object"&&(r=d.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){s.save(),s.translate(e,i),s.rotate(g),s.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),s.restore();return}if(!(isNaN(f)||f<=0)){switch(s.beginPath(),d){default:n?s.ellipse(e,i,n/2,f,0,0,B):s.arc(e,i,f,0,B),s.closePath();break;case"triangle":s.moveTo(e+Math.sin(g)*f,i-Math.cos(g)*f),g+=Wi,s.lineTo(e+Math.sin(g)*f,i-Math.cos(g)*f),g+=Wi,s.lineTo(e+Math.sin(g)*f,i-Math.cos(g)*f),s.closePath();break;case"rectRounded":c=f*.516,l=f-c,a=Math.cos(g+ue)*l,o=Math.sin(g+ue)*l,s.arc(e-a,i-o,c,g-H,g-j),s.arc(e+o,i-a,c,g-j,g),s.arc(e+a,i+o,c,g,g+j),s.arc(e-o,i+a,c,g+j,g+H),s.closePath();break;case"rect":if(!u){l=Math.SQRT1_2*f,h=n?n/2:l,s.rect(e-h,i-l,2*h,2*l);break}g+=ue;case"rectRot":a=Math.cos(g)*f,o=Math.sin(g)*f,s.moveTo(e-a,i-o),s.lineTo(e+o,i-a),s.lineTo(e+a,i+o),s.lineTo(e-o,i+a),s.closePath();break;case"crossRot":g+=ue;case"cross":a=Math.cos(g)*f,o=Math.sin(g)*f,s.moveTo(e-a,i-o),s.lineTo(e+a,i+o),s.moveTo(e+o,i-a),s.lineTo(e-o,i+a);break;case"star":a=Math.cos(g)*f,o=Math.sin(g)*f,s.moveTo(e-a,i-o),s.lineTo(e+a,i+o),s.moveTo(e+o,i-a),s.lineTo(e-o,i+a),g+=ue,a=Math.cos(g)*f,o=Math.sin(g)*f,s.moveTo(e-a,i-o),s.lineTo(e+a,i+o),s.moveTo(e+o,i-a),s.lineTo(e-o,i+a);break;case"line":a=n?n/2:Math.cos(g)*f,o=Math.sin(g)*f,s.moveTo(e-a,i-o),s.lineTo(e+a,i+o);break;case"dash":s.moveTo(e,i),s.lineTo(e+Math.cos(g)*f,i+Math.sin(g)*f);break}s.fill(),t.borderWidth>0&&s.stroke()}}function ye(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.x<t.right+e&&s.y>t.top-e&&s.y<t.bottom+e}function Ke(s,t){s.save(),s.beginPath(),s.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),s.clip()}function Ze(s){s.restore()}function fl(s,t,e,i,n){if(!t)return s.lineTo(e.x,e.y);if(n==="middle"){const r=(t.x+e.x)/2;s.lineTo(r,t.y),s.lineTo(r,e.y)}else n==="after"!=!!i?s.lineTo(t.x,e.y):s.lineTo(e.x,t.y);s.lineTo(e.x,e.y)}function gl(s,t,e,i){if(!t)return s.lineTo(e.x,e.y);s.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 Wt(s,t,e,i,n,r={}){const a=W(t)?t:[t],o=r.strokeWidth>0&&r.strokeColor!=="";let l,c;for(s.save(),s.font=n.string,ml(s,r),l=0;l<a.length;++l)c=a[l],o&&(r.strokeColor&&(s.strokeStyle=r.strokeColor),I(r.strokeWidth)||(s.lineWidth=r.strokeWidth),s.strokeText(c,e,i,r.maxWidth)),s.fillText(c,e,i,r.maxWidth),pl(s,e,i,c,r),i+=n.lineHeight;s.restore()}function ml(s,t){t.translation&&s.translate(t.translation[0],t.translation[1]),I(t.rotation)||s.rotate(t.rotation),t.color&&(s.fillStyle=t.color),t.textAlign&&(s.textAlign=t.textAlign),t.textBaseline&&(s.textBaseline=t.textBaseline)}function pl(s,t,e,i,n){if(n.strikethrough||n.underline){const r=s.measureText(i),a=t-r.actualBoundingBoxLeft,o=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;s.strokeStyle=s.fillStyle,s.beginPath(),s.lineWidth=n.decorationWidth||2,s.moveTo(a,h),s.lineTo(o,h),s.stroke()}}function xe(s,t){const{x:e,y:i,w:n,h:r,radius:a}=t;s.arc(e+a.topLeft,i+a.topLeft,a.topLeft,-j,H,!0),s.lineTo(e,i+r-a.bottomLeft),s.arc(e+a.bottomLeft,i+r-a.bottomLeft,a.bottomLeft,H,j,!0),s.lineTo(e+n-a.bottomRight,i+r),s.arc(e+n-a.bottomRight,i+r-a.bottomRight,a.bottomRight,j,0,!0),s.lineTo(e+n,i+a.topRight),s.arc(e+n-a.topRight,i+a.topRight,a.topRight,0,-j,!0),s.lineTo(e+a.topLeft,i)}const bl=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),_l=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function yl(s,t){const e=(""+s).match(bl);if(!e||e[1]==="normal")return t*1.2;switch(s=+e[2],e[3]){case"px":return s;case"%":s/=100;break}return t*s}const xl=s=>+s||0;function Ys(s,t){const e={},i=A(t),n=i?Object.keys(t):t,r=A(s)?i?a=>O(s[a],s[t[a]]):a=>s[a]:()=>s;for(const a of n)e[a]=xl(r(a));return e}function gn(s){return Ys(s,{top:"y",right:"x",bottom:"y",left:"x"})}function Ht(s){return Ys(s,["topLeft","topRight","bottomLeft","bottomRight"])}function nt(s){const t=gn(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function J(s,t){s=s||{},t=t||R.font;let e=O(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=O(s.style,t.style);i&&!(""+i).match(_l)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const n={family:O(s.family,t.family),lineHeight:yl(O(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:O(s.weight,t.weight),string:""};return n.string=dl(n),n}function Je(s,t,e,i){let n,r,a;for(n=0,r=s.length;n<r;++n)if(a=s[n],a!==void 0&&a!==void 0)return a}function wl(s,t,e){const{min:i,max:n}=s,r=$i(t,(n-i)/2),a=(o,l)=>e&&o===0?0:o+l;return{min:a(i,-Math.abs(r)),max:a(n,r)}}function At(s,t){return Object.assign(Object.create(s),t)}function js(s,t=[""],e=s,i,n=()=>s[0]){ct(i)||(i=yn("_fallback",s));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:e,_fallback:i,_getTarget:n,override:a=>js([a,...s],t,e,i)};return new Proxy(r,{deleteProperty(a,o){return delete a[o],delete a._keys,delete s[0][o],!0},get(a,o){return pn(a,o,()=>Cl(o,t,s,a))},getOwnPropertyDescriptor(a,o){return Reflect.getOwnPropertyDescriptor(a._scopes[0],o)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(a,o){return xn(a).includes(o)},ownKeys(a){return xn(a)},set(a,o,l){const c=a._storage||(a._storage=n());return a[o]=c[o]=l,delete a._keys,!0}})}function ee(s,t,e,i){const n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:mn(s,i),setContext:r=>ee(s,r,e,i),override:r=>ee(s.override(r),t,e,i)};return new Proxy(n,{deleteProperty(r,a){return delete r[a],delete s[a],!0},get(r,a,o){return pn(r,a,()=>kl(r,a,o))},getOwnPropertyDescriptor(r,a){return r._descriptors.allKeys?Reflect.has(s,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,a)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(r,a){return Reflect.has(s,a)},ownKeys(){return Reflect.ownKeys(s)},set(r,a,o){return s[a]=o,delete r[a],!0}})}function mn(s,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:Ct(e)?e:()=>e,isIndexable:Ct(i)?i:()=>i}}const vl=(s,t)=>s?s+Os(t):t,qs=(s,t)=>A(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function pn(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t))return s[t];const i=e();return s[t]=i,i}function kl(s,t,e){const{_proxy:i,_context:n,_subProxy:r,_descriptors:a}=s;let o=i[t];return Ct(o)&&a.isScriptable(t)&&(o=Ml(t,o,s,e)),W(o)&&o.length&&(o=Dl(t,o,s,a.isIndexable)),qs(t,o)&&(o=ee(o,n,r&&r[t],a)),o}function Ml(s,t,e,i){const{_proxy:n,_context:r,_subProxy:a,_stack:o}=e;if(o.has(s))throw new Error("Recursion detected: "+Array.from(o).join("->")+"->"+s);return o.add(s),t=t(r,a||i),o.delete(s),qs(s,t)&&(t=Us(n._scopes,n,s,t)),t}function Dl(s,t,e,i){const{_proxy:n,_context:r,_subProxy:a,_descriptors:o}=e;if(ct(r.index)&&i(s))t=t[r.index%t.length];else if(A(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Us(c,n,s,h);t.push(ee(d,r,a&&a[s],o))}}return t}function bn(s,t,e){return Ct(s)?s(t,e):s}const Pl=(s,t)=>s===!0?t:typeof s=="string"?St(t,s):void 0;function Tl(s,t,e,i,n){for(const r of t){const a=Pl(e,r);if(a){s.add(a);const o=bn(a._fallback,e,n);if(ct(o)&&o!==e&&o!==i)return o}else if(a===!1&&ct(i)&&e!==i)return null}return!1}function Us(s,t,e,i){const n=t._rootScopes,r=bn(t._fallback,e,i),a=[...s,...n],o=new Set;o.add(i);let l=_n(o,a,e,r||e,i);return l===null||ct(r)&&r!==e&&(l=_n(o,a,r,l,i),l===null)?!1:js(Array.from(o),[""],n,r,()=>Sl(t,e,i))}function _n(s,t,e,i,n){for(;e;)e=Tl(s,t,e,i,n);return e}function Sl(s,t,e){const i=s._getTarget();t in i||(i[t]={});const n=i[t];return W(n)&&A(e)?e:n}function Cl(s,t,e,i){let n;for(const r of t)if(n=yn(vl(r,s),e),ct(n))return qs(s,n)?Us(e,i,s,n):n}function yn(s,t){for(const e of t){if(!e)continue;const i=e[s];if(ct(i))return i}}function xn(s){let t=s._keys;return t||(t=s._keys=Ol(s._scopes)),t}function Ol(s){const t=new Set;for(const e of s)for(const i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function wn(s,t,e,i){const{iScale:n}=s,{key:r="r"}=this._parsing,a=new Array(i);let o,l,c,h;for(o=0,l=i;o<l;++o)c=o+e,h=t[c],a[o]={r:n.parse(St(h,r),c)};return a}const Ll=Number.EPSILON||1e-14,se=(s,t)=>t<s.length&&!s[t].skip&&s[t],vn=s=>s==="x"?"y":"x";function Al(s,t,e,i){const n=s.skip?t:s,r=t,a=e.skip?t:e,o=As(r,n),l=As(a,r);let c=o/(o+l),h=l/(o+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=i*c,u=i*h;return{previous:{x:r.x-d*(a.x-n.x),y:r.y-d*(a.y-n.y)},next:{x:r.x+u*(a.x-n.x),y:r.y+u*(a.y-n.y)}}}function Rl(s,t,e){const i=s.length;let n,r,a,o,l,c=se(s,0);for(let h=0;h<i-1;++h)if(l=c,c=se(s,h+1),!(!l||!c)){if(fe(t[h],0,Ll)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],r=e[h+1]/t[h],o=Math.pow(n,2)+Math.pow(r,2),!(o<=9)&&(a=3/Math.sqrt(o),e[h]=n*a*t[h],e[h+1]=r*a*t[h])}}function Fl(s,t,e="x"){const i=vn(e),n=s.length;let r,a,o,l=se(s,0);for(let c=0;c<n;++c){if(a=o,o=l,l=se(s,c+1),!o)continue;const h=o[e],d=o[i];a&&(r=(h-a[e])/3,o[`cp1${e}`]=h-r,o[`cp1${i}`]=d-r*t[c]),l&&(r=(l[e]-h)/3,o[`cp2${e}`]=h+r,o[`cp2${i}`]=d+r*t[c])}}function El(s,t="x"){const e=vn(t),i=s.length,n=Array(i).fill(0),r=Array(i);let a,o,l,c=se(s,0);for(a=0;a<i;++a)if(o=l,l=c,c=se(s,a+1),!!l){if(c){const h=c[t]-l[t];n[a]=h!==0?(c[e]-l[e])/h:0}r[a]=o?c?bt(n[a-1])!==bt(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}Rl(s,n,r),Fl(s,r,t)}function ts(s,t,e){return Math.max(Math.min(s,e),t)}function Il(s,t){let e,i,n,r,a,o=ye(s[0],t);for(e=0,i=s.length;e<i;++e)a=r,r=o,o=e<i-1&&ye(s[e+1],t),r&&(n=s[e],a&&(n.cp1x=ts(n.cp1x,t.left,t.right),n.cp1y=ts(n.cp1y,t.top,t.bottom)),o&&(n.cp2x=ts(n.cp2x,t.left,t.right),n.cp2y=ts(n.cp2y,t.top,t.bottom)))}function $l(s,t,e,i,n){let r,a,o,l;if(t.spanGaps&&(s=s.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")El(s,n);else{let c=i?s[s.length-1]:s[0];for(r=0,a=s.length;r<a;++r)o=s[r],l=Al(c,o,s[Math.min(r+1,a-(i?0:1))%a],t.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,c=o}t.capBezierPoints&&Il(s,e)}function kn(){return typeof window<"u"&&typeof document<"u"}function Xs(s){let t=s.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function es(s,t,e){let i;return typeof s=="string"?(i=parseInt(s,10),s.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=s,i}const ss=s=>window.getComputedStyle(s,null);function zl(s,t){return ss(s).getPropertyValue(t)}const Bl=["top","right","bottom","left"];function Vt(s,t,e){const i={};e=e?"-"+e:"";for(let n=0;n<4;n++){const r=Bl[n];i[r]=parseFloat(s[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Nl=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);function Wl(s,t){const e=s.touches,i=e&&e.length?e[0]:s,{offsetX:n,offsetY:r}=i;let a=!1,o,l;if(Nl(n,r,s.target))o=n,l=r;else{const c=t.getBoundingClientRect();o=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:o,y:l,box:a}}function Yt(s,t){if("native"in s)return s;const{canvas:e,currentDevicePixelRatio:i}=t,n=ss(e),r=n.boxSizing==="border-box",a=Vt(n,"padding"),o=Vt(n,"border","width"),{x:l,y:c,box:h}=Wl(s,e),d=a.left+(h&&o.left),u=a.top+(h&&o.top);let{width:f,height:g}=t;return r&&(f-=a.width+o.width,g-=a.height+o.height),{x:Math.round((l-d)/f*e.width/i),y:Math.round((c-u)/g*e.height/i)}}function Hl(s,t,e){let i,n;if(t===void 0||e===void 0){const r=Xs(s);if(!r)t=s.clientWidth,e=s.clientHeight;else{const a=r.getBoundingClientRect(),o=ss(r),l=Vt(o,"border","width"),c=Vt(o,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=es(o.maxWidth,r,"clientWidth"),n=es(o.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||Ye,maxHeight:n||Ye}}const Gs=s=>Math.round(s*10)/10;function Vl(s,t,e,i){const n=ss(s),r=Vt(n,"margin"),a=es(n.maxWidth,s,"clientWidth")||Ye,o=es(n.maxHeight,s,"clientHeight")||Ye,l=Hl(s,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const d=Vt(n,"border","width"),u=Vt(n,"padding");c-=u.width+d.width,h-=u.height+d.height}return c=Math.max(0,c-r.width),h=Math.max(0,i?Math.floor(c/i):h-r.height),c=Gs(Math.min(c,a,l.maxWidth)),h=Gs(Math.min(h,o,l.maxHeight)),c&&!h&&(h=Gs(c/2)),{width:c,height:h}}function Mn(s,t,e){const i=t||1,n=Math.floor(s.height*i),r=Math.floor(s.width*i);s.height=n/i,s.width=r/i;const a=s.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${s.height}px`,a.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||a.height!==n||a.width!==r?(s.currentDevicePixelRatio=i,a.height=n,a.width=r,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Yl=(function(){let s=!1;try{const t={get passive(){return s=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return s})();function Dn(s,t){const e=zl(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function jt(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function jl(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function ql(s,t,e,i){const n={x:s.cp2x,y:s.cp2y},r={x:t.cp1x,y:t.cp1y},a=jt(s,n,e),o=jt(n,r,e),l=jt(r,t,e),c=jt(a,o,e),h=jt(o,l,e);return jt(c,h,e)}const Pn=new Map;function Ul(s,t){t=t||{};const e=s+JSON.stringify(t);let i=Pn.get(e);return i||(i=new Intl.NumberFormat(s,t),Pn.set(e,i)),i}function we(s,t,e){return Ul(t,e).format(s)}const Xl=function(s,t){return{x(e){return s+s+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}}},Gl=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}};function ie(s,t,e){return s?Xl(t,e):Gl()}function Tn(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function Sn(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function Cn(s){return s==="angle"?{between:ge,compare:Eo,normalize:ot}:{between:Mt,compare:(t,e)=>t-e,normalize:t=>t}}function On({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function Ql(s,t,e){const{property:i,start:n,end:r}=e,{between:a,normalize:o}=Cn(i),l=t.length;let{start:c,end:h,loop:d}=s,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(o(t[c%l][i]),n,r);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:s.style}}function Ln(s,t,e){if(!e)return[s];const{property:i,start:n,end:r}=e,a=t.length,{compare:o,between:l,normalize:c}=Cn(i),{start:h,end:d,loop:u,style:f}=Ql(s,t,e),g=[];let m=!1,p=null,b,_,y;const w=()=>l(n,y,b)&&o(n,y)!==0,x=()=>o(r,b)===0||l(r,y,b),D=()=>m||w(),M=()=>!m||x();for(let v=h,k=h;v<=d;++v)_=t[v%a],!_.skip&&(b=c(_[i]),b!==y&&(m=l(b,n,r),p===null&&D()&&(p=o(b,n)===0?v:k),p!==null&&M()&&(g.push(On({start:p,end:v,loop:u,count:a,style:f})),p=null),k=v,y=b));return p!==null&&g.push(On({start:p,end:d,loop:u,count:a,style:f})),g}function An(s,t){const e=[],i=s.segments;for(let n=0;n<i.length;n++){const r=Ln(i[n],s.points,t);r.length&&e.push(...r)}return e}function Kl(s,t,e,i){let n=0,r=t-1;if(e&&!i)for(;n<t&&!s[n].skip;)n++;for(;n<t&&s[n].skip;)n++;for(n%=t,e&&(r+=n);r>n&&s[r%t].skip;)r--;return r%=t,{start:n,end:r}}function Zl(s,t,e,i){const n=s.length,r=[];let a=t,o=s[t],l;for(l=t+1;l<=e;++l){const c=s[l%n];c.skip||c.stop?o.skip||(i=!1,r.push({start:t%n,end:(l-1)%n,loop:i}),t=a=c.stop?l:null):(a=l,o.skip&&(t=l)),o=c}return a!==null&&r.push({start:t%n,end:a%n,loop:i}),r}function Jl(s,t){const e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];const r=!!s._loop,{start:a,end:o}=Kl(e,n,r,i);if(i===!0)return Rn(s,[{start:a,end:o,loop:r}],e,t);const l=o<a?o+n:o,c=!!s._fullLoop&&a===0&&o===n-1;return Rn(s,Zl(e,a,l,c),e,t)}function Rn(s,t,e,i){return!i||!i.setContext||!e?t:tc(s,t,e,i)}function tc(s,t,e,i){const n=s._chart.getContext(),r=Fn(s.options),{_datasetIndex:a,options:{spanGaps:o}}=s,l=e.length,c=[];let h=r,d=t[0].start,u=d;function f(g,m,p,b){const _=o?-1:1;if(g!==m){for(g+=l;e[g%l].skip;)g-=_;for(;e[m%l].skip;)m+=_;g%l!==m%l&&(c.push({start:g%l,end:m%l,loop:p,style:b}),h=b,d=m%l)}}for(const g of t){d=o?d:g.start;let m=e[d%l],p;for(u=d+1;u<=g.end;u++){const b=e[u%l];p=Fn(i.setContext(At(n,{type:"segment",p0:m,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),ec(p,h)&&f(d,u-1,g.loop,h),m=b,h=p}d<u-1&&f(d,u-1,g.loop,h)}return c}function Fn(s){return{backgroundColor:s.backgroundColor,borderCapStyle:s.borderCapStyle,borderDash:s.borderDash,borderDashOffset:s.borderDashOffset,borderJoinStyle:s.borderJoinStyle,borderWidth:s.borderWidth,borderColor:s.borderColor}}function ec(s,t){return t&&JSON.stringify(s)!==JSON.stringify(t)}/*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/class sc{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const r=e.listeners[n],a=e.duration;r.forEach(o=>o({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Gi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const r=i.items;let a=r.length-1,o=!1,l;for(;a>=0;--a)l=r[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),o=!0):(r[a]=r[r.length-1],r.pop());o&&(n.draw(),this._notify(n,i,t,"progress")),r.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let 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){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Pt=new sc;const En="transparent",ic={boolean(s,t,e){return e>.5?t:s},color(s,t,e){const i=dn(s||En),n=i.valid&&dn(t||En);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}};class nc{constructor(t,e,i,n){const r=e[i];n=Je([t.to,n,r,t.from]);const a=Je([t.from,r,n]);this._active=!0,this._fn=t.fn||ic[t.type||typeof a],this._easing=me[t.easing]||me.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=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],r=i-this._start,a=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=Je([t.to,e,n,t.from]),this._from=Je([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,r=this._from,a=this._loop,o=this._to;let l;if(this._active=r!==o&&(a||e<i),!this._active){this._target[n]=o,this._notify(!0);return}if(e<0){this._target[n]=r;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(r,o,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let n=0;n<i.length;n++)i[n][e]()}}const rc=["x","y","borderWidth","radius","tension"],ac=["color","borderColor","backgroundColor"];R.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const oc=Object.keys(R.animation);R.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:s=>s!=="onProgress"&&s!=="onComplete"&&s!=="fn"}),R.set("animations",{colors:{type:"color",properties:ac},numbers:{type:"number",properties:rc}}),R.describe("animations",{_fallback:"animation"}),R.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:s=>s|0}}}});class In{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!A(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const n=t[i];if(!A(n))return;const r={};for(const a of oc)r[a]=n[a];(W(n.properties)&&n.properties||[i]).forEach(a=>{(a===i||!e.has(a))&&e.set(a,r)})})}_animateOptions(t,e){const i=e.options,n=cc(t,i);if(!n)return[];const r=this._createAnimations(n,i);return i.$shared&&lc(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,n=[],r=t.$animations||(t.$animations={}),a=Object.keys(e),o=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=r[c];const u=i.get(c);if(d)if(u&&d.active()){d.update(u,h,o);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}r[c]=d=new nc(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Pt.add(this._chart,i),!0}}function lc(s,t){const e=[],i=Object.keys(t);for(let n=0;n<i.length;n++){const r=s[i[n]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function cc(s,t){if(!t)return;let e=s.options;if(!e){s.options=t;return}return e.$shared&&(s.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function $n(s,t){const e=s&&s.options||{},i=e.reverse,n=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:n,end:i?n:r}}function hc(s,t,e){if(e===!1)return!1;const i=$n(s,e),n=$n(t,e);return{top:n.end,right:i.end,bottom:n.start,left:i.start}}function dc(s){let t,e,i,n;return A(s)?(t=s.top,e=s.right,i=s.bottom,n=s.left):t=e=i=n=s,{top:t,right:e,bottom:i,left:n,disabled:s===!1}}function zn(s,t){const e=[],i=s._getSortedDatasetMetas(t);let n,r;for(n=0,r=i.length;n<r;++n)e.push(i[n].index);return e}function Bn(s,t,e,i={}){const n=s.keys,r=i.mode==="single";let a,o,l,c;if(t!==null){for(a=0,o=n.length;a<o;++a){if(l=+n[a],l===e){if(i.all)continue;break}c=s.values[l],X(c)&&(r||t===0||bt(t)===bt(c))&&(t+=c)}return t}}function uc(s){const t=Object.keys(s),e=new Array(t.length);let i,n,r;for(i=0,n=t.length;i<n;++i)r=t[i],e[i]={x:r,y:s[r]};return e}function Nn(s,t){const e=s&&s.options.stacked;return e||e===void 0&&t.stack!==void 0}function fc(s,t,e){return`${s.id}.${t.id}.${e.stack||e.type}`}function gc(s){const{min:t,max:e,minDefined:i,maxDefined:n}=s.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function mc(s,t,e){const i=s[t]||(s[t]={});return i[e]||(i[e]={})}function Wn(s,t,e,i){for(const n of t.getMatchingVisibleMetas(i).reverse()){const r=s[n.index];if(e&&r>0||!e&&r<0)return n.index}return null}function Hn(s,t){const{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:r,vScale:a,index:o}=i,l=r.axis,c=a.axis,h=fc(r,a,i),d=t.length;let u;for(let f=0;f<d;++f){const g=t[f],{[l]:m,[c]:p}=g,b=g._stacks||(g._stacks={});u=b[c]=mc(n,h,m),u[o]=p,u._top=Wn(u,a,!0,i.type),u._bottom=Wn(u,a,!1,i.type)}}function Qs(s,t){const e=s.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function pc(s,t){return At(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function bc(s,t,e){return At(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ve(s,t){const e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(const n of t){const r=n._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e]}}}const Ks=s=>s==="reset"||s==="none",Vn=(s,t)=>t?s:Object.assign({},s),_c=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:zn(e,!0),values:null};class gt{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.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Nn(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&ve(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,r=e.xAxisID=O(i.xAxisID,Qs(t,"x")),a=e.yAxisID=O(i.yAxisID,Qs(t,"y")),o=e.rAxisID=O(i.rAxisID,Qs(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,r,a,o),h=e.vAxisID=n(l,a,r,o);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ui(this._data,this),t._stacked&&ve(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(A(e))this._data=uc(e);else if(i!==e){if(i){Ui(i,this);const n=this._cachedMeta;ve(n),n._parsed=[]}e&&Object.isExtensible(e)&&Bo(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const r=e._stacked;e._stacked=Nn(e.vScale,e),e.stack!==i.stack&&(n=!0,ve(e),e.stack=i.stack),this._resyncElements(t),(n||r!==e._stacked)&&Hn(this,e._parsed)}configure(){const 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){const{_cachedMeta:i,_data:n}=this,{iScale:r,_stacked:a}=i,o=r.axis;let l=t===0&&e===n.length?!0:i._sorted,c=t>0&&i._parsed[t-1],h,d,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{W(n[t])?u=this.parseArrayData(i,n,t,e):A(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);const f=()=>d[o]===null||c&&d[o]<c[o];for(h=0;h<e;++h)i._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);i._sorted=l}a&&Hn(this,u)}parsePrimitiveData(t,e,i,n){const{iScale:r,vScale:a}=t,o=r.axis,l=a.axis,c=r.getLabels(),h=r===a,d=new Array(n);let u,f,g;for(u=0,f=n;u<f;++u)g=u+i,d[u]={[o]:h||r.parse(c[g],g),[l]:a.parse(e[g],g)};return d}parseArrayData(t,e,i,n){const{xScale:r,yScale:a}=t,o=new Array(n);let l,c,h,d;for(l=0,c=n;l<c;++l)h=l+i,d=e[h],o[l]={x:r.parse(d[0],h),y:a.parse(d[1],h)};return o}parseObjectData(t,e,i,n){const{xScale:r,yScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,d,u,f;for(h=0,d=n;h<d;++h)u=h+i,f=e[u],c[h]={x:r.parse(St(f,o),u),y:a.parse(St(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,r=this._cachedMeta,a=e[t.axis],o={keys:zn(n,!0),values:e._stacks[t.axis]};return Bn(o,a,r.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const r=i[e.axis];let a=r===null?NaN:r;const o=n&&i._stacks[e.axis];n&&o&&(n.values=o,a=Bn(n,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,r=i._sorted&&t===i.iScale,a=n.length,o=this._getOtherScale(t),l=_c(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=gc(o);let u,f;function g(){f=n[u];const m=f[o.axis];return!X(f[t.axis])||h>m||d<m}for(u=0;u<a&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),r));++u);if(r){for(u=a-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,r,a;for(n=0,r=e.length;n<r;++n)a=e[n][t.axis],X(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:n?""+n.getLabelForValue(r[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=dc(O(this.options.clip,hc(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],r=e.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||n.length-o,c=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,r,o,l),h=o;h<o+l;++h){const d=n[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,r))}for(h=0;h<a.length;++h)a[h].draw(t,r)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];r=a.$context||(a.$context=bc(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=n.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=pc(this.chart.getContext(),this.index)),r.dataset=n,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}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){const n=e==="active",r=this._cachedDataOpts,a=t+"-"+e,o=r[a],l=this.enableOptionSharing&&ct(i);if(o)return Vn(o,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(R.elements[t]),g=()=>this.getContext(i,n),m=c.resolveNamedOptions(u,f,g,d);return m.$shared&&(m.$shared=l,r[a]=Object.freeze(Vn(m,l))),m}_resolveAnimations(t,e,i){const n=this.chart,r=this._cachedDataOpts,a=`animation-${e}`,o=r[a];if(o)return o;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,i,e))}const c=new In(n,l&&l.animations);return l&&l._cacheable&&(r[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ks(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,r=this.getSharedOptions(i),a=this.includeOptions(e,r)||r!==n;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:a}}updateElement(t,e,i,n){Ks(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Ks(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const r=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];const n=i.length,r=e.length,a=Math.min(r,n);a&&this.parse(0,a),r>n?this._insertElements(n,r-n,t):r<n&&this._removeElements(r,n-r)}_insertElements(t,e,i=!0){const n=this._cachedMeta,r=n.data,a=t+e;let o;const l=c=>{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;o<a;++o)r[o]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&ve(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const 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]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}gt.defaults={},gt.prototype.datasetElementType=null,gt.prototype.dataElementType=null;function yc(s,t){if(!s._cache.$bar){const e=s.getMatchingVisibleMetas(t);let i=[];for(let n=0,r=e.length;n<r;n++)i=i.concat(e[n].controller.getAllParsedValues(s));s._cache.$bar=Xi(i.sort((n,r)=>n-r))}return s._cache.$bar}function xc(s){const t=s.iScale,e=yc(t,s.type);let i=t._length,n,r,a,o;const l=()=>{a===32767||a===-32768||(ct(o)&&(i=Math.min(i,Math.abs(a-o)||i)),o=a)};for(n=0,r=e.length;n<r;++n)a=t.getPixelForValue(e[n]),l();for(o=void 0,n=0,r=t.ticks.length;n<r;++n)a=t.getPixelForTick(n),l();return i}function wc(s,t,e,i){const n=e.barThickness;let r,a;return I(n)?(r=t.min*e.categoryPercentage,a=e.barPercentage):(r=n*i,a=1),{chunk:r/i,ratio:a,start:t.pixels[s]-r/2}}function vc(s,t,e,i){const n=t.pixels,r=n[s];let a=s>0?n[s-1]:null,o=s<n.length-1?n[s+1]:null;const l=e.categoryPercentage;a===null&&(a=r-(o===null?t.end-t.start:o-r)),o===null&&(o=r+r-a);const c=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/i,ratio:e.barPercentage,start:c}}function kc(s,t,e,i){const n=e.parse(s[0],i),r=e.parse(s[1],i),a=Math.min(n,r),o=Math.max(n,r);let l=a,c=o;Math.abs(a)>Math.abs(o)&&(l=o,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:r,min:a,max:o}}function Yn(s,t,e,i){return W(s)?kc(s,t,e,i):t[e.axis]=e.parse(s,i),t}function jn(s,t,e,i){const n=s.iScale,r=s.vScale,a=n.getLabels(),o=n===r,l=[];let c,h,d,u;for(c=e,h=e+i;c<h;++c)u=t[c],d={},d[n.axis]=o||n.parse(a[c],c),l.push(Yn(u,d,r,c));return l}function Zs(s){return s&&s.barStart!==void 0&&s.barEnd!==void 0}function Mc(s,t,e){return s!==0?bt(s):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Dc(s){let t,e,i,n,r;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.base<s.y,e="bottom",i="top"),t?(n="end",r="start"):(n="start",r="end"),{start:e,end:i,reverse:t,top:n,bottom:r}}function Pc(s,t,e,i){let n=t.borderSkipped;const r={};if(!n){s.borderSkipped=r;return}if(n===!0){s.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:o,reverse:l,top:c,bottom:h}=Dc(s);n==="middle"&&e&&(s.enableBorderRadius=!0,(e._top||0)===i?n=c:(e._bottom||0)===i?n=h:(r[qn(h,a,o,l)]=!0,n=c)),r[qn(n,a,o,l)]=!0,s.borderSkipped=r}function qn(s,t,e,i){return i?(s=Tc(s,t,e),s=Un(s,e,t)):s=Un(s,t,e),s}function Tc(s,t,e){return s===t?e:s===e?t:s}function Un(s,t,e){return s==="start"?t:s==="end"?e:s}function Sc(s,{inflateAmount:t},e){s.inflateAmount=t==="auto"?e===1?.33:0:t}class is extends gt{parsePrimitiveData(t,e,i,n){return jn(t,e,i,n)}parseArrayData(t,e,i,n){return jn(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:r,vScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?o:l,h=a.axis==="x"?o:l,d=[];let u,f,g,m;for(u=i,f=i+n;u<f;++u)m=e[u],g={},g[r.axis]=r.parse(St(m,c),u),d.push(Yn(St(m,h),g,a,u));return d}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,r=this.getParsed(t),a=r._custom,o=Zs(a)?"["+a.start+", "+a.end+"]":""+n.getLabelForValue(r[n.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const r=n==="reset",{index:a,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),c=o.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){const g=this.getParsed(f),m=r||I(g[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,h),b=(g._stacks||{})[o.axis],_={horizontal:c,base:m.base,enableBorderRadius:!b||Zs(g._custom)||a===b._top||a===b._bottom,x:c?m.head:p.center,y:c?p.center:m.head,height:c?p.size:Math.abs(m.size),width:c?Math.abs(m.size):p.size};u&&(_.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const y=_.options||t[f].options;Pc(_,y,b,a),Sc(_,y,h.ratio),this.updateElement(t[f],f,_,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter(l=>l.controller.options.grouped),r=i.options.stacked,a=[],o=l=>{const c=l.controller.getParsed(e),h=c&&c[l.vScale.axis];if(I(h)||isNaN(h))return!0};for(const l of n)if(!(e!==void 0&&o(l))&&((r===!1||a.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),r=e!==void 0?n.indexOf(e):-1;return r===-1?n.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let r,a;for(r=0,a=e.data.length;r<a;++r)n.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));const o=t.barThickness;return{min:o||xc(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:n,minBarLength:r}}=this,a=n||0,o=this.getParsed(t),l=o._custom,c=Zs(l);let h=o[e.axis],d=0,u=i?this.applyStack(e,o,i):h,f,g;u!==h&&(d=u-h,u=h),c&&(h=l.barStart,u=l.barEnd-l.barStart,h!==0&&bt(h)!==bt(l.barEnd)&&(d=0),d+=h);const m=!I(n)&&!c?n:d;let p=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?f=e.getPixelForValue(d+u):f=p,g=f-p,Math.abs(g)<r){g=Mc(g,e,a)*r,h===a&&(p-=g/2);const b=e.getPixelForDecimal(0),_=e.getPixelForDecimal(1),y=Math.min(b,_),w=Math.max(b,_);p=Math.max(Math.min(p,w),y),f=p+g}if(p===e.getPixelForValue(a)){const b=bt(g)*e.getLineWidthForValue(a)/2;p+=b,g-=b}return{size:g,base:p,head:f,center:f+g/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,r=n.skipNull,a=O(n.maxBarThickness,1/0);let o,l;if(e.grouped){const c=r?this._getStackCount(t):e.stackCount,h=n.barThickness==="flex"?vc(t,e,n,c):wc(t,e,n,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);o=h.start+h.chunk*d+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let r=0;for(;r<n;++r)this.getParsed(r)[e.axis]!==null&&i[r].draw(this._ctx)}}is.id="bar",is.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},is.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Js extends gt{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const r=super.parsePrimitiveData(t,e,i,n);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+i).radius;return r}parseArrayData(t,e,i,n){const r=super.parseArrayData(t,e,i,n);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=O(o[2],this.resolveDataElementOptions(a+i).radius)}return r}parseObjectData(t,e,i,n){const r=super.parseObjectData(t,e,i,n);for(let a=0;a<r.length;a++){const o=e[i+a];r[a]._custom=O(o&&o.r&&+o.r,this.resolveDataElementOptions(a+i).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let 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){const e=this._cachedMeta,{xScale:i,yScale:n}=e,r=this.getParsed(t),a=i.getLabelForValue(r.x),o=n.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+a+", "+o+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const r=n==="reset",{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,n),h=a.axis,d=o.axis;for(let u=e;u<e+i;u++){const f=t[u],g=!r&&this.getParsed(u),m={},p=m[h]=r?a.getPixelForDecimal(.5):a.getPixelForValue(g[h]),b=m[d]=r?o.getBasePixel():o.getPixelForValue(g[d]);m.skip=isNaN(p)||isNaN(b),c&&(m.options=l||this.resolveDataElementOptions(u,f.active?"active":n),r&&(m.options.radius=0)),this.updateElement(f,u,m,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const r=n.radius;return e!=="active"&&(n.radius=0),n.radius+=O(i&&i._custom,r),n}}Js.id="bubble",Js.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Js.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title(){return""}}}}};function Cc(s,t,e){let i=1,n=1,r=0,a=0;if(t<B){const o=s,l=o+t,c=Math.cos(o),h=Math.sin(o),d=Math.cos(l),u=Math.sin(l),f=(y,w,x)=>ge(y,o,l,!0)?1:Math.max(w,w*e,x,x*e),g=(y,w,x)=>ge(y,o,l,!0)?-1:Math.min(w,w*e,x,x*e),m=f(0,c,d),p=f(j,h,u),b=g(H,c,d),_=g(H+j,h,u);i=(m-b)/2,n=(p-_)/2,r=-(m+b)/2,a=-(p+_)/2}return{ratioX:i,ratioY:n,offsetX:r,offsetY:a}}class ke extends gt{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){const i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let r=l=>+i[l];if(A(i[t])){const{key:l="value"}=this._parsing;r=c=>+St(i[c],l)}let a,o;for(a=t,o=t+e;a<o;++a)n._parsed[a]=r(a)}}_getRotation(){return ft(this.options.rotation-90)}_getCircumference(){return ft(this.options.circumference)}_getRotationExtents(){let t=B,e=-B;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const n=this.chart.getDatasetMeta(i).controller,r=n._getRotation(),a=n._getCircumference();t=Math.min(t,r),e=Math.max(e,r+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,r=n.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(Do(this.options.cutout,o),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:m}=Cc(d,h,l),p=(i.width-a)/u,b=(i.height-a)/f,_=Math.max(Math.min(p,b)/2,0),y=$i(this.options.radius,_),w=Math.max(y*l,0),x=(y-w)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=m*y,n.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*r/B)}updateElements(t,e,i,n){const r=n==="reset",a=this.chart,o=a.chartArea,c=a.options.animation,h=(o.left+o.right)/2,d=(o.top+o.bottom)/2,u=r&&c.animateScale,f=u?0:this.innerRadius,g=u?0:this.outerRadius,{sharedOptions:m,includeOptions:p}=this._getSharedOptions(e,n);let b=this._getRotation(),_;for(_=0;_<e;++_)b+=this._circumference(_,r);for(_=e;_<e+i;++_){const y=this._circumference(_,r),w=t[_],x={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+y,circumference:y,outerRadius:g,innerRadius:f};p&&(x.options=m||this.resolveDataElementOptions(_,w.active?"active":n)),b+=y,this.updateElement(w,_,x,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,n;for(n=0;n<e.length;n++){const r=t._parsed[n];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?B*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],r=we(e._parsed[t],i.options.locale);return{label:n[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,r,a,o,l;if(!t){for(n=0,r=i.data.datasets.length;n<r;++n)if(i.isDatasetVisible(n)){a=i.getDatasetMeta(n),t=a.data,o=a.controller;break}}if(!t)return 0;for(n=0,r=t.length;n<r;++n)l=o.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.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(O(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}ke.id="doughnut",ke.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"},ke.descriptors={_scriptable:s=>s!=="spacing",_indexable:s=>s!=="spacing"},ke.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){const t=s.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=s.legend.options;return t.labels.map((i,n)=>{const a=s.getDatasetMeta(0).controller.getStyle(n);return{text:i,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:e,hidden:!s.getDataVisibility(n),index:n}})}return[]}},onClick(s,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(s){let t=s.label;const e=": "+s.formattedValue;return W(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};class ns extends gt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:r}=e,a=this.chart._animationsDisabled;let{start:o,count:l}=Ki(e,n,a);this._drawStart=o,this._drawCount=l,Zi(e)&&(o=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=n;const 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(n,o,l,t)}updateElements(t,e,i,n){const r=n==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=o.axis,{spanGaps:g,segment:m}=this.options,p=Jt(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||r||n==="none";let _=e>0&&this.getParsed(e-1);for(let y=e;y<e+i;++y){const w=t[y],x=this.getParsed(y),D=b?w:{},M=I(x[f]),v=D[u]=a.getPixelForValue(x[u],y),k=D[f]=r||M?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,x,l):x[f],y);D.skip=isNaN(v)||isNaN(k)||M,D.stop=y>0&&Math.abs(x[u]-_[u])>p,m&&(D.parsed=x,D.raw=c.data[y]),d&&(D.options=h||this.resolveDataElementOptions(y,w.active?"active":n)),b||this.updateElement(w,y,D,n),_=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const r=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,r,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}ns.id="line",ns.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},ns.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class ti extends gt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],r=we(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:r}}parseObjectData(t,e,i,n){return wn.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{const r=this.getParsed(n).r;!isNaN(r)&&this.chart.getDataVisibility(n)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(n/2,0),a=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),o=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,n){const r=n==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*H;let f=u,g;const m=360/this.countVisibleElements();for(g=0;g<e;++g)f+=this._computeAngle(g,n,m);for(g=e;g<e+i;g++){const p=t[g];let b=f,_=f+this._computeAngle(g,n,m),y=a.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=_,r&&(l.animateScale&&(y=0),l.animateRotate&&(b=_=u));const w={x:h,y:d,innerRadius:0,outerRadius:y,startAngle:b,endAngle:_,options:this.resolveDataElementOptions(g,p.active?"active":n)};this.updateElement(p,g,w,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ft(this.resolveDataElementOptions(t,e).angle||i):0}}ti.id="polarArea",ti.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},ti.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){const t=s.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:e}}=s.legend.options;return t.labels.map((i,n)=>{const a=s.getDatasetMeta(0).controller.getStyle(n);return{text:i,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:e,hidden:!s.getDataVisibility(n),index:n}})}return[]}},onClick(s,t,e){e.chart.toggleDataVisibility(t.index),e.chart.update()}},tooltip:{callbacks:{title(){return""},label(s){return s.chart.data.labels[s.dataIndex]+": "+s.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class ei extends ke{}ei.id="pie",ei.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class si extends gt{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return wn.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],r=e.iScale.getLabels();if(i.points=n,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const o={_loop:!0,_fullLoop:r.length===n.length,options:a};this.updateElement(i,void 0,o,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const r=this._cachedMeta.rScale,a=n==="reset";for(let o=e;o<e+i;o++){const l=t[o],c=this.resolveDataElementOptions(o,l.active?"active":n),h=r.getPointPositionForValue(o,this.getParsed(o).r),d=a?r.xCenter:h.x,u=a?r.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,o,f,n)}}}si.id="radar",si.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},si.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class mt{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Jt(this.x)&&Jt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach(r=>{n[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),n}}mt.defaults={},mt.defaultRoutes=void 0;const Xn={values(s){return W(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";const i=this.chart.options.locale;let n,r=s;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),r=Oc(s,e)}const a=ht(Math.abs(r)),o=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:o,maximumFractionDigits:o};return Object.assign(l,this.options.ticks.format),we(s,i,l)},logarithmic(s,t,e){if(s===0)return"0";const i=s/Math.pow(10,Math.floor(ht(s)));return i===1||i===2||i===5?Xn.numeric.call(this,s,t,e):""}};function Oc(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}var rs={formatters:Xn};R.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(s,t)=>t.lineWidth,tickColor:(s,t)=>t.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth: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:rs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),R.route("scale.ticks","color","","color"),R.route("scale.grid","color","","borderColor"),R.route("scale.grid","borderColor","","borderColor"),R.route("scale.title","color","","color"),R.describe("scale",{_fallback:!1,_scriptable:s=>!s.startsWith("before")&&!s.startsWith("after")&&s!=="callback"&&s!=="parser",_indexable:s=>s!=="borderDash"&&s!=="tickBorderDash"}),R.describe("scales",{_fallback:"scale"}),R.describe("scale.ticks",{_scriptable:s=>s!=="backdropPadding"&&s!=="callback",_indexable:s=>s!=="backdropPadding"});function Lc(s,t){const e=s.options.ticks,i=e.maxTicksLimit||Ac(s),n=e.major.enabled?Fc(t):[],r=n.length,a=n[0],o=n[r-1],l=[];if(r>i)return Ec(t,l,n,r/i),l;const c=Rc(n,t,i);if(r>0){let h,d;const u=r>1?Math.round((o-a)/(r-1)):null;for(as(t,l,c,I(u)?0:a-u,a),h=0,d=r-1;h<d;h++)as(t,l,c,n[h],n[h+1]);return as(t,l,c,o,I(u)?t.length:o+u),l}return as(t,l,c),l}function Ac(s){const t=s.options.offset,e=s._tickSize(),i=s._length/e+(t?0:1),n=s._maxLength/e;return Math.floor(Math.min(i,n))}function Rc(s,t,e){const i=Ic(s),n=t.length/e;if(!i)return Math.max(n,1);const r=Ro(i);for(let a=0,o=r.length-1;a<o;a++){const l=r[a];if(l>n)return l}return Math.max(n,1)}function Fc(s){const t=[];let e,i;for(e=0,i=s.length;e<i;e++)s[e].major&&t.push(e);return t}function Ec(s,t,e,i){let n=0,r=e[0],a;for(i=Math.ceil(i),a=0;a<s.length;a++)a===r&&(t.push(s[a]),n++,r=e[n*i])}function as(s,t,e,i,n){const r=O(i,0),a=Math.min(O(n,s.length),s.length);let o=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-i,e=l/Math.floor(l/e)),h=r;h<0;)o++,h=Math.round(r+o*e);for(c=Math.max(r,0);c<a;c++)c===h&&(t.push(s[c]),o++,h=Math.round(r+o*e))}function Ic(s){const t=s.length;let e,i;if(t<2)return!1;for(i=s[0],e=1;e<t;++e)if(s[e]-s[e-1]!==i)return!1;return i}const $c=s=>s==="left"?"right":s==="right"?"left":s,Gn=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e;function Qn(s,t){const e=[],i=s.length/t,n=s.length;let r=0;for(;r<n;r+=i)e.push(s[Math.floor(r)]);return e}function zc(s,t,e){const i=s.ticks.length,n=Math.min(t,i-1),r=s._startPixel,a=s._endPixel,o=1e-6;let l=s.getPixelForTick(n),c;if(!(e&&(i===1?c=Math.max(l-r,a-l):t===0?c=(s.getPixelForTick(1)-l)/2:c=(l-s.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<r-o||l>a+o)))return l}function Bc(s,t){$(s,e=>{const i=e.gc,n=i.length/2;let r;if(n>t){for(r=0;r<n;++r)delete e.data[i[r]];i.splice(0,n)}})}function Me(s){return s.drawTicks?s.tickLength:0}function Kn(s,t){if(!s.display)return 0;const e=J(s.font,t),i=nt(s.padding);return(W(s.text)?s.text.length:1)*e.lineHeight+i.height}function Nc(s,t){return At(s,{scale:t,type:"scale"})}function Wc(s,t,e){return At(s,{tick:e,index:t,type:"tick"})}function Hc(s,t,e){let i=Fs(s);return(e&&t!=="right"||!e&&t==="right")&&(i=$c(i)),i}function Vc(s,t,e,i){const{top:n,left:r,bottom:a,right:o,chart:l}=s,{chartArea:c,scales:h}=l;let d=0,u,f,g;const m=a-n,p=o-r;if(s.isHorizontal()){if(f=it(i,r,o),A(e)){const b=Object.keys(e)[0],_=e[b];g=h[b].getPixelForValue(_)+m-t}else e==="center"?g=(c.bottom+c.top)/2+m-t:g=Gn(s,e,t);u=o-r}else{if(A(e)){const b=Object.keys(e)[0],_=e[b];f=h[b].getPixelForValue(_)-p+t}else e==="center"?f=(c.left+c.right)/2-p+t:f=Gn(s,e,t);g=it(i,a,n),d=e==="left"?-j:j}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}class qt extends mt{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:n}=this;return t=lt(t,Number.POSITIVE_INFINITY),e=lt(e,Number.NEGATIVE_INFINITY),i=lt(i,Number.POSITIVE_INFINITY),n=lt(n,Number.NEGATIVE_INFINITY),{min:lt(t,i),max:lt(e,n),minDefined:X(t),maxDefined:X(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:r}=this.getUserBounds(),a;if(n&&r)return{min:e,max:i};const o=this.getMatchingVisibleMetas();for(let l=0,c=o.length;l<c;++l)a=o[l].controller.getMinMax(this,t),n||(e=Math.min(e,a.min)),r||(i=Math.max(i,a.max));return e=r&&e>i?i:e,i=n&&e>i?e:i,{min:lt(e,lt(i,e)),max:lt(i,lt(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(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){N(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:r,ticks:a}=this.options,o=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=wl(this,r,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o<this.ticks.length;this._convertTicksToLabels(l?Qn(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Lc(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(){N(this.options.afterUpdate,[this])}beforeSetDimensions(){N(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(){N(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),N(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){N(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,r;for(i=0,n=t.length;i<n;i++)r=t[i],r.label=N(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){N(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){N(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,n=e.minRotation||0,r=e.maxRotation;let a=n,o,l,c;if(!this._isVisible()||!e.display||n>=r||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=st(this.chart.width-d,0,this.maxWidth);o=t.offset?this.maxWidth/i:f/(i-1),d+6>o&&(o=f/(i-(t.offset?.5:1)),l=this.maxHeight-Me(t.grid)-e.padding-Kn(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=Ls(Math.min(Math.asin(st((h.highest.height+6)/o,-1,1)),Math.asin(st(l/c,-1,1))-Math.asin(st(u/c,-1,1)))),a=Math.max(n,Math.min(r,a))),this.labelRotation=a}afterCalculateLabelRotation(){N(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){N(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:r}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const l=Kn(n,e.options.font);if(o?(t.width=this.maxWidth,t.height=Me(r)+l):(t.height=this.maxHeight,t.width=Me(r)+l),i.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,g=ft(this.labelRotation),m=Math.cos(g),p=Math.sin(g);if(o){const b=i.mirror?0:p*d.width+m*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=i.mirror?0:m*d.width+p*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,p,m)}}this._handleMargins(),o?(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,n){const{ticks:{align:r,padding:a},position:o}=this.options,l=this.labelRotation!==0,c=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=i*e.height):(u=i*t.height,f=n*e.width):r==="start"?f=e.width:r==="end"?u=t.width:r!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;r==="start"?(h=0,d=t.height):r==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+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(){N(this.options.afterFit,[this])}isHorizontal(){const{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++)I(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Qn(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:n}=this,r=[],a=[];let o=0,l=0,c,h,d,u,f,g,m,p,b,_,y;for(c=0;c<e;++c){if(u=t[c].label,f=this._resolveTickFontOptions(c),i.font=g=f.string,m=n[g]=n[g]||{data:{},gc:[]},p=f.lineHeight,b=_=0,!I(u)&&!W(u))b=Qe(i,m.data,m.gc,b,u),_=p;else if(W(u))for(h=0,d=u.length;h<d;++h)y=u[h],!I(y)&&!W(y)&&(b=Qe(i,m.data,m.gc,b,y),_+=p);r.push(b),a.push(_),o=Math.max(b,o),l=Math.max(_,l)}Bc(n,e);const w=r.indexOf(o),x=a.indexOf(l),D=M=>({width:r[M]||0,height:a[M]||0});return{first:D(0),last:D(e-1),widest:D(w),highest:D(x),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Io(this._alignToPixels?Nt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Wc(this.getContext(),t,i))}return this.$context||(this.$context=Nc(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=ft(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),r=this._getLabelSizes(),a=t.autoSkipPadding||0,o=r?r.widest.width+a:0,l=r?r.highest.height+a:0;return this.isHorizontal()?l*i>o*n?o/i:l/n:l*n<o*i?l/i:o/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:r,position:a}=n,o=r.offset,l=this.isHorizontal(),h=this.ticks.length+(o?1:0),d=Me(r),u=[],f=r.setContext(this.getContext()),g=f.drawBorder?f.borderWidth:0,m=g/2,p=function(C){return Nt(i,C,g)};let b,_,y,w,x,D,M,v,k,S,F,L;if(a==="top")b=p(this.bottom),D=this.bottom-d,v=b-m,S=p(t.top)+m,L=t.bottom;else if(a==="bottom")b=p(this.top),S=t.top,L=p(t.bottom)-m,D=b+m,v=this.top+d;else if(a==="left")b=p(this.right),x=this.right-d,M=b-m,k=p(t.left)+m,F=t.right;else if(a==="right")b=p(this.left),k=t.left,F=p(t.right)-m,x=b+m,M=this.left+d;else if(e==="x"){if(a==="center")b=p((t.top+t.bottom)/2+.5);else if(A(a)){const C=Object.keys(a)[0],Z=a[C];b=p(this.chart.scales[C].getPixelForValue(Z))}S=t.top,L=t.bottom,D=b+m,v=D+d}else if(e==="y"){if(a==="center")b=p((t.left+t.right)/2);else if(A(a)){const C=Object.keys(a)[0],Z=a[C];b=p(this.chart.scales[C].getPixelForValue(Z))}x=b-m,M=x-d,k=t.left,F=t.right}const Y=O(n.ticks.maxTicksLimit,h),tt=Math.max(1,Math.ceil(h/Y));for(_=0;_<h;_+=tt){const C=r.setContext(this.getContext(_)),Z=C.lineWidth,K=C.color,Kt=C.borderDash||[],Ai=C.borderDashOffset,oe=C.tickWidth,Cs=C.tickColor,le=C.tickBorderDash||[],Ne=C.tickBorderDashOffset;y=zc(this,_,o),y!==void 0&&(w=Nt(i,y,Z),l?x=M=k=F=w:D=v=S=L=w,u.push({tx1:x,ty1:D,tx2:M,ty2:v,x1:k,y1:S,x2:F,y2:L,width:Z,color:K,borderDash:Kt,borderDashOffset:Ai,tickWidth:oe,tickColor:Cs,tickBorderDash:le,tickBorderDashOffset:Ne}))}return this._ticksLength=h,this._borderValue=b,u}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:r}=i,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=r,u=Me(i.grid),f=u+h,g=d?-h:f,m=-ft(this.labelRotation),p=[];let b,_,y,w,x,D,M,v,k,S,F,L,Y="middle";if(n==="top")D=this.bottom-g,M=this._getXAxisLabelAlignment();else if(n==="bottom")D=this.top+g,M=this._getXAxisLabelAlignment();else if(n==="left"){const C=this._getYAxisLabelAlignment(u);M=C.textAlign,x=C.x}else if(n==="right"){const C=this._getYAxisLabelAlignment(u);M=C.textAlign,x=C.x}else if(e==="x"){if(n==="center")D=(t.top+t.bottom)/2+f;else if(A(n)){const C=Object.keys(n)[0],Z=n[C];D=this.chart.scales[C].getPixelForValue(Z)+f}M=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")x=(t.left+t.right)/2-f;else if(A(n)){const C=Object.keys(n)[0],Z=n[C];x=this.chart.scales[C].getPixelForValue(Z)}M=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));const tt=this._getLabelSizes();for(b=0,_=o.length;b<_;++b){y=o[b],w=y.label;const C=r.setContext(this.getContext(b));v=this.getPixelForTick(b)+r.labelOffset,k=this._resolveTickFontOptions(b),S=k.lineHeight,F=W(w)?w.length:1;const Z=F/2,K=C.color,Kt=C.textStrokeColor,Ai=C.textStrokeWidth;let oe=M;a?(x=v,M==="inner"&&(b===_-1?oe=this.options.reverse?"left":"right":b===0?oe=this.options.reverse?"right":"left":oe="center"),n==="top"?c==="near"||m!==0?L=-F*S+S/2:c==="center"?L=-tt.highest.height/2-Z*S+S:L=-tt.highest.height+S/2:c==="near"||m!==0?L=S/2:c==="center"?L=tt.highest.height/2-Z*S:L=tt.highest.height-F*S,d&&(L*=-1)):(D=v,L=(1-F)*S/2);let Cs;if(C.showLabelBackdrop){const le=nt(C.backdropPadding),Ne=tt.heights[b],Ri=tt.widths[b];let Fi=D+L-le.top,Ei=x-le.left;switch(Y){case"middle":Fi-=Ne/2;break;case"bottom":Fi-=Ne;break}switch(M){case"center":Ei-=Ri/2;break;case"right":Ei-=Ri;break}Cs={left:Ei,top:Fi,width:Ri+le.width,height:Ne+le.height,color:C.backdropColor}}p.push({rotation:m,label:w,font:k,color:K,strokeColor:Kt,strokeWidth:Ai,textOffset:L,textAlign:oe,textBaseline:Y,translation:[x,D],backdrop:Cs})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ft(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:r}}=this.options,a=this._getLabelSizes(),o=t+r,l=a.widest.width;let c,h;return e==="left"?n?(h=this.right+r,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-o,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+r,i==="near"?c="right":i==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+o,i==="near"?c="left":i==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const 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(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:r,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,r,a),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(r=>r.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,a;const o=(l,c,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,a=n.length;r<a;++r){const l=n[r];e.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&o({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(){const{chart:t,ctx:e,options:{grid:i}}=this,n=i.setContext(this.getContext()),r=i.drawBorder?n.borderWidth:0;if(!r)return;const a=i.setContext(this.getContext(0)).lineWidth,o=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=Nt(t,this.left,r)-r/2,c=Nt(t,this.right,a)+a/2,h=d=o):(h=Nt(t,this.top,r)-r/2,d=Nt(t,this.bottom,a)+a/2,l=c=o),e.save(),e.lineWidth=n.borderWidth,e.strokeStyle=n.borderColor,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,n=this._computeLabelArea();n&&Ke(i,n);const r=this._labelItems||(this._labelItems=this._computeLabelItems(t));let a,o;for(a=0,o=r.length;a<o;++a){const l=r[a],c=l.font,h=l.label;l.backdrop&&(i.fillStyle=l.backdrop.color,i.fillRect(l.backdrop.left,l.backdrop.top,l.backdrop.width,l.backdrop.height));let d=l.textOffset;Wt(i,h,0,d,c,l)}n&&Ze(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const r=J(i.font),a=nt(i.padding),o=i.align;let l=r.lineHeight/2;e==="bottom"||e==="center"||A(e)?(l+=a.bottom,W(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=Vc(this,l,e,o);Wt(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:u,textAlign:Hc(o,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=O(t.grid&&t.grid.z,-1);return!this._isVisible()||this.draw!==qt.prototype.draw?[{z:e,draw:n=>{this.draw(n)}}]:[{z:i,draw:n=>{this.drawBackground(),this.drawGrid(n),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:n=>{this.drawLabels(n)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let r,a;for(r=0,a=e.length;r<a;++r){const o=e[r];o[i]===this.id&&(!t||o.type===t)&&n.push(o)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return J(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class os{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){const e=Object.getPrototypeOf(t);let i;qc(e)&&(i=this.register(e));const n=this.items,r=t.id,a=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in n||(n[r]=t,Yc(t,a,i),this.override&&R.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in R[n]&&(delete R[n][i],this.override&&delete Bt[i])}}function Yc(s,t,e){const i=he(Object.create(null),[e?R.get(e):{},R.get(t),s.defaults]);R.set(t,i),s.defaultRoutes&&jc(t,s.defaultRoutes),s.descriptors&&R.describe(t,s.descriptors)}function jc(s,t){Object.keys(t).forEach(e=>{const i=e.split("."),n=i.pop(),r=[s].concat(i).join("."),a=t[e].split("."),o=a.pop(),l=a.join(".");R.route(r,n,l,o)})}function qc(s){return"id"in s&&"defaults"in s}class Uc{constructor(){this.controllers=new os(gt,"datasets",!0),this.elements=new os(mt,"elements"),this.plugins=new os(Object,"plugins"),this.scales=new os(qt,"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(n=>{const r=i||this._getRegistryForType(n);i||r.isForType(n)||r===this.plugins&&n.id?this._exec(t,r,n):$(n,a=>{const o=i||this._getRegistryForType(a);this._exec(t,o,a)})})}_exec(t,e,i){const n=Os(t);N(i["before"+n],[],i),e[t](i),N(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var _t=new Uc;class ii extends gt{update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:r,count:a}=Ki(e,i,n);if(this._drawStart=r,this._drawCount=a,Zi(e)&&(r=0,a=i.length),this.options.showLine){const{dataset:o,_dataset:l}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!l._decimated,o.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:c},t)}this.updateElements(i,r,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=_t.getElement("line")),super.addElements()}updateElements(t,e,i,n){const r=n==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),u=this.includeOptions(n,d),f=a.axis,g=o.axis,{spanGaps:m,segment:p}=this.options,b=Jt(m)?m:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||r||n==="none";let y=e>0&&this.getParsed(e-1);for(let w=e;w<e+i;++w){const x=t[w],D=this.getParsed(w),M=_?x:{},v=I(D[g]),k=M[f]=a.getPixelForValue(D[f],w),S=M[g]=r||v?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,D,l):D[g],w);M.skip=isNaN(k)||isNaN(S)||v,M.stop=w>0&&Math.abs(D[f]-y[f])>b,p&&(M.parsed=D,M.raw=c.data[w]),u&&(M.options=d||this.resolveDataElementOptions(w,x.active?"active":n)),_||this.updateElement(x,w,M,n),y=D}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let o=0;for(let l=e.length-1;l>=0;--l)o=Math.max(o,e[l].size(this.resolveDataElementOptions(l))/2);return o>0&&o}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const r=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,r,a)/2}}ii.id="scatter",ii.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1},ii.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(s){return"("+s.label+", "+s.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function Ut(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ni{constructor(t){this.options=t||{}}init(t){}formats(){return Ut()}parse(t,e){return Ut()}format(t,e){return Ut()}add(t,e,i){return Ut()}diff(t,e,i){return Ut()}startOf(t,e,i){return Ut()}endOf(t,e){return Ut()}}ni.override=function(s){Object.assign(ni.prototype,s)};var Zn={_date:ni};function Xc(s,t,e,i){const{controller:n,data:r,_sorted:a}=s,o=n._cachedMeta.iScale;if(o&&t===o.axis&&t!=="r"&&a&&r.length){const l=o._reversePixels?$o:zt;if(i){if(n._sharedOptions){const c=r[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(r,t,e-h),u=l(r,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function ls(s,t,e,i,n){const r=s.getSortedVisibleDatasetMetas(),a=e[t];for(let o=0,l=r.length;o<l;++o){const{index:c,data:h}=r[o],{lo:d,hi:u}=Xc(r[o],t,a,n);for(let f=d;f<=u;++f){const g=h[f];g.skip||i(g,c,f)}}}function Gc(s){const t=s.indexOf("x")!==-1,e=s.indexOf("y")!==-1;return function(i,n){const r=t?Math.abs(i.x-n.x):0,a=e?Math.abs(i.y-n.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(a,2))}}function ri(s,t,e,i,n){const r=[];return!n&&!s.isPointInArea(t)||ls(s,e,t,function(o,l,c){!n&&!ye(o,s.chartArea,0)||o.inRange(t.x,t.y,i)&&r.push({element:o,datasetIndex:l,index:c})},!0),r}function Qc(s,t,e,i){let n=[];function r(a,o,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],i),{angle:d}=ji(a,{x:t.x,y:t.y});ge(d,c,h)&&n.push({element:a,datasetIndex:o,index:l})}return ls(s,e,t,r),n}function Kc(s,t,e,i,n,r){let a=[];const o=Gc(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,n);if(i&&!f)return;const g=h.getCenterPoint(n);if(!(!!r||s.isPointInArea(g))&&!f)return;const p=o(t,g);p<l?(a=[{element:h,datasetIndex:d,index:u}],l=p):p===l&&a.push({element:h,datasetIndex:d,index:u})}return ls(s,e,t,c),a}function ai(s,t,e,i,n,r){return!r&&!s.isPointInArea(t)?[]:e==="r"&&!i?Qc(s,t,e,n):Kc(s,t,e,i,n,r)}function Jn(s,t,e,i,n){const r=[],a=e==="x"?"inXRange":"inYRange";let o=!1;return ls(s,e,t,(l,c,h)=>{l[a](t[e],n)&&(r.push({element:l,datasetIndex:c,index:h}),o=o||l.inRange(t.x,t.y,n))}),i&&!o?[]:r}var Zc={modes:{index(s,t,e,i){const n=Yt(t,s),r=e.axis||"x",a=e.includeInvisible||!1,o=e.intersect?ri(s,n,r,i,a):ai(s,n,r,!1,i,a),l=[];return o.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{const h=o[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(s,t,e,i){const n=Yt(t,s),r=e.axis||"xy",a=e.includeInvisible||!1;let o=e.intersect?ri(s,n,r,i,a):ai(s,n,r,!1,i,a);if(o.length>0){const l=o[0].datasetIndex,c=s.getDatasetMeta(l).data;o=[];for(let h=0;h<c.length;++h)o.push({element:c[h],datasetIndex:l,index:h})}return o},point(s,t,e,i){const n=Yt(t,s),r=e.axis||"xy",a=e.includeInvisible||!1;return ri(s,n,r,i,a)},nearest(s,t,e,i){const n=Yt(t,s),r=e.axis||"xy",a=e.includeInvisible||!1;return ai(s,n,r,e.intersect,i,a)},x(s,t,e,i){const n=Yt(t,s);return Jn(s,n,"x",e.intersect,i)},y(s,t,e,i){const n=Yt(t,s);return Jn(s,n,"y",e.intersect,i)}}};const tr=["left","top","right","bottom"];function De(s,t){return s.filter(e=>e.pos===t)}function er(s,t){return s.filter(e=>tr.indexOf(e.pos)===-1&&e.box.axis===t)}function Pe(s,t){return s.sort((e,i)=>{const n=t?i:e,r=t?e:i;return n.weight===r.weight?n.index-r.index:n.weight-r.weight})}function Jc(s){const t=[];let e,i,n,r,a,o;for(e=0,i=(s||[]).length;e<i;++e)n=s[e],{position:r,options:{stack:a,stackWeight:o=1}}=n,t.push({index:e,box:n,pos:r,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&r+a,stackWeight:o});return t}function th(s){const t={};for(const e of s){const{stack:i,pos:n,stackWeight:r}=e;if(!i||!tr.includes(n))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=r}return t}function eh(s,t){const e=th(s),{vBoxMaxWidth:i,hBoxMaxHeight:n}=t;let r,a,o;for(r=0,a=s.length;r<a;++r){o=s[r];const{fullSize:l}=o.box,c=e[o.stack],h=c&&o.stackWeight/c.weight;o.horizontal?(o.width=h?h*i:l&&t.availableWidth,o.height=n):(o.width=i,o.height=h?h*n:l&&t.availableHeight)}return e}function sh(s){const t=Jc(s),e=Pe(t.filter(c=>c.box.fullSize),!0),i=Pe(De(t,"left"),!0),n=Pe(De(t,"right")),r=Pe(De(t,"top"),!0),a=Pe(De(t,"bottom")),o=er(t,"x"),l=er(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:n.concat(l).concat(a).concat(o),chartArea:De(t,"chartArea"),vertical:i.concat(n).concat(l),horizontal:r.concat(a).concat(o)}}function sr(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function ir(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function ih(s,t,e,i){const{pos:n,box:r}=e,a=s.maxPadding;if(!A(n)){e.size&&(s[n]-=e.size);const d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?r.height:r.width),e.size=d.size/d.count,s[n]+=e.size}r.getPadding&&ir(a,r.getPadding());const o=Math.max(0,t.outerWidth-sr(a,s,"left","right")),l=Math.max(0,t.outerHeight-sr(a,s,"top","bottom")),c=o!==s.w,h=l!==s.h;return s.w=o,s.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function nh(s){const t=s.maxPadding;function e(i){const n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function rh(s,t){const e=t.maxPadding;function i(n){const r={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{r[a]=Math.max(t[a],e[a])}),r}return i(s?["left","right"]:["top","bottom"])}function Te(s,t,e,i){const n=[];let r,a,o,l,c,h;for(r=0,a=s.length,c=0;r<a;++r){o=s[r],l=o.box,l.update(o.width||t.w,o.height||t.h,rh(o.horizontal,t));const{same:d,other:u}=ih(t,e,o,i);c|=d&&n.length,h=h||u,l.fullSize||n.push(o)}return c&&Te(n,t,e,i)||h}function cs(s,t,e,i,n){s.top=e,s.left=t,s.right=t+i,s.bottom=e+n,s.width=i,s.height=n}function nr(s,t,e,i){const n=e.padding;let{x:r,y:a}=t;for(const o of s){const l=o.box,c=i[o.stack]||{placed:0,weight:1},h=o.stackWeight/c.weight||1;if(o.horizontal){const d=t.w*h,u=c.size||l.height;ct(c.start)&&(a=c.start),l.fullSize?cs(l,n.left,a,e.outerWidth-n.right-n.left,u):cs(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,u=c.size||l.width;ct(c.start)&&(r=c.start),l.fullSize?cs(l,r,n.top,u,e.outerHeight-n.bottom-n.top):cs(l,r,t.top+c.placed,u,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=a}R.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var ut={addBox(s,t){s.boxes||(s.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)}}]},s.boxes.push(t)},removeBox(s,t){const e=s.boxes?s.boxes.indexOf(t):-1;e!==-1&&s.boxes.splice(e,1)},configure(s,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(s,t,e,i){if(!s)return;const n=nt(s.options.layout.padding),r=Math.max(t-n.width,0),a=Math.max(e-n.height,0),o=sh(s.boxes),l=o.vertical,c=o.horizontal;$(s.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,p)=>p.box.options&&p.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:r,availableHeight:a,vBoxMaxWidth:r/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);ir(u,nt(i));const f=Object.assign({maxPadding:u,w:r,h:a,x:n.left,y:n.top},n),g=eh(l.concat(c),d);Te(o.fullSize,f,d,g),Te(l,f,d,g),Te(c,f,d,g)&&Te(l,f,d,g),nh(f),nr(o.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,nr(o.rightAndBottom,f,d,g),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(o.chartArea,m=>{const p=m.box;Object.assign(p,s.chartArea),p.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class rr{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class ah extends rr{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const hs="$chartjs",oh={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ar=s=>s===null||s==="";function lh(s,t){const e=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[hs]={initial:{height:i,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",ar(n)){const r=Dn(s,"width");r!==void 0&&(s.width=r)}if(ar(i))if(s.style.height==="")s.height=s.width/(t||2);else{const r=Dn(s,"height");r!==void 0&&(s.height=r)}return s}const or=Yl?{passive:!0}:!1;function ch(s,t,e){s.addEventListener(t,e,or)}function hh(s,t,e){s.canvas.removeEventListener(t,e,or)}function dh(s,t){const e=oh[s.type]||s.type,{x:i,y:n}=Yt(s,t);return{type:e,chart:t,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function ds(s,t){for(const e of s)if(e===t||e.contains(t))return!0}function uh(s,t,e){const i=s.canvas,n=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||ds(o.addedNodes,i),a=a&&!ds(o.removedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function fh(s,t,e){const i=s.canvas,n=new MutationObserver(r=>{let a=!1;for(const o of r)a=a||ds(o.removedNodes,i),a=a&&!ds(o.addedNodes,i);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Se=new Map;let lr=0;function cr(){const s=window.devicePixelRatio;s!==lr&&(lr=s,Se.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function gh(s,t){Se.size||window.addEventListener("resize",cr),Se.set(s,t)}function mh(s){Se.delete(s),Se.size||window.removeEventListener("resize",cr)}function ph(s,t,e){const i=s.canvas,n=i&&Xs(i);if(!n)return;const r=Qi((o,l)=>{const c=n.clientWidth;e(o,l),c<n.clientWidth&&e()},window),a=new ResizeObserver(o=>{const l=o[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||r(c,h)});return a.observe(n),gh(s,r),a}function oi(s,t,e){e&&e.disconnect(),t==="resize"&&mh(s)}function bh(s,t,e){const i=s.canvas,n=Qi(r=>{s.ctx!==null&&e(dh(r,s))},s,r=>{const a=r[0];return[a,a.offsetX,a.offsetY]});return ch(i,t,n),n}class _h extends rr{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(lh(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[hs])return!1;const i=e[hs].initial;["height","width"].forEach(r=>{const a=i[r];I(a)?e.removeAttribute(r):e.setAttribute(r,a)});const n=i.style||{};return Object.keys(n).forEach(r=>{e.style[r]=n[r]}),e.width=e.width,delete e[hs],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:uh,detach:fh,resize:ph}[e]||bh;n[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:oi,detach:oi,resize:oi}[e]||hh)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Vl(t,e,i,n)}isAttached(t){const e=Xs(t);return!!(e&&e.isConnected)}}function yh(s){return!kn()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?ah:_h}class xh{constructor(){this._init=[]}notify(t,e,i,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=n?this._descriptors(t).filter(n):this._descriptors(t),a=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,i,n){n=n||{};for(const r of t){const a=r.plugin,o=a[i],l=[e,n,r.options];if(N(o,l,a)===!1&&n.cancelable)return!1}return!0}invalidate(){I(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=O(i.options&&i.options.plugins,{}),r=wh(i);return n===!1&&!e?[]:kh(t,r,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(r,a)=>r.filter(o=>!a.some(l=>o.plugin.id===l.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function wh(s){const t={},e=[],i=Object.keys(_t.plugins.items);for(let r=0;r<i.length;r++)e.push(_t.getPlugin(i[r]));const n=s.plugins||[];for(let r=0;r<n.length;r++){const a=n[r];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function vh(s,t){return!t&&s===!1?null:s===!0?{}:s}function kh(s,{plugins:t,localIds:e},i,n){const r=[],a=s.getContext();for(const o of t){const l=o.id,c=vh(i[l],n);c!==null&&r.push({plugin:o,options:Mh(s.config,{plugin:o,local:e[l]},c,a)})}return r}function Mh(s,{plugin:t,local:e},i,n){const r=s.pluginScopeKeys(t),a=s.getOptionScopes(i,r);return e&&t.defaults&&a.push(t.defaults),s.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function li(s,t){const e=R.datasets[s]||{};return((t.datasets||{})[s]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Dh(s,t){let e=s;return s==="_index_"?e=t:s==="_value_"&&(e=t==="x"?"y":"x"),e}function Ph(s,t){return s===t?"_index_":"_value_"}function Th(s){if(s==="top"||s==="bottom")return"x";if(s==="left"||s==="right")return"y"}function ci(s,t){return s==="x"||s==="y"?s:t.axis||Th(t.position)||s.charAt(0).toLowerCase()}function Sh(s,t){const e=Bt[s.type]||{scales:{}},i=t.scales||{},n=li(s.type,t),r=Object.create(null),a=Object.create(null);return Object.keys(i).forEach(o=>{const l=i[o];if(!A(l))return console.error(`Invalid scale configuration for scale: ${o}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const c=ci(o,l),h=Ph(c,n),d=e.scales||{};r[c]=r[c]||o,a[o]=de(Object.create(null),[{axis:c},l,d[c],d[h]])}),s.data.datasets.forEach(o=>{const l=o.type||s.type,c=o.indexAxis||li(l,t),d=(Bt[l]||{}).scales||{};Object.keys(d).forEach(u=>{const f=Dh(u,c),g=o[f+"AxisID"]||r[f]||f;a[g]=a[g]||Object.create(null),de(a[g],[{axis:f},i[g],d[u]])})}),Object.keys(a).forEach(o=>{const l=a[o];de(l,[R.scales[l.type],R.scale])}),a}function hr(s){const t=s.options||(s.options={});t.plugins=O(t.plugins,{}),t.scales=Sh(s,t)}function dr(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function Ch(s){return s=s||{},s.data=dr(s.data),hr(s),s}const ur=new Map,fr=new Set;function us(s,t){let e=ur.get(s);return e||(e=t(),ur.set(s,e),fr.add(e)),e}const Ce=(s,t,e)=>{const i=St(t,e);i!==void 0&&s.add(i)};class Oh{constructor(t){this._config=Ch(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=dr(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),hr(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return us(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return us(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return us(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return us(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:r}=this,a=this._cachedScopes(t,i),o=a.get(e);if(o)return o;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>Ce(l,t,d))),h.forEach(d=>Ce(l,n,d)),h.forEach(d=>Ce(l,Bt[r]||{},d)),h.forEach(d=>Ce(l,R,d)),h.forEach(d=>Ce(l,Ws,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),fr.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Bt[e]||{},R.datasets[e]||{},{type:e},R,Ws]}resolveNamedOptions(t,e,i,n=[""]){const r={$shared:!0},{resolver:a,subPrefixes:o}=gr(this._resolverCache,t,n);let l=a;if(Ah(a,e)){r.$shared=!1,i=Ct(i)?i():i;const c=this.createResolver(t,i,o);l=ee(a,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],n){const{resolver:r}=gr(this._resolverCache,t,i);return A(e)?ee(r,e,void 0,n):r}}function gr(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));const n=e.join();let r=i.get(n);return r||(r={resolver:js(t,e),subPrefixes:e.filter(o=>!o.toLowerCase().includes("hover"))},i.set(n,r)),r}const Lh=s=>A(s)&&Object.getOwnPropertyNames(s).reduce((t,e)=>t||Ct(s[e]),!1);function Ah(s,t){const{isScriptable:e,isIndexable:i}=mn(s);for(const n of t){const r=e(n),a=i(n),o=(a||r)&&s[n];if(r&&(Ct(o)||Lh(o))||a&&W(o))return!0}return!1}var Rh="3.9.1";const Fh=["top","bottom","left","right","chartArea"];function mr(s,t){return s==="top"||s==="bottom"||Fh.indexOf(s)===-1&&t==="x"}function pr(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function br(s){const t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),N(e&&e.onComplete,[s],t)}function Eh(s){const t=s.chart,e=t.options.animation;N(e&&e.onProgress,[s],t)}function _r(s){return kn()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const fs={},yr=s=>{const t=_r(s);return Object.values(fs).filter(e=>e.canvas===t).pop()};function Ih(s,t,e){const i=Object.keys(s);for(const n of i){const r=+n;if(r>=t){const a=s[n];delete s[n],(e>0||r>t)&&(s[r+e]=a)}}}function $h(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}let Oe=class{constructor(t,e){const i=this.config=new Oh(e),n=_r(t),r=yr(n);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||yh(n)),this.platform.updateConfig(i);const o=this.platform.acquireContext(n,a.aspectRatio),l=o&&o.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Mo(),this.ctx=o,this.canvas=l,this.width=h,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 xh,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=No(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],fs[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Pt.listen(this,"complete",br),Pt.listen(this,"progress",Eh),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:r}=this;return I(t)?e&&r?r:n?i/n: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}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Mn(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return un(this.canvas,this.ctx),this}stop(){return Pt.stop(this),this}resize(t,e){Pt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,r),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Mn(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),N(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};$(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((a,o)=>(a[o]=!1,a),{});let r=[];e&&(r=r.concat(Object.keys(e).map(a=>{const o=e[a],l=ci(a,o),c=l==="r",h=l==="x";return{options:o,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),$(r,a=>{const o=a.options,l=o.id,c=ci(l,o),h=O(o.type,a.dtype);(o.position===void 0||mr(o.position,c)!==mr(a.dposition))&&(o.position=a.dposition),n[l]=!0;let d=null;if(l in i&&i[l].type===h)d=i[l];else{const u=_t.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(o,t)}),$(n,(a,o)=>{a||delete i[o]}),$(i,a=>{ut.configure(this,a,a.options),ut.addBox(this,a)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,r)=>n.index-r.index),i>e){for(let n=e;n<i;++n)this._destroyDatasetMeta(n);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(pr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const r=e[i];let a=this.getDatasetMeta(i);const o=r.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=o,a.indexAxis=r.indexAxis||li(o,this.options),a.order=r.order||0,a.index=i,a.label=""+r.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const l=_t.getController(o),{datasetElementType:c,dataElementType:h}=R.datasets[o];Object.assign(l.prototype,{dataElementType:_t.getElement(h),datasetElementType:c&&_t.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){$(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!n&&r.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),n||$(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(pr("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){$(this.scales,t=>{ut.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Ni(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:r}of e){const a=i==="_removeElements"?-r:r;Ih(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(a=>a[0]===r).map((a,o)=>o+","+a.splice(1).join(","))),n=i(0);for(let r=1;r<e;r++)if(!Ni(n,i(r)))return;return Array.from(n).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ut.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],$(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,r)=>{n._idx=r}),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,Ct(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Pt.has(this)?this.attached&&!Pt.running(this)&&Pt.start(this):(this.draw(),br({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:n}=this._resizeBeforeDraw;this._resize(i,n),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const 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){const e=this._sortedMetasets,i=[];let n,r;for(n=0,r=e.length;n<r;++n){const a=e[n];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,r=this.chartArea,a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&Ke(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),n&&Ze(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ye(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const r=Zc.modes[e];return typeof r=="function"?r(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter(r=>r&&r._dataset===e).pop();return n||(n={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(n)),n}getContext(){return this.$context||(this.$context=At(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const 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){const n=i?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,n);ct(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(r,{visible:i}),this.update(o=>o.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Pt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),un(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete fs[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(r,a)=>{e.addEventListener(this,r,a),t[r]=a},n=(r,a,o)=>{r.offsetX=a,r.offsetY=o,this._eventHandler(r)};$(this.options.events,r=>i(r,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const o=()=>{n("attach",o),this.attached=!0,this.resize(),i("resize",r),i("detach",a)};a=()=>{this.attached=!1,n("resize",r),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){$(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},$(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let r,a,o,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+n+"DatasetHoverStyle"]()),o=0,l=t.length;o<l;++o){a=t[o];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[n+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:r,index:a})=>{const o=this.getDatasetMeta(r);if(!o)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:o.data[a],index:a}});!He(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const n=this.options.hover,r=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=r(e,t),o=i?t:r(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),o.length&&n.mode&&this.updateHoverStyle(o,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:r}=this,a=e,o=this._getActiveElements(t,n,i,a),l=Oo(t),c=$h(t,this._lastEvent,i,l);i&&(this._lastEvent=null,N(r.onHover,[t,o,this],this),l&&N(r.onClick,[t,o,this],this));const h=!He(o,n);return(h||e)&&(this._active=o,this._updateHoverStyles(o,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,n)}};const xr=()=>$(Oe.instances,s=>s._plugins.invalidate()),Rt=!0;Object.defineProperties(Oe,{defaults:{enumerable:Rt,value:R},instances:{enumerable:Rt,value:fs},overrides:{enumerable:Rt,value:Bt},registry:{enumerable:Rt,value:_t},version:{enumerable:Rt,value:Rh},getChart:{enumerable:Rt,value:yr},register:{enumerable:Rt,value:(...s)=>{_t.add(...s),xr()}},unregister:{enumerable:Rt,value:(...s)=>{_t.remove(...s),xr()}}});function wr(s,t,e){const{startAngle:i,pixelMargin:n,x:r,y:a,outerRadius:o,innerRadius:l}=t;let c=n/o;s.beginPath(),s.arc(r,a,o,i-c,e+c),l>n?(c=n/l,s.arc(r,a,l,e+c,i-c,!0)):s.arc(r,a,n,e+j,i-j),s.closePath(),s.clip()}function zh(s){return Ys(s,["outerStart","outerEnd","innerStart","innerEnd"])}function Bh(s,t,e,i){const n=zh(s.options.borderRadius),r=(e-t)/2,a=Math.min(r,i*t/2),o=l=>{const c=(e-Math.min(r,l))*i/2;return st(l,0,Math.min(r,c))};return{outerStart:o(n.outerStart),outerEnd:o(n.outerEnd),innerStart:st(n.innerStart,0,a),innerEnd:st(n.innerEnd,0,a)}}function ne(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function hi(s,t,e,i,n,r){const{x:a,y:o,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+i+e-c,0),u=h>0?h+i+e+c:0;let f=0;const g=n-l;if(i){const C=h>0?h-i:0,Z=d>0?d-i:0,K=(C+Z)/2,Kt=K!==0?g*K/(K+i):g;f=(g-Kt)/2}const m=Math.max(.001,g*d-e/H)/d,p=(g-m)/2,b=l+p+f,_=n-p-f,{outerStart:y,outerEnd:w,innerStart:x,innerEnd:D}=Bh(t,u,d,_-b),M=d-y,v=d-w,k=b+y/M,S=_-w/v,F=u+x,L=u+D,Y=b+x/F,tt=_-D/L;if(s.beginPath(),r){if(s.arc(a,o,d,k,S),w>0){const K=ne(v,S,a,o);s.arc(K.x,K.y,w,S,_+j)}const C=ne(L,_,a,o);if(s.lineTo(C.x,C.y),D>0){const K=ne(L,tt,a,o);s.arc(K.x,K.y,D,_+j,tt+Math.PI)}if(s.arc(a,o,u,_-D/u,b+x/u,!0),x>0){const K=ne(F,Y,a,o);s.arc(K.x,K.y,x,Y+Math.PI,b-j)}const Z=ne(M,b,a,o);if(s.lineTo(Z.x,Z.y),y>0){const K=ne(M,k,a,o);s.arc(K.x,K.y,y,b-j,k)}}else{s.moveTo(a,o);const C=Math.cos(k)*d+a,Z=Math.sin(k)*d+o;s.lineTo(C,Z);const K=Math.cos(S)*d+a,Kt=Math.sin(S)*d+o;s.lineTo(K,Kt)}s.closePath()}function Nh(s,t,e,i,n){const{fullCircles:r,startAngle:a,circumference:o}=t;let l=t.endAngle;if(r){hi(s,t,e,i,a+B,n);for(let c=0;c<r;++c)s.fill();isNaN(o)||(l=a+o%B,o%B===0&&(l+=B))}return hi(s,t,e,i,l,n),s.fill(),l}function Wh(s,t,e){const{x:i,y:n,startAngle:r,pixelMargin:a,fullCircles:o}=t,l=Math.max(t.outerRadius-a,0),c=t.innerRadius+a;let h;for(e&&wr(s,t,r+B),s.beginPath(),s.arc(i,n,c,r+B,r,!0),h=0;h<o;++h)s.stroke();for(s.beginPath(),s.arc(i,n,l,r,r+B),h=0;h<o;++h)s.stroke()}function Hh(s,t,e,i,n,r){const{options:a}=t,{borderWidth:o,borderJoinStyle:l}=a,c=a.borderAlign==="inner";o&&(c?(s.lineWidth=o*2,s.lineJoin=l||"round"):(s.lineWidth=o,s.lineJoin=l||"bevel"),t.fullCircles&&Wh(s,t,c),c&&wr(s,t,n),hi(s,t,e,i,n,r),s.stroke())}class gs extends mt{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:r,distance:a}=ji(n,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,g=O(d,l-o)>=B||ge(r,o,l),m=Mt(a,c+u,h+u);return g&&m}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:r,innerRadius:a,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:l,spacing:c}=this.options,h=(n+r)/2,d=(a+o+c+l)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/2,r=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>B?Math.floor(i/B):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(n){o=n/2;const c=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(c)*o,Math.sin(c)*o),this.circumference>=H&&(o=n)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const l=Nh(t,this,o,r,a);Hh(t,this,o,r,l,a),t.restore()}}gs.id="arc",gs.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0},gs.defaultRoutes={backgroundColor:"backgroundColor"};function vr(s,t,e=t){s.lineCap=O(e.borderCapStyle,t.borderCapStyle),s.setLineDash(O(e.borderDash,t.borderDash)),s.lineDashOffset=O(e.borderDashOffset,t.borderDashOffset),s.lineJoin=O(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=O(e.borderWidth,t.borderWidth),s.strokeStyle=O(e.borderColor,t.borderColor)}function Vh(s,t,e){s.lineTo(e.x,e.y)}function Yh(s){return s.stepped?fl:s.tension||s.cubicInterpolationMode==="monotone"?gl:Vh}function kr(s,t,e={}){const i=s.length,{start:n=0,end:r=i-1}=e,{start:a,end:o}=t,l=Math.max(n,a),c=Math.min(r,o),h=n<a&&r<a||n>o&&r>o;return{count:i,start:l,loop:t.loop,ilen:c<l&&!h?i+c-l:c-l}}function jh(s,t,e,i){const{points:n,options:r}=t,{count:a,start:o,loop:l,ilen:c}=kr(n,e,i),h=Yh(r);let{move:d=!0,reverse:u}=i||{},f,g,m;for(f=0;f<=c;++f)g=n[(o+(u?c-f:f))%a],!g.skip&&(d?(s.moveTo(g.x,g.y),d=!1):h(s,m,g,u,r.stepped),m=g);return l&&(g=n[(o+(u?c:0))%a],h(s,m,g,u,r.stepped)),!!l}function qh(s,t,e,i){const n=t.points,{count:r,start:a,ilen:o}=kr(n,e,i),{move:l=!0,reverse:c}=i||{};let h=0,d=0,u,f,g,m,p,b;const _=w=>(a+(c?o-w:w))%r,y=()=>{m!==p&&(s.lineTo(h,p),s.lineTo(h,m),s.lineTo(h,b))};for(l&&(f=n[_(0)],s.moveTo(f.x,f.y)),u=0;u<=o;++u){if(f=n[_(u)],f.skip)continue;const w=f.x,x=f.y,D=w|0;D===g?(x<m?m=x:x>p&&(p=x),h=(d*h+w)/++d):(y(),s.lineTo(w,x),g=D,d=0,m=p=x),b=x}y()}function di(s){const t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?qh:jh}function Uh(s){return s.stepped?jl:s.tension||s.cubicInterpolationMode==="monotone"?ql:jt}function Xh(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),vr(s,t.options),s.stroke(n)}function Gh(s,t,e,i){const{segments:n,options:r}=t,a=di(t);for(const o of n)vr(s,r,o.style),s.beginPath(),a(s,t,o,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}const Qh=typeof Path2D=="function";function Kh(s,t,e,i){Qh&&!t.options.segment?Xh(s,t,e,i):Gh(s,t,e,i)}class Ft extends mt{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){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;$l(this._points,i,t,n,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=Jl(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],r=this.points,a=An(this,{property:e,start:n,end:n});if(!a.length)return;const o=[],l=Uh(i);let c,h;for(c=0,h=a.length;c<h;++c){const{start:d,end:u}=a[c],f=r[d],g=r[u];if(f===g){o.push(f);continue}const m=Math.abs((n-f[e])/(g[e]-f[e])),p=l(f,g,m,i.stepped);p[e]=t[e],o.push(p)}return o.length===1?o[0]:o}pathSegment(t,e,i){return di(this)(t,this,e,i)}path(t,e,i){const n=this.segments,r=di(this);let a=this._loop;e=e||0,i=i||this.points.length-e;for(const o of n)a&=r(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,n){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),Kh(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ft.id="line",Ft.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},Ft.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},Ft.descriptors={_scriptable:!0,_indexable:s=>s!=="borderDash"&&s!=="fill"};function Mr(s,t,e,i){const n=s.options,{[e]:r}=s.getProps([e],i);return Math.abs(t-r)<n.radius+n.hitRadius}class ms extends mt{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(t-r,2)+Math.pow(e-a,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return Mr(this,t,"x",e)}inYRange(t,e){return Mr(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){const i=this.options;this.skip||i.radius<.1||!ye(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Vs(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}ms.id="point",ms.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},ms.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function Dr(s,t){const{x:e,y:i,base:n,width:r,height:a}=s.getProps(["x","y","base","width","height"],t);let o,l,c,h,d;return s.horizontal?(d=a/2,o=Math.min(e,n),l=Math.max(e,n),c=i-d,h=i+d):(d=r/2,o=e-d,l=e+d,c=Math.min(i,n),h=Math.max(i,n)),{left:o,top:c,right:l,bottom:h}}function Et(s,t,e,i){return s?0:st(t,e,i)}function Zh(s,t,e){const i=s.options.borderWidth,n=s.borderSkipped,r=gn(i);return{t:Et(n.top,r.top,0,e),r:Et(n.right,r.right,0,t),b:Et(n.bottom,r.bottom,0,e),l:Et(n.left,r.left,0,t)}}function Jh(s,t,e){const{enableBorderRadius:i}=s.getProps(["enableBorderRadius"]),n=s.options.borderRadius,r=Ht(n),a=Math.min(t,e),o=s.borderSkipped,l=i||A(n);return{topLeft:Et(!l||o.top||o.left,r.topLeft,0,a),topRight:Et(!l||o.top||o.right,r.topRight,0,a),bottomLeft:Et(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:Et(!l||o.bottom||o.right,r.bottomRight,0,a)}}function td(s){const t=Dr(s),e=t.right-t.left,i=t.bottom-t.top,n=Zh(s,e/2,i/2),r=Jh(s,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:i-n.t-n.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,r.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(n.b,n.r))}}}}function ui(s,t,e,i){const n=t===null,r=e===null,o=s&&!(n&&r)&&Dr(s,i);return o&&(n||Mt(t,o.left,o.right))&&(r||Mt(e,o.top,o.bottom))}function ed(s){return s.topLeft||s.topRight||s.bottomLeft||s.bottomRight}function sd(s,t){s.rect(t.x,t.y,t.w,t.h)}function fi(s,t,e={}){const i=s.x!==e.x?-t:0,n=s.y!==e.y?-t:0,r=(s.x+s.w!==e.x+e.w?t:0)-i,a=(s.y+s.h!==e.y+e.h?t:0)-n;return{x:s.x+i,y:s.y+n,w:s.w+r,h:s.h+a,radius:s.radius}}class ps extends mt{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){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:r,outer:a}=td(this),o=ed(a.radius)?xe:sd;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),o(t,fi(a,e,r)),t.clip(),o(t,fi(r,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,fi(r,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return ui(this,t,e,i)}inXRange(t,e){return ui(this,t,null,e)}inYRange(t,e){return ui(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+n)/2:e,y:r?i:(i+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}ps.id="bar",ps.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},ps.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function id(s,t,e){const i=s.segments,n=s.points,r=t.points,a=[];for(const o of i){let{start:l,end:c}=o;c=mi(l,c,n);const h=gi(e,n[l],n[c],o.loop);if(!t.segments){a.push({source:o,target:h,start:n[l],end:n[c]});continue}const d=An(t,h);for(const u of d){const f=gi(e,r[u.start],r[u.end],u.loop),g=Ln(o,n,f);for(const m of g)a.push({source:m,target:u,start:{[e]:Pr(h,f,"start",Math.max)},end:{[e]:Pr(h,f,"end",Math.min)}})}}return a}function gi(s,t,e,i){if(i)return;let n=t[s],r=e[s];return s==="angle"&&(n=ot(n),r=ot(r)),{property:s,start:n,end:r}}function nd(s,t){const{x:e=null,y:i=null}=s||{},n=t.points,r=[];return t.segments.forEach(({start:a,end:o})=>{o=mi(a,o,n);const l=n[a],c=n[o];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function mi(s,t,e){for(;t>s;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Pr(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function Tr(s,t){let e=[],i=!1;return W(s)?(i=!0,e=s):e=nd(s,t),e.length?new Ft({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Sr(s){return s&&s.fill!==!1}function rd(s,t,e){let n=s[t].fill;const r=[t];let a;if(!e)return n;for(;n!==!1&&r.indexOf(n)===-1;){if(!X(n))return n;if(a=s[n],!a)return!1;if(a.visible)return n;r.push(n),n=a.fill}return!1}function ad(s,t,e){const i=hd(s);if(A(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return X(n)&&Math.floor(n)===n?od(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function od(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function ld(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:A(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function cd(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:A(s)?i=s.value:i=t.getBaseValue(),i}function hd(s){const t=s.options,e=t.fill;let i=O(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function dd(s){const{scale:t,index:e,line:i}=s,n=[],r=i.segments,a=i.points,o=ud(t,e);o.push(Tr({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){const c=r[l];for(let h=c.start;h<=c.end;h++)fd(n,a[h],o)}return new Ft({points:n,options:{}})}function ud(s,t){const e=[],i=s.getMatchingVisibleMetas("line");for(let n=0;n<i.length;n++){const r=i[n];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function fd(s,t,e){const i=[];for(let n=0;n<e.length;n++){const r=e[n],{first:a,last:o,point:l}=gd(r,t,"x");if(!(!l||a&&o)){if(a)i.unshift(l);else if(s.push(l),!o)break}}s.push(...i)}function gd(s,t,e){const i=s.interpolate(t,e);if(!i)return{};const n=i[e],r=s.segments,a=s.points;let o=!1,l=!1;for(let c=0;c<r.length;c++){const h=r[c],d=a[h.start][e],u=a[h.end][e];if(Mt(n,d,u)){o=n===d,l=n===u;break}}return{first:o,last:l,point:i}}class Cr{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:r,radius:a}=this;return e=e||{start:0,end:B},t.arc(n,r,a,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,r=t.angle;return{x:e+Math.cos(r)*n,y:i+Math.sin(r)*n,angle:r}}}function md(s){const{chart:t,fill:e,line:i}=s;if(X(e))return pd(t,e);if(e==="stack")return dd(s);if(e==="shape")return!0;const n=bd(s);return n instanceof Cr?n:Tr(n,i)}function pd(s,t){const e=s.getDatasetMeta(t);return e&&s.isDatasetVisible(t)?e.dataset:null}function bd(s){return(s.scale||{}).getPointPositionForValue?yd(s):_d(s)}function _d(s){const{scale:t={},fill:e}=s,i=ld(e,t);if(X(i)){const n=t.isHorizontal();return{x:n?i:null,y:n?null:i}}return null}function yd(s){const{scale:t,fill:e}=s,i=t.options,n=t.getLabels().length,r=i.reverse?t.max:t.min,a=cd(e,t,r),o=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,r);return new Cr({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)o.push(t.getPointPositionForValue(l,a));return o}function pi(s,t,e){const i=md(t),{line:n,scale:r,axis:a}=t,o=n.options,l=o.fill,c=o.backgroundColor,{above:h=c,below:d=c}=l||{};i&&n.points.length&&(Ke(s,e),xd(s,{line:n,target:i,above:h,below:d,area:e,scale:r,axis:a}),Ze(s))}function xd(s,t){const{line:e,target:i,above:n,below:r,area:a,scale:o}=t,l=e._loop?"angle":t.axis;s.save(),l==="x"&&r!==n&&(Or(s,i,a.top),Lr(s,{line:e,target:i,color:n,scale:o,property:l}),s.restore(),s.save(),Or(s,i,a.bottom)),Lr(s,{line:e,target:i,color:r,scale:o,property:l}),s.restore()}function Or(s,t,e){const{segments:i,points:n}=t;let r=!0,a=!1;s.beginPath();for(const o of i){const{start:l,end:c}=o,h=n[l],d=n[mi(l,c,n)];r?(s.moveTo(h.x,h.y),r=!1):(s.lineTo(h.x,e),s.lineTo(h.x,h.y)),a=!!t.pathSegment(s,o,{move:a}),a?s.closePath():s.lineTo(d.x,e)}s.lineTo(t.first().x,e),s.closePath(),s.clip()}function Lr(s,t){const{line:e,target:i,property:n,color:r,scale:a}=t,o=id(e,i,n);for(const{source:l,target:c,start:h,end:d}of o){const{style:{backgroundColor:u=r}={}}=l,f=i!==!0;s.save(),s.fillStyle=u,wd(s,a,f&&gi(n,h,d)),s.beginPath();const g=!!e.pathSegment(s,l);let m;if(f){g?s.closePath():Ar(s,i,d,n);const p=!!i.pathSegment(s,c,{move:g,reverse:!0});m=g&&p,m||Ar(s,i,h,n)}s.closePath(),s.fill(m?"evenodd":"nonzero"),s.restore()}}function wd(s,t,e){const{top:i,bottom:n}=t.chart.chartArea,{property:r,start:a,end:o}=e||{};r==="x"&&(s.beginPath(),s.rect(a,i,o-a,n-i),s.clip())}function Ar(s,t,e,i){const n=t.interpolate(e,i);n&&s.lineTo(n.x,n.y)}var vd={id:"filler",afterDatasetsUpdate(s,t,e){const i=(s.data.datasets||[]).length,n=[];let r,a,o,l;for(a=0;a<i;++a)r=s.getDatasetMeta(a),o=r.dataset,l=null,o&&o.options&&o instanceof Ft&&(l={visible:s.isDatasetVisible(a),index:a,fill:ad(o,a,i),chart:s,axis:r.controller.options.indexAxis,scale:r.vScale,line:o}),r.$filler=l,n.push(l);for(a=0;a<i;++a)l=n[a],!(!l||l.fill===!1)&&(l.fill=rd(n,a,e.propagate))},beforeDraw(s,t,e){const i=e.drawTime==="beforeDraw",n=s.getSortedVisibleDatasetMetas(),r=s.chartArea;for(let a=n.length-1;a>=0;--a){const o=n[a].$filler;o&&(o.line.updateControlPoints(r,o.axis),i&&o.fill&&pi(s.ctx,o,r))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const r=i[n].$filler;Sr(r)&&pi(s.ctx,r,s.chartArea)}},beforeDatasetDraw(s,t,e){const i=t.meta.$filler;!Sr(i)||e.drawTime!=="beforeDatasetDraw"||pi(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Rr=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},kd=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index;class Fr extends mt{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(){const t=this.options.labels||{};let e=N(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,n=J(i.font),r=n.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Rr(i,r);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,r,o,l)+10):(h=this.maxHeight,c=this._fitCols(a,r,o,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:r,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+o;let d=t;r.textAlign="left",r.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((g,m)=>{const p=i+e/2+r.measureText(g.text).width;(m===0||c[c.length-1]+p+2*o>a)&&(d+=h,c[c.length-(m>0?0:1)]=0,f+=h,u++),l[m]={left:0,top:f,row:u,width:p,height:n},c[c.length-1]+=p+o}),d}_fitCols(t,e,i,n){const{ctx:r,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=o,u=0,f=0,g=0,m=0;return this.legendItems.forEach((p,b)=>{const _=i+e/2+r.measureText(p.text).width;b>0&&f+n+2*o>h&&(d+=u+o,c.push({width:u,height:f}),g+=u+o,m++,u=f=0),l[b]={left:g,top:f,col:m,width:_,height:n},u=Math.max(u,_),f+=n+o}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:r}}=this,a=ie(r,this.left,this.width);if(this.isHorizontal()){let o=0,l=it(i,this.left+n,this.right-this.lineWidths[o]);for(const c of e)o!==c.row&&(o=c.row,l=it(i,this.left+n,this.right-this.lineWidths[o])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let o=0,l=it(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const c of e)c.col!==o&&(o=c.col,l=it(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ke(t,this),this._draw(),Ze(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:r,labels:a}=t,o=R.color,l=ie(t.rtl,this.left,this.width),c=J(a.font),{color:h,padding:d}=a,u=c.size,f=u/2;let g;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:b}=Rr(a,u),_=function(M,v,k){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;n.save();const S=O(k.lineWidth,1);if(n.fillStyle=O(k.fillStyle,o),n.lineCap=O(k.lineCap,"butt"),n.lineDashOffset=O(k.lineDashOffset,0),n.lineJoin=O(k.lineJoin,"miter"),n.lineWidth=S,n.strokeStyle=O(k.strokeStyle,o),n.setLineDash(O(k.lineDash,[])),a.usePointStyle){const F={radius:p*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:S},L=l.xPlus(M,m/2),Y=v+f;fn(n,F,L,Y,a.pointStyleWidth&&m)}else{const F=v+Math.max((u-p)/2,0),L=l.leftForLtr(M,m),Y=Ht(k.borderRadius);n.beginPath(),Object.values(Y).some(tt=>tt!==0)?xe(n,{x:L,y:F,w:m,h:p,radius:Y}):n.rect(L,F,m,p),n.fill(),S!==0&&n.stroke()}n.restore()},y=function(M,v,k){Wt(n,k.text,M,v+b/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},w=this.isHorizontal(),x=this._computeTitleHeight();w?g={x:it(r,this.left+d,this.right-i[0]),y:this.top+d+x,line:0}:g={x:this.left+d,y:it(r,this.top+x+d,this.bottom-e[0].height),line:0},Tn(this.ctx,t.textDirection);const D=b+d;this.legendItems.forEach((M,v)=>{n.strokeStyle=M.fontColor||h,n.fillStyle=M.fontColor||h;const k=n.measureText(M.text).width,S=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),F=m+f+k;let L=g.x,Y=g.y;l.setWidth(this.width),w?v>0&&L+F+d>this.right&&(Y=g.y+=D,g.line++,L=g.x=it(r,this.left+d,this.right-i[g.line])):v>0&&Y+D>this.bottom&&(L=g.x=L+e[g.line].width+d,g.line++,Y=g.y=it(r,this.top+x+d,this.bottom-e[g.line].height));const tt=l.x(L);_(tt,Y,M),L=Wo(S,L+m+f,w?L+F:this.right,t.rtl),y(l.x(L),Y,M),w?g.x+=F+d:g.y+=D}),Sn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=J(e.font),n=nt(e.padding);if(!e.display)return;const r=ie(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=i.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=it(t.align,d,this.right-u);else{const g=this.columnSizes.reduce((m,p)=>Math.max(m,p.height),0);h=c+it(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=it(o,d,d+u);a.textAlign=r.textAlign(Fs(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,Wt(a,e.text,f,h,i)}_computeTitleHeight(){const t=this.options.title,e=J(t.font),i=nt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,r;if(Mt(t,this.left,this.right)&&Mt(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(n=r[i],Mt(t,n.left,n.left+n.width)&&Mt(e,n.top,n.top+n.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!Md(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,r=kd(n,i);n&&!r&&N(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!r&&N(e.onHover,[t,i,this],this)}else i&&N(e.onClick,[t,i,this],this)}}function Md(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}var Dd={id:"legend",_element:Fr,start(s,t,e){const i=s.legend=new Fr({ctx:s.ctx,options:e,chart:s});ut.configure(s,i,e),ut.addBox(s,i)},stop(s){ut.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,t,e){const i=s.legend;ut.configure(s,i,e),i.options=e},afterUpdate(s){const t=s.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(s,t){t.replay||s.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,t,e){const i=t.datasetIndex,n=e.chart;n.isDatasetVisible(i)?(n.hide(i),t.hidden=!0):(n.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:r}}=s.legend.options;return s._getSortedDatasetMetas().map(a=>{const o=a.controller.getStyle(e?0:void 0),l=nt(o.borderWidth);return{text:t[a.index].label,fillStyle:o.backgroundColor,fontColor:r,hidden:!a.visible,lineCap:o.borderCapStyle,lineDash:o.borderDash,lineDashOffset:o.borderDashOffset,lineJoin:o.borderJoinStyle,lineWidth:(l.width+l.height)/4,strokeStyle:o.borderColor,pointStyle:i||o.pointStyle,rotation:o.rotation,textAlign:n||o.textAlign,borderRadius:0,datasetIndex:a.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};class Er extends mt{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){const 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;const n=W(i.text)?i.text.length:1;this._padding=nt(i.padding);const r=n*J(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:n,right:r,options:a}=this,o=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=it(o,i,r),d=e+t,c=r-i):(a.position==="left"?(h=i+t,d=it(o,n,e),l=H*-.5):(h=r-t,d=it(o,e,n),l=H*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=J(e.font),r=i.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(r);Wt(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Fs(e.align),textBaseline:"middle",translation:[a,o]})}}function Pd(s,t){const e=new Er({ctx:s.ctx,options:t,chart:s});ut.configure(s,e,t),ut.addBox(s,e),s.titleBlock=e}var Td={id:"title",_element:Er,start(s,t,e){Pd(s,e)},stop(s){const t=s.titleBlock;ut.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){const i=s.titleBlock;ut.configure(s,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}};const Le={average(s){if(!s.length)return!1;let t,e,i=0,n=0,r=0;for(t=0,e=s.length;t<e;++t){const a=s[t].element;if(a&&a.hasValue()){const o=a.tooltipPosition();i+=o.x,n+=o.y,++r}}return{x:i/r,y:n/r}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,r,a,o;for(r=0,a=s.length;r<a;++r){const l=s[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=As(t,c);h<n&&(n=h,o=l)}}if(o){const l=o.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function yt(s,t){return t&&(W(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function Tt(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(`
`)>-1?s.split(`
`):s}function Sd(s,t){const{element:e,datasetIndex:i,index:n}=t,r=s.getDatasetMeta(i).controller,{label:a,value:o}=r.getLabelAndValue(n);return{chart:s,label:a,parsed:r.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:o,dataset:r.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function Ir(s,t){const e=s.chart.ctx,{body:i,footer:n,title:r}=s,{boxWidth:a,boxHeight:o}=t,l=J(t.bodyFont),c=J(t.titleFont),h=J(t.footerFont),d=r.length,u=n.length,f=i.length,g=nt(t.padding);let m=g.height,p=0,b=i.reduce((w,x)=>w+x.before.length+x.lines.length+x.after.length,0);if(b+=s.beforeBody.length+s.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const w=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;m+=f*w+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let _=0;const y=function(w){p=Math.max(p,e.measureText(w).width+_)};return e.save(),e.font=c.string,$(s.title,y),e.font=l.string,$(s.beforeBody.concat(s.afterBody),y),_=t.displayColors?a+2+t.boxPadding:0,$(i,w=>{$(w.before,y),$(w.lines,y),$(w.after,y)}),_=0,e.font=h.string,$(s.footer,y),e.restore(),p+=g.width,{width:p,height:m}}function Cd(s,t){const{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function Od(s,t,e,i){const{x:n,width:r}=i,a=e.caretSize+e.caretPadding;if(s==="left"&&n+r+a>t.width||s==="right"&&n-r-a<0)return!0}function Ld(s,t,e,i){const{x:n,width:r}=e,{width:a,chartArea:{left:o,right:l}}=s;let c="center";return i==="center"?c=n<=(o+l)/2?"left":"right":n<=r/2?c="left":n>=a-r/2&&(c="right"),Od(c,s,t,e)&&(c="center"),c}function $r(s,t,e){const i=e.yAlign||t.yAlign||Cd(s,e);return{xAlign:e.xAlign||t.xAlign||Ld(s,t,e,i),yAlign:i}}function Ad(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Rd(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function zr(s,t,e,i){const{caretSize:n,caretPadding:r,cornerRadius:a}=s,{xAlign:o,yAlign:l}=e,c=n+r,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Ht(a);let g=Ad(t,o);const m=Rd(t,l,c);return l==="center"?o==="left"?g+=c:o==="right"&&(g-=c):o==="left"?g-=Math.max(h,u)+n:o==="right"&&(g+=Math.max(d,f)+n),{x:st(g,0,i.width-t.width),y:st(m,0,i.height-t.height)}}function bs(s,t,e){const i=nt(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function Br(s){return yt([],Tt(s))}function Fd(s,t,e){return At(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Nr(s,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}class bi extends mt{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||t._chart,this._chart=this.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(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,r=new In(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=Fd(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,n=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),a=i.afterTitle.apply(this,[t]);let o=[];return o=yt(o,Tt(n)),o=yt(o,Tt(r)),o=yt(o,Tt(a)),o}getBeforeBody(t,e){return Br(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,n=[];return $(t,r=>{const a={before:[],lines:[],after:[]},o=Nr(i,r);yt(a.before,Tt(o.beforeLabel.call(this,r))),yt(a.lines,o.label.call(this,r)),yt(a.after,Tt(o.afterLabel.call(this,r))),n.push(a)}),n}getAfterBody(t,e){return Br(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,n=i.beforeFooter.apply(this,[t]),r=i.footer.apply(this,[t]),a=i.afterFooter.apply(this,[t]);let o=[];return o=yt(o,Tt(n)),o=yt(o,Tt(r)),o=yt(o,Tt(a)),o}_createItems(t){const e=this._active,i=this.chart.data,n=[],r=[],a=[];let o=[],l,c;for(l=0,c=e.length;l<c;++l)o.push(Sd(this.chart,e[l]));return t.filter&&(o=o.filter((h,d,u)=>t.filter(h,d,u,i))),t.itemSort&&(o=o.sort((h,d)=>t.itemSort(h,d,i))),$(o,h=>{const d=Nr(t.callbacks,h);n.push(d.labelColor.call(this,h)),r.push(d.labelPointStyle.call(this,h)),a.push(d.labelTextColor.call(this,h))}),this.labelColors=n,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=o,o}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let r,a=[];if(!n.length)this.opacity!==0&&(r={opacity:0});else{const o=Le[i.position].call(this,n,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);const l=this._size=Ir(this,i),c=Object.assign({},o,l),h=$r(this.chart,i,c),d=zr(i,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const r=this.getCaretPosition(t,i,n);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:r}=this,{caretSize:a,cornerRadius:o}=i,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Ht(o),{x:u,y:f}=t,{width:g,height:m}=e;let p,b,_,y,w,x;return r==="center"?(w=f+m/2,n==="left"?(p=u,b=p-a,y=w+a,x=w-a):(p=u+g,b=p+a,y=w-a,x=w+a),_=p):(n==="left"?b=u+Math.max(l,h)+a:n==="right"?b=u+g-Math.max(c,d)-a:b=this.caretX,r==="top"?(y=f,w=y-a,p=b-a,_=b+a):(y=f+m,w=y+a,p=b+a,_=b-a),x=y),{x1:p,x2:b,x3:_,y1:y,y2:w,y3:x}}drawTitle(t,e,i){const n=this.title,r=n.length;let a,o,l;if(r){const c=ie(i.rtl,this.x,this.width);for(t.x=bs(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=J(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<r;++l)e.fillText(n[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,l+1===r&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,n,r){const a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:c,boxPadding:h}=r,d=J(r.bodyFont),u=bs(this,"left",r),f=n.x(u),g=l<d.lineHeight?(d.lineHeight-l)/2:0,m=e.y+g;if(r.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},b=n.leftForLtr(f,c)+c/2,_=m+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Vs(t,p,b,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Vs(t,p,b,_)}else{t.lineWidth=A(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const p=n.leftForLtr(f,c-h),b=n.leftForLtr(n.xPlus(f,1),c-h-2),_=Ht(a.borderRadius);Object.values(_).some(y=>y!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,xe(t,{x:p,y:m,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),xe(t,{x:b,y:m+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(p,m,c,l),t.strokeRect(p,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(b,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:r,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:c,boxPadding:h}=i,d=J(i.bodyFont);let u=d.lineHeight,f=0;const g=ie(i.rtl,this.x,this.width),m=function(v){e.fillText(v,g.x(t.x+f),t.y+u/2),t.y+=u+r},p=g.textAlign(a);let b,_,y,w,x,D,M;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=bs(this,p,i),e.fillStyle=i.bodyColor,$(this.beforeBody,m),f=o&&p!=="right"?a==="center"?c/2+h:c+2+h:0,w=0,D=n.length;w<D;++w){for(b=n[w],_=this.labelTextColors[w],e.fillStyle=_,$(b.before,m),y=b.lines,o&&y.length&&(this._drawColorBox(e,t,w,g,i),u=Math.max(d.lineHeight,l)),x=0,M=y.length;x<M;++x)m(y[x]),u=d.lineHeight;$(b.after,m)}f=0,u=d.lineHeight,$(this.afterBody,m),t.y-=r}drawFooter(t,e,i){const n=this.footer,r=n.length;let a,o;if(r){const l=ie(i.rtl,this.x,this.width);for(t.x=bs(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=J(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<r;++o)e.fillText(n[o],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:r,yAlign:a}=this,{x:o,y:l}=t,{width:c,height:h}=i,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=Ht(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(o+d,l),a==="top"&&this.drawCaret(t,e,i,n),e.lineTo(o+c-u,l),e.quadraticCurveTo(o+c,l,o+c,l+u),a==="center"&&r==="right"&&this.drawCaret(t,e,i,n),e.lineTo(o+c,l+h-g),e.quadraticCurveTo(o+c,l+h,o+c-g,l+h),a==="bottom"&&this.drawCaret(t,e,i,n),e.lineTo(o+f,l+h),e.quadraticCurveTo(o,l+h,o,l+h-f),a==="center"&&r==="left"&&this.drawCaret(t,e,i,n),e.lineTo(o,l+d),e.quadraticCurveTo(o,l,o+d,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,r=i&&i.y;if(n||r){const a=Le[t.position].call(this,this._active,this._eventPosition);if(!a)return;const o=this._size=Ir(this,t),l=Object.assign({},a,this._size),c=$r(e,t,l),h=zr(t,l,c,e);(n._to!==h.x||r._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=nt(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,n,e),Tn(t,e.textDirection),r.y+=a.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),Sn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map(({datasetIndex:o,index:l})=>{const c=this.chart.getDatasetMeta(o);if(!c)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:c.data[l],index:l}}),r=!He(i,n),a=this._positionChanged(n,e);(r||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,r=this._active||[],a=this._getActiveElements(t,r,e,i),o=this._positionChanged(a,t),l=e||!He(a,r)||o;return l&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,n){const r=this.options;if(t.type==="mouseout")return[];if(!n)return e;const a=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:i,caretY:n,options:r}=this,a=Le[r.position].call(this,t,e);return a!==!1&&(i!==a.x||n!==a.y)}}bi.positioners=Le;var Ed={id:"tooltip",_element:bi,positioners:Le,afterInit(s,t,e){e&&(s.tooltip=new bi({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){const t=s.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",e)===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){const e=t.replay;s.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:(s,t)=>t.bodyFont.size,boxWidth:(s,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:{beforeTitle:kt,title(s){if(s.length>0){const t=s[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:kt,beforeBody:kt,beforeLabel:kt,label(s){if(this&&this.options&&this.options.mode==="dataset")return s.label+": "+s.formattedValue||s.formattedValue;let t=s.dataset.label||"";t&&(t+=": ");const e=s.formattedValue;return I(e)||(t+=e),t},labelColor(s){const e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.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(s){const e=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:kt,afterBody:kt,beforeFooter:kt,footer:kt,afterFooter:kt}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Id=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function $d(s,t,e,i){const n=s.indexOf(t);if(n===-1)return Id(s,t,e,i);const r=s.lastIndexOf(t);return n!==r?e:n}const zd=(s,t)=>s===null?null:st(Math.round(s),0,t);class _s extends qt{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:n,label:r}of e)i[n]===r&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(I(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:$d(i,t,O(e,t),this._addedLabels),zd(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]: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){const 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}}_s.id="category",_s.defaults={ticks:{callback:_s.prototype.getLabelForValue}};function Bd(s,t){const e=[],{bounds:n,step:r,min:a,max:o,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=s,f=r||1,g=h-1,{min:m,max:p}=t,b=!I(a),_=!I(o),y=!I(c),w=(p-m)/(d+1);let x=Hi((p-m)/g/f)*f,D,M,v,k;if(x<1e-14&&!b&&!_)return[{value:m},{value:p}];k=Math.ceil(p/x)-Math.floor(m/x),k>g&&(x=Hi(k*x/g/f)*f),I(l)||(D=Math.pow(10,l),x=Math.ceil(x*D)/D),n==="ticks"?(M=Math.floor(m/x)*x,v=Math.ceil(p/x)*x):(M=m,v=p),b&&_&&r&&Fo((o-a)/r,x/1e3)?(k=Math.round(Math.min((o-a)/x,h)),x=(o-a)/k,M=a,v=o):y?(M=b?a:M,v=_?o:v,k=c-1,x=(v-M)/k):(k=(v-M)/x,fe(k,Math.round(k),x/1e3)?k=Math.round(k):k=Math.ceil(k));const S=Math.max(Yi(x),Yi(M));D=Math.pow(10,I(l)?S:l),M=Math.round(M*D)/D,v=Math.round(v*D)/D;let F=0;for(b&&(u&&M!==a?(e.push({value:a}),M<a&&F++,fe(Math.round((M+F*x)*D)/D,a,Wr(a,w,s))&&F++):M<a&&F++);F<k;++F)e.push({value:Math.round((M+F*x)*D)/D});return _&&u&&v!==o?e.length&&fe(e[e.length-1].value,o,Wr(o,w,s))?e[e.length-1].value=o:e.push({value:o}):(!_||v===o)&&e.push({value:v}),e}function Wr(s,t,{horizontal:e,minRotation:i}){const n=ft(i),r=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+s).length;return Math.min(t/r,a)}class ys extends qt{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 I(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:r}=this;const a=l=>n=e?n:l,o=l=>r=i?r:l;if(t){const l=bt(n),c=bt(r);l<0&&c<0?o(0):l>0&&c>0&&a(0)}if(n===r){let l=1;(r>=Number.MAX_SAFE_INTEGER||n<=Number.MIN_SAFE_INTEGER)&&(l=Math.abs(r*.05)),o(r+l),t||a(n-l)}this.min=n,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={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},r=this._range||this,a=Bd(n,r);return t.bounds==="ticks"&&Vi(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(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return we(t,this.chart.options.locale,this.options.ticks.format)}}class _i extends ys{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?t:0,this.max=X(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=ft(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}_i.id="linear",_i.defaults={ticks:{callback:rs.formatters.numeric}};function Hr(s){return s/Math.pow(10,Math.floor(ht(s)))===1}function Nd(s,t){const e=Math.floor(ht(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),n=[];let r=lt(s.min,Math.pow(10,Math.floor(ht(t.min)))),a=Math.floor(ht(r)),o=Math.floor(r/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do n.push({value:r,major:Hr(r)}),++o,o===10&&(o=1,++a,l=a>=0?1:l),r=Math.round(o*Math.pow(10,a)*l)/l;while(a<e||a===e&&o<i);const c=lt(s.max,r);return n.push({value:c,major:Hr(r)}),n}class Vr extends qt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=ys.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return X(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?Math.max(0,t):null,this.max=X(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const r=l=>i=t?i:l,a=l=>n=e?n:l,o=(l,c)=>Math.pow(10,Math.floor(ht(l))+c);i===n&&(i<=0?(r(1),a(10)):(r(o(i,-1)),a(o(n,1)))),i<=0&&r(o(n,-1)),n<=0&&a(o(i,1)),this._zero&&this.min!==this._suggestedMin&&i===o(this.min,0)&&r(o(i,-1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=Nd(e,this);return t.bounds==="ticks"&&Vi(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":we(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ht(t),this._valueRange=ht(this.max)-ht(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ht(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}Vr.id="logarithmic",Vr.defaults={ticks:{callback:rs.formatters.logarithmic,major:{enabled:!0}}};function yi(s){const t=s.ticks;if(t.display&&s.display){const e=nt(t.backdropPadding);return O(t.font&&t.font.size,R.font.size)+e.height}return 0}function Wd(s,t,e){return e=W(e)?e:[e],{w:ul(s,t.string,e),h:e.length*t.lineHeight}}function Yr(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:s<i||s>n?{start:t-e,end:t}:{start:t,end:t+e}}function Hd(s){const t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],r=s._pointLabels.length,a=s.options.pointLabels,o=a.centerPointLabels?H/r:0;for(let l=0;l<r;l++){const c=a.setContext(s.getPointLabelContext(l));n[l]=c.padding;const h=s.getPointPosition(l,s.drawingArea+n[l],o),d=J(c.font),u=Wd(s.ctx,d,s._pointLabels[l]);i[l]=u;const f=ot(s.getIndexAngle(l)+o),g=Math.round(Ls(f)),m=Yr(g,h.x,u.w,0,180),p=Yr(g,h.y,u.h,90,270);Vd(e,t,f,m,p)}s.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),s._pointLabelItems=Yd(s,i,n)}function Vd(s,t,e,i,n){const r=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e));let o=0,l=0;i.start<t.l?(o=(t.l-i.start)/r,s.l=Math.min(s.l,t.l-o)):i.end>t.r&&(o=(i.end-t.r)/r,s.r=Math.max(s.r,t.r+o)),n.start<t.t?(l=(t.t-n.start)/a,s.t=Math.min(s.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/a,s.b=Math.max(s.b,t.b+l))}function Yd(s,t,e){const i=[],n=s._pointLabels.length,r=s.options,a=yi(r)/2,o=s.drawingArea,l=r.pointLabels.centerPointLabels?H/n:0;for(let c=0;c<n;c++){const h=s.getPointPosition(c,o+a+e[c],l),d=Math.round(Ls(ot(h.angle+j))),u=t[c],f=Ud(h.y,u.h,d),g=jd(d),m=qd(h.x,u.w,g);i.push({x:h.x,y:f,textAlign:g,left:m,top:f,right:m+u.w,bottom:f+u.h})}return i}function jd(s){return s===0||s===180?"center":s<180?"left":"right"}function qd(s,t,e){return e==="right"?s-=t:e==="center"&&(s-=t/2),s}function Ud(s,t,e){return e===90||e===270?s-=t/2:(e>270||e<90)&&(s-=t),s}function Xd(s,t){const{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){const r=i.setContext(s.getPointLabelContext(n)),a=J(r.font),{x:o,y:l,textAlign:c,left:h,top:d,right:u,bottom:f}=s._pointLabelItems[n],{backdropColor:g}=r;if(!I(g)){const m=Ht(r.borderRadius),p=nt(r.backdropPadding);e.fillStyle=g;const b=h-p.left,_=d-p.top,y=u-h+p.width,w=f-d+p.height;Object.values(m).some(x=>x!==0)?(e.beginPath(),xe(e,{x:b,y:_,w:y,h:w,radius:m}),e.fill()):e.fillRect(b,_,y,w)}Wt(e,s._pointLabels[n],o,l+a.lineHeight/2,a,{color:r.color,textAlign:c,textBaseline:"middle"})}}function jr(s,t,e,i){const{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,B);else{let r=s.getPointPosition(0,t);n.moveTo(r.x,r.y);for(let a=1;a<i;a++)r=s.getPointPosition(a,t),n.lineTo(r.x,r.y)}}function Gd(s,t,e,i){const n=s.ctx,r=t.circular,{color:a,lineWidth:o}=t;!r&&!i||!a||!o||e<0||(n.save(),n.strokeStyle=a,n.lineWidth=o,n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.beginPath(),jr(s,e,r,i),n.closePath(),n.stroke(),n.restore())}function Qd(s,t,e){return At(s,{label:e,index:t,type:"pointLabel"})}class xs extends ys{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=nt(yi(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(){const{min:t,max:e}=this.getMinMax(!1);this.min=X(t)&&!isNaN(t)?t:0,this.max=X(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/yi(this.options))}generateTickLabels(t){ys.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const n=N(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?Hd(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){const e=B/(this._pointLabels.length||1),i=this.options.startAngle||0;return ot(t*e+ft(i))}getDistanceFromCenterForValue(t){if(I(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(I(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Qd(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-j+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),jr(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n}=e,r=this._pointLabels.length;let a,o,l;if(e.pointLabels.display&&Xd(this,r),n.display&&this.ticks.forEach((c,h)=>{if(h!==0){o=this.getDistanceFromCenterForValue(c.value);const d=n.setContext(this.getContext(h-1));Gd(this,d,o,r)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const c=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=c;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,o=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(a,o),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let r,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),h=J(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,a=t.measureText(o.label).width,t.fillStyle=c.backdropColor;const d=nt(c.backdropPadding);t.fillRect(-a/2-d.left,-r-h.size/2-d.top,a+d.width,h.size+d.height)}Wt(t,o.label,0,-r,h,{color:c.color})}),t.restore()}drawTitle(){}}xs.id="radialLinear",xs.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:rs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(s){return s},padding:5,centerPointLabels:!1}},xs.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},xs.descriptors={angleLines:{_fallback:"grid"}};const ws={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}},at=Object.keys(ws);function Kd(s,t){return s-t}function qr(s,t){if(I(t))return null;const e=s._adapter,{parser:i,round:n,isoWeekday:r}=s._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),X(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(Jt(r)||r===!0)?e.startOf(a,"isoWeek",r):e.startOf(a,n)),+a)}function Ur(s,t,e,i){const n=at.length;for(let r=at.indexOf(s);r<n-1;++r){const a=ws[at[r]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(o*a.size))<=i)return at[r]}return at[n-1]}function Zd(s,t,e,i,n){for(let r=at.length-1;r>=at.indexOf(e);r--){const a=at[r];if(ws[a].common&&s._adapter.diff(n,i,a)>=t-1)return a}return at[e?at.indexOf(e):0]}function Jd(s){for(let t=at.indexOf(s)+1,e=at.length;t<e;++t)if(ws[at[t]].common)return at[t]}function Xr(s,t,e){if(!e)s[t]=!0;else if(e.length){const{lo:i,hi:n}=Rs(e,t),r=e[i]>=t?e[i]:e[n];s[r]=!0}}function tu(s,t,e,i){const n=s._adapter,r=+n.startOf(t[0].value,i),a=t[t.length-1].value;let o,l;for(o=r;o<=a;o=+n.add(o,1,i))l=e[o],l>=0&&(t[l].major=!0);return t}function Gr(s,t,e){const i=[],n={},r=t.length;let a,o;for(a=0;a<r;++a)o=t[a],n[o]=a,i.push({value:o,major:!1});return r===0||!e?i:tu(s,i,n,e)}class Ae extends qt{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){const i=t.time||(t.time={}),n=this._adapter=new Zn._date(t.adapters.date);n.init(e),de(i.displayFormats,n.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:qr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:r,minDefined:a,maxDefined:o}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!o&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!a||!o)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=X(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),r=X(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,r-1),this.max=Math.max(n+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const r=this.min,a=this.max,o=zo(n,r,a);return this._unit=e.unit||(i.autoSkip?Ur(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Zd(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Jd(this._unit),this.initOffsets(n),t.reverse&&o.reverse(),Gr(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t){let e=0,i=0,n,r;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;e=st(e,0,a),i=st(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,r=n.time,a=r.unit||Ur(r.minUnit,e,i,this._getLabelCapacity(e)),o=O(r.stepSize,1),l=a==="week"?r.isoWeekday:!1,c=Jt(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(i,e,a)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+a);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<i;u=+t.add(u,o,a),f++)Xr(h,u,g);return(u===i||n.bounds==="ticks"||f===1)&&Xr(h,u,g),Object.keys(h).sort((m,p)=>m-p).map(m=>+m)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,n){const r=this.options,a=r.time.displayFormats,o=this._unit,l=this._majorUnit,c=o&&a[o],h=l&&a[l],d=i[e],u=l&&h&&d&&d.major,f=this._adapter.format(t,n||(u?h:c)),g=r.ticks.callback;return g?N(g,[f,e,i],this):f}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=ft(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(n),a=Math.sin(n),o=this._resolveTickFontOptions(0).size;return{w:i*r+o*a,h:i*a+o*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,Gr(this,[t],this._majorUnit),n),a=this._getLabelSize(r),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e<i;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(qr(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xi(t.sort(Kd))}}Ae.id="time",Ae.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};function vs(s,t,e){let i=0,n=s.length-1,r,a,o,l;e?(t>=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=zt(s,"pos",t)),{pos:r,time:o}=s[i],{pos:a,time:l}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=zt(s,"time",t)),{time:r,pos:o}=s[i],{time:a,pos:l}=s[n]);const c=a-r;return c?o+(l-o)*(t-r)/c:o}class Qr extends Ae{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=vs(e,this.min),this._tableRange=vs(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],r=[];let a,o,l,c,h;for(a=0,o=t.length;a<o;++a)c=t[a],c>=e&&c<=i&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=n.length;a<o;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&r.push({time:c,pos:a/(o-1)});return r}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const 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(vs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return vs(this._table,i*this._tableRange+this._minPos,!0)}}Qr.id="timeseries",Qr.defaults=Ae.defaults;var pt;(function(s){s.ChartRendered="chart:rendered",s.ChartUpdated="chart:updated",s.ChartDestroyed="chart:destroyed",s.LabelsUpdated="labels:updated"})(pt||(pt={}));function ks(s,t,e,i){s(t,e)}function eu(s,t){s.update()}function Ms(s,t){s.destroy()}function su(s,t){const e={labels:typeof s.labels>"u"?[]:[...s.labels],datasets:[]};return Kr(e,{...s},t),e}function Kr(s,t,e){const i=[];s.datasets=t.datasets.map(n=>{const r=s.datasets.find(a=>a[e]===n[e]);return!r||!n.data||i.includes(r)?{...n}:(i.push(r),Object.assign(r,n),r)})}function iu(s,t,e){s.data.labels=t}function nu(s,t){s.options={...t}}function ru(s,t){const e=s.datasets.map(n=>n.label),i=t.datasets.map(n=>n.label);return t.datasets.length===s.datasets.length&&e.every((n,r)=>n===i[r])}const au="Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components",ou="annotation";function xi(s,t,e){let i={};return{props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,default:()=>{}},datasetIdKey:{type:String,default:"label"},chartId:{type:String,default:s},width:{type:Number,default:400},height:{type:Number,default:400},cssClasses:{type:String,default:""},styles:{type:Object,default:()=>{}},plugins:{type:Array,default:()=>[]}},data(){return{_chart:null,_id:Math.random().toString(36).substring(2)}},computed:{hasAnnotationPlugin(){var n,r;return typeof((n=this.chartOptions)===null||n===void 0||(r=n.plugins)===null||r===void 0?void 0:r[ou])<"u"}},created(){Oe.register(e)},mounted(){i[this.$data._id]=null,"datasets"in this.chartData&&this.chartData.datasets.length>0&&(ks(this.renderChart,this.chartData,this.chartOptions),this.$emit(pt.ChartRendered))},watch:{chartData:{handler:function(n,r){this.chartDataHandler(n,r)},deep:!0},chartOptions:{handler:function(n){this.chartOptionsHandler(n)},deep:!0}},methods:{renderChart(n,r){const a=this.getCurrentChart();if(a!==null&&(Ms(a),this.$emit(pt.ChartDestroyed)),this.$refs.canvas){const o=su(n,this.datasetIdKey),l=this.$refs.canvas.getContext("2d");l!==null&&this.setCurrentChart(new Oe(l,{type:t,data:o,options:r,plugins:this.plugins}))}else throw new Error(au)},chartDataHandler(n,r){const a={...n},o={...r},l=this.getCurrentChart();Object.keys(o).length>0?ru(a,o)&&l!==null?(Kr(l.data,a,this.datasetIdKey),a.labels!==void 0&&(iu(l,a.labels),this.$emit(pt.LabelsUpdated)),this.updateChart(),this.$emit(pt.ChartUpdated)):(l!==null&&(Ms(l),this.$emit(pt.ChartDestroyed)),ks(this.renderChart,this.chartData,this.chartOptions),this.$emit(pt.ChartRendered)):(l!==null&&(Ms(l),this.$emit(pt.ChartDestroyed)),ks(this.renderChart,this.chartData,this.chartOptions),this.$emit(pt.ChartRendered))},chartOptionsHandler(n){const r=this.getCurrentChart();r!==null?(nu(r,n),this.updateChart()):ks(this.renderChart,this.chartData,this.chartOptions)},updateChart(){const n=this.getCurrentChart();eu(n)},getCurrentChart(){return this.hasAnnotationPlugin?i[this.$data._id]:this.$data._chart},setCurrentChart(n){this.hasAnnotationPlugin?i[this.$data._id]=n:this.$data._chart=n}},beforeDestroy(){const n=this.getCurrentChart();n!==null&&(Ms(n),this.$emit(pt.ChartDestroyed))},render:function(n){return n("div",{style:this.styles,class:this.cssClasses},[n("canvas",{attrs:{id:this.chartId,width:this.width,height:this.height},ref:"canvas"})])}}}const lu=xi("bar-chart","bar",is),cu=xi("line-chart","line",ns),hu=xi("pie-chart","pie",ei),Zr=6048e5,du=864e5,Re=6e4,Fe=36e5,uu=1e3,Jr=Symbol.for("constructDateFrom");function q(s,t){return typeof s=="function"?s(t):s&&typeof s=="object"&&Jr in s?s[Jr](t):s instanceof Date?new s.constructor(t):new Date(t)}function T(s,t){return q(t||s,s)}function Ds(s,t,e){const i=T(s,e==null?void 0:e.in);return isNaN(t)?q((e==null?void 0:e.in)||s,NaN):(t&&i.setDate(i.getDate()+t),i)}function wi(s,t,e){const i=T(s,e==null?void 0:e.in);if(isNaN(t))return q(s,NaN);if(!t)return i;const n=i.getDate(),r=q(s,i.getTime());r.setMonth(i.getMonth()+t+1,0);const a=r.getDate();return n>=a?r:(i.setFullYear(r.getFullYear(),r.getMonth(),n),i)}function vi(s,t,e){return q(s,+T(s)+t)}function fu(s,t,e){return vi(s,t*Fe)}let gu={};function Xt(){return gu}function xt(s,t){var o,l,c,h;const e=Xt(),i=(t==null?void 0:t.weekStartsOn)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((h=(c=e.locale)==null?void 0:c.options)==null?void 0:h.weekStartsOn)??0,n=T(s,t==null?void 0:t.in),r=n.getDay(),a=(r<i?7:0)+r-i;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function re(s,t){return xt(s,{...t,weekStartsOn:1})}function ta(s,t){const e=T(s,t==null?void 0:t.in),i=e.getFullYear(),n=q(e,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const r=re(n),a=q(e,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const o=re(a);return e.getTime()>=r.getTime()?i+1:e.getTime()>=o.getTime()?i:i-1}function Ps(s){const t=T(s),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+s-+e}function Gt(s,...t){const e=q.bind(null,t.find(i=>typeof i=="object"));return t.map(e)}function ki(s,t){const e=T(s,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function ea(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t),r=ki(i),a=ki(n),o=+r-Ps(r),l=+a-Ps(a);return Math.round((o-l)/du)}function mu(s,t){const e=ta(s,t),i=q(s,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),re(i)}function pu(s,t,e){const i=T(s,e==null?void 0:e.in);return i.setTime(i.getTime()+t*Re),i}function bu(s,t,e){return wi(s,t*3,e)}function _u(s,t,e){return vi(s,t*1e3)}function yu(s,t,e){return Ds(s,t*7,e)}function xu(s,t,e){return wi(s,t*12,e)}function Ee(s,t){const e=+T(s)-+T(t);return e<0?-1:e>0?1:e}function wu(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function sa(s){return!(!wu(s)&&typeof s!="number"||isNaN(+T(s)))}function vu(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t),r=i.getFullYear()-n.getFullYear(),a=i.getMonth()-n.getMonth();return r*12+a}function ku(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t);return i.getFullYear()-n.getFullYear()}function ia(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t),r=na(i,n),a=Math.abs(ea(i,n));i.setDate(i.getDate()-r*a);const o=+(na(i,n)===-r),l=r*(a-o);return l===0?0:l}function na(s,t){const e=s.getFullYear()-t.getFullYear()||s.getMonth()-t.getMonth()||s.getDate()-t.getDate()||s.getHours()-t.getHours()||s.getMinutes()-t.getMinutes()||s.getSeconds()-t.getSeconds()||s.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Ie(s){return t=>{const i=(s?Math[s]:Math.trunc)(t);return i===0?0:i}}function Mu(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t),r=(+i-+n)/Fe;return Ie(e==null?void 0:e.roundingMethod)(r)}function Mi(s,t){return+T(s)-+T(t)}function Du(s,t,e){const i=Mi(s,t)/Re;return Ie(e==null?void 0:e.roundingMethod)(i)}function ra(s,t){const e=T(s,t==null?void 0:t.in);return e.setHours(23,59,59,999),e}function aa(s,t){const e=T(s,t==null?void 0:t.in),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}function Pu(s,t){const e=T(s,t==null?void 0:t.in);return+ra(e,t)==+aa(e,t)}function oa(s,t,e){const[i,n,r]=Gt(e==null?void 0:e.in,s,s,t),a=Ee(n,r),o=Math.abs(vu(n,r));if(o<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*o);let l=Ee(n,r)===-a;Pu(i)&&o===1&&Ee(i,r)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function Tu(s,t,e){const i=oa(s,t,e)/3;return Ie(e==null?void 0:e.roundingMethod)(i)}function Su(s,t,e){const i=Mi(s,t)/1e3;return Ie(e==null?void 0:e.roundingMethod)(i)}function Cu(s,t,e){const i=ia(s,t,e)/7;return Ie(e==null?void 0:e.roundingMethod)(i)}function Ou(s,t,e){const[i,n]=Gt(e==null?void 0:e.in,s,t),r=Ee(i,n),a=Math.abs(ku(i,n));i.setFullYear(1584),n.setFullYear(1584);const o=Ee(i,n)===-r,l=r*(a-+o);return l===0?0:l}function Lu(s,t){const e=T(s,t==null?void 0:t.in),i=e.getMonth(),n=i-i%3;return e.setMonth(n,1),e.setHours(0,0,0,0),e}function Au(s,t){const e=T(s,t==null?void 0:t.in);return e.setDate(1),e.setHours(0,0,0,0),e}function Ru(s,t){const e=T(s,t==null?void 0:t.in),i=e.getFullYear();return e.setFullYear(i+1,0,0),e.setHours(23,59,59,999),e}function la(s,t){const e=T(s,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}function Fu(s,t){const e=T(s,t==null?void 0:t.in);return e.setMinutes(59,59,999),e}function Eu(s,t){var o,l;const e=Xt(),i=e.weekStartsOn??((l=(o=e.locale)==null?void 0:o.options)==null?void 0:l.weekStartsOn)??0,n=T(s,t==null?void 0:t.in),r=n.getDay(),a=(r<i?-7:0)+6-(r-i);return n.setDate(n.getDate()+a),n.setHours(23,59,59,999),n}function Iu(s,t){const e=T(s,t==null?void 0:t.in);return e.setSeconds(59,999),e}function $u(s,t){const e=T(s,t==null?void 0:t.in),i=e.getMonth(),n=i-i%3+3;return e.setMonth(n,0),e.setHours(23,59,59,999),e}function zu(s,t){const e=T(s,t==null?void 0:t.in);return e.setMilliseconds(999),e}const Bu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Nu=(s,t,e)=>{let i;const n=Bu[s];return typeof n=="string"?i=n:t===1?i=n.one:i=n.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Di(s){return(t={})=>{const e=t.width?String(t.width):s.defaultWidth;return s.formats[e]||s.formats[s.defaultWidth]}}const Wu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Hu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Vu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Yu={date:Di({formats:Wu,defaultWidth:"full"}),time:Di({formats:Hu,defaultWidth:"full"}),dateTime:Di({formats:Vu,defaultWidth:"full"})},ju={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},qu=(s,t,e,i)=>ju[s];function $e(s){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let n;if(i==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,o=e!=null&&e.width?String(e.width):a;n=s.formattingValues[o]||s.formattingValues[a]}else{const a=s.defaultWidth,o=e!=null&&e.width?String(e.width):s.defaultWidth;n=s.values[o]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(t):t;return n[r]}}const Uu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Xu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Gu={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qu={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ku={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Zu={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ju={ordinalNumber:(s,t)=>{const e=Number(s),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:$e({values:Uu,defaultWidth:"wide"}),quarter:$e({values:Xu,defaultWidth:"wide",argumentCallback:s=>s-1}),month:$e({values:Gu,defaultWidth:"wide"}),day:$e({values:Qu,defaultWidth:"wide"}),dayPeriod:$e({values:Ku,defaultWidth:"wide",formattingValues:Zu,defaultFormattingWidth:"wide"})};function ze(s){return(t,e={})=>{const i=e.width,n=i&&s.matchPatterns[i]||s.matchPatterns[s.defaultMatchWidth],r=t.match(n);if(!r)return null;const a=r[0],o=i&&s.parsePatterns[i]||s.parsePatterns[s.defaultParseWidth],l=Array.isArray(o)?ef(o,d=>d.test(a)):tf(o,d=>d.test(a));let c;c=s.valueCallback?s.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const h=t.slice(a.length);return{value:c,rest:h}}}function tf(s,t){for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)&&t(s[e]))return e}function ef(s,t){for(let e=0;e<s.length;e++)if(t(s[e]))return e}function sf(s){return(t,e={})=>{const i=t.match(s.matchPattern);if(!i)return null;const n=i[0],r=t.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=e.valueCallback?e.valueCallback(a):a;const o=t.slice(n.length);return{value:a,rest:o}}}const nf=/^(\d+)(th|st|nd|rd)?/i,rf=/\d+/i,af={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},of={any:[/^b/i,/^(a|c)/i]},lf={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cf={any:[/1/i,/2/i,/3/i,/4/i]},hf={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},df={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},uf={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ff={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},gf={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},mf={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},pf={ordinalNumber:sf({matchPattern:nf,parsePattern:rf,valueCallback:s=>parseInt(s,10)}),era:ze({matchPatterns:af,defaultMatchWidth:"wide",parsePatterns:of,defaultParseWidth:"any"}),quarter:ze({matchPatterns:lf,defaultMatchWidth:"wide",parsePatterns:cf,defaultParseWidth:"any",valueCallback:s=>s+1}),month:ze({matchPatterns:hf,defaultMatchWidth:"wide",parsePatterns:df,defaultParseWidth:"any"}),day:ze({matchPatterns:uf,defaultMatchWidth:"wide",parsePatterns:ff,defaultParseWidth:"any"}),dayPeriod:ze({matchPatterns:gf,defaultMatchWidth:"any",parsePatterns:mf,defaultParseWidth:"any"})},ca={code:"en-US",formatDistance:Nu,formatLong:Yu,formatRelative:qu,localize:Ju,match:pf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function bf(s,t){const e=T(s,t==null?void 0:t.in);return ea(e,la(e))+1}function ha(s,t){const e=T(s,t==null?void 0:t.in),i=+re(e)-+mu(e);return Math.round(i/Zr)+1}function Pi(s,t){var h,d,u,f;const e=T(s,t==null?void 0:t.in),i=e.getFullYear(),n=Xt(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(u=n.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??1,a=q((t==null?void 0:t.in)||s,0);a.setFullYear(i+1,0,r),a.setHours(0,0,0,0);const o=xt(a,t),l=q((t==null?void 0:t.in)||s,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=xt(l,t);return+e>=+o?i+1:+e>=+c?i:i-1}function _f(s,t){var o,l,c,h;const e=Xt(),i=(t==null?void 0:t.firstWeekContainsDate)??((l=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((h=(c=e.locale)==null?void 0:c.options)==null?void 0:h.firstWeekContainsDate)??1,n=Pi(s,t),r=q((t==null?void 0:t.in)||s,0);return r.setFullYear(n,0,i),r.setHours(0,0,0,0),xt(r,t)}function da(s,t){const e=T(s,t==null?void 0:t.in),i=+xt(e,t)-+_f(e,t);return Math.round(i/Zr)+1}function z(s,t){const e=s<0?"-":"",i=Math.abs(s).toString().padStart(t,"0");return e+i}const It={y(s,t){const e=s.getFullYear(),i=e>0?e:1-e;return z(t==="yy"?i%100:i,t.length)},M(s,t){const e=s.getMonth();return t==="M"?String(e+1):z(e+1,2)},d(s,t){return z(s.getDate(),t.length)},a(s,t){const e=s.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(s,t){return z(s.getHours()%12||12,t.length)},H(s,t){return z(s.getHours(),t.length)},m(s,t){return z(s.getMinutes(),t.length)},s(s,t){return z(s.getSeconds(),t.length)},S(s,t){const e=t.length,i=s.getMilliseconds(),n=Math.trunc(i*Math.pow(10,e-3));return z(n,t.length)}},ae={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ua={G:function(s,t,e){const i=s.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(s,t,e){if(t==="yo"){const i=s.getFullYear(),n=i>0?i:1-i;return e.ordinalNumber(n,{unit:"year"})}return It.y(s,t)},Y:function(s,t,e,i){const n=Pi(s,i),r=n>0?n:1-n;if(t==="YY"){const a=r%100;return z(a,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):z(r,t.length)},R:function(s,t){const e=ta(s);return z(e,t.length)},u:function(s,t){const e=s.getFullYear();return z(e,t.length)},Q:function(s,t,e){const i=Math.ceil((s.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return z(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(s,t,e){const i=Math.ceil((s.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return z(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(s,t,e){const i=s.getMonth();switch(t){case"M":case"MM":return It.M(s,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(s,t,e){const i=s.getMonth();switch(t){case"L":return String(i+1);case"LL":return z(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(s,t,e,i){const n=da(s,i);return t==="wo"?e.ordinalNumber(n,{unit:"week"}):z(n,t.length)},I:function(s,t,e){const i=ha(s);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):z(i,t.length)},d:function(s,t,e){return t==="do"?e.ordinalNumber(s.getDate(),{unit:"date"}):It.d(s,t)},D:function(s,t,e){const i=bf(s);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):z(i,t.length)},E:function(s,t,e){const i=s.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(s,t,e,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return z(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(n,{width:"short",context:"formatting"});case"eeee":default:return e.day(n,{width:"wide",context:"formatting"})}},c:function(s,t,e,i){const n=s.getDay(),r=(n-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return z(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(n,{width:"narrow",context:"standalone"});case"cccccc":return e.day(n,{width:"short",context:"standalone"});case"cccc":default:return e.day(n,{width:"wide",context:"standalone"})}},i:function(s,t,e){const i=s.getDay(),n=i===0?7:i;switch(t){case"i":return String(n);case"ii":return z(n,t.length);case"io":return e.ordinalNumber(n,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(s,t,e){const n=s.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(s,t,e){const i=s.getHours();let n;switch(i===12?n=ae.noon:i===0?n=ae.midnight:n=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(s,t,e){const i=s.getHours();let n;switch(i>=17?n=ae.evening:i>=12?n=ae.afternoon:i>=4?n=ae.morning:n=ae.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(s,t,e){if(t==="ho"){let i=s.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return It.h(s,t)},H:function(s,t,e){return t==="Ho"?e.ordinalNumber(s.getHours(),{unit:"hour"}):It.H(s,t)},K:function(s,t,e){const i=s.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):z(i,t.length)},k:function(s,t,e){let i=s.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):z(i,t.length)},m:function(s,t,e){return t==="mo"?e.ordinalNumber(s.getMinutes(),{unit:"minute"}):It.m(s,t)},s:function(s,t,e){return t==="so"?e.ordinalNumber(s.getSeconds(),{unit:"second"}):It.s(s,t)},S:function(s,t){return It.S(s,t)},X:function(s,t,e){const i=s.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return ga(i);case"XXXX":case"XX":return Qt(i);case"XXXXX":case"XXX":default:return Qt(i,":")}},x:function(s,t,e){const i=s.getTimezoneOffset();switch(t){case"x":return ga(i);case"xxxx":case"xx":return Qt(i);case"xxxxx":case"xxx":default:return Qt(i,":")}},O:function(s,t,e){const i=s.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+fa(i,":");case"OOOO":default:return"GMT"+Qt(i,":")}},z:function(s,t,e){const i=s.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+fa(i,":");case"zzzz":default:return"GMT"+Qt(i,":")}},t:function(s,t,e){const i=Math.trunc(+s/1e3);return z(i,t.length)},T:function(s,t,e){return z(+s,t.length)}};function fa(s,t=""){const e=s>0?"-":"+",i=Math.abs(s),n=Math.trunc(i/60),r=i%60;return r===0?e+String(n):e+String(n)+t+z(r,2)}function ga(s,t){return s%60===0?(s>0?"-":"+")+z(Math.abs(s)/60,2):Qt(s,t)}function Qt(s,t=""){const e=s>0?"-":"+",i=Math.abs(s),n=z(Math.trunc(i/60),2),r=z(i%60,2);return e+n+t+r}const ma=(s,t)=>{switch(s){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},pa=(s,t)=>{switch(s){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ti={p:pa,P:(s,t)=>{const e=s.match(/(P+)(p+)?/)||[],i=e[1],n=e[2];if(!n)return ma(s,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",ma(i,t)).replace("{{time}}",pa(n,t))}},yf=/^D+$/,xf=/^Y+$/,wf=["D","DD","YY","YYYY"];function ba(s){return yf.test(s)}function _a(s){return xf.test(s)}function Si(s,t,e){const i=vf(s,t,e);if(console.warn(i),wf.includes(s))throw new RangeError(i)}function vf(s,t,e){const i=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const kf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Mf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Df=/^'([^]*?)'?$/,Pf=/''/g,Tf=/[a-zA-Z]/;function Sf(s,t,e){var h,d,u,f,g,m,p,b;const i=Xt(),n=(e==null?void 0:e.locale)??i.locale??ca,r=(e==null?void 0:e.firstWeekContainsDate)??((d=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((f=(u=i.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??1,a=(e==null?void 0:e.weekStartsOn)??((m=(g=e==null?void 0:e.locale)==null?void 0:g.options)==null?void 0:m.weekStartsOn)??i.weekStartsOn??((b=(p=i.locale)==null?void 0:p.options)==null?void 0:b.weekStartsOn)??0,o=T(s,e==null?void 0:e.in);if(!sa(o))throw new RangeError("Invalid time value");let l=t.match(Mf).map(_=>{const y=_[0];if(y==="p"||y==="P"){const w=Ti[y];return w(_,n.formatLong)}return _}).join("").match(kf).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const y=_[0];if(y==="'")return{isToken:!1,value:Cf(_)};if(ua[y])return{isToken:!0,value:_};if(y.match(Tf))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:_}});n.localize.preprocessor&&(l=n.localize.preprocessor(o,l));const c={firstWeekContainsDate:r,weekStartsOn:a,locale:n};return l.map(_=>{if(!_.isToken)return _.value;const y=_.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&_a(y)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&ba(y))&&Si(y,t,String(s));const w=ua[y[0]];return w(o,y,n.localize,c)}).join("")}function Cf(s){const t=s.match(Df);return t?t[1].replace(Pf,"'"):s}function Of(){return Object.assign({},Xt())}function Lf(s,t){const e=T(s,t==null?void 0:t.in).getDay();return e===0?7:e}function Af(s,t){const e=Rf(t)?new t(0):q(t,0);return e.setFullYear(s.getFullYear(),s.getMonth(),s.getDate()),e.setHours(s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),e}function Rf(s){var t;return typeof s=="function"&&((t=s.prototype)==null?void 0:t.constructor)===s}const Ff=10;class ya{constructor(){P(this,"subPriority",0)}validate(t,e){return!0}}class Ef extends ya{constructor(t,e,i,n,r){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=n,r&&(this.subPriority=r)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class If extends ya{constructor(e,i){super();P(this,"priority",Ff);P(this,"subPriority",-1);this.context=e||(n=>q(i,n))}set(e,i){return i.timestampIsSet?e:q(e,Af(e,this.context))}}class E{run(t,e,i,n){const r=this.parse(t,e,i,n);return r?{setter:new Ef(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(t,e,i){return!0}}class $f extends E{constructor(){super(...arguments);P(this,"priority",140);P(this,"incompatibleTokens",["R","u","t","T"])}parse(e,i,n){switch(i){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,i,n){return i.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}}const G={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},wt={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Q(s,t){return s&&{value:t(s.value),rest:s.rest}}function V(s,t){const e=t.match(s);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function vt(s,t){const e=t.match(s);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const i=e[1]==="+"?1:-1,n=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,a=e[5]?parseInt(e[5],10):0;return{value:i*(n*Fe+r*Re+a*uu),rest:t.slice(e[0].length)}}function xa(s){return V(G.anyDigitsSigned,s)}function U(s,t){switch(s){case 1:return V(G.singleDigit,t);case 2:return V(G.twoDigits,t);case 3:return V(G.threeDigits,t);case 4:return V(G.fourDigits,t);default:return V(new RegExp("^\\d{1,"+s+"}"),t)}}function Ts(s,t){switch(s){case 1:return V(G.singleDigitSigned,t);case 2:return V(G.twoDigitsSigned,t);case 3:return V(G.threeDigitsSigned,t);case 4:return V(G.fourDigitsSigned,t);default:return V(new RegExp("^-?\\d{1,"+s+"}"),t)}}function Ci(s){switch(s){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function wa(s,t){const e=t>0,i=e?t:1-t;let n;if(i<=50)n=s||100;else{const r=i+50,a=Math.trunc(r/100)*100,o=s>=r%100;n=s+a-(o?100:0)}return e?n:1-n}function va(s){return s%400===0||s%4===0&&s%100!==0}class zf extends E{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,i,n){const r=a=>({year:a,isTwoDigitYear:i==="yy"});switch(i){case"y":return Q(U(4,e),r);case"yo":return Q(n.ordinalNumber(e,{unit:"year"}),r);default:return Q(U(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,n){const r=e.getFullYear();if(n.isTwoDigitYear){const o=wa(n.year,r);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const a=!("era"in i)||i.era===1?n.year:1-n.year;return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}}class Bf extends E{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,i,n){const r=a=>({year:a,isTwoDigitYear:i==="YY"});switch(i){case"Y":return Q(U(4,e),r);case"Yo":return Q(n.ordinalNumber(e,{unit:"year"}),r);default:return Q(U(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,n,r){const a=Pi(e,r);if(n.isTwoDigitYear){const l=wa(n.year,a);return e.setFullYear(l,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),xt(e,r)}const o=!("era"in i)||i.era===1?n.year:1-n.year;return e.setFullYear(o,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),xt(e,r)}}class Nf extends E{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,i){return Ts(i==="R"?4:i.length,e)}set(e,i,n){const r=q(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),re(r)}}class Wf extends E{constructor(){super(...arguments);P(this,"priority",130);P(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,i){return Ts(i==="u"?4:i.length,e)}set(e,i,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}}class Hf extends E{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,n){switch(i){case"Q":case"QQ":return U(i.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=1&&i<=4}set(e,i,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}}class Vf extends E{constructor(){super(...arguments);P(this,"priority",120);P(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,n){switch(i){case"q":case"qq":return U(i.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=1&&i<=4}set(e,i,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}}class Yf extends E{constructor(){super(...arguments);P(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);P(this,"priority",110)}parse(e,i,n){const r=a=>a-1;switch(i){case"M":return Q(V(G.month,e),r);case"MM":return Q(U(2,e),r);case"Mo":return Q(n.ordinalNumber(e,{unit:"month"}),r);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=11}set(e,i,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class jf extends E{constructor(){super(...arguments);P(this,"priority",110);P(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,i,n){const r=a=>a-1;switch(i){case"L":return Q(V(G.month,e),r);case"LL":return Q(U(2,e),r);case"Lo":return Q(n.ordinalNumber(e,{unit:"month"}),r);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=11}set(e,i,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}function qf(s,t,e){const i=T(s,e==null?void 0:e.in),n=da(i,e)-t;return i.setDate(i.getDate()-n*7),T(i,e==null?void 0:e.in)}class Uf extends E{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,i,n){switch(i){case"w":return V(G.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return U(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,n,r){return xt(qf(e,n,r),r)}}function Xf(s,t,e){const i=T(s,e==null?void 0:e.in),n=ha(i,e)-t;return i.setDate(i.getDate()-n*7),i}class Gf extends E{constructor(){super(...arguments);P(this,"priority",100);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,i,n){switch(i){case"I":return V(G.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return U(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,n){return re(Xf(e,n))}}const Qf=[31,28,31,30,31,30,31,31,30,31,30,31],Kf=[31,29,31,30,31,30,31,31,30,31,30,31];class Zf extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"subPriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,i,n){switch(i){case"d":return V(G.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return U(i.length,e)}}validate(e,i){const n=e.getFullYear(),r=va(n),a=e.getMonth();return r?i>=1&&i<=Kf[a]:i>=1&&i<=Qf[a]}set(e,i,n){return e.setDate(n),e.setHours(0,0,0,0),e}}class Jf extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"subpriority",1);P(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,i,n){switch(i){case"D":case"DD":return V(G.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return U(i.length,e)}}validate(e,i){const n=e.getFullYear();return va(n)?i>=1&&i<=366:i>=1&&i<=365}set(e,i,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}}function Oi(s,t,e){var d,u,f,g;const i=Xt(),n=(e==null?void 0:e.weekStartsOn)??((u=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??i.weekStartsOn??((g=(f=i.locale)==null?void 0:f.options)==null?void 0:g.weekStartsOn)??0,r=T(s,e==null?void 0:e.in),a=r.getDay(),l=(t%7+7)%7,c=7-n,h=t<0||t>6?t-(a+c)%7:(l+c)%7-(a+c)%7;return Ds(r,h,e)}class tg extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,i,n){switch(i){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,n,r){return e=Oi(e,n,r),e.setHours(0,0,0,0),e}}class eg extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,i,n,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"e":case"ee":return Q(U(i.length,e),a);case"eo":return Q(n.ordinalNumber(e,{unit:"day"}),a);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,n,r){return e=Oi(e,n,r),e.setHours(0,0,0,0),e}}class sg extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,i,n,r){const a=o=>{const l=Math.floor((o-1)/7)*7;return(o+r.weekStartsOn+6)%7+l};switch(i){case"c":case"cc":return Q(U(i.length,e),a);case"co":return Q(n.ordinalNumber(e,{unit:"day"}),a);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=6}set(e,i,n,r){return e=Oi(e,n,r),e.setHours(0,0,0,0),e}}function ig(s,t,e){const i=T(s,e==null?void 0:e.in),n=Lf(i,e),r=t-n;return Ds(i,r,e)}class ng extends E{constructor(){super(...arguments);P(this,"priority",90);P(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,i,n){const r=a=>a===0?7:a;switch(i){case"i":case"ii":return U(i.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return Q(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return Q(n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return Q(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);case"iiii":default:return Q(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,i){return i>=1&&i<=7}set(e,i,n){return e=ig(e,n),e.setHours(0,0,0,0),e}}class rg extends E{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,i,n){switch(i){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,n){return e.setHours(Ci(n),0,0,0),e}}class ag extends E{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,i,n){switch(i){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,n){return e.setHours(Ci(n),0,0,0),e}}class og extends E{constructor(){super(...arguments);P(this,"priority",80);P(this,"incompatibleTokens",["a","b","t","T"])}parse(e,i,n){switch(i){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,n){return e.setHours(Ci(n),0,0,0),e}}class lg extends E{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,i,n){switch(i){case"h":return V(G.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return U(i.length,e)}}validate(e,i){return i>=1&&i<=12}set(e,i,n){const r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}}class cg extends E{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,i,n){switch(i){case"H":return V(G.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return U(i.length,e)}}validate(e,i){return i>=0&&i<=23}set(e,i,n){return e.setHours(n,0,0,0),e}}class hg extends E{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,i,n){switch(i){case"K":return V(G.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return U(i.length,e)}}validate(e,i){return i>=0&&i<=11}set(e,i,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}}class dg extends E{constructor(){super(...arguments);P(this,"priority",70);P(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,i,n){switch(i){case"k":return V(G.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return U(i.length,e)}}validate(e,i){return i>=1&&i<=24}set(e,i,n){const r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}}class ug extends E{constructor(){super(...arguments);P(this,"priority",60);P(this,"incompatibleTokens",["t","T"])}parse(e,i,n){switch(i){case"m":return V(G.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return U(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,n){return e.setMinutes(n,0,0),e}}class fg extends E{constructor(){super(...arguments);P(this,"priority",50);P(this,"incompatibleTokens",["t","T"])}parse(e,i,n){switch(i){case"s":return V(G.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return U(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,n){return e.setSeconds(n,0),e}}class gg extends E{constructor(){super(...arguments);P(this,"priority",30);P(this,"incompatibleTokens",["t","T"])}parse(e,i){const n=r=>Math.trunc(r*Math.pow(10,-i.length+3));return Q(U(i.length,e),n)}set(e,i,n){return e.setMilliseconds(n),e}}class mg extends E{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","x"])}parse(e,i){switch(i){case"X":return vt(wt.basicOptionalMinutes,e);case"XX":return vt(wt.basic,e);case"XXXX":return vt(wt.basicOptionalSeconds,e);case"XXXXX":return vt(wt.extendedOptionalSeconds,e);case"XXX":default:return vt(wt.extended,e)}}set(e,i,n){return i.timestampIsSet?e:q(e,e.getTime()-Ps(e)-n)}}class pg extends E{constructor(){super(...arguments);P(this,"priority",10);P(this,"incompatibleTokens",["t","T","X"])}parse(e,i){switch(i){case"x":return vt(wt.basicOptionalMinutes,e);case"xx":return vt(wt.basic,e);case"xxxx":return vt(wt.basicOptionalSeconds,e);case"xxxxx":return vt(wt.extendedOptionalSeconds,e);case"xxx":default:return vt(wt.extended,e)}}set(e,i,n){return i.timestampIsSet?e:q(e,e.getTime()-Ps(e)-n)}}class bg extends E{constructor(){super(...arguments);P(this,"priority",40);P(this,"incompatibleTokens","*")}parse(e){return xa(e)}set(e,i,n){return[q(e,n*1e3),{timestampIsSet:!0}]}}class _g extends E{constructor(){super(...arguments);P(this,"priority",20);P(this,"incompatibleTokens","*")}parse(e){return xa(e)}set(e,i,n){return[q(e,n),{timestampIsSet:!0}]}}const yg={G:new $f,y:new zf,Y:new Bf,R:new Nf,u:new Wf,Q:new Hf,q:new Vf,M:new Yf,L:new jf,w:new Uf,I:new Gf,d:new Zf,D:new Jf,E:new tg,e:new eg,c:new sg,i:new ng,a:new rg,b:new ag,B:new og,h:new lg,H:new cg,K:new hg,k:new dg,m:new ug,s:new fg,S:new gg,X:new mg,x:new pg,t:new bg,T:new _g},xg=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wg=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vg=/^'([^]*?)'?$/,kg=/''/g,Mg=/\S/,Dg=/[a-zA-Z]/;function Pg(s,t,e,i){var p,b,_,y,w,x,D,M;const n=()=>q((i==null?void 0:i.in)||e,NaN),r=Of(),a=(i==null?void 0:i.locale)??r.locale??ca,o=(i==null?void 0:i.firstWeekContainsDate)??((b=(p=i==null?void 0:i.locale)==null?void 0:p.options)==null?void 0:b.firstWeekContainsDate)??r.firstWeekContainsDate??((y=(_=r.locale)==null?void 0:_.options)==null?void 0:y.firstWeekContainsDate)??1,l=(i==null?void 0:i.weekStartsOn)??((x=(w=i==null?void 0:i.locale)==null?void 0:w.options)==null?void 0:x.weekStartsOn)??r.weekStartsOn??((M=(D=r.locale)==null?void 0:D.options)==null?void 0:M.weekStartsOn)??0;if(!t)return s?n():T(e,i==null?void 0:i.in);const c={firstWeekContainsDate:o,weekStartsOn:l,locale:a},h=[new If(i==null?void 0:i.in,e)],d=t.match(wg).map(v=>{const k=v[0];if(k in Ti){const S=Ti[k];return S(v,a.formatLong)}return v}).join("").match(xg),u=[];for(let v of d){!(i!=null&&i.useAdditionalWeekYearTokens)&&_a(v)&&Si(v,t,s),!(i!=null&&i.useAdditionalDayOfYearTokens)&&ba(v)&&Si(v,t,s);const k=v[0],S=yg[k];if(S){const{incompatibleTokens:F}=S;if(Array.isArray(F)){const Y=u.find(tt=>F.includes(tt.token)||tt.token===k);if(Y)throw new RangeError(`The format string mustn't contain \`${Y.fullToken}\` and \`${v}\` at the same time`)}else if(S.incompatibleTokens==="*"&&u.length>0)throw new RangeError(`The format string mustn't contain \`${v}\` and any other token at the same time`);u.push({token:k,fullToken:v});const L=S.run(s,v,a.match,c);if(!L)return n();h.push(L.setter),s=L.rest}else{if(k.match(Dg))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");if(v==="''"?v="'":k==="'"&&(v=Tg(v)),s.indexOf(v)===0)s=s.slice(v.length);else return n()}}if(s.length>0&&Mg.test(s))return n();const f=h.map(v=>v.priority).sort((v,k)=>k-v).filter((v,k,S)=>S.indexOf(v)===k).map(v=>h.filter(k=>k.priority===v).sort((k,S)=>S.subPriority-k.subPriority)).map(v=>v[0]);let g=T(e,i==null?void 0:i.in);if(isNaN(+g))return n();const m={};for(const v of f){if(!v.validate(g,c))return n();const k=v.set(g,m,c);Array.isArray(k)?(g=k[0],Object.assign(m,k[1])):g=k}return g}function Tg(s){return s.match(vg)[1].replace(kg,"'")}function Sg(s,t){const e=T(s,t==null?void 0:t.in);return e.setMinutes(0,0,0),e}function Cg(s,t){const e=T(s,t==null?void 0:t.in);return e.setSeconds(0,0),e}function Og(s,t){const e=T(s,t==null?void 0:t.in);return e.setMilliseconds(0),e}function Lg(s,t){const e=()=>q(t==null?void 0:t.in,NaN),i=(t==null?void 0:t.additionalDigits)??2,n=Eg(s);let r;if(n.date){const c=Ig(n.date,i);r=$g(c.restDateString,c.year)}if(!r||isNaN(+r))return e();const a=+r;let o=0,l;if(n.time&&(o=zg(n.time),isNaN(o)))return e();if(n.timezone){if(l=Bg(n.timezone),isNaN(l))return e()}else{const c=new Date(a+o),h=T(0,t==null?void 0:t.in);return h.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),h.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),h}return T(a+o+l,t==null?void 0:t.in)}const Ss={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Ag=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Rg=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Fg=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Eg(s){const t={},e=s.split(Ss.dateTimeDelimiter);let i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Ss.timeZoneDelimiter.test(t.date)&&(t.date=s.split(Ss.timeZoneDelimiter)[0],i=s.substr(t.date.length,s.length))),i){const n=Ss.timezone.exec(i);n?(t.time=i.replace(n[1],""),t.timezone=n[1]):t.time=i}return t}function Ig(s,t){const e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=s.match(e);if(!i)return{year:NaN,restDateString:""};const n=i[1]?parseInt(i[1]):null,r=i[2]?parseInt(i[2]):null;return{year:r===null?n:r*100,restDateString:s.slice((i[1]||i[2]).length)}}function $g(s,t){if(t===null)return new Date(NaN);const e=s.match(Ag);if(!e)return new Date(NaN);const i=!!e[4],n=Be(e[1]),r=Be(e[2])-1,a=Be(e[3]),o=Be(e[4]),l=Be(e[5])-1;if(i)return Yg(t,o,l)?Ng(t,o,l):new Date(NaN);{const c=new Date(0);return!Hg(t,r,a)||!Vg(t,n)?new Date(NaN):(c.setUTCFullYear(t,r,Math.max(n,a)),c)}}function Be(s){return s?parseInt(s):1}function zg(s){const t=s.match(Rg);if(!t)return NaN;const e=Li(t[1]),i=Li(t[2]),n=Li(t[3]);return jg(e,i,n)?e*Fe+i*Re+n*1e3:NaN}function Li(s){return s&&parseFloat(s.replace(",","."))||0}function Bg(s){if(s==="Z")return 0;const t=s.match(Fg);if(!t)return 0;const e=t[1]==="+"?-1:1,i=parseInt(t[2]),n=t[3]&&parseInt(t[3])||0;return qg(i,n)?e*(i*Fe+n*Re):NaN}function Ng(s,t,e){const i=new Date(0);i.setUTCFullYear(s,0,4);const n=i.getUTCDay()||7,r=(t-1)*7+e+1-n;return i.setUTCDate(i.getUTCDate()+r),i}const Wg=[31,null,31,30,31,30,31,31,30,31,30,31];function ka(s){return s%400===0||s%4===0&&s%100!==0}function Hg(s,t,e){return t>=0&&t<=11&&e>=1&&e<=(Wg[t]||(ka(s)?29:28))}function Vg(s,t){return t>=1&&t<=(ka(s)?366:365)}function Yg(s,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function jg(s,t,e){return s===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&s>=0&&s<25}function qg(s,t){return t>=0&&t<=59}/*!
* chartjs-adapter-date-fns v3.0.0
* https://www.chartjs.org
* (c) 2022 chartjs-adapter-date-fns Contributors
* Released under the MIT license
*/const Ug={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Zn._date.override({_id:"date-fns",formats:function(){return Ug},parse:function(s,t){if(s===null||typeof s>"u")return null;const e=typeof s;return e==="number"||s instanceof Date?s=T(s):e==="string"&&(typeof t=="string"?s=Pg(s,t,new Date,this.options):s=Lg(s,this.options)),sa(s)?s.getTime():null},format:function(s,t){return Sf(s,t,this.options)},add:function(s,t,e){switch(e){case"millisecond":return vi(s,t);case"second":return _u(s,t);case"minute":return pu(s,t);case"hour":return fu(s,t);case"day":return Ds(s,t);case"week":return yu(s,t);case"month":return wi(s,t);case"quarter":return bu(s,t);case"year":return xu(s,t);default:return s}},diff:function(s,t,e){switch(e){case"millisecond":return Mi(s,t);case"second":return Su(s,t);case"minute":return Du(s,t);case"hour":return Mu(s,t);case"day":return ia(s,t);case"week":return Cu(s,t);case"month":return oa(s,t);case"quarter":return Tu(s,t);case"year":return Ou(s,t);default:return 0}},startOf:function(s,t,e){switch(t){case"second":return Og(s);case"minute":return Cg(s);case"hour":return Sg(s);case"day":return ki(s);case"week":return xt(s);case"isoWeek":return xt(s,{weekStartsOn:+e});case"month":return Au(s);case"quarter":return Lu(s);case"year":return la(s);default:return s}},endOf:function(s,t){switch(t){case"second":return zu(s);case"minute":return Iu(s);case"hour":return Fu(s);case"day":return ra(s);case"week":return Eu(s);case"month":return aa(s);case"quarter":return $u(s);case"year":return Ru(s);default:return s}}}),Oe.register(Td,Ed,Dd,Ft,_i,_s,ms,Ae,vd,ps,gs);const Xg={mixins:[{props:{autoColorize:Boolean,autoGreyize:Boolean,fill:{type:[Boolean,String],default:!0},height:Number,showLegend:{type:Boolean,default:!0},stacked:Boolean,xTimeAxis:Boolean,xTitle:String,yVisitsAxis:Boolean,yTitle:String},data(){return{base64image:""}},computed:{chartColor(){if(typeof this.fill=="string"&&this.fill.length){const t=this.$library.colors.parseAs(this.fill,"hex");if(t!=null&&t.length)return t}const s=document.getElementById("chart-default-color-getter");if(s){const t=window.getComputedStyle(s),e=this.$library.colors.parseAs(t==null?void 0:t.color,"hex");if(e!=null&&e.length)return e}return"#313740"}},methods:{generateDatasetColor(s,t,e){var c,h;const n=((c=rt().theme)==null?void 0:c.current)=="dark";let r=0,a=n?40:60,o=this.autoGreyize?0:30;const l=((h=s.ss_uid)==null?void 0:h.split("/"))||[e];return l.forEach((d,u)=>{const f=u===0?t.filter(p=>!String(p).includes("/")):t.filter(p=>String(p).startsWith(l.slice(0,u).join("/"))),g=f.indexOf(s.ss_uid??e),m=Math.max(f.length,1);u===0?r=360/m*g:a+=(90-a)/m*g}),`hsl(${Math.round(r)}, ${o}%, ${Math.round(a)}%)`},generatePieColors(s){var r;const t=Math.max(s.length,1),n=((r=rt().theme)==null?void 0:r.current)=="dark"?40:60;return s.map((a,o)=>this.autoColorize?`hsl(${Math.round(360/t*o)}, 30%, ${n}%)`:`hsl(0, 0%, ${40+40/t*o}%)`)},prepareChartData(s,t,e){const i=s.map((n,r)=>n.ss_uid??r);return{labels:t,datasets:s.map((n,r)=>{const a={...n};return(this.autoColorize||this.autoGreyize)&&!a.backgroundColor&&(a.backgroundColor=e==="Pie"?this.generatePieColors(t):this.generateDatasetColor(a,i,r)),a})}},generateDownloadLink(s){var e;const t=(e=s==null?void 0:s._data)==null?void 0:e._chart;t!=null&&t.canvas&&(this.base64image=t.toBase64Image("image/png"))},buildChartOptions(){const s=this.deepMerge({},this.chartOptions,{animation:{onComplete:()=>this.generateDownloadLink(this.$refs.chart)},borderColor:"#1f1f1f",borderWidth:1,height:this.height,maintainAspectRatio:!1,datasets:{line:{borderWidth:0,pointRadius:0,pointHitRadius:3,pointHoverRadius:3}},plugins:{filler:{propagate:!0},legend:{maxHeight:75,display:this.showLegend},tooltip:{filter:t=>t.chart.data.datasets.length<=5||t.raw!==0}}});return this.fill&&(s.fill=!0,s.backgroundColor=this.chartColor),this.xTimeAxis&&(s.scales=s.scales||{},s.scales.xAxis={type:"time",time:{unit:"month",displayFormats:{month:"MMM yyyy"}},title:{display:!1,text:this.xTitle??this.$t("simplestats.chart.time")}},s.plugins.tooltip={callbacks:{title:function(t){let e=new Date(t[0].parsed.x);return Ii().dayjs(e).format("ddd D MMM YYYY")}}}),this.yVisitsAxis&&(s.scales=s.scales||{},s.scales.yAxis={...s.scales.yAxis||{},beginAtZero:!0,title:{display:!0,text:this.yTitle??this.$t("simplestats.chart.visits")},ticks:{stepSize:1}}),this.stacked&&(s.scales=s.scales||{},s.scales.yAxis=s.scales.yAxis||{},s.scales.yAxis.stacked=!0),this.showLegend===!1&&(s.plugins.legend={display:!1,title:{display:!1}}),s},deepMerge(s,...t){for(const e of t)if(!(!e||typeof e!="object"))for(const i in e){const n=e[i];s[i]=n&&typeof n=="object"&&!Array.isArray(n)?this.deepMerge(s[i]||{},n):n}return s}}}],components:{LineChart:cu,BarChart:lu,PieChart:hu},props:{label:String,type:{type:String,validator:s=>["Line","Bar","Pie"].includes(s)},chartData:{type:Array,default:()=>[]},chartLabels:{type:Array,default:()=>[]},chartOptions:{type:Object,default:()=>({})},download:{type:[String,Boolean],default:!1}},computed:{chartClass(){return`k-simplestats-chart k-simplestats-${this.type.toLowerCase()}-chart`},hasData(){return this.chartData.some(s=>Array.isArray(s.data)&&s.data.length)},fullChartData(){return this.prepareChartData(this.chartData,this.chartLabels,this.type)},fullChartOptions(){return this.buildChartOptions(this.chartOptions)},emptyText(){return this.chartData.length===0?this.$t("simplestats.chart.empty"):this.$t("simplestats.chart.nodatatimeframe")},emptyHeight(){const s=this.type==="Pie"?"--spacing-10":"--spacing-8";return`calc(${this.height}px + var(${s}))`},downloadFileName(){const s=new Date,t=`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`;return String(this.download||"MyChart.png").replace(".png",`-${t}.png`)}}};var Gg=function(){var t=this,e=t._self._c;return e("k-section",{class:t.chartClass,attrs:{label:t.label}},[t.download!==!1?e("a",{attrs:{slot:"options",download:t.downloadFileName,href:t.base64image},slot:"options"},[e("k-button",{attrs:{text:t.$t("simplestats.chart.download"),disabled:!t.base64image,icon:"download",size:"xs",variant:"filled"}})],1):t._e(),t.hasData?e(t.type+"Chart",{ref:"chart",tag:"Chart",staticClass:"k-simplestats-chart-wrapper",attrs:{"chart-data":t.fullChartData,"chart-options":t.fullChartOptions,height:t.height}}):e("k-empty",{style:{height:t.emptyHeight},attrs:{icon:t.isLoading?"loader":"chart",layout:"cards",text:t.emptyText}})],1)},Qg=[],Kg=et(Xg,Gg,Qg);const Zg=Kg.exports,Jg={props:{visible:{type:Boolean,default:!0}}};var tm=function(){var t=this,e=t._self._c;return t.visible?e("k-box",{attrs:{theme:"text"}},[e("k-text",{attrs:{size:"small"}},[e("h3",[t._v(t._s(t.$t("simplestats.disclaimer.title")))]),e("p",{domProps:{innerHTML:t._s(t.$t("simplestats.disclaimer.text"))}}),e("kbd",[t._v(t._s(t.$t("simplestats.disclaimer.dismiss")))])])],1):t._e()},em=[],sm=et(Jg,tm,em);const im=sm.exports,nm={props:{label:String,columns:Object,rows:{type:Array,default:()=>[]}},data(){return{searchTerm:"",showSearch:!1,sortBy:null,sortAsc:!0}},computed:{isSearchable(){return Object.values(this.columns).some(s=>s.search)},emptyText(){return this.searchTerm?this.$t("simplestats.table.filter.noresults"):this.$t("simplestats.table.empty")},searchableColumns(){return Object.entries(this.columns).filter(([,s])=>s.search).map(([s])=>s)},sortedFilteredRows(){const s=this.filterRows(this.rows);return this.sortRows(s)}},watch:{showSearch(s){s&&this.$nextTick(()=>{var t;(t=this.$refs.searchInput)==null||t.focus()})}},methods:{toggleSearch(){this.showSearch=!this.showSearch},filterRows(s){if(!this.searchTerm)return s;const t=this.searchTerm.toLowerCase();return s.filter(e=>{var i;return(i=e.slug)!=null&&i.toLowerCase().includes(t)?!0:this.searchableColumns.some(n=>{const r=e[n];return r==null||typeof r=="object"?!1:String(r).toLowerCase().includes(t)})})},sortRows(s){if(!this.sortBy)return s;const{type:t}=this.columns[this.sortBy];return[...s].sort((e,i)=>{const n=this.normalizeSortValue(e[this.sortBy],t),r=this.normalizeSortValue(i[this.sortBy],t);return n===r?0:(n>r?1:-1)*(this.sortAsc?1:-1)})},normalizeSortValue(s,t){return t==="number"||t==="percentage"?Number(s)||0:String(s??"").toLowerCase()},onHeaderClick({column:s,columnIndex:t}){if(s.sortable){if(this.sortBy!==t){this.sortBy=t,this.sortAsc=!0;return}this.sortAsc=!this.sortAsc}},onCellClick(s,t){this.$emit("row",s,t)}}};var rm=function(){var t=this,e=t._self._c;return e("k-section",{staticClass:"k-simplestats-filter-table",attrs:{label:t.label}},[t.isSearchable?e("k-button",{attrs:{slot:"options",icon:"filter",size:"xs",variant:"filled",text:t.$t("simplestats.table.filter")},on:{click:t.toggleSearch},slot:"options"}):t._e(),t.isSearchable&&t.showSearch?e("k-input",{ref:"searchInput",staticClass:"k-models-section-search",attrs:{icon:"search",type:"text",placeholder:t.$t("simplestats.table.filter.placeholder")},model:{value:t.searchTerm,callback:function(i){t.searchTerm=i},expression:"searchTerm"}}):t._e(),e("k-table",{attrs:{index:!1,columns:t.columns,rows:t.sortedFilteredRows,empty:t.emptyText},on:{header:t.onHeaderClick,cell:t.onCellClick}})],1)},am=[],om=et(nm,rm,am);const lm=om.exports,cm={mixins:[{methods:{resolveTextPreview(s){return{props:{column:s.column}}},resolveTogglePreview(){return{props:{field:{disabled:!0}}}},resolveTagsPreview(s){return{value:Array.isArray(s.value)?s.value:[]}},resolveFilesPreview(s){return{value:Array.isArray(s.value)?s.value:[{image:{icon:"file",back:"black",color:"white"},filename:s.value}]}},resolvePreview(s,t){const i={"k-text-field-preview":this.resolveTextPreview,"k-toggle-field-preview":this.resolveTogglePreview,"k-tags-field-preview":this.resolveTagsPreview,"k-files-field-preview":this.resolveFilesPreview}[s];return i?i(t):{}}}}],props:{label:String,rows:{type:Array,default:()=>[]}},computed:{previewData(){return this.rows.map(this.normalizeRow)}},methods:{normalizeRow(s){const t=s.preview||"k-text-field-preview",e=s.value,i=s.format?s.format(e):e,n=this.resolvePreview(t,{...s,value:i});return{...s,preview:t,value:n.value??i,props:n.props}}}};var hm=function(){var t=this,e=t._self._c;return e("k-section",{attrs:{label:t.label}},[e("div",{staticClass:"k-simplestats-info-table k-table"},[e("table",[e("tbody",t._l(t.previewData,function(i,n){return e("tr",{key:n},[e("th",{attrs:{"data-mobile":"true"}},[t._v(t._s(t.$t(i.label)))]),e("td",{staticClass:"k-table-cell",attrs:{"data-mobile":"true"}},[e(i.preview,t._b({tag:"preview",attrs:{value:i.value}},"preview",i.props,!1))],1)])}),0)])])])},dm=[],um=et(cm,hm,dm);const fm=um.exports,gm={props:{dateChoices:{type:Array,default:()=>[]},timePeriod:{type:String,default:"Monthly"},timeFormat:{type:String,default:"MMM YYYY"},initialViewPeriods:{type:Number,default:-1}},data(){return{dateFrom:"",dateTo:""}},mounted(){const s=this.dateChoices.length-1;this.dateFrom=this.dateChoices[0],this.dateTo=this.dateChoices[s],this.initialViewPeriods>0&&(this.dateFrom=this.dateChoices[Math.max(0,s-this.initialViewPeriods)])},computed:{fromOptions(){return this.mapOptions(this.dateFrom,this.dateTo,"from")},toOptions(){return this.mapOptions(this.dateFrom,this.dateTo,"to")}},methods:{formatDateLabel(s){if(!s)return"Select date";const t=this.timeFormat;return Ii().dayjs(s).format(t)},mapOptions(s,t,e){const i=this.dateChoices.indexOf(s),n=this.dateChoices.indexOf(t);return this.dateChoices.map((r,a)=>({value:r,text:this.formatDateLabel(r),disabled:e==="from"?n>=0&&a>n:i>=0&&a<i}))},onSelect(s,t){var e,i;if(!t||this[`date${this.capitalize(s)}`]===t){(e=this.$refs[`${s}Dropdown`])==null||e.close();return}this[`date${this.capitalize(s)}`]=t,(i=this.$refs[`${s}Dropdown`])==null||i.close(),this.update()},capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)},update(){this.$emit("change",{from:this.dateFrom,to:this.dateTo})}}};var mm=function(){var t=this,e=t._self._c;return e("k-button-group",{attrs:{layout:"collapsed"}},[e("k-button",{attrs:{dropdown:!0,text:t.formatDateLabel(t.dateFrom),icon:"calendar",size:"sm",variant:"filled"},on:{click:function(i){return t.$refs.fromDropdown.toggle()}}}),e("k-picklist-dropdown",{ref:"fromDropdown",attrs:{multiple:!1,options:t.fromOptions,search:{display:12},value:t.dateFrom},on:{input:function(i){return t.onSelect("from",i)}}}),e("k-icon",{attrs:{type:"expand-horizontal",alt:"to"}}),e("k-button",{attrs:{dropdown:!0,text:t.formatDateLabel(t.dateTo),icon:"calendar",size:"sm",variant:"filled"},on:{click:function(i){return t.$refs.toDropdown.toggle()}}}),e("k-picklist-dropdown",{ref:"toDropdown",attrs:{multiple:!1,options:t.toOptions,search:{display:12},value:t.dateTo},on:{input:function(i){return t.onSelect("to",i)}}})],1)},pm=[],bm=et(gm,mm,pm);const _m=bm.exports,ym={props:{value:Number,row:Object,column:Object},computed:{percentage(){return Math.min(100,Math.max(0,Math.round(this.value*100)))},cssVars(){return{"--percentage":`${this.percentage}%`,"--percentage-color":this.percentageColor}},percentageColor(){return this.percentage<25?"var(--color-red-600)":this.percentage<50?"var(--color-orange-600)":this.percentage<75?"var(--color-yellow-600)":"var(--color-green-600)"}}};var xm=function(){var t=this,e=t._self._c;return e("p",{staticClass:"k-percentage-field-preview k-text-field-preview",style:t.cssVars},[e("span",{staticClass:"track",attrs:{title:`${t.column.label}: ${t.percentage}%`}},[e("span",{staticClass:"fill"}),e("span",{staticClass:"percentage"},[t._v(" "+t._s(t.percentage)+"% ")])])])},wm=[],vm=et(ym,xm,wm);const km=vm.exports;panel.plugin("daandelange/simplestats",{components:{"k-percentage-field-preview":km,"k-simplestats-chart":Zg,"k-simplestats-disclaimer":im,"k-simplestats-filter-table":lm,"k-simplestats-info-table":fm,"k-simplestats-timespan":_m,"k-simplestats-view":Oa,"k-simplestats-visits-view":Ea,"k-simplestats-devices-view":Na,"k-simplestats-referrers-view":ja,"k-simplestats-info-view":Qa,"k-simplestats-info-config":eo,"k-simplestats-info-database":ao,"k-simplestats-info-testers":uo,"k-simplestats-info-visitors":bo,"k-simplestats-pagestats-drawer":ko},sections:{pagestats:We}})})();