@yoast/ai-insights-client 1.4.100 → 1.4.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -165,7 +165,57 @@ For testing purposes, the application includes a dev mode that allows manual tok
165
165
 
166
166
  When enabled, a "Dev mode token" section appears in the sidebar that provides a textarea for entering authentication tokens. Tokens are auto-saved after a 1-second debounce (there is no save button). This is useful for preview environments and testing scenarios.
167
167
 
168
- For more details, see [docs/dev-mode.md](./docs/dev-mode.md).
168
+ ## API Integration with Orval
169
+
170
+ This project uses [Orval](https://orval.dev/) to automatically generate type-safe API client code from our OpenAPI specification. This eliminates the need to manually write fetch or Axios calls and ensures our frontend stays in sync with backend API changes.
171
+
172
+ ### How Orval Works
173
+
174
+ Orval takes an OpenAPI specification file and converts it into TypeScript functions that can be consumed directly to perform API actions. The generated code includes:
175
+
176
+ - Typed Axios request functions
177
+ - TanStack Query hooks for data fetching
178
+ - TypeScript interfaces for request/response types
179
+ - Automatic error handling
180
+
181
+ ### Generated Code Location
182
+
183
+ The Orval output is generated into `/src/api/generated/`. While generated code typically wouldn't be committed to Git (like `node_modules`), we've chosen to commit these files to enable:
184
+
185
+ - Easy comparison of API changes during code review
186
+ - Tracking of API evolution over time
187
+ - Immediate availability for developers without requiring local generation
188
+
189
+ ### Development Workflow
190
+
191
+ #### Updating API Code
192
+
193
+ To pull the latest API changes from the backend:
194
+
195
+ ```bash
196
+ # Pull from local development server (localhost:8000)
197
+ yarn orval:dev
198
+
199
+ # Pull from production/staging API
200
+ yarn orval:prod
201
+ ```
202
+
203
+ Configuration can be found in `orval.config.ts`.
204
+
205
+ #### Code Review Guidelines
206
+
207
+ When reviewing changes in `/src/api/generated/`:
208
+
209
+ - Focus on high-level review to ensure new endpoints and schema changes are properly reflected
210
+ - Verify the changes align with the corresponding `ai-insights-api` branch
211
+ - Don't modify generated files directly - changes should come from API updates
212
+ - TypeScript compilation will catch most incompatibility issues
213
+
214
+ #### Best Practices
215
+
216
+ 1. **Always regenerate before merging**: Run `yarn orval:dev` after the API branch merges to main to capture all changes
217
+ 2. **Coordinate with backend**: Ensure the API branch is up-to-date when generating frontend code
218
+ 3. **Review systematically**: Check that new endpoints, modified schemas, and removed endpoints are properly reflected
169
219
 
170
220
  ## TypeScript Support
171
221
 
@@ -49,7 +49,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
49
49
  * Released under the MIT License
50
50
  */class J5{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,i){const s=n.listeners[i],a=n.duration;s.forEach(o=>o({chart:e,initial:n.initial,numSteps:a,currentStep:Math.min(r-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=u0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const s=r.items;let a=s.length-1,o=!1,l;for(;a>=0;--a)l=s[a],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),o=!0):(s[a]=s[s.length-1],s.pop());o&&(i.draw(),this._notify(i,r,e,"progress")),s.length||(r.running=!1,this._notify(i,r,e,"complete"),r.initial=!1),n+=s.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let i=r.length-1;for(;i>=0;--i)r[i].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Nn=new J5;const Qf="transparent",Z5={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=Rf(t||Qf),i=r.valid&&Rf(e||Qf);return i&&i.valid?i.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class $5{constructor(e,n,r,i){const s=n[r];i=Sa([e.to,i,s,e.from]);const a=Sa([e.from,s,i]);this._active=!0,this._fn=e.fn||Z5[e.type||typeof a],this._easing=xs[e.easing]||xs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],s=r-this._start,a=this._duration-s;this._start=r,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=Sa([e.to,n,i,e.from]),this._from=Sa([e.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,i=this._prop,s=this._from,a=this._loop,o=this._to;let l;if(this._active=s!==o&&(a||n<r),!this._active){this._target[i]=o,this._notify(!0);return}if(n<0){this._target[i]=s;return}l=n/r%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(s,o,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let i=0;i<r.length;i++)r[i][n]()}}class k0{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!Ce(e))return;const n=Object.keys(qe.animation),r=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!Ce(s))return;const a={};for(const o of n)a[o]=s[o];(Ue(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!r.has(o))&&r.set(o,a)})})}_animateOptions(e,n){const r=n.options,i=t6(e,r);if(!i)return[];const s=this._createAnimations(i,r);return r.$shared&&e6(e.options.$animations,r).then(()=>{e.options=r},()=>{}),s}_createAnimations(e,n){const r=this._properties,i=[],s=e.$animations||(e.$animations={}),a=Object.keys(n),o=Date.now();let l;for(l=a.length-1;l>=0;--l){const u=a[l];if(u.charAt(0)==="$")continue;if(u==="options"){i.push(...this._animateOptions(e,n));continue}const c=n[u];let f=s[u];const p=r.get(u);if(f)if(p&&f.active()){f.update(p,c,o);continue}else f.cancel();if(!p||!p.duration){e[u]=c;continue}s[u]=f=new $5(p,e,u,c),i.push(f)}return i}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return Nn.add(this._chart,r),!0}}function e6(t,e){const n=[],r=Object.keys(e);for(let i=0;i<r.length;i++){const s=t[r[i]];s&&s.active()&&n.push(s.wait())}return Promise.all(n)}function t6(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Gf(t,e){const n=t&&t.options||{},r=n.reverse,i=n.min===void 0?e:0,s=n.max===void 0?e:0;return{start:r?s:i,end:r?i:s}}function n6(t,e,n){if(n===!1)return!1;const r=Gf(t,n),i=Gf(e,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function r6(t){let e,n,r,i;return Ce(t)?(e=t.top,n=t.right,r=t.bottom,i=t.left):e=n=r=i=t,{top:e,right:n,bottom:r,left:i,disabled:t===!1}}function j0(t,e){const n=[],r=t._getSortedDatasetMetas(e);let i,s;for(i=0,s=r.length;i<s;++i)n.push(r[i].index);return n}function Yf(t,e,n,r={}){const i=t.keys,s=r.mode==="single";let a,o,l,u;if(e===null)return;let c=!1;for(a=0,o=i.length;a<o;++a){if(l=+i[a],l===n){if(c=!0,r.all)continue;break}u=t.values[l],nt(u)&&(s||e===0||Ii(e)===Ii(u))&&(e+=u)}return!c&&!r.all?0:e}function i6(t,e){const{iScale:n,vScale:r}=e,i=n.axis==="x"?"x":"y",s=r.axis==="x"?"x":"y",a=Object.keys(t),o=new Array(a.length);let l,u,c;for(l=0,u=a.length;l<u;++l)c=a[l],o[l]={[i]:c,[s]:t[c]};return o}function pl(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function s6(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function a6(t){const{min:e,max:n,minDefined:r,maxDefined:i}=t.getUserBounds();return{min:r?e:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function o6(t,e,n){const r=t[e]||(t[e]={});return r[n]||(r[n]={})}function Vf(t,e,n,r){for(const i of e.getMatchingVisibleMetas(r).reverse()){const s=t[i.index];if(n&&s>0||!n&&s<0)return i.index}return null}function Kf(t,e){const{chart:n,_cachedMeta:r}=t,i=n._stacks||(n._stacks={}),{iScale:s,vScale:a,index:o}=r,l=s.axis,u=a.axis,c=s6(s,a,r),f=e.length;let p;for(let h=0;h<f;++h){const y=e[h],{[l]:m,[u]:g}=y,v=y._stacks||(y._stacks={});p=v[u]=o6(i,c,m),p[o]=g,p._top=Vf(p,a,!0,r.type),p._bottom=Vf(p,a,!1,r.type);const S=p._visualValues||(p._visualValues={});S[o]=g}}function yl(t,e){const n=t.scales;return Object.keys(n).filter(r=>n[r].axis===e).shift()}function l6(t,e){return br(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function u6(t,e,n){return br(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function $i(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const i of e){const s=i._stacks;if(!s||s[r]===void 0||s[r][n]===void 0)return;delete s[r][n],s[r]._visualValues!==void 0&&s[r]._visualValues[n]!==void 0&&delete s[r]._visualValues[n]}}}const ml=t=>t==="reset"||t==="none",Xf=(t,e)=>e?t:Object.assign({},t),c6=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:j0(n,!0),values:null};class pi{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=pl(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&$i(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(f,p,h,y)=>f==="x"?p:f==="r"?y:h,s=n.xAxisID=Ae(r.xAxisID,yl(e,"x")),a=n.yAxisID=Ae(r.yAxisID,yl(e,"y")),o=n.rAxisID=Ae(r.rAxisID,yl(e,"r")),l=n.indexAxis,u=n.iAxisID=i(l,s,a,o),c=n.vAxisID=i(l,a,s,o);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(o),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Mf(this._data,this),e._stacked&&$i(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Ce(n)){const i=this._cachedMeta;this._data=i6(n,i)}else if(r!==n){if(r){Mf(r,this);const i=this._cachedMeta;$i(i),i._parsed=[]}n&&Object.isExtensible(n)&&HC(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const s=n._stacked;n._stacked=pl(n.vScale,n),n.stack!==r.stack&&(i=!0,$i(n),n.stack=r.stack),this._resyncElements(e),(i||s!==n._stacked)&&(Kf(this,n._parsed),n._stacked=pl(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:i}=this,{iScale:s,_stacked:a}=r,o=s.axis;let l=e===0&&n===i.length?!0:r._sorted,u=e>0&&r._parsed[e-1],c,f,p;if(this._parsing===!1)r._parsed=i,r._sorted=!0,p=i;else{Ue(i[e])?p=this.parseArrayData(r,i,e,n):Ce(i[e])?p=this.parseObjectData(r,i,e,n):p=this.parsePrimitiveData(r,i,e,n);const h=()=>f[o]===null||u&&f[o]<u[o];for(c=0;c<n;++c)r._parsed[c+e]=f=p[c],l&&(h()&&(l=!1),u=f);r._sorted=l}a&&Kf(this,p)}parsePrimitiveData(e,n,r,i){const{iScale:s,vScale:a}=e,o=s.axis,l=a.axis,u=s.getLabels(),c=s===a,f=new Array(i);let p,h,y;for(p=0,h=i;p<h;++p)y=p+r,f[p]={[o]:c||s.parse(u[y],y),[l]:a.parse(n[y],y)};return f}parseArrayData(e,n,r,i){const{xScale:s,yScale:a}=e,o=new Array(i);let l,u,c,f;for(l=0,u=i;l<u;++l)c=l+r,f=n[c],o[l]={x:s.parse(f[0],c),y:a.parse(f[1],c)};return o}parseObjectData(e,n,r,i){const{xScale:s,yScale:a}=e,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,u=new Array(i);let c,f,p,h;for(c=0,f=i;c<f;++c)p=c+r,h=n[p],u[c]={x:s.parse(zs(h,o),p),y:a.parse(zs(h,l),p)};return u}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,r){const i=this.chart,s=this._cachedMeta,a=n[e.axis],o={keys:j0(i,!0),values:n._stacks[e.axis]._visualValues};return Yf(o,a,s.index,{mode:r})}updateRangeFromParsed(e,n,r,i){const s=r[n.axis];let a=s===null?NaN:s;const o=i&&r._stacks[n.axis];i&&o&&(i.values=o,a=Yf(i,s,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,n){const r=this._cachedMeta,i=r._parsed,s=r._sorted&&e===r.iScale,a=i.length,o=this._getOtherScale(e),l=c6(n,r,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:f}=a6(o);let p,h;function y(){h=i[p];const m=h[o.axis];return!nt(h[e.axis])||c>m||f<m}for(p=0;p<a&&!(!y()&&(this.updateRangeFromParsed(u,e,h,l),s));++p);if(s){for(p=a-1;p>=0;--p)if(!y()){this.updateRangeFromParsed(u,e,h,l);break}}return u}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let i,s,a;for(i=0,s=n.length;i<s;++i)a=n[i][e.axis],nt(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,r=n.iScale,i=n.vScale,s=this.getParsed(e);return{label:r?""+r.getLabelForValue(s[r.axis]):"",value:i?""+i.getLabelForValue(s[i.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=r6(Ae(this.options.clip,n6(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,r=this._cachedMeta,i=r.data||[],s=n.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||i.length-o,u=this.options.drawActiveElementsOnTop;let c;for(r.dataset&&r.dataset.draw(e,s,o,l),c=o;c<o+l;++c){const f=i[c];f.hidden||(f.active&&u?a.push(f):f.draw(e,s))}for(c=0;c<a.length;++c)a[c].draw(e,s)}getStyle(e,n){const r=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(e||0,r)}getContext(e,n,r){const i=this.getDataset();let s;if(e>=0&&e<this._cachedMeta.data.length){const a=this._cachedMeta.data[e];s=a.$context||(a.$context=u6(this.getContext(),e,a)),s.parsed=this.getParsed(e),s.raw=i.data[e],s.index=s.dataIndex=e}else s=this.$context||(this.$context=l6(this.chart.getContext(),this.index)),s.dataset=i,s.index=s.datasetIndex=this.index;return s.active=!!n,s.mode=r,s}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",r){const i=n==="active",s=this._cachedDataOpts,a=e+"-"+n,o=s[a],l=this.enableOptionSharing&&uo(r);if(o)return Xf(o,l);const u=this.chart.config,c=u.datasetElementScopeKeys(this._type,e),f=i?[`${e}Hover`,"hover",e,""]:[e,""],p=u.getOptionScopes(this.getDataset(),c),h=Object.keys(qe.elements[e]),y=()=>this.getContext(r,i,n),m=u.resolveNamedOptions(p,h,y,f);return m.$shared&&(m.$shared=l,s[a]=Object.freeze(Xf(m,l))),m}_resolveAnimations(e,n,r){const i=this.chart,s=this._cachedDataOpts,a=`animation-${n}`,o=s[a];if(o)return o;let l;if(i.options.animation!==!1){const c=this.chart.config,f=c.datasetAnimationScopeKeys(this._type,n),p=c.getOptionScopes(this.getDataset(),f);l=c.createResolver(p,this.getContext(e,r,n))}const u=new k0(i,l&&l.animations);return l&&l._cacheable&&(s[a]=Object.freeze(u)),u}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||ml(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),i=this._sharedOptions,s=this.getSharedOptions(r),a=this.includeOptions(n,s)||s!==i;return this.updateSharedOptions(s,n,r),{sharedOptions:s,includeOptions:a}}updateElement(e,n,r,i){ml(i)?Object.assign(e,r):this._resolveAnimations(n,i).update(e,r)}updateSharedOptions(e,n,r){e&&!ml(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,i){e.active=i;const s=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(e,{options:!i&&this.getSharedOptions(s)||s})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[o,l,u]of this._syncList)this[o](l,u);this._syncList=[];const i=r.length,s=n.length,a=Math.min(s,i);a&&this.parse(0,a),s>i?this._insertElements(i,s-i,e):s<i&&this._removeElements(s,i-s)}_insertElements(e,n,r=!0){const i=this._cachedMeta,s=i.data,a=e+n;let o;const l=u=>{for(u.length+=n,o=u.length-1;o>=a;o--)u[o]=u[o-n]};for(l(s),o=e;o<a;++o)s[o]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,n),r&&this.updateElements(s,e,n,"reset")}updateElements(e,n,r,i){}_removeElements(e,n){const r=this._cachedMeta;if(this._parsing){const i=r._parsed.splice(e,n);r._stacked&&$i(r,i)}r.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,r,i]=e;this[n](r,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",e,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}he(pi,"defaults",{}),he(pi,"datasetElementType",null),he(pi,"dataElementType",null);class Ga extends pi{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const n=this._cachedMeta,{dataset:r,data:i=[],_dataset:s}=n,a=this.chart._animationsDisabled;let{start:o,count:l}=GC(n,i,a);this._drawStart=o,this._drawCount=l,YC(n)&&(o=0,l=i.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!s._decimated,r.points=i;const u=this.resolveDatasetElementOptions(e);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(r,void 0,{animated:!a,options:u},e),this.updateElements(i,o,l,e)}updateElements(e,n,r,i){const s=i==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:u}=this._cachedMeta,{sharedOptions:c,includeOptions:f}=this._getSharedOptions(n,i),p=a.axis,h=o.axis,{spanGaps:y,segment:m}=this.options,g=Us(y)?y:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||s||i==="none",S=n+r,j=e.length;let E=n>0&&this.getParsed(n-1);for(let A=0;A<j;++A){const w=e[A],x=v?w:{};if(A<n||A>=S){x.skip=!0;continue}const b=this.getParsed(A),L=Ne(b[h]),R=x[p]=a.getPixelForValue(b[p],A),I=x[h]=s||L?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,b,l):b[h],A);x.skip=isNaN(R)||isNaN(I)||L,x.stop=A>0&&Math.abs(b[p]-E[p])>g,m&&(x.parsed=b,x.raw=u.data[A]),f&&(x.options=c||this.resolveDataElementOptions(A,w.active?"active":i)),v||this.updateElement(w,A,x,i),E=b}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,r=n.options&&n.options.borderWidth||0,i=e.data||[];if(!i.length)return r;const s=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(r,s,a)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}he(Ga,"id","line"),he(Ga,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),he(Ga,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Ya extends pi{getLabelAndValue(e){const n=this._cachedMeta.vScale,r=this.getParsed(e);return{label:n.getLabels()[e],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(e,n,r,i){return k5.bind(this)(e,n,r,i)}update(e){const n=this._cachedMeta,r=n.dataset,i=n.data||[],s=n.iScale.getLabels();if(r.points=i,e!=="resize"){const a=this.resolveDatasetElementOptions(e);this.options.showLine||(a.borderWidth=0);const o={_loop:!0,_fullLoop:s.length===i.length,options:a};this.updateElement(r,void 0,o,e)}this.updateElements(i,0,i.length,e)}updateElements(e,n,r,i){const s=this._cachedMeta.rScale,a=i==="reset";for(let o=n;o<n+r;o++){const l=e[o],u=this.resolveDataElementOptions(o,l.active?"active":i),c=s.getPointPositionForValue(o,this.getParsed(o).r),f=a?s.xCenter:c.x,p=a?s.yCenter:c.y,h={x:f,y:p,angle:c.angle,skip:isNaN(f)||isNaN(p),options:u};this.updateElement(l,o,h,i)}}}he(Ya,"id","radar"),he(Ya,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),he(Ya,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});function kr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Lc{constructor(e){he(this,"options");this.options=e||{}}static override(e){Object.assign(Lc.prototype,e)}init(){}formats(){return kr()}parse(){return kr()}format(){return kr()}add(){return kr()}diff(){return kr()}startOf(){return kr()}endOf(){return kr()}}var d6={_date:Lc};function f6(t,e,n,r){const{controller:i,data:s,_sorted:a}=t,o=i._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(o&&e===o.axis&&e!=="r"&&a&&s.length){const u=o._reversePixels?zC:Mr;if(r){if(i._sharedOptions){const c=s[0],f=typeof c.getRange=="function"&&c.getRange(e);if(f){const p=u(s,e,n-f),h=u(s,e,n+f);return{lo:p.lo,hi:h.hi}}}}else{const c=u(s,e,n);if(l){const{vScale:f}=i._cachedMeta,{_parsed:p}=t,h=p.slice(0,c.lo+1).reverse().findIndex(m=>!Ne(m[f.axis]));c.lo-=Math.max(0,h);const y=p.slice(c.hi).findIndex(m=>!Ne(m[f.axis]));c.hi+=Math.max(0,y)}return c}}return{lo:0,hi:s.length-1}}function zo(t,e,n,r,i){const s=t.getSortedVisibleDatasetMetas(),a=n[e];for(let o=0,l=s.length;o<l;++o){const{index:u,data:c}=s[o],{lo:f,hi:p}=f6(s[o],e,a,i);for(let h=f;h<=p;++h){const y=c[h];y.skip||r(y,u,h)}}}function h6(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(r,i){const s=e?Math.abs(r.x-i.x):0,a=n?Math.abs(r.y-i.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(a,2))}}function gl(t,e,n,r,i){const s=[];return!i&&!t.isPointInArea(e)||zo(t,n,e,function(o,l,u){!i&&!qn(o,t.chartArea,0)||o.inRange(e.x,e.y,r)&&s.push({element:o,datasetIndex:l,index:u})},!0),s}function p6(t,e,n,r){let i=[];function s(a,o,l){const{startAngle:u,endAngle:c}=a.getProps(["startAngle","endAngle"],r),{angle:f}=DC(a,{x:e.x,y:e.y});o0(f,u,c)&&i.push({element:a,datasetIndex:o,index:l})}return zo(t,n,e,s),i}function y6(t,e,n,r,i,s){let a=[];const o=h6(n);let l=Number.POSITIVE_INFINITY;function u(c,f,p){const h=c.inRange(e.x,e.y,i);if(r&&!h)return;const y=c.getCenterPoint(i);if(!(!!s||t.isPointInArea(y))&&!h)return;const g=o(e,y);g<l?(a=[{element:c,datasetIndex:f,index:p}],l=g):g===l&&a.push({element:c,datasetIndex:f,index:p})}return zo(t,n,e,u),a}function vl(t,e,n,r,i,s){return!s&&!t.isPointInArea(e)?[]:n==="r"&&!r?p6(t,e,n,i):y6(t,e,n,r,i,s)}function Jf(t,e,n,r,i){const s=[],a=n==="x"?"inXRange":"inYRange";let o=!1;return zo(t,n,e,(l,u,c)=>{l[a]&&l[a](e[n],i)&&(s.push({element:l,datasetIndex:u,index:c}),o=o||l.inRange(e.x,e.y,i))}),r&&!o?[]:s}var m6={modes:{index(t,e,n,r){const i=Er(e,t),s=n.axis||"x",a=n.includeInvisible||!1,o=n.intersect?gl(t,i,s,r,a):vl(t,i,s,!1,r,a),l=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach(u=>{const c=o[0].index,f=u.data[c];f&&!f.skip&&l.push({element:f,datasetIndex:u.index,index:c})}),l):[]},dataset(t,e,n,r){const i=Er(e,t),s=n.axis||"xy",a=n.includeInvisible||!1;let o=n.intersect?gl(t,i,s,r,a):vl(t,i,s,!1,r,a);if(o.length>0){const l=o[0].datasetIndex,u=t.getDatasetMeta(l).data;o=[];for(let c=0;c<u.length;++c)o.push({element:u[c],datasetIndex:l,index:c})}return o},point(t,e,n,r){const i=Er(e,t),s=n.axis||"xy",a=n.includeInvisible||!1;return gl(t,i,s,r,a)},nearest(t,e,n,r){const i=Er(e,t),s=n.axis||"xy",a=n.includeInvisible||!1;return vl(t,i,s,n.intersect,r,a)},x(t,e,n,r){const i=Er(e,t);return Jf(t,i,"x",n.intersect,r)},y(t,e,n,r){const i=Er(e,t);return Jf(t,i,"y",n.intersect,r)}}};const E0=["left","top","right","bottom"];function es(t,e){return t.filter(n=>n.pos===e)}function Zf(t,e){return t.filter(n=>E0.indexOf(n.pos)===-1&&n.box.axis===e)}function ts(t,e){return t.sort((n,r)=>{const i=e?r:n,s=e?n:r;return i.weight===s.weight?i.index-s.index:i.weight-s.weight})}function g6(t){const e=[];let n,r,i,s,a,o;for(n=0,r=(t||[]).length;n<r;++n)i=t[n],{position:s,options:{stack:a,stackWeight:o=1}}=i,e.push({index:n,box:i,pos:s,horizontal:i.isHorizontal(),weight:i.weight,stack:a&&s+a,stackWeight:o});return e}function v6(t){const e={};for(const n of t){const{stack:r,pos:i,stackWeight:s}=n;if(!r||!E0.includes(i))continue;const a=e[r]||(e[r]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=s}return e}function b6(t,e){const n=v6(t),{vBoxMaxWidth:r,hBoxMaxHeight:i}=e;let s,a,o;for(s=0,a=t.length;s<a;++s){o=t[s];const{fullSize:l}=o.box,u=n[o.stack],c=u&&o.stackWeight/u.weight;o.horizontal?(o.width=c?c*r:l&&e.availableWidth,o.height=i):(o.width=r,o.height=c?c*i:l&&e.availableHeight)}return n}function x6(t){const e=g6(t),n=ts(e.filter(u=>u.box.fullSize),!0),r=ts(es(e,"left"),!0),i=ts(es(e,"right")),s=ts(es(e,"top"),!0),a=ts(es(e,"bottom")),o=Zf(e,"x"),l=Zf(e,"y");return{fullSize:n,leftAndTop:r.concat(s),rightAndBottom:i.concat(l).concat(a).concat(o),chartArea:es(e,"chartArea"),vertical:r.concat(i).concat(l),horizontal:s.concat(a).concat(o)}}function $f(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function O0(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function w6(t,e,n,r){const{pos:i,box:s}=n,a=t.maxPadding;if(!Ce(i)){n.size&&(t[i]-=n.size);const f=r[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?s.height:s.width),n.size=f.size/f.count,t[i]+=n.size}s.getPadding&&O0(a,s.getPadding());const o=Math.max(0,e.outerWidth-$f(a,t,"left","right")),l=Math.max(0,e.outerHeight-$f(a,t,"top","bottom")),u=o!==t.w,c=l!==t.h;return t.w=o,t.h=l,n.horizontal?{same:u,other:c}:{same:c,other:u}}function A6(t){const e=t.maxPadding;function n(r){const i=Math.max(e[r]-t[r],0);return t[r]+=i,i}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function S6(t,e){const n=e.maxPadding;function r(i){const s={left:0,top:0,right:0,bottom:0};return i.forEach(a=>{s[a]=Math.max(e[a],n[a])}),s}return r(t?["left","right"]:["top","bottom"])}function fs(t,e,n,r){const i=[];let s,a,o,l,u,c;for(s=0,a=t.length,u=0;s<a;++s){o=t[s],l=o.box,l.update(o.width||e.w,o.height||e.h,S6(o.horizontal,e));const{same:f,other:p}=w6(e,n,o,r);u|=f&&i.length,c=c||p,l.fullSize||i.push(o)}return u&&fs(i,e,n,r)||c}function ja(t,e,n,r,i){t.top=n,t.left=e,t.right=e+r,t.bottom=n+i,t.width=r,t.height=i}function eh(t,e,n,r){const i=n.padding;let{x:s,y:a}=e;for(const o of t){const l=o.box,u=r[o.stack]||{placed:0,weight:1},c=o.stackWeight/u.weight||1;if(o.horizontal){const f=e.w*c,p=u.size||l.height;uo(u.start)&&(a=u.start),l.fullSize?ja(l,i.left,a,n.outerWidth-i.right-i.left,p):ja(l,e.left+u.placed,a,f,p),u.start=a,u.placed+=f,a=l.bottom}else{const f=e.h*c,p=u.size||l.width;uo(u.start)&&(s=u.start),l.fullSize?ja(l,s,i.top,p,n.outerHeight-i.bottom-i.top):ja(l,s,e.top+u.placed,p,f),u.start=s,u.placed+=f,s=l.right}}e.x=s,e.y=a}var $t={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,r){if(!t)return;const i=lt(t.options.layout.padding),s=Math.max(e-i.width,0),a=Math.max(n-i.height,0),o=x6(t.boxes),l=o.vertical,u=o.horizontal;Le(t.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const c=l.reduce((m,g)=>g.box.options&&g.box.options.display===!1?m:m+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:n,padding:i,availableWidth:s,availableHeight:a,vBoxMaxWidth:s/2/c,hBoxMaxHeight:a/2}),p=Object.assign({},i);O0(p,lt(r));const h=Object.assign({maxPadding:p,w:s,h:a,x:i.left,y:i.top},i),y=b6(l.concat(u),f);fs(o.fullSize,h,f,y),fs(l,h,f,y),fs(u,h,f,y)&&fs(l,h,f,y),A6(h),eh(o.leftAndTop,h,f,y),h.x+=h.w,h.y+=h.h,eh(o.rightAndBottom,h,f,y),t.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},Le(o.chartArea,m=>{const g=m.box;Object.assign(g,t.chartArea),g.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class T0{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,i){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(e){return!0}updateConfig(e){}}class C6 extends T0{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Va="$chartjs",k6={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},th=t=>t===null||t==="";function j6(t,e){const n=t.style,r=t.getAttribute("height"),i=t.getAttribute("width");if(t[Va]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",th(i)){const s=Uf(t,"width");s!==void 0&&(t.width=s)}if(th(r))if(t.style.height==="")t.height=t.width/(e||2);else{const s=Uf(t,"height");s!==void 0&&(t.height=s)}return t}const P0=F5?{passive:!0}:!1;function E6(t,e,n){t&&t.addEventListener(e,n,P0)}function O6(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,P0)}function T6(t,e){const n=k6[t.type]||t.type,{x:r,y:i}=Er(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:i!==void 0?i:null}}function yo(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function P6(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let a=!1;for(const o of s)a=a||yo(o.addedNodes,r),a=a&&!yo(o.removedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function I6(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let a=!1;for(const o of s)a=a||yo(o.removedNodes,r),a=a&&!yo(o.addedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const Hs=new Map;let nh=0;function I0(){const t=window.devicePixelRatio;t!==nh&&(nh=t,Hs.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function M6(t,e){Hs.size||window.addEventListener("resize",I0),Hs.set(t,e)}function L6(t){Hs.delete(t),Hs.size||window.removeEventListener("resize",I0)}function N6(t,e,n){const r=t.canvas,i=r&&Mc(r);if(!i)return;const s=c0((o,l)=>{const u=i.clientWidth;n(o,l),u<i.clientWidth&&n()},window),a=new ResizeObserver(o=>{const l=o[0],u=l.contentRect.width,c=l.contentRect.height;u===0&&c===0||s(u,c)});return a.observe(i),M6(t,s),a}function bl(t,e,n){n&&n.disconnect(),e==="resize"&&L6(t)}function R6(t,e,n){const r=t.canvas,i=c0(s=>{t.ctx!==null&&n(T6(s,t))},t);return E6(r,e,i),i}class _6 extends T0{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(j6(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[Va])return!1;const r=n[Va].initial;["height","width"].forEach(s=>{const a=r[s];Ne(a)?n.removeAttribute(s):n.setAttribute(s,a)});const i=r.style||{};return Object.keys(i).forEach(s=>{n.style[s]=i[s]}),n.width=n.width,delete n[Va],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const i=e.$proxies||(e.$proxies={}),a={attach:P6,detach:I6,resize:N6}[n]||R6;i[n]=a(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),i=r[n];if(!i)return;({attach:bl,detach:bl,resize:bl}[n]||O6)(e,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,i){return B5(e,n,r,i)}isAttached(e){const n=e&&Mc(e);return!!(n&&n.isConnected)}}function D6(t){return!Ic()||typeof OffscreenCanvas!="undefined"&&t instanceof OffscreenCanvas?C6:_6}class Yn{constructor(){he(this,"x");he(this,"y");he(this,"active",!1);he(this,"options");he(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return Us(this.x)&&Us(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const i={};return e.forEach(s=>{i[s]=r[s]&&r[s].active()?r[s]._to:this[s]}),i}}he(Yn,"defaults",{}),he(Yn,"defaultRoutes");function B6(t,e){const n=t.options.ticks,r=F6(t),i=Math.min(n.maxTicksLimit||r,r),s=n.major.enabled?U6(e):[],a=s.length,o=s[0],l=s[a-1],u=[];if(a>i)return H6(e,u,s,a/i),u;const c=z6(s,e,i);if(a>0){let f,p;const h=a>1?Math.round((l-o)/(a-1)):null;for(Ea(e,u,c,Ne(h)?0:o-h,o),f=0,p=a-1;f<p;f++)Ea(e,u,c,s[f],s[f+1]);return Ea(e,u,c,l,Ne(h)?e.length:l+h),u}return Ea(e,u,c),u}function F6(t){const e=t.options.offset,n=t._tickSize(),r=t._length/n+(e?0:1),i=t._maxLength/n;return Math.floor(Math.min(r,i))}function z6(t,e,n){const r=q6(t),i=e.length/n;if(!r)return Math.max(i,1);const s=LC(r);for(let a=0,o=s.length-1;a<o;a++){const l=s[a];if(l>i)return l}return Math.max(i,1)}function U6(t){const e=[];let n,r;for(n=0,r=t.length;n<r;n++)t[n].major&&e.push(n);return e}function H6(t,e,n,r){let i=0,s=n[0],a;for(r=Math.ceil(r),a=0;a<t.length;a++)a===s&&(e.push(t[a]),i++,s=n[i*r])}function Ea(t,e,n,r,i){const s=Ae(r,0),a=Math.min(Ae(i,t.length),t.length);let o=0,l,u,c;for(n=Math.ceil(n),i&&(l=i-r,n=l/Math.floor(l/n)),c=s;c<0;)o++,c=Math.round(s+o*n);for(u=Math.max(s,0);u<a;u++)u===c&&(e.push(t[u]),o++,c=Math.round(s+o*n))}function q6(t){const e=t.length;let n,r;if(e<2)return!1;for(r=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==r)return!1;return r}const W6=t=>t==="left"?"right":t==="right"?"left":t,rh=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,ih=(t,e)=>Math.min(e||t,t);function sh(t,e){const n=[],r=t.length/e,i=t.length;let s=0;for(;s<i;s+=r)n.push(t[Math.floor(s)]);return n}function Q6(t,e,n){const r=t.ticks.length,i=Math.min(e,r-1),s=t._startPixel,a=t._endPixel,o=1e-6;let l=t.getPixelForTick(i),u;if(!(n&&(r===1?u=Math.max(l-s,a-l):e===0?u=(t.getPixelForTick(1)-l)/2:u=(l-t.getPixelForTick(i-1))/2,l+=i<e?u:-u,l<s-o||l>a+o)))return l}function G6(t,e){Le(t,n=>{const r=n.gc,i=r.length/2;let s;if(i>e){for(s=0;s<i;++s)delete n.data[r[s]];r.splice(0,i)}})}function ns(t){return t.drawTicks?t.tickLength:0}function ah(t,e){if(!t.display)return 0;const n=Je(t.font,e),r=lt(t.padding);return(Ue(t.text)?t.text.length:1)*n.lineHeight+r.height}function Y6(t,e){return br(t,{scale:e,type:"scale"})}function V6(t,e,n){return br(t,{tick:n,index:e,type:"tick"})}function K6(t,e,n){let r=kc(t);return(n&&e!=="right"||!n&&e==="right")&&(r=W6(r)),r}function X6(t,e,n,r){const{top:i,left:s,bottom:a,right:o,chart:l}=t,{chartArea:u,scales:c}=l;let f=0,p,h,y;const m=a-i,g=o-s;if(t.isHorizontal()){if(h=at(r,s,o),Ce(n)){const v=Object.keys(n)[0],S=n[v];y=c[v].getPixelForValue(S)+m-e}else n==="center"?y=(u.bottom+u.top)/2+m-e:y=rh(t,n,e);p=o-s}else{if(Ce(n)){const v=Object.keys(n)[0],S=n[v];h=c[v].getPixelForValue(S)-g+e}else n==="center"?h=(u.left+u.right)/2-g+e:h=rh(t,n,e);y=at(r,a,i),f=n==="left"?-Ht:Ht}return{titleX:h,titleY:y,maxWidth:p,rotation:f}}class Hi extends Yn{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:r,_suggestedMax:i}=this;return e=hn(e,Number.POSITIVE_INFINITY),n=hn(n,Number.NEGATIVE_INFINITY),r=hn(r,Number.POSITIVE_INFINITY),i=hn(i,Number.NEGATIVE_INFINITY),{min:hn(e,r),max:hn(n,i),minDefined:nt(e),maxDefined:nt(n)}}getMinMax(e){let{min:n,max:r,minDefined:i,maxDefined:s}=this.getUserBounds(),a;if(i&&s)return{min:n,max:r};const o=this.getMatchingVisibleMetas();for(let l=0,u=o.length;l<u;++l)a=o[l].controller.getMinMax(this,e),i||(n=Math.min(n,a.min)),s||(r=Math.max(r,a.max));return n=s&&n>r?r:n,r=i&&n>r?n:r,{min:hn(n,hn(r,n)),max:hn(r,hn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){_e(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:i,grace:s,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=y5(this,s,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o<this.ticks.length;this._convertTicksToLabels(l?sh(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=B6(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,e=!e),this._startPixel=n,this._endPixel=r,this._reversePixels=e,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){_e(this.options.afterUpdate,[this])}beforeSetDimensions(){_e(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(){_e(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),_e(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){_e(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let r,i,s;for(r=0,i=e.length;r<i;r++)s=e[r],s.label=_e(n.callback,[s.value,r,e],this)}afterTickToLabelConversion(){_e(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){_e(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,r=ih(this.ticks.length,e.ticks.maxTicksLimit),i=n.minRotation||0,s=n.maxRotation;let a=i,o,l,u;if(!this._isVisible()||!n.display||i>=s||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const c=this._getLabelSizes(),f=c.widest.width,p=c.highest.height,h=Zt(this.chart.width-f,0,this.maxWidth);o=e.offset?this.maxWidth/r:h/(r-1),f+6>o&&(o=h/(r-(e.offset?.5:1)),l=this.maxHeight-ns(e.grid)-n.padding-ah(e.title,this.chart.options.font),u=Math.sqrt(f*f+p*p),a=Sc(Math.min(Math.asin(Zt((c.highest.height+6)/o,-1,1)),Math.asin(Zt(l/u,-1,1))-Math.asin(Zt(p/u,-1,1)))),a=Math.max(i,Math.min(s,a))),this.labelRotation=a}afterCalculateLabelRotation(){_e(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){_e(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:s}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){const l=ah(i,n.options.font);if(o?(e.width=this.maxWidth,e.height=ns(s)+l):(e.height=this.maxHeight,e.width=ns(s)+l),r.display&&this.ticks.length){const{first:u,last:c,widest:f,highest:p}=this._getLabelSizes(),h=r.padding*2,y=dr(this.labelRotation),m=Math.cos(y),g=Math.sin(y);if(o){const v=r.mirror?0:g*f.width+m*p.height;e.height=Math.min(this.maxHeight,e.height+v+h)}else{const v=r.mirror?0:m*f.width+g*p.height;e.width=Math.min(this.maxWidth,e.width+v+h)}this._calculatePadding(u,c,g,m)}}this._handleMargins(),o?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,i){const{ticks:{align:s,padding:a},position:o}=this.options,l=this.labelRotation!==0,u=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const c=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,h=0;l?u?(p=i*e.width,h=r*n.height):(p=r*e.height,h=i*n.width):s==="start"?h=n.width:s==="end"?p=e.width:s!=="inner"&&(p=e.width/2,h=n.width/2),this.paddingLeft=Math.max((p-c+a)*this.width/(this.width-c),0),this.paddingRight=Math.max((h-f+a)*this.width/(this.width-f),0)}else{let c=n.height/2,f=e.height/2;s==="start"?(c=0,f=e.height):s==="end"&&(c=n.height,f=0),this.paddingTop=c+a,this.paddingBottom=f+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(){_e(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n<r;n++)Ne(e[n].label)&&(e.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=sh(r,n)),this._labelSizes=e=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,r){const{ctx:i,_longestTextCache:s}=this,a=[],o=[],l=Math.floor(n/ih(n,r));let u=0,c=0,f,p,h,y,m,g,v,S,j,E,A;for(f=0;f<n;f+=l){if(y=e[f].label,m=this._resolveTickFontOptions(f),i.font=g=m.string,v=s[g]=s[g]||{data:{},gc:[]},S=m.lineHeight,j=E=0,!Ne(y)&&!Ue(y))j=fo(i,v.data,v.gc,j,y),E=S;else if(Ue(y))for(p=0,h=y.length;p<h;++p)A=y[p],!Ne(A)&&!Ue(A)&&(j=fo(i,v.data,v.gc,j,A),E+=S);a.push(j),o.push(E),u=Math.max(j,u),c=Math.max(E,c)}G6(s,n);const w=a.indexOf(u),x=o.indexOf(c),b=L=>({width:a[L]||0,height:o[L]||0});return{first:b(0),last:b(n-1),widest:b(w),highest:b(x),widths:a,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return FC(this._alignToPixels?Cr(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const r=n[e];return r.$context||(r.$context=V6(this.getContext(),e,r))}return this.$context||(this.$context=Y6(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=dr(this.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),s=this._getLabelSizes(),a=e.autoSkipPadding||0,o=s?s.widest.width+a:0,l=s?s.highest.height+a:0;return this.isHorizontal()?l*r>o*i?o/r:l/i:l*i<o*r?l/r:o/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,r=this.chart,i=this.options,{grid:s,position:a,border:o}=i,l=s.offset,u=this.isHorizontal(),f=this.ticks.length+(l?1:0),p=ns(s),h=[],y=o.setContext(this.getContext()),m=y.display?y.width:0,g=m/2,v=function(B){return Cr(r,B,m)};let S,j,E,A,w,x,b,L,R,I,P,z;if(a==="top")S=v(this.bottom),x=this.bottom-p,L=S-g,I=v(e.top)+g,z=e.bottom;else if(a==="bottom")S=v(this.top),I=e.top,z=v(e.bottom)-g,x=S+g,L=this.top+p;else if(a==="left")S=v(this.right),w=this.right-p,b=S-g,R=v(e.left)+g,P=e.right;else if(a==="right")S=v(this.left),R=e.left,P=v(e.right)-g,w=S+g,b=this.left+p;else if(n==="x"){if(a==="center")S=v((e.top+e.bottom)/2+.5);else if(Ce(a)){const B=Object.keys(a)[0],_=a[B];S=v(this.chart.scales[B].getPixelForValue(_))}I=e.top,z=e.bottom,x=S+g,L=x+p}else if(n==="y"){if(a==="center")S=v((e.left+e.right)/2);else if(Ce(a)){const B=Object.keys(a)[0],_=a[B];S=v(this.chart.scales[B].getPixelForValue(_))}w=S-g,b=w-p,R=e.left,P=e.right}const N=Ae(i.ticks.maxTicksLimit,f),O=Math.max(1,Math.ceil(f/N));for(j=0;j<f;j+=O){const B=this.getContext(j),_=s.setContext(B),Y=o.setContext(B),G=_.lineWidth,C=_.color,W=Y.dash||[],q=Y.dashOffset,T=_.tickWidth,Q=_.tickColor,J=_.tickBorderDash||[],Z=_.tickBorderDashOffset;E=Q6(this,j,l),E!==void 0&&(A=Cr(r,E,G),u?w=b=R=P=A:x=L=I=z=A,h.push({tx1:w,ty1:x,tx2:b,ty2:L,x1:R,y1:I,x2:P,y2:z,width:G,color:C,borderDash:W,borderDashOffset:q,tickWidth:T,tickColor:Q,tickBorderDash:J,tickBorderDashOffset:Z}))}return this._ticksLength=f,this._borderValue=S,h}_computeLabelItems(e){const n=this.axis,r=this.options,{position:i,ticks:s}=r,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:u,padding:c,mirror:f}=s,p=ns(r.grid),h=p+c,y=f?-c:h,m=-dr(this.labelRotation),g=[];let v,S,j,E,A,w,x,b,L,R,I,P,z="middle";if(i==="top")w=this.bottom-y,x=this._getXAxisLabelAlignment();else if(i==="bottom")w=this.top+y,x=this._getXAxisLabelAlignment();else if(i==="left"){const O=this._getYAxisLabelAlignment(p);x=O.textAlign,A=O.x}else if(i==="right"){const O=this._getYAxisLabelAlignment(p);x=O.textAlign,A=O.x}else if(n==="x"){if(i==="center")w=(e.top+e.bottom)/2+h;else if(Ce(i)){const O=Object.keys(i)[0],B=i[O];w=this.chart.scales[O].getPixelForValue(B)+h}x=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")A=(e.left+e.right)/2-h;else if(Ce(i)){const O=Object.keys(i)[0],B=i[O];A=this.chart.scales[O].getPixelForValue(B)}x=this._getYAxisLabelAlignment(p).textAlign}n==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const N=this._getLabelSizes();for(v=0,S=o.length;v<S;++v){j=o[v],E=j.label;const O=s.setContext(this.getContext(v));b=this.getPixelForTick(v)+s.labelOffset,L=this._resolveTickFontOptions(v),R=L.lineHeight,I=Ue(E)?E.length:1;const B=I/2,_=O.color,Y=O.textStrokeColor,G=O.textStrokeWidth;let C=x;a?(A=b,x==="inner"&&(v===S-1?C=this.options.reverse?"left":"right":v===0?C=this.options.reverse?"right":"left":C="center"),i==="top"?u==="near"||m!==0?P=-I*R+R/2:u==="center"?P=-N.highest.height/2-B*R+R:P=-N.highest.height+R/2:u==="near"||m!==0?P=R/2:u==="center"?P=N.highest.height/2-B*R:P=N.highest.height-I*R,f&&(P*=-1),m!==0&&!O.showLabelBackdrop&&(A+=R/2*Math.sin(m))):(w=b,P=(1-I)*R/2);let W;if(O.showLabelBackdrop){const q=lt(O.backdropPadding),T=N.heights[v],Q=N.widths[v];let J=P-q.top,Z=0-q.left;switch(z){case"middle":J-=T/2;break;case"bottom":J-=T;break}switch(x){case"center":Z-=Q/2;break;case"right":Z-=Q;break;case"inner":v===S-1?Z-=Q:v>0&&(Z-=Q/2);break}W={left:Z,top:J,width:Q+q.width,height:T+q.height,color:O.backdropColor}}g.push({label:E,font:L,textOffset:P,options:{rotation:m,color:_,strokeColor:Y,strokeWidth:G,textAlign:C,textBaseline:z,translation:[A,w],backdrop:W}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-dr(this.labelRotation))return e==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:i,padding:s}}=this.options,a=this._getLabelSizes(),o=e+s,l=a.widest.width;let u,c;return n==="left"?i?(c=this.right+s,r==="near"?u="left":r==="center"?(u="center",c+=l/2):(u="right",c+=l)):(c=this.right-o,r==="near"?u="right":r==="center"?(u="center",c-=l/2):(u="left",c=this.left)):n==="right"?i?(c=this.left+s,r==="near"?u="right":r==="center"?(u="center",c-=l/2):(u="left",c-=l)):(c=this.left+o,r==="near"?u="left":r==="center"?(u="center",c+=l/2):(u="right",c=this.right)):u="right",{textAlign:u,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:i,width:s,height:a}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,i,s,a),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(s=>s.value===e);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,a;const o=(l,u,c)=>{!c.width||!c.color||(r.save(),r.lineWidth=c.width,r.strokeStyle=c.color,r.setLineDash(c.borderDash||[]),r.lineDashOffset=c.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(u.x,u.y),r.stroke(),r.restore())};if(n.display)for(s=0,a=i.length;s<a;++s){const l=i[s];n.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.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:e,ctx:n,options:{border:r,grid:i}}=this,s=r.setContext(this.getContext()),a=r.display?s.width:0;if(!a)return;const o=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let u,c,f,p;this.isHorizontal()?(u=Cr(e,this.left,a)-a/2,c=Cr(e,this.right,o)+o/2,f=p=l):(f=Cr(e,this.top,a)-a/2,p=Cr(e,this.bottom,o)+o/2,u=c=l),n.save(),n.lineWidth=s.width,n.strokeStyle=s.color,n.beginPath(),n.moveTo(u,f),n.lineTo(c,p),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const r=this.ctx,i=this._computeLabelArea();i&&Do(r,i);const s=this.getLabelItems(e);for(const a of s){const o=a.options,l=a.font,u=a.label,c=a.textOffset;Jr(r,u,0,c,l,o)}i&&Bo(r)}drawTitle(){const{ctx:e,options:{position:n,title:r,reverse:i}}=this;if(!r.display)return;const s=Je(r.font),a=lt(r.padding),o=r.align;let l=s.lineHeight/2;n==="bottom"||n==="center"||Ce(n)?(l+=a.bottom,Ue(r.text)&&(l+=s.lineHeight*(r.text.length-1))):l+=a.top;const{titleX:u,titleY:c,maxWidth:f,rotation:p}=X6(this,l,n,o);Jr(e,r.text,0,0,s,{color:r.color,maxWidth:f,rotation:p,textAlign:K6(o,n,i),textBaseline:"middle",translation:[u,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,r=Ae(e.grid&&e.grid.z,-1),i=Ae(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Hi.prototype.draw?[{z:n,draw:s=>{this.draw(s)}}]:[{z:r,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let s,a;for(s=0,a=n.length;s<a;++s){const o=n[s];o[r]===this.id&&(!e||o.type===e)&&i.push(o)}return i}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return Je(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Oa{constructor(e,n,r){this.type=e,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let r;$6(n)&&(r=this.register(n));const i=this.items,s=e.id,a=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+e);return s in i||(i[s]=e,J6(e,a,r),this.override&&qe.override(e.id,e.overrides)),a}get(e){return this.items[e]}unregister(e){const n=this.items,r=e.id,i=this.scope;r in n&&delete n[r],i&&r in qe[i]&&(delete qe[i][r],this.override&&delete Xr[r])}}function J6(t,e,n){const r=Fs(Object.create(null),[n?qe.get(n):{},qe.get(e),t.defaults]);qe.set(e,r),t.defaultRoutes&&Z6(e,t.defaultRoutes),t.descriptors&&qe.describe(e,t.descriptors)}function Z6(t,e){Object.keys(e).forEach(n=>{const r=n.split("."),i=r.pop(),s=[t].concat(r).join("."),a=e[n].split("."),o=a.pop(),l=a.join(".");qe.route(s,i,l,o)})}function $6(t){return"id"in t&&"defaults"in t}class e4{constructor(){this.controllers=new Oa(pi,"datasets",!0),this.elements=new Oa(Yn,"elements"),this.plugins=new Oa(Object,"plugins"),this.scales=new Oa(Hi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(i=>{const s=r||this._getRegistryForType(i);r||s.isForType(i)||s===this.plugins&&i.id?this._exec(e,s,i):Le(i,a=>{const o=r||this._getRegistryForType(a);this._exec(e,o,a)})})}_exec(e,n,r){const i=Ac(e);_e(r["before"+i],[],r),n[e](r),_e(r["after"+i],[],r)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(e))return r}return this.plugins}_get(e,n,r){const i=n.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+r+".");return i}}var mn=new e4;class t4{constructor(){this._init=void 0}notify(e,n,r,i){if(n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const s=i?this._descriptors(e).filter(i):this._descriptors(e),a=this._notify(s,e,n,r);return n==="afterDestroy"&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),a}_notify(e,n,r,i){i=i||{};for(const s of e){const a=s.plugin,o=a[r],l=[n,i,s.options];if(_e(o,l,a)===!1&&i.cancelable)return!1}return!0}invalidate(){Ne(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const r=e&&e.config,i=Ae(r.options&&r.options.plugins,{}),s=n4(r);return i===!1&&!n?[]:i4(e,s,i,n)}_notifyStateChanges(e){const n=this._oldCache||[],r=this._cache,i=(s,a)=>s.filter(o=>!a.some(l=>o.plugin.id===l.plugin.id));this._notify(i(n,r),e,"stop"),this._notify(i(r,n),e,"start")}}function n4(t){const e={},n=[],r=Object.keys(mn.plugins.items);for(let s=0;s<r.length;s++)n.push(mn.getPlugin(r[s]));const i=t.plugins||[];for(let s=0;s<i.length;s++){const a=i[s];n.indexOf(a)===-1&&(n.push(a),e[a.id]=!0)}return{plugins:n,localIds:e}}function r4(t,e){return!e&&t===!1?null:t===!0?{}:t}function i4(t,{plugins:e,localIds:n},r,i){const s=[],a=t.getContext();for(const o of e){const l=o.id,u=r4(r[l],i);u!==null&&s.push({plugin:o,options:s4(t.config,{plugin:o,local:n[l]},u,a)})}return s}function s4(t,{plugin:e,local:n},r,i){const s=t.pluginScopeKeys(e),a=t.getOptionScopes(r,s);return n&&e.defaults&&a.push(e.defaults),t.createResolver(a,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ku(t,e){const n=qe.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function a4(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function o4(t,e){return t===e?"_index_":"_value_"}function oh(t){if(t==="x"||t==="y"||t==="r")return t}function l4(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function ju(t,...e){if(oh(t))return t;for(const n of e){const r=n.axis||l4(n.position)||t.length>1&&oh(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function lh(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function u4(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return lh(t,"x",n[0])||lh(t,"y",n[0])}return{}}function c4(t,e){const n=Xr[t.type]||{scales:{}},r=e.scales||{},i=ku(t.type,e),s=Object.create(null);return Object.keys(r).forEach(a=>{const o=r[a];if(!Ce(o))return console.error(`Invalid scale configuration for scale: ${a}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=ju(a,o,u4(a,t),qe.scales[o.type]),u=o4(l,i),c=n.scales||{};s[a]=vs(Object.create(null),[{axis:l},o,c[l],c[u]])}),t.data.datasets.forEach(a=>{const o=a.type||t.type,l=a.indexAxis||ku(o,e),c=(Xr[o]||{}).scales||{};Object.keys(c).forEach(f=>{const p=a4(f,l),h=a[p+"AxisID"]||p;s[h]=s[h]||Object.create(null),vs(s[h],[{axis:p},r[h],c[f]])})}),Object.keys(s).forEach(a=>{const o=s[a];vs(o,[qe.scales[o.type],qe.scale])}),s}function M0(t){const e=t.options||(t.options={});e.plugins=Ae(e.plugins,{}),e.scales=c4(t,e)}function L0(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function d4(t){return t=t||{},t.data=L0(t.data),M0(t),t}const uh=new Map,N0=new Set;function Ta(t,e){let n=uh.get(t);return n||(n=e(),uh.set(t,n),N0.add(n)),n}const rs=(t,e,n)=>{const r=zs(e,n);r!==void 0&&t.add(r)};class f4{constructor(e){this._config=d4(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=L0(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),M0(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Ta(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return Ta(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return Ta(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return Ta(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let i=r.get(e);return(!i||n)&&(i=new Map,r.set(e,i)),i}getOptionScopes(e,n,r){const{options:i,type:s}=this,a=this._cachedScopes(e,r),o=a.get(n);if(o)return o;const l=new Set;n.forEach(c=>{e&&(l.add(e),c.forEach(f=>rs(l,e,f))),c.forEach(f=>rs(l,i,f)),c.forEach(f=>rs(l,Xr[s]||{},f)),c.forEach(f=>rs(l,qe,f)),c.forEach(f=>rs(l,Su,f))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),N0.has(n)&&a.set(n,u),u}chartOptionScopes(){const{options:e,type:n}=this;return[e,Xr[n]||{},qe.datasets[n]||{},{type:n},qe,Su]}resolveNamedOptions(e,n,r,i=[""]){const s={$shared:!0},{resolver:a,subPrefixes:o}=ch(this._resolverCache,e,i);let l=a;if(p4(a,n)){s.$shared=!1,r=gr(r)?r():r;const u=this.createResolver(e,r,o);l=Mi(a,r,u)}for(const u of n)s[u]=l[u];return s}createResolver(e,n,r=[""],i){const{resolver:s}=ch(this._resolverCache,e,r);return Ce(n)?Mi(s,n,void 0,i):s}}function ch(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const i=n.join();let s=r.get(i);return s||(s={resolver:Oc(e,n),subPrefixes:n.filter(o=>!o.toLowerCase().includes("hover"))},r.set(i,s)),s}const h4=t=>Ce(t)&&Object.getOwnPropertyNames(t).some(e=>gr(t[e]));function p4(t,e){const{isScriptable:n,isIndexable:r}=p0(t);for(const i of e){const s=n(i),a=r(i),o=(a||s)&&t[i];if(s&&(gr(o)||h4(o))||a&&Ue(o))return!0}return!1}var y4="4.5.1";const m4=["top","bottom","left","right","chartArea"];function dh(t,e){return t==="top"||t==="bottom"||m4.indexOf(t)===-1&&e==="x"}function fh(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function hh(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),_e(n&&n.onComplete,[t],e)}function g4(t){const e=t.chart,n=e.options.animation;_e(n&&n.onProgress,[t],e)}function R0(t){return Ic()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Ka={},ph=t=>{const e=R0(t);return Object.values(Ka).filter(n=>n.canvas===e).pop()};function v4(t,e,n){const r=Object.keys(t);for(const i of r){const s=+i;if(s>=e){const a=t[i];delete t[i],(n>0||s>e)&&(t[s+n]=a)}}}function b4(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}var er;let Uo=(er=class{static register(...e){mn.add(...e),yh()}static unregister(...e){mn.remove(...e),yh()}constructor(e,n){const r=this.config=new f4(n),i=R0(e),s=ph(i);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||D6(i)),this.platform.updateConfig(r);const o=this.platform.acquireContext(i,a.aspectRatio),l=o&&o.canvas,u=l&&l.height,c=l&&l.width;if(this.id=CC(),this.ctx=o,this.canvas=l,this.width=c,this.height=u,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 t4,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=WC(f=>this.update(f),a.resizeDelay||0),this._dataChanges=[],Ka[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Nn.listen(this,"complete",hh),Nn.listen(this,"progress",g4),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:i,_aspectRatio:s}=this;return Ne(e)?n&&s?s:i?r/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return mn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():zf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Df(this.canvas,this.ctx),this}stop(){return Nn.stop(this),this}resize(e,n){Nn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,i=this.canvas,s=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,e,n,s),o=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,zf(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),_e(r.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Le(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,i=Object.keys(r).reduce((a,o)=>(a[o]=!1,a),{});let s=[];n&&(s=s.concat(Object.keys(n).map(a=>{const o=n[a],l=ju(a,o),u=l==="r",c=l==="x";return{options:o,dposition:u?"chartArea":c?"bottom":"left",dtype:u?"radialLinear":c?"category":"linear"}}))),Le(s,a=>{const o=a.options,l=o.id,u=ju(l,o),c=Ae(o.type,a.dtype);(o.position===void 0||dh(o.position,u)!==dh(a.dposition))&&(o.position=a.dposition),i[l]=!0;let f=null;if(l in r&&r[l].type===c)f=r[l];else{const p=mn.getScale(c);f=new p({id:l,type:c,ctx:this.ctx,chart:this}),r[f.id]=f}f.init(o,e)}),Le(i,(a,o)=>{a||delete r[o]}),Le(r,a=>{$t.configure(this,a,a.options),$t.addBox(this,a)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((i,s)=>i.index-s.index),r>n){for(let i=n;i<r;++i)this._destroyDatasetMeta(i);e.splice(n,r-n)}this._sortedMetasets=e.slice(0).sort(fh("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((r,i)=>{n.filter(s=>s===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r<i;r++){const s=n[r];let a=this.getDatasetMeta(r);const o=s.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(r),a=this.getDatasetMeta(r)),a.type=o,a.indexAxis=s.indexAxis||ku(o,this.options),a.order=s.order||0,a.index=r,a.label=""+s.label,a.visible=this.isDatasetVisible(r),a.controller)a.controller.updateIndex(r),a.controller.linkScales();else{const l=mn.getController(o),{datasetElementType:u,dataElementType:c}=qe.datasets[o];Object.assign(l,{dataElementType:mn.getElement(c),datasetElementType:u&&mn.getElement(u)}),a.controller=new l(this,r),e.push(a.controller)}}return this._updateMetasets(),e}_resetElements(){Le(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let u=0,c=this.data.datasets.length;u<c;u++){const{controller:f}=this.getDatasetMeta(u),p=!i&&s.indexOf(f)===-1;f.buildOrUpdateElements(p),a=Math.max(+f.getMaxOverflow(),a)}a=this._minPadding=r.layout.autoPadding?a:0,this._updateLayout(a),i||Le(s,u=>{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(fh("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Le(this.scales,e=>{$t.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Of(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:s}of n){const a=r==="_removeElements"?-s:s;v4(e,i,a)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=s=>new Set(e.filter(a=>a[0]===s).map((a,o)=>o+","+a.splice(1).join(","))),i=r(0);for(let s=1;s<n;s++)if(!Of(i,r(s)))return;return Array.from(i).map(s=>s.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$t.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],Le(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,s)=>{i._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,gr(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const r=this.getDatasetMeta(e),i={meta:r,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(r.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Nn.has(this)?this.attached&&!Nn.running(this)&&Nn.start(this):(this.draw(),hh({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:r,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,r=[];let i,s;for(i=0,s=n.length;i<s;++i){const a=n[i];(!e||a.visible)&&r.push(a)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r={meta:e,index:e.index,cancelable:!0},i=C0(this,e);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(i&&Do(n,i),e.controller.draw(),i&&Bo(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return qn(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,i){const s=m6.modes[n];return typeof s=="function"?s(this,e,r,i):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let i=r.filter(s=>s&&s._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=br(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const i=r?"show":"hide",s=this.getDatasetMeta(e),a=s.controller._resolveAnimations(void 0,i);uo(n)?(s.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),a.update(s,{visible:r}),this.update(o=>o.datasetIndex===e?i:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Nn.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Df(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ka[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,r=(s,a)=>{n.addEventListener(this,s,a),e[s]=a},i=(s,a,o)=>{s.offsetX=a,s.offsetY=o,this._eventHandler(s)};Le(this.options.events,s=>r(s,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,u)=>{n.addEventListener(this,l,u),e[l]=u},i=(l,u)=>{e[l]&&(n.removeEventListener(this,l,u),delete e[l])},s=(l,u)=>{this.canvas&&this.resize(l,u)};let a;const o=()=>{i("attach",o),this.attached=!0,this.resize(),r("resize",s),r("detach",a)};a=()=>{this.attached=!1,i("resize",s),this._stop(),this._resize(0,0),r("attach",o)},n.isAttached(this.canvas)?o():a()}unbindEvents(){Le(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},Le(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const i=r?"set":"remove";let s,a,o,l;for(n==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+i+"DatasetHoverStyle"]()),o=0,l=e.length;o<l;++o){a=e[o];const u=a&&this.getDatasetMeta(a.datasetIndex).controller;u&&u[i+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],r=e.map(({datasetIndex:s,index:a})=>{const o=this.getDatasetMeta(s);if(!o)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:o.data[a],index:a}});!oo(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const i=this.options.hover,s=(l,u)=>l.filter(c=>!u.some(f=>c.datasetIndex===f.datasetIndex&&c.index===f.index)),a=s(n,e),o=r?e:s(e,n);a.length&&this.updateHoverStyle(a,i.mode,!1),o.length&&i.mode&&this.updateHoverStyle(o,i.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},i=a=>(a.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const s=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(s||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:i=[],options:s}=this,a=n,o=this._getActiveElements(e,i,r,a),l=PC(e),u=b4(e,this._lastEvent,r,l);r&&(this._lastEvent=null,_e(s.onHover,[e,o,this],this),l&&_e(s.onClick,[e,o,this],this));const c=!oo(o,i);return(c||n)&&(this._active=o,this._updateHoverStyles(o,i,n)),this._lastEvent=u,c}_getActiveElements(e,n,r,i){if(e.type==="mouseout")return[];if(!r)return n;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,i)}},he(er,"defaults",qe),he(er,"instances",Ka),he(er,"overrides",Xr),he(er,"registry",mn),he(er,"version",y4),he(er,"getChart",ph),er);function yh(){return Le(Uo.instances,t=>t._plugins.invalidate())}function _0(t,e,n=e){t.lineCap=Ae(n.borderCapStyle,e.borderCapStyle),t.setLineDash(Ae(n.borderDash,e.borderDash)),t.lineDashOffset=Ae(n.borderDashOffset,e.borderDashOffset),t.lineJoin=Ae(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Ae(n.borderWidth,e.borderWidth),t.strokeStyle=Ae(n.borderColor,e.borderColor)}function x4(t,e,n){t.lineTo(n.x,n.y)}function w4(t){return t.stepped?s5:t.tension||t.cubicInterpolationMode==="monotone"?a5:x4}function D0(t,e,n={}){const r=t.length,{start:i=0,end:s=r-1}=n,{start:a,end:o}=e,l=Math.max(i,a),u=Math.min(s,o),c=i<a&&s<a||i>o&&s>o;return{count:r,start:l,loop:e.loop,ilen:u<l&&!c?r+u-l:u-l}}function A4(t,e,n,r){const{points:i,options:s}=e,{count:a,start:o,loop:l,ilen:u}=D0(i,n,r),c=w4(s);let{move:f=!0,reverse:p}=r||{},h,y,m;for(h=0;h<=u;++h)y=i[(o+(p?u-h:h))%a],!y.skip&&(f?(t.moveTo(y.x,y.y),f=!1):c(t,m,y,p,s.stepped),m=y);return l&&(y=i[(o+(p?u:0))%a],c(t,m,y,p,s.stepped)),!!l}function S4(t,e,n,r){const i=e.points,{count:s,start:a,ilen:o}=D0(i,n,r),{move:l=!0,reverse:u}=r||{};let c=0,f=0,p,h,y,m,g,v;const S=E=>(a+(u?o-E:E))%s,j=()=>{m!==g&&(t.lineTo(c,g),t.lineTo(c,m),t.lineTo(c,v))};for(l&&(h=i[S(0)],t.moveTo(h.x,h.y)),p=0;p<=o;++p){if(h=i[S(p)],h.skip)continue;const E=h.x,A=h.y,w=E|0;w===y?(A<m?m=A:A>g&&(g=A),c=(f*c+E)/++f):(j(),t.lineTo(E,A),y=w,f=0,m=g=A),v=A}j()}function Eu(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?S4:A4}function C4(t){return t.stepped?z5:t.tension||t.cubicInterpolationMode==="monotone"?U5:Or}function k4(t,e,n,r){let i=e._path;i||(i=e._path=new Path2D,e.path(i,n,r)&&i.closePath()),_0(t,e.options),t.stroke(i)}function j4(t,e,n,r){const{segments:i,options:s}=e,a=Eu(e);for(const o of i)_0(t,s,o.style),t.beginPath(),a(t,e,o,{start:n,end:n+r-1})&&t.closePath(),t.stroke()}const E4=typeof Path2D=="function";function O4(t,e,n,r){E4&&!e.options.segment?k4(t,e,n,r):j4(t,e,n,r)}class hr extends Yn{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const i=r.spanGaps?this._loop:this._fullLoop;M5(this._points,r,e,i,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Y5(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,r=e.length;return r&&n[e[r-1].end]}interpolate(e,n){const r=this.options,i=e[n],s=this.points,a=S0(this,{property:n,start:i,end:i});if(!a.length)return;const o=[],l=C4(r);let u,c;for(u=0,c=a.length;u<c;++u){const{start:f,end:p}=a[u],h=s[f],y=s[p];if(h===y){o.push(h);continue}const m=Math.abs((i-h[n])/(y[n]-h[n])),g=l(h,y,m,r.stepped);g[n]=e[n],o.push(g)}return o.length===1?o[0]:o}pathSegment(e,n,r){return Eu(this)(e,this,n,r)}path(e,n,r){const i=this.segments,s=Eu(this);let a=this._loop;n=n||0,r=r||this.points.length-n;for(const o of i)a&=s(e,this,o,{start:n,end:n+r-1});return!!a}draw(e,n,r,i){const s=this.options||{};(this.points||[]).length&&s.borderWidth&&(e.save(),O4(e,this,r,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}he(hr,"id","line"),he(hr,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),he(hr,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),he(hr,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function mh(t,e,n,r){const i=t.options,{[n]:s}=t.getProps([n],r);return Math.abs(e-s)<i.radius+i.hitRadius}class Xa extends Yn{constructor(n){super();he(this,"parsed");he(this,"skip");he(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,i){const s=this.options,{x:a,y:o}=this.getProps(["x","y"],i);return Math.pow(n-a,2)+Math.pow(r-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(n,r){return mh(this,n,"x",r)}inYRange(n,r){return mh(this,n,"y",r)}getCenterPoint(n){const{x:r,y:i}=this.getProps(["x","y"],n);return{x:r,y:i}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const i=r&&n.borderWidth||0;return(r+i)*2}draw(n,r){const i=this.options;this.skip||i.radius<.1||!qn(this,r,this.size(i)/2)||(n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.fillStyle=i.backgroundColor,Cu(n,i,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}he(Xa,"id","point"),he(Xa,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),he(Xa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function T4(t,e,n){const r=t.segments,i=t.points,s=e.points,a=[];for(const o of r){let{start:l,end:u}=o;u=Ho(l,u,i);const c=Ou(n,i[l],i[u],o.loop);if(!e.segments){a.push({source:o,target:c,start:i[l],end:i[u]});continue}const f=S0(e,c);for(const p of f){const h=Ou(n,s[p.start],s[p.end],p.loop),y=A0(o,i,h);for(const m of y)a.push({source:m,target:p,start:{[n]:gh(c,h,"start",Math.max)},end:{[n]:gh(c,h,"end",Math.min)}})}}return a}function Ou(t,e,n,r){if(r)return;let i=e[t],s=n[t];return t==="angle"&&(i=Ut(i),s=Ut(s)),{property:t,start:i,end:s}}function P4(t,e){const{x:n=null,y:r=null}=t||{},i=e.points,s=[];return e.segments.forEach(({start:a,end:o})=>{o=Ho(a,o,i);const l=i[a],u=i[o];r!==null?(s.push({x:l.x,y:r}),s.push({x:u.x,y:r})):n!==null&&(s.push({x:n,y:l.y}),s.push({x:n,y:u.y}))}),s}function Ho(t,e,n){for(;e>t;e--){const r=n[e];if(!isNaN(r.x)&&!isNaN(r.y))break}return e}function gh(t,e,n,r){return t&&e?r(t[n],e[n]):t?t[n]:e?e[n]:0}function B0(t,e){let n=[],r=!1;return Ue(t)?(r=!0,n=t):n=P4(t,e),n.length?new hr({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function vh(t){return t&&t.fill!==!1}function I4(t,e,n){let i=t[e].fill;const s=[e];let a;if(!n)return i;for(;i!==!1&&s.indexOf(i)===-1;){if(!nt(i))return i;if(a=t[i],!a)return!1;if(a.visible)return i;s.push(i),i=a.fill}return!1}function M4(t,e,n){const r=_4(t);if(Ce(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return nt(i)&&Math.floor(i)===i?L4(r[0],e,i,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function L4(t,e,n,r){return(t==="-"||t==="+")&&(n=e+n),n===e||n<0||n>=r?!1:n}function N4(t,e){let n=null;return t==="start"?n=e.bottom:t==="end"?n=e.top:Ce(t)?n=e.getPixelForValue(t.value):e.getBasePixel&&(n=e.getBasePixel()),n}function R4(t,e,n){let r;return t==="start"?r=n:t==="end"?r=e.options.reverse?e.min:e.max:Ce(t)?r=t.value:r=e.getBaseValue(),r}function _4(t){const e=t.options,n=e.fill;let r=Ae(n&&n.target,n);return r===void 0&&(r=!!e.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function D4(t){const{scale:e,index:n,line:r}=t,i=[],s=r.segments,a=r.points,o=B4(e,n);o.push(B0({x:null,y:e.bottom},r));for(let l=0;l<s.length;l++){const u=s[l];for(let c=u.start;c<=u.end;c++)F4(i,a[c],o)}return new hr({points:i,options:{}})}function B4(t,e){const n=[],r=t.getMatchingVisibleMetas("line");for(let i=0;i<r.length;i++){const s=r[i];if(s.index===e)break;s.hidden||n.unshift(s.dataset)}return n}function F4(t,e,n){const r=[];for(let i=0;i<n.length;i++){const s=n[i],{first:a,last:o,point:l}=z4(s,e,"x");if(!(!l||a&&o)){if(a)r.unshift(l);else if(t.push(l),!o)break}}t.push(...r)}function z4(t,e,n){const r=t.interpolate(e,n);if(!r)return{};const i=r[n],s=t.segments,a=t.points;let o=!1,l=!1;for(let u=0;u<s.length;u++){const c=s[u],f=a[c.start][n],p=a[c.end][n];if(ui(i,f,p)){o=i===f,l=i===p;break}}return{first:o,last:l,point:r}}class F0{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,n,r){const{x:i,y:s,radius:a}=this;return n=n||{start:0,end:Wt},e.arc(i,s,a,n.end,n.start,!0),!r.bounds}interpolate(e){const{x:n,y:r,radius:i}=this,s=e.angle;return{x:n+Math.cos(s)*i,y:r+Math.sin(s)*i,angle:s}}}function U4(t){const{chart:e,fill:n,line:r}=t;if(nt(n))return H4(e,n);if(n==="stack")return D4(t);if(n==="shape")return!0;const i=q4(t);return i instanceof F0?i:B0(i,r)}function H4(t,e){const n=t.getDatasetMeta(e);return n&&t.isDatasetVisible(e)?n.dataset:null}function q4(t){return(t.scale||{}).getPointPositionForValue?Q4(t):W4(t)}function W4(t){const{scale:e={},fill:n}=t,r=N4(n,e);if(nt(r)){const i=e.isHorizontal();return{x:i?r:null,y:i?null:r}}return null}function Q4(t){const{scale:e,fill:n}=t,r=e.options,i=e.getLabels().length,s=r.reverse?e.max:e.min,a=R4(n,e,s),o=[];if(r.grid.circular){const l=e.getPointPositionForValue(0,s);return new F0({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(a)})}for(let l=0;l<i;++l)o.push(e.getPointPositionForValue(l,a));return o}function xl(t,e,n){const r=U4(e),{chart:i,index:s,line:a,scale:o,axis:l}=e,u=a.options,c=u.fill,f=u.backgroundColor,{above:p=f,below:h=f}=c||{},y=i.getDatasetMeta(s),m=C0(i,y);r&&a.points.length&&(Do(t,n),G4(t,{line:a,target:r,above:p,below:h,area:n,scale:o,axis:l,clip:m}),Bo(t))}function G4(t,e){const{line:n,target:r,above:i,below:s,area:a,scale:o,clip:l}=e,u=n._loop?"angle":e.axis;t.save();let c=s;s!==i&&(u==="x"?(bh(t,r,a.top),wl(t,{line:n,target:r,color:i,scale:o,property:u,clip:l}),t.restore(),t.save(),bh(t,r,a.bottom)):u==="y"&&(xh(t,r,a.left),wl(t,{line:n,target:r,color:s,scale:o,property:u,clip:l}),t.restore(),t.save(),xh(t,r,a.right),c=i)),wl(t,{line:n,target:r,color:c,scale:o,property:u,clip:l}),t.restore()}function bh(t,e,n){const{segments:r,points:i}=e;let s=!0,a=!1;t.beginPath();for(const o of r){const{start:l,end:u}=o,c=i[l],f=i[Ho(l,u,i)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,n),t.lineTo(c.x,c.y)),a=!!e.pathSegment(t,o,{move:a}),a?t.closePath():t.lineTo(f.x,n)}t.lineTo(e.first().x,n),t.closePath(),t.clip()}function xh(t,e,n){const{segments:r,points:i}=e;let s=!0,a=!1;t.beginPath();for(const o of r){const{start:l,end:u}=o,c=i[l],f=i[Ho(l,u,i)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(n,c.y),t.lineTo(c.x,c.y)),a=!!e.pathSegment(t,o,{move:a}),a?t.closePath():t.lineTo(n,f.y)}t.lineTo(n,e.first().y),t.closePath(),t.clip()}function wl(t,e){const{line:n,target:r,property:i,color:s,scale:a,clip:o}=e,l=T4(n,r,i);for(const{source:u,target:c,start:f,end:p}of l){const{style:{backgroundColor:h=s}={}}=u,y=r!==!0;t.save(),t.fillStyle=h,Y4(t,a,o,y&&Ou(i,f,p)),t.beginPath();const m=!!n.pathSegment(t,u);let g;if(y){m?t.closePath():wh(t,r,p,i);const v=!!r.pathSegment(t,c,{move:m,reverse:!0});g=m&&v,g||wh(t,r,f,i)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function Y4(t,e,n,r){const i=e.chart.chartArea,{property:s,start:a,end:o}=r||{};if(s==="x"||s==="y"){let l,u,c,f;s==="x"?(l=a,u=i.top,c=o,f=i.bottom):(l=i.left,u=a,c=i.right,f=o),t.beginPath(),n&&(l=Math.max(l,n.left),c=Math.min(c,n.right),u=Math.max(u,n.top),f=Math.min(f,n.bottom)),t.rect(l,u,c-l,f-u),t.clip()}}function wh(t,e,n,r){const i=e.interpolate(n,r);i&&t.lineTo(i.x,i.y)}var V4={id:"filler",afterDatasetsUpdate(t,e,n){const r=(t.data.datasets||[]).length,i=[];let s,a,o,l;for(a=0;a<r;++a)s=t.getDatasetMeta(a),o=s.dataset,l=null,o&&o.options&&o instanceof hr&&(l={visible:t.isDatasetVisible(a),index:a,fill:M4(o,a,r),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:o}),s.$filler=l,i.push(l);for(a=0;a<r;++a)l=i[a],!(!l||l.fill===!1)&&(l.fill=I4(i,a,n.propagate))},beforeDraw(t,e,n){const r=n.drawTime==="beforeDraw",i=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let a=i.length-1;a>=0;--a){const o=i[a].$filler;o&&(o.line.updateControlPoints(s,o.axis),r&&o.fill&&xl(t.ctx,o,s))}},beforeDatasetsDraw(t,e,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=t.getSortedVisibleDatasetMetas();for(let i=r.length-1;i>=0;--i){const s=r[i].$filler;vh(s)&&xl(t.ctx,s,t.chartArea)}},beforeDatasetDraw(t,e,n){const r=e.meta.$filler;!vh(r)||n.drawTime!=="beforeDatasetDraw"||xl(t.ctx,r,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Ah=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},K4=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Sh extends Yn{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,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 e=this.options.labels||{};let n=_e(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,i)=>e.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,i=Je(r.font),s=i.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=Ah(r,s);let u,c;n.font=i.string,this.isHorizontal()?(u=this.maxWidth,c=this._fitRows(a,s,o,l)+10):(c=this.maxHeight,u=this._fitCols(a,i,o,l)+10),this.width=Math.min(u,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,i){const{ctx:s,maxWidth:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],u=this.lineWidths=[0],c=i+o;let f=e;s.textAlign="left",s.textBaseline="middle";let p=-1,h=-c;return this.legendItems.forEach((y,m)=>{const g=r+n/2+s.measureText(y.text).width;(m===0||u[u.length-1]+g+2*o>a)&&(f+=c,u[u.length-(m>0?0:1)]=0,h+=c,p++),l[m]={left:0,top:h,row:p,width:g,height:i},u[u.length-1]+=g+o}),f}_fitCols(e,n,r,i){const{ctx:s,maxHeight:a,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],u=this.columnSizes=[],c=a-e;let f=o,p=0,h=0,y=0,m=0;return this.legendItems.forEach((g,v)=>{const{itemWidth:S,itemHeight:j}=X4(r,n,s,g,i);v>0&&h+j+2*o>c&&(f+=p+o,u.push({width:p,height:h}),y+=p+o,m++,p=h=0),l[v]={left:y,top:h,col:m,width:S,height:j},p=Math.max(p,S),h+=j+o}),f+=p,u.push({width:p,height:h}),f}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:s}}=this,a=hi(s,this.left,this.width);if(this.isHorizontal()){let o=0,l=at(r,this.left+i,this.right-this.lineWidths[o]);for(const u of n)o!==u.row&&(o=u.row,l=at(r,this.left+i,this.right-this.lineWidths[o])),u.top+=this.top+e+i,u.left=a.leftForLtr(a.x(l),u.width),l+=u.width+i}else{let o=0,l=at(r,this.top+e+i,this.bottom-this.columnSizes[o].height);for(const u of n)u.col!==o&&(o=u.col,l=at(r,this.top+e+i,this.bottom-this.columnSizes[o].height)),u.top=l,u.left+=this.left+i,u.left=a.leftForLtr(a.x(u.left),u.width),l+=u.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;Do(e,this),this._draw(),Bo(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:i}=this,{align:s,labels:a}=e,o=qe.color,l=hi(e.rtl,this.left,this.width),u=Je(a.font),{padding:c}=a,f=u.size,p=f/2;let h;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=u.string;const{boxWidth:y,boxHeight:m,itemHeight:g}=Ah(a,f),v=function(w,x,b){if(isNaN(y)||y<=0||isNaN(m)||m<0)return;i.save();const L=Ae(b.lineWidth,1);if(i.fillStyle=Ae(b.fillStyle,o),i.lineCap=Ae(b.lineCap,"butt"),i.lineDashOffset=Ae(b.lineDashOffset,0),i.lineJoin=Ae(b.lineJoin,"miter"),i.lineWidth=L,i.strokeStyle=Ae(b.strokeStyle,o),i.setLineDash(Ae(b.lineDash,[])),a.usePointStyle){const R={radius:m*Math.SQRT2/2,pointStyle:b.pointStyle,rotation:b.rotation,borderWidth:L},I=l.xPlus(w,y/2),P=x+p;f0(i,R,I,P,a.pointStyleWidth&&y)}else{const R=x+Math.max((f-m)/2,0),I=l.leftForLtr(w,y),P=fi(b.borderRadius);i.beginPath(),Object.values(P).some(z=>z!==0)?ho(i,{x:I,y:R,w:y,h:m,radius:P}):i.rect(I,R,y,m),i.fill(),L!==0&&i.stroke()}i.restore()},S=function(w,x,b){Jr(i,b.text,w,x+g/2,u,{strikethrough:b.hidden,textAlign:l.textAlign(b.textAlign)})},j=this.isHorizontal(),E=this._computeTitleHeight();j?h={x:at(s,this.left+c,this.right-r[0]),y:this.top+c+E,line:0}:h={x:this.left+c,y:at(s,this.top+E+c,this.bottom-n[0].height),line:0},b0(this.ctx,e.textDirection);const A=g+c;this.legendItems.forEach((w,x)=>{i.strokeStyle=w.fontColor,i.fillStyle=w.fontColor;const b=i.measureText(w.text).width,L=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),R=y+p+b;let I=h.x,P=h.y;l.setWidth(this.width),j?x>0&&I+R+c>this.right&&(P=h.y+=A,h.line++,I=h.x=at(s,this.left+c,this.right-r[h.line])):x>0&&P+A>this.bottom&&(I=h.x=I+n[h.line].width+c,h.line++,P=h.y=at(s,this.top+E+c,this.bottom-n[h.line].height));const z=l.x(I);if(v(z,P,w),I=QC(L,I+y+p,j?I+R:this.right,e.rtl),S(l.x(I),P,w),j)h.x+=R+c;else if(typeof w.text!="string"){const N=u.lineHeight;h.y+=z0(w,N)+c}else h.y+=A}),x0(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=Je(n.font),i=lt(n.padding);if(!n.display)return;const s=hi(e.rtl,this.left,this.width),a=this.ctx,o=n.position,l=r.size/2,u=i.top+l;let c,f=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),c=this.top+u,f=at(e.align,f,this.right-p);else{const y=this.columnSizes.reduce((m,g)=>Math.max(m,g.height),0);c=u+at(e.align,this.top,this.bottom-y-e.labels.padding-this._computeTitleHeight())}const h=at(o,f,f+p);a.textAlign=s.textAlign(kc(o)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=r.string,Jr(a,n.text,h,c,r)}_computeTitleHeight(){const e=this.options.title,n=Je(e.font),r=lt(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,i,s;if(ui(e,this.left,this.right)&&ui(n,this.top,this.bottom)){for(s=this.legendHitBoxes,r=0;r<s.length;++r)if(i=s[r],ui(e,i.left,i.left+i.width)&&ui(n,i.top,i.top+i.height))return this.legendItems[r]}return null}handleEvent(e){const n=this.options;if(!$4(e.type,n))return;const r=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,s=K4(i,r);i&&!s&&_e(n.onLeave,[e,i,this],this),this._hoveredItem=r,r&&!s&&_e(n.onHover,[e,r,this],this)}else r&&_e(n.onClick,[e,r,this],this)}}function X4(t,e,n,r,i){const s=J4(r,t,e,n),a=Z4(i,r,e.lineHeight);return{itemWidth:s,itemHeight:a}}function J4(t,e,n,r){let i=t.text;return i&&typeof i!="string"&&(i=i.reduce((s,a)=>s.length>a.length?s:a)),e+n.size/2+r.measureText(i).width}function Z4(t,e,n){let r=t;return typeof e.text!="string"&&(r=z0(e,n)),r}function z0(t,e){const n=t.text?t.text.length:0;return e*n}function $4(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var ek={id:"legend",_element:Sh,start(t,e,n){const r=t.legend=new Sh({ctx:t.ctx,options:n,chart:t});$t.configure(t,r,n),$t.addBox(t,r)},stop(t){$t.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;$t.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),e.hidden=!0):(i.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:s,useBorderRadius:a,borderRadius:o}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const u=l.controller.getStyle(n?0:void 0),c=lt(u.borderWidth);return{text:e[l.index].label,fillStyle:u.backgroundColor,fontColor:s,hidden:!l.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:u.borderColor,pointStyle:r||u.pointStyle,rotation:u.rotation,textAlign:i||u.textAlign,borderRadius:a&&(o||u.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class U0 extends Yn{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const i=Ue(r.text)?r.text.length:1;this._padding=lt(r.padding);const s=i*Je(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:i,right:s,options:a}=this,o=a.align;let l=0,u,c,f;return this.isHorizontal()?(c=at(o,r,s),f=n+e,u=s-r):(a.position==="left"?(c=r+e,f=at(o,i,n),l=Ye*-.5):(c=s-e,f=at(o,n,i),l=Ye*.5),u=i-n),{titleX:c,titleY:f,maxWidth:u,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=Je(n.font),s=r.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:u}=this._drawArgs(s);Jr(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:u,textAlign:kc(n.align),textBaseline:"middle",translation:[a,o]})}}function tk(t,e){const n=new U0({ctx:t.ctx,options:e,chart:t});$t.configure(t,n,e),$t.addBox(t,n),t.titleBlock=n}var nk={id:"title",_element:U0,start(t,e,n){tk(t,n)},stop(t){const e=t.titleBlock;$t.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;$t.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const hs={average(t){if(!t.length)return!1;let e,n,r=new Set,i=0,s=0;for(e=0,n=t.length;e<n;++e){const o=t[e].element;if(o&&o.hasValue()){const l=o.tooltipPosition();r.add(l.x),i+=l.y,++s}}return s===0||r.size===0?!1:{x:[...r].reduce((o,l)=>o+l)/r.size,y:i/s}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,i=Number.POSITIVE_INFINITY,s,a,o;for(s=0,a=t.length;s<a;++s){const l=t[s].element;if(l&&l.hasValue()){const u=l.getCenterPoint(),c=Au(e,u);c<i&&(i=c,o=l)}}if(o){const l=o.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function yn(t,e){return e&&(Ue(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Rn(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
51
51
  `)>-1?t.split(`
52
- `):t}function rk(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:a,value:o}=s.getLabelAndValue(i);return{chart:t,label:a,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:o,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Ch(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:a,boxHeight:o}=e,l=Je(e.bodyFont),u=Je(e.titleFont),c=Je(e.footerFont),f=s.length,p=i.length,h=r.length,y=lt(e.padding);let m=y.height,g=0,v=r.reduce((E,A)=>E+A.before.length+A.lines.length+A.after.length,0);if(v+=t.beforeBody.length+t.afterBody.length,f&&(m+=f*u.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),v){const E=e.displayColors?Math.max(o,l.lineHeight):l.lineHeight;m+=h*E+(v-h)*l.lineHeight+(v-1)*e.bodySpacing}p&&(m+=e.footerMarginTop+p*c.lineHeight+(p-1)*e.footerSpacing);let S=0;const j=function(E){g=Math.max(g,n.measureText(E).width+S)};return n.save(),n.font=u.string,Le(t.title,j),n.font=l.string,Le(t.beforeBody.concat(t.afterBody),j),S=e.displayColors?a+2+e.boxPadding:0,Le(r,E=>{Le(E.before,j),Le(E.lines,j),Le(E.after,j)}),S=0,n.font=c.string,Le(t.footer,j),n.restore(),g+=y.width,{width:g,height:m}}function ik(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function sk(t,e,n,r){const{x:i,width:s}=r,a=n.caretSize+n.caretPadding;if(t==="left"&&i+s+a>e.width||t==="right"&&i-s-a<0)return!0}function ak(t,e,n,r){const{x:i,width:s}=n,{width:a,chartArea:{left:o,right:l}}=t;let u="center";return r==="center"?u=i<=(o+l)/2?"left":"right":i<=s/2?u="left":i>=a-s/2&&(u="right"),sk(u,t,e,n)&&(u="center"),u}function kh(t,e,n){const r=n.yAlign||e.yAlign||ik(t,n);return{xAlign:n.xAlign||e.xAlign||ak(t,e,n,r),yAlign:r}}function ok(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function lk(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function jh(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:a}=t,{xAlign:o,yAlign:l}=n,u=i+s,{topLeft:c,topRight:f,bottomLeft:p,bottomRight:h}=fi(a);let y=ok(e,o);const m=lk(e,l,u);return l==="center"?o==="left"?y+=u:o==="right"&&(y-=u):o==="left"?y-=Math.max(c,p)+i:o==="right"&&(y+=Math.max(f,h)+i),{x:Zt(y,0,r.width-e.width),y:Zt(m,0,r.height-e.height)}}function Pa(t,e,n){const r=lt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function Eh(t){return yn([],Rn(t))}function uk(t,e,n){return br(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Oh(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const H0={beforeTitle:Pn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:Pn,beforeBody:Pn,beforeLabel:Pn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ne(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Pn,afterBody:Pn,beforeFooter:Pn,footer:Pn,afterFooter:Pn};function bt(t,e,n,r){const i=t[e].call(n,r);return typeof i=="undefined"?H0[e].call(n,r):i}class Tu extends Yn{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new k0(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=uk(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=bt(r,"beforeTitle",this,e),s=bt(r,"title",this,e),a=bt(r,"afterTitle",this,e);let o=[];return o=yn(o,Rn(i)),o=yn(o,Rn(s)),o=yn(o,Rn(a)),o}getBeforeBody(e,n){return Eh(bt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return Le(e,s=>{const a={before:[],lines:[],after:[]},o=Oh(r,s);yn(a.before,Rn(bt(o,"beforeLabel",this,s))),yn(a.lines,bt(o,"label",this,s)),yn(a.after,Rn(bt(o,"afterLabel",this,s))),i.push(a)}),i}getAfterBody(e,n){return Eh(bt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=bt(r,"beforeFooter",this,e),s=bt(r,"footer",this,e),a=bt(r,"afterFooter",this,e);let o=[];return o=yn(o,Rn(i)),o=yn(o,Rn(s)),o=yn(o,Rn(a)),o}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],a=[];let o=[],l,u;for(l=0,u=n.length;l<u;++l)o.push(rk(this.chart,n[l]));return e.filter&&(o=o.filter((c,f,p)=>e.filter(c,f,p,r))),e.itemSort&&(o=o.sort((c,f)=>e.itemSort(c,f,r))),Le(o,c=>{const f=Oh(e.callbacks,c);i.push(bt(f,"labelColor",this,c)),s.push(bt(f,"labelPointStyle",this,c)),a.push(bt(f,"labelTextColor",this,c))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=a,this.dataPoints=o,o}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,a=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const o=hs[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=Ch(this,r),u=Object.assign({},o,l),c=kh(this.chart,r,u),f=jh(r,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:a,cornerRadius:o}=r,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:f}=fi(o),{x:p,y:h}=e,{width:y,height:m}=n;let g,v,S,j,E,A;return s==="center"?(E=h+m/2,i==="left"?(g=p,v=g-a,j=E+a,A=E-a):(g=p+y,v=g+a,j=E-a,A=E+a),S=g):(i==="left"?v=p+Math.max(l,c)+a:i==="right"?v=p+y-Math.max(u,f)-a:v=this.caretX,s==="top"?(j=h,E=j-a,g=v-a,S=v+a):(j=h+m,E=j+a,g=v+a,S=v-a),A=j),{x1:g,x2:v,x3:S,y1:j,y2:E,y3:A}}drawTitle(e,n,r){const i=this.title,s=i.length;let a,o,l;if(s){const u=hi(r.rtl,this.x,this.width);for(e.x=Pa(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",a=Je(r.titleFont),o=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;l<s;++l)n.fillText(i[l],u.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,l+1===s&&(e.y+=r.titleMarginBottom-o)}}_drawColorBox(e,n,r,i,s){const a=this.labelColors[r],o=this.labelPointStyles[r],{boxHeight:l,boxWidth:u}=s,c=Je(s.bodyFont),f=Pa(this,"left",s),p=i.x(f),h=l<c.lineHeight?(c.lineHeight-l)/2:0,y=n.y+h;if(s.usePointStyle){const m={radius:Math.min(u,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},g=i.leftForLtr(p,u)+u/2,v=y+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,Cu(e,m,g,v),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,Cu(e,m,g,v)}else{e.lineWidth=Ce(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const m=i.leftForLtr(p,u),g=i.leftForLtr(i.xPlus(p,1),u-2),v=fi(a.borderRadius);Object.values(v).some(S=>S!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,ho(e,{x:m,y,w:u,h:l,radius:v}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),ho(e,{x:g,y:y+1,w:u-2,h:l-2,radius:v}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(m,y,u,l),e.strokeRect(m,y,u,l),e.fillStyle=a.backgroundColor,e.fillRect(g,y+1,u-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:u,boxPadding:c}=r,f=Je(r.bodyFont);let p=f.lineHeight,h=0;const y=hi(r.rtl,this.x,this.width),m=function(b){n.fillText(b,y.x(e.x+h),e.y+p/2),e.y+=p+s},g=y.textAlign(a);let v,S,j,E,A,w,x;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,e.x=Pa(this,g,r),n.fillStyle=r.bodyColor,Le(this.beforeBody,m),h=o&&g!=="right"?a==="center"?u/2+c:u+2+c:0,E=0,w=i.length;E<w;++E){for(v=i[E],S=this.labelTextColors[E],n.fillStyle=S,Le(v.before,m),j=v.lines,o&&j.length&&(this._drawColorBox(n,e,E,y,r),p=Math.max(f.lineHeight,l)),A=0,x=j.length;A<x;++A)m(j[A]),p=f.lineHeight;Le(v.after,m)}h=0,p=f.lineHeight,Le(this.afterBody,m),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let a,o;if(s){const l=hi(r.rtl,this.x,this.width);for(e.x=Pa(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",a=Je(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,o=0;o<s;++o)n.fillText(i[o],l.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:a}=this,{x:o,y:l}=e,{width:u,height:c}=r,{topLeft:f,topRight:p,bottomLeft:h,bottomRight:y}=fi(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(o+f,l),a==="top"&&this.drawCaret(e,n,r,i),n.lineTo(o+u-p,l),n.quadraticCurveTo(o+u,l,o+u,l+p),a==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(o+u,l+c-y),n.quadraticCurveTo(o+u,l+c,o+u-y,l+c),a==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(o+h,l+c),n.quadraticCurveTo(o,l+c,o,l+c-h),a==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(o,l+f),n.quadraticCurveTo(o,l,o+f,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const a=hs[e.position].call(this,this._active,this._eventPosition);if(!a)return;const o=this._size=Ch(this,e),l=Object.assign({},a,this._size),u=kh(n,e,l),c=jh(e,l,u,n);(i._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=lt(n.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&o&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),b0(e,n.textDirection),s.y+=a.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),x0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:o,index:l})=>{const u=this.chart.getDatasetMeta(o);if(!u)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:u.data[l],index:l}}),s=!oo(r,i),a=this._positionChanged(i,n);(s||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],a=this._getActiveElements(e,s,n,r),o=this._positionChanged(a,e),l=n||!oo(a,s)||o;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(o=>this.chart.data.datasets[o.datasetIndex]&&this.chart.getDatasetMeta(o.datasetIndex).controller.getParsed(o.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&a.reverse(),a}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,a=hs[s.position].call(this,e,n);return a!==!1&&(r!==a.x||i!==a.y)}}he(Tu,"positioners",hs);var ck={id:"tooltip",_element:Tu,positioners:hs,afterInit(t,e,n){n&&(t.tooltip=new Tu({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:H0},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const dk=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function fk(t,e,n,r){const i=t.indexOf(e);if(i===-1)return dk(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const hk=(t,e)=>t===null?null:Zt(Math.round(t),0,e);function Th(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Pu extends Hi{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ne(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:fk(r,e,Ae(n,e),this._addedLabels),hk(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=e;a<=n;a++)i.push({value:a});return i}getLabelForValue(e){return Th.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}he(Pu,"id","category"),he(Pu,"defaults",{ticks:{callback:Th}});function pk(t,e){const n=[],{bounds:i,step:s,min:a,max:o,precision:l,count:u,maxTicks:c,maxDigits:f,includeBounds:p}=t,h=s||1,y=c-1,{min:m,max:g}=e,v=!Ne(a),S=!Ne(o),j=!Ne(u),E=(g-m)/(f+1);let A=Pf((g-m)/y/h)*h,w,x,b,L;if(A<1e-14&&!v&&!S)return[{value:m},{value:g}];L=Math.ceil(g/A)-Math.floor(m/A),L>y&&(A=Pf(L*A/y/h)*h),Ne(l)||(w=Math.pow(10,l),A=Math.ceil(A*w)/w),i==="ticks"?(x=Math.floor(m/A)*A,b=Math.ceil(g/A)*A):(x=m,b=g),v&&S&&s&&RC((o-a)/s,A/1e3)?(L=Math.round(Math.min((o-a)/A,c)),A=(o-a)/L,x=a,b=o):j?(x=v?a:x,b=S?o:b,L=u-1,A=(b-x)/L):(L=(b-x)/A,bs(L,Math.round(L),A/1e3)?L=Math.round(L):L=Math.ceil(L));const R=Math.max(If(A),If(x));w=Math.pow(10,Ne(l)?R:l),x=Math.round(x*w)/w,b=Math.round(b*w)/w;let I=0;for(v&&(p&&x!==a?(n.push({value:a}),x<a&&I++,bs(Math.round((x+I*A)*w)/w,a,Ph(a,E,t))&&I++):x<a&&I++);I<L;++I){const P=Math.round((x+I*A)*w)/w;if(S&&P>o)break;n.push({value:P})}return S&&p&&b!==o?n.length&&bs(n[n.length-1].value,o,Ph(o,E,t))?n[n.length-1].value=o:n.push({value:o}):(!S||b===o)&&n.push({value:b}),n}function Ph(t,e,{horizontal:n,minRotation:r}){const i=dr(r),s=(n?Math.sin(i):Math.cos(i))||.001,a=.75*e*(""+t).length;return Math.min(e/s,a)}class Iu extends Hi{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return Ne(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const a=l=>i=n?i:l,o=l=>s=r?s:l;if(e){const l=Ii(i),u=Ii(s);l<0&&u<0?o(0):l>0&&u>0&&a(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);o(s+l),e||a(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,a=pk(i,s);return e.bounds==="ticks"&&_C(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return d0(e,this.chart.options.locale,this.options.ticks.format)}}class Mu extends Iu{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=nt(e)?e:0,this.max=nt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=dr(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}he(Mu,"id","linear"),he(Mu,"defaults",{ticks:{callback:Ec.formatters.numeric}});function Lu(t){const e=t.ticks;if(e.display&&t.display){const n=lt(e.backdropPadding);return Ae(e.font&&e.font.size,qe.font.size)+n.height}return 0}function yk(t,e,n){return n=Ue(n)?n:[n],{w:i5(t,e.string,n),h:n.length*e.lineHeight}}function Ih(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:t<r||t>i?{start:e-n,end:e}:{start:e,end:e+n}}function mk(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),r=[],i=[],s=t._pointLabels.length,a=t.options.pointLabels,o=a.centerPointLabels?Ye/s:0;for(let l=0;l<s;l++){const u=a.setContext(t.getPointLabelContext(l));i[l]=u.padding;const c=t.getPointPosition(l,t.drawingArea+i[l],o),f=Je(u.font),p=yk(t.ctx,f,t._pointLabels[l]);r[l]=p;const h=Ut(t.getIndexAngle(l)+o),y=Math.round(Sc(h)),m=Ih(y,c.x,p.w,0,180),g=Ih(y,c.y,p.h,90,270);gk(n,e,h,m,g)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=xk(t,r,i)}function gk(t,e,n,r,i){const s=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let o=0,l=0;r.start<e.l?(o=(e.l-r.start)/s,t.l=Math.min(t.l,e.l-o)):r.end>e.r&&(o=(r.end-e.r)/s,t.r=Math.max(t.r,e.r+o)),i.start<e.t?(l=(e.t-i.start)/a,t.t=Math.min(t.t,e.t-l)):i.end>e.b&&(l=(i.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function vk(t,e,n){const r=t.drawingArea,{extra:i,additionalAngle:s,padding:a,size:o}=n,l=t.getPointPosition(e,r+i+a,s),u=Math.round(Sc(Ut(l.angle+Ht))),c=Sk(l.y,o.h,u),f=wk(u),p=Ak(l.x,o.w,f);return{visible:!0,x:l.x,y:c,textAlign:f,left:p,top:c,right:p+o.w,bottom:c+o.h}}function bk(t,e){if(!e)return!0;const{left:n,top:r,right:i,bottom:s}=t;return!(qn({x:n,y:r},e)||qn({x:n,y:s},e)||qn({x:i,y:r},e)||qn({x:i,y:s},e))}function xk(t,e,n){const r=[],i=t._pointLabels.length,s=t.options,{centerPointLabels:a,display:o}=s.pointLabels,l={extra:Lu(s)/2,additionalAngle:a?Ye/i:0};let u;for(let c=0;c<i;c++){l.padding=n[c],l.size=e[c];const f=vk(t,c,l);r.push(f),o==="auto"&&(f.visible=bk(f,u),f.visible&&(u=f))}return r}function wk(t){return t===0||t===180?"center":t<180?"left":"right"}function Ak(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function Sk(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function Ck(t,e,n){const{left:r,top:i,right:s,bottom:a}=n,{backdropColor:o}=e;if(!Ne(o)){const l=fi(e.borderRadius),u=lt(e.backdropPadding);t.fillStyle=o;const c=r-u.left,f=i-u.top,p=s-r+u.width,h=a-i+u.height;Object.values(l).some(y=>y!==0)?(t.beginPath(),ho(t,{x:c,y:f,w:p,h,radius:l}),t.fill()):t.fillRect(c,f,p,h)}}function kk(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let i=e-1;i>=0;i--){const s=t._pointLabelItems[i];if(!s.visible)continue;const a=r.setContext(t.getPointLabelContext(i));Ck(n,a,s);const o=Je(a.font),{x:l,y:u,textAlign:c}=s;Jr(n,t._pointLabels[i],l,u+o.lineHeight/2,o,{color:a.color,textAlign:c,textBaseline:"middle"})}}function q0(t,e,n,r){const{ctx:i}=t;if(n)i.arc(t.xCenter,t.yCenter,e,0,Wt);else{let s=t.getPointPosition(0,e);i.moveTo(s.x,s.y);for(let a=1;a<r;a++)s=t.getPointPosition(a,e),i.lineTo(s.x,s.y)}}function jk(t,e,n,r,i){const s=t.ctx,a=e.circular,{color:o,lineWidth:l}=e;!a&&!r||!o||!l||n<0||(s.save(),s.strokeStyle=o,s.lineWidth=l,s.setLineDash(i.dash||[]),s.lineDashOffset=i.dashOffset,s.beginPath(),q0(t,n,a,r),s.closePath(),s.stroke(),s.restore())}function Ek(t,e,n){return br(t,{label:n,index:e,type:"pointLabel"})}class ps extends Iu{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=lt(Lu(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=nt(e)&&!isNaN(e)?e:0,this.max=nt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Lu(this.options))}generateTickLabels(e){Iu.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const i=_e(this.options.pointLabels.callback,[n,r],this);return i||i===0?i:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?mk(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,i){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,i))}getIndexAngle(e){const n=Wt/(this._pointLabels.length||1),r=this.options.startAngle||0;return Ut(e*n+dr(r))}getDistanceFromCenterForValue(e){if(Ne(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(Ne(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e<n.length){const r=n[e];return Ek(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const i=this.getIndexAngle(e)-Ht+r;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:i,bottom:s}=this._pointLabelItems[e];return{left:n,top:r,right:i,bottom:s}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),q0(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:i,border:s}=n,a=this._pointLabels.length;let o,l,u;if(n.pointLabels.display&&kk(this,a),i.display&&this.ticks.forEach((c,f)=>{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);const p=this.getContext(f),h=i.setContext(p),y=s.setContext(p);jk(this,h,l,a,y)}}),r.display){for(e.save(),o=a-1;o>=0;o--){const c=r.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:p}=c;!p||!f||(e.lineWidth=p,e.strokeStyle=f,e.setLineDash(c.borderDash),e.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),u=this.getPointPosition(o,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(u.x,u.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const i=this.getIndexAngle(0);let s,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const u=r.setContext(this.getContext(l)),c=Je(u.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),u.showLabelBackdrop){e.font=c.string,a=e.measureText(o.label).width,e.fillStyle=u.backdropColor;const f=lt(u.backdropPadding);e.fillRect(-a/2-f.left,-s-c.size/2-f.top,a+f.width,c.size+f.height)}Jr(e,o.label,0,-s,c,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),e.restore()}drawTitle(){}}he(ps,"id","radialLinear"),he(ps,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ec.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),he(ps,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),he(ps,"descriptors",{angleLines:{_fallback:"grid"}});const qo={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}},St=Object.keys(qo);function Mh(t,e){return t-e}function Lh(t,e){if(Ne(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let a=e;return typeof r=="function"&&(a=r(a)),nt(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(Us(s)||s===!0)?n.startOf(a,"isoWeek",s):n.startOf(a,i)),+a)}function Nh(t,e,n,r){const i=St.length;for(let s=St.indexOf(t);s<i-1;++s){const a=qo[St[s]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-e)/(o*a.size))<=r)return St[s]}return St[i-1]}function Ok(t,e,n,r,i){for(let s=St.length-1;s>=St.indexOf(n);s--){const a=St[s];if(qo[a].common&&t._adapter.diff(i,r,a)>=e-1)return a}return St[n?St.indexOf(n):0]}function Tk(t){for(let e=St.indexOf(t)+1,n=St.length;e<n;++e)if(qo[St[e]].common)return St[e]}function Rh(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=Cc(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function Pk(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),a=e[e.length-1].value;let o,l;for(o=s;o<=a;o=+i.add(o,1,r))l=n[o],l>=0&&(e[l].major=!0);return e}function _h(t,e,n){const r=[],i={},s=e.length;let a,o;for(a=0;a<s;++a)o=e[a],i[o]=a,r.push({value:o,major:!1});return s===0||!n?r:Pk(t,r,i,n)}class mo extends Hi{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new d6._date(e.adapters.date);i.init(n),vs(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:Lh(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:a,maxDefined:o}=this.getUserBounds();function l(u){!a&&!isNaN(u.min)&&(i=Math.min(i,u.min)),!o&&!isNaN(u.max)&&(s=Math.max(s,u.max))}(!a||!o)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=nt(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=nt(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,a=this.max,o=UC(i,s,a);return this._unit=n.unit||(r.autoSkip?Nh(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):Ok(this,o.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:Tk(this._unit),this.initOffsets(i),e.reverse&&o.reverse(),_h(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;n=Zt(n,0,a),r=Zt(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,a=s.unit||Nh(s.minUnit,n,r,this._getLabelCapacity(n)),o=Ae(i.ticks.stepSize,1),l=a==="week"?s.isoWeekday:!1,u=Us(l)||l===!0,c={};let f=n,p,h;if(u&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,u?"day":a),e.diff(r,n,a)>1e5*o)throw new Error(n+" and "+r+" are too far apart with stepSize of "+o+" "+a);const y=i.ticks.source==="data"&&this.getDataTimestamps();for(p=f,h=0;p<r;p=+e.add(p,o,a),h++)Rh(c,p,y);return(p===r||i.bounds==="ticks"||h===1)&&Rh(c,p,y),Object.keys(c).sort(Mh).map(m=>+m)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,a=n||i[s];return this._adapter.format(e,a)}_tickFormatFunction(e,n,r,i){const s=this.options,a=s.ticks.callback;if(a)return _e(a,[e,n,r],this);const o=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&o[l],f=u&&o[u],p=r[n],h=u&&f&&p&&p.major;return this._adapter.format(e,i||(h?f:c))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=dr(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),a=Math.sin(i),o=this._resolveTickFontOptions(0).size;return{w:r*s+o*a,h:r*a+o*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,_h(this,[e],this._majorUnit),i),a=this._getLabelSize(s),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(Lh(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return qC(e.sort(Mh))}}he(mo,"id","time"),he(mo,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ia(t,e,n){let r=0,i=t.length-1,s,a,o,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=Mr(t,"pos",e)),{pos:s,time:o}=t[r],{pos:a,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=Mr(t,"time",e)),{time:s,pos:o}=t[r],{time:a,pos:l}=t[i]);const u=a-s;return u?o+(l-o)*(e-s)/u:o}class Dh extends mo{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Ia(n,this.min),this._tableRange=Ia(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let a,o,l,u,c;for(a=0,o=e.length;a<o;++a)u=e[a],u>=n&&u<=r&&i.push(u);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,o=i.length;a<o;++a)c=i[a+1],l=i[a-1],u=i[a],Math.round((c+l)/2)!==u&&s.push({time:u,pos:a/(o-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Ia(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Ia(this._table,r*this._tableRange+this._minPos,!0)}}he(Dh,"id","timeseries"),he(Dh,"defaults",mo.defaults);const W0="label";function Bh(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function Ik(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Q0(t,e){t.labels=e}function G0(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W0;const r=[];t.datasets=e.map(i=>{const s=t.datasets.find(a=>a[n]===i[n]);return!s||!i.data||r.includes(s)?{...i}:(r.push(s),Object.assign(s,i),s)})}function Mk(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W0;const n={labels:[],datasets:[]};return Q0(n,t.labels),G0(n,t.datasets,e),n}function Lk(t,e){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:a,data:o,options:l,plugins:u=[],fallbackContent:c,updateMode:f,...p}=t,h=F.useRef(null),y=F.useRef(null),m=()=>{h.current&&(y.current=new Uo(h.current,{type:a,data:Mk(o,s),options:l&&{...l},plugins:u}),Bh(e,y.current))},g=()=>{Bh(e,null),y.current&&(y.current.destroy(),y.current=null)};return F.useEffect(()=>{!i&&y.current&&l&&Ik(y.current,l)},[i,l]),F.useEffect(()=>{!i&&y.current&&Q0(y.current.config.data,o.labels)},[i,o.labels]),F.useEffect(()=>{!i&&y.current&&o.datasets&&G0(y.current.config.data,o.datasets,s)},[i,o.datasets]),F.useEffect(()=>{y.current&&(i?(g(),setTimeout(m)):y.current.update(f))},[i,l,o.labels,o.datasets,f]),F.useEffect(()=>{y.current&&(g(),setTimeout(m))},[a]),F.useEffect(()=>(m(),()=>g()),[]),F.createElement("canvas",{ref:h,role:"img",height:n,width:r,...p},c)}const Nk=F.forwardRef(Lk);function Y0(t,e){return Uo.register(e),F.forwardRef((n,r)=>F.createElement(Nk,{...n,ref:r,type:t}))}const Rk=Y0("line",Ga),_k=Y0("radar",Ya);Uo.register(Pu,Mu,ps,hr,Xa,V4,nk,ck,ek);var Nu={elements:{line:{backgroundColor:"rgba(166, 30, 105, 0.2)",borderColor:"rgba(166, 30, 105, 1)",borderWidth:4},point:{backgroundColor:"rgba(166, 30, 105, 1)",borderColor:"rgba(255,255,255, .9)",borderWidth:2,radius:5,hoverRadius:6,hoverBorderWidth:3}},responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1}},interaction:{mode:"nearest",axis:"x",intersect:!1}},Dk=function(e){var n=e.chart.ctx,r=e.chart.chartArea;if(!r)return"rgba(166, 30, 105, 0.1)";var i=(r.left+r.right)/2,s=(r.top+r.bottom)/2,a=Math.min((r.right-r.left)/2,(r.bottom-r.top)/2),o=n.createRadialGradient(i,s,0,i,s,a);return o.addColorStop(0,"rgba(255, 255, 255, 0.4)"),o.addColorStop(.3,"rgba(255, 255, 255, 0.4)"),o.addColorStop(1,"rgba(166, 30, 105, 0.2)"),o};function Fh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fh(Object(n),!0).forEach(function(r){Bk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bk(t,e,n){return(e=Fk(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fk(t){var e=zk(t,"string");return Ni(e)=="symbol"?e:e+""}function zk(t,e){if(Ni(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ni(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ni(t){"@babel/helpers - typeof";return Ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ni(t)}function Uk(t){var e=new Date(t);return isNaN(e.getTime())?String(t):e.toLocaleString("en-US",{month:"short",day:"numeric"})}var Hk=function(){var e,n,r,i,s=Xn(),a=s.data,o=s.isLoading,l=s.isRefetching,u=a==null?void 0:a.mentions,c=u==null||(e=u.mentionedInNumberOfQueries)===null||e===void 0||(e=e.previous)===null||e===void 0?void 0:e.difference,f=u==null?void 0:u.chart,p=Array.isArray(f==null?void 0:f.labels)?f.labels:f!=null&&f.labels&&Ni(f.labels)==="object"?Object.values(f.labels):[],h=p.map(function(v){return Uk(String(v))}),y=a==null?void 0:a.numberOfQueries;if(!y){var m=0;Array.isArray(f==null?void 0:f.datasets)&&f.datasets.forEach(function(v){Array.isArray(v==null?void 0:v.data)&&v.data.forEach(function(S){typeof S=="number"&&S>m&&(m=S)})}),y=m+2}var g=zh(zh({},Nu),{},{responsive:!0,maintainAspectRatio:!1,scales:{x:{display:!0,title:{display:!1,text:"Date"},grid:{display:!1}},y:{display:!0,title:{display:!1,text:"Number of Mentions"},beginAtZero:!0,max:y,ticks:{stepSize:1}}}});return d.jsx(k.Card,{className:"yst-overflow-visible",children:d.jsxs(k.Card.Content,{className:"yst-space-y-4",children:[d.jsxs("div",{className:"yst-space-y-2",children:[d.jsx(aa,{title:"Mentions progress",tooltip:"Tracks how your brand mentions have changed over time across the same query set."}),d.jsx(sa,{score:u==null||(n=u.mentionedInNumberOfQueries)===null||n===void 0?void 0:n.value,total:a==null?void 0:a.numberOfQueries,delta:c,deltaSuffix:"since last analysis",suffix:"queries",isLoading:o||l})]}),Array.isArray(f==null||(r=f.datasets)===null||r===void 0?void 0:r.data)&&(f==null||(i=f.datasets)===null||i===void 0?void 0:i.data.length)<2?d.jsx(k.Alert,{variant:"info",children:"One more analysis needed to show more insights."}):d.jsx("div",{className:"yst-h-72",children:d.jsx(Rk,{data:function(){var v={labels:h,datasets:[f==null?void 0:f.datasets]};return v}(),options:g})})]})})},qk=function(){var e,n=Xn(),r=n.data,i=n.isLoading,s=n.isRefetching;if(i&&!s||(r==null||(e=r.mentions)===null||e===void 0||(e=e.mentionedInNumberOfQueries)===null||e===void 0?void 0:e.value)!==0)return null;var a=[{title:"Activate llms.txt",description:"Make sure AI systems know where to look and which pages matter most.",link:{url:"https://yoast.com/features/llms-txt/",text:"Set up llms.txt in Yoast SEO"}},{title:"Adopt an LLM-friendly content structure",description:"Start with clear definitions or TL;DRs, use subheadings, and format answers so LLMs can lift them directly.",link:{url:"https://yoast.com/yoast-seo-premium-september-9-2025/",text:"Learn how to generate AI summaries"}},{title:"Simplify writing and readability",description:"Use shorter sentences, plain language, and one idea per paragraph. This makes it easier for AI systems to recognize and quote your content."}];return d.jsx(k.Card,{className:"yst-overflow-visible yst-p-8 md:yst-col-span-2 yst-text-slate-800",children:d.jsxs(k.Card.Content,{className:"yst-max-w-2xl",children:[d.jsx(k.Title,{size:"2",className:"yst-mb-2 yst-text-slate-900",children:"We couldn't find your brand in this brand analysis..."}),d.jsx("p",{className:"yst-text-slate-600",children:"This means LLMs may not yet be surfacing your site in answers. Don't worry, here are some steps you can take today to boost your AI visibility:"}),d.jsx("ol",{className:"yst-my-0 yst-list-none yst-divide-y yst-divide-slate-200 [counter-reset:list-counter]",children:a.map(function(o,l){return d.jsx("li",{className:"yst-relative yst-py-4 last:yst-pb-0 [counter-increment:list-counter] before:yst-absolute before:yst-left-0 before:yst-font-semibold before:yst-text-slate-800 before:yst-content-[counter(list-counter)'.']",children:d.jsxs("div",{className:"yst-ml-4 yst-text-slate-600",children:[d.jsx("strong",{className:"yst-font-medium yst-text-slate-800",children:o.title}),d.jsx("br",{}),o.description,o.link&&d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"yst-mt-2 yst-block",children:d.jsxs("a",{href:o.link.url,target:"_blank",rel:"noopener noreferrer",className:"yst-font-medium",children:[o.link.text,d.jsx(Md,{className:"yst-ml-1 yst-inline yst-h-3 yst-w-3"})]})})]})]})},l)})}),d.jsx(zi,{size:4,className:"yst-pt-0"}),d.jsxs("p",{className:"yst-text-slate-600",children:["Want to go deeper? →"," ",d.jsxs("a",{href:"https://yoast.com/how-to-optimize-content-for-llms/",target:"_blank",rel:"noopener noreferrer",className:"yst-font-medium",children:["Read our full guide on optimizing content for LLMs",d.jsx(Md,{className:"yst-ml-1 yst-inline yst-h-3 yst-w-3"})]})]})]})})};function Ma(t){var e=t.value,n=e===void 0?"—":e,r=t.label,i=t.tooltip,s=t.className,a=t.borderBottom,o=a===void 0?!1:a,l=t.borderRight,u=l===void 0?!1:l,c=t.delta,f=t.tooltipPosition,p=f===void 0?"left":f;return d.jsxs("div",{className:oe("yst-relative yst-flex yst-flex-col yst-items-center yst-gap-1 yst-p-4 yst-text-center",o&&"yst-border-b yst-border-slate-200",u&&"yst-border-r yst-border-slate-200",s),children:[d.jsx("p",{className:"yst-text-2xl yst-font-bold yst-text-slate-900",children:n}),d.jsx("p",{className:"yst-text-tiny yst-text-slate-600",children:r}),typeof c=="number"&&d.jsxs("p",{className:oe("yst-flex yst-items-center yst-gap-1 yst-text-tiny yst-font-bold",Ms(c)),children:[c>0?d.jsx(Hm,{}):c<0?d.jsx(Um,{}):null,c>-1e-6&&"+",c]}),i&&d.jsx(vc,{id:"tooltip-".concat(r.replace(/\s+/g,"-").toLowerCase()),className:"yst-absolute yst-right-2 yst-top-2",position:p,children:i})]})}function Wk(t){var e=t.children,n=t.className;return d.jsx("div",{className:oe("yst-grid yst-w-full yst-grid-cols-2 yst-gap-0 yst-rounded-lg",n),children:e})}function Qk(t){return t>0?"yst-text-green-600":t<0?"yst-text-red-600":"yst-text-slate-500"}function Gk(t){var e=t.current,n=t.previous,r=t.className;if(typeof n!="number")return null;var i=e-n,s=i>0,a=i<0,o="".concat(i>0?"+":"").concat(i.toFixed(1),"%");return d.jsxs("div",{className:oe("yst-flex yst-items-center yst-gap-1 yst-text-tiny yst-font-bold",Qk(i),r),"aria-label":s?"Visibility increased by ".concat(o):a?"Visibility decreased by ".concat(o):"No change in visibility",children:[s&&d.jsx(Hm,{className:"yst-w-4 yst-h-4"}),a&&d.jsx(Um,{className:"yst-w-4 yst-h-4"}),o]})}function qs(t){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qs(t)}function Yk(t,e){return Jk(t)||Xk(t,e)||Kk(t,e)||Vk()}function Vk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
52
+ `):t}function rk(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:a,value:o}=s.getLabelAndValue(i);return{chart:t,label:a,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:o,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Ch(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:a,boxHeight:o}=e,l=Je(e.bodyFont),u=Je(e.titleFont),c=Je(e.footerFont),f=s.length,p=i.length,h=r.length,y=lt(e.padding);let m=y.height,g=0,v=r.reduce((E,A)=>E+A.before.length+A.lines.length+A.after.length,0);if(v+=t.beforeBody.length+t.afterBody.length,f&&(m+=f*u.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),v){const E=e.displayColors?Math.max(o,l.lineHeight):l.lineHeight;m+=h*E+(v-h)*l.lineHeight+(v-1)*e.bodySpacing}p&&(m+=e.footerMarginTop+p*c.lineHeight+(p-1)*e.footerSpacing);let S=0;const j=function(E){g=Math.max(g,n.measureText(E).width+S)};return n.save(),n.font=u.string,Le(t.title,j),n.font=l.string,Le(t.beforeBody.concat(t.afterBody),j),S=e.displayColors?a+2+e.boxPadding:0,Le(r,E=>{Le(E.before,j),Le(E.lines,j),Le(E.after,j)}),S=0,n.font=c.string,Le(t.footer,j),n.restore(),g+=y.width,{width:g,height:m}}function ik(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function sk(t,e,n,r){const{x:i,width:s}=r,a=n.caretSize+n.caretPadding;if(t==="left"&&i+s+a>e.width||t==="right"&&i-s-a<0)return!0}function ak(t,e,n,r){const{x:i,width:s}=n,{width:a,chartArea:{left:o,right:l}}=t;let u="center";return r==="center"?u=i<=(o+l)/2?"left":"right":i<=s/2?u="left":i>=a-s/2&&(u="right"),sk(u,t,e,n)&&(u="center"),u}function kh(t,e,n){const r=n.yAlign||e.yAlign||ik(t,n);return{xAlign:n.xAlign||e.xAlign||ak(t,e,n,r),yAlign:r}}function ok(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function lk(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function jh(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:a}=t,{xAlign:o,yAlign:l}=n,u=i+s,{topLeft:c,topRight:f,bottomLeft:p,bottomRight:h}=fi(a);let y=ok(e,o);const m=lk(e,l,u);return l==="center"?o==="left"?y+=u:o==="right"&&(y-=u):o==="left"?y-=Math.max(c,p)+i:o==="right"&&(y+=Math.max(f,h)+i),{x:Zt(y,0,r.width-e.width),y:Zt(m,0,r.height-e.height)}}function Pa(t,e,n){const r=lt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function Eh(t){return yn([],Rn(t))}function uk(t,e,n){return br(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Oh(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const H0={beforeTitle:Pn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:Pn,beforeBody:Pn,beforeLabel:Pn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ne(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Pn,afterBody:Pn,beforeFooter:Pn,footer:Pn,afterFooter:Pn};function bt(t,e,n,r){const i=t[e].call(n,r);return typeof i=="undefined"?H0[e].call(n,r):i}class Tu extends Yn{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new k0(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=uk(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=bt(r,"beforeTitle",this,e),s=bt(r,"title",this,e),a=bt(r,"afterTitle",this,e);let o=[];return o=yn(o,Rn(i)),o=yn(o,Rn(s)),o=yn(o,Rn(a)),o}getBeforeBody(e,n){return Eh(bt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return Le(e,s=>{const a={before:[],lines:[],after:[]},o=Oh(r,s);yn(a.before,Rn(bt(o,"beforeLabel",this,s))),yn(a.lines,bt(o,"label",this,s)),yn(a.after,Rn(bt(o,"afterLabel",this,s))),i.push(a)}),i}getAfterBody(e,n){return Eh(bt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=bt(r,"beforeFooter",this,e),s=bt(r,"footer",this,e),a=bt(r,"afterFooter",this,e);let o=[];return o=yn(o,Rn(i)),o=yn(o,Rn(s)),o=yn(o,Rn(a)),o}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],a=[];let o=[],l,u;for(l=0,u=n.length;l<u;++l)o.push(rk(this.chart,n[l]));return e.filter&&(o=o.filter((c,f,p)=>e.filter(c,f,p,r))),e.itemSort&&(o=o.sort((c,f)=>e.itemSort(c,f,r))),Le(o,c=>{const f=Oh(e.callbacks,c);i.push(bt(f,"labelColor",this,c)),s.push(bt(f,"labelPointStyle",this,c)),a.push(bt(f,"labelTextColor",this,c))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=a,this.dataPoints=o,o}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,a=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const o=hs[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=Ch(this,r),u=Object.assign({},o,l),c=kh(this.chart,r,u),f=jh(r,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=a,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:a,cornerRadius:o}=r,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:f}=fi(o),{x:p,y:h}=e,{width:y,height:m}=n;let g,v,S,j,E,A;return s==="center"?(E=h+m/2,i==="left"?(g=p,v=g-a,j=E+a,A=E-a):(g=p+y,v=g+a,j=E-a,A=E+a),S=g):(i==="left"?v=p+Math.max(l,c)+a:i==="right"?v=p+y-Math.max(u,f)-a:v=this.caretX,s==="top"?(j=h,E=j-a,g=v-a,S=v+a):(j=h+m,E=j+a,g=v+a,S=v-a),A=j),{x1:g,x2:v,x3:S,y1:j,y2:E,y3:A}}drawTitle(e,n,r){const i=this.title,s=i.length;let a,o,l;if(s){const u=hi(r.rtl,this.x,this.width);for(e.x=Pa(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",a=Je(r.titleFont),o=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;l<s;++l)n.fillText(i[l],u.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+o,l+1===s&&(e.y+=r.titleMarginBottom-o)}}_drawColorBox(e,n,r,i,s){const a=this.labelColors[r],o=this.labelPointStyles[r],{boxHeight:l,boxWidth:u}=s,c=Je(s.bodyFont),f=Pa(this,"left",s),p=i.x(f),h=l<c.lineHeight?(c.lineHeight-l)/2:0,y=n.y+h;if(s.usePointStyle){const m={radius:Math.min(u,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},g=i.leftForLtr(p,u)+u/2,v=y+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,Cu(e,m,g,v),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,Cu(e,m,g,v)}else{e.lineWidth=Ce(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const m=i.leftForLtr(p,u),g=i.leftForLtr(i.xPlus(p,1),u-2),v=fi(a.borderRadius);Object.values(v).some(S=>S!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,ho(e,{x:m,y,w:u,h:l,radius:v}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),ho(e,{x:g,y:y+1,w:u-2,h:l-2,radius:v}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(m,y,u,l),e.strokeRect(m,y,u,l),e.fillStyle=a.backgroundColor,e.fillRect(g,y+1,u-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:a,displayColors:o,boxHeight:l,boxWidth:u,boxPadding:c}=r,f=Je(r.bodyFont);let p=f.lineHeight,h=0;const y=hi(r.rtl,this.x,this.width),m=function(b){n.fillText(b,y.x(e.x+h),e.y+p/2),e.y+=p+s},g=y.textAlign(a);let v,S,j,E,A,w,x;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,e.x=Pa(this,g,r),n.fillStyle=r.bodyColor,Le(this.beforeBody,m),h=o&&g!=="right"?a==="center"?u/2+c:u+2+c:0,E=0,w=i.length;E<w;++E){for(v=i[E],S=this.labelTextColors[E],n.fillStyle=S,Le(v.before,m),j=v.lines,o&&j.length&&(this._drawColorBox(n,e,E,y,r),p=Math.max(f.lineHeight,l)),A=0,x=j.length;A<x;++A)m(j[A]),p=f.lineHeight;Le(v.after,m)}h=0,p=f.lineHeight,Le(this.afterBody,m),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let a,o;if(s){const l=hi(r.rtl,this.x,this.width);for(e.x=Pa(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",a=Je(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,o=0;o<s;++o)n.fillText(i[o],l.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:a}=this,{x:o,y:l}=e,{width:u,height:c}=r,{topLeft:f,topRight:p,bottomLeft:h,bottomRight:y}=fi(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(o+f,l),a==="top"&&this.drawCaret(e,n,r,i),n.lineTo(o+u-p,l),n.quadraticCurveTo(o+u,l,o+u,l+p),a==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(o+u,l+c-y),n.quadraticCurveTo(o+u,l+c,o+u-y,l+c),a==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(o+h,l+c),n.quadraticCurveTo(o,l+c,o,l+c-h),a==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(o,l+f),n.quadraticCurveTo(o,l,o+f,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const a=hs[e.position].call(this,this._active,this._eventPosition);if(!a)return;const o=this._size=Ch(this,e),l=Object.assign({},a,this._size),u=kh(n,e,l),c=jh(e,l,u,n);(i._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=o.width,this.height=o.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=lt(n.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&o&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),b0(e,n.textDirection),s.y+=a.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),x0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:o,index:l})=>{const u=this.chart.getDatasetMeta(o);if(!u)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:u.data[l],index:l}}),s=!oo(r,i),a=this._positionChanged(i,n);(s||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],a=this._getActiveElements(e,s,n,r),o=this._positionChanged(a,e),l=n||!oo(a,s)||o;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(o=>this.chart.data.datasets[o.datasetIndex]&&this.chart.getDatasetMeta(o.datasetIndex).controller.getParsed(o.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&a.reverse(),a}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,a=hs[s.position].call(this,e,n);return a!==!1&&(r!==a.x||i!==a.y)}}he(Tu,"positioners",hs);var ck={id:"tooltip",_element:Tu,positioners:hs,afterInit(t,e,n){n&&(t.tooltip=new Tu({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:H0},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const dk=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function fk(t,e,n,r){const i=t.indexOf(e);if(i===-1)return dk(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const hk=(t,e)=>t===null?null:Zt(Math.round(t),0,e);function Th(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Pu extends Hi{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ne(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:fk(r,e,Ae(n,e),this._addedLabels),hk(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=e;a<=n;a++)i.push({value:a});return i}getLabelForValue(e){return Th.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}he(Pu,"id","category"),he(Pu,"defaults",{ticks:{callback:Th}});function pk(t,e){const n=[],{bounds:i,step:s,min:a,max:o,precision:l,count:u,maxTicks:c,maxDigits:f,includeBounds:p}=t,h=s||1,y=c-1,{min:m,max:g}=e,v=!Ne(a),S=!Ne(o),j=!Ne(u),E=(g-m)/(f+1);let A=Pf((g-m)/y/h)*h,w,x,b,L;if(A<1e-14&&!v&&!S)return[{value:m},{value:g}];L=Math.ceil(g/A)-Math.floor(m/A),L>y&&(A=Pf(L*A/y/h)*h),Ne(l)||(w=Math.pow(10,l),A=Math.ceil(A*w)/w),i==="ticks"?(x=Math.floor(m/A)*A,b=Math.ceil(g/A)*A):(x=m,b=g),v&&S&&s&&RC((o-a)/s,A/1e3)?(L=Math.round(Math.min((o-a)/A,c)),A=(o-a)/L,x=a,b=o):j?(x=v?a:x,b=S?o:b,L=u-1,A=(b-x)/L):(L=(b-x)/A,bs(L,Math.round(L),A/1e3)?L=Math.round(L):L=Math.ceil(L));const R=Math.max(If(A),If(x));w=Math.pow(10,Ne(l)?R:l),x=Math.round(x*w)/w,b=Math.round(b*w)/w;let I=0;for(v&&(p&&x!==a?(n.push({value:a}),x<a&&I++,bs(Math.round((x+I*A)*w)/w,a,Ph(a,E,t))&&I++):x<a&&I++);I<L;++I){const P=Math.round((x+I*A)*w)/w;if(S&&P>o)break;n.push({value:P})}return S&&p&&b!==o?n.length&&bs(n[n.length-1].value,o,Ph(o,E,t))?n[n.length-1].value=o:n.push({value:o}):(!S||b===o)&&n.push({value:b}),n}function Ph(t,e,{horizontal:n,minRotation:r}){const i=dr(r),s=(n?Math.sin(i):Math.cos(i))||.001,a=.75*e*(""+t).length;return Math.min(e/s,a)}class Iu extends Hi{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return Ne(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const a=l=>i=n?i:l,o=l=>s=r?s:l;if(e){const l=Ii(i),u=Ii(s);l<0&&u<0?o(0):l>0&&u>0&&a(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);o(s+l),e||a(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,a=pk(i,s);return e.bounds==="ticks"&&_C(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return d0(e,this.chart.options.locale,this.options.ticks.format)}}class Mu extends Iu{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=nt(e)?e:0,this.max=nt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=dr(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}he(Mu,"id","linear"),he(Mu,"defaults",{ticks:{callback:Ec.formatters.numeric}});function Lu(t){const e=t.ticks;if(e.display&&t.display){const n=lt(e.backdropPadding);return Ae(e.font&&e.font.size,qe.font.size)+n.height}return 0}function yk(t,e,n){return n=Ue(n)?n:[n],{w:i5(t,e.string,n),h:n.length*e.lineHeight}}function Ih(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:t<r||t>i?{start:e-n,end:e}:{start:e,end:e+n}}function mk(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),r=[],i=[],s=t._pointLabels.length,a=t.options.pointLabels,o=a.centerPointLabels?Ye/s:0;for(let l=0;l<s;l++){const u=a.setContext(t.getPointLabelContext(l));i[l]=u.padding;const c=t.getPointPosition(l,t.drawingArea+i[l],o),f=Je(u.font),p=yk(t.ctx,f,t._pointLabels[l]);r[l]=p;const h=Ut(t.getIndexAngle(l)+o),y=Math.round(Sc(h)),m=Ih(y,c.x,p.w,0,180),g=Ih(y,c.y,p.h,90,270);gk(n,e,h,m,g)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=xk(t,r,i)}function gk(t,e,n,r,i){const s=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let o=0,l=0;r.start<e.l?(o=(e.l-r.start)/s,t.l=Math.min(t.l,e.l-o)):r.end>e.r&&(o=(r.end-e.r)/s,t.r=Math.max(t.r,e.r+o)),i.start<e.t?(l=(e.t-i.start)/a,t.t=Math.min(t.t,e.t-l)):i.end>e.b&&(l=(i.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function vk(t,e,n){const r=t.drawingArea,{extra:i,additionalAngle:s,padding:a,size:o}=n,l=t.getPointPosition(e,r+i+a,s),u=Math.round(Sc(Ut(l.angle+Ht))),c=Sk(l.y,o.h,u),f=wk(u),p=Ak(l.x,o.w,f);return{visible:!0,x:l.x,y:c,textAlign:f,left:p,top:c,right:p+o.w,bottom:c+o.h}}function bk(t,e){if(!e)return!0;const{left:n,top:r,right:i,bottom:s}=t;return!(qn({x:n,y:r},e)||qn({x:n,y:s},e)||qn({x:i,y:r},e)||qn({x:i,y:s},e))}function xk(t,e,n){const r=[],i=t._pointLabels.length,s=t.options,{centerPointLabels:a,display:o}=s.pointLabels,l={extra:Lu(s)/2,additionalAngle:a?Ye/i:0};let u;for(let c=0;c<i;c++){l.padding=n[c],l.size=e[c];const f=vk(t,c,l);r.push(f),o==="auto"&&(f.visible=bk(f,u),f.visible&&(u=f))}return r}function wk(t){return t===0||t===180?"center":t<180?"left":"right"}function Ak(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function Sk(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function Ck(t,e,n){const{left:r,top:i,right:s,bottom:a}=n,{backdropColor:o}=e;if(!Ne(o)){const l=fi(e.borderRadius),u=lt(e.backdropPadding);t.fillStyle=o;const c=r-u.left,f=i-u.top,p=s-r+u.width,h=a-i+u.height;Object.values(l).some(y=>y!==0)?(t.beginPath(),ho(t,{x:c,y:f,w:p,h,radius:l}),t.fill()):t.fillRect(c,f,p,h)}}function kk(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let i=e-1;i>=0;i--){const s=t._pointLabelItems[i];if(!s.visible)continue;const a=r.setContext(t.getPointLabelContext(i));Ck(n,a,s);const o=Je(a.font),{x:l,y:u,textAlign:c}=s;Jr(n,t._pointLabels[i],l,u+o.lineHeight/2,o,{color:a.color,textAlign:c,textBaseline:"middle"})}}function q0(t,e,n,r){const{ctx:i}=t;if(n)i.arc(t.xCenter,t.yCenter,e,0,Wt);else{let s=t.getPointPosition(0,e);i.moveTo(s.x,s.y);for(let a=1;a<r;a++)s=t.getPointPosition(a,e),i.lineTo(s.x,s.y)}}function jk(t,e,n,r,i){const s=t.ctx,a=e.circular,{color:o,lineWidth:l}=e;!a&&!r||!o||!l||n<0||(s.save(),s.strokeStyle=o,s.lineWidth=l,s.setLineDash(i.dash||[]),s.lineDashOffset=i.dashOffset,s.beginPath(),q0(t,n,a,r),s.closePath(),s.stroke(),s.restore())}function Ek(t,e,n){return br(t,{label:n,index:e,type:"pointLabel"})}class ps extends Iu{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=lt(Lu(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=nt(e)&&!isNaN(e)?e:0,this.max=nt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Lu(this.options))}generateTickLabels(e){Iu.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const i=_e(this.options.pointLabels.callback,[n,r],this);return i||i===0?i:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?mk(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,i){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,i))}getIndexAngle(e){const n=Wt/(this._pointLabels.length||1),r=this.options.startAngle||0;return Ut(e*n+dr(r))}getDistanceFromCenterForValue(e){if(Ne(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(Ne(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e<n.length){const r=n[e];return Ek(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const i=this.getIndexAngle(e)-Ht+r;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:i,bottom:s}=this._pointLabelItems[e];return{left:n,top:r,right:i,bottom:s}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),q0(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:i,border:s}=n,a=this._pointLabels.length;let o,l,u;if(n.pointLabels.display&&kk(this,a),i.display&&this.ticks.forEach((c,f)=>{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);const p=this.getContext(f),h=i.setContext(p),y=s.setContext(p);jk(this,h,l,a,y)}}),r.display){for(e.save(),o=a-1;o>=0;o--){const c=r.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:p}=c;!p||!f||(e.lineWidth=p,e.strokeStyle=f,e.setLineDash(c.borderDash),e.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),u=this.getPointPosition(o,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(u.x,u.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const i=this.getIndexAngle(0);let s,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const u=r.setContext(this.getContext(l)),c=Je(u.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),u.showLabelBackdrop){e.font=c.string,a=e.measureText(o.label).width,e.fillStyle=u.backdropColor;const f=lt(u.backdropPadding);e.fillRect(-a/2-f.left,-s-c.size/2-f.top,a+f.width,c.size+f.height)}Jr(e,o.label,0,-s,c,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),e.restore()}drawTitle(){}}he(ps,"id","radialLinear"),he(ps,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ec.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),he(ps,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),he(ps,"descriptors",{angleLines:{_fallback:"grid"}});const qo={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}},St=Object.keys(qo);function Mh(t,e){return t-e}function Lh(t,e){if(Ne(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let a=e;return typeof r=="function"&&(a=r(a)),nt(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(Us(s)||s===!0)?n.startOf(a,"isoWeek",s):n.startOf(a,i)),+a)}function Nh(t,e,n,r){const i=St.length;for(let s=St.indexOf(t);s<i-1;++s){const a=qo[St[s]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-e)/(o*a.size))<=r)return St[s]}return St[i-1]}function Ok(t,e,n,r,i){for(let s=St.length-1;s>=St.indexOf(n);s--){const a=St[s];if(qo[a].common&&t._adapter.diff(i,r,a)>=e-1)return a}return St[n?St.indexOf(n):0]}function Tk(t){for(let e=St.indexOf(t)+1,n=St.length;e<n;++e)if(qo[St[e]].common)return St[e]}function Rh(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=Cc(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function Pk(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),a=e[e.length-1].value;let o,l;for(o=s;o<=a;o=+i.add(o,1,r))l=n[o],l>=0&&(e[l].major=!0);return e}function _h(t,e,n){const r=[],i={},s=e.length;let a,o;for(a=0;a<s;++a)o=e[a],i[o]=a,r.push({value:o,major:!1});return s===0||!n?r:Pk(t,r,i,n)}class mo extends Hi{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new d6._date(e.adapters.date);i.init(n),vs(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:Lh(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:a,maxDefined:o}=this.getUserBounds();function l(u){!a&&!isNaN(u.min)&&(i=Math.min(i,u.min)),!o&&!isNaN(u.max)&&(s=Math.max(s,u.max))}(!a||!o)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=nt(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=nt(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,a=this.max,o=UC(i,s,a);return this._unit=n.unit||(r.autoSkip?Nh(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):Ok(this,o.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:Tk(this._unit),this.initOffsets(i),e.reverse&&o.reverse(),_h(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;n=Zt(n,0,a),r=Zt(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,a=s.unit||Nh(s.minUnit,n,r,this._getLabelCapacity(n)),o=Ae(i.ticks.stepSize,1),l=a==="week"?s.isoWeekday:!1,u=Us(l)||l===!0,c={};let f=n,p,h;if(u&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,u?"day":a),e.diff(r,n,a)>1e5*o)throw new Error(n+" and "+r+" are too far apart with stepSize of "+o+" "+a);const y=i.ticks.source==="data"&&this.getDataTimestamps();for(p=f,h=0;p<r;p=+e.add(p,o,a),h++)Rh(c,p,y);return(p===r||i.bounds==="ticks"||h===1)&&Rh(c,p,y),Object.keys(c).sort(Mh).map(m=>+m)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,a=n||i[s];return this._adapter.format(e,a)}_tickFormatFunction(e,n,r,i){const s=this.options,a=s.ticks.callback;if(a)return _e(a,[e,n,r],this);const o=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&o[l],f=u&&o[u],p=r[n],h=u&&f&&p&&p.major;return this._adapter.format(e,i||(h?f:c))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=dr(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),a=Math.sin(i),o=this._resolveTickFontOptions(0).size;return{w:r*s+o*a,h:r*a+o*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,_h(this,[e],this._majorUnit),i),a=this._getLabelSize(s),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(Lh(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return qC(e.sort(Mh))}}he(mo,"id","time"),he(mo,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ia(t,e,n){let r=0,i=t.length-1,s,a,o,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=Mr(t,"pos",e)),{pos:s,time:o}=t[r],{pos:a,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=Mr(t,"time",e)),{time:s,pos:o}=t[r],{time:a,pos:l}=t[i]);const u=a-s;return u?o+(l-o)*(e-s)/u:o}class Dh extends mo{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Ia(n,this.min),this._tableRange=Ia(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let a,o,l,u,c;for(a=0,o=e.length;a<o;++a)u=e[a],u>=n&&u<=r&&i.push(u);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,o=i.length;a<o;++a)c=i[a+1],l=i[a-1],u=i[a],Math.round((c+l)/2)!==u&&s.push({time:u,pos:a/(o-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Ia(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Ia(this._table,r*this._tableRange+this._minPos,!0)}}he(Dh,"id","timeseries"),he(Dh,"defaults",mo.defaults);const W0="label";function Bh(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function Ik(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Q0(t,e){t.labels=e}function G0(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W0;const r=[];t.datasets=e.map(i=>{const s=t.datasets.find(a=>a[n]===i[n]);return!s||!i.data||r.includes(s)?{...i}:(r.push(s),Object.assign(s,i),s)})}function Mk(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W0;const n={labels:[],datasets:[]};return Q0(n,t.labels),G0(n,t.datasets,e),n}function Lk(t,e){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:a,data:o,options:l,plugins:u=[],fallbackContent:c,updateMode:f,...p}=t,h=F.useRef(null),y=F.useRef(null),m=()=>{h.current&&(y.current=new Uo(h.current,{type:a,data:Mk(o,s),options:l&&{...l},plugins:u}),Bh(e,y.current))},g=()=>{Bh(e,null),y.current&&(y.current.destroy(),y.current=null)};return F.useEffect(()=>{!i&&y.current&&l&&Ik(y.current,l)},[i,l]),F.useEffect(()=>{!i&&y.current&&Q0(y.current.config.data,o.labels)},[i,o.labels]),F.useEffect(()=>{!i&&y.current&&o.datasets&&G0(y.current.config.data,o.datasets,s)},[i,o.datasets]),F.useEffect(()=>{y.current&&(i?(g(),setTimeout(m)):y.current.update(f))},[i,l,o.labels,o.datasets,f]),F.useEffect(()=>{y.current&&(g(),setTimeout(m))},[a]),F.useEffect(()=>(m(),()=>g()),[]),F.createElement("canvas",{ref:h,role:"img",height:n,width:r,...p},c)}const Nk=F.forwardRef(Lk);function Y0(t,e){return Uo.register(e),F.forwardRef((n,r)=>F.createElement(Nk,{...n,ref:r,type:t}))}const Rk=Y0("line",Ga),_k=Y0("radar",Ya);Uo.register(Pu,Mu,ps,hr,Xa,V4,nk,ck,ek);var Nu={elements:{line:{backgroundColor:"rgba(166, 30, 105, 0.2)",borderColor:"rgba(166, 30, 105, 1)",borderWidth:4},point:{backgroundColor:"rgba(166, 30, 105, 1)",borderColor:"rgba(255,255,255, .9)",borderWidth:2,radius:5,hoverRadius:6,hoverBorderWidth:3}},responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1}},interaction:{mode:"nearest",axis:"x",intersect:!1}},Dk=function(e){var n=e.chart.ctx,r=e.chart.chartArea;if(!r)return"rgba(166, 30, 105, 0.1)";var i=(r.left+r.right)/2,s=(r.top+r.bottom)/2,a=Math.min((r.right-r.left)/2,(r.bottom-r.top)/2),o=n.createRadialGradient(i,s,0,i,s,a);return o.addColorStop(0,"rgba(255, 255, 255, 0.4)"),o.addColorStop(.3,"rgba(255, 255, 255, 0.4)"),o.addColorStop(1,"rgba(166, 30, 105, 0.2)"),o};function Fh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fh(Object(n),!0).forEach(function(r){Bk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bk(t,e,n){return(e=Fk(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fk(t){var e=zk(t,"string");return Ni(e)=="symbol"?e:e+""}function zk(t,e){if(Ni(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ni(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ni(t){"@babel/helpers - typeof";return Ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ni(t)}function Uk(t){var e=new Date(t);return isNaN(e.getTime())?String(t):e.toLocaleString("en-US",{month:"short",day:"numeric"})}var Hk=function(){var e,n,r,i,s=Xn(),a=s.data,o=s.isLoading,l=s.isRefetching,u=a==null?void 0:a.mentions,c=u==null||(e=u.mentionedInNumberOfQueries)===null||e===void 0||(e=e.previous)===null||e===void 0?void 0:e.difference,f=u==null?void 0:u.chart,p=Array.isArray(f==null?void 0:f.labels)?f.labels:f!=null&&f.labels&&Ni(f.labels)==="object"?Object.values(f.labels):[],h=p.map(function(v){return Uk(String(v))}),y=a==null?void 0:a.numberOfQueries;if(!y){var m=0;Array.isArray(f==null?void 0:f.datasets)&&f.datasets.forEach(function(v){Array.isArray(v==null?void 0:v.data)&&v.data.forEach(function(S){typeof S=="number"&&S>m&&(m=S)})}),y=m+2}var g=zh(zh({},Nu),{},{responsive:!0,maintainAspectRatio:!1,scales:{x:{display:!0,title:{display:!1,text:"Date"},grid:{display:!1}},y:{display:!0,title:{display:!1,text:"Number of Mentions"},beginAtZero:!0,max:y,ticks:{stepSize:1}}}});return d.jsx(k.Card,{className:"yst-overflow-visible",children:d.jsxs(k.Card.Content,{className:"yst-space-y-4",children:[d.jsxs("div",{className:"yst-space-y-2",children:[d.jsx(aa,{title:"Mentions progress",tooltip:"Tracks how your brand mentions have changed over time across the same query set."}),d.jsx(sa,{score:u==null||(n=u.mentionedInNumberOfQueries)===null||n===void 0?void 0:n.value,total:a==null?void 0:a.numberOfQueries,delta:c,deltaSuffix:"since last analysis",suffix:"queries",isLoading:o||l})]}),Array.isArray(f==null||(r=f.datasets)===null||r===void 0?void 0:r.data)&&(f==null||(i=f.datasets)===null||i===void 0?void 0:i.data.length)<2?d.jsx(k.Alert,{variant:"info",children:"One more analysis needed to show more insights."}):d.jsx("div",{className:"yst-h-72",children:d.jsx(Rk,{data:function(){var v={labels:h,datasets:[f==null?void 0:f.datasets]};return v}(),options:g})})]})})},qk=function(){var e,n=Xn(),r=n.data,i=n.isLoading,s=n.isRefetching;if(i&&!s||(r==null||(e=r.mentions)===null||e===void 0||(e=e.mentionedInNumberOfQueries)===null||e===void 0?void 0:e.value)!==0)return null;var a=[{title:"Activate llms.txt",description:"Make sure AI systems know where to look and which pages matter most.",link:{url:"https://yoast.com/help/enable-llmstxt/",text:"Set up llms.txt in Yoast SEO"}},{title:"Adopt an LLM-friendly content structure",description:"Start with clear definitions or TL;DRs, use subheadings, and format answers so LLMs can lift them directly.",link:{url:"https://yoast.com/yoast-seo-premium-september-9-2025/",text:"Learn how to generate AI summaries"}},{title:"Simplify writing and readability",description:"Use shorter sentences, plain language, and one idea per paragraph. This makes it easier for AI systems to recognize and quote your content."}];return d.jsx(k.Card,{className:"yst-overflow-visible yst-p-8 yst-text-slate-800 md:yst-col-span-2",children:d.jsxs(k.Card.Content,{className:"yst-max-w-2xl",children:[d.jsx(k.Title,{size:"2",className:"yst-mb-2 yst-text-slate-900",children:"We couldn't find your brand in this brand analysis..."}),d.jsx("p",{className:"yst-text-slate-600",children:"This means LLMs may not yet be surfacing your site in answers. Don't worry, here are some steps you can take today to boost your AI visibility:"}),d.jsx("ol",{className:"yst-my-0 yst-list-none yst-divide-y yst-divide-slate-200 [counter-reset:list-counter]",children:a.map(function(o,l){return d.jsx("li",{className:"yst-relative yst-py-4 [counter-increment:list-counter] before:yst-absolute before:yst-left-0 before:yst-font-semibold before:yst-text-slate-800 before:yst-content-[counter(list-counter)'.'] last:yst-pb-0",children:d.jsxs("div",{className:"yst-ml-4 yst-text-slate-600",children:[d.jsx("strong",{className:"yst-font-medium yst-text-slate-800",children:o.title}),d.jsx("br",{}),o.description,o.link&&d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"yst-mt-2 yst-block",children:d.jsxs("a",{href:o.link.url,target:"_blank",rel:"noopener noreferrer",className:"yst-font-medium",children:[o.link.text,d.jsx(Md,{className:"yst-ml-1 yst-inline yst-h-3 yst-w-3"})]})})]})]})},l)})}),d.jsx(zi,{size:4,className:"yst-pt-0"}),d.jsxs("p",{className:"yst-text-slate-600",children:["Want to go deeper? →"," ",d.jsxs("a",{href:"https://yoast.com/how-to-optimize-content-for-llms/",target:"_blank",rel:"noopener noreferrer",className:"yst-font-medium",children:["Read our full guide on optimizing content for LLMs",d.jsx(Md,{className:"yst-ml-1 yst-inline yst-h-3 yst-w-3"})]})]})]})})};function Ma(t){var e=t.value,n=e===void 0?"—":e,r=t.label,i=t.tooltip,s=t.className,a=t.borderBottom,o=a===void 0?!1:a,l=t.borderRight,u=l===void 0?!1:l,c=t.delta,f=t.tooltipPosition,p=f===void 0?"left":f;return d.jsxs("div",{className:oe("yst-relative yst-flex yst-flex-col yst-items-center yst-gap-1 yst-p-4 yst-text-center",o&&"yst-border-b yst-border-slate-200",u&&"yst-border-r yst-border-slate-200",s),children:[d.jsx("p",{className:"yst-text-2xl yst-font-bold yst-text-slate-900",children:n}),d.jsx("p",{className:"yst-text-tiny yst-text-slate-600",children:r}),typeof c=="number"&&d.jsxs("p",{className:oe("yst-flex yst-items-center yst-gap-1 yst-text-tiny yst-font-bold",Ms(c)),children:[c>0?d.jsx(Hm,{}):c<0?d.jsx(Um,{}):null,c>-1e-6&&"+",c]}),i&&d.jsx(vc,{id:"tooltip-".concat(r.replace(/\s+/g,"-").toLowerCase()),className:"yst-absolute yst-right-2 yst-top-2",position:p,children:i})]})}function Wk(t){var e=t.children,n=t.className;return d.jsx("div",{className:oe("yst-grid yst-w-full yst-grid-cols-2 yst-gap-0 yst-rounded-lg",n),children:e})}function Qk(t){return t>0?"yst-text-green-600":t<0?"yst-text-red-600":"yst-text-slate-500"}function Gk(t){var e=t.current,n=t.previous,r=t.className;if(typeof n!="number")return null;var i=e-n,s=i>0,a=i<0,o="".concat(i>0?"+":"").concat(i.toFixed(1),"%");return d.jsxs("div",{className:oe("yst-flex yst-items-center yst-gap-1 yst-text-tiny yst-font-bold",Qk(i),r),"aria-label":s?"Visibility increased by ".concat(o):a?"Visibility decreased by ".concat(o):"No change in visibility",children:[s&&d.jsx(Hm,{className:"yst-w-4 yst-h-4"}),a&&d.jsx(Um,{className:"yst-w-4 yst-h-4"}),o]})}function qs(t){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qs(t)}function Yk(t,e){return Jk(t)||Xk(t,e)||Kk(t,e)||Vk()}function Vk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
53
53
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kk(t,e){if(t){if(typeof t=="string")return Uh(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Uh(t,e):void 0}}function Uh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xk(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function Jk(t){if(Array.isArray(t))return t}function Hh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function La(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hh(Object(n),!0).forEach(function(r){Zk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zk(t,e,n){return(e=$k(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $k(t){var e=ej(t,"string");return qs(e)=="symbol"?e:e+""}function ej(t,e){if(qs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tj(){var t,e,n,r,i,s,a,o,l,u,c,f,p,h,y,m,g,v,S,j,E,A,w,x=Xn(),b=x.data,L=x.isLoading,R=b==null||(t=b.scores)===null||t===void 0?void 0:t.standardized,I=(e=b==null||(n=b.mentions)===null||n===void 0||(n=n.mentionedInNumberOfQueries)===null||n===void 0?void 0:n.value)!==null&&e!==void 0?e:0,P=b==null||(r=b.mentions)===null||r===void 0||(r=r.mentionedInNumberOfQueries)===null||r===void 0||(r=r.previous)===null||r===void 0?void 0:r.difference,z=(i=b==null||(s=b.scores)===null||s===void 0||(s=s.standardized)===null||s===void 0||(s=s.citations)===null||s===void 0?void 0:s.value)!==null&&i!==void 0?i:0,N=(a=b==null||(o=b.citations)===null||o===void 0||(o=o.total)===null||o===void 0?void 0:o.value)!==null&&a!==void 0?a:0,O=b==null||(l=b.citations)===null||l===void 0||(l=l.total)===null||l===void 0||(l=l.previous)===null||l===void 0?void 0:l.difference,B=b==null||(u=b.rankings)===null||u===void 0||(u=u.list)===null||u===void 0?void 0:u.find(function(ce){var ke;return((ke=ce.brand)===null||ke===void 0?void 0:ke.isSelf)===!0}),_=(c=B==null||(f=B.rank)===null||f===void 0?void 0:f.value)!==null&&c!==void 0?c:"—",Y=B==null||(p=B.rank)===null||p===void 0||(p=p.previous)===null||p===void 0?void 0:p.difference;Y&&(Y=Y*-1);var G=(h=R==null||(y=R.visibility)===null||y===void 0?void 0:y.value)!==null&&h!==void 0?h:0,C=R==null||(m=R.visibility)===null||m===void 0||(m=m.previous)===null||m===void 0?void 0:m.value,W=(g=R==null||(v=R.ranking)===null||v===void 0?void 0:v.value)!==null&&g!==void 0?g:0,q=(S=R==null||(j=R.sentiment)===null||j===void 0?void 0:j.value)!==null&&S!==void 0?S:0,T=(E=R==null||(A=R.mentions)===null||A===void 0?void 0:A.value)!==null&&E!==void 0?E:0,Q={labels:["Mentions","Ranking","Citations","Sentiment"],datasets:[{data:[T,W,z,q],backgroundColor:Dk,pointBackgroundColor:"rgba(166, 30, 105, 1)"}]},J=La(La({},Nu),{},{plugins:La(La({},Nu.plugins),{},{tooltip:{mode:"point",intersect:!0,callbacks:{label:function(ke){var $=ke.label||"",We=ke.parsed.r||0;return"".concat($,": ").concat(We,"%")}}}}),interaction:{mode:"point",intersect:!0},scales:{r:{beginAtZero:!0,min:0,max:100,ticks:{stepSize:20}}}}),Z=F.useState(typeof window!="undefined"&&window.innerWidth<800?"top":"left"),ie=Yk(Z,2),ue=ie[0],ye=ie[1];return F.useEffect(function(){function ce(){ye(window.innerWidth<800?"top":"left")}return window.addEventListener("resize",ce),function(){return window.removeEventListener("resize",ce)}},[]),d.jsx(k.Card,{className:"yst-overflow-visible md:yst-col-span-2",children:d.jsxs(k.Card.Content,{children:[d.jsx(k.Title,{size:"3",className:"yst-mb-2",children:"AI Visibility Index (AIVI)"}),d.jsx(sa,{score:G,total:100,isLoading:L}),d.jsx(Gk,{current:G,previous:C,className:"yst-mb-4"}),d.jsxs("div",{className:"yst-flex yst-flex-col yst-items-center yst-justify-around yst-justify-items-center yst-gap-8 md:yst-flex-row",children:[d.jsxs("div",{className:"yst-radar-chart-container yst-relative yst-aspect-square yst-h-full yst-w-full md:yst-flex md:yst-w-1/2 md:yst-items-center md:yst-justify-center",children:[d.jsx(_k,{data:Q,options:J}),d.jsx(vc,{id:"tooltip-radar-chart",className:"yst-absolute yst-right-2 yst-top-2",position:"left",children:"The AI Visibility Index (AIVI) shows how visible your brand is across major AI platforms like ChatGPT and Perplexity, based on mentions, citations, sentiment, and rankings."})]}),d.jsx("div",{className:"yst-mt-6 yst-w-full md:yst-mt-0 md:yst-flex md:yst-w-1/2 md:yst-items-center",children:d.jsxs(Wk,{children:[d.jsx(Ma,{value:I,label:"Mentions",tooltip:"Mentions show how often your brand appears in AI-generated answers to the questions we send to LLMs.",borderBottom:!0,borderRight:!0,delta:P,tooltipPosition:ue}),d.jsx(Ma,{value:typeof _=="number"&&Number.isFinite(_)&&_>0?d.jsxs(d.Fragment,{children:["#",_,_===1&&" 🏆"]}):"—",label:"Competitor ranking",tooltip:"Ranking shows the position your brand is mentioned in AI-generated answers—whether in a numbered list or the order of appearance in full-text responses.",borderBottom:!0,delta:Y}),d.jsx(Ma,{value:N,label:"Citations",tooltip:"Citations are the source links found in AI-generated answers. They form the basis for mentions, sentiment, and ranking insights.",borderRight:!0,delta:O,tooltipPosition:ue}),d.jsx(Ma,{value:q?"".concat(q,"%"):"—",label:"Positive sentiment",tooltip:"Sentiment reflects how positively, neutrally, or negatively your brand is mentioned in AI-generated answers, based on the cited sources.",delta:b==null||(w=b.scores)===null||w===void 0||(w=w.standardized)===null||w===void 0||(w=w.sentiment)===null||w===void 0||(w=w.previous)===null||w===void 0?void 0:w.difference})]})})]})]})})}function nj(t,e){return aj(t)||sj(t,e)||ij(t,e)||rj()}function rj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
54
54
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ij(t,e){if(t){if(typeof t=="string")return qh(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qh(t,e):void 0}}function qh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function sj(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function aj(t){if(Array.isArray(t))return t}var Al=function(){var e=Et(),n=e.brandId,r=e.analysisId,i=vA(),s=i.isProduction,a=ut(),o=ei({query:{select:function(I){var P=I.data;return P==null?void 0:P.brands}}}),l=o.data,u=o.isLoading,c=Io(n,r,{query:{enabled:!!n&&bA(r),select:function(I){var P=I.data;return P==null?void 0:P.analysis}}}),f=c.data,p=c.isLoading,h=f==null?void 0:f.status,y=u||p,m=l&&(l==null?void 0:l.length)>0,g=!y&&f&&h===_n.completed,v=F.useState(!1),S=nj(v,2),j=S[0],E=S[1],A=F.useRef(null),w=F.useRef(void 0),x=localStorage.getItem("yst_congratulations_toast_seen")==="true";F.useEffect(function(){return g&&!w.current&&!x&&(A.current=setTimeout(function(){E(!0),localStorage.setItem("yst_congratulations_toast_seen","true")},1e4)),!g&&w.current&&(E(!1),A.current&&(clearTimeout(A.current),A.current=null)),w.current=g,function(){A.current&&(clearTimeout(A.current),A.current=null)}},[g,x]);function b(R){var I=R.children;if(typeof window=="undefined")return null;var P=document.getElementById("tsx-toasts");return P?Py.createPortal(I,P):null}var L=function(I){var P=I.isVisible,z=I.setIsVisible,N=function(){z(!1)};return d.jsxs(k.Toast,{id:"toast",isVisible:P,setIsVisible:function(O){O||z(!1)},children:[d.jsxs("div",{className:"yst-mb-3 yst-flex yst-items-start yst-gap-3",children:[d.jsx(Gm,{}),d.jsxs("div",{className:"yst-grow",children:[d.jsx(k.Title,{size:"3",className:"yst-mb-1",children:"Congratulations on your first analysis!"}),"You’ve completed your brand analysis. We’d love to hear what you think."]}),d.jsx(k.Button,{variant:"tertiary",onClick:N,children:d.jsx(Qm,{})})]}),d.jsxs("div",{className:"yst-flex yst-justify-end yst-gap-4",children:[d.jsx(k.Button,{variant:"tertiary",onClick:N,children:"Dismiss"}),d.jsxs(k.Button,{as:"a",href:"https://www.surveymonkey.com/r/HGSB8DL",target:"_blank",children:["Give feedback",d.jsx(Wm,{className:"yst-ml-2"})]})]})]})};return u?d.jsx(Ui,{}):m?d.jsxs("div",{className:"yst-space-y-4",children:[d.jsx(eC,{}),g&&d.jsxs("div",{className:"yst-space-y-4",children:[d.jsxs("div",{className:"yst-flex yst-items-center yst-justify-between",children:[d.jsx(k.Title,{size:"2",children:"Your brand analysis"}),d.jsxs("div",{className:"yst-flex yst-gap-2",children:[!s&&d.jsx(k.Button,{variant:"secondary",onClick:function(){return a("/brands/".concat(n,"/analysis/").concat(r,"/scan-details"))},children:"Scan details"}),d.jsxs(k.Button,{as:vr,variant:"secondary",to:"/brands/".concat(n,"/brand-list"),className:oe("yst-gap-1.5"),disabled:!n,children:[d.jsx(_m,{})," Edit brand list"]})]})]}),d.jsxs("div",{className:"yst-grid yst-grid-cols-1 yst-gap-4 md:yst-grid-cols-2",children:[d.jsx(qk,{}),d.jsx(tj,{}),d.jsx(tC,{}),d.jsx(Hk,{}),d.jsx(u3,{}),d.jsx(r3,{}),d.jsx(HA,{}),d.jsx(c3,{})]}),d.jsx(b,{children:d.jsx(L,{isVisible:j,setIsVisible:E})})]})]}):d.jsx(jA,{})},oj=F.lazy(function(){return Promise.resolve().then(()=>Gj)}),lj=F.lazy(function(){return Promise.resolve().then(()=>x9)}),uj=F.lazy(function(){return Promise.resolve().then(()=>eT)}),cj=F.lazy(function(){return Promise.resolve().then(()=>rT)}),dj=F.lazy(function(){return Promise.resolve().then(()=>gT)}),fj=F.lazy(function(){return Promise.resolve().then(()=>_T)}),hj=F.lazy(function(){return Promise.resolve().then(()=>tP)}),pj=new Rb({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:!1,staleTime:1e3*60*5},mutations:{retry:!1}}}),yj=F.lazy(function(){return Promise.resolve({default:function(){return null}})}),In=function(){return d.jsx("div",{className:"yst-flex yst-min-h-[200px] yst-items-center yst-justify-center",children:d.jsxs("div",{className:"yst-w-full yst-max-w-md yst-space-y-3",children:[d.jsx(k.SkeletonLoader,{className:"yst-h-8 yst-w-3/4"}),d.jsx(k.SkeletonLoader,{className:"yst-h-6 yst-w-full"}),d.jsx(k.SkeletonLoader,{className:"yst-h-6 yst-w-2/3"})]})})},mj=function(e){var n=e.hideNav,r=n===void 0?!1:n,i=e.disableLayout,s=i===void 0?!1:i,a=e.DebugInfo;return d.jsx(Nv,{children:d.jsxs(st,{element:d.jsx(Qw,{hideNav:r,disableLayout:s,DebugInfo:a}),children:[d.jsxs(st,{path:"/",element:d.jsx(Pi,{}),children:[d.jsx(st,{index:!0,element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"AI Brand Insights"}),d.jsx(Al,{})]})}),d.jsxs(st,{path:"brands/:brandId",element:d.jsx(zd,{}),children:[d.jsx(st,{index:!0,element:d.jsx(Al,{})}),d.jsx(st,{path:"brand-list",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Brands - AI Brand Insights"}),d.jsx(oj,{})]})}),d.jsxs(st,{path:"analysis/:analysisId",element:d.jsx(Gw,{}),children:[d.jsx(st,{index:!0,element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Analysis - AI Brand Insights"}),d.jsx(Al,{})]})}),d.jsx(st,{path:"scan-details",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Scan details - AI Brand Insights"}),d.jsx(lj,{})]})})]})]}),d.jsxs(st,{path:"/setup",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Setup brand - AI Brand Insights"}),d.jsx(cj,{})]}),children:[d.jsx(st,{index:!0,element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"AI Brand Insights"}),d.jsx(dj,{})]})}),d.jsxs(st,{path:":brandId",element:d.jsx(zd,{}),children:[d.jsx(st,{path:"queries",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Setup queries - AI Brand Insights"}),d.jsx(fj,{})]})}),d.jsx(st,{path:"analysis",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Analysis - AI Brand Insights"}),d.jsx(hj,{})]})})]})]})]}),d.jsx(st,{path:"/settings",element:d.jsxs(F.Suspense,{fallback:d.jsx(In,{}),children:[d.jsx(Tn,{title:"Settings - AI Brand Insights"}),d.jsx(uj,{})]})}),!1]})})},gj=function(e){var n=e.DebugInfo,r=e.hostAppProps;return d.jsxs(_b,{client:pj,children:[d.jsx(tA,{children:d.jsxs(Dx,{hostAppProps:r,children:[d.jsx(mj,{DebugInfo:n}),d.jsx(nA,{})]})}),d.jsx(F.Suspense,{fallback:null,children:d.jsx(yj,{initialIsOpen:!1})})]})};function vj(t){var e=t.subpath,n=e===void 0?"/":e,r=t.onNavigate,i=ut(),s=gt(),a=F.useRef(n),o=F.useRef(null),l=F.useRef(!1),u="".concat(s.pathname).concat(s.search).concat(s.hash),c=F.useCallback(r,[r]);return F.useEffect(function(){if(n===u){a.current=n;return}l.current||n!==a.current&&(a.current=n,o.current=n,l.current=!0,i(n,{replace:!0}),setTimeout(function(){l.current=!1},10))},[n,u,i]),F.useEffect(function(){l.current||u!==n&&u!==o.current&&(o.current=u,c(u))},[u,n,c]),null}function bj(t,e){return Sj(t)||Aj(t,e)||wj(t,e)||xj()}function xj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
55
55
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wj(t,e){if(t){if(typeof t=="string")return Wh(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wh(t,e):void 0}}function Wh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Aj(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}function Sj(t){if(Array.isArray(t))return t}var Cj=function(e){var n=e.isRtl,r=n===void 0?!1:n,i=e.className,s=e.style,a=e.token,o=a===void 0?"":a,l=e.apiUrl,u=e.env,c=e.DebugInfo,f=e.basename,p=f===void 0?"/":f,h=e.subpath,y=h===void 0?"/":h,m=e.onNavigate,g=m===void 0?function(){}:m,v=e.onLogout,S=v===void 0?function(){}:v,j=e.onAddSubscription,E=j===void 0?function(){}:j,A=function(P,z){var N=P.endsWith("/")?P.slice(0,-1):P,O=z.startsWith("/")?z:"/".concat(z);return N+O||"/"},w=F.useState(!!(o||l)),x=bj(w,2),b=x[0],L=x[1],R={onAddSubscription:E,onLogout:S,onNavigate:g,env:u,DebugInfo:c,basename:p,subpath:y};return F.useEffect(function(){l&&Tm(l),P1(typeof o!="function"?function(){return o}:o),L(!1)},[l,o]),b?d.jsx("div",{className:i,style:s,children:d.jsx(k.Spinner,{})}):d.jsx("div",{className:i,style:s,children:d.jsxs(Mv,{initialEntries:[A(p,y)],basename:p||"/",children:[d.jsx(vj,{subpath:y,onNavigate:g}),d.jsx(k.Root,{context:{isRtl:r},children:d.jsx(gj,{DebugInfo:c,hostAppProps:R})})]})})};function V0(t){var e=t.children,n=t.description,r=t.title;return d.jsxs(k.Paper.Header,{children:[r&&d.jsx(k.Title,{className:oe({"yst-mb-3":n||e}),children:r}),n&&(typeof n=="string"?d.jsx("p",{children:n}):n),e]})}function Ru(t){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ru(t)}function ys(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function s(h,y,m,g){var v=y&&y.prototype instanceof o?y:o,S=Object.create(v.prototype);return Rt(S,"_invoke",function(j,E,A){var w,x,b,L=0,R=A||[],I=!1,P={p:0,n:0,v:t,a:z,f:z.bind(t,4),d:function(O,B){return w=O,x=0,b=t,P.n=B,a}};function z(N,O){for(x=N,b=O,e=0;!I&&L&&!B&&e<R.length;e++){var B,_=R[e],Y=P.p,G=_[2];N>3?(B=G===O)&&(b=_[(x=_[4])?5:(x=3,3)],_[4]=_[5]=t):_[0]<=Y&&((B=N<2&&Y<_[1])?(x=0,P.v=O,P.n=_[1]):Y<G&&(B=N<3||_[0]>O||O>G)&&(_[4]=N,_[5]=O,P.n=G,x=0))}if(B||N>1)return a;throw I=!0,O}return function(N,O,B){if(L>1)throw TypeError("Generator is already running");for(I&&O===1&&z(O,B),x=O,b=B;(e=x<2?t:b)||!I;){w||(x?x<3?(x>1&&(P.n=-1),z(x,b)):P.n=b:P.v=b);try{if(L=2,w){if(x||(N="next"),e=w[N]){if(!(e=e.call(w,b)))throw TypeError("iterator result is not an object");if(!e.done)return e;b=e.value,x<2&&(x=0)}else x===1&&(e=w.return)&&e.call(w),x<2&&(b=TypeError("The iterator does not provide a '"+N+"' method"),x=1);w=t}else if((e=(I=P.n<0)?b:j.call(E,P))!==a)break}catch(_){w=t,x=1,b=_}finally{L=1}}return{value:e,done:I}}}(h,m,g),!0),S}var a={};function o(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Rt(e={},r,function(){return this}),e),f=u.prototype=o.prototype=Object.create(c);function p(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,u):(h.__proto__=u,Rt(h,i,"GeneratorFunction")),h.prototype=Object.create(f),h}return l.prototype=u,Rt(f,"constructor",u),Rt(u,"constructor",l),l.displayName="GeneratorFunction",Rt(u,i,"GeneratorFunction"),Rt(f),Rt(f,i,"Generator"),Rt(f,r,function(){return this}),Rt(f,"toString",function(){return"[object Generator]"}),(ys=function(){return{w:s,m:p}})()}function Rt(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(s){i=0}Rt=function(a,o,l,u){function c(f,p){Rt(a,f,function(h){return this._invoke(f,p,h)})}o?i?i(a,o,{value:l,enumerable:!u,configurable:!u,writable:!u}):a[o]=l:(c("next",0),c("throw",1),c("return",2))},Rt(t,e,n,r)}function Qh(t,e,n,r,i,s,a){try{var o=t[s](a),l=o.value}catch(u){return void n(u)}o.done?e(l):Promise.resolve(l).then(r,i)}function Gh(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function a(l){Qh(s,r,i,a,o,"next",l)}function o(l){Qh(s,r,i,a,o,"throw",l)}a(void 0)})}}function Sl(t,e){return Oj(t)||Ej(t,e)||jj(t,e)||kj()}function kj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.