claude-session-viewer 0.3.4 → 0.3.5
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.
|
@@ -65,5 +65,5 @@ Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}
|
|
|
65
65
|
* Released under the MIT License
|
|
66
66
|
*/class lk{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,i){const s=n.listeners[i],o=n.duration;s.forEach(a=>a({chart:e,initial:n.initial,numSteps:o,currentStep:Math.min(r-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Gy.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const s=r.items;let o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),a=!0):(s[o]=s[s.length-1],s.pop());a&&(i.draw(),this._notify(i,r,e,"progress")),s.length||(r.running=!1,this._notify(i,r,e,"complete"),r.initial=!1),n+=s.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let i=r.length-1;for(;i>=0;--i)r[i].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var sn=new lk;const Gf="transparent",uk={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=Hf(t||Gf),i=r.valid&&Hf(e||Gf);return i&&i.valid?i.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class ck{constructor(e,n,r,i){const s=n[r];i=Bo([e.to,i,s,e.from]);const o=Bo([e.from,s,i]);this._active=!0,this._fn=e.fn||uk[e.type||typeof o],this._easing=Cs[e.easing]||Cs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=o,this._to=i,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],s=r-this._start,o=this._duration-s;this._start=r,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=Bo([e.to,n,i,e.from]),this._from=Bo([e.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,i=this._prop,s=this._from,o=this._loop,a=this._to;let l;if(this._active=s!==a&&(o||n<r),!this._active){this._target[i]=a,this._notify(!0);return}if(n<0){this._target[i]=s;return}l=n/r%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(s,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let i=0;i<r.length;i++)r[i][n]()}}class h0{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!q(e))return;const n=Object.keys(_e.animation),r=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!q(s))return;const o={};for(const a of n)o[a]=s[a];(Ce(s.properties)&&s.properties||[i]).forEach(a=>{(a===i||!r.has(a))&&r.set(a,o)})})}_animateOptions(e,n){const r=n.options,i=hk(e,r);if(!i)return[];const s=this._createAnimations(i,r);return r.$shared&&dk(e.options.$animations,r).then(()=>{e.options=r},()=>{}),s}_createAnimations(e,n){const r=this._properties,i=[],s=e.$animations||(e.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const u=o[l];if(u.charAt(0)==="$")continue;if(u==="options"){i.push(...this._animateOptions(e,n));continue}const c=n[u];let d=s[u];const h=r.get(u);if(d)if(h&&d.active()){d.update(h,c,a);continue}else d.cancel();if(!h||!h.duration){e[u]=c;continue}s[u]=d=new ck(h,e,u,c),i.push(d)}return i}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return sn.add(this._chart,r),!0}}function dk(t,e){const n=[],r=Object.keys(e);for(let i=0;i<r.length;i++){const s=t[r[i]];s&&s.active()&&n.push(s.wait())}return Promise.all(n)}function hk(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Jf(t,e){const n=t&&t.options||{},r=n.reverse,i=n.min===void 0?e:0,s=n.max===void 0?e:0;return{start:r?s:i,end:r?i:s}}function fk(t,e,n){if(n===!1)return!1;const r=Jf(t,n),i=Jf(e,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function pk(t){let e,n,r,i;return q(t)?(e=t.top,n=t.right,r=t.bottom,i=t.left):e=n=r=i=t,{top:e,right:n,bottom:r,left:i,disabled:t===!1}}function f0(t,e){const n=[],r=t._getSortedDatasetMetas(e);let i,s;for(i=0,s=r.length;i<s;++i)n.push(r[i].index);return n}function Zf(t,e,n,r={}){const i=t.keys,s=r.mode==="single";let o,a,l,u;if(e===null)return;let c=!1;for(o=0,a=i.length;o<a;++o){if(l=+i[o],l===n){if(c=!0,r.all)continue;break}u=t.values[l],Et(u)&&(s||e===0||nr(e)===nr(u))&&(e+=u)}return!c&&!r.all?0:e}function mk(t,e){const{iScale:n,vScale:r}=e,i=n.axis==="x"?"x":"y",s=r.axis==="x"?"x":"y",o=Object.keys(t),a=new Array(o.length);let l,u,c;for(l=0,u=o.length;l<u;++l)c=o[l],a[l]={[i]:c,[s]:t[c]};return a}function Jl(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function gk(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function yk(t){const{min:e,max:n,minDefined:r,maxDefined:i}=t.getUserBounds();return{min:r?e:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function vk(t,e,n){const r=t[e]||(t[e]={});return r[n]||(r[n]={})}function ep(t,e,n,r){for(const i of e.getMatchingVisibleMetas(r).reverse()){const s=t[i.index];if(n&&s>0||!n&&s<0)return i.index}return null}function tp(t,e){const{chart:n,_cachedMeta:r}=t,i=n._stacks||(n._stacks={}),{iScale:s,vScale:o,index:a}=r,l=s.axis,u=o.axis,c=gk(s,o,r),d=e.length;let h;for(let p=0;p<d;++p){const v=e[p],{[l]:y,[u]:w}=v,m=v._stacks||(v._stacks={});h=m[u]=vk(i,c,y),h[a]=w,h._top=ep(h,o,!0,r.type),h._bottom=ep(h,o,!1,r.type);const g=h._visualValues||(h._visualValues={});g[a]=w}}function Zl(t,e){const n=t.scales;return Object.keys(n).filter(r=>n[r].axis===e).shift()}function xk(t,e){return $i(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function wk(t,e,n){return $i(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function ns(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const i of e){const s=i._stacks;if(!s||s[r]===void 0||s[r][n]===void 0)return;delete s[r][n],s[r]._visualValues!==void 0&&s[r]._visualValues[n]!==void 0&&delete s[r]._visualValues[n]}}}const eu=t=>t==="reset"||t==="none",np=(t,e)=>e?t:Object.assign({},t),bk=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:f0(n,!0),values:null};class Ps{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Jl(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&ns(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(d,h,p,v)=>d==="x"?h:d==="r"?v:p,s=n.xAxisID=G(r.xAxisID,Zl(e,"x")),o=n.yAxisID=G(r.yAxisID,Zl(e,"y")),a=n.rAxisID=G(r.rAxisID,Zl(e,"r")),l=n.indexAxis,u=n.iAxisID=i(l,s,o,a),c=n.vAxisID=i(l,o,s,a);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&zf(this._data,this),e._stacked&&ns(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(q(n)){const i=this._cachedMeta;this._data=mk(n,i)}else if(r!==n){if(r){zf(r,this);const i=this._cachedMeta;ns(i),i._parsed=[]}n&&Object.isExtensible(n)&&bS(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const s=n._stacked;n._stacked=Jl(n.vScale,n),n.stack!==r.stack&&(i=!0,ns(n),n.stack=r.stack),this._resyncElements(e),(i||s!==n._stacked)&&(tp(this,n._parsed),n._stacked=Jl(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:i}=this,{iScale:s,_stacked:o}=r,a=s.axis;let l=e===0&&n===i.length?!0:r._sorted,u=e>0&&r._parsed[e-1],c,d,h;if(this._parsing===!1)r._parsed=i,r._sorted=!0,h=i;else{Ce(i[e])?h=this.parseArrayData(r,i,e,n):q(i[e])?h=this.parseObjectData(r,i,e,n):h=this.parsePrimitiveData(r,i,e,n);const p=()=>d[a]===null||u&&d[a]<u[a];for(c=0;c<n;++c)r._parsed[c+e]=d=h[c],l&&(p()&&(l=!1),u=d);r._sorted=l}o&&tp(this,h)}parsePrimitiveData(e,n,r,i){const{iScale:s,vScale:o}=e,a=s.axis,l=o.axis,u=s.getLabels(),c=s===o,d=new Array(i);let h,p,v;for(h=0,p=i;h<p;++h)v=h+r,d[h]={[a]:c||s.parse(u[v],v),[l]:o.parse(n[v],v)};return d}parseArrayData(e,n,r,i){const{xScale:s,yScale:o}=e,a=new Array(i);let l,u,c,d;for(l=0,u=i;l<u;++l)c=l+r,d=n[c],a[l]={x:s.parse(d[0],c),y:o.parse(d[1],c)};return a}parseObjectData(e,n,r,i){const{xScale:s,yScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,u=new Array(i);let c,d,h,p;for(c=0,d=i;c<d;++c)h=c+r,p=n[h],u[c]={x:s.parse(Li(p,a),h),y:o.parse(Li(p,l),h)};return u}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,r){const i=this.chart,s=this._cachedMeta,o=n[e.axis],a={keys:f0(i,!0),values:n._stacks[e.axis]._visualValues};return Zf(a,o,s.index,{mode:r})}updateRangeFromParsed(e,n,r,i){const s=r[n.axis];let o=s===null?NaN:s;const a=i&&r._stacks[n.axis];i&&a&&(i.values=a,o=Zf(i,s,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,n){const r=this._cachedMeta,i=r._parsed,s=r._sorted&&e===r.iScale,o=i.length,a=this._getOtherScale(e),l=bk(n,r,this.chart),u={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=yk(a);let h,p;function v(){p=i[h];const y=p[a.axis];return!Et(p[e.axis])||c>y||d<y}for(h=0;h<o&&!(!v()&&(this.updateRangeFromParsed(u,e,p,l),s));++h);if(s){for(h=o-1;h>=0;--h)if(!v()){this.updateRangeFromParsed(u,e,p,l);break}}return u}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let i,s,o;for(i=0,s=n.length;i<s;++i)o=n[i][e.axis],Et(o)&&r.push(o);return r}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,r=n.iScale,i=n.vScale,s=this.getParsed(e);return{label:r?""+r.getLabelForValue(s[r.axis]):"",value:i?""+i.getLabelForValue(s[i.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=pk(G(this.options.clip,fk(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,r=this._cachedMeta,i=r.data||[],s=n.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||i.length-a,u=this.options.drawActiveElementsOnTop;let c;for(r.dataset&&r.dataset.draw(e,s,a,l),c=a;c<a+l;++c){const d=i[c];d.hidden||(d.active&&u?o.push(d):d.draw(e,s))}for(c=0;c<o.length;++c)o[c].draw(e,s)}getStyle(e,n){const r=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(e||0,r)}getContext(e,n,r){const i=this.getDataset();let s;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];s=o.$context||(o.$context=wk(this.getContext(),e,o)),s.parsed=this.getParsed(e),s.raw=i.data[e],s.index=s.dataIndex=e}else s=this.$context||(this.$context=xk(this.chart.getContext(),this.index)),s.dataset=i,s.index=s.datasetIndex=this.index;return s.active=!!n,s.mode=r,s}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",r){const i=n==="active",s=this._cachedDataOpts,o=e+"-"+n,a=s[o],l=this.enableOptionSharing&&Gs(r);if(a)return np(a,l);const u=this.chart.config,c=u.datasetElementScopeKeys(this._type,e),d=i?[`${e}Hover`,"hover",e,""]:[e,""],h=u.getOptionScopes(this.getDataset(),c),p=Object.keys(_e.elements[e]),v=()=>this.getContext(r,i,n),y=u.resolveNamedOptions(h,p,v,d);return y.$shared&&(y.$shared=l,s[o]=Object.freeze(np(y,l))),y}_resolveAnimations(e,n,r){const i=this.chart,s=this._cachedDataOpts,o=`animation-${n}`,a=s[o];if(a)return a;let l;if(i.options.animation!==!1){const c=this.chart.config,d=c.datasetAnimationScopeKeys(this._type,n),h=c.getOptionScopes(this.getDataset(),d);l=c.createResolver(h,this.getContext(e,r,n))}const u=new h0(i,l&&l.animations);return l&&l._cacheable&&(s[o]=Object.freeze(u)),u}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||eu(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),i=this._sharedOptions,s=this.getSharedOptions(r),o=this.includeOptions(n,s)||s!==i;return this.updateSharedOptions(s,n,r),{sharedOptions:s,includeOptions:o}}updateElement(e,n,r,i){eu(i)?Object.assign(e,r):this._resolveAnimations(n,i).update(e,r)}updateSharedOptions(e,n,r){e&&!eu(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,i){e.active=i;const s=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(e,{options:!i&&this.getSharedOptions(s)||s})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[a,l,u]of this._syncList)this[a](l,u);this._syncList=[];const i=r.length,s=n.length,o=Math.min(s,i);o&&this.parse(0,o),s>i?this._insertElements(i,s-i,e):s<i&&this._removeElements(s,i-s)}_insertElements(e,n,r=!0){const i=this._cachedMeta,s=i.data,o=e+n;let a;const l=u=>{for(u.length+=n,a=u.length-1;a>=o;a--)u[a]=u[a-n]};for(l(s),a=e;a<o;++a)s[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,n),r&&this.updateElements(s,e,n,"reset")}updateElements(e,n,r,i){}_removeElements(e,n){const r=this._cachedMeta;if(this._parsing){const i=r._parsed.splice(e,n);r._stacked&&ns(r,i)}r.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,r,i]=e;this[n](r,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",e,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}K(Ps,"defaults",{}),K(Ps,"datasetElementType",null),K(Ps,"dataElementType",null);function _k(t,e){if(!t._cache.$bar){const n=t.getMatchingVisibleMetas(e);let r=[];for(let i=0,s=n.length;i<s;i++)r=r.concat(n[i].controller.getAllParsedValues(t));t._cache.$bar=qy(r.sort((i,s)=>i-s))}return t._cache.$bar}function Sk(t){const e=t.iScale,n=_k(e,t.type);let r=e._length,i,s,o,a;const l=()=>{o===32767||o===-32768||(Gs(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(i=0,s=n.length;i<s;++i)o=e.getPixelForValue(n[i]),l();for(a=void 0,i=0,s=e.ticks.length;i<s;++i)o=e.getPixelForTick(i),l();return r}function kk(t,e,n,r){const i=n.barThickness;let s,o;return se(i)?(s=e.min*n.categoryPercentage,o=n.barPercentage):(s=i*r,o=1),{chunk:s/r,ratio:o,start:e.pixels[t]-s/2}}function Ck(t,e,n,r){const i=e.pixels,s=i[t];let o=t>0?i[t-1]:null,a=t<i.length-1?i[t+1]:null;const l=n.categoryPercentage;o===null&&(o=s-(a===null?e.end-e.start:a-s)),a===null&&(a=s+s-o);const u=s-(s-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/r,ratio:n.barPercentage,start:u}}function Ek(t,e,n,r){const i=n.parse(t[0],r),s=n.parse(t[1],r),o=Math.min(i,s),a=Math.max(i,s);let l=o,u=a;Math.abs(o)>Math.abs(a)&&(l=a,u=o),e[n.axis]=u,e._custom={barStart:l,barEnd:u,start:i,end:s,min:o,max:a}}function p0(t,e,n,r){return Ce(t)?Ek(t,e,n,r):e[n.axis]=n.parse(t,r),e}function rp(t,e,n,r){const i=t.iScale,s=t.vScale,o=i.getLabels(),a=i===s,l=[];let u,c,d,h;for(u=n,c=n+r;u<c;++u)h=e[u],d={},d[i.axis]=a||i.parse(o[u],u),l.push(p0(h,d,s,u));return l}function tu(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function Pk(t,e,n){return t!==0?nr(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function Mk(t){let e,n,r,i,s;return t.horizontal?(e=t.base>t.x,n="left",r="right"):(e=t.base<t.y,n="bottom",r="top"),e?(i="end",s="start"):(i="start",s="end"),{start:n,end:r,reverse:e,top:i,bottom:s}}function Tk(t,e,n,r){let i=e.borderSkipped;const s={};if(!i){t.borderSkipped=s;return}if(i===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:o,end:a,reverse:l,top:u,bottom:c}=Mk(t);i==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===r?i=u:(n._bottom||0)===r?i=c:(s[ip(c,o,a,l)]=!0,i=u)),s[ip(i,o,a,l)]=!0,t.borderSkipped=s}function ip(t,e,n,r){return r?(t=Rk(t,e,n),t=sp(t,n,e)):t=sp(t,e,n),t}function Rk(t,e,n){return t===e?n:t===n?e:t}function sp(t,e,n){return t==="start"?e:t==="end"?n:t}function Nk(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class ca extends Ps{parsePrimitiveData(e,n,r,i){return rp(e,n,r,i)}parseArrayData(e,n,r,i){return rp(e,n,r,i)}parseObjectData(e,n,r,i){const{iScale:s,vScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,u=s.axis==="x"?a:l,c=o.axis==="x"?a:l,d=[];let h,p,v,y;for(h=r,p=r+i;h<p;++h)y=n[h],v={},v[s.axis]=s.parse(Li(y,u),h),d.push(p0(Li(y,c),v,o,h));return d}updateRangeFromParsed(e,n,r,i){super.updateRangeFromParsed(e,n,r,i);const s=r._custom;s&&n===this._cachedMeta.vScale&&(e.min=Math.min(e.min,s.min),e.max=Math.max(e.max,s.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const n=this._cachedMeta,{iScale:r,vScale:i}=n,s=this.getParsed(e),o=s._custom,a=tu(o)?"["+o.start+", "+o.end+"]":""+i.getLabelForValue(s[i.axis]);return{label:""+r.getLabelForValue(s[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,e)}updateElements(e,n,r,i){const s=i==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),u=a.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,i);for(let p=n;p<n+r;p++){const v=this.getParsed(p),y=s||se(v[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),w=this._calculateBarIndexPixels(p,c),m=(v._stacks||{})[a.axis],g={horizontal:u,base:y.base,enableBorderRadius:!m||tu(v._custom)||o===m._top||o===m._bottom,x:u?y.head:w.center,y:u?w.center:y.head,height:u?w.size:Math.abs(y.size),width:u?Math.abs(y.size):w.size};h&&(g.options=d||this.resolveDataElementOptions(p,e[p].active?"active":i));const x=g.options||e[p].options;Tk(g,x,m,o),Nk(g,x,c.ratio),this.updateElement(e[p],p,g,i)}}_getStacks(e,n){const{iScale:r}=this._cachedMeta,i=r.getMatchingVisibleMetas(this._type).filter(c=>c.controller.options.grouped),s=r.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],u=c=>{const d=c._parsed.find(p=>p[r.axis]===l),h=d&&d[c.vScale.axis];if(se(h)||isNaN(h))return!0};for(const c of i)if(!(n!==void 0&&u(c))&&((s===!1||o.indexOf(c.stack)===-1||s===void 0&&c.stack===void 0)&&o.push(c.stack),c.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(r=>e[r].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)e[G(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,r){const i=this._getStacks(e,r),s=n!==void 0?i.indexOf(n):-1;return s===-1?i.length-1:s}_getRuler(){const e=this.options,n=this._cachedMeta,r=n.iScale,i=[];let s,o;for(s=0,o=n.data.length;s<o;++s)i.push(r.getPixelForValue(this.getParsed(s)[r.axis],s));const a=e.barThickness;return{min:a||Sk(n),pixels:i,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:n,_stacked:r,index:i},options:{base:s,minBarLength:o}}=this,a=s||0,l=this.getParsed(e),u=l._custom,c=tu(u);let d=l[n.axis],h=0,p=r?this.applyStack(n,l,r):d,v,y;p!==d&&(h=p-d,p=d),c&&(d=u.barStart,p=u.barEnd-u.barStart,d!==0&&nr(d)!==nr(u.barEnd)&&(h=0),h+=d);const w=!se(s)&&!c?s:h;let m=n.getPixelForValue(w);if(this.chart.getDataVisibility(e)?v=n.getPixelForValue(h+p):v=m,y=v-m,Math.abs(y)<o){y=Pk(y,n,a)*o,d===a&&(m-=y/2);const g=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),b=Math.min(g,x),C=Math.max(g,x);m=Math.max(Math.min(m,C),b),v=m+y,r&&!c&&(l._stacks[n.axis]._visualValues[i]=n.getValueForPixel(v)-n.getValueForPixel(m))}if(m===n.getPixelForValue(a)){const g=nr(y)*n.getLineWidthForValue(a)/2;m+=g,y-=g}return{size:y,base:m,head:v,center:v+y/2}}_calculateBarIndexPixels(e,n){const r=n.scale,i=this.options,s=i.skipNull,o=G(i.maxBarThickness,1/0);let a,l;const u=this._getAxisCount();if(n.grouped){const c=s?this._getStackCount(e):n.stackCount,d=i.barThickness==="flex"?Ck(e,n,i,c*u):kk(e,n,i,c*u),h=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(G(h,this.getFirstScaleIdForIndexAxis())),v=this._getStackIndex(this.index,this._cachedMeta.stack,s?e:void 0)+p;a=d.start+d.chunk*v+d.chunk/2,l=Math.min(o,d.chunk*d.ratio)}else a=r.getPixelForValue(this.getParsed(e)[r.axis],e),l=Math.min(o,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const e=this._cachedMeta,n=e.vScale,r=e.data,i=r.length;let s=0;for(;s<i;++s)this.getParsed(s)[n.axis]!==null&&!r[s].hidden&&r[s].draw(this._ctx)}}K(ca,"id","bar"),K(ca,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),K(ca,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function pr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Kd{constructor(e){K(this,"options");this.options=e||{}}static override(e){Object.assign(Kd.prototype,e)}init(){}formats(){return pr()}parse(){return pr()}format(){return pr()}add(){return pr()}diff(){return pr()}startOf(){return pr()}endOf(){return pr()}}var Ok={_date:Kd};function jk(t,e,n,r){const{controller:i,data:s,_sorted:o}=t,a=i._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&o&&s.length){const u=a._reversePixels?xS:xc;if(r){if(i._sharedOptions){const c=s[0],d=typeof c.getRange=="function"&&c.getRange(e);if(d){const h=u(s,e,n-d),p=u(s,e,n+d);return{lo:h.lo,hi:p.hi}}}}else{const c=u(s,e,n);if(l){const{vScale:d}=i._cachedMeta,{_parsed:h}=t,p=h.slice(0,c.lo+1).reverse().findIndex(y=>!se(y[d.axis]));c.lo-=Math.max(0,p);const v=h.slice(c.hi).findIndex(y=>!se(y[d.axis]));c.hi+=Math.max(0,v)}return c}}return{lo:0,hi:s.length-1}}function ml(t,e,n,r,i){const s=t.getSortedVisibleDatasetMetas(),o=n[e];for(let a=0,l=s.length;a<l;++a){const{index:u,data:c}=s[a],{lo:d,hi:h}=jk(s[a],e,o,i);for(let p=d;p<=h;++p){const v=c[p];v.skip||r(v,u,p)}}}function Dk(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(r,i){const s=e?Math.abs(r.x-i.x):0,o=n?Math.abs(r.y-i.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(o,2))}}function nu(t,e,n,r,i){const s=[];return!i&&!t.isPointInArea(e)||ml(t,n,e,function(a,l,u){!i&&!r0(a,t.chartArea,0)||a.inRange(e.x,e.y,r)&&s.push({element:a,datasetIndex:l,index:u})},!0),s}function Lk(t,e,n,r){let i=[];function s(o,a,l){const{startAngle:u,endAngle:c}=o.getProps(["startAngle","endAngle"],r),{angle:d}=mS(o,{x:e.x,y:e.y});yS(d,u,c)&&i.push({element:o,datasetIndex:a,index:l})}return ml(t,n,e,s),i}function Fk(t,e,n,r,i,s){let o=[];const a=Dk(n);let l=Number.POSITIVE_INFINITY;function u(c,d,h){const p=c.inRange(e.x,e.y,i);if(r&&!p)return;const v=c.getCenterPoint(i);if(!(!!s||t.isPointInArea(v))&&!p)return;const w=a(e,v);w<l?(o=[{element:c,datasetIndex:d,index:h}],l=w):w===l&&o.push({element:c,datasetIndex:d,index:h})}return ml(t,n,e,u),o}function ru(t,e,n,r,i,s){return!s&&!t.isPointInArea(e)?[]:n==="r"&&!r?Lk(t,e,n,i):Fk(t,e,n,r,i,s)}function op(t,e,n,r,i){const s=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return ml(t,n,e,(l,u,c)=>{l[o]&&l[o](e[n],i)&&(s.push({element:l,datasetIndex:u,index:c}),a=a||l.inRange(e.x,e.y,i))}),r&&!a?[]:s}var Ik={modes:{index(t,e,n,r){const i=vr(e,t),s=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?nu(t,i,s,r,o):ru(t,i,s,!1,r,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(u=>{const c=a[0].index,d=u.data[c];d&&!d.skip&&l.push({element:d,datasetIndex:u.index,index:c})}),l):[]},dataset(t,e,n,r){const i=vr(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?nu(t,i,s,r,o):ru(t,i,s,!1,r,o);if(a.length>0){const l=a[0].datasetIndex,u=t.getDatasetMeta(l).data;a=[];for(let c=0;c<u.length;++c)a.push({element:u[c],datasetIndex:l,index:c})}return a},point(t,e,n,r){const i=vr(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;return nu(t,i,s,r,o)},nearest(t,e,n,r){const i=vr(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;return ru(t,i,s,n.intersect,r,o)},x(t,e,n,r){const i=vr(e,t);return op(t,i,"x",n.intersect,r)},y(t,e,n,r){const i=vr(e,t);return op(t,i,"y",n.intersect,r)}}};const m0=["left","top","right","bottom"];function rs(t,e){return t.filter(n=>n.pos===e)}function ap(t,e){return t.filter(n=>m0.indexOf(n.pos)===-1&&n.box.axis===e)}function is(t,e){return t.sort((n,r)=>{const i=e?r:n,s=e?n:r;return i.weight===s.weight?i.index-s.index:i.weight-s.weight})}function Ak(t){const e=[];let n,r,i,s,o,a;for(n=0,r=(t||[]).length;n<r;++n)i=t[n],{position:s,options:{stack:o,stackWeight:a=1}}=i,e.push({index:n,box:i,pos:s,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&s+o,stackWeight:a});return e}function zk(t){const e={};for(const n of t){const{stack:r,pos:i,stackWeight:s}=n;if(!r||!m0.includes(i))continue;const o=e[r]||(e[r]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=s}return e}function Bk(t,e){const n=zk(t),{vBoxMaxWidth:r,hBoxMaxHeight:i}=e;let s,o,a;for(s=0,o=t.length;s<o;++s){a=t[s];const{fullSize:l}=a.box,u=n[a.stack],c=u&&a.stackWeight/u.weight;a.horizontal?(a.width=c?c*r:l&&e.availableWidth,a.height=i):(a.width=r,a.height=c?c*i:l&&e.availableHeight)}return n}function Wk(t){const e=Ak(t),n=is(e.filter(u=>u.box.fullSize),!0),r=is(rs(e,"left"),!0),i=is(rs(e,"right")),s=is(rs(e,"top"),!0),o=is(rs(e,"bottom")),a=ap(e,"x"),l=ap(e,"y");return{fullSize:n,leftAndTop:r.concat(s),rightAndBottom:i.concat(l).concat(o).concat(a),chartArea:rs(e,"chartArea"),vertical:r.concat(i).concat(l),horizontal:s.concat(o).concat(a)}}function lp(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function g0(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Hk(t,e,n,r){const{pos:i,box:s}=n,o=t.maxPadding;if(!q(i)){n.size&&(t[i]-=n.size);const d=r[n.stack]||{size:0,count:1};d.size=Math.max(d.size,n.horizontal?s.height:s.width),n.size=d.size/d.count,t[i]+=n.size}s.getPadding&&g0(o,s.getPadding());const a=Math.max(0,e.outerWidth-lp(o,t,"left","right")),l=Math.max(0,e.outerHeight-lp(o,t,"top","bottom")),u=a!==t.w,c=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:u,other:c}:{same:c,other:u}}function $k(t){const e=t.maxPadding;function n(r){const i=Math.max(e[r]-t[r],0);return t[r]+=i,i}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function Uk(t,e){const n=e.maxPadding;function r(i){const s={left:0,top:0,right:0,bottom:0};return i.forEach(o=>{s[o]=Math.max(e[o],n[o])}),s}return r(t?["left","right"]:["top","bottom"])}function fs(t,e,n,r){const i=[];let s,o,a,l,u,c;for(s=0,o=t.length,u=0;s<o;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Uk(a.horizontal,e));const{same:d,other:h}=Hk(e,n,a,r);u|=d&&i.length,c=c||h,l.fullSize||i.push(a)}return u&&fs(i,e,n,r)||c}function Ho(t,e,n,r,i){t.top=n,t.left=e,t.right=e+r,t.bottom=n+i,t.width=r,t.height=i}function up(t,e,n,r){const i=n.padding;let{x:s,y:o}=e;for(const a of t){const l=a.box,u=r[a.stack]||{placed:0,weight:1},c=a.stackWeight/u.weight||1;if(a.horizontal){const d=e.w*c,h=u.size||l.height;Gs(u.start)&&(o=u.start),l.fullSize?Ho(l,i.left,o,n.outerWidth-i.right-i.left,h):Ho(l,e.left+u.placed,o,d,h),u.start=o,u.placed+=d,o=l.bottom}else{const d=e.h*c,h=u.size||l.width;Gs(u.start)&&(s=u.start),l.fullSize?Ho(l,s,i.top,h,n.outerHeight-i.bottom-i.top):Ho(l,s,e.top+u.placed,h,d),u.start=s,u.placed+=d,s=l.right}}e.x=s,e.y=o}var bt={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,r){if(!t)return;const i=Pt(t.options.layout.padding),s=Math.max(e-i.width,0),o=Math.max(n-i.height,0),a=Wk(t.boxes),l=a.vertical,u=a.horizontal;te(t.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const c=l.reduce((y,w)=>w.box.options&&w.box.options.display===!1?y:y+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:n,padding:i,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/c,hBoxMaxHeight:o/2}),h=Object.assign({},i);g0(h,Pt(r));const p=Object.assign({maxPadding:h,w:s,h:o,x:i.left,y:i.top},i),v=Bk(l.concat(u),d);fs(a.fullSize,p,d,v),fs(l,p,d,v),fs(u,p,d,v)&&fs(l,p,d,v),$k(p),up(a.leftAndTop,p,d,v),p.x+=p.w,p.y+=p.h,up(a.rightAndBottom,p,d,v),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},te(a.chartArea,y=>{const w=y.box;Object.assign(w,t.chartArea),w.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class y0{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,i){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(e){return!0}updateConfig(e){}}class Vk extends y0{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const da="$chartjs",Qk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},cp=t=>t===null||t==="";function Yk(t,e){const n=t.style,r=t.getAttribute("height"),i=t.getAttribute("width");if(t[da]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",cp(i)){const s=qf(t,"width");s!==void 0&&(t.width=s)}if(cp(r))if(t.style.height==="")t.height=t.width/(e||2);else{const s=qf(t,"height");s!==void 0&&(t.height=s)}return t}const v0=rk?{passive:!0}:!1;function Kk(t,e,n){t&&t.addEventListener(e,n,v0)}function Xk(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,v0)}function qk(t,e){const n=Qk[t.type]||t.type,{x:r,y:i}=vr(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:i!==void 0?i:null}}function Ya(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function Gk(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Ya(a.addedNodes,r),o=o&&!Ya(a.removedNodes,r);o&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function Jk(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||Ya(a.removedNodes,r),o=o&&!Ya(a.addedNodes,r);o&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const Zs=new Map;let dp=0;function x0(){const t=window.devicePixelRatio;t!==dp&&(dp=t,Zs.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function Zk(t,e){Zs.size||window.addEventListener("resize",x0),Zs.set(t,e)}function eC(t){Zs.delete(t),Zs.size||window.removeEventListener("resize",x0)}function tC(t,e,n){const r=t.canvas,i=r&&Yd(r);if(!i)return;const s=Jy((a,l)=>{const u=i.clientWidth;n(a,l),u<i.clientWidth&&n()},window),o=new ResizeObserver(a=>{const l=a[0],u=l.contentRect.width,c=l.contentRect.height;u===0&&c===0||s(u,c)});return o.observe(i),Zk(t,s),o}function iu(t,e,n){n&&n.disconnect(),e==="resize"&&eC(t)}function nC(t,e,n){const r=t.canvas,i=Jy(s=>{t.ctx!==null&&n(qk(s,t))},t);return Kk(r,e,i),i}class rC extends y0{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(Yk(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[da])return!1;const r=n[da].initial;["height","width"].forEach(s=>{const o=r[s];se(o)?n.removeAttribute(s):n.setAttribute(s,o)});const i=r.style||{};return Object.keys(i).forEach(s=>{n.style[s]=i[s]}),n.width=n.width,delete n[da],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const i=e.$proxies||(e.$proxies={}),o={attach:Gk,detach:Jk,resize:tC}[n]||nC;i[n]=o(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),i=r[n];if(!i)return;({attach:iu,detach:iu,resize:iu}[n]||Xk)(e,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,i){return nk(e,n,r,i)}isAttached(e){const n=e&&Yd(e);return!!(n&&n.isConnected)}}function iC(t){return!Qd()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?Vk:rC}class or{constructor(){K(this,"x");K(this,"y");K(this,"active",!1);K(this,"options");K(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return Ua(this.x)&&Ua(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const i={};return e.forEach(s=>{i[s]=r[s]&&r[s].active()?r[s]._to:this[s]}),i}}K(or,"defaults",{}),K(or,"defaultRoutes");function sC(t,e){const n=t.options.ticks,r=oC(t),i=Math.min(n.maxTicksLimit||r,r),s=n.major.enabled?lC(e):[],o=s.length,a=s[0],l=s[o-1],u=[];if(o>i)return uC(e,u,s,o/i),u;const c=aC(s,e,i);if(o>0){let d,h;const p=o>1?Math.round((l-a)/(o-1)):null;for($o(e,u,c,se(p)?0:a-p,a),d=0,h=o-1;d<h;d++)$o(e,u,c,s[d],s[d+1]);return $o(e,u,c,l,se(p)?e.length:l+p),u}return $o(e,u,c),u}function oC(t){const e=t.options.offset,n=t._tickSize(),r=t._length/n+(e?0:1),i=t._maxLength/n;return Math.floor(Math.min(r,i))}function aC(t,e,n){const r=cC(t),i=e.length/n;if(!r)return Math.max(i,1);const s=cS(r);for(let o=0,a=s.length-1;o<a;o++){const l=s[o];if(l>i)return l}return Math.max(i,1)}function lC(t){const e=[];let n,r;for(n=0,r=t.length;n<r;n++)t[n].major&&e.push(n);return e}function uC(t,e,n,r){let i=0,s=n[0],o;for(r=Math.ceil(r),o=0;o<t.length;o++)o===s&&(e.push(t[o]),i++,s=n[i*r])}function $o(t,e,n,r,i){const s=G(r,0),o=Math.min(G(i,t.length),t.length);let a=0,l,u,c;for(n=Math.ceil(n),i&&(l=i-r,n=l/Math.floor(l/n)),c=s;c<0;)a++,c=Math.round(s+a*n);for(u=Math.max(s,0);u<o;u++)u===c&&(e.push(t[u]),a++,c=Math.round(s+a*n))}function cC(t){const e=t.length;let n,r;if(e<2)return!1;for(r=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==r)return!1;return r}const dC=t=>t==="left"?"right":t==="right"?"left":t,hp=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,fp=(t,e)=>Math.min(e||t,t);function pp(t,e){const n=[],r=t.length/e,i=t.length;let s=0;for(;s<i;s+=r)n.push(t[Math.floor(s)]);return n}function hC(t,e,n){const r=t.ticks.length,i=Math.min(e,r-1),s=t._startPixel,o=t._endPixel,a=1e-6;let l=t.getPixelForTick(i),u;if(!(n&&(r===1?u=Math.max(l-s,o-l):e===0?u=(t.getPixelForTick(1)-l)/2:u=(l-t.getPixelForTick(i-1))/2,l+=i<e?u:-u,l<s-a||l>o+a)))return l}function fC(t,e){te(t,n=>{const r=n.gc,i=r.length/2;let s;if(i>e){for(s=0;s<i;++s)delete n.data[r[s]];r.splice(0,i)}})}function ss(t){return t.drawTicks?t.tickLength:0}function mp(t,e){if(!t.display)return 0;const n=Be(t.font,e),r=Pt(t.padding);return(Ce(t.text)?t.text.length:1)*n.lineHeight+r.height}function pC(t,e){return $i(t,{scale:e,type:"scale"})}function mC(t,e,n){return $i(t,{tick:n,index:e,type:"tick"})}function gC(t,e,n){let r=Bd(t);return(n&&e!=="right"||!n&&e==="right")&&(r=dC(r)),r}function yC(t,e,n,r){const{top:i,left:s,bottom:o,right:a,chart:l}=t,{chartArea:u,scales:c}=l;let d=0,h,p,v;const y=o-i,w=a-s;if(t.isHorizontal()){if(p=Ae(r,s,a),q(n)){const m=Object.keys(n)[0],g=n[m];v=c[m].getPixelForValue(g)+y-e}else n==="center"?v=(u.bottom+u.top)/2+y-e:v=hp(t,n,e);h=a-s}else{if(q(n)){const m=Object.keys(n)[0],g=n[m];p=c[m].getPixelForValue(g)-w+e}else n==="center"?p=(u.left+u.right)/2-w+e:p=hp(t,n,e);v=Ae(r,o,i),d=n==="left"?-Dt:Dt}return{titleX:p,titleY:v,maxWidth:h,rotation:d}}class Ui extends or{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:r,_suggestedMax:i}=this;return e=$t(e,Number.POSITIVE_INFINITY),n=$t(n,Number.NEGATIVE_INFINITY),r=$t(r,Number.POSITIVE_INFINITY),i=$t(i,Number.NEGATIVE_INFINITY),{min:$t(e,r),max:$t(n,i),minDefined:Et(e),maxDefined:Et(n)}}getMinMax(e){let{min:n,max:r,minDefined:i,maxDefined:s}=this.getUserBounds(),o;if(i&&s)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,u=a.length;l<u;++l)o=a[l].controller.getMinMax(this,e),i||(n=Math.min(n,o.min)),s||(r=Math.max(r,o.max));return n=s&&n>r?r:n,r=i&&n>r?n:r,{min:$t(n,$t(r,n)),max:$t(r,$t(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ce(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:i,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=WS(this,s,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?pp(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=sC(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,e=!e),this._startPixel=n,this._endPixel=r,this._reversePixels=e,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ce(this.options.afterUpdate,[this])}beforeSetDimensions(){ce(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(){ce(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),ce(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ce(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let r,i,s;for(r=0,i=e.length;r<i;r++)s=e[r],s.label=ce(n.callback,[s.value,r,e],this)}afterTickToLabelConversion(){ce(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ce(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,r=fp(this.ticks.length,e.ticks.maxTicksLimit),i=n.minRotation||0,s=n.maxRotation;let o=i,a,l,u;if(!this._isVisible()||!n.display||i>=s||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const c=this._getLabelSizes(),d=c.widest.width,h=c.highest.height,p=Lt(this.chart.width-d,0,this.maxWidth);a=e.offset?this.maxWidth/r:p/(r-1),d+6>a&&(a=p/(r-(e.offset?.5:1)),l=this.maxHeight-ss(e.grid)-n.padding-mp(e.title,this.chart.options.font),u=Math.sqrt(d*d+h*h),o=pS(Math.min(Math.asin(Lt((c.highest.height+6)/a,-1,1)),Math.asin(Lt(l/u,-1,1))-Math.asin(Lt(h/u,-1,1)))),o=Math.max(i,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){ce(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ce(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=mp(i,n.options.font);if(a?(e.width=this.maxWidth,e.height=ss(s)+l):(e.height=this.maxHeight,e.width=ss(s)+l),r.display&&this.ticks.length){const{first:u,last:c,widest:d,highest:h}=this._getLabelSizes(),p=r.padding*2,v=Sr(this.labelRotation),y=Math.cos(v),w=Math.sin(v);if(a){const m=r.mirror?0:w*d.width+y*h.height;e.height=Math.min(this.maxHeight,e.height+m+p)}else{const m=r.mirror?0:y*d.width+w*h.height;e.width=Math.min(this.maxWidth,e.width+m+p)}this._calculatePadding(u,c,w,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,i){const{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const c=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,p=0;l?u?(h=i*e.width,p=r*n.height):(h=r*e.height,p=i*n.width):s==="start"?p=n.width:s==="end"?h=e.width:s!=="inner"&&(h=e.width/2,p=n.width/2),this.paddingLeft=Math.max((h-c+o)*this.width/(this.width-c),0),this.paddingRight=Math.max((p-d+o)*this.width/(this.width-d),0)}else{let c=n.height/2,d=e.height/2;s==="start"?(c=0,d=e.height):s==="end"&&(c=n.height,d=0),this.paddingTop=c+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(){ce(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n<r;n++)se(e[n].label)&&(e.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=pp(r,n)),this._labelSizes=e=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,r){const{ctx:i,_longestTextCache:s}=this,o=[],a=[],l=Math.floor(n/fp(n,r));let u=0,c=0,d,h,p,v,y,w,m,g,x,b,C;for(d=0;d<n;d+=l){if(v=e[d].label,y=this._resolveTickFontOptions(d),i.font=w=y.string,m=s[w]=s[w]||{data:{},gc:[]},g=y.lineHeight,x=b=0,!se(v)&&!Ce(v))x=Uf(i,m.data,m.gc,x,v),b=g;else if(Ce(v))for(h=0,p=v.length;h<p;++h)C=v[h],!se(C)&&!Ce(C)&&(x=Uf(i,m.data,m.gc,x,C),b+=g);o.push(x),a.push(b),u=Math.max(x,u),c=Math.max(b,c)}fC(s,n);const P=o.indexOf(u),_=a.indexOf(c),E=O=>({width:o[O]||0,height:a[O]||0});return{first:E(0),last:E(n-1),widest:E(P),highest:E(_),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return vS(this._alignToPixels?fr(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const r=n[e];return r.$context||(r.$context=mC(this.getContext(),e,r))}return this.$context||(this.$context=pC(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=Sr(this.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),s=this._getLabelSizes(),o=e.autoSkipPadding||0,a=s?s.widest.width+o:0,l=s?s.highest.height+o:0;return this.isHorizontal()?l*r>a*i?a/r:l/i:l*i<a*r?l/r:a/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,r=this.chart,i=this.options,{grid:s,position:o,border:a}=i,l=s.offset,u=this.isHorizontal(),d=this.ticks.length+(l?1:0),h=ss(s),p=[],v=a.setContext(this.getContext()),y=v.display?v.width:0,w=y/2,m=function(F){return fr(r,F,y)};let g,x,b,C,P,_,E,O,M,T,I,W;if(o==="top")g=m(this.bottom),_=this.bottom-h,O=g-w,T=m(e.top)+w,W=e.bottom;else if(o==="bottom")g=m(this.top),T=e.top,W=m(e.bottom)-w,_=g+w,O=this.top+h;else if(o==="left")g=m(this.right),P=this.right-h,E=g-w,M=m(e.left)+w,I=e.right;else if(o==="right")g=m(this.left),M=e.left,I=m(e.right)-w,P=g+w,E=this.left+h;else if(n==="x"){if(o==="center")g=m((e.top+e.bottom)/2+.5);else if(q(o)){const F=Object.keys(o)[0],ve=o[F];g=m(this.chart.scales[F].getPixelForValue(ve))}T=e.top,W=e.bottom,_=g+w,O=_+h}else if(n==="y"){if(o==="center")g=m((e.left+e.right)/2);else if(q(o)){const F=Object.keys(o)[0],ve=o[F];g=m(this.chart.scales[F].getPixelForValue(ve))}P=g-w,E=P-h,M=e.left,I=e.right}const oe=G(i.ticks.maxTicksLimit,d),Z=Math.max(1,Math.ceil(d/oe));for(x=0;x<d;x+=Z){const F=this.getContext(x),ve=s.setContext(F),j=a.setContext(F),A=ve.lineWidth,R=ve.color,B=j.dash||[],H=j.dashOffset,re=ve.tickWidth,$=ve.tickColor,ie=ve.tickBorderDash||[],pe=ve.tickBorderDashOffset;b=hC(this,x,l),b!==void 0&&(C=fr(r,b,A),u?P=E=M=I=C:_=O=T=W=C,p.push({tx1:P,ty1:_,tx2:E,ty2:O,x1:M,y1:T,x2:I,y2:W,width:A,color:R,borderDash:B,borderDashOffset:H,tickWidth:re,tickColor:$,tickBorderDash:ie,tickBorderDashOffset:pe}))}return this._ticksLength=d,this._borderValue=g,p}_computeLabelItems(e){const n=this.axis,r=this.options,{position:i,ticks:s}=r,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:u,padding:c,mirror:d}=s,h=ss(r.grid),p=h+c,v=d?-c:p,y=-Sr(this.labelRotation),w=[];let m,g,x,b,C,P,_,E,O,M,T,I,W="middle";if(i==="top")P=this.bottom-v,_=this._getXAxisLabelAlignment();else if(i==="bottom")P=this.top+v,_=this._getXAxisLabelAlignment();else if(i==="left"){const Z=this._getYAxisLabelAlignment(h);_=Z.textAlign,C=Z.x}else if(i==="right"){const Z=this._getYAxisLabelAlignment(h);_=Z.textAlign,C=Z.x}else if(n==="x"){if(i==="center")P=(e.top+e.bottom)/2+p;else if(q(i)){const Z=Object.keys(i)[0],F=i[Z];P=this.chart.scales[Z].getPixelForValue(F)+p}_=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")C=(e.left+e.right)/2-p;else if(q(i)){const Z=Object.keys(i)[0],F=i[Z];C=this.chart.scales[Z].getPixelForValue(F)}_=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?W="top":l==="end"&&(W="bottom"));const oe=this._getLabelSizes();for(m=0,g=a.length;m<g;++m){x=a[m],b=x.label;const Z=s.setContext(this.getContext(m));E=this.getPixelForTick(m)+s.labelOffset,O=this._resolveTickFontOptions(m),M=O.lineHeight,T=Ce(b)?b.length:1;const F=T/2,ve=Z.color,j=Z.textStrokeColor,A=Z.textStrokeWidth;let R=_;o?(C=E,_==="inner"&&(m===g-1?R=this.options.reverse?"left":"right":m===0?R=this.options.reverse?"right":"left":R="center"),i==="top"?u==="near"||y!==0?I=-T*M+M/2:u==="center"?I=-oe.highest.height/2-F*M+M:I=-oe.highest.height+M/2:u==="near"||y!==0?I=M/2:u==="center"?I=oe.highest.height/2-F*M:I=oe.highest.height-T*M,d&&(I*=-1),y!==0&&!Z.showLabelBackdrop&&(C+=M/2*Math.sin(y))):(P=E,I=(1-T)*M/2);let B;if(Z.showLabelBackdrop){const H=Pt(Z.backdropPadding),re=oe.heights[m],$=oe.widths[m];let ie=I-H.top,pe=0-H.left;switch(W){case"middle":ie-=re/2;break;case"bottom":ie-=re;break}switch(_){case"center":pe-=$/2;break;case"right":pe-=$;break;case"inner":m===g-1?pe-=$:m>0&&(pe-=$/2);break}B={left:pe,top:ie,width:$+H.width,height:re+H.height,color:Z.backdropColor}}w.push({label:b,font:O,textOffset:I,options:{rotation:y,color:ve,strokeColor:j,strokeWidth:A,textAlign:R,textBaseline:W,translation:[C,P],backdrop:B}})}return w}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Sr(this.labelRotation))return e==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:i,padding:s}}=this.options,o=this._getLabelSizes(),a=e+s,l=o.widest.width;let u,c;return n==="left"?i?(c=this.right+s,r==="near"?u="left":r==="center"?(u="center",c+=l/2):(u="right",c+=l)):(c=this.right-a,r==="near"?u="right":r==="center"?(u="center",c-=l/2):(u="left",c=this.left)):n==="right"?i?(c=this.left+s,r==="near"?u="right":r==="center"?(u="center",c-=l/2):(u="left",c-=l)):(c=this.left+a,r==="near"?u="left":r==="center"?(u="center",c+=l/2):(u="right",c=this.right)):u="right",{textAlign:u,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:i,width:s,height:o}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,i,s,o),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(s=>s.value===e);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,o;const a=(l,u,c)=>{!c.width||!c.color||(r.save(),r.lineWidth=c.width,r.strokeStyle=c.color,r.setLineDash(c.borderDash||[]),r.lineDashOffset=c.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(u.x,u.y),r.stroke(),r.restore())};if(n.display)for(s=0,o=i.length;s<o;++s){const l=i[s];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.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:e,ctx:n,options:{border:r,grid:i}}=this,s=r.setContext(this.getContext()),o=r.display?s.width:0;if(!o)return;const a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let u,c,d,h;this.isHorizontal()?(u=fr(e,this.left,o)-o/2,c=fr(e,this.right,a)+a/2,d=h=l):(d=fr(e,this.top,o)-o/2,h=fr(e,this.bottom,a)+a/2,u=c=l),n.save(),n.lineWidth=s.width,n.strokeStyle=s.color,n.beginPath(),n.moveTo(u,d),n.lineTo(c,h),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const r=this.ctx,i=this._computeLabelArea();i&&Wd(r,i);const s=this.getLabelItems(e);for(const o of s){const a=o.options,l=o.font,u=o.label,c=o.textOffset;Js(r,u,0,c,l,a)}i&&Hd(r)}drawTitle(){const{ctx:e,options:{position:n,title:r,reverse:i}}=this;if(!r.display)return;const s=Be(r.font),o=Pt(r.padding),a=r.align;let l=s.lineHeight/2;n==="bottom"||n==="center"||q(n)?(l+=o.bottom,Ce(r.text)&&(l+=s.lineHeight*(r.text.length-1))):l+=o.top;const{titleX:u,titleY:c,maxWidth:d,rotation:h}=yC(this,l,n,a);Js(e,r.text,0,0,s,{color:r.color,maxWidth:d,rotation:h,textAlign:gC(a,n,i),textBaseline:"middle",translation:[u,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,r=G(e.grid&&e.grid.z,-1),i=G(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Ui.prototype.draw?[{z:n,draw:s=>{this.draw(s)}}]:[{z:r,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let s,o;for(s=0,o=n.length;s<o;++s){const a=n[s];a[r]===this.id&&(!e||a.type===e)&&i.push(a)}return i}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return Be(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Uo{constructor(e,n,r){this.type=e,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let r;wC(n)&&(r=this.register(n));const i=this.items,s=e.id,o=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+e);return s in i||(i[s]=e,vC(e,o,r),this.override&&_e.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const n=this.items,r=e.id,i=this.scope;r in n&&delete n[r],i&&r in _e[i]&&(delete _e[i][r],this.override&&delete $r[r])}}function vC(t,e,n){const r=qs(Object.create(null),[n?_e.get(n):{},_e.get(e),t.defaults]);_e.set(e,r),t.defaultRoutes&&xC(e,t.defaultRoutes),t.descriptors&&_e.describe(e,t.descriptors)}function xC(t,e){Object.keys(e).forEach(n=>{const r=n.split("."),i=r.pop(),s=[t].concat(r).join("."),o=e[n].split("."),a=o.pop(),l=o.join(".");_e.route(s,i,l,a)})}function wC(t){return"id"in t&&"defaults"in t}class bC{constructor(){this.controllers=new Uo(Ps,"datasets",!0),this.elements=new Uo(or,"elements"),this.plugins=new Uo(Object,"plugins"),this.scales=new Uo(Ui,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(i=>{const s=r||this._getRegistryForType(i);r||s.isForType(i)||s===this.plugins&&i.id?this._exec(e,s,i):te(i,o=>{const a=r||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,r){const i=Ad(e);ce(r["before"+i],[],r),n[e](r),ce(r["after"+i],[],r)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(e))return r}return this.plugins}_get(e,n,r){const i=n.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+r+".");return i}}var Kt=new bC;class _C{constructor(){this._init=void 0}notify(e,n,r,i){if(n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const s=i?this._descriptors(e).filter(i):this._descriptors(e),o=this._notify(s,e,n,r);return n==="afterDestroy"&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),o}_notify(e,n,r,i){i=i||{};for(const s of e){const o=s.plugin,a=o[r],l=[n,i,s.options];if(ce(a,l,o)===!1&&i.cancelable)return!1}return!0}invalidate(){se(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const r=e&&e.config,i=G(r.options&&r.options.plugins,{}),s=SC(r);return i===!1&&!n?[]:CC(e,s,i,n)}_notifyStateChanges(e){const n=this._oldCache||[],r=this._cache,i=(s,o)=>s.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(i(n,r),e,"stop"),this._notify(i(r,n),e,"start")}}function SC(t){const e={},n=[],r=Object.keys(Kt.plugins.items);for(let s=0;s<r.length;s++)n.push(Kt.getPlugin(r[s]));const i=t.plugins||[];for(let s=0;s<i.length;s++){const o=i[s];n.indexOf(o)===-1&&(n.push(o),e[o.id]=!0)}return{plugins:n,localIds:e}}function kC(t,e){return!e&&t===!1?null:t===!0?{}:t}function CC(t,{plugins:e,localIds:n},r,i){const s=[],o=t.getContext();for(const a of e){const l=a.id,u=kC(r[l],i);u!==null&&s.push({plugin:a,options:EC(t.config,{plugin:a,local:n[l]},u,o)})}return s}function EC(t,{plugin:e,local:n},r,i){const s=t.pluginScopeKeys(e),o=t.getOptionScopes(r,s);return n&&e.defaults&&o.push(e.defaults),t.createResolver(o,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function bc(t,e){const n=_e.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function PC(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function MC(t,e){return t===e?"_index_":"_value_"}function gp(t){if(t==="x"||t==="y"||t==="r")return t}function TC(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function _c(t,...e){if(gp(t))return t;for(const n of e){const r=n.axis||TC(n.position)||t.length>1&&gp(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function yp(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function RC(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return yp(t,"x",n[0])||yp(t,"y",n[0])}return{}}function NC(t,e){const n=$r[t.type]||{scales:{}},r=e.scales||{},i=bc(t.type,e),s=Object.create(null);return Object.keys(r).forEach(o=>{const a=r[o];if(!q(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=_c(o,a,RC(o,t),_e.scales[a.type]),u=MC(l,i),c=n.scales||{};s[o]=ks(Object.create(null),[{axis:l},a,c[l],c[u]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||bc(a,e),c=($r[a]||{}).scales||{};Object.keys(c).forEach(d=>{const h=PC(d,l),p=o[h+"AxisID"]||h;s[p]=s[p]||Object.create(null),ks(s[p],[{axis:h},r[p],c[d]])})}),Object.keys(s).forEach(o=>{const a=s[o];ks(a,[_e.scales[a.type],_e.scale])}),s}function w0(t){const e=t.options||(t.options={});e.plugins=G(e.plugins,{}),e.scales=NC(t,e)}function b0(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function OC(t){return t=t||{},t.data=b0(t.data),w0(t),t}const vp=new Map,_0=new Set;function Vo(t,e){let n=vp.get(t);return n||(n=e(),vp.set(t,n),_0.add(n)),n}const os=(t,e,n)=>{const r=Li(e,n);r!==void 0&&t.add(r)};class jC{constructor(e){this._config=OC(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=b0(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),w0(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Vo(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return Vo(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return Vo(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return Vo(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let i=r.get(e);return(!i||n)&&(i=new Map,r.set(e,i)),i}getOptionScopes(e,n,r){const{options:i,type:s}=this,o=this._cachedScopes(e,r),a=o.get(n);if(a)return a;const l=new Set;n.forEach(c=>{e&&(l.add(e),c.forEach(d=>os(l,e,d))),c.forEach(d=>os(l,i,d)),c.forEach(d=>os(l,$r[s]||{},d)),c.forEach(d=>os(l,_e,d)),c.forEach(d=>os(l,wc,d))});const u=Array.from(l);return u.length===0&&u.push(Object.create(null)),_0.has(n)&&o.set(n,u),u}chartOptionScopes(){const{options:e,type:n}=this;return[e,$r[n]||{},_e.datasets[n]||{},{type:n},_e,wc]}resolveNamedOptions(e,n,r,i=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=xp(this._resolverCache,e,i);let l=o;if(LC(o,n)){s.$shared=!1,r=sr(r)?r():r;const u=this.createResolver(e,r,a);l=Fi(o,r,u)}for(const u of n)s[u]=l[u];return s}createResolver(e,n,r=[""],i){const{resolver:s}=xp(this._resolverCache,e,r);return q(n)?Fi(s,n,void 0,i):s}}function xp(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const i=n.join();let s=r.get(i);return s||(s={resolver:$d(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(i,s)),s}const DC=t=>q(t)&&Object.getOwnPropertyNames(t).some(e=>sr(t[e]));function LC(t,e){const{isScriptable:n,isIndexable:r}=o0(t);for(const i of e){const s=n(i),o=r(i),a=(o||s)&&t[i];if(s&&(sr(a)||DC(a))||o&&Ce(a))return!0}return!1}var FC="4.5.1";const IC=["top","bottom","left","right","chartArea"];function wp(t,e){return t==="top"||t==="bottom"||IC.indexOf(t)===-1&&e==="x"}function bp(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function _p(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),ce(n&&n.onComplete,[t],e)}function AC(t){const e=t.chart,n=e.options.animation;ce(n&&n.onProgress,[t],e)}function S0(t){return Qd()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const ha={},Sp=t=>{const e=S0(t);return Object.values(ha).filter(n=>n.canvas===e).pop()};function zC(t,e,n){const r=Object.keys(t);for(const i of r){const s=+i;if(s>=e){const o=t[i];delete t[i],(n>0||s>e)&&(t[s+n]=o)}}}function BC(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}var En;let gl=(En=class{static register(...e){Kt.add(...e),kp()}static unregister(...e){Kt.remove(...e),kp()}constructor(e,n){const r=this.config=new jC(n),i=S0(e),s=Sp(i);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||iC(i)),this.platform.updateConfig(r);const a=this.platform.acquireContext(i,o.aspectRatio),l=a&&a.canvas,u=l&&l.height,c=l&&l.width;if(this.id=nS(),this.ctx=a,this.canvas=l,this.width=c,this.height=u,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 _C,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=_S(d=>this.update(d),o.resizeDelay||0),this._dataChanges=[],ha[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}sn.listen(this,"complete",_p),sn.listen(this,"progress",AC),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:i,_aspectRatio:s}=this;return se(e)?n&&s?s:i?r/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Kt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Xf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Vf(this.canvas,this.ctx),this}stop(){return sn.stop(this),this}resize(e,n){sn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,i=this.canvas,s=r.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,e,n,s),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Xf(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),ce(r.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};te(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,i=Object.keys(r).reduce((o,a)=>(o[a]=!1,o),{});let s=[];n&&(s=s.concat(Object.keys(n).map(o=>{const a=n[o],l=_c(o,a),u=l==="r",c=l==="x";return{options:a,dposition:u?"chartArea":c?"bottom":"left",dtype:u?"radialLinear":c?"category":"linear"}}))),te(s,o=>{const a=o.options,l=a.id,u=_c(l,a),c=G(a.type,o.dtype);(a.position===void 0||wp(a.position,u)!==wp(o.dposition))&&(a.position=o.dposition),i[l]=!0;let d=null;if(l in r&&r[l].type===c)d=r[l];else{const h=Kt.getScale(c);d=new h({id:l,type:c,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(a,e)}),te(i,(o,a)=>{o||delete r[a]}),te(r,o=>{bt.configure(this,o,o.options),bt.addBox(this,o)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((i,s)=>i.index-s.index),r>n){for(let i=n;i<r;++i)this._destroyDatasetMeta(i);e.splice(n,r-n)}this._sortedMetasets=e.slice(0).sort(bp("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((r,i)=>{n.filter(s=>s===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r<i;r++){const s=n[r];let o=this.getDatasetMeta(r);const a=s.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(r),o=this.getDatasetMeta(r)),o.type=a,o.indexAxis=s.indexAxis||bc(a,this.options),o.order=s.order||0,o.index=r,o.label=""+s.label,o.visible=this.isDatasetVisible(r),o.controller)o.controller.updateIndex(r),o.controller.linkScales();else{const l=Kt.getController(a),{datasetElementType:u,dataElementType:c}=_e.datasets[a];Object.assign(l,{dataElementType:Kt.getElement(c),datasetElementType:u&&Kt.getElement(u)}),o.controller=new l(this,r),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){te(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,c=this.data.datasets.length;u<c;u++){const{controller:d}=this.getDatasetMeta(u),h=!i&&s.indexOf(d)===-1;d.buildOrUpdateElements(h),o=Math.max(+d.getMaxOverflow(),o)}o=this._minPadding=r.layout.autoPadding?o:0,this._updateLayout(o),i||te(s,u=>{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(bp("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){te(this.scales,e=>{bt.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Lf(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:s}of n){const o=r==="_removeElements"?-s:s;zC(e,i,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=s=>new Set(e.filter(o=>o[0]===s).map((o,a)=>a+","+o.splice(1).join(","))),i=r(0);for(let s=1;s<n;s++)if(!Lf(i,r(s)))return;return Array.from(i).map(s=>s.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;bt.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],te(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,s)=>{i._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,sr(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const r=this.getDatasetMeta(e),i={meta:r,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(r.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(sn.has(this)?this.attached&&!sn.running(this)&&sn.start(this):(this.draw(),_p({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:r,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,r=[];let i,s;for(i=0,s=n.length;i<s;++i){const o=n[i];(!e||o.visible)&&r.push(o)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r={meta:e,index:e.index,cancelable:!0},i=ak(this,e);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(i&&Wd(n,i),e.controller.draw(),i&&Hd(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return r0(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,i){const s=Ik.modes[n];return typeof s=="function"?s(this,e,r,i):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let i=r.filter(s=>s&&s._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=$i(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const i=r?"show":"hide",s=this.getDatasetMeta(e),o=s.controller._resolveAnimations(void 0,i);Gs(n)?(s.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),o.update(s,{visible:r}),this.update(a=>a.datasetIndex===e?i:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),sn.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Vf(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete ha[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,r=(s,o)=>{n.addEventListener(this,s,o),e[s]=o},i=(s,o,a)=>{s.offsetX=o,s.offsetY=a,this._eventHandler(s)};te(this.options.events,s=>r(s,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,u)=>{n.addEventListener(this,l,u),e[l]=u},i=(l,u)=>{e[l]&&(n.removeEventListener(this,l,u),delete e[l])},s=(l,u)=>{this.canvas&&this.resize(l,u)};let o;const a=()=>{i("attach",a),this.attached=!0,this.resize(),r("resize",s),r("detach",o)};o=()=>{this.attached=!1,i("resize",s),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){te(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},te(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const i=r?"set":"remove";let s,o,a,l;for(n==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){o=e[a];const u=o&&this.getDatasetMeta(o.datasetIndex).controller;u&&u[i+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],r=e.map(({datasetIndex:s,index:o})=>{const a=this.getDatasetMeta(s);if(!a)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:a.data[o],index:o}});!Wa(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const i=this.options.hover,s=(l,u)=>l.filter(c=>!u.some(d=>c.datasetIndex===d.datasetIndex&&c.index===d.index)),o=s(n,e),a=r?e:s(e,n);o.length&&this.updateHoverStyle(o,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},i=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const s=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(s||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:i=[],options:s}=this,o=n,a=this._getActiveElements(e,i,r,o),l=lS(e),u=BC(e,this._lastEvent,r,l);r&&(this._lastEvent=null,ce(s.onHover,[e,a,this],this),l&&ce(s.onClick,[e,a,this],this));const c=!Wa(a,i);return(c||n)&&(this._active=a,this._updateHoverStyles(a,i,n)),this._lastEvent=u,c}_getActiveElements(e,n,r,i){if(e.type==="mouseout")return[];if(!r)return n;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,i)}},K(En,"defaults",_e),K(En,"instances",ha),K(En,"overrides",$r),K(En,"registry",Kt),K(En,"version",FC),K(En,"getChart",Sp),En);function kp(){return te(gl.instances,t=>t._plugins.invalidate())}function k0(t,e){const{x:n,y:r,base:i,width:s,height:o}=t.getProps(["x","y","base","width","height"],e);let a,l,u,c,d;return t.horizontal?(d=o/2,a=Math.min(n,i),l=Math.max(n,i),u=r-d,c=r+d):(d=s/2,a=n-d,l=n+d,u=Math.min(r,i),c=Math.max(r,i)),{left:a,top:u,right:l,bottom:c}}function Un(t,e,n,r){return t?0:Lt(e,n,r)}function WC(t,e,n){const r=t.options.borderWidth,i=t.borderSkipped,s=s0(r);return{t:Un(i.top,s.top,0,n),r:Un(i.right,s.right,0,e),b:Un(i.bottom,s.bottom,0,n),l:Un(i.left,s.left,0,e)}}function HC(t,e,n){const{enableBorderRadius:r}=t.getProps(["enableBorderRadius"]),i=t.options.borderRadius,s=pi(i),o=Math.min(e,n),a=t.borderSkipped,l=r||q(i);return{topLeft:Un(!l||a.top||a.left,s.topLeft,0,o),topRight:Un(!l||a.top||a.right,s.topRight,0,o),bottomLeft:Un(!l||a.bottom||a.left,s.bottomLeft,0,o),bottomRight:Un(!l||a.bottom||a.right,s.bottomRight,0,o)}}function $C(t){const e=k0(t),n=e.right-e.left,r=e.bottom-e.top,i=WC(t,n/2,r/2),s=HC(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r,radius:s},inner:{x:e.left+i.l,y:e.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,s.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(i.b,i.r))}}}}function su(t,e,n,r){const i=e===null,s=n===null,a=t&&!(i&&s)&&k0(t,r);return a&&(i||ai(e,a.left,a.right))&&(s||ai(n,a.top,a.bottom))}function UC(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function VC(t,e){t.rect(e.x,e.y,e.w,e.h)}function ou(t,e,n={}){const r=t.x!==n.x?-e:0,i=t.y!==n.y?-e:0,s=(t.x+t.w!==n.x+n.w?e:0)-r,o=(t.y+t.h!==n.y+n.h?e:0)-i;return{x:t.x+r,y:t.y+i,w:t.w+s,h:t.h+o,radius:t.radius}}class fa extends or{constructor(e){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,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:r,backgroundColor:i}}=this,{inner:s,outer:o}=$C(this),a=UC(o.radius)?Va:VC;e.save(),(o.w!==s.w||o.h!==s.h)&&(e.beginPath(),a(e,ou(o,n,s)),e.clip(),a(e,ou(s,-n,o)),e.fillStyle=r,e.fill("evenodd")),e.beginPath(),a(e,ou(s,n)),e.fillStyle=i,e.fill(),e.restore()}inRange(e,n,r){return su(this,e,n,r)}inXRange(e,n){return su(this,e,null,n)}inYRange(e,n){return su(this,null,e,n)}getCenterPoint(e){const{x:n,y:r,base:i,horizontal:s}=this.getProps(["x","y","base","horizontal"],e);return{x:s?(n+i)/2:n,y:s?r:(r+i)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}K(fa,"id","bar"),K(fa,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),K(fa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const Cp=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},QC=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Ep extends or{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=ce(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,i)=>e.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,i=Be(r.font),s=i.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Cp(r,s);let u,c;n.font=i.string,this.isHorizontal()?(u=this.maxWidth,c=this._fitRows(o,s,a,l)+10):(c=this.maxHeight,u=this._fitCols(o,i,a,l)+10),this.width=Math.min(u,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,i){const{ctx:s,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.lineWidths=[0],c=i+a;let d=e;s.textAlign="left",s.textBaseline="middle";let h=-1,p=-c;return this.legendItems.forEach((v,y)=>{const w=r+n/2+s.measureText(v.text).width;(y===0||u[u.length-1]+w+2*a>o)&&(d+=c,u[u.length-(y>0?0:1)]=0,p+=c,h++),l[y]={left:0,top:p,row:h,width:w,height:i},u[u.length-1]+=w+a}),d}_fitCols(e,n,r,i){const{ctx:s,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],u=this.columnSizes=[],c=o-e;let d=a,h=0,p=0,v=0,y=0;return this.legendItems.forEach((w,m)=>{const{itemWidth:g,itemHeight:x}=YC(r,n,s,w,i);m>0&&p+x+2*a>c&&(d+=h+a,u.push({width:h,height:p}),v+=h+a,y++,h=p=0),l[m]={left:v,top:p,col:y,width:g,height:x},h=Math.max(h,g),p+=x+a}),d+=h,u.push({width:h,height:p}),d}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:s}}=this,o=mi(s,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ae(r,this.left+i,this.right-this.lineWidths[a]);for(const u of n)a!==u.row&&(a=u.row,l=Ae(r,this.left+i,this.right-this.lineWidths[a])),u.top+=this.top+e+i,u.left=o.leftForLtr(o.x(l),u.width),l+=u.width+i}else{let a=0,l=Ae(r,this.top+e+i,this.bottom-this.columnSizes[a].height);for(const u of n)u.col!==a&&(a=u.col,l=Ae(r,this.top+e+i,this.bottom-this.columnSizes[a].height)),u.top=l,u.left+=this.left+i,u.left=o.leftForLtr(o.x(u.left),u.width),l+=u.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;Wd(e,this),this._draw(),Hd(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:i}=this,{align:s,labels:o}=e,a=_e.color,l=mi(e.rtl,this.left,this.width),u=Be(o.font),{padding:c}=o,d=u.size,h=d/2;let p;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=u.string;const{boxWidth:v,boxHeight:y,itemHeight:w}=Cp(o,d),m=function(P,_,E){if(isNaN(v)||v<=0||isNaN(y)||y<0)return;i.save();const O=G(E.lineWidth,1);if(i.fillStyle=G(E.fillStyle,a),i.lineCap=G(E.lineCap,"butt"),i.lineDashOffset=G(E.lineDashOffset,0),i.lineJoin=G(E.lineJoin,"miter"),i.lineWidth=O,i.strokeStyle=G(E.strokeStyle,a),i.setLineDash(G(E.lineDash,[])),o.usePointStyle){const M={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:O},T=l.xPlus(P,v/2),I=_+h;n0(i,M,T,I,o.pointStyleWidth&&v)}else{const M=_+Math.max((d-y)/2,0),T=l.leftForLtr(P,v),I=pi(E.borderRadius);i.beginPath(),Object.values(I).some(W=>W!==0)?Va(i,{x:T,y:M,w:v,h:y,radius:I}):i.rect(T,M,v,y),i.fill(),O!==0&&i.stroke()}i.restore()},g=function(P,_,E){Js(i,E.text,P,_+w/2,u,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},x=this.isHorizontal(),b=this._computeTitleHeight();x?p={x:Ae(s,this.left+c,this.right-r[0]),y:this.top+c+b,line:0}:p={x:this.left+c,y:Ae(s,this.top+b+c,this.bottom-n[0].height),line:0},c0(this.ctx,e.textDirection);const C=w+c;this.legendItems.forEach((P,_)=>{i.strokeStyle=P.fontColor,i.fillStyle=P.fontColor;const E=i.measureText(P.text).width,O=l.textAlign(P.textAlign||(P.textAlign=o.textAlign)),M=v+h+E;let T=p.x,I=p.y;l.setWidth(this.width),x?_>0&&T+M+c>this.right&&(I=p.y+=C,p.line++,T=p.x=Ae(s,this.left+c,this.right-r[p.line])):_>0&&I+C>this.bottom&&(T=p.x=T+n[p.line].width+c,p.line++,I=p.y=Ae(s,this.top+b+c,this.bottom-n[p.line].height));const W=l.x(T);if(m(W,I,P),T=SS(O,T+v+h,x?T+M:this.right,e.rtl),g(l.x(T),I,P),x)p.x+=M+c;else if(typeof P.text!="string"){const oe=u.lineHeight;p.y+=C0(P,oe)+c}else p.y+=C}),d0(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=Be(n.font),i=Pt(n.padding);if(!n.display)return;const s=mi(e.rtl,this.left,this.width),o=this.ctx,a=n.position,l=r.size/2,u=i.top+l;let c,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),c=this.top+u,d=Ae(e.align,d,this.right-h);else{const v=this.columnSizes.reduce((y,w)=>Math.max(y,w.height),0);c=u+Ae(e.align,this.top,this.bottom-v-e.labels.padding-this._computeTitleHeight())}const p=Ae(a,d,d+h);o.textAlign=s.textAlign(Bd(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=r.string,Js(o,n.text,p,c,r)}_computeTitleHeight(){const e=this.options.title,n=Be(e.font),r=Pt(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,i,s;if(ai(e,this.left,this.right)&&ai(n,this.top,this.bottom)){for(s=this.legendHitBoxes,r=0;r<s.length;++r)if(i=s[r],ai(e,i.left,i.left+i.width)&&ai(n,i.top,i.top+i.height))return this.legendItems[r]}return null}handleEvent(e){const n=this.options;if(!qC(e.type,n))return;const r=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,s=QC(i,r);i&&!s&&ce(n.onLeave,[e,i,this],this),this._hoveredItem=r,r&&!s&&ce(n.onHover,[e,r,this],this)}else r&&ce(n.onClick,[e,r,this],this)}}function YC(t,e,n,r,i){const s=KC(r,t,e,n),o=XC(i,r,e.lineHeight);return{itemWidth:s,itemHeight:o}}function KC(t,e,n,r){let i=t.text;return i&&typeof i!="string"&&(i=i.reduce((s,o)=>s.length>o.length?s:o)),e+n.size/2+r.measureText(i).width}function XC(t,e,n){let r=t;return typeof e.text!="string"&&(r=C0(e,n)),r}function C0(t,e){const n=t.text?t.text.length:0;return e*n}function qC(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var GC={id:"legend",_element:Ep,start(t,e,n){const r=t.legend=new Ep({ctx:t.ctx,options:n,chart:t});bt.configure(t,r,n),bt.addBox(t,r)},stop(t){bt.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;bt.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),e.hidden=!0):(i.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:s,useBorderRadius:o,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const u=l.controller.getStyle(n?0:void 0),c=Pt(u.borderWidth);return{text:e[l.index].label,fillStyle:u.backgroundColor,fontColor:s,hidden:!l.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:u.borderColor,pointStyle:r||u.pointStyle,rotation:u.rotation,textAlign:i||u.textAlign,borderRadius:o&&(a||u.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class E0 extends or{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const i=Ce(r.text)?r.text.length:1;this._padding=Pt(r.padding);const s=i*Be(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:i,right:s,options:o}=this,a=o.align;let l=0,u,c,d;return this.isHorizontal()?(c=Ae(a,r,s),d=n+e,u=s-r):(o.position==="left"?(c=r+e,d=Ae(a,i,n),l=We*-.5):(c=s-e,d=Ae(a,n,i),l=We*.5),u=i-n),{titleX:c,titleY:d,maxWidth:u,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=Be(n.font),s=r.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:u}=this._drawArgs(s);Js(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:u,textAlign:Bd(n.align),textBaseline:"middle",translation:[o,a]})}}function JC(t,e){const n=new E0({ctx:t.ctx,options:e,chart:t});bt.configure(t,n,e),bt.addBox(t,n),t.titleBlock=n}var ZC={id:"title",_element:E0,start(t,e,n){JC(t,n)},stop(t){const e=t.titleBlock;bt.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;bt.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ps={average(t){if(!t.length)return!1;let e,n,r=new Set,i=0,s=0;for(e=0,n=t.length;e<n;++e){const a=t[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),i+=l.y,++s}}return s===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+l)/r.size,y:i/s}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,i=Number.POSITIVE_INFINITY,s,o,a;for(s=0,o=t.length;s<o;++s){const l=t[s].element;if(l&&l.hasValue()){const u=l.getCenterPoint(),c=gS(e,u);c<i&&(i=c,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function Qt(t,e){return e&&(Ce(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function on(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
|
|
67
67
|
`)>-1?t.split(`
|
|
68
|
-
`):t}function e2(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:o,value:a}=s.getLabelAndValue(i);return{chart:t,label:o,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:a,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Pp(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=Be(e.bodyFont),u=Be(e.titleFont),c=Be(e.footerFont),d=s.length,h=i.length,p=r.length,v=Pt(e.padding);let y=v.height,w=0,m=r.reduce((b,C)=>b+C.before.length+C.lines.length+C.after.length,0);if(m+=t.beforeBody.length+t.afterBody.length,d&&(y+=d*u.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),m){const b=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=p*b+(m-p)*l.lineHeight+(m-1)*e.bodySpacing}h&&(y+=e.footerMarginTop+h*c.lineHeight+(h-1)*e.footerSpacing);let g=0;const x=function(b){w=Math.max(w,n.measureText(b).width+g)};return n.save(),n.font=u.string,te(t.title,x),n.font=l.string,te(t.beforeBody.concat(t.afterBody),x),g=e.displayColors?o+2+e.boxPadding:0,te(r,b=>{te(b.before,x),te(b.lines,x),te(b.after,x)}),g=0,n.font=c.string,te(t.footer,x),n.restore(),w+=v.width,{width:w,height:y}}function t2(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function n2(t,e,n,r){const{x:i,width:s}=r,o=n.caretSize+n.caretPadding;if(t==="left"&&i+s+o>e.width||t==="right"&&i-s-o<0)return!0}function r2(t,e,n,r){const{x:i,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let u="center";return r==="center"?u=i<=(a+l)/2?"left":"right":i<=s/2?u="left":i>=o-s/2&&(u="right"),n2(u,t,e,n)&&(u="center"),u}function Mp(t,e,n){const r=n.yAlign||e.yAlign||t2(t,n);return{xAlign:n.xAlign||e.xAlign||r2(t,e,n,r),yAlign:r}}function i2(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function s2(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function Tp(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,u=i+s,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:p}=pi(o);let v=i2(e,a);const y=s2(e,l,u);return l==="center"?a==="left"?v+=u:a==="right"&&(v-=u):a==="left"?v-=Math.max(c,h)+i:a==="right"&&(v+=Math.max(d,p)+i),{x:Lt(v,0,r.width-e.width),y:Lt(y,0,r.height-e.height)}}function Qo(t,e,n){const r=Pt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function Rp(t){return Qt([],on(t))}function o2(t,e,n){return $i(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Np(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const P0={beforeTitle:nn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:nn,beforeBody:nn,beforeLabel:nn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return se(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:nn,afterBody:nn,beforeFooter:nn,footer:nn,afterFooter:nn};function Ge(t,e,n,r){const i=t[e].call(n,r);return typeof i>"u"?P0[e].call(n,r):i}class Sc extends or{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new h0(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=o2(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=Ge(r,"beforeTitle",this,e),s=Ge(r,"title",this,e),o=Ge(r,"afterTitle",this,e);let a=[];return a=Qt(a,on(i)),a=Qt(a,on(s)),a=Qt(a,on(o)),a}getBeforeBody(e,n){return Rp(Ge(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return te(e,s=>{const o={before:[],lines:[],after:[]},a=Np(r,s);Qt(o.before,on(Ge(a,"beforeLabel",this,s))),Qt(o.lines,Ge(a,"label",this,s)),Qt(o.after,on(Ge(a,"afterLabel",this,s))),i.push(o)}),i}getAfterBody(e,n){return Rp(Ge(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=Ge(r,"beforeFooter",this,e),s=Ge(r,"footer",this,e),o=Ge(r,"afterFooter",this,e);let a=[];return a=Qt(a,on(i)),a=Qt(a,on(s)),a=Qt(a,on(o)),a}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],o=[];let a=[],l,u;for(l=0,u=n.length;l<u;++l)a.push(e2(this.chart,n[l]));return e.filter&&(a=a.filter((c,d,h)=>e.filter(c,d,h,r))),e.itemSort&&(a=a.sort((c,d)=>e.itemSort(c,d,r))),te(a,c=>{const d=Np(e.callbacks,c);i.push(Ge(d,"labelColor",this,c)),s.push(Ge(d,"labelPointStyle",this,c)),o.push(Ge(d,"labelTextColor",this,c))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,o=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const a=ps[r.position].call(this,i,this._eventPosition);o=this._createItems(r),this.title=this.getTitle(o,r),this.beforeBody=this.getBeforeBody(o,r),this.body=this.getBody(o,r),this.afterBody=this.getAfterBody(o,r),this.footer=this.getFooter(o,r);const l=this._size=Pp(this,r),u=Object.assign({},a,l),c=Mp(this.chart,r,u),d=Tp(r,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={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,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:o,cornerRadius:a}=r,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:d}=pi(a),{x:h,y:p}=e,{width:v,height:y}=n;let w,m,g,x,b,C;return s==="center"?(b=p+y/2,i==="left"?(w=h,m=w-o,x=b+o,C=b-o):(w=h+v,m=w+o,x=b-o,C=b+o),g=w):(i==="left"?m=h+Math.max(l,c)+o:i==="right"?m=h+v-Math.max(u,d)-o:m=this.caretX,s==="top"?(x=p,b=x-o,w=m-o,g=m+o):(x=p+y,b=x+o,w=m+o,g=m-o),C=x),{x1:w,x2:m,x3:g,y1:x,y2:b,y3:C}}drawTitle(e,n,r){const i=this.title,s=i.length;let o,a,l;if(s){const u=mi(r.rtl,this.x,this.width);for(e.x=Qo(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",o=Be(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=o.string,l=0;l<s;++l)n.fillText(i[l],u.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===s&&(e.y+=r.titleMarginBottom-a)}}_drawColorBox(e,n,r,i,s){const o=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:u}=s,c=Be(s.bodyFont),d=Qo(this,"left",s),h=i.x(d),p=l<c.lineHeight?(c.lineHeight-l)/2:0,v=n.y+p;if(s.usePointStyle){const y={radius:Math.min(u,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},w=i.leftForLtr(h,u)+u/2,m=v+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,Qf(e,y,w,m),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,Qf(e,y,w,m)}else{e.lineWidth=q(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const y=i.leftForLtr(h,u),w=i.leftForLtr(i.xPlus(h,1),u-2),m=pi(o.borderRadius);Object.values(m).some(g=>g!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,Va(e,{x:y,y:v,w:u,h:l,radius:m}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Va(e,{x:w,y:v+1,w:u-2,h:l-2,radius:m}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(y,v,u,l),e.strokeRect(y,v,u,l),e.fillStyle=o.backgroundColor,e.fillRect(w,v+1,u-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:c}=r,d=Be(r.bodyFont);let h=d.lineHeight,p=0;const v=mi(r.rtl,this.x,this.width),y=function(E){n.fillText(E,v.x(e.x+p),e.y+h/2),e.y+=h+s},w=v.textAlign(o);let m,g,x,b,C,P,_;for(n.textAlign=o,n.textBaseline="middle",n.font=d.string,e.x=Qo(this,w,r),n.fillStyle=r.bodyColor,te(this.beforeBody,y),p=a&&w!=="right"?o==="center"?u/2+c:u+2+c:0,b=0,P=i.length;b<P;++b){for(m=i[b],g=this.labelTextColors[b],n.fillStyle=g,te(m.before,y),x=m.lines,a&&x.length&&(this._drawColorBox(n,e,b,v,r),h=Math.max(d.lineHeight,l)),C=0,_=x.length;C<_;++C)y(x[C]),h=d.lineHeight;te(m.after,y)}p=0,h=d.lineHeight,te(this.afterBody,y),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let o,a;if(s){const l=mi(r.rtl,this.x,this.width);for(e.x=Qo(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",o=Be(r.footerFont),n.fillStyle=r.footerColor,n.font=o.string,a=0;a<s;++a)n.fillText(i[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:o}=this,{x:a,y:l}=e,{width:u,height:c}=r,{topLeft:d,topRight:h,bottomLeft:p,bottomRight:v}=pi(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+d,l),o==="top"&&this.drawCaret(e,n,r,i),n.lineTo(a+u-h,l),n.quadraticCurveTo(a+u,l,a+u,l+h),o==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(a+u,l+c-v),n.quadraticCurveTo(a+u,l+c,a+u-v,l+c),o==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(a+p,l+c),n.quadraticCurveTo(a,l+c,a,l+c-p),o==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(a,l+d),n.quadraticCurveTo(a,l,a+d,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const o=ps[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Pp(this,e),l=Object.assign({},o,this._size),u=Mp(n,e,l),c=Tp(e,l,u,n);(i._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const o=Pt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),c0(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),d0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),s=!Wa(r,i),o=this._positionChanged(i,n);(s||o)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,r),a=this._positionChanged(o,e),l=n||!Wa(o,s)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,o=ps[s.position].call(this,e,n);return o!==!1&&(r!==o.x||i!==o.y)}}K(Sc,"positioners",ps);var a2={id:"tooltip",_element:Sc,positioners:ps,afterInit(t,e,n){n&&(t.tooltip=new Sc({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:P0},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const l2=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function u2(t,e,n,r){const i=t.indexOf(e);if(i===-1)return l2(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const c2=(t,e)=>t===null?null:Lt(Math.round(t),0,e);function Op(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class kc extends Ui{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(se(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:u2(r,e,G(n,e),this._addedLabels),c2(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let o=e;o<=n;o++)i.push({value:o});return i}getLabelForValue(e){return Op.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}K(kc,"id","category"),K(kc,"defaults",{ticks:{callback:Op}});function d2(t,e){const n=[],{bounds:i,step:s,min:o,max:a,precision:l,count:u,maxTicks:c,maxDigits:d,includeBounds:h}=t,p=s||1,v=c-1,{min:y,max:w}=e,m=!se(o),g=!se(a),x=!se(u),b=(w-y)/(d+1);let C=If((w-y)/v/p)*p,P,_,E,O;if(C<1e-14&&!m&&!g)return[{value:y},{value:w}];O=Math.ceil(w/C)-Math.floor(y/C),O>v&&(C=If(O*C/v/p)*p),se(l)||(P=Math.pow(10,l),C=Math.ceil(C*P)/P),i==="ticks"?(_=Math.floor(y/C)*C,E=Math.ceil(w/C)*C):(_=y,E=w),m&&g&&s&&hS((a-o)/s,C/1e3)?(O=Math.round(Math.min((a-o)/C,c)),C=(a-o)/O,_=o,E=a):x?(_=m?o:_,E=g?a:E,O=u-1,C=(E-_)/O):(O=(E-_)/C,ua(O,Math.round(O),C/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Af(C),Af(_));P=Math.pow(10,se(l)?M:l),_=Math.round(_*P)/P,E=Math.round(E*P)/P;let T=0;for(m&&(h&&_!==o?(n.push({value:o}),_<o&&T++,ua(Math.round((_+T*C)*P)/P,o,jp(o,b,t))&&T++):_<o&&T++);T<O;++T){const I=Math.round((_+T*C)*P)/P;if(g&&I>a)break;n.push({value:I})}return g&&h&&E!==a?n.length&&ua(n[n.length-1].value,a,jp(a,b,t))?n[n.length-1].value=a:n.push({value:a}):(!g||E===a)&&n.push({value:E}),n}function jp(t,e,{horizontal:n,minRotation:r}){const i=Sr(r),s=(n?Math.sin(i):Math.cos(i))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class h2 extends Ui{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return se(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const o=l=>i=n?i:l,a=l=>s=r?s:l;if(e){const l=nr(i),u=nr(s);l<0&&u<0?a(0):l>0&&u>0&&o(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=d2(i,s);return e.bounds==="ticks"&&fS(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return e0(e,this.chart.options.locale,this.options.ticks.format)}}class Cc extends h2{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=Et(e)?e:0,this.max=Et(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=Sr(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}K(Cc,"id","linear"),K(Cc,"defaults",{ticks:{callback:t0.formatters.numeric}});const yl={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}},tt=Object.keys(yl);function Dp(t,e){return t-e}function Lp(t,e){if(se(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let o=e;return typeof r=="function"&&(o=r(o)),Et(o)||(o=typeof r=="string"?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i==="week"&&(Ua(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,i)),+o)}function Fp(t,e,n,r){const i=tt.length;for(let s=tt.indexOf(t);s<i-1;++s){const o=yl[tt[s]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=r)return tt[s]}return tt[i-1]}function f2(t,e,n,r,i){for(let s=tt.length-1;s>=tt.indexOf(n);s--){const o=tt[s];if(yl[o].common&&t._adapter.diff(i,r,o)>=e-1)return o}return tt[n?tt.indexOf(n):0]}function p2(t){for(let e=tt.indexOf(t)+1,n=tt.length;e<n;++e)if(yl[tt[e]].common)return tt[e]}function Ip(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=zd(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function m2(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+i.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function Ap(t,e,n){const r=[],i={},s=e.length;let o,a;for(o=0;o<s;++o)a=e[o],i[a]=o,r.push({value:a,major:!1});return s===0||!n?r:m2(t,r,i,n)}class Ka extends Ui{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new Ok._date(e.adapters.date);i.init(n),ks(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:Lp(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:o,maxDefined:a}=this.getUserBounds();function l(u){!o&&!isNaN(u.min)&&(i=Math.min(i,u.min)),!a&&!isNaN(u.max)&&(s=Math.max(s,u.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Et(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=Et(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,o=this.max,a=wS(i,s,o);return this._unit=n.unit||(r.autoSkip?Fp(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):f2(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:p2(this._unit),this.initOffsets(i),e.reverse&&a.reverse(),Ap(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=Lt(n,0,o),r=Lt(r,0,o),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,o=s.unit||Fp(s.minUnit,n,r,this._getLabelCapacity(n)),a=G(i.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,u=Ua(l)||l===!0,c={};let d=n,h,p;if(u&&(d=+e.startOf(d,"isoWeek",l)),d=+e.startOf(d,u?"day":o),e.diff(r,n,o)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+o);const v=i.ticks.source==="data"&&this.getDataTimestamps();for(h=d,p=0;h<r;h=+e.add(h,a,o),p++)Ip(c,h,v);return(h===r||i.bounds==="ticks"||p===1)&&Ip(c,h,v),Object.keys(c).sort(Dp).map(y=>+y)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,o=n||i[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,r,i){const s=this.options,o=s.ticks.callback;if(o)return ce(o,[e,n,r],this);const a=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&a[l],d=u&&a[u],h=r[n],p=u&&d&&h&&h.major;return this._adapter.format(e,i||(p?d:c))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=Sr(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:r*s+a*o,h:r*o+a*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,Ap(this,[e],this._majorUnit),i),o=this._getLabelSize(s),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(Lp(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return qy(e.sort(Dp))}}K(Ka,"id","time"),K(Ka,"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 Yo(t,e,n){let r=0,i=t.length-1,s,o,a,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=xc(t,"pos",e)),{pos:s,time:a}=t[r],{pos:o,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=xc(t,"time",e)),{time:s,pos:a}=t[r],{time:o,pos:l}=t[i]);const u=o-s;return u?a+(l-a)*(e-s)/u:a}class zp extends Ka{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Yo(n,this.min),this._tableRange=Yo(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let o,a,l,u,c;for(o=0,a=e.length;o<a;++o)u=e[o],u>=n&&u<=r&&i.push(u);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(o=0,a=i.length;o<a;++o)c=i[o+1],l=i[o-1],u=i[o],Math.round((c+l)/2)!==u&&s.push({time:u,pos:o/(a-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Yo(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Yo(this._table,r*this._tableRange+this._minPos,!0)}}K(zp,"id","timeseries"),K(zp,"defaults",Ka.defaults);const M0="label";function Bp(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function g2(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function T0(t,e){t.labels=e}function R0(t,e,n=M0){const r=[];t.datasets=e.map(i=>{const s=t.datasets.find(o=>o[n]===i[n]);return!s||!i.data||r.includes(s)?{...i}:(r.push(s),Object.assign(s,i),s)})}function y2(t,e=M0){const n={labels:[],datasets:[]};return T0(n,t.labels),R0(n,t.datasets,e),n}function v2(t,e){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:o,data:a,options:l,plugins:u=[],fallbackContent:c,updateMode:d,...h}=t,p=k.useRef(null),v=k.useRef(null),y=()=>{p.current&&(v.current=new gl(p.current,{type:o,data:y2(a,s),options:l&&{...l},plugins:u}),Bp(e,v.current))},w=()=>{Bp(e,null),v.current&&(v.current.destroy(),v.current=null)};return k.useEffect(()=>{!i&&v.current&&l&&g2(v.current,l)},[i,l]),k.useEffect(()=>{!i&&v.current&&T0(v.current.config.data,a.labels)},[i,a.labels]),k.useEffect(()=>{!i&&v.current&&a.datasets&&R0(v.current.config.data,a.datasets,s)},[i,a.datasets]),k.useEffect(()=>{v.current&&(i?(w(),setTimeout(y)):v.current.update(d))},[i,l,a.labels,a.datasets,d]),k.useEffect(()=>{v.current&&(w(),setTimeout(y))},[o]),k.useEffect(()=>(y(),()=>w()),[]),f.jsx("canvas",{ref:p,role:"img",height:n,width:r,...h,children:c})}const x2=k.forwardRef(v2);function w2(t,e){return gl.register(e),k.forwardRef((n,r)=>f.jsx(x2,{...n,ref:r,type:t}))}const au=w2("bar",ca);gl.register(kc,Cc,fa,ZC,a2,GC);function b2(t,e="12px sans-serif"){const r=document.createElement("canvas").getContext("2d");return r?(r.font=e,r.measureText(t).width):0}function Ut({label:t,percentage:e,color:n,title:r}){const i=k.useRef(null),[s,o]=k.useState(!1);return k.useEffect(()=>{const a=()=>{if(i.current){const u=i.current.offsetWidth,c=b2(t,'bold 12px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif');o(u>=c+8)}};a(),window.addEventListener("resize",a);const l=new ResizeObserver(a);return i.current&&l.observe(i.current),()=>{window.removeEventListener("resize",a),l.disconnect()}},[t,e]),f.jsx("div",{ref:i,className:`${n} flex items-center justify-center text-xs font-semibold transition-all`,style:{width:`${e}%`,minWidth:"2px"},title:r,children:s&&f.jsx("span",{className:"text-white",children:t})})}function U(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(2)}K`:t.toLocaleString()}function ot(t){return`$${t.toFixed(2)}`}function Vt({title:t,value:e,subtitle:n,color:r="blue"}){const i={blue:"bg-blue-500/10 border-blue-500/20",green:"bg-green-500/10 border-green-500/20",purple:"bg-purple-500/10 border-purple-500/20",orange:"bg-orange-500/10 border-orange-500/20",pink:"bg-pink-500/10 border-pink-500/20",cyan:"bg-cyan-500/10 border-cyan-500/20"};return f.jsxs("div",{className:`p-6 rounded-lg border ${i[r]||i.blue}`,children:[f.jsx("div",{className:"text-sm text-gray-400 mb-1",children:t}),f.jsx("div",{className:"text-3xl font-bold mb-1",children:e}),n&&f.jsx("div",{className:"text-xs text-gray-500",children:n})]})}function _2(){const[t,e]=k.useState("7"),{data:n,isLoading:r,error:i}=Cd({queryKey:["token-statistics",t],queryFn:async()=>{const l=await fetch(`/api/statistics/tokens?days=${t}`);if(!l.ok)throw new Error("Failed to fetch token statistics");return l.json()}}),s=()=>f.jsxs("div",{className:"p-6 rounded-lg border bg-gray-800/50 border-gray-700 animate-pulse",children:[f.jsx("div",{className:"h-4 bg-gray-700 rounded w-1/2 mb-3"}),f.jsx("div",{className:"h-8 bg-gray-700 rounded w-3/4 mb-2"}),f.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3"})]}),o=()=>f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 border border-gray-700 animate-pulse",children:[f.jsx("div",{className:"h-6 bg-gray-700 rounded w-1/3 mb-6"}),f.jsx("div",{className:"h-64 bg-gray-700 rounded"})]}),a=()=>{if(i)return f.jsx("div",{className:"flex items-center justify-center h-96",children:f.jsxs("div",{className:"text-red-400",children:["Error loading statistics: ",i.message]})});if(!n)return f.jsx("div",{className:"flex items-center justify-center h-96",children:f.jsx("div",{className:"text-gray-400",children:"No data available"})});const{overview:l,daily:u,byProject:c,byModel:d,cache:h,cost:p,productivity:v,trends:y}=n,w=[...u.map(_=>_.usage.totalTokens)].sort((_,E)=>_-E),m=Math.floor(w.length*.95),g=Math.max(w[m]||1,1),x=u.map(_=>_.usage.totalTokens),b=x.length>0?Math.min(...x):0,C=x.length>0?Math.max(...x):0,P=x.length>0?x.reduce((_,E)=>_+E,0)/x.length:0;return f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"text-gray-400 mb-6",children:[pn(new Date(l.dateRange.start),"MMM d, yyyy")," - ",pn(new Date(l.dateRange.end),"MMM d, yyyy")]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[f.jsx(Vt,{title:"Total Tokens",value:U(l.total.totalTokens),subtitle:`${l.totalSessions} sessions`,color:"blue"}),f.jsx(Vt,{title:"Total Cost",value:ot(p.totalCost),subtitle:"Estimated",color:"green"}),f.jsx(Vt,{title:"Cache Hit Rate",value:`${h.cacheHitRate.toFixed(1)}%`,subtitle:`Saved ${ot(h.estimatedSavings)}`,color:"purple"}),f.jsx(Vt,{title:"Messages",value:U(l.totalMessages),subtitle:`${l.totalSessions} sessions`,color:"orange"})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Token Breakdown"}),f.jsxs("div",{className:"mb-8",children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Total Token Distribution"}),f.jsxs("span",{className:"text-sm text-white font-semibold",children:[U(l.total.totalTokens)," tokens"]})]}),f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"Input",percentage:l.total.inputTokens/l.total.totalTokens*100,color:"bg-blue-500",title:`Input: ${U(l.total.inputTokens)}`}),f.jsx(Ut,{label:"Output",percentage:l.total.outputTokens/l.total.totalTokens*100,color:"bg-green-500",title:`Output: ${U(l.total.outputTokens)}`}),f.jsx(Ut,{label:"Cache Create",percentage:l.total.cacheCreationTokens/l.total.totalTokens*100,color:"bg-purple-500",title:`Cache Create: ${U(l.total.cacheCreationTokens)}`}),f.jsx(Ut,{label:"Cache Read",percentage:l.total.cacheReadTokens/l.total.totalTokens*100,color:"bg-cyan-500",title:`Cache Read: ${U(l.total.cacheReadTokens)}`})]}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),f.jsxs("span",{children:["Input (",U(l.total.inputTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),f.jsxs("span",{children:["Output (",U(l.total.outputTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-purple-500 rounded"}),f.jsxs("span",{children:["Cache Create (",U(l.total.cacheCreationTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-cyan-500 rounded"}),f.jsxs("span",{children:["Cache Read (",U(l.total.cacheReadTokens),")"]})]})]})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Cache Creation Breakdown"}),f.jsxs("span",{className:"text-sm text-white font-semibold",children:[U(h.totalCacheCreation)," tokens"]})]}),f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"5-minute",percentage:h.totalCacheCreation>0?h.ephemeral5mTokens/h.totalCacheCreation*100:0,color:"bg-yellow-500",title:`5-minute: ${U(h.ephemeral5mTokens)}`}),f.jsx(Ut,{label:"1-hour",percentage:h.totalCacheCreation>0?h.ephemeral1hTokens/h.totalCacheCreation*100:0,color:"bg-orange-500",title:`1-hour: ${U(h.ephemeral1hTokens)}`})]}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded"}),f.jsxs("span",{children:["5-minute (",U(h.ephemeral5mTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-orange-500 rounded"}),f.jsxs("span",{children:["1-hour (",U(h.ephemeral1hTokens),")"]})]})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Cost Breakdown"}),f.jsxs("div",{className:"mb-8",children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Total Cost Distribution"}),f.jsx("span",{className:"text-sm text-white font-semibold",children:ot(p.totalCost)})]}),f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"Input",percentage:p.inputCost/p.totalCost*100,color:"bg-blue-500",title:`Input: ${ot(p.inputCost)}`}),f.jsx(Ut,{label:"Output",percentage:p.outputCost/p.totalCost*100,color:"bg-green-500",title:`Output: ${ot(p.outputCost)}`}),f.jsx(Ut,{label:"Cache Create",percentage:p.cacheCreationCost/p.totalCost*100,color:"bg-purple-500",title:`Cache Create: ${ot(p.cacheCreationCost)}`}),f.jsx(Ut,{label:"Cache Read",percentage:p.cacheReadCost/p.totalCost*100,color:"bg-cyan-500",title:`Cache Read: ${ot(p.cacheReadCost)}`})]}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),f.jsxs("span",{children:["Input (",ot(p.inputCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),f.jsxs("span",{children:["Output (",ot(p.outputCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-purple-500 rounded"}),f.jsxs("span",{children:["Cache Create (",ot(p.cacheCreationCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-cyan-500 rounded"}),f.jsxs("span",{children:["Cache Read (",ot(p.cacheReadCost),")"]})]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f.jsxs("div",{className:"p-4 bg-green-500/10 border border-green-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400",children:"Estimated savings from cache"}),f.jsx("div",{className:"text-2xl font-bold text-green-400",children:ot(h.estimatedSavings)})]}),f.jsxs("div",{className:"p-4 bg-purple-500/10 border border-purple-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400",children:"Cache Hit Rate"}),f.jsxs("div",{className:"text-2xl font-bold text-purple-400",children:[h.cacheHitRate.toFixed(1),"%"]})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Daily Token Usage"}),u.length===0?f.jsx("div",{className:"h-64 flex items-center justify-center text-gray-500",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{children:"No daily data available"}),f.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["Total sessions: ",l.totalSessions]}),f.jsxs("p",{className:"text-sm text-gray-600",children:["Daily entries: ",u.length]})]})}):f.jsx("div",{className:"bg-gray-900/50 rounded p-4",children:f.jsx(au,{data:{labels:u.map(_=>pn(new Date(_.date),"MMM d")),datasets:[{label:"Input",data:u.map(_=>_.usage.inputTokens),backgroundColor:"rgb(59, 130, 246)",borderColor:"rgb(59, 130, 246)",borderWidth:0},{label:"Cache Create",data:u.map(_=>_.usage.cacheCreationTokens),backgroundColor:"rgb(168, 85, 247)",borderColor:"rgb(168, 85, 247)",borderWidth:0},{label:"Cache Read",data:u.map(_=>_.usage.cacheReadTokens),backgroundColor:"rgb(6, 182, 212)",borderColor:"rgb(6, 182, 212)",borderWidth:0},{label:"Output",data:u.map(_=>_.usage.outputTokens),backgroundColor:"rgb(34, 197, 94)",borderColor:"rgb(34, 197, 94)",borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)",maxRotation:0,autoSkip:!0,maxTicksLimit:15}},y:{stacked:!0,max:g,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)",callback:function(_){return typeof _=="number"?U(_):_}}}},plugins:{legend:{display:!1},tooltip:{callbacks:{title:_=>{if(_.length>0){const E=_[0].dataIndex;return pn(new Date(u[E].date),"MMM d, yyyy")}return""},label:_=>{const E=_.dataset.label||"",O=_.parsed.y!==null?U(_.parsed.y):"0";return`${E}: ${O}`},footer:_=>{if(_.length>0){const E=_[0].dataIndex,O=U(u[E].usage.totalTokens),M=u[E].sessionCount;return`Total: ${O}
|
|
68
|
+
`):t}function e2(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:o,value:a}=s.getLabelAndValue(i);return{chart:t,label:o,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:a,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Pp(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=Be(e.bodyFont),u=Be(e.titleFont),c=Be(e.footerFont),d=s.length,h=i.length,p=r.length,v=Pt(e.padding);let y=v.height,w=0,m=r.reduce((b,C)=>b+C.before.length+C.lines.length+C.after.length,0);if(m+=t.beforeBody.length+t.afterBody.length,d&&(y+=d*u.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),m){const b=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=p*b+(m-p)*l.lineHeight+(m-1)*e.bodySpacing}h&&(y+=e.footerMarginTop+h*c.lineHeight+(h-1)*e.footerSpacing);let g=0;const x=function(b){w=Math.max(w,n.measureText(b).width+g)};return n.save(),n.font=u.string,te(t.title,x),n.font=l.string,te(t.beforeBody.concat(t.afterBody),x),g=e.displayColors?o+2+e.boxPadding:0,te(r,b=>{te(b.before,x),te(b.lines,x),te(b.after,x)}),g=0,n.font=c.string,te(t.footer,x),n.restore(),w+=v.width,{width:w,height:y}}function t2(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function n2(t,e,n,r){const{x:i,width:s}=r,o=n.caretSize+n.caretPadding;if(t==="left"&&i+s+o>e.width||t==="right"&&i-s-o<0)return!0}function r2(t,e,n,r){const{x:i,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let u="center";return r==="center"?u=i<=(a+l)/2?"left":"right":i<=s/2?u="left":i>=o-s/2&&(u="right"),n2(u,t,e,n)&&(u="center"),u}function Mp(t,e,n){const r=n.yAlign||e.yAlign||t2(t,n);return{xAlign:n.xAlign||e.xAlign||r2(t,e,n,r),yAlign:r}}function i2(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function s2(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function Tp(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,u=i+s,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:p}=pi(o);let v=i2(e,a);const y=s2(e,l,u);return l==="center"?a==="left"?v+=u:a==="right"&&(v-=u):a==="left"?v-=Math.max(c,h)+i:a==="right"&&(v+=Math.max(d,p)+i),{x:Lt(v,0,r.width-e.width),y:Lt(y,0,r.height-e.height)}}function Qo(t,e,n){const r=Pt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function Rp(t){return Qt([],on(t))}function o2(t,e,n){return $i(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Np(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const P0={beforeTitle:nn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:nn,beforeBody:nn,beforeLabel:nn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return se(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:nn,afterBody:nn,beforeFooter:nn,footer:nn,afterFooter:nn};function Ge(t,e,n,r){const i=t[e].call(n,r);return typeof i>"u"?P0[e].call(n,r):i}class Sc extends or{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new h0(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=o2(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=Ge(r,"beforeTitle",this,e),s=Ge(r,"title",this,e),o=Ge(r,"afterTitle",this,e);let a=[];return a=Qt(a,on(i)),a=Qt(a,on(s)),a=Qt(a,on(o)),a}getBeforeBody(e,n){return Rp(Ge(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return te(e,s=>{const o={before:[],lines:[],after:[]},a=Np(r,s);Qt(o.before,on(Ge(a,"beforeLabel",this,s))),Qt(o.lines,Ge(a,"label",this,s)),Qt(o.after,on(Ge(a,"afterLabel",this,s))),i.push(o)}),i}getAfterBody(e,n){return Rp(Ge(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=Ge(r,"beforeFooter",this,e),s=Ge(r,"footer",this,e),o=Ge(r,"afterFooter",this,e);let a=[];return a=Qt(a,on(i)),a=Qt(a,on(s)),a=Qt(a,on(o)),a}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],o=[];let a=[],l,u;for(l=0,u=n.length;l<u;++l)a.push(e2(this.chart,n[l]));return e.filter&&(a=a.filter((c,d,h)=>e.filter(c,d,h,r))),e.itemSort&&(a=a.sort((c,d)=>e.itemSort(c,d,r))),te(a,c=>{const d=Np(e.callbacks,c);i.push(Ge(d,"labelColor",this,c)),s.push(Ge(d,"labelPointStyle",this,c)),o.push(Ge(d,"labelTextColor",this,c))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,o=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const a=ps[r.position].call(this,i,this._eventPosition);o=this._createItems(r),this.title=this.getTitle(o,r),this.beforeBody=this.getBeforeBody(o,r),this.body=this.getBody(o,r),this.afterBody=this.getAfterBody(o,r),this.footer=this.getFooter(o,r);const l=this._size=Pp(this,r),u=Object.assign({},a,l),c=Mp(this.chart,r,u),d=Tp(r,u,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,s={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,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:o,cornerRadius:a}=r,{topLeft:l,topRight:u,bottomLeft:c,bottomRight:d}=pi(a),{x:h,y:p}=e,{width:v,height:y}=n;let w,m,g,x,b,C;return s==="center"?(b=p+y/2,i==="left"?(w=h,m=w-o,x=b+o,C=b-o):(w=h+v,m=w+o,x=b-o,C=b+o),g=w):(i==="left"?m=h+Math.max(l,c)+o:i==="right"?m=h+v-Math.max(u,d)-o:m=this.caretX,s==="top"?(x=p,b=x-o,w=m-o,g=m+o):(x=p+y,b=x+o,w=m+o,g=m-o),C=x),{x1:w,x2:m,x3:g,y1:x,y2:b,y3:C}}drawTitle(e,n,r){const i=this.title,s=i.length;let o,a,l;if(s){const u=mi(r.rtl,this.x,this.width);for(e.x=Qo(this,r.titleAlign,r),n.textAlign=u.textAlign(r.titleAlign),n.textBaseline="middle",o=Be(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=o.string,l=0;l<s;++l)n.fillText(i[l],u.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===s&&(e.y+=r.titleMarginBottom-a)}}_drawColorBox(e,n,r,i,s){const o=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:u}=s,c=Be(s.bodyFont),d=Qo(this,"left",s),h=i.x(d),p=l<c.lineHeight?(c.lineHeight-l)/2:0,v=n.y+p;if(s.usePointStyle){const y={radius:Math.min(u,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},w=i.leftForLtr(h,u)+u/2,m=v+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,Qf(e,y,w,m),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,Qf(e,y,w,m)}else{e.lineWidth=q(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const y=i.leftForLtr(h,u),w=i.leftForLtr(i.xPlus(h,1),u-2),m=pi(o.borderRadius);Object.values(m).some(g=>g!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,Va(e,{x:y,y:v,w:u,h:l,radius:m}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Va(e,{x:w,y:v+1,w:u-2,h:l-2,radius:m}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(y,v,u,l),e.strokeRect(y,v,u,l),e.fillStyle=o.backgroundColor,e.fillRect(w,v+1,u-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:u,boxPadding:c}=r,d=Be(r.bodyFont);let h=d.lineHeight,p=0;const v=mi(r.rtl,this.x,this.width),y=function(E){n.fillText(E,v.x(e.x+p),e.y+h/2),e.y+=h+s},w=v.textAlign(o);let m,g,x,b,C,P,_;for(n.textAlign=o,n.textBaseline="middle",n.font=d.string,e.x=Qo(this,w,r),n.fillStyle=r.bodyColor,te(this.beforeBody,y),p=a&&w!=="right"?o==="center"?u/2+c:u+2+c:0,b=0,P=i.length;b<P;++b){for(m=i[b],g=this.labelTextColors[b],n.fillStyle=g,te(m.before,y),x=m.lines,a&&x.length&&(this._drawColorBox(n,e,b,v,r),h=Math.max(d.lineHeight,l)),C=0,_=x.length;C<_;++C)y(x[C]),h=d.lineHeight;te(m.after,y)}p=0,h=d.lineHeight,te(this.afterBody,y),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let o,a;if(s){const l=mi(r.rtl,this.x,this.width);for(e.x=Qo(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",o=Be(r.footerFont),n.fillStyle=r.footerColor,n.font=o.string,a=0;a<s;++a)n.fillText(i[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:o}=this,{x:a,y:l}=e,{width:u,height:c}=r,{topLeft:d,topRight:h,bottomLeft:p,bottomRight:v}=pi(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+d,l),o==="top"&&this.drawCaret(e,n,r,i),n.lineTo(a+u-h,l),n.quadraticCurveTo(a+u,l,a+u,l+h),o==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(a+u,l+c-v),n.quadraticCurveTo(a+u,l+c,a+u-v,l+c),o==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(a+p,l+c),n.quadraticCurveTo(a,l+c,a,l+c-p),o==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(a,l+d),n.quadraticCurveTo(a,l,a+d,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const o=ps[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Pp(this,e),l=Object.assign({},o,this._size),u=Mp(n,e,l),c=Tp(e,l,u,n);(i._to!==c.x||s._to!==c.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const o=Pt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),c0(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),d0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:a,index:l})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[l],index:l}}),s=!Wa(r,i),o=this._positionChanged(i,n);(s||o)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,r),a=this._positionChanged(o,e),l=n||!Wa(o,s)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,o=ps[s.position].call(this,e,n);return o!==!1&&(r!==o.x||i!==o.y)}}K(Sc,"positioners",ps);var a2={id:"tooltip",_element:Sc,positioners:ps,afterInit(t,e,n){n&&(t.tooltip=new Sc({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:P0},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const l2=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function u2(t,e,n,r){const i=t.indexOf(e);if(i===-1)return l2(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const c2=(t,e)=>t===null?null:Lt(Math.round(t),0,e);function Op(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class kc extends Ui{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(se(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:u2(r,e,G(n,e),this._addedLabels),c2(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let o=e;o<=n;o++)i.push({value:o});return i}getLabelForValue(e){return Op.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}K(kc,"id","category"),K(kc,"defaults",{ticks:{callback:Op}});function d2(t,e){const n=[],{bounds:i,step:s,min:o,max:a,precision:l,count:u,maxTicks:c,maxDigits:d,includeBounds:h}=t,p=s||1,v=c-1,{min:y,max:w}=e,m=!se(o),g=!se(a),x=!se(u),b=(w-y)/(d+1);let C=If((w-y)/v/p)*p,P,_,E,O;if(C<1e-14&&!m&&!g)return[{value:y},{value:w}];O=Math.ceil(w/C)-Math.floor(y/C),O>v&&(C=If(O*C/v/p)*p),se(l)||(P=Math.pow(10,l),C=Math.ceil(C*P)/P),i==="ticks"?(_=Math.floor(y/C)*C,E=Math.ceil(w/C)*C):(_=y,E=w),m&&g&&s&&hS((a-o)/s,C/1e3)?(O=Math.round(Math.min((a-o)/C,c)),C=(a-o)/O,_=o,E=a):x?(_=m?o:_,E=g?a:E,O=u-1,C=(E-_)/O):(O=(E-_)/C,ua(O,Math.round(O),C/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Af(C),Af(_));P=Math.pow(10,se(l)?M:l),_=Math.round(_*P)/P,E=Math.round(E*P)/P;let T=0;for(m&&(h&&_!==o?(n.push({value:o}),_<o&&T++,ua(Math.round((_+T*C)*P)/P,o,jp(o,b,t))&&T++):_<o&&T++);T<O;++T){const I=Math.round((_+T*C)*P)/P;if(g&&I>a)break;n.push({value:I})}return g&&h&&E!==a?n.length&&ua(n[n.length-1].value,a,jp(a,b,t))?n[n.length-1].value=a:n.push({value:a}):(!g||E===a)&&n.push({value:E}),n}function jp(t,e,{horizontal:n,minRotation:r}){const i=Sr(r),s=(n?Math.sin(i):Math.cos(i))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class h2 extends Ui{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return se(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const o=l=>i=n?i:l,a=l=>s=r?s:l;if(e){const l=nr(i),u=nr(s);l<0&&u<0?a(0):l>0&&u>0&&o(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=d2(i,s);return e.bounds==="ticks"&&fS(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return e0(e,this.chart.options.locale,this.options.ticks.format)}}class Cc extends h2{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=Et(e)?e:0,this.max=Et(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=Sr(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}K(Cc,"id","linear"),K(Cc,"defaults",{ticks:{callback:t0.formatters.numeric}});const yl={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}},tt=Object.keys(yl);function Dp(t,e){return t-e}function Lp(t,e){if(se(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let o=e;return typeof r=="function"&&(o=r(o)),Et(o)||(o=typeof r=="string"?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i==="week"&&(Ua(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,i)),+o)}function Fp(t,e,n,r){const i=tt.length;for(let s=tt.indexOf(t);s<i-1;++s){const o=yl[tt[s]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=r)return tt[s]}return tt[i-1]}function f2(t,e,n,r,i){for(let s=tt.length-1;s>=tt.indexOf(n);s--){const o=tt[s];if(yl[o].common&&t._adapter.diff(i,r,o)>=e-1)return o}return tt[n?tt.indexOf(n):0]}function p2(t){for(let e=tt.indexOf(t)+1,n=tt.length;e<n;++e)if(yl[tt[e]].common)return tt[e]}function Ip(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=zd(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function m2(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+i.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function Ap(t,e,n){const r=[],i={},s=e.length;let o,a;for(o=0;o<s;++o)a=e[o],i[a]=o,r.push({value:a,major:!1});return s===0||!n?r:m2(t,r,i,n)}class Ka extends Ui{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new Ok._date(e.adapters.date);i.init(n),ks(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:Lp(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:o,maxDefined:a}=this.getUserBounds();function l(u){!o&&!isNaN(u.min)&&(i=Math.min(i,u.min)),!a&&!isNaN(u.max)&&(s=Math.max(s,u.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Et(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=Et(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,o=this.max,a=wS(i,s,o);return this._unit=n.unit||(r.autoSkip?Fp(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):f2(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:p2(this._unit),this.initOffsets(i),e.reverse&&a.reverse(),Ap(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=Lt(n,0,o),r=Lt(r,0,o),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,o=s.unit||Fp(s.minUnit,n,r,this._getLabelCapacity(n)),a=G(i.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,u=Ua(l)||l===!0,c={};let d=n,h,p;if(u&&(d=+e.startOf(d,"isoWeek",l)),d=+e.startOf(d,u?"day":o),e.diff(r,n,o)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+o);const v=i.ticks.source==="data"&&this.getDataTimestamps();for(h=d,p=0;h<r;h=+e.add(h,a,o),p++)Ip(c,h,v);return(h===r||i.bounds==="ticks"||p===1)&&Ip(c,h,v),Object.keys(c).sort(Dp).map(y=>+y)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,o=n||i[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,r,i){const s=this.options,o=s.ticks.callback;if(o)return ce(o,[e,n,r],this);const a=s.time.displayFormats,l=this._unit,u=this._majorUnit,c=l&&a[l],d=u&&a[u],h=r[n],p=u&&d&&h&&h.major;return this._adapter.format(e,i||(p?d:c))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=Sr(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:r*s+a*o,h:r*o+a*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,Ap(this,[e],this._majorUnit),i),o=this._getLabelSize(s),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(Lp(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return qy(e.sort(Dp))}}K(Ka,"id","time"),K(Ka,"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 Yo(t,e,n){let r=0,i=t.length-1,s,o,a,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=xc(t,"pos",e)),{pos:s,time:a}=t[r],{pos:o,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=xc(t,"time",e)),{time:s,pos:a}=t[r],{time:o,pos:l}=t[i]);const u=o-s;return u?a+(l-a)*(e-s)/u:a}class zp extends Ka{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Yo(n,this.min),this._tableRange=Yo(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let o,a,l,u,c;for(o=0,a=e.length;o<a;++o)u=e[o],u>=n&&u<=r&&i.push(u);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(o=0,a=i.length;o<a;++o)c=i[o+1],l=i[o-1],u=i[o],Math.round((c+l)/2)!==u&&s.push({time:u,pos:o/(a-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Yo(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Yo(this._table,r*this._tableRange+this._minPos,!0)}}K(zp,"id","timeseries"),K(zp,"defaults",Ka.defaults);const M0="label";function Bp(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function g2(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function T0(t,e){t.labels=e}function R0(t,e,n=M0){const r=[];t.datasets=e.map(i=>{const s=t.datasets.find(o=>o[n]===i[n]);return!s||!i.data||r.includes(s)?{...i}:(r.push(s),Object.assign(s,i),s)})}function y2(t,e=M0){const n={labels:[],datasets:[]};return T0(n,t.labels),R0(n,t.datasets,e),n}function v2(t,e){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:s,type:o,data:a,options:l,plugins:u=[],fallbackContent:c,updateMode:d,...h}=t,p=k.useRef(null),v=k.useRef(null),y=()=>{p.current&&(v.current=new gl(p.current,{type:o,data:y2(a,s),options:l&&{...l},plugins:u}),Bp(e,v.current))},w=()=>{Bp(e,null),v.current&&(v.current.destroy(),v.current=null)};return k.useEffect(()=>{!i&&v.current&&l&&g2(v.current,l)},[i,l]),k.useEffect(()=>{!i&&v.current&&T0(v.current.config.data,a.labels)},[i,a.labels]),k.useEffect(()=>{!i&&v.current&&a.datasets&&R0(v.current.config.data,a.datasets,s)},[i,a.datasets]),k.useEffect(()=>{v.current&&(i?(w(),setTimeout(y)):v.current.update(d))},[i,l,a.labels,a.datasets,d]),k.useEffect(()=>{v.current&&(w(),setTimeout(y))},[o]),k.useEffect(()=>(y(),()=>w()),[]),f.jsx("canvas",{ref:p,role:"img",height:n,width:r,...h,children:c})}const x2=k.forwardRef(v2);function w2(t,e){return gl.register(e),k.forwardRef((n,r)=>f.jsx(x2,{...n,ref:r,type:t}))}const au=w2("bar",ca);gl.register(kc,Cc,fa,ZC,a2,GC);function b2(t,e="12px sans-serif"){const r=document.createElement("canvas").getContext("2d");return r?(r.font=e,r.measureText(t).width):0}function Ut({label:t,percentage:e,color:n,title:r}){const i=k.useRef(null),[s,o]=k.useState(!1),[a,l]=k.useState(!1);return k.useEffect(()=>{const u=()=>{if(i.current){const d=i.current.offsetWidth,h=b2(t,'bold 12px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif');o(d>=h+8)}};u(),window.addEventListener("resize",u);const c=new ResizeObserver(u);return i.current&&c.observe(i.current),()=>{window.removeEventListener("resize",u),c.disconnect()}},[t,e]),f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:i,className:`${n} flex items-center justify-center text-xs font-semibold transition-all`,style:{width:`${e}%`,minWidth:"2px"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:s&&f.jsx("span",{className:"text-white",children:t})}),a&&i.current&&f.jsxs("div",{className:"fixed px-3 py-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg border border-gray-700 whitespace-nowrap z-50 pointer-events-none",style:{left:`${i.current.getBoundingClientRect().left+i.current.getBoundingClientRect().width/2}px`,top:`${i.current.getBoundingClientRect().top-10}px`,transform:"translate(-50%, -100%)"},children:[r,f.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 -mt-px",children:f.jsx("div",{className:"border-4 border-transparent border-t-gray-900"})})]})]})}function U(t){return t>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${(t/1e3).toFixed(2)}K`:t.toLocaleString()}function ot(t){return`$${t.toFixed(2)}`}function Vt({title:t,value:e,subtitle:n,color:r="blue"}){const i={blue:"bg-blue-500/10 border-blue-500/20",green:"bg-green-500/10 border-green-500/20",purple:"bg-purple-500/10 border-purple-500/20",orange:"bg-orange-500/10 border-orange-500/20",pink:"bg-pink-500/10 border-pink-500/20",cyan:"bg-cyan-500/10 border-cyan-500/20"};return f.jsxs("div",{className:`p-6 rounded-lg border ${i[r]||i.blue}`,children:[f.jsx("div",{className:"text-sm text-gray-400 mb-1",children:t}),f.jsx("div",{className:"text-3xl font-bold mb-1",children:e}),n&&f.jsx("div",{className:"text-xs text-gray-500",children:n})]})}function _2(){const[t,e]=k.useState("7"),{data:n,isLoading:r,error:i}=Cd({queryKey:["token-statistics",t],queryFn:async()=>{const l=await fetch(`/api/statistics/tokens?days=${t}`);if(!l.ok)throw new Error("Failed to fetch token statistics");return l.json()}}),s=()=>f.jsxs("div",{className:"p-6 rounded-lg border bg-gray-800/50 border-gray-700 animate-pulse",children:[f.jsx("div",{className:"h-4 bg-gray-700 rounded w-1/2 mb-3"}),f.jsx("div",{className:"h-8 bg-gray-700 rounded w-3/4 mb-2"}),f.jsx("div",{className:"h-3 bg-gray-700 rounded w-1/3"})]}),o=()=>f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 border border-gray-700 animate-pulse",children:[f.jsx("div",{className:"h-6 bg-gray-700 rounded w-1/3 mb-6"}),f.jsx("div",{className:"h-64 bg-gray-700 rounded"})]}),a=()=>{if(i)return f.jsx("div",{className:"flex items-center justify-center h-96",children:f.jsxs("div",{className:"text-red-400",children:["Error loading statistics: ",i.message]})});if(!n)return f.jsx("div",{className:"flex items-center justify-center h-96",children:f.jsx("div",{className:"text-gray-400",children:"No data available"})});const{overview:l,daily:u,byProject:c,byModel:d,cache:h,cost:p,productivity:v,trends:y}=n,w=[...u.map(_=>_.usage.totalTokens)].sort((_,E)=>_-E),m=Math.floor(w.length*.95),g=Math.max(w[m]||1,1),x=u.map(_=>_.usage.totalTokens),b=x.length>0?Math.min(...x):0,C=x.length>0?Math.max(...x):0,P=x.length>0?x.reduce((_,E)=>_+E,0)/x.length:0;return f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"text-gray-400 mb-6",children:[pn(new Date(l.dateRange.start),"MMM d, yyyy")," - ",pn(new Date(l.dateRange.end),"MMM d, yyyy")]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[f.jsx(Vt,{title:"Total Tokens",value:U(l.total.totalTokens),subtitle:`${l.totalSessions} sessions`,color:"blue"}),f.jsx(Vt,{title:"Total Cost",value:ot(p.totalCost),subtitle:"Estimated",color:"green"}),f.jsx(Vt,{title:"Cache Hit Rate",value:`${h.cacheHitRate.toFixed(1)}%`,subtitle:`Saved ${ot(h.estimatedSavings)}`,color:"purple"}),f.jsx(Vt,{title:"Messages",value:U(l.totalMessages),subtitle:`${l.totalSessions} sessions`,color:"orange"})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Token Breakdown"}),f.jsxs("div",{className:"mb-8",children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Total Token Distribution"}),f.jsxs("span",{className:"text-sm text-white font-semibold",children:[U(l.total.totalTokens)," tokens"]})]}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"Input",percentage:l.total.inputTokens/l.total.totalTokens*100,color:"bg-blue-500",title:`Input: ${U(l.total.inputTokens)}`}),f.jsx(Ut,{label:"Output",percentage:l.total.outputTokens/l.total.totalTokens*100,color:"bg-green-500",title:`Output: ${U(l.total.outputTokens)}`}),f.jsx(Ut,{label:"Cache Create",percentage:l.total.cacheCreationTokens/l.total.totalTokens*100,color:"bg-purple-500",title:`Cache Create: ${U(l.total.cacheCreationTokens)}`}),f.jsx(Ut,{label:"Cache Read",percentage:l.total.cacheReadTokens/l.total.totalTokens*100,color:"bg-cyan-500",title:`Cache Read: ${U(l.total.cacheReadTokens)}`})]})}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),f.jsxs("span",{children:["Input (",U(l.total.inputTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),f.jsxs("span",{children:["Output (",U(l.total.outputTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-purple-500 rounded"}),f.jsxs("span",{children:["Cache Create (",U(l.total.cacheCreationTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-cyan-500 rounded"}),f.jsxs("span",{children:["Cache Read (",U(l.total.cacheReadTokens),")"]})]})]})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Cache Creation Breakdown"}),f.jsxs("span",{className:"text-sm text-white font-semibold",children:[U(h.totalCacheCreation)," tokens"]})]}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"5-minute",percentage:h.totalCacheCreation>0?h.ephemeral5mTokens/h.totalCacheCreation*100:0,color:"bg-yellow-500",title:`5-minute: ${U(h.ephemeral5mTokens)}`}),f.jsx(Ut,{label:"1-hour",percentage:h.totalCacheCreation>0?h.ephemeral1hTokens/h.totalCacheCreation*100:0,color:"bg-orange-500",title:`1-hour: ${U(h.ephemeral1hTokens)}`})]})}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-yellow-500 rounded"}),f.jsxs("span",{children:["5-minute (",U(h.ephemeral5mTokens),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-orange-500 rounded"}),f.jsxs("span",{children:["1-hour (",U(h.ephemeral1hTokens),")"]})]})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Cost Breakdown"}),f.jsxs("div",{className:"mb-8",children:[f.jsxs("div",{className:"flex justify-between items-center mb-2",children:[f.jsx("h3",{className:"text-sm font-semibold text-gray-300",children:"Total Cost Distribution"}),f.jsx("span",{className:"text-sm text-white font-semibold",children:ot(p.totalCost)})]}),f.jsx("div",{className:"relative",children:f.jsxs("div",{className:"h-8 w-full bg-gray-700 overflow-hidden flex",children:[f.jsx(Ut,{label:"Input",percentage:p.inputCost/p.totalCost*100,color:"bg-blue-500",title:`Input: ${ot(p.inputCost)}`}),f.jsx(Ut,{label:"Output",percentage:p.outputCost/p.totalCost*100,color:"bg-green-500",title:`Output: ${ot(p.outputCost)}`}),f.jsx(Ut,{label:"Cache Create",percentage:p.cacheCreationCost/p.totalCost*100,color:"bg-purple-500",title:`Cache Create: ${ot(p.cacheCreationCost)}`}),f.jsx(Ut,{label:"Cache Read",percentage:p.cacheReadCost/p.totalCost*100,color:"bg-cyan-500",title:`Cache Read: ${ot(p.cacheReadCost)}`})]})}),f.jsxs("div",{className:"flex gap-4 mt-3 text-xs justify-center flex-wrap",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),f.jsxs("span",{children:["Input (",ot(p.inputCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),f.jsxs("span",{children:["Output (",ot(p.outputCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-purple-500 rounded"}),f.jsxs("span",{children:["Cache Create (",ot(p.cacheCreationCost),")"]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-cyan-500 rounded"}),f.jsxs("span",{children:["Cache Read (",ot(p.cacheReadCost),")"]})]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[f.jsxs("div",{className:"p-4 bg-green-500/10 border border-green-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400",children:"Estimated savings from cache"}),f.jsx("div",{className:"text-2xl font-bold text-green-400",children:ot(h.estimatedSavings)})]}),f.jsxs("div",{className:"p-4 bg-purple-500/10 border border-purple-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400",children:"Cache Hit Rate"}),f.jsxs("div",{className:"text-2xl font-bold text-purple-400",children:[h.cacheHitRate.toFixed(1),"%"]})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Daily Token Usage"}),u.length===0?f.jsx("div",{className:"h-64 flex items-center justify-center text-gray-500",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{children:"No daily data available"}),f.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["Total sessions: ",l.totalSessions]}),f.jsxs("p",{className:"text-sm text-gray-600",children:["Daily entries: ",u.length]})]})}):f.jsx("div",{className:"bg-gray-900/50 rounded p-4",children:f.jsx(au,{data:{labels:u.map(_=>pn(new Date(_.date),"MMM d")),datasets:[{label:"Input",data:u.map(_=>_.usage.inputTokens),backgroundColor:"rgb(59, 130, 246)",borderColor:"rgb(59, 130, 246)",borderWidth:0},{label:"Cache Create",data:u.map(_=>_.usage.cacheCreationTokens),backgroundColor:"rgb(168, 85, 247)",borderColor:"rgb(168, 85, 247)",borderWidth:0},{label:"Cache Read",data:u.map(_=>_.usage.cacheReadTokens),backgroundColor:"rgb(6, 182, 212)",borderColor:"rgb(6, 182, 212)",borderWidth:0},{label:"Output",data:u.map(_=>_.usage.outputTokens),backgroundColor:"rgb(34, 197, 94)",borderColor:"rgb(34, 197, 94)",borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{stacked:!0,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)",maxRotation:0,autoSkip:!0,maxTicksLimit:15}},y:{stacked:!0,max:g,grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)",callback:function(_){return typeof _=="number"?U(_):_}}}},plugins:{legend:{display:!1},tooltip:{callbacks:{title:_=>{if(_.length>0){const E=_[0].dataIndex;return pn(new Date(u[E].date),"MMM d, yyyy")}return""},label:_=>{const E=_.dataset.label||"",O=_.parsed.y!==null?U(_.parsed.y):"0";return`${E}: ${O}`},footer:_=>{if(_.length>0){const E=_[0].dataIndex,O=U(u[E].usage.totalTokens),M=u[E].sessionCount;return`Total: ${O}
|
|
69
69
|
${M} sessions`}return""}}}}},height:300})}),f.jsxs("div",{className:"flex gap-4 mt-4 text-xs justify-center",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded"}),f.jsx("span",{children:"Input"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-purple-500 rounded"}),f.jsx("span",{children:"Cache Create"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-cyan-500 rounded"}),f.jsx("span",{children:"Cache Read"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-3 h-3 bg-green-500 rounded"}),f.jsx("span",{children:"Output"})]})]}),u.length>0&&f.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6 pt-6 border-t border-gray-700",children:[f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Min Daily"}),f.jsx("div",{className:"font-mono text-sm text-gray-300",children:U(b)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Avg Daily"}),f.jsx("div",{className:"font-mono text-sm text-blue-400",children:U(P)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"Max Daily"}),f.jsx("div",{className:"font-mono text-sm text-green-400",children:U(C)})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Usage by Project"}),f.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:c.slice(0,10).map((_,E)=>{const O=c.reduce((T,I)=>T+I.usage.totalTokens,0),M=_.usage.totalTokens/O*100;return f.jsxs("div",{className:"bg-gray-800/30 rounded-lg p-4 border border-gray-700",children:[f.jsxs("div",{className:"flex justify-between items-baseline mb-2",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("div",{className:"font-semibold text-gray-200",children:_.displayName}),f.jsxs("div",{className:"text-xs text-gray-500",children:[_.sessionCount," sessions"]})]}),f.jsxs("div",{className:"text-right flex-shrink-0 ml-4",children:[f.jsx("div",{className:"font-mono text-sm",children:U(_.usage.totalTokens)}),f.jsxs("div",{className:"text-xs text-gray-500",children:[M.toFixed(1),"%"]})]})]}),f.jsxs("div",{className:"grid grid-cols-4 gap-2 text-xs",children:[f.jsxs("div",{className:"text-left",children:[f.jsx("div",{className:"text-gray-500",children:"Input"}),f.jsx("div",{className:"text-blue-400 font-mono",children:U(_.usage.inputTokens)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-gray-500",children:"Cache Create"}),f.jsx("div",{className:"text-purple-400 font-mono",children:U(_.usage.cacheCreationTokens)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-gray-500",children:"Cache Read"}),f.jsx("div",{className:"text-cyan-400 font-mono",children:U(_.usage.cacheReadTokens)})]}),f.jsxs("div",{className:"text-right",children:[f.jsx("div",{className:"text-gray-500",children:"Output"}),f.jsx("div",{className:"text-green-400 font-mono",children:U(_.usage.outputTokens)})]})]})]},E)})})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Usage by Model"}),f.jsx("div",{className:"space-y-4",children:d.map((_,E)=>{const O=d.reduce((T,I)=>T+I.usage.totalTokens,0),M=_.usage.totalTokens/O*100;return f.jsxs("div",{className:"border-b border-gray-700 pb-4 last:border-b-0 last:pb-0",children:[f.jsxs("div",{className:"flex justify-between items-start mb-2",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("div",{className:"font-semibold text-gray-200",children:_.model}),f.jsxs("div",{className:"text-xs text-gray-500",children:[_.messageCount," messages"]})]}),f.jsxs("div",{className:"text-right",children:[f.jsx("div",{className:"font-mono text-sm",children:U(_.usage.totalTokens)}),f.jsxs("div",{className:"text-xs text-gray-500",children:[M.toFixed(1),"%"]})]})]}),f.jsx("div",{className:"w-full bg-gray-700 rounded-full h-2",children:f.jsx("div",{className:"h-2 rounded-full bg-gradient-to-r from-blue-500 to-green-500",style:{width:`${M}%`}})}),f.jsxs("div",{className:"grid grid-cols-4 gap-2 text-xs mt-2",children:[f.jsxs("div",{className:"text-left",children:[f.jsx("div",{className:"text-gray-500",children:"Input"}),f.jsx("div",{className:"text-blue-400 font-mono",children:U(_.usage.inputTokens)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-gray-500",children:"Cache Create"}),f.jsx("div",{className:"text-purple-400 font-mono",children:U(_.usage.cacheCreationTokens)})]}),f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"text-gray-500",children:"Cache Read"}),f.jsx("div",{className:"text-cyan-400 font-mono",children:U(_.usage.cacheReadTokens)})]}),f.jsxs("div",{className:"text-right",children:[f.jsx("div",{className:"text-gray-500",children:"Output"}),f.jsx("div",{className:"text-green-400 font-mono",children:U(_.usage.outputTokens)})]})]})]},E)})})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Productivity Metrics"}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:[f.jsx(Vt,{title:"Total Tool Calls",value:U(v.totalToolCalls),subtitle:`Across ${l.totalSessions} sessions`,color:"blue"}),f.jsx(Vt,{title:"Agent Sessions",value:U(v.agentSessions),subtitle:`${v.agentUsageRate.toFixed(1)}% of sessions`,color:"purple"}),f.jsx(Vt,{title:"Avg Tools per Session",value:(v.totalToolCalls/v.totalSessions).toFixed(1),subtitle:"Tool calls per session",color:"cyan"})]}),f.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-300",children:"Tool Usage & Success Rates"}),f.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 auto-rows-fr",children:v.toolUsage.map((_,E)=>f.jsxs("div",{className:"@container bg-gray-800/30 rounded-lg p-4 border border-gray-700",children:[f.jsxs("div",{className:"flex justify-between items-start mb-2",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("div",{className:"font-semibold text-gray-200",children:_.toolName}),f.jsxs("div",{className:"text-xs text-gray-500",children:[f.jsxs("span",{className:"hidden @[300px]:inline",children:[_.successfulUses," successful / ",_.totalUses," total calls"]}),f.jsxs("span",{className:"@[300px]:hidden",children:[_.successfulUses," / ",_.totalUses," calls"]})]})]}),f.jsxs("div",{className:"text-right ml-2",children:[f.jsxs("div",{className:`font-mono text-sm ${_.successRate>=90?"text-green-400":_.successRate>=70?"text-yellow-400":"text-red-400"}`,children:[_.successRate.toFixed(1),"%"]}),f.jsx("div",{className:"text-xs text-gray-500",children:"success"})]})]}),f.jsx("div",{className:"w-full bg-gray-700 rounded-full h-2",children:f.jsx("div",{className:`h-2 rounded-full ${_.successRate>=90?"bg-green-500":_.successRate>=70?"bg-yellow-500":"bg-red-500"}`,style:{width:`${Math.min(_.successRate,100)}%`}})})]},E))})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Cache Efficiency Analysis"}),f.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[f.jsx(Vt,{title:"Total Cache Created",value:U(h.totalCacheCreation),subtitle:"Tokens cached",color:"purple"}),f.jsx(Vt,{title:"Total Cache Read",value:U(h.totalCacheRead),subtitle:"Tokens from cache",color:"cyan"}),f.jsx(Vt,{title:"Cache Hit Rate",value:`${h.cacheHitRate.toFixed(2)}%`,subtitle:`${ot(h.estimatedSavings)} saved`,color:"green"})]}),f.jsxs("div",{className:"mt-6 grid grid-cols-1 lg:grid-cols-2 gap-4",children:[f.jsxs("div",{className:"p-4 bg-purple-500/10 border border-purple-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400 mb-2",children:"5-minute Cache"}),f.jsx("div",{className:"text-2xl font-bold mb-1",children:U(h.ephemeral5mTokens)}),f.jsxs("div",{className:"text-xs text-gray-500",children:[h.totalCacheCreation>0?(h.ephemeral5mTokens/h.totalCacheCreation*100).toFixed(1):0,"% of total cache"]})]}),f.jsxs("div",{className:"p-4 bg-orange-500/10 border border-orange-500/20 rounded",children:[f.jsx("div",{className:"text-sm text-gray-400 mb-2",children:"1-hour Cache"}),f.jsx("div",{className:"text-2xl font-bold mb-1",children:U(h.ephemeral1hTokens)}),f.jsxs("div",{className:"text-xs text-gray-500",children:[h.totalCacheCreation>0?(h.ephemeral1hTokens/h.totalCacheCreation*100).toFixed(1):0,"% of total cache"]})]})]})]}),f.jsxs("div",{className:"bg-gray-800/50 rounded-lg p-6 mb-8 border border-gray-700",children:[f.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Activity Trends"}),f.jsxs("div",{className:"mb-8",children:[f.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-300",children:"Activity by Hour of Day"}),f.jsx("div",{className:"bg-gray-900/50 rounded p-4",children:f.jsx(au,{data:{labels:y.byHour.map(_=>`${_.hour.toString().padStart(2,"0")}:00`),datasets:[{label:"Messages",data:y.byHour.map(_=>_.messageCount),backgroundColor:"rgba(59, 130, 246, 0.8)",borderColor:"rgb(59, 130, 246)",borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)",maxRotation:45,minRotation:45}},y:{grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)"}}},plugins:{legend:{display:!1},tooltip:{callbacks:{label:_=>{const E=y.byHour[_.dataIndex];return[`Messages: ${E.messageCount}`,`Sessions: ${E.sessionCount}`,`Tokens: ${U(E.usage.totalTokens)}`]}}}}},height:250})})]}),f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-300",children:"Activity by Day of Week"}),f.jsx("div",{className:"bg-gray-900/50 rounded p-4",children:f.jsx(au,{data:{labels:y.byWeekday.map(_=>_.weekdayName),datasets:[{label:"Messages",data:y.byWeekday.map(_=>_.messageCount),backgroundColor:"rgba(34, 197, 94, 0.8)",borderColor:"rgb(34, 197, 94)",borderWidth:0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)"}},y:{grid:{color:"rgba(255, 255, 255, 0.1)"},ticks:{color:"rgba(255, 255, 255, 0.6)"}}},plugins:{legend:{display:!1},tooltip:{callbacks:{label:_=>{const E=y.byWeekday[_.dataIndex];return[`Messages: ${E.messageCount}`,`Sessions: ${E.sessionCount}`,`Tokens: ${U(E.usage.totalTokens)}`]}}}}},height:250})})]})]})]})};return f.jsx("div",{className:"h-screen overflow-y-auto bg-gray-900 text-white p-8",children:f.jsxs("div",{className:"max-w-7xl mx-auto",children:[f.jsx("div",{className:"mb-2",children:f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsx("h1",{className:"text-4xl font-bold",children:"Dashboard"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("button",{onClick:()=>e("7"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="7"?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-300"}`,children:"Last 7 Days"}),f.jsx("button",{onClick:()=>e("30"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="30"?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-300"}`,children:"Last 30 Days"}),f.jsx("button",{onClick:()=>e("all"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t==="all"?"bg-blue-600 text-white":"bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-300"}`,children:"All Time"})]})]})}),r?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"h-5 bg-gray-700 rounded w-64 mb-8 animate-pulse"}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[f.jsx(s,{}),f.jsx(s,{}),f.jsx(s,{}),f.jsx(s,{})]}),f.jsx(o,{}),f.jsx("div",{className:"mt-8",children:f.jsx(o,{})}),f.jsx("div",{className:"mt-8",children:f.jsx(o,{})})]}):a()]})})}const N0=new Nw,Wp="claude-session-viewer-sidebar-width",S2=320,k2=200,C2=600;function Hp(){const t=Td(),e=Sn(),r=Pb().sessionId||null,i=e.pathname==="/dashboard",[s,o]=k.useState(()=>{const T=localStorage.getItem(Wp);return T?parseInt(T,10):S2}),[a,l]=k.useState(!1),[u,c]=k.useState(0),[d,h]=k.useState(!1),p=k.useRef(null),v=k.useRef(null),y=k.useRef(0),{data:w,isLoading:m,error:g,refetch:x}=Cd({queryKey:["sessions"],queryFn:async()=>{const T=await fetch("/api/sessions");if(!T.ok)throw new Error("Failed to fetch sessions");return T.json()}}),b=T=>{t(`/sessions/${T}`)},C=r?w==null?void 0:w.projects.flatMap(T=>T.sessions).flatMap(T=>[T,...T.agentSessions||[]]).find(T=>T.id===r):null;k.useEffect(()=>{const T=v.current;if(!T)return;const I=()=>{const W=T.scrollTop,oe=W<y.current;c(W),h(oe),y.current=W};return T.addEventListener("scroll",I),()=>T.removeEventListener("scroll",I)},[]),k.useEffect(()=>{const T=W=>{if(!a)return;const oe=W.clientX;oe>=k2&&oe<=C2&&(o(oe),localStorage.setItem(Wp,oe.toString()))},I=()=>{l(!1),document.body.style.cursor="",document.body.style.userSelect=""};return a&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",I)),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",I)}},[a]),k.useEffect(()=>{const I=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;let W=null,oe=!1,Z=null,F=0,ve=!0;const j=()=>{W=new WebSocket(I),oe=!1,W.onopen=()=>{if(oe){W==null||W.close();return}F=0},W.onmessage=A=>{const R=JSON.parse(A.data);(R.type==="file-added"||R.type==="file-changed"||R.type==="file-deleted")&&(x(),r&&N0.invalidateQueries({queryKey:["session",r]}))},W.onerror=A=>{console.error("WebSocket error:",A)},W.onclose=()=>{if(!ve)return;const A=Math.min(1e3*2**F,1e4);F+=1,Z=setTimeout(j,A)}};return j(),()=>{ve=!1,Z&&clearTimeout(Z),W&&W.readyState===WebSocket.CONNECTING?oe=!0:W==null||W.close()}},[x,r]);const _=Math.max(0,1-(d?0:u)/80),E=12+_*12,O=1.125+_*.375,M=_;return f.jsxs("div",{className:"flex h-screen bg-gray-900 text-white",children:[f.jsxs("div",{className:"relative flex flex-col",style:{width:`${s}px`},children:[f.jsxs("div",{ref:p,className:"border-r border-gray-700 h-full flex flex-col",children:[f.jsxs("div",{className:"border-b border-gray-700 flex-shrink-0 transition-all duration-200",style:{padding:`${E}px`},children:[f.jsx("h1",{className:"font-bold transition-all duration-200",style:{fontSize:`${O}rem`},children:f.jsx("button",{onClick:()=>t("/dashboard"),className:"hover:text-blue-400 transition-colors",children:"Claude Sessions"})}),f.jsx("p",{className:"text-sm text-gray-400 mt-1 transition-opacity duration-200",style:{opacity:M,height:M>0?"auto":0,overflow:"hidden"},children:m?"Loading...":`${(w==null?void 0:w.projects.length)||0} project${(w==null?void 0:w.projects.length)!==1?"s":""}`})]}),f.jsx("div",{ref:v,className:"flex-1 overflow-y-auto",children:g?f.jsxs("div",{className:"p-4 text-red-400 text-sm",children:["Error loading sessions: ",g.message]}):f.jsx(T_,{projects:(w==null?void 0:w.projects)||[],selectedId:r,onSelect:b})})]}),f.jsx("div",{className:"absolute top-0 right-0 w-4 h-full cursor-col-resize group z-10",onMouseDown:T=>{T.preventDefault(),l(!0)},style:{touchAction:"none"},children:f.jsx("div",{className:`w-1 h-full ml-auto transition-colors ${a?"bg-blue-500":"bg-transparent group-hover:bg-blue-500"}`})})]}),f.jsx("div",{className:"flex-1 min-w-0",children:i?f.jsx(_2,{}):r?f.jsx(j_,{sessionId:r,sessionInfo:C}):f.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:f.jsxs("div",{className:"text-center",children:[f.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:f.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),f.jsx("h3",{className:"mt-2 text-sm font-medium",children:"No session selected"}),f.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Select a session from the sidebar to view details"})]})})})]})}function E2(){return f.jsx(jw,{client:N0,children:f.jsx(f1,{children:f.jsxs($b,{children:[f.jsx(oa,{path:"/",element:f.jsx(Wb,{to:"/dashboard",replace:!0})}),f.jsx(oa,{path:"/dashboard",element:f.jsx(Hp,{})}),f.jsx(oa,{path:"/sessions/:sessionId",element:f.jsx(Hp,{})})]})})})}lu.createRoot(document.getElementById("root")).render(f.jsx(q0.StrictMode,{children:f.jsx(E2,{})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.left-1\/2{left:50%}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.-mt-px{margin-top:-1px}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-96{height:24rem}.h-full{height:100%}.h-screen{height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-4\/5{width:80%}.w-5\/6{width:83.333333%}.w-64{width:16rem}.w-8{width:2rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-col-resize{cursor:col-resize}.resize{resize:both}.auto-rows-fr{grid-auto-rows:minmax(0,1fr)}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-cyan-500\/20{border-color:#06b6d433}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-green-500\/20{border-color:#22c55e33}.border-orange-500\/20{border-color:#f9731633}.border-pink-500\/20{border-color:#ec489933}.border-purple-500\/20{border-color:#a855f733}.border-transparent{border-color:transparent}.border-t-gray-900{--tw-border-opacity: 1;border-top-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.bg-blue-900\/50{background-color:#1e3a8a80}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/30{background-color:#1f29374d}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/50{background-color:#11182780}.bg-gray-900\/70{background-color:#111827b3}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-900{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity, 1))}.bg-green-900\/30{background-color:#14532d4d}.bg-green-900\/50{background-color:#14532d80}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-pink-500\/10{background-color:#ec48991a}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-700{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/30{background-color:#713f124d}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-green-500{--tw-gradient-to: #22c55e var(--tw-gradient-to-position)}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-14{padding-left:3.5rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[10px\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-200{--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.\@container{container-type:inline-size}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}#root{width:100%;min-height:100vh}*{scrollbar-width:thin;scrollbar-color:#4B5563 #1F2937}*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-track{background:#1f2937}*::-webkit-scrollbar-thumb{background-color:#4b5563;border-radius:4px}*::-webkit-scrollbar-thumb:hover{background-color:#6b7280}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700\/50:hover{background-color:#37415180}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.hover\:text-gray-300:hover{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}@container (min-width: 300px){.\@\[300px\]\:inline{display:inline}.\@\[300px\]\:hidden{display:none}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
package/dist/client/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Claude Session Viewer</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BREABlIc.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-nqJgfpl7.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.right-0{right:0}.top-0{top:0}.z-10{z-index:10}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-96{height:24rem}.h-full{height:100%}.h-screen{height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-4\/5{width:80%}.w-5\/6{width:83.333333%}.w-64{width:16rem}.w-8{width:2rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-col-resize{cursor:col-resize}.resize{resize:both}.auto-rows-fr{grid-auto-rows:minmax(0,1fr)}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-cyan-500\/20{border-color:#06b6d433}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-green-500\/20{border-color:#22c55e33}.border-orange-500\/20{border-color:#f9731633}.border-pink-500\/20{border-color:#ec489933}.border-purple-500\/20{border-color:#a855f733}.border-transparent{border-color:transparent}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.bg-blue-900\/50{background-color:#1e3a8a80}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/30{background-color:#1f29374d}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/50{background-color:#11182780}.bg-gray-900\/70{background-color:#111827b3}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-900{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity, 1))}.bg-green-900\/30{background-color:#14532d4d}.bg-green-900\/50{background-color:#14532d80}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-pink-500\/10{background-color:#ec48991a}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-700{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/30{background-color:#713f124d}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-green-500{--tw-gradient-to: #22c55e var(--tw-gradient-to-position)}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-14{padding-left:3.5rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[10px\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-200{--tw-text-opacity: 1;color:rgb(187 247 208 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.\@container{container-type:inline-size}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}#root{width:100%;min-height:100vh}*{scrollbar-width:thin;scrollbar-color:#4B5563 #1F2937}*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-track{background:#1f2937}*::-webkit-scrollbar-thumb{background-color:#4b5563;border-radius:4px}*::-webkit-scrollbar-thumb:hover{background-color:#6b7280}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700\/50:hover{background-color:#37415180}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.hover\:text-gray-300:hover{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}@container (min-width: 300px){.\@\[300px\]\:inline{display:inline}.\@\[300px\]\:hidden{display:none}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
|