@kong-ui-public/analytics-chart 5.0.2 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12840,8 +12840,9 @@ const Jw = [
12840
12840
  "latencies_response_ms",
12841
12841
  "latencies_upstream_ms",
12842
12842
  "latencies_kong_gateway_ms",
12843
- "response_body_size",
12844
12843
  "request_body_size",
12844
+ "response_body_size",
12845
+ "response_header_content_length",
12845
12846
  "status_code",
12846
12847
  "upstream_status_code"
12847
12848
  ];
@@ -15,7 +15,7 @@
15
15
  * Released under the MIT License
16
16
  */class _g{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const r=e.listeners[s],o=e.duration;r.forEach(a=>a({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=ja.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const r=i.items;let o=r.length-1,a=!1,l;for(;o>=0;--o)l=r[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(r[o]=r[r.length-1],r.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Fe=new _g;const _l="transparent",wg={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Ka(n||_l),s=i.valid&&Ka(t||_l);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class vg{constructor(t,e,i,s){const r=e[i];s=xi([t.to,s,r,t.from]);const o=xi([t.from,r,s]);this._active=!0,this._fn=t.fn||wg[t.type||typeof o],this._easing=gi[t.easing]||gi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],r=i-this._start,o=this._duration-r;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=xi([t.to,e,s,t.from]),this._from=xi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,r=this._from,o=this._loop,a=this._to;let l;if(this._active=r!==a&&(o||e<i),!this._active){this._target[s]=a,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/i%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}}class zr{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!it(t))return;const e=Object.keys(Tt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const r=t[s];if(!it(r))return;const o={};for(const a of e)o[a]=r[a];(at(r.properties)&&r.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,e){const i=e.options,s=Mg(t,i);if(!s)return[];const r=this._createAnimations(s,i);return i.$shared&&kg(t.options.$animations,i).then(()=>{t.options=i},()=>{}),r}_createAnimations(t,e){const i=this._properties,s=[],r=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[c];let d=r[c];const h=i.get(c);if(d)if(h&&d.active()){d.update(h,u,a);continue}else d.cancel();if(!h||!h.duration){t[c]=u;continue}r[c]=d=new vg(h,t,c,u),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Fe.add(this._chart,i),!0}}function kg(n,t){const e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const r=n[i[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function Mg(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function wl(n,t){const e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:s,end:i?s:r}}function Sg(n,t,e){if(e===!1)return!1;const i=wl(n,e),s=wl(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Dg(n){let t,e,i,s;return it(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function vl(n,t){const e=[],i=n._getSortedDatasetMetas(t);let s,r;for(s=0,r=i.length;s<r;++s)e.push(i[s].index);return e}function kl(n,t,e,i={}){const s=n.keys,r=i.mode==="single";let o,a,l,c;if(t!==null){for(o=0,a=s.length;o<a;++o){if(l=+s[o],l===e){if(i.all)continue;break}c=n.values[l],Mt(c)&&(r||t===0||Se(t)===Se(c))&&(t+=c)}return t}}function Tg(n,t){const{iScale:e,vScale:i}=t,s=e.axis==="x"?"x":"y",r=i.axis==="x"?"x":"y",o=Object.keys(n),a=new Array(o.length);let l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[s]:u,[r]:n[u]};return a}function Ml(n,t){const e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function Cg(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Pg(n){const{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Og(n,t,e){const i=n[t]||(n[t]={});return i[e]||(i[e]={})}function Sl(n,t,e,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const r=n[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function Dl(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:a}=i,l=r.axis,c=o.axis,u=Cg(r,o,i),d=t.length;let h;for(let g=0;g<d;++g){const p=t[g],{[l]:y,[c]:x}=p,w=p._stacks||(p._stacks={});h=w[c]=Og(s,u,y),h[a]=x,h._top=Sl(h,o,!0,i.type),h._bottom=Sl(h,o,!1,i.type);const v=h._visualValues||(h._visualValues={});v[a]=x}}function Hr(n,t){const e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Eg(n,t){return tn(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ag(n,t,e){return tn(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function _i(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const r=s._stacks;if(!r||r[i]===void 0||r[i][e]===void 0)return;delete r[i][e],r[i]._visualValues!==void 0&&r[i]._visualValues[e]!==void 0&&delete r[i]._visualValues[e]}}}const Wr=n=>n==="reset"||n==="none",Tl=(n,t)=>t?n:Object.assign({},n),Rg=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:vl(e,!0),values:null};class xe{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ml(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&_i(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,h,g,p)=>d==="x"?h:d==="r"?p:g,r=e.xAxisID=Z(i.xAxisID,Hr(t,"x")),o=e.yAxisID=Z(i.yAxisID,Hr(t,"y")),a=e.rAxisID=Z(i.rAxisID,Hr(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,r,o,a),u=e.vAxisID=s(l,o,r,a);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ya(this._data,this),t._stacked&&_i(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(it(e)){const s=this._cachedMeta;this._data=Tg(e,s)}else if(i!==e){if(i){Ya(i,this);const s=this._cachedMeta;_i(s),s._parsed=[]}e&&Object.isExtensible(e)&&bf(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const r=e._stacked;e._stacked=Ml(e.vScale,e),e.stack!==i.stack&&(s=!0,_i(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&Dl(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:r,_stacked:o}=i,a=r.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,d,h;if(this._parsing===!1)i._parsed=s,i._sorted=!0,h=s;else{at(s[t])?h=this.parseArrayData(i,s,t,e):it(s[t])?h=this.parseObjectData(i,s,t,e):h=this.parsePrimitiveData(i,s,t,e);const g=()=>d[a]===null||c&&d[a]<c[a];for(u=0;u<e;++u)i._parsed[u+t]=d=h[u],l&&(g()&&(l=!1),c=d);i._sorted=l}o&&Dl(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:r,vScale:o}=t,a=r.axis,l=o.axis,c=r.getLabels(),u=r===o,d=new Array(s);let h,g,p;for(h=0,g=s;h<g;++h)p=h+i,d[h]={[a]:u||r.parse(c[p],p),[l]:o.parse(e[p],p)};return d}parseArrayData(t,e,i,s){const{xScale:r,yScale:o}=t,a=new Array(s);let l,c,u,d;for(l=0,c=s;l<c;++l)u=l+i,d=e[u],a[l]={x:r.parse(d[0],u),y:o.parse(d[1],u)};return a}parseObjectData(t,e,i,s){const{xScale:r,yScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,d,h,g;for(u=0,d=s;u<d;++u)h=u+i,g=e[h],c[u]={x:r.parse(Ke(g,a),h),y:o.parse(Ke(g,l),h)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,r=this._cachedMeta,o=e[t.axis],a={keys:vl(s,!0),values:e._stacks[t.axis]._visualValues};return kl(a,o,r.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const r=i[e.axis];let o=r===null?NaN:r;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=kl(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,r=i._sorted&&t===i.iScale,o=s.length,a=this._getOtherScale(t),l=Rg(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Pg(a);let h,g;function p(){g=s[h];const y=g[a.axis];return!Mt(g[t.axis])||u>y||d<y}for(h=0;h<o&&!(!p()&&(this.updateRangeFromParsed(c,t,g,l),r));++h);if(r){for(h=o-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,r,o;for(s=0,r=e.length;s<r;++s)o=e[s][t.axis],Mt(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=Dg(Z(this.options.clip,Sg(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],r=e.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,r,a,l),u=a;u<a+l;++u){const d=s[u];d.hidden||(d.active&&c?o.push(d):d.draw(t,r))}for(u=0;u<o.length;++u)o[u].draw(t,r)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const o=this._cachedMeta.data[t];r=o.$context||(o.$context=Ag(this.getContext(),t,o)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Eg(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s=e==="active",r=this._cachedDataOpts,o=t+"-"+e,a=r[o],l=this.enableOptionSharing&&Qt(i);if(a)return Tl(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),u),g=Object.keys(Tt.elements[t]),p=()=>this.getContext(i,s,e),y=c.resolveNamedOptions(h,g,p,d);return y.$shared&&(y.$shared=l,r[o]=Object.freeze(Tl(y,l))),y}_resolveAnimations(t,e,i){const s=this.chart,r=this._cachedDataOpts,o=`animation-${e}`,a=r[o];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,e),h=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(h,this.getContext(t,i,e))}const c=new zr(s,l&&l.animations);return l&&l._cacheable&&(r[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Wr(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,r=this.getSharedOptions(i),o=this.includeOptions(e,r)||r!==s;return this.updateSharedOptions(r,e,i),{sharedOptions:r,includeOptions:o}}updateElement(t,e,i,s){Wr(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Wr(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,r=e.length,o=Math.min(r,s);o&&this.parse(0,o),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,i=!0){const s=this._cachedMeta,r=s.data,o=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=o;a--)c[a]=c[a-e]};for(l(r),a=t;a<o;++a)r[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&_i(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}O(xe,"defaults",{}),O(xe,"datasetElementType",null),O(xe,"dataElementType",null);function Lg(n,t){if(!n._cache.$bar){const e=n.getMatchingVisibleMetas(t);let i=[];for(let s=0,r=e.length;s<r;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Va(i.sort((s,r)=>s-r))}return n._cache.$bar}function Ig(n){const t=n.iScale,e=Lg(t,n.type);let i=t._length,s,r,o,a;const l=()=>{o===32767||o===-32768||(Qt(a)&&(i=Math.min(i,Math.abs(o-a)||i)),a=o)};for(s=0,r=e.length;s<r;++s)o=t.getPixelForValue(e[s]),l();for(a=void 0,s=0,r=t.ticks.length;s<r;++s)o=t.getPixelForTick(s),l();return i}function Ng(n,t,e,i){const s=e.barThickness;let r,o;return tt(s)?(r=t.min*e.categoryPercentage,o=e.barPercentage):(r=s*i,o=1),{chunk:r/i,ratio:o,start:t.pixels[n]-r/2}}function Fg(n,t,e,i){const s=t.pixels,r=s[n];let o=n>0?s[n-1]:null,a=n<s.length-1?s[n+1]:null;const l=e.categoryPercentage;o===null&&(o=r-(a===null?t.end-t.start:a-r)),a===null&&(a=r+r-o);const c=r-(r-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/i,ratio:e.barPercentage,start:c}}function Bg(n,t,e,i){const s=e.parse(n[0],i),r=e.parse(n[1],i),o=Math.min(s,r),a=Math.max(s,r);let l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:o,max:a}}function Cl(n,t,e,i){return at(n)?Bg(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Pl(n,t,e,i){const s=n.iScale,r=n.vScale,o=s.getLabels(),a=s===r,l=[];let c,u,d,h;for(c=e,u=e+i;c<u;++c)h=t[c],d={},d[s.axis]=a||s.parse(o[c],c),l.push(Cl(h,d,r,c));return l}function Yr(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function zg(n,t,e){return n!==0?Se(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Hg(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:i,reverse:t,top:s,bottom:r}}function Wg(n,t,e,i){let s=t.borderSkipped;const r={};if(!s){n.borderSkipped=r;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:o,end:a,reverse:l,top:c,bottom:u}=Hg(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=u:(r[Ol(u,o,a,l)]=!0,s=c)),r[Ol(s,o,a,l)]=!0,n.borderSkipped=r}function Ol(n,t,e,i){return i?(n=Yg(n,t,e),n=El(n,e,t)):n=El(n,t,e),n}function Yg(n,t,e){return n===t?e:n===e?t:n}function El(n,t,e){return n==="start"?t:n==="end"?e:n}function Vg(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}class wi extends xe{parsePrimitiveData(t,e,i,s){return Pl(t,e,i,s)}parseArrayData(t,e,i,s){return Pl(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:r,vScale:o}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?a:l,u=o.axis==="x"?a:l,d=[];let h,g,p,y;for(h=i,g=i+s;h<g;++h)y=e[h],p={},p[r.axis]=r.parse(Ke(y,c),h),d.push(Cl(Ke(y,u),p,o,h));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,r=this.getParsed(t),o=r._custom,a=Yr(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const r=s==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,s);for(let g=e;g<e+i;g++){const p=this.getParsed(g),y=r||tt(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),x=this._calculateBarIndexPixels(g,u),w=(p._stacks||{})[a.axis],v={horizontal:c,base:y.base,enableBorderRadius:!w||Yr(p._custom)||o===w._top||o===w._bottom,x:c?y.head:x.center,y:c?x.center:y.head,height:c?x.size:Math.abs(y.size),width:c?Math.abs(y.size):x.size};h&&(v.options=d||this.resolveDataElementOptions(g,t[g].active?"active":s));const M=v.options||t[g].options;Wg(v,M,w,o),Vg(v,M,u.ratio),this.updateElement(t[g],g,v,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),r=i.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[i.axis],c=u=>{const d=u._parsed.find(g=>g[i.axis]===l),h=d&&d[u.vScale.axis];if(tt(h)||isNaN(h))return!0};for(const u of s)if(!(e!==void 0&&c(u))&&((r===!1||o.indexOf(u.stack)===-1||r===void 0&&u.stack===void 0)&&o.push(u.stack),u.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let r,o;for(r=0,o=e.data.length;r<o;++r)s.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));const a=t.barThickness;return{min:a||Ig(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:r,minBarLength:o}}=this,a=r||0,l=this.getParsed(t),c=l._custom,u=Yr(c);let d=l[e.axis],h=0,g=i?this.applyStack(e,l,i):d,p,y;g!==d&&(h=g-d,g=d),u&&(d=c.barStart,g=c.barEnd-c.barStart,d!==0&&Se(d)!==Se(c.barEnd)&&(h=0),h+=d);const x=!tt(r)&&!u?r:h;let w=e.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(h+g):p=w,y=p-w,Math.abs(y)<o){y=zg(y,e,a)*o,d===a&&(w-=y/2);const v=e.getPixelForDecimal(0),M=e.getPixelForDecimal(1),P=Math.min(v,M),D=Math.max(v,M);w=Math.max(Math.min(w,D),P),p=w+y,i&&!u&&(l._stacks[e.axis]._visualValues[s]=e.getValueForPixel(p)-e.getValueForPixel(w))}if(w===e.getPixelForValue(a)){const v=Se(y)*e.getLineWidthForValue(a)/2;w+=v,y-=v}return{size:y,base:w,head:p,center:p+y/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,r=s.skipNull,o=Z(s.maxBarThickness,1/0);let a,l;if(e.grouped){const c=r?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?Fg(t,e,s,c):Ng(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);a=u.start+u.chunk*d+u.chunk/2,l=Math.min(o,u.chunk*u.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(o,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&!i[r].hidden&&i[r].draw(this._ctx)}}O(wi,"id","bar"),O(wi,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),O(wi,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class ms extends xe{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const r=super.parsePrimitiveData(t,e,i,s);for(let o=0;o<r.length;o++)r[o]._custom=this.resolveDataElementOptions(o+i).radius;return r}parseArrayData(t,e,i,s){const r=super.parseArrayData(t,e,i,s);for(let o=0;o<r.length;o++){const a=e[i+o];r[o]._custom=Z(a[2],this.resolveDataElementOptions(o+i).radius)}return r}parseObjectData(t,e,i,s){const r=super.parseObjectData(t,e,i,s);for(let o=0;o<r.length;o++){const a=e[i+o];r[o]._custom=Z(a&&a.r&&+a.r,this.resolveDataElementOptions(o+i).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y),c=o._custom;return{label:i[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=o.axis,d=a.axis;for(let h=e;h<e+i;h++){const g=t[h],p=!r&&this.getParsed(h),y={},x=y[u]=r?o.getPixelForDecimal(.5):o.getPixelForValue(p[u]),w=y[d]=r?a.getBasePixel():a.getPixelForValue(p[d]);y.skip=isNaN(x)||isNaN(w),c&&(y.options=l||this.resolveDataElementOptions(h,g.active?"active":s),r&&(y.options.radius=0)),this.updateElement(g,h,y,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=Z(i&&i._custom,r),s}}O(ms,"id","bubble"),O(ms,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),O(ms,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function jg(n,t,e){let i=1,s=1,r=0,o=0;if(t<yt){const a=n,l=a+t,c=Math.cos(a),u=Math.sin(a),d=Math.cos(l),h=Math.sin(l),g=(M,P,D)=>fi(M,a,l,!0)?1:Math.max(P,P*e,D,D*e),p=(M,P,D)=>fi(M,a,l,!0)?-1:Math.min(P,P*e,D,D*e),y=g(0,c,d),x=g(bt,u,h),w=p(rt,c,d),v=p(rt+bt,u,h);i=(y-w)/2,s=(x-v)/2,r=-(y+w)/2,o=-(x+v)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:o}}class nn extends xe{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let r=l=>+i[l];if(it(i[t])){const{key:l="value"}=this._parsing;r=c=>+Ke(i[c],l)}let o,a;for(o=t,a=t+e;o<a;++o)s._parsed[o]=r(o)}}_getRotation(){return Nt(this.options.rotation-90)}_getCircumference(){return Nt(this.options.circumference)}_getRotationExtents(){let t=yt,e=-yt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,r=s._getRotation(),o=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,r=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),l=Math.min(rf(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:h,ratioY:g,offsetX:p,offsetY:y}=jg(d,u,l),x=(i.width-o)/h,w=(i.height-o)/g,v=Math.max(Math.min(x,w)/2,0),M=Ra(this.options.radius,v),P=Math.max(M*l,0),D=(M-P)/this._getVisibleDatasetWeightTotal();this.offsetX=p*M,this.offsetY=y*M,s.total=this.calculateTotal(),this.outerRadius=M-D*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-D*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/yt)}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,u=(a.left+a.right)/2,d=(a.top+a.bottom)/2,h=r&&c.animateScale,g=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:y,includeOptions:x}=this._getSharedOptions(e,s);let w=this._getRotation(),v;for(v=0;v<e;++v)w+=this._circumference(v,r);for(v=e;v<e+i;++v){const M=this._circumference(v,r),P=t[v],D={x:u+this.offsetX,y:d+this.offsetY,startAngle:w,endAngle:w+M,circumference:M,outerRadius:p,innerRadius:g};x&&(D.options=y||this.resolveDataElementOptions(v,P.active?"active":s)),w+=M,this.updateElement(P,v,D,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?yt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=pi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,r,o,a,l;if(!t){for(s=0,r=i.data.datasets.length;s<r;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Z(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}O(nn,"id","doughnut"),O(nn,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),O(nn,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),O(nn,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class vi extends xe{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:r}=e,o=this.chart._animationsDisabled;let{start:a,count:l}=qa(e,s,o);this._drawStart=a,this._drawCount=l,Ua(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!r._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(e,s),h=o.axis,g=a.axis,{spanGaps:p,segment:y}=this.options,x=Qe(p)?p:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||r||s==="none",v=e+i,M=t.length;let P=e>0&&this.getParsed(e-1);for(let D=0;D<M;++D){const C=t[D],T=w?C:{};if(D<e||D>=v){T.skip=!0;continue}const b=this.getParsed(D),_=tt(b[g]),S=T[h]=o.getPixelForValue(b[h],D),E=T[g]=r||_?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,b,l):b[g],D);T.skip=isNaN(S)||isNaN(E)||_,T.stop=D>0&&Math.abs(b[h]-P[h])>x,y&&(T.parsed=b,T.raw=c.data[D]),d&&(T.options=u||this.resolveDataElementOptions(D,C.active?"active":s)),w||this.updateElement(C,D,T,s),P=b}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const r=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,r,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}O(vi,"id","line"),O(vi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),O(vi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ki extends xe{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=pi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return ll.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-o)/t.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const r=s==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,h=c.getIndexAngle(0)-.5*rt;let g=h,p;const y=360/this.countVisibleElements();for(p=0;p<e;++p)g+=this._computeAngle(p,s,y);for(p=e;p<e+i;p++){const x=t[p];let w=g,v=g+this._computeAngle(p,s,y),M=o.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;g=v,r&&(l.animateScale&&(M=0),l.animateRotate&&(w=v=h));const P={x:u,y:d,innerRadius:0,outerRadius:M,startAngle:w,endAngle:v,options:this.resolveDataElementOptions(p,x.active?"active":s)};this.updateElement(x,p,P,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Nt(this.resolveDataElementOptions(t,e).angle||i):0}}O(ki,"id","polarArea"),O(ki,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),O(ki,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((r,o)=>{const l=t.getDatasetMeta(0).controller.getStyle(o);return{text:r,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Vr extends nn{}O(Vr,"id","pie"),O(Vr,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class ys extends xe{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ll.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:r.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const r=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a<e+i;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":s),u=r.getPointPositionForValue(a,this.getParsed(a).r),d=o?r.xCenter:u.x,h=o?r.yCenter:u.y,g={x:d,y:h,angle:u.angle,skip:isNaN(d)||isNaN(h),options:c};this.updateElement(l,a,g,s)}}}O(ys,"id","radar"),O(ys,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),O(ys,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class bs extends xe{getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:r}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),l=r.getLabelForValue(o.y);return{label:i[t]||"",value:"("+a+", "+l+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:r,count:o}=qa(e,i,s);if(this._drawStart=r,this._drawCount=o,Ua(e)&&(r=0,o=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,r,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const r=s==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(u),h=this.includeOptions(s,d),g=o.axis,p=a.axis,{spanGaps:y,segment:x}=this.options,w=Qe(y)?y:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||r||s==="none";let M=e>0&&this.getParsed(e-1);for(let P=e;P<e+i;++P){const D=t[P],C=this.getParsed(P),T=v?D:{},b=tt(C[p]),_=T[g]=o.getPixelForValue(C[g],P),S=T[p]=r||b?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,C,l):C[p],P);T.skip=isNaN(_)||isNaN(S)||b,T.stop=P>0&&Math.abs(C[g]-M[g])>w,x&&(T.parsed=C,T.raw=c.data[P]),h&&(T.options=d||this.resolveDataElementOptions(P,D.active?"active":s)),v||this.updateElement(D,P,T,s),M=C}this.updateSharedOptions(d,s,u)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const r=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,r,o)/2}}O(bs,"id","scatter"),O(bs,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),O(bs,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var $g=Object.freeze({__proto__:null,BarController:wi,BubbleController:ms,DoughnutController:nn,LineController:vi,PieController:Vr,PolarAreaController:ki,RadarController:ys,ScatterController:bs});function kn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class jr{constructor(t){O(this,"options");this.options=t||{}}static override(t){Object.assign(jr.prototype,t)}init(){}formats(){return kn()}parse(){return kn()}format(){return kn()}add(){return kn()}diff(){return kn()}startOf(){return kn()}endOf(){return kn()}}var Al={_date:jr};function qg(n,t,e,i){const{controller:s,data:r,_sorted:o}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&r.length){const l=a._reversePixels?mf:Ie;if(i){if(s._sharedOptions){const c=r[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const d=l(r,t,e-u),h=l(r,t,e+u);return{lo:d.lo,hi:h.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Mi(n,t,e,i,s){const r=n.getSortedVisibleDatasetMetas(),o=e[t];for(let a=0,l=r.length;a<l;++a){const{index:c,data:u}=r[a],{lo:d,hi:h}=qg(r[a],t,o,s);for(let g=d;g<=h;++g){const p=u[g];p.skip||i(p,c,g)}}}function Ug(n){const t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){const r=t?Math.abs(i.x-s.x):0,o=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(o,2))}}function $r(n,t,e,i,s){const r=[];return!s&&!n.isPointInArea(t)||Mi(n,e,t,function(a,l,c){!s&&!Ne(a,n.chartArea,0)||a.inRange(t.x,t.y,i)&&r.push({element:a,datasetIndex:l,index:c})},!0),r}function Xg(n,t,e,i){let s=[];function r(o,a,l){const{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],i),{angle:d}=Ha(o,{x:t.x,y:t.y});fi(d,c,u)&&s.push({element:o,datasetIndex:a,index:l})}return Mi(n,e,t,r),s}function Gg(n,t,e,i,s,r){let o=[];const a=Ug(e);let l=Number.POSITIVE_INFINITY;function c(u,d,h){const g=u.inRange(t.x,t.y,s);if(i&&!g)return;const p=u.getCenterPoint(s);if(!(!!r||n.isPointInArea(p))&&!g)return;const x=a(t,p);x<l?(o=[{element:u,datasetIndex:d,index:h}],l=x):x===l&&o.push({element:u,datasetIndex:d,index:h})}return Mi(n,e,t,c),o}function qr(n,t,e,i,s,r){return!r&&!n.isPointInArea(t)?[]:e==="r"&&!i?Xg(n,t,e,s):Gg(n,t,e,i,s,r)}function Rl(n,t,e,i,s){const r=[],o=e==="x"?"inXRange":"inYRange";let a=!1;return Mi(n,e,t,(l,c,u)=>{l[o]&&l[o](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:r}var Ur={evaluateInteractionItems:Mi,modes:{index(n,t,e,i){const s=en(t,n),r=e.axis||"x",o=e.includeInvisible||!1,a=e.intersect?$r(n,s,r,i,o):qr(n,s,r,!1,i,o),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){const s=en(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;let a=e.intersect?$r(n,s,r,i,o):qr(n,s,r,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(n,t,e,i){const s=en(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;return $r(n,s,r,i,o)},nearest(n,t,e,i){const s=en(t,n),r=e.axis||"xy",o=e.includeInvisible||!1;return qr(n,s,r,e.intersect,i,o)},x(n,t,e,i){const s=en(t,n);return Rl(n,s,"x",e.intersect,i)},y(n,t,e,i){const s=en(t,n);return Rl(n,s,"y",e.intersect,i)}}};const Ll=["left","top","right","bottom"];function Si(n,t){return n.filter(e=>e.pos===t)}function Il(n,t){return n.filter(e=>Ll.indexOf(e.pos)===-1&&e.box.axis===t)}function Di(n,t){return n.sort((e,i)=>{const s=t?i:e,r=t?e:i;return s.weight===r.weight?s.index-r.index:s.weight-r.weight})}function Kg(n){const t=[];let e,i,s,r,o,a;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:r,options:{stack:o,stackWeight:a=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:o&&r+o,stackWeight:a});return t}function Zg(n){const t={};for(const e of n){const{stack:i,pos:s,stackWeight:r}=e;if(!i||!Ll.includes(s))continue;const o=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=r}return t}function Qg(n,t){const e=Zg(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let r,o,a;for(r=0,o=n.length;r<o;++r){a=n[r];const{fullSize:l}=a.box,c=e[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return e}function Jg(n){const t=Kg(n),e=Di(t.filter(c=>c.box.fullSize),!0),i=Di(Si(t,"left"),!0),s=Di(Si(t,"right")),r=Di(Si(t,"top"),!0),o=Di(Si(t,"bottom")),a=Il(t,"x"),l=Il(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(o).concat(a),chartArea:Si(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(o).concat(a)}}function Nl(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Fl(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function tp(n,t,e,i){const{pos:s,box:r}=e,o=n.maxPadding;if(!it(s)){e.size&&(n[s]-=e.size);const d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?r.height:r.width),e.size=d.size/d.count,n[s]+=e.size}r.getPadding&&Fl(o,r.getPadding());const a=Math.max(0,t.outerWidth-Nl(o,n,"left","right")),l=Math.max(0,t.outerHeight-Nl(o,n,"top","bottom")),c=a!==n.w,u=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function ep(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function np(n,t){const e=t.maxPadding;function i(s){const r={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{r[o]=Math.max(t[o],e[o])}),r}return i(n?["left","right"]:["top","bottom"])}function Ti(n,t,e,i){const s=[];let r,o,a,l,c,u;for(r=0,o=n.length,c=0;r<o;++r){a=n[r],l=a.box,l.update(a.width||t.w,a.height||t.h,np(a.horizontal,t));const{same:d,other:h}=tp(t,e,a,i);c|=d&&s.length,u=u||h,l.fullSize||s.push(a)}return c&&Ti(s,t,e,i)||u}function xs(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Bl(n,t,e,i){const s=e.padding;let{x:r,y:o}=t;for(const a of n){const l=a.box,c=i[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*u,h=c.size||l.height;Qt(c.start)&&(o=c.start),l.fullSize?xs(l,s.left,o,e.outerWidth-s.right-s.left,h):xs(l,t.left+c.placed,o,d,h),c.start=o,c.placed+=d,o=l.bottom}else{const d=t.h*u,h=c.size||l.width;Qt(c.start)&&(r=c.start),l.fullSize?xs(l,r,s.top,h,e.outerHeight-s.bottom-s.top):xs(l,r,t.top+c.placed,h,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=o}var $t={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){const e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;const s=Ft(n.options.layout.padding),r=Math.max(t-s.width,0),o=Math.max(e-s.height,0),a=Jg(n.boxes),l=a.vertical,c=a.horizontal;dt(n.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,x)=>x.box.options&&x.box.options.display===!1?y:y+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/u,hBoxMaxHeight:o/2}),h=Object.assign({},s);Fl(h,Ft(i));const g=Object.assign({maxPadding:h,w:r,h:o,x:s.left,y:s.top},s),p=Qg(l.concat(c),d);Ti(a.fullSize,g,d,p),Ti(l,g,d,p),Ti(c,g,d,p)&&Ti(l,g,d,p),ep(g),Bl(a.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,Bl(a.rightAndBottom,g,d,p),n.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},dt(a.chartArea,y=>{const x=y.box;Object.assign(x,n.chartArea),x.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class zl{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class ip extends zl{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const _s="$chartjs",sp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Hl=n=>n===null||n==="";function rp(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[_s]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Hl(s)){const r=dl(n,"width");r!==void 0&&(n.width=r)}if(Hl(i))if(n.style.height==="")n.height=n.width/(t||2);else{const r=dl(n,"height");r!==void 0&&(n.height=r)}return n}const Wl=cg?{passive:!0}:!1;function op(n,t,e){n&&n.addEventListener(t,e,Wl)}function ap(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Wl)}function lp(n,t){const e=sp[n.type]||n.type,{x:i,y:s}=en(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ws(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function cp(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||ws(a.addedNodes,i),o=o&&!ws(a.removedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function up(n,t,e){const i=n.canvas,s=new MutationObserver(r=>{let o=!1;for(const a of r)o=o||ws(a.removedNodes,i),o=o&&!ws(a.addedNodes,i);o&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ci=new Map;let Yl=0;function Vl(){const n=window.devicePixelRatio;n!==Yl&&(Yl=n,Ci.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function dp(n,t){Ci.size||window.addEventListener("resize",Vl),Ci.set(n,t)}function hp(n){Ci.delete(n),Ci.size||window.removeEventListener("resize",Vl)}function fp(n,t,e){const i=n.canvas,s=i&&Br(i);if(!s)return;const r=$a((a,l)=>{const c=s.clientWidth;e(a,l),c<s.clientWidth&&e()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return o.observe(s),dp(n,r),o}function Xr(n,t,e){e&&e.disconnect(),t==="resize"&&hp(n)}function gp(n,t,e){const i=n.canvas,s=$a(r=>{n.ctx!==null&&e(lp(r,n))},n);return op(i,t,s),s}class pp extends zl{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(rp(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[_s])return!1;const i=e[_s].initial;["height","width"].forEach(r=>{const o=i[r];tt(o)?e.removeAttribute(r):e.setAttribute(r,o)});const s=i.style||{};return Object.keys(s).forEach(r=>{e.style[r]=s[r]}),e.width=e.width,delete e[_s],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),o={attach:cp,detach:up,resize:fp}[e]||gp;s[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Xr,detach:Xr,resize:Xr}[e]||ap)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return lg(t,e,i,s)}isAttached(t){const e=t&&Br(t);return!!(e&&e.isConnected)}}function mp(n){return!Fr()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?ip:pp}class Yt{constructor(){O(this,"x");O(this,"y");O(this,"active",!1);O(this,"options");O(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Qe(this.x)&&Qe(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}}O(Yt,"defaults",{}),O(Yt,"defaultRoutes");function yp(n,t){const e=n.options.ticks,i=bp(n),s=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?_p(t):[],o=r.length,a=r[0],l=r[o-1],c=[];if(o>s)return wp(t,c,r,o/s),c;const u=xp(r,t,s);if(o>0){let d,h;const g=o>1?Math.round((l-a)/(o-1)):null;for(vs(t,c,u,tt(g)?0:a-g,a),d=0,h=o-1;d<h;d++)vs(t,c,u,r[d],r[d+1]);return vs(t,c,u,l,tt(g)?t.length:l+g),c}return vs(t,c,u),c}function bp(n){const t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function xp(n,t,e){const i=vp(n),s=t.length/e;if(!i)return Math.max(s,1);const r=hf(i);for(let o=0,a=r.length-1;o<a;o++){const l=r[o];if(l>s)return l}return Math.max(s,1)}function _p(n){const t=[];let e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function wp(n,t,e,i){let s=0,r=e[0],o;for(i=Math.ceil(i),o=0;o<n.length;o++)o===r&&(t.push(n[o]),s++,r=e[s*i])}function vs(n,t,e,i,s){const r=Z(i,0),o=Math.min(Z(s,n.length),n.length);let a=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),u=r;u<0;)a++,u=Math.round(r+a*e);for(c=Math.max(r,0);c<o;c++)c===u&&(t.push(n[c]),a++,u=Math.round(r+a*e))}function vp(n){const t=n.length;let e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}const kp=n=>n==="left"?"right":n==="right"?"left":n,jl=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,$l=(n,t)=>Math.min(t||n,n);function ql(n,t){const e=[],i=n.length/t,s=n.length;let r=0;for(;r<s;r+=i)e.push(n[Math.floor(r)]);return e}function Mp(n,t,e){const i=n.ticks.length,s=Math.min(t,i-1),r=n._startPixel,o=n._endPixel,a=1e-6;let l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-r,o-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-a||l>o+a)))return l}function Sp(n,t){dt(n,e=>{const i=e.gc,s=i.length/2;let r;if(s>t){for(r=0;r<s;++r)delete e.data[i[r]];i.splice(0,s)}})}function Pi(n){return n.drawTicks?n.tickLength:0}function Ul(n,t){if(!n.display)return 0;const e=xt(n.font,t),i=Ft(n.padding);return(at(n.text)?n.text.length:1)*e.lineHeight+i.height}function Dp(n,t){return tn(n,{scale:t,type:"scale"})}function Tp(n,t,e){return tn(n,{tick:e,index:t,type:"tick"})}function Cp(n,t,e){let i=Tr(n);return(e&&t!=="right"||!e&&t==="right")&&(i=kp(i)),i}function Pp(n,t,e,i){const{top:s,left:r,bottom:o,right:a,chart:l}=n,{chartArea:c,scales:u}=l;let d=0,h,g,p;const y=o-s,x=a-r;if(n.isHorizontal()){if(g=jt(i,r,a),it(e)){const w=Object.keys(e)[0],v=e[w];p=u[w].getPixelForValue(v)+y-t}else e==="center"?p=(c.bottom+c.top)/2+y-t:p=jl(n,e,t);h=a-r}else{if(it(e)){const w=Object.keys(e)[0],v=e[w];g=u[w].getPixelForValue(v)-x+t}else e==="center"?g=(c.left+c.right)/2-x+t:g=jl(n,e,t);p=jt(i,o,s),d=e==="left"?-bt:bt}return{titleX:g,titleY:p,maxWidth:h,rotation:d}}class Mn extends Yt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=ce(t,Number.POSITIVE_INFINITY),e=ce(e,Number.NEGATIVE_INFINITY),i=ce(i,Number.POSITIVE_INFINITY),s=ce(s,Number.NEGATIVE_INFINITY),{min:ce(t,i),max:ce(e,s),minDefined:Mt(t),maxDefined:Mt(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),o;if(s&&r)return{min:e,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,t),s||(e=Math.min(e,o.min)),r||(i=Math.max(i,o.max));return e=r&&e>i?i:e,i=s&&e>i?e:i,{min:ce(e,ce(i,e)),max:ce(i,ce(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ut(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:r,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Hf(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?ql(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=yp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ut(this.options.afterUpdate,[this])}beforeSetDimensions(){ut(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(){ut(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ut(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ut(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,r;for(i=0,s=t.length;i<s;i++)r=t[i],r.label=ut(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){ut(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ut(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=$l(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,r=e.maxRotation;let o=s,a,l,c;if(!this._isVisible()||!e.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),d=u.widest.width,h=u.highest.height,g=Ht(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),d+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-Pi(t.grid)-e.padding-Ul(t.title,this.chart.options.font),c=Math.sqrt(d*d+h*h),o=ls(Math.min(Math.asin(Ht((u.highest.height+6)/a,-1,1)),Math.asin(Ht(l/c,-1,1))-Math.asin(Ht(h/c,-1,1)))),o=Math.max(s,Math.min(r,o))),this.labelRotation=o}afterCalculateLabelRotation(){ut(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ut(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:r}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=Ul(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Pi(r)+l):(t.height=this.maxHeight,t.width=Pi(r)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:h}=this._getLabelSizes(),g=i.padding*2,p=Nt(this.labelRotation),y=Math.cos(p),x=Math.sin(p);if(a){const w=i.mirror?0:x*d.width+y*h.height;t.height=Math.min(this.maxHeight,t.height+w+g)}else{const w=i.mirror?0:y*d.width+x*h.height;t.width=Math.min(this.maxWidth,t.width+w+g)}this._calculatePadding(c,u,x,y)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:r,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,g=0;l?c?(h=s*t.width,g=i*e.height):(h=i*t.height,g=s*e.width):r==="start"?g=e.width:r==="end"?h=t.width:r!=="inner"&&(h=t.width/2,g=e.width/2),this.paddingLeft=Math.max((h-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-d+o)*this.width/(this.width-d),0)}else{let u=e.height/2,d=t.height/2;r==="start"?(u=0,d=t.height):r==="end"&&(u=e.height,d=0),this.paddingTop=u+o,this.paddingBottom=d+o}}_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(){ut(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)tt(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ql(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:r}=this,o=[],a=[],l=Math.floor(e/$l(e,i));let c=0,u=0,d,h,g,p,y,x,w,v,M,P,D;for(d=0;d<e;d+=l){if(p=t[d].label,y=this._resolveTickFontOptions(d),s.font=x=y.string,w=r[x]=r[x]||{data:{},gc:[]},v=y.lineHeight,M=P=0,!tt(p)&&!at(p))M=ds(s,w.data,w.gc,M,p),P=v;else if(at(p))for(h=0,g=p.length;h<g;++h)D=p[h],!tt(D)&&!at(D)&&(M=ds(s,w.data,w.gc,M,D),P+=v);o.push(M),a.push(P),c=Math.max(M,c),u=Math.max(P,u)}Sp(r,e);const C=o.indexOf(c),T=a.indexOf(u),b=_=>({width:o[_]||0,height:a[_]||0});return{first:b(0),last:b(e-1),widest:b(C),highest:b(T),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return pf(this._alignToPixels?xn(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=Tp(this.getContext(),t,i))}return this.$context||(this.$context=Dp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Nt(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),o=t.autoSkipPadding||0,a=r?r.widest.width+o:0,l=r?r.highest.height+o:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:r,position:o,border:a}=s,l=r.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=Pi(r),g=[],p=a.setContext(this.getContext()),y=p.display?p.width:0,x=y/2,w=function(j){return xn(i,j,y)};let v,M,P,D,C,T,b,_,S,E,R,F;if(o==="top")v=w(this.bottom),T=this.bottom-h,_=v-x,E=w(t.top)+x,F=t.bottom;else if(o==="bottom")v=w(this.top),E=t.top,F=w(t.bottom)-x,T=v+x,_=this.top+h;else if(o==="left")v=w(this.right),C=this.right-h,b=v-x,S=w(t.left)+x,R=t.right;else if(o==="right")v=w(this.left),S=t.left,R=w(t.right)-x,C=v+x,b=this.left+h;else if(e==="x"){if(o==="center")v=w((t.top+t.bottom)/2+.5);else if(it(o)){const j=Object.keys(o)[0],N=o[j];v=w(this.chart.scales[j].getPixelForValue(N))}E=t.top,F=t.bottom,T=v+x,_=T+h}else if(e==="y"){if(o==="center")v=w((t.left+t.right)/2);else if(it(o)){const j=Object.keys(o)[0],N=o[j];v=w(this.chart.scales[j].getPixelForValue(N))}C=v-x,b=C-h,S=t.left,R=t.right}const $=Z(s.ticks.maxTicksLimit,d),K=Math.max(1,Math.ceil(d/$));for(M=0;M<d;M+=K){const j=this.getContext(M),N=r.setContext(j),st=a.setContext(j),B=N.lineWidth,At=N.color,wt=st.dash||[],H=st.dashOffset,L=N.tickWidth,z=N.tickColor,V=N.tickBorderDash||[],U=N.tickBorderDashOffset;P=Mp(this,M,l),P!==void 0&&(D=xn(i,P,B),c?C=b=S=R=D:T=_=E=F=D,g.push({tx1:C,ty1:T,tx2:b,ty2:_,x1:S,y1:E,x2:R,y2:F,width:B,color:At,borderDash:wt,borderDashOffset:H,tickWidth:L,tickColor:z,tickBorderDash:V,tickBorderDashOffset:U}))}return this._ticksLength=d,this._borderValue=v,g}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:r}=i,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,h=Pi(i.grid),g=h+u,p=d?-u:g,y=-Nt(this.labelRotation),x=[];let w,v,M,P,D,C,T,b,_,S,E,R,F="middle";if(s==="top")C=this.bottom-p,T=this._getXAxisLabelAlignment();else if(s==="bottom")C=this.top+p,T=this._getXAxisLabelAlignment();else if(s==="left"){const K=this._getYAxisLabelAlignment(h);T=K.textAlign,D=K.x}else if(s==="right"){const K=this._getYAxisLabelAlignment(h);T=K.textAlign,D=K.x}else if(e==="x"){if(s==="center")C=(t.top+t.bottom)/2+g;else if(it(s)){const K=Object.keys(s)[0],j=s[K];C=this.chart.scales[K].getPixelForValue(j)+g}T=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")D=(t.left+t.right)/2-g;else if(it(s)){const K=Object.keys(s)[0],j=s[K];D=this.chart.scales[K].getPixelForValue(j)}T=this._getYAxisLabelAlignment(h).textAlign}e==="y"&&(l==="start"?F="top":l==="end"&&(F="bottom"));const $=this._getLabelSizes();for(w=0,v=a.length;w<v;++w){M=a[w],P=M.label;const K=r.setContext(this.getContext(w));b=this.getPixelForTick(w)+r.labelOffset,_=this._resolveTickFontOptions(w),S=_.lineHeight,E=at(P)?P.length:1;const j=E/2,N=K.color,st=K.textStrokeColor,B=K.textStrokeWidth;let At=T;o?(D=b,T==="inner"&&(w===v-1?At=this.options.reverse?"left":"right":w===0?At=this.options.reverse?"right":"left":At="center"),s==="top"?c==="near"||y!==0?R=-E*S+S/2:c==="center"?R=-$.highest.height/2-j*S+S:R=-$.highest.height+S/2:c==="near"||y!==0?R=S/2:c==="center"?R=$.highest.height/2-j*S:R=$.highest.height-E*S,d&&(R*=-1),y!==0&&!K.showLabelBackdrop&&(D+=S/2*Math.sin(y))):(C=b,R=(1-E)*S/2);let wt;if(K.showLabelBackdrop){const H=Ft(K.backdropPadding),L=$.heights[w],z=$.widths[w];let V=R-H.top,U=0-H.left;switch(F){case"middle":V-=L/2;break;case"bottom":V-=L;break}switch(T){case"center":U-=z/2;break;case"right":U-=z;break;case"inner":w===v-1?U-=z:w>0&&(U-=z/2);break}wt={left:U,top:V,width:z+H.width,height:L+H.height,color:K.backdropColor}}x.push({label:P,font:_,textOffset:R,options:{rotation:y,color:N,strokeColor:st,strokeWidth:B,textAlign:At,textBaseline:F,translation:[D,C],backdrop:wt}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Nt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,o=this._getLabelSizes(),a=t+r,l=o.widest.width;let c,u;return e==="left"?s?(u=this.right+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,o;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,o=s.length;r<o;++r){const l=s[r];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,r=i.setContext(this.getContext()),o=i.display?r.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,h;this.isHorizontal()?(c=xn(t,this.left,o)-o/2,u=xn(t,this.right,a)+a/2,d=h=l):(d=xn(t,this.top,o)-o/2,h=xn(t,this.bottom,a)+a/2,c=u=l),e.save(),e.lineWidth=r.width,e.strokeStyle=r.color,e.beginPath(),e.moveTo(c,d),e.lineTo(u,h),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&yi(i,s);const r=this.getLabelItems(t);for(const o of r){const a=o.options,l=o.font,c=o.label,u=o.textOffset;_n(i,c,0,u,l,a)}s&&bi(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const r=xt(i.font),o=Ft(i.padding),a=i.align;let l=r.lineHeight/2;e==="bottom"||e==="center"||it(e)?(l+=o.bottom,at(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=o.top;const{titleX:c,titleY:u,maxWidth:d,rotation:h}=Pp(this,l,e,a);_n(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:h,textAlign:Cp(a,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Z(t.grid&&t.grid.z,-1),s=Z(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Mn.prototype.draw?[{z:e,draw:r=>{this.draw(r)}}]:[{z:i,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let r,o;for(r=0,o=e.length;r<o;++r){const a=e[r];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return xt(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ks{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;Ap(e)&&(i=this.register(e));const s=this.items,r=t.id,o=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,Op(t,o,i),this.override&&Tt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in Tt[s]&&(delete Tt[s][i],this.override&&delete bn[i])}}function Op(n,t,e){const i=ui(Object.create(null),[e?Tt.get(e):{},Tt.get(t),n.defaults]);Tt.set(t,i),n.defaultRoutes&&Ep(t,n.defaultRoutes),n.descriptors&&Tt.describe(t,n.descriptors)}function Ep(n,t){Object.keys(t).forEach(e=>{const i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),o=t[e].split("."),a=o.pop(),l=o.join(".");Tt.route(r,s,l,a)})}function Ap(n){return"id"in n&&"defaults"in n}class Rp{constructor(){this.controllers=new ks(xe,"datasets",!0),this.elements=new ks(Yt,"elements"),this.plugins=new ks(Object,"plugins"),this.scales=new ks(Mn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const r=i||this._getRegistryForType(s);i||r.isForType(s)||r===this.plugins&&s.id?this._exec(t,r,s):dt(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=Mr(t);ut(i["before"+s],[],i),e[t](i),ut(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var De=new Rp;class Lp{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const r=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(r,t,e,i);return e==="afterDestroy"&&(this._notify(r,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const r of t){const o=r.plugin,a=o[i],l=[e,s,r.options];if(ut(a,l,o)===!1&&s.cancelable)return!1}return!0}invalidate(){tt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=Z(i.options&&i.options.plugins,{}),r=Ip(i);return s===!1&&!e?[]:Fp(t,r,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(r,o)=>r.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Ip(n){const t={},e=[],i=Object.keys(De.plugins.items);for(let r=0;r<i.length;r++)e.push(De.getPlugin(i[r]));const s=n.plugins||[];for(let r=0;r<s.length;r++){const o=s[r];e.indexOf(o)===-1&&(e.push(o),t[o.id]=!0)}return{plugins:e,localIds:t}}function Np(n,t){return!t&&n===!1?null:n===!0?{}:n}function Fp(n,{plugins:t,localIds:e},i,s){const r=[],o=n.getContext();for(const a of t){const l=a.id,c=Np(i[l],s);c!==null&&r.push({plugin:a,options:Bp(n.config,{plugin:a,local:e[l]},c,o)})}return r}function Bp(n,{plugin:t,local:e},i,s){const r=n.pluginScopeKeys(t),o=n.getOptionScopes(i,r);return e&&t.defaults&&o.push(t.defaults),n.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Gr(n,t){const e=Tt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function zp(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Hp(n,t){return n===t?"_index_":"_value_"}function Xl(n){if(n==="x"||n==="y"||n==="r")return n}function Wp(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function Kr(n,...t){if(Xl(n))return n;for(const e of t){const i=e.axis||Wp(e.position)||n.length>1&&Xl(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Gl(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function Yp(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Gl(n,"x",e[0])||Gl(n,"y",e[0])}return{}}function Vp(n,t){const e=bn[n.type]||{scales:{}},i=t.scales||{},s=Gr(n.type,t),r=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!it(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=Kr(o,a,Yp(o,n),Tt.scales[a.type]),c=Hp(l,s),u=e.scales||{};r[o]=di(Object.create(null),[{axis:l},a,u[l],u[c]])}),n.data.datasets.forEach(o=>{const a=o.type||n.type,l=o.indexAxis||Gr(a,t),u=(bn[a]||{}).scales||{};Object.keys(u).forEach(d=>{const h=zp(d,l),g=o[h+"AxisID"]||h;r[g]=r[g]||Object.create(null),di(r[g],[{axis:h},i[g],u[d]])})}),Object.keys(r).forEach(o=>{const a=r[o];di(a,[Tt.scales[a.type],Tt.scale])}),r}function Kl(n){const t=n.options||(n.options={});t.plugins=Z(t.plugins,{}),t.scales=Vp(n,t)}function Zl(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function jp(n){return n=n||{},n.data=Zl(n.data),Kl(n),n}const Ql=new Map,Jl=new Set;function Ms(n,t){let e=Ql.get(n);return e||(e=t(),Ql.set(n,e),Jl.add(e)),e}const Oi=(n,t,e)=>{const i=Ke(t,e);i!==void 0&&n.add(i)};class $p{constructor(t){this._config=jp(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Zl(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Kl(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ms(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ms(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ms(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Ms(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:r}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(d=>Oi(l,t,d))),u.forEach(d=>Oi(l,s,d)),u.forEach(d=>Oi(l,bn[r]||{},d)),u.forEach(d=>Oi(l,Tt,d)),u.forEach(d=>Oi(l,Or,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jl.has(e)&&o.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,bn[e]||{},Tt.datasets[e]||{},{type:e},Tt,Or]}resolveNamedOptions(t,e,i,s=[""]){const r={$shared:!0},{resolver:o,subPrefixes:a}=tc(this._resolverCache,t,s);let l=o;if(Up(o,e)){r.$shared=!1,i=Jt(i)?i():i;const c=this.createResolver(t,i,a);l=Hn(o,i,c)}for(const c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){const{resolver:r}=tc(this._resolverCache,t,i);return it(e)?Hn(r,e,void 0,s):r}}function tc(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let r=i.get(s);return r||(r={resolver:Lr(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,r)),r}const qp=n=>it(n)&&Object.getOwnPropertyNames(n).some(t=>Jt(n[t]));function Up(n,t){const{isScriptable:e,isIndexable:i}=nl(n);for(const s of t){const r=e(s),o=i(s),a=(o||r)&&n[s];if(r&&(Jt(a)||qp(a))||o&&at(a))return!0}return!1}var Xp="4.4.4";const Gp=["top","bottom","left","right","chartArea"];function ec(n,t){return n==="top"||n==="bottom"||Gp.indexOf(n)===-1&&t==="x"}function nc(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function ic(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ut(e&&e.onComplete,[n],t)}function Kp(n){const t=n.chart,e=t.options.animation;ut(e&&e.onProgress,[n],t)}function sc(n){return Fr()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Ss={},rc=n=>{const t=sc(n);return Object.values(Ss).filter(e=>e.canvas===t).pop()};function Zp(n,t,e){const i=Object.keys(n);for(const s of i){const r=+s;if(r>=t){const o=n[s];delete n[s],(e>0||r>t)&&(n[r+e]=o)}}}function Qp(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function Ds(n,t,e){return n.options.clip?n[e]:t[e]}function Jp(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:Ds(e,t,"left"),right:Ds(e,t,"right"),top:Ds(i,t,"top"),bottom:Ds(i,t,"bottom")}:t}let ge=(fn=class{static register(...t){De.add(...t),oc()}static unregister(...t){De.remove(...t),oc()}constructor(t,e){const i=this.config=new $p(e),s=sc(t),r=rc(s);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||mp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=sf(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,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 Lp,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=xf(d=>this.update(d),o.resizeDelay||0),this._dataChanges=[],Ss[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Fe.listen(this,"complete",ic),Fe.listen(this,"progress",Kp),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return tt(t)?e&&r?r:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return De}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ul(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ja(this.canvas,this.ctx),this}stop(){return Fe.stop(this),this}resize(t,e){Fe.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,r=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,r),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ul(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ut(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};dt(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let r=[];e&&(r=r.concat(Object.keys(e).map(o=>{const a=e[o],l=Kr(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),dt(r,o=>{const a=o.options,l=a.id,c=Kr(l,a),u=Z(a.type,o.dtype);(a.position===void 0||ec(a.position,c)!==ec(o.dposition))&&(a.position=o.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===u)d=i[l];else{const h=De.getScale(u);d=new h({id:l,type:u,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(a,t)}),dt(s,(o,a)=>{o||delete i[a]}),dt(i,o=>{$t.configure(this,o,o.options),$t.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(nc("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const r=e[i];let o=this.getDatasetMeta(i);const a=r.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=a,o.indexAxis=r.indexAxis||Gr(a,this.options),o.order=r.order||0,o.index=i,o.label=""+r.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const l=De.getController(a),{datasetElementType:c,dataElementType:u}=Tt.datasets[a];Object.assign(l,{dataElementType:De.getElement(u),datasetElementType:c&&De.getElement(c)}),o.controller=new l(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){dt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),h=!s&&r.indexOf(d)===-1;d.buildOrUpdateElements(h),o=Math.max(+d.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||dt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nc("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){dt(this.scales,t=>{$t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Na(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:r}of e){const o=i==="_removeElements"?-r:r;Zp(t,s,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=r=>new Set(t.filter(o=>o[0]===r).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let r=1;r<e;r++)if(!Na(s,i(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$t.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],dt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,Jt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Fe.has(this)?this.attached&&!Fe.running(this)&&Fe.start(this):(this.draw(),ic({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,r;for(s=0,r=e.length;s<r;++s){const o=e[s];(!t||o.visible)&&i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,r=Jp(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&yi(e,{left:i.left===!1?0:r.left-i.left,right:i.right===!1?this.width:r.right+i.right,top:i.top===!1?0:r.top-i.top,bottom:i.bottom===!1?this.height:r.bottom+i.bottom}),t.controller.draw(),s&&bi(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Ne(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const r=Ur.modes[e];return typeof r=="function"?r(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(r=>r&&r._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=tn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",r=this.getDatasetMeta(t),o=r.controller._resolveAnimations(void 0,s);Qt(e)?(r.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(r,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Fe.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ja(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ss[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(r,o)=>{e.addEventListener(this,r,o),t[r]=o},s=(r,o,a)=>{r.offsetX=o,r.offsetY=a,this._eventHandler(r)};dt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",r),i("detach",o)};o=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){dt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},dt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let r,o,a,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){o=t[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:r,index:o})=>{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[o],index:o}});!ss(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,r=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),o=r(e,t),a=i?t:r(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const r=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(r||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:r}=this,o=e,a=this._getActiveElements(t,s,i,o),l=uf(t),c=Qp(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ut(r.onHover,[t,a,this],this),l&&ut(r.onClick,[t,a,this],this));const u=!ss(a,s);return(u||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,s)}},O(fn,"defaults",Tt),O(fn,"instances",Ss),O(fn,"overrides",bn),O(fn,"registry",De),O(fn,"version",Xp),O(fn,"getChart",rc),fn);function oc(){return dt(ge.instances,n=>n._plugins.invalidate())}function tm(n,t,e){const{startAngle:i,pixelMargin:s,x:r,y:o,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(r,o,a,i-c,e+c),l>s?(c=s/l,n.arc(r,o,l,e+c,i-c,!0)):n.arc(r,o,s,e+bt,i-bt),n.closePath(),n.clip()}function em(n){return Rr(n,["outerStart","outerEnd","innerStart","innerEnd"])}function nm(n,t,e,i){const s=em(n.options.borderRadius),r=(e-t)/2,o=Math.min(r,i*t/2),a=l=>{const c=(e-Math.min(r,l))*i/2;return Ht(l,0,Math.min(r,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Ht(s.innerStart,0,o),innerEnd:Ht(s.innerEnd,0,o)}}function Vn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function Ts(n,t,e,i,s,r){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+i+e-c,0),h=u>0?u+i+e+c:0;let g=0;const p=s-l;if(i){const K=u>0?u-i:0,j=d>0?d-i:0,N=(K+j)/2,st=N!==0?p*N/(N+i):p;g=(p-st)/2}const y=Math.max(.001,p*d-e/rt)/d,x=(p-y)/2,w=l+x+g,v=s-x-g,{outerStart:M,outerEnd:P,innerStart:D,innerEnd:C}=nm(t,h,d,v-w),T=d-M,b=d-P,_=w+M/T,S=v-P/b,E=h+D,R=h+C,F=w+D/E,$=v-C/R;if(n.beginPath(),r){const K=(_+S)/2;if(n.arc(o,a,d,_,K),n.arc(o,a,d,K,S),P>0){const B=Vn(b,S,o,a);n.arc(B.x,B.y,P,S,v+bt)}const j=Vn(R,v,o,a);if(n.lineTo(j.x,j.y),C>0){const B=Vn(R,$,o,a);n.arc(B.x,B.y,C,v+bt,$+Math.PI)}const N=(v-C/h+(w+D/h))/2;if(n.arc(o,a,h,v-C/h,N,!0),n.arc(o,a,h,N,w+D/h,!0),D>0){const B=Vn(E,F,o,a);n.arc(B.x,B.y,D,F+Math.PI,w-bt)}const st=Vn(T,w,o,a);if(n.lineTo(st.x,st.y),M>0){const B=Vn(T,_,o,a);n.arc(B.x,B.y,M,w-bt,_)}}else{n.moveTo(o,a);const K=Math.cos(_)*d+o,j=Math.sin(_)*d+a;n.lineTo(K,j);const N=Math.cos(S)*d+o,st=Math.sin(S)*d+a;n.lineTo(N,st)}n.closePath()}function im(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a}=t;let l=t.endAngle;if(r){Ts(n,t,e,i,l,s);for(let c=0;c<r;++c)n.fill();isNaN(a)||(l=o+(a%yt||yt))}return Ts(n,t,e,i,l,s),n.fill(),l}function sm(n,t,e,i,s){const{fullCircles:r,startAngle:o,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:h}=l,g=l.borderAlign==="inner";if(!c)return;n.setLineDash(d||[]),n.lineDashOffset=h,g?(n.lineWidth=c*2,n.lineJoin=u||"round"):(n.lineWidth=c,n.lineJoin=u||"bevel");let p=t.endAngle;if(r){Ts(n,t,e,i,p,s);for(let y=0;y<r;++y)n.stroke();isNaN(a)||(p=o+(a%yt||yt))}g&&tm(n,t,p),r||(Ts(n,t,e,i,p,s),n.stroke())}class Ei extends Yt{constructor(e){super();O(this,"circumference");O(this,"endAngle");O(this,"fullCircles");O(this,"innerRadius");O(this,"outerRadius");O(this,"pixelMargin");O(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.getProps(["x","y"],s),{angle:o,distance:a}=Ha(r,{x:e,y:i}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,p=Z(h,c-l),y=fi(o,l,c)&&l!==c,x=p>=yt||y,w=Le(a,u+g,d+g);return x&&w}getCenterPoint(e){const{x:i,y:s,startAngle:r,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:u}=this.options,d=(r+o)/2,h=(a+l+u+c)/2;return{x:i+Math.cos(d)*h,y:s+Math.sin(d)*h}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,r=(i.offset||0)/4,o=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>yt?Math.floor(s/yt):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*r,Math.sin(l)*r);const c=1-Math.sin(Math.min(rt,s||0)),u=r*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,im(e,this,u,o,a),sm(e,this,u,o,a),e.restore()}}O(Ei,"id","arc"),O(Ei,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),O(Ei,"defaultRoutes",{backgroundColor:"backgroundColor"}),O(Ei,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function ac(n,t,e=t){n.lineCap=Z(e.borderCapStyle,t.borderCapStyle),n.setLineDash(Z(e.borderDash,t.borderDash)),n.lineDashOffset=Z(e.borderDashOffset,t.borderDashOffset),n.lineJoin=Z(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=Z(e.borderWidth,t.borderWidth),n.strokeStyle=Z(e.borderColor,t.borderColor)}function rm(n,t,e){n.lineTo(e.x,e.y)}function om(n){return n.stepped?Ef:n.tension||n.cubicInterpolationMode==="monotone"?Af:rm}function lc(n,t,e={}){const i=n.length,{start:s=0,end:r=i-1}=e,{start:o,end:a}=t,l=Math.max(s,o),c=Math.min(r,a),u=s<o&&r<o||s>a&&r>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function am(n,t,e,i){const{points:s,options:r}=t,{count:o,start:a,loop:l,ilen:c}=lc(s,e,i),u=om(r);let{move:d=!0,reverse:h}=i||{},g,p,y;for(g=0;g<=c;++g)p=s[(a+(h?c-g:g))%o],!p.skip&&(d?(n.moveTo(p.x,p.y),d=!1):u(n,y,p,h,r.stepped),y=p);return l&&(p=s[(a+(h?c:0))%o],u(n,y,p,h,r.stepped)),!!l}function lm(n,t,e,i){const s=t.points,{count:r,start:o,ilen:a}=lc(s,e,i),{move:l=!0,reverse:c}=i||{};let u=0,d=0,h,g,p,y,x,w;const v=P=>(o+(c?a-P:P))%r,M=()=>{y!==x&&(n.lineTo(u,x),n.lineTo(u,y),n.lineTo(u,w))};for(l&&(g=s[v(0)],n.moveTo(g.x,g.y)),h=0;h<=a;++h){if(g=s[v(h)],g.skip)continue;const P=g.x,D=g.y,C=P|0;C===p?(D<y?y=D:D>x&&(x=D),u=(d*u+P)/++d):(M(),n.lineTo(P,D),p=C,d=0,y=x=D),w=D}M()}function Zr(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?lm:am}function cm(n){return n.stepped?ug:n.tension||n.cubicInterpolationMode==="monotone"?dg:vn}function um(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),ac(n,t.options),n.stroke(s)}function dm(n,t,e,i){const{segments:s,options:r}=t,o=Zr(t);for(const a of s)ac(n,r,a.style),n.beginPath(),o(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const hm=typeof Path2D=="function";function fm(n,t,e,i){hm&&!t.options.segment?um(n,t,e,i):dm(n,t,e,i)}class sn extends Yt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;ng(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=yg(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],r=this.points,o=yl(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],l=cm(i);let c,u;for(c=0,u=o.length;c<u;++c){const{start:d,end:h}=o[c],g=r[d],p=r[h];if(g===p){a.push(g);continue}const y=Math.abs((s-g[e])/(p[e]-g[e])),x=l(g,p,y,i.stepped);x[e]=t[e],a.push(x)}return a.length===1?a[0]:a}pathSegment(t,e,i){return Zr(this)(t,this,e,i)}path(t,e,i){const s=this.segments,r=Zr(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=r(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),fm(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}O(sn,"id","line"),O(sn,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),O(sn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),O(sn,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function cc(n,t,e,i){const s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)<s.radius+s.hitRadius}class Cs extends Yt{constructor(e){super();O(this,"parsed");O(this,"skip");O(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,s){const r=this.options,{x:o,y:a}=this.getProps(["x","y"],s);return Math.pow(e-o,2)+Math.pow(i-a,2)<Math.pow(r.hitRadius+r.radius,2)}inXRange(e,i){return cc(this,e,"x",i)}inYRange(e,i){return cc(this,e,"y",i)}getCenterPoint(e){const{x:i,y:s}=this.getProps(["x","y"],e);return{x:i,y:s}}size(e){e=e||this.options||{};let i=e.radius||0;i=Math.max(i,i&&e.hoverRadius||0);const s=i&&e.borderWidth||0;return(i+s)*2}draw(e,i){const s=this.options;this.skip||s.radius<.1||!Ne(this,i,this.size(s)/2)||(e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.fillStyle=s.backgroundColor,Ar(e,s,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}O(Cs,"id","point"),O(Cs,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),O(Cs,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function uc(n,t){const{x:e,y:i,base:s,width:r,height:o}=n.getProps(["x","y","base","width","height"],t);let a,l,c,u,d;return n.horizontal?(d=o/2,a=Math.min(e,s),l=Math.max(e,s),c=i-d,u=i+d):(d=r/2,a=e-d,l=e+d,c=Math.min(i,s),u=Math.max(i,s)),{left:a,top:c,right:l,bottom:u}}function rn(n,t,e,i){return n?0:Ht(t,e,i)}function gm(n,t,e){const i=n.options.borderWidth,s=n.borderSkipped,r=el(i);return{t:rn(s.top,r.top,0,e),r:rn(s.right,r.right,0,t),b:rn(s.bottom,r.bottom,0,e),l:rn(s.left,r.left,0,t)}}function pm(n,t,e){const{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=Je(s),o=Math.min(t,e),a=n.borderSkipped,l=i||it(s);return{topLeft:rn(!l||a.top||a.left,r.topLeft,0,o),topRight:rn(!l||a.top||a.right,r.topRight,0,o),bottomLeft:rn(!l||a.bottom||a.left,r.bottomLeft,0,o),bottomRight:rn(!l||a.bottom||a.right,r.bottomRight,0,o)}}function mm(n){const t=uc(n),e=t.right-t.left,i=t.bottom-t.top,s=gm(n,e/2,i/2),r=pm(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function Qr(n,t,e,i){const s=t===null,r=e===null,a=n&&!(s&&r)&&uc(n,i);return a&&(s||Le(t,a.left,a.right))&&(r||Le(e,a.top,a.bottom))}function ym(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function bm(n,t){n.rect(t.x,t.y,t.w,t.h)}function Jr(n,t,e={}){const i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,r=(n.x+n.w!==e.x+e.w?t:0)-i,o=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+o,radius:n.radius}}class Ps extends Yt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:o}=mm(this),a=ym(o.radius)?zn:bm;t.save(),(o.w!==r.w||o.h!==r.h)&&(t.beginPath(),a(t,Jr(o,e,r)),t.clip(),a(t,Jr(r,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,Jr(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return Qr(this,t,e,i)}inXRange(t,e){return Qr(this,t,null,e)}inYRange(t,e){return Qr(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}O(Ps,"id","bar"),O(Ps,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),O(Ps,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var xm=Object.freeze({__proto__:null,ArcElement:Ei,BarElement:Ps,LineElement:sn,PointElement:Cs});const to=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],dc=to.map(n=>n.replace("rgb(","rgba(").replace(")",", 0.5)"));function hc(n){return to[n%to.length]}function fc(n){return dc[n%dc.length]}function _m(n,t){return n.borderColor=hc(t),n.backgroundColor=fc(t),++t}function wm(n,t){return n.backgroundColor=n.data.map(()=>hc(t++)),t}function vm(n,t){return n.backgroundColor=n.data.map(()=>fc(t++)),t}function km(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof nn?t=wm(e,t):s instanceof ki?t=vm(e,t):s&&(t=_m(e,t))}}function gc(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Mm(n){return n&&(n.borderColor||n.backgroundColor)}var Sm={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:r}=s;if(!e.forceOverride&&(gc(i)||Mm(s)||r&&gc(r)))return;const o=km(n);i.forEach(o)}};function Dm(n,t,e,i,s){const r=s.samples||i;if(r>=e)return n.slice(t,t+e);const o=[],a=(e-2)/(r-2);let l=0;const c=t+e-1;let u=t,d,h,g,p,y;for(o[l++]=n[u],d=0;d<r-2;d++){let x=0,w=0,v;const M=Math.floor((d+1)*a)+1+t,P=Math.min(Math.floor((d+2)*a)+1,e)+t,D=P-M;for(v=M;v<P;v++)x+=n[v].x,w+=n[v].y;x/=D,w/=D;const C=Math.floor(d*a)+1+t,T=Math.min(Math.floor((d+1)*a)+1,e)+t,{x:b,y:_}=n[u];for(g=p=-1,v=C;v<T;v++)p=.5*Math.abs((b-x)*(n[v].y-_)-(b-n[v].x)*(w-_)),p>g&&(g=p,h=n[v],y=v);o[l++]=h,u=y}return o[l++]=n[c],o}function Tm(n,t,e,i){let s=0,r=0,o,a,l,c,u,d,h,g,p,y;const x=[],w=t+e-1,v=n[t].x,P=n[w].x-v;for(o=t;o<t+e;++o){a=n[o],l=(a.x-v)/P*i,c=a.y;const D=l|0;if(D===u)c<p?(p=c,d=o):c>y&&(y=c,h=o),s=(r*s+a.x)/++r;else{const C=o-1;if(!tt(d)&&!tt(h)){const T=Math.min(d,h),b=Math.max(d,h);T!==g&&T!==C&&x.push({...n[T],x:s}),b!==g&&b!==C&&x.push({...n[b],x:s})}o>0&&C!==g&&x.push(n[C]),x.push(a),u=D,r=0,p=y=c,d=h=g=o}}return x}function pc(n){if(n._decimated){const t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function mc(n){n.data.datasets.forEach(t=>{pc(t)})}function Cm(n,t){const e=t.length;let i=0,s;const{iScale:r}=n,{min:o,max:a,minDefined:l,maxDefined:c}=r.getUserBounds();return l&&(i=Ht(Ie(t,r.axis,o).lo,0,e-1)),c?s=Ht(Ie(t,r.axis,a).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Pm={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){mc(n);return}const i=n.width;n.data.datasets.forEach((s,r)=>{const{_data:o,indexAxis:a}=s,l=n.getDatasetMeta(r),c=o||s.data;if(xi([a,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=n.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||n.options.parsing)return;let{start:d,count:h}=Cm(l,c);const g=e.threshold||4*i;if(h<=g){pc(s);return}tt(o)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(y){this._data=y}}));let p;switch(e.algorithm){case"lttb":p=Dm(c,d,h,i,e);break;case"min-max":p=Tm(c,d,h,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=p})},destroy(n){mc(n)}};function Om(n,t,e){const i=n.segments,s=n.points,r=t.points,o=[];for(const a of i){let{start:l,end:c}=a;c=no(l,c,s);const u=eo(e,s[l],s[c],a.loop);if(!t.segments){o.push({source:a,target:u,start:s[l],end:s[c]});continue}const d=yl(t,u);for(const h of d){const g=eo(e,r[h.start],r[h.end],h.loop),p=ml(a,s,g);for(const y of p)o.push({source:y,target:h,start:{[e]:yc(u,g,"start",Math.max)},end:{[e]:yc(u,g,"end",Math.min)}})}}return o}function eo(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=ue(s),r=ue(r)),{property:n,start:s,end:r}}function Em(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:o,end:a})=>{a=no(o,a,s);const l=s[o],c=s[a];i!==null?(r.push({x:l.x,y:i}),r.push({x:c.x,y:i})):e!==null&&(r.push({x:e,y:l.y}),r.push({x:e,y:c.y}))}),r}function no(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function yc(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function bc(n,t){let e=[],i=!1;return at(n)?(i=!0,e=n):e=Em(n,t),e.length?new sn({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function xc(n){return n&&n.fill!==!1}function Am(n,t,e){let s=n[t].fill;const r=[t];let o;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!Mt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;r.push(s),s=o.fill}return!1}function Rm(n,t,e){const i=Fm(n);if(it(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Mt(s)&&Math.floor(s)===s?Lm(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Lm(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function Im(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:it(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Nm(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:it(n)?i=n.value:i=t.getBaseValue(),i}function Fm(n){const t=n.options,e=t.fill;let i=Z(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Bm(n){const{scale:t,index:e,line:i}=n,s=[],r=i.segments,o=i.points,a=zm(t,e);a.push(bc({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){const c=r[l];for(let u=c.start;u<=c.end;u++)Hm(s,o[u],a)}return new sn({points:s,options:{}})}function zm(n,t){const e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const r=i[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function Hm(n,t,e){const i=[];for(let s=0;s<e.length;s++){const r=e[s],{first:o,last:a,point:l}=Wm(r,t,"x");if(!(!l||o&&a)){if(o)i.unshift(l);else if(n.push(l),!a)break}}n.push(...i)}function Wm(n,t,e){const i=n.interpolate(t,e);if(!i)return{};const s=i[e],r=n.segments,o=n.points;let a=!1,l=!1;for(let c=0;c<r.length;c++){const u=r[c],d=o[u.start][e],h=o[u.end][e];if(Le(s,d,h)){a=s===d,l=s===h;break}}return{first:a,last:l,point:i}}class _c{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:r,radius:o}=this;return e=e||{start:0,end:yt},t.arc(s,r,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}}function Ym(n){const{chart:t,fill:e,line:i}=n;if(Mt(e))return Vm(t,e);if(e==="stack")return Bm(n);if(e==="shape")return!0;const s=jm(n);return s instanceof _c?s:bc(s,i)}function Vm(n,t){const e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function jm(n){return(n.scale||{}).getPointPositionForValue?qm(n):$m(n)}function $m(n){const{scale:t={},fill:e}=n,i=Im(e,t);if(Mt(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function qm(n){const{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,r=i.reverse?t.max:t.min,o=Nm(e,t,r),a=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,r);return new _c({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(o)})}for(let l=0;l<s;++l)a.push(t.getPointPositionForValue(l,o));return a}function io(n,t,e){const i=Ym(t),{line:s,scale:r,axis:o}=t,a=s.options,l=a.fill,c=a.backgroundColor,{above:u=c,below:d=c}=l||{};i&&s.points.length&&(yi(n,e),Um(n,{line:s,target:i,above:u,below:d,area:e,scale:r,axis:o}),bi(n))}function Um(n,t){const{line:e,target:i,above:s,below:r,area:o,scale:a}=t,l=e._loop?"angle":t.axis;n.save(),l==="x"&&r!==s&&(wc(n,i,o.top),vc(n,{line:e,target:i,color:s,scale:a,property:l}),n.restore(),n.save(),wc(n,i,o.bottom)),vc(n,{line:e,target:i,color:r,scale:a,property:l}),n.restore()}function wc(n,t,e){const{segments:i,points:s}=t;let r=!0,o=!1;n.beginPath();for(const a of i){const{start:l,end:c}=a,u=s[l],d=s[no(l,c,s)];r?(n.moveTo(u.x,u.y),r=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),o=!!t.pathSegment(n,a,{move:o}),o?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function vc(n,t){const{line:e,target:i,property:s,color:r,scale:o}=t,a=Om(e,i,s);for(const{source:l,target:c,start:u,end:d}of a){const{style:{backgroundColor:h=r}={}}=l,g=i!==!0;n.save(),n.fillStyle=h,Xm(n,o,g&&eo(s,u,d)),n.beginPath();const p=!!e.pathSegment(n,l);let y;if(g){p?n.closePath():kc(n,i,d,s);const x=!!i.pathSegment(n,c,{move:p,reverse:!0});y=p&&x,y||kc(n,i,u,s)}n.closePath(),n.fill(y?"evenodd":"nonzero"),n.restore()}}function Xm(n,t,e){const{top:i,bottom:s}=t.chart.chartArea,{property:r,start:o,end:a}=e||{};r==="x"&&(n.beginPath(),n.rect(o,i,a-o,s-i),n.clip())}function kc(n,t,e,i){const s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var Gm={id:"filler",afterDatasetsUpdate(n,t,e){const i=(n.data.datasets||[]).length,s=[];let r,o,a,l;for(o=0;o<i;++o)r=n.getDatasetMeta(o),a=r.dataset,l=null,a&&a.options&&a instanceof sn&&(l={visible:n.isDatasetVisible(o),index:o,fill:Rm(a,o,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=l,s.push(l);for(o=0;o<i;++o)l=s[o],!(!l||l.fill===!1)&&(l.fill=Am(s,o,e.propagate))},beforeDraw(n,t,e){const i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let o=s.length-1;o>=0;--o){const a=s[o].$filler;a&&(a.line.updateControlPoints(r,a.axis),i&&a.fill&&io(n.ctx,a,r))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const r=i[s].$filler;xc(r)&&io(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!xc(i)||e.drawTime!=="beforeDatasetDraw"||io(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Mc=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},Km=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Sc extends Yt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=ut(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=xt(i.font),r=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Mc(i,r);let c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,r,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:r,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let d=t;r.textAlign="left",r.textBaseline="middle";let h=-1,g=-u;return this.legendItems.forEach((p,y)=>{const x=i+e/2+r.measureText(p.text).width;(y===0||c[c.length-1]+x+2*a>o)&&(d+=u,c[c.length-(y>0?0:1)]=0,g+=u,h++),l[y]={left:0,top:g,row:h,width:x,height:s},c[c.length-1]+=x+a}),d}_fitCols(t,e,i,s){const{ctx:r,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-t;let d=a,h=0,g=0,p=0,y=0;return this.legendItems.forEach((x,w)=>{const{itemWidth:v,itemHeight:M}=Zm(i,e,r,x,s);w>0&&g+M+2*a>u&&(d+=h+a,c.push({width:h,height:g}),p+=h+a,y++,h=g=0),l[w]={left:p,top:g,col:y,width:v,height:M},h=Math.max(h,v),g+=M+a}),d+=h,c.push({width:h,height:g}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:r}}=this,o=Yn(r,this.left,this.width);if(this.isHorizontal()){let a=0,l=jt(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=jt(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+s}else{let a=0,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=jt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;yi(t,this),this._draw(),bi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:o}=t,a=Tt.color,l=Yn(t.rtl,this.left,this.width),c=xt(o.font),{padding:u}=o,d=c.size,h=d/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:y,itemHeight:x}=Mc(o,d),w=function(C,T,b){if(isNaN(p)||p<=0||isNaN(y)||y<0)return;s.save();const _=Z(b.lineWidth,1);if(s.fillStyle=Z(b.fillStyle,a),s.lineCap=Z(b.lineCap,"butt"),s.lineDashOffset=Z(b.lineDashOffset,0),s.lineJoin=Z(b.lineJoin,"miter"),s.lineWidth=_,s.strokeStyle=Z(b.strokeStyle,a),s.setLineDash(Z(b.lineDash,[])),o.usePointStyle){const S={radius:y*Math.SQRT2/2,pointStyle:b.pointStyle,rotation:b.rotation,borderWidth:_},E=l.xPlus(C,p/2),R=T+h;tl(s,S,E,R,o.pointStyleWidth&&p)}else{const S=T+Math.max((d-y)/2,0),E=l.leftForLtr(C,p),R=Je(b.borderRadius);s.beginPath(),Object.values(R).some(F=>F!==0)?zn(s,{x:E,y:S,w:p,h:y,radius:R}):s.rect(E,S,p,y),s.fill(),_!==0&&s.stroke()}s.restore()},v=function(C,T,b){_n(s,b.text,C,T+x/2,c,{strikethrough:b.hidden,textAlign:l.textAlign(b.textAlign)})},M=this.isHorizontal(),P=this._computeTitleHeight();M?g={x:jt(r,this.left+u,this.right-i[0]),y:this.top+u+P,line:0}:g={x:this.left+u,y:jt(r,this.top+P+u,this.bottom-e[0].height),line:0},hl(this.ctx,t.textDirection);const D=x+u;this.legendItems.forEach((C,T)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const b=s.measureText(C.text).width,_=l.textAlign(C.textAlign||(C.textAlign=o.textAlign)),S=p+h+b;let E=g.x,R=g.y;l.setWidth(this.width),M?T>0&&E+S+u>this.right&&(R=g.y+=D,g.line++,E=g.x=jt(r,this.left+u,this.right-i[g.line])):T>0&&R+D>this.bottom&&(E=g.x=E+e[g.line].width+u,g.line++,R=g.y=jt(r,this.top+P+u,this.bottom-e[g.line].height));const F=l.x(E);if(w(F,R,C),E=_f(_,E+p+h,M?E+S:this.right,t.rtl),v(l.x(E),R,C),M)g.x+=S+u;else if(typeof C.text!="string"){const $=c.lineHeight;g.y+=Dc(C,$)+u}else g.y+=D}),fl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=xt(e.font),s=Ft(e.padding);if(!e.display)return;const r=Yn(t.rtl,this.left,this.width),o=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let u,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,d=jt(t.align,d,this.right-h);else{const p=this.columnSizes.reduce((y,x)=>Math.max(y,x.height),0);u=c+jt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=jt(a,d,d+h);o.textAlign=r.textAlign(Tr(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,_n(o,e.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,e=xt(t.font),i=Ft(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Le(t,this.left,this.right)&&Le(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],Le(t,s.left,s.left+s.width)&&Le(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!ty(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,r=Km(s,i);s&&!r&&ut(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!r&&ut(e.onHover,[t,i,this],this)}else i&&ut(e.onClick,[t,i,this],this)}}function Zm(n,t,e,i,s){const r=Qm(i,n,t,e),o=Jm(s,i,t.lineHeight);return{itemWidth:r,itemHeight:o}}function Qm(n,t,e,i){let s=n.text;return s&&typeof s!="string"&&(s=s.reduce((r,o)=>r.length>o.length?r:o)),t+e.size/2+i.measureText(s).width}function Jm(n,t,e){let i=n;return typeof t.text!="string"&&(i=Dc(t,e)),i}function Dc(n,t){const e=n.text?n.text.length:0;return t*e}function ty(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var ey={id:"legend",_element:Sc,start(n,t,e){const i=n.legend=new Sc({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i)},stop(n){$t.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;$t.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r,useBorderRadius:o,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),u=Ft(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:r,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};class so extends Yt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=at(i.text)?i.text.length:1;this._padding=Ft(i.padding);const r=s*xt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:r,options:o}=this,a=o.align;let l=0,c,u,d;return this.isHorizontal()?(u=jt(a,i,r),d=e+t,c=r-i):(o.position==="left"?(u=i+t,d=jt(a,s,e),l=rt*-.5):(u=r-t,d=jt(a,e,s),l=rt*.5),c=s-e),{titleX:u,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=xt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(r);_n(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:Tr(e.align),textBaseline:"middle",translation:[o,a]})}}function ny(n,t){const e=new so({ctx:n.ctx,options:t,chart:n});$t.configure(n,e,t),$t.addBox(n,e),n.titleBlock=e}var iy={id:"title",_element:so,start(n,t,e){ny(n,e)},stop(n){const t=n.titleBlock;$t.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){const i=n.titleBlock;$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Os=new WeakMap;var sy={id:"subtitle",start(n,t,e){const i=new so({ctx:n.ctx,options:e,chart:n});$t.configure(n,i,e),$t.addBox(n,i),Os.set(n,i)},stop(n){$t.removeBox(n,Os.get(n)),Os.delete(n)},beforeUpdate(n,t,e){const i=Os.get(n);$t.configure(n,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ai={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,r=0;for(t=0,e=n.length;t<e;++t){const a=n[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++r}}return r===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,o,a;for(r=0,o=n.length;r<o;++r){const l=n[r].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Bn(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function Te(n,t){return t&&(at(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Be(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
17
17
  `)>-1?n.split(`
18
- `):n}function ry(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Tc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=xt(t.bodyFont),c=xt(t.titleFont),u=xt(t.footerFont),d=r.length,h=s.length,g=i.length,p=Ft(t.padding);let y=p.height,x=0,w=i.reduce((P,D)=>P+D.before.length+D.lines.length+D.after.length,0);if(w+=n.beforeBody.length+n.afterBody.length,d&&(y+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),w){const P=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*P+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}h&&(y+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const M=function(P){x=Math.max(x,e.measureText(P).width+v)};return e.save(),e.font=c.string,dt(n.title,M),e.font=l.string,dt(n.beforeBody.concat(n.afterBody),M),v=t.displayColors?o+2+t.boxPadding:0,dt(i,P=>{dt(P.before,M),dt(P.lines,M),dt(P.after,M)}),v=0,e.font=u.string,dt(n.footer,M),e.restore(),x+=p.width,{width:x,height:y}}function oy(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function ay(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function ly(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),ay(c,n,t,e)&&(c="center"),c}function Cc(n,t,e){const i=e.yAlign||t.yAlign||oy(n,e);return{xAlign:e.xAlign||t.xAlign||ly(n,t,e,i),yAlign:i}}function cy(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function uy(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Pc(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:g}=Je(o);let p=cy(t,a);const y=uy(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+s:a==="right"&&(p+=Math.max(d,g)+s),{x:Ht(p,0,i.width-t.width),y:Ht(y,0,i.height-t.height)}}function Es(n,t,e){const i=Ft(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Oc(n){return Te([],Be(n))}function dy(n,t,e){return tn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ec(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Ac={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Re,beforeBody:Re,beforeLabel:Re,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return tt(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Re,afterBody:Re,beforeFooter:Re,footer:Re,afterFooter:Re};function te(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Ac[t].call(e,i):s}class ro extends Yt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new zr(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=dy(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=te(i,"beforeTitle",this,t),r=te(i,"title",this,t),o=te(i,"afterTitle",this,t);let a=[];return a=Te(a,Be(s)),a=Te(a,Be(r)),a=Te(a,Be(o)),a}getBeforeBody(t,e){return Oc(te(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return dt(t,r=>{const o={before:[],lines:[],after:[]},a=Ec(i,r);Te(o.before,Be(te(a,"beforeLabel",this,r))),Te(o.lines,te(a,"label",this,r)),Te(o.after,Be(te(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return Oc(te(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=te(i,"beforeFooter",this,t),r=te(i,"footer",this,t),o=te(i,"afterFooter",this,t);let a=[];return a=Te(a,Be(s)),a=Te(a,Be(r)),a=Te(a,Be(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(ry(this.chart,e[l]));return t.filter&&(a=a.filter((u,d,h)=>t.filter(u,d,h,i))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,i))),dt(a,u=>{const d=Ec(t.callbacks,u);s.push(te(d,"labelColor",this,u)),r.push(te(d,"labelPointStyle",this,u)),o.push(te(d,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=Ai[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Tc(this,i),c=Object.assign({},a,l),u=Cc(this.chart,i,c),d=Pc(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Je(a),{x:h,y:g}=t,{width:p,height:y}=e;let x,w,v,M,P,D;return r==="center"?(P=g+y/2,s==="left"?(x=h,w=x-o,M=P+o,D=P-o):(x=h+p,w=x+o,M=P-o,D=P+o),v=x):(s==="left"?w=h+Math.max(l,u)+o:s==="right"?w=h+p-Math.max(c,d)-o:w=this.caretX,r==="top"?(M=g,P=M-o,x=w-o,v=w+o):(M=g+y,P=M+o,x=w+o,v=w-o),D=M),{x1:x,x2:w,x3:v,y1:M,y2:P,y3:D}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Yn(i.rtl,this.x,this.width);for(t.x=Es(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=xt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,l+1===r&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,r){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=r,u=xt(r.bodyFont),d=Es(this,"left",r),h=s.x(d),g=l<u.lineHeight?(u.lineHeight-l)/2:0,p=e.y+g;if(r.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=s.leftForLtr(h,c)+c/2,w=p+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Ar(t,y,x,w),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,Ar(t,y,x,w)}else{t.lineWidth=it(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const y=s.leftForLtr(h,c),x=s.leftForLtr(s.xPlus(h,1),c-2),w=Je(o.borderRadius);Object.values(w).some(v=>v!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,zn(t,{x:y,y:p,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),zn(t,{x,y:p+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,d=xt(i.bodyFont);let h=d.lineHeight,g=0;const p=Yn(i.rtl,this.x,this.width),y=function(b){e.fillText(b,p.x(t.x+g),t.y+h/2),t.y+=h+r},x=p.textAlign(o);let w,v,M,P,D,C,T;for(e.textAlign=o,e.textBaseline="middle",e.font=d.string,t.x=Es(this,x,i),e.fillStyle=i.bodyColor,dt(this.beforeBody,y),g=a&&x!=="right"?o==="center"?c/2+u:c+2+u:0,P=0,C=s.length;P<C;++P){for(w=s[P],v=this.labelTextColors[P],e.fillStyle=v,dt(w.before,y),M=w.lines,a&&M.length&&(this._drawColorBox(e,t,P,p,i),h=Math.max(d.lineHeight,l)),D=0,T=M.length;D<T;++D)y(M[D]),h=d.lineHeight;dt(w.after,y)}g=0,h=d.lineHeight,dt(this.afterBody,y),t.y-=r}drawFooter(t,e,i){const s=this.footer,r=s.length;let o,a;if(r){const l=Yn(i.rtl,this.x,this.width);for(t.x=Es(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",o=xt(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<r;++a)e.fillText(s[a],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:r,yAlign:o}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:h,bottomLeft:g,bottomRight:p}=Je(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+d,l),o==="top"&&this.drawCaret(t,e,i,s),e.lineTo(a+c-h,l),e.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(a+c,l+u-p),e.quadraticCurveTo(a+c,l+u,a+c-p,l+u),o==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(a+g,l+u),e.quadraticCurveTo(a,l+u,a,l+u-g),o==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(a,l+d),e.quadraticCurveTo(a,l,a+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=Ai[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Tc(this,t),l=Object.assign({},o,this._size),c=Cc(e,t,l),u=Pc(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Ft(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),hl(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),fl(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!ss(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!ss(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=Ai[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}}O(ro,"positioners",Ai);var As={id:"tooltip",_element:ro,positioners:Ai,afterInit(n,t,e){e&&(n.tooltip=new ro({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ac},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},hy=Object.freeze({__proto__:null,Colors:Sm,Decimation:Pm,Filler:Gm,Legend:ey,SubTitle:sy,Title:iy,Tooltip:As});const fy=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function gy(n,t,e,i){const s=n.indexOf(t);if(s===-1)return fy(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const py=(n,t)=>n===null?null:Ht(Math.round(n),0,t);function Rc(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class oo extends Mn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(tt(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:gy(i,t,Z(e,t),this._addedLabels),py(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){return Rc.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}O(oo,"id","category"),O(oo,"defaults",{ticks:{callback:Rc}});function my(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=n,g=r||1,p=u-1,{min:y,max:x}=t,w=!tt(o),v=!tt(a),M=!tt(c),P=(x-y)/(d+1);let D=Fa((x-y)/p/g)*g,C,T,b,_;if(D<1e-14&&!w&&!v)return[{value:y},{value:x}];_=Math.ceil(x/D)-Math.floor(y/D),_>p&&(D=Fa(_*D/p/g)*g),tt(l)||(C=Math.pow(10,l),D=Math.ceil(D*C)/C),s==="ticks"?(T=Math.floor(y/D)*D,b=Math.ceil(x/D)*D):(T=y,b=x),w&&v&&r&&ff((a-o)/r,D/1e3)?(_=Math.round(Math.min((a-o)/D,u)),D=(a-o)/_,T=o,b=a):M?(T=w?o:T,b=v?a:b,_=c-1,D=(b-T)/_):(_=(b-T)/D,hi(_,Math.round(_),D/1e3)?_=Math.round(_):_=Math.ceil(_));const S=Math.max(za(D),za(T));C=Math.pow(10,tt(l)?S:l),T=Math.round(T*C)/C,b=Math.round(b*C)/C;let E=0;for(w&&(h&&T!==o?(e.push({value:o}),T<o&&E++,hi(Math.round((T+E*D)*C)/C,o,Lc(o,P,n))&&E++):T<o&&E++);E<_;++E){const R=Math.round((T+E*D)*C)/C;if(v&&R>a)break;e.push({value:R})}return v&&h&&b!==a?e.length&&hi(e[e.length-1].value,a,Lc(a,P,n))?e[e.length-1].value=a:e.push({value:a}):(!v||b===a)&&e.push({value:b}),e}function Lc(n,t,{horizontal:e,minRotation:i}){const s=Nt(i),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+n).length;return Math.min(t/r,o)}class Rs extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return tt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=e?s:l,a=l=>r=i?r:l;if(t){const l=Se(s),c=Se(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=my(s,r);return t.bounds==="ticks"&&Ba(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return pi(t,this.chart.options.locale,this.options.ticks.format)}}class ao extends Rs{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Mt(t)?t:0,this.max=Mt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Nt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}O(ao,"id","linear"),O(ao,"defaults",{ticks:{callback:us.formatters.numeric}});const Ri=n=>Math.floor(Ze(n)),Sn=(n,t)=>Math.pow(10,Ri(n)+t);function Ic(n){return n/Math.pow(10,Ri(n))===1}function Nc(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function yy(n,t){const e=t-n;let i=Ri(e);for(;Nc(n,t,i)>10;)i++;for(;Nc(n,t,i)<10;)i--;return Math.min(i,Ri(n))}function by(n,{min:t,max:e}){t=ce(n.min,t);const i=[],s=Ri(t);let r=yy(t,e),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,r)),h=ce(n.min,Math.round((l+u+d*Math.pow(10,r))*o)/o);for(;h<e;)i.push({value:h,major:Ic(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(r++,d=2,o=r>=0?1:o),h=Math.round((l+u+d*Math.pow(10,r))*o)/o;const g=ce(n.max,h);return i.push({value:g,major:Ic(g),significand:d}),i}class lo extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Rs.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return Mt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Mt(t)?Math.max(0,t):null,this.max=Mt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Mt(this._userMin)&&(this.min=t===Sn(this.min,0)?Sn(this.min,-1):Sn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=a=>i=t?i:a,o=a=>s=e?s:a;i===s&&(i<=0?(r(1),o(10)):(r(Sn(i,-1)),o(Sn(s,1)))),i<=0&&r(Sn(s,-1)),s<=0&&o(Sn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=by(e,this);return t.bounds==="ticks"&&Ba(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":pi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ze(t),this._valueRange=Ze(this.max)-Ze(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ze(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}O(lo,"id","logarithmic"),O(lo,"defaults",{ticks:{callback:us.formatters.logarithmic,major:{enabled:!0}}});function co(n){const t=n.ticks;if(t.display&&n.display){const e=Ft(t.backdropPadding);return Z(t.font&&t.font.size,Tt.font.size)+e.height}return 0}function xy(n,t,e){return e=at(e)?e:[e],{w:Of(n,t.string,e),h:e.length*t.lineHeight}}function Fc(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function _y(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?rt/r:0;for(let l=0;l<r;l++){const c=o.setContext(n.getPointLabelContext(l));s[l]=c.padding;const u=n.getPointPosition(l,n.drawingArea+s[l],a),d=xt(c.font),h=xy(n.ctx,d,n._pointLabels[l]);i[l]=h;const g=ue(n.getIndexAngle(l)+a),p=Math.round(ls(g)),y=Fc(p,u.x,h.w,0,180),x=Fc(p,u.y,h.h,90,270);wy(e,t,g,y,x)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=My(n,i,s)}function wy(n,t,e,i,s){const r=Math.abs(Math.sin(e)),o=Math.abs(Math.cos(e));let a=0,l=0;i.start<t.l?(a=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/o,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function vy(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=n.getPointPosition(t,i+s+o,r),c=Math.round(ls(ue(l.angle+bt))),u=Ty(l.y,a.h,c),d=Sy(c),h=Dy(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+a.w,bottom:u+a.h}}function ky(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Ne({x:e,y:i},t)||Ne({x:e,y:r},t)||Ne({x:s,y:i},t)||Ne({x:s,y:r},t))}function My(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:co(r)/2,additionalAngle:o?rt/s:0};let c;for(let u=0;u<s;u++){l.padding=e[u],l.size=t[u];const d=vy(n,u,l);i.push(d),a==="auto"&&(d.visible=ky(d,c),d.visible&&(c=d))}return i}function Sy(n){return n===0||n===180?"center":n<180?"left":"right"}function Dy(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function Ty(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Cy(n,t,e){const{left:i,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!tt(a)){const l=Je(t.borderRadius),c=Ft(t.backdropPadding);n.fillStyle=a;const u=i-c.left,d=s-c.top,h=r-i+c.width,g=o-s+c.height;Object.values(l).some(p=>p!==0)?(n.beginPath(),zn(n,{x:u,y:d,w:h,h:g,radius:l}),n.fill()):n.fillRect(u,d,h,g)}}function Py(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const o=i.setContext(n.getPointLabelContext(s));Cy(e,o,r);const a=xt(o.font),{x:l,y:c,textAlign:u}=r;_n(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function Bc(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,yt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o<i;o++)r=n.getPointPosition(o,t),s.lineTo(r.x,r.y)}}function Oy(n,t,e,i,s){const r=n.ctx,o=t.circular,{color:a,lineWidth:l}=t;!o&&!i||!a||!l||e<0||(r.save(),r.strokeStyle=a,r.lineWidth=l,r.setLineDash(s.dash),r.lineDashOffset=s.dashOffset,r.beginPath(),Bc(n,e,o,i),r.closePath(),r.stroke(),r.restore())}function Ey(n,t,e){return tn(n,{label:e,index:t,type:"pointLabel"})}class Li extends Rs{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ft(co(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Mt(t)&&!isNaN(t)?t:0,this.max=Mt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/co(this.options))}generateTickLabels(t){Rs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ut(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?_y(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=yt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ue(t*e+Nt(i))}getDistanceFromCenterForValue(t){if(tt(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(tt(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Ey(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-bt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Bc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:r}=e,o=this._pointLabels.length;let a,l,c;if(e.pointLabels.display&&Py(this,o),s.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),g=s.setContext(h),p=r.setContext(h);Oy(this,g,l,o,p)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=xt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=Ft(c.backdropPadding);t.fillRect(-o/2-d.left,-r-u.size/2-d.top,o+d.width,u.size+d.height)}_n(t,a.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}O(Li,"id","radialLinear"),O(Li,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:us.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),O(Li,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),O(Li,"descriptors",{angleLines:{_fallback:"grid"}});const Ls={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}},ee=Object.keys(Ls);function zc(n,t){return n-t}function Hc(n,t){if(tt(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Mt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Qe(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Wc(n,t,e,i){const s=ee.length;for(let r=ee.indexOf(n);r<s-1;++r){const o=Ls[ee[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((e-t)/(a*o.size))<=i)return ee[r]}return ee[s-1]}function Ay(n,t,e,i,s){for(let r=ee.length-1;r>=ee.indexOf(e);r--){const o=ee[r];if(Ls[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return ee[e?ee.indexOf(e):0]}function Ry(n){for(let t=ee.indexOf(n)+1,e=ee.length;t<e;++t)if(Ls[ee[t]].common)return ee[t]}function Yc(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=Dr(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function Ly(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Vc(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o<r;++o)a=t[o],s[a]=o,i.push({value:a,major:!1});return r===0||!e?i:Ly(n,i,s,e)}class Ii extends Mn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Al._date(t.adapters.date);s.init(e),di(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Hc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Mt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=Mt(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const r=this.min,o=this.max,a=yf(s,r,o);return this._unit=e.unit||(i.autoSkip?Wc(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Ay(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ry(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Vc(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Ht(e,0,o),i=Ht(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Wc(r.minUnit,e,i,this._getLabelCapacity(e)),a=Z(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Qe(l)||l===!0,u={};let d=e,h,g;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(h=d,g=0;h<i;h=+t.add(h,a,o),g++)Yc(u,h,p);return(h===i||s.bounds==="ticks"||g===1)&&Yc(u,h,p),Object.keys(u).sort(zc).map(y=>+y)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.ticks.callback;if(o)return ut(o,[t,e,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],h=i[e],g=c&&d&&h&&h.major;return this._adapter.format(t,s||(g?d:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Nt(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*r+a*o,h:i*o+a*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,Vc(this,[t],this._majorUnit),s),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Hc(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Va(t.sort(zc))}}O(Ii,"id","time"),O(Ii,"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 Is(n,t,e){let i=0,s=n.length-1,r,o,a,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ie(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ie(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class uo extends Ii{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Is(e,this.min),this._tableRange=Is(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,u;for(o=0,a=t.length;o<a;++o)c=t[o],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)u=s[o+1],l=s[o-1],c=s[o],Math.round((u+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,r)=>s-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Is(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Is(this._table,i*this._tableRange+this._minPos,!0)}}O(uo,"id","timeseries"),O(uo,"defaults",Ii.defaults);var Iy=Object.freeze({__proto__:null,CategoryScale:oo,LinearScale:ao,LogarithmicScale:lo,RadialLinearScale:Li,TimeScale:Ii,TimeSeriesScale:uo});const Ny=[$g,xm,hy,Iy],Fy=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],By=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],zy=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Hy=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],jc=(n,t,e)=>{let i=n;return typeof t=="string"||Array.isArray(t)?i=n.toLocaleString(t,e):(t===!0||e!==void 0)&&(i=n.toLocaleString(void 0,e)),i};function ho(n,t){if(!Number.isFinite(n))throw new TypeError(`Expected a finite number, got ${typeof n}: ${n}`);t={bits:!1,binary:!1,space:!0,...t};const e=t.bits?t.binary?Hy:zy:t.binary?By:Fy,i=t.space?" ":"";if(t.signed&&n===0)return` 0${i}${e[0]}`;const s=n<0,r=s?"-":t.signed?"+":"";s&&(n=-n);let o;if(t.minimumFractionDigits!==void 0&&(o={minimumFractionDigits:t.minimumFractionDigits}),t.maximumFractionDigits!==void 0&&(o={maximumFractionDigits:t.maximumFractionDigits,...o}),n<1){const u=jc(n,t.locale,o);return r+u+i+e[0]}const a=Math.min(Math.floor(t.binary?Math.log(n)/Math.log(1024):Math.log10(n)/3),e.length-1);n/=(t.binary?1024:1e3)**a,o||(n=n.toPrecision(3));const l=jc(Number(n),t.locale,o),c=e[a];return r+l+i+c}function G(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function _t(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function Ns(n,t){const e=G(n);return isNaN(t)?_t(n,NaN):(t&&e.setDate(e.getDate()+t),e)}function fo(n,t){const e=G(n);if(isNaN(t))return _t(n,NaN);if(!t)return e;const i=e.getDate(),s=_t(n,e.getTime());s.setMonth(e.getMonth()+t+1,0);const r=s.getDate();return i>=r?s:(e.setFullYear(s.getFullYear(),s.getMonth(),i),e)}function Fs(n,t){const e=+G(n);return _t(n,e+t)}const $c=6048e5,Wy=864e5,Ni=6e4,jn=36e5,Yy=1e3;function Vy(n,t){return Fs(n,t*jn)}let jy={};function Dn(){return jy}function Ce(n,t){var a,l,c,u;const e=Dn(),i=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,s=G(n),r=s.getDay(),o=(r<i?7:0)+r-i;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function $n(n){return Ce(n,{weekStartsOn:1})}function qc(n){const t=G(n),e=t.getFullYear(),i=_t(n,0);i.setFullYear(e+1,0,4),i.setHours(0,0,0,0);const s=$n(i),r=_t(n,0);r.setFullYear(e,0,4),r.setHours(0,0,0,0);const o=$n(r);return t.getTime()>=s.getTime()?e+1:t.getTime()>=o.getTime()?e:e-1}function go(n){const t=G(n);return t.setHours(0,0,0,0),t}function Bs(n){const t=G(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function Uc(n,t){const e=go(n),i=go(t),s=+e-Bs(e),r=+i-Bs(i);return Math.round((s-r)/Wy)}function $y(n){const t=qc(n),e=_t(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),$n(e)}function qy(n,t){return Fs(n,t*Ni)}function Uy(n,t){const e=t*3;return fo(n,e)}function Xy(n,t){return Fs(n,t*1e3)}function Gy(n,t){const e=t*7;return Ns(n,e)}function Ky(n,t){return fo(n,t*12)}function Fi(n,t){const e=G(n),i=G(t),s=e.getTime()-i.getTime();return s<0?-1:s>0?1:s}function Zy(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function po(n){if(!Zy(n)&&typeof n!="number")return!1;const t=G(n);return!isNaN(Number(t))}function Qy(n,t){const e=G(n),i=G(t),s=e.getFullYear()-i.getFullYear(),r=e.getMonth()-i.getMonth();return s*12+r}function Jy(n,t){const e=G(n),i=G(t);return e.getFullYear()-i.getFullYear()}function Xc(n,t){const e=G(n),i=G(t),s=Gc(e,i),r=Math.abs(Uc(e,i));e.setDate(e.getDate()-s*r);const o=+(Gc(e,i)===-s),a=s*(r-o);return a===0?0:a}function Gc(n,t){const e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Bi(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function zs(n,t){return+G(n)-+G(t)}function tb(n,t,e){const i=zs(n,t)/jn;return Bi(e==null?void 0:e.roundingMethod)(i)}function eb(n,t,e){const i=zs(n,t)/Ni;return Bi(e==null?void 0:e.roundingMethod)(i)}function Kc(n){const t=G(n);return t.setHours(23,59,59,999),t}function Zc(n){const t=G(n),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(23,59,59,999),t}function nb(n){const t=G(n);return+Kc(t)==+Zc(t)}function Qc(n,t){const e=G(n),i=G(t),s=Fi(e,i),r=Math.abs(Qy(e,i));let o;if(r<1)o=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*r);let a=Fi(e,i)===-s;nb(G(n))&&r===1&&Fi(n,i)===1&&(a=!1),o=s*(r-Number(a))}return o===0?0:o}function ib(n,t,e){const i=Qc(n,t)/3;return Bi(e==null?void 0:e.roundingMethod)(i)}function sb(n,t,e){const i=zs(n,t)/1e3;return Bi(e==null?void 0:e.roundingMethod)(i)}function rb(n,t,e){const i=Xc(n,t)/7;return Bi(e==null?void 0:e.roundingMethod)(i)}function ob(n,t){const e=G(n),i=G(t),s=Fi(e,i),r=Math.abs(Jy(e,i));e.setFullYear(1584),i.setFullYear(1584);const o=Fi(e,i)===-s,a=s*(r-+o);return a===0?0:a}function ab(n){const t=G(n);return t.setSeconds(0,0),t}function lb(n){const t=G(n),e=t.getMonth(),i=e-e%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}function cb(n){const t=G(n);return t.setDate(1),t.setHours(0,0,0,0),t}function ub(n){const t=G(n),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function Jc(n){const t=G(n),e=_t(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}function db(n){const t=G(n);return t.setMinutes(59,59,999),t}function hb(n,t){var a,l;const e=Dn(),i=e.weekStartsOn??((l=(a=e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??0,s=G(n),r=s.getDay(),o=(r<i?-7:0)+6-(r-i);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function fb(n){const t=G(n);return t.setSeconds(59,999),t}function gb(n){const t=G(n),e=t.getMonth(),i=e-e%3+3;return t.setMonth(i,0),t.setHours(23,59,59,999),t}function pb(n){const t=G(n);return t.setMilliseconds(999),t}const mb={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},yb=(n,t,e)=>{let i;const s=mb[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function mo(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const bb={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xb={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_b={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wb={date:mo({formats:bb,defaultWidth:"full"}),time:mo({formats:xb,defaultWidth:"full"}),dateTime:mo({formats:_b,defaultWidth:"full"})},vb={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kb=(n,t,e,i)=>vb[n];function zi(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=e!=null&&e.width?String(e.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const Mb={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Sb={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Db={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Tb={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Cb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Pb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ob={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:zi({values:Mb,defaultWidth:"wide"}),quarter:zi({values:Sb,defaultWidth:"wide",argumentCallback:n=>n-1}),month:zi({values:Db,defaultWidth:"wide"}),day:zi({values:Tb,defaultWidth:"wide"}),dayPeriod:zi({values:Cb,defaultWidth:"wide",formattingValues:Pb,defaultFormattingWidth:"wide"})};function Hi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Ab(a,d=>d.test(o)):Eb(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function Eb(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Ab(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Rb(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const Lb=/^(\d+)(th|st|nd|rd)?/i,Ib=/\d+/i,Nb={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Fb={any:[/^b/i,/^(a|c)/i]},Bb={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zb={any:[/1/i,/2/i,/3/i,/4/i]},Hb={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Wb={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Yb={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Vb={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},jb={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},$b={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qb={ordinalNumber:Rb({matchPattern:Lb,parsePattern:Ib,valueCallback:n=>parseInt(n,10)}),era:Hi({matchPatterns:Nb,defaultMatchWidth:"wide",parsePatterns:Fb,defaultParseWidth:"any"}),quarter:Hi({matchPatterns:Bb,defaultMatchWidth:"wide",parsePatterns:zb,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Hi({matchPatterns:Hb,defaultMatchWidth:"wide",parsePatterns:Wb,defaultParseWidth:"any"}),day:Hi({matchPatterns:Yb,defaultMatchWidth:"wide",parsePatterns:Vb,defaultParseWidth:"any"}),dayPeriod:Hi({matchPatterns:jb,defaultMatchWidth:"any",parsePatterns:$b,defaultParseWidth:"any"})},tu={code:"en-US",formatDistance:yb,formatLong:wb,formatRelative:kb,localize:Ob,match:qb,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ub(n){const t=G(n);return Uc(t,Jc(t))+1}function eu(n){const t=G(n),e=+$n(t)-+$y(t);return Math.round(e/$c)+1}function yo(n,t){var u,d,h,g;const e=G(n),i=e.getFullYear(),s=Dn(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(h=s.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,o=_t(n,0);o.setFullYear(i+1,0,r),o.setHours(0,0,0,0);const a=Ce(o,t),l=_t(n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=Ce(l,t);return e.getTime()>=a.getTime()?i+1:e.getTime()>=c.getTime()?i:i-1}function Xb(n,t){var a,l,c,u;const e=Dn(),i=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,s=yo(n,t),r=_t(n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),Ce(r,t)}function nu(n,t){const e=G(n),i=+Ce(e,t)-+Xb(e,t);return Math.round(i/$c)+1}function ht(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const on={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ht(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ht(e+1,2)},d(n,t){return ht(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ht(n.getHours()%12||12,t.length)},H(n,t){return ht(n.getHours(),t.length)},m(n,t){return ht(n.getMinutes(),t.length)},s(n,t){return ht(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ht(s,t.length)}},qn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return on.y(n,t)},Y:function(n,t,e,i){const s=yo(n,i),r=s>0?s:1-s;if(t==="YY"){const o=r%100;return ht(o,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ht(r,t.length)},R:function(n,t){const e=qc(n);return ht(e,t.length)},u:function(n,t){const e=n.getFullYear();return ht(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return on.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=nu(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(n,t,e){const i=eu(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):on.d(n,t)},D:function(n,t,e){const i=Ub(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ht(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ht(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=qn.noon:i===0?s=qn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=qn.evening:i>=12?s=qn.afternoon:i>=4?s=qn.morning:s=qn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return on.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):on.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):on.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):on.s(n,t)},S:function(n,t){return on.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return ru(i);case"XXXX":case"XX":return Tn(i);case"XXXXX":case"XXX":default:return Tn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return ru(i);case"xxxx":case"xx":return Tn(i);case"xxxxx":case"xxx":default:return Tn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+su(i,":");case"OOOO":default:return"GMT"+Tn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+su(i,":");case"zzzz":default:return"GMT"+Tn(i,":")}},t:function(n,t,e){const i=Math.trunc(n.getTime()/1e3);return ht(i,t.length)},T:function(n,t,e){const i=n.getTime();return ht(i,t.length)}};function su(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ht(r,2)}function ru(n,t){return n%60===0?(n>0?"-":"+")+ht(Math.abs(n)/60,2):Tn(n,t)}function Tn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ht(Math.trunc(i/60),2),r=ht(i%60,2);return e+s+t+r}const ou=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},au=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},bo={p:au,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return ou(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",ou(i,t)).replace("{{time}}",au(s,t))}},Gb=/^D+$/,Kb=/^Y+$/,Zb=["D","DD","YY","YYYY"];function lu(n){return Gb.test(n)}function cu(n){return Kb.test(n)}function xo(n,t,e){const i=Qb(n,t,e);if(console.warn(i),Zb.includes(n))throw new RangeError(i)}function Qb(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Jb=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,t0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,e0=/^'([^]*?)'?$/,n0=/''/g,i0=/[a-zA-Z]/;function uu(n,t,e){var u,d,h,g,p,y,x,w;const i=Dn(),s=(e==null?void 0:e.locale)??i.locale??tu,r=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((g=(h=i.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,o=(e==null?void 0:e.weekStartsOn)??((y=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((w=(x=i.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=G(n);if(!po(a))throw new RangeError("Invalid time value");let l=t.match(t0).map(v=>{const M=v[0];if(M==="p"||M==="P"){const P=bo[M];return P(v,s.formatLong)}return v}).join("").match(Jb).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:s0(v)};if(iu[M])return{isToken:!0,value:v};if(M.match(i0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:s};return l.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&cu(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&lu(M))&&xo(M,t,String(n));const P=iu[M[0]];return P(a,M,s.localize,c)}).join("")}function s0(n){const t=n.match(e0);return t?t[1].replace(n0,"'"):n}function r0(){return Object.assign({},Dn())}function o0(n){let e=G(n).getDay();return e===0&&(e=7),e}function a0(n,t){const e=t instanceof Date?_t(t,0):new t(0);return e.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),e.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e}const l0=10;class du{constructor(){O(this,"subPriority",0)}validate(t,e){return!0}}class c0 extends du{constructor(t,e,i,s,r){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=s,r&&(this.subPriority=r)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class u0 extends du{constructor(){super(...arguments);O(this,"priority",l0);O(this,"subPriority",-1)}set(e,i){return i.timestampIsSet?e:_t(e,a0(e,Date))}}class lt{run(t,e,i,s){const r=this.parse(t,e,i,s);return r?{setter:new c0(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(t,e,i){return!0}}class d0 extends lt{constructor(){super(...arguments);O(this,"priority",140);O(this,"incompatibleTokens",["R","u","t","T"])}parse(e,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"});case"GGGGG":return s.era(e,{width:"narrow"});case"GGGG":default:return s.era(e,{width:"wide"})||s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"})}}set(e,i,s){return i.era=s,e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}const Lt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pe={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function It(n,t){return n&&{value:t(n.value),rest:n.rest}}function Ct(n,t){const e=t.match(n);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function Oe(n,t){const e=t.match(n);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const i=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,o=e[5]?parseInt(e[5],10):0;return{value:i*(s*jn+r*Ni+o*Yy),rest:t.slice(e[0].length)}}function hu(n){return Ct(Lt.anyDigitsSigned,n)}function Et(n,t){switch(n){case 1:return Ct(Lt.singleDigit,t);case 2:return Ct(Lt.twoDigits,t);case 3:return Ct(Lt.threeDigits,t);case 4:return Ct(Lt.fourDigits,t);default:return Ct(new RegExp("^\\d{1,"+n+"}"),t)}}function Hs(n,t){switch(n){case 1:return Ct(Lt.singleDigitSigned,t);case 2:return Ct(Lt.twoDigitsSigned,t);case 3:return Ct(Lt.threeDigitsSigned,t);case 4:return Ct(Lt.fourDigitsSigned,t);default:return Ct(new RegExp("^-?\\d{1,"+n+"}"),t)}}function _o(n){switch(n){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function fu(n,t){const e=t>0,i=e?t:1-t;let s;if(i<=50)s=n||100;else{const r=i+50,o=Math.trunc(r/100)*100,a=n>=r%100;s=n+o-(a?100:0)}return e?s:1-s}function gu(n){return n%400===0||n%4===0&&n%100!==0}class h0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,i,s){const r=o=>({year:o,isTwoDigitYear:i==="yy"});switch(i){case"y":return It(Et(4,e),r);case"yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s){const r=e.getFullYear();if(s.isTwoDigitYear){const a=fu(s.year,r);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}const o=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}}class f0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,i,s){const r=o=>({year:o,isTwoDigitYear:i==="YY"});switch(i){case"Y":return It(Et(4,e),r);case"Yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s,r){const o=yo(e,r);if(s.isTwoDigitYear){const l=fu(s.year,o);return e.setFullYear(l,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}const a=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}}class g0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,i){return Hs(i==="R"?4:i.length,e)}set(e,i,s){const r=_t(e,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),$n(r)}}class p0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,i){return Hs(i==="u"?4:i.length,e)}set(e,i,s){return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class m0 extends lt{constructor(){super(...arguments);O(this,"priority",120);O(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"Q":case"QQ":return Et(i.length,e);case"Qo":return s.ordinalNumber(e,{unit:"quarter"});case"QQQ":return s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(e,{width:"wide",context:"formatting"})||s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class y0 extends lt{constructor(){super(...arguments);O(this,"priority",120);O(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"q":case"qq":return Et(i.length,e);case"qo":return s.ordinalNumber(e,{unit:"quarter"});case"qqq":return s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(e,{width:"wide",context:"standalone"})||s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class b0 extends lt{constructor(){super(...arguments);O(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);O(this,"priority",110)}parse(e,i,s){const r=o=>o-1;switch(i){case"M":return It(Ct(Lt.month,e),r);case"MM":return It(Et(2,e),r);case"Mo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"MMM":return s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(e,{width:"wide",context:"formatting"})||s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}class x0 extends lt{constructor(){super(...arguments);O(this,"priority",110);O(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,i,s){const r=o=>o-1;switch(i){case"L":return It(Ct(Lt.month,e),r);case"LL":return It(Et(2,e),r);case"Lo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"LLL":return s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(e,{width:"wide",context:"standalone"})||s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}function _0(n,t,e){const i=G(n),s=nu(i,e)-t;return i.setDate(i.getDate()-s*7),i}class w0 extends lt{constructor(){super(...arguments);O(this,"priority",100);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,i,s){switch(i){case"w":return Ct(Lt.week,e);case"wo":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s,r){return Ce(_0(e,s,r),r)}}function v0(n,t){const e=G(n),i=eu(e)-t;return e.setDate(e.getDate()-i*7),e}class k0 extends lt{constructor(){super(...arguments);O(this,"priority",100);O(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,i,s){switch(i){case"I":return Ct(Lt.week,e);case"Io":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s){return $n(v0(e,s))}}const M0=[31,28,31,30,31,30,31,31,30,31,30,31],S0=[31,29,31,30,31,30,31,31,30,31,30,31];class D0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"subPriority",1);O(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"d":return Ct(Lt.date,e);case"do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear(),r=gu(s),o=e.getMonth();return r?i>=1&&i<=S0[o]:i>=1&&i<=M0[o]}set(e,i,s){return e.setDate(s),e.setHours(0,0,0,0),e}}class T0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"subpriority",1);O(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,i,s){switch(i){case"D":case"DD":return Ct(Lt.dayOfYear,e);case"Do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear();return gu(s)?i>=1&&i<=366:i>=1&&i<=365}set(e,i,s){return e.setMonth(0,s),e.setHours(0,0,0,0),e}}function wo(n,t,e){var d,h,g,p;const i=Dn(),s=(e==null?void 0:e.weekStartsOn)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??i.weekStartsOn??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.weekStartsOn)??0,r=G(n),o=r.getDay(),l=(t%7+7)%7,c=7-s,u=t<0||t>6?t-(o+c)%7:(l+c)%7-(o+c)%7;return Ns(r,u)}class C0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}class P0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,i,s,r){const o=a=>{const l=Math.floor((a-1)/7)*7;return(a+r.weekStartsOn+6)%7+l};switch(i){case"e":case"ee":return It(Et(i.length,e),o);case"eo":return It(s.ordinalNumber(e,{unit:"day"}),o);case"eee":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeeee":return s.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}class O0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,i,s,r){const o=a=>{const l=Math.floor((a-1)/7)*7;return(a+r.weekStartsOn+6)%7+l};switch(i){case"c":case"cc":return It(Et(i.length,e),o);case"co":return It(s.ordinalNumber(e,{unit:"day"}),o);case"ccc":return s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"ccccc":return s.day(e,{width:"narrow",context:"standalone"});case"cccccc":return s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(e,{width:"wide",context:"standalone"})||s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}function E0(n,t){const e=G(n),i=o0(e),s=t-i;return Ns(e,s)}class A0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,i,s){const r=o=>o===0?7:o;switch(i){case"i":case"ii":return Et(i.length,e);case"io":return s.ordinalNumber(e,{unit:"day"});case"iii":return It(s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return It(s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return It(s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiii":default:return It(s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,i){return i>=1&&i<=7}set(e,i,s){return e=E0(e,s),e.setHours(0,0,0,0),e}}class R0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class L0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class I0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["a","b","t","T"])}parse(e,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class N0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,i,s){switch(i){case"h":return Ct(Lt.hour12h,e);case"ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=12}set(e,i,s){const r=e.getHours()>=12;return r&&s<12?e.setHours(s+12,0,0,0):!r&&s===12?e.setHours(0,0,0,0):e.setHours(s,0,0,0),e}}class F0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,i,s){switch(i){case"H":return Ct(Lt.hour23h,e);case"Ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=23}set(e,i,s){return e.setHours(s,0,0,0),e}}class B0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,i,s){switch(i){case"K":return Ct(Lt.hour11h,e);case"Ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.getHours()>=12&&s<12?e.setHours(s+12,0,0,0):e.setHours(s,0,0,0),e}}class z0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,i,s){switch(i){case"k":return Ct(Lt.hour24h,e);case"ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=24}set(e,i,s){const r=s<=24?s%24:s;return e.setHours(r,0,0,0),e}}class H0 extends lt{constructor(){super(...arguments);O(this,"priority",60);O(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"m":return Ct(Lt.minute,e);case"mo":return s.ordinalNumber(e,{unit:"minute"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setMinutes(s,0,0),e}}class W0 extends lt{constructor(){super(...arguments);O(this,"priority",50);O(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"s":return Ct(Lt.second,e);case"so":return s.ordinalNumber(e,{unit:"second"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setSeconds(s,0),e}}class Y0 extends lt{constructor(){super(...arguments);O(this,"priority",30);O(this,"incompatibleTokens",["t","T"])}parse(e,i){const s=r=>Math.trunc(r*Math.pow(10,-i.length+3));return It(Et(i.length,e),s)}set(e,i,s){return e.setMilliseconds(s),e}}class V0 extends lt{constructor(){super(...arguments);O(this,"priority",10);O(this,"incompatibleTokens",["t","T","x"])}parse(e,i){switch(i){case"X":return Oe(Pe.basicOptionalMinutes,e);case"XX":return Oe(Pe.basic,e);case"XXXX":return Oe(Pe.basicOptionalSeconds,e);case"XXXXX":return Oe(Pe.extendedOptionalSeconds,e);case"XXX":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:_t(e,e.getTime()-Bs(e)-s)}}class j0 extends lt{constructor(){super(...arguments);O(this,"priority",10);O(this,"incompatibleTokens",["t","T","X"])}parse(e,i){switch(i){case"x":return Oe(Pe.basicOptionalMinutes,e);case"xx":return Oe(Pe.basic,e);case"xxxx":return Oe(Pe.basicOptionalSeconds,e);case"xxxxx":return Oe(Pe.extendedOptionalSeconds,e);case"xxx":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:_t(e,e.getTime()-Bs(e)-s)}}class $0 extends lt{constructor(){super(...arguments);O(this,"priority",40);O(this,"incompatibleTokens","*")}parse(e){return hu(e)}set(e,i,s){return[_t(e,s*1e3),{timestampIsSet:!0}]}}class q0 extends lt{constructor(){super(...arguments);O(this,"priority",20);O(this,"incompatibleTokens","*")}parse(e){return hu(e)}set(e,i,s){return[_t(e,s),{timestampIsSet:!0}]}}const U0={G:new d0,y:new h0,Y:new f0,R:new g0,u:new p0,Q:new m0,q:new y0,M:new b0,L:new x0,w:new w0,I:new k0,d:new D0,D:new T0,E:new C0,e:new P0,c:new O0,i:new A0,a:new R0,b:new L0,B:new I0,h:new N0,H:new F0,K:new B0,k:new z0,m:new H0,s:new W0,S:new Y0,X:new V0,x:new j0,t:new $0,T:new q0},X0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,G0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,K0=/^'([^]*?)'?$/,Z0=/''/g,Q0=/\S/,J0=/[a-zA-Z]/;function tx(n,t,e,i){var y,x,w,v,M,P,D,C;const s=r0(),r=(i==null?void 0:i.locale)??s.locale??tu,o=(i==null?void 0:i.firstWeekContainsDate)??((x=(y=i==null?void 0:i.locale)==null?void 0:y.options)==null?void 0:x.firstWeekContainsDate)??s.firstWeekContainsDate??((v=(w=s.locale)==null?void 0:w.options)==null?void 0:v.firstWeekContainsDate)??1,a=(i==null?void 0:i.weekStartsOn)??((P=(M=i==null?void 0:i.locale)==null?void 0:M.options)==null?void 0:P.weekStartsOn)??s.weekStartsOn??((C=(D=s.locale)==null?void 0:D.options)==null?void 0:C.weekStartsOn)??0;if(t==="")return n===""?G(e):_t(e,NaN);const l={firstWeekContainsDate:o,weekStartsOn:a,locale:r},c=[new u0],u=t.match(G0).map(T=>{const b=T[0];if(b in bo){const _=bo[b];return _(T,r.formatLong)}return T}).join("").match(X0),d=[];for(let T of u){!(i!=null&&i.useAdditionalWeekYearTokens)&&cu(T)&&xo(T,t,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&lu(T)&&xo(T,t,n);const b=T[0],_=U0[b];if(_){const{incompatibleTokens:S}=_;if(Array.isArray(S)){const R=d.find(F=>S.includes(F.token)||F.token===b);if(R)throw new RangeError(`The format string mustn't contain \`${R.fullToken}\` and \`${T}\` at the same time`)}else if(_.incompatibleTokens==="*"&&d.length>0)throw new RangeError(`The format string mustn't contain \`${T}\` and any other token at the same time`);d.push({token:b,fullToken:T});const E=_.run(n,T,r.match,l);if(!E)return _t(e,NaN);c.push(E.setter),n=E.rest}else{if(b.match(J0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");if(T==="''"?T="'":b==="'"&&(T=ex(T)),n.indexOf(T)===0)n=n.slice(T.length);else return _t(e,NaN)}}if(n.length>0&&Q0.test(n))return _t(e,NaN);const h=c.map(T=>T.priority).sort((T,b)=>b-T).filter((T,b,_)=>_.indexOf(T)===b).map(T=>c.filter(b=>b.priority===T).sort((b,_)=>_.subPriority-b.subPriority)).map(T=>T[0]);let g=G(e);if(isNaN(g.getTime()))return _t(e,NaN);const p={};for(const T of h){if(!T.validate(g,l))return _t(e,NaN);const b=T.set(g,p,l);Array.isArray(b)?(g=b[0],Object.assign(p,b[1])):g=b}return _t(e,g)}function ex(n){return n.match(K0)[1].replace(Z0,"'")}function nx(n){const t=G(n);return t.setMinutes(0,0,0),t}function ix(n){const t=G(n);return t.setMilliseconds(0),t}function sx(n){const t=n/jn;return Math.trunc(t)}function pu(n,t){const e=(t==null?void 0:t.additionalDigits)??2,i=lx(n);let s;if(i.date){const l=cx(i.date,e);s=ux(l.restDateString,l.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const r=s.getTime();let o=0,a;if(i.time&&(o=dx(i.time),isNaN(o)))return new Date(NaN);if(i.timezone){if(a=hx(i.timezone),isNaN(a))return new Date(NaN)}else{const l=new Date(r+o),c=new Date(0);return c.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),c.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),c}return new Date(r+o+a)}const Ws={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},rx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ox=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,ax=/^([+-])(\d{2})(?::?(\d{2}))?$/;function lx(n){const t={},e=n.split(Ws.dateTimeDelimiter);let i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Ws.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Ws.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){const s=Ws.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function cx(n,t){const e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,r=i[2]?parseInt(i[2]):null;return{year:r===null?s:r*100,restDateString:n.slice((i[1]||i[2]).length)}}function ux(n,t){if(t===null)return new Date(NaN);const e=n.match(rx);if(!e)return new Date(NaN);const i=!!e[4],s=Wi(e[1]),r=Wi(e[2])-1,o=Wi(e[3]),a=Wi(e[4]),l=Wi(e[5])-1;if(i)return yx(t,a,l)?fx(t,a,l):new Date(NaN);{const c=new Date(0);return!px(t,r,o)||!mx(t,s)?new Date(NaN):(c.setUTCFullYear(t,r,Math.max(s,o)),c)}}function Wi(n){return n?parseInt(n):1}function dx(n){const t=n.match(ox);if(!t)return NaN;const e=vo(t[1]),i=vo(t[2]),s=vo(t[3]);return bx(e,i,s)?e*jn+i*Ni+s*1e3:NaN}function vo(n){return n&&parseFloat(n.replace(",","."))||0}function hx(n){if(n==="Z")return 0;const t=n.match(ax);if(!t)return 0;const e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return xx(i,s)?e*(i*jn+s*Ni):NaN}function fx(n,t,e){const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const gx=[31,null,31,30,31,30,31,31,30,31,30,31];function mu(n){return n%400===0||n%4===0&&n%100!==0}function px(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(gx[t]||(mu(n)?29:28))}function mx(n,t){return t>=1&&t<=(mu(n)?366:365)}function yx(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function bx(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function xx(n,t){return t>=0&&t<=59}const ko=(n,t)=>{var s,r;const{tooltip:e}=t;if(e.opacity===0&&!n.locked){n.showTooltip=!1;return}const i=n.chartTooltipSortFn||((o,a)=>a.rawValue-o.rawValue);if(e.body&&!n.locked){const o=e.labelColors,a=((r=(s=t.chart.config)==null?void 0:s.options)==null?void 0:r.indexAxis)==="y"?"x":"y",l=["horizontal_bar","vertical_bar"].includes(n.chartType),c=["gauge","doughnut"].includes(n.chartType);n.tooltipContext=l?e.dataPoints.length>1?e.dataPoints[0].label:"":e.dataPoints[0].parsed.x,n.tooltipSeries=e.dataPoints.map((u,d)=>{const h=c?u.parsed:u.parsed[a];let g;if(n.units==="bytes")g=isNaN(h)?h:ho(h);else{const y=n.translateUnit(n.units,h);g=`${n.units==="usd"?"$":""}${h%1===0?Ys.format(h):Ys.format(Number(h.toFixed(bu)))} ${y}`}const p=l&&u.dataset.label!==u.label?u.dataset.label:c?u.dataset.labels[u.dataIndex]:u.dataset.label;return{backgroundColor:o[d].backgroundColor,borderColor:o[d].borderColor,label:p,value:g,rawValue:h}}).sort(i),n.left=`${e.x}px`,n.top=`${e.y}px`,n.showTooltip=!0}},_x=n=>n&&n.datasets&&n.datasets.length,wx=n=>_x(n)&&n.datasets.some(t=>t.data.length),vx=n=>wx(n)&&n.datasets.some(t=>t.data.length>1),kx=n=>vx(n)&&n.datasets.some(t=>t.data[0]&&po(t.data[0].x)),Mx=n=>kx(n)&&n.datasets.some(t=>t.data[0]&&t.data[0].x.toString().length>=13),Mo=(n,t,e)=>{const s=Math.min(t/1150,1);return n.x<e?n.x+t*.15*(1-s):n.x-t*1.15*(1-s)},Sx=(n,t,e)=>n.y<e?n.y+t*.15:n.y-t*.5;function yu(n,t){let e;return(...i)=>{clearTimeout(e),e=window.setTimeout(()=>{n(...i)},t)}}const bu=2,xu=10,_u=12,Ys=new Intl.NumberFormat(((xh=document==null?void 0:document.documentElement)==null?void 0:xh.lang)||"en-US"),Vs=10,wu={"1XXCount|1XX|1[0-9][0-9]":{solid:"#0072E5",light:"#4DA6FF",description:"Informational"},"SuccessfulRequests|2XXCount|2XX|2[0-9][0-9]|SUCCESS":{solid:"#0BB652",light:"#6FCC83",description:"Success"},"3XXCount|3XX|3[0-9][0-9]":{solid:"#FDC53B",light:"#FFD982",description:"Redirection"},"4XXCount|4XX|4[0-9][0-9]":{solid:"#FE9439",light:"#FFBA81",description:"Client Errors"},"5XXCount|5XX|5[0-9][0-9]":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},"errorCount|FailedRequests|FAILURE":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},nonStandard:{solid:"#6f7787",light:"#e7e7ec"},standard:{solid:"#1155cb",light:"#8ab3fa"},p99:{solid:"#1356cb",light:"#1356cb"},p95:{solid:"#1fbecd",light:"#1fbecd"},p50:{solid:"#1df97d",light:"#1df97d"},LatencyP99:{solid:"#1356cb",light:"#1356cb"},LatencyP95:{solid:"#1fbecd",light:"#1fbecd"},LatencyP50:{solid:"#1df97d",light:"#1df97d"}},ze=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Un=(n,t)=>(t||ze)[n%ze.length],vu=(n,t)=>{n[0]==="#"&&(n=n.slice(1));let e=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);e=e-t,i=i-t,s=s-t,e>255?e=255:e<0&&(e=0),i>255?i=255:i<0&&(i=0),s>255?s=255:s<0&&(s=0);const r=e.toString(16).length===1?"0"+e.toString(16):e.toString(16),o=i.toString(16).length===1?"0"+i.toString(16):i.toString(16),a=s.toString(16).length===1?"0"+s.toString(16):s.toString(16);return`#${r}${o}${a}`},ku="#6f7787",Mu={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},Dx=n=>{var e;const t=Math.floor(parseInt(n,10)/100)*100;return((e=Mu[t])==null?void 0:e.background)||"#fafafa"},Tx={SUCCESS:"#6FCC83",FAILURE:"#FF8484"},Cx={"4XX":"#FFBA81","5XX":"#FF8484"},Px={LatencyP99:"#1356cb",LatencyP95:"#1fbecd",LatencyP50:"#1df97d"},Ox="#dad4c7",Ex=n=>{const t=Object.entries(wu).find(([e])=>new RegExp(e).test(n));return t&&t[1]||wu.standard},Ax={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},Rx=2,Lx=0,So=new Map,Do=(n,t)=>t==="bytes"?ho(n):t==="count/minute"?n.toFixed(2):Ys.format(n),Su=n=>{const e=document.createElement("canvas").getContext("2d"),i=xt({});return e.font=i.string,e.measureText(n).width},Ix=()=>{const n="label_height";if(!So.has(n)){const t=xt({});So.set(n,t.lineHeight)}return So.get(n)},Nx=n=>n.datasets.reduce((t,e)=>t+e.data.reduce((i,s)=>isNaN(s)?i:i+s,0),0),Du=(n,t)=>t.datasets.reduce((e,i,s)=>n.isDatasetVisible(s)?e+i.data.reduce((r,o)=>isNaN(o)?r:r+o,0):e,0),Tu=(n,t)=>t===0?" (0.0%)":` (${(n/t*100).toFixed(1)}%)`,To="#e0e4ea",Fx={100:["#c8e2fd","#80bfff","#4da6ff","#1a8cff","#0072e5","#0059b2"],200:["#ceedd2","#9edca6","#89d595","#6fcc83","#44c26b","#0bb652","#0ca84a","#169643","#196e33","#1b572a"],300:["#fff4db","#ffe9b8","#ffe2a1","#ffd982","#ffd062","#fdc53b","#f4bb1e","#e8b00b","#d9a30f","#c89407"],400:["#ffead8","#ffd5b1","#ffc899","#ffba81","#ffae6b","#fe9439","#f6871d","#eb7c0c","#da700c","#cc6100"],500:["#ffd5d5","#ffb6b6","#ff9d9d","#ff8484","#ff6a6a","#ff4545","#fb1f1f","#e90b0b","#d40202","#be0202"]},Yi=(n,t)=>{let e=1;const i=Fx[n],s=new Map;for(const r of t)s.set(r,i[e]),e=e%(i.length-1)+1;return s.set(-1,i[0]),s},Cu=new Map([[100,Yi("100",[100,101,102,103])],[200,Yi("200",[200,201,202,203,204,205,206,207,208,226])],[300,Yi("300",[300,301,302,303,304,305,307,308])],[400,Yi("400",[400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,423,424,425,426,428,429,431,451])],[500,Yi("500",[500,501,502,503,504,505,506,507,508,510,511])]]),Co=n=>{const t=parseInt(n,10),e=Math.floor(t/100)*100,i=Cu.get(e);return i===void 0?To:i.get(t)??i.get(-1)??To},Bx=n=>{const t=Co(n);return{solid:t,light:t}},js={...Array.from({length:500},(n,t)=>100+t).reduce((n,t)=>(n[`${t}`]=Co(`${t}`),n),{}),____OTHER____:"#DAD4C7","1XX":"#4DA6FF","2XX":"#6FCC83","3XX":"#FFD982","4XX":"#FFBA81","5XX":"#FF8484"};function zx(n){const t={enabled:!1,position:"barChartTooltipPosition",callbacks:{label:s=>({label:s.dataset.label,value:s.label})}};As.positioners.barChartTooltipPosition=function(s,r){if(!s.length)return!1;const o=this.chart.canvas.getBoundingClientRect(),a=n.tooltipState.width||this.width,l=o.width/2,c=Mo(r,a,l),u=r.y,d=r.x<l?"left":"center";return{x:c-n.tooltipState.offsetX,y:u-n.tooltipState.offsetY,xAlign:d}},Ur.modes.customInteractionMode=function(s,r){const o=en(r,s),a=[];return Ur.evaluateInteractionItems(s,s.options.indexAxis||"x",o,(l,c,u)=>{s.options.indexAxis==="y"&&l.inYRange(o.y,!0)&&s.data.datasets[c].data[u]&&a.push({element:l,datasetIndex:c,index:u}),s.options.indexAxis==="x"&&l.inXRange(o.x,!0)&&s.data.datasets[c].data[u]&&a.push({element:l,datasetIndex:c,index:u})}),a};const e=n.numLabels.value>25?xu:_u;return f.computed(()=>{var s,r,o,a,l,c,u,d;return{indexAxis:n.indexAxis,skipNull:!0,scales:{x:{border:{display:!1},stacked:n.stacked.value,grid:{display:!1,drawBorder:!1},ticks:{maxRotation:90,autoSkip:!1,font:e,callback:function(h,g){const p=this;if(p.chart.options.indexAxis===p.axis){h=p.getLabelForValue(g);const y=10;return h&&h.length>y?h.slice(0,y)+"...":h}return p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="y"?!tt((s=n.metricAxesTitle)==null?void 0:s.value):!tt((r=n.dimensionAxesTitle)==null?void 0:r.value),text:n.indexAxis==="y"?(o=n.metricAxesTitle)==null?void 0:o.value:(a=n.dimensionAxesTitle)==null?void 0:a.value,padding:{top:10},font:{weight:"bold"}}},y:{border:{display:!1},stacked:n.stacked.value,beginAtZero:!0,grid:{display:!1,drawBorder:!1},ticks:{font:e,callback:function(h,g){const p=this;return p.chart.options.indexAxis===p.axis?(h=p.getLabelForValue(g),h&&h.length>Vs?h.slice(0,Vs)+"...":h):p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="x"?!tt((l=n.metricAxesTitle)==null?void 0:l.value):!tt((c=n.dimensionAxesTitle)==null?void 0:c.value),text:n.indexAxis==="x"?(u=n.metricAxesTitle)==null?void 0:u.value:(d=n.dimensionAxesTitle)==null?void 0:d.value,padding:{bottom:20},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:h=>{ko(n.tooltipState,h)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1}})}ge.register(...Ny);const Hx=(n,t)=>{const e=t.datasets.map(s=>s.label),i=n.datasets.map(s=>s.label);return n.datasets.length===t.datasets.length&&e.every((s,r)=>s===i[r])};function Wx(n,t,e,i,s){const r=f.shallowRef(null),o=(a,l)=>{if(t.value)return new ge(t.value,{type:n,data:a,plugins:i,options:l})};return f.onMounted(()=>{r.value=o(e.value,s.value)}),f.onBeforeUnmount(()=>{tt(r.value)||r.value.destroy()}),f.watch(e,(a,l)=>{if(Hx(l,a)&&!tt(r.value)){for(const[c,u]of a.datasets.entries())Object.assign(r.value.data.datasets[c],u);r.value.data.labels=a.labels,r.value.update()}else tt(r.value)||r.value.destroy(),r.value=o(a,s.value)}),f.watch(t,()=>{tt(r.value)||r.value.destroy(),r.value=o(e.value,s.value)}),f.watch(s,(a,l)=>{(a.indexAxis!==l.indexAxis||JSON.stringify(a.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(a.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(tt(r.value)||r.value.destroy(),r.value=o(e.value,a))}),r}var ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Po(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Pu={exports:{}};(function(n){(function(){function t(c,u){if(u.separator===!1||c<1e3)return c.toString();var d=typeof u.separator=="string"?u.separator:",",h=[],g=Math.round(c).toString().split("");return g.reverse().forEach(function(p,y){y&&y%3===0&&h.push(d),h.push(p)}),h.reverse().join("")}function e(c,u,d){var h=c/u,g=d.round?"round":"floor";return d.decimal===!1?(c=Math[g](h),c.toString()):(d.precision?c=h:c=h<10?Math[g](h*10)/10:Math[g](h),c=c.toString(),typeof d.decimal=="string"&&(c=c.replace(".",d.decimal)),c)}var i=1e3,s=1e4,r=1e6,o=1e9,a=1e12;function l(c,u){var d;u=u||{};var h=c<0;h&&(c=Math.abs(c)),u.precision&&(c=parseFloat(c.toPrecision(u.precision)));var g=u.min10k?s:i;return c<g||u.precision&&u.precision>Math.log10(c)?d=t(e(c,1,u),u):c<r?d=e(c,i,u)+"k":c<o?d=e(c,r,u)+"m":c<a?d=t(e(c,o,u),u)+"b":d=t(e(c,a,u),u)+"t",h&&(d="-"+d),u.capital&&(d=d.toUpperCase()),u.prefix&&(d=u.prefix+d),u.suffix&&(d=d+u.suffix),d}l.addCommas=t,n.exports=l})()})(Pu);var Yx=Pu.exports;const Vi=Po(Yx);function Vx(n,t,e){const{i18n:i}=gt.useI18n(),{translateUnit:s}=gt.useTranslatedUnits();return{legendValues:f.computed(()=>n.value.datasets.reduce((o,a)=>{const l=a.total?a.total:a.data.reduce((u,d)=>u+(typeof d=="number"?Number(d)||0:Number(d&&d.y)||0),0);let c;if(e.value==="bytes")c=isNaN(l)?"0":ho(l);else{const u=s(e.value,l);c=i&&i.t("legend.datapointValueDisplay",{value:Vi(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}}),unit:u})||`${Vi(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}})} ${e.value}`}return{...o,[a.label]:{raw:l,formatted:c}}},{}))}}var jx=Object.defineProperty,$x=(n,t,e)=>t in n?jx(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ee=(n,t,e)=>$x(n,typeof t!="symbol"?t+"":t,e),Pt=(n=>(n.FIFTEEN_MIN="15m",n.ONE_HOUR="1h",n.SIX_HOUR="6h",n.TWELVE_HOUR="12h",n.ONE_DAY="24h",n.SEVEN_DAY="7d",n.THIRTY_DAY="30d",n.CURRENT_WEEK="current_week",n.CURRENT_MONTH="current_month",n.CURRENT_QUARTER="current_quarter",n.PREVIOUS_WEEK="previous_week",n.PREVIOUS_MONTH="previous_month",n.PREVIOUS_QUARTER="previous_quarter",n))(Pt||{});const qx=["secondly","minutely","hourly","daily","weekly","trend"],ji=n=>n.filter(t=>t!=="time"),Ou=["api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","route","status_code","status_code_grouped","time"],Ux=ji(Ou),Xx=[...Ou,"application","consumer","iso_code"],Gx=ji(Xx),Kx=["control_plane","control_plane_group","gateway_service","consumer","application","route","ai_provider","ai_response_model","ai_request_model","llm_cache_status","llm_embeddings_provider","llm_embeddings_model","time"],Zx=ji(Kx);ji(["api_product","api_product_version","application","auth_type","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","gateway_service","header_host","header_user_agent","http_method","iso_code","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_uri","upstream_status_code_grouped","websocket"]),ji(["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","response_body_size","request_body_size","status_code","upstream_status_code"]),new Set(Ux),new Set(Gx),new Set(Zx);function Ut(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function _e(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function Eu(n,t){const e=Ut(n);return isNaN(t)?_e(n,NaN):(e.setDate(e.getDate()+t),e)}function Qx(n,t){const e=Ut(n);if(isNaN(t))return _e(n,NaN);const i=e.getDate(),s=_e(n,e.getTime());s.setMonth(e.getMonth()+t+1,0);const r=s.getDate();return i>=r?s:(e.setFullYear(s.getFullYear(),s.getMonth(),i),e)}const Au=6048e5,Jx=864e5,t_=60,e_=3600;let n_={};function $s(){return n_}function He(n,t){var e,i,s,r;const o=$s(),a=(t==null?void 0:t.weekStartsOn)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.weekStartsOn)??o.weekStartsOn??((r=(s=o.locale)==null?void 0:s.options)==null?void 0:r.weekStartsOn)??0,l=Ut(n),c=l.getDay(),u=(c<a?7:0)+c-a;return l.setDate(l.getDate()-u),l.setHours(0,0,0,0),l}function qs(n){return He(n,{weekStartsOn:1})}function Ru(n){const t=Ut(n),e=t.getFullYear(),i=_e(n,0);i.setFullYear(e+1,0,4),i.setHours(0,0,0,0);const s=qs(i),r=_e(n,0);r.setFullYear(e,0,4),r.setHours(0,0,0,0);const o=qs(r);return t.getTime()>=s.getTime()?e+1:t.getTime()>=o.getTime()?e:e-1}function Us(n){const t=Ut(n);return t.setHours(0,0,0,0),t}function Lu(n){const t=Ut(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function i_(n,t){const e=Us(n),i=Us(t),s=+e-Lu(e),r=+i-Lu(i);return Math.round((s-r)/Jx)}function s_(n){const t=Ru(n),e=_e(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),qs(e)}function r_(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function o_(n){if(!r_(n)&&typeof n!="number")return!1;const t=Ut(n);return!isNaN(Number(t))}function Xn(n){const t=Ut(n);return t.setDate(1),t.setHours(0,0,0,0),t}function a_(n){const t=Ut(n),e=_e(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}const l_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},c_=(n,t,e)=>{let i;const s=l_[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Oo(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const u_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},d_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},h_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},f_={date:Oo({formats:u_,defaultWidth:"full"}),time:Oo({formats:d_,defaultWidth:"full"}),dateTime:Oo({formats:h_,defaultWidth:"full"})},g_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},p_=(n,t,e,i)=>g_[n];function $i(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=e!=null&&e.width?String(e.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const m_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},y_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},b_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},x_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},__={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},w_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},v_=(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},k_={ordinalNumber:v_,era:$i({values:m_,defaultWidth:"wide"}),quarter:$i({values:y_,defaultWidth:"wide",argumentCallback:n=>n-1}),month:$i({values:b_,defaultWidth:"wide"}),day:$i({values:x_,defaultWidth:"wide"}),dayPeriod:$i({values:__,defaultWidth:"wide",formattingValues:w_,defaultFormattingWidth:"wide"})};function qi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?S_(a,d=>d.test(o)):M_(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function M_(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function S_(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function D_(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const T_=/^(\d+)(th|st|nd|rd)?/i,C_=/\d+/i,P_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},O_={any:[/^b/i,/^(a|c)/i]},E_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},A_={any:[/1/i,/2/i,/3/i,/4/i]},R_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},L_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},I_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},N_={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},F_={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},B_={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},z_={ordinalNumber:D_({matchPattern:T_,parsePattern:C_,valueCallback:n=>parseInt(n,10)}),era:qi({matchPatterns:P_,defaultMatchWidth:"wide",parsePatterns:O_,defaultParseWidth:"any"}),quarter:qi({matchPatterns:E_,defaultMatchWidth:"wide",parsePatterns:A_,defaultParseWidth:"any",valueCallback:n=>n+1}),month:qi({matchPatterns:R_,defaultMatchWidth:"wide",parsePatterns:L_,defaultParseWidth:"any"}),day:qi({matchPatterns:I_,defaultMatchWidth:"wide",parsePatterns:N_,defaultParseWidth:"any"}),dayPeriod:qi({matchPatterns:F_,defaultMatchWidth:"any",parsePatterns:B_,defaultParseWidth:"any"})},H_={code:"en-US",formatDistance:c_,formatLong:f_,formatRelative:p_,localize:k_,match:z_,options:{weekStartsOn:0,firstWeekContainsDate:1}};function W_(n){const t=Ut(n);return i_(t,a_(t))+1}function Y_(n){const t=Ut(n),e=+qs(t)-+s_(t);return Math.round(e/Au)+1}function Iu(n,t){var e,i,s,r;const o=Ut(n),a=o.getFullYear(),l=$s(),c=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??l.firstWeekContainsDate??((r=(s=l.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,u=_e(n,0);u.setFullYear(a+1,0,c),u.setHours(0,0,0,0);const d=He(u,t),h=_e(n,0);h.setFullYear(a,0,c),h.setHours(0,0,0,0);const g=He(h,t);return o.getTime()>=d.getTime()?a+1:o.getTime()>=g.getTime()?a:a-1}function V_(n,t){var e,i,s,r;const o=$s(),a=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??o.firstWeekContainsDate??((r=(s=o.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,l=Iu(n,t),c=_e(n,0);return c.setFullYear(l,0,a),c.setHours(0,0,0,0),He(c,t)}function j_(n,t){const e=Ut(n),i=+He(e,t)-+V_(e,t);return Math.round(i/Au)+1}function ft(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const an={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ft(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ft(e+1,2)},d(n,t){return ft(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ft(n.getHours()%12||12,t.length)},H(n,t){return ft(n.getHours(),t.length)},m(n,t){return ft(n.getMinutes(),t.length)},s(n,t){return ft(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ft(s,t.length)}},Gn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Nu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return an.y(n,t)},Y:function(n,t,e,i){const s=Iu(n,i),r=s>0?s:1-s;if(t==="YY"){const o=r%100;return ft(o,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ft(r,t.length)},R:function(n,t){const e=Ru(n);return ft(e,t.length)},u:function(n,t){const e=n.getFullYear();return ft(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ft(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ft(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return an.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ft(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=j_(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ft(s,t.length)},I:function(n,t,e){const i=Y_(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ft(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):an.d(n,t)},D:function(n,t,e){const i=W_(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ft(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ft(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ft(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ft(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const i=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=Gn.noon:i===0?s=Gn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=Gn.evening:i>=12?s=Gn.afternoon:i>=4?s=Gn.morning:s=Gn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return an.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):an.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):an.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):an.s(n,t)},S:function(n,t){return an.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Bu(i);case"XXXX":case"XX":return Cn(i);case"XXXXX":case"XXX":default:return Cn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Bu(i);case"xxxx":case"xx":return Cn(i);case"xxxxx":case"xxx":default:return Cn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Fu(i,":");case"OOOO":default:return"GMT"+Cn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Fu(i,":");case"zzzz":default:return"GMT"+Cn(i,":")}},t:function(n,t,e){const i=Math.trunc(n.getTime()/1e3);return ft(i,t.length)},T:function(n,t,e){const i=n.getTime();return ft(i,t.length)}};function Fu(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ft(r,2)}function Bu(n,t){return n%60===0?(n>0?"-":"+")+ft(Math.abs(n)/60,2):Cn(n,t)}function Cn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ft(Math.trunc(i/60),2),r=ft(i%60,2);return e+s+t+r}const zu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Hu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},$_=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return zu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",zu(i,t)).replace("{{time}}",Hu(s,t))},q_={p:Hu,P:$_},U_=/^D+$/,X_=/^Y+$/,G_=["D","DD","YY","YYYY"];function K_(n){return U_.test(n)}function Z_(n){return X_.test(n)}function Q_(n,t,e){const i=J_(n,t,e);if(console.warn(i),G_.includes(n))throw new RangeError(i)}function J_(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const tw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ew=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nw=/^'([^]*?)'?$/,iw=/''/g,sw=/[a-zA-Z]/;function rw(n,t,e){var i,s,r,o,a,l,c,u;const d=$s(),h=(e==null?void 0:e.locale)??d.locale??H_,g=(e==null?void 0:e.firstWeekContainsDate)??((s=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:s.firstWeekContainsDate)??d.firstWeekContainsDate??((o=(r=d.locale)==null?void 0:r.options)==null?void 0:o.firstWeekContainsDate)??1,p=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((u=(c=d.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,y=Ut(n);if(!o_(y))throw new RangeError("Invalid time value");let x=t.match(ew).map(v=>{const M=v[0];if(M==="p"||M==="P"){const P=q_[M];return P(v,h.formatLong)}return v}).join("").match(tw).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:ow(v)};if(Nu[M])return{isToken:!0,value:v};if(M.match(sw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});h.localize.preprocessor&&(x=h.localize.preprocessor(y,x));const w={firstWeekContainsDate:g,weekStartsOn:p,locale:h};return x.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&Z_(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&K_(M))&&Q_(M,t,String(n));const P=Nu[M[0]];return P(y,M,h.localize,w)}).join("")}function ow(n){const t=n.match(nw);return t?t[1].replace(iw,"'"):n}function aw(n){const t=Ut(n),e=t.getFullYear(),i=t.getMonth(),s=_e(n,0);return s.setFullYear(e,i+1,0),s.setHours(0,0,0,0),s.getDate()}function lw(n){return Math.trunc(n*e_)}function cw(n){const t=n/t_;return Math.trunc(t)}function Wu(n,t){return Qx(n,-t)}function Yu(n,t,e){const i=hw(n,e.timeZone,e.locale);return"formatToParts"in i?uw(i,t):dw(i,t)}function uw(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function dw(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function hw(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function fw(n,t){const e=yw(t);return"formatToParts"in e?pw(e,n):mw(e,n)}const gw={year:0,month:1,day:2,hour:3,minute:4,second:5};function pw(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=gw[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function mw(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Eo={};function yw(n){if(!Eo[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";Eo[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Eo[n]}function Ao(n,t,e,i,s,r,o){const a=new Date(0);return a.setUTCFullYear(n,t,e),a.setUTCHours(i,s,r,o),a}const Vu=36e5,bw=6e4,Ro={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ui(n,t,e){if(!n)return 0;let i=Ro.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=Ro.timezoneHH.exec(n),i)return s=parseInt(i[1],10),ju(s)?-(s*Vu):NaN;if(i=Ro.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const o=parseInt(i[3],10);return ju(s,o)?(r=Math.abs(s)*Vu+o*bw,i[1]==="+"?-r:r):NaN}if(ww(n)){t=new Date(t||Date.now());const o=e?t:xw(t),a=Lo(o,n);return-(e?a:_w(t,a,n))}return NaN}function xw(n){return Ao(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function Lo(n,t){const e=fw(n,t),i=Ao(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function _w(n,t,e){let i=n.getTime()-t;const s=Lo(new Date(i),e);if(t===s)return t;i-=s-t;const r=Lo(new Date(i),e);return s===r?s:Math.max(s,r)}function ju(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const $u={};function ww(n){if($u[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),$u[n]=!0,!0}catch{return!1}}const vw=60*1e3,kw={X:function(n,t,e){const i=Io(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return qu(i);case"XXXX":case"XX":return Kn(i);case"XXXXX":case"XXX":default:return Kn(i,":")}},x:function(n,t,e){const i=Io(e.timeZone,n);switch(t){case"x":return qu(i);case"xxxx":case"xx":return Kn(i);case"xxxxx":case"xxx":default:return Kn(i,":")}},O:function(n,t,e){const i=Io(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+Mw(i,":");case"OOOO":default:return"GMT"+Kn(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return Yu("short",n,e);case"zzzz":default:return Yu("long",n,e)}}};function Io(n,t){const e=n?Ui(n,t,!0)/vw:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function Xs(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function Kn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Xs(Math.floor(i/60),2),r=Xs(Math.floor(i%60),2);return e+s+t+r}function qu(n,t){return n%60===0?(n>0?"-":"+")+Xs(Math.abs(n)/60,2):Kn(n,t)}function Mw(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+Xs(r,2)}function Uu(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const Xu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,No=36e5,Gu=6e4,Sw=2,Xt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Xu};function Gs(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?Sw:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=Dw(n),{year:s,restDateString:r}=Tw(i.date,e),o=Cw(r,s);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){const a=o.getTime();let l=0,c;if(i.time&&(l=Pw(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Ui(i.timeZone||t.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=Uu(new Date(a+l)),c=Uu(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function Dw(n){const t={};let e=Xt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Xt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Xt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function Tw(n,t){if(n){const e=Xt.YYY[t],i=Xt.YYYYY[t];let s=Xt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Xt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function Cw(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Xt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,Qu(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Xt.DDD.exec(n),r){e=new Date(0);const o=parseInt(r[1],10);return Aw(t,o)?(e.setUTCFullYear(t,0,o),e):new Date(NaN)}if(r=Xt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const o=parseInt(r[2],10);return Qu(t,i,o)?(e.setUTCFullYear(t,i,o),e):new Date(NaN)}if(r=Xt.Www.exec(n),r)return s=parseInt(r[1],10)-1,Ju(s)?Ku(t,s):new Date(NaN);if(r=Xt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const o=parseInt(r[2],10)-1;return Ju(s,o)?Ku(t,s,o):new Date(NaN)}return null}function Pw(n){let t,e,i=Xt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),Fo(t)?t%24*No:NaN;if(i=Xt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),Fo(t,e)?t%24*No+e*Gu:NaN;if(i=Xt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Fo(t,e,s)?t%24*No+e*Gu+s*1e3:NaN}return null}function Ku(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const Ow=[31,28,31,30,31,30,31,31,30,31,30,31],Ew=[31,29,31,30,31,30,31,31,30,31,30,31];function Zu(n){return n%400===0||n%4===0&&n%100!==0}function Qu(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=Zu(n);if(i&&e>Ew[t]||!i&&e>Ow[t])return!1}return!0}function Aw(n,t){if(t<1)return!1;const e=Zu(n);return!(e&&t>366||!e&&t>365)}function Ju(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function Fo(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const Rw=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Lw(n,t,e={}){t=String(t);const i=t.match(Rw);if(i){const s=Gs(e.originalDate||n,e);t=i.reduce(function(r,o){if(o[0]==="'")return r;const a=r.indexOf(o),l=r[a-1]==="'",c=r.replace(o,"'"+kw[o[0]](s,o,e)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},t)}return rw(n,t,e)}function td(n,t,e){n=Gs(n,e);const i=Ui(t,n,!0),s=new Date(n.getTime()-i),r=new Date(0);return r.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),r.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),r}function Iw(n,t,e,i){return i={...i,timeZone:t,originalDate:n},Lw(td(n,t,{timeZone:i.timeZone}),e,i)}function Nw(n,t,e){if(typeof n=="string"&&!n.match(Xu))return Gs(n,{...e,timeZone:t});n=Gs(n,e);const i=Ao(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),s=Ui(t,new Date(i));return new Date(i+s)}function Fw(n,t){return-Ui(n,t)}function Bo(n,t={}){if(!n)return n;const e=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(n);return Iw(s,e,i)}catch{return console.error("Invalid value passed to formatTime",n),"(invalid date)"}}const Bw={secondly:1e3,minutely:60*1e3,hourly:60*60*1e3,daily:60*60*24*1e3,weekly:60*60*24*7*1e3,trend:0};function zo(n){return n&&qx.find(t=>n<=Bw[t])||null}const Zn=(n,t)=>new Date(n.getTime()-Fw(t,n));class we{constructor(t){Ee(this,"timeframeText"),Ee(this,"key"),Ee(this,"display"),Ee(this,"timeframeLength"),Ee(this,"allowedTiers"),Ee(this,"defaultResponseGranularity"),Ee(this,"dataGranularity"),Ee(this,"isRelative"),Ee(this,"_startCustom"),Ee(this,"_endCustom"),this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(){const t=new Set,e=this.maximumTimeframeLength()/3600;return e<=6&&t.add("minutely"),e>=2&&e<=7*24&&t.add("hourly"),e>=2*24&&t.add("daily"),e>=2*24*14&&t.add("weekly"),t}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const e=Nw(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return td(e,t)}}class zw extends we{rawStart(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Zn(e,t)),e}maximumTimeframeLength(){return 60*60*24*7}}class Hw extends we{rawStart(t){let e=Xn(this.tzAdjustedDate(t));return t&&(e=Zn(e,t)),e}maximumTimeframeLength(){return 60*60*24*31}}class Ww extends we{rawEnd(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Zn(e,t)),e}rawStart(t){const e=this.tzAdjustedDate(t);let i=He(e.setDate(e.getDate()-7),{weekStartsOn:1});return t&&(i=Zn(i,t)),i}}class Yw extends we{rawEnd(t){let e=Xn(this.tzAdjustedDate(t));return t&&(e=Zn(e,t)),e}rawStart(t){let e=Xn(Wu(this.tzAdjustedDate(t),1));return t&&(e=Zn(e,t)),e}}Pt.FIFTEEN_MIN,new we({key:Pt.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>60*15,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.ONE_HOUR,new we({key:Pt.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>60*60*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.SIX_HOUR,new we({key:Pt.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>60*60*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.TWELVE_HOUR,new we({key:Pt.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>60*60*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.ONE_DAY,new we({key:Pt.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>60*60*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.SEVEN_DAY,new we({key:Pt.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Pt.THIRTY_DAY,new we({key:Pt.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>60*60*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Pt.CURRENT_WEEK,new zw({key:Pt.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const n=He(new Date,{weekStartsOn:1});return(Us(Eu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.CURRENT_MONTH,new Hw({key:Pt.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const n=Xn(new Date);return(Us(Eu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.PREVIOUS_WEEK,new Ww({key:Pt.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.PREVIOUS_MONTH,new Yw({key:Pt.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let n=0;const t=Xn(new Date),e=Xn(Wu(new Date,1));return t.getTimezoneOffset()!==e.getTimezoneOffset()&&(n=Vw(t,e)),60*60*24*aw(new Date().setMonth(new Date().getMonth()-1))+lw(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function Vw(n,t){return cw(n.getTimezoneOffset()-t.getTimezoneOffset())}function jw(n){return f.computed(()=>{var s;if(!((s=n.value)!=null&&s.meta))return"";const e=n.value.meta.start_ms,i=n.value.meta.end_ms;return e&&i?`${Bo(e)} - ${Bo(i,{includeTZ:!0})}`:""})}function $w(n){const t={enabled:!1,position:"doughnutChartTooltipPosition",callbacks:{label:i=>({label:i.dataset.label,value:i.label})}};return As.positioners.doughnutChartTooltipPosition=function(i,s){if(!i.length)return!1;const r=this.chart.canvas.getBoundingClientRect(),o=n.tooltipState.width||this.width,a=r.width/2,l=Mo(s,o,a),c=s.y,u=s.x<a?"left":"center";return{x:l-n.tooltipState.offsetX,y:c,xAlign:u}},{options:f.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:i=>{ko(n.tooltipState,i)}}}}))}}function qw(n){const t=f.computed(()=>{var l,c;return{type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:10,autoSkipPadding:100,source:"auto",maxRotation:0},title:{display:!tt((l=n.dimensionAxesTitle)==null?void 0:l.value),text:(c=n.dimensionAxesTitle)==null?void 0:c.value,padding:{top:2},font:{weight:"bold"}}}}),e=f.computed(()=>{var l,c;return{title:{display:!tt((l=n.metricAxesTitle)==null?void 0:l.value),text:(c=n.metricAxesTitle)==null?void 0:c.value,padding:{bottom:10},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0}}),i={enabled:!1,position:"lineChartTooltipPosition"};As.positioners.lineChartTooltipPosition=function(l,c){if(!l.length||n.tooltipState.locked)return!1;const u=this.chart.canvas.getBoundingClientRect(),d=n.tooltipState.width||this.width,h=n.tooltipState.height||this.height,g=u.width/2,p=u.height/2,y=Mo(c,d,g);let x=Sx(c,h,p);const w=c.y<p?"top":"bottom",v=c.x<g?"left":"center";return h>u.height&&(x=0),{x:y,y:x,xAlign:v,yAlign:w}};const s=f.computed(()=>{switch(n.granularity.value){case"minutely":return"minute";case"hourly":return"hour";case"daily":return"day";default:return"day"}}),r=f.computed(()=>sx(Number(n.timeRangeMs.value))>=24?"yyyy-MM-dd h:mm":"h:mm"),o=f.computed(()=>["daily","weekly"].includes(n.granularity.value)?"yyyy-MM-dd":"yyyy-MM-dd h:mm");return{options:f.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:{border:{display:!1},...t.value,stacked:n.stacked.value,time:{tooltipFormat:"h:mm:ss a",unit:s.value,displayFormats:{minute:"h:mm:ss a",hour:r.value,day:o.value}}},y:{border:{display:!1},...e.value,stacked:n.stacked.value}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},streaming:!1,tooltip:{...i,external:l=>{ko(n.tooltipState,l)}}},interaction:{mode:"index",intersect:!1}}))}}function Uw(n){const{isMultiMetric:t,hasDimensions:e,metricNames:i,barSegmentLabels:s,pivotRecords:r,rowLabels:o,colorPalette:a}=n,{i18n:l}=gt.useI18n();return t?i.map(u=>({label:l&&l.te(`chartLabels.${u}`)&&l.t(`chartLabels.${u}`)||u,backgroundColor:Un(i.indexOf(u),ze),data:o.map((d,h)=>e?r[`${d.id},${u}`]||0:r[`${h},${u}`]||null)})):Array.from(s).flatMap((u,d)=>{if(!u)return[];const h={},g=Array.isArray(a)?Un(d,a):a[u.name]||Un(d);return h[u.name]=g,{label:l&&l.te(`chartLabels.${u.name}`)&&l.t(`chartLabels.${u.name}`)||u.name,backgroundColor:g,data:o.map(p=>r[`${p.id},${u.id}`]||null)}})}function Xw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:o}=t.value.meta,a=r&&Object.keys(r),l=o&&o.length>1,c=r&&a&&a.length>0;if(!s.length||!o)return{datasets:[],labels:[]};const u=c&&a||o,d=u[0],h=u.length>1?u[1]:u[0],g=Object.fromEntries(l?s.flatMap(C=>o.map((T,b)=>{const _=C.event[d],S=c?`${_},${T}`:`${b},${T}`,E=C.event[T];return[S,E]})):s.map(C=>{const T=c?`${C.event[d]},${C.event[h]}`:`${d},${h}`,b=C.event[o[0]];return[T,b]})),p=Object.entries(g).sort(([,C],[,T])=>Number(T)-Number(C)).map(([C])=>C.split(",")[0]),y=r[d],x=r[h],w=c&&y&&Object.entries(y).map(([C,T])=>({id:C,name:T.name}))||o.map(C=>({id:C,name:C})),v=c&&x&&Object.entries(x).map(([C,T])=>({id:C,name:T.name}))||o.map(C=>({id:C,name:C}));if(d!=="status_code"&&d!=="status_code_grouped"&&(w.sort((C,T)=>p.indexOf(C.id)-p.indexOf(T.id)),v.sort((C,T)=>p.indexOf(C.id)-p.indexOf(T.id))),!w||!v)return{labels:[],datasets:[]};const M=Uw({isMultiMetric:l,hasDimensions:c,metricNames:o,dimensionFieldNames:u,barSegmentLabels:v,pivotRecords:g,rowLabels:w,colorPalette:n.colorPalette||ze});return{labels:c?w.map(C=>e&&e.te(`chartLabels.${C.name}`)&&e.t(`chartLabels.${C.name}`)||C.name):o.map(C=>e&&e.te(`chartLabels.${C}`)&&e.t(`chartLabels.${C}`)||C),datasets:M}}}catch(s){return console.error(s),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const Gw=(n,t,e=1)=>Array(Math.ceil((t-n)/e)).fill(n).map((i,s)=>i+s*e),Kw=n=>{if(typeof n=="string"){const t=+n;if(t)return t;try{return pu(n).getTime()}catch(e){if(e instanceof RangeError)return 0;throw e}}return n},Zw=(n,t,e,i,s)=>{const o=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),a=Math.floor((n-i)/e)*e+i,l=Math.floor((o-i)/e)*e+i+e;return Gw(a,l,e)};function Qw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:o,start_ms:a,end_ms:l}=t.value.meta;if(!o)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const c=r&&Object.keys(r)||o,u=c&&c[0],d=r[u],h=r&&d&&Object.keys(d).map(D=>({id:D,name:d[D].name}))||o.map(D=>({id:D,name:D})),g=t.value.meta.granularity_ms;if(typeof g!="number"||isNaN(g)||!isFinite(g)||g===0)return console.error("Invalid step value:",g),{datasets:[],labels:[]};if(!s.length)return{datasets:[],labels:[]};const p=Kw(a),y=Zw(a,l,g,p,s),x=new Set,w=s!=null&&s.length?s.reduce((D,C)=>{const T=new Date(C.timestamp).valueOf(),b=C.event;for(const _ of o)x.add(_),T in D||(D[T]={}),_ in D[T]||(D[T][_]={});for(const _ of o)h.forEach(S=>{b[u]===S.id||_===S.id?(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[_])*1e3)/1e3):c.length||(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[S.id])*1e3)/1e3)});return D},{}):{},v=o.length===1?o.flatMap(D=>h.map(C=>[D,C.name])):h.map(D=>[D.name,D.name]),M={},P=[...v].map(([D,C],T)=>{const b=y.map(R=>R in w&&D in w[R]?{x:R,y:w[R][D][C]||0}:{x:R,y:0});let{colorPalette:_,fill:S}=n;tt(_)&&(_=ze);const E=Array.isArray(_)?Un(T,_):_[C]||Un(T);return M[C]=E,{rawDimension:C,rawMetric:D,label:e&&e.te(`chartLabels.${C}`)&&e.t(`chartLabels.${C}`)||C,borderColor:E,backgroundColor:E,data:b,total:b.reduce((R,{y:F})=>R+Number(F),0),...Ax,fill:S,borderWidth:S?Lx:Rx}});return P.sort((D,C)=>Number(D.total)<Number(C.total)?-1:1),{datasets:P,colorMap:M}}}catch(s){return console.error(s),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const Jw=(n,t)=>{f.watch([n,t],(e,i,s)=>{const[r,o]=e;!o||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(o,r),s(()=>{var a;(a=window._AnalyticsChartDataInternal)==null||a.delete(o)}))},{immediate:!0})};function t1(){const{i18n:n}=gt.useI18n();return{translateUnit:(e,i)=>{const s=i===1,r=`chartUnits.${e}`;return e==="usd"?"":n.te(r)?n.t(r,{plural:s?"":"s"}):e}}}const gt={useBarChartOptions:zx,useChartJSCommon:Wx,useChartLegendValues:Vx,useChartSelectedRange:jw,useExploreResultToDatasets:Xw,useExploreResultToTimeDataset:Qw,useDoughnutChartOptions:$w,useLinechartOptions:qw,useI18n:Lh,useReportChartDataForSynthetics:Jw,useTranslatedUnits:t1};var Ot=(n=>(n.Hidden="hidden",n.Right="right",n.Bottom="bottom",n))(Ot||{}),Qn=(n=>(n.Hidden="hidden",n.SingleMetric="single",n.Full="full",n))(Qn||{});/*!
18
+ `):n}function ry(n,t){const{element:e,datasetIndex:i,index:s}=t,r=n.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(s);return{chart:n,label:o,parsed:r.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:r.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function Tc(n,t){const e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:o,boxHeight:a}=t,l=xt(t.bodyFont),c=xt(t.titleFont),u=xt(t.footerFont),d=r.length,h=s.length,g=i.length,p=Ft(t.padding);let y=p.height,x=0,w=i.reduce((P,D)=>P+D.before.length+D.lines.length+D.after.length,0);if(w+=n.beforeBody.length+n.afterBody.length,d&&(y+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),w){const P=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*P+(w-g)*l.lineHeight+(w-1)*t.bodySpacing}h&&(y+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const M=function(P){x=Math.max(x,e.measureText(P).width+v)};return e.save(),e.font=c.string,dt(n.title,M),e.font=l.string,dt(n.beforeBody.concat(n.afterBody),M),v=t.displayColors?o+2+t.boxPadding:0,dt(i,P=>{dt(P.before,M),dt(P.lines,M),dt(P.after,M)}),v=0,e.font=u.string,dt(n.footer,M),e.restore(),x+=p.width,{width:x,height:y}}function oy(n,t){const{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function ay(n,t,e,i){const{x:s,width:r}=i,o=e.caretSize+e.caretPadding;if(n==="left"&&s+r+o>t.width||n==="right"&&s-r-o<0)return!0}function ly(n,t,e,i){const{x:s,width:r}=e,{width:o,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=r/2?c="left":s>=o-r/2&&(c="right"),ay(c,n,t,e)&&(c="center"),c}function Cc(n,t,e){const i=e.yAlign||t.yAlign||oy(n,e);return{xAlign:e.xAlign||t.xAlign||ly(n,t,e,i),yAlign:i}}function cy(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function uy(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Pc(n,t,e,i){const{caretSize:s,caretPadding:r,cornerRadius:o}=n,{xAlign:a,yAlign:l}=e,c=s+r,{topLeft:u,topRight:d,bottomLeft:h,bottomRight:g}=Je(o);let p=cy(t,a);const y=uy(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+s:a==="right"&&(p+=Math.max(d,g)+s),{x:Ht(p,0,i.width-t.width),y:Ht(y,0,i.height-t.height)}}function Es(n,t,e){const i=Ft(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Oc(n){return Te([],Be(n))}function dy(n,t,e){return tn(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Ec(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const Ac={beforeTitle:Re,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Re,beforeBody:Re,beforeLabel:Re,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");const e=n.formattedValue;return tt(e)||(t+=e),t},labelColor(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Re,afterBody:Re,beforeFooter:Re,footer:Re,afterFooter:Re};function te(n,t,e,i){const s=n[t].call(e,i);return typeof s>"u"?Ac[t].call(e,i):s}class ro extends Yt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,r=new zr(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=dy(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=te(i,"beforeTitle",this,t),r=te(i,"title",this,t),o=te(i,"afterTitle",this,t);let a=[];return a=Te(a,Be(s)),a=Te(a,Be(r)),a=Te(a,Be(o)),a}getBeforeBody(t,e){return Oc(te(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return dt(t,r=>{const o={before:[],lines:[],after:[]},a=Ec(i,r);Te(o.before,Be(te(a,"beforeLabel",this,r))),Te(o.lines,te(a,"label",this,r)),Te(o.after,Be(te(a,"afterLabel",this,r))),s.push(o)}),s}getAfterBody(t,e){return Oc(te(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=te(i,"beforeFooter",this,t),r=te(i,"footer",this,t),o=te(i,"afterFooter",this,t);let a=[];return a=Te(a,Be(s)),a=Te(a,Be(r)),a=Te(a,Be(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],r=[],o=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(ry(this.chart,e[l]));return t.filter&&(a=a.filter((u,d,h)=>t.filter(u,d,h,i))),t.itemSort&&(a=a.sort((u,d)=>t.itemSort(u,d,i))),dt(a,u=>{const d=Ec(t.callbacks,u);s.push(te(d,"labelColor",this,u)),r.push(te(d,"labelPointStyle",this,u)),o.push(te(d,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=r,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let r,o=[];if(!s.length)this.opacity!==0&&(r={opacity:0});else{const a=Ai[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=Tc(this,i),c=Object.assign({},a,l),u=Cc(this.chart,i,c),d=Pc(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,r={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const r=this.getCaretPosition(t,i,s);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:r}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Je(a),{x:h,y:g}=t,{width:p,height:y}=e;let x,w,v,M,P,D;return r==="center"?(P=g+y/2,s==="left"?(x=h,w=x-o,M=P+o,D=P-o):(x=h+p,w=x+o,M=P-o,D=P+o),v=x):(s==="left"?w=h+Math.max(l,u)+o:s==="right"?w=h+p-Math.max(c,d)-o:w=this.caretX,r==="top"?(M=g,P=M-o,x=w-o,v=w+o):(M=g+y,P=M+o,x=w+o,v=w-o),D=M),{x1:x,x2:w,x3:v,y1:M,y2:P,y3:D}}drawTitle(t,e,i){const s=this.title,r=s.length;let o,a,l;if(r){const c=Yn(i.rtl,this.x,this.width);for(t.x=Es(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",o=xt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,l+1===r&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,r){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=r,u=xt(r.bodyFont),d=Es(this,"left",r),h=s.x(d),g=l<u.lineHeight?(u.lineHeight-l)/2:0,p=e.y+g;if(r.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=s.leftForLtr(h,c)+c/2,w=p+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Ar(t,y,x,w),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,Ar(t,y,x,w)}else{t.lineWidth=it(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const y=s.leftForLtr(h,c),x=s.leftForLtr(s.xPlus(h,1),c-2),w=Je(o.borderRadius);Object.values(w).some(v=>v!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,zn(t,{x:y,y:p,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),zn(t,{x,y:p+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(x,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:r,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,d=xt(i.bodyFont);let h=d.lineHeight,g=0;const p=Yn(i.rtl,this.x,this.width),y=function(b){e.fillText(b,p.x(t.x+g),t.y+h/2),t.y+=h+r},x=p.textAlign(o);let w,v,M,P,D,C,T;for(e.textAlign=o,e.textBaseline="middle",e.font=d.string,t.x=Es(this,x,i),e.fillStyle=i.bodyColor,dt(this.beforeBody,y),g=a&&x!=="right"?o==="center"?c/2+u:c+2+u:0,P=0,C=s.length;P<C;++P){for(w=s[P],v=this.labelTextColors[P],e.fillStyle=v,dt(w.before,y),M=w.lines,a&&M.length&&(this._drawColorBox(e,t,P,p,i),h=Math.max(d.lineHeight,l)),D=0,T=M.length;D<T;++D)y(M[D]),h=d.lineHeight;dt(w.after,y)}g=0,h=d.lineHeight,dt(this.afterBody,y),t.y-=r}drawFooter(t,e,i){const s=this.footer,r=s.length;let o,a;if(r){const l=Yn(i.rtl,this.x,this.width);for(t.x=Es(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",o=xt(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<r;++a)e.fillText(s[a],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:r,yAlign:o}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:h,bottomLeft:g,bottomRight:p}=Je(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+d,l),o==="top"&&this.drawCaret(t,e,i,s),e.lineTo(a+c-h,l),e.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(a+c,l+u-p),e.quadraticCurveTo(a+c,l+u,a+c-p,l+u),o==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(a+g,l+u),e.quadraticCurveTo(a,l+u,a,l+u-g),o==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(a,l+d),e.quadraticCurveTo(a,l,a+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){const o=Ai[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Tc(this,t),l=Object.assign({},o,this._size),c=Cc(e,t,l),u=Pc(t,l,c,e);(s._to!==u.x||r._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},r={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Ft(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(r,t,s,e),hl(t,e.textDirection),r.y+=o.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),fl(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),r=!ss(i,s),o=this._positionChanged(s,e);(r||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,r=this._active||[],o=this._getActiveElements(t,r,e,i),a=this._positionChanged(o,t),l=e||!ss(o,r)||a;return l&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const r=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,r.mode,r,i);return r.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:r}=this,o=Ai[r.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}}O(ro,"positioners",Ai);var As={id:"tooltip",_element:ro,positioners:Ai,afterInit(n,t,e){e&&(n.tooltip=new ro({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ac},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},hy=Object.freeze({__proto__:null,Colors:Sm,Decimation:Pm,Filler:Gm,Legend:ey,SubTitle:sy,Title:iy,Tooltip:As});const fy=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function gy(n,t,e,i){const s=n.indexOf(t);if(s===-1)return fy(n,t,e,i);const r=n.lastIndexOf(t);return s!==r?e:s}const py=(n,t)=>n===null?null:Ht(Math.round(n),0,t);function Rc(n){const t=this.getLabels();return n>=0&&n<t.length?t[n]:n}class oo extends Mn{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:r}of e)i[s]===r&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(tt(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:gy(i,t,Z(e,t),this._addedLabels),py(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){return Rc.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}O(oo,"id","category"),O(oo,"defaults",{ticks:{callback:Rc}});function my(n,t){const e=[],{bounds:s,step:r,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:h}=n,g=r||1,p=u-1,{min:y,max:x}=t,w=!tt(o),v=!tt(a),M=!tt(c),P=(x-y)/(d+1);let D=Fa((x-y)/p/g)*g,C,T,b,_;if(D<1e-14&&!w&&!v)return[{value:y},{value:x}];_=Math.ceil(x/D)-Math.floor(y/D),_>p&&(D=Fa(_*D/p/g)*g),tt(l)||(C=Math.pow(10,l),D=Math.ceil(D*C)/C),s==="ticks"?(T=Math.floor(y/D)*D,b=Math.ceil(x/D)*D):(T=y,b=x),w&&v&&r&&ff((a-o)/r,D/1e3)?(_=Math.round(Math.min((a-o)/D,u)),D=(a-o)/_,T=o,b=a):M?(T=w?o:T,b=v?a:b,_=c-1,D=(b-T)/_):(_=(b-T)/D,hi(_,Math.round(_),D/1e3)?_=Math.round(_):_=Math.ceil(_));const S=Math.max(za(D),za(T));C=Math.pow(10,tt(l)?S:l),T=Math.round(T*C)/C,b=Math.round(b*C)/C;let E=0;for(w&&(h&&T!==o?(e.push({value:o}),T<o&&E++,hi(Math.round((T+E*D)*C)/C,o,Lc(o,P,n))&&E++):T<o&&E++);E<_;++E){const R=Math.round((T+E*D)*C)/C;if(v&&R>a)break;e.push({value:R})}return v&&h&&b!==a?e.length&&hi(e[e.length-1].value,a,Lc(a,P,n))?e[e.length-1].value=a:e.push({value:a}):(!v||b===a)&&e.push({value:b}),e}function Lc(n,t,{horizontal:e,minRotation:i}){const s=Nt(i),r=(e?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+n).length;return Math.min(t/r,o)}class Rs extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return tt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:r}=this;const o=l=>s=e?s:l,a=l=>r=i?r:l;if(t){const l=Se(s),c=Se(r);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(s===r){let l=r===0?1:Math.abs(r*.05);a(r+l),t||o(s-l)}this.min=s,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},r=this._range||this,o=my(s,r);return t.bounds==="ticks"&&Ba(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return pi(t,this.chart.options.locale,this.options.ticks.format)}}class ao extends Rs{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Mt(t)?t:0,this.max=Mt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Nt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,r.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}O(ao,"id","linear"),O(ao,"defaults",{ticks:{callback:us.formatters.numeric}});const Ri=n=>Math.floor(Ze(n)),Sn=(n,t)=>Math.pow(10,Ri(n)+t);function Ic(n){return n/Math.pow(10,Ri(n))===1}function Nc(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function yy(n,t){const e=t-n;let i=Ri(e);for(;Nc(n,t,i)>10;)i++;for(;Nc(n,t,i)<10;)i--;return Math.min(i,Ri(n))}function by(n,{min:t,max:e}){t=ce(n.min,t);const i=[],s=Ri(t);let r=yy(t,e),o=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),l=s>r?Math.pow(10,s):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10;let d=Math.floor((c-u)/Math.pow(10,r)),h=ce(n.min,Math.round((l+u+d*Math.pow(10,r))*o)/o);for(;h<e;)i.push({value:h,major:Ic(h),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(r++,d=2,o=r>=0?1:o),h=Math.round((l+u+d*Math.pow(10,r))*o)/o;const g=ce(n.max,h);return i.push({value:g,major:Ic(g),significand:d}),i}class lo extends Mn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Rs.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return Mt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Mt(t)?Math.max(0,t):null,this.max=Mt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Mt(this._userMin)&&(this.min=t===Sn(this.min,0)?Sn(this.min,-1):Sn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const r=a=>i=t?i:a,o=a=>s=e?s:a;i===s&&(i<=0?(r(1),o(10)):(r(Sn(i,-1)),o(Sn(s,1)))),i<=0&&r(Sn(s,-1)),s<=0&&o(Sn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=by(e,this);return t.bounds==="ticks"&&Ba(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":pi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ze(t),this._valueRange=Ze(this.max)-Ze(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ze(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}O(lo,"id","logarithmic"),O(lo,"defaults",{ticks:{callback:us.formatters.logarithmic,major:{enabled:!0}}});function co(n){const t=n.ticks;if(t.display&&n.display){const e=Ft(t.backdropPadding);return Z(t.font&&t.font.size,Tt.font.size)+e.height}return 0}function xy(n,t,e){return e=at(e)?e:[e],{w:Of(n,t.string,e),h:e.length*t.lineHeight}}function Fc(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function _y(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],r=n._pointLabels.length,o=n.options.pointLabels,a=o.centerPointLabels?rt/r:0;for(let l=0;l<r;l++){const c=o.setContext(n.getPointLabelContext(l));s[l]=c.padding;const u=n.getPointPosition(l,n.drawingArea+s[l],a),d=xt(c.font),h=xy(n.ctx,d,n._pointLabels[l]);i[l]=h;const g=ue(n.getIndexAngle(l)+a),p=Math.round(ls(g)),y=Fc(p,u.x,h.w,0,180),x=Fc(p,u.y,h.h,90,270);wy(e,t,g,y,x)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=My(n,i,s)}function wy(n,t,e,i,s){const r=Math.abs(Math.sin(e)),o=Math.abs(Math.cos(e));let a=0,l=0;i.start<t.l?(a=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-a)):i.end>t.r&&(a=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+a)),s.start<t.t?(l=(t.t-s.start)/o,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/o,n.b=Math.max(n.b,t.b+l))}function vy(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:r,padding:o,size:a}=e,l=n.getPointPosition(t,i+s+o,r),c=Math.round(ls(ue(l.angle+bt))),u=Ty(l.y,a.h,c),d=Sy(c),h=Dy(l.x,a.w,d);return{visible:!0,x:l.x,y:u,textAlign:d,left:h,top:u,right:h+a.w,bottom:u+a.h}}function ky(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:r}=n;return!(Ne({x:e,y:i},t)||Ne({x:e,y:r},t)||Ne({x:s,y:i},t)||Ne({x:s,y:r},t))}function My(n,t,e){const i=[],s=n._pointLabels.length,r=n.options,{centerPointLabels:o,display:a}=r.pointLabels,l={extra:co(r)/2,additionalAngle:o?rt/s:0};let c;for(let u=0;u<s;u++){l.padding=e[u],l.size=t[u];const d=vy(n,u,l);i.push(d),a==="auto"&&(d.visible=ky(d,c),d.visible&&(c=d))}return i}function Sy(n){return n===0||n===180?"center":n<180?"left":"right"}function Dy(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function Ty(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function Cy(n,t,e){const{left:i,top:s,right:r,bottom:o}=e,{backdropColor:a}=t;if(!tt(a)){const l=Je(t.borderRadius),c=Ft(t.backdropPadding);n.fillStyle=a;const u=i-c.left,d=s-c.top,h=r-i+c.width,g=o-s+c.height;Object.values(l).some(p=>p!==0)?(n.beginPath(),zn(n,{x:u,y:d,w:h,h:g,radius:l}),n.fill()):n.fillRect(u,d,h,g)}}function Py(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const r=n._pointLabelItems[s];if(!r.visible)continue;const o=i.setContext(n.getPointLabelContext(s));Cy(e,o,r);const a=xt(o.font),{x:l,y:c,textAlign:u}=r;_n(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function Bc(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,yt);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let o=1;o<i;o++)r=n.getPointPosition(o,t),s.lineTo(r.x,r.y)}}function Oy(n,t,e,i,s){const r=n.ctx,o=t.circular,{color:a,lineWidth:l}=t;!o&&!i||!a||!l||e<0||(r.save(),r.strokeStyle=a,r.lineWidth=l,r.setLineDash(s.dash),r.lineDashOffset=s.dashOffset,r.beginPath(),Bc(n,e,o,i),r.closePath(),r.stroke(),r.restore())}function Ey(n,t,e){return tn(n,{label:e,index:t,type:"pointLabel"})}class Li extends Rs{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ft(co(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Mt(t)&&!isNaN(t)?t:0,this.max=Mt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/co(this.options))}generateTickLabels(t){Rs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=ut(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?_y(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=yt/(this._pointLabels.length||1),i=this.options.startAngle||0;return ue(t*e+Nt(i))}getDistanceFromCenterForValue(t){if(tt(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(tt(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return Ey(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-bt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Bc(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:r}=e,o=this._pointLabels.length;let a,l,c;if(e.pointLabels.display&&Py(this,o),s.display&&this.ticks.forEach((u,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(d),g=s.setContext(h),p=r.setContext(h);Oy(this,g,l,o,p)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=u;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let r,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=xt(c.font);if(r=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=Ft(c.backdropPadding);t.fillRect(-o/2-d.left,-r-u.size/2-d.top,o+d.width,u.size+d.height)}_n(t,a.label,0,-r,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}O(Li,"id","radialLinear"),O(Li,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:us.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),O(Li,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),O(Li,"descriptors",{angleLines:{_fallback:"grid"}});const Ls={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}},ee=Object.keys(Ls);function zc(n,t){return n-t}function Hc(n,t){if(tt(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Mt(o)||(o=typeof i=="string"?e.parse(o,i):e.parse(o)),o===null?null:(s&&(o=s==="week"&&(Qe(r)||r===!0)?e.startOf(o,"isoWeek",r):e.startOf(o,s)),+o)}function Wc(n,t,e,i){const s=ee.length;for(let r=ee.indexOf(n);r<s-1;++r){const o=Ls[ee[r]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((e-t)/(a*o.size))<=i)return ee[r]}return ee[s-1]}function Ay(n,t,e,i,s){for(let r=ee.length-1;r>=ee.indexOf(e);r--){const o=ee[r];if(Ls[o].common&&n._adapter.diff(s,i,o)>=t-1)return o}return ee[e?ee.indexOf(e):0]}function Ry(n){for(let t=ee.indexOf(n)+1,e=ee.length;t<e;++t)if(Ls[ee[t]].common)return ee[t]}function Yc(n,t,e){if(!e)n[t]=!0;else if(e.length){const{lo:i,hi:s}=Dr(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function Ly(n,t,e,i){const s=n._adapter,r=+s.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=r;a<=o;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function Vc(n,t,e){const i=[],s={},r=t.length;let o,a;for(o=0;o<r;++o)a=t[o],s[a]=o,i.push({value:a,major:!1});return r===0||!e?i:Ly(n,i,s,e)}class Ii extends Mn{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Al._date(t.adapters.date);s.init(e),di(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:Hc(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:r,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=Mt(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=Mt(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const r=this.min,o=this.max,a=yf(s,r,o);return this._unit=e.unit||(i.autoSkip?Wc(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):Ay(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ry(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),Vc(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=Ht(e,0,o),i=Ht(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,r=s.time,o=r.unit||Wc(r.minUnit,e,i,this._getLabelCapacity(e)),a=Z(s.ticks.stepSize,1),l=o==="week"?r.isoWeekday:!1,c=Qe(l)||l===!0,u={};let d=e,h,g;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(h=d,g=0;h<i;h=+t.add(h,a,o),g++)Yc(u,h,p);return(h===i||s.bounds==="ticks"||g===1)&&Yc(u,h,p),Object.keys(u).sort(zc).map(y=>+y)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,r=this._unit,o=e||s[r];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,s){const r=this.options,o=r.ticks.callback;if(o)return ut(o,[t,e,i],this);const a=r.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],d=c&&a[c],h=i[e],g=c&&d&&h&&h.major;return this._adapter.format(t,s||(g?d:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=Nt(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*r+a*o,h:i*o+a*r}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,Vc(this,[t],this._majorUnit),s),o=this._getLabelSize(r),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Hc(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Va(t.sort(zc))}}O(Ii,"id","time"),O(Ii,"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 Is(n,t,e){let i=0,s=n.length-1,r,o,a,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ie(n,"pos",t)),{pos:r,time:a}=n[i],{pos:o,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ie(n,"time",t)),{time:r,pos:a}=n[i],{time:o,pos:l}=n[s]);const c=o-r;return c?a+(l-a)*(t-r)/c:a}class uo extends Ii{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Is(e,this.min),this._tableRange=Is(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],r=[];let o,a,l,c,u;for(o=0,a=t.length;o<a;++o)c=t[o],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)u=s[o+1],l=s[o-1],c=s[o],Math.round((u+l)/2)!==c&&r.push({time:c,pos:o/(a-1)});return r}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,r)=>s-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Is(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Is(this._table,i*this._tableRange+this._minPos,!0)}}O(uo,"id","timeseries"),O(uo,"defaults",Ii.defaults);var Iy=Object.freeze({__proto__:null,CategoryScale:oo,LinearScale:ao,LogarithmicScale:lo,RadialLinearScale:Li,TimeScale:Ii,TimeSeriesScale:uo});const Ny=[$g,xm,hy,Iy],Fy=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],By=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],zy=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Hy=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],jc=(n,t,e)=>{let i=n;return typeof t=="string"||Array.isArray(t)?i=n.toLocaleString(t,e):(t===!0||e!==void 0)&&(i=n.toLocaleString(void 0,e)),i};function ho(n,t){if(!Number.isFinite(n))throw new TypeError(`Expected a finite number, got ${typeof n}: ${n}`);t={bits:!1,binary:!1,space:!0,...t};const e=t.bits?t.binary?Hy:zy:t.binary?By:Fy,i=t.space?" ":"";if(t.signed&&n===0)return` 0${i}${e[0]}`;const s=n<0,r=s?"-":t.signed?"+":"";s&&(n=-n);let o;if(t.minimumFractionDigits!==void 0&&(o={minimumFractionDigits:t.minimumFractionDigits}),t.maximumFractionDigits!==void 0&&(o={maximumFractionDigits:t.maximumFractionDigits,...o}),n<1){const u=jc(n,t.locale,o);return r+u+i+e[0]}const a=Math.min(Math.floor(t.binary?Math.log(n)/Math.log(1024):Math.log10(n)/3),e.length-1);n/=(t.binary?1024:1e3)**a,o||(n=n.toPrecision(3));const l=jc(Number(n),t.locale,o),c=e[a];return r+l+i+c}function G(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function _t(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function Ns(n,t){const e=G(n);return isNaN(t)?_t(n,NaN):(t&&e.setDate(e.getDate()+t),e)}function fo(n,t){const e=G(n);if(isNaN(t))return _t(n,NaN);if(!t)return e;const i=e.getDate(),s=_t(n,e.getTime());s.setMonth(e.getMonth()+t+1,0);const r=s.getDate();return i>=r?s:(e.setFullYear(s.getFullYear(),s.getMonth(),i),e)}function Fs(n,t){const e=+G(n);return _t(n,e+t)}const $c=6048e5,Wy=864e5,Ni=6e4,jn=36e5,Yy=1e3;function Vy(n,t){return Fs(n,t*jn)}let jy={};function Dn(){return jy}function Ce(n,t){var a,l,c,u;const e=Dn(),i=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,s=G(n),r=s.getDay(),o=(r<i?7:0)+r-i;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function $n(n){return Ce(n,{weekStartsOn:1})}function qc(n){const t=G(n),e=t.getFullYear(),i=_t(n,0);i.setFullYear(e+1,0,4),i.setHours(0,0,0,0);const s=$n(i),r=_t(n,0);r.setFullYear(e,0,4),r.setHours(0,0,0,0);const o=$n(r);return t.getTime()>=s.getTime()?e+1:t.getTime()>=o.getTime()?e:e-1}function go(n){const t=G(n);return t.setHours(0,0,0,0),t}function Bs(n){const t=G(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function Uc(n,t){const e=go(n),i=go(t),s=+e-Bs(e),r=+i-Bs(i);return Math.round((s-r)/Wy)}function $y(n){const t=qc(n),e=_t(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),$n(e)}function qy(n,t){return Fs(n,t*Ni)}function Uy(n,t){const e=t*3;return fo(n,e)}function Xy(n,t){return Fs(n,t*1e3)}function Gy(n,t){const e=t*7;return Ns(n,e)}function Ky(n,t){return fo(n,t*12)}function Fi(n,t){const e=G(n),i=G(t),s=e.getTime()-i.getTime();return s<0?-1:s>0?1:s}function Zy(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function po(n){if(!Zy(n)&&typeof n!="number")return!1;const t=G(n);return!isNaN(Number(t))}function Qy(n,t){const e=G(n),i=G(t),s=e.getFullYear()-i.getFullYear(),r=e.getMonth()-i.getMonth();return s*12+r}function Jy(n,t){const e=G(n),i=G(t);return e.getFullYear()-i.getFullYear()}function Xc(n,t){const e=G(n),i=G(t),s=Gc(e,i),r=Math.abs(Uc(e,i));e.setDate(e.getDate()-s*r);const o=+(Gc(e,i)===-s),a=s*(r-o);return a===0?0:a}function Gc(n,t){const e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function Bi(n){return t=>{const i=(n?Math[n]:Math.trunc)(t);return i===0?0:i}}function zs(n,t){return+G(n)-+G(t)}function tb(n,t,e){const i=zs(n,t)/jn;return Bi(e==null?void 0:e.roundingMethod)(i)}function eb(n,t,e){const i=zs(n,t)/Ni;return Bi(e==null?void 0:e.roundingMethod)(i)}function Kc(n){const t=G(n);return t.setHours(23,59,59,999),t}function Zc(n){const t=G(n),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(23,59,59,999),t}function nb(n){const t=G(n);return+Kc(t)==+Zc(t)}function Qc(n,t){const e=G(n),i=G(t),s=Fi(e,i),r=Math.abs(Qy(e,i));let o;if(r<1)o=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*r);let a=Fi(e,i)===-s;nb(G(n))&&r===1&&Fi(n,i)===1&&(a=!1),o=s*(r-Number(a))}return o===0?0:o}function ib(n,t,e){const i=Qc(n,t)/3;return Bi(e==null?void 0:e.roundingMethod)(i)}function sb(n,t,e){const i=zs(n,t)/1e3;return Bi(e==null?void 0:e.roundingMethod)(i)}function rb(n,t,e){const i=Xc(n,t)/7;return Bi(e==null?void 0:e.roundingMethod)(i)}function ob(n,t){const e=G(n),i=G(t),s=Fi(e,i),r=Math.abs(Jy(e,i));e.setFullYear(1584),i.setFullYear(1584);const o=Fi(e,i)===-s,a=s*(r-+o);return a===0?0:a}function ab(n){const t=G(n);return t.setSeconds(0,0),t}function lb(n){const t=G(n),e=t.getMonth(),i=e-e%3;return t.setMonth(i,1),t.setHours(0,0,0,0),t}function cb(n){const t=G(n);return t.setDate(1),t.setHours(0,0,0,0),t}function ub(n){const t=G(n),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function Jc(n){const t=G(n),e=_t(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}function db(n){const t=G(n);return t.setMinutes(59,59,999),t}function hb(n,t){var a,l;const e=Dn(),i=e.weekStartsOn??((l=(a=e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??0,s=G(n),r=s.getDay(),o=(r<i?-7:0)+6-(r-i);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function fb(n){const t=G(n);return t.setSeconds(59,999),t}function gb(n){const t=G(n),e=t.getMonth(),i=e-e%3+3;return t.setMonth(i,0),t.setHours(23,59,59,999),t}function pb(n){const t=G(n);return t.setMilliseconds(999),t}const mb={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},yb=(n,t,e)=>{let i;const s=mb[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function mo(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const bb={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xb={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_b={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},wb={date:mo({formats:bb,defaultWidth:"full"}),time:mo({formats:xb,defaultWidth:"full"}),dateTime:mo({formats:_b,defaultWidth:"full"})},vb={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kb=(n,t,e,i)=>vb[n];function zi(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=e!=null&&e.width?String(e.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const Mb={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Sb={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Db={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Tb={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Cb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Pb={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ob={ordinalNumber:(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},era:zi({values:Mb,defaultWidth:"wide"}),quarter:zi({values:Sb,defaultWidth:"wide",argumentCallback:n=>n-1}),month:zi({values:Db,defaultWidth:"wide"}),day:zi({values:Tb,defaultWidth:"wide"}),dayPeriod:zi({values:Cb,defaultWidth:"wide",formattingValues:Pb,defaultFormattingWidth:"wide"})};function Hi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?Ab(a,d=>d.test(o)):Eb(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function Eb(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Ab(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Rb(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const Lb=/^(\d+)(th|st|nd|rd)?/i,Ib=/\d+/i,Nb={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Fb={any:[/^b/i,/^(a|c)/i]},Bb={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zb={any:[/1/i,/2/i,/3/i,/4/i]},Hb={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Wb={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Yb={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Vb={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},jb={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},$b={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qb={ordinalNumber:Rb({matchPattern:Lb,parsePattern:Ib,valueCallback:n=>parseInt(n,10)}),era:Hi({matchPatterns:Nb,defaultMatchWidth:"wide",parsePatterns:Fb,defaultParseWidth:"any"}),quarter:Hi({matchPatterns:Bb,defaultMatchWidth:"wide",parsePatterns:zb,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Hi({matchPatterns:Hb,defaultMatchWidth:"wide",parsePatterns:Wb,defaultParseWidth:"any"}),day:Hi({matchPatterns:Yb,defaultMatchWidth:"wide",parsePatterns:Vb,defaultParseWidth:"any"}),dayPeriod:Hi({matchPatterns:jb,defaultMatchWidth:"any",parsePatterns:$b,defaultParseWidth:"any"})},tu={code:"en-US",formatDistance:yb,formatLong:wb,formatRelative:kb,localize:Ob,match:qb,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ub(n){const t=G(n);return Uc(t,Jc(t))+1}function eu(n){const t=G(n),e=+$n(t)-+$y(t);return Math.round(e/$c)+1}function yo(n,t){var u,d,h,g;const e=G(n),i=e.getFullYear(),s=Dn(),r=(t==null?void 0:t.firstWeekContainsDate)??((d=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(h=s.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,o=_t(n,0);o.setFullYear(i+1,0,r),o.setHours(0,0,0,0);const a=Ce(o,t),l=_t(n,0);l.setFullYear(i,0,r),l.setHours(0,0,0,0);const c=Ce(l,t);return e.getTime()>=a.getTime()?i+1:e.getTime()>=c.getTime()?i:i-1}function Xb(n,t){var a,l,c,u;const e=Dn(),i=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((u=(c=e.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,s=yo(n,t),r=_t(n,0);return r.setFullYear(s,0,i),r.setHours(0,0,0,0),Ce(r,t)}function nu(n,t){const e=G(n),i=+Ce(e,t)-+Xb(e,t);return Math.round(i/$c)+1}function ht(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const on={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ht(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ht(e+1,2)},d(n,t){return ht(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ht(n.getHours()%12||12,t.length)},H(n,t){return ht(n.getHours(),t.length)},m(n,t){return ht(n.getMinutes(),t.length)},s(n,t){return ht(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ht(s,t.length)}},qn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return on.y(n,t)},Y:function(n,t,e,i){const s=yo(n,i),r=s>0?s:1-s;if(t==="YY"){const o=r%100;return ht(o,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ht(r,t.length)},R:function(n,t){const e=qc(n);return ht(e,t.length)},u:function(n,t){const e=n.getFullYear();return ht(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return on.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=nu(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(n,t,e){const i=eu(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):on.d(n,t)},D:function(n,t,e){const i=Ub(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ht(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ht(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const s=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=qn.noon:i===0?s=qn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=qn.evening:i>=12?s=qn.afternoon:i>=4?s=qn.morning:s=qn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return on.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):on.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):on.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):on.s(n,t)},S:function(n,t){return on.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return ru(i);case"XXXX":case"XX":return Tn(i);case"XXXXX":case"XXX":default:return Tn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return ru(i);case"xxxx":case"xx":return Tn(i);case"xxxxx":case"xxx":default:return Tn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+su(i,":");case"OOOO":default:return"GMT"+Tn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+su(i,":");case"zzzz":default:return"GMT"+Tn(i,":")}},t:function(n,t,e){const i=Math.trunc(n.getTime()/1e3);return ht(i,t.length)},T:function(n,t,e){const i=n.getTime();return ht(i,t.length)}};function su(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ht(r,2)}function ru(n,t){return n%60===0?(n>0?"-":"+")+ht(Math.abs(n)/60,2):Tn(n,t)}function Tn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ht(Math.trunc(i/60),2),r=ht(i%60,2);return e+s+t+r}const ou=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},au=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},bo={p:au,P:(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return ou(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",ou(i,t)).replace("{{time}}",au(s,t))}},Gb=/^D+$/,Kb=/^Y+$/,Zb=["D","DD","YY","YYYY"];function lu(n){return Gb.test(n)}function cu(n){return Kb.test(n)}function xo(n,t,e){const i=Qb(n,t,e);if(console.warn(i),Zb.includes(n))throw new RangeError(i)}function Qb(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Jb=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,t0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,e0=/^'([^]*?)'?$/,n0=/''/g,i0=/[a-zA-Z]/;function uu(n,t,e){var u,d,h,g,p,y,x,w;const i=Dn(),s=(e==null?void 0:e.locale)??i.locale??tu,r=(e==null?void 0:e.firstWeekContainsDate)??((d=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??i.firstWeekContainsDate??((g=(h=i.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,o=(e==null?void 0:e.weekStartsOn)??((y=(p=e==null?void 0:e.locale)==null?void 0:p.options)==null?void 0:y.weekStartsOn)??i.weekStartsOn??((w=(x=i.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=G(n);if(!po(a))throw new RangeError("Invalid time value");let l=t.match(t0).map(v=>{const M=v[0];if(M==="p"||M==="P"){const P=bo[M];return P(v,s.formatLong)}return v}).join("").match(Jb).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:s0(v)};if(iu[M])return{isToken:!0,value:v};if(M.match(i0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:r,weekStartsOn:o,locale:s};return l.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&cu(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&lu(M))&&xo(M,t,String(n));const P=iu[M[0]];return P(a,M,s.localize,c)}).join("")}function s0(n){const t=n.match(e0);return t?t[1].replace(n0,"'"):n}function r0(){return Object.assign({},Dn())}function o0(n){let e=G(n).getDay();return e===0&&(e=7),e}function a0(n,t){const e=t instanceof Date?_t(t,0):new t(0);return e.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),e.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),e}const l0=10;class du{constructor(){O(this,"subPriority",0)}validate(t,e){return!0}}class c0 extends du{constructor(t,e,i,s,r){super(),this.value=t,this.validateValue=e,this.setValue=i,this.priority=s,r&&(this.subPriority=r)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,i){return this.setValue(t,e,this.value,i)}}class u0 extends du{constructor(){super(...arguments);O(this,"priority",l0);O(this,"subPriority",-1)}set(e,i){return i.timestampIsSet?e:_t(e,a0(e,Date))}}class lt{run(t,e,i,s){const r=this.parse(t,e,i,s);return r?{setter:new c0(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(t,e,i){return!0}}class d0 extends lt{constructor(){super(...arguments);O(this,"priority",140);O(this,"incompatibleTokens",["R","u","t","T"])}parse(e,i,s){switch(i){case"G":case"GG":case"GGG":return s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"});case"GGGGG":return s.era(e,{width:"narrow"});case"GGGG":default:return s.era(e,{width:"wide"})||s.era(e,{width:"abbreviated"})||s.era(e,{width:"narrow"})}}set(e,i,s){return i.era=s,e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}const Lt={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pe={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function It(n,t){return n&&{value:t(n.value),rest:n.rest}}function Ct(n,t){const e=t.match(n);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function Oe(n,t){const e=t.match(n);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};const i=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,o=e[5]?parseInt(e[5],10):0;return{value:i*(s*jn+r*Ni+o*Yy),rest:t.slice(e[0].length)}}function hu(n){return Ct(Lt.anyDigitsSigned,n)}function Et(n,t){switch(n){case 1:return Ct(Lt.singleDigit,t);case 2:return Ct(Lt.twoDigits,t);case 3:return Ct(Lt.threeDigits,t);case 4:return Ct(Lt.fourDigits,t);default:return Ct(new RegExp("^\\d{1,"+n+"}"),t)}}function Hs(n,t){switch(n){case 1:return Ct(Lt.singleDigitSigned,t);case 2:return Ct(Lt.twoDigitsSigned,t);case 3:return Ct(Lt.threeDigitsSigned,t);case 4:return Ct(Lt.fourDigitsSigned,t);default:return Ct(new RegExp("^-?\\d{1,"+n+"}"),t)}}function _o(n){switch(n){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function fu(n,t){const e=t>0,i=e?t:1-t;let s;if(i<=50)s=n||100;else{const r=i+50,o=Math.trunc(r/100)*100,a=n>=r%100;s=n+o-(a?100:0)}return e?s:1-s}function gu(n){return n%400===0||n%4===0&&n%100!==0}class h0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(e,i,s){const r=o=>({year:o,isTwoDigitYear:i==="yy"});switch(i){case"y":return It(Et(4,e),r);case"yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s){const r=e.getFullYear();if(s.isTwoDigitYear){const a=fu(s.year,r);return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}const o=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}}class f0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(e,i,s){const r=o=>({year:o,isTwoDigitYear:i==="YY"});switch(i){case"Y":return It(Et(4,e),r);case"Yo":return It(s.ordinalNumber(e,{unit:"year"}),r);default:return It(Et(i.length,e),r)}}validate(e,i){return i.isTwoDigitYear||i.year>0}set(e,i,s,r){const o=yo(e,r);if(s.isTwoDigitYear){const l=fu(s.year,o);return e.setFullYear(l,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}const a=!("era"in i)||i.era===1?s.year:1-s.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Ce(e,r)}}class g0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(e,i){return Hs(i==="R"?4:i.length,e)}set(e,i,s){const r=_t(e,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),$n(r)}}class p0 extends lt{constructor(){super(...arguments);O(this,"priority",130);O(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(e,i){return Hs(i==="u"?4:i.length,e)}set(e,i,s){return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class m0 extends lt{constructor(){super(...arguments);O(this,"priority",120);O(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"Q":case"QQ":return Et(i.length,e);case"Qo":return s.ordinalNumber(e,{unit:"quarter"});case"QQQ":return s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(e,{width:"wide",context:"formatting"})||s.quarter(e,{width:"abbreviated",context:"formatting"})||s.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class y0 extends lt{constructor(){super(...arguments);O(this,"priority",120);O(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"q":case"qq":return Et(i.length,e);case"qo":return s.ordinalNumber(e,{unit:"quarter"});case"qqq":return s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(e,{width:"wide",context:"standalone"})||s.quarter(e,{width:"abbreviated",context:"standalone"})||s.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=1&&i<=4}set(e,i,s){return e.setMonth((s-1)*3,1),e.setHours(0,0,0,0),e}}class b0 extends lt{constructor(){super(...arguments);O(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);O(this,"priority",110)}parse(e,i,s){const r=o=>o-1;switch(i){case"M":return It(Ct(Lt.month,e),r);case"MM":return It(Et(2,e),r);case"Mo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"MMM":return s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(e,{width:"wide",context:"formatting"})||s.month(e,{width:"abbreviated",context:"formatting"})||s.month(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}class x0 extends lt{constructor(){super(...arguments);O(this,"priority",110);O(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(e,i,s){const r=o=>o-1;switch(i){case"L":return It(Ct(Lt.month,e),r);case"LL":return It(Et(2,e),r);case"Lo":return It(s.ordinalNumber(e,{unit:"month"}),r);case"LLL":return s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(e,{width:"wide",context:"standalone"})||s.month(e,{width:"abbreviated",context:"standalone"})||s.month(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.setMonth(s,1),e.setHours(0,0,0,0),e}}function _0(n,t,e){const i=G(n),s=nu(i,e)-t;return i.setDate(i.getDate()-s*7),i}class w0 extends lt{constructor(){super(...arguments);O(this,"priority",100);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(e,i,s){switch(i){case"w":return Ct(Lt.week,e);case"wo":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s,r){return Ce(_0(e,s,r),r)}}function v0(n,t){const e=G(n),i=eu(e)-t;return e.setDate(e.getDate()-i*7),e}class k0 extends lt{constructor(){super(...arguments);O(this,"priority",100);O(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(e,i,s){switch(i){case"I":return Ct(Lt.week,e);case"Io":return s.ordinalNumber(e,{unit:"week"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=53}set(e,i,s){return $n(v0(e,s))}}const M0=[31,28,31,30,31,30,31,31,30,31,30,31],S0=[31,29,31,30,31,30,31,31,30,31,30,31];class D0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"subPriority",1);O(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"d":return Ct(Lt.date,e);case"do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear(),r=gu(s),o=e.getMonth();return r?i>=1&&i<=S0[o]:i>=1&&i<=M0[o]}set(e,i,s){return e.setDate(s),e.setHours(0,0,0,0),e}}class T0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"subpriority",1);O(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(e,i,s){switch(i){case"D":case"DD":return Ct(Lt.dayOfYear,e);case"Do":return s.ordinalNumber(e,{unit:"date"});default:return Et(i.length,e)}}validate(e,i){const s=e.getFullYear();return gu(s)?i>=1&&i<=366:i>=1&&i<=365}set(e,i,s){return e.setMonth(0,s),e.setHours(0,0,0,0),e}}function wo(n,t,e){var d,h,g,p;const i=Dn(),s=(e==null?void 0:e.weekStartsOn)??((h=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??i.weekStartsOn??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.weekStartsOn)??0,r=G(n),o=r.getDay(),l=(t%7+7)%7,c=7-s,u=t<0||t>6?t-(o+c)%7:(l+c)%7-(o+c)%7;return Ns(r,u)}class C0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(e,i,s){switch(i){case"E":case"EE":case"EEE":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}class P0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(e,i,s,r){const o=a=>{const l=Math.floor((a-1)/7)*7;return(a+r.weekStartsOn+6)%7+l};switch(i){case"e":case"ee":return It(Et(i.length,e),o);case"eo":return It(s.ordinalNumber(e,{unit:"day"}),o);case"eee":return s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeeee":return s.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}class O0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(e,i,s,r){const o=a=>{const l=Math.floor((a-1)/7)*7;return(a+r.weekStartsOn+6)%7+l};switch(i){case"c":case"cc":return It(Et(i.length,e),o);case"co":return It(s.ordinalNumber(e,{unit:"day"}),o);case"ccc":return s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"ccccc":return s.day(e,{width:"narrow",context:"standalone"});case"cccccc":return s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(e,{width:"wide",context:"standalone"})||s.day(e,{width:"abbreviated",context:"standalone"})||s.day(e,{width:"short",context:"standalone"})||s.day(e,{width:"narrow",context:"standalone"})}}validate(e,i){return i>=0&&i<=6}set(e,i,s,r){return e=wo(e,s,r),e.setHours(0,0,0,0),e}}function E0(n,t){const e=G(n),i=o0(e),s=t-i;return Ns(e,s)}class A0 extends lt{constructor(){super(...arguments);O(this,"priority",90);O(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(e,i,s){const r=o=>o===0?7:o;switch(i){case"i":case"ii":return Et(i.length,e);case"io":return s.ordinalNumber(e,{unit:"day"});case"iii":return It(s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return It(s.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return It(s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r);case"iiii":default:return It(s.day(e,{width:"wide",context:"formatting"})||s.day(e,{width:"abbreviated",context:"formatting"})||s.day(e,{width:"short",context:"formatting"})||s.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,i){return i>=1&&i<=7}set(e,i,s){return e=E0(e,s),e.setHours(0,0,0,0),e}}class R0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(e,i,s){switch(i){case"a":case"aa":case"aaa":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class L0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(e,i,s){switch(i){case"b":case"bb":case"bbb":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class I0 extends lt{constructor(){super(...arguments);O(this,"priority",80);O(this,"incompatibleTokens",["a","b","t","T"])}parse(e,i,s){switch(i){case"B":case"BB":case"BBB":return s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(e,{width:"wide",context:"formatting"})||s.dayPeriod(e,{width:"abbreviated",context:"formatting"})||s.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,i,s){return e.setHours(_o(s),0,0,0),e}}class N0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["H","K","k","t","T"])}parse(e,i,s){switch(i){case"h":return Ct(Lt.hour12h,e);case"ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=12}set(e,i,s){const r=e.getHours()>=12;return r&&s<12?e.setHours(s+12,0,0,0):!r&&s===12?e.setHours(0,0,0,0):e.setHours(s,0,0,0),e}}class F0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(e,i,s){switch(i){case"H":return Ct(Lt.hour23h,e);case"Ho":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=23}set(e,i,s){return e.setHours(s,0,0,0),e}}class B0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["h","H","k","t","T"])}parse(e,i,s){switch(i){case"K":return Ct(Lt.hour11h,e);case"Ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=11}set(e,i,s){return e.getHours()>=12&&s<12?e.setHours(s+12,0,0,0):e.setHours(s,0,0,0),e}}class z0 extends lt{constructor(){super(...arguments);O(this,"priority",70);O(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(e,i,s){switch(i){case"k":return Ct(Lt.hour24h,e);case"ko":return s.ordinalNumber(e,{unit:"hour"});default:return Et(i.length,e)}}validate(e,i){return i>=1&&i<=24}set(e,i,s){const r=s<=24?s%24:s;return e.setHours(r,0,0,0),e}}class H0 extends lt{constructor(){super(...arguments);O(this,"priority",60);O(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"m":return Ct(Lt.minute,e);case"mo":return s.ordinalNumber(e,{unit:"minute"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setMinutes(s,0,0),e}}class W0 extends lt{constructor(){super(...arguments);O(this,"priority",50);O(this,"incompatibleTokens",["t","T"])}parse(e,i,s){switch(i){case"s":return Ct(Lt.second,e);case"so":return s.ordinalNumber(e,{unit:"second"});default:return Et(i.length,e)}}validate(e,i){return i>=0&&i<=59}set(e,i,s){return e.setSeconds(s,0),e}}class Y0 extends lt{constructor(){super(...arguments);O(this,"priority",30);O(this,"incompatibleTokens",["t","T"])}parse(e,i){const s=r=>Math.trunc(r*Math.pow(10,-i.length+3));return It(Et(i.length,e),s)}set(e,i,s){return e.setMilliseconds(s),e}}class V0 extends lt{constructor(){super(...arguments);O(this,"priority",10);O(this,"incompatibleTokens",["t","T","x"])}parse(e,i){switch(i){case"X":return Oe(Pe.basicOptionalMinutes,e);case"XX":return Oe(Pe.basic,e);case"XXXX":return Oe(Pe.basicOptionalSeconds,e);case"XXXXX":return Oe(Pe.extendedOptionalSeconds,e);case"XXX":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:_t(e,e.getTime()-Bs(e)-s)}}class j0 extends lt{constructor(){super(...arguments);O(this,"priority",10);O(this,"incompatibleTokens",["t","T","X"])}parse(e,i){switch(i){case"x":return Oe(Pe.basicOptionalMinutes,e);case"xx":return Oe(Pe.basic,e);case"xxxx":return Oe(Pe.basicOptionalSeconds,e);case"xxxxx":return Oe(Pe.extendedOptionalSeconds,e);case"xxx":default:return Oe(Pe.extended,e)}}set(e,i,s){return i.timestampIsSet?e:_t(e,e.getTime()-Bs(e)-s)}}class $0 extends lt{constructor(){super(...arguments);O(this,"priority",40);O(this,"incompatibleTokens","*")}parse(e){return hu(e)}set(e,i,s){return[_t(e,s*1e3),{timestampIsSet:!0}]}}class q0 extends lt{constructor(){super(...arguments);O(this,"priority",20);O(this,"incompatibleTokens","*")}parse(e){return hu(e)}set(e,i,s){return[_t(e,s),{timestampIsSet:!0}]}}const U0={G:new d0,y:new h0,Y:new f0,R:new g0,u:new p0,Q:new m0,q:new y0,M:new b0,L:new x0,w:new w0,I:new k0,d:new D0,D:new T0,E:new C0,e:new P0,c:new O0,i:new A0,a:new R0,b:new L0,B:new I0,h:new N0,H:new F0,K:new B0,k:new z0,m:new H0,s:new W0,S:new Y0,X:new V0,x:new j0,t:new $0,T:new q0},X0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,G0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,K0=/^'([^]*?)'?$/,Z0=/''/g,Q0=/\S/,J0=/[a-zA-Z]/;function tx(n,t,e,i){var y,x,w,v,M,P,D,C;const s=r0(),r=(i==null?void 0:i.locale)??s.locale??tu,o=(i==null?void 0:i.firstWeekContainsDate)??((x=(y=i==null?void 0:i.locale)==null?void 0:y.options)==null?void 0:x.firstWeekContainsDate)??s.firstWeekContainsDate??((v=(w=s.locale)==null?void 0:w.options)==null?void 0:v.firstWeekContainsDate)??1,a=(i==null?void 0:i.weekStartsOn)??((P=(M=i==null?void 0:i.locale)==null?void 0:M.options)==null?void 0:P.weekStartsOn)??s.weekStartsOn??((C=(D=s.locale)==null?void 0:D.options)==null?void 0:C.weekStartsOn)??0;if(t==="")return n===""?G(e):_t(e,NaN);const l={firstWeekContainsDate:o,weekStartsOn:a,locale:r},c=[new u0],u=t.match(G0).map(T=>{const b=T[0];if(b in bo){const _=bo[b];return _(T,r.formatLong)}return T}).join("").match(X0),d=[];for(let T of u){!(i!=null&&i.useAdditionalWeekYearTokens)&&cu(T)&&xo(T,t,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&lu(T)&&xo(T,t,n);const b=T[0],_=U0[b];if(_){const{incompatibleTokens:S}=_;if(Array.isArray(S)){const R=d.find(F=>S.includes(F.token)||F.token===b);if(R)throw new RangeError(`The format string mustn't contain \`${R.fullToken}\` and \`${T}\` at the same time`)}else if(_.incompatibleTokens==="*"&&d.length>0)throw new RangeError(`The format string mustn't contain \`${T}\` and any other token at the same time`);d.push({token:b,fullToken:T});const E=_.run(n,T,r.match,l);if(!E)return _t(e,NaN);c.push(E.setter),n=E.rest}else{if(b.match(J0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");if(T==="''"?T="'":b==="'"&&(T=ex(T)),n.indexOf(T)===0)n=n.slice(T.length);else return _t(e,NaN)}}if(n.length>0&&Q0.test(n))return _t(e,NaN);const h=c.map(T=>T.priority).sort((T,b)=>b-T).filter((T,b,_)=>_.indexOf(T)===b).map(T=>c.filter(b=>b.priority===T).sort((b,_)=>_.subPriority-b.subPriority)).map(T=>T[0]);let g=G(e);if(isNaN(g.getTime()))return _t(e,NaN);const p={};for(const T of h){if(!T.validate(g,l))return _t(e,NaN);const b=T.set(g,p,l);Array.isArray(b)?(g=b[0],Object.assign(p,b[1])):g=b}return _t(e,g)}function ex(n){return n.match(K0)[1].replace(Z0,"'")}function nx(n){const t=G(n);return t.setMinutes(0,0,0),t}function ix(n){const t=G(n);return t.setMilliseconds(0),t}function sx(n){const t=n/jn;return Math.trunc(t)}function pu(n,t){const e=(t==null?void 0:t.additionalDigits)??2,i=lx(n);let s;if(i.date){const l=cx(i.date,e);s=ux(l.restDateString,l.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const r=s.getTime();let o=0,a;if(i.time&&(o=dx(i.time),isNaN(o)))return new Date(NaN);if(i.timezone){if(a=hx(i.timezone),isNaN(a))return new Date(NaN)}else{const l=new Date(r+o),c=new Date(0);return c.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),c.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),c}return new Date(r+o+a)}const Ws={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},rx=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ox=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,ax=/^([+-])(\d{2})(?::?(\d{2}))?$/;function lx(n){const t={},e=n.split(Ws.dateTimeDelimiter);let i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Ws.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Ws.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){const s=Ws.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function cx(n,t){const e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,r=i[2]?parseInt(i[2]):null;return{year:r===null?s:r*100,restDateString:n.slice((i[1]||i[2]).length)}}function ux(n,t){if(t===null)return new Date(NaN);const e=n.match(rx);if(!e)return new Date(NaN);const i=!!e[4],s=Wi(e[1]),r=Wi(e[2])-1,o=Wi(e[3]),a=Wi(e[4]),l=Wi(e[5])-1;if(i)return yx(t,a,l)?fx(t,a,l):new Date(NaN);{const c=new Date(0);return!px(t,r,o)||!mx(t,s)?new Date(NaN):(c.setUTCFullYear(t,r,Math.max(s,o)),c)}}function Wi(n){return n?parseInt(n):1}function dx(n){const t=n.match(ox);if(!t)return NaN;const e=vo(t[1]),i=vo(t[2]),s=vo(t[3]);return bx(e,i,s)?e*jn+i*Ni+s*1e3:NaN}function vo(n){return n&&parseFloat(n.replace(",","."))||0}function hx(n){if(n==="Z")return 0;const t=n.match(ax);if(!t)return 0;const e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return xx(i,s)?e*(i*jn+s*Ni):NaN}function fx(n,t,e){const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const gx=[31,null,31,30,31,30,31,31,30,31,30,31];function mu(n){return n%400===0||n%4===0&&n%100!==0}function px(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(gx[t]||(mu(n)?29:28))}function mx(n,t){return t>=1&&t<=(mu(n)?366:365)}function yx(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function bx(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function xx(n,t){return t>=0&&t<=59}const ko=(n,t)=>{var s,r;const{tooltip:e}=t;if(e.opacity===0&&!n.locked){n.showTooltip=!1;return}const i=n.chartTooltipSortFn||((o,a)=>a.rawValue-o.rawValue);if(e.body&&!n.locked){const o=e.labelColors,a=((r=(s=t.chart.config)==null?void 0:s.options)==null?void 0:r.indexAxis)==="y"?"x":"y",l=["horizontal_bar","vertical_bar"].includes(n.chartType),c=["gauge","doughnut"].includes(n.chartType);n.tooltipContext=l?e.dataPoints.length>1?e.dataPoints[0].label:"":e.dataPoints[0].parsed.x,n.tooltipSeries=e.dataPoints.map((u,d)=>{const h=c?u.parsed:u.parsed[a];let g;if(n.units==="bytes")g=isNaN(h)?h:ho(h);else{const y=n.translateUnit(n.units,h);g=`${n.units==="usd"?"$":""}${h%1===0?Ys.format(h):Ys.format(Number(h.toFixed(bu)))} ${y}`}const p=l&&u.dataset.label!==u.label?u.dataset.label:c?u.dataset.labels[u.dataIndex]:u.dataset.label;return{backgroundColor:o[d].backgroundColor,borderColor:o[d].borderColor,label:p,value:g,rawValue:h}}).sort(i),n.left=`${e.x}px`,n.top=`${e.y}px`,n.showTooltip=!0}},_x=n=>n&&n.datasets&&n.datasets.length,wx=n=>_x(n)&&n.datasets.some(t=>t.data.length),vx=n=>wx(n)&&n.datasets.some(t=>t.data.length>1),kx=n=>vx(n)&&n.datasets.some(t=>t.data[0]&&po(t.data[0].x)),Mx=n=>kx(n)&&n.datasets.some(t=>t.data[0]&&t.data[0].x.toString().length>=13),Mo=(n,t,e)=>{const s=Math.min(t/1150,1);return n.x<e?n.x+t*.15*(1-s):n.x-t*1.15*(1-s)},Sx=(n,t,e)=>n.y<e?n.y+t*.15:n.y-t*.5;function yu(n,t){let e;return(...i)=>{clearTimeout(e),e=window.setTimeout(()=>{n(...i)},t)}}const bu=2,xu=10,_u=12,Ys=new Intl.NumberFormat(((xh=document==null?void 0:document.documentElement)==null?void 0:xh.lang)||"en-US"),Vs=10,wu={"1XXCount|1XX|1[0-9][0-9]":{solid:"#0072E5",light:"#4DA6FF",description:"Informational"},"SuccessfulRequests|2XXCount|2XX|2[0-9][0-9]|SUCCESS":{solid:"#0BB652",light:"#6FCC83",description:"Success"},"3XXCount|3XX|3[0-9][0-9]":{solid:"#FDC53B",light:"#FFD982",description:"Redirection"},"4XXCount|4XX|4[0-9][0-9]":{solid:"#FE9439",light:"#FFBA81",description:"Client Errors"},"5XXCount|5XX|5[0-9][0-9]":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},"errorCount|FailedRequests|FAILURE":{solid:"#FF4545",light:"#FF8484",description:"Server Errors"},nonStandard:{solid:"#6f7787",light:"#e7e7ec"},standard:{solid:"#1155cb",light:"#8ab3fa"},p99:{solid:"#1356cb",light:"#1356cb"},p95:{solid:"#1fbecd",light:"#1fbecd"},p50:{solid:"#1df97d",light:"#1df97d"},LatencyP99:{solid:"#1356cb",light:"#1356cb"},LatencyP95:{solid:"#1fbecd",light:"#1fbecd"},LatencyP50:{solid:"#1df97d",light:"#1df97d"}},ze=["#a86cd5","#6a86d2","#00bbf9","#00c4b0","#ffdf15"],Un=(n,t)=>(t||ze)[n%ze.length],vu=(n,t)=>{n[0]==="#"&&(n=n.slice(1));let e=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);e=e-t,i=i-t,s=s-t,e>255?e=255:e<0&&(e=0),i>255?i=255:i<0&&(i=0),s>255?s=255:s<0&&(s=0);const r=e.toString(16).length===1?"0"+e.toString(16):e.toString(16),o=i.toString(16).length===1?"0"+i.toString(16):i.toString(16),a=s.toString(16).length===1?"0"+s.toString(16):s.toString(16);return`#${r}${o}${a}`},ku="#6f7787",Mu={100:{background:"#f0f5fd",text:"#10599e"},200:{background:"#e5f7f4",text:"#1b6955"},300:{background:"#fff1d5",text:"#a06027"},400:{background:"#fee3b6",text:"#944d19"},500:{background:"#fedada",text:"#852021"}},Dx=n=>{var e;const t=Math.floor(parseInt(n,10)/100)*100;return((e=Mu[t])==null?void 0:e.background)||"#fafafa"},Tx={SUCCESS:"#6FCC83",FAILURE:"#FF8484"},Cx={"4XX":"#FFBA81","5XX":"#FF8484"},Px={LatencyP99:"#1356cb",LatencyP95:"#1fbecd",LatencyP50:"#1df97d"},Ox="#dad4c7",Ex=n=>{const t=Object.entries(wu).find(([e])=>new RegExp(e).test(n));return t&&t[1]||wu.standard},Ax={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},Rx=2,Lx=0,So=new Map,Do=(n,t)=>t==="bytes"?ho(n):t==="count/minute"?n.toFixed(2):Ys.format(n),Su=n=>{const e=document.createElement("canvas").getContext("2d"),i=xt({});return e.font=i.string,e.measureText(n).width},Ix=()=>{const n="label_height";if(!So.has(n)){const t=xt({});So.set(n,t.lineHeight)}return So.get(n)},Nx=n=>n.datasets.reduce((t,e)=>t+e.data.reduce((i,s)=>isNaN(s)?i:i+s,0),0),Du=(n,t)=>t.datasets.reduce((e,i,s)=>n.isDatasetVisible(s)?e+i.data.reduce((r,o)=>isNaN(o)?r:r+o,0):e,0),Tu=(n,t)=>t===0?" (0.0%)":` (${(n/t*100).toFixed(1)}%)`,To="#e0e4ea",Fx={100:["#c8e2fd","#80bfff","#4da6ff","#1a8cff","#0072e5","#0059b2"],200:["#ceedd2","#9edca6","#89d595","#6fcc83","#44c26b","#0bb652","#0ca84a","#169643","#196e33","#1b572a"],300:["#fff4db","#ffe9b8","#ffe2a1","#ffd982","#ffd062","#fdc53b","#f4bb1e","#e8b00b","#d9a30f","#c89407"],400:["#ffead8","#ffd5b1","#ffc899","#ffba81","#ffae6b","#fe9439","#f6871d","#eb7c0c","#da700c","#cc6100"],500:["#ffd5d5","#ffb6b6","#ff9d9d","#ff8484","#ff6a6a","#ff4545","#fb1f1f","#e90b0b","#d40202","#be0202"]},Yi=(n,t)=>{let e=1;const i=Fx[n],s=new Map;for(const r of t)s.set(r,i[e]),e=e%(i.length-1)+1;return s.set(-1,i[0]),s},Cu=new Map([[100,Yi("100",[100,101,102,103])],[200,Yi("200",[200,201,202,203,204,205,206,207,208,226])],[300,Yi("300",[300,301,302,303,304,305,307,308])],[400,Yi("400",[400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,423,424,425,426,428,429,431,451])],[500,Yi("500",[500,501,502,503,504,505,506,507,508,510,511])]]),Co=n=>{const t=parseInt(n,10),e=Math.floor(t/100)*100,i=Cu.get(e);return i===void 0?To:i.get(t)??i.get(-1)??To},Bx=n=>{const t=Co(n);return{solid:t,light:t}},js={...Array.from({length:500},(n,t)=>100+t).reduce((n,t)=>(n[`${t}`]=Co(`${t}`),n),{}),____OTHER____:"#DAD4C7","1XX":"#4DA6FF","2XX":"#6FCC83","3XX":"#FFD982","4XX":"#FFBA81","5XX":"#FF8484"};function zx(n){const t={enabled:!1,position:"barChartTooltipPosition",callbacks:{label:s=>({label:s.dataset.label,value:s.label})}};As.positioners.barChartTooltipPosition=function(s,r){if(!s.length)return!1;const o=this.chart.canvas.getBoundingClientRect(),a=n.tooltipState.width||this.width,l=o.width/2,c=Mo(r,a,l),u=r.y,d=r.x<l?"left":"center";return{x:c-n.tooltipState.offsetX,y:u-n.tooltipState.offsetY,xAlign:d}},Ur.modes.customInteractionMode=function(s,r){const o=en(r,s),a=[];return Ur.evaluateInteractionItems(s,s.options.indexAxis||"x",o,(l,c,u)=>{s.options.indexAxis==="y"&&l.inYRange(o.y,!0)&&s.data.datasets[c].data[u]&&a.push({element:l,datasetIndex:c,index:u}),s.options.indexAxis==="x"&&l.inXRange(o.x,!0)&&s.data.datasets[c].data[u]&&a.push({element:l,datasetIndex:c,index:u})}),a};const e=n.numLabels.value>25?xu:_u;return f.computed(()=>{var s,r,o,a,l,c,u,d;return{indexAxis:n.indexAxis,skipNull:!0,scales:{x:{border:{display:!1},stacked:n.stacked.value,grid:{display:!1,drawBorder:!1},ticks:{maxRotation:90,autoSkip:!1,font:e,callback:function(h,g){const p=this;if(p.chart.options.indexAxis===p.axis){h=p.getLabelForValue(g);const y=10;return h&&h.length>y?h.slice(0,y)+"...":h}return p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="y"?!tt((s=n.metricAxesTitle)==null?void 0:s.value):!tt((r=n.dimensionAxesTitle)==null?void 0:r.value),text:n.indexAxis==="y"?(o=n.metricAxesTitle)==null?void 0:o.value:(a=n.dimensionAxesTitle)==null?void 0:a.value,padding:{top:10},font:{weight:"bold"}}},y:{border:{display:!1},stacked:n.stacked.value,beginAtZero:!0,grid:{display:!1,drawBorder:!1},ticks:{font:e,callback:function(h,g){const p=this;return p.chart.options.indexAxis===p.axis?(h=p.getLabelForValue(g),h&&h.length>Vs?h.slice(0,Vs)+"...":h):p.getLabelForValue(Number(h))}},title:{display:n.indexAxis==="x"?!tt((l=n.metricAxesTitle)==null?void 0:l.value):!tt((c=n.dimensionAxesTitle)==null?void 0:c.value),text:n.indexAxis==="x"?(u=n.metricAxesTitle)==null?void 0:u.value:(d=n.dimensionAxesTitle)==null?void 0:d.value,padding:{bottom:20},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:h=>{ko(n.tooltipState,h)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1}})}ge.register(...Ny);const Hx=(n,t)=>{const e=t.datasets.map(s=>s.label),i=n.datasets.map(s=>s.label);return n.datasets.length===t.datasets.length&&e.every((s,r)=>s===i[r])};function Wx(n,t,e,i,s){const r=f.shallowRef(null),o=(a,l)=>{if(t.value)return new ge(t.value,{type:n,data:a,plugins:i,options:l})};return f.onMounted(()=>{r.value=o(e.value,s.value)}),f.onBeforeUnmount(()=>{tt(r.value)||r.value.destroy()}),f.watch(e,(a,l)=>{if(Hx(l,a)&&!tt(r.value)){for(const[c,u]of a.datasets.entries())Object.assign(r.value.data.datasets[c],u);r.value.data.labels=a.labels,r.value.update()}else tt(r.value)||r.value.destroy(),r.value=o(a,s.value)}),f.watch(t,()=>{tt(r.value)||r.value.destroy(),r.value=o(e.value,s.value)}),f.watch(s,(a,l)=>{(a.indexAxis!==l.indexAxis||JSON.stringify(a.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(a.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(tt(r.value)||r.value.destroy(),r.value=o(e.value,a))}),r}var ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Po(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Pu={exports:{}};(function(n){(function(){function t(c,u){if(u.separator===!1||c<1e3)return c.toString();var d=typeof u.separator=="string"?u.separator:",",h=[],g=Math.round(c).toString().split("");return g.reverse().forEach(function(p,y){y&&y%3===0&&h.push(d),h.push(p)}),h.reverse().join("")}function e(c,u,d){var h=c/u,g=d.round?"round":"floor";return d.decimal===!1?(c=Math[g](h),c.toString()):(d.precision?c=h:c=h<10?Math[g](h*10)/10:Math[g](h),c=c.toString(),typeof d.decimal=="string"&&(c=c.replace(".",d.decimal)),c)}var i=1e3,s=1e4,r=1e6,o=1e9,a=1e12;function l(c,u){var d;u=u||{};var h=c<0;h&&(c=Math.abs(c)),u.precision&&(c=parseFloat(c.toPrecision(u.precision)));var g=u.min10k?s:i;return c<g||u.precision&&u.precision>Math.log10(c)?d=t(e(c,1,u),u):c<r?d=e(c,i,u)+"k":c<o?d=e(c,r,u)+"m":c<a?d=t(e(c,o,u),u)+"b":d=t(e(c,a,u),u)+"t",h&&(d="-"+d),u.capital&&(d=d.toUpperCase()),u.prefix&&(d=u.prefix+d),u.suffix&&(d=d+u.suffix),d}l.addCommas=t,n.exports=l})()})(Pu);var Yx=Pu.exports;const Vi=Po(Yx);function Vx(n,t,e){const{i18n:i}=gt.useI18n(),{translateUnit:s}=gt.useTranslatedUnits();return{legendValues:f.computed(()=>n.value.datasets.reduce((o,a)=>{const l=a.total?a.total:a.data.reduce((u,d)=>u+(typeof d=="number"?Number(d)||0:Number(d&&d.y)||0),0);let c;if(e.value==="bytes")c=isNaN(l)?"0":ho(l);else{const u=s(e.value,l);c=i&&i.t("legend.datapointValueDisplay",{value:Vi(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}}),unit:u})||`${Vi(l,{capital:!0,...e.value==="usd"&&{prefix:"$"}})} ${e.value}`}return{...o,[a.label]:{raw:l,formatted:c}}},{}))}}var jx=Object.defineProperty,$x=(n,t,e)=>t in n?jx(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ee=(n,t,e)=>$x(n,typeof t!="symbol"?t+"":t,e),Pt=(n=>(n.FIFTEEN_MIN="15m",n.ONE_HOUR="1h",n.SIX_HOUR="6h",n.TWELVE_HOUR="12h",n.ONE_DAY="24h",n.SEVEN_DAY="7d",n.THIRTY_DAY="30d",n.CURRENT_WEEK="current_week",n.CURRENT_MONTH="current_month",n.CURRENT_QUARTER="current_quarter",n.PREVIOUS_WEEK="previous_week",n.PREVIOUS_MONTH="previous_month",n.PREVIOUS_QUARTER="previous_quarter",n))(Pt||{});const qx=["secondly","minutely","hourly","daily","weekly","trend"],ji=n=>n.filter(t=>t!=="time"),Ou=["api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","route","status_code","status_code_grouped","time"],Ux=ji(Ou),Xx=[...Ou,"application","consumer","iso_code"],Gx=ji(Xx),Kx=["control_plane","control_plane_group","gateway_service","consumer","application","route","ai_provider","ai_response_model","ai_request_model","llm_cache_status","llm_embeddings_provider","llm_embeddings_model","time"],Zx=ji(Kx);ji(["api_product","api_product_version","application","auth_type","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","gateway_service","header_host","header_user_agent","http_method","iso_code","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_uri","upstream_status_code_grouped","websocket"]),ji(["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","request_body_size","response_body_size","response_header_content_length","status_code","upstream_status_code"]),new Set(Ux),new Set(Gx),new Set(Zx);function Ut(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function _e(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function Eu(n,t){const e=Ut(n);return isNaN(t)?_e(n,NaN):(e.setDate(e.getDate()+t),e)}function Qx(n,t){const e=Ut(n);if(isNaN(t))return _e(n,NaN);const i=e.getDate(),s=_e(n,e.getTime());s.setMonth(e.getMonth()+t+1,0);const r=s.getDate();return i>=r?s:(e.setFullYear(s.getFullYear(),s.getMonth(),i),e)}const Au=6048e5,Jx=864e5,t_=60,e_=3600;let n_={};function $s(){return n_}function He(n,t){var e,i,s,r;const o=$s(),a=(t==null?void 0:t.weekStartsOn)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.weekStartsOn)??o.weekStartsOn??((r=(s=o.locale)==null?void 0:s.options)==null?void 0:r.weekStartsOn)??0,l=Ut(n),c=l.getDay(),u=(c<a?7:0)+c-a;return l.setDate(l.getDate()-u),l.setHours(0,0,0,0),l}function qs(n){return He(n,{weekStartsOn:1})}function Ru(n){const t=Ut(n),e=t.getFullYear(),i=_e(n,0);i.setFullYear(e+1,0,4),i.setHours(0,0,0,0);const s=qs(i),r=_e(n,0);r.setFullYear(e,0,4),r.setHours(0,0,0,0);const o=qs(r);return t.getTime()>=s.getTime()?e+1:t.getTime()>=o.getTime()?e:e-1}function Us(n){const t=Ut(n);return t.setHours(0,0,0,0),t}function Lu(n){const t=Ut(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function i_(n,t){const e=Us(n),i=Us(t),s=+e-Lu(e),r=+i-Lu(i);return Math.round((s-r)/Jx)}function s_(n){const t=Ru(n),e=_e(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),qs(e)}function r_(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function o_(n){if(!r_(n)&&typeof n!="number")return!1;const t=Ut(n);return!isNaN(Number(t))}function Xn(n){const t=Ut(n);return t.setDate(1),t.setHours(0,0,0,0),t}function a_(n){const t=Ut(n),e=_e(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}const l_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},c_=(n,t,e)=>{let i;const s=l_[n];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+i:i+" ago":i};function Oo(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const u_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},d_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},h_={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},f_={date:Oo({formats:u_,defaultWidth:"full"}),time:Oo({formats:d_,defaultWidth:"full"}),dateTime:Oo({formats:h_,defaultWidth:"full"})},g_={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},p_=(n,t,e,i)=>g_[n];function $i(n){return(t,e)=>{const i=e!=null&&e.context?String(e.context):"standalone";let s;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=e!=null&&e.width?String(e.width):o;s=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=e!=null&&e.width?String(e.width):n.defaultWidth;s=n.values[a]||n.values[o]}const r=n.argumentCallback?n.argumentCallback(t):t;return s[r]}}const m_={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},y_={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},b_={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},x_={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},__={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},w_={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},v_=(n,t)=>{const e=Number(n),i=e%100;if(i>20||i<10)switch(i%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},k_={ordinalNumber:v_,era:$i({values:m_,defaultWidth:"wide"}),quarter:$i({values:y_,defaultWidth:"wide",argumentCallback:n=>n-1}),month:$i({values:b_,defaultWidth:"wide"}),day:$i({values:x_,defaultWidth:"wide"}),dayPeriod:$i({values:__,defaultWidth:"wide",formattingValues:w_,defaultFormattingWidth:"wide"})};function qi(n){return(t,e={})=>{const i=e.width,s=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],r=t.match(s);if(!r)return null;const o=r[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?S_(a,d=>d.test(o)):M_(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=e.valueCallback?e.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function M_(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function S_(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function D_(n){return(t,e={})=>{const i=t.match(n.matchPattern);if(!i)return null;const s=i[0],r=t.match(n.parsePattern);if(!r)return null;let o=n.valueCallback?n.valueCallback(r[0]):r[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const T_=/^(\d+)(th|st|nd|rd)?/i,C_=/\d+/i,P_={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},O_={any:[/^b/i,/^(a|c)/i]},E_={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},A_={any:[/1/i,/2/i,/3/i,/4/i]},R_={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},L_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},I_={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},N_={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},F_={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},B_={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},z_={ordinalNumber:D_({matchPattern:T_,parsePattern:C_,valueCallback:n=>parseInt(n,10)}),era:qi({matchPatterns:P_,defaultMatchWidth:"wide",parsePatterns:O_,defaultParseWidth:"any"}),quarter:qi({matchPatterns:E_,defaultMatchWidth:"wide",parsePatterns:A_,defaultParseWidth:"any",valueCallback:n=>n+1}),month:qi({matchPatterns:R_,defaultMatchWidth:"wide",parsePatterns:L_,defaultParseWidth:"any"}),day:qi({matchPatterns:I_,defaultMatchWidth:"wide",parsePatterns:N_,defaultParseWidth:"any"}),dayPeriod:qi({matchPatterns:F_,defaultMatchWidth:"any",parsePatterns:B_,defaultParseWidth:"any"})},H_={code:"en-US",formatDistance:c_,formatLong:f_,formatRelative:p_,localize:k_,match:z_,options:{weekStartsOn:0,firstWeekContainsDate:1}};function W_(n){const t=Ut(n);return i_(t,a_(t))+1}function Y_(n){const t=Ut(n),e=+qs(t)-+s_(t);return Math.round(e/Au)+1}function Iu(n,t){var e,i,s,r;const o=Ut(n),a=o.getFullYear(),l=$s(),c=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??l.firstWeekContainsDate??((r=(s=l.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,u=_e(n,0);u.setFullYear(a+1,0,c),u.setHours(0,0,0,0);const d=He(u,t),h=_e(n,0);h.setFullYear(a,0,c),h.setHours(0,0,0,0);const g=He(h,t);return o.getTime()>=d.getTime()?a+1:o.getTime()>=g.getTime()?a:a-1}function V_(n,t){var e,i,s,r;const o=$s(),a=(t==null?void 0:t.firstWeekContainsDate)??((i=(e=t==null?void 0:t.locale)==null?void 0:e.options)==null?void 0:i.firstWeekContainsDate)??o.firstWeekContainsDate??((r=(s=o.locale)==null?void 0:s.options)==null?void 0:r.firstWeekContainsDate)??1,l=Iu(n,t),c=_e(n,0);return c.setFullYear(l,0,a),c.setHours(0,0,0,0),He(c,t)}function j_(n,t){const e=Ut(n),i=+He(e,t)-+V_(e,t);return Math.round(i/Au)+1}function ft(n,t){const e=n<0?"-":"",i=Math.abs(n).toString().padStart(t,"0");return e+i}const an={y(n,t){const e=n.getFullYear(),i=e>0?e:1-e;return ft(t==="yy"?i%100:i,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):ft(e+1,2)},d(n,t){return ft(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return ft(n.getHours()%12||12,t.length)},H(n,t){return ft(n.getHours(),t.length)},m(n,t){return ft(n.getMinutes(),t.length)},s(n,t){return ft(n.getSeconds(),t.length)},S(n,t){const e=t.length,i=n.getMilliseconds(),s=Math.trunc(i*Math.pow(10,e-3));return ft(s,t.length)}},Gn={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Nu={G:function(n,t,e){const i=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(i,{width:"abbreviated"});case"GGGGG":return e.era(i,{width:"narrow"});case"GGGG":default:return e.era(i,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const i=n.getFullYear(),s=i>0?i:1-i;return e.ordinalNumber(s,{unit:"year"})}return an.y(n,t)},Y:function(n,t,e,i){const s=Iu(n,i),r=s>0?s:1-s;if(t==="YY"){const o=r%100;return ft(o,2)}return t==="Yo"?e.ordinalNumber(r,{unit:"year"}):ft(r,t.length)},R:function(n,t){const e=Ru(n);return ft(e,t.length)},u:function(n,t){const e=n.getFullYear();return ft(e,t.length)},Q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ft(i,2);case"Qo":return e.ordinalNumber(i,{unit:"quarter"});case"QQQ":return e.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,t,e){const i=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ft(i,2);case"qo":return e.ordinalNumber(i,{unit:"quarter"});case"qqq":return e.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,t,e){const i=n.getMonth();switch(t){case"M":case"MM":return an.M(n,t);case"Mo":return e.ordinalNumber(i+1,{unit:"month"});case"MMM":return e.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(i,{width:"wide",context:"formatting"})}},L:function(n,t,e){const i=n.getMonth();switch(t){case"L":return String(i+1);case"LL":return ft(i+1,2);case"Lo":return e.ordinalNumber(i+1,{unit:"month"});case"LLL":return e.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(i,{width:"wide",context:"standalone"})}},w:function(n,t,e,i){const s=j_(n,i);return t==="wo"?e.ordinalNumber(s,{unit:"week"}):ft(s,t.length)},I:function(n,t,e){const i=Y_(n);return t==="Io"?e.ordinalNumber(i,{unit:"week"}):ft(i,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):an.d(n,t)},D:function(n,t,e){const i=W_(n);return t==="Do"?e.ordinalNumber(i,{unit:"dayOfYear"}):ft(i,t.length)},E:function(n,t,e){const i=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(i,{width:"short",context:"formatting"});case"EEEE":default:return e.day(i,{width:"wide",context:"formatting"})}},e:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return ft(r,2);case"eo":return e.ordinalNumber(r,{unit:"day"});case"eee":return e.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(s,{width:"short",context:"formatting"});case"eeee":default:return e.day(s,{width:"wide",context:"formatting"})}},c:function(n,t,e,i){const s=n.getDay(),r=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return ft(r,t.length);case"co":return e.ordinalNumber(r,{unit:"day"});case"ccc":return e.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(s,{width:"narrow",context:"standalone"});case"cccccc":return e.day(s,{width:"short",context:"standalone"});case"cccc":default:return e.day(s,{width:"wide",context:"standalone"})}},i:function(n,t,e){const i=n.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ft(s,t.length);case"io":return e.ordinalNumber(s,{unit:"day"});case"iii":return e.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(i,{width:"short",context:"formatting"});case"iiii":default:return e.day(i,{width:"wide",context:"formatting"})}},a:function(n,t,e){const i=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(n,t,e){const i=n.getHours();let s;switch(i===12?s=Gn.noon:i===0?s=Gn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(n,t,e){const i=n.getHours();let s;switch(i>=17?s=Gn.evening:i>=12?s=Gn.afternoon:i>=4?s=Gn.morning:s=Gn.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let i=n.getHours()%12;return i===0&&(i=12),e.ordinalNumber(i,{unit:"hour"})}return an.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):an.H(n,t)},K:function(n,t,e){const i=n.getHours()%12;return t==="Ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},k:function(n,t,e){let i=n.getHours();return i===0&&(i=24),t==="ko"?e.ordinalNumber(i,{unit:"hour"}):ft(i,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):an.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):an.s(n,t)},S:function(n,t){return an.S(n,t)},X:function(n,t,e){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Bu(i);case"XXXX":case"XX":return Cn(i);case"XXXXX":case"XXX":default:return Cn(i,":")}},x:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"x":return Bu(i);case"xxxx":case"xx":return Cn(i);case"xxxxx":case"xxx":default:return Cn(i,":")}},O:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Fu(i,":");case"OOOO":default:return"GMT"+Cn(i,":")}},z:function(n,t,e){const i=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Fu(i,":");case"zzzz":default:return"GMT"+Cn(i,":")}},t:function(n,t,e){const i=Math.trunc(n.getTime()/1e3);return ft(i,t.length)},T:function(n,t,e){const i=n.getTime();return ft(i,t.length)}};function Fu(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.trunc(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+ft(r,2)}function Bu(n,t){return n%60===0?(n>0?"-":"+")+ft(Math.abs(n)/60,2):Cn(n,t)}function Cn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=ft(Math.trunc(i/60),2),r=ft(i%60,2);return e+s+t+r}const zu=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Hu=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},$_=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],i=e[1],s=e[2];if(!s)return zu(n,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;case"PPPP":default:r=t.dateTime({width:"full"});break}return r.replace("{{date}}",zu(i,t)).replace("{{time}}",Hu(s,t))},q_={p:Hu,P:$_},U_=/^D+$/,X_=/^Y+$/,G_=["D","DD","YY","YYYY"];function K_(n){return U_.test(n)}function Z_(n){return X_.test(n)}function Q_(n,t,e){const i=J_(n,t,e);if(console.warn(i),G_.includes(n))throw new RangeError(i)}function J_(n,t,e){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${i} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const tw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ew=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nw=/^'([^]*?)'?$/,iw=/''/g,sw=/[a-zA-Z]/;function rw(n,t,e){var i,s,r,o,a,l,c,u;const d=$s(),h=(e==null?void 0:e.locale)??d.locale??H_,g=(e==null?void 0:e.firstWeekContainsDate)??((s=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:s.firstWeekContainsDate)??d.firstWeekContainsDate??((o=(r=d.locale)==null?void 0:r.options)==null?void 0:o.firstWeekContainsDate)??1,p=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((u=(c=d.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,y=Ut(n);if(!o_(y))throw new RangeError("Invalid time value");let x=t.match(ew).map(v=>{const M=v[0];if(M==="p"||M==="P"){const P=q_[M];return P(v,h.formatLong)}return v}).join("").match(tw).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const M=v[0];if(M==="'")return{isToken:!1,value:ow(v)};if(Nu[M])return{isToken:!0,value:v};if(M.match(sw))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:v}});h.localize.preprocessor&&(x=h.localize.preprocessor(y,x));const w={firstWeekContainsDate:g,weekStartsOn:p,locale:h};return x.map(v=>{if(!v.isToken)return v.value;const M=v.value;(!(e!=null&&e.useAdditionalWeekYearTokens)&&Z_(M)||!(e!=null&&e.useAdditionalDayOfYearTokens)&&K_(M))&&Q_(M,t,String(n));const P=Nu[M[0]];return P(y,M,h.localize,w)}).join("")}function ow(n){const t=n.match(nw);return t?t[1].replace(iw,"'"):n}function aw(n){const t=Ut(n),e=t.getFullYear(),i=t.getMonth(),s=_e(n,0);return s.setFullYear(e,i+1,0),s.setHours(0,0,0,0),s.getDate()}function lw(n){return Math.trunc(n*e_)}function cw(n){const t=n/t_;return Math.trunc(t)}function Wu(n,t){return Qx(n,-t)}function Yu(n,t,e){const i=hw(n,e.timeZone,e.locale);return"formatToParts"in i?uw(i,t):dw(i,t)}function uw(n,t){const e=n.formatToParts(t);for(let i=e.length-1;i>=0;--i)if(e[i].type==="timeZoneName")return e[i].value}function dw(n,t){const e=n.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(e);return i?i[0].substr(1):""}function hw(n,t,e){return new Intl.DateTimeFormat(e?[e.code,"en-US"]:void 0,{timeZone:t,timeZoneName:n})}function fw(n,t){const e=yw(t);return"formatToParts"in e?pw(e,n):mw(e,n)}const gw={year:0,month:1,day:2,hour:3,minute:4,second:5};function pw(n,t){try{const e=n.formatToParts(t),i=[];for(let s=0;s<e.length;s++){const r=gw[e[s].type];r!==void 0&&(i[r]=parseInt(e[s].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function mw(n,t){const e=n.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(e);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Eo={};function yw(n){if(!Eo[n]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),e=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";Eo[n]=e?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Eo[n]}function Ao(n,t,e,i,s,r,o){const a=new Date(0);return a.setUTCFullYear(n,t,e),a.setUTCHours(i,s,r,o),a}const Vu=36e5,bw=6e4,Ro={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ui(n,t,e){if(!n)return 0;let i=Ro.timezoneZ.exec(n);if(i)return 0;let s,r;if(i=Ro.timezoneHH.exec(n),i)return s=parseInt(i[1],10),ju(s)?-(s*Vu):NaN;if(i=Ro.timezoneHHMM.exec(n),i){s=parseInt(i[2],10);const o=parseInt(i[3],10);return ju(s,o)?(r=Math.abs(s)*Vu+o*bw,i[1]==="+"?-r:r):NaN}if(ww(n)){t=new Date(t||Date.now());const o=e?t:xw(t),a=Lo(o,n);return-(e?a:_w(t,a,n))}return NaN}function xw(n){return Ao(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function Lo(n,t){const e=fw(n,t),i=Ao(e[0],e[1]-1,e[2],e[3]%24,e[4],e[5],0).getTime();let s=n.getTime();const r=s%1e3;return s-=r>=0?r:1e3+r,i-s}function _w(n,t,e){let i=n.getTime()-t;const s=Lo(new Date(i),e);if(t===s)return t;i-=s-t;const r=Lo(new Date(i),e);return s===r?s:Math.max(s,r)}function ju(n,t){return-23<=n&&n<=23&&(t==null||0<=t&&t<=59)}const $u={};function ww(n){if($u[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),$u[n]=!0,!0}catch{return!1}}const vw=60*1e3,kw={X:function(n,t,e){const i=Io(e.timeZone,n);if(i===0)return"Z";switch(t){case"X":return qu(i);case"XXXX":case"XX":return Kn(i);case"XXXXX":case"XXX":default:return Kn(i,":")}},x:function(n,t,e){const i=Io(e.timeZone,n);switch(t){case"x":return qu(i);case"xxxx":case"xx":return Kn(i);case"xxxxx":case"xxx":default:return Kn(i,":")}},O:function(n,t,e){const i=Io(e.timeZone,n);switch(t){case"O":case"OO":case"OOO":return"GMT"+Mw(i,":");case"OOOO":default:return"GMT"+Kn(i,":")}},z:function(n,t,e){switch(t){case"z":case"zz":case"zzz":return Yu("short",n,e);case"zzzz":default:return Yu("long",n,e)}}};function Io(n,t){const e=n?Ui(n,t,!0)/vw:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(e))throw new RangeError("Invalid time zone specified: "+n);return e}function Xs(n,t){const e=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<t;)i="0"+i;return e+i}function Kn(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Xs(Math.floor(i/60),2),r=Xs(Math.floor(i%60),2);return e+s+t+r}function qu(n,t){return n%60===0?(n>0?"-":"+")+Xs(Math.abs(n)/60,2):Kn(n,t)}function Mw(n,t=""){const e=n>0?"-":"+",i=Math.abs(n),s=Math.floor(i/60),r=i%60;return r===0?e+String(s):e+String(s)+t+Xs(r,2)}function Uu(n){const t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+n-+t}const Xu=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,No=36e5,Gu=6e4,Sw=2,Xt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Xu};function Gs(n,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const e=t.additionalDigits==null?Sw:Number(t.additionalDigits);if(e!==2&&e!==1&&e!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=Dw(n),{year:s,restDateString:r}=Tw(i.date,e),o=Cw(r,s);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){const a=o.getTime();let l=0,c;if(i.time&&(l=Pw(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Ui(i.timeZone||t.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=Uu(new Date(a+l)),c=Uu(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function Dw(n){const t={};let e=Xt.dateTimePattern.exec(n),i;if(e?(t.date=e[1],i=e[3]):(e=Xt.datePattern.exec(n),e?(t.date=e[1],i=e[2]):(t.date=null,i=n)),i){const s=Xt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function Tw(n,t){if(n){const e=Xt.YYY[t],i=Xt.YYYYY[t];let s=Xt.YYYY.exec(n)||i.exec(n);if(s){const r=s[1];return{year:parseInt(r,10),restDateString:n.slice(r.length)}}if(s=Xt.YY.exec(n)||e.exec(n),s){const r=s[1];return{year:parseInt(r,10)*100,restDateString:n.slice(r.length)}}}return{year:null}}function Cw(n,t){if(t===null)return null;let e,i,s;if(!n||!n.length)return e=new Date(0),e.setUTCFullYear(t),e;let r=Xt.MM.exec(n);if(r)return e=new Date(0),i=parseInt(r[1],10)-1,Qu(t,i)?(e.setUTCFullYear(t,i),e):new Date(NaN);if(r=Xt.DDD.exec(n),r){e=new Date(0);const o=parseInt(r[1],10);return Aw(t,o)?(e.setUTCFullYear(t,0,o),e):new Date(NaN)}if(r=Xt.MMDD.exec(n),r){e=new Date(0),i=parseInt(r[1],10)-1;const o=parseInt(r[2],10);return Qu(t,i,o)?(e.setUTCFullYear(t,i,o),e):new Date(NaN)}if(r=Xt.Www.exec(n),r)return s=parseInt(r[1],10)-1,Ju(s)?Ku(t,s):new Date(NaN);if(r=Xt.WwwD.exec(n),r){s=parseInt(r[1],10)-1;const o=parseInt(r[2],10)-1;return Ju(s,o)?Ku(t,s,o):new Date(NaN)}return null}function Pw(n){let t,e,i=Xt.HH.exec(n);if(i)return t=parseFloat(i[1].replace(",",".")),Fo(t)?t%24*No:NaN;if(i=Xt.HHMM.exec(n),i)return t=parseInt(i[1],10),e=parseFloat(i[2].replace(",",".")),Fo(t,e)?t%24*No+e*Gu:NaN;if(i=Xt.HHMMSS.exec(n),i){t=parseInt(i[1],10),e=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Fo(t,e,s)?t%24*No+e*Gu+s*1e3:NaN}return null}function Ku(n,t,e){t=t||0,e=e||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const s=i.getUTCDay()||7,r=t*7+e+1-s;return i.setUTCDate(i.getUTCDate()+r),i}const Ow=[31,28,31,30,31,30,31,31,30,31,30,31],Ew=[31,29,31,30,31,30,31,31,30,31,30,31];function Zu(n){return n%400===0||n%4===0&&n%100!==0}function Qu(n,t,e){if(t<0||t>11)return!1;if(e!=null){if(e<1)return!1;const i=Zu(n);if(i&&e>Ew[t]||!i&&e>Ow[t])return!1}return!0}function Aw(n,t){if(t<1)return!1;const e=Zu(n);return!(e&&t>366||!e&&t>365)}function Ju(n,t){return!(n<0||n>52||t!=null&&(t<0||t>6))}function Fo(n,t,e){return!(n<0||n>=25||t!=null&&(t<0||t>=60)||e!=null&&(e<0||e>=60))}const Rw=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Lw(n,t,e={}){t=String(t);const i=t.match(Rw);if(i){const s=Gs(e.originalDate||n,e);t=i.reduce(function(r,o){if(o[0]==="'")return r;const a=r.indexOf(o),l=r[a-1]==="'",c=r.replace(o,"'"+kw[o[0]](s,o,e)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},t)}return rw(n,t,e)}function td(n,t,e){n=Gs(n,e);const i=Ui(t,n,!0),s=new Date(n.getTime()-i),r=new Date(0);return r.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),r.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),r}function Iw(n,t,e,i){return i={...i,timeZone:t,originalDate:n},Lw(td(n,t,{timeZone:i.timeZone}),e,i)}function Nw(n,t,e){if(typeof n=="string"&&!n.match(Xu))return Gs(n,{...e,timeZone:t});n=Gs(n,e);const i=Ao(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()).getTime(),s=Ui(t,new Date(i));return new Date(i+s)}function Fw(n,t){return-Ui(n,t)}function Bo(n,t={}){if(!n)return n;const e=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(n);return Iw(s,e,i)}catch{return console.error("Invalid value passed to formatTime",n),"(invalid date)"}}const Bw={secondly:1e3,minutely:60*1e3,hourly:60*60*1e3,daily:60*60*24*1e3,weekly:60*60*24*7*1e3,trend:0};function zo(n){return n&&qx.find(t=>n<=Bw[t])||null}const Zn=(n,t)=>new Date(n.getTime()-Fw(t,n));class we{constructor(t){Ee(this,"timeframeText"),Ee(this,"key"),Ee(this,"display"),Ee(this,"timeframeLength"),Ee(this,"allowedTiers"),Ee(this,"defaultResponseGranularity"),Ee(this,"dataGranularity"),Ee(this,"isRelative"),Ee(this,"_startCustom"),Ee(this,"_endCustom"),this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(){const t=new Set,e=this.maximumTimeframeLength()/3600;return e<=6&&t.add("minutely"),e>=2&&e<=7*24&&t.add("hourly"),e>=2*24&&t.add("daily"),e>=2*24*14&&t.add("weekly"),t}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const e=Nw(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return td(e,t)}}class zw extends we{rawStart(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Zn(e,t)),e}maximumTimeframeLength(){return 60*60*24*7}}class Hw extends we{rawStart(t){let e=Xn(this.tzAdjustedDate(t));return t&&(e=Zn(e,t)),e}maximumTimeframeLength(){return 60*60*24*31}}class Ww extends we{rawEnd(t){let e=He(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(e=Zn(e,t)),e}rawStart(t){const e=this.tzAdjustedDate(t);let i=He(e.setDate(e.getDate()-7),{weekStartsOn:1});return t&&(i=Zn(i,t)),i}}class Yw extends we{rawEnd(t){let e=Xn(this.tzAdjustedDate(t));return t&&(e=Zn(e,t)),e}rawStart(t){let e=Xn(Wu(this.tzAdjustedDate(t),1));return t&&(e=Zn(e,t)),e}}Pt.FIFTEEN_MIN,new we({key:Pt.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>60*15,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.ONE_HOUR,new we({key:Pt.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>60*60*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.SIX_HOUR,new we({key:Pt.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>60*60*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.TWELVE_HOUR,new we({key:Pt.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>60*60*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.ONE_DAY,new we({key:Pt.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>60*60*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,allowedTiers:["free","trial","plus","enterprise"]}),Pt.SEVEN_DAY,new we({key:Pt.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Pt.THIRTY_DAY,new we({key:Pt.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>60*60*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,allowedTiers:["trial","plus","enterprise"]}),Pt.CURRENT_WEEK,new zw({key:Pt.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const n=He(new Date,{weekStartsOn:1});return(Us(Eu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.CURRENT_MONTH,new Hw({key:Pt.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const n=Xn(new Date);return(Us(Eu(new Date,1)).getTime()-n.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.PREVIOUS_WEEK,new Ww({key:Pt.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>60*60*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),Pt.PREVIOUS_MONTH,new Yw({key:Pt.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let n=0;const t=Xn(new Date),e=Xn(Wu(new Date,1));return t.getTimezoneOffset()!==e.getTimezoneOffset()&&(n=Vw(t,e)),60*60*24*aw(new Date().setMonth(new Date().getMonth()-1))+lw(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function Vw(n,t){return cw(n.getTimezoneOffset()-t.getTimezoneOffset())}function jw(n){return f.computed(()=>{var s;if(!((s=n.value)!=null&&s.meta))return"";const e=n.value.meta.start_ms,i=n.value.meta.end_ms;return e&&i?`${Bo(e)} - ${Bo(i,{includeTZ:!0})}`:""})}function $w(n){const t={enabled:!1,position:"doughnutChartTooltipPosition",callbacks:{label:i=>({label:i.dataset.label,value:i.label})}};return As.positioners.doughnutChartTooltipPosition=function(i,s){if(!i.length)return!1;const r=this.chart.canvas.getBoundingClientRect(),o=n.tooltipState.width||this.width,a=r.width/2,l=Mo(s,o,a),c=s.y,u=s.x<a?"left":"center";return{x:l-n.tooltipState.offsetX,y:c,xAlign:u}},{options:f.computed(()=>({responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},tooltip:{...t,external:i=>{ko(n.tooltipState,i)}}}}))}}function qw(n){const t=f.computed(()=>{var l,c;return{type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:10,autoSkipPadding:100,source:"auto",maxRotation:0},title:{display:!tt((l=n.dimensionAxesTitle)==null?void 0:l.value),text:(c=n.dimensionAxesTitle)==null?void 0:c.value,padding:{top:2},font:{weight:"bold"}}}}),e=f.computed(()=>{var l,c;return{title:{display:!tt((l=n.metricAxesTitle)==null?void 0:l.value),text:(c=n.metricAxesTitle)==null?void 0:c.value,padding:{bottom:10},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0}}),i={enabled:!1,position:"lineChartTooltipPosition"};As.positioners.lineChartTooltipPosition=function(l,c){if(!l.length||n.tooltipState.locked)return!1;const u=this.chart.canvas.getBoundingClientRect(),d=n.tooltipState.width||this.width,h=n.tooltipState.height||this.height,g=u.width/2,p=u.height/2,y=Mo(c,d,g);let x=Sx(c,h,p);const w=c.y<p?"top":"bottom",v=c.x<g?"left":"center";return h>u.height&&(x=0),{x:y,y:x,xAlign:v,yAlign:w}};const s=f.computed(()=>{switch(n.granularity.value){case"minutely":return"minute";case"hourly":return"hour";case"daily":return"day";default:return"day"}}),r=f.computed(()=>sx(Number(n.timeRangeMs.value))>=24?"yyyy-MM-dd h:mm":"h:mm"),o=f.computed(()=>["daily","weekly"].includes(n.granularity.value)?"yyyy-MM-dd":"yyyy-MM-dd h:mm");return{options:f.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:{border:{display:!1},...t.value,stacked:n.stacked.value,time:{tooltipFormat:"h:mm:ss a",unit:s.value,displayFormats:{minute:"h:mm:ss a",hour:r.value,day:o.value}}},y:{border:{display:!1},...e.value,stacked:n.stacked.value}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:n.legendID},legend:{display:!1},streaming:!1,tooltip:{...i,external:l=>{ko(n.tooltipState,l)}}},interaction:{mode:"index",intersect:!1}}))}}function Uw(n){const{isMultiMetric:t,hasDimensions:e,metricNames:i,barSegmentLabels:s,pivotRecords:r,rowLabels:o,colorPalette:a}=n,{i18n:l}=gt.useI18n();return t?i.map(u=>({label:l&&l.te(`chartLabels.${u}`)&&l.t(`chartLabels.${u}`)||u,backgroundColor:Un(i.indexOf(u),ze),data:o.map((d,h)=>e?r[`${d.id},${u}`]||0:r[`${h},${u}`]||null)})):Array.from(s).flatMap((u,d)=>{if(!u)return[];const h={},g=Array.isArray(a)?Un(d,a):a[u.name]||Un(d);return h[u.name]=g,{label:l&&l.te(`chartLabels.${u.name}`)&&l.t(`chartLabels.${u.name}`)||u.name,backgroundColor:g,data:o.map(p=>r[`${p.id},${u.id}`]||null)}})}function Xw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:o}=t.value.meta,a=r&&Object.keys(r),l=o&&o.length>1,c=r&&a&&a.length>0;if(!s.length||!o)return{datasets:[],labels:[]};const u=c&&a||o,d=u[0],h=u.length>1?u[1]:u[0],g=Object.fromEntries(l?s.flatMap(C=>o.map((T,b)=>{const _=C.event[d],S=c?`${_},${T}`:`${b},${T}`,E=C.event[T];return[S,E]})):s.map(C=>{const T=c?`${C.event[d]},${C.event[h]}`:`${d},${h}`,b=C.event[o[0]];return[T,b]})),p=Object.entries(g).sort(([,C],[,T])=>Number(T)-Number(C)).map(([C])=>C.split(",")[0]),y=r[d],x=r[h],w=c&&y&&Object.entries(y).map(([C,T])=>({id:C,name:T.name}))||o.map(C=>({id:C,name:C})),v=c&&x&&Object.entries(x).map(([C,T])=>({id:C,name:T.name}))||o.map(C=>({id:C,name:C}));if(d!=="status_code"&&d!=="status_code_grouped"&&(w.sort((C,T)=>p.indexOf(C.id)-p.indexOf(T.id)),v.sort((C,T)=>p.indexOf(C.id)-p.indexOf(T.id))),!w||!v)return{labels:[],datasets:[]};const M=Uw({isMultiMetric:l,hasDimensions:c,metricNames:o,dimensionFieldNames:u,barSegmentLabels:v,pivotRecords:g,rowLabels:w,colorPalette:n.colorPalette||ze});return{labels:c?w.map(C=>e&&e.te(`chartLabels.${C.name}`)&&e.t(`chartLabels.${C.name}`)||C.name):o.map(C=>e&&e.te(`chartLabels.${C}`)&&e.t(`chartLabels.${C}`)||C),datasets:M}}}catch(s){return console.error(s),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const Gw=(n,t,e=1)=>Array(Math.ceil((t-n)/e)).fill(n).map((i,s)=>i+s*e),Kw=n=>{if(typeof n=="string"){const t=+n;if(t)return t;try{return pu(n).getTime()}catch(e){if(e instanceof RangeError)return 0;throw e}}return n},Zw=(n,t,e,i,s)=>{const o=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),a=Math.floor((n-i)/e)*e+i,l=Math.floor((o-i)/e)*e+i+e;return Gw(a,l,e)};function Qw(n,t){const{i18n:e}=gt.useI18n();return f.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const s=t.value.data,{display:r,metric_names:o,start_ms:a,end_ms:l}=t.value.meta;if(!o)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const c=r&&Object.keys(r)||o,u=c&&c[0],d=r[u],h=r&&d&&Object.keys(d).map(D=>({id:D,name:d[D].name}))||o.map(D=>({id:D,name:D})),g=t.value.meta.granularity_ms;if(typeof g!="number"||isNaN(g)||!isFinite(g)||g===0)return console.error("Invalid step value:",g),{datasets:[],labels:[]};if(!s.length)return{datasets:[],labels:[]};const p=Kw(a),y=Zw(a,l,g,p,s),x=new Set,w=s!=null&&s.length?s.reduce((D,C)=>{const T=new Date(C.timestamp).valueOf(),b=C.event;for(const _ of o)x.add(_),T in D||(D[T]={}),_ in D[T]||(D[T][_]={});for(const _ of o)h.forEach(S=>{b[u]===S.id||_===S.id?(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[_])*1e3)/1e3):c.length||(D[T][_]||(D[T][_]={}),D[T][_][S.name]=Math.round(Number(b[S.id])*1e3)/1e3)});return D},{}):{},v=o.length===1?o.flatMap(D=>h.map(C=>[D,C.name])):h.map(D=>[D.name,D.name]),M={},P=[...v].map(([D,C],T)=>{const b=y.map(R=>R in w&&D in w[R]?{x:R,y:w[R][D][C]||0}:{x:R,y:0});let{colorPalette:_,fill:S}=n;tt(_)&&(_=ze);const E=Array.isArray(_)?Un(T,_):_[C]||Un(T);return M[C]=E,{rawDimension:C,rawMetric:D,label:e&&e.te(`chartLabels.${C}`)&&e.t(`chartLabels.${C}`)||C,borderColor:E,backgroundColor:E,data:b,total:b.reduce((R,{y:F})=>R+Number(F),0),...Ax,fill:S,borderWidth:S?Lx:Rx}});return P.sort((D,C)=>Number(D.total)<Number(C.total)?-1:1),{datasets:P,colorMap:M}}}catch(s){return console.error(s),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const Jw=(n,t)=>{f.watch([n,t],(e,i,s)=>{const[r,o]=e;!o||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(o,r),s(()=>{var a;(a=window._AnalyticsChartDataInternal)==null||a.delete(o)}))},{immediate:!0})};function t1(){const{i18n:n}=gt.useI18n();return{translateUnit:(e,i)=>{const s=i===1,r=`chartUnits.${e}`;return e==="usd"?"":n.te(r)?n.t(r,{plural:s?"":"s"}):e}}}const gt={useBarChartOptions:zx,useChartJSCommon:Wx,useChartLegendValues:Vx,useChartSelectedRange:jw,useExploreResultToDatasets:Xw,useExploreResultToTimeDataset:Qw,useDoughnutChartOptions:$w,useLinechartOptions:qw,useI18n:Lh,useReportChartDataForSynthetics:Jw,useTranslatedUnits:t1};var Ot=(n=>(n.Hidden="hidden",n.Right="right",n.Bottom="bottom",n))(Ot||{}),Qn=(n=>(n.Hidden="hidden",n.SingleMetric="single",n.Full="full",n))(Qn||{});/*!
19
19
  * chartjs-plugin-annotation v3.0.1
20
20
  * https://www.chartjs.org/chartjs-plugin-annotation/index
21
21
  * (c) 2023 chartjs-plugin-annotation Contributors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/analytics-chart",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/vitals-chart.umd.js",
6
6
  "module": "./dist/vitals-chart.es.js",
@@ -65,7 +65,7 @@
65
65
  "pretty-bytes": "^6.1.1",
66
66
  "uuid": "^10.0.0",
67
67
  "vue-chartjs": "^5.3.1",
68
- "@kong-ui-public/analytics-utilities": "^5.0.0"
68
+ "@kong-ui-public/analytics-utilities": "^5.0.1"
69
69
  },
70
70
  "distSizeChecker": {
71
71
  "warningLimit": "1.35MB",